expect-cli 0.0.4 → 0.0.6
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.
- package/dist/browser-mcp.js +1 -1
- package/dist/browser-mcp.js.map +1 -1
- package/dist/index.js +42 -41
- package/dist/index.js.map +1 -1
- package/dist/server-D-3IipQn.js +193 -0
- package/dist/server-D-3IipQn.js.map +1 -0
- package/package.json +4 -4
- package/dist/server-Smi2kpAY-CN-mxLk6.js +0 -193
- package/dist/server-Smi2kpAY-CN-mxLk6.js.map +0 -1
|
@@ -0,0 +1,193 @@
|
|
|
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{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=`~effect/interfaces/Hash`,C=e=>{switch(typeof e){case`number`:return Pe(e);case`bigint`:return Fe(e.toString(10));case`boolean`:return Fe(String(e));case`symbol`:return Fe(String(e));case`string`:return Fe(e);case`undefined`:return Fe(`undefined`);case`function`:case`object`:if(e===null)return Fe(`null`);if(e instanceof Date)return Fe(e.toISOString());if(e instanceof RegExp)return Fe(e.toString());{if(me.has(e))return Ae(e);if(Ue.has(e))return Ue.get(e);let t=Ge(e,()=>Ne(e)?e[ke]():typeof e==`function`?Ae(e):Array.isArray(e)?ze(e):e instanceof Map?Be(e):e instanceof Set?Ve(e):Le(e));return Ue.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Ae=e=>(He.has(e)||He.set(e,Pe(Math.floor(Math.random()*(2**53-1)))),He.get(e)),je=b(2,(e,t)=>e*53^t),Me=e=>e&3221225471|e>>>1&1073741824,Ne=e=>S(e,ke),Pe=e=>{if(e!==e)return Fe(`NaN`);if(e===1/0)return Fe(`Infinity`);if(e===-1/0)return Fe(`-Infinity`);let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return Me(t)},Fe=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return Me(t)},Ie=(e,t)=>{let n=12289;for(let r of t)n^=je(C(r),C(e[r]));return Me(n)},Le=e=>Ie(e,pe(e)),Re=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return Me(r)},ze=Re(6151,C),Be=Re(Fe(`Map`),([e,t])=>je(C(e),C(t))),Ve=Re(Fe(`Set`),C),He=new WeakMap,Ue=new WeakMap,We=new WeakSet;function Ge(e,t){if(We.has(e))return Fe(`[Circular]`);We.add(e);let n=t();return We.delete(e),n}const Ke=`~effect/interfaces/Equal`;function qe(){return arguments.length===1?e=>Je(e,arguments[0]):Je(arguments[0],arguments[1])}function Je(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:$e(e,t,Qe):!1}function Ye(e,t,n){let r=Xe.has(e),i=Ze.has(t);if(r&&i)return!0;if(r||i)return!1;Xe.add(e),Ze.add(t);let a=n();return Xe.delete(e),Ze.delete(t),a}const Xe=new WeakSet,Ze=new WeakSet;function Qe(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=st(e),r=st(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:Ye(e,t,()=>i?e[Ke](t):Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:tt(e,t):e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:it(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:ot(e,t):nt(e,t))}function $e(e,t,n){let r=et.get(e);if(!r)r=new WeakMap,et.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=et.get(t);return a||(a=new WeakMap,et.set(t,a)),a.set(e,i),i}const et=new WeakMap;function tt(e,t){for(let n=0;n<e.length;n++)if(!Je(e[n],t[n]))return!1;return!0}function nt(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)||!Je(e[i],t[i]))return!1;return!0}function rt(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 it=rt(Je,Je);function at(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 ot=at(Je),st=e=>S(e,Ke),ct=()=>qe,lt=e=>(t,n)=>t===n||e(t,n),ut=(e,t)=>e===t,dt=()=>ut;function ft(e){return lt((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 pt(e){return lt((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 mt=e=>e.length>0,ht=Symbol.for(`~effect/Inspectable/redactable`),gt=e=>S(e,ht);function _t(e){return gt(e)?vt(e):e}function vt(e){return e[ht](globalThis[`~effect/Fiber/currentFiber`]?.services??bt)}const yt=`~effect/Fiber/currentFiber`,bt={"~effect/ServiceMap":{},mapUnsafe:new Map,pipe(){return y(this,arguments)}};function xt(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 St;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 Tt(e);if(!t?.ignoreToString&&S(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Et(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 St;if(r.add(e),ht in e)return xt(vt(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=>`${Ct(t)}:${c(e[t],n)}`).join(`,`)}}`):o(e,`{\n${t.map(t=>`${a(n+1)}${Ct(t)}: ${c(e[t],n+1)}`).join(`,
|
|
4
|
+
`)}\n${a(n)}}`)}return String(e)}return c(e,0)}const St=`[Circular]`;function Ct(e){return typeof e==`string`?JSON.stringify(e):String(e)}function wt(e){return e.map(e=>`[${Ct(e)}]`).join(``)}function Tt(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Et(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function Dt(e,t){let n=[],r=JSON.stringify(e,(e,t)=>typeof t==`object`&&t?n.includes(t)?void 0:n.push(t)&&_t(t):t,t?.space);return n=void 0,r}const Ot=Symbol.for(`nodejs.util.inspect.custom`),kt=e=>{try{if(S(e,`toJSON`)&&xe(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(kt)}catch{return`[toJSON threw]`}return _t(e)},At=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?jt(e,t):String(e)}catch{return String(e)}},jt=(e,t)=>{let n=[],r=JSON.stringify(e,(e,t)=>typeof t==`object`&&t?n.includes(t)?void 0:n.push(t)&&_t(t):t,t);return n=void 0,r},Mt={toJSON(){return kt(this)},[Ot](){return this.toJSON()},toString(){return xt(this.toJSON())}};var Nt=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 Pt=`~effect/Utils/internal`,Ft={[Pt]:e=>e()},It={[Pt]:e=>{try{return e()}finally{}}},Lt=Ft[Pt](()=>Error().stack)?.includes(Pt)===!0?Ft[Pt]:It[Pt],Rt=`~effect/Effect`,zt=`~effect/Exit`,Bt={_A:x,_E:x,_R:x},Vt=`${Rt}/identifier`,w=`${Rt}/args`,Ht=`${Rt}/evaluate`,Ut=`${Rt}/successCont`,Wt=`${Rt}/failureCont`,Gt=`${Rt}/ensureCont`,Kt=Symbol.for(`effect/Effect/Yield`),qt={pipe(){return y(this,arguments)},toJSON(){return{...this}},toString(){return xt(this.toJSON(),{ignoreToString:!0,space:2})},[Ot](){return this.toJSON()}},Jt={[ke](){return Ie(this,Object.keys(this))},[Ke](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]&&!qe(this[t[r]],e[t[r]]))return!1;return!0}},Yt={[Symbol.iterator](){return new Nt(this)}},Xt={...Yt,pipe(){return y(this,arguments)}},Zt={[Rt]:Bt,...qt,[Symbol.iterator](){return new Nt(this)},asEffect(){return this},toJSON(){return{_id:`Effect`,op:this[Vt],...w in this?{args:this[w]}:void 0}}},Qt=e=>S(e,Rt),$t=e=>S(e,zt),en=`~effect/Cause`,tn=`~effect/Cause/Reason`,nn=e=>S(e,en);var rn=class{[en];reasons;constructor(e){this[en]=en,this.reasons=e}pipe(){return y(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${xt(this.reasons)})`}[Ot](){return this.toJSON()}[Ke](e){return nn(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>qe(t,e.reasons[n]))}[ke](){return ze(this.reasons)}};const an=new WeakMap;var on=class{[tn];annotations;_tag;constructor(e,t,n){if(this[tn]=tn,this._tag=e,t!==sn&&typeof n==`object`&&n&&t.size>0){let e=an.get(n);e&&(t=new Map([...e,...t])),an.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 xt(this)}[Ot](){return this.toString()}};const sn=new Map;var cn=class extends on{error;constructor(e,t=sn){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${xt(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[Ke](e){return hn(e)&&qe(this.error,e.error)&&qe(this.annotations,e.annotations)}[ke](){return je(Fe(this._tag))(je(C(this.error))(C(this.annotations)))}};const ln=e=>new rn(e),un=new rn([]),dn=e=>new rn([new cn(e)]);var fn=class extends on{defect;constructor(e,t=sn){super(`Die`,t,e),this.defect=e}toString(){return`Die(${xt(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[Ke](e){return gn(e)&&qe(this.defect,e.defect)&&qe(this.annotations,e.annotations)}[ke](){return je(Fe(this._tag))(je(C(this.defect))(C(this.annotations)))}};const pn=e=>new rn([new fn(e)]),mn=b(e=>nn(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new rn(e.reasons.map(e=>e.annotate(t,n)))),hn=e=>e._tag===`Fail`,gn=e=>e._tag===`Die`,_n=e=>e._tag===`Interrupt`;function vn(e){return En(`Effect.evaluate: Not implemented`)}const yn=e=>({...Zt,[Vt]:e.op,[Ht]:e[Ht]??vn,[Ut]:e[Ut],[Wt]:e[Wt],[Gt]:e[Gt]}),bn=e=>{let t=yn(e);return function(){let n=Object.create(t);return n[w]=e.single===!1?arguments:arguments[0],n}},xn=e=>{let t={...yn(e),[zt]:zt,_tag:e.op,get[e.prop](){return this[w]},toString(){return`${e.op}(${xt(this[w])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[w]}},[Ke](e){return $t(e)&&e._tag===this._tag&&qe(this[w],e[w])},[ke](){return je(Fe(e.op),C(this[w]))}};return function(e){let n=Object.create(t);return n[w]=e,n}},T=xn({op:`Success`,prop:`value`,[Ht](e){let t=e.getCont(Ut);return t?t[Ut](this[w],e,this):e.yieldWith(this)}}),Sn={key:`effect/Cause/StackTrace`},Cn={key:`effect/Cause/InterruptorStackTrace`},wn=xn({op:`Failure`,prop:`cause`,[Ht](e){let t=this[w],n=!1;e.currentStackFrame&&(t=mn(t,{mapUnsafe:new Map([[Sn.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(Wt);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(Wt);return r?r[Wt](t,e,n?void 0:this):e.yieldWith(n?this:wn(t))}}),Tn=e=>wn(dn(e)),En=e=>wn(pn(e)),E=bn({op:`WithFiber`,[Ht](e){return this[w](e)}}),Dn=function(){class e extends globalThis.Error{asEffect(){return Tn(this)}}return Object.assign(e.prototype,Xt),e}(),On=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Dn{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}}}}(),kn=e=>{class t extends On{_tag=e}return t.prototype.name=e,t},An=`~effect/Cause/NoSuchElementError`;var jn=class extends kn(`NoSuchElementError`){[An]=An;constructor(e){super({message:e})}};const Mn=`~effect/Cause/Done`,Nn=e=>S(e,Mn),Pn={[Mn]:Mn,_tag:`Done`,value:void 0},Fn=e=>e===void 0?Pn:{[Mn]:Mn,_tag:`Done`,value:e},In=Tn(Pn),Ln=e=>e===void 0?In:Tn(Fn(e)),Rn=`~effect/data/Option`,zn={[Rn]:{_A:e=>e},...qt,...Yt},Bn=Object.assign(Object.create(zn),{_tag:`Some`,_op:`Some`,[Ke](e){return Un(e)&&Gn(e)&&qe(this.value,e.value)},[ke](){return je(C(this._tag))(C(this.value))},toString(){return`some(${xt(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:kt(this.value)}},asEffect(){return T(this.value)}});Object.defineProperty(Bn,`valueOrUndefined`,{get(){return this.value}});const Vn=C(`None`),Hn=Object.assign(Object.create(zn),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[Ke](e){return Un(e)&&Wn(e)},[ke](){return Vn},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}},asEffect(){return Tn(new jn)}}),Un=e=>S(e,Rn),Wn=e=>e._tag===`None`,Gn=e=>e._tag===`Some`,Kn=Object.create(Hn),qn=e=>{let t=Object.create(Bn);return t.value=e,t},Jn=`~effect/data/Result`,Yn={[Jn]:{_A:e=>e,_E:e=>e},...qt,...Yt},Xn=Object.assign(Object.create(Yn),{_tag:`Success`,_op:`Success`,[Ke](e){return Qn(e)&&er(e)&&qe(this.success,e.success)},[ke](){return je(C(this._tag))(C(this.success))},toString(){return`success(${xt(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:kt(this.success)}},asEffect(){return T(this.success)}}),Zn=Object.assign(Object.create(Yn),{_tag:`Failure`,_op:`Failure`,[Ke](e){return Qn(e)&&$n(e)&&qe(this.failure,e.failure)},[ke](){return je(C(this._tag))(C(this.failure))},toString(){return`failure(${xt(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:kt(this.failure)}},asEffect(){return Tn(this.failure)}}),Qn=e=>S(e,Jn),$n=e=>e._tag===`Failure`,er=e=>e._tag===`Success`,tr=e=>{let t=Object.create(Zn);return t.failure=e,t},nr=e=>{let t=Object.create(Xn);return t.success=e,t};function rr(e){return(t,n)=>t===n?0:e(t,n)}const ir=rr((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),ar=rr((e,t)=>e<t?-1:1),or=b(2,(e,t)=>rr((n,r)=>{let i=e(n,r);return i===0?t(n,r):i})),sr=b(2,(e,t)=>rr((n,r)=>e(t(n),t(r)))),cr=e=>b(2,(t,n)=>e(t,n)===1),D=()=>Kn,O=qn,lr=Un,ur=Wn,dr=Gn,fr=b(2,(e,{onNone:t,onSome:n})=>ur(e)?t():n(e.value)),pr=b(2,(e,t)=>ur(e)?t():e.value),mr=e=>e==null?D():O(e),hr=e=>e===null?D():O(e),gr=pr(se),_r=pr(ce),vr=e=>(...t)=>{try{return O(e(...t))}catch{return D()}},yr=b(2,(e,t)=>{if(dr(e))return e.value;throw t()}),br=b(2,(e,t)=>ur(e)?D():O(t(e.value))),xr=b(2,(e,t)=>ur(e)?D():t(e.value)),Sr=b(2,(e,t)=>ur(e)?D():t(e.value)?O(e.value):D()),Cr=e=>lt((t,n)=>ur(t)?ur(n):ur(n)?!1:e(t.value,n.value)),wr=nr,Tr=tr,Er=Qn,k=$n,Dr=er,Or=ft,kr=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(dr(e))return e;n++}return D()}),Ar={[Symbol.iterator](){return jr}},jr={next(){return{done:!0,value:void 0}}},Mr=()=>Ar,Nr=b(2,(e,t)=>Object.hasOwn(e,t)),Pr=e=>Object.keys(e),Fr=e=>b(2,(t,n)=>{for(let r of Pr(t))if(!Nr(n,r)||!e(t[r],n[r]))return!1;return!0}),Ir=e=>{let t=Fr(e);return(e,n)=>t(e,n)&&t(n,e)},Lr=globalThis.Array,Rr=e=>Lr.isArray(e)?e:Lr.from(e),zr=e=>Lr.isArray(e)?e:[e],Br=b(2,(e,t)=>[...e,t]),Vr=b(2,(e,t)=>Rr(e).concat(Rr(t))),Hr=Lr.isArray,Ur=e=>e.length===0,Wr=mt,Gr=mt;function Kr(e,t){return e<0||e>=t.length}const qr=b(2,(e,t)=>{let n=Math.floor(t);return Kr(n,e)?D():O(e[n])}),Jr=b(2,(e,t)=>{let n=Math.floor(t);if(Kr(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]}),Yr=qr(0),Xr=Jr(0),Zr=e=>e[e.length-1],Qr=e=>e.slice(1),$r=kr,ei=b(2,(e,t)=>{let n=Lr.from(e);return n.sort(t),n}),ti=b(3,(e,t,n)=>{let r=Rr(e),i=Rr(t);return Gr(r)?Gr(i)?li(n)(Vr(r,i)):r:i}),ni=b(2,(e,t)=>ti(e,t,ct())),ri=()=>[],ii=e=>[e],ai=b(2,(e,t)=>e.map(t)),oi=b(2,(e,t)=>{if(Ur(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),si=b(2,(e,t)=>{let n=Rr(e),r=[];for(let e=0;e<n.length;e++)t(n[e],e)&&r.push(n[e]);return r}),ci=pt,li=b(2,(e,t)=>{let n=Rr(e);if(Gr(n)){let e=[Xr(n)],r=Qr(n);for(let n of r)e.every(e=>!t(n,e))&&e.push(n);return e}return[]}),ui=`~effect/BigDecimal`,di={[ui]:ui,[ke](){let e=vi(this);return je(C(e.value),Pe(e.scale))},[Ke](e){return fi(e)&&Si(this,e)},toString(){return`BigDecimal(${Ci(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Ot](){return this.toJSON()},pipe(){return y(this,arguments)}},fi=e=>S(e,ui),pi=(e,t)=>{let n=Object.create(di);return n.value=e,n.scale=t,n},mi=(e,t)=>{if(e!==hi&&e%gi===hi)throw RangeError(`Value must be normalized`);let n=pi(e,t);return n.normalized=n,n},hi=BigInt(0),gi=BigInt(10),_i=mi(hi,0),vi=e=>{if(e.normalized===void 0)if(e.value===hi)e.normalized=_i;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=mi(BigInt(t.substring(0,t.length-n)),e.scale-n)}return e.normalized},yi=b(2,(e,t)=>t>e.scale?pi(e.value*gi**BigInt(t-e.scale),t):t<e.scale?pi(e.value/gi**BigInt(e.scale-t),t):e),bi=e=>e.value<hi?pi(-e.value,e.scale):e,xi=lt((e,t)=>e.scale>t.scale?yi(t,e.scale).value===e.value:e.scale<t.scale?yi(e,t.scale).value===t.value:e.value===t.value),Si=b(2,(e,t)=>xi(e,t)),Ci=e=>{let t=vi(e);if(Math.abs(t.scale)>=16)return wi(t);let n=t.value<hi,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},wi=e=>{if(Ti(e))return`0e+0`;let t=vi(e),n=`${bi(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Ei(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},Ti=e=>e.value===hi,Ei=e=>e.value<hi,Di=`~effect/time/Duration`,Oi=BigInt(0),ki=BigInt(1e3),Ai=BigInt(1e6),ji=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Mi=e=>{switch(typeof e){case`number`:return Ki(e);case`bigint`:return Wi(e);case`string`:{let t=ji.exec(e);if(!t)break;let[n,r,i]=t,a=Number(r);switch(i){case`nano`:case`nanos`:return Wi(BigInt(r));case`micro`:case`micros`:return Gi(BigInt(r));case`milli`:case`millis`:return Ki(a);case`second`:case`seconds`:return qi(a);case`minute`:case`minutes`:return Ji(a);case`hour`:case`hours`:return Yi(a);case`day`:case`days`:return Xi(a);case`week`:case`weeks`:return Zi(a)}break}case`object`:{if(e===null)break;if(Di in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(ge)?Ni(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Vi:e[0]===-1/0||e[1]===-1/0?Ui:e[0]===1/0||e[1]===1/0?Hi:Ri(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 Ri(n);let r=BigInt(n)*Ai;return t.microseconds&&(r+=BigInt(t.microseconds)*ki),t.nanoseconds&&(r+=BigInt(t.nanoseconds)),Ri(r)}}return Ni(e)},Ni=e=>{throw Error(`Invalid Input: ${e}`)},Pi={_tag:`Millis`,millis:0},Fi={_tag:`Infinity`},Ii={_tag:`NegativeInfinity`},Li={[Di]:Di,[ke](){return Le(this.value)},[Ke](e){return zi(e)&&ra(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`}}},[Ot](){return this.toJSON()},pipe(){return y(this,arguments)}},Ri=e=>{let t=Object.create(Li);return typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?t.value=Pi: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?Fi:Ii:e===Oi?t.value=Pi:t.value={_tag:`Nanos`,nanos:e},t},zi=e=>S(e,Di),Bi=e=>e.value._tag!==`Infinity`&&e.value._tag!==`NegativeInfinity`,Vi=Ri(0),Hi=Ri(1/0),Ui=Ri(-1/0),Wi=e=>Ri(e),Gi=e=>Ri(e*ki),Ki=e=>Ri(e),qi=e=>Ri(e*1e3),Ji=e=>Ri(e*6e4),Yi=e=>Ri(e*36e5),Xi=e=>Ri(e*864e5),Zi=e=>Ri(e*6048e5),Qi=e=>ea(e,{onMillis:x,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),$i=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))}},ea=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)()}}),ta=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($i(e),t.value.nanos):n.onNanos(e.value.nanos,$i(t))),na=(e,t)=>ta(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),ra=b(2,(e,t)=>na(e,t)),ia=e=>t=>e(t)?wr(t):Tr(t),aa=e=>t=>!k(e(t)),oa=e=>t=>t.has(e)?wr(t):Tr(t),sa=b(2,(e,t)=>n=>{let r=e(n);return k(r)?r:t(r.success)}),ca=b(2,(e,t)=>n=>{let r=e(n);if(k(r))return Tr(n);let i=t(r.success);return k(i)?Tr(n):i}),la=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,ua),Object.defineProperty(r,`stack`,{get(){return t.stack}}),arguments.length>0?(r.key=arguments[0],arguments[1]?.defaultValue&&(r[da]=da,r.defaultValue=arguments[1].defaultValue),r):function(e,t){return r.key=e,t?.make&&(r.make=t.make),r}},ua={"~effect/ServiceMap/Service":{_Service:e=>e,_Identifier:e=>e},...qt,...Yt,toJSON(){return{_id:`Service`,key:this.key,stack:this.stack}},asEffect(){return(this.asEffect=ie(E(e=>T(Ca(e.services,this)))))()},of(e){return e},serviceMap(e){return ya(this,e)},use(e){return E(t=>e(Ca(t.services,this)))},useSync(e){return E(t=>T(e(Ca(t.services,this))))}},da=`~effect/ServiceMap/Reference`,fa=`~effect/ServiceMap`,pa=e=>{let t=Object.create(ma);return t.mapUnsafe=e,t.mutable=!1,t},ma={...qt,[fa]:{_Services:e=>e},toJSON(){return{_id:`ServiceMap`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Ke](e){if(!ha(e)||this.mapUnsafe.size!==e.mapUnsafe.size)return!1;for(let t of this.mapUnsafe.keys())if(!e.mapUnsafe.has(t)||!qe(this.mapUnsafe.get(t),e.mapUnsafe.get(t)))return!1;return!0},[ke](){return Pe(this.mapUnsafe.size)}},ha=e=>S(e,fa),ga=e=>S(e,da),_a=()=>va,va=pa(new Map),ya=(e,t)=>pa(new Map([[e.key,t]])),ba=b(3,(e,t,n)=>Aa(e,e=>{e.set(t.key,n)})),xa=b(3,(e,t,n)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):ga(t)?Ea(t):n()),Sa=b(2,(e,t)=>{if(!e.mapUnsafe.has(t.key)){if(da in t)return Ea(t);throw Da(t)}return e.mapUnsafe.get(t.key)}),Ca=Sa,wa=(e,t)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):Ea(t),Ta=`~effect/ServiceMap/defaultValue`,Ea=e=>Ta in e?e[Ta]:e[Ta]=e.defaultValue(),Da=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(e.stack){let n=e.stack.split(`
|
|
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
|
+
`);e.splice(1,3),t.stack=e.join(`
|
|
7
|
+
`)}return t},Oa=b(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:Aa(e,e=>{t.mapUnsafe.forEach((t,n)=>e.set(n,t))})),ka=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((e,n)=>{t.set(n,e)});return pa(t)},Aa=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;let n=new Map(e.mapUnsafe);return t(n),pa(n)},ja=A,Ma=ja(`effect/Scheduler`,{defaultValue:()=>new Fa}),Na=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)};var Pa=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}},Fa=class{executionMode;setImmediate;constructor(e=`async`,t=Na){this.executionMode=e,this.setImmediate=t}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new Ia(this.setImmediate)}},Ia=class{tasks=new Pa;running=void 0;setImmediate;constructor(e=Na){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 La=ja(`effect/Scheduler/MaxOpsBeforeYield`,{defaultValue:()=>2048}),Ra=ja(`effect/Scheduler/PreventSchedulerYield`,{defaultValue:()=>!1}),za=`effect/Tracer/ParentSpan`;var Ba=class extends A()(za){};const Va=e=>e,Ha=ja(`effect/Tracer/DisablePropagation`,{defaultValue:oe}),Ua=ja(`effect/Tracer/CurrentTraceLevel`,{defaultValue:()=>`Info`}),Wa=ja(`effect/Tracer/MinimumTraceLevel`,{defaultValue:()=>`All`}),Ga=`effect/Tracer`,Ka=ja(Ga,{defaultValue:()=>Va({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=_r(e.parent)?.traceId??Ja(32),this.spanId=Ja(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 Ja=function(){return function(e){let t=``;for(let n=0;n<e;n++)t+=`abcdef0123456789`.charAt(Math.floor(Math.random()*16));return t}}(),Ya=ja(`effect/References/CurrentConcurrency`,{defaultValue:()=>`unbounded`}),Xa=ja(`effect/References/CurrentStackFrame`,{defaultValue:ce}),Za=ja(`effect/References/TracerEnabled`,{defaultValue:ae}),Qa=ja(`effect/References/TracerTimingEnabled`,{defaultValue:ae}),$a=ja(`effect/References/TracerSpanAnnotations`,{defaultValue:()=>({})}),eo=ja(`effect/References/TracerSpanLinks`,{defaultValue:()=>[]}),to=ja(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),no=ja(`effect/References/CurrentLogLevel`,{defaultValue:()=>`Info`}),ro=ja(`effect/References/MinimumLogLevel`,{defaultValue:()=>`Info`}),io=ja(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),ao=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:so(()=>n.stack)}},oo=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}},so=oo(3);var co=class extends on{fiberId;constructor(e,t=sn){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[Ke](e){return _n(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[ke](){return je(Fe(`${this._tag}:${this.fiberId}`))(Ae(this.annotations))}};const lo=e=>new rn([new co(e)]),uo=e=>{let t=e.reasons.find(hn);return t?wr(t):Tr(e)},fo=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return wr(n.error)}return Tr(e)},po=la(fo),mo=e=>{let t=e.reasons.find(gn);return t?wr(t.defect):Tr(e)},ho=e=>e.reasons.some(_n),go=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?wr(t):Tr(e)},_o=e=>e.reasons.length>0&&e.reasons.every(_n),vo=b(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new rn(ni(e.reasons,t.reasons));return qe(e,n)?e:n}),yo=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},bo=e=>{let t=yo(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`)},xo=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(So(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=Do(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(So(r,n[0].annotations))}return Error.stackTraceLimit=r,t},So=(e,t)=>{let n=typeof e,r;if(e&&n===`object`){if(r=new globalThis.Error(Co(e),{cause:e.cause?So(e.cause):void 0}),typeof e.name==`string`&&(r.name=e.name),typeof e.stack==`string`)r.stack=To(e.stack,r,t);else{let e=`${r.name}: ${r.message}`;r.stack=t?Eo(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:Dt(e):`Unknown error: ${e}`);return r},Co=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 Dt(e)},wo=/\((.*)\)/g,To=(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?Eo(a.join(`
|
|
10
|
+
`),n):a.join(`
|
|
11
|
+
`)},Eo=(e,t)=>{let n=t?.get(Sn.key);return n&&(e=`${e}\n${Oo(n)}`),e},Do=(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(Cn.key);n.push(` at fiber (${t})`),r&&n.push(Oo(r))}return n.join(`
|
|
12
|
+
`)},Oo=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(wo),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
|
+
`)},ko=e=>xo(e).map(e=>e.cause?`${e.stack} {\n${Ao(e.cause,` `)}\n}`:e.stack).join(`
|
|
14
|
+
`),Ao=(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${Ao(e.cause,`${t} `)}\n${t}}`),r},jo=`~effect/Fiber/dev`,Mo={_A:x,_E:x},No={id:0},Po=()=>globalThis[yt];var Fo=class{constructor(e,t=!0){this[jo]=Mo,this.setServices(e),this.id=++No.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}[jo];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 wa(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=lo(e);this.currentStackFrame&&(n=mn(n,ya(Sn,this.currentStackFrame))),t&&(n=mn(n,t)),this._interruptedCause=this._interruptedCause?vo(this._interruptedCause,n):n,this.interruptible&&this.evaluate(Go(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===Kt)return;let n=Io.interruptChildren&&Io.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[yt];globalThis[yt]=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(Jo,()=>e)}if(r=this.currentTracerContext?this.currentTracerContext(r,this):r[Ht](this),i!==this.currentLoopCount)return Kt;if(r===Kt){let e=this._yielded;return zt in e?(this._yielded=void 0,e):Kt}}}catch(e){return S(r,Ht)?this.runLoop(En(e)):En(`Fiber.runLoop: Not a valid effect: ${String(r)}`)}finally{globalThis[yt]=t}}getCont(e){for(;;){let t=this._stack.pop();if(!t)return;let n=t[Gt]&&t[Gt](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,Kt}children(){return this._children??=new Set}pipe(){return y(this,arguments)}setServices(e){this.services=e;let t=this.getRef(Ma);t!==this.currentScheduler&&(this.currentScheduler=t,this._dispatcher=void 0),this.currentSpan=e.mapUnsafe.get(za),this.currentLogLevel=this.getRef(no),this.minimumLogLevel=this.getRef(ro),this.currentStackFrame=e.mapUnsafe.get(Xa.key),this.maxOpsBeforeYield=this.getRef(La),this.currentPreventYield=this.getRef(Ra),this.runtimeMetrics=e.mapUnsafe.get(`effect/observability/Metric/FiberRuntimeMetricsKey`);let n=e.mapUnsafe.get(Ga);this.currentTracerContext=n?n.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag===`Span`?this.currentSpan:void 0}};const Io={interruptChildren:void 0},Lo=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Sn.key,e.currentStackFrame),pa(t)},Ro=e=>{let t=e;return t._exit?j(t._exit):ss(n=>t._exit?n(j(t._exit)):qo(e.addObserver(e=>n(j(e)))))},zo=e=>ss(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?.())}),Bo=e=>{let t=e;return t._exit?t._exit:ss(n=>t._exit?n(t._exit):qo(e.addObserver(n)))},Vo=e=>ss(t=>{let n=Array.from(e);if(n.length===0)return t(j(ri()));let r=Array(n.length),i=ri(),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))}))}),Ho=e=>E(t=>Uo(e,t.id)),Uo=b(e=>S(e[0],jo),(e,t,n)=>E(r=>{let i=Lo(r);return i=i&&n?Oa(i,n):i??n,e.interruptUnsafe(t,i),Ss(Ro(e))})),Wo=e=>E(t=>{let n=Lo(t);for(let r of e)r.interruptUnsafe(t.id,n);return Ss(zo(e))}),j=T,Go=wn,Ko=Tn,qo=bn({op:`Sync`,[Ht](e){let t=this[w](),n=e.getCont(Ut);return n?n[Ut](t,e):e.yieldWith(T(t))}}),M=bn({op:`Suspend`,[Ht](e){return this[w]()}}),Jo=bn({op:`Yield`,[Ht](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Rs)},this[w]??0),e.yieldWith(()=>{t=!0})}})(0),Yo=e=>j(O(e)),Xo=j(D()),Zo=e=>En(e),Qo=e=>M(()=>Ko(Lt(e))),$o=j(void 0),es=e=>M(()=>{try{return j(Lt(e.try))}catch(t){return Ko(Lt(()=>e.catch(t)))}}),ts=e=>as(function(t,n){Lt(()=>e(n)).then(e=>t(j(e)),e=>t(Zo(e)))},e.length!==0),ns=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new su(e,`An error occurred in Effect.tryPromise`):e.catch;return as(function(e,r){try{Lt(()=>t(r)).then(t=>e(j(t)),t=>e(Ko(Lt(()=>n(t)))))}catch(t){e(Ko(Lt(()=>n(t))))}},eval.length!==0)},rs=e=>E(t=>e(t.id)),is=rs(j),as=bn({op:`Async`,single:!1,[Ht](e){let t=Lt(()=>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(os(()=>(n=!0,i?.abort(),a??Rs))),Kt):r}}),os=bn({op:`AsyncFinalizer`,[Gt](e){e.interruptible&&(e.interruptible=!1,e._stack.push(ol))},[Wt](e,t){return ho(e)?N(this[w](),()=>Go(e)):Go(e)}}),ss=e=>as(e,e.length>=2),cs=ss(le),ls=(...e)=>M(()=>_s(e.length===1?e[0]():e[1].call(e[0].self))),us=(e,...t)=>{let n=t.length===0?function(){return M(()=>_s(e.apply(this,arguments)))}:function(){let n=M(()=>_s(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return ds(e.length,n)},ds=(e,t)=>Object.defineProperty(t,`length`,{value:e,configurable:!0}),fs=oo(2),ps=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)=>ms(t,r,i,a,e,n):ms(t,arguments[0],i,Array.prototype.slice.call(arguments,1),e,n)},ms=(e,t,n,r,i,a)=>{let o=typeof t==`function`?t:r.pop().bind(t.self);return ds(o.length,function(...t){let s=M(()=>{let e=o.apply(this,arguments);return Qt(e)?e:_s(e)});for(let e=0;e<r.length;e++)s=r[e](s,...t);if(!Qt(s))return s;let c=globalThis.Error.stackTraceLimit;globalThis.Error.stackTraceLimit=2;let l=new globalThis.Error;return globalThis.Error.stackTraceLimit=c,Ks(i?Wl(e,a,e=>Gl(s,e)):s,Xa,t=>({name:e,stack:fs(()=>l.stack),parent:{name:`${e} (definition)`,stack:fs(()=>n.stack),parent:t}}))})},hs=(e,...t)=>ds(e.length,t.length===0?function(){return gs(()=>e.apply(this,arguments))}:function(){let n=gs(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),gs=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=>_s(t,e))):M(()=>_s(e())))}}}catch(e){return Zo(e)}},_s=bn({op:`Iterator`,single:!1,[Ut](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(!Es(i))return t._stack.push(this),i;if(i._tag===`Failure`)return i;e=i.value}},[Ht](e){return this[Ut](this[w][1],e)}}),vs=b(2,(e,t)=>{let n=j(t);return N(e,e=>n)}),ys=e=>ks(e,O),bs=b(2,(e,t)=>N(e,e=>Qt(t)?t:Lt(()=>t(e)))),xs=b(2,(e,t)=>N(e,e=>vs(Qt(t)?t:Lt(()=>t(e)),e))),Ss=e=>N(e,e=>Rs),Cs=(e,t)=>E(n=>ss(r=>{let i=!1,a=new Set,o=e=>{i=!0,r(a.size===0?e:N(il(Wo(a)),()=>e))},s=0;for(let r of e){if(i)break;let e=s++,c=gl(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 Wo(a)})),ws=b(e=>Qt(e[1]),(e,t,n)=>Cs([e,t],n)),N=b(2,(e,t)=>{let n=Object.create(Ts);return n[w]=e,n[Ut]=t.length===1?t:e=>t(e),n}),Ts=yn({op:`OnSuccess`,[Ht](e){return e._stack.push(this),this[w]}}),Es=e=>zt in e,Ds=b(2,(e,t)=>Es(e)?e._tag===`Success`?t(e.value):e:N(e,t)),Os=e=>N(e,x),ks=b(2,(e,t)=>N(e,e=>j(Lt(()=>t(e))))),As=b(2,(e,t)=>Es(e)?zs(e,t):ks(e,t)),js=b(2,(e,t)=>Es(e)?Bs(e,t):pc(e,t)),Ms=b(2,(e,t)=>Es(e)?Vs(e,t):mc(e,t)),Ns=b(2,(e,t)=>{if(Es(e)){if(e._tag===`Success`)return e;let n=fo(e.cause);return k(n)?e:t(n.success)}return ic(e,t)}),Ps=e=>wn(lo(e)),Fs=e=>e._tag===`Success`,Is=e=>e._tag===`Failure`,Ls=e=>e._tag===`Failure`?wr(e.cause):Tr(e),Rs=T(void 0),zs=b(2,(e,t)=>e._tag===`Success`?T(t(e.value)):e),Bs=b(2,(e,t)=>{if(e._tag===`Success`)return e;let n=fo(e.cause);return k(n)?e:Tn(t(n.success))}),Vs=b(2,(e,t)=>{if(e._tag===`Success`)return T(t.onSuccess(e.value));let n=fo(e.cause);return k(n)?e:Tn(t.onFailure(n.success))}),Hs=b(2,(e,t)=>Fs(e)?t:e),Us=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?Rs:wn(ln(t))},Ws=e=>Fs(e)?O(e.value):D(),Gs=b(2,(e,t)=>E(n=>{let r=n.services,i=t(r);return r===i?e:(n.setServices(i),Xc(e,()=>{n.setServices(r)}))})),Ks=b(3,(e,t,n)=>Gs(e,e=>{let r=Sa(e,t),i=n(r);return r===i?e:ba(e,t,i)})),qs=()=>Js,Js=E(e=>j(e.services)),Ys=e=>E(t=>e(t.services)),Xs=b(2,(e,t)=>Es(e)?e:Gs(e,Oa(t))),Zs=function(){return arguments.length===1?b(2,(e,t)=>Qs(e,arguments[0],t)):b(3,(e,t,n)=>Qs(e,t,n)).apply(this,arguments)},Qs=(e,t,n)=>Gs(e,e=>e.mapUnsafe.get(t.key)===n?e:ba(e,t,n)),$s=b(2,(e,t)=>N(t,t=>t?ys(e):Xo)),ec=b(e=>Qt(e[0]),(e,t)=>pl({while:ae,body:ie(t?.disableYield?e:N(e,e=>Jo)),step:le})),tc=b(2,(e,t)=>{let n=Object.create(nc);return n[w]=e,n[Wt]=t.length===1?t:e=>t(e),n}),nc=yn({op:`OnFailure`,[Ht](e){return e._stack.push(this),this[w]}}),rc=b(3,(e,t,n)=>tc(e,e=>{let r=t(e);return k(r)?Go(r.failure):Lt(()=>n(r.success,e))})),ic=b(2,(e,t)=>rc(e,fo,e=>t(e))),ac=b(2,(e,t)=>tc(e,e=>bs(Lt(()=>t(e)),Go(e)))),oc=b(3,(e,t,n)=>tc(e,e=>{let r=t(e);return k(r)?Go(e):bs(Lt(()=>n(r.success,e)),Go(e))})),sc=b(2,(e,t)=>oc(e,fo,e=>t(e))),cc=b(e=>Qt(e[0]),(e,t,n,r)=>tc(e,e=>{let i=fo(e);return k(i)?Go(i.failure):t(i.success)?Lt(()=>n(i.success)):r?Lt(()=>r(i.success)):Go(e)})),lc=b(e=>Qt(e[0]),(e,t,n,r)=>tc(e,e=>{let i=fo(e);if(k(i))return Go(i.failure);let a=t(i.success);return k(a)?r?Lt(()=>r(a.failure)):Go(e):Lt(()=>n(a.success))})),uc=b(e=>Qt(e[0]),(e,t,n,r)=>cc(e,Array.isArray(t)?e=>S(e,`_tag`)&&t.includes(e._tag):De(t),n,r)),dc=b(e=>Qt(e[0]),(e,t,n)=>{let r;return lc(e,e=>(r??=Object.keys(t),S(e,`_tag`)&&he(e._tag)&&r.includes(e._tag)?wr(e):Tr(e)),e=>Lt(()=>t[e._tag](e)),n)}),fc=b(e=>Qt(e[0]),(e,t,n,r,i)=>cc(e,e=>De(e,t)&&S(e,`reason`),e=>{let t=e.reason;return De(t,n)?r(t,e):i?Lt(()=>i(t,e)):Ko(e)})),pc=b(2,(e,t)=>ic(e,e=>Qo(()=>t(e)))),mc=b(2,(e,t)=>xc(e,{onFailure:e=>Qo(()=>t.onFailure(e)),onSuccess:e=>qo(()=>t.onSuccess(e))})),hc=e=>ic(e,Zo),gc=e=>ic(e,t=>N(Jo,()=>gc(e))),_c=b(e=>Qt(e[0]),(e,t)=>{if(!t?.log)return xc(e,{onFailure:e=>$o,onSuccess:e=>$o});let n=_u(t.log===!0?void 0:t.log);return yc(e,{onFailure(e){let r=uo(e);return k(r)?Go(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>$o})}),vc=e=>Cc(e,{onFailure:Tr,onSuccess:wr}),yc=b(2,(e,t)=>{let n=Object.create(bc);return n[w]=e,n[Ut]=t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),n[Wt]=t.onFailure.length===1?t.onFailure:e=>t.onFailure(e),n}),bc=yn({op:`OnSuccessAndFailure`,[Ht](e){return e._stack.push(this),this[w]}}),xc=b(2,(e,t)=>yc(e,{onFailure:e=>{let n=e.reasons.find(hn);return n?Lt(()=>t.onFailure(n.error)):Go(e)},onSuccess:t.onSuccess})),Sc=b(2,(e,t)=>xc(e,{onFailure:e=>qo(()=>t.onFailure(e)),onSuccess:e=>qo(()=>t.onSuccess(e))})),Cc=b(2,(e,t)=>{if(Es(e)){if(e._tag===`Success`)return T(t.onSuccess(e.value));let n=fo(e.cause);return k(n)?e:T(t.onFailure(n.success))}return Sc(e,t)}),wc=e=>Es(e)?T(e):Tc(e),Tc=bn({op:`Exit`,[Ht](e){return e._stack.push(this),this[w]},[Ut](e,t,n){return j(n??T(e))},[Wt](e,t,n){return j(n??wn(e))}}),Ec=b(2,(e,t)=>bs(tu(t),e)),Dc=b(2,(e,t)=>ws(e,N(tu(t.duration),t.onTimeout))),Oc=b(2,(e,t)=>Dc(e,{duration:t,onTimeout:()=>Ko(new ru)})),kc=b(2,(e,t)=>ws(ys(e),vs(tu(t),D()))),Ac=`~effect/Scope`,jc=`~effect/Scope/Closeable`,Mc=A(`effect/Scope`),Nc=(e,t)=>M(()=>Pc(e,t)??$o),Pc=(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):Fc(e,r,t)},Fc=us(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=Po();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*wc(s(n))):i.push(gl(o,s(n),!0,!0,`inherit`))}return i.length>0&&(r=yield*zo(i)),yield*Us(r)}),Ic=(e,t)=>qo(()=>Lc(e,t)),Lc=(e,t)=>{let n=Hc(t);if(e.state._tag===`Closed`)return n.state=e.state,n;let r={};return Bc(e,r,e=>Nc(n,e)),Bc(n,r,t=>qo(()=>Vc(e,r))),n},Rc=(e,t)=>M(()=>e.state._tag===`Closed`?t(e.state.exit):(Bc(e,{},t),$o)),zc=(e,t)=>Rc(e,ie(t)),Bc=(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)},Vc=(e,t)=>{e.state._tag===`Open`&&e.state.finalizers.delete(t)},Hc=(e=`sequential`)=>({[jc]:jc,[Ac]:Ac,strategy:e,state:Uc}),Uc={_tag:`Empty`},Wc=Mc.asEffect(),Gc=Zs(Mc),Kc=e=>E(t=>{let n=t.services,r=Hc();return t.setServices(ba(t.services,Mc,r)),Xc(e,e=>(t.setServices(n),Pc(r,e)))}),qc=e=>M(()=>{let t=Hc();return Zc(e(t),e=>M(()=>Pc(t,e)??$o))}),Jc=(e,t,n)=>Ys(r=>ll(i=>N(Wc,a=>xs(n?.interruptible?i(e):e,e=>Rc(a,n=>Xs(t(e,n),r)))))),Yc=e=>N(Wc,t=>Ys(n=>Rc(t,t=>Xs(e(t),n)))),Xc=bn({op:`OnExit`,single:!1,[Ht](e){return e._stack.push(this),this[w][0]},[Gt](e){e.interruptible&&this[w][2]!==!0&&(e._stack.push(ol),e.interruptible=!1)},[Ut](e,t,n){n??=T(e);let r=this[w][1](n);return r?N(r,e=>n):n},[Wt](e,t,n){n??=wn(e);let r=this[w][1](n);return r?N(r,e=>n):n}}),Zc=b(2,Xc),Qc=b(2,(e,t)=>Zc(e,e=>t)),$c=b(3,(e,t,n)=>Zc(e,e=>{let r=t(e);return k(r)?$o:n(r.success,e)})),el=b(2,(e,t)=>$c(e,Ls,t)),tl=b(3,(e,t,n)=>Zc(e,e=>{if(e._tag!==`Failure`)return $o;let r=t(e.cause);return k(r)?$o:n(r.success,e.cause)})),nl=b(2,(e,t)=>tl(go,t)(e)),rl=E(e=>Go(lo(e.id))),il=e=>E(t=>t.interruptible?(t.interruptible=!1,t._stack.push(ol),e):e),al=bn({op:`SetInterruptible`,[Gt](e){if(e.interruptible=this[w],e._interruptedCause&&e.interruptible)return()=>Go(e._interruptedCause)}}),ol=al(!0),sl=al(!1),cl=e=>E(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(sl),t._interruptedCause?Go(t._interruptedCause):e)),ll=e=>E(t=>t.interruptible?(t.interruptible=!1,t._stack.push(ol),e(cl)):e(x)),ul=(e,t)=>Oe(e)?t?.mode===`result`?ml(e,vc,t):ml(e,x,t):t?.discard?t.mode===`result`?ml(Object.values(e),vc,t):ml(Object.values(e),x,t):M(()=>{let n={};return vs(ml(Object.entries(e),([e,r])=>ks(t?.mode===`result`?vc(r):r,t=>{n[e]=t}),{discard:!0,concurrency:t?.concurrency}),n)}),dl=(e,t,n,r)=>N(n(r,t),i=>{if(i)return j(O(r));let a=e.next();return a.done?j(D()):dl(e,t+1,n,a.value)}),fl=(e,t,n,r)=>N(n(r,t),r=>{if(Dr(r))return j(O(r.success));let i=e.next();return i.done?j(D()):fl(e,t+1,n,i.value)}),pl=bn({op:`While`,[Ut](e,t){return this[w].step(e),this[w].while()?(t._stack.push(this),this[w].body()):Rs},[Ht](e){return this[w].while()?(e._stack.push(this),this[w].body()):Rs}}),ml=b(e=>typeof e[1]==`function`,(e,t,n)=>E(r=>{let i=n?.concurrency===`inherit`?r.getRef(Ya):n?.concurrency??1,a=i===`unbounded`?1/0:Math.max(1,i);if(a===1)return hl(e,t,n);let o=Rr(e),s=o.length;if(s===0)return n?.discard?$o:j([]);let c=n?.discard?void 0:Array(s),l=0,u=Lo(r);return ss(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=gl(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?wn(ln(i)):j(c)):!m&&!d&&f<a&&g()}})}catch(e){d=!0,s=l,i.push(new fn(e)),n.forEach(e=>e.interruptUnsafe(r.id,u))}}m=!1}return g(),M(()=>(h=!0,l=s,Wo(n)))})})),hl=(e,t,n)=>M(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return vs(pl({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),gl=(e,t,n=!1,r=!1,i=!1)=>{let a=i===`inherit`?e.interruptible:!i,o=new Fo(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},_l=b(e=>Qt(e[0]),(e,t)=>E(n=>j(gl(n,e,t?.startImmediately,!0,t?.uninterruptible)))),vl=b(e=>Qt(e[0]),(e,t,n)=>E(r=>{let i=gl(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit)if(t.state._tag!==`Closed`){let e={};Bc(t,e,()=>rs(e=>e===i.id?$o:Ho(i))),i.addObserver(()=>Vc(t,e))}else i.interruptUnsafe(r.id,Lo(r));return j(i)})),yl=b(e=>Qt(e[0]),(e,t)=>N(Wc,n=>vl(e,n,t))),bl=e=>(t,n)=>{let r=new Fo(n?.scheduler?ba(e,Ma,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},xl=b(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===`Closed`)return e.interruptUnsafe(e.id),e;let n={};return Bc(t,n,()=>Ho(e)),e.addObserver(()=>Vc(t,n)),e}),Sl=bl(_a()),Cl=e=>{let t=bl(e);return(e,n)=>{let r=t(e,n);return n?.onExit&&r.addObserver(n.onExit),e=>r.interruptUnsafe(e)}},wl=Cl(_a()),Tl=e=>{let t=bl(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},El=Tl(_a()),Dl=e=>{let t=Tl(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw bo(e.cause);return e.value})},Ol=Dl(_a()),kl=e=>{let t=bl(e);return e=>{if(Es(e))return e;let n=t(e,{scheduler:new Fa(`sync`)});return n.currentDispatcher?.flush(),n._exit??En(n)}},Al=kl(_a()),jl=e=>{let t=kl(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw bo(n.cause);return n.value}},Ml=jl(_a()),Nl=j(!0),Pl=j(!1);var Fl=class{waiters=[];scheduled=!1;isOpen;constructor(e){this.isOpen=e}scheduleUnsafe(e){return this.scheduled||this.waiters.length===0?Nl:(this.scheduled=!0,e.currentDispatcher.scheduleTask(this.flushWaiters,0),Nl)}flushWaiters=()=>{this.scheduled=!1;let e=this.waiters;this.waiters=[];for(let t=0;t<e.length;t++)e[t](Rs)};open=E(e=>this.isOpen?Pl:(this.isOpen=!0,this.scheduleUnsafe(e)));release=E(e=>this.open?Pl:this.scheduleUnsafe(e));openUnsafe(){return this.isOpen?!1:(this.isOpen=!0,this.flushWaiters(),!0)}await=ss(e=>this.isOpen?e($o):(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=>N(this.await,()=>e)};const Il=e=>new Fl(e??!1),Ll=E(e=>j(e.getRef(Ka))),Rl=BigInt(0),zl={_tag:`Span`,spanId:`noop`,traceId:`noop`,sampled:!1,status:{_tag:`Ended`,startTime:Rl,endTime:Rl,exit:Rs},attributes:new Map,links:[],kind:`internal`,attribute(){},event(){},end(){},addLinks(){}},Bl=e=>Object.assign(Object.create(zl),e),Vl=e=>e?Ca(e.annotations,Ha)?e._tag===`Span`?Vl(_r(e.parent)):D():O(e):D(),Hl=(e,t,n)=>{let r=!e.getRef(Za)||n?.annotations&&Ca(n.annotations,Ha),i=n?.parent===void 0?n?.root?D():Vl(e.currentSpan):O(n.parent),a;if(r)a=Bl({name:t,parent:i,annotations:ba(n?.annotations??_a(),Ha,!0)});else{let r=e.getRef(Ka),o=e.getRef(Yl),s=e.getRef(Qa),c=e.getRef($a),l=e.getRef(eo),u=n?.level??e.getRef(Ua),d=n?.links===void 0?l.slice():[...l,...n.links];a=r.span({name:t,parent:i,annotations:n?.annotations??_a(),links:d,startTime:s?o.currentTimeNanosUnsafe():0n,kind:n?.kind??`internal`,root:n?.root??ur(i),sampled:n?.sampled??(dr(i)&&i.value.sampled===!1?!1:!lu(e.getRef(Wa),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},Ul=(e,t)=>(t=typeof t==`function`?t:ce,Ks(Xa,n=>({name:e,stack:t,parent:n}))),Wl=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return E(t=>{let i=Hl(t,e,n),a=t.getRef(Yl);return Zc(Lt(()=>r(i)),e=>qo(()=>{i.status._tag!==`Ended`&&i.end(a.currentTimeNanosUnsafe(),e)}))})},Gl=Zs(Ba),Kl=function(){let e=Qt(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=x;return t._tag===`Span`&&(n=ao(n),r=Ul(t.name,n?.captureStackTrace)),e?Gl(r(arguments[0]),t):e=>Gl(r(e),t)},ql=function(){let e=typeof arguments[0]!=`string`,t=e?arguments[1]:arguments[0],n=ao(arguments[2]);if(e){let e=arguments[0];return Wl(t,arguments[2],t=>Kl(e,t,n))}let r=typeof arguments[1]==`function`?arguments[1]:void 0,i=r?void 0:arguments[1];return(e,...a)=>Wl(t,r?r(...a):i,t=>Kl(e,t,n))},Jl=(...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 $o}),Yl=ja(`effect/Clock`,{defaultValue:()=>new Zl}),Xl=2**31-1;var Zl=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=qo(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return $l()}currentTimeNanos=qo(()=>this.currentTimeNanosUnsafe());sleep(e){let t=Qi(e);return t<=0?Jo:ss(e=>{if(t>Xl)return;let n=setTimeout(()=>e($o),t);return qo(()=>clearTimeout(n))})}};const Ql=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))}(),$l=function(){let e=typeof process==`object`&&`hrtime`in process&&typeof process.hrtime.bigint==`function`?process.hrtime:void 0;if(!e)return Ql;let t=Ql()-e.bigint();return()=>t+e.bigint()}(),eu=e=>E(t=>e(t.getRef(Yl))),tu=e=>eu(t=>t.sleep(Mi(e))),nu=`~effect/Cause/TimeoutError`;var ru=class extends kn(`TimeoutError`){[nu]=nu;constructor(e){super({message:e})}};const iu=`~effect/Cause/IllegalArgumentError`;var au=class extends kn(`IllegalArgumentError`){[iu]=iu;constructor(e){super({message:e})}};kn(`ExceededCapacityError`);const ou=`~effect/Cause/UnknownError`;var su=class extends kn(`UnknownError`){[ou]=ou;constructor(e,t){super({message:t,cause:e})}};const cu=ja(`effect/Console/CurrentConsole`,{defaultValue:()=>globalThis.console}),lu=cr(sr(ir,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}})),uu=ja(`effect/Loggers/CurrentLoggers`,{defaultValue:()=>new Set([xu,Su])}),du=ja(`effect/Logger/LogToStderr`,{defaultValue:oe}),fu=function(){let e=typeof arguments[0]==`string`?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return il(E(t=>{let n=t.getRef(to),r={...n};for(let t=0;t<e.length;t++){let[n,i]=e[t];r[n]=i}return t.setServices(ba(t.services,to,r)),Rc(Sa(t.services,Mc),r=>{let i=t.getRef(to),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(ba(t.services,to,a)),$o})}))},pu={"~effect/Logger":{_Message:x,_Output:x},pipe(){return y(this,arguments)}},mu=e=>{let t=Object.create(pu);return t.log=e,t},hu=e=>e.replace(/[\s="]/g,`_`),gu=(e,t)=>`${hu(e[0])}=${t-e[1]}ms`,_u=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];nn(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?ln(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=un),E(r=>{let i=e??r.currentLogLevel;if(lu(r.minimumLogLevel,i))return $o;let a=r.getRef(Yl),o=r.getRef(uu);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 $o})},vu={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};vu.gray,vu.blue,vu.green,vu.yellow,vu.red,vu.bgBrightRed,vu.black;const yu=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`)}`,bu=typeof process==`object`&&process!==null&&typeof process.stdout==`object`&&process.stdout!==null;bu&&process.stdout.isTTY,bu||`Deno`in globalThis;const xu=mu(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(ko(e));let o=t.getTime(),s=n.getRef(io),c=``;for(let e of s)c+=` ${gu(e,o)}`;let l=n.getRef(to);Object.keys(l).length>0&&a.push(l);let u=n.getRef(cu);(n.getRef(du)?u.error:u.log)(`[${yu(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),Su=mu(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(Yl),a=t.getRef(to),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`]=ko(e)),o.event(At(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)}),Cu=nn,wu=dn,Tu=pn,Eu=lo,Du=_o,Ou=bo,ku=fo,Au=po,ju=mo,Mu=go,Nu=ko,Pu=jn,Fu=Nn,Iu=Ln,Lu=au,Ru=$t,zu=T,Bu=wn,Vu=Tn,Hu=Rs,Uu=Fs,Wu=Is,Gu=Ws,Ku={"~effect/Deferred":{_A:x,_E:x},pipe(){return y(this,arguments)}},qu=()=>{let e=Object.create(Ku);return e.resumes=void 0,e.effect=void 0,e},Ju=()=>qo(()=>qu()),Yu=e=>ss(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),qo(()=>{let n=e.resumes.indexOf(t);e.resumes.splice(n,1)}))),Xu=b(2,(e,t)=>qo(()=>nd(e,t))),Zu=Xu,Qu=b(2,(e,t)=>Zu(e,Tn(t))),$u=b(2,(e,t)=>Zu(e,wn(t))),ed=b(2,(e,t)=>$u(e,lo(t))),td=b(2,(e,t)=>Zu(e,T(t))),nd=(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},rd=b(2,(e,t)=>ll(n=>N(wc(n(e)),e=>Zu(t,e)))),id=Mc,ad=Hc,od=Gc,sd=Rc,cd=zc,ld=Ic,ud=Lc,dd=Nc,fd=`~effect/Layer`,pd=`~effect/Layer/MemoMap`,md=e=>S(e,fd),hd={[fd]:{_ROut:x,_E:x,_RIn:x},pipe(){return y(this,arguments)}},gd=e=>{let t=Object.create(hd);return t.build=e,t},_d=e=>gd((t,n)=>{let r=ud(n);return Zc(e(t,r),e=>e._tag===`Failure`?dd(r,e):$o)}),vd=e=>{let t=_d((n,r)=>n.getOrElseMemoize(t,r,e));return t};var yd=class{get[pd](){return pd}map=new Map;getOrElseMemoize(e,t,n){if(this.map.has(e)){let n=this.map.get(e);return n.observers++,bs(Rc(t,e=>n.finalizer(e)),n.effect)}let r=ad(),i=qu(),a={observers:1,effect:Yu(i),finalizer:t=>M(()=>(a.observers--,a.observers===0?(this.map.delete(e),dd(r,t)):$o))};return this.map.set(e,a),Rc(t,a.finalizer).pipe(N(()=>n(this,r)),Zc(e=>(a.effect=e,Zu(i,e))))}};const bd=()=>new yd;var xd=class extends A()(`effect/Layer/CurrentMemoMap`){static getOrCreate=xa(this,bd)};const Sd=b(3,(e,t,n)=>Zs(ks(e.build(t,n),ba(xd,t)),xd,t)),Cd=b(2,(e,t)=>E(n=>Sd(e,xd.getOrCreate(n.services),t))),wd=function(){return arguments.length===1?e=>Td(ya(arguments[0],e)):Td(ya(arguments[0],arguments[1]))},Td=e=>gd(ie(j(e))),Ed=function(){return arguments.length===1?e=>Dd(arguments[0],e):Dd(arguments[0],arguments[1])},Dd=(e,t)=>Od(ks(t,t=>ya(e,t))),Od=e=>vd((t,n)=>od(e,n)),kd=e=>Od(vs(e,_a())),Ad=e=>{let t=A(`effect/Layer/unwrap`);return Fd(Ed(t)(e),Ca(t))},jd=(e,t,n)=>{let r=ud(n,`parallel`);return ml(e,e=>e.build(t,ud(r,`sequential`)),{concurrency:e.length}).pipe(ks(e=>ka(...e)))},Md=(...e)=>_d((t,n)=>jd(e,t,n)),Nd=(e,t,n)=>_d((r,i)=>N(Array.isArray(t)?jd(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(Xs(t),ks(e=>n(e,t))))),P=b(2,(e,t)=>Nd(e,t,x)),Pd=b(2,(e,t)=>Nd(e,t,(e,t)=>Oa(t,e))),Fd=b(2,(e,t)=>_d((n,r)=>N(e.build(n,r),e=>t(e).build(n,r)))),Id=function(){return arguments.length===1?e=>Ld(arguments[0],e):Ld(arguments[0],arguments[1])},Ld=(e,t)=>wd(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`,Rd(a)},has:ae})),Rd=e=>{let t=Object.assign(Zo(e),{[zd]:zd,channel:{[Bd]:Bd,transform:()=>j(t),pipe(){return y(this,arguments)}},[Bd]:Bd,transform:()=>j(t)});function n(){return t}return Object.assign(n,t),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n},zd=`~effect/Stream`,Bd=`~effect/Channel`,Vd=`~effect/ExecutionPlan`,Hd={[Vd]:Vd,get withRequirements(){let e=this;return Ys(t=>j(Ud(e.steps.map(e=>({...e,provide:md(e.provide)?P(e.provide,Td(t)):e.provide})))))},pipe(){return y(this,arguments)}},Ud=e=>{let t=Object.create(Hd);return t.steps=e,t},Wd=class extends re{constructor(e){super(),e&&Object.assign(this,e)}},Gd=()=>new Proxy({},{get(e,t,n){return t===`$is`?De:t===`$match`?Kd:e=>({_tag:t,...e})}});function Kd(){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 qd=kn,Jd=`~effect/time/DateTime`,Yd=`~effect/time/DateTime/TimeZone`,Xd={[Jd]:Jd,pipe(){return y(this,arguments)},[Ot](){return this.toString()},toJSON(){return uf(this).toJSON()}},Zd={...Xd,_tag:`Utc`,[ke](){return Pe(this.epochMilliseconds)},[Ke](e){return $d(e)&&e._tag===`Utc`&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${uf(this).toJSON()})`}};({...Xd});const Qd={[Yd]:Yd,[Ot](){return this.toString()}};({...Qd}),{...Qd};const $d=e=>S(e,Jd),ef=e=>e._tag===`Utc`,tf=lt((e,t)=>e.epochMilliseconds===t.epochMilliseconds),nf=e=>{let t=Object.create(Zd);return t.epochMilliseconds=e,Object.defineProperty(t,`partsUtc`,{value:void 0,enumerable:!1,writable:!0}),t},rf=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Lu(`Invalid date`);return nf(t)},af=e=>{if($d(e))return e;if(e instanceof Date)return rf(e);if(typeof e==`object`){if(`epochMilliseconds`in e)return nf(e.epochMilliseconds);let t=new Date(0);return hf(t,e),rf(t)}else if(typeof e==`string`&&!of(e))return rf(new Date(e+`Z`));return rf(new Date(e))},of=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),sf=vr(af),cf=()=>nf(Date.now()),lf=e=>nf(e.epochMilliseconds),uf=e=>new Date(e.epochMilliseconds),df=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},ff=e=>df(e).getTime()-mf(e),pf=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`)}`},mf=e=>e.epochMilliseconds,hf=(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)},gf=e=>uf(e).toISOString();globalThis.String;const _f=e=>e.trim(),vf=e=>e.length>0,yf=b(2,(e,t)=>{let n=e.split(t);return mt(n)?n:[e]}),bf=b(2,(e,t)=>rc(e,Tf,e=>t(e))),xf=e=>e.reasons.some(Sf),Sf=e=>e._tag===`Fail`&&Fu(e.error),Cf=ca(ku,e=>Fu(e)?wr(e):Tr(e)),wf=ia(e=>e.reasons.every(e=>!Sf(e))),Tf=ca(ku,e=>Fu(e)?wr(e.value):Tr(e)),Ef=e=>{let t=Cf(e);return k(t)?Bu(t.failure):zu(t.success.value)},Df=b(2,(e,t)=>yc(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=Cf(e);return k(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),Of=`~effect/Schedule`,kf=ja(`effect/Schedule/CurrentMetadata`,{defaultValue:ie({input:void 0,output:void 0,duration:Vi,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),Af={[Of]:{_Out:x,_In:x,_Env:x},pipe(){return y(this,arguments)}},jf=e=>S(e,Of),Mf=e=>{let t=Object.create(Af);return t.step=e,t},Nf=()=>{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}}},Pf=e=>Mf(ks(e,e=>{let t=Nf();return(n,r)=>e(t(n,r))})),Ff=e=>tc(e.step,e=>j(()=>Go(e))),If=e=>eu(t=>ks(Ff(e),e=>{let n=Nf();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,vs(tu(t),a)})})})),Lf=(e,t=2)=>{let n=Qi(Mi(e));return Pf(j(e=>{let r=Ki(n*t**(e.attempt-1));return j([r,r])}))},Rf=e=>Mf(ks(Ff(e),e=>(t,n)=>Df(e(t,n),{onSuccess:e=>j([n,e[1]]),onFailure:Go,onDone:()=>Iu(n)}))),zf=e=>{let t=Mi(e);return Pf(j(e=>j([e.attempt-1,t])))},Bf=b(2,(e,t)=>Mf(ks(Ff(e),e=>{let n=Nf();return(r,i)=>N(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return N(Qt(s)?s:j(s),t=>t?j(e):Iu(a))})}))),Vf=zf(Vi),Hf=(e,t,n)=>qc(r=>N(n?.local?Sd(t,bd(),r):Cd(t,r),t=>Xs(e,t))),Uf=b(e=>Qt(e[0]),(e,t,n)=>ha(t)?Xs(e,t):Hf(e,Array.isArray(t)?Md(...t):t,n)),Wf=b(3,(e,t,n)=>N(If(t),t=>{let r=kf.defaultValue();return ic(ec(xs(N(M(()=>Zs(e,kf,r)),t),e=>qo(()=>{r=e})),{disableYield:!0}),e=>Nn(e)?j(e.value):n(e,r.attempt===0?D():O(r)))})),Gf=b(3,(e,t,n)=>N(If(t),t=>{let r=kf.defaultValue(),i,a=ic(M(()=>Zs(e,kf,r)),e=>(i=e,N(t(e),e=>(r=e,a))));return bf(a,e=>Lt(()=>n(i,e)))})),Kf=b(2,(e,t)=>Wf(e,typeof t==`function`?t(x):jf(t)?t:Yf(t),Ko)),qf=b(2,(e,t)=>Gf(e,typeof t==`function`?t(x):jf(t)?t:Yf(t),Ko)),Jf=Rf(Vf),Yf=e=>{let t=e.schedule??Jf;return e.while&&(t=Bf(t,({input:t})=>{let n=e.while(t);return Qt(n)?n:j(n)})),e.until&&(t=Bf(t,({input:t})=>{let n=e.until(t);return Qt(n)?ks(n,e=>!e):j(!n)})),e.times!==void 0&&(t=Bf(t,({attempt:t})=>j(t<=e.times))),t};({...Jt});const Xf=ja(`~effect/observability/Metric/MetricRegistryKey`,{defaultValue:()=>new Map}),Zf=e=>{let t=Ca(e,Xf);return Array.from(t.values()).map(({hooks:t,...n})=>({...n,state:t.get(e)}))},Qf=Qt,$f=ul,ep=ml,tp=pl,np=ts,rp=ns,F=j,ip=Xo,ap=Yo,op=M,I=qo,sp=$o,cp=ss,lp=cs,L=ls,R=Ko,up=Go,dp=Zo,fp=es,pp=E,z=N,mp=Os,hp=bs,gp=xs,_p=wc,B=ks,vp=vs,yp=Ss,bp=ic,xp=uc,Sp=dc,Cp=fc,V=tc,wp=lc,Tp=rc,Ep=pc,Dp=hc,Op=sc,kp=ac,Ap=qf,jp=_c,Mp=Oc,Np=kc,Pp=Dc,Fp=Ec,Ip=ws,Lp=$s,Rp=yc,zp=qs,Bp=Ys,Vp=Uf,Hp=Xs,Up=Gs,Wp=Zs,Gp=Wc,Kp=Kc,qp=qc,Jp=Jc,Yp=Yc,Xp=Qc,Zp=el,Qp=Zc,$p=rl,em=nl,tm=il,nm=ec,rm=Kf,im=Ll,am=Jl,om=ql,sm=vl,cm=yl,lm=_l,um=is,dm=Sl,fm=bl,pm=Cl,mm=wl,hm=Ol,gm=Dl,_m=El,vm=Tl,ym=Ml,bm=jl,xm=Al,Sm=kl,Cm=us,H=ps,wm=_u(`Warn`),Tm=_u(`Error`),Em=_u(`Info`),Dm=_u(`Debug`),Om=b(e=>Qf(e[0]),(e,...t)=>Ks(e,to,e=>{let n={...e};return t.length===1?Object.assign(n,t[0]):n[t[0]]=t[1],n})),km=fu,Am=As,jm=js,Mm=Ms,Nm=Ds,Pm=Ns,Fm=hs;function Im(e,t,n){return t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n,e}function Lm(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Rm(e){return t=>Lm(t)?.[e]}const zm=Rm(`identifier`),Bm=Rm(`brands`),Vm=fe(e=>{let t=zm(e);return typeof t==`string`?t:e.getExpected(Vm)});globalThis.RegExp;const Hm=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`),Um=$d,Wm=ef,Gm=tf,Km=rf,qm=sf,Jm=cf,Ym=lf,Xm=mf;A()(`effect/DateTime/CurrentTimeZone`);const Zm=gf;qd(`EncodingError`);const Qm=new WeakMap,$m=`~effect/data/Redacted`,eh=e=>S(e,$m),th=(e,t)=>{let n=Object.create(nh);return t?.label&&(n.label=t.label),Qm.set(n,e),n},nh={[$m]:{_A:e=>e},label:void 0,...qt,toJSON(){return this.toString()},toString(){return`<redacted${he(this.label)?`:`+this.label:``}>`},[ke](){return C(Qm.get(this))},[Ke](e){return eh(e)&&qe(Qm.get(this),Qm.get(e))}},rh=`~effect/SchemaIssue/Issue`;function ih(e){return S(e,rh)}var ah=class{[rh]=rh;toString(){return Ch(this)}},oh=class extends ah{_tag=`Filter`;actual;filter;issue;constructor(e,t,n){super(),this.actual=e,this.filter=t,this.issue=n}},sh=class extends ah{_tag=`Encoding`;ast;actual;issue;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issue=n}},ch=class extends ah{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},lh=class extends ah{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},uh=class extends ah{_tag=`UnexpectedKey`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},dh=class extends ah{_tag=`Composite`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},fh=class extends ah{_tag=`InvalidType`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},ph=class extends ah{_tag=`InvalidValue`;actual;annotations;constructor(e,t){super(),this.actual=e,this.annotations=t}},mh=class extends ah{_tag=`AnyOf`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},hh=class extends ah{_tag=`OneOf`;ast;actual;successes;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.successes=n}};function gh(e,t){if(ih(t))return t;if(t!==void 0)return typeof t==`boolean`?t?void 0:new ph(O(e)):typeof t==`string`?new ph(O(e),{message:t}):new ch(t.path,new ph(O(e),{message:t.message}))}const _h=e=>{let t=Th(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return yh(Vm(e.ast),Dh(e.actual));case`InvalidValue`:return`Invalid data ${Dh(e.actual)}`;case`MissingKey`:return`Missing key`;case`UnexpectedKey`:return`Unexpected key with value ${xt(e.actual)}`;case`Forbidden`:return`Forbidden operation`;case`OneOf`:return`Expected exactly one member to match the input ${xt(e.actual)}`}},vh=e=>Th(e.issue)??Th(e);function yh(e,t){return`Expected ${e}, got ${t}`}function bh(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:yh(xh(e.filter),xt(e.actual))}];default:return bh(e.issue,t,n,r)}}case`Encoding`:return bh(e.issue,t,n,r);case`Pointer`:return bh(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>bh(e,t,n,r));case`AnyOf`:{let i=Th(e);return e.issues.length===0?i===void 0?[{path:t,message:yh(Vm(e.ast),xt(e.actual))}]:[{path:t,message:i}]:e.issues.flatMap(e=>bh(e,t,n,r))}default:return[{path:t,message:n(e)}]}}function xh(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=>xh(e)).join(` & `)}}function Sh(){return e=>bh(e,[],_h,vh).map(wh).join(`
|
|
16
|
+
`)}const Ch=Sh();function wh(e){let t=e.message;if(e.path&&e.path.length>0){let n=wt(e.path);t+=`\n at ${n}`}return t}function Th(e){switch(e._tag){case`InvalidType`:case`OneOf`:case`Composite`:case`AnyOf`:return Eh(e.ast.annotations);case`InvalidValue`:case`Forbidden`:return Eh(e.annotations);case`MissingKey`:return Eh(e.annotations,`messageMissingKey`);case`UnexpectedKey`:return Eh(e.ast.annotations,`messageUnexpectedKey`);case`Filter`:return Eh(e.filter.annotations);case`Encoding`:return Th(e.issue)}}function Eh(e,t=`message`){let n=e?.[t];if(typeof n==`string`)return n}function Dh(e){return ur(e)?`no value provided`:xt(e.value)}var Oh=class e extends re{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(Am(br(t))))}compose(t){return Ah(this)?t:Ah(t)?this:new e((e,n)=>this.run(e,n).pipe(Nm(e=>t.run(e,n))))}};const kh=new Oh(F);function Ah(e){return e.run===kh.run}function jh(){return kh}function Mh(e){return new Oh((t,n)=>ur(t)?ip:e(t.value,n))}function U(e){return Ph(br(e))}function Nh(e){return Mh((t,n)=>e(t,n).pipe(Am(O)))}function Ph(e){return new Oh(t=>F(e(t)))}function Fh(){return U(globalThis.String)}function Ih(){return U(globalThis.Number)}function Lh(){return U(globalThis.BigInt)}function Rh(e){return Mh(t=>fp({try:()=>O(JSON.parse(t,e?.reviver)),catch:e=>new ph(O(t),{message:globalThis.String(e)})}))}function zh(e){return Mh(t=>fp({try:()=>O(JSON.stringify(t,e?.replacer,e?.space)),catch:e=>new ph(O(t),{message:globalThis.String(e)})}))}function Bh(e){let t=e?.separator??`,`;return U(e=>e===``?[]:e.split(t))}const Vh=`~effect/SchemaTransformation/Transformation`;var Hh=class e{[Vh]=Vh;_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 Uh(e){return S(e,Vh)}const Wh=e=>Uh(e)?e:new Hh(e.decode,e.encode);function Gh(e){return new Hh(Nh(e.decode),Nh(e.encode))}function Kh(e){return new Hh(U(e.decode),U(e.encode))}const qh=new Hh(jh(),jh());function Jh(){return qh}const Yh=new Hh(Ih(),Fh()),Xh=new Hh(Lh(),Fh()),Zh=e=>Kh({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 Qh(){return Kh({decode:hr,encode:gr})}function $h(e){return Kh({decode:mr,encode:e?.onNoneEncoding===null?gr:_r})}const eg=new Hh(Rh(),zh()),tg=Gh({decode:e=>fr(qm(e),{onNone:()=>R(new ph(O(e),{message:`Invalid DateTime input`})),onSome:e=>F(Ym(e))}),encode:e=>F(Zm(e))});function ng(e){return t=>t._tag===e}const rg=ng(`Declaration`),ig=ng(`Never`),ag=ng(`Literal`),og=ng(`UniqueSymbol`),sg=ng(`Arrays`),cg=ng(`Objects`),lg=ng(`Union`);var ug=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}};const dg={};var fg=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 pg=`~effect/Schema`;var mg=class{[pg]=pg;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}>`}},hg=class e extends mg{_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)=>ur(t)?ip:Am(e(t.value,this,n),O)}recur(t){let n=h_(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 gg=new class extends mg{_tag=`Null`;getParser(){return N_(this,null)}getExpected(){return`null`}};var _g=class extends mg{_tag=`Undefined`;getParser(){return N_(this,void 0)}toCodecJson(){return o_(this,[vg])}getExpected(){return`undefined`}};const vg=new ug(gg,new Hh(U(()=>void 0),U(()=>null))),yg=new _g,bg=new class extends mg{_tag=`Any`;getParser(){return P_(this,we)}getExpected(){return`any`}},xg=new class extends mg{_tag=`Unknown`;getParser(){return P_(this,we)}getExpected(){return`unknown`}};var Sg=class extends mg{_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 ${xt(e)}`);this.literal=e}getParser(){return N_(this,this.literal)}toCodecJson(){return typeof this.literal==`bigint`?Cg(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Cg(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Cg(e){let t=globalThis.String(e.literal);return o_(e,[new ug(new Sg(t),new Hh(U(()=>e.literal),U(()=>t)))])}const wg=new class extends mg{_tag=`String`;getParser(){return P_(this,he)}getExpected(){return`string`}};var Tg=class extends mg{_tag=`Number`;getParser(){return P_(this,ge)}toCodecJson(){return this.checks&&(Eg(this.checks,`isFinite`)||Eg(this.checks,`isInt`))?this:o_(this,[Xg])}toCodecStringTree(){return this.checks&&(Eg(this.checks,`isFinite`)||Eg(this.checks,`isInt`))?o_(this,[V_]):o_(this,[H_])}getExpected(){return`number`}};function Eg(e,t){return e.some(e=>{switch(e._tag){case`Filter`:return e.annotations?.meta?._tag===t;case`FilterGroup`:return Eg(e.checks,t)}})}const Dg=new Tg,Og=new class extends mg{_tag=`Boolean`;getParser(){return P_(this,_e)}getExpected(){return`boolean`}},kg=new class extends mg{_tag=`BigInt`;getParser(){return P_(this,ve)}toCodecStringTree(){return o_(this,[K_])}getExpected(){return`bigint`}};var Ag=class e extends mg{_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(C_);if(s!==-1&&(t.slice(s+1).some(e=>!C_(e))||n.length>1))throw Error(`A required element cannot follow an optional element. ts(1257)`);if(n.length>1&&n.slice(1).some(C_))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 Fm(function*(e,a){if(e._tag===`None`)return e;let o=e.value;if(!Array.isArray(o))return yield*R(new fh(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=Es(d)?d:yield*_p(d);if(f._tag===`Failure`){let n=ku(f.cause);if(k(n))return yield*f;let r=new ch([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(!C_(r.ast)){let n=new ch([u],new lh(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=Es(r)?r:yield*_p(r);if(i._tag===`Failure`){let n=ku(i.cause);if(k(n))return yield*i;let r=new ch([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 ch([u],new lh(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=Es(f)?f:yield*_p(f);if(p._tag===`Failure`){let n=ku(p.cause);if(k(n))return yield*p;let i=new ch([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 ch([r],new lh(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 ch([n],new uh(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=h_(this.elements,t),r=h_(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 jg=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`,Mg=new globalThis.RegExp(`(?:${jg}|Infinity|-Infinity|NaN)`);function Ng(e,t){let n=T_(t);switch(n._tag){case`String`:return Object.keys(e);case`TemplateLiteral`:{let t=A_(n);return Object.keys(e).filter(e=>t.test(e))}case`Symbol`:return Object.getOwnPropertySymbols(e);case`Number`:return Object.keys(e).filter(e=>Mg.test(e));case`Union`:return[...new Set(n.types.flatMap(t=>Ng(e,t)))];default:return[]}}var Pg=class{name;type;constructor(e,t){this.name=e,this.type=t}},Fg=class e{decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}},Ig=class{parameter;type;merge;constructor(e,t,n){if(this.parameter=e,this.type=t,this.merge=n,C_(t)&&!O_(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Lg=class e extends mg{_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?P_(t,Ce):Fm(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 fh(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 ch([n],new uh(t,l[n]));if(f){d?d.push(e):d=[e];continue}else return yield*R(new dh(t,s,[e]))}else Im(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=Es(a)?a:yield*_p(a);if(o._tag===`Failure`){let e=ku(o.cause);if(k(e))return yield*o;let r=new ch([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`)Im(u,n.name,o.value.value);else if(!C_(n.type)){let e=new ch([n.name],new lh(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=Ng(l,r.parameter);for(let n=0;n<i.length;n++){let a=i[n],o=e(I_(r.parameter))(O(a),c),p=Es(o)?o:yield*_p(o);if(p._tag===`Failure`){let e=ku(p.cause);if(k(e))return yield*p;let n=new ch([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=Es(h)?h:yield*_p(h);if(g._tag===`Failure`){let e=ku(g.cause);if(k(e))return yield*g;let n=new ch([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]);Im(u,n,i)}else Im(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)&&Im(t,n,u[n]);return O(t)}return O(u)})}rebuild(t,n){let r=h_(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new Pg(e.name,n)}),i=h_(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 Ig(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 Rg(e,t,n){return new Lg(Reflect.ownKeys(e).map(t=>new Pg(t,e[t].ast)),[],n,t)}function zg(e){return e.ast}function Bg(e,t=void 0){return new Ag(!1,e.map(e=>e.ast),[],void 0,t)}function Vg(e,t,n){return new Jg(e.map(zg),t,void 0,n)}function Hg(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(Hg)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Ug(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(!C_(t)){if(ag(t))return[{key:e.name,literal:t.literal}];if(og(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>ag(e)&&!C_(e)?[{key:t,literal:e.literal}]:[]);case`Suspend`:return Ug(e.thunk())}}const Wg=new WeakMap;function Gg(e){let t=Wg.get(e);if(t)return t;t={};for(let n of e){let e=T_(n);if(ig(e))continue;let r=Hg(e),i=Ug(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 Wg.set(e,t),t}function Kg(e){return t=>{let n=T_(t);return n._tag===`Literal`?n.literal===e:n._tag===`UniqueSymbol`?n.symbol===e:!0}}function qg(e,t){let n=Gg(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(Kg(e))}}return t}return(n.byType?.[r]??[]).filter(Kg(e))}var Jg=class e extends mg{_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 Fm(function*(n,r){if(n._tag===`None`)return n;let i=n.value,a=t.mode===`oneOf`,o=qg(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=Es(d)?d:yield*_p(d);if(f._tag===`Failure`){let e=ku(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 hh(t,i,c.successes));if(c.out=f.value,c.successes.push(u),!a)break}}return c.out?c.out:yield*R(new mh(t,i,s??[]))})}recur(t){let n=h_(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=T_(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(ag);if(t.length>0)return`${Zg(n.isMutable)}[ ${t.map(t=>e(t)+Qg(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>ag(e.type));if(t.length>0)return`{ ${t.map(t=>`${Zg(t.type.context?.isMutable)}${Ct(t.name)}${Qg(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};const Yg=new Jg([new Sg(`Infinity`),new Sg(`-Infinity`),new Sg(`NaN`)],`anyOf`),Xg=new ug(new Jg([Dg,Yg],`anyOf`),new Hh(Ih(),U(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Zg(e){return e?``:`readonly `}function Qg(e){return e?`?`:``}function $g(e){let t=!1,n;return()=>t?n:(n=e(),t=!0,n)}var e_=class e extends mg{_tag=`Suspend`;thunk;constructor(e,t,n,r,i){super(t,n,r,i),this.thunk=$g(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())}},t_=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 n_([this,e],t)}},n_=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 r_(e,t,n=!1){return new t_((t,n,r)=>gh(t,e(t,n,r)),t,n)}function i_(e,t){let n=e.source;return r_(t=>e.test(t),{expected:`a string matching the RegExp ${n}`,meta:{_tag:`isPattern`,regExp:e},toArbitraryConstraint:{string:{patterns:[e.source]}},...t})}function a_(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function o_(e,t){return e.encoding===t?e:a_(e,e=>{e.encoding.value=t})}function s_(e,t){return e.context===t?e:a_(e,e=>{e.context.value=t})}function c_(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return l_(e,Br(e.checks.slice(0,-1),n.annotate(t)))}return a_(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function l_(e,t){return e.checks===t?e:a_(e,e=>{e.checks.value=t})}function u_(e,t){return l_(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:Br(e.slice(0,e.length-1),new ug(i,r.transformation))}function f_(e){return t=>t.encoding?o_(t,d_(t.encoding,e)):t}function p_(e,t,n){let r=new ug(e,t);return o_(n,n.encoding?[...n.encoding,r]:[r])}function m_(e,t){let n=Bm(e);return c_(e,{brands:n?[...n,t]:[t]})}function h_(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 g_(e,t){return s_(e,e.context?new fg(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new fg(!1,!1,void 0,t))}const __=f_(v_);function v_(e){return __(s_(e,e.context?e.context.isOptional===!1?new fg(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new fg(!0,!1)))}function y_(e,t){let n=[new ug(xg,new Hh(new Oh(e=>{if(ur(Sr(e,Se))){let n=t(e);return Qf(n)?n:F(n)}else return F(e)}),jh()))];return s_(e,e.context?new fg(e.context.isOptional,e.context.isMutable,n,e.context.annotations):new fg(!1,!1,n))}function b_(e,t,n){return p_(e,n,t)}function x_(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=x_(e.types[n]);t.literals=t.literals.concat(r.literals),t.parameters=t.parameters.concat(r.parameters)}return t}}return{literals:[],parameters:[]}}function S_(e,t,n){let{literals:r,parameters:i}=x_(e);return new Lg(r.map(e=>new Pg(e,t)),i.map(e=>new Ig(e,t,n)))}function C_(e){return e.context?.isOptional??!1}const w_=fe(e=>{if(e.encoding)return w_(o_(e,void 0));let t=e;return t.recur?.(w_)??t}),T_=fe(e=>w_(D_(e)));function E_(e,t){let n=t,r=n.length,i=n[r-1],a=[new ug(D_(o_(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new ug(D_(n[e-1].to),n[e].transformation.flip()));let o=D_(i.to);return o.encoding?o_(o,[...o.encoding,...a]):o_(o,a)}const D_=fe(e=>{if(e.encoding)return E_(e,e.encoding);let t=e;return t.flip?.(D_)??t.recur?.(D_)??t});function O_(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(O_);default:return!1}}function k_(e,t){return e.encodedParts.map(e=>M_(e,j_(e),t)).join(``)}const A_=fe(e=>new globalThis.RegExp(`^${k_(e,!0)}$`));function j_(e){switch(e._tag){case`Literal`:return Hm(globalThis.String(e.literal));case`String`:return L_;case`Number`:return jg;case`BigInt`:return U_;case`TemplateLiteral`:return k_(e,!1);case`Union`:return e.types.map(j_).join(`|`)}}function M_(e,t,n){if(lg(e)){if(!n)return`(?:${t})`}else if(!n)return t;return`(${t})`}function N_(e,t){let n=ap(t);return r=>r._tag===`None`?ip:r.value===t?n:R(new fh(e,r))}function P_(e,t){return n=>n._tag===`None`?ip:t(n.value)?F(n):R(new fh(e,n))}function F_(e){function t(n){return n.encoding?o_(n,d_(n.encoding,t)):e(n)}return fe(t)}const I_=F_(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(I_)}}),L_=`[\\s\\S]*?`,R_=new globalThis.RegExp(`^${jg}$`);function z_(e){return i_(R_,{expected:`a string representing a finite number`,meta:{_tag:`isStringFinite`,regExp:R_},...e})}const B_=u_(wg,[z_()]),V_=new ug(B_,Yh),H_=new ug(new Jg([B_,Yg],`anyOf`),Yh),U_=`-?\\d+`,W_=new globalThis.RegExp(`^${U_}$`);function G_(e){return i_(W_,{expected:`a string representing a bigint`,meta:{_tag:`isStringBigInt`,regExp:W_},...e})}const K_=new ug(u_(wg,[G_()]),Xh);function q_(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`)q_(o.checks,t,n,r,i);else{let e=o.run(t,r,i);if(e&&(n.push(new oh(t,o,e)),o.aborted||i?.errors!==`all`))return}}}const J_=`~effect/Schema/Class`;function Y_(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 X_=new hg([],()=>(e,t)=>Y_(e)?F(e):R(new fh(t,O(e))),{typeConstructor:{_tag:`effect/Json`},generation:{runtime:`Schema.Json`,Type:`Schema.Json`},expected:`JSON value`,toCodecJson:()=>new ug(xg,Jh())}),Z_=new ug(gg,new Hh(jh(),U(()=>null))),Q_=new ug(X_,Jh());function $_(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 ev=new ug(new hg([],()=>(e,t)=>$_(e)?F(e):R(new fh(t,O(e))),{expected:`StringTree`,toCodecStringTree:()=>new ug(xg,Jh())}),Jh()),tv=`~effect/collections/MutableHashMap`,nv={[tv]:tv,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${xt(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:kt(Array.from(this))}},[Ot](){return this.toJSON()},pipe(){return y(this,arguments)}},rv=()=>{let e=Object.create(nv);return e.backing=new Map,e.buckets=new Map,e},iv=b(2,(e,t)=>{if(e.backing.has(t))return O(e.backing.get(t));if(ov(t))return D();let n=av.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():cv(e,i,t)}),av=new WeakMap,ov=e=>typeof e!=`object`&&typeof e!=`function`,sv=e=>e.backing.values(),cv=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(qe(n,t[r])){let i=t[r];return av.set(n,i),O(e.backing.get(i))}return D()},lv=b(2,(e,t)=>dr(iv(e,t))),uv=b(3,(e,t,n)=>{if(e.backing.has(t)||ov(t))return e.backing.set(t,n),e;let r=av.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=dv(a,t),r===void 0&&(a.push(t),r=t),e.backing.set(r,n),e)}),dv=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(qe(t,e[n]))return av.set(t,e[n]),e[n]},fv=b(2,(e,t)=>{if(ov(t))return e.backing.delete(t),e;let n=av.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||qe(n,r)){e.backing.delete(r),i.splice(t,1);break}}return i.length===0&&e.buckets.delete(r),e}),pv=Ro,mv=Bo,hv=Vo,gv=Ho,_v=Wo,vv=Po,yv=xl,bv=Il,xv=Symbol.for(`effect/MutableList/Empty`),Sv=()=>({head:void 0,tail:void 0,length:0}),Cv=()=>({array:[],mutable:!0,offset:0,next:void 0}),wv=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=Cv(),e.tail=e.tail.next):e.head=e.tail=Cv(),e.tail.array.push(t),e.length++},Tv=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.length++},Ev=e=>{e.head=e.tail=void 0,e.length=0},Dv=(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 Ev(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&&Ev(e),n;i=i.next}return Ev(e),n},Ov=e=>Dv(e,e.length),kv=e=>{if(!e.head)return xv;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:Ev(e)),t},Av=(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)=>Av(e,e=>e!==t),Mv=`~effect/MutableRef`,Nv={[Mv]:Mv,...qt,toJSON(){return{_id:`MutableRef`,current:kt(this.current)}}},Pv=e=>{let t=Object.create(Nv);return t.current=e,t},Fv=b(2,(e,t)=>(e.current=t,e)),Iv=e=>I(()=>$v(e.atomicPubSub(),new Map,ad(),bv(!1),Pv(!1),e.strategy())),Lv=e=>Iv({atomicPubSub:()=>Rv(e),strategy:()=>new ey}),Rv=e=>new Yv(e?.replay?new ry(e.replay):void 0),zv=b(2,(e,t)=>op(()=>e.shutdownFlag.current?$p:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),F(!0)):e.strategy.handleSurplus(e.pubsub,e.subscribers,[t],e.shutdownFlag))),Bv=b(2,(e,t)=>e.shutdownFlag.current?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),Vv=e=>Jp(I(()=>Jv(e.pubsub,e.subscribers,e.strategy)),Hv),Hv=e=>tm(pp(t=>(Fv(e.shutdownFlag,!0),ep(Ov(e.pollers),e=>ed(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(gp(()=>I(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),Lp(e.shutdownHook.open),yp)))),Uv=e=>op(function t(n){if(e.shutdownFlag.current)return $p;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)):Wr(r)?F(r):z(Wv(e),e=>t([e]))}),Wv=e=>{let t=qu(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),wv(e.pollers,t),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),em(Yu(t),()=>(jv(e.pollers,t),sp))},Gv=Symbol.for(`effect/PubSub/AbsentValue`),Kv=(e,t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},qv=(e,t,n)=>{if(!e.has(t))return;let r=e.get(t);r.delete(n),r.size===0&&e.delete(t)},Jv=(e,t,n)=>new Zv(e,t,e.subscribe(),Sv(),bv(!1),Pv(!1),n,e.replayWindow());var Yv=class{publisherHead={value:Gv,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 iy(this.replayBuffer):ay}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=Gv,this.subscribersIndex+=1),this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.publisherTail.subscribers+=1,new Xv(this,this.publisherTail,this.publisherIndex,!1)}},Xv=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===Gv?(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 xv;let e=!0,t=xv;for(;e;)if(this.subscriberHead===this.self.publisherTail)e=!1;else{let n=this.subscriberHead.next.value;n!==Gv&&(t=n,--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Gv,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===xv?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!==Gv&&(--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Gv,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},Zv=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)}},Qv=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 $v=(e,t,n,r,i,a)=>new Qv(e,t,n,r,i,a);var ey=class{get shutdown(){return sp}handleSurplus(e,t,n,r){return F(!1)}onPubSubEmptySpaceUnsafe(e,t){}completePollersUnsafe(e,t,n,r){return ty(this,e,t,n,r)}completeSubscribersUnsafe(e,t){return ny(this,e,t)}};const ty=(e,t,n,r,i)=>{let a=!0;for(;a&&!r.isEmpty();){let o=kv(i);if(o===xv)qv(n,r,i),i.length===0?a=!1:Kv(n,r,i);else{let a=r.poll();a===xv?Tv(i,o):(nd(o,zu(a)),e.onPubSubEmptySpaceUnsafe(t,n))}}},ny=(e,t,n)=>{for(let[r,i]of n)for(let a of i)e.completePollersUnsafe(t,n,r,a)};var ry=class{capacity;head={value:Gv,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:Gv,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)}},iy=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 ay={remaining:0,take:()=>void 0,takeN:()=>[],takeAll:()=>[]},oy={_A:x,_E:x},sy={"~effect/Queue":oy,"~effect/Queue/Enqueue":oy,"~effect/Queue/Dequeue":oy,...qt,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:xy(this)}}},cy=e=>E(t=>{let n=Object.create(sy);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=Sv(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},j(n)}),ly=e=>cy({capacity:e}),uy=()=>cy(),dy=(e,t)=>M(()=>{if(e.state._tag!==`Open`)return Cy;if(e.messages.length>=e.capacity)switch(e.strategy){case`dropping`:return Cy;case`suspend`:return e.capacity<=0&&e.state.takers.size>0?(wv(e.messages,t),Dy(e),wy):Ay(e,t);case`sliding`:return kv(e.messages),wv(e.messages,t),wy}return wv(e.messages,t),Oy(e),wy}),fy=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(kv(e.messages),wv(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(wv(e.messages,t),Dy(e),!0):!1:(wv(e.messages,t),Oy(e),!0):!1,py=b(2,(e,t)=>qo(()=>my(e,t))),my=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=Hs(wn(t),Ty);return e.state.offers.size===0&&e.messages.length===0?(Ny(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},!0)},hy=e=>py(e,dn(Fn())),gy=e=>qo(()=>{if(e.state._tag===`Done`)return!0;Ev(e.messages);let t=e.state.offers;if(Ny(e,e.state._tag===`Open`?Ey:e.state.exit),t.size>0){for(let e of t)e._tag===`Single`?e.resume(Cy):e.resume(T(e.remaining.slice(e.offset)));t.clear()}return!0}),_y=e=>vy(e,1,1/0),vy=(e,t,n)=>M(()=>ky(e,t,n)??bs(My(e),vy(e,1,n))),yy=e=>M(()=>by(e)??bs(My(e),yy(e))),by=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=kv(e.messages);return jy(e),T(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,jy(e),e.capacity=0;let t=kv(e.messages);return jy(e),T(t)}},xy=e=>e.state._tag===`Done`?0:e.messages.length,Sy=b(2,(e,t)=>ll(n=>yc(n(e),{onFailure:e=>py(t,e),onSuccess:e=>hy(t)}))),Cy=T(!1),wy=T(!0),Ty=Tn(Fn()),Ey=Ps(),Dy=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(Rs),e.messages.length===0)break}},Oy=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>Dy(e),0))},ky=(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,jy(e),e.capacity=0;let t=[kv(e.messages)];return jy(e),T(t)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let t=Dv(e.messages,n);return jy(e),T(t)}},Ay=(e,t)=>ss(n=>{if(e.state._tag!==`Open`)return n(Cy);let r={_tag:`Single`,message:t,resume:n};return e.state.offers.add(r),qo(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),jy=e=>{if(e.state._tag===`Done`)return xf(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0?(Ny(e,e.state.exit),xf(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`)wv(e.messages,n.message),t--,n.resume(wy),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;wv(e.messages,n.remaining[n.offset]),t--}n.resume(T([])),e.state.offers.delete(n)}return!1},My=e=>ss(t=>e.state._tag===`Done`?t(e.state.exit):(e.state.takers.add(t),qo(()=>{e.state._tag!==`Done`&&e.state.takers.delete(t)}))),Ny=(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()},Py=e=>new Fy(e);var Fy=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?ss(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),$o))}release(e){return this.updateTaken(t=>t-e)}get releaseAll(){return this.updateTaken(e=>0)}withPermits(e){return t=>ll(n=>N(n(this.take(e)),e=>Xc(n(t),()=>{this.updateTakenUnsafe(Po(),t=>t-e)},!0)))}get withPermit(){return this.withPermits(1)}withPermitsIfAvailable(e){return t=>ll(n=>this.free<e?Xo:(this.taken+=e,Xc(n(ys(t)),()=>{this.updateTakenUnsafe(Po(),t=>t-e)},!0)))}};const Iy=`~effect/Channel`,Ly=e=>S(e,Iy),Ry={[Iy]:{_Env:x,_InErr:x,_InElem:x,_OutErr:x,_OutElem:x},pipe(){return y(this,arguments)}},zy=e=>{let t=Object.create(Ry);return t.transform=(t,n)=>V(e(t,n),e=>F(up(e))),t},By=(e,t)=>zy((n,r)=>z(Uy(e)(n,r),e=>t(e,r))),Vy=e=>zy((t,n)=>e),Hy=e=>zy(Cm(function*(t,n){let r=ud(n),i=e=>dd(r,Ef(e));return Zp(yield*Zp(e(t,n,r),i),i)})),Uy=e=>e.transform,Wy=(e,t,n)=>cy({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(gp(t=>cd(e,gy(t))),gp(n=>sm(od(t(n),e),e))),Gy=(e,t)=>zy((n,r)=>B(Wy(r,e,t),_y)),Ky=e=>zy((t,n)=>op(()=>Uy(e())(t,n))),qy=Vy(F(Iu())),Jy=e=>Vy(F(R(e))),Yy=e=>Vy(up(e)),Xy=e=>Yy(Tu(e)),Zy=e=>Vy(z(e,()=>Iu())),Qy=e=>Vy(F(_y(e))),$y=e=>Vy(F(em(Uv(e),()=>Iu()))),eb=e=>_b(B(Vv(e),$y)),tb=b(2,(e,t)=>By(e,e=>I(()=>{let n=0;return B(e,e=>t(e,n++))}))),nb=e=>e===void 0||e!==`unbounded`&&e<=1,rb=b(e=>Ly(e[0]),(e,t,n)=>nb(n?.concurrency)?ib(e,t):ab(e,t,n)),ib=(e,t)=>zy((n,r)=>{let i=0;return B(Uy(e)(n,r),z(e=>t(e,i++)))}),ab=(e,t,n)=>Hy(Cm(function*(r,i,a){let o=0,s=yield*Uy(e)(r,i),c=n.concurrency===`unbounded`?2**53-1:n.concurrency,l=yield*ly(0);yield*cd(a,gy(l));let u=fm(yield*zp()),d=yv(a);if(n.unordered){let e=Py(c),n=ie(e.release(1)),r=Rp({onFailure:e=>z(py(l,e),n),onSuccess:e=>z(dy(l,e),n)});yield*e.take(1).pipe(z(()=>s),z(e=>(d(u(r(t(e,o++)))),sp)),nm({disableYield:!0}),V(t=>e.withPermits(c-1)(py(l,t))),sm(a))}else{let e=yield*ly(c-2);yield*cd(a,gy(l)),yield*yy(e).pipe(mp,z(e=>dy(l,e)),nm({disableYield:!0}),V(e=>py(l,e)),sm(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,my(l,e.cause))};yield*s.pipe(z(i=>{if(n)return up(n);let a=u(t(i,o++));return d(a),a.addObserver(r),dy(e,mv(a))}),nm({disableYield:!0}),V(t=>dy(e,Bu(t)).pipe(hp(py(e,t)))),sm(a))}return yy(l)})),ob=e=>By(e,e=>{let t,n=0;return F(op(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)}))}),sb=b(2,(e,t)=>By(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 Gr(i)?F(i):z(e,n)})))),cb=b(e=>Ly(e[0]),(e,t,n,r)=>zy((i,a)=>B(Uy(e)(i,a),e=>{let i=t(),a,o=0,s,c=Rp(e,{onFailure(e){s=e;let t=r?.onHalt&&r.onHalt(i);return t&&t.length>0?F([i,t]):up(e)},onSuccess(e){let t=n(i,e);return Hr(t)?F(t):t}});return op(function e(){if(a===void 0)return s?up(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)})}))),lb=b(2,(e,t)=>zy((n,r)=>{let i=ud(r);return B(Uy(e)(n,i),e=>{let a=e.pipe(V(e=>{if(xf(e))return up(e);let o=i;return i=ud(r),dd(o,Bu(e)).pipe(hp(Uy(t(e))(n,i)),z(e=>(a=e,e)))}));return op(()=>a)})})),ub=b(2,(e,t)=>lb(e,e=>Zy(z(t(e),t=>up(e))))),db=b(3,(e,t,n)=>lb(e,e=>{let r=t(e);return k(r)?Yy(r.failure):n(r.success,e)})),fb=b(2,(e,t)=>db(e,ku,e=>t(e))),pb=b(2,(e,t)=>fb(e,e=>Jy(t(e)))),mb=e=>fb(e,Xy),hb=()=>zy((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
|
+
`);for(n&&=(o===0?(r.push(t),t=``,e=1,o=a.indexOf(`
|
|
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
|
+
`,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 Gr(r)?r:null};return z(e,function t(n){let i=r(n);return i===null?z(e,t):F(i)})})),gb=b(2,(e,t)=>zy((n,r)=>z(Uy(e)(n,r),e=>Uy(t)(e,r)))),_b=e=>zy((t,n)=>{let r;return F(op(()=>r||e.pipe(od(n),z(e=>Uy(e)(t,n)),z(e=>r=e))))}),vb=b(2,(e,t)=>Hy((n,r,i)=>sd(i,t).pipe(hp(Uy(e)(n,r))))),yb=b(2,(e,t)=>By(e,e=>I(()=>{let n=!0,r=gp(e,e=>(n=!1,t(e)));return op(()=>n?r:e)}))),bb=b(2,(e,t)=>vb(e,e=>t)),xb=(e,t,n)=>op(()=>{let r=ad();return bf(z(Uy(e)(Iu(),r),t),n||F).pipe(Qp(e=>dd(r,e)))}),Sb=e=>xb(e,e=>nm(e,{disableYield:!0})),Cb=b(2,(e,t)=>xb(e,e=>nm(z(e,t),{disableYield:!0}))),wb=e=>op(()=>{let t=Symbol(),n=t;return xb(e,e=>nm(z(e,e=>(n=e,sp)),{disableYield:!0}),()=>n===t?ip:ap(n))}),Tb=Cm(function*(e){let t=Py(1),n=yield*zp(),r=Ca(n,id);return(yield*Uy(e)(Iu(),r)).pipe(Hp(n),t.withPermits(1))},V(e=>F(up(e)))),Eb=(e,t)=>Uy(e)(Iu(),t),Db=e=>e,Ob=fe(e=>{switch(e._tag){case`Declaration`:{let t=e.annotations?.[J_];if(xe(t)){let n=t(e.typeParameters),r=Ob(n.to);return o_(e,r===n.to?[n]:[new ug(r,n.transformation)])}return e}case`Objects`:case`Arrays`:return e.recur(e=>{let t=e.context?.defaultValue;return t?o_(Ob(e),t):Ob(e)});case`Suspend`:return e.recur(Ob);default:return e}});function kb(e){let t=zb(Ob(w_(e.ast)));return(e,n)=>t(e,n?.parseOptions)}function Ab(e){let t=kb(e);return(e,n)=>Gu(xm(t(e,n)))}function jb(e){let t=kb(e);return(e,n)=>ym(jm(t(e,n),e=>Error(e.toString(),{cause:e})))}function Mb(e){return Nb(e.ast)}function Nb(e){let t=Bb(zb(w_(e)));return e=>Uu(t(e,dg))}function Pb(e){return zb(e.ast)}function Fb(e){return Vb(Pb(e))}function Ib(e){return Hb(Pb(e))}const Lb=Ib;function Rb(e){return zb(D_(e.ast))}function zb(e){let t=Ub(e);return(e,n)=>Nm(t(O(e),n??dg),e=>e._tag===`None`?R(new ph(e)):F(e.value))}function Bb(e){return(t,n)=>xm(e(t,n))}function Vb(e){let t=Bb(e);return(e,n)=>Gu(t(e,n))}function Hb(e){return(t,n)=>ym(jm(e(t,n),e=>Error(e.toString(),{cause:e})))}const Ub=fe(e=>{let t;if(!e.context&&!e.encoding&&!e.checks)return(n,r)=>(t??=e.getParser(Ub),t(n,Lm(e)?.parseOptions??r));let n=sg(e)||cg(e)||rg(e)&&e.typeParameters.length>0;return(r,i)=>{i=Lm(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=Ub(a);if(o=o?Nm(o,e=>s(e,i)):s(r,i),n.transformation._tag===`Transformation`){let e=n.transformation.decode;o=Nm(o,t=>e.run(t,i))}else o=n.transformation.decode(o,i)}o=jm(o,t=>new sh(e,r,t))}t??=e.getParser(Ub);let s=o?Nm(o,e=>t(e,i)):t(r,i);if(e.checks){let t=e.checks;i?.errors===`all`&&n&&dr(r)&&(s=Pm(s,n=>{let a=[];return q_(t.filter(e=>e.annotations?.[`~structural`]),r.value,a,e,i),R(Wr(a)?n._tag===`Composite`&&n.ast===e?new dh(e,n.actual,[...n.issues,...a]):new dh(e,r,[n,...a]):n)})),s=Nm(s,n=>{if(dr(n)){let r=n.value,a=[];if(q_(t,r,a,e,i),Wr(a))return R(new dh(e,n,a))}return F(n)})}return s}}),Wb=`~effect/Schema/Schema`,Gb={[Wb]:Wb,pipe(){return y(this,arguments)},annotate(e){return this.rebuild(c_(this.ast,e))},annotateKey(e){return this.rebuild(g_(this.ast,e))},check(...e){return this.rebuild(u_(this.ast,e))}};function Kb(e,t){let n=Object.create(Gb);return t&&Object.assign(n,t),n.ast=e,n.rebuild=e=>Kb(e,t),n.makeUnsafe=jb(n),n.makeOption=Ab(n),n}const qb=F_(e=>{let t=Jb(e);return t!==e&&C_(e)?__(t):t});function Jb(e){switch(e._tag){case`Declaration`:{let t=e.annotations?.toCodecJson??e.annotations?.toCodec;if(xe(t)){let n=t(rg(e)?e.typeParameters.map(e=>Kb(T_(e))):[]),r=qb(n.to);return o_(e,r===n.to?[n]:[new ug(r,n.transformation)])}return o_(e,[Z_])}case`Unknown`:case`ObjectKeyword`:return o_(e,[Q_]);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(qb);case`Union`:{let t=Yb(e.types);return t===e.types?e.recur(qb):new Jg(t,e.mode,e.annotations,e.checks,e.encoding,e.context).recur(qb)}case`Arrays`:case`Suspend`:return e.recur(qb)}return e}const Yb=Zb(Xb);function Xb(e){switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}}function Zb(e){return t=>{let n=new Map;for(let e=0;e<t.length;e++)n.set(T_(t[e]),e);let r=[...t].sort((t,r)=>{t=T_(t),r=T_(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 Qb=Wb;function $b(){return(e,t,n)=>W(new hg(e.map(zg),e=>t(e.map(e=>W(e))),n))}function ex(e,t){return $b()([],()=>(t,n)=>e(t)?F(t):R(new fh(n,O(t))),t)}const tx=`~effect/Schema/SchemaError`;var nx=class{[tx]=tx;_tag=`SchemaError`;name=`SchemaError`;issue;constructor(e){this.issue=e}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}};function rx(e){return S(e,tx)}const ix=Mb;function ax(e){let t=Pb(e);return(e,n)=>jm(t(e,n),e=>new nx(e))}const ox=ax,sx=Fb,cx=Ib,lx=Lb;function ux(e){let t=Rb(e);return(e,n)=>jm(t(e,n),e=>new nx(e))}const dx=ux,W=Kb;function fx(e){return S(e,Qb)&&e[Qb]===Qb}const px=Db(e=>W(v_(e.ast),{schema:e})),mx=Db(e=>px(Fx(e))),hx=Db(e=>W(w_(e.ast),{schema:e}));function gx(e){let t=W(new Sg(e),{literal:e,transform(n){return t.pipe(zx(gx(n),{decode:U(()=>n),encode:U(()=>e)}))}});return t}const _x=W(bg),vx=W(xg),yx=W(gg),bx=W(yg),G=W(wg),xx=W(Dg),Sx=W(Og),Cx=W(kg);function wx(e,t){return W(e,{fields:t,mapFields(e,t){let n=e(this.fields);return wx(Rg(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Tx(e){return wx(Rg(e,void 0),e)}function Ex(e,t,n){let r=n?.keyValueCombiner?.decode||n?.keyValueCombiner?.encode?new Fg(n.keyValueCombiner.decode,n.keyValueCombiner.encode):void 0;return W(S_(e.ast,t.ast,r),{key:e,value:t})}function Dx(e,t){return W(e,{elements:t,mapElements(e,t){let n=e(this.elements);return Dx(Bg(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Ox(e){return Dx(Bg(e),e)}const kx=Db(e=>W(new Ag(!1,[],[e.ast]),{schema:e})),Ax=Db(e=>W(new Ag(!1,[e.ast],[e.ast]),{schema:e}));function jx(e,t){return W(e,{members:t,mapMembers(e,t){let n=e(this.members);return jx(Vg(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Mx(e,t){return jx(Vg(e,t?.mode??`anyOf`,void 0),e)}function Nx(e){let t=e.map(gx);return W(Vg(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return Mx(e(this.members))},pick(e){return Nx(e)},transform(e){return Mx(t.map((t,n)=>t.transform(e[n])))}})}const Px=Db(e=>Mx([e,yx])),Fx=Db(e=>Mx([e,bx])),Ix=Db(e=>Mx([e,yx,bx]));function Lx(e){return W(new e_(()=>e().ast))}function Rx(e){return t=>W(m_(t.ast,e),{schema:t,identifier:e})}function zx(e,t){return n=>W(b_(n.ast,e.ast,t?Wh(t):Jh()),{from:n,to:e})}function Bx(e){return t=>W(y_(t.ast,e),{schema:t})}function K(e){return gx(e).pipe(Bx(()=>O(e)))}function Vx(e,t){return Tx({_tag:K(e),...t})}function Hx(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(lg(a)&&`members`in t&&globalThis.Array.isArray(t.members)&&t.members.every(fx))return t.members.forEach(i);let o=Ug(a);if(o.length>0){let i=o.find(t=>t.key===e)?.literal;if(be(i)){n[i]=t,r[i]=ix(hx(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 Ux(e){let t={},n=[];for(let r of Object.keys(e))n.push(t[r]=Vx(r,e[r]));let r=Mx(n),{guards:i,isAnyOf:a,match:o}=Hx(`_tag`)(r);return W(r.ast,{cases:t,isAnyOf:a,guards:i,match:o})}function Wx(e,t){return ex(t=>t instanceof e,t)}function Gx(){return(e,t)=>new ug(e.ast,Wh(t))}function Kx(e){return W($b()([e],([e])=>(t,n,r)=>lr(t)?ur(t)?ip:Mm(Pb(e)(t.value,r),{onSuccess:O,onFailure:e=>new dh(n,O(t),[new ch([`value`],e)])}):R(new fh(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])=>Gx()(Mx([Tx({_tag:gx(`Some`),value:e}),Tx({_tag:gx(`None`)})]),Kh({decode:e=>e._tag===`None`?D():O(e.value),encode:e=>dr(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])=>Cr(e),toFormatter:([e])=>fr({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`})}).ast,{value:e})}function qx(e){return Px(e).pipe(zx(Kx(hx(e)),Qh()))}function Jx(e,t){return Ix(e).pipe(zx(Kx(hx(e)),$h(t)))}const Yx=Tx({message:G,name:px(G),stack:px(G)}),Xx=Wx(globalThis.Error,{typeConstructor:{_tag:`Error`},generation:{runtime:`Schema.Error`,Type:`globalThis.Error`},expected:`Error`,toCodecJson:()=>Gx()(Yx,Zh()),toArbitrary:()=>e=>e.string().map(e=>new globalThis.Error(e))});globalThis.Error;const Zx=new Hh(jh(),U(e=>{try{return JSON.parse(JSON.stringify(e))}catch{return xt(e)}})),Qx=Mx([Yx.pipe(zx(Xx,Zh())),_x.pipe(zx(vx.annotate({toCodecJson:()=>Gx()(_x,Zx),toArbitrary:()=>e=>e.json()}),Zx))]);function $x(e,t){return W($b()([e,t],([e,t])=>{let n=kx(Ox([e,t]));return(e,t,r)=>e instanceof globalThis.Map?Mm(Pb(n)([...e],r),{onSuccess:e=>new globalThis.Map(e),onFailure:n=>new dh(t,O(e),[new ch([`entries`],n)])}):R(new fh(t,O(e)))},{typeConstructor:{_tag:`ReadonlyMap`},generation:{runtime:`Schema.ReadonlyMap(?, ?)`,Type:`globalThis.ReadonlyMap<?, ?>`},expected:`ReadonlyMap`,toCodec:([e,t])=>Gx()(kx(Ox([e,t])),Kh({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])=>rt(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 eS(e){return G.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`,contentSchema:T_(e.ast)}).pipe(zx(e,eg))}globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;const tS=ex(e=>Um(e)&&Wm(e),{typeConstructor:{_tag:`effect/DateTime.Utc`},generation:{runtime:`Schema.DateTimeUtc`,Type:`DateTime.Utc`,importDeclaration:`import * as DateTime from "effect/DateTime"`},expected:`DateTime.Utc`,toCodecJson:()=>Gx()(G,tg),toArbitrary:()=>(e,t)=>e.date({noInvalidDate:!0,...t?.constraints?.date}).map(e=>Km(e)),toFormatter:()=>e=>e.toString(),toEquivalence:()=>Gm}),nS=globalThis.Symbol.for(`immer-draftable`);function rS(e,t,n,r){let i=oS(n,t,r),a=aS(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}(${xt({...this})})`}static[Qb]=Qb;get[a](){return a}static[nS]=!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 Ab(i(this))(e,t)}static annotate(e){return this.rebuild(c_(this.ast,e))}static annotateKey(e){return this.rebuild(g_(this.ast,e))}static check(...e){return this.rebuild(u_(this.ast,e))}static extend(e){return(t,r)=>{let i={...n.fields,...t};return rS(this,e,wx(Rg(i,n.ast.checks,{identifier:e}),i),r)}}static mapFields(e,t){return n.mapFields(e,t)}}}function iS(e){return new Hh(U(t=>new e(t)),jh())}function aS(e){return`~effect/Schema/Class/${e}`}function oS(e,t,n){let r;return i=>{if(r===void 0){let a=iS(i),o=W(new hg([e.ast],()=>(e,n)=>e instanceof i||S(e,aS(t))?F(e):R(new fh(n,O(e))),{identifier:t,[J_]:([e])=>new ug(e,a),toCodec:([e])=>new ug(e.ast,a),toArbitrary:([e])=>()=>e.map(e=>new i(e)),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,"~sentinels":Ug(e.ast),...n}));r=e.pipe(zx(o,a))}return r}}function sS(e){return fx(e)}const cS=e=>(t,n)=>rS(Wd,e,sS(t)?t:Tx(t),n),lS=e=>(t,n,r)=>cS(e??t)(sS(n)?n.mapFields(e=>({_tag:K(t),...e}),{unsafePreserveChecks:!0}):Vx(t,n),r),q=e=>(t,n)=>{let r=rS(On,e,sS(t)?t:Tx(t),n);return r.prototype.name=e,r},uS=e=>(t,n,r)=>q(e??t)(sS(n)?n.mapFields(e=>({_tag:K(t),...e}),{unsafePreserveChecks:!0}):Vx(t,n),r);function dS(e){return W(qb(e.ast))}function fS(e,t){return t?.keepDeclarations===!0?W(SS(bS(e.ast))):W(SS(vS(e.ast)))}function pS(e){switch(e._tag){case`Null`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}}const mS=Zb(pS);function hS(e,t,n){switch(e._tag){case`Declaration`:{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(xe(r)){let n=r(rg(e)?e.typeParameters.map(e=>W(t(T_(e)))):[]),i=t(n.to);return o_(e,i===n.to?[n]:[new ug(i,n.transformation)])}return n(e)}case`Null`:return o_(e,[gS]);case`Boolean`:return o_(e,[_S]);case`Unknown`:case`ObjectKeyword`:return o_(e,[ev]);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=mS(e.types);return n===e.types?e.recur(t):new Jg(n,e.mode,e.annotations,e.checks,e.encoding,e.context).recur(t)}case`Arrays`:case`Suspend`:return e.recur(t)}return e}const gS=new ug(new Sg(`null`),new Hh(U(()=>null),U(()=>`null`))),_S=new ug(new Jg([new Sg(`true`),new Sg(`false`)],`anyOf`),new Hh(U(e=>e===`true`),Fh())),vS=F_(e=>{let t=hS(e,vS,e=>o_(e,[yS]));return t!==e&&C_(e)?__(t):t}),yS=new ug(yg,new Hh(jh(),U(()=>void 0))),bS=F_(e=>{let t=hS(e,bS,x);return t!==e&&C_(e)?__(t):t}),xS=`~effect/Schema/SERIALIZER_ENSURE_ARRAY`,SS=F_(e=>{if(lg(e)&&e.annotations?.[xS])return e;let t=CS(e);if(sg(t)){let n=new Jg([t,b_(wg,t,new Hh(Bh(),jh()))],`anyOf`,{[xS]:!0});return C_(e)?v_(n):n}return t});function CS(e){switch(e._tag){default:return e;case`Declaration`:case`Arrays`:case`Objects`:case`Union`:case`Suspend`:return e.recur(SS)}}const wS={_R:x,_E:x,_A:x},TS={"~effect/Stream":wS,pipe(){return y(this,arguments)}},ES=e=>{let t=Object.create(TS);return t.channel=e,t},DS=e=>S(e,`~effect/Stream`),OS=ES,kS=e=>e.channel,AS=(e,t)=>OS(Gy(e,t)),jS=OS(qy),MS=e=>OS(Ky(()=>e().channel)),NS=e=>OS(Qy(e)),PS=e=>OS(eb(e)),FS=e=>OS(_b(B(e,kS))),IS=b(2,(e,t)=>MS(()=>{let n=0;return OS(tb(e.channel,ai(e=>t(e,n++))))})),LS=b(e=>DS(e[0]),(e,t,n)=>e.channel.pipe(ob,rb(t,n),tb(ii),OS)),RS=b(e=>DS(e[0]),(e,t,n)=>LS(e,e=>vp(t(e),e),n)),zS=b(2,(e,t)=>OS(sb(kS(e),t))),BS=b(2,(e,t)=>e.channel.pipe(ub(t),OS)),VS=b(2,(e,t)=>OS(pb(e.channel,t))),HS=e=>OS(mb(e.channel)),US=b(e=>DS(e[0]),(e,t,n,r)=>OS(cb(e.channel,t,(e,t)=>{let r=ri();for(let i=0;i<t.length;i++){let[a,o]=n(e,t[i]);e=a,r.push(...o)}return[e,Wr(r)?ii(r):WS]},r?.onHalt?{onHalt(e){let t=r.onHalt(e);return Gr(t)?ii(t):WS}}:void 0))),WS=ri(),GS=b(2,(e,t)=>OS(gb(e.channel,t))),KS=b(e=>DS(e[0]),(e,t)=>MS(()=>{let n=new TextDecoder(t?.encoding);return IS(e,e=>n.decode(e,{stream:!0}))})),qS=e=>e.channel.pipe(gb(hb()),OS),JS=b(2,(e,t)=>OS(yb(e.channel,e=>t(e[0])))),YS=b(2,(e,t)=>OS(bb(e.channel,t))),XS=b(2,(e,t)=>qp(n=>Eb(e.channel,n).pipe(z(e=>t.transform(e,n)),B(([e])=>e)))),ZS=e=>B(wb(e.channel),br(Zr)),QS=b(2,(e,t)=>Cb(e.channel,e=>{let n=0;return tp({while:()=>n<e.length,body:()=>t(e[n++]),step:le})})),$S=b(2,(e,t)=>Cb(e.channel,t)),eC=e=>Sb(e.channel),tC=e=>Tb(e.channel),nC=b(e=>DS(e[0]),(e,t,n)=>{let r,i,a=bv(!1);return new ReadableStream({start(n){i=dm(Hp($S(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(Ou(e.cause)):n.close()})},pull(){return new Promise(e=>{r=e,a.openUnsafe()})},cancel(){if(i)return hm(yp(gv(i)))}},n?.strategy)}),rC=b(e=>DS(e[0]),(e,t)=>nC(e,_a(),t)),iC=BigInt(1024);iC*iC*iC*iC*iC;const aC=A(`effect/platform/FileSystem`);function oC(e){return{_tag:`Value`,value:e}}function sC(e,t){return{_tag:`Record`,keys:e,value:t}}function cC(e,t){return{_tag:`Array`,length:e,value:t}}const lC=ja(`effect/ConfigProvider`,{defaultValue:()=>fC()}),uC={...qt,toJSON(){return{_id:`ConfigProvider`}}};function dC(e,t,n){let r=Object.create(uC);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 fC(e){let t=e?.env??{...globalThis?.process?.env,...import.meta?.env},n=pC(t);return dC(e=>F(hC(n,t,e)))}function pC(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 mC=/^(0|[1-9][0-9]*)$/;function hC(e,t,n){let r=t[n.map(String).join(`_`)],i=gC(e,n),a=i?.children?Object.keys(i.children):[];return a.length===0?r===void 0?void 0:oC(r):a.every(e=>mC.test(e))?cC(Math.max(...a.map(e=>parseInt(e,10)))+1,r):sC(new Set(a),r)}function gC(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 _C=`~effect/Config`;var vC=class{_tag=`ConfigError`;name=`ConfigError`;cause;constructor(e){this.cause=e}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}};const yC={...qt,...Yt,[_C]:_C,asEffect(){return z(lC.asEffect(),e=>this.parse(e))},toJSON(){return{_id:`Config`}}};function bC(e){let t=Object.create(yC);return t.parse=e,t}const xC=b(2,(e,t)=>bC(n=>B(e.parse(n),t))),SC=b(2,(e,t)=>bC(n=>bp(e.parse(n),e=>t(e).parse(n))));function CC(e){switch(e._tag){case`MissingKey`:return!0;case`InvalidType`:case`InvalidValue`:return ur(e.actual)||dr(e.actual)&&e.actual.value===void 0;case`OneOf`:return e.actual===void 0;case`Encoding`:return ur(e.actual)||dr(e.actual)&&e.actual.value===void 0?!0:CC(e.issue);case`Pointer`:case`Filter`:return CC(e.issue);case`UnexpectedKey`:return!1;case`Forbidden`:return!1;case`Composite`:case`AnyOf`:return e.issues.every(CC)}}const wC=b(2,(e,t)=>SC(e,e=>{if(rx(e.cause)){let n=e.cause.issue;if(CC(n))return AC(t)}return kC(e.cause)})),TC=e=>e.pipe(xC(O),wC(D())),EC=Cm(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*EC(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*EC(e,[...t,i]));return r}}}),DC=Cm(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*DC(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=Nb(a.parameter);for(let o of i.keys)if(!Object.hasOwn(r,o)&&e(o)){let e=yield*DC(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*DC(e.elements[r],t,[...n,r]));return i}case`Union`:return yield*EC(t,n);case`Suspend`:return yield*DC(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 OC(e,t){let n=fS(e),r=Pb(n),i=T_(n.ast),a=typeof t==`string`?[t]:t??[];return bC(e=>{let t=e.prefix?[...e.prefix,...a]:a;return DC(i,e,a).pipe(Nm(e=>r(e).pipe(jm(e=>new nx(t.length>0?new ch(t,e):e)))),jm(e=>new vC(e)))})}function kC(e){return bC(()=>R(new vC(e)))}function AC(e){return bC(()=>F(e))}function jC(e){return OC(G,e)}const MC=`~effect/FiberSet`,NC=e=>S(e,MC),PC={[MC]:MC,[Symbol.iterator](){return this.state._tag===`Closed`?Mr():this.state.backing[Symbol.iterator]()},...qt,toJSON(){return{_id:`FiberMap`,state:this.state}}},FC=(e,t)=>{let n=Object.create(PC);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},IC=()=>Jp(I(()=>FC(new Set,qu())),e=>op(()=>{let t=e.state;if(t._tag===`Closed`)return sp;e.state={_tag:`Closed`};let n=t.backing;return _v(n).pipe(rd(e.deferred))})),LC=aa(sa(Mu,oa(-1))),RC=b(e=>NC(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),Wu(r)&&(n?.propagateInterruption===!0?!LC(r.cause):!Du(r.cause))&&nd(e.deferred,r))})}),zC=function(){let e;return()=>(e===void 0&&(e=dm($p)),e)}(),BC=e=>()=>B(zp(),t=>{let n=fm(t);return(t,r)=>{if(e.state._tag===`Closed`)return zC();let i=n(t,r);return RC(e,i),i}}),VC=e=>Yu(e.deferred),HC=e=>S(e,`~effect/Logger`),UC=uu,WC=du,GC=/^[^\s"=]*$/,KC=e=>`#${e}`,qC=mu(((e,t)=>({cause:n,date:r,fiber:i,logLevel:a,message:o})=>{let s=t=>t.match(GC)?t:e(t),c=(e,t)=>`${hu(e)}=${s(t)}`,l=(e,t)=>` `+c(e,t),u=c(`timestamp`,r.toISOString());u+=l(`level`,a),u+=l(`fiber`,KC(i.id));let d=zr(o);for(let e=0;e<d.length;e++)u+=l(`message`,xt(d[e],{space:t}));n.reasons.length>0&&(u+=l(`cause`,ko(n)));let f=r.getTime(),p=i.getRef(io);for(let e of p)u+=` `+gu(e,f);let m=i.getRef(to);for(let[e,n]of Object.entries(m))u+=l(e,xt(n,{space:t}));return u})(JSON.stringify,0)),JC=b(2,(e,t)=>N(Wc,n=>{let r=[],i=M(()=>{if(r.length===0)return $o;let e=r;return r=[],t.flush(e)});return ll(a=>a(tu(t.window).pipe(bs(i),ec)).pipe(_l,N(e=>Rc(n,()=>Ho(e))),bs(Yc(()=>i)),vs(mu(t=>{r.push(e.log(t))}))))})),YC=(e,t)=>Ed(UC,E(us(function*(n){let r=new Set(t?.mergeWithExisting===!0?n.getRef(uu):[]);for(let t of e)r.add(Qt(t)?yield*t:t);return r}))),XC=b(e=>HC(e[0]),(e,t,n)=>ls(function*(){let r=yield*(yield*aC).open(t,{flag:`a+`,...n}),i=new TextEncoder;return yield*JC(e,{window:n?.batchWindow??1e3,flush:e=>_c(r.write(i.encode(e.join(`
|
|
21
|
+
`)+`
|
|
22
|
+
`)))})})),ZC=`~effect/ManagedRuntime`,QC=(e,t)=>{let n=t?.memoMap??bd(),r=ad(),i,a=pp(t=>(i||=yv(dm(gp(Sd(e,n,r),e=>I(()=>{o.cachedServices=e})),{scheduler:t.currentScheduler}),r),mp(pv(i)))),o={[ZC]:ZC,memoMap:n,scope:r,servicesEffect:a,cachedServices:void 0,services(){return o.cachedServices===void 0?hm(o.servicesEffect):Promise.resolve(o.cachedServices)},dispose(){return hm(o.disposeEffect)},disposeEffect:op(()=>(o.servicesEffect=dp(`ManagedRuntime disposed`),o.cachedServices=void 0,dd(o.scope,Hu))),runFork(e,t){return o.cachedServices===void 0?dm($C(o,e),t):fm(o.cachedServices)(e,t)},runCallback(e,t){return o.cachedServices===void 0?mm($C(o,e),t):pm(o.cachedServices)(e,t)},runSyncExit(e){return o.cachedServices===void 0?xm($C(o,e)):Sm(o.cachedServices)(e)},runSync(e){return o.cachedServices===void 0?ym($C(o,e)):bm(o.cachedServices)(e)},runPromiseExit(e,t){return o.cachedServices===void 0?_m($C(o,e),t):vm(o.cachedServices)(e,t)},runPromise(e,t){return o.cachedServices===void 0?hm($C(o,e),t):gm(o.cachedServices)(e,t)}};return o};function $C(e,t){return z(e.servicesEffect,e=>Hp(t,e))}const ew=`~effect/match/Match/Matcher`,tw={[ew]:{_input:x,_filters:x,_remaining:x,_result:x,_return:x},_tag:`TypeMatcher`,add(e){return nw([...this.cases,e])},pipe(){return y(this,arguments)}};function nw(e){let t=Object.create(tw);return t.cases=e,t}const rw={[ew]:{_input:x,_filters:x,_result:x,_return:x},_tag:`ValueMatcher`,add(e){return Dr(this.value)?this:e._tag===`When`&&e.guard(this.provided)===!0||e._tag===`Not`&&e.guard(this.provided)===!1?iw(this.provided,wr(e.evaluate(this.provided))):this},pipe(){return y(this,arguments)}};function iw(e,t){let n=Object.create(rw);return n.provided=e,n.value=t,n}const aw=(e,t)=>({_tag:`When`,guard:e,evaluate:t}),ow=e=>{if(typeof e==`function`)return e;if(Array.isArray(e)){let t=e.map(ow),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,ow(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},sw=e=>iw(e,Tr(e)),cw=b(2,(e,t)=>dw(t)(nw([]))(e)),lw=(e,t)=>n=>n.add(aw(ow(e),t)),uw=e=>t=>{let n=aw(n=>n!=null&&n[e]in t,n=>t[n[e]](n));return e=>e.add(n)},dw=(e=>t=>{let n=uw(e)(t);return e=>hw(n(e))})(`_tag`),fw=e=>t=>{let n=pw(t);return Er(n)?n._tag===`Success`?n.success:e(n.failure):t=>{let r=n(t);return Dr(r)?r.success:e(r.failure)}},pw=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?wr(t.evaluate(e)):Tr(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 wr(t.evaluate(n))}return Tr(n)}},mw=`effect/match/Match/exhaustive: absurd`,hw=e=>{let t=pw(e);if(Er(t)){if(Dr(t))return t.success;throw Error(mw)}return e=>{let n=t(e);if(Dr(n))return n.success;throw Error(mw)}},gw=sw,_w=cw,vw=lw,yw=dw,bw=fw,xw=hw,Sw={"~effect/Ref":{_A:x},...qt,toJSON(){return{_id:`Ref`,ref:this.ref}}},Cw=e=>{let t=Object.create(Sw);return t.ref=Pv(e),t},ww=e=>I(()=>Cw(e)),Tw=e=>I(()=>e.ref.current),Ew=b(2,(e,t)=>I(()=>Fv(e.ref,t))),Dw=e=>e.ref.current;({...Mt});var Ow=class extends A()(`effect/process/ChildProcessSpawner`){};const kw=`~effect/unstable/process/ChildProcess`,Aw={...qt,...Yt,[kw]:kw,asEffect(){return Ow.use(e=>e.spawn(this))}},jw=(e,t,n)=>Object.assign(Object.create(Aw),{_tag:`StandardCommand`,command:e,args:t,options:n}),Mw=function(...e){if(Nw(e[0])){let[t,...n]=e,r=Pw(t,n);return jw(r[0]??``,r.slice(1),{})}if(typeof e[0]==`object`&&!Array.isArray(e[0])&&!Nw(e[0])){let t=e[0];return function(e,...n){let r=Pw(e,n);return jw(r[0]??``,r.slice(1),t)}}if(typeof e[0]==`string`&&!Array.isArray(e[1])){let[t,n={}]=e;return jw(t,[],n)}let[t,n=[],r={}]=e;return jw(t,n,r)},Nw=e=>Array.isArray(e)&&`raw`in e&&Array.isArray(e.raw),Pw=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=Fw(e,t,n,i,r);return n},Fw=(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}=zw(r,a),l=Bw(n,c,o);if(i===t.length)return l;let u=t[i];return Bw(l,Array.isArray(u)?u.map(e=>Iw(e)):[Iw(u)],s)},Iw=e=>typeof e==`string`?e:String(e),Lw=new Set([` `,` `,`\r`,`
|
|
23
|
+
`]),Rw={x:3,u:5},zw=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let n=Lw.has(t[0]),r=[],i=0;for(let n=0,a=0;n<e.length;n+=1,a+=1){let o=t[a];if(Lw.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+=Rw[e]??1}}let a=i===e.length;return a||r.push(e.slice(i)),{tokens:r,hasLeadingWhitespace:n,hasTrailingWhitespace:a}},Bw=(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)],Vw=`EXPECT_LIVE_VIEW_URL`;var Hw=class extends Error{constructor(e){super(`${e} is locked`)}};const Uw={old:new Set,young:new Set};let Ww;const Gw=()=>{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},Kw=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)})})}),qw=async(e,t)=>{if(e.host||e.port===0)return Kw(e);for(let n of t)try{await Kw({port:e.port,host:n})}catch(e){if(![`EADDRNOTAVAIL`,`EINVAL`].includes(e.code))throw e}return e.port},Jw=function*(e){e&&(yield*e),yield 0};async function Yw(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)}Ww===void 0&&(Ww=setTimeout(()=>{Ww=void 0,Uw.old=Uw.young,Uw.young=new Set},15e3),Ww.unref&&Ww.unref());let r=Gw();for(let i of Jw(t))try{if(n.has(i))continue;let t=await qw({...e,port:i},r);for(;Uw.old.has(t)||Uw.young.has(t);){if(i!==0)throw new Hw(i);t=await qw({...e,port:i},r)}return Uw.young.add(t),t}catch(e){if(![`EADDRINUSE`,`EACCES`].includes(e.code)&&!(e instanceof Hw))throw e}throw Error(`No available ports found`)}var Xw=class extends q(`CookieDatabaseNotFoundError`)({_tag:K(`CookieDatabaseNotFoundError`),browser:G}){message=`Cookie database not found for ${this.browser}`},Zw=class extends q(`CpdInvalidResponsePayload`)({_tag:K(`CpdInvalidResponsePayload`),code:xx,errorMessage:G}){message=`Network.getAllCookies responded with #${this.code}: ${this.errorMessage}`},Qw=class extends q(`DebuggerUrlNotFoundError`)({_tag:K(`DebuggerUrlNotFoundError`)}){message=`Debugger URL not found`},$w=class extends q(`UnknownError`)({_tag:K(`UnknownError`),cause:vx}){message=`An unexpected error occurred. ${Cu(this.cause)?Nu(this.cause):String(this.cause)}`},eT=class extends q(`RequiresFullDiskAccess`)({_tag:K(`RequiresFullDiskAccess`)}){message=`Safari cookie extraction requires Full Disk Access`},tT=class extends q(`ExtractionError`)({_tag:K(`ExtractionError`),reason:Mx([Zw,Qw,eT,$w])}){message=`Extracting cookies failed. Error: ${this.reason.message}`},nT=class extends q(`CookieDatabaseCopyError`)({_tag:K(`CookieDatabaseCopyError`),browser:G,databasePath:G,cause:G}){message=`Failed to copy cookie database for ${this.browser}: ${this.cause}`},rT=class extends q(`CookieDecryptionKeyError`)({_tag:K(`CookieDecryptionKeyError`),browser:G,platform:G}){message=`Decryption key not found for ${this.browser} on ${this.platform}`},iT=class extends q(`CookieReadError`)({_tag:K(`CookieReadError`),browser:G,cause:G}){message=`Failed to read cookies for ${this.browser}: ${this.cause}`},aT=class extends q(`ListBrowsersError`)({_tag:K(`ListBrowsersError`),cause:G}){message=`Failed to list browsers: ${this.cause}`};const oT=Nx([`Strict`,`Lax`,`None`]);Nx([`chrome`,`edge`,`brave`,`arc`,`dia`,`helium`,`chromium`,`vivaldi`,`opera`,`ghost`,`sidekick`,`yandex`,`iridium`,`thorium`,`sigmaos`,`wavebox`,`comet`,`blisk`,`firefox`,`safari`]);const sT=Nx([`chrome`,`edge`,`brave`,`arc`,`dia`,`helium`,`chromium`,`vivaldi`,`opera`,`ghost`,`sidekick`,`yandex`,`iridium`,`thorium`,`sigmaos`,`wavebox`,`comet`,`blisk`]),cT=G.pipe(zx(G,{decode:U(e=>e.startsWith(`.`)?e.slice(1):e),encode:U(e=>e)}));var lT=class extends cS(`@cookies/Cookie`)({name:G,value:G,domain:cT,path:G,expires:mx(xx.pipe(zx(xx,{decode:U(e=>Math.floor(e)),encode:U(e=>e)}))),secure:Sx,httpOnly:Sx,sameSite:mx(oT)}){static make=cx(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}}},uT=class extends cS(`@cookies/ChromiumBrowser`)({_tag:K(`ChromiumBrowser`),key:sT,profileName:G,profilePath:G,executablePath:G,locale:mx(G)}){static orderBy=e=>or(sr(ar,t=>t.profileName===e),sr(rr((e,t)=>e.localeCompare(t,void 0,{numeric:!0})),e=>e.profileName))},dT=class extends cS(`@cookies/FirefoxBrowser`)({_tag:K(`FirefoxBrowser`),profileName:G,profilePath:G}){},fT=class extends cS(`@cookies/SafariBrowser`)({_tag:K(`SafariBrowser`),cookieFilePath:Jx(G)}){};Mx([uT,dT,fT]),qd(`CookieError`),{...Mt},{...Mt};const pT=Symbol.for(`~effect/http/Headers`),mT=Object.create(null);Object.defineProperties(mT,{[pT]:{value:pT},[ht]:{value(e){return ST(this,Ca(e,CT))}},toJSON:{value(){return _t(this)}},[Ke]:{value(e){return gT(this,e)}},[ke]:{value(){return Le(this)}},toString:{value:Mt.toString},[Ot]:{value:Mt[Ot]}});const hT=e=>Object.assign(Object.create(mT),e),gT=Ir(dt()),_T=Object.create(mT),vT=e=>{if(e===void 0)return _T;if(Symbol.iterator in e){let t=Object.create(mT);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(mT);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},yT=b(3,(e,t,n)=>{let r=hT(e);return r[t.toLowerCase()]=n,r}),bT=b(2,(e,t)=>hT({...e,...vT(t)})),xT=b(2,(e,t)=>{let n=hT(e);return delete n[t.toLowerCase()],n}),ST=b(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=th(e[r]))}else for(let r in e)t.test(r)&&(n[r]=th(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),CT=ja(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]});qd(`HttpClientError`),qd(`StatusCodeError`),qd(`DecodeError`),qd(`EmptyBodyError`);const wT=`~effect/http/UrlParams`,TT={...qt,[wT]:wT,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[Ke](e){return kT(this,e)},[ke](){return ze(this.params.flat())}},ET=e=>{let t=Object.create(TT);return t.params=e,t},DT=e=>{let t=OT(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 ET(n)},OT=e=>{let t=typeof e[Symbol.iterator]==`function`?Rr(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=OT(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},kT=lt((e,t)=>AT(e.params,t.params)),AT=ci(Or([dt(),dt()])),jT=ET([]),MT=b(2,(e,t)=>{let n=DT(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}),NT=`~effect/http/HttpBody`;qd(`HttpBodyError`);var PT=class{[NT];constructor(){this[NT]=NT}[Ot](){return this.toJSON()}toString(){return xt(this,{ignoreToString:!0})}};const FT=new class extends PT{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},IT=`~effect/http/HttpClientRequest`,LT={[IT]:IT,...Mt,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:_t(this.headers),body:this.body.toJSON()}},pipe(){return y(this,arguments)}};function RT(e,t,n,r,i,a){let o=Object.create(LT);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}const zT=RT(`GET`,``,jT,D(),_T,FT),BT=e=>(t,n)=>VT(zT,{method:e,url:t,...n??void 0}),VT=b(2,(e,t)=>{let n=e;return t.method&&(n=HT(n,t.method)),t.url&&(n=qT(n,t.url)),t.headers&&(n=WT(n,t.headers)),t.urlParams&&(n=JT(n,t.urlParams)),t.hash&&(n=YT(n,t.hash)),t.body&&(n=XT(n,t.body)),t.accept&&(n=GT(n,t.accept)),t.acceptJson&&(n=KT(n)),n}),HT=b(2,(e,t)=>RT(t,e.url,e.urlParams,e.hash,e.headers,e.body)),UT=b(3,(e,t,n)=>RT(e.method,e.url,e.urlParams,e.hash,yT(e.headers,t,n),e.body)),WT=b(2,(e,t)=>RT(e.method,e.url,e.urlParams,e.hash,bT(e.headers,t),e.body)),GT=b(2,(e,t)=>UT(e,`Accept`,t)),KT=GT(`application/json`),qT=b(2,(e,t)=>{if(typeof t==`string`)return RT(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=DT(n.searchParams),i=mr(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,RT(e.method,n.toString(),r,i,e.headers,e.body)}),JT=b(2,(e,t)=>RT(e.method,e.url,MT(e.urlParams,t),e.hash,e.headers,e.body)),YT=b(2,(e,t)=>RT(e.method,e.url,e.urlParams,O(t),e.headers,e.body)),XT=b(2,(e,t)=>{let n=e.headers;return t._tag===`Empty`||t._tag===`FormData`?n=xT(xT(n,`Content-Type`),`Content-length`):(t.contentType&&(n=yT(n,`content-type`,t.contentType)),t.contentLength!==void 0&&(n=yT(n,`content-length`,t.contentLength.toString()))),RT(e.method,e.url,e.urlParams,e.hash,n,t)}),ZT=(e,t)=>{let n=ox(dS(e).annotate({options:t}));return e=>z(e.json,n)},QT=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`]],$T=A(`effect/HttpClient`);({...Mt}),{...Object.fromEntries(QT.map(([e,t])=>[t,function(t,n){return this.execute(BT(e)(t,n))}]))};const eE=`~effect/socket/Socket`,tE=e=>S(e,eE),nE=A(`effect/socket/Socket`),rE=e=>S(e,`~effect/socket/Socket/CloseEvent`),iE=`~effect/socket/Socket/SocketError`,aE=e=>S(e,iE);var oE=class extends q(`effect/socket/Socket/SocketReadError`)({_tag:K(`SocketReadError`),cause:Qx}){message=`An error occurred during Read`},sE=class extends q(`effect/socket/Socket/SocketWriteError`)({_tag:K(`SocketWriteError`),cause:Qx}){message=`An error occurred during Write`},cE=class extends q(`effect/socket/Socket/SocketOpenError`)({_tag:K(`SocketOpenError`),kind:Nx([`Unknown`,`Timeout`]),cause:Qx}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},lE=class extends q(`effect/socket/Socket/SocketCloseError`)({_tag:K(`SocketCloseError`),code:xx,closeReason:mx(G)}){static filterClean(e){return function(t){return dE.is(t)&&t.reason._tag===`SocketCloseError`&&e(t.reason.code)?wr(t.reason):Tr(t)}}get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}};const uE=Mx([oE,sE,cE,lE]);var dE=class extends uS(iE)(`SocketError`,{_tag:K(`SocketError`),reason:uE}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[iE]=iE;static is(e){return aE(e)}message=this.reason.message};const fE=(e,t)=>zy(Cm(function*(n,r){let i=yield*cy(),a=yield*ld(r),o=yield*od(e.writer,a),s,c=0,l=tp({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)),nm({disableYield:!0}),Tp(wf,e=>py(i,e)),Xp(dd(a,Hu)),sm(r)),yield*e.runRaw(e=>{fy(i,t(e))}).pipe(Sy(i),sm(r)),_y(i)})),pE=b(e=>tE(e[0]),(e,t)=>{let n=new TextDecoder(t);return fE(e,e=>typeof e==`string`?e:n.decode(e))}),mE=e=>e!==1e3&&e!==1006;var hE=class extends A()(`~effect/socket/Socket/WebSocket`){},gE=class extends A()(`@effect/platform/Socket/WebSocketConstructor`){};const _E=wd(gE)((e,t)=>new globalThis.WebSocket(e,t)),vE=(e,t)=>gE.use(n=>yE(Jp((typeof e==`string`?F(e):e).pipe(B(e=>n(e,t?.protocols))),e=>I(()=>e.close(1e3))),t)),yE=(e,t)=>pp(n=>{let r,i=bv(!1),a=n.services,o=t?.closeCodeIsError??mE,s=(n,s)=>qp(Cm(function*(a){let c=yield*IC().pipe(od(a)),l=yield*od(e,a),u=yield*Wp(BC(c)(),hE,l),d=!1;function f(e){if(e.data instanceof Blob)return u(z(np(()=>e.data.arrayBuffer()),e=>{let t=n(new Uint8Array(e));return Qf(t)?t:sp}));let t=n(e.data);Qf(t)&&u(t)}function p(e){l.removeEventListener(`message`,f),l.removeEventListener(`close`,m),nd(c.deferred,R(new dE({reason:d?new oE({cause:e}):new cE({kind:`Unknown`,cause:e})})))}function m(e){let t=typeof e.code==`number`?e.code:1001;l.removeEventListener(`message`,f),l.removeEventListener(`error`,p),nd(c.deferred,R(new dE({reason:new lE({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=qu();l.addEventListener(`open`,()=>{d=!0,nd(e,sp)},{once:!0}),yield*Yu(e).pipe(Pp({duration:t?.openTimeout??1e4,onTimeout:()=>R(new dE({reason:new cE({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))}),Ip(VC(c)))}return d=!0,r=l,i.openUnsafe(),s?.onOpen&&(yield*s.onOpen),yield*wp(VC(c),lE.filterClean(e=>!o(e)),()=>sp)})).pipe(Up(e=>Oa(a,e)),Xp(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;rE(e)?t.close(e.code,e.reason):t.send(e)})));return F(nE.of({[eE]:eE,run:l,runRaw:s,writer:u}))}),bE=de(vE,Ed(nE)),xE=[`--headless=new`,`--disable-gpu`,`--no-first-run`,`--no-default-browser-check`,`--remote-debugging-address=127.0.0.1`],SE=Tx({id:xx,error:px(Tx({code:xx,message:G})),result:px(Tx({cookies:kx(lT)}))});var CE=class extends A()(`@cookies/CdpClient`,{make:L(function*(){let e=yield*aC,t=yield*Ow,r=yield*$T,i=d.tmpdir(),a=(yield*e.readDirectory(i).pipe(xp(`PlatformError`,()=>F([])))).filter(e=>e.startsWith(`cookies-cdp-`));a.length>0&&(yield*Em(`Cleaning up stale CDP temp directories`,{count:a.length}),yield*ep(a,t=>e.remove(n.join(i,t),{recursive:!0}).pipe(xp(`PlatformError`,()=>sp)),{concurrency:`unbounded`}));let o=H(`CdpClient.getAllCookies`)(function*(){let e=yield*nE,t=yield*e.writer,n=yield*Ju();return yield*e.runRaw(e=>L(function*(){let t=yield*ox(eS(SE))(e.toString());if(t.error)return yield*Qu(n,new tT({reason:new Zw({code:t.error.code,errorMessage:t.error.message})}));t.result&&(yield*td(n,t.result.cookies))})).pipe(kp(e=>Qu(n,new tT({reason:new $w({cause:e})}))),cm),yield*t(JSON.stringify({id:1,method:`Network.getAllCookies`})),yield*Yu(n).pipe(Mp(`10 seconds`))});return{extractCookies:H(`CdpClient.extractCookies`)(function*({key:i,profilePath:a,executablePath:s}){let c=yield*np(()=>Yw());yield*am({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*Mw(s,[`--remote-debugging-port=${c}`,...i===`dia`?[]:[`--user-data-dir=${l}`],`--profile-directory=${u}`,...xE],{stdin:`ignore`}).pipe(t.spawn,cm);let m=yield*r.get(`http://localhost:${c}/json`).pipe(z(ZT(kx(Tx({type:G,webSocketDebuggerUrl:px(G)})))),B($r(e=>e.type===`page`)),B(xr(e=>mr(e.webSocketDebuggerUrl))),z(e=>e.asEffect()),xp(`NoSuchElementError`,()=>new tT({reason:new Qw}).asEffect()),Ap({times:15,schedule:Lf(`100 millis`)})),h=yield*o().pipe(Vp(p.layerWebSocket(m),{local:!0}));return yield*Em(`CDP cookies extracted`,{profile:a,count:h.length}),h},Kp)}})}){static layer=Ed(this)(this.make).pipe(P(s.layer),P(o.layerUndici));static layerTest=Id(this)({extractCookies:()=>F([])})};const wE=`Bun`in globalThis;var TE=class extends A()(`@cookies/SqliteEngine`){static layerBun=wd(this,{open:e=>Jp(rp({try:async()=>{let{Database:t}=await import(`bun:sqlite`);return new t(e,{readonly:!0})},catch:e=>new iT({browser:`unknown`,cause:String(e)})}),e=>I(()=>e.close()))});static layerNodeJs=wd(this,{open:e=>Jp(rp({try:async()=>{let{DatabaseSync:t}=await import(`node:sqlite`);return new t(e,{readOnly:!0,readBigInts:!0})},catch:e=>new iT({browser:`unknown`,cause:String(e)})}),e=>I(()=>e.close()))});static layerLibSql=wd(this,{open:t=>Jp(rp({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 iT({browser:`unknown`,cause:String(e)})}),e=>I(()=>e.close()))})},EE=class extends A()(`@cookies/SqliteClient`,{make:L(function*(){let e=yield*TE,t=yield*aC;return{query:H(`SqliteClient.query`)(function*(t,n,r){yield*am({browser:r,databasePath:t});let i=yield*e.open(t).pipe(Ep(e=>new iT({browser:r,cause:e.cause})));return yield*fp({try:()=>i.prepare(n).all(),catch:e=>new iT({browser:r,cause:String(e)})})},Kp),copyToTemp:H(`SqliteClient.copyToTemp`)(function*(e,r,i,a){let o=yield*t.makeTempDirectory({prefix:r});yield*Yp(()=>t.remove(o,{recursive:!0}).pipe(bp(()=>sp)));let s=n.join(o,i);return yield*t.copyFile(e,s).pipe(xp(`PlatformError`,t=>new nT({browser:a,databasePath:e,cause:String(t)}).asEffect())),yield*t.copyFile(`${e}-wal`,`${s}-wal`).pipe(bp(()=>sp)),yield*t.copyFile(`${e}-shm`,`${s}-shm`).pipe(bp(()=>sp)),{tempDir:o,tempDatabasePath:s}})}})}){static layerBun=Ed(this,this.make).pipe(P(TE.layerBun),P(s.layer));static layerNodeJs=Ed(this,this.make).pipe(P(TE.layerNodeJs),P(s.layer));static layer=wE?this.layerBun:this.layerNodeJs};const DE=(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}),OE=[DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`),DE(`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`)],kE={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`}},AE={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`]},jE=[...OE,kE,AE],ME=new Map,NE=new Map,PE=new Map,FE=new Map;for(let e of jE)if(FE.set(e.key,e),ME.set(e.bundleId.toLowerCase(),e),PE.set(e.displayName,e),`desktopFiles`in e)for(let t of e.desktopFiles)NE.set(t,e);ME.set(`com.microsoft.edge`,FE.get(`edge`));const IE=e=>ME.get(e.toLowerCase()),LE=e=>NE.get(e.replace(/\.desktop$/,``)),RE=e=>OE.find(t=>t.key===e),zE=/^v\d\d$/,BE=(e,t)=>l.pbkdf2Sync(e,`saltysalt`,t,16,`sha1`),VE=(e,t,n)=>{let r=Buffer.from(e);if(r.length<3)return;let i=r.subarray(0,3).toString(`utf8`);if(!zE.test(i))return KE(r,!1);let a=r.subarray(3);if(!a.length)return``;for(let e of t){let t=UE(a,e);if(!t)continue;let r=KE(t,n);if(r!==void 0)return r}},HE=(e,t,n)=>{let r=Buffer.from(e);if(r.length<3)return;let i=r.subarray(0,3).toString(`utf8`);if(!zE.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),KE(Buffer.concat([e.update(c),e.final()]),n)}catch{return}},UE=(e,t)=>{try{let n=Buffer.alloc(16,32),r=l.createDecipheriv(`aes-128-cbc`,t,n);return r.setAutoPadding(!1),WE(Buffer.concat([r.update(e),r.final()]))}catch{return}},WE=e=>{if(!e.length)return e;let t=e[e.length-1];return!t||t>16?e:e.subarray(0,e.length-t)},GE=new TextDecoder(`utf-8`,{fatal:!0}),KE=(e,t)=>{let n=t&&e.length>=32?e.subarray(32):e;try{let e=GE.decode(n),t=0;for(;t<e.length&&e.charCodeAt(t)<32;)t+=1;return e.slice(t)}catch{return}},qE=0x9184e72a000,JE=1e6,YE=11644473600,XE=1e10,ZE=1e3,QE=e=>e>0&&e<=253402300799?Math.round(e):void 0,$E=e=>{if(e!==void 0){if(typeof e==`string`){let t=Number(e);return Number.isFinite(t)?$E(t):void 0}if(typeof e==`bigint`)return e<=0n?void 0:e>BigInt(qE)?QE(Number(e/BigInt(JE)-BigInt(YE))):e>BigInt(XE)?QE(Number(e/BigInt(ZE))):QE(Number(e));if(!(!e||Number.isNaN(e))&&!(e<=0))return QE(e>qE?e/JE-YE:e>XE?e/ZE:e)}},eD=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`}},tD=Tx({os_crypt:Tx({encrypted_key:G})});var nD=class extends A()(`@cookies/ChromiumKeyProvider`){static layerDarwin=Ed(this)(L(function*(){let e=yield*Ow;return{buildDecryptor:H(`ChromiumKeyProvider.buildDecryptor`)(function*(t,n){let r=RE(t),i=yield*e.string(Mw(`security`,[`find-generic-password`,`-w`,`-s`,r.keychainService])).pipe(B(e=>e.trim()),xp(`PlatformError`,()=>new rT({browser:t,platform:`darwin`}).asEffect()));if(!i)return yield*new rT({browser:t,platform:`darwin`}).asEffect();let a=BE(i,1003);return(e=>VE(e,[a],n))})}})).pipe(P(s.layer));static layerLinux=Ed(this)(L(function*(){let e=yield*Ow;return{buildDecryptor:H(`ChromiumKeyProvider.buildDecryptor`)(function*(t,n){let r=[[`secret-tool`,`lookup`,`application`,RE(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(Mw(n,r)).pipe(B(e=>e.trim()),xp(`PlatformError`,()=>F(``)));if(a){i=a;break}}i||=`peanuts`;let a=new Set([i,`peanuts`,``]),o=Array.from(a).map(e=>BE(e,1));return(e=>VE(e,o,n))})}})).pipe(P(s.layer));static layerWin32=Ed(this)(L(function*(){let e=yield*Ow,t=yield*aC;return{buildDecryptor:H(`ChromiumKeyProvider.buildDecryptor`)(function*(r,i){let a=RE(r),o=n.join(u.homedir(),a.localStatePath),s=yield*t.readFileString(o).pipe(xp(`PlatformError`,()=>new rT({browser:r,platform:`win32`}).asEffect())),c=(yield*fp({try:()=>cx(tD)(JSON.parse(s)),catch:()=>new rT({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(Mw(`powershell`,[`-Command`,l])).pipe(B(e=>e.trim()),xp(`PlatformError`,()=>new rT({browser:r,platform:`win32`}).asEffect()));if(!d)return yield*new rT({browser:r,platform:`win32`}).asEffect();let f=Buffer.from(d,`base64`);return(e=>HE(e,f,i))})}})).pipe(P(s.layer))},rD=class extends A()(`@cookies/ChromiumSqliteFallback`,{make:L(function*(){let e=yield*EE,t=yield*aC,r=yield*nD,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 Xw({browser:r}).asEffect()}),a=H(`ChromiumSqliteFallback.readMetaVersion`)(function*(t){let n=(yield*e.query(t,`SELECT value FROM meta WHERE key = 'version'`,`chromium`).pipe(xp(`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*am({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=$E(typeof i==`number`||typeof i==`bigint`||typeof i==`string`?i:void 0);u.push(lT.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:eD(e.samesite)}))}return yield*Em(`Chromium SQLite fallback cookies extracted`,{browser:t.key,count:u.length}),u},Kp);return{extract:e=>o(e).pipe(Sp({CookieDatabaseNotFoundError:e=>new tT({reason:new $w({cause:e})}).asEffect(),CookieDatabaseCopyError:e=>new tT({reason:new $w({cause:e})}).asEffect(),CookieReadError:e=>new tT({reason:new $w({cause:e})}).asEffect(),CookieDecryptionKeyError:e=>new tT({reason:new $w({cause:e})}).asEffect(),PlatformError:e=>new tT({reason:new $w({cause:e})}).asEffect()}))}})}){static layer=Ed(this)(this.make).pipe(P(EE.layer),P(Ad(I(()=>{let e=u.platform();return e===`darwin`?nD.layerDarwin:e===`win32`?nD.layerWin32:nD.layerLinux}))),P(s.layer))};const iD=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(...aD(r))}return i},aD=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=oD(e.subarray(t));n&&i.push(n)}return i},oD=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=sD(e,40),u=cD(e,a,t),d=cD(e,o,t),f=cD(e,s,t)??`/`,p=cD(e,c,t)??``;if(!d)return;let m=u?lD(u):void 0,h=l&&l>0?Math.round(l+978307200):void 0;return lT.make({name:d,value:p,domain:m??``,path:f,expires:h,secure:r,httpOnly:i})},sD=(e,t)=>t+8>e.length?0:e.subarray(t,t+8).readDoubleLE(0),cD=(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)},lD=e=>{try{let t=e.includes(`://`)?e:`https://${e}`;return new URL(t).hostname}catch{let t=e.trim();return t===``?void 0:t}},uD=1e3,dD=Mx([xx,Cx]).pipe(zx(Sx,{decode:U(e=>Number(e)!==0),encode:U(e=>e?1:0)})),fD=Tx({name:G,value:G,host:G,path:G,expiry:Mx([xx,Cx,G]).pipe(zx(mx(xx),{decode:U(e=>{let t=Number(e);if(!(Number.isNaN(t)||t<=0))return Math.floor(t/uD)}),encode:U(e=>(e??0)*uD)})),isSecure:dD,isHttpOnly:dD,sameSite:Mx([xx,Cx,G]).pipe(zx(mx(oT),{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)}))}),pD=e=>lT.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 mD=class extends A()(`@cookies/Cookies`,{make:L(function*(){let e=yield*CE,t=yield*EE,r=yield*rD,i=yield*aC,a=t=>e.extractCookies({key:t.key,profilePath:t.profilePath,executablePath:t.executablePath}).pipe(Sp({TimeoutError:e=>new tT({reason:new $w({cause:e})}).asEffect(),SchemaError:e=>new tT({reason:new $w({cause:e})}).asEffect(),SocketError:e=>new tT({reason:new $w({cause:e})}).asEffect(),HttpClientError:e=>new tT({reason:new $w({cause:e})}).asEffect(),PlatformError:e=>new tT({reason:new $w({cause:e})}).asEffect()}),xp(`ExtractionError`,e=>L(function*(){return yield*wm(`CDP extraction failed, trying SQLite fallback`,{browser:t.key,error:e.message}),yield*r.extract(t)}).pipe(xp(`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*ep(yield*t.query(i,`SELECT name, value, host, path, expiry, isSecure, isHttpOnly, sameSite FROM moz_cookies ORDER BY expiry DESC`,`firefox`),e=>ax(fD)(e).pipe(B(pD)))}).pipe(Kp,Sp({CookieReadError:e=>new tT({reason:new $w({cause:e})}).asEffect(),CookieDatabaseCopyError:e=>new tT({reason:new $w({cause:e})}).asEffect(),SchemaError:e=>new tT({reason:new $w({cause:e})}).asEffect()})),s=e=>L(function*(){if(ur(e.cookieFilePath))return yield*new tT({reason:new eT}).asEffect();let t=yield*i.readFile(e.cookieFilePath.value);return iD(Buffer.from(t)).filter(e=>!!e.name&&!!e.domain)}).pipe(Sp({PlatformError:e=>new tT({reason:new $w({cause:e})}).asEffect()}));return{extract:e=>_w(e,{ChromiumBrowser:a,FirefoxBrowser:o,SafariBrowser:s})}})}){static layer=Ed(this,this.make).pipe(P(CE.layer),P(EE.layer),P(rD.layer),P(s.layer));static layerTest=Ed(this,this.make).pipe(P(CE.layerTest),P(EE.layer),P(rD.layer),P(s.layer))};const hD=m(c);async function gD(){if(h.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await hD(`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 _D=m(c);async function vD(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 _D(`osascript`,[`-e`,e,r],i);return a.trim()}async function yD(e){return vD(`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 bD=m(c),xD={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(xD));var SD=class extends Error{};async function CD(e=bD){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 SD(`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 xD[r]??xD[o]??xD[s]??{name:r,id:r}}const wD=m(c),TD=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function ED(){if(h.platform===`darwin`){let e=await gD();return{name:await yD(e),id:e}}if(h.platform===`linux`){let{stdout:e}=await wD(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:TD(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(h.platform===`win32`)return CD();throw Error(`Only macOS, Linux, and Windows are supported`)}var DD=class extends A()(`@cookies/Browsers`,{make:L(function*(){let e=new Set,t=t=>I(()=>{e.add(t)}),n=ep(e,x,{concurrency:`unbounded`}).pipe(B(oi),om(`Browsers.list`));return{register:t,list:n,defaultBrowser:H(`Browsers.defaultBrowser`)(function*(){let e=(yield*rp({try:()=>ED(),catch:e=>new aT({cause:String(e)})})).id.toLowerCase(),t=e.replace(/\.desktop$/,``),r=IE(e)??LE(t);return r?mr((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=Ed(this,this.make)};const OD=Tx({profile:mx(Tx({last_used:mx(G)}))}),kD=Tx({intl:mx(Tx({selected_languages:mx(G),accept_languages:mx(G)}))});var AD=class extends A()(`@cookies/ChromiumPlatform`){static layerDarwin=wd(this,{executableCandidates:e=>[e.executable.darwin],userDataDir:e=>n.join(u.homedir(),`Library`,`Application Support`,e.userData.darwin)});static layerLinux=wd(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=Ed(this)(L(function*(){let e=yield*Ow,t=new Map;for(let n of OE){let r=`HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\${n.registryKey}`,i=yield*e.string(Mw(`reg`,[`query`,r,`/ve`])).pipe(B(e=>e.trim()),bp(()=>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))},jD=class extends A()(`@cookies/ChromiumSource`,{make:L(function*(){let e=yield*DD,t=yield*AD,r=yield*aC,i=e=>r.readFileString(n.join(e,`Local State`)).pipe(z(e=>ox(eS(OD))(e)),B(e=>mr(e.profile?.last_used)),Cp(`PlatformError`,`NotFound`,()=>F(D()))),a=e=>r.readFileString(n.join(e,`Preferences`)).pipe(z(e=>ox(eS(kD))(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)}),bp(()=>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(Cp(`PlatformError`,`NotFound`,()=>F([]))),l=e=>r.exists(n.join(e,`Preferences`)).pipe(Cp(`PlatformError`,`BadResource`,()=>F(!1)));return yield*ep(c,r=>L(function*(){let i=n.join(o,r);if(!(yield*l(i)))return;let s=yield*a(i);return new uT({key:e,profileName:r,profilePath:i,executablePath:t,...s?{locale:s}:{}})}),{concurrency:10}).pipe(B(si(Se)),B(ei(uT.orderBy(_r(s)))))});yield*e.register(ep(OE,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(oi),bp(e=>new aT({cause:String(e)}).asEffect())))})}){static layer=kd(this.make).pipe(P(s.layer))},MD=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
|
|
25
|
+
`:`
|
|
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 ND=Tx({Name:G,Path:G,IsRelative:mx(G)}),PD=e=>Object.values((0,MD.parse)(e)).map(e=>sx(ND)(e)).filter(e=>e._tag===`Some`).map(e=>({name:e.value.Name,path:e.value.Path,isRelative:e.value.IsRelative!==`0`}));var FD=class extends A()(`@cookies/FirefoxPlatform`){static layerDarwin=wd(this,{dataDir:n.join(u.homedir(),kE.dataDir.darwin),executablePaths:[kE.executable.darwin]});static layerLinux=wd(this,{dataDir:n.join(u.homedir(),kE.dataDir.linux),executablePaths:kE.executable.linux});static layerWin32=wd(this,{dataDir:n.join(u.homedir(),kE.dataDir.win32),executablePaths:kE.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)]})})},ID=class extends A()(`@cookies/FirefoxSource`,{make:L(function*(){let e=yield*DD,t=yield*FD,r=yield*aC;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*ep(PD(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 dT({profileName:n.basename(i),profilePath:i})}),{concurrency:`unbounded`}).pipe(B(e=>e.filter(Se)))}).pipe(bp(e=>new aT({cause:String(e)}).asEffect())))})}){static layer=kd(this.make)},LD=class extends A()(`@cookies/SafariPlatform`){static layerDarwin=wd(this,{executable:AE.executable,cookieRelativePaths:AE.cookieRelativePaths})},RD=class extends A()(`@cookies/SafariSource`,{make:L(function*(){let e=yield*DD,t=yield*LD,r=yield*aC;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 fT({cookieFilePath:e})]}).pipe(xp(`PlatformError`,e=>new aT({cause:String(e)}).asEffect())))})}){static layer=kd(this.make)};const zD=DD.layer,BD=Md(zD,jD.layer.pipe(P(zD),P(AD.layerDarwin),P(s.layer)),ID.layer.pipe(P(zD),P(FD.layerDarwin),P(s.layer)),RD.layer.pipe(P(zD),P(LD.layerDarwin),P(s.layer))),VD=Md(zD,jD.layer.pipe(P(zD),P(AD.layerLinux),P(s.layer)),ID.layer.pipe(P(zD),P(FD.layerLinux),P(s.layer))),HD=Md(zD,jD.layer.pipe(P(zD),P(AD.layerWin32),P(s.layer)),ID.layer.pipe(P(zD),P(FD.layerWin32),P(s.layer))),UD=Ad(I(()=>{let e=u.platform();return e===`darwin`?BD:e===`win32`?HD:VD})),WD=[`--enable-webgl`,`--use-gl=angle`,`--use-angle=swiftshader`,`--ignore-gpu-blocklist`],GD=new Set([`button`,`link`,`textbox`,`checkbox`,`radio`,`combobox`,`listbox`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`searchbox`,`slider`,`spinbutton`,`switch`,`tab`,`treeitem`]),KD=new Set([`heading`,`cell`,`gridcell`,`columnheader`,`rowheader`,`listitem`,`article`,`region`,`main`,`navigation`]),qD=`__expect_annotation_overlay__`;var JD=class extends q(`BrowserLaunchError`)({_tag:K(`BrowserLaunchError`),cause:G}){message=`Failed to launch browser: ${this.cause}`},YD=class extends q(`SnapshotTimeoutError`)({_tag:K(`SnapshotTimeoutError`),selector:G,timeoutMs:xx,cause:G}){message=`Snapshot timed out after ${this.timeoutMs}ms on selector "${this.selector}": ${this.cause}`},XD=class extends q(`RefNotFoundError`)({_tag:K(`RefNotFoundError`),ref:G,availableRefs:kx(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(`, `)})`},ZD=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.`},QD=class extends q(`RefBlockedError`)({_tag:K(`RefBlockedError`),ref:G}){message=`Ref "${this.ref}" is blocked by an overlay. Dismiss any modals or banners first.`},$D=class extends q(`RefNotVisibleError`)({_tag:K(`RefNotVisibleError`),ref:G}){message=`Ref "${this.ref}" is not visible. Try scrolling it into view.`},eO=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.`},tO=class extends q(`ActionUnknownError`)({_tag:K(`ActionUnknownError`),ref:G,cause:G}){message=`Action on "${this.ref}" failed: ${this.cause}`},nO=class extends q(`NavigationError`)({_tag:K(`NavigationError`),url:G,cause:G}){message=`Navigation to "${this.url}" failed: ${this.cause}`},rO=class extends q(`RecorderInjectionError`)({_tag:K(`RecorderInjectionError`),cause:G}){message=`Failed to inject rrweb recorder: ${this.cause}`},iO=class extends q(`SessionLoadError`)({_tag:K(`SessionLoadError`),path:G,cause:G}){message=`Failed to load session from ${this.path}: ${this.cause}`};const aO=/resolved to (\d+) elements/,oO=/Timeout \d+ms exceeded/,sO=[`strict mode violation`],cO=[`intercepts pointer events`],lO=[`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`],uO=(e,t)=>t.some(t=>e.includes(t)),dO=(e,t)=>{let n=e instanceof Error?e.message:String(e);if(uO(n,sO)){let e=aO.exec(n);return new ZD({matchCount:e?e[1]:`multiple`,ref:t})}return uO(n,cO)?new QD({ref:t}):uO(n,lO)?new $D({ref:t}):oO.test(n)?new eO({ref:t}):new tO({ref:t,cause:n})},fO=e=>{let t=0;for(;t<e.length&&e[t]===` `;)t++;return Math.floor(t/2)},pO=e=>e.includes(`[ref=`)||e.includes(`:`)&&!e.endsWith(`:`),mO=e=>{let t=e.split(`
|
|
27
|
+
`),n=t.map(fO),r=Array(t.length).fill(!1),i=[];for(let e=t.length-1;e>=0;e--)if(pO(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
|
+
`)},hO=(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)},gO=(e,t)=>H(`Browser.resolveRef`)(function*(n){let r=t[n];return r?hO(e,r):yield*new XD({ref:n,availableRefs:Object.keys(t)})}),_O=(e,t,...n)=>np(()=>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})),vO=[`a`,`button`,`input`,`select`,`textarea`,`details`,`summary`],yO=H(`findCursorInteractive`)(function*(e,t){return yield*_O(e,`findCursorInteractiveElements`,t||`body`,100,[...GD],vO,100)}),bO=/- (\w+)\s*(?:"((?:[^"\\]|\\.)*)")?/,xO=e=>{let t=bO.exec(e);if(!t)return D();let n=t[1];return n===`text`?D():O({role:n,name:t[2]?.replace(/\\(.)/g,`$1`)??``})},SO=(e,t)=>`${e}|${t}`,CO=e=>{let t=new Map;for(let[n,r]of Object.entries(e)){let e=SO(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},wO=(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=>GD.has(e.role)).length}},TO=Md(UD,mD.layer),EO=(e,t,n)=>GD.has(e)?!0:n?!1:KD.has(e)&&t.length>0,DO=e=>new JD({cause:e instanceof Error?e.message:String(e)}),OO=H(`Browser.resolveDefaultBrowserContext`)(function*(){return{preferredProfile:_r(yield*(yield*DD).defaultBrowser().pipe(xp(`ListBrowsersError`,()=>F(D()))))}},Vp(UD)),kO=H(`Browser.extractCookiesForProfile`)(function*(e,t){return yield*e.extract(t)},Sp({ExtractionError:()=>F([]),PlatformError:dp})),AO=(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,jO=H(`Browser.extractDefaultBrowserCookies`)(function*(e,t){if(!t)return[];let n=yield*mD;return li((yield*ep([t,...(yield*(yield*DD).list.pipe(xp(`ListBrowsersError`,()=>F([])))).filter(e=>AO(e,t))],e=>kO(n,e),{concurrency:`unbounded`})).flat(),(e,t)=>e.name===t.name&&e.domain===t.domain&&e.path===t.path)},Vp(TO)),MO=H(`Browser.appendCursorInteractive`)(function*(e,t,n,r,i){let a=yield*yO(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}),NO=(e,t)=>_O(e,`injectOverlayLabels`,qD,t);var PO=class extends A()(`@browser/Browser`,{make:L(function*(){let e=H(`Browser.createPage`)(function*(e,t={}){yield*am({url:e??`about:blank`});let n=yield*rp({try:()=>g.launch({headless:!t.headed,executablePath:t.executablePath,args:t.headed?[]:WD}),catch:DO});return yield*L(function*(){let r=t.cookies===!0?yield*OO():{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*rp({try:()=>n.newContext(a),catch:DO});if(yield*rp({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:DO}),t.cookies){let n=Array.isArray(t.cookies)?t.cookies:yield*jO(e??``,r.preferredProfile);yield*rp({try:()=>o.addCookies(n.map(e=>e.playwrightFormat)),catch:DO})}let s=yield*rp({try:()=>o.newPage(),catch:DO});return e&&(yield*rp({try:()=>s.goto(e,{waitUntil:t.waitUntil??`load`}),catch:t=>new nO({url:e,cause:t instanceof Error?t.message:String(t)})})),{browser:n,context:o,page:s}}).pipe(Op(()=>rp(()=>n.close()).pipe(xp(`UnknownError`,()=>sp))))}),t=H(`Browser.snapshot`)(function*(e,t={}){let n=t.timeout??3e4,r=t.selector??`body`;yield*am({selector:r});let i=yield*rp({try:()=>e.locator(r).ariaSnapshot({timeout:n}),catch:e=>new YD({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&&fO(e)>t.maxDepth)continue;let n=xO(e);if(ur(n)){t.interactive||o.push(e);continue}let{role:r,name:i}=n.value;if(!(t.interactive&&!GD.has(r)))if(EO(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*MO(e,o,a,s,t)),CO(a);let c=o.join(`
|
|
31
|
+
`);t.interactive&&s===0&&(c=`(no interactive elements)`),t.compact&&(c=mO(c));let l=wO(c,a);return{tree:c,refs:a,stats:l,locator:gO(e,a)}});return{createPage:e,snapshot:t,act:H(`Browser.act`)(function*(e,n,r,i){yield*am({ref:n});let a=yield*(yield*t(e,i)).locator(n);return yield*rp({try:()=>r(a),catch:e=>dO(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*rp(()=>n.boundingBox()).pipe(xp(`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*NO(e,a),yield*Xp(rp({try:()=>e.screenshot({fullPage:n.fullPage}),catch:DO}).pipe(B(e=>({screenshot:e,annotations:i}))),_O(e,`removeOverlay`,qD).pipe(V(()=>sp)))}),waitForNavigationSettle:H(`Browser.waitForNavigationSettle`)(function*(e,t){yield*rp({try:()=>e.waitForURL(e=>e.toString()!==t,{timeout:1e3,waitUntil:`commit`}),catch:DO}).pipe(xp(`BrowserLaunchError`,()=>sp)),e.url()!==t&&(yield*rp(()=>e.waitForLoadState(`domcontentloaded`)).pipe(xp(`UnknownError`,()=>sp)),yield*rp({try:()=>e.waitForTimeout(500),catch:DO}))}),preExtractCookies:H(`Browser.preExtractCookies`)(function*(){let{preferredProfile:e}=yield*OO();return yield*jO(``,e)})}})}){static layer=Ed(this)(this.make)};H(`Recorder.collectEvents`)(function*(e){let t=yield*_O(e,`getEvents`).pipe(V(e=>new rO({cause:String(e)}).asEffect()));return{events:t,total:(yield*_O(e,`getEventCount`).pipe(V(e=>new rO({cause:String(e)}).asEffect())))+t.length}});const FO=H(`Recorder.collectAllEvents`)(function*(e){return yield*_O(e,`getAllEvents`).pipe(V(e=>new rO({cause:String(e)}).asEffect()))}),IO=e=>Te(e)&&`type`in e&&`timestamp`in e;H(`Recorder.loadSession`)(function*(e){return yield*ep((yield*(yield*aC).readFileString(e).pipe(xp(`PlatformError`,t=>new iO({path:e,cause:String(t)}).asEffect()))).trim().split(`
|
|
32
|
+
`),(t,n)=>fp({try:()=>{let e=JSON.parse(t);if(!IO(e))throw Error(`Missing required 'type' and 'timestamp' fields`);return e},catch:t=>new iO({path:e,cause:`Invalid rrweb event at line ${n+1}: ${String(t)}`})}))});const LO=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),RO=`2.0.0-alpha.18`,zO=`https://cdn.jsdelivr.net/npm/rrweb-player@${RO}/dist/style.css`,BO=`https://cdn.jsdelivr.net/npm/rrweb-player@${RO}/dist/rrweb-player.js`,VO=e=>e===`sse`?`
|
|
33
|
+
const res = await fetch('/latest.json');
|
|
34
|
+
if (res.ok) { allEvents = await res.json(); if (allEvents.length >= 2) initPlayer(allEvents); }
|
|
35
|
+
const es = new EventSource('/events');
|
|
36
|
+
es.addEventListener('replay', (msg) => { try { for (const e of JSON.parse(msg.data)) { allEvents.push(e); if (player) player.getReplayer().addEvent(e); } if (!player && allEvents.length >= 2) initPlayer(allEvents); } catch {} });
|
|
37
|
+
es.addEventListener('steps', (msg) => { try { updateSteps(JSON.parse(msg.data)); } catch {} });
|
|
38
|
+
es.onerror = () => { if (statusEl) statusEl.textContent = 'Connection lost. Retrying...'; };`:`
|
|
39
|
+
if (window.__EXPECT_REPLAY_NDJSON__) {
|
|
40
|
+
allEvents = window.__EXPECT_REPLAY_NDJSON__.trim().split('\\n').map(l => JSON.parse(l));
|
|
41
|
+
if (allEvents.length >= 2) initPlayer(allEvents);
|
|
42
|
+
else if (statusEl) statusEl.textContent = 'No replay events recorded.';
|
|
43
|
+
} else {
|
|
44
|
+
const res = await fetch('${e.ndjsonPath.replaceAll(`'`,`\\'`)}');
|
|
45
|
+
if (res.ok) {
|
|
46
|
+
allEvents = (await res.text()).trim().split('\\n').map(l => JSON.parse(l));
|
|
47
|
+
if (allEvents.length >= 2) initPlayer(allEvents);
|
|
48
|
+
else if (statusEl) statusEl.textContent = 'No replay events recorded.';
|
|
49
|
+
} else if (statusEl) statusEl.textContent = 'Failed to load replay.';
|
|
50
|
+
}`,HO=e=>`
|
|
51
|
+
const stepsPanel = document.getElementById('steps-panel');
|
|
52
|
+
const runTitle = document.getElementById('run-title');
|
|
53
|
+
const runStatus = document.getElementById('run-status');
|
|
54
|
+
const runSummary = document.getElementById('run-summary');
|
|
55
|
+
const stepsList = document.getElementById('steps-list');
|
|
56
|
+
let initialSteps = ${e?JSON.stringify(e):`null`};
|
|
57
|
+
if (initialSteps) updateSteps(initialSteps);
|
|
58
|
+
|
|
59
|
+
function updateSteps(state) {
|
|
60
|
+
if (!stepsPanel || !state) return;
|
|
61
|
+
stepsPanel.style.display = 'block';
|
|
62
|
+
if (runTitle) runTitle.textContent = state.title || 'Test Run';
|
|
63
|
+
if (runStatus) {
|
|
64
|
+
runStatus.textContent = state.status;
|
|
65
|
+
runStatus.className = 'run-status status-' + state.status;
|
|
66
|
+
}
|
|
67
|
+
if (runSummary) {
|
|
68
|
+
runSummary.textContent = state.summary || '';
|
|
69
|
+
runSummary.style.display = state.summary ? 'block' : 'none';
|
|
70
|
+
}
|
|
71
|
+
if (stepsList && state.steps) {
|
|
72
|
+
stepsList.innerHTML = '';
|
|
73
|
+
for (const step of state.steps) {
|
|
74
|
+
const li = document.createElement('li');
|
|
75
|
+
li.className = 'step-item step-' + step.status;
|
|
76
|
+
const badge = document.createElement('span');
|
|
77
|
+
badge.className = 'step-badge';
|
|
78
|
+
badge.textContent = step.status === 'passed' ? '\\u2713'
|
|
79
|
+
: step.status === 'failed' ? '\\u2717'
|
|
80
|
+
: step.status === 'active' ? '\\u25CF'
|
|
81
|
+
: '\\u25CB';
|
|
82
|
+
const title = document.createElement('span');
|
|
83
|
+
title.className = 'step-title';
|
|
84
|
+
title.textContent = step.title;
|
|
85
|
+
li.appendChild(badge);
|
|
86
|
+
li.appendChild(title);
|
|
87
|
+
if (step.summary) {
|
|
88
|
+
const summary = document.createElement('span');
|
|
89
|
+
summary.className = 'step-summary';
|
|
90
|
+
summary.textContent = step.summary;
|
|
91
|
+
li.appendChild(summary);
|
|
92
|
+
}
|
|
93
|
+
stepsList.appendChild(li);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}`,UO=e=>{let t=e.eventsSource,n=t===`sse`,r=t===void 0?``:`
|
|
97
|
+
<div id="replay-container"><div class="status" id="status">Loading replay…</div></div>
|
|
98
|
+
${t!==void 0&&t!==`sse`?`
|
|
99
|
+
<script>
|
|
100
|
+
(function(){var b=location.pathname.split('/').pop().replace(/\\.html$/,'');document.write('<scr'+'ipt src="'+b+'.ndjson.js"></scr'+'ipt>');})();
|
|
101
|
+
<\/script>`:``}
|
|
102
|
+
<script type="module">
|
|
103
|
+
import rrwebPlayer from '${BO}';
|
|
104
|
+
const container = document.getElementById('replay-container');
|
|
105
|
+
const statusEl = document.getElementById('status');
|
|
106
|
+
let player = null, allEvents = [];
|
|
107
|
+
const initPlayer = (events) => {
|
|
108
|
+
if (player) { player.getReplayer().addEvent(events.at(-1)); return; }
|
|
109
|
+
if (events.length < 2) return;
|
|
110
|
+
statusEl?.remove();
|
|
111
|
+
player = new rrwebPlayer({ target: container, props: {
|
|
112
|
+
events, width: 960, height: 540,
|
|
113
|
+
autoPlay: ${n}, showController: ${!n}, ${n?`liveMode: true,`:``}
|
|
114
|
+
}});
|
|
115
|
+
${n?`player.getReplayer().startLive();`:``}
|
|
116
|
+
};
|
|
117
|
+
${VO(t)}
|
|
118
|
+
<\/script>`,i=`
|
|
119
|
+
<div id="steps-panel">
|
|
120
|
+
<h2 id="run-title">Test Run</h2>
|
|
121
|
+
<div id="run-status" class="run-status status-running">running</div>
|
|
122
|
+
<div id="run-summary" style="display:none"></div>
|
|
123
|
+
<ul id="steps-list"></ul>
|
|
124
|
+
</div>
|
|
125
|
+
<script>${HO(e.steps)}<\/script>`;return`<!doctype html>
|
|
126
|
+
<html>
|
|
127
|
+
<head>
|
|
128
|
+
<meta charset="utf-8" />
|
|
129
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
130
|
+
<title>${LO(e.title)}</title>
|
|
131
|
+
${t===void 0?``:`<link rel="stylesheet" href="${zO}" />`}
|
|
132
|
+
<style>
|
|
133
|
+
:root { color-scheme: dark }
|
|
134
|
+
body { margin: 0; font-family: ui-sans-serif, system-ui, sans-serif; background: #0f172a; color: #e2e8f0 }
|
|
135
|
+
h1, h2 { color: #f8fafc } a { color: #93c5fd }
|
|
136
|
+
#replay-container { margin: 16px 0; border-radius: 8px; overflow: hidden }
|
|
137
|
+
.status { text-align: center; padding: 16px; font-size: 14px; color: #9ca3af }
|
|
138
|
+
|
|
139
|
+
#steps-panel { display: none; margin-bottom: 24px; background: #1e293b; border-radius: 8px; padding: 20px; border: 1px solid #334155 }
|
|
140
|
+
#steps-panel h2 { margin: 0 0 4px 0; font-size: 16px; font-weight: 600 }
|
|
141
|
+
.run-status { display: inline-block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 4px; margin-bottom: 12px }
|
|
142
|
+
.status-running { background: #1e3a5f; color: #60a5fa }
|
|
143
|
+
.status-passed { background: #14532d; color: #4ade80 }
|
|
144
|
+
.status-failed { background: #7f1d1d; color: #f87171 }
|
|
145
|
+
#run-summary { font-size: 13px; color: #94a3b8; margin-bottom: 16px }
|
|
146
|
+
#steps-list { list-style: none; padding: 0; margin: 0 }
|
|
147
|
+
.step-item { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; font-size: 14px; border-top: 1px solid #1e293b }
|
|
148
|
+
.step-item:first-child { border-top: none }
|
|
149
|
+
.step-badge { flex-shrink: 0; width: 16px; text-align: center; font-size: 13px }
|
|
150
|
+
.step-pending .step-badge { color: #64748b }
|
|
151
|
+
.step-active .step-badge { color: #60a5fa; animation: pulse 1.5s infinite }
|
|
152
|
+
.step-passed .step-badge { color: #4ade80 }
|
|
153
|
+
.step-failed .step-badge { color: #f87171 }
|
|
154
|
+
.step-title { color: #e2e8f0 }
|
|
155
|
+
.step-summary { color: #94a3b8; font-size: 12px; margin-left: auto; max-width: 50%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
|
|
156
|
+
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.4 } }
|
|
157
|
+
.replayer-mouse {
|
|
158
|
+
background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0nMzInIGhlaWdodD0nMzUnIHZpZXdCb3g9JzAgMCAzMiAzNScgZmlsbD0nbm9uZScgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJz48ZGVmcz48ZmlsdGVyIGlkPSdjcycgeD0nLTQnIHk9Jy00JyB3aWR0aD0nNDAnIGhlaWdodD0nNDAnIGZpbHRlclVuaXRzPSd1c2VyU3BhY2VPblVzZScgY29sb3ItaW50ZXJwb2xhdGlvbi1maWx0ZXJzPSdzUkdCJz48ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PScwJyByZXN1bHQ9J2JnJy8+PGZlQ29sb3JNYXRyaXggaW49J1NvdXJjZUFscGhhJyB0eXBlPSdtYXRyaXgnIHZhbHVlcz0nMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMTI3IDAnIHJlc3VsdD0naGEnLz48ZmVPZmZzZXQvPjxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249JzInLz48ZmVDb21wb3NpdGUgaW4yPSdoYScgb3BlcmF0b3I9J291dCcvPjxmZUNvbG9yTWF0cml4IHR5cGU9J21hdHJpeCcgdmFsdWVzPScwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwLjI1IDAnLz48ZmVCbGVuZCBtb2RlPSdub3JtYWwnIGluMj0nYmcnIHJlc3VsdD0nZHMnLz48ZmVCbGVuZCBtb2RlPSdub3JtYWwnIGluPSdTb3VyY2VHcmFwaGljJyBpbjI9J2RzJyByZXN1bHQ9J3NoYXBlJy8+PC9maWx0ZXI+PC9kZWZzPjxnIGZpbHRlcj0ndXJsKCUyM2NzKSc+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNi41MDEgMTMuODZMMjQuODg0IDIyLjI2MUMyNS45MzcgMjMuMzE3IDI1LjE5IDI1LjExOSAyMy42OTkgMjUuMTE5TDIyLjQ3NSAyNS4xMTlMMjMuNjkxIDI4LjAwN0MyMy45MDQgMjguNTEzIDIzLjkwNyAyOS4wNzMgMjMuNyAyOS41ODJDMjMuNDkyIDMwLjA5MiAyMy4wOTggMzAuNDkgMjIuNTkgMzAuNzAzQzIyLjMzNCAzMC44MSAyMi4wNjYgMzAuODY0IDIxLjc5MiAzMC44NjRDMjAuOTYxIDMwLjg2NCAyMC4yMTYgMzAuMzY5IDE5Ljg5NCAyOS42MDNMMTguNjE2IDI2LjU2NUwxNy43ODQgMjcuMzAzQzE2LjcwMyAyOC4yNTkgMTUgMjcuNDkyIDE1IDI2LjA0OFYxNC40ODFDMTUgMTMuNjk3IDE1Ljk0NyAxMy4zMDUgMTYuNTAxIDEzLjg2WicgZmlsbD0nJTIzRkZGRkZGJy8+PHBhdGggZmlsbC1ydWxlPSdldmVub2RkJyBjbGlwLXJ1bGU9J2V2ZW5vZGQnIGQ9J00xNS45OTkgMTUuMTI5QzE1Ljk5OSAxNC45OTggMTYuMTU5IDE0LjkzMiAxNi4yNSAxNS4wMjVMMjQuMTU5IDIyLjk1QzI0LjU5IDIzLjM4MiAyNC4yODQgMjQuMTE5IDIzLjY3NCAyNC4xMTlMMjAuOTcgMjQuMTE4TDIyLjc2OSAyOC4zOTRDMjIuOTk2IDI4LjkzNCAyMi43NDIgMjkuNTU1IDIyLjIwMyAyOS43ODFDMjEuNjYyIDMwLjAwOCAyMS4wNDIgMjkuNzU1IDIwLjgxNiAyOS4yMTZMMTguOTk4IDI0Ljg5MkwxNy4xMzkgMjYuNTM5QzE2LjcyMyAyNi45MDcgMTYuMDgxIDI2LjY1MSAxNi4wMDcgMjYuMTI3TDE1Ljk5OSAyNi4wMjZWMTUuMTI5WicgZmlsbD0nJTIzMDAwMDAwJy8+PC9nPjwvc3ZnPg==') !important;
|
|
159
|
+
background-size: contain !important;
|
|
160
|
+
background-position: top left !important;
|
|
161
|
+
width: 54px !important;
|
|
162
|
+
height: 59px !important;
|
|
163
|
+
transition: left 0.15s cubic-bezier(0.25, 1, 0.5, 1), top 0.15s cubic-bezier(0.25, 1, 0.5, 1), width 0.2s ease-out, height 0.2s ease-out !important;
|
|
164
|
+
}
|
|
165
|
+
.replayer-mouse::after { display: none !important }
|
|
166
|
+
.replayer-mouse.active { animation: macos-click 0.2s ease-out 1 !important }
|
|
167
|
+
@keyframes macos-click { 0% { transform: scale(1) } 40% { transform: scale(0.7) } 100% { transform: scale(1) } }
|
|
168
|
+
</style>
|
|
169
|
+
</head>
|
|
170
|
+
<body>
|
|
171
|
+
<main style="max-width:960px;margin:0 auto;padding:32px">
|
|
172
|
+
${e.bodyHtml??``}
|
|
173
|
+
${i}
|
|
174
|
+
${r}
|
|
175
|
+
</main>
|
|
176
|
+
</body>
|
|
177
|
+
</html>`};var WO=class extends q(`McpSessionNotOpenError`)({_tag:K(`McpSessionNotOpenError`)}){message=`No browser open. Call the 'open' tool first.`};const GO=e=>Te(e)&&`status`in e&&`steps`in e&&Array.isArray(e.steps),KO={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`GET, POST, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type`},qO={"Cache-Control":`no-store`},JO=(e,t,n)=>cp(r=>{let i=e=>r(R(e));e.once(`error`,i),e.listen({host:t,port:n},()=>{e.off(`error`,i),r(sp)})}),YO=e=>cp(t=>{e.close(()=>t(sp))}),XO=H(`LiveViewServer.start`)(function*(e){let t=new URL(e.liveViewUrl),n=new Set,r=[],i,a=yield*Lv(),o=UO({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`,...KO,...qO}),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(!GO(r)){t.writeHead(400,{"Content-Type":`text/plain`,...KO,...qO}),t.end(`Invalid step state: missing status or steps`);return}l(r),t.writeHead(204,{...KO,...qO}),t.end()}catch{t.writeHead(400,{"Content-Type":`text/plain`,...KO,...qO}),t.end(`Invalid JSON`)}})},f=_((e,n)=>{if(e.method===`OPTIONS`){n.writeHead(204,KO),n.end();return}let a=new URL(e.url??`/`,t).pathname;if(a===`/`){n.writeHead(200,{"Content-Type":`text/html; charset=utf-8`,...KO,...qO}),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),...KO,...qO}),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),...KO,...qO}),n.end(t);return}n.writeHead(404,{"Content-Type":`text/plain; charset=utf-8`,...KO,...qO}),n.end(`Not found`)});yield*JO(f,t.hostname,Number(t.port));let p=yield*I(()=>e.getPage()).pipe(z(e=>!e||e.isClosed()?sp:_O(e,`startRecording`).pipe(V(()=>sp),z(()=>_O(e,`getEvents`)),gp(e=>I(()=>{Array.isArray(e)&&e.length>0&&c(e)})),V(e=>Dm(`Replay event collection failed`,{cause:e}))))).pipe(rm(zf(250)),lm),m=yield*PS(a).pipe(RS(e=>I(()=>l(e))),eC,lm);return{url:t.toString(),pushRunState:e=>{Bv(a,e)},getLatestRunState:()=>i,close:L(function*(){yield*gv(p),yield*gv(m);for(let e of n)e.end();n.clear(),yield*YO(f)})}}),ZO=`/tmp/expect-replays`,QO=(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 $O=class extends A()(`@browser/McpSession`,{make:L(function*(){let e=yield*PO,t=yield*aC,r=yield*TC(jC(`EXPECT_REPLAY_OUTPUT_PATH`)),i=yield*TC(jC(Vw)),a=yield*ww(void 0),o=yield*ww(void 0),s=yield*ww(void 0),c=yield*ww(void 0),l=yield*ww(void 0);yield*e.preExtractCookies().pipe(gp(e=>Ew(l,e)),gp(e=>Em(`Cookies pre-extracted`,{count:e.length})),V(()=>sp),lm);let u=H(`McpSession.requireSession`)(function*(){return(yield*Tw(a))||(yield*new WO)}),d=H(`McpSession.requirePage`)(function*(){return(yield*u()).page}),f=H(`McpSession.navigate`)(function*(e,t={}){let n=yield*u();yield*rp({try:()=>n.page.goto(e,{waitUntil:t.waitUntil??`load`}),catch:t=>new nO({url:e,cause:t instanceof Error?t.message:String(t)})})}),p=H(`McpSession.pushStepEvent`)(function*(e){yield*Ew(c,e);let t=yield*Tw(o);t&&t.pushRunState(e)});return{open:H(`McpSession.open`)(function*(c,u={}){yield*am({url:c});let d=u.cookies?yield*Tw(l):void 0,f=d&&d.length>0?d:u.cookies,p=n.join(ZO,`playwright`);yield*t.makeDirectory(p,{recursive:!0}).pipe(V(e=>Dm(`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:_r(r),accumulatedReplayEvents:[],trackedPages:new Set,lastSnapshot:void 0};QO(m.page,h),yield*Ew(a,h),yield*_O(m.page,`startRecording`).pipe(V(e=>Dm(`rrweb recording failed to start`,{cause:e})));let g=yield*Tw(o);if(dr(i)&&!g){let e=yield*XO({liveViewUrl:i.value,getPage:()=>Dw(a)?.page,onEventsCollected:e=>{Dw(a)?.accumulatedReplayEvents.push(...e)}}).pipe(V(e=>Dm(`Live view server failed to start`,{cause:e}).pipe(vp(void 0))));e&&(yield*Ew(o,e))}return(yield*Tw(o))||(yield*Ew(s,yield*I(()=>Dw(a)?.page).pipe(z(e=>!e||e.isClosed()?sp:_O(e,`startRecording`).pipe(V(()=>sp),z(()=>_O(e,`getEvents`)),gp(e=>I(()=>{Array.isArray(e)&&e.length>0&&Dw(a)?.accumulatedReplayEvents.push(...e)})),V(e=>Dm(`Replay event collection failed`,{cause:e}))))).pipe(rm(zf(250)),lm))),{injectedCookieCount:yield*rp(()=>m.context.cookies()).pipe(B(e=>e.length),V(e=>Dm(`Failed to count cookies`,{cause:e}).pipe(vp(0))))}}),navigate:f,hasSession:()=>!!Dw(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*Tw(a);if(!e)return;yield*Ew(a,void 0);let r=yield*Tw(s);r&&(yield*gv(r),yield*Ew(s,void 0));let i=yield*Tw(o);i&&(yield*i.close.pipe(V(e=>Dm(`Failed to close live view`,{cause:e}))),yield*Ew(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*FO(e.page).pipe(V(e=>Dm(`Failed to collect final replay events`,{cause:e}).pipe(vp([]))));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=>Dm(`Failed to create replay output directory`,{cause:e}))),yield*t.writeFileString(r,i).pipe(V(e=>Dm(`Failed to write replay file`,{cause:e}))),l=r;let a=yield*Tw(c),o=n.basename(r),s=n.basename(r,n.extname(r)),d=n.join(n.dirname(r),`${s}.html`),m=UO({title:a?`Test Report: ${a.title}`:`Expect Report`,eventsSource:{ndjsonPath:o},steps:a});yield*t.writeFileString(d,m).pipe(V(e=>Dm(`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=>Dm(`Failed to write ndjson.js wrapper`,{cause:e})));let _=n.join(ZO,`${s}.ndjson`),ee=n.join(ZO,`${s}.html`),v=`${_}.js`;yield*t.makeDirectory(ZO,{recursive:!0}).pipe(V(e=>Dm(`Failed to create /tmp artifact directory`,{cause:e}))),yield*t.copyFile(r,_).pipe(gp(()=>I(()=>{f=_})),V(e=>Dm(`Failed to copy replay to /tmp`,{cause:e}))),yield*t.copyFile(d,ee).pipe(gp(()=>I(()=>{p=ee})),V(e=>Dm(`Failed to copy report to /tmp`,{cause:e}))),yield*t.copyFile(h,v).pipe(V(e=>Dm(`Failed to copy ndjson.js to /tmp`,{cause:e})))}}).pipe(V(e=>Dm(`Failed during close cleanup`,{cause:e}))),yield*rp(()=>e.browser.close()).pipe(V(e=>Dm(`Failed to close browser`,{cause:e}))),h&&(d=yield*rp(()=>h.path()).pipe(V(e=>Dm(`Failed to resolve Playwright video path`,{cause:e}).pipe(vp(void 0)))),d)){let e=n.join(ZO,`${g}.webm`);yield*t.makeDirectory(ZO,{recursive:!0}).pipe(V(e=>Dm(`Failed to create /tmp artifact directory`,{cause:e}))),yield*t.copyFile(d,e).pipe(gp(()=>I(()=>{m=e})),V(e=>Dm(`Failed to copy Playwright video to /tmp`,{cause:e})))}return{replaySessionPath:l,reportPath:u,videoPath:d,tmpReplaySessionPath:f,tmpReportPath:p,tmpVideoPath:m}})}})}){static layer=Ed(this)(this.make).pipe(P(PO.layer))};const ek=wd(WC,!0),tk=QC($O.layer.pipe(P(ek),P(s.layer)));function nk(e){return!!e._zod}function rk(e){let t=Object.values(e);if(t.length===0)return te.object({});let n=t.every(nk),r=t.every(e=>!nk(e));if(n)return te.object(e);if(r)return ee.object(e);throw Error(`Mixed Zod versions detected in object shape.`)}function ik(e,t){return nk(e)?te.safeParse(e,t):e.safeParse(t)}async function ak(e,t){return nk(e)?await te.safeParseAsync(e,t):await e.safeParseAsync(t)}function ok(e){if(!e)return;let t;if(t=nk(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function sk(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 rk(e)}}if(nk(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 ck(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 lk(e){return e.description}function uk(e){if(nk(e))return e._zod?.def?.type===`optional`;let t=e;return typeof e.isOptional==`function`?e.isOptional():t._def?.typeName===`ZodOptional`}function dk(e){if(nk(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 fk=`2025-11-25`,pk=[fk,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],mk=`io.modelcontextprotocol/related-task`,hk=i.custom(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),gk=i.union([i.string(),i.number().int()]),_k=i.string();i.looseObject({ttl:i.union([i.number(),i.null()]).optional(),pollInterval:i.number().optional()});const vk=i.object({ttl:i.number().optional()}),yk=i.object({taskId:i.string()}),bk=i.looseObject({progressToken:gk.optional(),[mk]:yk.optional()}),xk=i.object({_meta:bk.optional()}),Sk=xk.extend({task:vk.optional()}),Ck=e=>Sk.safeParse(e).success,wk=i.object({method:i.string(),params:xk.loose().optional()}),Tk=i.object({_meta:bk.optional()}),Ek=i.object({method:i.string(),params:Tk.loose().optional()}),Dk=i.looseObject({_meta:bk.optional()}),Ok=i.union([i.string(),i.number().int()]),kk=i.object({jsonrpc:i.literal(`2.0`),id:Ok,...wk.shape}).strict(),Ak=e=>kk.safeParse(e).success,jk=i.object({jsonrpc:i.literal(`2.0`),...Ek.shape}).strict(),Mk=e=>jk.safeParse(e).success,Nk=i.object({jsonrpc:i.literal(`2.0`),id:Ok,result:Dk}).strict(),Pk=e=>Nk.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 Fk=i.object({jsonrpc:i.literal(`2.0`),id:Ok.optional(),error:i.object({code:i.number().int(),message:i.string(),data:i.unknown().optional()})}).strict(),Ik=e=>Fk.safeParse(e).success,Lk=i.union([kk,jk,Nk,Fk]);i.union([Nk,Fk]);const Rk=Dk.strict(),zk=Tk.extend({requestId:Ok.optional(),reason:i.string().optional()}),Bk=Ek.extend({method:i.literal(`notifications/cancelled`),params:zk}),Vk=i.object({src:i.string(),mimeType:i.string().optional(),sizes:i.array(i.string()).optional(),theme:i.enum([`light`,`dark`]).optional()}),Hk=i.object({icons:i.array(Vk).optional()}),Uk=i.object({name:i.string(),title:i.string().optional()}),Wk=Uk.extend({...Uk.shape,...Hk.shape,version:i.string(),websiteUrl:i.string().optional(),description:i.string().optional()}),Gk=i.intersection(i.object({applyDefaults:i.boolean().optional()}),i.record(i.string(),i.unknown())),Kk=i.preprocess(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,i.intersection(i.object({form:Gk.optional(),url:hk.optional()}),i.record(i.string(),i.unknown()).optional())),qk=i.looseObject({list:hk.optional(),cancel:hk.optional(),requests:i.looseObject({sampling:i.looseObject({createMessage:hk.optional()}).optional(),elicitation:i.looseObject({create:hk.optional()}).optional()}).optional()}),Jk=i.looseObject({list:hk.optional(),cancel:hk.optional(),requests:i.looseObject({tools:i.looseObject({call:hk.optional()}).optional()}).optional()}),Yk=i.object({experimental:i.record(i.string(),hk).optional(),sampling:i.object({context:hk.optional(),tools:hk.optional()}).optional(),elicitation:Kk.optional(),roots:i.object({listChanged:i.boolean().optional()}).optional(),tasks:qk.optional()}),Xk=xk.extend({protocolVersion:i.string(),capabilities:Yk,clientInfo:Wk}),Zk=wk.extend({method:i.literal(`initialize`),params:Xk}),Qk=i.object({experimental:i.record(i.string(),hk).optional(),logging:hk.optional(),completions:hk.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:Jk.optional()}),$k=Dk.extend({protocolVersion:i.string(),capabilities:Qk,serverInfo:Wk,instructions:i.string().optional()}),eA=Ek.extend({method:i.literal(`notifications/initialized`),params:Tk.optional()}),tA=wk.extend({method:i.literal(`ping`),params:xk.optional()}),nA=i.object({progress:i.number(),total:i.optional(i.number()),message:i.optional(i.string())}),rA=i.object({...Tk.shape,...nA.shape,progressToken:gk}),iA=Ek.extend({method:i.literal(`notifications/progress`),params:rA}),aA=xk.extend({cursor:_k.optional()}),oA=wk.extend({params:aA.optional()}),sA=Dk.extend({nextCursor:_k.optional()}),cA=i.enum([`working`,`input_required`,`completed`,`failed`,`cancelled`]),lA=i.object({taskId:i.string(),status:cA,ttl:i.union([i.number(),i.null()]),createdAt:i.string(),lastUpdatedAt:i.string(),pollInterval:i.optional(i.number()),statusMessage:i.optional(i.string())}),uA=Dk.extend({task:lA}),dA=Tk.merge(lA),fA=Ek.extend({method:i.literal(`notifications/tasks/status`),params:dA}),pA=wk.extend({method:i.literal(`tasks/get`),params:xk.extend({taskId:i.string()})}),mA=Dk.merge(lA),hA=wk.extend({method:i.literal(`tasks/result`),params:xk.extend({taskId:i.string()})});Dk.loose();const gA=oA.extend({method:i.literal(`tasks/list`)}),_A=sA.extend({tasks:i.array(lA)}),vA=wk.extend({method:i.literal(`tasks/cancel`),params:xk.extend({taskId:i.string()})}),yA=Dk.merge(lA),bA=i.object({uri:i.string(),mimeType:i.optional(i.string()),_meta:i.record(i.string(),i.unknown()).optional()}),xA=bA.extend({text:i.string()}),SA=i.string().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),CA=bA.extend({blob:SA}),wA=i.enum([`user`,`assistant`]),TA=i.object({audience:i.array(wA).optional(),priority:i.number().min(0).max(1).optional(),lastModified:i.iso.datetime({offset:!0}).optional()}),EA=i.object({...Uk.shape,...Hk.shape,uri:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),annotations:TA.optional(),_meta:i.optional(i.looseObject({}))}),DA=i.object({...Uk.shape,...Hk.shape,uriTemplate:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),annotations:TA.optional(),_meta:i.optional(i.looseObject({}))}),OA=oA.extend({method:i.literal(`resources/list`)}),kA=sA.extend({resources:i.array(EA)}),AA=oA.extend({method:i.literal(`resources/templates/list`)}),jA=sA.extend({resourceTemplates:i.array(DA)}),MA=xk.extend({uri:i.string()}),NA=MA,PA=wk.extend({method:i.literal(`resources/read`),params:NA}),FA=Dk.extend({contents:i.array(i.union([xA,CA]))}),IA=Ek.extend({method:i.literal(`notifications/resources/list_changed`),params:Tk.optional()}),LA=MA,RA=wk.extend({method:i.literal(`resources/subscribe`),params:LA}),zA=MA,BA=wk.extend({method:i.literal(`resources/unsubscribe`),params:zA}),VA=Tk.extend({uri:i.string()}),HA=Ek.extend({method:i.literal(`notifications/resources/updated`),params:VA}),UA=i.object({name:i.string(),description:i.optional(i.string()),required:i.optional(i.boolean())}),WA=i.object({...Uk.shape,...Hk.shape,description:i.optional(i.string()),arguments:i.optional(i.array(UA)),_meta:i.optional(i.looseObject({}))}),GA=oA.extend({method:i.literal(`prompts/list`)}),KA=sA.extend({prompts:i.array(WA)}),qA=xk.extend({name:i.string(),arguments:i.record(i.string(),i.string()).optional()}),JA=wk.extend({method:i.literal(`prompts/get`),params:qA}),YA=i.object({type:i.literal(`text`),text:i.string(),annotations:TA.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),XA=i.object({type:i.literal(`image`),data:SA,mimeType:i.string(),annotations:TA.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),ZA=i.object({type:i.literal(`audio`),data:SA,mimeType:i.string(),annotations:TA.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),QA=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()}),$A=i.object({type:i.literal(`resource`),resource:i.union([xA,CA]),annotations:TA.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),ej=EA.extend({type:i.literal(`resource_link`)}),tj=i.union([YA,XA,ZA,ej,$A]),nj=i.object({role:wA,content:tj}),rj=Dk.extend({description:i.string().optional(),messages:i.array(nj)}),ij=Ek.extend({method:i.literal(`notifications/prompts/list_changed`),params:Tk.optional()}),aj=i.object({title:i.string().optional(),readOnlyHint:i.boolean().optional(),destructiveHint:i.boolean().optional(),idempotentHint:i.boolean().optional(),openWorldHint:i.boolean().optional()}),oj=i.object({taskSupport:i.enum([`required`,`optional`,`forbidden`]).optional()}),sj=i.object({...Uk.shape,...Hk.shape,description:i.string().optional(),inputSchema:i.object({type:i.literal(`object`),properties:i.record(i.string(),hk).optional(),required:i.array(i.string()).optional()}).catchall(i.unknown()),outputSchema:i.object({type:i.literal(`object`),properties:i.record(i.string(),hk).optional(),required:i.array(i.string()).optional()}).catchall(i.unknown()).optional(),annotations:aj.optional(),execution:oj.optional(),_meta:i.record(i.string(),i.unknown()).optional()}),cj=oA.extend({method:i.literal(`tools/list`)}),lj=sA.extend({tools:i.array(sj)}),uj=Dk.extend({content:i.array(tj).default([]),structuredContent:i.record(i.string(),i.unknown()).optional(),isError:i.boolean().optional()});uj.or(Dk.extend({toolResult:i.unknown()}));const dj=Sk.extend({name:i.string(),arguments:i.record(i.string(),i.unknown()).optional()}),fj=wk.extend({method:i.literal(`tools/call`),params:dj}),pj=Ek.extend({method:i.literal(`notifications/tools/list_changed`),params:Tk.optional()});i.object({autoRefresh:i.boolean().default(!0),debounceMs:i.number().int().nonnegative().default(300)});const mj=i.enum([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),hj=xk.extend({level:mj}),gj=wk.extend({method:i.literal(`logging/setLevel`),params:hj}),_j=Tk.extend({level:mj,logger:i.string().optional(),data:i.unknown()}),vj=Ek.extend({method:i.literal(`notifications/message`),params:_j}),yj=i.object({name:i.string().optional()}),bj=i.object({hints:i.array(yj).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()}),xj=i.object({mode:i.enum([`auto`,`required`,`none`]).optional()}),Sj=i.object({type:i.literal(`tool_result`),toolUseId:i.string().describe(`The unique identifier for the corresponding tool call.`),content:i.array(tj).default([]),structuredContent:i.object({}).loose().optional(),isError:i.boolean().optional(),_meta:i.record(i.string(),i.unknown()).optional()}),Cj=i.discriminatedUnion(`type`,[YA,XA,ZA]),wj=i.discriminatedUnion(`type`,[YA,XA,ZA,QA,Sj]),Tj=i.object({role:wA,content:i.union([wj,i.array(wj)]),_meta:i.record(i.string(),i.unknown()).optional()}),Ej=Sk.extend({messages:i.array(Tj),modelPreferences:bj.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:hk.optional(),tools:i.array(sj).optional(),toolChoice:xj.optional()}),Dj=wk.extend({method:i.literal(`sampling/createMessage`),params:Ej}),Oj=Dk.extend({model:i.string(),stopReason:i.optional(i.enum([`endTurn`,`stopSequence`,`maxTokens`]).or(i.string())),role:wA,content:Cj}),kj=Dk.extend({model:i.string(),stopReason:i.optional(i.enum([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(i.string())),role:wA,content:i.union([wj,i.array(wj)])}),Aj=i.object({type:i.literal(`boolean`),title:i.string().optional(),description:i.string().optional(),default:i.boolean().optional()}),jj=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()}),Mj=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()}),Nj=i.object({type:i.literal(`string`),title:i.string().optional(),description:i.string().optional(),enum:i.array(i.string()),default:i.string().optional()}),Pj=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()}),Fj=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()}),Ij=i.union([Nj,Pj]),Lj=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()}),Rj=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()}),zj=i.union([Lj,Rj]),Bj=i.union([Fj,Ij,zj]),Vj=i.union([Bj,Aj,jj,Mj]),Hj=Sk.extend({mode:i.literal(`form`).optional(),message:i.string(),requestedSchema:i.object({type:i.literal(`object`),properties:i.record(i.string(),Vj),required:i.array(i.string()).optional()})}),Uj=Sk.extend({mode:i.literal(`url`),message:i.string(),elicitationId:i.string(),url:i.string().url()}),Wj=i.union([Hj,Uj]),Gj=wk.extend({method:i.literal(`elicitation/create`),params:Wj}),Kj=Tk.extend({elicitationId:i.string()}),qj=Ek.extend({method:i.literal(`notifications/elicitation/complete`),params:Kj}),Jj=Dk.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())}),Yj=i.object({type:i.literal(`ref/resource`),uri:i.string()}),Xj=i.object({type:i.literal(`ref/prompt`),name:i.string()}),Zj=xk.extend({ref:i.union([Xj,Yj]),argument:i.object({name:i.string(),value:i.string()}),context:i.object({arguments:i.record(i.string(),i.string()).optional()}).optional()}),Qj=wk.extend({method:i.literal(`completion/complete`),params:Zj});function $j(e){if(e.params.ref.type!==`ref/prompt`)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function eM(e){if(e.params.ref.type!==`ref/resource`)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}const tM=Dk.extend({completion:i.looseObject({values:i.array(i.string()).max(100),total:i.optional(i.number().int()),hasMore:i.optional(i.boolean())})}),nM=i.object({uri:i.string().startsWith(`file://`),name:i.string().optional(),_meta:i.record(i.string(),i.unknown()).optional()}),rM=wk.extend({method:i.literal(`roots/list`),params:xk.optional()}),iM=Dk.extend({roots:i.array(nM)}),aM=Ek.extend({method:i.literal(`notifications/roots/list_changed`),params:Tk.optional()});i.union([tA,Zk,Qj,gj,JA,GA,OA,AA,PA,RA,BA,fj,cj,pA,hA,gA,vA]),i.union([Bk,iA,eA,aM,fA]),i.union([Rk,Oj,kj,Jj,iM,mA,_A,uA]),i.union([tA,Dj,Gj,rM,pA,hA,gA,vA]),i.union([Bk,iA,vj,HA,IA,pj,ij,fA,qj]),i.union([Rk,$k,tM,rj,KA,kA,jA,FA,uj,lj,mA,_A,uA]);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 oM(e.elicitations,n)}return new e(t,n,r)}},oM=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 sM(e){return e===`completed`||e===`failed`||e===`cancelled`}const cM=Symbol(`Let zodToJsonSchema decide on which parser to use`),lM={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`},uM=e=>typeof e==`string`?{...lM,name:e}:{...lM,...e},dM=e=>{let t=uM(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 fM(e,t,n,r){r?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function X(e,t,n,r,i){e[t]=n,fM(e,t,r,i)}const pM=(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 mM(e){if(e.target!==`openAi`)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy===`relative`?pM(t,e.currentPath):t.join(`/`)}}function hM(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 gM(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 _M(){return{type:`boolean`}}function vM(e,t){return Z(e.type._def,t)}const yM=(e,t)=>Z(e.innerType._def,t);function bM(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((n,r)=>bM(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 xM(e,t)}}const xM=(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 SM(e,t){return{...Z(e.innerType._def,t),default:e.defaultValue()}}function CM(e,t){return t.effectStrategy===`input`?Z(e.schema._def,t):mM(t)}function wM(e){return{type:`string`,enum:Array.from(e.values)}}const TM=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function EM(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(TM(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 DM(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 OM;const kM={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:()=>(OM===void 0&&(OM=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),OM),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 AM(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`:PM(n,`email`,r.message,t);break;case`format:idn-email`:PM(n,`idn-email`,r.message,t);break;case`pattern:zod`:FM(n,kM.email,r.message,t);break}break;case`url`:PM(n,`uri`,r.message,t);break;case`uuid`:PM(n,`uuid`,r.message,t);break;case`regex`:FM(n,r.regex,r.message,t);break;case`cuid`:FM(n,kM.cuid,r.message,t);break;case`cuid2`:FM(n,kM.cuid2,r.message,t);break;case`startsWith`:FM(n,RegExp(`^${jM(r.value,t)}`),r.message,t);break;case`endsWith`:FM(n,RegExp(`${jM(r.value,t)}$`),r.message,t);break;case`datetime`:PM(n,`date-time`,r.message,t);break;case`date`:PM(n,`date`,r.message,t);break;case`time`:PM(n,`time`,r.message,t);break;case`duration`:PM(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`:FM(n,RegExp(jM(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&PM(n,`ipv4`,r.message,t),r.version!==`v4`&&PM(n,`ipv6`,r.message,t);break;case`base64url`:FM(n,kM.base64url,r.message,t);break;case`jwt`:FM(n,kM.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&FM(n,kM.ipv4Cidr,r.message,t),r.version!==`v4`&&FM(n,kM.ipv6Cidr,r.message,t);break;case`emoji`:FM(n,kM.emoji(),r.message,t);break;case`ulid`:FM(n,kM.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:PM(n,`binary`,r.message,t);break;case`contentEncoding:base64`:X(n,`contentEncoding`,`base64`,r.message,t);break;case`pattern:zod`:FM(n,kM.base64,r.message,t);break}break;case`nanoid`:FM(n,kM.nanoid,r.message,t);case`toLowerCase`:case`toUpperCase`:case`trim`:break;default:(e=>{})(r)}return n}function jM(e,t){return t.patternStrategy===`escape`?NM(e):e}const MM=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function NM(e){let t=``;for(let n=0;n<e.length;n++)MM.has(e[n])||(t+=`\\`),t+=e[n];return t}function PM(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 FM(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:IM(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):X(e,`pattern`,IM(t,r),n,r)}function IM(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
|
|
180
|
+
]))`;continue}else if(r[e]===`$`){i+=`($|(?=[\r
|
|
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 LM(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]})??mM(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}=AM(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}=vM(e.keyType._def,t);return{...n,propertyNames:i}}return n}function RM(e,t){return t.mapStrategy===`record`?LM(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[Z(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||mM(t),Z(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||mM(t)],minItems:2,maxItems:2}}}function zM(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 BM(e){return e.target===`openAi`?void 0:{not:mM({...e,currentPath:[...e.currentPath,`not`]})}}function VM(e){return e.target===`openApi3`?{enum:[`null`],nullable:!0}:{type:`null`}}const HM={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function UM(e,t){if(t.target===`openApi3`)return WM(e,t);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in HM&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=HM[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 WM(e,t)}const WM=(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 GM(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:HM[e.innerType._def.typeName],nullable:!0}:{type:[HM[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 KM(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`,fM(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 qM(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=YM(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=JM(e,t);return o!==void 0&&(r.additionalProperties=o),r}function JM(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 YM(e){try{return e.isOptional()}catch{return!0}}const XM=(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:mM(t)},n]}:mM(t)},ZM=(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 QM(e,t){return Z(e.type._def,t)}function $M(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 eN(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 tN(e){return{not:mM(e)}}function nN(e){return mM(e)}const rN=(e,t)=>Z(e.innerType._def,t),iN=(e,t,n)=>{switch(t){case v.ZodString:return AM(e,n);case v.ZodNumber:return KM(e,n);case v.ZodObject:return qM(e,n);case v.ZodBigInt:return gM(e,n);case v.ZodBoolean:return _M();case v.ZodDate:return bM(e,n);case v.ZodUndefined:return tN(n);case v.ZodNull:return VM(n);case v.ZodArray:return hM(e,n);case v.ZodUnion:case v.ZodDiscriminatedUnion:return UM(e,n);case v.ZodIntersection:return EM(e,n);case v.ZodTuple:return eN(e,n);case v.ZodRecord:return LM(e,n);case v.ZodLiteral:return DM(e,n);case v.ZodEnum:return wM(e);case v.ZodNativeEnum:return zM(e);case v.ZodNullable:return GM(e,n);case v.ZodOptional:return XM(e,n);case v.ZodMap:return RM(e,n);case v.ZodSet:return $M(e,n);case v.ZodLazy:return()=>e.getter()._def;case v.ZodPromise:return QM(e,n);case v.ZodNaN:case v.ZodNever:return BM(n);case v.ZodEffects:return CM(e,n);case v.ZodAny:return mM(n);case v.ZodUnknown:return nN(n);case v.ZodDefault:return SM(e,n);case v.ZodBranded:return vM(e,n);case v.ZodReadonly:return rN(e,n);case v.ZodCatch:return yM(e,n);case v.ZodPipeline:return ZM(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!==cM)return i}if(r&&!n){let e=aN(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=iN(e,e.typeName,t),o=typeof a==`function`?Z(a(),t):a;if(o&&oN(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}const aN=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:pM(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`),mM(t)):t.$refStrategy===`seen`?mM(t):void 0}},oN=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),sN=(e,t)=>{let n=dM(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)??mM(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)??mM(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 cN(e){return!e||e===`jsonSchema7`||e===`draft-7`?`draft-7`:e===`jsonSchema2019-09`||e===`draft-2020-12`?`draft-2020-12`:`draft-7`}function lN(e,t){return nk(e)?te.toJSONSchema(e,{target:cN(t?.target),io:t?.pipeStrategy??`input`}):sN(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??`input`})}function uN(e){let t=ok(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=dk(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function dN(e,t){let n=ik(e,t);if(!n.success)throw n.error;return n.data}var fN=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(Bk,e=>{this._oncancel(e)}),this.setNotificationHandler(iA,e=>{this._onprogress(e)}),this.setRequestHandler(tA,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(pA,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(hA,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(!sM(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if(sM(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[mk]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(gA,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(vA,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(sM(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),Pk(e)||Ik(e)?this._onresponse(e):Ak(e)?this._onrequest(e,t):Mk(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?.[mk]?.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=Ck(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),Pk(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(Pk(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),Pk(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,uA,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},sM(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||{},[mk]: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=ik(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},mA,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},_A,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},yA,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||{},[mk]: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||{},[mk]: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||{},[mk]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=uN(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=dN(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=uN(e);this._notificationHandlers.set(n,n=>{let r=dN(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`&&Ak(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=fA.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),sM(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(sM(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=fA.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),sM(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}};function pN(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mN(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];pN(a)&&pN(i)?n[r]={...a,...i}:n[r]=i}return n}var hN=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})),gN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=hN();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=hN(),n=gN();var r=hN();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=gN();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=hN();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})),_N=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`)}})),vN=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=_N();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])}})),yN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=vN(),n=Q(),r=_N(),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)}})),bN=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})),xN=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})),SN=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=bN(),n=xN(),r=vN(),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
|
|
183
|
+
|| (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
|
|
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"
|
|
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}}})),CN=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)}`)}})),wN=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=_N(),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})),TN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=Q(),n=_N(),r=wN(),i=vN();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})),EN=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})),DN=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}})),ON=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`)}})),kN=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=DN(),r=ON(),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})),AN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=yN(),n=SN(),r=xN(),i=SN(),a=CN(),o=TN(),s=EN(),c=Q(),l=_N(),u=kN(),d=$(),f=vN();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})),jN=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}}})),MN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=kN();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))}}})),NN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=Q(),n=jN(),r=_N(),i=kN(),a=$(),o=AN();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}})),PN=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}})),FN=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}})),IN=t(((e,t)=>{let{isUUID:n}=FN(),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}})),LN=t(((e,t)=>{let{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizeComponentEncoding:a,isIPv4:o,nonSimpleDomain:s}=FN(),{SCHEMES:c,getSchemeHandler:l}=IN();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=_})),RN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=LN();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),zN=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=AN();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=jN(),i=MN(),a=bN(),o=NN(),s=Q(),c=kN(),l=SN(),u=$(),d=PN(),f=RN(),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]}}})),BN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),VN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callRef=e.getValidate=void 0;let t=MN(),n=wN(),r=Q(),i=_N(),a=NN(),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})),HN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=BN(),n=VN();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),UN=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})`)}}})),WN=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}))`)}}})),GN=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`})),KN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=GN();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}`)}}})),qN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=wN(),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})`)}}}})),JN=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}`)}}})),YN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=wN(),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)}}}})),XN=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}`)}}})),ZN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=DN();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),QN=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=SN(),n=Q(),r=$(),i=ZN();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)})))}}}})),$N=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=ZN();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}`)}}})),eP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=ZN();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}`}}}})),tP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=UN(),n=WN(),r=KN(),i=qN(),a=JN(),o=YN(),s=XN(),c=QN(),l=$N(),u=eP();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]})),nP=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})),rP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateTuple=void 0;let t=Q(),n=$(),r=wN(),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})),iP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=rP();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),aP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=$(),r=wN(),i=nP();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)))}}})),oP=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)))}}}})),sP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=Q(),n=$(),r=wN();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},
|
|
186
|
+
missingProperty: ${i},
|
|
187
|
+
depsCount: ${n},
|
|
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})),cP=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)}}})),lP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=wN(),n=Q(),r=_N(),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)}}}})),uP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=AN(),n=wN(),r=$(),i=lP();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)}}}})),dP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=wN(),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())})})}}}})),fP=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`}}})),pP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:wN().validateUnion,error:{message:`must match a schema in anyOf`}}})),mP=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)})})}}}})),hP=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)})}}})),gP=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})),_P=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`)}}})),vP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=nP(),n=iP(),r=rP(),i=aP(),a=oP(),o=sP(),s=cP(),c=lP(),l=uP(),u=dP(),d=fP(),f=pP(),p=mP(),m=hP(),h=gP(),g=_P();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=_})),yP=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})`}}}}})),bP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[yP().default]})),xP=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`]})),SP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=HN(),n=tP(),r=vP(),i=bP(),a=xP();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),CP=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={}))})),wP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Q(),n=CP(),r=NN(),i=MN(),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}}}}})),TP=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}})),EP=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=zN(),r=SP(),i=wP(),a=TP(),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=AN();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=jN();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return d.default}});var f=MN();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return f.default}})})),DP=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}}})),OP=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatLimitDefinition=void 0;let t=EP(),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)})),kP=t(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});let n=DP(),r=OP(),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})),AP=e(EP(),1),jP=e(kP(),1);function MP(){let e=new AP.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,jP.default)(e),e}var NP=class{constructor(e){this._ajv=e??MP()}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)}}},PP=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},Oj,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},Jj,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 FP(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 IP(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 LP=class extends fN{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(mj.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 NP,this.setRequestHandler(Zk,e=>this._oninitialize(e)),this.setNotificationHandler(eA,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(gj,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=mj.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||={tasks:new PP(this)},this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=mN(this._capabilities,e)}setRequestHandler(e,t){let n=ok(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let r;if(nk(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=ik(fj,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=ik(uA,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=ik(uj,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){IP(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&FP(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:pk.includes(t)?t:fk,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`},Rk)}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},kj,t):this.request({method:`sampling/createMessage`,params:e},Oj,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},Jj,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},Jj,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},iM,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 RP=Symbol.for(`mcp.completable`);function zP(e){return!!e&&typeof e==`object`&&RP in e}function BP(e){return e[RP]?.complete}var VP;(function(e){e.Completable=`McpCompletable`})(VP||={});const HP=/^[A-Za-z0-9._-]{1,128}$/;function UP(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`),!HP.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 WP(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 GP(e){let t=UP(e);return WP(e,t.warnings),t.isValid}var KP=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)}},qP=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 LP(e,t)}get experimental(){return this._experimental||={tasks:new KP(this)},this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||=(this.server.assertCanSetRequestHandler(eF(cj)),this.server.assertCanSetRequestHandler(eF(fj)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(cj,()=>({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=sk(t.inputSchema);return e?lN(e,{strictUnions:!0,pipeStrategy:`input`}):JP})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let e=sk(t.outputSchema);e&&(n.outputSchema=lN(e,{strictUnions:!0,pipeStrategy:`output`}))}return n})})),this.server.setRequestHandler(fj,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 ak(sk(e.inputSchema)??e.inputSchema,t);if(!r.success){let e=ck(`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 ak(sk(e.outputSchema),t.structuredContent);if(!r.success){let e=ck(`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(eF(Qj)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Qj,async e=>{switch(e.params.ref.type){case`ref/prompt`:return $j(e),this.handlePromptCompletion(e,e.params.ref);case`ref/resource`:return eM(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 nF;let r=ok(n.argsSchema)?.[e.params.argument.name];if(!zP(r))return nF;let i=BP(r);return i?tF(await i(e.params.argument.value,e.params.context)):nF}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 nF;throw new Y(J.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let r=n.resourceTemplate.completeCallback(e.params.argument.name);return r?tF(await r(e.params.argument.value,e.params.context)):nF}setResourceRequestHandlers(){this._resourceHandlersInitialized||=(this.server.assertCanSetRequestHandler(eF(OA)),this.server.assertCanSetRequestHandler(eF(AA)),this.server.assertCanSetRequestHandler(eF(PA)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(OA,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(AA,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(PA,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(eF(GA)),this.server.assertCanSetRequestHandler(eF(JA)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(GA,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?$P(t.argsSchema):void 0}))})),this.server.setRequestHandler(JA,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 ak(sk(n.argsSchema),e.params.arguments);if(!r.success){let t=ck(`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:rk(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=rk(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=>zP(e instanceof r?e._def?.innerType:e))&&this.setCompletionRequestHandler(),o}_createRegisteredTool(e,t,n,r,i,a,o,s,c){GP(e);let l={title:t,description:n,inputSchema:QP(r),outputSchema:QP(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`&&GP(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=rk(t.paramsSchema)),t.outputSchema!==void 0&&(l.outputSchema=rk(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];ZP(e)?(r=t.shift(),t.length>1&&typeof t[0]==`object`&&t[0]!==null&&!ZP(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 JP={type:`object`,properties:{}};function YP(e){return typeof e==`object`&&!!e&&`parse`in e&&typeof e.parse==`function`&&`safeParse`in e&&typeof e.safeParse==`function`}function XP(e){return`_def`in e||`_zod`in e||YP(e)}function ZP(e){return typeof e!=`object`||!e||XP(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(YP)}function QP(e){if(e)return ZP(e)?rk(e):e}function $P(e){let t=ok(e);return t?Object.entries(t).map(([e,t])=>({name:e,description:lk(t),required:!uk(t)})):[]}function eF(e){let t=ok(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=dk(t);if(typeof n==`string`)return n;throw Error(`Schema method literal must be a string`)}function tF(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}const nF={completion:{values:[],hasMore:!1}};var rF=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),iF(t)}clear(){this._buffer=void 0}};function iF(e){return Lk.parse(JSON.parse(e))}function aF(e){return JSON.stringify(e)+`
|
|
190
|
+
`}var oF=class{constructor(e=h.stdin,t=h.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new rF,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=aF(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};const sF=e=>({content:[{type:`text`,text:e}]}),cF=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)},lF=e=>sF(cF(e)),uF=e=>({content:[{type:`image`,data:e,mimeType:`image/png`}]}),dF=Object.getPrototypeOf(async()=>{}).constructor,fF=e=>{let t=t=>e.runPromise(t),n=new qP({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*$O;if(t.hasSession())return yield*t.navigate(e,{waitUntil:i}),sF(`Navigated to ${e}`);let a=yield*t.open(e,{headed:n,cookies:r,waitUntil:i});return sF(`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*$O).requireSession(),n=e=>{if(!t.lastSnapshot)throw Error(`No snapshot taken yet. Call screenshot with mode 'snapshot' first.`);return ym(t.lastSnapshot.locator(e))};return yield*np(async()=>{try{let r=await new dF(`page`,`context`,`browser`,`ref`,e)(t.page,t.context,t.browser,n);return r===void 0?sF(`OK`):lF(r)}catch(e){return sF(`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*$O,r=yield*t.requirePage(),i=e??`screenshot`;if(i===`snapshot`){let e=yield*t.snapshot(r);return yield*t.updateLastSnapshot(e),lF({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 uF((yield*rp(()=>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*$O).requireSession(),r=e?t.consoleMessages.filter(t=>t.type===e):t.consoleMessages;return n&&(t.consoleMessages.length=0),r.length===0?sF(`No console messages captured.`):lF(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*$O).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?sF(`No network requests captured.`):lF(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*_O(yield*(yield*$O).requirePage(),`getPerformanceMetrics`);return e.fcp||e.lcp||e.inp?lF(e):sF(`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*$O).close();if(!e)return sF(`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}`),sF(t.join(`
|
|
192
|
+
`))}))),n},pF=async e=>{let t=fF(e),n=new oF;await t.connect(n)};export{gx as $,de as $i,Bp as $n,Du as $r,Jm as $t,LS as A,xr as Ai,Dm as An,Ad as Ar,gb as At,RS as B,qt as Bi,Vp as Bn,qu as Br,zv as Bt,YS as C,Gr as Ci,nm as Cn,Ed as Cr,Lx as Ct,DS as D,Mr as Di,jp as Dn,P as Dr,zy as Dt,NS as E,ii as Ei,L as En,Md as Er,sb as Et,XS as F,dr as Fi,Rp as Fn,Yu as Fr,my as Ft,_x as G,Fe as Gi,hm as Gn,Uu as Gr,hv as Gt,tC as H,Ke as Hi,pm as Hn,Bu as Hr,Lv as Ht,QS as I,br as Ii,lp as In,Xu as Ir,cy as It,Sx as J,Se as Ji,bm as Jn,Pu as Jr,iv as Jt,kx as K,ke as Ki,_m as Kn,zu as Kr,yv as Kt,$S as L,fr as Li,Qp as Ln,nd as Lr,dy as Lt,JS as M,gr as Mi,Em as Mn,cd as Mr,Eb as Mt,HS as N,yr as Ni,wm as Nn,dd as Nr,hy as Nt,IS as O,k as Oi,$p as On,Pd as Or,Ly as Ot,GS as P,ur as Pi,B as Pn,ad as Pr,py as Pt,q as Q,b as Qi,zp as Qn,Au as Qr,sv as Qt,ZS as R,D as Ri,Dp as Rn,rd as Rr,fy as Rt,jS as S,Yr as Si,ep as Sn,Sd as Sr,mx as St,PS as T,ai as Ti,cm as Tn,bd as Tr,dS as Tt,rC as U,je as Ui,dm as Un,Ru as Ur,vv as Ut,BS as V,qe as Vi,Wp as Vn,Vu as Vr,Bv as Vt,FS as W,C as Wi,fm as Wn,Wu as Wr,_v as Wt,tS as X,ae as Xi,Kp as Xn,Mu as Xr,fv as Xt,cS as Y,Te as Yi,Gp as Yn,wu as Yr,lv as Yt,Qx as Z,le as Zi,qp as Zn,ju as Zr,uv as Zt,YC as _,Bi as _i,up as _n,vf as _r,ox as _t,bE as a,Va as ai,am as an,Op as ar,qx as at,AS as b,ri as bi,H as bn,qd as br,dx as bt,Vw as c,A as ci,vp as cn,Pp as cr,G as ct,xw as d,Ca as di,V as dn,fp as dr,Ux as dt,x as ea,Eu as ei,Xm as en,F as er,Nx as et,bw as f,pa as fi,xp as fn,sp as fr,Ox as ft,qC as g,Mi as gi,R as gn,xf as gr,Rx as gt,vw as h,aa as hi,dp as hn,Zf as hr,vx as ht,nE as i,Ka as ii,hp as in,kp as ir,Kx as it,VS as j,pr as ji,Tm as jn,id as jr,hb as jt,US as k,Sr as ki,Qf as kn,wd as kr,rb as kt,Mw as l,ba as li,yp as ln,im as lr,Tx as lt,gw as m,oa as mi,Fp as mn,pp as mr,Mx as mt,tk as n,y as na,Ou as ni,Yp as nn,I as nr,Px as nt,_E as o,Fa as oi,Om as on,Mp as or,$x as ot,yw as p,sa as pi,Sp as pn,tp as pr,Fx as pt,Cx as q,S as qi,ym as qn,Hu as qr,rv as qt,$O as r,ro as ri,$f as rn,gp as rr,xx as rt,pE as s,Ma as si,km as sn,Np as sr,Ex as st,pF as t,ue as ta,Nu as ti,Jp as tn,op as tr,Ax as tt,Ow as u,_a as ui,cp as un,rp as ur,lS as ut,XC as v,Qi as vi,um as vn,yf as vr,lx as vt,zS as w,Zr as wi,lm as wn,kd as wr,K as wt,KS as x,si as xi,Cm as xn,Gd as xr,eS as xt,aC as y,Vr as yi,z as yn,_f as yr,cx as yt,qS as z,O as zi,np as zn,Ju as zr,uy as zt};
|
|
193
|
+
//# sourceMappingURL=server-D-3IipQn.js.map
|