expect-cli 0.0.5 → 0.0.7

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,35 +1,35 @@
1
1
  #!/usr/bin/env node
2
- import{r as e,t}from"./chunk-wdO_pP5q.js";import n from"node:path";import{ZodOptional as r}from"zod";import*as i from"zod/v4";import{z as a}from"zod/v4";import{execFile as o}from"node:child_process";import*as s from"node:crypto";import*as c from"node:os";import l from"node:os";import{NodeHttpClient as u,NodeServices as d}from"@effect/platform-node";import f from"node:net";import*as p from"@effect/platform-node/NodeSocket";import{promisify as m}from"node:util";import h from"node:process";import{chromium as g}from"playwright";import{createServer as _}from"node:http";import*as ee from"zod/v3";import{ZodFirstPartyTypeKind as v}from"zod/v3";import*as te from"zod/v4-mini";const y=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},ne={pipe(){return y(this,arguments)}},re=function(){function e(){}return e.prototype=ne,e}(),b=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},x=e=>e,ie=e=>()=>e,ae=ie(!0),oe=ie(!1),se=ie(null),ce=ie(void 0),le=ce;function ue(e,...t){return y(e,t)}function de(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}}function fe(e){let t=new WeakMap;return n=>{if(t.has(n))return t.get(n);let r=e(n);return t.set(n,r),r}}const pe=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},me=new WeakSet;function he(e){return typeof e==`string`}function ge(e){return typeof e==`number`}function _e(e){return typeof e==`boolean`}function ve(e){return typeof e==`bigint`}function ye(e){return typeof e==`symbol`}function be(e){return he(e)||ge(e)||ye(e)}function xe(e){return typeof e==`function`}function Se(e){return e===void 0}function Ce(e){return e!==void 0}function we(e){return e!==null}function Te(e){return e==null}function Ee(e){return e!=null}function De(e){return!0}function Oe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ke(e){return typeof e==`object`&&!!e||xe(e)}const S=b(2,(e,t)=>ke(e)&&t in e),Ae=b(2,(e,t)=>S(e,`_tag`)&&e._tag===t);function je(e){return S(e,Symbol.iterator)||he(e)}const Me=`~effect/interfaces/Hash`,C=e=>{switch(typeof e){case`number`:return Le(e);case`bigint`:return Re(e.toString(10));case`boolean`:return Re(String(e));case`symbol`:return Re(String(e));case`string`:return Re(e);case`undefined`:return Re(`undefined`);case`function`:case`object`:if(e===null)return Re(`null`);if(e instanceof Date)return Re(e.toISOString());if(e instanceof RegExp)return Re(e.toString());{if(me.has(e))return Ne(e);if(Ke.has(e))return Ke.get(e);let t=Je(e,()=>Ie(e)?e[Me]():typeof e==`function`?Ne(e):Array.isArray(e)?He(e):e instanceof Map?Ue(e):e instanceof Set?We(e):Be(e));return Ke.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Ne=e=>(Ge.has(e)||Ge.set(e,Le(Math.floor(Math.random()*(2**53-1)))),Ge.get(e)),Pe=b(2,(e,t)=>e*53^t),Fe=e=>e&3221225471|e>>>1&1073741824,Ie=e=>S(e,Me),Le=e=>{if(e!==e)return Re(`NaN`);if(e===1/0)return Re(`Infinity`);if(e===-1/0)return Re(`-Infinity`);let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return Fe(t)},Re=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Fe(t)},ze=(e,t)=>{let n=12289;for(let r of t)n^=Pe(C(r),C(e[r]));return Fe(n)},Be=e=>ze(e,pe(e)),Ve=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return Fe(r)},He=Ve(6151,C),Ue=Ve(Re(`Map`),([e,t])=>Pe(C(e),C(t))),We=Ve(Re(`Set`),C),Ge=new WeakMap,Ke=new WeakMap,qe=new WeakSet;function Je(e,t){if(qe.has(e))return Re(`[Circular]`);qe.add(e);let n=t();return qe.delete(e),n}const Ye=`~effect/interfaces/Equal`;function Xe(){return arguments.length===1?e=>Ze(e,arguments[0]):Ze(arguments[0],arguments[1])}function Ze(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||me.has(e)||me.has(t)?!1:nt(e,t,tt):!1}function Qe(e,t,n){let r=$e.has(e),i=et.has(t);if(r&&i)return!0;if(r||i)return!1;$e.add(e),et.add(t);let a=n();return $e.delete(e),et.delete(t),a}const $e=new WeakSet,et=new WeakSet;function tt(e,t){if(C(e)!==C(t))return!1;if(e instanceof Date)return t instanceof Date?e.toISOString()===t.toISOString():!1;if(e instanceof RegExp)return t instanceof RegExp?e.toString()===t.toString():!1;let n=ut(e),r=ut(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:Qe(e,t,()=>i?e[Ye](t):Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:it(e,t):e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:st(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:lt(e,t):at(e,t))}function nt(e,t,n){let r=rt.get(e);if(!r)r=new WeakMap,rt.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=rt.get(t);return a||(a=new WeakMap,rt.set(t,a)),a.set(e,i),i}const rt=new WeakMap;function it(e,t){for(let n=0;n<e.length;n++)if(!Ze(e[n],t[n]))return!1;return!0}function at(e,t){let n=pe(e),r=pe(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!Ze(e[i],t[i]))return!1;return!0}function ot(e,t){return function(n,r){for(let[i,a]of n){let n=!1;for(let[o,s]of r)if(e(i,o)&&t(a,s)){n=!0;break}if(!n)return!1}return!0}}const st=ot(Ze,Ze);function ct(e){return function(t,n){for(let r of t){let t=!1;for(let i of n)if(e(r,i)){t=!0;break}if(!t)return!1}return!0}}const lt=ct(Ze),ut=e=>S(e,Ye),dt=()=>Xe,ft=e=>(t,n)=>t===n||e(t,n),pt=(e,t)=>e===t,mt=()=>pt;function ht(e){return ft((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e[r](t[r],n[r]))return!1;return!0})}function gt(e){return ft((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}const _t=e=>e.length>0,vt=Symbol.for(`~effect/Inspectable/redactable`),yt=e=>S(e,vt);function bt(e){return yt(e)?xt(e):e}function xt(e){return e[vt](globalThis[`~effect/Fiber/currentFiber`]?.services??Ct)}const St=`~effect/Fiber/currentFiber`,Ct={"~effect/ServiceMap":{},mapUnsafe:new Map,pipe(){return y(this,arguments)}};function wt(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,n=0){if(Array.isArray(e)){if(r.has(e))return Tt;if(r.add(e),!i||e.length<=1)return`[${e.map(e=>c(e,n)).join(`,`)}]`;let t=e.map(e=>c(e,n+1)).join(`,
3
- `+a(n+1));return`[\n${a(n+1)}${t}\n${a(n)}]`}if(e instanceof Date)return Ot(e);if(!t?.ignoreToString&&S(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=kt(e);return e instanceof Error&&e.cause?`${t} (cause: ${c(e.cause,n)})`:t}if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return Tt;if(r.add(e),vt in e)return wt(xt(e));if(Symbol.iterator in e)return`${e.constructor.name}(${c(Array.from(e),n)})`;let t=s(e);return!i||t.length<=1?o(e,`{${t.map(t=>`${Et(t)}:${c(e[t],n)}`).join(`,`)}}`):o(e,`{\n${t.map(t=>`${a(n+1)}${Et(t)}: ${c(e[t],n+1)}`).join(`,
4
- `)}\n${a(n)}}`)}return String(e)}return c(e,0)}const Tt=`[Circular]`;function Et(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Dt(e){return e.map(e=>`[${Et(e)}]`).join(``)}function Ot(e){try{return e.toISOString()}catch{return`Invalid Date`}}function kt(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function At(e,t){let n=[],r=JSON.stringify(e,(e,t)=>typeof t==`object`&&t?n.includes(t)?void 0:n.push(t)&&bt(t):t,t?.space);return n=void 0,r}const jt=Symbol.for(`nodejs.util.inspect.custom`),Mt=e=>{try{if(S(e,`toJSON`)&&xe(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(Mt)}catch{return`[toJSON threw]`}return bt(e)},Nt=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?Pt(e,t):String(e)}catch{return String(e)}},Pt=(e,t)=>{let n=[],r=JSON.stringify(e,(e,t)=>typeof t==`object`&&t?n.includes(t)?void 0:n.push(t)&&bt(t):t,t);return n=void 0,r},Ft={toJSON(){return Mt(this)},[jt](){return this.toJSON()},toString(){return wt(this.toJSON())}};var It=class e{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}};const Lt=`~effect/Utils/internal`,Rt={[Lt]:e=>e()},zt={[Lt]:e=>{try{return e()}finally{}}},Bt=Rt[Lt](()=>Error().stack)?.includes(Lt)===!0?Rt[Lt]:zt[Lt],Vt=`~effect/Effect`,Ht=`~effect/Exit`,Ut={_A:x,_E:x,_R:x},Wt=`${Vt}/identifier`,w=`${Vt}/args`,Gt=`${Vt}/evaluate`,Kt=`${Vt}/successCont`,qt=`${Vt}/failureCont`,Jt=`${Vt}/ensureCont`,Yt=Symbol.for(`effect/Effect/Yield`),Xt={pipe(){return y(this,arguments)},toJSON(){return{...this}},toString(){return wt(this.toJSON(),{ignoreToString:!0,space:2})},[jt](){return this.toJSON()}},Zt={[Me](){return ze(this,Object.keys(this))},[Ye](e){let t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r]&&!Xe(this[t[r]],e[t[r]]))return!1;return!0}},Qt={[Symbol.iterator](){return new It(this)}},$t={...Qt,pipe(){return y(this,arguments)}},en={[Vt]:Ut,...Xt,[Symbol.iterator](){return new It(this)},asEffect(){return this},toJSON(){return{_id:`Effect`,op:this[Wt],...w in this?{args:this[w]}:void 0}}},tn=e=>S(e,Vt),nn=e=>S(e,Ht),rn=`~effect/Cause`,an=`~effect/Cause/Reason`,on=e=>S(e,rn);var sn=class{[rn];reasons;constructor(e){this[rn]=rn,this.reasons=e}pipe(){return y(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${wt(this.reasons)})`}[jt](){return this.toJSON()}[Ye](e){return on(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>Xe(t,e.reasons[n]))}[Me](){return He(this.reasons)}};const cn=new WeakMap;var ln=class{[an];annotations;_tag;constructor(e,t,n){if(this[an]=an,this._tag=e,t!==un&&typeof n==`object`&&n&&t.size>0){let e=cn.get(n);e&&(t=new Map([...e,...t])),cn.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return y(this,arguments)}toString(){return wt(this)}[jt](){return this.toString()}};const un=new Map;var dn=class extends ln{error;constructor(e,t=un){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${wt(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[Ye](e){return vn(e)&&Xe(this.error,e.error)&&Xe(this.annotations,e.annotations)}[Me](){return Pe(Re(this._tag))(Pe(C(this.error))(C(this.annotations)))}};const fn=e=>new sn(e),pn=new sn([]),mn=e=>new sn([new dn(e)]);var hn=class extends ln{defect;constructor(e,t=un){super(`Die`,t,e),this.defect=e}toString(){return`Die(${wt(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[Ye](e){return yn(e)&&Xe(this.defect,e.defect)&&Xe(this.annotations,e.annotations)}[Me](){return Pe(Re(this._tag))(Pe(C(this.defect))(C(this.annotations)))}};const gn=e=>new sn([new hn(e)]),_n=b(e=>on(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new sn(e.reasons.map(e=>e.annotate(t,n)))),vn=e=>e._tag===`Fail`,yn=e=>e._tag===`Die`,bn=e=>e._tag===`Interrupt`;function xn(e){return kn(`Effect.evaluate: Not implemented`)}const Sn=e=>({...en,[Wt]:e.op,[Gt]:e[Gt]??xn,[Kt]:e[Kt],[qt]:e[qt],[Jt]:e[Jt]}),Cn=e=>{let t=Sn(e);return function(){let n=Object.create(t);return n[w]=e.single===!1?arguments:arguments[0],n}},wn=e=>{let t={...Sn(e),[Ht]:Ht,_tag:e.op,get[e.prop](){return this[w]},toString(){return`${e.op}(${wt(this[w])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[w]}},[Ye](e){return nn(e)&&e._tag===this._tag&&Xe(this[w],e[w])},[Me](){return Pe(Re(e.op),C(this[w]))}};return function(e){let n=Object.create(t);return n[w]=e,n}},T=wn({op:`Success`,prop:`value`,[Gt](e){let t=e.getCont(Kt);return t?t[Kt](this[w],e,this):e.yieldWith(this)}}),Tn={key:`effect/Cause/StackTrace`},En={key:`effect/Cause/InterruptorStackTrace`},Dn=wn({op:`Failure`,prop:`cause`,[Gt](e){let t=this[w],n=!1;e.currentStackFrame&&(t=_n(t,{mapUnsafe:new Map([[Tn.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(qt);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(qt);return r?r[qt](t,e,n?void 0:this):e.yieldWith(n?this:Dn(t))}}),On=e=>Dn(mn(e)),kn=e=>Dn(gn(e)),E=Cn({op:`WithFiber`,[Gt](e){return this[w](e)}}),An=function(){class e extends globalThis.Error{asEffect(){return On(this)}}return Object.assign(e.prototype,$t),e}(),jn=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends An{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Object.assign(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),Mn=e=>{class t extends jn{_tag=e}return t.prototype.name=e,t},Nn=`~effect/Cause/NoSuchElementError`;var Pn=class extends Mn(`NoSuchElementError`){[Nn]=Nn;constructor(e){super({message:e})}};const Fn=`~effect/Cause/Done`,In=e=>S(e,Fn),Ln={[Fn]:Fn,_tag:`Done`,value:void 0},Rn=e=>e===void 0?Ln:{[Fn]:Fn,_tag:`Done`,value:e},zn=On(Ln),Bn=e=>e===void 0?zn:On(Rn(e)),Vn=`~effect/data/Option`,Hn={[Vn]:{_A:e=>e},...Xt,...Qt},Un=Object.assign(Object.create(Hn),{_tag:`Some`,_op:`Some`,[Ye](e){return Kn(e)&&Jn(e)&&Xe(this.value,e.value)},[Me](){return Pe(C(this._tag))(C(this.value))},toString(){return`some(${wt(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:Mt(this.value)}},asEffect(){return T(this.value)}});Object.defineProperty(Un,`valueOrUndefined`,{get(){return this.value}});const Wn=C(`None`),Gn=Object.assign(Object.create(Hn),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[Ye](e){return Kn(e)&&qn(e)},[Me](){return Wn},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}},asEffect(){return On(new Pn)}}),Kn=e=>S(e,Vn),qn=e=>e._tag===`None`,Jn=e=>e._tag===`Some`,Yn=Object.create(Gn),Xn=e=>{let t=Object.create(Un);return t.value=e,t},Zn=`~effect/data/Result`,Qn={[Zn]:{_A:e=>e,_E:e=>e},...Xt,...Qt},$n=Object.assign(Object.create(Qn),{_tag:`Success`,_op:`Success`,[Ye](e){return tr(e)&&rr(e)&&Xe(this.success,e.success)},[Me](){return Pe(C(this._tag))(C(this.success))},toString(){return`success(${wt(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:Mt(this.success)}},asEffect(){return T(this.success)}}),er=Object.assign(Object.create(Qn),{_tag:`Failure`,_op:`Failure`,[Ye](e){return tr(e)&&nr(e)&&Xe(this.failure,e.failure)},[Me](){return Pe(C(this._tag))(C(this.failure))},toString(){return`failure(${wt(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:Mt(this.failure)}},asEffect(){return On(this.failure)}}),tr=e=>S(e,Zn),nr=e=>e._tag===`Failure`,rr=e=>e._tag===`Success`,ir=e=>{let t=Object.create(er);return t.failure=e,t},ar=e=>{let t=Object.create($n);return t.success=e,t};function or(e){return(t,n)=>t===n?0:e(t,n)}const sr=or((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),cr=or((e,t)=>e<t?-1:1),lr=b(2,(e,t)=>or((n,r)=>{let i=e(n,r);return i===0?t(n,r):i})),ur=b(2,(e,t)=>or((n,r)=>e(t(n),t(r)))),dr=e=>b(2,(t,n)=>e(t,n)===1),D=()=>Yn,O=Xn,fr=Kn,pr=qn,mr=Jn,hr=b(2,(e,{onNone:t,onSome:n})=>pr(e)?t():n(e.value)),gr=b(2,(e,t)=>pr(e)?t():e.value),_r=e=>e==null?D():O(e),vr=e=>e===void 0?D():O(e),yr=e=>e===null?D():O(e),br=gr(se),xr=gr(ce),Sr=e=>(...t)=>{try{return O(e(...t))}catch{return D()}},Cr=b(2,(e,t)=>{if(mr(e))return e.value;throw t()}),wr=b(2,(e,t)=>pr(e)?D():O(t(e.value))),Tr=b(2,(e,t)=>pr(e)?D():t(e.value)),Er=b(2,(e,t)=>pr(e)?D():t(e.value)?O(e.value):D()),Dr=e=>ft((t,n)=>pr(t)?pr(n):pr(n)?!1:e(t.value,n.value)),Or=ar,kr=ir,Ar=tr,k=nr,jr=rr,Mr=ht,Nr=b(2,(e,t)=>{let n=0;for(let r of e){let e=t(r,n);if(_e(e)){if(e)return O(r)}else if(mr(e))return e;n++}return D()}),Pr={[Symbol.iterator](){return Fr}},Fr={next(){return{done:!0,value:void 0}}},Ir=()=>Pr,Lr=b(2,(e,t)=>Object.hasOwn(e,t)),Rr=e=>Object.keys(e),zr=e=>b(2,(t,n)=>{for(let r of Rr(t))if(!Lr(n,r)||!e(t[r],n[r]))return!1;return!0}),Br=e=>{let t=zr(e);return(e,n)=>t(e,n)&&t(n,e)},Vr=globalThis.Array,Hr=e=>Vr.isArray(e)?e:Vr.from(e),Ur=e=>Vr.isArray(e)?e:[e],Wr=b(2,(e,t)=>[...e,t]),Gr=b(2,(e,t)=>Hr(e).concat(Hr(t))),Kr=Vr.isArray,qr=e=>e.length===0,Jr=_t,Yr=_t;function Xr(e,t){return e<0||e>=t.length}const Zr=b(2,(e,t)=>{let n=Math.floor(t);return Xr(n,e)?D():O(e[n])}),Qr=b(2,(e,t)=>{let n=Math.floor(t);if(Xr(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]}),$r=Zr(0),ei=Qr(0),ti=e=>e[e.length-1],ni=e=>e.slice(1),ri=Nr,ii=b(2,(e,t)=>{let n=Vr.from(e);return n.sort(t),n}),ai=b(3,(e,t,n)=>{let r=Hr(e),i=Hr(t);return Yr(r)?Yr(i)?pi(n)(Gr(r,i)):r:i}),oi=b(2,(e,t)=>ai(e,t,dt())),si=()=>[],ci=e=>[e],li=b(2,(e,t)=>e.map(t)),ui=b(2,(e,t)=>{if(qr(e))return[];let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r);for(let e=0;e<i.length;e++)n.push(i[e])}return n})(x),di=b(2,(e,t)=>{let n=Hr(e),r=[];for(let e=0;e<n.length;e++)t(n[e],e)&&r.push(n[e]);return r}),fi=gt,pi=b(2,(e,t)=>{let n=Hr(e);if(Yr(n)){let e=[ei(n)],r=ni(n);for(let n of r)e.every(e=>!t(n,e))&&e.push(n);return e}return[]}),mi=`~effect/BigDecimal`,hi={[mi]:mi,[Me](){let e=Si(this);return Pe(C(e.value),Le(e.scale))},[Ye](e){return gi(e)&&Ei(this,e)},toString(){return`BigDecimal(${Di(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[jt](){return this.toJSON()},pipe(){return y(this,arguments)}},gi=e=>S(e,mi),_i=(e,t)=>{let n=Object.create(hi);return n.value=e,n.scale=t,n},vi=(e,t)=>{if(e!==yi&&e%bi===yi)throw RangeError(`Value must be normalized`);let n=_i(e,t);return n.normalized=n,n},yi=BigInt(0),bi=BigInt(10),xi=vi(yi,0),Si=e=>{if(e.normalized===void 0)if(e.value===yi)e.normalized=xi;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e),e.normalized=vi(BigInt(t.substring(0,t.length-n)),e.scale-n)}return e.normalized},Ci=b(2,(e,t)=>t>e.scale?_i(e.value*bi**BigInt(t-e.scale),t):t<e.scale?_i(e.value/bi**BigInt(e.scale-t),t):e),wi=e=>e.value<yi?_i(-e.value,e.scale):e,Ti=ft((e,t)=>e.scale>t.scale?Ci(t,e.scale).value===e.value:e.scale<t.scale?Ci(e,t.scale).value===t.value:e.value===t.value),Ei=b(2,(e,t)=>Ti(e,t)),Di=e=>{let t=Si(e);if(Math.abs(t.scale)>=16)return Oi(t);let n=t.value<yi,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},Oi=e=>{if(ki(e))return`0e+0`;let t=Si(e),n=`${wi(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Ai(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},ki=e=>e.value===yi,Ai=e=>e.value<yi,ji=`~effect/time/Duration`,Mi=BigInt(0),Ni=BigInt(1e3),Pi=BigInt(1e6),Fi=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Ii=e=>{switch(typeof e){case`number`:return Xi(e);case`bigint`:return Ji(e);case`string`:{let t=Fi.exec(e);if(!t)break;let[n,r,i]=t,a=Number(r);switch(i){case`nano`:case`nanos`:return Ji(BigInt(r));case`micro`:case`micros`:return Yi(BigInt(r));case`milli`:case`millis`:return Xi(a);case`second`:case`seconds`:return Zi(a);case`minute`:case`minutes`:return Qi(a);case`hour`:case`hours`:return $i(a);case`day`:case`days`:return ea(a);case`week`:case`weeks`:return ta(a)}break}case`object`:{if(e===null)break;if(ji in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(ge)?Li(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Gi:e[0]===-1/0||e[1]===-1/0?qi:e[0]===1/0||e[1]===1/0?Ki:Hi(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));let t=e,n=0;if(t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds)return Hi(n);let r=BigInt(n)*Pi;return t.microseconds&&(r+=BigInt(t.microseconds)*Ni),t.nanoseconds&&(r+=BigInt(t.nanoseconds)),Hi(r)}}return Li(e)},Li=e=>{throw Error(`Invalid Input: ${e}`)},Ri={_tag:`Millis`,millis:0},zi={_tag:`Infinity`},Bi={_tag:`NegativeInfinity`},Vi={[ji]:ji,[Me](){return Be(this.value)},[Ye](e){return Ui(e)&&sa(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[jt](){return this.toJSON()},pipe(){return y(this,arguments)}},Hi=e=>{let t=Object.create(Vi);return typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?t.value=Ri:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:`Millis`,millis:e}:t.value={_tag:`Nanos`,nanos:BigInt(Math.round(e*1e6))}:t.value=e>0?zi:Bi:e===Mi?t.value=Ri:t.value={_tag:`Nanos`,nanos:e},t},Ui=e=>S(e,ji),Wi=e=>e.value._tag!==`Infinity`&&e.value._tag!==`NegativeInfinity`,Gi=Hi(0),Ki=Hi(1/0),qi=Hi(-1/0),Ji=e=>Hi(e),Yi=e=>Hi(e*Ni),Xi=e=>Hi(e),Zi=e=>Hi(e*1e3),Qi=e=>Hi(e*6e4),$i=e=>Hi(e*36e5),ea=e=>Hi(e*864e5),ta=e=>Hi(e*6048e5),na=e=>ia(e,{onMillis:x,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),ra=e=>{switch(e.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return e.value.nanos;case`Millis`:return BigInt(Math.round(e.value.millis*1e6))}},ia=b(2,(e,t)=>{switch(e.value._tag){case`Millis`:return t.onMillis(e.value.millis);case`Nanos`:return t.onNanos(e.value.nanos);case`Infinity`:return t.onInfinity();case`NegativeInfinity`:return(t.onNegativeInfinity??t.onInfinity)()}}),aa=b(3,(e,t,n)=>e.value._tag===`Infinity`||e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`||t.value._tag===`NegativeInfinity`?n.onInfinity(e,t):e.value._tag===`Millis`?t.value._tag===`Millis`?n.onMillis(e.value.millis,t.value.millis):n.onNanos(ra(e),t.value.nanos):n.onNanos(e.value.nanos,ra(t))),oa=(e,t)=>aa(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),sa=b(2,(e,t)=>oa(e,t)),ca=e=>t=>e(t)?Or(t):kr(t),la=e=>t=>!k(e(t)),ua=e=>t=>t.has(e)?Or(t):kr(t),da=b(2,(e,t)=>n=>{let r=e(n);return k(r)?r:t(r.success)}),fa=b(2,(e,t)=>n=>{let r=e(n);if(k(r))return kr(n);let i=t(r.success);return k(i)?kr(n):i}),pa=e=>t=>{let n=e(t);return k(n)?D():O(n.success)},A=function(){let e=Error.stackTraceLimit;Error.stackTraceLimit=2;let t=Error();Error.stackTraceLimit=e;function n(){}let r=n;return Object.setPrototypeOf(r,ma),Object.defineProperty(r,`stack`,{get(){return t.stack}}),arguments.length>0?(r.key=arguments[0],arguments[1]?.defaultValue&&(r[ha]=ha,r.defaultValue=arguments[1].defaultValue),r):function(e,t){return r.key=e,t?.make&&(r.make=t.make),r}},ma={"~effect/ServiceMap/Service":{_Service:e=>e,_Identifier:e=>e},...Xt,...Qt,toJSON(){return{_id:`Service`,key:this.key,stack:this.stack}},asEffect(){return(this.asEffect=ie(E(e=>T(Da(e.services,this)))))()},of(e){return e},serviceMap(e){return Ca(this,e)},use(e){return E(t=>e(Da(t.services,this)))},useSync(e){return E(t=>T(e(Da(t.services,this))))}},ha=`~effect/ServiceMap/Reference`,ga=`~effect/ServiceMap`,_a=e=>{let t=Object.create(va);return t.mapUnsafe=e,t.mutable=!1,t},va={...Xt,[ga]:{_Services:e=>e},toJSON(){return{_id:`ServiceMap`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Ye](e){if(!ya(e)||this.mapUnsafe.size!==e.mapUnsafe.size)return!1;for(let t of this.mapUnsafe.keys())if(!e.mapUnsafe.has(t)||!Xe(this.mapUnsafe.get(t),e.mapUnsafe.get(t)))return!1;return!0},[Me](){return Le(this.mapUnsafe.size)}},ya=e=>S(e,ga),ba=e=>S(e,ha),xa=()=>Sa,Sa=_a(new Map),Ca=(e,t)=>_a(new Map([[e.key,t]])),wa=b(3,(e,t,n)=>Fa(e,e=>{e.set(t.key,n)})),Ta=b(3,(e,t,n)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):ba(t)?Aa(t):n()),Ea=b(2,(e,t)=>{if(!e.mapUnsafe.has(t.key)){if(ha in t)return Aa(t);throw ja(t)}return e.mapUnsafe.get(t.key)}),Da=Ea,Oa=(e,t)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):Aa(t),ka=`~effect/ServiceMap/defaultValue`,Aa=e=>ka in e?e[ka]:e[ka]=e.defaultValue(),ja=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(e.stack){let n=e.stack.split(`
2
+ import{r as e,t}from"./chunk-wdO_pP5q.js";import n from"node:path";import{ZodOptional as r}from"zod";import*as i from"zod/v4";import{z as a}from"zod/v4";import{NodeHttpClient as o,NodeServices as s}from"@effect/platform-node";import{execFile as c}from"node:child_process";import*as l from"node:crypto";import*as u from"node:os";import d from"node:os";import f from"node:net";import*as p from"@effect/platform-node/NodeSocket";import{promisify as m}from"node:util";import h from"node:process";import{chromium as g}from"playwright";import{createServer as _}from"node:http";import*as ee from"zod/v3";import{ZodFirstPartyTypeKind as v}from"zod/v3";import*as te from"zod/v4-mini";const y=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},ne={pipe(){return y(this,arguments)}},re=function(){function e(){}return e.prototype=ne,e}(),b=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},x=e=>e,ie=e=>()=>e,ae=ie(!0),oe=ie(!1),se=ie(null),ce=ie(void 0),le=ce;function ue(e,...t){return y(e,t)}function de(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}}function fe(e){let t=new WeakMap;return n=>{if(t.has(n))return t.get(n);let r=e(n);return t.set(n,r),r}}const pe=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},me=new WeakSet;function he(e){return typeof e==`string`}function ge(e){return typeof e==`number`}function _e(e){return typeof e==`boolean`}function ve(e){return typeof e==`bigint`}function ye(e){return typeof e==`symbol`}function be(e){return he(e)||ge(e)||ye(e)}function xe(e){return typeof e==`function`}function Se(e){return e!==void 0}function Ce(e){return e!=null}function we(e){return!0}function Te(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ee(e){return typeof e==`object`&&!!e||xe(e)}const S=b(2,(e,t)=>Ee(e)&&t in e),De=b(2,(e,t)=>S(e,`_tag`)&&e._tag===t);function Oe(e){return S(e,Symbol.iterator)||he(e)}const ke=b(2,(e,t)=>n=>e(n)&&t(n));function Ae(e){let t=Object.keys(e);return n=>{for(let r of t)if(!e[r](n[r]))return!1;return!0}}const je=`~effect/interfaces/Hash`,C=e=>{switch(typeof e){case`number`:return Ie(e);case`bigint`:return Le(e.toString(10));case`boolean`:return Le(String(e));case`symbol`:return Le(String(e));case`string`:return Le(e);case`undefined`:return Le(`undefined`);case`function`:case`object`:if(e===null)return Le(`null`);if(e instanceof Date)return Le(e.toISOString());if(e instanceof RegExp)return Le(e.toString());{if(me.has(e))return Me(e);if(Ge.has(e))return Ge.get(e);let t=qe(e,()=>Fe(e)?e[je]():typeof e==`function`?Me(e):Array.isArray(e)?Ve(e):e instanceof Map?He(e):e instanceof Set?Ue(e):ze(e));return Ge.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Me=e=>(We.has(e)||We.set(e,Ie(Math.floor(Math.random()*(2**53-1)))),We.get(e)),Ne=b(2,(e,t)=>e*53^t),Pe=e=>e&3221225471|e>>>1&1073741824,Fe=e=>S(e,je),Ie=e=>{if(e!==e)return Le(`NaN`);if(e===1/0)return Le(`Infinity`);if(e===-1/0)return Le(`-Infinity`);let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return Pe(t)},Le=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Pe(t)},Re=(e,t)=>{let n=12289;for(let r of t)n^=Ne(C(r),C(e[r]));return Pe(n)},ze=e=>Re(e,pe(e)),Be=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return Pe(r)},Ve=Be(6151,C),He=Be(Le(`Map`),([e,t])=>Ne(C(e),C(t))),Ue=Be(Le(`Set`),C),We=new WeakMap,Ge=new WeakMap,Ke=new WeakSet;function qe(e,t){if(Ke.has(e))return Le(`[Circular]`);Ke.add(e);let n=t();return Ke.delete(e),n}const Je=`~effect/interfaces/Equal`;function Ye(){return arguments.length===1?e=>Xe(e,arguments[0]):Xe(arguments[0],arguments[1])}function Xe(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||me.has(e)||me.has(t)?!1:tt(e,t,et):!1}function Ze(e,t,n){let r=Qe.has(e),i=$e.has(t);if(r&&i)return!0;if(r||i)return!1;Qe.add(e),$e.add(t);let a=n();return Qe.delete(e),$e.delete(t),a}const Qe=new WeakSet,$e=new WeakSet;function et(e,t){if(C(e)!==C(t))return!1;if(e instanceof Date)return t instanceof Date?e.toISOString()===t.toISOString():!1;if(e instanceof RegExp)return t instanceof RegExp?e.toString()===t.toString():!1;let n=lt(e),r=lt(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:Ze(e,t,()=>i?e[Je](t):Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:rt(e,t):e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:ot(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:ct(e,t):it(e,t))}function tt(e,t,n){let r=nt.get(e);if(!r)r=new WeakMap,nt.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=nt.get(t);return a||(a=new WeakMap,nt.set(t,a)),a.set(e,i),i}const nt=new WeakMap;function rt(e,t){for(let n=0;n<e.length;n++)if(!Xe(e[n],t[n]))return!1;return!0}function it(e,t){let n=pe(e),r=pe(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!Xe(e[i],t[i]))return!1;return!0}function at(e,t){return function(n,r){for(let[i,a]of n){let n=!1;for(let[o,s]of r)if(e(i,o)&&t(a,s)){n=!0;break}if(!n)return!1}return!0}}const ot=at(Xe,Xe);function st(e){return function(t,n){for(let r of t){let t=!1;for(let i of n)if(e(r,i)){t=!0;break}if(!t)return!1}return!0}}const ct=st(Xe),lt=e=>S(e,Je),ut=()=>Ye,dt=e=>(t,n)=>t===n||e(t,n),ft=(e,t)=>e===t,pt=()=>ft;function mt(e){return dt((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e[r](t[r],n[r]))return!1;return!0})}function ht(e){return dt((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}const gt=e=>e.length>0,_t=Symbol.for(`~effect/Inspectable/redactable`),vt=e=>S(e,_t);function yt(e){return vt(e)?bt(e):e}function bt(e){return e[_t](globalThis[`~effect/Fiber/currentFiber`]?.services??St)}const xt=`~effect/Fiber/currentFiber`,St={"~effect/ServiceMap":{},mapUnsafe:new Map,pipe(){return y(this,arguments)}};function Ct(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,n=0){if(Array.isArray(e)){if(r.has(e))return wt;if(r.add(e),!i||e.length<=1)return`[${e.map(e=>c(e,n)).join(`,`)}]`;let t=e.map(e=>c(e,n+1)).join(`,
3
+ `+a(n+1));return`[\n${a(n+1)}${t}\n${a(n)}]`}if(e instanceof Date)return Dt(e);if(!t?.ignoreToString&&S(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Ot(e);return e instanceof Error&&e.cause?`${t} (cause: ${c(e.cause,n)})`:t}if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return wt;if(r.add(e),_t in e)return Ct(bt(e));if(Symbol.iterator in e)return`${e.constructor.name}(${c(Array.from(e),n)})`;let t=s(e);return!i||t.length<=1?o(e,`{${t.map(t=>`${Tt(t)}:${c(e[t],n)}`).join(`,`)}}`):o(e,`{\n${t.map(t=>`${a(n+1)}${Tt(t)}: ${c(e[t],n+1)}`).join(`,
4
+ `)}\n${a(n)}}`)}return String(e)}return c(e,0)}const wt=`[Circular]`;function Tt(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Et(e){return e.map(e=>`[${Tt(e)}]`).join(``)}function Dt(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Ot(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function kt(e,t){let n=[],r=JSON.stringify(e,(e,t)=>typeof t==`object`&&t?n.includes(t)?void 0:n.push(t)&&yt(t):t,t?.space);return n=void 0,r}const At=Symbol.for(`nodejs.util.inspect.custom`),jt=e=>{try{if(S(e,`toJSON`)&&xe(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(jt)}catch{return`[toJSON threw]`}return yt(e)},Mt=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?Nt(e,t):String(e)}catch{return String(e)}},Nt=(e,t)=>{let n=[],r=JSON.stringify(e,(e,t)=>typeof t==`object`&&t?n.includes(t)?void 0:n.push(t)&&yt(t):t,t);return n=void 0,r},Pt={toJSON(){return jt(this)},[At](){return this.toJSON()},toString(){return Ct(this.toJSON())}};var Ft=class e{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}};const It=`~effect/Utils/internal`,Lt={[It]:e=>e()},Rt={[It]:e=>{try{return e()}finally{}}},zt=Lt[It](()=>Error().stack)?.includes(It)===!0?Lt[It]:Rt[It],Bt=`~effect/Effect`,Vt=`~effect/Exit`,Ht={_A:x,_E:x,_R:x},Ut=`${Bt}/identifier`,w=`${Bt}/args`,Wt=`${Bt}/evaluate`,Gt=`${Bt}/successCont`,Kt=`${Bt}/failureCont`,qt=`${Bt}/ensureCont`,Jt=Symbol.for(`effect/Effect/Yield`),Yt={pipe(){return y(this,arguments)},toJSON(){return{...this}},toString(){return Ct(this.toJSON(),{ignoreToString:!0,space:2})},[At](){return this.toJSON()}},Xt={[je](){return Re(this,Object.keys(this))},[Je](e){let t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r]&&!Ye(this[t[r]],e[t[r]]))return!1;return!0}},Zt={[Symbol.iterator](){return new Ft(this)}},Qt={...Zt,pipe(){return y(this,arguments)}},$t={[Bt]:Ht,...Yt,[Symbol.iterator](){return new Ft(this)},asEffect(){return this},toJSON(){return{_id:`Effect`,op:this[Ut],...w in this?{args:this[w]}:void 0}}},en=e=>S(e,Bt),tn=e=>S(e,Vt),nn=`~effect/Cause`,rn=`~effect/Cause/Reason`,an=e=>S(e,nn);var on=class{[nn];reasons;constructor(e){this[nn]=nn,this.reasons=e}pipe(){return y(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${Ct(this.reasons)})`}[At](){return this.toJSON()}[Je](e){return an(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>Ye(t,e.reasons[n]))}[je](){return Ve(this.reasons)}};const sn=new WeakMap;var cn=class{[rn];annotations;_tag;constructor(e,t,n){if(this[rn]=rn,this._tag=e,t!==ln&&typeof n==`object`&&n&&t.size>0){let e=sn.get(n);e&&(t=new Map([...e,...t])),sn.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return y(this,arguments)}toString(){return Ct(this)}[At](){return this.toString()}};const ln=new Map;var un=class extends cn{error;constructor(e,t=ln){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${Ct(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[Je](e){return _n(e)&&Ye(this.error,e.error)&&Ye(this.annotations,e.annotations)}[je](){return Ne(Le(this._tag))(Ne(C(this.error))(C(this.annotations)))}};const dn=e=>new on(e),fn=new on([]),pn=e=>new on([new un(e)]);var mn=class extends cn{defect;constructor(e,t=ln){super(`Die`,t,e),this.defect=e}toString(){return`Die(${Ct(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[Je](e){return vn(e)&&Ye(this.defect,e.defect)&&Ye(this.annotations,e.annotations)}[je](){return Ne(Le(this._tag))(Ne(C(this.defect))(C(this.annotations)))}};const hn=e=>new on([new mn(e)]),gn=b(e=>an(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new on(e.reasons.map(e=>e.annotate(t,n)))),_n=e=>e._tag===`Fail`,vn=e=>e._tag===`Die`,yn=e=>e._tag===`Interrupt`;function bn(e){return On(`Effect.evaluate: Not implemented`)}const xn=e=>({...$t,[Ut]:e.op,[Wt]:e[Wt]??bn,[Gt]:e[Gt],[Kt]:e[Kt],[qt]:e[qt]}),Sn=e=>{let t=xn(e);return function(){let n=Object.create(t);return n[w]=e.single===!1?arguments:arguments[0],n}},Cn=e=>{let t={...xn(e),[Vt]:Vt,_tag:e.op,get[e.prop](){return this[w]},toString(){return`${e.op}(${Ct(this[w])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[w]}},[Je](e){return tn(e)&&e._tag===this._tag&&Ye(this[w],e[w])},[je](){return Ne(Le(e.op),C(this[w]))}};return function(e){let n=Object.create(t);return n[w]=e,n}},T=Cn({op:`Success`,prop:`value`,[Wt](e){let t=e.getCont(Gt);return t?t[Gt](this[w],e,this):e.yieldWith(this)}}),wn={key:`effect/Cause/StackTrace`},Tn={key:`effect/Cause/InterruptorStackTrace`},En=Cn({op:`Failure`,prop:`cause`,[Wt](e){let t=this[w],n=!1;e.currentStackFrame&&(t=gn(t,{mapUnsafe:new Map([[wn.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(Kt);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(Kt);return r?r[Kt](t,e,n?void 0:this):e.yieldWith(n?this:En(t))}}),Dn=e=>En(pn(e)),On=e=>En(hn(e)),E=Sn({op:`WithFiber`,[Wt](e){return this[w](e)}}),kn=function(){class e extends globalThis.Error{asEffect(){return Dn(this)}}return Object.assign(e.prototype,Qt),e}(),An=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends kn{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Object.assign(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),jn=e=>{class t extends An{_tag=e}return t.prototype.name=e,t},Mn=`~effect/Cause/NoSuchElementError`;var Nn=class extends jn(`NoSuchElementError`){[Mn]=Mn;constructor(e){super({message:e})}};const Pn=`~effect/Cause/Done`,Fn=e=>S(e,Pn),In={[Pn]:Pn,_tag:`Done`,value:void 0},Ln=e=>e===void 0?In:{[Pn]:Pn,_tag:`Done`,value:e},Rn=Dn(In),zn=e=>e===void 0?Rn:Dn(Ln(e)),Bn=`~effect/data/Option`,Vn={[Bn]:{_A:e=>e},...Yt,...Zt},Hn=Object.assign(Object.create(Vn),{_tag:`Some`,_op:`Some`,[Je](e){return Gn(e)&&qn(e)&&Ye(this.value,e.value)},[je](){return Ne(C(this._tag))(C(this.value))},toString(){return`some(${Ct(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:jt(this.value)}},asEffect(){return T(this.value)}});Object.defineProperty(Hn,`valueOrUndefined`,{get(){return this.value}});const Un=C(`None`),Wn=Object.assign(Object.create(Vn),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[Je](e){return Gn(e)&&Kn(e)},[je](){return Un},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}},asEffect(){return Dn(new Nn)}}),Gn=e=>S(e,Bn),Kn=e=>e._tag===`None`,qn=e=>e._tag===`Some`,Jn=Object.create(Wn),Yn=e=>{let t=Object.create(Hn);return t.value=e,t},Xn=`~effect/data/Result`,Zn={[Xn]:{_A:e=>e,_E:e=>e},...Yt,...Zt},Qn=Object.assign(Object.create(Zn),{_tag:`Success`,_op:`Success`,[Je](e){return er(e)&&nr(e)&&Ye(this.success,e.success)},[je](){return Ne(C(this._tag))(C(this.success))},toString(){return`success(${Ct(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:jt(this.success)}},asEffect(){return T(this.success)}}),$n=Object.assign(Object.create(Zn),{_tag:`Failure`,_op:`Failure`,[Je](e){return er(e)&&tr(e)&&Ye(this.failure,e.failure)},[je](){return Ne(C(this._tag))(C(this.failure))},toString(){return`failure(${Ct(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:jt(this.failure)}},asEffect(){return Dn(this.failure)}}),er=e=>S(e,Xn),tr=e=>e._tag===`Failure`,nr=e=>e._tag===`Success`,rr=e=>{let t=Object.create($n);return t.failure=e,t},ir=e=>{let t=Object.create(Qn);return t.success=e,t};function ar(e){return(t,n)=>t===n?0:e(t,n)}const or=ar((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),sr=ar((e,t)=>e<t?-1:1),cr=b(2,(e,t)=>ar((n,r)=>{let i=e(n,r);return i===0?t(n,r):i})),lr=b(2,(e,t)=>ar((n,r)=>e(t(n),t(r)))),ur=e=>b(2,(t,n)=>e(t,n)===1),D=()=>Jn,O=Yn,dr=Gn,fr=Kn,pr=qn,mr=b(2,(e,{onNone:t,onSome:n})=>fr(e)?t():n(e.value)),hr=b(2,(e,t)=>fr(e)?t():e.value),gr=e=>e==null?D():O(e),_r=e=>e===null?D():O(e),vr=hr(se),yr=hr(ce),br=e=>(...t)=>{try{return O(e(...t))}catch{return D()}},xr=b(2,(e,t)=>{if(pr(e))return e.value;throw t()}),Sr=b(2,(e,t)=>fr(e)?D():O(t(e.value))),Cr=b(2,(e,t)=>fr(e)?D():t(e.value)),wr=b(2,(e,t)=>fr(e)?D():t(e.value)?O(e.value):D()),Tr=e=>dt((t,n)=>fr(t)?fr(n):fr(n)?!1:e(t.value,n.value)),Er=ir,Dr=rr,Or=er,k=tr,kr=nr,Ar=mt,jr=b(2,(e,t)=>{let n=0;for(let r of e){let e=t(r,n);if(_e(e)){if(e)return O(r)}else if(pr(e))return e;n++}return D()}),Mr={[Symbol.iterator](){return Nr}},Nr={next(){return{done:!0,value:void 0}}},Pr=()=>Mr,Fr=b(2,(e,t)=>Object.hasOwn(e,t)),Ir=e=>Object.keys(e),Lr=e=>b(2,(t,n)=>{for(let r of Ir(t))if(!Fr(n,r)||!e(t[r],n[r]))return!1;return!0}),Rr=e=>{let t=Lr(e);return(e,n)=>t(e,n)&&t(n,e)},zr=globalThis.Array,Br=e=>zr.isArray(e)?e:zr.from(e),Vr=e=>zr.isArray(e)?e:[e],Hr=b(2,(e,t)=>[...e,t]),Ur=b(2,(e,t)=>Br(e).concat(Br(t))),Wr=zr.isArray,Gr=e=>e.length===0,Kr=gt,qr=gt;function Jr(e,t){return e<0||e>=t.length}const Yr=b(2,(e,t)=>{let n=Math.floor(t);return Jr(n,e)?D():O(e[n])}),Xr=b(2,(e,t)=>{let n=Math.floor(t);if(Jr(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]}),Zr=Yr(0),Qr=Xr(0),$r=e=>e[e.length-1],ei=e=>e.slice(1),ti=jr,ni=b(2,(e,t)=>{let n=zr.from(e);return n.sort(t),n}),ri=b(3,(e,t,n)=>{let r=Br(e),i=Br(t);return qr(r)?qr(i)?di(n)(Ur(r,i)):r:i}),ii=b(2,(e,t)=>ri(e,t,ut())),ai=()=>[],oi=e=>[e],si=b(2,(e,t)=>e.map(t)),ci=b(2,(e,t)=>{if(Gr(e))return[];let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r);for(let e=0;e<i.length;e++)n.push(i[e])}return n})(x),li=b(2,(e,t)=>{let n=Br(e),r=[];for(let e=0;e<n.length;e++)t(n[e],e)&&r.push(n[e]);return r}),ui=ht,di=b(2,(e,t)=>{let n=Br(e);if(qr(n)){let e=[Qr(n)],r=ei(n);for(let n of r)e.every(e=>!t(n,e))&&e.push(n);return e}return[]}),fi=`~effect/BigDecimal`,pi={[fi]:fi,[je](){let e=bi(this);return Ne(C(e.value),Ie(e.scale))},[Je](e){return mi(e)&&wi(this,e)},toString(){return`BigDecimal(${Ti(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[At](){return this.toJSON()},pipe(){return y(this,arguments)}},mi=e=>S(e,fi),hi=(e,t)=>{let n=Object.create(pi);return n.value=e,n.scale=t,n},gi=(e,t)=>{if(e!==_i&&e%vi===_i)throw RangeError(`Value must be normalized`);let n=hi(e,t);return n.normalized=n,n},_i=BigInt(0),vi=BigInt(10),yi=gi(_i,0),bi=e=>{if(e.normalized===void 0)if(e.value===_i)e.normalized=yi;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e),e.normalized=gi(BigInt(t.substring(0,t.length-n)),e.scale-n)}return e.normalized},xi=b(2,(e,t)=>t>e.scale?hi(e.value*vi**BigInt(t-e.scale),t):t<e.scale?hi(e.value/vi**BigInt(e.scale-t),t):e),Si=e=>e.value<_i?hi(-e.value,e.scale):e,Ci=dt((e,t)=>e.scale>t.scale?xi(t,e.scale).value===e.value:e.scale<t.scale?xi(e,t.scale).value===t.value:e.value===t.value),wi=b(2,(e,t)=>Ci(e,t)),Ti=e=>{let t=bi(e);if(Math.abs(t.scale)>=16)return Ei(t);let n=t.value<_i,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},Ei=e=>{if(Di(e))return`0e+0`;let t=bi(e),n=`${Si(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Oi(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},Di=e=>e.value===_i,Oi=e=>e.value<_i,ki=`~effect/time/Duration`,Ai=BigInt(0),ji=BigInt(1e3),Mi=BigInt(1e6),Ni=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Pi=e=>{switch(typeof e){case`number`:return Ji(e);case`bigint`:return Ki(e);case`string`:{let t=Ni.exec(e);if(!t)break;let[n,r,i]=t,a=Number(r);switch(i){case`nano`:case`nanos`:return Ki(BigInt(r));case`micro`:case`micros`:return qi(BigInt(r));case`milli`:case`millis`:return Ji(a);case`second`:case`seconds`:return Yi(a);case`minute`:case`minutes`:return Xi(a);case`hour`:case`hours`:return Zi(a);case`day`:case`days`:return Qi(a);case`week`:case`weeks`:return $i(a)}break}case`object`:{if(e===null)break;if(ki in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(ge)?Fi(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Ui:e[0]===-1/0||e[1]===-1/0?Gi:e[0]===1/0||e[1]===1/0?Wi:Bi(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));let t=e,n=0;if(t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds)return Bi(n);let r=BigInt(n)*Mi;return t.microseconds&&(r+=BigInt(t.microseconds)*ji),t.nanoseconds&&(r+=BigInt(t.nanoseconds)),Bi(r)}}return Fi(e)},Fi=e=>{throw Error(`Invalid Input: ${e}`)},Ii={_tag:`Millis`,millis:0},Li={_tag:`Infinity`},Ri={_tag:`NegativeInfinity`},zi={[ki]:ki,[je](){return ze(this.value)},[Je](e){return Vi(e)&&aa(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[At](){return this.toJSON()},pipe(){return y(this,arguments)}},Bi=e=>{let t=Object.create(zi);return typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?t.value=Ii:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:`Millis`,millis:e}:t.value={_tag:`Nanos`,nanos:BigInt(Math.round(e*1e6))}:t.value=e>0?Li:Ri:e===Ai?t.value=Ii:t.value={_tag:`Nanos`,nanos:e},t},Vi=e=>S(e,ki),Hi=e=>e.value._tag!==`Infinity`&&e.value._tag!==`NegativeInfinity`,Ui=Bi(0),Wi=Bi(1/0),Gi=Bi(-1/0),Ki=e=>Bi(e),qi=e=>Bi(e*ji),Ji=e=>Bi(e),Yi=e=>Bi(e*1e3),Xi=e=>Bi(e*6e4),Zi=e=>Bi(e*36e5),Qi=e=>Bi(e*864e5),$i=e=>Bi(e*6048e5),ea=e=>na(e,{onMillis:x,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),ta=e=>{switch(e.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return e.value.nanos;case`Millis`:return BigInt(Math.round(e.value.millis*1e6))}},na=b(2,(e,t)=>{switch(e.value._tag){case`Millis`:return t.onMillis(e.value.millis);case`Nanos`:return t.onNanos(e.value.nanos);case`Infinity`:return t.onInfinity();case`NegativeInfinity`:return(t.onNegativeInfinity??t.onInfinity)()}}),ra=b(3,(e,t,n)=>e.value._tag===`Infinity`||e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`||t.value._tag===`NegativeInfinity`?n.onInfinity(e,t):e.value._tag===`Millis`?t.value._tag===`Millis`?n.onMillis(e.value.millis,t.value.millis):n.onNanos(ta(e),t.value.nanos):n.onNanos(e.value.nanos,ta(t))),ia=(e,t)=>ra(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),aa=b(2,(e,t)=>ia(e,t)),oa=e=>t=>e(t)?Er(t):Dr(t),sa=e=>t=>!k(e(t)),ca=e=>t=>t.has(e)?Er(t):Dr(t),la=b(2,(e,t)=>n=>{let r=e(n);return k(r)?r:t(r.success)}),ua=b(2,(e,t)=>n=>{let r=e(n);if(k(r))return Dr(n);let i=t(r.success);return k(i)?Dr(n):i}),da=e=>t=>{let n=e(t);return k(n)?D():O(n.success)},A=function(){let e=Error.stackTraceLimit;Error.stackTraceLimit=2;let t=Error();Error.stackTraceLimit=e;function n(){}let r=n;return Object.setPrototypeOf(r,fa),Object.defineProperty(r,`stack`,{get(){return t.stack}}),arguments.length>0?(r.key=arguments[0],arguments[1]?.defaultValue&&(r[pa]=pa,r.defaultValue=arguments[1].defaultValue),r):function(e,t){return r.key=e,t?.make&&(r.make=t.make),r}},fa={"~effect/ServiceMap/Service":{_Service:e=>e,_Identifier:e=>e},...Yt,...Zt,toJSON(){return{_id:`Service`,key:this.key,stack:this.stack}},asEffect(){return(this.asEffect=ie(E(e=>T(Ta(e.services,this)))))()},of(e){return e},serviceMap(e){return xa(this,e)},use(e){return E(t=>e(Ta(t.services,this)))},useSync(e){return E(t=>T(e(Ta(t.services,this))))}},pa=`~effect/ServiceMap/Reference`,ma=`~effect/ServiceMap`,ha=e=>{let t=Object.create(ga);return t.mapUnsafe=e,t.mutable=!1,t},ga={...Yt,[ma]:{_Services:e=>e},toJSON(){return{_id:`ServiceMap`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Je](e){if(!_a(e)||this.mapUnsafe.size!==e.mapUnsafe.size)return!1;for(let t of this.mapUnsafe.keys())if(!e.mapUnsafe.has(t)||!Ye(this.mapUnsafe.get(t),e.mapUnsafe.get(t)))return!1;return!0},[je](){return Ie(this.mapUnsafe.size)}},_a=e=>S(e,ma),va=e=>S(e,pa),ya=()=>ba,ba=ha(new Map),xa=(e,t)=>ha(new Map([[e.key,t]])),Sa=b(3,(e,t,n)=>Ma(e,e=>{e.set(t.key,n)})),Ca=b(3,(e,t,n)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):va(t)?Oa(t):n()),wa=b(2,(e,t)=>{if(!e.mapUnsafe.has(t.key)){if(pa in t)return Oa(t);throw ka(t)}return e.mapUnsafe.get(t.key)}),Ta=wa,Ea=(e,t)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):Oa(t),Da=`~effect/ServiceMap/defaultValue`,Oa=e=>Da in e?e[Da]:e[Da]=e.defaultValue(),ka=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(e.stack){let n=e.stack.split(`
5
5
  `);if(n.length>2){let e=n[2].match(/at (.*)/);e&&(t.message+=` (defined at ${e[1]})`)}}if(t.stack){let e=t.stack.split(`
6
6
  `);e.splice(1,3),t.stack=e.join(`
7
- `)}return t},Ma=b(2,(e,t)=>e.mapUnsafe.has(t.key)?O(e.mapUnsafe.get(t.key)):ba(t)?O(Aa(t)):D()),Na=b(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:Fa(e,e=>{t.mapUnsafe.forEach((t,n)=>e.set(n,t))})),Pa=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((e,n)=>{t.set(n,e)});return _a(t)},Fa=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;let n=new Map(e.mapUnsafe);return t(n),_a(n)},Ia=A,La=Ia(`effect/Scheduler`,{defaultValue:()=>new Ba}),Ra=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)};var za=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},Ba=class{executionMode;setImmediate;constructor(e=`async`,t=Ra){this.executionMode=e,this.setImmediate=t}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new Va(this.setImmediate)}},Va=class{tasks=new za;running=void 0;setImmediate;constructor(e=Ra){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}};const Ha=Ia(`effect/Scheduler/MaxOpsBeforeYield`,{defaultValue:()=>2048}),Ua=Ia(`effect/Scheduler/PreventSchedulerYield`,{defaultValue:()=>!1}),Wa=`effect/Tracer/ParentSpan`;var Ga=class extends A()(Wa){};const Ka=e=>e,qa=Ia(`effect/Tracer/DisablePropagation`,{defaultValue:oe}),Ja=Ia(`effect/Tracer/CurrentTraceLevel`,{defaultValue:()=>`Info`}),Ya=Ia(`effect/Tracer/MinimumTraceLevel`,{defaultValue:()=>`All`}),Xa=`effect/Tracer`,Za=Ia(Xa,{defaultValue:()=>Ka({span:e=>new Qa(e)})});var Qa=class{_tag=`Span`;spanId;traceId=`native`;sampled;name;parent;annotations;links;startTime;kind;status;attributes;events=[];constructor(e){this.name=e.name,this.parent=e.parent,this.annotations=e.annotations,this.links=e.links,this.startTime=e.startTime,this.kind=e.kind,this.sampled=e.sampled,this.status={_tag:`Started`,startTime:e.startTime},this.attributes=new Map,this.traceId=xr(e.parent)?.traceId??$a(32),this.spanId=$a(16)}end(e,t){this.status={_tag:`Ended`,endTime:e,exit:t,startTime:this.status.startTime}}attribute(e,t){this.attributes.set(e,t)}event(e,t,n){this.events.push([e,t,n??{}])}addLinks(e){this.links.push(...e)}};const $a=function(){return function(e){let t=``;for(let n=0;n<e;n++)t+=`abcdef0123456789`.charAt(Math.floor(Math.random()*16));return t}}(),eo=Ia(`effect/References/CurrentConcurrency`,{defaultValue:()=>`unbounded`}),to=Ia(`effect/References/CurrentStackFrame`,{defaultValue:ce}),no=Ia(`effect/References/TracerEnabled`,{defaultValue:ae}),ro=Ia(`effect/References/TracerTimingEnabled`,{defaultValue:ae}),io=Ia(`effect/References/TracerSpanAnnotations`,{defaultValue:()=>({})}),ao=Ia(`effect/References/TracerSpanLinks`,{defaultValue:()=>[]}),oo=Ia(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),so=Ia(`effect/References/CurrentLogLevel`,{defaultValue:()=>`Info`}),co=Ia(`effect/References/MinimumLogLevel`,{defaultValue:()=>`Info`}),lo=Ia(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),uo=e=>{if(e?.captureStackTrace===!1||e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=`boolean`)return e;let t=Error.stackTraceLimit;Error.stackTraceLimit=3;let n=Error();return Error.stackTraceLimit=t,{...e,captureStackTrace:po(()=>n.stack)}},fo=e=>t=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let i=r.split(`
8
- `);if(i[e]!==void 0)return n=i[e].trim(),n}},po=fo(3);var mo=class extends ln{fiberId;constructor(e,t=un){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[Ye](e){return bn(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[Me](){return Pe(Re(`${this._tag}:${this.fiberId}`))(Ne(this.annotations))}};const ho=e=>new sn([new mo(e)]),go=e=>{let t=e.reasons.find(vn);return t?Or(t):kr(e)},_o=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Or(n.error)}return kr(e)},vo=pa(_o),yo=e=>{let t=e.reasons.find(yn);return t?Or(t.defect):kr(e)},bo=e=>e.reasons.some(bn),xo=e=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];r._tag===`Interrupt`&&(t??=new Set,r.fiberId!==void 0&&t.add(r.fiberId))}return t?Or(t):kr(e)},So=e=>e.reasons.length>0&&e.reasons.every(bn),Co=b(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new sn(oi(e.reasons,t.reasons));return Xe(e,n)?e:n}),wo=e=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},To=e=>{let t=wo(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`)},Eo=e=>{let t=[],n=[];if(e.reasons.length===0)return t;let r=Error.stackTraceLimit;Error.stackTraceLimit=1;for(let r of e.reasons){if(r._tag===`Interrupt`){n.push(r);continue}t.push(Do(r._tag===`Die`?r.defect:r.error,r.annotations))}if(t.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=Mo(e,n);let r=new globalThis.Error(`All fibers interrupted without error`,{cause:e});r.name=`InterruptError`,r.stack=`${r.name}: ${r.message}`,t.push(Do(r,n[0].annotations))}return Error.stackTraceLimit=r,t},Do=(e,t)=>{let n=typeof e,r;if(e&&n===`object`){if(r=new globalThis.Error(Oo(e),{cause:e.cause?Do(e.cause):void 0}),typeof e.name==`string`&&(r.name=e.name),typeof e.stack==`string`)r.stack=Ao(e.stack,r,t);else{let e=`${r.name}: ${r.message}`;r.stack=t?jo(e,t):e}for(let t of Object.keys(e))t in r||(r[t]=e[t])}else r=new globalThis.Error(e?n===`string`?e:At(e):`Unknown error: ${e}`);return r},Oo=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return At(e)},ko=/\((.*)\)/g,Ao=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
9
- `),a=[r];for(let e=1;e<i.length&&!/(?:Generator\.next|~effect\/Effect)/.test(i[e]);e++)a.push(i[e]);return n?jo(a.join(`
7
+ `)}return t},Aa=b(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:Ma(e,e=>{t.mapUnsafe.forEach((t,n)=>e.set(n,t))})),ja=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((e,n)=>{t.set(n,e)});return ha(t)},Ma=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;let n=new Map(e.mapUnsafe);return t(n),ha(n)},Na=A,Pa=Na(`effect/Scheduler`,{defaultValue:()=>new La}),Fa=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)};var Ia=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},La=class{executionMode;setImmediate;constructor(e=`async`,t=Fa){this.executionMode=e,this.setImmediate=t}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new Ra(this.setImmediate)}},Ra=class{tasks=new Ia;running=void 0;setImmediate;constructor(e=Fa){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}};const za=Na(`effect/Scheduler/MaxOpsBeforeYield`,{defaultValue:()=>2048}),Ba=Na(`effect/Scheduler/PreventSchedulerYield`,{defaultValue:()=>!1}),Va=`effect/Tracer/ParentSpan`;var Ha=class extends A()(Va){};const Ua=e=>e,Wa=Na(`effect/Tracer/DisablePropagation`,{defaultValue:oe}),Ga=Na(`effect/Tracer/CurrentTraceLevel`,{defaultValue:()=>`Info`}),Ka=Na(`effect/Tracer/MinimumTraceLevel`,{defaultValue:()=>`All`}),qa=`effect/Tracer`,Ja=Na(qa,{defaultValue:()=>Ua({span:e=>new Ya(e)})});var Ya=class{_tag=`Span`;spanId;traceId=`native`;sampled;name;parent;annotations;links;startTime;kind;status;attributes;events=[];constructor(e){this.name=e.name,this.parent=e.parent,this.annotations=e.annotations,this.links=e.links,this.startTime=e.startTime,this.kind=e.kind,this.sampled=e.sampled,this.status={_tag:`Started`,startTime:e.startTime},this.attributes=new Map,this.traceId=yr(e.parent)?.traceId??Xa(32),this.spanId=Xa(16)}end(e,t){this.status={_tag:`Ended`,endTime:e,exit:t,startTime:this.status.startTime}}attribute(e,t){this.attributes.set(e,t)}event(e,t,n){this.events.push([e,t,n??{}])}addLinks(e){this.links.push(...e)}};const Xa=function(){return function(e){let t=``;for(let n=0;n<e;n++)t+=`abcdef0123456789`.charAt(Math.floor(Math.random()*16));return t}}(),Za=Na(`effect/References/CurrentConcurrency`,{defaultValue:()=>`unbounded`}),Qa=Na(`effect/References/CurrentStackFrame`,{defaultValue:ce}),$a=Na(`effect/References/TracerEnabled`,{defaultValue:ae}),eo=Na(`effect/References/TracerTimingEnabled`,{defaultValue:ae}),to=Na(`effect/References/TracerSpanAnnotations`,{defaultValue:()=>({})}),no=Na(`effect/References/TracerSpanLinks`,{defaultValue:()=>[]}),ro=Na(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),io=Na(`effect/References/CurrentLogLevel`,{defaultValue:()=>`Info`}),ao=Na(`effect/References/MinimumLogLevel`,{defaultValue:()=>`Info`}),oo=Na(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),so=e=>{if(e?.captureStackTrace===!1||e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=`boolean`)return e;let t=Error.stackTraceLimit;Error.stackTraceLimit=3;let n=Error();return Error.stackTraceLimit=t,{...e,captureStackTrace:lo(()=>n.stack)}},co=e=>t=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let i=r.split(`
8
+ `);if(i[e]!==void 0)return n=i[e].trim(),n}},lo=co(3);var uo=class extends cn{fiberId;constructor(e,t=ln){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[Je](e){return yn(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[je](){return Ne(Le(`${this._tag}:${this.fiberId}`))(Me(this.annotations))}};const fo=e=>new on([new uo(e)]),po=e=>{let t=e.reasons.find(_n);return t?Er(t):Dr(e)},mo=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Er(n.error)}return Dr(e)},ho=da(mo),go=e=>{let t=e.reasons.find(vn);return t?Er(t.defect):Dr(e)},_o=e=>e.reasons.some(yn),vo=e=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];r._tag===`Interrupt`&&(t??=new Set,r.fiberId!==void 0&&t.add(r.fiberId))}return t?Er(t):Dr(e)},yo=e=>e.reasons.length>0&&e.reasons.every(yn),bo=b(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new on(ii(e.reasons,t.reasons));return Ye(e,n)?e:n}),xo=e=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},So=e=>{let t=xo(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`)},Co=e=>{let t=[],n=[];if(e.reasons.length===0)return t;let r=Error.stackTraceLimit;Error.stackTraceLimit=1;for(let r of e.reasons){if(r._tag===`Interrupt`){n.push(r);continue}t.push(wo(r._tag===`Die`?r.defect:r.error,r.annotations))}if(t.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=ko(e,n);let r=new globalThis.Error(`All fibers interrupted without error`,{cause:e});r.name=`InterruptError`,r.stack=`${r.name}: ${r.message}`,t.push(wo(r,n[0].annotations))}return Error.stackTraceLimit=r,t},wo=(e,t)=>{let n=typeof e,r;if(e&&n===`object`){if(r=new globalThis.Error(To(e),{cause:e.cause?wo(e.cause):void 0}),typeof e.name==`string`&&(r.name=e.name),typeof e.stack==`string`)r.stack=Do(e.stack,r,t);else{let e=`${r.name}: ${r.message}`;r.stack=t?Oo(e,t):e}for(let t of Object.keys(e))t in r||(r[t]=e[t])}else r=new globalThis.Error(e?n===`string`?e:kt(e):`Unknown error: ${e}`);return r},To=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return kt(e)},Eo=/\((.*)\)/g,Do=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
9
+ `),a=[r];for(let e=1;e<i.length&&!/(?:Generator\.next|~effect\/Effect)/.test(i[e]);e++)a.push(i[e]);return n?Oo(a.join(`
10
10
  `),n):a.join(`
11
- `)},jo=(e,t)=>{let n=t?.get(Tn.key);return n&&(e=`${e}\n${No(n)}`),e},Mo=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(En.key);n.push(` at fiber (${t})`),r&&n.push(No(r))}return n.join(`
12
- `)},No=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(ko),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
13
- `)},Po=e=>Eo(e).map(e=>e.cause?`${e.stack} {\n${Fo(e.cause,` `)}\n}`:e.stack).join(`
14
- `),Fo=(e,t)=>{let n=e.stack.split(`
15
- `),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${Fo(e.cause,`${t} `)}\n${t}}`),r},Io=`~effect/Fiber/dev`,Lo={_A:x,_E:x},Ro={id:0},zo=()=>globalThis[St];var Bo=class{constructor(e,t=!0){this[Io]=Lo,this.setServices(e),this.id=++Ro.id,this.currentOpCount=0,this.currentLoopCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0}[Io];id;interruptible;currentOpCount;currentLoopCount;_stack;_observers;_exit;_currentExit;_children;_interruptedCause;_yielded;services;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return Oa(this.services,e)}addObserver(e){return this._exit?(e(this._exit),le):(this._observers.push(e),()=>{let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)})}interruptUnsafe(e,t){if(this._exit)return;let n=ho(e);this.currentStackFrame&&(n=_n(n,Ca(Tn,this.currentStackFrame))),t&&(n=_n(n,t)),this._interruptedCause=this._interruptedCause?Co(this._interruptedCause,n):n,this.interruptible&&this.evaluate(Xo(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this.runtimeMetrics?.recordFiberStart(this.services),this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===Yt)return;let n=Vo.interruptChildren&&Vo.interruptChildren(this);if(n!==void 0)return this.evaluate(M(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.services,this._exit);for(let e=0;e<this._observers.length;e++)this._observers[e](t);this._observers.length=0}runLoop(e){let t=globalThis[St];globalThis[St]=this;let n=!1,r=e;this.currentOpCount=0;let i=++this.currentLoopCount;try{for(;;){if(this.currentOpCount++,!n&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){n=!0;let e=r;r=M(es,()=>e)}if(r=this.currentTracerContext?this.currentTracerContext(r,this):r[Gt](this),i!==this.currentLoopCount)return Yt;if(r===Yt){let e=this._yielded;return Ht in e?(this._yielded=void 0,e):Yt}}}catch(e){return S(r,Gt)?this.runLoop(kn(e)):kn(`Fiber.runLoop: Not a valid effect: ${String(r)}`)}finally{globalThis[St]=t}}getCont(e){for(;;){let t=this._stack.pop();if(!t)return;let n=t[Jt]&&t[Jt](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,Yt}children(){return this._children??=new Set}pipe(){return y(this,arguments)}setServices(e){this.services=e;let t=this.getRef(La);t!==this.currentScheduler&&(this.currentScheduler=t,this._dispatcher=void 0),this.currentSpan=e.mapUnsafe.get(Wa),this.currentLogLevel=this.getRef(so),this.minimumLogLevel=this.getRef(co),this.currentStackFrame=e.mapUnsafe.get(to.key),this.maxOpsBeforeYield=this.getRef(Ha),this.currentPreventYield=this.getRef(Ua),this.runtimeMetrics=e.mapUnsafe.get(`effect/observability/Metric/FiberRuntimeMetricsKey`);let n=e.mapUnsafe.get(Xa);this.currentTracerContext=n?n.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag===`Span`?this.currentSpan:void 0}};const Vo={interruptChildren:void 0},Ho=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Tn.key,e.currentStackFrame),_a(t)},Uo=e=>{let t=e;return t._exit?j(t._exit):ps(n=>t._exit?n(j(t._exit)):Qo(e.addObserver(e=>n(j(e)))))},Wo=e=>ps(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(j(r))}return a(),Qo(()=>i?.())}),Go=e=>{let t=e;return t._exit?t._exit:ps(n=>t._exit?n(t._exit):Qo(e.addObserver(n)))},Ko=e=>ps(t=>{let n=Array.from(e);if(n.length===0)return t(j(si()));let r=Array(n.length),i=si(),a=0,o=!1;for(let e=0;e<n.length&&!o;e++)i.push(n[e].addObserver(s=>{if(a++,s._tag===`Failure`)return o=!0,i.forEach(e=>e()),t(s);r[e]=s.value,a===n.length&&t(j(r))}))}),qo=e=>E(t=>Jo(e,t.id)),Jo=b(e=>S(e[0],Io),(e,t,n)=>E(r=>{let i=Ho(r);return i=i&&n?Na(i,n):i??n,e.interruptUnsafe(t,i),Os(Uo(e))})),Yo=e=>E(t=>{let n=Ho(t);for(let r of e)r.interruptUnsafe(t.id,n);return Os(Wo(e))}),j=T,Xo=Dn,Zo=On,Qo=Cn({op:`Sync`,[Gt](e){let t=this[w](),n=e.getCont(Kt);return n?n[Kt](t,e):e.yieldWith(T(t))}}),$o=Cn({op:`Suspend`,[Gt](e){return this[w]()}}),es=Cn({op:`Yield`,[Gt](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Ws)},this[w]??0),e.yieldWith(()=>{t=!0})}})(0),ts=e=>j(O(e)),ns=j(D()),rs=e=>kn(e),is=e=>$o(()=>Zo(Bt(e))),as=j(void 0),os=e=>$o(()=>{try{return j(Bt(e.try))}catch(t){return Zo(Bt(()=>e.catch(t)))}}),ss=e=>ds(function(t,n){Bt(()=>e(n)).then(e=>t(j(e)),e=>t(rs(e)))},e.length!==0),cs=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new mu(e,`An error occurred in Effect.tryPromise`):e.catch;return ds(function(e,r){try{Bt(()=>t(r)).then(t=>e(j(t)),t=>e(Zo(Bt(()=>n(t)))))}catch(t){e(Zo(Bt(()=>n(t))))}},eval.length!==0)},ls=e=>E(t=>e(t.id)),us=ls(j),ds=Cn({op:`Async`,single:!1,[Gt](e){let t=Bt(()=>this[w][0].bind(e.currentScheduler)),n=!1,r=!1,i=this[w][1]?new AbortController:void 0,a=t(t=>{n||(n=!0,r?e.evaluate(t):r=t)},i?.signal);return r===!1?(r=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(fs(()=>(n=!0,i?.abort(),a??Ws))),Yt):r}}),fs=Cn({op:`AsyncFinalizer`,[Jt](e){e.interruptible&&(e.interruptible=!1,e._stack.push(pl))},[qt](e,t){return bo(e)?M(this[w](),()=>Xo(e)):Xo(e)}}),ps=e=>ds(e,e.length>=2),ms=ps(le),hs=(...e)=>$o(()=>Cs(e.length===1?e[0]():e[1].call(e[0].self))),gs=(e,...t)=>{let n=t.length===0?function(){return $o(()=>Cs(e.apply(this,arguments)))}:function(){let n=$o(()=>Cs(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return _s(e.length,n)},_s=(e,t)=>Object.defineProperty(t,`length`,{value:e,configurable:!0}),vs=fo(2),ys=function(){let e=typeof arguments[0]==`string`,t=e?arguments[0]:`Effect.fn`,n=e?arguments[1]:void 0,r=globalThis.Error.stackTraceLimit;globalThis.Error.stackTraceLimit=2;let i=new globalThis.Error;return globalThis.Error.stackTraceLimit=r,e?(r,...a)=>bs(t,r,i,a,e,n):bs(t,arguments[0],i,Array.prototype.slice.call(arguments,1),e,n)},bs=(e,t,n,r,i,a)=>{let o=typeof t==`function`?t:r.pop().bind(t.self);return _s(o.length,function(...t){let s=$o(()=>{let e=o.apply(this,arguments);return tn(e)?e:Cs(e)});for(let e=0;e<r.length;e++)s=r[e](s,...t);if(!tn(s))return s;let c=globalThis.Error.stackTraceLimit;globalThis.Error.stackTraceLimit=2;let l=new globalThis.Error;return globalThis.Error.stackTraceLimit=c,$s(i?Zl(e,a,e=>Ql(s,e)):s,to,t=>({name:e,stack:vs(()=>l.stack),parent:{name:`${e} (definition)`,stack:vs(()=>n.stack),parent:t}}))})},xs=(e,...t)=>_s(e.length,t.length===0?function(){return Ss(()=>e.apply(this,arguments))}:function(){let n=Ss(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),Ss=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return j(r.value);let i=r.value.asEffect(),a=i;if(a&&a._tag===`Success`){n=a.value;continue}else if(a&&a._tag===`Failure`)return i;else{let n=!0;return $o(()=>n?(n=!1,M(i,e=>Cs(t,e))):$o(()=>Cs(e())))}}}catch(e){return rs(e)}},Cs=Cn({op:`Iterator`,single:!1,[Kt](e,t){let n=this[w][0];for(;;){let r=n.next(e);if(r.done)return j(r.value);let i=r.value.asEffect();if(!Ms(i))return t._stack.push(this),i;if(i._tag===`Failure`)return i;e=i.value}},[Gt](e){return this[Kt](this[w][1],e)}}),ws=b(2,(e,t)=>{let n=j(t);return M(e,e=>n)}),Ts=e=>Fs(e,O),Es=b(2,(e,t)=>M(e,e=>tn(t)?t:Bt(()=>t(e)))),Ds=b(2,(e,t)=>M(e,e=>ws(tn(t)?t:Bt(()=>t(e)),e))),Os=e=>M(e,e=>Ws),ks=(e,t)=>E(n=>ps(r=>{let i=!1,a=new Set,o=e=>{i=!0,r(a.size===0?e:M(dl(Yo(a)),()=>e))},s=0;for(let r of e){if(i)break;let e=s++,c=Cl(n,r,!0,!0,!1);a.add(c),c.addObserver(r=>{a.delete(c);let s=!i;o(r),s&&t?.onWinner&&t.onWinner({fiber:c,index:e,parentFiber:n})})}return Yo(a)})),As=b(e=>tn(e[1]),(e,t,n)=>ks([e,t],n)),M=b(2,(e,t)=>{let n=Object.create(js);return n[w]=e,n[Kt]=t.length===1?t:e=>t(e),n}),js=Sn({op:`OnSuccess`,[Gt](e){return e._stack.push(this),this[w]}}),Ms=e=>Ht in e,Ns=b(2,(e,t)=>Ms(e)?e._tag===`Success`?t(e.value):e:M(e,t)),Ps=e=>M(e,x),Fs=b(2,(e,t)=>M(e,e=>j(Bt(()=>t(e))))),Is=b(2,(e,t)=>Ms(e)?Gs(e,t):Fs(e,t)),Ls=b(2,(e,t)=>Ms(e)?Ks(e,t):bc(e,t)),Rs=b(2,(e,t)=>Ms(e)?qs(e,t):xc(e,t)),zs=b(2,(e,t)=>{if(Ms(e)){if(e._tag===`Success`)return e;let n=_o(e.cause);return k(n)?e:t(n.success)}return dc(e,t)}),Bs=e=>Dn(ho(e)),Vs=e=>e._tag===`Success`,Hs=e=>e._tag===`Failure`,Us=e=>e._tag===`Failure`?Or(e.cause):kr(e),Ws=T(void 0),Gs=b(2,(e,t)=>e._tag===`Success`?T(t(e.value)):e),Ks=b(2,(e,t)=>{if(e._tag===`Success`)return e;let n=_o(e.cause);return k(n)?e:On(t(n.success))}),qs=b(2,(e,t)=>{if(e._tag===`Success`)return T(t.onSuccess(e.value));let n=_o(e.cause);return k(n)?e:On(t.onFailure(n.success))}),Js=b(2,(e,t)=>Vs(e)?t:e),Ys=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?Ws:Dn(fn(t))},Xs=e=>Vs(e)?O(e.value):D(),Zs=e=>E(t=>j(Ma(t.services,e))),Qs=b(2,(e,t)=>E(n=>{let r=n.services,i=t(r);return r===i?e:(n.setServices(i),rl(e,()=>{n.setServices(r)}))})),$s=b(3,(e,t,n)=>Qs(e,e=>{let r=Ea(e,t),i=n(r);return r===i?e:wa(e,t,i)})),ec=()=>tc,tc=E(e=>j(e.services)),nc=e=>E(t=>e(t.services)),rc=b(2,(e,t)=>Ms(e)?e:Qs(e,Na(t))),ic=function(){return arguments.length===1?b(2,(e,t)=>ac(e,arguments[0],t)):b(3,(e,t,n)=>ac(e,t,n)).apply(this,arguments)},ac=(e,t,n)=>Qs(e,e=>e.mapUnsafe.get(t.key)===n?e:wa(e,t,n)),oc=b(2,(e,t)=>M(t,t=>t?Ts(e):ns)),sc=b(e=>tn(e[0]),(e,t)=>bl({while:ae,body:ie(t?.disableYield?e:M(e,e=>es)),step:le})),cc=b(2,(e,t)=>{let n=Object.create(lc);return n[w]=e,n[qt]=t.length===1?t:e=>t(e),n}),lc=Sn({op:`OnFailure`,[Gt](e){return e._stack.push(this),this[w]}}),uc=b(3,(e,t,n)=>cc(e,e=>{let r=t(e);return k(r)?Xo(r.failure):Bt(()=>n(r.success,e))})),dc=b(2,(e,t)=>uc(e,_o,e=>t(e))),fc=b(2,(e,t)=>cc(e,e=>Es(Bt(()=>t(e)),Xo(e)))),pc=b(3,(e,t,n)=>cc(e,e=>{let r=t(e);return k(r)?Xo(e):Es(Bt(()=>n(r.success,e)),Xo(e))})),mc=b(2,(e,t)=>pc(e,_o,e=>t(e))),hc=b(e=>tn(e[0]),(e,t,n,r)=>cc(e,e=>{let i=_o(e);return k(i)?Xo(i.failure):t(i.success)?Bt(()=>n(i.success)):r?Bt(()=>r(i.success)):Xo(e)})),gc=b(e=>tn(e[0]),(e,t,n,r)=>cc(e,e=>{let i=_o(e);if(k(i))return Xo(i.failure);let a=t(i.success);return k(a)?r?Bt(()=>r(a.failure)):Xo(e):Bt(()=>n(a.success))})),_c=b(e=>tn(e[0]),(e,t,n,r)=>hc(e,Array.isArray(t)?e=>S(e,`_tag`)&&t.includes(e._tag):Ae(t),n,r)),vc=b(e=>tn(e[0]),(e,t,n)=>{let r;return gc(e,e=>(r??=Object.keys(t),S(e,`_tag`)&&he(e._tag)&&r.includes(e._tag)?Or(e):kr(e)),e=>Bt(()=>t[e._tag](e)),n)}),yc=b(e=>tn(e[0]),(e,t,n,r,i)=>hc(e,e=>Ae(e,t)&&S(e,`reason`),e=>{let t=e.reason;return Ae(t,n)?r(t,e):i?Bt(()=>i(t,e)):Zo(e)})),bc=b(2,(e,t)=>dc(e,e=>is(()=>t(e)))),xc=b(2,(e,t)=>Oc(e,{onFailure:e=>is(()=>t.onFailure(e)),onSuccess:e=>Qo(()=>t.onSuccess(e))})),Sc=e=>dc(e,rs),Cc=e=>dc(e,t=>M(es,()=>Cc(e))),wc=b(e=>tn(e[0]),(e,t)=>{if(!t?.log)return Oc(e,{onFailure:e=>as,onSuccess:e=>as});let n=wu(t.log===!0?void 0:t.log);return Ec(e,{onFailure(e){let r=go(e);return k(r)?Xo(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>as})}),Tc=e=>Ac(e,{onFailure:kr,onSuccess:Or}),Ec=b(2,(e,t)=>{let n=Object.create(Dc);return n[w]=e,n[Kt]=t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),n[qt]=t.onFailure.length===1?t.onFailure:e=>t.onFailure(e),n}),Dc=Sn({op:`OnSuccessAndFailure`,[Gt](e){return e._stack.push(this),this[w]}}),Oc=b(2,(e,t)=>Ec(e,{onFailure:e=>{let n=e.reasons.find(vn);return n?Bt(()=>t.onFailure(n.error)):Xo(e)},onSuccess:t.onSuccess})),kc=b(2,(e,t)=>Oc(e,{onFailure:e=>Qo(()=>t.onFailure(e)),onSuccess:e=>Qo(()=>t.onSuccess(e))})),Ac=b(2,(e,t)=>{if(Ms(e)){if(e._tag===`Success`)return T(t.onSuccess(e.value));let n=_o(e.cause);return k(n)?e:T(t.onFailure(n.success))}return kc(e,t)}),jc=e=>Ms(e)?T(e):Mc(e),Mc=Cn({op:`Exit`,[Gt](e){return e._stack.push(this),this[w]},[Kt](e,t,n){return j(n??T(e))},[qt](e,t,n){return j(n??Dn(e))}}),Nc=b(2,(e,t)=>Es(cu(t),e)),Pc=b(2,(e,t)=>As(e,M(cu(t.duration),t.onTimeout))),Fc=b(2,(e,t)=>Pc(e,{duration:t,onTimeout:()=>Zo(new uu)})),Ic=b(2,(e,t)=>As(Ts(e),ws(cu(t),D()))),Lc=`~effect/Scope`,Rc=`~effect/Scope/Closeable`,zc=A(`effect/Scope`),Bc=(e,t)=>$o(()=>Vc(e,t)??as),Vc=(e,t)=>{if(e.state._tag===`Closed`)return;let n={_tag:`Closed`,exit:t};if(e.state._tag===`Empty`){e.state=n;return}let{finalizers:r}=e.state;if(e.state=n,r.size!==0)return r.size===1?r.values().next().value(t):Hc(e,r,t)},Hc=gs(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=zo();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*jc(s(n))):i.push(Cl(o,s(n),!0,!0,`inherit`))}return i.length>0&&(r=yield*Wo(i)),yield*Ys(r)}),Uc=(e,t)=>Qo(()=>Wc(e,t)),Wc=(e,t)=>{let n=Yc(t);if(e.state._tag===`Closed`)return n.state=e.state,n;let r={};return qc(e,r,e=>Bc(n,e)),qc(n,r,t=>Qo(()=>Jc(e,r))),n},Gc=(e,t)=>$o(()=>e.state._tag===`Closed`?t(e.state.exit):(qc(e,{},t),as)),Kc=(e,t)=>Gc(e,ie(t)),qc=(e,t,n)=>{e.state._tag===`Empty`?e.state={_tag:`Open`,finalizers:new Map([[t,n]])}:e.state._tag===`Open`&&e.state.finalizers.set(t,n)},Jc=(e,t)=>{e.state._tag===`Open`&&e.state.finalizers.delete(t)},Yc=(e=`sequential`)=>({[Rc]:Rc,[Lc]:Lc,strategy:e,state:Xc}),Xc={_tag:`Empty`},Zc=zc.asEffect(),Qc=ic(zc),$c=e=>E(t=>{let n=t.services,r=Yc();return t.setServices(wa(t.services,zc,r)),rl(e,e=>(t.setServices(n),Vc(r,e)))}),el=e=>$o(()=>{let t=Yc();return il(e(t),e=>$o(()=>Vc(t,e)??as))}),tl=(e,t,n)=>nc(r=>gl(i=>M(Zc,a=>Ds(n?.interruptible?i(e):e,e=>Gc(a,n=>rc(t(e,n),r)))))),nl=e=>M(Zc,t=>nc(n=>Gc(t,t=>rc(e(t),n)))),rl=Cn({op:`OnExit`,single:!1,[Gt](e){return e._stack.push(this),this[w][0]},[Jt](e){e.interruptible&&this[w][2]!==!0&&(e._stack.push(pl),e.interruptible=!1)},[Kt](e,t,n){n??=T(e);let r=this[w][1](n);return r?M(r,e=>n):n},[qt](e,t,n){n??=Dn(e);let r=this[w][1](n);return r?M(r,e=>n):n}}),il=b(2,rl),al=b(2,(e,t)=>il(e,e=>t)),ol=b(3,(e,t,n)=>il(e,e=>{let r=t(e);return k(r)?as:n(r.success,e)})),sl=b(2,(e,t)=>ol(e,Us,t)),cl=b(3,(e,t,n)=>il(e,e=>{if(e._tag!==`Failure`)return as;let r=t(e.cause);return k(r)?as:n(r.success,e.cause)})),ll=b(2,(e,t)=>cl(xo,t)(e)),ul=E(e=>Xo(ho(e.id))),dl=e=>E(t=>t.interruptible?(t.interruptible=!1,t._stack.push(pl),e):e),fl=Cn({op:`SetInterruptible`,[Jt](e){if(e.interruptible=this[w],e._interruptedCause&&e.interruptible)return()=>Xo(e._interruptedCause)}}),pl=fl(!0),ml=fl(!1),hl=e=>E(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(ml),t._interruptedCause?Xo(t._interruptedCause):e)),gl=e=>E(t=>t.interruptible?(t.interruptible=!1,t._stack.push(pl),e(hl)):e(x)),_l=(e,t)=>je(e)?t?.mode===`result`?xl(e,Tc,t):xl(e,x,t):t?.discard?t.mode===`result`?xl(Object.values(e),Tc,t):xl(Object.values(e),x,t):$o(()=>{let n={};return ws(xl(Object.entries(e),([e,r])=>Fs(t?.mode===`result`?Tc(r):r,t=>{n[e]=t}),{discard:!0,concurrency:t?.concurrency}),n)}),vl=(e,t,n,r)=>M(n(r,t),i=>{if(i)return j(O(r));let a=e.next();return a.done?j(D()):vl(e,t+1,n,a.value)}),yl=(e,t,n,r)=>M(n(r,t),r=>{if(jr(r))return j(O(r.success));let i=e.next();return i.done?j(D()):yl(e,t+1,n,i.value)}),bl=Cn({op:`While`,[Kt](e,t){return this[w].step(e),this[w].while()?(t._stack.push(this),this[w].body()):Ws},[Gt](e){return this[w].while()?(e._stack.push(this),this[w].body()):Ws}}),xl=b(e=>typeof e[1]==`function`,(e,t,n)=>E(r=>{let i=n?.concurrency===`inherit`?r.getRef(eo):n?.concurrency??1,a=i===`unbounded`?1/0:Math.max(1,i);if(a===1)return Sl(e,t,n);let o=Hr(e),s=o.length;if(s===0)return n?.discard?as:j([]);let c=n?.discard?void 0:Array(s),l=0,u=Ho(r);return ps(e=>{let n=new Set,i=[],d=!1,f=0,p=0,m=!1,h=!1;function g(){for(m=!0;f<a&&l<s;){let _=l,ee=o[_];l++,f++;try{let o=Cl(r,t(ee,_),!0,!0,`inherit`);n.add(o),o.addObserver(t=>{if(!h){if(n.delete(o),t._tag===`Failure`)if(!d)d=!0,s=l,i.push(...t.cause.reasons),n.forEach(e=>e.interruptUnsafe(r.id,u));else for(let e of t.cause.reasons)e._tag!==`Interrupt`&&i.push(e);else c!==void 0&&(c[_]=t.value);p++,f--,p===s?e(i.length>0?Dn(fn(i)):j(c)):!m&&!d&&f<a&&g()}})}catch(e){d=!0,s=l,i.push(new hn(e)),n.forEach(e=>e.interruptUnsafe(r.id,u))}}m=!1}return g(),$o(()=>(h=!0,l=s,Yo(n)))})})),Sl=(e,t,n)=>$o(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return ws(bl({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),Cl=(e,t,n=!1,r=!1,i=!1)=>{let a=i===`inherit`?e.interruptible:!i,o=new Bo(e.services,a);return n?o.evaluate(t):e.currentDispatcher.scheduleTask(()=>o.evaluate(t),0),!r&&!o._exit&&(e.children().add(o),o.addObserver(()=>e._children.delete(o))),o},wl=b(e=>tn(e[0]),(e,t)=>E(n=>j(Cl(n,e,t?.startImmediately,!0,t?.uninterruptible)))),Tl=b(e=>tn(e[0]),(e,t,n)=>E(r=>{let i=Cl(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit)if(t.state._tag!==`Closed`){let e={};qc(t,e,()=>ls(e=>e===i.id?as:qo(i))),i.addObserver(()=>Jc(t,e))}else i.interruptUnsafe(r.id,Ho(r));return j(i)})),El=b(e=>tn(e[0]),(e,t)=>M(Zc,n=>Tl(e,n,t))),Dl=e=>(t,n)=>{let r=new Bo(n?.scheduler?wa(e,La,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal)if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}return r},Ol=b(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===`Closed`)return e.interruptUnsafe(e.id),e;let n={};return qc(t,n,()=>qo(e)),e.addObserver(()=>Jc(t,n)),e}),kl=Dl(xa()),Al=e=>{let t=Dl(e);return(e,n)=>{let r=t(e,n);return n?.onExit&&r.addObserver(n.onExit),e=>r.interruptUnsafe(e)}},jl=Al(xa()),Ml=e=>{let t=Dl(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},Nl=Ml(xa()),Pl=e=>{let t=Ml(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw To(e.cause);return e.value})},Fl=Pl(xa()),Il=e=>{let t=Dl(e);return e=>{if(Ms(e))return e;let n=t(e,{scheduler:new Ba(`sync`)});return n.currentDispatcher?.flush(),n._exit??kn(n)}},Ll=Il(xa()),Rl=e=>{let t=Il(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw To(n.cause);return n.value}},zl=Rl(xa()),Bl=j(!0),Vl=j(!1);var Hl=class{waiters=[];scheduled=!1;isOpen;constructor(e){this.isOpen=e}scheduleUnsafe(e){return this.scheduled||this.waiters.length===0?Bl:(this.scheduled=!0,e.currentDispatcher.scheduleTask(this.flushWaiters,0),Bl)}flushWaiters=()=>{this.scheduled=!1;let e=this.waiters;this.waiters=[];for(let t=0;t<e.length;t++)e[t](Ws)};open=E(e=>this.isOpen?Vl:(this.isOpen=!0,this.scheduleUnsafe(e)));release=E(e=>this.open?Vl:this.scheduleUnsafe(e));openUnsafe(){return this.isOpen?!1:(this.isOpen=!0,this.flushWaiters(),!0)}await=ps(e=>this.isOpen?e(as):(this.waiters.push(e),Qo(()=>{let t=this.waiters.indexOf(e);t!==-1&&this.waiters.splice(t,1)})));closeUnsafe(){return this.isOpen?(this.isOpen=!1,!0):!1}close=Qo(()=>this.closeUnsafe());whenOpen=e=>M(this.await,()=>e)};const Ul=e=>new Hl(e??!1),Wl=E(e=>j(e.getRef(Za))),Gl=BigInt(0),Kl={_tag:`Span`,spanId:`noop`,traceId:`noop`,sampled:!1,status:{_tag:`Ended`,startTime:Gl,endTime:Gl,exit:Ws},attributes:new Map,links:[],kind:`internal`,attribute(){},event(){},end(){},addLinks(){}},ql=e=>Object.assign(Object.create(Kl),e),Jl=e=>e?Da(e.annotations,qa)?e._tag===`Span`?Jl(xr(e.parent)):D():O(e):D(),Yl=(e,t,n)=>{let r=!e.getRef(no)||n?.annotations&&Da(n.annotations,qa),i=n?.parent===void 0?n?.root?D():Jl(e.currentSpan):O(n.parent),a;if(r)a=ql({name:t,parent:i,annotations:wa(n?.annotations??xa(),qa,!0)});else{let r=e.getRef(Za),o=e.getRef(nu),s=e.getRef(ro),c=e.getRef(io),l=e.getRef(ao),u=n?.level??e.getRef(Ja),d=n?.links===void 0?l.slice():[...l,...n.links];a=r.span({name:t,parent:i,annotations:n?.annotations??xa(),links:d,startTime:s?o.currentTimeNanosUnsafe():0n,kind:n?.kind??`internal`,root:n?.root??pr(i),sampled:n?.sampled??(mr(i)&&i.value.sampled===!1?!1:!gu(e.getRef(Ya),u))});for(let[e,t]of Object.entries(c))a.attribute(e,t);if(n?.attributes!==void 0)for(let[e,t]of Object.entries(n.attributes))a.attribute(e,t)}return a},Xl=(e,t)=>(t=typeof t==`function`?t:ce,$s(to,n=>({name:e,stack:t,parent:n}))),Zl=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return E(t=>{let i=Yl(t,e,n),a=t.getRef(nu);return il(Bt(()=>r(i)),e=>Qo(()=>{i.status._tag!==`Ended`&&i.end(a.currentTimeNanosUnsafe(),e)}))})},Ql=ic(Ga),$l=function(){let e=tn(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=x;return t._tag===`Span`&&(n=uo(n),r=Xl(t.name,n?.captureStackTrace)),e?Ql(r(arguments[0]),t):e=>Ql(r(e),t)},eu=function(){let e=typeof arguments[0]!=`string`,t=e?arguments[1]:arguments[0],n=uo(arguments[2]);if(e){let e=arguments[0];return Zl(t,arguments[2],t=>$l(e,t,n))}let r=typeof arguments[1]==`function`?arguments[1]:void 0,i=r?void 0:arguments[1];return(e,...a)=>Zl(t,r?r(...a):i,t=>$l(e,t,n))},tu=(...e)=>E(t=>{let n=t.currentSpanLocal;if(n)if(e.length===1)for(let[t,r]of Object.entries(e[0]))n.attribute(t,r);else n.attribute(e[0],e[1]);return as}),nu=Ia(`effect/Clock`,{defaultValue:()=>new iu}),ru=2**31-1;var iu=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=Qo(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return ou()}currentTimeNanos=Qo(()=>this.currentTimeNanosUnsafe());sleep(e){let t=na(e);return t<=0?es:ps(e=>{if(t>ru)return;let n=setTimeout(()=>e(as),t);return Qo(()=>clearTimeout(n))})}};const au=function(){let e=BigInt(1e6);if(typeof performance>`u`||performance.now===void 0)return()=>BigInt(Date.now())*e;if(typeof performance.timeOrigin==`number`&&performance.timeOrigin===0)return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6));return()=>t+BigInt(Math.round(performance.now()*1e6))}(),ou=function(){let e=typeof process==`object`&&`hrtime`in process&&typeof process.hrtime.bigint==`function`?process.hrtime:void 0;if(!e)return au;let t=au()-e.bigint();return()=>t+e.bigint()}(),su=e=>E(t=>e(t.getRef(nu))),cu=e=>su(t=>t.sleep(Ii(e))),lu=`~effect/Cause/TimeoutError`;var uu=class extends Mn(`TimeoutError`){[lu]=lu;constructor(e){super({message:e})}};const du=`~effect/Cause/IllegalArgumentError`;var fu=class extends Mn(`IllegalArgumentError`){[du]=du;constructor(e){super({message:e})}};Mn(`ExceededCapacityError`);const pu=`~effect/Cause/UnknownError`;var mu=class extends Mn(`UnknownError`){[pu]=pu;constructor(e,t){super({message:t,cause:e})}};const hu=Ia(`effect/Console/CurrentConsole`,{defaultValue:()=>globalThis.console}),gu=dr(ur(sr,e=>{switch(e){case`All`:return-(2**53-1);case`Fatal`:return 5e4;case`Error`:return 4e4;case`Warn`:return 3e4;case`Info`:return 2e4;case`Debug`:return 1e4;case`Trace`:return 0;case`None`:return 2**53-1}})),_u=Ia(`effect/Loggers/CurrentLoggers`,{defaultValue:()=>new Set([Ou,ku])}),vu=Ia(`effect/Logger/LogToStderr`,{defaultValue:oe}),yu=function(){let e=typeof arguments[0]==`string`?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return dl(E(t=>{let n=t.getRef(oo),r={...n};for(let t=0;t<e.length;t++){let[n,i]=e[t];r[n]=i}return t.setServices(wa(t.services,oo,r)),Gc(Ea(t.services,zc),r=>{let i=t.getRef(oo),a={...i};for(let t=0;t<e.length;t++){let[r,o]=e[t];i[r]===o&&(r in n?a[r]=n[r]:delete a[r])}return t.setServices(wa(t.services,oo,a)),as})}))},bu={"~effect/Logger":{_Message:x,_Output:x},pipe(){return y(this,arguments)}},xu=e=>{let t=Object.create(bu);return t.log=e,t},Su=e=>e.replace(/[\s="]/g,`_`),Cu=(e,t)=>`${Su(e[0])}=${t-e[1]}ms`,wu=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];on(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?fn(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=pn),E(r=>{let i=e??r.currentLogLevel;if(gu(r.minimumLogLevel,i))return as;let a=r.getRef(nu),o=r.getRef(_u);if(o.size>0){let e=new Date(a.currentTimeMillisUnsafe());for(let a of o)a.log({cause:n,fiber:r,date:e,logLevel:i,message:t})}return as})},Tu={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};Tu.gray,Tu.blue,Tu.green,Tu.yellow,Tu.red,Tu.bgBrightRed,Tu.black;const Eu=e=>`${e.getHours().toString().padStart(2,`0`)}:${e.getMinutes().toString().padStart(2,`0`)}:${e.getSeconds().toString().padStart(2,`0`)}.${e.getMilliseconds().toString().padStart(3,`0`)}`,Du=typeof process==`object`&&process!==null&&typeof process.stdout==`object`&&process.stdout!==null;Du&&process.stdout.isTTY,Du||`Deno`in globalThis;const Ou=xu(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(Po(e));let o=t.getTime(),s=n.getRef(lo),c=``;for(let e of s)c+=` ${Cu(e,o)}`;let l=n.getRef(oo);Object.keys(l).length>0&&a.push(l);let u=n.getRef(hu);(n.getRef(vu)?u.error:u.log)(`[${Eu(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),ku=xu(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(nu),a=t.getRef(oo),o=t.currentSpan;if(o===void 0||o._tag===`ExternalSpan`)return;let s={};for(let[e,t]of Object.entries(a))s[e]=t;s[`effect.fiberId`]=t.id,s[`effect.logLevel`]=n.toUpperCase(),e.reasons.length>0&&(s[`effect.cause`]=Po(e)),o.event(Nt(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)}),Au=on,ju=mn,Mu=gn,Nu=ho,Pu=So,Fu=To,Iu=_o,Lu=vo,Ru=yo,zu=xo,Bu=Po,Vu=Pn,Hu=In,Uu=Rn,Wu=Bn,Gu=fu,Ku=mu,qu=nn,Ju=T,Yu=Dn,Xu=On,Zu=Ws,Qu=Vs,$u=Hs,ed=Xs,td={"~effect/Deferred":{_A:x,_E:x},pipe(){return y(this,arguments)}},nd=()=>{let e=Object.create(td);return e.resumes=void 0,e.effect=void 0,e},rd=()=>Qo(()=>nd()),id=e=>ps(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),Qo(()=>{let n=e.resumes.indexOf(t);e.resumes.splice(n,1)}))),ad=b(2,(e,t)=>Qo(()=>pd(e,t))),od=ad,sd=b(2,(e,t)=>od(e,On(t))),cd=b(2,(e,t)=>od(e,Dn(t))),ld=b(2,(e,t)=>cd(e,ho(t))),ud=e=>Qo(()=>dd(e)),dd=e=>e.effect!==void 0,fd=b(2,(e,t)=>od(e,T(t))),pd=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){for(let n=0;n<e.resumes.length;n++)e.resumes[n](t);e.resumes=void 0}return!0},md=b(2,(e,t)=>gl(n=>M(jc(n(e)),e=>od(t,e)))),hd=zc,gd=Yc,_d=Qc,vd=Gc,yd=Kc,bd=Uc,xd=Wc,Sd=Bc,Cd=`~effect/Layer`,wd=`~effect/Layer/MemoMap`,Td=e=>S(e,Cd),Ed={[Cd]:{_ROut:x,_E:x,_RIn:x},pipe(){return y(this,arguments)}},Dd=e=>{let t=Object.create(Ed);return t.build=e,t},Od=e=>Dd((t,n)=>{let r=xd(n);return il(e(t,r),e=>e._tag===`Failure`?Sd(r,e):as)}),kd=e=>{let t=Od((n,r)=>n.getOrElseMemoize(t,r,e));return t};var Ad=class{get[wd](){return wd}map=new Map;getOrElseMemoize(e,t,n){if(this.map.has(e)){let n=this.map.get(e);return n.observers++,Es(Gc(t,e=>n.finalizer(e)),n.effect)}let r=gd(),i=nd(),a={observers:1,effect:id(i),finalizer:t=>$o(()=>(a.observers--,a.observers===0?(this.map.delete(e),Sd(r,t)):as))};return this.map.set(e,a),Gc(t,a.finalizer).pipe(M(()=>n(this,r)),il(e=>(a.effect=e,od(i,e))))}};const jd=()=>new Ad;var Md=class extends A()(`effect/Layer/CurrentMemoMap`){static getOrCreate=Ta(this,jd)};const Nd=b(3,(e,t,n)=>ic(Fs(e.build(t,n),wa(Md,t)),Md,t)),Pd=b(2,(e,t)=>E(n=>Nd(e,Md.getOrCreate(n.services),t))),Fd=function(){return arguments.length===1?e=>Id(Ca(arguments[0],e)):Id(Ca(arguments[0],arguments[1]))},Id=e=>Dd(ie(j(e))),Ld=function(){return arguments.length===1?e=>Rd(arguments[0],e):Rd(arguments[0],arguments[1])},Rd=(e,t)=>zd(Fs(t,t=>Ca(e,t))),zd=e=>kd((t,n)=>_d(e,n)),Bd=e=>zd(ws(e,xa())),Vd=e=>{let t=A(`effect/Layer/unwrap`);return Kd(Ld(t)(e),Da(t))},Hd=(e,t,n)=>{let r=xd(n,`parallel`);return xl(e,e=>e.build(t,xd(r,`sequential`)),{concurrency:e.length}).pipe(Fs(e=>Pa(...e)))},Ud=(...e)=>Od((t,n)=>Hd(e,t,n)),Wd=(e,t,n)=>Od((r,i)=>M(Array.isArray(t)?Hd(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(rc(t),Fs(e=>n(e,t))))),N=b(2,(e,t)=>Wd(e,t,x)),Gd=b(2,(e,t)=>Wd(e,t,(e,t)=>Na(t,e))),Kd=b(2,(e,t)=>Od((n,r)=>M(e.build(n,r),e=>t(e).build(n,r)))),qd=function(){return arguments.length===1?e=>Jd(arguments[0],e):Jd(arguments[0],arguments[1])},Jd=(e,t)=>Fd(e)(new Proxy({...t},{get(t,n,r){if(n in t)return t[n];let i=Error.stackTraceLimit;Error.stackTraceLimit=2;let a=Error(`${e.key}: Unimplemented method "${n.toString()}"`);return Error.stackTraceLimit=i,a.name=`UnimplementedError`,Yd(a)},has:ae})),Yd=e=>{let t=Object.assign(rs(e),{[Xd]:Xd,channel:{[Zd]:Zd,transform:()=>j(t),pipe(){return y(this,arguments)}},[Zd]:Zd,transform:()=>j(t)});function n(){return t}return Object.assign(n,t),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n},Xd=`~effect/Stream`,Zd=`~effect/Channel`,Qd=`~effect/ExecutionPlan`,$d={[Qd]:Qd,get withRequirements(){let e=this;return nc(t=>j(ef(e.steps.map(e=>({...e,provide:Td(e.provide)?N(e.provide,Id(t)):e.provide})))))},pipe(){return y(this,arguments)}},ef=e=>{let t=Object.create($d);return t.steps=e,t},tf=class extends re{constructor(e){super(),e&&Object.assign(this,e)}},nf=()=>new Proxy({},{get(e,t,n){return t===`$is`?Ae:t===`$match`?rf:e=>({_tag:t,...e})}});function rf(){if(arguments.length===1){let e=arguments[0];return function(t){return e[t._tag](t)}}let e=arguments[0];return arguments[1][e._tag](e)}const af=jn,of=Mn,sf=`~effect/time/DateTime`,cf=`~effect/time/DateTime/TimeZone`,lf={[sf]:sf,pipe(){return y(this,arguments)},[jt](){return this.toString()},toJSON(){return Sf(this).toJSON()}},uf={...lf,_tag:`Utc`,[Me](){return Le(this.epochMilliseconds)},[Ye](e){return ff(e)&&e._tag===`Utc`&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Sf(this).toJSON()})`}};({...lf});const df={[cf]:cf,[jt](){return this.toString()}};({...df}),{...df};const ff=e=>S(e,sf),pf=e=>e._tag===`Utc`,mf=ft((e,t)=>e.epochMilliseconds===t.epochMilliseconds),hf=e=>{let t=Object.create(uf);return t.epochMilliseconds=e,Object.defineProperty(t,`partsUtc`,{value:void 0,enumerable:!1,writable:!0}),t},gf=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Gu(`Invalid date`);return hf(t)},_f=e=>{if(ff(e))return e;if(e instanceof Date)return gf(e);if(typeof e==`object`){if(`epochMilliseconds`in e)return hf(e.epochMilliseconds);let t=new Date(0);return Df(t,e),gf(t)}else if(typeof e==`string`&&!vf(e))return gf(new Date(e+`Z`));return gf(new Date(e))},vf=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),yf=Sr(_f),bf=()=>hf(Date.now()),xf=e=>hf(e.epochMilliseconds),Sf=e=>new Date(e.epochMilliseconds),Cf=e=>{if(e._tag===`Utc`)return new Date(e.epochMilliseconds);if(e.zone._tag===`Offset`)return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(e=>e.type!==`literal`),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMilliseconds=n.getTime(),n},wf=e=>Cf(e).getTime()-Ef(e),Tf=e=>{let t=Math.abs(e),n=Math.floor(t/(3600*1e3)),r=Math.round(t%(3600*1e3)/(60*1e3));return r===60&&(n+=1,r=0),`${e<0?`-`:`+`}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`},Ef=e=>e.epochMilliseconds,Df=(e,t)=>{if(t.year!==void 0&&e.setUTCFullYear(t.year),t.month!==void 0&&e.setUTCMonth(t.month-1),t.day!==void 0&&e.setUTCDate(t.day),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)},Of=e=>Sf(e).toISOString();globalThis.String;const kf=e=>e.trim(),Af=e=>e.length>0,jf=b(2,(e,t)=>{let n=e.split(t);return _t(n)?n:[e]}),Mf=b(2,(e,t)=>uc(e,Lf,e=>t(e))),Nf=e=>e.reasons.some(Pf),Pf=e=>e._tag===`Fail`&&Hu(e.error),Ff=fa(Iu,e=>Hu(e)?Or(e):kr(e)),If=ca(e=>e.reasons.every(e=>!Pf(e))),Lf=fa(Iu,e=>Hu(e)?Or(e.value):kr(e)),Rf=e=>{let t=Ff(e);return k(t)?Yu(t.failure):Ju(t.success.value)},zf=b(2,(e,t)=>Ec(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=Ff(e);return k(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),Bf=`~effect/Schedule`,Vf=Ia(`effect/Schedule/CurrentMetadata`,{defaultValue:ie({input:void 0,output:void 0,duration:Gi,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),Hf={[Bf]:{_Out:x,_In:x,_Env:x},pipe(){return y(this,arguments)}},Uf=e=>S(e,Bf),Wf=e=>{let t=Object.create(Hf);return t.step=e,t},Gf=()=>{let e=0,t,n;return(r,i)=>{n===void 0&&(n=r);let a=r-n,o=t===void 0?0:r-t;return t=r,{input:i,attempt:++e,start:n,now:r,elapsed:a,elapsedSincePrevious:o}}},Kf=e=>Wf(Fs(e,e=>{let t=Gf();return(n,r)=>e(t(n,r))})),qf=e=>cc(e.step,e=>j(()=>Xo(e))),Jf=e=>su(t=>Fs(qf(e),e=>{let n=Gf();return r=>$o(()=>{let i=t.currentTimeMillisUnsafe();return M(e(i,r),([e,t])=>{let a=n(i,r);return a.output=e,a.duration=t,ws(cu(t),a)})})})),Yf=(e,t=2)=>{let n=na(Ii(e));return Kf(j(e=>{let r=Xi(n*t**(e.attempt-1));return j([r,r])}))},Xf=e=>Wf(Fs(qf(e),e=>(t,n)=>zf(e(t,n),{onSuccess:e=>j([n,e[1]]),onFailure:Xo,onDone:()=>Wu(n)}))),Zf=e=>{let t=Ii(e);return Kf(j(e=>j([e.attempt-1,t])))},Qf=b(2,(e,t)=>Wf(Fs(qf(e),e=>{let n=Gf();return(r,i)=>M(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return M(tn(s)?s:j(s),t=>t?j(e):Wu(a))})}))),$f=Zf(Gi),ep=(e,t,n)=>el(r=>M(n?.local?Nd(t,jd(),r):Pd(t,r),t=>rc(e,t))),tp=b(e=>tn(e[0]),(e,t,n)=>ya(t)?rc(e,t):ep(e,Array.isArray(t)?Ud(...t):t,n)),np=b(3,(e,t,n)=>M(Jf(t),t=>{let r=Vf.defaultValue();return dc(sc(Ds(M($o(()=>ic(e,Vf,r)),t),e=>Qo(()=>{r=e})),{disableYield:!0}),e=>In(e)?j(e.value):n(e,r.attempt===0?D():O(r)))})),rp=b(3,(e,t,n)=>M(Jf(t),t=>{let r=Vf.defaultValue(),i,a=dc($o(()=>ic(e,Vf,r)),e=>(i=e,M(t(e),e=>(r=e,a))));return Mf(a,e=>Bt(()=>n(i,e)))})),ip=b(2,(e,t)=>np(e,typeof t==`function`?t(x):Uf(t)?t:sp(t),Zo)),ap=b(2,(e,t)=>rp(e,typeof t==`function`?t(x):Uf(t)?t:sp(t),Zo)),op=Xf($f),sp=e=>{let t=e.schedule??op;return e.while&&(t=Qf(t,({input:t})=>{let n=e.while(t);return tn(n)?n:j(n)})),e.until&&(t=Qf(t,({input:t})=>{let n=e.until(t);return tn(n)?Fs(n,e=>!e):j(!n)})),e.times!==void 0&&(t=Qf(t,({attempt:t})=>j(t<=e.times))),t};({...Zt});const cp=Ia(`~effect/observability/Metric/MetricRegistryKey`,{defaultValue:()=>new Map}),lp=e=>{let t=Da(e,cp);return Array.from(t.values()).map(({hooks:t,...n})=>({...n,state:t.get(e)}))},up=tn,dp=_l,fp=xl,pp=bl,mp=ss,hp=cs,P=j,gp=ns,_p=ts,vp=$o,F=Qo,I=as,yp=ps,bp=ms,L=hs,R=Zo,xp=Xo,Sp=rs,Cp=os,wp=E,z=M,Tp=Ps,Ep=Es,Dp=Ds,Op=jc,B=Fs,kp=ws,Ap=Os,jp=dc,Mp=_c,Np=vc,Pp=yc,V=cc,Fp=gc,Ip=uc,Lp=bc,Rp=Sc,zp=mc,Bp=fc,Vp=ap,Hp=wc,Up=Fc,Wp=Ic,Gp=Pc,Kp=Nc,qp=cu,Jp=As,Yp=oc,Xp=Ec,Zp=Oc,Qp=ec,$p=nc,em=tp,tm=rc,nm=Zs,rm=Qs,im=ic,am=Zc,om=$c,sm=el,cm=tl,lm=nl,um=al,dm=sl,fm=il,pm=ul,mm=ll,hm=dl,gm=gl,_m=sc,vm=ip,ym=Wl,bm=tu,xm=eu,Sm=Tl,Cm=El,wm=wl,Tm=us,Em=kl,Dm=Dl,Om=Al,km=jl,Am=Fl,jm=Pl,Mm=Nl,Nm=Ml,Pm=zl,Fm=Rl,Im=Ll,Lm=Il,Rm=gs,H=ys,zm=wu(`Warn`),Bm=wu(`Error`),Vm=wu(`Info`),Hm=wu(`Debug`),Um=b(e=>up(e[0]),(e,...t)=>$s(e,oo,e=>{let n={...e};return t.length===1?Object.assign(n,t[0]):n[t[0]]=t[1],n})),Wm=yu,Gm=(e,t,n)=>(...r)=>yp(i=>{try{e(...r,(e,n)=>{i(e?R(t?t(e,r):e):P(n))})}catch(e){i(n?R(n(e,r)):Sp(e))}}),Km=Is,qm=Ls,Jm=Rs,Ym=Ns,Xm=zs,Zm=xs;function Qm(e,t,n){return t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n,e}function $m(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function eh(e){return t=>$m(t)?.[e]}const th=eh(`identifier`),nh=eh(`brands`),rh=fe(e=>{let t=th(e);return typeof t==`string`?t:e.getExpected(rh)});globalThis.RegExp;const ih=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`),ah=ff,oh=pf,sh=mf,ch=gf,lh=yf,uh=bf,dh=xf,fh=Ef;A()(`effect/DateTime/CurrentTimeZone`);const ph=Of;of(`EncodingError`);const mh=new WeakMap,hh=`~effect/data/Redacted`,gh=e=>S(e,hh),_h=(e,t)=>{let n=Object.create(vh);return t?.label&&(n.label=t.label),mh.set(n,e),n},vh={[hh]:{_A:e=>e},label:void 0,...Xt,toJSON(){return this.toString()},toString(){return`<redacted${he(this.label)?`:`+this.label:``}>`},[Me](){return C(mh.get(this))},[Ye](e){return gh(e)&&Xe(mh.get(this),mh.get(e))}},yh=`~effect/SchemaIssue/Issue`;function bh(e){return S(e,yh)}var xh=class{[yh]=yh;toString(){return zh(this)}},Sh=class extends xh{_tag=`Filter`;actual;filter;issue;constructor(e,t,n){super(),this.actual=e,this.filter=t,this.issue=n}},Ch=class extends xh{_tag=`Encoding`;ast;actual;issue;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issue=n}},wh=class extends xh{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},Th=class extends xh{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},Eh=class extends xh{_tag=`UnexpectedKey`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},Dh=class extends xh{_tag=`Composite`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},Oh=class extends xh{_tag=`InvalidType`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},kh=class extends xh{_tag=`InvalidValue`;actual;annotations;constructor(e,t){super(),this.actual=e,this.annotations=t}},Ah=class extends xh{_tag=`AnyOf`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},jh=class extends xh{_tag=`OneOf`;ast;actual;successes;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.successes=n}};function Mh(e,t){if(bh(t))return t;if(t!==void 0)return typeof t==`boolean`?t?void 0:new kh(O(e)):typeof t==`string`?new kh(O(e),{message:t}):new wh(t.path,new kh(O(e),{message:t.message}))}const Nh=e=>{let t=Vh(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return Fh(rh(e.ast),Uh(e.actual));case`InvalidValue`:return`Invalid data ${Uh(e.actual)}`;case`MissingKey`:return`Missing key`;case`UnexpectedKey`:return`Unexpected key with value ${wt(e.actual)}`;case`Forbidden`:return`Forbidden operation`;case`OneOf`:return`Expected exactly one member to match the input ${wt(e.actual)}`}},Ph=e=>Vh(e.issue)??Vh(e);function Fh(e,t){return`Expected ${e}, got ${t}`}function Ih(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];switch(e.issue._tag){case`InvalidValue`:return[{path:t,message:Fh(Lh(e.filter),wt(e.actual))}];default:return Ih(e.issue,t,n,r)}}case`Encoding`:return Ih(e.issue,t,n,r);case`Pointer`:return Ih(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Ih(e,t,n,r));case`AnyOf`:{let i=Vh(e);return e.issues.length===0?i===void 0?[{path:t,message:Fh(rh(e.ast),wt(e.actual))}]:[{path:t,message:i}]:e.issues.flatMap(e=>Ih(e,t,n,r))}default:return[{path:t,message:n(e)}]}}function Lh(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>Lh(e)).join(` & `)}}function Rh(){return e=>Ih(e,[],Nh,Ph).map(Bh).join(`
16
- `)}const zh=Rh();function Bh(e){let t=e.message;if(e.path&&e.path.length>0){let n=Dt(e.path);t+=`\n at ${n}`}return t}function Vh(e){switch(e._tag){case`InvalidType`:case`OneOf`:case`Composite`:case`AnyOf`:return Hh(e.ast.annotations);case`InvalidValue`:case`Forbidden`:return Hh(e.annotations);case`MissingKey`:return Hh(e.annotations,`messageMissingKey`);case`UnexpectedKey`:return Hh(e.ast.annotations,`messageUnexpectedKey`);case`Filter`:return Hh(e.filter.annotations);case`Encoding`:return Vh(e.issue)}}function Hh(e,t=`message`){let n=e?.[t];if(typeof n==`string`)return n}function Uh(e){return pr(e)?`no value provided`:wt(e.value)}var Wh=class e extends re{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(Km(wr(t))))}compose(t){return Kh(this)?t:Kh(t)?this:new e((e,n)=>this.run(e,n).pipe(Ym(e=>t.run(e,n))))}};const Gh=new Wh(P);function Kh(e){return e.run===Gh.run}function qh(){return Gh}function Jh(e){return new Wh((t,n)=>pr(t)?gp:e(t.value,n))}function U(e){return Xh(wr(e))}function Yh(e){return Jh((t,n)=>e(t,n).pipe(Km(O)))}function Xh(e){return new Wh(t=>P(e(t)))}function Zh(){return U(globalThis.String)}function Qh(){return U(globalThis.Number)}function $h(){return U(globalThis.BigInt)}function eg(e){return Jh(t=>Cp({try:()=>O(JSON.parse(t,e?.reviver)),catch:e=>new kh(O(t),{message:globalThis.String(e)})}))}function tg(e){return Jh(t=>Cp({try:()=>O(JSON.stringify(t,e?.replacer,e?.space)),catch:e=>new kh(O(t),{message:globalThis.String(e)})}))}function ng(e){let t=e?.separator??`,`;return U(e=>e===``?[]:e.split(t))}const rg=`~effect/SchemaTransformation/Transformation`;var ig=class e{[rg]=rg;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function ag(e){return S(e,rg)}const og=e=>ag(e)?e:new ig(e.decode,e.encode);function sg(e){return new ig(Yh(e.decode),Yh(e.encode))}function cg(e){return new ig(U(e.decode),U(e.encode))}const lg=new ig(qh(),qh());function ug(){return lg}const dg=new ig(Qh(),Zh()),fg=new ig($h(),Zh()),pg=e=>cg({decode:e=>{let t=Error(e.message);return typeof e.name==`string`&&e.name!==`Error`&&(t.name=e.name),typeof e.stack==`string`&&(t.stack=e.stack),t},encode:t=>{let n={name:t.name,message:t.message};return e?.includeStack&&typeof t.stack==`string`&&(n.stack=t.stack),n}});function mg(){return cg({decode:yr,encode:br})}function hg(e){return cg({decode:_r,encode:e?.onNoneEncoding===null?br:xr})}const gg=new ig(eg(),tg()),_g=sg({decode:e=>hr(lh(e),{onNone:()=>R(new kh(O(e),{message:`Invalid DateTime input`})),onSome:e=>P(dh(e))}),encode:e=>P(ph(e))});function vg(e){return t=>t._tag===e}const yg=vg(`Declaration`),bg=vg(`Never`),xg=vg(`Literal`),Sg=vg(`UniqueSymbol`),Cg=vg(`Arrays`),wg=vg(`Objects`),Tg=vg(`Union`);var Eg=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}};const Dg={};var Og=class{isOptional;isMutable;defaultValue;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.defaultValue=n,this.annotations=r}};const kg=`~effect/Schema`;var Ag=class{[kg]=kg;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},jg=class e extends Ag{_tag=`Declaration`;typeParameters;run;constructor(e,t,n,r,i,a){super(n,r,i,a),this.typeParameters=e,this.run=t}getParser(){let e=this.run(this.typeParameters);return(t,n)=>pr(t)?gp:Km(e(t.value,this,n),O)}recur(t){let n=j_(this.typeParameters,t);return n===this.typeParameters?this:new e(n,this.run,this.annotations,this.checks,void 0,this.context)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}};const Mg=new class extends Ag{_tag=`Null`;getParser(){return Y_(this,null)}getExpected(){return`null`}};var Ng=class extends Ag{_tag=`Undefined`;getParser(){return Y_(this,void 0)}toCodecJson(){return S_(this,[Pg])}getExpected(){return`undefined`}};const Pg=new Eg(Mg,new ig(U(()=>void 0),U(()=>null))),Fg=new Ng,Ig=new class extends Ag{_tag=`Any`;getParser(){return X_(this,De)}getExpected(){return`any`}},Lg=new class extends Ag{_tag=`Unknown`;getParser(){return X_(this,De)}getExpected(){return`unknown`}};var Rg=class extends Ag{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${wt(e)}`);this.literal=e}getParser(){return Y_(this,this.literal)}toCodecJson(){return typeof this.literal==`bigint`?zg(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:zg(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function zg(e){let t=globalThis.String(e.literal);return S_(e,[new Eg(new Rg(t),new ig(U(()=>e.literal),U(()=>t)))])}const Bg=new class extends Ag{_tag=`String`;getParser(){return X_(this,he)}getExpected(){return`string`}};var Vg=class extends Ag{_tag=`Number`;getParser(){return X_(this,ge)}toCodecJson(){return this.checks&&(Hg(this.checks,`isFinite`)||Hg(this.checks,`isInt`))?this:S_(this,[f_])}toCodecStringTree(){return this.checks&&(Hg(this.checks,`isFinite`)||Hg(this.checks,`isInt`))?S_(this,[rv]):S_(this,[iv])}getExpected(){return`number`}};function Hg(e,t){return e.some(e=>{switch(e._tag){case`Filter`:return e.annotations?.meta?._tag===t;case`FilterGroup`:return Hg(e.checks,t)}})}const Ug=new Vg,Wg=new class extends Ag{_tag=`Boolean`;getParser(){return X_(this,_e)}getExpected(){return`boolean`}},Gg=new class extends Ag{_tag=`BigInt`;getParser(){return X_(this,ve)}toCodecStringTree(){return S_(this,[cv])}getExpected(){return`bigint`}};var Kg=class e extends Ag{_tag=`Arrays`;isMutable;elements;rest;constructor(e,t,n,r,i,a,o){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n;let s=t.findIndex(z_);if(s!==-1&&(t.slice(s+1).some(e=>!z_(e))||n.length>1))throw Error(`A required element cannot follow an optional element. ts(1257)`);if(n.length>1&&n.slice(1).some(z_))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e){let t=this,n=t.elements.map(t=>({ast:t,parser:e(t)})),r=t.rest.map(t=>({ast:t,parser:e(t)})),i=n.length;return Zm(function*(e,a){if(e._tag===`None`)return e;let o=e.value;if(!Array.isArray(o))return yield*R(new Oh(t,e));let s=[],c,l=a.errors===`all`,u=0;for(;u<i;u++){let r=n[u],i=u<o.length?O(o[u]):D(),d=r.parser(i,a),f=Ms(d)?d:yield*Op(d);if(f._tag===`Failure`){let n=Iu(f.cause);if(k(n))return yield*f;let r=new wh([u],n.success);if(l)c?c.push(r):c=[r];else return yield*R(new Dh(t,e,[r]))}else if(f.value._tag===`Some`)s[u]=f.value.value;else if(!z_(r.ast)){let n=new wh([u],new Th(r.ast.context?.annotations));if(l)c?c.push(n):c=[n];else return yield*R(new Dh(t,e,[n]))}}let d=o.length;if(t.rest.length>0){let[n,...i]=r,f=n.ast.context?.annotations;for(;u<d-i.length;u++){let r=n.parser(O(o[u]),a),i=Ms(r)?r:yield*Op(r);if(i._tag===`Failure`){let n=Iu(i.cause);if(k(n))return yield*i;let r=new wh([u],n.success);if(l)c?c.push(r):c=[r];else return yield*R(new Dh(t,e,[r]))}else if(i.value._tag===`Some`)s[u]=i.value.value;else{let n=new wh([u],new Th(f));if(l)c?c.push(n):c=[n];else return yield*R(new Dh(t,e,[n]))}}for(let n=0;n<i.length;n++){let r=u+n;if(!(d<r)){let u=i[n],d=u.ast.context?.annotations,f=u.parser(O(o[r]),a),p=Ms(f)?f:yield*Op(f);if(p._tag===`Failure`){let n=Iu(p.cause);if(k(n))return yield*p;let i=new wh([r],n.success);if(l)c?c.push(i):c=[i];else return yield*R(new Dh(t,e,[i]))}else if(p.value._tag===`Some`)s[r]=p.value.value;else{let n=new wh([r],new Th(d));if(l)c?c.push(n):c=[n];else return yield*R(new Dh(t,e,[n]))}}}}else for(let n=i;n<=d-1;n++){let r=new wh([n],new Eh(t,o[n]));if(l)c?c.push(r):c=[r];else return yield*R(new Dh(t,e,[r]))}return c?yield*R(new Dh(t,e,c)):O(s)})}recur(t){let n=j_(this.elements,t),r=j_(this.rest,t);return n===this.elements&&r===this.rest?this:new e(this.isMutable,n,r,this.annotations,this.checks,void 0,this.context)}getExpected(){return`array`}};const qg=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`,Jg=new globalThis.RegExp(`(?:${qg}|Infinity|-Infinity|NaN)`);function Yg(e,t){let n=V_(t);switch(n._tag){case`String`:return Object.keys(e);case`TemplateLiteral`:{let t=K_(n);return Object.keys(e).filter(e=>t.test(e))}case`Symbol`:return Object.getOwnPropertySymbols(e);case`Number`:return Object.keys(e).filter(e=>Jg.test(e));case`Union`:return[...new Set(n.types.flatMap(t=>Yg(e,t)))];default:return[]}}var Xg=class{name;type;constructor(e,t){this.name=e,this.type=t}},Zg=class e{decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}},Qg=class{parameter;type;merge;constructor(e,t,n){if(this.parameter=e,this.type=t,this.merge=n,z_(t)&&!W_(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},$g=class e extends Ag{_tag=`Objects`;propertySignatures;indexSignatures;constructor(e,t,n,r,i,a){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t;let o=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(o.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(o)}. ts(2300)`)}getParser(e){let t=this,n=[],r=new Set,i=[],a=t.propertySignatures.length;for(let a of t.propertySignatures)n.push(a.name),r.add(a.name),i.push({ps:a,parser:e(a.type),name:a.name,type:a.type});let o=t.indexSignatures.length;return t.propertySignatures.length===0&&t.indexSignatures.length===0?X_(t,Ee):Zm(function*(s,c){if(s._tag===`None`)return s;let l=s.value;if(!(typeof l==`object`&&l&&!Array.isArray(l)))return yield*R(new Oh(t,s));let u={},d,f=c.errors===`all`,p=c.onExcessProperty===`error`,m=c.onExcessProperty===`preserve`,h;if(t.indexSignatures.length===0&&(p||m)){h=Reflect.ownKeys(l);for(let e=0;e<h.length;e++){let n=h[e];if(!r.has(n))if(p){let e=new wh([n],new Eh(t,l[n]));if(f){d?d.push(e):d=[e];continue}else return yield*R(new Dh(t,s,[e]))}else Qm(u,n,l[n])}}for(let e=0;e<a;e++){let n=i[e],r=Object.hasOwn(l,n.name)?O(l[n.name]):D(),a=n.parser(r,c),o=Ms(a)?a:yield*Op(a);if(o._tag===`Failure`){let e=Iu(o.cause);if(k(e))return yield*o;let r=new wh([n.name],e.success);if(f){d?d.push(r):d=[r];continue}else return yield*R(new Dh(t,s,[r]))}else if(o.value._tag===`Some`)Qm(u,n.name,o.value.value);else if(!z_(n.type)){let e=new wh([n.name],new Th(n.type.context?.annotations));if(f){d?d.push(e):d=[e];continue}else return yield*R(new Dh(t,s,[e]))}}if(o>0)for(let n=0;n<o;n++){let r=t.indexSignatures[n],i=Yg(l,r.parameter);for(let n=0;n<i.length;n++){let a=i[n],o=e(Q_(r.parameter))(O(a),c),p=Ms(o)?o:yield*Op(o);if(p._tag===`Failure`){let e=Iu(p.cause);if(k(e))return yield*p;let n=new wh([a],e.success);if(f){d?d.push(n):d=[n];continue}return yield*R(new Dh(t,s,[n]))}let m=O(l[a]),h=e(r.type)(m,c),g=Ms(h)?h:yield*Op(h);if(g._tag===`Failure`){let e=Iu(g.cause);if(k(e))return yield*g;let n=new wh([a],e.success);if(f){d?d.push(n):d=[n];continue}else return yield*R(new Dh(t,s,[n]))}else if(p.value._tag===`Some`&&g.value._tag===`Some`){let e=p.value.value,t=g.value.value;if(r.merge&&r.merge.decode&&Object.hasOwn(u,e)){let[n,i]=r.merge.decode.combine([e,u[e]],[e,t]);Qm(u,n,i)}else Qm(u,e,t)}}}if(d)return yield*R(new Dh(t,s,d));if(c.propertyOrder===`original`){let e=(h??Reflect.ownKeys(l)).concat(n),t={};for(let n of e)Object.hasOwn(u,n)&&Qm(t,n,u[n]);return O(t)}return O(u)})}rebuild(t,n){let r=j_(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new Xg(e.name,n)}),i=j_(this.indexSignatures,e=>{let r=t(e.parameter),i=t(e.type),a=n?e.merge?.flip():e.merge;return r===e.parameter&&i===e.type&&a===e.merge?e:new Qg(r,i,a)});return r===this.propertySignatures&&i===this.indexSignatures?this:new e(r,i,this.annotations,this.checks,void 0,this.context)}flip(e){return this.rebuild(e,!0)}recur(e){return this.rebuild(e,!1)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};function e_(e,t,n){return new $g(Reflect.ownKeys(e).map(t=>new Xg(t,e[t].ast)),[],n,t)}function t_(e){return e.ast}function n_(e,t=void 0){return new Kg(!1,e.map(e=>e.ast),[],void 0,t)}function r_(e,t,n){return new u_(e.map(t_),t,void 0,n)}function i_(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:case`Void`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`object`,`array`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(i_)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function a_(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[`~sentinels`];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!z_(t)){if(xg(t))return[{key:e.name,literal:t.literal}];if(Sg(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>xg(e)&&!z_(e)?[{key:t,literal:e.literal}]:[]);case`Suspend`:return a_(e.thunk())}}const o_=new WeakMap;function s_(e){let t=o_.get(e);if(t)return t;t={};for(let n of e){let e=V_(n);if(bg(e))continue;let r=i_(e),i=a_(e);t.byType??={};for(let e of r)(t.byType[e]??=[]).push(n);if(i.length>0){t.bySentinel??=new Map;for(let{key:e,literal:r}of i){let i=t.bySentinel.get(e);i||t.bySentinel.set(e,i=new Map);let a=i.get(r);a||i.set(r,a=[]),a.push(n)}}else{t.otherwise??={};for(let e of r)(t.otherwise[e]??=[]).push(n)}}return o_.set(e,t),t}function c_(e){return t=>{let n=V_(t);return n._tag===`Literal`?n.literal===e:n._tag===`UniqueSymbol`?n.symbol===e:!0}}function l_(e,t){let n=s_(t),r=e===null?`null`:Array.isArray(e)?`array`:typeof e;if(n.bySentinel){let t=n.otherwise?.[r]??[];if(r===`object`||r===`array`){for(let[r,i]of n.bySentinel)if(Object.hasOwn(e,r)){let n=i.get(e[r]);if(n)return[...n,...t].filter(c_(e))}}return t}return(n.byType?.[r]??[]).filter(c_(e))}var u_=class e extends Ag{_tag=`Union`;types;mode;constructor(e,t,n,r,i,a){super(n,r,i,a),this.types=e,this.mode=t}getParser(e){let t=this;return Zm(function*(n,r){if(n._tag===`None`)return n;let i=n.value,a=t.mode===`oneOf`,o=l_(i,t.types),s,c={out:void 0,successes:[]};for(let l=0;l<o.length;l++){let u=o[l],d=e(u)(n,r),f=Ms(d)?d:yield*Op(d);if(f._tag===`Failure`){let e=Iu(f.cause);if(k(e))return yield*f;s?s.push(e.success):s=[e.success];continue}else{if(c.out&&a)return c.successes.push(u),yield*R(new jh(t,i,c.successes));if(c.out=f.value,c.successes.push(u),!a)break}}return c.out?c.out:yield*R(new Ah(t,i,s??[]))})}recur(t){let n=j_(this.types,t);return n===this.types?this:new e(n,this.mode,this.annotations,this.checks,void 0,this.context)}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=V_(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(xg);if(t.length>0)return`${p_(n.isMutable)}[ ${t.map(t=>e(t)+m_(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>xg(e.type));if(t.length>0)return`{ ${t.map(t=>`${p_(t.type.context?.isMutable)}${Et(t.name)}${m_(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};const d_=new u_([new Rg(`Infinity`),new Rg(`-Infinity`),new Rg(`NaN`)],`anyOf`),f_=new Eg(new u_([Ug,d_],`anyOf`),new ig(Qh(),U(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function p_(e){return e?``:`readonly `}function m_(e){return e?`?`:``}function h_(e){let t=!1,n;return()=>t?n:(n=e(),t=!0,n)}var g_=class e extends Ag{_tag=`Suspend`;thunk;constructor(e,t,n,r,i){super(t,n,r,i),this.thunk=h_(e)}getParser(e){return e(this.thunk())}recur(t){return new e(()=>t(this.thunk()),this.annotations,this.checks,void 0,this.context)}getExpected(e){return e(this.thunk())}},__=class e extends re{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new v_([this,e],t)}},v_=class e extends re{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function y_(e,t,n=!1){return new __((t,n,r)=>Mh(t,e(t,n,r)),t,n)}function b_(e,t){let n=e.source;return y_(t=>e.test(t),{expected:`a string matching the RegExp ${n}`,meta:{_tag:`isPattern`,regExp:e},toArbitraryConstraint:{string:{patterns:[e.source]}},...t})}function x_(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function S_(e,t){return e.encoding===t?e:x_(e,e=>{e.encoding.value=t})}function C_(e,t){return e.context===t?e:x_(e,e=>{e.context.value=t})}function w_(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return T_(e,Wr(e.checks.slice(0,-1),n.annotate(t)))}return x_(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function T_(e,t){return e.checks===t?e:x_(e,e=>{e.checks.value=t})}function E_(e,t){return T_(e,e.checks?[...e.checks,...t]:t)}function D_(e,t){let n=e,r=n[n.length-1],i=t(r.to);return i===r.to?e:Wr(e.slice(0,e.length-1),new Eg(i,r.transformation))}function O_(e){return t=>t.encoding?S_(t,D_(t.encoding,e)):t}function k_(e,t,n){let r=new Eg(e,t);return S_(n,n.encoding?[...n.encoding,r]:[r])}function A_(e,t){let n=nh(e);return w_(e,{brands:n?[...n,t]:[t]})}function j_(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function M_(e,t){return C_(e,e.context?new Og(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new Og(!1,!1,void 0,t))}const N_=O_(P_);function P_(e){return N_(C_(e,e.context?e.context.isOptional===!1?new Og(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new Og(!0,!1)))}function F_(e,t){let n=[new Eg(Lg,new ig(new Wh(e=>{if(pr(Er(e,Ce))){let n=t(e);return up(n)?n:P(n)}else return P(e)}),qh()))];return C_(e,e.context?new Og(e.context.isOptional,e.context.isMutable,n,e.context.annotations):new Og(!1,!1,n))}function I_(e,t,n){return k_(e,n,t)}function L_(e){switch(e._tag){case`Literal`:return{literals:be(e.literal)?[e.literal]:[],parameters:[]};case`UniqueSymbol`:return{literals:[e.symbol],parameters:[]};case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return{literals:[],parameters:[e]};case`Union`:{let t={literals:[],parameters:[]};for(let n=0;n<e.types.length;n++){let r=L_(e.types[n]);t.literals=t.literals.concat(r.literals),t.parameters=t.parameters.concat(r.parameters)}return t}}return{literals:[],parameters:[]}}function R_(e,t,n){let{literals:r,parameters:i}=L_(e);return new $g(r.map(e=>new Xg(e,t)),i.map(e=>new Qg(e,t,n)))}function z_(e){return e.context?.isOptional??!1}const B_=fe(e=>{if(e.encoding)return B_(S_(e,void 0));let t=e;return t.recur?.(B_)??t}),V_=fe(e=>B_(U_(e)));function H_(e,t){let n=t,r=n.length,i=n[r-1],a=[new Eg(U_(S_(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new Eg(U_(n[e-1].to),n[e].transformation.flip()));let o=U_(i.to);return o.encoding?S_(o,[...o.encoding,...a]):S_(o,a)}const U_=fe(e=>{if(e.encoding)return H_(e,e.encoding);let t=e;return t.flip?.(U_)??t.recur?.(U_)??t});function W_(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(W_);default:return!1}}function G_(e,t){return e.encodedParts.map(e=>J_(e,q_(e),t)).join(``)}const K_=fe(e=>new globalThis.RegExp(`^${G_(e,!0)}$`));function q_(e){switch(e._tag){case`Literal`:return ih(globalThis.String(e.literal));case`String`:return $_;case`Number`:return qg;case`BigInt`:return av;case`TemplateLiteral`:return G_(e,!1);case`Union`:return e.types.map(q_).join(`|`)}}function J_(e,t,n){if(Tg(e)){if(!n)return`(?:${t})`}else if(!n)return t;return`(${t})`}function Y_(e,t){let n=_p(t);return r=>r._tag===`None`?gp:r.value===t?n:R(new Oh(e,r))}function X_(e,t){return n=>n._tag===`None`?gp:t(n.value)?P(n):R(new Oh(e,n))}function Z_(e){function t(n){return n.encoding?S_(n,D_(n.encoding,t)):e(n)}return fe(t)}const Q_=Z_(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(Q_)}}),$_=`[\\s\\S]*?`,ev=new globalThis.RegExp(`^${qg}$`);function tv(e){return b_(ev,{expected:`a string representing a finite number`,meta:{_tag:`isStringFinite`,regExp:ev},...e})}const nv=E_(Bg,[tv()]),rv=new Eg(nv,dg),iv=new Eg(new u_([nv,d_],`anyOf`),dg),av=`-?\\d+`,ov=new globalThis.RegExp(`^${av}$`);function sv(e){return b_(ov,{expected:`a string representing a bigint`,meta:{_tag:`isStringBigInt`,regExp:ov},...e})}const cv=new Eg(E_(Bg,[sv()]),fg);function lv(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`)lv(o.checks,t,n,r,i);else{let e=o.run(t,r,i);if(e&&(n.push(new Sh(t,o,e)),o.aborted||i?.errors!==`all`))return}}}const uv=`~effect/Schema/Class`;function dv(e){let t=new Set;return n(e);function n(e){return e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?globalThis.Number.isFinite(e):typeof e!=`object`||e===void 0||t.has(e)?!1:(t.add(e),Array.isArray(e)?e.every(n):Object.keys(e).every(t=>n(e[t])))}}const fv=new jg([],()=>(e,t)=>dv(e)?P(e):R(new Oh(t,O(e))),{typeConstructor:{_tag:`effect/Json`},generation:{runtime:`Schema.Json`,Type:`Schema.Json`},expected:`JSON value`,toCodecJson:()=>new Eg(Lg,ug())}),pv=new Eg(Mg,new ig(qh(),U(()=>null))),mv=new Eg(fv,ug());function hv(e){let t=new Set;return n(e);function n(e){return e===void 0||typeof e==`string`?!0:typeof e!=`object`||!e||t.has(e)?!1:(t.add(e),Array.isArray(e)?e.every(n):Object.keys(e).every(t=>n(e[t])))}}const gv=new Eg(new jg([],()=>(e,t)=>hv(e)?P(e):R(new Oh(t,O(e))),{expected:`StringTree`,toCodecStringTree:()=>new Eg(Lg,ug())}),ug());function _v(){return Object.assign(e=>e,{option:e=>O(e),result:e=>Or(e),is:e=>!0})}const vv=`~effect/collections/MutableHashMap`,yv={[vv]:vv,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${wt(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:Mt(Array.from(this))}},[jt](){return this.toJSON()},pipe(){return y(this,arguments)}},bv=()=>{let e=Object.create(yv);return e.backing=new Map,e.buckets=new Map,e},xv=b(2,(e,t)=>{if(e.backing.has(t))return O(e.backing.get(t));if(Cv(t))return D();let n=Sv.get(e);if(n!==void 0)return e.backing.has(n)?O(e.backing.get(n)):D();let r=C(t),i=e.buckets.get(r);return i===void 0?D():Tv(e,i,t)}),Sv=new WeakMap,Cv=e=>typeof e!=`object`&&typeof e!=`function`,wv=e=>e.backing.values(),Tv=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(Xe(n,t[r])){let i=t[r];return Sv.set(n,i),O(e.backing.get(i))}return D()},Ev=b(2,(e,t)=>mr(xv(e,t))),Dv=b(3,(e,t,n)=>{if(e.backing.has(t)||Cv(t))return e.backing.set(t,n),e;let r=Sv.get(e);if(r!==void 0&&e.backing.has(r))return e.backing.set(r,n),e;let i=C(t),a=e.buckets.get(i);return a===void 0?(e.buckets.set(i,[t]),e.backing.set(t,n),e):(r=Ov(a,t),r===void 0&&(a.push(t),r=t),e.backing.set(r,n),e)}),Ov=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(Xe(t,e[n]))return Sv.set(t,e[n]),e[n]},kv=b(2,(e,t)=>{if(Cv(t))return e.backing.delete(t),e;let n=Sv.get(e)??t,r=C(n),i=e.buckets.get(r);if(i===void 0)return e;for(let t=0,r=i.length;t<r;t++){let r=i[t];if(r===n||Xe(n,r)){e.backing.delete(r),i.splice(t,1);break}}return i.length===0&&e.buckets.delete(r),e}),Av=Uo,jv=Go,Mv=Ko,Nv=qo,Pv=Yo,Fv=zo,Iv=Ol,Lv=Ul,Rv=Symbol.for(`effect/MutableList/Empty`),zv=()=>({head:void 0,tail:void 0,length:0}),Bv=()=>({array:[],mutable:!0,offset:0,next:void 0}),Vv=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=Bv(),e.tail=e.tail.next):e.head=e.tail=Bv(),e.tail.array.push(t),e.length++},Hv=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.length++},Uv=e=>{e.head=e.tail=void 0,e.length=0},Wv=(e,t)=>{if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let t=e.head.array;return Uv(e),t}let n=Array(t),r=0,i=e.head;for(;i;){for(;i.offset<i.array.length;)if(n[r++]=i.array[i.offset],i.mutable&&(i.array[i.offset]=void 0),i.offset++,r===t)return e.head=i,e.length-=t,e.length===0&&Uv(e),n;i=i.next}return Uv(e),n},Gv=e=>Wv(e,e.length),Kv=e=>{if(!e.head)return Rv;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length&&(e.head.next?e.head=e.head.next:Uv(e)),t},qv=(e,t)=>{let n=[],r=e.head;for(;r;){for(let e=r.offset;e<r.array.length;e++)t(r.array[e],e)&&n.push(r.array[e]);r=r.next}e.head=e.tail={array:n,mutable:!0,offset:0,next:void 0}},Jv=(e,t)=>qv(e,e=>e!==t),Yv=`~effect/MutableRef`,Xv={[Yv]:Yv,...Xt,toJSON(){return{_id:`MutableRef`,current:Mt(this.current)}}},Zv=e=>{let t=Object.create(Xv);return t.current=e,t},Qv=b(2,(e,t)=>(e.current=t,e)),$v=e=>F(()=>gy(e.atomicPubSub(),new Map,gd(),Lv(!1),Zv(!1),e.strategy())),ey=e=>$v({atomicPubSub:()=>ty(e),strategy:()=>new _y}),ty=e=>new fy(e?.replay?new by(e.replay):void 0),ny=b(2,(e,t)=>vp(()=>e.shutdownFlag.current?pm:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),P(!0)):e.strategy.handleSurplus(e.pubsub,e.subscribers,[t],e.shutdownFlag))),ry=b(2,(e,t)=>e.shutdownFlag.current?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),iy=e=>cm(F(()=>dy(e.pubsub,e.subscribers,e.strategy)),ay),ay=e=>hm(wp(t=>(Qv(e.shutdownFlag,!0),fp(Gv(e.pollers),e=>ld(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(Dp(()=>F(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),Yp(e.shutdownHook.open),Ap)))),oy=e=>vp(function t(n){if(e.shutdownFlag.current)return pm;let r=e.pollers.length===0?e.subscription.pollUpTo(1/0):[];return n&&(r=n.concat(r)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?P(e.replayWindow.takeAll().concat(r)):Jr(r)?P(r):z(sy(e),e=>t([e]))}),sy=e=>{let t=nd(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),Vv(e.pollers,t),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),mm(id(t),()=>(Jv(e.pollers,t),I))},cy=Symbol.for(`effect/PubSub/AbsentValue`),ly=(e,t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},uy=(e,t,n)=>{if(!e.has(t))return;let r=e.get(t);r.delete(n),r.size===0&&e.delete(t)},dy=(e,t,n)=>new my(e,t,e.subscribe(),zv(),Lv(!1),Zv(!1),n,e.replayWindow());var fy=class{publisherHead={value:cy,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=2**53-1;replayBuffer;constructor(e){this.replayBuffer=e}replayWindow(){return this.replayBuffer?new xy(this.replayBuffer):Sy}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(e){let t=this.publisherTail.subscribers;return t!==0&&(this.publisherTail.next={value:e,subscribers:t,next:null},this.publisherTail=this.publisherTail.next,this.publisherIndex+=1),this.replayBuffer&&this.replayBuffer.offer(e),!0}publishAll(e){if(this.publisherTail.subscribers!==0)for(let t of e)this.publish(t);else this.replayBuffer&&this.replayBuffer.offerAll(e);return[]}slide(){this.publisherHead!==this.publisherTail&&(this.publisherHead=this.publisherHead.next,this.publisherHead.value=cy,this.subscribersIndex+=1),this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.publisherTail.subscribers+=1,new py(this,this.publisherTail,this.publisherIndex,!1)}},py=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(e,t,n,r){this.self=e,this.subscriberHead=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){if(this.unsubscribed)return!0;let e=!0,t=!0;for(;t;)this.subscriberHead===this.self.publisherTail?t=!1:this.subscriberHead.next.value===cy?(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1):(e=!1,t=!1);return e}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return Rv;let e=!0,t=Rv;for(;e;)if(this.subscriberHead===this.self.publisherTail)e=!1;else{let n=this.subscriberHead.next.value;n!==cy&&(t=n,--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=cy,this.self.subscribersIndex+=1),e=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return t}pollUpTo(e){let t=[],n=0;for(;n!==e;){let r=this.poll();r===Rv?n=e:(t.push(r),n+=1)}return t}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,--this.self.publisherTail.subscribers;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==cy&&(--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=cy,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},my=class{"~effect/PubSub/Subscription"={_A:x};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;constructor(e,t,n,r,i,a,o,s){this.pubsub=e,this.subscribers=t,this.subscription=n,this.pollers=r,this.shutdownHook=i,this.shutdownFlag=a,this.strategy=o,this.replayWindow=s}pipe(){return y(this,arguments)}},hy=class{"~effect/PubSub"={_A:x};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;constructor(e,t,n,r,i,a){this.pubsub=e,this.subscribers=t,this.scope=n,this.shutdownHook=r,this.shutdownFlag=i,this.strategy=a}pipe(){return y(this,arguments)}};const gy=(e,t,n,r,i,a)=>new hy(e,t,n,r,i,a);var _y=class{get shutdown(){return I}handleSurplus(e,t,n,r){return P(!1)}onPubSubEmptySpaceUnsafe(e,t){}completePollersUnsafe(e,t,n,r){return vy(this,e,t,n,r)}completeSubscribersUnsafe(e,t){return yy(this,e,t)}};const vy=(e,t,n,r,i)=>{let a=!0;for(;a&&!r.isEmpty();){let o=Kv(i);if(o===Rv)uy(n,r,i),i.length===0?a=!1:ly(n,r,i);else{let a=r.poll();a===Rv?Hv(i,o):(pd(o,Ju(a)),e.onPubSubEmptySpaceUnsafe(t,n))}}},yy=(e,t,n)=>{for(let[r,i]of n)for(let a of i)e.completePollersUnsafe(t,n,r,a)};var by=class{capacity;head={value:cy,next:null};tail=this.head;size=0;index=0;constructor(e){this.capacity=e}slide(){this.index++}offer(e){this.tail.value=e,this.tail.next={value:cy,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1}offerAll(e){for(let t of e)this.offer(t)}},xy=class{head;index;remaining;buffer;constructor(e){this.buffer=e,this.index=e.index,this.remaining=e.size,this.head=e.head}fastForward(){for(;this.index<this.buffer.index;)this.head=this.head.next,this.index++}take(){if(this.remaining===0)return;this.index<this.buffer.index&&this.fastForward(),this.remaining--;let e=this.head.value;return this.head=this.head.next,e}takeN(e){if(this.remaining===0)return[];this.index<this.buffer.index&&this.fastForward();let t=Math.min(e,this.remaining),n=Array(t);for(let e=0;e<t;e++){let t=this.head.value;this.head=this.head.next,n[e]=t}return this.remaining-=t,n}takeAll(){return this.takeN(this.remaining)}};const Sy={remaining:0,take:()=>void 0,takeN:()=>[],takeAll:()=>[]},Cy={_A:x,_E:x},wy={"~effect/Queue":Cy,"~effect/Queue/Enqueue":Cy,"~effect/Queue/Dequeue":Cy,...Xt,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:zy(this)}}},Ty=e=>E(t=>{let n=Object.create(wy);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=zv(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},j(n)}),Ey=e=>Ty({capacity:e}),Dy=()=>Ty(),Oy=(e,t)=>$o(()=>{if(e.state._tag!==`Open`)return Vy;if(e.messages.length>=e.capacity)switch(e.strategy){case`dropping`:return Vy;case`suspend`:return e.capacity<=0&&e.state.takers.size>0?(Vv(e.messages,t),Gy(e),Hy):Jy(e,t);case`sliding`:return Kv(e.messages),Vv(e.messages,t),Hy}return Vv(e.messages,t),Ky(e),Hy}),ky=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(Kv(e.messages),Vv(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(Vv(e.messages,t),Gy(e),!0):!1:(Vv(e.messages,t),Ky(e),!0):!1,Ay=b(2,(e,t)=>Qo(()=>jy(e,t))),jy=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=Js(Dn(t),Uy);return e.state.offers.size===0&&e.messages.length===0?(Zy(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},!0)},My=e=>Ay(e,mn(Rn())),Ny=e=>jy(e,mn(Rn())),Py=e=>Qo(()=>{if(e.state._tag===`Done`)return!0;Uv(e.messages);let t=e.state.offers;if(Zy(e,e.state._tag===`Open`?Wy:e.state.exit),t.size>0){for(let e of t)e._tag===`Single`?e.resume(Vy):e.resume(T(e.remaining.slice(e.offset)));t.clear()}return!0}),Fy=e=>Iy(e,1,1/0),Iy=(e,t,n)=>$o(()=>qy(e,t,n)??Es(Xy(e),Iy(e,1,n))),Ly=e=>$o(()=>Ry(e)??Es(Xy(e),Ly(e))),Ry=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=Kv(e.messages);return Yy(e),T(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Yy(e),e.capacity=0;let t=Kv(e.messages);return Yy(e),T(t)}},zy=e=>e.state._tag===`Done`?0:e.messages.length,By=b(2,(e,t)=>gl(n=>Ec(n(e),{onFailure:e=>Ay(t,e),onSuccess:e=>My(t)}))),Vy=T(!1),Hy=T(!0),Uy=On(Rn()),Wy=Bs(),Gy=e=>{if(e.scheduleRunning=!1,!(e.state._tag===`Done`||e.state.takers.size===0)){for(let t of e.state.takers)if(e.state.takers.delete(t),t(Ws),e.messages.length===0)break}},Ky=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>Gy(e),0))},qy=(e,t,n)=>{if(e.state._tag===`Done`)return e.state.exit;if(n<=0||t<=0)return T([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Yy(e),e.capacity=0;let t=[Kv(e.messages)];return Yy(e),T(t)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let t=Wv(e.messages,n);return Yy(e),T(t)}},Jy=(e,t)=>ps(n=>{if(e.state._tag!==`Open`)return n(Vy);let r={_tag:`Single`,message:t,resume:n};return e.state.offers.add(r),Qo(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),Yy=e=>{if(e.state._tag===`Done`)return Nf(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0?(Zy(e,e.state.exit),Nf(e.state.exit.cause)):!1;let t=e.capacity-e.messages.length;for(let n of e.state.offers)if(t===0)break;else if(n._tag===`Single`)Vv(e.messages,n.message),t--,n.resume(Hy),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;Vv(e.messages,n.remaining[n.offset]),t--}n.resume(T([])),e.state.offers.delete(n)}return!1},Xy=e=>ps(t=>e.state._tag===`Done`?t(e.state.exit):(e.state.takers.add(t),Qo(()=>{e.state._tag!==`Done`&&e.state.takers.delete(t)}))),Zy=(e,t)=>{if(e.state._tag===`Done`)return;let n=e.state;e.state={_tag:`Done`,exit:t};for(let e of n.takers)e(t);n.takers.clear();for(let e of n.awaiters)e(t);n.awaiters.clear()},Qy=e=>new $y(e);var $y=class{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=$o(()=>this.free<e?ps(n=>{if(this.free>=e)return n(t);let r=()=>{this.free<e||(this.waiters.delete(r),n(t))};return this.waiters.add(r),Qo(()=>{this.waiters.delete(r)})}):(this.taken+=e,j(e)));return t}updateTakenUnsafe(e,t){return this.taken=t(this.taken),this.waiters.size>0&&e.currentDispatcher.scheduleTask(()=>{let e=this.waiters.values(),t=e.next();for(;t.done===!1&&this.free>0;)t.value(),t=e.next()},0),this.free}updateTaken(e){return E(t=>j(this.updateTakenUnsafe(t,e)))}resize(e){return E(t=>(this.permits=e,this.free<0||this.updateTakenUnsafe(t,e=>e),as))}release(e){return this.updateTaken(t=>t-e)}get releaseAll(){return this.updateTaken(e=>0)}withPermits(e){return t=>gl(n=>M(n(this.take(e)),e=>rl(n(t),()=>{this.updateTakenUnsafe(zo(),t=>t-e)},!0)))}get withPermit(){return this.withPermits(1)}withPermitsIfAvailable(e){return t=>gl(n=>this.free<e?ns:(this.taken+=e,rl(n(Ts(t)),()=>{this.updateTakenUnsafe(zo(),t=>t-e)},!0)))}};const eb=`~effect/Channel`,tb=e=>S(e,eb),nb={[eb]:{_Env:x,_InErr:x,_InElem:x,_OutErr:x,_OutElem:x},pipe(){return y(this,arguments)}},rb=e=>{let t=Object.create(nb);return t.transform=(t,n)=>V(e(t,n),e=>P(xp(e))),t},ib=(e,t)=>rb((n,r)=>z(sb(e)(n,r),e=>t(e,r))),ab=e=>rb((t,n)=>e),ob=e=>rb(Rm(function*(t,n){let r=xd(n),i=e=>Sd(r,Rf(e));return dm(yield*dm(e(t,n,r),i),i)})),sb=e=>e.transform,cb=(e,t,n)=>Ty({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(Dp(t=>yd(e,Py(t))),Dp(n=>Sm(_d(t(n),e),e))),lb=(e,t)=>rb((n,r)=>B(cb(r,e,t),Fy)),ub=e=>rb((t,n)=>vp(()=>sb(e())(t,n))),db=ab(P(Wu())),fb=e=>ab(P(R(e))),pb=e=>ab(xp(e)),mb=e=>pb(Mu(e)),hb=e=>ab(z(e,()=>Wu())),gb=e=>ab(P(Fy(e))),_b=e=>ab(P(mm(oy(e),()=>Wu()))),vb=e=>Rb(B(iy(e),_b)),yb=b(2,(e,t)=>ib(e,e=>F(()=>{let n=0;return B(e,e=>t(e,n++))}))),bb=b(2,(e,t)=>xb(e,e=>P(t(e)))),xb=b(2,(e,t)=>ib(e,e=>P(Mf(e,e=>z(t(e),Wu))))),Sb=e=>e===void 0||e!==`unbounded`&&e<=1,Cb=b(e=>tb(e[0]),(e,t,n)=>Sb(n?.concurrency)?wb(e,t):Tb(e,t,n)),wb=(e,t)=>rb((n,r)=>{let i=0;return B(sb(e)(n,r),z(e=>t(e,i++)))}),Tb=(e,t,n)=>ob(Rm(function*(r,i,a){let o=0,s=yield*sb(e)(r,i),c=n.concurrency===`unbounded`?2**53-1:n.concurrency,l=yield*Ey(0);yield*yd(a,Py(l));let u=Dm(yield*Qp()),d=Iv(a);if(n.unordered){let e=Qy(c),n=ie(e.release(1)),r=Xp({onFailure:e=>z(Ay(l,e),n),onSuccess:e=>z(Oy(l,e),n)});yield*e.take(1).pipe(z(()=>s),z(e=>(d(u(r(t(e,o++)))),I)),_m({disableYield:!0}),V(t=>e.withPermits(c-1)(Ay(l,t))),Sm(a))}else{let e=yield*Ey(c-2);yield*yd(a,Py(l)),yield*Ly(e).pipe(Tp,z(e=>Oy(l,e)),_m({disableYield:!0}),V(e=>Ay(l,e)),Sm(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,jy(l,e.cause))};yield*s.pipe(z(i=>{if(n)return xp(n);let a=u(t(i,o++));return d(a),a.addObserver(r),Oy(e,jv(a))}),_m({disableYield:!0}),V(t=>Oy(e,Yu(t)).pipe(Ep(Ay(e,t)))),Sm(a))}return Ly(l)})),Eb=e=>ib(e,e=>{let t,n=0;return P(vp(function r(){if(t===void 0)return z(e,e=>{switch(e.length){case 0:return r();case 1:return P(e[0]);default:return t=e,P(e[n++])}});let i=t[n++];return n>=t.length&&(t=void 0,n=0),P(i)}))}),Db=b(2,(e,t)=>ib(e,e=>P(z(e,function n(r){let i=[];for(let e=0;e<r.length;e++)t(r[e])&&i.push(r[e]);return Yr(i)?P(i):z(e,n)})))),Ob=b(e=>tb(e[0]),(e,t,n,r)=>rb((i,a)=>B(sb(e)(i,a),e=>{let i=t(),a,o=0,s,c=Xp(e,{onFailure(e){s=e;let t=r?.onHalt&&r.onHalt(i);return t&&t.length>0?P([i,t]):xp(e)},onSuccess(e){let t=n(i,e);return Kr(t)?P(t):t}});return vp(function e(){if(a===void 0)return s?xp(s):z(c,([t,n])=>(i=t,n.length===0?e():n.length===1?P(n[0]):(a=n,e())));let t=a[o++];return o>=a.length&&(a=void 0,o=0),P(t)})}))),kb=b(2,(e,t)=>rb((n,r)=>{let i=xd(r);return B(sb(e)(n,i),e=>{let a=e.pipe(V(e=>{if(Nf(e))return xp(e);let o=i;return i=xd(r),Sd(o,Yu(e)).pipe(Ep(sb(t(e))(n,i)),z(e=>(a=e,e)))}));return vp(()=>a)})})),Ab=b(2,(e,t)=>kb(e,e=>hb(z(t(e),t=>xp(e))))),jb=b(3,(e,t,n)=>kb(e,e=>{let r=t(e);return k(r)?pb(r.failure):n(r.success,e)})),Mb=b(2,(e,t)=>jb(e,Iu,e=>t(e))),Nb=b(2,(e,t)=>Mb(e,e=>fb(t(e)))),Pb=e=>Mb(e,mb),Fb=b(e=>tb(e[0])&&tb(e[1]),(e,t,n)=>ob(Rm(function*(r,i,a){let o=n?.haltStrategy??`both`,s=yield*Ey(0);yield*yd(a,Py(s));let c=0;function l(e,t){if(c++,!Nf(t))return Ay(s,t);switch(o){case`both`:return c===2?Ay(s,t):I;case`left`:case`right`:return e===o?Ay(s,t):I;case`either`:return Ay(s,t)}}let u=(e,t,n)=>sb(t)(r,n).pipe(z(e=>e.pipe(z(e=>Oy(s,e)),_m)),dm(t=>Ep(Sd(n,Rf(t)),l(e,t))),Sm(a));return yield*u(`left`,e,xd(a)),yield*u(`right`,t,xd(a)),Ly(s)}))),Ib=()=>rb((e,t)=>F(()=>{let t=``,n=!1,r=e=>{let r=[];for(let i=0;i<e.length;i++){let a=e[i];if(a.length!==0){let e=0,i=a.indexOf(`\r`),o=a.indexOf(`
11
+ `)},Oo=(e,t)=>{let n=t?.get(wn.key);return n&&(e=`${e}\n${Ao(n)}`),e},ko=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(Tn.key);n.push(` at fiber (${t})`),r&&n.push(Ao(r))}return n.join(`
12
+ `)},Ao=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(Eo),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
13
+ `)},jo=e=>Co(e).map(e=>e.cause?`${e.stack} {\n${Mo(e.cause,` `)}\n}`:e.stack).join(`
14
+ `),Mo=(e,t)=>{let n=e.stack.split(`
15
+ `),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${Mo(e.cause,`${t} `)}\n${t}}`),r},No=`~effect/Fiber/dev`,Po={_A:x,_E:x},Fo={id:0},Io=()=>globalThis[xt];var Lo=class{constructor(e,t=!0){this[No]=Po,this.setServices(e),this.id=++Fo.id,this.currentOpCount=0,this.currentLoopCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0}[No];id;interruptible;currentOpCount;currentLoopCount;_stack;_observers;_exit;_currentExit;_children;_interruptedCause;_yielded;services;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return Ea(this.services,e)}addObserver(e){return this._exit?(e(this._exit),le):(this._observers.push(e),()=>{let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)})}interruptUnsafe(e,t){if(this._exit)return;let n=fo(e);this.currentStackFrame&&(n=gn(n,xa(wn,this.currentStackFrame))),t&&(n=gn(n,t)),this._interruptedCause=this._interruptedCause?bo(this._interruptedCause,n):n,this.interruptible&&this.evaluate(qo(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this.runtimeMetrics?.recordFiberStart(this.services),this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===Jt)return;let n=Ro.interruptChildren&&Ro.interruptChildren(this);if(n!==void 0)return this.evaluate(N(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.services,this._exit);for(let e=0;e<this._observers.length;e++)this._observers[e](t);this._observers.length=0}runLoop(e){let t=globalThis[xt];globalThis[xt]=this;let n=!1,r=e;this.currentOpCount=0;let i=++this.currentLoopCount;try{for(;;){if(this.currentOpCount++,!n&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){n=!0;let e=r;r=N(Xo,()=>e)}if(r=this.currentTracerContext?this.currentTracerContext(r,this):r[Wt](this),i!==this.currentLoopCount)return Jt;if(r===Jt){let e=this._yielded;return Vt in e?(this._yielded=void 0,e):Jt}}}catch(e){return S(r,Wt)?this.runLoop(On(e)):On(`Fiber.runLoop: Not a valid effect: ${String(r)}`)}finally{globalThis[xt]=t}}getCont(e){for(;;){let t=this._stack.pop();if(!t)return;let n=t[qt]&&t[qt](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,Jt}children(){return this._children??=new Set}pipe(){return y(this,arguments)}setServices(e){this.services=e;let t=this.getRef(Pa);t!==this.currentScheduler&&(this.currentScheduler=t,this._dispatcher=void 0),this.currentSpan=e.mapUnsafe.get(Va),this.currentLogLevel=this.getRef(io),this.minimumLogLevel=this.getRef(ao),this.currentStackFrame=e.mapUnsafe.get(Qa.key),this.maxOpsBeforeYield=this.getRef(za),this.currentPreventYield=this.getRef(Ba),this.runtimeMetrics=e.mapUnsafe.get(`effect/observability/Metric/FiberRuntimeMetricsKey`);let n=e.mapUnsafe.get(qa);this.currentTracerContext=n?n.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag===`Span`?this.currentSpan:void 0}};const Ro={interruptChildren:void 0},zo=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(wn.key,e.currentStackFrame),ha(t)},Bo=e=>{let t=e;return t._exit?j(t._exit):ls(n=>t._exit?n(j(t._exit)):Yo(e.addObserver(e=>n(j(e)))))},Vo=e=>ls(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(j(r))}return a(),Yo(()=>i?.())}),Ho=e=>{let t=e;return t._exit?t._exit:ls(n=>t._exit?n(t._exit):Yo(e.addObserver(n)))},Uo=e=>ls(t=>{let n=Array.from(e);if(n.length===0)return t(j(ai()));let r=Array(n.length),i=ai(),a=0,o=!1;for(let e=0;e<n.length&&!o;e++)i.push(n[e].addObserver(s=>{if(a++,s._tag===`Failure`)return o=!0,i.forEach(e=>e()),t(s);r[e]=s.value,a===n.length&&t(j(r))}))}),Wo=e=>E(t=>Go(e,t.id)),Go=b(e=>S(e[0],No),(e,t,n)=>E(r=>{let i=zo(r);return i=i&&n?Aa(i,n):i??n,e.interruptUnsafe(t,i),ws(Bo(e))})),Ko=e=>E(t=>{let n=zo(t);for(let r of e)r.interruptUnsafe(t.id,n);return ws(Vo(e))}),j=T,qo=En,Jo=Dn,Yo=Sn({op:`Sync`,[Wt](e){let t=this[w](),n=e.getCont(Gt);return n?n[Gt](t,e):e.yieldWith(T(t))}}),M=Sn({op:`Suspend`,[Wt](e){return this[w]()}}),Xo=Sn({op:`Yield`,[Wt](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Bs)},this[w]??0),e.yieldWith(()=>{t=!0})}})(0),Zo=e=>j(O(e)),Qo=j(D()),$o=e=>On(e),es=e=>M(()=>Jo(zt(e))),ts=j(void 0),ns=e=>M(()=>{try{return j(zt(e.try))}catch(t){return Jo(zt(()=>e.catch(t)))}}),rs=e=>ss(function(t,n){zt(()=>e(n)).then(e=>t(j(e)),e=>t($o(e)))},e.length!==0),is=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new lu(e,`An error occurred in Effect.tryPromise`):e.catch;return ss(function(e,r){try{zt(()=>t(r)).then(t=>e(j(t)),t=>e(Jo(zt(()=>n(t)))))}catch(t){e(Jo(zt(()=>n(t))))}},eval.length!==0)},as=e=>E(t=>e(t.id)),os=as(j),ss=Sn({op:`Async`,single:!1,[Wt](e){let t=zt(()=>this[w][0].bind(e.currentScheduler)),n=!1,r=!1,i=this[w][1]?new AbortController:void 0,a=t(t=>{n||(n=!0,r?e.evaluate(t):r=t)},i?.signal);return r===!1?(r=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(cs(()=>(n=!0,i?.abort(),a??Bs))),Jt):r}}),cs=Sn({op:`AsyncFinalizer`,[qt](e){e.interruptible&&(e.interruptible=!1,e._stack.push(cl))},[Kt](e,t){return _o(e)?N(this[w](),()=>qo(e)):qo(e)}}),ls=e=>ss(e,e.length>=2),us=ls(le),ds=(...e)=>M(()=>ys(e.length===1?e[0]():e[1].call(e[0].self))),fs=(e,...t)=>{let n=t.length===0?function(){return M(()=>ys(e.apply(this,arguments)))}:function(){let n=M(()=>ys(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return ps(e.length,n)},ps=(e,t)=>Object.defineProperty(t,`length`,{value:e,configurable:!0}),ms=co(2),hs=function(){let e=typeof arguments[0]==`string`,t=e?arguments[0]:`Effect.fn`,n=e?arguments[1]:void 0,r=globalThis.Error.stackTraceLimit;globalThis.Error.stackTraceLimit=2;let i=new globalThis.Error;return globalThis.Error.stackTraceLimit=r,e?(r,...a)=>gs(t,r,i,a,e,n):gs(t,arguments[0],i,Array.prototype.slice.call(arguments,1),e,n)},gs=(e,t,n,r,i,a)=>{let o=typeof t==`function`?t:r.pop().bind(t.self);return ps(o.length,function(...t){let s=M(()=>{let e=o.apply(this,arguments);return en(e)?e:ys(e)});for(let e=0;e<r.length;e++)s=r[e](s,...t);if(!en(s))return s;let c=globalThis.Error.stackTraceLimit;globalThis.Error.stackTraceLimit=2;let l=new globalThis.Error;return globalThis.Error.stackTraceLimit=c,Js(i?Kl(e,a,e=>ql(s,e)):s,Qa,t=>({name:e,stack:ms(()=>l.stack),parent:{name:`${e} (definition)`,stack:ms(()=>n.stack),parent:t}}))})},_s=(e,...t)=>ps(e.length,t.length===0?function(){return vs(()=>e.apply(this,arguments))}:function(){let n=vs(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),vs=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return j(r.value);let i=r.value.asEffect(),a=i;if(a&&a._tag===`Success`){n=a.value;continue}else if(a&&a._tag===`Failure`)return i;else{let n=!0;return M(()=>n?(n=!1,N(i,e=>ys(t,e))):M(()=>ys(e())))}}}catch(e){return $o(e)}},ys=Sn({op:`Iterator`,single:!1,[Gt](e,t){let n=this[w][0];for(;;){let r=n.next(e);if(r.done)return j(r.value);let i=r.value.asEffect();if(!Os(i))return t._stack.push(this),i;if(i._tag===`Failure`)return i;e=i.value}},[Wt](e){return this[Gt](this[w][1],e)}}),bs=b(2,(e,t)=>{let n=j(t);return N(e,e=>n)}),xs=e=>js(e,O),Ss=b(2,(e,t)=>N(e,e=>en(t)?t:zt(()=>t(e)))),Cs=b(2,(e,t)=>N(e,e=>bs(en(t)?t:zt(()=>t(e)),e))),ws=e=>N(e,e=>Bs),Ts=(e,t)=>E(n=>ls(r=>{let i=!1,a=new Set,o=e=>{i=!0,r(a.size===0?e:N(ol(Ko(a)),()=>e))},s=0;for(let r of e){if(i)break;let e=s++,c=vl(n,r,!0,!0,!1);a.add(c),c.addObserver(r=>{a.delete(c);let s=!i;o(r),s&&t?.onWinner&&t.onWinner({fiber:c,index:e,parentFiber:n})})}return Ko(a)})),Es=b(e=>en(e[1]),(e,t,n)=>Ts([e,t],n)),N=b(2,(e,t)=>{let n=Object.create(Ds);return n[w]=e,n[Gt]=t.length===1?t:e=>t(e),n}),Ds=xn({op:`OnSuccess`,[Wt](e){return e._stack.push(this),this[w]}}),Os=e=>Vt in e,ks=b(2,(e,t)=>Os(e)?e._tag===`Success`?t(e.value):e:N(e,t)),As=e=>N(e,x),js=b(2,(e,t)=>N(e,e=>j(zt(()=>t(e))))),Ms=b(2,(e,t)=>Os(e)?Vs(e,t):js(e,t)),Ns=b(2,(e,t)=>Os(e)?Hs(e,t):hc(e,t)),Ps=b(2,(e,t)=>Os(e)?Us(e,t):gc(e,t)),Fs=b(2,(e,t)=>{if(Os(e)){if(e._tag===`Success`)return e;let n=mo(e.cause);return k(n)?e:t(n.success)}return oc(e,t)}),Is=e=>En(fo(e)),Ls=e=>e._tag===`Success`,Rs=e=>e._tag===`Failure`,zs=e=>e._tag===`Failure`?Er(e.cause):Dr(e),Bs=T(void 0),Vs=b(2,(e,t)=>e._tag===`Success`?T(t(e.value)):e),Hs=b(2,(e,t)=>{if(e._tag===`Success`)return e;let n=mo(e.cause);return k(n)?e:Dn(t(n.success))}),Us=b(2,(e,t)=>{if(e._tag===`Success`)return T(t.onSuccess(e.value));let n=mo(e.cause);return k(n)?e:Dn(t.onFailure(n.success))}),Ws=b(2,(e,t)=>Ls(e)?t:e),Gs=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?Bs:En(dn(t))},Ks=e=>Ls(e)?O(e.value):D(),qs=b(2,(e,t)=>E(n=>{let r=n.services,i=t(r);return r===i?e:(n.setServices(i),Qc(e,()=>{n.setServices(r)}))})),Js=b(3,(e,t,n)=>qs(e,e=>{let r=wa(e,t),i=n(r);return r===i?e:Sa(e,t,i)})),Ys=()=>Xs,Xs=E(e=>j(e.services)),Zs=e=>E(t=>e(t.services)),Qs=b(2,(e,t)=>Os(e)?e:qs(e,Aa(t))),$s=function(){return arguments.length===1?b(2,(e,t)=>ec(e,arguments[0],t)):b(3,(e,t,n)=>ec(e,t,n)).apply(this,arguments)},ec=(e,t,n)=>qs(e,e=>e.mapUnsafe.get(t.key)===n?e:Sa(e,t,n)),tc=b(2,(e,t)=>N(t,t=>t?xs(e):Qo)),nc=b(e=>en(e[0]),(e,t)=>hl({while:ae,body:ie(t?.disableYield?e:N(e,e=>Xo)),step:le})),rc=b(2,(e,t)=>{let n=Object.create(ic);return n[w]=e,n[Kt]=t.length===1?t:e=>t(e),n}),ic=xn({op:`OnFailure`,[Wt](e){return e._stack.push(this),this[w]}}),ac=b(3,(e,t,n)=>rc(e,e=>{let r=t(e);return k(r)?qo(r.failure):zt(()=>n(r.success,e))})),oc=b(2,(e,t)=>ac(e,mo,e=>t(e))),sc=b(2,(e,t)=>rc(e,e=>Ss(zt(()=>t(e)),qo(e)))),cc=b(3,(e,t,n)=>rc(e,e=>{let r=t(e);return k(r)?qo(e):Ss(zt(()=>n(r.success,e)),qo(e))})),lc=b(2,(e,t)=>cc(e,mo,e=>t(e))),uc=b(e=>en(e[0]),(e,t,n,r)=>rc(e,e=>{let i=mo(e);return k(i)?qo(i.failure):t(i.success)?zt(()=>n(i.success)):r?zt(()=>r(i.success)):qo(e)})),dc=b(e=>en(e[0]),(e,t,n,r)=>rc(e,e=>{let i=mo(e);if(k(i))return qo(i.failure);let a=t(i.success);return k(a)?r?zt(()=>r(a.failure)):qo(e):zt(()=>n(a.success))})),fc=b(e=>en(e[0]),(e,t,n,r)=>uc(e,Array.isArray(t)?e=>S(e,`_tag`)&&t.includes(e._tag):De(t),n,r)),pc=b(e=>en(e[0]),(e,t,n)=>{let r;return dc(e,e=>(r??=Object.keys(t),S(e,`_tag`)&&he(e._tag)&&r.includes(e._tag)?Er(e):Dr(e)),e=>zt(()=>t[e._tag](e)),n)}),mc=b(e=>en(e[0]),(e,t,n,r,i)=>uc(e,e=>De(e,t)&&S(e,`reason`),e=>{let t=e.reason;return De(t,n)?r(t,e):i?zt(()=>i(t,e)):Jo(e)})),hc=b(2,(e,t)=>oc(e,e=>es(()=>t(e)))),gc=b(2,(e,t)=>Cc(e,{onFailure:e=>es(()=>t.onFailure(e)),onSuccess:e=>Yo(()=>t.onSuccess(e))})),_c=e=>oc(e,$o),vc=e=>oc(e,t=>N(Xo,()=>vc(e))),yc=b(e=>en(e[0]),(e,t)=>{if(!t?.log)return Cc(e,{onFailure:e=>ts,onSuccess:e=>ts});let n=yu(t.log===!0?void 0:t.log);return xc(e,{onFailure(e){let r=po(e);return k(r)?qo(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>ts})}),bc=e=>Tc(e,{onFailure:Dr,onSuccess:Er}),xc=b(2,(e,t)=>{let n=Object.create(Sc);return n[w]=e,n[Gt]=t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),n[Kt]=t.onFailure.length===1?t.onFailure:e=>t.onFailure(e),n}),Sc=xn({op:`OnSuccessAndFailure`,[Wt](e){return e._stack.push(this),this[w]}}),Cc=b(2,(e,t)=>xc(e,{onFailure:e=>{let n=e.reasons.find(_n);return n?zt(()=>t.onFailure(n.error)):qo(e)},onSuccess:t.onSuccess})),wc=b(2,(e,t)=>Cc(e,{onFailure:e=>Yo(()=>t.onFailure(e)),onSuccess:e=>Yo(()=>t.onSuccess(e))})),Tc=b(2,(e,t)=>{if(Os(e)){if(e._tag===`Success`)return T(t.onSuccess(e.value));let n=mo(e.cause);return k(n)?e:T(t.onFailure(n.success))}return wc(e,t)}),Ec=e=>Os(e)?T(e):Dc(e),Dc=Sn({op:`Exit`,[Wt](e){return e._stack.push(this),this[w]},[Gt](e,t,n){return j(n??T(e))},[Kt](e,t,n){return j(n??En(e))}}),Oc=b(2,(e,t)=>Ss(ru(t),e)),kc=b(2,(e,t)=>Es(e,N(ru(t.duration),t.onTimeout))),Ac=b(2,(e,t)=>kc(e,{duration:t,onTimeout:()=>Jo(new au)})),jc=b(2,(e,t)=>Es(xs(e),bs(ru(t),D()))),Mc=`~effect/Scope`,Nc=`~effect/Scope/Closeable`,Pc=A(`effect/Scope`),Fc=(e,t)=>M(()=>Ic(e,t)??ts),Ic=(e,t)=>{if(e.state._tag===`Closed`)return;let n={_tag:`Closed`,exit:t};if(e.state._tag===`Empty`){e.state=n;return}let{finalizers:r}=e.state;if(e.state=n,r.size!==0)return r.size===1?r.values().next().value(t):Lc(e,r,t)},Lc=fs(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=Io();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*Ec(s(n))):i.push(vl(o,s(n),!0,!0,`inherit`))}return i.length>0&&(r=yield*Vo(i)),yield*Gs(r)}),Rc=(e,t)=>Yo(()=>zc(e,t)),zc=(e,t)=>{let n=Wc(t);if(e.state._tag===`Closed`)return n.state=e.state,n;let r={};return Hc(e,r,e=>Fc(n,e)),Hc(n,r,t=>Yo(()=>Uc(e,r))),n},Bc=(e,t)=>M(()=>e.state._tag===`Closed`?t(e.state.exit):(Hc(e,{},t),ts)),Vc=(e,t)=>Bc(e,ie(t)),Hc=(e,t,n)=>{e.state._tag===`Empty`?e.state={_tag:`Open`,finalizers:new Map([[t,n]])}:e.state._tag===`Open`&&e.state.finalizers.set(t,n)},Uc=(e,t)=>{e.state._tag===`Open`&&e.state.finalizers.delete(t)},Wc=(e=`sequential`)=>({[Nc]:Nc,[Mc]:Mc,strategy:e,state:Gc}),Gc={_tag:`Empty`},Kc=Pc.asEffect(),qc=$s(Pc),Jc=e=>E(t=>{let n=t.services,r=Wc();return t.setServices(Sa(t.services,Pc,r)),Qc(e,e=>(t.setServices(n),Ic(r,e)))}),Yc=e=>M(()=>{let t=Wc();return $c(e(t),e=>M(()=>Ic(t,e)??ts))}),Xc=(e,t,n)=>Zs(r=>dl(i=>N(Kc,a=>Cs(n?.interruptible?i(e):e,e=>Bc(a,n=>Qs(t(e,n),r)))))),Zc=e=>N(Kc,t=>Zs(n=>Bc(t,t=>Qs(e(t),n)))),Qc=Sn({op:`OnExit`,single:!1,[Wt](e){return e._stack.push(this),this[w][0]},[qt](e){e.interruptible&&this[w][2]!==!0&&(e._stack.push(cl),e.interruptible=!1)},[Gt](e,t,n){n??=T(e);let r=this[w][1](n);return r?N(r,e=>n):n},[Kt](e,t,n){n??=En(e);let r=this[w][1](n);return r?N(r,e=>n):n}}),$c=b(2,Qc),el=b(2,(e,t)=>$c(e,e=>t)),tl=b(3,(e,t,n)=>$c(e,e=>{let r=t(e);return k(r)?ts:n(r.success,e)})),nl=b(2,(e,t)=>tl(e,zs,t)),rl=b(3,(e,t,n)=>$c(e,e=>{if(e._tag!==`Failure`)return ts;let r=t(e.cause);return k(r)?ts:n(r.success,e.cause)})),il=b(2,(e,t)=>rl(vo,t)(e)),al=E(e=>qo(fo(e.id))),ol=e=>E(t=>t.interruptible?(t.interruptible=!1,t._stack.push(cl),e):e),sl=Sn({op:`SetInterruptible`,[qt](e){if(e.interruptible=this[w],e._interruptedCause&&e.interruptible)return()=>qo(e._interruptedCause)}}),cl=sl(!0),ll=sl(!1),ul=e=>E(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(ll),t._interruptedCause?qo(t._interruptedCause):e)),dl=e=>E(t=>t.interruptible?(t.interruptible=!1,t._stack.push(cl),e(ul)):e(x)),fl=(e,t)=>Oe(e)?t?.mode===`result`?gl(e,bc,t):gl(e,x,t):t?.discard?t.mode===`result`?gl(Object.values(e),bc,t):gl(Object.values(e),x,t):M(()=>{let n={};return bs(gl(Object.entries(e),([e,r])=>js(t?.mode===`result`?bc(r):r,t=>{n[e]=t}),{discard:!0,concurrency:t?.concurrency}),n)}),pl=(e,t,n,r)=>N(n(r,t),i=>{if(i)return j(O(r));let a=e.next();return a.done?j(D()):pl(e,t+1,n,a.value)}),ml=(e,t,n,r)=>N(n(r,t),r=>{if(kr(r))return j(O(r.success));let i=e.next();return i.done?j(D()):ml(e,t+1,n,i.value)}),hl=Sn({op:`While`,[Gt](e,t){return this[w].step(e),this[w].while()?(t._stack.push(this),this[w].body()):Bs},[Wt](e){return this[w].while()?(e._stack.push(this),this[w].body()):Bs}}),gl=b(e=>typeof e[1]==`function`,(e,t,n)=>E(r=>{let i=n?.concurrency===`inherit`?r.getRef(Za):n?.concurrency??1,a=i===`unbounded`?1/0:Math.max(1,i);if(a===1)return _l(e,t,n);let o=Br(e),s=o.length;if(s===0)return n?.discard?ts:j([]);let c=n?.discard?void 0:Array(s),l=0,u=zo(r);return ls(e=>{let n=new Set,i=[],d=!1,f=0,p=0,m=!1,h=!1;function g(){for(m=!0;f<a&&l<s;){let _=l,ee=o[_];l++,f++;try{let o=vl(r,t(ee,_),!0,!0,`inherit`);n.add(o),o.addObserver(t=>{if(!h){if(n.delete(o),t._tag===`Failure`)if(!d)d=!0,s=l,i.push(...t.cause.reasons),n.forEach(e=>e.interruptUnsafe(r.id,u));else for(let e of t.cause.reasons)e._tag!==`Interrupt`&&i.push(e);else c!==void 0&&(c[_]=t.value);p++,f--,p===s?e(i.length>0?En(dn(i)):j(c)):!m&&!d&&f<a&&g()}})}catch(e){d=!0,s=l,i.push(new mn(e)),n.forEach(e=>e.interruptUnsafe(r.id,u))}}m=!1}return g(),M(()=>(h=!0,l=s,Ko(n)))})})),_l=(e,t,n)=>M(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return bs(hl({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),vl=(e,t,n=!1,r=!1,i=!1)=>{let a=i===`inherit`?e.interruptible:!i,o=new Lo(e.services,a);return n?o.evaluate(t):e.currentDispatcher.scheduleTask(()=>o.evaluate(t),0),!r&&!o._exit&&(e.children().add(o),o.addObserver(()=>e._children.delete(o))),o},yl=b(e=>en(e[0]),(e,t)=>E(n=>j(vl(n,e,t?.startImmediately,!0,t?.uninterruptible)))),bl=b(e=>en(e[0]),(e,t,n)=>E(r=>{let i=vl(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit)if(t.state._tag!==`Closed`){let e={};Hc(t,e,()=>as(e=>e===i.id?ts:Wo(i))),i.addObserver(()=>Uc(t,e))}else i.interruptUnsafe(r.id,zo(r));return j(i)})),xl=b(e=>en(e[0]),(e,t)=>N(Kc,n=>bl(e,n,t))),Sl=e=>(t,n)=>{let r=new Lo(n?.scheduler?Sa(e,Pa,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal)if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}return r},Cl=b(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===`Closed`)return e.interruptUnsafe(e.id),e;let n={};return Hc(t,n,()=>Wo(e)),e.addObserver(()=>Uc(t,n)),e}),wl=Sl(ya()),Tl=e=>{let t=Sl(e);return(e,n)=>{let r=t(e,n);return n?.onExit&&r.addObserver(n.onExit),e=>r.interruptUnsafe(e)}},El=Tl(ya()),Dl=e=>{let t=Sl(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},Ol=Dl(ya()),kl=e=>{let t=Dl(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw So(e.cause);return e.value})},Al=kl(ya()),jl=e=>{let t=Sl(e);return e=>{if(Os(e))return e;let n=t(e,{scheduler:new La(`sync`)});return n.currentDispatcher?.flush(),n._exit??On(n)}},Ml=jl(ya()),Nl=e=>{let t=jl(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw So(n.cause);return n.value}},Pl=Nl(ya()),Fl=j(!0),Il=j(!1);var Ll=class{waiters=[];scheduled=!1;isOpen;constructor(e){this.isOpen=e}scheduleUnsafe(e){return this.scheduled||this.waiters.length===0?Fl:(this.scheduled=!0,e.currentDispatcher.scheduleTask(this.flushWaiters,0),Fl)}flushWaiters=()=>{this.scheduled=!1;let e=this.waiters;this.waiters=[];for(let t=0;t<e.length;t++)e[t](Bs)};open=E(e=>this.isOpen?Il:(this.isOpen=!0,this.scheduleUnsafe(e)));release=E(e=>this.open?Il:this.scheduleUnsafe(e));openUnsafe(){return this.isOpen?!1:(this.isOpen=!0,this.flushWaiters(),!0)}await=ls(e=>this.isOpen?e(ts):(this.waiters.push(e),Yo(()=>{let t=this.waiters.indexOf(e);t!==-1&&this.waiters.splice(t,1)})));closeUnsafe(){return this.isOpen?(this.isOpen=!1,!0):!1}close=Yo(()=>this.closeUnsafe());whenOpen=e=>N(this.await,()=>e)};const Rl=e=>new Ll(e??!1),zl=E(e=>j(e.getRef(Ja))),Bl=BigInt(0),Vl={_tag:`Span`,spanId:`noop`,traceId:`noop`,sampled:!1,status:{_tag:`Ended`,startTime:Bl,endTime:Bl,exit:Bs},attributes:new Map,links:[],kind:`internal`,attribute(){},event(){},end(){},addLinks(){}},Hl=e=>Object.assign(Object.create(Vl),e),Ul=e=>e?Ta(e.annotations,Wa)?e._tag===`Span`?Ul(yr(e.parent)):D():O(e):D(),Wl=(e,t,n)=>{let r=!e.getRef($a)||n?.annotations&&Ta(n.annotations,Wa),i=n?.parent===void 0?n?.root?D():Ul(e.currentSpan):O(n.parent),a;if(r)a=Hl({name:t,parent:i,annotations:Sa(n?.annotations??ya(),Wa,!0)});else{let r=e.getRef(Ja),o=e.getRef(Zl),s=e.getRef(eo),c=e.getRef(to),l=e.getRef(no),u=n?.level??e.getRef(Ga),d=n?.links===void 0?l.slice():[...l,...n.links];a=r.span({name:t,parent:i,annotations:n?.annotations??ya(),links:d,startTime:s?o.currentTimeNanosUnsafe():0n,kind:n?.kind??`internal`,root:n?.root??fr(i),sampled:n?.sampled??(pr(i)&&i.value.sampled===!1?!1:!du(e.getRef(Ka),u))});for(let[e,t]of Object.entries(c))a.attribute(e,t);if(n?.attributes!==void 0)for(let[e,t]of Object.entries(n.attributes))a.attribute(e,t)}return a},Gl=(e,t)=>(t=typeof t==`function`?t:ce,Js(Qa,n=>({name:e,stack:t,parent:n}))),Kl=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return E(t=>{let i=Wl(t,e,n),a=t.getRef(Zl);return $c(zt(()=>r(i)),e=>Yo(()=>{i.status._tag!==`Ended`&&i.end(a.currentTimeNanosUnsafe(),e)}))})},ql=$s(Ha),Jl=function(){let e=en(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=x;return t._tag===`Span`&&(n=so(n),r=Gl(t.name,n?.captureStackTrace)),e?ql(r(arguments[0]),t):e=>ql(r(e),t)},Yl=function(){let e=typeof arguments[0]!=`string`,t=e?arguments[1]:arguments[0],n=so(arguments[2]);if(e){let e=arguments[0];return Kl(t,arguments[2],t=>Jl(e,t,n))}let r=typeof arguments[1]==`function`?arguments[1]:void 0,i=r?void 0:arguments[1];return(e,...a)=>Kl(t,r?r(...a):i,t=>Jl(e,t,n))},Xl=(...e)=>E(t=>{let n=t.currentSpanLocal;if(n)if(e.length===1)for(let[t,r]of Object.entries(e[0]))n.attribute(t,r);else n.attribute(e[0],e[1]);return ts}),Zl=Na(`effect/Clock`,{defaultValue:()=>new $l}),Ql=2**31-1;var $l=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=Yo(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return tu()}currentTimeNanos=Yo(()=>this.currentTimeNanosUnsafe());sleep(e){let t=ea(e);return t<=0?Xo:ls(e=>{if(t>Ql)return;let n=setTimeout(()=>e(ts),t);return Yo(()=>clearTimeout(n))})}};const eu=function(){let e=BigInt(1e6);if(typeof performance>`u`||performance.now===void 0)return()=>BigInt(Date.now())*e;if(typeof performance.timeOrigin==`number`&&performance.timeOrigin===0)return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6));return()=>t+BigInt(Math.round(performance.now()*1e6))}(),tu=function(){let e=typeof process==`object`&&`hrtime`in process&&typeof process.hrtime.bigint==`function`?process.hrtime:void 0;if(!e)return eu;let t=eu()-e.bigint();return()=>t+e.bigint()}(),nu=e=>E(t=>e(t.getRef(Zl))),ru=e=>nu(t=>t.sleep(Pi(e))),iu=`~effect/Cause/TimeoutError`;var au=class extends jn(`TimeoutError`){[iu]=iu;constructor(e){super({message:e})}};const ou=`~effect/Cause/IllegalArgumentError`;var su=class extends jn(`IllegalArgumentError`){[ou]=ou;constructor(e){super({message:e})}};jn(`ExceededCapacityError`);const cu=`~effect/Cause/UnknownError`;var lu=class extends jn(`UnknownError`){[cu]=cu;constructor(e,t){super({message:t,cause:e})}};const uu=Na(`effect/Console/CurrentConsole`,{defaultValue:()=>globalThis.console}),du=ur(lr(or,e=>{switch(e){case`All`:return-(2**53-1);case`Fatal`:return 5e4;case`Error`:return 4e4;case`Warn`:return 3e4;case`Info`:return 2e4;case`Debug`:return 1e4;case`Trace`:return 0;case`None`:return 2**53-1}})),fu=Na(`effect/Loggers/CurrentLoggers`,{defaultValue:()=>new Set([Cu,wu])}),pu=Na(`effect/Logger/LogToStderr`,{defaultValue:oe}),mu=function(){let e=typeof arguments[0]==`string`?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return ol(E(t=>{let n=t.getRef(ro),r={...n};for(let t=0;t<e.length;t++){let[n,i]=e[t];r[n]=i}return t.setServices(Sa(t.services,ro,r)),Bc(wa(t.services,Pc),r=>{let i=t.getRef(ro),a={...i};for(let t=0;t<e.length;t++){let[r,o]=e[t];i[r]===o&&(r in n?a[r]=n[r]:delete a[r])}return t.setServices(Sa(t.services,ro,a)),ts})}))},hu={"~effect/Logger":{_Message:x,_Output:x},pipe(){return y(this,arguments)}},gu=e=>{let t=Object.create(hu);return t.log=e,t},_u=e=>e.replace(/[\s="]/g,`_`),vu=(e,t)=>`${_u(e[0])}=${t-e[1]}ms`,yu=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];an(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?dn(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=fn),E(r=>{let i=e??r.currentLogLevel;if(du(r.minimumLogLevel,i))return ts;let a=r.getRef(Zl),o=r.getRef(fu);if(o.size>0){let e=new Date(a.currentTimeMillisUnsafe());for(let a of o)a.log({cause:n,fiber:r,date:e,logLevel:i,message:t})}return ts})},bu={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};bu.gray,bu.blue,bu.green,bu.yellow,bu.red,bu.bgBrightRed,bu.black;const xu=e=>`${e.getHours().toString().padStart(2,`0`)}:${e.getMinutes().toString().padStart(2,`0`)}:${e.getSeconds().toString().padStart(2,`0`)}.${e.getMilliseconds().toString().padStart(3,`0`)}`,Su=typeof process==`object`&&process!==null&&typeof process.stdout==`object`&&process.stdout!==null;Su&&process.stdout.isTTY,Su||`Deno`in globalThis;const Cu=gu(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(jo(e));let o=t.getTime(),s=n.getRef(oo),c=``;for(let e of s)c+=` ${vu(e,o)}`;let l=n.getRef(ro);Object.keys(l).length>0&&a.push(l);let u=n.getRef(uu);(n.getRef(pu)?u.error:u.log)(`[${xu(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),wu=gu(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(Zl),a=t.getRef(ro),o=t.currentSpan;if(o===void 0||o._tag===`ExternalSpan`)return;let s={};for(let[e,t]of Object.entries(a))s[e]=t;s[`effect.fiberId`]=t.id,s[`effect.logLevel`]=n.toUpperCase(),e.reasons.length>0&&(s[`effect.cause`]=jo(e)),o.event(Mt(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)}),Tu=an,Eu=pn,Du=hn,Ou=fo,ku=yo,Au=So,ju=mo,Mu=ho,Nu=go,Pu=vo,Fu=jo,Iu=Nn,Lu=Fn,Ru=zn,zu=su,Bu=tn,Vu=T,Hu=En,Uu=Dn,Wu=Bs,Gu=Ls,Ku=Rs,qu=Ks,Ju={"~effect/Deferred":{_A:x,_E:x},pipe(){return y(this,arguments)}},Yu=()=>{let e=Object.create(Ju);return e.resumes=void 0,e.effect=void 0,e},Xu=()=>Yo(()=>Yu()),Zu=e=>ls(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),Yo(()=>{let n=e.resumes.indexOf(t);e.resumes.splice(n,1)}))),Qu=b(2,(e,t)=>Yo(()=>id(e,t))),$u=Qu,ed=b(2,(e,t)=>$u(e,Dn(t))),td=b(2,(e,t)=>$u(e,En(t))),nd=b(2,(e,t)=>td(e,fo(t))),rd=b(2,(e,t)=>$u(e,T(t))),id=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){for(let n=0;n<e.resumes.length;n++)e.resumes[n](t);e.resumes=void 0}return!0},ad=b(2,(e,t)=>dl(n=>N(Ec(n(e)),e=>$u(t,e)))),od=Pc,sd=Wc,cd=qc,ld=Bc,ud=Vc,dd=Rc,fd=zc,pd=Fc,md=`~effect/Layer`,hd=`~effect/Layer/MemoMap`,gd=e=>S(e,md),_d={[md]:{_ROut:x,_E:x,_RIn:x},pipe(){return y(this,arguments)}},vd=e=>{let t=Object.create(_d);return t.build=e,t},yd=e=>vd((t,n)=>{let r=fd(n);return $c(e(t,r),e=>e._tag===`Failure`?pd(r,e):ts)}),bd=e=>{let t=yd((n,r)=>n.getOrElseMemoize(t,r,e));return t};var xd=class{get[hd](){return hd}map=new Map;getOrElseMemoize(e,t,n){if(this.map.has(e)){let n=this.map.get(e);return n.observers++,Ss(Bc(t,e=>n.finalizer(e)),n.effect)}let r=sd(),i=Yu(),a={observers:1,effect:Zu(i),finalizer:t=>M(()=>(a.observers--,a.observers===0?(this.map.delete(e),pd(r,t)):ts))};return this.map.set(e,a),Bc(t,a.finalizer).pipe(N(()=>n(this,r)),$c(e=>(a.effect=e,$u(i,e))))}};const Sd=()=>new xd;var Cd=class extends A()(`effect/Layer/CurrentMemoMap`){static getOrCreate=Ca(this,Sd)};const wd=b(3,(e,t,n)=>$s(js(e.build(t,n),Sa(Cd,t)),Cd,t)),Td=b(2,(e,t)=>E(n=>wd(e,Cd.getOrCreate(n.services),t))),Ed=function(){return arguments.length===1?e=>Dd(xa(arguments[0],e)):Dd(xa(arguments[0],arguments[1]))},Dd=e=>vd(ie(j(e))),Od=function(){return arguments.length===1?e=>kd(arguments[0],e):kd(arguments[0],arguments[1])},kd=(e,t)=>Ad(js(t,t=>xa(e,t))),Ad=e=>bd((t,n)=>cd(e,n)),jd=e=>Ad(bs(e,ya())),Md=e=>{let t=A(`effect/Layer/unwrap`);return Ld(Od(t)(e),Ta(t))},Nd=(e,t,n)=>{let r=fd(n,`parallel`);return gl(e,e=>e.build(t,fd(r,`sequential`)),{concurrency:e.length}).pipe(js(e=>ja(...e)))},Pd=(...e)=>yd((t,n)=>Nd(e,t,n)),Fd=(e,t,n)=>yd((r,i)=>N(Array.isArray(t)?Nd(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(Qs(t),js(e=>n(e,t))))),P=b(2,(e,t)=>Fd(e,t,x)),Id=b(2,(e,t)=>Fd(e,t,(e,t)=>Aa(t,e))),Ld=b(2,(e,t)=>yd((n,r)=>N(e.build(n,r),e=>t(e).build(n,r)))),Rd=function(){return arguments.length===1?e=>zd(arguments[0],e):zd(arguments[0],arguments[1])},zd=(e,t)=>Ed(e)(new Proxy({...t},{get(t,n,r){if(n in t)return t[n];let i=Error.stackTraceLimit;Error.stackTraceLimit=2;let a=Error(`${e.key}: Unimplemented method "${n.toString()}"`);return Error.stackTraceLimit=i,a.name=`UnimplementedError`,Bd(a)},has:ae})),Bd=e=>{let t=Object.assign($o(e),{[Vd]:Vd,channel:{[Hd]:Hd,transform:()=>j(t),pipe(){return y(this,arguments)}},[Hd]:Hd,transform:()=>j(t)});function n(){return t}return Object.assign(n,t),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n},Vd=`~effect/Stream`,Hd=`~effect/Channel`,Ud=`~effect/ExecutionPlan`,Wd={[Ud]:Ud,get withRequirements(){let e=this;return Zs(t=>j(Gd(e.steps.map(e=>({...e,provide:gd(e.provide)?P(e.provide,Dd(t)):e.provide})))))},pipe(){return y(this,arguments)}},Gd=e=>{let t=Object.create(Wd);return t.steps=e,t},Kd=class extends re{constructor(e){super(),e&&Object.assign(this,e)}},qd=()=>new Proxy({},{get(e,t,n){return t===`$is`?De:t===`$match`?Jd:e=>({_tag:t,...e})}});function Jd(){if(arguments.length===1){let e=arguments[0];return function(t){return e[t._tag](t)}}let e=arguments[0];return arguments[1][e._tag](e)}const Yd=jn,Xd=`~effect/time/DateTime`,Zd=`~effect/time/DateTime/TimeZone`,Qd={[Xd]:Xd,pipe(){return y(this,arguments)},[At](){return this.toString()},toJSON(){return ff(this).toJSON()}},$d={...Qd,_tag:`Utc`,[je](){return Ie(this.epochMilliseconds)},[Je](e){return tf(e)&&e._tag===`Utc`&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${ff(this).toJSON()})`}};({...Qd});const ef={[Zd]:Zd,[At](){return this.toString()}};({...ef}),{...ef};const tf=e=>S(e,Xd),nf=e=>e._tag===`Utc`,rf=dt((e,t)=>e.epochMilliseconds===t.epochMilliseconds),af=e=>{let t=Object.create($d);return t.epochMilliseconds=e,Object.defineProperty(t,`partsUtc`,{value:void 0,enumerable:!1,writable:!0}),t},of=e=>{let t=e.getTime();if(Number.isNaN(t))throw new zu(`Invalid date`);return af(t)},sf=e=>{if(tf(e))return e;if(e instanceof Date)return of(e);if(typeof e==`object`){if(`epochMilliseconds`in e)return af(e.epochMilliseconds);let t=new Date(0);return _f(t,e),of(t)}else if(typeof e==`string`&&!cf(e))return of(new Date(e+`Z`));return of(new Date(e))},cf=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),lf=br(sf),uf=()=>af(Date.now()),df=e=>af(e.epochMilliseconds),ff=e=>new Date(e.epochMilliseconds),pf=e=>{if(e._tag===`Utc`)return new Date(e.epochMilliseconds);if(e.zone._tag===`Offset`)return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(e=>e.type!==`literal`),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMilliseconds=n.getTime(),n},mf=e=>pf(e).getTime()-gf(e),hf=e=>{let t=Math.abs(e),n=Math.floor(t/(3600*1e3)),r=Math.round(t%(3600*1e3)/(60*1e3));return r===60&&(n+=1,r=0),`${e<0?`-`:`+`}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`},gf=e=>e.epochMilliseconds,_f=(e,t)=>{if(t.year!==void 0&&e.setUTCFullYear(t.year),t.month!==void 0&&e.setUTCMonth(t.month-1),t.day!==void 0&&e.setUTCDate(t.day),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)},vf=e=>ff(e).toISOString();globalThis.String;const yf=e=>e.trim(),bf=e=>e.length>0,xf=b(2,(e,t)=>{let n=e.split(t);return gt(n)?n:[e]}),Sf=b(2,(e,t)=>ac(e,Df,e=>t(e))),Cf=e=>e.reasons.some(wf),wf=e=>e._tag===`Fail`&&Lu(e.error),Tf=ua(ju,e=>Lu(e)?Er(e):Dr(e)),Ef=oa(e=>e.reasons.every(e=>!wf(e))),Df=ua(ju,e=>Lu(e)?Er(e.value):Dr(e)),Of=e=>{let t=Tf(e);return k(t)?Hu(t.failure):Vu(t.success.value)},kf=b(2,(e,t)=>xc(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=Tf(e);return k(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),Af=`~effect/Schedule`,jf=Na(`effect/Schedule/CurrentMetadata`,{defaultValue:ie({input:void 0,output:void 0,duration:Ui,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),Mf={[Af]:{_Out:x,_In:x,_Env:x},pipe(){return y(this,arguments)}},Nf=e=>S(e,Af),Pf=e=>{let t=Object.create(Mf);return t.step=e,t},Ff=()=>{let e=0,t,n;return(r,i)=>{n===void 0&&(n=r);let a=r-n,o=t===void 0?0:r-t;return t=r,{input:i,attempt:++e,start:n,now:r,elapsed:a,elapsedSincePrevious:o}}},If=e=>Pf(js(e,e=>{let t=Ff();return(n,r)=>e(t(n,r))})),Lf=e=>rc(e.step,e=>j(()=>qo(e))),Rf=e=>nu(t=>js(Lf(e),e=>{let n=Ff();return r=>M(()=>{let i=t.currentTimeMillisUnsafe();return N(e(i,r),([e,t])=>{let a=n(i,r);return a.output=e,a.duration=t,bs(ru(t),a)})})})),zf=(e,t=2)=>{let n=ea(Pi(e));return If(j(e=>{let r=Ji(n*t**(e.attempt-1));return j([r,r])}))},Bf=e=>Pf(js(Lf(e),e=>(t,n)=>kf(e(t,n),{onSuccess:e=>j([n,e[1]]),onFailure:qo,onDone:()=>Ru(n)}))),Vf=e=>{let t=Pi(e);return If(j(e=>j([e.attempt-1,t])))},Hf=b(2,(e,t)=>Pf(js(Lf(e),e=>{let n=Ff();return(r,i)=>N(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return N(en(s)?s:j(s),t=>t?j(e):Ru(a))})}))),Uf=Vf(Ui),Wf=(e,t,n)=>Yc(r=>N(n?.local?wd(t,Sd(),r):Td(t,r),t=>Qs(e,t))),Gf=b(e=>en(e[0]),(e,t,n)=>_a(t)?Qs(e,t):Wf(e,Array.isArray(t)?Pd(...t):t,n)),Kf=b(3,(e,t,n)=>N(Rf(t),t=>{let r=jf.defaultValue();return oc(nc(Cs(N(M(()=>$s(e,jf,r)),t),e=>Yo(()=>{r=e})),{disableYield:!0}),e=>Fn(e)?j(e.value):n(e,r.attempt===0?D():O(r)))})),qf=b(3,(e,t,n)=>N(Rf(t),t=>{let r=jf.defaultValue(),i,a=oc(M(()=>$s(e,jf,r)),e=>(i=e,N(t(e),e=>(r=e,a))));return Sf(a,e=>zt(()=>n(i,e)))})),Jf=b(2,(e,t)=>Kf(e,typeof t==`function`?t(x):Nf(t)?t:Zf(t),Jo)),Yf=b(2,(e,t)=>qf(e,typeof t==`function`?t(x):Nf(t)?t:Zf(t),Jo)),Xf=Bf(Uf),Zf=e=>{let t=e.schedule??Xf;return e.while&&(t=Hf(t,({input:t})=>{let n=e.while(t);return en(n)?n:j(n)})),e.until&&(t=Hf(t,({input:t})=>{let n=e.until(t);return en(n)?js(n,e=>!e):j(!n)})),e.times!==void 0&&(t=Hf(t,({attempt:t})=>j(t<=e.times))),t};({...Xt});const Qf=Na(`~effect/observability/Metric/MetricRegistryKey`,{defaultValue:()=>new Map}),$f=e=>{let t=Ta(e,Qf);return Array.from(t.values()).map(({hooks:t,...n})=>({...n,state:t.get(e)}))},ep=en,tp=fl,np=gl,rp=hl,ip=rs,ap=is,F=j,op=Qo,sp=Zo,cp=M,I=Yo,lp=ts,up=ls,dp=us,L=ds,R=Jo,fp=qo,pp=$o,mp=ns,hp=E,z=N,gp=As,_p=Ss,vp=Cs,yp=Ec,B=js,bp=bs,xp=ws,Sp=oc,Cp=fc,wp=pc,Tp=mc,V=rc,Ep=dc,Dp=ac,Op=hc,kp=_c,Ap=lc,jp=sc,Mp=Yf,Np=yc,Pp=Ac,Fp=jc,Ip=kc,Lp=Oc,Rp=Es,zp=tc,Bp=xc,Vp=Ys,Hp=Zs,Up=Gf,Wp=Qs,Gp=qs,Kp=$s,qp=Kc,Jp=Jc,Yp=Yc,Xp=Xc,Zp=Zc,Qp=el,$p=nl,em=$c,tm=al,nm=il,rm=ol,im=nc,am=Jf,om=zl,sm=Xl,cm=Yl,lm=bl,um=xl,dm=yl,fm=os,pm=wl,mm=Sl,hm=Tl,gm=El,_m=Al,vm=kl,ym=Ol,bm=Dl,xm=Pl,Sm=Nl,Cm=Ml,wm=jl,Tm=fs,H=hs,Em=yu(`Warn`),Dm=yu(`Error`),Om=yu(`Info`),km=yu(`Debug`),Am=b(e=>ep(e[0]),(e,...t)=>Js(e,ro,e=>{let n={...e};return t.length===1?Object.assign(n,t[0]):n[t[0]]=t[1],n})),jm=mu,Mm=Ms,Nm=Ns,Pm=Ps,Fm=ks,Im=Fs,Lm=_s;function Rm(e,t,n){return t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n,e}function zm(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Bm(e){return t=>zm(t)?.[e]}const Vm=Bm(`identifier`),Hm=Bm(`brands`),Um=fe(e=>{let t=Vm(e);return typeof t==`string`?t:e.getExpected(Um)});globalThis.RegExp;const Wm=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`),Gm=tf,Km=nf,qm=rf,Jm=of,Ym=lf,Xm=uf,Zm=df,Qm=gf;A()(`effect/DateTime/CurrentTimeZone`);const $m=vf;Yd(`EncodingError`);const eh=new WeakMap,th=`~effect/data/Redacted`,nh=e=>S(e,th),rh=(e,t)=>{let n=Object.create(ih);return t?.label&&(n.label=t.label),eh.set(n,e),n},ih={[th]:{_A:e=>e},label:void 0,...Yt,toJSON(){return this.toString()},toString(){return`<redacted${he(this.label)?`:`+this.label:``}>`},[je](){return C(eh.get(this))},[Je](e){return nh(e)&&Ye(eh.get(this),eh.get(e))}},ah=`~effect/SchemaIssue/Issue`;function oh(e){return S(e,ah)}var sh=class{[ah]=ah;toString(){return Th(this)}},ch=class extends sh{_tag=`Filter`;actual;filter;issue;constructor(e,t,n){super(),this.actual=e,this.filter=t,this.issue=n}},lh=class extends sh{_tag=`Encoding`;ast;actual;issue;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issue=n}},uh=class extends sh{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},dh=class extends sh{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},fh=class extends sh{_tag=`UnexpectedKey`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},ph=class extends sh{_tag=`Composite`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},mh=class extends sh{_tag=`InvalidType`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},hh=class extends sh{_tag=`InvalidValue`;actual;annotations;constructor(e,t){super(),this.actual=e,this.annotations=t}},gh=class extends sh{_tag=`AnyOf`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},_h=class extends sh{_tag=`OneOf`;ast;actual;successes;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.successes=n}};function vh(e,t){if(oh(t))return t;if(t!==void 0)return typeof t==`boolean`?t?void 0:new hh(O(e)):typeof t==`string`?new hh(O(e),{message:t}):new uh(t.path,new hh(O(e),{message:t.message}))}const yh=e=>{let t=Dh(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return xh(Um(e.ast),kh(e.actual));case`InvalidValue`:return`Invalid data ${kh(e.actual)}`;case`MissingKey`:return`Missing key`;case`UnexpectedKey`:return`Unexpected key with value ${Ct(e.actual)}`;case`Forbidden`:return`Forbidden operation`;case`OneOf`:return`Expected exactly one member to match the input ${Ct(e.actual)}`}},bh=e=>Dh(e.issue)??Dh(e);function xh(e,t){return`Expected ${e}, got ${t}`}function Sh(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];switch(e.issue._tag){case`InvalidValue`:return[{path:t,message:xh(Ch(e.filter),Ct(e.actual))}];default:return Sh(e.issue,t,n,r)}}case`Encoding`:return Sh(e.issue,t,n,r);case`Pointer`:return Sh(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Sh(e,t,n,r));case`AnyOf`:{let i=Dh(e);return e.issues.length===0?i===void 0?[{path:t,message:xh(Um(e.ast),Ct(e.actual))}]:[{path:t,message:i}]:e.issues.flatMap(e=>Sh(e,t,n,r))}default:return[{path:t,message:n(e)}]}}function Ch(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>Ch(e)).join(` & `)}}function wh(){return e=>Sh(e,[],yh,bh).map(Eh).join(`
16
+ `)}const Th=wh();function Eh(e){let t=e.message;if(e.path&&e.path.length>0){let n=Et(e.path);t+=`\n at ${n}`}return t}function Dh(e){switch(e._tag){case`InvalidType`:case`OneOf`:case`Composite`:case`AnyOf`:return Oh(e.ast.annotations);case`InvalidValue`:case`Forbidden`:return Oh(e.annotations);case`MissingKey`:return Oh(e.annotations,`messageMissingKey`);case`UnexpectedKey`:return Oh(e.ast.annotations,`messageUnexpectedKey`);case`Filter`:return Oh(e.filter.annotations);case`Encoding`:return Dh(e.issue)}}function Oh(e,t=`message`){let n=e?.[t];if(typeof n==`string`)return n}function kh(e){return fr(e)?`no value provided`:Ct(e.value)}var Ah=class e extends re{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(Mm(Sr(t))))}compose(t){return Mh(this)?t:Mh(t)?this:new e((e,n)=>this.run(e,n).pipe(Fm(e=>t.run(e,n))))}};const jh=new Ah(F);function Mh(e){return e.run===jh.run}function Nh(){return jh}function Ph(e){return new Ah((t,n)=>fr(t)?op:e(t.value,n))}function U(e){return Ih(Sr(e))}function Fh(e){return Ph((t,n)=>e(t,n).pipe(Mm(O)))}function Ih(e){return new Ah(t=>F(e(t)))}function Lh(){return U(globalThis.String)}function Rh(){return U(globalThis.Number)}function zh(){return U(globalThis.BigInt)}function Bh(e){return Ph(t=>mp({try:()=>O(JSON.parse(t,e?.reviver)),catch:e=>new hh(O(t),{message:globalThis.String(e)})}))}function Vh(e){return Ph(t=>mp({try:()=>O(JSON.stringify(t,e?.replacer,e?.space)),catch:e=>new hh(O(t),{message:globalThis.String(e)})}))}function Hh(e){let t=e?.separator??`,`;return U(e=>e===``?[]:e.split(t))}const Uh=`~effect/SchemaTransformation/Transformation`;var Wh=class e{[Uh]=Uh;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function Gh(e){return S(e,Uh)}const Kh=e=>Gh(e)?e:new Wh(e.decode,e.encode);function qh(e){return new Wh(Fh(e.decode),Fh(e.encode))}function Jh(e){return new Wh(U(e.decode),U(e.encode))}const Yh=new Wh(Nh(),Nh());function Xh(){return Yh}const Zh=new Wh(Rh(),Lh()),Qh=new Wh(zh(),Lh()),$h=e=>Jh({decode:e=>{let t=Error(e.message);return typeof e.name==`string`&&e.name!==`Error`&&(t.name=e.name),typeof e.stack==`string`&&(t.stack=e.stack),t},encode:t=>{let n={name:t.name,message:t.message};return e?.includeStack&&typeof t.stack==`string`&&(n.stack=t.stack),n}});function eg(){return Jh({decode:_r,encode:vr})}function tg(e){return Jh({decode:gr,encode:e?.onNoneEncoding===null?vr:yr})}const ng=new Wh(Bh(),Vh()),rg=qh({decode:e=>mr(Ym(e),{onNone:()=>R(new hh(O(e),{message:`Invalid DateTime input`})),onSome:e=>F(Zm(e))}),encode:e=>F($m(e))});function ig(e){return t=>t._tag===e}const ag=ig(`Declaration`),og=ig(`Never`),sg=ig(`Literal`),cg=ig(`UniqueSymbol`),lg=ig(`Arrays`),ug=ig(`Objects`),dg=ig(`Union`);var fg=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}};const pg={};var mg=class{isOptional;isMutable;defaultValue;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.defaultValue=n,this.annotations=r}};const hg=`~effect/Schema`;var gg=class{[hg]=hg;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},_g=class e extends gg{_tag=`Declaration`;typeParameters;run;constructor(e,t,n,r,i,a){super(n,r,i,a),this.typeParameters=e,this.run=t}getParser(){let e=this.run(this.typeParameters);return(t,n)=>fr(t)?op:Mm(e(t.value,this,n),O)}recur(t){let n=__(this.typeParameters,t);return n===this.typeParameters?this:new e(n,this.run,this.annotations,this.checks,void 0,this.context)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}};const vg=new class extends gg{_tag=`Null`;getParser(){return F_(this,null)}getExpected(){return`null`}};var yg=class extends gg{_tag=`Undefined`;getParser(){return F_(this,void 0)}toCodecJson(){return c_(this,[bg])}getExpected(){return`undefined`}};const bg=new fg(vg,new Wh(U(()=>void 0),U(()=>null))),xg=new yg,Sg=new class extends gg{_tag=`Any`;getParser(){return I_(this,we)}getExpected(){return`any`}},Cg=new class extends gg{_tag=`Unknown`;getParser(){return I_(this,we)}getExpected(){return`unknown`}};var wg=class extends gg{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${Ct(e)}`);this.literal=e}getParser(){return F_(this,this.literal)}toCodecJson(){return typeof this.literal==`bigint`?Tg(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Tg(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Tg(e){let t=globalThis.String(e.literal);return c_(e,[new fg(new wg(t),new Wh(U(()=>e.literal),U(()=>t)))])}const Eg=new class extends gg{_tag=`String`;getParser(){return I_(this,he)}getExpected(){return`string`}};var Dg=class extends gg{_tag=`Number`;getParser(){return I_(this,ge)}toCodecJson(){return this.checks&&(Og(this.checks,`isFinite`)||Og(this.checks,`isInt`))?this:c_(this,[Qg])}toCodecStringTree(){return this.checks&&(Og(this.checks,`isFinite`)||Og(this.checks,`isInt`))?c_(this,[U_]):c_(this,[W_])}getExpected(){return`number`}};function Og(e,t){return e.some(e=>{switch(e._tag){case`Filter`:return e.annotations?.meta?._tag===t;case`FilterGroup`:return Og(e.checks,t)}})}const kg=new Dg,Ag=new class extends gg{_tag=`Boolean`;getParser(){return I_(this,_e)}getExpected(){return`boolean`}},jg=new class extends gg{_tag=`BigInt`;getParser(){return I_(this,ve)}toCodecStringTree(){return c_(this,[J_])}getExpected(){return`bigint`}};var Mg=class e extends gg{_tag=`Arrays`;isMutable;elements;rest;constructor(e,t,n,r,i,a,o){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n;let s=t.findIndex(T_);if(s!==-1&&(t.slice(s+1).some(e=>!T_(e))||n.length>1))throw Error(`A required element cannot follow an optional element. ts(1257)`);if(n.length>1&&n.slice(1).some(T_))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e){let t=this,n=t.elements.map(t=>({ast:t,parser:e(t)})),r=t.rest.map(t=>({ast:t,parser:e(t)})),i=n.length;return Lm(function*(e,a){if(e._tag===`None`)return e;let o=e.value;if(!Array.isArray(o))return yield*R(new mh(t,e));let s=[],c,l=a.errors===`all`,u=0;for(;u<i;u++){let r=n[u],i=u<o.length?O(o[u]):D(),d=r.parser(i,a),f=Os(d)?d:yield*yp(d);if(f._tag===`Failure`){let n=ju(f.cause);if(k(n))return yield*f;let r=new uh([u],n.success);if(l)c?c.push(r):c=[r];else return yield*R(new ph(t,e,[r]))}else if(f.value._tag===`Some`)s[u]=f.value.value;else if(!T_(r.ast)){let n=new uh([u],new dh(r.ast.context?.annotations));if(l)c?c.push(n):c=[n];else return yield*R(new ph(t,e,[n]))}}let d=o.length;if(t.rest.length>0){let[n,...i]=r,f=n.ast.context?.annotations;for(;u<d-i.length;u++){let r=n.parser(O(o[u]),a),i=Os(r)?r:yield*yp(r);if(i._tag===`Failure`){let n=ju(i.cause);if(k(n))return yield*i;let r=new uh([u],n.success);if(l)c?c.push(r):c=[r];else return yield*R(new ph(t,e,[r]))}else if(i.value._tag===`Some`)s[u]=i.value.value;else{let n=new uh([u],new dh(f));if(l)c?c.push(n):c=[n];else return yield*R(new ph(t,e,[n]))}}for(let n=0;n<i.length;n++){let r=u+n;if(!(d<r)){let u=i[n],d=u.ast.context?.annotations,f=u.parser(O(o[r]),a),p=Os(f)?f:yield*yp(f);if(p._tag===`Failure`){let n=ju(p.cause);if(k(n))return yield*p;let i=new uh([r],n.success);if(l)c?c.push(i):c=[i];else return yield*R(new ph(t,e,[i]))}else if(p.value._tag===`Some`)s[r]=p.value.value;else{let n=new uh([r],new dh(d));if(l)c?c.push(n):c=[n];else return yield*R(new ph(t,e,[n]))}}}}else for(let n=i;n<=d-1;n++){let r=new uh([n],new fh(t,o[n]));if(l)c?c.push(r):c=[r];else return yield*R(new ph(t,e,[r]))}return c?yield*R(new ph(t,e,c)):O(s)})}recur(t){let n=__(this.elements,t),r=__(this.rest,t);return n===this.elements&&r===this.rest?this:new e(this.isMutable,n,r,this.annotations,this.checks,void 0,this.context)}getExpected(){return`array`}};const Ng=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`,Pg=new globalThis.RegExp(`(?:${Ng}|Infinity|-Infinity|NaN)`);function Fg(e,t){let n=D_(t);switch(n._tag){case`String`:return Object.keys(e);case`TemplateLiteral`:{let t=M_(n);return Object.keys(e).filter(e=>t.test(e))}case`Symbol`:return Object.getOwnPropertySymbols(e);case`Number`:return Object.keys(e).filter(e=>Pg.test(e));case`Union`:return[...new Set(n.types.flatMap(t=>Fg(e,t)))];default:return[]}}var Ig=class{name;type;constructor(e,t){this.name=e,this.type=t}},Lg=class e{decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}},Rg=class{parameter;type;merge;constructor(e,t,n){if(this.parameter=e,this.type=t,this.merge=n,T_(t)&&!A_(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},zg=class e extends gg{_tag=`Objects`;propertySignatures;indexSignatures;constructor(e,t,n,r,i,a){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t;let o=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(o.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(o)}. ts(2300)`)}getParser(e){let t=this,n=[],r=new Set,i=[],a=t.propertySignatures.length;for(let a of t.propertySignatures)n.push(a.name),r.add(a.name),i.push({ps:a,parser:e(a.type),name:a.name,type:a.type});let o=t.indexSignatures.length;return t.propertySignatures.length===0&&t.indexSignatures.length===0?I_(t,Ce):Lm(function*(s,c){if(s._tag===`None`)return s;let l=s.value;if(!(typeof l==`object`&&l&&!Array.isArray(l)))return yield*R(new mh(t,s));let u={},d,f=c.errors===`all`,p=c.onExcessProperty===`error`,m=c.onExcessProperty===`preserve`,h;if(t.indexSignatures.length===0&&(p||m)){h=Reflect.ownKeys(l);for(let e=0;e<h.length;e++){let n=h[e];if(!r.has(n))if(p){let e=new uh([n],new fh(t,l[n]));if(f){d?d.push(e):d=[e];continue}else return yield*R(new ph(t,s,[e]))}else Rm(u,n,l[n])}}for(let e=0;e<a;e++){let n=i[e],r=Object.hasOwn(l,n.name)?O(l[n.name]):D(),a=n.parser(r,c),o=Os(a)?a:yield*yp(a);if(o._tag===`Failure`){let e=ju(o.cause);if(k(e))return yield*o;let r=new uh([n.name],e.success);if(f){d?d.push(r):d=[r];continue}else return yield*R(new ph(t,s,[r]))}else if(o.value._tag===`Some`)Rm(u,n.name,o.value.value);else if(!T_(n.type)){let e=new uh([n.name],new dh(n.type.context?.annotations));if(f){d?d.push(e):d=[e];continue}else return yield*R(new ph(t,s,[e]))}}if(o>0)for(let n=0;n<o;n++){let r=t.indexSignatures[n],i=Fg(l,r.parameter);for(let n=0;n<i.length;n++){let a=i[n],o=e(R_(r.parameter))(O(a),c),p=Os(o)?o:yield*yp(o);if(p._tag===`Failure`){let e=ju(p.cause);if(k(e))return yield*p;let n=new uh([a],e.success);if(f){d?d.push(n):d=[n];continue}return yield*R(new ph(t,s,[n]))}let m=O(l[a]),h=e(r.type)(m,c),g=Os(h)?h:yield*yp(h);if(g._tag===`Failure`){let e=ju(g.cause);if(k(e))return yield*g;let n=new uh([a],e.success);if(f){d?d.push(n):d=[n];continue}else return yield*R(new ph(t,s,[n]))}else if(p.value._tag===`Some`&&g.value._tag===`Some`){let e=p.value.value,t=g.value.value;if(r.merge&&r.merge.decode&&Object.hasOwn(u,e)){let[n,i]=r.merge.decode.combine([e,u[e]],[e,t]);Rm(u,n,i)}else Rm(u,e,t)}}}if(d)return yield*R(new ph(t,s,d));if(c.propertyOrder===`original`){let e=(h??Reflect.ownKeys(l)).concat(n),t={};for(let n of e)Object.hasOwn(u,n)&&Rm(t,n,u[n]);return O(t)}return O(u)})}rebuild(t,n){let r=__(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new Ig(e.name,n)}),i=__(this.indexSignatures,e=>{let r=t(e.parameter),i=t(e.type),a=n?e.merge?.flip():e.merge;return r===e.parameter&&i===e.type&&a===e.merge?e:new Rg(r,i,a)});return r===this.propertySignatures&&i===this.indexSignatures?this:new e(r,i,this.annotations,this.checks,void 0,this.context)}flip(e){return this.rebuild(e,!0)}recur(e){return this.rebuild(e,!1)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};function Bg(e,t,n){return new zg(Reflect.ownKeys(e).map(t=>new Ig(t,e[t].ast)),[],n,t)}function Vg(e){return e.ast}function Hg(e,t=void 0){return new Mg(!1,e.map(e=>e.ast),[],void 0,t)}function Ug(e,t,n){return new Xg(e.map(Vg),t,void 0,n)}function Wg(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:case`Void`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`object`,`array`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(Wg)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Gg(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[`~sentinels`];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!T_(t)){if(sg(t))return[{key:e.name,literal:t.literal}];if(cg(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>sg(e)&&!T_(e)?[{key:t,literal:e.literal}]:[]);case`Suspend`:return Gg(e.thunk())}}const Kg=new WeakMap;function qg(e){let t=Kg.get(e);if(t)return t;t={};for(let n of e){let e=D_(n);if(og(e))continue;let r=Wg(e),i=Gg(e);t.byType??={};for(let e of r)(t.byType[e]??=[]).push(n);if(i.length>0){t.bySentinel??=new Map;for(let{key:e,literal:r}of i){let i=t.bySentinel.get(e);i||t.bySentinel.set(e,i=new Map);let a=i.get(r);a||i.set(r,a=[]),a.push(n)}}else{t.otherwise??={};for(let e of r)(t.otherwise[e]??=[]).push(n)}}return Kg.set(e,t),t}function Jg(e){return t=>{let n=D_(t);return n._tag===`Literal`?n.literal===e:n._tag===`UniqueSymbol`?n.symbol===e:!0}}function Yg(e,t){let n=qg(t),r=e===null?`null`:Array.isArray(e)?`array`:typeof e;if(n.bySentinel){let t=n.otherwise?.[r]??[];if(r===`object`||r===`array`){for(let[r,i]of n.bySentinel)if(Object.hasOwn(e,r)){let n=i.get(e[r]);if(n)return[...n,...t].filter(Jg(e))}}return t}return(n.byType?.[r]??[]).filter(Jg(e))}var Xg=class e extends gg{_tag=`Union`;types;mode;constructor(e,t,n,r,i,a){super(n,r,i,a),this.types=e,this.mode=t}getParser(e){let t=this;return Lm(function*(n,r){if(n._tag===`None`)return n;let i=n.value,a=t.mode===`oneOf`,o=Yg(i,t.types),s,c={out:void 0,successes:[]};for(let l=0;l<o.length;l++){let u=o[l],d=e(u)(n,r),f=Os(d)?d:yield*yp(d);if(f._tag===`Failure`){let e=ju(f.cause);if(k(e))return yield*f;s?s.push(e.success):s=[e.success];continue}else{if(c.out&&a)return c.successes.push(u),yield*R(new _h(t,i,c.successes));if(c.out=f.value,c.successes.push(u),!a)break}}return c.out?c.out:yield*R(new gh(t,i,s??[]))})}recur(t){let n=__(this.types,t);return n===this.types?this:new e(n,this.mode,this.annotations,this.checks,void 0,this.context)}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=D_(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(sg);if(t.length>0)return`${$g(n.isMutable)}[ ${t.map(t=>e(t)+e_(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>sg(e.type));if(t.length>0)return`{ ${t.map(t=>`${$g(t.type.context?.isMutable)}${Tt(t.name)}${e_(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};const Zg=new Xg([new wg(`Infinity`),new wg(`-Infinity`),new wg(`NaN`)],`anyOf`),Qg=new fg(new Xg([kg,Zg],`anyOf`),new Wh(Rh(),U(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function $g(e){return e?``:`readonly `}function e_(e){return e?`?`:``}function t_(e){let t=!1,n;return()=>t?n:(n=e(),t=!0,n)}var n_=class e extends gg{_tag=`Suspend`;thunk;constructor(e,t,n,r,i){super(t,n,r,i),this.thunk=t_(e)}getParser(e){return e(this.thunk())}recur(t){return new e(()=>t(this.thunk()),this.annotations,this.checks,void 0,this.context)}getExpected(e){return e(this.thunk())}},r_=class e extends re{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new i_([this,e],t)}},i_=class e extends re{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function a_(e,t,n=!1){return new r_((t,n,r)=>vh(t,e(t,n,r)),t,n)}function o_(e,t){let n=e.source;return a_(t=>e.test(t),{expected:`a string matching the RegExp ${n}`,meta:{_tag:`isPattern`,regExp:e},toArbitraryConstraint:{string:{patterns:[e.source]}},...t})}function s_(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function c_(e,t){return e.encoding===t?e:s_(e,e=>{e.encoding.value=t})}function l_(e,t){return e.context===t?e:s_(e,e=>{e.context.value=t})}function u_(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return d_(e,Hr(e.checks.slice(0,-1),n.annotate(t)))}return s_(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function d_(e,t){return e.checks===t?e:s_(e,e=>{e.checks.value=t})}function f_(e,t){return d_(e,e.checks?[...e.checks,...t]:t)}function p_(e,t){let n=e,r=n[n.length-1],i=t(r.to);return i===r.to?e:Hr(e.slice(0,e.length-1),new fg(i,r.transformation))}function m_(e){return t=>t.encoding?c_(t,p_(t.encoding,e)):t}function h_(e,t,n){let r=new fg(e,t);return c_(n,n.encoding?[...n.encoding,r]:[r])}function g_(e,t){let n=Hm(e);return u_(e,{brands:n?[...n,t]:[t]})}function __(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function v_(e,t){return l_(e,e.context?new mg(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new mg(!1,!1,void 0,t))}const y_=m_(b_);function b_(e){return y_(l_(e,e.context?e.context.isOptional===!1?new mg(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new mg(!0,!1)))}function x_(e,t){let n=[new fg(Cg,new Wh(new Ah(e=>{if(fr(wr(e,Se))){let n=t(e);return ep(n)?n:F(n)}else return F(e)}),Nh()))];return l_(e,e.context?new mg(e.context.isOptional,e.context.isMutable,n,e.context.annotations):new mg(!1,!1,n))}function S_(e,t,n){return h_(e,n,t)}function C_(e){switch(e._tag){case`Literal`:return{literals:be(e.literal)?[e.literal]:[],parameters:[]};case`UniqueSymbol`:return{literals:[e.symbol],parameters:[]};case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return{literals:[],parameters:[e]};case`Union`:{let t={literals:[],parameters:[]};for(let n=0;n<e.types.length;n++){let r=C_(e.types[n]);t.literals=t.literals.concat(r.literals),t.parameters=t.parameters.concat(r.parameters)}return t}}return{literals:[],parameters:[]}}function w_(e,t,n){let{literals:r,parameters:i}=C_(e);return new zg(r.map(e=>new Ig(e,t)),i.map(e=>new Rg(e,t,n)))}function T_(e){return e.context?.isOptional??!1}const E_=fe(e=>{if(e.encoding)return E_(c_(e,void 0));let t=e;return t.recur?.(E_)??t}),D_=fe(e=>E_(k_(e)));function O_(e,t){let n=t,r=n.length,i=n[r-1],a=[new fg(k_(c_(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new fg(k_(n[e-1].to),n[e].transformation.flip()));let o=k_(i.to);return o.encoding?c_(o,[...o.encoding,...a]):c_(o,a)}const k_=fe(e=>{if(e.encoding)return O_(e,e.encoding);let t=e;return t.flip?.(k_)??t.recur?.(k_)??t});function A_(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(A_);default:return!1}}function j_(e,t){return e.encodedParts.map(e=>P_(e,N_(e),t)).join(``)}const M_=fe(e=>new globalThis.RegExp(`^${j_(e,!0)}$`));function N_(e){switch(e._tag){case`Literal`:return Wm(globalThis.String(e.literal));case`String`:return z_;case`Number`:return Ng;case`BigInt`:return G_;case`TemplateLiteral`:return j_(e,!1);case`Union`:return e.types.map(N_).join(`|`)}}function P_(e,t,n){if(dg(e)){if(!n)return`(?:${t})`}else if(!n)return t;return`(${t})`}function F_(e,t){let n=sp(t);return r=>r._tag===`None`?op:r.value===t?n:R(new mh(e,r))}function I_(e,t){return n=>n._tag===`None`?op:t(n.value)?F(n):R(new mh(e,n))}function L_(e){function t(n){return n.encoding?c_(n,p_(n.encoding,t)):e(n)}return fe(t)}const R_=L_(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(R_)}}),z_=`[\\s\\S]*?`,B_=new globalThis.RegExp(`^${Ng}$`);function V_(e){return o_(B_,{expected:`a string representing a finite number`,meta:{_tag:`isStringFinite`,regExp:B_},...e})}const H_=f_(Eg,[V_()]),U_=new fg(H_,Zh),W_=new fg(new Xg([H_,Zg],`anyOf`),Zh),G_=`-?\\d+`,K_=new globalThis.RegExp(`^${G_}$`);function q_(e){return o_(K_,{expected:`a string representing a bigint`,meta:{_tag:`isStringBigInt`,regExp:K_},...e})}const J_=new fg(f_(Eg,[q_()]),Qh);function Y_(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`)Y_(o.checks,t,n,r,i);else{let e=o.run(t,r,i);if(e&&(n.push(new ch(t,o,e)),o.aborted||i?.errors!==`all`))return}}}const X_=`~effect/Schema/Class`;function Z_(e){let t=new Set;return n(e);function n(e){return e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?globalThis.Number.isFinite(e):typeof e!=`object`||e===void 0||t.has(e)?!1:(t.add(e),Array.isArray(e)?e.every(n):Object.keys(e).every(t=>n(e[t])))}}const Q_=new _g([],()=>(e,t)=>Z_(e)?F(e):R(new mh(t,O(e))),{typeConstructor:{_tag:`effect/Json`},generation:{runtime:`Schema.Json`,Type:`Schema.Json`},expected:`JSON value`,toCodecJson:()=>new fg(Cg,Xh())}),$_=new fg(vg,new Wh(Nh(),U(()=>null))),ev=new fg(Q_,Xh());function tv(e){let t=new Set;return n(e);function n(e){return e===void 0||typeof e==`string`?!0:typeof e!=`object`||!e||t.has(e)?!1:(t.add(e),Array.isArray(e)?e.every(n):Object.keys(e).every(t=>n(e[t])))}}const nv=new fg(new _g([],()=>(e,t)=>tv(e)?F(e):R(new mh(t,O(e))),{expected:`StringTree`,toCodecStringTree:()=>new fg(Cg,Xh())}),Xh()),rv=`~effect/collections/MutableHashMap`,iv={[rv]:rv,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${Ct(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:jt(Array.from(this))}},[At](){return this.toJSON()},pipe(){return y(this,arguments)}},av=()=>{let e=Object.create(iv);return e.backing=new Map,e.buckets=new Map,e},ov=b(2,(e,t)=>{if(e.backing.has(t))return O(e.backing.get(t));if(cv(t))return D();let n=sv.get(e);if(n!==void 0)return e.backing.has(n)?O(e.backing.get(n)):D();let r=C(t),i=e.buckets.get(r);return i===void 0?D():uv(e,i,t)}),sv=new WeakMap,cv=e=>typeof e!=`object`&&typeof e!=`function`,lv=e=>e.backing.values(),uv=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(Ye(n,t[r])){let i=t[r];return sv.set(n,i),O(e.backing.get(i))}return D()},dv=b(2,(e,t)=>pr(ov(e,t))),fv=b(3,(e,t,n)=>{if(e.backing.has(t)||cv(t))return e.backing.set(t,n),e;let r=sv.get(e);if(r!==void 0&&e.backing.has(r))return e.backing.set(r,n),e;let i=C(t),a=e.buckets.get(i);return a===void 0?(e.buckets.set(i,[t]),e.backing.set(t,n),e):(r=pv(a,t),r===void 0&&(a.push(t),r=t),e.backing.set(r,n),e)}),pv=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(Ye(t,e[n]))return sv.set(t,e[n]),e[n]},mv=b(2,(e,t)=>{if(cv(t))return e.backing.delete(t),e;let n=sv.get(e)??t,r=C(n),i=e.buckets.get(r);if(i===void 0)return e;for(let t=0,r=i.length;t<r;t++){let r=i[t];if(r===n||Ye(n,r)){e.backing.delete(r),i.splice(t,1);break}}return i.length===0&&e.buckets.delete(r),e}),hv=Bo,gv=Ho,_v=Uo,vv=Wo,yv=Ko,bv=Io,xv=Cl,Sv=Rl,Cv=Symbol.for(`effect/MutableList/Empty`),wv=()=>({head:void 0,tail:void 0,length:0}),Tv=()=>({array:[],mutable:!0,offset:0,next:void 0}),Ev=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=Tv(),e.tail=e.tail.next):e.head=e.tail=Tv(),e.tail.array.push(t),e.length++},Dv=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.length++},Ov=e=>{e.head=e.tail=void 0,e.length=0},kv=(e,t)=>{if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let t=e.head.array;return Ov(e),t}let n=Array(t),r=0,i=e.head;for(;i;){for(;i.offset<i.array.length;)if(n[r++]=i.array[i.offset],i.mutable&&(i.array[i.offset]=void 0),i.offset++,r===t)return e.head=i,e.length-=t,e.length===0&&Ov(e),n;i=i.next}return Ov(e),n},Av=e=>kv(e,e.length),jv=e=>{if(!e.head)return Cv;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length&&(e.head.next?e.head=e.head.next:Ov(e)),t},Mv=(e,t)=>{let n=[],r=e.head;for(;r;){for(let e=r.offset;e<r.array.length;e++)t(r.array[e],e)&&n.push(r.array[e]);r=r.next}e.head=e.tail={array:n,mutable:!0,offset:0,next:void 0}},Nv=(e,t)=>Mv(e,e=>e!==t),Pv=`~effect/MutableRef`,Fv={[Pv]:Pv,...Yt,toJSON(){return{_id:`MutableRef`,current:jt(this.current)}}},Iv=e=>{let t=Object.create(Fv);return t.current=e,t},Lv=b(2,(e,t)=>(e.current=t,e)),Rv=e=>I(()=>ty(e.atomicPubSub(),new Map,sd(),Sv(!1),Iv(!1),e.strategy())),zv=e=>Rv({atomicPubSub:()=>Bv(e),strategy:()=>new ny}),Bv=e=>new Zv(e?.replay?new ay(e.replay):void 0),Vv=b(2,(e,t)=>cp(()=>e.shutdownFlag.current?tm:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),F(!0)):e.strategy.handleSurplus(e.pubsub,e.subscribers,[t],e.shutdownFlag))),Hv=b(2,(e,t)=>e.shutdownFlag.current?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),Uv=e=>Xp(I(()=>Xv(e.pubsub,e.subscribers,e.strategy)),Wv),Wv=e=>rm(hp(t=>(Lv(e.shutdownFlag,!0),np(Av(e.pollers),e=>nd(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(vp(()=>I(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),zp(e.shutdownHook.open),xp)))),Gv=e=>cp(function t(n){if(e.shutdownFlag.current)return tm;let r=e.pollers.length===0?e.subscription.pollUpTo(1/0):[];return n&&(r=n.concat(r)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?F(e.replayWindow.takeAll().concat(r)):Kr(r)?F(r):z(Kv(e),e=>t([e]))}),Kv=e=>{let t=Yu(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),Ev(e.pollers,t),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),nm(Zu(t),()=>(Nv(e.pollers,t),lp))},qv=Symbol.for(`effect/PubSub/AbsentValue`),Jv=(e,t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},Yv=(e,t,n)=>{if(!e.has(t))return;let r=e.get(t);r.delete(n),r.size===0&&e.delete(t)},Xv=(e,t,n)=>new $v(e,t,e.subscribe(),wv(),Sv(!1),Iv(!1),n,e.replayWindow());var Zv=class{publisherHead={value:qv,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=2**53-1;replayBuffer;constructor(e){this.replayBuffer=e}replayWindow(){return this.replayBuffer?new oy(this.replayBuffer):sy}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(e){let t=this.publisherTail.subscribers;return t!==0&&(this.publisherTail.next={value:e,subscribers:t,next:null},this.publisherTail=this.publisherTail.next,this.publisherIndex+=1),this.replayBuffer&&this.replayBuffer.offer(e),!0}publishAll(e){if(this.publisherTail.subscribers!==0)for(let t of e)this.publish(t);else this.replayBuffer&&this.replayBuffer.offerAll(e);return[]}slide(){this.publisherHead!==this.publisherTail&&(this.publisherHead=this.publisherHead.next,this.publisherHead.value=qv,this.subscribersIndex+=1),this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.publisherTail.subscribers+=1,new Qv(this,this.publisherTail,this.publisherIndex,!1)}},Qv=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(e,t,n,r){this.self=e,this.subscriberHead=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){if(this.unsubscribed)return!0;let e=!0,t=!0;for(;t;)this.subscriberHead===this.self.publisherTail?t=!1:this.subscriberHead.next.value===qv?(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1):(e=!1,t=!1);return e}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return Cv;let e=!0,t=Cv;for(;e;)if(this.subscriberHead===this.self.publisherTail)e=!1;else{let n=this.subscriberHead.next.value;n!==qv&&(t=n,--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=qv,this.self.subscribersIndex+=1),e=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return t}pollUpTo(e){let t=[],n=0;for(;n!==e;){let r=this.poll();r===Cv?n=e:(t.push(r),n+=1)}return t}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,--this.self.publisherTail.subscribers;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==qv&&(--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=qv,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},$v=class{"~effect/PubSub/Subscription"={_A:x};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;constructor(e,t,n,r,i,a,o,s){this.pubsub=e,this.subscribers=t,this.subscription=n,this.pollers=r,this.shutdownHook=i,this.shutdownFlag=a,this.strategy=o,this.replayWindow=s}pipe(){return y(this,arguments)}},ey=class{"~effect/PubSub"={_A:x};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;constructor(e,t,n,r,i,a){this.pubsub=e,this.subscribers=t,this.scope=n,this.shutdownHook=r,this.shutdownFlag=i,this.strategy=a}pipe(){return y(this,arguments)}};const ty=(e,t,n,r,i,a)=>new ey(e,t,n,r,i,a);var ny=class{get shutdown(){return lp}handleSurplus(e,t,n,r){return F(!1)}onPubSubEmptySpaceUnsafe(e,t){}completePollersUnsafe(e,t,n,r){return ry(this,e,t,n,r)}completeSubscribersUnsafe(e,t){return iy(this,e,t)}};const ry=(e,t,n,r,i)=>{let a=!0;for(;a&&!r.isEmpty();){let o=jv(i);if(o===Cv)Yv(n,r,i),i.length===0?a=!1:Jv(n,r,i);else{let a=r.poll();a===Cv?Dv(i,o):(id(o,Vu(a)),e.onPubSubEmptySpaceUnsafe(t,n))}}},iy=(e,t,n)=>{for(let[r,i]of n)for(let a of i)e.completePollersUnsafe(t,n,r,a)};var ay=class{capacity;head={value:qv,next:null};tail=this.head;size=0;index=0;constructor(e){this.capacity=e}slide(){this.index++}offer(e){this.tail.value=e,this.tail.next={value:qv,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1}offerAll(e){for(let t of e)this.offer(t)}},oy=class{head;index;remaining;buffer;constructor(e){this.buffer=e,this.index=e.index,this.remaining=e.size,this.head=e.head}fastForward(){for(;this.index<this.buffer.index;)this.head=this.head.next,this.index++}take(){if(this.remaining===0)return;this.index<this.buffer.index&&this.fastForward(),this.remaining--;let e=this.head.value;return this.head=this.head.next,e}takeN(e){if(this.remaining===0)return[];this.index<this.buffer.index&&this.fastForward();let t=Math.min(e,this.remaining),n=Array(t);for(let e=0;e<t;e++){let t=this.head.value;this.head=this.head.next,n[e]=t}return this.remaining-=t,n}takeAll(){return this.takeN(this.remaining)}};const sy={remaining:0,take:()=>void 0,takeN:()=>[],takeAll:()=>[]},cy={_A:x,_E:x},ly={"~effect/Queue":cy,"~effect/Queue/Enqueue":cy,"~effect/Queue/Dequeue":cy,...Yt,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:Cy(this)}}},uy=e=>E(t=>{let n=Object.create(ly);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=wv(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},j(n)}),dy=e=>uy({capacity:e}),fy=()=>uy(),py=(e,t)=>M(()=>{if(e.state._tag!==`Open`)return Ty;if(e.messages.length>=e.capacity)switch(e.strategy){case`dropping`:return Ty;case`suspend`:return e.capacity<=0&&e.state.takers.size>0?(Ev(e.messages,t),ky(e),Ey):My(e,t);case`sliding`:return jv(e.messages),Ev(e.messages,t),Ey}return Ev(e.messages,t),Ay(e),Ey}),my=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(jv(e.messages),Ev(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(Ev(e.messages,t),ky(e),!0):!1:(Ev(e.messages,t),Ay(e),!0):!1,hy=b(2,(e,t)=>Yo(()=>gy(e,t))),gy=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=Ws(En(t),Dy);return e.state.offers.size===0&&e.messages.length===0?(Fy(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},!0)},_y=e=>hy(e,pn(Ln())),vy=e=>Yo(()=>{if(e.state._tag===`Done`)return!0;Ov(e.messages);let t=e.state.offers;if(Fy(e,e.state._tag===`Open`?Oy:e.state.exit),t.size>0){for(let e of t)e._tag===`Single`?e.resume(Ty):e.resume(T(e.remaining.slice(e.offset)));t.clear()}return!0}),yy=e=>by(e,1,1/0),by=(e,t,n)=>M(()=>jy(e,t,n)??Ss(Py(e),by(e,1,n))),xy=e=>M(()=>Sy(e)??Ss(Py(e),xy(e))),Sy=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=jv(e.messages);return Ny(e),T(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Ny(e),e.capacity=0;let t=jv(e.messages);return Ny(e),T(t)}},Cy=e=>e.state._tag===`Done`?0:e.messages.length,wy=b(2,(e,t)=>dl(n=>xc(n(e),{onFailure:e=>hy(t,e),onSuccess:e=>_y(t)}))),Ty=T(!1),Ey=T(!0),Dy=Dn(Ln()),Oy=Is(),ky=e=>{if(e.scheduleRunning=!1,!(e.state._tag===`Done`||e.state.takers.size===0)){for(let t of e.state.takers)if(e.state.takers.delete(t),t(Bs),e.messages.length===0)break}},Ay=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>ky(e),0))},jy=(e,t,n)=>{if(e.state._tag===`Done`)return e.state.exit;if(n<=0||t<=0)return T([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Ny(e),e.capacity=0;let t=[jv(e.messages)];return Ny(e),T(t)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let t=kv(e.messages,n);return Ny(e),T(t)}},My=(e,t)=>ls(n=>{if(e.state._tag!==`Open`)return n(Ty);let r={_tag:`Single`,message:t,resume:n};return e.state.offers.add(r),Yo(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),Ny=e=>{if(e.state._tag===`Done`)return Cf(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0?(Fy(e,e.state.exit),Cf(e.state.exit.cause)):!1;let t=e.capacity-e.messages.length;for(let n of e.state.offers)if(t===0)break;else if(n._tag===`Single`)Ev(e.messages,n.message),t--,n.resume(Ey),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;Ev(e.messages,n.remaining[n.offset]),t--}n.resume(T([])),e.state.offers.delete(n)}return!1},Py=e=>ls(t=>e.state._tag===`Done`?t(e.state.exit):(e.state.takers.add(t),Yo(()=>{e.state._tag!==`Done`&&e.state.takers.delete(t)}))),Fy=(e,t)=>{if(e.state._tag===`Done`)return;let n=e.state;e.state={_tag:`Done`,exit:t};for(let e of n.takers)e(t);n.takers.clear();for(let e of n.awaiters)e(t);n.awaiters.clear()},Iy=e=>new Ly(e);var Ly=class{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=M(()=>this.free<e?ls(n=>{if(this.free>=e)return n(t);let r=()=>{this.free<e||(this.waiters.delete(r),n(t))};return this.waiters.add(r),Yo(()=>{this.waiters.delete(r)})}):(this.taken+=e,j(e)));return t}updateTakenUnsafe(e,t){return this.taken=t(this.taken),this.waiters.size>0&&e.currentDispatcher.scheduleTask(()=>{let e=this.waiters.values(),t=e.next();for(;t.done===!1&&this.free>0;)t.value(),t=e.next()},0),this.free}updateTaken(e){return E(t=>j(this.updateTakenUnsafe(t,e)))}resize(e){return E(t=>(this.permits=e,this.free<0||this.updateTakenUnsafe(t,e=>e),ts))}release(e){return this.updateTaken(t=>t-e)}get releaseAll(){return this.updateTaken(e=>0)}withPermits(e){return t=>dl(n=>N(n(this.take(e)),e=>Qc(n(t),()=>{this.updateTakenUnsafe(Io(),t=>t-e)},!0)))}get withPermit(){return this.withPermits(1)}withPermitsIfAvailable(e){return t=>dl(n=>this.free<e?Qo:(this.taken+=e,Qc(n(xs(t)),()=>{this.updateTakenUnsafe(Io(),t=>t-e)},!0)))}};const Ry=`~effect/Channel`,zy=e=>S(e,Ry),By={[Ry]:{_Env:x,_InErr:x,_InElem:x,_OutErr:x,_OutElem:x},pipe(){return y(this,arguments)}},Vy=e=>{let t=Object.create(By);return t.transform=(t,n)=>V(e(t,n),e=>F(fp(e))),t},Hy=(e,t)=>Vy((n,r)=>z(Gy(e)(n,r),e=>t(e,r))),Uy=e=>Vy((t,n)=>e),Wy=e=>Vy(Tm(function*(t,n){let r=fd(n),i=e=>pd(r,Of(e));return $p(yield*$p(e(t,n,r),i),i)})),Gy=e=>e.transform,Ky=(e,t,n)=>uy({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(vp(t=>ud(e,vy(t))),vp(n=>lm(cd(t(n),e),e))),qy=(e,t)=>Vy((n,r)=>B(Ky(r,e,t),yy)),Jy=e=>Vy((t,n)=>cp(()=>Gy(e())(t,n))),Yy=Uy(F(Ru())),Xy=e=>Uy(F(R(e))),Zy=e=>Uy(fp(e)),Qy=e=>Zy(Du(e)),$y=e=>Uy(z(e,()=>Ru())),eb=e=>Uy(F(yy(e))),tb=e=>Uy(F(nm(Gv(e),()=>Ru()))),nb=e=>yb(B(Uv(e),tb)),rb=b(2,(e,t)=>Hy(e,e=>I(()=>{let n=0;return B(e,e=>t(e,n++))}))),ib=e=>e===void 0||e!==`unbounded`&&e<=1,ab=b(e=>zy(e[0]),(e,t,n)=>ib(n?.concurrency)?ob(e,t):sb(e,t,n)),ob=(e,t)=>Vy((n,r)=>{let i=0;return B(Gy(e)(n,r),z(e=>t(e,i++)))}),sb=(e,t,n)=>Wy(Tm(function*(r,i,a){let o=0,s=yield*Gy(e)(r,i),c=n.concurrency===`unbounded`?2**53-1:n.concurrency,l=yield*dy(0);yield*ud(a,vy(l));let u=mm(yield*Vp()),d=xv(a);if(n.unordered){let e=Iy(c),n=ie(e.release(1)),r=Bp({onFailure:e=>z(hy(l,e),n),onSuccess:e=>z(py(l,e),n)});yield*e.take(1).pipe(z(()=>s),z(e=>(d(u(r(t(e,o++)))),lp)),im({disableYield:!0}),V(t=>e.withPermits(c-1)(hy(l,t))),lm(a))}else{let e=yield*dy(c-2);yield*ud(a,vy(l)),yield*xy(e).pipe(gp,z(e=>py(l,e)),im({disableYield:!0}),V(e=>hy(l,e)),lm(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,gy(l,e.cause))};yield*s.pipe(z(i=>{if(n)return fp(n);let a=u(t(i,o++));return d(a),a.addObserver(r),py(e,gv(a))}),im({disableYield:!0}),V(t=>py(e,Hu(t)).pipe(_p(hy(e,t)))),lm(a))}return xy(l)})),cb=e=>Hy(e,e=>{let t,n=0;return F(cp(function r(){if(t===void 0)return z(e,e=>{switch(e.length){case 0:return r();case 1:return F(e[0]);default:return t=e,F(e[n++])}});let i=t[n++];return n>=t.length&&(t=void 0,n=0),F(i)}))}),lb=b(2,(e,t)=>Hy(e,e=>F(z(e,function n(r){let i=[];for(let e=0;e<r.length;e++)t(r[e])&&i.push(r[e]);return qr(i)?F(i):z(e,n)})))),ub=b(e=>zy(e[0]),(e,t,n,r)=>Vy((i,a)=>B(Gy(e)(i,a),e=>{let i=t(),a,o=0,s,c=Bp(e,{onFailure(e){s=e;let t=r?.onHalt&&r.onHalt(i);return t&&t.length>0?F([i,t]):fp(e)},onSuccess(e){let t=n(i,e);return Wr(t)?F(t):t}});return cp(function e(){if(a===void 0)return s?fp(s):z(c,([t,n])=>(i=t,n.length===0?e():n.length===1?F(n[0]):(a=n,e())));let t=a[o++];return o>=a.length&&(a=void 0,o=0),F(t)})}))),db=b(2,(e,t)=>Vy((n,r)=>{let i=fd(r);return B(Gy(e)(n,i),e=>{let a=e.pipe(V(e=>{if(Cf(e))return fp(e);let o=i;return i=fd(r),pd(o,Hu(e)).pipe(_p(Gy(t(e))(n,i)),z(e=>(a=e,e)))}));return cp(()=>a)})})),fb=b(2,(e,t)=>db(e,e=>$y(z(t(e),t=>fp(e))))),pb=b(3,(e,t,n)=>db(e,e=>{let r=t(e);return k(r)?Zy(r.failure):n(r.success,e)})),mb=b(2,(e,t)=>pb(e,ju,e=>t(e))),hb=b(2,(e,t)=>mb(e,e=>Xy(t(e)))),gb=e=>mb(e,Qy),_b=()=>Vy((e,t)=>I(()=>{let t=``,n=!1,r=e=>{let r=[];for(let i=0;i<e.length;i++){let a=e[i];if(a.length!==0){let e=0,i=a.indexOf(`\r`),o=a.indexOf(`
17
17
  `);for(n&&=(o===0?(r.push(t),t=``,e=1,o=a.indexOf(`
18
18
  `,e)):t+=`\r`,!1);i!==-1||o!==-1;)i===-1||o!==-1&&o<i?(t.length===0?r.push(a.substring(e,o)):(r.push(t+a.substring(e,o)),t=``),e=o+1,o=a.indexOf(`
19
19
  `,e)):a.length===i+1?(n=!0,i=-1):o===i+1?(t.length===0?r.push(a.substring(e,i)):(t+=a.substring(e,i),r.push(t),t=``),e=i+2,i=a.indexOf(`\r`,e),o=a.indexOf(`
20
- `,e)):i=a.indexOf(`\r`,i+1);n?t+=a.substring(e,a.length-1):t+=a.substring(e,a.length)}}return Yr(r)?r:null};return z(e,function t(n){let i=r(n);return i===null?z(e,t):P(i)})})),Lb=b(2,(e,t)=>rb((n,r)=>z(sb(e)(n,r),e=>sb(t)(e,r)))),Rb=e=>rb((t,n)=>{let r;return P(vp(()=>r||e.pipe(_d(n),z(e=>sb(e)(t,n)),z(e=>r=e))))}),zb=b(2,(e,t)=>ob((n,r,i)=>vd(i,t).pipe(Ep(sb(e)(n,r))))),Bb=b(2,(e,t)=>ib(e,e=>F(()=>{let n=!0,r=Dp(e,e=>(n=!1,t(e)));return vp(()=>n?r:e)}))),Vb=b(2,(e,t)=>zb(e,e=>t)),Hb=(e,t,n)=>vp(()=>{let r=gd();return Mf(z(sb(e)(Wu(),r),t),n||P).pipe(fm(e=>Sd(r,e)))}),Ub=e=>Hb(e,e=>_m(e,{disableYield:!0})),Wb=b(2,(e,t)=>Hb(e,e=>_m(z(e,t),{disableYield:!0}))),Gb=e=>vp(()=>{let t=Symbol(),n=t;return Hb(e,e=>_m(z(e,e=>(n=e,I)),{disableYield:!0}),()=>n===t?gp:_p(n))}),Kb=b(3,(e,t,n)=>vp(()=>{let r=t();return Hb(e,e=>pp({while:ae,body:()=>e,step:e=>{r=n(r,e)}}),()=>P(r))})),qb=Rm(function*(e){let t=Qy(1),n=yield*Qp(),r=Da(n,hd);return(yield*sb(e)(Wu(),r)).pipe(tm(n),t.withPermits(1))},V(e=>P(xp(e)))),Jb=(e,t)=>sb(e)(Wu(),t),Yb=e=>e,Xb=fe(e=>{switch(e._tag){case`Declaration`:{let t=e.annotations?.[uv];if(xe(t)){let n=t(e.typeParameters),r=Xb(n.to);return S_(e,r===n.to?[n]:[new Eg(r,n.transformation)])}return e}case`Objects`:case`Arrays`:return e.recur(e=>{let t=e.context?.defaultValue;return t?S_(Xb(e),t):Xb(e)});case`Suspend`:return e.recur(Xb);default:return e}});function Zb(e){let t=sx(Xb(B_(e.ast)));return(e,n)=>t(e,n?.parseOptions)}function Qb(e){let t=Zb(e);return(e,n)=>ed(Im(t(e,n)))}function $b(e){let t=Zb(e);return(e,n)=>Pm(qm(t(e,n),e=>Error(e.toString(),{cause:e})))}function ex(e){return tx(e.ast)}function tx(e){let t=cx(sx(B_(e)));return e=>Qu(t(e,Dg))}function nx(e){return sx(e.ast)}function rx(e){return lx(nx(e))}function ix(e){return ux(nx(e))}const ax=ix;function ox(e){return sx(U_(e.ast))}function sx(e){let t=dx(e);return(e,n)=>Ym(t(O(e),n??Dg),e=>e._tag===`None`?R(new kh(e)):P(e.value))}function cx(e){return(t,n)=>Im(e(t,n))}function lx(e){let t=cx(e);return(e,n)=>ed(t(e,n))}function ux(e){return(t,n)=>Pm(qm(e(t,n),e=>Error(e.toString(),{cause:e})))}const dx=fe(e=>{let t;if(!e.context&&!e.encoding&&!e.checks)return(n,r)=>(t??=e.getParser(dx),t(n,$m(e)?.parseOptions??r));let n=Cg(e)||wg(e)||yg(e)&&e.typeParameters.length>0;return(r,i)=>{i=$m(e)?.parseOptions??i;let a=e.encoding,o;if(a){let t=a,n=t.length;for(let e=n-1;e>=0;e--){let n=t[e],a=n.to,s=dx(a);if(o=o?Ym(o,e=>s(e,i)):s(r,i),n.transformation._tag===`Transformation`){let e=n.transformation.decode;o=Ym(o,t=>e.run(t,i))}else o=n.transformation.decode(o,i)}o=qm(o,t=>new Ch(e,r,t))}t??=e.getParser(dx);let s=o?Ym(o,e=>t(e,i)):t(r,i);if(e.checks){let t=e.checks;i?.errors===`all`&&n&&mr(r)&&(s=Xm(s,n=>{let a=[];return lv(t.filter(e=>e.annotations?.[`~structural`]),r.value,a,e,i),R(Jr(a)?n._tag===`Composite`&&n.ast===e?new Dh(e,n.actual,[...n.issues,...a]):new Dh(e,r,[n,...a]):n)})),s=Ym(s,n=>{if(mr(n)){let r=n.value,a=[];if(lv(t,r,a,e,i),Jr(a))return R(new Dh(e,n,a))}return P(n)})}return s}}),fx=`~effect/Schema/Schema`,px={[fx]:fx,pipe(){return y(this,arguments)},annotate(e){return this.rebuild(w_(this.ast,e))},annotateKey(e){return this.rebuild(M_(this.ast,e))},check(...e){return this.rebuild(E_(this.ast,e))}};function mx(e,t){let n=Object.create(px);return t&&Object.assign(n,t),n.ast=e,n.rebuild=e=>mx(e,t),n.makeUnsafe=$b(n),n.makeOption=Qb(n),n}const hx=Z_(e=>{let t=gx(e);return t!==e&&z_(e)?N_(t):t});function gx(e){switch(e._tag){case`Declaration`:{let t=e.annotations?.toCodecJson??e.annotations?.toCodec;if(xe(t)){let n=t(yg(e)?e.typeParameters.map(e=>mx(V_(e))):[]),r=hx(n.to);return S_(e,r===n.to?[n]:[new Eg(r,n.transformation)])}return S_(e,[pv])}case`Unknown`:case`ObjectKeyword`:return S_(e,[mv]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e});return e.recur(hx);case`Union`:{let t=_x(e.types);return t===e.types?e.recur(hx):new u_(t,e.mode,e.annotations,e.checks,e.encoding,e.context).recur(hx)}case`Arrays`:case`Suspend`:return e.recur(hx)}return e}const _x=yx(vx);function vx(e){switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}}function yx(e){return t=>{let n=new Map;for(let e=0;e<t.length;e++)n.set(V_(t[e]),e);let r=[...t].sort((t,r)=>{t=V_(t),r=V_(r);let i=e(t),a=e(r);return i===a?n.get(t)-n.get(r):i-a});return r.some((e,n)=>e!==t[n])?r:t}}const bx=fx;function xx(){return(e,t,n)=>W(new jg(e.map(t_),e=>t(e.map(e=>W(e))),n))}function Sx(e,t){return xx()([],()=>(t,n)=>e(t)?P(t):R(new Oh(n,O(t))),t)}const Cx=`~effect/Schema/SchemaError`;var wx=class{[Cx]=Cx;_tag=`SchemaError`;name=`SchemaError`;issue;constructor(e){this.issue=e}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}};function Tx(e){return S(e,Cx)}const Ex=ex;function Dx(e){let t=nx(e);return(e,n)=>qm(t(e,n),e=>new wx(e))}const Ox=Dx,kx=rx,Ax=ix,jx=ax;function Mx(e){let t=ox(e);return(e,n)=>qm(t(e,n),e=>new wx(e))}const Nx=Mx,W=mx;function Px(e){return S(e,bx)&&e[bx]===bx}const Fx=Yb(e=>W(P_(e.ast),{schema:e})),Ix=Yb(e=>Fx(rS(e))),Lx=Yb(e=>W(B_(e.ast),{schema:e}));function Rx(e){let t=W(new Rg(e),{literal:e,transform(n){return t.pipe(sS(Rx(n),{decode:U(()=>n),encode:U(()=>e)}))}});return t}const zx=W(Ig),Bx=W(Lg),Vx=W(Mg),Hx=W(Fg),G=W(Bg),Ux=W(Ug),Wx=W(Wg),Gx=W(Gg);function Kx(e,t){return W(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Kx(e_(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function qx(e){return Kx(e_(e,void 0),e)}function Jx(e,t,n){let r=n?.keyValueCombiner?.decode||n?.keyValueCombiner?.encode?new Zg(n.keyValueCombiner.decode,n.keyValueCombiner.encode):void 0;return W(R_(e.ast,t.ast,r),{key:e,value:t})}function Yx(e,t){return W(e,{elements:t,mapElements(e,t){let n=e(this.elements);return Yx(n_(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Xx(e){return Yx(n_(e),e)}const Zx=Yb(e=>W(new Kg(!1,[],[e.ast]),{schema:e})),Qx=Yb(e=>W(new Kg(!1,[e.ast],[e.ast]),{schema:e}));function $x(e,t){return W(e,{members:t,mapMembers(e,t){let n=e(this.members);return $x(r_(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function eS(e,t){return $x(r_(e,t?.mode??`anyOf`,void 0),e)}function tS(e){let t=e.map(Rx);return W(r_(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return eS(e(this.members))},pick(e){return tS(e)},transform(e){return eS(t.map((t,n)=>t.transform(e[n])))}})}const nS=Yb(e=>eS([e,Vx])),rS=Yb(e=>eS([e,Hx])),iS=Yb(e=>eS([e,Vx,Hx]));function aS(e){return W(new g_(()=>e().ast))}function oS(e){return t=>W(A_(t.ast,e),{schema:t,identifier:e})}function sS(e,t){return n=>W(I_(n.ast,e.ast,t?og(t):ug()),{from:n,to:e})}function cS(e){return t=>W(F_(t.ast,e),{schema:t})}function K(e){return Rx(e).pipe(cS(()=>O(e)))}function lS(e,t){return qx({_tag:K(e),...t})}function uS(e){return t=>{let n={},r={};return i(t),Object.assign(t,{cases:n,isAnyOf:t=>n=>t.includes(n[e]),guards:r,match:a});function i(t){let a=t.ast;if(Tg(a)&&`members`in t&&globalThis.Array.isArray(t.members)&&t.members.every(Px))return t.members.forEach(i);let o=a_(a);if(o.length>0){let i=o.find(t=>t.key===e)?.literal;if(be(i)){n[i]=t,r[i]=Ex(Lx(t));return}}throw new globalThis.Error(`No literal or unique symbol found`)}function a(){if(arguments.length===1){let t=arguments[0];return function(n){return t[n[e]](n)}}let t=arguments[0];return arguments[1][t[e]](t)}}}function dS(e){let t={},n=[];for(let r of Object.keys(e))n.push(t[r]=lS(r,e[r]));let r=eS(n),{guards:i,isAnyOf:a,match:o}=uS(`_tag`)(r);return W(r.ast,{cases:t,isAnyOf:a,guards:i,match:o})}function fS(e,t){return Sx(t=>t instanceof e,t)}function pS(){return(e,t)=>new Eg(e.ast,og(t))}function mS(e){return W(xx()([e],([e])=>(t,n,r)=>fr(t)?pr(t)?gp:Jm(nx(e)(t.value,r),{onSuccess:O,onFailure:e=>new Dh(n,O(t),[new wh([`value`],e)])}):R(new Oh(n,O(t))),{typeConstructor:{_tag:`effect/Option`},generation:{runtime:`Schema.Option(?)`,Type:`Option.Option<?>`,importDeclaration:`import * as Option from "effect/Option"`},expected:`Option`,toCodec:([e])=>pS()(eS([qx({_tag:Rx(`Some`),value:e}),qx({_tag:Rx(`None`)})]),cg({decode:e=>e._tag===`None`?D():O(e.value),encode:e=>mr(e)?{_tag:`Some`,value:e.value}:{_tag:`None`}})),toArbitrary:([e])=>(t,n)=>t.oneof(n?.isSuspend?{maxDepth:2,depthIdentifier:`Option`}:{},t.constant(D()),e.map(O)),toEquivalence:([e])=>Dr(e),toFormatter:([e])=>hr({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`})}).ast,{value:e})}function hS(e){return nS(e).pipe(sS(mS(Lx(e)),mg()))}function gS(e,t){return iS(e).pipe(sS(mS(Lx(e)),hg(t)))}const _S=qx({message:G,name:Fx(G),stack:Fx(G)}),vS=fS(globalThis.Error,{typeConstructor:{_tag:`Error`},generation:{runtime:`Schema.Error`,Type:`globalThis.Error`},expected:`Error`,toCodecJson:()=>pS()(_S,pg()),toArbitrary:()=>e=>e.string().map(e=>new globalThis.Error(e))});globalThis.Error;const yS=new ig(qh(),U(e=>{try{return JSON.parse(JSON.stringify(e))}catch{return wt(e)}})),bS=eS([_S.pipe(sS(vS,pg())),zx.pipe(sS(Bx.annotate({toCodecJson:()=>pS()(zx,yS),toArbitrary:()=>e=>e.json()}),yS))]);function xS(e,t){return W(xx()([e,t],([e,t])=>{let n=Zx(Xx([e,t]));return(e,t,r)=>e instanceof globalThis.Map?Jm(nx(n)([...e],r),{onSuccess:e=>new globalThis.Map(e),onFailure:n=>new Dh(t,O(e),[new wh([`entries`],n)])}):R(new Oh(t,O(e)))},{typeConstructor:{_tag:`ReadonlyMap`},generation:{runtime:`Schema.ReadonlyMap(?, ?)`,Type:`globalThis.ReadonlyMap<?, ?>`},expected:`ReadonlyMap`,toCodec:([e,t])=>pS()(Zx(Xx([e,t])),cg({decode:e=>new globalThis.Map(e),encode:e=>[...e.entries()]})),toArbitrary:([e,t])=>(n,r)=>n.oneof(r?.isSuspend?{maxDepth:2,depthIdentifier:`ReadonlyMap`}:{},n.constant([]),n.array(n.tuple(e,t),r?.constraints?.array)).map(e=>new globalThis.Map(e)),toEquivalence:([e,t])=>ot(e,t),toFormatter:([e,t])=>n=>{let r=n.size;return r===0?`ReadonlyMap(0) {}`:`ReadonlyMap(${r}) { ${globalThis.Array.from(n.entries()).sort().map(([n,r])=>`${e(n)} => ${t(r)}`).join(`, `)} }`}}).ast,{key:e,value:t})}globalThis.RegExp,globalThis.URL;function SS(e){return G.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`,contentSchema:V_(e.ast)}).pipe(sS(e,gg))}globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;const CS=Sx(e=>ah(e)&&oh(e),{typeConstructor:{_tag:`effect/DateTime.Utc`},generation:{runtime:`Schema.DateTimeUtc`,Type:`DateTime.Utc`,importDeclaration:`import * as DateTime from "effect/DateTime"`},expected:`DateTime.Utc`,toCodecJson:()=>pS()(G,_g),toArbitrary:()=>(e,t)=>e.date({noInvalidDate:!0,...t?.constraints?.date}).map(e=>ch(e)),toFormatter:()=>e=>e.toString(),toEquivalence:()=>sh}),wS=globalThis.Symbol.for(`immer-draftable`);function TS(e,t,n,r){let i=OS(n,t,r),a=DS(t);return class extends e{constructor(...[e,t]){let r=e??{};if(t?.disableValidation)super(r,t);else{let e=n.makeUnsafe(r,t);super({...r,...e},{...t,disableValidation:!0})}}toString(){return`${t}(${wt({...this})})`}static[bx]=bx;get[a](){return a}static[wS]=!0;static identifier=t;static fields=n.fields;static get ast(){return i(this).ast}static pipe(){return y(this,arguments)}static rebuild(e){return i(this).rebuild(e)}static makeUnsafe(e,t){return new this(e,t)}static makeOption(e,t){return Qb(i(this))(e,t)}static annotate(e){return this.rebuild(w_(this.ast,e))}static annotateKey(e){return this.rebuild(M_(this.ast,e))}static check(...e){return this.rebuild(E_(this.ast,e))}static extend(e){return(t,r)=>{let i={...n.fields,...t};return TS(this,e,Kx(e_(i,n.ast.checks,{identifier:e}),i),r)}}static mapFields(e,t){return n.mapFields(e,t)}}}function ES(e){return new ig(U(t=>new e(t)),qh())}function DS(e){return`~effect/Schema/Class/${e}`}function OS(e,t,n){let r;return i=>{if(r===void 0){let a=ES(i),o=W(new jg([e.ast],()=>(e,n)=>e instanceof i||S(e,DS(t))?P(e):R(new Oh(n,O(e))),{identifier:t,[uv]:([e])=>new Eg(e,a),toCodec:([e])=>new Eg(e.ast,a),toArbitrary:([e])=>()=>e.map(e=>new i(e)),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,"~sentinels":a_(e.ast),...n}));r=e.pipe(sS(o,a))}return r}}function kS(e){return Px(e)}const AS=e=>(t,n)=>TS(tf,e,kS(t)?t:qx(t),n),jS=e=>(t,n,r)=>AS(e??t)(kS(n)?n.mapFields(e=>({_tag:K(t),...e}),{unsafePreserveChecks:!0}):lS(t,n),r),q=e=>(t,n)=>{let r=TS(jn,e,kS(t)?t:qx(t),n);return r.prototype.name=e,r},MS=e=>(t,n,r)=>q(e??t)(kS(n)?n.mapFields(e=>({_tag:K(t),...e}),{unsafePreserveChecks:!0}):lS(t,n),r);function NS(e){return W(hx(e.ast))}function PS(e,t){return t?.keepDeclarations===!0?W(WS(HS(e.ast))):W(WS(BS(e.ast)))}function FS(e){switch(e._tag){case`Null`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}}const IS=yx(FS);function LS(e,t,n){switch(e._tag){case`Declaration`:{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(xe(r)){let n=r(yg(e)?e.typeParameters.map(e=>W(t(V_(e)))):[]),i=t(n.to);return S_(e,i===n.to?[n]:[new Eg(i,n.transformation)])}return n(e)}case`Null`:return S_(e,[RS]);case`Boolean`:return S_(e,[zS]);case`Unknown`:case`ObjectKeyword`:return S_(e,[gv]);case`Enum`:case`Number`:case`Literal`:case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e});return e.recur(t);case`Union`:{let n=IS(e.types);return n===e.types?e.recur(t):new u_(n,e.mode,e.annotations,e.checks,e.encoding,e.context).recur(t)}case`Arrays`:case`Suspend`:return e.recur(t)}return e}const RS=new Eg(new Rg(`null`),new ig(U(()=>null),U(()=>`null`))),zS=new Eg(new u_([new Rg(`true`),new Rg(`false`)],`anyOf`),new ig(U(e=>e===`true`),Zh())),BS=Z_(e=>{let t=LS(e,BS,e=>S_(e,[VS]));return t!==e&&z_(e)?N_(t):t}),VS=new Eg(Fg,new ig(qh(),U(()=>void 0))),HS=Z_(e=>{let t=LS(e,HS,x);return t!==e&&z_(e)?N_(t):t}),US=`~effect/Schema/SERIALIZER_ENSURE_ARRAY`,WS=Z_(e=>{if(Tg(e)&&e.annotations?.[US])return e;let t=GS(e);if(Cg(t)){let n=new u_([t,I_(Bg,t,new ig(ng(),qh()))],`anyOf`,{[US]:!0});return z_(e)?P_(n):n}return t});function GS(e){switch(e._tag){default:return e;case`Declaration`:case`Arrays`:case`Objects`:case`Union`:case`Suspend`:return e.recur(WS)}}const KS=`~effect/platform/PlatformError`;var qS=class extends of(`BadArgument`){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}},JS=class extends af{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}},YS=class extends of(`PlatformError`){constructor(e){`cause`in e?super({reason:e,cause:e.cause}):super({reason:e})}[KS]=KS;get message(){return this.reason.message}};const XS=e=>new YS(new JS(e)),ZS=e=>new YS(new qS(e)),QS={_R:x,_E:x,_A:x},$S={"~effect/Stream":QS,pipe(){return y(this,arguments)}},eC=e=>{let t=Object.create($S);return t.channel=e,t},tC=`~effect/Sink`,nC=P([void 0]),rC={_A:x,_In:x,_L:x,_E:x,_R:x},iC={[tC]:rC,pipe(){return y(this,arguments)}},aC=e=>S(e,tC),oC=e=>sC((t,n)=>sb(e)(t,n).pipe(z(_m({disableYield:!0})),Mf(P))),sC=e=>{let t=Object.create(iC);return t.transform=e,t},cC=e=>rb((t,n)=>P(z(e.transform(t,n),Wu))),lC=sC(e=>Mf(_m(e,{disableYield:!0}),()=>nC)),uC=e=>dC(fp(t=>e(t),{discard:!0})),dC=e=>sC(t=>t.pipe(z(e),_m({disableYield:!0}),Mf(()=>nC))),fC=e=>oC(Rb(B(e,cC))),pC={_tag:`Empty`},mC={_tag:`Closed`},hC={_A:x,_E:x};var gC=class{"~effect/RcRef"=hC;pipe(){return y(this,arguments)}state=pC;semaphore=Qy(1);acquire;services;scope;idleTimeToLive;constructor(e,t,n,r){this.acquire=e,this.services=t,this.scope=n,this.idleTimeToLive=r}};const _C=e=>wp(t=>{let n=t.services,r=Da(n,hd),i=new gC(e.acquire,n,r,e.idleTimeToLive?Ii(e.idleTimeToLive):void 0);return kp(vd(r,()=>{let e=i.state._tag===`Acquired`?Sd(i.state.scope,Zu):I;return i.state=mC,e}),i)}),vC=e=>gm(t=>{switch(e.state._tag){case`Closed`:return pm;case`Acquired`:return e.state.refCount++,e.state.fiber?kp(Nv(e.state.fiber),e.state):P(e.state);case`Empty`:{let n=gd();return e.semaphore.withPermits(1)(t(tm(e.acquire,wa(e.services,hd,n))).pipe(B(t=>{let r={_tag:`Acquired`,value:t,scope:n,fiber:void 0,refCount:1,invalidated:!1};return e.state=r,r})))}}}),yC=Rm(function*(e){let t=e,n=yield*vC(t),r=yield*am,i=t.idleTimeToLive!==void 0&&Wi(t.idleTimeToLive);return yield*vd(r,()=>(n.refCount--,n.refCount>0?I:t.idleTimeToLive===void 0?(t.state=pC,Sd(n.scope,Zu)):n.invalidated?Sd(n.scope,Zu):(i&&(n.fiber=qp(t.idleTimeToLive).pipe(z(()=>t.state._tag===`Acquired`&&t.state.refCount===0?(t.state=pC,Sd(n.scope,Zu)):I),um(F(()=>{n.fiber=void 0})),Dm(t.services),Iv(t.scope))),I))),n.value}),bC=_C,xC=yC,SC=e=>S(e,`~effect/Stream`),CC=eC,wC=e=>CC(ab(e)),TC=(e,t)=>CC(rb((n,r)=>z(Jb(e.channel,r),e=>t(e,r)))),EC=e=>e.channel,DC=(e,t)=>CC(lb(e,t)),OC=CC(db),kC=e=>CC(ub(()=>e().channel)),AC=e=>CC(gb(e)),jC=e=>CC(vb(e)),MC=e=>CC(Rb(B(e,EC))),NC=b(2,(e,t)=>kC(()=>{let n=0;return CC(yb(e.channel,li(e=>t(e,n++))))})),PC=b(e=>SC(e[0]),(e,t,n)=>e.channel.pipe(Eb,Cb(t,n),yb(ci),CC)),FC=b(e=>SC(e[0]),(e,t,n)=>PC(e,e=>kp(t(e),e),n)),IC=b(e=>SC(e[0])&&SC(e[1]),(e,t,n)=>CC(Fb(EC(e),EC(t),n))),LC=b(2,(e,t)=>CC(Db(EC(e),t))),RC=b(2,(e,t)=>e.channel.pipe(Ab(t),CC)),zC=b(2,(e,t)=>CC(Nb(e.channel,t))),BC=e=>CC(Pb(e.channel)),VC=b(e=>SC(e[0]),(e,t,n,r)=>CC(Ob(e.channel,t,(e,t)=>{let r=si();for(let i=0;i<t.length;i++){let[a,o]=n(e,t[i]);e=a,r.push(...o)}return[e,Jr(r)?ci(r):HC]},r?.onHalt?{onHalt(e){let t=r.onHalt(e);return Yr(t)?ci(t):HC}}:void 0))),HC=si(),UC=b(2,(e,t)=>TC(e,(e,n)=>F(()=>{let r,i,a=vp(()=>{if(i!==void 0){let e=i;return i=void 0,P(e)}return e}).pipe(jp(e=>(r=Xu(e),Wu()))),o=B(vp(()=>t.transform(a,n)),([e,t])=>(i=t,ci(e)));return vp(()=>r||o)}))),WC=b(2,(e,t)=>CC(Lb(e.channel,t))),GC=b(e=>SC(e[0]),(e,t)=>kC(()=>{let n=new TextDecoder(t?.encoding);return NC(e,e=>n.decode(e,{stream:!0}))})),KC=e=>e.channel.pipe(Lb(Ib()),CC),qC=b(2,(e,t)=>CC(Bb(e.channel,e=>t(e[0])))),JC=b(2,(e,t)=>CC(Vb(e.channel,t))),YC=b(2,(e,t)=>sm(n=>Jb(e.channel,n).pipe(z(e=>t.transform(e,n)),B(([e])=>e)))),XC=e=>Kb(e.channel,()=>[],(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n]);return e}),ZC=e=>B(Gb(e.channel),wr(ti)),QC=b(2,(e,t)=>Wb(e.channel,e=>{let n=0;return pp({while:()=>n<e.length,body:()=>t(e[n++]),step:le})})),$C=b(2,(e,t)=>Wb(e.channel,t)),ew=e=>Ub(e.channel),tw=e=>qb(e.channel),nw=e=>Kb(e.channel,()=>``,(e,t)=>e+t.join(``)),rw=b(e=>SC(e[0]),(e,t,n)=>{let r,i,a=Lv(!1);return new ReadableStream({start(n){i=Em(tm($C(e,e=>a.whenOpen(F(()=>{a.closeUnsafe();for(let t=0;t<e.length;t++)n.enqueue(e[t]);r(),r=void 0}))),t)),i.addObserver(e=>{e._tag===`Failure`?n.error(Fu(e.cause)):n.close()})},pull(){return new Promise(e=>{r=e,a.openUnsafe()})},cancel(){if(i)return Am(Ap(Nv(i)))}},n?.strategy)}),iw=b(e=>SC(e[0]),(e,t)=>rw(e,xa(),t)),aw=`~effect/platform/FileSystem`,ow=e=>typeof e==`bigint`?e:BigInt(e),sw=BigInt(1024);sw*sw*sw*sw*sw;const cw=A(`effect/platform/FileSystem`),lw=e=>cw.of({...e,[aw]:aw,exists:t=>ue(e.access(t),kp(!0),Mp(`PlatformError`,e=>e.reason._tag===`NotFound`?P(!1):R(e))),readFileString:(t,n)=>z(e.readFile(t),e=>Cp({try:()=>new TextDecoder(n).decode(e),catch:e=>ZS({module:`FileSystem`,method:`readFileString`,description:`invalid encoding`,cause:e})})),stream:Rm(function*(t,n){let r=yield*e.open(t,{flag:`r`});n?.offset&&(yield*r.seek(n.offset,`start`));let i=n?.bytesToRead===void 0?void 0:ow(n.bytesToRead),a=BigInt(0),o=ow(n?.chunkSize??64*1024),s=r.readAlloc(o);return wC(P(z(vp(()=>i!==void 0&&i<=a?Wu():i!==void 0&&i-a<o?r.readAlloc(i-a):s),hr({onNone:()=>Wu(),onSome:e=>(a+=BigInt(e.length),P(ci(e)))}))))},MC),sink:(t,n)=>ue(e.open(t,{flag:`w`,...n}),B(e=>uC(t=>e.writeAll(t))),fC),writeFileString:(t,n,r)=>z(Cp({try:()=>new TextEncoder().encode(n),catch:e=>ZS({module:`FileSystem`,method:`writeFileString`,description:`could not encode string`,cause:e})}),n=>e.writeFile(t,n,r))}),uw=`~effect/platform/FileSystem/File`,dw=_v();var fw=class extends A()(`effect/platform/FileSystem/WatchBackend`){};const pw=`~effect/platform/Path`,mw=A(`effect/Path`);function hw(e,t){let n=``,r=0,i=-1,a=0,o;for(let s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){let e=n.lastIndexOf(`/`);if(e!==n.length-1){e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}function gw(e,t){let n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+e+r:r}function _w(e){if(e.protocol!==`file:`)return R(new qS({module:`Path`,method:`fromFileUrl`,description:`URL must be of scheme file`}));if(e.hostname!==``)return R(new qS({module:`Path`,method:`fromFileUrl`,description:`Invalid file URL host`}));let t=e.pathname;for(let e=0;e<t.length;e++)if(t[e]===`%`){let n=t.codePointAt(e+2)|32;if(t[e+1]===`2`&&n===102)return R(new qS({module:`Path`,method:`fromFileUrl`,description:`must not include encoded / characters`}))}return P(decodeURIComponent(t))}const vw=function(){let e=``,t=!1,n;for(let r=arguments.length-1;r>=-1&&!t;r--){let i;if(r>=0)i=arguments[r];else{let e=globalThis.process;n===void 0&&`process`in globalThis&&typeof e==`object`&&e&&typeof e.cwd==`function`&&(n=e.cwd()),i=n}i.length!==0&&(e=i+`/`+e,t=i.charCodeAt(0)===47)}return e=hw(e,!t),t?e.length>0?`/`+e:`/`:e.length>0?e:`.`};function yw(e){let t=new URL(`file://`),n=vw(e);return e.charCodeAt(e.length-1)===47&&n[n.length-1]!==`/`&&(n+=`/`),t.pathname=Tw(n),P(t)}const bw=/%/g,xw=/\\/g,Sw=/\n/g,Cw=/\r/g,ww=/\t/g;function Tw(e){return e.includes(`%`)&&(e=e.replace(bw,`%25`)),e.includes(`\\`)&&(e=e.replace(xw,`%5C`)),e.includes(`
21
- `)&&(e=e.replace(Sw,`%0A`)),e.includes(`\r`)&&(e=e.replace(Cw,`%0D`)),e.includes(` `)&&(e=e.replace(ww,`%09`)),e}const Ew=mw.of({[pw]:pw,resolve:vw,normalize(e){if(e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=hw(e,!t),e.length===0&&!t&&(e=`.`),e.length>0&&n&&(e+=`/`),t?`/`+e:e},isAbsolute(e){return e.length>0&&e.charCodeAt(0)===47},join(){if(arguments.length===0)return`.`;let e;for(let t=0;t<arguments.length;++t){let n=arguments[t];n.length>0&&(e===void 0?e=n:e+=`/`+n)}return e===void 0?`.`:Ew.normalize(e)},relative(e,t){if(e===t||(e=Ew.resolve(e),t=Ew.resolve(t),e===t))return``;let n=1;for(;n<e.length&&e.charCodeAt(n)===47;++n);let r=e.length,i=r-n,a=1;for(;a<t.length&&t.charCodeAt(a)===47;++a);let o=t.length-a,s=i<o?i:o,c=-1,l=0;for(;l<=s;++l){if(l===s){if(o>s){if(t.charCodeAt(a+l)===47)return t.slice(a+l+1);if(l===0)return t.slice(a+l)}else i>s&&(e.charCodeAt(n+l)===47?c=l:l===0&&(c=0));break}let r=e.charCodeAt(n+l);if(r!==t.charCodeAt(a+l))break;r===47&&(c=l)}let u=``;for(l=n+c+1;l<=r;++l)(l===r||e.charCodeAt(l)===47)&&(u.length===0?u+=`..`:u+=`/..`);return u.length>0?u+t.slice(a+c):(a+=c,t.charCodeAt(a)===47&&++a,t.slice(a))},dirname(e){if(e.length===0)return`.`;let t=e.charCodeAt(0),n=t===47,r=-1,i=!0;for(let n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!i){r=n;break}}else i=!1;return r===-1?n?`/`:`.`:n&&r===1?`//`:e.slice(0,r)},basename(e,t){let n=0,r=-1,i=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let o=t.length-1,s=-1;for(a=e.length-1;a>=0;--a){let c=e.charCodeAt(a);if(c===47){if(!i){n=a+1;break}}else s===-1&&(i=!1,s=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(r=a):(o=-1,r=s))}return n===r?r=s:r===-1&&(r=e.length),e.slice(n,r)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!i){n=a+1;break}}else r===-1&&(i=!1,r=a+1);return r===-1?``:e.slice(n,r)}},extname(e){let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return gw(`/`,e)},parse(e){let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let n=e.charCodeAt(0),r=n===47,i;r?(t.root=`/`,i=1):i=0;let a=-1,o=0,s=-1,c=!0,l=e.length-1,u=0;for(;l>=i;--l){if(n=e.charCodeAt(l),n===47){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),n===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(o===0&&r?t.base=t.name=e.slice(1,s):t.base=t.name=e.slice(o,s)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s)),t.ext=e.slice(a,s)),o>0?t.dir=e.slice(0,o-1):r&&(t.dir=`/`),t},sep:`/`,fromFileUrl:_w,toFileUrl:yw,toNamespacedPath:x});function Dw(e){return{_tag:`Value`,value:e}}function Ow(e,t){return{_tag:`Record`,keys:e,value:t}}function kw(e,t){return{_tag:`Array`,length:e,value:t}}const Aw=Ia(`effect/ConfigProvider`,{defaultValue:()=>Nw()}),jw={...Xt,toJSON(){return{_id:`ConfigProvider`}}};function Mw(e,t,n){let r=Object.create(jw);return r.get=e,r.mapInput=t,r.prefix=n,r.load=r=>(t&&(r=t(r)),n&&(r=[...n,...r]),e(r)),r}function Nw(e){let t=e?.env??{...globalThis?.process?.env,...import.meta?.env},n=Pw(t);return Mw(e=>P(Iw(n,t,e)))}function Pw(e){let t={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let e=n.split(`_`),i=t;for(let t of e)i.children??={},i=i.children[t]??={};i.value=r}return t}const Fw=/^(0|[1-9][0-9]*)$/;function Iw(e,t,n){let r=t[n.map(String).join(`_`)],i=Lw(e,n),a=i?.children?Object.keys(i.children):[];return a.length===0?r===void 0?void 0:Dw(r):a.every(e=>Fw.test(e))?kw(Math.max(...a.map(e=>parseInt(e,10)))+1,r):Ow(new Set(a),r)}function Lw(e,t){if(t.length===0)return e;let n=e;for(let e of t)if(n=n?.children?.[String(e)],!n)return;return n}const Rw=`~effect/Config`;var zw=class{_tag=`ConfigError`;name=`ConfigError`;cause;constructor(e){this.cause=e}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}};const Bw={...Xt,...Qt,[Rw]:Rw,asEffect(){return z(Aw.asEffect(),e=>this.parse(e))},toJSON(){return{_id:`Config`}}};function Vw(e){let t=Object.create(Bw);return t.parse=e,t}const Hw=b(2,(e,t)=>Vw(n=>B(e.parse(n),t))),Uw=b(2,(e,t)=>Vw(n=>jp(e.parse(n),e=>t(e).parse(n))));function Ww(e){switch(e._tag){case`MissingKey`:return!0;case`InvalidType`:case`InvalidValue`:return pr(e.actual)||mr(e.actual)&&e.actual.value===void 0;case`OneOf`:return e.actual===void 0;case`Encoding`:return pr(e.actual)||mr(e.actual)&&e.actual.value===void 0?!0:Ww(e.issue);case`Pointer`:case`Filter`:return Ww(e.issue);case`UnexpectedKey`:return!1;case`Forbidden`:return!1;case`Composite`:case`AnyOf`:return e.issues.every(Ww)}}const Gw=b(2,(e,t)=>Uw(e,e=>{if(Tx(e.cause)){let n=e.cause.issue;if(Ww(n))return Zw(t)}return Xw(e.cause)})),Kw=e=>e.pipe(Hw(O),Gw(D())),qw=Rm(function*(e,t){let n=yield*e.load(t);if(n!==void 0)switch(n._tag){case`Value`:return n.value;case`Record`:{if(n.value!==void 0)return n.value;let r={};for(let i of n.keys){let n=yield*qw(e,[...t,i]);n!==void 0&&(r[i]=n)}return r}case`Array`:{if(n.value!==void 0)return n.value;let r=[];for(let i=0;i<n.length;i++)r.push(yield*qw(e,[...t,i]));return r}}}),Jw=Rm(function*(e,t,n){switch(e._tag){case`Objects`:{let r={};for(let i of e.propertySignatures){let e=i.name;if(typeof e==`string`){let a=yield*Jw(i.type,t,[...n,e]);a!==void 0&&(r[e]=a)}}if(e.indexSignatures.length>0){let i=yield*t.load(n);if(i&&i._tag===`Record`)for(let a of e.indexSignatures){let e=tx(a.parameter);for(let o of i.keys)if(!Object.hasOwn(r,o)&&e(o)){let e=yield*Jw(a.type,t,[...n,o]);e!==void 0&&(r[o]=e)}}}return r}case`Arrays`:{let r=yield*t.load(n);if(r&&r._tag===`Value`)return r.value;let i=[];for(let r=0;r<e.elements.length;r++)i.push(yield*Jw(e.elements[r],t,[...n,r]));return i}case`Union`:return yield*qw(t,n);case`Suspend`:return yield*Jw(e.thunk(),t,n);default:{let e=yield*t.load(n);return e===void 0?void 0:e._tag===`Value`||e._tag===`Record`&&e.value!==void 0||e._tag===`Array`&&e.value!==void 0?e.value:void 0}}});function Yw(e,t){let n=PS(e),r=nx(n),i=V_(n.ast),a=typeof t==`string`?[t]:t??[];return Vw(e=>{let t=e.prefix?[...e.prefix,...a]:a;return Jw(i,e,a).pipe(Ym(e=>r(e).pipe(qm(e=>new wx(t.length>0?new wh(t,e):e)))),qm(e=>new zw(e)))})}function Xw(e){return Vw(()=>R(new zw(e)))}function Zw(e){return Vw(()=>P(e))}function Qw(e){return Yw(G,e)}const $w=`~effect/FiberSet`,eT=e=>S(e,$w),tT={[$w]:$w,[Symbol.iterator](){return this.state._tag===`Closed`?Ir():this.state.backing[Symbol.iterator]()},...Xt,toJSON(){return{_id:`FiberMap`,state:this.state}}},nT=(e,t)=>{let n=Object.create(tT);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},rT=()=>cm(F(()=>nT(new Set,nd())),e=>vp(()=>{let t=e.state;if(t._tag===`Closed`)return I;e.state={_tag:`Closed`};let n=t.backing;return Pv(n).pipe(md(e.deferred))})),iT=la(da(zu,ua(-1))),aT=b(e=>eT(e[0]),(e,t,n)=>{if(e.state._tag===`Closed`){t.interruptUnsafe(-1);return}else if(e.state.backing.has(t))return;e.state.backing.add(t),t.addObserver(r=>{e.state._tag!==`Closed`&&(e.state.backing.delete(t),$u(r)&&(n?.propagateInterruption===!0?!iT(r.cause):!Pu(r.cause))&&pd(e.deferred,r))})}),oT=function(){let e;return()=>(e===void 0&&(e=Em(pm)),e)}(),sT=e=>()=>B(Qp(),t=>{let n=Dm(t);return(t,r)=>{if(e.state._tag===`Closed`)return oT();let i=n(t,r);return aT(e,i),i}}),cT=e=>id(e.deferred),lT=e=>S(e,`~effect/Logger`),uT=_u,dT=vu,fT=/^[^\s"=]*$/,pT=e=>`#${e}`,mT=xu(((e,t)=>({cause:n,date:r,fiber:i,logLevel:a,message:o})=>{let s=t=>t.match(fT)?t:e(t),c=(e,t)=>`${Su(e)}=${s(t)}`,l=(e,t)=>` `+c(e,t),u=c(`timestamp`,r.toISOString());u+=l(`level`,a),u+=l(`fiber`,pT(i.id));let d=Ur(o);for(let e=0;e<d.length;e++)u+=l(`message`,wt(d[e],{space:t}));n.reasons.length>0&&(u+=l(`cause`,Po(n)));let f=r.getTime(),p=i.getRef(lo);for(let e of p)u+=` `+Cu(e,f);let m=i.getRef(oo);for(let[e,n]of Object.entries(m))u+=l(e,wt(n,{space:t}));return u})(JSON.stringify,0)),hT=b(2,(e,t)=>M(Zc,n=>{let r=[],i=$o(()=>{if(r.length===0)return as;let e=r;return r=[],t.flush(e)});return gl(a=>a(cu(t.window).pipe(Es(i),sc)).pipe(wl,M(e=>Gc(n,()=>qo(e))),Es(nl(()=>i)),ws(xu(t=>{r.push(e.log(t))}))))})),gT=(e,t)=>Ld(uT,E(gs(function*(n){let r=new Set(t?.mergeWithExisting===!0?n.getRef(_u):[]);for(let t of e)r.add(tn(t)?yield*t:t);return r}))),_T=b(e=>lT(e[0]),(e,t,n)=>hs(function*(){let r=yield*(yield*cw).open(t,{flag:`a+`,...n}),i=new TextEncoder;return yield*hT(e,{window:n?.batchWindow??1e3,flush:e=>wc(r.write(i.encode(e.join(`
20
+ `,e)):i=a.indexOf(`\r`,i+1);n?t+=a.substring(e,a.length-1):t+=a.substring(e,a.length)}}return qr(r)?r:null};return z(e,function t(n){let i=r(n);return i===null?z(e,t):F(i)})})),vb=b(2,(e,t)=>Vy((n,r)=>z(Gy(e)(n,r),e=>Gy(t)(e,r)))),yb=e=>Vy((t,n)=>{let r;return F(cp(()=>r||e.pipe(cd(n),z(e=>Gy(e)(t,n)),z(e=>r=e))))}),bb=b(2,(e,t)=>Wy((n,r,i)=>ld(i,t).pipe(_p(Gy(e)(n,r))))),xb=b(2,(e,t)=>Hy(e,e=>I(()=>{let n=!0,r=vp(e,e=>(n=!1,t(e)));return cp(()=>n?r:e)}))),Sb=b(2,(e,t)=>bb(e,e=>t)),Cb=(e,t,n)=>cp(()=>{let r=sd();return Sf(z(Gy(e)(Ru(),r),t),n||F).pipe(em(e=>pd(r,e)))}),wb=e=>Cb(e,e=>im(e,{disableYield:!0})),Tb=b(2,(e,t)=>Cb(e,e=>im(z(e,t),{disableYield:!0}))),Eb=e=>cp(()=>{let t=Symbol(),n=t;return Cb(e,e=>im(z(e,e=>(n=e,lp)),{disableYield:!0}),()=>n===t?op:sp(n))}),Db=Tm(function*(e){let t=Iy(1),n=yield*Vp(),r=Ta(n,od);return(yield*Gy(e)(Ru(),r)).pipe(Wp(n),t.withPermits(1))},V(e=>F(fp(e)))),Ob=(e,t)=>Gy(e)(Ru(),t),kb=e=>e,Ab=fe(e=>{switch(e._tag){case`Declaration`:{let t=e.annotations?.[X_];if(xe(t)){let n=t(e.typeParameters),r=Ab(n.to);return c_(e,r===n.to?[n]:[new fg(r,n.transformation)])}return e}case`Objects`:case`Arrays`:return e.recur(e=>{let t=e.context?.defaultValue;return t?c_(Ab(e),t):Ab(e)});case`Suspend`:return e.recur(Ab);default:return e}});function jb(e){let t=Vb(Ab(E_(e.ast)));return(e,n)=>t(e,n?.parseOptions)}function Mb(e){let t=jb(e);return(e,n)=>qu(Cm(t(e,n)))}function Nb(e){let t=jb(e);return(e,n)=>xm(Nm(t(e,n),e=>Error(e.toString(),{cause:e})))}function Pb(e){return Fb(e.ast)}function Fb(e){let t=Hb(Vb(E_(e)));return e=>Gu(t(e,pg))}function Ib(e){return Vb(e.ast)}function Lb(e){return Ub(Ib(e))}function Rb(e){return Wb(Ib(e))}const zb=Rb;function Bb(e){return Vb(k_(e.ast))}function Vb(e){let t=Gb(e);return(e,n)=>Fm(t(O(e),n??pg),e=>e._tag===`None`?R(new hh(e)):F(e.value))}function Hb(e){return(t,n)=>Cm(e(t,n))}function Ub(e){let t=Hb(e);return(e,n)=>qu(t(e,n))}function Wb(e){return(t,n)=>xm(Nm(e(t,n),e=>Error(e.toString(),{cause:e})))}const Gb=fe(e=>{let t;if(!e.context&&!e.encoding&&!e.checks)return(n,r)=>(t??=e.getParser(Gb),t(n,zm(e)?.parseOptions??r));let n=lg(e)||ug(e)||ag(e)&&e.typeParameters.length>0;return(r,i)=>{i=zm(e)?.parseOptions??i;let a=e.encoding,o;if(a){let t=a,n=t.length;for(let e=n-1;e>=0;e--){let n=t[e],a=n.to,s=Gb(a);if(o=o?Fm(o,e=>s(e,i)):s(r,i),n.transformation._tag===`Transformation`){let e=n.transformation.decode;o=Fm(o,t=>e.run(t,i))}else o=n.transformation.decode(o,i)}o=Nm(o,t=>new lh(e,r,t))}t??=e.getParser(Gb);let s=o?Fm(o,e=>t(e,i)):t(r,i);if(e.checks){let t=e.checks;i?.errors===`all`&&n&&pr(r)&&(s=Im(s,n=>{let a=[];return Y_(t.filter(e=>e.annotations?.[`~structural`]),r.value,a,e,i),R(Kr(a)?n._tag===`Composite`&&n.ast===e?new ph(e,n.actual,[...n.issues,...a]):new ph(e,r,[n,...a]):n)})),s=Fm(s,n=>{if(pr(n)){let r=n.value,a=[];if(Y_(t,r,a,e,i),Kr(a))return R(new ph(e,n,a))}return F(n)})}return s}}),Kb=`~effect/Schema/Schema`,qb={[Kb]:Kb,pipe(){return y(this,arguments)},annotate(e){return this.rebuild(u_(this.ast,e))},annotateKey(e){return this.rebuild(v_(this.ast,e))},check(...e){return this.rebuild(f_(this.ast,e))}};function Jb(e,t){let n=Object.create(qb);return t&&Object.assign(n,t),n.ast=e,n.rebuild=e=>Jb(e,t),n.makeUnsafe=Nb(n),n.makeOption=Mb(n),n}const Yb=L_(e=>{let t=Xb(e);return t!==e&&T_(e)?y_(t):t});function Xb(e){switch(e._tag){case`Declaration`:{let t=e.annotations?.toCodecJson??e.annotations?.toCodec;if(xe(t)){let n=t(ag(e)?e.typeParameters.map(e=>Jb(D_(e))):[]),r=Yb(n.to);return c_(e,r===n.to?[n]:[new fg(r,n.transformation)])}return c_(e,[$_])}case`Unknown`:case`ObjectKeyword`:return c_(e,[ev]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e});return e.recur(Yb);case`Union`:{let t=Zb(e.types);return t===e.types?e.recur(Yb):new Xg(t,e.mode,e.annotations,e.checks,e.encoding,e.context).recur(Yb)}case`Arrays`:case`Suspend`:return e.recur(Yb)}return e}const Zb=$b(Qb);function Qb(e){switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}}function $b(e){return t=>{let n=new Map;for(let e=0;e<t.length;e++)n.set(D_(t[e]),e);let r=[...t].sort((t,r)=>{t=D_(t),r=D_(r);let i=e(t),a=e(r);return i===a?n.get(t)-n.get(r):i-a});return r.some((e,n)=>e!==t[n])?r:t}}const ex=Kb;function tx(){return(e,t,n)=>W(new _g(e.map(Vg),e=>t(e.map(e=>W(e))),n))}function nx(e,t){return tx()([],()=>(t,n)=>e(t)?F(t):R(new mh(n,O(t))),t)}const rx=`~effect/Schema/SchemaError`;var ix=class{[rx]=rx;_tag=`SchemaError`;name=`SchemaError`;issue;constructor(e){this.issue=e}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}};function ax(e){return S(e,rx)}const ox=Pb;function sx(e){let t=Ib(e);return(e,n)=>Nm(t(e,n),e=>new ix(e))}const cx=sx,lx=Lb,ux=Rb,dx=zb;function fx(e){let t=Bb(e);return(e,n)=>Nm(t(e,n),e=>new ix(e))}const px=fx,W=Jb;function mx(e){return S(e,ex)&&e[ex]===ex}const hx=kb(e=>W(b_(e.ast),{schema:e})),gx=kb(e=>hx(Lx(e))),_x=kb(e=>W(E_(e.ast),{schema:e}));function vx(e){let t=W(new wg(e),{literal:e,transform(n){return t.pipe(Vx(vx(n),{decode:U(()=>n),encode:U(()=>e)}))}});return t}const yx=W(Sg),bx=W(Cg),xx=W(vg),Sx=W(xg),G=W(Eg),Cx=W(kg),wx=W(Ag),Tx=W(jg);function Ex(e,t){return W(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Ex(Bg(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Dx(e){return Ex(Bg(e,void 0),e)}function Ox(e,t,n){let r=n?.keyValueCombiner?.decode||n?.keyValueCombiner?.encode?new Lg(n.keyValueCombiner.decode,n.keyValueCombiner.encode):void 0;return W(w_(e.ast,t.ast,r),{key:e,value:t})}function kx(e,t){return W(e,{elements:t,mapElements(e,t){let n=e(this.elements);return kx(Hg(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Ax(e){return kx(Hg(e),e)}const jx=kb(e=>W(new Mg(!1,[],[e.ast]),{schema:e})),Mx=kb(e=>W(new Mg(!1,[e.ast],[e.ast]),{schema:e}));function Nx(e,t){return W(e,{members:t,mapMembers(e,t){let n=e(this.members);return Nx(Ug(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Px(e,t){return Nx(Ug(e,t?.mode??`anyOf`,void 0),e)}function Fx(e){let t=e.map(vx);return W(Ug(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return Px(e(this.members))},pick(e){return Fx(e)},transform(e){return Px(t.map((t,n)=>t.transform(e[n])))}})}const Ix=kb(e=>Px([e,xx])),Lx=kb(e=>Px([e,Sx])),Rx=kb(e=>Px([e,xx,Sx]));function zx(e){return W(new n_(()=>e().ast))}function Bx(e){return t=>W(g_(t.ast,e),{schema:t,identifier:e})}function Vx(e,t){return n=>W(S_(n.ast,e.ast,t?Kh(t):Xh()),{from:n,to:e})}function Hx(e){return t=>W(x_(t.ast,e),{schema:t})}function K(e){return vx(e).pipe(Hx(()=>O(e)))}function Ux(e,t){return Dx({_tag:K(e),...t})}function Wx(e){return t=>{let n={},r={};return i(t),Object.assign(t,{cases:n,isAnyOf:t=>n=>t.includes(n[e]),guards:r,match:a});function i(t){let a=t.ast;if(dg(a)&&`members`in t&&globalThis.Array.isArray(t.members)&&t.members.every(mx))return t.members.forEach(i);let o=Gg(a);if(o.length>0){let i=o.find(t=>t.key===e)?.literal;if(be(i)){n[i]=t,r[i]=ox(_x(t));return}}throw new globalThis.Error(`No literal or unique symbol found`)}function a(){if(arguments.length===1){let t=arguments[0];return function(n){return t[n[e]](n)}}let t=arguments[0];return arguments[1][t[e]](t)}}}function Gx(e){let t={},n=[];for(let r of Object.keys(e))n.push(t[r]=Ux(r,e[r]));let r=Px(n),{guards:i,isAnyOf:a,match:o}=Wx(`_tag`)(r);return W(r.ast,{cases:t,isAnyOf:a,guards:i,match:o})}function Kx(e,t){return nx(t=>t instanceof e,t)}function qx(){return(e,t)=>new fg(e.ast,Kh(t))}function Jx(e){return W(tx()([e],([e])=>(t,n,r)=>dr(t)?fr(t)?op:Pm(Ib(e)(t.value,r),{onSuccess:O,onFailure:e=>new ph(n,O(t),[new uh([`value`],e)])}):R(new mh(n,O(t))),{typeConstructor:{_tag:`effect/Option`},generation:{runtime:`Schema.Option(?)`,Type:`Option.Option<?>`,importDeclaration:`import * as Option from "effect/Option"`},expected:`Option`,toCodec:([e])=>qx()(Px([Dx({_tag:vx(`Some`),value:e}),Dx({_tag:vx(`None`)})]),Jh({decode:e=>e._tag===`None`?D():O(e.value),encode:e=>pr(e)?{_tag:`Some`,value:e.value}:{_tag:`None`}})),toArbitrary:([e])=>(t,n)=>t.oneof(n?.isSuspend?{maxDepth:2,depthIdentifier:`Option`}:{},t.constant(D()),e.map(O)),toEquivalence:([e])=>Tr(e),toFormatter:([e])=>mr({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`})}).ast,{value:e})}function Yx(e){return Ix(e).pipe(Vx(Jx(_x(e)),eg()))}function Xx(e,t){return Rx(e).pipe(Vx(Jx(_x(e)),tg(t)))}const Zx=Dx({message:G,name:hx(G),stack:hx(G)}),Qx=Kx(globalThis.Error,{typeConstructor:{_tag:`Error`},generation:{runtime:`Schema.Error`,Type:`globalThis.Error`},expected:`Error`,toCodecJson:()=>qx()(Zx,$h()),toArbitrary:()=>e=>e.string().map(e=>new globalThis.Error(e))});globalThis.Error;const $x=new Wh(Nh(),U(e=>{try{return JSON.parse(JSON.stringify(e))}catch{return Ct(e)}})),eS=Px([Zx.pipe(Vx(Qx,$h())),yx.pipe(Vx(bx.annotate({toCodecJson:()=>qx()(yx,$x),toArbitrary:()=>e=>e.json()}),$x))]);function tS(e,t){return W(tx()([e,t],([e,t])=>{let n=jx(Ax([e,t]));return(e,t,r)=>e instanceof globalThis.Map?Pm(Ib(n)([...e],r),{onSuccess:e=>new globalThis.Map(e),onFailure:n=>new ph(t,O(e),[new uh([`entries`],n)])}):R(new mh(t,O(e)))},{typeConstructor:{_tag:`ReadonlyMap`},generation:{runtime:`Schema.ReadonlyMap(?, ?)`,Type:`globalThis.ReadonlyMap<?, ?>`},expected:`ReadonlyMap`,toCodec:([e,t])=>qx()(jx(Ax([e,t])),Jh({decode:e=>new globalThis.Map(e),encode:e=>[...e.entries()]})),toArbitrary:([e,t])=>(n,r)=>n.oneof(r?.isSuspend?{maxDepth:2,depthIdentifier:`ReadonlyMap`}:{},n.constant([]),n.array(n.tuple(e,t),r?.constraints?.array)).map(e=>new globalThis.Map(e)),toEquivalence:([e,t])=>at(e,t),toFormatter:([e,t])=>n=>{let r=n.size;return r===0?`ReadonlyMap(0) {}`:`ReadonlyMap(${r}) { ${globalThis.Array.from(n.entries()).sort().map(([n,r])=>`${e(n)} => ${t(r)}`).join(`, `)} }`}}).ast,{key:e,value:t})}globalThis.RegExp,globalThis.URL;function nS(e){return G.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`,contentSchema:D_(e.ast)}).pipe(Vx(e,ng))}globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;const rS=nx(e=>Gm(e)&&Km(e),{typeConstructor:{_tag:`effect/DateTime.Utc`},generation:{runtime:`Schema.DateTimeUtc`,Type:`DateTime.Utc`,importDeclaration:`import * as DateTime from "effect/DateTime"`},expected:`DateTime.Utc`,toCodecJson:()=>qx()(G,rg),toArbitrary:()=>(e,t)=>e.date({noInvalidDate:!0,...t?.constraints?.date}).map(e=>Jm(e)),toFormatter:()=>e=>e.toString(),toEquivalence:()=>qm}),iS=globalThis.Symbol.for(`immer-draftable`);function aS(e,t,n,r){let i=cS(n,t,r),a=sS(t);return class extends e{constructor(...[e,t]){let r=e??{};if(t?.disableValidation)super(r,t);else{let e=n.makeUnsafe(r,t);super({...r,...e},{...t,disableValidation:!0})}}toString(){return`${t}(${Ct({...this})})`}static[ex]=ex;get[a](){return a}static[iS]=!0;static identifier=t;static fields=n.fields;static get ast(){return i(this).ast}static pipe(){return y(this,arguments)}static rebuild(e){return i(this).rebuild(e)}static makeUnsafe(e,t){return new this(e,t)}static makeOption(e,t){return Mb(i(this))(e,t)}static annotate(e){return this.rebuild(u_(this.ast,e))}static annotateKey(e){return this.rebuild(v_(this.ast,e))}static check(...e){return this.rebuild(f_(this.ast,e))}static extend(e){return(t,r)=>{let i={...n.fields,...t};return aS(this,e,Ex(Bg(i,n.ast.checks,{identifier:e}),i),r)}}static mapFields(e,t){return n.mapFields(e,t)}}}function oS(e){return new Wh(U(t=>new e(t)),Nh())}function sS(e){return`~effect/Schema/Class/${e}`}function cS(e,t,n){let r;return i=>{if(r===void 0){let a=oS(i),o=W(new _g([e.ast],()=>(e,n)=>e instanceof i||S(e,sS(t))?F(e):R(new mh(n,O(e))),{identifier:t,[X_]:([e])=>new fg(e,a),toCodec:([e])=>new fg(e.ast,a),toArbitrary:([e])=>()=>e.map(e=>new i(e)),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,"~sentinels":Gg(e.ast),...n}));r=e.pipe(Vx(o,a))}return r}}function lS(e){return mx(e)}const uS=e=>(t,n)=>aS(Kd,e,lS(t)?t:Dx(t),n),dS=e=>(t,n,r)=>uS(e??t)(lS(n)?n.mapFields(e=>({_tag:K(t),...e}),{unsafePreserveChecks:!0}):Ux(t,n),r),q=e=>(t,n)=>{let r=aS(An,e,lS(t)?t:Dx(t),n);return r.prototype.name=e,r},fS=e=>(t,n,r)=>q(e??t)(lS(n)?n.mapFields(e=>({_tag:K(t),...e}),{unsafePreserveChecks:!0}):Ux(t,n),r);function pS(e){return W(Yb(e.ast))}function mS(e,t){return t?.keepDeclarations===!0?W(wS(SS(e.ast))):W(wS(bS(e.ast)))}function hS(e){switch(e._tag){case`Null`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}}const gS=$b(hS);function _S(e,t,n){switch(e._tag){case`Declaration`:{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(xe(r)){let n=r(ag(e)?e.typeParameters.map(e=>W(t(D_(e)))):[]),i=t(n.to);return c_(e,i===n.to?[n]:[new fg(i,n.transformation)])}return n(e)}case`Null`:return c_(e,[vS]);case`Boolean`:return c_(e,[yS]);case`Unknown`:case`ObjectKeyword`:return c_(e,[nv]);case`Enum`:case`Number`:case`Literal`:case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e});return e.recur(t);case`Union`:{let n=gS(e.types);return n===e.types?e.recur(t):new Xg(n,e.mode,e.annotations,e.checks,e.encoding,e.context).recur(t)}case`Arrays`:case`Suspend`:return e.recur(t)}return e}const vS=new fg(new wg(`null`),new Wh(U(()=>null),U(()=>`null`))),yS=new fg(new Xg([new wg(`true`),new wg(`false`)],`anyOf`),new Wh(U(e=>e===`true`),Lh())),bS=L_(e=>{let t=_S(e,bS,e=>c_(e,[xS]));return t!==e&&T_(e)?y_(t):t}),xS=new fg(xg,new Wh(Nh(),U(()=>void 0))),SS=L_(e=>{let t=_S(e,SS,x);return t!==e&&T_(e)?y_(t):t}),CS=`~effect/Schema/SERIALIZER_ENSURE_ARRAY`,wS=L_(e=>{if(dg(e)&&e.annotations?.[CS])return e;let t=TS(e);if(lg(t)){let n=new Xg([t,S_(Eg,t,new Wh(Hh(),Nh()))],`anyOf`,{[CS]:!0});return T_(e)?b_(n):n}return t});function TS(e){switch(e._tag){default:return e;case`Declaration`:case`Arrays`:case`Objects`:case`Union`:case`Suspend`:return e.recur(wS)}}const ES={_R:x,_E:x,_A:x},DS={"~effect/Stream":ES,pipe(){return y(this,arguments)}},OS=e=>{let t=Object.create(DS);return t.channel=e,t},kS=e=>S(e,`~effect/Stream`),AS=OS,jS=e=>e.channel,MS=(e,t)=>AS(qy(e,t)),NS=AS(Yy),PS=e=>AS(Jy(()=>e().channel)),FS=e=>AS(eb(e)),IS=e=>AS(nb(e)),LS=e=>AS(yb(B(e,jS))),RS=b(2,(e,t)=>PS(()=>{let n=0;return AS(rb(e.channel,si(e=>t(e,n++))))})),zS=b(e=>kS(e[0]),(e,t,n)=>e.channel.pipe(cb,ab(t,n),rb(oi),AS)),BS=b(e=>kS(e[0]),(e,t,n)=>zS(e,e=>bp(t(e),e),n)),VS=b(2,(e,t)=>AS(lb(jS(e),t))),HS=b(2,(e,t)=>e.channel.pipe(fb(t),AS)),US=b(2,(e,t)=>AS(hb(e.channel,t))),WS=e=>AS(gb(e.channel)),GS=b(e=>kS(e[0]),(e,t,n,r)=>AS(ub(e.channel,t,(e,t)=>{let r=ai();for(let i=0;i<t.length;i++){let[a,o]=n(e,t[i]);e=a,r.push(...o)}return[e,Kr(r)?oi(r):KS]},r?.onHalt?{onHalt(e){let t=r.onHalt(e);return qr(t)?oi(t):KS}}:void 0))),KS=ai(),qS=b(2,(e,t)=>AS(vb(e.channel,t))),JS=b(e=>kS(e[0]),(e,t)=>PS(()=>{let n=new TextDecoder(t?.encoding);return RS(e,e=>n.decode(e,{stream:!0}))})),YS=e=>e.channel.pipe(vb(_b()),AS),XS=b(2,(e,t)=>AS(xb(e.channel,e=>t(e[0])))),ZS=b(2,(e,t)=>AS(Sb(e.channel,t))),QS=b(2,(e,t)=>Yp(n=>Ob(e.channel,n).pipe(z(e=>t.transform(e,n)),B(([e])=>e)))),$S=e=>B(Eb(e.channel),Sr($r)),eC=b(2,(e,t)=>Tb(e.channel,e=>{let n=0;return rp({while:()=>n<e.length,body:()=>t(e[n++]),step:le})})),tC=b(2,(e,t)=>Tb(e.channel,t)),nC=e=>wb(e.channel),rC=e=>Db(e.channel),iC=b(e=>kS(e[0]),(e,t,n)=>{let r,i,a=Sv(!1);return new ReadableStream({start(n){i=pm(Wp(tC(e,e=>a.whenOpen(I(()=>{a.closeUnsafe();for(let t=0;t<e.length;t++)n.enqueue(e[t]);r(),r=void 0}))),t)),i.addObserver(e=>{e._tag===`Failure`?n.error(Au(e.cause)):n.close()})},pull(){return new Promise(e=>{r=e,a.openUnsafe()})},cancel(){if(i)return _m(xp(vv(i)))}},n?.strategy)}),aC=b(e=>kS(e[0]),(e,t)=>iC(e,ya(),t)),oC=BigInt(1024);oC*oC*oC*oC*oC;const sC=A(`effect/platform/FileSystem`);function cC(e){return{_tag:`Value`,value:e}}function lC(e,t){return{_tag:`Record`,keys:e,value:t}}function uC(e,t){return{_tag:`Array`,length:e,value:t}}const dC=Na(`effect/ConfigProvider`,{defaultValue:()=>mC()}),fC={...Yt,toJSON(){return{_id:`ConfigProvider`}}};function pC(e,t,n){let r=Object.create(fC);return r.get=e,r.mapInput=t,r.prefix=n,r.load=r=>(t&&(r=t(r)),n&&(r=[...n,...r]),e(r)),r}function mC(e){let t=e?.env??{...globalThis?.process?.env,...import.meta?.env},n=hC(t);return pC(e=>F(_C(n,t,e)))}function hC(e){let t={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let e=n.split(`_`),i=t;for(let t of e)i.children??={},i=i.children[t]??={};i.value=r}return t}const gC=/^(0|[1-9][0-9]*)$/;function _C(e,t,n){let r=t[n.map(String).join(`_`)],i=vC(e,n),a=i?.children?Object.keys(i.children):[];return a.length===0?r===void 0?void 0:cC(r):a.every(e=>gC.test(e))?uC(Math.max(...a.map(e=>parseInt(e,10)))+1,r):lC(new Set(a),r)}function vC(e,t){if(t.length===0)return e;let n=e;for(let e of t)if(n=n?.children?.[String(e)],!n)return;return n}const yC=`~effect/Config`;var bC=class{_tag=`ConfigError`;name=`ConfigError`;cause;constructor(e){this.cause=e}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}};const xC={...Yt,...Zt,[yC]:yC,asEffect(){return z(dC.asEffect(),e=>this.parse(e))},toJSON(){return{_id:`Config`}}};function SC(e){let t=Object.create(xC);return t.parse=e,t}const CC=b(2,(e,t)=>SC(n=>B(e.parse(n),t))),wC=b(2,(e,t)=>SC(n=>Sp(e.parse(n),e=>t(e).parse(n))));function TC(e){switch(e._tag){case`MissingKey`:return!0;case`InvalidType`:case`InvalidValue`:return fr(e.actual)||pr(e.actual)&&e.actual.value===void 0;case`OneOf`:return e.actual===void 0;case`Encoding`:return fr(e.actual)||pr(e.actual)&&e.actual.value===void 0?!0:TC(e.issue);case`Pointer`:case`Filter`:return TC(e.issue);case`UnexpectedKey`:return!1;case`Forbidden`:return!1;case`Composite`:case`AnyOf`:return e.issues.every(TC)}}const EC=b(2,(e,t)=>wC(e,e=>{if(ax(e.cause)){let n=e.cause.issue;if(TC(n))return MC(t)}return jC(e.cause)})),DC=e=>e.pipe(CC(O),EC(D())),OC=Tm(function*(e,t){let n=yield*e.load(t);if(n!==void 0)switch(n._tag){case`Value`:return n.value;case`Record`:{if(n.value!==void 0)return n.value;let r={};for(let i of n.keys){let n=yield*OC(e,[...t,i]);n!==void 0&&(r[i]=n)}return r}case`Array`:{if(n.value!==void 0)return n.value;let r=[];for(let i=0;i<n.length;i++)r.push(yield*OC(e,[...t,i]));return r}}}),kC=Tm(function*(e,t,n){switch(e._tag){case`Objects`:{let r={};for(let i of e.propertySignatures){let e=i.name;if(typeof e==`string`){let a=yield*kC(i.type,t,[...n,e]);a!==void 0&&(r[e]=a)}}if(e.indexSignatures.length>0){let i=yield*t.load(n);if(i&&i._tag===`Record`)for(let a of e.indexSignatures){let e=Fb(a.parameter);for(let o of i.keys)if(!Object.hasOwn(r,o)&&e(o)){let e=yield*kC(a.type,t,[...n,o]);e!==void 0&&(r[o]=e)}}}return r}case`Arrays`:{let r=yield*t.load(n);if(r&&r._tag===`Value`)return r.value;let i=[];for(let r=0;r<e.elements.length;r++)i.push(yield*kC(e.elements[r],t,[...n,r]));return i}case`Union`:return yield*OC(t,n);case`Suspend`:return yield*kC(e.thunk(),t,n);default:{let e=yield*t.load(n);return e===void 0?void 0:e._tag===`Value`||e._tag===`Record`&&e.value!==void 0||e._tag===`Array`&&e.value!==void 0?e.value:void 0}}});function AC(e,t){let n=mS(e),r=Ib(n),i=D_(n.ast),a=typeof t==`string`?[t]:t??[];return SC(e=>{let t=e.prefix?[...e.prefix,...a]:a;return kC(i,e,a).pipe(Fm(e=>r(e).pipe(Nm(e=>new ix(t.length>0?new uh(t,e):e)))),Nm(e=>new bC(e)))})}function jC(e){return SC(()=>R(new bC(e)))}function MC(e){return SC(()=>F(e))}function NC(e){return AC(G,e)}const PC=`~effect/FiberSet`,FC=e=>S(e,PC),IC={[PC]:PC,[Symbol.iterator](){return this.state._tag===`Closed`?Pr():this.state.backing[Symbol.iterator]()},...Yt,toJSON(){return{_id:`FiberMap`,state:this.state}}},LC=(e,t)=>{let n=Object.create(IC);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},RC=()=>Xp(I(()=>LC(new Set,Yu())),e=>cp(()=>{let t=e.state;if(t._tag===`Closed`)return lp;e.state={_tag:`Closed`};let n=t.backing;return yv(n).pipe(ad(e.deferred))})),zC=sa(la(Pu,ca(-1))),BC=b(e=>FC(e[0]),(e,t,n)=>{if(e.state._tag===`Closed`){t.interruptUnsafe(-1);return}else if(e.state.backing.has(t))return;e.state.backing.add(t),t.addObserver(r=>{e.state._tag!==`Closed`&&(e.state.backing.delete(t),Ku(r)&&(n?.propagateInterruption===!0?!zC(r.cause):!ku(r.cause))&&id(e.deferred,r))})}),VC=function(){let e;return()=>(e===void 0&&(e=pm(tm)),e)}(),HC=e=>()=>B(Vp(),t=>{let n=mm(t);return(t,r)=>{if(e.state._tag===`Closed`)return VC();let i=n(t,r);return BC(e,i),i}}),UC=e=>Zu(e.deferred),WC=e=>S(e,`~effect/Logger`),GC=fu,KC=pu,qC=/^[^\s"=]*$/,JC=e=>`#${e}`,YC=gu(((e,t)=>({cause:n,date:r,fiber:i,logLevel:a,message:o})=>{let s=t=>t.match(qC)?t:e(t),c=(e,t)=>`${_u(e)}=${s(t)}`,l=(e,t)=>` `+c(e,t),u=c(`timestamp`,r.toISOString());u+=l(`level`,a),u+=l(`fiber`,JC(i.id));let d=Vr(o);for(let e=0;e<d.length;e++)u+=l(`message`,Ct(d[e],{space:t}));n.reasons.length>0&&(u+=l(`cause`,jo(n)));let f=r.getTime(),p=i.getRef(oo);for(let e of p)u+=` `+vu(e,f);let m=i.getRef(ro);for(let[e,n]of Object.entries(m))u+=l(e,Ct(n,{space:t}));return u})(JSON.stringify,0)),XC=b(2,(e,t)=>N(Kc,n=>{let r=[],i=M(()=>{if(r.length===0)return ts;let e=r;return r=[],t.flush(e)});return dl(a=>a(ru(t.window).pipe(Ss(i),nc)).pipe(yl,N(e=>Bc(n,()=>Wo(e))),Ss(Zc(()=>i)),bs(gu(t=>{r.push(e.log(t))}))))})),ZC=(e,t)=>Od(GC,E(fs(function*(n){let r=new Set(t?.mergeWithExisting===!0?n.getRef(fu):[]);for(let t of e)r.add(en(t)?yield*t:t);return r}))),QC=b(e=>WC(e[0]),(e,t,n)=>ds(function*(){let r=yield*(yield*sC).open(t,{flag:`a+`,...n}),i=new TextEncoder;return yield*XC(e,{window:n?.batchWindow??1e3,flush:e=>yc(r.write(i.encode(e.join(`
22
21
  `)+`
23
- `)))})})),vT=`~effect/ManagedRuntime`,yT=(e,t)=>{let n=t?.memoMap??jd(),r=gd(),i,a=wp(t=>(i||=Iv(Em(Dp(Nd(e,n,r),e=>F(()=>{o.cachedServices=e})),{scheduler:t.currentScheduler}),r),Tp(Av(i)))),o={[vT]:vT,memoMap:n,scope:r,servicesEffect:a,cachedServices:void 0,services(){return o.cachedServices===void 0?Am(o.servicesEffect):Promise.resolve(o.cachedServices)},dispose(){return Am(o.disposeEffect)},disposeEffect:vp(()=>(o.servicesEffect=Sp(`ManagedRuntime disposed`),o.cachedServices=void 0,Sd(o.scope,Zu))),runFork(e,t){return o.cachedServices===void 0?Em(bT(o,e),t):Dm(o.cachedServices)(e,t)},runCallback(e,t){return o.cachedServices===void 0?km(bT(o,e),t):Om(o.cachedServices)(e,t)},runSyncExit(e){return o.cachedServices===void 0?Im(bT(o,e)):Lm(o.cachedServices)(e)},runSync(e){return o.cachedServices===void 0?Pm(bT(o,e)):Fm(o.cachedServices)(e)},runPromiseExit(e,t){return o.cachedServices===void 0?Mm(bT(o,e),t):Nm(o.cachedServices)(e,t)},runPromise(e,t){return o.cachedServices===void 0?Am(bT(o,e),t):jm(o.cachedServices)(e,t)}};return o};function bT(e,t){return z(e.servicesEffect,e=>tm(t,e))}const xT=`~effect/match/Match/Matcher`,ST={[xT]:{_input:x,_filters:x,_remaining:x,_result:x,_return:x},_tag:`TypeMatcher`,add(e){return CT([...this.cases,e])},pipe(){return y(this,arguments)}};function CT(e){let t=Object.create(ST);return t.cases=e,t}const wT={[xT]:{_input:x,_filters:x,_result:x,_return:x},_tag:`ValueMatcher`,add(e){return jr(this.value)?this:e._tag===`When`&&e.guard(this.provided)===!0||e._tag===`Not`&&e.guard(this.provided)===!1?TT(this.provided,Or(e.evaluate(this.provided))):this},pipe(){return y(this,arguments)}};function TT(e,t){let n=Object.create(wT);return n.provided=e,n.value=t,n}const ET=(e,t)=>({_tag:`When`,guard:e,evaluate:t}),DT=e=>{if(typeof e==`function`)return e;if(Array.isArray(e)){let t=e.map(DT),n=t.length;return e=>{if(!Array.isArray(e))return!1;for(let r=0;r<n;r++)if(t[r](e[r])===!1)return!1;return!0}}else if(typeof e==`object`&&e){let t=Object.entries(e).map(([e,t])=>[e,DT(t)]),n=t.length;return e=>{if(typeof e!=`object`||!e)return!1;for(let r=0;r<n;r++){let[n,i]=t[r];if(!(n in e)||i(e[n])===!1)return!1}return!0}}return t=>t===e},OT=e=>TT(e,kr(e)),kT=b(2,(e,t)=>MT(t)(CT([]))(e)),AT=(e,t)=>n=>n.add(ET(DT(e),t)),jT=e=>t=>{let n=ET(n=>n!=null&&n[e]in t,n=>t[n[e]](n));return e=>e.add(n)},MT=(e=>t=>{let n=jT(e)(t);return e=>IT(n(e))})(`_tag`),NT=e=>t=>{let n=PT(t);return Ar(n)?n._tag===`Success`?n.success:e(n.failure):t=>{let r=n(t);return jr(r)?r.success:e(r.failure)}},PT=e=>{if(e._tag===`ValueMatcher`)return e.value;let t=e.cases.length;if(t===1){let t=e.cases[0];return e=>t._tag===`When`&&t.guard(e)===!0||t._tag===`Not`&&t.guard(e)===!1?Or(t.evaluate(e)):kr(e)}return n=>{for(let r=0;r<t;r++){let t=e.cases[r];if(t._tag===`When`&&t.guard(n)===!0||t._tag===`Not`&&t.guard(n)===!1)return Or(t.evaluate(n))}return kr(n)}},FT=`effect/match/Match/exhaustive: absurd`,IT=e=>{let t=PT(e);if(Ar(t)){if(jr(t))return t.success;throw Error(FT)}return e=>{let n=t(e);if(jr(n))return n.success;throw Error(FT)}},LT=OT,RT=kT,zT=AT,BT=MT,VT=NT,HT=IT,UT={"~effect/Ref":{_A:x},...Xt,toJSON(){return{_id:`Ref`,ref:this.ref}}},WT=e=>{let t=Object.create(UT);return t.ref=Zv(e),t},GT=e=>F(()=>WT(e)),KT=e=>F(()=>e.ref.current),qT=b(2,(e,t)=>F(()=>Qv(e.ref,t))),JT=e=>e.ref.current,YT=_v(),XT=_v(),ZT=`~effect/ChildProcessSpawner/ChildProcessHandle`,QT={[ZT]:ZT,...Ft,toJSON(){return{_id:`ChildProcessHandle`,pid:this.pid}}},$T=e=>Object.assign(Object.create(QT),e),eE=e=>{let t=(t,n)=>e(t).pipe(B(e=>GC(n?.includeStderr===!0?e.all:e.stdout)),MC),n=(e,n)=>KC(t(e,n));return tE.of({spawn:e,exitCode:t=>om(z(e(t),e=>e.exitCode)),streamString:t,streamLines:n,lines:(e,t)=>XC(n(e,t)),string:(e,n)=>nw(t(e,n))})};var tE=class extends A()(`effect/process/ChildProcessSpawner`){};const nE=`~effect/unstable/process/ChildProcess`,rE={...Xt,...Qt,[nE]:nE,asEffect(){return tE.use(e=>e.spawn(this))}},iE=(e,t,n)=>Object.assign(Object.create(rE),{_tag:`StandardCommand`,command:e,args:t,options:n}),aE=function(...e){if(oE(e[0])){let[t,...n]=e,r=lE(t,n);return iE(r[0]??``,r.slice(1),{})}if(typeof e[0]==`object`&&!Array.isArray(e[0])&&!oE(e[0])){let t=e[0];return function(e,...n){let r=lE(e,n);return iE(r[0]??``,r.slice(1),t)}}if(typeof e[0]==`string`&&!Array.isArray(e[1])){let[t,n={}]=e;return iE(t,[],n)}let[t,n=[],r={}]=e;return iE(t,n,r)},oE=e=>Array.isArray(e)&&`raw`in e&&Array.isArray(e.raw),sE=e=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let n=parseInt(t[1],10);return n>=3?n:void 0},cE=e=>`fd${e}`,lE=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=uE(e,t,n,i,r);return n},uE=(e,t,n,r,i)=>{let a=e.raw[i];if(a===void 0)throw Error(`Invalid backslash sequence: ${e.raw[i]}`);let{hasLeadingWhitespace:o,hasTrailingWhitespace:s,tokens:c}=mE(r,a),l=hE(n,c,o);if(i===t.length)return l;let u=t[i];return hE(l,Array.isArray(u)?u.map(e=>dE(e)):[dE(u)],s)},dE=e=>typeof e==`string`?e:String(e),fE=new Set([` `,` `,`\r`,`
24
- `]),pE={x:3,u:5},mE=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let n=fE.has(t[0]),r=[],i=0;for(let n=0,a=0;n<e.length;n+=1,a+=1){let o=t[a];if(fE.has(o))i!==n&&r.push(e.slice(i,n)),i=n+1;else if(o===`\\`){let e=t[a+1];e===`
25
- `?(--n,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=pE[e]??1}}let a=i===e.length;return a||r.push(e.slice(i)),{tokens:r,hasLeadingWhitespace:n,hasTrailingWhitespace:a}},hE=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t.at(0)}`,...t.slice(1)];var gE=class extends Error{constructor(e){super(`${e} is locked`)}};const _E={old:new Set,young:new Set};let vE;const yE=()=>{let e=l.networkInterfaces(),t=new Set([void 0,`0.0.0.0`]);for(let n of Object.values(e))for(let e of n)t.add(e.address);return t},bE=e=>new Promise((t,n)=>{let r=f.createServer();r.unref(),r.on(`error`,n),r.listen(e,()=>{let{port:e}=r.address();r.close(()=>{t(e)})})}),xE=async(e,t)=>{if(e.host||e.port===0)return bE(e);for(let n of t)try{await bE({port:e.port,host:n})}catch(e){if(![`EADDRNOTAVAIL`,`EINVAL`].includes(e.code))throw e}return e.port},SE=function*(e){e&&(yield*e),yield 0};async function CE(e){let t,n=new Set;if(e&&(e.port&&(t=typeof e.port==`number`?[e.port]:e.port),e.exclude)){let t=e.exclude;if(typeof t[Symbol.iterator]!=`function`)throw TypeError("The `exclude` option must be an iterable.");for(let e of t){if(typeof e!=`number`)throw TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(e))throw TypeError(`Number ${e} in the exclude option is not a safe integer and can't be used`)}n=new Set(t)}vE===void 0&&(vE=setTimeout(()=>{vE=void 0,_E.old=_E.young,_E.young=new Set},15e3),vE.unref&&vE.unref());let r=yE();for(let i of SE(t))try{if(n.has(i))continue;let t=await xE({...e,port:i},r);for(;_E.old.has(t)||_E.young.has(t);){if(i!==0)throw new gE(i);t=await xE({...e,port:i},r)}return _E.young.add(t),t}catch(e){if(![`EADDRINUSE`,`EACCES`].includes(e.code)&&!(e instanceof gE))throw e}throw Error(`No available ports found`)}of(`CookieError`),{...Ft},{...Ft};const wE=Symbol.for(`~effect/http/Headers`),TE=Object.create(null);Object.defineProperties(TE,{[wE]:{value:wE},[vt]:{value(e){return NE(this,Da(e,PE))}},toJSON:{value(){return bt(this)}},[Ye]:{value(e){return DE(this,e)}},[Me]:{value(){return Be(this)}},toString:{value:Ft.toString},[jt]:{value:Ft[jt]}});const EE=e=>Object.assign(Object.create(TE),e),DE=Br(mt()),OE=Object.create(TE),kE=e=>{if(e===void 0)return OE;if(Symbol.iterator in e){let t=Object.create(TE);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(TE);for(let[n,r]of Object.entries(e))Array.isArray(r)?t[n.toLowerCase()]=r.join(`, `):r!==void 0&&(t[n.toLowerCase()]=r);return t},AE=b(3,(e,t,n)=>{let r=EE(e);return r[t.toLowerCase()]=n,r}),jE=b(2,(e,t)=>EE({...e,...kE(t)})),ME=b(2,(e,t)=>{let n=EE(e);return delete n[t.toLowerCase()],n}),NE=b(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=_h(e[r]))}else for(let r in e)t.test(r)&&(n[r]=_h(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),PE=Ia(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]});of(`HttpClientError`),of(`StatusCodeError`),of(`DecodeError`),of(`EmptyBodyError`);const FE=`~effect/http/UrlParams`,IE={...Xt,[FE]:FE,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[Ye](e){return BE(this,e)},[Me](){return He(this.params.flat())}},LE=e=>{let t=Object.create(IE);return t.params=e,t},RE=e=>{let t=zE(e),n=[];for(let e=0;e<t.length;e++)if(Array.isArray(t[e][0])){let[r,i]=t[e];n.push([`${r[0]}[${r.slice(1).join(`][`)}]`,i])}else n.push(t[e]);return LE(n)},zE=e=>{let t=typeof e[Symbol.iterator]==`function`?Hr(e):Object.entries(e),n=[];for(let[e,r]of t)if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]!==void 0&&n.push([e,String(r[t])]);else if(typeof r==`object`){let t=zE(r);for(let[r,i]of t)n.push([[e,...typeof r==`string`?[r]:r],i])}else r!==void 0&&n.push([e,String(r)]);return n},BE=ft((e,t)=>VE(e.params,t.params)),VE=fi(Mr([mt(),mt()])),HE=LE([]),UE=b(2,(e,t)=>{let n=RE(t),r=n.params,i=new Set;for(let e=0;e<r.length;e++)i.add(r[e][0]);for(let t=0;t<e.params.length;t++)i.has(e.params[t][0])||r.push(e.params[t]);return n}),WE=`~effect/http/HttpBody`;of(`HttpBodyError`);var GE=class{[WE];constructor(){this[WE]=WE}[jt](){return this.toJSON()}toString(){return wt(this,{ignoreToString:!0})}};const KE=new class extends GE{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},qE=`~effect/http/HttpClientRequest`,JE={[qE]:qE,...Ft,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:bt(this.headers),body:this.body.toJSON()}},pipe(){return y(this,arguments)}};function YE(e,t,n,r,i,a){let o=Object.create(JE);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}const XE=YE(`GET`,``,HE,D(),OE,KE),ZE=e=>(t,n)=>QE(XE,{method:e,url:t,...n??void 0}),QE=b(2,(e,t)=>{let n=e;return t.method&&(n=$E(n,t.method)),t.url&&(n=iD(n,t.url)),t.headers&&(n=tD(n,t.headers)),t.urlParams&&(n=aD(n,t.urlParams)),t.hash&&(n=oD(n,t.hash)),t.body&&(n=sD(n,t.body)),t.accept&&(n=nD(n,t.accept)),t.acceptJson&&(n=rD(n)),n}),$E=b(2,(e,t)=>YE(t,e.url,e.urlParams,e.hash,e.headers,e.body)),eD=b(3,(e,t,n)=>YE(e.method,e.url,e.urlParams,e.hash,AE(e.headers,t,n),e.body)),tD=b(2,(e,t)=>YE(e.method,e.url,e.urlParams,e.hash,jE(e.headers,t),e.body)),nD=b(2,(e,t)=>eD(e,`Accept`,t)),rD=nD(`application/json`),iD=b(2,(e,t)=>{if(typeof t==`string`)return YE(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=RE(n.searchParams),i=_r(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,YE(e.method,n.toString(),r,i,e.headers,e.body)}),aD=b(2,(e,t)=>YE(e.method,e.url,UE(e.urlParams,t),e.hash,e.headers,e.body)),oD=b(2,(e,t)=>YE(e.method,e.url,e.urlParams,O(t),e.headers,e.body)),sD=b(2,(e,t)=>{let n=e.headers;return t._tag===`Empty`||t._tag===`FormData`?n=ME(ME(n,`Content-Type`),`Content-length`):(t.contentType&&(n=AE(n,`content-type`,t.contentType)),t.contentLength!==void 0&&(n=AE(n,`content-length`,t.contentLength.toString()))),YE(e.method,e.url,e.urlParams,e.hash,n,t)}),cD=(e,t)=>{let n=Ox(NS(e).annotate({options:t}));return e=>z(e.json,n)},lD=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`]],uD=A(`effect/HttpClient`);({...Ft}),{...Object.fromEntries(lD.map(([e,t])=>[t,function(t,n){return this.execute(ZE(e)(t,n))}]))};const dD=`~effect/socket/Socket`,fD=e=>S(e,dD),pD=A(`effect/socket/Socket`),mD=e=>S(e,`~effect/socket/Socket/CloseEvent`),hD=`~effect/socket/Socket/SocketError`,gD=e=>S(e,hD);var _D=class extends q(`effect/socket/Socket/SocketReadError`)({_tag:K(`SocketReadError`),cause:bS}){message=`An error occurred during Read`},vD=class extends q(`effect/socket/Socket/SocketWriteError`)({_tag:K(`SocketWriteError`),cause:bS}){message=`An error occurred during Write`},yD=class extends q(`effect/socket/Socket/SocketOpenError`)({_tag:K(`SocketOpenError`),kind:tS([`Unknown`,`Timeout`]),cause:bS}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},bD=class extends q(`effect/socket/Socket/SocketCloseError`)({_tag:K(`SocketCloseError`),code:Ux,closeReason:Ix(G)}){static filterClean(e){return function(t){return SD.is(t)&&t.reason._tag===`SocketCloseError`&&e(t.reason.code)?Or(t.reason):kr(t)}}get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}};const xD=eS([_D,vD,yD,bD]);var SD=class extends MS(hD)(`SocketError`,{_tag:K(`SocketError`),reason:xD}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[hD]=hD;static is(e){return gD(e)}message=this.reason.message};const CD=(e,t)=>rb(Rm(function*(n,r){let i=yield*Ty(),a=yield*bd(r),o=yield*_d(e.writer,a),s,c=0,l=pp({while:()=>c<s.length,body:()=>o(s[c++]),step:le});return yield*n.pipe(z(e=>e.length===1?o(e[0]):(s=e,c=0,l)),_m({disableYield:!0}),Ip(If,e=>Ay(i,e)),um(Sd(a,Zu)),Sm(r)),yield*e.runRaw(e=>{ky(i,t(e))}).pipe(By(i),Sm(r)),Fy(i)})),wD=b(e=>fD(e[0]),(e,t)=>{let n=new TextDecoder(t);return CD(e,e=>typeof e==`string`?e:n.decode(e))}),TD=e=>e!==1e3&&e!==1006;var ED=class extends A()(`~effect/socket/Socket/WebSocket`){},DD=class extends A()(`@effect/platform/Socket/WebSocketConstructor`){};const OD=Fd(DD)((e,t)=>new globalThis.WebSocket(e,t)),kD=(e,t)=>DD.use(n=>AD(cm((typeof e==`string`?P(e):e).pipe(B(e=>n(e,t?.protocols))),e=>F(()=>e.close(1e3))),t)),AD=(e,t)=>wp(n=>{let r,i=Lv(!1),a=n.services,o=t?.closeCodeIsError??TD,s=(n,s)=>sm(Rm(function*(a){let c=yield*rT().pipe(_d(a)),l=yield*_d(e,a),u=yield*im(sT(c)(),ED,l),d=!1;function f(e){if(e.data instanceof Blob)return u(z(mp(()=>e.data.arrayBuffer()),e=>{let t=n(new Uint8Array(e));return up(t)?t:I}));let t=n(e.data);up(t)&&u(t)}function p(e){l.removeEventListener(`message`,f),l.removeEventListener(`close`,m),pd(c.deferred,R(new SD({reason:d?new _D({cause:e}):new yD({kind:`Unknown`,cause:e})})))}function m(e){let t=typeof e.code==`number`?e.code:1001;l.removeEventListener(`message`,f),l.removeEventListener(`error`,p),pd(c.deferred,R(new SD({reason:new bD({code:t,closeReason:e.reason})})))}if(l.addEventListener(`close`,m,{once:!0}),l.addEventListener(`error`,p,{once:!0}),l.addEventListener(`message`,f),l.readyState!==1){let e=nd();l.addEventListener(`open`,()=>{d=!0,pd(e,I)},{once:!0}),yield*id(e).pipe(Gp({duration:t?.openTimeout??1e4,onTimeout:()=>R(new SD({reason:new yD({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))}),Jp(cT(c)))}return d=!0,r=l,i.openUnsafe(),s?.onOpen&&(yield*s.onOpen),yield*Fp(cT(c),bD.filterClean(e=>!o(e)),()=>I)})).pipe(rm(e=>Na(a,e)),um(F(()=>{i.closeUnsafe(),r=void 0}))),c=new TextEncoder,l=(e,t)=>s(t=>typeof t==`string`?e(c.encode(t)):t instanceof Uint8Array?e(t):e(new Uint8Array(t)),t),u=P(e=>i.whenOpen(F(()=>{let t=r;mD(e)?t.close(e.code,e.reason):t.send(e)})));return P(pD.of({[dD]:dD,run:l,runRaw:s,writer:u}))}),jD=de(kD,Ld(pD)),MD=m(o);async function ND(){if(h.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await MD(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}const PD=m(o);async function FD(e,{humanReadableOutput:t=!0,signal:n}={}){if(h.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await PD(`osascript`,[`-e`,e,r],i);return a.trim()}async function ID(e){return FD(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const LD=m(o),RD={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}};new Map(Object.entries(RD));var zD=class extends Error{};async function BD(e=LD){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new zD(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=r.lastIndexOf(`.`),a=r.lastIndexOf(`-`),o=i===-1?void 0:r.slice(0,i),s=a===-1?void 0:r.slice(0,a);return RD[r]??RD[o]??RD[s]??{name:r,id:r}}const VD=m(o),HD=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function UD(){if(h.platform===`darwin`){let e=await ND();return{name:await ID(e),id:e}}if(h.platform===`linux`){let{stdout:e}=await VD(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:HD(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(h.platform===`win32`)return BD();throw Error(`Only macOS, Linux, and Windows are supported`)}var WD=t(((e,t)=>{let{hasOwnProperty:n}=Object.prototype,r=(e,t={})=>{typeof t==`string`&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<`u`&&process.platform,t.bracketedArray=t.bracketedArray!==!1;let n=t.platform===`win32`?`\r
22
+ `)))})})),$C=`~effect/ManagedRuntime`,ew=(e,t)=>{let n=t?.memoMap??Sd(),r=sd(),i,a=hp(t=>(i||=xv(pm(vp(wd(e,n,r),e=>I(()=>{o.cachedServices=e})),{scheduler:t.currentScheduler}),r),gp(hv(i)))),o={[$C]:$C,memoMap:n,scope:r,servicesEffect:a,cachedServices:void 0,services(){return o.cachedServices===void 0?_m(o.servicesEffect):Promise.resolve(o.cachedServices)},dispose(){return _m(o.disposeEffect)},disposeEffect:cp(()=>(o.servicesEffect=pp(`ManagedRuntime disposed`),o.cachedServices=void 0,pd(o.scope,Wu))),runFork(e,t){return o.cachedServices===void 0?pm(tw(o,e),t):mm(o.cachedServices)(e,t)},runCallback(e,t){return o.cachedServices===void 0?gm(tw(o,e),t):hm(o.cachedServices)(e,t)},runSyncExit(e){return o.cachedServices===void 0?Cm(tw(o,e)):wm(o.cachedServices)(e)},runSync(e){return o.cachedServices===void 0?xm(tw(o,e)):Sm(o.cachedServices)(e)},runPromiseExit(e,t){return o.cachedServices===void 0?ym(tw(o,e),t):bm(o.cachedServices)(e,t)},runPromise(e,t){return o.cachedServices===void 0?_m(tw(o,e),t):vm(o.cachedServices)(e,t)}};return o};function tw(e,t){return z(e.servicesEffect,e=>Wp(t,e))}const nw=`~effect/match/Match/Matcher`,rw={[nw]:{_input:x,_filters:x,_remaining:x,_result:x,_return:x},_tag:`TypeMatcher`,add(e){return iw([...this.cases,e])},pipe(){return y(this,arguments)}};function iw(e){let t=Object.create(rw);return t.cases=e,t}const aw={[nw]:{_input:x,_filters:x,_result:x,_return:x},_tag:`ValueMatcher`,add(e){return kr(this.value)?this:e._tag===`When`&&e.guard(this.provided)===!0||e._tag===`Not`&&e.guard(this.provided)===!1?ow(this.provided,Er(e.evaluate(this.provided))):this},pipe(){return y(this,arguments)}};function ow(e,t){let n=Object.create(aw);return n.provided=e,n.value=t,n}const sw=(e,t)=>({_tag:`When`,guard:e,evaluate:t}),cw=e=>{if(typeof e==`function`)return e;if(Array.isArray(e)){let t=e.map(cw),n=t.length;return e=>{if(!Array.isArray(e))return!1;for(let r=0;r<n;r++)if(t[r](e[r])===!1)return!1;return!0}}else if(typeof e==`object`&&e){let t=Object.entries(e).map(([e,t])=>[e,cw(t)]),n=t.length;return e=>{if(typeof e!=`object`||!e)return!1;for(let r=0;r<n;r++){let[n,i]=t[r];if(!(n in e)||i(e[n])===!1)return!1}return!0}}return t=>t===e},lw=e=>ow(e,Dr(e)),uw=b(2,(e,t)=>pw(t)(iw([]))(e)),dw=(e,t)=>n=>n.add(sw(cw(e),t)),fw=e=>t=>{let n=sw(n=>n!=null&&n[e]in t,n=>t[n[e]](n));return e=>e.add(n)},pw=(e=>t=>{let n=fw(e)(t);return e=>_w(n(e))})(`_tag`),mw=e=>t=>{let n=hw(t);return Or(n)?n._tag===`Success`?n.success:e(n.failure):t=>{let r=n(t);return kr(r)?r.success:e(r.failure)}},hw=e=>{if(e._tag===`ValueMatcher`)return e.value;let t=e.cases.length;if(t===1){let t=e.cases[0];return e=>t._tag===`When`&&t.guard(e)===!0||t._tag===`Not`&&t.guard(e)===!1?Er(t.evaluate(e)):Dr(e)}return n=>{for(let r=0;r<t;r++){let t=e.cases[r];if(t._tag===`When`&&t.guard(n)===!0||t._tag===`Not`&&t.guard(n)===!1)return Er(t.evaluate(n))}return Dr(n)}},gw=`effect/match/Match/exhaustive: absurd`,_w=e=>{let t=hw(e);if(Or(t)){if(kr(t))return t.success;throw Error(gw)}return e=>{let n=t(e);if(kr(n))return n.success;throw Error(gw)}},vw=lw,yw=uw,bw=dw,xw=pw,Sw=mw,Cw=_w,ww={"~effect/Ref":{_A:x},...Yt,toJSON(){return{_id:`Ref`,ref:this.ref}}},Tw=e=>{let t=Object.create(ww);return t.ref=Iv(e),t},Ew=e=>I(()=>Tw(e)),Dw=e=>I(()=>e.ref.current),Ow=b(2,(e,t)=>I(()=>Lv(e.ref,t))),kw=e=>e.ref.current;({...Pt});var Aw=class extends A()(`effect/process/ChildProcessSpawner`){};const jw=`~effect/unstable/process/ChildProcess`,Mw={...Yt,...Zt,[jw]:jw,asEffect(){return Aw.use(e=>e.spawn(this))}},Nw=(e,t,n)=>Object.assign(Object.create(Mw),{_tag:`StandardCommand`,command:e,args:t,options:n}),Pw=function(...e){if(Fw(e[0])){let[t,...n]=e,r=Iw(t,n);return Nw(r[0]??``,r.slice(1),{})}if(typeof e[0]==`object`&&!Array.isArray(e[0])&&!Fw(e[0])){let t=e[0];return function(e,...n){let r=Iw(e,n);return Nw(r[0]??``,r.slice(1),t)}}if(typeof e[0]==`string`&&!Array.isArray(e[1])){let[t,n={}]=e;return Nw(t,[],n)}let[t,n=[],r={}]=e;return Nw(t,n,r)},Fw=e=>Array.isArray(e)&&`raw`in e&&Array.isArray(e.raw),Iw=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=Lw(e,t,n,i,r);return n},Lw=(e,t,n,r,i)=>{let a=e.raw[i];if(a===void 0)throw Error(`Invalid backslash sequence: ${e.raw[i]}`);let{hasLeadingWhitespace:o,hasTrailingWhitespace:s,tokens:c}=Vw(r,a),l=Hw(n,c,o);if(i===t.length)return l;let u=t[i];return Hw(l,Array.isArray(u)?u.map(e=>Rw(e)):[Rw(u)],s)},Rw=e=>typeof e==`string`?e:String(e),zw=new Set([` `,` `,`\r`,`
23
+ `]),Bw={x:3,u:5},Vw=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let n=zw.has(t[0]),r=[],i=0;for(let n=0,a=0;n<e.length;n+=1,a+=1){let o=t[a];if(zw.has(o))i!==n&&r.push(e.slice(i,n)),i=n+1;else if(o===`\\`){let e=t[a+1];e===`
24
+ `?(--n,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=Bw[e]??1}}let a=i===e.length;return a||r.push(e.slice(i)),{tokens:r,hasLeadingWhitespace:n,hasTrailingWhitespace:a}},Hw=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t.at(0)}`,...t.slice(1)],Uw=`EXPECT_LIVE_VIEW_URL`;var Ww=class extends Error{constructor(e){super(`${e} is locked`)}};const Gw={old:new Set,young:new Set};let Kw;const qw=()=>{let e=d.networkInterfaces(),t=new Set([void 0,`0.0.0.0`]);for(let n of Object.values(e))for(let e of n)t.add(e.address);return t},Jw=e=>new Promise((t,n)=>{let r=f.createServer();r.unref(),r.on(`error`,n),r.listen(e,()=>{let{port:e}=r.address();r.close(()=>{t(e)})})}),Yw=async(e,t)=>{if(e.host||e.port===0)return Jw(e);for(let n of t)try{await Jw({port:e.port,host:n})}catch(e){if(![`EADDRNOTAVAIL`,`EINVAL`].includes(e.code))throw e}return e.port},Xw=function*(e){e&&(yield*e),yield 0};async function Zw(e){let t,n=new Set;if(e&&(e.port&&(t=typeof e.port==`number`?[e.port]:e.port),e.exclude)){let t=e.exclude;if(typeof t[Symbol.iterator]!=`function`)throw TypeError("The `exclude` option must be an iterable.");for(let e of t){if(typeof e!=`number`)throw TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(e))throw TypeError(`Number ${e} in the exclude option is not a safe integer and can't be used`)}n=new Set(t)}Kw===void 0&&(Kw=setTimeout(()=>{Kw=void 0,Gw.old=Gw.young,Gw.young=new Set},15e3),Kw.unref&&Kw.unref());let r=qw();for(let i of Xw(t))try{if(n.has(i))continue;let t=await Yw({...e,port:i},r);for(;Gw.old.has(t)||Gw.young.has(t);){if(i!==0)throw new Ww(i);t=await Yw({...e,port:i},r)}return Gw.young.add(t),t}catch(e){if(![`EADDRINUSE`,`EACCES`].includes(e.code)&&!(e instanceof Ww))throw e}throw Error(`No available ports found`)}var Qw=class extends q(`CookieDatabaseNotFoundError`)({_tag:K(`CookieDatabaseNotFoundError`),browser:G}){message=`Cookie database not found for ${this.browser}`},$w=class extends q(`CpdInvalidResponsePayload`)({_tag:K(`CpdInvalidResponsePayload`),code:Cx,errorMessage:G}){message=`Network.getAllCookies responded with #${this.code}: ${this.errorMessage}`},eT=class extends q(`DebuggerUrlNotFoundError`)({_tag:K(`DebuggerUrlNotFoundError`)}){message=`Debugger URL not found`},tT=class extends q(`UnknownError`)({_tag:K(`UnknownError`),cause:bx}){message=`An unexpected error occurred. ${Tu(this.cause)?Fu(this.cause):String(this.cause)}`},nT=class extends q(`RequiresFullDiskAccess`)({_tag:K(`RequiresFullDiskAccess`)}){message=`Safari cookie extraction requires Full Disk Access`},rT=class extends q(`ExtractionError`)({_tag:K(`ExtractionError`),reason:Px([$w,eT,nT,tT])}){message=`Extracting cookies failed. Error: ${this.reason.message}`},iT=class extends q(`CookieDatabaseCopyError`)({_tag:K(`CookieDatabaseCopyError`),browser:G,databasePath:G,cause:G}){message=`Failed to copy cookie database for ${this.browser}: ${this.cause}`},aT=class extends q(`CookieDecryptionKeyError`)({_tag:K(`CookieDecryptionKeyError`),browser:G,platform:G}){message=`Decryption key not found for ${this.browser} on ${this.platform}`},oT=class extends q(`CookieReadError`)({_tag:K(`CookieReadError`),browser:G,cause:G}){message=`Failed to read cookies for ${this.browser}: ${this.cause}`},sT=class extends q(`ListBrowsersError`)({_tag:K(`ListBrowsersError`),cause:G}){message=`Failed to list browsers: ${this.cause}`};const cT=Fx([`Strict`,`Lax`,`None`]);Fx([`chrome`,`edge`,`brave`,`arc`,`dia`,`helium`,`chromium`,`vivaldi`,`opera`,`ghost`,`sidekick`,`yandex`,`iridium`,`thorium`,`sigmaos`,`wavebox`,`comet`,`blisk`,`firefox`,`safari`]);const lT=Fx([`chrome`,`edge`,`brave`,`arc`,`dia`,`helium`,`chromium`,`vivaldi`,`opera`,`ghost`,`sidekick`,`yandex`,`iridium`,`thorium`,`sigmaos`,`wavebox`,`comet`,`blisk`]),uT=G.pipe(Vx(G,{decode:U(e=>e.startsWith(`.`)?e.slice(1):e),encode:U(e=>e)}));var dT=class extends uS(`@cookies/Cookie`)({name:G,value:G,domain:uT,path:G,expires:gx(Cx.pipe(Vx(Cx,{decode:U(e=>Math.floor(e)),encode:U(e=>e)}))),secure:wx,httpOnly:wx,sameSite:gx(cT)}){static make=ux(this);get playwrightFormat(){let e=this.name.startsWith(`__Host-`)||this.domain.startsWith(`.`)?this.domain:`.${this.domain}`;return{name:this.name,value:this.value,domain:e,path:this.path,expires:this.expires??-1,secure:this.secure,httpOnly:this.httpOnly,sameSite:this.sameSite}}},fT=class extends uS(`@cookies/ChromiumBrowser`)({_tag:K(`ChromiumBrowser`),key:lT,profileName:G,profilePath:G,executablePath:G,locale:gx(G)}){static orderBy=e=>cr(lr(sr,t=>t.profileName===e),lr(ar((e,t)=>e.localeCompare(t,void 0,{numeric:!0})),e=>e.profileName))},pT=class extends uS(`@cookies/FirefoxBrowser`)({_tag:K(`FirefoxBrowser`),profileName:G,profilePath:G}){},mT=class extends uS(`@cookies/SafariBrowser`)({_tag:K(`SafariBrowser`),cookieFilePath:Xx(G)}){};Px([fT,pT,mT]),Yd(`CookieError`),{...Pt},{...Pt};const hT=Symbol.for(`~effect/http/Headers`),gT=Object.create(null);Object.defineProperties(gT,{[hT]:{value:hT},[_t]:{value(e){return wT(this,Ta(e,TT))}},toJSON:{value(){return yt(this)}},[Je]:{value(e){return vT(this,e)}},[je]:{value(){return ze(this)}},toString:{value:Pt.toString},[At]:{value:Pt[At]}});const _T=e=>Object.assign(Object.create(gT),e),vT=Rr(pt()),yT=Object.create(gT),bT=e=>{if(e===void 0)return yT;if(Symbol.iterator in e){let t=Object.create(gT);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(gT);for(let[n,r]of Object.entries(e))Array.isArray(r)?t[n.toLowerCase()]=r.join(`, `):r!==void 0&&(t[n.toLowerCase()]=r);return t},xT=b(3,(e,t,n)=>{let r=_T(e);return r[t.toLowerCase()]=n,r}),ST=b(2,(e,t)=>_T({...e,...bT(t)})),CT=b(2,(e,t)=>{let n=_T(e);return delete n[t.toLowerCase()],n}),wT=b(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=rh(e[r]))}else for(let r in e)t.test(r)&&(n[r]=rh(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),TT=Na(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]});Yd(`HttpClientError`),Yd(`StatusCodeError`),Yd(`DecodeError`),Yd(`EmptyBodyError`);const ET=`~effect/http/UrlParams`,DT={...Yt,[ET]:ET,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[Je](e){return jT(this,e)},[je](){return Ve(this.params.flat())}},OT=e=>{let t=Object.create(DT);return t.params=e,t},kT=e=>{let t=AT(e),n=[];for(let e=0;e<t.length;e++)if(Array.isArray(t[e][0])){let[r,i]=t[e];n.push([`${r[0]}[${r.slice(1).join(`][`)}]`,i])}else n.push(t[e]);return OT(n)},AT=e=>{let t=typeof e[Symbol.iterator]==`function`?Br(e):Object.entries(e),n=[];for(let[e,r]of t)if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]!==void 0&&n.push([e,String(r[t])]);else if(typeof r==`object`){let t=AT(r);for(let[r,i]of t)n.push([[e,...typeof r==`string`?[r]:r],i])}else r!==void 0&&n.push([e,String(r)]);return n},jT=dt((e,t)=>MT(e.params,t.params)),MT=ui(Ar([pt(),pt()])),NT=OT([]),PT=b(2,(e,t)=>{let n=kT(t),r=n.params,i=new Set;for(let e=0;e<r.length;e++)i.add(r[e][0]);for(let t=0;t<e.params.length;t++)i.has(e.params[t][0])||r.push(e.params[t]);return n}),FT=`~effect/http/HttpBody`;Yd(`HttpBodyError`);var IT=class{[FT];constructor(){this[FT]=FT}[At](){return this.toJSON()}toString(){return Ct(this,{ignoreToString:!0})}};const LT=new class extends IT{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},RT=`~effect/http/HttpClientRequest`,zT={[RT]:RT,...Pt,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:yt(this.headers),body:this.body.toJSON()}},pipe(){return y(this,arguments)}};function BT(e,t,n,r,i,a){let o=Object.create(zT);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}const VT=BT(`GET`,``,NT,D(),yT,LT),HT=e=>(t,n)=>UT(VT,{method:e,url:t,...n??void 0}),UT=b(2,(e,t)=>{let n=e;return t.method&&(n=WT(n,t.method)),t.url&&(n=YT(n,t.url)),t.headers&&(n=KT(n,t.headers)),t.urlParams&&(n=XT(n,t.urlParams)),t.hash&&(n=ZT(n,t.hash)),t.body&&(n=QT(n,t.body)),t.accept&&(n=qT(n,t.accept)),t.acceptJson&&(n=JT(n)),n}),WT=b(2,(e,t)=>BT(t,e.url,e.urlParams,e.hash,e.headers,e.body)),GT=b(3,(e,t,n)=>BT(e.method,e.url,e.urlParams,e.hash,xT(e.headers,t,n),e.body)),KT=b(2,(e,t)=>BT(e.method,e.url,e.urlParams,e.hash,ST(e.headers,t),e.body)),qT=b(2,(e,t)=>GT(e,`Accept`,t)),JT=qT(`application/json`),YT=b(2,(e,t)=>{if(typeof t==`string`)return BT(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=kT(n.searchParams),i=gr(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,BT(e.method,n.toString(),r,i,e.headers,e.body)}),XT=b(2,(e,t)=>BT(e.method,e.url,PT(e.urlParams,t),e.hash,e.headers,e.body)),ZT=b(2,(e,t)=>BT(e.method,e.url,e.urlParams,O(t),e.headers,e.body)),QT=b(2,(e,t)=>{let n=e.headers;return t._tag===`Empty`||t._tag===`FormData`?n=CT(CT(n,`Content-Type`),`Content-length`):(t.contentType&&(n=xT(n,`content-type`,t.contentType)),t.contentLength!==void 0&&(n=xT(n,`content-length`,t.contentLength.toString()))),BT(e.method,e.url,e.urlParams,e.hash,n,t)}),$T=(e,t)=>{let n=cx(pS(e).annotate({options:t}));return e=>z(e.json,n)},eE=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`]],tE=A(`effect/HttpClient`);({...Pt}),{...Object.fromEntries(eE.map(([e,t])=>[t,function(t,n){return this.execute(HT(e)(t,n))}]))};const nE=`~effect/socket/Socket`,rE=e=>S(e,nE),iE=A(`effect/socket/Socket`),aE=e=>S(e,`~effect/socket/Socket/CloseEvent`),oE=`~effect/socket/Socket/SocketError`,sE=e=>S(e,oE);var cE=class extends q(`effect/socket/Socket/SocketReadError`)({_tag:K(`SocketReadError`),cause:eS}){message=`An error occurred during Read`},lE=class extends q(`effect/socket/Socket/SocketWriteError`)({_tag:K(`SocketWriteError`),cause:eS}){message=`An error occurred during Write`},uE=class extends q(`effect/socket/Socket/SocketOpenError`)({_tag:K(`SocketOpenError`),kind:Fx([`Unknown`,`Timeout`]),cause:eS}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},dE=class extends q(`effect/socket/Socket/SocketCloseError`)({_tag:K(`SocketCloseError`),code:Cx,closeReason:gx(G)}){static filterClean(e){return function(t){return pE.is(t)&&t.reason._tag===`SocketCloseError`&&e(t.reason.code)?Er(t.reason):Dr(t)}}get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}};const fE=Px([cE,lE,uE,dE]);var pE=class extends fS(oE)(`SocketError`,{_tag:K(`SocketError`),reason:fE}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[oE]=oE;static is(e){return sE(e)}message=this.reason.message};const mE=(e,t)=>Vy(Tm(function*(n,r){let i=yield*uy(),a=yield*dd(r),o=yield*cd(e.writer,a),s,c=0,l=rp({while:()=>c<s.length,body:()=>o(s[c++]),step:le});return yield*n.pipe(z(e=>e.length===1?o(e[0]):(s=e,c=0,l)),im({disableYield:!0}),Dp(Ef,e=>hy(i,e)),Qp(pd(a,Wu)),lm(r)),yield*e.runRaw(e=>{my(i,t(e))}).pipe(wy(i),lm(r)),yy(i)})),hE=b(e=>rE(e[0]),(e,t)=>{let n=new TextDecoder(t);return mE(e,e=>typeof e==`string`?e:n.decode(e))}),gE=e=>e!==1e3&&e!==1006;var _E=class extends A()(`~effect/socket/Socket/WebSocket`){},vE=class extends A()(`@effect/platform/Socket/WebSocketConstructor`){};const yE=Ed(vE)((e,t)=>new globalThis.WebSocket(e,t)),bE=(e,t)=>vE.use(n=>xE(Xp((typeof e==`string`?F(e):e).pipe(B(e=>n(e,t?.protocols))),e=>I(()=>e.close(1e3))),t)),xE=(e,t)=>hp(n=>{let r,i=Sv(!1),a=n.services,o=t?.closeCodeIsError??gE,s=(n,s)=>Yp(Tm(function*(a){let c=yield*RC().pipe(cd(a)),l=yield*cd(e,a),u=yield*Kp(HC(c)(),_E,l),d=!1;function f(e){if(e.data instanceof Blob)return u(z(ip(()=>e.data.arrayBuffer()),e=>{let t=n(new Uint8Array(e));return ep(t)?t:lp}));let t=n(e.data);ep(t)&&u(t)}function p(e){l.removeEventListener(`message`,f),l.removeEventListener(`close`,m),id(c.deferred,R(new pE({reason:d?new cE({cause:e}):new uE({kind:`Unknown`,cause:e})})))}function m(e){let t=typeof e.code==`number`?e.code:1001;l.removeEventListener(`message`,f),l.removeEventListener(`error`,p),id(c.deferred,R(new pE({reason:new dE({code:t,closeReason:e.reason})})))}if(l.addEventListener(`close`,m,{once:!0}),l.addEventListener(`error`,p,{once:!0}),l.addEventListener(`message`,f),l.readyState!==1){let e=Yu();l.addEventListener(`open`,()=>{d=!0,id(e,lp)},{once:!0}),yield*Zu(e).pipe(Ip({duration:t?.openTimeout??1e4,onTimeout:()=>R(new pE({reason:new uE({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))}),Rp(UC(c)))}return d=!0,r=l,i.openUnsafe(),s?.onOpen&&(yield*s.onOpen),yield*Ep(UC(c),dE.filterClean(e=>!o(e)),()=>lp)})).pipe(Gp(e=>Aa(a,e)),Qp(I(()=>{i.closeUnsafe(),r=void 0}))),c=new TextEncoder,l=(e,t)=>s(t=>typeof t==`string`?e(c.encode(t)):t instanceof Uint8Array?e(t):e(new Uint8Array(t)),t),u=F(e=>i.whenOpen(I(()=>{let t=r;aE(e)?t.close(e.code,e.reason):t.send(e)})));return F(iE.of({[nE]:nE,run:l,runRaw:s,writer:u}))}),SE=de(bE,Od(iE)),CE=[`--headless=new`,`--disable-gpu`,`--no-first-run`,`--no-default-browser-check`,`--remote-debugging-address=127.0.0.1`],wE=Dx({id:Cx,error:hx(Dx({code:Cx,message:G})),result:hx(Dx({cookies:jx(dT)}))});var TE=class extends A()(`@cookies/CdpClient`,{make:L(function*(){let e=yield*sC,t=yield*Aw,r=yield*tE,i=d.tmpdir(),a=(yield*e.readDirectory(i).pipe(Cp(`PlatformError`,()=>F([])))).filter(e=>e.startsWith(`cookies-cdp-`));a.length>0&&(yield*Om(`Cleaning up stale CDP temp directories`,{count:a.length}),yield*np(a,t=>e.remove(n.join(i,t),{recursive:!0}).pipe(Cp(`PlatformError`,()=>lp)),{concurrency:`unbounded`}));let o=H(`CdpClient.getAllCookies`)(function*(){let e=yield*iE,t=yield*e.writer,n=yield*Xu();return yield*e.runRaw(e=>L(function*(){let t=yield*cx(nS(wE))(e.toString());if(t.error)return yield*ed(n,new rT({reason:new $w({code:t.error.code,errorMessage:t.error.message})}));t.result&&(yield*rd(n,t.result.cookies))})).pipe(jp(e=>ed(n,new rT({reason:new tT({cause:e})}))),um),yield*t(JSON.stringify({id:1,method:`Network.getAllCookies`})),yield*Zu(n).pipe(Pp(`10 seconds`))});return{extractCookies:H(`CdpClient.extractCookies`)(function*({key:i,profilePath:a,executablePath:s}){let c=yield*ip(()=>Zw());yield*sm({profilePath:a,executablePath:s});let l=yield*e.makeTempDirectoryScoped({prefix:`cookies-cdp-`}),u=n.basename(a),d=n.join(l,u);yield*e.copy(a,d);let f=n.join(n.dirname(a),`Local State`);(yield*e.exists(f))&&(yield*e.copyFile(f,n.join(l,`Local State`))),yield*e.writeFile(n.join(l,`First Run`),new Uint8Array),yield*Pw(s,[`--remote-debugging-port=${c}`,...i===`dia`?[]:[`--user-data-dir=${l}`],`--profile-directory=${u}`,...CE],{stdin:`ignore`}).pipe(t.spawn,um);let m=yield*r.get(`http://localhost:${c}/json`).pipe(z($T(jx(Dx({type:G,webSocketDebuggerUrl:hx(G)})))),B(ti(e=>e.type===`page`)),B(Cr(e=>gr(e.webSocketDebuggerUrl))),z(e=>e.asEffect()),Cp(`NoSuchElementError`,()=>new rT({reason:new eT}).asEffect()),Mp({times:15,schedule:zf(`100 millis`)})),h=yield*o().pipe(Up(p.layerWebSocket(m),{local:!0}));return yield*Om(`CDP cookies extracted`,{profile:a,count:h.length}),h},Jp)}})}){static layer=Od(this)(this.make).pipe(P(s.layer),P(o.layerUndici));static layerTest=Rd(this)({extractCookies:()=>F([])})};const EE=`Bun`in globalThis;var DE=class extends A()(`@cookies/SqliteEngine`){static layerBun=Ed(this,{open:e=>Xp(ap({try:async()=>{let{Database:t}=await import(`bun:sqlite`);return new t(e,{readonly:!0})},catch:e=>new oT({browser:`unknown`,cause:String(e)})}),e=>I(()=>e.close()))});static layerNodeJs=Ed(this,{open:e=>Xp(ap({try:async()=>{let{DatabaseSync:t}=await import(`node:sqlite`);return new t(e,{readOnly:!0,readBigInts:!0})},catch:e=>new oT({browser:`unknown`,cause:String(e)})}),e=>I(()=>e.close()))});static layerLibSql=Ed(this,{open:t=>Xp(ap({try:async()=>{let{default:n}=await import(`./libsql-Bb5SdTGo.js`).then(t=>e(t.default,1));return new n(t,{readonly:!0})},catch:e=>new oT({browser:`unknown`,cause:String(e)})}),e=>I(()=>e.close()))})},OE=class extends A()(`@cookies/SqliteClient`,{make:L(function*(){let e=yield*DE,t=yield*sC;return{query:H(`SqliteClient.query`)(function*(t,n,r){yield*sm({browser:r,databasePath:t});let i=yield*e.open(t).pipe(Op(e=>new oT({browser:r,cause:e.cause})));return yield*mp({try:()=>i.prepare(n).all(),catch:e=>new oT({browser:r,cause:String(e)})})},Jp),copyToTemp:H(`SqliteClient.copyToTemp`)(function*(e,r,i,a){let o=yield*t.makeTempDirectory({prefix:r});yield*Zp(()=>t.remove(o,{recursive:!0}).pipe(Sp(()=>lp)));let s=n.join(o,i);return yield*t.copyFile(e,s).pipe(Cp(`PlatformError`,t=>new iT({browser:a,databasePath:e,cause:String(t)}).asEffect())),yield*t.copyFile(`${e}-wal`,`${s}-wal`).pipe(Sp(()=>lp)),yield*t.copyFile(`${e}-shm`,`${s}-shm`).pipe(Sp(()=>lp)),{tempDir:o,tempDatabasePath:s}})}})}){static layerBun=Od(this,this.make).pipe(P(DE.layerBun),P(s.layer));static layerNodeJs=Od(this,this.make).pipe(P(DE.layerNodeJs),P(s.layer));static layer=EE?this.layerBun:this.layerNodeJs};const kE=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>({kind:`chromium`,key:e,displayName:t,bundleId:n,desktopFiles:r,registryKey:i,executable:{darwin:a,linux:o,win32:s},userData:c,cookieRelativePath:l,keychainService:u,linuxSecretLabel:d,localStatePath:f}),AE=[kE(`chrome`,`Google Chrome`,`com.google.chrome`,[`google-chrome`],`chrome.exe`,`/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`,[`/usr/bin/google-chrome`,`/usr/local/bin/google-chrome`,`/snap/bin/google-chrome`],[`Google\\Chrome\\Application\\chrome.exe`],{darwin:`Google/Chrome`,linux:`google-chrome`,win32:`Google\\Chrome\\User Data`},{darwin:`Library/Application Support/Google/Chrome/Default`,linux:`.config/google-chrome/Default`,win32:`AppData/Local/Google/Chrome/User Data/Default`},`Chrome Safe Storage`,`chrome`,`AppData/Local/Google/Chrome/User Data/Local State`),kE(`brave`,`Brave Browser`,`com.brave.browser`,[`brave-browser`],`brave.exe`,`/Applications/Brave Browser.app/Contents/MacOS/Brave Browser`,[`/usr/bin/brave-browser`,`/usr/local/bin/brave-browser`,`/snap/bin/brave-browser`],[`BraveSoftware\\Brave-Browser\\Application\\brave.exe`],{darwin:`BraveSoftware/Brave-Browser`,linux:`BraveSoftware/Brave-Browser`,win32:`BraveSoftware\\Brave-Browser\\User Data`},{darwin:`Library/Application Support/BraveSoftware/Brave-Browser/Default`,linux:`.config/BraveSoftware/Brave-Browser/Default`,win32:`AppData/Local/BraveSoftware/Brave-Browser/User Data/Default`},`Brave Safe Storage`,`brave`,`AppData/Local/BraveSoftware/Brave-Browser/User Data/Local State`),kE(`edge`,`Microsoft Edge`,`com.microsoft.edgemac`,[`microsoft-edge`],`msedge.exe`,`/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge`,[`/usr/bin/microsoft-edge`,`/usr/local/bin/microsoft-edge`,`/snap/bin/microsoft-edge`],[`Microsoft\\Edge\\Application\\msedge.exe`],{darwin:`Microsoft Edge`,linux:`microsoft-edge`,win32:`Microsoft\\Edge\\User Data`},{darwin:`Library/Application Support/Microsoft Edge/Default`,linux:`.config/microsoft-edge/Default`,win32:`AppData/Local/Microsoft/Edge/User Data/Default`},`Microsoft Edge Safe Storage`,`microsoft-edge`,`AppData/Local/Microsoft/Edge/User Data/Local State`),kE(`arc`,`Arc`,`company.thebrowser.browser`,[`arc`],`arc.exe`,`/Applications/Arc.app/Contents/MacOS/Arc`,[`/usr/bin/arc`,`/usr/local/bin/arc`,`/snap/bin/arc`],[`Arc\\Application\\arc.exe`],{darwin:`Arc/User Data`,linux:`arc`,win32:`Arc\\User Data`},{darwin:`Library/Application Support/Arc/User Data/Default`,linux:`.config/arc/Default`,win32:`AppData/Local/Arc/User Data/Default`},`Arc Safe Storage`,`arc`,`AppData/Local/Arc/User Data/Local State`),kE(`dia`,`Dia`,`company.thebrowser.dia`,[`dia`],`dia.exe`,`/Applications/Dia.app/Contents/MacOS/Dia`,[`/usr/bin/dia`,`/usr/local/bin/dia`,`/snap/bin/dia`],[`Dia\\Application\\dia.exe`],{darwin:`Dia/User Data`,linux:`dia`,win32:`Dia\\User Data`},{darwin:`Library/Application Support/Dia/User Data/Default`,linux:`.config/dia/Default`,win32:`AppData/Local/Dia/User Data/Default`},`Dia Safe Storage`,`dia`,`AppData/Local/Dia/User Data/Local State`),kE(`helium`,`Helium`,`net.imput.helium`,[`helium`],`helium.exe`,`/Applications/Helium.app/Contents/MacOS/Helium`,[`/usr/bin/helium`,`/usr/local/bin/helium`,`/snap/bin/helium`],[`Helium\\Application\\helium.exe`],{darwin:`net.imput.helium`,linux:`helium`,win32:`Helium\\User Data`},{darwin:`Library/Application Support/net.imput.helium/Default`,linux:`.config/helium/Default`,win32:`AppData/Local/Helium/User Data/Default`},`Helium Storage Key`,`helium`,`AppData/Local/Helium/User Data/Local State`),kE(`chromium`,`Chromium`,`org.chromium.chromium`,[`chromium`,`chromium-browser`],`chromium.exe`,`/Applications/Chromium.app/Contents/MacOS/Chromium`,[`/usr/bin/chromium`,`/usr/local/bin/chromium`,`/snap/bin/chromium`],[`Chromium\\Application\\chrome.exe`],{darwin:`Chromium`,linux:`chromium`,win32:`Chromium\\User Data`},{darwin:`Library/Application Support/Chromium/Default`,linux:`.config/chromium/Default`,win32:`AppData/Local/Chromium/User Data/Default`},`Chromium Safe Storage`,`chromium`,`AppData/Local/Chromium/User Data/Local State`),kE(`vivaldi`,`Vivaldi`,`com.vivaldi.vivaldi`,[`vivaldi`,`vivaldi-stable`],`vivaldi.exe`,`/Applications/Vivaldi.app/Contents/MacOS/Vivaldi`,[`/usr/bin/vivaldi`,`/usr/local/bin/vivaldi`,`/snap/bin/vivaldi`],[`Vivaldi\\Application\\vivaldi.exe`],{darwin:`Vivaldi`,linux:`vivaldi`,win32:`Vivaldi\\User Data`},{darwin:`Library/Application Support/Vivaldi/Default`,linux:`.config/vivaldi/Default`,win32:`AppData/Local/Vivaldi/User Data/Default`},`Vivaldi Safe Storage`,`vivaldi`,`AppData/Local/Vivaldi/User Data/Local State`),kE(`opera`,`Opera`,`com.operasoftware.opera`,[`opera`,`opera-stable`],`opera.exe`,`/Applications/Opera.app/Contents/MacOS/Opera`,[`/usr/bin/opera`,`/usr/local/bin/opera`,`/snap/bin/opera`],[`Opera\\launcher.exe`],{darwin:`com.operasoftware.Opera`,linux:`opera`,win32:`Opera Software\\Opera Stable`},{darwin:`Library/Application Support/com.operasoftware.Opera`,linux:`.config/opera`,win32:`AppData/Roaming/Opera Software/Opera Stable`},`Opera Safe Storage`,`opera`,`AppData/Roaming/Opera Software/Opera Stable/Local State`),kE(`ghost`,`Ghost Browser`,`com.nickvision.ghost`,[`ghost-browser`],`ghost.exe`,`/Applications/Ghost Browser.app/Contents/MacOS/Ghost Browser`,[`/usr/bin/ghost-browser`,`/usr/local/bin/ghost-browser`,`/snap/bin/ghost-browser`],[`Ghost Browser\\Application\\ghost.exe`],{darwin:`Ghost Browser`,linux:`ghost-browser`,win32:`Ghost Browser\\User Data`},{darwin:`Library/Application Support/Ghost Browser/Default`,linux:`.config/ghost-browser/Default`,win32:`AppData/Local/Ghost Browser/User Data/Default`},`Ghost Browser Safe Storage`,`ghost-browser`,`AppData/Local/Ghost Browser/User Data/Local State`),kE(`sidekick`,`Sidekick`,`pushplaylabs.sidekick`,[`sidekick`],`sidekick.exe`,`/Applications/Sidekick.app/Contents/MacOS/Sidekick`,[`/usr/bin/sidekick`,`/usr/local/bin/sidekick`,`/snap/bin/sidekick`],[`Sidekick\\Application\\sidekick.exe`],{darwin:`Sidekick`,linux:`sidekick`,win32:`Sidekick\\User Data`},{darwin:`Library/Application Support/Sidekick/Default`,linux:`.config/sidekick/Default`,win32:`AppData/Local/Sidekick/User Data/Default`},`Sidekick Safe Storage`,`sidekick`,`AppData/Local/Sidekick/User Data/Local State`),kE(`yandex`,`Yandex`,`ru.yandex.desktop.yandex-browser`,[`yandex-browser`],`browser.exe`,`/Applications/Yandex.app/Contents/MacOS/Yandex`,[`/usr/bin/yandex-browser`,`/usr/local/bin/yandex-browser`,`/snap/bin/yandex-browser`],[`Yandex\\YandexBrowser\\Application\\browser.exe`],{darwin:`YandexBrowser`,linux:`yandex-browser`,win32:`Yandex\\YandexBrowser\\User Data`},{darwin:`Library/Application Support/YandexBrowser/Default`,linux:`.config/yandex-browser/Default`,win32:`AppData/Local/Yandex/YandexBrowser/User Data/Default`},`Yandex Safe Storage`,`yandex-browser`,`AppData/Local/Yandex/YandexBrowser/User Data/Local State`),kE(`iridium`,`Iridium`,`de.nickvision.iridium`,[`iridium`],`iridium.exe`,`/Applications/Iridium.app/Contents/MacOS/Iridium`,[`/usr/bin/iridium`,`/usr/local/bin/iridium`,`/snap/bin/iridium`],[`Iridium\\Application\\iridium.exe`],{darwin:`Iridium`,linux:`iridium`,win32:`Iridium\\User Data`},{darwin:`Library/Application Support/Iridium/Default`,linux:`.config/iridium/Default`,win32:`AppData/Local/Iridium/User Data/Default`},`Iridium Safe Storage`,`iridium`,`AppData/Local/Iridium/User Data/Local State`),kE(`thorium`,`Thorium`,`nickvision.thorium`,[`thorium`],`thorium.exe`,`/Applications/Thorium.app/Contents/MacOS/Thorium`,[`/usr/bin/thorium`,`/usr/local/bin/thorium`,`/snap/bin/thorium`],[`Thorium\\Application\\thorium.exe`],{darwin:`Thorium`,linux:`thorium`,win32:`Thorium\\User Data`},{darwin:`Library/Application Support/Thorium/Default`,linux:`.config/thorium/Default`,win32:`AppData/Local/Thorium/User Data/Default`},`Thorium Safe Storage`,`thorium`,`AppData/Local/Thorium/User Data/Local State`),kE(`sigmaos`,`SigmaOS`,`com.nickvision.sigmaos`,[`sigmaos`],`sigmaos.exe`,`/Applications/SigmaOS.app/Contents/MacOS/SigmaOS`,[`/usr/bin/sigmaos`,`/usr/local/bin/sigmaos`,`/snap/bin/sigmaos`],[`SigmaOS\\Application\\sigmaos.exe`],{darwin:`SigmaOS`,linux:`sigmaos`,win32:`SigmaOS\\User Data`},{darwin:`Library/Application Support/SigmaOS/Default`,linux:`.config/sigmaos/Default`,win32:`AppData/Local/SigmaOS/User Data/Default`},`SigmaOS Safe Storage`,`sigmaos`,`AppData/Local/SigmaOS/User Data/Local State`),kE(`wavebox`,`Wavebox`,`io.wavebox.wavebox`,[`wavebox`],`wavebox.exe`,`/Applications/Wavebox.app/Contents/MacOS/Wavebox`,[`/usr/bin/wavebox`,`/usr/local/bin/wavebox`,`/snap/bin/wavebox`],[`Wavebox\\Application\\wavebox.exe`],{darwin:`Wavebox`,linux:`wavebox`,win32:`Wavebox\\User Data`},{darwin:`Library/Application Support/Wavebox/Default`,linux:`.config/wavebox/Default`,win32:`AppData/Local/Wavebox/User Data/Default`},`Wavebox Safe Storage`,`wavebox`,`AppData/Local/Wavebox/User Data/Local State`),kE(`comet`,`Comet`,`com.nickvision.comet`,[`comet`],`comet.exe`,`/Applications/Comet.app/Contents/MacOS/Comet`,[`/usr/bin/comet`,`/usr/local/bin/comet`,`/snap/bin/comet`],[`Comet\\Application\\comet.exe`],{darwin:`Comet`,linux:`comet`,win32:`Comet\\User Data`},{darwin:`Library/Application Support/Comet/Default`,linux:`.config/comet/Default`,win32:`AppData/Local/Comet/User Data/Default`},`Comet Safe Storage`,`comet`,`AppData/Local/Comet/User Data/Local State`),kE(`blisk`,`Blisk`,`com.nickvision.blisk`,[`blisk`],`blisk.exe`,`/Applications/Blisk.app/Contents/MacOS/Blisk`,[`/usr/bin/blisk`,`/usr/local/bin/blisk`,`/snap/bin/blisk`],[`Blisk\\Application\\blisk.exe`],{darwin:`Blisk`,linux:`blisk`,win32:`Blisk\\User Data`},{darwin:`Library/Application Support/Blisk/Default`,linux:`.config/blisk/Default`,win32:`AppData/Local/Blisk/User Data/Default`},`Blisk Safe Storage`,`blisk`,`AppData/Local/Blisk/User Data/Local State`)],jE={kind:`firefox`,key:`firefox`,displayName:`Firefox`,bundleId:`org.mozilla.firefox`,desktopFiles:[`firefox`],executable:{darwin:`/Applications/Firefox.app/Contents/MacOS/firefox`,linux:[`/usr/bin/firefox`,`/usr/local/bin/firefox`,`/snap/bin/firefox`],win32:[`Mozilla Firefox\\firefox.exe`]},dataDir:{darwin:`Library/Application Support/Firefox`,linux:`.mozilla/firefox`,win32:`AppData/Roaming/Mozilla/Firefox`}},ME={kind:`safari`,key:`safari`,displayName:`Safari`,bundleId:`com.apple.safari`,executable:`/Applications/Safari.app/Contents/MacOS/Safari`,cookieRelativePaths:[`Library/Cookies`,`Library/Containers/com.apple.Safari/Data/Library/Cookies`]},NE=[...AE,jE,ME],PE=new Map,FE=new Map,IE=new Map,LE=new Map;for(let e of NE)if(LE.set(e.key,e),PE.set(e.bundleId.toLowerCase(),e),IE.set(e.displayName,e),`desktopFiles`in e)for(let t of e.desktopFiles)FE.set(t,e);PE.set(`com.microsoft.edge`,LE.get(`edge`));const RE=e=>PE.get(e.toLowerCase()),zE=e=>FE.get(e.replace(/\.desktop$/,``)),BE=e=>AE.find(t=>t.key===e),VE=/^v\d\d$/,HE=(e,t)=>l.pbkdf2Sync(e,`saltysalt`,t,16,`sha1`),UE=(e,t,n)=>{let r=Buffer.from(e);if(r.length<3)return;let i=r.subarray(0,3).toString(`utf8`);if(!VE.test(i))return JE(r,!1);let a=r.subarray(3);if(!a.length)return``;for(let e of t){let t=GE(a,e);if(!t)continue;let r=JE(t,n);if(r!==void 0)return r}},WE=(e,t,n)=>{let r=Buffer.from(e);if(r.length<3)return;let i=r.subarray(0,3).toString(`utf8`);if(!VE.test(i))return;let a=r.subarray(3);if(a.length<28)return;let o=a.subarray(0,12),s=a.subarray(a.length-16),c=a.subarray(12,a.length-16);try{let e=l.createDecipheriv(`aes-256-gcm`,t,o);return e.setAuthTag(s),JE(Buffer.concat([e.update(c),e.final()]),n)}catch{return}},GE=(e,t)=>{try{let n=Buffer.alloc(16,32),r=l.createDecipheriv(`aes-128-cbc`,t,n);return r.setAutoPadding(!1),KE(Buffer.concat([r.update(e),r.final()]))}catch{return}},KE=e=>{if(!e.length)return e;let t=e[e.length-1];return!t||t>16?e:e.subarray(0,e.length-t)},qE=new TextDecoder(`utf-8`,{fatal:!0}),JE=(e,t)=>{let n=t&&e.length>=32?e.subarray(32):e;try{let e=qE.decode(n),t=0;for(;t<e.length&&e.charCodeAt(t)<32;)t+=1;return e.slice(t)}catch{return}},YE=0x9184e72a000,XE=1e6,ZE=11644473600,QE=1e10,$E=1e3,eD=e=>e>0&&e<=253402300799?Math.round(e):void 0,tD=e=>{if(e!==void 0){if(typeof e==`string`){let t=Number(e);return Number.isFinite(t)?tD(t):void 0}if(typeof e==`bigint`)return e<=0n?void 0:e>BigInt(YE)?eD(Number(e/BigInt(XE)-BigInt(ZE))):e>BigInt(QE)?eD(Number(e/BigInt($E))):eD(Number(e));if(!(!e||Number.isNaN(e))&&!(e<=0))return eD(e>YE?e/XE-ZE:e>QE?e/$E:e)}},nD=e=>{let t=typeof e==`bigint`?Number(e):typeof e==`number`?e:void 0;if(t!==void 0){if(t===2)return`Strict`;if(t===1)return`Lax`;if(t===0)return`None`}},rD=Dx({os_crypt:Dx({encrypted_key:G})});var iD=class extends A()(`@cookies/ChromiumKeyProvider`){static layerDarwin=Od(this)(L(function*(){let e=yield*Aw;return{buildDecryptor:H(`ChromiumKeyProvider.buildDecryptor`)(function*(t,n){let r=BE(t),i=yield*e.string(Pw(`security`,[`find-generic-password`,`-w`,`-s`,r.keychainService])).pipe(B(e=>e.trim()),Cp(`PlatformError`,()=>new aT({browser:t,platform:`darwin`}).asEffect()));if(!i)return yield*new aT({browser:t,platform:`darwin`}).asEffect();let a=HE(i,1003);return(e=>UE(e,[a],n))})}})).pipe(P(s.layer));static layerLinux=Od(this)(L(function*(){let e=yield*Aw;return{buildDecryptor:H(`ChromiumKeyProvider.buildDecryptor`)(function*(t,n){let r=[[`secret-tool`,`lookup`,`application`,BE(t).linuxSecretLabel],[`secret-tool`,`lookup`,`xdg:schema`,`chrome_libsecret_os_crypt_password_v2`],[`secret-tool`,`lookup`,`xdg:schema`,`chrome_libsecret_os_crypt_password_v1`]],i=``;for(let t of r){let n=t[0],r=t.slice(1),a=yield*e.string(Pw(n,r)).pipe(B(e=>e.trim()),Cp(`PlatformError`,()=>F(``)));if(a){i=a;break}}i||=`peanuts`;let a=new Set([i,`peanuts`,``]),o=Array.from(a).map(e=>HE(e,1));return(e=>UE(e,o,n))})}})).pipe(P(s.layer));static layerWin32=Od(this)(L(function*(){let e=yield*Aw,t=yield*sC;return{buildDecryptor:H(`ChromiumKeyProvider.buildDecryptor`)(function*(r,i){let a=BE(r),o=n.join(u.homedir(),a.localStatePath),s=yield*t.readFileString(o).pipe(Cp(`PlatformError`,()=>new aT({browser:r,platform:`win32`}).asEffect())),c=(yield*mp({try:()=>ux(rD)(JSON.parse(s)),catch:()=>new aT({browser:r,platform:`win32`})})).os_crypt.encrypted_key,l=`Add-Type -AssemblyName System.Security; $encrypted = [Convert]::FromBase64String('${Buffer.from(c,`base64`).subarray(5).toString(`base64`)}'); $decrypted = [System.Security.Cryptography.ProtectedData]::Unprotect($encrypted, $null, 'CurrentUser'); [Convert]::ToBase64String($decrypted)`,d=yield*e.string(Pw(`powershell`,[`-Command`,l])).pipe(B(e=>e.trim()),Cp(`PlatformError`,()=>new aT({browser:r,platform:`win32`}).asEffect()));if(!d)return yield*new aT({browser:r,platform:`win32`}).asEffect();let f=Buffer.from(d,`base64`);return(e=>WE(e,f,i))})}})).pipe(P(s.layer))},aD=class extends A()(`@cookies/ChromiumSqliteFallback`,{make:L(function*(){let e=yield*OE,t=yield*sC,r=yield*iD,i=H(`ChromiumSqliteFallback.resolveCookieDbPath`)(function*(e,r){let i=n.join(e,`Network`,`Cookies`);if(yield*t.exists(i))return i;let a=n.join(e,`Cookies`);return(yield*t.exists(a))?a:yield*new Qw({browser:r}).asEffect()}),a=H(`ChromiumSqliteFallback.readMetaVersion`)(function*(t){let n=(yield*e.query(t,`SELECT value FROM meta WHERE key = 'version'`,`chromium`).pipe(Cp(`CookieReadError`,()=>F([]))))[0]?.value;if(typeof n==`number`)return Math.floor(n);if(typeof n==`bigint`)return Math.floor(Number(n));if(typeof n==`string`){let e=Number.parseInt(n,10);return Number.isFinite(e)?e:0}return 0}),o=H(`ChromiumSqliteFallback.extract`)(function*(t){yield*sm({browser:t.key});let n=yield*i(t.profilePath,t.key),{tempDatabasePath:o}=yield*e.copyToTemp(n,`cookies-sqlite-${t.key}-`,`Cookies`,t.key),s=(yield*a(o))>=24,c=yield*r.buildDecryptor(t.key,s),l=yield*e.query(o,`SELECT name, value, host_key, path, expires_utc, samesite, encrypted_value, is_secure, is_httponly FROM cookies ORDER BY expires_utc DESC`,t.key),u=[];for(let e of l){let t=typeof e.name==`string`?e.name:void 0;if(!t)continue;let n=typeof e.host_key==`string`?e.host_key:void 0;if(!n)continue;let r=typeof e.value==`string`?e.value:void 0;if(!r||r.length===0){let t=e.encrypted_value instanceof Uint8Array?e.encrypted_value:void 0;if(!t)continue;let n=c(t);if(n===void 0)continue;r=n}let i=e.expires_utc,a=tD(typeof i==`number`||typeof i==`bigint`||typeof i==`string`?i:void 0);u.push(dT.make({name:t,value:r,domain:n,path:typeof e.path==`string`?e.path:`/`,...a===void 0?{}:{expires:a},secure:Number(e.is_secure)!==0,httpOnly:Number(e.is_httponly)!==0,sameSite:nD(e.samesite)}))}return yield*Om(`Chromium SQLite fallback cookies extracted`,{browser:t.key,count:u.length}),u},Jp);return{extract:e=>o(e).pipe(wp({CookieDatabaseNotFoundError:e=>new rT({reason:new tT({cause:e})}).asEffect(),CookieDatabaseCopyError:e=>new rT({reason:new tT({cause:e})}).asEffect(),CookieReadError:e=>new rT({reason:new tT({cause:e})}).asEffect(),CookieDecryptionKeyError:e=>new rT({reason:new tT({cause:e})}).asEffect(),PlatformError:e=>new rT({reason:new tT({cause:e})}).asEffect()}))}})}){static layer=Od(this)(this.make).pipe(P(OE.layer),P(Md(I(()=>{let e=u.platform();return e===`darwin`?iD.layerDarwin:e===`win32`?iD.layerWin32:iD.layerLinux}))),P(s.layer))};const oD=e=>{if(e.length<8||e.subarray(0,4).toString(`utf8`)!==`cook`)return[];let t=e.readUInt32BE(4),n=8,r=[];for(let i=0;i<t;i+=1)r.push(e.readUInt32BE(n)),n+=4;let i=[];for(let t of r){let r=e.subarray(n,n+t);n+=t,i.push(...sD(r))}return i},sD=e=>{if(e.length<16||e.readUInt32BE(0)!==256)return[];let t=e.readUInt32LE(4),n=[],r=8;for(let i=0;i<t;i+=1)n.push(e.readUInt32LE(r)),r+=4;let i=[];for(let t of n){let n=cD(e.subarray(t));n&&i.push(n)}return i},cD=e=>{if(e.length<48)return;let t=e.readUInt32LE(0);if(t<48||t>e.length)return;let n=e.readUInt32LE(8),r=(n&1)!=0,i=(n&4)!=0,a=e.readUInt32LE(16),o=e.readUInt32LE(20),s=e.readUInt32LE(24),c=e.readUInt32LE(28),l=lD(e,40),u=uD(e,a,t),d=uD(e,o,t),f=uD(e,s,t)??`/`,p=uD(e,c,t)??``;if(!d)return;let m=u?dD(u):void 0,h=l&&l>0?Math.round(l+978307200):void 0;return dT.make({name:d,value:p,domain:m??``,path:f,expires:h,secure:r,httpOnly:i})},lD=(e,t)=>t+8>e.length?0:e.subarray(t,t+8).readDoubleLE(0),uD=(e,t,n)=>{if(t<=0||t>=n)return;let r=t;for(;r<n&&e[r]!==0;)r+=1;if(!(r>=n))return e.toString(`utf8`,t,r)},dD=e=>{try{let t=e.includes(`://`)?e:`https://${e}`;return new URL(t).hostname}catch{let t=e.trim();return t===``?void 0:t}},fD=1e3,pD=Px([Cx,Tx]).pipe(Vx(wx,{decode:U(e=>Number(e)!==0),encode:U(e=>e?1:0)})),mD=Dx({name:G,value:G,host:G,path:G,expiry:Px([Cx,Tx,G]).pipe(Vx(gx(Cx),{decode:U(e=>{let t=Number(e);if(!(Number.isNaN(t)||t<=0))return Math.floor(t/fD)}),encode:U(e=>(e??0)*fD)})),isSecure:pD,isHttpOnly:pD,sameSite:Px([Cx,Tx,G]).pipe(Vx(gx(cT),{decode:U(e=>{let t=Number(e);if(t===2)return`Strict`;if(t===1)return`Lax`;if(t===0)return`None`}),encode:U(e=>e===`Strict`?2:e===`Lax`?1:0)}))}),hD=e=>dT.make({name:e.name,value:e.value,domain:e.host,path:e.path||`/`,expires:e.expiry,secure:e.isSecure,httpOnly:e.isHttpOnly,sameSite:e.sameSite});var gD=class extends A()(`@cookies/Cookies`,{make:L(function*(){let e=yield*TE,t=yield*OE,r=yield*aD,i=yield*sC,a=t=>e.extractCookies({key:t.key,profilePath:t.profilePath,executablePath:t.executablePath}).pipe(wp({TimeoutError:e=>new rT({reason:new tT({cause:e})}).asEffect(),SchemaError:e=>new rT({reason:new tT({cause:e})}).asEffect(),SocketError:e=>new rT({reason:new tT({cause:e})}).asEffect(),HttpClientError:e=>new rT({reason:new tT({cause:e})}).asEffect(),PlatformError:e=>new rT({reason:new tT({cause:e})}).asEffect()}),Cp(`ExtractionError`,e=>L(function*(){return yield*Em(`CDP extraction failed, trying SQLite fallback`,{browser:t.key,error:e.message}),yield*r.extract(t)}).pipe(Cp(`ExtractionError`,()=>e.asEffect())))),o=e=>L(function*(){let r=n.join(e.profilePath,`cookies.sqlite`),{tempDatabasePath:i}=yield*t.copyToTemp(r,`cookies-firefox-`,`cookies.sqlite`,`firefox`);return yield*np(yield*t.query(i,`SELECT name, value, host, path, expiry, isSecure, isHttpOnly, sameSite FROM moz_cookies ORDER BY expiry DESC`,`firefox`),e=>sx(mD)(e).pipe(B(hD)))}).pipe(Jp,wp({CookieReadError:e=>new rT({reason:new tT({cause:e})}).asEffect(),CookieDatabaseCopyError:e=>new rT({reason:new tT({cause:e})}).asEffect(),SchemaError:e=>new rT({reason:new tT({cause:e})}).asEffect()})),s=e=>L(function*(){if(fr(e.cookieFilePath))return yield*new rT({reason:new nT}).asEffect();let t=yield*i.readFile(e.cookieFilePath.value);return oD(Buffer.from(t)).filter(e=>!!e.name&&!!e.domain)}).pipe(wp({PlatformError:e=>new rT({reason:new tT({cause:e})}).asEffect()}));return{extract:e=>yw(e,{ChromiumBrowser:a,FirefoxBrowser:o,SafariBrowser:s})}})}){static layer=Od(this,this.make).pipe(P(TE.layer),P(OE.layer),P(aD.layer),P(s.layer));static layerTest=Od(this,this.make).pipe(P(TE.layerTest),P(OE.layer),P(aD.layer),P(s.layer))};const _D=m(c);async function vD(){if(h.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await _D(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}const yD=m(c);async function bD(e,{humanReadableOutput:t=!0,signal:n}={}){if(h.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await yD(`osascript`,[`-e`,e,r],i);return a.trim()}async function xD(e){return bD(`tell application "Finder" to set app_path to application file id "${e}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const SD=m(c),CD={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}};new Map(Object.entries(CD));var wD=class extends Error{};async function TD(e=SD){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new wD(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=r.lastIndexOf(`.`),a=r.lastIndexOf(`-`),o=i===-1?void 0:r.slice(0,i),s=a===-1?void 0:r.slice(0,a);return CD[r]??CD[o]??CD[s]??{name:r,id:r}}const ED=m(c),DD=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function OD(){if(h.platform===`darwin`){let e=await vD();return{name:await xD(e),id:e}}if(h.platform===`linux`){let{stdout:e}=await ED(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:DD(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(h.platform===`win32`)return TD();throw Error(`Only macOS, Linux, and Windows are supported`)}var kD=class extends A()(`@cookies/Browsers`,{make:L(function*(){let e=new Set,t=t=>I(()=>{e.add(t)}),n=np(e,x,{concurrency:`unbounded`}).pipe(B(ci),cm(`Browsers.list`));return{register:t,list:n,defaultBrowser:H(`Browsers.defaultBrowser`)(function*(){let e=(yield*ap({try:()=>OD(),catch:e=>new sT({cause:String(e)})})).id.toLowerCase(),t=e.replace(/\.desktop$/,``),r=RE(e)??zE(t);return r?gr((yield*n).find(e=>e._tag===`ChromiumBrowser`?e.key===r.key:e._tag===`FirefoxBrowser`?r.key===`firefox`:e._tag===`SafariBrowser`?r.key===`safari`:!1)):D()})}})}){static layer=Od(this,this.make)};const AD=Dx({profile:gx(Dx({last_used:gx(G)}))}),jD=Dx({intl:gx(Dx({selected_languages:gx(G),accept_languages:gx(G)}))});var MD=class extends A()(`@cookies/ChromiumPlatform`){static layerDarwin=Ed(this,{executableCandidates:e=>[e.executable.darwin],userDataDir:e=>n.join(u.homedir(),`Library`,`Application Support`,e.userData.darwin)});static layerLinux=Ed(this,{executableCandidates:e=>e.executable.linux,userDataDir:e=>n.join(process.env.XDG_CONFIG_HOME??n.join(u.homedir(),`.config`),e.userData.linux)});static layerWin32=Od(this)(L(function*(){let e=yield*Aw,t=new Map;for(let n of AE){let r=`HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\${n.registryKey}`,i=yield*e.string(Pw(`reg`,[`query`,r,`/ve`])).pipe(B(e=>e.trim()),Sp(()=>F(``)));if(i){let e=i.match(/REG_SZ\s+(.+)/)?.[1]?.trim();e&&t.set(n.key,e)}}let r=process.env.ProgramFiles??`C:\\Program Files`,i=process.env[`ProgramFiles(x86)`]??`C:\\Program Files (x86)`,a=process.env.LOCALAPPDATA??n.join(u.homedir(),`AppData`,`Local`);return{executableCandidates:e=>{let o=[],s=t.get(e.key);s&&o.push(s);for(let t of e.executable.win32)o.push(n.join(r,t),n.join(i,t),n.join(a,t));return o},userDataDir:e=>n.join(a,e.userData.win32)}})).pipe(P(s.layer))},ND=class extends A()(`@cookies/ChromiumSource`,{make:L(function*(){let e=yield*kD,t=yield*MD,r=yield*sC,i=e=>r.readFileString(n.join(e,`Local State`)).pipe(z(e=>cx(nS(AD))(e)),B(e=>gr(e.profile?.last_used)),Tp(`PlatformError`,`NotFound`,()=>F(D()))),a=e=>r.readFileString(n.join(e,`Preferences`)).pipe(z(e=>cx(nS(jD))(e)),B(e=>{let t=e.intl?.selected_languages??e.intl?.accept_languages;if(t)return t.split(`,`).map(e=>e.trim()).find(e=>e.length>0)}),Sp(()=>F(void 0))),o=(e,t,o)=>L(function*(){if(!(yield*r.exists(o)))return[];let s=yield*i(o),c=yield*r.readDirectory(o).pipe(Tp(`PlatformError`,`NotFound`,()=>F([]))),l=e=>r.exists(n.join(e,`Preferences`)).pipe(Tp(`PlatformError`,`BadResource`,()=>F(!1)));return yield*np(c,r=>L(function*(){let i=n.join(o,r);if(!(yield*l(i)))return;let s=yield*a(i);return new fT({key:e,profileName:r,profilePath:i,executablePath:t,...s?{locale:s}:{}})}),{concurrency:10}).pipe(B(li(Se)),B(ni(fT.orderBy(yr(s)))))});yield*e.register(np(AE,e=>L(function*(){let n;for(let i of t.executableCandidates(e))if(yield*r.exists(i)){n=i;break}return n?yield*o(e.key,n,t.userDataDir(e)):[]}),{concurrency:`unbounded`}).pipe(B(ci),Sp(e=>new sT({cause:String(e)}).asEffect())))})}){static layer=jd(this.make).pipe(P(s.layer))},PD=t(((e,t)=>{let{hasOwnProperty:n}=Object.prototype,r=(e,t={})=>{typeof t==`string`&&(t={section:t}),t.align=t.align===!0,t.newline=t.newline===!0,t.sort=t.sort===!0,t.whitespace=t.whitespace===!0||t.align===!0,t.platform=t.platform||typeof process<`u`&&process.platform,t.bracketedArray=t.bracketedArray!==!1;let n=t.platform===`win32`?`\r
26
25
  `:`
27
- `,a=t.whitespace?` = `:`=`,o=[],c=t.sort?Object.keys(e).sort():Object.keys(e),l=0;t.align&&(l=s(c.filter(t=>e[t]===null||Array.isArray(e[t])||typeof e[t]!=`object`).map(t=>Array.isArray(e[t])?`${t}[]`:t).concat([``]).reduce((e,t)=>s(e).length>=s(t).length?e:t)).length);let u=``,d=t.bracketedArray?`[]`:``;for(let t of c){let r=e[t];if(r&&Array.isArray(r))for(let e of r)u+=s(`${t}${d}`).padEnd(l,` `)+a+s(e)+n;else r&&typeof r==`object`?o.push(t):u+=s(t).padEnd(l,` `)+a+s(r)+n}t.section&&u.length&&(u=`[`+s(t.section)+`]`+(t.newline?n+n:n)+u);for(let a of o){let o=i(a,`.`).join(`\\.`),s=(t.section?t.section+`.`:``)+o,c=r(e[a],{...t,section:s});u.length&&c.length&&(u+=n),u+=c}return u};function i(e,t){var n=0,r=0,i=0,a=[];do if(i=e.indexOf(t,n),i!==-1){if(n=i+t.length,i>0&&e[i-1]===`\\`)continue;a.push(e.slice(r,i)),r=i+t.length}while(i!==-1);return a.push(e.slice(r)),a}let a=(e,t={})=>{t.bracketedArray=t.bracketedArray!==!1;let r=Object.create(null),a=r,o=null,s=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,l=e.split(/[\r\n]+/g),u={};for(let e of l){if(!e||e.match(/^\s*[;#]/)||e.match(/^\s*$/))continue;let i=e.match(s);if(!i)continue;if(i[1]!==void 0){if(o=c(i[1]),o===`__proto__`){a=Object.create(null);continue}a=r[o]=r[o]||Object.create(null);continue}let l=c(i[2]),d;t.bracketedArray?d=l.length>2&&l.slice(-2)===`[]`:(u[l]=(u?.[l]||0)+1,d=u[l]>1);let f=d&&l.endsWith(`[]`)?l.slice(0,-2):l;if(f===`__proto__`)continue;let p=i[3]?c(i[4]):!0,m=p===`true`||p===`false`||p===`null`?JSON.parse(p):p;d&&(n.call(a,f)?Array.isArray(a[f])||(a[f]=[a[f]]):a[f]=[]),Array.isArray(a[f])?a[f].push(m):a[f]=m}let d=[];for(let e of Object.keys(r)){if(!n.call(r,e)||typeof r[e]!=`object`||Array.isArray(r[e]))continue;let t=i(e,`.`);a=r;let o=t.pop(),s=o.replace(/\\\./g,`.`);for(let e of t)e!==`__proto__`&&((!n.call(a,e)||typeof a[e]!=`object`)&&(a[e]=Object.create(null)),a=a[e]);a===r&&s===o||(a[s]=r[e],d.push(e))}for(let e of d)delete r[e];return r},o=e=>e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`),s=e=>typeof e!=`string`||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&o(e)||e!==e.trim()?JSON.stringify(e):e.split(`;`).join(`\\;`).split(`#`).join(`\\#`),c=e=>{if(e=(e||``).trim(),o(e)){e.charAt(0)===`'`&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let t=!1,n=``;for(let r=0,i=e.length;r<i;r++){let i=e.charAt(r);if(t)`\\;#`.indexOf(i)===-1?n+=`\\`+i:n+=i,t=!1;else if(`;#`.indexOf(i)!==-1)break;else i===`\\`?t=!0:n+=i}return t&&(n+=`\\`),n.trim()}return e};t.exports={parse:a,decode:a,stringify:r,encode:r,safe:s,unsafe:c}}))(),GD=class extends q(`CookieDatabaseNotFoundError`)({_tag:K(`CookieDatabaseNotFoundError`),browser:G}){message=`Cookie database not found for ${this.browser}`},KD=class extends q(`CpdInvalidResponsePayload`)({_tag:K(`CpdInvalidResponsePayload`),code:Ux,errorMessage:G}){message=`Network.getAllCookies responded with #${this.code}: ${this.errorMessage}`},qD=class extends q(`DebuggerUrlNotFoundError`)({_tag:K(`DebuggerUrlNotFoundError`)}){message=`Debugger URL not found`},JD=class extends q(`UnknownError`)({_tag:K(`UnknownError`),cause:Bx}){message=`An unexpected error occurred. ${Au(this.cause)?Bu(this.cause):String(this.cause)}`},YD=class extends q(`RequiresFullDiskAccess`)({_tag:K(`RequiresFullDiskAccess`)}){message=`Safari cookie extraction requires Full Disk Access`},XD=class extends q(`ExtractionError`)({_tag:K(`ExtractionError`),reason:eS([KD,qD,YD,JD])}){message=`Extracting cookies failed. Error: ${this.reason.message}`},ZD=class extends q(`CookieDatabaseCopyError`)({_tag:K(`CookieDatabaseCopyError`),browser:G,databasePath:G,cause:G}){message=`Failed to copy cookie database for ${this.browser}: ${this.cause}`},QD=class extends q(`CookieDecryptionKeyError`)({_tag:K(`CookieDecryptionKeyError`),browser:G,platform:G}){message=`Decryption key not found for ${this.browser} on ${this.platform}`},$D=class extends q(`CookieReadError`)({_tag:K(`CookieReadError`),browser:G,cause:G}){message=`Failed to read cookies for ${this.browser}: ${this.cause}`},eO=class extends q(`ListBrowsersError`)({_tag:K(`ListBrowsersError`),cause:G}){message=`Failed to list browsers: ${this.cause}`};const tO=tS([`Strict`,`Lax`,`None`]);tS([`chrome`,`edge`,`brave`,`arc`,`dia`,`helium`,`chromium`,`vivaldi`,`opera`,`ghost`,`sidekick`,`yandex`,`iridium`,`thorium`,`sigmaos`,`wavebox`,`comet`,`blisk`,`firefox`,`safari`]);const nO=tS([`chrome`,`edge`,`brave`,`arc`,`dia`,`helium`,`chromium`,`vivaldi`,`opera`,`ghost`,`sidekick`,`yandex`,`iridium`,`thorium`,`sigmaos`,`wavebox`,`comet`,`blisk`]),rO=G.pipe(sS(G,{decode:U(e=>e.startsWith(`.`)?e.slice(1):e),encode:U(e=>e)}));var iO=class extends AS(`@cookies/Cookie`)({name:G,value:G,domain:rO,path:G,expires:Ix(Ux.pipe(sS(Ux,{decode:U(e=>Math.floor(e)),encode:U(e=>e)}))),secure:Wx,httpOnly:Wx,sameSite:Ix(tO)}){static make=Ax(this);get playwrightFormat(){let e=this.name.startsWith(`__Host-`)||this.domain.startsWith(`.`)?this.domain:`.${this.domain}`;return{name:this.name,value:this.value,domain:e,path:this.path,expires:this.expires??-1,secure:this.secure,httpOnly:this.httpOnly,sameSite:this.sameSite}}},aO=class extends AS(`@cookies/ChromiumBrowser`)({_tag:K(`ChromiumBrowser`),key:nO,profileName:G,profilePath:G,executablePath:G,locale:Ix(G)}){static orderBy=e=>lr(ur(cr,t=>t.profileName===e),ur(or((e,t)=>e.localeCompare(t,void 0,{numeric:!0})),e=>e.profileName))},oO=class extends AS(`@cookies/FirefoxBrowser`)({_tag:K(`FirefoxBrowser`),profileName:G,profilePath:G}){},sO=class extends AS(`@cookies/SafariBrowser`)({_tag:K(`SafariBrowser`),cookieFilePath:gS(G)}){};eS([aO,oO,sO]);const cO=[`--headless=new`,`--disable-gpu`,`--no-first-run`,`--no-default-browser-check`,`--remote-debugging-address=127.0.0.1`],lO=qx({id:Ux,error:Fx(qx({code:Ux,message:G})),result:Fx(qx({cookies:Zx(iO)}))});var uO=class extends A()(`@cookies/CdpClient`,{make:L(function*(){let e=yield*cw,t=yield*tE,r=yield*uD,i=l.tmpdir(),a=(yield*e.readDirectory(i).pipe(Mp(`PlatformError`,()=>P([])))).filter(e=>e.startsWith(`cookies-cdp-`));a.length>0&&(yield*Vm(`Cleaning up stale CDP temp directories`,{count:a.length}),yield*fp(a,t=>e.remove(n.join(i,t),{recursive:!0}).pipe(Mp(`PlatformError`,()=>I)),{concurrency:`unbounded`}));let o=H(`CdpClient.getAllCookies`)(function*(){let e=yield*pD,t=yield*e.writer,n=yield*rd();return yield*e.runRaw(e=>L(function*(){let t=yield*Ox(SS(lO))(e.toString());if(t.error)return yield*sd(n,new XD({reason:new KD({code:t.error.code,errorMessage:t.error.message})}));t.result&&(yield*fd(n,t.result.cookies))})).pipe(Bp(e=>sd(n,new XD({reason:new JD({cause:e})}))),Cm),yield*t(JSON.stringify({id:1,method:`Network.getAllCookies`})),yield*id(n).pipe(Up(`10 seconds`))});return{extractCookies:H(`CdpClient.extractCookies`)(function*({key:i,profilePath:a,executablePath:s}){let c=yield*mp(()=>CE());yield*bm({profilePath:a,executablePath:s});let l=yield*e.makeTempDirectoryScoped({prefix:`cookies-cdp-`}),u=n.basename(a),d=n.join(l,u);yield*e.copy(a,d);let f=n.join(n.dirname(a),`Local State`);(yield*e.exists(f))&&(yield*e.copyFile(f,n.join(l,`Local State`))),yield*e.writeFile(n.join(l,`First Run`),new Uint8Array),yield*aE(s,[`--remote-debugging-port=${c}`,...i===`dia`?[]:[`--user-data-dir=${l}`],`--profile-directory=${u}`,...cO],{stdin:`ignore`}).pipe(t.spawn,Cm);let m=yield*r.get(`http://localhost:${c}/json`).pipe(z(cD(Zx(qx({type:G,webSocketDebuggerUrl:Fx(G)})))),B(ri(e=>e.type===`page`)),B(Tr(e=>_r(e.webSocketDebuggerUrl))),z(e=>e.asEffect()),Mp(`NoSuchElementError`,()=>new XD({reason:new qD}).asEffect()),Vp({times:15,schedule:Yf(`100 millis`)})),h=yield*o().pipe(em(p.layerWebSocket(m),{local:!0}));return yield*Vm(`CDP cookies extracted`,{profile:a,count:h.length}),h},om)}})}){static layer=Ld(this)(this.make).pipe(N(d.layer),N(u.layerUndici));static layerTest=qd(this)({extractCookies:()=>P([])})};const dO=`Bun`in globalThis;var fO=class extends A()(`@cookies/SqliteEngine`){static layerBun=Fd(this,{open:e=>cm(hp({try:async()=>{let{Database:t}=await import(`bun:sqlite`);return new t(e,{readonly:!0})},catch:e=>new $D({browser:`unknown`,cause:String(e)})}),e=>F(()=>e.close()))});static layerNodeJs=Fd(this,{open:e=>cm(hp({try:async()=>{let{DatabaseSync:t}=await import(`node:sqlite`);return new t(e,{readOnly:!0,readBigInts:!0})},catch:e=>new $D({browser:`unknown`,cause:String(e)})}),e=>F(()=>e.close()))});static layerLibSql=Fd(this,{open:t=>cm(hp({try:async()=>{let{default:n}=await import(`./libsql-Bb5SdTGo.js`).then(t=>e(t.default,1));return new n(t,{readonly:!0})},catch:e=>new $D({browser:`unknown`,cause:String(e)})}),e=>F(()=>e.close()))})},pO=class extends A()(`@cookies/SqliteClient`,{make:L(function*(){let e=yield*fO,t=yield*cw;return{query:H(`SqliteClient.query`)(function*(t,n,r){yield*bm({browser:r,databasePath:t});let i=yield*e.open(t).pipe(Lp(e=>new $D({browser:r,cause:e.cause})));return yield*Cp({try:()=>i.prepare(n).all(),catch:e=>new $D({browser:r,cause:String(e)})})},om),copyToTemp:H(`SqliteClient.copyToTemp`)(function*(e,r,i,a){let o=yield*t.makeTempDirectory({prefix:r});yield*lm(()=>t.remove(o,{recursive:!0}).pipe(jp(()=>I)));let s=n.join(o,i);return yield*t.copyFile(e,s).pipe(Mp(`PlatformError`,t=>new ZD({browser:a,databasePath:e,cause:String(t)}).asEffect())),yield*t.copyFile(`${e}-wal`,`${s}-wal`).pipe(jp(()=>I)),yield*t.copyFile(`${e}-shm`,`${s}-shm`).pipe(jp(()=>I)),{tempDir:o,tempDatabasePath:s}})}})}){static layerBun=Ld(this,this.make).pipe(N(fO.layerBun),N(d.layer));static layerNodeJs=Ld(this,this.make).pipe(N(fO.layerNodeJs),N(d.layer));static layer=dO?this.layerBun:this.layerNodeJs};const mO=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>({kind:`chromium`,key:e,displayName:t,bundleId:n,desktopFiles:r,registryKey:i,executable:{darwin:a,linux:o,win32:s},userData:c,cookieRelativePath:l,keychainService:u,linuxSecretLabel:d,localStatePath:f}),hO=[mO(`chrome`,`Google Chrome`,`com.google.chrome`,[`google-chrome`],`chrome.exe`,`/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`,[`/usr/bin/google-chrome`,`/usr/local/bin/google-chrome`,`/snap/bin/google-chrome`],[`Google\\Chrome\\Application\\chrome.exe`],{darwin:`Google/Chrome`,linux:`google-chrome`,win32:`Google\\Chrome\\User Data`},{darwin:`Library/Application Support/Google/Chrome/Default`,linux:`.config/google-chrome/Default`,win32:`AppData/Local/Google/Chrome/User Data/Default`},`Chrome Safe Storage`,`chrome`,`AppData/Local/Google/Chrome/User Data/Local State`),mO(`brave`,`Brave Browser`,`com.brave.browser`,[`brave-browser`],`brave.exe`,`/Applications/Brave Browser.app/Contents/MacOS/Brave Browser`,[`/usr/bin/brave-browser`,`/usr/local/bin/brave-browser`,`/snap/bin/brave-browser`],[`BraveSoftware\\Brave-Browser\\Application\\brave.exe`],{darwin:`BraveSoftware/Brave-Browser`,linux:`BraveSoftware/Brave-Browser`,win32:`BraveSoftware\\Brave-Browser\\User Data`},{darwin:`Library/Application Support/BraveSoftware/Brave-Browser/Default`,linux:`.config/BraveSoftware/Brave-Browser/Default`,win32:`AppData/Local/BraveSoftware/Brave-Browser/User Data/Default`},`Brave Safe Storage`,`brave`,`AppData/Local/BraveSoftware/Brave-Browser/User Data/Local State`),mO(`edge`,`Microsoft Edge`,`com.microsoft.edgemac`,[`microsoft-edge`],`msedge.exe`,`/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge`,[`/usr/bin/microsoft-edge`,`/usr/local/bin/microsoft-edge`,`/snap/bin/microsoft-edge`],[`Microsoft\\Edge\\Application\\msedge.exe`],{darwin:`Microsoft Edge`,linux:`microsoft-edge`,win32:`Microsoft\\Edge\\User Data`},{darwin:`Library/Application Support/Microsoft Edge/Default`,linux:`.config/microsoft-edge/Default`,win32:`AppData/Local/Microsoft/Edge/User Data/Default`},`Microsoft Edge Safe Storage`,`microsoft-edge`,`AppData/Local/Microsoft/Edge/User Data/Local State`),mO(`arc`,`Arc`,`company.thebrowser.browser`,[`arc`],`arc.exe`,`/Applications/Arc.app/Contents/MacOS/Arc`,[`/usr/bin/arc`,`/usr/local/bin/arc`,`/snap/bin/arc`],[`Arc\\Application\\arc.exe`],{darwin:`Arc/User Data`,linux:`arc`,win32:`Arc\\User Data`},{darwin:`Library/Application Support/Arc/User Data/Default`,linux:`.config/arc/Default`,win32:`AppData/Local/Arc/User Data/Default`},`Arc Safe Storage`,`arc`,`AppData/Local/Arc/User Data/Local State`),mO(`dia`,`Dia`,`company.thebrowser.dia`,[`dia`],`dia.exe`,`/Applications/Dia.app/Contents/MacOS/Dia`,[`/usr/bin/dia`,`/usr/local/bin/dia`,`/snap/bin/dia`],[`Dia\\Application\\dia.exe`],{darwin:`Dia/User Data`,linux:`dia`,win32:`Dia\\User Data`},{darwin:`Library/Application Support/Dia/User Data/Default`,linux:`.config/dia/Default`,win32:`AppData/Local/Dia/User Data/Default`},`Dia Safe Storage`,`dia`,`AppData/Local/Dia/User Data/Local State`),mO(`helium`,`Helium`,`net.imput.helium`,[`helium`],`helium.exe`,`/Applications/Helium.app/Contents/MacOS/Helium`,[`/usr/bin/helium`,`/usr/local/bin/helium`,`/snap/bin/helium`],[`Helium\\Application\\helium.exe`],{darwin:`net.imput.helium`,linux:`helium`,win32:`Helium\\User Data`},{darwin:`Library/Application Support/net.imput.helium/Default`,linux:`.config/helium/Default`,win32:`AppData/Local/Helium/User Data/Default`},`Helium Storage Key`,`helium`,`AppData/Local/Helium/User Data/Local State`),mO(`chromium`,`Chromium`,`org.chromium.chromium`,[`chromium`,`chromium-browser`],`chromium.exe`,`/Applications/Chromium.app/Contents/MacOS/Chromium`,[`/usr/bin/chromium`,`/usr/local/bin/chromium`,`/snap/bin/chromium`],[`Chromium\\Application\\chrome.exe`],{darwin:`Chromium`,linux:`chromium`,win32:`Chromium\\User Data`},{darwin:`Library/Application Support/Chromium/Default`,linux:`.config/chromium/Default`,win32:`AppData/Local/Chromium/User Data/Default`},`Chromium Safe Storage`,`chromium`,`AppData/Local/Chromium/User Data/Local State`),mO(`vivaldi`,`Vivaldi`,`com.vivaldi.vivaldi`,[`vivaldi`,`vivaldi-stable`],`vivaldi.exe`,`/Applications/Vivaldi.app/Contents/MacOS/Vivaldi`,[`/usr/bin/vivaldi`,`/usr/local/bin/vivaldi`,`/snap/bin/vivaldi`],[`Vivaldi\\Application\\vivaldi.exe`],{darwin:`Vivaldi`,linux:`vivaldi`,win32:`Vivaldi\\User Data`},{darwin:`Library/Application Support/Vivaldi/Default`,linux:`.config/vivaldi/Default`,win32:`AppData/Local/Vivaldi/User Data/Default`},`Vivaldi Safe Storage`,`vivaldi`,`AppData/Local/Vivaldi/User Data/Local State`),mO(`opera`,`Opera`,`com.operasoftware.opera`,[`opera`,`opera-stable`],`opera.exe`,`/Applications/Opera.app/Contents/MacOS/Opera`,[`/usr/bin/opera`,`/usr/local/bin/opera`,`/snap/bin/opera`],[`Opera\\launcher.exe`],{darwin:`com.operasoftware.Opera`,linux:`opera`,win32:`Opera Software\\Opera Stable`},{darwin:`Library/Application Support/com.operasoftware.Opera`,linux:`.config/opera`,win32:`AppData/Roaming/Opera Software/Opera Stable`},`Opera Safe Storage`,`opera`,`AppData/Roaming/Opera Software/Opera Stable/Local State`),mO(`ghost`,`Ghost Browser`,`com.nickvision.ghost`,[`ghost-browser`],`ghost.exe`,`/Applications/Ghost Browser.app/Contents/MacOS/Ghost Browser`,[`/usr/bin/ghost-browser`,`/usr/local/bin/ghost-browser`,`/snap/bin/ghost-browser`],[`Ghost Browser\\Application\\ghost.exe`],{darwin:`Ghost Browser`,linux:`ghost-browser`,win32:`Ghost Browser\\User Data`},{darwin:`Library/Application Support/Ghost Browser/Default`,linux:`.config/ghost-browser/Default`,win32:`AppData/Local/Ghost Browser/User Data/Default`},`Ghost Browser Safe Storage`,`ghost-browser`,`AppData/Local/Ghost Browser/User Data/Local State`),mO(`sidekick`,`Sidekick`,`pushplaylabs.sidekick`,[`sidekick`],`sidekick.exe`,`/Applications/Sidekick.app/Contents/MacOS/Sidekick`,[`/usr/bin/sidekick`,`/usr/local/bin/sidekick`,`/snap/bin/sidekick`],[`Sidekick\\Application\\sidekick.exe`],{darwin:`Sidekick`,linux:`sidekick`,win32:`Sidekick\\User Data`},{darwin:`Library/Application Support/Sidekick/Default`,linux:`.config/sidekick/Default`,win32:`AppData/Local/Sidekick/User Data/Default`},`Sidekick Safe Storage`,`sidekick`,`AppData/Local/Sidekick/User Data/Local State`),mO(`yandex`,`Yandex`,`ru.yandex.desktop.yandex-browser`,[`yandex-browser`],`browser.exe`,`/Applications/Yandex.app/Contents/MacOS/Yandex`,[`/usr/bin/yandex-browser`,`/usr/local/bin/yandex-browser`,`/snap/bin/yandex-browser`],[`Yandex\\YandexBrowser\\Application\\browser.exe`],{darwin:`YandexBrowser`,linux:`yandex-browser`,win32:`Yandex\\YandexBrowser\\User Data`},{darwin:`Library/Application Support/YandexBrowser/Default`,linux:`.config/yandex-browser/Default`,win32:`AppData/Local/Yandex/YandexBrowser/User Data/Default`},`Yandex Safe Storage`,`yandex-browser`,`AppData/Local/Yandex/YandexBrowser/User Data/Local State`),mO(`iridium`,`Iridium`,`de.nickvision.iridium`,[`iridium`],`iridium.exe`,`/Applications/Iridium.app/Contents/MacOS/Iridium`,[`/usr/bin/iridium`,`/usr/local/bin/iridium`,`/snap/bin/iridium`],[`Iridium\\Application\\iridium.exe`],{darwin:`Iridium`,linux:`iridium`,win32:`Iridium\\User Data`},{darwin:`Library/Application Support/Iridium/Default`,linux:`.config/iridium/Default`,win32:`AppData/Local/Iridium/User Data/Default`},`Iridium Safe Storage`,`iridium`,`AppData/Local/Iridium/User Data/Local State`),mO(`thorium`,`Thorium`,`nickvision.thorium`,[`thorium`],`thorium.exe`,`/Applications/Thorium.app/Contents/MacOS/Thorium`,[`/usr/bin/thorium`,`/usr/local/bin/thorium`,`/snap/bin/thorium`],[`Thorium\\Application\\thorium.exe`],{darwin:`Thorium`,linux:`thorium`,win32:`Thorium\\User Data`},{darwin:`Library/Application Support/Thorium/Default`,linux:`.config/thorium/Default`,win32:`AppData/Local/Thorium/User Data/Default`},`Thorium Safe Storage`,`thorium`,`AppData/Local/Thorium/User Data/Local State`),mO(`sigmaos`,`SigmaOS`,`com.nickvision.sigmaos`,[`sigmaos`],`sigmaos.exe`,`/Applications/SigmaOS.app/Contents/MacOS/SigmaOS`,[`/usr/bin/sigmaos`,`/usr/local/bin/sigmaos`,`/snap/bin/sigmaos`],[`SigmaOS\\Application\\sigmaos.exe`],{darwin:`SigmaOS`,linux:`sigmaos`,win32:`SigmaOS\\User Data`},{darwin:`Library/Application Support/SigmaOS/Default`,linux:`.config/sigmaos/Default`,win32:`AppData/Local/SigmaOS/User Data/Default`},`SigmaOS Safe Storage`,`sigmaos`,`AppData/Local/SigmaOS/User Data/Local State`),mO(`wavebox`,`Wavebox`,`io.wavebox.wavebox`,[`wavebox`],`wavebox.exe`,`/Applications/Wavebox.app/Contents/MacOS/Wavebox`,[`/usr/bin/wavebox`,`/usr/local/bin/wavebox`,`/snap/bin/wavebox`],[`Wavebox\\Application\\wavebox.exe`],{darwin:`Wavebox`,linux:`wavebox`,win32:`Wavebox\\User Data`},{darwin:`Library/Application Support/Wavebox/Default`,linux:`.config/wavebox/Default`,win32:`AppData/Local/Wavebox/User Data/Default`},`Wavebox Safe Storage`,`wavebox`,`AppData/Local/Wavebox/User Data/Local State`),mO(`comet`,`Comet`,`com.nickvision.comet`,[`comet`],`comet.exe`,`/Applications/Comet.app/Contents/MacOS/Comet`,[`/usr/bin/comet`,`/usr/local/bin/comet`,`/snap/bin/comet`],[`Comet\\Application\\comet.exe`],{darwin:`Comet`,linux:`comet`,win32:`Comet\\User Data`},{darwin:`Library/Application Support/Comet/Default`,linux:`.config/comet/Default`,win32:`AppData/Local/Comet/User Data/Default`},`Comet Safe Storage`,`comet`,`AppData/Local/Comet/User Data/Local State`),mO(`blisk`,`Blisk`,`com.nickvision.blisk`,[`blisk`],`blisk.exe`,`/Applications/Blisk.app/Contents/MacOS/Blisk`,[`/usr/bin/blisk`,`/usr/local/bin/blisk`,`/snap/bin/blisk`],[`Blisk\\Application\\blisk.exe`],{darwin:`Blisk`,linux:`blisk`,win32:`Blisk\\User Data`},{darwin:`Library/Application Support/Blisk/Default`,linux:`.config/blisk/Default`,win32:`AppData/Local/Blisk/User Data/Default`},`Blisk Safe Storage`,`blisk`,`AppData/Local/Blisk/User Data/Local State`)],gO={kind:`firefox`,key:`firefox`,displayName:`Firefox`,bundleId:`org.mozilla.firefox`,desktopFiles:[`firefox`],executable:{darwin:`/Applications/Firefox.app/Contents/MacOS/firefox`,linux:[`/usr/bin/firefox`,`/usr/local/bin/firefox`,`/snap/bin/firefox`],win32:[`Mozilla Firefox\\firefox.exe`]},dataDir:{darwin:`Library/Application Support/Firefox`,linux:`.mozilla/firefox`,win32:`AppData/Roaming/Mozilla/Firefox`}},_O={kind:`safari`,key:`safari`,displayName:`Safari`,bundleId:`com.apple.safari`,executable:`/Applications/Safari.app/Contents/MacOS/Safari`,cookieRelativePaths:[`Library/Cookies`,`Library/Containers/com.apple.Safari/Data/Library/Cookies`]},vO=[...hO,gO,_O],yO=new Map,bO=new Map,xO=new Map,SO=new Map;for(let e of vO)if(SO.set(e.key,e),yO.set(e.bundleId.toLowerCase(),e),xO.set(e.displayName,e),`desktopFiles`in e)for(let t of e.desktopFiles)bO.set(t,e);yO.set(`com.microsoft.edge`,SO.get(`edge`));const CO=e=>yO.get(e.toLowerCase()),wO=e=>bO.get(e.replace(/\.desktop$/,``)),TO=e=>hO.find(t=>t.key===e),EO=/^v\d\d$/,DO=(e,t)=>s.pbkdf2Sync(e,`saltysalt`,t,16,`sha1`),OO=(e,t,n)=>{let r=Buffer.from(e);if(r.length<3)return;let i=r.subarray(0,3).toString(`utf8`);if(!EO.test(i))return NO(r,!1);let a=r.subarray(3);if(!a.length)return``;for(let e of t){let t=AO(a,e);if(!t)continue;let r=NO(t,n);if(r!==void 0)return r}},kO=(e,t,n)=>{let r=Buffer.from(e);if(r.length<3)return;let i=r.subarray(0,3).toString(`utf8`);if(!EO.test(i))return;let a=r.subarray(3);if(a.length<28)return;let o=a.subarray(0,12),c=a.subarray(a.length-16),l=a.subarray(12,a.length-16);try{let e=s.createDecipheriv(`aes-256-gcm`,t,o);return e.setAuthTag(c),NO(Buffer.concat([e.update(l),e.final()]),n)}catch{return}},AO=(e,t)=>{try{let n=Buffer.alloc(16,32),r=s.createDecipheriv(`aes-128-cbc`,t,n);return r.setAutoPadding(!1),jO(Buffer.concat([r.update(e),r.final()]))}catch{return}},jO=e=>{if(!e.length)return e;let t=e[e.length-1];return!t||t>16?e:e.subarray(0,e.length-t)},MO=new TextDecoder(`utf-8`,{fatal:!0}),NO=(e,t)=>{let n=t&&e.length>=32?e.subarray(32):e;try{let e=MO.decode(n),t=0;for(;t<e.length&&e.charCodeAt(t)<32;)t+=1;return e.slice(t)}catch{return}},PO=0x9184e72a000,FO=1e6,IO=11644473600,LO=1e10,RO=1e3,zO=e=>e>0&&e<=253402300799?Math.round(e):void 0,BO=e=>{if(e!==void 0){if(typeof e==`string`){let t=Number(e);return Number.isFinite(t)?BO(t):void 0}if(typeof e==`bigint`)return e<=0n?void 0:e>BigInt(PO)?zO(Number(e/BigInt(FO)-BigInt(IO))):e>BigInt(LO)?zO(Number(e/BigInt(RO))):zO(Number(e));if(!(!e||Number.isNaN(e))&&!(e<=0))return zO(e>PO?e/FO-IO:e>LO?e/RO:e)}},VO=e=>{let t=typeof e==`bigint`?Number(e):typeof e==`number`?e:void 0;if(t!==void 0){if(t===2)return`Strict`;if(t===1)return`Lax`;if(t===0)return`None`}},HO=qx({os_crypt:qx({encrypted_key:G})});var UO=class extends A()(`@cookies/ChromiumKeyProvider`){static layerDarwin=Ld(this)(L(function*(){let e=yield*tE;return{buildDecryptor:H(`ChromiumKeyProvider.buildDecryptor`)(function*(t,n){let r=TO(t),i=yield*e.string(aE(`security`,[`find-generic-password`,`-w`,`-s`,r.keychainService])).pipe(B(e=>e.trim()),Mp(`PlatformError`,()=>new QD({browser:t,platform:`darwin`}).asEffect()));if(!i)return yield*new QD({browser:t,platform:`darwin`}).asEffect();let a=DO(i,1003);return(e=>OO(e,[a],n))})}})).pipe(N(d.layer));static layerLinux=Ld(this)(L(function*(){let e=yield*tE;return{buildDecryptor:H(`ChromiumKeyProvider.buildDecryptor`)(function*(t,n){let r=[[`secret-tool`,`lookup`,`application`,TO(t).linuxSecretLabel],[`secret-tool`,`lookup`,`xdg:schema`,`chrome_libsecret_os_crypt_password_v2`],[`secret-tool`,`lookup`,`xdg:schema`,`chrome_libsecret_os_crypt_password_v1`]],i=``;for(let t of r){let n=t[0],r=t.slice(1),a=yield*e.string(aE(n,r)).pipe(B(e=>e.trim()),Mp(`PlatformError`,()=>P(``)));if(a){i=a;break}}i||=`peanuts`;let a=new Set([i,`peanuts`,``]),o=Array.from(a).map(e=>DO(e,1));return(e=>OO(e,o,n))})}})).pipe(N(d.layer));static layerWin32=Ld(this)(L(function*(){let e=yield*tE,t=yield*cw;return{buildDecryptor:H(`ChromiumKeyProvider.buildDecryptor`)(function*(r,i){let a=TO(r),o=n.join(c.homedir(),a.localStatePath),s=yield*t.readFileString(o).pipe(Mp(`PlatformError`,()=>new QD({browser:r,platform:`win32`}).asEffect())),l=(yield*Cp({try:()=>Ax(HO)(JSON.parse(s)),catch:()=>new QD({browser:r,platform:`win32`})})).os_crypt.encrypted_key,u=`Add-Type -AssemblyName System.Security; $encrypted = [Convert]::FromBase64String('${Buffer.from(l,`base64`).subarray(5).toString(`base64`)}'); $decrypted = [System.Security.Cryptography.ProtectedData]::Unprotect($encrypted, $null, 'CurrentUser'); [Convert]::ToBase64String($decrypted)`,d=yield*e.string(aE(`powershell`,[`-Command`,u])).pipe(B(e=>e.trim()),Mp(`PlatformError`,()=>new QD({browser:r,platform:`win32`}).asEffect()));if(!d)return yield*new QD({browser:r,platform:`win32`}).asEffect();let f=Buffer.from(d,`base64`);return(e=>kO(e,f,i))})}})).pipe(N(d.layer))},WO=class extends A()(`@cookies/ChromiumSqliteFallback`,{make:L(function*(){let e=yield*pO,t=yield*cw,r=yield*UO,i=H(`ChromiumSqliteFallback.resolveCookieDbPath`)(function*(e,r){let i=n.join(e,`Network`,`Cookies`);if(yield*t.exists(i))return i;let a=n.join(e,`Cookies`);return(yield*t.exists(a))?a:yield*new GD({browser:r}).asEffect()}),a=H(`ChromiumSqliteFallback.readMetaVersion`)(function*(t){let n=(yield*e.query(t,`SELECT value FROM meta WHERE key = 'version'`,`chromium`).pipe(Mp(`CookieReadError`,()=>P([]))))[0]?.value;if(typeof n==`number`)return Math.floor(n);if(typeof n==`bigint`)return Math.floor(Number(n));if(typeof n==`string`){let e=Number.parseInt(n,10);return Number.isFinite(e)?e:0}return 0}),o=H(`ChromiumSqliteFallback.extract`)(function*(t){yield*bm({browser:t.key});let n=yield*i(t.profilePath,t.key),{tempDatabasePath:o}=yield*e.copyToTemp(n,`cookies-sqlite-${t.key}-`,`Cookies`,t.key),s=(yield*a(o))>=24,c=yield*r.buildDecryptor(t.key,s),l=yield*e.query(o,`SELECT name, value, host_key, path, expires_utc, samesite, encrypted_value, is_secure, is_httponly FROM cookies ORDER BY expires_utc DESC`,t.key),u=[];for(let e of l){let t=typeof e.name==`string`?e.name:void 0;if(!t)continue;let n=typeof e.host_key==`string`?e.host_key:void 0;if(!n)continue;let r=typeof e.value==`string`?e.value:void 0;if(!r||r.length===0){let t=e.encrypted_value instanceof Uint8Array?e.encrypted_value:void 0;if(!t)continue;let n=c(t);if(n===void 0)continue;r=n}let i=e.expires_utc,a=BO(typeof i==`number`||typeof i==`bigint`||typeof i==`string`?i:void 0);u.push(iO.make({name:t,value:r,domain:n,path:typeof e.path==`string`?e.path:`/`,...a===void 0?{}:{expires:a},secure:Number(e.is_secure)!==0,httpOnly:Number(e.is_httponly)!==0,sameSite:VO(e.samesite)}))}return yield*Vm(`Chromium SQLite fallback cookies extracted`,{browser:t.key,count:u.length}),u},om);return{extract:e=>o(e).pipe(Np({CookieDatabaseNotFoundError:e=>new XD({reason:new JD({cause:e})}).asEffect(),CookieDatabaseCopyError:e=>new XD({reason:new JD({cause:e})}).asEffect(),CookieReadError:e=>new XD({reason:new JD({cause:e})}).asEffect(),CookieDecryptionKeyError:e=>new XD({reason:new JD({cause:e})}).asEffect(),PlatformError:e=>new XD({reason:new JD({cause:e})}).asEffect()}))}})}){static layer=Ld(this)(this.make).pipe(N(pO.layer),N(Vd(F(()=>{let e=c.platform();return e===`darwin`?UO.layerDarwin:e===`win32`?UO.layerWin32:UO.layerLinux}))),N(d.layer))};const GO=e=>{if(e.length<8||e.subarray(0,4).toString(`utf8`)!==`cook`)return[];let t=e.readUInt32BE(4),n=8,r=[];for(let i=0;i<t;i+=1)r.push(e.readUInt32BE(n)),n+=4;let i=[];for(let t of r){let r=e.subarray(n,n+t);n+=t,i.push(...KO(r))}return i},KO=e=>{if(e.length<16||e.readUInt32BE(0)!==256)return[];let t=e.readUInt32LE(4),n=[],r=8;for(let i=0;i<t;i+=1)n.push(e.readUInt32LE(r)),r+=4;let i=[];for(let t of n){let n=qO(e.subarray(t));n&&i.push(n)}return i},qO=e=>{if(e.length<48)return;let t=e.readUInt32LE(0);if(t<48||t>e.length)return;let n=e.readUInt32LE(8),r=(n&1)!=0,i=(n&4)!=0,a=e.readUInt32LE(16),o=e.readUInt32LE(20),s=e.readUInt32LE(24),c=e.readUInt32LE(28),l=JO(e,40),u=YO(e,a,t),d=YO(e,o,t),f=YO(e,s,t)??`/`,p=YO(e,c,t)??``;if(!d)return;let m=u?XO(u):void 0,h=l&&l>0?Math.round(l+978307200):void 0;return iO.make({name:d,value:p,domain:m??``,path:f,expires:h,secure:r,httpOnly:i})},JO=(e,t)=>t+8>e.length?0:e.subarray(t,t+8).readDoubleLE(0),YO=(e,t,n)=>{if(t<=0||t>=n)return;let r=t;for(;r<n&&e[r]!==0;)r+=1;if(!(r>=n))return e.toString(`utf8`,t,r)},XO=e=>{try{let t=e.includes(`://`)?e:`https://${e}`;return new URL(t).hostname}catch{let t=e.trim();return t===``?void 0:t}},ZO=1e3,QO=eS([Ux,Gx]).pipe(sS(Wx,{decode:U(e=>Number(e)!==0),encode:U(e=>e?1:0)})),$O=qx({name:G,value:G,host:G,path:G,expiry:eS([Ux,Gx,G]).pipe(sS(Ix(Ux),{decode:U(e=>{let t=Number(e);if(!(Number.isNaN(t)||t<=0))return Math.floor(t/ZO)}),encode:U(e=>(e??0)*ZO)})),isSecure:QO,isHttpOnly:QO,sameSite:eS([Ux,Gx,G]).pipe(sS(Ix(tO),{decode:U(e=>{let t=Number(e);if(t===2)return`Strict`;if(t===1)return`Lax`;if(t===0)return`None`}),encode:U(e=>e===`Strict`?2:e===`Lax`?1:0)}))}),ek=e=>iO.make({name:e.name,value:e.value,domain:e.host,path:e.path||`/`,expires:e.expiry,secure:e.isSecure,httpOnly:e.isHttpOnly,sameSite:e.sameSite});var tk=class extends A()(`@cookies/Cookies`,{make:L(function*(){let e=yield*uO,t=yield*pO,r=yield*WO,i=yield*cw,a=t=>e.extractCookies({key:t.key,profilePath:t.profilePath,executablePath:t.executablePath}).pipe(Np({TimeoutError:e=>new XD({reason:new JD({cause:e})}).asEffect(),SchemaError:e=>new XD({reason:new JD({cause:e})}).asEffect(),SocketError:e=>new XD({reason:new JD({cause:e})}).asEffect(),HttpClientError:e=>new XD({reason:new JD({cause:e})}).asEffect(),PlatformError:e=>new XD({reason:new JD({cause:e})}).asEffect()}),Mp(`ExtractionError`,e=>L(function*(){return yield*zm(`CDP extraction failed, trying SQLite fallback`,{browser:t.key,error:e.message}),yield*r.extract(t)}).pipe(Mp(`ExtractionError`,()=>e.asEffect())))),o=e=>L(function*(){let r=n.join(e.profilePath,`cookies.sqlite`),{tempDatabasePath:i}=yield*t.copyToTemp(r,`cookies-firefox-`,`cookies.sqlite`,`firefox`);return yield*fp(yield*t.query(i,`SELECT name, value, host, path, expiry, isSecure, isHttpOnly, sameSite FROM moz_cookies ORDER BY expiry DESC`,`firefox`),e=>Dx($O)(e).pipe(B(ek)))}).pipe(om,Np({CookieReadError:e=>new XD({reason:new JD({cause:e})}).asEffect(),CookieDatabaseCopyError:e=>new XD({reason:new JD({cause:e})}).asEffect(),SchemaError:e=>new XD({reason:new JD({cause:e})}).asEffect()})),s=e=>L(function*(){if(pr(e.cookieFilePath))return yield*new XD({reason:new YD}).asEffect();let t=yield*i.readFile(e.cookieFilePath.value);return GO(Buffer.from(t)).filter(e=>!!e.name&&!!e.domain)}).pipe(Np({PlatformError:e=>new XD({reason:new JD({cause:e})}).asEffect()}));return{extract:e=>RT(e,{ChromiumBrowser:a,FirefoxBrowser:o,SafariBrowser:s})}})}){static layer=Ld(this,this.make).pipe(N(uO.layer),N(pO.layer),N(WO.layer),N(d.layer));static layerTest=Ld(this,this.make).pipe(N(uO.layerTest),N(pO.layer),N(WO.layer),N(d.layer))},nk=class extends A()(`@cookies/Browsers`,{make:L(function*(){let e=new Set,t=t=>F(()=>{e.add(t)}),n=fp(e,x,{concurrency:`unbounded`}).pipe(B(ui),xm(`Browsers.list`));return{register:t,list:n,defaultBrowser:H(`Browsers.defaultBrowser`)(function*(){let e=(yield*hp({try:()=>UD(),catch:e=>new eO({cause:String(e)})})).id.toLowerCase(),t=e.replace(/\.desktop$/,``),r=CO(e)??wO(t);return r?_r((yield*n).find(e=>e._tag===`ChromiumBrowser`?e.key===r.key:e._tag===`FirefoxBrowser`?r.key===`firefox`:e._tag===`SafariBrowser`?r.key===`safari`:!1)):D()})}})}){static layer=Ld(this,this.make)};const rk=qx({profile:Ix(qx({last_used:Ix(G)}))}),ik=qx({intl:Ix(qx({selected_languages:Ix(G),accept_languages:Ix(G)}))});var ak=class extends A()(`@cookies/ChromiumPlatform`){static layerDarwin=Fd(this,{executableCandidates:e=>[e.executable.darwin],userDataDir:e=>n.join(c.homedir(),`Library`,`Application Support`,e.userData.darwin)});static layerLinux=Fd(this,{executableCandidates:e=>e.executable.linux,userDataDir:e=>n.join(process.env.XDG_CONFIG_HOME??n.join(c.homedir(),`.config`),e.userData.linux)});static layerWin32=Ld(this)(L(function*(){let e=yield*tE,t=new Map;for(let n of hO){let r=`HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\${n.registryKey}`,i=yield*e.string(aE(`reg`,[`query`,r,`/ve`])).pipe(B(e=>e.trim()),jp(()=>P(``)));if(i){let e=i.match(/REG_SZ\s+(.+)/)?.[1]?.trim();e&&t.set(n.key,e)}}let r=process.env.ProgramFiles??`C:\\Program Files`,i=process.env[`ProgramFiles(x86)`]??`C:\\Program Files (x86)`,a=process.env.LOCALAPPDATA??n.join(c.homedir(),`AppData`,`Local`);return{executableCandidates:e=>{let o=[],s=t.get(e.key);s&&o.push(s);for(let t of e.executable.win32)o.push(n.join(r,t),n.join(i,t),n.join(a,t));return o},userDataDir:e=>n.join(a,e.userData.win32)}})).pipe(N(d.layer))},ok=class extends A()(`@cookies/ChromiumSource`,{make:L(function*(){let e=yield*nk,t=yield*ak,r=yield*cw,i=e=>r.readFileString(n.join(e,`Local State`)).pipe(z(e=>Ox(SS(rk))(e)),B(e=>_r(e.profile?.last_used)),Pp(`PlatformError`,`NotFound`,()=>P(D()))),a=e=>r.readFileString(n.join(e,`Preferences`)).pipe(z(e=>Ox(SS(ik))(e)),B(e=>{let t=e.intl?.selected_languages??e.intl?.accept_languages;if(t)return t.split(`,`).map(e=>e.trim()).find(e=>e.length>0)}),jp(()=>P(void 0))),o=(e,t,o)=>L(function*(){if(!(yield*r.exists(o)))return[];let s=yield*i(o),c=yield*r.readDirectory(o).pipe(Pp(`PlatformError`,`NotFound`,()=>P([]))),l=e=>r.exists(n.join(e,`Preferences`)).pipe(Pp(`PlatformError`,`BadResource`,()=>P(!1)));return yield*fp(c,r=>L(function*(){let i=n.join(o,r);if(!(yield*l(i)))return;let s=yield*a(i);return new aO({key:e,profileName:r,profilePath:i,executablePath:t,...s?{locale:s}:{}})}),{concurrency:10}).pipe(B(di(Ce)),B(ii(aO.orderBy(xr(s)))))});yield*e.register(fp(hO,e=>L(function*(){let n;for(let i of t.executableCandidates(e))if(yield*r.exists(i)){n=i;break}return n?yield*o(e.key,n,t.userDataDir(e)):[]}),{concurrency:`unbounded`}).pipe(B(ui),jp(e=>new eO({cause:String(e)}).asEffect())))})}){static layer=Bd(this.make).pipe(N(d.layer))};const sk=qx({Name:G,Path:G,IsRelative:Ix(G)}),ck=e=>Object.values((0,WD.parse)(e)).map(e=>kx(sk)(e)).filter(e=>e._tag===`Some`).map(e=>({name:e.value.Name,path:e.value.Path,isRelative:e.value.IsRelative!==`0`}));var lk=class extends A()(`@cookies/FirefoxPlatform`){static layerDarwin=Fd(this,{dataDir:n.join(c.homedir(),gO.dataDir.darwin),executablePaths:[gO.executable.darwin]});static layerLinux=Fd(this,{dataDir:n.join(c.homedir(),gO.dataDir.linux),executablePaths:gO.executable.linux});static layerWin32=Fd(this,{dataDir:n.join(c.homedir(),gO.dataDir.win32),executablePaths:gO.executable.win32.flatMap(e=>{let t=process.env.ProgramFiles??`C:\\Program Files`,r=process.env[`ProgramFiles(x86)`]??`C:\\Program Files (x86)`;return[n.join(t,e),n.join(r,e)]})})},uk=class extends A()(`@cookies/FirefoxSource`,{make:L(function*(){let e=yield*nk,t=yield*lk,r=yield*cw;yield*e.register(L(function*(){let e;for(let n of t.executablePaths)if(yield*r.exists(n)){e=n;break}if(!e)return[];let i=n.join(t.dataDir,`profiles.ini`);return yield*fp(ck(yield*r.readFileString(i)),e=>L(function*(){let i=e.isRelative?n.join(t.dataDir,e.path):e.path,a=n.join(i,`cookies.sqlite`);if(yield*r.exists(a))return new oO({profileName:n.basename(i),profilePath:i})}),{concurrency:`unbounded`}).pipe(B(e=>e.filter(Ce)))}).pipe(jp(e=>new eO({cause:String(e)}).asEffect())))})}){static layer=Bd(this.make)},dk=class extends A()(`@cookies/SafariPlatform`){static layerDarwin=Fd(this,{executable:_O.executable,cookieRelativePaths:_O.cookieRelativePaths})},fk=class extends A()(`@cookies/SafariSource`,{make:L(function*(){let e=yield*nk,t=yield*dk,r=yield*cw;yield*e.register(L(function*(){if(!(yield*r.exists(t.executable)))return[];let e=D();for(let i of t.cookieRelativePaths){let t=n.join(c.homedir(),i,`Cookies.binarycookies`);if(yield*r.exists(t)){e=O(t);break}}return[new sO({cookieFilePath:e})]}).pipe(Mp(`PlatformError`,e=>new eO({cause:String(e)}).asEffect())))})}){static layer=Bd(this.make)};const pk=nk.layer,mk=Ud(pk,ok.layer.pipe(N(pk),N(ak.layerDarwin),N(d.layer)),uk.layer.pipe(N(pk),N(lk.layerDarwin),N(d.layer)),fk.layer.pipe(N(pk),N(dk.layerDarwin),N(d.layer))),hk=Ud(pk,ok.layer.pipe(N(pk),N(ak.layerLinux),N(d.layer)),uk.layer.pipe(N(pk),N(lk.layerLinux),N(d.layer))),gk=Ud(pk,ok.layer.pipe(N(pk),N(ak.layerWin32),N(d.layer)),uk.layer.pipe(N(pk),N(lk.layerWin32),N(d.layer))),_k=Vd(F(()=>{let e=c.platform();return e===`darwin`?mk:e===`win32`?gk:hk})),vk=[`--enable-webgl`,`--use-gl=angle`,`--use-angle=swiftshader`,`--ignore-gpu-blocklist`],yk=new Set([`button`,`link`,`textbox`,`checkbox`,`radio`,`combobox`,`listbox`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`searchbox`,`slider`,`spinbutton`,`switch`,`tab`,`treeitem`]),bk=new Set([`heading`,`cell`,`gridcell`,`columnheader`,`rowheader`,`listitem`,`article`,`region`,`main`,`navigation`]),xk=`__expect_annotation_overlay__`;var Sk=class extends q(`BrowserLaunchError`)({_tag:K(`BrowserLaunchError`),cause:G}){message=`Failed to launch browser: ${this.cause}`},Ck=class extends q(`SnapshotTimeoutError`)({_tag:K(`SnapshotTimeoutError`),selector:G,timeoutMs:Ux,cause:G}){message=`Snapshot timed out after ${this.timeoutMs}ms on selector "${this.selector}": ${this.cause}`},wk=class extends q(`RefNotFoundError`)({_tag:K(`RefNotFoundError`),ref:G,availableRefs:Zx(G)}){message=this.availableRefs.length===0?`Unknown ref "${this.ref}" (no refs available — page may be empty)`:`Unknown ref "${this.ref}" (available refs: ${this.availableRefs.join(`, `)})`},Tk=class extends q(`RefAmbiguousError`)({_tag:K(`RefAmbiguousError`),ref:G,matchCount:G}){message=`Ref "${this.ref}" matched ${this.matchCount} elements. Run snapshot to get updated refs.`},Ek=class extends q(`RefBlockedError`)({_tag:K(`RefBlockedError`),ref:G}){message=`Ref "${this.ref}" is blocked by an overlay. Dismiss any modals or banners first.`},Dk=class extends q(`RefNotVisibleError`)({_tag:K(`RefNotVisibleError`),ref:G}){message=`Ref "${this.ref}" is not visible. Try scrolling it into view.`},Ok=class extends q(`ActionTimeoutError`)({_tag:K(`ActionTimeoutError`),ref:G}){message=`Action on "${this.ref}" timed out. The element may be blocked or still loading. Run snapshot to check.`},kk=class extends q(`ActionUnknownError`)({_tag:K(`ActionUnknownError`),ref:G,cause:G}){message=`Action on "${this.ref}" failed: ${this.cause}`},Ak=class extends q(`NavigationError`)({_tag:K(`NavigationError`),url:G,cause:G}){message=`Navigation to "${this.url}" failed: ${this.cause}`},jk=class extends q(`RecorderInjectionError`)({_tag:K(`RecorderInjectionError`),cause:G}){message=`Failed to inject rrweb recorder: ${this.cause}`},Mk=class extends q(`SessionLoadError`)({_tag:K(`SessionLoadError`),path:G,cause:G}){message=`Failed to load session from ${this.path}: ${this.cause}`};const Nk=/resolved to (\d+) elements/,Pk=/Timeout \d+ms exceeded/,Fk=[`strict mode violation`],Ik=[`intercepts pointer events`],Lk=[`Element is not visible`,`Element is outside of the viewport`,`element is not visible`,`element is outside of the viewport`,`to be visible`,`Element is not stable`,`element is not stable`,`Element(s) not found`,`Element is not attached to the DOM`,`Element is not connected`,`No element matching`,`Failed to find element matching selector`,`not attached`],Rk=(e,t)=>t.some(t=>e.includes(t)),zk=(e,t)=>{let n=e instanceof Error?e.message:String(e);if(Rk(n,Fk)){let e=Nk.exec(n);return new Tk({matchCount:e?e[1]:`multiple`,ref:t})}return Rk(n,Ik)?new Ek({ref:t}):Rk(n,Lk)?new Dk({ref:t}):Pk.test(n)?new Ok({ref:t}):new kk({ref:t,cause:n})},Bk=e=>{let t=0;for(;t<e.length&&e[t]===` `;)t++;return Math.floor(t/2)},Vk=e=>e.includes(`[ref=`)||e.includes(`:`)&&!e.endsWith(`:`),Hk=e=>{let t=e.split(`
28
- `),n=t.map(Bk),r=Array(t.length).fill(!1),i=[];for(let e=t.length-1;e>=0;e--)if(Vk(t[e])){r[e]=!0,i.length=0;for(let t=e-1;t>=0;t--)if(!(n[t]>=n[e])){if(r[t])break;r[t]=!0,i.push(t)}}return t.filter((e,t)=>r[t]).join(`
29
- `)},Uk=(e,t)=>{if(t.selector)return e.locator(t.selector);let n=e.getByRole(t.role,{name:t.name,exact:!0});return t.nth===void 0?n:n.nth(t.nth)},Wk=(e,t)=>H(`Browser.resolveRef`)(function*(n){let r=t[n];return r?Uk(e,r):yield*new wk({ref:n,availableRefs:Object.keys(t)})}),Gk=(e,t,...n)=>mp(()=>e.evaluate(({method:e,args:t})=>{let n=Reflect.get(globalThis,`__EXPECT_RUNTIME__`);if(!n||typeof n!=`object`)throw Error(`Browser runtime is not initialized`);let r=Reflect.get(n,e);if(typeof r!=`function`)throw Error(`Browser runtime method not found: ${e}`);return r(...t)},{method:t,args:n})),Kk=[`a`,`button`,`input`,`select`,`textarea`,`details`,`summary`],qk=H(`findCursorInteractive`)(function*(e,t){return yield*Gk(e,`findCursorInteractiveElements`,t||`body`,100,[...yk],Kk,100)}),Jk=/- (\w+)\s*(?:"((?:[^"\\]|\\.)*)")?/,Yk=e=>{let t=Jk.exec(e);if(!t)return D();let n=t[1];return n===`text`?D():O({role:n,name:t[2]?.replace(/\\(.)/g,`$1`)??``})},Xk=(e,t)=>`${e}|${t}`,Zk=e=>{let t=new Map;for(let[n,r]of Object.entries(e)){let e=Xk(r.role,r.name),i=t.get(e);i?i.push(n):t.set(e,[n])}for(let n of t.values())if(!(n.length<=1))for(let t=0;t<n.length;t++)e[n[t]].nth=t},Qk=(e,t)=>{let n=Object.values(t);return{lines:e.split(`
30
- `).length,characters:e.length,estimatedTokens:Math.ceil(e.length/4),totalRefs:n.length,interactiveRefs:n.filter(e=>yk.has(e.role)).length}},$k=Ud(_k,tk.layer),eA=(e,t,n)=>yk.has(e)?!0:n?!1:bk.has(e)&&t.length>0,tA=e=>new Sk({cause:e instanceof Error?e.message:String(e)}),nA=H(`Browser.resolveDefaultBrowserContext`)(function*(){return{preferredProfile:xr(yield*(yield*nk).defaultBrowser().pipe(Mp(`ListBrowsersError`,()=>P(D()))))}},em(_k)),rA=H(`Browser.extractCookiesForProfile`)(function*(e,t){return yield*e.extract(t)},Np({ExtractionError:()=>P([]),PlatformError:Sp})),iA=(e,t)=>e._tag===t._tag?e._tag===`ChromiumBrowser`&&t._tag===`ChromiumBrowser`?e.key===t.key&&e.profilePath!==t.profilePath:e._tag===`FirefoxBrowser`&&t._tag===`FirefoxBrowser`?e.profilePath!==t.profilePath:!1:!1,aA=H(`Browser.extractDefaultBrowserCookies`)(function*(e,t){if(!t)return[];let n=yield*tk;return pi((yield*fp([t,...(yield*(yield*nk).list.pipe(Mp(`ListBrowsersError`,()=>P([])))).filter(e=>iA(e,t))],e=>rA(n,e),{concurrency:`unbounded`})).flat(),(e,t)=>e.name===t.name&&e.domain===t.domain&&e.path===t.path)},em($k)),oA=H(`Browser.appendCursorInteractive`)(function*(e,t,n,r,i){let a=yield*qk(e,i.selector);if(a.length===0)return r;let o=new Set(Object.values(n).map(e=>e.name.toLowerCase())),s=[];for(let e of a){if(o.has(e.text.toLowerCase()))continue;o.add(e.text.toLowerCase());let t=`e${++r}`;n[t]={role:`clickable`,name:e.text,selector:e.selector},s.push(`- clickable "${e.text}" [ref=${t}] [${e.reason}]`)}return s.length>0&&(t.push(`# Cursor-interactive elements:`),t.push(...s)),r}),sA=(e,t)=>Gk(e,`injectOverlayLabels`,xk,t);var cA=class extends A()(`@browser/Browser`,{make:L(function*(){let e=H(`Browser.createPage`)(function*(e,t={}){yield*bm({url:e??`about:blank`});let n=yield*hp({try:()=>g.launch({headless:!t.headed,executablePath:t.executablePath,args:t.headed?[]:vk}),catch:tA});return yield*L(function*(){let r=t.cookies===!0?yield*nA():{preferredProfile:void 0},i=r.preferredProfile?._tag===`ChromiumBrowser`?r.preferredProfile.locale:void 0,a={};i&&(a.locale=i),t.videoOutputDir&&(a.recordVideo={dir:t.videoOutputDir,size:{width:960,height:540}});let o=yield*hp({try:()=>n.newContext(a),catch:tA});if(yield*hp({try:()=>o.addInitScript('"use strict";var __EXPECT_RUNTIME__=(()=>{var Cr=Object.defineProperty;var ra=Object.getOwnPropertyDescriptor;var sa=Object.getOwnPropertyNames;var ia=Object.prototype.hasOwnProperty;var na=(s,e)=>{for(var t in e)Cr(s,t,{get:e[t],enumerable:!0})},oa=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of sa(e))!ia.call(s,i)&&i!==t&&Cr(s,i,{get:()=>e[i],enumerable:!(r=ra(e,i))||r.enumerable});return s};var aa=s=>oa(Cr({},"__esModule",{value:!0}),s);var od={};na(od,{findCursorInteractiveElements:()=>ed,getAllEvents:()=>id,getEventCount:()=>nd,getEvents:()=>sd,getPerformanceMetrics:()=>Kf,injectOverlayLabels:()=>Qf,removeOverlay:()=>qf,startRecording:()=>td,stopRecording:()=>rd});var la=new Set(["role","name","aria-label","rel","href"]);function ua(s,e){let t=la.has(s);t||(t=s.startsWith("data-")&&Be(s));let r=Be(e)&&e.length<100;return r||(r=e.startsWith("#")&&Be(e.slice(1))),t&&r}function ca(s){return Be(s)}function ha(s){return Be(s)}function fa(s){return!0}function si(s,e){if(s.nodeType!==Node.ELEMENT_NODE)throw new Error("Can\'t generate CSS selector for non-element node type.");if(s.tagName.toLowerCase()==="html")return"html";let t={root:document.body,idName:ca,className:ha,tagName:fa,attr:ua,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},r=new Date,i={...t,...e},n=ya(i.root,t),o,l=0;for(let u of da(s,i,n)){if(new Date().getTime()-r.getTime()>i.timeoutMs||l>=i.maxNumberOfPathChecks){let h=ma(s,n);if(!h)throw new Error(`Timeout: Can\'t find a unique selector after ${i.timeoutMs}ms`);return We(h)}if(l++,xr(u,n)){o=u;break}}if(!o)throw new Error("Selector was not found.");let a=[...oi(o,s,i,n,r)];return a.sort(Er),a.length>0?We(a[0]):We(o)}function*da(s,e,t){let r=[],i=[],n=s,o=0;for(;n&&n!==t;){let l=pa(n,e);for(let a of l)a.level=o;if(r.push(l),n=n.parentElement,o++,i.push(...ni(r)),o>=e.seedMinLength){i.sort(Er);for(let a of i)yield a;i=[]}}i.sort(Er);for(let l of i)yield l}function Be(s){if(/^[a-z\\-]{3,}$/i.test(s)){let e=s.split(/-|[A-Z]/);for(let t of e)if(t.length<=2||/[^aeiou]{4,}/i.test(t))return!1;return!0}return!1}function pa(s,e){let t=[],r=s.getAttribute("id");r&&e.idName(r)&&t.push({name:"#"+CSS.escape(r),penalty:0});for(let o=0;o<s.classList.length;o++){let l=s.classList[o];e.className(l)&&t.push({name:"."+CSS.escape(l),penalty:1})}for(let o=0;o<s.attributes.length;o++){let l=s.attributes[o];e.attr(l.name,l.value)&&t.push({name:`[${CSS.escape(l.name)}="${CSS.escape(l.value)}"]`,penalty:2})}let i=s.tagName.toLowerCase();if(e.tagName(i)){t.push({name:i,penalty:5});let o=Ir(s,i);o!==void 0&&t.push({name:ii(i,o),penalty:10})}let n=Ir(s);return n!==void 0&&t.push({name:ga(i,n),penalty:50}),t}function We(s){let e=s[0],t=e.name;for(let r=1;r<s.length;r++){let i=s[r].level||0;e.level===i-1?t=`${s[r].name} > ${t}`:t=`${s[r].name} ${t}`,e=s[r]}return t}function ri(s){return s.map(e=>e.penalty).reduce((e,t)=>e+t,0)}function Er(s,e){return ri(s)-ri(e)}function Ir(s,e){let t=s.parentNode;if(!t)return;let r=t.firstChild;if(!r)return;let i=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(e===void 0||r.tagName.toLowerCase()===e)&&i++,r!==s);)r=r.nextSibling;return i}function ma(s,e){let t=0,r=s,i=[];for(;r&&r!==e;){let n=r.tagName.toLowerCase(),o=Ir(r,n);if(o===void 0)return;i.push({name:ii(n,o),penalty:NaN,level:t}),r=r.parentElement,t++}if(xr(i,e))return i}function ga(s,e){return s==="html"?"html":`${s}:nth-child(${e})`}function ii(s,e){return s==="html"?"html":`${s}:nth-of-type(${e})`}function*ni(s,e=[]){if(s.length>0)for(let t of s[0])yield*ni(s.slice(1,s.length),e.concat(t));else yield e}function ya(s,e){return s.nodeType===Node.DOCUMENT_NODE?s:s===e.root?s.ownerDocument:s}function xr(s,e){let t=We(s);switch(e.querySelectorAll(t).length){case 0:throw new Error(`Can\'t select any node with this selector: ${t}`);case 1:return!0;default:return!1}}function*oi(s,e,t,r,i){if(s.length>2&&s.length>t.optimizedMinLength)for(let n=1;n<s.length-1;n++){if(new Date().getTime()-i.getTime()>t.timeoutMs)return;let l=[...s];l.splice(n,1),xr(l,r)&&r.querySelector(We(l))===e&&(yield l,yield*oi(l,e,t,r,i))}}var wa=Object.defineProperty,ba=(s,e,t)=>e in s?wa(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,w=(s,e,t)=>ba(s,typeof e!="symbol"?e+"":e,t),ai,Sa=Object.defineProperty,va=(s,e,t)=>e in s?Sa(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,li=(s,e,t)=>va(s,typeof e!="symbol"?e+"":e,t),j=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(j||{}),ui={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ci={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},pt={},Ca=()=>!!globalThis.Zone;function As(s){if(pt[s])return pt[s];let e=globalThis[s],t=e.prototype,r=s in ui?ui[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),n=s in ci?ci[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!Ca())return pt[s]=e.prototype,e.prototype;try{let l=document.createElement("iframe");document.body.appendChild(l);let a=l.contentWindow;if(!a)return e.prototype;let u=a[s].prototype;return document.body.removeChild(l),u?pt[s]=u:t}catch{return t}}var Mr={};function fe(s,e,t){var r;let i=`${s}.${String(t)}`;if(Mr[i])return Mr[i].call(e);let n=As(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(Mr[i]=o,o.call(e)):e[t]}var Nr={};function on(s,e,t){let r=`${s}.${String(t)}`;if(Nr[r])return Nr[r].bind(e);let n=As(s)[t];return typeof n!="function"?e[t]:(Nr[r]=n,n.bind(e))}function Ea(s){return fe("Node",s,"ownerDocument")}function Ia(s){return fe("Node",s,"childNodes")}function xa(s){return fe("Node",s,"parentNode")}function Ma(s){return fe("Node",s,"parentElement")}function Na(s){return fe("Node",s,"textContent")}function Ra(s,e){return on("Node",s,"contains")(e)}function Aa(s){return on("Node",s,"getRootNode")()}function Oa(s){return!s||!("host"in s)?null:fe("ShadowRoot",s,"host")}function Da(s){return s.styleSheets}function Ta(s){return!s||!("shadowRoot"in s)?null:fe("Element",s,"shadowRoot")}function _a(s,e){return fe("Element",s,"querySelector")(e)}function ka(s,e){return fe("Element",s,"querySelectorAll")(e)}function Pa(){return As("MutationObserver").constructor}function $a(s,e,t){try{if(!(e in s))return()=>{};let r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}var Y={ownerDocument:Ea,childNodes:Ia,parentNode:xa,parentElement:Ma,textContent:Na,contains:Ra,getRootNode:Aa,host:Oa,styleSheets:Da,shadowRoot:Ta,querySelector:_a,querySelectorAll:ka,mutationObserver:Pa,patch:$a};function an(s){return s.nodeType===s.ELEMENT_NODE}function Ye(s){let e=s&&"host"in s&&"mode"in s&&Y.host(s)||null;return!!(e&&"shadowRoot"in e&&Y.shadowRoot(e)===s)}function Ze(s){return Object.prototype.toString.call(s)==="[object ShadowRoot]"}function La(s){return s.includes(" background-clip: text;")&&!s.includes(" -webkit-background-clip: text;")&&(s=s.replace(/\\sbackground-clip:\\s*text;/g," -webkit-background-clip: text; background-clip: text;")),s}function Fa(s){let{cssText:e}=s;if(e.split(\'"\').length<3)return e;let t=["@import",`url(${JSON.stringify(s.href)})`];return s.layerName===""?t.push("layer"):s.layerName&&t.push(`layer(${s.layerName})`),s.supportsText&&t.push(`supports(${s.supportsText})`),s.media.length&&t.push(s.media.mediaText),t.join(" ")+";"}function Br(s){try{let e=s.rules||s.cssRules;if(!e)return null;let t=s.href;!t&&s.ownerNode&&(t=s.ownerNode.baseURI);let r=Array.from(e,i=>ln(i,t)).join("");return La(r)}catch{return null}}function ln(s,e){if(Ba(s)){let t;try{t=Br(s.styleSheet)||Fa(s)}catch{t=s.cssText}return s.styleSheet.href?Ht(t,s.styleSheet.href):t}else{let t=s.cssText;return Wa(s)&&s.selectorText.includes(":")&&(t=Ua(t)),e?Ht(t,e):t}}function Ua(s){let e=/(\\[(?:[\\w-]+)[^\\\\])(:(?:[\\w-]+)\\])/gm;return s.replace(e,"$1\\\\$2")}function Ba(s){return"styleSheet"in s}function Wa(s){return"selectorText"in s}var Vt=class{constructor(){li(this,"idNodeMap",new Map),li(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){let r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){let r=this.getNode(e);if(r){let i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function za(){return new Vt}function Gt({element:s,maskInputOptions:e,tagName:t,type:r,value:i,maskInputFn:n}){let o=i||"",l=r&&Se(r);return(e[t.toLowerCase()]||l&&e[l])&&(n?o=n(o,s):o="*".repeat(o.length)),o}function Se(s){return s.toLowerCase()}var hi="__rrweb_original__";function Va(s){let e=s.getContext("2d");if(!e)return!0;let t=50;for(let r=0;r<s.width;r+=t)for(let i=0;i<s.height;i+=t){let n=e.getImageData,o=hi in n?n[hi]:n;if(new Uint32Array(o.call(e,r,i,Math.min(t,s.width-r),Math.min(t,s.height-i)).data.buffer).some(a=>a!==0))return!1}return!0}function jt(s){let e=s.type;return s.hasAttribute("data-rr-is-password")?"password":e?Se(e):null}function un(s,e){let t;try{t=new URL(s,e??window.location.href)}catch{return null}let r=/\\.([0-9a-z]+)(?:$)/i,i=t.pathname.match(r);return i?.[1]??null}function Ga(s){let e="";return s.indexOf("//")>-1?e=s.split("/").slice(0,3).join("/"):e=s.split("/")[0],e=e.split("?")[0],e}var ja=/url\\((?:(\')([^\']*)\'|(")(.*?)"|([^)]*))\\)/gm,Ha=/^(?:[a-z+]+:)?\\/\\//i,Ya=/^www\\..*/i,Za=/^(data:)([^,]*),(.*)/i;function Ht(s,e){return(s||"").replace(ja,(t,r,i,n,o,l)=>{let a=i||o||l,u=r||n||"";if(!a)return t;if(Ha.test(a)||Ya.test(a))return`url(${u}${a}${u})`;if(Za.test(a))return`url(${u}${a}${u})`;if(a[0]==="/")return`url(${u}${Ga(e)+a}${u})`;let c=e.split("/"),h=a.split("/");c.pop();for(let p of h)p!=="."&&(p===".."?c.pop():c.push(p));return`url(${u}${c.join("/")}${u})`})}function mt(s,e=!1){return e?s.replace(/(\\/\\*[^*]*\\*\\/)|[\\s;]/g,""):s.replace(/(\\/\\*[^*]*\\*\\/)|[\\s;]/g,"").replace(/0px/g,"0")}function Xa(s,e,t=!1){let r=Array.from(e.childNodes),i=[],n=0;if(r.length>1&&s&&typeof s=="string"){let o=mt(s,t),l=o.length/s.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&typeof r[a].textContent=="string"){let u=mt(r[a].textContent,t),c=100,h=3;for(;h<u.length&&(u[h].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,h),1)!==-1);h++);for(;h<u.length;h++){let p=u.substring(0,h),g=o.split(p),m=-1;if(g.length===2)m=g[0].length;else if(g.length>2&&g[0]===""&&r[a-1].textContent!=="")m=o.indexOf(p,1);else if(g.length===1){if(p=p.substring(0,p.length-1),g=o.split(p),g.length<=1)return i.push(s),i;h=c+1}else h===u.length-1&&(m=o.indexOf(p));if(g.length>=2&&h>c){let d=r[a-1].textContent;if(d&&typeof d=="string"){let f=mt(d).length;m=o.indexOf(p,f)}m===-1&&(m=g[0].length)}if(m!==-1){let d=Math.floor(m/l);for(;d>0&&d<s.length;){if(n+=1,n>50*r.length)return i.push(s),i;let f=mt(s.substring(0,d),t);if(f.length===m){i.push(s.substring(0,d)),s=s.substring(d),o=o.substring(m);break}else f.length<m?d+=Math.max(1,Math.floor((m-f.length)/l)):d-=Math.max(1,Math.floor((f.length-m)*l))}break}}}}return i.push(s),i}function Ja(s,e){return Xa(s,e).join("/* rr_split */")}var Ka=1,Qa=new RegExp("[^a-z0-9-_:]"),Je=-2;function cn(){return Ka++}function qa(s){if(s instanceof HTMLFormElement)return"form";let e=Se(s.tagName);return Qa.test(e)?"div":e}var Ie,fi,el=/^[^ \\t\\n\\r\\u000c]+/,tl=/^[, \\t\\n\\r\\u000c]+/;function rl(s,e){if(e.trim()==="")return e;let t=0;function r(n){let o,l=n.exec(e.substring(t));return l?(o=l[0],t+=o.length,o):""}let i=[];for(;r(tl),!(t>=e.length);){let n=r(el);if(n.slice(-1)===",")n=Ne(s,n.substring(0,n.length-1)),i.push(n);else{let o="";n=Ne(s,n);let l=!1;for(;;){let a=e.charAt(t);if(a===""){i.push((n+o).trim());break}else if(l)a===")"&&(l=!1);else if(a===","){t+=1,i.push((n+o).trim());break}else a==="("&&(l=!0);o+=a,t+=1}}}return i.join(", ")}var di=new WeakMap;function Ne(s,e){return!e||e.trim()===""?e:Os(s,e)}function sl(s){return!!(s.tagName==="svg"||s.ownerSVGElement)}function Os(s,e){let t=di.get(s);if(t||(t=s.createElement("a"),di.set(s,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function hn(s,e,t,r){return r&&(t==="src"||t==="href"&&!(e==="use"&&r[0]==="#")||t==="xlink:href"&&r[0]!=="#"||t==="background"&&["table","td","th"].includes(e)?Ne(s,r):t==="srcset"?rl(s,r):t==="style"?Ht(r,Os(s)):e==="object"&&t==="data"?Ne(s,r):r)}function fn(s,e,t){return["video","audio"].includes(s)&&e==="autoplay"}function il(s,e,t){try{if(typeof e=="string"){if(s.classList.contains(e))return!0}else for(let r=s.classList.length;r--;){let i=s.classList[r];if(e.test(i))return!0}if(t)return s.matches(t)}catch{}return!1}function Yt(s,e,t){if(!s)return!1;if(s.nodeType!==s.ELEMENT_NODE)return t?Yt(Y.parentNode(s),e,t):!1;for(let r=s.classList.length;r--;){let i=s.classList[r];if(e.test(i))return!0}return t?Yt(Y.parentNode(s),e,t):!1}function dn(s,e,t,r){let i;if(an(s)){if(i=s,!Y.childNodes(i).length)return!1}else{if(Y.parentElement(s)===null)return!1;i=Y.parentElement(s)}try{if(typeof e=="string"){if(r){if(i.closest(`.${e}`))return!0}else if(i.classList.contains(e))return!0}else if(Yt(i,e,r))return!0;if(t){if(r){if(i.closest(t))return!0}else if(i.matches(t))return!0}}catch{}return!1}function nl(s,e,t){let r=s.contentWindow;if(!r)return;let i=!1,n;try{n=r.document.readyState}catch{return}if(n!=="complete"){let l=setTimeout(()=>{i||(e(),i=!0)},t);s.addEventListener("load",()=>{clearTimeout(l),i=!0,e()});return}let o="about:blank";if(r.location.href!==o||s.src===o||s.src==="")return setTimeout(e,0),s.addEventListener("load",e);s.addEventListener("load",e)}function ol(s,e,t){let r=!1,i;try{i=s.sheet}catch{return}if(i)return;let n=setTimeout(()=>{r||(e(),r=!0)},t);s.addEventListener("load",()=>{clearTimeout(n),r=!0,e()})}function al(s,e){let{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:c,dataURLOptions:h={},inlineImages:p,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:d=!1,cssCaptured:f=!1}=e,b=ll(t,r);switch(s.nodeType){case s.DOCUMENT_NODE:return s.compatMode!=="CSS1Compat"?{type:j.Document,childNodes:[],compatMode:s.compatMode}:{type:j.Document,childNodes:[]};case s.DOCUMENT_TYPE_NODE:return{type:j.DocumentType,name:s.name,publicId:s.publicId,systemId:s.systemId,rootId:b};case s.ELEMENT_NODE:return cl(s,{doc:t,blockClass:i,blockSelector:n,inlineStylesheet:l,maskInputOptions:a,maskInputFn:c,dataURLOptions:h,inlineImages:p,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:d,rootId:b});case s.TEXT_NODE:return ul(s,{doc:t,needsMask:o,maskTextFn:u,rootId:b,cssCaptured:f});case s.CDATA_SECTION_NODE:return{type:j.CDATA,textContent:"",rootId:b};case s.COMMENT_NODE:return{type:j.Comment,textContent:Y.textContent(s)||"",rootId:b};default:return!1}}function ll(s,e){if(!e.hasNode(s))return;let t=e.getId(s);return t===1?void 0:t}function ul(s,e){let{needsMask:t,maskTextFn:r,rootId:i,cssCaptured:n}=e,o=Y.parentNode(s),l=o&&o.tagName,a="",u=l==="STYLE"?!0:void 0,c=l==="SCRIPT"?!0:void 0;return c?a="SCRIPT_PLACEHOLDER":n||(a=Y.textContent(s),u&&a&&(a=Ht(a,Os(e.doc)))),!u&&!c&&a&&t&&(a=r?r(a,Y.parentElement(s)):a.replace(/[\\S]/g,"*")),{type:j.Text,textContent:a||"",rootId:i}}function cl(s,e){let{doc:t,blockClass:r,blockSelector:i,inlineStylesheet:n,maskInputOptions:o={},maskInputFn:l,dataURLOptions:a={},inlineImages:u,recordCanvas:c,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:g}=e,m=il(s,r,i),d=qa(s),f={},b=s.attributes.length;for(let y=0;y<b;y++){let v=s.attributes[y];fn(d,v.name,v.value)||(f[v.name]=hn(t,d,Se(v.name),v.value))}if(d==="link"&&n){let y=Array.from(t.styleSheets).find(N=>N.href===s.href),v=null;y&&(v=Br(y)),v&&(delete f.rel,delete f.href,f._cssText=v)}if(d==="style"&&s.sheet){let y=Br(s.sheet);y&&(s.childNodes.length>1&&(y=Ja(y,s)),f._cssText=y)}if(["input","textarea","select"].includes(d)){let y=s.value,v=s.checked;f.type!=="radio"&&f.type!=="checkbox"&&f.type!=="submit"&&f.type!=="button"&&y?f.value=Gt({element:s,type:jt(s),tagName:d,value:y,maskInputOptions:o,maskInputFn:l}):v&&(f.checked=v)}if(d==="option"&&(s.selected&&!o.select?f.selected=!0:delete f.selected),d==="dialog"&&s.open&&(f.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal"),d==="canvas"&&c){if(s.__context==="2d")Va(s)||(f.rr_dataURL=s.toDataURL(a.type,a.quality));else if(!("__context"in s)){let y=s.toDataURL(a.type,a.quality),v=t.createElement("canvas");v.width=s.width,v.height=s.height;let N=v.toDataURL(a.type,a.quality);y!==N&&(f.rr_dataURL=y)}}if(d==="img"&&u){Ie||(Ie=t.createElement("canvas"),fi=Ie.getContext("2d"));let y=s,v=y.currentSrc||y.getAttribute("src")||"<unknown-src>",N=y.crossOrigin,T=()=>{y.removeEventListener("load",T);try{Ie.width=y.naturalWidth,Ie.height=y.naturalHeight,fi.drawImage(y,0,0),f.rr_dataURL=Ie.toDataURL(a.type,a.quality)}catch(V){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?T():y.addEventListener("load",T);return}else console.warn(`Cannot inline img src=${v}! Error: ${V}`)}y.crossOrigin==="anonymous"&&(N?f.crossOrigin=N:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?T():y.addEventListener("load",T)}if(["audio","video"].includes(d)){let y=f;y.rr_mediaState=s.paused?"paused":"played",y.rr_mediaCurrentTime=s.currentTime,y.rr_mediaPlaybackRate=s.playbackRate,y.rr_mediaMuted=s.muted,y.rr_mediaLoop=s.loop,y.rr_mediaVolume=s.volume}if(p||(s.scrollLeft&&(f.rr_scrollLeft=s.scrollLeft),s.scrollTop&&(f.rr_scrollTop=s.scrollTop)),m){let{width:y,height:v}=s.getBoundingClientRect();f={class:f.class,rr_width:`${y}px`,rr_height:`${v}px`}}d==="iframe"&&!h(f.src)&&(s.contentDocument||(f.rr_src=f.src),delete f.src);let S;try{customElements.get(d)&&(S=!0)}catch{}return{type:j.Element,tagName:d,attributes:f,childNodes:[],isSVG:sl(s)||void 0,needBlock:m,rootId:g,isCustom:S}}function _(s){return s==null?"":s.toLowerCase()}function pn(s){return s===!0||s==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:s==="all",headMetaDescKeywords:s==="all",headTitleMutations:s==="all"}:s||{}}function hl(s,e){if(e.comment&&s.type===j.Comment)return!0;if(s.type===j.Element){if(e.script&&(s.tagName==="script"||s.tagName==="link"&&(s.attributes.rel==="preload"&&s.attributes.as==="script"||s.attributes.rel==="modulepreload")||s.tagName==="link"&&s.attributes.rel==="prefetch"&&typeof s.attributes.href=="string"&&un(s.attributes.href)==="js"))return!0;if(e.headFavicon&&(s.tagName==="link"&&s.attributes.rel==="shortcut icon"||s.tagName==="meta"&&(_(s.attributes.name).match(/^msapplication-tile(image|color)$/)||_(s.attributes.name)==="application-name"||_(s.attributes.rel)==="icon"||_(s.attributes.rel)==="apple-touch-icon"||_(s.attributes.rel)==="shortcut icon")))return!0;if(s.tagName==="meta"){if(e.headMetaDescKeywords&&_(s.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(_(s.attributes.property).match(/^(og|twitter|fb):/)||_(s.attributes.name).match(/^(og|twitter):/)||_(s.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(_(s.attributes.name)==="robots"||_(s.attributes.name)==="googlebot"||_(s.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&s.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(_(s.attributes.name)==="author"||_(s.attributes.name)==="generator"||_(s.attributes.name)==="framework"||_(s.attributes.name)==="publisher"||_(s.attributes.name)==="progid"||_(s.attributes.property).match(/^article:/)||_(s.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(_(s.attributes.name)==="google-site-verification"||_(s.attributes.name)==="yandex-verification"||_(s.attributes.name)==="csrf-token"||_(s.attributes.name)==="p:domain_verify"||_(s.attributes.name)==="verify-v1"||_(s.attributes.name)==="verification"||_(s.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Re(s,e){let{doc:t,mirror:r,blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m={},inlineImages:d=!1,recordCanvas:f=!1,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:N=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:V=!1,cssCaptured:$=!1}=e,{needsMask:z}=e,{preserveWhiteSpace:H=!0}=e;z||(z=dn(s,o,l,z===void 0));let Q=al(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:z,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,dataURLOptions:m,inlineImages:d,recordCanvas:f,keepIframeSrcFn:T,newlyAddedElement:V,cssCaptured:$});if(!Q)return console.warn(s,"not serialized"),null;let ne;r.hasNode(s)?ne=r.getId(s):hl(Q,g)||!H&&Q.type===j.Text&&!Q.textContent.replace(/^\\s+|\\s+$/gm,"").length?ne=Je:ne=cn();let M=Object.assign(Q,{id:ne});if(r.add(s,M),ne===Je)return null;b&&b(s);let Fe=!a;if(M.type===j.Element){Fe=Fe&&!M.needBlock,delete M.needBlock;let G=Y.shadowRoot(s);G&&Ze(G)&&(M.isShadowHost=!0)}if((M.type===j.Document||M.type===j.Element)&&Fe){g.headWhitespace&&M.type===j.Element&&M.tagName==="head"&&(H=!1);let G={doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m,inlineImages:d,recordCanvas:f,preserveWhiteSpace:H,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:N,keepIframeSrcFn:T,cssCaptured:!1};if(!(M.type===j.Element&&M.tagName==="textarea"&&M.attributes.value!==void 0)){M.type===j.Element&&M.attributes._cssText!==void 0&&typeof M.attributes._cssText=="string"&&(G.cssCaptured=!0);for(let ge of Array.from(Y.childNodes(s))){let oe=Re(ge,G);oe&&M.childNodes.push(oe)}}let q=null;if(an(s)&&(q=Y.shadowRoot(s)))for(let ge of Array.from(Y.childNodes(q))){let oe=Re(ge,G);oe&&(Ze(q)&&(oe.isShadow=!0),M.childNodes.push(oe))}}let Ue=Y.parentNode(s);return Ue&&Ye(Ue)&&Ze(Ue)&&(M.isShadow=!0),M.type===j.Element&&M.tagName==="iframe"&&nl(s,()=>{let G=s.contentDocument;if(G&&S){let q=Re(G,{doc:G,mirror:r,blockClass:i,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m,inlineImages:d,recordCanvas:f,preserveWhiteSpace:H,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:N,keepIframeSrcFn:T});q&&S(s,q)}},y),M.type===j.Element&&M.tagName==="link"&&typeof M.attributes.rel=="string"&&(M.attributes.rel==="stylesheet"||M.attributes.rel==="preload"&&typeof M.attributes.href=="string"&&un(M.attributes.href)==="css")&&ol(s,()=>{if(v){let G=Re(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m,inlineImages:d,recordCanvas:f,preserveWhiteSpace:H,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:N,keepIframeSrcFn:T});G&&v(s,G)}},N),M}function fl(s,e){let{mirror:t=new Vt,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:n="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:h,maskInputFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:d,onSerialize:f,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:N=()=>!1}=e||{},T=c===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:c===!1?{password:!0}:c,V=pn(g);return Re(s,{doc:s,mirror:t,blockClass:r,blockSelector:i,maskTextClass:n,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:T,maskTextFn:h,maskInputFn:p,slimDOMOptions:V,dataURLOptions:m,inlineImages:a,recordCanvas:u,preserveWhiteSpace:d,onSerialize:f,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:N,newlyAddedElement:!1})}var dl=/(max|min)-device-(width|height)/,ud=new RegExp(dl.source,"g");function pl(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function ml(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var Ds={exports:{}},k=String,mn=function(){return{isColorSupported:!1,reset:k,bold:k,dim:k,italic:k,underline:k,inverse:k,hidden:k,strikethrough:k,black:k,red:k,green:k,yellow:k,blue:k,magenta:k,cyan:k,white:k,gray:k,bgBlack:k,bgRed:k,bgGreen:k,bgYellow:k,bgBlue:k,bgMagenta:k,bgCyan:k,bgWhite:k}};Ds.exports=mn();Ds.exports.createColors=mn;var gl=Ds.exports,yl={},wl=Object.freeze(Object.defineProperty({__proto__:null,default:yl},Symbol.toStringTag,{value:"Module"})),se=ml(wl),pi=gl,mi=se,Wr=class gn extends Error{constructor(e,t,r,i,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),typeof t<"u"&&typeof r<"u"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,gn)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=pi.isColorSupported),mi&&e&&(t=mi(t));let r=t.split(/\\r?\\n/),i=Math.max(this.line-3,0),n=Math.min(this.line+2,r.length),o=String(n).length,l,a;if(e){let{bold:u,gray:c,red:h}=pi.createColors(!0);l=p=>u(h(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(i,n).map((u,c)=>{let h=i+1+c,p=" "+(" "+h).slice(-o)+" | ";if(h===this.line){let g=a(p.replace(/\\d/g," "))+u.slice(0,this.column-1).replace(/[^\\t]/g," ");return l(">")+a(p)+u+`\n `+g+l("^")}return" "+a(p)+u}).join(`\n`)}toString(){let e=this.showSourceCode();return e&&(e=`\n\n`+e+`\n`),this.name+": "+this.message+e}},Ts=Wr;Wr.default=Wr;var ot={};ot.isClean=Symbol("isClean");ot.my=Symbol("my");var gi={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function bl(s){return s[0].toUpperCase()+s.slice(1)}var zr=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,i=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?r+=e.raws.afterName:i&&(r+=" "),e.nodes)this.block(e,r+i);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+i+n,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let i=e.parent,n=0;for(;i&&i.type!=="root";)n+=1,i=i.parent;if(r.includes(`\n`)){let o=this.raw(e,null,"indent");if(o.length)for(let l=0;l<n;l++)r+=o}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let i;e.nodes&&e.nodes.length?(this.body(e),i=this.raw(e,"after")):i=this.raw(e,"after","emptyBody"),i&&this.builder(i),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let i=0;i<e.nodes.length;i++){let n=e.nodes[i],o=this.raw(n,"before");o&&this.builder(o),this.stringify(n,t!==i||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),i=e.prop+r+this.rawValue(e,"value");e.important&&(i+=e.raws.important||" !important"),t&&(i+=";"),this.builder(i,e)}document(e){this.body(e)}raw(e,t,r){let i;if(r||(r=t),t&&(i=e.raws[t],typeof i<"u"))return i;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return gi[r];let o=e.root();if(o.rawCache||(o.rawCache={}),typeof o.rawCache[r]<"u")return o.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let l="raw"+bl(r);this[l]?i=this[l](o,e):o.walk(a=>{if(i=a.raws[t],typeof i<"u")return!1})}return typeof i>"u"&&(i=gi[r]),o.rawCache[r]=i,i}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return t=r.raws.after,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before<"u")return t=r.raws.before,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between<"u")return t=r.raws.between.replace(/[^\\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let i=r.parent;if(i&&i!==e&&i.parent&&i.parent===e&&typeof r.raws.before<"u"){let n=r.raws.before.split(`\n`);return t=n[n.length-1],t=t.replace(/\\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let r=e[t],i=e.raws[t];return i&&i.value===r?i.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}},yn=zr;zr.default=zr;var Sl=yn;function Vr(s,e){new Sl(e).stringify(s)}var or=Vr;Vr.default=Vr;var{isClean:gt,my:vl}=ot,Cl=Ts,El=yn,Il=or;function Gr(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let i=s[r],n=typeof i;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>Gr(o,t)):(n==="object"&&i!==null&&(i=Gr(i)),t[r]=i)}return t}var jr=class{constructor(e={}){this.raws={},this[gt]=!1,this[vl]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\\n\\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\\n\\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Gr(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:i}=this.rangeBy(t);return this.source.input.error(e,{column:i.column,line:i.line},{column:r.column,line:r.line},t)}return new Cl(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[gt]){this[gt]=!1;let e=this;for(;e=e.parent;)e[gt]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let i=t.indexOf(e.word);i!==-1&&(r=this.positionInside(i,t))}return r}positionInside(e,t){let r=t||this.toString(),i=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)r[o]===`\n`?(i=1,n+=1):i+=1;return{column:i,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let i=this.toString(),n=i.indexOf(e.word);n!==-1&&(t=this.positionInside(n,i),r=this.positionInside(n+e.word.length,i))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new El().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let i of e)i===this?r=!0:r?(this.parent.insertAfter(t,i),t=i):this.parent.insertBefore(t,i);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},i=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let l=this[o];if(Array.isArray(l))r[o]=l.map(a=>typeof a=="object"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l=="object"&&l.toJSON)r[o]=l.toJSON(null,t);else if(o==="source"){let a=t.get(l.input);a==null&&(a=n,t.set(l.input,n),n++),r[o]={end:l.end,inputId:a,start:l.start}}else r[o]=l}return i&&(r.inputs=[...t.keys()].map(o=>o.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=Il){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let i={node:this};for(let n in r)i[n]=r[n];return e.warn(t,i)}get proxyOf(){return this}},ar=jr;jr.default=jr;var xl=ar,Hr=class extends xl{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},lr=Hr;Hr.default=Hr;var Ml="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Nl=(s,e=21)=>(t=e)=>{let r="",i=t;for(;i--;)r+=s[Math.random()*s.length|0];return r},Rl=(s=21)=>{let e="",t=s;for(;t--;)e+=Ml[Math.random()*64|0];return e},Al={nanoid:Rl,customAlphabet:Nl},{SourceMapConsumer:yi,SourceMapGenerator:wi}=se,{existsSync:Ol,readFileSync:Dl}=se,{dirname:Rr,join:Tl}=se;function _l(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}var Yr=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Rr(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new yi(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\\/json;charset=utf-?8;base64,/,r=/^data:application\\/json;base64,/,i=/^data:application\\/json;charset=utf-?8,/,n=/^data:application\\/json,/;if(i.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return _l(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\\/\\*\\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\\/\\*\\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),i=e.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,i)))}loadFile(e){if(this.root=Rr(e),Ol(e))return this.mapFile=e,Dl(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(t instanceof yi)return wi.fromSourceMap(t).toString();if(t instanceof wi)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=Tl(Rr(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},wn=Yr;Yr.default=Yr;var{SourceMapConsumer:kl,SourceMapGenerator:Pl}=se,{fileURLToPath:bi,pathToFileURL:yt}=se,{isAbsolute:Zr,resolve:Xr}=se,{nanoid:$l}=Al,Ar=se,Si=Ts,Ll=wn,Or=Symbol("fromOffsetCache"),Fl=!!(kl&&Pl),vi=!!(Xr&&Zr),Zt=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\\uFEFF"||this.css[0]==="\\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!vi||/^\\w+:\\/\\//.test(t.from)||Zr(t.from)?this.file=t.from:this.file=Xr(t.from)),vi&&Fl){let r=new Ll(this.css,t);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+$l(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let n,o,l;if(t&&typeof t=="object"){let u=t,c=r;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);t=h.line,r=h.col}else t=u.line,r=u.column;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);o=h.line,l=h.col}else o=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,o,l);return a?n=new Si(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,i.plugin):n=new Si(e,o===void 0?t:{column:r,line:t},o===void 0?r:{column:l,line:o},this.css,this.file,i.plugin),n.input={column:r,endColumn:l,endLine:o,line:t,source:this.css},this.file&&(yt&&(n.input.url=yt(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[Or])r=this[Or];else{let n=this.css.split(`\n`);r=new Array(n.length);let o=0;for(let l=0,a=n.length;l<a;l++)r[l]=o,o+=n[l].length+1;this[Or]=r}t=r[r.length-1];let i=0;if(e>=t)i=r.length-1;else{let n=r.length-2,o;for(;i<n;)if(o=i+(n-i>>1),e<r[o])n=o-1;else if(e>=r[o+1])i=o+1;else{i=o;break}}return{col:e-r[i]+1,line:i+1}}mapResolve(e){return/^\\w+:\\/\\//.test(e)?e:Xr(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,i){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let l;typeof r=="number"&&(l=n.originalPositionFor({column:i,line:r}));let a;Zr(o.source)?a=yt(o.source):a=new URL(o.source,this.map.consumer().sourceRoot||yt(this.map.mapFile));let u={column:o.column,endColumn:l&&l.column,endLine:l&&l.line,line:o.line,url:a.toString()};if(a.protocol==="file:")if(bi)u.file=bi(a);else throw new Error("file: protocol is not available in this PostCSS build");let c=n.sourceContentFor(o.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},ur=Zt;Zt.default=Zt;Ar&&Ar.registerInput&&Ar.registerInput(Zt);var{SourceMapConsumer:bn,SourceMapGenerator:Lt}=se,{dirname:Ft,relative:Sn,resolve:vn,sep:Cn}=se,{pathToFileURL:Ci}=se,Ul=ur,Bl=!!(bn&&Lt),Wl=!!(Ft&&vn&&Sn&&Cn),zl=class{constructor(e,t,r,i){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`\n`;this.css.includes(`\\r\n`)&&(t=`\\r\n`),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||Ft(e.file),i;this.mapOpts.sourcesContent===!1?(i=new bn(e.text),i.sourcesContent&&(i.sourcesContent=null)):i=e.consumer(),this.map.applySourceMap(i,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\\n*?\\/\\*#[\\S\\s]*?\\*\\/$/gm,""))}generate(){if(this.clearAnnotation(),Wl&&Bl&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Lt.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Lt({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Lt({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!=="end"&&(i.generated.line=e,i.generated.column=t-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),n=l.match(/\\n/g),n?(e+=n.length,o=l.lastIndexOf(`\n`),t=l.length-o):t+=l.length,a&&u!=="start"){let c=a.parent||{raws:{}};(!(a.type==="decl"||a.type==="atrule"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=e,i.generated.column=t-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=e,i.generated.column=t-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\\w+:\\/\\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Ft(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Ft(vn(r,this.mapOpts.annotation)));let i=Sn(r,e);return this.memoizedPaths.set(e,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Ul(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Ci){let r=Ci(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;Cn==="\\\\"&&(e=e.replace(/\\\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},En=zl,Vl=ar,Jr=class extends Vl{constructor(e){super(e),this.type="comment"}},cr=Jr;Jr.default=Jr;var{isClean:In,my:xn}=ot,Mn=lr,Nn=cr,Gl=ar,Rn,_s,ks,An;function On(s){return s.map(e=>(e.nodes&&(e.nodes=On(e.nodes)),delete e.source,e))}function Dn(s){if(s[In]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)Dn(e)}var ce=class Tn extends Gl{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,i;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],i=e(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[t]+=1;return delete this.indexes[t],i}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(i=>typeof i=="function"?(n,o)=>i(n.toProxy(),o):i)):t==="every"||t==="some"?r=>e[t]((i,...n)=>r(i.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),i=r===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let l of n)this.proxyOf.nodes.splice(r,0,l);let o;for(let l in this.indexes)o=this.indexes[l],r<=o&&(this.indexes[l]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=On(Rn(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new Mn(e)]}else if(e.selector)e=[new _s(e)];else if(e.name)e=[new ks(e)];else if(e.text)e=[new Nn(e)];else throw new Error("Unknown node type in node creation");return e.map(i=>(i[xn]||Tn.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[In]&&Dn(i),typeof i.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(i.raws.before=t.raws.before.replace(/\\S/g,"")),i.parent=this.proxyOf,i))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(i=>{t.props&&!t.props.includes(i.prop)||t.fast&&!i.value.includes(t.fast)||(i.value=i.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let i;try{i=e(t,r)}catch(n){throw t.addToError(n)}return i!==!1&&t.walk&&(i=t.walk(e)),i})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="atrule")return t(r,i)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="decl")return t(r,i)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&e.test(r.selector))return t(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="rule")return t(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};ce.registerParse=s=>{Rn=s};ce.registerRule=s=>{_s=s};ce.registerAtRule=s=>{ks=s};ce.registerRoot=s=>{An=s};var ve=ce;ce.default=ce;ce.rebuild=s=>{s.type==="atrule"?Object.setPrototypeOf(s,ks.prototype):s.type==="rule"?Object.setPrototypeOf(s,_s.prototype):s.type==="decl"?Object.setPrototypeOf(s,Mn.prototype):s.type==="comment"?Object.setPrototypeOf(s,Nn.prototype):s.type==="root"&&Object.setPrototypeOf(s,An.prototype),s[xn]=!0,s.nodes&&s.nodes.forEach(e=>{ce.rebuild(e)})};var jl=ve,_n,kn,Ke=class extends jl{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new _n(new kn,this,e).stringify()}};Ke.registerLazyResult=s=>{_n=s};Ke.registerProcessor=s=>{kn=s};var Ps=Ke;Ke.default=Ke;var Kr=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},Pn=Kr;Kr.default=Kr;var Hl=Pn,Qr=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new Hl(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}},$s=Qr;Qr.default=Qr;var Dr=39,Ei=34,wt=92,Ii=47,bt=10,ze=32,St=12,vt=9,Ct=13,Yl=91,Zl=93,Xl=40,Jl=41,Kl=123,Ql=125,ql=59,eu=42,tu=58,ru=64,Et=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,It=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,su=/.[\\r\\n"\'(/\\\\]/,xi=/[\\da-f]/i,iu=function(e,t={}){let r=e.css.valueOf(),i=t.ignoreErrors,n,o,l,a,u,c,h,p,g,m,d=r.length,f=0,b=[],S=[];function y(){return f}function v($){throw e.error("Unclosed "+$,f)}function N(){return S.length===0&&f>=d}function T($){if(S.length)return S.pop();if(f>=d)return;let z=$?$.ignoreUnclosed:!1;switch(n=r.charCodeAt(f),n){case bt:case ze:case vt:case Ct:case St:{o=f;do o+=1,n=r.charCodeAt(o);while(n===ze||n===bt||n===vt||n===Ct||n===St);m=["space",r.slice(f,o)],f=o-1;break}case Yl:case Zl:case Kl:case Ql:case tu:case ql:case Jl:{let H=String.fromCharCode(n);m=[H,H,f];break}case Xl:{if(p=b.length?b.pop()[1]:"",g=r.charCodeAt(f+1),p==="url"&&g!==Dr&&g!==Ei&&g!==ze&&g!==bt&&g!==vt&&g!==St&&g!==Ct){o=f;do{if(c=!1,o=r.indexOf(")",o+1),o===-1)if(i||z){o=f;break}else v("bracket");for(h=o;r.charCodeAt(h-1)===wt;)h-=1,c=!c}while(c);m=["brackets",r.slice(f,o+1),f,o],f=o}else o=r.indexOf(")",f+1),a=r.slice(f,o+1),o===-1||su.test(a)?m=["(","(",f]:(m=["brackets",a,f,o],f=o);break}case Dr:case Ei:{l=n===Dr?"\'":\'"\',o=f;do{if(c=!1,o=r.indexOf(l,o+1),o===-1)if(i||z){o=f+1;break}else v("string");for(h=o;r.charCodeAt(h-1)===wt;)h-=1,c=!c}while(c);m=["string",r.slice(f,o+1),f,o],f=o;break}case ru:{Et.lastIndex=f+1,Et.test(r),Et.lastIndex===0?o=r.length-1:o=Et.lastIndex-2,m=["at-word",r.slice(f,o+1),f,o],f=o;break}case wt:{for(o=f,u=!0;r.charCodeAt(o+1)===wt;)o+=1,u=!u;if(n=r.charCodeAt(o+1),u&&n!==Ii&&n!==ze&&n!==bt&&n!==vt&&n!==Ct&&n!==St&&(o+=1,xi.test(r.charAt(o)))){for(;xi.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===ze&&(o+=1)}m=["word",r.slice(f,o+1),f,o],f=o;break}default:{n===Ii&&r.charCodeAt(f+1)===eu?(o=r.indexOf("*/",f+2)+1,o===0&&(i||z?o=r.length:v("comment")),m=["comment",r.slice(f,o+1),f,o],f=o):(It.lastIndex=f+1,It.test(r),It.lastIndex===0?o=r.length-1:o=It.lastIndex-2,m=["word",r.slice(f,o+1),f,o],b.push(m),f=o);break}}return f++,m}function V($){S.push($)}return{back:V,endOfFile:N,nextToken:T,position:y}},$n=ve,Xt=class extends $n{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},Ls=Xt;Xt.default=Xt;$n.registerAtRule(Xt);var Ln=ve,Fn,Un,Oe=class extends Ln{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let i=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of i)n.raws.before=t.raws.before}return i}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new Fn(new Un,this,e).stringify()}};Oe.registerLazyResult=s=>{Fn=s};Oe.registerProcessor=s=>{Un=s};var at=Oe;Oe.default=Oe;Ln.registerRoot(Oe);var Qe={comma(s){return Qe.split(s,[","],!0)},space(s){let e=[" ",`\n`," "];return Qe.split(s,e)},split(s,e,t){let r=[],i="",n=!1,o=0,l=!1,a="",u=!1;for(let c of s)u?u=!1:c==="\\\\"?u=!0:l?c===a&&(l=!1):c===\'"\'||c==="\'"?(l=!0,a=c):c==="("?o+=1:c===")"?o>0&&(o-=1):o===0&&e.includes(c)&&(n=!0),n?(i!==""&&r.push(i.trim()),i="",n=!1):i+=c;return(t||i!=="")&&r.push(i.trim()),r}},Bn=Qe;Qe.default=Qe;var Wn=ve,nu=Bn,Jt=class extends Wn{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return nu.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}},Fs=Jt;Jt.default=Jt;Wn.registerRule(Jt);var ou=lr,au=iu,lu=cr,uu=Ls,cu=at,Mi=Fs,Ni={empty:!0,space:!0};function hu(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var fu=class{constructor(e){this.input=e,this.root=new cu,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new uu;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,i,n,o=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(a.length>0){for(n=a.length-1,i=a[n];i&&i[0]==="space";)i=a[--n];i&&(t.source.end=this.getPosition(i[3]||i[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,"params",a),o&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,i;for(let n=t-1;n>=0&&(i=e[n],!(i[0]!=="space"&&(r+=1,r===2)));n--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(e){let t=0,r,i,n;for(let[o,l]of e.entries()){if(r=l,i=r[0],i==="("&&(t+=1),i===")"&&(t-=1),t===0&&i===":")if(!n)this.doubleColon(r);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=r}return!1}comment(e){let t=new lu;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let i=r.match(/^(\\s*)([^]*\\S)(\\s*)$/);t.text=i[2],t.raws.left=i[1],t.raws.right=i[3]}}createTokenizer(){this.tokenizer=au(this.input)}decl(e,t){let r=new ou;this.init(r,e[0][2]);let i=e[e.length-1];for(i[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||hu(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let u=e[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=e.shift()[1]}r.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){r.raws.between+=n[1];break}else n[0]==="word"&&/\\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let o=[],l;for(;e.length&&(l=e[0][0],!(l!=="space"&&l!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(n=e[u],n[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==" !important"&&(r.raws.important=c);break}else if(n[1].toLowerCase()==="important"){let c=e.slice(0),h="";for(let p=u;p>0;p--){let g=c[p][0];if(h.trim().indexOf("!")===0&&g!=="space")break;h=c.pop()[1]+h}h.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=h,e=c)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=o.map(u=>u[1]).join(""),o=[]),this.raw(r,"value",o.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new Mi;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,i=!1,n=null,o=[],l=e[1].startsWith("--"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r==="("||r==="[")n||(n=u),o.push(r==="("?")":"]");else if(l&&i&&r==="{")n||(n=u),o.push("}");else if(o.length===0)if(r===";")if(i){this.decl(a,l);return}else break;else if(r==="{"){this.rule(a);return}else if(r==="}"){this.tokenizer.back(a.pop()),t=!0;break}else r===":"&&(i=!0);else r===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&i){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,i){let n,o,l=r.length,a="",u=!0,c,h;for(let p=0;p<l;p+=1)n=r[p],o=n[0],o==="space"&&p===l-1&&!i?u=!1:o==="comment"?(h=r[p-1]?r[p-1][0]:"empty",c=r[p+1]?r[p+1][0]:"empty",!Ni[h]&&!Ni[c]?a.slice(-1)===","?u=!1:a+=n[1]:u=!1):a+=n[1];if(!u){let p=r.reduce((g,m)=>g+m[1],"");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new Mi;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let i=t;i<e.length;i++)r+=e[i][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},du=fu,pu=ve,mu=du,gu=ur;function Kt(s,e){let t=new gu(s,e),r=new mu(t);try{r.parse()}catch(i){throw i}return r.root}var Us=Kt;Kt.default=Kt;pu.registerParse(Kt);var{isClean:ae,my:yu}=ot,wu=En,bu=or,Su=ve,vu=Ps;var Ri=$s,Cu=Us,Eu=at,Iu={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},xu={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Mu={Once:!0,postcssPlugin:!0,prepare:!0},De=0;function Ve(s){return typeof s=="object"&&typeof s.then=="function"}function zn(s){let e=!1,t=Iu[s.type];return s.type==="decl"?e=s.prop.toLowerCase():s.type==="atrule"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+"-"+e,De,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:s.append?[t,De,t+"Exit"]:[t,t+"Exit"]}function Ai(s){let e;return s.type==="document"?e=["Document",De,"DocumentExit"]:s.type==="root"?e=["Root",De,"RootExit"]:e=zn(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function qr(s){return s[ae]=!1,s.nodes&&s.nodes.forEach(e=>qr(e)),s}var es={},Te=class Vn{constructor(e,t,r){this.stringified=!1,this.processed=!1;let i;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))i=qr(t);else if(t instanceof Vn||t instanceof Ri)i=qr(t.root),t.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let n=Cu;r.syntax&&(n=r.syntax.parse),r.parser&&(n=r.parser),n.parse&&(n=n.parse);try{i=n(t,r)}catch(o){this.processed=!0,this.error=o}i&&!i[yu]&&Su.rebuild(i)}this.result=new Ri(e,i,r),this.helpers={...es,postcss:es,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin?(e.plugin=r.postcssPlugin,e.setMessage()):r.postcssVersion}catch(i){console&&console.error&&console.error(i)}return e}prepareVisitors(){this.listeners={};let e=(t,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,i])};for(let t of this.plugins)if(typeof t=="object")for(let r in t){if(!xu[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Mu[r])if(typeof t[r]=="object")for(let i in t[r])i==="*"?e(t,r,t[r][i]):e(t,r+"-"+i.toLowerCase(),t[r][i]);else typeof t[r]=="function"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(Ve(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ae];){e[ae]=!0;let t=[Ai(e)];for(;t.length>0;){let r=this.visitTick(t);if(Ve(r))try{await r}catch(i){let n=t[t.length-1].node;throw this.handleError(i,n)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let i=e.nodes.map(n=>r(n,this.helpers));await Promise.all(i)}else await r(e,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return Ve(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=bu;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new wu(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(Ve(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ae];)e[ae]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,i]of e){this.result.lastPlugin=r;let n;try{n=i(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(Ve(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:i}=t;if(r.type!=="root"&&r.type!=="document"&&!r.parent){e.pop();return}if(i.length>0&&t.visitorIndex<i.length){let[o,l]=i[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===i.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let o=t.iterator,l;for(;l=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!l[ae]){l[ae]=!0,e.push(Ai(l));return}t.iterator=0,delete r.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===De){r.nodes&&r.nodes.length&&(r[ae]=!0,t.iterator=r.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[ae]=!0;let t=zn(e);for(let r of t)if(r===De)e.nodes&&e.each(i=>{i[ae]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Te.registerPostcss=s=>{es=s};var Gn=Te;Te.default=Te;Eu.registerLazyResult(Te);vu.registerLazyResult(Te);var Nu=En,Ru=or;var Au=Us,Ou=$s,ts=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let i,n=Ru;this.result=new Ou(this._processor,i,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let l=new Nu(n,i,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Au;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}},Du=ts;ts.default=ts;var Tu=Du,_u=Gn,ku=Ps,Pu=at,qe=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Tu(this,e,t):new _u(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},$u=qe;qe.default=qe;Pu.registerProcessor(qe);ku.registerProcessor(qe);var Lu=lr,Fu=wn,Uu=cr,Bu=Ls,Wu=ur,zu=at,Vu=Fs;function et(s,e){if(Array.isArray(s))return s.map(i=>et(i));let{inputs:t,...r}=s;if(t){e=[];for(let i of t){let n={...i,__proto__:Wu.prototype};n.map&&(n.map={...n.map,__proto__:Fu.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=s.nodes.map(i=>et(i,e))),r.source){let{inputId:i,...n}=r.source;r.source=n,i!=null&&(r.source.input=e[i])}if(r.type==="root")return new zu(r);if(r.type==="decl")return new Lu(r);if(r.type==="rule")return new Vu(r);if(r.type==="comment")return new Uu(r);if(r.type==="atrule")return new Bu(r);throw new Error("Unknown node type: "+s.type)}var Gu=et;et.default=et;var ju=Ts,jn=lr,Hu=Gn,Yu=ve,Bs=$u,Zu=or,Xu=Gu,Hn=Ps,Ju=Pn,Yn=cr,Zn=Ls,Ku=$s,Qu=ur,qu=Us,ec=Bn,Xn=Fs,Jn=at,tc=ar;function A(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new Bs(s)}A.plugin=function(e,t){let r=!1;function i(...o){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\nhttps://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new Bs().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return A([i(a)]).process(o,l)},i};A.stringify=Zu;A.parse=qu;A.fromJSON=Xu;A.list=ec;A.comment=s=>new Yn(s);A.atRule=s=>new Zn(s);A.decl=s=>new jn(s);A.rule=s=>new Xn(s);A.root=s=>new Jn(s);A.document=s=>new Hn(s);A.CssSyntaxError=ju;A.Declaration=jn;A.Container=Yu;A.Processor=Bs;A.Document=Hn;A.Comment=Yn;A.Warning=Ju;A.AtRule=Zn;A.Result=Ku;A.Input=Qu;A.Rule=Xn;A.Root=Jn;A.Node=tc;Hu.registerPostcss(A);var rc=A;A.default=A;var L=pl(rc);L.stringify;L.fromJSON;L.plugin;L.parse;L.list;L.document;L.comment;L.atRule;L.rule;L.decl;L.root;L.CssSyntaxError;L.Declaration;L.Container;L.Processor;L.Document;L.Comment;L.Warning;L.AtRule;L.Result;L.Input;L.Rule;L.Root;L.Node;var sc=Object.defineProperty,ic=(s,e,t)=>e in s?sc(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,ee=(s,e,t)=>ic(s,typeof e!="symbol"?e+"":e,t);function nc(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function oc(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var Ws={exports:{}},P=String,Kn=function(){return{isColorSupported:!1,reset:P,bold:P,dim:P,italic:P,underline:P,inverse:P,hidden:P,strikethrough:P,black:P,red:P,green:P,yellow:P,blue:P,magenta:P,cyan:P,white:P,gray:P,bgBlack:P,bgRed:P,bgGreen:P,bgYellow:P,bgBlue:P,bgMagenta:P,bgCyan:P,bgWhite:P}};Ws.exports=Kn();Ws.exports.createColors=Kn;var ac=Ws.exports,lc={},uc=Object.freeze(Object.defineProperty({__proto__:null,default:lc},Symbol.toStringTag,{value:"Module"})),ie=oc(uc),Oi=ac,Di=ie,rs=class Qn extends Error{constructor(e,t,r,i,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),typeof t<"u"&&typeof r<"u"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Qn)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=Oi.isColorSupported),Di&&e&&(t=Di(t));let r=t.split(/\\r?\\n/),i=Math.max(this.line-3,0),n=Math.min(this.line+2,r.length),o=String(n).length,l,a;if(e){let{bold:u,gray:c,red:h}=Oi.createColors(!0);l=p=>u(h(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(i,n).map((u,c)=>{let h=i+1+c,p=" "+(" "+h).slice(-o)+" | ";if(h===this.line){let g=a(p.replace(/\\d/g," "))+u.slice(0,this.column-1).replace(/[^\\t]/g," ");return l(">")+a(p)+u+`\n `+g+l("^")}return" "+a(p)+u}).join(`\n`)}toString(){let e=this.showSourceCode();return e&&(e=`\n\n`+e+`\n`),this.name+": "+this.message+e}},zs=rs;rs.default=rs;var lt={};lt.isClean=Symbol("isClean");lt.my=Symbol("my");var Ti={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function cc(s){return s[0].toUpperCase()+s.slice(1)}var ss=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,i=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?r+=e.raws.afterName:i&&(r+=" "),e.nodes)this.block(e,r+i);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+i+n,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let i=e.parent,n=0;for(;i&&i.type!=="root";)n+=1,i=i.parent;if(r.includes(`\n`)){let o=this.raw(e,null,"indent");if(o.length)for(let l=0;l<n;l++)r+=o}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let i;e.nodes&&e.nodes.length?(this.body(e),i=this.raw(e,"after")):i=this.raw(e,"after","emptyBody"),i&&this.builder(i),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let i=0;i<e.nodes.length;i++){let n=e.nodes[i],o=this.raw(n,"before");o&&this.builder(o),this.stringify(n,t!==i||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),i=e.prop+r+this.rawValue(e,"value");e.important&&(i+=e.raws.important||" !important"),t&&(i+=";"),this.builder(i,e)}document(e){this.body(e)}raw(e,t,r){let i;if(r||(r=t),t&&(i=e.raws[t],typeof i<"u"))return i;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return Ti[r];let o=e.root();if(o.rawCache||(o.rawCache={}),typeof o.rawCache[r]<"u")return o.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let l="raw"+cc(r);this[l]?i=this[l](o,e):o.walk(a=>{if(i=a.raws[t],typeof i<"u")return!1})}return typeof i>"u"&&(i=Ti[r]),o.rawCache[r]=i,i}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return t=r.raws.after,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before<"u")return t=r.raws.before,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between<"u")return t=r.raws.between.replace(/[^\\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let i=r.parent;if(i&&i!==e&&i.parent&&i.parent===e&&typeof r.raws.before<"u"){let n=r.raws.before.split(`\n`);return t=n[n.length-1],t=t.replace(/\\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let r=e[t],i=e.raws[t];return i&&i.value===r?i.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}},qn=ss;ss.default=ss;var hc=qn;function is(s,e){new hc(e).stringify(s)}var hr=is;is.default=is;var{isClean:xt,my:fc}=lt,dc=zs,pc=qn,mc=hr;function ns(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let i=s[r],n=typeof i;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>ns(o,t)):(n==="object"&&i!==null&&(i=ns(i)),t[r]=i)}return t}var os=class{constructor(e={}){this.raws={},this[xt]=!1,this[fc]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\\n\\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\\n\\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=ns(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:i}=this.rangeBy(t);return this.source.input.error(e,{column:i.column,line:i.line},{column:r.column,line:r.line},t)}return new dc(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[xt]){this[xt]=!1;let e=this;for(;e=e.parent;)e[xt]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let i=t.indexOf(e.word);i!==-1&&(r=this.positionInside(i,t))}return r}positionInside(e,t){let r=t||this.toString(),i=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)r[o]===`\n`?(i=1,n+=1):i+=1;return{column:i,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let i=this.toString(),n=i.indexOf(e.word);n!==-1&&(t=this.positionInside(n,i),r=this.positionInside(n+e.word.length,i))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new pc().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let i of e)i===this?r=!0:r?(this.parent.insertAfter(t,i),t=i):this.parent.insertBefore(t,i);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},i=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let l=this[o];if(Array.isArray(l))r[o]=l.map(a=>typeof a=="object"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l=="object"&&l.toJSON)r[o]=l.toJSON(null,t);else if(o==="source"){let a=t.get(l.input);a==null&&(a=n,t.set(l.input,n),n++),r[o]={end:l.end,inputId:a,start:l.start}}else r[o]=l}return i&&(r.inputs=[...t.keys()].map(o=>o.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=mc){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let i={node:this};for(let n in r)i[n]=r[n];return e.warn(t,i)}get proxyOf(){return this}},fr=os;os.default=os;var gc=fr,as=class extends gc{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},dr=as;as.default=as;var yc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",wc=(s,e=21)=>(t=e)=>{let r="",i=t;for(;i--;)r+=s[Math.random()*s.length|0];return r},bc=(s=21)=>{let e="",t=s;for(;t--;)e+=yc[Math.random()*64|0];return e},Sc={nanoid:bc,customAlphabet:wc},{SourceMapConsumer:_i,SourceMapGenerator:ki}=ie,{existsSync:vc,readFileSync:Cc}=ie,{dirname:Tr,join:Ec}=ie;function Ic(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}var ls=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Tr(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new _i(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\\/json;charset=utf-?8;base64,/,r=/^data:application\\/json;base64,/,i=/^data:application\\/json;charset=utf-?8,/,n=/^data:application\\/json,/;if(i.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return Ic(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\\/\\*\\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\\/\\*\\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),i=e.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,i)))}loadFile(e){if(this.root=Tr(e),vc(e))return this.mapFile=e,Cc(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(t instanceof _i)return ki.fromSourceMap(t).toString();if(t instanceof ki)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=Ec(Tr(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},eo=ls;ls.default=ls;var{SourceMapConsumer:xc,SourceMapGenerator:Mc}=ie,{fileURLToPath:Pi,pathToFileURL:Mt}=ie,{isAbsolute:us,resolve:cs}=ie,{nanoid:Nc}=Sc,_r=ie,$i=zs,Rc=eo,kr=Symbol("fromOffsetCache"),Ac=!!(xc&&Mc),Li=!!(cs&&us),Qt=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\\uFEFF"||this.css[0]==="\\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Li||/^\\w+:\\/\\//.test(t.from)||us(t.from)?this.file=t.from:this.file=cs(t.from)),Li&&Ac){let r=new Rc(this.css,t);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+Nc(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let n,o,l;if(t&&typeof t=="object"){let u=t,c=r;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);t=h.line,r=h.col}else t=u.line,r=u.column;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);o=h.line,l=h.col}else o=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,o,l);return a?n=new $i(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,i.plugin):n=new $i(e,o===void 0?t:{column:r,line:t},o===void 0?r:{column:l,line:o},this.css,this.file,i.plugin),n.input={column:r,endColumn:l,endLine:o,line:t,source:this.css},this.file&&(Mt&&(n.input.url=Mt(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[kr])r=this[kr];else{let n=this.css.split(`\n`);r=new Array(n.length);let o=0;for(let l=0,a=n.length;l<a;l++)r[l]=o,o+=n[l].length+1;this[kr]=r}t=r[r.length-1];let i=0;if(e>=t)i=r.length-1;else{let n=r.length-2,o;for(;i<n;)if(o=i+(n-i>>1),e<r[o])n=o-1;else if(e>=r[o+1])i=o+1;else{i=o;break}}return{col:e-r[i]+1,line:i+1}}mapResolve(e){return/^\\w+:\\/\\//.test(e)?e:cs(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,i){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let l;typeof r=="number"&&(l=n.originalPositionFor({column:i,line:r}));let a;us(o.source)?a=Mt(o.source):a=new URL(o.source,this.map.consumer().sourceRoot||Mt(this.map.mapFile));let u={column:o.column,endColumn:l&&l.column,endLine:l&&l.line,line:o.line,url:a.toString()};if(a.protocol==="file:")if(Pi)u.file=Pi(a);else throw new Error("file: protocol is not available in this PostCSS build");let c=n.sourceContentFor(o.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},pr=Qt;Qt.default=Qt;_r&&_r.registerInput&&_r.registerInput(Qt);var{SourceMapConsumer:to,SourceMapGenerator:Ut}=ie,{dirname:Bt,relative:ro,resolve:so,sep:io}=ie,{pathToFileURL:Fi}=ie,Oc=pr,Dc=!!(to&&Ut),Tc=!!(Bt&&so&&ro&&io),_c=class{constructor(e,t,r,i){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`\n`;this.css.includes(`\\r\n`)&&(t=`\\r\n`),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||Bt(e.file),i;this.mapOpts.sourcesContent===!1?(i=new to(e.text),i.sourcesContent&&(i.sourcesContent=null)):i=e.consumer(),this.map.applySourceMap(i,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\\n*?\\/\\*#[\\S\\s]*?\\*\\/$/gm,""))}generate(){if(this.clearAnnotation(),Tc&&Dc&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Ut.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Ut({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Ut({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!=="end"&&(i.generated.line=e,i.generated.column=t-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),n=l.match(/\\n/g),n?(e+=n.length,o=l.lastIndexOf(`\n`),t=l.length-o):t+=l.length,a&&u!=="start"){let c=a.parent||{raws:{}};(!(a.type==="decl"||a.type==="atrule"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=e,i.generated.column=t-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=e,i.generated.column=t-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\\w+:\\/\\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Bt(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Bt(so(r,this.mapOpts.annotation)));let i=ro(r,e);return this.memoizedPaths.set(e,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Oc(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Fi){let r=Fi(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;io==="\\\\"&&(e=e.replace(/\\\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},no=_c,kc=fr,hs=class extends kc{constructor(e){super(e),this.type="comment"}},mr=hs;hs.default=hs;var{isClean:oo,my:ao}=lt,lo=dr,uo=mr,Pc=fr,co,Vs,Gs,ho;function fo(s){return s.map(e=>(e.nodes&&(e.nodes=fo(e.nodes)),delete e.source,e))}function po(s){if(s[oo]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)po(e)}var he=class mo extends Pc{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,i;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],i=e(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[t]+=1;return delete this.indexes[t],i}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(i=>typeof i=="function"?(n,o)=>i(n.toProxy(),o):i)):t==="every"||t==="some"?r=>e[t]((i,...n)=>r(i.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),i=r===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let l of n)this.proxyOf.nodes.splice(r,0,l);let o;for(let l in this.indexes)o=this.indexes[l],r<=o&&(this.indexes[l]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=fo(co(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new lo(e)]}else if(e.selector)e=[new Vs(e)];else if(e.name)e=[new Gs(e)];else if(e.text)e=[new uo(e)];else throw new Error("Unknown node type in node creation");return e.map(i=>(i[ao]||mo.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[oo]&&po(i),typeof i.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(i.raws.before=t.raws.before.replace(/\\S/g,"")),i.parent=this.proxyOf,i))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(i=>{t.props&&!t.props.includes(i.prop)||t.fast&&!i.value.includes(t.fast)||(i.value=i.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let i;try{i=e(t,r)}catch(n){throw t.addToError(n)}return i!==!1&&t.walk&&(i=t.walk(e)),i})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="atrule")return t(r,i)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="decl")return t(r,i)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&e.test(r.selector))return t(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="rule")return t(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};he.registerParse=s=>{co=s};he.registerRule=s=>{Vs=s};he.registerAtRule=s=>{Gs=s};he.registerRoot=s=>{ho=s};var Ce=he;he.default=he;he.rebuild=s=>{s.type==="atrule"?Object.setPrototypeOf(s,Gs.prototype):s.type==="rule"?Object.setPrototypeOf(s,Vs.prototype):s.type==="decl"?Object.setPrototypeOf(s,lo.prototype):s.type==="comment"?Object.setPrototypeOf(s,uo.prototype):s.type==="root"&&Object.setPrototypeOf(s,ho.prototype),s[ao]=!0,s.nodes&&s.nodes.forEach(e=>{he.rebuild(e)})};var $c=Ce,go,yo,tt=class extends $c{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new go(new yo,this,e).stringify()}};tt.registerLazyResult=s=>{go=s};tt.registerProcessor=s=>{yo=s};var js=tt;tt.default=tt;var fs=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},wo=fs;fs.default=fs;var Lc=wo,ds=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new Lc(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}},Hs=ds;ds.default=ds;var Pr=39,Ui=34,Nt=92,Bi=47,Rt=10,Ge=32,At=12,Ot=9,Dt=13,Fc=91,Uc=93,Bc=40,Wc=41,zc=123,Vc=125,Gc=59,jc=42,Hc=58,Yc=64,Tt=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,_t=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,Zc=/.[\\r\\n"\'(/\\\\]/,Wi=/[\\da-f]/i,Xc=function(e,t={}){let r=e.css.valueOf(),i=t.ignoreErrors,n,o,l,a,u,c,h,p,g,m,d=r.length,f=0,b=[],S=[];function y(){return f}function v($){throw e.error("Unclosed "+$,f)}function N(){return S.length===0&&f>=d}function T($){if(S.length)return S.pop();if(f>=d)return;let z=$?$.ignoreUnclosed:!1;switch(n=r.charCodeAt(f),n){case Rt:case Ge:case Ot:case Dt:case At:{o=f;do o+=1,n=r.charCodeAt(o);while(n===Ge||n===Rt||n===Ot||n===Dt||n===At);m=["space",r.slice(f,o)],f=o-1;break}case Fc:case Uc:case zc:case Vc:case Hc:case Gc:case Wc:{let H=String.fromCharCode(n);m=[H,H,f];break}case Bc:{if(p=b.length?b.pop()[1]:"",g=r.charCodeAt(f+1),p==="url"&&g!==Pr&&g!==Ui&&g!==Ge&&g!==Rt&&g!==Ot&&g!==At&&g!==Dt){o=f;do{if(c=!1,o=r.indexOf(")",o+1),o===-1)if(i||z){o=f;break}else v("bracket");for(h=o;r.charCodeAt(h-1)===Nt;)h-=1,c=!c}while(c);m=["brackets",r.slice(f,o+1),f,o],f=o}else o=r.indexOf(")",f+1),a=r.slice(f,o+1),o===-1||Zc.test(a)?m=["(","(",f]:(m=["brackets",a,f,o],f=o);break}case Pr:case Ui:{l=n===Pr?"\'":\'"\',o=f;do{if(c=!1,o=r.indexOf(l,o+1),o===-1)if(i||z){o=f+1;break}else v("string");for(h=o;r.charCodeAt(h-1)===Nt;)h-=1,c=!c}while(c);m=["string",r.slice(f,o+1),f,o],f=o;break}case Yc:{Tt.lastIndex=f+1,Tt.test(r),Tt.lastIndex===0?o=r.length-1:o=Tt.lastIndex-2,m=["at-word",r.slice(f,o+1),f,o],f=o;break}case Nt:{for(o=f,u=!0;r.charCodeAt(o+1)===Nt;)o+=1,u=!u;if(n=r.charCodeAt(o+1),u&&n!==Bi&&n!==Ge&&n!==Rt&&n!==Ot&&n!==Dt&&n!==At&&(o+=1,Wi.test(r.charAt(o)))){for(;Wi.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===Ge&&(o+=1)}m=["word",r.slice(f,o+1),f,o],f=o;break}default:{n===Bi&&r.charCodeAt(f+1)===jc?(o=r.indexOf("*/",f+2)+1,o===0&&(i||z?o=r.length:v("comment")),m=["comment",r.slice(f,o+1),f,o],f=o):(_t.lastIndex=f+1,_t.test(r),_t.lastIndex===0?o=r.length-1:o=_t.lastIndex-2,m=["word",r.slice(f,o+1),f,o],b.push(m),f=o);break}}return f++,m}function V($){S.push($)}return{back:V,endOfFile:N,nextToken:T,position:y}},bo=Ce,qt=class extends bo{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},Ys=qt;qt.default=qt;bo.registerAtRule(qt);var So=Ce,vo,Co,_e=class extends So{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let i=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of i)n.raws.before=t.raws.before}return i}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new vo(new Co,this,e).stringify()}};_e.registerLazyResult=s=>{vo=s};_e.registerProcessor=s=>{Co=s};var ut=_e;_e.default=_e;So.registerRoot(_e);var rt={comma(s){return rt.split(s,[","],!0)},space(s){let e=[" ",`\n`," "];return rt.split(s,e)},split(s,e,t){let r=[],i="",n=!1,o=0,l=!1,a="",u=!1;for(let c of s)u?u=!1:c==="\\\\"?u=!0:l?c===a&&(l=!1):c===\'"\'||c==="\'"?(l=!0,a=c):c==="("?o+=1:c===")"?o>0&&(o-=1):o===0&&e.includes(c)&&(n=!0),n?(i!==""&&r.push(i.trim()),i="",n=!1):i+=c;return(t||i!=="")&&r.push(i.trim()),r}},Eo=rt;rt.default=rt;var Io=Ce,Jc=Eo,er=class extends Io{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Jc.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}},Zs=er;er.default=er;Io.registerRule(er);var Kc=dr,Qc=Xc,qc=mr,eh=Ys,th=ut,zi=Zs,Vi={empty:!0,space:!0};function rh(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var sh=class{constructor(e){this.input=e,this.root=new th,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new eh;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,i,n,o=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(a.length>0){for(n=a.length-1,i=a[n];i&&i[0]==="space";)i=a[--n];i&&(t.source.end=this.getPosition(i[3]||i[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,"params",a),o&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,i;for(let n=t-1;n>=0&&(i=e[n],!(i[0]!=="space"&&(r+=1,r===2)));n--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(e){let t=0,r,i,n;for(let[o,l]of e.entries()){if(r=l,i=r[0],i==="("&&(t+=1),i===")"&&(t-=1),t===0&&i===":")if(!n)this.doubleColon(r);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=r}return!1}comment(e){let t=new qc;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let i=r.match(/^(\\s*)([^]*\\S)(\\s*)$/);t.text=i[2],t.raws.left=i[1],t.raws.right=i[3]}}createTokenizer(){this.tokenizer=Qc(this.input)}decl(e,t){let r=new Kc;this.init(r,e[0][2]);let i=e[e.length-1];for(i[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||rh(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let u=e[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=e.shift()[1]}r.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){r.raws.between+=n[1];break}else n[0]==="word"&&/\\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let o=[],l;for(;e.length&&(l=e[0][0],!(l!=="space"&&l!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(n=e[u],n[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==" !important"&&(r.raws.important=c);break}else if(n[1].toLowerCase()==="important"){let c=e.slice(0),h="";for(let p=u;p>0;p--){let g=c[p][0];if(h.trim().indexOf("!")===0&&g!=="space")break;h=c.pop()[1]+h}h.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=h,e=c)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=o.map(u=>u[1]).join(""),o=[]),this.raw(r,"value",o.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new zi;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,i=!1,n=null,o=[],l=e[1].startsWith("--"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r==="("||r==="[")n||(n=u),o.push(r==="("?")":"]");else if(l&&i&&r==="{")n||(n=u),o.push("}");else if(o.length===0)if(r===";")if(i){this.decl(a,l);return}else break;else if(r==="{"){this.rule(a);return}else if(r==="}"){this.tokenizer.back(a.pop()),t=!0;break}else r===":"&&(i=!0);else r===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&i){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,i){let n,o,l=r.length,a="",u=!0,c,h;for(let p=0;p<l;p+=1)n=r[p],o=n[0],o==="space"&&p===l-1&&!i?u=!1:o==="comment"?(h=r[p-1]?r[p-1][0]:"empty",c=r[p+1]?r[p+1][0]:"empty",!Vi[h]&&!Vi[c]?a.slice(-1)===","?u=!1:a+=n[1]:u=!1):a+=n[1];if(!u){let p=r.reduce((g,m)=>g+m[1],"");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new zi;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let i=t;i<e.length;i++)r+=e[i][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},ih=sh,nh=Ce,oh=ih,ah=pr;function tr(s,e){let t=new ah(s,e),r=new oh(t);try{r.parse()}catch(i){throw i}return r.root}var Xs=tr;tr.default=tr;nh.registerParse(tr);var{isClean:le,my:lh}=lt,uh=no,ch=hr,hh=Ce,fh=js;var Gi=Hs,dh=Xs,ph=ut,mh={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},gh={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},yh={Once:!0,postcssPlugin:!0,prepare:!0},ke=0;function je(s){return typeof s=="object"&&typeof s.then=="function"}function xo(s){let e=!1,t=mh[s.type];return s.type==="decl"?e=s.prop.toLowerCase():s.type==="atrule"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+"-"+e,ke,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:s.append?[t,ke,t+"Exit"]:[t,t+"Exit"]}function ji(s){let e;return s.type==="document"?e=["Document",ke,"DocumentExit"]:s.type==="root"?e=["Root",ke,"RootExit"]:e=xo(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function ps(s){return s[le]=!1,s.nodes&&s.nodes.forEach(e=>ps(e)),s}var ms={},Pe=class Mo{constructor(e,t,r){this.stringified=!1,this.processed=!1;let i;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))i=ps(t);else if(t instanceof Mo||t instanceof Gi)i=ps(t.root),t.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let n=dh;r.syntax&&(n=r.syntax.parse),r.parser&&(n=r.parser),n.parse&&(n=n.parse);try{i=n(t,r)}catch(o){this.processed=!0,this.error=o}i&&!i[lh]&&hh.rebuild(i)}this.result=new Gi(e,i,r),this.helpers={...ms,postcss:ms,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin?(e.plugin=r.postcssPlugin,e.setMessage()):r.postcssVersion}catch(i){console&&console.error&&console.error(i)}return e}prepareVisitors(){this.listeners={};let e=(t,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,i])};for(let t of this.plugins)if(typeof t=="object")for(let r in t){if(!gh[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!yh[r])if(typeof t[r]=="object")for(let i in t[r])i==="*"?e(t,r,t[r][i]):e(t,r+"-"+i.toLowerCase(),t[r][i]);else typeof t[r]=="function"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(je(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[le];){e[le]=!0;let t=[ji(e)];for(;t.length>0;){let r=this.visitTick(t);if(je(r))try{await r}catch(i){let n=t[t.length-1].node;throw this.handleError(i,n)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let i=e.nodes.map(n=>r(n,this.helpers));await Promise.all(i)}else await r(e,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return je(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=ch;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new uh(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(je(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[le];)e[le]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,i]of e){this.result.lastPlugin=r;let n;try{n=i(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(je(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:i}=t;if(r.type!=="root"&&r.type!=="document"&&!r.parent){e.pop();return}if(i.length>0&&t.visitorIndex<i.length){let[o,l]=i[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===i.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let o=t.iterator,l;for(;l=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!l[le]){l[le]=!0,e.push(ji(l));return}t.iterator=0,delete r.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===ke){r.nodes&&r.nodes.length&&(r[le]=!0,t.iterator=r.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[le]=!0;let t=xo(e);for(let r of t)if(r===ke)e.nodes&&e.each(i=>{i[le]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Pe.registerPostcss=s=>{ms=s};var No=Pe;Pe.default=Pe;ph.registerLazyResult(Pe);fh.registerLazyResult(Pe);var wh=no,bh=hr;var Sh=Xs,vh=Hs,gs=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let i,n=bh;this.result=new vh(this._processor,i,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let l=new wh(n,i,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Sh;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}},Ch=gs;gs.default=gs;var Eh=Ch,Ih=No,xh=js,Mh=ut,st=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Eh(this,e,t):new Ih(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},Nh=st;st.default=st;Mh.registerProcessor(st);xh.registerProcessor(st);var Rh=dr,Ah=eo,Oh=mr,Dh=Ys,Th=pr,_h=ut,kh=Zs;function it(s,e){if(Array.isArray(s))return s.map(i=>it(i));let{inputs:t,...r}=s;if(t){e=[];for(let i of t){let n={...i,__proto__:Th.prototype};n.map&&(n.map={...n.map,__proto__:Ah.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=s.nodes.map(i=>it(i,e))),r.source){let{inputId:i,...n}=r.source;r.source=n,i!=null&&(r.source.input=e[i])}if(r.type==="root")return new _h(r);if(r.type==="decl")return new Rh(r);if(r.type==="rule")return new kh(r);if(r.type==="comment")return new Oh(r);if(r.type==="atrule")return new Dh(r);throw new Error("Unknown node type: "+s.type)}var Ph=it;it.default=it;var $h=zs,Ro=dr,Lh=No,Fh=Ce,Js=Nh,Uh=hr,Bh=Ph,Ao=js,Wh=wo,Oo=mr,Do=Ys,zh=Hs,Vh=pr,Gh=Xs,jh=Eo,To=Zs,_o=ut,Hh=fr;function O(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new Js(s)}O.plugin=function(e,t){let r=!1;function i(...o){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\nhttps://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new Js().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return O([i(a)]).process(o,l)},i};O.stringify=Uh;O.parse=Gh;O.fromJSON=Bh;O.list=jh;O.comment=s=>new Oo(s);O.atRule=s=>new Do(s);O.decl=s=>new Ro(s);O.rule=s=>new To(s);O.root=s=>new _o(s);O.document=s=>new Ao(s);O.CssSyntaxError=$h;O.Declaration=Ro;O.Container=Fh;O.Processor=Js;O.Document=Ao;O.Comment=Oo;O.Warning=Wh;O.AtRule=Do;O.Result=zh;O.Input=Vh;O.Rule=To;O.Root=_o;O.Node=Hh;Lh.registerPostcss(O);var Yh=O;O.default=O;var F=nc(Yh);F.stringify;F.fromJSON;F.plugin;F.parse;F.list;F.document;F.comment;F.atRule;F.rule;F.decl;F.root;F.CssSyntaxError;F.Declaration;F.Container;F.Processor;F.Document;F.Comment;F.Warning;F.AtRule;F.Result;F.Input;F.Rule;F.Root;F.Node;var ys=class s{constructor(...e){ee(this,"parentElement",null),ee(this,"parentNode",null),ee(this,"ownerDocument"),ee(this,"firstChild",null),ee(this,"lastChild",null),ee(this,"previousSibling",null),ee(this,"nextSibling",null),ee(this,"ELEMENT_NODE",1),ee(this,"TEXT_NODE",3),ee(this,"nodeType"),ee(this,"nodeName"),ee(this,"RRNodeType")}get childNodes(){let e=[],t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof s){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute \'appendChild\' on \'RRNode\': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute \'insertBefore\' on \'RRNode\': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute \'removeChild\' on \'RRNode\': This RRNode type does not support this method.")}toString(){return"RRNode"}};var Hi={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Yi={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},kt={},Zh=()=>!!globalThis.Zone;function Ks(s){if(kt[s])return kt[s];let e=globalThis[s],t=e.prototype,r=s in Hi?Hi[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),n=s in Yi?Yi[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!Zh())return kt[s]=e.prototype,e.prototype;try{let l=document.createElement("iframe");document.body.appendChild(l);let a=l.contentWindow;if(!a)return e.prototype;let u=a[s].prototype;return document.body.removeChild(l),u?kt[s]=u:t}catch{return t}}var $r={};function de(s,e,t){var r;let i=`${s}.${String(t)}`;if($r[i])return $r[i].call(e);let n=Ks(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?($r[i]=o,o.call(e)):e[t]}var Lr={};function ko(s,e,t){let r=`${s}.${String(t)}`;if(Lr[r])return Lr[r].bind(e);let n=Ks(s)[t];return typeof n!="function"?e[t]:(Lr[r]=n,n.bind(e))}function Xh(s){return de("Node",s,"ownerDocument")}function Jh(s){return de("Node",s,"childNodes")}function Kh(s){return de("Node",s,"parentNode")}function Qh(s){return de("Node",s,"parentElement")}function qh(s){return de("Node",s,"textContent")}function ef(s,e){return ko("Node",s,"contains")(e)}function tf(s){return ko("Node",s,"getRootNode")()}function rf(s){return!s||!("host"in s)?null:de("ShadowRoot",s,"host")}function sf(s){return s.styleSheets}function nf(s){return!s||!("shadowRoot"in s)?null:de("Element",s,"shadowRoot")}function of(s,e){return de("Element",s,"querySelector")(e)}function af(s,e){return de("Element",s,"querySelectorAll")(e)}function Po(){return Ks("MutationObserver").constructor}function Ee(s,e,t){try{if(!(e in s))return()=>{};let r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}var C={ownerDocument:Xh,childNodes:Jh,parentNode:Kh,parentElement:Qh,textContent:qh,contains:ef,getRootNode:tf,host:rf,styleSheets:sf,shadowRoot:nf,querySelector:of,querySelectorAll:af,mutationObserver:Po,patch:Ee};function Z(s,e,t=document){let r={capture:!0,passive:!0};return t.addEventListener(s,e,r),()=>t.removeEventListener(s,e,r)}var xe=`Please stop import mirror directly. Instead of that,\\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\\r\nor you can use record.mirror to access the mirror instance during recording.`,Zi={map:{},getId(){return console.error(xe),-1},getNode(){return console.error(xe),null},removeNodeFromMap(){console.error(xe)},has(){return console.error(xe),!1},reset(){console.error(xe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Zi=new Proxy(Zi,{get(s,e,t){return e==="map"&&console.error(xe),Reflect.get(s,e,t)}}));function nt(s,e,t={}){let r=null,i=0;return function(...n){let o=Date.now();!i&&t.leading===!1&&(i=o);let l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function gr(s,e,t,r,i=window){let n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>gr(s,e,n||{},!0)}var rr=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(rr=()=>new Date().getTime());function $o(s){var e,t,r,i;let n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||n?.body&&((e=C.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n?.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:n?.documentElement.scrollTop||n?.body&&((r=C.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n?.body)==null?void 0:i.scrollTop)||0}}function Lo(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Fo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Uo(s){return s?s.nodeType===s.ELEMENT_NODE?s:C.parentElement(s):null}function X(s,e,t,r){if(!s)return!1;let i=Uo(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Yt(i,e,r))return!0}catch{}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function lf(s,e){return e.getId(s)!==-1}function Fr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===Je}function Bo(s,e){if(Ye(s))return!1;let t=e.getId(s);if(!e.has(t))return!0;let r=C.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?Bo(r,e):!0}function ws(s){return!!s.changedTouches}function uf(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Wo(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function zo(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function bs(s){return s?s instanceof ys&&"shadowRoot"in s?!!s.shadowRoot:!!C.shadowRoot(s):!1}var Ss=class{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Vo(s){var e;let t=null;return"getRootNode"in s&&((e=C.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(s))&&(t=C.host(C.getRootNode(s))),t}function cf(s){let e=s,t;for(;t=Vo(e);)e=t;return e}function hf(s){let e=C.ownerDocument(s);if(!e)return!1;let t=cf(s);return C.contains(e,t)}function Go(s){let e=C.ownerDocument(s);return e?C.contains(e,s)||hf(s):!1}var x=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(x||{}),E=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(E||{}),J=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(J||{}),ue=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(ue||{}),$e=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))($e||{}),Me=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Me||{});var jo=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(jo||{});function Xi(s){return"__ln"in s}var vs=class{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Xi(e.previousSibling)){let r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&Xi(e.nextSibling)&&e.nextSibling.__ln.previous){let r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Ji=(s,e)=>`${s}@${e}`,Cs=class{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),w(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,r=new vs,i=a=>{let u=a,c=Je;for(;c===Je;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},n=a=>{let u=C.parentNode(a);if(!u||!Go(a))return;let c=!1;if(a.nodeType===Node.TEXT_NODE){let m=u.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let h=Ye(u)?this.mirror.getId(Vo(a)):this.mirror.getId(u),p=i(a);if(h===-1||p===-1)return r.addNode(a);let g=Re(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:m=>{Wo(m,this.mirror)&&this.iframeManager.addIframe(m),zo(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),bs(a)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(a),this.doc)},onIframeLoad:(m,d)=>{this.iframeManager.attachIframe(m,d),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,d)=>{this.stylesheetManager.attachLinkElement(m,d)},cssCaptured:c});g&&(e.push({parentId:h,nextId:p,node:g}),t.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of this.movedSet)Ki(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(C.parentNode(a))||n(a);for(let a of this.addedSet)!Qi(this.droppedSet,a)&&!Ki(this.removesSubTreeCache,a,this.mirror)||Qi(this.movedSet,a)?n(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){let u=this.mirror.getId(C.parentNode(o.value)),c=i(o.value);u!==-1&&c!==-1&&(a=o)}if(!a){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let h=this.mirror.getId(C.parentNode(c.value));if(i(c.value)===-1)continue;if(h!==-1){a=c;break}else{let g=c.value,m=C.parentNode(g);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let d=C.host(m);if(this.mirror.getId(d)!==-1){a=c;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),n(a.value)}let l={texts:this.texts.map(a=>{let u=a.node,c=C.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:a.value}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{let{attributes:u}=a;if(typeof u.style=="string"){let c=JSON.stringify(a.styleDiff),h=JSON.stringify(a._unchangedStyles);c.length<u.style.length&&(c+h).split("var(").length===u.style.split("var(").length&&(u.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:u}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(l))}),w(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(C.childNodes(e),i=>C.textContent(i)||"").join("");t.attributes.value=Gt({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:jt(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!Fr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=C.textContent(e.target);!X(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:dn(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Uo(e.target)):t.replace(/[\\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){let o=jt(t);i=Gt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(X(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!fn(t.tagName,r))if(n.attributes[r]=hn(this.doc,Se(t.tagName),Se(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(let l of Array.from(t.style)){let a=t.style.getPropertyValue(l),u=t.style.getPropertyPriority(l);a!==o.style.getPropertyValue(l)||u!==o.style.getPropertyPriority(l)?u===""?n.styleDiff[l]=a:n.styleDiff[l]=[a,u]:n._unchangedStyles[l]=[a,u]}for(let l of Array.from(o.style))t.style.getPropertyValue(l)===""&&(n.styleDiff[l]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(X(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),i=Ye(e.target)?this.mirror.getId(C.host(e.target)):this.mirror.getId(e.target);X(e.target,this.blockClass,this.blockSelector,!1)||Fr(t,this.mirror,this.slimDOMOptions)||!lf(t,this.mirror)||(this.addedSet.has(t)?(Es(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||Bo(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ji(r,i)]?Es(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:Ye(e.target)&&Ze(e.target)?!0:void 0}),ff(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Fr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Ji(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);X(e,this.blockClass,this.blockSelector,!1)||(C.childNodes(e).forEach(r=>this.genAdds(r)),bs(e)&&C.childNodes(C.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function Es(s,e){s.delete(e),C.childNodes(e).forEach(t=>Es(s,t))}function ff(s,e){let t=[s];for(;t.length;){let r=t.pop();e.has(r)||(e.add(r),C.childNodes(r).forEach(i=>t.push(i)))}}function Ki(s,e,t){return s.size===0?!1:df(s,e)}function df(s,e,t){let r=C.parentNode(e);return r?s.has(r):!1}function Qi(s,e){return s.size===0?!1:Ho(s,e)}function Ho(s,e){let t=C.parentNode(e);return t?s.has(t)?!0:Ho(s,t):!1}var Xe;function pf(s){Xe=s}function mf(){Xe=void 0}var I=s=>Xe?(...t)=>{try{return s(...t)}catch(r){if(Xe&&Xe(r)===!0)return;throw r}}:s,be=[];function ct(s){try{if("composedPath"in s){let e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch{}return s&&s.target}function Yo(s,e){let t=new Cs;be.push(t),t.init(s);let r=new(Po())(I(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function gf({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,o=[],l,a=nt(I(h=>{let p=Date.now()-l;s(o.map(g=>(g.timeOffset-=p,g)),h),o=[],l=null}),n),u=I(nt(I(h=>{let p=ct(h),{clientX:g,clientY:m}=ws(h)?h.changedTouches[0]:h;l||(l=rr()),o.push({x:g,y:m,id:r.getId(p),timeOffset:rr()-l}),a(typeof DragEvent<"u"&&h instanceof DragEvent?E.Drag:h instanceof MouseEvent?E.MouseMove:E.TouchMove)}),i,{trailing:!1})),c=[Z("mousemove",u,t),Z("touchmove",u,t),Z("drag",u,t)];return I(()=>{c.forEach(h=>h())})}function yf({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};let o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[],a=null,u=c=>h=>{let p=ct(h);if(X(p,r,i,!0))return;let g=null,m=c;if("pointerType"in h){switch(h.pointerType){case"mouse":g=ue.Mouse;break;case"touch":g=ue.Touch;break;case"pen":g=ue.Pen;break}g===ue.Touch?J[c]===J.MouseDown?m="TouchStart":J[c]===J.MouseUp&&(m="TouchEnd"):ue.Pen}else ws(h)&&(g=ue.Touch);g!==null?(a=g,(m.startsWith("Touch")&&g===ue.Touch||m.startsWith("Mouse")&&g===ue.Mouse)&&(g=null)):J[c]===J.Click&&(g=a,a=null);let d=ws(h)?h.changedTouches[0]:h;if(!d)return;let f=t.getId(p),{clientX:b,clientY:S}=d;I(s)({type:J[m],id:f,x:b,y:S,...g!==null&&{pointerType:g}})};return Object.keys(J).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&o[c]!==!1).forEach(c=>{let h=Se(c),p=u(c);if(window.PointerEvent)switch(J[c]){case J.MouseDown:case J.MouseUp:h=h.replace("mouse","pointer");break;case J.TouchStart:case J.TouchEnd:return}l.push(Z(h,p,e))}),I(()=>{l.forEach(c=>c())})}function Zo({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){let o=I(nt(I(l=>{let a=ct(l);if(!a||X(a,r,i,!0))return;let u=t.getId(a);if(a===e&&e.defaultView){let c=$o(e.defaultView);s({id:u,x:c.left,y:c.top})}else s({id:u,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return Z("scroll",o,e)}function wf({viewportResizeCb:s},{win:e}){let t=-1,r=-1,i=I(nt(I(()=>{let n=Lo(),o=Fo();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return Z("resize",i,e)}var bf=["INPUT","TEXTAREA","SELECT"],qi=new WeakMap;function Sf({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:c}){function h(S){let y=ct(S),v=S.isTrusted,N=y&&y.tagName;if(y&&N==="OPTION"&&(y=C.parentElement(y)),!y||!N||bf.indexOf(N)<0||X(y,r,i,!0)||y.classList.contains(n)||o&&y.matches(o))return;let T=y.value,V=!1,$=jt(y)||"";$==="radio"||$==="checkbox"?V=y.checked:(l[N.toLowerCase()]||l[$])&&(T=Gt({element:y,maskInputOptions:l,tagName:N,type:$,value:T,maskInputFn:a})),p(y,c?{text:T,isChecked:V,userTriggered:v}:{text:T,isChecked:V});let z=y.name;$==="radio"&&z&&V&&e.querySelectorAll(`input[type="radio"][name="${z}"]`).forEach(H=>{if(H!==y){let Q=H.value;p(H,c?{text:Q,isChecked:!V,userTriggered:!1}:{text:Q,isChecked:!V})}})}function p(S,y){let v=qi.get(S);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){qi.set(S,y);let N=t.getId(S);I(s)({...y,id:N})}}let m=(u.input==="last"?["change"]:["input","change"]).map(S=>Z(S,I(h),e)),d=e.defaultView;if(!d)return()=>{m.forEach(S=>S())};let f=d.Object.getOwnPropertyDescriptor(d.HTMLInputElement.prototype,"value"),b=[[d.HTMLInputElement.prototype,"value"],[d.HTMLInputElement.prototype,"checked"],[d.HTMLSelectElement.prototype,"value"],[d.HTMLTextAreaElement.prototype,"value"],[d.HTMLSelectElement.prototype,"selectedIndex"],[d.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&m.push(...b.map(S=>gr(S[0],S[1],{set(){I(h)({target:this,isTrusted:!1})}},!1,d))),I(()=>{m.forEach(S=>S())})}function sr(s){let e=[];function t(r,i){if(Pt("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Pt("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Pt("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Pt("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){let o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function me(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function vf({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:I((c,h,p)=>{let[g,m]=p,{id:d,styleId:f}=me(h,e,t.styleMirror);return(d&&d!==-1||f&&f!==-1)&&s({id:d,styleId:f,adds:[{rule:g,index:m}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(c,h,p=this.cssRules.length){let g=`${c} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[g,p])};let n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:I((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,removes:[{index:g}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:I((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replace:g}),c.apply(h,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:I((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replaceSync:g}),c.apply(h,p)})}));let a={};$t("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:($t("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),$t("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),$t("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));let u={};return Object.entries(a).forEach(([c,h])=>{u[c]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[c].insertRule,{apply:I((p,g,m)=>{let[d,f]=m,{id:b,styleId:S}=me(g.parentStyleSheet,e,t.styleMirror);return(b&&b!==-1||S&&S!==-1)&&s({id:b,styleId:S,adds:[{rule:d,index:[...sr(g),f||0]}]}),p.apply(g,m)})}),h.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:I((p,g,m)=>{let[d]=m,{id:f,styleId:b}=me(g.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||b&&b!==-1)&&s({id:f,styleId:b,removes:[{index:[...sr(g),d]}]}),p.apply(g,m)})})}),I(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([c,h])=>{h.prototype.insertRule=u[c].insertRule,h.prototype.deleteRule=u[c].deleteRule})})}function Xo({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(C.host(t));let l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,a=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var u;return(u=a.get)==null?void 0:u.call(this)},set(u){var c;let h=(c=a.set)==null?void 0:c.call(this,u);if(o!==null&&o!==-1)try{e.adoptStyleSheets(u,o)}catch{}return h}}),I(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Cf({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){let n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:I((l,a,u)=>{var c;let[h,p,g]=u;if(t.has(h))return n.apply(a,[h,p,g]);let{id:m,styleId:d}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,set:{property:h,value:p,priority:g},index:sr(a.parentRule)}),l.apply(a,u)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:I((l,a,u)=>{var c;let[h]=u;if(t.has(h))return o.apply(a,[h]);let{id:p,styleId:g}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&s({id:p,styleId:g,remove:{property:h},index:sr(a.parentRule)}),l.apply(a,u)})}),I(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Ef({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){let o=I(a=>nt(I(u=>{let c=ct(u);if(!c||X(c,e,t,!0))return;let{currentTime:h,volume:p,muted:g,playbackRate:m,loop:d}=c;s({type:a,id:r.getId(c),currentTime:h,volume:p,muted:g,playbackRate:m,loop:d})}),i.media||500)),l=[Z("play",o(Me.Play),n),Z("pause",o(Me.Pause),n),Z("seeked",o(Me.Seeked),n),Z("volumechange",o(Me.VolumeChange),n),Z("ratechange",o(Me.RateChange),n)];return I(()=>{l.forEach(a=>a())})}function If({fontCb:s,doc:e}){let t=e.defaultView;if(!t)return()=>{};let r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,u,c){let h=new n(a,u,c);return i.set(h,{family:a,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};let o=Ee(e.fonts,"add",function(l){return function(a){return setTimeout(I(()=>{let u=i.get(a);u&&(s(u),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),I(()=>{r.forEach(l=>l())})}function xf(s){let{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s,o=!0,l=I(()=>{let a=e.getSelection();if(!a||o&&a?.isCollapsed)return;o=a.isCollapsed||!1;let u=[],c=a.rangeCount||0;for(let h=0;h<c;h++){let p=a.getRangeAt(h),{startContainer:g,startOffset:m,endContainer:d,endOffset:f}=p;X(g,r,i,!0)||X(d,r,i,!0)||u.push({start:t.getId(g),startOffset:m,end:t.getId(d),endOffset:f})}n({ranges:u})});return l(),Z("selectionchange",l)}function Mf({doc:s,customElementCb:e}){let t=s.defaultView;return!t||!t.customElements?()=>{}:Ee(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch{console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function Nf(s,e){let{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:p,selectionCb:g,customElementCb:m}=s;s.mutationCb=(...d)=>{e.mutation&&e.mutation(...d),t(...d)},s.mousemoveCb=(...d)=>{e.mousemove&&e.mousemove(...d),r(...d)},s.mouseInteractionCb=(...d)=>{e.mouseInteraction&&e.mouseInteraction(...d),i(...d)},s.scrollCb=(...d)=>{e.scroll&&e.scroll(...d),n(...d)},s.viewportResizeCb=(...d)=>{e.viewportResize&&e.viewportResize(...d),o(...d)},s.inputCb=(...d)=>{e.input&&e.input(...d),l(...d)},s.mediaInteractionCb=(...d)=>{e.mediaInteaction&&e.mediaInteaction(...d),a(...d)},s.styleSheetRuleCb=(...d)=>{e.styleSheetRule&&e.styleSheetRule(...d),u(...d)},s.styleDeclarationCb=(...d)=>{e.styleDeclaration&&e.styleDeclaration(...d),c(...d)},s.canvasMutationCb=(...d)=>{e.canvasMutation&&e.canvasMutation(...d),h(...d)},s.fontCb=(...d)=>{e.font&&e.font(...d),p(...d)},s.selectionCb=(...d)=>{e.selection&&e.selection(...d),g(...d)},s.customElementCb=(...d)=>{e.customElement&&e.customElement(...d),m(...d)}}function Rf(s,e={}){let t=s.doc.defaultView;if(!t)return()=>{};Nf(s,e);let r;s.recordDOM&&(r=Yo(s,s.doc));let i=gf(s),n=yf(s),o=Zo(s),l=wf(s,{win:t}),a=Sf(s),u=Ef(s),c=()=>{},h=()=>{},p=()=>{},g=()=>{};s.recordDOM&&(c=vf(s,{win:t}),h=Xo(s,s.doc),p=Cf(s,{win:t}),s.collectFonts&&(g=If(s)));let m=xf(s),d=Mf(s),f=[];for(let b of s.plugins)f.push(b.observer(b.callback,t,b.options));return I(()=>{be.forEach(b=>b.reset()),r?.disconnect(),i(),n(),o(),l(),a(),u(),c(),h(),p(),g(),m(),d(),f.forEach(b=>b())})}function Pt(s){return typeof window[s]<"u"}function $t(s){return!!(typeof window[s]<"u"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}var ir=class{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){let n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e),l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.set(l,t)),l}getIds(e,t){let r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){let i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;let n=i.get(t);return n||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},Is=class{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new ir(cn)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ir(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case x.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:x.IncrementalSnapshot,data:{source:E.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case x.Meta:case x.Load:case x.DomContentLoaded:return!1;case x.Plugin:return t;case x.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case x.IncrementalSnapshot:switch(t.data.source){case E.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case E.Drag:case E.TouchMove:case E.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case E.ViewportResize:return!1;case E.MediaInteraction:case E.MouseInteraction:case E.Scroll:case E.CanvasMutation:case E.Input:return this.replaceIds(t.data,e,["id"]),t;case E.StyleSheetRule:case E.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case E.Font:return t;case E.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case E.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(let n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==jo.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},xs=class{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!Ze(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let r=Yo({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(Zo({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(C.host(e))),this.restoreHandlers.push(Xo({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(Ee(e.prototype,"attachShadow",function(i){return function(n){let o=i.call(this,n),l=C.shadowRoot(this);return l&&Go(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Af=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(He=0;He<Ae.length;He++)Af[Ae.charCodeAt(He)]=He;var He,Of=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Ae[e[t]>>2],i+=Ae[(e[t]&3)<<4|e[t+1]>>4],i+=Ae[(e[t+1]&15)<<2|e[t+2]>>6],i+=Ae[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var en=new Map;function Df(s,e){let t=en.get(s);return t||(t=new Map,en.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}var Jo=(s,e,t)=>{if(!s||!(Qo(s,e)||typeof s=="object"))return;let r=s.constructor.name,i=Df(t,r),n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function Wt(s,e,t){if(s instanceof Array)return s.map(r=>Wt(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){let r=s.constructor.name,i=Of(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[Wt(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){let r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){let r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[Wt(s.data,e,t),s.width,s.height]};if(Qo(s,e)||typeof s=="object"){let r=s.constructor.name,i=Jo(s,e,t);return{rr_type:r,index:i}}}}return s}var Ko=(s,e,t)=>s.map(r=>Wt(r,e,t)),Qo=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function Tf(s,e,t,r){let i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;let l=Ee(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...u){return X(this.canvas,t,r,!0)||setTimeout(()=>{let c=Ko(u,e,this);s(this.canvas,{type:$e["2D"],property:o,args:c})},0),a.apply(this,u)}});i.push(l)}catch{let l=gr(e.CanvasRenderingContext2D.prototype,o,{set(a){s(this.canvas,{type:$e["2D"],property:o,args:[a],setter:!0})}});i.push(l)}return()=>{i.forEach(o=>o())}}function _f(s){return s==="experimental-webgl"?"webgl":s}function tn(s,e,t,r){let i=[];try{let n=Ee(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!X(this,e,t,!0)){let u=_f(l);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(a[0]&&typeof a[0]=="object"){let c=a[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function rn(s,e,t,r,i,n){let o=[],l=Object.getOwnPropertyNames(s);for(let a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;let u=Ee(s,a,function(c){return function(...h){let p=c.apply(this,h);if(Jo(p,n,this),"tagName"in this.canvas&&!X(this.canvas,r,i,!0)){let g=Ko(h,n,this),m={type:e,property:a,args:g};t(this.canvas,m)}return p}});o.push(u)}catch{let u=gr(s,a,{set(c){t(this.canvas,{type:e,property:a,args:[c],setter:!0})}});o.push(u)}return o}function kf(s,e,t,r){let i=[];return i.push(...rn(e.WebGLRenderingContext.prototype,$e.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...rn(e.WebGL2RenderingContext.prototype,$e.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}var qo="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",Pf=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),sn=typeof window<"u"&&window.Blob&&new Blob([Pf(qo)],{type:"text/javascript;charset=utf-8"});function $f(s){let e;try{if(e=sn&&(window.URL||window.webkitURL).createObjectURL(sn),!e)throw"";let t=new Worker(e,{name:s?.name});return t.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+qo,{name:s?.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var Ms=class{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(a,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(u)});let{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,i,n){let o=tn(t,r,i,!0),l=new Map,a=new $f;a.onmessage=m=>{let{id:d}=m.data;if(l.set(d,!1),!("base64"in m.data))return;let{base64:f,type:b,width:S,height:y}=m.data;this.mutationCb({id:d,type:$e["2D"],commands:[{property:"clearRect",args:[0,0,S,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:b}]},0,0]}]})};let u=1e3/e,c=0,h,p=()=>{let m=[];return t.document.querySelectorAll("canvas").forEach(d=>{X(d,r,i,!0)||m.push(d)}),m},g=m=>{if(c&&m-c<u){h=requestAnimationFrame(g);return}c=m,p().forEach(async d=>{var f;let b=this.mirror.getId(d);if(l.get(b)||d.width===0||d.height===0)return;if(l.set(b,!0),["webgl","webgl2"].includes(d.__context)){let y=d.getContext(d.__context);((f=y?.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let S=await createImageBitmap(d);a.postMessage({id:b,bitmap:S,width:d.width,height:d.height,dataURLOptions:n.dataURLOptions},[S])}),h=requestAnimationFrame(g)};h=requestAnimationFrame(g),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=tn(e,t,r,!1),n=Tf(this.processMutation.bind(this),e,t,r),o=kf(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let i=r.map(o=>{let{type:l,...a}=o;return a}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}},Ns=class{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new Ss),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},i=[];for(let n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:ln(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},Rs=class{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},W,zt,Ur,nr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){let s=document.createElement("iframe");document.body.appendChild(s),Array.from=((ai=s.contentWindow)==null?void 0:ai.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}var re=za();function pe(s={}){let{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:g,maskInputFn:m,maskTextFn:d,hooks:f,packFn:b,sampling:S={},dataURLOptions:y={},mousemoveWait:v,recordDOM:N=!0,recordCanvas:T=!1,recordCrossOriginIframes:V=!1,recordAfter:$=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:z=!1,collectFonts:H=!1,inlineImages:Q=!1,plugins:ne,keepIframeSrcFn:M=()=>!1,ignoreCSSAttributes:Fe=new Set([]),errorHandler:Ue}=s;pf(Ue);let G=V?window.parent===window:!0,q=!1;if(!G)try{window.parent.document&&(q=!1)}catch{q=!0}if(G&&!e)throw new Error("emit function is required");if(!G&&!q)return()=>{};v!==void 0&&S.mousemove===void 0&&(S.mousemove=v),re.reset();let ge=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},oe=pn(g);uf();let Qs,br=0,qs=R=>{for(let te of ne||[])te.eventProcessor&&(R=te.eventProcessor(R));return b&&!q&&(R=b(R)),R};W=(R,te)=>{var U;let B=R;if(B.timestamp=rr(),(U=be[0])!=null&&U.isFrozen()&&B.type!==x.FullSnapshot&&!(B.type===x.IncrementalSnapshot&&B.data.source===E.Mutation)&&be.forEach(K=>K.unfreeze()),G)e?.(qs(B),te);else if(q){let K={type:"rrweb",event:qs(B),origin:window.location.origin,isCheckout:te};window.parent.postMessage(K,"*")}if(B.type===x.FullSnapshot)Qs=B,br=0;else if(B.type===x.IncrementalSnapshot){if(B.data.source===E.Mutation&&B.data.isAttachIframe)return;br++;let K=r&&br>=r,D=t&&B.timestamp-Qs.timestamp>t;(K||D)&&zt(!0)}};let ft=R=>{W({type:x.IncrementalSnapshot,data:{source:E.Mutation,...R}})},ei=R=>W({type:x.IncrementalSnapshot,data:{source:E.Scroll,...R}}),ti=R=>W({type:x.IncrementalSnapshot,data:{source:E.CanvasMutation,...R}}),ta=R=>W({type:x.IncrementalSnapshot,data:{source:E.AdoptedStyleSheet,...R}}),ye=new Ns({mutationCb:ft,adoptedStyleSheetCb:ta}),we=new Is({mirror:re,mutationCb:ft,stylesheetManager:ye,recordCrossOriginIframes:V,wrappedEmit:W});for(let R of ne||[])R.getMirror&&R.getMirror({nodeMirror:re,crossOriginIframeMirror:we.crossOriginIframeMirror,crossOriginIframeStyleMirror:we.crossOriginIframeStyleMirror});let Sr=new Rs;Ur=new Ms({recordCanvas:T,mutationCb:ti,win:window,blockClass:i,blockSelector:n,mirror:re,sampling:S.canvas,dataURLOptions:y});let dt=new xs({mutationCb:ft,scrollCb:ei,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:ge,dataURLOptions:y,maskTextFn:d,maskInputFn:m,recordCanvas:T,inlineImages:Q,sampling:S,slimDOMOptions:oe,iframeManager:we,stylesheetManager:ye,canvasManager:Ur,keepIframeSrcFn:M,processedNodeManager:Sr},mirror:re});zt=(R=!1)=>{if(!N)return;W({type:x.Meta,data:{href:window.location.href,width:Fo(),height:Lo()}},R),ye.reset(),dt.init(),be.forEach(U=>U.lock());let te=fl(document,{mirror:re,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:ge,maskTextFn:d,maskInputFn:m,slimDOM:oe,dataURLOptions:y,recordCanvas:T,inlineImages:Q,onSerialize:U=>{Wo(U,re)&&we.addIframe(U),zo(U,re)&&ye.trackLinkElement(U),bs(U)&&dt.addShadowRoot(C.shadowRoot(U),document)},onIframeLoad:(U,B)=>{we.attachIframe(U,B),dt.observeAttachShadow(U)},onStylesheetLoad:(U,B)=>{ye.attachLinkElement(U,B)},keepIframeSrcFn:M});if(!te)return console.warn("Failed to snapshot the document");W({type:x.FullSnapshot,data:{node:te,initialOffset:$o(window)}},R),be.forEach(U=>U.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ye.adoptStyleSheets(document.adoptedStyleSheets,re.getId(document))};try{let R=[],te=B=>{var K;return I(Rf)({mutationCb:ft,mousemoveCb:(D,vr)=>W({type:x.IncrementalSnapshot,data:{source:vr,positions:D}}),mouseInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.MouseInteraction,...D}}),scrollCb:ei,viewportResizeCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.ViewportResize,...D}}),inputCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.Input,...D}}),mediaInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.MediaInteraction,...D}}),styleSheetRuleCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.StyleSheetRule,...D}}),styleDeclarationCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.StyleDeclaration,...D}}),canvasMutationCb:ti,fontCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.Font,...D}}),selectionCb:D=>{W({type:x.IncrementalSnapshot,data:{source:E.Selection,...D}})},customElementCb:D=>{W({type:x.IncrementalSnapshot,data:{source:E.CustomElement,...D}})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:u,maskInputOptions:ge,inlineStylesheet:c,sampling:S,recordDOM:N,recordCanvas:T,inlineImages:Q,userTriggeredOnInput:z,collectFonts:H,doc:B,maskInputFn:m,maskTextFn:d,keepIframeSrcFn:M,blockSelector:n,slimDOMOptions:oe,dataURLOptions:y,mirror:re,iframeManager:we,stylesheetManager:ye,shadowDomManager:dt,processedNodeManager:Sr,canvasManager:Ur,ignoreCSSAttributes:Fe,plugins:((K=ne?.filter(D=>D.observer))==null?void 0:K.map(D=>({observer:D.observer,options:D.options,callback:vr=>W({type:x.Plugin,data:{plugin:D.name,payload:vr}})})))||[]},f)};we.addLoadListener(B=>{try{R.push(te(B.contentDocument))}catch(K){console.warn(K)}});let U=()=>{zt(),R.push(te(document)),nr=!0};return["interactive","complete"].includes(document.readyState)?U():(R.push(Z("DOMContentLoaded",()=>{W({type:x.DomContentLoaded,data:{}}),$==="DOMContentLoaded"&&U()})),R.push(Z("load",()=>{W({type:x.Load,data:{}}),$==="load"&&U()},window))),()=>{R.forEach(B=>{try{B()}catch(K){String(K).toLowerCase().includes("cross-origin")||console.warn(K)}}),Sr.destroy(),nr=!1,mf()}}catch(R){console.warn(R)}}pe.addCustomEvent=(s,e)=>{if(!nr)throw new Error("please add custom event after start recording");W({type:x.Custom,data:{tag:s,payload:e}})};pe.freezePage=()=>{be.forEach(s=>s.freeze())};pe.takeFullSnapshot=s=>{if(!nr)throw new Error("please take full snapshot after start recording");zt(s)};pe.mirror=re;var nn;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(nn||(nn={}));var zd=5*1e3;var{addCustomEvent:Vd}=pe,{freezePage:Gd}=pe,{takeFullSnapshot:jd}=pe;var Lf=1e4,Ff=1800,Uf=3e3,Bf=2500,Wf=4e3,zf=.1,Vf=.25,Gf=200,jf=500,Hf=1e3,Yf=5e3,Zf=16,ea=1e3,Le={fcp:null,lcp:null,cls:0,interactionDurations:new Map},Xf={FCP:[Ff,Uf],LCP:[Bf,Wf],CLS:[zf,Vf],INP:[Gf,jf]},Jf=(s,e)=>{let t=Xf[s];return t?e<t[0]?"good":e<t[1]?"needs-improvement":"poor":"unknown"};try{new PerformanceObserver(s=>{for(let e of s.getEntries())e.name==="first-contentful-paint"&&(Le.fcp=e.startTime)}).observe({type:"paint",buffered:!0})}catch{}try{new PerformanceObserver(s=>{for(let e of s.getEntries())Le.lcp=e.startTime}).observe({type:"largest-contentful-paint",buffered:!0})}catch{}try{new PerformanceObserver(s=>{for(let e of s.getEntries()){let{interactionId:t}=e;if(t&&t>0){let r=Le.interactionDurations.get(t)??0;Le.interactionDurations.set(t,Math.max(r,e.duration))}}}).observe({type:"event",buffered:!0,durationThreshold:Zf})}catch{}try{let s=[];new PerformanceObserver(e=>{for(let o of e.getEntries()){let l=o;l.hadRecentInput||s.push(l)}let t=0,r=0,i=0,n=0;for(let o of s)(o.startTime-n>Hf||o.startTime-i>Yf)&&(r=0,i=o.startTime),r+=o.value,n=o.startTime+o.duration,r>t&&(t=r);Le.cls=t}).observe({type:"layout-shift",buffered:!0})}catch{}var yr=(s,e)=>e===null?null:{value:s==="CLS"?Math.round(e*ea)/ea:Math.round(e),rating:Jf(s,e)},Kf=()=>{let{fcp:s,lcp:e,cls:t,interactionDurations:r}=Le,i=null;return r.size>0&&(i=[...r.values()].sort((o,l)=>l-o)[0]),{fcp:yr("FCP",s),lcp:yr("LCP",e),cls:yr("CLS",t),inp:yr("INP",i)}},Qf=(s,e)=>{let t=document.createElement("div");t.id=s,t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.zIndex="2147483647",t.style.pointerEvents="none";for(let r of e){let i=document.createElement("div");i.textContent=`[${r.label}]`,i.style.position="absolute",i.style.left=`${r.x}px`,i.style.top=`${r.y}px`,i.style.background="rgba(255, 0, 0, 0.85)",i.style.color="white",i.style.fontSize="11px",i.style.fontFamily="monospace",i.style.fontWeight="bold",i.style.padding="1px 3px",i.style.borderRadius="3px",i.style.lineHeight="1.2",i.style.whiteSpace="nowrap",t.appendChild(i)}document.body.appendChild(t)},qf=s=>{document.getElementById(s)?.remove()},ed=(s,e,t,r,i)=>{let n=new Set(t),o=new Set(r),l=document.querySelector(s)||document.body,a=l.querySelectorAll("*"),u=[];for(let c of a){let h=c.tagName.toLowerCase();if(o.has(h))continue;let p=c.getAttribute("role");if(p&&n.has(p.toLowerCase()))continue;let m=getComputedStyle(c).cursor==="pointer",d=c.hasAttribute("onclick")||c instanceof HTMLElement&&c.onclick!==null,f=c.getAttribute("tabindex"),b=f!==null&&f!=="-1";if(!m&&!d&&!b)continue;if(m&&!d&&!b){let N=c.parentElement;if(N&&getComputedStyle(N).cursor==="pointer")continue}let S=(c.textContent||"").trim().slice(0,e);if(!S)continue;let y=c.getBoundingClientRect();if(y.width===0||y.height===0)continue;let v=[];if(m&&v.push("cursor:pointer"),d&&v.push("onclick"),b&&v.push("tabindex"),u.push({selector:si(c,{root:l}),text:S,reason:v.join(", ")}),u.length>=i)break}return u},ht=[],wr,td=()=>{wr||(ht.length=0,wr=pe({checkoutEveryNms:Lf,sampling:{input:"last"},emit(s){ht.push(s)}})??void 0)},rd=()=>{wr?.(),wr=void 0},sd=()=>ht.splice(0),id=()=>[...ht],nd=()=>ht.length;return aa(od);})();\n/*! Bundled license information:\n\nrrweb/dist/rrweb.js:\n (*! *****************************************************************************\n Copyright (c) Microsoft Corporation.\n \n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted.\n \n THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n PERFORMANCE OF THIS SOFTWARE.\n ***************************************************************************** *)\n*/\n\nglobalThis.__EXPECT_RUNTIME__ = __EXPECT_RUNTIME__;\n'),catch:tA}),t.cookies){let n=Array.isArray(t.cookies)?t.cookies:yield*aA(e??``,r.preferredProfile);yield*hp({try:()=>o.addCookies(n.map(e=>e.playwrightFormat)),catch:tA})}let s=yield*hp({try:()=>o.newPage(),catch:tA});return e&&(yield*hp({try:()=>s.goto(e,{waitUntil:t.waitUntil??`load`}),catch:t=>new Ak({url:e,cause:t instanceof Error?t.message:String(t)})})),{browser:n,context:o,page:s}}).pipe(zp(()=>hp(()=>n.close()).pipe(Mp(`UnknownError`,()=>I))))}),t=H(`Browser.snapshot`)(function*(e,t={}){let n=t.timeout??3e4,r=t.selector??`body`;yield*bm({selector:r});let i=yield*hp({try:()=>e.locator(r).ariaSnapshot({timeout:n}),catch:e=>new Ck({selector:r,timeoutMs:n,cause:e instanceof Error?e.message:String(e)})}),a={},o=[],s=0;for(let e of i.split(`
31
- `)){if(t.maxDepth!==void 0&&Bk(e)>t.maxDepth)continue;let n=Yk(e);if(pr(n)){t.interactive||o.push(e);continue}let{role:r,name:i}=n.value;if(!(t.interactive&&!yk.has(r)))if(eA(r,i,t.interactive)){let t=`e${++s}`;a[t]={role:r,name:i},o.push(`${e} [ref=${t}]`)}else o.push(e)}t.cursor&&(s=yield*oA(e,o,a,s,t)),Zk(a);let c=o.join(`
32
- `);t.interactive&&s===0&&(c=`(no interactive elements)`),t.compact&&(c=Hk(c));let l=Qk(c,a);return{tree:c,refs:a,stats:l,locator:Wk(e,a)}});return{createPage:e,snapshot:t,act:H(`Browser.act`)(function*(e,n,r,i){yield*bm({ref:n});let a=yield*(yield*t(e,i)).locator(n);return yield*hp({try:()=>r(a),catch:e=>zk(e,n)}),yield*t(e,i)}),annotatedScreenshot:H(`Browser.annotatedScreenshot`)(function*(e,n={}){let r=yield*t(e,n),i=[],a=[],o=0;for(let[e,t]of Object.entries(r.refs)){let n=yield*r.locator(e),s=yield*hp(()=>n.boundingBox()).pipe(Mp(`UnknownError`,()=>P(void 0)));s&&(o++,i.push({label:o,ref:e,role:t.role,name:t.name}),a.push({label:o,x:s.x,y:s.y}))}return yield*sA(e,a),yield*um(hp({try:()=>e.screenshot({fullPage:n.fullPage}),catch:tA}).pipe(B(e=>({screenshot:e,annotations:i}))),Gk(e,`removeOverlay`,xk).pipe(V(()=>I)))}),waitForNavigationSettle:H(`Browser.waitForNavigationSettle`)(function*(e,t){yield*hp({try:()=>e.waitForURL(e=>e.toString()!==t,{timeout:1e3,waitUntil:`commit`}),catch:tA}).pipe(Mp(`BrowserLaunchError`,()=>I)),e.url()!==t&&(yield*hp(()=>e.waitForLoadState(`domcontentloaded`)).pipe(Mp(`UnknownError`,()=>I)),yield*hp({try:()=>e.waitForTimeout(500),catch:tA}))}),preExtractCookies:H(`Browser.preExtractCookies`)(function*(){let{preferredProfile:e}=yield*nA();return yield*aA(``,e)})}})}){static layer=Ld(this)(this.make)};const lA=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`),uA=`2.0.0-alpha.18`,dA=`https://cdn.jsdelivr.net/npm/rrweb-player@${uA}/dist/style.css`,fA=`https://cdn.jsdelivr.net/npm/rrweb-player@${uA}/dist/rrweb-player.js`,pA=e=>e===`sse`?`
26
+ `,a=t.whitespace?` = `:`=`,o=[],c=t.sort?Object.keys(e).sort():Object.keys(e),l=0;t.align&&(l=s(c.filter(t=>e[t]===null||Array.isArray(e[t])||typeof e[t]!=`object`).map(t=>Array.isArray(e[t])?`${t}[]`:t).concat([``]).reduce((e,t)=>s(e).length>=s(t).length?e:t)).length);let u=``,d=t.bracketedArray?`[]`:``;for(let t of c){let r=e[t];if(r&&Array.isArray(r))for(let e of r)u+=s(`${t}${d}`).padEnd(l,` `)+a+s(e)+n;else r&&typeof r==`object`?o.push(t):u+=s(t).padEnd(l,` `)+a+s(r)+n}t.section&&u.length&&(u=`[`+s(t.section)+`]`+(t.newline?n+n:n)+u);for(let a of o){let o=i(a,`.`).join(`\\.`),s=(t.section?t.section+`.`:``)+o,c=r(e[a],{...t,section:s});u.length&&c.length&&(u+=n),u+=c}return u};function i(e,t){var n=0,r=0,i=0,a=[];do if(i=e.indexOf(t,n),i!==-1){if(n=i+t.length,i>0&&e[i-1]===`\\`)continue;a.push(e.slice(r,i)),r=i+t.length}while(i!==-1);return a.push(e.slice(r)),a}let a=(e,t={})=>{t.bracketedArray=t.bracketedArray!==!1;let r=Object.create(null),a=r,o=null,s=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,l=e.split(/[\r\n]+/g),u={};for(let e of l){if(!e||e.match(/^\s*[;#]/)||e.match(/^\s*$/))continue;let i=e.match(s);if(!i)continue;if(i[1]!==void 0){if(o=c(i[1]),o===`__proto__`){a=Object.create(null);continue}a=r[o]=r[o]||Object.create(null);continue}let l=c(i[2]),d;t.bracketedArray?d=l.length>2&&l.slice(-2)===`[]`:(u[l]=(u?.[l]||0)+1,d=u[l]>1);let f=d&&l.endsWith(`[]`)?l.slice(0,-2):l;if(f===`__proto__`)continue;let p=i[3]?c(i[4]):!0,m=p===`true`||p===`false`||p===`null`?JSON.parse(p):p;d&&(n.call(a,f)?Array.isArray(a[f])||(a[f]=[a[f]]):a[f]=[]),Array.isArray(a[f])?a[f].push(m):a[f]=m}let d=[];for(let e of Object.keys(r)){if(!n.call(r,e)||typeof r[e]!=`object`||Array.isArray(r[e]))continue;let t=i(e,`.`);a=r;let o=t.pop(),s=o.replace(/\\\./g,`.`);for(let e of t)e!==`__proto__`&&((!n.call(a,e)||typeof a[e]!=`object`)&&(a[e]=Object.create(null)),a=a[e]);a===r&&s===o||(a[s]=r[e],d.push(e))}for(let e of d)delete r[e];return r},o=e=>e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`),s=e=>typeof e!=`string`||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&o(e)||e!==e.trim()?JSON.stringify(e):e.split(`;`).join(`\\;`).split(`#`).join(`\\#`),c=e=>{if(e=(e||``).trim(),o(e)){e.charAt(0)===`'`&&(e=e.slice(1,-1));try{e=JSON.parse(e)}catch{}}else{let t=!1,n=``;for(let r=0,i=e.length;r<i;r++){let i=e.charAt(r);if(t)`\\;#`.indexOf(i)===-1?n+=`\\`+i:n+=i,t=!1;else if(`;#`.indexOf(i)!==-1)break;else i===`\\`?t=!0:n+=i}return t&&(n+=`\\`),n.trim()}return e};t.exports={parse:a,decode:a,stringify:r,encode:r,safe:s,unsafe:c}}))();const FD=Dx({Name:G,Path:G,IsRelative:gx(G)}),ID=e=>Object.values((0,PD.parse)(e)).map(e=>lx(FD)(e)).filter(e=>e._tag===`Some`).map(e=>({name:e.value.Name,path:e.value.Path,isRelative:e.value.IsRelative!==`0`}));var LD=class extends A()(`@cookies/FirefoxPlatform`){static layerDarwin=Ed(this,{dataDir:n.join(u.homedir(),jE.dataDir.darwin),executablePaths:[jE.executable.darwin]});static layerLinux=Ed(this,{dataDir:n.join(u.homedir(),jE.dataDir.linux),executablePaths:jE.executable.linux});static layerWin32=Ed(this,{dataDir:n.join(u.homedir(),jE.dataDir.win32),executablePaths:jE.executable.win32.flatMap(e=>{let t=process.env.ProgramFiles??`C:\\Program Files`,r=process.env[`ProgramFiles(x86)`]??`C:\\Program Files (x86)`;return[n.join(t,e),n.join(r,e)]})})},RD=class extends A()(`@cookies/FirefoxSource`,{make:L(function*(){let e=yield*kD,t=yield*LD,r=yield*sC;yield*e.register(L(function*(){let e;for(let n of t.executablePaths)if(yield*r.exists(n)){e=n;break}if(!e)return[];let i=n.join(t.dataDir,`profiles.ini`);return yield*np(ID(yield*r.readFileString(i)),e=>L(function*(){let i=e.isRelative?n.join(t.dataDir,e.path):e.path,a=n.join(i,`cookies.sqlite`);if(yield*r.exists(a))return new pT({profileName:n.basename(i),profilePath:i})}),{concurrency:`unbounded`}).pipe(B(e=>e.filter(Se)))}).pipe(Sp(e=>new sT({cause:String(e)}).asEffect())))})}){static layer=jd(this.make)},zD=class extends A()(`@cookies/SafariPlatform`){static layerDarwin=Ed(this,{executable:ME.executable,cookieRelativePaths:ME.cookieRelativePaths})},BD=class extends A()(`@cookies/SafariSource`,{make:L(function*(){let e=yield*kD,t=yield*zD,r=yield*sC;yield*e.register(L(function*(){if(!(yield*r.exists(t.executable)))return[];let e=D();for(let i of t.cookieRelativePaths){let t=n.join(u.homedir(),i,`Cookies.binarycookies`);if(yield*r.exists(t)){e=O(t);break}}return[new mT({cookieFilePath:e})]}).pipe(Cp(`PlatformError`,e=>new sT({cause:String(e)}).asEffect())))})}){static layer=jd(this.make)};const VD=kD.layer,HD=Pd(VD,ND.layer.pipe(P(VD),P(MD.layerDarwin),P(s.layer)),RD.layer.pipe(P(VD),P(LD.layerDarwin),P(s.layer)),BD.layer.pipe(P(VD),P(zD.layerDarwin),P(s.layer))),UD=Pd(VD,ND.layer.pipe(P(VD),P(MD.layerLinux),P(s.layer)),RD.layer.pipe(P(VD),P(LD.layerLinux),P(s.layer))),WD=Pd(VD,ND.layer.pipe(P(VD),P(MD.layerWin32),P(s.layer)),RD.layer.pipe(P(VD),P(LD.layerWin32),P(s.layer))),GD=Md(I(()=>{let e=u.platform();return e===`darwin`?HD:e===`win32`?WD:UD})),KD=[`--enable-webgl`,`--use-gl=angle`,`--use-angle=swiftshader`,`--ignore-gpu-blocklist`],qD=new Set([`button`,`link`,`textbox`,`checkbox`,`radio`,`combobox`,`listbox`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`searchbox`,`slider`,`spinbutton`,`switch`,`tab`,`treeitem`]),JD=new Set([`heading`,`cell`,`gridcell`,`columnheader`,`rowheader`,`listitem`,`article`,`region`,`main`,`navigation`]),YD=`__expect_annotation_overlay__`;var XD=class extends q(`BrowserLaunchError`)({_tag:K(`BrowserLaunchError`),cause:G}){message=`Failed to launch browser: ${this.cause}`},ZD=class extends q(`SnapshotTimeoutError`)({_tag:K(`SnapshotTimeoutError`),selector:G,timeoutMs:Cx,cause:G}){message=`Snapshot timed out after ${this.timeoutMs}ms on selector "${this.selector}": ${this.cause}`},QD=class extends q(`RefNotFoundError`)({_tag:K(`RefNotFoundError`),ref:G,availableRefs:jx(G)}){message=this.availableRefs.length===0?`Unknown ref "${this.ref}" (no refs available — page may be empty)`:`Unknown ref "${this.ref}" (available refs: ${this.availableRefs.join(`, `)})`},$D=class extends q(`RefAmbiguousError`)({_tag:K(`RefAmbiguousError`),ref:G,matchCount:G}){message=`Ref "${this.ref}" matched ${this.matchCount} elements. Run snapshot to get updated refs.`},eO=class extends q(`RefBlockedError`)({_tag:K(`RefBlockedError`),ref:G}){message=`Ref "${this.ref}" is blocked by an overlay. Dismiss any modals or banners first.`},tO=class extends q(`RefNotVisibleError`)({_tag:K(`RefNotVisibleError`),ref:G}){message=`Ref "${this.ref}" is not visible. Try scrolling it into view.`},nO=class extends q(`ActionTimeoutError`)({_tag:K(`ActionTimeoutError`),ref:G}){message=`Action on "${this.ref}" timed out. The element may be blocked or still loading. Run snapshot to check.`},rO=class extends q(`ActionUnknownError`)({_tag:K(`ActionUnknownError`),ref:G,cause:G}){message=`Action on "${this.ref}" failed: ${this.cause}`},iO=class extends q(`NavigationError`)({_tag:K(`NavigationError`),url:G,cause:G}){message=`Navigation to "${this.url}" failed: ${this.cause}`},aO=class extends q(`RecorderInjectionError`)({_tag:K(`RecorderInjectionError`),cause:G}){message=`Failed to inject rrweb recorder: ${this.cause}`},oO=class extends q(`SessionLoadError`)({_tag:K(`SessionLoadError`),path:G,cause:G}){message=`Failed to load session from ${this.path}: ${this.cause}`};const sO=/resolved to (\d+) elements/,cO=/Timeout \d+ms exceeded/,lO=[`strict mode violation`],uO=[`intercepts pointer events`],dO=[`Element is not visible`,`Element is outside of the viewport`,`element is not visible`,`element is outside of the viewport`,`to be visible`,`Element is not stable`,`element is not stable`,`Element(s) not found`,`Element is not attached to the DOM`,`Element is not connected`,`No element matching`,`Failed to find element matching selector`,`not attached`],fO=(e,t)=>t.some(t=>e.includes(t)),pO=(e,t)=>{let n=e instanceof Error?e.message:String(e);if(fO(n,lO)){let e=sO.exec(n);return new $D({matchCount:e?e[1]:`multiple`,ref:t})}return fO(n,uO)?new eO({ref:t}):fO(n,dO)?new tO({ref:t}):cO.test(n)?new nO({ref:t}):new rO({ref:t,cause:n})},mO=e=>{let t=0;for(;t<e.length&&e[t]===` `;)t++;return Math.floor(t/2)},hO=e=>e.includes(`[ref=`)||e.includes(`:`)&&!e.endsWith(`:`),gO=e=>{let t=e.split(`
27
+ `),n=t.map(mO),r=Array(t.length).fill(!1),i=[];for(let e=t.length-1;e>=0;e--)if(hO(t[e])){r[e]=!0,i.length=0;for(let t=e-1;t>=0;t--)if(!(n[t]>=n[e])){if(r[t])break;r[t]=!0,i.push(t)}}return t.filter((e,t)=>r[t]).join(`
28
+ `)},_O=(e,t)=>{if(t.selector)return e.locator(t.selector);let n=e.getByRole(t.role,{name:t.name,exact:!0});return t.nth===void 0?n:n.nth(t.nth)},vO=(e,t)=>H(`Browser.resolveRef`)(function*(n){let r=t[n];return r?_O(e,r):yield*new QD({ref:n,availableRefs:Object.keys(t)})}),yO=(e,t,...n)=>ip(()=>e.evaluate(({method:e,args:t})=>{let n=Reflect.get(globalThis,`__EXPECT_RUNTIME__`);if(!n||typeof n!=`object`)throw Error(`Browser runtime is not initialized`);let r=Reflect.get(n,e);if(typeof r!=`function`)throw Error(`Browser runtime method not found: ${e}`);return r(...t)},{method:t,args:n})),bO=[`a`,`button`,`input`,`select`,`textarea`,`details`,`summary`],xO=H(`findCursorInteractive`)(function*(e,t){return yield*yO(e,`findCursorInteractiveElements`,t||`body`,100,[...qD],bO,100)}),SO=/- (\w+)\s*(?:"((?:[^"\\]|\\.)*)")?/,CO=e=>{let t=SO.exec(e);if(!t)return D();let n=t[1];return n===`text`?D():O({role:n,name:t[2]?.replace(/\\(.)/g,`$1`)??``})},wO=(e,t)=>`${e}|${t}`,TO=e=>{let t=new Map;for(let[n,r]of Object.entries(e)){let e=wO(r.role,r.name),i=t.get(e);i?i.push(n):t.set(e,[n])}for(let n of t.values())if(!(n.length<=1))for(let t=0;t<n.length;t++)e[n[t]].nth=t},EO=(e,t)=>{let n=Object.values(t);return{lines:e.split(`
29
+ `).length,characters:e.length,estimatedTokens:Math.ceil(e.length/4),totalRefs:n.length,interactiveRefs:n.filter(e=>qD.has(e.role)).length}},DO=Pd(GD,gD.layer),OO=(e,t,n)=>qD.has(e)?!0:n?!1:JD.has(e)&&t.length>0,kO=e=>new XD({cause:e instanceof Error?e.message:String(e)}),AO=H(`Browser.resolveDefaultBrowserContext`)(function*(){return{preferredProfile:yr(yield*(yield*kD).defaultBrowser().pipe(Cp(`ListBrowsersError`,()=>F(D()))))}},Up(GD)),jO=H(`Browser.extractCookiesForProfile`)(function*(e,t){return yield*e.extract(t)},wp({ExtractionError:()=>F([]),PlatformError:pp})),MO=(e,t)=>e._tag===t._tag?e._tag===`ChromiumBrowser`&&t._tag===`ChromiumBrowser`?e.key===t.key&&e.profilePath!==t.profilePath:e._tag===`FirefoxBrowser`&&t._tag===`FirefoxBrowser`?e.profilePath!==t.profilePath:!1:!1,NO=H(`Browser.extractDefaultBrowserCookies`)(function*(e,t){if(!t)return[];let n=yield*gD;return di((yield*np([t,...(yield*(yield*kD).list.pipe(Cp(`ListBrowsersError`,()=>F([])))).filter(e=>MO(e,t))],e=>jO(n,e),{concurrency:`unbounded`})).flat(),(e,t)=>e.name===t.name&&e.domain===t.domain&&e.path===t.path)},Up(DO)),PO=H(`Browser.appendCursorInteractive`)(function*(e,t,n,r,i){let a=yield*xO(e,i.selector);if(a.length===0)return r;let o=new Set(Object.values(n).map(e=>e.name.toLowerCase())),s=[];for(let e of a){if(o.has(e.text.toLowerCase()))continue;o.add(e.text.toLowerCase());let t=`e${++r}`;n[t]={role:`clickable`,name:e.text,selector:e.selector},s.push(`- clickable "${e.text}" [ref=${t}] [${e.reason}]`)}return s.length>0&&(t.push(`# Cursor-interactive elements:`),t.push(...s)),r}),FO=(e,t)=>yO(e,`injectOverlayLabels`,YD,t);var IO=class extends A()(`@browser/Browser`,{make:L(function*(){let e=H(`Browser.createPage`)(function*(e,t={}){yield*sm({url:e??`about:blank`});let n=yield*ap({try:()=>g.launch({headless:!t.headed,executablePath:t.executablePath,args:t.headed?[]:KD}),catch:kO});return yield*L(function*(){let r=t.cookies===!0?yield*AO():{preferredProfile:void 0},i=r.preferredProfile?._tag===`ChromiumBrowser`?r.preferredProfile.locale:void 0,a={};i&&(a.locale=i),t.videoOutputDir&&(a.recordVideo={dir:t.videoOutputDir,size:{width:960,height:540}});let o=yield*ap({try:()=>n.newContext(a),catch:kO});if(yield*ap({try:()=>o.addInitScript('"use strict";var __EXPECT_RUNTIME__=(()=>{var Cr=Object.defineProperty;var ra=Object.getOwnPropertyDescriptor;var sa=Object.getOwnPropertyNames;var ia=Object.prototype.hasOwnProperty;var na=(s,e)=>{for(var t in e)Cr(s,t,{get:e[t],enumerable:!0})},oa=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of sa(e))!ia.call(s,i)&&i!==t&&Cr(s,i,{get:()=>e[i],enumerable:!(r=ra(e,i))||r.enumerable});return s};var aa=s=>oa(Cr({},"__esModule",{value:!0}),s);var od={};na(od,{findCursorInteractiveElements:()=>ed,getAllEvents:()=>id,getEventCount:()=>nd,getEvents:()=>sd,getPerformanceMetrics:()=>Kf,injectOverlayLabels:()=>Qf,removeOverlay:()=>qf,startRecording:()=>td,stopRecording:()=>rd});var la=new Set(["role","name","aria-label","rel","href"]);function ua(s,e){let t=la.has(s);t||(t=s.startsWith("data-")&&Be(s));let r=Be(e)&&e.length<100;return r||(r=e.startsWith("#")&&Be(e.slice(1))),t&&r}function ca(s){return Be(s)}function ha(s){return Be(s)}function fa(s){return!0}function si(s,e){if(s.nodeType!==Node.ELEMENT_NODE)throw new Error("Can\'t generate CSS selector for non-element node type.");if(s.tagName.toLowerCase()==="html")return"html";let t={root:document.body,idName:ca,className:ha,tagName:fa,attr:ua,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},r=new Date,i={...t,...e},n=ya(i.root,t),o,l=0;for(let u of da(s,i,n)){if(new Date().getTime()-r.getTime()>i.timeoutMs||l>=i.maxNumberOfPathChecks){let h=ma(s,n);if(!h)throw new Error(`Timeout: Can\'t find a unique selector after ${i.timeoutMs}ms`);return We(h)}if(l++,xr(u,n)){o=u;break}}if(!o)throw new Error("Selector was not found.");let a=[...oi(o,s,i,n,r)];return a.sort(Er),a.length>0?We(a[0]):We(o)}function*da(s,e,t){let r=[],i=[],n=s,o=0;for(;n&&n!==t;){let l=pa(n,e);for(let a of l)a.level=o;if(r.push(l),n=n.parentElement,o++,i.push(...ni(r)),o>=e.seedMinLength){i.sort(Er);for(let a of i)yield a;i=[]}}i.sort(Er);for(let l of i)yield l}function Be(s){if(/^[a-z\\-]{3,}$/i.test(s)){let e=s.split(/-|[A-Z]/);for(let t of e)if(t.length<=2||/[^aeiou]{4,}/i.test(t))return!1;return!0}return!1}function pa(s,e){let t=[],r=s.getAttribute("id");r&&e.idName(r)&&t.push({name:"#"+CSS.escape(r),penalty:0});for(let o=0;o<s.classList.length;o++){let l=s.classList[o];e.className(l)&&t.push({name:"."+CSS.escape(l),penalty:1})}for(let o=0;o<s.attributes.length;o++){let l=s.attributes[o];e.attr(l.name,l.value)&&t.push({name:`[${CSS.escape(l.name)}="${CSS.escape(l.value)}"]`,penalty:2})}let i=s.tagName.toLowerCase();if(e.tagName(i)){t.push({name:i,penalty:5});let o=Ir(s,i);o!==void 0&&t.push({name:ii(i,o),penalty:10})}let n=Ir(s);return n!==void 0&&t.push({name:ga(i,n),penalty:50}),t}function We(s){let e=s[0],t=e.name;for(let r=1;r<s.length;r++){let i=s[r].level||0;e.level===i-1?t=`${s[r].name} > ${t}`:t=`${s[r].name} ${t}`,e=s[r]}return t}function ri(s){return s.map(e=>e.penalty).reduce((e,t)=>e+t,0)}function Er(s,e){return ri(s)-ri(e)}function Ir(s,e){let t=s.parentNode;if(!t)return;let r=t.firstChild;if(!r)return;let i=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(e===void 0||r.tagName.toLowerCase()===e)&&i++,r!==s);)r=r.nextSibling;return i}function ma(s,e){let t=0,r=s,i=[];for(;r&&r!==e;){let n=r.tagName.toLowerCase(),o=Ir(r,n);if(o===void 0)return;i.push({name:ii(n,o),penalty:NaN,level:t}),r=r.parentElement,t++}if(xr(i,e))return i}function ga(s,e){return s==="html"?"html":`${s}:nth-child(${e})`}function ii(s,e){return s==="html"?"html":`${s}:nth-of-type(${e})`}function*ni(s,e=[]){if(s.length>0)for(let t of s[0])yield*ni(s.slice(1,s.length),e.concat(t));else yield e}function ya(s,e){return s.nodeType===Node.DOCUMENT_NODE?s:s===e.root?s.ownerDocument:s}function xr(s,e){let t=We(s);switch(e.querySelectorAll(t).length){case 0:throw new Error(`Can\'t select any node with this selector: ${t}`);case 1:return!0;default:return!1}}function*oi(s,e,t,r,i){if(s.length>2&&s.length>t.optimizedMinLength)for(let n=1;n<s.length-1;n++){if(new Date().getTime()-i.getTime()>t.timeoutMs)return;let l=[...s];l.splice(n,1),xr(l,r)&&r.querySelector(We(l))===e&&(yield l,yield*oi(l,e,t,r,i))}}var wa=Object.defineProperty,ba=(s,e,t)=>e in s?wa(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,w=(s,e,t)=>ba(s,typeof e!="symbol"?e+"":e,t),ai,Sa=Object.defineProperty,va=(s,e,t)=>e in s?Sa(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,li=(s,e,t)=>va(s,typeof e!="symbol"?e+"":e,t),j=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(j||{}),ui={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ci={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},pt={},Ca=()=>!!globalThis.Zone;function As(s){if(pt[s])return pt[s];let e=globalThis[s],t=e.prototype,r=s in ui?ui[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),n=s in ci?ci[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!Ca())return pt[s]=e.prototype,e.prototype;try{let l=document.createElement("iframe");document.body.appendChild(l);let a=l.contentWindow;if(!a)return e.prototype;let u=a[s].prototype;return document.body.removeChild(l),u?pt[s]=u:t}catch{return t}}var Mr={};function fe(s,e,t){var r;let i=`${s}.${String(t)}`;if(Mr[i])return Mr[i].call(e);let n=As(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(Mr[i]=o,o.call(e)):e[t]}var Nr={};function on(s,e,t){let r=`${s}.${String(t)}`;if(Nr[r])return Nr[r].bind(e);let n=As(s)[t];return typeof n!="function"?e[t]:(Nr[r]=n,n.bind(e))}function Ea(s){return fe("Node",s,"ownerDocument")}function Ia(s){return fe("Node",s,"childNodes")}function xa(s){return fe("Node",s,"parentNode")}function Ma(s){return fe("Node",s,"parentElement")}function Na(s){return fe("Node",s,"textContent")}function Ra(s,e){return on("Node",s,"contains")(e)}function Aa(s){return on("Node",s,"getRootNode")()}function Oa(s){return!s||!("host"in s)?null:fe("ShadowRoot",s,"host")}function Da(s){return s.styleSheets}function Ta(s){return!s||!("shadowRoot"in s)?null:fe("Element",s,"shadowRoot")}function _a(s,e){return fe("Element",s,"querySelector")(e)}function ka(s,e){return fe("Element",s,"querySelectorAll")(e)}function Pa(){return As("MutationObserver").constructor}function $a(s,e,t){try{if(!(e in s))return()=>{};let r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}var Y={ownerDocument:Ea,childNodes:Ia,parentNode:xa,parentElement:Ma,textContent:Na,contains:Ra,getRootNode:Aa,host:Oa,styleSheets:Da,shadowRoot:Ta,querySelector:_a,querySelectorAll:ka,mutationObserver:Pa,patch:$a};function an(s){return s.nodeType===s.ELEMENT_NODE}function Ye(s){let e=s&&"host"in s&&"mode"in s&&Y.host(s)||null;return!!(e&&"shadowRoot"in e&&Y.shadowRoot(e)===s)}function Ze(s){return Object.prototype.toString.call(s)==="[object ShadowRoot]"}function La(s){return s.includes(" background-clip: text;")&&!s.includes(" -webkit-background-clip: text;")&&(s=s.replace(/\\sbackground-clip:\\s*text;/g," -webkit-background-clip: text; background-clip: text;")),s}function Fa(s){let{cssText:e}=s;if(e.split(\'"\').length<3)return e;let t=["@import",`url(${JSON.stringify(s.href)})`];return s.layerName===""?t.push("layer"):s.layerName&&t.push(`layer(${s.layerName})`),s.supportsText&&t.push(`supports(${s.supportsText})`),s.media.length&&t.push(s.media.mediaText),t.join(" ")+";"}function Br(s){try{let e=s.rules||s.cssRules;if(!e)return null;let t=s.href;!t&&s.ownerNode&&(t=s.ownerNode.baseURI);let r=Array.from(e,i=>ln(i,t)).join("");return La(r)}catch{return null}}function ln(s,e){if(Ba(s)){let t;try{t=Br(s.styleSheet)||Fa(s)}catch{t=s.cssText}return s.styleSheet.href?Ht(t,s.styleSheet.href):t}else{let t=s.cssText;return Wa(s)&&s.selectorText.includes(":")&&(t=Ua(t)),e?Ht(t,e):t}}function Ua(s){let e=/(\\[(?:[\\w-]+)[^\\\\])(:(?:[\\w-]+)\\])/gm;return s.replace(e,"$1\\\\$2")}function Ba(s){return"styleSheet"in s}function Wa(s){return"selectorText"in s}var Vt=class{constructor(){li(this,"idNodeMap",new Map),li(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){let r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){let r=this.getNode(e);if(r){let i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function za(){return new Vt}function Gt({element:s,maskInputOptions:e,tagName:t,type:r,value:i,maskInputFn:n}){let o=i||"",l=r&&Se(r);return(e[t.toLowerCase()]||l&&e[l])&&(n?o=n(o,s):o="*".repeat(o.length)),o}function Se(s){return s.toLowerCase()}var hi="__rrweb_original__";function Va(s){let e=s.getContext("2d");if(!e)return!0;let t=50;for(let r=0;r<s.width;r+=t)for(let i=0;i<s.height;i+=t){let n=e.getImageData,o=hi in n?n[hi]:n;if(new Uint32Array(o.call(e,r,i,Math.min(t,s.width-r),Math.min(t,s.height-i)).data.buffer).some(a=>a!==0))return!1}return!0}function jt(s){let e=s.type;return s.hasAttribute("data-rr-is-password")?"password":e?Se(e):null}function un(s,e){let t;try{t=new URL(s,e??window.location.href)}catch{return null}let r=/\\.([0-9a-z]+)(?:$)/i,i=t.pathname.match(r);return i?.[1]??null}function Ga(s){let e="";return s.indexOf("//")>-1?e=s.split("/").slice(0,3).join("/"):e=s.split("/")[0],e=e.split("?")[0],e}var ja=/url\\((?:(\')([^\']*)\'|(")(.*?)"|([^)]*))\\)/gm,Ha=/^(?:[a-z+]+:)?\\/\\//i,Ya=/^www\\..*/i,Za=/^(data:)([^,]*),(.*)/i;function Ht(s,e){return(s||"").replace(ja,(t,r,i,n,o,l)=>{let a=i||o||l,u=r||n||"";if(!a)return t;if(Ha.test(a)||Ya.test(a))return`url(${u}${a}${u})`;if(Za.test(a))return`url(${u}${a}${u})`;if(a[0]==="/")return`url(${u}${Ga(e)+a}${u})`;let c=e.split("/"),h=a.split("/");c.pop();for(let p of h)p!=="."&&(p===".."?c.pop():c.push(p));return`url(${u}${c.join("/")}${u})`})}function mt(s,e=!1){return e?s.replace(/(\\/\\*[^*]*\\*\\/)|[\\s;]/g,""):s.replace(/(\\/\\*[^*]*\\*\\/)|[\\s;]/g,"").replace(/0px/g,"0")}function Xa(s,e,t=!1){let r=Array.from(e.childNodes),i=[],n=0;if(r.length>1&&s&&typeof s=="string"){let o=mt(s,t),l=o.length/s.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&typeof r[a].textContent=="string"){let u=mt(r[a].textContent,t),c=100,h=3;for(;h<u.length&&(u[h].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,h),1)!==-1);h++);for(;h<u.length;h++){let p=u.substring(0,h),g=o.split(p),m=-1;if(g.length===2)m=g[0].length;else if(g.length>2&&g[0]===""&&r[a-1].textContent!=="")m=o.indexOf(p,1);else if(g.length===1){if(p=p.substring(0,p.length-1),g=o.split(p),g.length<=1)return i.push(s),i;h=c+1}else h===u.length-1&&(m=o.indexOf(p));if(g.length>=2&&h>c){let d=r[a-1].textContent;if(d&&typeof d=="string"){let f=mt(d).length;m=o.indexOf(p,f)}m===-1&&(m=g[0].length)}if(m!==-1){let d=Math.floor(m/l);for(;d>0&&d<s.length;){if(n+=1,n>50*r.length)return i.push(s),i;let f=mt(s.substring(0,d),t);if(f.length===m){i.push(s.substring(0,d)),s=s.substring(d),o=o.substring(m);break}else f.length<m?d+=Math.max(1,Math.floor((m-f.length)/l)):d-=Math.max(1,Math.floor((f.length-m)*l))}break}}}}return i.push(s),i}function Ja(s,e){return Xa(s,e).join("/* rr_split */")}var Ka=1,Qa=new RegExp("[^a-z0-9-_:]"),Je=-2;function cn(){return Ka++}function qa(s){if(s instanceof HTMLFormElement)return"form";let e=Se(s.tagName);return Qa.test(e)?"div":e}var Ie,fi,el=/^[^ \\t\\n\\r\\u000c]+/,tl=/^[, \\t\\n\\r\\u000c]+/;function rl(s,e){if(e.trim()==="")return e;let t=0;function r(n){let o,l=n.exec(e.substring(t));return l?(o=l[0],t+=o.length,o):""}let i=[];for(;r(tl),!(t>=e.length);){let n=r(el);if(n.slice(-1)===",")n=Ne(s,n.substring(0,n.length-1)),i.push(n);else{let o="";n=Ne(s,n);let l=!1;for(;;){let a=e.charAt(t);if(a===""){i.push((n+o).trim());break}else if(l)a===")"&&(l=!1);else if(a===","){t+=1,i.push((n+o).trim());break}else a==="("&&(l=!0);o+=a,t+=1}}}return i.join(", ")}var di=new WeakMap;function Ne(s,e){return!e||e.trim()===""?e:Os(s,e)}function sl(s){return!!(s.tagName==="svg"||s.ownerSVGElement)}function Os(s,e){let t=di.get(s);if(t||(t=s.createElement("a"),di.set(s,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function hn(s,e,t,r){return r&&(t==="src"||t==="href"&&!(e==="use"&&r[0]==="#")||t==="xlink:href"&&r[0]!=="#"||t==="background"&&["table","td","th"].includes(e)?Ne(s,r):t==="srcset"?rl(s,r):t==="style"?Ht(r,Os(s)):e==="object"&&t==="data"?Ne(s,r):r)}function fn(s,e,t){return["video","audio"].includes(s)&&e==="autoplay"}function il(s,e,t){try{if(typeof e=="string"){if(s.classList.contains(e))return!0}else for(let r=s.classList.length;r--;){let i=s.classList[r];if(e.test(i))return!0}if(t)return s.matches(t)}catch{}return!1}function Yt(s,e,t){if(!s)return!1;if(s.nodeType!==s.ELEMENT_NODE)return t?Yt(Y.parentNode(s),e,t):!1;for(let r=s.classList.length;r--;){let i=s.classList[r];if(e.test(i))return!0}return t?Yt(Y.parentNode(s),e,t):!1}function dn(s,e,t,r){let i;if(an(s)){if(i=s,!Y.childNodes(i).length)return!1}else{if(Y.parentElement(s)===null)return!1;i=Y.parentElement(s)}try{if(typeof e=="string"){if(r){if(i.closest(`.${e}`))return!0}else if(i.classList.contains(e))return!0}else if(Yt(i,e,r))return!0;if(t){if(r){if(i.closest(t))return!0}else if(i.matches(t))return!0}}catch{}return!1}function nl(s,e,t){let r=s.contentWindow;if(!r)return;let i=!1,n;try{n=r.document.readyState}catch{return}if(n!=="complete"){let l=setTimeout(()=>{i||(e(),i=!0)},t);s.addEventListener("load",()=>{clearTimeout(l),i=!0,e()});return}let o="about:blank";if(r.location.href!==o||s.src===o||s.src==="")return setTimeout(e,0),s.addEventListener("load",e);s.addEventListener("load",e)}function ol(s,e,t){let r=!1,i;try{i=s.sheet}catch{return}if(i)return;let n=setTimeout(()=>{r||(e(),r=!0)},t);s.addEventListener("load",()=>{clearTimeout(n),r=!0,e()})}function al(s,e){let{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:c,dataURLOptions:h={},inlineImages:p,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:d=!1,cssCaptured:f=!1}=e,b=ll(t,r);switch(s.nodeType){case s.DOCUMENT_NODE:return s.compatMode!=="CSS1Compat"?{type:j.Document,childNodes:[],compatMode:s.compatMode}:{type:j.Document,childNodes:[]};case s.DOCUMENT_TYPE_NODE:return{type:j.DocumentType,name:s.name,publicId:s.publicId,systemId:s.systemId,rootId:b};case s.ELEMENT_NODE:return cl(s,{doc:t,blockClass:i,blockSelector:n,inlineStylesheet:l,maskInputOptions:a,maskInputFn:c,dataURLOptions:h,inlineImages:p,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:d,rootId:b});case s.TEXT_NODE:return ul(s,{doc:t,needsMask:o,maskTextFn:u,rootId:b,cssCaptured:f});case s.CDATA_SECTION_NODE:return{type:j.CDATA,textContent:"",rootId:b};case s.COMMENT_NODE:return{type:j.Comment,textContent:Y.textContent(s)||"",rootId:b};default:return!1}}function ll(s,e){if(!e.hasNode(s))return;let t=e.getId(s);return t===1?void 0:t}function ul(s,e){let{needsMask:t,maskTextFn:r,rootId:i,cssCaptured:n}=e,o=Y.parentNode(s),l=o&&o.tagName,a="",u=l==="STYLE"?!0:void 0,c=l==="SCRIPT"?!0:void 0;return c?a="SCRIPT_PLACEHOLDER":n||(a=Y.textContent(s),u&&a&&(a=Ht(a,Os(e.doc)))),!u&&!c&&a&&t&&(a=r?r(a,Y.parentElement(s)):a.replace(/[\\S]/g,"*")),{type:j.Text,textContent:a||"",rootId:i}}function cl(s,e){let{doc:t,blockClass:r,blockSelector:i,inlineStylesheet:n,maskInputOptions:o={},maskInputFn:l,dataURLOptions:a={},inlineImages:u,recordCanvas:c,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:g}=e,m=il(s,r,i),d=qa(s),f={},b=s.attributes.length;for(let y=0;y<b;y++){let v=s.attributes[y];fn(d,v.name,v.value)||(f[v.name]=hn(t,d,Se(v.name),v.value))}if(d==="link"&&n){let y=Array.from(t.styleSheets).find(N=>N.href===s.href),v=null;y&&(v=Br(y)),v&&(delete f.rel,delete f.href,f._cssText=v)}if(d==="style"&&s.sheet){let y=Br(s.sheet);y&&(s.childNodes.length>1&&(y=Ja(y,s)),f._cssText=y)}if(["input","textarea","select"].includes(d)){let y=s.value,v=s.checked;f.type!=="radio"&&f.type!=="checkbox"&&f.type!=="submit"&&f.type!=="button"&&y?f.value=Gt({element:s,type:jt(s),tagName:d,value:y,maskInputOptions:o,maskInputFn:l}):v&&(f.checked=v)}if(d==="option"&&(s.selected&&!o.select?f.selected=!0:delete f.selected),d==="dialog"&&s.open&&(f.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal"),d==="canvas"&&c){if(s.__context==="2d")Va(s)||(f.rr_dataURL=s.toDataURL(a.type,a.quality));else if(!("__context"in s)){let y=s.toDataURL(a.type,a.quality),v=t.createElement("canvas");v.width=s.width,v.height=s.height;let N=v.toDataURL(a.type,a.quality);y!==N&&(f.rr_dataURL=y)}}if(d==="img"&&u){Ie||(Ie=t.createElement("canvas"),fi=Ie.getContext("2d"));let y=s,v=y.currentSrc||y.getAttribute("src")||"<unknown-src>",N=y.crossOrigin,T=()=>{y.removeEventListener("load",T);try{Ie.width=y.naturalWidth,Ie.height=y.naturalHeight,fi.drawImage(y,0,0),f.rr_dataURL=Ie.toDataURL(a.type,a.quality)}catch(V){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?T():y.addEventListener("load",T);return}else console.warn(`Cannot inline img src=${v}! Error: ${V}`)}y.crossOrigin==="anonymous"&&(N?f.crossOrigin=N:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?T():y.addEventListener("load",T)}if(["audio","video"].includes(d)){let y=f;y.rr_mediaState=s.paused?"paused":"played",y.rr_mediaCurrentTime=s.currentTime,y.rr_mediaPlaybackRate=s.playbackRate,y.rr_mediaMuted=s.muted,y.rr_mediaLoop=s.loop,y.rr_mediaVolume=s.volume}if(p||(s.scrollLeft&&(f.rr_scrollLeft=s.scrollLeft),s.scrollTop&&(f.rr_scrollTop=s.scrollTop)),m){let{width:y,height:v}=s.getBoundingClientRect();f={class:f.class,rr_width:`${y}px`,rr_height:`${v}px`}}d==="iframe"&&!h(f.src)&&(s.contentDocument||(f.rr_src=f.src),delete f.src);let S;try{customElements.get(d)&&(S=!0)}catch{}return{type:j.Element,tagName:d,attributes:f,childNodes:[],isSVG:sl(s)||void 0,needBlock:m,rootId:g,isCustom:S}}function _(s){return s==null?"":s.toLowerCase()}function pn(s){return s===!0||s==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:s==="all",headMetaDescKeywords:s==="all",headTitleMutations:s==="all"}:s||{}}function hl(s,e){if(e.comment&&s.type===j.Comment)return!0;if(s.type===j.Element){if(e.script&&(s.tagName==="script"||s.tagName==="link"&&(s.attributes.rel==="preload"&&s.attributes.as==="script"||s.attributes.rel==="modulepreload")||s.tagName==="link"&&s.attributes.rel==="prefetch"&&typeof s.attributes.href=="string"&&un(s.attributes.href)==="js"))return!0;if(e.headFavicon&&(s.tagName==="link"&&s.attributes.rel==="shortcut icon"||s.tagName==="meta"&&(_(s.attributes.name).match(/^msapplication-tile(image|color)$/)||_(s.attributes.name)==="application-name"||_(s.attributes.rel)==="icon"||_(s.attributes.rel)==="apple-touch-icon"||_(s.attributes.rel)==="shortcut icon")))return!0;if(s.tagName==="meta"){if(e.headMetaDescKeywords&&_(s.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(_(s.attributes.property).match(/^(og|twitter|fb):/)||_(s.attributes.name).match(/^(og|twitter):/)||_(s.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(_(s.attributes.name)==="robots"||_(s.attributes.name)==="googlebot"||_(s.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&s.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(_(s.attributes.name)==="author"||_(s.attributes.name)==="generator"||_(s.attributes.name)==="framework"||_(s.attributes.name)==="publisher"||_(s.attributes.name)==="progid"||_(s.attributes.property).match(/^article:/)||_(s.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(_(s.attributes.name)==="google-site-verification"||_(s.attributes.name)==="yandex-verification"||_(s.attributes.name)==="csrf-token"||_(s.attributes.name)==="p:domain_verify"||_(s.attributes.name)==="verify-v1"||_(s.attributes.name)==="verification"||_(s.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Re(s,e){let{doc:t,mirror:r,blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m={},inlineImages:d=!1,recordCanvas:f=!1,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:N=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:V=!1,cssCaptured:$=!1}=e,{needsMask:z}=e,{preserveWhiteSpace:H=!0}=e;z||(z=dn(s,o,l,z===void 0));let Q=al(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:z,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,dataURLOptions:m,inlineImages:d,recordCanvas:f,keepIframeSrcFn:T,newlyAddedElement:V,cssCaptured:$});if(!Q)return console.warn(s,"not serialized"),null;let ne;r.hasNode(s)?ne=r.getId(s):hl(Q,g)||!H&&Q.type===j.Text&&!Q.textContent.replace(/^\\s+|\\s+$/gm,"").length?ne=Je:ne=cn();let M=Object.assign(Q,{id:ne});if(r.add(s,M),ne===Je)return null;b&&b(s);let Fe=!a;if(M.type===j.Element){Fe=Fe&&!M.needBlock,delete M.needBlock;let G=Y.shadowRoot(s);G&&Ze(G)&&(M.isShadowHost=!0)}if((M.type===j.Document||M.type===j.Element)&&Fe){g.headWhitespace&&M.type===j.Element&&M.tagName==="head"&&(H=!1);let G={doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m,inlineImages:d,recordCanvas:f,preserveWhiteSpace:H,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:N,keepIframeSrcFn:T,cssCaptured:!1};if(!(M.type===j.Element&&M.tagName==="textarea"&&M.attributes.value!==void 0)){M.type===j.Element&&M.attributes._cssText!==void 0&&typeof M.attributes._cssText=="string"&&(G.cssCaptured=!0);for(let ge of Array.from(Y.childNodes(s))){let oe=Re(ge,G);oe&&M.childNodes.push(oe)}}let q=null;if(an(s)&&(q=Y.shadowRoot(s)))for(let ge of Array.from(Y.childNodes(q))){let oe=Re(ge,G);oe&&(Ze(q)&&(oe.isShadow=!0),M.childNodes.push(oe))}}let Ue=Y.parentNode(s);return Ue&&Ye(Ue)&&Ze(Ue)&&(M.isShadow=!0),M.type===j.Element&&M.tagName==="iframe"&&nl(s,()=>{let G=s.contentDocument;if(G&&S){let q=Re(G,{doc:G,mirror:r,blockClass:i,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m,inlineImages:d,recordCanvas:f,preserveWhiteSpace:H,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:N,keepIframeSrcFn:T});q&&S(s,q)}},y),M.type===j.Element&&M.tagName==="link"&&typeof M.attributes.rel=="string"&&(M.attributes.rel==="stylesheet"||M.attributes.rel==="preload"&&typeof M.attributes.href=="string"&&un(M.attributes.href)==="css")&&ol(s,()=>{if(v){let G=Re(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:g,dataURLOptions:m,inlineImages:d,recordCanvas:f,preserveWhiteSpace:H,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:v,stylesheetLoadTimeout:N,keepIframeSrcFn:T});G&&v(s,G)}},N),M}function fl(s,e){let{mirror:t=new Vt,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:n="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:h,maskInputFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:d,onSerialize:f,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:N=()=>!1}=e||{},T=c===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:c===!1?{password:!0}:c,V=pn(g);return Re(s,{doc:s,mirror:t,blockClass:r,blockSelector:i,maskTextClass:n,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:T,maskTextFn:h,maskInputFn:p,slimDOMOptions:V,dataURLOptions:m,inlineImages:a,recordCanvas:u,preserveWhiteSpace:d,onSerialize:f,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:v,keepIframeSrcFn:N,newlyAddedElement:!1})}var dl=/(max|min)-device-(width|height)/,ud=new RegExp(dl.source,"g");function pl(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function ml(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var Ds={exports:{}},k=String,mn=function(){return{isColorSupported:!1,reset:k,bold:k,dim:k,italic:k,underline:k,inverse:k,hidden:k,strikethrough:k,black:k,red:k,green:k,yellow:k,blue:k,magenta:k,cyan:k,white:k,gray:k,bgBlack:k,bgRed:k,bgGreen:k,bgYellow:k,bgBlue:k,bgMagenta:k,bgCyan:k,bgWhite:k}};Ds.exports=mn();Ds.exports.createColors=mn;var gl=Ds.exports,yl={},wl=Object.freeze(Object.defineProperty({__proto__:null,default:yl},Symbol.toStringTag,{value:"Module"})),se=ml(wl),pi=gl,mi=se,Wr=class gn extends Error{constructor(e,t,r,i,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),typeof t<"u"&&typeof r<"u"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,gn)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=pi.isColorSupported),mi&&e&&(t=mi(t));let r=t.split(/\\r?\\n/),i=Math.max(this.line-3,0),n=Math.min(this.line+2,r.length),o=String(n).length,l,a;if(e){let{bold:u,gray:c,red:h}=pi.createColors(!0);l=p=>u(h(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(i,n).map((u,c)=>{let h=i+1+c,p=" "+(" "+h).slice(-o)+" | ";if(h===this.line){let g=a(p.replace(/\\d/g," "))+u.slice(0,this.column-1).replace(/[^\\t]/g," ");return l(">")+a(p)+u+`\n `+g+l("^")}return" "+a(p)+u}).join(`\n`)}toString(){let e=this.showSourceCode();return e&&(e=`\n\n`+e+`\n`),this.name+": "+this.message+e}},Ts=Wr;Wr.default=Wr;var ot={};ot.isClean=Symbol("isClean");ot.my=Symbol("my");var gi={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function bl(s){return s[0].toUpperCase()+s.slice(1)}var zr=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,i=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?r+=e.raws.afterName:i&&(r+=" "),e.nodes)this.block(e,r+i);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+i+n,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let i=e.parent,n=0;for(;i&&i.type!=="root";)n+=1,i=i.parent;if(r.includes(`\n`)){let o=this.raw(e,null,"indent");if(o.length)for(let l=0;l<n;l++)r+=o}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let i;e.nodes&&e.nodes.length?(this.body(e),i=this.raw(e,"after")):i=this.raw(e,"after","emptyBody"),i&&this.builder(i),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let i=0;i<e.nodes.length;i++){let n=e.nodes[i],o=this.raw(n,"before");o&&this.builder(o),this.stringify(n,t!==i||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),i=e.prop+r+this.rawValue(e,"value");e.important&&(i+=e.raws.important||" !important"),t&&(i+=";"),this.builder(i,e)}document(e){this.body(e)}raw(e,t,r){let i;if(r||(r=t),t&&(i=e.raws[t],typeof i<"u"))return i;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return gi[r];let o=e.root();if(o.rawCache||(o.rawCache={}),typeof o.rawCache[r]<"u")return o.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let l="raw"+bl(r);this[l]?i=this[l](o,e):o.walk(a=>{if(i=a.raws[t],typeof i<"u")return!1})}return typeof i>"u"&&(i=gi[r]),o.rawCache[r]=i,i}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return t=r.raws.after,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before<"u")return t=r.raws.before,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between<"u")return t=r.raws.between.replace(/[^\\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let i=r.parent;if(i&&i!==e&&i.parent&&i.parent===e&&typeof r.raws.before<"u"){let n=r.raws.before.split(`\n`);return t=n[n.length-1],t=t.replace(/\\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let r=e[t],i=e.raws[t];return i&&i.value===r?i.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}},yn=zr;zr.default=zr;var Sl=yn;function Vr(s,e){new Sl(e).stringify(s)}var or=Vr;Vr.default=Vr;var{isClean:gt,my:vl}=ot,Cl=Ts,El=yn,Il=or;function Gr(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let i=s[r],n=typeof i;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>Gr(o,t)):(n==="object"&&i!==null&&(i=Gr(i)),t[r]=i)}return t}var jr=class{constructor(e={}){this.raws={},this[gt]=!1,this[vl]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\\n\\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\\n\\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Gr(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:i}=this.rangeBy(t);return this.source.input.error(e,{column:i.column,line:i.line},{column:r.column,line:r.line},t)}return new Cl(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[gt]){this[gt]=!1;let e=this;for(;e=e.parent;)e[gt]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let i=t.indexOf(e.word);i!==-1&&(r=this.positionInside(i,t))}return r}positionInside(e,t){let r=t||this.toString(),i=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)r[o]===`\n`?(i=1,n+=1):i+=1;return{column:i,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let i=this.toString(),n=i.indexOf(e.word);n!==-1&&(t=this.positionInside(n,i),r=this.positionInside(n+e.word.length,i))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new El().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let i of e)i===this?r=!0:r?(this.parent.insertAfter(t,i),t=i):this.parent.insertBefore(t,i);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},i=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let l=this[o];if(Array.isArray(l))r[o]=l.map(a=>typeof a=="object"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l=="object"&&l.toJSON)r[o]=l.toJSON(null,t);else if(o==="source"){let a=t.get(l.input);a==null&&(a=n,t.set(l.input,n),n++),r[o]={end:l.end,inputId:a,start:l.start}}else r[o]=l}return i&&(r.inputs=[...t.keys()].map(o=>o.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=Il){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let i={node:this};for(let n in r)i[n]=r[n];return e.warn(t,i)}get proxyOf(){return this}},ar=jr;jr.default=jr;var xl=ar,Hr=class extends xl{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},lr=Hr;Hr.default=Hr;var Ml="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Nl=(s,e=21)=>(t=e)=>{let r="",i=t;for(;i--;)r+=s[Math.random()*s.length|0];return r},Rl=(s=21)=>{let e="",t=s;for(;t--;)e+=Ml[Math.random()*64|0];return e},Al={nanoid:Rl,customAlphabet:Nl},{SourceMapConsumer:yi,SourceMapGenerator:wi}=se,{existsSync:Ol,readFileSync:Dl}=se,{dirname:Rr,join:Tl}=se;function _l(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}var Yr=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Rr(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new yi(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\\/json;charset=utf-?8;base64,/,r=/^data:application\\/json;base64,/,i=/^data:application\\/json;charset=utf-?8,/,n=/^data:application\\/json,/;if(i.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return _l(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\\/\\*\\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\\/\\*\\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),i=e.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,i)))}loadFile(e){if(this.root=Rr(e),Ol(e))return this.mapFile=e,Dl(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(t instanceof yi)return wi.fromSourceMap(t).toString();if(t instanceof wi)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=Tl(Rr(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},wn=Yr;Yr.default=Yr;var{SourceMapConsumer:kl,SourceMapGenerator:Pl}=se,{fileURLToPath:bi,pathToFileURL:yt}=se,{isAbsolute:Zr,resolve:Xr}=se,{nanoid:$l}=Al,Ar=se,Si=Ts,Ll=wn,Or=Symbol("fromOffsetCache"),Fl=!!(kl&&Pl),vi=!!(Xr&&Zr),Zt=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\\uFEFF"||this.css[0]==="\\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!vi||/^\\w+:\\/\\//.test(t.from)||Zr(t.from)?this.file=t.from:this.file=Xr(t.from)),vi&&Fl){let r=new Ll(this.css,t);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+$l(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let n,o,l;if(t&&typeof t=="object"){let u=t,c=r;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);t=h.line,r=h.col}else t=u.line,r=u.column;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);o=h.line,l=h.col}else o=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,o,l);return a?n=new Si(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,i.plugin):n=new Si(e,o===void 0?t:{column:r,line:t},o===void 0?r:{column:l,line:o},this.css,this.file,i.plugin),n.input={column:r,endColumn:l,endLine:o,line:t,source:this.css},this.file&&(yt&&(n.input.url=yt(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[Or])r=this[Or];else{let n=this.css.split(`\n`);r=new Array(n.length);let o=0;for(let l=0,a=n.length;l<a;l++)r[l]=o,o+=n[l].length+1;this[Or]=r}t=r[r.length-1];let i=0;if(e>=t)i=r.length-1;else{let n=r.length-2,o;for(;i<n;)if(o=i+(n-i>>1),e<r[o])n=o-1;else if(e>=r[o+1])i=o+1;else{i=o;break}}return{col:e-r[i]+1,line:i+1}}mapResolve(e){return/^\\w+:\\/\\//.test(e)?e:Xr(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,i){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let l;typeof r=="number"&&(l=n.originalPositionFor({column:i,line:r}));let a;Zr(o.source)?a=yt(o.source):a=new URL(o.source,this.map.consumer().sourceRoot||yt(this.map.mapFile));let u={column:o.column,endColumn:l&&l.column,endLine:l&&l.line,line:o.line,url:a.toString()};if(a.protocol==="file:")if(bi)u.file=bi(a);else throw new Error("file: protocol is not available in this PostCSS build");let c=n.sourceContentFor(o.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},ur=Zt;Zt.default=Zt;Ar&&Ar.registerInput&&Ar.registerInput(Zt);var{SourceMapConsumer:bn,SourceMapGenerator:Lt}=se,{dirname:Ft,relative:Sn,resolve:vn,sep:Cn}=se,{pathToFileURL:Ci}=se,Ul=ur,Bl=!!(bn&&Lt),Wl=!!(Ft&&vn&&Sn&&Cn),zl=class{constructor(e,t,r,i){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`\n`;this.css.includes(`\\r\n`)&&(t=`\\r\n`),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||Ft(e.file),i;this.mapOpts.sourcesContent===!1?(i=new bn(e.text),i.sourcesContent&&(i.sourcesContent=null)):i=e.consumer(),this.map.applySourceMap(i,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\\n*?\\/\\*#[\\S\\s]*?\\*\\/$/gm,""))}generate(){if(this.clearAnnotation(),Wl&&Bl&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Lt.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Lt({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Lt({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!=="end"&&(i.generated.line=e,i.generated.column=t-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),n=l.match(/\\n/g),n?(e+=n.length,o=l.lastIndexOf(`\n`),t=l.length-o):t+=l.length,a&&u!=="start"){let c=a.parent||{raws:{}};(!(a.type==="decl"||a.type==="atrule"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=e,i.generated.column=t-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=e,i.generated.column=t-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\\w+:\\/\\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Ft(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Ft(vn(r,this.mapOpts.annotation)));let i=Sn(r,e);return this.memoizedPaths.set(e,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Ul(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Ci){let r=Ci(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;Cn==="\\\\"&&(e=e.replace(/\\\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},En=zl,Vl=ar,Jr=class extends Vl{constructor(e){super(e),this.type="comment"}},cr=Jr;Jr.default=Jr;var{isClean:In,my:xn}=ot,Mn=lr,Nn=cr,Gl=ar,Rn,_s,ks,An;function On(s){return s.map(e=>(e.nodes&&(e.nodes=On(e.nodes)),delete e.source,e))}function Dn(s){if(s[In]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)Dn(e)}var ce=class Tn extends Gl{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,i;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],i=e(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[t]+=1;return delete this.indexes[t],i}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(i=>typeof i=="function"?(n,o)=>i(n.toProxy(),o):i)):t==="every"||t==="some"?r=>e[t]((i,...n)=>r(i.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),i=r===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let l of n)this.proxyOf.nodes.splice(r,0,l);let o;for(let l in this.indexes)o=this.indexes[l],r<=o&&(this.indexes[l]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=On(Rn(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new Mn(e)]}else if(e.selector)e=[new _s(e)];else if(e.name)e=[new ks(e)];else if(e.text)e=[new Nn(e)];else throw new Error("Unknown node type in node creation");return e.map(i=>(i[xn]||Tn.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[In]&&Dn(i),typeof i.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(i.raws.before=t.raws.before.replace(/\\S/g,"")),i.parent=this.proxyOf,i))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(i=>{t.props&&!t.props.includes(i.prop)||t.fast&&!i.value.includes(t.fast)||(i.value=i.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let i;try{i=e(t,r)}catch(n){throw t.addToError(n)}return i!==!1&&t.walk&&(i=t.walk(e)),i})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="atrule")return t(r,i)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="decl")return t(r,i)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&e.test(r.selector))return t(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="rule")return t(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};ce.registerParse=s=>{Rn=s};ce.registerRule=s=>{_s=s};ce.registerAtRule=s=>{ks=s};ce.registerRoot=s=>{An=s};var ve=ce;ce.default=ce;ce.rebuild=s=>{s.type==="atrule"?Object.setPrototypeOf(s,ks.prototype):s.type==="rule"?Object.setPrototypeOf(s,_s.prototype):s.type==="decl"?Object.setPrototypeOf(s,Mn.prototype):s.type==="comment"?Object.setPrototypeOf(s,Nn.prototype):s.type==="root"&&Object.setPrototypeOf(s,An.prototype),s[xn]=!0,s.nodes&&s.nodes.forEach(e=>{ce.rebuild(e)})};var jl=ve,_n,kn,Ke=class extends jl{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new _n(new kn,this,e).stringify()}};Ke.registerLazyResult=s=>{_n=s};Ke.registerProcessor=s=>{kn=s};var Ps=Ke;Ke.default=Ke;var Kr=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},Pn=Kr;Kr.default=Kr;var Hl=Pn,Qr=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new Hl(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}},$s=Qr;Qr.default=Qr;var Dr=39,Ei=34,wt=92,Ii=47,bt=10,ze=32,St=12,vt=9,Ct=13,Yl=91,Zl=93,Xl=40,Jl=41,Kl=123,Ql=125,ql=59,eu=42,tu=58,ru=64,Et=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,It=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,su=/.[\\r\\n"\'(/\\\\]/,xi=/[\\da-f]/i,iu=function(e,t={}){let r=e.css.valueOf(),i=t.ignoreErrors,n,o,l,a,u,c,h,p,g,m,d=r.length,f=0,b=[],S=[];function y(){return f}function v($){throw e.error("Unclosed "+$,f)}function N(){return S.length===0&&f>=d}function T($){if(S.length)return S.pop();if(f>=d)return;let z=$?$.ignoreUnclosed:!1;switch(n=r.charCodeAt(f),n){case bt:case ze:case vt:case Ct:case St:{o=f;do o+=1,n=r.charCodeAt(o);while(n===ze||n===bt||n===vt||n===Ct||n===St);m=["space",r.slice(f,o)],f=o-1;break}case Yl:case Zl:case Kl:case Ql:case tu:case ql:case Jl:{let H=String.fromCharCode(n);m=[H,H,f];break}case Xl:{if(p=b.length?b.pop()[1]:"",g=r.charCodeAt(f+1),p==="url"&&g!==Dr&&g!==Ei&&g!==ze&&g!==bt&&g!==vt&&g!==St&&g!==Ct){o=f;do{if(c=!1,o=r.indexOf(")",o+1),o===-1)if(i||z){o=f;break}else v("bracket");for(h=o;r.charCodeAt(h-1)===wt;)h-=1,c=!c}while(c);m=["brackets",r.slice(f,o+1),f,o],f=o}else o=r.indexOf(")",f+1),a=r.slice(f,o+1),o===-1||su.test(a)?m=["(","(",f]:(m=["brackets",a,f,o],f=o);break}case Dr:case Ei:{l=n===Dr?"\'":\'"\',o=f;do{if(c=!1,o=r.indexOf(l,o+1),o===-1)if(i||z){o=f+1;break}else v("string");for(h=o;r.charCodeAt(h-1)===wt;)h-=1,c=!c}while(c);m=["string",r.slice(f,o+1),f,o],f=o;break}case ru:{Et.lastIndex=f+1,Et.test(r),Et.lastIndex===0?o=r.length-1:o=Et.lastIndex-2,m=["at-word",r.slice(f,o+1),f,o],f=o;break}case wt:{for(o=f,u=!0;r.charCodeAt(o+1)===wt;)o+=1,u=!u;if(n=r.charCodeAt(o+1),u&&n!==Ii&&n!==ze&&n!==bt&&n!==vt&&n!==Ct&&n!==St&&(o+=1,xi.test(r.charAt(o)))){for(;xi.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===ze&&(o+=1)}m=["word",r.slice(f,o+1),f,o],f=o;break}default:{n===Ii&&r.charCodeAt(f+1)===eu?(o=r.indexOf("*/",f+2)+1,o===0&&(i||z?o=r.length:v("comment")),m=["comment",r.slice(f,o+1),f,o],f=o):(It.lastIndex=f+1,It.test(r),It.lastIndex===0?o=r.length-1:o=It.lastIndex-2,m=["word",r.slice(f,o+1),f,o],b.push(m),f=o);break}}return f++,m}function V($){S.push($)}return{back:V,endOfFile:N,nextToken:T,position:y}},$n=ve,Xt=class extends $n{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},Ls=Xt;Xt.default=Xt;$n.registerAtRule(Xt);var Ln=ve,Fn,Un,Oe=class extends Ln{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let i=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of i)n.raws.before=t.raws.before}return i}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new Fn(new Un,this,e).stringify()}};Oe.registerLazyResult=s=>{Fn=s};Oe.registerProcessor=s=>{Un=s};var at=Oe;Oe.default=Oe;Ln.registerRoot(Oe);var Qe={comma(s){return Qe.split(s,[","],!0)},space(s){let e=[" ",`\n`," "];return Qe.split(s,e)},split(s,e,t){let r=[],i="",n=!1,o=0,l=!1,a="",u=!1;for(let c of s)u?u=!1:c==="\\\\"?u=!0:l?c===a&&(l=!1):c===\'"\'||c==="\'"?(l=!0,a=c):c==="("?o+=1:c===")"?o>0&&(o-=1):o===0&&e.includes(c)&&(n=!0),n?(i!==""&&r.push(i.trim()),i="",n=!1):i+=c;return(t||i!=="")&&r.push(i.trim()),r}},Bn=Qe;Qe.default=Qe;var Wn=ve,nu=Bn,Jt=class extends Wn{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return nu.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}},Fs=Jt;Jt.default=Jt;Wn.registerRule(Jt);var ou=lr,au=iu,lu=cr,uu=Ls,cu=at,Mi=Fs,Ni={empty:!0,space:!0};function hu(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var fu=class{constructor(e){this.input=e,this.root=new cu,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new uu;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,i,n,o=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(a.length>0){for(n=a.length-1,i=a[n];i&&i[0]==="space";)i=a[--n];i&&(t.source.end=this.getPosition(i[3]||i[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,"params",a),o&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,i;for(let n=t-1;n>=0&&(i=e[n],!(i[0]!=="space"&&(r+=1,r===2)));n--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(e){let t=0,r,i,n;for(let[o,l]of e.entries()){if(r=l,i=r[0],i==="("&&(t+=1),i===")"&&(t-=1),t===0&&i===":")if(!n)this.doubleColon(r);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=r}return!1}comment(e){let t=new lu;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let i=r.match(/^(\\s*)([^]*\\S)(\\s*)$/);t.text=i[2],t.raws.left=i[1],t.raws.right=i[3]}}createTokenizer(){this.tokenizer=au(this.input)}decl(e,t){let r=new ou;this.init(r,e[0][2]);let i=e[e.length-1];for(i[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||hu(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let u=e[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=e.shift()[1]}r.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){r.raws.between+=n[1];break}else n[0]==="word"&&/\\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let o=[],l;for(;e.length&&(l=e[0][0],!(l!=="space"&&l!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(n=e[u],n[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==" !important"&&(r.raws.important=c);break}else if(n[1].toLowerCase()==="important"){let c=e.slice(0),h="";for(let p=u;p>0;p--){let g=c[p][0];if(h.trim().indexOf("!")===0&&g!=="space")break;h=c.pop()[1]+h}h.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=h,e=c)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=o.map(u=>u[1]).join(""),o=[]),this.raw(r,"value",o.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new Mi;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,i=!1,n=null,o=[],l=e[1].startsWith("--"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r==="("||r==="[")n||(n=u),o.push(r==="("?")":"]");else if(l&&i&&r==="{")n||(n=u),o.push("}");else if(o.length===0)if(r===";")if(i){this.decl(a,l);return}else break;else if(r==="{"){this.rule(a);return}else if(r==="}"){this.tokenizer.back(a.pop()),t=!0;break}else r===":"&&(i=!0);else r===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&i){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,i){let n,o,l=r.length,a="",u=!0,c,h;for(let p=0;p<l;p+=1)n=r[p],o=n[0],o==="space"&&p===l-1&&!i?u=!1:o==="comment"?(h=r[p-1]?r[p-1][0]:"empty",c=r[p+1]?r[p+1][0]:"empty",!Ni[h]&&!Ni[c]?a.slice(-1)===","?u=!1:a+=n[1]:u=!1):a+=n[1];if(!u){let p=r.reduce((g,m)=>g+m[1],"");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new Mi;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let i=t;i<e.length;i++)r+=e[i][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},du=fu,pu=ve,mu=du,gu=ur;function Kt(s,e){let t=new gu(s,e),r=new mu(t);try{r.parse()}catch(i){throw i}return r.root}var Us=Kt;Kt.default=Kt;pu.registerParse(Kt);var{isClean:ae,my:yu}=ot,wu=En,bu=or,Su=ve,vu=Ps;var Ri=$s,Cu=Us,Eu=at,Iu={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},xu={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Mu={Once:!0,postcssPlugin:!0,prepare:!0},De=0;function Ve(s){return typeof s=="object"&&typeof s.then=="function"}function zn(s){let e=!1,t=Iu[s.type];return s.type==="decl"?e=s.prop.toLowerCase():s.type==="atrule"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+"-"+e,De,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:s.append?[t,De,t+"Exit"]:[t,t+"Exit"]}function Ai(s){let e;return s.type==="document"?e=["Document",De,"DocumentExit"]:s.type==="root"?e=["Root",De,"RootExit"]:e=zn(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function qr(s){return s[ae]=!1,s.nodes&&s.nodes.forEach(e=>qr(e)),s}var es={},Te=class Vn{constructor(e,t,r){this.stringified=!1,this.processed=!1;let i;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))i=qr(t);else if(t instanceof Vn||t instanceof Ri)i=qr(t.root),t.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let n=Cu;r.syntax&&(n=r.syntax.parse),r.parser&&(n=r.parser),n.parse&&(n=n.parse);try{i=n(t,r)}catch(o){this.processed=!0,this.error=o}i&&!i[yu]&&Su.rebuild(i)}this.result=new Ri(e,i,r),this.helpers={...es,postcss:es,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin?(e.plugin=r.postcssPlugin,e.setMessage()):r.postcssVersion}catch(i){console&&console.error&&console.error(i)}return e}prepareVisitors(){this.listeners={};let e=(t,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,i])};for(let t of this.plugins)if(typeof t=="object")for(let r in t){if(!xu[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Mu[r])if(typeof t[r]=="object")for(let i in t[r])i==="*"?e(t,r,t[r][i]):e(t,r+"-"+i.toLowerCase(),t[r][i]);else typeof t[r]=="function"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(Ve(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ae];){e[ae]=!0;let t=[Ai(e)];for(;t.length>0;){let r=this.visitTick(t);if(Ve(r))try{await r}catch(i){let n=t[t.length-1].node;throw this.handleError(i,n)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let i=e.nodes.map(n=>r(n,this.helpers));await Promise.all(i)}else await r(e,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return Ve(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=bu;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new wu(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(Ve(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ae];)e[ae]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,i]of e){this.result.lastPlugin=r;let n;try{n=i(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(Ve(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:i}=t;if(r.type!=="root"&&r.type!=="document"&&!r.parent){e.pop();return}if(i.length>0&&t.visitorIndex<i.length){let[o,l]=i[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===i.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let o=t.iterator,l;for(;l=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!l[ae]){l[ae]=!0,e.push(Ai(l));return}t.iterator=0,delete r.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===De){r.nodes&&r.nodes.length&&(r[ae]=!0,t.iterator=r.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[ae]=!0;let t=zn(e);for(let r of t)if(r===De)e.nodes&&e.each(i=>{i[ae]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Te.registerPostcss=s=>{es=s};var Gn=Te;Te.default=Te;Eu.registerLazyResult(Te);vu.registerLazyResult(Te);var Nu=En,Ru=or;var Au=Us,Ou=$s,ts=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let i,n=Ru;this.result=new Ou(this._processor,i,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let l=new Nu(n,i,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Au;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}},Du=ts;ts.default=ts;var Tu=Du,_u=Gn,ku=Ps,Pu=at,qe=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Tu(this,e,t):new _u(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},$u=qe;qe.default=qe;Pu.registerProcessor(qe);ku.registerProcessor(qe);var Lu=lr,Fu=wn,Uu=cr,Bu=Ls,Wu=ur,zu=at,Vu=Fs;function et(s,e){if(Array.isArray(s))return s.map(i=>et(i));let{inputs:t,...r}=s;if(t){e=[];for(let i of t){let n={...i,__proto__:Wu.prototype};n.map&&(n.map={...n.map,__proto__:Fu.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=s.nodes.map(i=>et(i,e))),r.source){let{inputId:i,...n}=r.source;r.source=n,i!=null&&(r.source.input=e[i])}if(r.type==="root")return new zu(r);if(r.type==="decl")return new Lu(r);if(r.type==="rule")return new Vu(r);if(r.type==="comment")return new Uu(r);if(r.type==="atrule")return new Bu(r);throw new Error("Unknown node type: "+s.type)}var Gu=et;et.default=et;var ju=Ts,jn=lr,Hu=Gn,Yu=ve,Bs=$u,Zu=or,Xu=Gu,Hn=Ps,Ju=Pn,Yn=cr,Zn=Ls,Ku=$s,Qu=ur,qu=Us,ec=Bn,Xn=Fs,Jn=at,tc=ar;function A(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new Bs(s)}A.plugin=function(e,t){let r=!1;function i(...o){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\nhttps://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new Bs().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return A([i(a)]).process(o,l)},i};A.stringify=Zu;A.parse=qu;A.fromJSON=Xu;A.list=ec;A.comment=s=>new Yn(s);A.atRule=s=>new Zn(s);A.decl=s=>new jn(s);A.rule=s=>new Xn(s);A.root=s=>new Jn(s);A.document=s=>new Hn(s);A.CssSyntaxError=ju;A.Declaration=jn;A.Container=Yu;A.Processor=Bs;A.Document=Hn;A.Comment=Yn;A.Warning=Ju;A.AtRule=Zn;A.Result=Ku;A.Input=Qu;A.Rule=Xn;A.Root=Jn;A.Node=tc;Hu.registerPostcss(A);var rc=A;A.default=A;var L=pl(rc);L.stringify;L.fromJSON;L.plugin;L.parse;L.list;L.document;L.comment;L.atRule;L.rule;L.decl;L.root;L.CssSyntaxError;L.Declaration;L.Container;L.Processor;L.Document;L.Comment;L.Warning;L.AtRule;L.Result;L.Input;L.Rule;L.Root;L.Node;var sc=Object.defineProperty,ic=(s,e,t)=>e in s?sc(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,ee=(s,e,t)=>ic(s,typeof e!="symbol"?e+"":e,t);function nc(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function oc(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var Ws={exports:{}},P=String,Kn=function(){return{isColorSupported:!1,reset:P,bold:P,dim:P,italic:P,underline:P,inverse:P,hidden:P,strikethrough:P,black:P,red:P,green:P,yellow:P,blue:P,magenta:P,cyan:P,white:P,gray:P,bgBlack:P,bgRed:P,bgGreen:P,bgYellow:P,bgBlue:P,bgMagenta:P,bgCyan:P,bgWhite:P}};Ws.exports=Kn();Ws.exports.createColors=Kn;var ac=Ws.exports,lc={},uc=Object.freeze(Object.defineProperty({__proto__:null,default:lc},Symbol.toStringTag,{value:"Module"})),ie=oc(uc),Oi=ac,Di=ie,rs=class Qn extends Error{constructor(e,t,r,i,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),typeof t<"u"&&typeof r<"u"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Qn)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=Oi.isColorSupported),Di&&e&&(t=Di(t));let r=t.split(/\\r?\\n/),i=Math.max(this.line-3,0),n=Math.min(this.line+2,r.length),o=String(n).length,l,a;if(e){let{bold:u,gray:c,red:h}=Oi.createColors(!0);l=p=>u(h(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(i,n).map((u,c)=>{let h=i+1+c,p=" "+(" "+h).slice(-o)+" | ";if(h===this.line){let g=a(p.replace(/\\d/g," "))+u.slice(0,this.column-1).replace(/[^\\t]/g," ");return l(">")+a(p)+u+`\n `+g+l("^")}return" "+a(p)+u}).join(`\n`)}toString(){let e=this.showSourceCode();return e&&(e=`\n\n`+e+`\n`),this.name+": "+this.message+e}},zs=rs;rs.default=rs;var lt={};lt.isClean=Symbol("isClean");lt.my=Symbol("my");var Ti={after:`\n`,beforeClose:`\n`,beforeComment:`\n`,beforeDecl:`\n`,beforeOpen:" ",beforeRule:`\n`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function cc(s){return s[0].toUpperCase()+s.slice(1)}var ss=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,i=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?r+=e.raws.afterName:i&&(r+=" "),e.nodes)this.block(e,r+i);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+i+n,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let i=e.parent,n=0;for(;i&&i.type!=="root";)n+=1,i=i.parent;if(r.includes(`\n`)){let o=this.raw(e,null,"indent");if(o.length)for(let l=0;l<n;l++)r+=o}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let i;e.nodes&&e.nodes.length?(this.body(e),i=this.raw(e,"after")):i=this.raw(e,"after","emptyBody"),i&&this.builder(i),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let i=0;i<e.nodes.length;i++){let n=e.nodes[i],o=this.raw(n,"before");o&&this.builder(o),this.stringify(n,t!==i||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),i=e.prop+r+this.rawValue(e,"value");e.important&&(i+=e.raws.important||" !important"),t&&(i+=";"),this.builder(i,e)}document(e){this.body(e)}raw(e,t,r){let i;if(r||(r=t),t&&(i=e.raws[t],typeof i<"u"))return i;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return Ti[r];let o=e.root();if(o.rawCache||(o.rawCache={}),typeof o.rawCache[r]<"u")return o.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let l="raw"+cc(r);this[l]?i=this[l](o,e):o.walk(a=>{if(i=a.raws[t],typeof i<"u")return!1})}return typeof i>"u"&&(i=Ti[r]),o.rawCache[r]=i,i}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return t=r.raws.after,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(`\n`)&&(r=r.replace(/[^\\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before<"u")return t=r.raws.before,t.includes(`\n`)&&(t=t.replace(/[^\\n]+$/,"")),!1}),t&&(t=t.replace(/\\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between<"u")return t=r.raws.between.replace(/[^\\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let i=r.parent;if(i&&i!==e&&i.parent&&i.parent===e&&typeof r.raws.before<"u"){let n=r.raws.before.split(`\n`);return t=n[n.length-1],t=t.replace(/\\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let r=e[t],i=e.raws[t];return i&&i.value===r?i.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}},qn=ss;ss.default=ss;var hc=qn;function is(s,e){new hc(e).stringify(s)}var hr=is;is.default=is;var{isClean:xt,my:fc}=lt,dc=zs,pc=qn,mc=hr;function ns(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let i=s[r],n=typeof i;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>ns(o,t)):(n==="object"&&i!==null&&(i=ns(i)),t[r]=i)}return t}var os=class{constructor(e={}){this.raws={},this[xt]=!1,this[fc]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\\n\\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\\n\\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=ns(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:i}=this.rangeBy(t);return this.source.input.error(e,{column:i.column,line:i.line},{column:r.column,line:r.line},t)}return new dc(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[xt]){this[xt]=!1;let e=this;for(;e=e.parent;)e[xt]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let i=t.indexOf(e.word);i!==-1&&(r=this.positionInside(i,t))}return r}positionInside(e,t){let r=t||this.toString(),i=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)r[o]===`\n`?(i=1,n+=1):i+=1;return{column:i,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let i=this.toString(),n=i.indexOf(e.word);n!==-1&&(t=this.positionInside(n,i),r=this.positionInside(n+e.word.length,i))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new pc().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let i of e)i===this?r=!0:r?(this.parent.insertAfter(t,i),t=i):this.parent.insertBefore(t,i);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},i=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let l=this[o];if(Array.isArray(l))r[o]=l.map(a=>typeof a=="object"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l=="object"&&l.toJSON)r[o]=l.toJSON(null,t);else if(o==="source"){let a=t.get(l.input);a==null&&(a=n,t.set(l.input,n),n++),r[o]={end:l.end,inputId:a,start:l.start}}else r[o]=l}return i&&(r.inputs=[...t.keys()].map(o=>o.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=mc){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let i={node:this};for(let n in r)i[n]=r[n];return e.warn(t,i)}get proxyOf(){return this}},fr=os;os.default=os;var gc=fr,as=class extends gc{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},dr=as;as.default=as;var yc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",wc=(s,e=21)=>(t=e)=>{let r="",i=t;for(;i--;)r+=s[Math.random()*s.length|0];return r},bc=(s=21)=>{let e="",t=s;for(;t--;)e+=yc[Math.random()*64|0];return e},Sc={nanoid:bc,customAlphabet:wc},{SourceMapConsumer:_i,SourceMapGenerator:ki}=ie,{existsSync:vc,readFileSync:Cc}=ie,{dirname:Tr,join:Ec}=ie;function Ic(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}var ls=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Tr(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new _i(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\\/json;charset=utf-?8;base64,/,r=/^data:application\\/json;base64,/,i=/^data:application\\/json;charset=utf-?8,/,n=/^data:application\\/json,/;if(i.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return Ic(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\\/\\*\\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\\/\\*\\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),i=e.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,i)))}loadFile(e){if(this.root=Tr(e),vc(e))return this.mapFile=e,Cc(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(t instanceof _i)return ki.fromSourceMap(t).toString();if(t instanceof ki)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=Ec(Tr(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},eo=ls;ls.default=ls;var{SourceMapConsumer:xc,SourceMapGenerator:Mc}=ie,{fileURLToPath:Pi,pathToFileURL:Mt}=ie,{isAbsolute:us,resolve:cs}=ie,{nanoid:Nc}=Sc,_r=ie,$i=zs,Rc=eo,kr=Symbol("fromOffsetCache"),Ac=!!(xc&&Mc),Li=!!(cs&&us),Qt=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\\uFEFF"||this.css[0]==="\\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Li||/^\\w+:\\/\\//.test(t.from)||us(t.from)?this.file=t.from:this.file=cs(t.from)),Li&&Ac){let r=new Rc(this.css,t);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+Nc(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let n,o,l;if(t&&typeof t=="object"){let u=t,c=r;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);t=h.line,r=h.col}else t=u.line,r=u.column;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);o=h.line,l=h.col}else o=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,o,l);return a?n=new $i(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,i.plugin):n=new $i(e,o===void 0?t:{column:r,line:t},o===void 0?r:{column:l,line:o},this.css,this.file,i.plugin),n.input={column:r,endColumn:l,endLine:o,line:t,source:this.css},this.file&&(Mt&&(n.input.url=Mt(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[kr])r=this[kr];else{let n=this.css.split(`\n`);r=new Array(n.length);let o=0;for(let l=0,a=n.length;l<a;l++)r[l]=o,o+=n[l].length+1;this[kr]=r}t=r[r.length-1];let i=0;if(e>=t)i=r.length-1;else{let n=r.length-2,o;for(;i<n;)if(o=i+(n-i>>1),e<r[o])n=o-1;else if(e>=r[o+1])i=o+1;else{i=o;break}}return{col:e-r[i]+1,line:i+1}}mapResolve(e){return/^\\w+:\\/\\//.test(e)?e:cs(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,i){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let l;typeof r=="number"&&(l=n.originalPositionFor({column:i,line:r}));let a;us(o.source)?a=Mt(o.source):a=new URL(o.source,this.map.consumer().sourceRoot||Mt(this.map.mapFile));let u={column:o.column,endColumn:l&&l.column,endLine:l&&l.line,line:o.line,url:a.toString()};if(a.protocol==="file:")if(Pi)u.file=Pi(a);else throw new Error("file: protocol is not available in this PostCSS build");let c=n.sourceContentFor(o.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},pr=Qt;Qt.default=Qt;_r&&_r.registerInput&&_r.registerInput(Qt);var{SourceMapConsumer:to,SourceMapGenerator:Ut}=ie,{dirname:Bt,relative:ro,resolve:so,sep:io}=ie,{pathToFileURL:Fi}=ie,Oc=pr,Dc=!!(to&&Ut),Tc=!!(Bt&&so&&ro&&io),_c=class{constructor(e,t,r,i){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`\n`;this.css.includes(`\\r\n`)&&(t=`\\r\n`),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||Bt(e.file),i;this.mapOpts.sourcesContent===!1?(i=new to(e.text),i.sourcesContent&&(i.sourcesContent=null)):i=e.consumer(),this.map.applySourceMap(i,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\\n*?\\/\\*#[\\S\\s]*?\\*\\/$/gm,""))}generate(){if(this.clearAnnotation(),Tc&&Dc&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Ut.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Ut({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Ut({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!=="end"&&(i.generated.line=e,i.generated.column=t-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),n=l.match(/\\n/g),n?(e+=n.length,o=l.lastIndexOf(`\n`),t=l.length-o):t+=l.length,a&&u!=="start"){let c=a.parent||{raws:{}};(!(a.type==="decl"||a.type==="atrule"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=e,i.generated.column=t-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=e,i.generated.column=t-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\\w+:\\/\\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Bt(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Bt(so(r,this.mapOpts.annotation)));let i=ro(r,e);return this.memoizedPaths.set(e,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Oc(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Fi){let r=Fi(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;io==="\\\\"&&(e=e.replace(/\\\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},no=_c,kc=fr,hs=class extends kc{constructor(e){super(e),this.type="comment"}},mr=hs;hs.default=hs;var{isClean:oo,my:ao}=lt,lo=dr,uo=mr,Pc=fr,co,Vs,Gs,ho;function fo(s){return s.map(e=>(e.nodes&&(e.nodes=fo(e.nodes)),delete e.source,e))}function po(s){if(s[oo]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)po(e)}var he=class mo extends Pc{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,i;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],i=e(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[t]+=1;return delete this.indexes[t],i}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(i=>typeof i=="function"?(n,o)=>i(n.toProxy(),o):i)):t==="every"||t==="some"?r=>e[t]((i,...n)=>r(i.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),i=r===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let l of n)this.proxyOf.nodes.splice(r,0,l);let o;for(let l in this.indexes)o=this.indexes[l],r<=o&&(this.indexes[l]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=fo(co(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new lo(e)]}else if(e.selector)e=[new Vs(e)];else if(e.name)e=[new Gs(e)];else if(e.text)e=[new uo(e)];else throw new Error("Unknown node type in node creation");return e.map(i=>(i[ao]||mo.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[oo]&&po(i),typeof i.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(i.raws.before=t.raws.before.replace(/\\S/g,"")),i.parent=this.proxyOf,i))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(i=>{t.props&&!t.props.includes(i.prop)||t.fast&&!i.value.includes(t.fast)||(i.value=i.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let i;try{i=e(t,r)}catch(n){throw t.addToError(n)}return i!==!1&&t.walk&&(i=t.walk(e)),i})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="atrule")return t(r,i)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="decl")return t(r,i)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&e.test(r.selector))return t(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="rule")return t(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};he.registerParse=s=>{co=s};he.registerRule=s=>{Vs=s};he.registerAtRule=s=>{Gs=s};he.registerRoot=s=>{ho=s};var Ce=he;he.default=he;he.rebuild=s=>{s.type==="atrule"?Object.setPrototypeOf(s,Gs.prototype):s.type==="rule"?Object.setPrototypeOf(s,Vs.prototype):s.type==="decl"?Object.setPrototypeOf(s,lo.prototype):s.type==="comment"?Object.setPrototypeOf(s,uo.prototype):s.type==="root"&&Object.setPrototypeOf(s,ho.prototype),s[ao]=!0,s.nodes&&s.nodes.forEach(e=>{he.rebuild(e)})};var $c=Ce,go,yo,tt=class extends $c{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new go(new yo,this,e).stringify()}};tt.registerLazyResult=s=>{go=s};tt.registerProcessor=s=>{yo=s};var js=tt;tt.default=tt;var fs=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},wo=fs;fs.default=fs;var Lc=wo,ds=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new Lc(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}},Hs=ds;ds.default=ds;var Pr=39,Ui=34,Nt=92,Bi=47,Rt=10,Ge=32,At=12,Ot=9,Dt=13,Fc=91,Uc=93,Bc=40,Wc=41,zc=123,Vc=125,Gc=59,jc=42,Hc=58,Yc=64,Tt=/[\\t\\n\\f\\r "#\'()/;[\\\\\\]{}]/g,_t=/[\\t\\n\\f\\r !"#\'():;@[\\\\\\]{}]|\\/(?=\\*)/g,Zc=/.[\\r\\n"\'(/\\\\]/,Wi=/[\\da-f]/i,Xc=function(e,t={}){let r=e.css.valueOf(),i=t.ignoreErrors,n,o,l,a,u,c,h,p,g,m,d=r.length,f=0,b=[],S=[];function y(){return f}function v($){throw e.error("Unclosed "+$,f)}function N(){return S.length===0&&f>=d}function T($){if(S.length)return S.pop();if(f>=d)return;let z=$?$.ignoreUnclosed:!1;switch(n=r.charCodeAt(f),n){case Rt:case Ge:case Ot:case Dt:case At:{o=f;do o+=1,n=r.charCodeAt(o);while(n===Ge||n===Rt||n===Ot||n===Dt||n===At);m=["space",r.slice(f,o)],f=o-1;break}case Fc:case Uc:case zc:case Vc:case Hc:case Gc:case Wc:{let H=String.fromCharCode(n);m=[H,H,f];break}case Bc:{if(p=b.length?b.pop()[1]:"",g=r.charCodeAt(f+1),p==="url"&&g!==Pr&&g!==Ui&&g!==Ge&&g!==Rt&&g!==Ot&&g!==At&&g!==Dt){o=f;do{if(c=!1,o=r.indexOf(")",o+1),o===-1)if(i||z){o=f;break}else v("bracket");for(h=o;r.charCodeAt(h-1)===Nt;)h-=1,c=!c}while(c);m=["brackets",r.slice(f,o+1),f,o],f=o}else o=r.indexOf(")",f+1),a=r.slice(f,o+1),o===-1||Zc.test(a)?m=["(","(",f]:(m=["brackets",a,f,o],f=o);break}case Pr:case Ui:{l=n===Pr?"\'":\'"\',o=f;do{if(c=!1,o=r.indexOf(l,o+1),o===-1)if(i||z){o=f+1;break}else v("string");for(h=o;r.charCodeAt(h-1)===Nt;)h-=1,c=!c}while(c);m=["string",r.slice(f,o+1),f,o],f=o;break}case Yc:{Tt.lastIndex=f+1,Tt.test(r),Tt.lastIndex===0?o=r.length-1:o=Tt.lastIndex-2,m=["at-word",r.slice(f,o+1),f,o],f=o;break}case Nt:{for(o=f,u=!0;r.charCodeAt(o+1)===Nt;)o+=1,u=!u;if(n=r.charCodeAt(o+1),u&&n!==Bi&&n!==Ge&&n!==Rt&&n!==Ot&&n!==Dt&&n!==At&&(o+=1,Wi.test(r.charAt(o)))){for(;Wi.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===Ge&&(o+=1)}m=["word",r.slice(f,o+1),f,o],f=o;break}default:{n===Bi&&r.charCodeAt(f+1)===jc?(o=r.indexOf("*/",f+2)+1,o===0&&(i||z?o=r.length:v("comment")),m=["comment",r.slice(f,o+1),f,o],f=o):(_t.lastIndex=f+1,_t.test(r),_t.lastIndex===0?o=r.length-1:o=_t.lastIndex-2,m=["word",r.slice(f,o+1),f,o],b.push(m),f=o);break}}return f++,m}function V($){S.push($)}return{back:V,endOfFile:N,nextToken:T,position:y}},bo=Ce,qt=class extends bo{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},Ys=qt;qt.default=qt;bo.registerAtRule(qt);var So=Ce,vo,Co,_e=class extends So{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let i=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of i)n.raws.before=t.raws.before}return i}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new vo(new Co,this,e).stringify()}};_e.registerLazyResult=s=>{vo=s};_e.registerProcessor=s=>{Co=s};var ut=_e;_e.default=_e;So.registerRoot(_e);var rt={comma(s){return rt.split(s,[","],!0)},space(s){let e=[" ",`\n`," "];return rt.split(s,e)},split(s,e,t){let r=[],i="",n=!1,o=0,l=!1,a="",u=!1;for(let c of s)u?u=!1:c==="\\\\"?u=!0:l?c===a&&(l=!1):c===\'"\'||c==="\'"?(l=!0,a=c):c==="("?o+=1:c===")"?o>0&&(o-=1):o===0&&e.includes(c)&&(n=!0),n?(i!==""&&r.push(i.trim()),i="",n=!1):i+=c;return(t||i!=="")&&r.push(i.trim()),r}},Eo=rt;rt.default=rt;var Io=Ce,Jc=Eo,er=class extends Io{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Jc.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}},Zs=er;er.default=er;Io.registerRule(er);var Kc=dr,Qc=Xc,qc=mr,eh=Ys,th=ut,zi=Zs,Vi={empty:!0,space:!0};function rh(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var sh=class{constructor(e){this.input=e,this.root=new th,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new eh;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,i,n,o=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(a.length>0){for(n=a.length-1,i=a[n];i&&i[0]==="space";)i=a[--n];i&&(t.source.end=this.getPosition(i[3]||i[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,"params",a),o&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,i;for(let n=t-1;n>=0&&(i=e[n],!(i[0]!=="space"&&(r+=1,r===2)));n--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(e){let t=0,r,i,n;for(let[o,l]of e.entries()){if(r=l,i=r[0],i==="("&&(t+=1),i===")"&&(t-=1),t===0&&i===":")if(!n)this.doubleColon(r);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=r}return!1}comment(e){let t=new qc;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let i=r.match(/^(\\s*)([^]*\\S)(\\s*)$/);t.text=i[2],t.raws.left=i[1],t.raws.right=i[3]}}createTokenizer(){this.tokenizer=Qc(this.input)}decl(e,t){let r=new Kc;this.init(r,e[0][2]);let i=e[e.length-1];for(i[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||rh(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let u=e[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=e.shift()[1]}r.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){r.raws.between+=n[1];break}else n[0]==="word"&&/\\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let o=[],l;for(;e.length&&(l=e[0][0],!(l!=="space"&&l!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(n=e[u],n[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==" !important"&&(r.raws.important=c);break}else if(n[1].toLowerCase()==="important"){let c=e.slice(0),h="";for(let p=u;p>0;p--){let g=c[p][0];if(h.trim().indexOf("!")===0&&g!=="space")break;h=c.pop()[1]+h}h.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=h,e=c)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=o.map(u=>u[1]).join(""),o=[]),this.raw(r,"value",o.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new zi;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,i=!1,n=null,o=[],l=e[1].startsWith("--"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r==="("||r==="[")n||(n=u),o.push(r==="("?")":"]");else if(l&&i&&r==="{")n||(n=u),o.push("}");else if(o.length===0)if(r===";")if(i){this.decl(a,l);return}else break;else if(r==="{"){this.rule(a);return}else if(r==="}"){this.tokenizer.back(a.pop()),t=!0;break}else r===":"&&(i=!0);else r===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&i){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,i){let n,o,l=r.length,a="",u=!0,c,h;for(let p=0;p<l;p+=1)n=r[p],o=n[0],o==="space"&&p===l-1&&!i?u=!1:o==="comment"?(h=r[p-1]?r[p-1][0]:"empty",c=r[p+1]?r[p+1][0]:"empty",!Vi[h]&&!Vi[c]?a.slice(-1)===","?u=!1:a+=n[1]:u=!1):a+=n[1];if(!u){let p=r.reduce((g,m)=>g+m[1],"");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new zi;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let i=t;i<e.length;i++)r+=e[i][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},ih=sh,nh=Ce,oh=ih,ah=pr;function tr(s,e){let t=new ah(s,e),r=new oh(t);try{r.parse()}catch(i){throw i}return r.root}var Xs=tr;tr.default=tr;nh.registerParse(tr);var{isClean:le,my:lh}=lt,uh=no,ch=hr,hh=Ce,fh=js;var Gi=Hs,dh=Xs,ph=ut,mh={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},gh={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},yh={Once:!0,postcssPlugin:!0,prepare:!0},ke=0;function je(s){return typeof s=="object"&&typeof s.then=="function"}function xo(s){let e=!1,t=mh[s.type];return s.type==="decl"?e=s.prop.toLowerCase():s.type==="atrule"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+"-"+e,ke,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:s.append?[t,ke,t+"Exit"]:[t,t+"Exit"]}function ji(s){let e;return s.type==="document"?e=["Document",ke,"DocumentExit"]:s.type==="root"?e=["Root",ke,"RootExit"]:e=xo(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function ps(s){return s[le]=!1,s.nodes&&s.nodes.forEach(e=>ps(e)),s}var ms={},Pe=class Mo{constructor(e,t,r){this.stringified=!1,this.processed=!1;let i;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))i=ps(t);else if(t instanceof Mo||t instanceof Gi)i=ps(t.root),t.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let n=dh;r.syntax&&(n=r.syntax.parse),r.parser&&(n=r.parser),n.parse&&(n=n.parse);try{i=n(t,r)}catch(o){this.processed=!0,this.error=o}i&&!i[lh]&&hh.rebuild(i)}this.result=new Gi(e,i,r),this.helpers={...ms,postcss:ms,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin?(e.plugin=r.postcssPlugin,e.setMessage()):r.postcssVersion}catch(i){console&&console.error&&console.error(i)}return e}prepareVisitors(){this.listeners={};let e=(t,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,i])};for(let t of this.plugins)if(typeof t=="object")for(let r in t){if(!gh[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!yh[r])if(typeof t[r]=="object")for(let i in t[r])i==="*"?e(t,r,t[r][i]):e(t,r+"-"+i.toLowerCase(),t[r][i]);else typeof t[r]=="function"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(je(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[le];){e[le]=!0;let t=[ji(e)];for(;t.length>0;){let r=this.visitTick(t);if(je(r))try{await r}catch(i){let n=t[t.length-1].node;throw this.handleError(i,n)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let i=e.nodes.map(n=>r(n,this.helpers));await Promise.all(i)}else await r(e,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return je(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=ch;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new uh(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(je(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[le];)e[le]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,i]of e){this.result.lastPlugin=r;let n;try{n=i(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(je(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:i}=t;if(r.type!=="root"&&r.type!=="document"&&!r.parent){e.pop();return}if(i.length>0&&t.visitorIndex<i.length){let[o,l]=i[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===i.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let o=t.iterator,l;for(;l=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!l[le]){l[le]=!0,e.push(ji(l));return}t.iterator=0,delete r.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===ke){r.nodes&&r.nodes.length&&(r[le]=!0,t.iterator=r.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[le]=!0;let t=xo(e);for(let r of t)if(r===ke)e.nodes&&e.each(i=>{i[le]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Pe.registerPostcss=s=>{ms=s};var No=Pe;Pe.default=Pe;ph.registerLazyResult(Pe);fh.registerLazyResult(Pe);var wh=no,bh=hr;var Sh=Xs,vh=Hs,gs=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let i,n=bh;this.result=new vh(this._processor,i,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let l=new wh(n,i,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Sh;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}},Ch=gs;gs.default=gs;var Eh=Ch,Ih=No,xh=js,Mh=ut,st=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(!(typeof r=="object"&&(r.parse||r.stringify)))throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Eh(this,e,t):new Ih(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},Nh=st;st.default=st;Mh.registerProcessor(st);xh.registerProcessor(st);var Rh=dr,Ah=eo,Oh=mr,Dh=Ys,Th=pr,_h=ut,kh=Zs;function it(s,e){if(Array.isArray(s))return s.map(i=>it(i));let{inputs:t,...r}=s;if(t){e=[];for(let i of t){let n={...i,__proto__:Th.prototype};n.map&&(n.map={...n.map,__proto__:Ah.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=s.nodes.map(i=>it(i,e))),r.source){let{inputId:i,...n}=r.source;r.source=n,i!=null&&(r.source.input=e[i])}if(r.type==="root")return new _h(r);if(r.type==="decl")return new Rh(r);if(r.type==="rule")return new kh(r);if(r.type==="comment")return new Oh(r);if(r.type==="atrule")return new Dh(r);throw new Error("Unknown node type: "+s.type)}var Ph=it;it.default=it;var $h=zs,Ro=dr,Lh=No,Fh=Ce,Js=Nh,Uh=hr,Bh=Ph,Ao=js,Wh=wo,Oo=mr,Do=Ys,zh=Hs,Vh=pr,Gh=Xs,jh=Eo,To=Zs,_o=ut,Hh=fr;function O(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new Js(s)}O.plugin=function(e,t){let r=!1;function i(...o){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \\u91CC\\u9762 postcss.plugin \\u88AB\\u5F03\\u7528. \\u8FC1\\u79FB\\u6307\\u5357:\nhttps://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new Js().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return O([i(a)]).process(o,l)},i};O.stringify=Uh;O.parse=Gh;O.fromJSON=Bh;O.list=jh;O.comment=s=>new Oo(s);O.atRule=s=>new Do(s);O.decl=s=>new Ro(s);O.rule=s=>new To(s);O.root=s=>new _o(s);O.document=s=>new Ao(s);O.CssSyntaxError=$h;O.Declaration=Ro;O.Container=Fh;O.Processor=Js;O.Document=Ao;O.Comment=Oo;O.Warning=Wh;O.AtRule=Do;O.Result=zh;O.Input=Vh;O.Rule=To;O.Root=_o;O.Node=Hh;Lh.registerPostcss(O);var Yh=O;O.default=O;var F=nc(Yh);F.stringify;F.fromJSON;F.plugin;F.parse;F.list;F.document;F.comment;F.atRule;F.rule;F.decl;F.root;F.CssSyntaxError;F.Declaration;F.Container;F.Processor;F.Document;F.Comment;F.Warning;F.AtRule;F.Result;F.Input;F.Rule;F.Root;F.Node;var ys=class s{constructor(...e){ee(this,"parentElement",null),ee(this,"parentNode",null),ee(this,"ownerDocument"),ee(this,"firstChild",null),ee(this,"lastChild",null),ee(this,"previousSibling",null),ee(this,"nextSibling",null),ee(this,"ELEMENT_NODE",1),ee(this,"TEXT_NODE",3),ee(this,"nodeType"),ee(this,"nodeName"),ee(this,"RRNodeType")}get childNodes(){let e=[],t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof s){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute \'appendChild\' on \'RRNode\': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute \'insertBefore\' on \'RRNode\': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute \'removeChild\' on \'RRNode\': This RRNode type does not support this method.")}toString(){return"RRNode"}};var Hi={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Yi={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},kt={},Zh=()=>!!globalThis.Zone;function Ks(s){if(kt[s])return kt[s];let e=globalThis[s],t=e.prototype,r=s in Hi?Hi[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),n=s in Yi?Yi[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!Zh())return kt[s]=e.prototype,e.prototype;try{let l=document.createElement("iframe");document.body.appendChild(l);let a=l.contentWindow;if(!a)return e.prototype;let u=a[s].prototype;return document.body.removeChild(l),u?kt[s]=u:t}catch{return t}}var $r={};function de(s,e,t){var r;let i=`${s}.${String(t)}`;if($r[i])return $r[i].call(e);let n=Ks(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?($r[i]=o,o.call(e)):e[t]}var Lr={};function ko(s,e,t){let r=`${s}.${String(t)}`;if(Lr[r])return Lr[r].bind(e);let n=Ks(s)[t];return typeof n!="function"?e[t]:(Lr[r]=n,n.bind(e))}function Xh(s){return de("Node",s,"ownerDocument")}function Jh(s){return de("Node",s,"childNodes")}function Kh(s){return de("Node",s,"parentNode")}function Qh(s){return de("Node",s,"parentElement")}function qh(s){return de("Node",s,"textContent")}function ef(s,e){return ko("Node",s,"contains")(e)}function tf(s){return ko("Node",s,"getRootNode")()}function rf(s){return!s||!("host"in s)?null:de("ShadowRoot",s,"host")}function sf(s){return s.styleSheets}function nf(s){return!s||!("shadowRoot"in s)?null:de("Element",s,"shadowRoot")}function of(s,e){return de("Element",s,"querySelector")(e)}function af(s,e){return de("Element",s,"querySelectorAll")(e)}function Po(){return Ks("MutationObserver").constructor}function Ee(s,e,t){try{if(!(e in s))return()=>{};let r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}var C={ownerDocument:Xh,childNodes:Jh,parentNode:Kh,parentElement:Qh,textContent:qh,contains:ef,getRootNode:tf,host:rf,styleSheets:sf,shadowRoot:nf,querySelector:of,querySelectorAll:af,mutationObserver:Po,patch:Ee};function Z(s,e,t=document){let r={capture:!0,passive:!0};return t.addEventListener(s,e,r),()=>t.removeEventListener(s,e,r)}var xe=`Please stop import mirror directly. Instead of that,\\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\\r\nor you can use record.mirror to access the mirror instance during recording.`,Zi={map:{},getId(){return console.error(xe),-1},getNode(){return console.error(xe),null},removeNodeFromMap(){console.error(xe)},has(){return console.error(xe),!1},reset(){console.error(xe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Zi=new Proxy(Zi,{get(s,e,t){return e==="map"&&console.error(xe),Reflect.get(s,e,t)}}));function nt(s,e,t={}){let r=null,i=0;return function(...n){let o=Date.now();!i&&t.leading===!1&&(i=o);let l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function gr(s,e,t,r,i=window){let n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>gr(s,e,n||{},!0)}var rr=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(rr=()=>new Date().getTime());function $o(s){var e,t,r,i;let n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||n?.body&&((e=C.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n?.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:n?.documentElement.scrollTop||n?.body&&((r=C.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n?.body)==null?void 0:i.scrollTop)||0}}function Lo(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Fo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Uo(s){return s?s.nodeType===s.ELEMENT_NODE?s:C.parentElement(s):null}function X(s,e,t,r){if(!s)return!1;let i=Uo(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Yt(i,e,r))return!0}catch{}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function lf(s,e){return e.getId(s)!==-1}function Fr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===Je}function Bo(s,e){if(Ye(s))return!1;let t=e.getId(s);if(!e.has(t))return!0;let r=C.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?Bo(r,e):!0}function ws(s){return!!s.changedTouches}function uf(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Wo(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function zo(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function bs(s){return s?s instanceof ys&&"shadowRoot"in s?!!s.shadowRoot:!!C.shadowRoot(s):!1}var Ss=class{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Vo(s){var e;let t=null;return"getRootNode"in s&&((e=C.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(s))&&(t=C.host(C.getRootNode(s))),t}function cf(s){let e=s,t;for(;t=Vo(e);)e=t;return e}function hf(s){let e=C.ownerDocument(s);if(!e)return!1;let t=cf(s);return C.contains(e,t)}function Go(s){let e=C.ownerDocument(s);return e?C.contains(e,s)||hf(s):!1}var x=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(x||{}),E=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(E||{}),J=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(J||{}),ue=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(ue||{}),$e=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))($e||{}),Me=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Me||{});var jo=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(jo||{});function Xi(s){return"__ln"in s}var vs=class{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Xi(e.previousSibling)){let r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&Xi(e.nextSibling)&&e.nextSibling.__ln.previous){let r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Ji=(s,e)=>`${s}@${e}`,Cs=class{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),w(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,r=new vs,i=a=>{let u=a,c=Je;for(;c===Je;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},n=a=>{let u=C.parentNode(a);if(!u||!Go(a))return;let c=!1;if(a.nodeType===Node.TEXT_NODE){let m=u.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let h=Ye(u)?this.mirror.getId(Vo(a)):this.mirror.getId(u),p=i(a);if(h===-1||p===-1)return r.addNode(a);let g=Re(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:m=>{Wo(m,this.mirror)&&this.iframeManager.addIframe(m),zo(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),bs(a)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(a),this.doc)},onIframeLoad:(m,d)=>{this.iframeManager.attachIframe(m,d),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,d)=>{this.stylesheetManager.attachLinkElement(m,d)},cssCaptured:c});g&&(e.push({parentId:h,nextId:p,node:g}),t.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of this.movedSet)Ki(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(C.parentNode(a))||n(a);for(let a of this.addedSet)!Qi(this.droppedSet,a)&&!Ki(this.removesSubTreeCache,a,this.mirror)||Qi(this.movedSet,a)?n(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){let u=this.mirror.getId(C.parentNode(o.value)),c=i(o.value);u!==-1&&c!==-1&&(a=o)}if(!a){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let h=this.mirror.getId(C.parentNode(c.value));if(i(c.value)===-1)continue;if(h!==-1){a=c;break}else{let g=c.value,m=C.parentNode(g);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let d=C.host(m);if(this.mirror.getId(d)!==-1){a=c;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),n(a.value)}let l={texts:this.texts.map(a=>{let u=a.node,c=C.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:a.value}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{let{attributes:u}=a;if(typeof u.style=="string"){let c=JSON.stringify(a.styleDiff),h=JSON.stringify(a._unchangedStyles);c.length<u.style.length&&(c+h).split("var(").length===u.style.split("var(").length&&(u.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:u}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(l))}),w(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(C.childNodes(e),i=>C.textContent(i)||"").join("");t.attributes.value=Gt({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:jt(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!Fr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=C.textContent(e.target);!X(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:dn(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Uo(e.target)):t.replace(/[\\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){let o=jt(t);i=Gt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(X(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!fn(t.tagName,r))if(n.attributes[r]=hn(this.doc,Se(t.tagName),Se(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(let l of Array.from(t.style)){let a=t.style.getPropertyValue(l),u=t.style.getPropertyPriority(l);a!==o.style.getPropertyValue(l)||u!==o.style.getPropertyPriority(l)?u===""?n.styleDiff[l]=a:n.styleDiff[l]=[a,u]:n._unchangedStyles[l]=[a,u]}for(let l of Array.from(o.style))t.style.getPropertyValue(l)===""&&(n.styleDiff[l]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(X(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),i=Ye(e.target)?this.mirror.getId(C.host(e.target)):this.mirror.getId(e.target);X(e.target,this.blockClass,this.blockSelector,!1)||Fr(t,this.mirror,this.slimDOMOptions)||!lf(t,this.mirror)||(this.addedSet.has(t)?(Es(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||Bo(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ji(r,i)]?Es(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:Ye(e.target)&&Ze(e.target)?!0:void 0}),ff(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Fr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Ji(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);X(e,this.blockClass,this.blockSelector,!1)||(C.childNodes(e).forEach(r=>this.genAdds(r)),bs(e)&&C.childNodes(C.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function Es(s,e){s.delete(e),C.childNodes(e).forEach(t=>Es(s,t))}function ff(s,e){let t=[s];for(;t.length;){let r=t.pop();e.has(r)||(e.add(r),C.childNodes(r).forEach(i=>t.push(i)))}}function Ki(s,e,t){return s.size===0?!1:df(s,e)}function df(s,e,t){let r=C.parentNode(e);return r?s.has(r):!1}function Qi(s,e){return s.size===0?!1:Ho(s,e)}function Ho(s,e){let t=C.parentNode(e);return t?s.has(t)?!0:Ho(s,t):!1}var Xe;function pf(s){Xe=s}function mf(){Xe=void 0}var I=s=>Xe?(...t)=>{try{return s(...t)}catch(r){if(Xe&&Xe(r)===!0)return;throw r}}:s,be=[];function ct(s){try{if("composedPath"in s){let e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch{}return s&&s.target}function Yo(s,e){let t=new Cs;be.push(t),t.init(s);let r=new(Po())(I(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function gf({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,o=[],l,a=nt(I(h=>{let p=Date.now()-l;s(o.map(g=>(g.timeOffset-=p,g)),h),o=[],l=null}),n),u=I(nt(I(h=>{let p=ct(h),{clientX:g,clientY:m}=ws(h)?h.changedTouches[0]:h;l||(l=rr()),o.push({x:g,y:m,id:r.getId(p),timeOffset:rr()-l}),a(typeof DragEvent<"u"&&h instanceof DragEvent?E.Drag:h instanceof MouseEvent?E.MouseMove:E.TouchMove)}),i,{trailing:!1})),c=[Z("mousemove",u,t),Z("touchmove",u,t),Z("drag",u,t)];return I(()=>{c.forEach(h=>h())})}function yf({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};let o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[],a=null,u=c=>h=>{let p=ct(h);if(X(p,r,i,!0))return;let g=null,m=c;if("pointerType"in h){switch(h.pointerType){case"mouse":g=ue.Mouse;break;case"touch":g=ue.Touch;break;case"pen":g=ue.Pen;break}g===ue.Touch?J[c]===J.MouseDown?m="TouchStart":J[c]===J.MouseUp&&(m="TouchEnd"):ue.Pen}else ws(h)&&(g=ue.Touch);g!==null?(a=g,(m.startsWith("Touch")&&g===ue.Touch||m.startsWith("Mouse")&&g===ue.Mouse)&&(g=null)):J[c]===J.Click&&(g=a,a=null);let d=ws(h)?h.changedTouches[0]:h;if(!d)return;let f=t.getId(p),{clientX:b,clientY:S}=d;I(s)({type:J[m],id:f,x:b,y:S,...g!==null&&{pointerType:g}})};return Object.keys(J).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&o[c]!==!1).forEach(c=>{let h=Se(c),p=u(c);if(window.PointerEvent)switch(J[c]){case J.MouseDown:case J.MouseUp:h=h.replace("mouse","pointer");break;case J.TouchStart:case J.TouchEnd:return}l.push(Z(h,p,e))}),I(()=>{l.forEach(c=>c())})}function Zo({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){let o=I(nt(I(l=>{let a=ct(l);if(!a||X(a,r,i,!0))return;let u=t.getId(a);if(a===e&&e.defaultView){let c=$o(e.defaultView);s({id:u,x:c.left,y:c.top})}else s({id:u,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return Z("scroll",o,e)}function wf({viewportResizeCb:s},{win:e}){let t=-1,r=-1,i=I(nt(I(()=>{let n=Lo(),o=Fo();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return Z("resize",i,e)}var bf=["INPUT","TEXTAREA","SELECT"],qi=new WeakMap;function Sf({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:c}){function h(S){let y=ct(S),v=S.isTrusted,N=y&&y.tagName;if(y&&N==="OPTION"&&(y=C.parentElement(y)),!y||!N||bf.indexOf(N)<0||X(y,r,i,!0)||y.classList.contains(n)||o&&y.matches(o))return;let T=y.value,V=!1,$=jt(y)||"";$==="radio"||$==="checkbox"?V=y.checked:(l[N.toLowerCase()]||l[$])&&(T=Gt({element:y,maskInputOptions:l,tagName:N,type:$,value:T,maskInputFn:a})),p(y,c?{text:T,isChecked:V,userTriggered:v}:{text:T,isChecked:V});let z=y.name;$==="radio"&&z&&V&&e.querySelectorAll(`input[type="radio"][name="${z}"]`).forEach(H=>{if(H!==y){let Q=H.value;p(H,c?{text:Q,isChecked:!V,userTriggered:!1}:{text:Q,isChecked:!V})}})}function p(S,y){let v=qi.get(S);if(!v||v.text!==y.text||v.isChecked!==y.isChecked){qi.set(S,y);let N=t.getId(S);I(s)({...y,id:N})}}let m=(u.input==="last"?["change"]:["input","change"]).map(S=>Z(S,I(h),e)),d=e.defaultView;if(!d)return()=>{m.forEach(S=>S())};let f=d.Object.getOwnPropertyDescriptor(d.HTMLInputElement.prototype,"value"),b=[[d.HTMLInputElement.prototype,"value"],[d.HTMLInputElement.prototype,"checked"],[d.HTMLSelectElement.prototype,"value"],[d.HTMLTextAreaElement.prototype,"value"],[d.HTMLSelectElement.prototype,"selectedIndex"],[d.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&m.push(...b.map(S=>gr(S[0],S[1],{set(){I(h)({target:this,isTrusted:!1})}},!1,d))),I(()=>{m.forEach(S=>S())})}function sr(s){let e=[];function t(r,i){if(Pt("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Pt("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Pt("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Pt("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){let o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function me(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function vf({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:I((c,h,p)=>{let[g,m]=p,{id:d,styleId:f}=me(h,e,t.styleMirror);return(d&&d!==-1||f&&f!==-1)&&s({id:d,styleId:f,adds:[{rule:g,index:m}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(c,h,p=this.cssRules.length){let g=`${c} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[g,p])};let n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:I((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,removes:[{index:g}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:I((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replace:g}),c.apply(h,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:I((c,h,p)=>{let[g]=p,{id:m,styleId:d}=me(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,replaceSync:g}),c.apply(h,p)})}));let a={};$t("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:($t("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),$t("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),$t("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));let u={};return Object.entries(a).forEach(([c,h])=>{u[c]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[c].insertRule,{apply:I((p,g,m)=>{let[d,f]=m,{id:b,styleId:S}=me(g.parentStyleSheet,e,t.styleMirror);return(b&&b!==-1||S&&S!==-1)&&s({id:b,styleId:S,adds:[{rule:d,index:[...sr(g),f||0]}]}),p.apply(g,m)})}),h.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:I((p,g,m)=>{let[d]=m,{id:f,styleId:b}=me(g.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||b&&b!==-1)&&s({id:f,styleId:b,removes:[{index:[...sr(g),d]}]}),p.apply(g,m)})})}),I(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([c,h])=>{h.prototype.insertRule=u[c].insertRule,h.prototype.deleteRule=u[c].deleteRule})})}function Xo({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(C.host(t));let l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,a=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var u;return(u=a.get)==null?void 0:u.call(this)},set(u){var c;let h=(c=a.set)==null?void 0:c.call(this,u);if(o!==null&&o!==-1)try{e.adoptStyleSheets(u,o)}catch{}return h}}),I(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Cf({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){let n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:I((l,a,u)=>{var c;let[h,p,g]=u;if(t.has(h))return n.apply(a,[h,p,g]);let{id:m,styleId:d}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,set:{property:h,value:p,priority:g},index:sr(a.parentRule)}),l.apply(a,u)})});let o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:I((l,a,u)=>{var c;let[h]=u;if(t.has(h))return o.apply(a,[h]);let{id:p,styleId:g}=me((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&s({id:p,styleId:g,remove:{property:h},index:sr(a.parentRule)}),l.apply(a,u)})}),I(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Ef({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){let o=I(a=>nt(I(u=>{let c=ct(u);if(!c||X(c,e,t,!0))return;let{currentTime:h,volume:p,muted:g,playbackRate:m,loop:d}=c;s({type:a,id:r.getId(c),currentTime:h,volume:p,muted:g,playbackRate:m,loop:d})}),i.media||500)),l=[Z("play",o(Me.Play),n),Z("pause",o(Me.Pause),n),Z("seeked",o(Me.Seeked),n),Z("volumechange",o(Me.VolumeChange),n),Z("ratechange",o(Me.RateChange),n)];return I(()=>{l.forEach(a=>a())})}function If({fontCb:s,doc:e}){let t=e.defaultView;if(!t)return()=>{};let r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,u,c){let h=new n(a,u,c);return i.set(h,{family:a,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};let o=Ee(e.fonts,"add",function(l){return function(a){return setTimeout(I(()=>{let u=i.get(a);u&&(s(u),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),I(()=>{r.forEach(l=>l())})}function xf(s){let{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s,o=!0,l=I(()=>{let a=e.getSelection();if(!a||o&&a?.isCollapsed)return;o=a.isCollapsed||!1;let u=[],c=a.rangeCount||0;for(let h=0;h<c;h++){let p=a.getRangeAt(h),{startContainer:g,startOffset:m,endContainer:d,endOffset:f}=p;X(g,r,i,!0)||X(d,r,i,!0)||u.push({start:t.getId(g),startOffset:m,end:t.getId(d),endOffset:f})}n({ranges:u})});return l(),Z("selectionchange",l)}function Mf({doc:s,customElementCb:e}){let t=s.defaultView;return!t||!t.customElements?()=>{}:Ee(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch{console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function Nf(s,e){let{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:p,selectionCb:g,customElementCb:m}=s;s.mutationCb=(...d)=>{e.mutation&&e.mutation(...d),t(...d)},s.mousemoveCb=(...d)=>{e.mousemove&&e.mousemove(...d),r(...d)},s.mouseInteractionCb=(...d)=>{e.mouseInteraction&&e.mouseInteraction(...d),i(...d)},s.scrollCb=(...d)=>{e.scroll&&e.scroll(...d),n(...d)},s.viewportResizeCb=(...d)=>{e.viewportResize&&e.viewportResize(...d),o(...d)},s.inputCb=(...d)=>{e.input&&e.input(...d),l(...d)},s.mediaInteractionCb=(...d)=>{e.mediaInteaction&&e.mediaInteaction(...d),a(...d)},s.styleSheetRuleCb=(...d)=>{e.styleSheetRule&&e.styleSheetRule(...d),u(...d)},s.styleDeclarationCb=(...d)=>{e.styleDeclaration&&e.styleDeclaration(...d),c(...d)},s.canvasMutationCb=(...d)=>{e.canvasMutation&&e.canvasMutation(...d),h(...d)},s.fontCb=(...d)=>{e.font&&e.font(...d),p(...d)},s.selectionCb=(...d)=>{e.selection&&e.selection(...d),g(...d)},s.customElementCb=(...d)=>{e.customElement&&e.customElement(...d),m(...d)}}function Rf(s,e={}){let t=s.doc.defaultView;if(!t)return()=>{};Nf(s,e);let r;s.recordDOM&&(r=Yo(s,s.doc));let i=gf(s),n=yf(s),o=Zo(s),l=wf(s,{win:t}),a=Sf(s),u=Ef(s),c=()=>{},h=()=>{},p=()=>{},g=()=>{};s.recordDOM&&(c=vf(s,{win:t}),h=Xo(s,s.doc),p=Cf(s,{win:t}),s.collectFonts&&(g=If(s)));let m=xf(s),d=Mf(s),f=[];for(let b of s.plugins)f.push(b.observer(b.callback,t,b.options));return I(()=>{be.forEach(b=>b.reset()),r?.disconnect(),i(),n(),o(),l(),a(),u(),c(),h(),p(),g(),m(),d(),f.forEach(b=>b())})}function Pt(s){return typeof window[s]<"u"}function $t(s){return!!(typeof window[s]<"u"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}var ir=class{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){let n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e),l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.set(l,t)),l}getIds(e,t){let r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){let i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;let n=i.get(t);return n||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},Is=class{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new ir(cn)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ir(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case x.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:x.IncrementalSnapshot,data:{source:E.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case x.Meta:case x.Load:case x.DomContentLoaded:return!1;case x.Plugin:return t;case x.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case x.IncrementalSnapshot:switch(t.data.source){case E.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case E.Drag:case E.TouchMove:case E.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case E.ViewportResize:return!1;case E.MediaInteraction:case E.MouseInteraction:case E.Scroll:case E.CanvasMutation:case E.Input:return this.replaceIds(t.data,e,["id"]),t;case E.StyleSheetRule:case E.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case E.Font:return t;case E.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case E.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(let n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==jo.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},xs=class{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!Ze(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let r=Yo({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(Zo({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(C.host(e))),this.restoreHandlers.push(Xo({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(Ee(e.prototype,"attachShadow",function(i){return function(n){let o=i.call(this,n),l=C.shadowRoot(this);return l&&Go(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Af=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(He=0;He<Ae.length;He++)Af[Ae.charCodeAt(He)]=He;var He,Of=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Ae[e[t]>>2],i+=Ae[(e[t]&3)<<4|e[t+1]>>4],i+=Ae[(e[t+1]&15)<<2|e[t+2]>>6],i+=Ae[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var en=new Map;function Df(s,e){let t=en.get(s);return t||(t=new Map,en.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}var Jo=(s,e,t)=>{if(!s||!(Qo(s,e)||typeof s=="object"))return;let r=s.constructor.name,i=Df(t,r),n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function Wt(s,e,t){if(s instanceof Array)return s.map(r=>Wt(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){let r=s.constructor.name,i=Of(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[Wt(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){let r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){let r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[Wt(s.data,e,t),s.width,s.height]};if(Qo(s,e)||typeof s=="object"){let r=s.constructor.name,i=Jo(s,e,t);return{rr_type:r,index:i}}}}return s}var Ko=(s,e,t)=>s.map(r=>Wt(r,e,t)),Qo=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function Tf(s,e,t,r){let i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;let l=Ee(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...u){return X(this.canvas,t,r,!0)||setTimeout(()=>{let c=Ko(u,e,this);s(this.canvas,{type:$e["2D"],property:o,args:c})},0),a.apply(this,u)}});i.push(l)}catch{let l=gr(e.CanvasRenderingContext2D.prototype,o,{set(a){s(this.canvas,{type:$e["2D"],property:o,args:[a],setter:!0})}});i.push(l)}return()=>{i.forEach(o=>o())}}function _f(s){return s==="experimental-webgl"?"webgl":s}function tn(s,e,t,r){let i=[];try{let n=Ee(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!X(this,e,t,!0)){let u=_f(l);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(a[0]&&typeof a[0]=="object"){let c=a[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function rn(s,e,t,r,i,n){let o=[],l=Object.getOwnPropertyNames(s);for(let a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;let u=Ee(s,a,function(c){return function(...h){let p=c.apply(this,h);if(Jo(p,n,this),"tagName"in this.canvas&&!X(this.canvas,r,i,!0)){let g=Ko(h,n,this),m={type:e,property:a,args:g};t(this.canvas,m)}return p}});o.push(u)}catch{let u=gr(s,a,{set(c){t(this.canvas,{type:e,property:a,args:[c],setter:!0})}});o.push(u)}return o}function kf(s,e,t,r){let i=[];return i.push(...rn(e.WebGLRenderingContext.prototype,$e.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...rn(e.WebGL2RenderingContext.prototype,$e.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}var qo="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",Pf=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),sn=typeof window<"u"&&window.Blob&&new Blob([Pf(qo)],{type:"text/javascript;charset=utf-8"});function $f(s){let e;try{if(e=sn&&(window.URL||window.webkitURL).createObjectURL(sn),!e)throw"";let t=new Worker(e,{name:s?.name});return t.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+qo,{name:s?.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var Ms=class{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(a,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(u)});let{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,i,n){let o=tn(t,r,i,!0),l=new Map,a=new $f;a.onmessage=m=>{let{id:d}=m.data;if(l.set(d,!1),!("base64"in m.data))return;let{base64:f,type:b,width:S,height:y}=m.data;this.mutationCb({id:d,type:$e["2D"],commands:[{property:"clearRect",args:[0,0,S,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:b}]},0,0]}]})};let u=1e3/e,c=0,h,p=()=>{let m=[];return t.document.querySelectorAll("canvas").forEach(d=>{X(d,r,i,!0)||m.push(d)}),m},g=m=>{if(c&&m-c<u){h=requestAnimationFrame(g);return}c=m,p().forEach(async d=>{var f;let b=this.mirror.getId(d);if(l.get(b)||d.width===0||d.height===0)return;if(l.set(b,!0),["webgl","webgl2"].includes(d.__context)){let y=d.getContext(d.__context);((f=y?.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let S=await createImageBitmap(d);a.postMessage({id:b,bitmap:S,width:d.width,height:d.height,dataURLOptions:n.dataURLOptions},[S])}),h=requestAnimationFrame(g)};h=requestAnimationFrame(g),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=tn(e,t,r,!1),n=Tf(this.processMutation.bind(this),e,t,r),o=kf(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let i=r.map(o=>{let{type:l,...a}=o;return a}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}},Ns=class{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new Ss),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},i=[];for(let n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:ln(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},Rs=class{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},W,zt,Ur,nr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){let s=document.createElement("iframe");document.body.appendChild(s),Array.from=((ai=s.contentWindow)==null?void 0:ai.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}var re=za();function pe(s={}){let{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:g,maskInputFn:m,maskTextFn:d,hooks:f,packFn:b,sampling:S={},dataURLOptions:y={},mousemoveWait:v,recordDOM:N=!0,recordCanvas:T=!1,recordCrossOriginIframes:V=!1,recordAfter:$=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:z=!1,collectFonts:H=!1,inlineImages:Q=!1,plugins:ne,keepIframeSrcFn:M=()=>!1,ignoreCSSAttributes:Fe=new Set([]),errorHandler:Ue}=s;pf(Ue);let G=V?window.parent===window:!0,q=!1;if(!G)try{window.parent.document&&(q=!1)}catch{q=!0}if(G&&!e)throw new Error("emit function is required");if(!G&&!q)return()=>{};v!==void 0&&S.mousemove===void 0&&(S.mousemove=v),re.reset();let ge=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},oe=pn(g);uf();let Qs,br=0,qs=R=>{for(let te of ne||[])te.eventProcessor&&(R=te.eventProcessor(R));return b&&!q&&(R=b(R)),R};W=(R,te)=>{var U;let B=R;if(B.timestamp=rr(),(U=be[0])!=null&&U.isFrozen()&&B.type!==x.FullSnapshot&&!(B.type===x.IncrementalSnapshot&&B.data.source===E.Mutation)&&be.forEach(K=>K.unfreeze()),G)e?.(qs(B),te);else if(q){let K={type:"rrweb",event:qs(B),origin:window.location.origin,isCheckout:te};window.parent.postMessage(K,"*")}if(B.type===x.FullSnapshot)Qs=B,br=0;else if(B.type===x.IncrementalSnapshot){if(B.data.source===E.Mutation&&B.data.isAttachIframe)return;br++;let K=r&&br>=r,D=t&&B.timestamp-Qs.timestamp>t;(K||D)&&zt(!0)}};let ft=R=>{W({type:x.IncrementalSnapshot,data:{source:E.Mutation,...R}})},ei=R=>W({type:x.IncrementalSnapshot,data:{source:E.Scroll,...R}}),ti=R=>W({type:x.IncrementalSnapshot,data:{source:E.CanvasMutation,...R}}),ta=R=>W({type:x.IncrementalSnapshot,data:{source:E.AdoptedStyleSheet,...R}}),ye=new Ns({mutationCb:ft,adoptedStyleSheetCb:ta}),we=new Is({mirror:re,mutationCb:ft,stylesheetManager:ye,recordCrossOriginIframes:V,wrappedEmit:W});for(let R of ne||[])R.getMirror&&R.getMirror({nodeMirror:re,crossOriginIframeMirror:we.crossOriginIframeMirror,crossOriginIframeStyleMirror:we.crossOriginIframeStyleMirror});let Sr=new Rs;Ur=new Ms({recordCanvas:T,mutationCb:ti,win:window,blockClass:i,blockSelector:n,mirror:re,sampling:S.canvas,dataURLOptions:y});let dt=new xs({mutationCb:ft,scrollCb:ei,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:ge,dataURLOptions:y,maskTextFn:d,maskInputFn:m,recordCanvas:T,inlineImages:Q,sampling:S,slimDOMOptions:oe,iframeManager:we,stylesheetManager:ye,canvasManager:Ur,keepIframeSrcFn:M,processedNodeManager:Sr},mirror:re});zt=(R=!1)=>{if(!N)return;W({type:x.Meta,data:{href:window.location.href,width:Fo(),height:Lo()}},R),ye.reset(),dt.init(),be.forEach(U=>U.lock());let te=fl(document,{mirror:re,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:ge,maskTextFn:d,maskInputFn:m,slimDOM:oe,dataURLOptions:y,recordCanvas:T,inlineImages:Q,onSerialize:U=>{Wo(U,re)&&we.addIframe(U),zo(U,re)&&ye.trackLinkElement(U),bs(U)&&dt.addShadowRoot(C.shadowRoot(U),document)},onIframeLoad:(U,B)=>{we.attachIframe(U,B),dt.observeAttachShadow(U)},onStylesheetLoad:(U,B)=>{ye.attachLinkElement(U,B)},keepIframeSrcFn:M});if(!te)return console.warn("Failed to snapshot the document");W({type:x.FullSnapshot,data:{node:te,initialOffset:$o(window)}},R),be.forEach(U=>U.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ye.adoptStyleSheets(document.adoptedStyleSheets,re.getId(document))};try{let R=[],te=B=>{var K;return I(Rf)({mutationCb:ft,mousemoveCb:(D,vr)=>W({type:x.IncrementalSnapshot,data:{source:vr,positions:D}}),mouseInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.MouseInteraction,...D}}),scrollCb:ei,viewportResizeCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.ViewportResize,...D}}),inputCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.Input,...D}}),mediaInteractionCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.MediaInteraction,...D}}),styleSheetRuleCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.StyleSheetRule,...D}}),styleDeclarationCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.StyleDeclaration,...D}}),canvasMutationCb:ti,fontCb:D=>W({type:x.IncrementalSnapshot,data:{source:E.Font,...D}}),selectionCb:D=>{W({type:x.IncrementalSnapshot,data:{source:E.Selection,...D}})},customElementCb:D=>{W({type:x.IncrementalSnapshot,data:{source:E.CustomElement,...D}})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:u,maskInputOptions:ge,inlineStylesheet:c,sampling:S,recordDOM:N,recordCanvas:T,inlineImages:Q,userTriggeredOnInput:z,collectFonts:H,doc:B,maskInputFn:m,maskTextFn:d,keepIframeSrcFn:M,blockSelector:n,slimDOMOptions:oe,dataURLOptions:y,mirror:re,iframeManager:we,stylesheetManager:ye,shadowDomManager:dt,processedNodeManager:Sr,canvasManager:Ur,ignoreCSSAttributes:Fe,plugins:((K=ne?.filter(D=>D.observer))==null?void 0:K.map(D=>({observer:D.observer,options:D.options,callback:vr=>W({type:x.Plugin,data:{plugin:D.name,payload:vr}})})))||[]},f)};we.addLoadListener(B=>{try{R.push(te(B.contentDocument))}catch(K){console.warn(K)}});let U=()=>{zt(),R.push(te(document)),nr=!0};return["interactive","complete"].includes(document.readyState)?U():(R.push(Z("DOMContentLoaded",()=>{W({type:x.DomContentLoaded,data:{}}),$==="DOMContentLoaded"&&U()})),R.push(Z("load",()=>{W({type:x.Load,data:{}}),$==="load"&&U()},window))),()=>{R.forEach(B=>{try{B()}catch(K){String(K).toLowerCase().includes("cross-origin")||console.warn(K)}}),Sr.destroy(),nr=!1,mf()}}catch(R){console.warn(R)}}pe.addCustomEvent=(s,e)=>{if(!nr)throw new Error("please add custom event after start recording");W({type:x.Custom,data:{tag:s,payload:e}})};pe.freezePage=()=>{be.forEach(s=>s.freeze())};pe.takeFullSnapshot=s=>{if(!nr)throw new Error("please take full snapshot after start recording");zt(s)};pe.mirror=re;var nn;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(nn||(nn={}));var zd=5*1e3;var{addCustomEvent:Vd}=pe,{freezePage:Gd}=pe,{takeFullSnapshot:jd}=pe;var Lf=1e4,Ff=1800,Uf=3e3,Bf=2500,Wf=4e3,zf=.1,Vf=.25,Gf=200,jf=500,Hf=1e3,Yf=5e3,Zf=16,ea=1e3,Le={fcp:null,lcp:null,cls:0,interactionDurations:new Map},Xf={FCP:[Ff,Uf],LCP:[Bf,Wf],CLS:[zf,Vf],INP:[Gf,jf]},Jf=(s,e)=>{let t=Xf[s];return t?e<t[0]?"good":e<t[1]?"needs-improvement":"poor":"unknown"};try{new PerformanceObserver(s=>{for(let e of s.getEntries())e.name==="first-contentful-paint"&&(Le.fcp=e.startTime)}).observe({type:"paint",buffered:!0})}catch{}try{new PerformanceObserver(s=>{for(let e of s.getEntries())Le.lcp=e.startTime}).observe({type:"largest-contentful-paint",buffered:!0})}catch{}try{new PerformanceObserver(s=>{for(let e of s.getEntries()){let{interactionId:t}=e;if(t&&t>0){let r=Le.interactionDurations.get(t)??0;Le.interactionDurations.set(t,Math.max(r,e.duration))}}}).observe({type:"event",buffered:!0,durationThreshold:Zf})}catch{}try{let s=[];new PerformanceObserver(e=>{for(let o of e.getEntries()){let l=o;l.hadRecentInput||s.push(l)}let t=0,r=0,i=0,n=0;for(let o of s)(o.startTime-n>Hf||o.startTime-i>Yf)&&(r=0,i=o.startTime),r+=o.value,n=o.startTime+o.duration,r>t&&(t=r);Le.cls=t}).observe({type:"layout-shift",buffered:!0})}catch{}var yr=(s,e)=>e===null?null:{value:s==="CLS"?Math.round(e*ea)/ea:Math.round(e),rating:Jf(s,e)},Kf=()=>{let{fcp:s,lcp:e,cls:t,interactionDurations:r}=Le,i=null;return r.size>0&&(i=[...r.values()].sort((o,l)=>l-o)[0]),{fcp:yr("FCP",s),lcp:yr("LCP",e),cls:yr("CLS",t),inp:yr("INP",i)}},Qf=(s,e)=>{let t=document.createElement("div");t.id=s,t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.zIndex="2147483647",t.style.pointerEvents="none";for(let r of e){let i=document.createElement("div");i.textContent=`[${r.label}]`,i.style.position="absolute",i.style.left=`${r.x}px`,i.style.top=`${r.y}px`,i.style.background="rgba(255, 0, 0, 0.85)",i.style.color="white",i.style.fontSize="11px",i.style.fontFamily="monospace",i.style.fontWeight="bold",i.style.padding="1px 3px",i.style.borderRadius="3px",i.style.lineHeight="1.2",i.style.whiteSpace="nowrap",t.appendChild(i)}document.body.appendChild(t)},qf=s=>{document.getElementById(s)?.remove()},ed=(s,e,t,r,i)=>{let n=new Set(t),o=new Set(r),l=document.querySelector(s)||document.body,a=l.querySelectorAll("*"),u=[];for(let c of a){let h=c.tagName.toLowerCase();if(o.has(h))continue;let p=c.getAttribute("role");if(p&&n.has(p.toLowerCase()))continue;let m=getComputedStyle(c).cursor==="pointer",d=c.hasAttribute("onclick")||c instanceof HTMLElement&&c.onclick!==null,f=c.getAttribute("tabindex"),b=f!==null&&f!=="-1";if(!m&&!d&&!b)continue;if(m&&!d&&!b){let N=c.parentElement;if(N&&getComputedStyle(N).cursor==="pointer")continue}let S=(c.textContent||"").trim().slice(0,e);if(!S)continue;let y=c.getBoundingClientRect();if(y.width===0||y.height===0)continue;let v=[];if(m&&v.push("cursor:pointer"),d&&v.push("onclick"),b&&v.push("tabindex"),u.push({selector:si(c,{root:l}),text:S,reason:v.join(", ")}),u.length>=i)break}return u},ht=[],wr,td=()=>{wr||(ht.length=0,wr=pe({checkoutEveryNms:Lf,sampling:{input:"last"},emit(s){ht.push(s)}})??void 0)},rd=()=>{wr?.(),wr=void 0},sd=()=>ht.splice(0),id=()=>[...ht],nd=()=>ht.length;return aa(od);})();\n/*! Bundled license information:\n\nrrweb/dist/rrweb.js:\n (*! *****************************************************************************\n Copyright (c) Microsoft Corporation.\n \n Permission to use, copy, modify, and/or distribute this software for any\n purpose with or without fee is hereby granted.\n \n THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n PERFORMANCE OF THIS SOFTWARE.\n ***************************************************************************** *)\n*/\n\nglobalThis.__EXPECT_RUNTIME__ = __EXPECT_RUNTIME__;\n'),catch:kO}),t.cookies){let n=Array.isArray(t.cookies)?t.cookies:yield*NO(e??``,r.preferredProfile);yield*ap({try:()=>o.addCookies(n.map(e=>e.playwrightFormat)),catch:kO})}let s=yield*ap({try:()=>o.newPage(),catch:kO});return e&&(yield*ap({try:()=>s.goto(e,{waitUntil:t.waitUntil??`load`}),catch:t=>new iO({url:e,cause:t instanceof Error?t.message:String(t)})})),{browser:n,context:o,page:s}}).pipe(Ap(()=>ap(()=>n.close()).pipe(Cp(`UnknownError`,()=>lp))))}),t=H(`Browser.snapshot`)(function*(e,t={}){let n=t.timeout??3e4,r=t.selector??`body`;yield*sm({selector:r});let i=yield*ap({try:()=>e.locator(r).ariaSnapshot({timeout:n}),catch:e=>new ZD({selector:r,timeoutMs:n,cause:e instanceof Error?e.message:String(e)})}),a={},o=[],s=0;for(let e of i.split(`
30
+ `)){if(t.maxDepth!==void 0&&mO(e)>t.maxDepth)continue;let n=CO(e);if(fr(n)){t.interactive||o.push(e);continue}let{role:r,name:i}=n.value;if(!(t.interactive&&!qD.has(r)))if(OO(r,i,t.interactive)){let t=`e${++s}`;a[t]={role:r,name:i},o.push(`${e} [ref=${t}]`)}else o.push(e)}t.cursor&&(s=yield*PO(e,o,a,s,t)),TO(a);let c=o.join(`
31
+ `);t.interactive&&s===0&&(c=`(no interactive elements)`),t.compact&&(c=gO(c));let l=EO(c,a);return{tree:c,refs:a,stats:l,locator:vO(e,a)}});return{createPage:e,snapshot:t,act:H(`Browser.act`)(function*(e,n,r,i){yield*sm({ref:n});let a=yield*(yield*t(e,i)).locator(n);return yield*ap({try:()=>r(a),catch:e=>pO(e,n)}),yield*t(e,i)}),annotatedScreenshot:H(`Browser.annotatedScreenshot`)(function*(e,n={}){let r=yield*t(e,n),i=[],a=[],o=0;for(let[e,t]of Object.entries(r.refs)){let n=yield*r.locator(e),s=yield*ap(()=>n.boundingBox()).pipe(Cp(`UnknownError`,()=>F(void 0)));s&&(o++,i.push({label:o,ref:e,role:t.role,name:t.name}),a.push({label:o,x:s.x,y:s.y}))}return yield*FO(e,a),yield*Qp(ap({try:()=>e.screenshot({fullPage:n.fullPage}),catch:kO}).pipe(B(e=>({screenshot:e,annotations:i}))),yO(e,`removeOverlay`,YD).pipe(V(()=>lp)))}),waitForNavigationSettle:H(`Browser.waitForNavigationSettle`)(function*(e,t){yield*ap({try:()=>e.waitForURL(e=>e.toString()!==t,{timeout:1e3,waitUntil:`commit`}),catch:kO}).pipe(Cp(`BrowserLaunchError`,()=>lp)),e.url()!==t&&(yield*ap(()=>e.waitForLoadState(`domcontentloaded`)).pipe(Cp(`UnknownError`,()=>lp)),yield*ap({try:()=>e.waitForTimeout(500),catch:kO}))}),preExtractCookies:H(`Browser.preExtractCookies`)(function*(){let{preferredProfile:e}=yield*AO();return yield*NO(``,e)})}})}){static layer=Od(this)(this.make)};H(`Recorder.collectEvents`)(function*(e){let t=yield*yO(e,`getEvents`).pipe(V(e=>new aO({cause:String(e)}).asEffect()));return{events:t,total:(yield*yO(e,`getEventCount`).pipe(V(e=>new aO({cause:String(e)}).asEffect())))+t.length}});const LO=H(`Recorder.collectAllEvents`)(function*(e){return yield*yO(e,`getAllEvents`).pipe(V(e=>new aO({cause:String(e)}).asEffect()))}),RO=e=>Te(e)&&`type`in e&&`timestamp`in e;H(`Recorder.loadSession`)(function*(e){return yield*np((yield*(yield*sC).readFileString(e).pipe(Cp(`PlatformError`,t=>new oO({path:e,cause:String(t)}).asEffect()))).trim().split(`
32
+ `),(t,n)=>mp({try:()=>{let e=JSON.parse(t);if(!RO(e))throw Error(`Missing required 'type' and 'timestamp' fields`);return e},catch:t=>new oO({path:e,cause:`Invalid rrweb event at line ${n+1}: ${String(t)}`})}))});const zO=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`),BO=`2.0.0-alpha.18`,VO=`https://cdn.jsdelivr.net/npm/rrweb-player@${BO}/dist/style.css`,HO=`https://cdn.jsdelivr.net/npm/rrweb-player@${BO}/dist/rrweb-player.js`,UO=e=>e===`sse`?`
33
33
  const res = await fetch('/latest.json');
34
34
  if (res.ok) { allEvents = await res.json(); if (allEvents.length >= 2) initPlayer(allEvents); }
35
35
  const es = new EventSource('/events');
@@ -47,7 +47,7 @@ import{r as e,t}from"./chunk-wdO_pP5q.js";import n from"node:path";import{ZodOpt
47
47
  if (allEvents.length >= 2) initPlayer(allEvents);
48
48
  else if (statusEl) statusEl.textContent = 'No replay events recorded.';
49
49
  } else if (statusEl) statusEl.textContent = 'Failed to load replay.';
50
- }`,mA=e=>`
50
+ }`,WO=e=>`
51
51
  const stepsPanel = document.getElementById('steps-panel');
52
52
  const runTitle = document.getElementById('run-title');
53
53
  const runStatus = document.getElementById('run-status');
@@ -93,14 +93,14 @@ import{r as e,t}from"./chunk-wdO_pP5q.js";import n from"node:path";import{ZodOpt
93
93
  stepsList.appendChild(li);
94
94
  }
95
95
  }
96
- }`,hA=e=>{let t=e.eventsSource,n=t===`sse`,r=t===void 0?``:`
96
+ }`,GO=e=>{let t=e.eventsSource,n=t===`sse`,r=t===void 0?``:`
97
97
  <div id="replay-container"><div class="status" id="status">Loading replay…</div></div>
98
98
  ${t!==void 0&&t!==`sse`?`
99
99
  <script>
100
100
  (function(){var b=location.pathname.split('/').pop().replace(/\\.html$/,'');document.write('<scr'+'ipt src="'+b+'.ndjson.js"></scr'+'ipt>');})();
101
101
  <\/script>`:``}
102
102
  <script type="module">
103
- import rrwebPlayer from '${fA}';
103
+ import rrwebPlayer from '${HO}';
104
104
  const container = document.getElementById('replay-container');
105
105
  const statusEl = document.getElementById('status');
106
106
  let player = null, allEvents = [];
@@ -114,7 +114,7 @@ import{r as e,t}from"./chunk-wdO_pP5q.js";import n from"node:path";import{ZodOpt
114
114
  }});
115
115
  ${n?`player.getReplayer().startLive();`:``}
116
116
  };
117
- ${pA(t)}
117
+ ${UO(t)}
118
118
  <\/script>`,i=`
119
119
  <div id="steps-panel">
120
120
  <h2 id="run-title">Test Run</h2>
@@ -122,13 +122,13 @@ import{r as e,t}from"./chunk-wdO_pP5q.js";import n from"node:path";import{ZodOpt
122
122
  <div id="run-summary" style="display:none"></div>
123
123
  <ul id="steps-list"></ul>
124
124
  </div>
125
- <script>${mA(e.steps)}<\/script>`;return`<!doctype html>
125
+ <script>${WO(e.steps)}<\/script>`;return`<!doctype html>
126
126
  <html>
127
127
  <head>
128
128
  <meta charset="utf-8" />
129
129
  <meta name="viewport" content="width=device-width, initial-scale=1" />
130
- <title>${lA(e.title)}</title>
131
- ${t===void 0?``:`<link rel="stylesheet" href="${dA}" />`}
130
+ <title>${zO(e.title)}</title>
131
+ ${t===void 0?``:`<link rel="stylesheet" href="${VO}" />`}
132
132
  <style>
133
133
  :root { color-scheme: dark }
134
134
  body { margin: 0; font-family: ui-sans-serif, system-ui, sans-serif; background: #0f172a; color: #e2e8f0 }
@@ -174,21 +174,20 @@ import{r as e,t}from"./chunk-wdO_pP5q.js";import n from"node:path";import{ZodOpt
174
174
  ${r}
175
175
  </main>
176
176
  </body>
177
- </html>`};H(`Recorder.collectEvents`)(function*(e){let t=yield*Gk(e,`getEvents`).pipe(V(e=>new jk({cause:String(e)}).asEffect()));return{events:t,total:(yield*Gk(e,`getEventCount`).pipe(V(e=>new jk({cause:String(e)}).asEffect())))+t.length}});const gA=H(`Recorder.collectAllEvents`)(function*(e){return yield*Gk(e,`getAllEvents`).pipe(V(e=>new jk({cause:String(e)}).asEffect()))}),_A=e=>Oe(e)&&`type`in e&&`timestamp`in e;H(`Recorder.loadSession`)(function*(e){return yield*fp((yield*(yield*cw).readFileString(e).pipe(Mp(`PlatformError`,t=>new Mk({path:e,cause:String(t)}).asEffect()))).trim().split(`
178
- `),(t,n)=>Cp({try:()=>{let e=JSON.parse(t);if(!_A(e))throw Error(`Missing required 'type' and 'timestamp' fields`);return e},catch:t=>new Mk({path:e,cause:`Invalid rrweb event at line ${n+1}: ${String(t)}`})}))});function vA(e){return!!e._zod}function yA(e){let t=Object.values(e);if(t.length===0)return te.object({});let n=t.every(vA),r=t.every(e=>!vA(e));if(n)return te.object(e);if(r)return ee.object(e);throw Error(`Mixed Zod versions detected in object shape.`)}function bA(e,t){return vA(e)?te.safeParse(e,t):e.safeParse(t)}async function xA(e,t){return vA(e)?await te.safeParseAsync(e,t):await e.safeParseAsync(t)}function SA(e){if(!e)return;let t;if(t=vA(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function CA(e){if(e){if(typeof e==`object`){let t=e,n=e;if(!t._def&&!n._zod){let t=Object.values(e);if(t.length>0&&t.every(e=>typeof e==`object`&&!!e&&(e._def!==void 0||e._zod!==void 0||typeof e.parse==`function`)))return yA(e)}}if(vA(e)){let t=e._zod?.def;if(t&&(t.type===`object`||t.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function wA(e){if(e&&typeof e==`object`){if(`message`in e&&typeof e.message==`string`)return e.message;if(`issues`in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==`object`&&`message`in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function TA(e){return e.description}function EA(e){if(vA(e))return e._zod?.def?.type===`optional`;let t=e;return typeof e.isOptional==`function`?e.isOptional():t._def?.typeName===`ZodOptional`}function DA(e){if(vA(e)){let t=e._zod?.def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}const OA=`2025-11-25`,kA=[OA,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],AA=`io.modelcontextprotocol/related-task`,jA=i.custom(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),MA=i.union([i.string(),i.number().int()]),NA=i.string();i.looseObject({ttl:i.union([i.number(),i.null()]).optional(),pollInterval:i.number().optional()});const PA=i.object({ttl:i.number().optional()}),FA=i.object({taskId:i.string()}),IA=i.looseObject({progressToken:MA.optional(),[AA]:FA.optional()}),LA=i.object({_meta:IA.optional()}),RA=LA.extend({task:PA.optional()}),zA=e=>RA.safeParse(e).success,BA=i.object({method:i.string(),params:LA.loose().optional()}),VA=i.object({_meta:IA.optional()}),HA=i.object({method:i.string(),params:VA.loose().optional()}),UA=i.looseObject({_meta:IA.optional()}),WA=i.union([i.string(),i.number().int()]),GA=i.object({jsonrpc:i.literal(`2.0`),id:WA,...BA.shape}).strict(),KA=e=>GA.safeParse(e).success,qA=i.object({jsonrpc:i.literal(`2.0`),...HA.shape}).strict(),JA=e=>qA.safeParse(e).success,YA=i.object({jsonrpc:i.literal(`2.0`),id:WA,result:UA}).strict(),XA=e=>YA.safeParse(e).success;var J;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(J||={});const ZA=i.object({jsonrpc:i.literal(`2.0`),id:WA.optional(),error:i.object({code:i.number().int(),message:i.string(),data:i.unknown().optional()})}).strict(),QA=e=>ZA.safeParse(e).success,$A=i.union([GA,qA,YA,ZA]);i.union([YA,ZA]);const ej=UA.strict(),tj=VA.extend({requestId:WA.optional(),reason:i.string().optional()}),nj=HA.extend({method:i.literal(`notifications/cancelled`),params:tj}),rj=i.object({src:i.string(),mimeType:i.string().optional(),sizes:i.array(i.string()).optional(),theme:i.enum([`light`,`dark`]).optional()}),ij=i.object({icons:i.array(rj).optional()}),aj=i.object({name:i.string(),title:i.string().optional()}),oj=aj.extend({...aj.shape,...ij.shape,version:i.string(),websiteUrl:i.string().optional(),description:i.string().optional()}),sj=i.intersection(i.object({applyDefaults:i.boolean().optional()}),i.record(i.string(),i.unknown())),cj=i.preprocess(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,i.intersection(i.object({form:sj.optional(),url:jA.optional()}),i.record(i.string(),i.unknown()).optional())),lj=i.looseObject({list:jA.optional(),cancel:jA.optional(),requests:i.looseObject({sampling:i.looseObject({createMessage:jA.optional()}).optional(),elicitation:i.looseObject({create:jA.optional()}).optional()}).optional()}),uj=i.looseObject({list:jA.optional(),cancel:jA.optional(),requests:i.looseObject({tools:i.looseObject({call:jA.optional()}).optional()}).optional()}),dj=i.object({experimental:i.record(i.string(),jA).optional(),sampling:i.object({context:jA.optional(),tools:jA.optional()}).optional(),elicitation:cj.optional(),roots:i.object({listChanged:i.boolean().optional()}).optional(),tasks:lj.optional()}),fj=LA.extend({protocolVersion:i.string(),capabilities:dj,clientInfo:oj}),pj=BA.extend({method:i.literal(`initialize`),params:fj}),mj=i.object({experimental:i.record(i.string(),jA).optional(),logging:jA.optional(),completions:jA.optional(),prompts:i.object({listChanged:i.boolean().optional()}).optional(),resources:i.object({subscribe:i.boolean().optional(),listChanged:i.boolean().optional()}).optional(),tools:i.object({listChanged:i.boolean().optional()}).optional(),tasks:uj.optional()}),hj=UA.extend({protocolVersion:i.string(),capabilities:mj,serverInfo:oj,instructions:i.string().optional()}),gj=HA.extend({method:i.literal(`notifications/initialized`),params:VA.optional()}),_j=BA.extend({method:i.literal(`ping`),params:LA.optional()}),vj=i.object({progress:i.number(),total:i.optional(i.number()),message:i.optional(i.string())}),yj=i.object({...VA.shape,...vj.shape,progressToken:MA}),bj=HA.extend({method:i.literal(`notifications/progress`),params:yj}),xj=LA.extend({cursor:NA.optional()}),Sj=BA.extend({params:xj.optional()}),Cj=UA.extend({nextCursor:NA.optional()}),wj=i.enum([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Tj=i.object({taskId:i.string(),status:wj,ttl:i.union([i.number(),i.null()]),createdAt:i.string(),lastUpdatedAt:i.string(),pollInterval:i.optional(i.number()),statusMessage:i.optional(i.string())}),Ej=UA.extend({task:Tj}),Dj=VA.merge(Tj),Oj=HA.extend({method:i.literal(`notifications/tasks/status`),params:Dj}),kj=BA.extend({method:i.literal(`tasks/get`),params:LA.extend({taskId:i.string()})}),Aj=UA.merge(Tj),jj=BA.extend({method:i.literal(`tasks/result`),params:LA.extend({taskId:i.string()})});UA.loose();const Mj=Sj.extend({method:i.literal(`tasks/list`)}),Nj=Cj.extend({tasks:i.array(Tj)}),Pj=BA.extend({method:i.literal(`tasks/cancel`),params:LA.extend({taskId:i.string()})}),Fj=UA.merge(Tj),Ij=i.object({uri:i.string(),mimeType:i.optional(i.string()),_meta:i.record(i.string(),i.unknown()).optional()}),Lj=Ij.extend({text:i.string()}),Rj=i.string().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),zj=Ij.extend({blob:Rj}),Bj=i.enum([`user`,`assistant`]),Vj=i.object({audience:i.array(Bj).optional(),priority:i.number().min(0).max(1).optional(),lastModified:i.iso.datetime({offset:!0}).optional()}),Hj=i.object({...aj.shape,...ij.shape,uri:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),annotations:Vj.optional(),_meta:i.optional(i.looseObject({}))}),Uj=i.object({...aj.shape,...ij.shape,uriTemplate:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),annotations:Vj.optional(),_meta:i.optional(i.looseObject({}))}),Wj=Sj.extend({method:i.literal(`resources/list`)}),Gj=Cj.extend({resources:i.array(Hj)}),Kj=Sj.extend({method:i.literal(`resources/templates/list`)}),qj=Cj.extend({resourceTemplates:i.array(Uj)}),Jj=LA.extend({uri:i.string()}),Yj=Jj,Xj=BA.extend({method:i.literal(`resources/read`),params:Yj}),Zj=UA.extend({contents:i.array(i.union([Lj,zj]))}),Qj=HA.extend({method:i.literal(`notifications/resources/list_changed`),params:VA.optional()}),$j=Jj,eM=BA.extend({method:i.literal(`resources/subscribe`),params:$j}),tM=Jj,nM=BA.extend({method:i.literal(`resources/unsubscribe`),params:tM}),rM=VA.extend({uri:i.string()}),iM=HA.extend({method:i.literal(`notifications/resources/updated`),params:rM}),aM=i.object({name:i.string(),description:i.optional(i.string()),required:i.optional(i.boolean())}),oM=i.object({...aj.shape,...ij.shape,description:i.optional(i.string()),arguments:i.optional(i.array(aM)),_meta:i.optional(i.looseObject({}))}),sM=Sj.extend({method:i.literal(`prompts/list`)}),cM=Cj.extend({prompts:i.array(oM)}),lM=LA.extend({name:i.string(),arguments:i.record(i.string(),i.string()).optional()}),uM=BA.extend({method:i.literal(`prompts/get`),params:lM}),dM=i.object({type:i.literal(`text`),text:i.string(),annotations:Vj.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),fM=i.object({type:i.literal(`image`),data:Rj,mimeType:i.string(),annotations:Vj.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),pM=i.object({type:i.literal(`audio`),data:Rj,mimeType:i.string(),annotations:Vj.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),mM=i.object({type:i.literal(`tool_use`),name:i.string(),id:i.string(),input:i.record(i.string(),i.unknown()),_meta:i.record(i.string(),i.unknown()).optional()}),hM=i.object({type:i.literal(`resource`),resource:i.union([Lj,zj]),annotations:Vj.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),gM=Hj.extend({type:i.literal(`resource_link`)}),_M=i.union([dM,fM,pM,gM,hM]),vM=i.object({role:Bj,content:_M}),yM=UA.extend({description:i.string().optional(),messages:i.array(vM)}),bM=HA.extend({method:i.literal(`notifications/prompts/list_changed`),params:VA.optional()}),xM=i.object({title:i.string().optional(),readOnlyHint:i.boolean().optional(),destructiveHint:i.boolean().optional(),idempotentHint:i.boolean().optional(),openWorldHint:i.boolean().optional()}),SM=i.object({taskSupport:i.enum([`required`,`optional`,`forbidden`]).optional()}),CM=i.object({...aj.shape,...ij.shape,description:i.string().optional(),inputSchema:i.object({type:i.literal(`object`),properties:i.record(i.string(),jA).optional(),required:i.array(i.string()).optional()}).catchall(i.unknown()),outputSchema:i.object({type:i.literal(`object`),properties:i.record(i.string(),jA).optional(),required:i.array(i.string()).optional()}).catchall(i.unknown()).optional(),annotations:xM.optional(),execution:SM.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),wM=Sj.extend({method:i.literal(`tools/list`)}),TM=Cj.extend({tools:i.array(CM)}),EM=UA.extend({content:i.array(_M).default([]),structuredContent:i.record(i.string(),i.unknown()).optional(),isError:i.boolean().optional()});EM.or(UA.extend({toolResult:i.unknown()}));const DM=RA.extend({name:i.string(),arguments:i.record(i.string(),i.unknown()).optional()}),OM=BA.extend({method:i.literal(`tools/call`),params:DM}),kM=HA.extend({method:i.literal(`notifications/tools/list_changed`),params:VA.optional()});i.object({autoRefresh:i.boolean().default(!0),debounceMs:i.number().int().nonnegative().default(300)});const AM=i.enum([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),jM=LA.extend({level:AM}),MM=BA.extend({method:i.literal(`logging/setLevel`),params:jM}),NM=VA.extend({level:AM,logger:i.string().optional(),data:i.unknown()}),PM=HA.extend({method:i.literal(`notifications/message`),params:NM}),FM=i.object({name:i.string().optional()}),IM=i.object({hints:i.array(FM).optional(),costPriority:i.number().min(0).max(1).optional(),speedPriority:i.number().min(0).max(1).optional(),intelligencePriority:i.number().min(0).max(1).optional()}),LM=i.object({mode:i.enum([`auto`,`required`,`none`]).optional()}),RM=i.object({type:i.literal(`tool_result`),toolUseId:i.string().describe(`The unique identifier for the corresponding tool call.`),content:i.array(_M).default([]),structuredContent:i.object({}).loose().optional(),isError:i.boolean().optional(),_meta:i.record(i.string(),i.unknown()).optional()}),zM=i.discriminatedUnion(`type`,[dM,fM,pM]),BM=i.discriminatedUnion(`type`,[dM,fM,pM,mM,RM]),VM=i.object({role:Bj,content:i.union([BM,i.array(BM)]),_meta:i.record(i.string(),i.unknown()).optional()}),HM=RA.extend({messages:i.array(VM),modelPreferences:IM.optional(),systemPrompt:i.string().optional(),includeContext:i.enum([`none`,`thisServer`,`allServers`]).optional(),temperature:i.number().optional(),maxTokens:i.number().int(),stopSequences:i.array(i.string()).optional(),metadata:jA.optional(),tools:i.array(CM).optional(),toolChoice:LM.optional()}),UM=BA.extend({method:i.literal(`sampling/createMessage`),params:HM}),WM=UA.extend({model:i.string(),stopReason:i.optional(i.enum([`endTurn`,`stopSequence`,`maxTokens`]).or(i.string())),role:Bj,content:zM}),GM=UA.extend({model:i.string(),stopReason:i.optional(i.enum([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(i.string())),role:Bj,content:i.union([BM,i.array(BM)])}),KM=i.object({type:i.literal(`boolean`),title:i.string().optional(),description:i.string().optional(),default:i.boolean().optional()}),qM=i.object({type:i.literal(`string`),title:i.string().optional(),description:i.string().optional(),minLength:i.number().optional(),maxLength:i.number().optional(),format:i.enum([`email`,`uri`,`date`,`date-time`]).optional(),default:i.string().optional()}),JM=i.object({type:i.enum([`number`,`integer`]),title:i.string().optional(),description:i.string().optional(),minimum:i.number().optional(),maximum:i.number().optional(),default:i.number().optional()}),YM=i.object({type:i.literal(`string`),title:i.string().optional(),description:i.string().optional(),enum:i.array(i.string()),default:i.string().optional()}),XM=i.object({type:i.literal(`string`),title:i.string().optional(),description:i.string().optional(),oneOf:i.array(i.object({const:i.string(),title:i.string()})),default:i.string().optional()}),ZM=i.object({type:i.literal(`string`),title:i.string().optional(),description:i.string().optional(),enum:i.array(i.string()),enumNames:i.array(i.string()).optional(),default:i.string().optional()}),QM=i.union([YM,XM]),$M=i.object({type:i.literal(`array`),title:i.string().optional(),description:i.string().optional(),minItems:i.number().optional(),maxItems:i.number().optional(),items:i.object({type:i.literal(`string`),enum:i.array(i.string())}),default:i.array(i.string()).optional()}),eN=i.object({type:i.literal(`array`),title:i.string().optional(),description:i.string().optional(),minItems:i.number().optional(),maxItems:i.number().optional(),items:i.object({anyOf:i.array(i.object({const:i.string(),title:i.string()}))}),default:i.array(i.string()).optional()}),tN=i.union([$M,eN]),nN=i.union([ZM,QM,tN]),rN=i.union([nN,KM,qM,JM]),iN=RA.extend({mode:i.literal(`form`).optional(),message:i.string(),requestedSchema:i.object({type:i.literal(`object`),properties:i.record(i.string(),rN),required:i.array(i.string()).optional()})}),aN=RA.extend({mode:i.literal(`url`),message:i.string(),elicitationId:i.string(),url:i.string().url()}),oN=i.union([iN,aN]),sN=BA.extend({method:i.literal(`elicitation/create`),params:oN}),cN=VA.extend({elicitationId:i.string()}),lN=HA.extend({method:i.literal(`notifications/elicitation/complete`),params:cN}),uN=UA.extend({action:i.enum([`accept`,`decline`,`cancel`]),content:i.preprocess(e=>e===null?void 0:e,i.record(i.string(),i.union([i.string(),i.number(),i.boolean(),i.array(i.string())])).optional())}),dN=i.object({type:i.literal(`ref/resource`),uri:i.string()}),fN=i.object({type:i.literal(`ref/prompt`),name:i.string()}),pN=LA.extend({ref:i.union([fN,dN]),argument:i.object({name:i.string(),value:i.string()}),context:i.object({arguments:i.record(i.string(),i.string()).optional()}).optional()}),mN=BA.extend({method:i.literal(`completion/complete`),params:pN});function hN(e){if(e.params.ref.type!==`ref/prompt`)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function gN(e){if(e.params.ref.type!==`ref/resource`)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}const _N=UA.extend({completion:i.looseObject({values:i.array(i.string()).max(100),total:i.optional(i.number().int()),hasMore:i.optional(i.boolean())})}),vN=i.object({uri:i.string().startsWith(`file://`),name:i.string().optional(),_meta:i.record(i.string(),i.unknown()).optional()}),yN=BA.extend({method:i.literal(`roots/list`),params:LA.optional()}),bN=UA.extend({roots:i.array(vN)}),xN=HA.extend({method:i.literal(`notifications/roots/list_changed`),params:VA.optional()});i.union([_j,pj,mN,MM,uM,sM,Wj,Kj,Xj,eM,nM,OM,wM,kj,jj,Mj,Pj]),i.union([nj,bj,gj,xN,Oj]),i.union([ej,WM,GM,uN,bN,Aj,Nj,Ej]),i.union([_j,UM,sN,yN,kj,jj,Mj,Pj]),i.union([nj,bj,PM,iM,Qj,kM,bM,Oj,lN]),i.union([ej,hj,_N,yM,cM,Gj,qj,Zj,EM,TM,Aj,Nj,Ej]);var Y=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===J.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new SN(e.elicitations,n)}return new e(t,n,r)}},SN=class extends Y{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(J.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function CN(e){return e===`completed`||e===`failed`||e===`cancelled`}const wN=Symbol(`Let zodToJsonSchema decide on which parser to use`),TN={name:void 0,$refStrategy:`root`,basePath:[`#`],effectStrategy:`input`,pipeStrategy:`all`,dateStrategy:`format:date-time`,mapStrategy:`entries`,removeAdditionalStrategy:`passthrough`,allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:`definitions`,target:`jsonSchema7`,strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:`escape`,applyRegexFlags:!1,emailStrategy:`format:email`,base64Strategy:`contentEncoding:base64`,nameStrategy:`ref`,openAiAnyTypeName:`OpenAiAnyType`},EN=e=>typeof e==`string`?{...TN,name:e}:{...TN,...e},DN=e=>{let t=EN(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function ON(e,t,n,r){r?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function X(e,t,n,r,i){e[t]=n,ON(e,t,r,i)}const kN=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)};function AN(e){if(e.target!==`openAi`)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy===`relative`?kN(t,e.currentPath):t.join(`/`)}}function jN(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==v.ZodAny&&(n.items=Z(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&X(n,`minItems`,e.minLength.value,e.minLength.message,t),e.maxLength&&X(n,`maxItems`,e.maxLength.value,e.maxLength.message,t),e.exactLength&&(X(n,`minItems`,e.exactLength.value,e.exactLength.message,t),X(n,`maxItems`,e.exactLength.value,e.exactLength.message,t)),n}function MN(e,t){let n={type:`integer`,format:`int64`};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case`min`:t.target===`jsonSchema7`?r.inclusive?X(n,`minimum`,r.value,r.message,t):X(n,`exclusiveMinimum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),X(n,`minimum`,r.value,r.message,t));break;case`max`:t.target===`jsonSchema7`?r.inclusive?X(n,`maximum`,r.value,r.message,t):X(n,`exclusiveMaximum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),X(n,`maximum`,r.value,r.message,t));break;case`multipleOf`:X(n,`multipleOf`,r.value,r.message,t);break}return n}function NN(){return{type:`boolean`}}function PN(e,t){return Z(e.type._def,t)}const FN=(e,t)=>Z(e.innerType._def,t);function IN(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((n,r)=>IN(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return LN(e,t)}}const LN=(e,t)=>{let n={type:`integer`,format:`unix-time`};if(t.target===`openApi3`)return n;for(let r of e.checks)switch(r.kind){case`min`:X(n,`minimum`,r.value,r.message,t);break;case`max`:X(n,`maximum`,r.value,r.message,t);break}return n};function RN(e,t){return{...Z(e.innerType._def,t),default:e.defaultValue()}}function zN(e,t){return t.effectStrategy===`input`?Z(e.schema._def,t):AN(t)}function BN(e){return{type:`string`,enum:Array.from(e.values)}}const VN=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function HN(e,t){let n=[Z(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),Z(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=t.target===`jsonSchema2019-09`?{unevaluatedProperties:!1}:void 0,i=[];return n.forEach(e=>{if(VN(e))i.push(...e.allOf),e.unevaluatedProperties===void 0&&(r=void 0);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}else r=void 0;i.push(t)}}),i.length?{allOf:i,...r}:void 0}function UN(e,t){let n=typeof e.value;return n!==`bigint`&&n!==`number`&&n!==`boolean`&&n!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:t.target===`openApi3`?{type:n===`bigint`?`integer`:n,enum:[e.value]}:{type:n===`bigint`?`integer`:n,const:e.value}}let WN;const GN={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(WN===void 0&&(WN=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),WN),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function KN(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:X(n,`minLength`,typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,r.message,t);break;case`max`:X(n,`maxLength`,typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case`email`:switch(t.emailStrategy){case`format:email`:XN(n,`email`,r.message,t);break;case`format:idn-email`:XN(n,`idn-email`,r.message,t);break;case`pattern:zod`:ZN(n,GN.email,r.message,t);break}break;case`url`:XN(n,`uri`,r.message,t);break;case`uuid`:XN(n,`uuid`,r.message,t);break;case`regex`:ZN(n,r.regex,r.message,t);break;case`cuid`:ZN(n,GN.cuid,r.message,t);break;case`cuid2`:ZN(n,GN.cuid2,r.message,t);break;case`startsWith`:ZN(n,RegExp(`^${qN(r.value,t)}`),r.message,t);break;case`endsWith`:ZN(n,RegExp(`${qN(r.value,t)}$`),r.message,t);break;case`datetime`:XN(n,`date-time`,r.message,t);break;case`date`:XN(n,`date`,r.message,t);break;case`time`:XN(n,`time`,r.message,t);break;case`duration`:XN(n,`duration`,r.message,t);break;case`length`:X(n,`minLength`,typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,r.message,t),X(n,`maxLength`,typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case`includes`:ZN(n,RegExp(qN(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&XN(n,`ipv4`,r.message,t),r.version!==`v4`&&XN(n,`ipv6`,r.message,t);break;case`base64url`:ZN(n,GN.base64url,r.message,t);break;case`jwt`:ZN(n,GN.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&ZN(n,GN.ipv4Cidr,r.message,t),r.version!==`v4`&&ZN(n,GN.ipv6Cidr,r.message,t);break;case`emoji`:ZN(n,GN.emoji(),r.message,t);break;case`ulid`:ZN(n,GN.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:XN(n,`binary`,r.message,t);break;case`contentEncoding:base64`:X(n,`contentEncoding`,`base64`,r.message,t);break;case`pattern:zod`:ZN(n,GN.base64,r.message,t);break}break;case`nanoid`:ZN(n,GN.nanoid,r.message,t);case`toLowerCase`:case`toUpperCase`:case`trim`:break;default:(e=>{})(r)}return n}function qN(e,t){return t.patternStrategy===`escape`?YN(e):e}const JN=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function YN(e){let t=``;for(let n=0;n<e.length;n++)JN.has(e[n])||(t+=`\\`),t+=e[n];return t}function XN(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||=[],e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):X(e,`format`,t,n,r)}function ZN(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:QN(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):X(e,`pattern`,QN(t,r),n,r)}function QN(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},r=n.i?e.source.toLowerCase():e.source,i=``,a=!1,o=!1,s=!1;for(let e=0;e<r.length;e++){if(a){i+=r[e],a=!1;continue}if(n.i){if(o){if(r[e].match(/[a-z]/)){s?(i+=r[e],i+=`${r[e-2]}-${r[e]}`.toUpperCase(),s=!1):r[e+1]===`-`&&r[e+2]?.match(/[a-z]/)?(i+=r[e],s=!0):i+=`${r[e]}${r[e].toUpperCase()}`;continue}}else if(r[e].match(/[a-z]/)){i+=`[${r[e]}${r[e].toUpperCase()}]`;continue}}if(n.m){if(r[e]===`^`){i+=`(^|(?<=[\r
177
+ </html>`};var KO=class extends q(`McpSessionNotOpenError`)({_tag:K(`McpSessionNotOpenError`)}){message=`No browser open. Call the 'open' tool first.`};const qO=e=>Te(e)&&`status`in e&&`steps`in e&&Array.isArray(e.steps),JO={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`GET, POST, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type`},YO={"Cache-Control":`no-store`},XO=(e,t,n)=>up(r=>{let i=e=>r(R(e));e.once(`error`,i),e.listen({host:t,port:n},()=>{e.off(`error`,i),r(lp)})}),ZO=e=>up(t=>{e.close(()=>t(lp))}),QO=H(`LiveViewServer.start`)(function*(e){let t=new URL(e.liveViewUrl),n=new Set,r=[],i,a=yield*zv(),o=GO({title:`Expect Live View`,eventsSource:`sse`}),s=(e,t)=>{let r=`event: ${e}\ndata: ${t}\n\n`;for(let e of n){if(e.destroyed){n.delete(e);continue}try{e.write(r)}catch{n.delete(e),e.end()}}},c=t=>{t.length!==0&&(r.push(...t),e.onEventsCollected(t),s(`replay`,JSON.stringify(t)))},l=e=>{i=e,s(`steps`,JSON.stringify(e))},u=(e,t)=>{t.writeHead(200,{"Content-Type":`text/event-stream`,Connection:`keep-alive`,...JO,...YO}),t.flushHeaders(),n.add(t),e.on(`close`,()=>n.delete(t))},d=(e,t)=>{let n=[];e.on(`data`,e=>n.push(e)),e.on(`end`,()=>{try{let e=Buffer.concat(n).toString(`utf-8`),r=JSON.parse(e);if(!qO(r)){t.writeHead(400,{"Content-Type":`text/plain`,...JO,...YO}),t.end(`Invalid step state: missing status or steps`);return}l(r),t.writeHead(204,{...JO,...YO}),t.end()}catch{t.writeHead(400,{"Content-Type":`text/plain`,...JO,...YO}),t.end(`Invalid JSON`)}})},f=_((e,n)=>{if(e.method===`OPTIONS`){n.writeHead(204,JO),n.end();return}let a=new URL(e.url??`/`,t).pathname;if(a===`/`){n.writeHead(200,{"Content-Type":`text/html; charset=utf-8`,...JO,...YO}),n.end(o);return}if(a===`/events`){u(e,n);return}if(a===`/latest.json`){let e=JSON.stringify(r);n.writeHead(200,{"Content-Type":`application/json`,"Content-Length":Buffer.byteLength(e),...JO,...YO}),n.end(e);return}if(a===`/steps`){if(e.method===`POST`){d(e,n);return}let t=JSON.stringify(i??{title:``,status:`running`,steps:[]});n.writeHead(200,{"Content-Type":`application/json`,"Content-Length":Buffer.byteLength(t),...JO,...YO}),n.end(t);return}n.writeHead(404,{"Content-Type":`text/plain; charset=utf-8`,...JO,...YO}),n.end(`Not found`)});yield*XO(f,t.hostname,Number(t.port));let p=yield*I(()=>e.getPage()).pipe(z(e=>!e||e.isClosed()?lp:yO(e,`startRecording`).pipe(V(()=>lp),z(()=>yO(e,`getEvents`)),vp(e=>I(()=>{Array.isArray(e)&&e.length>0&&c(e)})),V(e=>km(`Replay event collection failed`,{cause:e}))))).pipe(am(Vf(250)),dm),m=yield*IS(a).pipe(BS(e=>I(()=>l(e))),nC,dm);return{url:t.toString(),pushRunState:e=>{Hv(a,e)},getLatestRunState:()=>i,close:L(function*(){yield*vv(p),yield*vv(m);for(let e of n)e.end();n.clear(),yield*ZO(f)})}}),$O=`/tmp/expect-replays`,ek=(e,t)=>{t.trackedPages.has(e)||(t.trackedPages.add(e),e.on(`console`,e=>{t.consoleMessages.push({type:e.type(),text:e.text(),timestamp:Date.now()})}),e.on(`request`,e=>{t.networkRequests.push({url:e.url(),method:e.method(),status:void 0,resourceType:e.resourceType(),timestamp:Date.now()})}),e.on(`response`,e=>{let n=t.networkRequests.find(t=>t.url===e.url()&&t.status===void 0);n&&(n.status=e.status())}))};var tk=class extends A()(`@browser/McpSession`,{make:L(function*(){let e=yield*IO,t=yield*sC,r=yield*DC(NC(`EXPECT_REPLAY_OUTPUT_PATH`)),i=yield*DC(NC(Uw)),a=yield*Ew(void 0),o=yield*Ew(void 0),s=yield*Ew(void 0),c=yield*Ew(void 0),l=yield*Ew(void 0);yield*e.preExtractCookies().pipe(vp(e=>Ow(l,e)),vp(e=>Om(`Cookies pre-extracted`,{count:e.length})),V(()=>lp),dm);let u=H(`McpSession.requireSession`)(function*(){return(yield*Dw(a))||(yield*new KO)}),d=H(`McpSession.requirePage`)(function*(){return(yield*u()).page}),f=H(`McpSession.navigate`)(function*(e,t={}){let n=yield*u();yield*ap({try:()=>n.page.goto(e,{waitUntil:t.waitUntil??`load`}),catch:t=>new iO({url:e,cause:t instanceof Error?t.message:String(t)})})}),p=H(`McpSession.pushStepEvent`)(function*(e){yield*Ow(c,e);let t=yield*Dw(o);t&&t.pushRunState(e)});return{open:H(`McpSession.open`)(function*(c,u={}){yield*sm({url:c});let d=u.cookies?yield*Dw(l):void 0,f=d&&d.length>0?d:u.cookies,p=n.join($O,`playwright`);yield*t.makeDirectory(p,{recursive:!0}).pipe(V(e=>km(`Failed to create Playwright video directory`,{cause:e})));let m=yield*e.createPage(c,{headed:u.headed,cookies:f,waitUntil:u.waitUntil,videoOutputDir:p}),h={browser:m.browser,context:m.context,page:m.page,consoleMessages:[],networkRequests:[],replayOutputPath:yr(r),accumulatedReplayEvents:[],trackedPages:new Set,lastSnapshot:void 0};ek(m.page,h),yield*Ow(a,h),yield*yO(m.page,`startRecording`).pipe(V(e=>km(`rrweb recording failed to start`,{cause:e})));let g=yield*Dw(o);if(pr(i)&&!g){let e=yield*QO({liveViewUrl:i.value,getPage:()=>kw(a)?.page,onEventsCollected:e=>{kw(a)?.accumulatedReplayEvents.push(...e)}}).pipe(V(e=>km(`Live view server failed to start`,{cause:e}).pipe(bp(void 0))));e&&(yield*Ow(o,e))}return(yield*Dw(o))||(yield*Ow(s,yield*I(()=>kw(a)?.page).pipe(z(e=>!e||e.isClosed()?lp:yO(e,`startRecording`).pipe(V(()=>lp),z(()=>yO(e,`getEvents`)),vp(e=>I(()=>{Array.isArray(e)&&e.length>0&&kw(a)?.accumulatedReplayEvents.push(...e)})),V(e=>km(`Replay event collection failed`,{cause:e}))))).pipe(am(Vf(250)),dm))),{injectedCookieCount:yield*ap(()=>m.context.cookies()).pipe(B(e=>e.length),V(e=>km(`Failed to count cookies`,{cause:e}).pipe(bp(0))))}}),navigate:f,hasSession:()=>!!kw(a),requirePage:d,requireSession:u,snapshot:H(`McpSession.snapshot`)(function*(t,n){return yield*e.snapshot(t,n)}),annotatedScreenshot:H(`McpSession.annotatedScreenshot`)(function*(t,n){return yield*e.annotatedScreenshot(t,n)}),updateLastSnapshot:H(`McpSession.updateLastSnapshot`)(function*(e){let t=yield*u();t.lastSnapshot=e}),pushStepEvent:p,close:H(`McpSession.close`)(function*(){let e=yield*Dw(a);if(!e)return;yield*Ow(a,void 0);let r=yield*Dw(s);r&&(yield*vv(r),yield*Ow(s,void 0));let i=yield*Dw(o);i&&(yield*i.close.pipe(V(e=>km(`Failed to close live view`,{cause:e}))),yield*Ow(o,void 0));let l,u,d,f,p,m,h=e.page.video(),g=e.replayOutputPath?n.basename(e.replayOutputPath,n.extname(e.replayOutputPath)):`session-${Date.now()}`;if(yield*L(function*(){if(!e.page.isClosed()){let t=yield*LO(e.page).pipe(V(e=>km(`Failed to collect final replay events`,{cause:e}).pipe(bp([]))));t.length>0&&e.accumulatedReplayEvents.push(...t)}let r=e.replayOutputPath;if(r&&e.accumulatedReplayEvents.length>0){let i=e.accumulatedReplayEvents.map(e=>JSON.stringify(e)).join(`
178
+ `)+`
179
+ `;yield*t.makeDirectory(n.dirname(r),{recursive:!0}).pipe(V(e=>km(`Failed to create replay output directory`,{cause:e}))),yield*t.writeFileString(r,i).pipe(V(e=>km(`Failed to write replay file`,{cause:e}))),l=r;let a=yield*Dw(c),o=n.basename(r),s=n.basename(r,n.extname(r)),d=n.join(n.dirname(r),`${s}.html`),m=GO({title:a?`Test Report: ${a.title}`:`Expect Report`,eventsSource:{ndjsonPath:o},steps:a});yield*t.writeFileString(d,m).pipe(V(e=>km(`Failed to write HTML report`,{cause:e}))),u=d;let h=`${r}.js`,g=`window.__EXPECT_REPLAY_NDJSON__ = ${JSON.stringify(i)};\n`;yield*t.writeFileString(h,g).pipe(V(e=>km(`Failed to write ndjson.js wrapper`,{cause:e})));let _=n.join($O,`${s}.ndjson`),ee=n.join($O,`${s}.html`),v=`${_}.js`;yield*t.makeDirectory($O,{recursive:!0}).pipe(V(e=>km(`Failed to create /tmp artifact directory`,{cause:e}))),yield*t.copyFile(r,_).pipe(vp(()=>I(()=>{f=_})),V(e=>km(`Failed to copy replay to /tmp`,{cause:e}))),yield*t.copyFile(d,ee).pipe(vp(()=>I(()=>{p=ee})),V(e=>km(`Failed to copy report to /tmp`,{cause:e}))),yield*t.copyFile(h,v).pipe(V(e=>km(`Failed to copy ndjson.js to /tmp`,{cause:e})))}}).pipe(V(e=>km(`Failed during close cleanup`,{cause:e}))),yield*ap(()=>e.browser.close()).pipe(V(e=>km(`Failed to close browser`,{cause:e}))),h&&(d=yield*ap(()=>h.path()).pipe(V(e=>km(`Failed to resolve Playwright video path`,{cause:e}).pipe(bp(void 0)))),d)){let e=n.join($O,`${g}.webm`);yield*t.makeDirectory($O,{recursive:!0}).pipe(V(e=>km(`Failed to create /tmp artifact directory`,{cause:e}))),yield*t.copyFile(d,e).pipe(vp(()=>I(()=>{m=e})),V(e=>km(`Failed to copy Playwright video to /tmp`,{cause:e})))}return{replaySessionPath:l,reportPath:u,videoPath:d,tmpReplaySessionPath:f,tmpReportPath:p,tmpVideoPath:m}})}})}){static layer=Od(this)(this.make).pipe(P(IO.layer))};const nk=Ed(KC,!0),rk=ew(tk.layer.pipe(P(nk),P(s.layer)));function ik(e){return!!e._zod}function ak(e){let t=Object.values(e);if(t.length===0)return te.object({});let n=t.every(ik),r=t.every(e=>!ik(e));if(n)return te.object(e);if(r)return ee.object(e);throw Error(`Mixed Zod versions detected in object shape.`)}function ok(e,t){return ik(e)?te.safeParse(e,t):e.safeParse(t)}async function sk(e,t){return ik(e)?await te.safeParseAsync(e,t):await e.safeParseAsync(t)}function ck(e){if(!e)return;let t;if(t=ik(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function lk(e){if(e){if(typeof e==`object`){let t=e,n=e;if(!t._def&&!n._zod){let t=Object.values(e);if(t.length>0&&t.every(e=>typeof e==`object`&&!!e&&(e._def!==void 0||e._zod!==void 0||typeof e.parse==`function`)))return ak(e)}}if(ik(e)){let t=e._zod?.def;if(t&&(t.type===`object`||t.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function uk(e){if(e&&typeof e==`object`){if(`message`in e&&typeof e.message==`string`)return e.message;if(`issues`in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==`object`&&`message`in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function dk(e){return e.description}function fk(e){if(ik(e))return e._zod?.def?.type===`optional`;let t=e;return typeof e.isOptional==`function`?e.isOptional():t._def?.typeName===`ZodOptional`}function pk(e){if(ik(e)){let t=e._zod?.def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}const mk=`2025-11-25`,hk=[mk,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],gk=`io.modelcontextprotocol/related-task`,_k=i.custom(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),vk=i.union([i.string(),i.number().int()]),yk=i.string();i.looseObject({ttl:i.union([i.number(),i.null()]).optional(),pollInterval:i.number().optional()});const bk=i.object({ttl:i.number().optional()}),xk=i.object({taskId:i.string()}),Sk=i.looseObject({progressToken:vk.optional(),[gk]:xk.optional()}),Ck=i.object({_meta:Sk.optional()}),wk=Ck.extend({task:bk.optional()}),Tk=e=>wk.safeParse(e).success,Ek=i.object({method:i.string(),params:Ck.loose().optional()}),Dk=i.object({_meta:Sk.optional()}),Ok=i.object({method:i.string(),params:Dk.loose().optional()}),kk=i.looseObject({_meta:Sk.optional()}),Ak=i.union([i.string(),i.number().int()]),jk=i.object({jsonrpc:i.literal(`2.0`),id:Ak,...Ek.shape}).strict(),Mk=e=>jk.safeParse(e).success,Nk=i.object({jsonrpc:i.literal(`2.0`),...Ok.shape}).strict(),Pk=e=>Nk.safeParse(e).success,Fk=i.object({jsonrpc:i.literal(`2.0`),id:Ak,result:kk}).strict(),Ik=e=>Fk.safeParse(e).success;var J;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(J||={});const Lk=i.object({jsonrpc:i.literal(`2.0`),id:Ak.optional(),error:i.object({code:i.number().int(),message:i.string(),data:i.unknown().optional()})}).strict(),Rk=e=>Lk.safeParse(e).success,zk=i.union([jk,Nk,Fk,Lk]);i.union([Fk,Lk]);const Bk=kk.strict(),Vk=Dk.extend({requestId:Ak.optional(),reason:i.string().optional()}),Hk=Ok.extend({method:i.literal(`notifications/cancelled`),params:Vk}),Uk=i.object({src:i.string(),mimeType:i.string().optional(),sizes:i.array(i.string()).optional(),theme:i.enum([`light`,`dark`]).optional()}),Wk=i.object({icons:i.array(Uk).optional()}),Gk=i.object({name:i.string(),title:i.string().optional()}),Kk=Gk.extend({...Gk.shape,...Wk.shape,version:i.string(),websiteUrl:i.string().optional(),description:i.string().optional()}),qk=i.intersection(i.object({applyDefaults:i.boolean().optional()}),i.record(i.string(),i.unknown())),Jk=i.preprocess(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,i.intersection(i.object({form:qk.optional(),url:_k.optional()}),i.record(i.string(),i.unknown()).optional())),Yk=i.looseObject({list:_k.optional(),cancel:_k.optional(),requests:i.looseObject({sampling:i.looseObject({createMessage:_k.optional()}).optional(),elicitation:i.looseObject({create:_k.optional()}).optional()}).optional()}),Xk=i.looseObject({list:_k.optional(),cancel:_k.optional(),requests:i.looseObject({tools:i.looseObject({call:_k.optional()}).optional()}).optional()}),Zk=i.object({experimental:i.record(i.string(),_k).optional(),sampling:i.object({context:_k.optional(),tools:_k.optional()}).optional(),elicitation:Jk.optional(),roots:i.object({listChanged:i.boolean().optional()}).optional(),tasks:Yk.optional()}),Qk=Ck.extend({protocolVersion:i.string(),capabilities:Zk,clientInfo:Kk}),$k=Ek.extend({method:i.literal(`initialize`),params:Qk}),eA=i.object({experimental:i.record(i.string(),_k).optional(),logging:_k.optional(),completions:_k.optional(),prompts:i.object({listChanged:i.boolean().optional()}).optional(),resources:i.object({subscribe:i.boolean().optional(),listChanged:i.boolean().optional()}).optional(),tools:i.object({listChanged:i.boolean().optional()}).optional(),tasks:Xk.optional()}),tA=kk.extend({protocolVersion:i.string(),capabilities:eA,serverInfo:Kk,instructions:i.string().optional()}),nA=Ok.extend({method:i.literal(`notifications/initialized`),params:Dk.optional()}),rA=Ek.extend({method:i.literal(`ping`),params:Ck.optional()}),iA=i.object({progress:i.number(),total:i.optional(i.number()),message:i.optional(i.string())}),aA=i.object({...Dk.shape,...iA.shape,progressToken:vk}),oA=Ok.extend({method:i.literal(`notifications/progress`),params:aA}),sA=Ck.extend({cursor:yk.optional()}),cA=Ek.extend({params:sA.optional()}),lA=kk.extend({nextCursor:yk.optional()}),uA=i.enum([`working`,`input_required`,`completed`,`failed`,`cancelled`]),dA=i.object({taskId:i.string(),status:uA,ttl:i.union([i.number(),i.null()]),createdAt:i.string(),lastUpdatedAt:i.string(),pollInterval:i.optional(i.number()),statusMessage:i.optional(i.string())}),fA=kk.extend({task:dA}),pA=Dk.merge(dA),mA=Ok.extend({method:i.literal(`notifications/tasks/status`),params:pA}),hA=Ek.extend({method:i.literal(`tasks/get`),params:Ck.extend({taskId:i.string()})}),gA=kk.merge(dA),_A=Ek.extend({method:i.literal(`tasks/result`),params:Ck.extend({taskId:i.string()})});kk.loose();const vA=cA.extend({method:i.literal(`tasks/list`)}),yA=lA.extend({tasks:i.array(dA)}),bA=Ek.extend({method:i.literal(`tasks/cancel`),params:Ck.extend({taskId:i.string()})}),xA=kk.merge(dA),SA=i.object({uri:i.string(),mimeType:i.optional(i.string()),_meta:i.record(i.string(),i.unknown()).optional()}),CA=SA.extend({text:i.string()}),wA=i.string().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),TA=SA.extend({blob:wA}),EA=i.enum([`user`,`assistant`]),DA=i.object({audience:i.array(EA).optional(),priority:i.number().min(0).max(1).optional(),lastModified:i.iso.datetime({offset:!0}).optional()}),OA=i.object({...Gk.shape,...Wk.shape,uri:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),annotations:DA.optional(),_meta:i.optional(i.looseObject({}))}),kA=i.object({...Gk.shape,...Wk.shape,uriTemplate:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),annotations:DA.optional(),_meta:i.optional(i.looseObject({}))}),AA=cA.extend({method:i.literal(`resources/list`)}),jA=lA.extend({resources:i.array(OA)}),MA=cA.extend({method:i.literal(`resources/templates/list`)}),NA=lA.extend({resourceTemplates:i.array(kA)}),PA=Ck.extend({uri:i.string()}),FA=PA,IA=Ek.extend({method:i.literal(`resources/read`),params:FA}),LA=kk.extend({contents:i.array(i.union([CA,TA]))}),RA=Ok.extend({method:i.literal(`notifications/resources/list_changed`),params:Dk.optional()}),zA=PA,BA=Ek.extend({method:i.literal(`resources/subscribe`),params:zA}),VA=PA,HA=Ek.extend({method:i.literal(`resources/unsubscribe`),params:VA}),UA=Dk.extend({uri:i.string()}),WA=Ok.extend({method:i.literal(`notifications/resources/updated`),params:UA}),GA=i.object({name:i.string(),description:i.optional(i.string()),required:i.optional(i.boolean())}),KA=i.object({...Gk.shape,...Wk.shape,description:i.optional(i.string()),arguments:i.optional(i.array(GA)),_meta:i.optional(i.looseObject({}))}),qA=cA.extend({method:i.literal(`prompts/list`)}),JA=lA.extend({prompts:i.array(KA)}),YA=Ck.extend({name:i.string(),arguments:i.record(i.string(),i.string()).optional()}),XA=Ek.extend({method:i.literal(`prompts/get`),params:YA}),ZA=i.object({type:i.literal(`text`),text:i.string(),annotations:DA.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),QA=i.object({type:i.literal(`image`),data:wA,mimeType:i.string(),annotations:DA.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),$A=i.object({type:i.literal(`audio`),data:wA,mimeType:i.string(),annotations:DA.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),ej=i.object({type:i.literal(`tool_use`),name:i.string(),id:i.string(),input:i.record(i.string(),i.unknown()),_meta:i.record(i.string(),i.unknown()).optional()}),tj=i.object({type:i.literal(`resource`),resource:i.union([CA,TA]),annotations:DA.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),nj=OA.extend({type:i.literal(`resource_link`)}),rj=i.union([ZA,QA,$A,nj,tj]),ij=i.object({role:EA,content:rj}),aj=kk.extend({description:i.string().optional(),messages:i.array(ij)}),oj=Ok.extend({method:i.literal(`notifications/prompts/list_changed`),params:Dk.optional()}),sj=i.object({title:i.string().optional(),readOnlyHint:i.boolean().optional(),destructiveHint:i.boolean().optional(),idempotentHint:i.boolean().optional(),openWorldHint:i.boolean().optional()}),cj=i.object({taskSupport:i.enum([`required`,`optional`,`forbidden`]).optional()}),lj=i.object({...Gk.shape,...Wk.shape,description:i.string().optional(),inputSchema:i.object({type:i.literal(`object`),properties:i.record(i.string(),_k).optional(),required:i.array(i.string()).optional()}).catchall(i.unknown()),outputSchema:i.object({type:i.literal(`object`),properties:i.record(i.string(),_k).optional(),required:i.array(i.string()).optional()}).catchall(i.unknown()).optional(),annotations:sj.optional(),execution:cj.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),uj=cA.extend({method:i.literal(`tools/list`)}),dj=lA.extend({tools:i.array(lj)}),fj=kk.extend({content:i.array(rj).default([]),structuredContent:i.record(i.string(),i.unknown()).optional(),isError:i.boolean().optional()});fj.or(kk.extend({toolResult:i.unknown()}));const pj=wk.extend({name:i.string(),arguments:i.record(i.string(),i.unknown()).optional()}),mj=Ek.extend({method:i.literal(`tools/call`),params:pj}),hj=Ok.extend({method:i.literal(`notifications/tools/list_changed`),params:Dk.optional()});i.object({autoRefresh:i.boolean().default(!0),debounceMs:i.number().int().nonnegative().default(300)});const gj=i.enum([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),_j=Ck.extend({level:gj}),vj=Ek.extend({method:i.literal(`logging/setLevel`),params:_j}),yj=Dk.extend({level:gj,logger:i.string().optional(),data:i.unknown()}),bj=Ok.extend({method:i.literal(`notifications/message`),params:yj}),xj=i.object({name:i.string().optional()}),Sj=i.object({hints:i.array(xj).optional(),costPriority:i.number().min(0).max(1).optional(),speedPriority:i.number().min(0).max(1).optional(),intelligencePriority:i.number().min(0).max(1).optional()}),Cj=i.object({mode:i.enum([`auto`,`required`,`none`]).optional()}),wj=i.object({type:i.literal(`tool_result`),toolUseId:i.string().describe(`The unique identifier for the corresponding tool call.`),content:i.array(rj).default([]),structuredContent:i.object({}).loose().optional(),isError:i.boolean().optional(),_meta:i.record(i.string(),i.unknown()).optional()}),Tj=i.discriminatedUnion(`type`,[ZA,QA,$A]),Ej=i.discriminatedUnion(`type`,[ZA,QA,$A,ej,wj]),Dj=i.object({role:EA,content:i.union([Ej,i.array(Ej)]),_meta:i.record(i.string(),i.unknown()).optional()}),Oj=wk.extend({messages:i.array(Dj),modelPreferences:Sj.optional(),systemPrompt:i.string().optional(),includeContext:i.enum([`none`,`thisServer`,`allServers`]).optional(),temperature:i.number().optional(),maxTokens:i.number().int(),stopSequences:i.array(i.string()).optional(),metadata:_k.optional(),tools:i.array(lj).optional(),toolChoice:Cj.optional()}),kj=Ek.extend({method:i.literal(`sampling/createMessage`),params:Oj}),Aj=kk.extend({model:i.string(),stopReason:i.optional(i.enum([`endTurn`,`stopSequence`,`maxTokens`]).or(i.string())),role:EA,content:Tj}),jj=kk.extend({model:i.string(),stopReason:i.optional(i.enum([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(i.string())),role:EA,content:i.union([Ej,i.array(Ej)])}),Mj=i.object({type:i.literal(`boolean`),title:i.string().optional(),description:i.string().optional(),default:i.boolean().optional()}),Nj=i.object({type:i.literal(`string`),title:i.string().optional(),description:i.string().optional(),minLength:i.number().optional(),maxLength:i.number().optional(),format:i.enum([`email`,`uri`,`date`,`date-time`]).optional(),default:i.string().optional()}),Pj=i.object({type:i.enum([`number`,`integer`]),title:i.string().optional(),description:i.string().optional(),minimum:i.number().optional(),maximum:i.number().optional(),default:i.number().optional()}),Fj=i.object({type:i.literal(`string`),title:i.string().optional(),description:i.string().optional(),enum:i.array(i.string()),default:i.string().optional()}),Ij=i.object({type:i.literal(`string`),title:i.string().optional(),description:i.string().optional(),oneOf:i.array(i.object({const:i.string(),title:i.string()})),default:i.string().optional()}),Lj=i.object({type:i.literal(`string`),title:i.string().optional(),description:i.string().optional(),enum:i.array(i.string()),enumNames:i.array(i.string()).optional(),default:i.string().optional()}),Rj=i.union([Fj,Ij]),zj=i.object({type:i.literal(`array`),title:i.string().optional(),description:i.string().optional(),minItems:i.number().optional(),maxItems:i.number().optional(),items:i.object({type:i.literal(`string`),enum:i.array(i.string())}),default:i.array(i.string()).optional()}),Bj=i.object({type:i.literal(`array`),title:i.string().optional(),description:i.string().optional(),minItems:i.number().optional(),maxItems:i.number().optional(),items:i.object({anyOf:i.array(i.object({const:i.string(),title:i.string()}))}),default:i.array(i.string()).optional()}),Vj=i.union([zj,Bj]),Hj=i.union([Lj,Rj,Vj]),Uj=i.union([Hj,Mj,Nj,Pj]),Wj=wk.extend({mode:i.literal(`form`).optional(),message:i.string(),requestedSchema:i.object({type:i.literal(`object`),properties:i.record(i.string(),Uj),required:i.array(i.string()).optional()})}),Gj=wk.extend({mode:i.literal(`url`),message:i.string(),elicitationId:i.string(),url:i.string().url()}),Kj=i.union([Wj,Gj]),qj=Ek.extend({method:i.literal(`elicitation/create`),params:Kj}),Jj=Dk.extend({elicitationId:i.string()}),Yj=Ok.extend({method:i.literal(`notifications/elicitation/complete`),params:Jj}),Xj=kk.extend({action:i.enum([`accept`,`decline`,`cancel`]),content:i.preprocess(e=>e===null?void 0:e,i.record(i.string(),i.union([i.string(),i.number(),i.boolean(),i.array(i.string())])).optional())}),Zj=i.object({type:i.literal(`ref/resource`),uri:i.string()}),Qj=i.object({type:i.literal(`ref/prompt`),name:i.string()}),$j=Ck.extend({ref:i.union([Qj,Zj]),argument:i.object({name:i.string(),value:i.string()}),context:i.object({arguments:i.record(i.string(),i.string()).optional()}).optional()}),eM=Ek.extend({method:i.literal(`completion/complete`),params:$j});function tM(e){if(e.params.ref.type!==`ref/prompt`)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function nM(e){if(e.params.ref.type!==`ref/resource`)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}const rM=kk.extend({completion:i.looseObject({values:i.array(i.string()).max(100),total:i.optional(i.number().int()),hasMore:i.optional(i.boolean())})}),iM=i.object({uri:i.string().startsWith(`file://`),name:i.string().optional(),_meta:i.record(i.string(),i.unknown()).optional()}),aM=Ek.extend({method:i.literal(`roots/list`),params:Ck.optional()}),oM=kk.extend({roots:i.array(iM)}),sM=Ok.extend({method:i.literal(`notifications/roots/list_changed`),params:Dk.optional()});i.union([rA,$k,eM,vj,XA,qA,AA,MA,IA,BA,HA,mj,uj,hA,_A,vA,bA]),i.union([Hk,oA,nA,sM,mA]),i.union([Bk,Aj,jj,Xj,oM,gA,yA,fA]),i.union([rA,kj,qj,aM,hA,_A,vA,bA]),i.union([Hk,oA,bj,WA,RA,hj,oj,mA,Yj]),i.union([Bk,tA,rM,aj,JA,jA,NA,LA,fj,dj,gA,yA,fA]);var Y=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===J.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new cM(e.elicitations,n)}return new e(t,n,r)}},cM=class extends Y{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(J.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function lM(e){return e===`completed`||e===`failed`||e===`cancelled`}const uM=Symbol(`Let zodToJsonSchema decide on which parser to use`),dM={name:void 0,$refStrategy:`root`,basePath:[`#`],effectStrategy:`input`,pipeStrategy:`all`,dateStrategy:`format:date-time`,mapStrategy:`entries`,removeAdditionalStrategy:`passthrough`,allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:`definitions`,target:`jsonSchema7`,strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:`escape`,applyRegexFlags:!1,emailStrategy:`format:email`,base64Strategy:`contentEncoding:base64`,nameStrategy:`ref`,openAiAnyTypeName:`OpenAiAnyType`},fM=e=>typeof e==`string`?{...dM,name:e}:{...dM,...e},pM=e=>{let t=fM(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function mM(e,t,n,r){r?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function X(e,t,n,r,i){e[t]=n,mM(e,t,r,i)}const hM=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join(`/`)};function gM(e){if(e.target!==`openAi`)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy===`relative`?hM(t,e.currentPath):t.join(`/`)}}function _M(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==v.ZodAny&&(n.items=Z(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&X(n,`minItems`,e.minLength.value,e.minLength.message,t),e.maxLength&&X(n,`maxItems`,e.maxLength.value,e.maxLength.message,t),e.exactLength&&(X(n,`minItems`,e.exactLength.value,e.exactLength.message,t),X(n,`maxItems`,e.exactLength.value,e.exactLength.message,t)),n}function vM(e,t){let n={type:`integer`,format:`int64`};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case`min`:t.target===`jsonSchema7`?r.inclusive?X(n,`minimum`,r.value,r.message,t):X(n,`exclusiveMinimum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),X(n,`minimum`,r.value,r.message,t));break;case`max`:t.target===`jsonSchema7`?r.inclusive?X(n,`maximum`,r.value,r.message,t):X(n,`exclusiveMaximum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),X(n,`maximum`,r.value,r.message,t));break;case`multipleOf`:X(n,`multipleOf`,r.value,r.message,t);break}return n}function yM(){return{type:`boolean`}}function bM(e,t){return Z(e.type._def,t)}const xM=(e,t)=>Z(e.innerType._def,t);function SM(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((n,r)=>SM(e,t,n))};switch(r){case`string`:case`format:date-time`:return{type:`string`,format:`date-time`};case`format:date`:return{type:`string`,format:`date`};case`integer`:return CM(e,t)}}const CM=(e,t)=>{let n={type:`integer`,format:`unix-time`};if(t.target===`openApi3`)return n;for(let r of e.checks)switch(r.kind){case`min`:X(n,`minimum`,r.value,r.message,t);break;case`max`:X(n,`maximum`,r.value,r.message,t);break}return n};function wM(e,t){return{...Z(e.innerType._def,t),default:e.defaultValue()}}function TM(e,t){return t.effectStrategy===`input`?Z(e.schema._def,t):gM(t)}function EM(e){return{type:`string`,enum:Array.from(e.values)}}const DM=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function OM(e,t){let n=[Z(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),Z(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=t.target===`jsonSchema2019-09`?{unevaluatedProperties:!1}:void 0,i=[];return n.forEach(e=>{if(DM(e))i.push(...e.allOf),e.unevaluatedProperties===void 0&&(r=void 0);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}else r=void 0;i.push(t)}}),i.length?{allOf:i,...r}:void 0}function kM(e,t){let n=typeof e.value;return n!==`bigint`&&n!==`number`&&n!==`boolean`&&n!==`string`?{type:Array.isArray(e.value)?`array`:`object`}:t.target===`openApi3`?{type:n===`bigint`?`integer`:n,enum:[e.value]}:{type:n===`bigint`?`integer`:n,const:e.value}}let AM;const jM={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(AM===void 0&&(AM=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),AM),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function MM(e,t){let n={type:`string`};if(e.checks)for(let r of e.checks)switch(r.kind){case`min`:X(n,`minLength`,typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,r.message,t);break;case`max`:X(n,`maxLength`,typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case`email`:switch(t.emailStrategy){case`format:email`:IM(n,`email`,r.message,t);break;case`format:idn-email`:IM(n,`idn-email`,r.message,t);break;case`pattern:zod`:LM(n,jM.email,r.message,t);break}break;case`url`:IM(n,`uri`,r.message,t);break;case`uuid`:IM(n,`uuid`,r.message,t);break;case`regex`:LM(n,r.regex,r.message,t);break;case`cuid`:LM(n,jM.cuid,r.message,t);break;case`cuid2`:LM(n,jM.cuid2,r.message,t);break;case`startsWith`:LM(n,RegExp(`^${NM(r.value,t)}`),r.message,t);break;case`endsWith`:LM(n,RegExp(`${NM(r.value,t)}$`),r.message,t);break;case`datetime`:IM(n,`date-time`,r.message,t);break;case`date`:IM(n,`date`,r.message,t);break;case`time`:IM(n,`time`,r.message,t);break;case`duration`:IM(n,`duration`,r.message,t);break;case`length`:X(n,`minLength`,typeof n.minLength==`number`?Math.max(n.minLength,r.value):r.value,r.message,t),X(n,`maxLength`,typeof n.maxLength==`number`?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case`includes`:LM(n,RegExp(NM(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&IM(n,`ipv4`,r.message,t),r.version!==`v4`&&IM(n,`ipv6`,r.message,t);break;case`base64url`:LM(n,jM.base64url,r.message,t);break;case`jwt`:LM(n,jM.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&LM(n,jM.ipv4Cidr,r.message,t),r.version!==`v4`&&LM(n,jM.ipv6Cidr,r.message,t);break;case`emoji`:LM(n,jM.emoji(),r.message,t);break;case`ulid`:LM(n,jM.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:IM(n,`binary`,r.message,t);break;case`contentEncoding:base64`:X(n,`contentEncoding`,`base64`,r.message,t);break;case`pattern:zod`:LM(n,jM.base64,r.message,t);break}break;case`nanoid`:LM(n,jM.nanoid,r.message,t);case`toLowerCase`:case`toUpperCase`:case`trim`:break;default:(e=>{})(r)}return n}function NM(e,t){return t.patternStrategy===`escape`?FM(e):e}const PM=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function FM(e){let t=``;for(let n=0;n<e.length;n++)PM.has(e[n])||(t+=`\\`),t+=e[n];return t}function IM(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||=[],e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):X(e,`format`,t,n,r)}function LM(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:RM(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):X(e,`pattern`,RM(t,r),n,r)}function RM(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},r=n.i?e.source.toLowerCase():e.source,i=``,a=!1,o=!1,s=!1;for(let e=0;e<r.length;e++){if(a){i+=r[e],a=!1;continue}if(n.i){if(o){if(r[e].match(/[a-z]/)){s?(i+=r[e],i+=`${r[e-2]}-${r[e]}`.toUpperCase(),s=!1):r[e+1]===`-`&&r[e+2]?.match(/[a-z]/)?(i+=r[e],s=!0):i+=`${r[e]}${r[e].toUpperCase()}`;continue}}else if(r[e].match(/[a-z]/)){i+=`[${r[e]}${r[e].toUpperCase()}]`;continue}}if(n.m){if(r[e]===`^`){i+=`(^|(?<=[\r
179
180
  ]))`;continue}else if(r[e]===`$`){i+=`($|(?=[\r
180
- ]))`;continue}}if(n.s&&r[e]===`.`){i+=o?`${r[e]}\r\n`:`[${r[e]}\r\n]`;continue}i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join(`/`)} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function $N(e,t){if(t.target===`openAi`&&console.warn(`Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.`),t.target===`openApi3`&&e.keyType?._def.typeName===v.ZodEnum)return{type:`object`,required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,r)=>({...n,[r]:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,`properties`,r]})??AN(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let n={type:`object`,additionalProperties:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(t.target===`openApi3`)return n;if(e.keyType?._def.typeName===v.ZodString&&e.keyType._def.checks?.length){let{type:r,...i}=KN(e.keyType._def,t);return{...n,propertyNames:i}}else if(e.keyType?._def.typeName===v.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===v.ZodBranded&&e.keyType._def.type._def.typeName===v.ZodString&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=PN(e.keyType._def,t);return{...n,propertyNames:i}}return n}function eP(e,t){return t.mapStrategy===`record`?$N(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[Z(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||AN(t),Z(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||AN(t)],minItems:2,maxItems:2}}}function tP(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function nP(e){return e.target===`openAi`?void 0:{not:AN({...e,currentPath:[...e.currentPath,`not`]})}}function rP(e){return e.target===`openApi3`?{enum:[`null`],nullable:!0}:{type:`null`}}const iP={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function aP(e,t){if(t.target===`openApi3`)return oP(e,t);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in iP&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=iP[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return oP(e,t)}const oP=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>Z(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function sP(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target===`openApi3`?{type:iP[e.innerType._def.typeName],nullable:!0}:{type:[iP[e.innerType._def.typeName],`null`]};if(t.target===`openApi3`){let n=Z(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&`$ref`in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let n=Z(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function cP(e,t){let n={type:`number`};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case`int`:n.type=`integer`,ON(n,`type`,r.message,t);break;case`min`:t.target===`jsonSchema7`?r.inclusive?X(n,`minimum`,r.value,r.message,t):X(n,`exclusiveMinimum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),X(n,`minimum`,r.value,r.message,t));break;case`max`:t.target===`jsonSchema7`?r.inclusive?X(n,`maximum`,r.value,r.message,t):X(n,`exclusiveMaximum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),X(n,`maximum`,r.value,r.message,t));break;case`multipleOf`:X(n,`multipleOf`,r.value,r.message,t);break}return n}function lP(e,t){let n=t.target===`openAi`,r={type:`object`,properties:{}},i=[],a=e.shape();for(let e in a){let o=a[e];if(o===void 0||o._def===void 0)continue;let s=dP(o);s&&n&&(o._def.typeName===`ZodOptional`&&(o=o._def.innerType),o.isNullable()||(o=o.nullable()),s=!1);let c=Z(o._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});c!==void 0&&(r.properties[e]=c,s||i.push(e))}i.length&&(r.required=i);let o=uP(e,t);return o!==void 0&&(r.additionalProperties=o),r}function uP(e,t){if(e.catchall._def.typeName!==`ZodNever`)return Z(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function dP(e){try{return e.isOptional()}catch{return!0}}const fP=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Z(e.innerType._def,t);let n=Z(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:AN(t)},n]}:AN(t)},pP=(e,t)=>{if(t.pipeStrategy===`input`)return Z(e.in._def,t);if(t.pipeStrategy===`output`)return Z(e.out._def,t);let n=Z(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,Z(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function mP(e,t){return Z(e.type._def,t)}function hP(e,t){let n={type:`array`,uniqueItems:!0,items:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&X(n,`minItems`,e.minSize.value,e.minSize.message,t),e.maxSize&&X(n,`maxItems`,e.maxSize.value,e.maxSize.message,t),n}function gP(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>Z(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:Z(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>Z(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function _P(e){return{not:AN(e)}}function vP(e){return AN(e)}const yP=(e,t)=>Z(e.innerType._def,t),bP=(e,t,n)=>{switch(t){case v.ZodString:return KN(e,n);case v.ZodNumber:return cP(e,n);case v.ZodObject:return lP(e,n);case v.ZodBigInt:return MN(e,n);case v.ZodBoolean:return NN();case v.ZodDate:return IN(e,n);case v.ZodUndefined:return _P(n);case v.ZodNull:return rP(n);case v.ZodArray:return jN(e,n);case v.ZodUnion:case v.ZodDiscriminatedUnion:return aP(e,n);case v.ZodIntersection:return HN(e,n);case v.ZodTuple:return gP(e,n);case v.ZodRecord:return $N(e,n);case v.ZodLiteral:return UN(e,n);case v.ZodEnum:return BN(e);case v.ZodNativeEnum:return tP(e);case v.ZodNullable:return sP(e,n);case v.ZodOptional:return fP(e,n);case v.ZodMap:return eP(e,n);case v.ZodSet:return hP(e,n);case v.ZodLazy:return()=>e.getter()._def;case v.ZodPromise:return mP(e,n);case v.ZodNaN:case v.ZodNever:return nP(n);case v.ZodEffects:return zN(e,n);case v.ZodAny:return AN(n);case v.ZodUnknown:return vP(n);case v.ZodDefault:return RN(e,n);case v.ZodBranded:return PN(e,n);case v.ZodReadonly:return yP(e,n);case v.ZodCatch:return FN(e,n);case v.ZodPipeline:return pP(e,n);case v.ZodFunction:case v.ZodVoid:case v.ZodSymbol:return;default:return(e=>void 0)(t)}};function Z(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==wN)return i}if(r&&!n){let e=xP(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=bP(e,e.typeName,t),o=typeof a==`function`?Z(a(),t):a;if(o&&SP(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}const xP=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:kN(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),AN(t)):t.$refStrategy===`seen`?AN(t):void 0}},SP=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),CP=(e,t)=>{let n=DN(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:Z(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??AN(n)}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=Z(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??AN(n),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o),n.flags.hasReferencedOpenAiAnyType&&(r||={},r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:[`string`,`number`,`integer`,`boolean`,`array`,`null`],items:{$ref:n.$refStrategy===`relative`?`1`:[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join(`/`)}}));let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return n.target===`jsonSchema7`?s.$schema=`http://json-schema.org/draft-07/schema#`:(n.target===`jsonSchema2019-09`||n.target===`openAi`)&&(s.$schema=`https://json-schema.org/draft/2019-09/schema#`),n.target===`openAi`&&(`anyOf`in s||`oneOf`in s||`allOf`in s||`type`in s&&Array.isArray(s.type))&&console.warn(`Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.`),s};function wP(e){return!e||e===`jsonSchema7`||e===`draft-7`?`draft-7`:e===`jsonSchema2019-09`||e===`draft-2020-12`?`draft-2020-12`:`draft-7`}function TP(e,t){return vA(e)?te.toJSONSchema(e,{target:wP(t?.target),io:t?.pipeStrategy??`input`}):CP(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??`input`})}function EP(e){let t=SA(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=DA(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function DP(e,t){let n=bA(e,t);if(!n.success)throw n.error;return n.data}var OP=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(nj,e=>{this._oncancel(e)}),this.setNotificationHandler(bj,e=>{this._onprogress(e)}),this.setRequestHandler(_j,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(kj,async(e,t)=>{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Y(J.InvalidParams,`Failed to retrieve task: Task not found`);return{...n}}),this.setRequestHandler(jj,async(e,t)=>{let n=async()=>{let r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if(e.type===`response`||e.type===`error`){let t=e.message,n=t.id,r=this._requestResolvers.get(n);if(r)if(this._requestResolvers.delete(n),e.type===`response`)r(t);else{let e=t;r(new Y(e.error.code,e.error.message,e.error.data))}else{let t=e.type===`response`?`Response`:`Error`;this._onerror(Error(`${t} handler missing for request ${n}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new Y(J.InvalidParams,`Task not found: ${r}`);if(!CN(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if(CN(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[AA]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(Mj,async(e,t)=>{try{let{tasks:n,nextCursor:r}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new Y(J.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(Pj,async(e,t)=>{try{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Y(J.InvalidParams,`Task not found: ${e.params.taskId}`);if(CN(n.status))throw new Y(J.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,`cancelled`,`Client cancelled task execution.`,t.sessionId),this._clearTaskQueue(e.params.taskId);let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new Y(J.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...r}}catch(e){throw e instanceof Y?e:new Y(J.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),Y.fromError(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error(`Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.`);this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),XA(e)||QA(e)?this._onresponse(e):KA(e)?this._onrequest(e,t):JA(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();let t=Y.fromError(J.ConnectionClosed,`Connection closed`);this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[AA]?.taskId;if(n===void 0){let t={jsonrpc:`2.0`,id:e.id,error:{code:J.MethodNotFound,message:`Method not found`}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:`error`,message:t,timestamp:Date.now()},r?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):r?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=zA(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let n={relatedRequestId:e.id};i&&(n.relatedTask={taskId:i}),await this.notification(t,n)},sendRequest:async(t,n,r)=>{if(a.signal.aborted)throw new Y(J.ConnectionClosed,`Request was cancelled`);let o={...r,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let c=o.relatedTask?.taskId??i;return c&&s&&await s.updateTaskStatus(c,`input_required`),await this.request(t,n,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:s,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async t=>{if(a.signal.aborted)return;let n={result:t,jsonrpc:`2.0`,id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`response`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)},async t=>{if(a.signal.aborted)return;let n={jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:J.InternalError,message:t.message??`Internal error`,...t.data!==void 0&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`error`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){this._requestResolvers.delete(t),XA(e)?n(e):n(new Y(e.error.code,e.error.message,e.error.data));return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(XA(e)&&e.result&&typeof e.result==`object`){let n=e.result;if(n.task&&typeof n.task==`object`){let e=n.task;typeof e.taskId==`string`&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),XA(e)?r(e):r(Y.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:`result`,result:await this.request(e,t,n)}}catch(e){yield{type:`error`,error:e instanceof Y?e:new Y(J.InternalError,String(e))}}return}let i;try{let r=await this.request(e,Ej,n);if(r.task)i=r.task.taskId,yield{type:`taskCreated`,task:r.task};else throw new Y(J.InternalError,`Task creation did not return a task`);for(;;){let e=await this.getTask({taskId:i},n);if(yield{type:`taskStatus`,task:e},CN(e.status)){e.status===`completed`?yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)}:e.status===`failed`?yield{type:`error`,error:new Y(J.InternalError,`Task ${i} failed`)}:e.status===`cancelled`&&(yield{type:`error`,error:new Y(J.InternalError,`Task ${i} was cancelled`)});return}if(e.status===`input_required`){yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)};return}let r=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,r)),n?.signal?.throwIfAborted()}}catch(e){yield{type:`error`,error:e instanceof Y?e:new Y(J.InternalError,String(e))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:o,relatedTask:s}=n??{};return new Promise((c,l)=>{let u=e=>{l(e)};if(!this._transport){u(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){u(e);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:`2.0`,id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),o&&(f.params={...f.params,task:o}),s&&(f.params={...f.params,_meta:{...f.params?._meta||{},[AA]:s}});let p=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:d,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),l(e instanceof Y?e:new Y(J.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return l(e);try{let n=bA(t,e.result);n.success?c(n.data):l(n.error)}catch(e){l(e)}}}),n?.signal?.addEventListener(`abort`,()=>{p(n?.signal?.reason)});let m=n?.timeout??6e4;this._setupTimeout(d,m,n?.maxTotalTimeout,()=>p(Y.fromError(J.RequestTimeout,`Request timed out`,{timeout:m})),n?.resetTimeoutOnProgress??!1);let h=s?.taskId;h?(this._requestResolvers.set(d,e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))}),this._enqueueTaskMessage(h,{type:`request`,message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})):this._transport.send(f,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:`tasks/get`,params:e},Aj,t)}async getTaskResult(e,t,n){return this.request({method:`tasks/result`,params:e},t,n)}async listTasks(e,t){return this.request({method:`tasks/list`,params:e},Nj,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},Fj,t)}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let r={...e,jsonrpc:`2.0`,params:{...e.params,_meta:{...e.params?._meta||{},[AA]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:`notification`,message:r,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let n={...e,jsonrpc:`2.0`};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[AA]:t.relatedTask}}}),this._transport?.send(n,t).catch(e=>this._onerror(e))});return}let r={...e,jsonrpc:`2.0`};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[AA]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=EP(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=DP(e,n);return Promise.resolve(t(i,r))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=EP(e);this._notificationHandlers.set(n,n=>{let r=DP(e,n);return Promise.resolve(t(r))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error(`Cannot enqueue task message: taskStore and taskMessageQueue are not configured`);let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let t of n)if(t.type===`request`&&KA(t.message)){let n=t.message.id,r=this._requestResolvers.get(n);r?(r(new Y(J.InternalError,`Task cancelled or completed`)),this._requestResolvers.delete(n)):this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(n=t.pollInterval)}catch{}return new Promise((e,r)=>{if(t.aborted){r(new Y(J.InvalidRequest,`Request cancelled`));return}let i=setTimeout(e,n);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new Y(J.InvalidRequest,`Request cancelled`))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error(`No task store configured`);return{createTask:async r=>{if(!e)throw Error(`No request provided`);return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let r=await n.getTask(e,t);if(!r)throw new Y(J.InvalidParams,`Failed to retrieve task: Task not found`);return r},storeTaskResult:async(e,r,i)=>{await n.storeTaskResult(e,r,i,t);let a=await n.getTask(e,t);if(a){let t=Oj.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),CN(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>n.getTaskResult(e,t),updateTaskStatus:async(e,r,i)=>{let a=await n.getTask(e,t);if(!a)throw new Y(J.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(CN(a.status))throw new Y(J.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(e,r,i,t);let o=await n.getTask(e,t);if(o){let t=Oj.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),CN(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}};function kP(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function AP(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];kP(a)&&kP(i)?n[r]={...a,...i}:n[r]=i}return n}var jP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;let a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),MP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=jP();var n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;let o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),Q=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=jP(),n=MP();var r=jP();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=MP();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=se(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=se(this.rhs,e,n),this}get names(){return oe(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=se(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(ce(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>ae(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(le(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=se(this.condition,e,t),this}get names(){let e=super.names;return oe(e,this.condition),this.else&&ae(e,this.else.names),e}};_.kind=`if`;var ee=class extends m{};ee.kind=`for`;var v=class extends ee{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=se(this.iteration,e,t),this}get names(){return ae(super.names,this.iteration.names)}},te=class extends ee{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return oe(oe(super.names,this.from),this.to)}},y=class extends ee{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=se(this.iterable,e,t),this}get names(){return ae(super.names,this.iterable.names)}},ne=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};ne.kind=`func`;var re=class extends p{render(e){return`return `+super.render(e)}};re.kind=`return`;var b=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&ae(e,this.catch.names),this.finally&&ae(e,this.finally.names),e}},x=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};x.kind=`catch`;var ie=class extends m{render(e){return`finally`+super.render(e)}};ie.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
181
- `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new v(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new te(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new y(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new y(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(ee)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new re;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(re)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new b;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new x(e),t(e)}return n&&(this._currNode=r.finally=new ie,this.code(n)),this._endBlockNode(x,ie)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new ne(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(ne)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function ae(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function oe(e,n){return n instanceof t._CodeOrName?ae(e,n.names):e}function se(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function ce(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function le(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${he(e)}`}e.not=le;let ue=me(e.operators.AND);function de(...e){return e.reduce(ue)}e.and=de;let fe=me(e.operators.OR);function pe(...e){return e.reduce(fe)}e.or=pe;function me(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${he(n)} ${e} ${he(r)}`}function he(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),$=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=Q(),n=jP();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||y(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;let _={};function ee(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=ee;var v;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(v||(e.Type=v={}));function te(e,n,r){if(e instanceof t.Name){let i=n===v.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=te;function y(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=y})),NP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),PP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=Q(),n=$(),r=NP();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}let u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),FP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=PP(),n=Q(),r=NP(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),IP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),LP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),RP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=IP(),n=LP(),r=PP(),i=Q(),a=$();var o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;let u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
181
+ ]))`;continue}}if(n.s&&r[e]===`.`){i+=o?`${r[e]}\r\n`:`[${r[e]}\r\n]`;continue}i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join(`/`)} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function zM(e,t){if(t.target===`openAi`&&console.warn(`Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.`),t.target===`openApi3`&&e.keyType?._def.typeName===v.ZodEnum)return{type:`object`,required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,r)=>({...n,[r]:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,`properties`,r]})??gM(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let n={type:`object`,additionalProperties:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(t.target===`openApi3`)return n;if(e.keyType?._def.typeName===v.ZodString&&e.keyType._def.checks?.length){let{type:r,...i}=MM(e.keyType._def,t);return{...n,propertyNames:i}}else if(e.keyType?._def.typeName===v.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===v.ZodBranded&&e.keyType._def.type._def.typeName===v.ZodString&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=bM(e.keyType._def,t);return{...n,propertyNames:i}}return n}function BM(e,t){return t.mapStrategy===`record`?zM(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[Z(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||gM(t),Z(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||gM(t)],minItems:2,maxItems:2}}}function VM(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function HM(e){return e.target===`openAi`?void 0:{not:gM({...e,currentPath:[...e.currentPath,`not`]})}}function UM(e){return e.target===`openApi3`?{enum:[`null`],nullable:!0}:{type:`null`}}const WM={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function GM(e,t){if(t.target===`openApi3`)return KM(e,t);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in WM&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=WM[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return KM(e,t)}const KM=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>Z(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function qM(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target===`openApi3`?{type:WM[e.innerType._def.typeName],nullable:!0}:{type:[WM[e.innerType._def.typeName],`null`]};if(t.target===`openApi3`){let n=Z(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&`$ref`in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let n=Z(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function JM(e,t){let n={type:`number`};if(!e.checks)return n;for(let r of e.checks)switch(r.kind){case`int`:n.type=`integer`,mM(n,`type`,r.message,t);break;case`min`:t.target===`jsonSchema7`?r.inclusive?X(n,`minimum`,r.value,r.message,t):X(n,`exclusiveMinimum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),X(n,`minimum`,r.value,r.message,t));break;case`max`:t.target===`jsonSchema7`?r.inclusive?X(n,`maximum`,r.value,r.message,t):X(n,`exclusiveMaximum`,r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),X(n,`maximum`,r.value,r.message,t));break;case`multipleOf`:X(n,`multipleOf`,r.value,r.message,t);break}return n}function YM(e,t){let n=t.target===`openAi`,r={type:`object`,properties:{}},i=[],a=e.shape();for(let e in a){let o=a[e];if(o===void 0||o._def===void 0)continue;let s=ZM(o);s&&n&&(o._def.typeName===`ZodOptional`&&(o=o._def.innerType),o.isNullable()||(o=o.nullable()),s=!1);let c=Z(o._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});c!==void 0&&(r.properties[e]=c,s||i.push(e))}i.length&&(r.required=i);let o=XM(e,t);return o!==void 0&&(r.additionalProperties=o),r}function XM(e,t){if(e.catchall._def.typeName!==`ZodNever`)return Z(e.catchall._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]});switch(e.unknownKeys){case`passthrough`:return t.allowedAdditionalProperties;case`strict`:return t.rejectedAdditionalProperties;case`strip`:return t.removeAdditionalStrategy===`strict`?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function ZM(e){try{return e.isOptional()}catch{return!0}}const QM=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Z(e.innerType._def,t);let n=Z(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:gM(t)},n]}:gM(t)},$M=(e,t)=>{if(t.pipeStrategy===`input`)return Z(e.in._def,t);if(t.pipeStrategy===`output`)return Z(e.out._def,t);let n=Z(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,Z(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function eN(e,t){return Z(e.type._def,t)}function tN(e,t){let n={type:`array`,uniqueItems:!0,items:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&X(n,`minItems`,e.minSize.value,e.minSize.message,t),e.maxSize&&X(n,`maxItems`,e.maxSize.value,e.maxSize.message,t),n}function nN(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>Z(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:Z(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>Z(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function rN(e){return{not:gM(e)}}function iN(e){return gM(e)}const aN=(e,t)=>Z(e.innerType._def,t),oN=(e,t,n)=>{switch(t){case v.ZodString:return MM(e,n);case v.ZodNumber:return JM(e,n);case v.ZodObject:return YM(e,n);case v.ZodBigInt:return vM(e,n);case v.ZodBoolean:return yM();case v.ZodDate:return SM(e,n);case v.ZodUndefined:return rN(n);case v.ZodNull:return UM(n);case v.ZodArray:return _M(e,n);case v.ZodUnion:case v.ZodDiscriminatedUnion:return GM(e,n);case v.ZodIntersection:return OM(e,n);case v.ZodTuple:return nN(e,n);case v.ZodRecord:return zM(e,n);case v.ZodLiteral:return kM(e,n);case v.ZodEnum:return EM(e);case v.ZodNativeEnum:return VM(e);case v.ZodNullable:return qM(e,n);case v.ZodOptional:return QM(e,n);case v.ZodMap:return BM(e,n);case v.ZodSet:return tN(e,n);case v.ZodLazy:return()=>e.getter()._def;case v.ZodPromise:return eN(e,n);case v.ZodNaN:case v.ZodNever:return HM(n);case v.ZodEffects:return TM(e,n);case v.ZodAny:return gM(n);case v.ZodUnknown:return iN(n);case v.ZodDefault:return wM(e,n);case v.ZodBranded:return bM(e,n);case v.ZodReadonly:return aN(e,n);case v.ZodCatch:return xM(e,n);case v.ZodPipeline:return $M(e,n);case v.ZodFunction:case v.ZodVoid:case v.ZodSymbol:return;default:return(e=>void 0)(t)}};function Z(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==uM)return i}if(r&&!n){let e=sN(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=oN(e,e.typeName,t),o=typeof a==`function`?Z(a(),t):a;if(o&&cN(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}const sN=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:hM(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),gM(t)):t.$refStrategy===`seen`?gM(t):void 0}},cN=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),lN=(e,t)=>{let n=pM(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:Z(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??gM(n)}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=Z(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??gM(n),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o),n.flags.hasReferencedOpenAiAnyType&&(r||={},r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:[`string`,`number`,`integer`,`boolean`,`array`,`null`],items:{$ref:n.$refStrategy===`relative`?`1`:[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join(`/`)}}));let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return n.target===`jsonSchema7`?s.$schema=`http://json-schema.org/draft-07/schema#`:(n.target===`jsonSchema2019-09`||n.target===`openAi`)&&(s.$schema=`https://json-schema.org/draft/2019-09/schema#`),n.target===`openAi`&&(`anyOf`in s||`oneOf`in s||`allOf`in s||`type`in s&&Array.isArray(s.type))&&console.warn(`Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.`),s};function uN(e){return!e||e===`jsonSchema7`||e===`draft-7`?`draft-7`:e===`jsonSchema2019-09`||e===`draft-2020-12`?`draft-2020-12`:`draft-7`}function dN(e,t){return ik(e)?te.toJSONSchema(e,{target:uN(t?.target),io:t?.pipeStrategy??`input`}):lN(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??`input`})}function fN(e){let t=ck(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=pk(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function pN(e,t){let n=ok(e,t);if(!n.success)throw n.error;return n.data}var mN=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Hk,e=>{this._oncancel(e)}),this.setNotificationHandler(oA,e=>{this._onprogress(e)}),this.setRequestHandler(rA,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(hA,async(e,t)=>{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Y(J.InvalidParams,`Failed to retrieve task: Task not found`);return{...n}}),this.setRequestHandler(_A,async(e,t)=>{let n=async()=>{let r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if(e.type===`response`||e.type===`error`){let t=e.message,n=t.id,r=this._requestResolvers.get(n);if(r)if(this._requestResolvers.delete(n),e.type===`response`)r(t);else{let e=t;r(new Y(e.error.code,e.error.message,e.error.data))}else{let t=e.type===`response`?`Response`:`Error`;this._onerror(Error(`${t} handler missing for request ${n}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new Y(J.InvalidParams,`Task not found: ${r}`);if(!lM(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if(lM(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[gk]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(vA,async(e,t)=>{try{let{tasks:n,nextCursor:r}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new Y(J.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(bA,async(e,t)=>{try{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Y(J.InvalidParams,`Task not found: ${e.params.taskId}`);if(lM(n.status))throw new Y(J.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,`cancelled`,`Client cancelled task execution.`,t.sessionId),this._clearTaskQueue(e.params.taskId);let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new Y(J.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...r}}catch(e){throw e instanceof Y?e:new Y(J.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),Y.fromError(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error(`Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.`);this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),Ik(e)||Rk(e)?this._onresponse(e):Mk(e)?this._onrequest(e,t):Pk(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();let t=Y.fromError(J.ConnectionClosed,`Connection closed`);this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[gk]?.taskId;if(n===void 0){let t={jsonrpc:`2.0`,id:e.id,error:{code:J.MethodNotFound,message:`Method not found`}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:`error`,message:t,timestamp:Date.now()},r?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):r?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=Tk(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let n={relatedRequestId:e.id};i&&(n.relatedTask={taskId:i}),await this.notification(t,n)},sendRequest:async(t,n,r)=>{if(a.signal.aborted)throw new Y(J.ConnectionClosed,`Request was cancelled`);let o={...r,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let c=o.relatedTask?.taskId??i;return c&&s&&await s.updateTaskStatus(c,`input_required`),await this.request(t,n,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:s,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async t=>{if(a.signal.aborted)return;let n={result:t,jsonrpc:`2.0`,id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`response`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)},async t=>{if(a.signal.aborted)return;let n={jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:J.InternalError,message:t.message??`Internal error`,...t.data!==void 0&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`error`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){this._requestResolvers.delete(t),Ik(e)?n(e):n(new Y(e.error.code,e.error.message,e.error.data));return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(Ik(e)&&e.result&&typeof e.result==`object`){let n=e.result;if(n.task&&typeof n.task==`object`){let e=n.task;typeof e.taskId==`string`&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),Ik(e)?r(e):r(Y.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:`result`,result:await this.request(e,t,n)}}catch(e){yield{type:`error`,error:e instanceof Y?e:new Y(J.InternalError,String(e))}}return}let i;try{let r=await this.request(e,fA,n);if(r.task)i=r.task.taskId,yield{type:`taskCreated`,task:r.task};else throw new Y(J.InternalError,`Task creation did not return a task`);for(;;){let e=await this.getTask({taskId:i},n);if(yield{type:`taskStatus`,task:e},lM(e.status)){e.status===`completed`?yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)}:e.status===`failed`?yield{type:`error`,error:new Y(J.InternalError,`Task ${i} failed`)}:e.status===`cancelled`&&(yield{type:`error`,error:new Y(J.InternalError,`Task ${i} was cancelled`)});return}if(e.status===`input_required`){yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)};return}let r=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,r)),n?.signal?.throwIfAborted()}}catch(e){yield{type:`error`,error:e instanceof Y?e:new Y(J.InternalError,String(e))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:o,relatedTask:s}=n??{};return new Promise((c,l)=>{let u=e=>{l(e)};if(!this._transport){u(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){u(e);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:`2.0`,id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),o&&(f.params={...f.params,task:o}),s&&(f.params={...f.params,_meta:{...f.params?._meta||{},[gk]:s}});let p=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:d,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),l(e instanceof Y?e:new Y(J.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return l(e);try{let n=ok(t,e.result);n.success?c(n.data):l(n.error)}catch(e){l(e)}}}),n?.signal?.addEventListener(`abort`,()=>{p(n?.signal?.reason)});let m=n?.timeout??6e4;this._setupTimeout(d,m,n?.maxTotalTimeout,()=>p(Y.fromError(J.RequestTimeout,`Request timed out`,{timeout:m})),n?.resetTimeoutOnProgress??!1);let h=s?.taskId;h?(this._requestResolvers.set(d,e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))}),this._enqueueTaskMessage(h,{type:`request`,message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})):this._transport.send(f,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:`tasks/get`,params:e},gA,t)}async getTaskResult(e,t,n){return this.request({method:`tasks/result`,params:e},t,n)}async listTasks(e,t){return this.request({method:`tasks/list`,params:e},yA,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},xA,t)}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let r={...e,jsonrpc:`2.0`,params:{...e.params,_meta:{...e.params?._meta||{},[gk]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:`notification`,message:r,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let n={...e,jsonrpc:`2.0`};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[gk]:t.relatedTask}}}),this._transport?.send(n,t).catch(e=>this._onerror(e))});return}let r={...e,jsonrpc:`2.0`};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[gk]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=fN(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=pN(e,n);return Promise.resolve(t(i,r))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=fN(e);this._notificationHandlers.set(n,n=>{let r=pN(e,n);return Promise.resolve(t(r))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error(`Cannot enqueue task message: taskStore and taskMessageQueue are not configured`);let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let t of n)if(t.type===`request`&&Mk(t.message)){let n=t.message.id,r=this._requestResolvers.get(n);r?(r(new Y(J.InternalError,`Task cancelled or completed`)),this._requestResolvers.delete(n)):this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(n=t.pollInterval)}catch{}return new Promise((e,r)=>{if(t.aborted){r(new Y(J.InvalidRequest,`Request cancelled`));return}let i=setTimeout(e,n);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new Y(J.InvalidRequest,`Request cancelled`))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error(`No task store configured`);return{createTask:async r=>{if(!e)throw Error(`No request provided`);return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let r=await n.getTask(e,t);if(!r)throw new Y(J.InvalidParams,`Failed to retrieve task: Task not found`);return r},storeTaskResult:async(e,r,i)=>{await n.storeTaskResult(e,r,i,t);let a=await n.getTask(e,t);if(a){let t=mA.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),lM(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>n.getTaskResult(e,t),updateTaskStatus:async(e,r,i)=>{let a=await n.getTask(e,t);if(!a)throw new Y(J.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(lM(a.status))throw new Y(J.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(e,r,i,t);let o=await n.getTask(e,t);if(o){let t=mA.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),lM(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}};function hN(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function gN(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];hN(a)&&hN(i)?n[r]={...a,...i}:n[r]=i}return n}var _N=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;let a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),vN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=_N();var n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;let o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),Q=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=_N(),n=vN();var r=_N();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=vN();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=se(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=se(this.rhs,e,n),this}get names(){return oe(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=se(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(ce(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>ae(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(le(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=se(this.condition,e,t),this}get names(){let e=super.names;return oe(e,this.condition),this.else&&ae(e,this.else.names),e}};_.kind=`if`;var ee=class extends m{};ee.kind=`for`;var v=class extends ee{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=se(this.iteration,e,t),this}get names(){return ae(super.names,this.iteration.names)}},te=class extends ee{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return oe(oe(super.names,this.from),this.to)}},y=class extends ee{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=se(this.iterable,e,t),this}get names(){return ae(super.names,this.iterable.names)}},ne=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};ne.kind=`func`;var re=class extends p{render(e){return`return `+super.render(e)}};re.kind=`return`;var b=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&ae(e,this.catch.names),this.finally&&ae(e,this.finally.names),e}},x=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};x.kind=`catch`;var ie=class extends m{render(e){return`finally`+super.render(e)}};ie.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
182
+ `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new v(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new te(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new y(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new y(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(ee)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new re;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(re)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new b;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new x(e),t(e)}return n&&(this._currNode=r.finally=new ie,this.code(n)),this._endBlockNode(x,ie)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new ne(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(ne)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function ae(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function oe(e,n){return n instanceof t._CodeOrName?ae(e,n.names):e}function se(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function ce(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function le(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${he(e)}`}e.not=le;let ue=me(e.operators.AND);function de(...e){return e.reduce(ue)}e.and=de;let fe=me(e.operators.OR);function pe(...e){return e.reduce(fe)}e.or=pe;function me(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${he(n)} ${e} ${he(r)}`}function he(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),$=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=Q(),n=_N();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||y(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;let _={};function ee(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=ee;var v;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(v||(e.Type=v={}));function te(e,n,r){if(e instanceof t.Name){let i=n===v.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=te;function y(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=y})),yN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),bN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=Q(),n=$(),r=yN();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}let u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),xN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=bN(),n=Q(),r=yN(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),SN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),CN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),wN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=SN(),n=CN(),r=bN(),i=Q(),a=$();var o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;let u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
182
183
  || (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
183
184
  || (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
184
- || ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;let g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=ee(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function ee(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),zP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.assignDefaults=void 0;let t=Q(),n=$();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),BP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=Q(),n=$(),r=NP(),i=$();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;let h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function ee(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=ee})),VP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=Q(),n=NP(),r=BP(),i=PP();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)te(),i.modifying&&s(e),y(()=>e.error());else{let t=i.async?ee():v();i.modifying&&s(e),y(()=>c(e,t))}}function ee(){let e=a.let(`ruleErrs`,null);return a.try(()=>te((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function v(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),te(t.nil),e}function te(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function y(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),HP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=Q(),n=$();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),UP=t(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),WP=t(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else (p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),GP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=$(),n=UP(),r=WP(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;let o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;let d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;let m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),KP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=FP(),n=RP(),r=LP(),i=RP(),a=zP(),o=VP(),s=HP(),c=Q(),l=NP(),u=GP(),d=$(),f=PP();function p(e){if(ne(e)&&(b(e),y(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${v(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(v(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&ce(e),ae(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&ee(e),x(e),le(e)})}function ee(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function v(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function te(e,n){if(ne(e)&&(b(e),y(e))){re(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function y({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function ne(e){return typeof e.schema!=`boolean`}function re(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&ce(e),oe(e),se(e);let a=r.const(`_errs`,l.default.errors);x(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function b(e){(0,d.checkUnknownRules)(e),ie(e)}function x(e,t){if(e.opts.jtd)return de(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);de(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function ie(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function ae(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function oe(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function se(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function ce({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function le(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&ue(e),t.return((0,c._)`${l.default.errors} === 0`))}function ue({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function de(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>Se(e,`$ref`,h.all.$ref.definition));return}p.jtd||pe(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),fe(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):fe(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function fe(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&Se(e,n.keyword,n.definition,t.type)})}function pe(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(me(e,t),e.opts.allowUnionTypes||he(e,t),ge(e,e.dataTypes))}function me(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{ve(e.dataTypes,t)||be(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),ye(e,t)}}function he(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&be(e,`use allowUnionTypes to allow union type keyword`)}function ge(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>_e(t,e))&&be(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function _e(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function ve(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function ye(e,t){let n=[];for(let r of e.dataTypes)ve(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function be(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var xe=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,Te(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return te(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=xe;function Se(e,t,n,r){let i=new xe(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}let Ce=/^\/(?:[^~]|~0|~1)*$/,we=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Te(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!Ce.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=we.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=Te})),qP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),JP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=GP();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),YP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=Q(),n=qP(),r=NP(),i=GP(),a=$(),o=KP();var s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;let h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),XP=t(((e,t)=>{t.exports={$id:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,description:`Meta-schema for $data reference (JSON AnySchema extension proposal)`,type:`object`,required:[`$data`],properties:{$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},additionalProperties:!1}})),ZP=t(((e,t)=>{let n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}let a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o(e){return e.length=0,!0}function s(e,t,n){if(e.length){let r=i(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function c(e){let t=0,n={error:!1,address:``,zone:``},r=[],a=[],c=!1,l=!1,u=s;for(let i=0;i<e.length;i++){let s=e[i];if(!(s===`[`||s===`]`))if(s===`:`){if(c===!0&&(l=!0),!u(a,r,n))break;if(++t>7){n.error=!0;break}i>0&&e[i-1]===`:`&&(c=!0),r.push(`:`);continue}else if(s===`%`){if(!u(a,r,n))break;u=o}else{a.push(s);continue}}return a.length&&(u===o?n.zone=a.join(``):l?r.push(a.join(``)):r.push(i(a))),n.address=r.join(``),n}function l(e){if(u(e,`:`)<2)return{host:e,isIPV6:!1};let t=c(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,n=t.address;return t.zone&&(e+=`%`+t.zone,n+=`%25`+t.zone),{host:e,isIPV6:!0,escapedHost:n}}}function u(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function d(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}else{n.push(t);break}}else if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}else if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}function f(e,t){let n=t===!0?unescape:escape;return e.scheme!==void 0&&(e.scheme=n(e.scheme)),e.userinfo!==void 0&&(e.userinfo=n(e.userinfo)),e.host!==void 0&&(e.host=n(e.host)),e.path!==void 0&&(e.path=n(e.path)),e.query!==void 0&&(e.query=n(e.query)),e.fragment!==void 0&&(e.fragment=n(e.fragment)),e}function p(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push(`@`)),e.host!==void 0){let n=unescape(e.host);if(!r(n)){let t=l(n);n=t.isIPV6===!0?`[${t.escapedHost}]`:e.host}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:a,recomposeAuthority:p,normalizeComponentEncoding:f,removeDotSegments:d,isIPv4:r,isUUID:n,normalizeIPv6:l,stringArrayToHexStripped:i}})),QP=t(((e,t)=>{let{isUUID:n}=ZP(),r=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let[t,n]=e.resourceName.split(`?`);e.path=t&&t!==`/`?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=ne(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=ne(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}let h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},ee={scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},v={scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},te={scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0},y={http:h,https:g,ws:_,wss:ee,urn:v,"urn:uuid":te};Object.setPrototypeOf(y,null);function ne(e){return e&&(y[e]||y[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:y,isValidSchemeName:a,getSchemeHandler:ne}})),$P=t(((e,t)=>{let{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizeComponentEncoding:a,isIPv4:o,nonSimpleDomain:s}=ZP(),{SCHEMES:c,getSchemeHandler:l}=QP();function u(e,t){return typeof e==`string`?e=m(g(e,t),t):typeof e==`object`&&(e=g(m(e,t),t)),e}function d(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},i=f(g(e,r),g(t,r),r,!0);return r.skipEscape=!0,m(i,r)}function f(e,t,n,i){let a={};return i||(e=g(m(e,n),n),t=g(m(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path=`/`+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:a.path=t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,t.query===void 0?a.query=e.query:a.query=t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function p(e,t,n){return typeof e==`string`?(e=unescape(e),e=m(a(g(e,n),!0),{...n,skipEscape:!0})):typeof e==`object`&&(e=m(a(e,!0),{...n,skipEscape:!0})),typeof t==`string`?(t=unescape(t),t=m(a(g(t,n),!0),{...n,skipEscape:!0})):typeof t==`object`&&(t=m(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function m(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},a=Object.assign({},t),o=[],s=l(a.scheme||n.scheme);s&&s.serialize&&s.serialize(n,a),n.path!==void 0&&(a.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),a.reference!==`suffix`&&n.scheme&&o.push(n.scheme,`:`);let c=i(n);if(c!==void 0&&(a.reference!==`suffix`&&o.push(`//`),o.push(c),n.path&&n.path[0]!==`/`&&o.push(`/`)),n.path!==void 0){let e=n.path;!a.absolutePath&&(!s||!s.absolutePath)&&(e=r(e)),c===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),o.push(e)}return n.query!==void 0&&o.push(`?`,n.query),n.fragment!==void 0&&o.push(`#`,n.fragment),o.join(``)}let h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let c=e.match(h);if(c){if(i.scheme=c[1],i.userinfo=c[3],i.host=c[4],i.port=parseInt(c[5],10),i.path=c[6]||``,i.query=c[7],i.fragment=c[8],isNaN(i.port)&&(i.port=c[5]),i.host)if(o(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference=`same-document`:i.scheme===void 0?i.reference=`relative`:i.fragment===void 0?i.reference=`absolute`:i.reference=`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let t=l(r.scheme||i.scheme);if(!r.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(r.domainHost||t&&t.domainHost)&&a===!1&&s(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||`Host's domain name can not be converted to ASCII: `+e}(!t||t&&!t.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=unescape(i.host))),i.path&&=escape(unescape(i.path)),i.fragment&&=encodeURI(decodeURIComponent(i.fragment))),t&&t.parse&&t.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return i}let _={SCHEMES:c,normalize:u,resolve:d,resolveComponent:f,equal:p,serialize:m,parse:g};t.exports=_,t.exports.default=_,t.exports.fastUri=_})),eF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=$P();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),tF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=KP();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Q();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return n.CodeGen}});let r=qP(),i=JP(),a=IP(),o=YP(),s=Q(),c=GP(),l=RP(),u=$(),d=XP(),f=eF(),p=(e,t)=>new RegExp(e,t);p.code=`new RegExp`;let m=[`removeAdditional`,`useDefaults`,`coerceTypes`],h=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),g={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},_={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`};function ee(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??p,a=e.uriResolver??f.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??200,loopEnum:e.loopEnum??200,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var v=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...ee(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:h,es5:t,lines:n}),this.logger=ae(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),te.call(this,g,e,`NOT SUPPORTED`),te.call(this,_,e,`DEPRECATED`,`warn`),this._metaOpts=x.call(this),e.formats&&re.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&b.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),ne.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=d;n===`id`&&(r={...d},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await a.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function a(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await a.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=y.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new o.SchemaEnv({schema:{},schemaId:n});if(t=o.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=y.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,c.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(se.call(this,n,t),!t)return(0,u.eachItem)(n,e=>ce.call(this,e)),this;ue.call(this,t);let r={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(n,r.type.length===0?e=>ce.call(this,e,r):e=>r.type.forEach(t=>ce.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=fe(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e==`object`)a=e[s];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let l=this._cache.get(e);if(l!==void 0)return l;n=(0,c.normalizeId)(a||n);let u=c.getSchemaRefs.call(this,e,n);return l=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(l.schema,l),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=l),r&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};v.ValidationError=r.default,v.MissingRefError=i.default,e.default=v;function te(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function y(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function ne(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function re(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function b(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function x(){let e={...this.opts};for(let t of m)delete e[t];return e}let ie={log(){},warn(){},error(){}};function ae(e){if(e===!1)return ie;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}let oe=/^[a-z_$][a-z0-9_$:-]*$/i;function se(e,t){let{RULES:n}=this;if((0,u.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!oe.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function ce(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?le.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function le(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function ue(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=fe(t)),e.validateSchema=this.compile(t,!0))}let de={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function fe(e){return{anyOf:[e,de]}}})),nF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),rF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callRef=e.getValidate=void 0;let t=JP(),n=BP(),r=Q(),i=NP(),a=YP(),o=$(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);if(h instanceof a.SchemaEnv)return _(h);return ee(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function ee(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0)if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}if(l.items!==!0)if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}e.callRef=l,e.default=s})),iF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=nF(),n=rF();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),aF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),oF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),sF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),cF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=sF();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),lF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=BP(),n=$(),r=Q();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),uF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),dF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=BP(),n=Q(),r=$();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),fF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),pF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=UP();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),mF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=RP(),n=Q(),r=$(),i=pF();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),hF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=pF();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),gF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=pF();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),_F=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=aF(),n=oF(),r=cF(),i=lF(),a=uF(),o=dF(),s=fF(),c=mF(),l=hF(),u=gF();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),vF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateAdditionalItems=void 0;let t=Q(),n=$(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),yF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateTuple=void 0;let t=Q(),n=$(),r=BP(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),bF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=yF();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),xF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=BP(),i=vF();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),SF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),CF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=Q(),n=$(),r=BP();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
185
+ || ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;let g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=ee(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function ee(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),TN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.assignDefaults=void 0;let t=Q(),n=$();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),EN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=Q(),n=$(),r=yN(),i=$();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;let h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function ee(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=ee})),DN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=Q(),n=yN(),r=EN(),i=bN();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)te(),i.modifying&&s(e),y(()=>e.error());else{let t=i.async?ee():v();i.modifying&&s(e),y(()=>c(e,t))}}function ee(){let e=a.let(`ruleErrs`,null);return a.try(()=>te((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function v(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),te(t.nil),e}function te(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function y(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),ON=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=Q(),n=$();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),kN=t(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),AN=t(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else (p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),jN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=$(),n=kN(),r=AN(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;let o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;let d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;let m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),MN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=xN(),n=wN(),r=CN(),i=wN(),a=TN(),o=DN(),s=ON(),c=Q(),l=yN(),u=jN(),d=$(),f=bN();function p(e){if(ne(e)&&(b(e),y(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${v(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(v(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&ce(e),ae(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&ee(e),x(e),le(e)})}function ee(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function v(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function te(e,n){if(ne(e)&&(b(e),y(e))){re(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function y({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function ne(e){return typeof e.schema!=`boolean`}function re(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&ce(e),oe(e),se(e);let a=r.const(`_errs`,l.default.errors);x(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function b(e){(0,d.checkUnknownRules)(e),ie(e)}function x(e,t){if(e.opts.jtd)return de(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);de(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function ie(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function ae(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function oe(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function se(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function ce({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function le(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&ue(e),t.return((0,c._)`${l.default.errors} === 0`))}function ue({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function de(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>Se(e,`$ref`,h.all.$ref.definition));return}p.jtd||pe(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),fe(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):fe(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function fe(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&Se(e,n.keyword,n.definition,t.type)})}function pe(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(me(e,t),e.opts.allowUnionTypes||he(e,t),ge(e,e.dataTypes))}function me(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{ve(e.dataTypes,t)||be(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),ye(e,t)}}function he(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&be(e,`use allowUnionTypes to allow union type keyword`)}function ge(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>_e(t,e))&&be(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function _e(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function ve(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function ye(e,t){let n=[];for(let r of e.dataTypes)ve(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function be(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var xe=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,Te(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return te(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=xe;function Se(e,t,n,r){let i=new xe(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}let Ce=/^\/(?:[^~]|~0|~1)*$/,we=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Te(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!Ce.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=we.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=Te})),NN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),PN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=jN();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),FN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=Q(),n=NN(),r=yN(),i=jN(),a=$(),o=MN();var s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;let h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),IN=t(((e,t)=>{t.exports={$id:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,description:`Meta-schema for $data reference (JSON AnySchema extension proposal)`,type:`object`,required:[`$data`],properties:{$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},additionalProperties:!1}})),LN=t(((e,t)=>{let n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}let a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o(e){return e.length=0,!0}function s(e,t,n){if(e.length){let r=i(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function c(e){let t=0,n={error:!1,address:``,zone:``},r=[],a=[],c=!1,l=!1,u=s;for(let i=0;i<e.length;i++){let s=e[i];if(!(s===`[`||s===`]`))if(s===`:`){if(c===!0&&(l=!0),!u(a,r,n))break;if(++t>7){n.error=!0;break}i>0&&e[i-1]===`:`&&(c=!0),r.push(`:`);continue}else if(s===`%`){if(!u(a,r,n))break;u=o}else{a.push(s);continue}}return a.length&&(u===o?n.zone=a.join(``):l?r.push(a.join(``)):r.push(i(a))),n.address=r.join(``),n}function l(e){if(u(e,`:`)<2)return{host:e,isIPV6:!1};let t=c(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,n=t.address;return t.zone&&(e+=`%`+t.zone,n+=`%25`+t.zone),{host:e,isIPV6:!0,escapedHost:n}}}function u(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function d(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}else{n.push(t);break}}else if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}else if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}function f(e,t){let n=t===!0?unescape:escape;return e.scheme!==void 0&&(e.scheme=n(e.scheme)),e.userinfo!==void 0&&(e.userinfo=n(e.userinfo)),e.host!==void 0&&(e.host=n(e.host)),e.path!==void 0&&(e.path=n(e.path)),e.query!==void 0&&(e.query=n(e.query)),e.fragment!==void 0&&(e.fragment=n(e.fragment)),e}function p(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push(`@`)),e.host!==void 0){let n=unescape(e.host);if(!r(n)){let t=l(n);n=t.isIPV6===!0?`[${t.escapedHost}]`:e.host}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:a,recomposeAuthority:p,normalizeComponentEncoding:f,removeDotSegments:d,isIPv4:r,isUUID:n,normalizeIPv6:l,stringArrayToHexStripped:i}})),RN=t(((e,t)=>{let{isUUID:n}=LN(),r=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let[t,n]=e.resourceName.split(`?`);e.path=t&&t!==`/`?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=ne(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=ne(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}let h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},ee={scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},v={scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},te={scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0},y={http:h,https:g,ws:_,wss:ee,urn:v,"urn:uuid":te};Object.setPrototypeOf(y,null);function ne(e){return e&&(y[e]||y[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:y,isValidSchemeName:a,getSchemeHandler:ne}})),zN=t(((e,t)=>{let{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizeComponentEncoding:a,isIPv4:o,nonSimpleDomain:s}=LN(),{SCHEMES:c,getSchemeHandler:l}=RN();function u(e,t){return typeof e==`string`?e=m(g(e,t),t):typeof e==`object`&&(e=g(m(e,t),t)),e}function d(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},i=f(g(e,r),g(t,r),r,!0);return r.skipEscape=!0,m(i,r)}function f(e,t,n,i){let a={};return i||(e=g(m(e,n),n),t=g(m(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path=`/`+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:a.path=t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,t.query===void 0?a.query=e.query:a.query=t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function p(e,t,n){return typeof e==`string`?(e=unescape(e),e=m(a(g(e,n),!0),{...n,skipEscape:!0})):typeof e==`object`&&(e=m(a(e,!0),{...n,skipEscape:!0})),typeof t==`string`?(t=unescape(t),t=m(a(g(t,n),!0),{...n,skipEscape:!0})):typeof t==`object`&&(t=m(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function m(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},a=Object.assign({},t),o=[],s=l(a.scheme||n.scheme);s&&s.serialize&&s.serialize(n,a),n.path!==void 0&&(a.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),a.reference!==`suffix`&&n.scheme&&o.push(n.scheme,`:`);let c=i(n);if(c!==void 0&&(a.reference!==`suffix`&&o.push(`//`),o.push(c),n.path&&n.path[0]!==`/`&&o.push(`/`)),n.path!==void 0){let e=n.path;!a.absolutePath&&(!s||!s.absolutePath)&&(e=r(e)),c===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),o.push(e)}return n.query!==void 0&&o.push(`?`,n.query),n.fragment!==void 0&&o.push(`#`,n.fragment),o.join(``)}let h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let c=e.match(h);if(c){if(i.scheme=c[1],i.userinfo=c[3],i.host=c[4],i.port=parseInt(c[5],10),i.path=c[6]||``,i.query=c[7],i.fragment=c[8],isNaN(i.port)&&(i.port=c[5]),i.host)if(o(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference=`same-document`:i.scheme===void 0?i.reference=`relative`:i.fragment===void 0?i.reference=`absolute`:i.reference=`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let t=l(r.scheme||i.scheme);if(!r.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(r.domainHost||t&&t.domainHost)&&a===!1&&s(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||`Host's domain name can not be converted to ASCII: `+e}(!t||t&&!t.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=unescape(i.host))),i.path&&=escape(unescape(i.path)),i.fragment&&=encodeURI(decodeURIComponent(i.fragment))),t&&t.parse&&t.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return i}let _={SCHEMES:c,normalize:u,resolve:d,resolveComponent:f,equal:p,serialize:m,parse:g};t.exports=_,t.exports.default=_,t.exports.fastUri=_})),BN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=zN();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),VN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=MN();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return t.KeywordCxt}});var n=Q();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return n.CodeGen}});let r=NN(),i=PN(),a=SN(),o=FN(),s=Q(),c=jN(),l=wN(),u=$(),d=IN(),f=BN(),p=(e,t)=>new RegExp(e,t);p.code=`new RegExp`;let m=[`removeAdditional`,`useDefaults`,`coerceTypes`],h=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),g={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},_={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`};function ee(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??p,a=e.uriResolver??f.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??200,loopEnum:e.loopEnum??200,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var v=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...ee(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:h,es5:t,lines:n}),this.logger=ae(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),te.call(this,g,e,`NOT SUPPORTED`),te.call(this,_,e,`DEPRECATED`,`warn`),this._metaOpts=x.call(this),e.formats&&re.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&b.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),ne.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=d;n===`id`&&(r={...d},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await a.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function a(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await a.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=y.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new o.SchemaEnv({schema:{},schemaId:n});if(t=o.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=y.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,c.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(se.call(this,n,t),!t)return(0,u.eachItem)(n,e=>ce.call(this,e)),this;ue.call(this,t);let r={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(n,r.type.length===0?e=>ce.call(this,e,r):e=>r.type.forEach(t=>ce.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=fe(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e==`object`)a=e[s];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let l=this._cache.get(e);if(l!==void 0)return l;n=(0,c.normalizeId)(a||n);let u=c.getSchemaRefs.call(this,e,n);return l=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(l.schema,l),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=l),r&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};v.ValidationError=r.default,v.MissingRefError=i.default,e.default=v;function te(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function y(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function ne(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function re(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function b(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function x(){let e={...this.opts};for(let t of m)delete e[t];return e}let ie={log(){},warn(){},error(){}};function ae(e){if(e===!1)return ie;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}let oe=/^[a-z_$][a-z0-9_$:-]*$/i;function se(e,t){let{RULES:n}=this;if((0,u.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!oe.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function ce(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?le.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function le(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function ue(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=fe(t)),e.validateSchema=this.compile(t,!0))}let de={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function fe(e){return{anyOf:[e,de]}}})),HN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),UN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callRef=e.getValidate=void 0;let t=PN(),n=EN(),r=Q(),i=yN(),a=FN(),o=$(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);if(h instanceof a.SchemaEnv)return _(h);return ee(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function ee(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0)if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}if(l.items!==!0)if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}e.callRef=l,e.default=s})),WN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=HN(),n=UN();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),GN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),KN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),qN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),JN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=qN();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),YN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=EN(),n=$(),r=Q();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),XN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),ZN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=EN(),n=Q(),r=$();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),QN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),$N=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=kN();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),eP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=wN(),n=Q(),r=$(),i=$N();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),tP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=$N();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),nP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=$N();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),rP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=GN(),n=KN(),r=JN(),i=YN(),a=XN(),o=ZN(),s=QN(),c=eP(),l=tP(),u=nP();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),iP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateAdditionalItems=void 0;let t=Q(),n=$(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),aP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateTuple=void 0;let t=Q(),n=$(),r=EN(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),oP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=aP();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),sP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=EN(),i=iP();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),cP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),lP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=Q(),n=$(),r=EN();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
185
186
  missingProperty: ${i},
186
187
  depsCount: ${n},
187
- deps: ${r}}`};let i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),wF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),TF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=BP(),n=Q(),r=NP(),i=$();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?ee(e):a.if(g(e),()=>ee(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function ee(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(v(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(v(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function v(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),EF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=KP(),n=BP(),r=$(),i=TF();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),DF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=BP(),n=Q(),r=$(),i=$();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?ee(e):(a.var(m,!0),ee(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function ee(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),OF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=$();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),kF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:BP().validateUnion,error:{message:`must match a schema in anyOf`}}})),AF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),jF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=$();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),MF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),NF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=$();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),PF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=vF(),n=bF(),r=yF(),i=xF(),a=SF(),o=CF(),s=wF(),c=TF(),l=EF(),u=DF(),d=OF(),f=kF(),p=AF(),m=jF(),h=MF(),g=NF();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),FF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),IF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[FF().default]})),LF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),RF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=iF(),n=_F(),r=PF(),i=IF(),a=LF();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),zF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),BF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=zF(),r=YP(),i=JP(),a=$();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),VF=t(((e,t)=>{t.exports={$schema:`http://json-schema.org/draft-07/schema#`,$id:`http://json-schema.org/draft-07/schema#`,title:`Core schema meta-schema`,definitions:{schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},default:!0}})),HF=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let n=tF(),r=RF(),i=BF(),a=VF(),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`;var c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=c;var l=KP();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return l.KeywordCxt}});var u=Q();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return u.CodeGen}});var d=qP();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return d.default}});var f=JP();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return f.default}})})),UF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:ie,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:v,int32:{type:`number`,validate:ne},int64:{type:`number`,validate:re},float:{type:`number`,validate:b},double:{type:`number`,validate:b},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}let d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}let h=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(e){return h.test(e)&&g.test(e)}let ee=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(e){return ee.lastIndex=0,ee.test(e)}let te=-(2**31),y=2**31-1;function ne(e){return Number.isInteger(e)&&e<=y&&e>=te}function re(e){return Number.isInteger(e)}function b(){return!0}let x=/[^\\]\\Z/;function ie(e){if(x.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),WF=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatLimitDefinition=void 0;let t=HF(),n=Q(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),GF=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});let n=UF(),r=WF(),i=Q(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=s})),KF=e(HF(),1),qF=e(GF(),1);function JF(){let e=new KF.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,qF.default)(e),e}var YF=class{constructor(e){this._ajv=e??JF()}getValidator(e){let t=`$id`in e&&typeof e.$id==`string`?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}},XF=class{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return this.requestStream({method:`sampling/createMessage`,params:e},WM,t)}elicitInputStream(e,t){let n=this._server.getClientCapabilities(),r=e.mode??`form`;switch(r){case`url`:if(!n?.elicitation?.url)throw Error(`Client does not support url elicitation.`);break;case`form`:if(!n?.elicitation?.form)throw Error(`Client does not support form elicitation.`);break}let i=r===`form`&&e.mode===void 0?{...e,mode:`form`}:e;return this.requestStream({method:`elicitation/create`,params:i},uN,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}};function ZF(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case`tools/call`:if(!e.tools?.call)throw Error(`${n} does not support task creation for tools/call (required for ${t})`);break;default:break}}function QF(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case`sampling/createMessage`:if(!e.sampling?.createMessage)throw Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case`elicitation/create`:if(!e.elicitation?.create)throw Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var $F=class extends OP{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(AM.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new YF,this.setRequestHandler(pj,e=>this._oninitialize(e)),this.setNotificationHandler(gj,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(MM,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=AM.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||={tasks:new XF(this)},this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=AP(this._capabilities,e)}setRequestHandler(e,t){let n=SA(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let r;if(vA(n)){let e=n;r=e._zod?.def?.value??e.value}else{let e=n;r=e._def?.value??e.value}if(typeof r!=`string`)throw Error(`Schema method literal must be a string`);return r===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let r=bA(OM,e);if(!r.success){let e=r.error instanceof Error?r.error.message:String(r.error);throw new Y(J.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:i}=r.data,a=await Promise.resolve(t(e,n));if(i.task){let e=bA(Ej,a);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new Y(J.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let o=bA(EM,a);if(!o.success){let e=o.error instanceof Error?o.error.message:String(o.error);throw new Y(J.InvalidParams,`Invalid tools/call result: ${e}`)}return o.data}):super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`completion/complete`:if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case`ping`:case`initialize`:break}}assertTaskCapability(e){QF(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&ZF(this._capabilities.tasks?.requests,e,`Server`)}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:kA.includes(t)?t:OA,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:`ping`},ej)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return e.tools?this.request({method:`sampling/createMessage`,params:e},GM,t):this.request({method:`sampling/createMessage`,params:e},WM,t)}async elicitInput(e,t){switch(e.mode??`form`){case`url`:{if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support url elicitation.`);let n=e;return this.request({method:`elicitation/create`,params:n},uN,t)}case`form`:{if(!this._clientCapabilities?.elicitation?.form)throw Error(`Client does not support form elicitation.`);let n=e.mode===`form`?e:{...e,mode:`form`},r=await this.request({method:`elicitation/create`,params:n},uN,t);if(r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new Y(J.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof Y?e:new Y(J.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return r}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:`roots/list`,params:e},bN,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}};const eI=Symbol.for(`mcp.completable`);function tI(e){return!!e&&typeof e==`object`&&eI in e}function nI(e){return e[eI]?.complete}var rI;(function(e){e.Completable=`McpCompletable`})(rI||={});const iI=/^[A-Za-z0-9._-]{1,128}$/;function aI(e){let t=[];if(e.length===0)return{isValid:!1,warnings:[`Tool name cannot be empty`]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(` `)&&t.push(`Tool name contains spaces, which may cause parsing issues`),e.includes(`,`)&&t.push(`Tool name contains commas, which may cause parsing issues`),(e.startsWith(`-`)||e.endsWith(`-`))&&t.push(`Tool name starts or ends with a dash, which may cause parsing issues in some contexts`),(e.startsWith(`.`)||e.endsWith(`.`))&&t.push(`Tool name starts or ends with a dot, which may cause parsing issues in some contexts`),!iI.test(e)){let n=e.split(``).filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,n)=>n.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${n.map(e=>`"${e}"`).join(`, `)}`,`Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)`),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function oI(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let e of t)console.warn(` - ${e}`);console.warn(`Tool registration will proceed, but this may cause compatibility issues.`),console.warn(`Consider updating the tool name to conform to the MCP tool naming standard.`),console.warn(`See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.`)}}function sI(e){let t=aI(e);return oI(e,t.warnings),t.isValid}var cI=class{constructor(e){this._mcpServer=e}registerToolTask(e,t,n){let r={taskSupport:`required`,...t.execution};if(r.taskSupport===`forbidden`)throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,r,t._meta,n)}},lI=class{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new $F(e,t)}get experimental(){return this._experimental||={tasks:new cI(this)},this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||=(this.server.assertCanSetRequestHandler(gI(wM)),this.server.assertCanSetRequestHandler(gI(OM)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(wM,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:(()=>{let e=CA(t.inputSchema);return e?TP(e,{strictUnions:!0,pipeStrategy:`input`}):uI})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let e=CA(t.outputSchema);e&&(n.outputSchema=TP(e,{strictUnions:!0,pipeStrategy:`output`}))}return n})})),this.server.setRequestHandler(OM,async(e,t)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new Y(J.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new Y(J.InvalidParams,`Tool ${e.params.name} disabled`);let r=!!e.params.task,i=n.execution?.taskSupport,a=`createTask`in n.handler;if((i===`required`||i===`optional`)&&!a)throw new Y(J.InternalError,`Tool ${e.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if(i===`required`&&!r)throw new Y(J.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(i===`optional`&&!r&&a)return await this.handleAutomaticTaskPolling(n,e,t);let o=await this.validateToolInput(n,e.params.arguments,e.params.name),s=await this.executeToolHandler(n,o,t);return r||await this.validateToolOutput(n,s,e.params.name),s}catch(e){if(e instanceof Y&&e.code===J.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),!0)}createToolError(e){return{content:[{type:`text`,text:e}],isError:!0}}async validateToolInput(e,t,n){if(!e.inputSchema)return;let r=await xA(CA(e.inputSchema)??e.inputSchema,t);if(!r.success){let e=wA(`error`in r?r.error:`Unknown error`);throw new Y(J.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${e}`)}return r.data}async validateToolOutput(e,t,n){if(!e.outputSchema||!(`content`in t)||t.isError)return;if(!t.structuredContent)throw new Y(J.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let r=await xA(CA(e.outputSchema),t.structuredContent);if(!r.success){let e=wA(`error`in r?r.error:`Unknown error`);throw new Y(J.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${e}`)}}async executeToolHandler(e,t,n){let r=e.handler;if(`createTask`in r){if(!n.taskStore)throw Error(`No task store provided.`);let i={...n,taskStore:n.taskStore};if(e.inputSchema){let e=r;return await Promise.resolve(e.createTask(t,i))}else{let e=r;return await Promise.resolve(e.createTask(i))}}if(e.inputSchema){let e=r;return await Promise.resolve(e(t,n))}else{let e=r;return await Promise.resolve(e(n))}}async handleAutomaticTaskPolling(e,t,n){if(!n.taskStore)throw Error(`No task store provided for task-capable tool.`);let r=await this.validateToolInput(e,t.params.arguments,t.params.name),i=e.handler,a={...n,taskStore:n.taskStore},o=r?await Promise.resolve(i.createTask(r,a)):await Promise.resolve(i.createTask(a)),s=o.task.taskId,c=o.task,l=c.pollInterval??5e3;for(;c.status!==`completed`&&c.status!==`failed`&&c.status!==`cancelled`;){await new Promise(e=>setTimeout(e,l));let e=await n.taskStore.getTask(s);if(!e)throw new Y(J.InternalError,`Task ${s} not found during polling`);c=e}return await n.taskStore.getTaskResult(s)}setCompletionRequestHandler(){this._completionHandlerInitialized||=(this.server.assertCanSetRequestHandler(gI(mN)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(mN,async e=>{switch(e.params.ref.type){case`ref/prompt`:return hN(e),this.handlePromptCompletion(e,e.params.ref);case`ref/resource`:return gN(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Y(J.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),!0)}async handlePromptCompletion(e,t){let n=this._registeredPrompts[t.name];if(!n)throw new Y(J.InvalidParams,`Prompt ${t.name} not found`);if(!n.enabled)throw new Y(J.InvalidParams,`Prompt ${t.name} disabled`);if(!n.argsSchema)return vI;let r=SA(n.argsSchema)?.[e.params.argument.name];if(!tI(r))return vI;let i=nI(r);return i?_I(await i(e.params.argument.value,e.params.context)):vI}async handleResourceCompletion(e,t){let n=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!n){if(this._registeredResources[t.uri])return vI;throw new Y(J.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let r=n.resourceTemplate.completeCallback(e.params.argument.name);return r?_I(await r(e.params.argument.value,e.params.context)):vI}setResourceRequestHandlers(){this._resourceHandlersInitialized||=(this.server.assertCanSetRequestHandler(gI(Wj)),this.server.assertCanSetRequestHandler(gI(Kj)),this.server.assertCanSetRequestHandler(gI(Xj)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Wj,async(e,t)=>{let n=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),r=[];for(let e of Object.values(this._registeredResourceTemplates)){if(!e.resourceTemplate.listCallback)continue;let n=await e.resourceTemplate.listCallback(t);for(let t of n.resources)r.push({...e.metadata,...t})}return{resources:[...n,...r]}}),this.server.setRequestHandler(Kj,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(Xj,async(e,t)=>{let n=new URL(e.params.uri),r=this._registeredResources[n.toString()];if(r){if(!r.enabled)throw new Y(J.InvalidParams,`Resource ${n} disabled`);return r.readCallback(n,t)}for(let e of Object.values(this._registeredResourceTemplates)){let r=e.resourceTemplate.uriTemplate.match(n.toString());if(r)return e.readCallback(n,r,t)}throw new Y(J.InvalidParams,`Resource ${n} not found`)}),!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||=(this.server.assertCanSetRequestHandler(gI(sM)),this.server.assertCanSetRequestHandler(gI(uM)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(sM,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?hI(t.argsSchema):void 0}))})),this.server.setRequestHandler(uM,async(e,t)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new Y(J.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new Y(J.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let r=await xA(CA(n.argsSchema),e.params.arguments);if(!r.success){let t=wA(`error`in r?r.error:`Unknown error`);throw new Y(J.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${t}`)}let i=r.data,a=n.callback;return await Promise.resolve(a(i,t))}else{let e=n.callback;return await Promise.resolve(e(t))}}),!0)}resource(e,t,...n){let r;typeof n[0]==`object`&&(r=n.shift());let i=n[0];if(typeof t==`string`){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,void 0,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,void 0,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}registerResource(e,t,n,r){if(typeof t==`string`){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,n.title,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,n.title,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(e,t,n,r,i){let a={name:e,title:t,metadata:r,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({uri:null}),update:e=>{e.uri!==void 0&&e.uri!==n&&(delete this._registeredResources[n],e.uri&&(this._registeredResources[e.uri]=a)),e.name!==void 0&&(a.name=e.name),e.title!==void 0&&(a.title=e.title),e.metadata!==void 0&&(a.metadata=e.metadata),e.callback!==void 0&&(a.readCallback=e.callback),e.enabled!==void 0&&(a.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=a,a}_createRegisteredResourceTemplate(e,t,n,r,i){let a={resourceTemplate:n,title:t,metadata:r,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=a)),t.title!==void 0&&(a.title=t.title),t.template!==void 0&&(a.resourceTemplate=t.template),t.metadata!==void 0&&(a.metadata=t.metadata),t.callback!==void 0&&(a.readCallback=t.callback),t.enabled!==void 0&&(a.enabled=t.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=a;let o=n.uriTemplate.variableNames;return Array.isArray(o)&&o.some(e=>!!n.completeCallback(e))&&this.setCompletionRequestHandler(),a}_createRegisteredPrompt(e,t,n,i,a){let o={title:t,description:n,argsSchema:i===void 0?void 0:yA(i),callback:a,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=o)),t.title!==void 0&&(o.title=t.title),t.description!==void 0&&(o.description=t.description),t.argsSchema!==void 0&&(o.argsSchema=yA(t.argsSchema)),t.callback!==void 0&&(o.callback=t.callback),t.enabled!==void 0&&(o.enabled=t.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=o,i&&Object.values(i).some(e=>tI(e instanceof r?e._def?.innerType:e))&&this.setCompletionRequestHandler(),o}_createRegisteredTool(e,t,n,r,i,a,o,s,c){sI(e);let l={title:t,description:n,inputSchema:mI(r),outputSchema:mI(i),annotations:a,execution:o,_meta:s,handler:c,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(typeof t.name==`string`&&sI(t.name),delete this._registeredTools[e],t.name&&(this._registeredTools[t.name]=l)),t.title!==void 0&&(l.title=t.title),t.description!==void 0&&(l.description=t.description),t.paramsSchema!==void 0&&(l.inputSchema=yA(t.paramsSchema)),t.outputSchema!==void 0&&(l.outputSchema=yA(t.outputSchema)),t.callback!==void 0&&(l.handler=t.callback),t.annotations!==void 0&&(l.annotations=t.annotations),t._meta!==void 0&&(l._meta=t._meta),t.enabled!==void 0&&(l.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let n,r,i;if(typeof t[0]==`string`&&(n=t.shift()),t.length>1){let e=t[0];pI(e)?(r=t.shift(),t.length>1&&typeof t[0]==`object`&&t[0]!==null&&!pI(t[0])&&(i=t.shift())):typeof e==`object`&&e&&(i=t.shift())}let a=t[0];return this._createRegisteredTool(e,void 0,n,r,void 0,i,{taskSupport:`forbidden`},void 0,a)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:r,description:i,inputSchema:a,outputSchema:o,annotations:s,_meta:c}=t;return this._createRegisteredTool(e,r,i,a,o,s,{taskSupport:`forbidden`},c,n)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let n;typeof t[0]==`string`&&(n=t.shift());let r;t.length>1&&(r=t.shift());let i=t[0],a=this._createRegisteredPrompt(e,void 0,n,r,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}registerPrompt(e,t,n){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:r,description:i,argsSchema:a}=t,o=this._createRegisteredPrompt(e,r,i,a,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};const uI={type:`object`,properties:{}};function dI(e){return typeof e==`object`&&!!e&&`parse`in e&&typeof e.parse==`function`&&`safeParse`in e&&typeof e.safeParse==`function`}function fI(e){return`_def`in e||`_zod`in e||dI(e)}function pI(e){return typeof e!=`object`||!e||fI(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(dI)}function mI(e){if(e)return pI(e)?yA(e):e}function hI(e){let t=SA(e);return t?Object.entries(t).map(([e,t])=>({name:e,description:TA(t),required:!EA(t)})):[]}function gI(e){let t=SA(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=DA(t);if(typeof n==`string`)return n;throw Error(`Schema method literal must be a string`)}function _I(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}const vI={completion:{values:[],hasMore:!1}};var yI=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
188
- `);if(e===-1)return null;let t=this._buffer.toString(`utf8`,0,e).replace(/\r$/,``);return this._buffer=this._buffer.subarray(e+1),bI(t)}clear(){this._buffer=void 0}};function bI(e){return $A.parse(JSON.parse(e))}function xI(e){return JSON.stringify(e)+`
189
- `}var SI=class{constructor(e=h.stdin,t=h.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new yI,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{this.onerror?.(e)}}async start(){if(this._started)throw Error(`StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.`);this._started=!0,this._stdin.on(`data`,this._ondata),this._stdin.on(`error`,this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off(`data`,this._ondata),this._stdin.off(`error`,this._onerror),this._stdin.listenerCount(`data`)===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let n=xI(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};const CI=`EXPECT_LIVE_VIEW_URL`;var wI=class extends q(`McpSessionNotOpenError`)({_tag:K(`McpSessionNotOpenError`)}){message=`No browser open. Call the 'open' tool first.`};const TI=e=>Oe(e)&&`status`in e&&`steps`in e&&Array.isArray(e.steps),EI={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`GET, POST, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type`},DI={"Cache-Control":`no-store`},OI=(e,t,n)=>yp(r=>{let i=e=>r(R(e));e.once(`error`,i),e.listen({host:t,port:n},()=>{e.off(`error`,i),r(I)})}),kI=e=>yp(t=>{e.close(()=>t(I))}),AI=H(`LiveViewServer.start`)(function*(e){let t=new URL(e.liveViewUrl),n=new Set,r=[],i,a=yield*ey(),o=hA({title:`Expect Live View`,eventsSource:`sse`}),s=(e,t)=>{let r=`event: ${e}\ndata: ${t}\n\n`;for(let e of n){if(e.destroyed){n.delete(e);continue}try{e.write(r)}catch{n.delete(e),e.end()}}},c=t=>{t.length!==0&&(r.push(...t),e.onEventsCollected(t),s(`replay`,JSON.stringify(t)))},l=e=>{i=e,s(`steps`,JSON.stringify(e))},u=(e,t)=>{t.writeHead(200,{"Content-Type":`text/event-stream`,Connection:`keep-alive`,...EI,...DI}),t.flushHeaders(),n.add(t),e.on(`close`,()=>n.delete(t))},d=(e,t)=>{let n=[];e.on(`data`,e=>n.push(e)),e.on(`end`,()=>{try{let e=Buffer.concat(n).toString(`utf-8`),r=JSON.parse(e);if(!TI(r)){t.writeHead(400,{"Content-Type":`text/plain`,...EI,...DI}),t.end(`Invalid step state: missing status or steps`);return}l(r),t.writeHead(204,{...EI,...DI}),t.end()}catch{t.writeHead(400,{"Content-Type":`text/plain`,...EI,...DI}),t.end(`Invalid JSON`)}})},f=_((e,n)=>{if(e.method===`OPTIONS`){n.writeHead(204,EI),n.end();return}let a=new URL(e.url??`/`,t).pathname;if(a===`/`){n.writeHead(200,{"Content-Type":`text/html; charset=utf-8`,...EI,...DI}),n.end(o);return}if(a===`/events`){u(e,n);return}if(a===`/latest.json`){let e=JSON.stringify(r);n.writeHead(200,{"Content-Type":`application/json`,"Content-Length":Buffer.byteLength(e),...EI,...DI}),n.end(e);return}if(a===`/steps`){if(e.method===`POST`){d(e,n);return}let t=JSON.stringify(i??{title:``,status:`running`,steps:[]});n.writeHead(200,{"Content-Type":`application/json`,"Content-Length":Buffer.byteLength(t),...EI,...DI}),n.end(t);return}n.writeHead(404,{"Content-Type":`text/plain; charset=utf-8`,...EI,...DI}),n.end(`Not found`)});yield*OI(f,t.hostname,Number(t.port));let p=yield*F(()=>e.getPage()).pipe(z(e=>!e||e.isClosed()?I:Gk(e,`startRecording`).pipe(V(()=>I),z(()=>Gk(e,`getEvents`)),Dp(e=>F(()=>{Array.isArray(e)&&e.length>0&&c(e)})),V(e=>Hm(`Replay event collection failed`,{cause:e}))))).pipe(vm(Zf(250)),wm),m=yield*jC(a).pipe(FC(e=>F(()=>l(e))),ew,wm);return{url:t.toString(),pushRunState:e=>{ry(a,e)},getLatestRunState:()=>i,close:L(function*(){yield*Nv(p),yield*Nv(m);for(let e of n)e.end();n.clear(),yield*kI(f)})}}),jI=`/tmp/expect-replays`,MI=(e,t)=>{t.trackedPages.has(e)||(t.trackedPages.add(e),e.on(`console`,e=>{t.consoleMessages.push({type:e.type(),text:e.text(),timestamp:Date.now()})}),e.on(`request`,e=>{t.networkRequests.push({url:e.url(),method:e.method(),status:void 0,resourceType:e.resourceType(),timestamp:Date.now()})}),e.on(`response`,e=>{let n=t.networkRequests.find(t=>t.url===e.url()&&t.status===void 0);n&&(n.status=e.status())}))};var NI=class extends A()(`@browser/McpSession`,{make:L(function*(){let e=yield*cA,t=yield*cw,r=yield*Kw(Qw(`EXPECT_REPLAY_OUTPUT_PATH`)),i=yield*Kw(Qw(CI)),a=yield*GT(void 0),o=yield*GT(void 0),s=yield*GT(void 0),c=yield*GT(void 0),l=yield*GT(void 0);yield*e.preExtractCookies().pipe(Dp(e=>qT(l,e)),Dp(e=>Vm(`Cookies pre-extracted`,{count:e.length})),V(()=>I),wm);let u=H(`McpSession.requireSession`)(function*(){return(yield*KT(a))||(yield*new wI)}),d=H(`McpSession.requirePage`)(function*(){return(yield*u()).page}),f=H(`McpSession.navigate`)(function*(e,t={}){let n=yield*u();yield*hp({try:()=>n.page.goto(e,{waitUntil:t.waitUntil??`load`}),catch:t=>new Ak({url:e,cause:t instanceof Error?t.message:String(t)})})}),p=H(`McpSession.pushStepEvent`)(function*(e){yield*qT(c,e);let t=yield*KT(o);t&&t.pushRunState(e)});return{open:H(`McpSession.open`)(function*(c,u={}){yield*bm({url:c});let d=u.cookies?yield*KT(l):void 0,f=d&&d.length>0?d:u.cookies,p=n.join(jI,`playwright`);yield*t.makeDirectory(p,{recursive:!0}).pipe(V(e=>Hm(`Failed to create Playwright video directory`,{cause:e})));let m=yield*e.createPage(c,{headed:u.headed,cookies:f,waitUntil:u.waitUntil,videoOutputDir:p}),h={browser:m.browser,context:m.context,page:m.page,consoleMessages:[],networkRequests:[],replayOutputPath:xr(r),accumulatedReplayEvents:[],trackedPages:new Set,lastSnapshot:void 0};MI(m.page,h),yield*qT(a,h),yield*Gk(m.page,`startRecording`).pipe(V(e=>Hm(`rrweb recording failed to start`,{cause:e})));let g=yield*KT(o);if(mr(i)&&!g){let e=yield*AI({liveViewUrl:i.value,getPage:()=>JT(a)?.page,onEventsCollected:e=>{JT(a)?.accumulatedReplayEvents.push(...e)}}).pipe(V(e=>Hm(`Live view server failed to start`,{cause:e}).pipe(kp(void 0))));e&&(yield*qT(o,e))}return(yield*KT(o))||(yield*qT(s,yield*F(()=>JT(a)?.page).pipe(z(e=>!e||e.isClosed()?I:Gk(e,`startRecording`).pipe(V(()=>I),z(()=>Gk(e,`getEvents`)),Dp(e=>F(()=>{Array.isArray(e)&&e.length>0&&JT(a)?.accumulatedReplayEvents.push(...e)})),V(e=>Hm(`Replay event collection failed`,{cause:e}))))).pipe(vm(Zf(250)),wm))),{injectedCookieCount:yield*hp(()=>m.context.cookies()).pipe(B(e=>e.length),V(e=>Hm(`Failed to count cookies`,{cause:e}).pipe(kp(0))))}}),navigate:f,hasSession:()=>!!JT(a),requirePage:d,requireSession:u,snapshot:H(`McpSession.snapshot`)(function*(t,n){return yield*e.snapshot(t,n)}),annotatedScreenshot:H(`McpSession.annotatedScreenshot`)(function*(t,n){return yield*e.annotatedScreenshot(t,n)}),updateLastSnapshot:H(`McpSession.updateLastSnapshot`)(function*(e){let t=yield*u();t.lastSnapshot=e}),pushStepEvent:p,close:H(`McpSession.close`)(function*(){let e=yield*KT(a);if(!e)return;yield*qT(a,void 0);let r=yield*KT(s);r&&(yield*Nv(r),yield*qT(s,void 0));let i=yield*KT(o);i&&(yield*i.close.pipe(V(e=>Hm(`Failed to close live view`,{cause:e}))),yield*qT(o,void 0));let l,u,d,f,p,m,h=e.page.video(),g=e.replayOutputPath?n.basename(e.replayOutputPath,n.extname(e.replayOutputPath)):`session-${Date.now()}`;if(yield*L(function*(){if(!e.page.isClosed()){let t=yield*gA(e.page).pipe(V(e=>Hm(`Failed to collect final replay events`,{cause:e}).pipe(kp([]))));t.length>0&&e.accumulatedReplayEvents.push(...t)}let r=e.replayOutputPath;if(r&&e.accumulatedReplayEvents.length>0){let i=e.accumulatedReplayEvents.map(e=>JSON.stringify(e)).join(`
190
- `)+`
191
- `;yield*t.makeDirectory(n.dirname(r),{recursive:!0}).pipe(V(e=>Hm(`Failed to create replay output directory`,{cause:e}))),yield*t.writeFileString(r,i).pipe(V(e=>Hm(`Failed to write replay file`,{cause:e}))),l=r;let a=yield*KT(c),o=n.basename(r),s=n.basename(r,n.extname(r)),d=n.join(n.dirname(r),`${s}.html`),m=hA({title:a?`Test Report: ${a.title}`:`Expect Report`,eventsSource:{ndjsonPath:o},steps:a});yield*t.writeFileString(d,m).pipe(V(e=>Hm(`Failed to write HTML report`,{cause:e}))),u=d;let h=`${r}.js`,g=`window.__EXPECT_REPLAY_NDJSON__ = ${JSON.stringify(i)};\n`;yield*t.writeFileString(h,g).pipe(V(e=>Hm(`Failed to write ndjson.js wrapper`,{cause:e})));let _=n.join(jI,`${s}.ndjson`),ee=n.join(jI,`${s}.html`),v=`${_}.js`;yield*t.makeDirectory(jI,{recursive:!0}).pipe(V(e=>Hm(`Failed to create /tmp artifact directory`,{cause:e}))),yield*t.copyFile(r,_).pipe(Dp(()=>F(()=>{f=_})),V(e=>Hm(`Failed to copy replay to /tmp`,{cause:e}))),yield*t.copyFile(d,ee).pipe(Dp(()=>F(()=>{p=ee})),V(e=>Hm(`Failed to copy report to /tmp`,{cause:e}))),yield*t.copyFile(h,v).pipe(V(e=>Hm(`Failed to copy ndjson.js to /tmp`,{cause:e})))}}).pipe(V(e=>Hm(`Failed during close cleanup`,{cause:e}))),yield*hp(()=>e.browser.close()).pipe(V(e=>Hm(`Failed to close browser`,{cause:e}))),h&&(d=yield*hp(()=>h.path()).pipe(V(e=>Hm(`Failed to resolve Playwright video path`,{cause:e}).pipe(kp(void 0)))),d)){let e=n.join(jI,`${g}.webm`);yield*t.makeDirectory(jI,{recursive:!0}).pipe(V(e=>Hm(`Failed to create /tmp artifact directory`,{cause:e}))),yield*t.copyFile(d,e).pipe(Dp(()=>F(()=>{m=e})),V(e=>Hm(`Failed to copy Playwright video to /tmp`,{cause:e})))}return{replaySessionPath:l,reportPath:u,videoPath:d,tmpReplaySessionPath:f,tmpReportPath:p,tmpVideoPath:m}})}})}){static layer=Ld(this)(this.make).pipe(N(cA.layer))};const PI=Fd(dT,!0),FI=yT(NI.layer.pipe(N(PI),N(d.layer))),II=e=>({content:[{type:`text`,text:e}]}),LI=e=>{let t=new WeakSet;return JSON.stringify(e,(e,n)=>{if(typeof n==`object`&&n){if(t.has(n))return`[Circular]`;t.add(n)}return n},2)},RI=e=>II(LI(e)),zI=e=>({content:[{type:`image`,data:e,mimeType:`image/png`}]}),BI=Object.getPrototypeOf(async()=>{}).constructor,VI=e=>{let t=t=>e.runPromise(t),n=new lI({name:`expect`,version:`0.0.1`});return n.registerTool(`open`,{title:`Open URL`,description:`Navigate to a URL, launching a browser if needed.`,inputSchema:{url:a.string().describe(`URL to navigate to`),headed:a.boolean().optional().describe(`Show browser window`),cookies:a.boolean().optional().describe(`Reuse local browser cookies for the target URL when available`),waitUntil:a.enum([`load`,`domcontentloaded`,`networkidle`,`commit`]).optional().describe(`Wait strategy`)}},({url:e,headed:n,cookies:r,waitUntil:i})=>t(L(function*(){let t=yield*NI;if(t.hasSession())return yield*t.navigate(e,{waitUntil:i}),II(`Navigated to ${e}`);let a=yield*t.open(e,{headed:n,cookies:r,waitUntil:i});return II(`Opened ${e}`+(a.injectedCookieCount>0?` (${a.injectedCookieCount} cookies synced from local browser)`:``))}))),n.registerTool(`playwright`,{title:`Execute Playwright`,description:"Execute Playwright code in the Node.js context. Available globals: page (Page), context (BrowserContext), browser (Browser), ref (function: ref ID from snapshot Playwright Locator). Use `return` to send a value back as JSON. Supports await.",inputSchema:{code:a.string().describe(`Playwright code to execute`)}},({code:e})=>t(L(function*(){let t=yield*(yield*NI).requireSession(),n=e=>{if(!t.lastSnapshot)throw Error(`No snapshot taken yet. Call screenshot with mode 'snapshot' first.`);return Pm(t.lastSnapshot.locator(e))};return yield*mp(async()=>{try{let r=await new BI(`page`,`context`,`browser`,`ref`,e)(t.page,t.context,t.browser,n);return r===void 0?II(`OK`):RI(r)}catch(e){return II(`Error: ${e instanceof Error?e.message:String(e)}`)}})}))),n.registerTool(`screenshot`,{title:`Screenshot`,description:`Capture the current page state. Modes: 'screenshot' (default, PNG image), 'snapshot' (ARIA accessibility tree with element refs), 'annotated' (screenshot with numbered labels on interactive elements).`,annotations:{readOnlyHint:!0},inputSchema:{mode:a.enum([`screenshot`,`snapshot`,`annotated`]).optional().describe(`Capture mode (default: screenshot)`),fullPage:a.boolean().optional().describe(`Capture the full scrollable page`)}},({mode:e,fullPage:n})=>t(L(function*(){let t=yield*NI,r=yield*t.requirePage(),i=e??`screenshot`;if(i===`snapshot`){let e=yield*t.snapshot(r);return yield*t.updateLastSnapshot(e),RI({tree:e.tree,refs:e.refs,stats:e.stats})}if(i===`annotated`){let e=yield*t.annotatedScreenshot(r,{fullPage:n});return{content:[{type:`image`,data:e.screenshot.toString(`base64`),mimeType:`image/png`},{type:`text`,text:e.annotations.map(e=>`[${e.label}] @${e.ref} ${e.role} "${e.name}"`).join(`
192
- `)}]}}return zI((yield*hp(()=>r.screenshot({fullPage:n}))).toString(`base64`))}))),n.registerTool(`console_logs`,{title:`Console Logs`,description:`Get browser console log messages. Optionally filter by log type (log, warning, error, info, debug).`,annotations:{readOnlyHint:!0},inputSchema:{type:a.string().optional().describe(`Filter by console message type (e.g. 'error', 'warning', 'log')`),clear:a.boolean().optional().describe(`Clear the collected messages after reading`)}},({type:e,clear:n})=>t(L(function*(){let t=yield*(yield*NI).requireSession(),r=e?t.consoleMessages.filter(t=>t.type===e):t.consoleMessages;return n&&(t.consoleMessages.length=0),r.length===0?II(`No console messages captured.`):RI(r)}))),n.registerTool(`network_requests`,{title:`Network Requests`,description:`Get captured network requests. Optionally filter by HTTP method, URL substring, or resource type (document, script, stylesheet, image, xhr, fetch, etc.).`,annotations:{readOnlyHint:!0},inputSchema:{method:a.string().optional().describe(`Filter by HTTP method (e.g. 'GET', 'POST')`),url:a.string().optional().describe(`Filter by URL substring match`),resourceType:a.string().optional().describe(`Filter by resource type (e.g. 'xhr', 'fetch', 'document', 'script')`),clear:a.boolean().optional().describe(`Clear the collected requests after reading`)}},({method:e,url:n,resourceType:r,clear:i})=>t(L(function*(){let t=yield*(yield*NI).requireSession(),a=e?.toUpperCase(),o=r?.toLowerCase(),s=t.networkRequests.filter(e=>(!a||e.method===a)&&(!n||e.url.includes(n))&&(!o||e.resourceType===o));return i&&(t.networkRequests.length=0),s.length===0?II(`No network requests captured.`):RI(s)}))),n.registerTool(`performance_metrics`,{title:`Performance Metrics`,description:`Get Core Web Vitals performance metrics (FCP, LCP, CLS, INP) for the current page. Each metric includes a value (milliseconds for FCP/LCP/INP, unitless score for CLS) and a rating (good, needs-improvement, poor). Metrics are collected automatically from page load and user interactions.`,annotations:{readOnlyHint:!0},inputSchema:{}},()=>t(L(function*(){let e=yield*Gk(yield*(yield*NI).requirePage(),`getPerformanceMetrics`);return e.fcp||e.lcp||e.inp?RI(e):II(`No performance metrics available yet.`)}))),n.registerTool(`close`,{title:`Close Browser`,description:`Close the browser and end the session.`,annotations:{destructiveHint:!0},inputSchema:{}},()=>t(L(function*(){let e=yield*(yield*NI).close();if(!e)return II(`No browser open.`);let t=[`Browser closed.`];return e.tmpReplaySessionPath&&t.push(`rrweb replay: ${e.tmpReplaySessionPath}`),e.tmpReportPath&&t.push(`rrweb report: ${e.tmpReportPath}`),e.tmpVideoPath?t.push(`Playwright video: ${e.tmpVideoPath}`):e.videoPath&&t.push(`Playwright video: ${e.videoPath}`),II(t.join(`
193
- `))}))),n},HI=async e=>{let t=VI(e),n=new SI;await t.connect(n)};export{ZC as $,ua as $i,_m as $n,jf as $r,bb as $t,ow as A,Pe as Aa,Uu as Ai,lm as An,nm as Ar,xS as At,AC as B,ae as Ba,Bu as Bi,Mp as Bn,Wp as Br,oS as Bt,gT as C,wr as Ca,Xu as Ci,Ev as Cn,Am as Cr,Rx as Ct,dw as D,Xt as Da,Qu as Di,uh as Dn,am as Dr,Ux as Dt,pw as E,O as Ea,$u as Ei,wv as En,Fm as Er,nS as Et,OC as F,we as Fa,zu as Fi,Wm as Fn,F as Fr,dS as Ft,zC as G,ue as Ga,Ba as Gi,Gm as Gn,hm as Gr,SS as Gt,NC as H,b as Ha,co as Hi,jp as Hn,ym as Hr,jx as Ht,JC as I,Ce as Ia,Ru as Ii,kp as In,Dp as Ir,Xx as It,BC as J,wa as Ji,Tm as Jn,wp as Jr,K as Jt,IC as K,y as Ka,La as Ki,R as Kn,I as Kr,Ix as Kt,LC as L,Te as La,Lu as Li,Ap as Ln,Bp as Lr,rS as Lt,lw as M,Re as Ma,Ku as Mi,Ep as Mn,$p as Mr,G as Mt,DC as N,Me as Na,Wu as Ni,bm as Nn,P as Nr,qx as Nt,cw as O,Xe as Oa,Ju as Oi,fh as On,om as Or,mS as Ot,GC as P,S as Pa,ju as Pi,Um as Pn,vp as Pr,jS as Pt,$C as Q,da as Qi,fp as Qn,Af as Qr,tb as Qt,CC as R,Oe as Ra,Pu as Ri,yp as Rn,zp as Rr,eS as Rt,mT as S,mr as Sa,nd as Si,xv as Sn,Dm as Sr,q as St,mw as T,D as Ta,qu as Ti,Dv as Tn,Pm as Tr,Qx as Tt,VC as U,de as Ua,Za as Ui,Kp as Un,hp as Ur,Ax as Ut,SC as V,le as Va,Fu as Vi,Np as Vn,Gp as Vr,Ox as Vt,PC as W,x as Wa,Ka as Wi,Sp as Wn,Cp as Wr,Nx as Wt,YC as X,Da as Xi,H as Xn,Mf as Xr,Db as Xt,WC as Y,xa as Yi,z as Yn,lp as Yr,NS as Yt,QC as Z,_a as Zi,Rm as Zn,Nf as Zr,rb as Zt,HT as _,vr as _a,ad as _i,Fv as _n,em as _r,Gx as _t,pD as a,si as aa,Bd as ai,Ny as an,up as ar,UC as at,LT as b,Cr as ba,ud as bi,Iv as bn,Om as br,CS as bt,wD as c,Yr as ca,N as ci,Ty as cn,Vm as cr,bC as ct,sE as d,ci as da,Vd as di,Dy as dn,Xp as dr,aC as dt,la as ea,kf as ei,Cb as en,wm as er,KC as et,tE as f,Ir as fa,hd as fi,ny as fn,Zp as fr,qS as ft,$T as g,_r as ga,id as gi,Lv as gn,mp as gr,Zx as gt,eE as h,Tr as ha,gd as hi,Zv as hn,Rp as hr,zx as ht,HI as i,Gr as ia,Ld as ii,My as in,pm as ir,iw as it,fw as j,C as ja,Vu as ji,dp as jn,Qp as jr,Jx as jt,uw as k,Ye as ka,Zu as ki,cm as kn,sm as kr,hS as kt,cE as l,ti as la,Gd as li,Oy as ln,zm as lr,lC as lt,XT as m,Er as ma,Sd as mi,ey as mn,fm as mr,XS as mt,FI as n,Wi as na,nf as ni,Ib as nn,L as nr,RC as nt,jD as o,di as oa,jd as oi,Ay as on,Hm as or,MC as ot,YT as p,k as pa,yd as pi,ry as pn,bp as pr,ZS as pt,qC as q,A as qi,xp as qn,pp as qr,aS as qt,NI as r,na as ra,Nd as ri,Jb as rn,Hp as rr,tw as rt,OD as s,$r as sa,Ud as si,jy as sn,Bm as sr,xC as st,CI as t,Ii as ta,of as ti,Lb as tn,Cm as tr,FC as tt,aE as u,li as ua,Fd as ui,ky as un,B as ur,oC as ut,VT as v,gr as va,pd as vi,Pv as vn,im as vr,Wx as vt,_T as w,hr as wa,Yu as wi,kv as wn,Mm as wr,tS as wt,zT as x,pr as xa,rd as xi,bv as xn,Em as xr,bS as xt,BT as y,br as ya,md as yi,Mv as yn,Jp as yr,AS as yt,jC as z,Se as za,Nu as zi,V as zn,Up as zr,Bx as zt};
194
- //# sourceMappingURL=server-C9rjDe4G-tK1eEVqu.js.map
188
+ deps: ${r}}`};let i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),uP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),dP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=EN(),n=Q(),r=yN(),i=$();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?ee(e):a.if(g(e),()=>ee(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function ee(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(v(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(v(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function v(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),fP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=MN(),n=EN(),r=$(),i=dP();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),pP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=EN(),n=Q(),r=$(),i=$();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?ee(e):(a.var(m,!0),ee(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function ee(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),mP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=$();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),hP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:EN().validateUnion,error:{message:`must match a schema in anyOf`}}})),gP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),_P=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=$();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),vP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),yP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=$();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),bP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=iP(),n=oP(),r=aP(),i=sP(),a=cP(),o=lP(),s=uP(),c=dP(),l=fP(),u=pP(),d=mP(),f=hP(),p=gP(),m=_P(),h=vP(),g=yP();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),xP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),SP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[xP().default]})),CP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),wP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=WN(),n=rP(),r=bP(),i=SP(),a=CP();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),TP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),EP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=TP(),r=FN(),i=PN(),a=$();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),DP=t(((e,t)=>{t.exports={$schema:`http://json-schema.org/draft-07/schema#`,$id:`http://json-schema.org/draft-07/schema#`,title:`Core schema meta-schema`,definitions:{schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},default:!0}})),OP=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let n=VN(),r=wP(),i=EP(),a=DP(),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`;var c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=c;var l=MN();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return l.KeywordCxt}});var u=Q();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return u.CodeGen}});var d=NN();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return d.default}});var f=PN();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return f.default}})})),kP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:ie,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:v,int32:{type:`number`,validate:ne},int64:{type:`number`,validate:re},float:{type:`number`,validate:b},double:{type:`number`,validate:b},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}let r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}let s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}let d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}let h=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(e){return h.test(e)&&g.test(e)}let ee=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(e){return ee.lastIndex=0,ee.test(e)}let te=-(2**31),y=2**31-1;function ne(e){return Number.isInteger(e)&&e<=y&&e>=te}function re(e){return Number.isInteger(e)}function b(){return!0}let x=/[^\\]\\Z/;function ie(e){if(x.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),AP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatLimitDefinition=void 0;let t=OP(),n=Q(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),jP=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});let n=kP(),r=AP(),i=Q(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=s})),MP=e(OP(),1),NP=e(jP(),1);function PP(){let e=new MP.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,NP.default)(e),e}var FP=class{constructor(e){this._ajv=e??PP()}getValidator(e){let t=`$id`in e&&typeof e.$id==`string`?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}},IP=class{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return this.requestStream({method:`sampling/createMessage`,params:e},Aj,t)}elicitInputStream(e,t){let n=this._server.getClientCapabilities(),r=e.mode??`form`;switch(r){case`url`:if(!n?.elicitation?.url)throw Error(`Client does not support url elicitation.`);break;case`form`:if(!n?.elicitation?.form)throw Error(`Client does not support form elicitation.`);break}let i=r===`form`&&e.mode===void 0?{...e,mode:`form`}:e;return this.requestStream({method:`elicitation/create`,params:i},Xj,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}};function LP(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case`tools/call`:if(!e.tools?.call)throw Error(`${n} does not support task creation for tools/call (required for ${t})`);break;default:break}}function RP(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case`sampling/createMessage`:if(!e.sampling?.createMessage)throw Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case`elicitation/create`:if(!e.elicitation?.create)throw Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var zP=class extends mN{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(gj.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new FP,this.setRequestHandler($k,e=>this._oninitialize(e)),this.setNotificationHandler(nA,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(vj,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=gj.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||={tasks:new IP(this)},this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=gN(this._capabilities,e)}setRequestHandler(e,t){let n=ck(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let r;if(ik(n)){let e=n;r=e._zod?.def?.value??e.value}else{let e=n;r=e._def?.value??e.value}if(typeof r!=`string`)throw Error(`Schema method literal must be a string`);return r===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let r=ok(mj,e);if(!r.success){let e=r.error instanceof Error?r.error.message:String(r.error);throw new Y(J.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:i}=r.data,a=await Promise.resolve(t(e,n));if(i.task){let e=ok(fA,a);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new Y(J.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let o=ok(fj,a);if(!o.success){let e=o.error instanceof Error?o.error.message:String(o.error);throw new Y(J.InvalidParams,`Invalid tools/call result: ${e}`)}return o.data}):super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`completion/complete`:if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case`ping`:case`initialize`:break}}assertTaskCapability(e){RP(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&LP(this._capabilities.tasks?.requests,e,`Server`)}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:hk.includes(t)?t:mk,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:`ping`},Bk)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return e.tools?this.request({method:`sampling/createMessage`,params:e},jj,t):this.request({method:`sampling/createMessage`,params:e},Aj,t)}async elicitInput(e,t){switch(e.mode??`form`){case`url`:{if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support url elicitation.`);let n=e;return this.request({method:`elicitation/create`,params:n},Xj,t)}case`form`:{if(!this._clientCapabilities?.elicitation?.form)throw Error(`Client does not support form elicitation.`);let n=e.mode===`form`?e:{...e,mode:`form`},r=await this.request({method:`elicitation/create`,params:n},Xj,t);if(r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new Y(J.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof Y?e:new Y(J.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return r}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:`roots/list`,params:e},oM,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}};const BP=Symbol.for(`mcp.completable`);function VP(e){return!!e&&typeof e==`object`&&BP in e}function HP(e){return e[BP]?.complete}var UP;(function(e){e.Completable=`McpCompletable`})(UP||={});const WP=/^[A-Za-z0-9._-]{1,128}$/;function GP(e){let t=[];if(e.length===0)return{isValid:!1,warnings:[`Tool name cannot be empty`]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(` `)&&t.push(`Tool name contains spaces, which may cause parsing issues`),e.includes(`,`)&&t.push(`Tool name contains commas, which may cause parsing issues`),(e.startsWith(`-`)||e.endsWith(`-`))&&t.push(`Tool name starts or ends with a dash, which may cause parsing issues in some contexts`),(e.startsWith(`.`)||e.endsWith(`.`))&&t.push(`Tool name starts or ends with a dot, which may cause parsing issues in some contexts`),!WP.test(e)){let n=e.split(``).filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,n)=>n.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${n.map(e=>`"${e}"`).join(`, `)}`,`Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)`),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function KP(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let e of t)console.warn(` - ${e}`);console.warn(`Tool registration will proceed, but this may cause compatibility issues.`),console.warn(`Consider updating the tool name to conform to the MCP tool naming standard.`),console.warn(`See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.`)}}function qP(e){let t=GP(e);return KP(e,t.warnings),t.isValid}var JP=class{constructor(e){this._mcpServer=e}registerToolTask(e,t,n){let r={taskSupport:`required`,...t.execution};if(r.taskSupport===`forbidden`)throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,r,t._meta,n)}},YP=class{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new zP(e,t)}get experimental(){return this._experimental||={tasks:new JP(this)},this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||=(this.server.assertCanSetRequestHandler(nF(uj)),this.server.assertCanSetRequestHandler(nF(mj)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(uj,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:(()=>{let e=lk(t.inputSchema);return e?dN(e,{strictUnions:!0,pipeStrategy:`input`}):XP})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let e=lk(t.outputSchema);e&&(n.outputSchema=dN(e,{strictUnions:!0,pipeStrategy:`output`}))}return n})})),this.server.setRequestHandler(mj,async(e,t)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new Y(J.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new Y(J.InvalidParams,`Tool ${e.params.name} disabled`);let r=!!e.params.task,i=n.execution?.taskSupport,a=`createTask`in n.handler;if((i===`required`||i===`optional`)&&!a)throw new Y(J.InternalError,`Tool ${e.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if(i===`required`&&!r)throw new Y(J.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(i===`optional`&&!r&&a)return await this.handleAutomaticTaskPolling(n,e,t);let o=await this.validateToolInput(n,e.params.arguments,e.params.name),s=await this.executeToolHandler(n,o,t);return r||await this.validateToolOutput(n,s,e.params.name),s}catch(e){if(e instanceof Y&&e.code===J.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),!0)}createToolError(e){return{content:[{type:`text`,text:e}],isError:!0}}async validateToolInput(e,t,n){if(!e.inputSchema)return;let r=await sk(lk(e.inputSchema)??e.inputSchema,t);if(!r.success){let e=uk(`error`in r?r.error:`Unknown error`);throw new Y(J.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${e}`)}return r.data}async validateToolOutput(e,t,n){if(!e.outputSchema||!(`content`in t)||t.isError)return;if(!t.structuredContent)throw new Y(J.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let r=await sk(lk(e.outputSchema),t.structuredContent);if(!r.success){let e=uk(`error`in r?r.error:`Unknown error`);throw new Y(J.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${e}`)}}async executeToolHandler(e,t,n){let r=e.handler;if(`createTask`in r){if(!n.taskStore)throw Error(`No task store provided.`);let i={...n,taskStore:n.taskStore};if(e.inputSchema){let e=r;return await Promise.resolve(e.createTask(t,i))}else{let e=r;return await Promise.resolve(e.createTask(i))}}if(e.inputSchema){let e=r;return await Promise.resolve(e(t,n))}else{let e=r;return await Promise.resolve(e(n))}}async handleAutomaticTaskPolling(e,t,n){if(!n.taskStore)throw Error(`No task store provided for task-capable tool.`);let r=await this.validateToolInput(e,t.params.arguments,t.params.name),i=e.handler,a={...n,taskStore:n.taskStore},o=r?await Promise.resolve(i.createTask(r,a)):await Promise.resolve(i.createTask(a)),s=o.task.taskId,c=o.task,l=c.pollInterval??5e3;for(;c.status!==`completed`&&c.status!==`failed`&&c.status!==`cancelled`;){await new Promise(e=>setTimeout(e,l));let e=await n.taskStore.getTask(s);if(!e)throw new Y(J.InternalError,`Task ${s} not found during polling`);c=e}return await n.taskStore.getTaskResult(s)}setCompletionRequestHandler(){this._completionHandlerInitialized||=(this.server.assertCanSetRequestHandler(nF(eM)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(eM,async e=>{switch(e.params.ref.type){case`ref/prompt`:return tM(e),this.handlePromptCompletion(e,e.params.ref);case`ref/resource`:return nM(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Y(J.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),!0)}async handlePromptCompletion(e,t){let n=this._registeredPrompts[t.name];if(!n)throw new Y(J.InvalidParams,`Prompt ${t.name} not found`);if(!n.enabled)throw new Y(J.InvalidParams,`Prompt ${t.name} disabled`);if(!n.argsSchema)return iF;let r=ck(n.argsSchema)?.[e.params.argument.name];if(!VP(r))return iF;let i=HP(r);return i?rF(await i(e.params.argument.value,e.params.context)):iF}async handleResourceCompletion(e,t){let n=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!n){if(this._registeredResources[t.uri])return iF;throw new Y(J.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let r=n.resourceTemplate.completeCallback(e.params.argument.name);return r?rF(await r(e.params.argument.value,e.params.context)):iF}setResourceRequestHandlers(){this._resourceHandlersInitialized||=(this.server.assertCanSetRequestHandler(nF(AA)),this.server.assertCanSetRequestHandler(nF(MA)),this.server.assertCanSetRequestHandler(nF(IA)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(AA,async(e,t)=>{let n=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),r=[];for(let e of Object.values(this._registeredResourceTemplates)){if(!e.resourceTemplate.listCallback)continue;let n=await e.resourceTemplate.listCallback(t);for(let t of n.resources)r.push({...e.metadata,...t})}return{resources:[...n,...r]}}),this.server.setRequestHandler(MA,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(IA,async(e,t)=>{let n=new URL(e.params.uri),r=this._registeredResources[n.toString()];if(r){if(!r.enabled)throw new Y(J.InvalidParams,`Resource ${n} disabled`);return r.readCallback(n,t)}for(let e of Object.values(this._registeredResourceTemplates)){let r=e.resourceTemplate.uriTemplate.match(n.toString());if(r)return e.readCallback(n,r,t)}throw new Y(J.InvalidParams,`Resource ${n} not found`)}),!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||=(this.server.assertCanSetRequestHandler(nF(qA)),this.server.assertCanSetRequestHandler(nF(XA)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(qA,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?tF(t.argsSchema):void 0}))})),this.server.setRequestHandler(XA,async(e,t)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new Y(J.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new Y(J.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let r=await sk(lk(n.argsSchema),e.params.arguments);if(!r.success){let t=uk(`error`in r?r.error:`Unknown error`);throw new Y(J.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${t}`)}let i=r.data,a=n.callback;return await Promise.resolve(a(i,t))}else{let e=n.callback;return await Promise.resolve(e(t))}}),!0)}resource(e,t,...n){let r;typeof n[0]==`object`&&(r=n.shift());let i=n[0];if(typeof t==`string`){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,void 0,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,void 0,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}registerResource(e,t,n,r){if(typeof t==`string`){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,n.title,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,n.title,t,n,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(e,t,n,r,i){let a={name:e,title:t,metadata:r,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({uri:null}),update:e=>{e.uri!==void 0&&e.uri!==n&&(delete this._registeredResources[n],e.uri&&(this._registeredResources[e.uri]=a)),e.name!==void 0&&(a.name=e.name),e.title!==void 0&&(a.title=e.title),e.metadata!==void 0&&(a.metadata=e.metadata),e.callback!==void 0&&(a.readCallback=e.callback),e.enabled!==void 0&&(a.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=a,a}_createRegisteredResourceTemplate(e,t,n,r,i){let a={resourceTemplate:n,title:t,metadata:r,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=a)),t.title!==void 0&&(a.title=t.title),t.template!==void 0&&(a.resourceTemplate=t.template),t.metadata!==void 0&&(a.metadata=t.metadata),t.callback!==void 0&&(a.readCallback=t.callback),t.enabled!==void 0&&(a.enabled=t.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=a;let o=n.uriTemplate.variableNames;return Array.isArray(o)&&o.some(e=>!!n.completeCallback(e))&&this.setCompletionRequestHandler(),a}_createRegisteredPrompt(e,t,n,i,a){let o={title:t,description:n,argsSchema:i===void 0?void 0:ak(i),callback:a,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=o)),t.title!==void 0&&(o.title=t.title),t.description!==void 0&&(o.description=t.description),t.argsSchema!==void 0&&(o.argsSchema=ak(t.argsSchema)),t.callback!==void 0&&(o.callback=t.callback),t.enabled!==void 0&&(o.enabled=t.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=o,i&&Object.values(i).some(e=>VP(e instanceof r?e._def?.innerType:e))&&this.setCompletionRequestHandler(),o}_createRegisteredTool(e,t,n,r,i,a,o,s,c){qP(e);let l={title:t,description:n,inputSchema:eF(r),outputSchema:eF(i),annotations:a,execution:o,_meta:s,handler:c,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(typeof t.name==`string`&&qP(t.name),delete this._registeredTools[e],t.name&&(this._registeredTools[t.name]=l)),t.title!==void 0&&(l.title=t.title),t.description!==void 0&&(l.description=t.description),t.paramsSchema!==void 0&&(l.inputSchema=ak(t.paramsSchema)),t.outputSchema!==void 0&&(l.outputSchema=ak(t.outputSchema)),t.callback!==void 0&&(l.handler=t.callback),t.annotations!==void 0&&(l.annotations=t.annotations),t._meta!==void 0&&(l._meta=t._meta),t.enabled!==void 0&&(l.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let n,r,i;if(typeof t[0]==`string`&&(n=t.shift()),t.length>1){let e=t[0];$P(e)?(r=t.shift(),t.length>1&&typeof t[0]==`object`&&t[0]!==null&&!$P(t[0])&&(i=t.shift())):typeof e==`object`&&e&&(i=t.shift())}let a=t[0];return this._createRegisteredTool(e,void 0,n,r,void 0,i,{taskSupport:`forbidden`},void 0,a)}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:r,description:i,inputSchema:a,outputSchema:o,annotations:s,_meta:c}=t;return this._createRegisteredTool(e,r,i,a,o,s,{taskSupport:`forbidden`},c,n)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let n;typeof t[0]==`string`&&(n=t.shift());let r;t.length>1&&(r=t.shift());let i=t[0],a=this._createRegisteredPrompt(e,void 0,n,r,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}registerPrompt(e,t,n){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:r,description:i,argsSchema:a}=t,o=this._createRegisteredPrompt(e,r,i,a,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};const XP={type:`object`,properties:{}};function ZP(e){return typeof e==`object`&&!!e&&`parse`in e&&typeof e.parse==`function`&&`safeParse`in e&&typeof e.safeParse==`function`}function QP(e){return`_def`in e||`_zod`in e||ZP(e)}function $P(e){return typeof e!=`object`||!e||QP(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(ZP)}function eF(e){if(e)return $P(e)?ak(e):e}function tF(e){let t=ck(e);return t?Object.entries(t).map(([e,t])=>({name:e,description:dk(t),required:!fk(t)})):[]}function nF(e){let t=ck(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=pk(t);if(typeof n==`string`)return n;throw Error(`Schema method literal must be a string`)}function rF(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}const iF={completion:{values:[],hasMore:!1}};var aF=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
189
+ `);if(e===-1)return null;let t=this._buffer.toString(`utf8`,0,e).replace(/\r$/,``);return this._buffer=this._buffer.subarray(e+1),oF(t)}clear(){this._buffer=void 0}};function oF(e){return zk.parse(JSON.parse(e))}function sF(e){return JSON.stringify(e)+`
190
+ `}var cF=class{constructor(e=h.stdin,t=h.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new aF,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{this.onerror?.(e)}}async start(){if(this._started)throw Error(`StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.`);this._started=!0,this._stdin.on(`data`,this._ondata),this._stdin.on(`error`,this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off(`data`,this._ondata),this._stdin.off(`error`,this._onerror),this._stdin.listenerCount(`data`)===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let n=sF(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};const lF=e=>({content:[{type:`text`,text:e}]}),uF=e=>{let t=new WeakSet;return JSON.stringify(e,(e,n)=>{if(typeof n==`object`&&n){if(t.has(n))return`[Circular]`;t.add(n)}return n},2)},dF=e=>lF(uF(e)),fF=e=>({content:[{type:`image`,data:e,mimeType:`image/png`}]}),pF=Object.getPrototypeOf(async()=>{}).constructor,mF=e=>{let t=t=>e.runPromise(t),n=new YP({name:`expect`,version:`0.0.1`});return n.registerTool(`open`,{title:`Open URL`,description:`Navigate to a URL, launching a browser if needed.`,inputSchema:{url:a.string().describe(`URL to navigate to`),headed:a.boolean().optional().describe(`Show browser window`),cookies:a.boolean().optional().describe(`Reuse local browser cookies for the target URL when available`),waitUntil:a.enum([`load`,`domcontentloaded`,`networkidle`,`commit`]).optional().describe(`Wait strategy`)}},({url:e,headed:n,cookies:r,waitUntil:i})=>t(L(function*(){let t=yield*tk;if(t.hasSession())return yield*t.navigate(e,{waitUntil:i}),lF(`Navigated to ${e}`);let a=yield*t.open(e,{headed:n,cookies:r,waitUntil:i});return lF(`Opened ${e}`+(a.injectedCookieCount>0?` (${a.injectedCookieCount} cookies synced from local browser)`:``))}))),n.registerTool(`playwright`,{title:`Execute Playwright`,description:"Execute Playwright code in the Node.js context. Available globals: page (Page), context (BrowserContext), browser (Browser), ref (function: ref ID from snapshot → Playwright Locator). Use `return` to send a value back as JSON. Supports await.",inputSchema:{code:a.string().describe(`Playwright code to execute`)}},({code:e})=>t(L(function*(){let t=yield*(yield*tk).requireSession(),n=e=>{if(!t.lastSnapshot)throw Error(`No snapshot taken yet. Call screenshot with mode 'snapshot' first.`);return xm(t.lastSnapshot.locator(e))};return yield*ip(async()=>{try{let r=await new pF(`page`,`context`,`browser`,`ref`,e)(t.page,t.context,t.browser,n);return r===void 0?lF(`OK`):dF(r)}catch(e){return lF(`Error: ${e instanceof Error?e.message:String(e)}`)}})}))),n.registerTool(`screenshot`,{title:`Screenshot`,description:`Capture the current page state. Modes: 'screenshot' (default, PNG image), 'snapshot' (ARIA accessibility tree with element refs), 'annotated' (screenshot with numbered labels on interactive elements).`,annotations:{readOnlyHint:!0},inputSchema:{mode:a.enum([`screenshot`,`snapshot`,`annotated`]).optional().describe(`Capture mode (default: screenshot)`),fullPage:a.boolean().optional().describe(`Capture the full scrollable page`)}},({mode:e,fullPage:n})=>t(L(function*(){let t=yield*tk,r=yield*t.requirePage(),i=e??`screenshot`;if(i===`snapshot`){let e=yield*t.snapshot(r);return yield*t.updateLastSnapshot(e),dF({tree:e.tree,refs:e.refs,stats:e.stats})}if(i===`annotated`){let e=yield*t.annotatedScreenshot(r,{fullPage:n});return{content:[{type:`image`,data:e.screenshot.toString(`base64`),mimeType:`image/png`},{type:`text`,text:e.annotations.map(e=>`[${e.label}] @${e.ref} ${e.role} "${e.name}"`).join(`
191
+ `)}]}}return fF((yield*ap(()=>r.screenshot({fullPage:n}))).toString(`base64`))}))),n.registerTool(`console_logs`,{title:`Console Logs`,description:`Get browser console log messages. Optionally filter by log type (log, warning, error, info, debug).`,annotations:{readOnlyHint:!0},inputSchema:{type:a.string().optional().describe(`Filter by console message type (e.g. 'error', 'warning', 'log')`),clear:a.boolean().optional().describe(`Clear the collected messages after reading`)}},({type:e,clear:n})=>t(L(function*(){let t=yield*(yield*tk).requireSession(),r=e?t.consoleMessages.filter(t=>t.type===e):t.consoleMessages;return n&&(t.consoleMessages.length=0),r.length===0?lF(`No console messages captured.`):dF(r)}))),n.registerTool(`network_requests`,{title:`Network Requests`,description:`Get captured network requests. Optionally filter by HTTP method, URL substring, or resource type (document, script, stylesheet, image, xhr, fetch, etc.).`,annotations:{readOnlyHint:!0},inputSchema:{method:a.string().optional().describe(`Filter by HTTP method (e.g. 'GET', 'POST')`),url:a.string().optional().describe(`Filter by URL substring match`),resourceType:a.string().optional().describe(`Filter by resource type (e.g. 'xhr', 'fetch', 'document', 'script')`),clear:a.boolean().optional().describe(`Clear the collected requests after reading`)}},({method:e,url:n,resourceType:r,clear:i})=>t(L(function*(){let t=yield*(yield*tk).requireSession(),a=e?.toUpperCase(),o=r?.toLowerCase(),s=t.networkRequests.filter(e=>(!a||e.method===a)&&(!n||e.url.includes(n))&&(!o||e.resourceType===o));return i&&(t.networkRequests.length=0),s.length===0?lF(`No network requests captured.`):dF(s)}))),n.registerTool(`performance_metrics`,{title:`Performance Metrics`,description:`Get Core Web Vitals performance metrics (FCP, LCP, CLS, INP) for the current page. Each metric includes a value (milliseconds for FCP/LCP/INP, unitless score for CLS) and a rating (good, needs-improvement, poor). Metrics are collected automatically from page load and user interactions.`,annotations:{readOnlyHint:!0},inputSchema:{}},()=>t(L(function*(){let e=yield*yO(yield*(yield*tk).requirePage(),`getPerformanceMetrics`);return e.fcp||e.lcp||e.inp?dF(e):lF(`No performance metrics available yet.`)}))),n.registerTool(`close`,{title:`Close Browser`,description:`Close the browser and end the session.`,annotations:{destructiveHint:!0},inputSchema:{}},()=>t(L(function*(){let e=yield*(yield*tk).close();if(!e)return lF(`No browser open.`);let t=[`Browser closed.`];return e.tmpReplaySessionPath&&t.push(`rrweb replay: ${e.tmpReplaySessionPath}`),e.tmpReportPath&&t.push(`rrweb report: ${e.tmpReportPath}`),e.tmpVideoPath?t.push(`Playwright video: ${e.tmpVideoPath}`):e.videoPath&&t.push(`Playwright video: ${e.videoPath}`),lF(t.join(`
192
+ `))}))),n},hF=async e=>{let t=mF(e),n=new cF;await t.connect(n)};export{vx as $,ae as $i,Hp as $n,ku as $r,Xm as $t,zS as A,Cr as Ai,km as An,Md as Ar,vb as At,BS as B,Yt as Bi,Up as Bn,Yu as Br,Vv as Bt,ZS as C,qr as Ci,im as Cn,Od as Cr,zx as Ct,kS as D,Pr as Di,Np as Dn,P as Dr,Vy as Dt,FS as E,oi as Ei,L as En,Pd as Er,lb as Et,QS as F,pr as Fi,Bp as Fn,Zu as Fr,gy as Ft,yx as G,Le as Gi,_m as Gn,Gu as Gr,_v as Gt,rC as H,Je as Hi,hm as Hn,Hu as Hr,zv as Ht,eC as I,Sr as Ii,dp as In,Qu as Ir,uy as It,wx as J,ke as Ji,Sm as Jn,Iu as Jr,ov as Jt,jx as K,je as Ki,ym as Kn,Vu as Kr,xv as Kt,tC as L,mr as Li,em as Ln,id as Lr,py as Lt,XS as M,vr as Mi,Om as Mn,ud as Mr,Ob as Mt,WS as N,xr as Ni,Em as Nn,pd as Nr,_y as Nt,RS as O,k as Oi,tm as On,Id as Or,zy as Ot,qS as P,fr as Pi,B as Pn,sd as Pr,hy as Pt,q as Q,he as Qi,Vp as Qn,Mu as Qr,lv as Qt,$S as R,D as Ri,kp as Rn,ad as Rr,my as Rt,NS as S,Zr as Si,np as Sn,wd as Sr,gx as St,IS as T,si as Ti,um as Tn,Sd as Tr,pS as Tt,aC as U,Ne as Ui,pm as Un,Bu as Ur,bv as Ut,HS as V,Ye as Vi,Kp as Vn,Uu as Vr,Hv as Vt,LS as W,C as Wi,mm as Wn,Ku as Wr,yv as Wt,rS as X,Se as Xi,Jp as Xn,Pu as Xr,mv as Xt,uS as Y,S as Yi,qp as Yn,Eu as Yr,dv as Yt,eS as Z,Te as Zi,Yp as Zn,Nu as Zr,fv as Zt,ZC as _,Hi as _i,fp as _n,bf as _r,cx as _t,SE as a,y as aa,Ua as ai,sm as an,Ap as ar,Yx as at,MS as b,ai as bi,H as bn,Yd as br,px as bt,Uw as c,A as ci,bp as cn,Ip as cr,G as ct,Cw as d,Ta as di,V as dn,mp as dr,Gx as dt,le as ea,Ou as ei,Qm as en,F as er,Fx as et,Sw as f,ha as fi,Cp as fn,lp as fr,Ax as ft,YC as g,Pi as gi,R as gn,Cf as gr,Bx as gt,bw as h,sa as hi,pp as hn,$f as hr,bx as ht,iE as i,ue as ia,Ja as ii,_p as in,jp as ir,Jx as it,US as j,hr as ji,Dm as jn,od as jr,_b as jt,GS as k,wr as ki,ep as kn,Ed as kr,ab as kt,Pw as l,Sa as li,xp as ln,om as lr,Dx as lt,vw as m,ca as mi,Lp as mn,hp as mr,Px as mt,rk as n,de as na,Au as ni,Zp as nn,I as nr,Ix as nt,yE as o,La as oi,Am as on,Pp as or,tS as ot,xw as p,la as pi,wp as pn,rp as pr,Lx as pt,Tx as q,Ae as qi,xm as qn,Wu as qr,av as qt,tk as r,x as ra,ao as ri,tp as rn,vp as rr,Cx as rt,hE as s,Pa as si,jm as sn,Fp as sr,Ox as st,hF as t,b as ta,Fu as ti,Xp as tn,cp as tr,Mx as tt,Aw as u,ya as ui,up as un,ap as ur,dS as ut,QC as v,ea as vi,fm as vn,xf as vr,dx as vt,VS as w,$r as wi,dm as wn,jd as wr,K as wt,JS as x,li as xi,Tm as xn,qd as xr,nS as xt,sC as y,Ur as yi,z as yn,yf as yr,ux as yt,YS as z,O as zi,ip as zn,Xu as zr,fy as zt};
193
+ //# sourceMappingURL=server-DsSVRZK1.js.map