tempest.games 0.2.104 → 0.3.0

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.
@@ -1,66 +0,0 @@
1
- function kC(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in t)){const u=Object.getOwnPropertyDescriptor(r,o);u&&Object.defineProperty(t,o,u.get?u:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(o){if(o.ep)return;o.ep=!0;const u=n(o);fetch(o.href,u)}})();function CC(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xh={exports:{}},Fa={};var _S;function MC(){if(_S)return Fa;_S=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,o,u){var c=null;if(u!==void 0&&(c=""+u),o.key!==void 0&&(c=""+o.key),"key"in o){u={};for(var f in o)f!=="key"&&(u[f]=o[f])}else u=o;return o=u.ref,{$$typeof:t,type:r,key:c,ref:o!==void 0?o:null,props:u}}return Fa.Fragment=e,Fa.jsx=n,Fa.jsxs=n,Fa}var RS;function DC(){return RS||(RS=1,Xh.exports=MC()),Xh.exports}var F=DC();function ft(t){return ff(Ft.STORE,t,void 0)}function NC(t){return py(Ft.STORE,t,void 0)}function $C(t){return sy(Ft.STORE,t)}function nt(...t){return An(Ft.STORE,...t)}function P1(t){return TM(Ft.STORE,t)}function of(t,e){return EM(Ft.STORE,t)}const Kr={atom_family:"atom family",atom:"atom",continuity:"continuity",key:"key",mutable_atom_family:"atom family [m]",mutable_atom:"atom [m]",readonly_held_selector_family:"selector family [h]",readonly_held_selector:"selector [h]",readonly_pure_selector_family:"selector family",readonly_pure_selector:"selector",socket:"socket",state:"state",timeline:"timeline",transaction:"transaction",unknown:"unknown",user:"👤",writable_held_selector_family:"selector family [wh]",writable_held_selector:"selector [wh]",writable_pure_selector_family:"selector family [w]",writable_pure_selector:"selector [w]"},Zh=(t,e)=>(n,r,o,u,...c)=>{console[t](`${n} ${Kr[r]} \`${o}\` ${u}`,...c)},jC={error:Zh("error"),info:Zh("info"),warn:Zh("warn")};var BC=class{logLevel;filter;logger;constructor(t,e,n=jC){this.logLevel=t,this.filter=e,this.logger=n}error=(...t)=>{if(this.logLevel!==null){const e=this.filter?.(...t)??!0;e===!0?this.logger.error(...t):e&&this.logger.error(...e)}};info=(...t)=>{if(this.logLevel==="info"){const e=this.filter?.(...t)??!0;e===!0?this.logger.info(...t):e&&this.logger.info(...e)}};warn=(...t)=>{if(this.logLevel!=="error"&&this.logLevel!==null){const e=this.filter?.(...t)??!0;e===!0?this.logger.warn(...t):e&&this.logger.warn(...e)}}};function vc(t,e){return[t,e].sort().join("")}function zC(t){if(typeof t!="string")return null;const[e,n]=t.split("==");if(!n)return null;const r=e.slice(4),[o,u]=n.split("++");return r&&o&&u?[r,o,u]:null}function vi(t){return fT(Ft.STORE,t)}function Qm(t){return cM(Ft.STORE,t)}function De(...t){Lt(Ft.STORE,...t)}function LC(t,e,n=af()){return SM(Ft.STORE,t,e,n)}function VC(t){return iT(Ft.STORE,t)}function UC(t,e=af()){return ey(Ft.STORE,t,e)}const I1="",H1="",F1="",G1="",kS=t=>{if(t===null)return H1;switch(typeof t){case"string":return F1+t;case"number":return G1+t;case"boolean":return I1+ +t;case"object":return JSON.stringify(t)}},CS=t=>{switch(t[0]){case F1:return t.slice(1);case G1:return+t.slice(1);case I1:return t.slice(1)==="1";case H1:return null;case"[":return JSON.parse(t)}};function KC(t){return Object.entries(t)}function qC(t){const e={};let n=0;for(const r of t)e[r]=n,e[n]=r,++n;return e}function qr(t){return JSON.parse(t)}const zt=t=>JSON.stringify(t),MS=qC(["add","delete","clear"]);var Y1=class Xa extends Set{mode="record";subject=new We;constructor(e){super(e)}READONLY_VIEW=this;toJSON(){return[...this]}static fromJSON(e){return new Xa(e)}add(e){const n=super.add(e);return this.mode==="record"&&this.emit({type:"add",value:e}),n}clear(){const e=this.mode==="record"?[...this]:null;super.clear(),e&&this.emit({type:"clear",values:e})}delete(e){const n=super.delete(e);return this.mode==="record"&&this.emit({type:"delete",value:e}),n}subscribe(e,n){return this.subject.subscribe(e,n)}emit(e){this.subject.next(Xa.packUpdate(e))}do(e){this.mode="playback";const n=Xa.unpackUpdate(e);switch(n.type){case"add":this.add(n.value);break;case"delete":this.delete(n.value);break;case"clear":this.clear()}return this.mode="record",null}undo(e){const n=Xa.unpackUpdate(e);switch(this.mode="playback",n.type){case"add":this.delete(n.value);break;case"delete":this.add(n.value);break;case"clear":{const r=n.values;for(const o of r)this.add(o)}}return this.mode="record",null}static packUpdate(e){const n=MS[e.type]+"";return e.type==="clear"?n+e.values.map(kS).join(""):n+kS(e.value)}static unpackUpdate(e){const[n,r]=e.split(""),o=MS[n];return o==="clear"?{type:"clear",values:r.split("").map(CS)}:{type:o,value:CS(r)}}};function af(t=Math.random){return t().toString(36).slice(2)}function Re(t){for(;t.child!==null;)t=t.child;return t}function Wm(t){for(;t.parent!==null;)t=t.parent;return t}const PC=/^\[object (?:Async|Generator|AsyncGenerator)?Function\]$/;function Br(t){const e=Object.prototype.toString.call(t);return PC.test(e)}function DS(t,e){return Br(t)?t(e):t}var Ip=class extends Promise{fate;resolve;reject;done=!1;constructor(t){let e,n;super((r,o)=>{e=r,n=o}),this.resolve=e,this.reject=n,this.use(t instanceof Promise?t:new Promise(t))}pass(t,e){t===this.fate&&(this.resolve(e),this.done=!0)}fail(t,e){t===this.fate&&(this.reject(e),this.done=!0)}use(t){if(this!==t)if(t instanceof Promise){const e=t;this.fate=e,e.then(n=>{this.pass(e,n)},n=>{this.fail(e,n)})}else this.resolve(t),this.fate=void 0}},We=class{Subscriber;subscribers=new Map;subscribe(t,e){return this.subscribers.set(t,e),()=>{this.unsubscribe(t)}}unsubscribe(t){this.subscribers.delete(t)}next(t){const e=this.subscribers.values();for(const n of e)n(t)}},IC=class extends We{state;constructor(t){super(),this.state=t}next(t){this.state=t,super.next(t)}},HC=class J1{_buffer;_index=0;constructor(e){let n;typeof e=="number"?n=e:n=e.length,this._buffer=Array.from({length:n})}get buffer(){return this._buffer}get index(){return this._index}add(e){this._buffer[this._index]=e,this._index=(this._index+1)%this._buffer.length}copy(){const e=new J1([...this._buffer]);return e._index=this._index,e}};function zr(t){const e={key:t.key,type:t.type};return"family"in t&&(e.family=t.family),e}var Jn=class extends Map{deleted=new Set;changed=new Set;source;constructor(t){super(),this.source=t}get(t){if(super.has(t))return super.get(t);if(!this.deleted.has(t)&&this.source.has(t))return this.source.get(t)}set(t,e){return this.deleted.delete(t),this.source.has(t)&&this.changed.add(t),super.set(t,e)}hasOwn(t){return super.has(t)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.source.has(t)&&(this.deleted.add(t),this.changed.delete(t)),super.delete(t)}clear(){this.deleted=new Set(this.source.keys()),this.changed.clear(),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(const[t,e]of this.source)!this.deleted.has(t)&&!this.changed.has(t)&&(yield[t,e])}*entries(){yield*this[Symbol.iterator]()}*keys(){yield*super.keys();for(const t of this.source.keys())!this.deleted.has(t)&&!this.changed.has(t)&&(yield t)}*values(){for(const[,t]of this[Symbol.iterator]())yield t}forEach(t){for(const[e,n]of this[Symbol.iterator]())t(n,e,this)}get size(){return super.size+this.source.size-this.changed.size-this.deleted.size}},X1=class extends Set{deleted=new Set;source;constructor(t){super(),this.source=t}add(t){return this.source.has(t)?(this.deleted.delete(t),this):super.add(t)}hasOwn(t){return super.has(t)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.source.has(t)?(this.deleted.add(t),!0):super.delete(t)}clear(){this.deleted=new Set(this.source),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(const t of this.source)this.deleted.has(t)||(yield t)}*iterateOwn(){yield*super[Symbol.iterator]()}get size(){return super.size+this.source.size-this.deleted.size}},FC=class extends Map{deleted=new Set;source;constructor(t){super(),this.source=t}get(t){if(super.has(t))return super.get(t);if(!this.deleted.has(t)&&this.source.has(t)){const e=new X1(this.source.get(t));return super.set(t,e),e}}set(t,e){return this.deleted.delete(t),super.set(t,e)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.deleted.add(t),super.delete(t)}},Pi=class Z1{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(e,n)=>`${e}:${n}`;warn;getRelatedKeys(e){return this.relations.get(e)}addRelation(e,n){let r=this.relations.get(e),o=this.relations.get(n);r?r.add(n):(r=new Set([n]),this.relations.set(e,r)),o?o.add(e):(o=new Set([e]),this.relations.set(n,o))}deleteRelation(e,n){const r=this.relations.get(e);if(r){r.delete(n),r.size===0&&this.relations.delete(e);const o=this.relations.get(n);o&&(o.delete(e),o.size===0&&this.relations.delete(n))}}replaceRelationsUnsafely(e,n){this.relations.set(e,new Set(n));for(const r of n){const o=new Set().add(e);this.relations.set(r,o)}}replaceRelationsSafely(e,n){const r=this.relations.get(e);let o=this.isAType?.(e)?e:void 0,u=o===void 0?e:void 0;if(r)for(const c of r){o??=c,u??=c;const f=this.relations.get(c);f&&(f.size===1?this.relations.delete(c):f.delete(e),this.contents.delete(this.makeContentKey(o,u)))}this.relations.set(e,new Set(n));for(const c of n){let f=this.relations.get(c);f?f.add(e):(f=new Set().add(e),this.relations.set(c,f))}}getContentInternal(e){return this.contents.get(e)}setContent(e,n){this.contents.set(e,n)}deleteContent(e){this.contents.delete(e)}constructor(e,n){if(this.a=e.between[0],this.b=e.between[1],this.cardinality=e.cardinality,this.isAType=n?.isAType??null,this.isBType=n?.isBType??null,this.isContent=n?.isContent??null,n?.makeContentKey&&(this.makeContentKey=n.makeContentKey),!n?.externalStore){const r=n?.source;r===void 0&&(this.relations=new Map(e.relations?.map(([o,u])=>[o,new Set(u)])),this.contents=new Map(e.contents)),r&&(this.relations=new FC(r.relations),this.contents=new Jn(r.contents))}if(n?.externalStore){const r=n.externalStore;this.has=(o,u)=>r.has(o,u),this.addRelation=(o,u)=>{r.addRelation(o,u)},this.deleteRelation=(o,u)=>{r.deleteRelation(o,u)},this.replaceRelationsSafely=(o,u)=>{r.replaceRelationsSafely(o,u)},this.replaceRelationsUnsafely=(o,u)=>{r.replaceRelationsUnsafely(o,u)},this.getRelatedKeys=(o=>r.getRelatedKeys(o)),r.getContent&&(this.getContentInternal=o=>r.getContent(o),this.setContent=(o,u)=>{r.setContent(o,u)},this.deleteContent=o=>{r.deleteContent(o)});for(const[o,u]of e.relations??[]){let c=this.isAType?.(o)?o:void 0,f=c===void 0?o:void 0;for(const h of u)c??=h,f??=h,this.addRelation(c,f)}for(const[o,u]of e.contents??[])this.setContent(o,u)}n?.warn&&(this.warn=n.warn)}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([e,n])=>[e,[...n]]),contents:[...this.contents.entries()]}}set(...e){let n,r,o;switch(e.length){case 1:{const u=e[0];n=u[this.a],r=u[this.b],o=void 0;break}case 2:{const u=e[0];typeof u=="string"?[n,r]=e:(n=u[this.a],r=u[this.b],o=e[1]);break}default:n=e[0],r=e[1],o=e[2];break}switch(this.cardinality){case"1:1":{const u=this.getRelatedKey(n);u&&u!==r&&this.delete(n,u)}case"1:n":{const u=this.getRelatedKey(r);u&&u!==n&&this.delete(u,r)}break}if(o){const u=this.makeContentKey(n,r);this.setContent(u,o)}return this.addRelation(n,r),this}delete(e,n){n=typeof n=="string"?n:e[this.b];const r=typeof e=="string"?e:e[this.a];if(r===void 0&&typeof n=="string"){const o=this.getRelatedKeys(n);if(o)for(const u of o)this.delete(u,n)}else if(typeof r=="string"&&n===void 0){const o=this.getRelatedKeys(r);if(o)for(const u of o)this.delete(r,u)}else if(typeof r=="string"&&typeof n=="string"){this.deleteRelation(r,n);const o=this.makeContentKey(r,n);this.deleteContent(o)}return this}getRelatedKey(e){const n=this.getRelatedKeys(e);if(n){n.size>1&&this.warn?.(`${n.size} related keys were found for key "${e}": (${[...n].map(o=>`"${o}"`).join(", ")}). Only one related key was expected.`);let r;for(const o of n){r=o;break}return r}}replaceRelations(e,n,r){const o=!Array.isArray(n),u=o?Object.keys(n):n;if(r?.reckless?this.replaceRelationsUnsafely(e,u):this.replaceRelationsSafely(e,u),o)for(const c of u){const f=this.makeContentKey(e,c),h=n[c];this.setContent(f,h)}return this}getContent(e,n){const r=this.makeContentKey(e,n);return this.getContentInternal(r)}getRelationEntries(e){const n=e[this.a],r=e[this.b];if(n!==void 0&&r===void 0){const o=this.getRelatedKeys(n);if(o)return[...o].map(u=>[u,this.getContent(n,u)])}if(n===void 0&&r!==void 0){const o=this.getRelatedKeys(r);if(o)return[...o].map(u=>[u,this.getContent(u,r)])}return[]}has(e,n){return n?this.getRelatedKeys(e)?.has(n)??!1:this.relations.has(e)}overlay(){const e={source:this,makeContentKey:this.makeContentKey};return this.isAType&&(e.isAType=this.isAType),this.isBType&&(e.isBType=this.isBType),this.isContent&&(e.isContent=this.isContent),this.warn&&(e.warn=this.warn),new Z1({between:[this.a,this.b],cardinality:this.cardinality},e)}incorporate(e){const{relations:n,contents:r}=e;for(const[o,u]of n)if(u instanceof X1){const{source:c}=u;for(const f of u.iterateOwn())c.add(f)}else this.relations.set(o,u);for(const o of n.deleted)this.relations.delete(o);for(const[o,u]of r)this.contents.set(o,u);for(const o of r.deleted)this.contents.delete(o)}};function GC(t){return t.startsWith("🔍 ")}const YC=t=>{t.logger.info("🪂","transaction",t.transactionMeta.update.token.key,"Aborting transaction"),t.parent.child=null};function ey(t,e,n){return(...r)=>ct(t,e).run(r,n)}function JC(t,e,n){const{token:r,update:{newValue:o,oldValue:u}}=e;Lt(t,r,n==="newValue"?o:u)}function XC(t){const{stack:e}=t;return e?`
2
- `+e.split(`
3
- `)?.slice(1)?.join(`
4
- `):""}function Q1(t,e,n,r="any"){const o=e,u=zt(n),c=[],f=Re(t);if(Array.isArray(o))for(const y of o){const g=zt(y);f.molecules.get(g)?t.moleculeGraph.set(g,u,{source:g}):c.push(g)}else{const y=zt(o);f.molecules.get(y)?t.moleculeGraph.set(y,u,{source:y}):c.push(y)}const h=new We;c.length===0&&f.molecules.set(u,{key:n,stringKey:u,dependsOn:r,subject:h});const m={type:"molecule_creation",key:n,provenance:o,timestamp:Date.now()};Tn(f)&&f.transactionMeta.phase==="building"?f.transactionMeta.update.subEvents.push(m):f.on.moleculeCreation.next(m);for(const y of c){const g=t.disposalTraces.buffer.find(b=>b?.key===y);t.logger.error("❌","key",n,"allocation failed:",`Could not allocate to ${y} in store "${t.config.name}".`,g?`
5
- ${y} was most recently disposed
6
- ${g.trace}`:`No previous disposal trace for ${y} was found.`)}return n}function ty(t,e){const n=zt(e),r=t.molecules.get(n);if(!r){const b=t.disposalTraces.buffer.find(S=>S?.key===n);t.logger.error("❌","key",e,"deallocation failed:",`Could not find allocation for ${n} in store "${t.config.name}".`,b?`
7
- This state was most recently deallocated
8
- ${b.trace}`:`No previous disposal trace for ${n} was found.`);return}r.subject.next();const o=t.keyRefsInJoins.getRelatedKeys(n);if(o)for(const b of o){const S=t.joins.get(b);S&&S.relations.delete(e)}else{const b=zC(e);if(b){const[,S,x]=b,T=t.keyRefsInJoins.getRelatedKey(vc(S,x));if(T){const _=t.joins.get(T);_&&_.relations.delete(S,x)}}}t.keyRefsInJoins.delete(n);const u=[],c=[],f=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:n});if(f)for(const[b,{source:S}]of f)S===n?ty(t,qr(b)):u.push(S);const h=t.moleculeData.getRelatedKeys(r.stringKey);if(h)for(const b of h){const S=t.families.get(b),x=An(t,S,e);c.push([S.key,x]),lf(t,S,e)}const m={type:"molecule_disposal",key:r.key,values:c,provenance:u,timestamp:Date.now()};t.molecules.delete(n);const y=Tn(t)&&t.transactionMeta.phase==="building";y&&t.transactionMeta.update.subEvents.push(m),t.moleculeGraph.delete(r.stringKey),t.keyRefsInJoins.delete(r.stringKey),t.moleculeData.delete(r.stringKey),y||t.on.moleculeDisposal.next(m),t.molecules.delete(r.stringKey);const g=XC(new Error);t.disposalTraces.add({key:n,trace:g})}function NS(t,e,n,r){const o=zt(n),u=Re(t),c=u.molecules.get(o);if(!c){const g=t.disposalTraces.buffer.find(b=>b?.key===o);return t.logger.error("❌","key",o,"claim failed:",`Could not allocate to ${o} in store "${t.config.name}".`,g?`
9
- ${o} was most recently disposed
10
- ${g.trace}`:`No previous disposal trace for ${o} was found.`),n}const f=zt(e),h=u.molecules.get(f);if(!h){const g=t.disposalTraces.buffer.find(b=>b?.key===f);return t.logger.error("❌","key",n,"claim failed:",`Could not allocate to ${f} in store "${t.config.name}".`,g?`
11
- ${f} was most recently disposed
12
- ${g.trace}`:`No previous disposal trace for ${f} was found.`),n}const m=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:c.stringKey}).filter(([,{source:g}])=>g!==o).map(([g])=>qr(g));r&&u.moleculeGraph.delete(o),u.moleculeGraph.set({upstreamMoleculeKey:h.stringKey,downstreamMoleculeKey:c.stringKey},{source:h.stringKey});const y={type:"molecule_transfer",key:c.key,exclusive:!!r,from:m,to:[h.key],timestamp:Date.now()};return Tn(u)&&u.transactionMeta.phase==="building"&&u.transactionMeta.update.subEvents.push(y),n}function ZC(t,e,n){switch(n){case"newValue":W1(t,e);break;case"oldValue":lf(t,e.token);break}}function QC(t,e,n){switch(n){case"newValue":lf(t,e.token);break;case"oldValue":W1(t,e),e.subType==="atom"&&t.valueMap.set(e.token.key,e.value);break}}function W1(t,e){const{token:n}=e;e.subType==="writable"&&e.value?Lt(t,n,e.value):An(t,n)}function WC(t,e,n){switch(n){case"newValue":Q1(t,e.provenance,e.key);break;case"oldValue":ty(t,e.key);break}}function eM(t,e,n){switch(n){case"newValue":ty(t,e.key);break;case"oldValue":Q1(t,e.provenance.map(qr),e.key);for(const[r,o]of e.values){const u=t.families.get(r);if(u){An(t,u,e.key);const c=`${r}(${zt(e.key)})`;t.valueMap.set(c,o)}}break}}function tM(t,e,n){switch(n){case"newValue":for(const r of e.to)NS(t,r,e.key,e.exclusive?"exclusive":void 0);break;case"oldValue":{let r="exclusive";for(const o of e.from)NS(t,o,e.key,r),r=void 0}break}}function xo(t,e,n){const r=n==="newValue"?e.subEvents:[...e.subEvents].reverse();for(const o of r)switch(o.type){case"atom_update":JC(t,o,n);break;case"state_creation":ZC(t,o,n);break;case"state_disposal":QC(t,o,n);break;case"molecule_creation":WC(t,o,n);break;case"molecule_disposal":eM(t,o,n);break;case"molecule_transfer":tM(t,o,n);break;case"transaction_outcome":xo(t,o,n);break}}function ll(t){return"epoch"in t.transactionMeta}function Tn(t){return"phase"in t.transactionMeta}function eT(t,e){return t.transactionMeta.actionContinuities.getRelatedKey(e)}function tT(t,e){return t.transactionMeta.epoch.get(e)}function nM(t,e){const n=eT(t,e);if(n!==void 0)return tT(t,n)}function ny(t,e,n){t.transactionMeta.epoch.set(e,n)}function iM(t,e,n){const r=eT(t,e);r!==void 0&&t.transactionMeta.epoch.set(r,n)}function rM(t,e){const n=Re(t),{parent:r}=n;n.transactionMeta.phase="applying",n.transactionMeta.update.output=e,r.child=null,r.on.transactionApplying.next(n.transactionMeta);const{subEvents:o}=n.transactionMeta.update;t.logger.info("🛄","transaction",n.transactionMeta.update.token.key,`applying ${o.length} subEvents:`,o),xo(r,n.transactionMeta.update,"newValue"),ll(r)?(iM(r,n.transactionMeta.update.token.key,n.transactionMeta.update.epoch),ct(t,{key:n.transactionMeta.update.token.key,type:"transaction"})?.subject.next(n.transactionMeta.update),t.logger.info("🛬","transaction",n.transactionMeta.update.token.key,"applied")):Tn(r)&&r.transactionMeta.update.subEvents.push(n.transactionMeta.update),r.on.transactionApplying.next(null)}function nT(t,e,n){const{epoch:r,actionContinuities:o}=t.transactionMeta;o.set(e,n),r.has(e)||r.set(e,-1)}function sM(t){return{store:t}}const oM=(t,e,n,r)=>{const o=Re(t),u={parent:o,child:null,on:o.on,loggers:o.loggers,logger:o.logger,config:o.config,atoms:new Jn(o.atoms),atomsThatAreDefault:new Set(o.atomsThatAreDefault),families:new Jn(o.families),joins:new Jn(o.joins),operation:{open:!1},readonlySelectors:new Jn(o.readonlySelectors),timelines:new Jn(o.timelines),timelineTopics:o.timelineTopics.overlay(),trackers:new Map,transactions:new Jn(o.transactions),selectorAtoms:o.selectorAtoms.overlay(),selectorGraph:o.selectorGraph.overlay(),writableSelectors:new Jn(o.writableSelectors),valueMap:new Jn(o.valueMap),defaults:o.defaults,disposalTraces:t.disposalTraces.copy(),molecules:new Jn(o.molecules),moleculeGraph:o.moleculeGraph.overlay(),moleculeData:o.moleculeData.overlay(),keyRefsInJoins:o.keyRefsInJoins.overlay(),miscResources:new Jn(o.miscResources)},c=nM(t,e.key),f={phase:"building",update:{type:"transaction_outcome",token:e,id:r,epoch:c===void 0?NaN:c+1,timestamp:Date.now(),subEvents:[],params:n,output:void 0},toolkit:{get:((...m)=>An(h,...m)),set:((...m)=>{Lt(h,...m)}),reset:((...m)=>{ay(h,...m)}),run:(m,y=af())=>ey(h,m,y),find:((...m)=>Pr(t,...m)),json:m=>ks(h,m),dispose:((...m)=>{lf(h,...m)}),env:()=>sM(h)}},h=Object.assign(u,{transactionMeta:f});return o.child=h,t.logger.info("🛫","transaction",e.key,"building with params:",n),h};function iT(t,e){const{key:n}=e,r=t.transactions.has(n),o={key:n,type:"transaction",run:(c,f)=>{const h=oM(t,zr(o),c,f);try{const{toolkit:m}=h.transactionMeta,y=e.do(m,...c);return rM(h,y),y}catch(m){throw YC(h),t.logger.warn("💥","transaction",n,"caught:",m),m}},install:c=>iT(c,e),subject:new We};Re(t).transactions.set(n,o);const u=zr(o);return r||t.on.transactionCreation.next(u),u}var aM=class{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;writableSelectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new Pi({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new Pi({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});trackers=new Map;families=new Map;joins=new Map;transactions=new Map;transactionMeta={epoch:new Map,actionContinuities:new Pi({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new Pi({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new HC(100);molecules=new Map;moleculeGraph=new Pi({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});moleculeData=new Pi({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});keyRefsInJoins=new Pi({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});miscResources=new Map;on={atomCreation:new We,atomDisposal:new We,selectorCreation:new We,selectorDisposal:new We,timelineCreation:new We,transactionCreation:new We,transactionApplying:new IC(null),operationClose:new We,moleculeCreation:new We,moleculeDisposal:new We};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral",isProduction:!0};loggers=[new BC("warn",(t,e,n)=>!GC(n))];logger={error:(...t)=>{for(const e of this.loggers)e.error(...t)},info:(...t)=>{for(const e of this.loggers)e.info(...t)},warn:(...t)=>{for(const e of this.loggers)e.warn(...t)}};constructor(t,e=null){if(this.config={...e?.config,...t},e!==null){this.operation={...e?.operation},ll(e)&&(this.transactionMeta={epoch:new Map(e?.transactionMeta.epoch),actionContinuities:new Pi(e?.transactionMeta.actionContinuities.toJSON())});for(const[,r]of e.families)r.internalRoles?.includes("mutable")||r.internalRoles?.includes("join")||r.install(this);const n=new Set;for(const[,r]of e.atoms)if(!n.has(r.key)&&(r.install(this),r.type==="mutable_atom")){const o=ks(e,r),u=mT(r);n.add(o.key),n.add(u.key)}for(const[,r]of e.readonlySelectors)r.install(this);for(const[,r]of e.writableSelectors)n.has(r.key)||r.install(this);for(const[,r]of e.transactions)r.install(this);for(const[,r]of e.timelines)r.install(this)}}};const Ft={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new aM({name:"IMPLICIT_STORE",lifespan:"ephemeral",isProduction:!0}),globalThis.ATOM_IO_IMPLICIT_STORE}};var lM=class extends Error{constructor(t,e){super(`${Kr[t.type]} ${zt(t.key)} not found in store "${e.config.name}".`)}};function ct(t,e){let n,r=t;for(;r!==null;){switch(e.type){case"atom":case"mutable_atom":n=r.atoms.get(e.key);break;case"writable_pure_selector":case"writable_held_selector":n=r.writableSelectors.get(e.key);break;case"readonly_pure_selector":case"readonly_held_selector":n=r.readonlySelectors.get(e.key);break;case"atom_family":case"mutable_atom_family":case"writable_pure_selector_family":case"readonly_pure_selector_family":case"writable_held_selector_family":case"readonly_held_selector_family":n=r.families.get(e.key);break;case"timeline":n=r.timelines.get(e.key);break;case"transaction":n=r.transactions.get(e.key);break}if(n)return n;r=r.child}throw new lM(e,t)}function rT(t,e,n,r){const o=t.disposalTraces.buffer.find(u=>u?.key===zt(r));switch(t.logger.error("❌",e.type,e.key,"gets a fallback value because key",r,"is not allocated",o?`This key was previously disposed:
13
- ${o.trace}`:"(no previous disposal trace found)"),n.type){case"mutable_atom_family":{if(t.defaults.has(n.key))return t.defaults.get(n.key);const u=new n.class;return t.defaults.set(n.key,u),u.READONLY_VIEW}case"atom_family":{if(t.defaults.has(n.key))return t.defaults.get(n.key);const u=n.default,c=u(r);return t.defaults.set(n.key,c),c}case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if(t.defaults.has(n.key))return t.defaults.get(n.key);const u=n.default(r);return t.defaults.set(n.key,u),u}}}function Nc(t,e){const{type:n,key:r,catch:o}=e;switch(n){case"readonly_pure_selector":case"writable_pure_selector":{let u;t.logger.info("🧮",n,r,"computing value");try{u=e.getFrom(t),u instanceof Promise&&(u=u.catch(c=>{if(t.logger.error("💥",n,r,"rejected:",c),o){for(const f of o)if(c instanceof f)return c}throw c}))}catch(c){if(t.logger.error("💥",n,r,"rejected:",c),o){for(const f of o)if(c instanceof f)return di(t,e,c)}throw c}return di(t,e,u)}case"atom":{let u;if(Br(e.default))try{u=e.default(),u instanceof Promise&&(u=u.catch(c=>{if(t.logger.error("💥",n,r,"rejected:",c),o){for(const f of o)if(c instanceof f)return c}throw c}))}catch(c){if(t.logger.error("💥",n,r,"rejected:",c),o){for(const f of o)if(c instanceof f)return u=di(t,e,c),t.logger.info("✨",e.type,r,"computed default",u),u}throw c}else u=e.default,t.logger.info("✨",e.type,r,"using static default",u);return di(t,e,u)}}}function Rs(t,e,n){if(t.valueMap.has(e.key))return yT(t,e,n);t.logger.info("❔",e.type,e.key,"value not found in cache");const{key:r}=e;switch(e.type){case"readonly_held_selector":case"writable_held_selector":return t.logger.info("🧮",e.type,r,"computing value"),e.getFrom(t);case"writable_pure_selector":case"readonly_pure_selector":case"atom":return Nc(t,e);case"mutable_atom":{const o=new e.class;return t.logger.info("✨",e.type,r,"created new instance",o),di(t,e,o)}}}function iy(t,e){return ct(t,{key:e.family.key,type:`${e.type}_family`})}const $S={atom_family:"atom",molecule_family:"molecule",mutable_atom_family:"mutable_atom",readonly_held_selector_family:"readonly_held_selector",readonly_pure_selector_family:"readonly_pure_selector",writable_held_selector_family:"writable_held_selector",writable_pure_selector_family:"writable_pure_selector"},ul=Symbol("MUST_CREATE"),uM=Symbol("DO_NOT_CREATE");function cl(t,e,n,r){const o=zt(r),u=e.molecules.get(o);if(!u&&e.config.lifespan==="immortal"){const{type:f,key:h}=n;return e.logger.warn("💣","key",o,"was used to mint a counterfeit token for",f,`"${h}"`),{counterfeit:!0,key:`${h}(${o})`,type:$S[f],family:{key:h,subKey:o}}}let c;if(t===ul)e.logger.info("👪",n.type,n.key,"adds member",typeof r=="string"?`\`${r}\``:r),c=n.create(r),u&&e.moleculeData.set(o,n.key);else{const{type:f,key:h}=n;return{key:`${h}(${o})`,type:$S[f],family:{key:h,subKey:o}}}return c}function ry(t,...e){let n,r,o,u,c;if(e.length===1){if(c=e[0],"family"in c){const h=iy(t,c);if(o=ct(t,h),u=qr(c.family.subKey),n=fl(t,h,u),"counterfeit"in c)return{token:c,family:o,subKey:u,isNew:!1};n?c=n:(r=cl(ul,t,h,u),c=r)}}else o=ct(t,e[0]),u=e[1],n=fl(t,o,u),n?c=n:(r=cl(ul,t,o,u),c=r);const f="counterfeit"in c;if(r&&f===!1&&o){let h;switch(c.type){case"readonly_pure_selector":case"readonly_held_selector":h="readable";break;case"atom":case"mutable_atom":case"writable_pure_selector":case"writable_held_selector":h="writable";break}const m={type:"state_creation",subType:h,token:c,timestamp:Date.now()};o.subject.next(m);const y=Re(t);if(c.family)if(ll(y))switch(c.type){case"atom":case"mutable_atom":t.on.atomCreation.next(c);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":t.on.selectorCreation.next(c);break}else Tn(y)&&y.on.transactionApplying.state===null&&y.transactionMeta.update.subEvents.push(m)}return{token:c,family:o,subKey:u,isNew:!!r}}function An(t,...e){const{token:n,family:r,subKey:o}=ry(t,...e);return"counterfeit"in n&&r&&o?rT(t,n,r,o):Rs(t,ct(t,n))}function fl(t,e,n){const r=zt(n),o=`${e.key}(${r})`,u=Re(t);let c;switch(e.type){case"atom_family":case"mutable_atom_family":c=u.atoms.get(o);break;case"writable_held_selector_family":case"writable_pure_selector_family":c=u.writableSelectors.get(o);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":c=u.readonlySelectors.get(o);break}return c&&zr(c)}function Pr(t,e,n){const r=ct(t,e),o=fl(t,e,n);return o||cl(uM,t,r,n)}function $c(t,e,n){const r=e.key,o="readonly_pure_selector_family",u={key:r,type:o},c=t.families.get(r);c&&t.config.isProduction===!0&&t.logger.error("❗",o,r,`Overwriting an existing ${Kr[c.type]} "${c.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new We,m={...u,create:y=>{const g=zt(y),b={key:r,subKey:g},S=`${r}(${g})`,x=Re(t),T={key:S,get:e.get(y)};return e.catch&&(T.catch=e.catch),cy(x,T,b)},internalRoles:n,subject:f,install:y=>$c(y,e),default:y=>e.get(y)({get:((...g)=>An(t,...g)),find:((...g)=>Pr(t,...g)),json:g=>ks(t,g)})};return t.families.set(r,m),u}function sy(t,e,n){const r={key:e.key,type:"atom_family"},o=t.families.get(e.key);o&&t.config.isProduction===!0&&t.logger.error("❗","atom_family",e.key,`Overwriting an existing ${Kr[o.type]} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const u=new We,f={...r,create:h=>{const m=zt(h),y={key:e.key,subKey:m},g=`${e.key}(${m})`,b=Re(t),S=e.default,x={key:g,default:Br(S)?()=>S(h):S};return e.effects&&(x.effects=e.effects(h)),e.catch&&(x.catch=e.catch),ff(b,x,y)},default:e.default,subject:u,install:h=>sy(h,e),internalRoles:n};return t.families.set(e.key,f),Br(e.default)===!1&&t.defaults.set(e.key,e.default),r}function sT(t,e,n){const r=e.key,o="readonly_held_selector_family",u={key:r,type:o},c=t.families.get(r);c&&t.config.isProduction===!0&&t.logger.error("❗",o,r,`Overwriting an existing ${Kr[c.type]} "${c.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new We,m={...u,create:y=>{const g=zt(y),b={key:r,subKey:g},S=`${r}(${g})`;return uy(Re(t),{key:S,const:e.const(y),get:e.get(y)},b)},internalRoles:n,subject:f,install:y=>sT(y,e),default:e.const};return t.families.set(r,m),u}function oT(t,e,n){const r=e.key,o="writable_held_selector_family",u={key:r,type:o},c=t.families.get(r);c&&t.config.isProduction===!0&&t.logger.error("❗",o,r,`Overwriting an existing ${Kr[c.type]} "${c.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new We,m={...u,create:y=>{const g=zt(y),b={key:r,subKey:g},S=`${r}(${g})`;return fy(Re(t),{key:S,const:e.const(y),get:e.get(y),set:e.set(y)},b)},internalRoles:n,subject:f,install:y=>oT(y,e),default:e.const};return t.families.set(r,m),u}function oy(t,e,n){const r=e.key,o="writable_pure_selector_family",u={key:r,type:o},c=t.families.get(r);c&&t.config.isProduction===!0&&t.logger.error("❗",o,r,`Overwriting an existing ${Kr[c.type]} "${c.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new We,m={...u,create:y=>{const g=zt(y),b={key:r,subKey:g},S=`${r}(${g})`,x=Re(t),T={key:S,get:e.get(y),set:e.set(y)};return e.catch&&(T.catch=e.catch),dy(x,T,b)},internalRoles:n,subject:f,install:y=>oy(y,e),default:y=>e.get(y)({get:((...g)=>An(t,...g)),find:((...g)=>Pr(t,...g)),json:g=>ks(t,g)})};return t.families.set(r,m),u}function cM(t,e){const n="set"in e,r="const"in e;return r&&n?oT(t,e,void 0):r?sT(t,e,void 0):n?oy(t,e):$c(t,e)}function lf(t,...e){let n;if(e.length===1)n=e[0];else{const r=e[0],o=e[1];n=Pr(t,r,o)}try{ct(t,n)}catch{t.logger.error("❌",n.type,n.key,`could not be disposed because it was not found in the store "${t.config.name}".`);return}switch(n.type){case"atom":case"mutable_atom":gy(t,n);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":vM(t,n);break}}function aT(t,e){if(t.operation.open){const n=performance.now();return t.logger.info("🚫",e.type,e.key,`deferring setState at T-${n} until setState for "${t.operation.token.key}" is done`),n}return t.operation={open:!0,done:new Set,prev:new Map,timestamp:Date.now(),token:e,subEvents:[]},t.logger.info("⭕",e.type,e.key,`operation start in store "${t.config.name}"${Tn(t)?` ${t.transactionMeta.phase} "${t.transactionMeta.update.token.key}"`:""}`),t}function lT(t){t.operation.open&&t.logger.info("🔴",t.operation.token.type,t.operation.token.key,`operation done in store "${t.config.name}"`),t.operation={open:!1},t.on.operationClose.next(t.operation)}const uT=(t,e)=>t.operation.open?t.operation.done.has(e):(t.logger.error("🐞","unknown",e,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0),uf=(t,e)=>{if(!t.operation.open){t.logger.error("🐞","unknown",e,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}t.operation.done.add(e)};function Hp(t,e,n,r,o){const{oldValue:u,newValue:c}=n,f="oldValue"in n,h=zr(e);if(r&&o){e.subject.next({newValue:c});const S={checkpoint:!0,type:"state_creation",subType:"writable",token:h,timestamp:Date.now(),value:c};t.operation.subEvents.push(S),o.subject.next(S);const x=Re(t);if(h.family)if(ll(x))switch(h.type){case"atom":case"mutable_atom":t.on.atomCreation.next(h);break;case"writable_pure_selector":case"writable_held_selector":t.on.selectorCreation.next(h);break}else Tn(x)&&x.on.transactionApplying.state===null&&x.transactionMeta.update.subEvents.push(S);return}const{key:m,subject:y,type:g}=e;let b;if(f?b={oldValue:ic(u)?u.READONLY_VIEW:u,newValue:ic(c)?c.READONLY_VIEW:c}:b={newValue:ic(c)?c.READONLY_VIEW:c},ll(t)){switch(g){case"mutable_atom":t.logger.info("📢",g,m,"is now (",c,") subscribers:",y.subscribers.keys());break;case"atom":case"writable_pure_selector":case"writable_held_selector":t.logger.info("📢",g,m,"went (",u,"->",c,") subscribers:",y.subscribers.keys())}y.next(b)}if(Tn(t)&&(g==="mutable_atom"||g==="atom")){if(t.on.transactionApplying.state===null){if(ic(c))return;const{timestamp:S}=t.operation,x={type:"atom_update",token:h,timestamp:S,update:b};t.transactionMeta.update.subEvents.push(x),t.logger.info("📁","atom",m,"stowed (",u,"->",c,")");return}if(yy(e,"tracker:signal")){const S=m.slice(1),x=t.atoms.get(S);Rs(t,x,"mut").do(b.newValue)===null&&my(t,x)}}}const jS=Symbol("UNSET"),Fp=(t,e,n)=>{let r,o;if(Br(n)){const u=Rs(t,e,"mut");r=u,o=n(u)}else t.valueMap.has(e.key)?r=yT(t,e,"mut"):e.type==="atom"&&!Br(e.default)?r=e.default:r=jS,o=n;return t.logger.info("⭐","atom",e.key,"setting value",o),o=di(t,e,o),uf(t,e.key),my(t,e),r===jS?{newValue:o}:{oldValue:r,newValue:o}};function Qh(t,e){switch(e.type){case"mutable_atom":return Fp(t,e,new e.class);case"atom":{let n;return Br(e.default)?n=Nc(t,e):n=e.default,Fp(t,e,n)}}}function fM(t,e){let n;switch(e.type){case"atom":case"mutable_atom":n=Qh(t,e);break;case"writable_held_selector":{const r=dl(t,e.key);for(const u of r.values())Hp(t,e,Qh(t,u),!1);const o=e.getFrom(t);n={oldValue:o,newValue:o}}break;case"writable_pure_selector":{const r=Nc(t,e),o=dl(t,e.key);for(const u of o.values())Hp(t,e,Qh(t,u),!1);n={oldValue:r,newValue:Nc(t,e)}}break}return n}function Lt(t,...e){Tl(Yp,t,...e)}const Gp=Symbol("RESET");function ay(t,...e){Lt(t,...e,Gp)}function dM(t,e,n){let r,o,u;const{type:c,key:f}=e;switch(e.type){case"writable_pure_selector":r=Rs(t,e,"mut"),o=DS(n,r),o=di(t,e,o);break;case"writable_held_selector":u=e.const,DS(n,u),r=u,o=u}return t.logger.info("⭐",c,f,"setting to",o),uf(t,f),e.setSelf(o),{oldValue:r,newValue:o}}const hM=(t,e,n)=>{let r;switch(e.type){case"atom":case"mutable_atom":r=Fp(t,e,n);break;case"writable_pure_selector":case"writable_held_selector":r=dM(t,e,n);break}return r},Yp=Symbol("OWN_OP"),ly=Symbol("JOIN_OP");function Tl(t,e,...n){let r,o,u,c,f,h;n.length===2?(u=n[0],h=n[1],"family"in u&&(c=iy(e,u),f=qr(u.family.subKey),r=fl(e,c,f),r?u=r:u=o=cl(ul,e,c,f))):(c=ct(e,n[0]),f=n[1],h=n[2],r=fl(e,c,f),r?u=r:u=o=cl(ul,e,c,f));const m=h===Gp?"reset":"set";let y;if(t===Yp){const S=aT(e,u);if(typeof S=="number"){const x=S,T=e.on.operationClose.subscribe(`waiting to ${m} "${u.key}" at T-${x}`,function(){T(),e.logger.info("🟢",u.type,u.key,"resuming deferred",m,`from T-${x}`),Tl(t,e,u,h)});return}y=S}else y=e;if("counterfeit"in u&&"family"in u){const S=u.family.subKey,x=e.disposalTraces.buffer.find(T=>T?.key===S);e.logger.error("❌",u.type,u.key,"could not be",m,"because key",S,"is not allocated.",x?`this key was previously disposed:${x.trace}`:"(no previous disposal trace found)");return}const g=ct(y,u);let b;h===Gp?b=fM(y,g):b=hM(y,g,h),Hp(y,g,b,!!o,c),t===Yp&&lT(y)}const cT=(t,e)=>Re(t).atoms.has(e),pM=(t,e)=>Re(t).writableSelectors.has(e),mM=(t,e)=>Re(t).readonlySelectors.has(e),yM=(t,e)=>cT(t,e)||pM(t,e)||mM(t,e);function BS(t,e){return Re(t).selectorGraph.getRelationEntries({downstreamSelectorKey:e}).filter(([n,{source:r}])=>r!==e).map(([n,{source:r}])=>r).filter(n=>yM(t,n))}function dl(t,e,n=new Set){const r=BS(t,e),o=new Map;for(;r.length>0;){const u=r.pop();if(!n.has(u))if(n.add(u),cT(t,u)){const c=t.atoms.get(u);o.set(c.key,c)}else r.push(...BS(t,u))}return o}function gM(t,e,n,r,o){const u=Re(t),{type:c,key:f}=r;if(c==="atom"||c==="mutable_atom")u.selectorAtoms.set({selectorKey:n,atomKey:f}),t.logger.info("🔍",e,n,`discovers root atom "${f}"`);else{const h=dl(t,f,o);t.logger.info("🔍",e,n,`discovers root atoms: [ ${[...h.values()].map(m=>`"${m.key}"`).join(", ")} ]`);for(const{key:m}of h.values())u.selectorAtoms=u.selectorAtoms.set({selectorKey:n,atomKey:m})}o.add(f)}function cf(t,e,n,r){return{get:(...o)=>{const u=Re(t),{token:c,family:f,subKey:h}=ry(t,...o);let m;return"counterfeit"in c&&f&&h?m=rT(t,c,f,h):m=Rs(t,ct(t,c)),t.logger.info("🔌",e,n,`registers dependency ( "${c.key}" =`,m,")"),u.selectorGraph.set({upstreamSelectorKey:c.key,downstreamSelectorKey:n},{source:c.key}),gM(t,e,n,c,r),m},set:((...o)=>{Tl(ly,Re(t),...o)}),find:((...o)=>Pr(t,...o)),json:o=>ks(t,o)}}function uy(t,e,n){const r=Re(t),o=new We,u=new Set,{key:c,const:f}=e,h="readonly_held_selector";t.logger.info("🔨",h,c,"is being created");const{get:m,find:y,json:g}=cf(r,h,c,u),S={...e,type:h,subject:o,getFrom:T=>{const _=T.selectorGraph.getRelationEntries({downstreamSelectorKey:c});for(const[k,{source:C}]of _)C!==c&&T.selectorGraph.delete(k,c);return T.selectorAtoms.delete(c),e.get({get:m,find:y,json:g},f),di(T,S,f),t.logger.info("✨",h,c,"=",f),u.clear(),f},install:T=>uy(T,e,n)};n&&(S.family=n),r.readonlySelectors.set(c,S);const x={key:c,type:h};return n&&(x.family=n),x}function cy(t,e,n){const r=Re(t),o=new We,u=new Set,c=e.key,f="readonly_pure_selector";t.logger.info("🔨",f,c,"is being created");const{get:h,find:m,json:y}=cf(r,f,c,u),b={...e,type:f,subject:o,getFrom:()=>{const x=Re(t),T=x.selectorGraph.getRelationEntries({downstreamSelectorKey:c});for(const[k,{source:C}]of T)C!==c&&x.selectorGraph.delete(k,c);x.selectorAtoms.delete(c);const _=e.get({get:h,find:m,json:y});return t.logger.info("✨",f,c,"=",_),u.clear(),_},install:x=>cy(x,e,n)};n&&(b.family=n),r.readonlySelectors.set(c,b);const S={key:c,type:f};return n&&(S.family=n),S}function fy(t,e,n){const r=Re(t),o=new We,u=new Set,{key:c,const:f}=e,h="writable_held_selector";t.logger.info("🔨",h,c,"is being created");const m=cf(r,h,c,u),{find:y,get:g,json:b}=m,S={find:y,get:g,json:b},_={...e,type:h,subject:o,getFrom:C=>{const M=C.selectorGraph.getRelationEntries({downstreamSelectorKey:c});for(const[G,{source:I}]of M)I!==c&&C.selectorGraph.delete(G,c);return C.selectorAtoms.delete(c),e.get(S,f),di(C,_,f),t.logger.info("✨",h,c,"=",f),u.clear(),f},setSelf:()=>{e.set(m,f)},install:C=>fy(C,e,n)};n&&(_.family=n),r.writableSelectors.set(c,_);const k={key:c,type:h};return n&&(k.family=n),k}function dy(t,e,n){const r=Re(t),o=new We,u=new Set,c=e.key,f="writable_pure_selector";t.logger.info("🔨",f,c,"is being created");const h=cf(r,f,c,u),{find:m,get:y,json:g}=h,b={find:m,get:y,json:g},T={...e,type:f,subject:o,getFrom:k=>{const C=k.selectorGraph.getRelationEntries({downstreamSelectorKey:c});for(const[G,{source:I}]of C)I!==c&&k.selectorGraph.delete(G,c);k.selectorAtoms.delete(c);const M=e.get(b);return t.logger.info("✨",f,c,"=",M),u.clear(),M},setSelf:k=>{e.set(h,k)},install:k=>dy(k,e,n)};n&&(T.family=n),r.writableSelectors.set(c,T);const _={key:c,type:f};return n&&(_.family=n),_}function fT(t,e){const n="set"in e,r="const"in e;if(r&&n){const u=fy(t,e,void 0);return t.on.selectorCreation.next(u),u}if(r){const u=uy(t,e,void 0);return t.on.selectorCreation.next(u),u}if(n){const u=dy(t,e,void 0);return t.on.selectorCreation.next(u),u}const o=cy(t,e,void 0);return t.on.selectorCreation.next(o),o}function vM(t,e){const n=Re(t),{key:r,type:o,family:u}=e;if(!u)t.logger.error("❌",o,r,"Standalone selectors cannot be disposed.");else{n.molecules.get(u.subKey)&&n.moleculeData.delete(u.subKey,u.key);let c;switch(e.type){case"writable_held_selector":n.writableSelectors.delete(r),c={key:u.key,type:"writable_held_selector_family"},ct(t,c).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"writable_pure_selector":n.writableSelectors.delete(r),c={key:u.key,type:"writable_pure_selector_family"},ct(t,c).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"readonly_held_selector":n.readonlySelectors.delete(r),c={key:u.key,type:"readonly_held_selector_family"},ct(t,c).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"readonly_pure_selector":n.readonlySelectors.delete(r),c={key:u.key,type:"readonly_pure_selector_family"},ct(t,c).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break}n.valueMap.delete(r),n.selectorAtoms.delete(r),n.selectorGraph.delete(r),n.moleculeData.delete(u.key,u.subKey),t.logger.info("🔥",e.type,r,"deleted"),Tn(n)&&n.transactionMeta.phase==="building"?n.transactionMeta.update.subEvents.push({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()}):t.on.selectorDisposal.next(e)}}const bM=(t,e)=>{const n=Re(t);return n.operation.open?n.operation.prev.get(e.key):n.valueMap.get(e.key)},zS=(t,e,n)=>n.subject.subscribe(`${e.type}:${e.key}`,r=>{t.logger.info("📢",e.type,e.key,"root",n.key,"went",r.oldValue,"->",r.newValue);const o=bM(t,e),u=Rs(t,e);t.logger.info("✨",e.type,e.key,"went",o,"->",u),e.subject.next({newValue:u,oldValue:o})});function Ts(t,e,n,r){function o(g){t.operation.open&&u?.type==="atom"&&yy(u,"tracker:signal")&&"*"+t.operation.token.key===e.key&&"inboundTracker"in r||r(g)}ry(t,e);const u=ct(t,e);t.logger.info("👀",u.type,u.key,`Adding subscription "${n}"`);const c=u.type==="writable_pure_selector"||u.type==="readonly_pure_selector",f=new Map;let h=o;if(c){Rs(t,u);for(const[g,b]of dl(t,u.key))f.set(g,zS(t,u,b));h=function(b){const S=dl(t,u.key);for(const[x,T]of f)S.get(x)?S.delete(x):(T(),f.delete(x));for(const[x,T]of S)f.set(x,zS(t,u,T));o(b)}}const m=u.subject.subscribe(n,h);return()=>{t.logger.info("🙈",u.type,u.key,`Removing subscription "${n}"`),m();for(const g of f.values())g()}}const dT=(t,e,n,r)=>{const o=ct(t,e);t.logger.info("👀","timeline",e.key,`Adding subscription "${n}"`);const u=o.subject.subscribe(n,r);return()=>{t.logger.info("🙈","timeline",e.key,`Removing subscription "${n}" from timeline`),u()}},hT=(t,e,n,r)=>{const o=ct(t,e);t.logger.info("👀","transaction",e.key,`Adding subscription "${n}"`);const u=o.subject.subscribe(n,r);return()=>{t.logger.info("🙈","transaction",e.key,`Removing subscription "${n}"`),u()}};function SM(t,e,n,r=af()){switch(e.type){case"atom":case"mutable_atom":case"readonly_pure_selector":case"readonly_held_selector":case"writable_pure_selector":case"writable_held_selector":return Ts(t,e,r,n);case"transaction":return hT(t,e,r,n);case"timeline":return dT(t,e,r,n)}}var hy=class{initializeSignalAtom(t,e){const n=`*${t.key}`;e.atoms.delete(n),e.valueMap.delete(n);const r=t.family?{key:`*${t.family.key}`,subKey:t.family.subKey}:void 0,o=ff(e,{key:n,default:null},r,["tracker:signal"]);if(e.parent?.valueMap.has(n)){const u=e.parent.valueMap.get(n);e.valueMap.set(n,u)}return o}unsubscribeFromInnerValue;unsubscribeFromState;captureSignalsFromCore(t,e,n){const r=t.key,o=`tracker-from-core:${n.config.name}:${Tn(n)?n.transactionMeta.update.token.key:"main"}:${r}`,u=c=>{Tl(ly,n,e,c)};this.unsubscribeFromInnerValue=An(n,t).subscribe(o,u),this.unsubscribeFromState=Ts(n,t,o,(function(f){f.newValue!==f.oldValue&&(this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=f.newValue.subscribe(o,u))}).bind(this))}supplySignalsToCore(t,e,n){const r=t.key,o=`tracker-to-core:${n.config.name}:${Tn(n)?n.transactionMeta.update.token.key:"main"}:${r}`;Ts(n,e,o,Object.assign(function({newValue:c,oldValue:f}){const h=n.timelineTopics.getRelatedKey(e.key);if(h&&n.timelines.get(h)?.timeTraveling){const m=dT(n,{key:h,type:"timeline"},o,function(g){m(),Lt(n,t,b=>(g==="redo"&&c?b.do(c):g==="undo"&&f&&b.undo(f),b))});return}Lt(n,t,m=>(m.do(c),m))},{inboundTracker:!0}))}mutableAtomToken;latestSignalToken;[Symbol.dispose];constructor(t,e){const n=Re(e),r=this.initializeSignalAtom(t,n);this.mutableAtomToken=t,this.latestSignalToken=r,this.captureSignalsFromCore(t,r,n),this.supplySignalsToCore(t,r,n),n.trackers.set(t.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),n.trackers.delete(t.key)}}};function py(t,e,n){t.logger.info("🔨","atom",e.key,`creating in store "${t.config.name}"`);const r=Re(t),{key:o}=e,u=r.atoms.get(o),c="mutable_atom";if(u?.type===c&&t.config.isProduction===!0)return t.logger.error("❌",c,o,"Tried to create atom, but it already exists in the store."),zr(u);const f=new We,h={...e,type:c,install:y=>(y.logger.info("🛠️","atom",o,`installing in store "${y.config.name}"`),py(y,e,n)),subject:f};n&&(h.family=n),r.atoms.set(h.key,h);const m=zr(h);if(new hy(m,t),n||fT(t,{key:`${o}:JSON`,get:({get:y})=>y(m).toJSON(),set:({set:y},g)=>{y(m,e.class.fromJSON(g))}}),e.effects){let y=0;const g=[];for(const b of e.effects){const S=b({resetSelf:()=>{ay(t,m)},setSelf:x=>{Lt(t,m,x)},onSet:x=>Ts(t,m,`effect[${y}]`,x),token:m,store:Wm(t)});S&&g.push(S),++y}h.cleanup=()=>{for(const b of g)b()}}return t.on.atomCreation.next(m),m}var wM=class{trackers=new Map;latestSignalAtoms;mutableAtoms;constructor(t,e){this.latestSignalAtoms=ct(e,sy(e,{key:`*${t.key}`,default:null},["mutable","updates"])),this.mutableAtoms=t;const n=r=>{const{type:o,token:u}=r;if(u.family){const c=qr(u.family.subKey);switch(o){case"state_creation":this.trackers.set(c,new hy(u,e));break;case"state_disposal":{const f=this.trackers.get(c);f&&(f[Symbol.dispose](),this.trackers.delete(c))}}}};this.mutableAtoms.subject.subscribe(`store=${e.config.name}::tracker-atom-family`,n)}};function pT(t,e,n){const r={key:e.key,type:"mutable_atom_family"},o=t.families.get(e.key);o&&t.config.isProduction===!0&&t.logger.error("❗","mutable_atom_family",e.key,`Overwriting an existing ${Kr[o.type]} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const u=new We,f={...r,create:h=>{const m=zt(h),y={key:e.key,subKey:m},g=`${e.key}(${m})`,b=Re(t),S={key:g,class:e.class};return e.effects&&(S.effects=e.effects(h)),py(b,S,y)},class:e.class,subject:u,install:h=>pT(h,e),internalRoles:n};return t.families.set(e.key,f),oy(t,{key:`${e.key}:JSON`,get:h=>({get:m})=>m(r,h).toJSON(),set:h=>({set:m},y)=>{m(r,h,e.class.fromJSON(y))}},["mutable","json"]),new wM(f,t),r}const xM=(t,e)=>{const n=Re(e),r=`${t.key}:JSON`;return n.families.get(r)},ks=(t,e)=>e.family?Pr(t,ct(Re(t),{key:`${e.family.key}:JSON`,type:"writable_pure_selector_family"}),qr(e.family.subKey)):{type:"writable_pure_selector",key:`${e.key}:JSON`},mT=t=>{const e={type:"atom",key:`*${t.key}`};return t.family&&(e.family={key:`*${t.family.key}`,subKey:t.family.subKey}),e};function ic(t){return typeof t=="object"&&t!==null&&"do"in t&&"undo"in t&&"subscribe"in t&&"READONLY_VIEW"in t&&"toJSON"in t}function di(t,e,n){const{key:r,subject:o,type:u}=e,c=t.valueMap.get(r);if(c instanceof Ip&&!c.done){const f=c;return n instanceof Promise?(f.use(n),f):(t.valueMap.set(r,n),n)}if(n instanceof Promise){const f=new Ip(n);return t.valueMap.set(r,f),f.then(function(m){if(t.valueMap.get(r)===f){switch(aT(t,e),di(t,e,m),u){case"atom":my(t,e);break;case"readonly_pure_selector":case"writable_pure_selector":vT(t,r);break}lT(t),o.next({newValue:m,oldValue:f})}}).catch(h=>{t.logger.error("💥",e.type,r,"rejected:",h)}),f}return t.logger.info("📝",e.type,e.key,"writing to cache",n),t.valueMap.set(r,n),n}function yT(t,e,n){t.logger.info("📖",e.type,e.key,"reading cached value");let r=t.valueMap.get(e.key);if(n==="mut"&&e.type==="mutable_atom"&&Tn(t)){const o=e,{parent:u}=t;if(t.valueMap.hasOwn(o.key))return r;const c=u.valueMap.get(o.key);t.logger.info("📃","atom",o.key,"copying");const f=c.toJSON(),h=o.class.fromJSON(f);t.valueMap.set(o.key,h),new hy(o,u),r=h}return r}function gT(t,e){const n=t.valueMap.get(e);n instanceof Ip||(t.operation.open&&t.operation.prev.set(e,n),t.valueMap.delete(e),t.logger.info("🗑","state",e,"evicted"))}function my(t,e){const n=Re(t),{key:r,type:o}=e,u=n.selectorAtoms.getRelatedKeys(r);if(n.logger.info("🧹",o,r,u?`evicting ${u.size} states downstream:`:"no downstream states",u??"to evict"),u){n.operation.open&&n.logger.info("🧹",o,r,`[ ${[...n.operation.done].join(", ")} ] already done`);for(const c of u)uT(n,c)||(gT(n,c),uf(n,c))}}function vT(t,e){const n=Re(t),r=n.selectorGraph.getRelationEntries({upstreamSelectorKey:e}).filter(([o,{source:u}])=>u===e);for(const[o]of r)uT(n,o)||(gT(n,o),uf(n,o),vT(t,o))}function ff(t,e,n,r){const o="atom",{key:u}=e;t.logger.info("🔨",o,u,"is being created");const c=Re(t),f=c.atoms.get(u);if(f?.type===o&&t.config.isProduction===!0)return t.logger.error("❌","atom",u,"Tried to create atom, but it already exists in the store."),zr(f);const h=new We,m={...e,type:o,install:g=>(g.logger.info("🛠️",o,u,`installing in store "${g.config.name}"`),ff(g,e,n)),subject:h};n&&(m.family=n),r&&(m.internalRoles=r),c.atoms.set(u,m);const y=zr(m);if(e.effects){let g=0;const b=[];for(const S of e.effects){const x=S({resetSelf:()=>{ay(t,y)},setSelf:T=>{Lt(t,y,T)},onSet:T=>Ts(t,y,`effect[${g}]`,T),token:y,store:Wm(t)});x&&b.push(x),++g}m.cleanup=()=>{for(const S of b)S()}}return t.on.atomCreation.next(y),y}function yy(t,e){return"internalRoles"in t?t.internalRoles.includes(e):!1}function gy(t,e){const n=Re(t),{key:r,family:o}=e,u=ct(n,e);if(!o)t.logger.error("❌","atom",r,"Standalone atoms cannot be disposed.");else{u.cleanup?.();const c=t.valueMap.get(u.key),f=ct(t,iy(t,e)).subject,h={type:"state_disposal",subType:"atom",token:e,value:c,timestamp:Date.now()};f.next(h);const m=Tn(n);if(n.atoms.delete(r),n.valueMap.delete(r),n.selectorAtoms.delete(r),n.atomsThatAreDefault.delete(r),n.moleculeData.delete(o.key,o.subKey),t.timelineTopics.delete(r),e.type==="mutable_atom"&&(gy(t,mT(e)),t.trackers.delete(r)),t.logger.info("🔥","atom",r,"deleted"),m&&n.transactionMeta.phase==="building"){const y=n.transactionMeta.update.subEvents.at(-1),g=y?.type==="molecule_disposal"&&y.values.some(([S])=>S===u.family?.key),b=yy(u,"tracker:signal");!g&&!b&&n.transactionMeta.update.subEvents.push(h)}else t.on.atomDisposal.next(e)}}function hs(t){return t[0].toUpperCase()+t.slice(1)}var bT=class{toolkit;options;relations;states;relatedKeysAtoms;transact(t,e){const n=this.toolkit;this.toolkit=t,e(this),this.toolkit=n}store;[Symbol.dispose](){}constructor(t,e){this.store=t,this.options=e,this.store.miscResources.set(`join:${e.key}`,this),this.toolkit={get:((...y)=>An(t,...y)),set:((...y)=>{Lt(t,...y)}),find:((...y)=>Pr(t,...y)),json:y=>ks(t,y)};const n=e.between[0],r=e.between[1],o=pT(t,{key:`${e.key}/relatedKeys`,class:Y1},["join","relations"]);this.relatedKeysAtoms=o;const u=(y,g,b)=>{const{find:S,get:x,set:T}=y,_=S(o,g),k=x(_);for(const C of k)b.includes(C)||T(o,C,M=>(M.delete(g),M));T(_,C=>{C.clear();for(const M of b){const G=S(o,M),I=x(G),ee=I.has(g);if(this.relations.cardinality==="1:n"){const J=[];for(const X of I){if(X===g)continue;let he;Tl(ly,this.store,o,X,pe=>(pe.delete(M),he=pe.size,pe)),he===0&&J.push(X)}!ee&&I.size>0&&T(G,X=>(X.clear(),X));for(const X of J)t.keyRefsInJoins.delete(vc(M,X))}ee||T(G,J=>(J.add(g),J)),C.add(M)}return C})},c=(y,g,b)=>{const{set:S}=y;S(o,g,x=>{for(const T of b)x.add(T);return x});for(const x of b)S(o,x,T=>(T.add(g),T));return!0},f=new Pi(e,{externalStore:{getRelatedKeys:y=>this.toolkit.get(o,y),addRelation:(y,g)=>{this.store.keyRefsInJoins.set(`"${y}"`,e.key),this.store.keyRefsInJoins.set(`"${g}"`,e.key),this.store.keyRefsInJoins.set(vc(y,g),e.key),this.toolkit.set(o,y,b=>b.add(g)),this.toolkit.set(o,g,b=>b.add(y))},deleteRelation:(y,g)=>{this.toolkit.set(o,y,S=>(S.delete(g),S)),this.toolkit.set(o,g,S=>(S.delete(y),S));const b=vc(y,g);this.store.keyRefsInJoins.delete(b)},replaceRelationsSafely:(y,g)=>{u(this.toolkit,y,g)},replaceRelationsUnsafely:(y,g)=>{c(this.toolkit,y,g)},has:(y,g)=>{const b=this.toolkit.get(o,y);return g?b.has(g):b.size>0}},isAType:e.isAType,isBType:e.isBType}),h=()=>$c(t,{key:`${e.key}/singleRelatedKey`,get:y=>({get:g})=>{const b=g(o,y);for(const S of b)return S;return null}},["join","keys"]),m=()=>$c(t,{key:`${e.key}/multipleRelatedKeys`,get:y=>({get:g})=>g(xM(o,t),y)},["join","keys"]);switch(e.cardinality){case"1:1":{const y=h(),g=`${n}KeyOf${hs(r)}`,b=`${r}KeyOf${hs(n)}`;this.relations=f,this.states={[g]:y,[b]:y};break}case"1:n":{const y=h(),g=m(),b=`${n}KeyOf${hs(r)}`,S=`${r}KeysOf${hs(n)}`,x={[b]:y,[S]:g};this.relations=f,this.states=x;break}case"n:n":{const y=m(),g=`${n}KeysOf${hs(r)}`,b=`${r}KeysOf${hs(n)}`;this.relations=f,this.states={[g]:y,[b]:y}}}}};function TM(t,e){return t.joins.set(e.key,new bT(t,e)),{key:e.key,type:"join",a:e.between[0],b:e.between[1],cardinality:e.cardinality}}function AM(t,e){let n=t.joins.get(e.key);if(n===void 0){const r=Ft.STORE.joins.get(e.key);if(r===void 0)throw new Error(`Join "${e.key}" not found in store "${t.config.name}"`);n=new bT(Wm(t),r.options),t.joins.set(e.key,n)}return n}function EM(t,e,n){const r=AM(t,e);return[r.relatedKeysAtoms,r.relatedKeysAtoms]}var Wh={exports:{}},ye={};var LS;function OM(){if(LS)return ye;LS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function S(E){return E===null||typeof E!="object"?null:(E=b&&E[b]||E["@@iterator"],typeof E=="function"?E:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,_={};function k(E,q,H){this.props=E,this.context=q,this.refs=_,this.updater=H||x}k.prototype.isReactComponent={},k.prototype.setState=function(E,q){if(typeof E!="object"&&typeof E!="function"&&E!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,E,q,"setState")},k.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function C(){}C.prototype=k.prototype;function M(E,q,H){this.props=E,this.context=q,this.refs=_,this.updater=H||x}var G=M.prototype=new C;G.constructor=M,T(G,k.prototype),G.isPureReactComponent=!0;var I=Array.isArray;function ee(){}var J={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function he(E,q,H){var Q=H.ref;return{$$typeof:t,type:E,key:q,ref:Q!==void 0?Q:null,props:H}}function pe(E,q){return he(E.type,q,E.props)}function we(E){return typeof E=="object"&&E!==null&&E.$$typeof===t}function je(E){var q={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(H){return q[H]})}var be=/\/+/g;function Z(E,q){return typeof E=="object"&&E!==null&&E.key!=null?je(""+E.key):q.toString(36)}function ne(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(ee,ee):(E.status="pending",E.then(function(q){E.status==="pending"&&(E.status="fulfilled",E.value=q)},function(q){E.status==="pending"&&(E.status="rejected",E.reason=q)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function j(E,q,H,Q,re){var ce=typeof E;(ce==="undefined"||ce==="boolean")&&(E=null);var Te=!1;if(E===null)Te=!0;else switch(ce){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(E.$$typeof){case t:case e:Te=!0;break;case y:return Te=E._init,j(Te(E._payload),q,H,Q,re)}}if(Te)return re=re(E),Te=Q===""?"."+Z(E,0):Q,I(re)?(H="",Te!=null&&(H=Te.replace(be,"$&/")+"/"),j(re,q,H,"",function(ni){return ni})):re!=null&&(we(re)&&(re=pe(re,H+(re.key==null||E&&E.key===re.key?"":(""+re.key).replace(be,"$&/")+"/")+Te)),q.push(re)),1;Te=0;var Rt=Q===""?".":Q+":";if(I(E))for(var Je=0;Je<E.length;Je++)Q=E[Je],ce=Rt+Z(Q,Je),Te+=j(Q,q,H,ce,re);else if(Je=S(E),typeof Je=="function")for(E=Je.call(E),Je=0;!(Q=E.next()).done;)Q=Q.value,ce=Rt+Z(Q,Je++),Te+=j(Q,q,H,ce,re);else if(ce==="object"){if(typeof E.then=="function")return j(ne(E),q,H,Q,re);throw q=String(E),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return Te}function U(E,q,H){if(E==null)return E;var Q=[],re=0;return j(E,Q,"","",function(ce){return q.call(H,ce,re++)}),Q}function L(E){if(E._status===-1){var q=E._result;q=q(),q.then(function(H){(E._status===0||E._status===-1)&&(E._status=1,E._result=H)},function(H){(E._status===0||E._status===-1)&&(E._status=2,E._result=H)}),E._status===-1&&(E._status=0,E._result=q)}if(E._status===1)return E._result.default;throw E._result}var te=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},oe={map:U,forEach:function(E,q,H){U(E,function(){q.apply(this,arguments)},H)},count:function(E){var q=0;return U(E,function(){q++}),q},toArray:function(E){return U(E,function(q){return q})||[]},only:function(E){if(!we(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return ye.Activity=g,ye.Children=oe,ye.Component=k,ye.Fragment=n,ye.Profiler=o,ye.PureComponent=M,ye.StrictMode=r,ye.Suspense=h,ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=J,ye.__COMPILER_RUNTIME={__proto__:null,c:function(E){return J.H.useMemoCache(E)}},ye.cache=function(E){return function(){return E.apply(null,arguments)}},ye.cacheSignal=function(){return null},ye.cloneElement=function(E,q,H){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var Q=T({},E.props),re=E.key;if(q!=null)for(ce in q.key!==void 0&&(re=""+q.key),q)!X.call(q,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&q.ref===void 0||(Q[ce]=q[ce]);var ce=arguments.length-2;if(ce===1)Q.children=H;else if(1<ce){for(var Te=Array(ce),Rt=0;Rt<ce;Rt++)Te[Rt]=arguments[Rt+2];Q.children=Te}return he(E.type,re,Q)},ye.createContext=function(E){return E={$$typeof:c,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:u,_context:E},E},ye.createElement=function(E,q,H){var Q,re={},ce=null;if(q!=null)for(Q in q.key!==void 0&&(ce=""+q.key),q)X.call(q,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(re[Q]=q[Q]);var Te=arguments.length-2;if(Te===1)re.children=H;else if(1<Te){for(var Rt=Array(Te),Je=0;Je<Te;Je++)Rt[Je]=arguments[Je+2];re.children=Rt}if(E&&E.defaultProps)for(Q in Te=E.defaultProps,Te)re[Q]===void 0&&(re[Q]=Te[Q]);return he(E,ce,re)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(E){return{$$typeof:f,render:E}},ye.isValidElement=we,ye.lazy=function(E){return{$$typeof:y,_payload:{_status:-1,_result:E},_init:L}},ye.memo=function(E,q){return{$$typeof:m,type:E,compare:q===void 0?null:q}},ye.startTransition=function(E){var q=J.T,H={};J.T=H;try{var Q=E(),re=J.S;re!==null&&re(H,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(ee,te)}catch(ce){te(ce)}finally{q!==null&&H.types!==null&&(q.types=H.types),J.T=q}},ye.unstable_useCacheRefresh=function(){return J.H.useCacheRefresh()},ye.use=function(E){return J.H.use(E)},ye.useActionState=function(E,q,H){return J.H.useActionState(E,q,H)},ye.useCallback=function(E,q){return J.H.useCallback(E,q)},ye.useContext=function(E){return J.H.useContext(E)},ye.useDebugValue=function(){},ye.useDeferredValue=function(E,q){return J.H.useDeferredValue(E,q)},ye.useEffect=function(E,q){return J.H.useEffect(E,q)},ye.useEffectEvent=function(E){return J.H.useEffectEvent(E)},ye.useId=function(){return J.H.useId()},ye.useImperativeHandle=function(E,q,H){return J.H.useImperativeHandle(E,q,H)},ye.useInsertionEffect=function(E,q){return J.H.useInsertionEffect(E,q)},ye.useLayoutEffect=function(E,q){return J.H.useLayoutEffect(E,q)},ye.useMemo=function(E,q){return J.H.useMemo(E,q)},ye.useOptimistic=function(E,q){return J.H.useOptimistic(E,q)},ye.useReducer=function(E,q,H){return J.H.useReducer(E,q,H)},ye.useRef=function(E){return J.H.useRef(E)},ye.useState=function(E){return J.H.useState(E)},ye.useSyncExternalStore=function(E,q,H){return J.H.useSyncExternalStore(E,q,H)},ye.useTransition=function(){return J.H.useTransition()},ye.version="19.2.3",ye}var VS;function vy(){return VS||(VS=1,Wh.exports=OM()),Wh.exports}var N=vy();const _M=CC(N),ST=kC({__proto__:null,default:_M},[N]),by=N.createContext(Ft.STORE);function wT(t,...e){let n;if(e.length===2){const r=e[0],o=e[1];n=Pr(t,r,o)}else n=e[0];return n}function Qn(...t){const e=N.useContext(by),n=wT(e,...t),r=N.useRef(null);return r.current??=o=>{Lt(e,n,o)},r.current}function xT(t,e){if(globalThis.env?.NODE_ENV==="development"){const n=N.useRef(!1);N.useEffect(()=>{let r=n.current;if(r===!1)r=t()??!0,n.current=r;else return()=>{Br(r)&&r(),n.current=!1}},e)}else N.useEffect(t,e)}function At(...t){const e=N.useContext(by),n=wT(e,...t),r=N.useId();if(n.type==="mutable_atom"||n.type==="readonly_held_selector"||n.type==="writable_held_selector"){const[,c]=N.useState(0),f=N.useRef(An(e,n));return xT(()=>Ts(e,n,`use-o:${r}`,({newValue:h})=>{f.current=h,c(m=>m+1)}),[n.key]),f.current}const o=N.useCallback(c=>Ts(e,n,`use-o:${r}`,c),[n.key]),u=N.useCallback(()=>An(e,n),[n.key]);return N.useSyncExternalStore(o,u,u)}$C({key:"mutex",default:!1});var RM=class extends Map{set(t,e){return this.has(t)?(console.warn("Tried to set a key that already exists in an InvariantMap",{key:t,value:e}),this):super.set(t,e)}},kM=class Jp{type="continuity";globals=[];actions=[];perspectives=[];key;constructor(e){this.key=e}static existing=new RM;static create(e,n){const{type:r,globals:o,actions:u,perspectives:c}=n(new Jp(e)),f={type:r,key:e,globals:o,actions:u,perspectives:c};return Jp.existing.set(e,f),f}add(...e){switch(e[0].type){case"atom":case"mutable_atom":this.globals.push(...e);break;case"transaction":this.actions.push(...e);break;case"atom_family":case"mutable_atom_family":{const[n,r]=e;this.perspectives.push({type:"realtime_perspective",resourceAtoms:n,viewAtoms:r})}break}return this}};function CM(t){const{key:e,config:n}=t,r=kM.create(e,n),{actions:o}=r;for(const u of o)nT(Ft.STORE,e,u.key);return ny(Ft.STORE,e,-1),r}const TT=t=>t.startsWith("user::"),AT=t=>t.startsWith("room::");NC({key:"roomKeys",class:Y1});const df=P1({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:AT,isBType:TT});Qm({key:"visibleUsersInRooms",get:t=>({get:e})=>{const[,n]=of(df);return[t,...e(n,t)]}});Qm({key:"visibilityFromRoom",get:t=>({get:e})=>{const[n]=of(df);return[t,...e(n,t)]}});Qm({key:"mutualUsers",get:t=>({get:e})=>{const[n,r]=of(df),o=e(r,t);for(const u of o)return[...e(n,u)];return[]}});P1({key:"ownersOfRooms",between:["user","room"],cardinality:"1:n",isAType:TT,isBType:AT});const MM="modulepreload",DM=function(t){return"/"+t},US={},NM=function(e,n,r){let o=Promise.resolve();if(n&&n.length>0){let m=function(y){return Promise.all(y.map(g=>Promise.resolve(g).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};var c=m;document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),h=f?.nonce||f?.getAttribute("nonce");o=m(n.map(y=>{if(y=DM(y),y in US)return;US[y]=!0;const g=y.endsWith(".css"),b=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${b}`))return;const S=document.createElement("link");if(S.rel=g?"stylesheet":MM,g||(S.as="script"),S.crossOrigin="",S.href=y,h&&S.setAttribute("nonce",h),document.head.appendChild(S),g)return new Promise((x,T)=>{S.addEventListener("load",x),S.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${y}`)))})}))}function u(f){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return o.then(f=>{for(const h of f||[])h.status==="rejected"&&u(h.reason);return e().catch(u)})};var KS={};const $M=ft({key:"mySocketKey",default:void 0}),jM=ft({key:"myUserKey",default:null,effects:[t=>{typeof window<"u"&&NM(async()=>{const{storageSync:e}=await Promise.resolve().then(()=>Wz);return{storageSync:e}},void 0).then(({storageSync:e})=>{e(globalThis.localStorage,JSON,"myUserKey")(t)})}]});vi({key:"myRoomKey",get:({get:t})=>{if("process"in globalThis&&"env"in process&&"REALTIME_ROOM_KEY"in KS)return KS.REALTIME_ROOM_KEY;const e=t(jM);if(!e)return null;const[,n]=of(df),r=t(n,e);for(const o of r)return o;return null}});const bc=ft({key:"optimisticUpdateQueue",default:()=>[]}),Xp=ft({key:"confirmedUpdateQueue",default:()=>[]}),BM=(t,e,n,r,o)=>u=>{function c(h,m){if(t.logger.info("🧑‍⚖️","continuity",e,"reconciling updates"),Lt(t,bc,g=>(g.shift(),g)),h.id===m.id){if(JSON.stringify(h.subEvents)===JSON.stringify(m.subEvents)){t.logger.info("✅","continuity",e,`results for ${h.id} match between client and server`),n.emit(`ack:${e}`,m.epoch);return}}else t.logger.info("❌","continuity",e,`thought update #${m.epoch} was ${h.token.key}:${h.id}, but it was actually ${m.token.key}:${m.id}`);t.logger.info("🧑‍⚖️","continuity",e,"updates do not match",h,m);const y=r.toReversed();for(const g of y)xo(t,g,"oldValue");t.logger.info("⏪","continuity",e,"undid optimistic updates:",y),xo(t,h,"oldValue"),t.logger.info("⏪","continuity",e,"undid zeroth optimistic update",h),xo(t,m,"newValue"),t.logger.info("⏩","continuity",e,"applied confirmed update",m),n.emit(`ack:${e}`,m.epoch);for(const g of r){const b={type:"transaction",key:g.token.key},{id:S,params:x}=g;ey(t,b,S)(...x)}t.logger.info("⏩","continuity",e,"reapplied subsequent optimistic updates:",r)}t.logger.info("🧑‍⚖️","continuity",e,"integrating confirmed update",{confirmedUpdate:u,confirmedUpdates:o,optimisticUpdates:r});const f=r[0];if(f)if(t.logger.info("🧑‍⚖️","continuity",e,"has optimistic updates to reconcile"),u.epoch===f.epoch){t.logger.info("🧑‍⚖️","continuity",e,`epoch of confirmed update #${u.epoch} matches zeroth optimistic update`),c(f,u);for(const h of o){const m=r[0];if(h.epoch===m?.epoch)c(m,h);else break}}else t.logger.info("🧑‍⚖️","continuity",e,`epoch of confirmed update #${u.epoch} does not match zeroth optimistic update #${f.epoch}`),o.some(h=>h.epoch===u.epoch)||(t.logger.info("👈","continuity",e,"pushing confirmed update to queue",u),Lt(t,Xp,h=>(h.push(u),h.sort((m,y)=>m.epoch-y.epoch),h)));else{t.logger.info("🧑‍⚖️","continuity",e,"has no optimistic updates to deal with");let h;h=tT(t,e),h===u.epoch-1?(t.logger.info("✅","continuity",e,`integrating update #${u.epoch} (${u.token.key} ${u.id})`),xo(t,u,"newValue"),n.emit(`ack:${e}`,u.epoch),ny(t,e,u.epoch)):h!==void 0&&(t.logger.info("🧑‍⚖️","continuity",e,`received update #${u.epoch} but still waiting for update #${h+1}`,{clientEpoch:h,serverEpoch:u.epoch}),o.some(m=>m.epoch===u.epoch)?t.logger.info("👍","continuity",e,`confirmed update #${u.epoch} is already enqueued`):(t.logger.info("👈","continuity",e,`pushing confirmed update #${u.epoch} to queue`),Lt(t,Xp,m=>(m.push(u),m.sort((y,g)=>y.epoch-g.epoch),m))))}};function zM(t){return e=>{for(const n of e)gy(t,n)}}function LM(t){return e=>{let n=0,r,o;for(const u of e)n%2===0?r=u:(o=u,Lt(t,r,o)),n++}}function VM(t,e,n){const r=n.key,o=An(t,bc),u=An(t,Xp),c=(g,b)=>{e.off(`continuity-init:${r}`,c);let S=0,x,T;for(const _ of b)S%2===0?x=_:(T=_,"type"in x&&x.type==="mutable_atom"&&(x=ks(t,x)),Lt(t,x,T)),S++;ny(t,r,g)};e.off(`continuity-init:${r}`),e.on(`continuity-init:${r}`,c);const f=BM(t,r,e,o,u);e.off(`tx-new:${r}`),e.on(`tx-new:${r}`,f);const h=n.actions.map(g=>(nT(t,r,g.key),hT(t,g,`tx-run:${r}`,b=>{t.logger.info("🤞","continuity",r,"enqueuing optimistic update");const S=o.findIndex(x=>x.id===b.id);S===-1?(t.logger.info("🤞","continuity",r,"enqueuing new optimistic update"),Lt(t,bc,x=>(x.push(b),x.sort((T,_)=>T.epoch-_.epoch),x))):(t.logger.info("🤞","continuity",r,`replacing existing optimistic update at index ${S}`),Lt(t,bc,x=>(x[S]=b,x))),e.emit(`tx-run:${r}`,{id:b.id,token:g,params:b.params})}))),m=LM(t),y=zM(t);return e.on(`reveal:${r}`,m),e.on(`conceal:${r}`,y),e.emit(`get:${r}`),()=>{e.off(`continuity-init:${r}`),e.off(`tx-new:${r}`);for(const g of h)g()}}const ET=N.createContext({socket:null,services:null}),UM=({children:t,socket:e})=>{const n=N.useRef(new Map).current,r=Qn($M);return N.useEffect(()=>{r(e?.id?`socket::${e.id}`:void 0),e?.on("connect",()=>{r(e?.id?`socket::${e.id}`:void 0)}),e?.on("disconnect",()=>{r(void 0)})},[e,r]),F.jsx(ET.Provider,{value:{socket:e,services:n},children:t})};function KM(t,e){const{socket:n,services:r}=N.useContext(ET);xT(()=>{let o=r?.get(t);return o?++o.consumerCount:n&&(o={consumerCount:1,dispose:e(n)},r?.set(t,o)),()=>{o&&(--o.consumerCount,o.consumerCount===0&&(o.dispose?.(),r?.delete(t)))}},[n,t])}function qM(t){const e=N.useContext(by);KM(`tx-sync:${t.key}`,n=>VM(e,n,t))}var ep={exports:{}},Ga={},tp={exports:{}},np={};var qS;function PM(){return qS||(qS=1,(function(t){function e(j,U){var L=j.length;j.push(U);e:for(;0<L;){var te=L-1>>>1,oe=j[te];if(0<o(oe,U))j[te]=U,j[L]=oe,L=te;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var U=j[0],L=j.pop();if(L!==U){j[0]=L;e:for(var te=0,oe=j.length,E=oe>>>1;te<E;){var q=2*(te+1)-1,H=j[q],Q=q+1,re=j[Q];if(0>o(H,L))Q<oe&&0>o(re,H)?(j[te]=re,j[Q]=L,te=Q):(j[te]=H,j[q]=L,te=q);else if(Q<oe&&0>o(re,L))j[te]=re,j[Q]=L,te=Q;else break e}}return U}function o(j,U){var L=j.sortIndex-U.sortIndex;return L!==0?L:j.id-U.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();t.unstable_now=function(){return c.now()-f}}var h=[],m=[],y=1,g=null,b=3,S=!1,x=!1,T=!1,_=!1,k=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function G(j){for(var U=n(m);U!==null;){if(U.callback===null)r(m);else if(U.startTime<=j)r(m),U.sortIndex=U.expirationTime,e(h,U);else break;U=n(m)}}function I(j){if(T=!1,G(j),!x)if(n(h)!==null)x=!0,ee||(ee=!0,je());else{var U=n(m);U!==null&&ne(I,U.startTime-j)}}var ee=!1,J=-1,X=5,he=-1;function pe(){return _?!0:!(t.unstable_now()-he<X)}function we(){if(_=!1,ee){var j=t.unstable_now();he=j;var U=!0;try{e:{x=!1,T&&(T=!1,C(J),J=-1),S=!0;var L=b;try{t:{for(G(j),g=n(h);g!==null&&!(g.expirationTime>j&&pe());){var te=g.callback;if(typeof te=="function"){g.callback=null,b=g.priorityLevel;var oe=te(g.expirationTime<=j);if(j=t.unstable_now(),typeof oe=="function"){g.callback=oe,G(j),U=!0;break t}g===n(h)&&r(h),G(j)}else r(h);g=n(h)}if(g!==null)U=!0;else{var E=n(m);E!==null&&ne(I,E.startTime-j),U=!1}}break e}finally{g=null,b=L,S=!1}U=void 0}}finally{U?je():ee=!1}}}var je;if(typeof M=="function")je=function(){M(we)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,Z=be.port2;be.port1.onmessage=we,je=function(){Z.postMessage(null)}}else je=function(){k(we,0)};function ne(j,U){J=k(function(){j(t.unstable_now())},U)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(j){j.callback=null},t.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<j?Math.floor(1e3/j):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(j){switch(b){case 1:case 2:case 3:var U=3;break;default:U=b}var L=b;b=U;try{return j()}finally{b=L}},t.unstable_requestPaint=function(){_=!0},t.unstable_runWithPriority=function(j,U){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var L=b;b=j;try{return U()}finally{b=L}},t.unstable_scheduleCallback=function(j,U,L){var te=t.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?te+L:te):L=te,j){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=L+oe,j={id:y++,callback:U,priorityLevel:j,startTime:L,expirationTime:oe,sortIndex:-1},L>te?(j.sortIndex=L,e(m,j),n(h)===null&&j===n(m)&&(T?(C(J),J=-1):T=!0,ne(I,L-te))):(j.sortIndex=oe,e(h,j),x||S||(x=!0,ee||(ee=!0,je()))),j},t.unstable_shouldYield=pe,t.unstable_wrapCallback=function(j){var U=b;return function(){var L=b;b=U;try{return j.apply(this,arguments)}finally{b=L}}}})(np)),np}var PS;function IM(){return PS||(PS=1,tp.exports=PM()),tp.exports}var ip={exports:{}},Yt={};var IS;function HM(){if(IS)return Yt;IS=1;var t=vy();function e(h){var m="https://react.dev/errors/"+h;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(h,m,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:h,containerInfo:m,implementation:y}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,m){if(h==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Yt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Yt.createPortal=function(h,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(e(299));return u(h,m,null,y)},Yt.flushSync=function(h){var m=c.T,y=r.p;try{if(c.T=null,r.p=2,h)return h()}finally{c.T=m,r.p=y,r.d.f()}},Yt.preconnect=function(h,m){typeof h=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(h,m))},Yt.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},Yt.preinit=function(h,m){if(typeof h=="string"&&m&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?r.d.S(h,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:S}):y==="script"&&r.d.X(h,{crossOrigin:g,integrity:b,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Yt.preinitModule=function(h,m){if(typeof h=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=f(m.as,m.crossOrigin);r.d.M(h,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(h)},Yt.preload=function(h,m){if(typeof h=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin);r.d.L(h,y,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Yt.preloadModule=function(h,m){if(typeof h=="string")if(m){var y=f(m.as,m.crossOrigin);r.d.m(h,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(h)},Yt.requestFormReset=function(h){r.d.r(h)},Yt.unstable_batchedUpdates=function(h,m){return h(m)},Yt.useFormState=function(h,m,y){return c.H.useFormState(h,m,y)},Yt.useFormStatus=function(){return c.H.useHostTransitionStatus()},Yt.version="19.2.3",Yt}var HS;function OT(){if(HS)return ip.exports;HS=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),ip.exports=HM(),ip.exports}var FS;function FM(){if(FS)return Ga;FS=1;var t=IM(),e=vy(),n=OT();function r(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function u(i){var s=i,a=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(a=s.return),i=s.return;while(i)}return s.tag===3?a:null}function c(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function f(i){if(i.tag===31){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function h(i){if(u(i)!==i)throw Error(r(188))}function m(i){var s=i.alternate;if(!s){if(s=u(i),s===null)throw Error(r(188));return s!==i?null:i}for(var a=i,l=s;;){var d=a.return;if(d===null)break;var p=d.alternate;if(p===null){if(l=d.return,l!==null){a=l;continue}break}if(d.child===p.child){for(p=d.child;p;){if(p===a)return h(d),i;if(p===l)return h(d),s;p=p.sibling}throw Error(r(188))}if(a.return!==l.return)a=d,l=p;else{for(var v=!1,w=d.child;w;){if(w===a){v=!0,a=d,l=p;break}if(w===l){v=!0,l=d,a=p;break}w=w.sibling}if(!v){for(w=p.child;w;){if(w===a){v=!0,a=p,l=d;break}if(w===l){v=!0,l=p,a=d;break}w=w.sibling}if(!v)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?i:s}function y(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=y(i),s!==null)return s;i=i.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),M=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),pe=Symbol.for("react.memo_cache_sentinel"),we=Symbol.iterator;function je(i){return i===null||typeof i!="object"?null:(i=we&&i[we]||i["@@iterator"],typeof i=="function"?i:null)}var be=Symbol.for("react.client.reference");function Z(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===be?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case T:return"Fragment";case k:return"Profiler";case _:return"StrictMode";case I:return"Suspense";case ee:return"SuspenseList";case he:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case x:return"Portal";case M:return i.displayName||"Context";case C:return(i._context.displayName||"Context")+".Consumer";case G:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case J:return s=i.displayName||null,s!==null?s:Z(i.type)||"Memo";case X:s=i._payload,i=i._init;try{return Z(i(s))}catch{}}return null}var ne=Array.isArray,j=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L={pending:!1,data:null,method:null,action:null},te=[],oe=-1;function E(i){return{current:i}}function q(i){0>oe||(i.current=te[oe],te[oe]=null,oe--)}function H(i,s){oe++,te[oe]=i.current,i.current=s}var Q=E(null),re=E(null),ce=E(null),Te=E(null);function Rt(i,s){switch(H(ce,s),H(re,i),H(Q,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?X0(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=X0(s),i=Z0(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}q(Q),H(Q,i)}function Je(){q(Q),q(re),q(ce)}function ni(i){i.memoizedState!==null&&H(Te,i);var s=Q.current,a=Z0(s,i.type);s!==a&&(H(re,i),H(Q,a))}function Ti(i){re.current===i&&(q(Q),q(re)),Te.current===i&&(q(Te),qa._currentValue=L)}var xe,Me;function ge(i){if(xe===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);xe=s&&s[1]||"",Me=-1<a.stack.indexOf(`
14
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
15
- `+xe+i+Me}var Xe=!1;function ht(i,s){if(!i||Xe)return"";Xe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(z){var B=z}Reflect.construct(i,[],P)}else{try{P.call()}catch(z){B=z}i.call(P.prototype)}}else{try{throw Error()}catch(z){B=z}(P=i())&&typeof P.catch=="function"&&P.catch(function(){})}}catch(z){if(z&&B&&typeof z.stack=="string")return[z.stack,B.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=l.DetermineComponentFrameRoot(),v=p[0],w=p[1];if(v&&w){var A=v.split(`
16
- `),$=w.split(`
17
- `);for(d=l=0;l<A.length&&!A[l].includes("DetermineComponentFrameRoot");)l++;for(;d<$.length&&!$[d].includes("DetermineComponentFrameRoot");)d++;if(l===A.length||d===$.length)for(l=A.length-1,d=$.length-1;1<=l&&0<=d&&A[l]!==$[d];)d--;for(;1<=l&&0<=d;l--,d--)if(A[l]!==$[d]){if(l!==1||d!==1)do if(l--,d--,0>d||A[l]!==$[d]){var V=`
18
- `+A[l].replace(" at new "," at ");return i.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",i.displayName)),V}while(1<=l&&0<=d);break}}}finally{Xe=!1,Error.prepareStackTrace=a}return(a=i?i.displayName||i.name:"")?ge(a):""}function Le(i,s){switch(i.tag){case 26:case 27:case 5:return ge(i.type);case 16:return ge("Lazy");case 13:return i.child!==s&&s!==null?ge("Suspense Fallback"):ge("Suspense");case 19:return ge("SuspenseList");case 0:case 15:return ht(i.type,!1);case 11:return ht(i.type.render,!1);case 1:return ht(i.type,!0);case 31:return ge("Activity");default:return""}}function En(i){try{var s="",a=null;do s+=Le(i,a),a=i,i=i.return;while(i);return s}catch(l){return`
19
- Error generating stack: `+l.message+`
20
- `+l.stack}}var Gt=Object.prototype.hasOwnProperty,Vt=t.unstable_scheduleCallback,Pn=t.unstable_cancelCallback,ii=t.unstable_shouldYield,In=t.unstable_requestPaint,st=t.unstable_now,Vl=t.unstable_getCurrentPriorityLevel,Rg=t.unstable_ImmediatePriority,kg=t.unstable_UserBlockingPriority,Ul=t.unstable_NormalPriority,cR=t.unstable_LowPriority,Cg=t.unstable_IdlePriority,fR=t.log,dR=t.unstable_setDisableYieldValue,ea=null,dn=null;function nr(i){if(typeof fR=="function"&&dR(i),dn&&typeof dn.setStrictMode=="function")try{dn.setStrictMode(ea,i)}catch{}}var hn=Math.clz32?Math.clz32:mR,hR=Math.log,pR=Math.LN2;function mR(i){return i>>>=0,i===0?32:31-(hR(i)/pR|0)|0}var Kl=256,ql=262144,Pl=4194304;function Yr(i){var s=i&42;if(s!==0)return s;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Il(i,s,a){var l=i.pendingLanes;if(l===0)return 0;var d=0,p=i.suspendedLanes,v=i.pingedLanes;i=i.warmLanes;var w=l&134217727;return w!==0?(l=w&~p,l!==0?d=Yr(l):(v&=w,v!==0?d=Yr(v):a||(a=w&~i,a!==0&&(d=Yr(a))))):(w=l&~p,w!==0?d=Yr(w):v!==0?d=Yr(v):a||(a=l&~i,a!==0&&(d=Yr(a)))),d===0?0:s!==0&&s!==d&&(s&p)===0&&(p=d&-d,a=s&-s,p>=a||p===32&&(a&4194048)!==0)?s:d}function ta(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function yR(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mg(){var i=Pl;return Pl<<=1,(Pl&62914560)===0&&(Pl=4194304),i}function Lf(i){for(var s=[],a=0;31>a;a++)s.push(i);return s}function na(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function gR(i,s,a,l,d,p){var v=i.pendingLanes;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=a,i.entangledLanes&=a,i.errorRecoveryDisabledLanes&=a,i.shellSuspendCounter=0;var w=i.entanglements,A=i.expirationTimes,$=i.hiddenUpdates;for(a=v&~a;0<a;){var V=31-hn(a),P=1<<V;w[V]=0,A[V]=-1;var B=$[V];if(B!==null)for($[V]=null,V=0;V<B.length;V++){var z=B[V];z!==null&&(z.lane&=-536870913)}a&=~P}l!==0&&Dg(i,l,0),p!==0&&d===0&&i.tag!==0&&(i.suspendedLanes|=p&~(v&~s))}function Dg(i,s,a){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-hn(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|a&261930}function Ng(i,s){var a=i.entangledLanes|=s;for(i=i.entanglements;a;){var l=31-hn(a),d=1<<l;d&s|i[l]&s&&(i[l]|=s),a&=~d}}function $g(i,s){var a=s&-s;return a=(a&42)!==0?1:Vf(a),(a&(i.suspendedLanes|s))!==0?0:a}function Vf(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Uf(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function jg(){var i=U.p;return i!==0?i:(i=window.event,i===void 0?32:SS(i.type))}function Bg(i,s){var a=U.p;try{return U.p=i,s()}finally{U.p=a}}var ir=Math.random().toString(36).slice(2),Ut="__reactFiber$"+ir,tn="__reactProps$"+ir,Ds="__reactContainer$"+ir,Kf="__reactEvents$"+ir,vR="__reactListeners$"+ir,bR="__reactHandles$"+ir,zg="__reactResources$"+ir,ia="__reactMarker$"+ir;function qf(i){delete i[Ut],delete i[tn],delete i[Kf],delete i[vR],delete i[bR]}function Ns(i){var s=i[Ut];if(s)return s;for(var a=i.parentNode;a;){if(s=a[Ds]||a[Ut]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(i=rS(i);i!==null;){if(a=i[Ut])return a;i=rS(i)}return s}i=a,a=i.parentNode}return null}function $s(i){if(i=i[Ut]||i[Ds]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function ra(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(r(33))}function js(i){var s=i[zg];return s||(s=i[zg]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Nt(i){i[ia]=!0}var Lg=new Set,Vg={};function Jr(i,s){Bs(i,s),Bs(i+"Capture",s)}function Bs(i,s){for(Vg[i]=s,i=0;i<s.length;i++)Lg.add(s[i])}var SR=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Ug={},Kg={};function wR(i){return Gt.call(Kg,i)?!0:Gt.call(Ug,i)?!1:SR.test(i)?Kg[i]=!0:(Ug[i]=!0,!1)}function Hl(i,s,a){if(wR(s))if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var l=s.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,""+a)}}function Fl(i,s,a){if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+a)}}function Ai(i,s,a,l){if(l===null)i.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttributeNS(s,a,""+l)}}function On(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function qg(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function xR(i,s,a){var l=Object.getOwnPropertyDescriptor(i.constructor.prototype,s);if(!i.hasOwnProperty(s)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var d=l.get,p=l.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return d.call(this)},set:function(v){a=""+v,p.call(this,v)}}),Object.defineProperty(i,s,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(v){a=""+v},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Pf(i){if(!i._valueTracker){var s=qg(i)?"checked":"value";i._valueTracker=xR(i,s,""+i[s])}}function Pg(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var a=s.getValue(),l="";return i&&(l=qg(i)?i.checked?"true":"false":i.value),i=l,i!==a?(s.setValue(i),!0):!1}function Gl(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var TR=/[\n"\\]/g;function _n(i){return i.replace(TR,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function If(i,s,a,l,d,p,v,w){i.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?i.type=v:i.removeAttribute("type"),s!=null?v==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+On(s)):i.value!==""+On(s)&&(i.value=""+On(s)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),s!=null?Hf(i,v,On(s)):a!=null?Hf(i,v,On(a)):l!=null&&i.removeAttribute("value"),d==null&&p!=null&&(i.defaultChecked=!!p),d!=null&&(i.checked=d&&typeof d!="function"&&typeof d!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.name=""+On(w):i.removeAttribute("name")}function Ig(i,s,a,l,d,p,v,w){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(i.type=p),s!=null||a!=null){if(!(p!=="submit"&&p!=="reset"||s!=null)){Pf(i);return}a=a!=null?""+On(a):"",s=s!=null?""+On(s):a,w||s===i.value||(i.value=s),i.defaultValue=s}l=l??d,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=w?i.checked:!!l,i.defaultChecked=!!l,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.name=v),Pf(i)}function Hf(i,s,a){s==="number"&&Gl(i.ownerDocument)===i||i.defaultValue===""+a||(i.defaultValue=""+a)}function zs(i,s,a,l){if(i=i.options,s){s={};for(var d=0;d<a.length;d++)s["$"+a[d]]=!0;for(a=0;a<i.length;a++)d=s.hasOwnProperty("$"+i[a].value),i[a].selected!==d&&(i[a].selected=d),d&&l&&(i[a].defaultSelected=!0)}else{for(a=""+On(a),s=null,d=0;d<i.length;d++){if(i[d].value===a){i[d].selected=!0,l&&(i[d].defaultSelected=!0);return}s!==null||i[d].disabled||(s=i[d])}s!==null&&(s.selected=!0)}}function Hg(i,s,a){if(s!=null&&(s=""+On(s),s!==i.value&&(i.value=s),a==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=a!=null?""+On(a):""}function Fg(i,s,a,l){if(s==null){if(l!=null){if(a!=null)throw Error(r(92));if(ne(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),s=a}a=On(s),i.defaultValue=a,l=i.textContent,l===a&&l!==""&&l!==null&&(i.value=l),Pf(i)}function Ls(i,s){if(s){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=s;return}}i.textContent=s}var AR=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Gg(i,s,a){var l=s.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":l?i.setProperty(s,a):typeof a!="number"||a===0||AR.has(s)?s==="float"?i.cssFloat=a:i[s]=(""+a).trim():i[s]=a+"px"}function Yg(i,s,a){if(s!=null&&typeof s!="object")throw Error(r(62));if(i=i.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||s!=null&&s.hasOwnProperty(l)||(l.indexOf("--")===0?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="");for(var d in s)l=s[d],s.hasOwnProperty(d)&&a[d]!==l&&Gg(i,d,l)}else for(var p in s)s.hasOwnProperty(p)&&Gg(i,p,s[p])}function Ff(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ER=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),OR=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Yl(i){return OR.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ei(){}var Gf=null;function Yf(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Vs=null,Us=null;function Jg(i){var s=$s(i);if(s&&(i=s.stateNode)){var a=i[tn]||null;e:switch(i=s.stateNode,s.type){case"input":if(If(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),s=a.name,a.type==="radio"&&s!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+_n(""+s)+'"][type="radio"]'),s=0;s<a.length;s++){var l=a[s];if(l!==i&&l.form===i.form){var d=l[tn]||null;if(!d)throw Error(r(90));If(l,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(s=0;s<a.length;s++)l=a[s],l.form===i.form&&Pg(l)}break e;case"textarea":Hg(i,a.value,a.defaultValue);break e;case"select":s=a.value,s!=null&&zs(i,!!a.multiple,s,!1)}}}var Jf=!1;function Xg(i,s,a){if(Jf)return i(s,a);Jf=!0;try{var l=i(s);return l}finally{if(Jf=!1,(Vs!==null||Us!==null)&&(ju(),Vs&&(s=Vs,i=Us,Us=Vs=null,Jg(s),i)))for(s=0;s<i.length;s++)Jg(i[s])}}function sa(i,s){var a=i.stateNode;if(a===null)return null;var l=a[tn]||null;if(l===null)return null;a=l[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(i=i.type,l=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!l;break e;default:i=!1}if(i)return null;if(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var Oi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xf=!1;if(Oi)try{var oa={};Object.defineProperty(oa,"passive",{get:function(){Xf=!0}}),window.addEventListener("test",oa,oa),window.removeEventListener("test",oa,oa)}catch{Xf=!1}var rr=null,Zf=null,Jl=null;function Zg(){if(Jl)return Jl;var i,s=Zf,a=s.length,l,d="value"in rr?rr.value:rr.textContent,p=d.length;for(i=0;i<a&&s[i]===d[i];i++);var v=a-i;for(l=1;l<=v&&s[a-l]===d[p-l];l++);return Jl=d.slice(i,1<l?1-l:void 0)}function Xl(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function Zl(){return!0}function Qg(){return!1}function nn(i){function s(a,l,d,p,v){this._reactName=a,this._targetInst=d,this.type=l,this.nativeEvent=p,this.target=v,this.currentTarget=null;for(var w in i)i.hasOwnProperty(w)&&(a=i[w],this[w]=a?a(p):p[w]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Zl:Qg,this.isPropagationStopped=Qg,this}return g(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Zl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Zl)},persist:function(){},isPersistent:Zl}),s}var Xr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ql=nn(Xr),aa=g({},Xr,{view:0,detail:0}),_R=nn(aa),Qf,Wf,la,Wl=g({},aa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:td,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==la&&(la&&i.type==="mousemove"?(Qf=i.screenX-la.screenX,Wf=i.screenY-la.screenY):Wf=Qf=0,la=i),Qf)},movementY:function(i){return"movementY"in i?i.movementY:Wf}}),Wg=nn(Wl),RR=g({},Wl,{dataTransfer:0}),kR=nn(RR),CR=g({},aa,{relatedTarget:0}),ed=nn(CR),MR=g({},Xr,{animationName:0,elapsedTime:0,pseudoElement:0}),DR=nn(MR),NR=g({},Xr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),$R=nn(NR),jR=g({},Xr,{data:0}),ev=nn(jR),BR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zR={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},LR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function VR(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=LR[i])?!!s[i]:!1}function td(){return VR}var UR=g({},aa,{key:function(i){if(i.key){var s=BR[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Xl(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?zR[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:td,charCode:function(i){return i.type==="keypress"?Xl(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Xl(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),KR=nn(UR),qR=g({},Wl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tv=nn(qR),PR=g({},aa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:td}),IR=nn(PR),HR=g({},Xr,{propertyName:0,elapsedTime:0,pseudoElement:0}),FR=nn(HR),GR=g({},Wl,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),YR=nn(GR),JR=g({},Xr,{newState:0,oldState:0}),XR=nn(JR),ZR=[9,13,27,32],nd=Oi&&"CompositionEvent"in window,ua=null;Oi&&"documentMode"in document&&(ua=document.documentMode);var QR=Oi&&"TextEvent"in window&&!ua,nv=Oi&&(!nd||ua&&8<ua&&11>=ua),iv=" ",rv=!1;function sv(i,s){switch(i){case"keyup":return ZR.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ov(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Ks=!1;function WR(i,s){switch(i){case"compositionend":return ov(s);case"keypress":return s.which!==32?null:(rv=!0,iv);case"textInput":return i=s.data,i===iv&&rv?null:i;default:return null}}function ek(i,s){if(Ks)return i==="compositionend"||!nd&&sv(i,s)?(i=Zg(),Jl=Zf=rr=null,Ks=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return nv&&s.locale!=="ko"?null:s.data;default:return null}}var tk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function av(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!tk[i.type]:s==="textarea"}function lv(i,s,a,l){Vs?Us?Us.push(l):Us=[l]:Vs=l,s=qu(s,"onChange"),0<s.length&&(a=new Ql("onChange","change",null,a,l),i.push({event:a,listeners:s}))}var ca=null,fa=null;function nk(i){I0(i,0)}function eu(i){var s=ra(i);if(Pg(s))return i}function uv(i,s){if(i==="change")return s}var cv=!1;if(Oi){var id;if(Oi){var rd="oninput"in document;if(!rd){var fv=document.createElement("div");fv.setAttribute("oninput","return;"),rd=typeof fv.oninput=="function"}id=rd}else id=!1;cv=id&&(!document.documentMode||9<document.documentMode)}function dv(){ca&&(ca.detachEvent("onpropertychange",hv),fa=ca=null)}function hv(i){if(i.propertyName==="value"&&eu(fa)){var s=[];lv(s,fa,i,Yf(i)),Xg(nk,s)}}function ik(i,s,a){i==="focusin"?(dv(),ca=s,fa=a,ca.attachEvent("onpropertychange",hv)):i==="focusout"&&dv()}function rk(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return eu(fa)}function sk(i,s){if(i==="click")return eu(s)}function ok(i,s){if(i==="input"||i==="change")return eu(s)}function ak(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var pn=typeof Object.is=="function"?Object.is:ak;function da(i,s){if(pn(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var a=Object.keys(i),l=Object.keys(s);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var d=a[l];if(!Gt.call(s,d)||!pn(i[d],s[d]))return!1}return!0}function pv(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function mv(i,s){var a=pv(i);i=0;for(var l;a;){if(a.nodeType===3){if(l=i+a.textContent.length,i<=s&&l>=s)return{node:a,offset:s-i};i=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=pv(a)}}function yv(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?yv(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function gv(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=Gl(i.document);s instanceof i.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)i=s.contentWindow;else break;s=Gl(i.document)}return s}function sd(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var lk=Oi&&"documentMode"in document&&11>=document.documentMode,qs=null,od=null,ha=null,ad=!1;function vv(i,s,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ad||qs==null||qs!==Gl(l)||(l=qs,"selectionStart"in l&&sd(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),ha&&da(ha,l)||(ha=l,l=qu(od,"onSelect"),0<l.length&&(s=new Ql("onSelect","select",null,s,a),i.push({event:s,listeners:l}),s.target=qs)))}function Zr(i,s){var a={};return a[i.toLowerCase()]=s.toLowerCase(),a["Webkit"+i]="webkit"+s,a["Moz"+i]="moz"+s,a}var Ps={animationend:Zr("Animation","AnimationEnd"),animationiteration:Zr("Animation","AnimationIteration"),animationstart:Zr("Animation","AnimationStart"),transitionrun:Zr("Transition","TransitionRun"),transitionstart:Zr("Transition","TransitionStart"),transitioncancel:Zr("Transition","TransitionCancel"),transitionend:Zr("Transition","TransitionEnd")},ld={},bv={};Oi&&(bv=document.createElement("div").style,"AnimationEvent"in window||(delete Ps.animationend.animation,delete Ps.animationiteration.animation,delete Ps.animationstart.animation),"TransitionEvent"in window||delete Ps.transitionend.transition);function Qr(i){if(ld[i])return ld[i];if(!Ps[i])return i;var s=Ps[i],a;for(a in s)if(s.hasOwnProperty(a)&&a in bv)return ld[i]=s[a];return i}var Sv=Qr("animationend"),wv=Qr("animationiteration"),xv=Qr("animationstart"),uk=Qr("transitionrun"),ck=Qr("transitionstart"),fk=Qr("transitioncancel"),Tv=Qr("transitionend"),Av=new Map,ud="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ud.push("scrollEnd");function Hn(i,s){Av.set(i,s),Jr(s,[i])}var tu=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Rn=[],Is=0,cd=0;function nu(){for(var i=Is,s=cd=Is=0;s<i;){var a=Rn[s];Rn[s++]=null;var l=Rn[s];Rn[s++]=null;var d=Rn[s];Rn[s++]=null;var p=Rn[s];if(Rn[s++]=null,l!==null&&d!==null){var v=l.pending;v===null?d.next=d:(d.next=v.next,v.next=d),l.pending=d}p!==0&&Ev(a,d,p)}}function iu(i,s,a,l){Rn[Is++]=i,Rn[Is++]=s,Rn[Is++]=a,Rn[Is++]=l,cd|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function fd(i,s,a,l){return iu(i,s,a,l),ru(i)}function Wr(i,s){return iu(i,null,null,s),ru(i)}function Ev(i,s,a){i.lanes|=a;var l=i.alternate;l!==null&&(l.lanes|=a);for(var d=!1,p=i.return;p!==null;)p.childLanes|=a,l=p.alternate,l!==null&&(l.childLanes|=a),p.tag===22&&(i=p.stateNode,i===null||i._visibility&1||(d=!0)),i=p,p=p.return;return i.tag===3?(p=i.stateNode,d&&s!==null&&(d=31-hn(a),i=p.hiddenUpdates,l=i[d],l===null?i[d]=[s]:l.push(s),s.lane=a|536870912),p):null}function ru(i){if(50<ja)throw ja=0,Sh=null,Error(r(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var Hs={};function dk(i,s,a,l){this.tag=i,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mn(i,s,a,l){return new dk(i,s,a,l)}function dd(i){return i=i.prototype,!(!i||!i.isReactComponent)}function _i(i,s){var a=i.alternate;return a===null?(a=mn(i.tag,s,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=s,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&65011712,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,s=i.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a.refCleanup=i.refCleanup,a}function Ov(i,s){i.flags&=65011714;var a=i.alternate;return a===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,s=a.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function su(i,s,a,l,d,p){var v=0;if(l=i,typeof i=="function")dd(i)&&(v=1);else if(typeof i=="string")v=gC(i,a,Q.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case he:return i=mn(31,a,s,d),i.elementType=he,i.lanes=p,i;case T:return es(a.children,d,p,s);case _:v=8,d|=24;break;case k:return i=mn(12,a,s,d|2),i.elementType=k,i.lanes=p,i;case I:return i=mn(13,a,s,d),i.elementType=I,i.lanes=p,i;case ee:return i=mn(19,a,s,d),i.elementType=ee,i.lanes=p,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case M:v=10;break e;case C:v=9;break e;case G:v=11;break e;case J:v=14;break e;case X:v=16,l=null;break e}v=29,a=Error(r(130,i===null?"null":typeof i,"")),l=null}return s=mn(v,a,s,d),s.elementType=i,s.type=l,s.lanes=p,s}function es(i,s,a,l){return i=mn(7,i,l,s),i.lanes=a,i}function hd(i,s,a){return i=mn(6,i,null,s),i.lanes=a,i}function _v(i){var s=mn(18,null,null,0);return s.stateNode=i,s}function pd(i,s,a){return s=mn(4,i.children!==null?i.children:[],i.key,s),s.lanes=a,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var Rv=new WeakMap;function kn(i,s){if(typeof i=="object"&&i!==null){var a=Rv.get(i);return a!==void 0?a:(s={value:i,source:s,stack:En(s)},Rv.set(i,s),s)}return{value:i,source:s,stack:En(s)}}var Fs=[],Gs=0,ou=null,pa=0,Cn=[],Mn=0,sr=null,ri=1,si="";function Ri(i,s){Fs[Gs++]=pa,Fs[Gs++]=ou,ou=i,pa=s}function kv(i,s,a){Cn[Mn++]=ri,Cn[Mn++]=si,Cn[Mn++]=sr,sr=i;var l=ri;i=si;var d=32-hn(l)-1;l&=~(1<<d),a+=1;var p=32-hn(s)+d;if(30<p){var v=d-d%5;p=(l&(1<<v)-1).toString(32),l>>=v,d-=v,ri=1<<32-hn(s)+d|a<<d|l,si=p+i}else ri=1<<p|a<<d|l,si=i}function md(i){i.return!==null&&(Ri(i,1),kv(i,1,0))}function yd(i){for(;i===ou;)ou=Fs[--Gs],Fs[Gs]=null,pa=Fs[--Gs],Fs[Gs]=null;for(;i===sr;)sr=Cn[--Mn],Cn[Mn]=null,si=Cn[--Mn],Cn[Mn]=null,ri=Cn[--Mn],Cn[Mn]=null}function Cv(i,s){Cn[Mn++]=ri,Cn[Mn++]=si,Cn[Mn++]=sr,ri=s.id,si=s.overflow,sr=i}var Kt=null,Ze=null,ke=!1,or=null,Dn=!1,gd=Error(r(519));function ar(i){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ma(kn(s,i)),gd}function Mv(i){var s=i.stateNode,a=i.type,l=i.memoizedProps;switch(s[Ut]=i,s[tn]=l,a){case"dialog":Ee("cancel",s),Ee("close",s);break;case"iframe":case"object":case"embed":Ee("load",s);break;case"video":case"audio":for(a=0;a<za.length;a++)Ee(za[a],s);break;case"source":Ee("error",s);break;case"img":case"image":case"link":Ee("error",s),Ee("load",s);break;case"details":Ee("toggle",s);break;case"input":Ee("invalid",s),Ig(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ee("invalid",s);break;case"textarea":Ee("invalid",s),Fg(s,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||s.textContent===""+a||l.suppressHydrationWarning===!0||Y0(s.textContent,a)?(l.popover!=null&&(Ee("beforetoggle",s),Ee("toggle",s)),l.onScroll!=null&&Ee("scroll",s),l.onScrollEnd!=null&&Ee("scrollend",s),l.onClick!=null&&(s.onclick=Ei),s=!0):s=!1,s||ar(i,!0)}function Dv(i){for(Kt=i.return;Kt;)switch(Kt.tag){case 5:case 31:case 13:Dn=!1;return;case 27:case 3:Dn=!0;return;default:Kt=Kt.return}}function Ys(i){if(i!==Kt)return!1;if(!ke)return Dv(i),ke=!0,!1;var s=i.tag,a;if((a=s!==3&&s!==27)&&((a=s===5)&&(a=i.type,a=!(a!=="form"&&a!=="button")||jh(i.type,i.memoizedProps)),a=!a),a&&Ze&&ar(i),Dv(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Ze=iS(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Ze=iS(i)}else s===27?(s=Ze,wr(i.type)?(i=Uh,Uh=null,Ze=i):Ze=s):Ze=Kt?$n(i.stateNode.nextSibling):null;return!0}function ts(){Ze=Kt=null,ke=!1}function vd(){var i=or;return i!==null&&(an===null?an=i:an.push.apply(an,i),or=null),i}function ma(i){or===null?or=[i]:or.push(i)}var bd=E(null),ns=null,ki=null;function lr(i,s,a){H(bd,s._currentValue),s._currentValue=a}function Ci(i){i._currentValue=bd.current,q(bd)}function Sd(i,s,a){for(;i!==null;){var l=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,l!==null&&(l.childLanes|=s)):l!==null&&(l.childLanes&s)!==s&&(l.childLanes|=s),i===a)break;i=i.return}}function wd(i,s,a,l){var d=i.child;for(d!==null&&(d.return=i);d!==null;){var p=d.dependencies;if(p!==null){var v=d.child;p=p.firstContext;e:for(;p!==null;){var w=p;p=d;for(var A=0;A<s.length;A++)if(w.context===s[A]){p.lanes|=a,w=p.alternate,w!==null&&(w.lanes|=a),Sd(p.return,a,i),l||(v=null);break e}p=w.next}}else if(d.tag===18){if(v=d.return,v===null)throw Error(r(341));v.lanes|=a,p=v.alternate,p!==null&&(p.lanes|=a),Sd(v,a,i),v=null}else v=d.child;if(v!==null)v.return=d;else for(v=d;v!==null;){if(v===i){v=null;break}if(d=v.sibling,d!==null){d.return=v.return,v=d;break}v=v.return}d=v}}function Js(i,s,a,l){i=null;for(var d=s,p=!1;d!==null;){if(!p){if((d.flags&524288)!==0)p=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var v=d.alternate;if(v===null)throw Error(r(387));if(v=v.memoizedProps,v!==null){var w=d.type;pn(d.pendingProps.value,v.value)||(i!==null?i.push(w):i=[w])}}else if(d===Te.current){if(v=d.alternate,v===null)throw Error(r(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(i!==null?i.push(qa):i=[qa])}d=d.return}i!==null&&wd(s,i,a,l),s.flags|=262144}function au(i){for(i=i.firstContext;i!==null;){if(!pn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function is(i){ns=i,ki=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function qt(i){return Nv(ns,i)}function lu(i,s){return ns===null&&is(i),Nv(i,s)}function Nv(i,s){var a=s._currentValue;if(s={context:s,memoizedValue:a,next:null},ki===null){if(i===null)throw Error(r(308));ki=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else ki=ki.next=s;return a}var hk=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(a,l){i.push(l)}};this.abort=function(){s.aborted=!0,i.forEach(function(a){return a()})}},pk=t.unstable_scheduleCallback,mk=t.unstable_NormalPriority,vt={$$typeof:M,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xd(){return{controller:new hk,data:new Map,refCount:0}}function ya(i){i.refCount--,i.refCount===0&&pk(mk,function(){i.controller.abort()})}var ga=null,Td=0,Xs=0,Zs=null;function yk(i,s){if(ga===null){var a=ga=[];Td=0,Xs=Oh(),Zs={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Td++,s.then($v,$v),s}function $v(){if(--Td===0&&ga!==null){Zs!==null&&(Zs.status="fulfilled");var i=ga;ga=null,Xs=0,Zs=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function gk(i,s){var a=[],l={status:"pending",value:null,reason:null,then:function(d){a.push(d)}};return i.then(function(){l.status="fulfilled",l.value=s;for(var d=0;d<a.length;d++)(0,a[d])(s)},function(d){for(l.status="rejected",l.reason=d,d=0;d<a.length;d++)(0,a[d])(void 0)}),l}var jv=j.S;j.S=function(i,s){v0=st(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&yk(i,s),jv!==null&&jv(i,s)};var rs=E(null);function Ad(){var i=rs.current;return i!==null?i:He.pooledCache}function uu(i,s){s===null?H(rs,rs.current):H(rs,s.pool)}function Bv(){var i=Ad();return i===null?null:{parent:vt._currentValue,pool:i}}var Qs=Error(r(460)),Ed=Error(r(474)),cu=Error(r(542)),fu={then:function(){}};function zv(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Lv(i,s,a){switch(a=i[a],a===void 0?i.push(s):a!==s&&(s.then(Ei,Ei),s=a),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,Uv(i),i;default:if(typeof s.status=="string")s.then(Ei,Ei);else{if(i=He,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=s,i.status="pending",i.then(function(l){if(s.status==="pending"){var d=s;d.status="fulfilled",d.value=l}},function(l){if(s.status==="pending"){var d=s;d.status="rejected",d.reason=l}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,Uv(i),i}throw os=s,Qs}}function ss(i){try{var s=i._init;return s(i._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(os=a,Qs):a}}var os=null;function Vv(){if(os===null)throw Error(r(459));var i=os;return os=null,i}function Uv(i){if(i===Qs||i===cu)throw Error(r(483))}var Ws=null,va=0;function du(i){var s=va;return va+=1,Ws===null&&(Ws=[]),Lv(Ws,i,s)}function ba(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function hu(i,s){throw s.$$typeof===b?Error(r(525)):(i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function Kv(i){function s(R,O){if(i){var D=R.deletions;D===null?(R.deletions=[O],R.flags|=16):D.push(O)}}function a(R,O){if(!i)return null;for(;O!==null;)s(R,O),O=O.sibling;return null}function l(R){for(var O=new Map;R!==null;)R.key!==null?O.set(R.key,R):O.set(R.index,R),R=R.sibling;return O}function d(R,O){return R=_i(R,O),R.index=0,R.sibling=null,R}function p(R,O,D){return R.index=D,i?(D=R.alternate,D!==null?(D=D.index,D<O?(R.flags|=67108866,O):D):(R.flags|=67108866,O)):(R.flags|=1048576,O)}function v(R){return i&&R.alternate===null&&(R.flags|=67108866),R}function w(R,O,D,K){return O===null||O.tag!==6?(O=hd(D,R.mode,K),O.return=R,O):(O=d(O,D),O.return=R,O)}function A(R,O,D,K){var le=D.type;return le===T?V(R,O,D.props.children,K,D.key):O!==null&&(O.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===X&&ss(le)===O.type)?(O=d(O,D.props),ba(O,D),O.return=R,O):(O=su(D.type,D.key,D.props,null,R.mode,K),ba(O,D),O.return=R,O)}function $(R,O,D,K){return O===null||O.tag!==4||O.stateNode.containerInfo!==D.containerInfo||O.stateNode.implementation!==D.implementation?(O=pd(D,R.mode,K),O.return=R,O):(O=d(O,D.children||[]),O.return=R,O)}function V(R,O,D,K,le){return O===null||O.tag!==7?(O=es(D,R.mode,K,le),O.return=R,O):(O=d(O,D),O.return=R,O)}function P(R,O,D){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=hd(""+O,R.mode,D),O.return=R,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case S:return D=su(O.type,O.key,O.props,null,R.mode,D),ba(D,O),D.return=R,D;case x:return O=pd(O,R.mode,D),O.return=R,O;case X:return O=ss(O),P(R,O,D)}if(ne(O)||je(O))return O=es(O,R.mode,D,null),O.return=R,O;if(typeof O.then=="function")return P(R,du(O),D);if(O.$$typeof===M)return P(R,lu(R,O),D);hu(R,O)}return null}function B(R,O,D,K){var le=O!==null?O.key:null;if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return le!==null?null:w(R,O,""+D,K);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case S:return D.key===le?A(R,O,D,K):null;case x:return D.key===le?$(R,O,D,K):null;case X:return D=ss(D),B(R,O,D,K)}if(ne(D)||je(D))return le!==null?null:V(R,O,D,K,null);if(typeof D.then=="function")return B(R,O,du(D),K);if(D.$$typeof===M)return B(R,O,lu(R,D),K);hu(R,D)}return null}function z(R,O,D,K,le){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return R=R.get(D)||null,w(O,R,""+K,le);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case S:return R=R.get(K.key===null?D:K.key)||null,A(O,R,K,le);case x:return R=R.get(K.key===null?D:K.key)||null,$(O,R,K,le);case X:return K=ss(K),z(R,O,D,K,le)}if(ne(K)||je(K))return R=R.get(D)||null,V(O,R,K,le,null);if(typeof K.then=="function")return z(R,O,D,du(K),le);if(K.$$typeof===M)return z(R,O,D,lu(O,K),le);hu(O,K)}return null}function ie(R,O,D,K){for(var le=null,Ne=null,se=O,Se=O=0,_e=null;se!==null&&Se<D.length;Se++){se.index>Se?(_e=se,se=null):_e=se.sibling;var $e=B(R,se,D[Se],K);if($e===null){se===null&&(se=_e);break}i&&se&&$e.alternate===null&&s(R,se),O=p($e,O,Se),Ne===null?le=$e:Ne.sibling=$e,Ne=$e,se=_e}if(Se===D.length)return a(R,se),ke&&Ri(R,Se),le;if(se===null){for(;Se<D.length;Se++)se=P(R,D[Se],K),se!==null&&(O=p(se,O,Se),Ne===null?le=se:Ne.sibling=se,Ne=se);return ke&&Ri(R,Se),le}for(se=l(se);Se<D.length;Se++)_e=z(se,R,Se,D[Se],K),_e!==null&&(i&&_e.alternate!==null&&se.delete(_e.key===null?Se:_e.key),O=p(_e,O,Se),Ne===null?le=_e:Ne.sibling=_e,Ne=_e);return i&&se.forEach(function(Or){return s(R,Or)}),ke&&Ri(R,Se),le}function ue(R,O,D,K){if(D==null)throw Error(r(151));for(var le=null,Ne=null,se=O,Se=O=0,_e=null,$e=D.next();se!==null&&!$e.done;Se++,$e=D.next()){se.index>Se?(_e=se,se=null):_e=se.sibling;var Or=B(R,se,$e.value,K);if(Or===null){se===null&&(se=_e);break}i&&se&&Or.alternate===null&&s(R,se),O=p(Or,O,Se),Ne===null?le=Or:Ne.sibling=Or,Ne=Or,se=_e}if($e.done)return a(R,se),ke&&Ri(R,Se),le;if(se===null){for(;!$e.done;Se++,$e=D.next())$e=P(R,$e.value,K),$e!==null&&(O=p($e,O,Se),Ne===null?le=$e:Ne.sibling=$e,Ne=$e);return ke&&Ri(R,Se),le}for(se=l(se);!$e.done;Se++,$e=D.next())$e=z(se,R,Se,$e.value,K),$e!==null&&(i&&$e.alternate!==null&&se.delete($e.key===null?Se:$e.key),O=p($e,O,Se),Ne===null?le=$e:Ne.sibling=$e,Ne=$e);return i&&se.forEach(function(RC){return s(R,RC)}),ke&&Ri(R,Se),le}function Pe(R,O,D,K){if(typeof D=="object"&&D!==null&&D.type===T&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case S:e:{for(var le=D.key;O!==null;){if(O.key===le){if(le=D.type,le===T){if(O.tag===7){a(R,O.sibling),K=d(O,D.props.children),K.return=R,R=K;break e}}else if(O.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===X&&ss(le)===O.type){a(R,O.sibling),K=d(O,D.props),ba(K,D),K.return=R,R=K;break e}a(R,O);break}else s(R,O);O=O.sibling}D.type===T?(K=es(D.props.children,R.mode,K,D.key),K.return=R,R=K):(K=su(D.type,D.key,D.props,null,R.mode,K),ba(K,D),K.return=R,R=K)}return v(R);case x:e:{for(le=D.key;O!==null;){if(O.key===le)if(O.tag===4&&O.stateNode.containerInfo===D.containerInfo&&O.stateNode.implementation===D.implementation){a(R,O.sibling),K=d(O,D.children||[]),K.return=R,R=K;break e}else{a(R,O);break}else s(R,O);O=O.sibling}K=pd(D,R.mode,K),K.return=R,R=K}return v(R);case X:return D=ss(D),Pe(R,O,D,K)}if(ne(D))return ie(R,O,D,K);if(je(D)){if(le=je(D),typeof le!="function")throw Error(r(150));return D=le.call(D),ue(R,O,D,K)}if(typeof D.then=="function")return Pe(R,O,du(D),K);if(D.$$typeof===M)return Pe(R,O,lu(R,D),K);hu(R,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,O!==null&&O.tag===6?(a(R,O.sibling),K=d(O,D),K.return=R,R=K):(a(R,O),K=hd(D,R.mode,K),K.return=R,R=K),v(R)):a(R,O)}return function(R,O,D,K){try{va=0;var le=Pe(R,O,D,K);return Ws=null,le}catch(se){if(se===Qs||se===cu)throw se;var Ne=mn(29,se,null,R.mode);return Ne.lanes=K,Ne.return=R,Ne}}}var as=Kv(!0),qv=Kv(!1),ur=!1;function Od(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _d(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function cr(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function fr(i,s,a){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(Be&2)!==0){var d=l.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),l.pending=s,s=ru(i),Ev(i,null,a),s}return iu(i,l,s,a),ru(i)}function Sa(i,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194048)!==0)){var l=s.lanes;l&=i.pendingLanes,a|=l,s.lanes=a,Ng(i,a)}}function Rd(i,s){var a=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var d=null,p=null;if(a=a.firstBaseUpdate,a!==null){do{var v={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};p===null?d=p=v:p=p.next=v,a=a.next}while(a!==null);p===null?d=p=s:p=p.next=s}else d=p=s;a={baseState:l.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:l.shared,callbacks:l.callbacks},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=s:i.next=s,a.lastBaseUpdate=s}var kd=!1;function wa(){if(kd){var i=Zs;if(i!==null)throw i}}function xa(i,s,a,l){kd=!1;var d=i.updateQueue;ur=!1;var p=d.firstBaseUpdate,v=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var A=w,$=A.next;A.next=null,v===null?p=$:v.next=$,v=A;var V=i.alternate;V!==null&&(V=V.updateQueue,w=V.lastBaseUpdate,w!==v&&(w===null?V.firstBaseUpdate=$:w.next=$,V.lastBaseUpdate=A))}if(p!==null){var P=d.baseState;v=0,V=$=A=null,w=p;do{var B=w.lane&-536870913,z=B!==w.lane;if(z?(Oe&B)===B:(l&B)===B){B!==0&&B===Xs&&(kd=!0),V!==null&&(V=V.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var ie=i,ue=w;B=s;var Pe=a;switch(ue.tag){case 1:if(ie=ue.payload,typeof ie=="function"){P=ie.call(Pe,P,B);break e}P=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=ue.payload,B=typeof ie=="function"?ie.call(Pe,P,B):ie,B==null)break e;P=g({},P,B);break e;case 2:ur=!0}}B=w.callback,B!==null&&(i.flags|=64,z&&(i.flags|=8192),z=d.callbacks,z===null?d.callbacks=[B]:z.push(B))}else z={lane:B,tag:w.tag,payload:w.payload,callback:w.callback,next:null},V===null?($=V=z,A=P):V=V.next=z,v|=B;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;z=w,w=z.next,z.next=null,d.lastBaseUpdate=z,d.shared.pending=null}}while(!0);V===null&&(A=P),d.baseState=A,d.firstBaseUpdate=$,d.lastBaseUpdate=V,p===null&&(d.shared.lanes=0),yr|=v,i.lanes=v,i.memoizedState=P}}function Pv(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function Iv(i,s){var a=i.callbacks;if(a!==null)for(i.callbacks=null,i=0;i<a.length;i++)Pv(a[i],s)}var eo=E(null),pu=E(0);function Hv(i,s){i=Vi,H(pu,i),H(eo,s),Vi=i|s.baseLanes}function Cd(){H(pu,Vi),H(eo,eo.current)}function Md(){Vi=pu.current,q(eo),q(pu)}var yn=E(null),Nn=null;function dr(i){var s=i.alternate;H(pt,pt.current&1),H(yn,i),Nn===null&&(s===null||eo.current!==null||s.memoizedState!==null)&&(Nn=i)}function Dd(i){H(pt,pt.current),H(yn,i),Nn===null&&(Nn=i)}function Fv(i){i.tag===22?(H(pt,pt.current),H(yn,i),Nn===null&&(Nn=i)):hr()}function hr(){H(pt,pt.current),H(yn,yn.current)}function gn(i){q(yn),Nn===i&&(Nn=null),q(pt)}var pt=E(0);function mu(i){for(var s=i;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Lh(a)||Vh(a)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Mi=0,ve=null,Ke=null,bt=null,yu=!1,to=!1,ls=!1,gu=0,Ta=0,no=null,vk=0;function ot(){throw Error(r(321))}function Nd(i,s){if(s===null)return!1;for(var a=0;a<s.length&&a<i.length;a++)if(!pn(i[a],s[a]))return!1;return!0}function $d(i,s,a,l,d,p){return Mi=p,ve=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,j.H=i===null||i.memoizedState===null?kb:Jd,ls=!1,p=a(l,d),ls=!1,to&&(p=Yv(s,a,l,d)),Gv(i),p}function Gv(i){j.H=Oa;var s=Ke!==null&&Ke.next!==null;if(Mi=0,bt=Ke=ve=null,yu=!1,Ta=0,no=null,s)throw Error(r(300));i===null||St||(i=i.dependencies,i!==null&&au(i)&&(St=!0))}function Yv(i,s,a,l){ve=i;var d=0;do{if(to&&(no=null),Ta=0,to=!1,25<=d)throw Error(r(301));if(d+=1,bt=Ke=null,i.updateQueue!=null){var p=i.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}j.H=Cb,p=s(a,l)}while(to);return p}function bk(){var i=j.H,s=i.useState()[0];return s=typeof s.then=="function"?Aa(s):s,i=i.useState()[0],(Ke!==null?Ke.memoizedState:null)!==i&&(ve.flags|=1024),s}function jd(){var i=gu!==0;return gu=0,i}function Bd(i,s,a){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~a}function zd(i){if(yu){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}yu=!1}Mi=0,bt=Ke=ve=null,to=!1,Ta=gu=0,no=null}function Zt(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?ve.memoizedState=bt=i:bt=bt.next=i,bt}function mt(){if(Ke===null){var i=ve.alternate;i=i!==null?i.memoizedState:null}else i=Ke.next;var s=bt===null?ve.memoizedState:bt.next;if(s!==null)bt=s,Ke=i;else{if(i===null)throw ve.alternate===null?Error(r(467)):Error(r(310));Ke=i,i={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},bt===null?ve.memoizedState=bt=i:bt=bt.next=i}return bt}function vu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Aa(i){var s=Ta;return Ta+=1,no===null&&(no=[]),i=Lv(no,i,s),s=ve,(bt===null?s.memoizedState:bt.next)===null&&(s=s.alternate,j.H=s===null||s.memoizedState===null?kb:Jd),i}function bu(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Aa(i);if(i.$$typeof===M)return qt(i)}throw Error(r(438,String(i)))}function Ld(i){var s=null,a=ve.updateQueue;if(a!==null&&(s=a.memoCache),s==null){var l=ve.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(s={data:l.data.map(function(d){return d.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),a===null&&(a=vu(),ve.updateQueue=a),a.memoCache=s,a=s.data[s.index],a===void 0)for(a=s.data[s.index]=Array(i),l=0;l<i;l++)a[l]=pe;return s.index++,a}function Di(i,s){return typeof s=="function"?s(i):s}function Su(i){var s=mt();return Vd(s,Ke,i)}function Vd(i,s,a){var l=i.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var d=i.baseQueue,p=l.pending;if(p!==null){if(d!==null){var v=d.next;d.next=p.next,p.next=v}s.baseQueue=d=p,l.pending=null}if(p=i.baseState,d===null)i.memoizedState=p;else{s=d.next;var w=v=null,A=null,$=s,V=!1;do{var P=$.lane&-536870913;if(P!==$.lane?(Oe&P)===P:(Mi&P)===P){var B=$.revertLane;if(B===0)A!==null&&(A=A.next={lane:0,revertLane:0,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null}),P===Xs&&(V=!0);else if((Mi&B)===B){$=$.next,B===Xs&&(V=!0);continue}else P={lane:0,revertLane:$.revertLane,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},A===null?(w=A=P,v=p):A=A.next=P,ve.lanes|=B,yr|=B;P=$.action,ls&&a(p,P),p=$.hasEagerState?$.eagerState:a(p,P)}else B={lane:P,revertLane:$.revertLane,gesture:$.gesture,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},A===null?(w=A=B,v=p):A=A.next=B,ve.lanes|=P,yr|=P;$=$.next}while($!==null&&$!==s);if(A===null?v=p:A.next=w,!pn(p,i.memoizedState)&&(St=!0,V&&(a=Zs,a!==null)))throw a;i.memoizedState=p,i.baseState=v,i.baseQueue=A,l.lastRenderedState=p}return d===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function Ud(i){var s=mt(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var l=a.dispatch,d=a.pending,p=s.memoizedState;if(d!==null){a.pending=null;var v=d=d.next;do p=i(p,v.action),v=v.next;while(v!==d);pn(p,s.memoizedState)||(St=!0),s.memoizedState=p,s.baseQueue===null&&(s.baseState=p),a.lastRenderedState=p}return[p,l]}function Jv(i,s,a){var l=ve,d=mt(),p=ke;if(p){if(a===void 0)throw Error(r(407));a=a()}else a=s();var v=!pn((Ke||d).memoizedState,a);if(v&&(d.memoizedState=a,St=!0),d=d.queue,Pd(Qv.bind(null,l,d,i),[i]),d.getSnapshot!==s||v||bt!==null&&bt.memoizedState.tag&1){if(l.flags|=2048,io(9,{destroy:void 0},Zv.bind(null,l,d,a,s),null),He===null)throw Error(r(349));p||(Mi&127)!==0||Xv(l,s,a)}return a}function Xv(i,s,a){i.flags|=16384,i={getSnapshot:s,value:a},s=ve.updateQueue,s===null?(s=vu(),ve.updateQueue=s,s.stores=[i]):(a=s.stores,a===null?s.stores=[i]:a.push(i))}function Zv(i,s,a,l){s.value=a,s.getSnapshot=l,Wv(s)&&eb(i)}function Qv(i,s,a){return a(function(){Wv(s)&&eb(i)})}function Wv(i){var s=i.getSnapshot;i=i.value;try{var a=s();return!pn(i,a)}catch{return!0}}function eb(i){var s=Wr(i,2);s!==null&&ln(s,i,2)}function Kd(i){var s=Zt();if(typeof i=="function"){var a=i;if(i=a(),ls){nr(!0);try{a()}finally{nr(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:i},s}function tb(i,s,a,l){return i.baseState=a,Vd(i,Ke,typeof l=="function"?l:Di)}function Sk(i,s,a,l,d){if(Tu(i))throw Error(r(485));if(i=s.action,i!==null){var p={payload:d,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){p.listeners.push(v)}};j.T!==null?a(!0):p.isTransition=!1,l(p),a=s.pending,a===null?(p.next=s.pending=p,nb(s,p)):(p.next=a.next,s.pending=a.next=p)}}function nb(i,s){var a=s.action,l=s.payload,d=i.state;if(s.isTransition){var p=j.T,v={};j.T=v;try{var w=a(d,l),A=j.S;A!==null&&A(v,w),ib(i,s,w)}catch($){qd(i,s,$)}finally{p!==null&&v.types!==null&&(p.types=v.types),j.T=p}}else try{p=a(d,l),ib(i,s,p)}catch($){qd(i,s,$)}}function ib(i,s,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){rb(i,s,l)},function(l){return qd(i,s,l)}):rb(i,s,a)}function rb(i,s,a){s.status="fulfilled",s.value=a,sb(s),i.state=a,s=i.pending,s!==null&&(a=s.next,a===s?i.pending=null:(a=a.next,s.next=a,nb(i,a)))}function qd(i,s,a){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=a,sb(s),s=s.next;while(s!==l)}i.action=null}function sb(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function ob(i,s){return s}function ab(i,s){if(ke){var a=He.formState;if(a!==null){e:{var l=ve;if(ke){if(Ze){t:{for(var d=Ze,p=Dn;d.nodeType!==8;){if(!p){d=null;break t}if(d=$n(d.nextSibling),d===null){d=null;break t}}p=d.data,d=p==="F!"||p==="F"?d:null}if(d){Ze=$n(d.nextSibling),l=d.data==="F!";break e}}ar(l)}l=!1}l&&(s=a[0])}}return a=Zt(),a.memoizedState=a.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ob,lastRenderedState:s},a.queue=l,a=Ob.bind(null,ve,l),l.dispatch=a,l=Kd(!1),p=Yd.bind(null,ve,!1,l.queue),l=Zt(),d={state:s,dispatch:null,action:i,pending:null},l.queue=d,a=Sk.bind(null,ve,d,p,a),d.dispatch=a,l.memoizedState=i,[s,a,!1]}function lb(i){var s=mt();return ub(s,Ke,i)}function ub(i,s,a){if(s=Vd(i,s,ob)[0],i=Su(Di)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=Aa(s)}catch(v){throw v===Qs?cu:v}else l=s;s=mt();var d=s.queue,p=d.dispatch;return a!==s.memoizedState&&(ve.flags|=2048,io(9,{destroy:void 0},wk.bind(null,d,a),null)),[l,p,i]}function wk(i,s){i.action=s}function cb(i){var s=mt(),a=Ke;if(a!==null)return ub(s,a,i);mt(),s=s.memoizedState,a=mt();var l=a.queue.dispatch;return a.memoizedState=i,[s,l,!1]}function io(i,s,a,l){return i={tag:i,create:a,deps:l,inst:s,next:null},s=ve.updateQueue,s===null&&(s=vu(),ve.updateQueue=s),a=s.lastEffect,a===null?s.lastEffect=i.next=i:(l=a.next,a.next=i,i.next=l,s.lastEffect=i),i}function fb(){return mt().memoizedState}function wu(i,s,a,l){var d=Zt();ve.flags|=i,d.memoizedState=io(1|s,{destroy:void 0},a,l===void 0?null:l)}function xu(i,s,a,l){var d=mt();l=l===void 0?null:l;var p=d.memoizedState.inst;Ke!==null&&l!==null&&Nd(l,Ke.memoizedState.deps)?d.memoizedState=io(s,p,a,l):(ve.flags|=i,d.memoizedState=io(1|s,p,a,l))}function db(i,s){wu(8390656,8,i,s)}function Pd(i,s){xu(2048,8,i,s)}function xk(i){ve.flags|=4;var s=ve.updateQueue;if(s===null)s=vu(),ve.updateQueue=s,s.events=[i];else{var a=s.events;a===null?s.events=[i]:a.push(i)}}function hb(i){var s=mt().memoizedState;return xk({ref:s,nextImpl:i}),function(){if((Be&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function pb(i,s){return xu(4,2,i,s)}function mb(i,s){return xu(4,4,i,s)}function yb(i,s){if(typeof s=="function"){i=i();var a=s(i);return function(){typeof a=="function"?a():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function gb(i,s,a){a=a!=null?a.concat([i]):null,xu(4,4,yb.bind(null,s,i),a)}function Id(){}function vb(i,s){var a=mt();s=s===void 0?null:s;var l=a.memoizedState;return s!==null&&Nd(s,l[1])?l[0]:(a.memoizedState=[i,s],i)}function bb(i,s){var a=mt();s=s===void 0?null:s;var l=a.memoizedState;if(s!==null&&Nd(s,l[1]))return l[0];if(l=i(),ls){nr(!0);try{i()}finally{nr(!1)}}return a.memoizedState=[l,s],l}function Hd(i,s,a){return a===void 0||(Mi&1073741824)!==0&&(Oe&261930)===0?i.memoizedState=s:(i.memoizedState=a,i=S0(),ve.lanes|=i,yr|=i,a)}function Sb(i,s,a,l){return pn(a,s)?a:eo.current!==null?(i=Hd(i,a,l),pn(i,s)||(St=!0),i):(Mi&42)===0||(Mi&1073741824)!==0&&(Oe&261930)===0?(St=!0,i.memoizedState=a):(i=S0(),ve.lanes|=i,yr|=i,s)}function wb(i,s,a,l,d){var p=U.p;U.p=p!==0&&8>p?p:8;var v=j.T,w={};j.T=w,Yd(i,!1,s,a);try{var A=d(),$=j.S;if($!==null&&$(w,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var V=gk(A,l);Ea(i,s,V,Sn(i))}else Ea(i,s,l,Sn(i))}catch(P){Ea(i,s,{then:function(){},status:"rejected",reason:P},Sn())}finally{U.p=p,v!==null&&w.types!==null&&(v.types=w.types),j.T=v}}function Tk(){}function Fd(i,s,a,l){if(i.tag!==5)throw Error(r(476));var d=xb(i).queue;wb(i,d,s,L,a===null?Tk:function(){return Tb(i),a(l)})}function xb(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:L,baseState:L,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:L},next:null};var a={};return s.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:a},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function Tb(i){var s=xb(i);s.next===null&&(s=i.alternate.memoizedState),Ea(i,s.next.queue,{},Sn())}function Gd(){return qt(qa)}function Ab(){return mt().memoizedState}function Eb(){return mt().memoizedState}function Ak(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var a=Sn();i=cr(a);var l=fr(s,i,a);l!==null&&(ln(l,s,a),Sa(l,s,a)),s={cache:xd()},i.payload=s;return}s=s.return}}function Ek(i,s,a){var l=Sn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Tu(i)?_b(s,a):(a=fd(i,s,a,l),a!==null&&(ln(a,i,l),Rb(a,s,l)))}function Ob(i,s,a){var l=Sn();Ea(i,s,a,l)}function Ea(i,s,a,l){var d={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Tu(i))_b(s,d);else{var p=i.alternate;if(i.lanes===0&&(p===null||p.lanes===0)&&(p=s.lastRenderedReducer,p!==null))try{var v=s.lastRenderedState,w=p(v,a);if(d.hasEagerState=!0,d.eagerState=w,pn(w,v))return iu(i,s,d,0),He===null&&nu(),!1}catch{}if(a=fd(i,s,d,l),a!==null)return ln(a,i,l),Rb(a,s,l),!0}return!1}function Yd(i,s,a,l){if(l={lane:2,revertLane:Oh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Tu(i)){if(s)throw Error(r(479))}else s=fd(i,a,l,2),s!==null&&ln(s,i,2)}function Tu(i){var s=i.alternate;return i===ve||s!==null&&s===ve}function _b(i,s){to=yu=!0;var a=i.pending;a===null?s.next=s:(s.next=a.next,a.next=s),i.pending=s}function Rb(i,s,a){if((a&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,a|=l,s.lanes=a,Ng(i,a)}}var Oa={readContext:qt,use:bu,useCallback:ot,useContext:ot,useEffect:ot,useImperativeHandle:ot,useLayoutEffect:ot,useInsertionEffect:ot,useMemo:ot,useReducer:ot,useRef:ot,useState:ot,useDebugValue:ot,useDeferredValue:ot,useTransition:ot,useSyncExternalStore:ot,useId:ot,useHostTransitionStatus:ot,useFormState:ot,useActionState:ot,useOptimistic:ot,useMemoCache:ot,useCacheRefresh:ot};Oa.useEffectEvent=ot;var kb={readContext:qt,use:bu,useCallback:function(i,s){return Zt().memoizedState=[i,s===void 0?null:s],i},useContext:qt,useEffect:db,useImperativeHandle:function(i,s,a){a=a!=null?a.concat([i]):null,wu(4194308,4,yb.bind(null,s,i),a)},useLayoutEffect:function(i,s){return wu(4194308,4,i,s)},useInsertionEffect:function(i,s){wu(4,2,i,s)},useMemo:function(i,s){var a=Zt();s=s===void 0?null:s;var l=i();if(ls){nr(!0);try{i()}finally{nr(!1)}}return a.memoizedState=[l,s],l},useReducer:function(i,s,a){var l=Zt();if(a!==void 0){var d=a(s);if(ls){nr(!0);try{a(s)}finally{nr(!1)}}}else d=s;return l.memoizedState=l.baseState=d,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:d},l.queue=i,i=i.dispatch=Ek.bind(null,ve,i),[l.memoizedState,i]},useRef:function(i){var s=Zt();return i={current:i},s.memoizedState=i},useState:function(i){i=Kd(i);var s=i.queue,a=Ob.bind(null,ve,s);return s.dispatch=a,[i.memoizedState,a]},useDebugValue:Id,useDeferredValue:function(i,s){var a=Zt();return Hd(a,i,s)},useTransition:function(){var i=Kd(!1);return i=wb.bind(null,ve,i.queue,!0,!1),Zt().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,a){var l=ve,d=Zt();if(ke){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),He===null)throw Error(r(349));(Oe&127)!==0||Xv(l,s,a)}d.memoizedState=a;var p={value:a,getSnapshot:s};return d.queue=p,db(Qv.bind(null,l,p,i),[i]),l.flags|=2048,io(9,{destroy:void 0},Zv.bind(null,l,p,a,s),null),a},useId:function(){var i=Zt(),s=He.identifierPrefix;if(ke){var a=si,l=ri;a=(l&~(1<<32-hn(l)-1)).toString(32)+a,s="_"+s+"R_"+a,a=gu++,0<a&&(s+="H"+a.toString(32)),s+="_"}else a=vk++,s="_"+s+"r_"+a.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:Gd,useFormState:ab,useActionState:ab,useOptimistic:function(i){var s=Zt();s.memoizedState=s.baseState=i;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=a,s=Yd.bind(null,ve,!0,a),a.dispatch=s,[i,s]},useMemoCache:Ld,useCacheRefresh:function(){return Zt().memoizedState=Ak.bind(null,ve)},useEffectEvent:function(i){var s=Zt(),a={impl:i};return s.memoizedState=a,function(){if((Be&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Jd={readContext:qt,use:bu,useCallback:vb,useContext:qt,useEffect:Pd,useImperativeHandle:gb,useInsertionEffect:pb,useLayoutEffect:mb,useMemo:bb,useReducer:Su,useRef:fb,useState:function(){return Su(Di)},useDebugValue:Id,useDeferredValue:function(i,s){var a=mt();return Sb(a,Ke.memoizedState,i,s)},useTransition:function(){var i=Su(Di)[0],s=mt().memoizedState;return[typeof i=="boolean"?i:Aa(i),s]},useSyncExternalStore:Jv,useId:Ab,useHostTransitionStatus:Gd,useFormState:lb,useActionState:lb,useOptimistic:function(i,s){var a=mt();return tb(a,Ke,i,s)},useMemoCache:Ld,useCacheRefresh:Eb};Jd.useEffectEvent=hb;var Cb={readContext:qt,use:bu,useCallback:vb,useContext:qt,useEffect:Pd,useImperativeHandle:gb,useInsertionEffect:pb,useLayoutEffect:mb,useMemo:bb,useReducer:Ud,useRef:fb,useState:function(){return Ud(Di)},useDebugValue:Id,useDeferredValue:function(i,s){var a=mt();return Ke===null?Hd(a,i,s):Sb(a,Ke.memoizedState,i,s)},useTransition:function(){var i=Ud(Di)[0],s=mt().memoizedState;return[typeof i=="boolean"?i:Aa(i),s]},useSyncExternalStore:Jv,useId:Ab,useHostTransitionStatus:Gd,useFormState:cb,useActionState:cb,useOptimistic:function(i,s){var a=mt();return Ke!==null?tb(a,Ke,i,s):(a.baseState=i,[i,a.queue.dispatch])},useMemoCache:Ld,useCacheRefresh:Eb};Cb.useEffectEvent=hb;function Xd(i,s,a,l){s=i.memoizedState,a=a(l,s),a=a==null?s:g({},s,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var Zd={enqueueSetState:function(i,s,a){i=i._reactInternals;var l=Sn(),d=cr(l);d.payload=s,a!=null&&(d.callback=a),s=fr(i,d,l),s!==null&&(ln(s,i,l),Sa(s,i,l))},enqueueReplaceState:function(i,s,a){i=i._reactInternals;var l=Sn(),d=cr(l);d.tag=1,d.payload=s,a!=null&&(d.callback=a),s=fr(i,d,l),s!==null&&(ln(s,i,l),Sa(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var a=Sn(),l=cr(a);l.tag=2,s!=null&&(l.callback=s),s=fr(i,l,a),s!==null&&(ln(s,i,a),Sa(s,i,a))}};function Mb(i,s,a,l,d,p,v){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,p,v):s.prototype&&s.prototype.isPureReactComponent?!da(a,l)||!da(d,p):!0}function Db(i,s,a,l){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,l),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,l),s.state!==i&&Zd.enqueueReplaceState(s,s.state,null)}function us(i,s){var a=s;if("ref"in s){a={};for(var l in s)l!=="ref"&&(a[l]=s[l])}if(i=i.defaultProps){a===s&&(a=g({},a));for(var d in i)a[d]===void 0&&(a[d]=i[d])}return a}function Nb(i){tu(i)}function $b(i){console.error(i)}function jb(i){tu(i)}function Au(i,s){try{var a=i.onUncaughtError;a(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function Bb(i,s,a){try{var l=i.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Qd(i,s,a){return a=cr(a),a.tag=3,a.payload={element:null},a.callback=function(){Au(i,s)},a}function zb(i){return i=cr(i),i.tag=3,i}function Lb(i,s,a,l){var d=a.type.getDerivedStateFromError;if(typeof d=="function"){var p=l.value;i.payload=function(){return d(p)},i.callback=function(){Bb(s,a,l)}}var v=a.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){Bb(s,a,l),typeof d!="function"&&(gr===null?gr=new Set([this]):gr.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function Ok(i,s,a,l,d){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=a.alternate,s!==null&&Js(s,a,d,!0),a=yn.current,a!==null){switch(a.tag){case 31:case 13:return Nn===null?Bu():a.alternate===null&&at===0&&(at=3),a.flags&=-257,a.flags|=65536,a.lanes=d,l===fu?a.flags|=16384:(s=a.updateQueue,s===null?a.updateQueue=new Set([l]):s.add(l),Th(i,l,d)),!1;case 22:return a.flags|=65536,l===fu?a.flags|=16384:(s=a.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=s):(a=s.retryQueue,a===null?s.retryQueue=new Set([l]):a.add(l)),Th(i,l,d)),!1}throw Error(r(435,a.tag))}return Th(i,l,d),Bu(),!1}if(ke)return s=yn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=d,l!==gd&&(i=Error(r(422),{cause:l}),ma(kn(i,a)))):(l!==gd&&(s=Error(r(423),{cause:l}),ma(kn(s,a))),i=i.current.alternate,i.flags|=65536,d&=-d,i.lanes|=d,l=kn(l,a),d=Qd(i.stateNode,l,d),Rd(i,d),at!==4&&(at=2)),!1;var p=Error(r(520),{cause:l});if(p=kn(p,a),$a===null?$a=[p]:$a.push(p),at!==4&&(at=2),s===null)return!0;l=kn(l,a),a=s;do{switch(a.tag){case 3:return a.flags|=65536,i=d&-d,a.lanes|=i,i=Qd(a.stateNode,l,i),Rd(a,i),!1;case 1:if(s=a.type,p=a.stateNode,(a.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(gr===null||!gr.has(p))))return a.flags|=65536,d&=-d,a.lanes|=d,d=zb(d),Lb(d,i,a,l),Rd(a,d),!1}a=a.return}while(a!==null);return!1}var Wd=Error(r(461)),St=!1;function Pt(i,s,a,l){s.child=i===null?qv(s,null,a,l):as(s,i.child,a,l)}function Vb(i,s,a,l,d){a=a.render;var p=s.ref;if("ref"in l){var v={};for(var w in l)w!=="ref"&&(v[w]=l[w])}else v=l;return is(s),l=$d(i,s,a,v,p,d),w=jd(),i!==null&&!St?(Bd(i,s,d),Ni(i,s,d)):(ke&&w&&md(s),s.flags|=1,Pt(i,s,l,d),s.child)}function Ub(i,s,a,l,d){if(i===null){var p=a.type;return typeof p=="function"&&!dd(p)&&p.defaultProps===void 0&&a.compare===null?(s.tag=15,s.type=p,Kb(i,s,p,l,d)):(i=su(a.type,null,l,s,s.mode,d),i.ref=s.ref,i.return=s,s.child=i)}if(p=i.child,!ah(i,d)){var v=p.memoizedProps;if(a=a.compare,a=a!==null?a:da,a(v,l)&&i.ref===s.ref)return Ni(i,s,d)}return s.flags|=1,i=_i(p,l),i.ref=s.ref,i.return=s,s.child=i}function Kb(i,s,a,l,d){if(i!==null){var p=i.memoizedProps;if(da(p,l)&&i.ref===s.ref)if(St=!1,s.pendingProps=l=p,ah(i,d))(i.flags&131072)!==0&&(St=!0);else return s.lanes=i.lanes,Ni(i,s,d)}return eh(i,s,a,l,d)}function qb(i,s,a,l){var d=l.children,p=i!==null?i.memoizedState:null;if(i===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((s.flags&128)!==0){if(p=p!==null?p.baseLanes|a:a,i!==null){for(l=s.child=i.child,d=0;l!==null;)d=d|l.lanes|l.childLanes,l=l.sibling;l=d&~p}else l=0,s.child=null;return Pb(i,s,p,a,l)}if((a&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&uu(s,p!==null?p.cachePool:null),p!==null?Hv(s,p):Cd(),Fv(s);else return l=s.lanes=536870912,Pb(i,s,p!==null?p.baseLanes|a:a,a,l)}else p!==null?(uu(s,p.cachePool),Hv(s,p),hr(),s.memoizedState=null):(i!==null&&uu(s,null),Cd(),hr());return Pt(i,s,d,a),s.child}function _a(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Pb(i,s,a,l,d){var p=Ad();return p=p===null?null:{parent:vt._currentValue,pool:p},s.memoizedState={baseLanes:a,cachePool:p},i!==null&&uu(s,null),Cd(),Fv(s),i!==null&&Js(i,s,l,!0),s.childLanes=d,null}function Eu(i,s){return s=_u({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function Ib(i,s,a){return as(s,i.child,null,a),i=Eu(s,s.pendingProps),i.flags|=2,gn(s),s.memoizedState=null,i}function _k(i,s,a){var l=s.pendingProps,d=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(ke){if(l.mode==="hidden")return i=Eu(s,l),s.lanes=536870912,_a(null,i);if(Dd(s),(i=Ze)?(i=nS(i,Dn),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:sr!==null?{id:ri,overflow:si}:null,retryLane:536870912,hydrationErrors:null},a=_v(i),a.return=s,s.child=a,Kt=s,Ze=null)):i=null,i===null)throw ar(s);return s.lanes=536870912,null}return Eu(s,l)}var p=i.memoizedState;if(p!==null){var v=p.dehydrated;if(Dd(s),d)if(s.flags&256)s.flags&=-257,s=Ib(i,s,a);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(r(558));else if(St||Js(i,s,a,!1),d=(a&i.childLanes)!==0,St||d){if(l=He,l!==null&&(v=$g(l,a),v!==0&&v!==p.retryLane))throw p.retryLane=v,Wr(i,v),ln(l,i,v),Wd;Bu(),s=Ib(i,s,a)}else i=p.treeContext,Ze=$n(v.nextSibling),Kt=s,ke=!0,or=null,Dn=!1,i!==null&&Cv(s,i),s=Eu(s,l),s.flags|=4096;return s}return i=_i(i.child,{mode:l.mode,children:l.children}),i.ref=s.ref,s.child=i,i.return=s,i}function Ou(i,s){var a=s.ref;if(a===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(i===null||i.ref!==a)&&(s.flags|=4194816)}}function eh(i,s,a,l,d){return is(s),a=$d(i,s,a,l,void 0,d),l=jd(),i!==null&&!St?(Bd(i,s,d),Ni(i,s,d)):(ke&&l&&md(s),s.flags|=1,Pt(i,s,a,d),s.child)}function Hb(i,s,a,l,d,p){return is(s),s.updateQueue=null,a=Yv(s,l,a,d),Gv(i),l=jd(),i!==null&&!St?(Bd(i,s,p),Ni(i,s,p)):(ke&&l&&md(s),s.flags|=1,Pt(i,s,a,p),s.child)}function Fb(i,s,a,l,d){if(is(s),s.stateNode===null){var p=Hs,v=a.contextType;typeof v=="object"&&v!==null&&(p=qt(v)),p=new a(l,p),s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Zd,s.stateNode=p,p._reactInternals=s,p=s.stateNode,p.props=l,p.state=s.memoizedState,p.refs={},Od(s),v=a.contextType,p.context=typeof v=="object"&&v!==null?qt(v):Hs,p.state=s.memoizedState,v=a.getDerivedStateFromProps,typeof v=="function"&&(Xd(s,a,v,l),p.state=s.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(v=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),v!==p.state&&Zd.enqueueReplaceState(p,p.state,null),xa(s,l,p,d),wa(),p.state=s.memoizedState),typeof p.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){p=s.stateNode;var w=s.memoizedProps,A=us(a,w);p.props=A;var $=p.context,V=a.contextType;v=Hs,typeof V=="object"&&V!==null&&(v=qt(V));var P=a.getDerivedStateFromProps;V=typeof P=="function"||typeof p.getSnapshotBeforeUpdate=="function",w=s.pendingProps!==w,V||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w||$!==v)&&Db(s,p,l,v),ur=!1;var B=s.memoizedState;p.state=B,xa(s,l,p,d),wa(),$=s.memoizedState,w||B!==$||ur?(typeof P=="function"&&(Xd(s,a,P,l),$=s.memoizedState),(A=ur||Mb(s,a,A,l,B,$,v))?(V||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(s.flags|=4194308)):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=$),p.props=l,p.state=$,p.context=v,l=A):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{p=s.stateNode,_d(i,s),v=s.memoizedProps,V=us(a,v),p.props=V,P=s.pendingProps,B=p.context,$=a.contextType,A=Hs,typeof $=="object"&&$!==null&&(A=qt($)),w=a.getDerivedStateFromProps,($=typeof w=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==P||B!==A)&&Db(s,p,l,A),ur=!1,B=s.memoizedState,p.state=B,xa(s,l,p,d),wa();var z=s.memoizedState;v!==P||B!==z||ur||i!==null&&i.dependencies!==null&&au(i.dependencies)?(typeof w=="function"&&(Xd(s,a,w,l),z=s.memoizedState),(V=ur||Mb(s,a,V,l,B,z,A)||i!==null&&i.dependencies!==null&&au(i.dependencies))?($||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,z,A),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,z,A)),typeof p.componentDidUpdate=="function"&&(s.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof p.componentDidUpdate!="function"||v===i.memoizedProps&&B===i.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&B===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=z),p.props=l,p.state=z,p.context=A,l=V):(typeof p.componentDidUpdate!="function"||v===i.memoizedProps&&B===i.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&B===i.memoizedState||(s.flags|=1024),l=!1)}return p=l,Ou(i,s),l=(s.flags&128)!==0,p||l?(p=s.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:p.render(),s.flags|=1,i!==null&&l?(s.child=as(s,i.child,null,d),s.child=as(s,null,a,d)):Pt(i,s,a,d),s.memoizedState=p.state,i=s.child):i=Ni(i,s,d),i}function Gb(i,s,a,l){return ts(),s.flags|=256,Pt(i,s,a,l),s.child}var th={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function nh(i){return{baseLanes:i,cachePool:Bv()}}function ih(i,s,a){return i=i!==null?i.childLanes&~a:0,s&&(i|=bn),i}function Yb(i,s,a){var l=s.pendingProps,d=!1,p=(s.flags&128)!==0,v;if((v=p)||(v=i!==null&&i.memoizedState===null?!1:(pt.current&2)!==0),v&&(d=!0,s.flags&=-129),v=(s.flags&32)!==0,s.flags&=-33,i===null){if(ke){if(d?dr(s):hr(),(i=Ze)?(i=nS(i,Dn),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:sr!==null?{id:ri,overflow:si}:null,retryLane:536870912,hydrationErrors:null},a=_v(i),a.return=s,s.child=a,Kt=s,Ze=null)):i=null,i===null)throw ar(s);return Vh(i)?s.lanes=32:s.lanes=536870912,null}var w=l.children;return l=l.fallback,d?(hr(),d=s.mode,w=_u({mode:"hidden",children:w},d),l=es(l,d,a,null),w.return=s,l.return=s,w.sibling=l,s.child=w,l=s.child,l.memoizedState=nh(a),l.childLanes=ih(i,v,a),s.memoizedState=th,_a(null,l)):(dr(s),rh(s,w))}var A=i.memoizedState;if(A!==null&&(w=A.dehydrated,w!==null)){if(p)s.flags&256?(dr(s),s.flags&=-257,s=sh(i,s,a)):s.memoizedState!==null?(hr(),s.child=i.child,s.flags|=128,s=null):(hr(),w=l.fallback,d=s.mode,l=_u({mode:"visible",children:l.children},d),w=es(w,d,a,null),w.flags|=2,l.return=s,w.return=s,l.sibling=w,s.child=l,as(s,i.child,null,a),l=s.child,l.memoizedState=nh(a),l.childLanes=ih(i,v,a),s.memoizedState=th,s=_a(null,l));else if(dr(s),Vh(w)){if(v=w.nextSibling&&w.nextSibling.dataset,v)var $=v.dgst;v=$,l=Error(r(419)),l.stack="",l.digest=v,ma({value:l,source:null,stack:null}),s=sh(i,s,a)}else if(St||Js(i,s,a,!1),v=(a&i.childLanes)!==0,St||v){if(v=He,v!==null&&(l=$g(v,a),l!==0&&l!==A.retryLane))throw A.retryLane=l,Wr(i,l),ln(v,i,l),Wd;Lh(w)||Bu(),s=sh(i,s,a)}else Lh(w)?(s.flags|=192,s.child=i.child,s=null):(i=A.treeContext,Ze=$n(w.nextSibling),Kt=s,ke=!0,or=null,Dn=!1,i!==null&&Cv(s,i),s=rh(s,l.children),s.flags|=4096);return s}return d?(hr(),w=l.fallback,d=s.mode,A=i.child,$=A.sibling,l=_i(A,{mode:"hidden",children:l.children}),l.subtreeFlags=A.subtreeFlags&65011712,$!==null?w=_i($,w):(w=es(w,d,a,null),w.flags|=2),w.return=s,l.return=s,l.sibling=w,s.child=l,_a(null,l),l=s.child,w=i.child.memoizedState,w===null?w=nh(a):(d=w.cachePool,d!==null?(A=vt._currentValue,d=d.parent!==A?{parent:A,pool:A}:d):d=Bv(),w={baseLanes:w.baseLanes|a,cachePool:d}),l.memoizedState=w,l.childLanes=ih(i,v,a),s.memoizedState=th,_a(i.child,l)):(dr(s),a=i.child,i=a.sibling,a=_i(a,{mode:"visible",children:l.children}),a.return=s,a.sibling=null,i!==null&&(v=s.deletions,v===null?(s.deletions=[i],s.flags|=16):v.push(i)),s.child=a,s.memoizedState=null,a)}function rh(i,s){return s=_u({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function _u(i,s){return i=mn(22,i,null,s),i.lanes=0,i}function sh(i,s,a){return as(s,i.child,null,a),i=rh(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Jb(i,s,a){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),Sd(i.return,s,a)}function oh(i,s,a,l,d,p){var v=i.memoizedState;v===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:d,treeForkCount:p}:(v.isBackwards=s,v.rendering=null,v.renderingStartTime=0,v.last=l,v.tail=a,v.tailMode=d,v.treeForkCount=p)}function Xb(i,s,a){var l=s.pendingProps,d=l.revealOrder,p=l.tail;l=l.children;var v=pt.current,w=(v&2)!==0;if(w?(v=v&1|2,s.flags|=128):v&=1,H(pt,v),Pt(i,s,l,a),l=ke?pa:0,!w&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Jb(i,a,s);else if(i.tag===19)Jb(i,a,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(d){case"forwards":for(a=s.child,d=null;a!==null;)i=a.alternate,i!==null&&mu(i)===null&&(d=a),a=a.sibling;a=d,a===null?(d=s.child,s.child=null):(d=a.sibling,a.sibling=null),oh(s,!1,d,a,p,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,d=s.child,s.child=null;d!==null;){if(i=d.alternate,i!==null&&mu(i)===null){s.child=d;break}i=d.sibling,d.sibling=a,a=d,d=i}oh(s,!0,a,null,p,l);break;case"together":oh(s,!1,null,null,void 0,l);break;default:s.memoizedState=null}return s.child}function Ni(i,s,a){if(i!==null&&(s.dependencies=i.dependencies),yr|=s.lanes,(a&s.childLanes)===0)if(i!==null){if(Js(i,s,a,!1),(a&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(r(153));if(s.child!==null){for(i=s.child,a=_i(i,i.pendingProps),s.child=a,a.return=s;i.sibling!==null;)i=i.sibling,a=a.sibling=_i(i,i.pendingProps),a.return=s;a.sibling=null}return s.child}function ah(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&au(i)))}function Rk(i,s,a){switch(s.tag){case 3:Rt(s,s.stateNode.containerInfo),lr(s,vt,i.memoizedState.cache),ts();break;case 27:case 5:ni(s);break;case 4:Rt(s,s.stateNode.containerInfo);break;case 10:lr(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Dd(s),null;break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(dr(s),s.flags|=128,null):(a&s.child.childLanes)!==0?Yb(i,s,a):(dr(s),i=Ni(i,s,a),i!==null?i.sibling:null);dr(s);break;case 19:var d=(i.flags&128)!==0;if(l=(a&s.childLanes)!==0,l||(Js(i,s,a,!1),l=(a&s.childLanes)!==0),d){if(l)return Xb(i,s,a);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),H(pt,pt.current),l)break;return null;case 22:return s.lanes=0,qb(i,s,a,s.pendingProps);case 24:lr(s,vt,i.memoizedState.cache)}return Ni(i,s,a)}function Zb(i,s,a){if(i!==null)if(i.memoizedProps!==s.pendingProps)St=!0;else{if(!ah(i,a)&&(s.flags&128)===0)return St=!1,Rk(i,s,a);St=(i.flags&131072)!==0}else St=!1,ke&&(s.flags&1048576)!==0&&kv(s,pa,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(i=ss(s.elementType),s.type=i,typeof i=="function")dd(i)?(l=us(i,l),s.tag=1,s=Fb(null,s,i,l,a)):(s.tag=0,s=eh(null,s,i,l,a));else{if(i!=null){var d=i.$$typeof;if(d===G){s.tag=11,s=Vb(null,s,i,l,a);break e}else if(d===J){s.tag=14,s=Ub(null,s,i,l,a);break e}}throw s=Z(i)||i,Error(r(306,s,""))}}return s;case 0:return eh(i,s,s.type,s.pendingProps,a);case 1:return l=s.type,d=us(l,s.pendingProps),Fb(i,s,l,d,a);case 3:e:{if(Rt(s,s.stateNode.containerInfo),i===null)throw Error(r(387));l=s.pendingProps;var p=s.memoizedState;d=p.element,_d(i,s),xa(s,l,null,a);var v=s.memoizedState;if(l=v.cache,lr(s,vt,l),l!==p.cache&&wd(s,[vt],a,!0),wa(),l=v.element,p.isDehydrated)if(p={element:l,isDehydrated:!1,cache:v.cache},s.updateQueue.baseState=p,s.memoizedState=p,s.flags&256){s=Gb(i,s,l,a);break e}else if(l!==d){d=kn(Error(r(424)),s),ma(d),s=Gb(i,s,l,a);break e}else{switch(i=s.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(Ze=$n(i.firstChild),Kt=s,ke=!0,or=null,Dn=!0,a=qv(s,null,l,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ts(),l===d){s=Ni(i,s,a);break e}Pt(i,s,l,a)}s=s.child}return s;case 26:return Ou(i,s),i===null?(a=lS(s.type,null,s.pendingProps,null))?s.memoizedState=a:ke||(a=s.type,i=s.pendingProps,l=Pu(ce.current).createElement(a),l[Ut]=s,l[tn]=i,It(l,a,i),Nt(l),s.stateNode=l):s.memoizedState=lS(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return ni(s),i===null&&ke&&(l=s.stateNode=sS(s.type,s.pendingProps,ce.current),Kt=s,Dn=!0,d=Ze,wr(s.type)?(Uh=d,Ze=$n(l.firstChild)):Ze=d),Pt(i,s,s.pendingProps.children,a),Ou(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&ke&&((d=l=Ze)&&(l=rC(l,s.type,s.pendingProps,Dn),l!==null?(s.stateNode=l,Kt=s,Ze=$n(l.firstChild),Dn=!1,d=!0):d=!1),d||ar(s)),ni(s),d=s.type,p=s.pendingProps,v=i!==null?i.memoizedProps:null,l=p.children,jh(d,p)?l=null:v!==null&&jh(d,v)&&(s.flags|=32),s.memoizedState!==null&&(d=$d(i,s,bk,null,null,a),qa._currentValue=d),Ou(i,s),Pt(i,s,l,a),s.child;case 6:return i===null&&ke&&((i=a=Ze)&&(a=sC(a,s.pendingProps,Dn),a!==null?(s.stateNode=a,Kt=s,Ze=null,i=!0):i=!1),i||ar(s)),null;case 13:return Yb(i,s,a);case 4:return Rt(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=as(s,null,l,a):Pt(i,s,l,a),s.child;case 11:return Vb(i,s,s.type,s.pendingProps,a);case 7:return Pt(i,s,s.pendingProps,a),s.child;case 8:return Pt(i,s,s.pendingProps.children,a),s.child;case 12:return Pt(i,s,s.pendingProps.children,a),s.child;case 10:return l=s.pendingProps,lr(s,s.type,l.value),Pt(i,s,l.children,a),s.child;case 9:return d=s.type._context,l=s.pendingProps.children,is(s),d=qt(d),l=l(d),s.flags|=1,Pt(i,s,l,a),s.child;case 14:return Ub(i,s,s.type,s.pendingProps,a);case 15:return Kb(i,s,s.type,s.pendingProps,a);case 19:return Xb(i,s,a);case 31:return _k(i,s,a);case 22:return qb(i,s,a,s.pendingProps);case 24:return is(s),l=qt(vt),i===null?(d=Ad(),d===null&&(d=He,p=xd(),d.pooledCache=p,p.refCount++,p!==null&&(d.pooledCacheLanes|=a),d=p),s.memoizedState={parent:l,cache:d},Od(s),lr(s,vt,d)):((i.lanes&a)!==0&&(_d(i,s),xa(s,null,null,a),wa()),d=i.memoizedState,p=s.memoizedState,d.parent!==l?(d={parent:l,cache:l},s.memoizedState=d,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=d),lr(s,vt,l)):(l=p.cache,lr(s,vt,l),l!==d.cache&&wd(s,[vt],a,!0))),Pt(i,s,s.pendingProps.children,a),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function $i(i){i.flags|=4}function lh(i,s,a,l,d){if((s=(i.mode&32)!==0)&&(s=!1),s){if(i.flags|=16777216,(d&335544128)===d)if(i.stateNode.complete)i.flags|=8192;else if(A0())i.flags|=8192;else throw os=fu,Ed}else i.flags&=-16777217}function Qb(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!hS(s))if(A0())i.flags|=8192;else throw os=fu,Ed}function Ru(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Mg():536870912,i.lanes|=s,ao|=s)}function Ra(i,s){if(!ke)switch(i.tailMode){case"hidden":s=i.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?i.tail=null:a.sibling=null;break;case"collapsed":a=i.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:l.sibling=null}}function Qe(i){var s=i.alternate!==null&&i.alternate.child===i.child,a=0,l=0;if(s)for(var d=i.child;d!==null;)a|=d.lanes|d.childLanes,l|=d.subtreeFlags&65011712,l|=d.flags&65011712,d.return=i,d=d.sibling;else for(d=i.child;d!==null;)a|=d.lanes|d.childLanes,l|=d.subtreeFlags,l|=d.flags,d.return=i,d=d.sibling;return i.subtreeFlags|=l,i.childLanes=a,s}function kk(i,s,a){var l=s.pendingProps;switch(yd(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(s),null;case 1:return Qe(s),null;case 3:return a=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),Ci(vt),Je(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(i===null||i.child===null)&&(Ys(s)?$i(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,vd())),Qe(s),null;case 26:var d=s.type,p=s.memoizedState;return i===null?($i(s),p!==null?(Qe(s),Qb(s,p)):(Qe(s),lh(s,d,null,l,a))):p?p!==i.memoizedState?($i(s),Qe(s),Qb(s,p)):(Qe(s),s.flags&=-16777217):(i=i.memoizedProps,i!==l&&$i(s),Qe(s),lh(s,d,i,l,a)),null;case 27:if(Ti(s),a=ce.current,d=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&$i(s);else{if(!l){if(s.stateNode===null)throw Error(r(166));return Qe(s),null}i=Q.current,Ys(s)?Mv(s):(i=sS(d,l,a),s.stateNode=i,$i(s))}return Qe(s),null;case 5:if(Ti(s),d=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&$i(s);else{if(!l){if(s.stateNode===null)throw Error(r(166));return Qe(s),null}if(p=Q.current,Ys(s))Mv(s);else{var v=Pu(ce.current);switch(p){case 1:p=v.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:p=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":p=v.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":p=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":p=v.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof l.is=="string"?v.createElement("select",{is:l.is}):v.createElement("select"),l.multiple?p.multiple=!0:l.size&&(p.size=l.size);break;default:p=typeof l.is=="string"?v.createElement(d,{is:l.is}):v.createElement(d)}}p[Ut]=s,p[tn]=l;e:for(v=s.child;v!==null;){if(v.tag===5||v.tag===6)p.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===s)break e;for(;v.sibling===null;){if(v.return===null||v.return===s)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}s.stateNode=p;e:switch(It(p,d,l),d){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&$i(s)}}return Qe(s),lh(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,a),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&$i(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(r(166));if(i=ce.current,Ys(s)){if(i=s.stateNode,a=s.memoizedProps,l=null,d=Kt,d!==null)switch(d.tag){case 27:case 5:l=d.memoizedProps}i[Ut]=s,i=!!(i.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Y0(i.nodeValue,a)),i||ar(s,!0)}else i=Pu(i).createTextNode(l),i[Ut]=s,s.stateNode=i}return Qe(s),null;case 31:if(a=s.memoizedState,i===null||i.memoizedState!==null){if(l=Ys(s),a!==null){if(i===null){if(!l)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Ut]=s}else ts(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Qe(s),i=!1}else a=vd(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=a),i=!0;if(!i)return s.flags&256?(gn(s),s):(gn(s),null);if((s.flags&128)!==0)throw Error(r(558))}return Qe(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(d=Ys(s),l!==null&&l.dehydrated!==null){if(i===null){if(!d)throw Error(r(318));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));d[Ut]=s}else ts(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Qe(s),d=!1}else d=vd(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(gn(s),s):(gn(s),null)}return gn(s),(s.flags&128)!==0?(s.lanes=a,s):(a=l!==null,i=i!==null&&i.memoizedState!==null,a&&(l=s.child,d=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(d=l.alternate.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==d&&(l.flags|=2048)),a!==i&&a&&(s.child.flags|=8192),Ru(s,s.updateQueue),Qe(s),null);case 4:return Je(),i===null&&Ch(s.stateNode.containerInfo),Qe(s),null;case 10:return Ci(s.type),Qe(s),null;case 19:if(q(pt),l=s.memoizedState,l===null)return Qe(s),null;if(d=(s.flags&128)!==0,p=l.rendering,p===null)if(d)Ra(l,!1);else{if(at!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(p=mu(i),p!==null){for(s.flags|=128,Ra(l,!1),i=p.updateQueue,s.updateQueue=i,Ru(s,i),s.subtreeFlags=0,i=a,a=s.child;a!==null;)Ov(a,i),a=a.sibling;return H(pt,pt.current&1|2),ke&&Ri(s,l.treeForkCount),s.child}i=i.sibling}l.tail!==null&&st()>Nu&&(s.flags|=128,d=!0,Ra(l,!1),s.lanes=4194304)}else{if(!d)if(i=mu(p),i!==null){if(s.flags|=128,d=!0,i=i.updateQueue,s.updateQueue=i,Ru(s,i),Ra(l,!0),l.tail===null&&l.tailMode==="hidden"&&!p.alternate&&!ke)return Qe(s),null}else 2*st()-l.renderingStartTime>Nu&&a!==536870912&&(s.flags|=128,d=!0,Ra(l,!1),s.lanes=4194304);l.isBackwards?(p.sibling=s.child,s.child=p):(i=l.last,i!==null?i.sibling=p:s.child=p,l.last=p)}return l.tail!==null?(i=l.tail,l.rendering=i,l.tail=i.sibling,l.renderingStartTime=st(),i.sibling=null,a=pt.current,H(pt,d?a&1|2:a&1),ke&&Ri(s,l.treeForkCount),i):(Qe(s),null);case 22:case 23:return gn(s),Md(),l=s.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(a&536870912)!==0&&(s.flags&128)===0&&(Qe(s),s.subtreeFlags&6&&(s.flags|=8192)):Qe(s),a=s.updateQueue,a!==null&&Ru(s,a.retryQueue),a=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==a&&(s.flags|=2048),i!==null&&q(rs),null;case 24:return a=null,i!==null&&(a=i.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),Ci(vt),Qe(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function Ck(i,s){switch(yd(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return Ci(vt),Je(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return Ti(s),null;case 31:if(s.memoizedState!==null){if(gn(s),s.alternate===null)throw Error(r(340));ts()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(gn(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ts()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return q(pt),null;case 4:return Je(),null;case 10:return Ci(s.type),null;case 22:case 23:return gn(s),Md(),i!==null&&q(rs),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return Ci(vt),null;case 25:return null;default:return null}}function Wb(i,s){switch(yd(s),s.tag){case 3:Ci(vt),Je();break;case 26:case 27:case 5:Ti(s);break;case 4:Je();break;case 31:s.memoizedState!==null&&gn(s);break;case 13:gn(s);break;case 19:q(pt);break;case 10:Ci(s.type);break;case 22:case 23:gn(s),Md(),i!==null&&q(rs);break;case 24:Ci(vt)}}function ka(i,s){try{var a=s.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var d=l.next;a=d;do{if((a.tag&i)===i){l=void 0;var p=a.create,v=a.inst;l=p(),v.destroy=l}a=a.next}while(a!==d)}}catch(w){Ue(s,s.return,w)}}function pr(i,s,a){try{var l=s.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var p=d.next;l=p;do{if((l.tag&i)===i){var v=l.inst,w=v.destroy;if(w!==void 0){v.destroy=void 0,d=s;var A=a,$=w;try{$()}catch(V){Ue(d,A,V)}}}l=l.next}while(l!==p)}}catch(V){Ue(s,s.return,V)}}function e0(i){var s=i.updateQueue;if(s!==null){var a=i.stateNode;try{Iv(s,a)}catch(l){Ue(i,i.return,l)}}}function t0(i,s,a){a.props=us(i.type,i.memoizedProps),a.state=i.memoizedState;try{a.componentWillUnmount()}catch(l){Ue(i,s,l)}}function Ca(i,s){try{var a=i.ref;if(a!==null){switch(i.tag){case 26:case 27:case 5:var l=i.stateNode;break;case 30:l=i.stateNode;break;default:l=i.stateNode}typeof a=="function"?i.refCleanup=a(l):a.current=l}}catch(d){Ue(i,s,d)}}function oi(i,s){var a=i.ref,l=i.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(d){Ue(i,s,d)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(d){Ue(i,s,d)}else a.current=null}function n0(i){var s=i.type,a=i.memoizedProps,l=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(d){Ue(i,i.return,d)}}function uh(i,s,a){try{var l=i.stateNode;Qk(l,i.type,a,s),l[tn]=s}catch(d){Ue(i,i.return,d)}}function i0(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&wr(i.type)||i.tag===4}function ch(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||i0(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&wr(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function fh(i,s,a){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(i,s):(s=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,s.appendChild(i),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=Ei));else if(l!==4&&(l===27&&wr(i.type)&&(a=i.stateNode,s=null),i=i.child,i!==null))for(fh(i,s,a),i=i.sibling;i!==null;)fh(i,s,a),i=i.sibling}function ku(i,s,a){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?a.insertBefore(i,s):a.appendChild(i);else if(l!==4&&(l===27&&wr(i.type)&&(a=i.stateNode),i=i.child,i!==null))for(ku(i,s,a),i=i.sibling;i!==null;)ku(i,s,a),i=i.sibling}function r0(i){var s=i.stateNode,a=i.memoizedProps;try{for(var l=i.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);It(s,l,a),s[Ut]=i,s[tn]=a}catch(p){Ue(i,i.return,p)}}var ji=!1,wt=!1,dh=!1,s0=typeof WeakSet=="function"?WeakSet:Set,$t=null;function Mk(i,s){if(i=i.containerInfo,Nh=Xu,i=gv(i),sd(i)){if("selectionStart"in i)var a={start:i.selectionStart,end:i.selectionEnd};else e:{a=(a=i.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var d=l.anchorOffset,p=l.focusNode;l=l.focusOffset;try{a.nodeType,p.nodeType}catch{a=null;break e}var v=0,w=-1,A=-1,$=0,V=0,P=i,B=null;t:for(;;){for(var z;P!==a||d!==0&&P.nodeType!==3||(w=v+d),P!==p||l!==0&&P.nodeType!==3||(A=v+l),P.nodeType===3&&(v+=P.nodeValue.length),(z=P.firstChild)!==null;)B=P,P=z;for(;;){if(P===i)break t;if(B===a&&++$===d&&(w=v),B===p&&++V===l&&(A=v),(z=P.nextSibling)!==null)break;P=B,B=P.parentNode}P=z}a=w===-1||A===-1?null:{start:w,end:A}}else a=null}a=a||{start:0,end:0}}else a=null;for($h={focusedElem:i,selectionRange:a},Xu=!1,$t=s;$t!==null;)if(s=$t,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,$t=i;else for(;$t!==null;){switch(s=$t,p=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(a=0;a<i.length;a++)d=i[a],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&p!==null){i=void 0,a=s,d=p.memoizedProps,p=p.memoizedState,l=a.stateNode;try{var ie=us(a.type,d);i=l.getSnapshotBeforeUpdate(ie,p),l.__reactInternalSnapshotBeforeUpdate=i}catch(ue){Ue(a,a.return,ue)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,a=i.nodeType,a===9)zh(i);else if(a===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":zh(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=s.sibling,i!==null){i.return=s.return,$t=i;break}$t=s.return}}function o0(i,s,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:zi(i,a),l&4&&ka(5,a);break;case 1:if(zi(i,a),l&4)if(i=a.stateNode,s===null)try{i.componentDidMount()}catch(v){Ue(a,a.return,v)}else{var d=us(a.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(d,s,i.__reactInternalSnapshotBeforeUpdate)}catch(v){Ue(a,a.return,v)}}l&64&&e0(a),l&512&&Ca(a,a.return);break;case 3:if(zi(i,a),l&64&&(i=a.updateQueue,i!==null)){if(s=null,a.child!==null)switch(a.child.tag){case 27:case 5:s=a.child.stateNode;break;case 1:s=a.child.stateNode}try{Iv(i,s)}catch(v){Ue(a,a.return,v)}}break;case 27:s===null&&l&4&&r0(a);case 26:case 5:zi(i,a),s===null&&l&4&&n0(a),l&512&&Ca(a,a.return);break;case 12:zi(i,a);break;case 31:zi(i,a),l&4&&u0(i,a);break;case 13:zi(i,a),l&4&&c0(i,a),l&64&&(i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(a=Uk.bind(null,a),oC(i,a))));break;case 22:if(l=a.memoizedState!==null||ji,!l){s=s!==null&&s.memoizedState!==null||wt,d=ji;var p=wt;ji=l,(wt=s)&&!p?Li(i,a,(a.subtreeFlags&8772)!==0):zi(i,a),ji=d,wt=p}break;case 30:break;default:zi(i,a)}}function a0(i){var s=i.alternate;s!==null&&(i.alternate=null,a0(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&qf(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var tt=null,rn=!1;function Bi(i,s,a){for(a=a.child;a!==null;)l0(i,s,a),a=a.sibling}function l0(i,s,a){if(dn&&typeof dn.onCommitFiberUnmount=="function")try{dn.onCommitFiberUnmount(ea,a)}catch{}switch(a.tag){case 26:wt||oi(a,s),Bi(i,s,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:wt||oi(a,s);var l=tt,d=rn;wr(a.type)&&(tt=a.stateNode,rn=!1),Bi(i,s,a),Va(a.stateNode),tt=l,rn=d;break;case 5:wt||oi(a,s);case 6:if(l=tt,d=rn,tt=null,Bi(i,s,a),tt=l,rn=d,tt!==null)if(rn)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(a.stateNode)}catch(p){Ue(a,s,p)}else try{tt.removeChild(a.stateNode)}catch(p){Ue(a,s,p)}break;case 18:tt!==null&&(rn?(i=tt,eS(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.stateNode),yo(i)):eS(tt,a.stateNode));break;case 4:l=tt,d=rn,tt=a.stateNode.containerInfo,rn=!0,Bi(i,s,a),tt=l,rn=d;break;case 0:case 11:case 14:case 15:pr(2,a,s),wt||pr(4,a,s),Bi(i,s,a);break;case 1:wt||(oi(a,s),l=a.stateNode,typeof l.componentWillUnmount=="function"&&t0(a,s,l)),Bi(i,s,a);break;case 21:Bi(i,s,a);break;case 22:wt=(l=wt)||a.memoizedState!==null,Bi(i,s,a),wt=l;break;default:Bi(i,s,a)}}function u0(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{yo(i)}catch(a){Ue(s,s.return,a)}}}function c0(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{yo(i)}catch(a){Ue(s,s.return,a)}}function Dk(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new s0),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new s0),s;default:throw Error(r(435,i.tag))}}function Cu(i,s){var a=Dk(i);s.forEach(function(l){if(!a.has(l)){a.add(l);var d=Kk.bind(null,i,l);l.then(d,d)}})}function sn(i,s){var a=s.deletions;if(a!==null)for(var l=0;l<a.length;l++){var d=a[l],p=i,v=s,w=v;e:for(;w!==null;){switch(w.tag){case 27:if(wr(w.type)){tt=w.stateNode,rn=!1;break e}break;case 5:tt=w.stateNode,rn=!1;break e;case 3:case 4:tt=w.stateNode.containerInfo,rn=!0;break e}w=w.return}if(tt===null)throw Error(r(160));l0(p,v,d),tt=null,rn=!1,p=d.alternate,p!==null&&(p.return=null),d.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)f0(s,i),s=s.sibling}var Fn=null;function f0(i,s){var a=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:sn(s,i),on(i),l&4&&(pr(3,i,i.return),ka(3,i),pr(5,i,i.return));break;case 1:sn(s,i),on(i),l&512&&(wt||a===null||oi(a,a.return)),l&64&&ji&&(i=i.updateQueue,i!==null&&(l=i.callbacks,l!==null&&(a=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var d=Fn;if(sn(s,i),on(i),l&512&&(wt||a===null||oi(a,a.return)),l&4){var p=a!==null?a.memoizedState:null;if(l=i.memoizedState,a===null)if(l===null)if(i.stateNode===null){e:{l=i.type,a=i.memoizedProps,d=d.ownerDocument||d;t:switch(l){case"title":p=d.getElementsByTagName("title")[0],(!p||p[ia]||p[Ut]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=d.createElement(l),d.head.insertBefore(p,d.querySelector("head > title"))),It(p,l,a),p[Ut]=i,Nt(p),l=p;break e;case"link":var v=fS("link","href",d).get(l+(a.href||""));if(v){for(var w=0;w<v.length;w++)if(p=v[w],p.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&p.getAttribute("rel")===(a.rel==null?null:a.rel)&&p.getAttribute("title")===(a.title==null?null:a.title)&&p.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){v.splice(w,1);break t}}p=d.createElement(l),It(p,l,a),d.head.appendChild(p);break;case"meta":if(v=fS("meta","content",d).get(l+(a.content||""))){for(w=0;w<v.length;w++)if(p=v[w],p.getAttribute("content")===(a.content==null?null:""+a.content)&&p.getAttribute("name")===(a.name==null?null:a.name)&&p.getAttribute("property")===(a.property==null?null:a.property)&&p.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&p.getAttribute("charset")===(a.charSet==null?null:a.charSet)){v.splice(w,1);break t}}p=d.createElement(l),It(p,l,a),d.head.appendChild(p);break;default:throw Error(r(468,l))}p[Ut]=i,Nt(p),l=p}i.stateNode=l}else dS(d,i.type,i.stateNode);else i.stateNode=cS(d,l,i.memoizedProps);else p!==l?(p===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):p.count--,l===null?dS(d,i.type,i.stateNode):cS(d,l,i.memoizedProps)):l===null&&i.stateNode!==null&&uh(i,i.memoizedProps,a.memoizedProps)}break;case 27:sn(s,i),on(i),l&512&&(wt||a===null||oi(a,a.return)),a!==null&&l&4&&uh(i,i.memoizedProps,a.memoizedProps);break;case 5:if(sn(s,i),on(i),l&512&&(wt||a===null||oi(a,a.return)),i.flags&32){d=i.stateNode;try{Ls(d,"")}catch(ie){Ue(i,i.return,ie)}}l&4&&i.stateNode!=null&&(d=i.memoizedProps,uh(i,d,a!==null?a.memoizedProps:d)),l&1024&&(dh=!0);break;case 6:if(sn(s,i),on(i),l&4){if(i.stateNode===null)throw Error(r(162));l=i.memoizedProps,a=i.stateNode;try{a.nodeValue=l}catch(ie){Ue(i,i.return,ie)}}break;case 3:if(Fu=null,d=Fn,Fn=Iu(s.containerInfo),sn(s,i),Fn=d,on(i),l&4&&a!==null&&a.memoizedState.isDehydrated)try{yo(s.containerInfo)}catch(ie){Ue(i,i.return,ie)}dh&&(dh=!1,d0(i));break;case 4:l=Fn,Fn=Iu(i.stateNode.containerInfo),sn(s,i),on(i),Fn=l;break;case 12:sn(s,i),on(i);break;case 31:sn(s,i),on(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Cu(i,l)));break;case 13:sn(s,i),on(i),i.child.flags&8192&&i.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Du=st()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Cu(i,l)));break;case 22:d=i.memoizedState!==null;var A=a!==null&&a.memoizedState!==null,$=ji,V=wt;if(ji=$||d,wt=V||A,sn(s,i),wt=V,ji=$,on(i),l&8192)e:for(s=i.stateNode,s._visibility=d?s._visibility&-2:s._visibility|1,d&&(a===null||A||ji||wt||cs(i)),a=null,s=i;;){if(s.tag===5||s.tag===26){if(a===null){A=a=s;try{if(p=A.stateNode,d)v=p.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{w=A.stateNode;var P=A.memoizedProps.style,B=P!=null&&P.hasOwnProperty("display")?P.display:null;w.style.display=B==null||typeof B=="boolean"?"":(""+B).trim()}}catch(ie){Ue(A,A.return,ie)}}}else if(s.tag===6){if(a===null){A=s;try{A.stateNode.nodeValue=d?"":A.memoizedProps}catch(ie){Ue(A,A.return,ie)}}}else if(s.tag===18){if(a===null){A=s;try{var z=A.stateNode;d?tS(z,!0):tS(A.stateNode,!1)}catch(ie){Ue(A,A.return,ie)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===i)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;a===s&&(a=null),s=s.return}a===s&&(a=null),s.sibling.return=s.return,s=s.sibling}l&4&&(l=i.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Cu(i,a))));break;case 19:sn(s,i),on(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Cu(i,l)));break;case 30:break;case 21:break;default:sn(s,i),on(i)}}function on(i){var s=i.flags;if(s&2){try{for(var a,l=i.return;l!==null;){if(i0(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var d=a.stateNode,p=ch(i);ku(i,p,d);break;case 5:var v=a.stateNode;a.flags&32&&(Ls(v,""),a.flags&=-33);var w=ch(i);ku(i,w,v);break;case 3:case 4:var A=a.stateNode.containerInfo,$=ch(i);fh(i,$,A);break;default:throw Error(r(161))}}catch(V){Ue(i,i.return,V)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function d0(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;d0(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function zi(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)o0(i,s.alternate,s),s=s.sibling}function cs(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:pr(4,s,s.return),cs(s);break;case 1:oi(s,s.return);var a=s.stateNode;typeof a.componentWillUnmount=="function"&&t0(s,s.return,a),cs(s);break;case 27:Va(s.stateNode);case 26:case 5:oi(s,s.return),cs(s);break;case 22:s.memoizedState===null&&cs(s);break;case 30:cs(s);break;default:cs(s)}i=i.sibling}}function Li(i,s,a){for(a=a&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,d=i,p=s,v=p.flags;switch(p.tag){case 0:case 11:case 15:Li(d,p,a),ka(4,p);break;case 1:if(Li(d,p,a),l=p,d=l.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch($){Ue(l,l.return,$)}if(l=p,d=l.updateQueue,d!==null){var w=l.stateNode;try{var A=d.shared.hiddenCallbacks;if(A!==null)for(d.shared.hiddenCallbacks=null,d=0;d<A.length;d++)Pv(A[d],w)}catch($){Ue(l,l.return,$)}}a&&v&64&&e0(p),Ca(p,p.return);break;case 27:r0(p);case 26:case 5:Li(d,p,a),a&&l===null&&v&4&&n0(p),Ca(p,p.return);break;case 12:Li(d,p,a);break;case 31:Li(d,p,a),a&&v&4&&u0(d,p);break;case 13:Li(d,p,a),a&&v&4&&c0(d,p);break;case 22:p.memoizedState===null&&Li(d,p,a),Ca(p,p.return);break;case 30:break;default:Li(d,p,a)}s=s.sibling}}function hh(i,s){var a=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==a&&(i!=null&&i.refCount++,a!=null&&ya(a))}function ph(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&ya(i))}function Gn(i,s,a,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)h0(i,s,a,l),s=s.sibling}function h0(i,s,a,l){var d=s.flags;switch(s.tag){case 0:case 11:case 15:Gn(i,s,a,l),d&2048&&ka(9,s);break;case 1:Gn(i,s,a,l);break;case 3:Gn(i,s,a,l),d&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&ya(i)));break;case 12:if(d&2048){Gn(i,s,a,l),i=s.stateNode;try{var p=s.memoizedProps,v=p.id,w=p.onPostCommit;typeof w=="function"&&w(v,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(A){Ue(s,s.return,A)}}else Gn(i,s,a,l);break;case 31:Gn(i,s,a,l);break;case 13:Gn(i,s,a,l);break;case 23:break;case 22:p=s.stateNode,v=s.alternate,s.memoizedState!==null?p._visibility&2?Gn(i,s,a,l):Ma(i,s):p._visibility&2?Gn(i,s,a,l):(p._visibility|=2,ro(i,s,a,l,(s.subtreeFlags&10256)!==0||!1)),d&2048&&hh(v,s);break;case 24:Gn(i,s,a,l),d&2048&&ph(s.alternate,s);break;default:Gn(i,s,a,l)}}function ro(i,s,a,l,d){for(d=d&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var p=i,v=s,w=a,A=l,$=v.flags;switch(v.tag){case 0:case 11:case 15:ro(p,v,w,A,d),ka(8,v);break;case 23:break;case 22:var V=v.stateNode;v.memoizedState!==null?V._visibility&2?ro(p,v,w,A,d):Ma(p,v):(V._visibility|=2,ro(p,v,w,A,d)),d&&$&2048&&hh(v.alternate,v);break;case 24:ro(p,v,w,A,d),d&&$&2048&&ph(v.alternate,v);break;default:ro(p,v,w,A,d)}s=s.sibling}}function Ma(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var a=i,l=s,d=l.flags;switch(l.tag){case 22:Ma(a,l),d&2048&&hh(l.alternate,l);break;case 24:Ma(a,l),d&2048&&ph(l.alternate,l);break;default:Ma(a,l)}s=s.sibling}}var Da=8192;function so(i,s,a){if(i.subtreeFlags&Da)for(i=i.child;i!==null;)p0(i,s,a),i=i.sibling}function p0(i,s,a){switch(i.tag){case 26:so(i,s,a),i.flags&Da&&i.memoizedState!==null&&vC(a,Fn,i.memoizedState,i.memoizedProps);break;case 5:so(i,s,a);break;case 3:case 4:var l=Fn;Fn=Iu(i.stateNode.containerInfo),so(i,s,a),Fn=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=Da,Da=16777216,so(i,s,a),Da=l):so(i,s,a));break;default:so(i,s,a)}}function m0(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function Na(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var l=s[a];$t=l,g0(l,i)}m0(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)y0(i),i=i.sibling}function y0(i){switch(i.tag){case 0:case 11:case 15:Na(i),i.flags&2048&&pr(9,i,i.return);break;case 3:Na(i);break;case 12:Na(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Mu(i)):Na(i);break;default:Na(i)}}function Mu(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var l=s[a];$t=l,g0(l,i)}m0(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:pr(8,s,s.return),Mu(s);break;case 22:a=s.stateNode,a._visibility&2&&(a._visibility&=-3,Mu(s));break;default:Mu(s)}i=i.sibling}}function g0(i,s){for(;$t!==null;){var a=$t;switch(a.tag){case 0:case 11:case 15:pr(8,a,s);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:ya(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,$t=l;else e:for(a=i;$t!==null;){l=$t;var d=l.sibling,p=l.return;if(a0(l),l===a){$t=null;break e}if(d!==null){d.return=p,$t=d;break e}$t=p}}}var Nk={getCacheForType:function(i){var s=qt(vt),a=s.data.get(i);return a===void 0&&(a=i(),s.data.set(i,a)),a},cacheSignal:function(){return qt(vt).controller.signal}},$k=typeof WeakMap=="function"?WeakMap:Map,Be=0,He=null,Ae=null,Oe=0,Ve=0,vn=null,mr=!1,oo=!1,mh=!1,Vi=0,at=0,yr=0,fs=0,yh=0,bn=0,ao=0,$a=null,an=null,gh=!1,Du=0,v0=0,Nu=1/0,$u=null,gr=null,kt=0,vr=null,lo=null,Ui=0,vh=0,bh=null,b0=null,ja=0,Sh=null;function Sn(){return(Be&2)!==0&&Oe!==0?Oe&-Oe:j.T!==null?Oh():jg()}function S0(){if(bn===0)if((Oe&536870912)===0||ke){var i=ql;ql<<=1,(ql&3932160)===0&&(ql=262144),bn=i}else bn=536870912;return i=yn.current,i!==null&&(i.flags|=32),bn}function ln(i,s,a){(i===He&&(Ve===2||Ve===9)||i.cancelPendingCommit!==null)&&(uo(i,0),br(i,Oe,bn,!1)),na(i,a),((Be&2)===0||i!==He)&&(i===He&&((Be&2)===0&&(fs|=a),at===4&&br(i,Oe,bn,!1)),ai(i))}function w0(i,s,a){if((Be&6)!==0)throw Error(r(327));var l=!a&&(s&127)===0&&(s&i.expiredLanes)===0||ta(i,s),d=l?zk(i,s):xh(i,s,!0),p=l;do{if(d===0){oo&&!l&&br(i,s,0,!1);break}else{if(a=i.current.alternate,p&&!jk(a)){d=xh(i,s,!1),p=!1;continue}if(d===2){if(p=s,i.errorRecoveryDisabledLanes&p)var v=0;else v=i.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){s=v;e:{var w=i;d=$a;var A=w.current.memoizedState.isDehydrated;if(A&&(uo(w,v).flags|=256),v=xh(w,v,!1),v!==2){if(mh&&!A){w.errorRecoveryDisabledLanes|=p,fs|=p,d=4;break e}p=an,an=d,p!==null&&(an===null?an=p:an.push.apply(an,p))}d=v}if(p=!1,d!==2)continue}}if(d===1){uo(i,0),br(i,s,0,!0);break}e:{switch(l=i,p=d,p){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:br(l,s,bn,!mr);break e;case 2:an=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(d=Du+300-st(),10<d)){if(br(l,s,bn,!mr),Il(l,0,!0)!==0)break e;Ui=s,l.timeoutHandle=Q0(x0.bind(null,l,a,an,$u,gh,s,bn,fs,ao,mr,p,"Throttled",-0,0),d);break e}x0(l,a,an,$u,gh,s,bn,fs,ao,mr,p,null,-0,0)}}break}while(!0);ai(i)}function x0(i,s,a,l,d,p,v,w,A,$,V,P,B,z){if(i.timeoutHandle=-1,P=s.subtreeFlags,P&8192||(P&16785408)===16785408){P={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ei},p0(s,p,P);var ie=(p&62914560)===p?Du-st():(p&4194048)===p?v0-st():0;if(ie=bC(P,ie),ie!==null){Ui=p,i.cancelPendingCommit=ie(C0.bind(null,i,s,p,a,l,d,v,w,A,V,P,null,B,z)),br(i,p,v,!$);return}}C0(i,s,p,a,l,d,v,w,A)}function jk(i){for(var s=i;;){var a=s.tag;if((a===0||a===11||a===15)&&s.flags&16384&&(a=s.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var d=a[l],p=d.getSnapshot;d=d.value;try{if(!pn(p(),d))return!1}catch{return!1}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function br(i,s,a,l){s&=~yh,s&=~fs,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var d=s;0<d;){var p=31-hn(d),v=1<<p;l[p]=-1,d&=~v}a!==0&&Dg(i,a,s)}function ju(){return(Be&6)===0?(Ba(0),!1):!0}function wh(){if(Ae!==null){if(Ve===0)var i=Ae.return;else i=Ae,ki=ns=null,zd(i),Ws=null,va=0,i=Ae;for(;i!==null;)Wb(i.alternate,i),i=i.return;Ae=null}}function uo(i,s){var a=i.timeoutHandle;a!==-1&&(i.timeoutHandle=-1,tC(a)),a=i.cancelPendingCommit,a!==null&&(i.cancelPendingCommit=null,a()),Ui=0,wh(),He=i,Ae=a=_i(i.current,null),Oe=s,Ve=0,vn=null,mr=!1,oo=ta(i,s),mh=!1,ao=bn=yh=fs=yr=at=0,an=$a=null,gh=!1,(s&8)!==0&&(s|=s&32);var l=i.entangledLanes;if(l!==0)for(i=i.entanglements,l&=s;0<l;){var d=31-hn(l),p=1<<d;s|=i[d],l&=~p}return Vi=s,nu(),a}function T0(i,s){ve=null,j.H=Oa,s===Qs||s===cu?(s=Vv(),Ve=3):s===Ed?(s=Vv(),Ve=4):Ve=s===Wd?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,vn=s,Ae===null&&(at=1,Au(i,kn(s,i.current)))}function A0(){var i=yn.current;return i===null?!0:(Oe&4194048)===Oe?Nn===null:(Oe&62914560)===Oe||(Oe&536870912)!==0?i===Nn:!1}function E0(){var i=j.H;return j.H=Oa,i===null?Oa:i}function O0(){var i=j.A;return j.A=Nk,i}function Bu(){at=4,mr||(Oe&4194048)!==Oe&&yn.current!==null||(oo=!0),(yr&134217727)===0&&(fs&134217727)===0||He===null||br(He,Oe,bn,!1)}function xh(i,s,a){var l=Be;Be|=2;var d=E0(),p=O0();(He!==i||Oe!==s)&&($u=null,uo(i,s)),s=!1;var v=at;e:do try{if(Ve!==0&&Ae!==null){var w=Ae,A=vn;switch(Ve){case 8:wh(),v=6;break e;case 3:case 2:case 9:case 6:yn.current===null&&(s=!0);var $=Ve;if(Ve=0,vn=null,co(i,w,A,$),a&&oo){v=0;break e}break;default:$=Ve,Ve=0,vn=null,co(i,w,A,$)}}Bk(),v=at;break}catch(V){T0(i,V)}while(!0);return s&&i.shellSuspendCounter++,ki=ns=null,Be=l,j.H=d,j.A=p,Ae===null&&(He=null,Oe=0,nu()),v}function Bk(){for(;Ae!==null;)_0(Ae)}function zk(i,s){var a=Be;Be|=2;var l=E0(),d=O0();He!==i||Oe!==s?($u=null,Nu=st()+500,uo(i,s)):oo=ta(i,s);e:do try{if(Ve!==0&&Ae!==null){s=Ae;var p=vn;t:switch(Ve){case 1:Ve=0,vn=null,co(i,s,p,1);break;case 2:case 9:if(zv(p)){Ve=0,vn=null,R0(s);break}s=function(){Ve!==2&&Ve!==9||He!==i||(Ve=7),ai(i)},p.then(s,s);break e;case 3:Ve=7;break e;case 4:Ve=5;break e;case 7:zv(p)?(Ve=0,vn=null,R0(s)):(Ve=0,vn=null,co(i,s,p,7));break;case 5:var v=null;switch(Ae.tag){case 26:v=Ae.memoizedState;case 5:case 27:var w=Ae;if(v?hS(v):w.stateNode.complete){Ve=0,vn=null;var A=w.sibling;if(A!==null)Ae=A;else{var $=w.return;$!==null?(Ae=$,zu($)):Ae=null}break t}}Ve=0,vn=null,co(i,s,p,5);break;case 6:Ve=0,vn=null,co(i,s,p,6);break;case 8:wh(),at=6;break e;default:throw Error(r(462))}}Lk();break}catch(V){T0(i,V)}while(!0);return ki=ns=null,j.H=l,j.A=d,Be=a,Ae!==null?0:(He=null,Oe=0,nu(),at)}function Lk(){for(;Ae!==null&&!ii();)_0(Ae)}function _0(i){var s=Zb(i.alternate,i,Vi);i.memoizedProps=i.pendingProps,s===null?zu(i):Ae=s}function R0(i){var s=i,a=s.alternate;switch(s.tag){case 15:case 0:s=Hb(a,s,s.pendingProps,s.type,void 0,Oe);break;case 11:s=Hb(a,s,s.pendingProps,s.type.render,s.ref,Oe);break;case 5:zd(s);default:Wb(a,s),s=Ae=Ov(s,Vi),s=Zb(a,s,Vi)}i.memoizedProps=i.pendingProps,s===null?zu(i):Ae=s}function co(i,s,a,l){ki=ns=null,zd(s),Ws=null,va=0;var d=s.return;try{if(Ok(i,d,s,a,Oe)){at=1,Au(i,kn(a,i.current)),Ae=null;return}}catch(p){if(d!==null)throw Ae=d,p;at=1,Au(i,kn(a,i.current)),Ae=null;return}s.flags&32768?(ke||l===1?i=!0:oo||(Oe&536870912)!==0?i=!1:(mr=i=!0,(l===2||l===9||l===3||l===6)&&(l=yn.current,l!==null&&l.tag===13&&(l.flags|=16384))),k0(s,i)):zu(s)}function zu(i){var s=i;do{if((s.flags&32768)!==0){k0(s,mr);return}i=s.return;var a=kk(s.alternate,s,Vi);if(a!==null){Ae=a;return}if(s=s.sibling,s!==null){Ae=s;return}Ae=s=i}while(s!==null);at===0&&(at=5)}function k0(i,s){do{var a=Ck(i.alternate,i);if(a!==null){a.flags&=32767,Ae=a;return}if(a=i.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!s&&(i=i.sibling,i!==null)){Ae=i;return}Ae=i=a}while(i!==null);at=6,Ae=null}function C0(i,s,a,l,d,p,v,w,A){i.cancelPendingCommit=null;do Lu();while(kt!==0);if((Be&6)!==0)throw Error(r(327));if(s!==null){if(s===i.current)throw Error(r(177));if(p=s.lanes|s.childLanes,p|=cd,gR(i,a,p,v,w,A),i===He&&(Ae=He=null,Oe=0),lo=s,vr=i,Ui=a,vh=p,bh=d,b0=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,qk(Ul,function(){return j0(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=j.T,j.T=null,d=U.p,U.p=2,v=Be,Be|=4;try{Mk(i,s,a)}finally{Be=v,U.p=d,j.T=l}}kt=1,M0(),D0(),N0()}}function M0(){if(kt===1){kt=0;var i=vr,s=lo,a=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||a){a=j.T,j.T=null;var l=U.p;U.p=2;var d=Be;Be|=4;try{f0(s,i);var p=$h,v=gv(i.containerInfo),w=p.focusedElem,A=p.selectionRange;if(v!==w&&w&&w.ownerDocument&&yv(w.ownerDocument.documentElement,w)){if(A!==null&&sd(w)){var $=A.start,V=A.end;if(V===void 0&&(V=$),"selectionStart"in w)w.selectionStart=$,w.selectionEnd=Math.min(V,w.value.length);else{var P=w.ownerDocument||document,B=P&&P.defaultView||window;if(B.getSelection){var z=B.getSelection(),ie=w.textContent.length,ue=Math.min(A.start,ie),Pe=A.end===void 0?ue:Math.min(A.end,ie);!z.extend&&ue>Pe&&(v=Pe,Pe=ue,ue=v);var R=mv(w,ue),O=mv(w,Pe);if(R&&O&&(z.rangeCount!==1||z.anchorNode!==R.node||z.anchorOffset!==R.offset||z.focusNode!==O.node||z.focusOffset!==O.offset)){var D=P.createRange();D.setStart(R.node,R.offset),z.removeAllRanges(),ue>Pe?(z.addRange(D),z.extend(O.node,O.offset)):(D.setEnd(O.node,O.offset),z.addRange(D))}}}}for(P=[],z=w;z=z.parentNode;)z.nodeType===1&&P.push({element:z,left:z.scrollLeft,top:z.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<P.length;w++){var K=P[w];K.element.scrollLeft=K.left,K.element.scrollTop=K.top}}Xu=!!Nh,$h=Nh=null}finally{Be=d,U.p=l,j.T=a}}i.current=s,kt=2}}function D0(){if(kt===2){kt=0;var i=vr,s=lo,a=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||a){a=j.T,j.T=null;var l=U.p;U.p=2;var d=Be;Be|=4;try{o0(i,s.alternate,s)}finally{Be=d,U.p=l,j.T=a}}kt=3}}function N0(){if(kt===4||kt===3){kt=0,In();var i=vr,s=lo,a=Ui,l=b0;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?kt=5:(kt=0,lo=vr=null,$0(i,i.pendingLanes));var d=i.pendingLanes;if(d===0&&(gr=null),Uf(a),s=s.stateNode,dn&&typeof dn.onCommitFiberRoot=="function")try{dn.onCommitFiberRoot(ea,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=j.T,d=U.p,U.p=2,j.T=null;try{for(var p=i.onRecoverableError,v=0;v<l.length;v++){var w=l[v];p(w.value,{componentStack:w.stack})}}finally{j.T=s,U.p=d}}(Ui&3)!==0&&Lu(),ai(i),d=i.pendingLanes,(a&261930)!==0&&(d&42)!==0?i===Sh?ja++:(ja=0,Sh=i):ja=0,Ba(0)}}function $0(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,ya(s)))}function Lu(){return M0(),D0(),N0(),j0()}function j0(){if(kt!==5)return!1;var i=vr,s=vh;vh=0;var a=Uf(Ui),l=j.T,d=U.p;try{U.p=32>a?32:a,j.T=null,a=bh,bh=null;var p=vr,v=Ui;if(kt=0,lo=vr=null,Ui=0,(Be&6)!==0)throw Error(r(331));var w=Be;if(Be|=4,y0(p.current),h0(p,p.current,v,a),Be=w,Ba(0,!1),dn&&typeof dn.onPostCommitFiberRoot=="function")try{dn.onPostCommitFiberRoot(ea,p)}catch{}return!0}finally{U.p=d,j.T=l,$0(i,s)}}function B0(i,s,a){s=kn(a,s),s=Qd(i.stateNode,s,2),i=fr(i,s,2),i!==null&&(na(i,2),ai(i))}function Ue(i,s,a){if(i.tag===3)B0(i,i,a);else for(;s!==null;){if(s.tag===3){B0(s,i,a);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(gr===null||!gr.has(l))){i=kn(a,i),a=zb(2),l=fr(s,a,2),l!==null&&(Lb(a,l,s,i),na(l,2),ai(l));break}}s=s.return}}function Th(i,s,a){var l=i.pingCache;if(l===null){l=i.pingCache=new $k;var d=new Set;l.set(s,d)}else d=l.get(s),d===void 0&&(d=new Set,l.set(s,d));d.has(a)||(mh=!0,d.add(a),i=Vk.bind(null,i,s,a),s.then(i,i))}function Vk(i,s,a){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&a,i.warmLanes&=~a,He===i&&(Oe&a)===a&&(at===4||at===3&&(Oe&62914560)===Oe&&300>st()-Du?(Be&2)===0&&uo(i,0):yh|=a,ao===Oe&&(ao=0)),ai(i)}function z0(i,s){s===0&&(s=Mg()),i=Wr(i,s),i!==null&&(na(i,s),ai(i))}function Uk(i){var s=i.memoizedState,a=0;s!==null&&(a=s.retryLane),z0(i,a)}function Kk(i,s){var a=0;switch(i.tag){case 31:case 13:var l=i.stateNode,d=i.memoizedState;d!==null&&(a=d.retryLane);break;case 19:l=i.stateNode;break;case 22:l=i.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(s),z0(i,a)}function qk(i,s){return Vt(i,s)}var Vu=null,fo=null,Ah=!1,Uu=!1,Eh=!1,Sr=0;function ai(i){i!==fo&&i.next===null&&(fo===null?Vu=fo=i:fo=fo.next=i),Uu=!0,Ah||(Ah=!0,Ik())}function Ba(i,s){if(!Eh&&Uu){Eh=!0;do for(var a=!1,l=Vu;l!==null;){if(i!==0){var d=l.pendingLanes;if(d===0)var p=0;else{var v=l.suspendedLanes,w=l.pingedLanes;p=(1<<31-hn(42|i)+1)-1,p&=d&~(v&~w),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(a=!0,K0(l,p))}else p=Oe,p=Il(l,l===He?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(p&3)===0||ta(l,p)||(a=!0,K0(l,p));l=l.next}while(a);Eh=!1}}function Pk(){L0()}function L0(){Uu=Ah=!1;var i=0;Sr!==0&&eC()&&(i=Sr);for(var s=st(),a=null,l=Vu;l!==null;){var d=l.next,p=V0(l,s);p===0?(l.next=null,a===null?Vu=d:a.next=d,d===null&&(fo=a)):(a=l,(i!==0||(p&3)!==0)&&(Uu=!0)),l=d}kt!==0&&kt!==5||Ba(i),Sr!==0&&(Sr=0)}function V0(i,s){for(var a=i.suspendedLanes,l=i.pingedLanes,d=i.expirationTimes,p=i.pendingLanes&-62914561;0<p;){var v=31-hn(p),w=1<<v,A=d[v];A===-1?((w&a)===0||(w&l)!==0)&&(d[v]=yR(w,s)):A<=s&&(i.expiredLanes|=w),p&=~w}if(s=He,a=Oe,a=Il(i,i===s?a:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,a===0||i===s&&(Ve===2||Ve===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&Pn(l),i.callbackNode=null,i.callbackPriority=0;if((a&3)===0||ta(i,a)){if(s=a&-a,s===i.callbackPriority)return s;switch(l!==null&&Pn(l),Uf(a)){case 2:case 8:a=kg;break;case 32:a=Ul;break;case 268435456:a=Cg;break;default:a=Ul}return l=U0.bind(null,i),a=Vt(a,l),i.callbackPriority=s,i.callbackNode=a,s}return l!==null&&l!==null&&Pn(l),i.callbackPriority=2,i.callbackNode=null,2}function U0(i,s){if(kt!==0&&kt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var a=i.callbackNode;if(Lu()&&i.callbackNode!==a)return null;var l=Oe;return l=Il(i,i===He?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(w0(i,l,s),V0(i,st()),i.callbackNode!=null&&i.callbackNode===a?U0.bind(null,i):null)}function K0(i,s){if(Lu())return null;w0(i,s,!0)}function Ik(){nC(function(){(Be&6)!==0?Vt(Rg,Pk):L0()})}function Oh(){if(Sr===0){var i=Xs;i===0&&(i=Kl,Kl<<=1,(Kl&261888)===0&&(Kl=256)),Sr=i}return Sr}function q0(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Yl(""+i)}function P0(i,s){var a=s.ownerDocument.createElement("input");return a.name=s.name,a.value=s.value,i.id&&a.setAttribute("form",i.id),s.parentNode.insertBefore(a,s),i=new FormData(i),a.parentNode.removeChild(a),i}function Hk(i,s,a,l,d){if(s==="submit"&&a&&a.stateNode===d){var p=q0((d[tn]||null).action),v=l.submitter;v&&(s=(s=v[tn]||null)?q0(s.formAction):v.getAttribute("formAction"),s!==null&&(p=s,v=null));var w=new Ql("action","action",null,l,d);i.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Sr!==0){var A=v?P0(d,v):new FormData(d);Fd(a,{pending:!0,data:A,method:d.method,action:p},null,A)}}else typeof p=="function"&&(w.preventDefault(),A=v?P0(d,v):new FormData(d),Fd(a,{pending:!0,data:A,method:d.method,action:p},p,A))},currentTarget:d}]})}}for(var _h=0;_h<ud.length;_h++){var Rh=ud[_h],Fk=Rh.toLowerCase(),Gk=Rh[0].toUpperCase()+Rh.slice(1);Hn(Fk,"on"+Gk)}Hn(Sv,"onAnimationEnd"),Hn(wv,"onAnimationIteration"),Hn(xv,"onAnimationStart"),Hn("dblclick","onDoubleClick"),Hn("focusin","onFocus"),Hn("focusout","onBlur"),Hn(uk,"onTransitionRun"),Hn(ck,"onTransitionStart"),Hn(fk,"onTransitionCancel"),Hn(Tv,"onTransitionEnd"),Bs("onMouseEnter",["mouseout","mouseover"]),Bs("onMouseLeave",["mouseout","mouseover"]),Bs("onPointerEnter",["pointerout","pointerover"]),Bs("onPointerLeave",["pointerout","pointerover"]),Jr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Jr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Jr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Jr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var za="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Yk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(za));function I0(i,s){s=(s&4)!==0;for(var a=0;a<i.length;a++){var l=i[a],d=l.event;l=l.listeners;e:{var p=void 0;if(s)for(var v=l.length-1;0<=v;v--){var w=l[v],A=w.instance,$=w.currentTarget;if(w=w.listener,A!==p&&d.isPropagationStopped())break e;p=w,d.currentTarget=$;try{p(d)}catch(V){tu(V)}d.currentTarget=null,p=A}else for(v=0;v<l.length;v++){if(w=l[v],A=w.instance,$=w.currentTarget,w=w.listener,A!==p&&d.isPropagationStopped())break e;p=w,d.currentTarget=$;try{p(d)}catch(V){tu(V)}d.currentTarget=null,p=A}}}}function Ee(i,s){var a=s[Kf];a===void 0&&(a=s[Kf]=new Set);var l=i+"__bubble";a.has(l)||(H0(s,i,2,!1),a.add(l))}function kh(i,s,a){var l=0;s&&(l|=4),H0(a,i,l,s)}var Ku="_reactListening"+Math.random().toString(36).slice(2);function Ch(i){if(!i[Ku]){i[Ku]=!0,Lg.forEach(function(a){a!=="selectionchange"&&(Yk.has(a)||kh(a,!1,i),kh(a,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Ku]||(s[Ku]=!0,kh("selectionchange",!1,s))}}function H0(i,s,a,l){switch(SS(s)){case 2:var d=xC;break;case 8:d=TC;break;default:d=Hh}a=d.bind(null,s,a,i),d=void 0,!Xf||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(d=!0),l?d!==void 0?i.addEventListener(s,a,{capture:!0,passive:d}):i.addEventListener(s,a,!0):d!==void 0?i.addEventListener(s,a,{passive:d}):i.addEventListener(s,a,!1)}function Mh(i,s,a,l,d){var p=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var v=l.tag;if(v===3||v===4){var w=l.stateNode.containerInfo;if(w===d)break;if(v===4)for(v=l.return;v!==null;){var A=v.tag;if((A===3||A===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;w!==null;){if(v=Ns(w),v===null)return;if(A=v.tag,A===5||A===6||A===26||A===27){l=p=v;continue e}w=w.parentNode}}l=l.return}Xg(function(){var $=p,V=Yf(a),P=[];e:{var B=Av.get(i);if(B!==void 0){var z=Ql,ie=i;switch(i){case"keypress":if(Xl(a)===0)break e;case"keydown":case"keyup":z=KR;break;case"focusin":ie="focus",z=ed;break;case"focusout":ie="blur",z=ed;break;case"beforeblur":case"afterblur":z=ed;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":z=Wg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":z=kR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":z=IR;break;case Sv:case wv:case xv:z=DR;break;case Tv:z=FR;break;case"scroll":case"scrollend":z=_R;break;case"wheel":z=YR;break;case"copy":case"cut":case"paste":z=$R;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":z=tv;break;case"toggle":case"beforetoggle":z=XR}var ue=(s&4)!==0,Pe=!ue&&(i==="scroll"||i==="scrollend"),R=ue?B!==null?B+"Capture":null:B;ue=[];for(var O=$,D;O!==null;){var K=O;if(D=K.stateNode,K=K.tag,K!==5&&K!==26&&K!==27||D===null||R===null||(K=sa(O,R),K!=null&&ue.push(La(O,K,D))),Pe)break;O=O.return}0<ue.length&&(B=new z(B,ie,null,a,V),P.push({event:B,listeners:ue}))}}if((s&7)===0){e:{if(B=i==="mouseover"||i==="pointerover",z=i==="mouseout"||i==="pointerout",B&&a!==Gf&&(ie=a.relatedTarget||a.fromElement)&&(Ns(ie)||ie[Ds]))break e;if((z||B)&&(B=V.window===V?V:(B=V.ownerDocument)?B.defaultView||B.parentWindow:window,z?(ie=a.relatedTarget||a.toElement,z=$,ie=ie?Ns(ie):null,ie!==null&&(Pe=u(ie),ue=ie.tag,ie!==Pe||ue!==5&&ue!==27&&ue!==6)&&(ie=null)):(z=null,ie=$),z!==ie)){if(ue=Wg,K="onMouseLeave",R="onMouseEnter",O="mouse",(i==="pointerout"||i==="pointerover")&&(ue=tv,K="onPointerLeave",R="onPointerEnter",O="pointer"),Pe=z==null?B:ra(z),D=ie==null?B:ra(ie),B=new ue(K,O+"leave",z,a,V),B.target=Pe,B.relatedTarget=D,K=null,Ns(V)===$&&(ue=new ue(R,O+"enter",ie,a,V),ue.target=D,ue.relatedTarget=Pe,K=ue),Pe=K,z&&ie)t:{for(ue=Jk,R=z,O=ie,D=0,K=R;K;K=ue(K))D++;K=0;for(var le=O;le;le=ue(le))K++;for(;0<D-K;)R=ue(R),D--;for(;0<K-D;)O=ue(O),K--;for(;D--;){if(R===O||O!==null&&R===O.alternate){ue=R;break t}R=ue(R),O=ue(O)}ue=null}else ue=null;z!==null&&F0(P,B,z,ue,!1),ie!==null&&Pe!==null&&F0(P,Pe,ie,ue,!0)}}e:{if(B=$?ra($):window,z=B.nodeName&&B.nodeName.toLowerCase(),z==="select"||z==="input"&&B.type==="file")var Ne=uv;else if(av(B))if(cv)Ne=ok;else{Ne=rk;var se=ik}else z=B.nodeName,!z||z.toLowerCase()!=="input"||B.type!=="checkbox"&&B.type!=="radio"?$&&Ff($.elementType)&&(Ne=uv):Ne=sk;if(Ne&&(Ne=Ne(i,$))){lv(P,Ne,a,V);break e}se&&se(i,B,$),i==="focusout"&&$&&B.type==="number"&&$.memoizedProps.value!=null&&Hf(B,"number",B.value)}switch(se=$?ra($):window,i){case"focusin":(av(se)||se.contentEditable==="true")&&(qs=se,od=$,ha=null);break;case"focusout":ha=od=qs=null;break;case"mousedown":ad=!0;break;case"contextmenu":case"mouseup":case"dragend":ad=!1,vv(P,a,V);break;case"selectionchange":if(lk)break;case"keydown":case"keyup":vv(P,a,V)}var Se;if(nd)e:{switch(i){case"compositionstart":var _e="onCompositionStart";break e;case"compositionend":_e="onCompositionEnd";break e;case"compositionupdate":_e="onCompositionUpdate";break e}_e=void 0}else Ks?sv(i,a)&&(_e="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(_e="onCompositionStart");_e&&(nv&&a.locale!=="ko"&&(Ks||_e!=="onCompositionStart"?_e==="onCompositionEnd"&&Ks&&(Se=Zg()):(rr=V,Zf="value"in rr?rr.value:rr.textContent,Ks=!0)),se=qu($,_e),0<se.length&&(_e=new ev(_e,i,null,a,V),P.push({event:_e,listeners:se}),Se?_e.data=Se:(Se=ov(a),Se!==null&&(_e.data=Se)))),(Se=QR?WR(i,a):ek(i,a))&&(_e=qu($,"onBeforeInput"),0<_e.length&&(se=new ev("onBeforeInput","beforeinput",null,a,V),P.push({event:se,listeners:_e}),se.data=Se)),Hk(P,i,$,a,V)}I0(P,s)})}function La(i,s,a){return{instance:i,listener:s,currentTarget:a}}function qu(i,s){for(var a=s+"Capture",l=[];i!==null;){var d=i,p=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||p===null||(d=sa(i,a),d!=null&&l.unshift(La(i,d,p)),d=sa(i,s),d!=null&&l.push(La(i,d,p))),i.tag===3)return l;i=i.return}return[]}function Jk(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function F0(i,s,a,l,d){for(var p=s._reactName,v=[];a!==null&&a!==l;){var w=a,A=w.alternate,$=w.stateNode;if(w=w.tag,A!==null&&A===l)break;w!==5&&w!==26&&w!==27||$===null||(A=$,d?($=sa(a,p),$!=null&&v.unshift(La(a,$,A))):d||($=sa(a,p),$!=null&&v.push(La(a,$,A)))),a=a.return}v.length!==0&&i.push({event:s,listeners:v})}var Xk=/\r\n?/g,Zk=/\u0000|\uFFFD/g;function G0(i){return(typeof i=="string"?i:""+i).replace(Xk,`
21
- `).replace(Zk,"")}function Y0(i,s){return s=G0(s),G0(i)===s}function qe(i,s,a,l,d,p){switch(a){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||Ls(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&Ls(i,""+l);break;case"className":Fl(i,"class",l);break;case"tabIndex":Fl(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Fl(i,a,l);break;case"style":Yg(i,l,p);break;case"data":if(s!=="object"){Fl(i,"data",l);break}case"src":case"href":if(l===""&&(s!=="a"||a!=="href")){i.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(a);break}l=Yl(""+l),i.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){i.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(a==="formAction"?(s!=="input"&&qe(i,s,"name",d.name,d,null),qe(i,s,"formEncType",d.formEncType,d,null),qe(i,s,"formMethod",d.formMethod,d,null),qe(i,s,"formTarget",d.formTarget,d,null)):(qe(i,s,"encType",d.encType,d,null),qe(i,s,"method",d.method,d,null),qe(i,s,"target",d.target,d,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(a);break}l=Yl(""+l),i.setAttribute(a,l);break;case"onClick":l!=null&&(i.onclick=Ei);break;case"onScroll":l!=null&&Ee("scroll",i);break;case"onScrollEnd":l!=null&&Ee("scrollend",i);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(d.children!=null)throw Error(r(60));i.innerHTML=a}}break;case"multiple":i.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":i.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){i.removeAttribute("xlink:href");break}a=Yl(""+l),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(a,""+l):i.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(a,""):i.removeAttribute(a);break;case"capture":case"download":l===!0?i.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(a,l):i.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?i.setAttribute(a,l):i.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?i.removeAttribute(a):i.setAttribute(a,l);break;case"popover":Ee("beforetoggle",i),Ee("toggle",i),Hl(i,"popover",l);break;case"xlinkActuate":Ai(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ai(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ai(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ai(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ai(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ai(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ai(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ai(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ai(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Hl(i,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=ER.get(a)||a,Hl(i,a,l))}}function Dh(i,s,a,l,d,p){switch(a){case"style":Yg(i,l,p);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(d.children!=null)throw Error(r(60));i.innerHTML=a}}break;case"children":typeof l=="string"?Ls(i,l):(typeof l=="number"||typeof l=="bigint")&&Ls(i,""+l);break;case"onScroll":l!=null&&Ee("scroll",i);break;case"onScrollEnd":l!=null&&Ee("scrollend",i);break;case"onClick":l!=null&&(i.onclick=Ei);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Vg.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(d=a.endsWith("Capture"),s=a.slice(2,d?a.length-7:void 0),p=i[tn]||null,p=p!=null?p[a]:null,typeof p=="function"&&i.removeEventListener(s,p,d),typeof l=="function")){typeof p!="function"&&p!==null&&(a in i?i[a]=null:i.hasAttribute(a)&&i.removeAttribute(a)),i.addEventListener(s,l,d);break e}a in i?i[a]=l:l===!0?i.setAttribute(a,""):Hl(i,a,l)}}}function It(i,s,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",i),Ee("load",i);var l=!1,d=!1,p;for(p in a)if(a.hasOwnProperty(p)){var v=a[p];if(v!=null)switch(p){case"src":l=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:qe(i,s,p,v,a,null)}}d&&qe(i,s,"srcSet",a.srcSet,a,null),l&&qe(i,s,"src",a.src,a,null);return;case"input":Ee("invalid",i);var w=p=v=d=null,A=null,$=null;for(l in a)if(a.hasOwnProperty(l)){var V=a[l];if(V!=null)switch(l){case"name":d=V;break;case"type":v=V;break;case"checked":A=V;break;case"defaultChecked":$=V;break;case"value":p=V;break;case"defaultValue":w=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(r(137,s));break;default:qe(i,s,l,V,a,null)}}Ig(i,p,w,A,$,v,d,!1);return;case"select":Ee("invalid",i),l=v=p=null;for(d in a)if(a.hasOwnProperty(d)&&(w=a[d],w!=null))switch(d){case"value":p=w;break;case"defaultValue":v=w;break;case"multiple":l=w;default:qe(i,s,d,w,a,null)}s=p,a=v,i.multiple=!!l,s!=null?zs(i,!!l,s,!1):a!=null&&zs(i,!!l,a,!0);return;case"textarea":Ee("invalid",i),p=d=l=null;for(v in a)if(a.hasOwnProperty(v)&&(w=a[v],w!=null))switch(v){case"value":l=w;break;case"defaultValue":d=w;break;case"children":p=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:qe(i,s,v,w,a,null)}Fg(i,l,d,p);return;case"option":for(A in a)if(a.hasOwnProperty(A)&&(l=a[A],l!=null))switch(A){case"selected":i.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:qe(i,s,A,l,a,null)}return;case"dialog":Ee("beforetoggle",i),Ee("toggle",i),Ee("cancel",i),Ee("close",i);break;case"iframe":case"object":Ee("load",i);break;case"video":case"audio":for(l=0;l<za.length;l++)Ee(za[l],i);break;case"image":Ee("error",i),Ee("load",i);break;case"details":Ee("toggle",i);break;case"embed":case"source":case"link":Ee("error",i),Ee("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for($ in a)if(a.hasOwnProperty($)&&(l=a[$],l!=null))switch($){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:qe(i,s,$,l,a,null)}return;default:if(Ff(s)){for(V in a)a.hasOwnProperty(V)&&(l=a[V],l!==void 0&&Dh(i,s,V,l,a,void 0));return}}for(w in a)a.hasOwnProperty(w)&&(l=a[w],l!=null&&qe(i,s,w,l,a,null))}function Qk(i,s,a,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,p=null,v=null,w=null,A=null,$=null,V=null;for(z in a){var P=a[z];if(a.hasOwnProperty(z)&&P!=null)switch(z){case"checked":break;case"value":break;case"defaultValue":A=P;default:l.hasOwnProperty(z)||qe(i,s,z,null,l,P)}}for(var B in l){var z=l[B];if(P=a[B],l.hasOwnProperty(B)&&(z!=null||P!=null))switch(B){case"type":p=z;break;case"name":d=z;break;case"checked":$=z;break;case"defaultChecked":V=z;break;case"value":v=z;break;case"defaultValue":w=z;break;case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(137,s));break;default:z!==P&&qe(i,s,B,z,l,P)}}If(i,v,w,A,$,V,p,d);return;case"select":z=v=w=B=null;for(p in a)if(A=a[p],a.hasOwnProperty(p)&&A!=null)switch(p){case"value":break;case"multiple":z=A;default:l.hasOwnProperty(p)||qe(i,s,p,null,l,A)}for(d in l)if(p=l[d],A=a[d],l.hasOwnProperty(d)&&(p!=null||A!=null))switch(d){case"value":B=p;break;case"defaultValue":w=p;break;case"multiple":v=p;default:p!==A&&qe(i,s,d,p,l,A)}s=w,a=v,l=z,B!=null?zs(i,!!a,B,!1):!!l!=!!a&&(s!=null?zs(i,!!a,s,!0):zs(i,!!a,a?[]:"",!1));return;case"textarea":z=B=null;for(w in a)if(d=a[w],a.hasOwnProperty(w)&&d!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:qe(i,s,w,null,l,d)}for(v in l)if(d=l[v],p=a[v],l.hasOwnProperty(v)&&(d!=null||p!=null))switch(v){case"value":B=d;break;case"defaultValue":z=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==p&&qe(i,s,v,d,l,p)}Hg(i,B,z);return;case"option":for(var ie in a)if(B=a[ie],a.hasOwnProperty(ie)&&B!=null&&!l.hasOwnProperty(ie))switch(ie){case"selected":i.selected=!1;break;default:qe(i,s,ie,null,l,B)}for(A in l)if(B=l[A],z=a[A],l.hasOwnProperty(A)&&B!==z&&(B!=null||z!=null))switch(A){case"selected":i.selected=B&&typeof B!="function"&&typeof B!="symbol";break;default:qe(i,s,A,B,l,z)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ue in a)B=a[ue],a.hasOwnProperty(ue)&&B!=null&&!l.hasOwnProperty(ue)&&qe(i,s,ue,null,l,B);for($ in l)if(B=l[$],z=a[$],l.hasOwnProperty($)&&B!==z&&(B!=null||z!=null))switch($){case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(r(137,s));break;default:qe(i,s,$,B,l,z)}return;default:if(Ff(s)){for(var Pe in a)B=a[Pe],a.hasOwnProperty(Pe)&&B!==void 0&&!l.hasOwnProperty(Pe)&&Dh(i,s,Pe,void 0,l,B);for(V in l)B=l[V],z=a[V],!l.hasOwnProperty(V)||B===z||B===void 0&&z===void 0||Dh(i,s,V,B,l,z);return}}for(var R in a)B=a[R],a.hasOwnProperty(R)&&B!=null&&!l.hasOwnProperty(R)&&qe(i,s,R,null,l,B);for(P in l)B=l[P],z=a[P],!l.hasOwnProperty(P)||B===z||B==null&&z==null||qe(i,s,P,B,l,z)}function J0(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Wk(){if(typeof performance.getEntriesByType=="function"){for(var i=0,s=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var d=a[l],p=d.transferSize,v=d.initiatorType,w=d.duration;if(p&&w&&J0(v)){for(v=0,w=d.responseEnd,l+=1;l<a.length;l++){var A=a[l],$=A.startTime;if($>w)break;var V=A.transferSize,P=A.initiatorType;V&&J0(P)&&(A=A.responseEnd,v+=V*(A<w?1:(w-$)/(A-$)))}if(--l,s+=8*(p+v)/(d.duration/1e3),i++,10<i)break}}if(0<i)return s/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Nh=null,$h=null;function Pu(i){return i.nodeType===9?i:i.ownerDocument}function X0(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Z0(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function jh(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Bh=null;function eC(){var i=window.event;return i&&i.type==="popstate"?i===Bh?!1:(Bh=i,!0):(Bh=null,!1)}var Q0=typeof setTimeout=="function"?setTimeout:void 0,tC=typeof clearTimeout=="function"?clearTimeout:void 0,W0=typeof Promise=="function"?Promise:void 0,nC=typeof queueMicrotask=="function"?queueMicrotask:typeof W0<"u"?function(i){return W0.resolve(null).then(i).catch(iC)}:Q0;function iC(i){setTimeout(function(){throw i})}function wr(i){return i==="head"}function eS(i,s){var a=s,l=0;do{var d=a.nextSibling;if(i.removeChild(a),d&&d.nodeType===8)if(a=d.data,a==="/$"||a==="/&"){if(l===0){i.removeChild(d),yo(s);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Va(i.ownerDocument.documentElement);else if(a==="head"){a=i.ownerDocument.head,Va(a);for(var p=a.firstChild;p;){var v=p.nextSibling,w=p.nodeName;p[ia]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&p.rel.toLowerCase()==="stylesheet"||a.removeChild(p),p=v}}else a==="body"&&Va(i.ownerDocument.body);a=d}while(a);yo(s)}function tS(i,s){var a=i;i=0;do{var l=a.nextSibling;if(a.nodeType===1?s?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(s?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(i===0)break;i--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||i++;a=l}while(a)}function zh(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var a=s;switch(s=s.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":zh(a),qf(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}i.removeChild(a)}}function rC(i,s,a,l){for(;i.nodeType===1;){var d=a;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!l&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(l){if(!i[ia])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(p=i.getAttribute("rel"),p==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(p!==d.rel||i.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||i.getAttribute("title")!==(d.title==null?null:d.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(p=i.getAttribute("src"),(p!==(d.src==null?null:d.src)||i.getAttribute("type")!==(d.type==null?null:d.type)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&p&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var p=d.name==null?null:""+d.name;if(d.type==="hidden"&&i.getAttribute("name")===p)return i}else return i;if(i=$n(i.nextSibling),i===null)break}return null}function sC(i,s,a){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=$n(i.nextSibling),i===null))return null;return i}function nS(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=$n(i.nextSibling),i===null))return null;return i}function Lh(i){return i.data==="$?"||i.data==="$~"}function Vh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function oC(i,s){var a=i.ownerDocument;if(i.data==="$~")i._reactRetry=s;else if(i.data!=="$?"||a.readyState!=="loading")s();else{var l=function(){s(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),i._reactRetry=l}}function $n(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return i}var Uh=null;function iS(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var a=i.data;if(a==="/$"||a==="/&"){if(s===0)return $n(i.nextSibling);s--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||s++}i=i.nextSibling}return null}function rS(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(s===0)return i;s--}else a!=="/$"&&a!=="/&"||s++}i=i.previousSibling}return null}function sS(i,s,a){switch(s=Pu(a),i){case"html":if(i=s.documentElement,!i)throw Error(r(452));return i;case"head":if(i=s.head,!i)throw Error(r(453));return i;case"body":if(i=s.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function Va(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);qf(i)}var jn=new Map,oS=new Set;function Iu(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Ki=U.d;U.d={f:aC,r:lC,D:uC,C:cC,L:fC,m:dC,X:pC,S:hC,M:mC};function aC(){var i=Ki.f(),s=ju();return i||s}function lC(i){var s=$s(i);s!==null&&s.tag===5&&s.type==="form"?Tb(s):Ki.r(i)}var ho=typeof document>"u"?null:document;function aS(i,s,a){var l=ho;if(l&&typeof s=="string"&&s){var d=_n(s);d='link[rel="'+i+'"][href="'+d+'"]',typeof a=="string"&&(d+='[crossorigin="'+a+'"]'),oS.has(d)||(oS.add(d),i={rel:i,crossOrigin:a,href:s},l.querySelector(d)===null&&(s=l.createElement("link"),It(s,"link",i),Nt(s),l.head.appendChild(s)))}}function uC(i){Ki.D(i),aS("dns-prefetch",i,null)}function cC(i,s){Ki.C(i,s),aS("preconnect",i,s)}function fC(i,s,a){Ki.L(i,s,a);var l=ho;if(l&&i&&s){var d='link[rel="preload"][as="'+_n(s)+'"]';s==="image"&&a&&a.imageSrcSet?(d+='[imagesrcset="'+_n(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(d+='[imagesizes="'+_n(a.imageSizes)+'"]')):d+='[href="'+_n(i)+'"]';var p=d;switch(s){case"style":p=po(i);break;case"script":p=mo(i)}jn.has(p)||(i=g({rel:"preload",href:s==="image"&&a&&a.imageSrcSet?void 0:i,as:s},a),jn.set(p,i),l.querySelector(d)!==null||s==="style"&&l.querySelector(Ua(p))||s==="script"&&l.querySelector(Ka(p))||(s=l.createElement("link"),It(s,"link",i),Nt(s),l.head.appendChild(s)))}}function dC(i,s){Ki.m(i,s);var a=ho;if(a&&i){var l=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+_n(l)+'"][href="'+_n(i)+'"]',p=d;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=mo(i)}if(!jn.has(p)&&(i=g({rel:"modulepreload",href:i},s),jn.set(p,i),a.querySelector(d)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ka(p)))return}l=a.createElement("link"),It(l,"link",i),Nt(l),a.head.appendChild(l)}}}function hC(i,s,a){Ki.S(i,s,a);var l=ho;if(l&&i){var d=js(l).hoistableStyles,p=po(i);s=s||"default";var v=d.get(p);if(!v){var w={loading:0,preload:null};if(v=l.querySelector(Ua(p)))w.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":s},a),(a=jn.get(p))&&Kh(i,a);var A=v=l.createElement("link");Nt(A),It(A,"link",i),A._p=new Promise(function($,V){A.onload=$,A.onerror=V}),A.addEventListener("load",function(){w.loading|=1}),A.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Hu(v,s,l)}v={type:"stylesheet",instance:v,count:1,state:w},d.set(p,v)}}}function pC(i,s){Ki.X(i,s);var a=ho;if(a&&i){var l=js(a).hoistableScripts,d=mo(i),p=l.get(d);p||(p=a.querySelector(Ka(d)),p||(i=g({src:i,async:!0},s),(s=jn.get(d))&&qh(i,s),p=a.createElement("script"),Nt(p),It(p,"link",i),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(d,p))}}function mC(i,s){Ki.M(i,s);var a=ho;if(a&&i){var l=js(a).hoistableScripts,d=mo(i),p=l.get(d);p||(p=a.querySelector(Ka(d)),p||(i=g({src:i,async:!0,type:"module"},s),(s=jn.get(d))&&qh(i,s),p=a.createElement("script"),Nt(p),It(p,"link",i),a.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(d,p))}}function lS(i,s,a,l){var d=(d=ce.current)?Iu(d):null;if(!d)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(s=po(a.href),a=js(d).hoistableStyles,l=a.get(s),l||(l={type:"style",instance:null,count:0,state:null},a.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){i=po(a.href);var p=js(d).hoistableStyles,v=p.get(i);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(i,v),(p=d.querySelector(Ua(i)))&&!p._p&&(v.instance=p,v.state.loading=5),jn.has(i)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},jn.set(i,a),p||yC(d,i,a,v.state))),s&&l===null)throw Error(r(528,""));return v}if(s&&l!==null)throw Error(r(529,""));return null;case"script":return s=a.async,a=a.src,typeof a=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=mo(a),a=js(d).hoistableScripts,l=a.get(s),l||(l={type:"script",instance:null,count:0,state:null},a.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function po(i){return'href="'+_n(i)+'"'}function Ua(i){return'link[rel="stylesheet"]['+i+"]"}function uS(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function yC(i,s,a,l){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?l.loading=1:(s=i.createElement("link"),l.preload=s,s.addEventListener("load",function(){return l.loading|=1}),s.addEventListener("error",function(){return l.loading|=2}),It(s,"link",a),Nt(s),i.head.appendChild(s))}function mo(i){return'[src="'+_n(i)+'"]'}function Ka(i){return"script[async]"+i}function cS(i,s,a){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+_n(a.href)+'"]');if(l)return s.instance=l,Nt(l),l;var d=g({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),Nt(l),It(l,"style",d),Hu(l,a.precedence,i),s.instance=l;case"stylesheet":d=po(a.href);var p=i.querySelector(Ua(d));if(p)return s.state.loading|=4,s.instance=p,Nt(p),p;l=uS(a),(d=jn.get(d))&&Kh(l,d),p=(i.ownerDocument||i).createElement("link"),Nt(p);var v=p;return v._p=new Promise(function(w,A){v.onload=w,v.onerror=A}),It(p,"link",l),s.state.loading|=4,Hu(p,a.precedence,i),s.instance=p;case"script":return p=mo(a.src),(d=i.querySelector(Ka(p)))?(s.instance=d,Nt(d),d):(l=a,(d=jn.get(p))&&(l=g({},a),qh(l,d)),i=i.ownerDocument||i,d=i.createElement("script"),Nt(d),It(d,"link",l),i.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(l=s.instance,s.state.loading|=4,Hu(l,a.precedence,i));return s.instance}function Hu(i,s,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=l.length?l[l.length-1]:null,p=d,v=0;v<l.length;v++){var w=l[v];if(w.dataset.precedence===s)p=w;else if(p!==d)break}p?p.parentNode.insertBefore(i,p.nextSibling):(s=a.nodeType===9?a.head:a,s.insertBefore(i,s.firstChild))}function Kh(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function qh(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var Fu=null;function fS(i,s,a){if(Fu===null){var l=new Map,d=Fu=new Map;d.set(a,l)}else d=Fu,l=d.get(a),l||(l=new Map,d.set(a,l));if(l.has(i))return l;for(l.set(i,null),a=a.getElementsByTagName(i),d=0;d<a.length;d++){var p=a[d];if(!(p[ia]||p[Ut]||i==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var v=p.getAttribute(s)||"";v=i+v;var w=l.get(v);w?w.push(p):l.set(v,[p])}}return l}function dS(i,s,a){i=i.ownerDocument||i,i.head.insertBefore(a,s==="title"?i.querySelector("head > title"):null)}function gC(i,s,a){if(a===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function hS(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function vC(i,s,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var d=po(l.href),p=s.querySelector(Ua(d));if(p){s=p._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Gu.bind(i),s.then(i,i)),a.state.loading|=4,a.instance=p,Nt(p);return}p=s.ownerDocument||s,l=uS(l),(d=jn.get(d))&&Kh(l,d),p=p.createElement("link"),Nt(p);var v=p;v._p=new Promise(function(w,A){v.onload=w,v.onerror=A}),It(p,"link",l),a.instance=p}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(a,s),(s=a.state.preload)&&(a.state.loading&3)===0&&(i.count++,a=Gu.bind(i),s.addEventListener("load",a),s.addEventListener("error",a))}}var Ph=0;function bC(i,s){return i.stylesheets&&i.count===0&&Ju(i,i.stylesheets),0<i.count||0<i.imgCount?function(a){var l=setTimeout(function(){if(i.stylesheets&&Ju(i,i.stylesheets),i.unsuspend){var p=i.unsuspend;i.unsuspend=null,p()}},6e4+s);0<i.imgBytes&&Ph===0&&(Ph=62500*Wk());var d=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Ju(i,i.stylesheets),i.unsuspend)){var p=i.unsuspend;i.unsuspend=null,p()}},(i.imgBytes>Ph?50:800)+s);return i.unsuspend=a,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(d)}}:null}function Gu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ju(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Yu=null;function Ju(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Yu=new Map,s.forEach(SC,i),Yu=null,Gu.call(i))}function SC(i,s){if(!(s.state.loading&4)){var a=Yu.get(i);if(a)var l=a.get(null);else{a=new Map,Yu.set(i,a);for(var d=i.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<d.length;p++){var v=d[p];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(a.set(v.dataset.precedence,v),l=v)}l&&a.set(null,l)}d=s.instance,v=d.getAttribute("data-precedence"),p=a.get(v)||l,p===l&&a.set(null,d),a.set(v,d),this.count++,l=Gu.bind(this),d.addEventListener("load",l),d.addEventListener("error",l),p?p.parentNode.insertBefore(d,p.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(d,i.firstChild)),s.state.loading|=4}}var qa={$$typeof:M,Provider:null,Consumer:null,_currentValue:L,_currentValue2:L,_threadCount:0};function wC(i,s,a,l,d,p,v,w,A){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Lf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lf(0),this.hiddenUpdates=Lf(null),this.identifierPrefix=l,this.onUncaughtError=d,this.onCaughtError=p,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=A,this.incompleteTransitions=new Map}function pS(i,s,a,l,d,p,v,w,A,$,V,P){return i=new wC(i,s,a,v,A,$,V,P,w),s=1,p===!0&&(s|=24),p=mn(3,null,null,s),i.current=p,p.stateNode=i,s=xd(),s.refCount++,i.pooledCache=s,s.refCount++,p.memoizedState={element:l,isDehydrated:a,cache:s},Od(p),i}function mS(i){return i?(i=Hs,i):Hs}function yS(i,s,a,l,d,p){d=mS(d),l.context===null?l.context=d:l.pendingContext=d,l=cr(s),l.payload={element:a},p=p===void 0?null:p,p!==null&&(l.callback=p),a=fr(i,l,s),a!==null&&(ln(a,i,s),Sa(a,i,s))}function gS(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<s?a:s}}function Ih(i,s){gS(i,s),(i=i.alternate)&&gS(i,s)}function vS(i){if(i.tag===13||i.tag===31){var s=Wr(i,67108864);s!==null&&ln(s,i,67108864),Ih(i,67108864)}}function bS(i){if(i.tag===13||i.tag===31){var s=Sn();s=Vf(s);var a=Wr(i,s);a!==null&&ln(a,i,s),Ih(i,s)}}var Xu=!0;function xC(i,s,a,l){var d=j.T;j.T=null;var p=U.p;try{U.p=2,Hh(i,s,a,l)}finally{U.p=p,j.T=d}}function TC(i,s,a,l){var d=j.T;j.T=null;var p=U.p;try{U.p=8,Hh(i,s,a,l)}finally{U.p=p,j.T=d}}function Hh(i,s,a,l){if(Xu){var d=Fh(l);if(d===null)Mh(i,s,l,Zu,a),wS(i,l);else if(EC(d,i,s,a,l))l.stopPropagation();else if(wS(i,l),s&4&&-1<AC.indexOf(i)){for(;d!==null;){var p=$s(d);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var v=Yr(p.pendingLanes);if(v!==0){var w=p;for(w.pendingLanes|=2,w.entangledLanes|=2;v;){var A=1<<31-hn(v);w.entanglements[1]|=A,v&=~A}ai(p),(Be&6)===0&&(Nu=st()+500,Ba(0))}}break;case 31:case 13:w=Wr(p,2),w!==null&&ln(w,p,2),ju(),Ih(p,2)}if(p=Fh(l),p===null&&Mh(i,s,l,Zu,a),p===d)break;d=p}d!==null&&l.stopPropagation()}else Mh(i,s,l,null,a)}}function Fh(i){return i=Yf(i),Gh(i)}var Zu=null;function Gh(i){if(Zu=null,i=Ns(i),i!==null){var s=u(i);if(s===null)i=null;else{var a=s.tag;if(a===13){if(i=c(s),i!==null)return i;i=null}else if(a===31){if(i=f(s),i!==null)return i;i=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return Zu=i,null}function SS(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Vl()){case Rg:return 2;case kg:return 8;case Ul:case cR:return 32;case Cg:return 268435456;default:return 32}default:return 32}}var Yh=!1,xr=null,Tr=null,Ar=null,Pa=new Map,Ia=new Map,Er=[],AC="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function wS(i,s){switch(i){case"focusin":case"focusout":xr=null;break;case"dragenter":case"dragleave":Tr=null;break;case"mouseover":case"mouseout":Ar=null;break;case"pointerover":case"pointerout":Pa.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ia.delete(s.pointerId)}}function Ha(i,s,a,l,d,p){return i===null||i.nativeEvent!==p?(i={blockedOn:s,domEventName:a,eventSystemFlags:l,nativeEvent:p,targetContainers:[d]},s!==null&&(s=$s(s),s!==null&&vS(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),i)}function EC(i,s,a,l,d){switch(s){case"focusin":return xr=Ha(xr,i,s,a,l,d),!0;case"dragenter":return Tr=Ha(Tr,i,s,a,l,d),!0;case"mouseover":return Ar=Ha(Ar,i,s,a,l,d),!0;case"pointerover":var p=d.pointerId;return Pa.set(p,Ha(Pa.get(p)||null,i,s,a,l,d)),!0;case"gotpointercapture":return p=d.pointerId,Ia.set(p,Ha(Ia.get(p)||null,i,s,a,l,d)),!0}return!1}function xS(i){var s=Ns(i.target);if(s!==null){var a=u(s);if(a!==null){if(s=a.tag,s===13){if(s=c(a),s!==null){i.blockedOn=s,Bg(i.priority,function(){bS(a)});return}}else if(s===31){if(s=f(a),s!==null){i.blockedOn=s,Bg(i.priority,function(){bS(a)});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Qu(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var a=Fh(i.nativeEvent);if(a===null){a=i.nativeEvent;var l=new a.constructor(a.type,a);Gf=l,a.target.dispatchEvent(l),Gf=null}else return s=$s(a),s!==null&&vS(s),i.blockedOn=a,!1;s.shift()}return!0}function TS(i,s,a){Qu(i)&&a.delete(s)}function OC(){Yh=!1,xr!==null&&Qu(xr)&&(xr=null),Tr!==null&&Qu(Tr)&&(Tr=null),Ar!==null&&Qu(Ar)&&(Ar=null),Pa.forEach(TS),Ia.forEach(TS)}function Wu(i,s){i.blockedOn===s&&(i.blockedOn=null,Yh||(Yh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,OC)))}var ec=null;function AS(i){ec!==i&&(ec=i,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){ec===i&&(ec=null);for(var s=0;s<i.length;s+=3){var a=i[s],l=i[s+1],d=i[s+2];if(typeof l!="function"){if(Gh(l||a)===null)continue;break}var p=$s(a);p!==null&&(i.splice(s,3),s-=3,Fd(p,{pending:!0,data:d,method:a.method,action:l},l,d))}}))}function yo(i){function s(A){return Wu(A,i)}xr!==null&&Wu(xr,i),Tr!==null&&Wu(Tr,i),Ar!==null&&Wu(Ar,i),Pa.forEach(s),Ia.forEach(s);for(var a=0;a<Er.length;a++){var l=Er[a];l.blockedOn===i&&(l.blockedOn=null)}for(;0<Er.length&&(a=Er[0],a.blockedOn===null);)xS(a),a.blockedOn===null&&Er.shift();if(a=(i.ownerDocument||i).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var d=a[l],p=a[l+1],v=d[tn]||null;if(typeof p=="function")v||AS(a);else if(v){var w=null;if(p&&p.hasAttribute("formAction")){if(d=p,v=p[tn]||null)w=v.formAction;else if(Gh(d)!==null)continue}else w=v.action;typeof w=="function"?a[l+1]=w:(a.splice(l,3),l-=3),AS(a)}}}function ES(){function i(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(v){return d=v})},focusReset:"manual",scroll:"manual"})}function s(){d!==null&&(d(),d=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,d=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),d!==null&&(d(),d=null)}}}function Jh(i){this._internalRoot=i}tc.prototype.render=Jh.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var a=s.current,l=Sn();yS(a,l,i,s,null,null)},tc.prototype.unmount=Jh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;yS(i.current,2,null,i,null,null),ju(),s[Ds]=null}};function tc(i){this._internalRoot=i}tc.prototype.unstable_scheduleHydration=function(i){if(i){var s=jg();i={blockedOn:null,target:i,priority:s};for(var a=0;a<Er.length&&s!==0&&s<Er[a].priority;a++);Er.splice(a,0,i),a===0&&xS(i)}};var OS=e.version;if(OS!=="19.2.3")throw Error(r(527,OS,"19.2.3"));U.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=m(s),i=i!==null?y(i):null,i=i===null?null:i.stateNode,i};var _C={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nc.isDisabled&&nc.supportsFiber)try{ea=nc.inject(_C),dn=nc}catch{}}return Ga.createRoot=function(i,s){if(!o(i))throw Error(r(299));var a=!1,l="",d=Nb,p=$b,v=jb;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(l=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(p=s.onCaughtError),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=pS(i,1,!1,null,null,a,l,null,d,p,v,ES),i[Ds]=s.current,Ch(i),new Jh(s)},Ga.hydrateRoot=function(i,s,a){if(!o(i))throw Error(r(299));var l=!1,d="",p=Nb,v=$b,w=jb,A=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError),a.formState!==void 0&&(A=a.formState)),s=pS(i,1,!0,s,a??null,l,d,A,p,v,w,ES),s.context=mS(null),a=s.current,l=Sn(),l=Vf(l),d=cr(l),d.callback=null,fr(a,d,l),a=l,s.current.lanes=a,na(s,a),ai(s),i[Ds]=s.current,Ch(i),new tc(s)},Ga.version="19.2.3",Ga}var GS;function GM(){if(GS)return ep.exports;GS=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),ep.exports=FM(),ep.exports}var YM=GM();function hf(){return typeof window<"u"}function Ir(t){return _T(t)?(t.nodeName||"").toLowerCase():"#document"}function xn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function bi(t){var e;return(e=(_T(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function _T(t){return hf()?t instanceof Node||t instanceof xn(t).Node:!1}function yt(t){return hf()?t instanceof Element||t instanceof xn(t).Element:!1}function Dt(t){return hf()?t instanceof HTMLElement||t instanceof xn(t).HTMLElement:!1}function Zp(t){return!hf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof xn(t).ShadowRoot}const JM=new Set(["inline","contents"]);function Al(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=qn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!JM.has(o)}const XM=new Set(["table","td","th"]);function ZM(t){return XM.has(Ir(t))}const QM=[":popover-open",":modal"];function pf(t){return QM.some(e=>{try{return t.matches(e)}catch{return!1}})}const WM=["transform","translate","scale","rotate","perspective"],eD=["transform","translate","scale","rotate","perspective","filter"],tD=["paint","layout","strict","content"];function Sy(t){const e=mf(),n=yt(t)?qn(t):t;return WM.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||eD.some(r=>(n.willChange||"").includes(r))||tD.some(r=>(n.contain||"").includes(r))}function nD(t){let e=Yi(t);for(;Dt(e)&&!Fi(e);){if(Sy(e))return e;if(pf(e))return null;e=Yi(e)}return null}function mf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const iD=new Set(["html","body","#document"]);function Fi(t){return iD.has(Ir(t))}function qn(t){return xn(t).getComputedStyle(t)}function yf(t){return yt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Yi(t){if(Ir(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Zp(t)&&t.host||bi(t);return Zp(e)?e.host:e}function RT(t){const e=Yi(t);return Fi(e)?t.ownerDocument?t.ownerDocument.body:t.body:Dt(e)&&Al(e)?e:RT(e)}function $r(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=RT(t),u=o===((r=t.ownerDocument)==null?void 0:r.body),c=xn(o);if(u){const f=Qp(c);return e.concat(c,c.visualViewport||[],Al(o)?o:[],f&&n?$r(f):[])}return e.concat(o,$r(o,[],n))}function Qp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const jc=Math.min,bs=Math.max,Bc=Math.round,rc=Math.floor,hi=t=>({x:t,y:t}),rD={left:"right",right:"left",bottom:"top",top:"bottom"},sD={start:"end",end:"start"};function YS(t,e,n){return bs(t,jc(e,n))}function gf(t,e){return typeof t=="function"?t(e):t}function As(t){return t.split("-")[0]}function vf(t){return t.split("-")[1]}function kT(t){return t==="x"?"y":"x"}function CT(t){return t==="y"?"height":"width"}const oD=new Set(["top","bottom"]);function Mr(t){return oD.has(As(t))?"y":"x"}function MT(t){return kT(Mr(t))}function aD(t,e,n){n===void 0&&(n=!1);const r=vf(t),o=MT(t),u=CT(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[u]>e.floating[u]&&(c=zc(c)),[c,zc(c)]}function lD(t){const e=zc(t);return[Wp(t),e,Wp(e)]}function Wp(t){return t.replace(/start|end/g,e=>sD[e])}const JS=["left","right"],XS=["right","left"],uD=["top","bottom"],cD=["bottom","top"];function fD(t,e,n){switch(t){case"top":case"bottom":return n?e?XS:JS:e?JS:XS;case"left":case"right":return e?uD:cD;default:return[]}}function dD(t,e,n,r){const o=vf(t);let u=fD(As(t),n==="start",r);return o&&(u=u.map(c=>c+"-"+o),e&&(u=u.concat(u.map(Wp)))),u}function zc(t){return t.replace(/left|right|bottom|top/g,e=>rD[e])}function hD(t){return{top:0,right:0,bottom:0,left:0,...t}}function pD(t){return typeof t!="number"?hD(t):{top:t,right:t,bottom:t,left:t}}function Lc(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}var mD=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Vc=mD.join(","),DT=typeof Element>"u",zo=DT?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Uc=!DT&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},hl=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),u=o===""||o==="true",c=u||n&&e&&hl(e.parentNode);return c},yD=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},NT=function(e,n,r){if(hl(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Vc));return n&&zo.call(e,Vc)&&o.unshift(e),o=o.filter(r),o},Kc=function(e,n,r){for(var o=[],u=Array.from(e);u.length;){var c=u.shift();if(!hl(c,!1))if(c.tagName==="SLOT"){var f=c.assignedElements(),h=f.length?f:c.children,m=Kc(h,!0,r);r.flatten?o.push.apply(o,m):o.push({scopeParent:c,candidates:m})}else{var y=zo.call(c,Vc);y&&r.filter(c)&&(n||!e.includes(c))&&o.push(c);var g=c.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(c),b=!hl(g,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(c));if(g&&b){var S=Kc(g===!0?c.children:g.children,!0,r);r.flatten?o.push.apply(o,S):o.push({scopeParent:c,candidates:S})}else u.unshift.apply(u,c.children)}}return o},$T=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},jT=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||yD(e))&&!$T(e)?0:e.tabIndex},gD=function(e,n){var r=jT(e);return r<0&&n&&!$T(e)?0:r},vD=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},BT=function(e){return e.tagName==="INPUT"},bD=function(e){return BT(e)&&e.type==="hidden"},SD=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},wD=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},xD=function(e){if(!e.name)return!0;var n=e.form||Uc(e),r=function(f){return n.querySelectorAll('input[type="radio"][name="'+f+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(c){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",c.message),!1}var u=wD(o,e.form);return!u||u===e},TD=function(e){return BT(e)&&e.type==="radio"},AD=function(e){return TD(e)&&!xD(e)},ED=function(e){var n,r=e&&Uc(e),o=(n=r)===null||n===void 0?void 0:n.host,u=!1;if(r&&r!==e){var c,f,h;for(u=!!((c=o)!==null&&c!==void 0&&(f=c.ownerDocument)!==null&&f!==void 0&&f.contains(o)||e!=null&&(h=e.ownerDocument)!==null&&h!==void 0&&h.contains(e));!u&&o;){var m,y,g;r=Uc(o),o=(m=r)===null||m===void 0?void 0:m.host,u=!!((y=o)!==null&&y!==void 0&&(g=y.ownerDocument)!==null&&g!==void 0&&g.contains(o))}}return u},ZS=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},OD=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var u=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!u}if(getComputedStyle(e).visibility==="hidden")return!0;var c=zo.call(e,"details>summary:first-of-type"),f=c?e.parentElement:e;if(zo.call(f,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var h=e;e;){var m=e.parentElement,y=Uc(e);if(m&&!m.shadowRoot&&o(m)===!0)return ZS(e);e.assignedSlot?e=e.assignedSlot:!m&&y!==e.ownerDocument?e=y.host:e=m}e=h}if(ED(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return ZS(e);return!1},_D=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return zo.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},em=function(e,n){return!(n.disabled||hl(n)||bD(n)||OD(n,e)||SD(n)||_D(n))},tm=function(e,n){return!(AD(n)||jT(n)<0||!em(e,n))},RD=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},zT=function(e){var n=[],r=[];return e.forEach(function(o,u){var c=!!o.scopeParent,f=c?o.scopeParent:o,h=gD(f,c),m=c?zT(o.candidates):f;h===0?c?n.push.apply(n,m):n.push(f):r.push({documentOrder:u,tabIndex:h,item:o,isScope:c,content:m})}),r.sort(vD).reduce(function(o,u){return u.isScope?o.push.apply(o,u.content):o.push(u.content),o},[]).concat(n)},wy=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Kc([e],n.includeContainer,{filter:tm.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:RD}):r=NT(e,n.includeContainer,tm.bind(null,n)),zT(r)},kD=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Kc([e],n.includeContainer,{filter:em.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=NT(e,n.includeContainer,em.bind(null,n)),r},LT=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return zo.call(e,Vc)===!1?!1:tm(n,e)};function CD(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function VT(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}function MD(){return/apple/i.test(navigator.vendor)}function nm(){const t=/android/i;return t.test(CD())||t.test(VT())}function DD(){return VT().includes("jsdom/")}const QS="data-floating-ui-focusable",ND="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function wo(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function wn(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Zp(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function kr(t){return"composedPath"in t?t.composedPath()[0]:t.target}function rp(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function $D(t){return t.matches("html,body")}function Wn(t){return t?.ownerDocument||document}function UT(t){return Dt(t)&&t.matches(ND)}function WS(t){return t?t.getAttribute("role")==="combobox"&&UT(t):!1}function im(t){return t?t.hasAttribute(QS)?t:t.querySelector("["+QS+"]")||t:null}function ko(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var u;return o.parentId===e&&(!n||((u=o.context)==null?void 0:u.open))}).flatMap(o=>[o,...ko(t,o.id,n)])}function ew(t,e){var n;let r=[],o=(n=t.find(u=>u.id===e))==null?void 0:n.parentId;for(;o;){const u=t.find(c=>c.id===o);o=u?.parentId,u&&(r=r.concat(u))}return r}function sp(t){t.preventDefault(),t.stopPropagation()}function jD(t){return"nativeEvent"in t}function BD(t){return t.mozInputSource===0&&t.isTrusted?!0:nm()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function zD(t){return DD()?!1:!nm()&&t.width===0&&t.height===0||nm()&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function tw(t,e){return["mouse","pen"].includes(t)}var LD=typeof document<"u",VD=function(){},Hi=LD?N.useLayoutEffect:VD;const UD={...ST};function op(t){const e=N.useRef(t);return Hi(()=>{e.current=t}),e}const KD=UD.useInsertionEffect,qD=KD||(t=>t());function ci(t){const e=N.useRef(()=>{});return qD(()=>{e.current=t}),N.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const bf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function KT(t,e){const n=wy(t,bf()),r=n.length;if(r===0)return;const o=wo(Wn(t)),u=n.indexOf(o),c=u===-1?e===1?0:r-1:u+e;return n[c]}function PD(t){return KT(Wn(t).body,1)||t}function ID(t){return KT(Wn(t).body,-1)||t}function nw(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!wn(n,r)}var HD=OT();function iw(t,e,n){let{reference:r,floating:o}=t;const u=Mr(e),c=MT(e),f=CT(c),h=As(e),m=u==="y",y=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,b=r[f]/2-o[f]/2;let S;switch(h){case"top":S={x:y,y:r.y-o.height};break;case"bottom":S={x:y,y:r.y+r.height};break;case"right":S={x:r.x+r.width,y:g};break;case"left":S={x:r.x-o.width,y:g};break;default:S={x:r.x,y:r.y}}switch(vf(e)){case"start":S[c]-=b*(n&&m?-1:1);break;case"end":S[c]+=b*(n&&m?-1:1);break}return S}const FD=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:u=[],platform:c}=n,f=u.filter(Boolean),h=await(c.isRTL==null?void 0:c.isRTL(e));let m=await c.getElementRects({reference:t,floating:e,strategy:o}),{x:y,y:g}=iw(m,r,h),b=r,S={},x=0;for(let T=0;T<f.length;T++){const{name:_,fn:k}=f[T],{x:C,y:M,data:G,reset:I}=await k({x:y,y:g,initialPlacement:r,placement:b,strategy:o,middlewareData:S,rects:m,platform:c,elements:{reference:t,floating:e}});y=C??y,g=M??g,S={...S,[_]:{...S[_],...G}},I&&x<=50&&(x++,typeof I=="object"&&(I.placement&&(b=I.placement),I.rects&&(m=I.rects===!0?await c.getElementRects({reference:t,floating:e,strategy:o}):I.rects),{x:y,y:g}=iw(m,b,h)),T=-1)}return{x:y,y:g,placement:b,strategy:o,middlewareData:S}};async function qT(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:u,rects:c,elements:f,strategy:h}=t,{boundary:m="clippingAncestors",rootBoundary:y="viewport",elementContext:g="floating",altBoundary:b=!1,padding:S=0}=gf(e,t),x=pD(S),_=f[b?g==="floating"?"reference":"floating":g],k=Lc(await u.getClippingRect({element:(n=await(u.isElement==null?void 0:u.isElement(_)))==null||n?_:_.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(f.floating)),boundary:m,rootBoundary:y,strategy:h})),C=g==="floating"?{x:r,y:o,width:c.floating.width,height:c.floating.height}:c.reference,M=await(u.getOffsetParent==null?void 0:u.getOffsetParent(f.floating)),G=await(u.isElement==null?void 0:u.isElement(M))?await(u.getScale==null?void 0:u.getScale(M))||{x:1,y:1}:{x:1,y:1},I=Lc(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:C,offsetParent:M,strategy:h}):C);return{top:(k.top-I.top+x.top)/G.y,bottom:(I.bottom-k.bottom+x.bottom)/G.y,left:(k.left-I.left+x.left)/G.x,right:(I.right-k.right+x.right)/G.x}}const GD=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:u,rects:c,initialPlacement:f,platform:h,elements:m}=e,{mainAxis:y=!0,crossAxis:g=!0,fallbackPlacements:b,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:T=!0,..._}=gf(t,e);if((n=u.arrow)!=null&&n.alignmentOffset)return{};const k=As(o),C=Mr(f),M=As(f)===f,G=await(h.isRTL==null?void 0:h.isRTL(m.floating)),I=b||(M||!T?[zc(f)]:lD(f)),ee=x!=="none";!b&&ee&&I.push(...dD(f,T,x,G));const J=[f,...I],X=await qT(e,_),he=[];let pe=((r=u.flip)==null?void 0:r.overflows)||[];if(y&&he.push(X[k]),g){const Z=aD(o,c,G);he.push(X[Z[0]],X[Z[1]])}if(pe=[...pe,{placement:o,overflows:he}],!he.every(Z=>Z<=0)){var we,je;const Z=(((we=u.flip)==null?void 0:we.index)||0)+1,ne=J[Z];if(ne&&(!(g==="alignment"?C!==Mr(ne):!1)||pe.every(L=>Mr(L.placement)===C?L.overflows[0]>0:!0)))return{data:{index:Z,overflows:pe},reset:{placement:ne}};let j=(je=pe.filter(U=>U.overflows[0]<=0).sort((U,L)=>U.overflows[1]-L.overflows[1])[0])==null?void 0:je.placement;if(!j)switch(S){case"bestFit":{var be;const U=(be=pe.filter(L=>{if(ee){const te=Mr(L.placement);return te===C||te==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(te=>te>0).reduce((te,oe)=>te+oe,0)]).sort((L,te)=>L[1]-te[1])[0])==null?void 0:be[0];U&&(j=U);break}case"initialPlacement":j=f;break}if(o!==j)return{reset:{placement:j}}}return{}}}},YD=new Set(["left","top"]);async function JD(t,e){const{placement:n,platform:r,elements:o}=t,u=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=As(n),f=vf(n),h=Mr(n)==="y",m=YD.has(c)?-1:1,y=u&&h?-1:1,g=gf(e,t);let{mainAxis:b,crossAxis:S,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return f&&typeof x=="number"&&(S=f==="end"?x*-1:x),h?{x:S*y,y:b*m}:{x:b*m,y:S*y}}const XD=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:u,placement:c,middlewareData:f}=e,h=await JD(e,t);return c===((n=f.offset)==null?void 0:n.placement)&&(r=f.arrow)!=null&&r.alignmentOffset?{}:{x:o+h.x,y:u+h.y,data:{...h,placement:c}}}}},ZD=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:u=!0,crossAxis:c=!1,limiter:f={fn:_=>{let{x:k,y:C}=_;return{x:k,y:C}}},...h}=gf(t,e),m={x:n,y:r},y=await qT(e,h),g=Mr(As(o)),b=kT(g);let S=m[b],x=m[g];if(u){const _=b==="y"?"top":"left",k=b==="y"?"bottom":"right",C=S+y[_],M=S-y[k];S=YS(C,S,M)}if(c){const _=g==="y"?"top":"left",k=g==="y"?"bottom":"right",C=x+y[_],M=x-y[k];x=YS(C,x,M)}const T=f.fn({...e,[b]:S,[g]:x});return{...T,data:{x:T.x-n,y:T.y-r,enabled:{[b]:u,[g]:c}}}}}};function PT(t){const e=qn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=Dt(t),u=o?t.offsetWidth:n,c=o?t.offsetHeight:r,f=Bc(n)!==u||Bc(r)!==c;return f&&(n=u,r=c),{width:n,height:r,$:f}}function xy(t){return yt(t)?t:t.contextElement}function Co(t){const e=xy(t);if(!Dt(e))return hi(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:u}=PT(e);let c=(u?Bc(n.width):n.width)/r,f=(u?Bc(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!f||!Number.isFinite(f))&&(f=1),{x:c,y:f}}const QD=hi(0);function IT(t){const e=xn(t);return!mf()||!e.visualViewport?QD:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function WD(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==xn(t)?!1:e}function Es(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),u=xy(t);let c=hi(1);e&&(r?yt(r)&&(c=Co(r)):c=Co(t));const f=WD(u,n,r)?IT(u):hi(0);let h=(o.left+f.x)/c.x,m=(o.top+f.y)/c.y,y=o.width/c.x,g=o.height/c.y;if(u){const b=xn(u),S=r&&yt(r)?xn(r):r;let x=b,T=Qp(x);for(;T&&r&&S!==x;){const _=Co(T),k=T.getBoundingClientRect(),C=qn(T),M=k.left+(T.clientLeft+parseFloat(C.paddingLeft))*_.x,G=k.top+(T.clientTop+parseFloat(C.paddingTop))*_.y;h*=_.x,m*=_.y,y*=_.x,g*=_.y,h+=M,m+=G,x=xn(T),T=Qp(x)}}return Lc({width:y,height:g,x:h,y:m})}function Sf(t,e){const n=yf(t).scrollLeft;return e?e.left+n:Es(bi(t)).left+n}function HT(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Sf(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function e2(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const u=o==="fixed",c=bi(r),f=e?pf(e.floating):!1;if(r===c||f&&u)return n;let h={scrollLeft:0,scrollTop:0},m=hi(1);const y=hi(0),g=Dt(r);if((g||!g&&!u)&&((Ir(r)!=="body"||Al(c))&&(h=yf(r)),Dt(r))){const S=Es(r);m=Co(r),y.x=S.x+r.clientLeft,y.y=S.y+r.clientTop}const b=c&&!g&&!u?HT(c,h):hi(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-h.scrollLeft*m.x+y.x+b.x,y:n.y*m.y-h.scrollTop*m.y+y.y+b.y}}function t2(t){return Array.from(t.getClientRects())}function n2(t){const e=bi(t),n=yf(t),r=t.ownerDocument.body,o=bs(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),u=bs(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+Sf(t);const f=-n.scrollTop;return qn(r).direction==="rtl"&&(c+=bs(e.clientWidth,r.clientWidth)-o),{width:o,height:u,x:c,y:f}}const rw=25;function i2(t,e){const n=xn(t),r=bi(t),o=n.visualViewport;let u=r.clientWidth,c=r.clientHeight,f=0,h=0;if(o){u=o.width,c=o.height;const y=mf();(!y||y&&e==="fixed")&&(f=o.offsetLeft,h=o.offsetTop)}const m=Sf(r);if(m<=0){const y=r.ownerDocument,g=y.body,b=getComputedStyle(g),S=y.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,x=Math.abs(r.clientWidth-g.clientWidth-S);x<=rw&&(u-=x)}else m<=rw&&(u+=m);return{width:u,height:c,x:f,y:h}}const r2=new Set(["absolute","fixed"]);function s2(t,e){const n=Es(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,u=Dt(t)?Co(t):hi(1),c=t.clientWidth*u.x,f=t.clientHeight*u.y,h=o*u.x,m=r*u.y;return{width:c,height:f,x:h,y:m}}function sw(t,e,n){let r;if(e==="viewport")r=i2(t,n);else if(e==="document")r=n2(bi(t));else if(yt(e))r=s2(e,n);else{const o=IT(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Lc(r)}function FT(t,e){const n=Yi(t);return n===e||!yt(n)||Fi(n)?!1:qn(n).position==="fixed"||FT(n,e)}function o2(t,e){const n=e.get(t);if(n)return n;let r=$r(t,[],!1).filter(f=>yt(f)&&Ir(f)!=="body"),o=null;const u=qn(t).position==="fixed";let c=u?Yi(t):t;for(;yt(c)&&!Fi(c);){const f=qn(c),h=Sy(c);!h&&f.position==="fixed"&&(o=null),(u?!h&&!o:!h&&f.position==="static"&&!!o&&r2.has(o.position)||Al(c)&&!h&&FT(t,c))?r=r.filter(y=>y!==c):o=f,c=Yi(c)}return e.set(t,r),r}function a2(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const c=[...n==="clippingAncestors"?pf(e)?[]:o2(e,this._c):[].concat(n),r],f=c[0],h=c.reduce((m,y)=>{const g=sw(e,y,o);return m.top=bs(g.top,m.top),m.right=jc(g.right,m.right),m.bottom=jc(g.bottom,m.bottom),m.left=bs(g.left,m.left),m},sw(e,f,o));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function l2(t){const{width:e,height:n}=PT(t);return{width:e,height:n}}function u2(t,e,n){const r=Dt(e),o=bi(e),u=n==="fixed",c=Es(t,!0,u,e);let f={scrollLeft:0,scrollTop:0};const h=hi(0);function m(){h.x=Sf(o)}if(r||!r&&!u)if((Ir(e)!=="body"||Al(o))&&(f=yf(e)),r){const S=Es(e,!0,u,e);h.x=S.x+e.clientLeft,h.y=S.y+e.clientTop}else o&&m();u&&!r&&o&&m();const y=o&&!r&&!u?HT(o,f):hi(0),g=c.left+f.scrollLeft-h.x-y.x,b=c.top+f.scrollTop-h.y-y.y;return{x:g,y:b,width:c.width,height:c.height}}function ap(t){return qn(t).position==="static"}function ow(t,e){if(!Dt(t)||qn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return bi(t)===n&&(n=n.ownerDocument.body),n}function GT(t,e){const n=xn(t);if(pf(t))return n;if(!Dt(t)){let o=Yi(t);for(;o&&!Fi(o);){if(yt(o)&&!ap(o))return o;o=Yi(o)}return n}let r=ow(t,e);for(;r&&ZM(r)&&ap(r);)r=ow(r,e);return r&&Fi(r)&&ap(r)&&!Sy(r)?n:r||nD(t)||n}const c2=async function(t){const e=this.getOffsetParent||GT,n=this.getDimensions,r=await n(t.floating);return{reference:u2(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function f2(t){return qn(t).direction==="rtl"}const d2={convertOffsetParentRelativeRectToViewportRelativeRect:e2,getDocumentElement:bi,getClippingRect:a2,getOffsetParent:GT,getElementRects:c2,getClientRects:t2,getDimensions:l2,getScale:Co,isElement:yt,isRTL:f2};function YT(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function h2(t,e){let n=null,r;const o=bi(t);function u(){var f;clearTimeout(r),(f=n)==null||f.disconnect(),n=null}function c(f,h){f===void 0&&(f=!1),h===void 0&&(h=1),u();const m=t.getBoundingClientRect(),{left:y,top:g,width:b,height:S}=m;if(f||e(),!b||!S)return;const x=rc(g),T=rc(o.clientWidth-(y+b)),_=rc(o.clientHeight-(g+S)),k=rc(y),M={rootMargin:-x+"px "+-T+"px "+-_+"px "+-k+"px",threshold:bs(0,jc(1,h))||1};let G=!0;function I(ee){const J=ee[0].intersectionRatio;if(J!==h){if(!G)return c();J?c(!1,J):r=setTimeout(()=>{c(!1,1e-7)},1e3)}J===1&&!YT(m,t.getBoundingClientRect())&&c(),G=!1}try{n=new IntersectionObserver(I,{...M,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,M)}n.observe(t)}return c(!0),u}function p2(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:u=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,m=xy(t),y=o||u?[...m?$r(m):[],...$r(e)]:[];y.forEach(k=>{o&&k.addEventListener("scroll",n,{passive:!0}),u&&k.addEventListener("resize",n)});const g=m&&f?h2(m,n):null;let b=-1,S=null;c&&(S=new ResizeObserver(k=>{let[C]=k;C&&C.target===m&&S&&(S.unobserve(e),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var M;(M=S)==null||M.observe(e)})),n()}),m&&!h&&S.observe(m),S.observe(e));let x,T=h?Es(t):null;h&&_();function _(){const k=Es(t);T&&!YT(T,k)&&n(),T=k,x=requestAnimationFrame(_)}return n(),()=>{var k;y.forEach(C=>{o&&C.removeEventListener("scroll",n),u&&C.removeEventListener("resize",n)}),g?.(),(k=S)==null||k.disconnect(),S=null,h&&cancelAnimationFrame(x)}}const m2=XD,y2=ZD,g2=GD,v2=(t,e,n)=>{const r=new Map,o={platform:d2,...n},u={...o.platform,_c:r};return FD(t,e,{...o,platform:u})};var b2=typeof document<"u",S2=function(){},Sc=b2?N.useLayoutEffect:S2;function qc(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!qc(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const u=o[r];if(!(u==="_owner"&&t.$$typeof)&&!qc(t[u],e[u]))return!1}return!0}return t!==t&&e!==e}function JT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function aw(t,e){const n=JT(t);return Math.round(e*n)/n}function lp(t){const e=N.useRef(t);return Sc(()=>{e.current=t}),e}function w2(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:u,floating:c}={},transform:f=!0,whileElementsMounted:h,open:m}=t,[y,g]=N.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[b,S]=N.useState(r);qc(b,r)||S(r);const[x,T]=N.useState(null),[_,k]=N.useState(null),C=N.useCallback(L=>{L!==ee.current&&(ee.current=L,T(L))},[]),M=N.useCallback(L=>{L!==J.current&&(J.current=L,k(L))},[]),G=u||x,I=c||_,ee=N.useRef(null),J=N.useRef(null),X=N.useRef(y),he=h!=null,pe=lp(h),we=lp(o),je=lp(m),be=N.useCallback(()=>{if(!ee.current||!J.current)return;const L={placement:e,strategy:n,middleware:b};we.current&&(L.platform=we.current),v2(ee.current,J.current,L).then(te=>{const oe={...te,isPositioned:je.current!==!1};Z.current&&!qc(X.current,oe)&&(X.current=oe,HD.flushSync(()=>{g(oe)}))})},[b,e,n,we,je]);Sc(()=>{m===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,g(L=>({...L,isPositioned:!1})))},[m]);const Z=N.useRef(!1);Sc(()=>(Z.current=!0,()=>{Z.current=!1}),[]),Sc(()=>{if(G&&(ee.current=G),I&&(J.current=I),G&&I){if(pe.current)return pe.current(G,I,be);be()}},[G,I,be,pe,he]);const ne=N.useMemo(()=>({reference:ee,floating:J,setReference:C,setFloating:M}),[C,M]),j=N.useMemo(()=>({reference:G,floating:I}),[G,I]),U=N.useMemo(()=>{const L={position:n,left:0,top:0};if(!j.floating)return L;const te=aw(j.floating,y.x),oe=aw(j.floating,y.y);return f?{...L,transform:"translate("+te+"px, "+oe+"px)",...JT(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:te,top:oe}},[n,f,j.floating,y.x,y.y]);return N.useMemo(()=>({...y,update:be,refs:ne,elements:j,floatingStyles:U}),[y,be,ne,j,U])}const x2=(t,e)=>({...m2(t),options:[t,e]}),T2=(t,e)=>({...y2(t),options:[t,e]}),A2=(t,e)=>({...g2(t),options:[t,e]}),E2="data-floating-ui-focusable",lw="active",uw="selected",O2={...ST};let cw=!1,_2=0;const fw=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+_2++;function R2(){const[t,e]=N.useState(()=>cw?fw():void 0);return Hi(()=>{t==null&&e(fw())},[]),N.useEffect(()=>{cw=!0},[]),t}const k2=O2.useId,XT=k2||R2;function C2(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const M2=N.createContext(null),D2=N.createContext(null),ZT=()=>{var t;return((t=N.useContext(M2))==null?void 0:t.id)||null},Ty=()=>N.useContext(D2);function Pc(t){return"data-floating-ui-"+t}function N2(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}let dw=0;function go(t,e){e===void 0&&(e={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=e;r&&cancelAnimationFrame(dw);const u=()=>t?.focus({preventScroll:n});o?u():dw=requestAnimationFrame(u)}function $2(t){return t?.ownerDocument||document}const Mo={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function hw(t){return t==="inert"?Mo.inert:t==="aria-hidden"?Mo["aria-hidden"]:Mo.none}let sc=new WeakSet,oc={},up=0;const j2=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,QT=t=>t&&(t.host||QT(t.parentNode)),B2=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=QT(n);return t.contains(r)?r:null}).filter(n=>n!=null);function z2(t,e,n,r){const o="data-floating-ui-inert",u=r?"inert":n?"aria-hidden":null,c=B2(e,t),f=new Set,h=new Set(c),m=[];oc[o]||(oc[o]=new WeakMap);const y=oc[o];c.forEach(g),b(e),f.clear();function g(S){!S||f.has(S)||(f.add(S),S.parentNode&&g(S.parentNode))}function b(S){!S||h.has(S)||[].forEach.call(S.children,x=>{if(Ir(x)!=="script")if(f.has(x))b(x);else{const T=u?x.getAttribute(u):null,_=T!==null&&T!=="false",k=hw(u),C=(k.get(x)||0)+1,M=(y.get(x)||0)+1;k.set(x,C),y.set(x,M),m.push(x),C===1&&_&&sc.add(x),M===1&&x.setAttribute(o,""),!_&&u&&x.setAttribute(u,u==="inert"?"":"true")}})}return up++,()=>{m.forEach(S=>{const x=hw(u),_=(x.get(S)||0)-1,k=(y.get(S)||0)-1;x.set(S,_),y.set(S,k),_||(!sc.has(S)&&u&&S.removeAttribute(u),sc.delete(S)),k||S.removeAttribute(o)}),up--,up||(Mo.inert=new WeakMap,Mo["aria-hidden"]=new WeakMap,Mo.none=new WeakMap,sc=new WeakSet,oc={})}}function pw(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=$2(t[0]).body;return z2(t.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,e,n)}const Ay={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},mw=N.forwardRef(function(e,n){const[r,o]=N.useState();Hi(()=>{MD()&&o("button")},[]);const u={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Pc("focus-guard")]:"",style:Ay};return F.jsx("span",{...e,...u})}),L2=N.createContext(null),V2=()=>N.useContext(L2);function yw(t){return N.useMemo(()=>e=>{t.forEach(n=>{n&&(n.current=e)})},t)}const U2=20;let Dr=[];function Ey(){Dr=Dr.filter(t=>t.isConnected)}function K2(t){Ey(),t&&Ir(t)!=="body"&&(Dr.push(t),Dr.length>U2&&(Dr=Dr.slice(-20)))}function gw(){return Ey(),Dr[Dr.length-1]}function q2(t){const e=bf();return LT(t,e)?t:wy(t,e)[0]||t}function vw(t,e){var n;if(!e.current.includes("floating")&&!((n=t.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=bf(),u=kD(t,r).filter(f=>{const h=f.getAttribute("data-tabindex")||"";return LT(f,r)||f.hasAttribute("data-tabindex")&&!h.startsWith("-")}),c=t.getAttribute("tabindex");e.current.includes("floating")||u.length===0?c!=="0"&&t.setAttribute("tabindex","0"):(c!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}const P2=N.forwardRef(function(e,n){return F.jsx("button",{...e,type:"button",ref:n,tabIndex:-1,style:Ay})});function I2(t){const{context:e,children:n,disabled:r=!1,order:o=["content"],guards:u=!0,initialFocus:c=0,returnFocus:f=!0,restoreFocus:h=!1,modal:m=!0,visuallyHiddenDismiss:y=!1,closeOnFocusOut:g=!0,outsideElementsInert:b=!1,getInsideElements:S=()=>[]}=t,{open:x,onOpenChange:T,events:_,dataRef:k,elements:{domReference:C,floating:M}}=e,G=ci(()=>{var xe;return(xe=k.current.floatingContext)==null?void 0:xe.nodeId}),I=ci(S),ee=typeof c=="number"&&c<0,J=WS(C)&&ee,X=j2(),he=X?u:!0,pe=!he||X&&b,we=op(o),je=op(c),be=op(f),Z=Ty(),ne=V2(),j=N.useRef(null),U=N.useRef(null),L=N.useRef(!1),te=N.useRef(!1),oe=N.useRef(-1),E=N.useRef(-1),q=ne!=null,H=im(M),Q=ci(function(xe){return xe===void 0&&(xe=H),xe?wy(xe,bf()):[]}),re=ci(xe=>{const Me=Q(xe);return we.current.map(ge=>C&&ge==="reference"?C:H&&ge==="floating"?H:Me).filter(Boolean).flat()});N.useEffect(()=>{if(r||!m)return;function xe(ge){if(ge.key==="Tab"){wn(H,wo(Wn(H)))&&Q().length===0&&!J&&sp(ge);const Xe=re(),ht=kr(ge);we.current[0]==="reference"&&ht===C&&(sp(ge),ge.shiftKey?go(Xe[Xe.length-1]):go(Xe[1])),we.current[1]==="floating"&&ht===H&&ge.shiftKey&&(sp(ge),go(Xe[0]))}}const Me=Wn(H);return Me.addEventListener("keydown",xe),()=>{Me.removeEventListener("keydown",xe)}},[r,C,H,m,we,J,Q,re]),N.useEffect(()=>{if(r||!M)return;function xe(Me){const ge=kr(Me),ht=Q().indexOf(ge);ht!==-1&&(oe.current=ht)}return M.addEventListener("focusin",xe),()=>{M.removeEventListener("focusin",xe)}},[r,M,Q]),N.useEffect(()=>{if(r||!g)return;function xe(){te.current=!0,setTimeout(()=>{te.current=!1})}function Me(ht){const Le=ht.relatedTarget,En=ht.currentTarget,Gt=kr(ht);queueMicrotask(()=>{const Vt=G(),Pn=!(wn(C,Le)||wn(M,Le)||wn(Le,M)||wn(ne?.portalNode,Le)||Le!=null&&Le.hasAttribute(Pc("focus-guard"))||Z&&(ko(Z.nodesRef.current,Vt).find(ii=>{var In,st;return wn((In=ii.context)==null?void 0:In.elements.floating,Le)||wn((st=ii.context)==null?void 0:st.elements.domReference,Le)})||ew(Z.nodesRef.current,Vt).find(ii=>{var In,st,Vl;return[(In=ii.context)==null?void 0:In.elements.floating,im((st=ii.context)==null?void 0:st.elements.floating)].includes(Le)||((Vl=ii.context)==null?void 0:Vl.elements.domReference)===Le})));if(En===C&&H&&vw(H,we),h&&En!==C&&!(Gt!=null&&Gt.isConnected)&&wo(Wn(H))===Wn(H).body){Dt(H)&&H.focus();const ii=oe.current,In=Q(),st=In[ii]||In[In.length-1]||H;Dt(st)&&st.focus()}if(k.current.insideReactTree){k.current.insideReactTree=!1;return}(J||!m)&&Le&&Pn&&!te.current&&Le!==gw()&&(L.current=!0,T(!1,ht,"focus-out"))})}const ge=!!(!Z&&ne);function Xe(){N2(E),k.current.insideReactTree=!0,E.current=window.setTimeout(()=>{k.current.insideReactTree=!1})}if(M&&Dt(C))return C.addEventListener("focusout",Me),C.addEventListener("pointerdown",xe),M.addEventListener("focusout",Me),ge&&M.addEventListener("focusout",Xe,!0),()=>{C.removeEventListener("focusout",Me),C.removeEventListener("pointerdown",xe),M.removeEventListener("focusout",Me),ge&&M.removeEventListener("focusout",Xe,!0)}},[r,C,M,H,m,Z,ne,T,g,h,Q,J,G,we,k]);const ce=N.useRef(null),Te=N.useRef(null),Rt=yw([ce,ne?.beforeInsideRef]),Je=yw([Te,ne?.afterInsideRef]);N.useEffect(()=>{var xe,Me;if(r||!M)return;const ge=Array.from((ne==null||(xe=ne.portalNode)==null?void 0:xe.querySelectorAll("["+Pc("portal")+"]"))||[]),ht=(Me=(Z?ew(Z.nodesRef.current,G()):[]).find(Gt=>{var Vt;return WS(((Vt=Gt.context)==null?void 0:Vt.elements.domReference)||null)}))==null||(Me=Me.context)==null?void 0:Me.elements.domReference,Le=[M,ht,...ge,...I(),j.current,U.current,ce.current,Te.current,ne?.beforeOutsideRef.current,ne?.afterOutsideRef.current,we.current.includes("reference")||J?C:null].filter(Gt=>Gt!=null),En=m||J?pw(Le,!pe,pe):pw(Le);return()=>{En()}},[r,C,M,m,we,ne,J,he,pe,Z,G,I]),Hi(()=>{if(r||!Dt(H))return;const xe=Wn(H),Me=wo(xe);queueMicrotask(()=>{const ge=re(H),Xe=je.current,ht=(typeof Xe=="number"?ge[Xe]:Xe.current)||H,Le=wn(H,Me);!ee&&!Le&&x&&go(ht,{preventScroll:ht===H})})},[r,x,H,ee,re,je]),Hi(()=>{if(r||!H)return;const xe=Wn(H),Me=wo(xe);K2(Me);function ge(Le){let{reason:En,event:Gt,nested:Vt}=Le;if(["hover","safe-polygon"].includes(En)&&Gt.type==="mouseleave"&&(L.current=!0),En==="outside-press")if(Vt)L.current=!1;else if(BD(Gt)||zD(Gt))L.current=!1;else{let Pn=!1;document.createElement("div").focus({get preventScroll(){return Pn=!0,!1}}),Pn?L.current=!1:L.current=!0}}_.on("openchange",ge);const Xe=xe.createElement("span");Xe.setAttribute("tabindex","-1"),Xe.setAttribute("aria-hidden","true"),Object.assign(Xe.style,Ay),q&&C&&C.insertAdjacentElement("afterend",Xe);function ht(){if(typeof be.current=="boolean"){const Le=C||gw();return Le&&Le.isConnected?Le:Xe}return be.current.current||Xe}return()=>{_.off("openchange",ge);const Le=wo(xe),En=wn(M,Le)||Z&&ko(Z.nodesRef.current,G(),!1).some(Vt=>{var Pn;return wn((Pn=Vt.context)==null?void 0:Pn.elements.floating,Le)}),Gt=ht();queueMicrotask(()=>{const Vt=q2(Gt);be.current&&!L.current&&Dt(Vt)&&(!(Vt!==Le&&Le!==xe.body)||En)&&Vt.focus({preventScroll:!0}),Xe.remove()})}},[r,M,H,be,k,_,Z,q,C,G]),N.useEffect(()=>(queueMicrotask(()=>{L.current=!1}),()=>{queueMicrotask(Ey)}),[r]),Hi(()=>{if(!r&&ne)return ne.setFocusManagerState({modal:m,closeOnFocusOut:g,open:x,onOpenChange:T,domReference:C}),()=>{ne.setFocusManagerState(null)}},[r,ne,m,x,T,g,C]),Hi(()=>{r||H&&vw(H,we)},[r,H,we]);function ni(xe){return r||!y||!m?null:F.jsx(P2,{ref:xe==="start"?j:U,onClick:Me=>T(!1,Me.nativeEvent),children:typeof y=="string"?y:"Dismiss"})}const Ti=!r&&he&&(m?!J:!0)&&(q||m);return F.jsxs(F.Fragment,{children:[Ti&&F.jsx(mw,{"data-type":"inside",ref:Rt,onFocus:xe=>{if(m){const ge=re();go(o[0]==="reference"?ge[0]:ge[ge.length-1])}else if(ne!=null&&ne.preserveTabOrder&&ne.portalNode)if(L.current=!1,nw(xe,ne.portalNode)){const ge=PD(C);ge?.focus()}else{var Me;(Me=ne.beforeOutsideRef.current)==null||Me.focus()}}}),!J&&ni("start"),n,ni("end"),Ti&&F.jsx(mw,{"data-type":"inside",ref:Je,onFocus:xe=>{if(m)go(re()[0]);else if(ne!=null&&ne.preserveTabOrder&&ne.portalNode)if(g&&(L.current=!0),nw(xe,ne.portalNode)){const ge=ID(C);ge?.focus()}else{var Me;(Me=ne.afterOutsideRef.current)==null||Me.focus()}}})]})}function bw(t){return Dt(t.target)&&t.target.tagName==="BUTTON"}function H2(t){return Dt(t.target)&&t.target.tagName==="A"}function Sw(t){return UT(t)}function F2(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:u}}=t,{enabled:c=!0,event:f="click",toggle:h=!0,ignoreMouse:m=!1,keyboardHandlers:y=!0,stickIfOpen:g=!0}=e,b=N.useRef(),S=N.useRef(!1),x=N.useMemo(()=>({onPointerDown(T){b.current=T.pointerType},onMouseDown(T){const _=b.current;T.button===0&&f!=="click"&&(tw(_)&&m||(n&&h&&(!(o.current.openEvent&&g)||o.current.openEvent.type==="mousedown")?r(!1,T.nativeEvent,"click"):(T.preventDefault(),r(!0,T.nativeEvent,"click"))))},onClick(T){const _=b.current;if(f==="mousedown"&&b.current){b.current=void 0;return}tw(_)&&m||(n&&h&&(!(o.current.openEvent&&g)||o.current.openEvent.type==="click")?r(!1,T.nativeEvent,"click"):r(!0,T.nativeEvent,"click"))},onKeyDown(T){b.current=void 0,!(T.defaultPrevented||!y||bw(T))&&(T.key===" "&&!Sw(u)&&(T.preventDefault(),S.current=!0),!H2(T)&&T.key==="Enter"&&r(!(n&&h),T.nativeEvent,"click"))},onKeyUp(T){T.defaultPrevented||!y||bw(T)||Sw(u)||T.key===" "&&S.current&&(S.current=!1,r(!(n&&h),T.nativeEvent,"click"))}}),[o,u,f,m,y,r,n,g,h]);return N.useMemo(()=>c?{reference:x}:{},[c,x])}const G2={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Y2={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},ww=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function J2(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:u}=t,{enabled:c=!0,escapeKey:f=!0,outsidePress:h=!0,outsidePressEvent:m="pointerdown",referencePress:y=!1,referencePressEvent:g="pointerdown",ancestorScroll:b=!1,bubbles:S,capture:x}=e,T=Ty(),_=ci(typeof h=="function"?h:()=>!1),k=typeof h=="function"?_:h,C=N.useRef(!1),{escapeKey:M,outsidePress:G}=ww(S),{escapeKey:I,outsidePress:ee}=ww(x),J=N.useRef(!1),X=ci(Z=>{var ne;if(!n||!c||!f||Z.key!=="Escape"||J.current)return;const j=(ne=u.current.floatingContext)==null?void 0:ne.nodeId,U=T?ko(T.nodesRef.current,j):[];if(!M&&(Z.stopPropagation(),U.length>0)){let L=!0;if(U.forEach(te=>{var oe;if((oe=te.context)!=null&&oe.open&&!te.context.dataRef.current.__escapeKeyBubbles){L=!1;return}}),!L)return}r(!1,jD(Z)?Z.nativeEvent:Z,"escape-key")}),he=ci(Z=>{var ne;const j=()=>{var U;X(Z),(U=kr(Z))==null||U.removeEventListener("keydown",j)};(ne=kr(Z))==null||ne.addEventListener("keydown",j)}),pe=ci(Z=>{var ne;const j=u.current.insideReactTree;u.current.insideReactTree=!1;const U=C.current;if(C.current=!1,m==="click"&&U||j||typeof k=="function"&&!k(Z))return;const L=kr(Z),te="["+Pc("inert")+"]",oe=Wn(o.floating).querySelectorAll(te);let E=yt(L)?L:null;for(;E&&!Fi(E);){const re=Yi(E);if(Fi(re)||!yt(re))break;E=re}if(oe.length&&yt(L)&&!$D(L)&&!wn(L,o.floating)&&Array.from(oe).every(re=>!wn(E,re)))return;if(Dt(L)&&be){const re=Fi(L),ce=qn(L),Te=/auto|scroll/,Rt=re||Te.test(ce.overflowX),Je=re||Te.test(ce.overflowY),ni=Rt&&L.clientWidth>0&&L.scrollWidth>L.clientWidth,Ti=Je&&L.clientHeight>0&&L.scrollHeight>L.clientHeight,xe=ce.direction==="rtl",Me=Ti&&(xe?Z.offsetX<=L.offsetWidth-L.clientWidth:Z.offsetX>L.clientWidth),ge=ni&&Z.offsetY>L.clientHeight;if(Me||ge)return}const q=(ne=u.current.floatingContext)==null?void 0:ne.nodeId,H=T&&ko(T.nodesRef.current,q).some(re=>{var ce;return rp(Z,(ce=re.context)==null?void 0:ce.elements.floating)});if(rp(Z,o.floating)||rp(Z,o.domReference)||H)return;const Q=T?ko(T.nodesRef.current,q):[];if(Q.length>0){let re=!0;if(Q.forEach(ce=>{var Te;if((Te=ce.context)!=null&&Te.open&&!ce.context.dataRef.current.__outsidePressBubbles){re=!1;return}}),!re)return}r(!1,Z,"outside-press")}),we=ci(Z=>{var ne;const j=()=>{var U;pe(Z),(U=kr(Z))==null||U.removeEventListener(m,j)};(ne=kr(Z))==null||ne.addEventListener(m,j)});N.useEffect(()=>{if(!n||!c)return;u.current.__escapeKeyBubbles=M,u.current.__outsidePressBubbles=G;let Z=-1;function ne(oe){r(!1,oe,"ancestor-scroll")}function j(){window.clearTimeout(Z),J.current=!0}function U(){Z=window.setTimeout(()=>{J.current=!1},mf()?5:0)}const L=Wn(o.floating);f&&(L.addEventListener("keydown",I?he:X,I),L.addEventListener("compositionstart",j),L.addEventListener("compositionend",U)),k&&L.addEventListener(m,ee?we:pe,ee);let te=[];return b&&(yt(o.domReference)&&(te=$r(o.domReference)),yt(o.floating)&&(te=te.concat($r(o.floating))),!yt(o.reference)&&o.reference&&o.reference.contextElement&&(te=te.concat($r(o.reference.contextElement)))),te=te.filter(oe=>{var E;return oe!==((E=L.defaultView)==null?void 0:E.visualViewport)}),te.forEach(oe=>{oe.addEventListener("scroll",ne,{passive:!0})}),()=>{f&&(L.removeEventListener("keydown",I?he:X,I),L.removeEventListener("compositionstart",j),L.removeEventListener("compositionend",U)),k&&L.removeEventListener(m,ee?we:pe,ee),te.forEach(oe=>{oe.removeEventListener("scroll",ne)}),window.clearTimeout(Z)}},[u,o,f,k,m,n,r,b,c,M,G,X,I,he,pe,ee,we]),N.useEffect(()=>{u.current.insideReactTree=!1},[u,k,m]);const je=N.useMemo(()=>({onKeyDown:X,...y&&{[G2[g]]:Z=>{r(!1,Z.nativeEvent,"reference-press")},...g!=="click"&&{onClick(Z){r(!1,Z.nativeEvent,"reference-press")}}}}),[X,r,y,g]),be=N.useMemo(()=>({onKeyDown:X,onMouseDown(){C.current=!0},onMouseUp(){C.current=!0},[Y2[m]]:()=>{u.current.insideReactTree=!0}}),[X,m,u]);return N.useMemo(()=>c?{reference:je,floating:be}:{},[c,je,be])}function X2(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=XT(),u=N.useRef({}),[c]=N.useState(()=>C2()),f=ZT()!=null,[h,m]=N.useState(r.reference),y=ci((S,x,T)=>{u.current.openEvent=S?x:void 0,c.emit("openchange",{open:S,event:x,reason:T,nested:f}),n?.(S,x,T)}),g=N.useMemo(()=>({setPositionReference:m}),[]),b=N.useMemo(()=>({reference:h||r.reference||null,floating:r.floating||null,domReference:r.reference}),[h,r.reference,r.floating]);return N.useMemo(()=>({dataRef:u,open:e,onOpenChange:y,elements:b,events:c,floatingId:o,refs:g}),[e,y,b,c,o,g])}function Z2(t){t===void 0&&(t={});const{nodeId:e}=t,n=X2({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[u,c]=N.useState(null),[f,h]=N.useState(null),y=o?.domReference||u,g=N.useRef(null),b=Ty();Hi(()=>{y&&(g.current=y)},[y]);const S=w2({...t,elements:{...o,...f&&{reference:f}}}),x=N.useCallback(M=>{const G=yt(M)?{getBoundingClientRect:()=>M.getBoundingClientRect(),getClientRects:()=>M.getClientRects(),contextElement:M}:M;h(G),S.refs.setReference(G)},[S.refs]),T=N.useCallback(M=>{(yt(M)||M===null)&&(g.current=M,c(M)),(yt(S.refs.reference.current)||S.refs.reference.current===null||M!==null&&!yt(M))&&S.refs.setReference(M)},[S.refs]),_=N.useMemo(()=>({...S.refs,setReference:T,setPositionReference:x,domReference:g}),[S.refs,T,x]),k=N.useMemo(()=>({...S.elements,domReference:y}),[S.elements,y]),C=N.useMemo(()=>({...S,...r,refs:_,elements:k,nodeId:e}),[S,_,k,e,r]);return Hi(()=>{r.dataRef.current.floatingContext=C;const M=b?.nodesRef.current.find(G=>G.id===e);M&&(M.context=C)}),N.useMemo(()=>({...S,context:C,refs:_,elements:k}),[S,_,k,C])}function cp(t,e,n){const r=new Map,o=n==="item";let u=t;if(o&&t){const{[lw]:c,[uw]:f,...h}=t;u=h}return{...n==="floating"&&{tabIndex:-1,[E2]:""},...u,...e.map(c=>{const f=c?c[n]:null;return typeof f=="function"?t?f(t):null:f}).concat(t).reduce((c,f)=>(f&&Object.entries(f).forEach(h=>{let[m,y]=h;if(!(o&&[lw,uw].includes(m)))if(m.indexOf("on")===0){if(r.has(m)||r.set(m,[]),typeof y=="function"){var g;(g=r.get(m))==null||g.push(y),c[m]=function(){for(var b,S=arguments.length,x=new Array(S),T=0;T<S;T++)x[T]=arguments[T];return(b=r.get(m))==null?void 0:b.map(_=>_(...x)).find(_=>_!==void 0)}}}else c[m]=y}),c),{})}}function Q2(t){t===void 0&&(t=[]);const e=t.map(f=>f?.reference),n=t.map(f=>f?.floating),r=t.map(f=>f?.item),o=N.useCallback(f=>cp(f,t,"reference"),e),u=N.useCallback(f=>cp(f,t,"floating"),n),c=N.useCallback(f=>cp(f,t,"item"),r);return N.useMemo(()=>({getReferenceProps:o,getFloatingProps:u,getItemProps:c}),[o,u,c])}const W2=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function eN(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:u,floatingId:c}=t,{enabled:f=!0,role:h="dialog"}=e,m=XT(),y=((n=u.domReference)==null?void 0:n.id)||m,g=N.useMemo(()=>{var C;return((C=im(u.floating))==null?void 0:C.id)||c},[u.floating,c]),b=(r=W2.get(h))!=null?r:h,x=ZT()!=null,T=N.useMemo(()=>b==="tooltip"||h==="label"?{["aria-"+(h==="label"?"labelledby":"describedby")]:o?g:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":b==="alertdialog"?"dialog":b,"aria-controls":o?g:void 0,...b==="listbox"&&{role:"combobox"},...b==="menu"&&{id:y},...b==="menu"&&x&&{role:"menuitem"},...h==="select"&&{"aria-autocomplete":"none"},...h==="combobox"&&{"aria-autocomplete":"list"}},[b,g,x,o,y,h]),_=N.useMemo(()=>{const C={id:g,...b&&{role:b}};return b==="tooltip"||h==="label"?C:{...C,...b==="menu"&&{"aria-labelledby":y}}},[b,g,y,h]),k=N.useCallback(C=>{let{active:M,selected:G}=C;const I={role:"option",...M&&{id:g+"-fui-option"}};switch(h){case"select":case"combobox":return{...I,"aria-selected":G}}return{}},[g,h]);return N.useMemo(()=>f?{reference:T,floating:_,item:k}:{},[f,T,_,k])}const El=t=>Array.isArray(t)?t:[t],tN=(t,e)=>{const n=[[],[]];for(const r of t)e(r)?n[0].push(r):n[1].push(r);return n},WT=Array,Ii=(t,e)=>t.includes(e),nN=(t,e=0)=>[...new Array(t)].map((n,r)=>r+e),Fe=(t,e,n)=>t===void 0?e===void 0?[]:Array.isArray(e)?e:[e]:(Array.isArray(e)?t.push(...e):t.push(e),t),ys=(t,e)=>e==null?t??[]:t==null?El(e):t.concat(e),iN=(...t)=>t.reduce(ys,[]),Ss=(t,e,n)=>{if(t===void 0)return Array.isArray(e)?e:[e];const r=n?.isEqual??((o,u)=>o===u);for(const o of El(e))t.some(u=>r(u,o))||t.push(o);return t},rN=(t,e)=>t.reduce((n,r)=>{const o=r[e];return n[o]=Fe(n[o],r),n},{}),Lo=(t,e,n)=>t.length===e.length&&t.every(n?.isEqual?(r,o)=>n.isEqual(r,e[o]):(r,o)=>r===e[o]),Cs=(t,e)=>ei(t)===e,ei=t=>{const e=typeof t;return e==="object"?t===null?"null":"object":e==="function"?"object":e},Ji={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},sN={...Ji,function:"a function"};class oN extends Error{}const _t=t=>Vo(t,oN),Vo=(t,e=Error)=>{throw new e(t)};class aN extends Error{name="ParseError"}const Y=t=>Vo(t,aN),eA=t=>` ${t}`,lN="​",Ge=(t,e)=>{const n={},r=Array.isArray(t);let o=!1;for(const[u,c]of Object.entries(t).entries()){const f=r?e(u,c[1]):e(...c,u);o||=typeof f[0]=="number";const h=Array.isArray(f[0])||f.length===0?f:[f];for(const[m,y]of h)typeof m=="object"?n[m.group]=Fe(n[m.group],y):n[m]=y}return o?Object.values(n):n},tA=Object.entries,Si=(t,e)=>t in e,Oy=(t,e)=>e in t;class uN{constructor(e){Object.assign(this,e)}}const cN=class{};class nA extends cN{}const fN=(t,e)=>{const n={},r={};let o;for(o in t)o in e?n[o]=t[o]:r[o]=t[o];return[n,r]},iA=(t,e)=>fN(t,e)[1],Ol=t=>Object.keys(t).length===0,Ic=t=>[...Object.entries(t),...Object.getOwnPropertySymbols(t).map(e=>[e,t[e]])],dN=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),hN=t=>{const e=Object.keys(t).sort(),n={};for(let r=0;r<e.length;r++)n[e[r]]=t[e[r]];return n},ui=eA(`unset${lN}`),pN=t=>Object.values(t).filter(e=>typeof e=="number"?!0:typeof t[e]!="number"),rA={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},sA=globalThis.File??Blob,oA={ArrayBuffer,Blob,File:sA,FormData,Headers,Request,Response,URL},mN={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},Uo={...rA,...oA,...mN,String,Number,Boolean},_y=t=>{let e=Object.getPrototypeOf(t);for(;e?.constructor&&(!Si(e.constructor.name,Uo)||!(t instanceof Uo[e.constructor.name]));)e=Object.getPrototypeOf(e);const n=e?.constructor?.name;if(!(n===void 0||n==="Object"))return n},rm=t=>typeof t=="object"&&t!==null?_y(t)??"object":ei(t),Xt=Array.isArray,yN={Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},gN={ArrayBuffer:"an ArrayBuffer instance",Blob:"a Blob instance",File:"a File instance",FormData:"a FormData instance",Headers:"a Headers instance",Request:"a Request instance",Response:"a Response instance",URL:"a URL instance"},vN={Int8Array:"an Int8Array",Uint8Array:"a Uint8Array",Uint8ClampedArray:"a Uint8ClampedArray",Int16Array:"an Int16Array",Uint16Array:"a Uint16Array",Int32Array:"an Int32Array",Uint32Array:"a Uint32Array",Float32Array:"a Float32Array",Float64Array:"a Float64Array",BigInt64Array:"a BigInt64Array",BigUint64Array:"a BigUint64Array"},bN={...yN,...gN,...vN},Ry=t=>{const e=Object(t).name??null;return e&&Si(e,Uo)&&Uo[e]===t?e:null},xw=(t,e)=>{let n=t.prototype;for(;n!==null;){if(n===e.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},SN=t=>aA(t,new Map),aA=(t,e)=>{if(typeof t!="object"||t===null)return t;if(e?.has(t))return e.get(t);const n=Ry(t.constructor);if(n==="Date")return new Date(t.getTime());if(n&&n!=="Array")return t;const r=Array.isArray(t)?t.slice():Object.create(Object.getPrototypeOf(t)),o=Object.getOwnPropertyDescriptors(t);if(e){e.set(t,r);for(const u in o){const c=o[u];"get"in c||"set"in c||(c.value=aA(c.value,e))}}return Object.defineProperties(r,o),r},wN=t=>{let e=ui;return()=>e===ui?e=t():e},wf=t=>typeof t=="function"&&t.length===0,xN=class extends Function{constructor(...t){const e=t.slice(0,-1),n=t[t.length-1];try{super(...e,n)}catch(r){return _t(`Encountered an unexpected error while compiling your definition:
22
- Message: ${r}
23
- Source: (${t.slice(0,-1)}) => {
24
- ${t[t.length-1]}
25
- }`)}}};class Hr{constructor(e,...[n]){return Object.assign(Object.setPrototypeOf(e.bind(n?.bind??this),this.constructor.prototype),n?.attach)}}const TN=wN(()=>{try{return new Function("return false")()}catch{return!0}});class wi{constructor(){}}var AN={};const EN=()=>{try{return((new Error().stack?.split(`
26
- `)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},ON=AN??{},_N={fileName:EN,env:ON},RN=t=>t[0].toUpperCase()+t.slice(1),kN=t=>t[0].toLowerCase()+t.slice(1),lA=t=>new RegExp(CN(t),typeof t=="string"?"":t.flags),CN=t=>`^(?:${typeof t=="string"?t:t.source})$`,Cr={negativeLookahead:t=>`(?!${t})`,nonCapturingGroup:t=>`(?:${t})`},tl="\\",xf={" ":1,"\n":1," ":1},MN=/^-0\.?0*$/.source,uA=/[1-9]\d*/.source,DN=/\.\d+/.source,NN=/\.\d*[1-9]/.source,cA=t=>lA(Cr.negativeLookahead(MN)+Cr.nonCapturingGroup("-?"+Cr.nonCapturingGroup(Cr.nonCapturingGroup("0|"+uA)+Cr.nonCapturingGroup(t.decimalPattern)+"?")+(t.allowDecimalOnly?"|"+t.decimalPattern:"")+"?")),Tw=cA({decimalPattern:NN,allowDecimalOnly:!1}),$N=Tw.test.bind(Tw),sm=cA({decimalPattern:DN,allowDecimalOnly:!0});sm.test.bind(sm);const jN=/^-?\d*\.?\d*$/,BN=t=>t.length!==0&&jN.test(t),Hc=lA(Cr.negativeLookahead("^-0$")+"-?"+Cr.nonCapturingGroup(Cr.nonCapturingGroup("0|"+uA))),zN=Hc.test.bind(Hc),om=/^-?\d+$/,LN=om.test.bind(om),fA={number:"a number",bigint:"a bigint",integer:"an integer"},dA=(t,e)=>`'${t}' was parsed as ${fA[e]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,VN=(t,e)=>e==="number"?$N(t):zN(t),UN=(t,e)=>e==="number"?Number(t):Number.parseInt(t),KN=(t,e)=>e==="number"?BN(t):LN(t),qN=(t,e)=>ky(t,"number",e),PN=(t,e)=>ky(t,"number",{...e,strict:!0}),IN=(t,e)=>ky(t,"integer",e),ky=(t,e,n)=>{const r=UN(t,e);return!Number.isNaN(r)&&KN(t,e)?n?.strict?VN(t,e)?r:Y(dA(t,e)):r:n?.errorOnFail?Y(n?.errorOnFail===!0?`Failed to parse ${fA[e]} from '${t}'`:n?.errorOnFail):void 0},HN=t=>{if(t[t.length-1]!=="n")return;const e=t.slice(0,-1);let n;try{n=BigInt(e)}catch{return}if(Hc.test(e))return n;if(om.test(e))return Y(dA(t,"bigint"))},FN="0.56.0",GN={version:FN,filename:_N.fileName(),FileConstructor:sA},_l=GN,Aw=new Map,fp=Object.create(null),am=t=>{const e=Aw.get(t);if(e)return e;let n=YN(t);return fp[n]?n=`${n}${fp[n]++}`:fp[n]=1,_l[n]=t,Aw.set(t,n),n},pl=t=>/^[$A-Z_a-z][\w$]*$/.test(t),YN=t=>{switch(typeof t){case"object":{if(t===null)break;const e=_y(t)??"object";return e[0].toLowerCase()+e.slice(1)}case"function":return pl(t.name)?t.name:"fn";case"symbol":return t.description&&pl(t.description)?t.description:"symbol"}return _t(`Unexpected attempt to register serializable value of type ${ei(t)}`)},Cy=t=>typeof t=="string"?JSON.stringify(t):typeof t=="bigint"?`${t}n`:`${t}`,JN=(t,e={})=>nl(t,{onUndefined:"$ark.undefined",onBigInt:n=>`$ark.bigint-${n}`,...e},[]),Ie=(t,e)=>{switch(ei(t)){case"object":const n=t,r=n.constructor?.name??"Object";return r==="Object"||r==="Array"?e?.quoteKeys===!1?Fc(n,e?.indent??0,""):JSON.stringify(nl(n,Ko,[]),null,e?.indent):Fc(n,e?.indent??0,"");case"symbol":return Ko.onSymbol(t);default:return Cy(t)}},Fc=(t,e,n)=>{if(typeof t=="function")return Ko.onFunction(t);if(typeof t!="object"||t===null)return Cy(t);const r=n+" ".repeat(e);if(Array.isArray(t)){if(t.length===0)return"[]";const u=t.map(c=>Fc(c,e,r)).join(`,
27
- `+r);return e?`[
28
- ${r}${u}
29
- ${n}]`:`[${u}]`}const o=t.constructor?.name??"Object";if(o==="Object"){const u=Ic(t).map(([c,f])=>{const h=typeof c=="symbol"?Ko.onSymbol(c):pl(c)?c:JSON.stringify(c),m=Fc(f,e,r);return`${r}${h}: ${m}`});return u.length===0?"{}":e?`{
30
- ${u.join(`,
31
- `)}
32
- ${n}}`:`{${u.join(", ")}}`}return t instanceof Date?Rl(t):"expression"in t&&typeof t.expression=="string"?t.expression:o},Ko={onCycle:()=>"(cycle)",onSymbol:t=>`Symbol(${am(t)})`,onFunction:t=>`Function(${am(t)})`},nl=(t,e,n)=>{switch(ei(t)){case"object":{const r=t;if("toJSON"in r&&typeof r.toJSON=="function")return r.toJSON();if(typeof r=="function")return Ko.onFunction(r);if(n.includes(r))return"(cycle)";const o=[...n,r];if(Array.isArray(r))return r.map(c=>nl(c,e,o));if(r instanceof Date)return r.toDateString();const u={};for(const c in r)u[c]=nl(r[c],e,o);for(const c of Object.getOwnPropertySymbols(r))u[e.onSymbol?.(c)??c.toString()]=nl(r[c],e,o);return u}case"symbol":return Ko.onSymbol(t);case"bigint":return e.onBigInt?.(t)??`${t}n`;case"undefined":return e.onUndefined??"undefined";case"string":return t.replace(/\\/g,"\\\\");default:return t}},Rl=t=>{const e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),o=t.getHours(),u=t.getMinutes(),c=t.getSeconds(),f=t.getMilliseconds();if(n===0&&r===1&&o===0&&u===0&&c===0&&f===0)return`${e}`;const h=`${XN[n]} ${r}, ${e}`;if(o===0&&u===0&&c===0&&f===0)return h;let m=t.toLocaleTimeString();const y=m.endsWith(" AM")||m.endsWith(" PM")?m.slice(-3):"";return y&&(m=m.slice(0,-y.length)),f?m+=`.${QN(f,3)}`:ZN.test(m)&&(m=m.slice(0,-3)),`${m+y}, ${h}`},XN=["January","February","March","April","May","June","July","August","September","October","November","December"],ZN=/:\d\d:00$/,QN=(t,e)=>String(t).padStart(e,"0"),hA=(t,e,...[n])=>{const r=n?.stringifySymbol??Ie;let o=t;switch(typeof e){case"string":o=pl(e)?t===""?e:`${t}.${e}`:`${t}[${JSON.stringify(e)}]`;break;case"number":o=`${t}[${e}]`;break;case"symbol":o=`${t}[${r(e)}]`;break;default:n?.stringifyNonKey?o=`${t}[${n.stringifyNonKey(e)}]`:Y(`${Ie(e)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return o},kl=(t,...e)=>t.reduce((n,r)=>hA(n,r,...e),"");class pA extends WT{cache={};constructor(...e){super(),this.push(...e)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let e=0;e<this.length;e++)this.cache.json.push(typeof this[e]=="symbol"?Ie(this[e]):this[e]);return this.cache.json}stringify(){return this.cache.stringify?this.cache.stringify:this.cache.stringify=kl(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let e="";const n=[e];for(const r of this)e=hA(e,r),n.push(e);return this.cache.stringifyAncestors=n}}class mA{chars;i;def;constructor(e){this.def=e,this.chars=[...e],this.i=0}shift(){return this.chars[this.i++]??""}get lookahead(){return this.chars[this.i]??""}get nextLookahead(){return this.chars[this.i+1]??""}get length(){return this.chars.length}shiftUntil(e){let n="";for(;this.lookahead&&!e(this,n);)n+=this.shift();return n}shiftUntilEscapable(e){let n="";for(;this.lookahead;)if(this.lookahead===tl)this.shift(),e(this,n)?n+=this.shift():this.lookahead===tl?n+=this.shift():n+=`${tl}${this.shift()}`;else{if(e(this,n))break;n+=this.shift()}return n}shiftUntilLookahead(e){return typeof e=="string"?this.shiftUntil(n=>n.lookahead===e):this.shiftUntil(n=>n.lookahead in e)}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in xf))}jumpToIndex(e){this.i=e<0?this.length+e:e}jumpForward(e){this.i+=e}get location(){return this.i}get unscanned(){return this.chars.slice(this.i,this.length).join("")}get scanned(){return this.chars.slice(0,this.i).join("")}sliceChars(e,n){return this.chars.slice(e,n).join("")}lookaheadIs(e){return this.lookahead===e}lookaheadIsIn(e){return this.lookahead in e}}const WN=(t,e)=>`Unmatched ${t}${e===""?"":` before ${e}`}`,yA=t=>`Missing ${t}`;let lm="$ark",e$=2;for(;lm in globalThis;)lm=`$ark${e$++}`;const gA=lm;globalThis[gA]=_l;const W=_l,t$=t=>`${gA}.${t}`,en=t=>t$(am(t));class vA extends nA{argNames;body="";constructor(...e){super(),this.argNames=e;for(const n of e){if(n in this)throw new Error(`Arg name '${n}' would overwrite an existing property on FunctionBody`);this[n]=n}}indentation=0;indent(){return this.indentation+=4,this}dedent(){return this.indentation-=4,this}prop(e,n=!1){return bA(e,n)}index(e,n=!1){return SA(`${e}`,n)}line(e){return this.body+=`${" ".repeat(this.indentation)}${e}
33
- `,this}const(e,n){return this.line(`const ${e} = ${n}`),this}let(e,n){return this.line(`let ${e} = ${n}`)}set(e,n){return this.line(`${e} = ${n}`)}if(e,n){return this.block(`if (${e})`,n)}elseIf(e,n){return this.block(`else if (${e})`,n)}else(e){return this.block("else",e)}for(e,n,r=0){return this.block(`for (let i = ${r}; ${e}; i++)`,n)}forIn(e,n){return this.block(`for (const k in ${e})`,n)}block(e,n,r=""){return this.line(`${e} {`),this.indent(),n(this),this.dedent(),this.line(`}${r}`)}return(e=""){return this.line(`return ${e}`)}write(e="anonymous",n=0){return`${e}(${this.argNames.join(", ")}) { ${n?this.body.split(`
34
- `).map(r=>" ".repeat(n)+`${r}`).join(`
35
- `):this.body} }`}compile(){return new xN(...this.argNames,this.body)}}const Fo=t=>Cs(t,"object")||typeof t=="symbol"?en(t):Cy(t),bA=(t,e=!1)=>typeof t=="string"&&pl(t)?`${e?"?":""}.${t}`:SA(n$(t),e),n$=t=>typeof t=="symbol"?en(t):JSON.stringify(t),SA=(t,e=!1)=>`${e?"?.":""}[${t}]`;class dp extends vA{traversalKind;optimistic;constructor(e){super("data","ctx"),this.traversalKind=e.kind,this.optimistic=e.optimistic===!0}invoke(e,n){const r=n?.arg??this.data,o=typeof e=="string"?!0:this.requiresContextFor(e),u=typeof e=="string"?e:e.id;return o?`${this.referenceToId(u,n)}(${r}, ${this.ctx})`:`${this.referenceToId(u,n)}(${r})`}referenceToId(e,n){const r=n?.kind??this.traversalKind,o=`this.${e}${r}`;return n?.bind?`${o}.bind(${n?.bind})`:o}requiresContextFor(e){return this.traversalKind==="Apply"||e.allowsRequiresContext}initializeErrorCount(){return this.const("errorCount","ctx.currentErrorCount")}returnIfFail(){return this.if("ctx.currentErrorCount > errorCount",()=>this.return())}returnIfFailFast(){return this.if("ctx.failFast && ctx.currentErrorCount > errorCount",()=>this.return())}traverseKey(e,n,r){const o=this.requiresContextFor(r);return o&&this.line(`${this.ctx}.path.push(${e})`),this.check(r,{arg:n}),o&&this.line(`${this.ctx}.path.pop()`),this}check(e,n){return this.traversalKind==="Allows"?this.if(`!${this.invoke(e,n)}`,()=>this.return(!1)):this.line(this.invoke(e,n))}}const wA=t=>Ge(t,(e,n)=>[e,Xt(n)?[...n]:n]),Xi=eA("arkKind"),fe=(t,e)=>t?.[Xi]===e,Qt=t=>fe(t,"root")||fe(t,"constraint"),i$=["unit","proto","domain"],Tf=["required","optional","index","sequence"],xA=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],TA=[...xA,"structure","predicate"],My=[...TA,...Tf],Af=["alias","union","morph","unit","intersection","proto","domain"],r$=[...Af,...My],AA=Ge(My,(t,e)=>[e,1]),s$=Ge([...Tf,"undeclared"],(t,e)=>[e,1]),EA=Ge(r$,(t,e)=>[e,t]),wc=t=>typeof t=="string"&&t in EA,Gc=t=>EA[t],Dy=t=>Af.slice(Gc(t)+1);[...Dy("union")];[...Dy("morph")];const Os=t=>typeof t=="string"||typeof t=="boolean"||t===null?t:typeof t=="number"?Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t:Fo(t),Ef=t=>{let e="{ ";for(const[n,r]of Object.entries(t))e+=`${n}: ${Fo(r)}, `;return e+" }"},dt=t=>{const e=t;return e.hasAssociatedError&&(e.defaults.expected??=n=>"description"in n?n.description:e.defaults.description(n),e.defaults.actual??=n=>Ie(n),e.defaults.problem??=n=>`must be ${n.expected}${n.actual?` (was ${n.actual})`:""}`,e.defaults.message??=n=>{if(n.path.length===0)return n.problem;const r=`${n.propString} ${n.problem}`;return r[0]==="["?`value at ${r}`:r}),e};class o$ extends Error{name="ToJsonSchemaError";code;context;constructor(e,n){super(Ie(n,{quoteKeys:!1,indent:4})),this.code=e,this.context=n}hasCode(e){return this.code===e}}const a$={target:"draft-2020-12",dialect:"https://json-schema.org/draft/2020-12/schema",useRefs:!1,fallback:{arrayObject:t=>Mt.throw("arrayObject",t),arrayPostfix:t=>Mt.throw("arrayPostfix",t),defaultValue:t=>Mt.throw("defaultValue",t),domain:t=>Mt.throw("domain",t),morph:t=>Mt.throw("morph",t),patternIntersection:t=>Mt.throw("patternIntersection",t),predicate:t=>Mt.throw("predicate",t),proto:t=>Mt.throw("proto",t),symbolKey:t=>Mt.throw("symbolKey",t),unit:t=>Mt.throw("unit",t),date:t=>Mt.throw("date",t)}},Mt={Error:o$,throw:(...t)=>{throw new Mt.Error(...t)},throwInternalOperandError:(t,e)=>_t(`Unexpected JSON Schema input for ${t}: ${Ie(e)}`),defaultConfig:a$};W.config??={};const um=(t,e)=>{if(!e)return t;const n={...t};let r;for(r in e){const o={...t.keywords};if(r==="keywords"){for(const u in e[r]){const c=e.keywords[u];c!==void 0&&(o[u]=typeof c=="string"?{description:c}:c)}n.keywords=o}else r==="toJsonSchema"?n[r]=OA(t.toJsonSchema,e.toJsonSchema):wc(r)?n[r]={...t[r],...e[r]}:n[r]=e[r]}return n},l$={"draft-2020-12":"https://json-schema.org/draft/2020-12/schema","draft-07":"http://json-schema.org/draft-07/schema#"},OA=((t,e)=>{if(!t)return Ew(e??{},void 0);if(!e)return t;const n={...t};let r;for(r in e)r==="fallback"?n.fallback=u$(t.fallback,e.fallback):n[r]=e[r];return Ew(n,e)}),Ew=(t,e)=>e?.dialect!==void 0?t:e?.target!==void 0?{...t,dialect:l$[e.target]}:t,u$=(t,e)=>{t=Ow(t),e=Ow(e);const n={};let r;for(r in Mt.defaultConfig.fallback)n[r]=e[r]??e.default??t[r]??t.default??Mt.defaultConfig.fallback[r];return n},Ow=t=>typeof t=="function"?{default:t}:t??{};class qo extends nA{[Xi]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:e,relativePath:n,...r},o){super(),this.input=r,this.ctx=o,dN(this,r);const u=o.data;r.code==="union"&&(r.errors=r.errors.flatMap(f=>{const h=f.hasCode("union")?f.errors:[f];return!e&&!n?h:h.map(m=>m.transform(y=>({...y,path:iN(e,y.path,n)})))})),this.nodeConfig=o.config[this.code];const c=[...r.path??o.path];n&&c.push(...n),e&&c.unshift(...e),this.path=new pA(...c),this.data="data"in r?r.data:u}transform(e){return new qo(e({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(e){return this.code===e}get propString(){return kl(this.path)}get expected(){if(this.input.expected)return this.input.expected;const e=this.meta?.expected??this.nodeConfig.expected;return typeof e=="function"?e(this.input):e}get actual(){if(this.input.actual)return this.input.actual;const e=this.meta?.actual??this.nodeConfig.actual;return typeof e=="function"?e(this.data):e}get problem(){if(this.input.problem)return this.input.problem;const e=this.meta?.problem??this.nodeConfig.problem;return typeof e=="function"?e(this):e}get message(){if(this.input.message)return this.input.message;const e=this.meta?.message??this.nodeConfig.message;return typeof e=="function"?e(this):e}get flat(){return this.hasCode("intersection")?[...this.errors]:[this]}toJSON(){return{data:this.data,path:this.path,...this.input,expected:this.expected,actual:this.actual,problem:this.problem,message:this.message}}toString(){return this.message}throw(){throw this}}class Lr extends WT{[Xi]="errors";ctx;constructor(e){super(),this.ctx=e}byPath=Object.create(null);get flatByPath(){return Ge(this.byPath,(e,n)=>[e,n.flat])}get flatProblemsByPath(){return Ge(this.byPath,(e,n)=>[e,n.flat.map(r=>r.problem)])}byAncestorPath=Object.create(null);count=0;mutable=this;throw(){throw this.toTraversalError()}toTraversalError(){return new c$(this)}add(e){const n=this.byPath[e.propString];if(n){if(e===n||n.hasCode("union")&&n.errors.length===0)return;const r=e.hasCode("union")&&e.errors.length===0?e:new qo({code:"intersection",errors:n.hasCode("intersection")?[...n.errors,e]:[n,e]},this.ctx),o=this.indexOf(n);this.mutable[o===-1?this.length:o]=r,this.byPath[e.propString]=r,this.addAncestorPaths(e)}else this.byPath[e.propString]=e,this.addAncestorPaths(e),this.mutable.push(e);this.count++}transform(e){const n=new Lr(this.ctx);for(const r of this)n.add(e(r));return n}merge(e){for(const n of e)this.add(new qo({...n,path:[...this.ctx.path,...n.path]},this.ctx))}affectsPath(e){return this.length===0?!1:e.stringifyAncestors().some(n=>n in this.byPath)||e.stringify()in this.byAncestorPath}get summary(){return this.toString()}get issues(){return this}toJSON(){return[...this.map(e=>e.toJSON())]}toString(){return this.join(`
36
- `)}addAncestorPaths(e){for(const n of e.path.stringifyAncestors())this.byAncestorPath[n]=Fe(this.byAncestorPath[n],e)}}class c$ extends Error{name="TraversalError";constructor(e){e.length===1?super(e.summary):super(`
37
- `+e.map(n=>` • ${f$(n)}`).join(`
38
- `)),Object.defineProperty(this,"arkErrors",{value:e,enumerable:!1})}}const f$=t=>t.toString().split(`
39
- `).join(`
40
- `);class To{path=[];errors=new Lr(this);root;config;queuedMorphs=[];branches=[];seen={};constructor(e,n){this.root=e,this.config=n}get data(){let e=this.root;for(const n of this.path)e=e?.[n];return e}get propString(){return kl(this.path)}reject(e){return this.error(e),!1}mustBe(e){return this.error(e),!1}error(e){const n=typeof e=="object"?e.code?e:{...e,code:"predicate"}:{code:"predicate",expected:e};return this.errorFromContext(n)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches[this.branches.length-1]}queueMorphs(e){const n={path:new pA(...this.path),morphs:e};this.currentBranch?this.currentBranch.queuedMorphs.push(n):this.queuedMorphs.push(n)}finalize(e){return this.queuedMorphs.length&&(typeof this.root=="object"&&this.root!==null&&this.config.clone&&(this.root=this.config.clone(this.root)),this.applyQueuedMorphs()),this.hasError()?e?e(this.errors):this.errors:this.root}get currentErrorCount(){return this.currentBranch?this.currentBranch.error?1:0:this.errors.count}get failFast(){return this.branches.length!==0}pushBranch(){this.branches.push({error:void 0,queuedMorphs:[]})}popBranch(){return this.branches.pop()}get external(){return this}errorFromNodeContext(e){return this.errorFromContext(e)}errorFromContext(e){const n=new qo(e,this);return this.currentBranch?this.currentBranch.error=n:this.errors.add(n),n}applyQueuedMorphs(){for(;this.queuedMorphs.length;){const e=this.queuedMorphs;this.queuedMorphs=[];for(const{path:n,morphs:r}of e)this.errors.affectsPath(n)||this.applyMorphsAtPath(n,r)}}applyMorphsAtPath(e,n){const r=e[e.length-1];let o;if(r!==void 0){o=this.root;for(let u=0;u<e.length-1;u++)o=o[e[u]]}for(const u of n){this.path=[...e];const c=Qt(u),f=u(o===void 0?this.root:o[r],this);if(f instanceof qo){this.errors.includes(f)||this.errors.add(f);break}if(f instanceof Lr){c||this.errors.merge(f),this.queuedMorphs=[];break}o===void 0?this.root=f:o[r]=f,this.applyQueuedMorphs()}}}const Zi=(t,e,n)=>{if(!n)return e();n.path.push(t);const r=e();return n.path.pop(),r};class _A extends Hr{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor(e,n){super((o,u,c=this.onFail)=>u?(this.traverseApply(o,u),u.hasError()?u.errors:u.data):this.rootApply(o,c),{attach:e}),this.attachments=e,this.$=n,this.onFail=this.meta.onFail??this.$.resolvedConfig.onFail,this.includesTransform=this.hasKind("morph")||this.hasKind("structure")&&this.structuralMorph!==void 0||this.hasKind("sequence")&&this.inner.defaultables!==void 0,this.includesContextualPredicate=this.hasKind("predicate")&&this.inner.predicate.length!==1,this.isCyclic=this.kind==="alias",this.referencesById={[this.id]:this},this.shallowReferences=this.hasKind("structure")?[this,...this.children]:this.children.reduce((o,u)=>m$(o,u.shallowReferences),[this]);const r=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let o=0;o<this.children.length;o++){if(this.includesTransform||=this.children[o].includesTransform,this.includesContextualPredicate||=this.children[o].includesContextualPredicate,this.isCyclic||=this.children[o].isCyclic,!r){const u=this.children[o].flatRefs;for(let c=0;c<u.length;c++){const f=u[c];if(!this.flatRefs.some(h=>RA(h,f))){this.flatRefs.push(f);for(const h of f.node.branches)(h.hasKind("morph")||h.hasKind("intersection")&&h.structure?.structuralMorph!==void 0)&&this.flatMorphs.push({path:f.path,propString:f.propString,node:h})}}}Object.assign(this.referencesById,this.children[o].referencesById)}this.flatRefs.sort((o,u)=>o.path.length>u.path.length?1:o.path.length<u.path.length?-1:o.propString>u.propString?1:o.propString<u.propString||o.node.expression<u.node.expression?-1:1),this.allowsRequiresContext=this.includesContextualPredicate||this.isCyclic,this.rootApplyStrategy=!this.allowsRequiresContext&&this.flatMorphs.length===0?this.shallowMorphs.length===0?"allows":this.shallowMorphs.every(o=>o.length===1||o.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some(o=>o.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?o=>this.traverseAllows(o,new To(o,this.$.resolvedConfig)):o=>this.traverseAllows(o)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(n,r)=>{if(this.allows(n))return n;const o=new To(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"contextual":return(n,r)=>{const o=new To(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];const e=this.$.resolvedConfig.clone;return(n,r)=>{if(this.allows(n))return this.contextFreeMorph(e&&(typeof n=="object"&&n!==null||typeof n=="function")?e(n):n);const o=new To(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,_t(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=p$(this.metaJson);cacheGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}get description(){return this.cacheGetter("description",this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=Gc(this.kind);precompilation;assert=(e,n)=>this(e,n,r=>r.throw());traverse(e,n){return this(e,n,null)}get in(){return this.cacheGetter("in",this.rawIn.isRoot()?this.$.finalize(this.rawIn):this.rawIn)}get rawIn(){return this.cacheGetter("rawIn",this.getIo("in"))}get out(){return this.cacheGetter("out",this.rawOut.isRoot()?this.$.finalize(this.rawOut):this.rawOut)}get rawOut(){return this.cacheGetter("rawOut",this.getIo("out"))}getIo(e){if(!this.includesTransform)return this;const n={};for(const[r,o]of this.innerEntries){const u=this.impl.keys[r];if(u.reduceIo)u.reduceIo(e,n,o);else if(u.child){const c=o;n[r]=Xt(c)?c.map(f=>e==="in"?f.rawIn:f.rawOut):e==="in"?c.rawIn:c.rawOut}else n[r]=o}return this.$.node(this.kind,n)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals(e){const n=Qt(e)?e:this.$.parseDefinition(e);return this.innerHash===n.innerHash}ifEquals(e){return this.equals(e)?this:void 0}hasKind(e){return this.kind===e}assertHasKind(e){return this.kind!==e&&Vo(`${this.kind} node was not of asserted kind ${e}`),this}hasKindIn(...e){return e.includes(this.kind)}assertHasKindIn(...e){return Ii(e,this.kind)||Vo(`${this.kind} node was not one of asserted kinds ${e}`),this}isBasis(){return Ii(i$,this.kind)}isConstraint(){return Ii(My,this.kind)}isStructural(){return Ii(Tf,this.kind)}isRefinement(){return Ii(TA,this.kind)}isRoot(){return Ii(Af,this.kind)}isUnknown(){return this.hasKind("intersection")&&this.children.length===0}isNever(){return this.hasKind("union")&&this.children.length===0}hasUnit(e){return this.hasKind("unit")&&this.allows(e)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select(e){const n=Za.normalize(e);return this._select(n)}_select(e){let n=Za.applyBoundary[e.boundary??"references"](this);return e.kind&&(n=n.filter(r=>r.kind===e.kind)),e.where&&(n=n.filter(e.where)),Za.applyMethod[e.method??"filter"](n,this,e)}transform(e,n){return this._transform(e,this._createTransformContext(n))}_createTransformContext(e){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:e?.prereduced??!1},undeclaredKeyHandling:void 0,...e}}_transform(e,n){const r=n.bindScope??this.$;if(n.seen[this.id])return this.$.lazilyResolve(n.seen[this.id]);if(n.shouldTransform?.(this,n)===!1)return this;let o;n.seen[this.id]=()=>o,this.hasKind("structure")&&this.undeclared!==n.undeclaredKeyHandling&&(n={...n,undeclaredKeyHandling:this.undeclared});const u=Ge(this.inner,(y,g)=>{if(!this.impl.keys[y].child)return[y,g];const b=g;if(!Xt(b)){const x=b._transform(e,n);return x?[y,x]:[]}if(b.length===0)return[y,g];const S=b.flatMap(x=>x._transform(e,n)??[]);return S.length?[y,S]:[]});delete n.seen[this.id];const c=Object.assign(u,{meta:this.meta}),f=n.selected&&!n.selected.includes(this)?c:e(this.kind,c,n);if(f===null)return null;if(Qt(f))return o=f;const h=Object.keys(f);return(h.length===0||h.length===1&&h[0]==="meta")&&!Ol(this.inner)?null:(this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in f)?n.undeclaredKeyHandling?{...f,value:W.intrinsic.unknown}:null:(this.kind==="morph"&&(f.in??=W.intrinsic.unknown),o=r.node(this.kind,f,n.parseOptions))}configureReferences(e,n="references"){const r=Za.normalize(n),o=typeof e=="string"?(h,m)=>({...m,meta:{...m.meta,description:e}}):typeof e=="function"?(h,m)=>({...m,meta:e(m.meta)}):(h,m)=>({...m,meta:{...m.meta,...e}});if(r.boundary==="self")return this.$.node(this.kind,o(this.kind,{...this.inner,meta:this.meta}));const u=this._select(r),c=u&&El(u),f=r.boundary==="child"?(h,m)=>m.root.children.includes(h):r.boundary==="shallow"?h=>h.kind!=="structure":()=>!0;return this.$.finalize(this.transform(o,{shouldTransform:f,selected:c}))}}const Za={applyBoundary:{self:t=>[t],child:t=>[...t.children],shallow:t=>[...t.shallowReferences],references:t=>[...t.references]},applyMethod:{filter:t=>t,assertFilter:(t,e,n)=>(t.length===0&&Vo(_w(e,n)),t),find:t=>t[0],assertFind:(t,e,n)=>(t.length===0&&Vo(_w(e,n)),t[0])},normalize:t=>typeof t=="function"?{boundary:"references",method:"filter",where:t}:typeof t=="string"?Si(t,Za.applyBoundary)?{method:"filter",boundary:t}:{boundary:"references",method:"filter",kind:t}:{boundary:"references",method:"filter",...t}},_w=(t,e)=>`${t} had no references matching ${Ie(e)}.`,d$=t=>kl(t,{stringifyNonKey:e=>e.expression}),h$=/"(\$ark\.[^"]+)"/g,p$=t=>JSON.stringify(t).replace(h$,"$1"),Nr=(t,e)=>({path:t,node:e,propString:d$(t)}),RA=(t,e)=>t.propString===e.propString&&t.node.equals(e.node),Rw=(t,e)=>Ss(t,e,{isEqual:RA}),m$=(t,e)=>Ss(t,e,{isEqual:(n,r)=>n.equals(r)});class ae extends Array{static init(e,n,r,o){return new ae({kind:e,l:n,r,path:o?.path??[],optional:o?.optional??!1})}add(e,n,r,o){return this.push({kind:e,l:n,r,path:o?.path??[],optional:o?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){const{path:e,l:n,r}=this[0],o=kl(e);return kA(`Intersection${o&&` at ${o}`} of ${kw(n,r)}`)}return`The following intersections result in unsatisfiable types:
41
- • ${this.map(({path:e,l:n,r})=>`${e}: ${kw(n,r)}`).join(`
42
- • `)}`}throw(){return Y(this.describeReasons())}invert(){const e=this.map(n=>({...n,l:n.r,r:n.l}));return e instanceof ae?e:new ae(...e)}withPrefixKey(e,n){return this.map(r=>({...r,path:[e,...r.path],optional:r.optional||n==="optional"}))}toNeverIfDisjoint(){return W.intrinsic.never}}const kw=(t,e)=>`${cm(t)} and ${cm(e)}`,cm=t=>Qt(t)?t.expression:Xt(t)?t.map(cm).join(" | ")||"never":String(t),kA=t=>`${t} results in an unsatisfiable type`,vo={},Qi=(t,e,n)=>Bt(t,e,{$:n,invert:!1,pipe:!1}),fm=(t,e,n)=>Bt(t,e,{$:n,invert:!1,pipe:!0}),Bt=((t,e,n)=>{const r=n.pipe?"|>":"&",o=`${t.hash}${r}${e.hash}`;if(vo[o]!==void 0)return vo[o];if(!n.pipe){const f=`${e.hash}${r}${t.hash}`;if(vo[f]!==void 0){const h=vo[f],m=h instanceof ae?h.invert():h;return vo[o]=m,m}}const u=!n.pipe||!t.includesTransform&&!e.includesTransform;if(u&&t.equals(e))return t;let c=u?dm(t,e,n):t.hasKindIn(...Af)?y$(t,e,n):dm(t,e,n);return Qt(c)&&(t.equals(c)?c=t:e.equals(c)&&(c=e)),vo[o]=c,c}),dm=(t,e,n)=>{const r=t.precedence<e.precedence?t.kind:e.kind,o=t.impl.intersections[e.kind]??e.impl.intersections[t.kind];if(o===void 0)return null;if(r===t.kind)return o(t,e,n);{let u=o(e,t,{...n,invert:!n.invert});return u instanceof ae&&(u=u.invert()),u}},y$=(t,e,n)=>t.includesTransform||e.includesTransform?n.invert?Cw(e,t,n):Cw(t,e,n):dm(t,e,n),Cw=(t,e,n)=>t.distribute(r=>g$(r,e,n),r=>{const o=r.filter(Qt);if(o.length===0)return ae.init("union",t.branches,e.branches);if(o.length<t.branches.length||!t.branches.every((c,f)=>c.rawIn.equals(o[f].rawIn)))return n.$.parseSchema(o);if(o.length===1)return o[0];const u={branches:o};return n.$.parseSchema(u)}),g$=(t,e,n)=>{if(t.hasKind("morph")){const o=[...t.morphs];if(t.lastMorphIfNode){const u=Bt(t.lastMorphIfNode,e,n);if(u instanceof ae)return u;o[o.length-1]=u}else o.push(e);return n.$.node("morph",{morphs:o,in:t.inner.in})}if(e.hasKind("morph")){const o=Bt(t,e.rawIn,n);return o instanceof ae?o:n.$.node("morph",{morphs:[e],in:o})}return n.$.node("morph",{morphs:[e],in:t})};class Go extends _A{constructor(e,n){super(e,n),Object.defineProperty(this,Xi,{value:"constraint",enumerable:!1})}impliedSiblings;intersect(e){return Qi(this,e,this.$)}}class Of extends Go{traverseApply=(e,n)=>{this.traverseAllows(e,n)||n.errorFromNodeContext(this.errorContext)};compile(e){e.traversalKind==="Allows"?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return Ef(this.errorContext)}}const un=t=>(e,n)=>{if(Xt(e)){if(e.length===0)return;const o=e.map(u=>n.$.node(t,u));return t==="predicate"?o:o.sort((u,c)=>u.hash<c.hash?-1:1)}const r=n.$.node(t,e);return r.hasOpenIntersection()?[r]:r},Yc=t=>{const e=t.r.shift();if(!e){let r=t.l.length===0&&t.kind==="structure"?W.intrinsic.unknown.internal:t.ctx.$.node(t.kind,Object.assign(t.baseInner,v$(t.l)),{prereduced:!0});for(const o of t.roots){if(r instanceof ae)return r;r=Bt(o,r,t.ctx)}return r}let n=!1;for(let r=0;r<t.l.length;r++){const o=Bt(t.l[r],e,t.ctx);if(o!==null){if(o instanceof ae)return o;if(o.isRoot())return t.roots.push(o),t.l.splice(r),Yc(t);if(!n)t.l[r]=o,n=!0;else if(!t.l.includes(o))return _t(`Unexpectedly encountered multiple distinct intersection results for refinement ${e}`)}}if(n||t.l.push(e),t.kind==="intersection"&&e.impliedSiblings)for(const r of e.impliedSiblings)Ss(t.r,r);return Yc(t)},Jc=t=>Object.entries(t).flatMap(([n,r])=>n in AA?r:[]).sort((n,r)=>n.precedence<r.precedence?-1:n.precedence>r.precedence?1:n.kind==="predicate"&&r.kind==="predicate"?0:n.hash<r.hash?-1:1),v$=t=>{const e={};for(const n of t)if(n.hasOpenIntersection())e[n.kind]=Fe(e[n.kind],n);else{if(e[n.kind])return _t(`Unexpected intersection of closed refinements of kind ${n.kind}`);e[n.kind]=n}return e},b$=(...t)=>Y(S$(...t)),S$=(t,e,n)=>{const r=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(e).defaultShortDescription;return`${RN(t)} operand must be ${e.description} (was ${r})`},w$=(t,e,n)=>new Xc(t,e,n,n,null);class CA extends Hr{}class Xc extends Hr{[Xi]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor(e,n,r,o,u){super((...c)=>{const f=Ge(this.names,(h,m)=>{const y=this.arg$.parse(c[h]);return y.extends(this.constraints[h])||Y(x$(m,this.constraints[h].expression,y.expression)),[m,y]});if(this.defIsLazy()){const h=this.bodyDef(f);return this.$.parse(h)}return this.$.parse(n,{args:f})}),this.paramDefs=e,this.bodyDef=n,this.$=r,this.arg$=o,this.hkt=u,this.description=u?new u().description??`a generic type for ${u.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof CA}cacheGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}get json(){return this.cacheGetter("json",{params:this.params.map(e=>e[1].isUnknown()?e[0]:[e[0],e[1].json]),body:JN(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(e=>typeof e=="string"?[e,W.intrinsic.unknown]:[e[0],this.$.parse(e[1])]))}get names(){return this.cacheGetter("names",this.params.map(e=>e[0]))}get constraints(){return this.cacheGetter("constraints",this.params.map(e=>e[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}}const x$=(t,e,n)=>`${t} must be assignable to ${e} (was ${n})`,T$=dt({kind:"predicate",hasAssociatedError:!0,collapsibleKey:"predicate",keys:{predicate:{}},normalize:t=>typeof t=="function"?{predicate:t}:t,defaults:{description:t=>`valid according to ${t.predicate.name||"an anonymous predicate"}`},intersectionIsOpen:!0,intersections:{predicate:()=>null}});class A$ extends Go{serializedPredicate=en(this.predicate);compiledCondition=`${this.serializedPredicate}(data, ctx)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=null;expression=this.serializedPredicate;traverseAllows=this.predicate;errorContext={code:"predicate",description:this.description,meta:this.meta};compiledErrorContext=Ef(this.errorContext);traverseApply=(e,n)=>{const r=n.currentErrorCount;!this.predicate(e,n.external)&&n.currentErrorCount===r&&n.errorFromNodeContext(this.errorContext)};compile(e){if(e.traversalKind==="Allows"){e.return(this.compiledCondition);return}e.initializeErrorCount(),e.if(`${this.compiledNegation} && ctx.currentErrorCount === errorCount`,()=>e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema(e,n){return n.fallback.predicate({code:"predicate",base:e,predicate:this.predicate})}}const MA={implementation:T$,Node:A$},E$=dt({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:t=>Number.isInteger(t)?t:Y(_$(t))}},normalize:t=>typeof t=="number"?{rule:t}:t,hasAssociatedError:!0,defaults:{description:t=>t.rule===1?"an integer":t.rule===2?"even":`a multiple of ${t.rule}`},intersections:{divisor:(t,e,n)=>n.$.node("divisor",{rule:Math.abs(t.rule*e.rule/R$(t.rule,e.rule))})},obviatesBasisDescription:!0});class O$ extends Of{traverseAllows=e=>e%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=W.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema(e){return e.type="integer",this.rule===1||(e.multipleOf=this.rule),e}}const DA={implementation:E$,Node:O$},_$=t=>`divisor must be an integer (was ${t})`,R$=(t,e)=>{let n,r=t,o=e;for(;o!==0;)n=o,o=r%o,r=n;return r};class Yo extends Of{boundOperandKind=D$[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=N$(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${k$[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?$$(this.numericLimit):`${this.numericLimit}`;limitKind=this.comparator[0]==="<"?"upper":"lower";isStricterThan(e){return(this.limitKind==="upper"?this.numericLimit<e.numericLimit:this.numericLimit>e.numericLimit)||this.numericLimit===e.numericLimit&&this.exclusive===!0&&!e.exclusive}overlapsRange(e){return!(this.isStricterThan(e)||this.numericLimit===e.numericLimit&&(this.exclusive||e.exclusive))}overlapIsUnit(e){return this.numericLimit===e.numericLimit&&!this.exclusive&&!e.exclusive}}const k$={"<":">=","<=":">",">":"<=",">=":"<"},C$={min:"max",minLength:"maxLength",after:"before"},NA={parse:t=>t||void 0},$A=t=>e=>{if(typeof e=="number")return{rule:e};const{exclusive:n,...r}=e;return n?{...r,rule:t==="minLength"?r.rule+1:r.rule-1}:r},jA=t=>e=>{if(typeof e=="number"||typeof e=="string"||e instanceof Date)return{rule:e};const{exclusive:n,...r}=e;if(!n)return r;const o=typeof r.rule=="number"?r.rule:typeof r.rule=="string"?new Date(r.rule).valueOf():r.rule.valueOf();return n?{...r,rule:t==="after"?o+1:o-1}:r},BA=t=>typeof t=="string"||typeof t=="number"?new Date(t):t,M$=(t,e)=>`${t} bound must be a positive integer (was ${e})`,Ny=t=>e=>((!Number.isInteger(e)||e<0)&&Y(M$(t,e)),e),D$={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},N$=(t,e)=>`${Si(t,C$)?">":"<"}${e?"":"="}`,$$=t=>typeof t=="string"?t:new Date(t).toLocaleString(),j$=t=>`Bounded expression ${t} must be exactly one of number, string, Array, or Date`,B$=dt({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:BA,serialize:t=>t.toISOString()}},normalize:jA("after"),defaults:{description:t=>`${t.collapsibleLimitString} or later`,actual:Rl},intersections:{after:(t,e)=>t.isStricterThan(e)?t:e}});class z$ extends Yo{impliedBasis=W.intrinsic.Date.internal;collapsibleLimitString=Rl(this.rule);traverseAllows=e=>e>=this.rule;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,after:this.rule})}}const zA={implementation:B$,Node:z$},L$=dt({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:BA,serialize:t=>t.toISOString()}},normalize:jA("before"),defaults:{description:t=>`${t.collapsibleLimitString} or earlier`,actual:Rl},intersections:{before:(t,e)=>t.isStricterThan(e)?t:e,after:(t,e,n)=>t.overlapsRange(e)?t.overlapIsUnit(e)?n.$.node("unit",{unit:t.rule}):null:ae.init("range",t,e)}});class V$ extends Yo{collapsibleLimitString=Rl(this.rule);traverseAllows=e=>e<=this.rule;impliedBasis=W.intrinsic.Date.internal;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,before:this.rule})}}const LA={implementation:L$,Node:V$},U$=dt({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:Ny("exactLength")}},normalize:t=>typeof t=="number"?{rule:t}:t,hasAssociatedError:!0,defaults:{description:t=>`exactly length ${t.rule}`,actual:t=>`${t.length}`},intersections:{exactLength:(t,e,n)=>ae.init("unit",n.$.node("unit",{unit:t.rule}),n.$.node("unit",{unit:e.rule}),{path:["length"]}),minLength:(t,e)=>t.rule>=e.rule?t:ae.init("range",t,e),maxLength:(t,e)=>t.rule<=e.rule?t:ae.init("range",t,e)}});class K$ extends Of{traverseAllows=e=>e.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=W.intrinsic.lengthBoundable.internal;expression=`== ${this.rule}`;reduceJsonSchema(e){switch(e.type){case"string":return e.minLength=this.rule,e.maxLength=this.rule,e;case"array":return e.minItems=this.rule,e.maxItems=this.rule,e;default:return Mt.throwInternalOperandError("exactLength",e)}}}const VA={implementation:U$,Node:K$},q$=dt({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:NA},normalize:t=>typeof t=="number"?{rule:t}:t,defaults:{description:t=>t.rule===0?t.exclusive?"negative":"non-positive":`${t.exclusive?"less than":"at most"} ${t.rule}`},intersections:{max:(t,e)=>t.isStricterThan(e)?t:e,min:(t,e,n)=>t.overlapsRange(e)?t.overlapIsUnit(e)?n.$.node("unit",{unit:t.rule}):null:ae.init("range",t,e)},obviatesBasisDescription:!0});class P$ extends Yo{impliedBasis=W.intrinsic.number.internal;traverseAllows=this.exclusive?e=>e<this.rule:e=>e<=this.rule;reduceJsonSchema(e){return this.exclusive?e.exclusiveMaximum=this.rule:e.maximum=this.rule,e}}const UA={implementation:q$,Node:P$},I$=dt({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Ny("maxLength")}},reduce:(t,e)=>t.rule===0?e.node("exactLength",t):void 0,normalize:$A("maxLength"),defaults:{description:t=>`at most length ${t.rule}`,actual:t=>`${t.length}`},intersections:{maxLength:(t,e)=>t.isStricterThan(e)?t:e,minLength:(t,e,n)=>t.overlapsRange(e)?t.overlapIsUnit(e)?n.$.node("exactLength",{rule:t.rule}):null:ae.init("range",t,e)}});class H$ extends Yo{impliedBasis=W.intrinsic.lengthBoundable.internal;traverseAllows=e=>e.length<=this.rule;reduceJsonSchema(e){switch(e.type){case"string":return e.maxLength=this.rule,e;case"array":return e.maxItems=this.rule,e;default:return Mt.throwInternalOperandError("maxLength",e)}}}const KA={implementation:I$,Node:H$},F$=dt({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:NA},normalize:t=>typeof t=="number"?{rule:t}:t,defaults:{description:t=>t.rule===0?t.exclusive?"positive":"non-negative":`${t.exclusive?"more than":"at least"} ${t.rule}`},intersections:{min:(t,e)=>t.isStricterThan(e)?t:e},obviatesBasisDescription:!0});class G$ extends Yo{impliedBasis=W.intrinsic.number.internal;traverseAllows=this.exclusive?e=>e>this.rule:e=>e>=this.rule;reduceJsonSchema(e){return this.exclusive?e.exclusiveMinimum=this.rule:e.minimum=this.rule,e}}const qA={implementation:F$,Node:G$},Y$=dt({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Ny("minLength")}},reduce:t=>t.rule===0?W.intrinsic.unknown:void 0,normalize:$A("minLength"),defaults:{description:t=>t.rule===1?"non-empty":`at least length ${t.rule}`,actual:t=>t.length===0?"":`${t.length}`},intersections:{minLength:(t,e)=>t.isStricterThan(e)?t:e}});class J$ extends Yo{impliedBasis=W.intrinsic.lengthBoundable.internal;traverseAllows=e=>e.length>=this.rule;reduceJsonSchema(e){switch(e.type){case"string":return e.minLength=this.rule,e;case"array":return e.minItems=this.rule,e;default:return Mt.throwInternalOperandError("minLength",e)}}}const PA={implementation:Y$,Node:J$},X$={min:qA.implementation,max:UA.implementation,minLength:PA.implementation,maxLength:KA.implementation,exactLength:VA.implementation,after:zA.implementation,before:LA.implementation},Z$={min:qA.Node,max:UA.Node,minLength:PA.Node,maxLength:KA.Node,exactLength:VA.Node,after:zA.Node,before:LA.Node},Q$=dt({kind:"pattern",collapsibleKey:"rule",keys:{rule:{},flags:{}},normalize:t=>typeof t=="string"?{rule:t}:t instanceof RegExp?t.flags?{rule:t.source,flags:t.flags}:{rule:t.source}:t,obviatesBasisDescription:!0,obviatesBasisExpression:!0,hasAssociatedError:!0,intersectionIsOpen:!0,defaults:{description:t=>`matched by ${t.rule}`},intersections:{pattern:()=>null}});class W$ extends Of{instance=new RegExp(this.rule,this.flags);expression=`${this.instance}`;traverseAllows=this.instance.test.bind(this.instance);compiledCondition=`${this.expression}.test(data)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=W.intrinsic.string.internal;reduceJsonSchema(e,n){return e.pattern?n.fallback.patternIntersection({code:"patternIntersection",base:e,pattern:this.rule}):(e.pattern=this.rule,e)}}const IA={implementation:Q$,Node:W$},xc=(t,e)=>{const n=ej(t);return e&&!e.includes(n)?Y(`Root of kind ${n} should be one of ${e}`):n},ej=t=>{if(fe(t,"root"))return t.kind;if(typeof t=="string")return t[0]==="$"?"alias":t in Ji?"domain":"proto";if(typeof t=="function")return"proto";if(typeof t!="object"||t===null)return Y(Mw(t));if("morphs"in t)return"morph";if("branches"in t||Xt(t))return"union";if("unit"in t)return"unit";if("reference"in t)return"alias";const e=Object.keys(t);return e.length===0||e.some(n=>n in AA)?"intersection":"proto"in t?"proto":"domain"in t?"domain":Y(Mw(t))},Mw=t=>`${Ie(t)} is not a valid type schema`,Dw={},tj=t=>Xt(t)?t.map(e=>e.collapsibleJson):t.collapsibleJson,Ln={};W.nodesByRegisteredId=Ln;const HA=t=>(Dw[t]??=0,`${t}${++Dw[t]}`),FA=t=>{const e=_f[t.kind],n=e.applyConfig?.(t.def,t.$.resolvedConfig)??t.def,r={},{meta:o,...u}=n,c=o===void 0?{}:typeof o=="string"?{description:o}:o,f=tA(u).sort(([m],[y])=>wc(m)?wc(y)?Gc(m)-Gc(y):1:wc(y)||m<y?-1:1).filter(([m,y])=>{if(m.startsWith("meta.")){const g=m.slice(5);return c[g]=y,!1}return!0});for(const m of f){const y=m[0],g=e.keys[y];if(!g)return Y(`Key ${y} is not valid on ${t.kind} schema`);const b=g.parse?g.parse(m[1],t):m[1];b!==ui&&(b!==void 0||g.preserveUndefined)&&(r[y]=b)}if(e.reduce&&!t.prereduced){const m=e.reduce(r,t.$);if(m)return m instanceof ae?m.throw():ij(m,c)}return $y({id:t.id,kind:t.kind,inner:r,meta:c,$:t.$})},$y=({id:t,kind:e,inner:n,meta:r,$:o,ignoreCache:u})=>{const c=_f[e],f=tA(n),h=[];let m={};for(const[k,C]of f){const M=c.keys[k],G=M.serialize??(M.child?tj:Os);if(m[k]=G(C),M.child===!0){const I=C;Xt(I)?h.push(...I):h.push(I)}else typeof M.child=="function"&&h.push(...M.child(C))}c.finalizeInnerJson&&(m=c.finalizeInnerJson(m));let y={...m},g={};Ol(r)||(g=Ge(r,(k,C)=>[k,k==="examples"?C:Os(C)]),y.meta=ac(g,"description",!0)),m=ac(m,c.collapsibleKey,!1);const b=JSON.stringify({kind:e,...m});y=ac(y,c.collapsibleKey,!1);const S=ac(y,c.collapsibleKey,!0),x=JSON.stringify({kind:e,...y});if(o.nodesByHash[x]&&!u)return o.nodesByHash[x];const T={id:t,kind:e,impl:c,inner:n,innerEntries:f,innerJson:m,innerHash:b,meta:r,metaJson:g,json:y,hash:x,collapsibleJson:S,children:h};if(e!=="intersection")for(const k in n)k!=="in"&&k!=="out"&&(T[k]=n[k]);const _=new c3[e](T,o);return o.nodesByHash[x]=_},nj=(t,e)=>t.id===e?t:(Qt(Ln[e])&&_t(`Unexpected attempt to overwrite node id ${e}`),$y({id:e,kind:t.kind,inner:t.inner,meta:t.meta,$:t.$,ignoreCache:!0})),ij=(t,e,n)=>$y({id:HA(e.alias??t.kind),kind:t.kind,inner:t.inner,meta:e,$:t.$}),ac=(t,e,n)=>{const r=Object.keys(t);if(r.length===1&&r[0]===e){const o=t[e];if(n||Cs(o,"object")&&(Object.keys(o).length===1||Array.isArray(o)))return o}return t},hm=(t,e,n)=>{if(t.key!==e.key)return null;const r=t.key;let o=Bt(t.value,e.value,n);const u=t.required||e.required?"required":"optional";if(o instanceof ae)if(u==="optional")o=W.intrinsic.never.internal;else return o.withPrefixKey(t.key,t.required&&e.required?"required":"optional");if(u==="required")return n.$.node("required",{key:r,value:o});const c=t.hasDefault()?e.hasDefault()?t.default===e.default?t.default:Y(YA(t.default,e.default)):t.default:e.hasDefault()?e.default:ui;return n.$.node("optional",{key:r,value:o,default:c})};class GA extends Go{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=W.intrinsic.object.internal;serializedKey=Fo(this.key);compiledKey=typeof this.key=="string"?this.key:this.serializedKey;flatRefs=Fe(this.value.flatRefs.map(e=>Nr([this.key,...e.path],e.node)),Nr([this.key],this.value));_transform(e,n){n.path.push(this.key);const r=super._transform(e,n);return n.path.pop(),r}hasDefault(){return"default"in this.inner}traverseAllows=(e,n)=>this.key in e?Zi(this.key,()=>this.value.traverseAllows(e[this.key],n),n):this.optional;traverseApply=(e,n)=>{this.key in e?Zi(this.key,()=>this.value.traverseApply(e[this.key],n),n):this.hasKind("required")&&n.errorFromNodeContext(this.errorContext)};compile(e){e.if(`${this.serializedKey} in data`,()=>e.traverseKey(this.serializedKey,`data${e.prop(this.key)}`,this.value)),this.hasKind("required")&&e.else(()=>e.traversalKind==="Apply"?e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`):e.return(!1)),e.traversalKind==="Allows"&&e.return(!0)}}const YA=(t,e)=>`Invalid intersection of default values ${Ie(t)} & ${Ie(e)}`,rj=dt({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(t,e)=>e.$.parseSchema(t)},default:{preserveUndefined:!0}},normalize:t=>t,reduce:(t,e)=>{if(e.resolvedConfig.exactOptionalPropertyTypes===!1&&!t.value.allows(void 0))return e.node("optional",{...t,value:t.value.or(me.undefined)},{prereduced:!0})},defaults:{description:t=>`${t.compiledKey}?: ${t.value.description}`},intersections:{optional:hm}});class sj extends GA{constructor(...e){super(...e),"default"in this.inner&&By(this.value,this.inner.default,this.key)}get rawIn(){const e=super.rawIn;return this.hasDefault()?this.$.node("optional",iA(e.inner,{default:!0}),{prereduced:!0}):e}get outProp(){if(!this.hasDefault())return this;const{default:e,...n}=this.inner;return this.cacheGetter("outProp",this.$.node("required",n,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${Ie(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=aj(this);defaultValueMorphRef=this.defaultValueMorph&&en(this.defaultValueMorph)}const jy={implementation:rj,Node:sj},oj={},aj=t=>{if(!t.hasDefault())return;const e=`{${t.compiledKey}: ${t.value.id} = ${Os(t.default)}}`;return oj[e]??=JA(t.key,t.value,t.default)},JA=(t,e,n)=>{if(typeof n=="function")return e.includesTransform?(o,u)=>(Zi(t,()=>e(o[t]=n(),u),u),o):o=>(o[t]=n(),o);const r=e.includesTransform?e.assert(n):n;return Cs(r,"object")?(o,u)=>(Zi(t,()=>e(o[t]=n,u),u),o):o=>(o[t]=r,o)},By=(t,e,n)=>{const r=wf(e);Cs(e,"object")&&!r&&Y(lj(n));const o=t.in(r?e():e);if(o instanceof Lr){n===null&&Y(`Default ${o.summary}`);const u=o.transform(c=>c.transform(f=>({...f,prefixPath:[n]})));Y(`Default for ${u.summary}`)}return e},lj=t=>`Non-primitive default ${t===null?"":typeof t=="number"?`for value at [${t}] `:`for ${Fo(t)} `}must be specified as a function like () => ({my: 'object'})`;class Cl extends _A{constructor(e,n){super(e,n),Object.defineProperty(this,Xi,{value:"root",enumerable:!1})}get rawIn(){return super.rawIn}get rawOut(){return super.rawOut}get internal(){return this}get"~standard"(){return{vendor:"arktype",version:1,validate:e=>{const n=this(e);return n instanceof Lr?n:{value:n}},jsonSchema:{input:e=>this.rawIn.toJsonSchema({target:Nw(e.target),...e.libraryOptions}),output:e=>this.rawOut.toJsonSchema({target:Nw(e.target),...e.libraryOptions})}}}as(){return this}brand(e){return e===""?Y(uj):this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute(e,n){const r=this.branches.map(e);return n?.(r)??r}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema(e={}){const n=OA(this.$.resolvedConfig.toJsonSchema,e);n.useRefs||=this.isCyclic;const r=typeof n.dialect=="string"?{$schema:n.dialect}:{};if(Object.assign(r,this.toJsonSchemaRecurse(n)),n.useRefs){const o=Ge(this.references,(u,c)=>c.isRoot()&&!c.alwaysExpandJsonSchema?[c.id,c.toResolvedJsonSchema(n)]:[]);n.target==="draft-07"?Object.assign(r,{definitions:o}):r.$defs=o}return r}toJsonSchemaRecurse(e){return e.useRefs&&!this.alwaysExpandJsonSchema?{$ref:`#/${e.target==="draft-07"?"definitions":"$defs"}/${this.id}`}:this.toResolvedJsonSchema(e)}get alwaysExpandJsonSchema(){return this.isBasis()||this.kind==="alias"||this.hasKind("union")&&this.isBoolean}toResolvedJsonSchema(e){const n=this.innerToJsonSchema(e);return Object.assign(n,this.metaJson)}intersect(e){const n=this.$.parseDefinition(e),r=this.rawIntersect(n);return r instanceof ae?r:this.$.finalize(r)}rawIntersect(e){return Qi(this,e,this.$)}toNeverIfDisjoint(){return this}and(e){const n=this.intersect(e);return n instanceof ae?n.throw():n}rawAnd(e){const n=this.rawIntersect(e);return n instanceof ae?n.throw():n}or(e){const n=this.$.parseDefinition(e);return this.$.finalize(this.rawOr(n))}rawOr(e){const n=[...this.branches,...e.branches];return this.$.node("union",n)}map(e){return this.$.schema(this.applyStructuralOperation("map",[e]))}pick(...e){return this.$.schema(this.applyStructuralOperation("pick",e))}omit(...e){return this.$.schema(this.applyStructuralOperation("omit",e))}required(){return this.$.schema(this.applyStructuralOperation("required",[]))}partial(){return this.$.schema(this.applyStructuralOperation("partial",[]))}_keyof;keyof(){if(this._keyof)return this._keyof;const e=this.applyStructuralOperation("keyof",[]).reduce((n,r)=>n.intersect(r).toNeverIfDisjoint(),W.intrinsic.unknown.internal);return e.branches.length===0&&Y(kA(`keyof ${this.expression}`)),this._keyof=this.$.finalize(e)}get props(){return this.branches.length!==1?Y(fj(this.expression)):[...this.applyStructuralOperation("props",[])[0]]}merge(e){const n=this.$.parseDefinition(e);return this.$.schema(n.distribute(r=>this.applyStructuralOperation("merge",[$w(r)??Y(jw("merge",r.expression))])))}applyStructuralOperation(e,n){return this.distribute(r=>{if(r.equals(W.intrinsic.object)&&e!=="merge")return r;const o=$w(r);if(o||Y(jw(e,r.expression)),e==="keyof")return o.keyof();if(e==="get")return o.get(...n);if(e==="props")return o.props;const u=e==="required"?"require":e==="partial"?"optionalize":e;return this.$.node("intersection",{domain:"object",structure:o[u](...n)})})}get(...e){return e[0]===void 0?this:this.$.schema(this.applyStructuralOperation("get",e))}extract(e){const n=this.$.parseDefinition(e);return this.$.schema(this.branches.filter(r=>r.extends(n)))}exclude(e){const n=this.$.parseDefinition(e);return this.$.schema(this.branches.filter(r=>!r.extends(n)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps(e){return!(this.intersect(e)instanceof ae)}extends(e){if(this.isNever())return!0;const n=this.intersect(e);return!(n instanceof ae)&&this.equals(n)}ifExtends(e){return this.extends(e)?this:void 0}subsumes(e){return this.$.parseDefinition(e).extends(this)}configure(e,n="shallow"){return this.configureReferences(e,n)}describe(e,n="shallow"){return this.configure({description:e},n)}optional(){return[this,"?"]}default(e){return By(this,e,null),[this,"=",e]}from(e){return this.assert(e)}_pipe(...e){const n=e.reduce((r,o)=>r.rawPipeOnce(o),this);return this.$.finalize(n)}tryPipe(...e){const n=e.reduce((r,o)=>r.rawPipeOnce(fe(o,"root")?o:((u,c)=>{try{return o(u,c)}catch(f){return c.error({code:"predicate",predicate:o,actual:`aborted due to error:
43
- ${f}
44
- `})}})),this);return this.$.finalize(n)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to(e){return this.$.finalize(this.toNode(this.$.parseDefinition(e)))}toNode(e){const n=fm(this,e,this.$);return n instanceof ae?n.throw():n}rawPipeOnce(e){return fe(e,"root")?this.toNode(e):this.distribute(n=>n.hasKind("morph")?this.$.node("morph",{in:n.inner.in,morphs:[...n.morphs,e]}):this.$.node("morph",{in:n,morphs:[e]}),this.$.parseSchema)}narrow(e){return this.constrainOut("predicate",e)}constrain(e,n){return this._constrain("root",e,n)}constrainIn(e,n){return this._constrain("in",e,n)}constrainOut(e,n){return this._constrain("out",e,n)}_constrain(e,n,r){const o=this.$.node(n,r);if(o.isRoot())return o.isUnknown()?this:_t(`Unexpected constraint node ${o}`);const u=e==="root"?this:e==="in"?this.rawIn:this.rawOut;if(u.hasKind("morph")||o.impliedBasis&&!u.extends(o.impliedBasis))return b$(n,o.impliedBasis,this);const c=this.$.node("intersection",{[o.kind]:o}),f=e==="out"?fm(this,c,this.$):Qi(this,c,this.$);return f instanceof ae&&f.throw(),this.$.finalize(f)}onUndeclaredKey(e){const n=typeof e=="string"?e:e.rule,r=typeof e=="string"?!1:e.deep;return this.$.finalize(this.transform((o,u)=>o==="structure"?n==="ignore"?iA(u,{undeclared:1}):{...u,undeclared:n}:u,r?void 0:{shouldTransform:o=>!Ii(Tf,o.kind)}))}hasEqualMorphs(e){return!this.includesTransform&&!e.includesTransform?!0:!(!Lo(this.shallowMorphs,e.shallowMorphs)||!Lo(this.flatMorphs,e.flatMorphs,{isEqual:(n,r)=>n.propString===r.propString&&(n.node.hasKind("morph")&&r.node.hasKind("morph")?n.node.hasEqualMorphs(r.node):n.node.hasKind("intersection")&&r.node.hasKind("intersection")?n.node.structure?.structuralMorphRef===r.node.structure?.structuralMorphRef:!1)}))}onDeepUndeclaredKey(e){return this.onUndeclaredKey({rule:e,deep:!0})}filter(e){return this.constrainIn("predicate",e)}divisibleBy(e){return this.constrain("divisor",e)}matching(e){return this.constrain("pattern",e)}atLeast(e){return this.constrain("min",e)}atMost(e){return this.constrain("max",e)}moreThan(e){return this.constrain("min",bo(e))}lessThan(e){return this.constrain("max",bo(e))}atLeastLength(e){return this.constrain("minLength",e)}atMostLength(e){return this.constrain("maxLength",e)}moreThanLength(e){return this.constrain("minLength",bo(e))}lessThanLength(e){return this.constrain("maxLength",bo(e))}exactlyLength(e){return this.constrain("exactLength",e)}atOrAfter(e){return this.constrain("after",e)}atOrBefore(e){return this.constrain("before",e)}laterThan(e){return this.constrain("after",bo(e))}earlierThan(e){return this.constrain("before",bo(e))}}const uj="Expected a non-empty brand name after #",XA=["draft-2020-12","draft-07"],cj=t=>`JSONSchema target '${t}' is not supported (must be ${XA.map(e=>`"${e}"`).join(" or ")})`,Nw=t=>(Ii(XA,t)||Y(cj(t)),t),bo=t=>typeof t=="object"&&!(t instanceof Date)?{...t,exclusive:!0}:{rule:t,exclusive:!0},lc=(t,e)=>fe(e,"root")?fe(t,"root")?t.extends(e):e.allows(t):fe(t,"root")?t.hasUnit(e):e===t,$w=t=>t.hasKind("morph")?null:t.hasKind("intersection")?t.inner.structure??(t.basis?.domain==="object"?t.$.bindReference(W.intrinsic.emptyStructure):null):t.isBasis()&&t.domain==="object"?t.$.bindReference(W.intrinsic.emptyStructure):null,fj=t=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
45
- ${t}`,jw=(t,e)=>`${t} operand must be an object (was ${e})`,Ml=(t,e)=>Ge(Dy(t),(n,r)=>[r,e]),dj=t=>typeof t=="string"?{reference:t}:t,Bw=t=>t instanceof ae?W.intrinsic.never.internal:t,hj=dt({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:t=>t.startsWith("$")?t:`$ark.${t}`},resolve:{}},normalize:dj,defaults:{description:t=>t.reference},intersections:{alias:(t,e,n)=>n.$.lazilyResolve(()=>Bw(Bt(t.resolution,e.resolution,n)),`${t.reference}${n.pipe?"=>":"&"}${e.reference}`),...Ml("alias",(t,e,n)=>e.isUnknown()?t:e.isNever()?e:e.isBasis()&&!e.overlaps(W.intrinsic.object)?ae.init("assignability",W.intrinsic.object,e):n.$.lazilyResolve(()=>Bw(Bt(t.resolution,e,n)),`${t.reference}${n.pipe?"=>":"&"}${e.id}`))}});class pj extends Cl{expression=this.reference;structure=void 0;get resolution(){const e=this._resolve();return Ln[this.id]=e}_resolve(){if(this.resolve)return this.resolve();if(this.reference[0]==="$")return this.$.resolveRoot(this.reference.slice(1));const e=this.reference;let n=Ln[e];const r=[];for(;fe(n,"context");){if(r.includes(n.id))return Y(mj(n.id,r));r.push(n.id),n=Ln[n.id]}return fe(n,"root")?n:_t(`Unexpected resolution for reference ${this.reference}
46
- Seen: [${r.join("->")}]
47
- Resolution: ${Ie(n)}`)}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;const e=this.reference.slice(1),n=this.$.resolutions[e];return typeof n=="string"?n:fe(n,"root")?n.id:_t(`Unexpected resolution for reference ${this.reference}: ${Ie(n)}`)}get defaultShortDescription(){return Ji.object}innerToJsonSchema(e){return this.resolution.toJsonSchemaRecurse(e)}traverseAllows=(e,n)=>{const r=n.seen[this.reference];return r?.includes(e)?!0:(n.seen[this.reference]=Fe(r,e),this.resolution.traverseAllows(e,n))};traverseApply=(e,n)=>{const r=n.seen[this.reference];r?.includes(e)||(n.seen[this.reference]=Fe(r,e),this.resolution.traverseApply(e,n))};compile(e){const n=this.resolutionId;e.if(`ctx.seen.${n} && ctx.seen.${n}.includes(data)`,()=>e.return(!0)),e.if(`!ctx.seen.${n}`,()=>e.line(`ctx.seen.${n} = []`)),e.line(`ctx.seen.${n}.push(data)`),e.return(e.invoke(n))}}const mj=(t,e)=>`Alias '${t}' has a shallow resolution cycle: ${[...e,t].join("->")}`,zy={implementation:hj,Node:pj};class Ly extends Cl{traverseApply=(e,n)=>{this.traverseAllows(e,n)||n.errorFromNodeContext(this.errorContext)};get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return Ef(this.errorContext)}compile(e){e.traversalKind==="Allows"?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}}const yj=dt({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:t=>typeof t=="string"?{domain:t}:Oy(t,"numberAllowsNaN")&&t.domain!=="number"?Y(Vy.writeBadAllowNanMessage(t.domain)):t,applyConfig:(t,e)=>t.numberAllowsNaN===void 0&&t.domain==="number"&&e.numberAllowsNaN?{...t,numberAllowsNaN:!0}:t,defaults:{description:t=>Ji[t.domain],actual:t=>Number.isNaN(t)?"NaN":Ji[ei(t)]},intersections:{domain:(t,e)=>t.domain==="number"&&e.domain==="number"?t.numberAllowsNaN?e:t:ae.init("domain",t,e)}});class gj extends Ly{requiresNaNCheck=this.domain==="number"&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?e=>typeof e=="number"&&!Number.isNaN(e):e=>ei(e)===this.domain;compiledCondition=this.domain==="object"?'((typeof data === "object" && data !== null) || typeof data === "function")':`typeof data === "${this.domain}"${this.requiresNaNCheck?" && !Number.isNaN(data)":""}`;compiledNegation=this.domain==="object"?'((typeof data !== "object" || data === null) && typeof data !== "function")':`typeof data !== "${this.domain}"${this.requiresNaNCheck?" || Number.isNaN(data)":""}`;expression=this.numberAllowsNaN?"number | NaN":this.domain;get nestableExpression(){return this.numberAllowsNaN?`(${this.expression})`:this.expression}get defaultShortDescription(){return Ji[this.domain]}innerToJsonSchema(e){return this.domain==="bigint"||this.domain==="symbol"?e.fallback.domain({code:"domain",base:{},domain:this.domain}):{type:this.domain}}}const Vy={implementation:yj,Node:gj,writeBadAllowNanMessage:t=>`numberAllowsNaN may only be specified with domain "number" (was ${t})`},vj=dt({kind:"intersection",hasAssociatedError:!0,normalize:t=>{if(Qt(t))return t;const{structure:e,...n}=t,r=!!e,o=e??{},u=Ge(n,(c,f)=>Si(c,s$)?(r&&Y(`Flattened structure key ${c} cannot be specified alongside a root 'structure' key.`),o[c]=f,[]):[c,f]);return(fe(o,"constraint")||!Ol(o))&&(u.structure=o),u},finalizeInnerJson:({structure:t,...e})=>Cs(t,"object")?{...t,...e}:e,keys:{domain:{child:!0,parse:(t,e)=>e.$.node("domain",t)},proto:{child:!0,parse:(t,e)=>e.$.node("proto",t)},structure:{child:!0,parse:(t,e)=>e.$.node("structure",t),serialize:t=>{if(!t.sequence?.minLength)return t.collapsibleJson;const{sequence:e,...n}=t.collapsibleJson,{minVariadicLength:r,...o}=e,u=o.variadic&&Object.keys(o).length===1?o.variadic:o;return{...n,sequence:u}}},divisor:{child:!0,parse:un("divisor")},max:{child:!0,parse:un("max")},min:{child:!0,parse:un("min")},maxLength:{child:!0,parse:un("maxLength")},minLength:{child:!0,parse:un("minLength")},exactLength:{child:!0,parse:un("exactLength")},before:{child:!0,parse:un("before")},after:{child:!0,parse:un("after")},pattern:{child:!0,parse:un("pattern")},predicate:{child:!0,parse:un("predicate")}},reduce:(t,e)=>zw({},t,{$:e,invert:!1,pipe:!1}),defaults:{description:t=>{if(t.children.length===0)return"unknown";if(t.structure)return t.structure.description;const e=[];if(t.basis&&!t.prestructurals.some(n=>n.impl.obviatesBasisDescription)&&e.push(t.basis.description),t.prestructurals.length){const n=t.prestructurals.slice().sort((r,o)=>r.kind==="min"&&o.kind==="max"?-1:0).map(r=>r.description);e.push(...n)}return t.inner.predicate&&e.push(...t.inner.predicate.map(n=>n.description)),e.join(" and ")},expected:t=>` ◦ ${t.errors.map(e=>e.expected).join(`
48
- ◦ `)}`,problem:t=>`(${t.actual}) must be...
49
- ${t.expected}`},intersections:{intersection:(t,e,n)=>zw(t.inner,e.inner,n),...Ml("intersection",(t,e,n)=>{if(t.children.length===0)return e;const{domain:r,proto:o,...u}=t.inner,c=o??r,f=c?Bt(c,e,n):e;return f instanceof ae?f:t?.basis?.equals(f)?t:t.$.node("intersection",{...u,[f.kind]:f},{prereduced:!0})})}});class bj extends Cl{basis=this.inner.domain??this.inner.proto??null;prestructurals=[];refinements=this.children.filter(e=>e.isRefinement()?(Ii(xA,e.kind)&&this.prestructurals.push(e),!0):!1);structure=this.inner.structure;expression=Sj(this);get shallowMorphs(){return this.inner.structure?.structuralMorph?[this.inner.structure.structuralMorph]:[]}get defaultShortDescription(){return this.basis?.defaultShortDescription??"present"}innerToJsonSchema(e){return this.children.reduce((n,r)=>r.isBasis()?r.toJsonSchemaRecurse(e):r.reduceJsonSchema(n,e),{})}traverseAllows=(e,n)=>this.children.every(r=>r.traverseAllows(e,n));traverseApply=(e,n)=>{const r=n.currentErrorCount;if(!(this.basis&&(this.basis.traverseApply(e,n),n.currentErrorCount>r))){if(this.prestructurals.length){for(let o=0;o<this.prestructurals.length-1;o++)if(this.prestructurals[o].traverseApply(e,n),n.failFast&&n.currentErrorCount>r)return;if(this.prestructurals[this.prestructurals.length-1].traverseApply(e,n),n.currentErrorCount>r)return}if(!(this.structure&&(this.structure.traverseApply(e,n),n.currentErrorCount>r))&&this.inner.predicate){for(let o=0;o<this.inner.predicate.length-1;o++)if(this.inner.predicate[o].traverseApply(e,n),n.failFast&&n.currentErrorCount>r)return;this.inner.predicate[this.inner.predicate.length-1].traverseApply(e,n)}}};compile(e){if(e.traversalKind==="Allows"){for(const n of this.children)e.check(n);e.return(!0);return}if(e.initializeErrorCount(),this.basis&&(e.check(this.basis),this.children.length>1&&e.returnIfFail()),this.prestructurals.length){for(let n=0;n<this.prestructurals.length-1;n++)e.check(this.prestructurals[n]),e.returnIfFailFast();e.check(this.prestructurals[this.prestructurals.length-1]),(this.structure||this.inner.predicate)&&e.returnIfFail()}if(this.structure&&(e.check(this.structure),this.inner.predicate&&e.returnIfFail()),this.inner.predicate){for(let n=0;n<this.inner.predicate.length-1;n++)e.check(this.inner.predicate[n]),e.returnIfFail();e.check(this.inner.predicate[this.inner.predicate.length-1])}}}const ZA={implementation:vj,Node:bj},Sj=t=>{if(t.structure?.expression)return t.structure.expression;const e=t.basis&&!t.prestructurals.some(o=>o.impl.obviatesBasisExpression)?t.basis.nestableExpression:"",n=t.prestructurals.map(o=>o.expression).join(" & "),r=`${e}${e?" ":""}${n}`;return r==="Array == 0"?"[]":r||"unknown"},zw=(t,e,n)=>{const r={},o=t.proto??t.domain,u=e.proto??e.domain,c=o?u?Bt(o,u,n):o:u;return c instanceof ae?c:(c&&(r[c.kind]=c),Yc({kind:"intersection",baseInner:r,l:Jc(t),r:Jc(e),roots:[],ctx:n}))},wj=dt({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(t,e)=>e.$.parseSchema(t)},morphs:{parse:El,serialize:t=>t.map(e=>fe(e,"root")?e.json:en(e))},declaredIn:{child:!1,serialize:t=>t.json},declaredOut:{child:!1,serialize:t=>t.json}},normalize:t=>t,defaults:{description:t=>`a morph from ${t.rawIn.description} to ${t.rawOut?.description??"unknown"}`},intersections:{morph:(t,e,n)=>{if(!t.hasEqualMorphs(e))return Y(Tj(t.expression,e.expression));const r=Bt(t.rawIn,e.rawIn,n);if(r instanceof ae)return r;const o={morphs:t.morphs};if(t.declaredIn||e.declaredIn){const u=Bt(t.rawIn,e.rawIn,n);if(u instanceof ae)return u.throw();o.declaredIn=u}if(t.declaredOut||e.declaredOut){const u=Bt(t.rawOut,e.rawOut,n);if(u instanceof ae)return u.throw();o.declaredOut=u}return r.distribute(u=>n.$.node("morph",{...o,in:u}),n.$.parseSchema)},...Ml("morph",(t,e,n)=>{const r=t.inner.in?Bt(t.inner.in,e,n):e;return r instanceof ae?r:r.equals(t.inner.in)?t:n.$.node("morph",{...t.inner,in:r})})}});class xj extends Cl{serializedMorphs=this.morphs.map(en);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs[this.inner.morphs.length-1];lastMorphIfNode=fe(this.lastMorph,"root")?this.lastMorph:void 0;introspectableIn=this.inner.in;introspectableOut=this.lastMorphIfNode?Object.assign(this.referencesById,this.lastMorphIfNode.referencesById)&&this.lastMorphIfNode.rawOut:void 0;get shallowMorphs(){return Array.isArray(this.inner.in?.shallowMorphs)?[...this.inner.in.shallowMorphs,...this.morphs]:this.morphs}get rawIn(){return this.declaredIn??this.inner.in?.rawIn??W.intrinsic.unknown.internal}get rawOut(){return this.declaredOut??this.introspectableOut??W.intrinsic.unknown.internal}declareIn(e){return this.$.node("morph",{...this.inner,declaredIn:e})}declareOut(e){return this.$.node("morph",{...this.inner,declaredOut:e})}expression=`(In: ${this.rawIn.expression}) => ${this.lastMorphIfNode?"To":"Out"}<${this.rawOut.expression}>`;get defaultShortDescription(){return this.rawIn.meta.description??this.rawIn.defaultShortDescription}innerToJsonSchema(e){return e.fallback.morph({code:"morph",base:this.rawIn.toJsonSchemaRecurse(e),out:this.introspectableOut?.toJsonSchemaRecurse(e)??null})}compile(e){if(e.traversalKind==="Allows"){if(!this.introspectableIn)return;e.return(e.invoke(this.introspectableIn));return}this.introspectableIn&&e.line(e.invoke(this.introspectableIn)),e.line(`ctx.queueMorphs(${this.compiledMorphs})`)}traverseAllows=(e,n)=>!this.introspectableIn||this.introspectableIn.traverseAllows(e,n);traverseApply=(e,n)=>{this.introspectableIn&&this.introspectableIn.traverseApply(e,n),n.queueMorphs(this.morphs)};hasEqualMorphs(e){return Lo(this.morphs,e.morphs,{isEqual:(n,r)=>n===r||fe(n,"root")&&fe(r,"root")&&n.equals(r)})}}const QA={implementation:wj,Node:xj},Tj=(t,e)=>`The intersection of distinct morphs at a single path is indeterminate:
50
- Left: ${t}
51
- Right: ${e}`,Aj=dt({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:t=>Ry(t)??Os(t)},dateAllowsInvalid:{}},normalize:t=>{const e=typeof t=="string"?{proto:Uo[t]}:typeof t=="function"?Qt(t)?t:{proto:t}:typeof t.proto=="string"?{...t,proto:Uo[t.proto]}:t;return typeof e.proto!="function"&&Y(Zc.writeInvalidSchemaMessage(e.proto)),Oy(e,"dateAllowsInvalid")&&e.proto!==Date&&Y(Zc.writeBadInvalidDateMessage(e.proto)),e},applyConfig:(t,e)=>t.dateAllowsInvalid===void 0&&t.proto===Date&&e.dateAllowsInvalid?{...t,dateAllowsInvalid:!0}:t,defaults:{description:t=>t.builtinName?bN[t.builtinName]:`an instance of ${t.proto.name}`,actual:t=>t instanceof Date&&t.toString()==="Invalid Date"?"an invalid Date":rm(t)},intersections:{proto:(t,e)=>t.proto===Date&&e.proto===Date?t.dateAllowsInvalid?e:t:xw(t.proto,e.proto)?t:xw(e.proto,t.proto)?e:ae.init("proto",t,e),domain:(t,e)=>e.domain==="object"?t:ae.init("domain",W.intrinsic.object.internal,e)}});class Ej extends Ly{builtinName=Ry(this.proto);serializedConstructor=this.json.proto;requiresInvalidDateCheck=this.proto===Date&&!this.dateAllowsInvalid;traverseAllows=this.requiresInvalidDateCheck?e=>e instanceof Date&&e.toString()!=="Invalid Date":e=>e instanceof this.proto;compiledCondition=`data instanceof ${this.serializedConstructor}${this.requiresInvalidDateCheck?' && data.toString() !== "Invalid Date"':""}`;compiledNegation=`!(${this.compiledCondition})`;innerToJsonSchema(e){switch(this.builtinName){case"Array":return{type:"array"};case"Date":return e.fallback.date?.({code:"date",base:{}})??e.fallback.proto({code:"proto",base:{},proto:this.proto});default:return e.fallback.proto({code:"proto",base:{},proto:this.proto})}}expression=this.dateAllowsInvalid?"Date | InvalidDate":this.proto.name;get nestableExpression(){return this.dateAllowsInvalid?`(${this.expression})`:this.expression}domain="object";get defaultShortDescription(){return this.description}}const Zc={implementation:Aj,Node:Ej,writeBadInvalidDateMessage:t=>`dateAllowsInvalid may only be specified with constructor Date (was ${t.name})`,writeInvalidSchemaMessage:t=>`instanceOf operand must be a function (was ${ei(t)})`},Oj=dt({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:(t,e)=>{const n=[];for(const r of t){const o=fe(r,"root")?r.branches:e.$.parseSchema(r).branches;for(const u of o)if(u.hasKind("morph")){const c=n.findIndex(f=>f.hasKind("morph")&&f.hasEqualMorphs(u));if(c===-1)n.push(u);else{const f=n[c];n[c]=e.$.node("morph",{...f.inner,in:f.rawIn.rawOr(u.rawIn)})}}else n.push(u)}return e.def.ordered||n.sort((r,o)=>r.hash<o.hash?-1:1),n}}},normalize:t=>Xt(t)?{branches:t}:t,reduce:(t,e)=>{const n=zj(t);if(n.length===1)return n[0];if(n.length!==t.branches.length)return e.node("union",{...t,branches:n},{prereduced:!0})},defaults:{description:t=>t.distribute(e=>e.description,Do),expected:t=>{const e=rN(t.errors,"propString"),n=Object.entries(e).map(([r,o])=>{const u=[];for(const h of o)Ss(u,h.expected);const c=Do(u),f=o.every(h=>h.actual===o[0].actual)?o[0].actual:Ie(o[0].data);return`${r&&`${r} `}must be ${c}${f&&` (was ${f})`}`});return Do(n)},problem:t=>t.expected,message:t=>t.problem[0]==="["?`value at ${t.problem}`:t.problem},intersections:{union:(t,e,n)=>{if(t.isNever!==e.isNever)return ae.init("presence",t,e);let r;return t.ordered?(e.ordered&&Y(Vj(t.expression,e.expression)),r=hp(e.branches,t.branches,n),r instanceof ae&&r.invert()):r=hp(t.branches,e.branches,n),r instanceof ae?r:n.$.parseSchema(t.ordered||e.ordered?{branches:r,ordered:!0}:{branches:r})},...Ml("union",(t,e,n)=>{const r=hp(t.branches,[e],n);return r instanceof ae?r:r.length===1?r[0]:n.$.parseSchema(t.ordered?{branches:r,ordered:!0}:{branches:r})})}});class _j extends Cl{isBoolean=this.branches.length===2&&this.branches[0].hasUnit(!1)&&this.branches[1].hasUnit(!0);get branchGroups(){const e=[];let n=-1;for(const r of this.branches){if(r.hasKind("unit")&&r.domain==="boolean"){n===-1?(n=e.length,e.push(r)):e[n]=W.intrinsic.boolean;continue}e.push(r)}return e}unitBranches=this.branches.filter(e=>e.rawIn.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?$j(this.discriminant):null;expression=this.distribute(e=>e.nestableExpression,Bj);createBranchedOptimisticRootApply(){return(e,n)=>{const r=this.traverseOptimistic(e);if(r!==ui)return r;const o=new To(e,this.$.resolvedConfig);return this.traverseApply(e,o),o.finalize(n)}}get shallowMorphs(){return this.branches.reduce((e,n)=>Ss(e,n.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(e=>e.defaultShortDescription,Do)}innerToJsonSchema(e){if(this.branchGroups.length===1&&this.branchGroups[0].equals(W.intrinsic.boolean))return{type:"boolean"};const n=this.branchGroups.map(r=>r.toJsonSchemaRecurse(e));return n.every(r=>Object.keys(r).length===1&&Oy(r,"const"))?{enum:n.map(r=>r.const)}:{anyOf:n}}traverseAllows=(e,n)=>this.branches.some(r=>r.traverseAllows(e,n));traverseApply=(e,n)=>{const r=[];for(let o=0;o<this.branches.length;o++){if(n.pushBranch(),this.branches[o].traverseApply(e,n),!n.hasError())return this.branches[o].includesTransform?n.queuedMorphs.push(...n.popBranch().queuedMorphs):n.popBranch();r.push(n.popBranch().error)}n.errorFromNodeContext({code:"union",errors:r,meta:this.meta})};traverseOptimistic=e=>{for(let n=0;n<this.branches.length;n++){const r=this.branches[n];if(r.traverseAllows(e))return r.contextFreeMorph?r.contextFreeMorph(e):e}return ui};compile(e){if(!this.discriminant||this.unitBranches.length===this.branches.length&&this.branches.length===2)return this.compileIndiscriminable(e);let n=this.discriminant.optionallyChainedPropString;this.discriminant.kind==="domain"&&(n=`typeof ${n} === "object" ? ${n} === null ? "null" : "object" : typeof ${n} === "function" ? "object" : typeof ${n}`);const r=this.discriminant.cases,o=Object.keys(r),{optimistic:u}=e;if(e.optimistic=!1,e.block(`switch(${n})`,()=>{for(const y in r){const g=r[y],b=y==="default"?y:`case ${y}`;let S;g===!0?S=u?"data":"true":u?g.rootApplyStrategy==="branchedOptimistic"?S=e.invoke(g,{kind:"Optimistic"}):g.contextFreeMorph?S=`${e.invoke(g)} ? ${en(g.contextFreeMorph)}(data) : "${ui}"`:S=`${e.invoke(g)} ? data : "${ui}"`:S=e.invoke(g),e.line(`${b}: return ${S}`)}return e}),e.traversalKind==="Allows"){e.return(u?`"${ui}"`:!1);return}const c=Do(this.discriminant.kind==="domain"?o.map(y=>{const g=y.slice(1,-1);return g==="function"?Ji.object:Ji[g]}):o),f=this.discriminant.path.map(y=>typeof y=="symbol"?en(y):JSON.stringify(y)),h=JSON.stringify(c),m=this.discriminant.kind==="domain"?`${Dj}[${n}]`:`${Nj}(${n})`;e.line(`ctx.errorFromNodeContext({
52
- code: "predicate",
53
- expected: ${h},
54
- actual: ${m},
55
- relativePath: [${f}],
56
- meta: ${this.compiledMeta}
57
- })`)}compileIndiscriminable(e){if(e.traversalKind==="Apply"){e.const("errors","[]");for(const n of this.branches)e.line("ctx.pushBranch()").line(e.invoke(n)).if("!ctx.hasError()",()=>e.return(n.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");e.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{const{optimistic:n}=e;e.optimistic=!1;for(const r of this.branches)e.if(`${e.invoke(r)}`,()=>e.return(n?r.contextFreeMorph?`${en(r.contextFreeMorph)}(data)`:"data":!0));e.return(n?`"${ui}"`:!1)}}get nestableExpression(){return this.isBoolean?"boolean":`(${this.expression})`}discriminate(){if(this.branches.length<2||this.isCyclic)return null;if(this.unitBranches.length===this.branches.length){const u=Ge(this.unitBranches,(c,f)=>[`${f.rawIn.serializedValue}`,f.hasKind("morph")?f:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:u}}const e=[];for(let u=0;u<this.branches.length-1;u++){const c=this.branches[u];for(let f=u+1;f<this.branches.length;f++){const h=this.branches[f],m=Qi(c.rawIn,h.rawIn,c.$);if(m instanceof ae)for(const y of m){if(!y.kind||y.optional)continue;let g,b;if(y.kind==="domain"){const x=y.l,T=y.r;g=`"${typeof x=="string"?x:x.domain}"`,b=`"${typeof T=="string"?T:T.domain}"`}else if(y.kind==="unit")g=y.l.serializedValue,b=y.r.serializedValue;else continue;const S=e.find(x=>Lo(x.path,y.path)&&x.kind===y.kind);S?(S.cases[g]?S.cases[g].branchIndices=Ss(S.cases[g].branchIndices,u):S.cases[g]??={branchIndices:[u],condition:y.l},S.cases[b]?S.cases[b].branchIndices=Ss(S.cases[b].branchIndices,f):S.cases[b]??={branchIndices:[f],condition:y.r}):e.push({kind:y.kind,cases:{[g]:{branchIndices:[u],condition:y.l},[b]:{branchIndices:[f],condition:y.r}},path:y.path})}}}const n=this.ordered?Cj(e,this.branches):e;if(!n.length)return null;const r=Rj(n,this),o={};for(const u in r.best.cases){const c=kj(r,u);if(c===null){o[u]=!0;continue}if(c.length===this.branches.length)return null;this.ordered&&c.sort((m,y)=>m.originalIndex-y.originalIndex);const f=c.map(m=>m.branch),h=f.length===1?f[0]:this.$.node("union",this.ordered?{branches:f,ordered:!0}:f);Object.assign(this.referencesById,h.referencesById),o[u]=h}if(r.defaultEntries.length){const u=r.defaultEntries.map(c=>c.branch);o.default=this.$.node("union",this.ordered?{branches:u,ordered:!0}:u,{prereduced:!0}),Object.assign(this.referencesById,o.default.referencesById)}return Object.assign(r.location,{cases:o})}}const Rj=(t,e)=>{const r=t.sort((c,f)=>c.path.length===f.path.length?Object.keys(f.cases).length-Object.keys(c.cases).length:c.path.length-f.path.length)[0],o={kind:r.kind,path:r.path,optionallyChainedPropString:WA(r.path)},u=e.branches.map((c,f)=>({originalIndex:f,branch:c}));return{best:r,location:o,defaultEntries:u,node:e}},kj=(t,e)=>{const n=t.best.cases[e],r=Mj(n.condition,t.location.path,t.node.$);let o=[];const u=[];for(let c=0;c<t.defaultEntries.length;c++){const f=t.defaultEntries[c];if(n.branchIndices.includes(f.originalIndex)){const h=Lw(t.node.branches[f.originalIndex],t.location);h===null?o=null:o?.push({originalIndex:f.originalIndex,branch:h})}else if(f.branch.hasKind("alias")&&r.hasKind("domain")&&r.domain==="object")o?.push(f);else{if(f.branch.rawIn.overlaps(r)){const h=Lw(f.branch,t.location);o?.push({originalIndex:f.originalIndex,branch:h})}u.push(f)}}return t.defaultEntries=u,o},Cj=(t,e)=>t.filter(r=>{const o=Object.values(r.cases).map(u=>u.branchIndices);for(let u=0;u<o.length-1;u++){const c=o[u];for(let f=u+1;f<o.length;f++){const h=o[f];for(const m of c)for(const y of h)if(m>y&&e[m].overlaps(e[y]))return!1}}return!0}),Mj=(t,e,n)=>{let r=t==="undefined"?n.node("unit",{unit:void 0}):t==="null"?n.node("unit",{unit:null}):t==="boolean"?n.units([!0,!1]):t;for(let o=e.length-1;o>=0;o--){const u=e[o];r=n.node("intersection",typeof u=="number"?{proto:"Array",sequence:[...nN(u).map(c=>({})),r]}:{domain:"object",required:[{key:u,value:r}]})}return r},WA=t=>t.reduce((e,n)=>e+bA(n,!0),"data"),Dj=en(sN),Nj=en(Ie),eE={implementation:Oj,Node:_j},$j=t=>({kind:t.kind,path:t.path.map(e=>typeof e=="string"?e:Fo(e)),cases:Ge(t.cases,(e,n)=>[e,n===!0?n:n.hasKind("union")&&n.discriminantJson?n.discriminantJson:n.json])}),jj={delimiter:" | ",finalDelimiter:" | "},Bj=t=>Do(t,jj),Do=(t,e)=>{const n=e?.delimiter??", ",r=e?.finalDelimiter??" or ";if(t.length===0)return"never";if(t.length===1)return t[0];if(t.length===2&&t[0]==="false"&&t[1]==="true"||t[0]==="true"&&t[1]==="false")return"boolean";const o={},u=t.filter(f=>o[f]?!1:o[f]=!0),c=u.pop();return`${u.join(n)}${u.length?r:""}${c}`},hp=(t,e,n)=>{const r=e.map(()=>[]);for(let u=0;u<t.length;u++){let c={};for(let f=0;f<e.length;f++){if(r[f]===null)continue;if(t[u].equals(e[f])){r[f]=null,c={};break}const h=Bt(t[u],e[f],n);if(!(h instanceof ae)){if(h.equals(t[u])){r[f].push(t[u]),c={};break}h.equals(e[f])?r[f]=null:c[f]=h}}for(const f in c)r[f][u]=c[f]}const o=r.flatMap((u,c)=>u?.flatMap(f=>f.branches)??e[c]);return o.length===0?ae.init("union",t,e):o},zj=({branches:t,ordered:e})=>{if(t.length<2)return t;const n=t.map(()=>!0);for(let r=0;r<t.length;r++)for(let o=r+1;o<t.length&&n[r]&&n[o];o++){if(t[r].equals(t[o])){n[o]=!1;continue}const u=Qi(t[r].rawIn,t[o].rawIn,t[0].$);u instanceof ae||(e||Lj(t[r],t[o]),u.equals(t[r].rawIn)?n[r]=!!e:u.equals(t[o].rawIn)&&(n[o]=!1))}return t.filter((r,o)=>n[o])},Lj=(t,e)=>{!t.includesTransform&&!e.includesTransform||(Lo(t.shallowMorphs,e.shallowMorphs)||Y(Vw(t.expression,e.expression)),Lo(t.flatMorphs,e.flatMorphs,{isEqual:(n,r)=>n.propString===r.propString&&(n.node.hasKind("morph")&&r.node.hasKind("morph")?n.node.hasEqualMorphs(r.node):n.node.hasKind("intersection")&&r.node.hasKind("intersection")?n.node.structure?.structuralMorphRef===r.node.structure?.structuralMorphRef:!1)})||Y(Vw(t.expression,e.expression)))},Lw=(t,e)=>t.transform((n,r)=>n==="domain"||n==="unit"?null:r,{shouldTransform:(n,r)=>{const o=WA(r.path);return e.optionallyChainedPropString.startsWith(o)?n.hasKind("domain")&&n.domain==="object"||(n.hasKind("domain")||e.kind==="unit")&&o===e.optionallyChainedPropString?!0:n.children.length!==0&&n.kind!=="index":!1}}),Vw=(t,e)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
58
- Left: ${t}
59
- Right: ${e}`,Vj=(t,e)=>`The intersection of two ordered unions is indeterminate:
60
- Left: ${t}
61
- Right: ${e}`,Uj=dt({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:t=>t instanceof Date?t.toISOString():Os(t)}},normalize:t=>t,defaults:{description:t=>Ie(t.unit),problem:({expected:t,actual:e})=>`${t===e?`must be reference equal to ${t} (serialized to the same value)`:`must be ${t} (was ${e})`}`},intersections:{unit:(t,e)=>ae.init("unit",t,e),...Ml("unit",(t,e)=>{if(e.allows(t.unit))return t;const n=e.hasKind("intersection")?e.basis:e;if(n){const r=n.hasKind("domain")?n:W.intrinsic.object;if(t.domain!==r.domain){const o=t.domain==="undefined"||t.domain==="null"||t.domain==="boolean"?t.domain:W.intrinsic[t.domain];return ae.init("domain",o,r)}}return ae.init("assignability",t,e.hasKind("intersection")?e.children.find(r=>!r.allows(t.unit)):e)})}});class Kj extends Ly{compiledValue=this.json.unit;serializedValue=typeof this.unit=="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=Uw(this.unit,this.serializedValue);compiledNegation=Uw(this.unit,this.serializedValue,"negated");expression=Ie(this.unit);domain=ei(this.unit);get defaultShortDescription(){return this.domain==="object"?Ji.object:this.description}innerToJsonSchema(e){return this.unit===null?{type:"null"}:W.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:e.fallback.unit({code:"unit",base:{},unit:this.unit})}traverseAllows=this.unit instanceof Date?e=>e instanceof Date&&e.toISOString()===this.compiledValue:Number.isNaN(this.unit)?e=>Number.isNaN(e):e=>e===this.unit}const tE={implementation:Uj,Node:Kj},Uw=(t,e,n)=>{if(t instanceof Date){const r=`data instanceof Date && data.toISOString() === ${e}`;return n?`!(${r})`:r}return Number.isNaN(t)?`${n?"!":""}Number.isNaN(data)`:`data ${n?"!":"="}== ${e}`},qj=dt({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(t,e)=>{const n=e.$.parseSchema(t);if(!n.extends(W.intrinsic.key))return Y(Hj(n.expression));const r=n.branches.filter(o=>o.hasKind("unit"));return r.length?Y(Ij(r.map(o=>Ie(o.unit)))):n}},value:{child:!0,parse:(t,e)=>e.$.parseSchema(t)}},normalize:t=>t,defaults:{description:t=>`[${t.signature.expression}]: ${t.value.description}`},intersections:{index:(t,e,n)=>{if(t.signature.equals(e.signature)){const r=Bt(t.value,e.value,n),o=r instanceof ae?W.intrinsic.never.internal:r;return n.$.node("index",{signature:t.signature,value:o})}return t.signature.extends(e.signature)&&t.value.subsumes(e.value)?e:e.signature.extends(t.signature)&&e.value.subsumes(t.value)?t:null}}});class Pj extends Go{impliedBasis=W.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=Fe(this.value.flatRefs.map(e=>Nr([this.signature,...e.path],e.node)),Nr([this.signature],this.value));traverseAllows=(e,n)=>Ic(e).every(r=>this.signature.traverseAllows(r[0],n)?Zi(r[0],()=>this.value.traverseAllows(r[1],n),n):!0);traverseApply=(e,n)=>{for(const r of Ic(e))this.signature.traverseAllows(r[0],n)&&Zi(r[0],()=>this.value.traverseApply(r[1],n),n)};_transform(e,n){n.path.push(this.signature);const r=super._transform(e,n);return n.path.pop(),r}compile(){}}const nE={implementation:qj,Node:Pj},Ij=t=>`Index keys ${t.join(", ")} should be specified as named props.`,Hj=t=>`Indexed key definition '${t}' must be a string or symbol`,Fj=dt({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(t,e)=>e.$.parseSchema(t)}},normalize:t=>t,defaults:{description:t=>`${t.compiledKey}: ${t.value.description}`,expected:t=>t.missingValueDescription,actual:()=>"missing"},intersections:{required:hm,optional:hm}});class Gj extends GA{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=Ef(this.errorContext)}const iE={implementation:Fj,Node:Gj},Yj=dt({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:(t,e)=>{if(t.length!==0)return t.map(n=>e.$.parseSchema(n))}},optionals:{child:!0,parse:(t,e)=>{if(t.length!==0)return t.map(n=>e.$.parseSchema(n))}},defaultables:{child:t=>t.map(e=>e[0]),parse:(t,e)=>{if(t.length!==0)return t.map(n=>{const r=e.$.parseSchema(n[0]);return By(r,n[1],null),[r,n[1]]})},serialize:t=>t.map(e=>[e[0].collapsibleJson,Os(e[1])]),reduceIo:(t,e,n)=>{if(t==="in"){e.optionals=n.map(r=>r[0].rawIn);return}e.prefix=n.map(r=>r[0].rawOut)}},variadic:{child:!0,parse:(t,e)=>e.$.parseSchema(t,e)},minVariadicLength:{parse:t=>t===0?void 0:t},postfix:{child:!0,parse:(t,e)=>{if(t.length!==0)return t.map(n=>e.$.parseSchema(n))}}},normalize:t=>{if(typeof t=="string")return{variadic:t};if("variadic"in t||"prefix"in t||"defaultables"in t||"optionals"in t||"postfix"in t||"minVariadicLength"in t){if(t.postfix?.length){if(!t.variadic)return Y(Wj);if(t.optionals?.length||t.defaultables?.length)return Y(sE)}return t.minVariadicLength&&!t.variadic?Y("minVariadicLength may not be specified without a variadic element"):t}return{variadic:t}},reduce:(t,e)=>{let n=t.minVariadicLength??0;const r=t.prefix?.slice()??[],o=t.defaultables?.slice()??[],u=t.optionals?.slice()??[],c=t.postfix?.slice()??[];if(t.variadic){for(;u[u.length-1]?.equals(t.variadic);)u.pop();if(u.length===0&&o.length===0)for(;r[r.length-1]?.equals(t.variadic);)r.pop(),n++;for(;c[0]?.equals(t.variadic);)c.shift(),n++}else u.length===0&&o.length===0&&r.push(...c.splice(0));if(n!==t.minVariadicLength||t.prefix&&t.prefix.length!==r.length)return e.node("sequence",{...t,prefix:r,defaultables:o,optionals:u,postfix:c,minVariadicLength:n},{prereduced:!0})},defaults:{description:t=>t.isVariadicOnly?`${t.variadic.nestableExpression}[]`:`[${t.tuple.map(n=>n.kind==="defaultables"?`${n.node.nestableExpression} = ${Ie(n.default)}`:n.kind==="optionals"?`${n.node.nestableExpression}?`:n.kind==="variadic"?`...${n.node.nestableExpression}[]`:n.node.expression).join(", ")}]`},intersections:{sequence:(t,e,n)=>{const r=Qa({l:t.tuple,r:e.tuple,disjoint:new ae,result:[],fixedVariants:[],ctx:n}),o=r.disjoint.length===0?[r,...r.fixedVariants]:r.fixedVariants;return o.length===0?r.disjoint:o.length===1?n.$.node("sequence",Kw(o[0].result)):n.$.node("union",o.map(u=>({proto:Array,sequence:Kw(u.result)})))}}});class Jj extends Go{impliedBasis=W.intrinsic.Array.internal;tuple=Qj(this.inner);prefixLength=this.prefix?.length??0;defaultablesLength=this.defaultables?.length??0;optionalsLength=this.optionals?.length??0;postfixLength=this.postfix?.length??0;defaultablesAndOptionals=[];prevariadic=this.tuple.filter(e=>e.kind==="defaultables"||e.kind==="optionals"?(this.defaultablesAndOptionals.push(e.node),!0):e.kind==="prefix");variadicOrPostfix=ys(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return Rw(this.flatRefs,this.prevariadic.flatMap((e,n)=>Fe(e.node.flatRefs.map(r=>Nr([`${n}`,...r.path],r.node)),Nr([`${n}`],e.node)))),Rw(this.flatRefs,this.variadicOrPostfix.flatMap(e=>Fe(e.flatRefs.map(n=>Nr([W.intrinsic.nonNegativeIntegerString.internal,...n.path],n.node)),Nr([W.intrinsic.nonNegativeIntegerString.internal],e)))),this.flatRefs}isVariadicOnly=this.prevariadic.length+this.postfixLength===0;minVariadicLength=this.inner.minVariadicLength??0;minLength=this.prefixLength+this.minVariadicLength+this.postfixLength;minLengthNode=this.minLength===0?null:this.$.node("minLength",this.minLength);maxLength=this.variadic?null:this.tuple.length;maxLengthNode=this.maxLength===null?null:this.$.node("maxLength",this.maxLength);impliedSiblings=this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[];defaultValueMorphs=Zj(this);defaultValueMorphsReference=this.defaultValueMorphs.length?en(this.defaultValueMorphs):void 0;elementAtIndex(e,n){if(n<this.prevariadic.length)return this.tuple[n];const r=e.length-this.postfixLength;return n>=r?{kind:"postfix",node:this.postfix[n-r]}:{kind:"variadic",node:this.variadic??_t(`Unexpected attempt to access index ${n} on ${this}`)}}traverseAllows=(e,n)=>{for(let r=0;r<e.length;r++)if(!this.elementAtIndex(e,r).node.traverseAllows(e[r],n))return!1;return!0};traverseApply=(e,n)=>{let r=0;for(;r<e.length;r++)Zi(r,()=>this.elementAtIndex(e,r).node.traverseApply(e[r],n),n)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile(e){if(this.prefix)for(const[n,r]of this.prefix.entries())e.traverseKey(`${n}`,`data[${n}]`,r);for(const[n,r]of this.defaultablesAndOptionals.entries()){const o=`${n+this.prefixLength}`;e.if(`${o} >= data.length`,()=>e.traversalKind==="Allows"?e.return(!0):e.return()),e.traverseKey(o,`data[${o}]`,r)}if(this.variadic&&(this.postfix&&e.const("firstPostfixIndex",`data.length${this.postfix?`- ${this.postfix.length}`:""}`),e.for(`i < ${this.postfix?"firstPostfixIndex":"data.length"}`,()=>e.traverseKey("i","data[i]",this.variadic),this.prevariadic.length),this.postfix))for(const[n,r]of this.postfix.entries()){const o=`firstPostfixIndex + ${n}`;e.traverseKey(o,`data[${o}]`,r)}e.traversalKind==="Allows"&&e.return(!0)}_transform(e,n){n.path.push(W.intrinsic.nonNegativeIntegerString.internal);const r=super._transform(e,n);return n.path.pop(),r}expression=this.description;reduceJsonSchema(e,n){const r=n.target==="draft-07";if(this.prevariadic.length){const o=this.prevariadic.map(u=>{const c=u.node.toJsonSchemaRecurse(n);if(u.kind==="defaultables"){const f=typeof u.default=="function"?u.default():u.default;c.default=W.intrinsic.jsonData.allows(f)?f:n.fallback.defaultValue({code:"defaultValue",base:c,value:f})}return c});r?e.items=o:e.prefixItems=o}if(this.minLength&&(e.minItems=this.minLength),this.variadic){const o=this.variadic.toJsonSchemaRecurse(n);if(r&&this.prevariadic.length?e.additionalItems=o:e.items=o,this.maxLength&&(e.maxItems=this.maxLength),this.postfix){const u=this.postfix.map(c=>c.toJsonSchemaRecurse(n));e=n.fallback.arrayPostfix({code:"arrayPostfix",base:e,elements:u})}}else r?e.additionalItems=!1:e.items=!1,delete e.maxItems;return e}}const Xj={},Zj=t=>{if(!t.defaultables)return[];const e=[];let n="[";const r=t.prefixLength+t.defaultablesLength-1;for(let o=t.prefixLength;o<=r;o++){const[u,c]=t.defaultables[o-t.prefixLength];e.push(JA(o,u,c)),n+=`${o}: ${u.id} = ${Os(c)}, `}return n+="]",Xj[n]??=e},rE={implementation:Yj,Node:Jj},Qj=t=>{const e=[];if(t.prefix)for(const n of t.prefix)e.push({kind:"prefix",node:n});if(t.defaultables)for(const[n,r]of t.defaultables)e.push({kind:"defaultables",node:n,default:r});if(t.optionals)for(const n of t.optionals)e.push({kind:"optionals",node:n});if(t.variadic&&e.push({kind:"variadic",node:t.variadic}),t.postfix)for(const n of t.postfix)e.push({kind:"postfix",node:n});return e},Kw=t=>t.reduce((e,n)=>(n.kind==="variadic"?e.variadic=n.node:n.kind==="defaultables"?e.defaultables=Fe(e.defaultables,[[n.node,n.default]]):e[n.kind]=Fe(e[n.kind],n.node),e),{}),sE="A postfix required element cannot follow an optional or defaultable element",Wj="A postfix element requires a variadic element",Qa=t=>{const[e,...n]=t.l,[r,...o]=t.r;if(!e||!r)return t;const u=n[n.length-1]?.kind==="postfix",c=o[o.length-1]?.kind==="postfix",f=e.kind==="prefix"||r.kind==="prefix"?"prefix":e.kind==="postfix"||r.kind==="postfix"?"postfix":e.kind==="variadic"&&r.kind==="variadic"?"variadic":u||c?"prefix":e.kind==="defaultables"||r.kind==="defaultables"?"defaultables":"optionals";if(e.kind==="prefix"&&r.kind==="variadic"&&c){const g=Qa({...t,fixedVariants:[],r:o.map(b=>({...b,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}else if(r.kind==="prefix"&&e.kind==="variadic"&&u){const g=Qa({...t,fixedVariants:[],l:n.map(b=>({...b,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}const h=Bt(e.node,r.node,t.ctx);if(h instanceof ae)if(f==="prefix"||f==="postfix")t.disjoint.push(...h.withPrefixKey(f==="prefix"?t.result.length:`-${n.length+1}`,qw(e)&&qw(r)?"required":"optional")),t.result=[...t.result,{kind:f,node:W.intrinsic.never.internal}];else return f==="optionals"||f==="defaultables"?t:Qa({...t,fixedVariants:[],l:n.map(g=>({...g,kind:"prefix"})),r:n.map(g=>({...g,kind:"prefix"}))});else f==="defaultables"?(e.kind==="defaultables"&&r.kind==="defaultables"&&e.default!==r.default&&Y(YA(e.default,r.default)),t.result=[...t.result,{kind:f,node:h,default:e.kind==="defaultables"?e.default:r.kind==="defaultables"?r.default:_t(`Unexpected defaultable intersection from ${e.kind} and ${r.kind} elements.`)}]):t.result=[...t.result,{kind:f,node:h}];const m=t.l.length,y=t.r.length;return(e.kind!=="variadic"||m>=y&&(r.kind==="variadic"||y===1))&&(t.l=n),(r.kind!=="variadic"||y>=m&&(e.kind==="variadic"||m===1))&&(t.r=o),Qa(t)},qw=t=>t.kind==="prefix"||t.kind==="postfix",oE=t=>e=>{if(e.props.length||e.index){const n=e.index?.map(o=>o[t])??[];for(const o of e.props)n.push(o[t]);e.undeclared&&n.push(`+ (undeclared): ${e.undeclared}`);const r=`{ ${n.join(", ")} }`;return e.sequence?`${r} & ${e.sequence.description}`:r}return e.sequence?.description??"{}"},e3=oE("description"),t3=oE("expression"),Pw=(t,e,n)=>{const r=t.required?"required":"optional";if(!e.signature.allows(t.key))return null;const o=Qi(t.value,e.value,n);return o instanceof ae?r==="optional"?n.node("optional",{key:t.key,value:W.intrinsic.never.internal}):o.withPrefixKey(t.key,t.kind):null},n3=dt({kind:"structure",hasAssociatedError:!1,normalize:t=>t,applyConfig:(t,e)=>!t.undeclared&&e.onUndeclaredKey!=="ignore"?{...t,undeclared:e.onUndeclaredKey}:t,keys:{required:{child:!0,parse:un("required"),reduceIo:(t,e,n)=>{e.required=Fe(e.required,n.map(r=>t==="in"?r.rawIn:r.rawOut))}},optional:{child:!0,parse:un("optional"),reduceIo:(t,e,n)=>{if(t==="in"){e.optional=n.map(r=>r.rawIn);return}for(const r of n)e[r.outProp.kind]=Fe(e[r.outProp.kind],r.outProp.rawOut)}},index:{child:!0,parse:un("index")},sequence:{child:!0,parse:un("sequence")},undeclared:{parse:t=>t==="ignore"?void 0:t,reduceIo:(t,e,n)=>{if(n==="reject"){e.undeclared="reject";return}t==="in"?delete e.undeclared:e.undeclared="reject"}}},defaults:{description:e3},intersections:{structure:(t,e,n)=>{const r={...t.inner},o={...e.inner},u=new ae;if(t.undeclared){const h=t.keyof();for(const m of e.requiredKeys)h.allows(m)||u.add("presence",W.intrinsic.never.internal,e.propsByKey[m].value,{path:[m]});o.optional&&(o.optional=o.optional.filter(m=>h.allows(m.key))),o.index&&(o.index=o.index.flatMap(m=>{if(m.signature.extends(h))return m;const y=Qi(h,m.signature,n.$);if(y instanceof ae)return[];const g=pm(y,m.value,n.$);return g.required&&(o.required=ys(o.required,g.required)),g.optional&&(o.optional=ys(o.optional,g.optional)),g.index??[]}))}if(e.undeclared){const h=e.keyof();for(const m of t.requiredKeys)h.allows(m)||u.add("presence",t.propsByKey[m].value,W.intrinsic.never.internal,{path:[m]});r.optional&&(r.optional=r.optional.filter(m=>h.allows(m.key))),r.index&&(r.index=r.index.flatMap(m=>{if(m.signature.extends(h))return m;const y=Qi(h,m.signature,n.$);if(y instanceof ae)return[];const g=pm(y,m.value,n.$);return g.required&&(r.required=ys(r.required,g.required)),g.optional&&(r.optional=ys(r.optional,g.optional)),g.index??[]}))}const c={};(t.undeclared||e.undeclared)&&(c.undeclared=t.undeclared==="reject"||e.undeclared==="reject"?"reject":"delete");const f=Yc({kind:"structure",baseInner:c,l:Jc(r),r:Jc(o),roots:[],ctx:n});return f instanceof ae&&u.push(...f),u.length?u:f}},reduce:(t,e)=>{if(!t.required&&!t.optional)return;const n={};let r=!1;const o=t.optional?[...t.optional]:[];if(t.required)for(let u=0;u<t.required.length;u++){const c=t.required[u];if(c.key in n&&Y(Hw(c.key)),n[c.key]=!0,t.index)for(const f of t.index){const h=Pw(c,f,e);if(h instanceof ae)return h}}if(t.optional)for(let u=0;u<t.optional.length;u++){const c=t.optional[u];if(c.key in n&&Y(Hw(c.key)),n[c.key]=!0,t.index)for(const f of t.index){const h=Pw(c,f,e);if(h instanceof ae)return h;h!==null&&(o[u]=h,r=!0)}}if(r)return e.node("structure",{...t,optional:o},{prereduced:!0})}});class i3 extends Go{impliedBasis=W.intrinsic.object.internal;impliedSiblings=this.children.flatMap(e=>e.impliedSiblings??[]);props=ys(this.required,this.optional);propsByKey=Ge(this.props,(e,n)=>[n.key,n]);propsByKeyReference=en(this.propsByKey);expression=t3(this);requiredKeys=this.required?.map(e=>e.key)??[];optionalKeys=this.optional?.map(e=>e.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let e=this.$.units(this.literalKeys).branches;if(this.index)for(const{signature:n}of this.index)e=e.concat(n.branches);return this._keyof=this.$.node("union",e)}map(e){return this.$.node("structure",this.props.flatMap(e).reduce((n,r)=>{const o=this.propsByKey[r.key];if(Qt(r))return r.kind!=="required"&&r.kind!=="optional"?Y(`Map result must have kind "required" or "optional" (was ${r.kind})`):(n[r.kind]=Fe(n[r.kind],r),n);const u=r.kind??o?.kind??"required",c=Ge(r,(f,h)=>f in jy.implementation.keys?[f,h]:[]);return n[u]=Fe(n[u],this.$.node(u,c)),n},{}))}assertHasKeys(e){const n=e.filter(r=>!lc(r,this.keyof()));if(n.length)return Y(Iw(this.expression,n))}get(e,...n){let r,o=!1;const u=a3(e);if((typeof u=="string"||typeof u=="symbol")&&this.propsByKey[u]&&(r=this.propsByKey[u].value,o=this.propsByKey[u].required),this.index)for(const f of this.index)lc(u,f.signature)&&(r=r?.and(f.value)??f.value);if(this.sequence&&lc(u,W.intrinsic.nonNegativeIntegerString))if(fe(u,"root"))this.sequence.variadic&&(r=r?.and(this.sequence.element)??this.sequence.element);else{const f=Number.parseInt(u);if(f<this.sequence.prevariadic.length){const h=this.sequence.prevariadic[f].node;r=r?.and(h)??h,o||=f<this.sequence.prefixLength}else if(this.sequence.variadic){const h=this.$.node("union",this.sequence.variadicOrPostfix);r=r?.and(h)??h}}if(!r)return this.sequence?.variadic&&fe(u,"root")&&u.extends(W.intrinsic.number)?Y(l3(u.expression,this.sequence.expression)):Y(Iw(this.expression,[u]));const c=r.get(...n);return o?c:c.or(W.intrinsic.undefined)}pick(...e){return this.assertHasKeys(e),this.$.node("structure",this.filterKeys("pick",e))}omit(...e){return this.assertHasKeys(e),this.$.node("structure",this.filterKeys("omit",e))}optionalize(){const{required:e,...n}=this.inner;return this.$.node("structure",{...n,optional:this.props.map(r=>r.hasKind("required")?this.$.node("optional",r.inner):r)})}require(){const{optional:e,...n}=this.inner;return this.$.node("structure",{...n,required:this.props.map(r=>r.hasKind("optional")?{key:r.key,value:r.value}:r)})}merge(e){const n=this.filterKeys("omit",[e.keyof()]);return e.required&&(n.required=Fe(n.required,e.required)),e.optional&&(n.optional=Fe(n.optional,e.optional)),e.index&&(n.index=Fe(n.index,e.index)),e.sequence&&(n.sequence=e.sequence),e.undeclared?n.undeclared=e.undeclared:delete n.undeclared,this.$.node("structure",n)}filterKeys(e,n){const r=wA(this.inner),o=u=>{const c=n.some(f=>lc(u,f));return e==="pick"?c:!c};return r.required&&(r.required=r.required.filter(u=>o(u.key))),r.optional&&(r.optional=r.optional.filter(u=>o(u.key))),r.index&&(r.index=r.index.filter(u=>o(u.signature))),r}traverseAllows=(e,n)=>this._traverse("Allows",e,n);traverseApply=(e,n)=>this._traverse("Apply",e,n);_traverse=(e,n,r)=>{const o=r?.currentErrorCount??0;for(let u=0;u<this.props.length;u++)if(e==="Allows"){if(!this.props[u].traverseAllows(n,r))return!1}else if(this.props[u].traverseApply(n,r),r.failFast&&r.currentErrorCount>o)return!1;if(this.sequence){if(e==="Allows"){if(!this.sequence.traverseAllows(n,r))return!1}else if(this.sequence.traverseApply(n,r),r.failFast&&r.currentErrorCount>o)return!1}if(this.index||this.undeclared==="reject"){const u=Object.keys(n);u.push(...Object.getOwnPropertySymbols(n));for(let c=0;c<u.length;c++){const f=u[c];if(this.index){for(const h of this.index)if(h.signature.traverseAllows(f,r)){if(e==="Allows"){if(!Zi(f,()=>h.value.traverseAllows(n[f],r),r))return!1}else if(Zi(f,()=>h.value.traverseApply(n[f],r),r),r.failFast&&r.currentErrorCount>o)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(f)&&(e==="Allows"||(r.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[f],meta:this.meta}),r.failFast)))return!1}}return this.structuralMorph&&r&&!r.hasError()&&r.queueMorphs([this.structuralMorph]),!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter(e=>e.hasDefault())??[])}declaresKey=e=>e in this.propsByKey||this.index?.some(n=>n.signature.allows(e))||this.sequence!==void 0&&W.intrinsic.nonNegativeIntegerString.allows(e);_compileDeclaresKey(e){const n=[];if(this.props.length&&n.push(`k in ${this.propsByKeyReference}`),this.index)for(const r of this.index)n.push(e.invoke(r.signature,{kind:"Allows",arg:"k"}));return this.sequence&&n.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)"),n.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",s3(this))}structuralMorphRef=this.structuralMorph&&en(this.structuralMorph);compile(e){e.traversalKind==="Apply"&&e.initializeErrorCount();for(const n of this.props)e.check(n),e.traversalKind==="Apply"&&e.returnIfFailFast();if(this.sequence&&(e.check(this.sequence),e.traversalKind==="Apply"&&e.returnIfFailFast()),(this.index||this.undeclared==="reject")&&(e.const("keys","Object.keys(data)"),e.line("keys.push(...Object.getOwnPropertySymbols(data))"),e.for("i < keys.length",()=>this.compileExhaustiveEntry(e))),e.traversalKind==="Allows")return e.return(!0);this.structuralMorphRef&&e.if("ctx && !ctx.hasError()",()=>(e.line("ctx.queueMorphs(["),o3(e,this),e.line("])")))}compileExhaustiveEntry(e){if(e.const("k","keys[i]"),this.index)for(const n of this.index)e.if(`${e.invoke(n.signature,{arg:"k",kind:"Allows"})}`,()=>e.traverseKey("k","data[k]",n.value));return this.undeclared==="reject"&&e.if(`!(${this._compileDeclaresKey(e)})`,()=>e.traversalKind==="Allows"?e.return(!1):e.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if("ctx.failFast",()=>e.return())),e}reduceJsonSchema(e,n){switch(e.type){case"object":return this.reduceObjectJsonSchema(e,n);case"array":const r=this.sequence?.reduceJsonSchema(e,n)??e;return this.props.length||this.index?n.fallback.arrayObject({code:"arrayObject",base:r,object:this.reduceObjectJsonSchema({type:"object"},n)}):r;default:return Mt.throwInternalOperandError("structure",e)}}reduceObjectJsonSchema(e,n){if(this.props.length){e.properties={};for(const r of this.props){const o=r.value.toJsonSchemaRecurse(n);if(typeof r.key=="symbol"){n.fallback.symbolKey({code:"symbolKey",base:e,key:r.key,value:o,optional:r.optional});continue}if(r.hasDefault()){const u=typeof r.default=="function"?r.default():r.default;o.default=W.intrinsic.jsonData.allows(u)?u:n.fallback.defaultValue({code:"defaultValue",base:o,value:u})}e.properties[r.key]=o}this.requiredKeys.length&&e.properties&&(e.required=this.requiredKeys.filter(r=>typeof r=="string"&&r in e.properties))}if(this.index)for(const r of this.index){const o=r.value.toJsonSchemaRecurse(n);if(r.signature.equals(W.intrinsic.string)){e.additionalProperties=o;continue}for(const u of r.signature.branches){if(!u.extends(W.intrinsic.string)){e=n.fallback.symbolKey({code:"symbolKey",base:e,key:null,value:o,optional:!1});continue}let c={type:"string"};if(u.hasKind("morph")&&(c=n.fallback.morph({code:"morph",base:u.rawIn.toJsonSchemaRecurse(n),out:u.rawOut.toJsonSchemaRecurse(n)})),!u.hasKind("intersection"))return _t(`Unexpected index branch kind ${u.kind}.`);const{pattern:f}=u.inner;if(f){const h=Object.assign(c,{pattern:f[0].rule});for(let m=1;m<f.length;m++)c=n.fallback.patternIntersection({code:"patternIntersection",base:h,pattern:f[m].rule});e.patternProperties??={},e.patternProperties[h.pattern]=o}}}return this.undeclared&&!e.additionalProperties&&(e.additionalProperties=!1),e}}const pp={},r3=t=>{let e="";for(let n=0;n<t.defaultable.length;n++)e+=t.defaultable[n].defaultValueMorphRef;if(t.sequence?.defaultValueMorphsReference&&(e+=t.sequence?.defaultValueMorphsReference),t.undeclared==="delete"){if(e+="delete !(",t.required)for(const n of t.required)e+=n.compiledKey+" | ";if(t.optional)for(const n of t.optional)e+=n.compiledKey+" | ";if(t.index)for(const n of t.index)e+=n.signature.id+" | ";if(t.sequence)if(t.sequence.maxLength===null)e+=me.nonNegativeIntegerString.id;else for(let n=0;n<t.sequence.tuple.length;n++)e+=n+" | ";e+=")"}return e},s3=t=>{const e=r3(t);if(!e)return;if(pp[e])return pp[e];const n=(r,o)=>{for(let u=0;u<t.defaultable.length;u++)t.defaultable[u].key in r||t.defaultable[u].defaultValueMorph(r,o);if(t.sequence?.defaultables)for(let u=r.length-t.sequence.prefixLength;u<t.sequence.defaultables.length;u++)t.sequence.defaultValueMorphs[u](r,o);if(t.undeclared==="delete")for(const u in r)t.declaresKey(u)||delete r[u];return r};return pp[e]=n},o3=(t,e)=>{const r=`(data${e.defaultable.some(o=>o.defaultValueMorph.length===2)||e.sequence?.defaultValueMorphs.some(o=>o.length===2)?", ctx":""})`;return t.block(`${r} => `,o=>{for(let u=0;u<e.defaultable.length;u++){const{serializedKey:c,defaultValueMorphRef:f}=e.defaultable[u];o.if(`!(${c} in data)`,h=>h.line(`${f}${r}`))}return e.sequence?.defaultables&&o.for(`i < ${e.sequence.defaultables.length}`,u=>u.set("data[i]",5),`data.length - ${e.sequence.prefixLength}`),e.undeclared==="delete"&&o.forIn("data",u=>u.if(`!(${e._compileDeclaresKey(u)})`,c=>c.line("delete data[k]"))),o.return("data")})},aE={implementation:n3,Node:i3},a3=t=>(fe(t,"root")&&t.hasKind("unit")&&(t=t.unit),typeof t=="number"&&(t=`${t}`),t),l3=(t,e)=>`${t} is not allowed as an array index on ${e}. Use the 'nonNegativeIntegerString' keyword instead.`,pm=(t,e,n)=>{const[r,o]=tN(t.branches,c=>c.hasKind("unit"));if(!r.length)return{index:n.node("index",{signature:t,value:e})};const u={};for(const c of r){const f=n.node("required",{key:c.unit,value:e});u[f.kind]=Fe(u[f.kind],f)}return o.length&&(u.index=n.node("index",{signature:o,value:e})),u},u3=t=>fe(t,"root")?t.expression:Ie(t),Iw=(t,e)=>`Key${e.length===1?"":"s"} ${e.map(u3).join(", ")} ${e.length===1?"does":"do"} not exist on ${t}`,Hw=t=>`Duplicate key ${Fo(t)}`,_f={...X$,alias:zy.implementation,domain:Vy.implementation,unit:tE.implementation,proto:Zc.implementation,union:eE.implementation,morph:QA.implementation,intersection:ZA.implementation,divisor:DA.implementation,pattern:IA.implementation,predicate:MA.implementation,required:iE.implementation,optional:jy.implementation,index:nE.implementation,sequence:rE.implementation,structure:aE.implementation};W.defaultConfig=hN(Object.assign(Ge(_f,(t,e)=>[t,e.defaults]),{jitless:TN(),clone:SN,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:Mt.defaultConfig}));W.resolvedConfig=um(W.defaultConfig,W.config);const c3={...Z$,alias:zy.Node,domain:Vy.Node,unit:tE.Node,proto:Zc.Node,union:eE.Node,morph:QA.Node,intersection:ZA.Node,divisor:DA.Node,pattern:IA.Node,predicate:MA.Node,required:iE.Node,optional:jy.Node,index:nE.Node,sequence:rE.Node,structure:aE.Node};class mm extends uN{get[Xi](){return"module"}}const lE=(t,e)=>new mm(Ge(t,(n,r)=>[n,fe(r,"module")?lE(r,e):e.bindReference(r)])),f3=t=>Xt(t)?t:"branches"in t&&Xt(t.branches)?t.branches:void 0,d3=(t,e)=>Y(`Node of kind ${e} is not valid as a ${t} definition`),Fw=t=>`#${t} duplicates public alias ${t}`,mp={};W.ambient??={};let Gw;const uE="function $",h3=t=>cE(t,fE(t)),cE=(t,e)=>{const n=e.write(uE,4),r=e.compile()();for(const o of t)o.precompilation||(o.traverseAllows=r[`${o.id}Allows`].bind(r),o.isRoot()&&!o.allowsRequiresContext&&(o.allows=o.traverseAllows),o.traverseApply=r[`${o.id}Apply`].bind(r),r[`${o.id}Optimistic`]&&(o.traverseOptimistic=r[`${o.id}Optimistic`].bind(r)),o.precompilation=n)},fE=t=>new vA().return(t.reduce((e,n)=>{const r=new dp({kind:"Allows"}).indent();n.compile(r);const o=r.write(`${n.id}Allows`),u=new dp({kind:"Apply"}).indent();n.compile(u);const c=u.write(`${n.id}Apply`),f=`${e}${o},
62
- ${c},
63
- `;if(!n.hasKind("union"))return f;const h=new dp({kind:"Allows",optimistic:!0}).indent();n.compile(h);const m=h.write(`${n.id}Optimistic`);return`${f}${m},
64
- `},`{
65
- `)+"}");class dE{config;resolvedConfig;name;get[Xi](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,n){this.config=um(W.config,n),this.resolvedConfig=um(W.resolvedConfig,n),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(mp).length}`,this.name in mp&&Y(`A Scope already named ${this.name} already exists`),mp[this.name]=this;const r=Object.entries(e).map(o=>this.preparseOwnAliasEntry(...o));for(const[o,u]of r){let c=o;if(o[0]==="#"?(c=o.slice(1),c in this.aliases&&Y(Fw(c)),this.aliases[c]=u):(c in this.aliases&&Y(Fw(o)),this.aliases[c]=u,this.exportedNames.push(c)),!fe(u,"module")&&!fe(u,"generic")&&!wf(u)){const f=this.preparseOwnDefinitionFormat(u,{alias:c});this.resolutions[c]=fe(f,"root")?this.bindReference(f):this.createParseContext(f).id}}Gw??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[Gw.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=W.intrinsic?Ge(W.intrinsic,(o,u)=>o.startsWith("json")?[]:[o,this.bindReference(u)]):{}}cacheGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}get internal(){return this}_json;get json(){return this._json||this.export(),this._json}defineSchema(e){return e}generic=(...e)=>{const n=this;return(r,o)=>new Xc(e,o?new CA(r):r,n,n,o??null)};units=(e,n)=>{const r=[];for(const u of e)r.includes(u)||r.push(u);const o=r.map(u=>this.node("unit",{unit:u},n));return this.node("union",o,{...n,prereduced:!0})};lazyResolutions=[];lazilyResolve(e,n){const r=this.node("alias",{reference:n??"synthetic",resolve:e},{prereduced:!0});return this.resolved||this.lazyResolutions.push(r),r}schema=(e,n)=>this.finalize(this.parseSchema(e,n));parseSchema=(e,n)=>this.node(xc(e),e,n);preparseNode(e,n,r){let o=typeof e=="string"?e:xc(n,e);if(Qt(n)&&n.kind===o)return n;if(o==="alias"&&!r?.prereduced){const{reference:f}=zy.implementation.normalize(n,this);if(f.startsWith("$")){const h=this.resolveRoot(f.slice(1));n=h,o=h.kind}}else if(o==="union"&&Cs(n,"object")){const f=f3(n);f?.length===1&&(n=f[0],o=xc(n))}if(Qt(n)&&n.kind===o)return n;const c=_f[o].normalize?.(n,this)??n;return Qt(c)?c.kind===o?c:d3(o,c.kind):{...r,$:this,kind:o,def:c,prefix:r.alias??o}}bindReference(e){let n;return Qt(e)?n=e.$===this?e:new e.constructor(e.attachments,this):n=e.$===this?e:new Xc(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(e){return this.maybeResolveRoot(e)??Y(yE(e))}maybeResolveRoot(e){const n=this.maybeResolve(e);if(!fe(n,"generic"))return n}maybeResolveSubalias(e){return ym(this.aliases,e)??ym(this.ambient,e)}get ambient(){return W.ambient}maybeResolve(e){const n=this.resolutions[e];if(n){if(typeof n!="string")return this.bindReference(n);const o=Ln[n];if(fe(o,"root"))return this.resolutions[e]=o;if(fe(o,"context")){if(o.phase==="resolving")return this.node("alias",{reference:`$${e}`},{prereduced:!0});if(o.phase==="resolved")return _t(`Unexpected resolved context for was uncached by its scope: ${Ie(o)}`);o.phase="resolving";const u=this.bindReference(this.parseOwnDefinitionFormat(o.def,o));return o.phase="resolved",Ln[u.id]=u,Ln[o.id]=u,this.resolutions[e]=u}return _t(`Unexpected nodesById entry for ${n}: ${Ie(o)}`)}let r=this.aliases[e]??this.ambient?.[e];return r?(r=this.normalizeRootScopeValue(r),fe(r,"generic")?this.resolutions[e]=this.bindReference(r):fe(r,"module")?(r.root||Y(gE(e)),this.resolutions[e]=this.bindReference(r.root)):this.resolutions[e]=this.parse(r,{alias:e})):this.maybeResolveSubalias(e)}createParseContext(e){const n=e.id??HA(e.prefix);return Ln[n]=Object.assign(e,{[Xi]:"context",$:this,id:n,phase:"unresolved"})}traversal(e){return new To(e,this.resolvedConfig)}import(...e){return new mm(Ge(this.export(...e),(n,r)=>[`#${n}`,r]))}precompilation;_exportedResolutions;_exports;export(...e){if(!this._exports){this._exports={};for(const r of this.exportedNames){const o=this.aliases[r];this._exports[r]=fe(o,"module")?lE(o,this):Yw(this.maybeResolve(r))}for(const r of this.lazyResolutions)r.resolution;if(this._exportedResolutions=mE(this,this._exports),this._json=pE(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const r=fE(this.references);this.precompilation=r.write(uE,4),cE(this.references,r)}this.resolved=!0}const n=e.length?e:this.exportedNames;return new mm(Ge(n,(r,o)=>[o,this._exports[o]]))}resolve(e){return this.export()[e]}node=(e,n,r={})=>{const o=this.preparseNode(e,n,r);if(Qt(o))return this.bindReference(o);const u=this.createParseContext(o),c=FA(u),f=this.bindReference(c);return Ln[u.id]=f};parse=(e,n={})=>this.finalize(this.parseDefinition(e,n));parseDefinition(e,n={}){if(fe(e,"root"))return this.bindReference(e);const r=this.preparseOwnDefinitionFormat(e,n);if(fe(r,"root"))return this.bindReference(r);const o=this.createParseContext(r);Ln[o.id]=o;let u=this.bindReference(this.parseOwnDefinitionFormat(e,o));return u.isCyclic&&(u=nj(u,o.id)),Ln[o.id]=u,u}finalize(e){return Yw(e),!e.precompilation&&!this.resolvedConfig.jitless&&h3(e.references),e}}class hE extends dE{parseOwnDefinitionFormat(e,n){return FA(n)}preparseOwnDefinitionFormat(e,n){return this.preparseNode(xc(e),e,n)}preparseOwnAliasEntry(e,n){return[e,n]}normalizeRootScopeValue(e){return e}}const Yw=t=>{const e=t.references.filter(n=>n.hasKind("alias"));for(const n of e){Object.assign(n.referencesById,n.resolution.referencesById);for(const r of t.references)n.id in r.referencesById&&Object.assign(r.referencesById,n.referencesById)}return t},pE=t=>Ge(t,(e,n)=>[e,fe(n,"root")||fe(n,"generic")?n.json:fe(n,"module")?pE(n):_t(`Unexpected resolution ${Ie(n)}`)]),ym=(t,e)=>{const n=e.indexOf(".");if(n===-1)return;const r=e.slice(0,n),o=t[r];if(o===void 0)return;if(!fe(o,"module"))return Y(p3(r));const u=e.slice(n+1),c=o[u];if(c===void 0)return ym(o,u);if(fe(c,"root")||fe(c,"generic"))return c;if(fe(c,"module"))return c.root??Y(gE(e));_t(`Unexpected resolution for alias '${e}': ${Ie(c)}`)},Uy=(t,e)=>new hE(t,e),Dl=new hE({}),mE=(t,e)=>{const n={};for(const r in e){const o=e[r];if(fe(o,"module")){const u=mE(t,o),c=Ge(u,(f,h)=>[`${r}.${f}`,h]);Object.assign(n,c)}else fe(o,"root")||fe(o,"generic")?n[r]=o:_t(`Unexpected scope resolution ${Ie(o)}`)}return n},yE=t=>`'${t}' is unresolvable`,p3=t=>`'${t}' must reference a module to be accessed using dot syntax`,gE=t=>`Reference to submodule '${t}' must specify an alias`;Dl.export();const Ye=Dl.schema,Ky=Dl.node;Dl.defineSchema;const tr=Dl.generic,vE="^(?:0|[1-9]\\d*)$",m3=new RegExp(vE);en(m3);const bE=Uy({bigint:"bigint",boolean:[{unit:!1},{unit:!0}],false:{unit:!1},never:[],null:{unit:null},number:"number",object:"object",string:"string",symbol:"symbol",true:{unit:!0},unknown:{},undefined:{unit:void 0},Array,Date},{prereducedAliases:!0}).export();W.intrinsic={...bE};const SE=Uy({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:vE}},{prereducedAliases:!0}).export();Object.assign(W.intrinsic,SE);const y3=Uy({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),me={...bE,...SE,...y3,emptyStructure:Ky("structure",{},{prereduced:!0})};W.intrinsic={...me};const Jw=((t,e)=>new RegExp(t,e));Object.assign(Jw,{as:Jw});const g3=t=>typeof t=="string"&&t[0]==="d"&&(t[1]==="'"||t[1]==='"')&&t[t.length-1]===t[1],Xw=t=>t.toString()!=="Invalid Date",v3=t=>t.slice(2,-1),wE=t=>`'${t}' could not be parsed by the Date constructor`,b3=(t,e)=>S3(t,e),S3=(t,e)=>{const n=new Date(t);if(Xw(n))return n;const r=qN(t);if(r!==void 0){const o=new Date(r);if(Xw(o))return o}return e?Y(e===!0?wE(t):e):void 0},w3=Ye({proto:"Array",sequence:"string",required:{key:"groups",value:["object",{unit:void 0}]}}),yp=(t,e)=>{const n=t.scanner.shiftUntilEscapable(A3[AE[e]]);if(t.scanner.lookahead==="")return t.error(O3(n,e));if(t.scanner.shift(),e in TE){let r;try{r=new RegExp(n)}catch(o){Y(String(o))}t.root=t.ctx.$.node("intersection",{domain:"string",pattern:n},{prereduced:!0}),e==="x/"&&(t.root=t.ctx.$.node("morph",{in:t.root,morphs:o=>r.exec(o),declaredOut:w3}))}else if(Si(e,xE))t.root=t.ctx.$.node("unit",{unit:n});else{const r=b3(n,wE(n));t.root=t.ctx.$.node("unit",{meta:n,unit:r})}},xE={"'":1,'"':1},x3={"/":1,"'":1,'"':1},T3={"d'":"'",'d"':'"',"'":"'",'"':'"'},TE={"/":"/","x/":"/"},AE={...T3,...TE},A3={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},E3={'"':"double-quote","'":"single-quote","/":"forward slash"},O3=(t,e)=>`${e}${t} requires a closing ${E3[AE[e]]}`,_3=t=>`Private type references should not include '#'. Use '${t}' instead.`,EE="Optional definitions like 'string?' are only valid as properties in an object or tuple",OE="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple",Jo={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...xf},R3=(t,e)=>t===">"?e[0]==="="?e[1]==="=":e.trimStart()===""||Si(e.trimStart()[0],Jo):t==="="?e[0]!=="=":t===","||t==="?",k3=(t,e,n)=>_E(t,e,n,[]),_E=(t,e,n,r)=>{const o=n.parseUntilFinalizer();return r.push(o.root),o.finalizer===">"?r.length!==e.params.length?n.error(RE(t,e.names,r.map(u=>u.expression))):r:o.finalizer===","?_E(t,e,n,r):o.error(yA(">"))},RE=(t,e,n)=>`${t}<${e.join(", ")}> requires exactly ${e.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,gp=t=>{const e=t.scanner.shiftUntilLookahead(Jo);e==="keyof"?t.addPrefix("keyof"):t.root=M3(t,e)},C3=(t,e,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(RE(t,e.names,[]));const o=k3(t,e,n);return e(...o)},M3=(t,e)=>D3(t,e)??N3(t,e)??t.error(e===""?t.scanner.lookahead==="#"?_3(t.shiftedBy(1).scanner.shiftUntilLookahead(Jo)):kE(t):yE(e)),D3=(t,e)=>{if(t.ctx.args?.[e]){const r=t.ctx.args[e];return typeof r!="string"?r:t.ctx.$.node("alias",{reference:r},{prereduced:!0})}const n=t.ctx.$.maybeResolve(e);if(fe(n,"root"))return n;if(n!==void 0)return fe(n,"generic")?C3(e,n,t):Y(`Unexpected resolution ${Ie(n)}`)},N3=(t,e)=>{const n=PN(e);if(n!==void 0)return t.ctx.$.node("unit",{unit:n});const r=HN(e);if(r!==void 0)return t.ctx.$.node("unit",{unit:r})},kE=t=>{const e=t.previousOperator();return e?CE(e,t.scanner.unscanned):$3(t.scanner.unscanned)},CE=(t,e="")=>`Token '${t}' requires a right operand${e?` before '${e}'`:""}`,$3=t=>`Expected an expression${t?` before '${t}'`:""}`,ME=t=>t.scanner.lookahead===""?t.error(kE(t)):t.scanner.lookahead==="("?t.shiftedBy(1).reduceGroupOpen():t.scanner.lookaheadIsIn(x3)?yp(t,t.scanner.shift()):t.scanner.lookaheadIsIn(xf)?ME(t.shiftedBy(1)):t.scanner.lookahead==="d"?t.scanner.nextLookahead in xE?yp(t,`${t.scanner.shift()}${t.scanner.shift()}`):gp(t):t.scanner.lookahead==="x"&&t.scanner.nextLookahead==="/"?t.shiftedBy(2)&&yp(t,"x/"):gp(t),j3={">":!0,">=":!0},B3={"<":!0,"<=":!0},Qc={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},z3=(t,e)=>`Left bounds are only valid when paired with right bounds (try ...${e}${t})`,DE=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,L3=(t,e,n,r)=>`An expression may have at most one left bound (parsed ${t}${Qc[e]}, ${n}${Qc[r]})`,V3=(t,e)=>{const n=K3(t,e);if(t.root.hasKind("unit")){if(typeof t.root.unit=="number"){t.reduceLeftBound(t.root.unit,n),t.unsetRoot();return}if(t.root.unit instanceof Date){const r=`d'${t.root.description??t.root.unit.toISOString()}'`;t.unsetRoot(),t.reduceLeftBound(r,n);return}}return P3(t,n)},U3={"<":1,">":1,"=":1},K3=(t,e)=>t.scanner.lookaheadIs("=")?`${e}${t.scanner.shift()}`:e,Zw=(t,e,n,r)=>n.extends(W.intrinsic.number)?typeof e!="number"?Y(gm(t,e,r)):t==="=="?["min","max"]:t[0]===">"?["min"]:["max"]:n.extends(W.intrinsic.lengthBoundable)?typeof e!="number"?Y(gm(t,e,r)):t==="=="?["exactLength"]:t[0]===">"?["minLength"]:["maxLength"]:n.extends(W.intrinsic.Date)?t==="=="?["after","before"]:t[0]===">"?["after"]:["before"]:Y(j$(n.expression)),q3=t=>({rule:g3(t.limit)?v3(t.limit):t.limit,exclusive:t.comparator.length===1}),P3=(t,e)=>{const n=t.unsetRoot(),r=t.scanner.location;t.parseOperand();const o=t.unsetRoot(),u=t.scanner.sliceChars(r,t.scanner.location);if(t.root=n,!o.hasKind("unit")||typeof o.unit!="number"&&!(o.unit instanceof Date))return t.error(gm(e,u,"right"));const c=o.unit,f=e.length===1,h=Zw(e,typeof c=="number"?c:u,n,"right");for(const y of h)t.constrainRoot(y,e==="=="?{rule:c}:{rule:c,exclusive:f});if(!t.branches.leftBound)return;if(!Si(e,B3))return t.error(DE(e));const m=Zw(t.branches.leftBound.comparator,t.branches.leftBound.limit,n,"left");t.constrainRoot(m[0],q3(t.branches.leftBound)),t.branches.leftBound=null},gm=(t,e,n)=>`Comparator ${n==="left"?Qc[t]:t} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${e})`,I3=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilLookahead(Jo);t.root=t.root.brand(e)},H3=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilLookahead(Jo),n=IN(e,{errorOnFail:Qw(e)});n===0&&t.error(Qw(0)),t.root=t.root.constrain("divisor",n)},Qw=t=>`% operator must be followed by a non-zero integer literal (was ${t})`,NE=t=>{const e=t.scanner.shift();return e===""?t.finalize(""):e==="["?t.scanner.shift()==="]"?t.setRoot(t.root.array()):t.error(F3):e==="|"?t.scanner.lookahead===">"?t.shiftedBy(1).pushRootToBranch("|>"):t.pushRootToBranch(e):e==="&"?t.pushRootToBranch(e):e===")"?t.finalizeGroup():R3(e,t.scanner.unscanned)?t.finalize(e):Si(e,U3)?V3(t,e):e==="%"?H3(t):e==="#"?I3(t):e in xf?NE(t):t.error(qy(e))},qy=(t,e="")=>`'${t}' is not allowed here${e&&` (should be ${e})`}`,F3="Missing expected ']'",G3=t=>{const e=t.unsetRoot();t.parseOperand();const n=t.unsetRoot();if(!n.hasKind("unit"))return t.error(Y3(n.expression));const r=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[e,"=",r]},Y3=t=>`Default value '${t}' must be a literal value`,Ww=(t,e)=>{const n=e.$.maybeResolveRoot(t);if(n)return n;if(t.endsWith("[]")){const u=e.$.maybeResolveRoot(t.slice(0,-2));if(u)return u.array()}const r=new Rf(new mA(t),e),o=J3(r);return r.finalizer===">"&&Y(qy(">")),o},J3=t=>{t.parseOperand();let e=Py(t).root;return e?(t.finalizer==="="?e=G3(t):t.finalizer==="?"&&(e=[e,"?"]),t.scanner.shiftUntilNonWhitespace(),t.scanner.lookahead&&Y(qy(t.scanner.lookahead)),e):_t(`Root was unexpectedly unset after parsing string '${t.scanner.scanned}'`)},Py=t=>{for(;t.finalizer===void 0;)X3(t);return t},X3=t=>t.hasRoot()?t.parseOperator():t.parseOperand();class Rf{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor(e,n){this.scanner=e,this.ctx=n}error(e){return Y(e)}hasRoot(){return this.root!==void 0}setRoot(e){this.root=e}unsetRoot(){const e=this.root;return this.root=void 0,e}constrainRoot(...e){this.root=this.root.constrain(e[0],e[1])}finalize(e){if(this.groups.length)return this.error(yA(")"));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,n){const r=Qc[n];if(!Si(r,j3))return this.error(DE(n));if(this.branches.leftBound)return this.error(L3(this.branches.leftBound.limit,this.branches.leftBound.comparator,e,r));this.branches.leftBound={comparator:r,limit:e}}finalizeBranches(){if(this.assertRangeUnset(),this.branches.pipe){this.pushRootToBranch("|>"),this.root=this.branches.pipe;return}if(this.branches.union){this.pushRootToBranch("|"),this.root=this.branches.union;return}if(this.branches.intersection){this.pushRootToBranch("&"),this.root=this.branches.intersection;return}this.applyPrefixes()}finalizeGroup(){this.finalizeBranches();const e=this.groups.pop();if(!e)return this.error(WN(")",this.scanner.unscanned));this.branches=e}addPrefix(e){this.branches.prefixes.push(e)}applyPrefixes(){for(;this.branches.prefixes.length;){const e=this.branches.prefixes.pop();this.root=e==="keyof"?this.root.keyof():_t(`Unexpected prefix '${e}'`)}}pushRootToBranch(e){this.assertRangeUnset(),this.applyPrefixes();const n=this.root;this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(n)??n,e!=="&"&&(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,e!=="|"&&(this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null))}parseUntilFinalizer(){return Py(new Rf(this.scanner,this.ctx))}parseOperator(){return NE(this)}parseOperand(){return ME(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(z3(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){return this.branches.leftBound?.comparator??this.branches.prefixes[this.branches.prefixes.length-1]??(this.branches.intersection?"&":this.branches.union?"|":this.branches.pipe?"|>":void 0)}shiftedBy(e){return this.scanner.jumpForward(e),this}}const Z3="An empty string is not a valid generic parameter name",vm=(t,e,n)=>{t.shiftUntilNonWhitespace();const r=t.shiftUntilLookahead(Jo);return r===""?t.lookahead===""&&e.length?e:Y(Z3):(t.shiftUntilNonWhitespace(),Q3(t,r,e,n))},ex="extends ",Q3=(t,e,n,r)=>{if(t.shiftUntilNonWhitespace(),t.unscanned.startsWith(ex))t.jumpForward(ex.length);else return t.lookahead===","&&t.shift(),n.push(e),vm(t,n,r);const o=Py(new Rf(t,r));return n.push([e,o.root]),vm(t,n,r)};class W3 extends Hr{constructor(e){const n={$:e,raw:e.fn};super((...r)=>{const o=r.indexOf(":"),u=o===-1?r.length-1:o-1,c=r.slice(0,u+1),f=e.parse(c).assertHasKind("intersection");let h=e.intrinsic.unknown;if(o!==-1){if(o!==r.length-2)return Y(tB);h=e.parse(r[o+1])}return m=>new eB(m,f,h)},{attach:n})}}class eB extends Hr{raw;params;returns;expression;constructor(e,n,r){const o=`typed ${e.name}`,u={[o]:(...f)=>{const h=n.assert(f),m=e(...h);return r.assert(m)}}[o];super(u),this.raw=e,this.params=n,this.returns=r;let c=n.expression;c[0]==="["&&c[c.length-1]==="]"?c=c.slice(1,-1):c.endsWith("[]")&&(c=`...${c}`),this.expression=`(${c}) => ${r?.expression??"unknown"}`}}const tB=`":" must be followed by exactly one return type e.g:
66
- fn("string", ":", "number")(s => s.length)`;class nB extends Hr{$;constructor(e){super((...n)=>new uc(e)(...n),{bind:e}),this.$=e}in(e){return new uc(this.$,e===void 0?void 0:this.$.parse(e))}at(e,n){return new uc(this.$).at(e,n)}case(e,n){return new uc(this.$).case(e,n)}}class uc extends Hr{$;in;key;branches=[];constructor(e,n){super(r=>this.caseEntries(Object.entries(r).map(([o,u])=>o==="default"?[o,u]:[this.$.parse(o),u]))),this.$=e,this.in=n}at(e,n){return this.key&&Y(rB),this.branches.length&&Y(iB),this.key=e,n?this.match(n):this}case(e,n){return this.caseEntry(this.$.parse(e),n)}caseEntry(e,n){const o=(this.key?this.$.parse({[this.key]:e}):e).pipe(n);return this.branches.push(o),this}match(e){return this(e)}strings(e){return this.caseEntries(Object.entries(e).map(([n,r])=>n==="default"?[n,r]:[this.$.node("unit",{unit:n}),r]))}caseEntries(e){for(let n=0;n<e.length;n++){const[r,o]=e[n];if(r==="default")return n!==e.length-1&&Y("default may only be specified as the last key of a switch definition"),this.default(o);if(typeof o!="function")return Y(`Value for case "${r}" must be a function (was ${ei(o)})`);this.caseEntry(r,o)}return this}default(e){typeof e=="function"&&this.case(me.unknown,e);const n={branches:this.branches,ordered:!0};(e==="never"||e==="assert")&&(n.meta={onFail:tx});const r=this.$.node("union",n);if(!this.in)return this.$.finalize(r);let o=this.in.pipe(r);return(e==="never"||e==="assert")&&(o=o.configureReferences({onFail:tx},"self")),this.$.finalize(o)}}const tx=t=>t.throw(),iB="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",rB="At most one key matcher may be specified per expression",$E=(t,e)=>{if(Xt(t)){if(t[1]==="=")return[e.$.parseOwnDefinitionFormat(t[0],e),"=",t[2]];if(t[1]==="?")return[e.$.parseOwnDefinitionFormat(t[0],e),"?"]}return KE(t,e)},sB="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",oB="Only required keys may specify default values, e.g. { value: 'number = 0' }",aB=(t,e)=>{let n;const r={},o=Ic(t);for(const[c,f]of o){const h=cB(c);if(h.kind==="spread"){if(!Ol(r))return Y(uB);const S=e.$.parseOwnDefinitionFormat(f,e);if(S.equals(me.object))continue;if(!S.hasKind("intersection")||!S.basis?.equals(me.object))return Y(fB(S.expression));n=S.structure;continue}if(h.kind==="undeclared"){f!=="reject"&&f!=="delete"&&f!=="ignore"&&Y(lB(f)),r.undeclared=f;continue}const m=$E(f,e),y=h;if(h.kind==="required"){Xt(m)?vp(r,"optional",m[1]==="="?{key:h.normalized,value:m[0],default:m[2]}:{key:h.normalized,value:m[0]},e):vp(r,"required",{key:h.normalized,value:m},e);continue}if(Xt(m)&&(m[1]==="?"&&Y(sB),m[1]==="="&&Y(oB)),h.kind==="optional"){vp(r,"optional",{key:h.normalized,value:m},e);continue}const g=e.$.parseOwnDefinitionFormat(y.normalized,e),b=pm(g,m,e.$);b.index&&(r.index=Fe(r.index,b.index)),b.required&&(r.required=Fe(r.required,b.required))}const u=e.$.node("structure",r);return e.$.parseSchema({domain:"object",structure:n?.merge(u)??u})},vp=(t,e,n,r)=>{t[e]=Fe(t[e],r.$.node(e,n))},lB=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Ie(t)})`,uB="Spread operator may only be used as the first key in an object",cB=t=>typeof t=="symbol"?{kind:"required",normalized:t}:t[t.length-1]==="?"?t[t.length-2]===tl?{kind:"required",normalized:`${t.slice(0,-2)}?`}:{kind:"optional",normalized:t.slice(0,-1)}:t[0]==="["&&t[t.length-1]==="]"?{kind:"index",normalized:t.slice(1,-1)}:t[0]===tl&&t[1]==="["&&t[t.length-1]==="]"?{kind:"required",normalized:t.slice(1)}:t==="..."?{kind:"spread"}:t==="+"?{kind:"undeclared"}:{kind:"required",normalized:t==="\\..."?"...":t==="\\+"?"+":t},fB=t=>`Spread operand must resolve to an object literal type (was ${t})`,dB=(t,e)=>xB(t)?LE[t[0]](t,e):SB(t)?zE[t[1]](t,e):null,hB=(t,e)=>e.$.parseOwnDefinitionFormat(t[1],e).keyof(),bp=(t,e)=>{if(t[2]===void 0)return Y(CE(t[1],""));const n=e.$.parseOwnDefinitionFormat(t[0],e),r=e.$.parseOwnDefinitionFormat(t[2],e);if(t[1]==="|")return e.$.node("union",{branches:[n,r]});const o=t[1]==="&"?Qi(n,r,e.$):fm(n,r,e.$);return o instanceof ae?o.throw():o},pB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).array(),mB=(t,e)=>typeof t[2]!="function"?Y(jE("=>",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).pipe(t[2]),jE=(t,e)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof e})`,yB=(t,e)=>typeof t[2]!="function"?Y(jE(":",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).constrain("predicate",t[2]),gB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).configure(t[2],t[3]),BE=t=>t,vB=BE({"[]":pB,"?":()=>Y(EE)}),bB=BE({"|":bp,"&":bp,":":yB,"=>":mB,"|>":bp,"@":gB,"=":()=>Y(OE)}),zE={...vB,...bB},SB=t=>zE[t[1]]!==void 0,wB=t=>t,LE=wB({keyof:hB,instanceof:(t,e)=>{if(typeof t[1]!="function")return Y(nx(rm(t[1])));const n=t.slice(1).map(r=>typeof r=="function"?e.$.node("proto",{proto:r}):Y(nx(rm(r))));return n.length===1?n[0]:e.$.node("union",{branches:n})},"===":(t,e)=>e.$.units(t.slice(1))}),xB=t=>LE[t[0]]!==void 0,nx=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,TB=(t,e)=>{let n=[{}],r=0;for(;r<t.length;){let o=!1;t[r]==="..."&&r<t.length-1&&(o=!0,r++);const u=$E(t[r],e),[c,f,h]=Xt(u)?u:[u];if(r++,o){if(!c.extends(W.intrinsic.Array))return Y(OB(c.expression));n=n.flatMap(m=>c.distribute(y=>EB(wA(m),y)))}else n=n.map(m=>f==="?"?VE(m,c):f==="="?AB(m,c,h):bm(m,c))}return e.$.parseSchema(n.map(o=>Ol(o)?{proto:Array,exactLength:0}:{proto:Array,sequence:o}))},bm=(t,e)=>t.defaultables||t.optionals?Y(t.variadic?sE:_B):(t.variadic?t.postfix=Fe(t.postfix,e):t.prefix=Fe(t.prefix,e),t),VE=(t,e)=>t.variadic?Y(UE):(t.optionals=Fe(t.optionals,e),t),AB=(t,e,n)=>t.variadic?Y(UE):t.optionals?Y(RB):(t.defaultables=Fe(t.defaultables,[[e,n]]),t),ix=(t,e)=>(t.postfix&&Y(rx),t.variadic?t.variadic.equals(e)||Y(rx):t.variadic=e.internal,t),EB=(t,e)=>{const n=e.select({method:"find",kind:"sequence"});if(!n)return ix(t,W.intrinsic.unknown);if(n.prefix)for(const r of n.prefix)bm(t,r);if(n.optionals)for(const r of n.optionals)VE(t,r);if(n.variadic&&ix(t,n.variadic),n.postfix)for(const r of n.postfix)bm(t,r);return t},OB=t=>`Spread element must be an array (was ${t})`,rx="A tuple may have at most one variadic element",_B="A required element may not follow an optional element",UE="An optional element may not follow a variadic element",RB="A defaultable element may not follow an optional element without a default",kB={},KE=(t,e)=>{if(typeof t=="string"){if(e.args&&Object.keys(e.args).some(r=>t.includes(r)))return Ww(t,e);const n=kB[e.$.name]??={};return n[t]??=Ww(t,e)}return Cs(t,"object")?CB(t,e):Y(Sm(ei(t)))},CB=(t,e)=>{const n=_y(t);switch(n){case void 0:return fe(t,"root")?t:"~standard"in t?MB(t,e):aB(t,e);case"Array":return DB(t,e);case"RegExp":return e.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const r=wf(t)?t():t;return fe(r,"root")?r:Y(Sm("Function"))}default:return Y(Sm(n??Ie(t)))}},MB=(t,e)=>e.$.intrinsic.unknown.pipe((n,r)=>{const o=t["~standard"].validate(n);if(!o.issues)return o.value;for(const{message:u,path:c}of o.issues)c?c.length?r.error({problem:kN(u),relativePath:c.map(f=>typeof f=="object"?f.key:f)}):r.error({message:u}):r.error({message:u})}),DB=(t,e)=>dB(t,e)??TB(t,e),Sm=t=>`Type definitions must be strings or objects (was ${t})`;class NB extends Hr{constructor(e){const n=Object.assign({errors:Lr,hkt:wi,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,declare:e.declare,define:e.define,match:e.match,generic:e.generic,schema:e.schema,keywords:e.ambient,unit:e.unit,enumerated:e.enumerated,instanceOf:e.instanceOf,valueOf:e.valueOf,or:e.or,and:e.and,merge:e.merge,pipe:e.pipe,fn:e.fn},e.ambientAttachments);super((...r)=>{if(r.length===1)return e.parse(r[0]);if(r.length===2&&typeof r[0]=="string"&&r[0][0]==="<"&&r[0][r[0].length-1]===">"){const o=r[0].slice(1,-1),u=e.parseGenericParams(o,{});return new Xc(u,r[1],e,e,null)}return e.parse(r)},{attach:n})}}const ml=W;class kf extends dE{get ambientAttachments(){if(ml.typeAttachments)return this.cacheGetter("ambientAttachments",Ge(ml.typeAttachments,(e,n)=>[e,this.bindReference(n)]))}preparseOwnAliasEntry(e,n){const r=e.indexOf("<");if(r===-1){if(fe(n,"module")||fe(n,"generic"))return[e,n];const c=this.name==="ark"?e:e==="root"?this.name:`${this.name}.${e}`,f=this.resolvedConfig.keywords?.[c];return f&&(n=[n,"@",f]),[e,n]}e[e.length-1]!==">"&&Y("'>' must be the last character of a generic declaration in a scope");const o=e.slice(0,r),u=e.slice(r+1,-1);return[o,()=>{const c=this.parseGenericParams(u,{alias:o});return w$(c,n,this)}]}parseGenericParams(e,n){return vm(new mA(e),[],this.createParseContext({...n,def:e,prefix:"generic"}))}normalizeRootScopeValue(e){return wf(e)&&!fe(e,"generic")?e():e}preparseOwnDefinitionFormat(e,n){return{...n,def:e,prefix:n.alias??"type"}}parseOwnDefinitionFormat(e,n){!(n.alias&&n.alias in this.aliases)&&!n.args&&(n.args={this:n.id});const o=KE(e,n);if(Xt(o)){if(o[1]==="=")return Y(OE);if(o[1]==="?")return Y(EE)}return o}unit=e=>this.units([e]);valueOf=e=>this.units(pN(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node("proto",{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(n=>this.parse(n)));and=(...e)=>e.reduce((n,r)=>n.and(this.parse(r)),this.intrinsic.unknown);merge=(...e)=>e.reduce((n,r)=>n.merge(this.parse(r)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);fn=new W3(this);match=new nB(this);declare=()=>({type:this.type});define(e){return e}type=new NB(this);static scope=((e,n={})=>new kf(e,n));static module=((e,n={})=>this.scope(e,n).export())}const $B=Object.assign(kf.scope,{define:t=>t}),ze=kf;class jB extends wi{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}const BB=tr(["base",me.object],["props",me.object])(t=>t.base.merge(t.props),jB),zB=ze.module({Key:me.key,Merge:BB});class LB extends wi{}const VB=tr("element")(t=>{const e=t.element.exclude(me.Array),n=e.array();return e.rawOr(n).pipe(El).distribute(r=>r.assertHasKind("morph").declareOut(n),Ye)},LB),UB=ze.module({root:me.Array,readonly:"root",index:me.nonNegativeIntegerString,liftFrom:VB},{name:"Array"}),wm=Ye(["string",_l.FileConstructor]),KB=wm.rawOr(wm.array()),sx=Ye({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:KB}}),qB=ze.module({root:["instanceof",FormData],value:wm,parsed:sx,parse:Ye({in:FormData,morphs:t=>{const e={};for(const[n,r]of t)if(n in e){const o=e[n];typeof o=="string"||o instanceof _l.FileConstructor?e[n]=[o,r]:o.push(r)}else e[n]=r;return e},declaredOut:sx})},{name:"FormData"}),PB=ze.module({Int8:["instanceof",Int8Array],Uint8:["instanceof",Uint8Array],Uint8Clamped:["instanceof",Uint8ClampedArray],Int16:["instanceof",Int16Array],Uint16:["instanceof",Uint16Array],Int32:["instanceof",Int32Array],Uint32:["instanceof",Uint32Array],Float32:["instanceof",Float32Array],Float64:["instanceof",Float64Array],BigInt64:["instanceof",BigInt64Array],BigUint64:["instanceof",BigUint64Array]},{name:"TypedArray"}),IB={Boolean:1,Number:1,String:1},HB=ze.module({...Ge({...rA,...oA},(t,e)=>t in IB?[]:[t,["instanceof",e]]),Array:UB,TypedArray:PB,FormData:qB}),FB=Ye({domain:{domain:"number",meta:"a number representing a Unix timestamp"},divisor:{rule:1,meta:"an integer representing a Unix timestamp"},min:{rule:-864e13,meta:"a Unix timestamp after -8640000000000000"},max:{rule:864e13,meta:"a Unix timestamp before 8640000000000000"},meta:"an integer representing a safe Unix timestamp"}),GB=Ye({domain:"number",divisor:1}),qE=ze.module({root:me.number,integer:GB,epoch:FB,safe:Ye({domain:{domain:"number",numberAllowsNaN:!1},min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}),NaN:["===",Number.NaN],Infinity:["===",Number.POSITIVE_INFINITY],NegativeInfinity:["===",Number.NEGATIVE_INFINITY]},{name:"number"}),et=(t,e,n)=>{const r={domain:"string",pattern:{rule:t.source,flags:t.flags,meta:e}};return n&&(r.meta={format:n}),Ky("intersection",r)},ox=et(Hc,"a well-formed integer string"),PE=ze.module({root:ox,parse:Ye({in:ox,morphs:(t,e)=>{const n=Number.parseInt(t);return Number.isSafeInteger(n)?n:e.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:me.integer})},{name:"string.integer"}),YB=et(/^[\dA-Fa-f]+$/,"hex characters only"),JB=ze.module({root:et(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:et(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),ax=et(/^[A-Z].*$/,"capitalized"),XB=ze.module({root:Ye({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:ax}),preformatted:ax},{name:"string.capitalize"}),ZB=t=>{const e=t.replace(/[ -]+/g,"");let n=0,r,o,u=!1;for(let c=e.length-1;c>=0;c--)r=e.substring(c,c+1),o=Number.parseInt(r,10),u?(o*=2,n+=o>=10?o%10+1:o):n+=o,u=!u;return!!(n%10===0&&e)},QB=/^(?:4\d{12}(?:\d{3,6})?|5[1-5]\d{14}|(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}|6(?:011|5\d\d)\d{12,15}|3[47]\d{13}|3(?:0[0-5]|[68]\d)\d{11}|(?:2131|1800|35\d{3})\d{11}|6[27]\d{14}|^(81\d{14,17}))$/,WB=Ye({domain:"string",pattern:{meta:"a credit card number",rule:QB.source},predicate:{meta:"a credit card number",predicate:ZB}}),ez=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,tz=t=>!Number.isNaN(new Date(t).valueOf()),lx=Ye({domain:"string",predicate:{meta:"a parsable date",predicate:tz}}).assertHasKind("intersection"),ux=PE.root.internal.narrow((t,e)=>{const n=Number.parseInt(t),r=qE.epoch(n);return r instanceof Lr?(e.errors.merge(r),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),nz=ze.module({root:ux,parse:Ye({in:ux,morphs:t=>new Date(t),declaredOut:me.Date})},{name:"string.date.epoch"}),cx=et(ez,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),iz=ze.module({root:cx,parse:Ye({in:cx,morphs:t=>new Date(t),declaredOut:me.Date})},{name:"string.date.iso"}),rz=ze.module({root:lx,parse:Ye({declaredIn:lx,in:"string",morphs:(t,e)=>{const n=new Date(t);return Number.isNaN(n.valueOf())?e.error("a parsable date"):n},declaredOut:me.Date}),iso:iz,epoch:nz},{name:"string.date"}),sz=et(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),fx="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",_r=`(${fx}[.]){3}${fx}`,oz=new RegExp(`^${_r}$`),xt="(?:[0-9a-fA-F]{1,4})",az=new RegExp(`^((?:${xt}:){7}(?:${xt}|:)|(?:${xt}:){6}(?:${_r}|:${xt}|:)|(?:${xt}:){5}(?::${_r}|(:${xt}){1,2}|:)|(?:${xt}:){4}(?:(:${xt}){0,1}:${_r}|(:${xt}){1,3}|:)|(?:${xt}:){3}(?:(:${xt}){0,2}:${_r}|(:${xt}){1,4}|:)|(?:${xt}:){2}(?:(:${xt}){0,3}:${_r}|(:${xt}){1,5}|:)|(?:${xt}:){1}(?:(:${xt}){0,4}:${_r}|(:${xt}){1,6}|:)|(?::((?::${xt}){0,5}:${_r}|(?::${xt}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),lz=ze.module({root:["v4 | v6","@","an IP address"],v4:et(oz,"an IPv4 address","ipv4"),v6:et(az,"an IPv6 address","ipv6")},{name:"string.ip"}),No="a JSON string",IE=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${No} (${t})`},uz=Ye({meta:No,domain:"string",predicate:{meta:No,predicate:(t,e)=>{try{return JSON.parse(t),!0}catch(n){return e.reject({code:"predicate",expected:No,problem:IE(n)})}}}}),cz=(t,e)=>{if(t.length===0)return e.error({code:"predicate",expected:No,actual:"empty"});try{return JSON.parse(t)}catch(n){return e.error({code:"predicate",expected:No,problem:IE(n)})}},fz=ze.module({root:uz,parse:Ye({meta:"safe JSON string parser",in:"string",morphs:cz,declaredOut:me.jsonObject})},{name:"string.json"}),dx=et(/^[a-z]*$/,"only lowercase letters"),dz=ze.module({root:Ye({in:"string",morphs:t=>t.toLowerCase(),declaredOut:dx}),preformatted:dx},{name:"string.lower"}),HE=["NFC","NFD","NFKC","NFKD"],Nl=Ge(HE,(t,e)=>[e,Ye({domain:"string",predicate:n=>n.normalize(e)===n,meta:`${e}-normalized unicode`})]),Cf=Ge(HE,(t,e)=>[e,Ye({in:"string",morphs:n=>n.normalize(e),declaredOut:Nl[e]})]),hz=ze.module({root:Cf.NFC,preformatted:Nl.NFC},{name:"string.normalize.NFC"}),pz=ze.module({root:Cf.NFD,preformatted:Nl.NFD},{name:"string.normalize.NFD"}),mz=ze.module({root:Cf.NFKC,preformatted:Nl.NFKC},{name:"string.normalize.NFKC"}),yz=ze.module({root:Cf.NFKD,preformatted:Nl.NFKD},{name:"string.normalize.NFKD"}),gz=ze.module({root:"NFC",NFC:hz,NFD:pz,NFKC:mz,NFKD:yz},{name:"string.normalize"}),hx=et(sm,"a well-formed numeric string"),vz=ze.module({root:hx,parse:Ye({in:hx,morphs:t=>Number.parseFloat(t),declaredOut:me.number})},{name:"string.numeric"}),px="a regex pattern",bz=Ye({domain:"string",predicate:{meta:px,predicate:(t,e)=>{try{return new RegExp(t),!0}catch(n){return e.reject({code:"predicate",expected:px,problem:String(n)})}}},meta:{format:"regex"}}),Sz=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,wz=et(Sz,"a semantic version (see https://semver.org/)"),mx=et(/^\S.*\S$|^\S?$/,"trimmed"),xz=ze.module({root:Ye({in:"string",morphs:t=>t.trim(),declaredOut:mx}),preformatted:mx},{name:"string.trim"}),yx=et(/^[A-Z]*$/,"only uppercase letters"),Tz=ze.module({root:Ye({in:"string",morphs:t=>t.toUpperCase(),declaredOut:yx}),preformatted:yx},{name:"string.upper"}),Az=t=>URL.canParse(t),gx=Ye({domain:"string",predicate:{meta:"a URL string",predicate:Az},meta:{format:"uri"}}),Ez=ze.module({root:gx,parse:Ye({declaredIn:gx,in:"string",morphs:(t,e)=>{try{return new URL(t)}catch{return e.error("a URL string")}},declaredOut:Ye(URL)})},{name:"string.url"}),Oz=ze.module({root:["versioned | nil | max","@",{description:"a UUID",format:"uuid"}],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}/i,v1:et(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:et(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:et(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:et(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:et(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:et(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:et(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:et(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),_z=ze.module({root:me.string,alpha:et(/^[A-Za-z]*$/,"only letters"),alphanumeric:et(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:YB,base64:JB,capitalize:XB,creditCard:WB,date:rz,digits:et(/^\d*$/,"only digits 0-9"),email:sz,integer:PE,ip:lz,json:fz,lower:dz,normalize:gz,numeric:vz,regex:bz,semver:wz,trim:xz,upper:Tz,url:Ez,uuid:Oz},{name:"string"}),Rz=ze.module({bigint:me.bigint,boolean:me.boolean,false:me.false,never:me.never,null:me.null,number:me.number,object:me.object,string:me.string,symbol:me.symbol,true:me.true,unknown:me.unknown,undefined:me.undefined}),kz=ze.module({root:me.unknown,any:me.unknown},{name:"unknown"}),Cz=ze.module({root:me.jsonObject,stringify:Ky("morph",{in:me.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:me.string})},{name:"object.json"}),Mz=ze.module({root:me.object,json:Cz},{name:"object"});class Dz extends wi{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}const Nz=tr(["K",me.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),Dz);class $z extends wi{description='pick a set of properties from an object like `Pick(User, "name | age")`'}const jz=tr(["T",me.object],["K",me.key])(t=>t.T.pick(t.K),$z);class Bz extends wi{description='omit a set of properties from an object like `Omit(User, "age")`'}const zz=tr(["T",me.object],["K",me.key])(t=>t.T.omit(t.K),Bz);class Lz extends wi{description="make all named properties of an object optional like `Partial(User)`"}const Vz=tr(["T",me.object])(t=>t.T.partial(),Lz);class Uz extends wi{description="make all named properties of an object required like `Required(User)`"}const Kz=tr(["T",me.object])(t=>t.T.required(),Uz);class qz extends wi{description='exclude branches of a union like `Exclude("boolean", "true")`'}const Pz=tr("T","U")(t=>t.T.exclude(t.U),qz);class Iz extends wi{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}const Hz=tr("T","U")(t=>t.T.extract(t.U),Iz),Fz=ze.module({Exclude:Pz,Extract:Hz,Omit:zz,Partial:Vz,Pick:jz,Record:Nz,Required:Kz}),Fr=$B({...Rz,...Fz,...HB,...zB,string:_z,number:qE,object:Mz,unknown:kz},{prereducedAliases:!0,name:"ark"}),jt=Fr.export();Object.assign(ml.ambient,jt);ml.typeAttachments={string:jt.string.root,number:jt.number.root,bigint:jt.bigint,boolean:jt.boolean,symbol:jt.symbol,undefined:jt.undefined,null:jt.null,object:jt.object.root,unknown:jt.unknown.root,false:jt.false,true:jt.true,never:jt.never,arrayIndex:jt.Array.index,Key:jt.Key,Record:jt.Record,Array:jt.Array.root,Date:jt.Date};const Et=Object.assign(Fr.type,ml.typeAttachments);Fr.match;Fr.fn;Fr.generic;Fr.schema;Fr.define;Fr.declare;const FE={100:'"Continue"',101:'"Switching Protocols"',102:'"Processing"',103:'"Early Hints"',200:'"OK"',201:'"Created"',202:'"Accepted"',203:'"Non-Authoritative Information"',204:'"No Content"',205:'"Reset Content"',206:'"Partial Content"',207:'"Multi-Status"',208:'"Already Reported"',226:'"IM Used"',300:'"Multiple Choices"',301:'"Moved Permanently"',302:'"Found"',303:'"See Other"',304:'"Not Modified"',305:'"Use Proxy"',306:'"Switch Proxy"',307:'"Temporary Redirect"',308:'"Permanent Redirect"',400:'"Bad Request"',401:'"Unauthorized"',402:'"Payment Required"',403:'"Forbidden"',404:'"Not Found"',405:'"Method Not Allowed"',406:'"Not Acceptable"',407:'"Proxy Authentication Required"',408:'"Request Timeout"',409:'"Conflict"',410:'"Gone"',411:'"Length Required"',412:'"Precondition Failed"',413:'"Payload Too Large"',414:'"URI Too Long"',415:'"Unsupported Media Type"',416:'"Range Not Satisfiable"',417:'"Expectation Failed"',418:`"I'm a teapot"`,421:'"Misdirected Request"',422:'"Unprocessable Entity"',423:'"Locked"',424:'"Failed Dependency"',425:'"Too Early"',426:'"Upgrade Required"',428:'"Precondition Required"',429:'"Too Many Requests"',431:'"Request Header Fields Too Large"',451:'"Unavailable For Legal Reasons"',500:'"Internal Server Error"',501:'"Not Implemented"',502:'"Bad Gateway"',503:'"Service Unavailable"',504:'"Gateway Timeout"',505:'"HTTP Version Not Supported"',506:'"Variant Also Negotiates"',507:'"Insufficient Storage"',508:'"Loop Detected"',510:'"Not Extended"',511:'"Network Authentication Required"'};function Gz(t){return Number.parseInt(t,10)}const Yz=Et(FE),Jz=Yz.keyof().pipe(t=>Gz(t));Et([Jz,"string"]);function Xz(t){return F.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",...t,children:[F.jsx("title",{children:"Tempest Games Logo"}),F.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M202.91,7.86h-13.18v17.03h13.18v6.84h-13.18v22.24h13.18v6.84h-30.29V.93h30.29v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M289.49.93v59.89h-17.11V7.78h-.43c-8.21,0-11.21,5.82-11.21,17.03v36.02h-16.25V24.8c0-11.21-2.99-17.03-11.21-17.03h-.43v53.04h-17.11V.93h18.74c9.92,0,15.31,4.96,18.14,11.21,2.82-6.25,8.21-11.21,18.14-11.21h18.73Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M352.82,29.68c0,11.72-6.42,19.16-24.55,19.16h-4.53v11.98h-17.11V1.1l46.2-.17v28.75ZM323.73,7.78v34.22h2.48c7.36,0,9.5-4.11,9.5-12.15V7.78h-11.98Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M396.8,7.86h-13.17v17.03h13.17v6.84h-13.17v22.24h13.17v6.84h-30.28V.93h30.28v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M425.9,12.57v14.03h27.89v16.94c0,12.75-1.71,18.13-16.43,18.13h-14.54c-9.58,0-14.03-2.74-14.03-11.97v-5.99h15.4v5.13c0,4.53.77,5.99,4.62,5.99h1.71c5.05,0,6.16-1.46,6.16-6.84v-14.54h-27.89v-16.68c0-13.52,3.85-16.68,18.82-16.68h12.83c8.81,0,13.17,1.54,13.17,10.78v7.19h-15.4v-6.5c0-3.42-1.03-4.62-4.45-4.62h-1.45c-4.28,0-6.42,1.46-6.42,5.65Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M155.96,93.78v-3.57h-5.58v-7.14h13.39v17.85h-24.76v-28.56h24.76v7.14h-16.96v14.28h9.15Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M224.26,100.92h-8.25v-10.71h-8.25v3.57h4.68v7.14h-12.94v-17.85h16.51v-3.57h-16.51v-7.14h24.76v28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M259.99,72.36h30.57v28.56h-7.81v-21.42h-3.57v21.42h-7.81v-21.42h-3.57v21.42h-7.81v-28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M343.24,83.08v-3.57h-9.14v14.28h16.96v7.14h-24.76v-28.56h24.76v17.85h-13.38v-7.14h5.57Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M394.59,79.5v3.57h16.96v17.85h-24.76v-7.14h16.96v-3.57h-16.96v-17.85h24.76v7.14h-16.96Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M0,63.42v-20.84h20.83L0,63.42ZM100,.92v32.29h-35.42v8.33h-8.33V14.46h-22.92l1.04,7.29h9.38v19.79h-8.33v-8.33H0V.92h100ZM0,100.92v-26.04l6.25-1.04,25-26.04,1.04,1.05-10.42,18.75-4.16,7.29h13.54l3.13-3.12,8.33-22.92h1.04v41.66h3.12l9.38-8.33v-33.33h1.04l8.33,22.92,3.12,3.12h13.54l-4.17-7.29-10.42-19.8,1.04-1.04,25,27.09,6.25,1.04v26.04H0ZM100,42.59v20.84l-20.83-20.84h20.83Z",style:{fill:"var(--logo-color)",strokeWidth:0}})]})}function GE(t){return F.jsx("a",{...t})}const Zz={class:"_class_1riwg_1"},Sp=["⠋","⠙","⠸","⠴","⠦","⠇"];function Qz({input:t}){const e=N.useRef(null),[n,r]=N.useState(typeof t=="string"?t:null);return N.useEffect(()=>{let o=!0,u;if(typeof t=="string")r(t);else{let c=0;u=setInterval(()=>{e.current&&(e.current.textContent=Sp[c],c=(c+1)%Sp.length)},100),t.then(f=>{o&&(clearInterval(u),r(f))})}return()=>{o=!1,u&&clearInterval(u)}},[t]),F.jsx("span",{ref:e,children:n??Sp[0]})}const YE=(t,{stringify:e,parse:n},r)=>({setSelf:o,onSet:u})=>{if(!t)return;const c=t.getItem(r);c!=null&&o(n(c)),u(({newValue:f})=>{if(f==null){t.removeItem(r);return}t.setItem(r,e(f))})},Wz=Object.freeze(Object.defineProperty({__proto__:null,storageSync:YE},Symbol.toStringTag,{value:"Module"}));var eL=Object.create,JE=Object.defineProperty,tL=Object.getOwnPropertyDescriptor,XE=Object.getOwnPropertyNames,nL=Object.getPrototypeOf,iL=Object.prototype.hasOwnProperty,xi=(t,e)=>function(){return e||(0,t[XE(t)[0]])((e={exports:{}}).exports,e),e.exports},rL=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=XE(e),u=0,c=o.length,f;u<c;u++)f=o[u],!iL.call(t,f)&&f!==n&&JE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=tL(e,f))||r.enumerable});return t},gt=(t,e,n)=>(n=t!=null?eL(nL(t)):{},rL(JE(n,"default",{value:t,enumerable:!0}),t)),ZE=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(r){"@babel/helpers - typeof";return e.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),sL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=ZE().default;function r(o,u){if(n(o)!="object"||!o)return o;var c=o[Symbol.toPrimitive];if(c!==void 0){var f=c.call(o,u||"default");if(n(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),oL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=ZE().default,r=sL();function o(u){var c=r(u,"string");return n(c)=="symbol"?c:c+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ms=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=oL();function r(o,u,c){return(u=n(u))in o?Object.defineProperty(o,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[u]=c,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),ti=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=Ms();function r(u,c){var f=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),f.push.apply(f,h)}return f}function o(u){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?r(Object(f),!0).forEach(function(h){n(u,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(f)):r(Object(f)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(f,h))})}return u}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});function Mf(t){const e={subscribe(n){let r=null,o=!1,u=!1,c=!1;function f(){if(r===null){c=!0;return}u||(u=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=t({next(h){var m;o||(m=n.next)===null||m===void 0||m.call(n,h)},error(h){var m;o||(o=!0,(m=n.error)===null||m===void 0||m.call(n,h),f())},complete(){var h;o||(o=!0,(h=n.complete)===null||h===void 0||h.call(n),f())}}),c&&f(),{unsubscribe:f}},pipe(...n){return n.reduce(aL,e)}};return e}function aL(t,e){return e(t)}function lL(t){const e=new AbortController;return new Promise((r,o)=>{let u=!1;function c(){u||(u=!0,f.unsubscribe())}e.signal.addEventListener("abort",()=>{o(e.signal.reason)});const f=t.subscribe({next(h){u=!0,r(h),c()},error(h){o(h)},complete(){e.abort(),c()}})})}function uL(t){return e=>{let n=0,r=null;const o=[];function u(){r||(r=e.subscribe({next(f){for(const m of o){var h;(h=m.next)===null||h===void 0||h.call(m,f)}},error(f){for(const m of o){var h;(h=m.error)===null||h===void 0||h.call(m,f)}},complete(){for(const h of o){var f;(f=h.complete)===null||f===void 0||f.call(h)}}}))}function c(){if(n===0&&r){const f=r;r=null,f.unsubscribe()}}return Mf(f=>(n++,o.push(f),u(),{unsubscribe(){n--,c();const h=o.findIndex(m=>m===f);h>-1&&o.splice(h,1)}}))}}function cL(t){let e=t;const n=[],r=c=>{e!==void 0&&c.next(e),n.push(c)},o=c=>{n.splice(n.indexOf(c),1)},u=Mf(c=>(r(c),()=>{o(c)}));return u.next=c=>{if(e!==c){e=c;for(const f of n)f.next(c)}},u.get=()=>e,u}function fL(t){return Mf(e=>{function n(o=0,u=t.op){const c=t.links[o];if(!c)throw new Error("No more links to execute - did you forget to add an ending link?");return c({op:u,next(h){return n(o+1,h)}})}return n().subscribe(e)})}function yl(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function dL(){return Object.create(null)}var hL=Object.create,QE=Object.defineProperty,pL=Object.getOwnPropertyDescriptor,WE=Object.getOwnPropertyNames,mL=Object.getPrototypeOf,yL=Object.prototype.hasOwnProperty,$l=(t,e)=>function(){return e||(0,t[WE(t)[0]])((e={exports:{}}).exports,e),e.exports},gL=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=WE(e),u=0,c=o.length,f;u<c;u++)f=o[u],!yL.call(t,f)&&f!==n&&QE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=pL(e,f))||r.enumerable});return t},Df=(t,e,n)=>(n=t!=null?hL(mL(t)):{},gL(QE(n,"default",{value:t,enumerable:!0}),t));const eO=()=>{},vx=t=>{Object.freeze&&Object.freeze(t)};function tO(t,e,n){var r;const o=e.join(".");return(r=n[o])!==null&&r!==void 0||(n[o]=new Proxy(eO,{get(u,c){if(!(typeof c!="string"||c==="then"))return tO(t,[...e,c],n)},apply(u,c,f){const h=e[e.length-1];let m={args:f,path:e};return h==="call"?m={args:f.length>=2?[f[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(m={args:f.length>=2?f[1]:[],path:e.slice(0,-1)}),vx(m.args),vx(m.path),t(m)}})),n[o]}const vL=t=>tO(t,[],dL()),bL=t=>new Proxy(eO,{get(e,n){if(n!=="then")return t(n)}});var nO=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(r){"@babel/helpers - typeof";return e.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),SL=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=nO().default;function r(o,u){if(n(o)!="object"||!o)return o;var c=o[Symbol.toPrimitive];if(c!==void 0){var f=c.call(o,u||"default");if(n(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),wL=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=nO().default,r=SL();function o(u){var c=r(u,"string");return n(c)=="symbol"?c:c+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),iO=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=wL();function r(o,u,c){return(u=n(u))in o?Object.defineProperty(o,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[u]=c,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Iy=$l({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=iO();function r(u,c){var f=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),f.push.apply(f,h)}return f}function o(u){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?r(Object(f),!0).forEach(function(h){n(u,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(f)):r(Object(f)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(f,h))})}return u}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});Df(Iy());Df(iO());var cc=Df(Iy());function xL(t,e){if("error"in t){const r=e.deserialize(t.error);return{ok:!1,error:(0,cc.default)((0,cc.default)({},t),{},{error:r})}}return{ok:!0,result:(0,cc.default)((0,cc.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var wp=class extends Error{constructor(){super("Unable to transform response from server")}};function TL(t,e){let n;try{n=xL(t,e)}catch{throw new wp}if(!n.ok&&(!yl(n.error.error)||typeof n.error.error.code!="number"))throw new wp;if(n.ok&&!yl(n.result))throw new wp;return n}Df(Iy());var fc=gt(Ms()),So=gt(ti());function AL(t){return t instanceof gl}function EL(t){return yl(t)&&yl(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function OL(t,e){return typeof t=="string"?t:yl(t)&&typeof t.message=="string"?t.message:e}var gl=class Tc extends Error{constructor(e,n){var r,o;const u=n?.cause;super(e,{cause:u}),(0,fc.default)(this,"cause",void 0),(0,fc.default)(this,"shape",void 0),(0,fc.default)(this,"data",void 0),(0,fc.default)(this,"meta",void 0),this.meta=n?.meta,this.cause=u,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(o=n.result)===null||o===void 0?void 0:o.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Tc.prototype)}static from(e,n={}){const r=e;return AL(r)?(n.meta&&(r.meta=(0,So.default)((0,So.default)({},r.meta),n.meta)),r):EL(r)?new Tc(r.error.message,(0,So.default)((0,So.default)({},n),{},{result:r})):new Tc(OL(r,"Unknown error"),(0,So.default)((0,So.default)({},n),{},{cause:r}))}};function _L(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:n=>n,deserialize:n=>n},output:{serialize:n=>n,deserialize:n=>n}}}const bx=t=>typeof t=="function";function RL(t){if(t)return t;if(typeof window<"u"&&bx(window.fetch))return window.fetch;if(typeof globalThis<"u"&&bx(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var il=gt(ti());function kL(t){return{url:t.url.toString(),fetch:t.fetch,transformer:_L(t.transformer),methodOverride:t.methodOverride}}function CL(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];e[n]=r}return e}const ML={query:"GET",mutation:"POST",subscription:"PATCH"};function rO(t){return"input"in t?t.transformer.input.serialize(t.input):CL(t.inputs.map(e=>t.transformer.input.serialize(e)))}const sO=t=>{const e=t.url.split("?");let r=e[0].replace(/\/$/,"")+"/"+t.path;const o=[];if(e[1]&&o.push(e[1]),"inputs"in t&&o.push("batch=1"),t.type==="query"||t.type==="subscription"){const u=rO(t);u!==void 0&&t.methodOverride!=="POST"&&o.push(`input=${encodeURIComponent(JSON.stringify(u))}`)}return o.length&&(r+="?"+o.join("&")),r},DL=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=rO(t);return e!==void 0?JSON.stringify(e):void 0},NL=t=>zL((0,il.default)((0,il.default)({},t),{},{contentTypeHeader:"application/json",getUrl:sO,getBody:DL}));var $L=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const jL=t=>{var e;if(t?.aborted)throw(e=t.throwIfAborted)===null||e===void 0||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new $L};async function BL(t){var e;jL(t.signal);const n=t.getUrl(t),r=t.getBody(t),o=(e=t.methodOverride)!==null&&e!==void 0?e:ML[t.type],u=await(async()=>{const f=await t.headers();return Symbol.iterator in f?Object.fromEntries(f):f})(),c=(0,il.default)((0,il.default)((0,il.default)({},t.contentTypeHeader&&o!=="GET"?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),u);return RL(t.fetch)(n,{method:o,signal:t.signal,body:r,headers:c})}async function zL(t){const e={},n=await BL(t);e.response=n;const r=await n.json();return e.responseJSON=r,{json:r,meta:e}}gt(ti());const Sx=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function wx(t){let e=null,n=null;const r=()=>{clearTimeout(n),n=null,e=null};function o(f){const h=[[]];let m=0;for(;;){const b=f[m];if(!b)break;const S=h[h.length-1];if(b.aborted){var y;(y=b.reject)===null||y===void 0||y.call(b,new Error("Aborted")),m++;continue}if(t.validate(S.concat(b).map(T=>T.key))){S.push(b),m++;continue}if(S.length===0){var g;(g=b.reject)===null||g===void 0||g.call(b,new Error("Input is too big for a single dispatch")),m++;continue}h.push([])}return h}function u(){const f=o(e);r();for(const h of f){if(!h.length)continue;const m={items:h};for(const g of h)g.batch=m;t.fetch(m.items.map(g=>g.key)).then(async g=>{await Promise.all(g.map(async(S,x)=>{const T=m.items[x];try{var _;const C=await Promise.resolve(S);(_=T.resolve)===null||_===void 0||_.call(T,C)}catch(C){var k;(k=T.reject)===null||k===void 0||k.call(T,C)}T.batch=null,T.reject=null,T.resolve=null}));for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,new Error("Missing result")),S.batch=null}}).catch(g=>{for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,g),S.batch=null}})}}function c(f){var h;const m={aborted:!1,key:f,batch:null,resolve:Sx,reject:Sx},y=new Promise((g,b)=>{var S;m.reject=b,m.resolve=g,(S=e)!==null&&S!==void 0||(e=[]),e.push(m)});return(h=n)!==null&&h!==void 0||(n=setTimeout(u)),y}return{load:c}}function LL(...t){const e=new AbortController,n=t.length;let r=0;const o=()=>{++r===n&&e.abort()};for(const u of t)u?.aborted?o():u?.addEventListener("abort",o,{once:!0});return e.signal}var dc=gt(ti());function VL(t){var e,n;const r=kL(t),o=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,u=(n=t.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const c=y=>({validate(g){if(o===1/0&&u===1/0)return!0;if(g.length>u)return!1;const b=g.map(T=>T.path).join(","),S=g.map(T=>T.input);return sO((0,dc.default)((0,dc.default)({},r),{},{type:y,path:b,inputs:S,signal:null})).length<=o},async fetch(g){const b=g.map(C=>C.path).join(","),S=g.map(C=>C.input),x=LL(...g.map(C=>C.signal)),T=await NL((0,dc.default)((0,dc.default)({},r),{},{path:b,inputs:S,type:y,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:g}):t.headers:{}},signal:x}));return(Array.isArray(T.json)?T.json:g.map(()=>T.json)).map(C=>({meta:T.meta,json:C}))}}),f=wx(c("query")),h=wx(c("mutation")),m={query:f,mutation:h};return({op:y})=>Mf(g=>{if(y.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const S=m[y.type].load(y);let x;return S.then(T=>{x=T;const _=TL(T.json,r.transformer.output);if(!_.ok){g.error(gl.from(_.error,{meta:T.meta}));return}g.next({context:T.meta,result:_.result}),g.complete()}).catch(T=>{g.error(gl.from(T,{meta:x?.meta}))}),()=>{}})}}gt(ti());const oO=(t,...e)=>typeof t=="function"?t(...e):t;gt(Ms());function UL(){let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}}async function KL(t){const e=await oO(t.url);if(!t.connectionParams)return e;const r=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+r}async function qL(t){const e={method:"connectionParams",data:await oO(t)};return JSON.stringify(e)}gt(Ms());var ps=gt(Ms());function PL(t){const{promise:e,resolve:n,reject:r}=UL();return t.addEventListener("open",()=>{t.removeEventListener("error",r),n()}),t.addEventListener("error",r),e}function IL(t,{intervalMs:e,pongTimeoutMs:n}){let r,o;function u(){r=setTimeout(()=>{t.send("PING"),o=setTimeout(()=>{t.close()},n)},e)}function c(){clearTimeout(r),u()}function f(){clearTimeout(o),c()}t.addEventListener("open",u),t.addEventListener("message",({data:h})=>{clearTimeout(r),u(),h==="PONG"&&f()}),t.addEventListener("close",()=>{clearTimeout(r),clearTimeout(o)})}var HL=class xm{constructor(e){var n;if((0,ps.default)(this,"id",++xm.connectCount),(0,ps.default)(this,"WebSocketPonyfill",void 0),(0,ps.default)(this,"urlOptions",void 0),(0,ps.default)(this,"keepAliveOpts",void 0),(0,ps.default)(this,"wsObservable",cL(null)),(0,ps.default)(this,"openPromise",null),this.WebSocketPonyfill=(n=e.WebSocketPonyfill)!==null&&n!==void 0?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var e=this;if(e.openPromise)return e.openPromise;e.id=++xm.connectCount;const n=KL(e.urlOptions).then(r=>new e.WebSocketPonyfill(r));e.openPromise=n.then(async r=>{e.ws=r,r.addEventListener("message",function({data:o}){o==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&IL(r,e.keepAliveOpts),r.addEventListener("close",()=>{e.ws===r&&(e.ws=null)}),await PL(r),e.urlOptions.connectionParams&&r.send(await qL(e.urlOptions.connectionParams))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var n;(n=e.ws)===null||n===void 0||n.close()}}};(0,ps.default)(HL,"connectCount",0);gt(Ms());gt(ti());var xp=gt(Ms()),xx=gt(ti()),FL=class{constructor(t){(0,xp.default)(this,"links",void 0),(0,xp.default)(this,"runtime",void 0),(0,xp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return fL({links:this.links,op:(0,xx.default)((0,xx.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(uL())}async requestAsPromise(t){var e=this;try{const n=e.$request(t);return(await lL(n)).result.data}catch(n){throw gl.from(n)}}query(t,e,n){return this.requestAsPromise({type:"query",path:t,input:e,context:n?.context,signal:n?.signal})}mutation(t,e,n){return this.requestAsPromise({type:"mutation",path:t,input:e,context:n?.context,signal:n?.signal})}subscription(t,e,n){return this.$request({type:"subscription",path:t,input:e,context:n.context,signal:n.signal}).subscribe({next(o){switch(o.result.type){case"state":{var u;(u=n.onConnectionStateChange)===null||u===void 0||u.call(n,o.result);break}case"started":{var c;(c=n.onStarted)===null||c===void 0||c.call(n,{context:o.context});break}case"stopped":{var f;(f=n.onStopped)===null||f===void 0||f.call(n);break}case"data":case void 0:{var h;(h=n.onData)===null||h===void 0||h.call(n,o.result.data);break}}},error(o){var u;(u=n.onError)===null||u===void 0||u.call(n,o)},complete(){var o;(o=n.onComplete)===null||o===void 0||o.call(n)}})}};const GL=Symbol.for("trpc_untypedClient"),YL={query:"query",mutate:"mutation",subscribe:"subscription"},JL=t=>YL[t];function XL(t){const e=vL(({path:n,args:r})=>{const o=[...n],u=JL(o.pop()),c=o.join(".");return t[u](c,...r)});return bL(n=>n===GL?t:e[n])}function ZL(t){const e=new FL(t);return XL(e)}gt(ti());gt(ti());var QL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function n(o){var u,c,f,h=2;for(typeof Symbol<"u"&&(c=Symbol.asyncIterator,f=Symbol.iterator);h--;){if(c&&(u=o[c])!=null)return u.call(o);if(f&&(u=o[f])!=null)return new r(u.call(o));c="@@asyncIterator",f="@@iterator"}throw new TypeError("Object is not async iterable")}function r(o){function u(c){if(Object(c)!==c)return Promise.reject(new TypeError(c+" is not an object."));var f=c.done;return Promise.resolve(c.value).then(function(h){return{value:h,done:f}})}return r=function(f){this.s=f,this.n=f.next},r.prototype={s:null,n:null,next:function(){return u(this.n.apply(this.s,arguments))},return:function(f){var h=this.s.return;return h===void 0?Promise.resolve({value:f,done:!0}):u(h.apply(this.s,arguments))},throw:function(f){var h=this.s.return;return h===void 0?Promise.reject(f):u(h.apply(this.s,arguments))}},new r(o)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}});gt(QL());gt(ti());var WL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function n(){var r=typeof SuppressedError=="function"?SuppressedError:function(f,h){var m=Error();return m.name="SuppressedError",m.error=f,m.suppressed=h,m},o={},u=[];function c(f,h){if(h!=null){if(Object(h)!==h)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(f)var m=h[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(m===void 0&&(m=h[Symbol.dispose||Symbol.for("Symbol.dispose")],f))var y=m;if(typeof m!="function")throw new TypeError("Object is not disposable.");y&&(m=function(){try{y.call(h)}catch(b){return Promise.reject(b)}}),u.push({v:h,d:m,a:f})}else f&&u.push({d:h,a:f});return h}return{e:o,u:c.bind(null,!1),a:c.bind(null,!0),d:function(){var h,m=this.e,y=0;function g(){for(;h=u.pop();)try{if(!h.a&&y===1)return y=0,u.push(h),Promise.resolve().then(g);if(h.d){var S=h.d.call(h.v);if(h.a)return y|=2,Promise.resolve(S).then(g,b)}else y|=1}catch(x){return b(x)}if(y===1)return m!==o?Promise.reject(m):Promise.resolve();if(m!==o)throw m}function b(S){return m=m!==o?new r(S,m):S,g()}return g()}}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),aO=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function n(r,o){this.v=r,this.k=o}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),eV=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var n=aO();function r(o){return new n(o,0)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),tV=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var n=aO();function r(u){return function(){return new o(u.apply(this,arguments))}}function o(u){var c,f;function h(y,g){try{var b=u[y](g),S=b.value,x=S instanceof n;Promise.resolve(x?S.v:S).then(function(T){if(x){var _=y==="return"?"return":"next";if(!S.k||T.done)return h(_,T);T=u[_](T).value}m(b.done?"return":"normal",T)},function(T){h("throw",T)})}catch(T){m("throw",T)}}function m(y,g){switch(y){case"return":c.resolve({value:g,done:!0});break;case"throw":c.reject(g);break;default:c.resolve({value:g,done:!1})}(c=c.next)?h(c.key,c.arg):f=null}this._invoke=function(y,g){return new Promise(function(b,S){var x={key:y,arg:g,resolve:b,reject:S,next:null};f?f=f.next=x:(c=f=x,h(y,g))})},typeof u.return!="function"&&(this.return=void 0)}o.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(u){return this._invoke("next",u)},o.prototype.throw=function(u){return this._invoke("throw",u)},o.prototype.return=function(u){return this._invoke("return",u)},e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});gt(WL());gt(eV());gt(tV());gt(ti());function lO(t,e){if(t instanceof Promise)throw new Error(e)}function nV(t,e){const n={},r=[];for(const o in t){const u=t[o]["~standard"].validate(e[o]);if(lO(u,`Validation must be synchronous, but ${o} returned a Promise.`),u.issues){r.push(...u.issues.map(c=>({...c,message:c.message,path:[o,...c.path??[]]})));continue}n[o]=u.value}return r.length?{issues:r}:{value:n}}var iV={};function rV(t){const e=t.runtimeEnvStrict??t.runtimeEnv??iV;if(t.emptyStringAsUndefined??!1)for(const[T,_]of Object.entries(e))_===""&&delete e[T];if(t.skipValidation){if(t.extends)for(const T of t.extends)T.skipValidation=!0;return e}const n=typeof t.client=="object"?t.client:{},r=typeof t.server=="object"?t.server:{},o=typeof t.shared=="object"?t.shared:{},u=t.isServer??(typeof window>"u"||"Deno"in window),c=u?{...r,...o,...n}:{...n,...o},f=t.createFinalSchema?.(c,u)?.["~standard"].validate(e)??nV(c,e);lO(f,"Validation must be synchronous");const h=t.onValidationError??(T=>{throw console.error("❌ Invalid environment variables:",T),new Error("Invalid environment variables")}),m=t.onInvalidAccess??(()=>{throw new Error("❌ Attempted to access a server-side environment variable on the client")});if(f.issues)return h(f.issues);const y=T=>t.clientPrefix?!T.startsWith(t.clientPrefix)&&!(T in o):!0,g=T=>u||!y(T),b=T=>T==="__esModule"||T==="$$typeof",S=(t.extends??[]).reduce((T,_)=>Object.assign(T,_),{}),x=Object.assign(S,f.value);return new Proxy(x,{get(T,_){if(typeof _=="string"&&!b(_))return g(_)?Reflect.get(T,_):m(_)}})}const sV={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},oV="__vite_start_time"in globalThis,aV=typeof window<"u",qi=Et("string"),Tx=Et('"true" | "false" | undefined'),uO=rV({isServer:!oV&&!aV,server:{CI:Et("string | undefined").pipe(Boolean),POSTGRES_USER:qi,POSTGRES_PASSWORD:qi,POSTGRES_DATABASE:qi,POSTGRES_HOST:qi,POSTGRES_PORT:qi.pipe(t=>Number.parseInt(t,10)),BACKEND_PORT:qi.pipe(t=>Number.parseInt(t,10)),RUN_WORKERS_FROM_SOURCE:Tx.pipe(t=>t==="true"),FRONTEND_PORT:qi.pipe(t=>Number.parseInt(t,10)),FRONTEND_ORIGINS:qi.pipe.try(t=>JSON.parse(t),Et("string[]")),API_KEY_OPENAI:Et("string | undefined"),API_KEY_RESEND:Et("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:qi,VITE_DEV_FRONTEND_HOST:Et("string | undefined"),VITE_DEV_HTTPS:Tx.pipe(t=>t==="true")},runtimeEnv:sV,emptyStringAsUndefined:!0}),cn=ZL({links:[VL({url:uO.VITE_BACKEND_ORIGIN,fetch(t,e){return e?(Object.assign(e,{credentials:"include"}),fetch(t,e)):fetch(t)}})]}),lV=ft({key:"appVersionQuery",default:cn.version.query});ft({key:"lastKnownVersion",default:null,effects:[YE(localStorage,JSON,"lastKnownVersion")]});const uV=vi({key:"appVersion",get:async({get:t})=>{const e=t(lV),{version:n}=await e;return n}});function Tp(t){return["optional",t]}function cV(t,e){let n=[t];for(const r of e){if(typeof r!="string")return!1;n=n.flatMap(o=>{if(o===null)return[];const u=[],c=o[1],f=c[r];f!==void 0&&u.push(f);const h=Object.keys(c).find(m=>m.startsWith("$"));if(h){const m=c[h];m&&u.push(m)}return u})}for(const r of n)if(r===null||r[0]==="optional")return!0;return!1}const yi=Object.create(null);yi.open="0";yi.close="1";yi.ping="2";yi.pong="3";yi.message="4";yi.upgrade="5";yi.noop="6";const Ac=Object.create(null);Object.keys(yi).forEach(t=>{Ac[yi[t]]=t});const Tm={type:"error",data:"parser error"},cO=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",fO=typeof ArrayBuffer=="function",dO=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Hy=({type:t,data:e},n,r)=>cO&&e instanceof Blob?n?r(e):Ax(e,r):fO&&(e instanceof ArrayBuffer||dO(e))?n?r(e):Ax(new Blob([e]),r):r(yi[t]+(e||"")),Ax=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function Ex(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Ap;function fV(t,e){if(cO&&t.data instanceof Blob)return t.data.arrayBuffer().then(Ex).then(e);if(fO&&(t.data instanceof ArrayBuffer||dO(t.data)))return e(Ex(t.data));Hy(t,!1,n=>{Ap||(Ap=new TextEncoder),e(Ap.encode(n))})}const Ox="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Ox.length;t++)Wa[Ox.charCodeAt(t)]=t;const dV=t=>{let e=t.length*.75,n=t.length,r,o=0,u,c,f,h;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const m=new ArrayBuffer(e),y=new Uint8Array(m);for(r=0;r<n;r+=4)u=Wa[t.charCodeAt(r)],c=Wa[t.charCodeAt(r+1)],f=Wa[t.charCodeAt(r+2)],h=Wa[t.charCodeAt(r+3)],y[o++]=u<<2|c>>4,y[o++]=(c&15)<<4|f>>2,y[o++]=(f&3)<<6|h&63;return m},hV=typeof ArrayBuffer=="function",Fy=(t,e)=>{if(typeof t!="string")return{type:"message",data:hO(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:pV(t.substring(1),e)}:Ac[n]?t.length>1?{type:Ac[n],data:t.substring(1)}:{type:Ac[n]}:Tm},pV=(t,e)=>{if(hV){const n=dV(t);return hO(n,e)}else return{base64:!0,data:t}},hO=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},pO="",mV=(t,e)=>{const n=t.length,r=new Array(n);let o=0;t.forEach((u,c)=>{Hy(u,!1,f=>{r[c]=f,++o===n&&e(r.join(pO))})})},yV=(t,e)=>{const n=t.split(pO),r=[];for(let o=0;o<n.length;o++){const u=Fy(n[o],e);if(r.push(u),u.type==="error")break}return r};function gV(){return new TransformStream({transform(t,e){fV(t,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const u=new DataView(o.buffer);u.setUint8(0,126),u.setUint16(1,r)}else{o=new Uint8Array(9);const u=new DataView(o.buffer);u.setUint8(0,127),u.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(n)})}})}let Ep;function hc(t){return t.reduce((e,n)=>e+n.length,0)}function pc(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let o=0;o<e;o++)n[o]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function vV(t,e){Ep||(Ep=new TextDecoder);const n=[];let r=0,o=-1,u=!1;return new TransformStream({transform(c,f){for(n.push(c);;){if(r===0){if(hc(n)<1)break;const h=pc(n,1);u=(h[0]&128)===128,o=h[0]&127,o<126?r=3:o===126?r=1:r=2}else if(r===1){if(hc(n)<2)break;const h=pc(n,2);o=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(hc(n)<8)break;const h=pc(n,8),m=new DataView(h.buffer,h.byteOffset,h.length),y=m.getUint32(0);if(y>Math.pow(2,21)-1){f.enqueue(Tm);break}o=y*Math.pow(2,32)+m.getUint32(4),r=3}else{if(hc(n)<o)break;const h=pc(n,o);f.enqueue(Fy(u?h:Ep.decode(h),e)),r=0}if(o===0||o>t){f.enqueue(Tm);break}}}})}const mO=4;function Ot(t){if(t)return bV(t)}function bV(t){for(var e in Ot.prototype)t[e]=Ot.prototype[e];return t}Ot.prototype.on=Ot.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Ot.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Ot.prototype.off=Ot.prototype.removeListener=Ot.prototype.removeAllListeners=Ot.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Ot.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,o=n.length;r<o;++r)n[r].apply(this,e)}return this};Ot.prototype.emitReserved=Ot.prototype.emit;Ot.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Ot.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Nf=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Vn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),SV="arraybuffer";function yO(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const wV=Vn.setTimeout,xV=Vn.clearTimeout;function $f(t,e){e.useNativeTimers?(t.setTimeoutFn=wV.bind(Vn),t.clearTimeoutFn=xV.bind(Vn)):(t.setTimeoutFn=Vn.setTimeout.bind(Vn),t.clearTimeoutFn=Vn.clearTimeout.bind(Vn))}const TV=1.33;function AV(t){return typeof t=="string"?EV(t):Math.ceil((t.byteLength||t.size)*TV)}function EV(t){let e=0,n=0;for(let r=0,o=t.length;r<o;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function gO(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function OV(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function _V(t){let e={},n=t.split("&");for(let r=0,o=n.length;r<o;r++){let u=n[r].split("=");e[decodeURIComponent(u[0])]=decodeURIComponent(u[1])}return e}class RV extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Gy extends Ot{constructor(e){super(),this.writable=!1,$f(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new RV(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=Fy(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=OV(e);return n.length?"?"+n:""}}class kV extends Gy{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};yV(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,mV(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=gO()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let vO=!1;try{vO=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const CV=vO;function MV(){}class DV extends kV{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(o,u)=>{this.onError("xhr post error",o,u)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}let $o=class Ec extends Ot{constructor(e,n,r){super(),this.createRequest=e,$f(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=yO(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var o;r.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=Ec.requestsCount++,Ec.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=MV,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ec.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};$o.requestsCount=0;$o.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",_x);else if(typeof addEventListener=="function"){const t="onpagehide"in Vn?"pagehide":"unload";addEventListener(t,_x,!1)}}function _x(){for(let t in $o.requests)$o.requests.hasOwnProperty(t)&&$o.requests[t].abort()}const NV=(function(){const t=bO({xdomain:!1});return t&&t.responseType!==null})();class $V extends DV{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=NV&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new $o(bO,this.uri(),e)}}function bO(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||CV))return new XMLHttpRequest}catch{}if(!e)try{return new Vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const SO=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class jV extends Gy{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=SO?{}:yO(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;Hy(r,this.supportsBinary,u=>{try{this.doWrite(r,u)}catch{}o&&Nf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=gO()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const Op=Vn.WebSocket||Vn.MozWebSocket;class BV extends jV{createSocket(e,n,r){return SO?new Op(e,n,r):n?new Op(e,n):new Op(e)}doWrite(e,n){this.ws.send(n)}}class zV extends Gy{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=vV(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),o=gV();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const u=()=>{r.read().then(({done:f,value:h})=>{f||(this.onPacket(h),u())}).catch(f=>{})};u();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;this._writer.write(r).then(()=>{o&&Nf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const LV={websocket:BV,webtransport:zV,polling:$V},VV=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,UV=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Am(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let o=VV.exec(t||""),u={},c=14;for(;c--;)u[UV[c]]=o[c]||"";return n!=-1&&r!=-1&&(u.source=e,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=KV(u,u.path),u.queryKey=qV(u,u.query),u}function KV(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function qV(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,u){o&&(n[o]=u)}),n}const Em=typeof addEventListener=="function"&&typeof removeEventListener=="function",Oc=[];Em&&addEventListener("offline",()=>{Oc.forEach(t=>t())},!1);class jr extends Ot{constructor(e,n){if(super(),this.binaryType=SV,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=Am(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=Am(n.host).host);$f(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const o=r.prototype.name;this.transports.push(o),this._transportsByName[o]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=_V(this.opts.query)),Em&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Oc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=mO,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&jr.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",jr.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const o=this.writeBuffer[r].data;if(o&&(n+=AV(o)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Nf(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,o){if(typeof n=="function"&&(o=n,n=void 0),typeof r=="function"&&(o=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const u={type:e,data:n,options:r};this.emitReserved("packetCreate",u),this.writeBuffer.push(u),o&&this.once("flush",o),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(jr.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Em&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Oc.indexOf(this._offlineEventListener);r!==-1&&Oc.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}jr.protocol=mO;class PV extends jr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;jr.priorWebsocketSuccess=!1;const o=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",g=>{if(!r)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;jr.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(y(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const b=new Error("probe error");b.transport=n.name,this.emitReserved("upgradeError",b)}}))};function u(){r||(r=!0,y(),n.close(),n=null)}const c=g=>{const b=new Error("probe error: "+g);b.transport=n.name,u(),this.emitReserved("upgradeError",b)};function f(){c("transport closed")}function h(){c("socket closed")}function m(g){n&&g.name!==n.name&&u()}const y=()=>{n.removeListener("open",o),n.removeListener("error",c),n.removeListener("close",f),this.off("close",h),this.off("upgrading",m)};n.once("open",o),n.once("error",c),n.once("close",f),this.once("close",h),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let IV=class extends PV{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(o=>LV[o]).filter(o=>!!o)),super(e,r)}};function HV(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=Am(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const u=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+u+":"+r.port+e,r.href=r.protocol+"://"+u+(n&&n.port===r.port?"":":"+r.port),r}const FV=typeof ArrayBuffer=="function",GV=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,wO=Object.prototype.toString,YV=typeof Blob=="function"||typeof Blob<"u"&&wO.call(Blob)==="[object BlobConstructor]",JV=typeof File=="function"||typeof File<"u"&&wO.call(File)==="[object FileConstructor]";function Yy(t){return FV&&(t instanceof ArrayBuffer||GV(t))||YV&&t instanceof Blob||JV&&t instanceof File}function _c(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(_c(t[n]))return!0;return!1}if(Yy(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return _c(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&_c(t[n]))return!0;return!1}function XV(t){const e=[],n=t.data,r=t;return r.data=Om(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Om(t,e){if(!t)return t;if(Yy(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Om(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Om(t[r],e));return n}return t}function ZV(t,e){return t.data=_m(t.data,e),delete t.attachments,t}function _m(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=_m(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=_m(t[n],e));return t}const QV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],WV=5;var Ce;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(Ce||(Ce={}));class e4{constructor(e){this.replacer=e}encode(e){return(e.type===Ce.EVENT||e.type===Ce.ACK)&&_c(e)?this.encodeAsBinary({type:e.type===Ce.EVENT?Ce.BINARY_EVENT:Ce.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===Ce.BINARY_EVENT||e.type===Ce.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=XV(e),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function Rx(t){return Object.prototype.toString.call(t)==="[object Object]"}class Jy extends Ot{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===Ce.BINARY_EVENT;r||n.type===Ce.BINARY_ACK?(n.type=r?Ce.EVENT:Ce.ACK,this.reconstructor=new t4(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Yy(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(Ce[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Ce.BINARY_EVENT||r.type===Ce.BINARY_ACK){const u=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const c=e.substring(u,n);if(c!=Number(c)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(c)}if(e.charAt(n+1)==="/"){const u=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(u,n)}else r.nsp="/";const o=e.charAt(n+1);if(o!==""&&Number(o)==o){const u=n+1;for(;++n;){const c=e.charAt(n);if(c==null||Number(c)!=c){--n;break}if(n===e.length)break}r.id=Number(e.substring(u,n+1))}if(e.charAt(++n)){const u=this.tryParse(e.substr(n));if(Jy.isPayloadValid(r.type,u))r.data=u;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case Ce.CONNECT:return Rx(n);case Ce.DISCONNECT:return n===void 0;case Ce.CONNECT_ERROR:return typeof n=="string"||Rx(n);case Ce.EVENT:case Ce.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&QV.indexOf(n[0])===-1);case Ce.ACK:case Ce.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class t4{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=ZV(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const n4=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Jy,Encoder:e4,get PacketType(){return Ce},protocol:WV},Symbol.toStringTag,{value:"Module"}));function Zn(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const i4=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class xO extends Ot{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Zn(e,"open",this.onopen.bind(this)),Zn(e,"packet",this.onpacket.bind(this)),Zn(e,"error",this.onerror.bind(this)),Zn(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,o,u;if(i4.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const c={type:Ce.EVENT,data:n};if(c.options={},c.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const y=this.ids++,g=n.pop();this._registerAckCallback(y,g),c.id=y}const f=(o=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||o===void 0?void 0:o.writable,h=this.connected&&!(!((u=this.io.engine)===null||u===void 0)&&u._hasPingExpired());return this.flags.volatile&&!f||(h?(this.notifyOutgoingListeners(c),this.packet(c)):this.sendBuffer.push(c)),this.flags={},this}_registerAckCallback(e,n){var r;const o=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(o===void 0){this.acks[e]=n;return}const u=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let f=0;f<this.sendBuffer.length;f++)this.sendBuffer[f].id===e&&this.sendBuffer.splice(f,1);n.call(this,new Error("operation has timed out"))},o),c=(...f)=>{this.io.clearTimeoutFn(u),n.apply(this,f)};c.withError=!0,this.acks[e]=c}emitWithAck(e,...n){return new Promise((r,o)=>{const u=(c,f)=>c?o(c):r(f);u.withError=!0,n.push(u),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((o,...u)=>(this._queue[0],o!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...u)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ce.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ce.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ce.EVENT:case Ce.BINARY_EVENT:this.onevent(e);break;case Ce.ACK:case Ce.BINARY_ACK:this.onack(e);break;case Ce.DISCONNECT:this.ondisconnect();break;case Ce.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...o){r||(r=!0,n.packet({type:Ce.ACK,id:e,data:o}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ce.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function Xo(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Xo.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0};Xo.prototype.reset=function(){this.attempts=0};Xo.prototype.setMin=function(t){this.ms=t};Xo.prototype.setMax=function(t){this.max=t};Xo.prototype.setJitter=function(t){this.jitter=t};class Rm extends Ot{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,$f(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Xo({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const o=n.parser||n4;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new IV(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=Zn(n,"open",function(){r.onopen(),e&&e()}),u=f=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",f),e?e(f):this.maybeReconnectOnOpen()},c=Zn(n,"error",u);if(this._timeout!==!1){const f=this._timeout,h=this.setTimeoutFn(()=>{o(),u(new Error("timeout")),n.close()},f);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(o),this.subs.push(c),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Zn(e,"ping",this.onping.bind(this)),Zn(e,"data",this.ondata.bind(this)),Zn(e,"error",this.onerror.bind(this)),Zn(e,"close",this.onclose.bind(this)),Zn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Nf(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new xO(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ya={};function Rc(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=HV(t,e.path||"/socket.io"),r=n.source,o=n.id,u=n.path,c=Ya[o]&&u in Ya[o].nsps,f=e.forceNew||e["force new connection"]||e.multiplex===!1||c;let h;return f?h=new Rm(r,e):(Ya[o]||(Ya[o]=new Rm(r,e)),h=Ya[o]),n.query&&!e.query&&(e.query=n.queryKey),h.socket(n.path,e)}Object.assign(Rc,{Manager:Rm,Socket:xO,io:Rc,connect:Rc});const r4=["123","321","abc","admin","adobe","alexander","amanda","andrea","andrew","angel","apple","asdf","ashley","baby","banana","baseball","batman","bear","biteme","blazer","blonde","boston","buster","butterfly","cameron","charlie","cheese","chelsea","chicken","chocolate","chris","compaq","computer","cookie","corvette","cowboys","dakota","dallas","daniel","david","diamond","dolphin","donald","dragon","eagle","flower","football","frank","freedom","friend","gateway","george","ginger","god","golf","hannah","hardcore","harley","heather","hello","hottie","hunter","internet","jasmine","jennifer","jessica","jesus","johnny","jordan","joshua","justin","justme","killer","knight","lakers","letmein","liverpool","login","london","love","lucky","mackenzie","maggie","master","matrix","matthew","maverick","melissa","mercedes","michael","michelle","mickey","miller","money","monkey","morgan","mother","muffin","mustang","natasha","nathan","nicole","ninja","orange","pass","password","patrick","peanut","pepper","phoenix","photoshop","pokemon","princess","purple","qazwsx","qwerty","rainbow","ranger","root","samantha","samsung","scooter","secret","shadow","simpson","smile","soccer","sparkle","starwars","summer","sunflower","sunshine","superman","taylor","temp","test","thomas","tigers","tigger","tinkerbell","trust","turtle","victoria","welcome","whatever","william","winter","yellow","zaq12wsx","zxcvbn"],s4=3,o4=15,a4=/^[a-zA-Z0-9_-]+$/,l4=Et(a4).pipe(Et(`string > ${s4} & string < ${o4}`)).brand("username"),kx=20,Cx={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function u4(t){let e="";for(const n of t)n in Cx?e+=Cx[n]:e+=n;return e}function c4(t){const e=t.toLocaleLowerCase(),n=u4(e);for(const r of r4)if(n.includes(r)||e.includes(r))return!0;return!1}function f4(t){const e=new Set(t).size;return t.length*Math.log2(e)}function d4(t){let e=0;return c4(t)&&(e-=100),e+=f4(t)*.5,Math.max(e,0)}const h4=Et("string").narrow((t,e)=>{const n=d4(t);return n>=kx?!0:e.mustBe(`Of complexity ${kx} or more. Was ${n.toFixed(2)}.`)}).brand("password");Et({"+":"delete",email:"string",password:"string"});const p4=Et("string").brand("email");Et({"+":"delete",username:"string",password:"string",email:"string"});const m4=Et({email:"string",userId:"string",username:"string",password:"boolean",verification:"'unverified' | 'verified'"}),gi=Rc(uO.VITE_BACKEND_ORIGIN,{auth:t=>{const e=nt(ut);e&&t(e)},withCredentials:!0,autoConnect:!1});gi.on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),De(ut,null)}).on("usernameChanged",t=>{De(ut,e=>e===null?null:{...e,username:t})});const ut=ft({key:"auth",default:function(){const e=localStorage.getItem("auth");if(e)try{const n=qr(e),r=m4(n);return r instanceof Et.errors?(console.error("failed to parse auth data",r),null):(r.verification==="verified"&&(console.log("connecting..."),gi.connect()),r)}catch(n){return console.error("failed to parse auth data",n),null}return null},effects:[function({onSet:e}){e(({newValue:n})=>{console.log("setting auth",n),n?(console.log("setting auth",n),De(jo,n.username),localStorage.setItem("auth",zt(n)),n.verification==="verified"?(console.log("connecting..."),gi.connect()):_s("/verify")):(console.log("clearing session..."),localStorage.removeItem("auth"))})}]}),jo=ft({key:"username",default:nt(ut)?.username??""}),_p=ft({key:"usernameDebounce",default:!0}),y4=ft({key:"usernameDebounced100ms",default:window.localStorage.getItem("username")??"",effects:[({setSelf:t})=>{LC(jo,()=>{nt(_p)&&(t(nt(jo)),De(_p,!1),setTimeout(()=>{De(_p,!0),t(nt(jo))},2e3))})}]}),g4=vi({key:"isUsernameTakenQuery",get:({get:t})=>{const e=t(y4);if(!e)return!1;const n=nt(ut);return e===n?.username?!1:cn.isUsernameTaken.query({username:e})}}),TO=vi({key:"usernameIssues",get:({get:t})=>{const e=t(jo),n=l4(e);return n instanceof Et.errors?n:null}}),fi=ft({key:"password0",default:""}),AO=vi({key:"password0Issues",get:({get:t})=>{const e=t(fi),n=h4(e);return n instanceof Et.errors?n:null}}),Po=ft({key:"email",default:""}),EO=vi({key:"emailIssues",get:({get:t})=>{const e=t(Po),n=p4(e);return n instanceof Et.errors?n:null}});vi({key:"signupReady",get:({get:t})=>{const e=t(TO),n=t(AO),r=t(EO);return!(e??n??r)}});const Gi=ft({key:"oneTimeCode",default:""}),km=ft({key:"oneTimeCodeNewEmail",default:""}),li=ft({key:"authTarget",default:null}),OO=Tp({verify:Tp({$token:null}),game:Tp({clicker:null}),account:null,admin:null});function v4(t){return cV(OO,t)}const b4=[[]];function S4(t){return b4.some(e=>e.join("/")===t.join("/"))}function _s(t){history.pushState(null,"",t),De(_O,t)}const _O=ft({key:"pathName",default:window.location.pathname,effects:[({onSet:t,setSelf:e})=>{const n=o=>{history.replaceState(null,"",o),e(o)},r=o=>{switch(o){case"/":{const u=nt(ut);switch(console.log("/","auth",u),u?.verification){case"verified":n("/game");break;case"unverified":n("/verify");break}break}case"/verify":{nt(ut)?.verification==="verified"&&n("/game");break}case"/game":case"/game/clicker":{nt(ut)?.verification==="unverified"&&n("/verify");break}case"/admin":break;case"/account":{const u=nt(ut);if(!u){n("/");break}u.verification==="unverified"&&n("/verify");break}}};r(window.location.pathname),t(({newValue:o})=>{r(o)})},({setSelf:t})=>{document.addEventListener("click",e=>{const n=e.target.closest("a");if(n&&n instanceof HTMLAnchorElement){const r=n.getAttribute("href");r?.startsWith("/")&&(e.preventDefault(),history.pushState(null,"",r),t(r))}}),window.addEventListener("popstate",()=>{t(window.location.pathname)})}]}),w4=vi({key:"route",get:({get:t})=>{const n=t(_O).split("/").slice(1).filter(Boolean);return v4(n)?S4(n)||t(ut)?n:401:404}}),Mx=ft({key:"buttonBlockActive",default:!1}),Bn=ft({key:"editing",default:[],effects:[({onSet:t})=>{t(({newValue:e})=>{switch(e[0]){case"email":{nt(RO)?.focus();break}case"new-password":{nt(kO)?.focus();break}case"username":{nt(CO)?.focus();break}}})}]}),RO=ft({key:"emailInputElement",default:null}),kO=ft({key:"password0InputElement",default:null}),CO=ft({key:"usernameInputElement",default:null});function x4(t){const e=N.useRef(null);return N.useEffect(()=>{De(t,e.current)},[t]),e}const T4=vi({key:"otcLoginFieldLabel",get:({get:t})=>{const e=t(ut);return e?`Code sent to ${e.email}`:""}}),A4=vi({key:"otcVerifyFieldLabel",get:({get:t})=>{const e=t(Po);return e?`Code sent to ${e}`:""}});function Rp({label:t,inputToken:e,issuesToken:n,inputElementToken:r,initialState:o,onSubmit:u,onOpen:c,onCancel:f,extraIssues:h}){const m=At(e),y=Qn(e),g=At(Gi),b=Qn(Gi),S=At(km),x=Qn(km),T=At(fi),_=Qn(fi),k=At(Mx),C=Qn(Mx),M=At(Bn),G=Qn(Bn),I=At(n),ee=At(T4),J=At(A4),X=x4(r),he=M[0]===t,pe=M.at(-1),[we,...je]=M;return F.jsxs("form",{onSubmit:async be=>{if(be.preventDefault(),k){C(!1);return}console.log(`submitted! changing ${t} to`,m);const Z=await u(m);Error.isError(Z)&&console.error(Z)},children:[he?F.jsx("button",{type:"button",onClick:async()=>{await f?.(),G([])},children:"x"}):null,F.jsxs("main",{children:[F.jsxs("label",{htmlFor:t,children:[I||h?F.jsxs("aside",{children:[h,I?.map(be=>F.jsx("span",{children:be.message},be.path.join(".")))]}):null,F.jsx("span",{children:t==="new-password"?"Password":hs(t)}),F.jsx("input",{id:t,type:t==="new-password"?"password":"text",ref:X,value:m,onChange:be=>{y(be.target.value)},autoComplete:t,autoCapitalize:"none",disabled:pe!==t})]}),he?je.map(be=>F.jsxs("label",{htmlFor:`${t}-${be}`,children:[F.jsx("span",{children:(()=>{switch(be){case"otcLogin":return ee;case"otcVerify":return J;case"passwordLogin":return"Password"}})()}),F.jsx("input",{id:`${t}-otc`,type:"text",ref:X,value:(()=>{switch(be){case"otcLogin":return g;case"otcVerify":return t==="email"?S:g;case"passwordLogin":return T}})(),onChange:Z=>{switch(be){case"otcLogin":b(Z.target.value);break;case"otcVerify":if(t==="email"){x(Z.target.value);break}b(Z.target.value);break;case"passwordLogin":_(Z.target.value)}},autoComplete:t.includes("otc")?"one-time-code":t.includes("password")?"password":"",autoCapitalize:"none",disabled:be!==pe})]},`${t}-${be}`)):null]}),M[0]===t?F.jsx("button",{type:"submit",children:"->"}):F.jsx("button",{type:"button",onMouseDown:async()=>{C(!0),await c?.(),G(o)},onMouseUp:()=>{C(!1)},children:"/"})]})}function E4(){const t=At(ut),e=At(g4);return N.useEffect(()=>{t&&De(Po,t.email),t?.password&&De(fi,"••••••••••••")},[]),t?F.jsxs("article",{"data-css":"editor",children:[F.jsx(Rp,{label:"username",inputToken:jo,issuesToken:TO,inputElementToken:CO,initialState:["username"],onSubmit:async n=>(await new Promise(r=>{gi.once("usernameChanged",r),gi.emit("changeUsername",n)}),De(Bn,[]),n),extraIssues:e?F.jsx("span",{children:"This username is taken."}):null}),F.jsx(Rp,{label:"email",inputToken:Po,issuesToken:EO,inputElementToken:RO,initialState:["email"],onSubmit:async n=>{const r=nt(Bn);if(r[0]!=="email")return new Error("field not email");switch(r.length){case 1:{const{userKey:o,nextStep:u}=await cn.offerNewEmail.mutate({emailOffered:n});switch(console.log({authTarget:o,nextStep:u}),u){case"otc_login":{De(li,o),De(Bn,["email","otcLogin"]);break}case"password_login":{De(li,o),De(Bn,["email","passwordLogin"]);break}case"otc_verify":{De(li,o),De(Gi,"not needed"),De(Bn,["email","otcLogin","otcVerify"]);break}}return o}case 2:switch(console.log("case 2"),r[1]){case"otcLogin":{console.log("case 2.1");const o=nt(li);if(!o)return new Error("No auth target");const u=nt(Gi),c=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:o});return De(ut,c),De(Bn,["email","otcLogin","otcVerify"]),o}case"passwordLogin":return new Error("not implemented")}break;case 3:{const o=nt(li);if(!o)return new Error("No auth target");const u=nt(km),c=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:o});return De(ut,c),De(Bn,[]),c.email}}}}),F.jsx(Rp,{label:"new-password",inputToken:fi,issuesToken:AO,inputElementToken:kO,initialState:t.password?["new-password","otcVerify"]:["new-password"],onSubmit:async n=>{const r=nt(Bn);if(r[0]!=="new-password")return new Error("field not new-password");switch(r.length){case 1:return await cn.setPassword.mutate({password:n}),De(fi,"••••••••••••"),De(ut,o=>o&&{...o,password:!0}),De(Bn,[]),"done";case 2:{const o=nt(li);return o?(await cn.verifyAccountAction.mutate({oneTimeCode:nt(Gi),userKey:o}),De(ut,u=>u&&{...u,password:!1}),De(fi,""),De(Bn,["new-password"]),"done"):new Error("No userKey")}}},onCancel:()=>{t.password&&De(fi,"••••••••••••")},onOpen:async()=>{if(t.password){const n=nt(li);if(!n)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:n})}}})]}):F.jsx("p",{children:"You must be logged in to verify your account."})}function O4(){return F.jsx("article",{children:F.jsx("h1",{children:"admin"})})}const Xy=ft({key:"count",default:0}),MO=VC({key:"incrementTX",do:({set:t})=>{t(Xy,e=>e+1)}}),_4=CM({key:"countContinuity",config:t=>t.add(Xy).add(MO)});function R4({route:[,t]}){return F.jsx("article",{children:t?F.jsx(C4,{gameId:t}):F.jsx(k4,{})})}function k4(){return F.jsx("nav",{children:F.jsx(GE,{href:"/game/clicker",children:"Clicker"})})}KC(OO[1].game[1]);function C4({gameId:t}){console.log(t);const e=At(Xy),n=UC(MO);return qM(_4),F.jsxs("article",{children:[F.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",e]}),F.jsx("p",{children:"Let's see how high we can count!"})]})}const DO=N.createContext({});function M4(t){const e=N.useRef(null);return e.current===null&&(e.current=t()),e.current}const Zy=typeof window<"u",D4=Zy?N.useLayoutEffect:N.useEffect,Qy=N.createContext(null);function Wy(t,e){t.indexOf(e)===-1&&t.push(e)}function eg(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Wi=(t,e,n)=>n>e?e:n<t?t:n;let tg=()=>{};const er={},NO=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function $O(t){return typeof t=="object"&&t!==null}const jO=t=>/^0[^.\s]+$/u.test(t);function ng(t){let e;return()=>(e===void 0&&(e=t()),e)}const Kn=t=>t,N4=(t,e)=>n=>e(t(n)),jl=(...t)=>t.reduce(N4),vl=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class ig{constructor(){this.subscriptions=[]}add(e){return Wy(this.subscriptions,e),()=>eg(this.subscriptions,e)}notify(e,n,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,n,r);else for(let u=0;u<o;u++){const c=this.subscriptions[u];c&&c(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const pi=t=>t*1e3,Un=t=>t/1e3;function BO(t,e){return e?t*(1e3/e):0}const zO=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,$4=1e-7,j4=12;function B4(t,e,n,r,o){let u,c,f=0;do c=e+(n-e)/2,u=zO(c,r,o)-t,u>0?n=c:e=c;while(Math.abs(u)>$4&&++f<j4);return c}function Bl(t,e,n,r){if(t===e&&n===r)return Kn;const o=u=>B4(u,0,1,t,n);return u=>u===0||u===1?u:zO(o(u),e,r)}const LO=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,VO=t=>e=>1-t(1-e),UO=Bl(.33,1.53,.69,.99),rg=VO(UO),KO=LO(rg),qO=t=>(t*=2)<1?.5*rg(t):.5*(2-Math.pow(2,-10*(t-1))),sg=t=>1-Math.sin(Math.acos(t)),PO=VO(sg),IO=LO(sg),z4=Bl(.42,0,1,1),L4=Bl(0,0,.58,1),HO=Bl(.42,0,.58,1),V4=t=>Array.isArray(t)&&typeof t[0]!="number",FO=t=>Array.isArray(t)&&typeof t[0]=="number",U4={linear:Kn,easeIn:z4,easeInOut:HO,easeOut:L4,circIn:sg,circInOut:IO,circOut:PO,backIn:rg,backInOut:KO,backOut:UO,anticipate:qO},K4=t=>typeof t=="string",Dx=t=>{if(FO(t)){tg(t.length===4);const[e,n,r,o]=t;return Bl(e,n,r,o)}else if(K4(t))return U4[t];return t},mc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function q4(t,e){let n=new Set,r=new Set,o=!1,u=!1;const c=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function h(y){c.has(y)&&(m.schedule(y),t()),y(f)}const m={schedule:(y,g=!1,b=!1)=>{const x=b&&o?n:r;return g&&c.add(y),x.has(y)||x.add(y),y},cancel:y=>{r.delete(y),c.delete(y)},process:y=>{if(f=y,o){u=!0;return}o=!0,[n,r]=[r,n],n.forEach(h),n.clear(),o=!1,u&&(u=!1,m.process(y))}};return m}const P4=40;function GO(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},u=()=>n=!0,c=mc.reduce((M,G)=>(M[G]=q4(u),M),{}),{setup:f,read:h,resolveKeyframes:m,preUpdate:y,update:g,preRender:b,render:S,postRender:x}=c,T=()=>{const M=er.useManualTiming?o.timestamp:performance.now();n=!1,er.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(M-o.timestamp,P4),1)),o.timestamp=M,o.isProcessing=!0,f.process(o),h.process(o),m.process(o),y.process(o),g.process(o),b.process(o),S.process(o),x.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(T))},_=()=>{n=!0,r=!0,o.isProcessing||t(T)};return{schedule:mc.reduce((M,G)=>{const I=c[G];return M[G]=(ee,J=!1,X=!1)=>(n||_(),I.schedule(ee,J,X)),M},{}),cancel:M=>{for(let G=0;G<mc.length;G++)c[mc[G]].cancel(M)},state:o,steps:c}}const{schedule:it,cancel:Vr,state:Ht,steps:kp}=GO(typeof requestAnimationFrame<"u"?requestAnimationFrame:Kn,!0);let kc;function I4(){kc=void 0}const fn={now:()=>(kc===void 0&&fn.set(Ht.isProcessing||er.useManualTiming?Ht.timestamp:performance.now()),kc),set:t=>{kc=t,queueMicrotask(I4)}},YO=t=>e=>typeof e=="string"&&e.startsWith(t),JO=YO("--"),H4=YO("var(--"),og=t=>H4(t)?F4.test(t.split("/*")[0].trim()):!1,F4=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Zo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},bl={...Zo,transform:t=>Wi(0,1,t)},yc={...Zo,default:1},rl=t=>Math.round(t*1e5)/1e5,ag=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function G4(t){return t==null}const Y4=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,lg=(t,e)=>n=>!!(typeof n=="string"&&Y4.test(n)&&n.startsWith(t)||e&&!G4(n)&&Object.prototype.hasOwnProperty.call(n,e)),XO=(t,e,n)=>r=>{if(typeof r!="string")return r;const[o,u,c,f]=r.match(ag);return{[t]:parseFloat(o),[e]:parseFloat(u),[n]:parseFloat(c),alpha:f!==void 0?parseFloat(f):1}},J4=t=>Wi(0,255,t),Cp={...Zo,transform:t=>Math.round(J4(t))},gs={test:lg("rgb","red"),parse:XO("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Cp.transform(t)+", "+Cp.transform(e)+", "+Cp.transform(n)+", "+rl(bl.transform(r))+")"};function X4(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const Cm={test:lg("#"),parse:X4,transform:gs.transform},zl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Rr=zl("deg"),mi=zl("%"),de=zl("px"),Z4=zl("vh"),Q4=zl("vw"),Nx={...mi,parse:t=>mi.parse(t)/100,transform:t=>mi.transform(t*100)},Ao={test:lg("hsl","hue"),parse:XO("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+mi.transform(rl(e))+", "+mi.transform(rl(n))+", "+rl(bl.transform(r))+")"},Tt={test:t=>gs.test(t)||Cm.test(t)||Ao.test(t),parse:t=>gs.test(t)?gs.parse(t):Ao.test(t)?Ao.parse(t):Cm.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?gs.transform(t):Ao.transform(t),getAnimatableNone:t=>{const e=Tt.parse(t);return e.alpha=0,Tt.transform(e)}},W4=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function eU(t){return isNaN(t)&&typeof t=="string"&&(t.match(ag)?.length||0)+(t.match(W4)?.length||0)>0}const ZO="number",QO="color",tU="var",nU="var(",$x="${}",iU=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Sl(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let u=0;const f=e.replace(iU,h=>(Tt.test(h)?(r.color.push(u),o.push(QO),n.push(Tt.parse(h))):h.startsWith(nU)?(r.var.push(u),o.push(tU),n.push(h)):(r.number.push(u),o.push(ZO),n.push(parseFloat(h))),++u,$x)).split($x);return{values:n,split:f,indexes:r,types:o}}function WO(t){return Sl(t).values}function e_(t){const{split:e,types:n}=Sl(t),r=e.length;return o=>{let u="";for(let c=0;c<r;c++)if(u+=e[c],o[c]!==void 0){const f=n[c];f===ZO?u+=rl(o[c]):f===QO?u+=Tt.transform(o[c]):u+=o[c]}return u}}const rU=t=>typeof t=="number"?0:Tt.test(t)?Tt.getAnimatableNone(t):t;function sU(t){const e=WO(t);return e_(t)(e.map(rU))}const Ur={test:eU,parse:WO,createTransformer:e_,getAnimatableNone:sU};function Mp(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function oU({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let o=0,u=0,c=0;if(!e)o=u=c=n;else{const f=n<.5?n*(1+e):n+e-n*e,h=2*n-f;o=Mp(h,f,t+1/3),u=Mp(h,f,t),c=Mp(h,f,t-1/3)}return{red:Math.round(o*255),green:Math.round(u*255),blue:Math.round(c*255),alpha:r}}function Wc(t,e){return n=>n>0?e:t}const rt=(t,e,n)=>t+(e-t)*n,Dp=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},aU=[Cm,gs,Ao],lU=t=>aU.find(e=>e.test(t));function jx(t){const e=lU(t);if(!e)return!1;let n=e.parse(t);return e===Ao&&(n=oU(n)),n}const Bx=(t,e)=>{const n=jx(t),r=jx(e);if(!n||!r)return Wc(t,e);const o={...n};return u=>(o.red=Dp(n.red,r.red,u),o.green=Dp(n.green,r.green,u),o.blue=Dp(n.blue,r.blue,u),o.alpha=rt(n.alpha,r.alpha,u),gs.transform(o))},Mm=new Set(["none","hidden"]);function uU(t,e){return Mm.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function cU(t,e){return n=>rt(t,e,n)}function ug(t){return typeof t=="number"?cU:typeof t=="string"?og(t)?Wc:Tt.test(t)?Bx:hU:Array.isArray(t)?t_:typeof t=="object"?Tt.test(t)?Bx:fU:Wc}function t_(t,e){const n=[...t],r=n.length,o=t.map((u,c)=>ug(u)(u,e[c]));return u=>{for(let c=0;c<r;c++)n[c]=o[c](u);return n}}function fU(t,e){const n={...t,...e},r={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(r[o]=ug(t[o])(t[o],e[o]));return o=>{for(const u in r)n[u]=r[u](o);return n}}function dU(t,e){const n=[],r={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const u=e.types[o],c=t.indexes[u][r[u]],f=t.values[c]??0;n[o]=f,r[u]++}return n}const hU=(t,e)=>{const n=Ur.createTransformer(e),r=Sl(t),o=Sl(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?Mm.has(t)&&!o.values.length||Mm.has(e)&&!r.values.length?uU(t,e):jl(t_(dU(r,o),o.values),n):Wc(t,e)};function n_(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?rt(t,e,n):ug(t)(t,e)}const pU=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>it.update(e,n),stop:()=>Vr(e),now:()=>Ht.isProcessing?Ht.timestamp:fn.now()}},i_=(t,e,n=10)=>{let r="";const o=Math.max(Math.round(e/n),2);for(let u=0;u<o;u++)r+=Math.round(t(u/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},ef=2e4;function cg(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<ef;)e+=n,r=t.next(e);return e>=ef?1/0:e}function mU(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(cg(r),ef);return{type:"keyframes",ease:u=>r.next(o*u).value/e,duration:Un(o)}}const yU=5;function r_(t,e,n){const r=Math.max(e-yU,0);return BO(n-t(r),e-r)}const lt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Np=.001;function gU({duration:t=lt.duration,bounce:e=lt.bounce,velocity:n=lt.velocity,mass:r=lt.mass}){let o,u,c=1-e;c=Wi(lt.minDamping,lt.maxDamping,c),t=Wi(lt.minDuration,lt.maxDuration,Un(t)),c<1?(o=m=>{const y=m*c,g=y*t,b=y-n,S=Dm(m,c),x=Math.exp(-g);return Np-b/S*x},u=m=>{const g=m*c*t,b=g*n+n,S=Math.pow(c,2)*Math.pow(m,2)*t,x=Math.exp(-g),T=Dm(Math.pow(m,2),c);return(-o(m)+Np>0?-1:1)*((b-S)*x)/T}):(o=m=>{const y=Math.exp(-m*t),g=(m-n)*t+1;return-Np+y*g},u=m=>{const y=Math.exp(-m*t),g=(n-m)*(t*t);return y*g});const f=5/t,h=bU(o,u,f);if(t=pi(t),isNaN(h))return{stiffness:lt.stiffness,damping:lt.damping,duration:t};{const m=Math.pow(h,2)*r;return{stiffness:m,damping:c*2*Math.sqrt(r*m),duration:t}}}const vU=12;function bU(t,e,n){let r=n;for(let o=1;o<vU;o++)r=r-t(r)/e(r);return r}function Dm(t,e){return t*Math.sqrt(1-e*e)}const SU=["duration","bounce"],wU=["stiffness","damping","mass"];function zx(t,e){return e.some(n=>t[n]!==void 0)}function xU(t){let e={velocity:lt.velocity,stiffness:lt.stiffness,damping:lt.damping,mass:lt.mass,isResolvedFromDuration:!1,...t};if(!zx(t,wU)&&zx(t,SU))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),o=r*r,u=2*Wi(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:lt.mass,stiffness:o,damping:u}}else{const n=gU(t);e={...e,...n,mass:lt.mass},e.isResolvedFromDuration=!0}return e}function tf(t=lt.visualDuration,e=lt.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:o}=n;const u=n.keyframes[0],c=n.keyframes[n.keyframes.length-1],f={done:!1,value:u},{stiffness:h,damping:m,mass:y,duration:g,velocity:b,isResolvedFromDuration:S}=xU({...n,velocity:-Un(n.velocity||0)}),x=b||0,T=m/(2*Math.sqrt(h*y)),_=c-u,k=Un(Math.sqrt(h/y)),C=Math.abs(_)<5;r||(r=C?lt.restSpeed.granular:lt.restSpeed.default),o||(o=C?lt.restDelta.granular:lt.restDelta.default);let M;if(T<1){const I=Dm(k,T);M=ee=>{const J=Math.exp(-T*k*ee);return c-J*((x+T*k*_)/I*Math.sin(I*ee)+_*Math.cos(I*ee))}}else if(T===1)M=I=>c-Math.exp(-k*I)*(_+(x+k*_)*I);else{const I=k*Math.sqrt(T*T-1);M=ee=>{const J=Math.exp(-T*k*ee),X=Math.min(I*ee,300);return c-J*((x+T*k*_)*Math.sinh(X)+I*_*Math.cosh(X))/I}}const G={calculatedDuration:S&&g||null,next:I=>{const ee=M(I);if(S)f.done=I>=g;else{let J=I===0?x:0;T<1&&(J=I===0?pi(x):r_(M,I,ee));const X=Math.abs(J)<=r,he=Math.abs(c-ee)<=o;f.done=X&&he}return f.value=f.done?c:ee,f},toString:()=>{const I=Math.min(cg(G),ef),ee=i_(J=>G.next(I*J).value,I,30);return I+"ms "+ee},toTransition:()=>{}};return G}tf.applyToOptions=t=>{const e=mU(t,100,tf);return t.ease=e.ease,t.duration=pi(e.duration),t.type="keyframes",t};function Nm({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:u=500,modifyTarget:c,min:f,max:h,restDelta:m=.5,restSpeed:y}){const g=t[0],b={done:!1,value:g},S=X=>f!==void 0&&X<f||h!==void 0&&X>h,x=X=>f===void 0?h:h===void 0||Math.abs(f-X)<Math.abs(h-X)?f:h;let T=n*e;const _=g+T,k=c===void 0?_:c(_);k!==_&&(T=k-g);const C=X=>-T*Math.exp(-X/r),M=X=>k+C(X),G=X=>{const he=C(X),pe=M(X);b.done=Math.abs(he)<=m,b.value=b.done?k:pe};let I,ee;const J=X=>{S(b.value)&&(I=X,ee=tf({keyframes:[b.value,x(b.value)],velocity:r_(M,X,b.value),damping:o,stiffness:u,restDelta:m,restSpeed:y}))};return J(0),{calculatedDuration:null,next:X=>{let he=!1;return!ee&&I===void 0&&(he=!0,G(X),J(X)),I!==void 0&&X>=I?ee.next(X-I):(!he&&G(X),b)}}}function TU(t,e,n){const r=[],o=n||er.mix||n_,u=t.length-1;for(let c=0;c<u;c++){let f=o(t[c],t[c+1]);if(e){const h=Array.isArray(e)?e[c]||Kn:e;f=jl(h,f)}r.push(f)}return r}function AU(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const u=t.length;if(tg(u===e.length),u===1)return()=>e[0];if(u===2&&e[0]===e[1])return()=>e[1];const c=t[0]===t[1];t[0]>t[u-1]&&(t=[...t].reverse(),e=[...e].reverse());const f=TU(e,r,o),h=f.length,m=y=>{if(c&&y<t[0])return e[0];let g=0;if(h>1)for(;g<t.length-2&&!(y<t[g+1]);g++);const b=vl(t[g],t[g+1],y);return f[g](b)};return n?y=>m(Wi(t[0],t[u-1],y)):m}function EU(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=vl(0,e,r);t.push(rt(n,1,o))}}function OU(t){const e=[0];return EU(e,t.length-1),e}function _U(t,e){return t.map(n=>n*e)}function RU(t,e){return t.map(()=>e||HO).splice(0,t.length-1)}function sl({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=V4(r)?r.map(Dx):Dx(r),u={done:!1,value:e[0]},c=_U(n&&n.length===e.length?n:OU(e),t),f=AU(c,e,{ease:Array.isArray(o)?o:RU(e,o)});return{calculatedDuration:t,next:h=>(u.value=f(h),u.done=h>=t,u)}}const kU=t=>t!==null;function fg(t,{repeat:e,repeatType:n="loop"},r,o=1){const u=t.filter(kU),f=o<0||e&&n!=="loop"&&e%2===1?0:u.length-1;return!f||r===void 0?u[f]:r}const CU={decay:Nm,inertia:Nm,tween:sl,keyframes:sl,spring:tf};function s_(t){typeof t.type=="string"&&(t.type=CU[t.type])}class dg{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const MU=t=>t/100;class hg extends dg{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==fn.now()&&this.tick(fn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;s_(e);const{type:n=sl,repeat:r=0,repeatDelay:o=0,repeatType:u,velocity:c=0}=e;let{keyframes:f}=e;const h=n||sl;h!==sl&&typeof f[0]!="number"&&(this.mixKeyframes=jl(MU,n_(f[0],f[1])),f=[0,100]);const m=h({...e,keyframes:f});u==="mirror"&&(this.mirroredGenerator=h({...e,keyframes:[...f].reverse(),velocity:-c})),m.calculatedDuration===null&&(m.calculatedDuration=cg(m));const{calculatedDuration:y}=m;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=m}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:o,mixKeyframes:u,mirroredGenerator:c,resolvedDuration:f,calculatedDuration:h}=this;if(this.startTime===null)return r.next(0);const{delay:m=0,keyframes:y,repeat:g,repeatType:b,repeatDelay:S,type:x,onUpdate:T,finalKeyframe:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-o/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const k=this.currentTime-m*(this.playbackSpeed>=0?1:-1),C=this.playbackSpeed>=0?k<0:k>o;this.currentTime=Math.max(k,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let M=this.currentTime,G=r;if(g){const X=Math.min(this.currentTime,o)/f;let he=Math.floor(X),pe=X%1;!pe&&X>=1&&(pe=1),pe===1&&he--,he=Math.min(he,g+1),he%2&&(b==="reverse"?(pe=1-pe,S&&(pe-=S/f)):b==="mirror"&&(G=c)),M=Wi(0,1,pe)*f}const I=C?{done:!1,value:y[0]}:G.next(M);u&&(I.value=u(I.value));let{done:ee}=I;!C&&h!==null&&(ee=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const J=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&ee);return J&&x!==Nm&&(I.value=fg(y,this.options,_,this.speed)),T&&T(I.value),J&&this.finish(),I}then(e,n){return this.finished.then(e,n)}get duration(){return Un(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Un(e)}get time(){return Un(this.currentTime)}set time(e){e=pi(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(fn.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Un(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=pU,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(fn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function DU(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const vs=t=>t*180/Math.PI,$m=t=>{const e=vs(Math.atan2(t[1],t[0]));return jm(e)},NU={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:$m,rotateZ:$m,skewX:t=>vs(Math.atan(t[1])),skewY:t=>vs(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},jm=t=>(t=t%360,t<0&&(t+=360),t),Lx=$m,Vx=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Ux=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),$U={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Vx,scaleY:Ux,scale:t=>(Vx(t)+Ux(t))/2,rotateX:t=>jm(vs(Math.atan2(t[6],t[5]))),rotateY:t=>jm(vs(Math.atan2(-t[2],t[0]))),rotateZ:Lx,rotate:Lx,skewX:t=>vs(Math.atan(t[4])),skewY:t=>vs(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Bm(t){return t.includes("scale")?1:0}function zm(t,e){if(!t||t==="none")return Bm(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(n)r=$U,o=n;else{const f=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=NU,o=f}if(!o)return Bm(e);const u=r[e],c=o[1].split(",").map(BU);return typeof u=="function"?u(c):c[u]}const jU=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return zm(n,e)};function BU(t){return parseFloat(t.trim())}const Qo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Wo=new Set(Qo),Kx=t=>t===Zo||t===de,zU=new Set(["x","y","z"]),LU=Qo.filter(t=>!zU.has(t));function VU(t){const e=[];return LU.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const ws={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>zm(e,"x"),y:(t,{transform:e})=>zm(e,"y")};ws.translateX=ws.x;ws.translateY=ws.y;const xs=new Set;let Lm=!1,Vm=!1,Um=!1;function o_(){if(Vm){const t=Array.from(xs).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const o=VU(r);o.length&&(n.set(r,o),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const o=n.get(r);o&&o.forEach(([u,c])=>{r.getValue(u)?.set(c)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Vm=!1,Lm=!1,xs.forEach(t=>t.complete(Um)),xs.clear()}function a_(){xs.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Vm=!0)})}function UU(){Um=!0,a_(),o_(),Um=!1}class pg{constructor(e,n,r,o,u,c=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=o,this.element=u,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(xs.add(this),Lm||(Lm=!0,it.read(a_),it.resolveKeyframes(o_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:o}=this;if(e[0]===null){const u=o?.get(),c=e[e.length-1];if(u!==void 0)e[0]=u;else if(r&&n){const f=r.readValue(n,c);f!=null&&(e[0]=f)}e[0]===void 0&&(e[0]=c),o&&u===void 0&&o.set(e[0])}DU(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),xs.delete(this)}cancel(){this.state==="scheduled"&&(xs.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const KU=t=>t.startsWith("--");function qU(t,e,n){KU(e)?t.style.setProperty(e,n):t.style[e]=n}const PU=ng(()=>window.ScrollTimeline!==void 0),IU={};function HU(t,e){const n=ng(t);return()=>IU[e]??n()}const l_=HU(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),el=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,qx={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:el([0,.65,.55,1]),circOut:el([.55,0,1,.45]),backIn:el([.31,.01,.66,-.59]),backOut:el([.33,1.53,.69,.99])};function u_(t,e){if(t)return typeof t=="function"?l_()?i_(t,e):"ease-out":FO(t)?el(t):Array.isArray(t)?t.map(n=>u_(n,e)||qx.easeOut):qx[t]}function FU(t,e,n,{delay:r=0,duration:o=300,repeat:u=0,repeatType:c="loop",ease:f="easeOut",times:h}={},m=void 0){const y={[e]:n};h&&(y.offset=h);const g=u_(f,o);Array.isArray(g)&&(y.easing=g);const b={delay:r,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:u+1,direction:c==="reverse"?"alternate":"normal"};return m&&(b.pseudoElement=m),t.animate(y,b)}function c_(t){return typeof t=="function"&&"applyToOptions"in t}function GU({type:t,...e}){return c_(t)&&l_()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class YU extends dg{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:o,pseudoElement:u,allowFlatten:c=!1,finalKeyframe:f,onComplete:h}=e;this.isPseudoElement=!!u,this.allowFlatten=c,this.options=e,tg(typeof e.type!="string");const m=GU(e);this.animation=FU(n,r,o,m,u),m.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!u){const y=fg(o,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(y):qU(n,r,y),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Un(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Un(e)}get time(){return Un(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=pi(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&PU()?(this.animation.timeline=e,Kn):n(this)}}const f_={anticipate:qO,backInOut:KO,circInOut:IO};function JU(t){return t in f_}function XU(t){typeof t.ease=="string"&&JU(t.ease)&&(t.ease=f_[t.ease])}const Px=10;class ZU extends YU{constructor(e){XU(e),s_(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:o,element:u,...c}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const f=new hg({...c,autoplay:!1}),h=pi(this.finishedTime??this.time);n.setWithVelocity(f.sample(h-Px).value,f.sample(h).value,Px),f.stop()}}const Ix=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ur.test(t)||t==="0")&&!t.startsWith("url("));function QU(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function WU(t,e,n,r){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const u=t[t.length-1],c=Ix(o,e),f=Ix(u,e);return!c||!f?!1:QU(t)||(n==="spring"||c_(n))&&r}function Km(t){t.duration=0,t.type="keyframes"}const eK=new Set(["opacity","clipPath","filter","transform"]),tK=ng(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function nK(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:u,type:c}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:m}=e.owner.getProps();return tK()&&n&&eK.has(n)&&(n!=="transform"||!m)&&!h&&!r&&o!=="mirror"&&u!==0&&c!=="inertia"}const iK=40;class rK extends dg{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:o=0,repeatDelay:u=0,repeatType:c="loop",keyframes:f,name:h,motionValue:m,element:y,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=fn.now();const b={autoplay:e,delay:n,type:r,repeat:o,repeatDelay:u,repeatType:c,name:h,motionValue:m,element:y,...g},S=y?.KeyframeResolver||pg;this.keyframeResolver=new S(f,(x,T,_)=>this.onKeyframesResolved(x,T,b,!_),h,m,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,o){this.keyframeResolver=void 0;const{name:u,type:c,velocity:f,delay:h,isHandoff:m,onUpdate:y}=r;this.resolvedAt=fn.now(),WU(e,u,c,f)||((er.instantAnimations||!h)&&y?.(fg(e,r,n)),e[0]=e[e.length-1],Km(r),r.repeat=0);const b={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>iK?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},S=!m&&nK(b)?new ZU({...b,element:b.motionValue.owner.current}):new hg(b);S.finished.then(()=>this.notifyFinished()).catch(Kn),this.pendingTimeline&&(this.stopTimeline=S.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=S}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),UU()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const sK=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function oK(t){const e=sK.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${n??r}`,o]}function d_(t,e,n=1){const[r,o]=oK(t);if(!r)return;const u=window.getComputedStyle(e).getPropertyValue(r);if(u){const c=u.trim();return NO(c)?parseFloat(c):c}return og(o)?d_(o,e,n+1):o}function mg(t,e){return t?.[e]??t?.default??t}const h_=new Set(["width","height","top","left","right","bottom",...Qo]),aK={test:t=>t==="auto",parse:t=>t},p_=t=>e=>e.test(t),m_=[Zo,de,mi,Rr,Q4,Z4,aK],Hx=t=>m_.find(p_(t));function lK(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||jO(t):!0}const uK=new Set(["brightness","contrast","saturate","opacity"]);function cK(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(ag)||[];if(!r)return t;const o=n.replace(r,"");let u=uK.has(e)?1:0;return r!==n&&(u*=100),e+"("+u+o+")"}const fK=/\b([a-z-]*)\(.*?\)/gu,qm={...Ur,getAnimatableNone:t=>{const e=t.match(fK);return e?e.map(cK).join(" "):t}},Fx={...Zo,transform:Math.round},dK={rotate:Rr,rotateX:Rr,rotateY:Rr,rotateZ:Rr,scale:yc,scaleX:yc,scaleY:yc,scaleZ:yc,skew:Rr,skewX:Rr,skewY:Rr,distance:de,translateX:de,translateY:de,translateZ:de,x:de,y:de,z:de,perspective:de,transformPerspective:de,opacity:bl,originX:Nx,originY:Nx,originZ:de},yg={borderWidth:de,borderTopWidth:de,borderRightWidth:de,borderBottomWidth:de,borderLeftWidth:de,borderRadius:de,radius:de,borderTopLeftRadius:de,borderTopRightRadius:de,borderBottomRightRadius:de,borderBottomLeftRadius:de,width:de,maxWidth:de,height:de,maxHeight:de,top:de,right:de,bottom:de,left:de,padding:de,paddingTop:de,paddingRight:de,paddingBottom:de,paddingLeft:de,margin:de,marginTop:de,marginRight:de,marginBottom:de,marginLeft:de,backgroundPositionX:de,backgroundPositionY:de,...dK,zIndex:Fx,fillOpacity:bl,strokeOpacity:bl,numOctaves:Fx},hK={...yg,color:Tt,backgroundColor:Tt,outlineColor:Tt,fill:Tt,stroke:Tt,borderColor:Tt,borderTopColor:Tt,borderRightColor:Tt,borderBottomColor:Tt,borderLeftColor:Tt,filter:qm,WebkitFilter:qm},y_=t=>hK[t];function g_(t,e){let n=y_(t);return n!==qm&&(n=Ur),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const pK=new Set(["auto","none","0"]);function mK(t,e,n){let r=0,o;for(;r<t.length&&!o;){const u=t[r];typeof u=="string"&&!pK.has(u)&&Sl(u).values.length&&(o=t[r]),r++}if(o&&n)for(const u of e)t[u]=g_(n,o)}class yK extends pg{constructor(e,n,r,o,u){super(e,n,r,o,u,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<e.length;h++){let m=e[h];if(typeof m=="string"&&(m=m.trim(),og(m))){const y=d_(m,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!h_.has(r)||e.length!==2)return;const[o,u]=e,c=Hx(o),f=Hx(u);if(c!==f)if(Kx(c)&&Kx(f))for(let h=0;h<e.length;h++){const m=e[h];typeof m=="string"&&(e[h]=parseFloat(m))}else ws[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let o=0;o<e.length;o++)(e[o]===null||lK(e[o]))&&r.push(o);r.length&&mK(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ws[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&e.getValue(r,o).jump(o,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const u=r.length-1,c=r[u];r[u]=ws[n](e.measureViewportBox(),window.getComputedStyle(e.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),this.removedTransforms?.length&&this.removedTransforms.forEach(([f,h])=>{e.getValue(f).set(h)}),this.resolveNoneKeyframes()}}function gK(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const o=n?.[t]??r.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}const v_=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function vK(t){return $O(t)&&"offsetHeight"in t}const Gx=30,bK=t=>!isNaN(parseFloat(t));class SK{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const o=fn.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const u of this.dependents)u.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=fn.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=bK(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new ig);const r=this.events[e].add(n);return e==="change"?()=>{r(),it.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=fn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Gx)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Gx);return BO(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Io(t,e){return new SK(t,e)}const{schedule:gg}=GO(queueMicrotask,!1),Xn={x:!1,y:!1};function b_(){return Xn.x||Xn.y}function wK(t){return t==="x"||t==="y"?Xn[t]?null:(Xn[t]=!0,()=>{Xn[t]=!1}):Xn.x||Xn.y?null:(Xn.x=Xn.y=!0,()=>{Xn.x=Xn.y=!1})}function S_(t,e){const n=gK(t),r=new AbortController,o={passive:!0,...e,signal:r.signal};return[n,o,()=>r.abort()]}function Yx(t){return!(t.pointerType==="touch"||b_())}function xK(t,e,n={}){const[r,o,u]=S_(t,n),c=f=>{if(!Yx(f))return;const{target:h}=f,m=e(h,f);if(typeof m!="function"||!h)return;const y=g=>{Yx(g)&&(m(g),h.removeEventListener("pointerleave",y))};h.addEventListener("pointerleave",y,o)};return r.forEach(f=>{f.addEventListener("pointerenter",c,o)}),u}const w_=(t,e)=>e?t===e?!0:w_(t,e.parentElement):!1,vg=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,TK=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function AK(t){return TK.has(t.tagName)||t.tabIndex!==-1}const Cc=new WeakSet;function Jx(t){return e=>{e.key==="Enter"&&t(e)}}function $p(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const EK=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=Jx(()=>{if(Cc.has(n))return;$p(n,"down");const o=Jx(()=>{$p(n,"up")}),u=()=>$p(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",u,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function Xx(t){return vg(t)&&!b_()}function OK(t,e,n={}){const[r,o,u]=S_(t,n),c=f=>{const h=f.currentTarget;if(!Xx(f))return;Cc.add(h);const m=e(h,f),y=(S,x)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",b),Cc.has(h)&&Cc.delete(h),Xx(S)&&typeof m=="function"&&m(S,{success:x})},g=S=>{y(S,h===window||h===document||n.useGlobalTarget||w_(h,S.target))},b=S=>{y(S,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",b,o)};return r.forEach(f=>{(n.useGlobalTarget?window:f).addEventListener("pointerdown",c,o),vK(f)&&(f.addEventListener("focus",m=>EK(m,o)),!AK(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),u}function x_(t){return $O(t)&&"ownerSVGElement"in t}function _K(t){return x_(t)&&t.tagName==="svg"}const Jt=t=>!!(t&&t.getVelocity),RK=[...m_,Tt,Ur],kK=t=>RK.find(p_(t)),T_=N.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function CK(t=!0){const e=N.useContext(Qy);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=e,u=N.useId();N.useEffect(()=>{if(t)return o(u)},[t]);const c=N.useCallback(()=>t&&r&&r(u),[u,r,t]);return!n&&r?[!1,c]:[!0]}const A_=N.createContext({strict:!1}),Zx={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Ho={};for(const t in Zx)Ho[t]={isEnabled:e=>Zx[t].some(n=>!!e[n])};function MK(t){for(const e in t)Ho[e]={...Ho[e],...t[e]}}const DK=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function nf(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||DK.has(t)}let E_=t=>!nf(t);function NK(t){typeof t=="function"&&(E_=e=>e.startsWith("on")?!nf(e):t(e))}try{NK(require("@emotion/is-prop-valid").default)}catch{}function $K(t,e,n){const r={};for(const o in t)o==="values"&&typeof t.values=="object"||(E_(o)||n===!0&&nf(o)||!e&&!nf(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}const jf=N.createContext({});function Bf(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function wl(t){return typeof t=="string"||Array.isArray(t)}const bg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Sg=["initial",...bg];function zf(t){return Bf(t.animate)||Sg.some(e=>wl(t[e]))}function O_(t){return!!(zf(t)||t.variants)}function jK(t,e){if(zf(t)){const{initial:n,animate:r}=t;return{initial:n===!1||wl(n)?n:void 0,animate:wl(r)?r:void 0}}return t.inherit!==!1?e:{}}function BK(t){const{initial:e,animate:n}=jK(t,N.useContext(jf));return N.useMemo(()=>({initial:e,animate:n}),[Qx(e),Qx(n)])}function Qx(t){return Array.isArray(t)?t.join(" "):t}function Wx(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ja={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(de.test(t))t=parseFloat(t);else return t;const n=Wx(t,e.target.x),r=Wx(t,e.target.y);return`${n}% ${r}%`}},zK={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,o=Ur.parse(t);if(o.length>5)return r;const u=Ur.createTransformer(t),c=typeof o[0]!="number"?1:0,f=n.x.scale*e.x,h=n.y.scale*e.y;o[0+c]/=f,o[1+c]/=h;const m=rt(f,h,.5);return typeof o[2+c]=="number"&&(o[2+c]/=m),typeof o[3+c]=="number"&&(o[3+c]/=m),u(o)}},Pm={borderRadius:{...Ja,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ja,borderTopRightRadius:Ja,borderBottomLeftRadius:Ja,borderBottomRightRadius:Ja,boxShadow:zK};function __(t,{layout:e,layoutId:n}){return Wo.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Pm[t]||t==="opacity")}const LK={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},VK=Qo.length;function UK(t,e,n){let r="",o=!0;for(let u=0;u<VK;u++){const c=Qo[u],f=t[c];if(f===void 0)continue;let h=!0;if(typeof f=="number"?h=f===(c.startsWith("scale")?1:0):h=parseFloat(f)===0,!h||n){const m=v_(f,yg[c]);if(!h){o=!1;const y=LK[c]||c;r+=`${y}(${m}) `}n&&(e[c]=m)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}function wg(t,e,n){const{style:r,vars:o,transformOrigin:u}=t;let c=!1,f=!1;for(const h in e){const m=e[h];if(Wo.has(h)){c=!0;continue}else if(JO(h)){o[h]=m;continue}else{const y=v_(m,yg[h]);h.startsWith("origin")?(f=!0,u[h]=y):r[h]=y}}if(e.transform||(c||n?r.transform=UK(e,t.transform,n):r.transform&&(r.transform="none")),f){const{originX:h="50%",originY:m="50%",originZ:y=0}=u;r.transformOrigin=`${h} ${m} ${y}`}}const xg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function R_(t,e,n){for(const r in e)!Jt(e[r])&&!__(r,n)&&(t[r]=e[r])}function KK({transformTemplate:t},e){return N.useMemo(()=>{const n=xg();return wg(n,e,t),Object.assign({},n.vars,n.style)},[e])}function qK(t,e){const n=t.style||{},r={};return R_(r,n,t),Object.assign(r,KK(t,e)),r}function PK(t,e){const n={},r=qK(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const IK={offset:"stroke-dashoffset",array:"stroke-dasharray"},HK={offset:"strokeDashoffset",array:"strokeDasharray"};function FK(t,e,n=1,r=0,o=!0){t.pathLength=1;const u=o?IK:HK;t[u.offset]=de.transform(-r);const c=de.transform(e),f=de.transform(n);t[u.array]=`${c} ${f}`}function k_(t,{attrX:e,attrY:n,attrScale:r,pathLength:o,pathSpacing:u=1,pathOffset:c=0,...f},h,m,y){if(wg(t,f,m),h){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:g,style:b}=t;g.transform&&(b.transform=g.transform,delete g.transform),(b.transform||g.transformOrigin)&&(b.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),b.transform&&(b.transformBox=y?.transformBox??"fill-box",delete g.transformBox),e!==void 0&&(g.x=e),n!==void 0&&(g.y=n),r!==void 0&&(g.scale=r),o!==void 0&&FK(g,o,u,c,!1)}const C_=()=>({...xg(),attrs:{}}),M_=t=>typeof t=="string"&&t.toLowerCase()==="svg";function GK(t,e,n,r){const o=N.useMemo(()=>{const u=C_();return k_(u,e,M_(r),t.transformTemplate,t.style),{...u.attrs,style:{...u.style}}},[e]);if(t.style){const u={};R_(u,t.style,t),o.style={...u,...o.style}}return o}const YK=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Tg(t){return typeof t!="string"||t.includes("-")?!1:!!(YK.indexOf(t)>-1||/[A-Z]/u.test(t))}function JK(t,e,n,{latestValues:r},o,u=!1){const f=(Tg(t)?GK:PK)(e,r,o,t),h=$K(e,typeof t=="string",u),m=t!==N.Fragment?{...h,...f,ref:n}:{},{children:y}=e,g=N.useMemo(()=>Jt(y)?y.get():y,[y]);return N.createElement(t,{...m,children:g})}function e1(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Ag(t,e,n,r){if(typeof e=="function"){const[o,u]=e1(r);e=e(n!==void 0?n:t.custom,o,u)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,u]=e1(r);e=e(n!==void 0?n:t.custom,o,u)}return e}function Mc(t){return Jt(t)?t.get():t}function XK({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,o){return{latestValues:ZK(n,r,o,t),renderState:e()}}function ZK(t,e,n,r){const o={},u=r(t,{});for(const b in u)o[b]=Mc(u[b]);let{initial:c,animate:f}=t;const h=zf(t),m=O_(t);e&&m&&!h&&t.inherit!==!1&&(c===void 0&&(c=e.initial),f===void 0&&(f=e.animate));let y=n?n.initial===!1:!1;y=y||c===!1;const g=y?f:c;if(g&&typeof g!="boolean"&&!Bf(g)){const b=Array.isArray(g)?g:[g];for(let S=0;S<b.length;S++){const x=Ag(t,b[S]);if(x){const{transitionEnd:T,transition:_,...k}=x;for(const C in k){let M=k[C];if(Array.isArray(M)){const G=y?M.length-1:0;M=M[G]}M!==null&&(o[C]=M)}for(const C in T)o[C]=T[C]}}}return o}const D_=t=>(e,n)=>{const r=N.useContext(jf),o=N.useContext(Qy),u=()=>XK(t,e,r,o);return n?u():M4(u)};function Eg(t,e,n){const{style:r}=t,o={};for(const u in r)(Jt(r[u])||e.style&&Jt(e.style[u])||__(u,t)||n?.getValue(u)?.liveStyle!==void 0)&&(o[u]=r[u]);return o}const QK=D_({scrapeMotionValuesFromProps:Eg,createRenderState:xg});function N_(t,e,n){const r=Eg(t,e,n);for(const o in t)if(Jt(t[o])||Jt(e[o])){const u=Qo.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[u]=t[o]}return r}const WK=D_({scrapeMotionValuesFromProps:N_,createRenderState:C_}),eq=Symbol.for("motionComponentSymbol");function Eo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function tq(t,e,n){return N.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):Eo(n)&&(n.current=r))},[e])}const Og=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),nq="framerAppearId",$_="data-"+Og(nq),j_=N.createContext({});function iq(t,e,n,r,o){const{visualElement:u}=N.useContext(jf),c=N.useContext(A_),f=N.useContext(Qy),h=N.useContext(T_).reducedMotion,m=N.useRef(null);r=r||c.renderer,!m.current&&r&&(m.current=r(t,{visualState:e,parent:u,props:n,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:h}));const y=m.current,g=N.useContext(j_);y&&!y.projection&&o&&(y.type==="html"||y.type==="svg")&&rq(m.current,n,o,g);const b=N.useRef(!1);N.useInsertionEffect(()=>{y&&b.current&&y.update(n,f)});const S=n[$_],x=N.useRef(!!S&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return D4(()=>{y&&(b.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),x.current&&y.animationState&&y.animationState.animateChanges())}),N.useEffect(()=>{y&&(!x.current&&y.animationState&&y.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),x.current=!1),y.enteringChildren=void 0)}),y}function rq(t,e,n,r){const{layoutId:o,layout:u,drag:c,dragConstraints:f,layoutScroll:h,layoutRoot:m,layoutCrossfade:y}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:B_(t.parent)),t.projection.setOptions({layoutId:o,layout:u,alwaysMeasureLayout:!!c||f&&Eo(f),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:h,layoutRoot:m})}function B_(t){if(t)return t.options.allowProjection!==!1?t.projection:B_(t.parent)}function jp(t,{forwardMotionProps:e=!1}={},n,r){n&&MK(n);const o=Tg(t)?WK:QK;function u(f,h){let m;const y={...N.useContext(T_),...f,layoutId:sq(f)},{isStatic:g}=y,b=BK(f),S=o(f,g);if(!g&&Zy){oq();const x=aq(y);m=x.MeasureLayout,b.visualElement=iq(t,S,y,r,x.ProjectionNode)}return F.jsxs(jf.Provider,{value:b,children:[m&&b.visualElement?F.jsx(m,{visualElement:b.visualElement,...y}):null,JK(t,f,tq(S,b.visualElement,h),S,g,e)]})}u.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const c=N.forwardRef(u);return c[eq]=t,c}function sq({layoutId:t}){const e=N.useContext(DO).id;return e&&t!==void 0?e+"-"+t:t}function oq(t,e){N.useContext(A_).strict}function aq(t){const{drag:e,layout:n}=Ho;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function lq(t,e){if(typeof Proxy>"u")return jp;const n=new Map,r=(u,c)=>jp(u,c,t,e),o=(u,c)=>r(u,c);return new Proxy(o,{get:(u,c)=>c==="create"?r:(n.has(c)||n.set(c,jp(c,void 0,t,e)),n.get(c))})}function z_({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function uq({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function cq(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Bp(t){return t===void 0||t===1}function Im({scale:t,scaleX:e,scaleY:n}){return!Bp(t)||!Bp(e)||!Bp(n)}function ms(t){return Im(t)||L_(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function L_(t){return t1(t.x)||t1(t.y)}function t1(t){return t&&t!=="0%"}function rf(t,e,n){const r=t-n,o=e*r;return n+o}function n1(t,e,n,r,o){return o!==void 0&&(t=rf(t,o,r)),rf(t,n,r)+e}function Hm(t,e=0,n=1,r,o){t.min=n1(t.min,e,n,r,o),t.max=n1(t.max,e,n,r,o)}function V_(t,{x:e,y:n}){Hm(t.x,e.translate,e.scale,e.originPoint),Hm(t.y,n.translate,n.scale,n.originPoint)}const i1=.999999999999,r1=1.0000000000001;function fq(t,e,n,r=!1){const o=n.length;if(!o)return;e.x=e.y=1;let u,c;for(let f=0;f<o;f++){u=n[f],c=u.projectionDelta;const{visualElement:h}=u.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&u.options.layoutScroll&&u.scroll&&u!==u.root&&_o(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),c&&(e.x*=c.x.scale,e.y*=c.y.scale,V_(t,c)),r&&ms(u.latestValues)&&_o(t,u.latestValues))}e.x<r1&&e.x>i1&&(e.x=1),e.y<r1&&e.y>i1&&(e.y=1)}function Oo(t,e){t.min=t.min+e,t.max=t.max+e}function s1(t,e,n,r,o=.5){const u=rt(t.min,t.max,o);Hm(t,e,n,u,r)}function _o(t,e){s1(t.x,e.x,e.scaleX,e.scale,e.originX),s1(t.y,e.y,e.scaleY,e.scale,e.originY)}function U_(t,e){return z_(cq(t.getBoundingClientRect(),e))}function dq(t,e,n){const r=U_(t,n),{scroll:o}=e;return o&&(Oo(r.x,o.offset.x),Oo(r.y,o.offset.y)),r}const o1=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ro=()=>({x:o1(),y:o1()}),a1=()=>({min:0,max:0}),Ct=()=>({x:a1(),y:a1()}),Fm={current:null},K_={current:!1};function hq(){if(K_.current=!0,!!Zy)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Fm.current=t.matches;t.addEventListener("change",e),e()}else Fm.current=!1}const pq=new WeakMap;function mq(t,e,n){for(const r in e){const o=e[r],u=n[r];if(Jt(o))t.addValue(r,o);else if(Jt(u))t.addValue(r,Io(o,{owner:t}));else if(u!==o)if(t.hasValue(r)){const c=t.getValue(r);c.liveStyle===!0?c.jump(o):c.hasAnimated||c.set(o)}else{const c=t.getStaticValue(r);t.addValue(r,Io(c!==void 0?c:o,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const l1=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class yq{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:u,visualState:c},f={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=pg,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const b=fn.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,it.render(this.render,!1,!0))};const{latestValues:h,renderState:m}=c;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=m,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=f,this.blockInitialAnimation=!!u,this.isControllingVariants=zf(n),this.isVariantNode=O_(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:y,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const b in g){const S=g[b];h[b]!==void 0&&Jt(S)&&S.set(h[b])}}mount(e){this.current=e,pq.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),K_.current||hq(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Fm.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Vr(this.notifyUpdate),Vr(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=Wo.has(e);r&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",c=>{this.latestValues[e]=c,this.props.onUpdate&&it.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),u&&u(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Ho){const n=Ho[e];if(!n)continue;const{isEnabled:r,Feature:o}=n;if(!this.features[e]&&o&&r(this.props)&&(this.features[e]=new o(this)),this.features[e]){const u=this.features[e];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ct()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<l1.length;r++){const o=l1[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const u="on"+o,c=e[u];c&&(this.propEventSubscriptions[o]=this.on(o,c))}this.prevMotionValues=mq(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Io(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(NO(r)||jO(r))?r=parseFloat(r):!kK(r)&&Ur.test(n)&&(r=g_(e,n)),this.setBaseTarget(e,Jt(r)?r.get():r)),Jt(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const u=Ag(this.props,n,this.presenceContext?.custom);u&&(r=u[e])}if(n&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,e);return o!==void 0&&!Jt(o)?o:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new ig),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){gg.render(this.render)}}class q_ extends yq{constructor(){super(...arguments),this.KeyframeResolver=yK}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Jt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function P_(t,{style:e,vars:n},r,o){const u=t.style;let c;for(c in e)u[c]=e[c];o?.applyProjectionStyles(u,r);for(c in n)u.setProperty(c,n[c])}function gq(t){return window.getComputedStyle(t)}class vq extends q_{constructor(){super(...arguments),this.type="html",this.renderInstance=P_}readValueFromInstance(e,n){if(Wo.has(n))return this.projection?.isProjecting?Bm(n):jU(e,n);{const r=gq(e),o=(JO(n)?r.getPropertyValue(n):r[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return U_(e,n)}build(e,n,r){wg(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return Eg(e,n,r)}}const I_=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function bq(t,e,n,r){P_(t,e,void 0,r);for(const o in e.attrs)t.setAttribute(I_.has(o)?o:Og(o),e.attrs[o])}class Sq extends q_{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ct}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Wo.has(n)){const r=y_(n);return r&&r.default||0}return n=I_.has(n)?n:Og(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return N_(e,n,r)}build(e,n,r){k_(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,o){bq(e,n,r,o)}mount(e){this.isSVGTag=M_(e.tagName),super.mount(e)}}const wq=(t,e)=>Tg(t)?new Sq(e):new vq(e,{allowProjection:t!==N.Fragment});function Bo(t,e,n){const r=t.getProps();return Ag(r,e,n!==void 0?n:r.custom,t)}const Gm=t=>Array.isArray(t);function xq(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Io(n))}function Tq(t){return Gm(t)?t[t.length-1]||0:t}function Aq(t,e){const n=Bo(t,e);let{transitionEnd:r={},transition:o={},...u}=n||{};u={...u,...r};for(const c in u){const f=Tq(u[c]);xq(t,c,f)}}function Eq(t){return!!(Jt(t)&&t.add)}function Ym(t,e){const n=t.getValue("willChange");if(Eq(n))return n.add(e);if(!n&&er.WillChange){const r=new er.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function H_(t){return t.props[$_]}const Oq=t=>t!==null;function _q(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(Oq),u=e&&n!=="loop"&&e%2===1?0:o.length-1;return o[u]}const Rq={type:"spring",stiffness:500,damping:25,restSpeed:10},kq=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Cq={type:"keyframes",duration:.8},Mq={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Dq=(t,{keyframes:e})=>e.length>2?Cq:Wo.has(t)?t.startsWith("scale")?kq(e[1]):Rq:Mq;function Nq({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:u,repeatType:c,repeatDelay:f,from:h,elapsed:m,...y}){return!!Object.keys(y).length}const _g=(t,e,n,r={},o,u)=>c=>{const f=mg(r,t)||{},h=f.delay||r.delay||0;let{elapsed:m=0}=r;m=m-pi(h);const y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...f,delay:-m,onUpdate:b=>{e.set(b),f.onUpdate&&f.onUpdate(b)},onComplete:()=>{c(),f.onComplete&&f.onComplete()},name:t,motionValue:e,element:u?void 0:o};Nq(f)||Object.assign(y,Dq(t,y)),y.duration&&(y.duration=pi(y.duration)),y.repeatDelay&&(y.repeatDelay=pi(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let g=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(Km(y),y.delay===0&&(g=!0)),(er.instantAnimations||er.skipAnimations)&&(g=!0,Km(y),y.delay=0),y.allowFlatten=!f.type&&!f.ease,g&&!u&&e.get()!==void 0){const b=_q(y.keyframes,f);if(b!==void 0){it.update(()=>{y.onUpdate(b),y.onComplete()});return}}return f.isSync?new hg(y):new rK(y)};function $q({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function F_(t,e,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:u=t.getDefaultTransition(),transitionEnd:c,...f}=e;r&&(u=r);const h=[],m=o&&t.animationState&&t.animationState.getState()[o];for(const y in f){const g=t.getValue(y,t.latestValues[y]??null),b=f[y];if(b===void 0||m&&$q(m,y))continue;const S={delay:n,...mg(u||{},y)},x=g.get();if(x!==void 0&&!g.isAnimating&&!Array.isArray(b)&&b===x&&!S.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const k=H_(t);if(k){const C=window.MotionHandoffAnimation(k,y,it);C!==null&&(S.startTime=C,T=!0)}}Ym(t,y),g.start(_g(y,g,b,t.shouldReduceMotion&&h_.has(y)?{type:!1}:S,t,T));const _=g.animation;_&&h.push(_)}return c&&Promise.all(h).then(()=>{it.update(()=>{c&&Aq(t,c)})}),h}function G_(t,e,n,r=0,o=1){const u=Array.from(t).sort((m,y)=>m.sortNodePosition(y)).indexOf(e),c=t.size,f=(c-1)*r;return typeof n=="function"?n(u,c):o===1?u*r:f-u*r}function Jm(t,e,n={}){const r=Bo(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(o=n.transitionOverride);const u=r?()=>Promise.all(F_(t,r,n)):()=>Promise.resolve(),c=t.variantChildren&&t.variantChildren.size?(h=0)=>{const{delayChildren:m=0,staggerChildren:y,staggerDirection:g}=o;return jq(t,e,h,m,y,g,n)}:()=>Promise.resolve(),{when:f}=o;if(f){const[h,m]=f==="beforeChildren"?[u,c]:[c,u];return h().then(()=>m())}else return Promise.all([u(),c(n.delay)])}function jq(t,e,n=0,r=0,o=0,u=1,c){const f=[];for(const h of t.variantChildren)h.notify("AnimationStart",e),f.push(Jm(h,e,{...c,delay:n+(typeof r=="function"?0:r)+G_(t.variantChildren,h,r,o,u)}).then(()=>h.notify("AnimationComplete",e)));return Promise.all(f)}function Bq(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const o=e.map(u=>Jm(t,u,n));r=Promise.all(o)}else if(typeof e=="string")r=Jm(t,e,n);else{const o=typeof e=="function"?Bo(t,e,n.custom):e;r=Promise.all(F_(t,o,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function Y_(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const zq=Sg.length;function J_(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?J_(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<zq;n++){const r=Sg[n],o=t.props[r];(wl(o)||o===!1)&&(e[r]=o)}return e}const Lq=[...bg].reverse(),Vq=bg.length;function Uq(t){return e=>Promise.all(e.map(({animation:n,options:r})=>Bq(t,n,r)))}function Kq(t){let e=Uq(t),n=u1(),r=!0;const o=h=>(m,y)=>{const g=Bo(t,y,h==="exit"?t.presenceContext?.custom:void 0);if(g){const{transition:b,transitionEnd:S,...x}=g;m={...m,...x,...S}}return m};function u(h){e=h(t)}function c(h){const{props:m}=t,y=J_(t.parent)||{},g=[],b=new Set;let S={},x=1/0;for(let _=0;_<Vq;_++){const k=Lq[_],C=n[k],M=m[k]!==void 0?m[k]:y[k],G=wl(M),I=k===h?C.isActive:null;I===!1&&(x=_);let ee=M===y[k]&&M!==m[k]&&G;if(ee&&r&&t.manuallyAnimateOnMount&&(ee=!1),C.protectedKeys={...S},!C.isActive&&I===null||!M&&!C.prevProp||Bf(M)||typeof M=="boolean")continue;const J=qq(C.prevProp,M);let X=J||k===h&&C.isActive&&!ee&&G||_>x&&G,he=!1;const pe=Array.isArray(M)?M:[M];let we=pe.reduce(o(k),{});I===!1&&(we={});const{prevResolvedValues:je={}}=C,be={...je,...we},Z=U=>{X=!0,b.has(U)&&(he=!0,b.delete(U)),C.needsAnimating[U]=!0;const L=t.getValue(U);L&&(L.liveStyle=!1)};for(const U in be){const L=we[U],te=je[U];if(S.hasOwnProperty(U))continue;let oe=!1;Gm(L)&&Gm(te)?oe=!Y_(L,te):oe=L!==te,oe?L!=null?Z(U):b.add(U):L!==void 0&&b.has(U)?Z(U):C.protectedKeys[U]=!0}C.prevProp=M,C.prevResolvedValues=we,C.isActive&&(S={...S,...we}),r&&t.blockInitialAnimation&&(X=!1);const ne=ee&&J;X&&(!ne||he)&&g.push(...pe.map(U=>{const L={type:k};if(typeof U=="string"&&r&&!ne&&t.manuallyAnimateOnMount&&t.parent){const{parent:te}=t,oe=Bo(te,U);if(te.enteringChildren&&oe){const{delayChildren:E}=oe.transition||{};L.delay=G_(te.enteringChildren,t,E)}}return{animation:U,options:L}}))}if(b.size){const _={};if(typeof m.initial!="boolean"){const k=Bo(t,Array.isArray(m.initial)?m.initial[0]:m.initial);k&&k.transition&&(_.transition=k.transition)}b.forEach(k=>{const C=t.getBaseTarget(k),M=t.getValue(k);M&&(M.liveStyle=!0),_[k]=C??null}),g.push({animation:_})}let T=!!g.length;return r&&(m.initial===!1||m.initial===m.animate)&&!t.manuallyAnimateOnMount&&(T=!1),r=!1,T?e(g):Promise.resolve()}function f(h,m){if(n[h].isActive===m)return Promise.resolve();t.variantChildren?.forEach(g=>g.animationState?.setActive(h,m)),n[h].isActive=m;const y=c(h);for(const g in n)n[g].protectedKeys={};return y}return{animateChanges:c,setActive:f,setAnimateFunction:u,getState:()=>n,reset:()=>{n=u1()}}}function qq(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Y_(e,t):!1}function ds(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function u1(){return{animate:ds(!0),whileInView:ds(),whileHover:ds(),whileTap:ds(),whileDrag:ds(),whileFocus:ds(),exit:ds()}}class Gr{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Pq extends Gr{constructor(e){super(e),e.animationState||(e.animationState=Kq(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Bf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Iq=0;class Hq extends Gr{constructor(){super(...arguments),this.id=Iq++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const o=this.node.animationState.setActive("exit",!e);n&&!e&&o.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Fq={animation:{Feature:Pq},exit:{Feature:Hq}};function xl(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Ll(t){return{point:{x:t.pageX,y:t.pageY}}}const Gq=t=>e=>vg(e)&&t(e,Ll(e));function ol(t,e,n,r){return xl(t,e,Gq(n),r)}const X_=1e-4,Yq=1-X_,Jq=1+X_,Z_=.01,Xq=0-Z_,Zq=0+Z_;function Wt(t){return t.max-t.min}function Qq(t,e,n){return Math.abs(t-e)<=n}function c1(t,e,n,r=.5){t.origin=r,t.originPoint=rt(e.min,e.max,t.origin),t.scale=Wt(n)/Wt(e),t.translate=rt(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Yq&&t.scale<=Jq||isNaN(t.scale))&&(t.scale=1),(t.translate>=Xq&&t.translate<=Zq||isNaN(t.translate))&&(t.translate=0)}function al(t,e,n,r){c1(t.x,e.x,n.x,r?r.originX:void 0),c1(t.y,e.y,n.y,r?r.originY:void 0)}function f1(t,e,n){t.min=n.min+e.min,t.max=t.min+Wt(e)}function Wq(t,e,n){f1(t.x,e.x,n.x),f1(t.y,e.y,n.y)}function d1(t,e,n){t.min=e.min-n.min,t.max=t.min+Wt(e)}function sf(t,e,n){d1(t.x,e.x,n.x),d1(t.y,e.y,n.y)}function zn(t){return[t("x"),t("y")]}const Q_=({current:t})=>t?t.ownerDocument.defaultView:null,h1=(t,e)=>Math.abs(t-e);function e6(t,e){const n=h1(t.x,e.x),r=h1(t.y,e.y);return Math.sqrt(n**2+r**2)}class W_{constructor(e,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:u=!1,distanceThreshold:c=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=Lp(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,x=e6(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!x)return;const{point:T}=b,{timestamp:_}=Ht;this.history.push({...T,timestamp:_});const{onStart:k,onMove:C}=this.handlers;S||(k&&k(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,b)},this.handlePointerMove=(b,S)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=zp(S,this.transformPagePoint),it.update(this.updatePoint,!0)},this.handlePointerUp=(b,S)=>{this.end();const{onEnd:x,onSessionEnd:T,resumeAnimation:_}=this.handlers;if(this.dragSnapToOrigin&&_&&_(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Lp(b.type==="pointercancel"?this.lastMoveEventInfo:zp(S,this.transformPagePoint),this.history);this.startEvent&&x&&x(b,k),T&&T(b,k)},!vg(e))return;this.dragSnapToOrigin=u,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=c,this.contextWindow=o||window;const f=Ll(e),h=zp(f,this.transformPagePoint),{point:m}=h,{timestamp:y}=Ht;this.history=[{...m,timestamp:y}];const{onSessionStart:g}=n;g&&g(e,Lp(h,this.history)),this.removeListeners=jl(ol(this.contextWindow,"pointermove",this.handlePointerMove),ol(this.contextWindow,"pointerup",this.handlePointerUp),ol(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Vr(this.updatePoint)}}function zp(t,e){return e?{point:e(t.point)}:t}function p1(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Lp({point:t},e){return{point:t,delta:p1(t,eR(e)),offset:p1(t,t6(e)),velocity:n6(e,.1)}}function t6(t){return t[0]}function eR(t){return t[t.length-1]}function n6(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const o=eR(t);for(;n>=0&&(r=t[n],!(o.timestamp-r.timestamp>pi(e)));)n--;if(!r)return{x:0,y:0};const u=Un(o.timestamp-r.timestamp);if(u===0)return{x:0,y:0};const c={x:(o.x-r.x)/u,y:(o.y-r.y)/u};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function i6(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?rt(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?rt(n,t,r.max):Math.min(t,n)),t}function m1(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function r6(t,{top:e,left:n,bottom:r,right:o}){return{x:m1(t.x,n,o),y:m1(t.y,e,r)}}function y1(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function s6(t,e){return{x:y1(t.x,e.x),y:y1(t.y,e.y)}}function o6(t,e){let n=.5;const r=Wt(t),o=Wt(e);return o>r?n=vl(e.min,e.max-r,t.min):r>o&&(n=vl(t.min,t.max-o,e.min)),Wi(0,1,n)}function a6(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Xm=.35;function l6(t=Xm){return t===!1?t=0:t===!0&&(t=Xm),{x:g1(t,"left","right"),y:g1(t,"top","bottom")}}function g1(t,e,n){return{min:v1(t,e),max:v1(t,n)}}function v1(t,e){return typeof t=="number"?t:t[e]||0}const u6=new WeakMap;class c6{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ct(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const u=g=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Ll(g).point)},c=(g,b)=>{const{drag:S,dragPropagation:x,onDragStart:T}=this.getProps();if(S&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=wK(S),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),zn(k=>{let C=this.getAxisMotionValue(k).get()||0;if(mi.test(C)){const{projection:M}=this.visualElement;if(M&&M.layout){const G=M.layout.layoutBox[k];G&&(C=Wt(G)*(parseFloat(C)/100))}}this.originPoint[k]=C}),T&&it.postRender(()=>T(g,b)),Ym(this.visualElement,"transform");const{animationState:_}=this.visualElement;_&&_.setActive("whileDrag",!0)},f=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b;const{dragPropagation:S,dragDirectionLock:x,onDirectionLock:T,onDrag:_}=this.getProps();if(!S&&!this.openDragLock)return;const{offset:k}=b;if(x&&this.currentDirection===null){this.currentDirection=f6(k),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",b.point,k),this.updateAxis("y",b.point,k),this.visualElement.render(),_&&_(g,b)},h=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b,this.stop(g,b),this.latestPointerEvent=null,this.latestPanInfo=null},m=()=>zn(g=>this.getAnimationState(g)==="paused"&&this.getAxisMotionValue(g).animation?.play()),{dragSnapToOrigin:y}=this.getProps();this.panSession=new W_(e,{onSessionStart:u,onStart:c,onMove:f,onSessionEnd:h,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:r,contextWindow:Q_(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,o=n||this.latestPanInfo,u=this.isDragging;if(this.cancel(),!u||!o||!r)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:f}=this.getProps();f&&it.postRender(()=>f(r,o))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:o}=this.getProps();if(!r||!gc(e,o,this.currentDirection))return;const u=this.getAxisMotionValue(e);let c=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(c=i6(c,this.constraints[e],this.elastic[e])),u.set(c)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,o=this.constraints;e&&Eo(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=r6(r.layoutBox,e):this.constraints=!1,this.elastic=l6(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&zn(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=a6(r.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Eo(e))return!1;const r=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const u=dq(r,o.root,this.visualElement.getTransformPagePoint());let c=s6(o.layout.layoutBox,u);if(n){const f=n(uq(c));this.hasMutatedConstraints=!!f,f&&(c=z_(f))}return c}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:u,dragSnapToOrigin:c,onDragTransitionEnd:f}=this.getProps(),h=this.constraints||{},m=zn(y=>{if(!gc(y,n,this.currentDirection))return;let g=h&&h[y]||{};c&&(g={min:0,max:0});const b=o?200:1e6,S=o?40:1e7,x={type:"inertia",velocity:r?e[y]:0,bounceStiffness:b,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...u,...g};return this.startAxisValueAnimation(y,x)});return Promise.all(m).then(f)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return Ym(this.visualElement,e),r.start(_g(e,r,0,n,this.visualElement,!1))}stopAnimation(){zn(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){zn(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),o=r[n];return o||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){zn(n=>{const{drag:r}=this.getProps();if(!gc(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,u=this.getAxisMotionValue(n);if(o&&o.layout){const{min:c,max:f}=o.layout.layoutBox[n];u.set(e[n]-rt(c,f,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Eo(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};zn(c=>{const f=this.getAxisMotionValue(c);if(f&&this.constraints!==!1){const h=f.get();o[c]=o6({min:h,max:h},this.constraints[c])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),zn(c=>{if(!gc(c,e,null))return;const f=this.getAxisMotionValue(c),{min:h,max:m}=this.constraints[c];f.set(rt(h,m,o[c]))})}addListeners(){if(!this.visualElement.current)return;u6.set(this.visualElement,this);const e=this.visualElement.current,n=ol(e,"pointerdown",h=>{const{drag:m,dragListener:y=!0}=this.getProps();m&&y&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();Eo(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,u=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),it.read(r);const c=xl(window,"resize",()=>this.scalePositionWithinConstraints()),f=o.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:m})=>{this.isDragging&&m&&(zn(y=>{const g=this.getAxisMotionValue(y);g&&(this.originPoint[y]+=h[y].translate,g.set(g.get()+h[y].translate))}),this.visualElement.render())}));return()=>{c(),n(),u(),f&&f()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:u=!1,dragElastic:c=Xm,dragMomentum:f=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:u,dragElastic:c,dragMomentum:f}}}function gc(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function f6(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class d6 extends Gr{constructor(e){super(e),this.removeGroupControls=Kn,this.removeListeners=Kn,this.controls=new c6(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Kn}unmount(){this.removeGroupControls(),this.removeListeners()}}const b1=t=>(e,n)=>{t&&it.postRender(()=>t(e,n))};class h6 extends Gr{constructor(){super(...arguments),this.removePointerDownListener=Kn}onPointerDown(e){this.session=new W_(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Q_(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:b1(e),onStart:b1(n),onMove:r,onEnd:(u,c)=>{delete this.session,o&&it.postRender(()=>o(u,c))}}}mount(){this.removePointerDownListener=ol(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Dc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Vp=!1;class p6 extends N.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:u}=e;u&&(n.group&&n.group.add(u),r&&r.register&&o&&r.register(u),Vp&&u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),Dc.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:o,isPresent:u}=this.props,{projection:c}=r;return c&&(c.isPresent=u,Vp=!0,o||e.layoutDependency!==n||n===void 0||e.isPresent!==u?c.willUpdate():this.safeToRemove(),e.isPresent!==u&&(u?c.promote():c.relegate()||it.postRender(()=>{const f=c.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),gg.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=e;Vp=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function tR(t){const[e,n]=CK(),r=N.useContext(DO);return F.jsx(p6,{...t,layoutGroup:r,switchLayoutGroup:N.useContext(j_),isPresent:e,safeToRemove:n})}function m6(t,e,n){const r=Jt(t)?t:Io(t);return r.start(_g("",r,e,n)),r.animation}const y6=(t,e)=>t.depth-e.depth;class g6{constructor(){this.children=[],this.isDirty=!1}add(e){Wy(this.children,e),this.isDirty=!0}remove(e){eg(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(y6),this.isDirty=!1,this.children.forEach(e)}}function v6(t,e){const n=fn.now(),r=({timestamp:o})=>{const u=o-n;u>=e&&(Vr(r),t(u-e))};return it.setup(r,!0),()=>Vr(r)}const nR=["TopLeft","TopRight","BottomLeft","BottomRight"],b6=nR.length,S1=t=>typeof t=="string"?parseFloat(t):t,w1=t=>typeof t=="number"||de.test(t);function S6(t,e,n,r,o,u){o?(t.opacity=rt(0,n.opacity??1,w6(r)),t.opacityExit=rt(e.opacity??1,0,x6(r))):u&&(t.opacity=rt(e.opacity??1,n.opacity??1,r));for(let c=0;c<b6;c++){const f=`border${nR[c]}Radius`;let h=x1(e,f),m=x1(n,f);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||w1(h)===w1(m)?(t[f]=Math.max(rt(S1(h),S1(m),r),0),(mi.test(m)||mi.test(h))&&(t[f]+="%")):t[f]=m}(e.rotate||n.rotate)&&(t.rotate=rt(e.rotate||0,n.rotate||0,r))}function x1(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const w6=iR(0,.5,PO),x6=iR(.5,.95,Kn);function iR(t,e,n){return r=>r<t?0:r>e?1:n(vl(t,e,r))}function T1(t,e){t.min=e.min,t.max=e.max}function Yn(t,e){T1(t.x,e.x),T1(t.y,e.y)}function A1(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function E1(t,e,n,r,o){return t-=e,t=rf(t,1/n,r),o!==void 0&&(t=rf(t,1/o,r)),t}function T6(t,e=0,n=1,r=.5,o,u=t,c=t){if(mi.test(e)&&(e=parseFloat(e),e=rt(c.min,c.max,e/100)-c.min),typeof e!="number")return;let f=rt(u.min,u.max,r);t===u&&(f-=e),t.min=E1(t.min,e,n,f,o),t.max=E1(t.max,e,n,f,o)}function O1(t,e,[n,r,o],u,c){T6(t,e[n],e[r],e[o],e.scale,u,c)}const A6=["x","scaleX","originX"],E6=["y","scaleY","originY"];function _1(t,e,n,r){O1(t.x,e,A6,n?n.x:void 0,r?r.x:void 0),O1(t.y,e,E6,n?n.y:void 0,r?r.y:void 0)}function R1(t){return t.translate===0&&t.scale===1}function rR(t){return R1(t.x)&&R1(t.y)}function k1(t,e){return t.min===e.min&&t.max===e.max}function O6(t,e){return k1(t.x,e.x)&&k1(t.y,e.y)}function C1(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function sR(t,e){return C1(t.x,e.x)&&C1(t.y,e.y)}function M1(t){return Wt(t.x)/Wt(t.y)}function D1(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class _6{constructor(){this.members=[]}add(e){Wy(this.members,e),e.scheduleRender()}remove(e){if(eg(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(o=>e===o);if(n===0)return!1;let r;for(let o=n;o>=0;o--){const u=this.members[o];if(u.isPresent!==!1){r=u;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:o}=e.options;o===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function R6(t,e,n){let r="";const o=t.x.translate/e.x,u=t.y.translate/e.y,c=n?.z||0;if((o||u||c)&&(r=`translate3d(${o}px, ${u}px, ${c}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:m,rotate:y,rotateX:g,rotateY:b,skewX:S,skewY:x}=n;m&&(r=`perspective(${m}px) ${r}`),y&&(r+=`rotate(${y}deg) `),g&&(r+=`rotateX(${g}deg) `),b&&(r+=`rotateY(${b}deg) `),S&&(r+=`skewX(${S}deg) `),x&&(r+=`skewY(${x}deg) `)}const f=t.x.scale*e.x,h=t.y.scale*e.y;return(f!==1||h!==1)&&(r+=`scale(${f}, ${h})`),r||"none"}const Up=["","X","Y","Z"],k6=1e3;let C6=0;function Kp(t,e,n,r){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),r&&(r[t]=0))}function oR(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=H_(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:u}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",it,!(o||u))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&oR(r)}function aR({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(c={},f=e?.()){this.id=C6++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(N6),this.nodes.forEach(z6),this.nodes.forEach(L6),this.nodes.forEach($6)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=c,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new g6)}addEventListener(c,f){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new ig),this.eventHandlers.get(c).add(f)}notifyListeners(c,...f){const h=this.eventHandlers.get(c);h&&h.notify(...f)}hasListeners(c){return this.eventHandlers.has(c)}mount(c){if(this.instance)return;this.isSVG=x_(c)&&!_K(c),this.instance=c;const{layoutId:f,layout:h,visualElement:m}=this.options;if(m&&!m.current&&m.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||f)&&(this.isLayoutDirty=!0),t){let y,g=0;const b=()=>this.root.updateBlockedByResize=!1;it.read(()=>{g=window.innerWidth}),t(c,()=>{const S=window.innerWidth;S!==g&&(g=S,this.root.updateBlockedByResize=!0,y&&y(),y=v6(b,250),Dc.hasAnimatedSinceResize&&(Dc.hasAnimatedSinceResize=!1,this.nodes.forEach(j1)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&m&&(f||h)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:g,hasRelativeLayoutChanged:b,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||m.getDefaultTransition()||P6,{onLayoutAnimationStart:T,onLayoutAnimationComplete:_}=m.getProps(),k=!this.targetLayout||!sR(this.targetLayout,S),C=!g&&b;if(this.options.layoutRoot||this.resumeFrom||C||g&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const M={...mg(x,"layout"),onPlay:T,onComplete:_};(m.shouldReduceMotion||this.options.layoutRoot)&&(M.delay=0,M.type=!1),this.startAnimation(M),this.setAnimationOrigin(y,C)}else g||j1(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const c=this.getStack();c&&c.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Vr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(V6),this.animationId++)}getTransformTemplate(){const{visualElement:c}=this.options;return c&&c.getProps().transformTemplate}willUpdate(c=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&oR(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const g=this.path[y];g.shouldResetTransform=!0,g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:f,layout:h}=this.options;if(f===void 0&&!h)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(N1);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach($1);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(B6),this.nodes.forEach(M6),this.nodes.forEach(D6)):this.nodes.forEach($1),this.clearAllSnapshots();const f=fn.now();Ht.delta=Wi(0,1e3/60,f-Ht.timestamp),Ht.timestamp=f,Ht.isProcessing=!0,kp.update.process(Ht),kp.preRender.process(Ht),kp.render.process(Ht),Ht.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,gg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(j6),this.sharedNodes.forEach(U6)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,it.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){it.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Wt(this.snapshot.measuredBox.x)&&!Wt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const c=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Ct(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,c?c.layoutBox:void 0)}updateScroll(c="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===c&&(f=!1),f&&this.instance){const h=r(this.instance);this.scroll={animationId:this.root.animationId,phase:c,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!o)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!rR(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,y=m!==this.prevTransformTemplateValue;c&&this.instance&&(f||ms(this.latestValues)||y)&&(o(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const f=this.measurePageBox();let h=this.removeElementScroll(f);return c&&(h=this.removeTransform(h)),I6(h),{animationId:this.root.animationId,measuredBox:f,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:c}=this.options;if(!c)return Ct();const f=c.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(H6))){const{scroll:m}=this.root;m&&(Oo(f.x,m.offset.x),Oo(f.y,m.offset.y))}return f}removeElementScroll(c){const f=Ct();if(Yn(f,c),this.scroll?.wasRoot)return f;for(let h=0;h<this.path.length;h++){const m=this.path[h],{scroll:y,options:g}=m;m!==this.root&&y&&g.layoutScroll&&(y.wasRoot&&Yn(f,c),Oo(f.x,y.offset.x),Oo(f.y,y.offset.y))}return f}applyTransform(c,f=!1){const h=Ct();Yn(h,c);for(let m=0;m<this.path.length;m++){const y=this.path[m];!f&&y.options.layoutScroll&&y.scroll&&y!==y.root&&_o(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),ms(y.latestValues)&&_o(h,y.latestValues)}return ms(this.latestValues)&&_o(h,this.latestValues),h}removeTransform(c){const f=Ct();Yn(f,c);for(let h=0;h<this.path.length;h++){const m=this.path[h];if(!m.instance||!ms(m.latestValues))continue;Im(m.latestValues)&&m.updateSnapshot();const y=Ct(),g=m.measurePageBox();Yn(y,g),_1(f,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return ms(this.latestValues)&&_1(f,this.latestValues),f}setTargetDelta(c){this.targetDelta=c,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(c){this.options={...this.options,...c,crossfade:c.crossfade!==void 0?c.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Ht.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==f;if(!(c||h&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:g}=this.options;if(!this.layout||!(y||g))return;this.resolvedRelativeTargetAt=Ht.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Ct(),this.targetWithTransforms=Ct()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Wq(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Yn(this.target,this.layout.layoutBox),V_(this.target,this.targetDelta)):Yn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Im(this.parent.latestValues)||L_(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(c,f,h){this.relativeParent=c,this.linkedParentVersion=c.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ct(),this.relativeTargetOrigin=Ct(),sf(this.relativeTargetOrigin,f,h),Yn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const c=this.getLead(),f=!!this.resumingFrom||this!==c;let h=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(h=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===Ht.timestamp&&(h=!1),h)return;const{layout:m,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(m||y))return;Yn(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,b=this.treeScale.y;fq(this.layoutCorrected,this.treeScale,this.path,f),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=Ct());const{target:S}=c;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(A1(this.prevProjectionDelta.x,this.projectionDelta.x),A1(this.prevProjectionDelta.y,this.projectionDelta.y)),al(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==b||!D1(this.projectionDelta.x,this.prevProjectionDelta.x)||!D1(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){if(this.options.visualElement?.scheduleRender(),c){const f=this.getStack();f&&f.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ro(),this.projectionDelta=Ro(),this.projectionDeltaWithTransform=Ro()}setAnimationOrigin(c,f=!1){const h=this.snapshot,m=h?h.latestValues:{},y={...this.latestValues},g=Ro();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const b=Ct(),S=h?h.source:void 0,x=this.layout?this.layout.source:void 0,T=S!==x,_=this.getStack(),k=!_||_.members.length<=1,C=!!(T&&!k&&this.options.crossfade===!0&&!this.path.some(q6));this.animationProgress=0;let M;this.mixTargetDelta=G=>{const I=G/1e3;B1(g.x,c.x,I),B1(g.y,c.y,I),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sf(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),K6(this.relativeTarget,this.relativeTargetOrigin,b,I),M&&O6(this.relativeTarget,M)&&(this.isProjectionDirty=!1),M||(M=Ct()),Yn(M,this.relativeTarget)),T&&(this.animationValues=y,S6(y,m,this.latestValues,I,C,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=I},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Vr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=it.update(()=>{Dc.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Io(0)),this.currentAnimation=m6(this.motionValue,[0,1e3],{...c,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),c.onUpdate&&c.onUpdate(f)},onStop:()=>{},onComplete:()=>{c.onComplete&&c.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const c=this.getStack();c&&c.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(k6),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:f,target:h,layout:m,latestValues:y}=c;if(!(!f||!h||!m)){if(this!==c&&this.layout&&m&&lR(this.options.animationType,this.layout.layoutBox,m.layoutBox)){h=this.target||Ct();const g=Wt(this.layout.layoutBox.x);h.x.min=c.target.x.min,h.x.max=h.x.min+g;const b=Wt(this.layout.layoutBox.y);h.y.min=c.target.y.min,h.y.max=h.y.min+b}Yn(f,h),_o(f,y),al(this.projectionDeltaWithTransform,this.layoutCorrected,f,y)}}registerSharedNode(c,f){this.sharedNodes.has(c)||this.sharedNodes.set(c,new _6),this.sharedNodes.get(c).add(f);const m=f.options.initialPromotionConfig;f.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(f):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){const{layoutId:c}=this.options;return c?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:c}=this.options;return c?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:c}=this.options;if(c)return this.root.sharedNodes.get(c)}promote({needsReset:c,transition:f,preserveFollowOpacity:h}={}){const m=this.getStack();m&&m.promote(this,h),c&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const c=this.getStack();return c?c.relegate(this):!1}resetSkewAndRotation(){const{visualElement:c}=this.options;if(!c)return;let f=!1;const{latestValues:h}=c;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(f=!0),!f)return;const m={};h.z&&Kp("z",c,m,this.animationValues);for(let y=0;y<Up.length;y++)Kp(`rotate${Up[y]}`,c,m,this.animationValues),Kp(`skew${Up[y]}`,c,m,this.animationValues);c.render();for(const y in m)c.setStaticValue(y,m[y]),this.animationValues&&(this.animationValues[y]=m[y]);c.scheduleRender()}applyProjectionStyles(c,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){c.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,c.visibility="",c.opacity="",c.pointerEvents=Mc(f?.pointerEvents)||"",c.transform=h?h(this.latestValues,""):"none";return}const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){this.options.layoutId&&(c.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,c.pointerEvents=Mc(f?.pointerEvents)||""),this.hasProjected&&!ms(this.latestValues)&&(c.transform=h?h({},""):"none",this.hasProjected=!1);return}c.visibility="";const y=m.animationValues||m.latestValues;this.applyTransformsToTarget();let g=R6(this.projectionDeltaWithTransform,this.treeScale,y);h&&(g=h(y,g)),c.transform=g;const{x:b,y:S}=this.projectionDelta;c.transformOrigin=`${b.origin*100}% ${S.origin*100}% 0`,m.animationValues?c.opacity=m===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:c.opacity=m===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const x in Pm){if(y[x]===void 0)continue;const{correct:T,applyTo:_,isCSSVariable:k}=Pm[x],C=g==="none"?y[x]:T(y[x],m);if(_){const M=_.length;for(let G=0;G<M;G++)c[_[G]]=C}else k?this.options.visualElement.renderState.vars[x]=C:c[x]=C}this.options.layoutId&&(c.pointerEvents=m===this?Mc(f?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>c.currentAnimation?.stop()),this.root.nodes.forEach(N1),this.root.sharedNodes.clear()}}}function M6(t){t.updateLayout()}function D6(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:o}=t.options,u=e.source!==t.layout.source;o==="size"?zn(y=>{const g=u?e.measuredBox[y]:e.layoutBox[y],b=Wt(g);g.min=n[y].min,g.max=g.min+b}):lR(o,e.layoutBox,n)&&zn(y=>{const g=u?e.measuredBox[y]:e.layoutBox[y],b=Wt(n[y]);g.max=g.min+b,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+b)});const c=Ro();al(c,n,e.layoutBox);const f=Ro();u?al(f,t.applyTransform(r,!0),e.measuredBox):al(f,n,e.layoutBox);const h=!rR(c);let m=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:g,layout:b}=y;if(g&&b){const S=Ct();sf(S,e.layoutBox,g.layoutBox);const x=Ct();sf(x,n,b.layoutBox),sR(S,x)||(m=!0),y.options.layoutRoot&&(t.relativeTarget=x,t.relativeTargetOrigin=S,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:f,layoutDelta:c,hasLayoutChanged:h,hasRelativeLayoutChanged:m})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function N6(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function $6(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function j6(t){t.clearSnapshot()}function N1(t){t.clearMeasurements()}function $1(t){t.isLayoutDirty=!1}function B6(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function j1(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function z6(t){t.resolveTargetDelta()}function L6(t){t.calcProjection()}function V6(t){t.resetSkewAndRotation()}function U6(t){t.removeLeadSnapshot()}function B1(t,e,n){t.translate=rt(e.translate,0,n),t.scale=rt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function z1(t,e,n,r){t.min=rt(e.min,n.min,r),t.max=rt(e.max,n.max,r)}function K6(t,e,n,r){z1(t.x,e.x,n.x,r),z1(t.y,e.y,n.y,r)}function q6(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const P6={duration:.45,ease:[.4,0,.1,1]},L1=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),V1=L1("applewebkit/")&&!L1("chrome/")?Math.round:Kn;function U1(t){t.min=V1(t.min),t.max=V1(t.max)}function I6(t){U1(t.x),U1(t.y)}function lR(t,e,n){return t==="position"||t==="preserve-aspect"&&!Qq(M1(e),M1(n),.2)}function H6(t){return t!==t.root&&t.scroll?.wasRoot}const F6=aR({attachResizeListener:(t,e)=>xl(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),qp={current:void 0},uR=aR({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!qp.current){const t=new F6({});t.mount(window),t.setOptions({layoutScroll:!0}),qp.current=t}return qp.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),G6={pan:{Feature:h6},drag:{Feature:d6,ProjectionNode:uR,MeasureLayout:tR}};function K1(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,u=r[o];u&&it.postRender(()=>u(e,Ll(e)))}class Y6 extends Gr{mount(){const{current:e}=this.node;e&&(this.unmount=xK(e,(n,r)=>(K1(this.node,r,"Start"),o=>K1(this.node,o,"End"))))}unmount(){}}class J6 extends Gr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=jl(xl(this.node.current,"focus",()=>this.onFocus()),xl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function q1(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),u=r[o];u&&it.postRender(()=>u(e,Ll(e)))}class X6 extends Gr{mount(){const{current:e}=this.node;e&&(this.unmount=OK(e,(n,r)=>(q1(this.node,r,"Start"),(o,{success:u})=>q1(this.node,o,u?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Zm=new WeakMap,Pp=new WeakMap,Z6=t=>{const e=Zm.get(t.target);e&&e(t)},Q6=t=>{t.forEach(Z6)};function W6({root:t,...e}){const n=t||document;Pp.has(n)||Pp.set(n,{});const r=Pp.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Q6,{root:t,...e})),r[o]}function e5(t,e,n){const r=W6(e);return Zm.set(t,n),r.observe(t),()=>{Zm.delete(t),r.unobserve(t)}}const t5={some:0,all:1};class n5 extends Gr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:u}=e,c={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:t5[o]},f=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,u&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:y,onViewportLeave:g}=this.node.getProps(),b=m?y:g;b&&b(h)};return e5(this.node.current,c,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(i5(e,n))&&this.startObserver()}unmount(){}}function i5({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const r5={inView:{Feature:n5},tap:{Feature:X6},focus:{Feature:J6},hover:{Feature:Y6}},s5={layout:{ProjectionNode:uR,MeasureLayout:tR}},o5={...Fq,...r5,...G6,...s5},a5=lq(o5,wq);function l5(){const t=Qn(Po),e=Qn(fi),n=Qn(Gi),r=At(Po),o=At(fi),u=At(Gi),c=`email-${N.useId()}`,f=`password-${N.useId()}`,h=`one-time-code-${N.useId()}`,[m,y]=N.useState(null),[g,b]=N.useState("email"),S=`form-${N.useId()}`;return N.useEffect(()=>{if(u.length===6){const x=document.getElementById(S);x instanceof HTMLFormElement&&x.requestSubmit()}},[u]),F.jsx("form",{id:S,onSubmit:async x=>{x.preventDefault();const T=nt(li);try{switch(g){case"email":{const{nextStep:_,userKey:k}=await cn.declareAuthTarget.query({email:r});switch(De(li,k),_){case"otc_login":case"otc_verify":{b("otc");break}case"password_login":{b("password");break}}break}case"otc":{if(!T){console.error("somehow userKey is null");return}const _=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:T});De(ut,_),gi.once("connect",()=>{_s("/game"),t(""),n("")});break}case"password":{const _=await cn.openSession.mutate({email:r,password:o});De(ut,_),gi.once("connect",()=>{_s("/game"),t(""),e("")});break}}}catch(_){_ instanceof gl&&y(_.message)}},children:F.jsxs("main",{children:[m?F.jsx("aside",{children:m}):null,F.jsxs(a5.label,{htmlFor:c,children:[F.jsx("span",{children:"Email"}),F.jsx("input",{id:c,type:"text",value:r,onChange:x=>{t(x.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:g!=="email"})]}),g==="password"?F.jsxs("label",{htmlFor:f,children:[F.jsx("span",{children:"Password"}),F.jsx("input",{id:f,type:"password",value:o,onChange:x=>{e(x.target.value)},autoComplete:"current-password",autoCapitalize:"none",autoFocus:g==="password"})]}):null,g==="otc"?F.jsxs("label",{htmlFor:h,children:[F.jsx("span",{children:"One-time Code"}),F.jsx("input",{id:h,type:"number",inputMode:"numeric",enterKeyHint:"go",value:u,onChange:x=>{n(x.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:g==="otc"})]}):null,F.jsxs("footer",{children:[g==="password"?F.jsx("button",{type:"button",onClick:async()=>{const x=nt(li);if(!x)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:x}),b("otc")},children:"Forgot Password?"}):null,F.jsx("span",{}),F.jsx("button",{type:"submit",disabled:!r&&g==="email"||!o&&g==="password"||!u&&g==="otc",children:">>->"})]})]})})}function u5({route:[,t]}){const e=At(ut),n=At(Gi),r=Qn(Gi),o=`code-${N.useId()}`;return N.useEffect(()=>{t&&r(t)},[]),e?F.jsx("form",{onSubmit:async u=>{u.preventDefault();try{const c=await cn.verifyAccountAction.mutate({oneTimeCode:n,userKey:"CHANGEME"});De(ut,c),c.action==="resetPassword"?_s("/account"):_s("/game")}catch(c){console.error(c)}},children:F.jsxs("main",{children:[F.jsx("p",{children:"Check your email for a verification code."}),F.jsxs("label",{htmlFor:o,children:[F.jsx("span",{children:"Verification code"}),F.jsx("input",{id:o,type:"text",value:n,onChange:u=>{r(u.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})}):F.jsx("p",{children:"You must be logged in to verify your account."})}Ft.STORE.loggers[0].logLevel="info";function c5(){const t=At(w4),e=At(ut),[n,r]=N.useState(!1),{refs:o,floatingStyles:u,context:c}=Z2({open:n,onOpenChange:r,placement:"bottom-end",middleware:[x2(5),A2(),T2()],whileElementsMounted:p2}),f=F2(c),h=J2(c),m=eN(c),{getReferenceProps:y,getFloatingProps:g}=Q2([f,h,m]),b=At(uV);return F.jsxs("main",{className:Zz.class,children:[F.jsxs("header",{children:[F.jsxs("main",{children:[F.jsx(Xz,{}),F.jsx("span",{children:F.jsx(Qz,{input:b})})]}),F.jsx("button",{"data-css":"profile",ref:o.setReference,...y(),children:e?.username?e.username.slice(0,2):""}),n&&e&&F.jsx(I2,{context:c,modal:!1,children:F.jsxs("div",{"data-css":"profile-actions",ref:o.setFloating,style:u,...g(),children:[F.jsx("span",{children:e.username}),F.jsx("button",{type:"button",onClick:()=>{_s("/account")},children:"Account"}),F.jsx("button",{type:"button",onClick:async()=>{e&&(await cn.closeSession.mutate({username:e.username}),gi.once("disconnect",()=>{De(ut,null),_s("/")}),gi.disconnect())},children:"Sign out"})]})})]}),F.jsx("main",{children:typeof t=="number"?F.jsxs("article",{children:[F.jsx("h1",{children:t}),F.jsx("h2",{children:JSON.parse(FE[t])}),F.jsx(GE,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(t[0]){case void 0:return F.jsx(l5,{});case"admin":return F.jsx(O4,{});case"game":return F.jsx(R4,{route:t});case"verify":return F.jsx(u5,{route:t});case"account":return F.jsx(E4,{})}})()})]})}YM.createRoot(document.getElementById("root")).render(F.jsx(N.StrictMode,{children:F.jsx(UM,{socket:gi,children:F.jsx(c5,{})})}));