{"protocol":13,"version":"0.0.1-beta.100","server":{"node_modules/apps/skills/effect.js":"import{a,b}from\"../chunk-CWIMLCDY.js\";import\"../chunk-IRY5FGME.js\";import\"../chunk-OOJM4CTU.js\";export{b as folderSkillsEffect,a as skillFromFiles};\n","node_modules/apps/operations/approval.js":"import\"../chunk-OOJM4CTU.js\";var p=()=>()=>\"user-approval\",t=()=>()=>\"approved\";export{p as always,t as never};\n","node_modules/apps/browser-LGB77CRC.js":"import{A,B,C,D,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from\"./chunk-OFSIEQZ2.js\";import\"./chunk-OOJM4CTU.js\";export{k as Alias,v as CST,u as Composer,q as Document,w as Lexer,x as LineCounter,m as Pair,y as Parser,l as Scalar,p as Schema,r as YAMLError,n as YAMLMap,s as YAMLParseError,o as YAMLSeq,t as YAMLWarning,D as default,a as isAlias,g as isCollection,b as isDocument,c as isMap,h as isNode,d as isPair,e as isScalar,f as isSeq,B as parse,z as parseAllDocuments,A as parseDocument,C as stringify,i as visit,j as visitAsync};\n","node_modules/apps/es-KUCVESUL.js":"import{a as Ze,b as Jc,c as NA,d as kA,e as Xt,f as Ke,g as DA,h as qA}from\"./chunk-U7D4LK7G.js\";import{a as w,b as vr,c as Le}from\"./chunk-OOJM4CTU.js\";var Rr=w((moe,BA)=>{\"use strict\";BA.exports=function(t){try{return!!t()}catch{return!0}}});var Wc=w((doe,UA)=>{\"use strict\";var v3=Rr();UA.exports=!v3(function(){var t=function(){}.bind();return typeof t!=\"function\"||t.hasOwnProperty(\"prototype\")})});var _r=w((hoe,zA)=>{\"use strict\";var JA=Wc(),HA=Function.prototype,Zm=HA.call,E3=JA&&HA.bind.bind(Zm,Zm);zA.exports=JA?E3:function(t){return function(){return Zm.apply(t,arguments)}}});var Oa=w((xoe,KA)=>{\"use strict\";var b3=_r();KA.exports=b3({}.isPrototypeOf)});var rr=w((ed,WA)=>{\"use strict\";var Gc=function(t){return t&&t.Math===Math&&t};WA.exports=Gc(typeof globalThis==\"object\"&&globalThis)||Gc(typeof window==\"object\"&&window)||Gc(typeof self==\"object\"&&self)||Gc(typeof global==\"object\"&&global)||Gc(typeof ed==\"object\"&&ed)||(function(){return this})()||Function(\"return this\")()});var Gu=w((yoe,QA)=>{\"use strict\";var S3=Wc(),XA=Function.prototype,GA=XA.apply,YA=XA.call;QA.exports=typeof Reflect==\"object\"&&Reflect.apply||(S3?YA.bind(GA):function(){return YA.apply(GA,arguments)})});var Yc=w((goe,eR)=>{\"use strict\";var ZA=_r(),O3=ZA({}.toString),w3=ZA(\"\".slice);eR.exports=function(t){return w3(O3(t),8,-1)}});var td=w((voe,tR)=>{\"use strict\";var j3=Yc(),P3=_r();tR.exports=function(t){if(j3(t)===\"Function\")return P3(t)}});var ir=w((Eoe,rR)=>{\"use strict\";var rd=typeof document==\"object\"&&document.all;rR.exports=typeof rd>\"u\"&&rd!==void 0?function(t){return typeof t==\"function\"||t===rd}:function(t){return typeof t==\"function\"}});var vo=w((boe,iR)=>{\"use strict\";var A3=Rr();iR.exports=!A3(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Js=w((Soe,oR)=>{\"use strict\";var R3=Wc(),Yu=Function.prototype.call;oR.exports=R3?Yu.bind(Yu):function(){return Yu.apply(Yu,arguments)}});var cR=w(aR=>{\"use strict\";var sR={}.propertyIsEnumerable,nR=Object.getOwnPropertyDescriptor,_3=nR&&!sR.call({1:2},1);aR.f=_3?function(e){var r=nR(this,e);return!!r&&r.enumerable}:sR});var wa=w((woe,lR)=>{\"use strict\";lR.exports=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}}});var pR=w((joe,uR)=>{\"use strict\";var I3=_r(),C3=Rr(),T3=Yc(),id=Object,M3=I3(\"\".split);uR.exports=C3(function(){return!id(\"z\").propertyIsEnumerable(0)})?function(t){return T3(t)===\"String\"?M3(t,\"\"):id(t)}:id});var Xu=w((Poe,fR)=>{\"use strict\";fR.exports=function(t){return t==null}});var ja=w((Aoe,mR)=>{\"use strict\";var F3=Xu(),$3=TypeError;mR.exports=function(t){if(F3(t))throw new $3(\"Can't call method on \"+t);return t}});var Pa=w((Roe,dR)=>{\"use strict\";var N3=pR(),k3=ja();dR.exports=function(t){return N3(k3(t))}});var kr=w((_oe,hR)=>{\"use strict\";var D3=ir();hR.exports=function(t){return typeof t==\"object\"?t!==null:D3(t)}});var Xc=w((Ioe,xR)=>{\"use strict\";xR.exports={}});var Aa=w((Coe,gR)=>{\"use strict\";var od=Xc(),sd=rr(),q3=ir(),yR=function(t){return q3(t)?t:void 0};gR.exports=function(t,e){return arguments.length<2?yR(od[t])||yR(sd[t]):od[t]&&od[t][e]||sd[t]&&sd[t][e]}});var SR=w((Toe,bR)=>{\"use strict\";var V3=rr(),vR=V3.navigator,ER=vR&&vR.userAgent;bR.exports=ER?String(ER):\"\"});var _R=w((Moe,RR)=>{\"use strict\";var AR=rr(),nd=SR(),OR=AR.process,wR=AR.Deno,jR=OR&&OR.versions||wR&&wR.version,PR=jR&&jR.v8,Qr,Qu;PR&&(Qr=PR.split(\".\"),Qu=Qr[0]>0&&Qr[0]<4?1:+(Qr[0]+Qr[1]));!Qu&&nd&&(Qr=nd.match(/Edge\\/(\\d+)/),(!Qr||Qr[1]>=74)&&(Qr=nd.match(/Chrome\\/(\\d+)/),Qr&&(Qu=+Qr[1])));RR.exports=Qu});var ad=w((Foe,CR)=>{\"use strict\";var IR=_R(),L3=Rr(),B3=rr(),U3=B3.String;CR.exports=!!Object.getOwnPropertySymbols&&!L3(function(){var t=Symbol(\"symbol detection\");return!U3(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&IR&&IR<41})});var cd=w(($oe,TR)=>{\"use strict\";var J3=ad();TR.exports=J3&&!Symbol.sham&&typeof Symbol.iterator==\"symbol\"});var ld=w((Noe,MR)=>{\"use strict\";var H3=Aa(),z3=ir(),K3=Oa(),W3=cd(),G3=Object;MR.exports=W3?function(t){return typeof t==\"symbol\"}:function(t){var e=H3(\"Symbol\");return z3(e)&&K3(e.prototype,G3(t))}});var Zu=w((koe,FR)=>{\"use strict\";var Y3=String;FR.exports=function(t){try{return Y3(t)}catch{return\"Object\"}}});var ep=w((Doe,$R)=>{\"use strict\";var X3=ir(),Q3=Zu(),Z3=TypeError;$R.exports=function(t){if(X3(t))return t;throw new Z3(Q3(t)+\" is not a function\")}});var tp=w((qoe,NR)=>{\"use strict\";var eU=ep(),tU=Xu();NR.exports=function(t,e){var r=t[e];return tU(r)?void 0:eU(r)}});var DR=w((Voe,kR)=>{\"use strict\";var ud=Js(),pd=ir(),fd=kr(),rU=TypeError;kR.exports=function(t,e){var r,i;if(e===\"string\"&&pd(r=t.toString)&&!fd(i=ud(r,t))||pd(r=t.valueOf)&&!fd(i=ud(r,t))||e!==\"string\"&&pd(r=t.toString)&&!fd(i=ud(r,t)))return i;throw new rU(\"Can't convert object to primitive value\")}});var Ra=w((Loe,qR)=>{\"use strict\";qR.exports=!0});var BR=w((Boe,LR)=>{\"use strict\";var VR=rr(),iU=Object.defineProperty;LR.exports=function(t,e){try{iU(VR,t,{value:e,configurable:!0,writable:!0})}catch{VR[t]=e}return e}});var rp=w((Uoe,HR)=>{\"use strict\";var oU=Ra(),sU=rr(),nU=BR(),UR=\"__core-js_shared__\",JR=HR.exports=sU[UR]||nU(UR,{});(JR.versions||(JR.versions=[])).push({version:\"3.50.0\",mode:oU?\"pure\":\"global\",copyright:\"\\xA9 2013\\u20132025 Denis Pushkarev (zloirock.ru), 2025\\u20132026 CoreJS Company (core-js.io). All rights reserved.\",license:\"https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE\",source:\"https://github.com/zloirock/core-js\"})});var md=w((Joe,KR)=>{\"use strict\";var zR=rp(),aU=Object.create||Object;KR.exports=function(t,e){return zR[t]||(zR[t]=e||aU(null))}});var dd=w((Hoe,WR)=>{\"use strict\";var cU=ja(),lU=Object;WR.exports=function(t){return lU(cU(t))}});var Dr=w((zoe,GR)=>{\"use strict\";var uU=_r(),pU=dd(),fU=uU({}.hasOwnProperty);GR.exports=Object.hasOwn||function(e,r){return fU(pU(e),r)}});var hd=w((Koe,YR)=>{\"use strict\";var mU=_r(),dU=0,hU=Math.random(),xU=mU(1.1.toString);YR.exports=function(t){return\"Symbol(\"+(t===void 0?\"\":t)+\")_\"+xU(++dU+hU,36)}});var qr=w((Woe,QR)=>{\"use strict\";var yU=rr(),gU=md(),XR=Dr(),vU=hd(),EU=ad(),bU=cd(),_a=yU.Symbol,xd=gU(\"wks\"),SU=bU?_a.for||_a:_a&&_a.withoutSetter||vU;QR.exports=function(t){return XR(xd,t)||(xd[t]=EU&&XR(_a,t)?_a[t]:SU(\"Symbol.\"+t)),xd[t]}});var r0=w((Goe,t0)=>{\"use strict\";var OU=Js(),ZR=kr(),e0=ld(),wU=tp(),jU=DR(),PU=qr(),AU=TypeError,RU=PU(\"toPrimitive\");t0.exports=function(t,e){if(!ZR(t)||e0(t))return t;var r=wU(t,RU),i;if(r){if(e===void 0&&(e=\"default\"),i=OU(r,t,e),!ZR(i)||e0(i))return i;throw new AU(\"Can't convert object to primitive value\")}return e===void 0&&(e=\"number\"),jU(t,e)}});var yd=w((Yoe,i0)=>{\"use strict\";var _U=r0(),IU=ld();i0.exports=function(t){var e=_U(t,\"string\");return IU(e)?e:e+\"\"}});var vd=w((Xoe,s0)=>{\"use strict\";var CU=rr(),o0=kr(),gd=CU.document,TU=o0(gd)&&o0(gd.createElement);s0.exports=function(t){return TU?gd.createElement(t):{}}});var Ed=w((Qoe,n0)=>{\"use strict\";var MU=vo(),FU=Rr(),$U=vd();n0.exports=!MU&&!FU(function(){return Object.defineProperty($U(\"div\"),\"a\",{get:function(){return 7}}).a!==7})});var bd=w(c0=>{\"use strict\";var NU=vo(),kU=Js(),DU=cR(),qU=wa(),VU=Pa(),LU=yd(),BU=Dr(),UU=Ed(),a0=Object.getOwnPropertyDescriptor;c0.f=NU?a0:function(e,r){if(e=VU(e),r=LU(r),UU)try{return a0(e,r)}catch{}if(BU(e,r))return qU(!kU(DU.f,e,r),e[r])}});var u0=w((ese,l0)=>{\"use strict\";var JU=Rr(),HU=ir(),zU=/#|\\.prototype\\./,Qc=function(t,e){var r=WU[KU(t)];return r===YU?!0:r===GU?!1:HU(e)?JU(e):!!e},KU=Qc.normalize=function(t){return String(t).replace(zU,\".\").toLowerCase()},WU=Qc.data={},GU=Qc.NATIVE=\"N\",YU=Qc.POLYFILL=\"P\";l0.exports=Qc});var Sd=w((tse,f0)=>{\"use strict\";var p0=td(),XU=ep(),QU=Wc(),ZU=p0(p0.bind);f0.exports=function(t,e){return XU(t),e===void 0?t:QU?ZU(t,e):function(){return t.apply(e,arguments)}}});var Od=w((rse,m0)=>{\"use strict\";var eJ=vo(),tJ=Rr();m0.exports=eJ&&tJ(function(){return Object.defineProperty(function(){},\"prototype\",{value:42,writable:!1}).prototype!==42})});var Hs=w((ise,d0)=>{\"use strict\";var rJ=kr(),iJ=String,oJ=TypeError;d0.exports=function(t){if(rJ(t))return t;throw new oJ(iJ(t)+\" is not an object\")}});var jn=w(x0=>{\"use strict\";var sJ=vo(),nJ=Ed(),aJ=Od(),ip=Hs(),h0=yd(),cJ=TypeError,wd=Object.defineProperty,lJ=Object.getOwnPropertyDescriptor,jd=\"enumerable\",Pd=\"configurable\",Ad=\"writable\";x0.f=sJ?aJ?function(e,r,i){if(ip(e),r=h0(r),ip(i),typeof e==\"function\"&&r===\"prototype\"&&\"value\"in i&&Ad in i&&!i[Ad]){var o=lJ(e,r);o&&o[Ad]&&(e[r]=i.value,i={configurable:Pd in i?i[Pd]:o[Pd],enumerable:jd in i?i[jd]:o[jd],writable:!1})}return wd(e,r,i)}:wd:function(e,r,i){if(ip(e),r=h0(r),ip(i),nJ)try{return wd(e,r,i)}catch{}if(\"get\"in i||\"set\"in i)throw new cJ(\"Accessors not supported\");return\"value\"in i&&(e[r]=i.value),e}});var Eo=w((sse,y0)=>{\"use strict\";var uJ=vo(),pJ=jn(),fJ=wa();y0.exports=uJ?function(t,e,r){return pJ.f(t,e,fJ(1,r))}:function(t,e,r){return t[e]=r,t}});var Pn=w((nse,v0)=>{\"use strict\";var Zc=rr(),mJ=Gu(),dJ=td(),hJ=ir(),xJ=bd().f,yJ=u0(),Ia=Xc(),gJ=Sd(),Ca=Eo(),g0=Dr();rp();var vJ=function(t){var e=function(r,i,o){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,i)}return new t(r,i,o)}return mJ(t,this,arguments)};return e.prototype=t.prototype,e};v0.exports=function(t,e){var r=t.target,i=t.global,o=t.stat,s=t.proto,n=i?Zc:o?Zc[r]:Zc[r]&&Zc[r].prototype,a=i?Ia:Ia[r]||Ca(Ia,r,{})[r],p=a.prototype,l,u,f,m,x,h,O,j,v;for(m in e)l=yJ(i?m:r+(o?\".\":\"#\")+m,t.forced),u=!l&&n&&g0(n,m),h=a[m],u&&(t.dontCallGetSet?(v=xJ(n,m),O=v&&v.value):O=n[m]),x=u&&O?O:e[m],!(!l&&!s&&typeof h==typeof x)&&(t.bind&&u?j=gJ(x,Zc):t.wrap&&u?j=vJ(x):s&&hJ(x)?j=dJ(x):j=x,(t.sham||x&&x.sham||h&&h.sham)&&Ca(j,\"sham\",!0),Ca(a,m,j),s&&(f=r+\"Prototype\",g0(Ia,f)||Ca(Ia,f,{}),Ca(Ia[f],m,x),t.real&&p&&(l||!p[m])&&Ca(p,m,x)))}});var b0=w((ase,E0)=>{\"use strict\";var EJ=Math.ceil,bJ=Math.floor;E0.exports=Math.trunc||function(e){var r=+e;return(r>0?bJ:EJ)(r)}});var op=w((cse,S0)=>{\"use strict\";var SJ=b0();S0.exports=function(t){var e=+t;return e!==e||e===0?0:SJ(e)}});var w0=w((lse,O0)=>{\"use strict\";var OJ=op(),wJ=Math.max,jJ=Math.min;O0.exports=function(t,e){var r=OJ(t);return r<0?wJ(r+e,0):jJ(r,e)}});var P0=w((use,j0)=>{\"use strict\";var PJ=op(),AJ=Math.min;j0.exports=function(t){var e=PJ(t);return e>0?AJ(e,9007199254740991):0}});var Rd=w((pse,A0)=>{\"use strict\";var RJ=P0();A0.exports=function(t){return RJ(t.length)}});var _d=w((fse,_0)=>{\"use strict\";var _J=Pa(),IJ=w0(),CJ=Rd(),R0=function(t){return function(e,r,i){var o=_J(e),s=CJ(o);if(s===0)return!t&&-1;var n=IJ(i,s),a;if(t&&r!==r){for(;s>n;)if(a=o[n++],a!==a)return!0}else for(;s>n;n++)if((t||n in o)&&o[n]===r)return t||n||0;return!t&&-1}};_0.exports={includes:R0(!0),indexOf:R0(!1)}});var Id=w((mse,I0)=>{\"use strict\";I0.exports=function(){}});var T0=w(()=>{\"use strict\";var TJ=Pn(),MJ=_d().includes,C0=Rr(),FJ=Id(),$J=C0(function(){return!Array(1).includes()}),NJ=C0(function(){return[,1].includes(void 0,1)});TJ({target:\"Array\",proto:!0,forced:$J||NJ},{includes:function(e){return MJ(this,e,arguments.length>1?arguments[1]:void 0)}});FJ(\"includes\")});var Cd=w((xse,M0)=>{\"use strict\";var kJ=rr(),DJ=Xc();M0.exports=function(t,e){var r=DJ[t+\"Prototype\"],i=r&&r[e];if(i)return i;var o=kJ[t],s=o&&o.prototype;return s&&s[e]}});var $0=w((yse,F0)=>{\"use strict\";T0();var qJ=Cd();F0.exports=qJ(\"Array\",\"includes\")});var k0=w((gse,N0)=>{\"use strict\";var VJ=kr(),LJ=Yc(),BJ=qr(),UJ=BJ(\"match\");N0.exports=function(t){var e;return VJ(t)&&((e=t[UJ])!==void 0?!!e:LJ(t)===\"RegExp\")}});var q0=w((vse,D0)=>{\"use strict\";var JJ=k0(),HJ=TypeError;D0.exports=function(t){if(JJ(t))throw new HJ(\"The method doesn't accept regular expressions\");return t}});var sp=w((Ese,L0)=>{\"use strict\";var zJ=qr(),KJ=zJ(\"toStringTag\"),V0={};V0[KJ]=\"z\";L0.exports=String(V0)===\"[object z]\"});var ap=w((bse,B0)=>{\"use strict\";var WJ=sp(),GJ=ir(),np=Yc(),YJ=qr(),XJ=YJ(\"toStringTag\"),QJ=Object,ZJ=np((function(){return arguments})())===\"Arguments\",e4=function(t,e){try{return t[e]}catch{}};B0.exports=WJ?np:function(t){var e,r,i;return t===void 0?\"Undefined\":t===null?\"Null\":typeof(r=e4(e=QJ(t),XJ))==\"string\"?r:ZJ?np(e):(i=np(e))===\"Object\"&&GJ(e.callee)?\"Arguments\":i}});var el=w((Sse,U0)=>{\"use strict\";var t4=ap(),r4=String;U0.exports=function(t){if(t4(t)===\"Symbol\")throw new TypeError(\"Cannot convert a Symbol value to a string\");return r4(t)}});var H0=w((Ose,J0)=>{\"use strict\";var i4=qr(),o4=i4(\"match\");J0.exports=function(t){var e=/./;try{\"/./\"[t](e)}catch{try{return e[o4]=!1,\"/./\"[t](e)}catch{}}return!1}});var K0=w(()=>{\"use strict\";var s4=Pn(),n4=_r(),a4=q0(),c4=ja(),z0=el(),l4=H0(),u4=n4(\"\".indexOf);s4({target:\"String\",proto:!0,forced:!l4(\"includes\")},{includes:function(e){return!!~u4(z0(c4(this)),z0(a4(e)),arguments.length>1?arguments[1]:void 0)}})});var G0=w((Pse,W0)=>{\"use strict\";K0();var p4=Cd();W0.exports=p4(\"String\",\"includes\")});var Q0=w((Ase,X0)=>{\"use strict\";var Y0=Oa(),f4=$0(),m4=G0(),Td=Array.prototype,Md=String.prototype;X0.exports=function(t){var e=t.includes;return t===Td||Y0(Td,t)&&e===Td.includes?f4:typeof t==\"string\"||t===Md||Y0(Md,t)&&e===Md.includes?m4:e}});var e_=w((Rse,Z0)=>{\"use strict\";var d4=Q0();Z0.exports=d4});var Er=w((_se,t_)=>{t_.exports=e_()});var X_=w((ane,Y_)=>{\"use strict\";var D4=function(e){return q4(e)&&!V4(e)};function q4(t){return!!t&&typeof t==\"object\"}function V4(t){var e=Object.prototype.toString.call(t);return e===\"[object RegExp]\"||e===\"[object Date]\"||U4(t)}var L4=typeof Symbol==\"function\"&&Symbol.for,B4=L4?Symbol.for(\"react.element\"):60103;function U4(t){return t.$$typeof===B4}function J4(t){return Array.isArray(t)?[]:{}}function nl(t,e){return e.clone!==!1&&e.isMergeableObject(t)?Fa(J4(t),t,e):t}function H4(t,e,r){return t.concat(e).map(function(i){return nl(i,r)})}function z4(t,e){if(!e.customMerge)return Fa;var r=e.customMerge(t);return typeof r==\"function\"?r:Fa}function K4(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[]}function W_(t){return Object.keys(t).concat(K4(t))}function G_(t,e){try{return e in t}catch{return!1}}function W4(t,e){return G_(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))}function G4(t,e,r){var i={};return r.isMergeableObject(t)&&W_(t).forEach(function(o){i[o]=nl(t[o],r)}),W_(e).forEach(function(o){W4(t,o)||(G_(t,o)&&r.isMergeableObject(e[o])?i[o]=z4(o,r)(t[o],e[o],r):i[o]=nl(e[o],r))}),i}function Fa(t,e,r){r=r||{},r.arrayMerge=r.arrayMerge||H4,r.isMergeableObject=r.isMergeableObject||D4,r.cloneUnlessOtherwiseSpecified=nl;var i=Array.isArray(e),o=Array.isArray(t),s=i===o;return s?i?r.arrayMerge(t,e,r):G4(t,e,r):nl(e,r)}Fa.all=function(e,r){if(!Array.isArray(e))throw new Error(\"first argument should be an array\");return e.reduce(function(i,o){return Fa(i,o,r)},{})};var Y4=Fa;Y_.exports=Y4});var bp=w((lne,nI)=>{\"use strict\";var fH=md(),mH=hd(),sI=fH(\"keys\");nI.exports=function(t){return sI[t]||(sI[t]=mH(t))}});var cI=w((une,aI)=>{\"use strict\";var dH=Rr();aI.exports=!dH(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})});var Sp=w((pne,uI)=>{\"use strict\";var hH=Dr(),xH=ir(),yH=dd(),gH=bp(),vH=cI(),lI=gH(\"IE_PROTO\"),mh=Object,EH=mh.prototype;uI.exports=vH?mh.getPrototypeOf:function(t){var e=yH(t);if(hH(e,lI))return e[lI];var r=e.constructor;return xH(r)&&e instanceof r?r.prototype:e instanceof mh?EH:null}});var fI=w((fne,pI)=>{\"use strict\";var bH=_r(),SH=ep();pI.exports=function(t,e,r){try{return bH(SH(Object.getOwnPropertyDescriptor(t,e)[r]))}catch{}}});var dI=w((mne,mI)=>{\"use strict\";var OH=kr();mI.exports=function(t){return OH(t)||t===null}});var xI=w((dne,hI)=>{\"use strict\";var wH=dI(),jH=String,PH=TypeError;hI.exports=function(t){if(wH(t))return t;throw new PH(\"Can't set \"+jH(t)+\" as a prototype\")}});var cl=w((hne,yI)=>{\"use strict\";var AH=fI(),RH=kr(),_H=ja(),IH=xI();yI.exports=Object.setPrototypeOf||(\"__proto__\"in{}?(function(){var t=!1,e={},r;try{r=AH(Object.prototype,\"__proto__\",\"set\"),r(e,[]),t=e instanceof Array}catch{}return function(o,s){return _H(o),IH(s),RH(o)&&(t?r(o,s):o.__proto__=s),o}})():void 0)});var Op=w((xne,gI)=>{\"use strict\";gI.exports={}});var hh=w((yne,EI)=>{\"use strict\";var CH=_r(),dh=Dr(),TH=Pa(),MH=_d().indexOf,FH=Op(),vI=CH([].push);EI.exports=function(t,e){var r=TH(t),i=0,o=[],s;for(s in r)!dh(FH,s)&&dh(r,s)&&vI(o,s);for(;e.length>i;)dh(r,s=e[i++])&&(~MH(o,s)||vI(o,s));return o}});var wp=w((gne,bI)=>{\"use strict\";bI.exports=[\"constructor\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"toLocaleString\",\"toString\",\"valueOf\"]});var OI=w(SI=>{\"use strict\";var $H=hh(),NH=wp(),kH=NH.concat(\"length\",\"prototype\");SI.f=Object.getOwnPropertyNames||function(e){return $H(e,kH)}});var jI=w(wI=>{\"use strict\";wI.f=Object.getOwnPropertySymbols});var AI=w((bne,PI)=>{\"use strict\";var DH=Aa(),qH=_r(),VH=OI(),LH=jI(),BH=Hs(),UH=qH([].concat);PI.exports=DH(\"Reflect\",\"ownKeys\")||function(e){var r=VH.f(BH(e)),i=LH.f;return i?UH(r,i(e)):r}});var xh=w((Sne,_I)=>{\"use strict\";var RI=Dr(),JH=AI(),HH=bd(),zH=jn();_I.exports=function(t,e,r){for(var i=JH(e),o=zH.f,s=HH.f,n=0;n<i.length;n++){var a=i[n];!RI(t,a)&&!(r&&RI(r,a))&&o(t,a,s(e,a))}}});var CI=w((One,II)=>{\"use strict\";var KH=hh(),WH=wp();II.exports=Object.keys||function(e){return KH(e,WH)}});var MI=w(TI=>{\"use strict\";var GH=vo(),YH=Od(),XH=jn(),QH=Hs(),ZH=Pa(),ez=CI();TI.f=GH&&!YH?Object.defineProperties:function(e,r){QH(e);for(var i=ZH(r),o=ez(r),s=o.length,n=0,a;s>n;)XH.f(e,a=o[n++],i[a]);return e}});var $I=w((jne,FI)=>{\"use strict\";var tz=Aa();FI.exports=tz(\"document\",\"documentElement\")});var Ap=w((Pne,BI)=>{\"use strict\";var rz=Hs(),iz=MI(),NI=wp(),oz=Op(),sz=$I(),nz=vd(),az=bp(),kI=\">\",DI=\"<\",gh=\"prototype\",vh=\"script\",VI=az(\"IE_PROTO\"),yh=function(){},LI=function(t){return DI+vh+kI+t+DI+\"/\"+vh+kI},qI=function(t){t.write(LI(\"\")),t.close();var e=t.parentWindow.Object;return t=null,e},cz=function(){var t=nz(\"iframe\"),e=\"java\"+vh+\":\",r;return t.style.display=\"none\",sz.appendChild(t),t.src=String(e),r=t.contentWindow.document,r.open(),r.write(LI(\"document.F=Object\")),r.close(),r.F},jp,Pp=function(){try{jp=new ActiveXObject(\"htmlfile\")}catch{}Pp=typeof document<\"u\"?document.domain&&jp?qI(jp):cz():qI(jp);for(var t=NI.length;t--;)delete Pp[gh][NI[t]];return Pp()};oz[VI]=!0;BI.exports=Object.create||function(e,r){var i;return e!==null?(yh[gh]=rz(e),i=new yh,yh[gh]=null,i[VI]=e):i=Pp(),r===void 0?i:iz.f(i,r)}});var Eh=w((Ane,UI)=>{\"use strict\";var lz=kr(),uz=Eo();UI.exports=function(t,e){lz(e)&&\"cause\"in e&&uz(t,\"cause\",e.cause)}});var KI=w((Rne,zI)=>{\"use strict\";var pz=_r(),JI=Error,fz=pz(\"\".replace),mz=(function(t){return String(new JI(t).stack)})(\"zxcasd\"),HI=/\\n\\s*at [^:]*:[^\\n]*/,dz=HI.test(mz);zI.exports=function(t,e){if(dz&&typeof t==\"string\"&&!JI.prepareStackTrace)for(;e--;)t=fz(t,HI,\"\");return t}});var GI=w((_ne,WI)=>{\"use strict\";var hz=Rr(),xz=wa();WI.exports=!hz(function(){var t=new Error(\"a\");return\"stack\"in t?(Object.defineProperty(t,\"stack\",xz(1,7)),t.stack!==7):!0})});var bh=w((Ine,XI)=>{\"use strict\";var yz=Eo(),gz=KI(),vz=GI(),YI=Error.captureStackTrace;XI.exports=function(t,e,r,i){vz&&(YI?YI(t,e):yz(t,\"stack\",gz(r,i)))}});var In=w((Cne,QI)=>{\"use strict\";QI.exports=Object.create?Object.create(null):{}});var eC=w((Tne,ZI)=>{\"use strict\";var Ez=qr(),bz=In(),Sz=Ez(\"iterator\"),Oz=Array.prototype;ZI.exports=function(t){return t!==void 0&&(bz.Array===t||Oz[Sz]===t)}});var iC=w((Mne,rC)=>{\"use strict\";var wz=ap(),jz=Dr(),tC=In();rC.exports=function(t){var e=wz(t);return e===\"Arguments\"&&(e=\"Array\"),jz(tC,e)?tC[e]:void 0}});var Sh=w((Fne,sC)=>{\"use strict\";var oC=tp(),Pz=Xu(),Az=iC(),Rz=qr(),_z=Rz(\"iterator\");sC.exports=function(t){if(!Pz(t))return oC(t,_z)||oC(t,\"@@iterator\")||Az(t)}});var aC=w(($ne,nC)=>{\"use strict\";var Iz=Js(),Cz=ir(),Tz=Hs(),Mz=Zu(),Fz=Sh(),$z=TypeError;nC.exports=function(t,e){var r=arguments.length<2?Fz(t):e;if(Cz(r))return Tz(Iz(r,t));throw new $z(Mz(t)+\" is not iterable\")}});var uC=w((Nne,lC)=>{\"use strict\";var Nz=Js(),cC=Hs(),kz=tp();lC.exports=function(t,e,r){var i,o;cC(t);try{if(i=kz(t,\"return\"),!i){if(e===\"throw\")throw r;return r}i=Nz(i,t)}catch(s){o=!0,i=s}if(e===\"throw\")throw r;if(o)throw i;return cC(i),r}});var hC=w((kne,dC)=>{\"use strict\";var Dz=Sd(),qz=Js(),Vz=Hs(),Lz=Zu(),Bz=eC(),Uz=Rd(),pC=Oa(),Jz=aC(),Hz=Sh(),fC=uC(),zz=TypeError,Rp=function(t,e){this.stopped=t,this.result=e},mC=Rp.prototype;dC.exports=function(t,e,r){var i=r&&r.that,o=!!(r&&r.AS_ENTRIES),s=!!(r&&r.IS_RECORD),n=!!(r&&r.IS_ITERATOR),a=!!(r&&r.INTERRUPTED),p=Dz(e,i),l,u,f,m,x,h,O,j=function(y){var g=l;return l=void 0,g&&fC(g,\"normal\"),new Rp(!0,y)},v=function(y){return o?(Vz(y),a?p(y[0],y[1],j):p(y[0],y[1])):a?p(y,j):p(y)};if(s)l=t.iterator;else if(n)l=t;else{if(u=Hz(t),!u)throw new zz(Lz(t)+\" is not iterable\");if(Bz(u)){for(f=0,m=Uz(t);m>f;f++)if(x=v(t[f]),x&&pC(mC,x))return x;return new Rp(!1)}l=Jz(t,u)}for(h=s?t.next:l.next;!(O=qz(h,l)).done;){var E=O.value;try{x=v(E)}catch(y){if(l)fC(l,\"throw\",y);else throw y}if(typeof x==\"object\"&&x&&pC(mC,x))return x}return new Rp(!1)}});var Oh=w((Dne,xC)=>{\"use strict\";var Kz=el();xC.exports=function(t,e){return t===void 0?arguments.length<2?\"\":e:Kz(t)}});var gC=w(()=>{\"use strict\";var Wz=Pn(),Gz=Oa(),Yz=Sp(),_p=cl(),Xz=xh(),yC=Ap(),wh=Eo(),jh=wa(),Qz=Eh(),Zz=bh(),e6=hC(),t6=Oh(),r6=qr(),i6=r6(\"toStringTag\"),Ip=Error,o6=[].push,$a=function(e,r){var i=Gz(Ph,this),o;_p?o=_p(new Ip,i?Yz(this):Ph):(o=i?this:yC(Ph),wh(o,i6,\"Error\")),r!==void 0&&wh(o,\"message\",t6(r)),Zz(o,$a,o.stack,1),arguments.length>2&&Qz(o,arguments[2]);var s=[];return e6(e,o6,{that:s}),wh(o,\"errors\",s),o};_p?_p($a,Ip):Xz($a,Ip,{name:!0});var Ph=$a.prototype=yC(Ip.prototype,{constructor:jh(1,$a),message:jh(1,\"\"),name:jh(1,\"AggregateError\")});Wz({global:!0,constructor:!0,arity:2},{AggregateError:$a})});var Ah=w(()=>{\"use strict\";gC()});var Rh=w(()=>{\"use strict\";Ah()});var EC=w((Hne,vC)=>{\"use strict\";var s6=jn().f;vC.exports=function(t,e,r){r in t||s6(t,r,{configurable:!0,get:function(){return e[r]},set:function(i){e[r]=i}})}});var OC=w((zne,SC)=>{\"use strict\";var n6=ir(),a6=kr(),bC=cl();SC.exports=function(t,e,r){var i,o;return bC&&n6(i=e.constructor)&&i!==r&&a6(o=i.prototype)&&o!==r.prototype&&bC(t,o),t}});var _h=w((Kne,IC)=>{\"use strict\";var wC=Aa(),c6=Dr(),jC=Eo(),l6=Oa(),PC=cl(),AC=xh(),RC=EC(),u6=OC(),p6=Oh(),f6=Eh(),m6=bh(),d6=vo(),_C=Ra();IC.exports=function(t,e,r,i){var o=\"stackTraceLimit\",s=i?2:1,n=t.split(\".\"),a=n[n.length-1],p=wC.apply(null,n);if(p){var l=p.prototype;if(!_C&&c6(l,\"cause\")&&delete l.cause,!r)return p;var u=wC(\"Error\"),f=e(function(m,x){var h=p6(i?x:m,void 0),O=i?new p(m):new p;return h!==void 0&&jC(O,\"message\",h),m6(O,f,O.stack,2),this&&l6(l,this)&&u6(O,this,f),arguments.length>s&&f6(O,arguments[s]),O});if(f.prototype=l,a!==\"Error\"?PC?PC(f,u):AC(f,u,{name:!0}):d6&&o in p&&(RC(f,p,o),RC(f,p,\"prepareStackTrace\")),AC(f,p),!_C)try{l.name!==a&&jC(l,\"name\",a),l.constructor=f}catch{}return f}}});var FC=w(()=>{\"use strict\";var TC=Pn(),h6=rr(),Oo=Gu(),MC=_h(),Ih=\"WebAssembly\",CC=h6[Ih],Cp=new Error(\"e\",{cause:7}).cause!==7,Cn=function(t,e){var r={};r[t]=MC(t,e,Cp),TC({global:!0,constructor:!0,arity:1,forced:Cp},r)},Ch=function(t,e){if(CC&&CC[t]){var r={};r[t]=MC(Ih+\".\"+t,e,Cp),TC({target:Ih,stat:!0,constructor:!0,arity:1,forced:Cp},r)}};Cn(\"Error\",function(t){return function(r){return Oo(t,this,arguments)}});Cn(\"EvalError\",function(t){return function(r){return Oo(t,this,arguments)}});Cn(\"RangeError\",function(t){return function(r){return Oo(t,this,arguments)}});Cn(\"ReferenceError\",function(t){return function(r){return Oo(t,this,arguments)}});Cn(\"SyntaxError\",function(t){return function(r){return Oo(t,this,arguments)}});Cn(\"TypeError\",function(t){return function(r){return Oo(t,this,arguments)}});Cn(\"URIError\",function(t){return function(r){return Oo(t,this,arguments)}});Ch(\"CompileError\",function(t){return function(r){return Oo(t,this,arguments)}});Ch(\"LinkError\",function(t){return function(r){return Oo(t,this,arguments)}});Ch(\"RuntimeError\",function(t){return function(r){return Oo(t,this,arguments)}})});var DC=w(()=>{\"use strict\";var x6=Pn(),y6=Aa(),g6=Gu(),$C=Rr(),v6=_h(),Th=\"AggregateError\",NC=y6(Th),kC=!$C(function(){return NC([1]).errors[0]!==1})&&$C(function(){return NC([1],Th,{cause:7}).cause!==7});x6({global:!0,constructor:!0,arity:2,forced:kC},{AggregateError:v6(Th,function(t){return function(r,i){return g6(t,this,arguments)}},kC,!0)})});var LC=w((Qne,VC)=>{\"use strict\";var E6=rr(),b6=ir(),qC=E6.WeakMap;VC.exports=b6(qC)&&/native code/.test(String(qC))});var Nh=w((Zne,JC)=>{\"use strict\";var S6=LC(),UC=rr(),O6=kr(),w6=Eo(),Mh=Dr(),Fh=rp(),j6=bp(),P6=Op(),BC=\"Object already initialized\",$h=UC.TypeError,A6=UC.WeakMap,Tp,ll,Mp,R6=function(t){return Mp(t)?ll(t):Tp(t,{})},_6=function(t){return function(e){var r;if(!O6(e)||(r=ll(e)).type!==t)throw new $h(\"Incompatible receiver, \"+t+\" required\");return r}};S6||Fh.state?(ei=Fh.state||(Fh.state=new A6),ei.get=ei.get,ei.has=ei.has,ei.set=ei.set,Tp=function(t,e){if(ei.has(t))throw new $h(BC);return e.facade=t,ei.set(t,e),e},ll=function(t){return ei.get(t)||{}},Mp=function(t){return ei.has(t)}):(Tn=j6(\"state\"),P6[Tn]=!0,Tp=function(t,e){if(Mh(t,Tn))throw new $h(BC);return e.facade=t,w6(t,Tn,e),e},ll=function(t){return Mh(t,Tn)?t[Tn]:{}},Mp=function(t){return Mh(t,Tn)});var ei,Tn;JC.exports={set:Tp,get:ll,has:Mp,enforce:R6,getterFor:_6}});var KC=w((eae,zC)=>{\"use strict\";var kh=vo(),I6=Dr(),HC=Function.prototype,C6=kh&&Object.getOwnPropertyDescriptor,Dh=I6(HC,\"name\"),T6=Dh&&function(){}.name===\"something\",M6=Dh&&(!kh||kh&&C6(HC,\"name\").configurable);zC.exports={EXISTS:Dh,PROPER:T6,CONFIGURABLE:M6}});var qh=w((tae,WC)=>{\"use strict\";var F6=Eo();WC.exports=function(t,e,r,i){return i&&i.enumerable?t[e]=r:F6(t,e,r),t}});var Uh=w((rae,XC)=>{\"use strict\";var $6=Rr(),N6=ir(),k6=kr(),D6=Ap(),GC=Sp(),q6=qh(),V6=qr(),L6=Ra(),Bh=V6(\"iterator\"),YC=!1,Do,Vh,Lh;[].keys&&(Lh=[].keys(),\"next\"in Lh?(Vh=GC(GC(Lh)),Vh!==Object.prototype&&(Do=Vh)):YC=!0);var B6=!k6(Do)||$6(function(){var t={};return Do[Bh].call(t)!==t});B6?Do={}:L6&&(Do=D6(Do));N6(Do[Bh])||q6(Do,Bh,function(){return this});XC.exports={IteratorPrototype:Do,BUGGY_SAFARI_ITERATORS:YC}});var ZC=w((iae,QC)=>{\"use strict\";var U6=sp(),J6=ap();QC.exports=U6?{}.toString:function(){return\"[object \"+J6(this)+\"]\"}});var Fp=w((oae,tT)=>{\"use strict\";var H6=sp(),z6=jn().f,K6=Eo(),W6=Dr(),G6=ZC(),Y6=qr(),eT=Y6(\"toStringTag\");tT.exports=function(t,e,r,i){var o=r?t:t&&t.prototype;o&&(W6(o,eT)||z6(o,eT,{configurable:!0,value:e}),i&&!H6&&K6(o,\"toString\",G6))}});var iT=w((sae,rT)=>{\"use strict\";var X6=Uh().IteratorPrototype,Q6=Ap(),Z6=wa(),e5=Fp(),t5=In(),r5=function(){return this};rT.exports=function(t,e,r,i){var o=e+\" Iterator\";return t.prototype=Q6(X6,{next:Z6(+!i,r)}),e5(t,o,!1,!0),t5[o]=r5,t}});var Hh=w((nae,mT)=>{\"use strict\";var i5=Pn(),o5=Js(),$p=Ra(),pT=KC(),s5=ir(),n5=iT(),oT=Sp(),sT=cl(),a5=Fp(),c5=Eo(),Jh=qh(),l5=qr(),nT=In(),fT=Uh(),u5=pT.PROPER,p5=pT.CONFIGURABLE,aT=fT.IteratorPrototype,Np=fT.BUGGY_SAFARI_ITERATORS,ul=l5(\"iterator\"),cT=\"keys\",pl=\"values\",lT=\"entries\",uT=function(){return this};mT.exports=function(t,e,r,i,o,s,n){n5(r,e,i);var a=function(v){if(v===o&&m)return m;if(!Np&&v&&v in u)return u[v];switch(v){case cT:return function(){return new r(this,v)};case pl:return function(){return new r(this,v)};case lT:return function(){return new r(this,v)}}return function(){return new r(this)}},p=e+\" Iterator\",l=!1,u=t.prototype,f=u[ul]||u[\"@@iterator\"]||o&&u[o],m=!Np&&f||a(o),x=e===\"Array\"&&u.entries||f,h,O,j;if(x&&(h=oT(x.call(new t)),h!==Object.prototype&&h.next&&(!$p&&oT(h)!==aT&&(sT?sT(h,aT):s5(h[ul])||Jh(h,ul,uT)),a5(h,p,!0,!0),$p&&(nT[p]=uT))),u5&&o===pl&&f&&f.name!==pl&&(!$p&&p5?c5(u,\"name\",pl):(l=!0,m=function(){return o5(f,this)})),o)if(O={values:a(pl),keys:s?m:a(cT),entries:a(lT)},n)for(j in O)(Np||l||!(j in u))&&Jh(u,j,O[j]);else i5({target:e,proto:!0,forced:Np||l},O);return(!$p||n)&&u[ul]!==m&&Jh(u,ul,m,{name:o}),nT[e]=m,O}});var zh=w((aae,dT)=>{\"use strict\";dT.exports=function(t,e){return{value:t,done:e}}});var Wh=w((cae,vT)=>{\"use strict\";var f5=Pa(),Kh=Id(),hT=In(),yT=Nh(),m5=jn().f,d5=Hh(),kp=zh(),h5=Ra(),x5=vo(),gT=\"Array Iterator\",y5=yT.set,g5=yT.getterFor(gT);vT.exports=d5(Array,\"Array\",function(t,e){y5(this,{type:gT,target:f5(t),index:0,kind:e})},function(){var t=g5(this),e=t.target,r=t.index++;if(!e||r>=e.length)return t.target=null,kp(void 0,!0);switch(t.kind){case\"keys\":return kp(r,!1);case\"values\":return kp(e[r],!1)}return kp([r,e[r]],!1)},\"values\");var xT=hT.Arguments=hT.Array;Kh(\"keys\");Kh(\"values\");Kh(\"entries\");if(!h5&&x5&&xT.name!==\"values\")try{m5(xT,\"name\",{value:\"values\"})}catch{}});var OT=w((lae,ST)=>{\"use strict\";var Gh=_r(),v5=op(),E5=el(),b5=ja(),S5=Gh(\"\".charAt),ET=Gh(\"\".charCodeAt),O5=Gh(\"\".slice),bT=function(t){return function(e,r){var i=E5(b5(e)),o=v5(r),s=i.length,n,a;return o<0||o>=s?t?\"\":void 0:(n=ET(i,o),n<55296||n>56319||o+1===s||(a=ET(i,o+1))<56320||a>57343?t?S5(i,o):n:t?O5(i,o,o+2):(n-55296<<10)+(a-56320)+65536)}};ST.exports={codeAt:bT(!1),charAt:bT(!0)}});var AT=w(()=>{\"use strict\";var w5=OT().charAt,j5=el(),jT=Nh(),P5=Hh(),wT=zh(),PT=\"String Iterator\",A5=jT.set,R5=jT.getterFor(PT);P5(String,\"String\",function(t){A5(this,{type:PT,string:j5(t),index:0})},function(){var e=R5(this),r=e.string,i=e.index,o;return i>=r.length?wT(void 0,!0):(o=w5(r,i),e.index+=o.length,wT(o,!1))})});var _T=w((fae,RT)=>{\"use strict\";FC();Ah();DC();Wh();AT();var _5=Xc();RT.exports=_5.AggregateError});var CT=w((mae,IT)=>{\"use strict\";IT.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var MT=w(()=>{\"use strict\";Wh();var I5=CT(),C5=rr(),T5=Fp(),TT=In();for(Dp in I5)T5(C5[Dp],Dp),TT[Dp]=TT.Array;var Dp});var $T=w((xae,FT)=>{\"use strict\";Rh();var M5=_T();MT();FT.exports=M5});var kT=w((yae,NT)=>{\"use strict\";var F5=$T();NT.exports=F5});var qT=w((gae,DT)=>{\"use strict\";Rh();var $5=kT();DT.exports=$5});var LT=w((vae,VT)=>{\"use strict\";VT.exports=qT()});var UT=w((Eae,BT)=>{BT.exports=LT()});var VM=w((uve,qM)=>{function $W(t){return t===null}qM.exports=$W});var ay=w((pve,LM)=>{var NW=typeof global==\"object\"&&global&&global.Object===Object&&global;LM.exports=NW});var Po=w((fve,BM)=>{var kW=ay(),DW=typeof self==\"object\"&&self&&self.Object===Object&&self,qW=kW||DW||Function(\"return this\")();BM.exports=qW});var Zp=w((mve,UM)=>{var VW=Po(),LW=VW.Symbol;UM.exports=LW});var KM=w((dve,zM)=>{var JM=Zp(),HM=Object.prototype,BW=HM.hasOwnProperty,UW=HM.toString,Tl=JM?JM.toStringTag:void 0;function JW(t){var e=BW.call(t,Tl),r=t[Tl];try{t[Tl]=void 0;var i=!0}catch{}var o=UW.call(t);return i&&(e?t[Tl]=r:delete t[Tl]),o}zM.exports=JW});var GM=w((hve,WM)=>{var HW=Object.prototype,zW=HW.toString;function KW(t){return zW.call(t)}WM.exports=KW});var rn=w((xve,QM)=>{var YM=Zp(),WW=KM(),GW=GM(),YW=\"[object Null]\",XW=\"[object Undefined]\",XM=YM?YM.toStringTag:void 0;function QW(t){return t==null?t===void 0?XW:YW:XM&&XM in Object(t)?WW(t):GW(t)}QM.exports=QW});var Ml=w((yve,ZM)=>{var ZW=Array.isArray;ZM.exports=ZW});var on=w((gve,e1)=>{function e7(t){return t!=null&&typeof t==\"object\"}e1.exports=e7});var r1=w((vve,t1)=>{var t7=rn(),r7=Ml(),i7=on(),o7=\"[object String]\";function s7(t){return typeof t==\"string\"||!r7(t)&&i7(t)&&t7(t)==o7}t1.exports=s7});var o1=w((Eve,i1)=>{var n7=rn(),a7=on(),c7=\"[object Number]\";function l7(t){return typeof t==\"number\"||a7(t)&&n7(t)==c7}i1.exports=l7});var n1=w((bve,s1)=>{var u7=rn(),p7=on(),f7=\"[object Boolean]\";function m7(t){return t===!0||t===!1||p7(t)&&u7(t)==f7}s1.exports=m7});var Fl=w((Sve,a1)=>{function d7(t){var e=typeof t;return t!=null&&(e==\"object\"||e==\"function\")}a1.exports=d7});var ef=w((Ove,c1)=>{var cy=class{constructor(e){this.namespace=e||new this.Namespace}serialise(e){if(!(e instanceof this.namespace.elements.Element))throw new TypeError(`Given element \\`${e}\\` is not an Element instance`);let r={element:e.element};e._meta&&e._meta.length>0&&(r.meta=this.serialiseObject(e.meta)),e._attributes&&e._attributes.length>0&&(r.attributes=this.serialiseObject(e.attributes));let i=this.serialiseContent(e.content);return i!==void 0&&(r.content=i),r}deserialise(e){if(!e.element)throw new Error(\"Given value is not an object containing an element name\");let r=this.namespace.getElementClass(e.element),i=new r;i.element!==e.element&&(i.element=e.element),e.meta&&this.deserialiseObject(e.meta,i.meta),e.attributes&&this.deserialiseObject(e.attributes,i.attributes);let o=this.deserialiseContent(e.content);return(o!==void 0||i.content===null)&&(i.content=o),i}serialiseContent(e){if(e instanceof this.namespace.elements.Element)return this.serialise(e);if(e instanceof this.namespace.KeyValuePair){let r={key:this.serialise(e.key)};return e.value&&(r.value=this.serialise(e.value)),r}return e&&e.map?e.length===0?void 0:e.map(this.serialise,this):e}deserialiseContent(e){if(e){if(e.element)return this.deserialise(e);if(e.key){let r=new this.namespace.KeyValuePair(this.deserialise(e.key));return e.value&&(r.value=this.deserialise(e.value)),r}if(e.map)return e.map(this.deserialise,this)}return e}serialiseObject(e){let r={};if(e.forEach((i,o)=>{i&&(r[o.toValue()]=this.serialise(i))}),Object.keys(r).length!==0)return r}deserialiseObject(e,r){Object.keys(e).forEach(i=>{r.set(i,this.deserialise(e[i]))})}};c1.exports=cy});var u1=w((wve,l1)=>{function h7(){this.__data__=[],this.size=0}l1.exports=h7});var ly=w((jve,p1)=>{function x7(t,e){return t===e||t!==t&&e!==e}p1.exports=x7});var $l=w((Pve,f1)=>{var y7=ly();function g7(t,e){for(var r=t.length;r--;)if(y7(t[r][0],e))return r;return-1}f1.exports=g7});var d1=w((Ave,m1)=>{var v7=$l(),E7=Array.prototype,b7=E7.splice;function S7(t){var e=this.__data__,r=v7(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():b7.call(e,r,1),--this.size,!0}m1.exports=S7});var x1=w((Rve,h1)=>{var O7=$l();function w7(t){var e=this.__data__,r=O7(e,t);return r<0?void 0:e[r][1]}h1.exports=w7});var g1=w((_ve,y1)=>{var j7=$l();function P7(t){return j7(this.__data__,t)>-1}y1.exports=P7});var E1=w((Ive,v1)=>{var A7=$l();function R7(t,e){var r=this.__data__,i=A7(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}v1.exports=R7});var Nl=w((Cve,b1)=>{var _7=u1(),I7=d1(),C7=x1(),T7=g1(),M7=E1();function Ua(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}Ua.prototype.clear=_7;Ua.prototype.delete=I7;Ua.prototype.get=C7;Ua.prototype.has=T7;Ua.prototype.set=M7;b1.exports=Ua});var O1=w((Tve,S1)=>{var F7=Nl();function $7(){this.__data__=new F7,this.size=0}S1.exports=$7});var j1=w((Mve,w1)=>{function N7(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}w1.exports=N7});var A1=w((Fve,P1)=>{function k7(t){return this.__data__.get(t)}P1.exports=k7});var _1=w(($ve,R1)=>{function D7(t){return this.__data__.has(t)}R1.exports=D7});var uy=w((Nve,I1)=>{var q7=rn(),V7=Fl(),L7=\"[object AsyncFunction]\",B7=\"[object Function]\",U7=\"[object GeneratorFunction]\",J7=\"[object Proxy]\";function H7(t){if(!V7(t))return!1;var e=q7(t);return e==B7||e==U7||e==L7||e==J7}I1.exports=H7});var T1=w((kve,C1)=>{var z7=Po(),K7=z7[\"__core-js_shared__\"];C1.exports=K7});var $1=w((Dve,F1)=>{var py=T1(),M1=(function(){var t=/[^.]+$/.exec(py&&py.keys&&py.keys.IE_PROTO||\"\");return t?\"Symbol(src)_1.\"+t:\"\"})();function W7(t){return!!M1&&M1 in t}F1.exports=W7});var fy=w((qve,N1)=>{var G7=Function.prototype,Y7=G7.toString;function X7(t){if(t!=null){try{return Y7.call(t)}catch{}try{return t+\"\"}catch{}}return\"\"}N1.exports=X7});var D1=w((Vve,k1)=>{var Q7=uy(),Z7=$1(),eG=Fl(),tG=fy(),rG=/[\\\\^$.*+?()[\\]{}|]/g,iG=/^\\[object .+?Constructor\\]$/,oG=Function.prototype,sG=Object.prototype,nG=oG.toString,aG=sG.hasOwnProperty,cG=RegExp(\"^\"+nG.call(aG).replace(rG,\"\\\\$&\").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,\"$1.*?\")+\"$\");function lG(t){if(!eG(t)||Z7(t))return!1;var e=Q7(t)?cG:iG;return e.test(tG(t))}k1.exports=lG});var V1=w((Lve,q1)=>{function uG(t,e){return t?.[e]}q1.exports=uG});var Gn=w((Bve,L1)=>{var pG=D1(),fG=V1();function mG(t,e){var r=fG(t,e);return pG(r)?r:void 0}L1.exports=mG});var tf=w((Uve,B1)=>{var dG=Gn(),hG=Po(),xG=dG(hG,\"Map\");B1.exports=xG});var kl=w((Jve,U1)=>{var yG=Gn(),gG=yG(Object,\"create\");U1.exports=gG});var z1=w((Hve,H1)=>{var J1=kl();function vG(){this.__data__=J1?J1(null):{},this.size=0}H1.exports=vG});var W1=w((zve,K1)=>{function EG(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}K1.exports=EG});var Y1=w((Kve,G1)=>{var bG=kl(),SG=\"__lodash_hash_undefined__\",OG=Object.prototype,wG=OG.hasOwnProperty;function jG(t){var e=this.__data__;if(bG){var r=e[t];return r===SG?void 0:r}return wG.call(e,t)?e[t]:void 0}G1.exports=jG});var Q1=w((Wve,X1)=>{var PG=kl(),AG=Object.prototype,RG=AG.hasOwnProperty;function _G(t){var e=this.__data__;return PG?e[t]!==void 0:RG.call(e,t)}X1.exports=_G});var eF=w((Gve,Z1)=>{var IG=kl(),CG=\"__lodash_hash_undefined__\";function TG(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=IG&&e===void 0?CG:e,this}Z1.exports=TG});var rF=w((Yve,tF)=>{var MG=z1(),FG=W1(),$G=Y1(),NG=Q1(),kG=eF();function Ja(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}Ja.prototype.clear=MG;Ja.prototype.delete=FG;Ja.prototype.get=$G;Ja.prototype.has=NG;Ja.prototype.set=kG;tF.exports=Ja});var sF=w((Xve,oF)=>{var iF=rF(),DG=Nl(),qG=tf();function VG(){this.size=0,this.__data__={hash:new iF,map:new(qG||DG),string:new iF}}oF.exports=VG});var aF=w((Qve,nF)=>{function LG(t){var e=typeof t;return e==\"string\"||e==\"number\"||e==\"symbol\"||e==\"boolean\"?t!==\"__proto__\":t===null}nF.exports=LG});var Dl=w((Zve,cF)=>{var BG=aF();function UG(t,e){var r=t.__data__;return BG(e)?r[typeof e==\"string\"?\"string\":\"hash\"]:r.map}cF.exports=UG});var uF=w((eEe,lF)=>{var JG=Dl();function HG(t){var e=JG(this,t).delete(t);return this.size-=e?1:0,e}lF.exports=HG});var fF=w((tEe,pF)=>{var zG=Dl();function KG(t){return zG(this,t).get(t)}pF.exports=KG});var dF=w((rEe,mF)=>{var WG=Dl();function GG(t){return WG(this,t).has(t)}mF.exports=GG});var xF=w((iEe,hF)=>{var YG=Dl();function XG(t,e){var r=YG(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}hF.exports=XG});var my=w((oEe,yF)=>{var QG=sF(),ZG=uF(),e8=fF(),t8=dF(),r8=xF();function Ha(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}Ha.prototype.clear=QG;Ha.prototype.delete=ZG;Ha.prototype.get=e8;Ha.prototype.has=t8;Ha.prototype.set=r8;yF.exports=Ha});var vF=w((sEe,gF)=>{var i8=Nl(),o8=tf(),s8=my(),n8=200;function a8(t,e){var r=this.__data__;if(r instanceof i8){var i=r.__data__;if(!o8||i.length<n8-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new s8(i)}return r.set(t,e),this.size=r.size,this}gF.exports=a8});var bF=w((nEe,EF)=>{var c8=Nl(),l8=O1(),u8=j1(),p8=A1(),f8=_1(),m8=vF();function za(t){var e=this.__data__=new c8(t);this.size=e.size}za.prototype.clear=l8;za.prototype.delete=u8;za.prototype.get=p8;za.prototype.has=f8;za.prototype.set=m8;EF.exports=za});var OF=w((aEe,SF)=>{var d8=\"__lodash_hash_undefined__\";function h8(t){return this.__data__.set(t,d8),this}SF.exports=h8});var jF=w((cEe,wF)=>{function x8(t){return this.__data__.has(t)}wF.exports=x8});var AF=w((lEe,PF)=>{var y8=my(),g8=OF(),v8=jF();function rf(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new y8;++e<r;)this.add(t[e])}rf.prototype.add=rf.prototype.push=g8;rf.prototype.has=v8;PF.exports=rf});var _F=w((uEe,RF)=>{function E8(t,e){for(var r=-1,i=t==null?0:t.length;++r<i;)if(e(t[r],r,t))return!0;return!1}RF.exports=E8});var CF=w((pEe,IF)=>{function b8(t,e){return t.has(e)}IF.exports=b8});var dy=w((fEe,TF)=>{var S8=AF(),O8=_F(),w8=CF(),j8=1,P8=2;function A8(t,e,r,i,o,s){var n=r&j8,a=t.length,p=e.length;if(a!=p&&!(n&&p>a))return!1;var l=s.get(t),u=s.get(e);if(l&&u)return l==e&&u==t;var f=-1,m=!0,x=r&P8?new S8:void 0;for(s.set(t,e),s.set(e,t);++f<a;){var h=t[f],O=e[f];if(i)var j=n?i(O,h,f,e,t,s):i(h,O,f,t,e,s);if(j!==void 0){if(j)continue;m=!1;break}if(x){if(!O8(e,function(v,E){if(!w8(x,E)&&(h===v||o(h,v,r,i,s)))return x.push(E)})){m=!1;break}}else if(!(h===O||o(h,O,r,i,s))){m=!1;break}}return s.delete(t),s.delete(e),m}TF.exports=A8});var FF=w((mEe,MF)=>{var R8=Po(),_8=R8.Uint8Array;MF.exports=_8});var NF=w((dEe,$F)=>{function I8(t){var e=-1,r=Array(t.size);return t.forEach(function(i,o){r[++e]=[o,i]}),r}$F.exports=I8});var DF=w((hEe,kF)=>{function C8(t){var e=-1,r=Array(t.size);return t.forEach(function(i){r[++e]=i}),r}kF.exports=C8});var UF=w((xEe,BF)=>{var qF=Zp(),VF=FF(),T8=ly(),M8=dy(),F8=NF(),$8=DF(),N8=1,k8=2,D8=\"[object Boolean]\",q8=\"[object Date]\",V8=\"[object Error]\",L8=\"[object Map]\",B8=\"[object Number]\",U8=\"[object RegExp]\",J8=\"[object Set]\",H8=\"[object String]\",z8=\"[object Symbol]\",K8=\"[object ArrayBuffer]\",W8=\"[object DataView]\",LF=qF?qF.prototype:void 0,hy=LF?LF.valueOf:void 0;function G8(t,e,r,i,o,s,n){switch(r){case W8:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case K8:return!(t.byteLength!=e.byteLength||!s(new VF(t),new VF(e)));case D8:case q8:case B8:return T8(+t,+e);case V8:return t.name==e.name&&t.message==e.message;case U8:case H8:return t==e+\"\";case L8:var a=F8;case J8:var p=i&N8;if(a||(a=$8),t.size!=e.size&&!p)return!1;var l=n.get(t);if(l)return l==e;i|=k8,n.set(t,e);var u=M8(a(t),a(e),i,o,s,n);return n.delete(t),u;case z8:if(hy)return hy.call(t)==hy.call(e)}return!1}BF.exports=G8});var HF=w((yEe,JF)=>{function Y8(t,e){for(var r=-1,i=e.length,o=t.length;++r<i;)t[o+r]=e[r];return t}JF.exports=Y8});var KF=w((gEe,zF)=>{var X8=HF(),Q8=Ml();function Z8(t,e,r){var i=e(t);return Q8(t)?i:X8(i,r(t))}zF.exports=Z8});var GF=w((vEe,WF)=>{function eY(t,e){for(var r=-1,i=t==null?0:t.length,o=0,s=[];++r<i;){var n=t[r];e(n,r,t)&&(s[o++]=n)}return s}WF.exports=eY});var XF=w((EEe,YF)=>{function tY(){return[]}YF.exports=tY});var e$=w((bEe,ZF)=>{var rY=GF(),iY=XF(),oY=Object.prototype,sY=oY.propertyIsEnumerable,QF=Object.getOwnPropertySymbols,nY=QF?function(t){return t==null?[]:(t=Object(t),rY(QF(t),function(e){return sY.call(t,e)}))}:iY;ZF.exports=nY});var r$=w((SEe,t$)=>{function aY(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}t$.exports=aY});var o$=w((OEe,i$)=>{var cY=rn(),lY=on(),uY=\"[object Arguments]\";function pY(t){return lY(t)&&cY(t)==uY}i$.exports=pY});var c$=w((wEe,a$)=>{var s$=o$(),fY=on(),n$=Object.prototype,mY=n$.hasOwnProperty,dY=n$.propertyIsEnumerable,hY=s$((function(){return arguments})())?s$:function(t){return fY(t)&&mY.call(t,\"callee\")&&!dY.call(t,\"callee\")};a$.exports=hY});var u$=w((jEe,l$)=>{function xY(){return!1}l$.exports=xY});var xy=w((ql,Ka)=>{var yY=Po(),gY=u$(),m$=typeof ql==\"object\"&&ql&&!ql.nodeType&&ql,p$=m$&&typeof Ka==\"object\"&&Ka&&!Ka.nodeType&&Ka,vY=p$&&p$.exports===m$,f$=vY?yY.Buffer:void 0,EY=f$?f$.isBuffer:void 0,bY=EY||gY;Ka.exports=bY});var h$=w((PEe,d$)=>{var SY=9007199254740991,OY=/^(?:0|[1-9]\\d*)$/;function wY(t,e){var r=typeof t;return e=e??SY,!!e&&(r==\"number\"||r!=\"symbol\"&&OY.test(t))&&t>-1&&t%1==0&&t<e}d$.exports=wY});var yy=w((AEe,x$)=>{var jY=9007199254740991;function PY(t){return typeof t==\"number\"&&t>-1&&t%1==0&&t<=jY}x$.exports=PY});var g$=w((REe,y$)=>{var AY=rn(),RY=yy(),_Y=on(),IY=\"[object Arguments]\",CY=\"[object Array]\",TY=\"[object Boolean]\",MY=\"[object Date]\",FY=\"[object Error]\",$Y=\"[object Function]\",NY=\"[object Map]\",kY=\"[object Number]\",DY=\"[object Object]\",qY=\"[object RegExp]\",VY=\"[object Set]\",LY=\"[object String]\",BY=\"[object WeakMap]\",UY=\"[object ArrayBuffer]\",JY=\"[object DataView]\",HY=\"[object Float32Array]\",zY=\"[object Float64Array]\",KY=\"[object Int8Array]\",WY=\"[object Int16Array]\",GY=\"[object Int32Array]\",YY=\"[object Uint8Array]\",XY=\"[object Uint8ClampedArray]\",QY=\"[object Uint16Array]\",ZY=\"[object Uint32Array]\",Ge={};Ge[HY]=Ge[zY]=Ge[KY]=Ge[WY]=Ge[GY]=Ge[YY]=Ge[XY]=Ge[QY]=Ge[ZY]=!0;Ge[IY]=Ge[CY]=Ge[UY]=Ge[TY]=Ge[JY]=Ge[MY]=Ge[FY]=Ge[$Y]=Ge[NY]=Ge[kY]=Ge[DY]=Ge[qY]=Ge[VY]=Ge[LY]=Ge[BY]=!1;function eX(t){return _Y(t)&&RY(t.length)&&!!Ge[AY(t)]}y$.exports=eX});var E$=w((_Ee,v$)=>{function tX(t){return function(e){return t(e)}}v$.exports=tX});var S$=w((Vl,Wa)=>{var rX=ay(),b$=typeof Vl==\"object\"&&Vl&&!Vl.nodeType&&Vl,Ll=b$&&typeof Wa==\"object\"&&Wa&&!Wa.nodeType&&Wa,iX=Ll&&Ll.exports===b$,gy=iX&&rX.process,oX=(function(){try{var t=Ll&&Ll.require&&Ll.require(\"util\").types;return t||gy&&gy.binding&&gy.binding(\"util\")}catch{}})();Wa.exports=oX});var vy=w((IEe,j$)=>{var sX=g$(),nX=E$(),O$=S$(),w$=O$&&O$.isTypedArray,aX=w$?nX(w$):sX;j$.exports=aX});var A$=w((CEe,P$)=>{var cX=r$(),lX=c$(),uX=Ml(),pX=xy(),fX=h$(),mX=vy(),dX=Object.prototype,hX=dX.hasOwnProperty;function xX(t,e){var r=uX(t),i=!r&&lX(t),o=!r&&!i&&pX(t),s=!r&&!i&&!o&&mX(t),n=r||i||o||s,a=n?cX(t.length,String):[],p=a.length;for(var l in t)(e||hX.call(t,l))&&!(n&&(l==\"length\"||o&&(l==\"offset\"||l==\"parent\")||s&&(l==\"buffer\"||l==\"byteLength\"||l==\"byteOffset\")||fX(l,p)))&&a.push(l);return a}P$.exports=xX});var _$=w((TEe,R$)=>{var yX=Object.prototype;function gX(t){var e=t&&t.constructor,r=typeof e==\"function\"&&e.prototype||yX;return t===r}R$.exports=gX});var C$=w((MEe,I$)=>{function vX(t,e){return function(r){return t(e(r))}}I$.exports=vX});var M$=w((FEe,T$)=>{var EX=C$(),bX=EX(Object.keys,Object);T$.exports=bX});var $$=w(($Ee,F$)=>{var SX=_$(),OX=M$(),wX=Object.prototype,jX=wX.hasOwnProperty;function PX(t){if(!SX(t))return OX(t);var e=[];for(var r in Object(t))jX.call(t,r)&&r!=\"constructor\"&&e.push(r);return e}F$.exports=PX});var k$=w((NEe,N$)=>{var AX=uy(),RX=yy();function _X(t){return t!=null&&RX(t.length)&&!AX(t)}N$.exports=_X});var q$=w((kEe,D$)=>{var IX=A$(),CX=$$(),TX=k$();function MX(t){return TX(t)?IX(t):CX(t)}D$.exports=MX});var L$=w((DEe,V$)=>{var FX=KF(),$X=e$(),NX=q$();function kX(t){return FX(t,NX,$X)}V$.exports=kX});var J$=w((qEe,U$)=>{var B$=L$(),DX=1,qX=Object.prototype,VX=qX.hasOwnProperty;function LX(t,e,r,i,o,s){var n=r&DX,a=B$(t),p=a.length,l=B$(e),u=l.length;if(p!=u&&!n)return!1;for(var f=p;f--;){var m=a[f];if(!(n?m in e:VX.call(e,m)))return!1}var x=s.get(t),h=s.get(e);if(x&&h)return x==e&&h==t;var O=!0;s.set(t,e),s.set(e,t);for(var j=n;++f<p;){m=a[f];var v=t[m],E=e[m];if(i)var y=n?i(E,v,m,e,t,s):i(v,E,m,t,e,s);if(!(y===void 0?v===E||o(v,E,r,i,s):y)){O=!1;break}j||(j=m==\"constructor\")}if(O&&!j){var g=t.constructor,q=e.constructor;g!=q&&\"constructor\"in t&&\"constructor\"in e&&!(typeof g==\"function\"&&g instanceof g&&typeof q==\"function\"&&q instanceof q)&&(O=!1)}return s.delete(t),s.delete(e),O}U$.exports=LX});var z$=w((VEe,H$)=>{var BX=Gn(),UX=Po(),JX=BX(UX,\"DataView\");H$.exports=JX});var W$=w((LEe,K$)=>{var HX=Gn(),zX=Po(),KX=HX(zX,\"Promise\");K$.exports=KX});var Y$=w((BEe,G$)=>{var WX=Gn(),GX=Po(),YX=WX(GX,\"Set\");G$.exports=YX});var Q$=w((UEe,X$)=>{var XX=Gn(),QX=Po(),ZX=XX(QX,\"WeakMap\");X$.exports=ZX});var nN=w((JEe,sN)=>{var Ey=z$(),by=tf(),Sy=W$(),Oy=Y$(),wy=Q$(),oN=rn(),Ga=fy(),Z$=\"[object Map]\",eQ=\"[object Object]\",eN=\"[object Promise]\",tN=\"[object Set]\",rN=\"[object WeakMap]\",iN=\"[object DataView]\",tQ=Ga(Ey),rQ=Ga(by),iQ=Ga(Sy),oQ=Ga(Oy),sQ=Ga(wy),Yn=oN;(Ey&&Yn(new Ey(new ArrayBuffer(1)))!=iN||by&&Yn(new by)!=Z$||Sy&&Yn(Sy.resolve())!=eN||Oy&&Yn(new Oy)!=tN||wy&&Yn(new wy)!=rN)&&(Yn=function(t){var e=oN(t),r=e==eQ?t.constructor:void 0,i=r?Ga(r):\"\";if(i)switch(i){case tQ:return iN;case rQ:return Z$;case iQ:return eN;case oQ:return tN;case sQ:return rN}return e});sN.exports=Yn});var dN=w((HEe,mN)=>{var jy=bF(),nQ=dy(),aQ=UF(),cQ=J$(),aN=nN(),cN=Ml(),lN=xy(),lQ=vy(),uQ=1,uN=\"[object Arguments]\",pN=\"[object Array]\",of=\"[object Object]\",pQ=Object.prototype,fN=pQ.hasOwnProperty;function fQ(t,e,r,i,o,s){var n=cN(t),a=cN(e),p=n?pN:aN(t),l=a?pN:aN(e);p=p==uN?of:p,l=l==uN?of:l;var u=p==of,f=l==of,m=p==l;if(m&&lN(t)){if(!lN(e))return!1;n=!0,u=!1}if(m&&!u)return s||(s=new jy),n||lQ(t)?nQ(t,e,r,i,o,s):aQ(t,e,p,r,i,o,s);if(!(r&uQ)){var x=u&&fN.call(t,\"__wrapped__\"),h=f&&fN.call(e,\"__wrapped__\");if(x||h){var O=x?t.value():t,j=h?e.value():e;return s||(s=new jy),o(O,j,r,i,s)}}return m?(s||(s=new jy),cQ(t,e,r,i,o,s)):!1}mN.exports=fQ});var gN=w((zEe,yN)=>{var mQ=dN(),hN=on();function xN(t,e,r,i,o){return t===e?!0:t==null||e==null||!hN(t)&&!hN(e)?t!==t&&e!==e:mQ(t,e,r,i,xN,o)}yN.exports=xN});var EN=w((KEe,vN)=>{var dQ=gN();function hQ(t,e){return dQ(t,e)}vN.exports=hQ});var Bl=w((WEe,bN)=>{var Py=class t{constructor(e,r){this.key=e,this.value=r}clone(){let e=new t;return this.key&&(e.key=this.key.clone()),this.value&&(e.value=this.value.clone()),e}};bN.exports=Py});var Ul=w((GEe,SN)=>{var xQ=\"Expected a function\";function yQ(t){if(typeof t!=\"function\")throw new TypeError(xQ);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}SN.exports=yQ});var Jl=w((YEe,ON)=>{var gQ=Ul();function Ay(t){return typeof t==\"string\"?e=>e.element===t:t.constructor&&t.extend?e=>e instanceof t:t}var sf=class t{constructor(e){this.elements=e||[]}toValue(){return this.elements.map(e=>e.toValue())}map(e,r){return this.elements.map(e,r)}flatMap(e,r){return this.map(e,r).reduce((i,o)=>i.concat(o),[])}compactMap(e,r){let i=[];return this.forEach(o=>{let s=e.bind(r)(o);s&&i.push(s)}),i}filter(e,r){return e=Ay(e),new t(this.elements.filter(e,r))}reject(e,r){return e=Ay(e),new t(this.elements.filter(gQ(e),r))}find(e,r){return e=Ay(e),this.elements.find(e,r)}forEach(e,r){this.elements.forEach(e,r)}reduce(e,r){return this.elements.reduce(e,r)}includes(e){return this.elements.some(r=>r.equals(e))}shift(){return this.elements.shift()}unshift(e){this.elements.unshift(this.refract(e))}push(e){return this.elements.push(this.refract(e)),this}add(e){this.push(e)}get(e){return this.elements[e]}getValue(e){let r=this.elements[e];if(r)return r.toValue()}get length(){return this.elements.length}get isEmpty(){return this.elements.length===0}get first(){return this.elements[0]}};typeof Symbol<\"u\"&&(sf.prototype[Symbol.iterator]=function(){return this.elements[Symbol.iterator]()});ON.exports=sf});var Ao=w((XEe,wN)=>{var vQ=EN(),nf=Bl(),sn=Jl(),Ry=class t{constructor(e,r,i){r&&(this.meta=r),i&&(this.attributes=i),this.content=e}freeze(){Object.isFrozen(this)||(this._meta&&(this.meta.parent=this,this.meta.freeze()),this._attributes&&(this.attributes.parent=this,this.attributes.freeze()),this.children.forEach(e=>{e.parent=this,e.freeze()},this),this.content&&Array.isArray(this.content)&&Object.freeze(this.content),Object.freeze(this))}primitive(){}clone(){let e=new this.constructor;return e.element=this.element,this.meta.length&&(e._meta=this.meta.clone()),this.attributes.length&&(e._attributes=this.attributes.clone()),this.content?this.content.clone?e.content=this.content.clone():Array.isArray(this.content)?e.content=this.content.map(r=>r.clone()):e.content=this.content:e.content=this.content,e}toValue(){return this.content instanceof t?this.content.toValue():this.content instanceof nf?{key:this.content.key.toValue(),value:this.content.value?this.content.value.toValue():void 0}:this.content&&this.content.map?this.content.map(e=>e.toValue(),this):this.content}toRef(e){if(this.id.toValue()===\"\")throw Error(\"Cannot create reference to an element that does not contain an ID\");let r=new this.RefElement(this.id.toValue());return e&&(r.path=e),r}findRecursive(...e){if(arguments.length>1&&!this.isFrozen)throw new Error(\"Cannot find recursive with multiple element names without first freezing the element. Call `element.freeze()`\");let r=e.pop(),i=new sn,o=(n,a)=>(n.push(a),n),s=(n,a)=>{a.element===r&&n.push(a);let p=a.findRecursive(r);return p&&p.reduce(o,n),a.content instanceof nf&&(a.content.key&&s(n,a.content.key),a.content.value&&s(n,a.content.value)),n};return this.content&&(this.content.element&&s(i,this.content),Array.isArray(this.content)&&this.content.reduce(s,i)),e.isEmpty||(i=i.filter(n=>{let a=n.parents.map(p=>p.element);for(let p in e){let l=e[p],u=a.indexOf(l);if(u!==-1)a=a.splice(0,u);else return!1}return!0})),i}set(e){return this.content=e,this}equals(e){return vQ(this.toValue(),e)}getMetaProperty(e,r){if(!this.meta.hasKey(e)){if(this.isFrozen){let i=this.refract(r);return i.freeze(),i}this.meta.set(e,r)}return this.meta.get(e)}setMetaProperty(e,r){this.meta.set(e,r)}get element(){return this._storedElement||\"element\"}set element(e){this._storedElement=e}get content(){return this._content}set content(e){if(e instanceof t)this._content=e;else if(e instanceof sn)this.content=e.elements;else if(typeof e==\"string\"||typeof e==\"number\"||typeof e==\"boolean\"||e===\"null\"||e==null)this._content=e;else if(e instanceof nf)this._content=e;else if(Array.isArray(e))this._content=e.map(this.refract);else if(typeof e==\"object\")this._content=Object.keys(e).map(r=>new this.MemberElement(r,e[r]));else throw new Error(\"Cannot set content to given value\")}get meta(){if(!this._meta){if(this.isFrozen){let e=new this.ObjectElement;return e.freeze(),e}this._meta=new this.ObjectElement}return this._meta}set meta(e){e instanceof this.ObjectElement?this._meta=e:this.meta.set(e||{})}get attributes(){if(!this._attributes){if(this.isFrozen){let e=new this.ObjectElement;return e.freeze(),e}this._attributes=new this.ObjectElement}return this._attributes}set attributes(e){e instanceof this.ObjectElement?this._attributes=e:this.attributes.set(e||{})}get id(){return this.getMetaProperty(\"id\",\"\")}set id(e){this.setMetaProperty(\"id\",e)}get classes(){return this.getMetaProperty(\"classes\",[])}set classes(e){this.setMetaProperty(\"classes\",e)}get title(){return this.getMetaProperty(\"title\",\"\")}set title(e){this.setMetaProperty(\"title\",e)}get description(){return this.getMetaProperty(\"description\",\"\")}set description(e){this.setMetaProperty(\"description\",e)}get links(){return this.getMetaProperty(\"links\",[])}set links(e){this.setMetaProperty(\"links\",e)}get isFrozen(){return Object.isFrozen(this)}get parents(){let{parent:e}=this,r=new sn;for(;e;)r.push(e),e=e.parent;return r}get children(){if(Array.isArray(this.content))return new sn(this.content);if(this.content instanceof nf){let e=new sn([this.content.key]);return this.content.value&&e.push(this.content.value),e}return this.content instanceof t?new sn([this.content]):new sn}get recursiveChildren(){let e=new sn;return this.children.forEach(r=>{e.push(r),r.recursiveChildren.forEach(i=>{e.push(i)})}),e}};wN.exports=Ry});var PN=w((QEe,jN)=>{var EQ=Ao(),_y=class extends EQ{constructor(e,r,i){super(e||null,r,i),this.element=\"null\"}primitive(){return\"null\"}set(){return new Error(\"Cannot set the value of null\")}};jN.exports=_y});var RN=w((ebe,AN)=>{var bQ=Ao();AN.exports=class extends bQ{constructor(e,r,i){super(e,r,i),this.element=\"string\"}primitive(){return\"string\"}get length(){return this.content.length}}});var IN=w((rbe,_N)=>{var SQ=Ao();_N.exports=class extends SQ{constructor(e,r,i){super(e,r,i),this.element=\"number\"}primitive(){return\"number\"}}});var TN=w((obe,CN)=>{var OQ=Ao();CN.exports=class extends OQ{constructor(e,r,i){super(e,r,i),this.element=\"boolean\"}primitive(){return\"boolean\"}}});var Iy=w((sbe,FN)=>{var wQ=Ul(),jQ=Ao(),MN=Jl(),Xn=class extends jQ{constructor(e,r,i){super(e||[],r,i),this.element=\"array\"}primitive(){return\"array\"}get(e){return this.content[e]}getValue(e){let r=this.get(e);if(r)return r.toValue()}getIndex(e){return this.content[e]}set(e,r){return this.content[e]=this.refract(r),this}remove(e){let r=this.content.splice(e,1);return r.length?r[0]:null}map(e,r){return this.content.map(e,r)}flatMap(e,r){return this.map(e,r).reduce((i,o)=>i.concat(o),[])}compactMap(e,r){let i=[];return this.forEach(o=>{let s=e.bind(r)(o);s&&i.push(s)}),i}filter(e,r){return new MN(this.content.filter(e,r))}reject(e,r){return this.filter(wQ(e),r)}reduce(e,r){let i,o;r!==void 0?(i=0,o=this.refract(r)):(i=1,o=this.primitive()===\"object\"?this.first.value:this.first);for(let s=i;s<this.length;s+=1){let n=this.content[s];this.primitive()===\"object\"?o=this.refract(e(o,n.value,n.key,n,this)):o=this.refract(e(o,n,s,this))}return o}forEach(e,r){this.content.forEach((i,o)=>{e.bind(r)(i,this.refract(o))})}shift(){return this.content.shift()}unshift(e){this.content.unshift(this.refract(e))}push(e){return this.content.push(this.refract(e)),this}add(e){this.push(e)}findElements(e,r){let i=r||{},o=!!i.recursive,s=i.results===void 0?[]:i.results;return this.forEach((n,a,p)=>{o&&n.findElements!==void 0&&n.findElements(e,{results:s,recursive:o}),e(n,a,p)&&s.push(n)}),s}find(e){return new MN(this.findElements(e,{recursive:!0}))}findByElement(e){return this.find(r=>r.element===e)}findByClass(e){return this.find(r=>r.classes.includes(e))}getById(e){return this.find(r=>r.id.toValue()===e).first}includes(e){return this.content.some(r=>r.equals(e))}contains(e){return this.includes(e)}empty(){return new this.constructor([])}\"fantasy-land/empty\"(){return this.empty()}concat(e){return new this.constructor(this.content.concat(e.content))}\"fantasy-land/concat\"(e){return this.concat(e)}\"fantasy-land/map\"(e){return new this.constructor(this.map(e))}\"fantasy-land/chain\"(e){return this.map(r=>e(r),this).reduce((r,i)=>r.concat(i),this.empty())}\"fantasy-land/filter\"(e){return new this.constructor(this.content.filter(e))}\"fantasy-land/reduce\"(e,r){return this.content.reduce(e,r)}get length(){return this.content.length}get isEmpty(){return this.content.length===0}get first(){return this.getIndex(0)}get second(){return this.getIndex(1)}get last(){return this.getIndex(this.length-1)}};Xn.empty=function(){return new this};Xn[\"fantasy-land/empty\"]=Xn.empty;typeof Symbol<\"u\"&&(Xn.prototype[Symbol.iterator]=function(){return this.content[Symbol.iterator]()});FN.exports=Xn});var Cy=w((abe,$N)=>{var PQ=Bl(),AQ=Ao();$N.exports=class extends AQ{constructor(e,r,i,o){super(new PQ,i,o),this.element=\"member\",this.key=e,this.value=r}get key(){return this.content.key}set key(e){this.content.key=this.refract(e)}get value(){return this.content.value}set value(e){this.content.value=this.refract(e)}}});var My=w((cbe,NN)=>{var RQ=Ul(),_Q=Jl(),Ty=class t extends _Q{map(e,r){return this.elements.map(i=>e.bind(r)(i.value,i.key,i))}filter(e,r){return new t(this.elements.filter(i=>e.bind(r)(i.value,i.key,i)))}reject(e,r){return this.filter(RQ(e.bind(r)))}forEach(e,r){return this.elements.forEach((i,o)=>{e.bind(r)(i.value,i.key,i,o)})}keys(){return this.map((e,r)=>r.toValue())}values(){return this.map(e=>e.toValue())}};NN.exports=Ty});var DN=w((lbe,kN)=>{var IQ=Ul(),CQ=Fl(),TQ=Iy(),MQ=Cy(),FQ=My(),Fy=class extends TQ{constructor(e,r,i){super(e||[],r,i),this.element=\"object\"}primitive(){return\"object\"}toValue(){return this.content.reduce((e,r)=>(e[r.key.toValue()]=r.value?r.value.toValue():void 0,e),{})}get(e){let r=this.getMember(e);if(r)return r.value}getMember(e){if(e!==void 0)return this.content.find(r=>r.key.toValue()===e)}remove(e){let r=null;return this.content=this.content.filter(i=>i.key.toValue()===e?(r=i,!1):!0),r}getKey(e){let r=this.getMember(e);if(r)return r.key}set(e,r){if(CQ(e))return Object.keys(e).forEach(s=>{this.set(s,e[s])}),this;let i=e,o=this.getMember(i);return o?o.value=r:this.content.push(new MQ(i,r)),this}keys(){return this.content.map(e=>e.key.toValue())}values(){return this.content.map(e=>e.value.toValue())}hasKey(e){return this.content.some(r=>r.key.equals(e))}items(){return this.content.map(e=>[e.key.toValue(),e.value.toValue()])}map(e,r){return this.content.map(i=>e.bind(r)(i.value,i.key,i))}compactMap(e,r){let i=[];return this.forEach((o,s,n)=>{let a=e.bind(r)(o,s,n);a&&i.push(a)}),i}filter(e,r){return new FQ(this.content).filter(e,r)}reject(e,r){return this.filter(IQ(e),r)}forEach(e,r){return this.content.forEach(i=>e.bind(r)(i.value,i.key,i))}};kN.exports=Fy});var VN=w((pbe,qN)=>{var $Q=Ao();qN.exports=class extends $Q{constructor(e,r,i){super(e||[],r,i),this.element=\"link\"}get relation(){return this.attributes.get(\"relation\")}set relation(e){this.attributes.set(\"relation\",e)}get href(){return this.attributes.get(\"href\")}set href(e){this.attributes.set(\"href\",e)}}});var BN=w((mbe,LN)=>{var NQ=Ao();LN.exports=class extends NQ{constructor(e,r,i){super(e||[],r,i),this.element=\"ref\",this.path||(this.path=\"element\")}get path(){return this.attributes.get(\"path\")}set path(e){this.attributes.set(\"path\",e)}}});var Ny=w((dbe,XN)=>{var Ya=Ao(),UN=PN(),JN=RN(),HN=IN(),zN=TN(),KN=Iy(),WN=Cy(),$y=DN(),kQ=VN(),GN=BN(),YN=Jl(),DQ=My(),qQ=Bl();function af(t){return t instanceof Ya?t:typeof t==\"string\"?new JN(t):typeof t==\"number\"?new HN(t):typeof t==\"boolean\"?new zN(t):t===null?new UN:Array.isArray(t)?new KN(t.map(af)):typeof t==\"object\"?new $y(t):t}Ya.prototype.ObjectElement=$y;Ya.prototype.RefElement=GN;Ya.prototype.MemberElement=WN;Ya.prototype.refract=af;YN.prototype.refract=af;XN.exports={Element:Ya,NullElement:UN,StringElement:JN,NumberElement:HN,BooleanElement:zN,ArrayElement:KN,MemberElement:WN,ObjectElement:$y,LinkElement:kQ,RefElement:GN,refract:af,ArraySlice:YN,ObjectSlice:DQ,KeyValuePair:qQ}});var ek=w((hbe,ZN)=>{var VQ=VM(),LQ=r1(),BQ=o1(),UQ=n1(),JQ=Fl(),QN=ef(),Lt=Ny(),cf=class{constructor(e){this.elementMap={},this.elementDetection=[],this.Element=Lt.Element,this.KeyValuePair=Lt.KeyValuePair,(!e||!e.noDefault)&&this.useDefault(),this._attributeElementKeys=[],this._attributeElementArrayKeys=[]}use(e){return e.namespace&&e.namespace({base:this}),e.load&&e.load({base:this}),this}useDefault(){return this.register(\"null\",Lt.NullElement).register(\"string\",Lt.StringElement).register(\"number\",Lt.NumberElement).register(\"boolean\",Lt.BooleanElement).register(\"array\",Lt.ArrayElement).register(\"object\",Lt.ObjectElement).register(\"member\",Lt.MemberElement).register(\"ref\",Lt.RefElement).register(\"link\",Lt.LinkElement),this.detect(VQ,Lt.NullElement,!1).detect(LQ,Lt.StringElement,!1).detect(BQ,Lt.NumberElement,!1).detect(UQ,Lt.BooleanElement,!1).detect(Array.isArray,Lt.ArrayElement,!1).detect(JQ,Lt.ObjectElement,!1),this}register(e,r){return this._elements=void 0,this.elementMap[e]=r,this}unregister(e){return this._elements=void 0,delete this.elementMap[e],this}detect(e,r,i){return(i===void 0?!0:i)?this.elementDetection.unshift([e,r]):this.elementDetection.push([e,r]),this}toElement(e){if(e instanceof this.Element)return e;let r;for(let i=0;i<this.elementDetection.length;i+=1){let o=this.elementDetection[i][0],s=this.elementDetection[i][1];if(o(e)){r=new s(e);break}}return r}getElementClass(e){let r=this.elementMap[e];return r===void 0?this.Element:r}fromRefract(e){return this.serialiser.deserialise(e)}toRefract(e){return this.serialiser.serialise(e)}get elements(){return this._elements===void 0&&(this._elements={Element:this.Element},Object.keys(this.elementMap).forEach(e=>{let r=e[0].toUpperCase()+e.substr(1);this._elements[r]=this.elementMap[e]})),this._elements}get serialiser(){return new QN(this)}};QN.prototype.Namespace=cf;ZN.exports=cf});var rk=w((ybe,tk)=>{var HQ=ef();tk.exports=class extends HQ{serialise(e){if(!(e instanceof this.namespace.elements.Element))throw new TypeError(`Given element \\`${e}\\` is not an Element instance`);let r;e._attributes&&e.attributes.get(\"variable\")&&(r=e.attributes.get(\"variable\"));let i={element:e.element};e._meta&&e._meta.length>0&&(i.meta=this.serialiseObject(e.meta));let o=e.element===\"enum\"||e.attributes.keys().indexOf(\"enumerations\")!==-1;if(o){let s=this.enumSerialiseAttributes(e);s&&(i.attributes=s)}else if(e._attributes&&e._attributes.length>0){let{attributes:s}=e;s.get(\"metadata\")&&(s=s.clone(),s.set(\"meta\",s.get(\"metadata\")),s.remove(\"metadata\")),e.element===\"member\"&&r&&(s=s.clone(),s.remove(\"variable\")),s.length>0&&(i.attributes=this.serialiseObject(s))}if(o)i.content=this.enumSerialiseContent(e,i);else if(this[`${e.element}SerialiseContent`])i.content=this[`${e.element}SerialiseContent`](e,i);else if(e.content!==void 0){let s;r&&e.content.key?(s=e.content.clone(),s.key.attributes.set(\"variable\",r),s=this.serialiseContent(s)):s=this.serialiseContent(e.content),this.shouldSerialiseContent(e,s)&&(i.content=s)}else this.shouldSerialiseContent(e,e.content)&&e instanceof this.namespace.elements.Array&&(i.content=[]);return i}shouldSerialiseContent(e,r){return e.element===\"parseResult\"||e.element===\"httpRequest\"||e.element===\"httpResponse\"||e.element===\"category\"||e.element===\"link\"?!0:!(r===void 0||Array.isArray(r)&&r.length===0)}refSerialiseContent(e,r){return delete r.attributes,{href:e.toValue(),path:e.path.toValue()}}sourceMapSerialiseContent(e){return e.toValue()}dataStructureSerialiseContent(e){return[this.serialiseContent(e.content)]}enumSerialiseAttributes(e){let r=e.attributes.clone(),i=r.remove(\"enumerations\")||new this.namespace.elements.Array([]),o=r.get(\"default\"),s=r.get(\"samples\")||new this.namespace.elements.Array([]);if(o&&o.content&&(o.content.attributes&&o.content.attributes.remove(\"typeAttributes\"),r.set(\"default\",new this.namespace.elements.Array([o.content]))),s.forEach(n=>{n.content&&n.content.element&&n.content.attributes.remove(\"typeAttributes\")}),e.content&&i.length!==0&&s.unshift(e.content),s=s.map(n=>n instanceof this.namespace.elements.Array?[n]:new this.namespace.elements.Array([n.content])),s.length&&r.set(\"samples\",s),r.length>0)return this.serialiseObject(r)}enumSerialiseContent(e){if(e._attributes){let r=e.attributes.get(\"enumerations\");if(r&&r.length>0)return r.content.map(i=>{let o=i.clone();return o.attributes.remove(\"typeAttributes\"),this.serialise(o)})}if(e.content){let r=e.content.clone();return r.attributes.remove(\"typeAttributes\"),[this.serialise(r)]}return[]}deserialise(e){if(typeof e==\"string\")return new this.namespace.elements.String(e);if(typeof e==\"number\")return new this.namespace.elements.Number(e);if(typeof e==\"boolean\")return new this.namespace.elements.Boolean(e);if(e===null)return new this.namespace.elements.Null;if(Array.isArray(e))return new this.namespace.elements.Array(e.map(this.deserialise,this));let r=this.namespace.getElementClass(e.element),i=new r;i.element!==e.element&&(i.element=e.element),e.meta&&this.deserialiseObject(e.meta,i.meta),e.attributes&&this.deserialiseObject(e.attributes,i.attributes);let o=this.deserialiseContent(e.content);if((o!==void 0||i.content===null)&&(i.content=o),i.element===\"enum\"){i.content&&i.attributes.set(\"enumerations\",i.content);let s=i.attributes.get(\"samples\");if(i.attributes.remove(\"samples\"),s){let a=s;s=new this.namespace.elements.Array,a.forEach(l=>{l.forEach(u=>{let f=new r(u);f.element=i.element,s.push(f)})});let p=s.shift();p?i.content=p.content:i.content=void 0,i.attributes.set(\"samples\",s)}else i.content=void 0;let n=i.attributes.get(\"default\");if(n&&n.length>0){n=n.get(0);let a=new r(n);a.element=i.element,i.attributes.set(\"default\",a)}}else if(i.element===\"dataStructure\"&&Array.isArray(i.content))[i.content]=i.content;else if(i.element===\"category\"){let s=i.attributes.get(\"meta\");s&&(i.attributes.set(\"metadata\",s),i.attributes.remove(\"meta\"))}else i.element===\"member\"&&i.key&&i.key._attributes&&i.key._attributes.getValue(\"variable\")&&(i.attributes.set(\"variable\",i.key.attributes.get(\"variable\")),i.key.attributes.remove(\"variable\"));return i}serialiseContent(e){if(e instanceof this.namespace.elements.Element)return this.serialise(e);if(e instanceof this.namespace.KeyValuePair){let r={key:this.serialise(e.key)};return e.value&&(r.value=this.serialise(e.value)),r}return e&&e.map?e.map(this.serialise,this):e}deserialiseContent(e){if(e){if(e.element)return this.deserialise(e);if(e.key){let r=new this.namespace.KeyValuePair(this.deserialise(e.key));return e.value&&(r.value=this.deserialise(e.value)),r}if(e.map)return e.map(this.deserialise,this)}return e}shouldRefract(e){return e._attributes&&e.attributes.keys().length||e._meta&&e.meta.keys().length?!0:e.element===\"enum\"?!1:e.element!==e.primitive()||e.element===\"member\"}convertKeyToRefract(e,r){return this.shouldRefract(r)?this.serialise(r):r.element===\"enum\"?this.serialiseEnum(r):r.element===\"array\"?r.map(i=>this.shouldRefract(i)||e===\"default\"?this.serialise(i):i.element===\"array\"||i.element===\"object\"||i.element===\"enum\"?i.children.map(o=>this.serialise(o)):i.toValue()):r.element===\"object\"?(r.content||[]).map(this.serialise,this):r.toValue()}serialiseEnum(e){return e.children.map(r=>this.serialise(r))}serialiseObject(e){let r={};return e.forEach((i,o)=>{if(i){let s=o.toValue();r[s]=this.convertKeyToRefract(s,i)}}),r}deserialiseObject(e,r){Object.keys(e).forEach(i=>{r.set(i,this.deserialise(e[i]))})}}});var Cr=w(vt=>{var ik=ek(),Ir=Ny();vt.Namespace=ik;vt.namespace=function(e){return new ik(e)};vt.KeyValuePair=Bl();vt.ArraySlice=Ir.ArraySlice;vt.ObjectSlice=Ir.ObjectSlice;vt.Element=Ir.Element;vt.StringElement=Ir.StringElement;vt.NumberElement=Ir.NumberElement;vt.BooleanElement=Ir.BooleanElement;vt.NullElement=Ir.NullElement;vt.ArrayElement=Ir.ArrayElement;vt.ObjectElement=Ir.ObjectElement;vt.MemberElement=Ir.MemberElement;vt.RefElement=Ir.RefElement;vt.LinkElement=Ir.LinkElement;vt.refract=Ir.refract;vt.JSONSerialiser=ef();vt.JSON06Serialiser=rk()});var yk=w((mSe,Ky)=>{\"use strict\";var zy=(()=>{var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,n=(E,y,g)=>y in E?t(E,y,{enumerable:!0,configurable:!0,writable:!0,value:g}):E[y]=g,a=(E,y)=>{for(var g in y||(y={}))o.call(y,g)&&n(E,g,y[g]);if(i)for(var g of i(y))s.call(y,g)&&n(E,g,y[g]);return E},p=(E,y)=>{for(var g in y)t(E,g,{get:y[g],enumerable:!0})},l=(E,y,g,q)=>{if(y&&typeof y==\"object\"||typeof y==\"function\")for(let V of r(y))!o.call(E,V)&&V!==g&&t(E,V,{get:()=>y[V],enumerable:!(q=e(y,V))||q.enumerable});return E},u=E=>l(t({},\"__esModule\",{value:!0}),E),f=(E,y,g)=>n(E,typeof y!=\"symbol\"?y+\"\":y,g),m={};p(m,{DEFAULT_OPTIONS:()=>O,DEFAULT_UUID_LENGTH:()=>h,default:()=>v});var x=\"5.3.2\",h=6,O={dictionary:\"alphanum\",shuffle:!0,debug:!1,length:h,counter:0},j=class{constructor(y={}){f(this,\"counter\"),f(this,\"debug\"),f(this,\"dict\"),f(this,\"version\"),f(this,\"dictIndex\",0),f(this,\"dictRange\",[]),f(this,\"lowerBound\",0),f(this,\"upperBound\",0),f(this,\"dictLength\",0),f(this,\"uuidLength\"),f(this,\"_digit_first_ascii\",48),f(this,\"_digit_last_ascii\",58),f(this,\"_alpha_lower_first_ascii\",97),f(this,\"_alpha_lower_last_ascii\",123),f(this,\"_hex_last_ascii\",103),f(this,\"_alpha_upper_first_ascii\",65),f(this,\"_alpha_upper_last_ascii\",91),f(this,\"_number_dict_ranges\",{digits:[this._digit_first_ascii,this._digit_last_ascii]}),f(this,\"_alpha_dict_ranges\",{lowerCase:[this._alpha_lower_first_ascii,this._alpha_lower_last_ascii],upperCase:[this._alpha_upper_first_ascii,this._alpha_upper_last_ascii]}),f(this,\"_alpha_lower_dict_ranges\",{lowerCase:[this._alpha_lower_first_ascii,this._alpha_lower_last_ascii]}),f(this,\"_alpha_upper_dict_ranges\",{upperCase:[this._alpha_upper_first_ascii,this._alpha_upper_last_ascii]}),f(this,\"_alphanum_dict_ranges\",{digits:[this._digit_first_ascii,this._digit_last_ascii],lowerCase:[this._alpha_lower_first_ascii,this._alpha_lower_last_ascii],upperCase:[this._alpha_upper_first_ascii,this._alpha_upper_last_ascii]}),f(this,\"_alphanum_lower_dict_ranges\",{digits:[this._digit_first_ascii,this._digit_last_ascii],lowerCase:[this._alpha_lower_first_ascii,this._alpha_lower_last_ascii]}),f(this,\"_alphanum_upper_dict_ranges\",{digits:[this._digit_first_ascii,this._digit_last_ascii],upperCase:[this._alpha_upper_first_ascii,this._alpha_upper_last_ascii]}),f(this,\"_hex_dict_ranges\",{decDigits:[this._digit_first_ascii,this._digit_last_ascii],alphaDigits:[this._alpha_lower_first_ascii,this._hex_last_ascii]}),f(this,\"_dict_ranges\",{_number_dict_ranges:this._number_dict_ranges,_alpha_dict_ranges:this._alpha_dict_ranges,_alpha_lower_dict_ranges:this._alpha_lower_dict_ranges,_alpha_upper_dict_ranges:this._alpha_upper_dict_ranges,_alphanum_dict_ranges:this._alphanum_dict_ranges,_alphanum_lower_dict_ranges:this._alphanum_lower_dict_ranges,_alphanum_upper_dict_ranges:this._alphanum_upper_dict_ranges,_hex_dict_ranges:this._hex_dict_ranges}),f(this,\"log\",(...M)=>{let te=[...M];if(te[0]=\"[short-unique-id] \".concat(M[0]),this.debug===!0&&typeof console<\"u\"&&console!==null){console.log(...te);return}}),f(this,\"_normalizeDictionary\",(M,te)=>{let H;if(M&&Array.isArray(M)&&M.length>1)H=M;else{H=[],this.dictIndex=0;let k=\"_\".concat(M,\"_dict_ranges\"),W=this._dict_ranges[k],Z=0;for(let[,re]of Object.entries(W)){let[Qe,$t]=re;Z+=Math.abs($t-Qe)}H=new Array(Z);let pe=0;for(let[,re]of Object.entries(W)){this.dictRange=re,this.lowerBound=this.dictRange[0],this.upperBound=this.dictRange[1];let Qe=this.lowerBound<=this.upperBound,$t=this.lowerBound,Ea=this.upperBound;if(Qe)for(let Nt=$t;Nt<Ea;Nt++)H[pe++]=String.fromCharCode(Nt),this.dictIndex=Nt;else for(let Nt=$t;Nt>Ea;Nt--)H[pe++]=String.fromCharCode(Nt),this.dictIndex=Nt}H.length=pe}if(te){let k=H.length;for(let W=k-1;W>0;W--){let Z=Math.floor(Math.random()*(W+1));[H[W],H[Z]]=[H[Z],H[W]]}}return H}),f(this,\"setDictionary\",(M,te)=>{this.dict=this._normalizeDictionary(M,te),this.dictLength=this.dict.length,this.setCounter(0)}),f(this,\"seq\",()=>this.sequentialUUID()),f(this,\"sequentialUUID\",()=>{let M=this.dictLength,te=this.dict,H=this.counter,k=[];do{let Z=H%M;H=Math.trunc(H/M),k.push(te[Z])}while(H!==0);let W=k.join(\"\");return this.counter+=1,W}),f(this,\"rnd\",(M=this.uuidLength||h)=>this.randomUUID(M)),f(this,\"randomUUID\",(M=this.uuidLength||h)=>{if(M===null||typeof M>\"u\"||M<1)throw new Error(\"Invalid UUID Length Provided\");let te=new Array(M),H=this.dictLength,k=this.dict;for(let W=0;W<M;W++){let Z=Math.floor(Math.random()*H);te[W]=k[Z]}return te.join(\"\")}),f(this,\"fmt\",(M,te)=>this.formattedUUID(M,te)),f(this,\"formattedUUID\",(M,te)=>{let H={$r:this.randomUUID,$s:this.sequentialUUID,$t:this.stamp};return M.replace(/\\$[rs]\\d{0,}|\\$t0|\\$t[1-9]\\d{1,}/g,W=>{let Z=W.slice(0,2),pe=Number.parseInt(W.slice(2),10);return Z===\"$s\"?H[Z]().padStart(pe,\"0\"):Z===\"$t\"&&te?H[Z](pe,te):H[Z](pe)})}),f(this,\"availableUUIDs\",(M=this.uuidLength)=>Number.parseFloat(([...new Set(this.dict)].length**M).toFixed(0))),f(this,\"_collisionCache\",new Map),f(this,\"approxMaxBeforeCollision\",(M=this.availableUUIDs(this.uuidLength))=>{let te=M,H=this._collisionCache.get(te);if(H!==void 0)return H;let k=Number.parseFloat(Math.sqrt(Math.PI/2*M).toFixed(20));return this._collisionCache.set(te,k),k}),f(this,\"collisionProbability\",(M=this.availableUUIDs(this.uuidLength),te=this.uuidLength)=>Number.parseFloat((this.approxMaxBeforeCollision(M)/this.availableUUIDs(te)).toFixed(20))),f(this,\"uniqueness\",(M=this.availableUUIDs(this.uuidLength))=>{let te=Number.parseFloat((1-this.approxMaxBeforeCollision(M)/M).toFixed(20));return te>1?1:te<0?0:te}),f(this,\"getVersion\",()=>this.version),f(this,\"stamp\",(M,te)=>{let H=Math.floor(+(te||new Date)/1e3).toString(16);if(typeof M==\"number\"&&M===0)return H;if(typeof M!=\"number\"||M<10)throw new Error([\"Param finalLength must be a number greater than or equal to 10,\",\"or 0 if you want the raw hexadecimal timestamp\"].join(`\n`));let k=M-9,W=Math.round(Math.random()*(k>15?15:k)),Z=this.randomUUID(k);return\"\".concat(Z.substring(0,W)).concat(H).concat(Z.substring(W)).concat(W.toString(16))}),f(this,\"parseStamp\",(M,te)=>{if(te&&!/t0|t[1-9]\\d{1,}/.test(te))throw new Error(\"Cannot extract date from a formated UUID with no timestamp in the format\");let H=te?te.replace(/\\$[rs]\\d{0,}|\\$t0|\\$t[1-9]\\d{1,}/g,W=>{let Z={$r:Qe=>[...Array(Qe)].map(()=>\"r\").join(\"\"),$s:Qe=>[...Array(Qe)].map(()=>\"s\").join(\"\"),$t:Qe=>[...Array(Qe)].map(()=>\"t\").join(\"\")},pe=W.slice(0,2),re=Number.parseInt(W.slice(2),10);return Z[pe](re)}).replace(/^(.*?)(t{8,})(.*)$/g,(W,Z,pe)=>M.substring(Z.length,Z.length+pe.length)):M;if(H.length===8)return new Date(Number.parseInt(H,16)*1e3);if(H.length<10)throw new Error(\"Stamp length invalid\");let k=Number.parseInt(H.substring(H.length-1),16);return new Date(Number.parseInt(H.substring(k,k+8),16)*1e3)}),f(this,\"setCounter\",M=>{this.counter=M}),f(this,\"validate\",(M,te)=>{let H=te?this._normalizeDictionary(te):this.dict;return M.split(\"\").every(k=>H.includes(k))});let g=a(a({},O),y);this.counter=0,this.debug=!1,this.dict=[],this.version=x;let{dictionary:q,shuffle:V,length:C,counter:oe}=g;this.uuidLength=C,this.setDictionary(q,V),this.setCounter(oe),this.debug=g.debug,this.log(this.dict),this.log(\"Generator instantiated with Dictionary Size \".concat(this.dictLength,\" and counter set to \").concat(this.counter)),this.log=this.log.bind(this),this.setDictionary=this.setDictionary.bind(this),this.setCounter=this.setCounter.bind(this),this.seq=this.seq.bind(this),this.sequentialUUID=this.sequentialUUID.bind(this),this.rnd=this.rnd.bind(this),this.randomUUID=this.randomUUID.bind(this),this.fmt=this.fmt.bind(this),this.formattedUUID=this.formattedUUID.bind(this),this.availableUUIDs=this.availableUUIDs.bind(this),this.approxMaxBeforeCollision=this.approxMaxBeforeCollision.bind(this),this.collisionProbability=this.collisionProbability.bind(this),this.uniqueness=this.uniqueness.bind(this),this.getVersion=this.getVersion.bind(this),this.stamp=this.stamp.bind(this),this.parseStamp=this.parseStamp.bind(this)}};f(j,\"default\",j);var v=j;return u(m)})();typeof Ky<\"u\"&&(Ky.exports=zy.default),typeof window<\"u\"&&(zy=zy.default)});var Ju=\"application/json, application/yaml\",ko=\"https://swagger.io\",Hu=Object.freeze({url:\"/\"}),zu=3e3;function Hc(t,e){return!e&&typeof navigator<\"u\"&&(e=navigator),e&&e.product===\"ReactNative\"?!!(t&&typeof t==\"object\"&&typeof t.uri==\"string\"):typeof File<\"u\"&&t instanceof File||typeof Blob<\"u\"&&t instanceof Blob||ArrayBuffer.isView(t)?!0:t!==null&&typeof t==\"object\"&&typeof t.pipe==\"function\"}function Ku(t,e){return Array.isArray(t)&&t.some(r=>Hc(r,e))}var wn=class extends File{constructor(e,r=\"\",i={}){super([e],r,i),this.data=e}valueOf(){return this.data}toString(){return this.valueOf()}};var u3=t=>\":/?#[]@!$&'()*+,;=\".indexOf(t)>-1,p3=t=>/^[a-z0-9\\-._~]+$/i.test(t);function Qm(t,e=\"reserved\"){return[...t].map(r=>{if(p3(r)||u3(r)&&e===\"unsafe\")return r;let i=new TextEncoder;return Array.from(i.encode(r)).map(s=>`0${s.toString(16).toUpperCase()}`.slice(-2)).map(s=>`%${s}`).join(\"\")}).join(\"\")}function zc(t){let{value:e}=t;return Array.isArray(e)?f3(t):typeof e==\"object\"?m3(t):d3(t)}function Ot(t,e=!1){return Array.isArray(t)||t!==null&&typeof t==\"object\"?t=JSON.stringify(t):(typeof t==\"number\"||typeof t==\"boolean\")&&(t=String(t)),e&&typeof t==\"string\"&&t.length>0?Qm(t,e):t??\"\"}function f3({key:t,value:e,style:r,explode:i,escape:o}){if(r===\"simple\")return e.map(s=>Ot(s,o)).join(\",\");if(r===\"label\")return`.${e.map(s=>Ot(s,o)).join(\".\")}`;if(r===\"matrix\")return e.map(s=>Ot(s,o)).reduce((s,n)=>!s||i?`${s||\"\"};${t}=${n}`:`${s},${n}`,\"\");if(r===\"form\"){let s=i?`&${t}=`:\",\";return e.map(n=>Ot(n,o)).join(s)}if(r===\"spaceDelimited\"){let s=i?`${t}=`:\"\";return e.map(n=>Ot(n,o)).join(` ${s}`)}if(r===\"pipeDelimited\"){let s=i?`${t}=`:\"\";return e.map(n=>Ot(n,o)).join(`|${s}`)}}function m3({key:t,value:e,style:r,explode:i,escape:o}){let s=Object.keys(e);if(r===\"simple\")return s.reduce((n,a)=>{let p=Ot(e[a],o),l=i?\"=\":\",\";return`${n?`${n},`:\"\"}${a}${l}${p}`},\"\");if(r===\"label\")return s.reduce((n,a)=>{let p=Ot(e[a],o),l=i?\"=\":\".\";return`${n?`${n}.`:\".\"}${a}${l}${p}`},\"\");if(r===\"matrix\"&&i)return s.reduce((n,a)=>{let p=Ot(e[a],o);return`${n?`${n};`:\";\"}${a}=${p}`},\"\");if(r===\"matrix\")return s.reduce((n,a)=>{let p=Ot(e[a],o);return`${n?`${n},`:`;${t}=`}${a},${p}`},\"\");if(r===\"form\")return s.reduce((n,a)=>{let p=Ot(e[a],o);return`${n?`${n}${i?\"&\":\",\"}`:\"\"}${a}${i?\"=\":\",\"}${p}`},\"\")}function d3({key:t,value:e,style:r,escape:i}){if(r===\"simple\")return Ot(e,i);if(r===\"label\")return`.${Ot(e,i)}`;if(r===\"matrix\")return`;${t}=${Ot(e,i)}`;if(r===\"form\"||r===\"deepObject\")return Ot(e,i)}var h3={form:\",\",spaceDelimited:\"%20\",pipeDelimited:\"|\"},x3={csv:\",\",ssv:\"%20\",tsv:\"%09\",pipes:\"|\"};function Wu(t,e,r=!1){let{collectionFormat:i,allowEmptyValue:o,serializationOption:s,encoding:n}=e,a=typeof e==\"object\"&&!Array.isArray(e)?e.value:e,p=r?u=>u.toString():u=>encodeURIComponent(u),l=p(t);if(typeof a>\"u\"&&o)return[[l,\"\"]];if(Hc(a)||Ku(a))return[[l,a]];if(s)return VA(t,a,r,s);if(n){if([typeof n.style,typeof n.explode,typeof n.allowReserved].some(u=>u!==\"undefined\")){let{style:u,explode:f,allowReserved:m}=n;return VA(t,a,r,{style:u,explode:f,allowReserved:m})}if(typeof n.contentType==\"string\"){if(n.contentType.startsWith(\"application/json\")){let m=typeof a==\"string\"?a:JSON.stringify(a),x=p(m),h=new wn(x,\"blob\",{type:n.contentType});return[[l,h]]}let u=p(String(a)),f=new wn(u,\"blob\",{type:n.contentType});return[[l,f]]}return typeof a!=\"object\"?[[l,p(a)]]:Array.isArray(a)&&a.every(u=>typeof u!=\"object\")?[[l,a.map(p).join(\",\")]]:[[l,p(JSON.stringify(a))]]}return typeof a!=\"object\"?[[l,p(a)]]:Array.isArray(a)?i===\"multi\"?[[l,a.map(p)]]:[[l,a.map(p).join(x3[i||\"csv\"])]]:[[l,\"\"]]}function VA(t,e,r,i){let o=i.style||\"form\",s=typeof i.explode>\"u\"?o===\"form\":i.explode,n=r?!1:i&&i.allowReserved?\"unsafe\":\"reserved\",a=l=>Ot(l,n),p=r?l=>l:l=>a(l);return typeof e!=\"object\"?[[p(t),a(e)]]:Array.isArray(e)?s?[[p(t),e.map(a)]]:[[p(t),e.map(a).join(h3[o])]]:o===\"deepObject\"?Object.keys(e).map(l=>[p(`${t}[${l}]`),a(e[l])]):s?Object.keys(e).map(l=>[p(l),a(e[l])]):[[p(t),Object.keys(e).map(l=>[`${p(l)},${a(e[l])}`]).join(\",\")]]}function y3(t){return Object.entries(t).reduce((e,[r,i])=>{for(let[o,s]of Wu(r,i,!0))if(Array.isArray(s))for(let n of s)if(ArrayBuffer.isView(n)){let a=new Blob([n]);e.append(o,a)}else e.append(o,n);else if(ArrayBuffer.isView(s)){let n=new Blob([s]);e.append(o,n)}else e.append(o,s);return e},new FormData)}var g3=(t,{encode:e=!0}={})=>{let r=(s,n,a)=>(Array.isArray(a)?a.reduce((p,l)=>r(s,n,l),s):a instanceof Date?s.append(n,a.toISOString()):typeof a==\"object\"?Object.entries(a).reduce((p,[l,u])=>r(s,`${n}[${l}]`,u),s):s.append(n,a),s),i=Object.entries(t).reduce((s,[n,a])=>r(s,n,a),new URLSearchParams),o=String(i);return e?o:decodeURIComponent(o)};function LA(t){let e=Object.keys(t).reduce((r,i)=>{for(let[o,s]of Wu(i,t[i]))s instanceof wn?r[o]=s.valueOf():r[o]=s;return r},{});return g3(e,{encode:!1})}function Kc(t={}){let{url:e=\"\",query:r,form:i}=t,o=(...s)=>{let n=s.filter(a=>a).join(\"&\");return n?`?${n}`:\"\"};if(i){let s=Object.keys(i).some(a=>{let{value:p}=i[a];return Hc(p)||Ku(p)}),n=t.headers[\"content-type\"]||t.headers[\"Content-Type\"];if(s||/multipart\\/form-data/i.test(n)){let a=y3(t.form);t.formdata=a,t.body=a}else t.body=LA(i);delete t.form}if(r){let[s,n]=e.split(\"?\"),a=\"\";if(n){let l=new URLSearchParams(n);Object.keys(r).forEach(f=>l.delete(f)),a=String(l)}let p=o(a,LA(r));t.url=s+p,delete t.query}return t}var J_=Le(Er());function h4(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,\"default\")?t.default:t}var Qt={},cp={},zs={},r_;function tl(){if(r_)return zs;r_=1;function t(n){return typeof n>\"u\"||n===null}function e(n){return typeof n==\"object\"&&n!==null}function r(n){return Array.isArray(n)?n:t(n)?[]:[n]}function i(n,a){if(a){let p=Object.keys(a);for(let l=0,u=p.length;l<u;l+=1){let f=p[l];n[f]=a[f]}}return n}function o(n,a){let p=\"\";for(let l=0;l<a;l+=1)p+=n;return p}function s(n){return n===0&&Number.NEGATIVE_INFINITY===1/n}return zs.isNothing=t,zs.isObject=e,zs.toArray=r,zs.repeat=o,zs.isNegativeZero=s,zs.extend=i,zs}var Fd,i_;function rl(){if(i_)return Fd;i_=1;function t(r,i){let o=\"\",s=r.reason||\"(unknown reason)\";return r.mark?(r.mark.name&&(o+='in \"'+r.mark.name+'\" '),o+=\"(\"+(r.mark.line+1)+\":\"+(r.mark.column+1)+\")\",!i&&r.mark.snippet&&(o+=`\n\n`+r.mark.snippet),s+\" \"+o):s}function e(r,i){Error.call(this),this.name=\"YAMLException\",this.reason=r,this.mark=i,this.message=t(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||\"\"}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(i){return this.name+\": \"+t(this,i)},Fd=e,Fd}var $d,o_;function x4(){if(o_)return $d;o_=1;let t=tl();function e(o,s,n,a,p){let l=\"\",u=\"\",f=Math.floor(p/2)-1;return a-s>f&&(l=\" ... \",s=a-f+l.length),n-a>f&&(u=\" ...\",n=a+f-u.length),{str:l+o.slice(s,n).replace(/\\t/g,\"\\u2192\")+u,pos:a-s+l.length}}function r(o,s){return t.repeat(\" \",s-o.length)+o}function i(o,s){if(s=Object.create(s||null),!o.buffer)return null;s.maxLength||(s.maxLength=79),typeof s.indent!=\"number\"&&(s.indent=1),typeof s.linesBefore!=\"number\"&&(s.linesBefore=3),typeof s.linesAfter!=\"number\"&&(s.linesAfter=2);let n=/\\r?\\n|\\r|\\0/g,a=[0],p=[],l,u=-1;for(;l=n.exec(o.buffer);)p.push(l.index),a.push(l.index+l[0].length),o.position<=l.index&&u<0&&(u=a.length-2);u<0&&(u=a.length-1);let f=\"\",m=Math.min(o.line+s.linesAfter,p.length).toString().length,x=s.maxLength-(s.indent+m+3);for(let O=1;O<=s.linesBefore&&!(u-O<0);O++){let j=e(o.buffer,a[u-O],p[u-O],o.position-(a[u]-a[u-O]),x);f=t.repeat(\" \",s.indent)+r((o.line-O+1).toString(),m)+\" | \"+j.str+`\n`+f}let h=e(o.buffer,a[u],p[u],o.position,x);f+=t.repeat(\" \",s.indent)+r((o.line+1).toString(),m)+\" | \"+h.str+`\n`,f+=t.repeat(\"-\",s.indent+m+3+h.pos)+`^\n`;for(let O=1;O<=s.linesAfter&&!(u+O>=p.length);O++){let j=e(o.buffer,a[u+O],p[u+O],o.position-(a[u]-a[u+O]),x);f+=t.repeat(\" \",s.indent)+r((o.line+O+1).toString(),m)+\" | \"+j.str+`\n`}return f.replace(/\\n$/,\"\")}return $d=i,$d}var Nd,s_;function or(){if(s_)return Nd;s_=1;let t=rl(),e=[\"kind\",\"multi\",\"resolve\",\"construct\",\"instanceOf\",\"predicate\",\"represent\",\"representName\",\"defaultStyle\",\"styleAliases\"],r=[\"scalar\",\"sequence\",\"mapping\"];function i(s){let n={};return s!==null&&Object.keys(s).forEach(function(a){s[a].forEach(function(p){n[String(p)]=a})}),n}function o(s,n){if(n=n||{},Object.keys(n).forEach(function(a){if(e.indexOf(a)===-1)throw new t('Unknown option \"'+a+'\" is met in definition of \"'+s+'\" YAML type.')}),this.options=n,this.tag=s,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(a){return a},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=i(n.styleAliases||null),r.indexOf(this.kind)===-1)throw new t('Unknown kind \"'+this.kind+'\" is specified for \"'+s+'\" YAML type.')}return Nd=o,Nd}var kd,n_;function A_(){if(n_)return kd;n_=1;let t=rl(),e=or();function r(s,n){let a=[];return s[n].forEach(function(p){let l=a.length;a.forEach(function(u,f){u.tag===p.tag&&u.kind===p.kind&&u.multi===p.multi&&(l=f)}),a[l]=p}),a}function i(){let s={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function n(a){a.multi?(s.multi[a.kind].push(a),s.multi.fallback.push(a)):s[a.kind][a.tag]=s.fallback[a.tag]=a}for(let a=0,p=arguments.length;a<p;a+=1)arguments[a].forEach(n);return s}function o(s){return this.extend(s)}return o.prototype.extend=function(n){let a=[],p=[];if(n instanceof e)p.push(n);else if(Array.isArray(n))p=p.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(a=a.concat(n.implicit)),n.explicit&&(p=p.concat(n.explicit));else throw new t(\"Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })\");a.forEach(function(u){if(!(u instanceof e))throw new t(\"Specified list of YAML types (or a single Type object) contains a non-Type object.\");if(u.loadKind&&u.loadKind!==\"scalar\")throw new t(\"There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.\");if(u.multi)throw new t(\"There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.\")}),p.forEach(function(u){if(!(u instanceof e))throw new t(\"Specified list of YAML types (or a single Type object) contains a non-Type object.\")});let l=Object.create(o.prototype);return l.implicit=(this.implicit||[]).concat(a),l.explicit=(this.explicit||[]).concat(p),l.compiledImplicit=r(l,\"implicit\"),l.compiledExplicit=r(l,\"explicit\"),l.compiledTypeMap=i(l.compiledImplicit,l.compiledExplicit),l},kd=o,kd}var Dd,a_;function R_(){if(a_)return Dd;a_=1;let t=or();return Dd=new t(\"tag:yaml.org,2002:str\",{kind:\"scalar\",construct:function(e){return e!==null?e:\"\"}}),Dd}var qd,c_;function __(){if(c_)return qd;c_=1;let t=or();return qd=new t(\"tag:yaml.org,2002:seq\",{kind:\"sequence\",construct:function(e){return e!==null?e:[]}}),qd}var Vd,l_;function I_(){if(l_)return Vd;l_=1;let t=or();return Vd=new t(\"tag:yaml.org,2002:map\",{kind:\"mapping\",construct:function(e){return e!==null?e:{}}}),Vd}var Ld,u_;function C_(){if(u_)return Ld;u_=1;let t=A_();return Ld=new t({explicit:[R_(),__(),I_()]}),Ld}var Bd,p_;function T_(){if(p_)return Bd;p_=1;let t=or();function e(o){if(o===null)return!0;let s=o.length;return s===1&&o===\"~\"||s===4&&(o===\"null\"||o===\"Null\"||o===\"NULL\")}function r(){return null}function i(o){return o===null}return Bd=new t(\"tag:yaml.org,2002:null\",{kind:\"scalar\",resolve:e,construct:r,predicate:i,represent:{canonical:function(){return\"~\"},lowercase:function(){return\"null\"},uppercase:function(){return\"NULL\"},camelcase:function(){return\"Null\"},empty:function(){return\"\"}},defaultStyle:\"lowercase\"}),Bd}var Ud,f_;function M_(){if(f_)return Ud;f_=1;let t=or();function e(o){if(o===null)return!1;let s=o.length;return s===4&&(o===\"true\"||o===\"True\"||o===\"TRUE\")||s===5&&(o===\"false\"||o===\"False\"||o===\"FALSE\")}function r(o){return o===\"true\"||o===\"True\"||o===\"TRUE\"}function i(o){return Object.prototype.toString.call(o)===\"[object Boolean]\"}return Ud=new t(\"tag:yaml.org,2002:bool\",{kind:\"scalar\",resolve:e,construct:r,predicate:i,represent:{lowercase:function(o){return o?\"true\":\"false\"},uppercase:function(o){return o?\"TRUE\":\"FALSE\"},camelcase:function(o){return o?\"True\":\"False\"}},defaultStyle:\"lowercase\"}),Ud}var Jd,m_;function F_(){if(m_)return Jd;m_=1;let t=tl(),e=or();function r(l){return l>=48&&l<=57||l>=65&&l<=70||l>=97&&l<=102}function i(l){return l>=48&&l<=55}function o(l){return l>=48&&l<=57}function s(l){if(l===null)return!1;let u=l.length,f=0,m=!1;if(!u)return!1;let x=l[f];if((x===\"-\"||x===\"+\")&&(x=l[++f]),x===\"0\"){if(f+1===u)return!0;if(x=l[++f],x===\"b\"){for(f++;f<u;f++){if(x=l[f],x!==\"0\"&&x!==\"1\")return!1;m=!0}return m&&isFinite(n(l))}if(x===\"x\"){for(f++;f<u;f++){if(!r(l.charCodeAt(f)))return!1;m=!0}return m&&isFinite(n(l))}if(x===\"o\"){for(f++;f<u;f++){if(!i(l.charCodeAt(f)))return!1;m=!0}return m&&isFinite(n(l))}}for(;f<u;f++){if(!o(l.charCodeAt(f)))return!1;m=!0}return m?isFinite(n(l)):!1}function n(l){let u=l,f=1,m=u[0];if((m===\"-\"||m===\"+\")&&(m===\"-\"&&(f=-1),u=u.slice(1),m=u[0]),u===\"0\")return 0;if(m===\"0\"){if(u[1]===\"b\")return f*parseInt(u.slice(2),2);if(u[1]===\"x\")return f*parseInt(u.slice(2),16);if(u[1]===\"o\")return f*parseInt(u.slice(2),8)}return f*parseInt(u,10)}function a(l){return n(l)}function p(l){return Object.prototype.toString.call(l)===\"[object Number]\"&&l%1===0&&!t.isNegativeZero(l)}return Jd=new e(\"tag:yaml.org,2002:int\",{kind:\"scalar\",resolve:s,construct:a,predicate:p,represent:{binary:function(l){return l>=0?\"0b\"+l.toString(2):\"-0b\"+l.toString(2).slice(1)},octal:function(l){return l>=0?\"0o\"+l.toString(8):\"-0o\"+l.toString(8).slice(1)},decimal:function(l){return l.toString(10)},hexadecimal:function(l){return l>=0?\"0x\"+l.toString(16).toUpperCase():\"-0x\"+l.toString(16).toUpperCase().slice(1)}},defaultStyle:\"decimal\",styleAliases:{binary:[2,\"bin\"],octal:[8,\"oct\"],decimal:[10,\"dec\"],hexadecimal:[16,\"hex\"]}}),Jd}var Hd,d_;function $_(){if(d_)return Hd;d_=1;let t=tl(),e=or(),r=new RegExp(\"^(?:[-+]?(?:[0-9]+)(?:\\\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))$\"),i=new RegExp(\"^(?:[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))$\");function o(l){return l===null||!r.test(l)?!1:isFinite(parseFloat(l,10))?!0:i.test(l)}function s(l){let u=l.toLowerCase(),f=u[0]===\"-\"?-1:1;return\"+-\".indexOf(u[0])>=0&&(u=u.slice(1)),u===\".inf\"?f===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:u===\".nan\"?NaN:f*parseFloat(u,10)}let n=/^[-+]?[0-9]+e/;function a(l,u){if(isNaN(l))switch(u){case\"lowercase\":return\".nan\";case\"uppercase\":return\".NAN\";case\"camelcase\":return\".NaN\"}else if(Number.POSITIVE_INFINITY===l)switch(u){case\"lowercase\":return\".inf\";case\"uppercase\":return\".INF\";case\"camelcase\":return\".Inf\"}else if(Number.NEGATIVE_INFINITY===l)switch(u){case\"lowercase\":return\"-.inf\";case\"uppercase\":return\"-.INF\";case\"camelcase\":return\"-.Inf\"}else if(t.isNegativeZero(l))return\"-0.0\";let f=l.toString(10);return n.test(f)?f.replace(\"e\",\".e\"):f}function p(l){return Object.prototype.toString.call(l)===\"[object Number]\"&&(l%1!==0||t.isNegativeZero(l))}return Hd=new e(\"tag:yaml.org,2002:float\",{kind:\"scalar\",resolve:o,construct:s,predicate:p,represent:a,defaultStyle:\"lowercase\"}),Hd}var zd,h_;function N_(){return h_||(h_=1,zd=C_().extend({implicit:[T_(),M_(),F_(),$_()]})),zd}var Kd,x_;function k_(){return x_||(x_=1,Kd=N_()),Kd}var Wd,y_;function D_(){if(y_)return Wd;y_=1;let t=or(),e=new RegExp(\"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$\"),r=new RegExp(\"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\\\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\\\.([0-9]*))?(?:[ \\\\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$\");function i(n){return n===null?!1:e.exec(n)!==null||r.exec(n)!==null}function o(n){let a=0,p=null,l=e.exec(n);if(l===null&&(l=r.exec(n)),l===null)throw new Error(\"Date resolve error\");let u=+l[1],f=+l[2]-1,m=+l[3];if(!l[4])return new Date(Date.UTC(u,f,m));let x=+l[4],h=+l[5],O=+l[6];if(l[7]){for(a=l[7].slice(0,3);a.length<3;)a+=\"0\";a=+a}if(l[9]){let v=+l[10],E=+(l[11]||0);p=(v*60+E)*6e4,l[9]===\"-\"&&(p=-p)}let j=new Date(Date.UTC(u,f,m,x,h,O,a));return p&&j.setTime(j.getTime()-p),j}function s(n){return n.toISOString()}return Wd=new t(\"tag:yaml.org,2002:timestamp\",{kind:\"scalar\",resolve:i,construct:o,instanceOf:Date,represent:s}),Wd}var Gd,g_;function q_(){if(g_)return Gd;g_=1;let t=or();function e(r){return r===\"<<\"||r===null}return Gd=new t(\"tag:yaml.org,2002:merge\",{kind:\"scalar\",resolve:e}),Gd}var Yd,v_;function V_(){if(v_)return Yd;v_=1;let t=or(),e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\\r`;function r(n){if(n===null)return!1;let a=0,p=n.length,l=e;for(let u=0;u<p;u++){let f=l.indexOf(n.charAt(u));if(!(f>64)){if(f<0)return!1;a+=6}}return a%8===0}function i(n){let a=n.replace(/[\\r\\n=]/g,\"\"),p=a.length,l=e,u=0,f=[];for(let x=0;x<p;x++)x%4===0&&x&&(f.push(u>>16&255),f.push(u>>8&255),f.push(u&255)),u=u<<6|l.indexOf(a.charAt(x));let m=p%4*6;return m===0?(f.push(u>>16&255),f.push(u>>8&255),f.push(u&255)):m===18?(f.push(u>>10&255),f.push(u>>2&255)):m===12&&f.push(u>>4&255),new Uint8Array(f)}function o(n){let a=\"\",p=0,l=n.length,u=e;for(let m=0;m<l;m++)m%3===0&&m&&(a+=u[p>>18&63],a+=u[p>>12&63],a+=u[p>>6&63],a+=u[p&63]),p=(p<<8)+n[m];let f=l%3;return f===0?(a+=u[p>>18&63],a+=u[p>>12&63],a+=u[p>>6&63],a+=u[p&63]):f===2?(a+=u[p>>10&63],a+=u[p>>4&63],a+=u[p<<2&63],a+=u[64]):f===1&&(a+=u[p>>2&63],a+=u[p<<4&63],a+=u[64],a+=u[64]),a}function s(n){return Object.prototype.toString.call(n)===\"[object Uint8Array]\"}return Yd=new t(\"tag:yaml.org,2002:binary\",{kind:\"scalar\",resolve:r,construct:i,predicate:s,represent:o}),Yd}var Xd,E_;function L_(){if(E_)return Xd;E_=1;let t=or(),e=Object.prototype.hasOwnProperty,r=Object.prototype.toString;function i(s){if(s===null)return!0;let n={},a=s;for(let p=0,l=a.length;p<l;p+=1){let u=a[p],f=!1;if(r.call(u)!==\"[object Object]\")return!1;let m;for(m in u)if(e.call(u,m))if(!f)f=!0;else return!1;if(!f||e.call(n,m))return!1;Object.defineProperty(n,m,{value:!0})}return!0}function o(s){return s!==null?s:[]}return Xd=new t(\"tag:yaml.org,2002:omap\",{kind:\"sequence\",resolve:i,construct:o}),Xd}var Qd,b_;function B_(){if(b_)return Qd;b_=1;let t=or(),e=Object.prototype.toString;function r(o){if(o===null)return!0;let s=o,n=new Array(s.length);for(let a=0,p=s.length;a<p;a+=1){let l=s[a];if(e.call(l)!==\"[object Object]\")return!1;let u=Object.keys(l);if(u.length!==1)return!1;n[a]=[u[0],l[u[0]]]}return!0}function i(o){if(o===null)return[];let s=o,n=new Array(s.length);for(let a=0,p=s.length;a<p;a+=1){let l=s[a],u=Object.keys(l);n[a]=[u[0],l[u[0]]]}return n}return Qd=new t(\"tag:yaml.org,2002:pairs\",{kind:\"sequence\",resolve:r,construct:i}),Qd}var Zd,S_;function U_(){if(S_)return Zd;S_=1;let t=or(),e=Object.prototype.hasOwnProperty;function r(o){if(o===null)return!0;let s=o;for(let n in s)if(e.call(s,n)&&s[n]!==null)return!1;return!0}function i(o){return o!==null?o:{}}return Zd=new t(\"tag:yaml.org,2002:set\",{kind:\"mapping\",resolve:r,construct:i}),Zd}var eh,O_;function rh(){return O_||(O_=1,eh=k_().extend({implicit:[D_(),q_()],explicit:[V_(),L_(),B_(),U_()]})),eh}var w_;function y4(){if(w_)return cp;w_=1;let t=tl(),e=rl(),r=x4(),i=rh(),o=Object.prototype.hasOwnProperty,s=1,n=2,a=3,p=4,l=1,u=2,f=3,m=/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x84\\x86-\\x9F\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/,x=/[\\x85\\u2028\\u2029]/,h=/[,\\[\\]{}]/,O=/^(?:!|!!|![0-9A-Za-z-]+!)$/,j=/^(?:!|[^,\\[\\]{}])(?:%[0-9a-f]{2}|[0-9a-z\\-#;/?:@&=+$,_.!~*'()\\[\\]])*$/i;function v(c){return Object.prototype.toString.call(c)}function E(c){return c===10||c===13}function y(c){return c===9||c===32}function g(c){return c===9||c===32||c===10||c===13}function q(c){return c===44||c===91||c===93||c===123||c===125}function V(c){if(c>=48&&c<=57)return c-48;let R=c|32;return R>=97&&R<=102?R-97+10:-1}function C(c){return c===120?2:c===117?4:c===85?8:0}function oe(c){return c>=48&&c<=57?c-48:-1}function M(c){switch(c){case 48:return\"\\0\";case 97:return\"\\x07\";case 98:return\"\\b\";case 116:return\"\t\";case 9:return\"\t\";case 110:return`\n`;case 118:return\"\\v\";case 102:return\"\\f\";case 114:return\"\\r\";case 101:return\"\\x1B\";case 32:return\" \";case 34:return'\"';case 47:return\"/\";case 92:return\"\\\\\";case 78:return\"\\x85\";case 95:return\"\\xA0\";case 76:return\"\\u2028\";case 80:return\"\\u2029\";default:return\"\"}}function te(c){return c<=65535?String.fromCharCode(c):String.fromCharCode((c-65536>>10)+55296,(c-65536&1023)+56320)}function H(c,R,L){R===\"__proto__\"?Object.defineProperty(c,R,{configurable:!0,enumerable:!0,writable:!0,value:L}):c[R]=L}let k=new Array(256),W=new Array(256);for(let c=0;c<256;c++)k[c]=M(c)?1:0,W[c]=M(c);function Z(c,R){this.input=c,this.filename=R.filename||null,this.schema=R.schema||i,this.onWarning=R.onWarning||null,this.legacy=R.legacy||!1,this.json=R.json||!1,this.listener=R.listener||null,this.maxDepth=typeof R.maxDepth==\"number\"?R.maxDepth:100,this.maxTotalMergeKeys=typeof R.maxTotalMergeKeys==\"number\"?R.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=c.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function pe(c,R){let L={name:c.filename,buffer:c.input.slice(0,-1),position:c.position,line:c.line,column:c.position-c.lineStart};return L.snippet=r(L),new e(R,L)}function re(c,R){throw pe(c,R)}function Qe(c,R){c.onWarning&&c.onWarning.call(null,pe(c,R))}function $t(c,R,L){let U=c.anchorMapTransactions;if(U.length!==0){let N=U[U.length-1];o.call(N,R)||(N[R]={existed:o.call(c.anchorMap,R),value:c.anchorMap[R]})}c.anchorMap[R]=L}function Ea(c){c.anchorMapTransactions.push(Object.create(null))}function Nt(c){let R=c.anchorMapTransactions.pop(),L=c.anchorMapTransactions;if(L.length===0)return;let U=L[L.length-1],N=Object.keys(R);for(let d=0,T=N.length;d<T;d+=1){let F=N[d];o.call(U,F)||(U[F]=R[F])}}function Km(c){let R=c.anchorMapTransactions.pop(),L=Object.keys(R);for(let U=L.length-1;U>=0;U-=1){let N=R[L[U]];N.existed?c.anchorMap[L[U]]=N.value:delete c.anchorMap[L[U]]}}function kc(c){return{position:c.position,line:c.line,lineStart:c.lineStart,lineIndent:c.lineIndent,firstTabInLine:c.firstTabInLine,tag:c.tag,anchor:c.anchor,kind:c.kind,result:c.result}}function ba(c,R){c.position=R.position,c.line=R.line,c.lineStart=R.lineStart,c.lineIndent=R.lineIndent,c.firstTabInLine=R.firstTabInLine,c.tag=R.tag,c.anchor=R.anchor,c.kind=R.kind,c.result=R.result}let $u={YAML:function(R,L,U){R.version!==null&&re(R,\"duplication of %YAML directive\"),U.length!==1&&re(R,\"YAML directive accepts exactly one argument\");let N=/^([0-9]+)\\.([0-9]+)$/.exec(U[0]);N===null&&re(R,\"ill-formed argument of the YAML directive\");let d=parseInt(N[1],10),T=parseInt(N[2],10);d!==1&&re(R,\"unacceptable YAML version of the document\"),R.version=U[0],R.checkLineBreaks=T<2,T!==1&&T!==2&&Qe(R,\"unsupported YAML version of the document\")},TAG:function(R,L,U){let N;U.length!==2&&re(R,\"TAG directive accepts exactly two arguments\");let d=U[0];N=U[1],O.test(d)||re(R,\"ill-formed tag handle (first argument) of the TAG directive\"),o.call(R.tagMap,d)&&re(R,'there is a previously declared suffix for \"'+d+'\" tag handle'),j.test(N)||re(R,\"ill-formed tag prefix (second argument) of the TAG directive\");try{N=decodeURIComponent(N)}catch{re(R,\"tag prefix is malformed: \"+N)}R.tagMap[d]=N}};function Ar(c,R,L,U){if(R<L){let N=c.input.slice(R,L);if(U)for(let d=0,T=N.length;d<T;d+=1){let F=N.charCodeAt(d);F===9||F>=32&&F<=1114111||re(c,\"expected valid JSON character\")}else m.test(N)&&re(c,\"the stream contains non-printable characters\");c.result+=N}}function Vs(c){c.totalMergeKeys++,c.maxTotalMergeKeys!==-1&&c.totalMergeKeys>c.maxTotalMergeKeys&&re(c,\"merge keys exceeded maxTotalMergeKeys (\"+c.maxTotalMergeKeys+\")\")}function Dc(c,R,L,U){t.isObject(L)||re(c,\"cannot merge mappings; the provided source object is unacceptable\"),Vs(c);let N=Object.keys(L);for(let d=0,T=N.length;d<T;d+=1){let F=N[d];Vs(c),o.call(R,F)||(H(R,F,L[F]),U[F]=!0)}}function No(c,R,L,U,N,d,T,F,K){if(Array.isArray(N)){N=Array.prototype.slice.call(N);for(let G=0,Y=N.length;G<Y;G+=1)Array.isArray(N[G])&&re(c,\"nested arrays are not supported inside keys\"),typeof N==\"object\"&&v(N[G])===\"[object Object]\"&&(N[G]=\"[object Object]\")}if(typeof N==\"object\"&&v(N)===\"[object Object]\"&&(N=\"[object Object]\"),N=String(N),R===null&&(R={}),U===\"tag:yaml.org,2002:merge\")if(Array.isArray(d)){d.length>100&&re(c,\"abnormal merge sequence size\");for(let G=0,Y=d.length;G<Y;G+=1)Dc(c,R,d[G],L)}else Dc(c,R,d,L);else!c.json&&!o.call(L,N)&&o.call(R,N)&&(c.line=T||c.line,c.lineStart=F||c.lineStart,c.position=K||c.position,re(c,\"duplicated mapping key\")),H(R,N,d),delete L[N];return R}function qc(c){let R=c.input.charCodeAt(c.position);R===10?c.position++:R===13?(c.position++,c.input.charCodeAt(c.position)===10&&c.position++):re(c,\"a line break is expected\"),c.line+=1,c.lineStart=c.position,c.firstTabInLine=-1}function tt(c,R,L){let U=0,N=c.input.charCodeAt(c.position);for(;N!==0;){for(;y(N);)N===9&&c.firstTabInLine===-1&&(c.firstTabInLine=c.position),N=c.input.charCodeAt(++c.position);if(R&&N===35)do N=c.input.charCodeAt(++c.position);while(N!==10&&N!==13&&N!==0);if(E(N))for(qc(c),N=c.input.charCodeAt(c.position),U++,c.lineIndent=0;N===32;)c.lineIndent++,N=c.input.charCodeAt(++c.position);else break}return L!==-1&&U!==0&&c.lineIndent<L&&Qe(c,\"deficient indentation\"),U}function go(c){let R=c.position,L=c.input.charCodeAt(R);return!!((L===45||L===46)&&L===c.input.charCodeAt(R+1)&&L===c.input.charCodeAt(R+2)&&(R+=3,L=c.input.charCodeAt(R),L===0||g(L)))}function Sa(c,R){R===1?c.result+=\" \":R>1&&(c.result+=t.repeat(`\n`,R-1))}function Nu(c,R,L){let U,N,d,T,F,K,G=c.kind,Y=c.result,D=c.input.charCodeAt(c.position);if(g(D)||q(D)||D===35||D===38||D===42||D===33||D===124||D===62||D===39||D===34||D===37||D===64||D===96)return!1;if(D===63||D===45){let ee=c.input.charCodeAt(c.position+1);if(g(ee)||L&&q(ee))return!1}for(c.kind=\"scalar\",c.result=\"\",U=N=c.position,d=!1;D!==0;){if(D===58){let ee=c.input.charCodeAt(c.position+1);if(g(ee)||L&&q(ee))break}else if(D===35){let ee=c.input.charCodeAt(c.position-1);if(g(ee))break}else{if(c.position===c.lineStart&&go(c)||L&&q(D))break;if(E(D))if(T=c.line,F=c.lineStart,K=c.lineIndent,tt(c,!1,-1),c.lineIndent>=R){d=!0,D=c.input.charCodeAt(c.position);continue}else{c.position=N,c.line=T,c.lineStart=F,c.lineIndent=K;break}}d&&(Ar(c,U,N,!1),Sa(c,c.line-T),U=N=c.position,d=!1),y(D)||(N=c.position+1),D=c.input.charCodeAt(++c.position)}return Ar(c,U,N,!1),c.result?!0:(c.kind=G,c.result=Y,!1)}function Vc(c,R){let L,U,N=c.input.charCodeAt(c.position);if(N!==39)return!1;for(c.kind=\"scalar\",c.result=\"\",c.position++,L=U=c.position;(N=c.input.charCodeAt(c.position))!==0;)if(N===39)if(Ar(c,L,c.position,!0),N=c.input.charCodeAt(++c.position),N===39)L=c.position,c.position++,U=c.position;else return!0;else E(N)?(Ar(c,L,U,!0),Sa(c,tt(c,!1,R)),L=U=c.position):c.position===c.lineStart&&go(c)?re(c,\"unexpected end of the document within a single quoted scalar\"):(c.position++,y(N)||(U=c.position));re(c,\"unexpected end of the stream within a single quoted scalar\")}function ku(c,R){let L,U,N,d=c.input.charCodeAt(c.position);if(d!==34)return!1;for(c.kind=\"scalar\",c.result=\"\",c.position++,L=U=c.position;(d=c.input.charCodeAt(c.position))!==0;){if(d===34)return Ar(c,L,c.position,!0),c.position++,!0;if(d===92){if(Ar(c,L,c.position,!0),d=c.input.charCodeAt(++c.position),E(d))tt(c,!1,R);else if(d<256&&k[d])c.result+=W[d],c.position++;else if((N=C(d))>0){let T=N,F=0;for(;T>0;T--)d=c.input.charCodeAt(++c.position),(N=V(d))>=0?F=(F<<4)+N:re(c,\"expected hexadecimal character\");c.result+=te(F),c.position++}else re(c,\"unknown escape sequence\");L=U=c.position}else E(d)?(Ar(c,L,U,!0),Sa(c,tt(c,!1,R)),L=U=c.position):c.position===c.lineStart&&go(c)?re(c,\"unexpected end of the document within a double quoted scalar\"):(c.position++,y(d)||(U=c.position))}re(c,\"unexpected end of the stream within a double quoted scalar\")}function Du(c,R){let L=!0,U,N,d,T=c.tag,F,K=c.anchor,G,Y,D,ee,fe=Object.create(null),xe,ye,Oe,je=c.input.charCodeAt(c.position);if(je===91)G=93,ee=!1,F=[];else if(je===123)G=125,ee=!0,F={};else return!1;for(c.anchor!==null&&$t(c,c.anchor,F),je=c.input.charCodeAt(++c.position);je!==0;){if(tt(c,!0,R),je=c.input.charCodeAt(c.position),je===G)return c.position++,c.tag=T,c.anchor=K,c.kind=ee?\"mapping\":\"sequence\",c.result=F,!0;if(L?je===44&&re(c,\"expected the node content, but found ','\"):re(c,\"missed comma between flow collection entries\"),ye=xe=Oe=null,Y=D=!1,je===63){let Us=c.input.charCodeAt(c.position+1);g(Us)&&(Y=D=!0,c.position++,tt(c,!0,R))}U=c.line,N=c.lineStart,d=c.position,Bs(c,R,s,!1,!0),ye=c.tag,xe=c.result,tt(c,!0,R),je=c.input.charCodeAt(c.position),(D||c.line===U)&&je===58&&(Y=!0,je=c.input.charCodeAt(++c.position),tt(c,!0,R),Bs(c,R,s,!1,!0),Oe=c.result),ee?No(c,F,fe,ye,xe,Oe,U,N,d):Y?F.push(No(c,null,fe,ye,xe,Oe,U,N,d)):F.push(xe),tt(c,!0,R),je=c.input.charCodeAt(c.position),je===44?(L=!0,je=c.input.charCodeAt(++c.position)):L=!1}re(c,\"unexpected end of the stream within a flow collection\")}function Ls(c,R){let L,U=l,N=!1,d=!1,T=R,F=0,K=!1,G,Y=c.input.charCodeAt(c.position);if(Y===124)L=!1;else if(Y===62)L=!0;else return!1;for(c.kind=\"scalar\",c.result=\"\";Y!==0;)if(Y=c.input.charCodeAt(++c.position),Y===43||Y===45)l===U?U=Y===43?f:u:re(c,\"repeat of a chomping mode identifier\");else if((G=oe(Y))>=0)G===0?re(c,\"bad explicit indentation width of a block scalar; it cannot be less than one\"):d?re(c,\"repeat of an indentation width identifier\"):(T=R+G-1,d=!0);else break;if(y(Y)){do Y=c.input.charCodeAt(++c.position);while(y(Y));if(Y===35)do Y=c.input.charCodeAt(++c.position);while(!E(Y)&&Y!==0)}for(;Y!==0;){for(qc(c),c.lineIndent=0,Y=c.input.charCodeAt(c.position);(!d||c.lineIndent<T)&&Y===32;)c.lineIndent++,Y=c.input.charCodeAt(++c.position);if(!d&&c.lineIndent>T&&(T=c.lineIndent),E(Y)){F++;continue}if(!d&&T===0&&re(c,\"missing indentation for block scalar\"),c.lineIndent<T){U===f?c.result+=t.repeat(`\n`,N?1+F:F):U===l&&N&&(c.result+=`\n`);break}L?y(Y)?(K=!0,c.result+=t.repeat(`\n`,N?1+F:F)):K?(K=!1,c.result+=t.repeat(`\n`,F+1)):F===0?N&&(c.result+=\" \"):c.result+=t.repeat(`\n`,F):c.result+=t.repeat(`\n`,N?1+F:F),N=!0,d=!0,F=0;let D=c.position;for(;!E(Y)&&Y!==0;)Y=c.input.charCodeAt(++c.position);Ar(c,D,c.position,!1)}return!0}function qu(c,R){let L=c.tag,U=c.anchor,N=[],d=!1;if(c.firstTabInLine!==-1)return!1;c.anchor!==null&&$t(c,c.anchor,N);let T=c.input.charCodeAt(c.position);for(;T!==0&&(c.firstTabInLine!==-1&&(c.position=c.firstTabInLine,re(c,\"tab characters must not be used in indentation\")),T===45);){let F=c.input.charCodeAt(c.position+1);if(!g(F))break;if(d=!0,c.position++,tt(c,!0,-1)&&c.lineIndent<=R){N.push(null),T=c.input.charCodeAt(c.position);continue}let K=c.line;if(Bs(c,R,a,!1,!0),N.push(c.result),tt(c,!0,-1),T=c.input.charCodeAt(c.position),(c.line===K||c.lineIndent>R)&&T!==0)re(c,\"bad indentation of a sequence entry\");else if(c.lineIndent<R)break}return d?(c.tag=L,c.anchor=U,c.kind=\"sequence\",c.result=N,!0):!1}function Vu(c,R,L){let U,N,d,T,F=c.tag,K=c.anchor,G={},Y=Object.create(null),D=null,ee=null,fe=null,xe=!1,ye=!1;if(c.firstTabInLine!==-1)return!1;c.anchor!==null&&$t(c,c.anchor,G);let Oe=c.input.charCodeAt(c.position);for(;Oe!==0;){!xe&&c.firstTabInLine!==-1&&(c.position=c.firstTabInLine,re(c,\"tab characters must not be used in indentation\"));let je=c.input.charCodeAt(c.position+1),Us=c.line;if((Oe===63||Oe===58)&&g(je))Oe===63?(xe&&(No(c,G,Y,D,ee,null,N,d,T),D=ee=fe=null),ye=!0,xe=!0,U=!0):xe?(xe=!1,U=!0):re(c,\"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line\"),c.position+=1,Oe=je;else{if(N=c.line,d=c.lineStart,T=c.position,!Bs(c,L,n,!1,!0))break;if(c.line===Us){for(Oe=c.input.charCodeAt(c.position);y(Oe);)Oe=c.input.charCodeAt(++c.position);if(Oe===58)Oe=c.input.charCodeAt(++c.position),g(Oe)||re(c,\"a whitespace character is expected after the key-value separator within a block mapping\"),xe&&(No(c,G,Y,D,ee,null,N,d,T),D=ee=fe=null),ye=!0,xe=!1,U=!1,D=c.tag,ee=c.result;else if(ye)re(c,\"can not read an implicit mapping pair; a colon is missed\");else return c.tag=F,c.anchor=K,!0}else if(ye)re(c,\"can not read a block mapping entry; a multiline key may not be an implicit key\");else return c.tag=F,c.anchor=K,!0}if((c.line===Us||c.lineIndent>R)&&(xe&&(N=c.line,d=c.lineStart,T=c.position),Bs(c,R,p,!0,U)&&(xe?ee=c.result:fe=c.result),xe||(No(c,G,Y,D,ee,fe,N,d,T),D=ee=fe=null),tt(c,!0,-1),Oe=c.input.charCodeAt(c.position)),(c.line===Us||c.lineIndent>R)&&Oe!==0)re(c,\"bad indentation of a mapping entry\");else if(c.lineIndent<R)break}return xe&&No(c,G,Y,D,ee,null,N,d,T),ye&&(c.tag=F,c.anchor=K,c.kind=\"mapping\",c.result=G),ye}function Lu(c){let R=!1,L=!1,U,N,d=c.input.charCodeAt(c.position);if(d!==33)return!1;c.tag!==null&&re(c,\"duplication of a tag property\"),d=c.input.charCodeAt(++c.position),d===60?(R=!0,d=c.input.charCodeAt(++c.position)):d===33?(L=!0,U=\"!!\",d=c.input.charCodeAt(++c.position)):U=\"!\";let T=c.position;if(R){do d=c.input.charCodeAt(++c.position);while(d!==0&&d!==62);c.position<c.length?(N=c.input.slice(T,c.position),d=c.input.charCodeAt(++c.position)):re(c,\"unexpected end of the stream within a verbatim tag\")}else{for(;d!==0&&!g(d);)d===33&&(L?re(c,\"tag suffix cannot contain exclamation marks\"):(U=c.input.slice(T-1,c.position+1),O.test(U)||re(c,\"named tag handle cannot contain such characters\"),L=!0,T=c.position+1)),d=c.input.charCodeAt(++c.position);N=c.input.slice(T,c.position),h.test(N)&&re(c,\"tag suffix cannot contain flow indicator characters\")}N&&!j.test(N)&&re(c,\"tag name cannot contain such characters: \"+N);try{N=decodeURIComponent(N)}catch{re(c,\"tag name is malformed: \"+N)}return R?c.tag=N:o.call(c.tagMap,U)?c.tag=c.tagMap[U]+N:U===\"!\"?c.tag=\"!\"+N:U===\"!!\"?c.tag=\"tag:yaml.org,2002:\"+N:re(c,'undeclared tag handle \"'+U+'\"'),!0}function Bu(c){let R=c.input.charCodeAt(c.position);if(R!==38)return!1;c.anchor!==null&&re(c,\"duplication of an anchor property\"),R=c.input.charCodeAt(++c.position);let L=c.position;for(;R!==0&&!g(R)&&!q(R);)R=c.input.charCodeAt(++c.position);return c.position===L&&re(c,\"name of an anchor node must contain at least one character\"),c.anchor=c.input.slice(L,c.position),!0}function Wm(c){let R=c.input.charCodeAt(c.position);if(R!==42)return!1;R=c.input.charCodeAt(++c.position);let L=c.position;for(;R!==0&&!g(R)&&!q(R);)R=c.input.charCodeAt(++c.position);c.position===L&&re(c,\"name of an alias node must contain at least one character\");let U=c.input.slice(L,c.position);return o.call(c.anchorMap,U)||re(c,'unidentified alias \"'+U+'\"'),c.result=c.anchorMap[U],tt(c,!0,-1),!0}function Uu(c,R,L,U){let N=kc(c);return Ea(c),ba(c,R),c.tag=null,c.anchor=null,c.kind=null,c.result=null,Vu(c,L,U)&&c.kind===\"mapping\"?(Nt(c),!0):(Km(c),ba(c,N),!1)}function Bs(c,R,L,U,N){let d,T,F=1,K=!1,G=!1,Y=null,D,ee,fe;c.depth>=c.maxDepth&&re(c,\"nesting exceeded maxDepth (\"+c.maxDepth+\")\"),c.depth+=1,c.listener!==null&&c.listener(\"open\",c),c.tag=null,c.anchor=null,c.kind=null,c.result=null;let xe=d=T=p===L||a===L;if(U&&tt(c,!0,-1)&&(K=!0,c.lineIndent>R?F=1:c.lineIndent===R?F=0:c.lineIndent<R&&(F=-1)),F===1)for(;;){let ye=c.input.charCodeAt(c.position),Oe=kc(c);if(K&&(ye===33&&c.tag!==null||ye===38&&c.anchor!==null)||!Lu(c)&&!Bu(c))break;Y===null&&(Y=Oe),tt(c,!0,-1)?(K=!0,T=xe,c.lineIndent>R?F=1:c.lineIndent===R?F=0:c.lineIndent<R&&(F=-1)):T=!1}if(T&&(T=K||N),F===1||p===L)if(s===L||n===L?ee=R:ee=R+1,fe=c.position-c.lineStart,F===1)if(T&&(qu(c,fe)||Vu(c,fe,ee))||Du(c,ee))G=!0;else{let ye=c.input.charCodeAt(c.position);Y!==null&&xe&&!T&&ye!==124&&ye!==62&&Uu(c,Y,Y.position-Y.lineStart,ee)||d&&Ls(c,ee)||Vc(c,ee)||ku(c,ee)?G=!0:Wm(c)?(G=!0,(c.tag!==null||c.anchor!==null)&&re(c,\"alias node should not have any properties\")):Nu(c,ee,s===L)&&(G=!0,c.tag===null&&(c.tag=\"?\")),c.anchor!==null&&$t(c,c.anchor,c.result)}else F===0&&(G=T&&qu(c,fe));if(c.tag===null)c.anchor!==null&&$t(c,c.anchor,c.result);else if(c.tag===\"?\"){c.result!==null&&c.kind!==\"scalar\"&&re(c,'unacceptable node kind for !<?> tag; it should be \"scalar\", not \"'+c.kind+'\"');for(let ye=0,Oe=c.implicitTypes.length;ye<Oe;ye+=1)if(D=c.implicitTypes[ye],D.resolve(c.result)){c.result=D.construct(c.result),c.tag=D.tag,c.anchor!==null&&$t(c,c.anchor,c.result);break}}else if(c.tag!==\"!\"){if(o.call(c.typeMap[c.kind||\"fallback\"],c.tag))D=c.typeMap[c.kind||\"fallback\"][c.tag];else{D=null;let ye=c.typeMap.multi[c.kind||\"fallback\"];for(let Oe=0,je=ye.length;Oe<je;Oe+=1)if(c.tag.slice(0,ye[Oe].tag.length)===ye[Oe].tag){D=ye[Oe];break}}D||re(c,\"unknown tag !<\"+c.tag+\">\"),c.result!==null&&D.kind!==c.kind&&re(c,\"unacceptable node kind for !<\"+c.tag+'> tag; it should be \"'+D.kind+'\", not \"'+c.kind+'\"'),D.resolve(c.result,c.tag)?(c.result=D.construct(c.result,c.tag),c.anchor!==null&&$t(c,c.anchor,c.result)):re(c,\"cannot resolve a node with !<\"+c.tag+\"> explicit tag\")}return c.listener!==null&&c.listener(\"close\",c),c.depth-=1,c.tag!==null||c.anchor!==null||G}function Gm(c){let R=c.position,L=!1,U;for(c.version=null,c.checkLineBreaks=c.legacy,c.tagMap=Object.create(null),c.anchorMap=Object.create(null);(U=c.input.charCodeAt(c.position))!==0&&(tt(c,!0,-1),U=c.input.charCodeAt(c.position),!(c.lineIndent>0||U!==37));){L=!0,U=c.input.charCodeAt(++c.position);let N=c.position;for(;U!==0&&!g(U);)U=c.input.charCodeAt(++c.position);let d=c.input.slice(N,c.position),T=[];for(d.length<1&&re(c,\"directive name must not be less than one character in length\");U!==0;){for(;y(U);)U=c.input.charCodeAt(++c.position);if(U===35){do U=c.input.charCodeAt(++c.position);while(U!==0&&!E(U));break}if(E(U))break;for(N=c.position;U!==0&&!g(U);)U=c.input.charCodeAt(++c.position);T.push(c.input.slice(N,c.position))}U!==0&&qc(c),o.call($u,d)?$u[d](c,d,T):Qe(c,'unknown document directive \"'+d+'\"')}if(tt(c,!0,-1),c.lineIndent===0&&c.input.charCodeAt(c.position)===45&&c.input.charCodeAt(c.position+1)===45&&c.input.charCodeAt(c.position+2)===45?(c.position+=3,tt(c,!0,-1)):L&&re(c,\"directives end mark is expected\"),Bs(c,c.lineIndent-1,p,!1,!0),tt(c,!0,-1),c.checkLineBreaks&&x.test(c.input.slice(R,c.position))&&Qe(c,\"non-ASCII line breaks are interpreted as content\"),c.documents.push(c.result),c.position===c.lineStart&&go(c)){c.input.charCodeAt(c.position)===46&&(c.position+=3,tt(c,!0,-1));return}c.position<c.length-1&&re(c,\"end of the stream or a document separator is expected\")}function Lc(c,R){c=String(c),R=R||{},c.length!==0&&(c.charCodeAt(c.length-1)!==10&&c.charCodeAt(c.length-1)!==13&&(c+=`\n`),c.charCodeAt(0)===65279&&(c=c.slice(1)));let L=new Z(c,R),U=c.indexOf(\"\\0\");for(U!==-1&&(L.position=U,re(L,\"null byte is not allowed in input\")),L.input+=\"\\0\";L.input.charCodeAt(L.position)===32;)L.lineIndent+=1,L.position+=1;for(;L.position<L.length-1;)Gm(L);return L.documents}function Ym(c,R,L){R!==null&&typeof R==\"object\"&&typeof L>\"u\"&&(L=R,R=null);let U=Lc(c,L);if(typeof R!=\"function\")return U;for(let N=0,d=U.length;N<d;N+=1)R(U[N])}function Xm(c,R){let L=Lc(c,R);if(L.length!==0){if(L.length===1)return L[0];throw new e(\"expected a single document in the stream, but found more\")}}return cp.loadAll=Ym,cp.load=Xm,cp}var th={},j_;function g4(){if(j_)return th;j_=1;let t=tl(),e=rl(),r=rh(),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty,s=65279,n=9,a=10,p=13,l=32,u=33,f=34,m=35,x=37,h=38,O=39,j=42,v=44,E=45,y=58,g=61,q=62,V=63,C=64,oe=91,M=93,te=96,H=123,k=124,W=125,Z={};Z[0]=\"\\\\0\",Z[7]=\"\\\\a\",Z[8]=\"\\\\b\",Z[9]=\"\\\\t\",Z[10]=\"\\\\n\",Z[11]=\"\\\\v\",Z[12]=\"\\\\f\",Z[13]=\"\\\\r\",Z[27]=\"\\\\e\",Z[34]='\\\\\"',Z[92]=\"\\\\\\\\\",Z[133]=\"\\\\N\",Z[160]=\"\\\\_\",Z[8232]=\"\\\\L\",Z[8233]=\"\\\\P\";let pe=[\"y\",\"Y\",\"yes\",\"Yes\",\"YES\",\"on\",\"On\",\"ON\",\"n\",\"N\",\"no\",\"No\",\"NO\",\"off\",\"Off\",\"OFF\"],re=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\\.[0-9_]*)?$/;function Qe(d,T){if(T===null)return{};let F={},K=Object.keys(T);for(let G=0,Y=K.length;G<Y;G+=1){let D=K[G],ee=String(T[D]);D.slice(0,2)===\"!!\"&&(D=\"tag:yaml.org,2002:\"+D.slice(2));let fe=d.compiledTypeMap.fallback[D];fe&&o.call(fe.styleAliases,ee)&&(ee=fe.styleAliases[ee]),F[D]=ee}return F}function $t(d){let T,F,K=d.toString(16).toUpperCase();if(d<=255)T=\"x\",F=2;else if(d<=65535)T=\"u\",F=4;else if(d<=4294967295)T=\"U\",F=8;else throw new e(\"code point within a string may not be greater than 0xFFFFFFFF\");return\"\\\\\"+T+t.repeat(\"0\",F-K.length)+K}let Ea=1,Nt=2;function Km(d){this.schema=d.schema||r,this.indent=Math.max(1,d.indent||2),this.noArrayIndent=d.noArrayIndent||!1,this.skipInvalid=d.skipInvalid||!1,this.flowLevel=t.isNothing(d.flowLevel)?-1:d.flowLevel,this.styleMap=Qe(this.schema,d.styles||null),this.sortKeys=d.sortKeys||!1,this.lineWidth=d.lineWidth||80,this.noRefs=d.noRefs||!1,this.noCompatMode=d.noCompatMode||!1,this.condenseFlow=d.condenseFlow||!1,this.quotingType=d.quotingType==='\"'?Nt:Ea,this.forceQuotes=d.forceQuotes||!1,this.replacer=typeof d.replacer==\"function\"?d.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result=\"\",this.duplicates=[],this.usedDuplicates=null}function kc(d,T){let F=t.repeat(\" \",T),K=0,G=\"\",Y=d.length;for(;K<Y;){let D,ee=d.indexOf(`\n`,K);ee===-1?(D=d.slice(K),K=Y):(D=d.slice(K,ee+1),K=ee+1),D.length&&D!==`\n`&&(G+=F),G+=D}return G}function ba(d,T){return`\n`+t.repeat(\" \",d.indent*T)}function $u(d,T){for(let F=0,K=d.implicitTypes.length;F<K;F+=1)if(d.implicitTypes[F].resolve(T))return!0;return!1}function Ar(d){return d===l||d===n}function Vs(d){return d>=32&&d<=126||d>=161&&d<=55295&&d!==8232&&d!==8233||d>=57344&&d<=65533&&d!==s||d>=65536&&d<=1114111}function Dc(d){return Vs(d)&&d!==s&&d!==p&&d!==a}function No(d,T,F){let K=Dc(d),G=K&&!Ar(d);return(F?K:K&&d!==v&&d!==oe&&d!==M&&d!==H&&d!==W)&&d!==m&&!(T===y&&!G)||Dc(T)&&!Ar(T)&&d===m||T===y&&G}function qc(d){return Vs(d)&&d!==s&&!Ar(d)&&d!==E&&d!==V&&d!==y&&d!==v&&d!==oe&&d!==M&&d!==H&&d!==W&&d!==m&&d!==h&&d!==j&&d!==u&&d!==k&&d!==g&&d!==q&&d!==O&&d!==f&&d!==x&&d!==C&&d!==te}function tt(d){return!Ar(d)&&d!==y}function go(d,T){let F=d.charCodeAt(T),K;return F>=55296&&F<=56319&&T+1<d.length&&(K=d.charCodeAt(T+1),K>=56320&&K<=57343)?(F-55296)*1024+K-56320+65536:F}function Sa(d){return/^\\n* /.test(d)}let Nu=1,Vc=2,ku=3,Du=4,Ls=5;function qu(d,T,F,K,G,Y,D,ee){let fe,xe=0,ye=null,Oe=!1,je=!1,Us=K!==-1,Bc=-1,Uc=qc(go(d,0))&&tt(go(d,d.length-1));if(T||D)for(fe=0;fe<d.length;xe>=65536?fe+=2:fe++){if(xe=go(d,fe),!Vs(xe))return Ls;Uc=Uc&&No(xe,ye,ee),ye=xe}else{for(fe=0;fe<d.length;xe>=65536?fe+=2:fe++){if(xe=go(d,fe),xe===a)Oe=!0,Us&&(je=je||fe-Bc-1>K&&d[Bc+1]!==\" \",Bc=fe);else if(!Vs(xe))return Ls;Uc=Uc&&No(xe,ye,ee),ye=xe}je=je||Us&&fe-Bc-1>K&&d[Bc+1]!==\" \"}return!Oe&&!je?Uc&&!D&&!G(d)?Nu:Y===Nt?Ls:Vc:F>9&&Sa(d)?Ls:D?Y===Nt?Ls:Vc:je?Du:ku}function Vu(d,T,F,K,G){d.dump=(function(){if(T.length===0)return d.quotingType===Nt?'\"\"':\"''\";if(!d.noCompatMode&&(pe.indexOf(T)!==-1||re.test(T)))return d.quotingType===Nt?'\"'+T+'\"':\"'\"+T+\"'\";let Y=d.indent*Math.max(1,F),D=d.lineWidth===-1?-1:Math.max(Math.min(d.lineWidth,40),d.lineWidth-Y),ee=K||d.flowLevel>-1&&F>=d.flowLevel;function fe(xe){return $u(d,xe)}switch(qu(T,ee,d.indent,D,fe,d.quotingType,d.forceQuotes&&!K,G)){case Nu:return T;case Vc:return\"'\"+T.replace(/'/g,\"''\")+\"'\";case ku:return\"|\"+Lu(T,d.indent)+Bu(kc(T,Y));case Du:return\">\"+Lu(T,d.indent)+Bu(kc(Wm(T,D),Y));case Ls:return'\"'+Bs(T)+'\"';default:throw new e(\"impossible error: invalid scalar style\")}})()}function Lu(d,T){let F=Sa(d)?String(T):\"\",K=d[d.length-1]===`\n`,Y=K&&(d[d.length-2]===`\n`||d===`\n`)?\"+\":K?\"\":\"-\";return F+Y+`\n`}function Bu(d){return d[d.length-1]===`\n`?d.slice(0,-1):d}function Wm(d,T){let F=/(\\n+)([^\\n]*)/g,K=(function(){let ee=d.indexOf(`\n`);return ee=ee!==-1?ee:d.length,F.lastIndex=ee,Uu(d.slice(0,ee),T)})(),G=d[0]===`\n`||d[0]===\" \",Y,D;for(;D=F.exec(d);){let ee=D[1],fe=D[2];Y=fe[0]===\" \",K+=ee+(!G&&!Y&&fe!==\"\"?`\n`:\"\")+Uu(fe,T),G=Y}return K}function Uu(d,T){if(d===\"\"||d[0]===\" \")return d;let F=/ [^ ]/g,K,G=0,Y,D=0,ee=0,fe=\"\";for(;K=F.exec(d);)ee=K.index,ee-G>T&&(Y=D>G?D:ee,fe+=`\n`+d.slice(G,Y),G=Y+1),D=ee;return fe+=`\n`,d.length-G>T&&D>G?fe+=d.slice(G,D)+`\n`+d.slice(D+1):fe+=d.slice(G),fe.slice(1)}function Bs(d){let T=\"\",F=0;for(let K=0;K<d.length;F>=65536?K+=2:K++){F=go(d,K);let G=Z[F];!G&&Vs(F)?(T+=d[K],F>=65536&&(T+=d[K+1])):T+=G||$t(F)}return T}function Gm(d,T,F){let K=\"\",G=d.tag;for(let Y=0,D=F.length;Y<D;Y+=1){let ee=F[Y];d.replacer&&(ee=d.replacer.call(F,String(Y),ee)),(R(d,T,ee,!1,!1)||typeof ee>\"u\"&&R(d,T,null,!1,!1))&&(K!==\"\"&&(K+=\",\"+(d.condenseFlow?\"\":\" \")),K+=d.dump)}d.tag=G,d.dump=\"[\"+K+\"]\"}function Lc(d,T,F,K){let G=\"\",Y=d.tag;for(let D=0,ee=F.length;D<ee;D+=1){let fe=F[D];d.replacer&&(fe=d.replacer.call(F,String(D),fe)),(R(d,T+1,fe,!0,!0,!1,!0)||typeof fe>\"u\"&&R(d,T+1,null,!0,!0,!1,!0))&&((!K||G!==\"\")&&(G+=ba(d,T)),d.dump&&a===d.dump.charCodeAt(0)?G+=\"-\":G+=\"- \",G+=d.dump)}d.tag=Y,d.dump=G||\"[]\"}function Ym(d,T,F){let K=\"\",G=d.tag,Y=Object.keys(F);for(let D=0,ee=Y.length;D<ee;D+=1){let fe=\"\";K!==\"\"&&(fe+=\", \"),d.condenseFlow&&(fe+='\"');let xe=Y[D],ye=F[xe];d.replacer&&(ye=d.replacer.call(F,xe,ye)),R(d,T,xe,!1,!1)&&(d.dump.length>1024&&(fe+=\"? \"),fe+=d.dump+(d.condenseFlow?'\"':\"\")+\":\"+(d.condenseFlow?\"\":\" \"),R(d,T,ye,!1,!1)&&(fe+=d.dump,K+=fe))}d.tag=G,d.dump=\"{\"+K+\"}\"}function Xm(d,T,F,K){let G=\"\",Y=d.tag,D=Object.keys(F);if(d.sortKeys===!0)D.sort();else if(typeof d.sortKeys==\"function\")D.sort(d.sortKeys);else if(d.sortKeys)throw new e(\"sortKeys must be a boolean or a function\");for(let ee=0,fe=D.length;ee<fe;ee+=1){let xe=\"\";(!K||G!==\"\")&&(xe+=ba(d,T));let ye=D[ee],Oe=F[ye];if(d.replacer&&(Oe=d.replacer.call(F,ye,Oe)),!R(d,T+1,ye,!0,!0,!0))continue;let je=d.tag!==null&&d.tag!==\"?\"||d.dump&&d.dump.length>1024;je&&(d.dump&&a===d.dump.charCodeAt(0)?xe+=\"?\":xe+=\"? \"),xe+=d.dump,je&&(xe+=ba(d,T)),R(d,T+1,Oe,!0,je)&&(d.dump&&a===d.dump.charCodeAt(0)?xe+=\":\":xe+=\": \",xe+=d.dump,G+=xe)}d.tag=Y,d.dump=G||\"{}\"}function c(d,T,F){let K=F?d.explicitTypes:d.implicitTypes;for(let G=0,Y=K.length;G<Y;G+=1){let D=K[G];if((D.instanceOf||D.predicate)&&(!D.instanceOf||typeof T==\"object\"&&T instanceof D.instanceOf)&&(!D.predicate||D.predicate(T))){if(F?D.multi&&D.representName?d.tag=D.representName(T):d.tag=D.tag:d.tag=\"?\",D.represent){let ee=d.styleMap[D.tag]||D.defaultStyle,fe;if(i.call(D.represent)===\"[object Function]\")fe=D.represent(T,ee);else if(o.call(D.represent,ee))fe=D.represent[ee](T,ee);else throw new e(\"!<\"+D.tag+'> tag resolver accepts not \"'+ee+'\" style');d.dump=fe}return!0}}return!1}function R(d,T,F,K,G,Y,D){d.tag=null,d.dump=F,c(d,F,!1)||c(d,F,!0);let ee=i.call(d.dump),fe=K;K&&(K=d.flowLevel<0||d.flowLevel>T);let xe=ee===\"[object Object]\"||ee===\"[object Array]\",ye,Oe;if(xe&&(ye=d.duplicates.indexOf(F),Oe=ye!==-1),(d.tag!==null&&d.tag!==\"?\"||Oe||d.indent!==2&&T>0)&&(G=!1),Oe&&d.usedDuplicates[ye])d.dump=\"*ref_\"+ye;else{if(xe&&Oe&&!d.usedDuplicates[ye]&&(d.usedDuplicates[ye]=!0),ee===\"[object Object]\")K&&Object.keys(d.dump).length!==0?(Xm(d,T,d.dump,G),Oe&&(d.dump=\"&ref_\"+ye+d.dump)):(Ym(d,T,d.dump),Oe&&(d.dump=\"&ref_\"+ye+\" \"+d.dump));else if(ee===\"[object Array]\")K&&d.dump.length!==0?(d.noArrayIndent&&!D&&T>0?Lc(d,T-1,d.dump,G):Lc(d,T,d.dump,G),Oe&&(d.dump=\"&ref_\"+ye+d.dump)):(Gm(d,T,d.dump),Oe&&(d.dump=\"&ref_\"+ye+\" \"+d.dump));else if(ee===\"[object String]\")d.tag!==\"?\"&&Vu(d,d.dump,T,Y,fe);else{if(ee===\"[object Undefined]\")return!1;if(d.skipInvalid)return!1;throw new e(\"unacceptable kind of an object to dump \"+ee)}if(d.tag!==null&&d.tag!==\"?\"){let je=encodeURI(d.tag[0]===\"!\"?d.tag.slice(1):d.tag).replace(/!/g,\"%21\");d.tag[0]===\"!\"?je=\"!\"+je:je.slice(0,18)===\"tag:yaml.org,2002:\"?je=\"!!\"+je.slice(18):je=\"!<\"+je+\">\",d.dump=je+\" \"+d.dump}}return!0}function L(d,T){let F=[],K=[];U(d,F,K);let G=K.length;for(let Y=0;Y<G;Y+=1)T.duplicates.push(F[K[Y]]);T.usedDuplicates=new Array(G)}function U(d,T,F){if(d!==null&&typeof d==\"object\"){let K=T.indexOf(d);if(K!==-1)F.indexOf(K)===-1&&F.push(K);else if(T.push(d),Array.isArray(d))for(let G=0,Y=d.length;G<Y;G+=1)U(d[G],T,F);else{let G=Object.keys(d);for(let Y=0,D=G.length;Y<D;Y+=1)U(d[G[Y]],T,F)}}}function N(d,T){T=T||{};let F=new Km(T);F.noRefs||L(d,F);let K=d;return F.replacer&&(K=F.replacer.call({\"\":K},\"\",K)),R(F,0,K,!0,!0)?F.dump+`\n`:\"\"}return th.dump=N,th}var P_;function v4(){if(P_)return Qt;P_=1;let t=y4(),e=g4();function r(i,o){return function(){throw new Error(\"Function yaml.\"+i+\" is removed in js-yaml 4. Use yaml.\"+o+\" instead, which is now safe by default.\")}}return Qt.Type=or(),Qt.Schema=A_(),Qt.FAILSAFE_SCHEMA=C_(),Qt.JSON_SCHEMA=N_(),Qt.CORE_SCHEMA=k_(),Qt.DEFAULT_SCHEMA=rh(),Qt.load=t.load,Qt.loadAll=t.loadAll,Qt.dump=e.dump,Qt.YAMLException=rl(),Qt.types={binary:V_(),float:$_(),map:I_(),null:T_(),pairs:B_(),set:U_(),timestamp:D_(),bool:M_(),int:F_(),merge:q_(),omap:L_(),seq:__(),str:R_()},Qt.safeLoad=r(\"safeLoad\",\"load\"),Qt.safeLoadAll=r(\"safeLoadAll\",\"loadAll\"),Qt.safeDump=r(\"safeDump\",\"dump\"),Qt}var E4=v4(),br=h4(E4),{Type:Ise,Schema:Cse,FAILSAFE_SCHEMA:Tse,JSON_SCHEMA:An,CORE_SCHEMA:Mse,DEFAULT_SCHEMA:Fse,load:$se,loadAll:Nse,dump:kse,YAMLException:Dse,types:qse,safeLoad:Vse,safeLoadAll:Lse,safeDump:Bse}=br;var b4=(t=\"\")=>/(json|xml|yaml|text)\\b/.test(t);function S4(t,e){if(e){if(e.indexOf(\"application/json\")===0||e.indexOf(\"+json\")>0)return JSON.parse(t);if(e.indexOf(\"application/xml\")===0||e.indexOf(\"+xml\")>0)return t}return br.load(t)}function O4(t){return(0,J_.default)(t).call(t,\", \")?t.split(\", \"):t}function ih(t={}){return typeof t.entries!=\"function\"?{}:Array.from(t.entries()).reduce((e,[r,i])=>(e[r]=O4(i),e),{})}function lp(t,e,{loadSpec:r=!1}={}){let i={ok:t.ok,url:t.url||e,status:t.status,statusText:t.statusText,headers:ih(t.headers)},o=i.headers[\"content-type\"],s=r||b4(o);return(s?t.text:t.blob||t.buffer).call(t).then(a=>{if(i.text=a,i.data=a,s)try{let p=S4(a,o);i.body=p,i.obj=p}catch(p){i.parseError=p}return i})}async function Zr(t,e={}){typeof t==\"object\"&&(e=t,t=e.url),e.headers=e.headers||{},e=Kc(e),e.headers&&Object.keys(e.headers).forEach(o=>{let s=e.headers[o];typeof s==\"string\"&&(e.headers[o]=s.replace(/\\n+/g,\" \"))}),e.requestInterceptor&&(e=await e.requestInterceptor(e)||e);let r=e.headers[\"content-type\"]||e.headers[\"Content-Type\"];/multipart\\/form-data/i.test(r)&&(delete e.headers[\"content-type\"],delete e.headers[\"Content-Type\"]);let i;try{i=await(e.userFetch||fetch)(e.url,e),i=await lp(i,t,e),e.responseInterceptor&&(i=await e.responseInterceptor(i)||i)}catch(o){if(!i)throw o;let s=new Error(i.statusText||`response status is ${i.status}`);throw s.status=i.status,s.statusCode=i.status,s.responseError=o,s}if(!i.ok){let o=new Error(i.statusText||`response status is ${i.status}`);throw o.status=i.status,o.statusCode=i.status,o.response=i,o}return i}function H_(t,e,r){return r=r||(i=>i),e=e||(i=>i),i=>(typeof i==\"string\"&&(i={url:i}),i=Kc(i),i=e(i),r(t(i)))}function up(t,e={}){let{requestInterceptor:r,responseInterceptor:i}=e,o=t.withCredentials?\"include\":\"same-origin\";return s=>t({url:s,loadSpec:!0,requestInterceptor:r,responseInterceptor:i,headers:{Accept:Ju},credentials:o}).then(n=>n.body)}var Ks=t=>{let{baseDoc:e,url:r}=t,i=e??r??\"\";return typeof globalThis.document?.baseURI==\"string\"?String(new URL(i,globalThis.document.baseURI)):i},pp=t=>{let{fetch:e,http:r}=t;return e||r||Zr};var oh={};vr(oh,{JsonPatchError:()=>rt,_areEquals:()=>sl,applyOperation:()=>Rn,applyPatch:()=>So,applyReducer:()=>R4,deepClone:()=>P4,getValueByPointer:()=>Ma,validate:()=>K_,validator:()=>yp});var w4=(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var s in o)o.hasOwnProperty(s)&&(i[s]=o[s])},t(e,r)};return function(e,r){t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}})(),j4=Object.prototype.hasOwnProperty;function dp(t,e){return j4.call(t,e)}function hp(t){if(Array.isArray(t)){for(var e=new Array(t.length),r=0;r<e.length;r++)e[r]=\"\"+r;return e}if(Object.keys)return Object.keys(t);var i=[];for(var o in t)dp(t,o)&&i.push(o);return i}function kt(t){switch(typeof t){case\"object\":return JSON.parse(JSON.stringify(t));case\"undefined\":return null;default:return t}}function xp(t){for(var e=0,r=t.length,i;e<r;){if(i=t.charCodeAt(e),i>=48&&i<=57){e++;continue}return!1}return!0}function bo(t){return t.indexOf(\"/\")===-1&&t.indexOf(\"~\")===-1?t:t.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}function il(t){return t.replace(/~1/g,\"/\").replace(/~0/g,\"~\")}function mp(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(var e=0,r=t.length;e<r;e++)if(mp(t[e]))return!0}else if(typeof t==\"object\"){for(var i=hp(t),o=i.length,s=0;s<o;s++)if(mp(t[i[s]]))return!0}}return!1}function z_(t,e){var r=[t];for(var i in e){var o=typeof e[i]==\"object\"?JSON.stringify(e[i],null,2):e[i];typeof o<\"u\"&&r.push(i+\": \"+o)}return r.join(`\n`)}var ol=(function(t){w4(e,t);function e(r,i,o,s,n){var a=this.constructor,p=t.call(this,z_(r,{name:i,index:o,operation:s,tree:n}))||this;return p.name=i,p.index=o,p.operation=s,p.tree=n,Object.setPrototypeOf(p,a.prototype),p.message=z_(r,{name:i,index:o,operation:s,tree:n}),p}return e})(Error);var rt=ol,P4=kt,Ta={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var i=t[e];return delete t[e],{newDocument:r,removed:i}},replace:function(t,e,r){var i=t[e];return t[e]=this.value,{newDocument:r,removed:i}},move:function(t,e,r){var i=Ma(r,this.path);i&&(i=kt(i));var o=Rn(r,{op:\"remove\",path:this.from}).removed;return Rn(r,{op:\"add\",path:this.path,value:o}),{newDocument:r,removed:i}},copy:function(t,e,r){var i=Ma(r,this.from);return Rn(r,{op:\"add\",path:this.path,value:kt(i)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:sl(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},A4={add:function(t,e,r){return xp(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var i=t.splice(e,1);return{newDocument:r,removed:i[0]}},replace:function(t,e,r){var i=t[e];return t[e]=this.value,{newDocument:r,removed:i}},move:Ta.move,copy:Ta.copy,test:Ta.test,_get:Ta._get};function Ma(t,e){if(e==\"\")return t;var r={op:\"_get\",path:e};return Rn(t,r),r.value}function Rn(t,e,r,i,o,s){if(r===void 0&&(r=!1),i===void 0&&(i=!0),o===void 0&&(o=!0),s===void 0&&(s=0),r&&(typeof r==\"function\"?r(e,0,t,e.path):yp(e,0)),e.path===\"\"){var n={newDocument:t};if(e.op===\"add\")return n.newDocument=e.value,n;if(e.op===\"replace\")return n.newDocument=e.value,n.removed=t,n;if(e.op===\"move\"||e.op===\"copy\")return n.newDocument=Ma(t,e.from),e.op===\"move\"&&(n.removed=t),n;if(e.op===\"test\"){if(n.test=sl(t,e.value),n.test===!1)throw new rt(\"Test operation failed\",\"TEST_OPERATION_FAILED\",s,e,t);return n.newDocument=t,n}else{if(e.op===\"remove\")return n.removed=t,n.newDocument=null,n;if(e.op===\"_get\")return e.value=t,n;if(r)throw new rt(\"Operation `op` property is not one of operations defined in RFC-6902\",\"OPERATION_OP_INVALID\",s,e,t);return n}}else{i||(t=kt(t));var a=e.path||\"\",p=a.split(\"/\"),l=t,u=1,f=p.length,m=void 0,x=void 0,h=void 0;for(typeof r==\"function\"?h=r:h=yp;;){if(x=p[u],x&&x.indexOf(\"~\")!=-1&&(x=il(x)),o&&(x==\"__proto__\"||x==\"prototype\"&&u>0&&p[u-1]==\"constructor\"))throw new TypeError(\"JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README\");if(r&&m===void 0&&(l[x]===void 0?m=p.slice(0,u).join(\"/\"):u==f-1&&(m=e.path),m!==void 0&&h(e,0,t,m)),u++,Array.isArray(l)){if(x===\"-\")x=l.length;else{if(r&&!xp(x))throw new rt(\"Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index\",\"OPERATION_PATH_ILLEGAL_ARRAY_INDEX\",s,e,t);xp(x)&&(x=~~x)}if(u>=f){if(r&&e.op===\"add\"&&x>l.length)throw new rt(\"The specified index MUST NOT be greater than the number of elements in the array\",\"OPERATION_VALUE_OUT_OF_BOUNDS\",s,e,t);var n=A4[e.op].call(e,l,x,t);if(n.test===!1)throw new rt(\"Test operation failed\",\"TEST_OPERATION_FAILED\",s,e,t);return n}}else if(u>=f){var n=Ta[e.op].call(e,l,x,t);if(n.test===!1)throw new rt(\"Test operation failed\",\"TEST_OPERATION_FAILED\",s,e,t);return n}if(l=l[x],r&&u<f&&(!l||typeof l!=\"object\"))throw new rt(\"Cannot perform operation at the desired path\",\"OPERATION_PATH_UNRESOLVABLE\",s,e,t)}}}function So(t,e,r,i,o){if(i===void 0&&(i=!0),o===void 0&&(o=!0),r&&!Array.isArray(e))throw new rt(\"Patch sequence must be an array\",\"SEQUENCE_NOT_AN_ARRAY\");i||(t=kt(t));for(var s=new Array(e.length),n=0,a=e.length;n<a;n++)s[n]=Rn(t,e[n],r,!0,o,n),t=s[n].newDocument;return s.newDocument=t,s}function R4(t,e,r){var i=Rn(t,e);if(i.test===!1)throw new rt(\"Test operation failed\",\"TEST_OPERATION_FAILED\",r,e,t);return i.newDocument}function yp(t,e,r,i){if(typeof t!=\"object\"||t===null||Array.isArray(t))throw new rt(\"Operation is not an object\",\"OPERATION_NOT_AN_OBJECT\",e,t,r);if(Ta[t.op]){if(typeof t.path!=\"string\")throw new rt(\"Operation `path` property is not a string\",\"OPERATION_PATH_INVALID\",e,t,r);if(t.path.indexOf(\"/\")!==0&&t.path.length>0)throw new rt('Operation `path` property must start with \"/\"',\"OPERATION_PATH_INVALID\",e,t,r);if((t.op===\"move\"||t.op===\"copy\")&&typeof t.from!=\"string\")throw new rt(\"Operation `from` property is not present (applicable in `move` and `copy` operations)\",\"OPERATION_FROM_REQUIRED\",e,t,r);if((t.op===\"add\"||t.op===\"replace\"||t.op===\"test\")&&t.value===void 0)throw new rt(\"Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)\",\"OPERATION_VALUE_REQUIRED\",e,t,r);if((t.op===\"add\"||t.op===\"replace\"||t.op===\"test\")&&mp(t.value))throw new rt(\"Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)\",\"OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED\",e,t,r);if(r){if(t.op==\"add\"){var o=t.path.split(\"/\").length,s=i.split(\"/\").length;if(o!==s+1&&o!==s)throw new rt(\"Cannot perform an `add` operation at the desired path\",\"OPERATION_PATH_CANNOT_ADD\",e,t,r)}else if(t.op===\"replace\"||t.op===\"remove\"||t.op===\"_get\"){if(t.path!==i)throw new rt(\"Cannot perform the operation at a path that does not exist\",\"OPERATION_PATH_UNRESOLVABLE\",e,t,r)}else if(t.op===\"move\"||t.op===\"copy\"){var n={op:\"_get\",path:t.from,value:void 0},a=K_([n],r);if(a&&a.name===\"OPERATION_PATH_UNRESOLVABLE\")throw new rt(\"Cannot perform the operation from a path that does not exist\",\"OPERATION_FROM_UNRESOLVABLE\",e,t,r)}}}else throw new rt(\"Operation `op` property is not one of operations defined in RFC-6902\",\"OPERATION_OP_INVALID\",e,t,r)}function K_(t,e,r){try{if(!Array.isArray(t))throw new rt(\"Patch sequence must be an array\",\"SEQUENCE_NOT_AN_ARRAY\");if(e)So(kt(e),kt(t),r||!0);else{r=r||yp;for(var i=0;i<t.length;i++)r(t[i],i,e,void 0)}}catch(o){if(o instanceof rt)return o;throw o}}function sl(t,e){if(t===e)return!0;if(t&&e&&typeof t==\"object\"&&typeof e==\"object\"){var r=Array.isArray(t),i=Array.isArray(e),o,s,n;if(r&&i){if(s=t.length,s!=e.length)return!1;for(o=s;o--!==0;)if(!sl(t[o],e[o]))return!1;return!0}if(r!=i)return!1;var a=Object.keys(t);if(s=a.length,s!==Object.keys(e).length)return!1;for(o=s;o--!==0;)if(!e.hasOwnProperty(a[o]))return!1;for(o=s;o--!==0;)if(n=a[o],!sl(t[n],e[n]))return!1;return!0}return t!==t&&e!==e}var ch={};vr(ch,{compare:()=>N4,generate:()=>sh,observe:()=>$4,unobserve:()=>F4});var nh=new WeakMap,_4=(function(){function t(e){this.observers=new Map,this.obj=e}return t})(),I4=(function(){function t(e,r){this.callback=e,this.observer=r}return t})();function C4(t){return nh.get(t)}function T4(t,e){return t.observers.get(e)}function M4(t,e){t.observers.delete(e.callback)}function F4(t,e){e.unobserve()}function $4(t,e){var r=[],i,o=C4(t);if(!o)o=new _4(t),nh.set(t,o);else{var s=T4(o,e);i=s&&s.observer}if(i)return i;if(i={},o.value=kt(t),e){i.callback=e,i.next=null;var n=function(){sh(i)},a=function(){clearTimeout(i.next),i.next=setTimeout(n)};typeof window<\"u\"&&(window.addEventListener(\"mouseup\",a),window.addEventListener(\"keyup\",a),window.addEventListener(\"mousedown\",a),window.addEventListener(\"keydown\",a),window.addEventListener(\"change\",a))}return i.patches=r,i.object=t,i.unobserve=function(){sh(i),clearTimeout(i.next),M4(o,i),typeof window<\"u\"&&(window.removeEventListener(\"mouseup\",a),window.removeEventListener(\"keyup\",a),window.removeEventListener(\"mousedown\",a),window.removeEventListener(\"keydown\",a),window.removeEventListener(\"change\",a))},o.observers.set(e,new I4(e,i)),i}function sh(t,e){e===void 0&&(e=!1);var r=nh.get(t.object);ah(r.value,t.object,t.patches,\"\",e),t.patches.length&&So(r.value,t.patches);var i=t.patches;return i.length>0&&(t.patches=[],t.callback&&t.callback(i)),i}function ah(t,e,r,i,o){if(e!==t){typeof e.toJSON==\"function\"&&(e=e.toJSON());for(var s=hp(e),n=hp(t),a=!1,p=!1,l=n.length-1;l>=0;l--){var u=n[l],f=t[u];if(dp(e,u)&&!(e[u]===void 0&&f!==void 0&&Array.isArray(e)===!1)){var m=e[u];typeof f==\"object\"&&f!=null&&typeof m==\"object\"&&m!=null&&Array.isArray(f)===Array.isArray(m)?ah(f,m,r,i+\"/\"+bo(u),o):f!==m&&(a=!0,o&&r.push({op:\"test\",path:i+\"/\"+bo(u),value:kt(f)}),r.push({op:\"replace\",path:i+\"/\"+bo(u),value:kt(m)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:\"test\",path:i+\"/\"+bo(u),value:kt(f)}),r.push({op:\"remove\",path:i+\"/\"+bo(u)}),p=!0):(o&&r.push({op:\"test\",path:i,value:t}),r.push({op:\"replace\",path:i,value:e}),a=!0)}if(!(!p&&s.length==n.length))for(var l=0;l<s.length;l++){var u=s[l];!dp(t,u)&&e[u]!==void 0&&r.push({op:\"add\",path:i+\"/\"+bo(u),value:kt(e[u])})}}}function N4(t,e,r){r===void 0&&(r=!1);var i=[];return ah(t,e,i,\"\",r),i}var ine=Object.assign({},oh,ch,{JsonPatchError:ol,deepClone:kt,escapePathComponent:bo,unescapePathComponent:il});var uh=Le(X_()),_e={add:Q4,replace:gp,remove:Z4,merge:eH,mergeDeep:tH,context:rH,getIn:nH,applyPatch:X4,parentPathMatch:sH,flatten:al,fullyNormalizeArray:aH,normalizeArray:eI,isPromise:cH,forEachNew:iH,forEachNewPrimitive:oH,isJsonPatch:iI,isContextPatch:pH,isPatch:Ep,isMutation:oI,isAdditiveMutation:vp,isGenerator:uH,isFunction:rI,isObject:_n,isError:lH};function X4(t,e,r){if(r=r||{},e={...e,path:e.path&&Q_(e.path)},e.op===\"merge\"){let i=lh(t,e.path);Object.assign(i,e.value),So(t,[gp(e.path,i)])}else if(e.op===\"mergeDeep\"){let i=lh(t,e.path),o=(0,uh.default)(i,e.value,{customMerge:s=>{if(s===\"enum\")return(n,a)=>Array.isArray(n)&&Array.isArray(a)?[...new Set([...n,...a])]:(0,uh.default)(n,a)}});t=So(t,[gp(e.path,o)]).newDocument}else if(e.op===\"add\"&&e.path===\"\"&&_n(e.value)){let i=Object.keys(e.value).reduce((o,s)=>(o.push({op:\"add\",path:`/${Q_(s)}`,value:e.value[s]}),o),[]);So(t,i)}else if(e.op===\"replace\"&&e.path===\"\"){let{value:i}=e;r.allowMetaPatches&&e.meta&&vp(e)&&(Array.isArray(e.value)||_n(e.value))&&(i={...i,...e.meta}),t=i}else if(So(t,[e]),r.allowMetaPatches&&e.meta&&vp(e)&&(Array.isArray(e.value)||_n(e.value))){let o={...lh(t,e.path),...e.meta};So(t,[gp(e.path,o)])}return t}function Q_(t){return Array.isArray(t)?t.length<1?\"\":`/${t.map(e=>(e+\"\").replace(/~/g,\"~0\").replace(/\\//g,\"~1\")).join(\"/\")}`:t}function Q4(t,e){return{op:\"add\",path:t,value:e}}function gp(t,e,r){return{op:\"replace\",path:t,value:e,meta:r}}function Z4(t){return{op:\"remove\",path:t}}function eH(t,e){return{type:\"mutation\",op:\"merge\",path:t,value:e}}function tH(t,e){return{type:\"mutation\",op:\"mergeDeep\",path:t,value:e}}function rH(t,e){return{type:\"context\",path:t,value:e}}function iH(t,e){try{return Z_(t,fh,e)}catch(r){return r}}function oH(t,e){try{return Z_(t,ph,e)}catch(r){return r}}function Z_(t,e,r){let i=t.filter(vp).map(n=>e(n.value,r,n.path))||[],o=al(i);return tI(o)}function ph(t,e,r){return r=r||[],Array.isArray(t)?t.map((i,o)=>ph(i,e,r.concat(o))):_n(t)?Object.keys(t).map(i=>ph(t[i],e,r.concat(i))):e(t,r[r.length-1],r)}function fh(t,e,r){r=r||[];let i=[];if(r.length>0){let o=e(t,r[r.length-1],r);o&&(i=i.concat(o))}if(Array.isArray(t)){let o=t.map((s,n)=>fh(s,e,r.concat(n)));o&&(i=i.concat(o))}else if(_n(t)){let o=Object.keys(t).map(s=>fh(t[s],e,r.concat(s)));o&&(i=i.concat(o))}return i=al(i),i}function sH(t,e){if(!Array.isArray(e))return!1;for(let r=0,i=e.length;r<i;r+=1)if(e[r]!==t[r])return!1;return!0}function nH(t,e){return e.reduce((r,i)=>typeof i<\"u\"&&r?r[i]:r,t)}function aH(t){return tI(al(eI(t)))}function eI(t){return Array.isArray(t)?t:[t]}function al(t){return[].concat(...t.map(e=>Array.isArray(e)?al(e):e))}function tI(t){return t.filter(e=>typeof e<\"u\")}function _n(t){return t&&typeof t==\"object\"}function cH(t){return _n(t)&&rI(t.then)}function rI(t){return t&&typeof t==\"function\"}function lH(t){return t instanceof Error}function iI(t){if(Ep(t)){let{op:e}=t;return e===\"add\"||e===\"remove\"||e===\"replace\"}return!1}function uH(t){return Object.prototype.toString.call(t)===\"[object GeneratorFunction]\"}function oI(t){return iI(t)||Ep(t)&&t.type===\"mutation\"}function vp(t){return oI(t)&&(t.op===\"add\"||t.op===\"replace\"||t.op===\"merge\"||t.op===\"mergeDeep\")}function pH(t){return Ep(t)&&t.type===\"context\"}function Ep(t){return t&&typeof t==\"object\"}function lh(t,e){try{return Ma(t,e)}catch(r){return console.error(r),{}}}var JT=Le(UT(),1),Yh=class extends JT.default{constructor(e,r,i){if(super(e,r,i),this.name=this.constructor.name,typeof r==\"string\"&&(this.message=r),typeof Error.captureStackTrace==\"function\"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(r).stack,i!=null&&typeof i==\"object\"&&Object.hasOwn(i,\"cause\")&&!(\"cause\"in this)){let{cause:o}=i;this.cause=o,o instanceof Error&&\"stack\"in o&&(this.stack=`${this.stack}\nCAUSE: ${o.stack}`)}}},HT=Yh;var Xh=class extends Error{static[Symbol.hasInstance](e){return super[Symbol.hasInstance](e)||Function.prototype[Symbol.hasInstance].call(HT,e)}constructor(e,r){if(super(e,r),this.name=this.constructor.name,typeof e==\"string\"&&(this.message=e),typeof Error.captureStackTrace==\"function\"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack,r!=null&&typeof r==\"object\"&&Object.hasOwn(r,\"cause\")&&!(\"cause\"in this)){let{cause:i}=r;this.cause=i,i instanceof Error&&\"stack\"in i&&(this.stack=`${this.stack}\nCAUSE: ${i.stack}`)}}},he=Xh;var Qh=class extends he{constructor(e,r){if(super(e,r),r!=null&&typeof r==\"object\"){let{cause:i,...o}=r;Object.assign(this,o)}}},yt=Qh;var Zh=class extends he{},ge=Zh;var ex=class extends ge{},fl=ex;var N5=function(){return!1},Mn=N5;var k5=function(){return!0},wt=k5;function Ve(t){return t!=null&&typeof t==\"object\"&&t[\"@@functional/placeholder\"]===!0}function de(t){return function e(r){return arguments.length===0||Ve(r)?e:t.apply(this,arguments)}}function ie(t){return function e(r,i){switch(arguments.length){case 0:return e;case 1:return Ve(r)?e:de(function(o){return t(r,o)});default:return Ve(r)&&Ve(i)?e:Ve(r)?de(function(o){return t(o,i)}):Ve(i)?de(function(o){return t(r,o)}):t(r,i)}}}function tx(t,e){t=t||[],e=e||[];var r,i=t.length,o=e.length,s=[];for(r=0;r<i;)s[s.length]=t[r],r+=1;for(r=0;r<o;)s[s.length]=e[r],r+=1;return s}function qo(t,e){switch(t){case 0:return function(){return e.apply(this,arguments)};case 1:return function(r){return e.apply(this,arguments)};case 2:return function(r,i){return e.apply(this,arguments)};case 3:return function(r,i,o){return e.apply(this,arguments)};case 4:return function(r,i,o,s){return e.apply(this,arguments)};case 5:return function(r,i,o,s,n){return e.apply(this,arguments)};case 6:return function(r,i,o,s,n,a){return e.apply(this,arguments)};case 7:return function(r,i,o,s,n,a,p){return e.apply(this,arguments)};case 8:return function(r,i,o,s,n,a,p,l){return e.apply(this,arguments)};case 9:return function(r,i,o,s,n,a,p,l,u){return e.apply(this,arguments)};case 10:return function(r,i,o,s,n,a,p,l,u,f){return e.apply(this,arguments)};default:throw new Error(\"First argument to _arity must be a non-negative integer no greater than ten\")}}function Na(t,e,r){return function(){for(var i=[],o=0,s=t,n=0,a=!1;n<e.length||o<arguments.length;){var p;n<e.length&&(!Ve(e[n])||o>=arguments.length)?p=e[n]:(p=arguments[o],o+=1),i[n]=p,Ve(p)?a=!0:s-=1,n+=1}return!a&&s<=0?r.apply(this,i):qo(Math.max(0,s),Na(t,i,r))}}var D5=ie(function(e,r){return e===1?de(r):qo(e,Na(e,[],r))}),we=D5;function Ce(t){return function e(r,i,o){switch(arguments.length){case 0:return e;case 1:return Ve(r)?e:ie(function(s,n){return t(r,s,n)});case 2:return Ve(r)&&Ve(i)?e:Ve(r)?ie(function(s,n){return t(s,i,n)}):Ve(i)?ie(function(s,n){return t(r,s,n)}):de(function(s){return t(r,i,s)});default:return Ve(r)&&Ve(i)&&Ve(o)?e:Ve(r)&&Ve(i)?ie(function(s,n){return t(s,n,o)}):Ve(r)&&Ve(o)?ie(function(s,n){return t(s,i,n)}):Ve(i)&&Ve(o)?ie(function(s,n){return t(r,s,n)}):Ve(r)?de(function(s){return t(s,i,o)}):Ve(i)?de(function(s){return t(r,s,o)}):Ve(o)?de(function(s){return t(r,i,s)}):t(r,i,o)}}}var Sr=Array.isArray||function(e){return e!=null&&e.length>=0&&Object.prototype.toString.call(e)===\"[object Array]\"};function rx(t){return t!=null&&typeof t[\"@@transducer/step\"]==\"function\"}function Dt(t,e,r){return function(){if(arguments.length===0)return r();var i=arguments[arguments.length-1];if(!Sr(i)){for(var o=0;o<t.length;){if(typeof i[t[o]]==\"function\")return i[t[o]].apply(i,Array.prototype.slice.call(arguments,0,-1));o+=1}if(rx(i)){var s=e.apply(null,Array.prototype.slice.call(arguments,0,-1));return s(i)}}return r.apply(this,arguments)}}function Vo(t){return t&&t[\"@@transducer/reduced\"]?t:{\"@@transducer/value\":t,\"@@transducer/reduced\":!0}}var ot={init:function(){return this.xf[\"@@transducer/init\"]()},result:function(t){return this.xf[\"@@transducer/result\"](t)}};var q5=(function(){function t(e,r){this.xf=r,this.f=e,this.all=!0}return t.prototype[\"@@transducer/init\"]=ot.init,t.prototype[\"@@transducer/result\"]=function(e){return this.all&&(e=this.xf[\"@@transducer/step\"](e,!0)),this.xf[\"@@transducer/result\"](e)},t.prototype[\"@@transducer/step\"]=function(e,r){return this.f(r)||(this.all=!1,e=Vo(this.xf[\"@@transducer/step\"](e,!1))),e},t})();function ix(t){return function(e){return new q5(t,e)}}var V5=ie(Dt([\"all\"],ix,function(e,r){for(var i=0;i<r.length;){if(!e(r[i]))return!1;i+=1}return!0})),ka=V5;function qp(t){for(var e=[],r;!(r=t.next()).done;)e.push(r.value);return e}function Ws(t,e,r){for(var i=0,o=r.length;i<o;){if(t(e,r[i]))return!0;i+=1}return!1}function ox(t){var e=String(t).match(/^function (\\w*)/);return e==null?\"\":e[1]}function st(t,e){return Object.prototype.hasOwnProperty.call(e,t)}function L5(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var Fn=typeof Object.is==\"function\"?Object.is:L5;var zT=Object.prototype.toString,B5=(function(){return zT.call(arguments)===\"[object Arguments]\"?function(e){return zT.call(e)===\"[object Arguments]\"}:function(e){return st(\"callee\",e)}})(),Vp=B5;var U5=!{toString:null}.propertyIsEnumerable(\"toString\"),KT=[\"constructor\",\"valueOf\",\"isPrototypeOf\",\"toString\",\"propertyIsEnumerable\",\"hasOwnProperty\",\"toLocaleString\"],WT=(function(){\"use strict\";return arguments.propertyIsEnumerable(\"length\")})(),J5=function(e,r){for(var i=0;i<e.length;){if(e[i]===r)return!0;i+=1}return!1},H5=typeof Object.keys==\"function\"&&!WT?de(function(e){return Object(e)!==e?[]:Object.keys(e)}):de(function(e){if(Object(e)!==e)return[];var r,i,o=[],s=WT&&Vp(e);for(r in e)st(r,e)&&(!s||r!==\"length\")&&(o[o.length]=r);if(U5)for(i=KT.length-1;i>=0;)r=KT[i],st(r,e)&&!J5(o,r)&&(o[o.length]=r),i-=1;return o}),Vr=H5;var z5=de(function(e){return e===null?\"Null\":e===void 0?\"Undefined\":Object.prototype.toString.call(e).slice(8,-1)}),it=z5;function GT(t,e,r,i){var o=qp(t),s=qp(e);function n(a,p){return ml(a,p,r.slice(),i.slice())}return!Ws(function(a,p){return!Ws(n,p,a)},s,o)}function ml(t,e,r,i){if(Fn(t,e))return!0;var o=it(t);if(o!==it(e))return!1;if(typeof t[\"fantasy-land/equals\"]==\"function\"||typeof e[\"fantasy-land/equals\"]==\"function\")return typeof t[\"fantasy-land/equals\"]==\"function\"&&t[\"fantasy-land/equals\"](e)&&typeof e[\"fantasy-land/equals\"]==\"function\"&&e[\"fantasy-land/equals\"](t);if(typeof t.equals==\"function\"||typeof e.equals==\"function\")return typeof t.equals==\"function\"&&t.equals(e)&&typeof e.equals==\"function\"&&e.equals(t);switch(o){case\"Arguments\":case\"Array\":case\"Object\":if(typeof t.constructor==\"function\"&&ox(t.constructor)===\"Promise\")return t===e;break;case\"Boolean\":case\"Number\":case\"String\":if(!(typeof t==typeof e&&Fn(t.valueOf(),e.valueOf())))return!1;break;case\"Date\":if(!Fn(t.valueOf(),e.valueOf()))return!1;break;case\"Error\":return t.name===e.name&&t.message===e.message;case\"RegExp\":if(!(t.source===e.source&&t.global===e.global&&t.ignoreCase===e.ignoreCase&&t.multiline===e.multiline&&t.sticky===e.sticky&&t.unicode===e.unicode))return!1;break}for(var s=r.length-1;s>=0;){if(r[s]===t)return i[s]===e;s-=1}switch(o){case\"Map\":return t.size!==e.size?!1:GT(t.entries(),e.entries(),r.concat([t]),i.concat([e]));case\"Set\":return t.size!==e.size?!1:GT(t.values(),e.values(),r.concat([t]),i.concat([e]));case\"Arguments\":case\"Array\":case\"Object\":case\"Boolean\":case\"Number\":case\"String\":case\"Date\":case\"Error\":case\"RegExp\":case\"Int8Array\":case\"Uint8Array\":case\"Uint8ClampedArray\":case\"Int16Array\":case\"Uint16Array\":case\"Int32Array\":case\"Uint32Array\":case\"Float32Array\":case\"Float64Array\":case\"ArrayBuffer\":break;default:return!1}var n=Vr(t);if(n.length!==Vr(e).length)return!1;var a=r.concat([t]),p=i.concat([e]);for(s=n.length-1;s>=0;){var l=n[s];if(!(st(l,e)&&ml(e[l],t[l],a,p)))return!1;s-=1}return!0}var K5=ie(function(e,r){return ml(e,r,[],[])}),qt=K5;function sx(t,e,r){var i,o;if(typeof t.indexOf==\"function\")switch(typeof e){case\"number\":if(e===0){for(i=1/e;r<t.length;){if(o=t[r],o===0&&1/o===i)return r;r+=1}return-1}else if(e!==e){for(;r<t.length;){if(o=t[r],typeof o==\"number\"&&o!==o)return r;r+=1}return-1}return t.indexOf(e,r);case\"string\":case\"boolean\":case\"function\":case\"undefined\":return t.indexOf(e,r);case\"object\":if(e===null)return t.indexOf(e,r)}for(;r<t.length;){if(qt(t[r],e))return r;r+=1}return-1}function Gs(t,e){return sx(e,t,0)>=0}function $n(t,e){for(var r=0,i=e.length,o=Array(i);r<i;)o[r]=t(e[r]),r+=1;return o}function dl(t){var e=t.replace(/\\\\/g,\"\\\\\\\\\").replace(/[\\b]/g,\"\\\\b\").replace(/\\f/g,\"\\\\f\").replace(/\\n/g,\"\\\\n\").replace(/\\r/g,\"\\\\r\").replace(/\\t/g,\"\\\\t\").replace(/\\v/g,\"\\\\v\").replace(/\\0/g,\"\\\\0\");return'\"'+e.replace(/\"/g,'\\\\\"')+'\"'}var hl=function(e){return(e<10?\"0\":\"\")+e},W5=typeof Date.prototype.toISOString==\"function\"?function(e){return e.toISOString()}:function(e){return e.getUTCFullYear()+\"-\"+hl(e.getUTCMonth()+1)+\"-\"+hl(e.getUTCDate())+\"T\"+hl(e.getUTCHours())+\":\"+hl(e.getUTCMinutes())+\":\"+hl(e.getUTCSeconds())+\".\"+(e.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+\"Z\"},YT=W5;function xl(t){return function(){return!t.apply(this,arguments)}}function ti(t,e,r){for(var i=0,o=r.length;i<o;)e=t(e,r[i]),i+=1;return e}function nx(t,e){for(var r=0,i=e.length,o=[];r<i;)t(e[r])&&(o[o.length]=e[r]),r+=1;return o}function Ys(t){return Object.prototype.toString.call(t)===\"[object Object]\"}var G5=(function(){function t(e,r){this.xf=r,this.f=e}return t.prototype[\"@@transducer/init\"]=ot.init,t.prototype[\"@@transducer/result\"]=ot.result,t.prototype[\"@@transducer/step\"]=function(e,r){return this.f(r)?this.xf[\"@@transducer/step\"](e,r):e},t})();function ax(t){return function(e){return new G5(t,e)}}var Y5=ie(Dt([\"fantasy-land/filter\",\"filter\"],ax,function(t,e){return Ys(e)?ti(function(r,i){return t(e[i])&&(r[i]=e[i]),r},{},Vr(e)):nx(t,e)})),XT=Y5;var X5=ie(function(e,r){return XT(xl(e),r)}),QT=X5;function Lp(t,e){var r=function(n){var a=e.concat([t]);return Gs(n,a)?\"<Circular>\":Lp(n,a)},i=function(s,n){return $n(function(a){return dl(a)+\": \"+r(s[a])},n.slice().sort())};switch(Object.prototype.toString.call(t)){case\"[object Arguments]\":return\"(function() { return arguments; }(\"+$n(r,t).join(\", \")+\"))\";case\"[object Array]\":return\"[\"+$n(r,t).concat(i(t,QT(function(s){return/^\\d+$/.test(s)},Vr(t)))).join(\", \")+\"]\";case\"[object Boolean]\":return typeof t==\"object\"?\"new Boolean(\"+r(t.valueOf())+\")\":t.toString();case\"[object Date]\":return\"new Date(\"+(isNaN(t.valueOf())?r(NaN):dl(YT(t)))+\")\";case\"[object Map]\":return\"new Map(\"+r(Array.from(t))+\")\";case\"[object Null]\":return\"null\";case\"[object Number]\":return typeof t==\"object\"?\"new Number(\"+r(t.valueOf())+\")\":1/t===-1/0?\"-0\":t.toString(10);case\"[object Set]\":return\"new Set(\"+r(Array.from(t).sort())+\")\";case\"[object String]\":return typeof t==\"object\"?\"new String(\"+r(t.valueOf())+\")\":dl(t);case\"[object Undefined]\":return\"undefined\";default:if(typeof t.toString==\"function\"){var o=t.toString();if(o!==\"[object Object]\")return o}return\"{\"+i(t,Vr(t)).join(\", \")+\"}\"}}var Q5=de(function(e){return Lp(e,[])}),Lo=Q5;var Z5=ie(function(e,r){if(e===r)return r;function i(p,l){if(p>l!=l>p)return l>p?l:p}var o=i(e,r);if(o!==void 0)return o;var s=i(typeof e,typeof r);if(s!==void 0)return s===typeof e?e:r;var n=Lo(e),a=i(n,Lo(r));return a!==void 0&&a===n?e:r}),Bp=Z5;var e9=(function(){function t(e,r){this.xf=r,this.f=e}return t.prototype[\"@@transducer/init\"]=ot.init,t.prototype[\"@@transducer/result\"]=ot.result,t.prototype[\"@@transducer/step\"]=function(e,r){return this.xf[\"@@transducer/step\"](e,this.f(r))},t})(),t9=function(e){return function(r){return new e9(e,r)}},ZT=t9;var r9=ie(Dt([\"fantasy-land/map\",\"map\"],ZT,function(e,r){switch(Object.prototype.toString.call(r)){case\"[object Function]\":return we(r.length,function(){return e.call(this,r.apply(this,arguments))});case\"[object Object]\":return ti(function(i,o){return i[o]=e(r[o]),i},{},Vr(r));default:return $n(e,r)}})),Xs=r9;var Lr=Number.isInteger||function(e){return e<<0===e};function Nn(t){return Object.prototype.toString.call(t)===\"[object String]\"}function Bo(t,e){var r=t<0?e.length+t:t;return Nn(e)?e.charAt(r):e[r]}var i9=ie(function(e,r){if(r!=null)return Lr(e)?Bo(e,r):r[e]}),ri=i9;var o9=ie(function(e,r){return Xs(ri(e),r)}),Up=o9;var s9=de(function(e){return Sr(e)?!0:!e||typeof e!=\"object\"||Nn(e)?!1:e.length===0?!0:e.length>0?e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1):!1}),eM=s9;var tM=typeof Symbol<\"u\"?Symbol.iterator:\"@@iterator\";function yl(t,e,r){return function(o,s,n){if(eM(n))return t(o,s,n);if(n==null)return s;if(typeof n[\"fantasy-land/reduce\"]==\"function\")return e(o,s,n,\"fantasy-land/reduce\");if(n[tM]!=null)return r(o,s,n[tM]());if(typeof n.next==\"function\")return r(o,s,n);if(typeof n.reduce==\"function\")return e(o,s,n,\"reduce\");throw new TypeError(\"reduce: list must be array or iterable\")}}function cx(t,e,r){for(var i=0,o=r.length;i<o;){if(e=t[\"@@transducer/step\"](e,r[i]),e&&e[\"@@transducer/reduced\"]){e=e[\"@@transducer/value\"];break}i+=1}return t[\"@@transducer/result\"](e)}var n9=ie(function(e,r){return qo(e.length,function(){return e.apply(r,arguments)})}),gl=n9;function a9(t,e,r){for(var i=r.next();!i.done;){if(e=t[\"@@transducer/step\"](e,i.value),e&&e[\"@@transducer/reduced\"]){e=e[\"@@transducer/value\"];break}i=r.next()}return t[\"@@transducer/result\"](e)}function c9(t,e,r,i){return t[\"@@transducer/result\"](r[i](gl(t[\"@@transducer/step\"],t),e))}var l9=yl(cx,c9,a9),Da=l9;var u9=(function(){function t(e){this.f=e}return t.prototype[\"@@transducer/init\"]=function(){throw new Error(\"init not implemented on XWrap\")},t.prototype[\"@@transducer/result\"]=function(e){return e},t.prototype[\"@@transducer/step\"]=function(e,r){return this.f(e,r)},t})();function vl(t){return new u9(t)}var p9=Ce(function(t,e,r){return Da(typeof t==\"function\"?vl(t):t,e,r)}),sr=p9;var f9=de(function(e){return we(sr(Bp,0,Up(\"length\",e)),function(){for(var r=0,i=e.length;r<i;){if(!e[r].apply(this,arguments))return!1;r+=1}return!0})}),lx=f9;var m9=de(function(e){return function(){return e}}),J=m9;var d9=ie(function(e,r){return e&&r}),rM=d9;var h9=de(function(e){return we(sr(Bp,0,Up(\"length\",e)),function(){for(var r=0,i=e.length;r<i;){if(e[r].apply(this,arguments))return!0;r+=1}return!1})}),ux=h9;function x9(t,e,r){for(var i=r.next();!i.done;)e=t(e,i.value),i=r.next();return e}function y9(t,e,r,i){return r[i](t,e)}var g9=yl(ti,y9,x9),iM=g9;var v9=ie(function(e,r){return typeof r[\"fantasy-land/ap\"]==\"function\"?r[\"fantasy-land/ap\"](e):typeof e.ap==\"function\"?e.ap(r):typeof e==\"function\"?function(i){return e(i)(r(i))}:iM(function(i,o){return tx(i,Xs(o,r))},[],e)}),oM=v9;var E9=ie(function(e,r){return e.apply(this,r)}),px=E9;var b9=de(function(e){return we(e.length,e)}),kn=b9;function fx(t,e,r){if(Lr(t)&&Sr(r)){var i=[].concat(r);return i[t]=e,i}var o={};for(var s in r)o[s]=r[s];return o[t]=e,o}var S9=de(function(e){return e==null}),Qs=S9;var O9=Ce(function t(e,r,i){if(e.length===0)return r;var o=e[0];if(e.length>1){var s=!Qs(i)&&st(o,i)&&typeof i[o]==\"object\"?i[o]:Lr(e[1])?[]:{};r=t(Array.prototype.slice.call(e,1),r,s)}return fx(o,r,i)}),X=O9;var w9=Ce(function(e,r,i){return X([e],r,i)}),sM=w9;function Dn(t){var e=Object.prototype.toString.call(t);return e===\"[object Function]\"||e===\"[object AsyncFunction]\"||e===\"[object GeneratorFunction]\"||e===\"[object AsyncGeneratorFunction]\"}var j9=ie(function(e,r){var i=we(e,r);return we(e,function(){return ti(oM,Xs(i,arguments[0]),Array.prototype.slice.call(arguments,1))})}),nM=j9;var P9=de(function(e){return nM(e.length,e)}),qa=P9;var A9=ie(function(e,r){return Dn(e)?function(){return e.apply(this,arguments)&&r.apply(this,arguments)}:qa(rM)(e,r)}),ii=A9;function mx(t){return new RegExp(t.source,t.flags?t.flags:(t.global?\"g\":\"\")+(t.ignoreCase?\"i\":\"\")+(t.multiline?\"m\":\"\")+(t.sticky?\"y\":\"\")+(t.unicode?\"u\":\"\")+(t.dotAll?\"s\":\"\"))}function Va(t,e,r){if(r||(r=new _9),R9(t))return t;var i=function(s){var n=r.get(t);if(n)return n;r.set(t,s);for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(s[a]=e?Va(t[a],!0,r):t[a]);return s};switch(it(t)){case\"Object\":return i(Object.create(Object.getPrototypeOf(t)));case\"Array\":return i(Array(t.length));case\"Date\":return new Date(t.valueOf());case\"RegExp\":return mx(t);case\"Int8Array\":case\"Uint8Array\":case\"Uint8ClampedArray\":case\"Int16Array\":case\"Uint16Array\":case\"Int32Array\":case\"Uint32Array\":case\"Float32Array\":case\"Float64Array\":case\"BigInt64Array\":case\"BigUint64Array\":return t.slice();default:return t}}function R9(t){var e=typeof t;return t==null||e!=\"object\"&&e!=\"function\"}var _9=(function(){function t(){this.map={},this.length=0}return t.prototype.set=function(e,r){var i=this.hash(e),o=this.map[i];o||(this.map[i]=o=[]),o.push([e,r]),this.length+=1},t.prototype.hash=function(e){var r=[];for(var i in e)r.push(Object.prototype.toString.call(e[i]));return r.join()},t.prototype.get=function(e){if(this.length<=180){for(var r in this.map)for(var n=this.map[r],i=0;i<n.length;i+=1){var o=n[i];if(o[0]===e)return o[1]}return}var s=this.hash(e),n=this.map[s];if(n)for(var i=0;i<n.length;i+=1){var o=n[i];if(o[0]===e)return o[1]}},t})();var I9=de(function(e){return function(r,i){return e(r,i)?-1:e(i,r)?1:0}}),dx=I9;var C9=de(function(e){return!e}),aM=C9;var T9=qa(aM),oi=T9;function hx(t,e){return function(){return e.call(this,t.apply(this,arguments))}}function qn(t,e){return function(){var r=arguments.length;if(r===0)return e();var i=arguments[r-1];return Sr(i)||typeof i[t]!=\"function\"?e.apply(this,arguments):i[t].apply(i,Array.prototype.slice.call(arguments,0,r-1))}}var M9=Ce(qn(\"slice\",function(e,r,i){return Array.prototype.slice.call(i,e,r)})),wo=M9;var F9=de(qn(\"tail\",wo(1,1/0))),cM=F9;function Re(){if(arguments.length===0)throw new Error(\"pipe requires at least one argument\");return qo(arguments[0].length,sr(hx,arguments[0],cM(arguments)))}var $9=de(function(t){return Bo(0,t)}),xx=$9;function yx(t){return t}var N9=de(yx),El=N9;var k9=(function(){function t(e,r,i,o){this.valueFn=e,this.valueAcc=r,this.keyFn=i,this.xf=o,this.inputs={}}return t.prototype[\"@@transducer/init\"]=ot.init,t.prototype[\"@@transducer/result\"]=function(e){var r;for(r in this.inputs)if(st(r,this.inputs)&&(e=this.xf[\"@@transducer/step\"](e,this.inputs[r]),e[\"@@transducer/reduced\"])){e=e[\"@@transducer/value\"];break}return this.inputs=null,this.xf[\"@@transducer/result\"](e)},t.prototype[\"@@transducer/step\"]=function(e,r){var i=this.keyFn(r);return this.inputs[i]=this.inputs[i]||[i,Va(this.valueAcc,!1)],this.inputs[i][1]=this.valueFn(this.inputs[i][1],r),e},t})();function gx(t,e,r){return function(i){return new k9(t,e,r,i)}}var D9=Na(4,[],Dt([],gx,function(e,r,i,o){var s=vl(function(n,a){var p=i(a),l=e(st(p,n)?n[p]:Va(r,!1),a);return l&&l[\"@@transducer/reduced\"]?Vo(n):(n[p]=l,n)});return Da(s,{},o)})),lM=D9;var q9=ie(function(e,r){return r==null||r!==r?e:r}),nr=q9;var V9=(function(){function t(){this._nativeSet=typeof Set==\"function\"?new Set:null,this._items={}}return t.prototype.add=function(e){return!uM(e,!0,this)},t.prototype.has=function(e){return uM(e,!1,this)},t})();function uM(t,e,r){var i=typeof t,o,s;switch(i){case\"string\":case\"number\":return t===0&&1/t===-1/0?r._items[\"-0\"]?!0:(e&&(r._items[\"-0\"]=!0),!1):r._nativeSet!==null?e?(o=r._nativeSet.size,r._nativeSet.add(t),s=r._nativeSet.size,s===o):r._nativeSet.has(t):i in r._items?t in r._items[i]?!0:(e&&(r._items[i][t]=!0),!1):(e&&(r._items[i]={},r._items[i][t]=!0),!1);case\"boolean\":if(i in r._items){var n=t?1:0;return r._items[i][n]?!0:(e&&(r._items[i][n]=!0),!1)}else return e&&(r._items[i]=t?[!1,!0]:[!0,!1]),!1;case\"function\":return r._nativeSet!==null?e?(o=r._nativeSet.size,r._nativeSet.add(t),s=r._nativeSet.size,s===o):r._nativeSet.has(t):i in r._items?Gs(t,r._items[i])?!0:(e&&r._items[i].push(t),!1):(e&&(r._items[i]=[t]),!1);case\"undefined\":return r._items[i]?!0:(e&&(r._items[i]=!0),!1);case\"object\":if(t===null)return r._items.null?!0:(e&&(r._items.null=!0),!1);default:return i=Object.prototype.toString.call(t),i in r._items?Gs(t,r._items[i])?!0:(e&&r._items[i].push(t),!1):(e&&(r._items[i]=[t]),!1)}}var pM=V9;var L9=ie(function(e,r){for(var i=[],o=0,s=e.length,n=r.length,a=new pM,p=0;p<n;p+=1)a.add(r[p]);for(;o<s;)a.add(e[o])&&(i[i.length]=e[o]),o+=1;return i}),vx=L9;var B9=Ce(function(e,r,i){var o=Array.prototype.slice.call(i,0);return o.splice(e,r),o}),fM=B9;function Ex(t,e){if(e==null)return e;if(Lr(t)&&Sr(e))return fM(t,1,e);var r={};for(var i in e)r[i]=e[i];return delete r[t],r}function U9(t,e){if(Lr(t)&&Sr(e))return[].concat(e);var r={};for(var i in e)r[i]=e[i];return r}var J9=ie(function t(e,r){if(r==null)return r;switch(e.length){case 0:return r;case 1:return Ex(e[0],r);default:var i=e[0],o=Array.prototype.slice.call(e,1);return r[i]==null?U9(i,r):sM(i,t(o,r[i]),r)}}),jt=J9;var H9=(function(){function t(e,r){this.xf=r,this.n=e,this.i=0}return t.prototype[\"@@transducer/init\"]=ot.init,t.prototype[\"@@transducer/result\"]=ot.result,t.prototype[\"@@transducer/step\"]=function(e,r){this.i+=1;var i=this.n===0?e:this.xf[\"@@transducer/step\"](e,r);return this.n>=0&&this.i>=this.n?Vo(i):i},t})();function bx(t){return function(e){return new H9(t,e)}}var z9=ie(Dt([\"take\"],bx,function(e,r){return wo(0,e<0?1/0:e,r)})),mM=z9;function Sx(t,e){for(var r=e.length-1;r>=0&&t(e[r]);)r-=1;return wo(0,r+1,e)}var K9=(function(){function t(e,r){this.f=e,this.retained=[],this.xf=r}return t.prototype[\"@@transducer/init\"]=ot.init,t.prototype[\"@@transducer/result\"]=function(e){return this.retained=null,this.xf[\"@@transducer/result\"](e)},t.prototype[\"@@transducer/step\"]=function(e,r){return this.f(r)?this.retain(e,r):this.flush(e,r)},t.prototype.flush=function(e,r){return e=Da(this.xf,e,this.retained),this.retained=[],this.xf[\"@@transducer/step\"](e,r)},t.prototype.retain=function(e,r){return this.retained.push(r),e},t})();function Ox(t){return function(e){return new K9(t,e)}}var W9=ie(Dt([],Ox,Sx)),wx=W9;var G9=de(function(t){return Bo(-1,t)}),ar=G9;var Y9=(function(){function t(e,r){this.xf=r,this.f=e}return t.prototype[\"@@transducer/init\"]=ot.init,t.prototype[\"@@transducer/result\"]=ot.result,t.prototype[\"@@transducer/step\"]=function(e,r){if(this.f){if(this.f(r))return e;this.f=null}return this.xf[\"@@transducer/step\"](e,r)},t})();function jx(t){return function(e){return new Y9(t,e)}}var X9=ie(Dt([\"dropWhile\"],jx,function(e,r){for(var i=0,o=r.length;i<o&&e(r[i]);)i+=1;return wo(i,1/0,r)})),Px=X9;var Q9=ie(function(e,r){return e||r}),dM=Q9;var Z9=ie(function(e,r){return Dn(e)?function(){return e.apply(this,arguments)||r.apply(this,arguments)}:qa(dM)(e,r)}),Ax=Z9;function Rx(t){var e=Object.prototype.toString.call(t);return e===\"[object Uint8ClampedArray]\"||e===\"[object Int8Array]\"||e===\"[object Uint8Array]\"||e===\"[object Int16Array]\"||e===\"[object Uint16Array]\"||e===\"[object Int32Array]\"||e===\"[object Uint32Array]\"||e===\"[object Float32Array]\"||e===\"[object Float64Array]\"||e===\"[object BigInt64Array]\"||e===\"[object BigUint64Array]\"}var eK=de(function(e){return e!=null&&typeof e[\"fantasy-land/empty\"]==\"function\"?e[\"fantasy-land/empty\"]():e!=null&&e.constructor!=null&&typeof e.constructor[\"fantasy-land/empty\"]==\"function\"?e.constructor[\"fantasy-land/empty\"]():e!=null&&typeof e.empty==\"function\"?e.empty():e!=null&&e.constructor!=null&&typeof e.constructor.empty==\"function\"?e.constructor.empty():Sr(e)?[]:Nn(e)?\"\":Ys(e)?{}:Vp(e)?(function(){return arguments})():Rx(e)?e.constructor.from(\"\"):void 0}),hM=eK;var tK=de(function(e){return we(e.length,function(r,i){var o=Array.prototype.slice.call(arguments,0);return o[0]=i,o[1]=r,e.apply(this,o)})}),_x=tK;var rK=ie(qn(\"groupBy\",lM(function(t,e){return t.push(e),t},[]))),bl=rK;var iK=ie(function(e,r){if(e.length===0||Qs(r))return!1;for(var i=r,o=0;o<e.length;)if(!Qs(i)&&st(e[o],i))i=i[e[o]],o+=1;else return!1;return!0}),xM=iK;var oK=ie(function(e,r){return xM([e],r)}),Uo=oK;var yM=function(t,e){switch(arguments.length){case 0:return yM;case 1:return(function(){return function r(i){return arguments.length===0?r:Fn(t,i)}})();default:return Fn(t,e)}},cr=yM;var sK=Ce(function(e,r,i){return we(Math.max(e.length,r.length,i.length),function(){return e.apply(this,arguments)?r.apply(this,arguments):i.apply(this,arguments)})}),Vn=sK;var nK=ie(Gs),Ix=nK;var aK=wo(0,-1),Cx=aK;var cK=ie(function(e,r){return we(e+1,function(){var i=arguments[e];if(i!=null&&Dn(i[r]))return i[r].apply(i,Array.prototype.slice.call(arguments,0,e));throw new TypeError(Lo(i)+' does not have a method named \"'+r+'\"')})}),Ln=cK;var lK=de(function(e){return e!=null&&qt(e,hM(e))}),si=lK;var uK=de(function(e){return!si(e)}),Sl=uK;var pK=Ln(1,\"join\"),Ol=pK;function Jp(t){return Object.prototype.toString.call(t)===\"[object Number]\"}var fK=ie(function(e,r){return function(i){return function(o){return Xs(function(s){return r(s,o)},i(e(o)))}}}),Tx=fK;function Bn(t,e){for(var r=e,i=0;i<t.length;i+=1){if(r==null)return;var o=t[i];Lr(o)?r=Bo(o,r):r=r[o]}return r}var mK=ie(function(e,r){return ti(function(i,o){return i[o]=e(r[o],o,r),i},{},Vr(r))}),Mx=mK;var dK=Ce(function(e,r,i){var o={},s;r=r||{},i=i||{};for(s in r)st(s,r)&&(o[s]=st(s,i)?e(s,r[s],i[s]):r[s]);for(s in i)st(s,i)&&!st(s,o)&&(o[s]=i[s]);return o}),gM=dK;var hK=Ce(function t(e,r,i){return gM(function(o,s,n){return Ys(s)&&Ys(n)?t(e,s,n):e(o,s,n)},r,i)}),vM=hK;var xK=ie(function(e,r){return vM(function(i,o,s){return s},e,r)}),Zs=xK;var yK=ie(function(e,r){return ka(xl(e),r)}),wl=yK;var EM=function(t){return{value:t,map:function(e){return EM(e(t))}}},gK=Ce(function(e,r,i){return e(function(o){return EM(r(o))})(i).value}),Fx=gK;var vK=ie(Bn),Te=vK;var EK=Ce(function(e,r,i){return nr(e,Bn(r,i))}),Un=EK;var bK=Ce(function(e,r,i){return e(Bn(r,i))}),Jn=bK;var SK=ie(function(e,r){for(var i={},o=0;o<e.length;)e[o]in r&&(i[e[o]]=r[e[o]]),o+=1;return i}),jl=SK;var OK=Ce(function(e,r,i){return qt(e,ri(r,i))}),jo=OK;var wK=Ce(function(e,r,i){return nr(e,ri(r,i))}),Hn=wK;var jK=Ce(function(e,r,i){return e(ri(r,i))}),$x=jK;var PK=ie(function(e,r){if(!(Jp(e)&&Jp(r)))throw new TypeError(\"Both arguments to range must be numbers\");for(var i=Array(e<r?r-e:0),o=e<0?r+Math.abs(e):r-e,s=0;s<o;)i[s]=s+e,s+=1;return i}),Nx=PK;var AK=de(Vo),kx=AK;var RK=Ce(function(e,r,i){return i.replace(e,r)}),Pl=RK;var _K=ie(function(e,r){return Array.prototype.slice.call(r,0).sort(e)}),Dx=_K;var IK=Ln(1,\"split\"),Al=IK;var CK=ie(function(t,e){return qt(mM(t.length,e),t)}),qx=CK;var TK=(function(){function t(e,r){this.xf=r,this.pred=e,this.items=[]}return t.prototype[\"@@transducer/init\"]=ot.init,t.prototype[\"@@transducer/result\"]=ot.result,t.prototype[\"@@transducer/step\"]=function(e,r){return Ws(this.pred,r,this.items)?e:(this.items.push(r),this.xf[\"@@transducer/step\"](e,r))},t})();function Vx(t){return function(e){return new TK(t,e)}}var MK=ie(Dt([],Vx,function(t,e){for(var r=0,i=e.length,o=[],s;r<i;)s=e[r],Ws(t,s,o)||(o[o.length]=s),r+=1;return o})),Jo=MK;var FK=Ce(function(e,r,i){return e(i)?r(i):i}),Lx=FK;var $K=J(void 0),Ho=$K;var NK=qt(Ho()),et=NK;var kK=oi(et),Rl=kK;var DK=qt(null),Hp=DK;var qK=oi(Hp),zp=qK;var VK=oi(Qs),bM=VK;var LK=we(1,Re(it,cr(\"GeneratorFunction\"))),SM=LK;var BK=we(1,Re(it,cr(\"AsyncFunction\"))),OM=BK;var UK=ux([Re(it,cr(\"Function\")),SM,OM]),lr=UK;var JK=we(1,lr(Array.isArray)?Array.isArray:Re(it,cr(\"Array\"))),Kp=JK;var HK=ii(Kp,si),wM=HK;var zK=ii(Kp,Sl),jM=zK;var KK=we(1,Re(it,cr(\"String\"))),ur=KK;var WK=qt(\"\"),Bx=WK;function Ux(t){\"@babel/helpers - typeof\";return Ux=typeof Symbol==\"function\"&&typeof Symbol.iterator==\"symbol\"?function(e){return typeof e}:function(e){return e&&typeof Symbol==\"function\"&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e},Ux(t)}var GK=function(e){return Ux(e)===\"object\"},Wp=GK;var YK=we(1,ii(zp,Ax(Wp,lr))),PM=YK;var XK=oi(PM),AM=XK;var QK=lx([ur,AM,Sl]),zo=QK;var ZK=oi(lr),RM=ZK;var eW=we(1,ii(zp,Wp)),_M=eW;var tW=Re(it,cr(\"Object\")),rW=Re(Lo,qt(Lo(Object))),iW=Jn(ii(lr,rW),[\"constructor\"]),oW=we(1,function(t){if(!_M(t)||!tW(t))return!1;var e=Object.getPrototypeOf(t);return Hp(e)?!0:iW(e)}),nt=oW;var sW=we(1,Re(it,cr(\"RegExp\"))),IM=sW;function nW(t){return uW(t)||lW(t)||cW(t)||aW()}function aW(){throw new TypeError(`Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cW(t,e){if(t){if(typeof t==\"string\")return Jx(t,e);var r={}.toString.call(t).slice(8,-1);return r===\"Object\"&&t.constructor&&(r=t.constructor.name),r===\"Map\"||r===\"Set\"?Array.from(t):r===\"Arguments\"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Jx(t,e):void 0}}function lW(t){if(typeof Symbol<\"u\"&&t[Symbol.iterator]!=null||t[\"@@iterator\"]!=null)return Array.from(t)}function uW(t){if(Array.isArray(t))return Jx(t)}function Jx(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}var pW=dx(function(t,e){return t.length>e.length}),fW=Re(Dx(pW),xx,ri(\"length\")),mW=kn(function(t,e,r){var i=r.apply(void 0,nW(t));return bM(i)?kx(i):e}),dW=function(e){var r=fW(e);return we(r,function(){for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return sr(mW(o),void 0,e)})},hW=Vn(jM,dW,Ho),_l=hW;var xW=_x(Ix),en=xW;var yW=we(3,function(t,e,r){var i=Te(t,r),o=Te(Cx(t),r);if(!RM(i)&&!wM(t)){var s=gl(i,o);return px(s,e)}}),tn=yW;var gW=Lx(ur,Pl(/[.*+?^${}()|[\\]\\\\-]/g,\"\\\\$&\")),CM=gW;var vW=function(e,r,i){if(i==null||e==null||r==null)throw TypeError(\"Input values must not be `null` or `undefined`\")},TM=function(e,r){if(typeof e!=\"string\"&&!(e instanceof String))throw TypeError(\"`\".concat(r,\"` must be a string\"))},EW=function(e){if(typeof e!=\"string\"&&!(e instanceof String)&&!(e instanceof RegExp))throw TypeError(\"`searchValue` must be a string or an regexp\")},bW=function(e,r,i){vW(e,r,i),TM(i,\"str\"),TM(r,\"replaceValue\"),EW(e);var o=new RegExp(IM(e)?e:CM(e),\"g\");return Pl(o,r,i)},MM=bW;var SW=we(3,MM),OW=Ln(2,\"replaceAll\"),wW=lr(String.prototype.replaceAll)?OW:SW,Hx=wW;var jW=kn(function(t,e){return Re(Al(\"\"),wx(en(t)),Ol(\"\"))(e)}),zx=jW;var PW=kn(function(t,e){return Re(Al(\"\"),Px(en(t)),Ol(\"\"))(e)}),zn=PW;var ae={};vr(ae,{cwd:()=>Qx,fromFileSystemPath:()=>FM,getExtension:()=>Wx,getHash:()=>Ko,getProtocol:()=>Gp,hasProtocol:()=>AW,isFileSystemPath:()=>Gx,isHttpUrl:()=>Yx,isURI:()=>RW,resolve:()=>Vt,sanitize:()=>Pt,stripHash:()=>be,toFileSystemPath:()=>Xx,unsanitize:()=>pr});var Kx=()=>{var t,e;return/^win/.test((t=(e=globalThis.process)===null||e===void 0?void 0:e.platform)!==null&&t!==void 0?t:\"\")},Gp=t=>{try{let e=new URL(t);return zx(\":\",e.protocol)}catch{return}},AW=Re(Gp,Rl),Wx=t=>{let e=t.lastIndexOf(\".\");return e>=0?t.substring(e).toLowerCase():\"\"},Gx=t=>{if(globalThis.window!==void 0)return!1;let e=Gp(t);return et(e)||e===\"file\"||/^[a-zA-Z]$/.test(e)},Yx=t=>{let e=Gp(t);return e===\"http\"||e===\"https\"},RW=t=>{try{return new URL(t)&&!0}catch{return!1}},Xx=(t,e)=>{let r=[/%23/g,\"#\",/%24/g,\"$\",/%26/g,\"&\",/%2C/g,\",\",/%40/g,\"@\"],i=Hn(!1,\"keepFileProtocol\",e),o=Hn(Kx,\"isWindows\",e),s=decodeURI(t);for(let a=0;a<r.length;a+=2)s=s.replace(r[a],r[a+1]);let n=s.substring(0,7).toLowerCase()===\"file://\";return n&&(s=s[7]===\"/\"?s.substring(8):s.substring(7),o()&&s[1]===\"/\"&&(s=`${s[0]}:${s.substring(1)}`),i?s=`file:///${s}`:(n=!1,s=o()?s:`/${s}`)),o()&&!n&&(s=Hx(\"/\",\"\\\\\",s),s.substring(1,3)===\":\\\\\"&&(s=s[0].toUpperCase()+s.substring(1))),s},FM=t=>{let e=[/\\?/g,\"%3F\",/#/g,\"%23\"],r=t;Kx()&&(r=r.replace(/\\\\/g,\"/\")),r=encodeURI(r);for(let i=0;i<e.length;i+=2)r=r.replace(e[i],e[i+1]);return r},Ko=t=>{let e=t.indexOf(\"#\");return e!==-1?t.substring(e):\"#\"},be=t=>{let e=t.indexOf(\"#\"),r=t;return e>=0&&(r=t.substring(0,e)),r},Qx=()=>{var t,e;if(globalThis.window!==void 0)return be(globalThis.location.href);let r=(t=(e=globalThis.process)===null||e===void 0?void 0:e.cwd())!==null&&t!==void 0?t:\"/\",i=ar(r);return[\"/\",\"\\\\\"].includes(i)?r:r+(Kx()?\"\\\\\":\"/\")},Vt=(t,e)=>{let r=new URL(e,new URL(t,\"resolve://\"));if(r.protocol===\"resolve:\"){let{pathname:i,search:o,hash:s}=r;return i+o+s}return r.toString()},Pt=t=>{if(Gx(t))return FM(Xx(t));try{return new URL(t).toString()}catch{return encodeURI(decodeURI(t)).replace(/%5B/g,\"[\").replace(/%5D/g,\"]\")}},pr=t=>Gx(t)?Xx(t):decodeURI(t);var Zx=class{uri;mediaType;data;parseResult;constructor({uri:e,mediaType:r=\"text/plain\",data:i,parseResult:o}){this.uri=e,this.mediaType=r,this.data=i,this.parseResult=o}get extension(){return ur(this.uri)?Wx(this.uri):\"\"}toString(){return typeof this.data==\"string\"?this.data:this.data instanceof ArrayBuffer||[\"ArrayBuffer\"].includes(it(this.data))||ArrayBuffer.isView(this.data)?new TextDecoder(\"utf-8\").decode(this.data):String(this.data)}},Zt=Zx;var ey=class{rootRef;refs;circular;constructor({refs:e=[],circular:r=!1}={}){this.refs=[],this.circular=r,e.forEach(this.add.bind(this))}get size(){return this.refs.length}add(e){return this.has(e)||(this.refs.push(e),this.rootRef=this.rootRef===void 0?e:this.rootRef,e.refSet=this),this}merge(e){for(let r of e.values())this.add(r);return this}has(e){let r=ur(e)?e:e.uri;return Rl(this.find(i=>i.uri===r))}find(e){return this.refs.find(e)}*values(){yield*this.refs}clean(){this.refs.forEach(e=>{e.refSet=void 0}),this.rootRef=void 0,this.refs.length=0}},gt=ey;var _W={parse:{mediaType:\"text/plain\",parsers:[],parserOpts:{}},resolve:{baseURI:\"\",resolvers:[],resolverOpts:{},strategies:[],strategyOpts:{},internal:!0,external:!0,maxDepth:1/0},dereference:{strategies:[],strategyOpts:{},refSet:null,maxDepth:1/0,circular:\"ignore\",circularReplacer:El,immutable:!0,dereferenceOpts:{}},bundle:{strategies:[],refSet:null,maxDepth:1/0}},Kn=_W;var IW=Tx(Te([\"resolve\",\"baseURI\"]),X([\"resolve\",\"baseURI\"])),CW=t=>Bx(t)?Qx():t,Yp=(t,e)=>{let r=Zs(t,e);return Fx(IW,CW,r)};var ty=class extends he{plugin;constructor(e,r){super(e,{cause:r.cause}),this.plugin=r.plugin}},$M=ty;var La=async(t,e,r)=>{let i=await Promise.all(r.map(tn([t],e)));return r.filter((o,s)=>i[s])},Ba=async(t,e,r)=>{let i;for(let o of r)try{let s=await o[t].call(o,...e);return{plugin:o,result:s}}catch(s){i=new $M(\"Error while running plugin\",{cause:s,plugin:o})}return Promise.reject(i)};var iy=class extends he{},Il=iy;var oy=class extends he{},Wn=oy;var sy=class extends Wn{},Cl=sy;var ny=class extends Cl{},Xp=ny;var kM=\"apidom-file-cache\",TW=async({cacheKey:t,cacheTTL:e})=>{if(e===0)return{cachedResult:null,cachedError:null};try{let r=await caches.open(kM),i=await r.match(t);if(i){let{cachedResult:o,cachedError:s,timestamp:n}=await i.json();if(Date.now()-n<e)return{cachedResult:o,cachedError:s};await r.delete(t)}}catch{return console.log(\"There was an error parsing the response\"),{cachedResult:null,cachedError:null}}return{cachedResult:null,cachedError:null}},NM=async({cacheKey:t,result:e,error:r,cacheTTL:i})=>{if(i!==0)try{let o={cachedResult:e,cachedError:r,timestamp:Date.now()},s=await caches.open(kM),n=new Response(JSON.stringify(o),{headers:{\"Content-Type\":\"application/json\"}});await s.put(t,n)}catch{console.error(\"CacheStorage is not available\")}},DM=async(t,e)=>{let{cacheTTL:r=0}=e.resolve.resolverOpts,i=`read_${t.uri}`,{cachedResult:o,cachedError:s}=await TW({cacheKey:i,cacheTTL:r});if(o!==null)return o;if(s!==null)throw new Wn(`Error while reading file \"${t.uri}\"`,{cause:s});let n=e.resolve.resolvers.map(f=>{let m=Object.create(f);return Object.assign(m,e.resolve.resolverOpts)}),a=await La(\"canRead\",[t,e],n);if(si(a))throw new Xp(t.uri);try{let{result:f}=await Ba(\"read\",[t],a),m=new Zt({...t,data:f}).toString();return await NM({cacheKey:i,result:m,error:null,cacheTTL:r}),f}catch(f){var p,l,u;throw await NM({cacheKey:i,result:null,error:(p=(l=f==null||(u=f.cause)===null||u===void 0?void 0:u.cause)!==null&&l!==void 0?l:f?.cause)!==null&&p!==void 0?p:f,cacheTTL:r}),new Wn(`Error while reading file \"${t.uri}\"`,{cause:f})}};var MW=async(t,e)=>{let r=e.parse.parsers.map(o=>{let s=Object.create(o);return Object.assign(s,e.parse.parserOpts)}),i=await La(\"canParse\",[t,e],r);if(si(i))throw new Xp(t.uri);try{let{plugin:o,result:s}=await Ba(\"parse\",[t,e],i);return!o.allowEmpty&&s.isEmpty?Promise.reject(new Il(`Error while parsing file \"${t.uri}\". File is empty.`)):s}catch(o){throw new Il(`Error while parsing file \"${t.uri}\"`,{cause:o})}},FW=async(t,e)=>{let r=new Zt({uri:Pt(be(t)),mediaType:e.parse.mediaType}),i=await DM(r,e);return MW(new Zt({...r,data:i}),e)},Qp=FW;var Vy={};vr(Vy,{hasElementSourceMap:()=>Or,includesClasses:()=>At,includesSymbols:()=>lk,isAnnotationElement:()=>ck,isArrayElement:()=>Pe,isBooleanElement:()=>Br,isCommentElement:()=>XQ,isElement:()=>Se,isLinkElement:()=>lf,isMemberElement:()=>Ue,isNullElement:()=>Qa,isNumberElement:()=>Xa,isObjectElement:()=>ne,isParseResultElement:()=>pf,isPrimitiveElement:()=>ft,isRefElement:()=>uf,isStringElement:()=>z});var at=Le(Cr(),1);var ok=Le(Cr(),1),ky=class extends ok.StringElement{constructor(e,r,i){super(e,r,i),this.element=\"annotation\"}get code(){return this.attributes.get(\"code\")}set code(e){this.attributes.set(\"code\",e)}},nn=ky;var sk=Le(Cr(),1),Dy=class extends sk.StringElement{constructor(e,r,i){super(e,r,i),this.element=\"comment\"}},an=Dy;var nk=Le(Cr(),1);var qy=class extends nk.ArrayElement{constructor(e,r,i){super(e,r,i),this.element=\"parseResult\"}get api(){return this.children.filter(e=>e.classes.contains(\"api\")).first}get results(){return this.children.filter(e=>e.classes.contains(\"result\"))}get result(){return this.results.first}get annotations(){return this.children.filter(e=>e.element===\"annotation\")}get warnings(){return this.children.filter(e=>e.element===\"annotation\"&&e.classes.contains(\"warning\"))}get errors(){return this.children.filter(e=>e.element===\"annotation\"&&e.classes.contains(\"error\"))}get isEmpty(){return this.children.reject(e=>e.element===\"annotation\").isEmpty}replaceResult(e){let{result:r}=this;if(et(r))return!1;let i=this.content.findIndex(o=>o===r);return i===-1?!1:(this.content[i]=e,!0)}},Be=qy;var ak=Le(Cr(),1),zQ=(t,e)=>typeof e==\"object\"&&e!==null&&t in e&&typeof e[t]==\"function\",KQ=t=>typeof t==\"object\"&&t!=null&&\"_storedElement\"in t&&typeof t._storedElement==\"string\"&&\"_content\"in t,WQ=(t,e)=>typeof e==\"object\"&&e!==null&&\"primitive\"in e?typeof e.primitive==\"function\"&&e.primitive()===t:!1,GQ=(t,e)=>typeof e==\"object\"&&e!==null&&\"classes\"in e&&(Array.isArray(e.classes)||e.classes instanceof ak.ArrayElement)&&e.classes.includes(t),Wo=(t,e)=>typeof e==\"object\"&&e!==null&&\"element\"in e&&e.element===t,YQ=t=>t({hasMethod:zQ,hasBasicElementProps:KQ,primitiveEq:WQ,isElementType:Wo,hasClass:GQ}),B=YQ;var Se=B(({hasBasicElementProps:t,primitiveEq:e})=>r=>r instanceof at.Element||t(r)&&e(void 0,r)),z=B(({hasBasicElementProps:t,primitiveEq:e})=>r=>r instanceof at.StringElement||t(r)&&e(\"string\",r)),Xa=B(({hasBasicElementProps:t,primitiveEq:e})=>r=>r instanceof at.NumberElement||t(r)&&e(\"number\",r)),Qa=B(({hasBasicElementProps:t,primitiveEq:e})=>r=>r instanceof at.NullElement||t(r)&&e(\"null\",r)),Br=B(({hasBasicElementProps:t,primitiveEq:e})=>r=>r instanceof at.BooleanElement||t(r)&&e(\"boolean\",r)),ne=B(({hasBasicElementProps:t,primitiveEq:e,hasMethod:r})=>i=>i instanceof at.ObjectElement||t(i)&&e(\"object\",i)&&r(\"keys\",i)&&r(\"values\",i)&&r(\"items\",i)),Pe=B(({hasBasicElementProps:t,primitiveEq:e,hasMethod:r})=>i=>i instanceof at.ArrayElement&&!(i instanceof at.ObjectElement)||t(i)&&e(\"array\",i)&&r(\"push\",i)&&r(\"unshift\",i)&&r(\"map\",i)&&r(\"reduce\",i)),Ue=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof at.MemberElement||t(i)&&e(\"member\",i)&&r(void 0,i)),lf=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof at.LinkElement||t(i)&&e(\"link\",i)&&r(void 0,i)),uf=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof at.RefElement||t(i)&&e(\"ref\",i)&&r(void 0,i)),ck=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof nn||t(i)&&e(\"annotation\",i)&&r(\"array\",i)),XQ=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof an||t(i)&&e(\"comment\",i)&&r(\"string\",i)),pf=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Be||t(i)&&e(\"parseResult\",i)&&r(\"array\",i)),ft=t=>Wo(\"object\",t)||Wo(\"array\",t)||Wo(\"boolean\",t)||Wo(\"number\",t)||Wo(\"string\",t)||Wo(\"null\",t)||Wo(\"member\",t),Or=t=>Se(t)?Number.isInteger(t.startPositionRow)&&Number.isInteger(t.startPositionColumn)&&Number.isInteger(t.startIndex)&&Number.isInteger(t.endPositionRow)&&Number.isInteger(t.endPositionColumn)&&Number.isInteger(t.endIndex):!1,lk=(t,e)=>{if(t.length===0)return!0;let r=e.attributes.get(\"symbols\");return Pe(r)?ka(en(r.toValue()),t):!1},At=(t,e)=>t.length===0?!0:ka(en(e.classes.toValue()),t);var uk=Le(Cr(),1);var Hl=class extends uk.Namespace{constructor(){super(),this.register(\"annotation\",nn),this.register(\"comment\",an),this.register(\"parseResult\",Be)}},QQ=new Hl,Ye=t=>{let e=new Hl;return nt(t)&&e.use(t),e},zl=QQ;var ZQ=()=>({predicates:{...Vy},namespace:zl}),ff=ZQ;var Kl=(t,e,r)=>{let i=t[e];if(i!=null){if(!r&&typeof i==\"function\")return i;let o=r?i.leave:i.enter;if(typeof o==\"function\")return o}else{let o=r?t.leave:t.enter;if(o!=null){if(typeof o==\"function\")return o;let s=o[e];if(typeof s==\"function\")return s}}return null},ce={},Za=t=>t?.type,Ly=t=>typeof Za(t)==\"string\",Wl=t=>Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t)),ni=(t,{visitFnGetter:e=Kl,nodeTypeGetter:r=Za,breakSymbol:i=ce,deleteNodeSymbol:o=null,skipVisitingNodeSymbol:s=!1,exposeEdits:n=!1}={})=>{let a=Symbol(\"skip\"),p=new Array(t.length).fill(a);return{enter(l,u,f,m,x,h){let O=l,j=!1,v={...h,replaceWith(E,y){h.replaceWith(E,y),O=E}};for(let E=0;E<t.length;E+=1)if(p[E]===a){let y=e(t[E],r(O),!1);if(typeof y==\"function\"){let g=y.call(t[E],O,u,f,m,x,v);if(typeof g?.then==\"function\")throw new yt(\"Async visitor not supported in sync mode\",{visitor:t[E],visitFn:y});if(g===s)p[E]=O;else if(g===i)p[E]=i;else{if(g===o)return g;if(g!==void 0)if(n)O=g,j=!0;else return g}}}return j?O:void 0},leave(l,u,f,m,x,h){let O=l,j={...h,replaceWith(v,E){h.replaceWith(v,E),O=v}};for(let v=0;v<t.length;v+=1)if(p[v]===a){let E=e(t[v],r(O),!0);if(typeof E==\"function\"){let y=E.call(t[v],O,u,f,m,x,j);if(typeof y?.then==\"function\")throw new yt(\"Async visitor not supported in sync mode\",{visitor:t[v],visitFn:E});if(y===i)p[v]=i;else if(y!==void 0&&y!==s)return y}}else p[v]===O&&(p[v]=a)}}},eZ=(t,{visitFnGetter:e=Kl,nodeTypeGetter:r=Za,breakSymbol:i=ce,deleteNodeSymbol:o=null,skipVisitingNodeSymbol:s=!1,exposeEdits:n=!1}={})=>{let a=Symbol(\"skip\"),p=new Array(t.length).fill(a);return{async enter(l,u,f,m,x,h){let O=l,j=!1,v={...h,replaceWith(E,y){h.replaceWith(E,y),O=E}};for(let E=0;E<t.length;E+=1)if(p[E]===a){let y=e(t[E],r(O),!1);if(typeof y==\"function\"){let g=await y.call(t[E],O,u,f,m,x,v);if(g===s)p[E]=O;else if(g===i)p[E]=i;else{if(g===o)return g;if(g!==void 0)if(n)O=g,j=!0;else return g}}}return j?O:void 0},async leave(l,u,f,m,x,h){let O=l,j={...h,replaceWith(v,E){h.replaceWith(v,E),O=v}};for(let v=0;v<t.length;v+=1)if(p[v]===a){let E=e(t[v],r(O),!0);if(typeof E==\"function\"){let y=await E.call(t[v],O,u,f,m,x,j);if(y===i)p[v]=i;else if(y!==void 0&&y!==s)return y}}else p[v]===O&&(p[v]=a)}}};ni[Symbol.for(\"nodejs.util.promisify.custom\")]=eZ;var Gl=(t,e,{keyMap:r=null,state:i={},breakSymbol:o=ce,deleteNodeSymbol:s=null,skipVisitingNodeSymbol:n=!1,visitFnGetter:a=Kl,nodeTypeGetter:p=Za,nodePredicate:l=Ly,nodeCloneFn:u=Wl,detectCycles:f=!0,detectCyclesCallback:m=null}={})=>{let x=r||{},h,O=Array.isArray(t),j=[t],v=-1,E,y=[],g=t,q=[],V=[];do{v+=1;let M=v===j.length,te,H=M&&y.length!==0;if(M){if(te=V.length===0?void 0:q.pop(),g=E,E=V.pop(),H)if(O){g=g.slice();let W=0;for(let[Z,pe]of y){let re=Z-W;pe===s?(g.splice(re,1),W+=1):g[re]=pe}}else{g=u(g);for(let[W,Z]of y)g[W]=Z}v=h.index,j=h.keys,y=h.edits,O=h.inArray,h=h.prev}else if(E!==s&&E!==void 0){if(te=O?v:j[v],g=E[te],g===s||g===void 0)continue;q.push(te)}let k;if(!Array.isArray(g)){var C;if(!l(g))throw new yt(`Invalid AST Node:  ${String(g)}`,{node:g});if(f&&V.includes(g)){typeof m==\"function\"&&m(g,te,E,q,V),q.pop();continue}let W=a(e,p(g),M);if(W){for(let[pe,re]of Object.entries(i))e[pe]=re;let Z={replaceWith(pe,re){typeof re==\"function\"?re(pe,g,te,E,q,V):E&&(E[te]=pe),M||(g=pe)}};k=W.call(e,g,te,E,q,V,Z)}if(typeof((C=k)===null||C===void 0?void 0:C.then)==\"function\")throw new yt(\"Async visitor not supported in sync mode\",{visitor:e,visitFn:W});if(k===o)break;if(k===n){if(!M){q.pop();continue}}else if(k!==void 0&&(y.push([te,k]),!M))if(l(k))g=k;else{q.pop();continue}}if(k===void 0&&H&&y.push([te,g]),!M){var oe;h={inArray:O,index:v,keys:j,edits:y,prev:h},O=Array.isArray(g),j=O?g:(oe=x[p(g)])!==null&&oe!==void 0?oe:[],v=-1,y=[],E!==s&&E!==void 0&&V.push(E),E=g}}while(h!==void 0);return y.length!==0?y[y.length-1][1]:t};Gl[Symbol.for(\"nodejs.util.promisify.custom\")]=async(t,e,{keyMap:r=null,state:i={},breakSymbol:o=ce,deleteNodeSymbol:s=null,skipVisitingNodeSymbol:n=!1,visitFnGetter:a=Kl,nodeTypeGetter:p=Za,nodePredicate:l=Ly,nodeCloneFn:u=Wl,detectCycles:f=!0,detectCyclesCallback:m=null}={})=>{let x=r||{},h,O=Array.isArray(t),j=[t],v=-1,E,y=[],g=t,q=[],V=[];do{v+=1;let oe=v===j.length,M,te=oe&&y.length!==0;if(oe){if(M=V.length===0?void 0:q.pop(),g=E,E=V.pop(),te)if(O){g=g.slice();let k=0;for(let[W,Z]of y){let pe=W-k;Z===s?(g.splice(pe,1),k+=1):g[pe]=Z}}else{g=u(g);for(let[k,W]of y)g[k]=W}v=h.index,j=h.keys,y=h.edits,O=h.inArray,h=h.prev}else if(E!==s&&E!==void 0){if(M=O?v:j[v],g=E[M],g===s||g===void 0)continue;q.push(M)}let H;if(!Array.isArray(g)){if(!l(g))throw new yt(`Invalid AST Node: ${String(g)}`,{node:g});if(f&&V.includes(g)){typeof m==\"function\"&&m(g,M,E,q,V),q.pop();continue}let k=a(e,p(g),oe);if(k){for(let[Z,pe]of Object.entries(i))e[Z]=pe;let W={replaceWith(Z,pe){typeof pe==\"function\"?pe(Z,g,M,E,q,V):E&&(E[M]=Z),oe||(g=Z)}};H=await k.call(e,g,M,E,q,V,W)}if(H===o)break;if(H===n){if(!oe){q.pop();continue}}else if(H!==void 0&&(y.push([M,H]),!oe))if(l(H))g=H;else{q.pop();continue}}if(H===void 0&&te&&y.push([M,g]),!oe){var C;h={inArray:O,index:v,keys:j,edits:y,prev:h},O=Array.isArray(g),j=O?g:(C=x[p(g)])!==null&&C!==void 0?C:[],v=-1,y=[],E!==s&&E!==void 0&&V.push(E),E=g}}while(h!==void 0);return y.length!==0?y[y.length-1][1]:t};var Bt=Le(Cr(),1);var By=class extends yt{value;constructor(e,r){super(e,r),typeof r<\"u\"&&(this.value=r.value)}},mf=By;var Uy=class extends mf{},pk=Uy;var Jy=class extends mf{},fk=Jy;var Rt=(t,e)=>{let r=nr(t,e);return Mx(i=>{if(nt(i)&&Uo(\"$ref\",i)&&$x(ur,\"$ref\",i)){let o=Te([\"$ref\"],i),s=zn(\"#/\",o);return Te(s.split(\"/\"),r)}return nt(i)?Rt(i,r):i},t)},Qn=(t,e)=>(t.startPositionRow=e?.startPositionRow,t.startPositionColumn=e?.startPositionColumn,t.startIndex=e?.startIndex,t.endPositionRow=e?.endPositionRow,t.endPositionColumn=e?.endPositionColumn,t.endIndex=e?.endIndex,t);var $=(t,e={})=>{let{visited:r=new WeakMap}=e,i={...e,visited:r};if(r.has(t))return r.get(t);if(t instanceof Bt.KeyValuePair){let{key:o,value:s}=t,n=Se(o)?$(o,i):o,a=Se(s)?$(s,i):s,p=new Bt.KeyValuePair(n,a);return r.set(t,p),p}if(t instanceof Bt.ObjectSlice){let o=a=>$(a,i),s=[...t].map(o),n=new Bt.ObjectSlice(s);return r.set(t,n),n}if(t instanceof Bt.ArraySlice){let o=a=>$(a,i),s=[...t].map(o),n=new Bt.ArraySlice(s);return r.set(t,n),n}if(Se(t)){let o=Ae(t);if(r.set(t,o),t.content)if(Se(t.content))o.content=$(t.content,i);else if(t.content instanceof Bt.KeyValuePair)o.content=$(t.content,i);else if(Array.isArray(t.content)){let s=n=>$(n,i);o.content=t.content.map(s)}else o.content=t.content;else o.content=t.content;return o}throw new pk(\"Value provided to cloneDeep function couldn't be cloned\",{value:t})};$.safe=t=>{try{return $(t)}catch{return t}};var mk=t=>{let{key:e,value:r}=t;return new Bt.KeyValuePair(e,r)},tZ=t=>{let e=[...t];return new Bt.ArraySlice(e)},rZ=t=>{let e=[...t];return new Bt.ObjectSlice(e)},dk=t=>{let e=new t.constructor;if(e.element=t.element,Or(t)&&Qn(e,t),t.meta.length>0&&(e._meta=$(t.meta)),t.attributes.length>0&&(e._attributes=$(t.attributes)),Se(t.content)){let r=t.content;e.content=dk(r)}else Array.isArray(t.content)?e.content=[...t.content]:t.content instanceof Bt.KeyValuePair?e.content=mk(t.content):e.content=t.content;return e},Ae=t=>{if(t instanceof Bt.KeyValuePair)return mk(t);if(t instanceof Bt.ObjectSlice)return rZ(t);if(t instanceof Bt.ArraySlice)return tZ(t);if(Se(t))return dk(t);throw new fk(\"Value provided to cloneShallow function couldn't be cloned\",{value:t})};Ae.safe=t=>{try{return Ae(t)}catch{return t}};var Ro=t=>ne(t)?\"ObjectElement\":Pe(t)?\"ArrayElement\":Ue(t)?\"MemberElement\":z(t)?\"StringElement\":Br(t)?\"BooleanElement\":Xa(t)?\"NumberElement\":Qa(t)?\"NullElement\":lf(t)?\"LinkElement\":uf(t)?\"RefElement\":void 0,Hy=t=>Se(t)?Ae(t):Wl(t),hk=Re(Ro,ur),ct={ObjectElement:[\"content\"],ArrayElement:[\"content\"],MemberElement:[\"key\",\"value\"],StringElement:[],BooleanElement:[],NumberElement:[],NullElement:[],RefElement:[],LinkElement:[],Annotation:[],Comment:[],ParseResultElement:[\"content\"]},ec=class{result;predicate;returnOnTrue;returnOnFalse;constructor({predicate:e=Mn,returnOnTrue:r,returnOnFalse:i}={}){this.result=[],this.predicate=e,this.returnOnTrue=r,this.returnOnFalse=i}enter(e){return this.predicate(e)?(this.result.push(e),this.returnOnTrue):this.returnOnFalse}},ve=(t,e,{keyMap:r=ct,...i}={})=>Gl(t,e,{keyMap:r,nodeTypeGetter:Ro,nodePredicate:hk,nodeCloneFn:Hy,...i});ve[Symbol.for(\"nodejs.util.promisify.custom\")]=async(t,e,{keyMap:r=ct,...i}={})=>Gl[Symbol.for(\"nodejs.util.promisify.custom\")](t,e,{keyMap:r,nodeTypeGetter:Ro,nodePredicate:hk,nodeCloneFn:Hy,...i});var xk={toolboxCreator:ff,visitorOptions:{nodeTypeGetter:Ro,exposeEdits:!0}},Xe=(t,e,r={})=>{if(e.length===0)return t;let i=Zs(xk,r),{toolboxCreator:o,visitorOptions:s}=i,n=o(),a=e.map(u=>u(n)),p=ni(a.map(Hn({},\"visitor\")),{...s});a.forEach(tn([\"pre\"],[]));let l=ve(t,p,s);return a.forEach(tn([\"post\"],[])),l},iZ=async(t,e,r={})=>{if(e.length===0)return t;let i=Zs(xk,r),{toolboxCreator:o,visitorOptions:s}=i,n=o(),a=e.map(m=>m(n)),p=ni[Symbol.for(\"nodejs.util.promisify.custom\")],l=ve[Symbol.for(\"nodejs.util.promisify.custom\")],u=p(a.map(Hn({},\"visitor\")),{...s});await Promise.allSettled(a.map(tn([\"pre\"],[])));let f=await l(t,u,s);return await Promise.allSettled(a.map(tn([\"post\"],[]))),f};Xe[Symbol.for(\"nodejs.util.promisify.custom\")]=iZ;var vk=Le(Cr(),1),Ek=Le(yk(),1);var Wy=class extends yt{value;constructor(e,r){super(e,r),typeof r<\"u\"&&(this.value=r.value)}},gk=Wy;var Ur=class{uuid;identityMap;constructor({length:e=6}={}){this.uuid=new Ek.default({length:e}),this.identityMap=new WeakMap}identify(e){if(!Se(e))throw new gk(\"Cannot not identify the element. `element` is neither structurally compatible nor a subclass of an Element class.\",{value:e});if(e.meta.hasKey(\"id\")&&z(e.meta.get(\"id\"))&&!e.meta.get(\"id\").equals(\"\"))return e.id;if(this.identityMap.has(e))return this.identityMap.get(e);let r=new vk.StringElement(this.generateId());return this.identityMap.set(e,r),r}forget(e){return this.identityMap.has(e)?(this.identityMap.delete(e),!0):!1}generateId(){return this.uuid.randomUUID()}},oZ=new Ur;var Gy=class extends Array{unknownMediaType=\"application/octet-stream\";filterByFormat(){throw new fl(\"filterByFormat method in MediaTypes class is not yet implemented.\")}findBy(){throw new fl(\"findBy method in MediaTypes class is not yet implemented.\")}latest(){throw new fl(\"latest method in MediaTypes class is not yet implemented.\")}},Yl=Gy;var Ne=Le(Cr(),1);var S=Le(Cr(),1);var sZ=(t,{Type:e,plugins:r=[]})=>{let i=new e(t);return Se(t)&&(t.meta.length>0&&(i.meta=$(t.meta)),t.attributes.length>0&&(i.attributes=$(t.attributes))),Xe(i,r,{toolboxCreator:ff,visitorOptions:{nodeTypeGetter:Ro}})},Jr=t=>(e,r={})=>sZ(e,{...r,Type:t});S.ObjectElement.refract=Jr(S.ObjectElement);S.ArrayElement.refract=Jr(S.ArrayElement);S.StringElement.refract=Jr(S.StringElement);S.BooleanElement.refract=Jr(S.BooleanElement);S.NullElement.refract=Jr(S.NullElement);S.NumberElement.refract=Jr(S.NumberElement);S.LinkElement.refract=Jr(S.LinkElement);S.RefElement.refract=Jr(S.RefElement);nn.refract=Jr(nn);an.refract=Jr(an);Be.refract=Jr(Be);var bk=Le(Cr(),1);var nZ=(t,e)=>{let r=new ec({predicate:t});return ve(e,r),new bk.ArraySlice(r.result)},tc=nZ;var aZ=(t,e)=>{let r=new ec({predicate:t,returnOnTrue:ce});return ve(e,r),Un(void 0,[0],r.result)},ai=aZ;var df=(t,e=new WeakMap)=>(Ue(t)?(e.set(t.key,t),df(t.key,e),e.set(t.value,t),df(t.value,e)):t.children.forEach(r=>{e.set(r,t),df(r,e)}),e),cZ=(t,e,r)=>{let i=r.get(t);Ue(i)&&(i.key===t&&(i.key=e,r.delete(t),r.set(e,i)),i.value===t&&(i.value=e,r.delete(t),r.set(e,i)))},lZ=(t,e,r)=>{let i=r.get(t);ne(i)&&(i.content=i.map((o,s,n)=>n===t?(r.delete(t),r.set(e,i),e):n))},uZ=(t,e,r)=>{let i=r.get(t);Pe(i)&&(i.content=i.map(o=>o===t?(r.delete(t),r.set(e,i),e):o))},Yy=class{element;edges;constructor({element:e}){this.element=e}transclude(e,r){var i;if(e===this.element)return r;if(e===r)return this.element;this.edges=(i=this.edges)!==null&&i!==void 0?i:df(this.element);let o=this.edges.get(e);if(!et(o))return ne(o)?lZ(e,r,this.edges):Pe(o)?uZ(e,r,this.edges):Ue(o)&&cZ(e,r,this.edges),this.element}},Sk=Yy;var Xl=(t,e,r)=>new Sk({element:r}).transclude(t,e);var pZ=(t,e=zl)=>{if(ur(t))try{return e.fromRefract(JSON.parse(t))}catch{}return nt(t)&&Uo(\"element\",t)?e.fromRefract(t):e.toElement(t)},Ql=pZ;var Ok=t=>typeof t?.type==\"string\"?t.type:Ro(t),wk={EphemeralObject:[\"content\"],EphemeralArray:[\"content\"],...ct},Xy=(t,e,{keyMap:r=wk,...i}={})=>ve(t,e,{keyMap:r,nodeTypeGetter:Ok,nodePredicate:wt,detectCycles:!1,deleteNodeSymbol:Symbol.for(\"delete-node\"),skipVisitingNodeSymbol:Symbol.for(\"skip-visiting-node\"),...i});Xy[Symbol.for(\"nodejs.util.promisify.custom\")]=async(t,{keyMap:e=wk,...r}={})=>ve[Symbol.for(\"nodejs.util.promisify.custom\")](t,visitor,{keyMap:e,nodeTypeGetter:Ok,nodePredicate:wt,detectCycles:!1,deleteNodeSymbol:Symbol.for(\"delete-node\"),skipVisitingNodeSymbol:Symbol.for(\"skip-visiting-node\"),...r});var Qy=class{type=\"EphemeralArray\";content=[];reference=void 0;constructor(e){this.content=e,this.reference=[]}toReference(){return this.reference}toArray(){return this.reference.push(...this.content),this.reference}},jk=Qy;var Zy=class{type=\"EphemeralObject\";content=[];reference=void 0;constructor(e){this.content=e,this.reference={}}toReference(){return this.reference}toObject(){return Object.assign(this.reference,Object.fromEntries(this.content))}},Pk=Zy;var eg=class{ObjectElement={enter:e=>{if(this.references.has(e))return this.references.get(e).toReference();let r=new Pk(e.content);return this.references.set(e,r),r}};EphemeralObject={leave:e=>e.toObject()};MemberElement={enter:e=>[e.key,e.value]};ArrayElement={enter:e=>{if(this.references.has(e))return this.references.get(e).toReference();let r=new jk(e.content);return this.references.set(e,r),r}};EphemeralArray={leave:e=>e.toArray()};references=new WeakMap;BooleanElement(e){return e.toValue()}NumberElement(e){return e.toValue()}StringElement(e){return e.toValue()}NullElement(){return null}RefElement(e,...r){var i;let o=r[3];return((i=o[o.length-1])===null||i===void 0?void 0:i.type)===\"EphemeralObject\"?Symbol.for(\"delete-node\"):String(e.toValue())}LinkElement(e){return z(e.href)?e.href.toValue():\"\"}},fZ=t=>Se(t)?z(t)||Xa(t)||Br(t)||Qa(t)?t.toValue():Xy(t,new eg):t,b=fZ;var Ak=Le(Cr(),1);var xf=t=>{let e=t.meta.length>0?$(t.meta):void 0,r=t.attributes.length>0?$(t.attributes):void 0;return new t.constructor(void 0,e,r)},yf=(t,e)=>e.clone&&e.isMergeableElement(t)?rc(xf(t),t,e):t,mZ=(t,e)=>{if(typeof e.customMerge!=\"function\")return rc;let r=e.customMerge(t,e);return typeof r==\"function\"?r:rc},dZ=t=>typeof t.customMetaMerge!=\"function\"?e=>$(e):t.customMetaMerge,hZ=t=>typeof t.customAttributesMerge!=\"function\"?e=>$(e):t.customAttributesMerge,xZ=(t,e,r)=>t.concat(e)[\"fantasy-land/map\"](i=>yf(i,r)),yZ=(t,e,r)=>{let i=ne(t)?xf(t):xf(e);return ne(t)&&t.forEach((o,s,n)=>{let a=Ae(n);a.value=yf(o,r),i.content.push(a)}),e.forEach((o,s,n)=>{let a=b(s),p;if(ne(t)&&t.hasKey(a)&&r.isMergeableElement(o)){let l=t.get(a);p=Ae(n),p.value=mZ(s,r)(l,o,r)}else p=Ae(n),p.value=yf(o,r);i.remove(a),i.content.push(p)}),i},hf={clone:!0,isMergeableElement:t=>ne(t)||Pe(t),arrayElementMerge:xZ,objectElementMerge:yZ,customMerge:void 0,customMetaMerge:void 0,customAttributesMerge:void 0},rc=(t,e,r)=>{var i,o,s;let n={...hf,...r};n.isMergeableElement=(i=n.isMergeableElement)!==null&&i!==void 0?i:hf.isMergeableElement,n.arrayElementMerge=(o=n.arrayElementMerge)!==null&&o!==void 0?o:hf.arrayElementMerge,n.objectElementMerge=(s=n.objectElementMerge)!==null&&s!==void 0?s:hf.objectElementMerge;let a=Pe(e),p=Pe(t);if(!(a===p))return yf(e,n);let u=a&&typeof n.arrayElementMerge==\"function\"?n.arrayElementMerge(t,e,n):n.objectElementMerge(t,e,n);return u.meta=dZ(n)(t.meta,e.meta),u.attributes=hZ(n)(t.attributes,e.attributes),u};rc.all=(t,e)=>{if(!Array.isArray(t))throw new TypeError(\"First argument of deepmerge should be an array.\");return t.length===0?new Ak.ObjectElement:t.reduce((r,i)=>rc(r,i,e),xf(t[0]))};var fr=rc;var tg=class extends he{},ic=tg;var rg=class extends ic{},gf=rg;var Rk=async(t,e)=>{let r=t,i=!1;if(!pf(t)){let n=Ae(t);n.classes.push(\"result\"),r=new Be([n]),i=!0}let o=new Zt({uri:e.resolve.baseURI,parseResult:r,mediaType:e.parse.mediaType}),s=await La(\"canDereference\",[o,e],e.dereference.strategies);if(si(s))throw new gf(o.uri);try{let{result:n}=await Ba(\"dereference\",[o,e],s);return i?n.get(0):n}catch(n){throw new ic(`Error while dereferencing file \"${o.uri}\"`,{cause:n})}};var ig=class{name;allowEmpty;sourceMap;fileExtensions;mediaTypes;constructor({name:e,allowEmpty:r=!0,sourceMap:i=!1,fileExtensions:o=[],mediaTypes:s=[]}){this.name=e,this.allowEmpty=r,this.sourceMap=i,this.fileExtensions=o,this.mediaTypes=s}},mr=ig;var og=class{name;constructor({name:e}){this.name=e}},_k=og;var sg=class extends _k{timeout;redirects;withCredentials;constructor(e){let{name:r=\"http-resolver\",timeout:i=5e3,redirects:o=5,withCredentials:s=!1}=e??{};super({name:r}),this.timeout=i,this.redirects=o,this.withCredentials=s}canRead(e){return Yx(e.uri)}},ng=sg;var ag=class{name;constructor({name:e}){this.name=e}},Ik=ag;var cg=class{name;constructor({name:e}){this.name=e}},vf=cg;var _o=class extends Array{includesCycle(e){return this.filter(r=>r.has(e)).length>1}includes(e,r){return e instanceof Set?super.includes(e,r):this.some(i=>i.has(e))}findItem(e){for(let r of this)for(let i of r)if(Se(i)&&e(i))return i}};var lg=class{uri;depth;value;refSet;errors;constructor({uri:e,depth:r=0,refSet:i,value:o}){this.uri=e,this.value=o,this.depth=r,this.refSet=i,this.errors=[]}},He=lg;var ug=class extends he{},Ef=ug;var pg=class extends Ef{},bf=pg;var fg=class extends he{},Ck=fg;var mg=class extends Ck{},Hr=mg;var dg=class extends Ef{constructor(e){super(`Invalid JSON Schema $anchor \"${e}\".`)}},Sf=dg;var hg=class extends ic{},Ut=hg;var xg=class extends Wn{},Of=xg;var yg=class extends Il{},lt=yg;var wf=async(t,e={})=>{let r=Yp(Kn,e);return Rk(t,r)};var Vk=Le(Er());var Fk=t=>Object.prototype.toString.call(t),gg=t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),$k=Array.isArray,Nk=t=>{let e=Fk(t);return e===\"[object Boolean]\"||e===\"[object Number]\"||e===\"[object String]\"},gZ=Object.getOwnPropertyDescriptor,vZ=Object.prototype.propertyIsEnumerable,EZ=Object.getOwnPropertySymbols,jf=Object.prototype.hasOwnProperty,Tk=t=>t===\"__proto__\"||t===\"constructor\"||t===\"prototype\";function Pf(t,e,r){e===\"__proto__\"?Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0}):t[e]=r}function kk(t,e){if(e!==void 0&&t>e)throw new RangeError(`neotraverse: maximum traversal depth (${e}) exceeded`)}function vg(t){let e=Object.keys(t),r=EZ(t);for(let i=0;i<r.length;i++)vZ.call(t,r[i])&&e.push(r[i]);return e}function bZ(t,e){var r;return!(!((r=gZ(t,e))===null||r===void 0)&&r.writable)}function Dk(t,e){if(typeof t==\"object\"&&t!==null){let r;if($k(t))r=[];else{if(gg(t))return t.slice();if(Nk(t))return Object(t);{let o=Fk(t);o===\"[object Date]\"&&typeof t.getTime==\"function\"?r=new Date(t.getTime()):o===\"[object RegExp]\"&&typeof t.source==\"string\"?r=new RegExp(t):o===\"[object Error]\"?r={message:t.message}:r=Object.create(Object.getPrototypeOf(t))}}let i=e.includeSymbols?vg:Object.keys;for(let o of i(t))Pf(r,o,t[o]);return r}return t}var qk={includeSymbols:!1,immutable:!1};function Mk(t,e,r=qk){let i=[],o=[],s=!0,n=r.includeSymbols?vg:Object.keys,a=!!r.immutable,p=r.maxDepth;return(function l(u){kk(i.length,p);let f=a?Dk(u,r):u,m={},x=!0,h={node:f,node_:u,path:i.slice(),parent:o[o.length-1],parents:o,key:i[i.length-1],isRoot:i.length===0,level:i.length,circular:void 0,isLeaf:!1,notLeaf:!0,notRoot:!0,isFirst:!1,isLast:!1,update:function(E,y=!1){h.isRoot||Pf(h.parent.node,h.key,E),h.node=E,y&&(x=!1)},delete:function(E){delete h.parent.node[h.key],E&&(x=!1)},remove:function(E){$k(h.parent.node)?h.parent.node.splice(h.key,1):delete h.parent.node[h.key],E&&(x=!1)},keys:null,before:function(E){m.before=E},after:function(E){m.after=E},pre:function(E){m.pre=E},post:function(E){m.post=E},stop:function(){s=!1},block:function(){x=!1}};if(!s)return h;function O(){if(typeof h.node==\"object\"&&h.node!==null){(!h.keys||h.node_!==h.node)&&(h.keys=n(h.node)),h.isLeaf=h.keys.length===0;for(let E=0;E<o.length;E++)if(o[E].node_===u){h.circular=o[E];break}}else h.isLeaf=!0,h.keys=null;h.notLeaf=!h.isLeaf,h.notRoot=!h.isRoot}O();let j=e.call(h,h.node);if(j!==void 0&&h.update&&h.update(j),m.before&&m.before.call(h,h.node),!x)return h;if(typeof h.node==\"object\"&&h.node!==null&&!h.circular){var v;o.push(h),O();let E=(v=h.keys)!==null&&v!==void 0?v:[];for(let y=0;y<E.length;y++){let g=E[y];i.push(g),m.pre&&m.pre.call(h,h.node[g],g);let q=l(h.node[g]);a&&jf.call(h.node,g)&&!bZ(h.node,g)&&Pf(h.node,g,q.node),q.isLast=y===E.length-1,q.isFirst=y===0,m.post&&m.post.call(h,q),i.pop()}o.pop()}return m.after&&m.after.call(h,h.node),h})(t).node}var Io=class{constructor(t,e=qk){this._value=t,this._options=e}get(t){let e=this._value;for(let r=0;e&&r<t.length;r++){let i=t[r];if(!jf.call(e,i)||!this._options.includeSymbols&&typeof i==\"symbol\")return;e=e[i]}return e}has(t){let e=this._value;for(let r=0;e&&r<t.length;r++){let i=t[r];if(!jf.call(e,i)||!this._options.includeSymbols&&typeof i==\"symbol\")return!1;e=e[i]}return!0}set(t,e){let r=this._value,i=0;for(i=0;i<t.length-1;i++){let o=t[i];if(Tk(o))return e;jf.call(r,o)||(r[o]={}),r=r[o]}return Tk(t[i])||(r[t[i]]=e),e}map(t){return Mk(this._value,t,{immutable:!0,includeSymbols:!!this._options.includeSymbols,maxDepth:this._options.maxDepth})}forEach(t){return this._value=Mk(this._value,t,this._options),this._value}reduce(t,e){let r=arguments.length===1,i=r?this._value:e;return this.forEach(function(o){(!this.isRoot||!r)&&(i=t.call(this,i,o))}),i}paths(){let t=[];return this.forEach(function(){t.push(this.path)}),t}nodes(){let t=[];return this.forEach(function(){t.push(this.node)}),t}clone(){let t=[],e=[],r=this._options,i=r.maxDepth;return gg(this._value)?this._value.slice():(function o(s){kk(t.length,i);for(let n=0;n<t.length;n++)if(t[n]===s)return e[n];if(typeof s==\"object\"&&s!==null){let n=Dk(s,r);if(gg(s)||Nk(s))return n;t.push(s),e.push(n);let a=r.includeSymbols?vg:Object.keys;for(let p of a(s))Pf(n,p,o(s[p]));return t.pop(),e.pop(),n}return s})(this._value)}},ci=(t,e)=>new Io(t,e);ci.get=(t,e,r)=>new Io(t,r).get(e);ci.set=(t,e,r,i)=>new Io(t,i).set(e,r);ci.has=(t,e,r)=>new Io(t,r).has(e);ci.map=(t,e,r)=>new Io(t,r).map(e);ci.forEach=(t,e,r)=>new Io(t,r).forEach(e);ci.reduce=(t,e,r,i)=>new Io(t,i).reduce(e,r);ci.paths=(t,e)=>new Io(t,e).paths();ci.nodes=(t,e)=>new Io(t,e).nodes();ci.clone=(t,e)=>new Io(t,e).clone();var SZ=[\"properties\"],OZ=[\"properties\"],wZ=[\"definitions\",\"parameters\",\"responses\",\"securityDefinitions\",\"components/schemas\",\"components/responses\",\"components/parameters\",\"components/securitySchemes\"],jZ=[\"schema/example\",\"items/example\"];function Af(t){let e=t[t.length-1],r=t[t.length-2],i=t.join(\"/\");return SZ.indexOf(e)>-1&&OZ.indexOf(r)===-1||wZ.indexOf(i)>-1||jZ.some(o=>i.indexOf(o)>-1)}function Lk(t,e,{specmap:r,getBaseUrlForNodePath:i=s=>r.getContext([...e,...s]).baseDoc,targetKeys:o=[\"$ref\",\"$$ref\"]}={}){let s=[];return ci(t).forEach(function(){if((0,Vk.default)(o).call(o,this.key)&&typeof this.node==\"string\"){let a=this.path,p=e.concat(this.path),l=Rf(this.node,i(a));s.push(r.replace(p,l))}}),s}function Rf(t,e){let[r,i]=t.split(\"#\"),o=e??\"\",s=r??\"\",n;if(ae.isHttpUrl(o))n=ae.resolve(o,s);else{let a=ae.resolve(ko,o),l=ae.resolve(a,s).replace(ko,\"\");n=s.startsWith(\"/\")?l:l.substring(1)}return i?`${n}#${i}`:n}var PZ=/^([a-z]+:\\/\\/|\\/\\/)/i,cn=class extends yt{},Go={},Bk=new WeakMap,AZ=[t=>t[0]===\"paths\"&&t[3]===\"responses\"&&t[5]===\"examples\",t=>t[0]===\"paths\"&&t[3]===\"responses\"&&t[5]===\"content\"&&t[7]===\"example\",t=>t[0]===\"paths\"&&t[3]===\"responses\"&&t[5]===\"content\"&&t[7]===\"examples\"&&t[9]===\"value\",t=>t[0]===\"paths\"&&t[3]===\"requestBody\"&&t[4]===\"content\"&&t[6]===\"example\",t=>t[0]===\"paths\"&&t[3]===\"requestBody\"&&t[4]===\"content\"&&t[6]===\"examples\"&&t[8]===\"value\",t=>t[0]===\"paths\"&&t[2]===\"parameters\"&&t[4]===\"example\",t=>t[0]===\"paths\"&&t[3]===\"parameters\"&&t[5]===\"example\",t=>t[0]===\"paths\"&&t[2]===\"parameters\"&&t[4]===\"examples\"&&t[6]===\"value\",t=>t[0]===\"paths\"&&t[3]===\"parameters\"&&t[5]===\"examples\"&&t[7]===\"value\",t=>t[0]===\"paths\"&&t[2]===\"parameters\"&&t[4]===\"content\"&&t[6]===\"example\",t=>t[0]===\"paths\"&&t[2]===\"parameters\"&&t[4]===\"content\"&&t[6]===\"examples\"&&t[8]===\"value\",t=>t[0]===\"paths\"&&t[3]===\"parameters\"&&t[4]===\"content\"&&t[7]===\"example\",t=>t[0]===\"paths\"&&t[3]===\"parameters\"&&t[5]===\"content\"&&t[7]===\"examples\"&&t[9]===\"value\"],RZ=t=>AZ.some(e=>e(t)),_Z={key:\"$ref\",plugin:(t,e,r,i)=>{let o=i.getInstance(),s=r.slice(0,-1);if(Af(s)||RZ(s))return;let{baseDoc:n}=i.getContext(r);if(typeof t!=\"string\")return new cn(\"$ref: must be a string (JSON-Ref)\",{$ref:t,baseDoc:n,fullPath:r});let a=Hk(t),p=a[0],l=a[1]||\"\",u;try{u=n||p?Jk(p,n):null}catch(O){return bg(O,{pointer:l,$ref:t,basePath:u,fullPath:r})}let f,m;if(FZ(l,u,s,i)&&!o.useCircularStructures){let O=Rf(t,u);return t===O?null:_e.replace(r,O)}if(u==null?(m=Og(l),f=i.get(m),typeof f>\"u\"&&(f=new cn(`Could not resolve reference: ${t}`,{pointer:l,$ref:t,baseDoc:n,fullPath:r}))):(f=zk(u,l),f.__value!=null?f=f.__value:f=f.catch(O=>{throw bg(O,{pointer:l,$ref:t,baseDoc:n,fullPath:r})})),f instanceof Error)return[_e.remove(r),f];let x=Rf(t,u),h=_e.replace(s,f,{$$ref:x});if(u&&u!==n)return[h,_e.context(s,{baseDoc:u})];try{if(!$Z(i.state,h)||o.useCircularStructures)return h}catch{return null}}},Uk=Object.assign(_Z,{docCache:Go,absoluteify:Jk,clearCache:IZ,JSONRefError:cn,wrapError:bg,getDoc:Kk,split:Hk,extractFromDoc:zk,fetchJSON:CZ,extract:Sg,jsonPointerToArray:Og,unescapeJsonPointerToken:Wk}),oc=Uk;function Jk(t,e){if(!PZ.test(t)){if(!e)throw new cn(`Tried to resolve a relative URL, without having a basePath. path: '${t}' basePath: '${e}'`);return ae.resolve(e,t)}return t}function bg(t,e){let r;return t&&t.response&&t.response.body?r=`${t.response.body.code} ${t.response.body.message}`:r=t.message,new cn(`Could not resolve reference: ${r}`,{...e,cause:t})}function Hk(t){return(t+\"\").split(\"#\")}function zk(t,e){let r=Go[t];if(r&&!_e.isPromise(r))try{let i=Sg(e,r);return Object.assign(Promise.resolve(i),{__value:i})}catch(i){return Promise.reject(i)}return Kk(t).then(i=>Sg(e,i))}function IZ(t){typeof t<\"u\"?delete Go[t]:Object.keys(Go).forEach(e=>{delete Go[e]})}function Kk(t){let e=Go[t];return e?_e.isPromise(e)?e:Promise.resolve(e):(Go[t]=Uk.fetchJSON(t).then(r=>(Go[t]=r,r)),Go[t])}function CZ(t){return fetch(t,{headers:{Accept:Ju},loadSpec:!0}).then(e=>e.text()).then(e=>br.load(e))}function Sg(t,e){let r=Og(t);if(r.length<1)return e;let i=_e.getIn(e,r);if(typeof i>\"u\")throw new cn(`Could not resolve pointer: ${t} does not exist in document`,{pointer:t});return i}function Og(t){if(typeof t!=\"string\")throw new TypeError(`Expected a string, got a ${typeof t}`);return t[0]===\"/\"&&(t=t.substr(1)),t===\"\"?[]:t.split(\"/\").map(Wk)}function Wk(t){return typeof t!=\"string\"?t:new URLSearchParams(`=${t.replace(/~1/g,\"/\").replace(/~0/g,\"~\")}`).get(\"\")}function Gk(t){return new URLSearchParams([[\"\",t.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")]]).toString().slice(1)}function TZ(t){return t.length===0?\"\":`/${t.map(Gk).join(\"/\")}`}var MZ=t=>!t||t===\"/\"||t===\"#\";function Eg(t,e){if(MZ(e))return!0;let r=t.charAt(e.length),i=e.slice(-1);return t.indexOf(e)===0&&(!r||r===\"/\"||r===\"#\")&&i!==\"#\"}function FZ(t,e,r,i){let o=Bk.get(i);o||(o={},Bk.set(i,o));let s=TZ(r),n=`${e||\"<specmap-base>\"}#${t}`,a=s.replace(/allOf\\/\\d+\\/?/g,\"\"),p=i.contextTree.get([]).baseDoc;if(e===p&&Eg(a,t))return!0;let l=\"\";if(r.some(f=>(l=`${l}/${Gk(f)}`,o[l]&&o[l].some(m=>Eg(m,n)||Eg(n,m)))))return!0;o[a]=(o[a]||[]).concat(n)}function $Z(t,e){let r=[t];return e.path.reduce((o,s)=>(r.push(o[s]),o[s]),t),i(e.value);function i(o){return _e.isObject(o)&&(r.indexOf(o)>=0||Object.keys(o).some(s=>i(o[s])))}}var Yk={key:\"allOf\",plugin:(t,e,r,i,o)=>{if(o.meta&&o.meta.$$ref)return;let s=r.slice(0,-1);if(Af(s))return;if(!Array.isArray(t)){let l=new TypeError(\"allOf must be an array\");return l.fullPath=r,l}let n=!1,a=o.value;if(s.forEach(l=>{a&&(a=a[l])}),a={...a},Object.keys(a).length===0)return;delete a.allOf;let p=[];return p.push(i.replace(s,{})),t.forEach((l,u)=>{if(!i.isObject(l)){if(n)return null;n=!0;let x=new TypeError(\"Elements in allOf must be objects\");return x.fullPath=r,p.push(x)}p.push(i.mergeDeep(s,l));let f=r.slice(0,-1),m=Lk(l,f,{getBaseUrlForNodePath:x=>i.getContext([...r,u,...x]).baseDoc,specmap:i});p.push(...m)}),a.example&&p.push(i.remove([].concat(s,\"example\"))),p.push(i.mergeDeep(s,a)),a.$$ref||p.push(i.remove([].concat(s,\"$$ref\"))),p}};var Xk={key:\"parameters\",plugin:(t,e,r,i)=>{if(Array.isArray(t)&&t.length){let o=Object.assign([],t),s=r.slice(0,-1),n={..._e.getIn(i.spec,s)};for(let a=0;a<t.length;a+=1){let p=t[a];try{o[a].default=i.parameterMacro(n,p)}catch(l){let u=new Error(l);return u.fullPath=r,u}}return _e.replace(r,o)}return _e.replace(r,t)}};var Qk={key:\"properties\",plugin:(t,e,r,i)=>{let o={...t};for(let n in t)try{o[n].default=i.modelPropertyMacro(o[n])}catch(a){let p=new Error(a);return p.fullPath=r,p}return _e.replace(r,o)}};var Zl=class{constructor(e){this.root=wg(e||{})}set(e,r){let i=this.getParent(e,!0);if(!i){_f(this.root,r,null);return}let o=e[e.length-1],{children:s}=i;if(s[o]){_f(s[o],r,i);return}s[o]=wg(r,i)}get(e){if(e=e||[],e.length<1)return this.root.value;let r=this.root,i,o;for(let s=0;s<e.length&&(o=e[s],i=r.children,!!i[o]);s+=1)r=i[o];return r&&r.protoValue}getParent(e,r){return!e||e.length<1?null:e.length<2?this.root:e.slice(0,-1).reduce((i,o)=>{if(!i)return i;let{children:s}=i;return!s[o]&&r&&(s[o]=wg(null,i)),s[o]},this.root)}};function wg(t,e){return _f({children:{}},t,e)}function _f(t,e,r){return t.value=e||{},t.protoValue=r?{...r.protoValue,...t.value}:t.value,Object.keys(t.children).forEach(i=>{let o=t.children[i];t.children[i]=_f(o,o.value,t)}),t}var Zk=100,eD=()=>{},jg=class{static getPluginName(e){return e.pluginName}static getPatchesOfType(e,r){return e.filter(r)}constructor(e){Object.assign(this,{spec:\"\",debugLevel:\"info\",plugins:[],pluginHistory:{},errors:[],mutations:[],promisedPatches:[],state:{},patches:[],context:{},contextTree:new Zl,showDebug:!1,allPatches:[],pluginProp:\"specMap\",libMethods:Object.assign(Object.create(this),_e,{getInstance:()=>this}),allowMetaPatches:!1},e),this.get=this._get.bind(this),this.getContext=this._getContext.bind(this),this.hasRun=this._hasRun.bind(this),this.wrappedPlugins=this.plugins.map(this.wrapPlugin.bind(this)).filter(_e.isFunction),this.patches.push(_e.add([],this.spec)),this.patches.push(_e.context([],this.context)),this.updatePatches(this.patches)}debug(e,...r){this.debugLevel===e&&console.log(...r)}verbose(e,...r){this.debugLevel===\"verbose\"&&console.log(`[${e}]   `,...r)}wrapPlugin(e,r){let{pathDiscriminator:i}=this,o=null,s;return e[this.pluginProp]?(o=e,s=e[this.pluginProp]):_e.isFunction(e)?s=e:_e.isObject(e)&&(s=n(e)),Object.assign(s.bind(o),{pluginName:e.name||r,isGenerator:_e.isGenerator(s)});function n(a){let p=(l,u)=>Array.isArray(l)?l.every((f,m)=>f===u[m]):!0;return function*(u,f){let m={};for(let[h,O]of u.filter(_e.isAdditiveMutation).entries())if(h<zu)yield*x(O.value,O.path,O);else return;function*x(h,O,j){if(!_e.isObject(h))a.key===O[O.length-1]&&(yield a.plugin(h,a.key,O,f));else{let v=O.length-1,E=O[v],y=O.indexOf(\"properties\"),g=E===\"properties\"&&v===y,q=f.allowMetaPatches&&m[h.$$ref];for(let V of Object.keys(h)){let C=h[V],oe=O.concat(V),M=_e.isObject(C),te=h.$$ref;if(q||M&&(f.allowMetaPatches&&te&&p(i,oe)&&(m[te]=!0),yield*x(C,oe,j)),!g&&V===a.key){let H=p(i,O);(!i||H)&&(yield a.plugin(C,V,oe,f,j))}}}}}}}nextPlugin(){return this.wrappedPlugins.find(e=>this.getMutationsForPlugin(e).length>0)}nextPromisedPatch(){if(this.promisedPatches.length>0)return Promise.race(this.promisedPatches.map(e=>e.value))}getPluginHistory(e){let r=this.constructor.getPluginName(e);return this.pluginHistory[r]||[]}getPluginRunCount(e){return this.getPluginHistory(e).length}getPluginHistoryTip(e){let r=this.getPluginHistory(e);return r&&r[r.length-1]||{}}getPluginMutationIndex(e){let r=this.getPluginHistoryTip(e).mutationIndex;return typeof r!=\"number\"?-1:r}updatePluginHistory(e,r){let i=this.constructor.getPluginName(e);this.pluginHistory[i]=this.pluginHistory[i]||[],this.pluginHistory[i].push(r)}updatePatches(e){_e.normalizeArray(e).forEach(r=>{if(r instanceof Error){this.errors.push(r);return}try{if(!_e.isObject(r)){this.debug(\"updatePatches\",\"Got a non-object patch\",r);return}if(this.showDebug&&this.allPatches.push(r),_e.isPromise(r.value)){this.promisedPatches.push(r),this.promisedPatchThen(r);return}if(_e.isContextPatch(r)){this.setContext(r.path,r.value);return}_e.isMutation(r)&&this.updateMutations(r)}catch(i){console.error(i),this.errors.push(i)}})}updateMutations(e){typeof e.value==\"object\"&&!Array.isArray(e.value)&&this.allowMetaPatches&&(e.value={...e.value});let r=_e.applyPatch(this.state,e,{allowMetaPatches:this.allowMetaPatches});r&&(this.mutations.push(e),this.state=r)}removePromisedPatch(e){let r=this.promisedPatches.indexOf(e);if(r<0){this.debug(\"Tried to remove a promisedPatch that isn't there!\");return}this.promisedPatches.splice(r,1)}promisedPatchThen(e){return e.value=e.value.then(r=>{let i={...e,value:r};this.removePromisedPatch(e),this.updatePatches(i)}).catch(r=>{this.removePromisedPatch(e),this.updatePatches(r)}),e.value}getMutations(e,r){return e=e||0,typeof r!=\"number\"&&(r=this.mutations.length),this.mutations.slice(e,r)}getCurrentMutations(){return this.getMutationsForPlugin(this.getCurrentPlugin())}getMutationsForPlugin(e){let r=this.getPluginMutationIndex(e);return this.getMutations(r+1)}getCurrentPlugin(){return this.currentPlugin}getLib(){return this.libMethods}_get(e){return _e.getIn(this.state,e)}_getContext(e){return this.contextTree.get(e)}setContext(e,r){return this.contextTree.set(e,r)}_hasRun(e){return this.getPluginRunCount(this.getCurrentPlugin())>(e||0)}dispatch(){let e=this,r=this.nextPlugin();if(!r){let s=this.nextPromisedPatch();if(s)return s.then(()=>this.dispatch()).catch(()=>this.dispatch());let n={spec:this.state,errors:this.errors};return this.showDebug&&(n.patches=this.allPatches),Promise.resolve(n)}if(e.pluginCount=e.pluginCount||new WeakMap,e.pluginCount.set(r,(e.pluginCount.get(r)||0)+1),e.pluginCount[r]>Zk)return Promise.resolve({spec:e.state,errors:e.errors.concat(new Error(`We've reached a hard limit of ${Zk} plugin runs`))});if(r!==this.currentPlugin&&this.promisedPatches.length){let s=this.promisedPatches.map(n=>n.value);return Promise.all(s.map(n=>n.then(eD,eD))).then(()=>this.dispatch())}return i();function i(){e.currentPlugin=r;let s=e.getCurrentMutations(),n=e.mutations.length-1;try{if(r.isGenerator)for(let a of r(s,e.getLib()))o(a);else{let a=r(s,e.getLib());o(a)}}catch(a){console.error(a),o([Object.assign(Object.create(a),{plugin:r})])}finally{e.updatePluginHistory(r,{mutationIndex:n})}return e.dispatch()}function o(s){s&&(s=_e.fullyNormalizeArray(s),e.updatePatches(s,r))}}};function Pg(t){return new jg(t).dispatch()}var Yo={refs:oc,allOf:Yk,parameters:Xk,properties:Qk};async function Zn(t){let{spec:e,mode:r,allowMetaPatches:i=!0,pathDiscriminator:o,modelPropertyMacro:s,parameterMacro:n,requestInterceptor:a,responseInterceptor:p,skipNormalization:l=!1,useCircularStructures:u,strategies:f}=t,m=Ks(t),x=pp(t),h=f.find(j=>j.match(e));return O(e);async function O(j){m&&(Yo.refs.docCache[m]=j),Yo.refs.fetchJSON=up(x,{requestInterceptor:a,responseInterceptor:p});let v=[Yo.refs];typeof n==\"function\"&&v.push(Yo.parameters),typeof s==\"function\"&&v.push(Yo.properties),r!==\"strict\"&&v.push(Yo.allOf);let E=await Pg({spec:j,context:{baseDoc:m},plugins:v,allowMetaPatches:i,pathDiscriminator:o,parameterMacro:n,modelPropertyMacro:s,useCircularStructures:u});return l||(E.spec=h.normalize(E.spec)),E}}var Ag=Le(Er());var NZ=t=>t.replace(/\\W/gi,\"_\"),If=NZ;var kZ=new Set([\"connect\",\"delete\",\"get\",\"head\",\"options\",\"patch\",\"post\",\"put\",\"query\",\"trace\"]);function Cf(t,e,{v2OperationIdCompatibilityMode:r}={}){if(r){let o=`${e.toLowerCase()}_${t}`.replace(/[\\s!@#$%^&*()_+=[{\\]};:<>|./?,\\\\'\"\"-]/g,\"_\");return o=o||`${t.substring(1)}_${e}`,o.replace(/((_){2,})/g,\"_\").replace(/^(_)*/g,\"\").replace(/([_])*$/g,\"\")}return`${kZ.has(e.toLowerCase())?e.toLowerCase():e}${If(t)}`}function wr(t,e,r=\"\",{v2OperationIdCompatibilityMode:i}={}){return!t||typeof t!=\"object\"?null:(t.operationId||\"\").replace(/\\s/g,\"\").length?If(t.operationId):Cf(e,r,{v2OperationIdCompatibilityMode:i})}function Xo(t){let{spec:e}=t,{paths:r}=e,i={};if(!r||e.$$normalized)return t;for(let n in r){var o;let a=r[n];if(a==null||!(0,Ag.default)(o=[\"object\",\"function\"]).call(o,typeof a))continue;let p=a.parameters;for(let l in a){var s;let u=a[l];if(u==null||!(0,Ag.default)(s=[\"object\",\"function\"]).call(s,typeof u))continue;let f=wr(u,n,l);if(f){i[f]?i[f].push(u):i[f]=[u];let m=i[f];if(m.length>1)m.forEach((x,h)=>{x.__originalOperationId=x.__originalOperationId||x.operationId,x.operationId=`${f}${h+1}`});else if(typeof u.operationId<\"u\"){let x=m[0];x.__originalOperationId=x.__originalOperationId||u.operationId,x.operationId=f}}if(l!==\"parameters\"){let m=[],x={};for(let h in e)(h===\"produces\"||h===\"consumes\"||h===\"security\")&&(x[h]=e[h],m.push(x));if(p&&(x.parameters=p,m.push(x)),m.length){for(let h of m)for(let O in h)if(!Array.isArray(u[O]))u[O]=h[O];else if(O===\"parameters\")for(let j of h[O])u[O].some(E=>!nt(E)&&!nt(j)?!1:E===j?!0:[\"name\",\"$ref\",\"$$ref\"].some(y=>typeof E[y]==\"string\"&&typeof j[y]==\"string\"&&E[y]===j[y]))||u[O].push(j)}}}}return e.$$normalized=!0,t}function Tf(){Yo.refs.clearCache()}var DZ={name:\"generic\",match(){return!0},normalize(t){let{spec:e}=Xo({spec:t});return e},async resolve(t){return Zn(t)}},sc=DZ;async function Rg(t){return Zn(t)}var Mf=t=>{try{let{swagger:e}=t;return e===\"2.0\"}catch{return!1}},_g=t=>{try{let{openapi:e}=t;return typeof e==\"string\"&&/^3\\.0\\.(?:[1-9]\\d*|0)$/.test(e)}catch{return!1}},eu=t=>{try{let{openapi:e}=t;return typeof e==\"string\"&&/^3\\.1\\.(?:[1-9]\\d*|0)$/.test(e)}catch{return!1}},tu=t=>{try{let{openapi:e}=t;return typeof e==\"string\"&&/^3\\.2\\.(?:[1-9]\\d*|0)$/.test(e)}catch{return!1}},ru=t=>_g(t)||eu(t)||tu(t);var qZ={name:\"openapi-2\",match(t){return Mf(t)},normalize(t){let{spec:e}=Xo({spec:t});return e},async resolve(t){return Rg(t)}},nc=qZ;async function Ig(t){return Zn(t)}var VZ={name:\"openapi-3-0\",match(t){return _g(t)},normalize(t){let{spec:e}=Xo({spec:t});return e},async resolve(t){return Ig(t)}},ac=VZ;var LZ=async t=>{let{spec:e,requestInterceptor:r,responseInterceptor:i}=t,o=Ks(t),s=pp(t),n=e||await up(s,{requestInterceptor:r,responseInterceptor:i})(o),a={...t,spec:n};return t.strategies.find(l=>l.match(n)).resolve(a)},Cg=t=>async e=>{let r={...t,...e};return LZ(r)},tD=Cg({strategies:[ac,nc,sc]});var BZ=async(t,e,r={})=>{let{returnEntireTree:i,baseDoc:o,requestInterceptor:s,responseInterceptor:n,parameterMacro:a,modelPropertyMacro:p,useCircularStructures:l,strategies:u}=r,f={spec:t,pathDiscriminator:e,baseDoc:o,requestInterceptor:s,responseInterceptor:n,parameterMacro:a,modelPropertyMacro:p,useCircularStructures:l,strategies:u},x=u.find(O=>O.match(t)).normalize(t),h=await tD({spec:x,...f,allowMetaPatches:!0,skipNormalization:!eu(t)});return!i&&Array.isArray(e)&&e.length&&(h.spec=e.reduce((O,j)=>O?.[j],h.spec)||null),h},Tg=t=>async(e,r,i={})=>{let o={...t,...i};return BZ(e,r,o)},Hje=Tg({strategies:[ac,nc,sc]});var Me={};vr(Me,{from:()=>iD,fromURIReference:()=>JZ,to:()=>UZ});var UZ=t=>`#${[...t].map(r=>/^[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]$/.test(r)?r:encodeURIComponent(r)).join(\"\")}`,iD=t=>{try{let e=t.startsWith(\"#\")?t.slice(1):t;return decodeURIComponent(e)}catch{return t}},JZ=t=>{let e=t.indexOf(\"#\"),r=e===-1?\"#\":t.substring(e);return iD(r)};function Tr(){this.grammarObject=\"grammarObject\",this.rules=[],this.rules[0]={name:\"json-pointer\",lower:\"json-pointer\",index:0,isBkr:!1},this.rules[1]={name:\"reference-token\",lower:\"reference-token\",index:1,isBkr:!1},this.rules[2]={name:\"unescaped\",lower:\"unescaped\",index:2,isBkr:!1},this.rules[3]={name:\"escaped\",lower:\"escaped\",index:3,isBkr:!1},this.rules[4]={name:\"array-location\",lower:\"array-location\",index:4,isBkr:!1},this.rules[5]={name:\"array-index\",lower:\"array-index\",index:5,isBkr:!1},this.rules[6]={name:\"array-dash\",lower:\"array-dash\",index:6,isBkr:!1},this.rules[7]={name:\"slash\",lower:\"slash\",index:7,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:0,max:1/0},this.rules[0].opcodes[1]={type:2,children:[2,3]},this.rules[0].opcodes[2]={type:4,index:7},this.rules[0].opcodes[3]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:3,min:0,max:1/0},this.rules[1].opcodes[1]={type:1,children:[2,3]},this.rules[1].opcodes[2]={type:4,index:2},this.rules[1].opcodes[3]={type:4,index:3},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:1,children:[1,2,3]},this.rules[2].opcodes[1]={type:5,min:0,max:46},this.rules[2].opcodes[2]={type:5,min:48,max:125},this.rules[2].opcodes[3]={type:5,min:127,max:1114111},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2]},this.rules[3].opcodes[1]={type:7,string:[126]},this.rules[3].opcodes[2]={type:1,children:[3,4]},this.rules[3].opcodes[3]={type:7,string:[48]},this.rules[3].opcodes[4]={type:7,string:[49]},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:4,index:5},this.rules[4].opcodes[2]={type:4,index:6},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2]},this.rules[5].opcodes[1]={type:6,string:[48]},this.rules[5].opcodes[2]={type:2,children:[3,4]},this.rules[5].opcodes[3]={type:5,min:49,max:57},this.rules[5].opcodes[4]={type:3,min:0,max:1/0},this.rules[5].opcodes[5]={type:5,min:48,max:57},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:7,string:[45]},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:7,string:[47]},this.toString=function(){let e=\"\";return e+=`; JavaScript Object Notation (JSON) Pointer ABNF syntax\n`,e+=`; https://datatracker.ietf.org/doc/html/rfc6901\n`,e+=`json-pointer    = *( slash reference-token ) ; MODIFICATION: surrogate text rule used\n`,e+=`reference-token = *( unescaped / escaped )\n`,e+=`unescaped       = %x00-2E / %x30-7D / %x7F-10FFFF\n`,e+=`                ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped'\n`,e+=`escaped         = \"~\" ( \"0\" / \"1\" )\n`,e+=`                ; representing '~' and '/', respectively\n`,e+=`\n`,e+=`; https://datatracker.ietf.org/doc/html/rfc6901#section-4\n`,e+=`array-location  = array-index / array-dash\n`,e+=`array-index     = %x30 / ( %x31-39 *(%x30-39) )\n`,e+=`                ; \"0\", or digits without a leading \"0\"\n`,e+=`array-dash      = \"-\"\n`,e+=`\n`,e+=`; Surrogate named rules\n`,e+=`slash           = \"/\"\n`,e}}var Mg=class extends Error{constructor(e,r=void 0){if(super(e,r),this.name=this.constructor.name,typeof e==\"string\"&&(this.message=e),typeof Error.captureStackTrace==\"function\"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack,r!=null&&typeof r==\"object\"&&Object.prototype.hasOwnProperty.call(r,\"cause\")&&!(\"cause\"in this)){let{cause:i}=r;this.cause=i,i instanceof Error&&\"stack\"in i&&(this.stack=`${this.stack}\nCAUSE: ${i.stack}`)}if(r!=null&&typeof r==\"object\"){let{cause:i,...o}=r;Object.assign(this,o)}}},jr=Mg;var Fg=class extends jr{},cc=Fg;var HZ=t=>(e,r,i,o,s)=>{if(!(typeof s==\"object\"&&s!==null&&!Array.isArray(s)))throw new cc(\"parser's user data must be an object\");if(e===Ke.SEM_PRE){let n={type:t,text:Xt.charsToString(r,i,o),start:i,length:o,children:[]};s.stack.length>0?s.stack[s.stack.length-1].children.push(n):s.root=n,s.stack.push(n)}e===Ke.SEM_POST&&s.stack.pop()},Ff=HZ;var $g=class extends Jc{constructor(){super(),this.callbacks[\"json-pointer\"]=Ff(\"json-pointer\"),this.callbacks[\"reference-token\"]=Ff(\"reference-token\"),this.callbacks.slash=Ff(\"text\")}getTree(){let e={stack:[],root:null};return this.translate(e),delete e.stack,e}},iu=$g;var zZ=t=>{if(typeof t!=\"string\")throw new TypeError(\"Reference token must be a string\");return t.replace(/~1/g,\"/\").replace(/~0/g,\"~\")},$f=zZ;var Ng=class extends iu{getTree(){let{root:e}=super.getTree();return e.children.filter(({type:r})=>r===\"reference-token\").map(({text:r})=>$f(r))}},Nf=Ng;var kg=class extends Array{toString(){return this.map(e=>`\"${String(e)}\"`).join(\", \")}},oD=kg;var Dg=class extends NA{inferExpectations(){let e=this.displayTrace().split(`\n`),r=new Set,i=!1,o=-1;for(let s=0;s<e.length;s++){let n=e[s];if(!i&&n.includes(\"M|\")){let a=n.match(/]'(.*)'$/);a&&a[1]&&(o=s)}if(s>o){let a=n.match(/N\\|\\[TLS\\(([^)]+)\\)]/);a&&r.add(a[1])}}return new oD(...r)}},sD=Dg;var KZ=new Tr,WZ=(t,{translator:e=new Nf,stats:r=!1,trace:i=!1}={})=>{if(typeof t!=\"string\")throw new TypeError(\"JSON Pointer must be a string\");try{let o=new Ze;e&&(o.ast=e),r&&(o.stats=new kA),i&&(o.trace=new sD);let s=o.parse(KZ,\"json-pointer\",t);return{result:s,tree:s.success&&e?o.ast.getTree():void 0,stats:o.stats,trace:o.trace}}catch(o){throw new cc(\"Unexpected error during JSON Pointer parsing\",{cause:o,jsonPointer:t})}},ou=WZ;var OPe=new Tr,wPe=new Ze;var RPe=new Tr,_Pe=new Ze;var GZ=new Tr,YZ=new Ze,XZ=t=>{if(typeof t!=\"string\")return!1;try{return YZ.parse(GZ,\"array-index\",t).success}catch{return!1}},kf=XZ;var QZ=new Tr,ZZ=new Ze,eee=t=>{if(typeof t!=\"string\")return!1;try{return ZZ.parse(QZ,\"array-dash\",t).success}catch{return!1}},Df=eee;var tee=t=>{if(typeof t!=\"string\"&&typeof t!=\"number\")throw new TypeError(\"Reference token must be a string or number\");return String(t).replace(/~/g,\"~0\").replace(/\\//g,\"~1\")},qf=tee;var qg=class extends jr{},Vf=qg;var ree=t=>{if(!Array.isArray(t))throw new TypeError(\"Reference tokens must be a list of strings or numbers\");try{return t.length===0?\"\":`/${t.map(e=>{if(typeof e!=\"string\"&&typeof e!=\"number\")throw new TypeError(\"Reference token must be a string or number\");return qf(String(e))}).join(\"/\")}`}catch(e){throw new Vf(\"Unexpected error during JSON Pointer compilation\",{cause:e,referenceTokens:t})}},Co=ree;var Vg=class{#e;#t;#r;constructor(e,r={}){this.#e=e,this.#e.steps=[],this.#e.failed=!1,this.#e.failedAt=-1,this.#e.message=`JSON Pointer \"${r.jsonPointer}\" was successfully evaluated against the provided value`,this.#e.context={...r,realm:r.realm.name},this.#t=[],this.#r=r.realm}step({referenceToken:e,input:r,output:i,success:o=!0,reason:s}){let n=this.#t.length;this.#t.push(e);let a={referenceToken:e,referenceTokenPosition:n,input:r,inputType:this.#r.isObject(r)?\"object\":this.#r.isArray(r)?\"array\":\"unrecognized\",output:i,success:o};s&&(a.reason=s),this.#e.steps.push(a),o||(this.#e.failed=!0,this.#e.failedAt=n,this.#e.message=s)}},nD=Vg;var Lg=class{name=\"\";isArray(e){throw new jr(\"Realm.isArray(node) must be implemented in a subclass\")}isObject(e){throw new jr(\"Realm.isObject(node) must be implemented in a subclass\")}sizeOf(e){throw new jr(\"Realm.sizeOf(node) must be implemented in a subclass\")}has(e,r){throw new jr(\"Realm.has(node) must be implemented in a subclass\")}evaluate(e,r){throw new jr(\"Realm.evaluate(node) must be implemented in a subclass\")}},lc=Lg;var Bg=class extends jr{},Jt=Bg;var Ug=class extends Jt{},li=Ug;var Jg=class extends lc{name=\"json\";isArray(e){return Array.isArray(e)}isObject(e){return typeof e==\"object\"&&e!==null&&!this.isArray(e)}sizeOf(e){return this.isArray(e)?e.length:this.isObject(e)?Object.keys(e).length:0}has(e,r){if(this.isArray(e)){let i=Number(r),o=i>>>0;if(i!==o)throw new li(`Invalid array index \"${r}\": index must be an unsinged 32-bit integer`,{referenceToken:r,currentValue:e,realm:this.name});return o<this.sizeOf(e)&&Object.prototype.hasOwnProperty.call(e,i)}return this.isObject(e)?Object.prototype.hasOwnProperty.call(e,r):!1}evaluate(e,r){return this.isArray(e)?e[Number(r)]:e[r]}},aD=Jg;var Hg=class extends Jt{},Lf=Hg;var zg=class extends Jt{},uc=zg;var iee=(t,e,{strictArrays:r=!0,strictObjects:i=!0,realm:o=new aD,trace:s=!0}={})=>{let{result:n,tree:a,trace:p}=ou(e,{trace:!!s}),l=typeof s==\"object\"&&s!==null?new nD(s,{jsonPointer:e,referenceTokens:a,strictArrays:r,strictObjects:i,realm:o,value:t}):null;try{let u;if(!n.success){let f=`Invalid JSON Pointer: \"${e}\". Syntax error at position ${n.maxMatched}`;throw f+=p?`, expected ${p.inferExpectations()}`:\"\",new Jt(f,{jsonPointer:e,currentValue:t,realm:o.name})}return a.reduce((f,m,x)=>{if(o.isArray(f)){if(Df(m)){if(r)throw new li(`Invalid array index \"-\" at position ${x} in \"${e}\". The \"-\" token always refers to a nonexistent element during evaluation`,{jsonPointer:e,referenceTokens:a,referenceToken:m,referenceTokenPosition:x,currentValue:f,realm:o.name});return u=o.evaluate(f,String(o.sizeOf(f))),l?.step({referenceToken:m,input:f,output:u}),u}if(!kf(m))throw new li(`Invalid array index \"${m}\" at position ${x} in \"${e}\": index MUST be \"0\", or digits without a leading \"0\"`,{jsonPointer:e,referenceTokens:a,referenceToken:m,referenceTokenPosition:x,currentValue:f,realm:o.name});let h=Number(m);if(!Number.isSafeInteger(h))throw new li(`Invalid array index \"${m}\" at position ${x} in \"${e}\": index must be a safe integer`,{jsonPointer:e,referenceTokens:a,referenceToken:m,referenceTokenPosition:x,currentValue:f,realm:o.name});if(!o.has(f,m)&&r)throw new li(`Invalid array index \"${m}\" at position ${x} in \"${e}\": index not found in array`,{jsonPointer:e,referenceTokens:a,referenceToken:m,referenceTokenPosition:x,currentValue:f,realm:o.name});return u=o.evaluate(f,m),l?.step({referenceToken:m,input:f,output:u}),u}if(o.isObject(f)){if(!o.has(f,m)&&i)throw new uc(`Invalid object key \"${m}\" at position ${x} in \"${e}\": key not found in object`,{jsonPointer:e,referenceTokens:a,referenceToken:m,referenceTokenPosition:x,currentValue:f,realm:o.name});return u=o.evaluate(f,m),l?.step({referenceToken:m,input:f,output:u}),u}throw new Lf(`Invalid reference token \"${m}\" at position ${x} in \"${e}\": cannot be applied to a non-object/non-array value`,{jsonPointer:e,referenceTokens:a,referenceToken:m,referenceTokenPosition:x,currentValue:f,realm:o.name})},t)}catch(u){throw l?.step({referenceToken:u.referenceToken,input:u.currentValue,success:!1,reason:u.message}),u instanceof Jt?u:new Jt(\"Unexpected error during JSON Pointer evaluation\",{cause:u,jsonPointer:e,referenceTokens:a})}},Kg=iee;var Wg=class extends lc{name=\"apidom\";isArray(e){return Pe(e)}isObject(e){return ne(e)}sizeOf(e){return this.isArray(e)||this.isObject(e)?e.length:0}has(e,r){if(this.isArray(e)){let i=Number(r),o=i>>>0;if(i!==o)throw new li(`Invalid array index \"${r}\": index must be an unsinged 32-bit integer`,{referenceToken:r,currentValue:e,realm:this.name});return o<this.sizeOf(e)}if(this.isObject(e)){let i=e.keys(),o=new Set(i);if(i.length!==o.size)throw new uc(`Object key \"${r}\" is not unique \\u2014 JSON Pointer requires unique member names`,{referenceToken:r,currentValue:e,realm:this.name});return e.hasKey(r)}return!1}evaluate(e,r){return this.isArray(e)?e.get(Number(r)):e.get(r)}},Gg=Wg;var cee=(t,e,r={})=>Kg(t,e,{...r,realm:new Gg}),ke=cee;var ln=class extends Yl{filterByFormat(e=\"generic\"){let r=e===\"generic\"?\"openapi;version\":e;return this.filter(i=>i.includes(r))}findBy(e=\"3.1.2\",r=\"generic\"){let i=r===\"generic\"?`vnd.oai.openapi;version=${e}`:`vnd.oai.openapi+${r};version=${e}`;return this.find(s=>s.includes(i))||this.unknownMediaType}latest(e=\"generic\"){return ar(this.filterByFormat(e))}},lee=new ln(\"application/vnd.oai.openapi;version=3.1.0\",\"application/vnd.oai.openapi+json;version=3.1.0\",\"application/vnd.oai.openapi+yaml;version=3.1.0\",\"application/vnd.oai.openapi;version=3.1.1\",\"application/vnd.oai.openapi+json;version=3.1.1\",\"application/vnd.oai.openapi+yaml;version=3.1.1\",\"application/vnd.oai.openapi;version=3.1.2\",\"application/vnd.oai.openapi+json;version=3.1.2\",\"application/vnd.oai.openapi+yaml;version=3.1.2\"),ui=lee;var Yg=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"callback\"}},pi=Yg;var Xg=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"components\"}get schemas(){return this.get(\"schemas\")}set schemas(e){this.set(\"schemas\",e)}get responses(){return this.get(\"responses\")}set responses(e){this.set(\"responses\",e)}get parameters(){return this.get(\"parameters\")}set parameters(e){this.set(\"parameters\",e)}get examples(){return this.get(\"examples\")}set examples(e){this.set(\"examples\",e)}get requestBodies(){return this.get(\"requestBodies\")}set requestBodies(e){this.set(\"requestBodies\",e)}get headers(){return this.get(\"headers\")}set headers(e){this.set(\"headers\",e)}get securitySchemes(){return this.get(\"securitySchemes\")}set securitySchemes(e){this.set(\"securitySchemes\",e)}get links(){return this.get(\"links\")}set links(e){this.set(\"links\",e)}get callbacks(){return this.get(\"callbacks\")}set callbacks(e){this.set(\"callbacks\",e)}},fi=Xg;var Qg=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"contact\"}get name(){return this.get(\"name\")}set name(e){this.set(\"name\",e)}get url(){return this.get(\"url\")}set url(e){this.set(\"url\",e)}get email(){return this.get(\"email\")}set email(e){this.set(\"email\",e)}},mi=Qg;var Zg=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"discriminator\"}get propertyName(){return this.get(\"propertyName\")}set propertyName(e){this.set(\"propertyName\",e)}get mapping(){return this.get(\"mapping\")}set mapping(e){this.set(\"mapping\",e)}},di=Zg;var ev=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"encoding\"}get contentType(){return this.get(\"contentType\")}set contentType(e){this.set(\"contentType\",e)}get headers(){return this.get(\"headers\")}set headers(e){this.set(\"headers\",e)}get style(){return this.get(\"style\")}set style(e){this.set(\"style\",e)}get explode(){return this.get(\"explode\")}set explode(e){this.set(\"explode\",e)}get allowedReserved(){return this.get(\"allowedReserved\")}set allowedReserved(e){this.set(\"allowedReserved\",e)}},Qo=ev;var tv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"example\"}get summary(){return this.get(\"summary\")}set summary(e){this.set(\"summary\",e)}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get value(){return this.get(\"value\")}set value(e){this.set(\"value\",e)}get externalValue(){return this.get(\"externalValue\")}set externalValue(e){this.set(\"externalValue\",e)}},hi=tv;var rv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"externalDocumentation\"}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get url(){return this.get(\"url\")}set url(e){this.set(\"url\",e)}},xi=rv;var Bf=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"header\"}get required(){return this.hasKey(\"required\")?this.get(\"required\"):new S.BooleanElement(!1)}set required(e){this.set(\"required\",e)}get deprecated(){return this.hasKey(\"deprecated\")?this.get(\"deprecated\"):new S.BooleanElement(!1)}set deprecated(e){this.set(\"deprecated\",e)}get allowEmptyValue(){return this.get(\"allowEmptyValue\")}set allowEmptyValue(e){this.set(\"allowEmptyValue\",e)}get style(){return this.get(\"style\")}set style(e){this.set(\"style\",e)}get explode(){return this.get(\"explode\")}set explode(e){this.set(\"explode\",e)}get allowReserved(){return this.get(\"allowReserved\")}set allowReserved(e){this.set(\"allowReserved\",e)}get schema(){return this.get(\"schema\")}set schema(e){this.set(\"schema\",e)}get example(){return this.get(\"example\")}set example(e){this.set(\"example\",e)}get examples(){return this.get(\"examples\")}set examples(e){this.set(\"examples\",e)}get contentProp(){return this.get(\"content\")}set contentProp(e){this.set(\"content\",e)}};Object.defineProperty(Bf.prototype,\"description\",{get(){return this.get(\"description\")},set(t){this.set(\"description\",t)},enumerable:!0});var yi=Bf;var iv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"info\",this.classes.push(\"info\")}get title(){return this.get(\"title\")}set title(e){this.set(\"title\",e)}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get termsOfService(){return this.get(\"termsOfService\")}set termsOfService(e){this.set(\"termsOfService\",e)}get contact(){return this.get(\"contact\")}set contact(e){this.set(\"contact\",e)}get license(){return this.get(\"license\")}set license(e){this.set(\"license\",e)}get version(){return this.get(\"version\")}set version(e){this.set(\"version\",e)}},gi=iv;var ov=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"license\"}get name(){return this.get(\"name\")}set name(e){this.set(\"name\",e)}get url(){return this.get(\"url\")}set url(e){this.set(\"url\",e)}},vi=ov;var sv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"link\"}get operationRef(){return this.get(\"operationRef\")}set operationRef(e){this.set(\"operationRef\",e)}get operationId(){return this.get(\"operationId\")}set operationId(e){this.set(\"operationId\",e)}get operation(){if(z(this.operationRef)){var e;return(e=this.operationRef)===null||e===void 0?void 0:e.meta.get(\"operation\")}if(z(this.operationId)){var r;return(r=this.operationId)===null||r===void 0?void 0:r.meta.get(\"operation\")}}set operation(e){this.set(\"operation\",e)}get parameters(){return this.get(\"parameters\")}set parameters(e){this.set(\"parameters\",e)}get requestBody(){return this.get(\"requestBody\")}set requestBody(e){this.set(\"requestBody\",e)}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get server(){return this.get(\"server\")}set server(e){this.set(\"server\",e)}},Ei=sv;var nv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"mediaType\"}get schema(){return this.get(\"schema\")}set schema(e){this.set(\"schema\",e)}get example(){return this.get(\"example\")}set example(e){this.set(\"example\",e)}get examples(){return this.get(\"examples\")}set examples(e){this.set(\"examples\",e)}get encoding(){return this.get(\"encoding\")}set encoding(e){this.set(\"encoding\",e)}},bi=nv;var av=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"oAuthFlow\"}get authorizationUrl(){return this.get(\"authorizationUrl\")}set authorizationUrl(e){this.set(\"authorizationUrl\",e)}get tokenUrl(){return this.get(\"tokenUrl\")}set tokenUrl(e){this.set(\"tokenUrl\",e)}get refreshUrl(){return this.get(\"refreshUrl\")}set refreshUrl(e){this.set(\"refreshUrl\",e)}get scopes(){return this.get(\"scopes\")}set scopes(e){this.set(\"scopes\",e)}},Zo=av;var cv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"oAuthFlows\"}get implicit(){return this.get(\"implicit\")}set implicit(e){this.set(\"implicit\",e)}get password(){return this.get(\"password\")}set password(e){this.set(\"password\",e)}get clientCredentials(){return this.get(\"clientCredentials\")}set clientCredentials(e){this.set(\"clientCredentials\",e)}get authorizationCode(){return this.get(\"authorizationCode\")}set authorizationCode(e){this.set(\"authorizationCode\",e)}},es=cv;var lv=class extends S.StringElement{constructor(e,r,i){super(e,r,i),this.element=\"openapi\",this.classes.push(\"spec-version\"),this.classes.push(\"version\")}},Si=lv;var uv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"openApi3_0\",this.classes.push(\"api\")}get openapi(){return this.get(\"openapi\")}set openapi(e){this.set(\"openapi\",e)}get info(){return this.get(\"info\")}set info(e){this.set(\"info\",e)}get servers(){return this.get(\"servers\")}set servers(e){this.set(\"servers\",e)}get paths(){return this.get(\"paths\")}set paths(e){this.set(\"paths\",e)}get components(){return this.get(\"components\")}set components(e){this.set(\"components\",e)}get security(){return this.get(\"security\")}set security(e){this.set(\"security\",e)}get tags(){return this.get(\"tags\")}set tags(e){this.set(\"tags\",e)}get externalDocs(){return this.get(\"externalDocs\")}set externalDocs(e){this.set(\"externalDocs\",e)}},ts=uv;var pv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"operation\"}get tags(){return this.get(\"tags\")}set tags(e){this.set(\"tags\",e)}get summary(){return this.get(\"summary\")}set summary(e){this.set(\"summary\",e)}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}set externalDocs(e){this.set(\"externalDocs\",e)}get externalDocs(){return this.get(\"externalDocs\")}get operationId(){return this.get(\"operationId\")}set operationId(e){this.set(\"operationId\",e)}get parameters(){return this.get(\"parameters\")}set parameters(e){this.set(\"parameters\",e)}get requestBody(){return this.get(\"requestBody\")}set requestBody(e){this.set(\"requestBody\",e)}get responses(){return this.get(\"responses\")}set responses(e){this.set(\"responses\",e)}get callbacks(){return this.get(\"callbacks\")}set callbacks(e){this.set(\"callbacks\",e)}get deprecated(){return this.hasKey(\"deprecated\")?this.get(\"deprecated\"):new S.BooleanElement(!1)}set deprecated(e){this.set(\"deprecated\",e)}get security(){return this.get(\"security\")}set security(e){this.set(\"security\",e)}get servers(){return this.get(\"severs\")}set servers(e){this.set(\"servers\",e)}},Oi=pv;var Uf=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"parameter\"}get name(){return this.get(\"name\")}set name(e){this.set(\"name\",e)}get in(){return this.get(\"in\")}set in(e){this.set(\"in\",e)}get required(){return this.hasKey(\"required\")?this.get(\"required\"):new S.BooleanElement(!1)}set required(e){this.set(\"required\",e)}get deprecated(){return this.hasKey(\"deprecated\")?this.get(\"deprecated\"):new S.BooleanElement(!1)}set deprecated(e){this.set(\"deprecated\",e)}get allowEmptyValue(){return this.get(\"allowEmptyValue\")}set allowEmptyValue(e){this.set(\"allowEmptyValue\",e)}get style(){return this.get(\"style\")}set style(e){this.set(\"style\",e)}get explode(){return this.get(\"explode\")}set explode(e){this.set(\"explode\",e)}get allowReserved(){return this.get(\"allowReserved\")}set allowReserved(e){this.set(\"allowReserved\",e)}get schema(){return this.get(\"schema\")}set schema(e){this.set(\"schema\",e)}get example(){return this.get(\"example\")}set example(e){this.set(\"example\",e)}get examples(){return this.get(\"examples\")}set examples(e){this.set(\"examples\",e)}get contentProp(){return this.get(\"content\")}set contentProp(e){this.set(\"content\",e)}};Object.defineProperty(Uf.prototype,\"description\",{get(){return this.get(\"description\")},set(t){this.set(\"description\",t)},enumerable:!0});var wi=Uf;var fv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"pathItem\"}get $ref(){return this.get(\"$ref\")}set $ref(e){this.set(\"$ref\",e)}get summary(){return this.get(\"summary\")}set summary(e){this.set(\"summary\",e)}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get GET(){return this.get(\"get\")}set GET(e){this.set(\"GET\",e)}get PUT(){return this.get(\"put\")}set PUT(e){this.set(\"PUT\",e)}get POST(){return this.get(\"post\")}set POST(e){this.set(\"POST\",e)}get DELETE(){return this.get(\"delete\")}set DELETE(e){this.set(\"DELETE\",e)}get OPTIONS(){return this.get(\"options\")}set OPTIONS(e){this.set(\"OPTIONS\",e)}get HEAD(){return this.get(\"head\")}set HEAD(e){this.set(\"HEAD\",e)}get PATCH(){return this.get(\"patch\")}set PATCH(e){this.set(\"PATCH\",e)}get TRACE(){return this.get(\"trace\")}set TRACE(e){this.set(\"TRACE\",e)}get servers(){return this.get(\"servers\")}set servers(e){this.set(\"servers\",e)}get parameters(){return this.get(\"parameters\")}set parameters(e){this.set(\"parameters\",e)}},ji=fv;var mv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"paths\"}},Pi=mv;var dv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"reference\",this.classes.push(\"openapi-reference\")}get $ref(){return this.get(\"$ref\")}set $ref(e){this.set(\"$ref\",e)}},Ai=dv;var hv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"requestBody\"}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get contentProp(){return this.get(\"content\")}set contentProp(e){this.set(\"content\",e)}get required(){return this.hasKey(\"required\")?this.get(\"required\"):new S.BooleanElement(!1)}set required(e){this.set(\"required\",e)}},Ri=hv;var xv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"response\"}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get headers(){return this.get(\"headers\")}set headers(e){this.set(\"headers\",e)}get contentProp(){return this.get(\"content\")}set contentProp(e){this.set(\"content\",e)}get links(){return this.get(\"links\")}set links(e){this.set(\"links\",e)}},_i=xv;var yv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"responses\"}get default(){return this.get(\"default\")}set default(e){this.set(\"default\",e)}},Ii=yv;var gv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"JSONSchemaDraft4\"}get idProp(){return this.get(\"id\")}set idProp(e){this.set(\"id\",e)}get $schema(){return this.get(\"$schema\")}set $schema(e){this.set(\"$schema\",e)}get multipleOf(){return this.get(\"multipleOf\")}set multipleOf(e){this.set(\"multipleOf\",e)}get maximum(){return this.get(\"maximum\")}set maximum(e){this.set(\"maximum\",e)}get exclusiveMaximum(){return this.get(\"exclusiveMaximum\")}set exclusiveMaximum(e){this.set(\"exclusiveMaximum\",e)}get minimum(){return this.get(\"minimum\")}set minimum(e){this.set(\"minimum\",e)}get exclusiveMinimum(){return this.get(\"exclusiveMinimum\")}set exclusiveMinimum(e){this.set(\"exclusiveMinimum\",e)}get maxLength(){return this.get(\"maxLength\")}set maxLength(e){this.set(\"maxLength\",e)}get minLength(){return this.get(\"minLength\")}set minLength(e){this.set(\"minLength\",e)}get pattern(){return this.get(\"pattern\")}set pattern(e){this.set(\"pattern\",e)}get additionalItems(){return this.get(\"additionalItems\")}set additionalItems(e){this.set(\"additionalItems\",e)}get items(){return this.get(\"items\")}set items(e){this.set(\"items\",e)}get maxItems(){return this.get(\"maxItems\")}set maxItems(e){this.set(\"maxItems\",e)}get minItems(){return this.get(\"minItems\")}set minItems(e){this.set(\"minItems\",e)}get uniqueItems(){return this.get(\"uniqueItems\")}set uniqueItems(e){this.set(\"uniqueItems\",e)}get maxProperties(){return this.get(\"maxProperties\")}set maxProperties(e){this.set(\"maxProperties\",e)}get minProperties(){return this.get(\"minProperties\")}set minProperties(e){this.set(\"minProperties\",e)}get required(){return this.get(\"required\")}set required(e){this.set(\"required\",e)}get properties(){return this.get(\"properties\")}set properties(e){this.set(\"properties\",e)}get additionalProperties(){return this.get(\"additionalProperties\")}set additionalProperties(e){this.set(\"additionalProperties\",e)}get patternProperties(){return this.get(\"patternProperties\")}set patternProperties(e){this.set(\"patternProperties\",e)}get dependencies(){return this.get(\"dependencies\")}set dependencies(e){this.set(\"dependencies\",e)}get enum(){return this.get(\"enum\")}set enum(e){this.set(\"enum\",e)}get type(){return this.get(\"type\")}set type(e){this.set(\"type\",e)}get allOf(){return this.get(\"allOf\")}set allOf(e){this.set(\"allOf\",e)}get anyOf(){return this.get(\"anyOf\")}set anyOf(e){this.set(\"anyOf\",e)}get oneOf(){return this.get(\"oneOf\")}set oneOf(e){this.set(\"oneOf\",e)}get not(){return this.get(\"not\")}set not(e){this.set(\"not\",e)}get definitions(){return this.get(\"definitions\")}set definitions(e){this.set(\"definitions\",e)}get title(){return this.get(\"title\")}set title(e){this.set(\"title\",e)}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get default(){return this.get(\"default\")}set default(e){this.set(\"default\",e)}get format(){return this.get(\"format\")}set format(e){this.set(\"format\",e)}get base(){return this.get(\"base\")}set base(e){this.set(\"base\",e)}get links(){return this.get(\"links\")}set links(e){this.set(\"links\",e)}get media(){return this.get(\"media\")}set media(e){this.set(\"media\",e)}get readOnly(){return this.get(\"readOnly\")}set readOnly(e){this.set(\"readOnly\",e)}},Mr=gv;var vv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"JSONReference\",this.classes.push(\"json-reference\")}get $ref(){return this.get(\"$ref\")}set $ref(e){this.set(\"$ref\",e)}},Pr=vv;var Ev=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"media\"}get binaryEncoding(){return this.get(\"binaryEncoding\")}set binaryEncoding(e){this.set(\"binaryEncoding\",e)}get type(){return this.get(\"type\")}set type(e){this.set(\"type\",e)}},zr=Ev;var bv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"linkDescription\"}get href(){return this.get(\"href\")}set href(e){this.set(\"href\",e)}get rel(){return this.get(\"rel\")}set rel(e){this.set(\"rel\",e)}get title(){return this.get(\"title\")}set title(e){this.set(\"title\",e)}get targetSchema(){return this.get(\"targetSchema\")}set targetSchema(e){this.set(\"targetSchema\",e)}get mediaType(){return this.get(\"mediaType\")}set mediaType(e){this.set(\"mediaType\",e)}get method(){return this.get(\"method\")}set method(e){this.set(\"method\",e)}get encType(){return this.get(\"encType\")}set encType(e){this.set(\"encType\",e)}get schema(){return this.get(\"schema\")}set schema(e){this.set(\"schema\",e)}},Ci=bv;var uee={namespace:t=>{let{base:e}=t;return e.register(\"jSONSchemaDraft4\",Mr),e.register(\"jSONReference\",Pr),e.register(\"media\",zr),e.register(\"linkDescription\",Ci),e}},cD=uee;var _t=t=>{if(Se(t))return`${t.element.charAt(0).toUpperCase()+t.element.slice(1)}Element`},Sv={JSONSchemaDraft4Element:[\"content\"],JSONReferenceElement:[\"content\"],MediaElement:[\"content\"],LinkDescriptionElement:[\"content\"],...ct};var Ov=class{element;constructor(e){Object.assign(this,e)}copyMetaAndAttributes(e,r){(e.meta.length>0||r.meta.length>0)&&(r.meta=fr(r.meta,e.meta)),Or(e)&&Qn(r,e),(e.attributes.length>0||e.meta.length>0)&&(r.attributes=fr(r.attributes,e.attributes))}},un=Ov;var wv=class extends un{enter(e){return this.element=$(e),ce}},le=wv;var mD=(t,e,r=[])=>{let i=Object.getOwnPropertyDescriptors(e);for(let o of r)delete i[o];Object.defineProperties(t,i)},pc=(t,e=[t])=>{let r=Object.getPrototypeOf(t);return r===null?e:pc(r,[...e,r])},pee=(...t)=>{if(t.length===0)return;let e,r=t.map(i=>pc(i));for(;r.every(i=>i.length>0);){let i=r.map(s=>s.pop()),o=i[0];if(i.every(s=>s===o))e=o;else break}return e},lD=(t,e,r=[])=>{var i;let o=(i=pee(...t))!==null&&i!==void 0?i:Object.prototype,s=Object.create(o),n=pc(o);for(let a of t){let p=pc(a);for(let l=p.length-1;l>=0;l--){let u=p[l];n.indexOf(u)===-1&&(mD(s,u,[\"constructor\",...r]),n.push(u))}}return s.constructor=e,s},jv=t=>t.filter((e,r)=>t.indexOf(e)==r),Jf=(t,e)=>{let r=e.map(s=>pc(s)),i=0,o=!0;for(;o;){o=!1;for(let s=e.length-1;s>=0;s--){let n=r[s][i];if(n!=null&&(o=!0,Object.getOwnPropertyDescriptor(n,t)!=null))return r[s][0]}i++}},dD=(t,e=Object.prototype)=>new Proxy({},{getPrototypeOf(){return e},setPrototypeOf(){throw Error(\"Cannot set prototype of Proxies created by ts-mixer\")},getOwnPropertyDescriptor(r,i){return Object.getOwnPropertyDescriptor(Jf(i,t)||{},i)},defineProperty(){throw new Error(\"Cannot define new properties on Proxies created by ts-mixer\")},has(r,i){return Jf(i,t)!==void 0||e[i]!==void 0},get(r,i){return(Jf(i,t)||e)[i]},set(r,i,o){let s=Jf(i,t);if(s===void 0)throw new Error(\"Cannot set new properties on Proxies created by ts-mixer\");return s[i]=o,!0},deleteProperty(){throw new Error(\"Cannot delete properties on Proxies created by ts-mixer\")},ownKeys(){return t.map(Object.getOwnPropertyNames).reduce((r,i)=>i.concat(r.filter(o=>i.indexOf(o)<0)))}}),fee=(t,e)=>dD([...t,{constructor:e}]),su={initFunction:null,staticsStrategy:\"copy\",prototypeStrategy:\"copy\",decoratorInheritance:\"deep\"},hD=new WeakMap,mee=t=>hD.get(t),dee=(t,e)=>hD.set(t,e);var uD=(t,e)=>{var r,i;let o=jv([...Object.getOwnPropertyNames(t),...Object.getOwnPropertyNames(e)]),s={};for(let n of o)s[n]=jv([...(r=t?.[n])!==null&&r!==void 0?r:[],...(i=e?.[n])!==null&&i!==void 0?i:[]]);return s},pD=(t,e)=>{var r,i,o,s;return{property:uD((r=t?.property)!==null&&r!==void 0?r:{},(i=e?.property)!==null&&i!==void 0?i:{}),method:uD((o=t?.method)!==null&&o!==void 0?o:{},(s=e?.method)!==null&&s!==void 0?s:{})}},xD=(t,e)=>{var r,i,o,s,n,a;return{class:jv([...(r=t?.class)!==null&&r!==void 0?r:[],...(i=e?.class)!==null&&i!==void 0?i:[]]),static:pD((o=t?.static)!==null&&o!==void 0?o:{},(s=e?.static)!==null&&s!==void 0?s:{}),instance:pD((n=t?.instance)!==null&&n!==void 0?n:{},(a=e?.instance)!==null&&a!==void 0?a:{})}},Pv=new Map,hee=(...t)=>{var e;let r=new Set,i=new Set([...t]);for(;i.size>0;)for(let o of i){let s=pc(o.prototype).map(l=>l.constructor),n=(e=mee(o))!==null&&e!==void 0?e:[],p=[...s,...n].filter(l=>!r.has(l));for(let l of p)i.add(l);r.add(o),i.delete(o)}return[...r]},xee=(...t)=>{let e=hee(...t).map(r=>Pv.get(r)).filter(r=>!!r);return e.length==0?{}:e.length==1?e[0]:e.reduce((r,i)=>xD(r,i))},yee=(...t)=>{let e=t.map(r=>gee(r));return e.length===0?{}:e.length===1?e[0]:e.reduce((r,i)=>xD(r,i))},gee=t=>{let e=Pv.get(t);return e||(e={},Pv.set(t,e)),e};function P(...t){var e,r,i;let o=t.map(p=>p.prototype),s=su.initFunction;if(s!==null){let p=o.map(f=>f[s]).filter(f=>typeof f==\"function\"),l=function(...f){for(let m of p)m.apply(this,f)},u={[s]:l};o.push(u)}function n(...p){for(let l of t)mD(this,new l(...p));s!==null&&typeof this[s]==\"function\"&&this[s].apply(this,p)}n.prototype=su.prototypeStrategy===\"copy\"?lD(o,n):fee(o,n),Object.setPrototypeOf(n,su.staticsStrategy===\"copy\"?lD(t,null,[\"prototype\"]):dD(t,Function.prototype));let a=n;if(su.decoratorInheritance!==\"none\"){let p=su.decoratorInheritance===\"deep\"?xee(...t):yee(...t);for(let l of(e=p?.class)!==null&&e!==void 0?e:[]){let u=l(a);u&&(a=u)}fD((r=p?.static)!==null&&r!==void 0?r:{},a),fD((i=p?.instance)!==null&&i!==void 0?i:{},a.prototype)}return dee(a,t),a}var fD=(t,e)=>{let r=t.property,i=t.method;if(r)for(let o in r)for(let s of r[o])s(e,o);if(i)for(let o in i)for(let s of i[o])s(e,o,Object.getOwnPropertyDescriptor(e,o))};var Av=class extends un{specObj;passingOptionsNames=[\"specObj\",\"parent\"];constructor({specObj:e,...r}){super({...r}),this.specObj=e}retrievePassingOptions(){return jl(this.passingOptionsNames,this)}retrieveFixedFields(e){let r=Te([\"visitors\",...e,\"fixedFields\"],this.specObj);return typeof r==\"object\"&&r!==null?Object.keys(r):[]}retrieveVisitor(e){return Jn(lr,[\"visitors\",...e],this.specObj)?Te([\"visitors\",...e],this.specObj):Te([\"visitors\",...e,\"$visitor\"],this.specObj)}retrieveVisitorInstance(e,r={}){let i=this.retrievePassingOptions(),o=this.retrieveVisitor(e),s={...i,...r};return new o(s)}toRefractedElement(e,r,i={}){let o=this.retrieveVisitorInstance(e,i);return o instanceof le&&o?.constructor===le?$(r):(ve(r,o,i),o.element)}},qe=Av;var Rv=class extends qe{specPath;ignoredFields;constructor({specPath:e,ignoredFields:r,...i}){super({...i}),this.specPath=e,this.ignoredFields=r||[]}ObjectElement(e){let r=this.specPath(e),i=this.retrieveFixedFields(r);return e.forEach((o,s,n)=>{if(z(s)&&i.includes(b(s))&&!this.ignoredFields.includes(b(s))){let a=this.toRefractedElement([...r,\"fixedFields\",b(s)],o),p=new Ne.MemberElement($(s),a);this.copyMetaAndAttributes(n,p),p.classes.push(\"fixed-field\"),this.element.content.push(p)}else this.ignoredFields.includes(b(s))||this.element.content.push($(n))}),this.copyMetaAndAttributes(e,this.element),ce}},Ht=Rv;var _v=class{parent;constructor({parent:e}){this.parent=e}},Ee=_v;var Iv={};vr(Iv,{isJSONReferenceElement:()=>ea,isJSONSchemaElement:()=>Hf,isLinkDescriptionElement:()=>yD,isMediaElement:()=>nu});var Hf=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Mr||t(i)&&e(\"JSONSchemaDraft4\",i)&&r(\"object\",i)),ea=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Pr||t(i)&&e(\"JSONReference\",i)&&r(\"object\",i)),nu=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof zr||t(i)&&e(\"media\",i)&&r(\"object\",i)),yD=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ci||t(i)&&e(\"linkDescription\",i)&&r(\"object\",i));var Cv=class extends P(Ht,Ee,le){constructor(e){super(e),this.element=new Mr,this.specPath=J([\"document\",\"objects\",\"JSONSchema\"])}get defaultDialectIdentifier(){return\"http://json-schema.org/draft-04/schema#\"}ObjectElement(e){return this.handleDialectIdentifier(e),this.handleSchemaIdentifier(e),this.parent=this.element,Ht.prototype.ObjectElement.call(this,e)}handleDialectIdentifier(e){if(et(this.parent)&&!z(e.get(\"$schema\")))this.element.setMetaProperty(\"inheritedDialectIdentifier\",this.defaultDialectIdentifier);else if(Hf(this.parent)&&!z(e.get(\"$schema\"))){let r=nr(b(this.parent.meta.get(\"inheritedDialectIdentifier\")),b(this.parent.$schema));this.element.setMetaProperty(\"inheritedDialectIdentifier\",r)}}handleSchemaIdentifier(e,r=\"id\"){let i=this.parent!==void 0?$(this.parent.getMetaProperty(\"ancestorsSchemaIdentifiers\",[])):new S.ArrayElement,o=b(e.get(r));zo(o)&&i.push(o),this.element.setMetaProperty(\"ancestorsSchemaIdentifiers\",i)}},au=Cv;var ut=t=>ne(t)&&t.hasKey(\"$ref\");var Tv=class extends P(qe,Ee,le){ObjectElement(e){let r=ut(e)?[\"document\",\"objects\",\"JSONReference\"]:[\"document\",\"objects\",\"JSONSchema\"];return this.element=this.toRefractedElement(r,e),ce}ArrayElement(e){return this.element=new S.ArrayElement,this.element.classes.push(\"json-schema-items\"),e.forEach(r=>{let i=ut(r)?[\"document\",\"objects\",\"JSONReference\"]:[\"document\",\"objects\",\"JSONSchema\"],o=this.toRefractedElement(i,r);this.element.push(o)}),this.copyMetaAndAttributes(e,this.element),ce}},cu=Tv;var Mv=class extends le{ArrayElement(e){let r=this.enter(e);return this.element.classes.push(\"json-schema-required\"),r}},gD=Mv;var Fv=class extends qe{specPath;ignoredFields;fieldPatternPredicate=Mn;constructor({specPath:e,ignoredFields:r,fieldPatternPredicate:i,...o}){super({...o}),this.specPath=e,this.ignoredFields=r||[],typeof i==\"function\"&&(this.fieldPatternPredicate=i)}ObjectElement(e){return e.forEach((r,i,o)=>{if(!this.ignoredFields.includes(b(i))&&this.fieldPatternPredicate(b(i))){let s=this.specPath(r),n=this.toRefractedElement(s,r),a=new Ne.MemberElement($(i),n);this.copyMetaAndAttributes(o,a),a.classes.push(\"patterned-field\"),this.element.content.push(a)}else this.ignoredFields.includes(b(i))||this.element.content.push($(o))}),this.copyMetaAndAttributes(e,this.element),ce}},fc=Fv;var $v=class extends fc{constructor(e){super(e),this.fieldPatternPredicate=zo}},pt=$v;var Nv=class extends P(pt,Ee,le){constructor(e){super(e),this.element=new S.ObjectElement,this.element.classes.push(\"json-schema-properties\"),this.specPath=r=>ut(r)?[\"document\",\"objects\",\"JSONReference\"]:[\"document\",\"objects\",\"JSONSchema\"]}},vD=Nv;var kv=class extends P(pt,Ee,le){constructor(e){super(e),this.element=new S.ObjectElement,this.element.classes.push(\"json-schema-patternProperties\"),this.specPath=r=>ut(r)?[\"document\",\"objects\",\"JSONReference\"]:[\"document\",\"objects\",\"JSONSchema\"]}},ED=kv;var Dv=class extends P(pt,Ee,le){constructor(e){super(e),this.element=new S.ObjectElement,this.element.classes.push(\"json-schema-dependencies\"),this.specPath=r=>ut(r)?[\"document\",\"objects\",\"JSONReference\"]:[\"document\",\"objects\",\"JSONSchema\"]}},bD=Dv;var qv=class extends le{ArrayElement(e){let r=this.enter(e);return this.element.classes.push(\"json-schema-enum\"),r}},SD=qv;var Vv=class extends le{StringElement(e){let r=this.enter(e);return this.element.classes.push(\"json-schema-type\"),r}ArrayElement(e){let r=this.enter(e);return this.element.classes.push(\"json-schema-type\"),r}},OD=Vv;var Lv=class extends P(qe,Ee,le){constructor(e){super(e),this.element=new S.ArrayElement,this.element.classes.push(\"json-schema-allOf\")}ArrayElement(e){return e.forEach(r=>{let i=ut(r)?[\"document\",\"objects\",\"JSONReference\"]:[\"document\",\"objects\",\"JSONSchema\"],o=this.toRefractedElement(i,r);this.element.push(o)}),this.copyMetaAndAttributes(e,this.element),ce}},wD=Lv;var Bv=class extends P(qe,Ee,le){constructor(e){super(e),this.element=new S.ArrayElement,this.element.classes.push(\"json-schema-anyOf\")}ArrayElement(e){return e.forEach(r=>{let i=ut(r)?[\"document\",\"objects\",\"JSONReference\"]:[\"document\",\"objects\",\"JSONSchema\"],o=this.toRefractedElement(i,r);this.element.push(o)}),this.copyMetaAndAttributes(e,this.element),ce}},jD=Bv;var Uv=class extends P(qe,Ee,le){constructor(e){super(e),this.element=new S.ArrayElement,this.element.classes.push(\"json-schema-oneOf\")}ArrayElement(e){return e.forEach(r=>{let i=ut(r)?[\"document\",\"objects\",\"JSONReference\"]:[\"document\",\"objects\",\"JSONSchema\"],o=this.toRefractedElement(i,r);this.element.push(o)}),this.copyMetaAndAttributes(e,this.element),ce}},PD=Uv;var Jv=class extends P(pt,Ee,le){constructor(e){super(e),this.element=new S.ObjectElement,this.element.classes.push(\"json-schema-definitions\"),this.specPath=r=>ut(r)?[\"document\",\"objects\",\"JSONReference\"]:[\"document\",\"objects\",\"JSONSchema\"]}},AD=Jv;var Hv=class extends P(qe,Ee,le){constructor(e){super(e),this.element=new S.ArrayElement,this.element.classes.push(\"json-schema-links\")}ArrayElement(e){return e.forEach(r=>{let i=this.toRefractedElement([\"document\",\"objects\",\"LinkDescription\"],r);this.element.push(i)}),this.copyMetaAndAttributes(e,this.element),ce}},RD=Hv;var zv=class extends P(Ht,le){constructor(e){super(e),this.element=new Pr,this.specPath=J([\"document\",\"objects\",\"JSONReference\"])}ObjectElement(e){let r=Ht.prototype.ObjectElement.call(this,e);return z(this.element.$ref)&&this.element.classes.push(\"reference-element\"),r}},_D=zv;var Kv=class extends le{StringElement(e){let r=this.enter(e);return this.element.classes.push(\"reference-value\"),r}},ID=Kv;var Wv=class extends qe{alternator;constructor({alternator:e,...r}){super({...r}),this.alternator=e}enter(e){let r=this.alternator.map(({predicate:o,specPath:s})=>Vn(o,J(s),Ho)),i=_l(r)(e);return this.element=this.toRefractedElement(i,e),ce}},mc=Wv;var Gv=class extends mc{constructor(e){super(e),this.alternator=[{predicate:ut,specPath:[\"document\",\"objects\",\"JSONReference\"]},{predicate:wt,specPath:[\"document\",\"objects\",\"JSONSchema\"]}]}},ta=Gv;var Yv=class extends P(Ht,le){constructor(e){super(e),this.element=new zr,this.specPath=J([\"document\",\"objects\",\"Media\"])}},CD=Yv;var Xv=class extends P(Ht,le){constructor(e){super(e),this.element=new Ci,this.specPath=J([\"document\",\"objects\",\"LinkDescription\"])}},lu=Xv;var vee={visitors:{value:le,JSONSchemaOrJSONReferenceVisitor:ta,document:{objects:{JSONSchema:{$visitor:au,fixedFields:{id:{$ref:\"#/visitors/value\"},$schema:{$ref:\"#/visitors/value\"},multipleOf:{$ref:\"#/visitors/value\"},maximum:{$ref:\"#/visitors/value\"},exclusiveMaximum:{$ref:\"#/visitors/value\"},minimum:{$ref:\"#/visitors/value\"},exclusiveMinimum:{$ref:\"#/visitors/value\"},maxLength:{$ref:\"#/visitors/value\"},minLength:{$ref:\"#/visitors/value\"},pattern:{$ref:\"#/visitors/value\"},additionalItems:ta,items:cu,maxItems:{$ref:\"#/visitors/value\"},minItems:{$ref:\"#/visitors/value\"},uniqueItems:{$ref:\"#/visitors/value\"},maxProperties:{$ref:\"#/visitors/value\"},minProperties:{$ref:\"#/visitors/value\"},required:gD,properties:vD,additionalProperties:ta,patternProperties:ED,dependencies:bD,enum:SD,type:OD,allOf:wD,anyOf:jD,oneOf:PD,not:ta,definitions:AD,title:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"},default:{$ref:\"#/visitors/value\"},format:{$ref:\"#/visitors/value\"},base:{$ref:\"#/visitors/value\"},links:RD,media:{$ref:\"#/visitors/document/objects/Media\"},readOnly:{$ref:\"#/visitors/value\"}}},JSONReference:{$visitor:_D,fixedFields:{$ref:ID}},Media:{$visitor:CD,fixedFields:{binaryEncoding:{$ref:\"#/visitors/value\"},type:{$ref:\"#/visitors/value\"}}},LinkDescription:{$visitor:lu,fixedFields:{href:{$ref:\"#/visitors/value\"},rel:{$ref:\"#/visitors/value\"},title:{$ref:\"#/visitors/value\"},targetSchema:ta,mediaType:{$ref:\"#/visitors/value\"},method:{$ref:\"#/visitors/value\"},encType:{$ref:\"#/visitors/value\"},schema:ta}}}}}},Je=vee;var Eee=()=>{let t=Ye(cD);return{predicates:{...Iv,isStringElement:z},namespace:t}},TD=Eee;var bee=(t,{specPath:e=[\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"],plugins:r=[],specificationObj:i=Je}={})=>{let o=(0,Ne.refract)(t),s=Rt(i),n=Te(e,s),a=new n({specObj:s});return ve(o,a),Xe(a.element,r,{toolboxCreator:TD,visitorOptions:{keyMap:Sv,nodeTypeGetter:_t}})},uu=t=>(e,r={})=>bee(e,{specPath:t,...r});Mr.refract=uu([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"]);Pr.refract=uu([\"visitors\",\"document\",\"objects\",\"JSONReference\",\"$visitor\"]);zr.refract=uu([\"visitors\",\"document\",\"objects\",\"Media\",\"$visitor\"]);Ci.refract=uu([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"$visitor\"]);var Qv=class extends Mr{constructor(e,r,i){super(e,r,i),this.element=\"schema\",this.classes.push(\"json-schema-draft-4\")}get idProp(){throw new ge(\"idProp getter in Schema class is not not supported.\")}set idProp(e){throw new ge(\"idProp setter in Schema class is not not supported.\")}get $schema(){throw new ge(\"$schema getter in Schema class is not not supported.\")}set $schema(e){throw new ge(\"$schema setter in Schema class is not not supported.\")}get additionalItems(){return this.get(\"additionalItems\")}set additionalItems(e){this.set(\"additionalItems\",e)}get items(){return this.get(\"items\")}set items(e){this.set(\"items\",e)}get additionalProperties(){return this.get(\"additionalProperties\")}set additionalProperties(e){this.set(\"additionalProperties\",e)}get patternProperties(){throw new ge(\"patternProperties getter in Schema class is not not supported.\")}set patternProperties(e){throw new ge(\"patternProperties setter in Schema class is not not supported.\")}get dependencies(){throw new ge(\"dependencies getter in Schema class is not not supported.\")}set dependencies(e){throw new ge(\"dependencies setter in Schema class is not not supported.\")}get type(){return this.get(\"type\")}set type(e){this.set(\"type\",e)}get not(){return this.get(\"not\")}set not(e){this.set(\"not\",e)}get definitions(){throw new ge(\"definitions getter in Schema class is not not supported.\")}set definitions(e){throw new ge(\"definitions setter in Schema class is not not supported.\")}get base(){throw new ge(\"base getter in Schema class is not not supported.\")}set base(e){throw new ge(\"base setter in Schema class is not not supported.\")}get links(){throw new ge(\"links getter in Schema class is not not supported.\")}set links(e){throw new ge(\"links setter in Schema class is not not supported.\")}get media(){throw new ge(\"media getter in Schema class is not not supported.\")}set media(e){throw new ge(\"media setter in Schema class is not not supported.\")}get nullable(){return this.get(\"nullable\")}set nullable(e){this.set(\"nullable\",e)}get discriminator(){return this.get(\"discriminator\")}set discriminator(e){this.set(\"discriminator\",e)}get writeOnly(){return this.get(\"writeOnly\")}set writeOnly(e){this.set(\"writeOnly\",e)}get xml(){return this.get(\"xml\")}set xml(e){this.set(\"xml\",e)}get externalDocs(){return this.get(\"externalDocs\")}set externalDocs(e){this.set(\"externalDocs\",e)}get example(){return this.get(\"example\")}set example(e){this.set(\"example\",e)}get deprecated(){return this.get(\"deprecated\")}set deprecated(e){this.set(\"deprecated\",e)}},rs=Qv;var Zv=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"securityRequirement\"}},Ti=Zv;var eE=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"securityScheme\"}get type(){return this.get(\"type\")}set type(e){this.set(\"type\",e)}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get name(){return this.get(\"name\")}set name(e){this.set(\"name\",e)}get in(){return this.get(\"in\")}set in(e){this.set(\"in\",e)}get scheme(){return this.get(\"scheme\")}set scheme(e){this.set(\"scheme\",e)}get bearerFormat(){return this.get(\"bearerFormat\")}set bearerFormat(e){this.set(\"bearerFormat\",e)}get flows(){return this.get(\"flows\")}set flows(e){this.set(\"flows\",e)}get openIdConnectUrl(){return this.get(\"openIdConnectUrl\")}set openIdConnectUrl(e){this.set(\"openIdConnectUrl\",e)}},Mi=eE;var tE=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"server\"}get url(){return this.get(\"url\")}set url(e){this.set(\"url\",e)}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get variables(){return this.get(\"variables\")}set variables(e){this.set(\"variables\",e)}},Fi=tE;var rE=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"serverVariable\"}get enum(){return this.get(\"enum\")}set enum(e){this.set(\"enum\",e)}get default(){return this.get(\"default\")}set default(e){this.set(\"default\",e)}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}},$i=rE;var iE=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"tag\"}get name(){return this.get(\"name\")}set name(e){this.set(\"name\",e)}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get externalDocs(){return this.get(\"externalDocs\")}set externalDocs(e){this.set(\"externalDocs\",e)}},is=iE;var oE=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"xml\"}get name(){return this.get(\"name\")}set name(e){this.set(\"name\",e)}get namespace(){return this.get(\"namespace\")}set namespace(e){this.set(\"namespace\",e)}get prefix(){return this.get(\"prefix\")}set prefix(e){this.set(\"prefix\",e)}get attribute(){return this.get(\"attribute\")}set attribute(e){this.set(\"attribute\",e)}get wrapped(){return this.get(\"wrapped\")}set wrapped(e){this.set(\"wrapped\",e)}},os=oE;var See={namespace:t=>{let{base:e}=t;return e.register(\"callback\",pi),e.register(\"components\",fi),e.register(\"contact\",mi),e.register(\"discriminator\",di),e.register(\"encoding\",Qo),e.register(\"example\",hi),e.register(\"externalDocumentation\",xi),e.register(\"header\",yi),e.register(\"info\",gi),e.register(\"license\",vi),e.register(\"link\",Ei),e.register(\"mediaType\",bi),e.register(\"oAuthFlow\",Zo),e.register(\"oAuthFlows\",es),e.register(\"openapi\",Si),e.register(\"openApi3_0\",ts),e.register(\"operation\",Oi),e.register(\"parameter\",wi),e.register(\"pathItem\",ji),e.register(\"paths\",Pi),e.register(\"reference\",Ai),e.register(\"requestBody\",Ri),e.register(\"response\",_i),e.register(\"responses\",Ii),e.register(\"schema\",rs),e.register(\"securityRequirement\",Ti),e.register(\"securityScheme\",Mi),e.register(\"server\",Fi),e.register(\"serverVariable\",$i),e.register(\"tag\",is),e.register(\"xml\",os),e}},MD=See;var sE=class t extends S.ArrayElement{static primaryClass=\"servers\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},dc=sE;var nE=class t extends S.ArrayElement{static primaryClass=\"security\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},zf=nE;var aE=class t extends S.ArrayElement{static primaryClass=\"tags\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},Kf=aE;var cE=class t extends S.ObjectElement{static primaryClass=\"server-variables\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},Wf=cE;var lE=class t extends S.ObjectElement{static primaryClass=\"components-schemas\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},ss=lE;var uE=class t extends S.ObjectElement{static primaryClass=\"components-responses\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},Gf=uE;var pE=class t extends S.ObjectElement{static primaryClass=\"components-parameters\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"parameters\")}},Yf=pE;var fE=class t extends S.ObjectElement{static primaryClass=\"components-examples\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"examples\")}},Xf=fE;var mE=class t extends S.ObjectElement{static primaryClass=\"components-request-bodies\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},Qf=mE;var dE=class t extends S.ObjectElement{static primaryClass=\"components-headers\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},Zf=dE;var hE=class t extends S.ObjectElement{static primaryClass=\"components-security-schemes\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},em=hE;var xE=class t extends S.ObjectElement{static primaryClass=\"components-links\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},tm=xE;var yE=class t extends S.ObjectElement{static primaryClass=\"components-callbacks\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},rm=yE;var gE=class t extends S.ArrayElement{static primaryClass=\"path-item-servers\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"servers\")}},im=gE;var vE=class t extends S.ArrayElement{static primaryClass=\"path-item-parameters\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"parameters\")}},om=vE;var EE=class t extends S.ArrayElement{static primaryClass=\"operation-parameters\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"parameters\")}},ns=EE;var bE=class t extends S.ObjectElement{static primaryClass=\"parameter-examples\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"examples\")}},sm=bE;var SE=class t extends S.ObjectElement{static primaryClass=\"parameter-content\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"content\")}},nm=SE;var OE=class t extends S.ArrayElement{static primaryClass=\"operation-tags\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},am=OE;var wE=class t extends S.ObjectElement{static primaryClass=\"operation-callbacks\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},cm=wE;var jE=class t extends S.ArrayElement{static primaryClass=\"operation-security\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"security\")}},as=jE;var PE=class t extends S.ArrayElement{static primaryClass=\"operation-servers\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"servers\")}},lm=PE;var AE=class t extends S.ObjectElement{static primaryClass=\"request-body-content\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"content\")}},ra=AE;var RE=class t extends S.ObjectElement{static primaryClass=\"media-type-examples\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"examples\")}},um=RE;var _E=class t extends S.ObjectElement{static primaryClass=\"media-type-encoding\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},pm=_E;var IE=class t extends S.ObjectElement{static primaryClass=\"encoding-headers\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},fm=IE;var CE=class t extends S.ObjectElement{static primaryClass=\"response-headers\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},mm=CE;var TE=class t extends S.ObjectElement{static primaryClass=\"response-content\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"content\")}},ia=TE;var ME=class t extends S.ObjectElement{static primaryClass=\"response-links\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},dm=ME;var FE=class t extends S.ObjectElement{static primaryClass=\"discriminator-mapping\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},hm=FE;var $E=class t extends S.ObjectElement{static primaryClass=\"oauth-flow-scopes\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},xm=$E;var NE=class t extends S.ObjectElement{static primaryClass=\"link-parameters\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},ym=NE;var kE=class t extends S.ObjectElement{static primaryClass=\"header-examples\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"examples\")}},gm=kE;var DE=class t extends S.ObjectElement{static primaryClass=\"header-content\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass),this.classes.push(\"content\")}},vm=DE;var FD=t=>{if(Se(t))return`${t.element.charAt(0).toUpperCase()+t.element.slice(1)}Element`},$D={CallbackElement:[\"content\"],ComponentsElement:[\"content\"],ContactElement:[\"content\"],DiscriminatorElement:[\"content\"],Encoding:[\"content\"],Example:[\"content\"],ExternalDocumentationElement:[\"content\"],HeaderElement:[\"content\"],InfoElement:[\"content\"],LicenseElement:[\"content\"],MediaTypeElement:[\"content\"],OAuthFlowElement:[\"content\"],OAuthFlowsElement:[\"content\"],OpenApi3_0Element:[\"content\"],OperationElement:[\"content\"],ParameterElement:[\"content\"],PathItemElement:[\"content\"],PathsElement:[\"content\"],ReferenceElement:[\"content\"],RequestBodyElement:[\"content\"],ResponseElement:[\"content\"],ResponsesElement:[\"content\"],SchemaElement:[\"content\"],SecurityRequirementElement:[\"content\"],SecuritySchemeElement:[\"content\"],ServerElement:[\"content\"],ServerVariableElement:[\"content\"],TagElement:[\"content\"],...ct};var qE=class{element;constructor(e={}){Object.assign(this,e)}copyMetaAndAttributes(e,r){(e.meta.length>0||r.meta.length>0)&&(r.meta=fr(r.meta,e.meta)),Or(e)&&Qn(r,e),(e.attributes.length>0||e.meta.length>0)&&(r.attributes=fr(r.attributes,e.attributes))}},pu=qE;var VE=class extends pu{enter(e){return this.element=$(e),ce}},A=VE;var LE=class extends pu{specObj;passingOptionsNames=[\"specObj\",\"openApiGenericElement\",\"openApiSemanticElement\"];openApiGenericElement;openApiSemanticElement;constructor({specObj:e,passingOptionsNames:r,openApiGenericElement:i,openApiSemanticElement:o,...s}){super({...s}),this.specObj=e,this.openApiGenericElement=i,this.openApiSemanticElement=o,Array.isArray(r)&&(this.passingOptionsNames=r)}retrievePassingOptions(){return jl(this.passingOptionsNames,this)}retrieveFixedFields(e){let r=Te([\"visitors\",...e,\"fixedFields\"],this.specObj);return typeof r==\"object\"&&r!==null?Object.keys(r):[]}retrieveVisitor(e){return Jn(lr,[\"visitors\",...e],this.specObj)?Te([\"visitors\",...e],this.specObj):Te([\"visitors\",...e,\"$visitor\"],this.specObj)}retrieveVisitorInstance(e,r={}){let i=this.retrievePassingOptions(),o=this.retrieveVisitor(e),s={...i,...r};return new o(s)}toRefractedElement(e,r,i={}){let o=this.retrieveVisitorInstance(e,i);return o instanceof A&&o?.constructor===A?$(r):(ve(r,o,i),o.element)}},ze=LE;var ue=t=>ne(t)&&t.hasKey(\"$ref\"),fu=ne,BE=ne,oa=t=>z(t.key)&&qx(\"x-\",b(t.key));var UE=class extends ze{specPath;ignoredFields;canSupportSpecificationExtensions=!0;specificationExtensionPredicate=oa;constructor({specPath:e,ignoredFields:r,canSupportSpecificationExtensions:i,specificationExtensionPredicate:o,...s}){super({...s}),this.specPath=e,this.ignoredFields=r||[],typeof i==\"boolean\"&&(this.canSupportSpecificationExtensions=i),typeof o==\"function\"&&(this.specificationExtensionPredicate=o)}ObjectElement(e){let r=this.specPath(e),i=this.retrieveFixedFields(r);return e.forEach((o,s,n)=>{if(z(s)&&i.includes(b(s))&&!this.ignoredFields.includes(b(s))){let a=this.toRefractedElement([...r,\"fixedFields\",b(s)],o),p=new Ne.MemberElement($(s),a);this.copyMetaAndAttributes(n,p),p.classes.push(\"fixed-field\"),this.element.content.push(p)}else if(this.canSupportSpecificationExtensions&&this.specificationExtensionPredicate(n)){let a=this.toRefractedElement([\"document\",\"extension\"],n);this.element.content.push(a)}else this.ignoredFields.includes(b(s))||this.element.content.push($(n))}),this.copyMetaAndAttributes(e,this.element),ce}},se=UE;var JE=class extends P(se,A){constructor(e){super(e),this.element=new ts,this.specPath=J([\"document\",\"objects\",\"OpenApi\"]),this.canSupportSpecificationExtensions=!0}ObjectElement(e){return se.prototype.ObjectElement.call(this,e)}},ND=JE;var HE=class extends P(ze,A){StringElement(e){let r=new Si(b(e));return this.copyMetaAndAttributes(e,r),this.element=r,ce}},kD=HE;var zE=class extends ze{MemberElement(e){return this.element=$(e),this.element.classes.push(\"specification-extension\"),ce}},KE=zE;var WE=class extends P(se,A){constructor(e){super(e),this.element=new gi,this.specPath=J([\"document\",\"objects\",\"Info\"]),this.canSupportSpecificationExtensions=!0}},DD=WE;var GE=class extends A{StringElement(e){let r=super.enter(e);return this.element.classes.push(\"api-version\"),this.element.classes.push(\"version\"),r}},qD=GE;var YE=class extends P(se,A){constructor(e){super(e),this.element=new mi,this.specPath=J([\"document\",\"objects\",\"Contact\"]),this.canSupportSpecificationExtensions=!0}},VD=YE;var XE=class extends P(se,A){constructor(e){super(e),this.element=new vi,this.specPath=J([\"document\",\"objects\",\"License\"]),this.canSupportSpecificationExtensions=!0}},LD=XE;var QE=class extends P(se,A){constructor(e){super(e),this.element=new Ei,this.specPath=J([\"document\",\"objects\",\"Link\"]),this.canSupportSpecificationExtensions=!0}ObjectElement(e){let r=se.prototype.ObjectElement.call(this,e);return(z(this.element.operationId)||z(this.element.operationRef))&&this.element.classes.push(\"reference-element\"),r}},BD=QE;var ZE=class extends A{StringElement(e){let r=super.enter(e);return this.element.classes.push(\"reference-value\"),r}},UD=ZE;var eb=class extends A{StringElement(e){let r=super.enter(e);return this.element.classes.push(\"reference-value\"),r}},JD=eb;var tb=class extends ze{specPath;ignoredFields;fieldPatternPredicate=Mn;canSupportSpecificationExtensions=!1;specificationExtensionPredicate=oa;constructor({specPath:e,ignoredFields:r,fieldPatternPredicate:i,canSupportSpecificationExtensions:o,specificationExtensionPredicate:s,...n}){super({...n}),this.specPath=e,this.ignoredFields=r||[],typeof i==\"function\"&&(this.fieldPatternPredicate=i),typeof o==\"boolean\"&&(this.canSupportSpecificationExtensions=o),typeof s==\"function\"&&(this.specificationExtensionPredicate=s)}ObjectElement(e){return e.forEach((r,i,o)=>{if(this.canSupportSpecificationExtensions&&this.specificationExtensionPredicate(o)){let s=this.toRefractedElement([\"document\",\"extension\"],o);this.element.content.push(s)}else if(!this.ignoredFields.includes(b(i))&&this.fieldPatternPredicate(b(i))){let s=this.specPath(r),n=this.toRefractedElement(s,r),a=new Ne.MemberElement($(i),n);this.copyMetaAndAttributes(o,a),a.classes.push(\"patterned-field\"),this.element.content.push(a)}else this.ignoredFields.includes(b(i))||this.element.content.push($(o))}),this.copyMetaAndAttributes(e,this.element),ce}},Ni=tb;var rb=class extends Ni{constructor(e){super(e),this.fieldPatternPredicate=zo}},Q=rb;var ib=class extends P(Q,A){constructor(e){super(e),this.element=new ym,this.specPath=J([\"value\"])}},HD=ib;var ob=class extends P(se,A){constructor(e){super(e),this.element=new Fi,this.specPath=J([\"document\",\"objects\",\"Server\"]),this.canSupportSpecificationExtensions=!0}},zD=ob;var sb=class extends A{StringElement(e){let r=super.enter(e);return this.element.classes.push(\"server-url\"),r}},KD=sb;var nb=class extends P(ze,A){constructor(e){super(e),this.element=new dc}ArrayElement(e){return e.forEach(r=>{let i=fu(r)?[\"document\",\"objects\",\"Server\"]:[\"value\"],o=this.toRefractedElement(i,r);this.element.push(o)}),this.copyMetaAndAttributes(e,this.element),ce}},hc=nb;var ab=class extends P(se,A){constructor(e){super(e),this.element=new $i,this.specPath=J([\"document\",\"objects\",\"ServerVariable\"]),this.canSupportSpecificationExtensions=!0}},WD=ab;var cb=class extends P(Q,A){constructor(e){super(e),this.element=new Wf,this.specPath=J([\"document\",\"objects\",\"ServerVariable\"])}},GD=cb;var lb=class extends P(se,A){constructor(e){super(e),this.element=new bi,this.specPath=J([\"document\",\"objects\",\"MediaType\"]),this.canSupportSpecificationExtensions=!0}},YD=lb;var ub=class extends ze{alternator;constructor({alternator:e,...r}){super({...r}),this.alternator=e||[]}enter(e){let r=this.alternator.map(({predicate:o,specPath:s})=>Vn(o,J(s),Ho)),i=_l(r)(e);return this.element=this.toRefractedElement(i,e),ce}},er=ub;var pb={};vr(pb,{isBooleanJsonSchemaElement:()=>fq,isCallbackElement:()=>XD,isComponentsElement:()=>QD,isContactElement:()=>ZD,isDiscriminatorElement:()=>yq,isExampleElement:()=>eq,isExternalDocumentationElement:()=>tq,isHeaderElement:()=>ki,isInfoElement:()=>rq,isLicenseElement:()=>iq,isLinkElement:()=>oq,isMediaTypeElement:()=>fn,isOpenApi3_0Element:()=>nq,isOpenapiElement:()=>sq,isOperationElement:()=>Em,isParameterElement:()=>aq,isPathItemElement:()=>xc,isPathsElement:()=>cq,isReferenceElement:()=>me,isRequestBodyElement:()=>lq,isResponseElement:()=>pn,isResponsesElement:()=>uq,isSchemaElement:()=>pq,isSecurityRequirementElement:()=>mq,isSecuritySchemeElement:()=>dq,isServerElement:()=>hq,isServerVariableElement:()=>xq,isServersElement:()=>mn});var XD=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof pi||t(i)&&e(\"callback\",i)&&r(\"object\",i)),QD=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof fi||t(i)&&e(\"components\",i)&&r(\"object\",i)),ZD=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof mi||t(i)&&e(\"contact\",i)&&r(\"object\",i)),eq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof hi||t(i)&&e(\"example\",i)&&r(\"object\",i)),tq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof xi||t(i)&&e(\"externalDocumentation\",i)&&r(\"object\",i)),ki=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof yi||t(i)&&e(\"header\",i)&&r(\"object\",i)),rq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof gi||t(i)&&e(\"info\",i)&&r(\"object\",i)),iq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof vi||t(i)&&e(\"license\",i)&&r(\"object\",i)),oq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ei||t(i)&&e(\"link\",i)&&r(\"object\",i)),sq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Si||t(i)&&e(\"openapi\",i)&&r(\"string\",i)),nq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r,hasClass:i})=>o=>o instanceof ts||t(o)&&e(\"openApi3_0\",o)&&r(\"object\",o)&&i(\"api\",o)),Em=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Oi||t(i)&&e(\"operation\",i)&&r(\"object\",i)),aq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof wi||t(i)&&e(\"parameter\",i)&&r(\"object\",i)),xc=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof ji||t(i)&&e(\"pathItem\",i)&&r(\"object\",i)),cq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Pi||t(i)&&e(\"paths\",i)&&r(\"object\",i)),me=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ai||t(i)&&e(\"reference\",i)&&r(\"object\",i)),lq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ri||t(i)&&e(\"requestBody\",i)&&r(\"object\",i)),pn=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof _i||t(i)&&e(\"response\",i)&&r(\"object\",i)),uq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ii||t(i)&&e(\"responses\",i)&&r(\"object\",i)),pq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof rs||t(i)&&e(\"schema\",i)&&r(\"object\",i)),fq=t=>Br(t)&&t.classes.includes(\"boolean-json-schema\"),mq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ti||t(i)&&e(\"securityRequirement\",i)&&r(\"object\",i)),dq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Mi||t(i)&&e(\"securityScheme\",i)&&r(\"object\",i)),hq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Fi||t(i)&&e(\"server\",i)&&r(\"object\",i)),xq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof $i||t(i)&&e(\"serverVariable\",i)&&r(\"object\",i)),fn=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof bi||t(i)&&e(\"mediaType\",i)&&r(\"object\",i)),mn=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r,hasClass:i})=>o=>o instanceof dc||t(o)&&e(\"array\",o)&&r(\"array\",o)&&i(\"servers\",o)),yq=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof di||t(i)&&e(\"discriminator\",i)&&r(\"object\",i));var fb=class extends P(er,A){constructor(e){super(e),this.alternator=[{predicate:ue,specPath:[\"document\",\"objects\",\"Reference\"]},{predicate:wt,specPath:[\"document\",\"objects\",\"Schema\"]}]}ObjectElement(e){let r=er.prototype.enter.call(this,e);return me(this.element)&&this.element.setMetaProperty(\"referenced-element\",\"schema\"),r}},gq=fb;var mb=class extends P(Q,A){constructor(e){super(e),this.element=new S.ObjectElement,this.element.classes.push(\"examples\"),this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Example\"],this.canSupportSpecificationExtensions=!0}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"example\")}),r}},yc=mb;var db=class extends yc{constructor(e){super(e),this.element=new um}},vq=db;var hb=class extends P(Q,A){constructor(e){super(e),this.element=new pm,this.specPath=J([\"document\",\"objects\",\"Encoding\"])}},Eq=hb;var xb=class extends P(Q,A){constructor(e){super(e),this.element=new Ti,this.specPath=J([\"value\"])}},bq=xb;var yb=class extends P(ze,A){constructor(e){super(e),this.element=new zf}ArrayElement(e){return e.forEach(r=>{if(ne(r)){let i=this.toRefractedElement([\"document\",\"objects\",\"SecurityRequirement\"],r);this.element.push(i)}else this.element.push($(r))}),this.copyMetaAndAttributes(e,this.element),ce}},Sq=yb;var gb=class extends P(se,A){constructor(e){super(e),this.element=new fi,this.specPath=J([\"document\",\"objects\",\"Components\"]),this.canSupportSpecificationExtensions=!0}},Oq=gb;var vb=class extends P(se,A){constructor(e){super(e),this.element=new is,this.specPath=J([\"document\",\"objects\",\"Tag\"]),this.canSupportSpecificationExtensions=!0}},wq=vb;var Eb=class extends P(se,A){constructor(e){super(e),this.element=new Ai,this.specPath=J([\"document\",\"objects\",\"Reference\"]),this.canSupportSpecificationExtensions=!1}ObjectElement(e){let r=se.prototype.ObjectElement.call(this,e);return z(this.element.$ref)&&this.element.classes.push(\"reference-element\"),r}},jq=Eb;var bb=class extends A{StringElement(e){let r=super.enter(e);return this.element.classes.push(\"reference-value\"),r}},Pq=bb;var Sb=class extends P(se,A){constructor(e){super(e),this.element=new wi,this.specPath=J([\"document\",\"objects\",\"Parameter\"]),this.canSupportSpecificationExtensions=!0}ObjectElement(e){let r=se.prototype.ObjectElement.call(this,e);return ne(this.element.contentProp)&&this.element.contentProp.filter(fn).forEach((i,o)=>{i.setMetaProperty(\"media-type\",b(o))}),r}},Aq=Sb;var Ob=class extends P(er,A){constructor(e){super(e),this.alternator=[{predicate:ue,specPath:[\"document\",\"objects\",\"Reference\"]},{predicate:wt,specPath:[\"document\",\"objects\",\"Schema\"]}]}ObjectElement(e){let r=er.prototype.enter.call(this,e);return me(this.element)&&this.element.setMetaProperty(\"referenced-element\",\"schema\"),r}},Rq=Ob;var wb=class extends P(se,A){constructor(e){super(e),this.element=new yi,this.specPath=J([\"document\",\"objects\",\"Header\"]),this.canSupportSpecificationExtensions=!0}},_q=wb;var jb=class extends P(er,A){constructor(e){super(e),this.alternator=[{predicate:ue,specPath:[\"document\",\"objects\",\"Reference\"]},{predicate:wt,specPath:[\"document\",\"objects\",\"Schema\"]}]}ObjectElement(e){let r=er.prototype.enter.call(this,e);return me(this.element)&&this.element.setMetaProperty(\"referenced-element\",\"schema\"),r}},Iq=jb;var Pb=class extends yc{constructor(e){super(e),this.element=new gm}},Cq=Pb;var Ab=class extends P(Q,A){constructor(e){super(e),this.element=new S.ObjectElement,this.element.classes.push(\"content\"),this.specPath=J([\"document\",\"objects\",\"MediaType\"])}},dn=Ab;var Rb=class extends dn{constructor(e){super(e),this.element=new vm}},Tq=Rb;var _b=class extends P(se,A){constructor(e){super(e),this.element=new rs,this.specPath=J([\"document\",\"objects\",\"Schema\"]),this.canSupportSpecificationExtensions=!0}},Mq=_b;var Fq=Je.visitors.document.objects.JSONSchema.fixedFields.allOf,Ib=class extends Fq{ArrayElement(e){let r=Fq.prototype.ArrayElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"schema\")}),r}},$q=Ib;var Nq=Je.visitors.document.objects.JSONSchema.fixedFields.anyOf,Cb=class extends Nq{ArrayElement(e){let r=Nq.prototype.ArrayElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"schema\")}),r}},kq=Cb;var Dq=Je.visitors.document.objects.JSONSchema.fixedFields.oneOf,Tb=class extends Dq{ArrayElement(e){let r=Dq.prototype.ArrayElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"schema\")}),r}},qq=Tb;var Vq=Je.visitors.document.objects.JSONSchema.fixedFields.items,Mb=class extends Vq{ObjectElement(e){let r=Vq.prototype.ObjectElement.call(this,e);return me(this.element)&&this.element.setMetaProperty(\"referenced-element\",\"schema\"),r}ArrayElement(e){return this.enter(e)}},Lq=Mb;var Bq=Je.visitors.document.objects.JSONSchema.fixedFields.properties,Fb=class extends Bq{ObjectElement(e){let r=Bq.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"schema\")}),r}},Uq=Fb;var Oee=Je.visitors.document.objects.JSONSchema.fixedFields.type,$b=class extends Oee{ArrayElement(e){return this.enter(e)}},Jq=$b;var Hq=Je.visitors.JSONSchemaOrJSONReferenceVisitor,Nb=class extends Hq{ObjectElement(e){let r=Hq.prototype.enter.call(this,e);return me(this.element)&&this.element.setMetaProperty(\"referenced-element\",\"schema\"),r}},kb=Nb;var Db=class extends P(se,A){constructor(e){super(e),this.element=new di,this.specPath=J([\"document\",\"objects\",\"Discriminator\"]),this.canSupportSpecificationExtensions=!1}},zq=Db;var qb=class extends P(Q,A){constructor(e){super(e),this.element=new hm,this.specPath=J([\"value\"])}},Kq=qb;var Vb=class extends P(se,A){constructor(e){super(e),this.element=new os,this.specPath=J([\"document\",\"objects\",\"XML\"]),this.canSupportSpecificationExtensions=!0}},Wq=Vb;var Lb=class extends yc{constructor(e){super(e),this.element=new sm}},Gq=Lb;var Bb=class extends dn{constructor(e){super(e),this.element=new nm}},Yq=Bb;var Ub=class extends P(Q,A){constructor(e){super(e),this.element=new ss,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Schema\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"schema\")}),r}},Xq=Ub;var Jb=class extends P(Q,A){constructor(e){super(e),this.element=new Gf,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Response\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"response\")}),this.element.filter(pn).forEach((i,o)=>{i.setMetaProperty(\"http-status-code\",b(o))}),r}},Qq=Jb;var Hb=class extends P(Q,A){constructor(e){super(e),this.element=new Yf,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Parameter\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"parameter\")}),r}},Zq=Hb;var zb=class extends P(Q,A){constructor(e){super(e),this.element=new Xf,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Example\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"example\")}),r}},eV=zb;var Kb=class extends P(Q,A){constructor(e){super(e),this.element=new Qf,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"RequestBody\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"requestBody\")}),r}},tV=Kb;var Wb=class extends P(Q,A){constructor(e){super(e),this.element=new Zf,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Header\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"header\")}),this.element.filter(ki).forEach((i,o)=>{i.setMetaProperty(\"header-name\",b(o))}),r}},rV=Wb;var Gb=class extends P(Q,A){constructor(e){super(e),this.element=new em,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"SecurityScheme\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"securityScheme\")}),r}},iV=Gb;var Yb=class extends P(Q,A){constructor(e){super(e),this.element=new tm,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Link\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"link\")}),r}},oV=Yb;var Xb=class extends P(Q,A){constructor(e){super(e),this.element=new rm,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Callback\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"callback\")}),r}},sV=Xb;var Qb=class extends P(se,A){constructor(e){super(e),this.element=new hi,this.specPath=J([\"document\",\"objects\",\"Example\"]),this.canSupportSpecificationExtensions=!0}ObjectElement(e){let r=se.prototype.ObjectElement.call(this,e);return z(this.element.externalValue)&&this.element.classes.push(\"reference-element\"),r}},nV=Qb;var Zb=class extends A{StringElement(e){let r=super.enter(e);return this.element.classes.push(\"reference-value\"),r}},aV=Zb;var eS=class extends P(se,A){constructor(e){super(e),this.element=new xi,this.specPath=J([\"document\",\"objects\",\"ExternalDocumentation\"]),this.canSupportSpecificationExtensions=!0}},cV=eS;var tS=class extends P(se,A){constructor(e){super(e),this.element=new Qo,this.specPath=J([\"document\",\"objects\",\"Encoding\"]),this.canSupportSpecificationExtensions=!0}ObjectElement(e){let r=se.prototype.ObjectElement.call(this,e);return ne(this.element.headers)&&this.element.headers.filter(ki).forEach((i,o)=>{i.setMetaProperty(\"header-name\",b(o))}),r}},lV=tS;var rS=class extends P(Q,A){constructor(e){super(e),this.element=new fm,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Header\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"header\")}),this.element.forEach((i,o)=>{if(!ki(i))return;let s=b(o);i.setMetaProperty(\"headerName\",s)}),r}},uV=rS;var iS=class extends P(Ni,A){constructor(e){super(e),this.element=new Pi,this.specPath=J([\"document\",\"objects\",\"PathItem\"]),this.canSupportSpecificationExtensions=!0,this.fieldPatternPredicate=wt}ObjectElement(e){let r=Ni.prototype.ObjectElement.call(this,e);return this.element.filter(xc).forEach((i,o)=>{o.classes.push(\"openapi-path-template\"),o.classes.push(\"path-template\"),i.setMetaProperty(\"path\",$(o))}),r}},pV=iS;var oS=class extends P(se,A){constructor(e){super(e),this.element=new Ri,this.specPath=J([\"document\",\"objects\",\"RequestBody\"])}ObjectElement(e){let r=se.prototype.ObjectElement.call(this,e);return ne(this.element.contentProp)&&this.element.contentProp.filter(fn).forEach((i,o)=>{i.setMetaProperty(\"media-type\",b(o))}),r}},fV=oS;var sS=class extends dn{constructor(e){super(e),this.element=new ra}},mV=sS;var nS=class extends P(Ni,A){constructor(e){super(e),this.element=new pi,this.specPath=J([\"document\",\"objects\",\"PathItem\"]),this.canSupportSpecificationExtensions=!0,this.fieldPatternPredicate=r=>/{(?<expression>[^}]{1,2083})}/.test(String(r))}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(xc).forEach((i,o)=>{i.setMetaProperty(\"runtime-expression\",b(o))}),r}},dV=nS;var aS=class extends P(se,A){constructor(e){super(e),this.element=new _i,this.specPath=J([\"document\",\"objects\",\"Response\"])}ObjectElement(e){let r=se.prototype.ObjectElement.call(this,e);return ne(this.element.contentProp)&&this.element.contentProp.filter(fn).forEach((i,o)=>{i.setMetaProperty(\"media-type\",b(o))}),ne(this.element.headers)&&this.element.headers.filter(ki).forEach((i,o)=>{i.setMetaProperty(\"header-name\",b(o))}),r}},hV=aS;var cS=class extends P(Q,A){constructor(e){super(e),this.element=new mm,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Header\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"header\")}),this.element.forEach((i,o)=>{if(!ki(i))return;let s=b(o);i.setMetaProperty(\"header-name\",s)}),r}},xV=cS;var lS=class extends dn{constructor(e){super(e),this.element=new ia}},yV=lS;var uS=class extends P(Q,A){constructor(e){super(e),this.element=new dm,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Link\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"link\")}),r}},gV=uS;var pS=class extends P(se,Ni){specPathFixedFields;specPathPatternedFields;constructor({specPathFixedFields:e,specPathPatternedFields:r,...i}){super({...i}),this.specPathFixedFields=e,this.specPathPatternedFields=r}ObjectElement(e){let{specPath:r,ignoredFields:i}=this;try{this.specPath=this.specPathFixedFields;let o=this.retrieveFixedFields(this.specPath(e));this.ignoredFields=[...i,...vx(e.keys(),o)],se.prototype.ObjectElement.call(this,e),this.specPath=this.specPathPatternedFields,this.ignoredFields=o,Ni.prototype.ObjectElement.call(this,e)}catch(o){throw this.specPath=r,o}return ce}},bm=pS;var fS=class extends P(bm,A){constructor(e){super(e),this.element=new Ii,this.specPathFixedFields=J([\"document\",\"objects\",\"Responses\"]),this.canSupportSpecificationExtensions=!0,this.specPathPatternedFields=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Response\"],this.fieldPatternPredicate=r=>new RegExp(`^(1XX|2XX|3XX|4XX|5XX|${Nx(100,600).join(\"|\")})$`).test(String(r))}ObjectElement(e){let r=bm.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"response\")}),this.element.filter(pn).forEach((i,o)=>{let s=$(o);this.fieldPatternPredicate(b(s))&&i.setMetaProperty(\"http-status-code\",s)}),r}},vV=fS;var mS=class extends P(er,A){constructor(e){super(e),this.alternator=[{predicate:ue,specPath:[\"document\",\"objects\",\"Reference\"]},{predicate:wt,specPath:[\"document\",\"objects\",\"Response\"]}]}ObjectElement(e){let r=er.prototype.enter.call(this,e);return me(this.element)?this.element.setMetaProperty(\"referenced-element\",\"response\"):pn(this.element)&&this.element.setMetaProperty(\"http-status-code\",\"default\"),r}},EV=mS;var dS=class extends P(se,A){constructor(e){super(e),this.element=new Oi,this.specPath=J([\"document\",\"objects\",\"Operation\"])}},bV=dS;var hS=class extends A{constructor(e){super(e),this.element=new am}ArrayElement(e){return this.element=this.element.concat($(e)),ce}},SV=hS;var xS=class extends P(ze,A){constructor(e){super(e),this.element=new S.ArrayElement,this.element.classes.push(\"parameters\")}ArrayElement(e){return e.forEach(r=>{let i=ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Parameter\"],o=this.toRefractedElement(i,r);me(o)&&o.setMetaProperty(\"referenced-element\",\"parameter\"),this.element.push(o)}),this.copyMetaAndAttributes(e,this.element),ce}},Sm=xS;var yS=class extends Sm{constructor(e){super(e),this.element=new ns}},OV=yS;var gS=class extends er{constructor(e){super(e),this.alternator=[{predicate:ue,specPath:[\"document\",\"objects\",\"Reference\"]},{predicate:wt,specPath:[\"document\",\"objects\",\"RequestBody\"]}]}ObjectElement(e){let r=er.prototype.enter.call(this,e);return me(this.element)&&this.element.setMetaProperty(\"referenced-element\",\"requestBody\"),r}},wV=gS;var vS=class extends P(Q,A){specPath;constructor(e){super(e),this.element=new cm,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"Callback\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(me).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"callback\")}),r}},jV=vS;var ES=class extends P(ze,A){constructor(e){super(e),this.element=new as}ArrayElement(e){return e.forEach(r=>{let i=ne(r)?[\"document\",\"objects\",\"SecurityRequirement\"]:[\"value\"],o=this.toRefractedElement(i,r);this.element.push(o)}),this.copyMetaAndAttributes(e,this.element),ce}},PV=ES;var bS=class extends hc{constructor(e){super(e),this.element=new lm}},AV=bS;var SS=class extends P(se,A){constructor(e){super(e),this.element=new ji,this.specPath=J([\"document\",\"objects\",\"PathItem\"])}ObjectElement(e){let r=se.prototype.ObjectElement.call(this,e);return this.element.filter(Em).forEach((i,o)=>{let s=$(o);s.content=b(s).toUpperCase(),i.setMetaProperty(\"http-method\",s)}),z(this.element.$ref)&&this.element.classes.push(\"reference-element\"),r}},RV=SS;var OS=class extends A{StringElement(e){let r=super.enter(e);return this.element.classes.push(\"reference-value\"),r}},_V=OS;var wS=class extends hc{constructor(e){super(e),this.element=new im}},IV=wS;var jS=class extends Sm{constructor(e){super(e),this.element=new om}},CV=jS;var PS=class extends P(se,A){constructor(e){super(e),this.element=new Mi,this.specPath=J([\"document\",\"objects\",\"SecurityScheme\"]),this.canSupportSpecificationExtensions=!0}},TV=PS;var AS=class extends P(se,A){constructor(e){super(e),this.element=new es,this.specPath=J([\"document\",\"objects\",\"OAuthFlows\"]),this.canSupportSpecificationExtensions=!0}},MV=AS;var RS=class extends P(se,A){constructor(e){super(e),this.element=new Zo,this.specPath=J([\"document\",\"objects\",\"OAuthFlow\"]),this.canSupportSpecificationExtensions=!0}},FV=RS;var _S=class extends P(Q,A){constructor(e){super(e),this.element=new xm,this.specPath=J([\"value\"])}},$V=_S;var IS=class extends P(ze,A){constructor(e){super(e),this.element=new Kf}ArrayElement(e){return e.forEach(r=>{let i=BE(r)?[\"document\",\"objects\",\"Tag\"]:[\"value\"],o=this.toRefractedElement(i,r);this.element.push(o)}),this.copyMetaAndAttributes(e,this.element),ce}},NV=IS;var{fixedFields:Et}=Je.visitors.document.objects.JSONSchema,wee={visitors:{value:A,document:{objects:{OpenApi:{$visitor:ND,fixedFields:{openapi:kD,info:{$ref:\"#/visitors/document/objects/Info\"},servers:hc,paths:{$ref:\"#/visitors/document/objects/Paths\"},components:{$ref:\"#/visitors/document/objects/Components\"},security:Sq,tags:NV,externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"}}},Info:{$visitor:DD,fixedFields:{title:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"},termsOfService:{$ref:\"#/visitors/value\"},contact:{$ref:\"#/visitors/document/objects/Contact\"},license:{$ref:\"#/visitors/document/objects/License\"},version:qD}},Contact:{$visitor:VD,fixedFields:{name:{$ref:\"#/visitors/value\"},url:{$ref:\"#/visitors/value\"},email:{$ref:\"#/visitors/value\"}}},License:{$visitor:LD,fixedFields:{name:{$ref:\"#/visitors/value\"},url:{$ref:\"#/visitors/value\"}}},Server:{$visitor:zD,fixedFields:{url:KD,description:{$ref:\"#/visitors/value\"},variables:GD}},ServerVariable:{$visitor:WD,fixedFields:{enum:{$ref:\"#/visitors/value\"},default:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"}}},Components:{$visitor:Oq,fixedFields:{schemas:Xq,responses:Qq,parameters:Zq,examples:eV,requestBodies:tV,headers:rV,securitySchemes:iV,links:oV,callbacks:sV}},Paths:{$visitor:pV},PathItem:{$visitor:RV,fixedFields:{$ref:_V,summary:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"},get:{$ref:\"#/visitors/document/objects/Operation\"},put:{$ref:\"#/visitors/document/objects/Operation\"},post:{$ref:\"#/visitors/document/objects/Operation\"},delete:{$ref:\"#/visitors/document/objects/Operation\"},options:{$ref:\"#/visitors/document/objects/Operation\"},head:{$ref:\"#/visitors/document/objects/Operation\"},patch:{$ref:\"#/visitors/document/objects/Operation\"},trace:{$ref:\"#/visitors/document/objects/Operation\"},servers:IV,parameters:CV}},Operation:{$visitor:bV,fixedFields:{tags:SV,summary:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"},externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"},operationId:{$ref:\"#/visitors/value\"},parameters:OV,requestBody:wV,responses:{$ref:\"#/visitors/document/objects/Responses\"},callbacks:jV,deprecated:{$ref:\"#/visitors/value\"},security:PV,servers:AV}},ExternalDocumentation:{$visitor:cV,fixedFields:{description:{$ref:\"#/visitors/value\"},url:{$ref:\"#/visitors/value\"}}},Parameter:{$visitor:Aq,fixedFields:{name:{$ref:\"#/visitors/value\"},in:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"},required:{$ref:\"#/visitors/value\"},deprecated:{$ref:\"#/visitors/value\"},allowEmptyValue:{$ref:\"#/visitors/value\"},style:{$ref:\"#/visitors/value\"},explode:{$ref:\"#/visitors/value\"},allowReserved:{$ref:\"#/visitors/value\"},schema:Rq,example:{$ref:\"#/visitors/value\"},examples:Gq,content:Yq}},RequestBody:{$visitor:fV,fixedFields:{description:{$ref:\"#/visitors/value\"},content:mV,required:{$ref:\"#/visitors/value\"}}},MediaType:{$visitor:YD,fixedFields:{schema:gq,example:{$ref:\"#/visitors/value\"},examples:vq,encoding:Eq}},Encoding:{$visitor:lV,fixedFields:{contentType:{$ref:\"#/visitors/value\"},headers:uV,style:{$ref:\"#/visitors/value\"},explode:{$ref:\"#/visitors/value\"},allowReserved:{$ref:\"#/visitors/value\"}}},Responses:{$visitor:vV,fixedFields:{default:EV}},Response:{$visitor:hV,fixedFields:{description:{$ref:\"#/visitors/value\"},headers:xV,content:yV,links:gV}},Callback:{$visitor:dV},Example:{$visitor:nV,fixedFields:{summary:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"},value:{$ref:\"#/visitors/value\"},externalValue:aV}},Link:{$visitor:BD,fixedFields:{operationRef:UD,operationId:JD,parameters:HD,requestBody:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"},server:{$ref:\"#/visitors/document/objects/Server\"}}},Header:{$visitor:_q,fixedFields:{description:{$ref:\"#/visitors/value\"},required:{$ref:\"#/visitors/value\"},deprecated:{$ref:\"#/visitors/value\"},allowEmptyValue:{$ref:\"#/visitors/value\"},style:{$ref:\"#/visitors/value\"},explode:{$ref:\"#/visitors/value\"},allowReserved:{$ref:\"#/visitors/value\"},schema:Iq,example:{$ref:\"#/visitors/value\"},examples:Cq,content:Tq}},Tag:{$visitor:wq,fixedFields:{name:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"},externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"}}},Reference:{$visitor:jq,fixedFields:{$ref:Pq}},JSONSchema:{$ref:\"#/visitors/document/objects/Schema\"},JSONReference:{$ref:\"#/visitors/document/objects/Reference\"},Schema:{$visitor:Mq,fixedFields:{title:Et.title,multipleOf:Et.multipleOf,maximum:Et.maximum,exclusiveMaximum:Et.exclusiveMaximum,minimum:Et.minimum,exclusiveMinimum:Et.exclusiveMinimum,maxLength:Et.maxLength,minLength:Et.minLength,pattern:Et.pattern,maxItems:Et.maxItems,minItems:Et.minItems,uniqueItems:Et.uniqueItems,maxProperties:Et.maxProperties,minProperties:Et.minProperties,required:Et.required,enum:Et.enum,type:Jq,allOf:$q,anyOf:kq,oneOf:qq,not:kb,items:Lq,properties:Uq,additionalProperties:kb,description:Et.description,format:Et.format,default:Et.default,nullable:{$ref:\"#/visitors/value\"},discriminator:{$ref:\"#/visitors/document/objects/Discriminator\"},writeOnly:{$ref:\"#/visitors/value\"},xml:{$ref:\"#/visitors/document/objects/XML\"},externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"},example:{$ref:\"#/visitors/value\"},deprecated:{$ref:\"#/visitors/value\"}}},Discriminator:{$visitor:zq,fixedFields:{propertyName:{$ref:\"#/visitors/value\"},mapping:Kq}},XML:{$visitor:Wq,fixedFields:{name:{$ref:\"#/visitors/value\"},namespace:{$ref:\"#/visitors/value\"},prefix:{$ref:\"#/visitors/value\"},attribute:{$ref:\"#/visitors/value\"},wrapped:{$ref:\"#/visitors/value\"}}},SecurityScheme:{$visitor:TV,fixedFields:{type:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"},name:{$ref:\"#/visitors/value\"},in:{$ref:\"#/visitors/value\"},scheme:{$ref:\"#/visitors/value\"},bearerFormat:{$ref:\"#/visitors/value\"},flows:{$ref:\"#/visitors/document/objects/OAuthFlows\"},openIdConnectUrl:{$ref:\"#/visitors/value\"}}},OAuthFlows:{$visitor:MV,fixedFields:{implicit:{$ref:\"#/visitors/document/objects/OAuthFlow\"},password:{$ref:\"#/visitors/document/objects/OAuthFlow\"},clientCredentials:{$ref:\"#/visitors/document/objects/OAuthFlow\"},authorizationCode:{$ref:\"#/visitors/document/objects/OAuthFlow\"}}},OAuthFlow:{$visitor:FV,fixedFields:{authorizationUrl:{$ref:\"#/visitors/value\"},tokenUrl:{$ref:\"#/visitors/value\"},refreshUrl:{$ref:\"#/visitors/value\"},scopes:$V}},SecurityRequirement:{$visitor:bq}},extension:{$visitor:KE}}}},_=wee;var jee=()=>{let t=Ye(MD);return{predicates:{...pb,isElement:Se,isStringElement:z,isArrayElement:Pe,isObjectElement:ne,isMemberElement:Ue,includesClasses:At,hasElementSourceMap:Or},namespace:t}},kV=jee;var Pee=(t,{specPath:e=[\"visitors\",\"document\",\"objects\",\"OpenApi\",\"$visitor\"],plugins:r=[]}={})=>{let i=(0,Ne.refract)(t),o=Rt(_),s=Te(e,o),n=new s({specObj:o});return ve(i,n),Xe(n.element,r,{toolboxCreator:kV,visitorOptions:{keyMap:$D,nodeTypeGetter:FD}})},De=t=>(e,r={})=>Pee(e,{specPath:t,...r});pi.refract=De([\"visitors\",\"document\",\"objects\",\"Callback\",\"$visitor\"]);fi.refract=De([\"visitors\",\"document\",\"objects\",\"Components\",\"$visitor\"]);mi.refract=De([\"visitors\",\"document\",\"objects\",\"Contact\",\"$visitor\"]);hi.refract=De([\"visitors\",\"document\",\"objects\",\"Example\",\"$visitor\"]);di.refract=De([\"visitors\",\"document\",\"objects\",\"Discriminator\",\"$visitor\"]);Qo.refract=De([\"visitors\",\"document\",\"objects\",\"Encoding\",\"$visitor\"]);xi.refract=De([\"visitors\",\"document\",\"objects\",\"ExternalDocumentation\",\"$visitor\"]);yi.refract=De([\"visitors\",\"document\",\"objects\",\"Header\",\"$visitor\"]);gi.refract=De([\"visitors\",\"document\",\"objects\",\"Info\",\"$visitor\"]);vi.refract=De([\"visitors\",\"document\",\"objects\",\"License\",\"$visitor\"]);Ei.refract=De([\"visitors\",\"document\",\"objects\",\"Link\",\"$visitor\"]);bi.refract=De([\"visitors\",\"document\",\"objects\",\"MediaType\",\"$visitor\"]);Zo.refract=De([\"visitors\",\"document\",\"objects\",\"OAuthFlow\",\"$visitor\"]);es.refract=De([\"visitors\",\"document\",\"objects\",\"OAuthFlows\",\"$visitor\"]);Si.refract=De([\"visitors\",\"document\",\"objects\",\"OpenApi\",\"fixedFields\",\"openapi\"]);ts.refract=De([\"visitors\",\"document\",\"objects\",\"OpenApi\",\"$visitor\"]);Oi.refract=De([\"visitors\",\"document\",\"objects\",\"Operation\",\"$visitor\"]);wi.refract=De([\"visitors\",\"document\",\"objects\",\"Parameter\",\"$visitor\"]);ji.refract=De([\"visitors\",\"document\",\"objects\",\"PathItem\",\"$visitor\"]);Pi.refract=De([\"visitors\",\"document\",\"objects\",\"Paths\",\"$visitor\"]);Ai.refract=De([\"visitors\",\"document\",\"objects\",\"Reference\",\"$visitor\"]);Ri.refract=De([\"visitors\",\"document\",\"objects\",\"RequestBody\",\"$visitor\"]);_i.refract=De([\"visitors\",\"document\",\"objects\",\"Response\",\"$visitor\"]);Ii.refract=De([\"visitors\",\"document\",\"objects\",\"Responses\",\"$visitor\"]);rs.refract=De([\"visitors\",\"document\",\"objects\",\"Schema\",\"$visitor\"]);Ti.refract=De([\"visitors\",\"document\",\"objects\",\"SecurityRequirement\",\"$visitor\"]);Mi.refract=De([\"visitors\",\"document\",\"objects\",\"SecurityScheme\",\"$visitor\"]);Fi.refract=De([\"visitors\",\"document\",\"objects\",\"Server\",\"$visitor\"]);$i.refract=De([\"visitors\",\"document\",\"objects\",\"ServerVariable\",\"$visitor\"]);is.refract=De([\"visitors\",\"document\",\"objects\",\"Tag\",\"$visitor\"]);os.refract=De([\"visitors\",\"document\",\"objects\",\"XML\",\"$visitor\"]);var CS=class extends pi{},Di=CS;var TS=class extends fi{get pathItems(){return this.get(\"pathItems\")}set pathItems(e){this.set(\"pathItems\",e)}},qi=TS;var MS=class extends mi{},Vi=MS;var FS=class extends di{},cs=FS;var $S=class extends Qo{},ls=$S;var NS=class extends hi{},Li=NS;var kS=class extends xi{},Bi=kS;var DS=class extends yi{get schema(){return this.get(\"schema\")}set schema(e){this.set(\"schema\",e)}},Ui=DS;var qS=class extends gi{get license(){return this.get(\"license\")}set license(e){this.set(\"license\",e)}get summary(){return this.get(\"summary\")}set summary(e){this.set(\"summary\",e)}},Ji=qS;var VS=class t extends S.StringElement{static default=new t(\"https://spec.openapis.org/oas/3.1/dialect/base\");constructor(e,r,i){super(e,r,i),this.element=\"jsonSchemaDialect\"}},Hi=VS;var LS=class extends vi{get identifier(){return this.get(\"identifier\")}set identifier(e){this.set(\"identifier\",e)}},zi=LS;var BS=class extends Ei{},Ki=BS;var US=class extends bi{get schema(){return this.get(\"schema\")}set schema(e){this.set(\"schema\",e)}},Wi=US;var JS=class extends Zo{},us=JS;var HS=class extends es{},ps=HS;var zS=class extends Si{},fs=zS;var KS=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"openApi3_1\",this.classes.push(\"api\")}get openapi(){return this.get(\"openapi\")}set openapi(e){this.set(\"openapi\",e)}get info(){return this.get(\"info\")}set info(e){this.set(\"info\",e)}get jsonSchemaDialect(){return this.get(\"jsonSchemaDialect\")}set jsonSchemaDialect(e){this.set(\"jsonSchemaDialect\",e)}get servers(){return this.get(\"servers\")}set servers(e){this.set(\"servers\",e)}get paths(){return this.get(\"paths\")}set paths(e){this.set(\"paths\",e)}get components(){return this.get(\"components\")}set components(e){this.set(\"components\",e)}get security(){return this.get(\"security\")}set security(e){this.set(\"security\",e)}get tags(){return this.get(\"tags\")}set tags(e){this.set(\"tags\",e)}get externalDocs(){return this.get(\"externalDocs\")}set externalDocs(e){this.set(\"externalDocs\",e)}get webhooks(){return this.get(\"webhooks\")}set webhooks(e){this.set(\"webhooks\",e)}},zt=KS;var WS=class extends Oi{get requestBody(){return this.get(\"requestBody\")}set requestBody(e){this.set(\"requestBody\",e)}},Fr=WS;var GS=class extends wi{get schema(){return this.get(\"schema\")}set schema(e){this.set(\"schema\",e)}},Gi=GS;var YS=class extends ji{get GET(){return this.get(\"get\")}set GET(e){this.set(\"GET\",e)}get PUT(){return this.get(\"put\")}set PUT(e){this.set(\"PUT\",e)}get POST(){return this.get(\"post\")}set POST(e){this.set(\"POST\",e)}get DELETE(){return this.get(\"delete\")}set DELETE(e){this.set(\"DELETE\",e)}get OPTIONS(){return this.get(\"options\")}set OPTIONS(e){this.set(\"OPTIONS\",e)}get HEAD(){return this.get(\"head\")}set HEAD(e){this.set(\"HEAD\",e)}get PATCH(){return this.get(\"patch\")}set PATCH(e){this.set(\"PATCH\",e)}get TRACE(){return this.get(\"trace\")}set TRACE(e){this.set(\"TRACE\",e)}},Kt=YS;var XS=class extends Pi{},Yi=XS;var mu=class extends Ai{};Object.defineProperty(mu.prototype,\"description\",{get(){return this.get(\"description\")},set(t){this.set(\"description\",t)},enumerable:!0});Object.defineProperty(mu.prototype,\"summary\",{get(){return this.get(\"summary\")},set(t){this.set(\"summary\",t)},enumerable:!0});var dr=mu;var QS=class extends Ri{},Xi=QS;var ZS=class extends _i{},Qi=ZS;var eO=class extends Ii{},Zi=eO;var tO=class extends Mr{constructor(e,r,i){super(e,r,i),this.element=\"JSONSchemaDraft6\"}get idProp(){throw new ge(\"id keyword from Core vocabulary has been renamed to $id.\")}set idProp(e){throw new ge(\"id keyword from Core vocabulary has been renamed to $id.\")}get $id(){return this.get(\"$id\")}set $id(e){this.set(\"$id\",e)}get exclusiveMaximum(){return this.get(\"exclusiveMaximum\")}set exclusiveMaximum(e){this.set(\"exclusiveMaximum\",e)}get exclusiveMinimum(){return this.get(\"exclusiveMinimum\")}set exclusiveMinimum(e){this.set(\"exclusiveMinimum\",e)}get containsProp(){return this.get(\"contains\")}set containsProp(e){this.set(\"contains\",e)}get items(){return this.get(\"items\")}set items(e){this.set(\"items\",e)}get propertyNames(){return this.get(\"propertyNames\")}set propertyNames(e){this.set(\"propertyNames\",e)}get const(){return this.get(\"const\")}set const(e){this.set(\"const\",e)}get not(){return this.get(\"not\")}set not(e){this.set(\"not\",e)}get examples(){return this.get(\"examples\")}set examples(e){this.set(\"examples\",e)}},eo=tO;var rO=class extends Ci{get hrefSchema(){return this.get(\"hrefSchema\")}set hrefSchema(e){this.set(\"hrefSchema\",e)}get targetSchema(){return this.get(\"targetSchema\")}set targetSchema(e){this.set(\"targetSchema\",e)}get schema(){throw new ge(\"schema keyword from Hyper-Schema vocabulary has been renamed to submissionSchema.\")}set schema(e){throw new ge(\"schema keyword from Hyper-Schema vocabulary has been renamed to submissionSchema.\")}get submissionSchema(){return this.get(\"submissionSchema\")}set submissionSchema(e){this.set(\"submissionSchema\",e)}get method(){throw new ge(\"method keyword from Hyper-Schema vocabulary has been removed.\")}set method(e){throw new ge(\"method keyword from Hyper-Schema vocabulary has been removed.\")}get encType(){throw new ge(\"encType keyword from Hyper-Schema vocabulary has been renamed to submissionEncType.\")}set encType(e){throw new ge(\"encType keyword from Hyper-Schema vocabulary has been renamed to submissionEncType.\")}get submissionEncType(){return this.get(\"submissionEncType\")}set submissionEncType(e){this.set(\"submissionEncType\",e)}},to=rO;var Aee={namespace:t=>{let{base:e}=t;return e.register(\"jSONSchemaDraft6\",eo),e.register(\"jSONReference\",Pr),e.register(\"media\",zr),e.register(\"linkDescription\",to),e}},DV=Aee;var iO={JSONSchemaDraft6Element:[\"content\"],JSONReferenceElement:[\"content\"],MediaElement:[\"content\"],LinkDescriptionElement:[\"content\"],...ct};var oO=class extends au{constructor(e){super(e),this.element=new eo}get defaultDialectIdentifier(){return\"http://json-schema.org/draft-06/schema#\"}BooleanElement(e){let r=this.enter(e);return this.element.classes.push(\"boolean-json-schema\"),r}handleSchemaIdentifier(e,r=\"$id\"){return super.handleSchemaIdentifier(e,r)}},du=oO;var sO=class extends cu{BooleanElement(e){return this.element=this.toRefractedElement([\"document\",\"objects\",\"JSONSchema\"],e),ce}},qV=sO;var nO=class extends le{ArrayElement(e){let r=this.enter(e);return this.element.classes.push(\"json-schema-examples\"),r}},VV=nO;var aO=class extends lu{constructor(e){super(e),this.element=new to}},hu=aO;var Ree=Re(X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"],du),jt([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"id\"]),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$id\"],Je.visitors.value),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"contains\"],Je.visitors.JSONSchemaOrJSONReferenceVisitor),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"items\"],qV),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"propertyNames\"],Je.visitors.JSONSchemaOrJSONReferenceVisitor),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"const\"],Je.visitors.value),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"examples\"],VV),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"$visitor\"],hu),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"hrefSchema\"],Je.visitors.JSONSchemaOrJSONReferenceVisitor),jt([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"schema\"]),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"submissionSchema\"],Je.visitors.JSONSchemaOrJSONReferenceVisitor),jt([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"method\"]),jt([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"encType\"]),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"submissionEncType\"],Je.visitors.value))(Je),mt=Ree;var cO={};vr(cO,{isJSONReferenceElement:()=>ea,isJSONSchemaElement:()=>LV,isLinkDescriptionElement:()=>BV,isMediaElement:()=>nu});var LV=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof eo||t(i)&&e(\"JSONSchemaDraft6\",i)&&r(\"object\",i)),BV=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof to||t(i)&&e(\"linkDescription\",i)&&r(\"object\",i));var _ee=()=>{let t=Ye(DV);return{predicates:{...cO,isStringElement:z},namespace:t}},UV=_ee;var Iee=(t,{specPath:e=[\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"],plugins:r=[],specificationObj:i=mt}={})=>{let o=(0,Ne.refract)(t),s=Rt(i),n=Te(e,s),a=new n({specObj:s});return ve(o,a),Xe(a.element,r,{toolboxCreator:UV,visitorOptions:{keyMap:iO,nodeTypeGetter:_t}})},lO=t=>(e,r={})=>Iee(e,{specPath:t,...r});eo.refract=lO([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"]);to.refract=lO([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"$visitor\"]);var uO=class extends eo{constructor(e,r,i){super(e,r,i),this.element=\"JSONSchemaDraft7\"}get $comment(){return this.get(\"$comment\")}set $comment(e){this.set(\"$comment\",e)}get items(){return this.get(\"items\")}set items(e){this.set(\"items\",e)}get if(){return this.get(\"if\")}set if(e){this.set(\"if\",e)}get then(){return this.get(\"then\")}set then(e){this.set(\"then\",e)}get else(){return this.get(\"else\")}set else(e){this.set(\"else\",e)}get not(){return this.get(\"not\")}set not(e){this.set(\"not\",e)}get contentEncoding(){return this.get(\"contentEncoding\")}set contentEncoding(e){this.set(\"contentEncoding\",e)}get contentMediaType(){return this.get(\"contentMediaType\")}set contentMediaType(e){this.set(\"contentMediaType\",e)}get media(){throw new ge('media keyword from Hyper-Schema vocabulary has been moved to validation vocabulary as \"contentMediaType\" / \"contentEncoding\"')}set media(e){throw new ge('media keyword from Hyper-Schema vocabulary has been moved to validation vocabulary as \"contentMediaType\" / \"contentEncoding\"')}get writeOnly(){return this.get(\"writeOnly\")}set writeOnly(e){this.set(\"writeOnly\",e)}},ro=uO;var pO=class extends to{get anchor(){return this.get(\"anchor\")}set anchor(e){this.set(\"anchor\",e)}get anchorPointer(){return this.get(\"anchorPointer\")}set anchorPointer(e){this.set(\"anchorPointer\",e)}get templatePointers(){return this.get(\"templatePointers\")}set templatePointers(e){this.set(\"templatePointers\",e)}get templateRequired(){return this.get(\"templateRequired\")}set templateRequired(e){this.set(\"templateRequired\",e)}get targetSchema(){return this.get(\"targetSchema\")}set targetSchema(e){this.set(\"targetSchema\",e)}get mediaType(){throw new ge(\"mediaType keyword from Hyper-Schema vocabulary has been renamed to targetMediaType.\")}set mediaType(e){throw new ge(\"mediaType keyword from Hyper-Schema vocabulary has been renamed to targetMediaType.\")}get targetMediaType(){return this.get(\"targetMediaType\")}set targetMediaType(e){this.set(\"targetMediaType\",e)}get targetHints(){return this.get(\"targetHints\")}set targetHints(e){this.set(\"targetHints\",e)}get description(){return this.get(\"description\")}set description(e){this.set(\"description\",e)}get $comment(){return this.get(\"$comment\")}set $comment(e){this.set(\"$comment\",e)}get hrefSchema(){return this.get(\"hrefSchema\")}set hrefSchema(e){this.set(\"hrefSchema\",e)}get headerSchema(){return this.get(\"headerSchema\")}set headerSchema(e){this.set(\"headerSchema\",e)}get submissionSchema(){return this.get(\"submissionSchema\")}set submissionSchema(e){this.set(\"submissionSchema\",e)}get submissionEncType(){throw new ge(\"submissionEncType keyword from Hyper-Schema vocabulary has been renamed to submissionMediaType.\")}set submissionEncType(e){throw new ge(\"submissionEncType keyword from Hyper-Schema vocabulary has been renamed to submissionMediaType.\")}get submissionMediaType(){return this.get(\"submissionMediaType\")}set submissionMediaType(e){this.set(\"submissionMediaType\",e)}},io=pO;var Cee={namespace:t=>{let{base:e}=t;return e.register(\"jSONSchemaDraft7\",ro),e.register(\"jSONReference\",Pr),e.register(\"linkDescription\",io),e}},JV=Cee;var fO={JSONSchemaDraft7Element:[\"content\"],JSONReferenceElement:[\"content\"],LinkDescriptionElement:[\"content\"],...ct};var mO=class extends du{constructor(e){super(e),this.element=new ro}get defaultDialectIdentifier(){return\"http://json-schema.org/draft-07/schema#\"}},xu=mO;var dO=class extends hu{constructor(e){super(e),this.element=new io}},yu=dO;var Tee=Re(X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"],xu),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$comment\"],mt.visitors.value),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"if\"],mt.visitors.JSONSchemaOrJSONReferenceVisitor),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"then\"],mt.visitors.JSONSchemaOrJSONReferenceVisitor),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"else\"],mt.visitors.JSONSchemaOrJSONReferenceVisitor),jt([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"media\"]),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"contentEncoding\"],mt.visitors.value),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"contentMediaType\"],mt.visitors.value),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"writeOnly\"],mt.visitors.value),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"$visitor\"],yu),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"anchor\"],mt.visitors.value),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"anchorPointer\"],mt.visitors.value),jt([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"mediaType\"]),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"targetMediaType\"],mt.visitors.value),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"targetHints\"],mt.visitors.value),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"description\"],mt.visitors.value),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"$comment\"],mt.visitors.value),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"headerSchema\"],mt.visitors.JSONSchemaOrJSONReferenceVisitor),jt([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"submissionEncType\"]),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"submissionMediaType\"],mt.visitors.value))(mt),oo=Tee;var hO={};vr(hO,{isJSONReferenceElement:()=>ea,isJSONSchemaElement:()=>Mee,isLinkDescriptionElement:()=>Fee});var Mee=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof ro||t(i)&&e(\"JSONSchemaDraft7\",i)&&r(\"object\",i)),Fee=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof io||t(i)&&e(\"linkDescription\",i)&&r(\"object\",i));var $ee=()=>{let t=Ye(JV);return{predicates:{...hO,isStringElement:z},namespace:t}},HV=$ee;var Nee=(t,{specPath:e=[\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"],plugins:r=[],specificationObj:i=oo}={})=>{let o=(0,Ne.refract)(t),s=Rt(i),n=Te(e,s),a=new n({specObj:s});return ve(o,a),Xe(a.element,r,{toolboxCreator:HV,visitorOptions:{keyMap:fO,nodeTypeGetter:_t}})},xO=t=>(e,r={})=>Nee(e,{specPath:t,...r});ro.refract=xO([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"]);io.refract=xO([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"$visitor\"]);var yO=class extends ro{constructor(e,r,i){super(e,r,i),this.element=\"JSONSchema201909\"}get $vocabulary(){return this.get(\"$vocabulary\")}set $vocabulary(e){this.set(\"$vocabulary\",e)}get $anchor(){return this.get(\"$anchor\")}set $anchor(e){this.set(\"$anchor\",e)}get $recursiveAnchor(){return this.get(\"$recursiveAnchor\")}set $recursiveAnchor(e){this.set(\"$recursiveAnchor\",e)}get $recursiveRef(){return this.get(\"$recursiveRef\")}set $recursiveRef(e){this.set(\"$recursiveRef\",e)}get $ref(){return this.get(\"$ref\")}set $ref(e){this.set(\"$ref\",e)}get $defs(){return this.get(\"$defs\")}set $defs(e){this.set(\"$defs\",e)}get definitions(){throw new ge(\"definitions keyword from Validation vocabulary has been renamed to $defs.\")}set definitions(e){throw new ge(\"definitions keyword from Validation vocabulary has been renamed to $defs.\")}get not(){return this.get(\"not\")}set not(e){this.set(\"not\",e)}get if(){return this.get(\"if\")}set if(e){this.set(\"if\",e)}get then(){return this.get(\"then\")}set then(e){this.set(\"then\",e)}get else(){return this.get(\"else\")}set else(e){this.set(\"else\",e)}get dependentSchemas(){return this.get(\"dependentSchemas\")}set dependentSchemas(e){this.set(\"dependentSchemas\",e)}get dependencies(){throw new ge(\"dependencies keyword from Validation vocabulary has been renamed to dependentSchemas.\")}set dependencies(e){throw new ge(\"dependencies keyword from Validation vocabulary has been renamed to dependentSchemas.\")}get items(){return this.get(\"items\")}set items(e){this.set(\"items\",e)}get containsProp(){return this.get(\"contains\")}set containsProp(e){this.set(\"contains\",e)}get additionalProperties(){return this.get(\"additionalProperties\")}set additionalProperties(e){this.set(\"additionalProperties\",e)}get additionalItems(){return this.get(\"additionalItems\")}set additionalItems(e){this.set(\"additionalItems\",e)}get propertyNames(){return this.get(\"propertyNames\")}set propertyNames(e){this.set(\"propertyNames\",e)}get unevaluatedItems(){return this.get(\"unevaluatedItems\")}set unevaluatedItems(e){this.set(\"unevaluatedItems\",e)}get unevaluatedProperties(){return this.get(\"unevaluatedProperties\")}set unevaluatedProperties(e){this.set(\"unevaluatedProperties\",e)}get maxContains(){return this.get(\"maxContains\")}set maxContains(e){this.set(\"maxContains\",e)}get minContains(){return this.get(\"minContains\")}set minContains(e){this.set(\"minContains\",e)}get dependentRequired(){return this.get(\"dependentRequired\")}set dependentRequired(e){this.set(\"dependentRequired\",e)}get deprecated(){return this.get(\"deprecated\")}set deprecated(e){this.set(\"deprecated\",e)}get contentSchema(){return this.get(\"contentSchema\")}set contentSchema(e){this.set(\"contentSchema\",e)}},so=yO;var gO=class extends io{get targetSchema(){return this.get(\"targetSchema\")}set targetSchema(e){this.set(\"targetSchema\",e)}get hrefSchema(){return this.get(\"hrefSchema\")}set hrefSchema(e){this.set(\"hrefSchema\",e)}get headerSchema(){return this.get(\"headerSchema\")}set headerSchema(e){this.set(\"headerSchema\",e)}get submissionSchema(){return this.get(\"submissionSchema\")}set submissionSchema(e){this.set(\"submissionSchema\",e)}},no=gO;var kee={namespace:t=>{let{base:e}=t;return e.register(\"jSONSchema201909\",so),e.register(\"linkDescription\",no),e}},zV=kee;var vO={JSONSchema201909Element:[\"content\"],LinkDescriptionElement:[\"content\"],...ct};var EO=class extends xu{constructor(e){super(e),this.element=new so}get defaultDialectIdentifier(){return\"https://json-schema.org/draft/2019-09/schema\"}ObjectElement(e){this.handleDialectIdentifier(e),this.handleSchemaIdentifier(e),this.parent=this.element;let r=Ht.prototype.ObjectElement.call(this,e);return z(this.element.$ref)&&(this.element.classes.push(\"reference-element\"),this.element.setMetaProperty(\"referenced-element\",\"schema\")),r}},dt=EO;var bO=class extends le{ObjectElement(e){let r=super.enter(e);return this.element.classes.push(\"json-schema-$vocabulary\"),r}},KV=bO;var SO=class extends le{StringElement(e){let r=super.enter(e);return this.element.classes.push(\"reference-value\"),r}},WV=SO;var OO=class extends P(pt,Ee,le){constructor(e){super(e),this.element=new S.ObjectElement,this.element.classes.push(\"json-schema-$defs\"),this.specPath=J([\"document\",\"objects\",\"JSONSchema\"])}},hn=OO;var wO=class extends P(qe,Ee,le){constructor(e){super(e),this.element=new S.ArrayElement,this.element.classes.push(\"json-schema-allOf\")}ArrayElement(e){return e.forEach(r=>{let i=this.toRefractedElement([\"document\",\"objects\",\"JSONSchema\"],r);this.element.push(i)}),this.copyMetaAndAttributes(e,this.element),ce}},xn=wO;var jO=class extends P(qe,Ee,le){constructor(e){super(e),this.element=new S.ArrayElement,this.element.classes.push(\"json-schema-anyOf\")}ArrayElement(e){return e.forEach(r=>{let i=this.toRefractedElement([\"document\",\"objects\",\"JSONSchema\"],r);this.element.push(i)}),this.copyMetaAndAttributes(e,this.element),ce}},yn=jO;var PO=class extends P(qe,Ee,le){constructor(e){super(e),this.element=new S.ArrayElement,this.element.classes.push(\"json-schema-oneOf\")}ArrayElement(e){return e.forEach(r=>{let i=this.toRefractedElement([\"document\",\"objects\",\"JSONSchema\"],r);this.element.push(i)}),this.copyMetaAndAttributes(e,this.element),ce}},gn=PO;var AO=class extends P(pt,Ee,le){constructor(e){super(e),this.element=new S.ObjectElement,this.element.classes.push(\"json-schema-dependentSchemas\"),this.specPath=J([\"document\",\"objects\",\"JSONSchema\"])}},vn=AO;var RO=class extends P(qe,Ee,le){ObjectElement(e){return this.element=this.toRefractedElement([\"document\",\"objects\",\"JSONSchema\"],e),ce}ArrayElement(e){return this.element=new S.ArrayElement,this.element.classes.push(\"json-schema-items\"),e.forEach(r=>{let i=this.toRefractedElement([\"document\",\"objects\",\"JSONSchema\"],r);this.element.push(i)}),this.copyMetaAndAttributes(e,this.element),ce}BooleanElement(e){return this.element=this.toRefractedElement([\"document\",\"objects\",\"JSONSchema\"],e),ce}},GV=RO;var _O=class extends P(pt,Ee,le){constructor(e){super(e),this.element=new S.ObjectElement,this.element.classes.push(\"json-schema-properties\"),this.specPath=J([\"document\",\"objects\",\"JSONSchema\"])}},En=_O;var IO=class extends P(pt,Ee,le){constructor(e){super(e),this.element=new S.ObjectElement,this.element.classes.push(\"json-schema-patternProperties\"),this.specPath=J([\"document\",\"objects\",\"JSONSchema\"])}},bn=IO;var CO=class extends le{ObjectElement(e){let r=super.enter(e);return this.element.classes.push(\"json-schema-dependentRequired\"),r}},YV=CO;var TO=class extends yu{constructor(e){super(e),this.element=new no}},gu=TO;var Dee=Re(X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"],dt),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$vocabulary\"],KV),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$anchor\"],oo.visitors.value),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$recursiveAnchor\"],oo.visitors.value),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$recursiveRef\"],oo.visitors.value),jt([\"visitors\",\"document\",\"objects\",\"JSONReference\",\"$visitor\"]),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$ref\"],WV),jt([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"definitions\"]),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$defs\"],hn),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"allOf\"],xn),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"anyOf\"],yn),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"oneOf\"],gn),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"not\"],dt),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"if\"],dt),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"then\"],dt),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"else\"],dt),jt([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"dependencies\"]),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"dependentSchemas\"],vn),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"items\"],GV),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"contains\"],dt),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"properties\"],En),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"patternProperties\"],bn),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"additionalProperties\"],dt),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"additionalItems\"],dt),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"propertyNames\"],dt),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"unevaluatedItems\"],dt),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"unevaluatedProperties\"],dt),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"maxContains\"],oo.visitors.value),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"minContains\"],oo.visitors.value),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"dependentRequired\"],YV),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"deprecated\"],oo.visitors.value),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"contentSchema\"],dt),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"$visitor\"],gu),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"targetSchema\"],dt),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"hrefSchema\"],dt),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"headerSchema\"],dt),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"submissionSchema\"],dt))(oo),sa=Dee;var MO={};vr(MO,{isJSONSchemaElement:()=>qee,isLinkDescriptionElement:()=>Vee});var qee=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof so||t(i)&&e(\"JSONSchema201909\",i)&&r(\"object\",i)),Vee=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof no||t(i)&&e(\"linkDescription\",i)&&r(\"object\",i));var Lee=()=>{let t=Ye(zV);return{predicates:{...MO,isStringElement:z},namespace:t}},XV=Lee;var Bee=(t,{specPath:e=[\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"],plugins:r=[],specificationObj:i=sa}={})=>{let o=(0,Ne.refract)(t),s=Rt(i),n=Te(e,s),a=new n({specObj:s});return ve(o,a),Xe(a.element,r,{toolboxCreator:XV,visitorOptions:{keyMap:vO,nodeTypeGetter:_t}})},FO=t=>(e,r={})=>Bee(e,{specPath:t,...r});so.refract=FO([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"]);no.refract=FO([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"$visitor\"]);var $O=class extends so{constructor(e,r,i){super(e,r,i),this.element=\"JSONSchema202012\"}get $dynamicAnchor(){return this.get(\"$dynamicAnchor\")}set $dynamicAnchor(e){this.set(\"$dynamicAnchor\",e)}get $recursiveAnchor(){throw new ge(\"$recursiveAnchor keyword from Core vocabulary has been renamed to $dynamicAnchor.\")}set $recursiveAnchor(e){throw new ge(\"$recursiveAnchor keyword from Core vocabulary has been renamed to $dynamicAnchor.\")}get $dynamicRef(){return this.get(\"$dynamicRef\")}set $dynamicRef(e){this.set(\"$dynamicRef\",e)}get $recursiveRef(){throw new ge(\"$recursiveRef keyword from Core vocabulary has been renamed to $dynamicRef.\")}set $recursiveRef(e){throw new ge(\"$recursiveRef keyword from Core vocabulary has been renamed to $dynamicRef.\")}get prefixItems(){return this.get(\"prefixItems\")}set prefixItems(e){this.set(\"prefixItems\",e)}},ao=$O;var NO=class extends no{get targetSchema(){return this.get(\"targetSchema\")}set targetSchema(e){this.set(\"targetSchema\",e)}get hrefSchema(){return this.get(\"hrefSchema\")}set hrefSchema(e){this.set(\"hrefSchema\",e)}get headerSchema(){return this.get(\"headerSchema\")}set headerSchema(e){this.set(\"headerSchema\",e)}get submissionSchema(){return this.get(\"submissionSchema\")}set submissionSchema(e){this.set(\"submissionSchema\",e)}},ms=NO;var Uee={namespace:t=>{let{base:e}=t;return e.register(\"jSONSchema202012\",ao),e.register(\"linkDescription\",ms),e}},QV=Uee;var ZV={JSONSchema202012Element:[\"content\"],LinkDescriptionElement:[\"content\"],...ct};var kO=class extends dt{constructor(e){super(e),this.element=new ao}get defaultDialectIdentifier(){return\"https://json-schema.org/draft/2020-12/schema\"}},We=kO;var DO=class extends P(qe,Ee,le){constructor(e){super(e),this.element=new S.ArrayElement,this.element.classes.push(\"json-schema-prefixItems\")}ArrayElement(e){return e.forEach(r=>{let i=this.toRefractedElement([\"document\",\"objects\",\"JSONSchema\"],r);this.element.push(i)}),this.copyMetaAndAttributes(e,this.element),ce}},na=DO;var qO=class extends gu{constructor(e){super(e),this.element=new ms}},eL=qO;var Jee=Re(X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"],We),jt([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$recursiveAnchor\"]),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$dynamicAnchor\"],sa.visitors.value),jt([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$recursiveRef\"]),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"$dynamicRef\"],sa.visitors.value),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"not\"],We),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"if\"],We),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"then\"],We),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"else\"],We),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"prefixItems\"],na),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"items\"],We),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"contains\"],We),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"additionalProperties\"],We),jt([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"additionalItems\"]),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"propertyNames\"],We),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"unevaluatedItems\"],We),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"unevaluatedProperties\"],We),X([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"fixedFields\",\"contentSchema\"],We),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"$visitor\"],eL),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"targetSchema\"],We),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"hrefSchema\"],We),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"headerSchema\"],We),X([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"fixedFields\",\"submissionSchema\"],We))(sa),aa=Jee;var VO={};vr(VO,{isJSONSchemaElement:()=>Hee,isLinkDescriptionElement:()=>zee});var Hee=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof ao||t(i)&&e(\"JSONSchema202012\",i)&&r(\"object\",i)),zee=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof ms||t(i)&&e(\"linkDescription\",i)&&r(\"object\",i));var Kee=()=>{let t=Ye(QV);return{predicates:{...VO,isStringElement:z},namespace:t}},tL=Kee;var Wee=(t,{specPath:e=[\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"],plugins:r=[],specificationObj:i=aa}={})=>{let o=(0,Ne.refract)(t),s=Rt(i),n=Te(e,s),a=new n({specObj:s});return ve(o,a),Xe(a.element,r,{toolboxCreator:tL,visitorOptions:{keyMap:ZV,nodeTypeGetter:_t}})},LO=t=>(e,r={})=>Wee(e,{specPath:t,...r});ao.refract=LO([\"visitors\",\"document\",\"objects\",\"JSONSchema\",\"$visitor\"]);ms.refract=LO([\"visitors\",\"document\",\"objects\",\"LinkDescription\",\"$visitor\"]);var BO=class extends ao{constructor(e,r,i){super(e,r,i),this.element=\"schema\"}get discriminator(){return this.get(\"discriminator\")}set discriminator(e){this.set(\"discriminator\",e)}get xml(){return this.get(\"xml\")}set xml(e){this.set(\"xml\",e)}get externalDocs(){return this.get(\"externalDocs\")}set externalDocs(e){this.set(\"externalDocs\",e)}get example(){return this.get(\"example\")}set example(e){this.set(\"example\",e)}},It=BO;var UO=class extends Ti{},co=UO;var JO=class extends Mi{},lo=JO;var HO=class extends Fi{},uo=HO;var zO=class extends $i{},po=zO;var KO=class extends is{},ds=KO;var WO=class extends os{},hs=WO;var Gee={namespace:t=>{let{base:e}=t;return e.register(\"callback\",Di),e.register(\"components\",qi),e.register(\"contact\",Vi),e.register(\"discriminator\",cs),e.register(\"encoding\",ls),e.register(\"example\",Li),e.register(\"externalDocumentation\",Bi),e.register(\"header\",Ui),e.register(\"info\",Ji),e.register(\"jsonSchemaDialect\",Hi),e.register(\"license\",zi),e.register(\"link\",Ki),e.register(\"mediaType\",Wi),e.register(\"oAuthFlow\",us),e.register(\"oAuthFlows\",ps),e.register(\"openapi\",fs),e.register(\"openApi3_1\",zt),e.register(\"operation\",Fr),e.register(\"parameter\",Gi),e.register(\"pathItem\",Kt),e.register(\"paths\",Yi),e.register(\"reference\",dr),e.register(\"requestBody\",Xi),e.register(\"response\",Qi),e.register(\"responses\",Zi),e.register(\"schema\",It),e.register(\"securityRequirement\",co),e.register(\"securityScheme\",lo),e.register(\"server\",uo),e.register(\"serverVariable\",po),e.register(\"tag\",ds),e.register(\"xml\",hs),e}},ca=Gee;var GO=class t extends S.ObjectElement{static primaryClass=\"components-path-items\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},vu=GO;var YO=class t extends S.ObjectElement{static primaryClass=\"webhooks\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},Eu=YO;var ht=t=>{if(Se(t))return`${t.element.charAt(0).toUpperCase()+t.element.slice(1)}Element`},Ct={CallbackElement:[\"content\"],ComponentsElement:[\"content\"],ContactElement:[\"content\"],DiscriminatorElement:[\"content\"],Encoding:[\"content\"],Example:[\"content\"],ExternalDocumentationElement:[\"content\"],HeaderElement:[\"content\"],InfoElement:[\"content\"],LicenseElement:[\"content\"],MediaTypeElement:[\"content\"],OAuthFlowElement:[\"content\"],OAuthFlowsElement:[\"content\"],OpenApi3_1Element:[\"content\"],OperationElement:[\"content\"],ParameterElement:[\"content\"],PathItemElement:[\"content\"],PathsElement:[\"content\"],ReferenceElement:[\"content\"],RequestBodyElement:[\"content\"],ResponseElement:[\"content\"],ResponsesElement:[\"content\"],SchemaElement:[\"content\"],SecurityRequirementElement:[\"content\"],SecuritySchemeElement:[\"content\"],ServerElement:[\"content\"],ServerVariableElement:[\"content\"],TagElement:[\"content\"],...ct};var XO=class{internalStore;constructor(e,r,i){this.storageElement=e,this.storageField=r,this.storageSubField=i}get store(){if(!this.internalStore){let e=this.storageElement.get(this.storageField);ne(e)||(e=new S.ObjectElement,this.storageElement.set(this.storageField,e));let r=e.get(this.storageSubField);Pe(r)||(r=new S.ArrayElement,e.set(this.storageSubField,r)),this.internalStore=r}return this.internalStore}append(e){this.includes(e)||this.store.push(e)}includes(e){return this.store.includes(e)}},To=XO;var Yee=({storageField:t=\"x-normalized\"}={})=>e=>{let{predicates:r,ancestorLineageToJSONPointer:i}=e,o=(a,p)=>!r.isParameterElement(a)||!r.isParameterElement(p)||!r.isStringElement(a.name)||!r.isStringElement(a.in)||!r.isStringElement(p.name)||!r.isStringElement(p.in)?!1:b(a.name)===b(p.name)&&b(a.in)===b(p.in),s=[],n;return{visitor:{OpenApi3_1Element:{enter(a){n=new To(a,t,\"parameters\")},leave(){n=void 0}},PathItemElement:{enter(a,p,l,u,f){if(f.some(r.isComponentsElement))return;let{parameters:m}=a;r.isArrayElement(m)?s.push([...m.content]):s.push([])},leave(){s.pop()}},OperationElement:{leave(a,p,l,u,f){let m=ar(s);if(!Array.isArray(m)||m.length===0)return;let x=i([...f,l,a]);if(n.includes(x))return;let h=Un([],[\"parameters\",\"content\"],a),O=Jo(o,[...h,...m]);a.parameters=new ns(O),n.append(x)}}}}},QO=Yee;var Xee=({storageField:t=\"x-normalized\"}={})=>e=>{let{predicates:r,ancestorLineageToJSONPointer:i}=e,o,s;return{visitor:{OpenApi3_1Element:{enter(n){s=new To(n,t,\"security-requirements\"),r.isArrayElement(n.security)&&(o=n.security)},leave(){s=void 0,o=void 0}},OperationElement:{leave(n,a,p,l,u){if(u.some(r.isComponentsElement))return;let f=i([...u,p,n]);if(s.includes(f))return;if(typeof n.security>\"u\"&&typeof o<\"u\"){var h;n.security=new as((h=o)===null||h===void 0?void 0:h.content),s.append(f)}}}}}},ZO=Xee;var ew=t=>t.replace(/\\s/g,\"\"),tw=t=>t.replace(/\\W/gi,\"_\"),Qee=(t,e)=>{let r=tw(ew(e.toLowerCase())),i=tw(ew(t));return`${r}${i}`},Zee=(t,e,r)=>{let i=ew(t);return i.length>0?tw(i):Qee(e,r)},ete=({storageField:t=\"x-normalized\",operationIdNormalizer:e=Zee}={})=>r=>{let{predicates:i,ancestorLineageToJSONPointer:o,namespace:s}=r,n=[],a=[],p=[],l;return{visitor:{OpenApi3_1Element:{enter(u){l=new To(u,t,\"operation-ids\")},leave(){let u=bl(f=>b(f.operationId),a);Object.entries(u).forEach(([f,m])=>{Array.isArray(m)&&(m.length<=1||m.forEach((x,h)=>{let O=`${f}${h+1}`;x.operationId=new s.elements.String(O)}))}),p.forEach(f=>{if(typeof f.operationId>\"u\")return;let m=String(b(f.operationId)),x=a.find(h=>b(h.meta.get(\"originalOperationId\"))===m);typeof x>\"u\"||(f.operationId=$.safe(x.operationId),f.meta.set(\"originalOperationId\",m),f.set(\"__originalOperationId\",m))}),a.length=0,p.length=0,l=void 0}},PathItemElement:{enter(u){let f=nr(\"path\",b(u.meta.get(\"path\")));n.push(f)},leave(){n.pop()}},OperationElement:{enter(u,f,m,x,h){if(typeof u.operationId>\"u\")return;let O=o([...h,m,u]);if(l.includes(O))return;let j=String(b(u.operationId)),v=ar(n),E=nr(\"method\",b(u.meta.get(\"http-method\"))),y=e(j,v,E);j!==y&&(u.operationId=new s.elements.String(y),u.set(\"__originalOperationId\",j),u.meta.set(\"originalOperationId\",j),a.push(u),l.append(O))}},LinkElement:{leave(u){i.isLinkElement(u)&&(typeof u.operationId>\"u\"||p.push(u))}}}}},rw=ete;var tte=({storageField:t=\"x-normalized\"}={})=>e=>{let{predicates:r,ancestorLineageToJSONPointer:i}=e,o;return{visitor:{OpenApi3_1Element:{enter(s){o=new To(s,t,\"parameter-examples\")},leave(){o=void 0}},ParameterElement:{leave(s,n,a,p,l){var u,f;if(l.some(r.isComponentsElement)||typeof s.schema>\"u\"||!r.isSchemaElement(s.schema)||typeof((u=s.schema)===null||u===void 0?void 0:u.example)>\"u\"&&typeof((f=s.schema)===null||f===void 0?void 0:f.examples)>\"u\")return;let m=i([...l,a,s]);if(!o.includes(m)){if(typeof s.examples<\"u\"&&r.isObjectElement(s.examples)){let x=s.examples.map(h=>$.safe(h.value));typeof s.schema.examples<\"u\"&&(s.schema.set(\"examples\",x),o.append(m)),typeof s.schema.example<\"u\"&&(s.schema.set(\"example\",x[0]),o.append(m));return}typeof s.example<\"u\"&&(typeof s.schema.examples<\"u\"&&(s.schema.set(\"examples\",[$(s.example)]),o.append(m)),typeof s.schema.example<\"u\"&&(s.schema.set(\"example\",$(s.example)),o.append(m)))}}}}}},iw=tte;var rte=({storageField:t=\"x-normalized\"}={})=>e=>{let{predicates:r,ancestorLineageToJSONPointer:i}=e,o;return{visitor:{OpenApi3_1Element:{enter(s){o=new To(s,t,\"header-examples\")},leave(){o=void 0}},HeaderElement:{leave(s,n,a,p,l){var u,f;if(l.some(r.isComponentsElement)||typeof s.schema>\"u\"||!r.isSchemaElement(s.schema)||typeof((u=s.schema)===null||u===void 0?void 0:u.example)>\"u\"&&typeof((f=s.schema)===null||f===void 0?void 0:f.examples)>\"u\")return;let m=i([...l,a,s]);if(!o.includes(m)){if(typeof s.examples<\"u\"&&r.isObjectElement(s.examples)){let x=s.examples.map(h=>$.safe(h.value));typeof s.schema.examples<\"u\"&&(s.schema.set(\"examples\",x),o.append(m)),typeof s.schema.example<\"u\"&&(s.schema.set(\"example\",x[0]),o.append(m));return}typeof s.example<\"u\"&&(typeof s.schema.examples<\"u\"&&(s.schema.set(\"examples\",[$(s.example)]),o.append(m)),typeof s.schema.example<\"u\"&&(s.schema.set(\"example\",$(s.example)),o.append(m)))}}}}}},ow=rte;var sw={};vr(sw,{isBooleanJsonSchemaElement:()=>gc,isCallbackElement:()=>rL,isComponentsElement:()=>iL,isContactElement:()=>oL,isExampleElement:()=>sL,isExternalDocumentationElement:()=>nL,isHeaderElement:()=>ite,isInfoElement:()=>aL,isJsonSchemaDialectElement:()=>Om,isLicenseElement:()=>cL,isLinkElement:()=>lL,isMediaTypeElement:()=>SL,isOpenApi3_1Element:()=>wm,isOpenapiElement:()=>uL,isOperationElement:()=>jm,isParameterElement:()=>pL,isPathItemElement:()=>fo,isPathItemElementExternal:()=>fL,isPathsElement:()=>mL,isReferenceElement:()=>$r,isReferenceElementExternal:()=>dL,isRequestBodyElement:()=>hL,isResponseElement:()=>xL,isResponsesElement:()=>yL,isSchemaElement:()=>Tt,isSecurityRequirementElement:()=>gL,isSecuritySchemeElement:()=>vL,isServerElement:()=>EL,isServerVariableElement:()=>bL});var rL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Di||t(i)&&e(\"callback\",i)&&r(\"object\",i)),iL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof qi||t(i)&&e(\"components\",i)&&r(\"object\",i)),oL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Vi||t(i)&&e(\"contact\",i)&&r(\"object\",i)),sL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Li||t(i)&&e(\"example\",i)&&r(\"object\",i)),nL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Bi||t(i)&&e(\"externalDocumentation\",i)&&r(\"object\",i)),ite=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ui||t(i)&&e(\"header\",i)&&r(\"object\",i)),aL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ji||t(i)&&e(\"info\",i)&&r(\"object\",i)),Om=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Hi||t(i)&&e(\"jsonSchemaDialect\",i)&&r(\"string\",i)),cL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof zi||t(i)&&e(\"license\",i)&&r(\"object\",i)),lL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ki||t(i)&&e(\"link\",i)&&r(\"object\",i)),uL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof fs||t(i)&&e(\"openapi\",i)&&r(\"string\",i)),wm=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r,hasClass:i})=>o=>o instanceof zt||t(o)&&e(\"openApi3_1\",o)&&r(\"object\",o)&&i(\"api\",o)),jm=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Fr||t(i)&&e(\"operation\",i)&&r(\"object\",i)),pL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Gi||t(i)&&e(\"parameter\",i)&&r(\"object\",i)),fo=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Kt||t(i)&&e(\"pathItem\",i)&&r(\"object\",i)),fL=t=>{if(!fo(t)||!z(t.$ref))return!1;let e=b(t.$ref);return typeof e==\"string\"&&e.length>0&&!e.startsWith(\"#\")},mL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Yi||t(i)&&e(\"paths\",i)&&r(\"object\",i)),$r=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof dr||t(i)&&e(\"reference\",i)&&r(\"object\",i)),dL=t=>{if(!$r(t)||!z(t.$ref))return!1;let e=b(t.$ref);return typeof e==\"string\"&&e.length>0&&!e.startsWith(\"#\")},hL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Xi||t(i)&&e(\"requestBody\",i)&&r(\"object\",i)),xL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Qi||t(i)&&e(\"response\",i)&&r(\"object\",i)),yL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Zi||t(i)&&e(\"responses\",i)&&r(\"object\",i)),Tt=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof It||t(i)&&e(\"schema\",i)&&r(\"object\",i)),gc=t=>Br(t)&&t.classes.includes(\"boolean-json-schema\"),gL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof co||t(i)&&e(\"securityRequirement\",i)&&r(\"object\",i)),vL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof lo||t(i)&&e(\"securityScheme\",i)&&r(\"object\",i)),EL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof uo||t(i)&&e(\"server\",i)&&r(\"object\",i)),bL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof po||t(i)&&e(\"serverVariable\",i)&&r(\"object\",i)),SL=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Wi||t(i)&&e(\"mediaType\",i)&&r(\"object\",i));var ote=t=>{let e=t.reduce((r,i,o)=>{if(Ue(i)){let s=String(b(i.key));r.push(s)}else if(Pe(t[o-2])){let s=String(t[o-2].content.indexOf(i));r.push(s)}return r},[]);return Co(e)},ste=()=>{let t=Ye(ca);return{predicates:{...sw,isElement:Se,isStringElement:z,isArrayElement:Pe,isObjectElement:ne,isMemberElement:Ue,isServersElement:mn,includesClasses:At,hasElementSourceMap:Or},ancestorLineageToJSONPointer:ote,namespace:t}},bu=ste;var nw=class extends P(se,A){constructor(e){super(e),this.element=new zt,this.specPath=J([\"document\",\"objects\",\"OpenApi\"]),this.canSupportSpecificationExtensions=!0,this.openApiSemanticElement=this.element}ObjectElement(e){return this.openApiGenericElement=e,se.prototype.ObjectElement.call(this,e)}},OL=nw;var nte=_.visitors.document.objects.Info.$visitor,aw=class extends nte{constructor(e){super(e),this.element=new Ji}},wL=aw;var ate=_.visitors.document.objects.Contact.$visitor,cw=class extends ate{constructor(e){super(e),this.element=new Vi}},jL=cw;var cte=_.visitors.document.objects.License.$visitor,lw=class extends cte{constructor(e){super(e),this.element=new zi}},PL=lw;var lte=_.visitors.document.objects.Link.$visitor,uw=class extends lte{constructor(e){super(e),this.element=new Ki}},AL=uw;var pw=class extends P(ze,A){StringElement(e){let r=new Hi(b(e));return this.copyMetaAndAttributes(e,r),this.element=r,ce}},RL=pw;var ute=_.visitors.document.objects.Server.$visitor,fw=class extends ute{constructor(e){super(e),this.element=new uo}},_L=fw;var pte=_.visitors.document.objects.ServerVariable.$visitor,mw=class extends pte{constructor(e){super(e),this.element=new po}},IL=mw;var fte=_.visitors.document.objects.MediaType.$visitor,dw=class extends fte{constructor(e){super(e),this.element=new Wi}},CL=dw;var mte=_.visitors.document.objects.SecurityRequirement.$visitor,hw=class extends mte{constructor(e){super(e),this.element=new co}},TL=hw;var dte=_.visitors.document.objects.Components.$visitor,xw=class extends dte{constructor(e){super(e),this.element=new qi}},ML=xw;var hte=_.visitors.document.objects.Tag.$visitor,yw=class extends hte{constructor(e){super(e),this.element=new ds}},FL=yw;var xte=_.visitors.document.objects.Reference.$visitor,gw=class extends xte{constructor(e){super(e),this.element=new dr}},$L=gw;var yte=_.visitors.document.objects.Parameter.$visitor,vw=class extends yte{constructor(e){super(e),this.element=new Gi}},NL=vw;var gte=_.visitors.document.objects.Header.$visitor,Ew=class extends gte{constructor(e){super(e),this.element=new Ui}},kL=Ew;var bw=class extends P(se,Ee,A){constructor(e){super(e),this.element=new It,this.specPath=J([\"document\",\"objects\",\"Schema\"]),this.canSupportSpecificationExtensions=!0,this.jsonSchemaDefaultDialect=Hi.default,this.passingOptionsNames.push(\"parent\")}ObjectElement(e){this.handleDialectIdentifier(e),this.handleSchemaIdentifier(e),this.parent=this.element;let r=se.prototype.ObjectElement.call(this,e);return z(this.element.$ref)&&(this.element.classes.push(\"reference-element\"),this.element.setMetaProperty(\"referenced-element\",\"schema\")),r}BooleanElement(e){return We.prototype.BooleanElement.call(this,e)}get defaultDialectIdentifier(){let e;return this.openApiSemanticElement!==void 0&&Om(this.openApiSemanticElement.jsonSchemaDialect)?e=b(this.openApiSemanticElement.jsonSchemaDialect):this.openApiGenericElement!==void 0&&z(this.openApiGenericElement.get(\"jsonSchemaDialect\"))?e=b(this.openApiGenericElement.get(\"jsonSchemaDialect\")):e=b(this.jsonSchemaDefaultDialect),e}handleDialectIdentifier(e){return We.prototype.handleDialectIdentifier.call(this,e)}handleSchemaIdentifier(e){return We.prototype.handleSchemaIdentifier.call(this,e)}},DL=bw;var Sw=class extends hn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},qL=Sw;var Ow=class extends xn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},VL=Ow;var ww=class extends yn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},LL=ww;var jw=class extends gn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},BL=jw;var Pw=class extends vn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},UL=Pw;var Aw=class extends na{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},JL=Aw;var Rw=class extends En{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},HL=Rw;var _w=class extends bn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},zL=_w;var vte=_.visitors.document.objects.Discriminator.$visitor,Iw=class extends vte{constructor(e){super(e),this.element=new cs,this.canSupportSpecificationExtensions=!0}},KL=Iw;var Ete=_.visitors.document.objects.XML.$visitor,Cw=class extends Ete{constructor(e){super(e),this.element=new hs}},WL=Cw;var Tw=class extends P(Q,A){constructor(e){super(e),this.element=new ss,this.specPath=J([\"document\",\"objects\",\"Schema\"])}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(Tt).forEach((i,o)=>{i.setMetaProperty(\"schemaName\",b(o))}),r}},GL=Tw;var Mw=class extends P(Q,A){constructor(e){super(e),this.element=new vu,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"PathItem\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter($r).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"pathItem\")}),r}},YL=Mw;var bte=_.visitors.document.objects.Example.$visitor,Fw=class extends bte{constructor(e){super(e),this.element=new Li}},XL=Fw;var Ste=_.visitors.document.objects.ExternalDocumentation.$visitor,$w=class extends Ste{constructor(e){super(e),this.element=new Bi}},QL=$w;var Ote=_.visitors.document.objects.Encoding.$visitor,Nw=class extends Ote{constructor(e){super(e),this.element=new ls}},ZL=Nw;var wte=_.visitors.document.objects.Paths.$visitor,kw=class extends wte{constructor(e){super(e),this.element=new Yi}},e2=kw;var jte=_.visitors.document.objects.RequestBody.$visitor,Dw=class extends jte{constructor(e){super(e),this.element=new Xi}},t2=Dw;var r2=_.visitors.document.objects.Callback.$visitor,qw=class extends r2{constructor(e){super(e),this.element=new Di,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"PathItem\"]}ObjectElement(e){let r=r2.prototype.ObjectElement.call(this,e);return this.element.filter($r).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"pathItem\")}),r}},i2=qw;var Pte=_.visitors.document.objects.Response.$visitor,Vw=class extends Pte{constructor(e){super(e),this.element=new Qi}},o2=Vw;var Ate=_.visitors.document.objects.Responses.$visitor,Lw=class extends Ate{constructor(e){super(e),this.element=new Zi}},s2=Lw;var Rte=_.visitors.document.objects.Operation.$visitor,Bw=class extends Rte{constructor(e){super(e),this.element=new Fr}},n2=Bw;var _te=_.visitors.document.objects.PathItem.$visitor,Uw=class extends _te{constructor(e){super(e),this.element=new Kt}},a2=Uw;var Ite=_.visitors.document.objects.SecurityScheme.$visitor,Jw=class extends Ite{constructor(e){super(e),this.element=new lo}},c2=Jw;var Cte=_.visitors.document.objects.OAuthFlows.$visitor,Hw=class extends Cte{constructor(e){super(e),this.element=new ps}},l2=Hw;var Tte=_.visitors.document.objects.OAuthFlow.$visitor,zw=class extends Tte{constructor(e){super(e),this.element=new us}},u2=zw;var Kw=class extends P(Q,A){constructor(e){super(e),this.element=new Eu,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"PathItem\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter($r).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"pathItem\")}),this.element.filter(fo).forEach((i,o)=>{i.setMetaProperty(\"webhook-name\",b(o))}),r}},p2=Kw;var{JSONSchema:Mte,LinkDescription:Fte}=aa.visitors.document.objects,$te={visitors:{value:_.visitors.value,document:{objects:{OpenApi:{$visitor:OL,fixedFields:{openapi:_.visitors.document.objects.OpenApi.fixedFields.openapi,info:{$ref:\"#/visitors/document/objects/Info\"},jsonSchemaDialect:RL,servers:_.visitors.document.objects.OpenApi.fixedFields.servers,paths:{$ref:\"#/visitors/document/objects/Paths\"},webhooks:p2,components:{$ref:\"#/visitors/document/objects/Components\"},security:_.visitors.document.objects.OpenApi.fixedFields.security,tags:_.visitors.document.objects.OpenApi.fixedFields.tags,externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"}}},Info:{$visitor:wL,fixedFields:{title:_.visitors.document.objects.Info.fixedFields.title,description:_.visitors.document.objects.Info.fixedFields.description,summary:{$ref:\"#/visitors/value\"},termsOfService:_.visitors.document.objects.Info.fixedFields.termsOfService,contact:{$ref:\"#/visitors/document/objects/Contact\"},license:{$ref:\"#/visitors/document/objects/License\"},version:_.visitors.document.objects.Info.fixedFields.version}},Contact:{$visitor:jL,fixedFields:{name:_.visitors.document.objects.Contact.fixedFields.name,url:_.visitors.document.objects.Contact.fixedFields.url,email:_.visitors.document.objects.Contact.fixedFields.email}},License:{$visitor:PL,fixedFields:{name:_.visitors.document.objects.License.fixedFields.name,identifier:{$ref:\"#/visitors/value\"},url:_.visitors.document.objects.License.fixedFields.url}},Server:{$visitor:_L,fixedFields:{url:_.visitors.document.objects.Server.fixedFields.url,description:_.visitors.document.objects.Server.fixedFields.description,variables:_.visitors.document.objects.Server.fixedFields.variables}},ServerVariable:{$visitor:IL,fixedFields:{enum:_.visitors.document.objects.ServerVariable.fixedFields.enum,default:_.visitors.document.objects.ServerVariable.fixedFields.default,description:_.visitors.document.objects.ServerVariable.fixedFields.description}},Components:{$visitor:ML,fixedFields:{schemas:GL,responses:_.visitors.document.objects.Components.fixedFields.responses,parameters:_.visitors.document.objects.Components.fixedFields.parameters,examples:_.visitors.document.objects.Components.fixedFields.examples,requestBodies:_.visitors.document.objects.Components.fixedFields.requestBodies,headers:_.visitors.document.objects.Components.fixedFields.headers,securitySchemes:_.visitors.document.objects.Components.fixedFields.securitySchemes,links:_.visitors.document.objects.Components.fixedFields.links,callbacks:_.visitors.document.objects.Components.fixedFields.callbacks,pathItems:YL}},Paths:{$visitor:e2},PathItem:{$visitor:a2,fixedFields:{$ref:_.visitors.document.objects.PathItem.fixedFields.$ref,summary:_.visitors.document.objects.PathItem.fixedFields.summary,description:_.visitors.document.objects.PathItem.fixedFields.description,get:{$ref:\"#/visitors/document/objects/Operation\"},put:{$ref:\"#/visitors/document/objects/Operation\"},post:{$ref:\"#/visitors/document/objects/Operation\"},delete:{$ref:\"#/visitors/document/objects/Operation\"},options:{$ref:\"#/visitors/document/objects/Operation\"},head:{$ref:\"#/visitors/document/objects/Operation\"},patch:{$ref:\"#/visitors/document/objects/Operation\"},trace:{$ref:\"#/visitors/document/objects/Operation\"},servers:_.visitors.document.objects.PathItem.fixedFields.servers,parameters:_.visitors.document.objects.PathItem.fixedFields.parameters}},Operation:{$visitor:n2,fixedFields:{tags:_.visitors.document.objects.Operation.fixedFields.tags,summary:_.visitors.document.objects.Operation.fixedFields.summary,description:_.visitors.document.objects.Operation.fixedFields.description,externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"},operationId:_.visitors.document.objects.Operation.fixedFields.operationId,parameters:_.visitors.document.objects.Operation.fixedFields.parameters,requestBody:_.visitors.document.objects.Operation.fixedFields.requestBody,responses:{$ref:\"#/visitors/document/objects/Responses\"},callbacks:_.visitors.document.objects.Operation.fixedFields.callbacks,deprecated:_.visitors.document.objects.Operation.fixedFields.deprecated,security:_.visitors.document.objects.Operation.fixedFields.security,servers:_.visitors.document.objects.Operation.fixedFields.servers}},ExternalDocumentation:{$visitor:QL,fixedFields:{description:_.visitors.document.objects.ExternalDocumentation.fixedFields.description,url:_.visitors.document.objects.ExternalDocumentation.fixedFields.url}},Parameter:{$visitor:NL,fixedFields:{name:_.visitors.document.objects.Parameter.fixedFields.name,in:_.visitors.document.objects.Parameter.fixedFields.in,description:_.visitors.document.objects.Parameter.fixedFields.description,required:_.visitors.document.objects.Parameter.fixedFields.required,deprecated:_.visitors.document.objects.Parameter.fixedFields.deprecated,allowEmptyValue:_.visitors.document.objects.Parameter.fixedFields.allowEmptyValue,style:_.visitors.document.objects.Parameter.fixedFields.style,explode:_.visitors.document.objects.Parameter.fixedFields.explode,allowReserved:_.visitors.document.objects.Parameter.fixedFields.allowReserved,schema:{$ref:\"#/visitors/document/objects/Schema\"},example:_.visitors.document.objects.Parameter.fixedFields.example,examples:_.visitors.document.objects.Parameter.fixedFields.examples,content:_.visitors.document.objects.Parameter.fixedFields.content}},RequestBody:{$visitor:t2,fixedFields:{description:_.visitors.document.objects.RequestBody.fixedFields.description,content:_.visitors.document.objects.RequestBody.fixedFields.content,required:_.visitors.document.objects.RequestBody.fixedFields.required}},MediaType:{$visitor:CL,fixedFields:{schema:{$ref:\"#/visitors/document/objects/Schema\"},example:_.visitors.document.objects.MediaType.fixedFields.example,examples:_.visitors.document.objects.MediaType.fixedFields.examples,encoding:_.visitors.document.objects.MediaType.fixedFields.encoding}},Encoding:{$visitor:ZL,fixedFields:{contentType:_.visitors.document.objects.Encoding.fixedFields.contentType,headers:_.visitors.document.objects.Encoding.fixedFields.headers,style:_.visitors.document.objects.Encoding.fixedFields.style,explode:_.visitors.document.objects.Encoding.fixedFields.explode,allowReserved:_.visitors.document.objects.Encoding.fixedFields.allowReserved}},Responses:{$visitor:s2,fixedFields:{default:_.visitors.document.objects.Responses.fixedFields.default}},Response:{$visitor:o2,fixedFields:{description:_.visitors.document.objects.Response.fixedFields.description,headers:_.visitors.document.objects.Response.fixedFields.headers,content:_.visitors.document.objects.Response.fixedFields.content,links:_.visitors.document.objects.Response.fixedFields.links}},Callback:{$visitor:i2},Example:{$visitor:XL,fixedFields:{summary:_.visitors.document.objects.Example.fixedFields.summary,description:_.visitors.document.objects.Example.fixedFields.description,value:_.visitors.document.objects.Example.fixedFields.value,externalValue:_.visitors.document.objects.Example.fixedFields.externalValue}},Link:{$visitor:AL,fixedFields:{operationRef:_.visitors.document.objects.Link.fixedFields.operationRef,operationId:_.visitors.document.objects.Link.fixedFields.operationId,parameters:_.visitors.document.objects.Link.fixedFields.parameters,requestBody:_.visitors.document.objects.Link.fixedFields.requestBody,description:_.visitors.document.objects.Link.fixedFields.description,server:{$ref:\"#/visitors/document/objects/Server\"}}},Header:{$visitor:kL,fixedFields:{description:_.visitors.document.objects.Header.fixedFields.description,required:_.visitors.document.objects.Header.fixedFields.required,deprecated:_.visitors.document.objects.Header.fixedFields.deprecated,allowEmptyValue:_.visitors.document.objects.Header.fixedFields.allowEmptyValue,style:_.visitors.document.objects.Header.fixedFields.style,explode:_.visitors.document.objects.Header.fixedFields.explode,allowReserved:_.visitors.document.objects.Header.fixedFields.allowReserved,schema:{$ref:\"#/visitors/document/objects/Schema\"},example:_.visitors.document.objects.Header.fixedFields.example,examples:_.visitors.document.objects.Header.fixedFields.examples,content:_.visitors.document.objects.Header.fixedFields.content}},Tag:{$visitor:FL,fixedFields:{name:_.visitors.document.objects.Tag.fixedFields.name,description:_.visitors.document.objects.Tag.fixedFields.description,externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"}}},Reference:{$visitor:$L,fixedFields:{$ref:_.visitors.document.objects.Reference.fixedFields.$ref,summary:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"}}},JSONSchema:{$ref:\"#/visitors/document/objects/Schema\"},LinkDescription:{...Fte},Schema:{$visitor:DL,fixedFields:{...Mte.fixedFields,$defs:qL,allOf:VL,anyOf:LL,oneOf:BL,not:{$ref:\"#/visitors/document/objects/Schema\"},if:{$ref:\"#/visitors/document/objects/Schema\"},then:{$ref:\"#/visitors/document/objects/Schema\"},else:{$ref:\"#/visitors/document/objects/Schema\"},dependentSchemas:UL,prefixItems:JL,items:{$ref:\"#/visitors/document/objects/Schema\"},contains:{$ref:\"#/visitors/document/objects/Schema\"},properties:HL,patternProperties:zL,additionalProperties:{$ref:\"#/visitors/document/objects/Schema\"},propertyNames:{$ref:\"#/visitors/document/objects/Schema\"},unevaluatedItems:{$ref:\"#/visitors/document/objects/Schema\"},unevaluatedProperties:{$ref:\"#/visitors/document/objects/Schema\"},contentSchema:{$ref:\"#/visitors/document/objects/Schema\"},discriminator:{$ref:\"#/visitors/document/objects/Discriminator\"},xml:{$ref:\"#/visitors/document/objects/XML\"},externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"},example:{$ref:\"#/visitors/value\"}}},Discriminator:{$visitor:KL,fixedFields:{propertyName:_.visitors.document.objects.Discriminator.fixedFields.propertyName,mapping:_.visitors.document.objects.Discriminator.fixedFields.mapping}},XML:{$visitor:WL,fixedFields:{name:_.visitors.document.objects.XML.fixedFields.name,namespace:_.visitors.document.objects.XML.fixedFields.namespace,prefix:_.visitors.document.objects.XML.fixedFields.prefix,attribute:_.visitors.document.objects.XML.fixedFields.attribute,wrapped:_.visitors.document.objects.XML.fixedFields.wrapped}},SecurityScheme:{$visitor:c2,fixedFields:{type:_.visitors.document.objects.SecurityScheme.fixedFields.type,description:_.visitors.document.objects.SecurityScheme.fixedFields.description,name:_.visitors.document.objects.SecurityScheme.fixedFields.name,in:_.visitors.document.objects.SecurityScheme.fixedFields.in,scheme:_.visitors.document.objects.SecurityScheme.fixedFields.scheme,bearerFormat:_.visitors.document.objects.SecurityScheme.fixedFields.bearerFormat,flows:{$ref:\"#/visitors/document/objects/OAuthFlows\"},openIdConnectUrl:_.visitors.document.objects.SecurityScheme.fixedFields.openIdConnectUrl}},OAuthFlows:{$visitor:l2,fixedFields:{implicit:{$ref:\"#/visitors/document/objects/OAuthFlow\"},password:{$ref:\"#/visitors/document/objects/OAuthFlow\"},clientCredentials:{$ref:\"#/visitors/document/objects/OAuthFlow\"},authorizationCode:{$ref:\"#/visitors/document/objects/OAuthFlow\"}}},OAuthFlow:{$visitor:u2,fixedFields:{authorizationUrl:_.visitors.document.objects.OAuthFlow.fixedFields.authorizationUrl,tokenUrl:_.visitors.document.objects.OAuthFlow.fixedFields.tokenUrl,refreshUrl:_.visitors.document.objects.OAuthFlow.fixedFields.refreshUrl,scopes:_.visitors.document.objects.OAuthFlow.fixedFields.scopes}},SecurityRequirement:{$visitor:TL}},extension:{$visitor:_.visitors.document.extension.$visitor}}}},I=$te;var Nte=(t,{specPath:e=[\"visitors\",\"document\",\"objects\",\"OpenApi\",\"$visitor\"],plugins:r=[]}={})=>{let i=(0,Ne.refract)(t),o=Rt(I),s=Te(e,o),n=new s({specObj:o});return ve(i,n),Xe(n.element,r,{toolboxCreator:bu,visitorOptions:{keyMap:Ct,nodeTypeGetter:ht}})},Fe=t=>(e,r={})=>Nte(e,{specPath:t,...r});Di.refract=Fe([\"visitors\",\"document\",\"objects\",\"Callback\",\"$visitor\"]);qi.refract=Fe([\"visitors\",\"document\",\"objects\",\"Components\",\"$visitor\"]);Vi.refract=Fe([\"visitors\",\"document\",\"objects\",\"Contact\",\"$visitor\"]);Li.refract=Fe([\"visitors\",\"document\",\"objects\",\"Example\",\"$visitor\"]);cs.refract=Fe([\"visitors\",\"document\",\"objects\",\"Discriminator\",\"$visitor\"]);ls.refract=Fe([\"visitors\",\"document\",\"objects\",\"Encoding\",\"$visitor\"]);Bi.refract=Fe([\"visitors\",\"document\",\"objects\",\"ExternalDocumentation\",\"$visitor\"]);Ui.refract=Fe([\"visitors\",\"document\",\"objects\",\"Header\",\"$visitor\"]);Ji.refract=Fe([\"visitors\",\"document\",\"objects\",\"Info\",\"$visitor\"]);Hi.refract=Fe([\"visitors\",\"document\",\"objects\",\"OpenApi\",\"fixedFields\",\"jsonSchemaDialect\"]);zi.refract=Fe([\"visitors\",\"document\",\"objects\",\"License\",\"$visitor\"]);Ki.refract=Fe([\"visitors\",\"document\",\"objects\",\"Link\",\"$visitor\"]);Wi.refract=Fe([\"visitors\",\"document\",\"objects\",\"MediaType\",\"$visitor\"]);us.refract=Fe([\"visitors\",\"document\",\"objects\",\"OAuthFlow\",\"$visitor\"]);ps.refract=Fe([\"visitors\",\"document\",\"objects\",\"OAuthFlows\",\"$visitor\"]);fs.refract=Fe([\"visitors\",\"document\",\"objects\",\"OpenApi\",\"fixedFields\",\"openapi\"]);zt.refract=Fe([\"visitors\",\"document\",\"objects\",\"OpenApi\",\"$visitor\"]);Fr.refract=Fe([\"visitors\",\"document\",\"objects\",\"Operation\",\"$visitor\"]);Gi.refract=Fe([\"visitors\",\"document\",\"objects\",\"Parameter\",\"$visitor\"]);Kt.refract=Fe([\"visitors\",\"document\",\"objects\",\"PathItem\",\"$visitor\"]);Yi.refract=Fe([\"visitors\",\"document\",\"objects\",\"Paths\",\"$visitor\"]);dr.refract=Fe([\"visitors\",\"document\",\"objects\",\"Reference\",\"$visitor\"]);Xi.refract=Fe([\"visitors\",\"document\",\"objects\",\"RequestBody\",\"$visitor\"]);Qi.refract=Fe([\"visitors\",\"document\",\"objects\",\"Response\",\"$visitor\"]);Zi.refract=Fe([\"visitors\",\"document\",\"objects\",\"Responses\",\"$visitor\"]);It.refract=Fe([\"visitors\",\"document\",\"objects\",\"Schema\",\"$visitor\"]);co.refract=Fe([\"visitors\",\"document\",\"objects\",\"SecurityRequirement\",\"$visitor\"]);lo.refract=Fe([\"visitors\",\"document\",\"objects\",\"SecurityScheme\",\"$visitor\"]);uo.refract=Fe([\"visitors\",\"document\",\"objects\",\"Server\",\"$visitor\"]);po.refract=Fe([\"visitors\",\"document\",\"objects\",\"ServerVariable\",\"$visitor\"]);ds.refract=Fe([\"visitors\",\"document\",\"objects\",\"Tag\",\"$visitor\"]);hs.refract=Fe([\"visitors\",\"document\",\"objects\",\"XML\",\"$visitor\"]);var Ww=class extends mr{constructor(e){super({...e??{},name:\"binary\"})}canParse(e){return this.fileExtensions.length===0?!0:this.fileExtensions.includes(e.extension)}parse(e){try{let r=unescape(encodeURIComponent(e.toString())),i=btoa(r),o=new Be;if(i.length!==0){let s=new S.StringElement(i);s.classes.push(\"result\"),o.push(s)}return o}catch(r){throw new lt(`Error parsing \"${e.uri}\"`,{cause:r})}}},Pm=Ww;var Gw=class extends Ik{constructor(e){super({...e??{},name:\"openapi-3-1\"})}canResolve(e,r){let i=r.dereference.strategies.find(o=>o.name===\"openapi-3-1\");return i===void 0?!1:i.canDereference(e,r)}async resolve(e,r){let i=r.dereference.strategies.find(n=>n.name===\"openapi-3-1\");if(i===void 0)throw new gf('\"openapi-3-1\" dereference strategy is not available.');let o=new gt,s=Yp(r,{resolve:{internal:!1},dereference:{refSet:o}});return await i.dereference(e,s),o}},Am=Gw;var{AbortController:f2,AbortSignal:m2}=globalThis;typeof globalThis.AbortController>\"u\"&&(globalThis.AbortController=f2);typeof globalThis.AbortSignal>\"u\"&&(globalThis.AbortSignal=m2);var Yw=class extends ng{swaggerHTTPClient=Zr;swaggerHTTPClientConfig;constructor({swaggerHTTPClient:e=Zr,swaggerHTTPClientConfig:r={},...i}={}){super({...i,name:\"http-swagger-client\"}),this.swaggerHTTPClient=e,this.swaggerHTTPClientConfig=r}getHttpClient(){return this.swaggerHTTPClient}async read(e){let r=this.getHttpClient(),i=new AbortController,{signal:o}=i,s=setTimeout(()=>{i.abort()},this.timeout),n=this.getHttpClient().withCredentials||this.withCredentials?\"include\":\"same-origin\",a=this.redirects===0?\"error\":\"follow\",p=this.redirects>0?this.redirects:void 0;try{return(await r({url:e.uri,signal:o,userFetch:async(u,f)=>{let m=await fetch(u,f);try{m.headers.delete(\"Content-Type\")}catch{m=new Response(m.body,{...m,headers:new Headers(m.headers)}),m.headers.delete(\"Content-Type\")}return m},credentials:n,redirect:a,follow:p,...this.swaggerHTTPClientConfig})).text.arrayBuffer()}catch(l){throw new Cl(`Error downloading \"${e.uri}\"`,{cause:l})}finally{clearTimeout(s)}}},vc=Yw;var Xw=Le(Er());var Qw=class extends mr{constructor(e={}){super({name:\"json-swagger-client\",mediaTypes:[\"application/json\"],...e})}async canParse(e){var r,i;let o=this.fileExtensions.length===0?!0:(0,Xw.default)(r=this.fileExtensions).call(r,e.extension),s=(0,Xw.default)(i=this.mediaTypes).call(i,e.mediaType);if(!o)return!1;if(s)return!0;if(!s)try{return JSON.parse(e.toString()),!0}catch{return!1}return!1}async parse(e){if(this.sourceMap)throw new lt(\"json-swagger-client parser plugin doesn't support sourceMaps option\");let r=new Be,i=e.toString();if(this.allowEmpty&&i.trim()===\"\")return r;try{let o=Ql(JSON.parse(i));return o.classes.push(\"result\"),r.push(o),r}catch(o){throw new lt(`Error parsing \"${e.uri}\"`,{cause:o})}}},Ec=Qw;var Zw=Le(Er());var ej=class extends mr{constructor(e={}){super({name:\"yaml-1-2-swagger-client\",mediaTypes:[\"text/yaml\",\"application/yaml\"],...e})}async canParse(e){var r,i;let o=this.fileExtensions.length===0?!0:(0,Zw.default)(r=this.fileExtensions).call(r,e.extension),s=(0,Zw.default)(i=this.mediaTypes).call(i,e.mediaType);if(!o)return!1;if(s)return!0;if(!s)try{return br.load(e.toString(),{schema:An}),!0}catch{return!1}return!1}async parse(e){if(this.sourceMap)throw new lt(\"yaml-1-2-swagger-client parser plugin doesn't support sourceMaps option\");let r=new Be,i=e.toString();try{let o=br.load(i,{schema:An});if(this.allowEmpty&&typeof o>\"u\")return r;let s=Ql(o);return s.classes.push(\"result\"),r.push(s),r}catch(o){throw new lt(`Error parsing \"${e.uri}\"`,{cause:o})}}},bc=ej;var tj=Le(Er());var rj=class extends mr{detectionRegExp=/\"openapi\"\\s*:\\s*\"(?<version_json>3\\.1\\.(?:[1-9]\\d*|0))\"/;constructor(e={}){super({name:\"openapi-json-3-1-swagger-client\",mediaTypes:new ln(...ui.filterByFormat(\"generic\"),...ui.filterByFormat(\"json\")),...e})}async canParse(e){var r,i;let o=this.fileExtensions.length===0?!0:(0,tj.default)(r=this.fileExtensions).call(r,e.extension),s=(0,tj.default)(i=this.mediaTypes).call(i,e.mediaType);if(!o)return!1;if(s)return!0;if(!s)try{let n=e.toString();return JSON.parse(n),this.detectionRegExp.test(n)}catch{return!1}return!1}async parse(e){if(this.sourceMap)throw new lt(\"openapi-json-3-1-swagger-client parser plugin doesn't support sourceMaps option\");let r=new Be,i=e.toString();if(this.allowEmpty&&i.trim()===\"\")return r;try{let o=JSON.parse(i),s=zt.refract(o,this.refractorOpts);return s.classes.push(\"result\"),r.push(s),r}catch(o){throw new lt(`Error parsing \"${e.uri}\"`,{cause:o})}}},Rm=rj;var ij=Le(Er());var oj=class extends mr{detectionRegExp=/(?<YAML>^([\"']?)openapi\\2\\s*:\\s*([\"']?)(?<version_yaml>3\\.1\\.(?:[1-9]\\d*|0))\\3(?:\\s+|$))|(?<JSON>\"openapi\"\\s*:\\s*\"(?<version_json>3\\.1\\.(?:[1-9]\\d*|0))\")/m;constructor(e={}){super({name:\"openapi-yaml-3-1-swagger-client\",mediaTypes:new ln(...ui.filterByFormat(\"generic\"),...ui.filterByFormat(\"yaml\")),...e})}async canParse(e){var r,i;let o=this.fileExtensions.length===0?!0:(0,ij.default)(r=this.fileExtensions).call(r,e.extension),s=(0,ij.default)(i=this.mediaTypes).call(i,e.mediaType);if(!o)return!1;if(s)return!0;if(!s)try{let n=e.toString();return br.load(n),this.detectionRegExp.test(n)}catch{return!1}return!1}async parse(e){if(this.sourceMap)throw new lt(\"openapi-yaml-3-1-swagger-client parser plugin doesn't support sourceMaps option\");let r=new Be,i=e.toString();try{let o=br.load(i,{schema:An});if(this.allowEmpty&&typeof o>\"u\")return r;let s=zt.refract(o,this.refractorOpts);return s.classes.push(\"result\"),r.push(s),r}catch(o){throw new lt(`Error parsing \"${e.uri}\"`,{cause:o})}}},_m=oj;var la=t=>/^[A-Za-z_][A-Za-z_0-9.-]*$/.test(t),xs=t=>{let e=Ko(t);return zn(\"#\",e)},kte=t=>{if(!la(t))throw new Sf(t);return t},Sc=(t,e)=>{let r=kte(t),i=ai(o=>Tt(o)&&b(o.$anchor)===r,e);if(et(i))throw new bf(`Evaluation failed on token: \"${r}\"`);return i};var Ou=(t,e)=>{if(typeof e.$ref>\"u\")return;let r=Ko(b(e.$ref)),i=b(e.meta.get(\"ancestorsSchemaIdentifiers\"));return`${sr((s,n)=>Vt(s,Pt(be(n))),t,[...i,b(e.$ref)])}${r===\"#\"?\"\":r}`},sj=(t,e)=>{if(typeof e.$id>\"u\")return;let r=b(e.meta.get(\"ancestorsSchemaIdentifiers\"));return sr((i,o)=>Vt(i,Pt(be(o))),t,r)},Su=t=>{if(Su.cache.has(t))return Su.cache.get(t);let e=It.refract(t);return Su.cache.set(t,e),e};Su.cache=new WeakMap;var bt=t=>ft(t)?Su(t):t;var Oc=(t,e)=>{let{cache:r}=Oc,i=be(t),o=n=>Tt(n)&&typeof n.$id<\"u\";if(!r.has(e)){let n=tc(o,e);r.set(e,Array.from(n))}let s=r.get(e).find(n=>sj(i,n)===i);if(et(s))throw new Hr(`Evaluation failed on URI: \"${t}\"`);return la(xs(t))?Sc(xs(t),s):ke(s,Me.fromURIReference(t))};Oc.cache=new WeakMap;var Im=ve[Symbol.for(\"nodejs.util.promisify.custom\")],Wt=new Ur,Kr=(t,e,r,i)=>{Ue(i)?i.value=t:Array.isArray(i)&&(i[r]=t)},nj=class t{indirections;namespace;reference;options;ancestors;refractCache;allOfDiscriminatorMapping;errorContext;errorPropagationCache=new Map;pendingPropagations=[];constructor({reference:e,namespace:r,options:i,indirections:o=[],ancestors:s=new _o,refractCache:n=new Map,allOfDiscriminatorMapping:a=new Map,errorContext:p=[],errorPropagationCache:l=new Map,pendingPropagations:u=[]}){this.indirections=o,this.namespace=r,this.reference=e,this.options=i,this.ancestors=new _o(...s),this.refractCache=n,this.allOfDiscriminatorMapping=a,this.errorContext=p,this.errorPropagationCache=l,this.pendingPropagations=u}popErrorContext(e){if(this.errorContext[this.errorContext.length-1]===e)this.errorContext.pop();else for(let r=this.errorContext.length-1;r>=0;r-=1)if(this.errorContext[r]===e){this.errorContext.splice(r,1);break}}runPropagationPass(){let e=!1;return this.pendingPropagations.forEach(({referencingElement:r,referencedElement:i})=>{let o=this.errorPropagationCache.get(i);Array.isArray(o)&&o.length>0&&o.forEach(s=>{let n=this.errorPropagationCache.get(r);if(!(n!=null&&n.includes(s))){var a;(a=this.options.dereference.dereferenceOpts)===null||a===void 0||a.errors.push({error:s,refEl:r}),n?n.push(s):this.errorPropagationCache.set(r,[s]),e=!0}})}),e}propagateErrors(){for(;this.runPropagationPass(););this.pendingPropagations.length=0}handleDereferenceError(e,r,i){var o;if((o=this.options.dereference.dereferenceOpts)!==null&&o!==void 0&&o.continueOnError){var s,n,a;let{directAncestors:u,isExternalReference:f=!1}=i??{},m=(s=(n=this.options.dereference.dereferenceOpts)===null||n===void 0?void 0:n.skipNestedExternal)!==null&&s!==void 0?s:!1,x=f&&m;if(u&&!x){for(let O of u){let j=this.errorPropagationCache.get(O);j?j.push(e):this.errorPropagationCache.set(O,[e])}let h=[...u].find(O=>ne(O)&&O.getMetaProperty(\"ref-referencing-element\"));if(h){var p;(p=this.options.dereference.dereferenceOpts)===null||p===void 0||p.errors.push({error:e,refEl:h.getMetaProperty(\"ref-referencing-element\")})}}if((a=this.options.dereference.dereferenceOpts)===null||a===void 0||a.errors.push({error:e,refEl:r}),!x){let h=new Set(this.errorContext);h.delete(r),this.popErrorContext(r);for(let O of h){var l;(l=this.options.dereference.dereferenceOpts)===null||l===void 0||l.errors.push({error:e,refEl:O})}}return}throw e}getNestedVisitorOptions(e){var r,i;return{...this.options,resolve:{...this.options.resolve,external:(r=this.options.dereference)!==null&&r!==void 0&&(r=r.dereferenceOpts)!==null&&r!==void 0&&r.skipNestedExternal&&b(e.get(\"$ref\")).startsWith(\"#\")?!1:this.options.resolve.external},dereference:{...this.options.dereference,dereferenceOpts:{...(i=this.options.dereference)===null||i===void 0?void 0:i.dereferenceOpts,continueOnError:!1}}}}toBaseURI(e){return Vt(this.reference.uri,Pt(be(e)))}async toReference(e){if(this.reference.depth>=this.options.resolve.maxDepth)throw new Of(`Maximum resolution depth of ${this.options.resolve.maxDepth} has been exceeded by file \"${this.reference.uri}\"`);let r=this.toBaseURI(e),{refSet:i}=this.reference;if(i.has(r))return i.find(jo(r,\"uri\"));let o=await Qp(pr(r),{...this.options,parse:{...this.options.parse,mediaType:\"text/plain\"}}),s=new He({uri:r,value:$(o),depth:this.reference.depth+1});if(i.add(s),this.options.dereference.immutable){let n=new He({uri:`immutable://${r}`,value:o,depth:this.reference.depth+1});i.add(n)}return s}toAncestorLineage(e){let r=new Set(e.filter(Se));return[new _o(...this.ancestors,r),r]}OpenApi3_1Element={leave:(e,r,i,o,s,n)=>{var a,p;if((a=this.options.dereference.dereferenceOpts)!==null&&a!==void 0&&a.continueOnError&&this.propagateErrors(),!((p=this.options.dereference.strategyOpts[\"openapi-3-1\"])!==null&&p!==void 0&&p.dereferenceDiscriminatorMapping))return;let l=Ae(e);return l.setMetaProperty(\"allOfDiscriminatorMapping\",Object.fromEntries(this.allOfDiscriminatorMapping)),n.replaceWith(l,Kr),i?void 0:l}};async ReferenceElement(e,r,i,o,s,n){var a,p;if(this.indirections.includes(e))return!1;let[l,u]=this.toAncestorLineage([...s,i]),f=this.toBaseURI(b(e.$ref)),m=be(this.reference.uri)===f,x=!m;if(!this.options.resolve.internal&&m||!this.options.resolve.external&&x)return!1;let h;try{h=await this.toReference(b(e.$ref))}catch(C){return this.handleDereferenceError(C,e,{directAncestors:u,isExternalReference:x})}let O=Vt(f,b(e.$ref));this.indirections.push(e);let j=Me.fromURIReference(O),v;try{v=ke(h.value.result,j)}catch(C){return this.indirections.pop(),this.handleDereferenceError(C,e,{directAncestors:u,isExternalReference:x})}if(v.id=Wt.identify(v),ft(v)){let C=b(e.meta.get(\"referenced-element\")),oe=`${C}-${b(Wt.identify(v))}`;this.refractCache.has(oe)?v=this.refractCache.get(oe):ue(v)?(v=dr.refract(v),v.setMetaProperty(\"referenced-element\",C),this.refractCache.set(oe,v)):(v=this.namespace.getElementClass(C).refract(v),this.refractCache.set(oe,v))}if(e===v){let C=new he(\"Recursive Reference Object detected\");return this.indirections.pop(),this.handleDereferenceError(C,e,{directAncestors:u,isExternalReference:x})}if(this.indirections.length>this.options.dereference.maxDepth){let C=new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);return this.indirections.pop(),this.handleDereferenceError(C,e,{directAncestors:u,isExternalReference:x})}if(l.includes(v)){if(h.refSet.circular=!0,this.options.dereference.circular===\"error\"){let C=new he(\"Circular reference detected\");return this.indirections.pop(),this.handleDereferenceError(C,e,{directAncestors:u,isExternalReference:x})}if(this.options.dereference.circular===\"replace\"){var E,y;let C=new S.RefElement(v.id,{type:\"reference\",uri:h.uri,$ref:b(e.$ref)}),M=((E=(y=this.options.dereference.strategyOpts[\"openapi-3-1\"])===null||y===void 0?void 0:y.circularReplacer)!==null&&E!==void 0?E:this.options.dereference.circularReplacer)(C);return n.replaceWith(M,Kr),i?!1:M}}let g=be(h.refSet.rootRef.uri)!==h.uri,q=[\"error\",\"replace\"].includes(this.options.dereference.circular);if((x||g||$r(v)||q)&&!l.includesCycle(v)){u.add(e),this.errorContext.push(e);let C=new t({reference:h,namespace:this.namespace,indirections:[...this.indirections],options:this.getNestedVisitorOptions(e),refractCache:this.refractCache,ancestors:l,allOfDiscriminatorMapping:this.allOfDiscriminatorMapping,errorContext:this.errorContext,errorPropagationCache:this.errorPropagationCache,pendingPropagations:this.pendingPropagations});try{v=await Im(v,C,{keyMap:Ct,nodeTypeGetter:ht})}catch(oe){return this.indirections.pop(),this.handleDereferenceError(oe,e,{directAncestors:u,isExternalReference:x})}u.delete(e),this.popErrorContext(e)}(a=this.options.dereference.dereferenceOpts)!==null&&a!==void 0&&a.continueOnError&&this.pendingPropagations.push({referencingElement:e,referencedElement:v}),this.indirections.pop();let V=Ae(v);return V.setMetaProperty(\"id\",Wt.generateId()),V.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref),description:b(e.description),summary:b(e.summary)}),V.setMetaProperty(\"ref-origin\",h.uri),V.setMetaProperty(\"ref-referencing-element-id\",$(Wt.identify(e))),(p=this.options.dereference.dereferenceOpts)!==null&&p!==void 0&&p.continueOnError&&V.setMetaProperty(\"ref-referencing-element\",e),ne(v)&&ne(V)&&(e.hasKey(\"description\")&&\"description\"in v&&(V.remove(\"description\"),V.set(\"description\",e.get(\"description\"))),e.hasKey(\"summary\")&&\"summary\"in v&&(V.remove(\"summary\"),V.set(\"summary\",e.get(\"summary\")))),n.replaceWith(V,Kr),i?!1:V}async PathItemElement(e,r,i,o,s,n){var a;if(!z(e.$ref))return;if(this.indirections.includes(e))return!1;let[p,l]=this.toAncestorLineage([...s,i]),u=this.toBaseURI(b(e.$ref)),f=be(this.reference.uri)===u,m=!f;if(!this.options.resolve.internal&&f||!this.options.resolve.external&&m)return;let x;try{x=await this.toReference(b(e.$ref))}catch(V){return this.handleDereferenceError(V,e,{directAncestors:l,isExternalReference:m})}let h=Vt(u,b(e.$ref));this.indirections.push(e);let O=Me.fromURIReference(h),j;try{j=ke(x.value.result,O)}catch(V){return this.indirections.pop(),this.handleDereferenceError(V,e,{directAncestors:l,isExternalReference:m})}if(j.id=Wt.identify(j),ft(j)){let V=`path-item-${b(Wt.identify(j))}`;this.refractCache.has(V)?j=this.refractCache.get(V):(j=Kt.refract(j),this.refractCache.set(V,j))}if(e===j){let V=new he(\"Recursive Path Item Object reference detected\");return this.indirections.pop(),this.handleDereferenceError(V,e,{directAncestors:l,isExternalReference:m})}if(this.indirections.length>this.options.dereference.maxDepth){let V=new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);return this.indirections.pop(),this.handleDereferenceError(V,e,{directAncestors:l,isExternalReference:m})}if(p.includes(j)){if(x.refSet.circular=!0,this.options.dereference.circular===\"error\"){let V=new he(\"Circular reference detected\");return this.indirections.pop(),this.handleDereferenceError(V,e,{directAncestors:l,isExternalReference:m})}if(this.options.dereference.circular===\"replace\"){var v,E;let V=new S.RefElement(j.id,{type:\"path-item\",uri:x.uri,$ref:b(e.$ref)}),oe=((v=(E=this.options.dereference.strategyOpts[\"openapi-3-1\"])===null||E===void 0?void 0:E.circularReplacer)!==null&&v!==void 0?v:this.options.dereference.circularReplacer)(V);return n.replaceWith(oe,Kr),i?!1:oe}}let y=be(x.refSet.rootRef.uri)!==x.uri,g=[\"error\",\"replace\"].includes(this.options.dereference.circular);if((m||y||fo(j)&&z(j.$ref)||g)&&!p.includesCycle(j)){l.add(e),this.errorContext.push(e);let V=new t({reference:x,namespace:this.namespace,indirections:[...this.indirections],options:this.getNestedVisitorOptions(e),refractCache:this.refractCache,ancestors:p,allOfDiscriminatorMapping:this.allOfDiscriminatorMapping,errorContext:this.errorContext,errorPropagationCache:this.errorPropagationCache,pendingPropagations:this.pendingPropagations});try{j=await Im(j,V,{keyMap:Ct,nodeTypeGetter:ht})}catch(C){return this.indirections.pop(),this.handleDereferenceError(C,e,{directAncestors:l,isExternalReference:m})}l.delete(e),this.popErrorContext(e)}if((a=this.options.dereference.dereferenceOpts)!==null&&a!==void 0&&a.continueOnError&&this.pendingPropagations.push({referencingElement:e,referencedElement:j}),this.indirections.pop(),fo(j)){var q;let V=new Kt([...j.content],$(j.meta),$(j.attributes));V.setMetaProperty(\"id\",Wt.generateId()),e.forEach((C,oe,M)=>{V.remove(b(oe)),V.content.push(M)}),V.remove(\"$ref\"),V.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref)}),V.setMetaProperty(\"ref-origin\",x.uri),V.setMetaProperty(\"ref-referencing-element-id\",$(Wt.identify(e))),(q=this.options.dereference.dereferenceOpts)!==null&&q!==void 0&&q.continueOnError&&V.setMetaProperty(\"ref-referencing-element\",e),j=V}return n.replaceWith(j,Kr),i?void 0:j}async LinkElement(e,r,i,o,s,n){if(!z(e.operationRef)&&!z(e.operationId))return;if(z(e.operationRef)&&z(e.operationId)){let u=new he(\"LinkElement operationRef and operationId fields are mutually exclusive.\");return this.handleDereferenceError(u,e)}let a;if(z(e.operationRef)){var p;let u=Me.fromURIReference(b(e.operationRef)),f=this.toBaseURI(b(e.operationRef)),m=be(this.reference.uri)===f,x=!m;if(!this.options.resolve.internal&&m||!this.options.resolve.external&&x)return;let h;try{h=await this.toReference(b(e.operationRef)),a=ke(h.value.result,u)}catch(j){return this.handleDereferenceError(j,e,{isExternalReference:x})}if(ft(a)){let j=`operation-${b(Wt.identify(a))}`;this.refractCache.has(j)?a=this.refractCache.get(j):(a=Fr.refract(a),this.refractCache.set(j,a))}a=Ae(a),a.setMetaProperty(\"ref-origin\",h.uri);let O=Ae(e);return(p=O.operationRef)===null||p===void 0||p.meta.set(\"operation\",a),n.replaceWith(O,Kr),i?void 0:O}if(z(e.operationId)){var l;let u=b(e.operationId),f;try{f=await this.toReference(pr(this.reference.uri))}catch(x){return this.handleDereferenceError(x,e)}if(a=ai(x=>jm(x)&&Se(x.operationId)&&x.operationId.equals(u),f.value.result),et(a)){let x=new he(`OperationElement(operationId=${u}) not found.`);return this.handleDereferenceError(x,e)}let m=Ae(e);return(l=m.operationId)===null||l===void 0||l.meta.set(\"operation\",a),n.replaceWith(m,Kr),i?void 0:m}}async ExampleElement(e,r,i,o,s,n){if(!z(e.externalValue))return;if(e.hasKey(\"value\")&&z(e.externalValue)){let x=new he(\"ExampleElement value and externalValue fields are mutually exclusive.\");return this.handleDereferenceError(x,e)}let a=this.toBaseURI(b(e.externalValue)),p=be(this.reference.uri)===a,l=!p;if(!this.options.resolve.internal&&p||!this.options.resolve.external&&l)return;let u;try{u=await this.toReference(b(e.externalValue))}catch(x){return this.handleDereferenceError(x,e,{isExternalReference:l})}let f=Ae(u.value.result);f.setMetaProperty(\"ref-origin\",u.uri);let m=Ae(e);return m.value=f,n.replaceWith(m,Kr),i?void 0:m}async MemberElement(e,r,i,o,s,n){var a;let p=s[s.length-1];if(!ne(p)||!p.classes.contains(\"discriminator-mapping\"))return;if(!((a=this.options.dereference.strategyOpts[\"openapi-3-1\"])!==null&&a!==void 0&&a.dereferenceDiscriminatorMapping)||!z(e.key)||!z(e.value)||this.indirections.includes(e))return!1;this.indirections.push(e);let[l,u]=this.toAncestorLineage([...s,i]),f=[...u].findLast(Tt),m=$(f.getMetaProperty(\"ancestorsSchemaIdentifiers\")),x=b(e.value),O=/^[a-zA-Z0-9\\\\.\\\\-_]+$/.test(x)?`#/components/schemas/${x}`:x,j=new It({$ref:O});j.setMetaProperty(\"ancestorsSchemaIdentifiers\",m),u.add(j);let v=new t({reference:this.reference,namespace:this.namespace,indirections:[...this.indirections],options:this.getNestedVisitorOptions(j),refractCache:this.refractCache,ancestors:l,allOfDiscriminatorMapping:this.allOfDiscriminatorMapping}),E;try{E=await Im(j,v,{keyMap:Ct,nodeTypeGetter:ht})}catch(g){let q=!O.startsWith(\"#\");return this.handleDereferenceError(g,j,{directAncestors:u,isExternalReference:q})}u.delete(j),this.indirections.pop();let y=Ae(e);return y.value.setMetaProperty(\"ref-schema\",E),n.replaceWith(y,Kr),i?void 0:y}async SchemaElement(e,r,i,o,s,n){var a;if(!z(e.$ref))return;if(this.indirections.includes(e))return!1;let[p,l]=this.toAncestorLineage([...s,i]),u;try{u=await this.toReference(pr(this.reference.uri))}catch(k){return this.handleDereferenceError(k,e,{directAncestors:l})}let{uri:f}=u,m=Ou(f,e),x=be(m),h=new Zt({uri:x}),O=wl(k=>k.canRead(h),this.options.resolve.resolvers),j=!O,v=be(this.reference.uri)===m,E=!v;this.indirections.push(e);let y;try{if(O||j){f=this.toBaseURI(m);let k=m,W=bt(u.value.result);if(y=Oc(k,W),y=bt(y),y.id=Wt.identify(y),!this.options.resolve.internal&&v||!this.options.resolve.external&&E)return}else{if(f=this.toBaseURI(m),v=be(this.reference.uri)===f,E=!v,!this.options.resolve.internal&&v||!this.options.resolve.external&&E)return;u=await this.toReference(pr(m));let k=Me.fromURIReference(m),W=bt(u.value.result);y=ke(W,k),y=bt(y),y.id=Wt.identify(y)}}catch(k){if(j&&k instanceof Hr)if(la(xs(m))){if(v=be(this.reference.uri)===f,E=!v,!this.options.resolve.internal&&v||!this.options.resolve.external&&E)return;try{u=await this.toReference(pr(m))}catch(pe){return this.indirections.pop(),this.handleDereferenceError(pe,e,{directAncestors:l,isExternalReference:E})}let W=xs(m),Z=bt(u.value.result);try{y=Sc(W,Z)}catch(pe){return this.indirections.pop(),this.handleDereferenceError(pe,e,{directAncestors:l,isExternalReference:E})}y=bt(y),y.id=Wt.identify(y)}else{if(f=this.toBaseURI(m),v=be(this.reference.uri)===f,E=!v,!this.options.resolve.internal&&v||!this.options.resolve.external&&E)return;try{u=await this.toReference(pr(m))}catch(pe){return this.indirections.pop(),this.handleDereferenceError(pe,e,{directAncestors:l,isExternalReference:E})}let W=Me.fromURIReference(m),Z=bt(u.value.result);try{y=ke(Z,W)}catch(pe){return this.indirections.pop(),this.handleDereferenceError(pe,e,{directAncestors:l,isExternalReference:E})}y=bt(y),y.id=Wt.identify(y)}else return this.indirections.pop(),this.handleDereferenceError(k,e,{directAncestors:l,isExternalReference:E})}if(e===y){let k=new he(\"Recursive Schema Object reference detected\");return this.indirections.pop(),this.handleDereferenceError(k,e,{directAncestors:l,isExternalReference:E})}if(this.indirections.length>this.options.dereference.maxDepth){let k=new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);return this.indirections.pop(),this.handleDereferenceError(k,e,{directAncestors:l,isExternalReference:E})}if(p.includes(y)){if(u.refSet.circular=!0,this.options.dereference.circular===\"error\"){let k=new he(\"Circular reference detected\");return this.indirections.pop(),this.handleDereferenceError(k,e,{directAncestors:l,isExternalReference:E})}if(this.options.dereference.circular===\"replace\"){var g,q;let k=new S.RefElement(y.id,{type:\"json-schema\",uri:u.uri,$ref:b(e.$ref)}),Z=((g=(q=this.options.dereference.strategyOpts[\"openapi-3-1\"])===null||q===void 0?void 0:q.circularReplacer)!==null&&g!==void 0?g:this.options.dereference.circularReplacer)(k);return n.replaceWith(Z,Kr),i?!1:Z}}let V=be(u.refSet.rootRef.uri)!==u.uri,C=[\"error\",\"replace\"].includes(this.options.dereference.circular);if((E||V||Tt(y)&&z(y.$ref)||C)&&!p.includesCycle(y)){l.add(e),this.errorContext.push(e);let k=new t({reference:u,namespace:this.namespace,indirections:[...this.indirections],options:this.getNestedVisitorOptions(e),refractCache:this.refractCache,ancestors:p,allOfDiscriminatorMapping:this.allOfDiscriminatorMapping,errorContext:this.errorContext,errorPropagationCache:this.errorPropagationCache,pendingPropagations:this.pendingPropagations});try{y=await Im(y,k,{keyMap:Ct,nodeTypeGetter:ht})}catch(W){return this.indirections.pop(),this.handleDereferenceError(W,e,{directAncestors:l,isExternalReference:E})}l.delete(e),this.popErrorContext(e)}if((a=this.options.dereference.dereferenceOpts)!==null&&a!==void 0&&a.continueOnError&&this.pendingPropagations.push({referencingElement:e,referencedElement:y}),this.indirections.pop(),gc(y)){let k=$(y);return k.setMetaProperty(\"id\",Wt.generateId()),k.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref),$refBaseURI:m}),k.setMetaProperty(\"ref-origin\",u.uri),k.setMetaProperty(\"ref-referencing-element-id\",$(Wt.identify(e))),n.replaceWith(k,Kr),i?!1:k}if(Tt(y)){var oe,M;let k=new It([...y.content],$(y.meta),$(y.attributes));if(k.setMetaProperty(\"id\",Wt.generateId()),e.forEach((W,Z,pe)=>{k.remove(b(Z)),k.content.push(pe)}),k.remove(\"$ref\"),k.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref),$refBaseURI:m}),k.setMetaProperty(\"ref-origin\",u.uri),k.setMetaProperty(\"ref-referencing-element-id\",$(Wt.identify(e))),(oe=this.options.dereference.dereferenceOpts)!==null&&oe!==void 0&&oe.continueOnError&&k.setMetaProperty(\"ref-referencing-element\",e),(M=this.options.dereference.strategyOpts[\"openapi-3-1\"])!==null&&M!==void 0&&M.dereferenceDiscriminatorMapping){var te;let W=s[s.length-1],Z=[...l].findLast(Tt),pe=Z?.getMetaProperty(\"schemaName\"),re=b(k.getMetaProperty(\"schemaName\"));if(re&&pe&&W!==null&&W!==void 0&&(te=W.classes)!==null&&te!==void 0&&te.contains(\"json-schema-allOf\")){var H;let Qe=(H=this.allOfDiscriminatorMapping.get(re))!==null&&H!==void 0?H:[];Qe.push(Z),this.allOfDiscriminatorMapping.set(re,Qe)}}y=k}return n.replaceWith(y,Kr),i?void 0:y}},Cm=nj;var Dte=ve[Symbol.for(\"nodejs.util.promisify.custom\")],aj=class extends vf{constructor(e){super({...e??{},name:\"openapi-3-1\"})}canDereference(e){var r;return e.mediaType!==\"text/plain\"?ui.includes(e.mediaType):wm((r=e.parseResult)===null||r===void 0?void 0:r.result)}async dereference(e,r){var i;let o=Ye(ca),s=(i=r.dereference.refSet)!==null&&i!==void 0?i:new gt,n=new gt,a=s,p;s.has(e.uri)?p=s.find(jo(e.uri,\"uri\")):(p=new He({uri:e.uri,value:e.parseResult}),s.add(p)),r.dereference.immutable&&(s.refs.map(f=>new He({...f,value:$(f.value)})).forEach(f=>n.add(f)),p=n.find(f=>f.uri===e.uri),a=n);let l=new Cm({reference:p,namespace:o,options:r}),u=await Dte(a.rootRef.value,l,{keyMap:Ct,nodeTypeGetter:ht});return r.dereference.immutable&&n.refs.filter(f=>f.uri.startsWith(\"immutable://\")).map(f=>new He({...f,uri:f.uri.replace(/^immutable:\\/\\//,\"\")})).forEach(f=>s.add(f)),r.dereference.refSet===null&&s.clean(),n.clean(),u}};var d2=aj;var qte=t=>t.slice(2),Vte=t=>{let e=qte(t);return e.reduce((r,i,o)=>{if(Ue(i)){let s=String(b(i.key));r.push(s)}else if(Pe(e[o-2])){let s=e[o-2].content.indexOf(i);r.push(s)}return r},[])},hr=Vte;var cj=class{modelPropertyMacro;options;SchemaElement={leave:(e,r,i,o,s)=>{typeof e.properties>\"u\"||ne(e.properties)&&e.properties.forEach(n=>{if(ne(n))try{let a=this.modelPropertyMacro(b(n));n.set(\"default\",a)}catch(a){let p=new Error(a,{cause:a});p.fullPath=[...hr([...s,i,e]),\"properties\"],this.options.dereference.dereferenceOpts?.errors?.push?.(p)}})}};constructor({modelPropertyMacro:e,options:r}){this.modelPropertyMacro=e,this.options=r}},h2=cj;var lj=class{options;SchemaElement={leave(e,r,i,o,s){if(typeof e.allOf>\"u\")return;if(!Pe(e.allOf)){let a=new TypeError(\"allOf must be an array\");a.fullPath=[...hr([...s,i,e]),\"allOf\"],this.options.dereference.dereferenceOpts?.errors?.push?.(a);return}if(e.allOf.isEmpty){e.remove(\"allOf\");return}if(!e.allOf.content.every(Tt)){let a=new TypeError(\"Elements in allOf must be objects\");a.fullPath=[...hr([...s,i,e]),\"allOf\"],this.options.dereference.dereferenceOpts?.errors?.push?.(a);return}for(;e.hasKey(\"allOf\");){let{allOf:a}=e;e.remove(\"allOf\");let p=fr.all([...a.content,e],{customMerge:l=>b(l)===\"enum\"?(u,f)=>{if(At([\"json-schema-enum\"],u)&&At([\"json-schema-enum\"],f)){let m=(h,O)=>Pe(h)||Pe(O)||ne(h)||ne(O)?!1:h.equals(b(O)),x=Ae(u);return x.content=Jo(m)([...u.content,...f.content]),x}return fr(u,f)}:fr});if(e.hasKey(\"$$ref\")||p.remove(\"$$ref\"),e.hasKey(\"example\")){let l=p.getMember(\"example\");l&&(l.value=e.get(\"example\"))}if(e.hasKey(\"examples\")){let l=p.getMember(\"examples\");l&&(l.value=e.get(\"examples\"))}e.content=p.content}}};constructor({options:e}){this.options=e}},x2=lj;var uj=class{parameterMacro;options;#e;OperationElement={enter:e=>{this.#e=e},leave:()=>{this.#e=void 0}};ParameterElement={leave:(e,r,i,o,s)=>{let n=this.#e?b(this.#e):null,a=b(e);try{let p=this.parameterMacro(n,a);e.set(\"default\",p)}catch(p){let l=new Error(p,{cause:p});l.fullPath=hr([...s,i]),this.options.dereference.dereferenceOpts?.errors?.push?.(l)}}};constructor({parameterMacro:e,options:r}){this.parameterMacro=e,this.options=r}},y2=uj;var Mo=Le(Er());var Lte=t=>{if(t.cause==null)return t;let{cause:e}=t;for(;e.cause!=null;)e=e.cause;return e},wu=Lte;var pj=class extends yt{},g2=pj;var{wrapError:fj}=oc,mj=ve[Symbol.for(\"nodejs.util.promisify.custom\")],Wr=new Ur,ua=(t,e,r,i)=>{Ue(i)?i.value=t:Array.isArray(i)&&(i[r]=t)},dj=class t extends Cm{useCircularStructures;allowMetaPatches;basePath;constructor({allowMetaPatches:e=!0,useCircularStructures:r=!1,basePath:i=null,...o}){super(o),this.allowMetaPatches=e,this.useCircularStructures=r,this.basePath=i}async ReferenceElement(e,r,i,o,s,n){try{var a,p;if((0,Mo.default)(a=this.indirections).call(a,e))return!1;let[l,u]=this.toAncestorLineage([...s,i]),f=this.toBaseURI(b(e.$ref)),m=ae.stripHash(this.reference.uri)===f,x=!m;if(!this.options.resolve.internal&&m||!this.options.resolve.external&&x)return!1;let h=await this.toReference(b(e.$ref)),O=ae.resolve(f,b(e.$ref));this.indirections.push(e);let j=Me.fromURIReference(O),v=ke(h.value.result,j);if(v.id=Wr.identify(v),ft(v)){let q=b(e.meta.get(\"referenced-element\")),V=`${q}-${b(Wr.identify(v))}`;this.refractCache.has(V)?v=this.refractCache.get(V):ue(v)?(v=dr.refract(v),v.setMetaProperty(\"referenced-element\",q),this.refractCache.set(V,v)):(v=this.namespace.getElementClass(q).refract(v),this.refractCache.set(V,v))}if(e===v)throw new he(\"Recursive Reference Object detected\");if(this.indirections.length>this.options.dereference.maxDepth)throw new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);if((0,Mo.default)(l).call(l,v)){if(h.refSet.circular=!0,this.options.dereference.circular===\"error\")throw new he(\"Circular reference detected\");if(this.options.dereference.circular===\"replace\"){let q=new S.RefElement(v.id,{type:\"reference\",uri:h.uri,$ref:b(e.$ref),baseURI:O,referencingElement:e}),C=(this.options.dereference.strategyOpts[\"openapi-3-1\"]?.circularReplacer??this.options.dereference.circularReplacer)(q);return n.replaceWith(q,ua),i?!1:C}}let E=ae.stripHash(h.refSet.rootRef.uri)!==h.uri,y=(0,Mo.default)(p=[\"error\",\"replace\"]).call(p,this.options.dereference.circular);if((x||E||$r(v)||y)&&!l.includesCycle(v)){u.add(e);let q=new t({reference:h,namespace:this.namespace,indirections:[...this.indirections],options:this.options,refractCache:this.refractCache,ancestors:l,allowMetaPatches:this.allowMetaPatches,useCircularStructures:this.useCircularStructures,basePath:this.basePath??[...hr([...s,i,e]),\"$ref\"]});v=await mj(v,q,{keyMap:Ct,nodeTypeGetter:ht}),u.delete(e)}this.indirections.pop();let g=Ae(v);if(g.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref),description:b(e.description),summary:b(e.summary)}),g.setMetaProperty(\"ref-origin\",h.uri),g.setMetaProperty(\"ref-referencing-element-id\",$(Wr.identify(e))),ne(v)&&(e.hasKey(\"description\")&&\"description\"in v&&(g.remove(\"description\"),g.set(\"description\",e.get(\"description\"))),e.hasKey(\"summary\")&&\"summary\"in v&&(g.remove(\"summary\"),g.set(\"summary\",e.get(\"summary\")))),this.allowMetaPatches&&ne(g)&&!g.hasKey(\"$$ref\")){let q=ae.resolve(f,O);g.set(\"$$ref\",q)}return n.replaceWith(g,ua),i?!1:g}catch(l){let u=wu(l),f=fj(u,{baseDoc:this.reference.uri,$ref:b(e.$ref),pointer:Me.fromURIReference(b(e.$ref)),fullPath:this.basePath??[...hr([...s,i,e]),\"$ref\"]});this.options.dereference.dereferenceOpts?.errors?.push?.(f);return}}async PathItemElement(e,r,i,o,s,n){try{var a,p;if(!z(e.$ref))return;if((0,Mo.default)(a=this.indirections).call(a,e)||At([\"cycle\"],e.$ref))return!1;let[l,u]=this.toAncestorLineage([...s,i]),f=this.toBaseURI(b(e.$ref)),m=ae.stripHash(this.reference.uri)===f,x=!m;if(!this.options.resolve.internal&&m||!this.options.resolve.external&&x)return;let h=await this.toReference(b(e.$ref)),O=ae.resolve(f,b(e.$ref));this.indirections.push(e);let j=Me.fromURIReference(O),v=ke(h.value.result,j);if(v.id=Wr.identify(v),ft(v)){let g=`path-item-${b(Wr.identify(v))}`;this.refractCache.has(g)?v=this.refractCache.get(g):(v=Kt.refract(v),this.refractCache.set(g,v))}if(e===v)throw new he(\"Recursive Path Item Object reference detected\");if(this.indirections.length>this.options.dereference.maxDepth)throw new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);if((0,Mo.default)(l).call(l,v)){if(h.refSet.circular=!0,this.options.dereference.circular===\"error\")throw new he(\"Circular reference detected\");if(this.options.dereference.circular===\"replace\"){let g=new S.RefElement(v.id,{type:\"path-item\",uri:h.uri,$ref:b(e.$ref),baseURI:O,referencingElement:e}),V=(this.options.dereference.strategyOpts[\"openapi-3-1\"]?.circularReplacer??this.options.dereference.circularReplacer)(g);return n.replaceWith(g,ua),i?!1:V}}let E=ae.stripHash(h.refSet.rootRef.uri)!==h.uri,y=(0,Mo.default)(p=[\"error\",\"replace\"]).call(p,this.options.dereference.circular);if((x||E||fo(v)&&z(v.$ref)||y)&&!l.includesCycle(v)){u.add(e);let g=new t({reference:h,namespace:this.namespace,indirections:[...this.indirections],options:this.options,ancestors:l,allowMetaPatches:this.allowMetaPatches,useCircularStructures:this.useCircularStructures,basePath:this.basePath??[...hr([...s,i,e]),\"$ref\"]});v=await mj(v,g,{keyMap:Ct,nodeTypeGetter:ht}),u.delete(e)}if(this.indirections.pop(),fo(v)){let g=new Kt([...v.content],$(v.meta),$(v.attributes));if(e.forEach((q,V,C)=>{g.remove(b(V)),g.content.push(C)}),g.remove(\"$ref\"),g.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref)}),g.setMetaProperty(\"ref-origin\",h.uri),g.setMetaProperty(\"ref-referencing-element-id\",$(Wr.identify(e))),this.allowMetaPatches&&typeof g.get(\"$$ref\")>\"u\"){let q=ae.resolve(f,O);g.set(\"$$ref\",q)}v=g}return n.replaceWith(v,ua),i?void 0:v}catch(l){let u=wu(l),f=fj(u,{baseDoc:this.reference.uri,$ref:b(e.$ref),pointer:Me.fromURIReference(b(e.$ref)),fullPath:this.basePath??[...hr([...s,i,e]),\"$ref\"]});this.options.dereference.dereferenceOpts?.errors?.push?.(f);return}}async SchemaElement(e,r,i,o,s,n){try{var a,p;if(!z(e.$ref))return;if((0,Mo.default)(a=this.indirections).call(a,e))return!1;let[l,u]=this.toAncestorLineage([...s,i]),f=await this.toReference(ae.unsanitize(this.reference.uri)),{uri:m}=f,x=Ou(m,e),h=ae.stripHash(x),O=new Zt({uri:h}),j=!this.options.resolve.resolvers.some(C=>C.canRead(O)),v=!j,E=ae.stripHash(this.reference.uri)===x,y=!E;this.indirections.push(e);let g;try{if(j||v){m=this.toBaseURI(x);let C=x,oe=bt(f.value.result);if(g=Oc(C,oe),g=bt(g),g.id=Wr.identify(g),!this.options.resolve.internal&&E||!this.options.resolve.external&&y)return}else{if(m=this.toBaseURI(x),E=ae.stripHash(this.reference.uri)===m,y=!E,!this.options.resolve.internal&&E||!this.options.resolve.external&&y)return;f=await this.toReference(ae.unsanitize(x));let C=Me.fromURIReference(x),oe=bt(f.value.result);g=ke(oe,C),g=bt(g),g.id=Wr.identify(g)}}catch(C){if(v&&C instanceof Hr)if(la(xs(x))){if(E=ae.stripHash(this.reference.uri)===m,y=!E,!this.options.resolve.internal&&E||!this.options.resolve.external&&y)return;f=await this.toReference(ae.unsanitize(x));let oe=xs(x),M=bt(f.value.result);g=Sc(oe,M),g=bt(g),g.id=Wr.identify(g)}else{if(m=this.toBaseURI(b(x)),E=ae.stripHash(this.reference.uri)===m,y=!E,!this.options.resolve.internal&&E||!this.options.resolve.external&&y)return;f=await this.toReference(ae.unsanitize(x));let oe=Me.fromURIReference(x),M=bt(f.value.result);g=ke(M,oe),g=bt(g),g.id=Wr.identify(g)}else throw C}if(e===g)throw new he(\"Recursive Schema Object reference detected\");if(this.indirections.length>this.options.dereference.maxDepth)throw new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);if((0,Mo.default)(l).call(l,g)){if(f.refSet.circular=!0,this.options.dereference.circular===\"error\")throw new he(\"Circular reference detected\");if(this.options.dereference.circular===\"replace\"){let C=new S.RefElement(g.id,{type:\"json-schema\",uri:f.uri,$ref:b(e.$ref),baseURI:ae.resolve(m,x),referencingElement:e}),M=(this.options.dereference.strategyOpts[\"openapi-3-1\"]?.circularReplacer??this.options.dereference.circularReplacer)(C);return n.replaceWith(M,ua),i?!1:M}}let q=ae.stripHash(f.refSet.rootRef.uri)!==f.uri,V=(0,Mo.default)(p=[\"error\",\"replace\"]).call(p,this.options.dereference.circular);if((y||q||Tt(g)&&z(g.$ref)||V)&&!l.includesCycle(g)){u.add(e);let C=new t({reference:f,namespace:this.namespace,indirections:[...this.indirections],options:this.options,useCircularStructures:this.useCircularStructures,allowMetaPatches:this.allowMetaPatches,ancestors:l,basePath:this.basePath??[...hr([...s,i,e]),\"$ref\"]});g=await mj(g,C,{keyMap:Ct,nodeTypeGetter:ht}),u.delete(e)}if(this.indirections.pop(),gc(g)){let C=$(g);return C.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref)}),C.setMetaProperty(\"ref-origin\",f.uri),C.setMetaProperty(\"ref-referencing-element-id\",$(Wr.identify(e))),n.replaceWith(C,ua),i?!1:C}if(Tt(g)){let C=new It([...g.content],$(g.meta),$(g.attributes));if(e.forEach((oe,M,te)=>{C.remove(b(M)),C.content.push(te)}),C.remove(\"$ref\"),C.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref)}),C.setMetaProperty(\"ref-origin\",f.uri),C.setMetaProperty(\"ref-referencing-element-id\",$(Wr.identify(e))),this.allowMetaPatches&&typeof C.get(\"$$ref\")>\"u\"){let oe=ae.resolve(m,x);C.set(\"$$ref\",oe)}g=C}return n.replaceWith(g,ua),i?void 0:g}catch(l){let u=wu(l),f=new g2(`Could not resolve reference: ${u.message}`,{baseDoc:this.reference.uri,$ref:b(e.$ref),fullPath:this.basePath??[...hr([...s,i,e]),\"$ref\"],cause:u});this.options.dereference.dereferenceOpts?.errors?.push?.(f);return}}async LinkElement(){}async ExampleElement(e,r,i,o,s,n){try{return await super.ExampleElement(e,r,i,o,s,n)}catch(a){let p=wu(a),l=fj(p,{baseDoc:this.reference.uri,externalValue:b(e.externalValue),fullPath:this.basePath??[...hr([...s,i,e]),\"externalValue\"]});this.options.dereference.dereferenceOpts?.errors?.push?.(l);return}}},v2=dj;var Bte=ni[Symbol.for(\"nodejs.util.promisify.custom\")],hj=class{constructor({parameterMacro:e,modelPropertyMacro:r,mode:i,options:o,...s}){let n=[];n.push(new v2({...s,options:o})),typeof r==\"function\"&&n.push(new h2({modelPropertyMacro:r,options:o})),i!==\"strict\"&&n.push(new x2({options:o})),typeof e==\"function\"&&n.push(new y2({parameterMacro:e,options:o}));let a=Bte(n,{nodeTypeGetter:ht});Object.assign(this,a)}},E2=hj;var Ute=ve[Symbol.for(\"nodejs.util.promisify.custom\")],xj=class extends d2{allowMetaPatches;parameterMacro;modelPropertyMacro;mode;ancestors;constructor({allowMetaPatches:e=!1,parameterMacro:r=null,modelPropertyMacro:i=null,mode:o=\"non-strict\",ancestors:s=[],...n}={}){super({...n}),this.name=\"openapi-3-1-swagger-client\",this.allowMetaPatches=e,this.parameterMacro=r,this.modelPropertyMacro=i,this.mode=o,this.ancestors=[...s]}async dereference(e,r){let i=Ye(ca),o=r.dereference.refSet??new gt,s=new gt,n=o,a;o.has(e.uri)?a=o.find(u=>u.uri===e.uri):(a=new He({uri:e.uri,value:e.parseResult}),o.add(a)),r.dereference.immutable&&(o.refs.map(u=>new He({...u,value:$(u.value)})).forEach(u=>s.add(u)),a=s.find(u=>u.uri===e.uri),n=s);let p=new E2({reference:a,namespace:i,options:r,allowMetaPatches:this.allowMetaPatches,ancestors:this.ancestors,modelPropertyMacro:this.modelPropertyMacro,mode:this.mode,parameterMacro:this.parameterMacro}),l=await Ute(n.rootRef.value,p,{keyMap:Ct,nodeTypeGetter:ht});return r.dereference.immutable&&s.refs.filter(u=>u.uri.startsWith(\"immutable://\")).map(u=>new He({...u,uri:u.uri.replace(/^immutable:\\/\\//,\"\")})).forEach(u=>o.add(u)),r.dereference.refSet===null&&o.clean(),s.clean(),l}},Tm=xj;var Jte=t=>{let e=b(t.meta.get(\"baseURI\")),r=t.meta.get(\"referencingElement\");return new S.ObjectElement({$ref:e},$(r.meta),$(r.attributes))},yj=async t=>{let{spec:e,timeout:r,redirects:i,requestInterceptor:o,responseInterceptor:s,pathDiscriminator:n=[],allowMetaPatches:a=!1,useCircularStructures:p=!1,skipNormalization:l=!1,parameterMacro:u=null,modelPropertyMacro:f=null,mode:m=\"non-strict\",strategies:x}=t;try{let{cache:h}=yj,O=x.find(pe=>pe.match(e)),j=ae.isHttpUrl(ae.cwd())?ae.cwd():ko,v=Ks(t),E=ae.resolve(j,v),y;h.has(e)?y=h.get(e):(y=zt.refract(e),y.classes.push(\"result\"),h.set(e,y));let g=new Be([y]),q=Co(n),V=q===\"\"?\"\":`#${q}`,C=ke(y,q),oe=new He({uri:E,value:g}),M=new gt({refs:[oe]});q!==\"\"&&(M.rootRef=void 0);let te=[new Set([C])],H=[],k=await wf(C,{resolve:{baseURI:`${E}${V}`,resolvers:[new vc({timeout:r||1e4,redirects:i||10})],resolverOpts:{swaggerHTTPClientConfig:{requestInterceptor:o,responseInterceptor:s}},strategies:[new Am]},parse:{mediaType:ui.latest(),parsers:[new Rm({allowEmpty:!1,sourceMap:!1}),new _m({allowEmpty:!1,sourceMap:!1}),new Ec({allowEmpty:!1,sourceMap:!1}),new bc({allowEmpty:!1,sourceMap:!1}),new Pm({allowEmpty:!1,sourceMap:!1})]},dereference:{maxDepth:100,strategies:[new Tm({allowMetaPatches:a,useCircularStructures:p,parameterMacro:u,modelPropertyMacro:f,mode:m,ancestors:te})],refSet:M,dereferenceOpts:{errors:H},immutable:!1,circular:p?\"ignore\":\"replace\",circularReplacer:p?Kn.dereference.circularReplacer:Jte}}),W=Xl(C,k,y),Z=l?W:O.normalize(W);return{spec:b(Z),errors:H}}catch(h){if(h instanceof Jt)return{spec:e,errors:[]};throw h}};yj.cache=new WeakMap;var Mm=yj;var Hte=t=>{if(!ne(t))return t;let e=[rw({operationIdNormalizer:(i,o,s)=>wr({operationId:i},o,s,{v2OperationIdCompatibilityMode:!1})}),QO(),ZO(),iw(),ow()];return Xe(t,e,{toolboxCreator:bu,visitorOptions:{keyMap:Ct,nodeTypeGetter:ht}})},b2=t=>e=>{let r=zt.refract(e);r.classes.push(\"result\");let i=t(r),o=b(i);return Mm.cache.set(o,i),b(i)},gj=Hte;var zte={name:\"openapi-3-1-apidom\",match(t){return eu(t)},normalize(t){if(!Se(t)&&nt(t)&&!t.$$normalized){let e=b2(gj)(t);return e.$$normalized=!0,e}return Se(t)?gj(t):t},async resolve(t){return Mm(t)}},S2=zte;var Sn=class extends Yl{filterByFormat(e=\"generic\"){let r=e===\"generic\"?\"openapi;version\":e;return this.filter(i=>i.includes(r))}findBy(e=\"3.2.0\",r=\"generic\"){let i=r===\"generic\"?`vnd.oai.openapi;version=${e}`:`vnd.oai.openapi+${r};version=${e}`;return this.find(s=>s.includes(i))||this.unknownMediaType}latest(e=\"generic\"){return ar(this.filterByFormat(e))}},Kte=new Sn(\"application/vnd.oai.openapi;version=3.2.0\",\"application/vnd.oai.openapi+json;version=3.2.0\",\"application/vnd.oai.openapi+yaml;version=3.2.0\"),mo=Kte;var vj=class extends Di{},ys=vj;var Ej=class extends qi{get mediaTypes(){return this.get(\"mediaTypes\")}set mediaTypes(e){this.set(\"mediaTypes\",e)}},gs=Ej;var bj=class extends Vi{},vs=bj;var Sj=class extends cs{get defaultMapping(){return this.get(\"defaultMapping\")}set defaultMapping(e){this.set(\"defaultMapping\",e)}},Es=Sj;var Oj=class extends ls{get encoding(){return this.get(\"encoding\")}set encoding(e){this.set(\"encoding\",e)}get prefixEncoding(){return this.get(\"prefixEncoding\")}set prefixEncoding(e){this.set(\"prefixEncoding\",e)}get itemEncoding(){return this.get(\"itemEncoding\")}set itemEncoding(e){this.set(\"itemEncoding\",e)}},pa=Oj;var wj=class extends Li{get dataValue(){return this.get(\"dataValue\")}set dataValue(e){this.set(\"dataValue\",e)}get serializedValue(){return this.get(\"serializedValue\")}set serializedValue(e){this.set(\"serializedValue\",e)}},bs=wj;var jj=class extends Bi{},Ss=jj;var Pj=class extends Ui{get schema(){return this.get(\"schema\")}set schema(e){this.set(\"schema\",e)}},Os=Pj;var Aj=class extends Ji{},ws=Aj;var Rj=class t extends S.StringElement{static default=new t(\"https://spec.openapis.org/oas/3.2/dialect/2025-09-17\");constructor(e,r,i){super(e,r,i),this.element=\"jsonSchemaDialect\"}},ho=Rj;var _j=class extends zi{},js=_j;var Ij=class extends Ki{},Ps=Ij;var Cj=class extends Wi{get schema(){return this.get(\"schema\")}set schema(e){this.set(\"schema\",e)}get itemSchema(){return this.get(\"itemSchema\")}set itemSchema(e){this.set(\"itemSchema\",e)}get prefixEncoding(){return this.get(\"prefixEncoding\")}set prefixEncoding(e){this.set(\"prefixEncoding\",e)}get itemEncoding(){return this.get(\"itemEncoding\")}set itemEncoding(e){this.set(\"itemEncoding\",e)}},As=Cj;var Tj=class extends us{get deviceAuthorizationUrl(){return this.get(\"deviceAuthorizationUrl\")}set deviceAuthorizationUrl(e){this.set(\"deviceAuthorizationUrl\",e)}},fa=Tj;var Mj=class extends ps{get deviceAuthorization(){return this.get(\"deviceAuthorization\")}set deviceAuthorization(e){this.set(\"deviceAuthorization\",e)}},ma=Mj;var Fj=class extends fs{},da=Fj;var $j=class extends S.ObjectElement{constructor(e,r,i){super(e,r,i),this.element=\"openApi3_2\",this.classes.push(\"api\")}get openapi(){return this.get(\"openapi\")}set openapi(e){this.set(\"openapi\",e)}get info(){return this.get(\"info\")}set info(e){this.set(\"info\",e)}get jsonSchemaDialect(){return this.get(\"jsonSchemaDialect\")}set jsonSchemaDialect(e){this.set(\"jsonSchemaDialect\",e)}get servers(){return this.get(\"servers\")}set servers(e){this.set(\"servers\",e)}get $self(){return this.get(\"$self\")}set $self(e){this.set(\"$self\",e)}get paths(){return this.get(\"paths\")}set paths(e){this.set(\"paths\",e)}get components(){return this.get(\"components\")}set components(e){this.set(\"components\",e)}get security(){return this.get(\"security\")}set security(e){this.set(\"security\",e)}get tags(){return this.get(\"tags\")}set tags(e){this.set(\"tags\",e)}get externalDocs(){return this.get(\"externalDocs\")}set externalDocs(e){this.set(\"externalDocs\",e)}get webhooks(){return this.get(\"webhooks\")}set webhooks(e){this.set(\"webhooks\",e)}},Gt=$j;var Nj=class extends Fr{},xo=Nj;var kj=class extends Gi{get schema(){return this.get(\"schema\")}set schema(e){this.set(\"schema\",e)}},Rs=kj;var Dj=class extends Kt{get QUERY(){return this.get(\"query\")}set QUERY(e){this.set(\"query\",e)}get additionalOperations(){return this.get(\"additionalOperations\")}set additionalOperations(e){this.set(\"additionalOperations\",e)}},xr=Dj;var qj=class extends Yi{},_s=qj;var ju=class extends dr{};Object.defineProperty(ju.prototype,\"description\",{get(){return this.get(\"description\")},set(t){this.set(\"description\",t)},enumerable:!0});Object.defineProperty(ju.prototype,\"summary\",{get(){return this.get(\"summary\")},set(t){this.set(\"summary\",t)},enumerable:!0});var Nr=ju;var Vj=class extends Xi{},Is=Vj;var Lj=class extends Qi{get summary(){return this.get(\"summary\")}set summary(e){this.set(\"summary\",e)}},Cs=Lj;var Bj=class extends Zi{},Ts=Bj;var Uj=class extends It{},tr=Uj;var Jj=class extends co{},Ms=Jj;var Hj=class extends lo{get oauth2MetadataUrl(){return this.get(\"oauth2MetadataUrl\")}set oauth2MetadataUrl(e){this.set(\"oauth2MetadataUrl\",e)}get deprecated(){return this.get(\"deprecated\")}set deprecated(e){this.set(\"deprecated\",e)}},Fs=Hj;var zj=class extends uo{get name(){return this.get(\"name\")}set name(e){this.set(\"name\",e)}},$s=zj;var Kj=class extends po{},Ns=Kj;var Wj=class extends ds{get summary(){return this.get(\"summary\")}set summary(e){this.set(\"summary\",e)}get parentProp(){return this.get(\"parent\")}set parentProp(e){this.set(\"parent\",e)}get kind(){return this.get(\"kind\")}set kind(e){this.set(\"kind\",e)}},ha=Wj;var Gj=class extends hs{get nodeType(){return this.get(\"nodeType\")}set nodeType(e){this.set(\"nodeType\",e)}},xa=Gj;var Wte={namespace:t=>{let{base:e}=t;return e.register(\"callback\",ys),e.register(\"components\",gs),e.register(\"contact\",vs),e.register(\"discriminator\",Es),e.register(\"encoding\",pa),e.register(\"example\",bs),e.register(\"externalDocumentation\",Ss),e.register(\"header\",Os),e.register(\"info\",ws),e.register(\"jsonSchemaDialect\",ho),e.register(\"license\",js),e.register(\"link\",Ps),e.register(\"mediaType\",As),e.register(\"oAuthFlow\",fa),e.register(\"oAuthFlows\",ma),e.register(\"openapi\",da),e.register(\"openApi3_2\",Gt),e.register(\"operation\",xo),e.register(\"parameter\",Rs),e.register(\"pathItem\",xr),e.register(\"paths\",_s),e.register(\"reference\",Nr),e.register(\"requestBody\",Is),e.register(\"response\",Cs),e.register(\"responses\",Ts),e.register(\"schema\",tr),e.register(\"securityRequirement\",Ms),e.register(\"securityScheme\",Fs),e.register(\"server\",$s),e.register(\"serverVariable\",Ns),e.register(\"tag\",ha),e.register(\"xml\",xa),e}},ya=Wte;var Yj=class extends vu{},O2=Yj;var Xj=class t extends S.ObjectElement{static primaryClass=\"components-media-types\";constructor(e,r,i){super(e,r,i),this.classes.push(t.primaryClass)}},w2=Xj;var Qj=class extends Eu{},j2=Qj;var xt=t=>{if(Se(t))return`${t.element.charAt(0).toUpperCase()+t.element.slice(1)}Element`},Mt={CallbackElement:[\"content\"],ComponentsElement:[\"content\"],ContactElement:[\"content\"],DiscriminatorElement:[\"content\"],Encoding:[\"content\"],Example:[\"content\"],ExternalDocumentationElement:[\"content\"],HeaderElement:[\"content\"],InfoElement:[\"content\"],LicenseElement:[\"content\"],MediaTypeElement:[\"content\"],OAuthFlowElement:[\"content\"],OAuthFlowsElement:[\"content\"],OpenApi3_2Element:[\"content\"],OperationElement:[\"content\"],ParameterElement:[\"content\"],PathItemElement:[\"content\"],PathsElement:[\"content\"],ReferenceElement:[\"content\"],RequestBodyElement:[\"content\"],ResponseElement:[\"content\"],ResponsesElement:[\"content\"],SchemaElement:[\"content\"],SecurityRequirementElement:[\"content\"],SecuritySchemeElement:[\"content\"],ServerElement:[\"content\"],ServerVariableElement:[\"content\"],TagElement:[\"content\"],...ct};var Zj=class{internalStore;constructor(e,r,i){this.storageElement=e,this.storageField=r,this.storageSubField=i}get store(){if(!this.internalStore){let e=this.storageElement.get(this.storageField);ne(e)||(e=new S.ObjectElement,this.storageElement.set(this.storageField,e));let r=e.get(this.storageSubField);Pe(r)||(r=new S.ArrayElement,e.set(this.storageSubField,r)),this.internalStore=r}return this.internalStore}append(e){this.includes(e)||this.store.push(e)}includes(e){return this.store.includes(e)}},Fo=Zj;var Gte=({storageField:t=\"x-normalized\"}={})=>e=>{let{predicates:r,ancestorLineageToJSONPointer:i}=e,o=(a,p)=>!r.isParameterElement(a)||!r.isParameterElement(p)||!r.isStringElement(a.name)||!r.isStringElement(a.in)||!r.isStringElement(p.name)||!r.isStringElement(p.in)?!1:b(a.name)===b(p.name)&&b(a.in)===b(p.in),s=[],n;return{visitor:{OpenApi3_2Element:{enter(a){n=new Fo(a,t,\"parameters\")},leave(){n=void 0}},PathItemElement:{enter(a,p,l,u,f){if(f.some(r.isComponentsElement))return;let{parameters:m}=a;r.isArrayElement(m)?s.push([...m.content]):s.push([])},leave(){s.pop()}},OperationElement:{leave(a,p,l,u,f){let m=ar(s);if(!Array.isArray(m)||m.length===0)return;let x=i([...f,l,a]);if(n.includes(x))return;let h=Un([],[\"parameters\",\"content\"],a),O=Jo(o,[...h,...m]);a.parameters=new ns(O),n.append(x)}}}}},eP=Gte;var Yte=({storageField:t=\"x-normalized\"}={})=>e=>{let{predicates:r,ancestorLineageToJSONPointer:i}=e,o,s;return{visitor:{OpenApi3_2Element:{enter(n){s=new Fo(n,t,\"security-requirements\"),r.isArrayElement(n.security)&&(o=n.security)},leave(){s=void 0,o=void 0}},OperationElement:{leave(n,a,p,l,u){if(u.some(r.isComponentsElement))return;let f=i([...u,p,n]);if(s.includes(f))return;if(typeof n.security>\"u\"&&typeof o<\"u\"){var h;n.security=new as((h=o)===null||h===void 0?void 0:h.content),s.append(f)}}}}}},tP=Yte;var rP=t=>t.replace(/\\s/g,\"\"),iP=t=>t.replace(/\\W/gi,\"_\"),Xte=(t,e)=>{let r=iP(rP(e.toLowerCase())),i=iP(rP(t));return`${r}${i}`},Qte=(t,e,r)=>{let i=rP(t);return i.length>0?iP(i):Xte(e,r)},Zte=({storageField:t=\"x-normalized\",operationIdNormalizer:e=Qte}={})=>r=>{let{predicates:i,ancestorLineageToJSONPointer:o,namespace:s}=r,n=[],a=[],p=[],l;return{visitor:{OpenApi3_2Element:{enter(u){l=new Fo(u,t,\"operation-ids\")},leave(){let u=bl(f=>b(f.operationId),a);Object.entries(u).forEach(([f,m])=>{Array.isArray(m)&&(m.length<=1||m.forEach((x,h)=>{let O=`${f}${h+1}`;x.operationId=new s.elements.String(O)}))}),p.forEach(f=>{if(typeof f.operationId>\"u\")return;let m=String(b(f.operationId)),x=a.find(h=>b(h.meta.get(\"originalOperationId\"))===m);typeof x>\"u\"||(f.operationId=$.safe(x.operationId),f.meta.set(\"originalOperationId\",m),f.set(\"__originalOperationId\",m))}),a.length=0,p.length=0,l=void 0}},PathItemElement:{enter(u){let f=nr(\"path\",b(u.meta.get(\"path\")));n.push(f)},leave(){n.pop()}},OperationElement:{enter(u,f,m,x,h){if(typeof u.operationId>\"u\")return;let O=o([...h,m,u]);if(l.includes(O))return;let j=String(b(u.operationId)),v=ar(n),E=nr(\"method\",b(u.meta.get(\"http-method\"))),y=e(j,v,E);j!==y&&(u.operationId=new s.elements.String(y),u.set(\"__originalOperationId\",j),u.meta.set(\"originalOperationId\",j),a.push(u),l.append(O))}},LinkElement:{leave(u){i.isLinkElement(u)&&(typeof u.operationId>\"u\"||p.push(u))}}}}},oP=Zte;var ere=({storageField:t=\"x-normalized\"}={})=>e=>{let{predicates:r,ancestorLineageToJSONPointer:i}=e,o;return{visitor:{OpenApi3_2Element:{enter(s){o=new Fo(s,t,\"parameter-examples\")},leave(){o=void 0}},ParameterElement:{leave(s,n,a,p,l){var u,f;if(l.some(r.isComponentsElement)||typeof s.schema>\"u\"||!r.isSchemaElement(s.schema)||typeof((u=s.schema)===null||u===void 0?void 0:u.example)>\"u\"&&typeof((f=s.schema)===null||f===void 0?void 0:f.examples)>\"u\")return;let m=i([...l,a,s]);if(!o.includes(m)){if(typeof s.examples<\"u\"&&r.isObjectElement(s.examples)){let x=s.examples.map(h=>$.safe(h.value));typeof s.schema.examples<\"u\"&&(s.schema.set(\"examples\",x),o.append(m)),typeof s.schema.example<\"u\"&&(s.schema.set(\"example\",x[0]),o.append(m));return}typeof s.example<\"u\"&&(typeof s.schema.examples<\"u\"&&(s.schema.set(\"examples\",[$(s.example)]),o.append(m)),typeof s.schema.example<\"u\"&&(s.schema.set(\"example\",$(s.example)),o.append(m)))}}}}}},sP=ere;var tre=({storageField:t=\"x-normalized\"}={})=>e=>{let{predicates:r,ancestorLineageToJSONPointer:i}=e,o;return{visitor:{OpenApi3_2Element:{enter(s){o=new Fo(s,t,\"header-examples\")},leave(){o=void 0}},HeaderElement:{leave(s,n,a,p,l){var u,f;if(l.some(r.isComponentsElement)||typeof s.schema>\"u\"||!r.isSchemaElement(s.schema)||typeof((u=s.schema)===null||u===void 0?void 0:u.example)>\"u\"&&typeof((f=s.schema)===null||f===void 0?void 0:f.examples)>\"u\")return;let m=i([...l,a,s]);if(!o.includes(m)){if(typeof s.examples<\"u\"&&r.isObjectElement(s.examples)){let x=s.examples.map(h=>$.safe(h.value));typeof s.schema.examples<\"u\"&&(s.schema.set(\"examples\",x),o.append(m)),typeof s.schema.example<\"u\"&&(s.schema.set(\"example\",x[0]),o.append(m));return}typeof s.example<\"u\"&&(typeof s.schema.examples<\"u\"&&(s.schema.set(\"examples\",[$(s.example)]),o.append(m)),typeof s.schema.example<\"u\"&&(s.schema.set(\"example\",$(s.example)),o.append(m)))}}}}}},nP=tre;var aP={};vr(aP,{isBooleanJsonSchemaElement:()=>jc,isCallbackElement:()=>P2,isComponentsElement:()=>A2,isContactElement:()=>R2,isDiscriminatorElement:()=>rre,isExampleElement:()=>_2,isExternalDocumentationElement:()=>I2,isHeaderElement:()=>ire,isInfoElement:()=>C2,isJsonSchemaDialectElement:()=>Fm,isLicenseElement:()=>T2,isLinkElement:()=>M2,isMediaTypeElement:()=>z2,isOpenApi3_2Element:()=>wc,isOpenapiElement:()=>F2,isOperationElement:()=>$m,isParameterElement:()=>$2,isPathItemElement:()=>yo,isPathItemElementExternal:()=>N2,isPathsElement:()=>k2,isReferenceElement:()=>yr,isReferenceElementExternal:()=>D2,isRequestBodyElement:()=>q2,isResponseElement:()=>V2,isResponsesElement:()=>L2,isSchemaElement:()=>Ft,isSecurityRequirementElement:()=>B2,isSecuritySchemeElement:()=>U2,isServerElement:()=>J2,isServerVariableElement:()=>H2});var P2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof ys||t(i)&&e(\"callback\",i)&&r(\"object\",i)),A2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof gs||t(i)&&e(\"components\",i)&&r(\"object\",i)),R2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof vs||t(i)&&e(\"contact\",i)&&r(\"object\",i)),rre=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Es||t(i)&&e(\"discriminator\",i)&&r(\"object\",i)),_2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof bs||t(i)&&e(\"example\",i)&&r(\"object\",i)),I2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ss||t(i)&&e(\"externalDocumentation\",i)&&r(\"object\",i)),ire=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Os||t(i)&&e(\"header\",i)&&r(\"object\",i)),C2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof ws||t(i)&&e(\"info\",i)&&r(\"object\",i)),Fm=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof ho||t(i)&&e(\"jsonSchemaDialect\",i)&&r(\"string\",i)),T2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof js||t(i)&&e(\"license\",i)&&r(\"object\",i)),M2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ps||t(i)&&e(\"link\",i)&&r(\"object\",i)),F2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof da||t(i)&&e(\"openapi\",i)&&r(\"string\",i)),wc=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r,hasClass:i})=>o=>o instanceof Gt||t(o)&&e(\"openApi3_2\",o)&&r(\"object\",o)&&i(\"api\",o)),$m=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof xo||t(i)&&e(\"operation\",i)&&r(\"object\",i)),$2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Rs||t(i)&&e(\"parameter\",i)&&r(\"object\",i)),yo=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof xr||t(i)&&e(\"pathItem\",i)&&r(\"object\",i)),N2=t=>{if(!yo(t)||!z(t.$ref))return!1;let e=b(t.$ref);return typeof e==\"string\"&&e.length>0&&!e.startsWith(\"#\")},k2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof _s||t(i)&&e(\"paths\",i)&&r(\"object\",i)),yr=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Nr||t(i)&&e(\"reference\",i)&&r(\"object\",i)),D2=t=>{if(!yr(t)||!z(t.$ref))return!1;let e=b(t.$ref);return typeof e==\"string\"&&e.length>0&&!e.startsWith(\"#\")},q2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Is||t(i)&&e(\"requestBody\",i)&&r(\"object\",i)),V2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Cs||t(i)&&e(\"response\",i)&&r(\"object\",i)),L2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ts||t(i)&&e(\"responses\",i)&&r(\"object\",i)),Ft=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof tr||t(i)&&e(\"schema\",i)&&r(\"object\",i)),jc=t=>Br(t)&&t.classes.includes(\"boolean-json-schema\"),B2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ms||t(i)&&e(\"securityRequirement\",i)&&r(\"object\",i)),U2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Fs||t(i)&&e(\"securityScheme\",i)&&r(\"object\",i)),J2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof $s||t(i)&&e(\"server\",i)&&r(\"object\",i)),H2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof Ns||t(i)&&e(\"serverVariable\",i)&&r(\"object\",i)),z2=B(({hasBasicElementProps:t,isElementType:e,primitiveEq:r})=>i=>i instanceof As||t(i)&&e(\"mediaType\",i)&&r(\"object\",i));var ore=t=>{let e=t.reduce((r,i,o)=>{if(Ue(i)){let s=String(b(i.key));r.push(s)}else if(Pe(t[o-2])){let s=String(t[o-2].content.indexOf(i));r.push(s)}return r},[]);return Co(e)},sre=()=>{let t=Ye(ya);return{predicates:{...aP,isElement:Se,isStringElement:z,isArrayElement:Pe,isObjectElement:ne,isMemberElement:Ue,isServersElement:mn,includesClasses:At,hasElementSourceMap:Or},ancestorLineageToJSONPointer:ore,namespace:t}},Pu=sre;var cP=class extends P(se,A){constructor(e){super(e),this.element=new Gt,this.specPath=J([\"document\",\"objects\",\"OpenApi\"]),this.canSupportSpecificationExtensions=!0,this.openApiSemanticElement=this.element}ObjectElement(e){return this.openApiGenericElement=e,se.prototype.ObjectElement.call(this,e)}},K2=cP;var nre=I.visitors.document.objects.Info.$visitor,lP=class extends nre{constructor(e){super(e),this.element=new ws}},W2=lP;var are=I.visitors.document.objects.Contact.$visitor,uP=class extends are{constructor(e){super(e),this.element=new vs}},G2=uP;var cre=I.visitors.document.objects.License.$visitor,pP=class extends cre{constructor(e){super(e),this.element=new js}},Y2=pP;var lre=I.visitors.document.objects.Link.$visitor,fP=class extends lre{constructor(e){super(e),this.element=new Ps}},X2=fP;var mP=class extends P(ze,A){StringElement(e){let r=new ho(b(e));return this.copyMetaAndAttributes(e,r),this.element=r,ce}},Q2=mP;var ure=I.visitors.document.objects.Server.$visitor,dP=class extends ure{constructor(e){super(e),this.element=new $s}},Z2=dP;var pre=I.visitors.document.objects.ServerVariable.$visitor,hP=class extends pre{constructor(e){super(e),this.element=new Ns}},eB=hP;var fre=I.visitors.document.objects.MediaType.$visitor,xP=class extends fre{constructor(e){super(e),this.element=new As}},tB=xP;var mre=I.visitors.document.objects.SecurityRequirement.$visitor,yP=class extends mre{constructor(e){super(e),this.element=new Ms}},rB=yP;var dre=I.visitors.document.objects.Components.$visitor,gP=class extends dre{constructor(e){super(e),this.element=new gs}},iB=gP;var hre=I.visitors.document.objects.Tag.$visitor,vP=class extends hre{constructor(e){super(e),this.element=new ha}},oB=vP;var xre=I.visitors.document.objects.Reference.$visitor,EP=class extends xre{constructor(e){super(e),this.element=new Nr}},sB=EP;var yre=I.visitors.document.objects.Parameter.$visitor,bP=class extends yre{constructor(e){super(e),this.element=new Rs}},nB=bP;var gre=I.visitors.document.objects.Header.$visitor,SP=class extends gre{constructor(e){super(e),this.element=new Os}},aB=SP;var OP=class extends P(se,Ee,A){constructor(e){super(e),this.element=new tr,this.specPath=J([\"document\",\"objects\",\"Schema\"]),this.canSupportSpecificationExtensions=!0,this.jsonSchemaDefaultDialect=ho.default,this.passingOptionsNames.push(\"parent\")}ObjectElement(e){this.handleDialectIdentifier(e),this.handleSchemaIdentifier(e),this.parent=this.element;let r=se.prototype.ObjectElement.call(this,e);return z(this.element.$ref)&&(this.element.classes.push(\"reference-element\"),this.element.setMetaProperty(\"referenced-element\",\"schema\")),r}BooleanElement(e){return We.prototype.BooleanElement.call(this,e)}get defaultDialectIdentifier(){let e;return this.openApiSemanticElement!==void 0&&Fm(this.openApiSemanticElement.jsonSchemaDialect)?e=b(this.openApiSemanticElement.jsonSchemaDialect):this.openApiGenericElement!==void 0&&z(this.openApiGenericElement.get(\"jsonSchemaDialect\"))?e=b(this.openApiGenericElement.get(\"jsonSchemaDialect\")):e=b(this.jsonSchemaDefaultDialect),e}handleDialectIdentifier(e){return We.prototype.handleDialectIdentifier.call(this,e)}handleSchemaIdentifier(e){return We.prototype.handleSchemaIdentifier.call(this,e)}},cB=OP;var wP=class extends hn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},lB=wP;var jP=class extends xn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},uB=jP;var PP=class extends yn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},pB=PP;var AP=class extends gn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},fB=AP;var RP=class extends vn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},mB=RP;var _P=class extends na{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},dB=_P;var IP=class extends En{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},hB=IP;var CP=class extends bn{constructor(e){super(e),this.passingOptionsNames.push(\"parent\")}},xB=CP;var vre=I.visitors.document.objects.Discriminator.$visitor,TP=class extends vre{constructor(e){super(e),this.element=new Es,this.canSupportSpecificationExtensions=!0}},yB=TP;var Ere=I.visitors.document.objects.XML.$visitor,MP=class extends Ere{constructor(e){super(e),this.element=new xa}},gB=MP;var FP=class extends P(Q,A){constructor(e){super(e),this.element=new ss,this.specPath=J([\"document\",\"objects\",\"Schema\"])}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(Ft).forEach((i,o)=>{i.setMetaProperty(\"schemaName\",b(o))}),r}},vB=FP;var $P=class extends P(Q,A){constructor(e){super(e),this.element=new O2,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"PathItem\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(yr).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"pathItem\")}),r}},EB=$P;var NP=class extends P(Q,A){constructor(e){super(e),this.element=new w2,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"MediaType\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(yr).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"mediaType\")}),r}},bB=NP;var kP=class extends P(Q,A){constructor(e){super(e),this.element=new S.ObjectElement,this.specPath=J([\"document\",\"objects\",\"Operation\"])}},SB=kP;var bre=I.visitors.document.objects.Example.$visitor,DP=class extends bre{constructor(e){super(e),this.element=new bs}},OB=DP;var Sre=I.visitors.document.objects.ExternalDocumentation.$visitor,qP=class extends Sre{constructor(e){super(e),this.element=new Ss}},wB=qP;var Ore=I.visitors.document.objects.Encoding.$visitor,VP=class extends Ore{constructor(e){super(e),this.element=new pa}},jB=VP;var wre=I.visitors.document.objects.Paths.$visitor,LP=class extends wre{constructor(e){super(e),this.element=new _s}},PB=LP;var jre=I.visitors.document.objects.RequestBody.$visitor,BP=class extends jre{constructor(e){super(e),this.element=new Is}},AB=BP;var UP=class extends P(Q,A){constructor(e){super(e),this.element=new ra,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"MediaType\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(yr).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"mediaType\")}),r}},RB=UP;var Pre=I.visitors.document.objects.Callback.$visitor,JP=class extends Pre{constructor(e){super(e),this.element=new ys,this.specPath=J([\"document\",\"objects\",\"PathItem\"])}},_B=JP;var Are=I.visitors.document.objects.Response.$visitor,HP=class extends Are{constructor(e){super(e),this.element=new Cs}},IB=HP;var zP=class extends P(Q,A){constructor(e){super(e),this.element=new ia,this.specPath=r=>ue(r)?[\"document\",\"objects\",\"Reference\"]:[\"document\",\"objects\",\"MediaType\"]}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(yr).forEach(i=>{i.setMetaProperty(\"referenced-element\",\"mediaType\")}),r}},CB=zP;var Rre=I.visitors.document.objects.Responses.$visitor,KP=class extends Rre{constructor(e){super(e),this.element=new Ts}},TB=KP;var _re=I.visitors.document.objects.Operation.$visitor,WP=class extends _re{constructor(e){super(e),this.element=new xo}},MB=WP;var Ire=I.visitors.document.objects.PathItem.$visitor,GP=class extends Ire{constructor(e){super(e),this.element=new xr}},FB=GP;var Cre=I.visitors.document.objects.SecurityScheme.$visitor,YP=class extends Cre{constructor(e){super(e),this.element=new Fs}},$B=YP;var Tre=I.visitors.document.objects.OAuthFlows.$visitor,XP=class extends Tre{constructor(e){super(e),this.element=new ma}},NB=XP;var Mre=I.visitors.document.objects.OAuthFlow.$visitor,QP=class extends Mre{constructor(e){super(e),this.element=new fa}},kB=QP;var ZP=class extends P(Q,A){constructor(e){super(e),this.element=new j2,this.specPath=J([\"document\",\"objects\",\"PathItem\"])}ObjectElement(e){let r=Q.prototype.ObjectElement.call(this,e);return this.element.filter(yo).forEach((i,o)=>{i.setMetaProperty(\"webhook-name\",b(o))}),r}},DB=ZP;var{JSONSchema:Fre,LinkDescription:$re}=aa.visitors.document.objects,Nre={visitors:{value:I.visitors.value,document:{objects:{OpenApi:{$visitor:K2,fixedFields:{openapi:I.visitors.document.objects.OpenApi.fixedFields.openapi,info:{$ref:\"#/visitors/document/objects/Info\"},jsonSchemaDialect:Q2,servers:I.visitors.document.objects.OpenApi.fixedFields.servers,$self:{$ref:\"#/visitors/value\"},paths:{$ref:\"#/visitors/document/objects/Paths\"},webhooks:DB,components:{$ref:\"#/visitors/document/objects/Components\"},security:I.visitors.document.objects.OpenApi.fixedFields.security,tags:I.visitors.document.objects.OpenApi.fixedFields.tags,externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"}}},Info:{$visitor:W2,fixedFields:{title:I.visitors.document.objects.Info.fixedFields.title,description:I.visitors.document.objects.Info.fixedFields.description,summary:{$ref:\"#/visitors/value\"},termsOfService:I.visitors.document.objects.Info.fixedFields.termsOfService,contact:{$ref:\"#/visitors/document/objects/Contact\"},license:{$ref:\"#/visitors/document/objects/License\"},version:I.visitors.document.objects.Info.fixedFields.version}},Contact:{$visitor:G2,fixedFields:{name:I.visitors.document.objects.Contact.fixedFields.name,url:I.visitors.document.objects.Contact.fixedFields.url,email:I.visitors.document.objects.Contact.fixedFields.email}},License:{$visitor:Y2,fixedFields:{name:I.visitors.document.objects.License.fixedFields.name,identifier:{$ref:\"#/visitors/value\"},url:I.visitors.document.objects.License.fixedFields.url}},Server:{$visitor:Z2,fixedFields:{url:I.visitors.document.objects.Server.fixedFields.url,description:I.visitors.document.objects.Server.fixedFields.description,variables:I.visitors.document.objects.Server.fixedFields.variables,name:{$ref:\"#/visitors/value\"}}},ServerVariable:{$visitor:eB,fixedFields:{enum:I.visitors.document.objects.ServerVariable.fixedFields.enum,default:I.visitors.document.objects.ServerVariable.fixedFields.default,description:I.visitors.document.objects.ServerVariable.fixedFields.description}},Components:{$visitor:iB,fixedFields:{schemas:vB,responses:I.visitors.document.objects.Components.fixedFields.responses,parameters:I.visitors.document.objects.Components.fixedFields.parameters,examples:I.visitors.document.objects.Components.fixedFields.examples,requestBodies:I.visitors.document.objects.Components.fixedFields.requestBodies,headers:I.visitors.document.objects.Components.fixedFields.headers,securitySchemes:I.visitors.document.objects.Components.fixedFields.securitySchemes,links:I.visitors.document.objects.Components.fixedFields.links,callbacks:I.visitors.document.objects.Components.fixedFields.callbacks,pathItems:EB,mediaTypes:bB}},Paths:{$visitor:PB},PathItem:{$visitor:FB,fixedFields:{$ref:I.visitors.document.objects.PathItem.fixedFields.$ref,summary:I.visitors.document.objects.PathItem.fixedFields.summary,description:I.visitors.document.objects.PathItem.fixedFields.description,get:{$ref:\"#/visitors/document/objects/Operation\"},put:{$ref:\"#/visitors/document/objects/Operation\"},post:{$ref:\"#/visitors/document/objects/Operation\"},delete:{$ref:\"#/visitors/document/objects/Operation\"},options:{$ref:\"#/visitors/document/objects/Operation\"},head:{$ref:\"#/visitors/document/objects/Operation\"},patch:{$ref:\"#/visitors/document/objects/Operation\"},trace:{$ref:\"#/visitors/document/objects/Operation\"},query:{$ref:\"#/visitors/document/objects/Operation\"},servers:I.visitors.document.objects.PathItem.fixedFields.servers,parameters:I.visitors.document.objects.PathItem.fixedFields.parameters,additionalOperations:SB}},Operation:{$visitor:MB,fixedFields:{tags:I.visitors.document.objects.Operation.fixedFields.tags,summary:I.visitors.document.objects.Operation.fixedFields.summary,description:I.visitors.document.objects.Operation.fixedFields.description,externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"},operationId:I.visitors.document.objects.Operation.fixedFields.operationId,parameters:I.visitors.document.objects.Operation.fixedFields.parameters,requestBody:I.visitors.document.objects.Operation.fixedFields.requestBody,responses:{$ref:\"#/visitors/document/objects/Responses\"},callbacks:I.visitors.document.objects.Operation.fixedFields.callbacks,deprecated:I.visitors.document.objects.Operation.fixedFields.deprecated,security:I.visitors.document.objects.Operation.fixedFields.security,servers:I.visitors.document.objects.Operation.fixedFields.servers}},ExternalDocumentation:{$visitor:wB,fixedFields:{description:I.visitors.document.objects.ExternalDocumentation.fixedFields.description,url:I.visitors.document.objects.ExternalDocumentation.fixedFields.url}},Parameter:{$visitor:nB,fixedFields:{name:I.visitors.document.objects.Parameter.fixedFields.name,in:I.visitors.document.objects.Parameter.fixedFields.in,description:I.visitors.document.objects.Parameter.fixedFields.description,required:I.visitors.document.objects.Parameter.fixedFields.required,deprecated:I.visitors.document.objects.Parameter.fixedFields.deprecated,allowEmptyValue:I.visitors.document.objects.Parameter.fixedFields.allowEmptyValue,style:I.visitors.document.objects.Parameter.fixedFields.style,explode:I.visitors.document.objects.Parameter.fixedFields.explode,allowReserved:I.visitors.document.objects.Parameter.fixedFields.allowReserved,schema:{$ref:\"#/visitors/document/objects/Schema\"},example:I.visitors.document.objects.Parameter.fixedFields.example,examples:I.visitors.document.objects.Parameter.fixedFields.examples,content:I.visitors.document.objects.Parameter.fixedFields.content}},RequestBody:{$visitor:AB,fixedFields:{description:I.visitors.document.objects.RequestBody.fixedFields.description,content:RB,required:I.visitors.document.objects.RequestBody.fixedFields.required}},MediaType:{$visitor:tB,fixedFields:{schema:{$ref:\"#/visitors/document/objects/Schema\"},example:I.visitors.document.objects.MediaType.fixedFields.example,examples:I.visitors.document.objects.MediaType.fixedFields.examples,encoding:I.visitors.document.objects.MediaType.fixedFields.encoding,itemSchema:{$ref:\"#/visitors/document/objects/Schema\"},prefixEncoding:{$ref:\"#/visitors/value\"},itemEncoding:{$ref:\"#/visitors/document/objects/Encoding\"}}},Encoding:{$visitor:jB,fixedFields:{contentType:I.visitors.document.objects.Encoding.fixedFields.contentType,headers:I.visitors.document.objects.Encoding.fixedFields.headers,style:I.visitors.document.objects.Encoding.fixedFields.style,explode:I.visitors.document.objects.Encoding.fixedFields.explode,allowReserved:I.visitors.document.objects.Encoding.fixedFields.allowReserved,encoding:I.visitors.document.objects.MediaType.fixedFields.encoding,prefixEncoding:{$ref:\"#/visitors/value\"},itemEncoding:{$ref:\"#/visitors/document/objects/Encoding\"}}},Responses:{$visitor:TB,fixedFields:{default:I.visitors.document.objects.Responses.fixedFields.default}},Response:{$visitor:IB,fixedFields:{description:I.visitors.document.objects.Response.fixedFields.description,headers:I.visitors.document.objects.Response.fixedFields.headers,content:CB,links:I.visitors.document.objects.Response.fixedFields.links}},Callback:{$visitor:_B},Example:{$visitor:OB,fixedFields:{summary:I.visitors.document.objects.Example.fixedFields.summary,description:I.visitors.document.objects.Example.fixedFields.description,value:I.visitors.document.objects.Example.fixedFields.value,externalValue:I.visitors.document.objects.Example.fixedFields.externalValue,dataValue:{$ref:\"#/visitors/value\"},serializedValue:{$ref:\"#/visitors/value\"}}},Link:{$visitor:X2,fixedFields:{operationRef:I.visitors.document.objects.Link.fixedFields.operationRef,operationId:I.visitors.document.objects.Link.fixedFields.operationId,parameters:I.visitors.document.objects.Link.fixedFields.parameters,requestBody:I.visitors.document.objects.Link.fixedFields.requestBody,description:I.visitors.document.objects.Link.fixedFields.description,server:{$ref:\"#/visitors/document/objects/Server\"}}},Header:{$visitor:aB,fixedFields:{description:I.visitors.document.objects.Header.fixedFields.description,required:I.visitors.document.objects.Header.fixedFields.required,deprecated:I.visitors.document.objects.Header.fixedFields.deprecated,allowEmptyValue:I.visitors.document.objects.Header.fixedFields.allowEmptyValue,style:I.visitors.document.objects.Header.fixedFields.style,explode:I.visitors.document.objects.Header.fixedFields.explode,allowReserved:I.visitors.document.objects.Header.fixedFields.allowReserved,schema:{$ref:\"#/visitors/document/objects/Schema\"},example:I.visitors.document.objects.Header.fixedFields.example,examples:I.visitors.document.objects.Header.fixedFields.examples,content:I.visitors.document.objects.Header.fixedFields.content}},Tag:{$visitor:oB,fixedFields:{name:I.visitors.document.objects.Tag.fixedFields.name,description:I.visitors.document.objects.Tag.fixedFields.description,externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"},summary:{$ref:\"#/visitors/value\"},parent:{$ref:\"#/visitors/value\"},kind:{$ref:\"#/visitors/value\"}}},Reference:{$visitor:sB,fixedFields:{$ref:I.visitors.document.objects.Reference.fixedFields.$ref,summary:{$ref:\"#/visitors/value\"},description:{$ref:\"#/visitors/value\"}}},JSONSchema:{$ref:\"#/visitors/document/objects/Schema\"},LinkDescription:{...$re},Schema:{$visitor:cB,fixedFields:{...Fre.fixedFields,$defs:lB,allOf:uB,anyOf:pB,oneOf:fB,not:{$ref:\"#/visitors/document/objects/Schema\"},if:{$ref:\"#/visitors/document/objects/Schema\"},then:{$ref:\"#/visitors/document/objects/Schema\"},else:{$ref:\"#/visitors/document/objects/Schema\"},dependentSchemas:mB,prefixItems:dB,items:{$ref:\"#/visitors/document/objects/Schema\"},contains:{$ref:\"#/visitors/document/objects/Schema\"},properties:hB,patternProperties:xB,additionalProperties:{$ref:\"#/visitors/document/objects/Schema\"},propertyNames:{$ref:\"#/visitors/document/objects/Schema\"},unevaluatedItems:{$ref:\"#/visitors/document/objects/Schema\"},unevaluatedProperties:{$ref:\"#/visitors/document/objects/Schema\"},contentSchema:{$ref:\"#/visitors/document/objects/Schema\"},discriminator:{$ref:\"#/visitors/document/objects/Discriminator\"},xml:{$ref:\"#/visitors/document/objects/XML\"},externalDocs:{$ref:\"#/visitors/document/objects/ExternalDocumentation\"},example:{$ref:\"#/visitors/value\"}}},Discriminator:{$visitor:yB,fixedFields:{propertyName:I.visitors.document.objects.Discriminator.fixedFields.propertyName,mapping:I.visitors.document.objects.Discriminator.fixedFields.mapping,defaultMapping:{$ref:\"#/visitors/value\"}}},XML:{$visitor:gB,fixedFields:{name:I.visitors.document.objects.XML.fixedFields.name,namespace:I.visitors.document.objects.XML.fixedFields.namespace,prefix:I.visitors.document.objects.XML.fixedFields.prefix,attribute:I.visitors.document.objects.XML.fixedFields.attribute,wrapped:I.visitors.document.objects.XML.fixedFields.wrapped}},SecurityScheme:{$visitor:$B,fixedFields:{type:I.visitors.document.objects.SecurityScheme.fixedFields.type,description:I.visitors.document.objects.SecurityScheme.fixedFields.description,name:I.visitors.document.objects.SecurityScheme.fixedFields.name,in:I.visitors.document.objects.SecurityScheme.fixedFields.in,scheme:I.visitors.document.objects.SecurityScheme.fixedFields.scheme,bearerFormat:I.visitors.document.objects.SecurityScheme.fixedFields.bearerFormat,flows:{$ref:\"#/visitors/document/objects/OAuthFlows\"},openIdConnectUrl:I.visitors.document.objects.SecurityScheme.fixedFields.openIdConnectUrl,oauth2MetadataUrl:{$ref:\"#/visitors/value\"}}},OAuthFlows:{$visitor:NB,fixedFields:{implicit:{$ref:\"#/visitors/document/objects/OAuthFlow\"},password:{$ref:\"#/visitors/document/objects/OAuthFlow\"},clientCredentials:{$ref:\"#/visitors/document/objects/OAuthFlow\"},authorizationCode:{$ref:\"#/visitors/document/objects/OAuthFlow\"},deviceAuthorization:{$ref:\"#/visitors/document/objects/OAuthFlow\"}}},OAuthFlow:{$visitor:kB,fixedFields:{authorizationUrl:I.visitors.document.objects.OAuthFlow.fixedFields.authorizationUrl,tokenUrl:I.visitors.document.objects.OAuthFlow.fixedFields.tokenUrl,refreshUrl:I.visitors.document.objects.OAuthFlow.fixedFields.refreshUrl,scopes:I.visitors.document.objects.OAuthFlow.fixedFields.scopes}},SecurityRequirement:{$visitor:rB}},extension:{$visitor:I.visitors.document.extension.$visitor}}}},qB=Nre;var kre=(t,{specPath:e=[\"visitors\",\"document\",\"objects\",\"OpenApi\",\"$visitor\"],plugins:r=[]}={})=>{let i=(0,Ne.refract)(t),o=Rt(qB),s=Te(e,o),n=new s({specObj:o});return ve(i,n),Xe(n.element,r,{toolboxCreator:Pu,visitorOptions:{keyMap:Mt,nodeTypeGetter:xt}})},$e=t=>(e,r={})=>kre(e,{specPath:t,...r});ys.refract=$e([\"visitors\",\"document\",\"objects\",\"Callback\",\"$visitor\"]);gs.refract=$e([\"visitors\",\"document\",\"objects\",\"Components\",\"$visitor\"]);vs.refract=$e([\"visitors\",\"document\",\"objects\",\"Contact\",\"$visitor\"]);bs.refract=$e([\"visitors\",\"document\",\"objects\",\"Example\",\"$visitor\"]);Es.refract=$e([\"visitors\",\"document\",\"objects\",\"Discriminator\",\"$visitor\"]);pa.refract=$e([\"visitors\",\"document\",\"objects\",\"Encoding\",\"$visitor\"]);Ss.refract=$e([\"visitors\",\"document\",\"objects\",\"ExternalDocumentation\",\"$visitor\"]);Os.refract=$e([\"visitors\",\"document\",\"objects\",\"Header\",\"$visitor\"]);ws.refract=$e([\"visitors\",\"document\",\"objects\",\"Info\",\"$visitor\"]);ho.refract=$e([\"visitors\",\"document\",\"objects\",\"OpenApi\",\"fixedFields\",\"jsonSchemaDialect\"]);js.refract=$e([\"visitors\",\"document\",\"objects\",\"License\",\"$visitor\"]);Ps.refract=$e([\"visitors\",\"document\",\"objects\",\"Link\",\"$visitor\"]);As.refract=$e([\"visitors\",\"document\",\"objects\",\"MediaType\",\"$visitor\"]);fa.refract=$e([\"visitors\",\"document\",\"objects\",\"OAuthFlow\",\"$visitor\"]);ma.refract=$e([\"visitors\",\"document\",\"objects\",\"OAuthFlows\",\"$visitor\"]);da.refract=$e([\"visitors\",\"document\",\"objects\",\"OpenApi\",\"fixedFields\",\"openapi\"]);Gt.refract=$e([\"visitors\",\"document\",\"objects\",\"OpenApi\",\"$visitor\"]);xo.refract=$e([\"visitors\",\"document\",\"objects\",\"Operation\",\"$visitor\"]);Rs.refract=$e([\"visitors\",\"document\",\"objects\",\"Parameter\",\"$visitor\"]);xr.refract=$e([\"visitors\",\"document\",\"objects\",\"PathItem\",\"$visitor\"]);_s.refract=$e([\"visitors\",\"document\",\"objects\",\"Paths\",\"$visitor\"]);Nr.refract=$e([\"visitors\",\"document\",\"objects\",\"Reference\",\"$visitor\"]);Is.refract=$e([\"visitors\",\"document\",\"objects\",\"RequestBody\",\"$visitor\"]);Cs.refract=$e([\"visitors\",\"document\",\"objects\",\"Response\",\"$visitor\"]);Ts.refract=$e([\"visitors\",\"document\",\"objects\",\"Responses\",\"$visitor\"]);tr.refract=$e([\"visitors\",\"document\",\"objects\",\"Schema\",\"$visitor\"]);Ms.refract=$e([\"visitors\",\"document\",\"objects\",\"SecurityRequirement\",\"$visitor\"]);Fs.refract=$e([\"visitors\",\"document\",\"objects\",\"SecurityScheme\",\"$visitor\"]);$s.refract=$e([\"visitors\",\"document\",\"objects\",\"Server\",\"$visitor\"]);Ns.refract=$e([\"visitors\",\"document\",\"objects\",\"ServerVariable\",\"$visitor\"]);ha.refract=$e([\"visitors\",\"document\",\"objects\",\"Tag\",\"$visitor\"]);xa.refract=$e([\"visitors\",\"document\",\"objects\",\"XML\",\"$visitor\"]);var eA=Le(Er());var tA=class extends mr{detectionRegExp=/\"openapi\"\\s*:\\s*\"(?<version_json>3\\.2\\.(?:[1-9]\\d*|0))\"/;constructor(e={}){super({name:\"openapi-json-3-2-swagger-client\",mediaTypes:new Sn(...mo.filterByFormat(\"generic\"),...mo.filterByFormat(\"json\")),...e})}async canParse(e){var r,i;let o=this.fileExtensions.length===0?!0:(0,eA.default)(r=this.fileExtensions).call(r,e.extension),s=(0,eA.default)(i=this.mediaTypes).call(i,e.mediaType);if(!o)return!1;if(s)return!0;if(!s)try{let n=e.toString();return JSON.parse(n),this.detectionRegExp.test(n)}catch{return!1}return!1}async parse(e){if(this.sourceMap)throw new lt(\"openapi-json-3-2-swagger-client parser plugin doesn't support sourceMaps option\");let r=new Be,i=e.toString();if(this.allowEmpty&&i.trim()===\"\")return r;try{let o=JSON.parse(i),s=Gt.refract(o,this.refractorOpts);return s.classes.push(\"result\"),r.push(s),r}catch(o){throw new lt(`Error parsing \"${e.uri}\"`,{cause:o})}}},Nm=tA;var rA=Le(Er());var iA=class extends mr{detectionRegExp=/(?<YAML>^([\"']?)openapi\\2\\s*:\\s*([\"']?)(?<version_yaml>3\\.2\\.(?:[1-9]\\d*|0))\\3(?:\\s+|$))|(?<JSON>\"openapi\"\\s*:\\s*\"(?<version_json>3\\.2\\.(?:[1-9]\\d*|0))\")/m;constructor(e={}){super({name:\"openapi-yaml-3-2-swagger-client\",mediaTypes:new Sn(...mo.filterByFormat(\"generic\"),...mo.filterByFormat(\"yaml\")),...e})}async canParse(e){var r,i;let o=this.fileExtensions.length===0?!0:(0,rA.default)(r=this.fileExtensions).call(r,e.extension),s=(0,rA.default)(i=this.mediaTypes).call(i,e.mediaType);if(!o)return!1;if(s)return!0;if(!s)try{let n=e.toString();return br.load(n),this.detectionRegExp.test(n)}catch{return!1}return!1}async parse(e){if(this.sourceMap)throw new lt(\"openapi-yaml-3-2-swagger-client parser plugin doesn't support sourceMaps option\");let r=new Be,i=e.toString();try{let o=br.load(i,{schema:An});if(this.allowEmpty&&typeof o>\"u\")return r;let s=Gt.refract(o,this.refractorOpts);return s.classes.push(\"result\"),r.push(s),r}catch(o){throw new lt(`Error parsing \"${e.uri}\"`,{cause:o})}}},km=iA;var ga=t=>/^[A-Za-z_][A-Za-z_0-9.-]*$/.test(t),ks=t=>{let e=Ko(t);return zn(\"#\",e)},Dre=t=>{if(!ga(t))throw new Sf(t);return t},Pc=(t,e)=>{let r=Dre(t),i=ai(o=>Ft(o)&&b(o.$anchor)===r,e);if(et(i))throw new bf(`Evaluation failed on token: \"${r}\"`);return i};var Ru=(t,e)=>{if(typeof e.$ref>\"u\")return;let r=Ko(b(e.$ref)),i=b(e.meta.get(\"ancestorsSchemaIdentifiers\"));return`${sr((s,n)=>Vt(s,Pt(be(n))),t,[...i,b(e.$ref)])}${r===\"#\"?\"\":r}`},oA=(t,e)=>{if(typeof e.$id>\"u\")return;let r=b(e.meta.get(\"ancestorsSchemaIdentifiers\"));return sr((i,o)=>Vt(i,Pt(be(o))),t,r)},Au=t=>{if(Au.cache.has(t))return Au.cache.get(t);let e=tr.refract(t);return Au.cache.set(t,e),e};Au.cache=new WeakMap;var St=t=>ft(t)?Au(t):t;var Ac=(t,e)=>{let{cache:r}=Ac,i=be(t),o=n=>Ft(n)&&typeof n.$id<\"u\";if(!r.has(e)){let n=tc(o,e);r.set(e,Array.from(n))}let s=r.get(e).find(n=>oA(i,n)===i);if(et(s))throw new Hr(`Evaluation failed on URI: \"${t}\"`);return ga(ks(t))?Pc(ks(t),s):ke(s,Me.fromURIReference(t))};Ac.cache=new WeakMap;var Dm=ve[Symbol.for(\"nodejs.util.promisify.custom\")],Yt=new Ur,VB=t=>{try{return!!new URL(t).protocol}catch{return!1}},Gr=(t,e,r,i)=>{Ue(i)?i.value=t:Array.isArray(i)&&(i[r]=t)},sA=class t{indirections;namespace;reference;options;ancestors;refractCache;allOfDiscriminatorMapping;$selfValue;errorContext;errorPropagationCache=new Map;pendingPropagations=[];constructor({reference:e,namespace:r,options:i,indirections:o=[],ancestors:s=new _o,refractCache:n=new Map,allOfDiscriminatorMapping:a=new Map,$selfValue:p=void 0,errorContext:l=[],errorPropagationCache:u=new Map,pendingPropagations:f=[]}){this.indirections=o,this.namespace=r,this.reference=e,this.options=i,this.ancestors=new _o(...s),this.refractCache=n,this.allOfDiscriminatorMapping=a,this.$selfValue=p,this.errorContext=l,this.errorPropagationCache=u,this.pendingPropagations=f}popErrorContext(e){if(this.errorContext[this.errorContext.length-1]===e)this.errorContext.pop();else for(let r=this.errorContext.length-1;r>=0;r-=1)if(this.errorContext[r]===e){this.errorContext.splice(r,1);break}}runPropagationPass(){let e=!1;return this.pendingPropagations.forEach(({referencingElement:r,referencedElement:i})=>{let o=this.errorPropagationCache.get(i);Array.isArray(o)&&o.length>0&&o.forEach(s=>{let n=this.errorPropagationCache.get(r);if(!(n!=null&&n.includes(s))){var a;(a=this.options.dereference.dereferenceOpts)===null||a===void 0||a.errors.push({error:s,refEl:r}),n?n.push(s):this.errorPropagationCache.set(r,[s]),e=!0}})}),e}propagateErrors(){for(;this.runPropagationPass(););this.pendingPropagations.length=0}handleDereferenceError(e,r,i){var o;if((o=this.options.dereference.dereferenceOpts)!==null&&o!==void 0&&o.continueOnError){var s,n,a;let{directAncestors:u,isExternalReference:f=!1}=i??{},m=(s=(n=this.options.dereference.dereferenceOpts)===null||n===void 0?void 0:n.skipNestedExternal)!==null&&s!==void 0?s:!1,x=f&&m;if(u&&!x){for(let O of u){let j=this.errorPropagationCache.get(O);j?j.push(e):this.errorPropagationCache.set(O,[e])}let h=[...u].find(O=>ne(O)&&O.getMetaProperty(\"ref-referencing-element\"));if(h){var p;(p=this.options.dereference.dereferenceOpts)===null||p===void 0||p.errors.push({error:e,refEl:h.getMetaProperty(\"ref-referencing-element\")})}}if((a=this.options.dereference.dereferenceOpts)===null||a===void 0||a.errors.push({error:e,refEl:r}),!x){let h=new Set(this.errorContext);h.delete(r),this.popErrorContext(r);for(let O of h){var l;(l=this.options.dereference.dereferenceOpts)===null||l===void 0||l.errors.push({error:e,refEl:O})}}return}throw e}getNestedVisitorOptions(e){var r,i;return{...this.options,resolve:{...this.options.resolve,external:(r=this.options.dereference)!==null&&r!==void 0&&(r=r.dereferenceOpts)!==null&&r!==void 0&&r.skipNestedExternal&&b(e.get(\"$ref\")).startsWith(\"#\")?!1:this.options.resolve.external},dereference:{...this.options.dereference,dereferenceOpts:{...(i=this.options.dereference)===null||i===void 0?void 0:i.dereferenceOpts,continueOnError:!1}}}}toBaseURI(e){return Vt(this.reference.uri,Pt(be(e)))}async toReference(e){if(this.reference.depth>=this.options.resolve.maxDepth)throw new Of(`Maximum resolution depth of ${this.options.resolve.maxDepth} has been exceeded by file \"${this.reference.uri}\"`);let r=this.toBaseURI(e),{refSet:i}=this.reference;if(i.has(r))return i.find(jo(r,\"uri\"));let o=await Qp(pr(r),{...this.options,parse:{...this.options.parse,mediaType:\"text/plain\"}}),s=new He({uri:r,value:$(o),depth:this.reference.depth+1});if(i.add(s),this.options.dereference.immutable){let n=new He({uri:`immutable://${r}`,value:o,depth:this.reference.depth+1});i.add(n)}return s}toAncestorLineage(e){let r=new Set(e.filter(Se));return[new _o(...this.ancestors,r),r]}extractSelfFromReference(e){try{let r=e.value.result,i;if(r instanceof Ne.Element)if(r.element===\"openapi-3-2\")i=r;else{let o=ai(s=>s.element===\"openapi-3-2\",r);o&&(i=o)}if(i&&wc(i)&&z(i.$self)){let o=b(i.$self);if(o)return VB(o)?Pt(be(o)):Vt(e.uri,Pt(be(o)))}}catch{}}OpenApi3_2Element={enter:e=>{if(z(e.$self)){let r=b(e.$self);r&&(VB(r)?this.$selfValue=Pt(be(r)):this.$selfValue=Vt(this.reference.uri,Pt(be(r))))}},leave:(e,r,i,o,s,n)=>{var a,p;if((a=this.options.dereference.dereferenceOpts)!==null&&a!==void 0&&a.continueOnError&&this.propagateErrors(),!((p=this.options.dereference.strategyOpts[\"openapi-3-2\"])!==null&&p!==void 0&&p.dereferenceDiscriminatorMapping))return;let l=Ae(e);return l.setMetaProperty(\"allOfDiscriminatorMapping\",Object.fromEntries(this.allOfDiscriminatorMapping)),n.replaceWith(l,Gr),i?void 0:l}};async ReferenceElement(e,r,i,o,s,n){var a,p;if(this.indirections.includes(e))return!1;let[l,u]=this.toAncestorLineage([...s,i]),f=b(e.$ref),m=this.toBaseURI(f),x=be(this.reference.uri)===m,h=!x;if(!this.options.resolve.internal&&x||!this.options.resolve.external&&h)return!1;let O;try{O=await this.toReference(b(e.$ref))}catch(M){return this.handleDereferenceError(M,e,{directAncestors:u,isExternalReference:h})}let j=Vt(m,b(e.$ref));this.indirections.push(e);let v=Me.fromURIReference(j),E;try{E=ke(O.value.result,v)}catch(M){return this.indirections.pop(),this.handleDereferenceError(M,e,{directAncestors:u,isExternalReference:h})}if(E.id=Yt.identify(E),ft(E)){let M=b(e.meta.get(\"referenced-element\")),te=`${M}-${b(Yt.identify(E))}`;this.refractCache.has(te)?E=this.refractCache.get(te):ue(E)?(E=Nr.refract(E),E.setMetaProperty(\"referenced-element\",M),this.refractCache.set(te,E)):(E=this.namespace.getElementClass(M).refract(E),this.refractCache.set(te,E))}if(e===E){let M=new he(\"Recursive Reference Object detected\");return this.indirections.pop(),this.handleDereferenceError(M,e,{directAncestors:u,isExternalReference:h})}if(this.indirections.length>this.options.dereference.maxDepth){let M=new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);return this.indirections.pop(),this.handleDereferenceError(M,e,{directAncestors:u,isExternalReference:h})}if(l.includes(E)){if(O.refSet.circular=!0,this.options.dereference.circular===\"error\"){let M=new he(\"Circular reference detected\");return this.indirections.pop(),this.handleDereferenceError(M,e,{directAncestors:u,isExternalReference:h})}if(this.options.dereference.circular===\"replace\"){var y,g;let M=new S.RefElement(E.id,{type:\"reference\",uri:O.uri,$ref:b(e.$ref)}),H=((y=(g=this.options.dereference.strategyOpts[\"openapi-3-2\"])===null||g===void 0?void 0:g.circularReplacer)!==null&&y!==void 0?y:this.options.dereference.circularReplacer)(M);return n.replaceWith(H,Gr),i?!1:H}}let q=be(O.refSet.rootRef.uri)!==O.uri,V=[\"error\",\"replace\"].includes(this.options.dereference.circular);if((h||q||yr(E)||V)&&!l.includesCycle(E)){u.add(e),this.errorContext.push(e);let M=h||q?this.extractSelfFromReference(O):this.$selfValue,te=new t({reference:O,namespace:this.namespace,indirections:[...this.indirections],options:this.getNestedVisitorOptions(e),refractCache:this.refractCache,ancestors:l,allOfDiscriminatorMapping:this.allOfDiscriminatorMapping,$selfValue:M,errorContext:this.errorContext,errorPropagationCache:this.errorPropagationCache,pendingPropagations:this.pendingPropagations});try{E=await Dm(E,te,{keyMap:Mt,nodeTypeGetter:xt})}catch(H){return this.indirections.pop(),this.handleDereferenceError(H,e,{directAncestors:u,isExternalReference:h})}u.delete(e),this.popErrorContext(e)}(a=this.options.dereference.dereferenceOpts)!==null&&a!==void 0&&a.continueOnError&&this.pendingPropagations.push({referencingElement:e,referencedElement:E}),this.indirections.pop();let C=Ae(E);C.setMetaProperty(\"id\",Yt.generateId()),C.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref),description:b(e.description),summary:b(e.summary)});let oe=h||q?this.extractSelfFromReference(O)||O.uri:this.$selfValue||O.uri;return C.setMetaProperty(\"ref-origin\",oe),C.setMetaProperty(\"ref-referencing-element-id\",$(Yt.identify(e))),(p=this.options.dereference.dereferenceOpts)!==null&&p!==void 0&&p.continueOnError&&C.setMetaProperty(\"ref-referencing-element\",e),ne(E)&&ne(C)&&(e.hasKey(\"description\")&&\"description\"in E&&(C.remove(\"description\"),C.set(\"description\",e.get(\"description\"))),e.hasKey(\"summary\")&&\"summary\"in E&&(C.remove(\"summary\"),C.set(\"summary\",e.get(\"summary\")))),n.replaceWith(C,Gr),i?!1:C}async PathItemElement(e,r,i,o,s,n){var a;if(!z(e.$ref))return;if(this.indirections.includes(e))return!1;let[p,l]=this.toAncestorLineage([...s,i]),u=b(e.$ref),f=this.toBaseURI(u),m=be(this.reference.uri)===f,x=!m;if(!this.options.resolve.internal&&m||!this.options.resolve.external&&x)return;let h;try{h=await this.toReference(b(e.$ref))}catch(C){return this.handleDereferenceError(C,e,{directAncestors:l,isExternalReference:x})}let O=Vt(f,b(e.$ref));this.indirections.push(e);let j=Me.fromURIReference(O),v;try{v=ke(h.value.result,j)}catch(C){return this.indirections.pop(),this.handleDereferenceError(C,e,{directAncestors:l,isExternalReference:x})}if(v.id=Yt.identify(v),ft(v)){let C=`path-item-${b(Yt.identify(v))}`;this.refractCache.has(C)?v=this.refractCache.get(C):(v=xr.refract(v),this.refractCache.set(C,v))}if(e===v){let C=new he(\"Recursive Path Item Object reference detected\");return this.indirections.pop(),this.handleDereferenceError(C,e,{directAncestors:l,isExternalReference:x})}if(this.indirections.length>this.options.dereference.maxDepth){let C=new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);return this.indirections.pop(),this.handleDereferenceError(C,e,{directAncestors:l,isExternalReference:x})}if(p.includes(v)){if(h.refSet.circular=!0,this.options.dereference.circular===\"error\"){let C=new he(\"Circular reference detected\");return this.indirections.pop(),this.handleDereferenceError(C,e,{directAncestors:l,isExternalReference:x})}if(this.options.dereference.circular===\"replace\"){var E,y;let C=new S.RefElement(v.id,{type:\"path-item\",uri:h.uri,$ref:b(e.$ref)}),M=((E=(y=this.options.dereference.strategyOpts[\"openapi-3-2\"])===null||y===void 0?void 0:y.circularReplacer)!==null&&E!==void 0?E:this.options.dereference.circularReplacer)(C);return n.replaceWith(M,Gr),i?!1:M}}let g=be(h.refSet.rootRef.uri)!==h.uri,q=[\"error\",\"replace\"].includes(this.options.dereference.circular);if((x||g||yo(v)&&z(v.$ref)||q)&&!p.includesCycle(v)){l.add(e),this.errorContext.push(e);let C=x||g?this.extractSelfFromReference(h):this.$selfValue,oe=new t({reference:h,namespace:this.namespace,indirections:[...this.indirections],options:this.getNestedVisitorOptions(e),refractCache:this.refractCache,ancestors:p,allOfDiscriminatorMapping:this.allOfDiscriminatorMapping,$selfValue:C,errorContext:this.errorContext,errorPropagationCache:this.errorPropagationCache,pendingPropagations:this.pendingPropagations});try{v=await Dm(v,oe,{keyMap:Mt,nodeTypeGetter:xt})}catch(M){return this.indirections.pop(),this.handleDereferenceError(M,e,{directAncestors:l,isExternalReference:x})}l.delete(e),this.popErrorContext(e)}if((a=this.options.dereference.dereferenceOpts)!==null&&a!==void 0&&a.continueOnError&&this.pendingPropagations.push({referencingElement:e,referencedElement:v}),this.indirections.pop(),yo(v)){var V;let C=new xr([...v.content],$(v.meta),$(v.attributes));C.setMetaProperty(\"id\",Yt.generateId()),e.forEach((M,te,H)=>{C.remove(b(te)),C.content.push(H)}),C.remove(\"$ref\"),C.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref)});let oe=x||g?this.extractSelfFromReference(h)||h.uri:this.$selfValue||h.uri;C.setMetaProperty(\"ref-origin\",oe),C.setMetaProperty(\"ref-referencing-element-id\",$(Yt.identify(e))),(V=this.options.dereference.dereferenceOpts)!==null&&V!==void 0&&V.continueOnError&&C.setMetaProperty(\"ref-referencing-element\",e),v=C}return n.replaceWith(v,Gr),i?void 0:v}async LinkElement(e,r,i,o,s,n){if(!z(e.operationRef)&&!z(e.operationId))return;if(z(e.operationRef)&&z(e.operationId)){let u=new he(\"LinkElement operationRef and operationId fields are mutually exclusive.\");return this.handleDereferenceError(u,e)}let a;if(z(e.operationRef)){var p;let u=b(e.operationRef),f=Me.fromURIReference(u),m=this.toBaseURI(u),x=be(this.reference.uri)===m,h=!x;if(!this.options.resolve.internal&&x||!this.options.resolve.external&&h)return;let O;try{O=await this.toReference(b(e.operationRef)),a=ke(O.value.result,f)}catch(y){return this.handleDereferenceError(y,e,{isExternalReference:h})}if(!a){let y=new he(\"OperationElement could not be resolved.\");return this.handleDereferenceError(y,e,{isExternalReference:h})}let j=a;if(ft(j)){let y=`operation-${b(Yt.identify(j))}`;this.refractCache.has(y)?j=this.refractCache.get(y):(j=xo.refract(j),this.refractCache.set(y,j))}j=Ae(j);let v=h?this.extractSelfFromReference(O)||O.uri:this.$selfValue||O.uri;j.setMetaProperty(\"ref-origin\",v);let E=Ae(e);return(p=E.operationRef)===null||p===void 0||p.meta.set(\"operation\",j),n.replaceWith(E,Gr),i?void 0:E}if(z(e.operationId)){var l;let u=b(e.operationId),f;try{f=await this.toReference(pr(this.reference.uri))}catch(x){return this.handleDereferenceError(x,e)}if(a=ai(x=>$m(x)&&Se(x.operationId)&&x.operationId.equals(u),f.value.result),et(a)){let x=new he(`OperationElement(operationId=${u}) not found.`);return this.handleDereferenceError(x,e)}let m=Ae(e);return(l=m.operationId)===null||l===void 0||l.meta.set(\"operation\",a),n.replaceWith(m,Gr),i?void 0:m}}async ExampleElement(e,r,i,o,s,n){if(!z(e.externalValue))return;if(e.hasKey(\"value\")&&z(e.externalValue)){let O=new he(\"ExampleElement value and externalValue fields are mutually exclusive.\");return this.handleDereferenceError(O,e)}let a=b(e.externalValue),p=this.toBaseURI(a),l=be(this.reference.uri)===p,u=!l;if(!this.options.resolve.internal&&l||!this.options.resolve.external&&u)return;let f;try{f=await this.toReference(b(e.externalValue))}catch(O){return this.handleDereferenceError(O,e,{isExternalReference:u})}let m=Ae(f.value.result),x=u?this.extractSelfFromReference(f)||f.uri:this.$selfValue||f.uri;m.setMetaProperty(\"ref-origin\",x);let h=Ae(e);return h.value=m,n.replaceWith(h,Gr),i?void 0:h}async MemberElement(e,r,i,o,s,n){var a;let p=s[s.length-1];if(!ne(p)||!p.classes.contains(\"discriminator-mapping\"))return;if(!((a=this.options.dereference.strategyOpts[\"openapi-3-2\"])!==null&&a!==void 0&&a.dereferenceDiscriminatorMapping)||!z(e.key)||!z(e.value)||this.indirections.includes(e))return!1;this.indirections.push(e);let[l,u]=this.toAncestorLineage([...s,i]),f=[...u].findLast(Ft),m=$(f.getMetaProperty(\"ancestorsSchemaIdentifiers\")),x=b(e.value),O=/^[a-zA-Z0-9\\\\.\\\\-_]+$/.test(x)?`#/components/schemas/${x}`:x,j=new tr({$ref:O});j.setMetaProperty(\"ancestorsSchemaIdentifiers\",m),u.add(j);let v=new t({reference:this.reference,namespace:this.namespace,indirections:[...this.indirections],options:this.getNestedVisitorOptions(j),refractCache:this.refractCache,ancestors:l,allOfDiscriminatorMapping:this.allOfDiscriminatorMapping,$selfValue:this.$selfValue}),E;try{E=await Dm(j,v,{keyMap:Mt,nodeTypeGetter:xt})}catch(g){let q=!O.startsWith(\"#\");return this.handleDereferenceError(g,e,{directAncestors:u,isExternalReference:q})}u.delete(j),this.indirections.pop();let y=Ae(e);return y.value.setMetaProperty(\"ref-schema\",E),n.replaceWith(y,Gr),i?void 0:y}async SchemaElement(e,r,i,o,s,n){var a;if(!z(e.$ref))return;if(this.indirections.includes(e))return!1;let[p,l]=this.toAncestorLineage([...s,i]),u;try{u=await this.toReference(pr(this.reference.uri))}catch(k){return this.handleDereferenceError(k,e,{directAncestors:l})}let{uri:f}=u,m=Ru(f,e),x=be(m),h=new Zt({uri:x}),O=wl(k=>k.canRead(h),this.options.resolve.resolvers),j=!O,v=be(this.reference.uri)===m,E=!v;this.indirections.push(e);let y;try{if(O||j){f=this.toBaseURI(m);let k=m,W=St(u.value.result);if(y=Ac(k,W),y=St(y),y.id=Yt.identify(y),!this.options.resolve.internal&&v||!this.options.resolve.external&&E)return}else{if(f=this.toBaseURI(m),v=be(this.reference.uri)===f,E=!v,!this.options.resolve.internal&&v||!this.options.resolve.external&&E)return;u=await this.toReference(pr(m));let k=Me.fromURIReference(m),W=St(u.value.result);y=ke(W,k),y=St(y),y.id=Yt.identify(y)}}catch(k){if(j&&k instanceof Hr)if(ga(ks(m))){if(v=be(this.reference.uri)===f,E=!v,!this.options.resolve.internal&&v||!this.options.resolve.external&&E)return;try{u=await this.toReference(pr(m))}catch(pe){return this.indirections.pop(),this.handleDereferenceError(pe,e,{directAncestors:l,isExternalReference:E})}let W=ks(m),Z=St(u.value.result);try{y=Pc(W,Z)}catch(pe){return this.indirections.pop(),this.handleDereferenceError(pe,e,{directAncestors:l,isExternalReference:E})}y=St(y),y.id=Yt.identify(y)}else{if(f=this.toBaseURI(m),v=be(this.reference.uri)===f,E=!v,!this.options.resolve.internal&&v||!this.options.resolve.external&&E)return;try{u=await this.toReference(pr(m))}catch(pe){return this.indirections.pop(),this.handleDereferenceError(pe,e,{directAncestors:l,isExternalReference:E})}let W=Me.fromURIReference(m),Z=St(u.value.result);try{y=ke(Z,W)}catch(pe){return this.indirections.pop(),this.handleDereferenceError(pe,e,{directAncestors:l,isExternalReference:E})}y=St(y),y.id=Yt.identify(y)}else return this.indirections.pop(),this.handleDereferenceError(k,e,{directAncestors:l,isExternalReference:E})}if(e===y){let k=new he(\"Recursive Schema Object reference detected\");return this.indirections.pop(),this.handleDereferenceError(k,e,{directAncestors:l,isExternalReference:E})}if(this.indirections.length>this.options.dereference.maxDepth){let k=new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);return this.indirections.pop(),this.handleDereferenceError(k,e,{directAncestors:l,isExternalReference:E})}if(p.includes(y)){if(u.refSet.circular=!0,this.options.dereference.circular===\"error\"){let k=new he(\"Circular reference detected\");return this.indirections.pop(),this.handleDereferenceError(k,e,{directAncestors:l,isExternalReference:E})}if(this.options.dereference.circular===\"replace\"){var g,q;let k=new S.RefElement(y.id,{type:\"json-schema\",uri:u.uri,$ref:b(e.$ref)}),Z=((g=(q=this.options.dereference.strategyOpts[\"openapi-3-2\"])===null||q===void 0?void 0:q.circularReplacer)!==null&&g!==void 0?g:this.options.dereference.circularReplacer)(k);return n.replaceWith(Z,Gr),i?!1:Z}}let V=be(u.refSet.rootRef.uri)!==u.uri,C=[\"error\",\"replace\"].includes(this.options.dereference.circular);if((E||V||Ft(y)&&z(y.$ref)||C)&&!p.includesCycle(y)){l.add(e),this.errorContext.push(e);let k=E||V?this.extractSelfFromReference(u):this.$selfValue,W=new t({reference:u,namespace:this.namespace,indirections:[...this.indirections],options:this.getNestedVisitorOptions(e),refractCache:this.refractCache,ancestors:p,allOfDiscriminatorMapping:this.allOfDiscriminatorMapping,$selfValue:k,errorContext:this.errorContext,errorPropagationCache:this.errorPropagationCache,pendingPropagations:this.pendingPropagations});try{y=await Dm(y,W,{keyMap:Mt,nodeTypeGetter:xt})}catch(Z){return this.indirections.pop(),this.handleDereferenceError(Z,e,{directAncestors:l,isExternalReference:E})}l.delete(e),this.popErrorContext(e)}if((a=this.options.dereference.dereferenceOpts)!==null&&a!==void 0&&a.continueOnError&&this.pendingPropagations.push({referencingElement:e,referencedElement:y}),this.indirections.pop(),jc(y)){let k=$(y);k.setMetaProperty(\"id\",Yt.generateId()),k.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref),$refBaseURI:m});let W=E?this.extractSelfFromReference(u)||u.uri:this.$selfValue||u.uri;return k.setMetaProperty(\"ref-origin\",W),k.setMetaProperty(\"ref-referencing-element-id\",$(Yt.identify(e))),n.replaceWith(k,Gr),i?!1:k}if(Ft(y)){var oe,M;let k=new tr([...y.content],$(y.meta),$(y.attributes));k.setMetaProperty(\"id\",Yt.generateId()),e.forEach((Z,pe,re)=>{k.remove(b(pe)),k.content.push(re)}),k.remove(\"$ref\"),k.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref),$refBaseURI:m});let W=E?this.extractSelfFromReference(u)||u.uri:this.$selfValue||u.uri;if(k.setMetaProperty(\"ref-origin\",W),k.setMetaProperty(\"ref-referencing-element-id\",$(Yt.identify(e))),(oe=this.options.dereference.dereferenceOpts)!==null&&oe!==void 0&&oe.continueOnError&&k.setMetaProperty(\"ref-referencing-element\",e),(M=this.options.dereference.strategyOpts[\"openapi-3-2\"])!==null&&M!==void 0&&M.dereferenceDiscriminatorMapping){var te;let Z=s[s.length-1],pe=[...l].findLast(Ft),re=pe?.getMetaProperty(\"schemaName\"),Qe=b(k.getMetaProperty(\"schemaName\"));if(Qe&&re&&Z!==null&&Z!==void 0&&(te=Z.classes)!==null&&te!==void 0&&te.contains(\"json-schema-allOf\")){var H;let $t=(H=this.allOfDiscriminatorMapping.get(Qe))!==null&&H!==void 0?H:[];$t.push(pe),this.allOfDiscriminatorMapping.set(Qe,$t)}}y=k}return n.replaceWith(y,Gr),i?void 0:y}},qm=sA;var qre=ve[Symbol.for(\"nodejs.util.promisify.custom\")],nA=class extends vf{constructor(e){super({...e??{},name:\"openapi-3-2\"})}canDereference(e){var r;return e.mediaType!==\"text/plain\"?mo.includes(e.mediaType):wc((r=e.parseResult)===null||r===void 0?void 0:r.result)}async dereference(e,r){var i;let o=Ye(ya),s=(i=r.dereference.refSet)!==null&&i!==void 0?i:new gt,n=new gt,a=s,p;s.has(e.uri)?p=s.find(jo(e.uri,\"uri\")):(p=new He({uri:e.uri,value:e.parseResult}),s.add(p)),r.dereference.immutable&&(s.refs.map(f=>new He({...f,value:$(f.value)})).forEach(f=>n.add(f)),p=n.find(f=>f.uri===e.uri),a=n);let l=new qm({reference:p,namespace:o,options:r}),u=await qre(a.rootRef.value,l,{keyMap:Mt,nodeTypeGetter:xt});return r.dereference.immutable&&n.refs.filter(f=>f.uri.startsWith(\"immutable://\")).map(f=>new He({...f,uri:f.uri.replace(/^immutable:\\/\\//,\"\")})).forEach(f=>s.add(f)),r.dereference.refSet===null&&s.clean(),n.clean(),u}};var LB=nA;var Vre=t=>t.slice(2),Lre=t=>{let e=Vre(t);return e.reduce((r,i,o)=>{if(Ue(i)){let s=String(b(i.key));r.push(s)}else if(Pe(e[o-2])){let s=e[o-2].content.indexOf(i);r.push(s)}return r},[])},gr=Lre;var aA=class{modelPropertyMacro;options;SchemaElement={leave:(e,r,i,o,s)=>{typeof e.properties>\"u\"||ne(e.properties)&&e.properties.forEach(n=>{if(ne(n))try{let a=this.modelPropertyMacro(b(n));n.set(\"default\",a)}catch(a){let p=new Error(a,{cause:a});p.fullPath=[...gr([...s,i,e]),\"properties\"],this.options.dereference.dereferenceOpts?.errors?.push?.(p)}})}};constructor({modelPropertyMacro:e,options:r}){this.modelPropertyMacro=e,this.options=r}},BB=aA;var cA=class{options;SchemaElement={leave(e,r,i,o,s){if(typeof e.allOf>\"u\")return;if(!Pe(e.allOf)){let a=new TypeError(\"allOf must be an array\");a.fullPath=[...gr([...s,i,e]),\"allOf\"],this.options.dereference.dereferenceOpts?.errors?.push?.(a);return}if(e.allOf.isEmpty){e.remove(\"allOf\");return}if(!e.allOf.content.every(Ft)){let a=new TypeError(\"Elements in allOf must be objects\");a.fullPath=[...gr([...s,i,e]),\"allOf\"],this.options.dereference.dereferenceOpts?.errors?.push?.(a);return}for(;e.hasKey(\"allOf\");){let{allOf:a}=e;e.remove(\"allOf\");let p=fr.all([...a.content,e],{customMerge:l=>b(l)===\"enum\"?(u,f)=>{if(At([\"json-schema-enum\"],u)&&At([\"json-schema-enum\"],f)){let m=(h,O)=>Pe(h)||Pe(O)||ne(h)||ne(O)?!1:h.equals(b(O)),x=Ae(u);return x.content=Jo(m)([...u.content,...f.content]),x}return fr(u,f)}:fr});if(e.hasKey(\"$$ref\")||p.remove(\"$$ref\"),e.hasKey(\"example\")){let l=p.getMember(\"example\");l&&(l.value=e.get(\"example\"))}if(e.hasKey(\"examples\")){let l=p.getMember(\"examples\");l&&(l.value=e.get(\"examples\"))}e.content=p.content}}};constructor({options:e}){this.options=e}},UB=cA;var lA=class{parameterMacro;options;#e;OperationElement={enter:e=>{this.#e=e},leave:()=>{this.#e=void 0}};ParameterElement={leave:(e,r,i,o,s)=>{let n=this.#e?b(this.#e):null,a=b(e);try{let p=this.parameterMacro(n,a);e.set(\"default\",p)}catch(p){let l=new Error(p,{cause:p});l.fullPath=gr([...s,i]),this.options.dereference.dereferenceOpts?.errors?.push?.(l)}}};constructor({parameterMacro:e,options:r}){this.parameterMacro=e,this.options=r}},JB=lA;var $o=Le(Er());var Bre=t=>{if(t.cause==null)return t;let{cause:e}=t;for(;e.cause!=null;)e=e.cause;return e},_u=Bre;var uA=class extends yt{},HB=uA;var{wrapError:pA}=oc,fA=ve[Symbol.for(\"nodejs.util.promisify.custom\")],Yr=new Ur,va=(t,e,r,i)=>{Ue(i)?i.value=t:Array.isArray(i)&&(i[r]=t)},mA=class t extends qm{useCircularStructures;allowMetaPatches;basePath;constructor({allowMetaPatches:e=!0,useCircularStructures:r=!1,basePath:i=null,...o}){super(o),this.allowMetaPatches=e,this.useCircularStructures=r,this.basePath=i}async ReferenceElement(e,r,i,o,s,n){try{var a,p;if((0,$o.default)(a=this.indirections).call(a,e))return!1;let[l,u]=this.toAncestorLineage([...s,i]),f=this.toBaseURI(b(e.$ref)),m=ae.stripHash(this.reference.uri)===f,x=!m;if(!this.options.resolve.internal&&m||!this.options.resolve.external&&x)return!1;let h=await this.toReference(b(e.$ref)),O=ae.resolve(f,b(e.$ref));this.indirections.push(e);let j=Me.fromURIReference(O),v=ke(h.value.result,j);if(v.id=Yr.identify(v),ft(v)){let q=b(e.meta.get(\"referenced-element\")),V=`${q}-${b(Yr.identify(v))}`;this.refractCache.has(V)?v=this.refractCache.get(V):ue(v)?(v=Nr.refract(v),v.setMetaProperty(\"referenced-element\",q),this.refractCache.set(V,v)):(v=this.namespace.getElementClass(q).refract(v),this.refractCache.set(V,v))}if(e===v)throw new he(\"Recursive Reference Object detected\");if(this.indirections.length>this.options.dereference.maxDepth)throw new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);if((0,$o.default)(l).call(l,v)){if(h.refSet.circular=!0,this.options.dereference.circular===\"error\")throw new he(\"Circular reference detected\");if(this.options.dereference.circular===\"replace\"){let q=new S.RefElement(v.id,{type:\"reference\",uri:h.uri,$ref:b(e.$ref),baseURI:O,referencingElement:e}),C=(this.options.dereference.strategyOpts[\"openapi-3-2\"]?.circularReplacer??this.options.dereference.circularReplacer)(q);return n.replaceWith(q,va),i?!1:C}}let E=ae.stripHash(h.refSet.rootRef.uri)!==h.uri,y=(0,$o.default)(p=[\"error\",\"replace\"]).call(p,this.options.dereference.circular);if((x||E||yr(v)||y)&&!l.includesCycle(v)){u.add(e);let q=new t({reference:h,namespace:this.namespace,indirections:[...this.indirections],options:this.options,refractCache:this.refractCache,ancestors:l,allowMetaPatches:this.allowMetaPatches,useCircularStructures:this.useCircularStructures,basePath:this.basePath??[...gr([...s,i,e]),\"$ref\"]});v=await fA(v,q,{keyMap:Mt,nodeTypeGetter:xt}),u.delete(e)}this.indirections.pop();let g=Ae(v);if(g.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref),description:b(e.description),summary:b(e.summary)}),g.setMetaProperty(\"ref-origin\",h.uri),g.setMetaProperty(\"ref-referencing-element-id\",$(Yr.identify(e))),ne(v)&&(e.hasKey(\"description\")&&\"description\"in v&&(g.remove(\"description\"),g.set(\"description\",e.get(\"description\"))),e.hasKey(\"summary\")&&\"summary\"in v&&(g.remove(\"summary\"),g.set(\"summary\",e.get(\"summary\")))),this.allowMetaPatches&&ne(g)&&!g.hasKey(\"$$ref\")){let q=ae.resolve(f,O);g.set(\"$$ref\",q)}return n.replaceWith(g,va),i?!1:g}catch(l){let u=_u(l),f=pA(u,{baseDoc:this.reference.uri,$ref:b(e.$ref),pointer:Me.fromURIReference(b(e.$ref)),fullPath:this.basePath??[...gr([...s,i,e]),\"$ref\"]});this.options.dereference.dereferenceOpts?.errors?.push?.(f);return}}async PathItemElement(e,r,i,o,s,n){try{var a,p;if(!z(e.$ref))return;if((0,$o.default)(a=this.indirections).call(a,e)||At([\"cycle\"],e.$ref))return!1;let[l,u]=this.toAncestorLineage([...s,i]),f=this.toBaseURI(b(e.$ref)),m=ae.stripHash(this.reference.uri)===f,x=!m;if(!this.options.resolve.internal&&m||!this.options.resolve.external&&x)return;let h=await this.toReference(b(e.$ref)),O=ae.resolve(f,b(e.$ref));this.indirections.push(e);let j=Me.fromURIReference(O),v=ke(h.value.result,j);if(v.id=Yr.identify(v),ft(v)){let g=`path-item-${b(Yr.identify(v))}`;this.refractCache.has(g)?v=this.refractCache.get(g):(v=xr.refract(v),this.refractCache.set(g,v))}if(e===v)throw new he(\"Recursive Path Item Object reference detected\");if(this.indirections.length>this.options.dereference.maxDepth)throw new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);if((0,$o.default)(l).call(l,v)){if(h.refSet.circular=!0,this.options.dereference.circular===\"error\")throw new he(\"Circular reference detected\");if(this.options.dereference.circular===\"replace\"){let g=new S.RefElement(v.id,{type:\"path-item\",uri:h.uri,$ref:b(e.$ref),baseURI:O,referencingElement:e}),V=(this.options.dereference.strategyOpts[\"openapi-3-2\"]?.circularReplacer??this.options.dereference.circularReplacer)(g);return n.replaceWith(g,va),i?!1:V}}let E=ae.stripHash(h.refSet.rootRef.uri)!==h.uri,y=(0,$o.default)(p=[\"error\",\"replace\"]).call(p,this.options.dereference.circular);if((x||E||yo(v)&&z(v.$ref)||y)&&!l.includesCycle(v)){u.add(e);let g=new t({reference:h,namespace:this.namespace,indirections:[...this.indirections],options:this.options,ancestors:l,allowMetaPatches:this.allowMetaPatches,useCircularStructures:this.useCircularStructures,basePath:this.basePath??[...gr([...s,i,e]),\"$ref\"]});v=await fA(v,g,{keyMap:Mt,nodeTypeGetter:xt}),u.delete(e)}if(this.indirections.pop(),yo(v)){let g=new xr([...v.content],$(v.meta),$(v.attributes));if(e.forEach((q,V,C)=>{g.remove(b(V)),g.content.push(C)}),g.remove(\"$ref\"),g.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref)}),g.setMetaProperty(\"ref-origin\",h.uri),g.setMetaProperty(\"ref-referencing-element-id\",$(Yr.identify(e))),this.allowMetaPatches&&typeof g.get(\"$$ref\")>\"u\"){let q=ae.resolve(f,O);g.set(\"$$ref\",q)}v=g}return n.replaceWith(v,va),i?void 0:v}catch(l){let u=_u(l),f=pA(u,{baseDoc:this.reference.uri,$ref:b(e.$ref),pointer:Me.fromURIReference(b(e.$ref)),fullPath:this.basePath??[...gr([...s,i,e]),\"$ref\"]});this.options.dereference.dereferenceOpts?.errors?.push?.(f);return}}async SchemaElement(e,r,i,o,s,n){try{var a,p;if(!z(e.$ref))return;if((0,$o.default)(a=this.indirections).call(a,e))return!1;let[l,u]=this.toAncestorLineage([...s,i]),f=await this.toReference(ae.unsanitize(this.reference.uri)),{uri:m}=f,x=Ru(m,e),h=ae.stripHash(x),O=new Zt({uri:h}),j=!this.options.resolve.resolvers.some(C=>C.canRead(O)),v=!j,E=ae.stripHash(this.reference.uri)===x,y=!E;this.indirections.push(e);let g;try{if(j||v){m=this.toBaseURI(x);let C=x,oe=St(f.value.result);if(g=Ac(C,oe),g=St(g),g.id=Yr.identify(g),!this.options.resolve.internal&&E||!this.options.resolve.external&&y)return}else{if(m=this.toBaseURI(x),E=ae.stripHash(this.reference.uri)===m,y=!E,!this.options.resolve.internal&&E||!this.options.resolve.external&&y)return;f=await this.toReference(ae.unsanitize(x));let C=Me.fromURIReference(x),oe=St(f.value.result);g=ke(oe,C),g=St(g),g.id=Yr.identify(g)}}catch(C){if(v&&C instanceof Hr)if(ga(ks(x))){if(E=ae.stripHash(this.reference.uri)===m,y=!E,!this.options.resolve.internal&&E||!this.options.resolve.external&&y)return;f=await this.toReference(ae.unsanitize(x));let oe=ks(x),M=St(f.value.result);g=Pc(oe,M),g=St(g),g.id=Yr.identify(g)}else{if(m=this.toBaseURI(b(x)),E=ae.stripHash(this.reference.uri)===m,y=!E,!this.options.resolve.internal&&E||!this.options.resolve.external&&y)return;f=await this.toReference(ae.unsanitize(x));let oe=Me.fromURIReference(x),M=St(f.value.result);g=ke(M,oe),g=St(g),g.id=Yr.identify(g)}else throw C}if(e===g)throw new he(\"Recursive Schema Object reference detected\");if(this.indirections.length>this.options.dereference.maxDepth)throw new Ut(`Maximum dereference depth of \"${this.options.dereference.maxDepth}\" has been exceeded in file \"${this.reference.uri}\"`);if((0,$o.default)(l).call(l,g)){if(f.refSet.circular=!0,this.options.dereference.circular===\"error\")throw new he(\"Circular reference detected\");if(this.options.dereference.circular===\"replace\"){let C=new S.RefElement(g.id,{type:\"json-schema\",uri:f.uri,$ref:b(e.$ref),baseURI:ae.resolve(m,x),referencingElement:e}),M=(this.options.dereference.strategyOpts[\"openapi-3-2\"]?.circularReplacer??this.options.dereference.circularReplacer)(C);return n.replaceWith(M,va),i?!1:M}}let q=ae.stripHash(f.refSet.rootRef.uri)!==f.uri,V=(0,$o.default)(p=[\"error\",\"replace\"]).call(p,this.options.dereference.circular);if((y||q||Ft(g)&&z(g.$ref)||V)&&!l.includesCycle(g)){u.add(e);let C=new t({reference:f,namespace:this.namespace,indirections:[...this.indirections],options:this.options,useCircularStructures:this.useCircularStructures,allowMetaPatches:this.allowMetaPatches,ancestors:l,basePath:this.basePath??[...gr([...s,i,e]),\"$ref\"]});g=await fA(g,C,{keyMap:Mt,nodeTypeGetter:xt}),u.delete(e)}if(this.indirections.pop(),jc(g)){let C=$(g);return C.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref)}),C.setMetaProperty(\"ref-origin\",f.uri),C.setMetaProperty(\"ref-referencing-element-id\",$(Yr.identify(e))),n.replaceWith(C,va),i?!1:C}if(Ft(g)){let C=new tr([...g.content],$(g.meta),$(g.attributes));if(e.forEach((oe,M,te)=>{C.remove(b(M)),C.content.push(te)}),C.remove(\"$ref\"),C.setMetaProperty(\"ref-fields\",{$ref:b(e.$ref)}),C.setMetaProperty(\"ref-origin\",f.uri),C.setMetaProperty(\"ref-referencing-element-id\",$(Yr.identify(e))),this.allowMetaPatches&&typeof C.get(\"$$ref\")>\"u\"){let oe=ae.resolve(m,x);C.set(\"$$ref\",oe)}g=C}return n.replaceWith(g,va),i?void 0:g}catch(l){let u=_u(l),f=new HB(`Could not resolve reference: ${u.message}`,{baseDoc:this.reference.uri,$ref:b(e.$ref),fullPath:this.basePath??[...gr([...s,i,e]),\"$ref\"],cause:u});this.options.dereference.dereferenceOpts?.errors?.push?.(f);return}}async LinkElement(){}async ExampleElement(e,r,i,o,s,n){try{return await super.ExampleElement(e,r,i,o,s,n)}catch(a){let p=_u(a),l=pA(p,{baseDoc:this.reference.uri,externalValue:b(e.externalValue),fullPath:this.basePath??[...gr([...s,i,e]),\"externalValue\"]});this.options.dereference.dereferenceOpts?.errors?.push?.(l);return}}},zB=mA;var Ure=ni[Symbol.for(\"nodejs.util.promisify.custom\")],dA=class{constructor({parameterMacro:e,modelPropertyMacro:r,mode:i,options:o,...s}){let n=[];n.push(new zB({...s,options:o})),typeof r==\"function\"&&n.push(new BB({modelPropertyMacro:r,options:o})),i!==\"strict\"&&n.push(new UB({options:o})),typeof e==\"function\"&&n.push(new JB({parameterMacro:e,options:o}));let a=Ure(n,{nodeTypeGetter:xt});Object.assign(this,a)}},KB=dA;var Jre=ve[Symbol.for(\"nodejs.util.promisify.custom\")],hA=class extends LB{allowMetaPatches;parameterMacro;modelPropertyMacro;mode;ancestors;constructor({allowMetaPatches:e=!1,parameterMacro:r=null,modelPropertyMacro:i=null,mode:o=\"non-strict\",ancestors:s=[],...n}={}){super({...n}),this.name=\"openapi-3-2-swagger-client\",this.allowMetaPatches=e,this.parameterMacro=r,this.modelPropertyMacro=i,this.mode=o,this.ancestors=[...s]}async dereference(e,r){let i=Ye(ya),o=r.dereference.refSet??new gt,s=new gt,n=o,a;o.has(e.uri)?a=o.find(u=>u.uri===e.uri):(a=new He({uri:e.uri,value:e.parseResult}),o.add(a)),r.dereference.immutable&&(o.refs.map(u=>new He({...u,value:$(u.value)})).forEach(u=>s.add(u)),a=s.find(u=>u.uri===e.uri),n=s);let p=new KB({reference:a,namespace:i,options:r,allowMetaPatches:this.allowMetaPatches,ancestors:this.ancestors,modelPropertyMacro:this.modelPropertyMacro,mode:this.mode,parameterMacro:this.parameterMacro}),l=await Jre(n.rootRef.value,p,{keyMap:Mt,nodeTypeGetter:xt});return r.dereference.immutable&&s.refs.filter(u=>u.uri.startsWith(\"immutable://\")).map(u=>new He({...u,uri:u.uri.replace(/^immutable:\\/\\//,\"\")})).forEach(u=>o.add(u)),r.dereference.refSet===null&&o.clean(),s.clean(),l}},Vm=hA;var Hre=t=>{let e=b(t.meta.get(\"baseURI\")),r=t.meta.get(\"referencingElement\");return new S.ObjectElement({$ref:e},$(r.meta),$(r.attributes))},xA=async t=>{let{spec:e,timeout:r,redirects:i,requestInterceptor:o,responseInterceptor:s,pathDiscriminator:n=[],allowMetaPatches:a=!1,useCircularStructures:p=!1,skipNormalization:l=!1,parameterMacro:u=null,modelPropertyMacro:f=null,mode:m=\"non-strict\",strategies:x}=t;try{let{cache:h}=xA,O=x.find(pe=>pe.match(e)),j=ae.isHttpUrl(ae.cwd())?ae.cwd():ko,v=Ks(t),E=ae.resolve(j,v),y;h.has(e)?y=h.get(e):(y=Gt.refract(e),y.classes.push(\"result\"),h.set(e,y));let g=new Be([y]),q=Co(n),V=q===\"\"?\"\":`#${q}`,C=ke(y,q),oe=new He({uri:E,value:g}),M=new gt({refs:[oe]});q!==\"\"&&(M.rootRef=void 0);let te=[new Set([C])],H=[],k=await wf(C,{resolve:{baseURI:`${E}${V}`,resolvers:[new vc({timeout:r||1e4,redirects:i||10})],resolverOpts:{swaggerHTTPClientConfig:{requestInterceptor:o,responseInterceptor:s}},strategies:[new Am]},parse:{mediaType:mo.latest(),parsers:[new Nm({allowEmpty:!1,sourceMap:!1}),new km({allowEmpty:!1,sourceMap:!1}),new Ec({allowEmpty:!1,sourceMap:!1}),new bc({allowEmpty:!1,sourceMap:!1}),new Pm({allowEmpty:!1,sourceMap:!1})]},dereference:{maxDepth:100,strategies:[new Vm({allowMetaPatches:a,useCircularStructures:p,parameterMacro:u,modelPropertyMacro:f,mode:m,ancestors:te})],refSet:M,dereferenceOpts:{errors:H},immutable:!1,circular:p?\"ignore\":\"replace\",circularReplacer:p?Kn.dereference.circularReplacer:Hre}}),W=Xl(C,k,y),Z=l?W:O.normalize(W);return{spec:b(Z),errors:H}}catch(h){if(h instanceof Jt)return{spec:e,errors:[]};throw h}};xA.cache=new WeakMap;var Lm=xA;var zre=t=>{if(!ne(t))return t;let e=[oP({operationIdNormalizer:(i,o,s)=>wr({operationId:i},o,s,{v2OperationIdCompatibilityMode:!1})}),eP(),tP(),sP(),nP()];return Xe(t,e,{toolboxCreator:Pu,visitorOptions:{keyMap:Mt,nodeTypeGetter:xt}})},WB=t=>e=>{let r=Gt.refract(e);r.classes.push(\"result\");let i=t(r),o=b(i);return Lm.cache.set(o,i),b(i)},yA=zre;var Kre={name:\"openapi-3-2-apidom\",match(t){return tu(t)},normalize(t){if(!Se(t)&&nt(t)&&!t.$$normalized){let e=WB(yA)(t);return e.$$normalized=!0,e}return Se(t)?yA(t):t},async resolve(t){return Lm(t)}},GB=Kre;function Rc(t,e,r){if(!t||typeof t!=\"object\"||!t.paths||typeof t.paths!=\"object\")return null;let{paths:i}=t,o=tu(t);for(let s in i){for(let a in i[s]){if(a.toUpperCase()===\"PARAMETERS\"||a===\"additionalOperations\")continue;let p=i[s][a];if(!p||typeof p!=\"object\")continue;let l={spec:t,pathName:s,method:a.toUpperCase(),operation:p},u=e(l);if(r&&u)return l}let{additionalOperations:n}=i[s];if(o&&n&&typeof n==\"object\")for(let a of Object.keys(n)){let p=n[a];if(!p||typeof p!=\"object\")continue;let l={spec:t,pathName:s,method:a,operation:p},u=e(l);if(r&&u)return l}}}function Bm(t,e){return Rc(t,e,!0)||null}function _c(t,e){return`${e.toLowerCase()}-${t}`}function Um(t,e){return!t||!t.paths?null:Bm(t,({pathName:r,method:i,operation:o})=>{if(!o||typeof o!=\"object\")return!1;let s=o.operationId,n=wr(o,r,i),a=_c(r,i);return[n,a,s].some(p=>p&&p===e)})}var{isHttpUrl:Wre}=ae,gA=Wre;var Gre=()=>null,Yre=t=>Array.isArray(t)?t:[t],YB={mapTagOperations:Qre,makeExecute:Xre};function Xre(t={}){return({pathName:e,method:r,operationId:i})=>(o,s={})=>{let{requestInterceptor:n,responseInterceptor:a,userFetch:p}=t;return t.execute({spec:t.spec,requestInterceptor:n,responseInterceptor:a,userFetch:p,pathName:e,method:r,parameters:o,operationId:i,...s})}}function XB(t={}){let e=YB.makeExecute(t);return{apis:YB.mapTagOperations({v2OperationIdCompatibilityMode:t.v2OperationIdCompatibilityMode,spec:t.spec,cb:e})}}function Qre({spec:t,cb:e=Gre,defaultTag:r=\"default\",v2OperationIdCompatibilityMode:i}){let o={},s={};return Rc(t,({pathName:n,method:a,operation:p})=>{(p.tags?Yre(p.tags):[r]).forEach(u=>{if(typeof u!=\"string\")return;s[u]=s[u]||{};let f=s[u],m=wr(p,n,a,{v2OperationIdCompatibilityMode:i}),x=e({spec:t,pathName:n,method:a,operation:p,operationId:m});if(o[m])o[m]+=1,f[`${m}${o[m]}`]=x;else if(typeof f[m]<\"u\"){let h=o[m]||1;o[m]=h+1,f[`${m}${o[m]}`]=x;let O=f[m];delete f[m],f[`${m}${h}`]=O}else f[m]=x})}),s}var CA=Le(Er());function Ic(){this.grammarObject=\"grammarObject\",this.rules=[],this.rules[0]={name:\"path-template\",lower:\"path-template\",index:0,isBkr:!1},this.rules[1]={name:\"path-segment\",lower:\"path-segment\",index:1,isBkr:!1},this.rules[2]={name:\"slash\",lower:\"slash\",index:2,isBkr:!1},this.rules[3]={name:\"path-literal\",lower:\"path-literal\",index:3,isBkr:!1},this.rules[4]={name:\"template-expression\",lower:\"template-expression\",index:4,isBkr:!1},this.rules[5]={name:\"template-expression-param-name\",lower:\"template-expression-param-name\",index:5,isBkr:!1},this.rules[6]={name:\"pchar\",lower:\"pchar\",index:6,isBkr:!1},this.rules[7]={name:\"unreserved\",lower:\"unreserved\",index:7,isBkr:!1},this.rules[8]={name:\"pct-encoded\",lower:\"pct-encoded\",index:8,isBkr:!1},this.rules[9]={name:\"sub-delims\",lower:\"sub-delims\",index:9,isBkr:!1},this.rules[10]={name:\"ALPHA\",lower:\"alpha\",index:10,isBkr:!1},this.rules[11]={name:\"DIGIT\",lower:\"digit\",index:11,isBkr:!1},this.rules[12]={name:\"HEXDIG\",lower:\"hexdig\",index:12,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,2,6]},this.rules[0].opcodes[1]={type:4,index:2},this.rules[0].opcodes[2]={type:3,min:0,max:1/0},this.rules[0].opcodes[3]={type:2,children:[4,5]},this.rules[0].opcodes[4]={type:4,index:1},this.rules[0].opcodes[5]={type:4,index:2},this.rules[0].opcodes[6]={type:3,min:0,max:1},this.rules[0].opcodes[7]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:3,min:1,max:1/0},this.rules[1].opcodes[1]={type:1,children:[2,3]},this.rules[1].opcodes[2]={type:4,index:3},this.rules[1].opcodes[3]={type:4,index:4},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:7,string:[47]},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:1,max:1/0},this.rules[3].opcodes[1]={type:4,index:6},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:2,children:[1,2,3]},this.rules[4].opcodes[1]={type:7,string:[123]},this.rules[4].opcodes[2]={type:4,index:5},this.rules[4].opcodes[3]={type:7,string:[125]},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:3,min:1,max:1/0},this.rules[5].opcodes[1]={type:1,children:[2,3,4]},this.rules[5].opcodes[2]={type:5,min:0,max:122},this.rules[5].opcodes[3]={type:6,string:[124]},this.rules[5].opcodes[4]={type:5,min:126,max:1114111},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[6].opcodes[1]={type:4,index:7},this.rules[6].opcodes[2]={type:4,index:8},this.rules[6].opcodes[3]={type:4,index:9},this.rules[6].opcodes[4]={type:7,string:[58]},this.rules[6].opcodes[5]={type:7,string:[64]},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,2,3,4,5,6]},this.rules[7].opcodes[1]={type:4,index:10},this.rules[7].opcodes[2]={type:4,index:11},this.rules[7].opcodes[3]={type:7,string:[45]},this.rules[7].opcodes[4]={type:7,string:[46]},this.rules[7].opcodes[5]={type:7,string:[95]},this.rules[7].opcodes[6]={type:7,string:[126]},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:2,children:[1,2,3]},this.rules[8].opcodes[1]={type:7,string:[37]},this.rules[8].opcodes[2]={type:4,index:12},this.rules[8].opcodes[3]={type:4,index:12},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10,11]},this.rules[9].opcodes[1]={type:7,string:[33]},this.rules[9].opcodes[2]={type:7,string:[36]},this.rules[9].opcodes[3]={type:7,string:[38]},this.rules[9].opcodes[4]={type:7,string:[39]},this.rules[9].opcodes[5]={type:7,string:[40]},this.rules[9].opcodes[6]={type:7,string:[41]},this.rules[9].opcodes[7]={type:7,string:[42]},this.rules[9].opcodes[8]={type:7,string:[43]},this.rules[9].opcodes[9]={type:7,string:[44]},this.rules[9].opcodes[10]={type:7,string:[59]},this.rules[9].opcodes[11]={type:7,string:[61]},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:1,children:[1,2]},this.rules[10].opcodes[1]={type:5,min:65,max:90},this.rules[10].opcodes[2]={type:5,min:97,max:122},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:5,min:48,max:57},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:1,children:[1,2,3,4,5,6,7]},this.rules[12].opcodes[1]={type:4,index:11},this.rules[12].opcodes[2]={type:7,string:[97]},this.rules[12].opcodes[3]={type:7,string:[98]},this.rules[12].opcodes[4]={type:7,string:[99]},this.rules[12].opcodes[5]={type:7,string:[100]},this.rules[12].opcodes[6]={type:7,string:[101]},this.rules[12].opcodes[7]={type:7,string:[102]},this.toString=function(){let e=\"\";return e+=`; OpenAPI Path Templating ABNF syntax\n`,e+=`; variant of https://datatracker.ietf.org/doc/html/rfc3986#section-3.3\n`,e+=`path-template                  = slash *( path-segment slash ) [ path-segment ]\n`,e+=`path-segment                   = 1*( path-literal / template-expression )\n`,e+=`slash                          = \"/\"\n`,e+=`path-literal                   = 1*pchar\n`,e+=`template-expression            = \"{\" template-expression-param-name \"}\"\n`,e+=`template-expression-param-name = 1*( %x00-7A / %x7C / %x7E-10FFFF ) ; every UTF8 character except { and } (from OpenAPI)\n`,e+=`\n`,e+=`; https://datatracker.ietf.org/doc/html/rfc3986#section-3.3\n`,e+=`pchar               = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n`,e+=`unreserved          = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n`,e+=`                    ; https://datatracker.ietf.org/doc/html/rfc3986#section-2.3\n`,e+=`pct-encoded         = \"%\" HEXDIG HEXDIG\n`,e+=`                    ; https://datatracker.ietf.org/doc/html/rfc3986#section-2.1\n`,e+=`sub-delims          = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n`,e+=`                    / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n`,e+=`                    ; https://datatracker.ietf.org/doc/html/rfc3986#section-2.2\n`,e+=`\n`,e+=`; https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1\n`,e+=`ALPHA               = %x41-5A / %x61-7A   ; A-Z / a-z\n`,e+=`DIGIT               = %x30-39            ; 0-9\n`,e+=`HEXDIG              = DIGIT / \"A\" / \"B\" / \"C\" / \"D\" / \"E\" / \"F\"\n`,e}}var Zre=(t,e,r,i,o)=>(t===Ke.SEM_PRE?o.push([\"slash\",Xt.charsToString(e,r,i)]):Ke.SEM_POST,Ke.SEM_OK),QB=Zre;var eie=(t,e,r,i,o)=>{if(t===Ke.SEM_PRE){if(Array.isArray(o)===!1)throw new Error(\"parser's user data must be an array\");o.push([\"path-template\",Xt.charsToString(e,r,i)])}return Ke.SEM_OK},ZB=eie;var tie=(t,e,r,i,o)=>(t===Ke.SEM_PRE?o.push([\"path-literal\",Xt.charsToString(e,r,i)]):Ke.SEM_POST,Ke.SEM_OK),e3=tie;var rie=(t,e,r,i,o)=>(t===Ke.SEM_PRE?o.push([\"template-expression\",Xt.charsToString(e,r,i)]):Ke.SEM_POST,Ke.SEM_OK),t3=rie;var iie=(t,e,r,i,o)=>(t===Ke.SEM_PRE?o.push([\"template-expression-param-name\",Xt.charsToString(e,r,i)]):Ke.SEM_POST,Ke.SEM_OK),r3=iie;var oie=new Ic,sie=t=>{let e=new Ze;return e.ast=new Jc,e.ast.callbacks[\"path-template\"]=ZB,e.ast.callbacks.slash=QB,e.ast.callbacks[\"path-literal\"]=e3,e.ast.callbacks[\"template-expression\"]=t3,e.ast.callbacks[\"template-expression-param-name\"]=r3,{result:e.parse(oie,\"path-template\",t),ast:e.ast}},On=sie;var nie=t=>{try{return typeof t==\"string\"&&decodeURIComponent(t)!==t}catch{return!1}},i3=t=>nie(t)?t:encodeURIComponent(t).replace(/%5B/g,\"[\").replace(/%5D/g,\"]\"),aie=[\"slash\",\"path-literal\",\"template-expression-param-name\"],cie=(t,e,r={})=>{let o={...{encoder:i3},...r},s=On(t);if(!s.result.success)return t;let n=[];return s.ast.translate(n),n.filter(([p])=>aie.includes(p)).map(([p,l])=>p===\"template-expression-param-name\"?Object.prototype.hasOwnProperty.call(e,l)?o.encoder(e[l],l):`{${l}}`:l).join(\"\")},Cc=cie;var Llt=new Ic,Blt=new Ze;var o3={body:die,header:xie,query:gie,path:yie,formData:hie};function die({req:t,value:e}){e!==void 0&&(t.body=e)}function hie({req:t,value:e,parameter:r}){if(e===!1&&r.type===\"boolean\"&&(e=\"false\"),e===0&&[\"number\",\"integer\"].indexOf(r.type)>-1&&(e=\"0\"),e)t.form=t.form||{},t.form[r.name]={collectionFormat:r.collectionFormat,value:e};else if(r.allowEmptyValue&&e!==void 0){t.form=t.form||{};let i=r.name;t.form[i]=t.form[i]||{},t.form[i].allowEmptyValue=!0}}function xie({req:t,parameter:e,value:r}){t.headers=t.headers||{},typeof r<\"u\"&&(t.headers[e.name]=r)}function yie({req:t,value:e,parameter:r,baseURL:i}){if(e!==void 0){let o=t.url.replace(i,\"\"),s=Cc(o,{[r.name]:e});t.url=i+s}}function gie({req:t,value:e,parameter:r}){if(t.query=t.query||{},e===!1&&r.type===\"boolean\"&&(e=\"false\"),e===0&&[\"number\",\"integer\"].indexOf(r.type)>-1&&(e=\"0\"),e)t.query[r.name]={collectionFormat:r.collectionFormat,value:e};else if(r.allowEmptyValue&&e!==void 0){let i=r.name;t.query[i]=t.query[i]||{},t.query[i].allowEmptyValue=!0}}var PA={};vr(PA,{cookie:()=>Hie,header:()=>Jie,path:()=>Lie,query:()=>Bie});var s3=Le(Er());function Tc(t,e){return(0,s3.default)(e).call(e,\"application/json\")?typeof t==\"string\"?t:(Array.isArray(t)&&(t=t.map(r=>{try{return JSON.parse(r)}catch{return r}})),JSON.stringify(t)):String(t)}function Xr(){this.grammarObject=\"grammarObject\",this.rules=[],this.rules[0]={name:\"lenient-cookie-string\",lower:\"lenient-cookie-string\",index:0,isBkr:!1},this.rules[1]={name:\"lenient-cookie-entry\",lower:\"lenient-cookie-entry\",index:1,isBkr:!1},this.rules[2]={name:\"lenient-cookie-pair\",lower:\"lenient-cookie-pair\",index:2,isBkr:!1},this.rules[3]={name:\"lenient-cookie-pair-invalid\",lower:\"lenient-cookie-pair-invalid\",index:3,isBkr:!1},this.rules[4]={name:\"lenient-cookie-name\",lower:\"lenient-cookie-name\",index:4,isBkr:!1},this.rules[5]={name:\"lenient-cookie-value\",lower:\"lenient-cookie-value\",index:5,isBkr:!1},this.rules[6]={name:\"lenient-quoted-value\",lower:\"lenient-quoted-value\",index:6,isBkr:!1},this.rules[7]={name:\"lenient-quoted-char\",lower:\"lenient-quoted-char\",index:7,isBkr:!1},this.rules[8]={name:\"lenient-cookie-octet\",lower:\"lenient-cookie-octet\",index:8,isBkr:!1},this.rules[9]={name:\"cookie-string\",lower:\"cookie-string\",index:9,isBkr:!1},this.rules[10]={name:\"cookie-pair\",lower:\"cookie-pair\",index:10,isBkr:!1},this.rules[11]={name:\"cookie-name\",lower:\"cookie-name\",index:11,isBkr:!1},this.rules[12]={name:\"cookie-value\",lower:\"cookie-value\",index:12,isBkr:!1},this.rules[13]={name:\"cookie-octet\",lower:\"cookie-octet\",index:13,isBkr:!1},this.rules[14]={name:\"OWS\",lower:\"ows\",index:14,isBkr:!1},this.rules[15]={name:\"token\",lower:\"token\",index:15,isBkr:!1},this.rules[16]={name:\"tchar\",lower:\"tchar\",index:16,isBkr:!1},this.rules[17]={name:\"CHAR\",lower:\"char\",index:17,isBkr:!1},this.rules[18]={name:\"CTL\",lower:\"ctl\",index:18,isBkr:!1},this.rules[19]={name:\"separators\",lower:\"separators\",index:19,isBkr:!1},this.rules[20]={name:\"SP\",lower:\"sp\",index:20,isBkr:!1},this.rules[21]={name:\"HT\",lower:\"ht\",index:21,isBkr:!1},this.rules[22]={name:\"ALPHA\",lower:\"alpha\",index:22,isBkr:!1},this.rules[23]={name:\"DIGIT\",lower:\"digit\",index:23,isBkr:!1},this.rules[24]={name:\"DQUOTE\",lower:\"dquote\",index:24,isBkr:!1},this.rules[25]={name:\"WSP\",lower:\"wsp\",index:25,isBkr:!1},this.rules[26]={name:\"HTAB\",lower:\"htab\",index:26,isBkr:!1},this.rules[27]={name:\"CRLF\",lower:\"crlf\",index:27,isBkr:!1},this.rules[28]={name:\"CR\",lower:\"cr\",index:28,isBkr:!1},this.rules[29]={name:\"LF\",lower:\"lf\",index:29,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,2]},this.rules[0].opcodes[1]={type:4,index:1},this.rules[0].opcodes[2]={type:3,min:0,max:1/0},this.rules[0].opcodes[3]={type:2,children:[4,5,6]},this.rules[0].opcodes[4]={type:7,string:[59]},this.rules[0].opcodes[5]={type:4,index:14},this.rules[0].opcodes[6]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:1,children:[1,2]},this.rules[1].opcodes[1]={type:4,index:2},this.rules[1].opcodes[2]={type:4,index:3},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:2,children:[1,2,3,4,5,6,7]},this.rules[2].opcodes[1]={type:4,index:14},this.rules[2].opcodes[2]={type:4,index:4},this.rules[2].opcodes[3]={type:4,index:14},this.rules[2].opcodes[4]={type:7,string:[61]},this.rules[2].opcodes[5]={type:4,index:14},this.rules[2].opcodes[6]={type:4,index:5},this.rules[2].opcodes[7]={type:4,index:14},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2,4]},this.rules[3].opcodes[1]={type:4,index:14},this.rules[3].opcodes[2]={type:3,min:1,max:1/0},this.rules[3].opcodes[3]={type:4,index:16},this.rules[3].opcodes[4]={type:4,index:14},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:3,min:1,max:1/0},this.rules[4].opcodes[1]={type:1,children:[2,3,4]},this.rules[4].opcodes[2]={type:5,min:33,max:58},this.rules[4].opcodes[3]={type:6,string:[60]},this.rules[4].opcodes[4]={type:5,min:62,max:126},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,6]},this.rules[5].opcodes[1]={type:2,children:[2,3]},this.rules[5].opcodes[2]={type:4,index:6},this.rules[5].opcodes[3]={type:3,min:0,max:1},this.rules[5].opcodes[4]={type:3,min:0,max:1/0},this.rules[5].opcodes[5]={type:4,index:8},this.rules[5].opcodes[6]={type:3,min:0,max:1/0},this.rules[5].opcodes[7]={type:4,index:8},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:2,children:[1,2,4]},this.rules[6].opcodes[1]={type:4,index:24},this.rules[6].opcodes[2]={type:3,min:0,max:1/0},this.rules[6].opcodes[3]={type:4,index:7},this.rules[6].opcodes[4]={type:4,index:24},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,2]},this.rules[7].opcodes[1]={type:5,min:32,max:33},this.rules[7].opcodes[2]={type:5,min:35,max:126},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:1,children:[1,2,3]},this.rules[8].opcodes[1]={type:5,min:33,max:43},this.rules[8].opcodes[2]={type:5,min:45,max:58},this.rules[8].opcodes[3]={type:5,min:60,max:126},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:2,children:[1,2]},this.rules[9].opcodes[1]={type:4,index:10},this.rules[9].opcodes[2]={type:3,min:0,max:1/0},this.rules[9].opcodes[3]={type:2,children:[4,5,6]},this.rules[9].opcodes[4]={type:7,string:[59]},this.rules[9].opcodes[5]={type:4,index:20},this.rules[9].opcodes[6]={type:4,index:10},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:2,children:[1,2,3]},this.rules[10].opcodes[1]={type:4,index:11},this.rules[10].opcodes[2]={type:7,string:[61]},this.rules[10].opcodes[3]={type:4,index:12},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:4,index:15},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:1,children:[1,6]},this.rules[12].opcodes[1]={type:2,children:[2,3,5]},this.rules[12].opcodes[2]={type:4,index:24},this.rules[12].opcodes[3]={type:3,min:0,max:1/0},this.rules[12].opcodes[4]={type:4,index:13},this.rules[12].opcodes[5]={type:4,index:24},this.rules[12].opcodes[6]={type:3,min:0,max:1/0},this.rules[12].opcodes[7]={type:4,index:13},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:1,children:[1,2,3,4,5]},this.rules[13].opcodes[1]={type:6,string:[33]},this.rules[13].opcodes[2]={type:5,min:35,max:43},this.rules[13].opcodes[3]={type:5,min:45,max:58},this.rules[13].opcodes[4]={type:5,min:60,max:91},this.rules[13].opcodes[5]={type:5,min:93,max:126},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:3,min:0,max:1/0},this.rules[14].opcodes[1]={type:2,children:[2,4]},this.rules[14].opcodes[2]={type:3,min:0,max:1},this.rules[14].opcodes[3]={type:4,index:27},this.rules[14].opcodes[4]={type:4,index:25},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:3,min:1,max:1/0},this.rules[15].opcodes[1]={type:4,index:16},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]},this.rules[16].opcodes[1]={type:7,string:[33]},this.rules[16].opcodes[2]={type:7,string:[35]},this.rules[16].opcodes[3]={type:7,string:[36]},this.rules[16].opcodes[4]={type:7,string:[37]},this.rules[16].opcodes[5]={type:7,string:[38]},this.rules[16].opcodes[6]={type:7,string:[39]},this.rules[16].opcodes[7]={type:7,string:[42]},this.rules[16].opcodes[8]={type:7,string:[43]},this.rules[16].opcodes[9]={type:7,string:[45]},this.rules[16].opcodes[10]={type:7,string:[46]},this.rules[16].opcodes[11]={type:7,string:[94]},this.rules[16].opcodes[12]={type:7,string:[95]},this.rules[16].opcodes[13]={type:7,string:[96]},this.rules[16].opcodes[14]={type:7,string:[124]},this.rules[16].opcodes[15]={type:7,string:[126]},this.rules[16].opcodes[16]={type:4,index:23},this.rules[16].opcodes[17]={type:4,index:22},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:5,min:1,max:127},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:1,children:[1,2]},this.rules[18].opcodes[1]={type:5,min:0,max:31},this.rules[18].opcodes[2]={type:6,string:[127]},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]},this.rules[19].opcodes[1]={type:7,string:[40]},this.rules[19].opcodes[2]={type:7,string:[41]},this.rules[19].opcodes[3]={type:7,string:[60]},this.rules[19].opcodes[4]={type:7,string:[62]},this.rules[19].opcodes[5]={type:7,string:[64]},this.rules[19].opcodes[6]={type:7,string:[44]},this.rules[19].opcodes[7]={type:7,string:[59]},this.rules[19].opcodes[8]={type:7,string:[58]},this.rules[19].opcodes[9]={type:7,string:[92]},this.rules[19].opcodes[10]={type:6,string:[34]},this.rules[19].opcodes[11]={type:7,string:[47]},this.rules[19].opcodes[12]={type:7,string:[91]},this.rules[19].opcodes[13]={type:7,string:[93]},this.rules[19].opcodes[14]={type:7,string:[63]},this.rules[19].opcodes[15]={type:7,string:[61]},this.rules[19].opcodes[16]={type:7,string:[123]},this.rules[19].opcodes[17]={type:7,string:[125]},this.rules[19].opcodes[18]={type:4,index:20},this.rules[19].opcodes[19]={type:4,index:21},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:6,string:[32]},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:6,string:[9]},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:1,children:[1,2]},this.rules[22].opcodes[1]={type:5,min:65,max:90},this.rules[22].opcodes[2]={type:5,min:97,max:122},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:5,min:48,max:57},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:6,string:[34]},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:1,children:[1,2]},this.rules[25].opcodes[1]={type:4,index:20},this.rules[25].opcodes[2]={type:4,index:26},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:6,string:[9]},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:2,children:[1,2]},this.rules[27].opcodes[1]={type:4,index:28},this.rules[27].opcodes[2]={type:4,index:29},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:6,string:[13]},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:6,string:[10]},this.toString=function(){let e=\"\";return e+=`; Lenient version of https://datatracker.ietf.org/doc/html/rfc6265#section-4.2.1\n`,e+=`lenient-cookie-string        = lenient-cookie-entry *( \";\" OWS lenient-cookie-entry )\n`,e+=`lenient-cookie-entry         = lenient-cookie-pair / lenient-cookie-pair-invalid\n`,e+=`lenient-cookie-pair          = OWS lenient-cookie-name OWS \"=\" OWS lenient-cookie-value OWS\n`,e+=`lenient-cookie-pair-invalid  = OWS 1*tchar OWS ; Allow for standalone entries like \"fizz\" to be ignored\n`,e+=`lenient-cookie-name          = 1*( %x21-3A / %x3C / %x3E-7E ) ; Allow all printable US-ASCII except \"=\"\n`,e+=`lenient-cookie-value         = lenient-quoted-value [ *lenient-cookie-octet ] / *lenient-cookie-octet\n`,e+=`lenient-quoted-value         = DQUOTE *( lenient-quoted-char ) DQUOTE\n`,e+=`lenient-quoted-char          = %x20-21 / %x23-7E ; Allow all printable US-ASCII except DQUOTE\n`,e+=`lenient-cookie-octet         = %x21-2B / %x2D-3A / %x3C-7E\n`,e+=`                             ; Allow all printable characters except CTLs, semicolon and SP\n`,e+=`\n`,e+=`; https://datatracker.ietf.org/doc/html/rfc6265#section-4.2.1\n`,e+=`cookie-string     = cookie-pair *( \";\" SP cookie-pair )\n`,e+=`\n`,e+=`; https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1\n`,e+=`; https://www.rfc-editor.org/errata/eid5518\n`,e+=`cookie-pair       = cookie-name \"=\" cookie-value\n`,e+=`cookie-name       = token\n`,e+=`cookie-value      = ( DQUOTE *cookie-octet DQUOTE ) / *cookie-octet\n`,e+=`                  ; https://www.rfc-editor.org/errata/eid8242\n`,e+=`cookie-octet      = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E\n`,e+=`                       ; US-ASCII characters excluding CTLs,\n`,e+=`                       ; whitespace, DQUOTE, comma, semicolon,\n`,e+=`                       ; and backslash\n`,e+=`\n`,e+=`; https://datatracker.ietf.org/doc/html/rfc6265#section-2.2\n`,e+=`OWS            = *( [ CRLF ] WSP ) ; \"optional\" whitespace\n`,e+=`\n`,e+=`; https://datatracker.ietf.org/doc/html/rfc9110#section-5.6.2\n`,e+=`token          = 1*(tchar)\n`,e+=`tchar          = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" / \"*\"\n`,e+='                 / \"+\" / \"-\" / \".\" / \"^\" / \"_\" / \"`\" / \"|\" / \"~\"\\n',e+=`                 / DIGIT / ALPHA\n`,e+=`                 ; any VCHAR, except delimiters\n`,e+=`\n`,e+=`; https://datatracker.ietf.org/doc/html/rfc2616#section-2.2\n`,e+=`CHAR           = %x01-7F ; any US-ASCII character (octets 0 - 127)\n`,e+=`CTL            = %x00-1F / %x7F ; any US-ASCII control character\n`,e+=`separators     = \"(\" / \")\" / \"<\" / \">\" / \"@\" / \",\" / \";\" / \":\" / \"\\\\\" / %x22 / \"/\" / \"[\" / \"]\" / \"?\" / \"=\" / \"{\" / \"}\" / SP / HT\n`,e+=`SP             = %x20 ; US-ASCII SP, space (32)\n`,e+=`HT             = %x09 ; US-ASCII HT, horizontal-tab (9)\n`,e+=`\n`,e+=`; https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1\n`,e+=`ALPHA          =  %x41-5A / %x61-7A ; A-Z / a-z\n`,e+=`DIGIT          =  %x30-39 ; 0-9\n`,e+=`DQUOTE         =  %x22 ; \" (Double Quote)\n`,e+=`WSP            =  SP / HTAB ; white space\n`,e+=`HTAB           =  %x09 ; horizontal tab\n`,e+=`CRLF           =  CR LF ; Internet standard newline\n`,e+=`CR             =  %x0D ; carriage return\n`,e+=`LF             =  %x0A ; linefeed\n`,e}}var Fut=new Xr;var Iu=t=>{if(typeof t!=\"string\"||[...t].length!==1)throw new TypeError(\"Input must be a single character string.\");let e=t.codePointAt(0);return e<=127?`%${e.toString(16).toUpperCase().padStart(2,\"0\")}`:encodeURIComponent(t)},n3=t=>t.replace(/\\+/g,\"-\").replace(/\\//g,\"_\").replace(/=+$/g,\"\");var Ds=t=>t.length>=2&&t.startsWith('\"')&&t.endsWith('\"'),Mc=t=>Ds(t)?t.slice(1,-1):t,Fc=t=>`\"${t}\"`,Cu=t=>t;var vie=new Ze,Eie=new Xr,bie=(t,{strict:e=!0,quoted:r=null}={})=>{try{let i=e?\"cookie-value\":\"lenient-cookie-value\",o=vie.parse(Eie,i,t);return typeof r==\"boolean\"?o.success&&r===Ds(t):o.success}catch{return!1}},qs=bie;var Sie=t=>{let r=new TextEncoder().encode(t).reduce((i,o)=>i+String.fromCharCode(o),\"\");return btoa(r)},$c=Sie;var Oie=(t,e=$c)=>{let r=String(t);if(qs(r))return r;let i=Ds(r),o=i?Mc(r):r,s=e(o);return i?Fc(s):s},vA=Oie;var wie=t=>n3($c(t)),Jm=wie;var jie=t=>vA(t,Jm),EA=jie;var Pie=new Ze,Aie=new Xr,Rie=(t,{strict:e=!0}={})=>{try{let r=e?\"cookie-name\":\"lenient-cookie-name\";return Pie.parse(Aie,r,t).success}catch{return!1}},Nc=Rie;var _ie=t=>{if(!Nc(t))throw new TypeError(`Invalid cookie name: ${t}`)},bA=_ie;var Iie=t=>{if(!qs(t))throw new TypeError(`Invalid cookie value: ${t}`)},Tu=Iie;var SA={encoders:{name:Cu,value:EA},validators:{name:bA,value:Tu}},Cie=(t,e,r={})=>{let i={...SA,...r,encoders:{...SA.encoders,...r.encoders},validators:{...SA.validators,...r.validators}},o=i.encoders.name(t),s=i.encoders.value(e);return i.validators.name(o),i.validators.value(s),`${o}=${s}`},a3=Cie;var Tie=(t,e={})=>(Array.isArray(t)?t:typeof t==\"object\"&&t!==null?Object.entries(t):[]).map(([i,o])=>a3(i,o,e)).join(\"; \"),OA=Tie;var Mie=new Ze,Fie=new Xr,$ie=t=>{let e=String(t);if(qs(e))return e;let r=Ds(e),i=r?Mc(e):e,o=\"\";for(let s of i)o+=Mie.parse(Fie,\"cookie-octet\",s).success?s:Iu(s);return r?Fc(o):o},wA=$ie;var Apt=new Ze,Rpt=new Xr;var kie=t=>{if(!Nc(t,{strict:!1}))throw new TypeError(`Invalid cookie name: ${t}`)},jA=kie;var Die=\"%3D\",qie=\"%26\",Vie=t=>wA(t).replace(/[=&]/gu,e=>e===\"=\"?Die:qie),Mu=(t,e={})=>OA(t,Zs({encoders:{name:Cu,value:Vie},validators:{name:jA,value:Tu}},e));function Lie({req:t,value:e,parameter:r,baseURL:i}){let{name:o,style:s,explode:n,content:a}=r;if(e===void 0)return;let p=t.url.replace(i,\"\"),l;if(a){let u=Object.keys(a)[0];l=Cc(p,{[o]:e},{encoder:f=>Qm(Tc(f,u))})}else l=Cc(p,{[o]:e},{encoder:u=>zc({key:r.name,value:u,style:s||\"simple\",explode:n??!1,escape:\"reserved\"})});t.url=i+l}function Bie({req:t,value:e,parameter:r}){if(t.query=t.query||{},e!==void 0&&r.content){let i=Object.keys(r.content)[0],o=Tc(e,i);if(o)t.query[r.name]=o;else if(r.allowEmptyValue){let s=r.name;t.query[s]=t.query[s]||{},t.query[s].allowEmptyValue=!0}return}if(e===!1&&(e=\"false\"),e===0&&(e=\"0\"),e){let{style:i,explode:o,allowReserved:s}=r;t.query[r.name]={value:e,serializationOption:{style:i,explode:o,allowReserved:s}}}else if(r.allowEmptyValue&&e!==void 0){let i=r.name;t.query[i]=t.query[i]||{},t.query[i].allowEmptyValue=!0}}var Uie=[\"accept\",\"authorization\",\"content-type\"];function Jie({req:t,parameter:e,value:r}){if(t.headers=t.headers||{},!(Uie.indexOf(e.name.toLowerCase())>-1)){if(r!==void 0&&e.content){let i=Object.keys(e.content)[0];t.headers[e.name]=Tc(r,i);return}r!==void 0&&!(Array.isArray(r)&&r.length===0)&&(t.headers[e.name]=zc({key:e.name,value:r,style:e.style||\"simple\",explode:typeof e.explode>\"u\"?!1:e.explode,escape:!1}))}}function Hie({req:t,parameter:e,value:r}){let{name:i}=e;if(t.headers=t.headers||{},r!==void 0&&e.content){let o=Object.keys(e.content)[0],s=Tc(r,o);t.headers.Cookie=Mu({[i]:s});return}if(r!==void 0&&!(Array.isArray(r)&&r.length===0)){let o=zc({key:e.name,value:r,escape:!1,style:e.style||\"form\",explode:e.explode??!1}),s=Array.isArray(r)&&e.explode?`${i}=${o}`:o;t.headers.Cookie=Mu({[i]:s})}}var zie=typeof globalThis<\"u\"?globalThis:typeof self<\"u\"?self:window,{btoa:Kie}=zie,Hm=Kie;function AA(t,e){let{operation:r,requestBody:i,securities:o,spec:s,attachContentTypeForEmptyPayload:n}=t,{requestContentType:a}=t;e=Wie({request:e,securities:o,operation:r,spec:s});let p=r.requestBody||{},l=Object.keys(p.content||{}),u=a&&l.indexOf(a)>-1;if(i||n){if(a&&u)e.headers[\"Content-Type\"]=a;else if(!a){let f=l[0];f&&(e.headers[\"Content-Type\"]=f,a=f)}}else a&&u&&(e.headers[\"Content-Type\"]=a);if(!t.responseContentType&&r.responses){let f=Object.entries(r.responses).filter(([m,x])=>{let h=parseInt(m,10);return h>=200&&h<300&&nt(x.content)}).reduce((m,[,x])=>m.concat(Object.keys(x.content)),[]);f.length>0&&(e.headers.accept=f.join(\", \"))}if(i)if(a){if(l.indexOf(a)>-1)if(a===\"application/x-www-form-urlencoded\"||a===\"multipart/form-data\")if(typeof i==\"object\"){let f=p.content[a]?.encoding??{};e.form={},Object.keys(i).forEach(m=>{let x;try{x=JSON.parse(i[m])}catch{x=i[m]}e.form[m]={value:x,encoding:f[m]||{}}})}else if(typeof i==\"string\"){let f=p.content[a]?.encoding??{};try{e.form={};let m=JSON.parse(i);Object.entries(m).forEach(([x,h])=>{e.form[x]={value:h,encoding:f[x]||{}}})}catch{e.form=i}}else e.form=i;else e.body=i}else e.body=i;return e}function Wie({request:t,securities:e={},operation:r={},spec:i}){let o={...t},{authorized:s={}}=e,n=r.security||i.security||[],a=s&&!!Object.keys(s).length,p=i?.components?.securitySchemes||{};return o.headers=o.headers||{},o.query=o.query||{},!Object.keys(e).length||!a||!n||Array.isArray(r.security)&&!r.security.length?t:(n.forEach(l=>{Object.keys(l).forEach(u=>{let f=s[u],m=p[u];if(!f)return;let x=f.value||f,{type:h}=m;if(f){if(h===\"apiKey\")m.in===\"query\"&&(o.query[m.name]=x),m.in===\"header\"&&(o.headers[m.name]=x),m.in===\"cookie\"&&(o.cookies[m.name]=x);else if(h===\"http\"){if(/^basic$/i.test(m.scheme)){let O=x.username||\"\",j=x.password||\"\",v=Hm(`${O}:${j}`);o.headers.Authorization=`Basic ${v}`}/^bearer$/i.test(m.scheme)&&(o.headers.Authorization=`Bearer ${x}`)}else if(h===\"oauth2\"||h===\"openIdConnect\"){let O=f.token||{},j=m[\"x-tokenName\"]||\"access_token\",v=O[j],E=O.token_type;(!E||E.toLowerCase()===\"bearer\")&&(E=\"Bearer\"),o.headers.Authorization=`${E} ${v}`}}})}),o)}function RA(t,e){let{spec:r,operation:i,securities:o,requestContentType:s,responseContentType:n,attachContentTypeForEmptyPayload:a}=t;if(e=Gie({request:e,securities:o,operation:i,spec:r}),e.body||e.form||a)s?e.headers[\"Content-Type\"]=s:Array.isArray(i.consumes)?[e.headers[\"Content-Type\"]]=i.consumes:Array.isArray(r.consumes)?[e.headers[\"Content-Type\"]]=r.consumes:i.parameters&&i.parameters.filter(p=>p.type===\"file\").length?e.headers[\"Content-Type\"]=\"multipart/form-data\":i.parameters&&i.parameters.filter(p=>p.in===\"formData\").length&&(e.headers[\"Content-Type\"]=\"application/x-www-form-urlencoded\");else if(s){let p=i.parameters&&i.parameters.filter(u=>u.in===\"body\").length>0,l=i.parameters&&i.parameters.filter(u=>u.in===\"formData\").length>0;(p||l)&&(e.headers[\"Content-Type\"]=s)}return!n&&Array.isArray(i.produces)&&i.produces.length>0&&(e.headers.accept=i.produces.join(\", \")),e}function Gie({request:t,securities:e={},operation:r={},spec:i}){let o={...t},{authorized:s={},specSecurity:n=[]}=e,a=r.security||n,p=s&&!!Object.keys(s).length,l=i.securityDefinitions;return o.headers=o.headers||{},o.query=o.query||{},!Object.keys(e).length||!p||!a||Array.isArray(r.security)&&!r.security.length?t:(a.forEach(u=>{Object.keys(u).forEach(f=>{let m=s[f];if(!m)return;let{token:x}=m,h=m.value||m,O=l[f],{type:j}=O,v=O[\"x-tokenName\"]||\"access_token\",E=x&&x[v],y=x&&x.token_type;if(m)if(j===\"apiKey\"){let g=O.in===\"query\"?\"query\":\"headers\";o[g]=o[g]||{},o[g][O.name]=h}else if(j===\"basic\")if(h.header)o.headers.authorization=h.header;else{let g=h.username||\"\",q=h.password||\"\";h.base64=Hm(`${g}:${q}`),o.headers.authorization=`Basic ${h.base64}`}else j===\"oauth2\"&&E&&(y=!y||y.toLowerCase()===\"bearer\"?\"Bearer\":y,o.headers.authorization=`${y} ${E}`)})}),o)}var c3=t=>Array.isArray(t)?t:[],Yie=/^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/,Xie=t=>typeof t==\"string\"&&Yie.test(t),Fu=(t,{recurse:e=!0,depth:r=1}={})=>{var i,o;if(nt(t)){if(t.type===\"object\"||t.type===\"array\"||Array.isArray(t.type)&&((0,CA.default)(i=t.type).call(i,\"object\")||(0,CA.default)(o=t.type).call(o,\"array\")))return t;if(!(r>zu)&&e){let s=Array.isArray(t.oneOf)?t.oneOf.find(a=>Fu(a,{recurse:e,depth:r+1})):void 0;if(s)return s;let n=Array.isArray(t.anyOf)?t.anyOf.find(a=>Fu(a,{recurse:e,depth:r+1})):void 0;if(n)return n}}},_A=({value:t,silentFail:e=!1})=>{try{let r=JSON.parse(t);if(nt(r)||Array.isArray(r))return r;if(!e)throw new Error(\"Expected JSON serialized object or array\")}catch{if(!e)throw new Error(\"Could not parse parameter value string as JSON Object or JSON Array\")}return t},zm=t=>{try{return new URL(t)}catch{let e=new URL(t,ko),r=String(t).startsWith(\"/\")?e.pathname:e.pathname.substring(1);return{hash:e.hash,host:\"\",hostname:\"\",href:\"\",origin:\"\",password:\"\",pathname:r,port:\"\",protocol:\"\",search:e.search,searchParams:e.searchParams}}},TA=class extends yt{},Qie=(t,e)=>e.filter(r=>r.name===t),Zie=t=>{let e={};t.forEach(i=>{e[i.in]||(e[i.in]={}),e[i.in][i.name]=i});let r=[];return Object.keys(e).forEach(i=>{Object.keys(e[i]).forEach(o=>{r.push(e[i][o])})}),r},eoe={buildRequest:FA};function l3({http:t,fetch:e,spec:r,operationId:i,pathName:o,method:s,parameters:n,securities:a,...p}){let l=t||e||Zr;o&&s&&!i&&(i=_c(o,s));let u=eoe.buildRequest({spec:r,operationId:i,parameters:n,securities:a,http:l,...p});return u.body&&(nt(u.body)||Array.isArray(u.body))&&(u.body=JSON.stringify(u.body)),l(u)}function FA(t){let{spec:e,operationId:r,responseContentType:i,scheme:o,requestInterceptor:s,responseInterceptor:n,contextUrl:a,userFetch:p,server:l,serverVariables:u,http:f,signal:m,serverVariableEncoder:x}=t,{parameters:h,parameterBuilders:O,baseURL:j}=t,v=ru(e);O||(v?O=PA:O=o3);let y={url:\"\",credentials:f&&f.withCredentials?\"include\":\"same-origin\",headers:{},cookies:{}};m&&(y.signal=m),s&&(y.requestInterceptor=s),n&&(y.responseInterceptor=n),p&&(y.userFetch=p);let g=Um(e,r);if(!g)throw new TA(`Operation ${r} not found`);let{operation:q={},method:V,pathName:C}=g;if(!Xie(V))throw new Error(\"Invalid HTTP method\");if(j=j??$A({spec:e,scheme:o,contextUrl:a,server:l,serverVariables:u,pathName:C,method:V,operation:q,serverVariableEncoder:x}),y.url+=j,!r)return delete y.cookies,y;y.url+=C,y.method=V,h=h||{};let oe=e.paths[C]||{};i&&(y.headers.accept=i);let M=Zie([].concat(c3(q.parameters)).concat(c3(oe.parameters)));M.forEach(H=>{let k=O[H.in],W;if(H.in===\"body\"&&H.schema&&H.schema.properties&&(W=h),W=H&&H.name&&h[H.name],typeof W>\"u\"?W=H&&H.name&&h[`${H.in}.${H.name}`]:Qie(H.name,M).length>1&&console.warn(`Parameter '${H.name}' is ambiguous because the defined spec has more than one parameter with the name: '${H.name}' and the passed-in parameter values did not define an 'in' value.`),W!==null){if(typeof H.default<\"u\"&&typeof W>\"u\"&&(W=H.default),typeof W>\"u\"&&H.required&&!H.allowEmptyValue)throw new Error(`Required parameter ${H.name} is not provided`);v&&typeof W==\"string\"&&(Uo(\"type\",H.schema)&&typeof H.schema.type==\"string\"&&Fu(H.schema,{recurse:!1})?W=_A({value:W,silentFail:!1}):Uo(\"type\",H.schema)&&Array.isArray(H.schema.type)&&Fu(H.schema,{recurse:!1})?W=_A({value:W,silentFail:!0}):!Uo(\"type\",H.schema)&&Fu(H.schema,{recurse:!0})&&(W=_A({value:W,silentFail:!0}))),k&&k({req:y,parameter:H,value:W,operation:q,spec:e,baseURL:j})}});let te={...t,operation:q};if(v?y=AA(te,y):y=RA(te,y),y.cookies&&Object.keys(y.cookies).length>0){let H=Mu(y.cookies);zo(y.headers.Cookie)?y.headers.Cookie+=`; ${H}`:y.headers.Cookie=H}return y.cookies&&delete y.cookies,Kc(y)}var MA=t=>t?t.replace(/\\W/g,\"\"):null;function $A(t){return ru(t.spec)?toe(t):ioe(t)}var IA=t=>Array.isArray(t)&&t.length>0;function toe({spec:t,pathName:e,method:r,operation:i,server:o,contextUrl:s,serverVariables:n={},serverVariableEncoder:a}){let p=[],l=\"\",u,f=i?.servers??t?.paths?.[e]?.[(r||\"\").toLowerCase()]?.servers,m=t?.paths?.[e]?.servers,x=t?.servers;if(p=IA(f)?f:IA(m)?m:IA(x)?x:[Hu],o&&(u=p.find(h=>h.url===o),u&&(l=o)),l||([u]=p,l=u.url),DA(l,{strict:!0})){let h=Object.entries({...u.variables}).reduce((O,[j,v])=>(O[j]=v.default,O),{});l=qA(l,{...h,...n},{encoder:typeof a==\"function\"?a:El})}return roe(l,s)}function roe(t=\"\",e=\"\"){let r=zm(t&&e?ae.resolve(e,t):t),i=zm(e),o=MA(r.protocol)||MA(i.protocol),s=r.host||i.host,n=r.pathname,a;return o&&s?a=`${o}://${s+n}`:a=n,a[a.length-1]===\"/\"?a.slice(0,-1):a}function ioe({spec:t,scheme:e,contextUrl:r=\"\"}){let i=zm(r),o=Array.isArray(t.schemes)?t.schemes[0]:null,s=e||o||MA(i.protocol)||\"http\",n=t.host||i.host||\"\",a=t.basePath||\"\",p;return s&&n?p=`${s}://${n+a}`:p=a,p[p.length-1]===\"/\"?p.slice(0,-1):p}Ie.http=Zr;Ie.makeHttp=H_.bind(null,Ie.http);Ie.resolveStrategies={\"openapi-3-2-apidom\":GB,\"openapi-3-1-apidom\":S2,\"openapi-3-0\":ac,\"openapi-2-0\":nc,generic:sc};Ie.resolve=Cg({strategies:[Ie.resolveStrategies[\"openapi-3-2-apidom\"],Ie.resolveStrategies[\"openapi-3-1-apidom\"],Ie.resolveStrategies[\"openapi-3-0\"],Ie.resolveStrategies[\"openapi-2-0\"],Ie.resolveStrategies.generic]});Ie.resolveSubtree=Tg({strategies:[Ie.resolveStrategies[\"openapi-3-2-apidom\"],Ie.resolveStrategies[\"openapi-3-1-apidom\"],Ie.resolveStrategies[\"openapi-3-0\"],Ie.resolveStrategies[\"openapi-2-0\"],Ie.resolveStrategies.generic]});Ie.execute=l3;Ie.serializeRes=lp;Ie.serializeHeaders=ih;Ie.clearCache=Tf;Ie.makeApisTagOperation=XB;Ie.buildRequest=FA;Ie.helpers={opId:wr};Ie.getBaseUrl=$A;Ie.apidom={resolve:{resolvers:{HTTPResolverSwaggerClient:vc}},parse:{parsers:{JsonParser:Ec,YamlParser:bc,OpenApiJson3_1Parser:Rm,OpenApiYaml3_1Parser:_m,OpenApiJson3_2Parser:Nm,OpenApiYaml3_2Parser:km}},dereference:{strategies:{OpenApi3_1SwaggerClientDereferenceStrategy:Tm,OpenApi3_2SwaggerClientDereferenceStrategy:Vm}}};function Ie(t,e={}){if(typeof t==\"string\"?e.url=t:e=t,!(this instanceof Ie))return new Ie(e);Object.assign(this,e);let r=this.resolve().then(()=>(this.disableInterfaces||Object.assign(this,Ie.makeApisTagOperation(this)),this));return r.client=this,r}Ie.prototype={http:Zr,execute(t){return this.applyDefaults(),Ie.execute({spec:this.spec,http:this.http,securities:{authorized:this.authorizations},contextUrl:typeof this.url==\"string\"?this.url:void 0,requestInterceptor:this.requestInterceptor||null,responseInterceptor:this.responseInterceptor||null,...t})},resolve(t={}){return Ie.resolve({spec:this.spec,url:this.url,http:this.http||this.fetch,allowMetaPatches:this.allowMetaPatches,useCircularStructures:this.useCircularStructures,requestInterceptor:this.requestInterceptor||null,responseInterceptor:this.responseInterceptor||null,pathDiscriminator:this.pathDiscriminator||[],skipNormalization:this.skipNormalization||!1,...t}).then(e=>(this.originalSpec=this.spec,this.spec=e.spec,this.errors=e.errors,this))}};Ie.prototype.applyDefaults=function(){let{spec:e}=this,r=this.url;if(Mf(e)&&gA(r)){let i=new URL(r);e.host||(e.host=i.host),e.schemes||(e.schemes=[i.protocol.replace(\":\",\"\")]),e.basePath||(e.basePath=\"/\")}else if(ru(e)){let i=Array.isArray(e.servers)&&e.servers.length===0;(!e.servers||i)&&(e.servers=[Hu])}};var{helpers:umt}=Ie,pmt=Ie;export{pmt as default,umt as helpers};\n/*! Bundled license information:\n\nfast-json-patch/module/helpers.mjs:\n  (*!\n   * https://github.com/Starcounter-Jack/JSON-Patch\n   * (c) 2017-2022 Joachim Wester\n   * MIT licensed\n   *)\n\nfast-json-patch/module/duplex.mjs:\n  (*!\n   * https://github.com/Starcounter-Jack/JSON-Patch\n   * (c) 2017-2021 Joachim Wester\n   * MIT license\n   *)\n*/\n","node_modules/apps/index.js":"import{a as O,b as h,c as Pe,d as qe,e as Ne,f as z,g as Fe,h as Te,i as H,k as Ve,l as Le,q as Ke}from\"./chunk-6IAPTKU4.js\";import{a as Q,b as S,c as je,d as We,e as $,f as Je,g as R,h as X,j as He,k as Qe,o as $e,p as Be}from\"./chunk-H64J6GLT.js\";import{A as Ce,B as Re,C as be,D as Ee,E as De,F as Ie,G as W,H as J,I as U,J as _,L as C,X as Me,da as f,n as x,q as v,r as N,t as F,u as T,v as j,w as Oe,x as ge,y as we,z as ve}from\"./chunk-G6QGZRZI.js\";import{D as Ae,E as ke,K as M,Pa as ze,Qb as B,R as g,Rb as V,S as P,Sb as L,T as q,W as w,fc as K,gc as G,o as I,p as k,s as ye,t as he,u as Se,w as xe,wa as Ue,xa as _e}from\"./chunk-DI7JLZ3C.js\";import{Ob as a,rd as p}from\"./chunk-IRY5FGME.js\";import\"./chunk-OOJM4CTU.js\";var Y=(e,t)=>a.gen(function*(){if(e.status<200||e.status>=300)return yield*a.fail(new O({status:e.status}));let o=yield*e.json();return yield*F(t,o).pipe(a.mapError(()=>new h))});var Z=e=>new M(e),Ge=p.is(p.Struct({grant:p.Literal(\"client_credentials\")})),Xe=e=>{let[t,o,n,r]=g.members,s=typeof e==\"object\"&&e!==null&&Object.hasOwn(e,\"discover\");return Ge(e)?s?n:r:s?t:o},ee=(e,t,o,n)=>T(g,e,\"oauth2()\",Xe).pipe(a.map(r=>new q({config:r,response:t,...o===void 0?{}:{exposure:o},...n===void 0?{}:{request:n}}))),Ye=({health:e,...t})=>{let o=Object.entries(t.auth).filter(([,r])=>r.request!==void 0);if(t.hosts===void 0&&o.length>0)throw new TypeError(`Provider \"${t.name}\" declares a request for ${o.map(([r])=>r).join(\", \")} but no hosts. Declare the hosts its credentials may be sent to.`);if(e===void 0)return new w(t);let n=x(e,\"check\");return new w({...t,health:{run:n}})};var oe=e=>{let t=J(e);if(t!==void 0)return p.decodeUnknownSync(k)(t);let o=p.toJsonSchemaDocument(e);return p.decodeUnknownSync(k)({...o.schema,$defs:o.definitions})},ne=e=>{let t=new Map;for(let[s,d]of e){let u=JSON.stringify(d),c=t.get(u);c===void 0?t.set(u,{schema:d,first:s,rest:[]}):c.rest.push(s)}let o=[...t.values()],{$defs:n,schemas:r}=C(o.map(({schema:s})=>s),s=>`#/anyOf/${s}/properties/input`);return{type:\"object\",...n===void 0?{}:{$defs:n},anyOf:r.map((s,d)=>{let{first:u,rest:c}=o[d];return{type:\"object\",properties:{accountId:c.length===0?{type:\"string\",const:u}:{type:\"string\",enum:[u,...c]},input:s},required:[\"accountId\",\"input\"]}})}},re=e=>{let{$defs:t,schemas:o}=C([...new Map(e.map(n=>[JSON.stringify(n),n])).values()],n=>`#/anyOf/${n}`);return{...t===void 0?{}:{$defs:t},anyOf:o}},Ze=e=>{if(e.output!==void 0)return!0;let t=Object.getOwnPropertyDescriptor(e,\"outputSchema\");return t!==void 0&&(t.get!==void 0||t.value!==void 0)},et=e=>e.output===void 0?e.outputSchema:oe(e.output),se=e=>{let t=[...e.values()],o=t[0];if(o===void 0)throw new Error(\"An account operation must have at least one account\");let n=t.every(i=>i.kind===\"query\")?\"query\":\"mutation\",r=i=>{let l=e.get(i.accountId);if(l===void 0)throw new Error(\"Account selection must be decoded before execution\");return l},s=p.Union([...e].map(([i,l])=>p.Struct({accountId:p.Literal(i),input:l.input}))),d=()=>ne([...e].map(([i,l])=>[i,oe(l.input)])),u=Q({kind:n,...o.description===void 0?{}:{description:o.description},...o.title===void 0?{}:{title:o.title},...o.annotations===void 0||!t.every(i=>JSON.stringify(i.annotations)===JSON.stringify(o.annotations))?{}:{annotations:o.annotations},...o._meta===void 0||!t.every(i=>JSON.stringify(i._meta)===JSON.stringify(o._meta))?{}:{_meta:o._meta},input:_(s,d),approval:i=>{let l=r(i.toolInput);return l.approval===void 0?a.succeed(\"approved\"):l.approval({...i,toolInput:i.toolInput.input})},run:(i,l)=>{let y=r(l);return y.run(i,l.input).pipe(a.mapError(m=>f(m,l.accountId)),a.flatMap(m=>y.output===void 0?a.succeed(m):p.decodeUnknownEffect(y.output)(m)))}});if(t.every(Ze)){let i=U(()=>re(t.flatMap(y=>{let m=et(y);return m===void 0?[]:[m]}))),l=S(u);l!==void 0&&Object.defineProperty(l,\"outputSchema\",{enumerable:!0,get:i})}let c=S(u);if(c===void 0)throw new Error(\"Expected a combined operation\");return c},ae=(e,t)=>{let o=t[0]?.[1][e];return o!==void 0&&t.every(([,n])=>JSON.stringify(n[e])===JSON.stringify(o))?{[e]:o}:{}},ie=(e,t)=>{let o=t[0]?.[1];if(o===void 0)throw new Error(\"Expected a source operation\");return p.decodeUnknownSync(G)({name:e,description:o.description,...o.title===void 0?{}:{title:o.title},readOnly:t.every(([,n])=>n.readOnly===!0),...ae(\"annotations\",t)})},te=(e,t)=>p.decodeUnknownSync(K)({...ie(e,t),inputSchema:ne(t.map(([o,n])=>[o,n.inputSchema])),...t.every(([,o])=>o.outputSchema!==void 0)?{outputSchema:re(t.flatMap(([,o])=>o.outputSchema===void 0?[]:[o.outputSchema]))}:{},...ae(\"_meta\",t)}),tt=e=>{let t=[...e.values()][0],o=n=>a.gen(function*(){let r=new Map;for(let[s,d]of e){let u=yield*n(d).pipe(a.mapError(c=>f(c,s)));for(let c of u){let i=r.get(c.name)??[];if(i.some(([l])=>l===s))return yield*a.die(new Error(\"Duplicate source operation\"));i.push([s,c]),r.set(c.name,i)}}return r});return{kind:\"dynamic\",...t?.meta===void 0?{}:{meta:t.meta},...t?.overrides===void 0?{}:{overrides:t.overrides},list:()=>o(n=>n.list()).pipe(a.map(n=>[...n].map(([r,s])=>te(r,s)))),summaries:()=>o(n=>n.summaries===void 0?n.list():n.summaries()).pipe(a.map(n=>[...n].map(([r,s])=>ie(r,s)))),describe:n=>a.gen(function*(){let r=[];for(let[s,d]of e){let u=yield*(d.describe===void 0?d.list().pipe(a.map(c=>c.find(i=>i.name===n))):d.describe(n)).pipe(a.mapError(c=>f(c,s)));u!==void 0&&r.push([s,u])}return r.length===0?void 0:te(n,r)}),resolve:n=>a.gen(function*(){let r=new Map;for(let[s,d]of e){let u=yield*d.resolve(n).pipe(a.mapError(c=>f(c,s)));u!==void 0&&r.set(s,u)}return r.size===0?void 0:se(r)})}},ce=e=>{let o=[...e.values()][0];if(o===void 0)throw new Error(\"An account operation must have at least one account\");switch(o.kind){case\"query\":case\"mutation\":return se(b(e,n=>n.kind===\"query\"||n.kind===\"mutation\"));case\"dynamic\":return tt(b(e,n=>n.kind===\"dynamic\"));case\"router\":{let n=b(e,s=>s.kind===\"router\"),r=new Set([...n.values()].flatMap(s=>Object.keys(s.children)));return{kind:\"router\",...o.meta===void 0?{}:{meta:o.meta},children:Object.fromEntries([...r].map(s=>{let d=new Map;for(let[u,c]of n){let i=Object.hasOwn(c.children,s)?c.children[s]:void 0;i!==void 0&&d.set(u,i)}return[s,ce(d)]}))}}}},b=(e,t)=>{let o=new Map;for(let[n,r]of e){if(!t(r))throw new Error(\"Each account's router must have the same shape\");o.set(n,r)}return o},ot=(e,t,o)=>a.runPromise(a.gen(function*(){let n=new Map;for(let s of e){let d=yield*a.tryPromise({try:async()=>t(s),catch:c=>f(c,s.id)});if(n.has(s.id))return yield*a.die(new Error(\"Account selections must be unique\"));let u=X(d);if(u===void 0)return yield*a.die(new Error(\"Expected a protocol router\"));n.set(s.id,u)}if(n.size===0)return R({kind:\"router\",children:{}});let r=ce(n);return r.kind!==\"router\"&&r.kind!==\"dynamic\"?yield*a.die(new Error(\"Expected a protocol router\")):R(r)}),o);var nt=e=>({list:x(async()=>e.list(),\"skills\")});var E=class extends p.TaggedError()(\"NotImplemented\",{operation:p.String}){};var A=(e,t,o,n)=>{let r=S(o);if(r===void 0||r.kind!==\"mutation\")throw new Error(\"A schedule must reference a mutation\");if(e===\"app\"&&r.approval!==void 0)throw new Error(\"An app schedule must reference a mutation without an approval\");return p.decodeUnknownSync(r.input)(n),{scope:e,operation:o,timing:t,input:p.decodeUnknownSync(I)(n)}},pe=e=>{let t=p.decodeUnknownSync(B)(e),o=t.seconds!==void 0?t.seconds*1e3:t.minutes!==void 0?t.minutes*6e4:t.hours*36e5;return p.decodeUnknownSync(L)({kind:\"interval\",milliseconds:o})},ue=e=>({kind:\"cron\",calendar:p.decodeUnknownSync(V)({...e,timezone:e.timezone??\"UTC\"})}),rt=(e,t,o)=>A(\"user\",pe(e),t,o),st=(e,t,o)=>A(\"user\",ue(e),t,o),at=(e,t,o)=>A(\"app\",pe(e),t,o),it=(e,t,o)=>A(\"app\",ue(e),t,o);var de=e=>typeof e==\"object\"&&e!==null&&Object.values(e).every(N),le=e=>v(e),D=e=>{let t=\"fields\"in e&&de(e.fields)?W(e.fields):{};return Object.keys(t).length===0?{}:{exposure:t}},ct=e=>\"fields\"in e&&de(e.fields)?Object.keys(e.fields):e===fe?[\"access_token\"]:[],me=(e,t,o)=>o===void 0?{}:{request:H(e,ct(t),D(t).exposure,o)},fe=j(P,!1),Ht=e=>Z({label:e.label,fields:le(e.fields),...D(e.fields),...me(`\"${e.label}\"`,e.fields,e.request)});function Qt(e){let{response:t=fe,request:o,...n}=e;return a.runSync(ee(n,le(t),D(t).exposure,me(\"OAuth\",t,o).request))}var $t=(e,t)=>{let o={status:e.status,json:()=>a.tryPromise({try:()=>e.json(),catch:n=>n}).pipe(a.catch(n=>n instanceof SyntaxError?a.fail(new h):a.die(n)))};return a.runPromise(Y(o,v(t)))};function Bt(e,t){return typeof e==\"string\"?z(e,t):$(e,t)}export{ke as CacheError,ye as DeclarationInvalid,ze as ElicitationFailed,Ae as FetchOptionUnsupported,xe as NetworkRefused,_e as NonRetryableError,E as NotImplemented,fe as OAuth2AccessToken,Se as ProviderError,h as ResponseDecodeError,O as ResponseStatusError,he as ValidationError,Ue as WorkflowFailure,ot as accountRouter,it as appCron,at as appInterval,be as array,qe as base64,Te as basic,Fe as bearer,we as boolean,$t as decodeJson,Ke as defineApp,Ye as defineProvider,Qe as dynamicRouter,nt as dynamicSkills,Le as event,Ne as header,ve as json,Me as jsonSchema,Re as literal,Je as mutation,ge as number,Qt as oauth2,Ee as object,De as plain,Bt as query,Ie as raw,Ce as record,Be as renameTools,He as router,Ht as secrets,Oe as string,Pe as t,We as toolAnnotations,st as userCron,rt as userInterval,je as withApproval,$e as withApprovals,Ve as workflow};\n","node_modules/apps/host.js":"import{b as h}from\"./chunk-6AE4BD3M.js\";import\"./chunk-6IAPTKU4.js\";import\"./chunk-4RDFZJBD.js\";import\"./chunk-H64J6GLT.js\";import\"./chunk-M63EC7R2.js\";import\"./chunk-EYTDRABV.js\";import\"./chunk-CWIMLCDY.js\";import{j as k,l as H}from\"./chunk-G6QGZRZI.js\";import{Aa as P,Ba as b,E as w,Ec as U,Fa as d,I as R,J as W,Kc as T,Pa as y,Qa as A,cc as u,dc as M,dd as F,pa as S,wa as l,xc as I}from\"./chunk-DI7JLZ3C.js\";import{$ as g,Ea as C,Ob as e,ec as x,oa as v,rd as a}from\"./chunk-IRY5FGME.js\";import\"./chunk-OOJM4CTU.js\";var q=c=>{let s=new AbortController,t=new Set,o={transport:r=>e.tryPromise({try:()=>c(a.encodeSync(R)(r)),catch:()=>new w({reason:\"storage\"})}).pipe(e.flatMap(a.decodeUnknownEffect(W)),e.mapError(()=>new w({reason:\"storage\"})),e.flatMap(i=>i.ok?e.succeed(i.value):e.fail(i.error))),background:r=>e.gen(function*(){let i=yield*e.context(),p=e.runPromiseWith(i)(r.pipe(e.timeout(\"30 seconds\"),e.catchCause(()=>e.logWarning(\"App cache refresh failed\"))),{signal:s.signal}).then(()=>{t.delete(p)},()=>{t.delete(p)});t.add(p)})},n=async()=>{for(;t.size>0;)await Promise.all(t)};return{cache:o,drain:n,cancel:async()=>{s.abort(),await n()}}};var V=(c,s,t)=>{let o=a.decodeUnknownSync(S)(c),n=(r,i)=>e.tryPromise({try:()=>s(r,i),catch:()=>new l({reason:\"engine\",retryable:!0})}).pipe(e.flatMap(a.decodeUnknownEffect(d)),e.mapError(()=>new l({reason:\"engine\",retryable:!0})),e.flatMap(p=>p.ok?e.succeed(p.value):e.fail(p.error)));return{runId:o,driver:{do:(r,i,p)=>e.gen(function*(){let f=yield*e.context();return yield*n({operation:\"do\",name:r,options:i},()=>e.runPromiseWith(f)(p().pipe(e.matchCause({onSuccess:m=>({ok:!0,value:m}),onFailure:m=>{let E=v.squash(m);return{ok:!1,error:a.is(l)(E)?E:new l({reason:\"execution\",retryable:!0})}}}),e.flatMap(a.encodeEffect(d))),{signal:t}))}),sleep:(r,i)=>n({operation:\"sleep\",name:r,duration:i}).pipe(e.asVoid),sleepUntil:(r,i)=>n({operation:\"until\",name:r,timestamp:i}).pipe(e.asVoid)},resolve:()=>n({operation:\"context\"}).pipe(e.flatMap(a.decodeUnknownEffect(u)),e.map(r=>({accounts:x.make(r)})),e.mapError(r=>a.is(l)(r)?r:new l({reason:\"credentials\",retryable:!1}))),invoke:r=>n({operation:\"invoke\",...r})}},j=c=>{let s=o=>e.tryPromise({try:()=>c(o),catch:()=>new l({reason:\"engine\",retryable:!0})}).pipe(e.flatMap(a.decodeUnknownEffect(d)),e.mapError(()=>new l({reason:\"engine\",retryable:!0})),e.flatMap(n=>n.ok?e.succeed(n.value):e.fail(n.error))),t=o=>s(o).pipe(e.flatMap(n=>a.decodeUnknownEffect(P)(n).pipe(e.mapError(()=>new l({reason:\"engine\",retryable:!0})))));return{start:o=>t({operation:\"start\",...o}),get:o=>t({operation:\"get\",...o}),terminate:o=>t({operation:\"terminate\",...o}),list:o=>s({operation:\"list\",...o}).pipe(e.flatMap(n=>a.decodeUnknownEffect(b)(n).pipe(e.mapError(()=>new l({reason:\"engine\",retryable:!0})))))}};var _=(c,s)=>({...s===void 0?{}:{approval:e.runSync(a.decodeUnknownEffect(M)(s).pipe(e.mapError(()=>new U)))},accounts:e.runSync(a.decodeUnknownEffect(a.RedactedFromValue(u))(c).pipe(e.mapError(()=>new I)))}),$=c=>{let s=h(c);return(t,o)=>{let n=s(t,o).pipe(k(t,\"app.dispatch\"));return e.runPromise(o.telemetry===void 0?n:n.pipe(e.provideContext(o.telemetry.context)),{signal:t.signal})}},ee=()=>e.runSync(C.currentTimeNanos),oe=c=>{let s=h(c);return(t,o)=>e.runPromise(e.gen(function*(){let n,{value:r,telemetry:i}=yield*H(s(t,o).pipe(k(t,\"app.dispatch\"),e.provideService(F,f=>{n=f}))),p=yield*e.promise(()=>r.json()).pipe(e.flatMap(a.decodeUnknownEffect(T)));return Response.json({...p,telemetry:i,...n===void 0?{}:{timing:n}},{status:r.status})}),{signal:t.signal,scheduler:new g.MixedScheduler(\"sync\")})},ne=(c,s)=>t=>e.tryPromise({try:()=>c(t),catch:()=>(s.abort(),new y({reason:\"transport\"}))}).pipe(e.flatMap(o=>a.decodeUnknownEffect(A)(o).pipe(e.mapError(()=>new y({reason:\"transport\"})))),e.flatMap(o=>o.ok?e.succeed(o.response):e.fail(o.error)));export{$ as createAppHandler,oe as createIsolatedAppHandler,_ as hostContext,q as isolatedCacheSession,ee as isolatedClock,ne as isolatedElicitation,j as isolatedWorkflowControls,V as isolatedWorkflowExecution};\n","node_modules/apps/storage/facet.js":"import\"../chunk-OOJM4CTU.js\";var o=t=>t;export{o as facetStorage};\n","node_modules/apps/contracts.js":"import{$ as I,$b as Db,$c as Cc,A as v,Aa as pa,Ab as db,Ac as cc,Ba as qa,Bc as dc,Ca as ra,Cb as eb,Cc as ec,D as w,Da as sa,Db as fb,Dc as fc,Ea as ta,Eb as gb,Ec as gc,Fa as ua,Fb as hb,Fc as hc,Ga as va,Gb as ib,Gc as ic,Ha as wa,Hb as jb,Hc as jc,Ia as xa,Ib as kb,Ic as kc,Jb as lb,Jc as lc,Kb as mb,Kc as mc,L as x,La as ya,Lb as nb,Lc as nc,M as y,Ma as za,Mb as ob,Mc as oc,N as z,Na as Aa,Nb as pb,O as A,Oa as Ba,Ob as qb,Oc as pc,P as B,Pa as Ca,Pb as rb,Pc as qc,Q as C,Qa as Da,Qb as sb,Qc as rc,Ra as Ea,Rb as tb,Rc as sc,Sa as Fa,Sb as ub,Sc as tc,Ta as Ga,Tb as vb,Tc as uc,U as D,Ua as Ha,Ub as wb,Uc as vc,V as E,Vb as xb,Vc as wc,Wa as Ia,Wb as yb,Wc as xc,Xa as Ja,Xb as zb,Xc as yc,Y as F,Ya as Ka,Yb as Ab,Yc as zc,Z as G,Za as La,Zb as Bb,Zc as Ac,_ as H,_a as Ma,_b as Cb,_c as Bc,a,aa as J,ac as Eb,ad as Dc,b,ba as K,bc as Fb,bd as Ec,c,ca as L,cc as Gb,cd as Fc,d,da as M,dc as Hb,dd as Gc,e,ea as N,ec as Ib,f,fa as O,fc as Jb,g,ga as P,gc as Kb,h,ha as Q,hc as Lb,i,ia as R,ib as Na,ic as Mb,j,ja as aa,jb as Oa,jc as Nb,k,kb as Pa,kc as Ob,l,la as ba,lb as Qa,lc as Pb,m,ma as ca,mb as Ra,mc as Qb,n,na as da,nb as Sa,nc as Rb,ob as Ta,oc as Sb,pa as ea,pb as Ua,pc as Tb,q as o,qa as fa,qb as Va,qc as Ub,r as p,ra as ga,rb as Wa,rc as Vb,sa as ha,sb as Xa,sc as Wb,ta as ia,tb as Ya,tc as Xb,u as q,ua as ja,ub as Za,uc as Yb,v as r,va as ka,vb as _a,vc as Zb,w as s,wa as la,wb as $a,wc as _b,x as t,xa as ma,xb as ab,xc as $b,y as u,ya as na,yb as bb,yc as ac,za as oa,zb as cb,zc as bc}from\"./chunk-DI7JLZ3C.js\";import{Ae as Z,Be as _,De as $,te as S,ue as T,ve as U,we as V,xe as W,ye as X,ze as Y}from\"./chunk-IRY5FGME.js\";import\"./chunk-OOJM4CTU.js\";export{Wb as AccountCheckCommand,E as AccountCheckResult,o as AccountId,D as AccountInfo,ca as ApiErrorResponse,cb as AppIcon,db as AppIcons,W as AppSkillMetadata,V as AppSkillName,X as AppSkillSource,Z as AppSkills,Ea as ApprovalElicitation,Fa as ApprovalResponse,tb as CalendarSchedule,yb as CredentialHost,xa as DatabaseFieldReserved,wa as DatabaseLimitExceeded,Bb as DeclaredAccountSlot,Cb as DeclaredAccountSlots,zb as DeclaredAuthMethod,Za as DeclaredEvent,_a as DeclaredEvents,Ab as DeclaredProvider,Db as DeclaredRequirements,Ca as ElicitationFailed,ya as ElicitationLimits,Da as ElicitationReply,Ba as ElicitationResponse,$a as EmittedEvent,ab as EmittedEvents,Wa as EventFilterValue,Xa as EventLimits,Va as EventName,d as FailureCode,k as FailureDetail,h as FailureFieldName,i as FailureFieldValue,j as FailureFields,e as FailureMessage,c as FailureName,n as FailurePhase,b as FailureSource,w as FetchOptionUnsupported,Aa as FormElicitation,qc as HostAccount,Cc as HostAccountCheckError,rc as HostAccountSlots,sc as HostAccounts,$b as HostAccountsInvalid,Bc as HostCallError,Dc as HostDataError,Lb as HostDeclarationInvalid,lc as HostError,Mb as HostEvaluationFailed,gc as HostInputInvalid,Ac as HostInspectError,nc as HostInvocation,dc as HostKindMismatch,bc as HostOperationFailed,ac as HostOperationNotFound,kc as HostOutputInvalid,Zb as HostRequest,_b as HostRequestInvalid,zc as HostRequirementsError,mc as HostResponse,Nb as HostRouterError,ic as HostToolApprovalRequired,hc as HostToolBlocked,cc as HostToolNotFound,jc as HostToolPolicyFailed,Pb as HostedCatalog,Qb as HostedCatalogSummary,Ob as HostedRouter,Tb as HostedSharedCatalog,Sb as HostedSharedTool,Jb as HostedTool,Kb as HostedToolSummary,Ta as HostedWebhook,oa as HostedWorkflow,p as HttpUrl,ec as InputProblem,sb as Interval,Ib as InvocationDeadline,Fc as InvocationTiming,Gc as InvocationTimingSink,Sa as ManualWebhookDescriptor,Ra as ManualWebhookSetup,La as McpClientLimits,wb as McpError,Xb as MigrateCommand,Yb as MigrateResult,r as NetworkRefusal,s as NetworkRefused,ma as NonRetryableError,A as OAuthAuthorizationParams,x as OAuthClientAuth,y as OAuthSecretClientAuth,B as OAuthTokenRequestFormat,C as OAuthTokenResponse,da as OpenapiResponseError,vb as OperationSchedule,K as Placement,H as PlacementBase64,F as PlacementField,Q as PlacementFieldMissing,J as PlacementHeaderName,I as PlacementPart,G as PlacementText,L as Placements,q as ProviderError,Eb as ResolvedAccount,Fb as ResolvedAccountSlots,Gb as ResolvedAccounts,Ja as RouterIcon,Ia as RouterKey,Ka as RouterMeta,ub as ScheduleTiming,Rb as SharedSchemaKey,Vb as SkillCatalogResponse,Y as SkillDefinitionInvalid,T as SkillFile,S as SkillFilePath,xb as SkillLoadFailed,_ as SkillServiceName,Ub as SkillSources,Ec as ToolResultObservation,Hb as TrustedToolApproval,m as UpstreamError,Ua as WebhookCommand,Pa as WebhookRequestData,Qa as WebhookResponseData,Na as WebhookTransportLimits,sa as WorkflowCommand,va as WorkflowControlCommand,ha as WorkflowDuration,la as WorkflowFailure,ja as WorkflowFailureDetail,fa as WorkflowName,ra as WorkflowReplay,ta as WorkflowRpcCommand,ua as WorkflowRpcResult,pa as WorkflowRun,ka as WorkflowRunFailure,ea as WorkflowRunId,qa as WorkflowRunPage,ia as WorkflowStepOptions,na as WorkflowValue,bb as appIconLimits,Ha as approvalElicitation,za as defaultElicitationLimits,Ya as defaultEventLimits,Ma as defaultMcpClientLimits,Oa as defaultWebhookTransportLimits,Ga as exactApprovalElicitation,eb as frameworkProtocol,xc as indexCommand,wc as inspectCommand,M as isPlacementField,aa as maxApiErrorInstructionsLength,ba as maxApiErrorMessageLength,g as maxFailureFieldLength,f as maxFailureFields,a as maxFailureMessageLength,fc as maxInputProblems,l as maxUpstreamMessageLength,rb as minimumIntervalMilliseconds,u as networkRefusalHeader,v as networkRefusalResponse,t as networkRefusalStatus,P as normalizePlacements,N as placementFields,O as placementKey,fb as protocol1,ob as protocol10,pb as protocol11,qb as protocol12,oc as protocol13,gb as protocol2,hb as protocol3,ib as protocol4,jb as protocol5,kb as protocol6,lb as protocol7,mb as protocol8,nb as protocol9,R as renderPlacement,z as reservedAuthorizationParams,pc as restoreSharedCatalog,tc as scopedSlots,yc as selectTools,vc as skillCatalog,U as skillFormatLimits,$ as skillLoadLimits,uc as skillsCommand,ga as workflowDurationMillis};\n","node_modules/apps/mcp.js":"import\"./chunk-EIDKD4M6.js\";import{a as Td}from\"./chunk-6AE4BD3M.js\";import\"./chunk-6IAPTKU4.js\";import{a as Ad}from\"./chunk-RKBZVLTP.js\";import{A as Od}from\"./chunk-4RDFZJBD.js\";import{b as yd,g as Pd}from\"./chunk-H64J6GLT.js\";import{a as Cd,b as Id}from\"./chunk-Y6CTOODP.js\";import{a as Rd}from\"./chunk-M63EC7R2.js\";import{a as Ed}from\"./chunk-EYTDRABV.js\";import\"./chunk-CWIMLCDY.js\";import{K as gd,V as _d,W as ts,_ as rs,b as fd,ba as sa,c as md,ca as ia,d as es,da as vd,f as Ne,i as hd,n as zn,o as oa}from\"./chunk-G6QGZRZI.js\";import{$a as $d,Ma as wd,Pa as rr,Xa as bd,_a as Zt,ab as ns,bb as xd,bd as kd,cb as zd,db as Sd,eb as Sn,fb as kn,gb as J,hb as os,p as pd,u as Qo,w as na}from\"./chunk-DI7JLZ3C.js\";import{D as Mt,Ea as $n,Ob as w,Qd as jt,ec as ra,k as ld,ne as xn,qa as dd,qe as Yo,ra as tt,rd as G,ud as Er}from\"./chunk-IRY5FGME.js\";import{a as P,b as ea,c as ta}from\"./chunk-OOJM4CTU.js\";var go=P(W=>{\"use strict\";Object.defineProperty(W,\"__esModule\",{value:!0});W.regexpCode=W.getEsmExportName=W.getProperty=W.safeStringify=W.stringify=W.strConcat=W.addCodeArg=W.str=W._=W.nil=W._Code=W.Name=W.IDENTIFIER=W._CodeOrName=void 0;var mo=class{};W._CodeOrName=mo;W.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var pr=class extends mo{constructor(t){if(super(),!W.IDENTIFIER.test(t))throw new Error(\"CodeGen: name must be a valid identifier\");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};W.Name=pr;var Xe=class extends mo{constructor(t){super(),this._items=typeof t==\"string\"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===\"\"||t==='\"\"'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,\"\")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof pr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};W._Code=Xe;W.nil=new Xe(\"\");function a_(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Gc(r,t[n]),r.push(e[++n]);return new Xe(r)}W._=a_;var Wc=new Xe(\"+\");function c_(e,...t){let r=[ho(e[0])],n=0;for(;n<t.length;)r.push(Wc),Gc(r,t[n]),r.push(Wc,ho(e[++n]));return iz(r),new Xe(r)}W.str=c_;function Gc(e,t){t instanceof Xe?e.push(...t._items):t instanceof pr?e.push(t):e.push(uz(t))}W.addCodeArg=Gc;function iz(e){let t=1;for(;t<e.length-1;){if(e[t]===Wc){let r=az(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]=\"+\"}t++}}function az(e,t){if(t==='\"\"')return e;if(e==='\"\"')return t;if(typeof e==\"string\")return t instanceof pr||e[e.length-1]!=='\"'?void 0:typeof t!=\"string\"?`${e.slice(0,-1)}${t}\"`:t[0]==='\"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t==\"string\"&&t[0]==='\"'&&!(e instanceof pr))return`\"${e}${t.slice(1)}`}function cz(e,t){return t.emptyStr()?e:e.emptyStr()?t:c_`${e}${t}`}W.strConcat=cz;function uz(e){return typeof e==\"number\"||typeof e==\"boolean\"||e===null?e:ho(Array.isArray(e)?e.join(\",\"):e)}function lz(e){return new Xe(ho(e))}W.stringify=lz;function ho(e){return JSON.stringify(e).replace(/\\u2028/g,\"\\\\u2028\").replace(/\\u2029/g,\"\\\\u2029\")}W.safeStringify=ho;function dz(e){return typeof e==\"string\"&&W.IDENTIFIER.test(e)?new Xe(`.${e}`):a_`[${e}]`}W.getProperty=dz;function pz(e){if(typeof e==\"string\"&&W.IDENTIFIER.test(e))return new Xe(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}W.getEsmExportName=pz;function fz(e){return new Xe(e.toString())}W.regexpCode=fz});var Qc=P(qe=>{\"use strict\";Object.defineProperty(qe,\"__esModule\",{value:!0});qe.ValueScope=qe.ValueScopeName=qe.Scope=qe.varKinds=qe.UsedValueState=void 0;var De=go(),Xc=class extends Error{constructor(t){super(`CodeGen: \"code\" for ${t} not defined`),this.value=t.value}},ci;(function(e){e[e.Started=0]=\"Started\",e[e.Completed=1]=\"Completed\"})(ci||(qe.UsedValueState=ci={}));qe.varKinds={const:new De.Name(\"const\"),let:new De.Name(\"let\"),var:new De.Name(\"var\")};var ui=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof De.Name?t:this.name(t)}name(t){return new De.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix \"${t}\" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};qe.Scope=ui;var li=class extends De.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,De._)`.${new De.Name(r)}[${n}]`}};qe.ValueScopeName=li;var mz=(0,De._)`\\n`,Yc=class extends ui{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?mz:De.nil}}get(){return this._scope}name(t){return new li(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error(\"CodeGen: ref must be passed in value\");let o=this.toName(t),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name \"${n}\" has no value`);return(0,De._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name \"${o}\" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let s=De.nil;for(let i in t){let a=t[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,ci.Started);let l=r(u);if(l){let d=this.opts.es5?qe.varKinds.var:qe.varKinds.const;s=(0,De._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,De._)`${s}${l}${this.opts._n}`;else throw new Xc(u);c.set(u,ci.Completed)})}return s}};qe.ValueScope=Yc});var Z=P(D=>{\"use strict\";Object.defineProperty(D,\"__esModule\",{value:!0});D.or=D.and=D.not=D.CodeGen=D.operators=D.varKinds=D.ValueScopeName=D.ValueScope=D.Scope=D.Name=D.regexpCode=D.stringify=D.getProperty=D.nil=D.strConcat=D.str=D._=void 0;var F=go(),at=Qc(),Jt=go();Object.defineProperty(D,\"_\",{enumerable:!0,get:function(){return Jt._}});Object.defineProperty(D,\"str\",{enumerable:!0,get:function(){return Jt.str}});Object.defineProperty(D,\"strConcat\",{enumerable:!0,get:function(){return Jt.strConcat}});Object.defineProperty(D,\"nil\",{enumerable:!0,get:function(){return Jt.nil}});Object.defineProperty(D,\"getProperty\",{enumerable:!0,get:function(){return Jt.getProperty}});Object.defineProperty(D,\"stringify\",{enumerable:!0,get:function(){return Jt.stringify}});Object.defineProperty(D,\"regexpCode\",{enumerable:!0,get:function(){return Jt.regexpCode}});Object.defineProperty(D,\"Name\",{enumerable:!0,get:function(){return Jt.Name}});var mi=Qc();Object.defineProperty(D,\"Scope\",{enumerable:!0,get:function(){return mi.Scope}});Object.defineProperty(D,\"ValueScope\",{enumerable:!0,get:function(){return mi.ValueScope}});Object.defineProperty(D,\"ValueScopeName\",{enumerable:!0,get:function(){return mi.ValueScopeName}});Object.defineProperty(D,\"varKinds\",{enumerable:!0,get:function(){return mi.varKinds}});D.operators={GT:new F._Code(\">\"),GTE:new F._Code(\">=\"),LT:new F._Code(\"<\"),LTE:new F._Code(\"<=\"),EQ:new F._Code(\"===\"),NEQ:new F._Code(\"!==\"),NOT:new F._Code(\"!\"),OR:new F._Code(\"||\"),AND:new F._Code(\"&&\"),ADD:new F._Code(\"+\")};var Ot=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},eu=class extends Ot{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?at.varKinds.var:this.varKind,o=this.rhs===void 0?\"\":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=en(this.rhs,t,r)),this}get names(){return this.rhs instanceof F._CodeOrName?this.rhs.names:{}}},di=class extends Ot{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof F.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=en(this.rhs,t,r),this}get names(){let t=this.lhs instanceof F.Name?{}:{...this.lhs.names};return fi(t,this.rhs)}},tu=class extends di{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},ru=class extends Ot{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},nu=class extends Ot{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:\"\"};`+t}},ou=class extends Ot{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},su=class extends Ot{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=en(this.code,t,r),this}get names(){return this.code instanceof F._CodeOrName?this.code.names:{}}},_o=class extends Ot{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),\"\")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(t,r)||(hz(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>hr(t,r.names),{})}},Rt=class extends _o{render(t){return\"{\"+t._n+super.render(t)+\"}\"+t._n}},iu=class extends _o{},Qr=class extends Rt{};Qr.kind=\"else\";var fr=class e extends Rt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+=\"else \"+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Qr(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(u_(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=en(this.condition,t,r),this}get names(){let t=super.names;return fi(t,this.condition),this.else&&hr(t,this.else.names),t}};fr.kind=\"if\";var mr=class extends Rt{};mr.kind=\"for\";var au=class extends mr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=en(this.iteration,t,r),this}get names(){return hr(super.names,this.iteration.names)}},cu=class extends mr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?at.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=fi(super.names,this.from);return fi(t,this.to)}},pi=class extends mr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=en(this.iterable,t,r),this}get names(){return hr(super.names,this.iterable.names)}},yo=class extends Rt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?\"async \":\"\"}function ${this.name}(${this.args})`+super.render(t)}};yo.kind=\"func\";var vo=class extends _o{render(t){return\"return \"+super.render(t)}};vo.kind=\"return\";var uu=class extends Rt{render(t){let r=\"try\"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&hr(t,this.catch.names),this.finally&&hr(t,this.finally.names),t}},wo=class extends Rt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};wo.kind=\"catch\";var bo=class extends Rt{render(t){return\"finally\"+super.render(t)}};bo.kind=\"finally\";var lu=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`\n`:\"\"},this._extScope=t,this._scope=new at.Scope({parent:t}),this._nodes=[new iu]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new eu(t,s,n)),s}const(t,r,n){return this._def(at.varKinds.const,t,r,n)}let(t,r,n){return this._def(at.varKinds.let,t,r,n)}var(t,r,n){return this._def(at.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new di(t,r,n))}add(t,r){return this._leafNode(new tu(t,D.operators.ADD,r))}code(t){return typeof t==\"function\"?t():t!==F.nil&&this._leafNode(new su(t)),this}object(...t){let r=[\"{\"];for(let[n,o]of t)r.length>1&&r.push(\",\"),r.push(n),(n!==o||this.opts.es5)&&(r.push(\":\"),(0,F.addCodeArg)(r,o));return r.push(\"}\"),new F._Code(r)}if(t,r,n){if(this._blockNode(new fr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: \"else\" body without \"then\" body');return this}elseIf(t){return this._elseNode(new fr(t))}else(){return this._elseNode(new Qr)}endIf(){return this._endBlockNode(fr,Qr)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new au(t),r)}forRange(t,r,n,o,s=this.opts.es5?at.varKinds.var:at.varKinds.let){let i=this._scope.toName(t);return this._for(new cu(s,i,r,n),()=>o(i))}forOf(t,r,n,o=at.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof F.Name?r:this.var(\"_arr\",r);return this.forRange(\"_i\",0,(0,F._)`${i}.length`,a=>{this.var(s,(0,F._)`${i}[${a}]`),n(s)})}return this._for(new pi(\"of\",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?at.varKinds.var:at.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,F._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new pi(\"in\",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(mr)}label(t){return this._leafNode(new ru(t))}break(t){return this._leafNode(new nu(t))}return(t){let r=new vo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: \"return\" should have one node');return this._endBlockNode(vo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: \"try\" without \"catch\" and \"finally\"');let o=new uu;if(this._blockNode(o),this.code(t),r){let s=this.name(\"e\");this._currNode=o.catch=new wo(s),r(s)}return n&&(this._currNode=o.finally=new bo,this.code(n)),this._endBlockNode(wo,bo)}throw(t){return this._leafNode(new ou(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error(\"CodeGen: not in self-balancing block\");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=F.nil,n,o){return this._blockNode(new yo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(yo)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block \"${r?`${t.kind}/${r.kind}`:t.kind}\"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof fr))throw new Error('CodeGen: \"else\" without \"if\"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};D.CodeGen=lu;function hr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function fi(e,t){return t instanceof F._CodeOrName?hr(e,t.names):e}function en(e,t,r){if(e instanceof F.Name)return n(e);if(!o(e))return e;return new F._Code(e._items.reduce((s,i)=>(i instanceof F.Name&&(i=n(i)),i instanceof F._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function o(s){return s instanceof F._Code&&s._items.some(i=>i instanceof F.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function hz(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function u_(e){return typeof e==\"boolean\"||typeof e==\"number\"||e===null?!e:(0,F._)`!${du(e)}`}D.not=u_;var gz=l_(D.operators.AND);function _z(...e){return e.reduce(gz)}D.and=_z;var yz=l_(D.operators.OR);function vz(...e){return e.reduce(yz)}D.or=vz;function l_(e){return(t,r)=>t===F.nil?r:r===F.nil?t:(0,F._)`${du(t)} ${e} ${du(r)}`}function du(e){return e instanceof F.Name?e:(0,F._)`(${e})`}});var V=P(U=>{\"use strict\";Object.defineProperty(U,\"__esModule\",{value:!0});U.checkStrictMode=U.getErrorPath=U.Type=U.useFunc=U.setEvaluated=U.evaluatedPropsToName=U.mergeEvaluated=U.eachItem=U.unescapeJsonPointer=U.escapeJsonPointer=U.escapeFragment=U.unescapeFragment=U.schemaRefOrVal=U.schemaHasRulesButRef=U.schemaHasRules=U.checkUnknownRules=U.alwaysValidSchema=U.toHash=void 0;var re=Z(),wz=go();function bz(e){let t={};for(let r of e)t[r]=!0;return t}U.toHash=bz;function $z(e,t){return typeof t==\"boolean\"?t:Object.keys(t).length===0?!0:(f_(e,t),!m_(t,e.self.RULES.all))}U.alwaysValidSchema=$z;function f_(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t==\"boolean\")return;let o=n.RULES.keywords;for(let s in t)o[s]||__(e,`unknown keyword: \"${s}\"`)}U.checkUnknownRules=f_;function m_(e,t){if(typeof e==\"boolean\")return!e;for(let r in e)if(t[r])return!0;return!1}U.schemaHasRules=m_;function xz(e,t){if(typeof e==\"boolean\")return!e;for(let r in e)if(r!==\"$ref\"&&t.all[r])return!0;return!1}U.schemaHasRulesButRef=xz;function zz({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r==\"number\"||typeof r==\"boolean\")return r;if(typeof r==\"string\")return(0,re._)`${r}`}return(0,re._)`${e}${t}${(0,re.getProperty)(n)}`}U.schemaRefOrVal=zz;function Sz(e){return h_(decodeURIComponent(e))}U.unescapeFragment=Sz;function kz(e){return encodeURIComponent(fu(e))}U.escapeFragment=kz;function fu(e){return typeof e==\"number\"?`${e}`:e.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}U.escapeJsonPointer=fu;function h_(e){return e.replace(/~1/g,\"/\").replace(/~0/g,\"~\")}U.unescapeJsonPointer=h_;function Pz(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}U.eachItem=Pz;function d_({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof re.Name?(s instanceof re.Name?e(o,s,i):t(o,s,i),i):s instanceof re.Name?(t(o,i,s),s):r(s,i);return a===re.Name&&!(c instanceof re.Name)?n(o,c):c}}U.mergeEvaluated={props:d_({mergeNames:(e,t,r)=>e.if((0,re._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,re._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,re._)`${r} || {}`).code((0,re._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,re._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,re._)`${r} || {}`),mu(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:g_}),items:d_({mergeNames:(e,t,r)=>e.if((0,re._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,re._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,re._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,re._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(\"items\",t)})};function g_(e,t){if(t===!0)return e.var(\"props\",!0);let r=e.var(\"props\",(0,re._)`{}`);return t!==void 0&&mu(e,r,t),r}U.evaluatedPropsToName=g_;function mu(e,t,r){Object.keys(r).forEach(n=>e.assign((0,re._)`${t}${(0,re.getProperty)(n)}`,!0))}U.setEvaluated=mu;var p_={};function Ez(e,t){return e.scopeValue(\"func\",{ref:t,code:p_[t.code]||(p_[t.code]=new wz._Code(t.code))})}U.useFunc=Ez;var pu;(function(e){e[e.Num=0]=\"Num\",e[e.Str=1]=\"Str\"})(pu||(U.Type=pu={}));function Tz(e,t,r){if(e instanceof re.Name){let n=t===pu.Num;return r?n?(0,re._)`\"[\" + ${e} + \"]\"`:(0,re._)`\"['\" + ${e} + \"']\"`:n?(0,re._)`\"/\" + ${e}`:(0,re._)`\"/\" + ${e}.replace(/~/g, \"~0\").replace(/\\\\//g, \"~1\")`}return r?(0,re.getProperty)(e).toString():\"/\"+fu(e)}U.getErrorPath=Tz;function __(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}U.checkStrictMode=__});var Ct=P(hu=>{\"use strict\";Object.defineProperty(hu,\"__esModule\",{value:!0});var Ee=Z(),Oz={data:new Ee.Name(\"data\"),valCxt:new Ee.Name(\"valCxt\"),instancePath:new Ee.Name(\"instancePath\"),parentData:new Ee.Name(\"parentData\"),parentDataProperty:new Ee.Name(\"parentDataProperty\"),rootData:new Ee.Name(\"rootData\"),dynamicAnchors:new Ee.Name(\"dynamicAnchors\"),vErrors:new Ee.Name(\"vErrors\"),errors:new Ee.Name(\"errors\"),this:new Ee.Name(\"this\"),self:new Ee.Name(\"self\"),scope:new Ee.Name(\"scope\"),json:new Ee.Name(\"json\"),jsonPos:new Ee.Name(\"jsonPos\"),jsonLen:new Ee.Name(\"jsonLen\"),jsonPart:new Ee.Name(\"jsonPart\")};hu.default=Oz});var $o=P(Te=>{\"use strict\";Object.defineProperty(Te,\"__esModule\",{value:!0});Te.extendErrors=Te.resetErrorsCount=Te.reportExtraError=Te.reportError=Te.keyword$DataError=Te.keywordError=void 0;var H=Z(),hi=V(),Ie=Ct();Te.keywordError={message:({keyword:e})=>(0,H.str)`must pass \"${e}\" keyword validation`};Te.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,H.str)`\"${e}\" keyword must be ${t} ($data)`:(0,H.str)`\"${e}\" keyword is invalid ($data)`};function Rz(e,t=Te.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=w_(e,t,r);n??(i||a)?y_(s,c):v_(o,(0,H._)`[${c}]`)}Te.reportError=Rz;function Cz(e,t=Te.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=w_(e,t,r);y_(o,a),s||i||v_(n,Ie.default.vErrors)}Te.reportExtraError=Cz;function Iz(e,t){e.assign(Ie.default.errors,t),e.if((0,H._)`${Ie.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,H._)`${Ie.default.vErrors}.length`,t),()=>e.assign(Ie.default.vErrors,null)))}Te.resetErrorsCount=Iz;function Az({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error(\"ajv implementation error\");let i=e.name(\"err\");e.forRange(\"i\",o,Ie.default.errors,a=>{e.const(i,(0,H._)`${Ie.default.vErrors}[${a}]`),e.if((0,H._)`${i}.instancePath === undefined`,()=>e.assign((0,H._)`${i}.instancePath`,(0,H.strConcat)(Ie.default.instancePath,s.errorPath))),e.assign((0,H._)`${i}.schemaPath`,(0,H.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,H._)`${i}.schema`,r),e.assign((0,H._)`${i}.data`,n))})}Te.extendErrors=Az;function y_(e,t){let r=e.const(\"err\",t);e.if((0,H._)`${Ie.default.vErrors} === null`,()=>e.assign(Ie.default.vErrors,(0,H._)`[${r}]`),(0,H._)`${Ie.default.vErrors}.push(${r})`),e.code((0,H._)`${Ie.default.errors}++`)}function v_(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,H._)`new ${e.ValidationError}(${t})`):(r.assign((0,H._)`${n}.errors`,t),r.return(!1))}var gr={keyword:new H.Name(\"keyword\"),schemaPath:new H.Name(\"schemaPath\"),params:new H.Name(\"params\"),propertyName:new H.Name(\"propertyName\"),message:new H.Name(\"message\"),schema:new H.Name(\"schema\"),parentSchema:new H.Name(\"parentSchema\")};function w_(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,H._)`{}`:Nz(e,t,r)}function Nz(e,t,r={}){let{gen:n,it:o}=e,s=[Mz(o,r),jz(e,r)];return Zz(e,t,s),n.object(...s)}function Mz({errorPath:e},{instancePath:t}){let r=t?(0,H.str)`${e}${(0,hi.getErrorPath)(t,hi.Type.Str)}`:e;return[Ie.default.instancePath,(0,H.strConcat)(Ie.default.instancePath,r)]}function jz({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,H.str)`${t}/${e}`;return r&&(o=(0,H.str)`${o}${(0,hi.getErrorPath)(r,hi.Type.Str)}`),[gr.schemaPath,o]}function Zz(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([gr.keyword,o],[gr.params,typeof t==\"function\"?t(e):t||(0,H._)`{}`]),c.messages&&n.push([gr.message,typeof r==\"function\"?r(e):r]),c.verbose&&n.push([gr.schema,i],[gr.parentSchema,(0,H._)`${l}${d}`],[Ie.default.data,s]),u&&n.push([gr.propertyName,u])}});var $_=P(tn=>{\"use strict\";Object.defineProperty(tn,\"__esModule\",{value:!0});tn.boolOrEmptySchema=tn.topBoolOrEmptySchema=void 0;var Dz=$o(),qz=Z(),Uz=Ct(),Lz={message:\"boolean schema is false\"};function Fz(e){let{gen:t,schema:r,validateName:n}=e;r===!1?b_(e,!1):typeof r==\"object\"&&r.$async===!0?t.return(Uz.default.data):(t.assign((0,qz._)`${n}.errors`,null),t.return(!0))}tn.topBoolOrEmptySchema=Fz;function Vz(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),b_(e)):r.var(t,!0)}tn.boolOrEmptySchema=Vz;function b_(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:\"false schema\",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Dz.reportError)(o,Lz,void 0,t)}});var gu=P(rn=>{\"use strict\";Object.defineProperty(rn,\"__esModule\",{value:!0});rn.getRules=rn.isJSONType=void 0;var Hz=[\"string\",\"number\",\"integer\",\"boolean\",\"null\",\"object\",\"array\"],Jz=new Set(Hz);function Kz(e){return typeof e==\"string\"&&Jz.has(e)}rn.isJSONType=Kz;function Bz(){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:{}}}rn.getRules=Bz});var _u=P(Kt=>{\"use strict\";Object.defineProperty(Kt,\"__esModule\",{value:!0});Kt.shouldUseRule=Kt.shouldUseGroup=Kt.schemaHasRulesForType=void 0;function Wz({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&x_(e,n)}Kt.schemaHasRulesForType=Wz;function x_(e,t){return t.rules.some(r=>z_(e,r))}Kt.shouldUseGroup=x_;function z_(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Kt.shouldUseRule=z_});var xo=P(Oe=>{\"use strict\";Object.defineProperty(Oe,\"__esModule\",{value:!0});Oe.reportTypeError=Oe.checkDataTypes=Oe.checkDataType=Oe.coerceAndCheckDataType=Oe.getJSONTypes=Oe.getSchemaTypes=Oe.DataType=void 0;var Gz=gu(),Xz=_u(),Yz=$o(),j=Z(),S_=V(),nn;(function(e){e[e.Correct=0]=\"Correct\",e[e.Wrong=1]=\"Wrong\"})(nn||(Oe.DataType=nn={}));function Qz(e){let t=k_(e.type);if(t.includes(\"null\")){if(e.nullable===!1)throw new Error(\"type: null contradicts nullable: false\")}else{if(!t.length&&e.nullable!==void 0)throw new Error('\"nullable\" cannot be used without \"type\"');e.nullable===!0&&t.push(\"null\")}return t}Oe.getSchemaTypes=Qz;function k_(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Gz.isJSONType))return t;throw new Error(\"type must be JSONType or JSONType[]: \"+t.join(\",\"))}Oe.getJSONTypes=k_;function eS(e,t){let{gen:r,data:n,opts:o}=e,s=tS(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,Xz.schemaHasRulesForType)(e,t[0]));if(i){let a=vu(t,n,o.strictNumbers,nn.Wrong);r.if(a,()=>{s.length?rS(e,t,s):wu(e)})}return i}Oe.coerceAndCheckDataType=eS;var P_=new Set([\"string\",\"number\",\"integer\",\"boolean\",\"null\"]);function tS(e,t){return t?e.filter(r=>P_.has(r)||t===\"array\"&&r===\"array\"):[]}function rS(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let(\"dataType\",(0,j._)`typeof ${o}`),a=n.let(\"coerced\",(0,j._)`undefined`);s.coerceTypes===\"array\"&&n.if((0,j._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,j._)`${o}[0]`).assign(i,(0,j._)`typeof ${o}`).if(vu(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,j._)`${a} !== undefined`);for(let u of r)(P_.has(u)||u===\"array\"&&s.coerceTypes===\"array\")&&c(u);n.else(),wu(e),n.endIf(),n.if((0,j._)`${a} !== undefined`,()=>{n.assign(o,a),nS(e,a)});function c(u){switch(u){case\"string\":n.elseIf((0,j._)`${i} == \"number\" || ${i} == \"boolean\"`).assign(a,(0,j._)`\"\" + ${o}`).elseIf((0,j._)`${o} === null`).assign(a,(0,j._)`\"\"`);return;case\"number\":n.elseIf((0,j._)`${i} == \"boolean\" || ${o} === null\n              || (${i} == \"string\" && ${o} && ${o} == +${o})`).assign(a,(0,j._)`+${o}`);return;case\"integer\":n.elseIf((0,j._)`${i} === \"boolean\" || ${o} === null\n              || (${i} === \"string\" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,j._)`+${o}`);return;case\"boolean\":n.elseIf((0,j._)`${o} === \"false\" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,j._)`${o} === \"true\" || ${o} === 1`).assign(a,!0);return;case\"null\":n.elseIf((0,j._)`${o} === \"\" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case\"array\":n.elseIf((0,j._)`${i} === \"string\" || ${i} === \"number\"\n              || ${i} === \"boolean\" || ${o} === null`).assign(a,(0,j._)`[${o}]`)}}}function nS({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,j._)`${t} !== undefined`,()=>e.assign((0,j._)`${t}[${r}]`,n))}function yu(e,t,r,n=nn.Correct){let o=n===nn.Correct?j.operators.EQ:j.operators.NEQ,s;switch(e){case\"null\":return(0,j._)`${t} ${o} null`;case\"array\":s=(0,j._)`Array.isArray(${t})`;break;case\"object\":s=(0,j._)`${t} && typeof ${t} == \"object\" && !Array.isArray(${t})`;break;case\"integer\":s=i((0,j._)`!(${t} % 1) && !isNaN(${t})`);break;case\"number\":s=i();break;default:return(0,j._)`typeof ${t} ${o} ${e}`}return n===nn.Correct?s:(0,j.not)(s);function i(a=j.nil){return(0,j.and)((0,j._)`typeof ${t} == \"number\"`,a,r?(0,j._)`isFinite(${t})`:j.nil)}}Oe.checkDataType=yu;function vu(e,t,r,n){if(e.length===1)return yu(e[0],t,r,n);let o,s=(0,S_.toHash)(e);if(s.array&&s.object){let i=(0,j._)`typeof ${t} != \"object\"`;o=s.null?i:(0,j._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=j.nil;s.number&&delete s.integer;for(let i in s)o=(0,j.and)(o,yu(i,t,r,n));return o}Oe.checkDataTypes=vu;var oS={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==\"string\"?(0,j._)`{type: ${e}}`:(0,j._)`{type: ${t}}`};function wu(e){let t=sS(e);(0,Yz.reportError)(t,oS)}Oe.reportTypeError=wu;function sS(e){let{gen:t,data:r,schema:n}=e,o=(0,S_.schemaRefOrVal)(e,n,\"type\");return{gen:t,keyword:\"type\",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var T_=P(gi=>{\"use strict\";Object.defineProperty(gi,\"__esModule\",{value:!0});gi.assignDefaults=void 0;var on=Z(),iS=V();function aS(e,t){let{properties:r,items:n}=e.schema;if(t===\"object\"&&r)for(let o in r)E_(e,o,r[o].default);else t===\"array\"&&Array.isArray(n)&&n.forEach((o,s)=>E_(e,s,o.default))}gi.assignDefaults=aS;function E_(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,on._)`${s}${(0,on.getProperty)(t)}`;if(o){(0,iS.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,on._)`${a} === undefined`;i.useDefaults===\"empty\"&&(c=(0,on._)`${c} || ${a} === null || ${a} === \"\"`),n.if(c,(0,on._)`${a} = ${(0,on.stringify)(r)}`)}});var Ye=P(Y=>{\"use strict\";Object.defineProperty(Y,\"__esModule\",{value:!0});Y.validateUnion=Y.validateArray=Y.usePattern=Y.callValidateCode=Y.schemaProperties=Y.allSchemaProperties=Y.noPropertyInData=Y.propertyInData=Y.isOwnProperty=Y.hasPropFunc=Y.reportMissingProp=Y.checkMissingProp=Y.checkReportMissingProp=void 0;var ie=Z(),bu=V(),Bt=Ct(),cS=V();function uS(e,t){let{gen:r,data:n,it:o}=e;r.if(xu(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ie._)`${t}`},!0),e.error()})}Y.checkReportMissingProp=uS;function lS({gen:e,data:t,it:{opts:r}},n,o){return(0,ie.or)(...n.map(s=>(0,ie.and)(xu(e,t,s,r.ownProperties),(0,ie._)`${o} = ${s}`)))}Y.checkMissingProp=lS;function dS(e,t){e.setParams({missingProperty:t},!0),e.error()}Y.reportMissingProp=dS;function O_(e){return e.scopeValue(\"func\",{ref:Object.prototype.hasOwnProperty,code:(0,ie._)`Object.prototype.hasOwnProperty`})}Y.hasPropFunc=O_;function $u(e,t,r){return(0,ie._)`${O_(e)}.call(${t}, ${r})`}Y.isOwnProperty=$u;function pS(e,t,r,n){let o=(0,ie._)`${t}${(0,ie.getProperty)(r)} !== undefined`;return n?(0,ie._)`${o} && ${$u(e,t,r)}`:o}Y.propertyInData=pS;function xu(e,t,r,n){let o=(0,ie._)`${t}${(0,ie.getProperty)(r)} === undefined`;return n?(0,ie.or)(o,(0,ie.not)($u(e,t,r))):o}Y.noPropertyInData=xu;function R_(e){return e?Object.keys(e).filter(t=>t!==\"__proto__\"):[]}Y.allSchemaProperties=R_;function fS(e,t){return R_(t).filter(r=>!(0,bu.alwaysValidSchema)(e,t[r]))}Y.schemaProperties=fS;function mS({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,ie._)`${e}, ${t}, ${n}${o}`:t,d=[[Bt.default.instancePath,(0,ie.strConcat)(Bt.default.instancePath,s)],[Bt.default.parentData,i.parentData],[Bt.default.parentDataProperty,i.parentDataProperty],[Bt.default.rootData,Bt.default.rootData]];i.opts.dynamicRef&&d.push([Bt.default.dynamicAnchors,Bt.default.dynamicAnchors]);let m=(0,ie._)`${l}, ${r.object(...d)}`;return c!==ie.nil?(0,ie._)`${a}.call(${c}, ${m})`:(0,ie._)`${a}(${m})`}Y.callValidateCode=mS;var hS=(0,ie._)`new RegExp`;function gS({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?\"u\":\"\",{regExp:o}=t.code,s=o(r,n);return e.scopeValue(\"pattern\",{key:s.toString(),ref:s,code:(0,ie._)`${o.code===\"new RegExp\"?hS:(0,cS.useFunc)(e,o)}(${r}, ${n})`})}Y.usePattern=gS;function _S(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name(\"valid\");if(o.allErrors){let a=t.let(\"valid\",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const(\"len\",(0,ie._)`${r}.length`);t.forRange(\"i\",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:bu.Type.Num},s),t.if((0,ie.not)(s),a)})}}Y.validateArray=_S;function yS(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error(\"ajv implementation error\");if(r.some(c=>(0,bu.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let(\"valid\",!1),a=t.name(\"_valid\");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,ie._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,ie.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}Y.validateUnion=yS});var A_=P(mt=>{\"use strict\";Object.defineProperty(mt,\"__esModule\",{value:!0});mt.validateKeywordUsage=mt.validSchemaType=mt.funcKeywordCode=mt.macroKeywordCode=void 0;var Ae=Z(),_r=Ct(),vS=Ye(),wS=$o();function bS(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=I_(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name(\"valid\");e.subschema({schema:a,schemaPath:Ae.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}mt.macroKeywordCode=bS;function $S(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;zS(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=I_(n,o,u),d=n.let(\"valid\");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)g(),t.modifying&&C_(e),h(()=>e.error());else{let y=t.async?p():f();t.modifying&&C_(e),h(()=>xS(e,y))}}function p(){let y=n.let(\"ruleErrs\",null);return n.try(()=>g((0,Ae._)`await `),x=>n.assign(d,!1).if((0,Ae._)`${x} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,Ae._)`${x}.errors`),()=>n.throw(x))),y}function f(){let y=(0,Ae._)`${l}.errors`;return n.assign(y,null),g(Ae.nil),y}function g(y=t.async?(0,Ae._)`await `:Ae.nil){let x=c.opts.passContext?_r.default.this:_r.default.self,S=!(\"compile\"in t&&!a||t.schema===!1);n.assign(d,(0,Ae._)`${y}${(0,vS.callValidateCode)(e,l,x,S)}`,t.modifying)}function h(y){var x;n.if((0,Ae.not)((x=t.valid)!==null&&x!==void 0?x:d),y)}}mt.funcKeywordCode=$S;function C_(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ae._)`${n.parentData}[${n.parentDataProperty}]`))}function xS(e,t){let{gen:r}=e;r.if((0,Ae._)`Array.isArray(${t})`,()=>{r.assign(_r.default.vErrors,(0,Ae._)`${_r.default.vErrors} === null ? ${t} : ${_r.default.vErrors}.concat(${t})`).assign(_r.default.errors,(0,Ae._)`${_r.default.vErrors}.length`),(0,wS.extendErrors)(e)},()=>e.error())}function zS({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error(\"async keyword in sync schema\")}function I_(e,t,r){if(r===void 0)throw new Error(`keyword \"${t}\" failed to compile`);return e.scopeValue(\"keyword\",typeof r==\"function\"?{ref:r}:{ref:r,code:(0,Ae.stringify)(r)})}function SS(e,t,r=!1){return!t.length||t.some(n=>n===\"array\"?Array.isArray(e):n===\"object\"?e&&typeof e==\"object\"&&!Array.isArray(e):typeof e==n||r&&typeof e>\"u\")}mt.validSchemaType=SS;function kS({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error(\"ajv implementation error\");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(\",\")}`);if(o.validateSchema&&!o.validateSchema(e[s])){let c=`keyword \"${s}\" value is invalid at path \"${n}\": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema===\"log\")r.logger.error(c);else throw new Error(c)}}mt.validateKeywordUsage=kS});var M_=P(Wt=>{\"use strict\";Object.defineProperty(Wt,\"__esModule\",{value:!0});Wt.extendSubschemaMode=Wt.extendSubschemaData=Wt.getSubschema=void 0;var ht=Z(),N_=V();function PS(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw new Error('both \"keyword\" and \"schema\" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,ht._)`${e.schemaPath}${(0,ht.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,ht._)`${e.schemaPath}${(0,ht.getProperty)(t)}${(0,ht.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,N_.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('\"schemaPath\", \"errSchemaPath\" and \"topSchemaRef\" are required with \"schema\"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either \"keyword\" or \"schema\" must be passed')}Wt.getSubschema=PS;function ES(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both \"data\" and \"dataProp\" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,m=a.let(\"data\",(0,ht._)`${t.data}${(0,ht.getProperty)(r)}`,!0);c(m),e.errorPath=(0,ht.str)`${u}${(0,N_.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,ht._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof ht.Name?o:a.let(\"data\",o,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}Wt.extendSubschemaData=ES;function TS(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}Wt.extendSubschemaMode=TS});var zu=P((JM,j_)=>{\"use strict\";j_.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t==\"object\"&&typeof r==\"object\"){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var D_=P((KM,Z_)=>{\"use strict\";var Gt=Z_.exports=function(e,t,r){typeof t==\"function\"&&(r=t,t={}),r=t.cb||r;var n=typeof r==\"function\"?r:r.pre||function(){},o=r.post||function(){};_i(t,n,o,e,\"\",e)};Gt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Gt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Gt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Gt.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 _i(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n==\"object\"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Gt.arrayKeywords)for(var m=0;m<d.length;m++)_i(e,t,r,d[m],o+\"/\"+l+\"/\"+m,s,o,l,n,m)}else if(l in Gt.propsKeywords){if(d&&typeof d==\"object\")for(var p in d)_i(e,t,r,d[p],o+\"/\"+l+\"/\"+OS(p),s,o,l,n,p)}else(l in Gt.keywords||e.allKeys&&!(l in Gt.skipKeywords))&&_i(e,t,r,d,o+\"/\"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function OS(e){return e.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}});var zo=P(Ue=>{\"use strict\";Object.defineProperty(Ue,\"__esModule\",{value:!0});Ue.getSchemaRefs=Ue.resolveUrl=Ue.normalizeId=Ue._getFullPath=Ue.getFullPath=Ue.inlineRef=void 0;var RS=V(),CS=zu(),IS=D_(),AS=new Set([\"type\",\"format\",\"pattern\",\"maxLength\",\"minLength\",\"maxProperties\",\"minProperties\",\"maxItems\",\"minItems\",\"maximum\",\"minimum\",\"uniqueItems\",\"multipleOf\",\"required\",\"enum\",\"const\"]);function NS(e,t=!0){return typeof e==\"boolean\"?!0:t===!0?!Su(e):t?q_(e)<=t:!1}Ue.inlineRef=NS;var MS=new Set([\"$ref\",\"$recursiveRef\",\"$recursiveAnchor\",\"$dynamicRef\",\"$dynamicAnchor\"]);function Su(e){for(let t in e){if(MS.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Su)||typeof r==\"object\"&&Su(r))return!0}return!1}function q_(e){let t=0;for(let r in e){if(r===\"$ref\")return 1/0;if(t++,!AS.has(r)&&(typeof e[r]==\"object\"&&(0,RS.eachItem)(e[r],n=>t+=q_(n)),t===1/0))return 1/0}return t}function U_(e,t=\"\",r){r!==!1&&(t=sn(t));let n=e.parse(t);return L_(e,n)}Ue.getFullPath=U_;function L_(e,t){return e.serialize(t).split(\"#\")[0]+\"#\"}Ue._getFullPath=L_;var jS=/#\\/?$/;function sn(e){return e?e.replace(jS,\"\"):\"\"}Ue.normalizeId=sn;function ZS(e,t,r){return r=sn(r),e.resolve(t,r)}Ue.resolveUrl=ZS;var DS=/^[a-z_][-a-z0-9._]*$/i;function qS(e,t){if(typeof e==\"boolean\")return{};let{schemaId:r,uriResolver:n}=this.opts,o=sn(e[r]||t),s={\"\":o},i=U_(n,o,!1),a={},c=new Set;return IS(e,{allKeys:!0},(d,m,p,f)=>{if(f===void 0)return;let g=i+m,h=s[f];typeof d[r]==\"string\"&&(h=y.call(this,d[r])),x.call(this,d.$anchor),x.call(this,d.$dynamicAnchor),s[m]=h;function y(S){let M=this.opts.uriResolver.resolve;if(S=sn(h?M(h,S):S),c.has(S))throw l(S);c.add(S);let b=this.refs[S];return typeof b==\"string\"&&(b=this.refs[b]),typeof b==\"object\"?u(d,b.schema,S):S!==sn(g)&&(S[0]===\"#\"?(u(d,a[S],S),a[S]=d):this.refs[S]=g),S}function x(S){if(typeof S==\"string\"){if(!DS.test(S))throw new Error(`invalid anchor \"${S}\"`);y.call(this,`#${S}`)}}}),a;function u(d,m,p){if(m!==void 0&&!CS(d,m))throw l(p)}function l(d){return new Error(`reference \"${d}\" resolves to more than one schema`)}}Ue.getSchemaRefs=qS});var Po=P(Xt=>{\"use strict\";Object.defineProperty(Xt,\"__esModule\",{value:!0});Xt.getData=Xt.KeywordCxt=Xt.validateFunctionCode=void 0;var K_=$_(),F_=xo(),Pu=_u(),yi=xo(),US=T_(),ko=A_(),ku=M_(),O=Z(),N=Ct(),LS=zo(),It=V(),So=$o();function FS(e){if(G_(e)&&(X_(e),W_(e))){JS(e);return}B_(e,()=>(0,K_.topBoolOrEmptySchema)(e))}Xt.validateFunctionCode=FS;function B_({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,(0,O._)`${N.default.data}, ${N.default.valCxt}`,n.$async,()=>{e.code((0,O._)`\"use strict\"; ${V_(r,o)}`),HS(e,o),e.code(s)}):e.func(t,(0,O._)`${N.default.data}, ${VS(o)}`,n.$async,()=>e.code(V_(r,o)).code(s))}function VS(e){return(0,O._)`{${N.default.instancePath}=\"\", ${N.default.parentData}, ${N.default.parentDataProperty}, ${N.default.rootData}=${N.default.data}${e.dynamicRef?(0,O._)`, ${N.default.dynamicAnchors}={}`:O.nil}}={}`}function HS(e,t){e.if(N.default.valCxt,()=>{e.var(N.default.instancePath,(0,O._)`${N.default.valCxt}.${N.default.instancePath}`),e.var(N.default.parentData,(0,O._)`${N.default.valCxt}.${N.default.parentData}`),e.var(N.default.parentDataProperty,(0,O._)`${N.default.valCxt}.${N.default.parentDataProperty}`),e.var(N.default.rootData,(0,O._)`${N.default.valCxt}.${N.default.rootData}`),t.dynamicRef&&e.var(N.default.dynamicAnchors,(0,O._)`${N.default.valCxt}.${N.default.dynamicAnchors}`)},()=>{e.var(N.default.instancePath,(0,O._)`\"\"`),e.var(N.default.parentData,(0,O._)`undefined`),e.var(N.default.parentDataProperty,(0,O._)`undefined`),e.var(N.default.rootData,N.default.data),t.dynamicRef&&e.var(N.default.dynamicAnchors,(0,O._)`{}`)})}function JS(e){let{schema:t,opts:r,gen:n}=e;B_(e,()=>{r.$comment&&t.$comment&&Q_(e),XS(e),n.let(N.default.vErrors,null),n.let(N.default.errors,0),r.unevaluated&&KS(e),Y_(e),ek(e)})}function KS(e){let{gen:t,validateName:r}=e;e.evaluated=t.const(\"evaluated\",(0,O._)`${r}.evaluated`),t.if((0,O._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,O._)`${e.evaluated}.props`,(0,O._)`undefined`)),t.if((0,O._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,O._)`${e.evaluated}.items`,(0,O._)`undefined`))}function V_(e,t){let r=typeof e==\"object\"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,O._)`/*# sourceURL=${r} */`:O.nil}function BS(e,t){if(G_(e)&&(X_(e),W_(e))){WS(e,t);return}(0,K_.boolOrEmptySchema)(e,t)}function W_({schema:e,self:t}){if(typeof e==\"boolean\")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function G_(e){return typeof e.schema!=\"boolean\"}function WS(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Q_(e),YS(e),QS(e);let s=n.const(\"_errs\",N.default.errors);Y_(e,s),n.var(t,(0,O._)`${s} === ${N.default.errors}`)}function X_(e){(0,It.checkUnknownRules)(e),GS(e)}function Y_(e,t){if(e.opts.jtd)return H_(e,[],!1,t);let r=(0,F_.getSchemaTypes)(e.schema),n=(0,F_.coerceAndCheckDataType)(e,r);H_(e,r,!n,t)}function GS(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,It.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path \"${r}\"`)}function XS(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,It.checkStrictMode)(e,\"default is ignored in the schema root\")}function YS(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,LS.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function QS(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error(\"async schema in sync schema\")}function Q_({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code((0,O._)`${N.default.self}.logger.log(${s})`);else if(typeof o.$comment==\"function\"){let i=(0,O.str)`${n}/$comment`,a=e.scopeValue(\"root\",{ref:t.root});e.code((0,O._)`${N.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function ek(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if((0,O._)`${N.default.errors} === 0`,()=>t.return(N.default.data),()=>t.throw((0,O._)`new ${o}(${N.default.vErrors})`)):(t.assign((0,O._)`${n}.errors`,N.default.vErrors),s.unevaluated&&tk(e),t.return((0,O._)`${N.default.errors} === 0`))}function tk({gen:e,evaluated:t,props:r,items:n}){r instanceof O.Name&&e.assign((0,O._)`${t}.props`,r),n instanceof O.Name&&e.assign((0,O._)`${t}.items`,n)}function H_(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,It.schemaHasRulesButRef)(s,l))){o.block(()=>ty(e,\"$ref\",l.all.$ref.definition));return}c.jtd||rk(e,t),o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){(0,Pu.shouldUseGroup)(s,m)&&(m.type?(o.if((0,yi.checkDataType)(m.type,i,c.strictNumbers)),J_(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,yi.reportTypeError)(e)),o.endIf()):J_(e,m),a||o.if((0,O._)`${N.default.errors} === ${n||0}`))}}function J_(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,US.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Pu.shouldUseRule)(n,s)&&ty(e,s.keyword,s.definition,t.type)})}function rk(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(nk(e,t),e.opts.allowUnionTypes||ok(e,t),sk(e,e.dataTypes))}function nk(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{ey(e.dataTypes,r)||Eu(e,`type \"${r}\" not allowed by context \"${e.dataTypes.join(\",\")}\"`)}),ak(e,t)}}function ok(e,t){t.length>1&&!(t.length===2&&t.includes(\"null\"))&&Eu(e,\"use allowUnionTypes to allow union type keyword\")}function sk(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o==\"object\"&&(0,Pu.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>ik(t,i))&&Eu(e,`missing type \"${s.join(\",\")}\" for keyword \"${n}\"`)}}}function ik(e,t){return e.includes(t)||t===\"number\"&&e.includes(\"integer\")}function ey(e,t){return e.includes(t)||t===\"integer\"&&e.includes(\"number\")}function ak(e,t){let r=[];for(let n of e.dataTypes)ey(t,n)?r.push(n):t.includes(\"integer\")&&n===\"number\"&&r.push(\"integer\");e.dataTypes=r}function Eu(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at \"${r}\" (strictTypes)`,(0,It.checkStrictMode)(e,t,e.opts.strictTypes)}var vi=class{constructor(t,r,n){if((0,ko.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,It.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const(\"vSchema\",ry(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,ko.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);(\"code\"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const(\"_errs\",N.default.errors))}result(t,r,n){this.failResult((0,O.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,O.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,O._)`${r} !== undefined && (${(0,O.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?So.reportExtraError:So.reportError)(this,this.def.error,r)}$dataError(){(0,So.reportError)(this,this.def.$dataError||So.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add \"trackErrors\" to keyword definition');(0,So.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=O.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=O.nil,r=O.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,O.or)((0,O._)`${o} === undefined`,r)),t!==O.nil&&n.assign(t,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==O.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,O.or)(i(),a());function i(){if(n.length){if(!(r instanceof O.Name))throw new Error(\"ajv implementation error\");let c=Array.isArray(n)?n:[n];return(0,O._)`${(0,yi.checkDataTypes)(c,r,s.opts.strictNumbers,yi.DataType.Wrong)}`}return O.nil}function a(){if(o.validateSchema){let c=t.scopeValue(\"validate$data\",{ref:o.validateSchema});return(0,O._)`!${c}(${r})`}return O.nil}}subschema(t,r){let n=(0,ku.getSubschema)(this.it,t);(0,ku.extendSubschemaData)(n,this.it,t),(0,ku.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return BS(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=It.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=It.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,O.Name)),!0}};Xt.KeywordCxt=vi;function ty(e,t,r,n){let o=new vi(e,r,t);\"code\"in r?r.code(o,n):o.$data&&r.validate?(0,ko.funcKeywordCode)(o,r):\"macro\"in r?(0,ko.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,ko.funcKeywordCode)(o,r)}var ck=/^\\/(?:[^~]|~0|~1)*$/,uk=/^([0-9]+)(#|\\/(?:[^~]|~0|~1)*)?$/;function ry(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e===\"\")return N.default.rootData;if(e[0]===\"/\"){if(!ck.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=N.default.rootData}else{let u=uk.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o===\"#\"){if(l>=t)throw new Error(c(\"property/index\",l));return n[t-l]}if(l>t)throw new Error(c(\"data\",l));if(s=r[t-l],!o)return s}let i=s,a=o.split(\"/\");for(let u of a)u&&(s=(0,O._)`${s}${(0,O.getProperty)((0,It.unescapeJsonPointer)(u))}`,i=(0,O._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}Xt.getData=ry});var wi=P(Ou=>{\"use strict\";Object.defineProperty(Ou,\"__esModule\",{value:!0});var Tu=class extends Error{constructor(t){super(\"validation failed\"),this.errors=t,this.ajv=this.validation=!0}};Ou.default=Tu});var Eo=P(Iu=>{\"use strict\";Object.defineProperty(Iu,\"__esModule\",{value:!0});var Ru=zo(),Cu=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Ru.resolveUrl)(t,r,n),this.missingSchema=(0,Ru.normalizeId)((0,Ru.getFullPath)(t,this.missingRef))}};Iu.default=Cu});var $i=P(Qe=>{\"use strict\";Object.defineProperty(Qe,\"__esModule\",{value:!0});Qe.resolveSchema=Qe.getCompilingSchema=Qe.resolveRef=Qe.compileSchema=Qe.SchemaEnv=void 0;var ct=Z(),lk=wi(),yr=Ct(),ut=zo(),ny=V(),dk=Po(),an=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema==\"object\"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,ut.normalizeId)(n?.[t.schemaId||\"$id\"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};Qe.SchemaEnv=an;function Nu(e){let t=oy.call(this,e);if(t)return t;let r=(0,ut.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new ct.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue(\"Error\",{ref:lk.default,code:(0,ct._)`require(\"ajv/dist/runtime/validation_error\").default`}));let c=i.scopeName(\"validate\");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:yr.default.data,parentData:yr.default.parentData,parentDataProperty:yr.default.parentDataProperty,dataNames:[yr.default.data],dataPathArr:[ct.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue(\"schema\",this.opts.code.source===!0?{ref:e.schema,code:(0,ct.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ct.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?\"\":\"#\"),errorPath:(0,ct._)`\"\"`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,dk.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(yr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${yr.default.self}`,`${yr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:f,items:g}=u;p.evaluated={props:f instanceof ct.Name?void 0:f,items:g instanceof ct.Name?void 0:g,dynamicProps:f instanceof ct.Name,dynamicItems:g instanceof ct.Name},p.source&&(p.source.evaluated=(0,ct.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error(\"Error compiling schema, function code:\",l),d}finally{this._compilations.delete(e)}}Qe.compileSchema=Nu;function pk(e,t,r){var n;r=(0,ut.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=hk.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new an({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=fk.call(this,s)}Qe.resolveRef=pk;function fk(e){return(0,ut.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Nu.call(this,e)}function oy(e){for(let t of this._compilations)if(mk(t,e))return t}Qe.getCompilingSchema=oy;function mk(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function hk(e,t){let r;for(;typeof(r=this.refs[t])==\"string\";)t=r;return r||this.schemas[t]||bi.call(this,e,t)}function bi(e,t){let r=this.opts.uriResolver.parse(t),n=(0,ut._getFullPath)(this.opts.uriResolver,r),o=(0,ut.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Au.call(this,r,e);let s=(0,ut.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i==\"string\"){let a=bi.call(this,e,i);return typeof a?.schema!=\"object\"?void 0:Au.call(this,r,a)}if(typeof i?.schema==\"object\"){if(i.validate||Nu.call(this,i),s===(0,ut.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,ut.resolveUrl)(this.opts.uriResolver,o,u)),new an({schema:a,schemaId:c,root:e,baseId:o})}return Au.call(this,r,i)}}Qe.resolveSchema=bi;var gk=new Set([\"properties\",\"patternProperties\",\"enum\",\"dependencies\",\"definitions\"]);function Au(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!==\"/\")return;for(let a of e.fragment.slice(1).split(\"/\")){if(typeof r==\"boolean\")return;let c=r[(0,ny.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r==\"object\"&&r[this.opts.schemaId];!gk.has(a)&&u&&(t=(0,ut.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!=\"boolean\"&&r.$ref&&!(0,ny.schemaHasRulesButRef)(r,this.RULES)){let a=(0,ut.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=bi.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new an({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var sy=P((QM,_k)=>{_k.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}});var Uu=P((ej,py)=>{\"use strict\";var yk=RegExp.prototype.test.bind(/^[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}$/iu),ju=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),vk=RegExp.prototype.test.bind(/^\\d*$/u),vr=RegExp.prototype.test.bind(/^[\\da-f]{2}$/iu),Zu=RegExp.prototype.test.bind(/^[\\da-z\\-._~]$/iu),ay=RegExp.prototype.test.bind(/^[A-Za-z0-9\\-._~!$&'()*+,;=:@/]$/u),Du=RegExp.prototype.test.bind(/^[A-Za-z0-9\\-._~!$&'()*+,;=:@/?]$/u),wk=RegExp.prototype.test.bind(/^[A-Za-z0-9\\-._~!$&'()*+,;=:]$/u),Le=new Array(256);{let e=\"0123456789ABCDEF\";for(let t=0;t<256;t++)Le[t]=\"%\"+e[t>>4]+e[t&15]}function Re(e){return e<2048?Le[192|e>>6]+Le[128|e&63]:e<65536?Le[224|e>>12]+Le[128|e>>6&63]+Le[128|e&63]:Le[240|e>>18]+Le[128|e>>12&63]+Le[128|e>>6&63]+Le[128|e&63]}function bk(e){let t=\"\",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return\"\";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return\"\";t+=e[n]}return t}var $k=RegExp.prototype.test.bind(/^[\\dA-Fa-f]{1,4}$/),xk=RegExp.prototype.test.bind(/^[vV][\\dA-Fa-f]+\\.[A-Za-z\\d\\-._~!$&'()*+,;=:]+$/),zk=RegExp.prototype.test.bind(/^[A-Za-z\\d\\-._~]$/),Sk=RegExp.prototype.test.bind(/[^!\"$&'()*+,\\-.;=_`a-z{}~]/u);function kk(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!zk(e[t])){if(e[t]===\"%\"&&t+2<e.length&&vr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function iy(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)e[a]===\"0\"?(n===-1&&(n=a),o++,o>r&&(r=o,t=n)):(n=-1,o=0);if(r<2)return e.join(\":\");let s=e.slice(0,t).join(\":\"),i=e.slice(t+r).join(\":\");return s+\"::\"+i}function Pk(e){let t=e.indexOf(\"::\");if(t!==-1&&e.indexOf(\"::\",t+1)!==-1)return;let r=t===-1?e.split(\":\"):e.slice(0,t).split(\":\"),n=t===-1?[]:e.slice(t+2).split(\":\");t!==-1&&(r.length===1&&r[0]===\"\"&&(r.length=0),n.length===1&&n[0]===\"\"&&(n.length=0));let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c===\"\")return;if(c.indexOf(\".\")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!ju(c))return;s+=2;continue}if(!$k(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1)return s!==8?void 0:iy(o);if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push(\"0\");for(let a=r.length;a<o.length;a++)i.push(o[a]);return iy(i)}function Mu(e){let t=e[0]===\"[\"&&e[e.length-1]===\"]\";if((e[0]===\"[\"||e[e.length-1]===\"]\")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&xk(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(Ek(n,\":\")<2)return{host:e,isIPV6:!1,error:t};let o=\"\",s=n.indexOf(\"%\");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()===\"%25\"?3:1;if(o=n.slice(s+a),!kk(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=Pk(n);return i===void 0?{host:e,isIPV6:!1,error:!0}:{host:i+(o?\"%\"+o:\"\"),escapedHost:i+(o?\"%25\"+o:\"\"),isIPV6:!0}}function Ek(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Tk(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===\".\")break;if(t===\"/\"){r.push(\"/\");break}else{r.push(t);break}}else if(o===2){if(t[0]===\".\"){if(t[1]===\".\")break;if(t[1]===\"/\"){t=t.slice(2);continue}}else if(t[0]===\"/\"&&(t[1]===\".\"||t[1]===\"/\")){r.push(\"/\");break}}else if(o===3&&t===\"/..\"){r.length!==0&&r.pop(),r.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),r.length!==0&&r.pop();continue}}if((n=t.indexOf(\"/\",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join(\"\")}var Ok={\"@\":\"%40\",\"/\":\"%2F\",\"?\":\"%3F\",\"#\":\"%23\",\":\":\"%3A\"},Rk=/[@/?#:]/g,Ck=/[@/?#]/g;function cy(e,t){let r=t?Ck:Rk;return r.lastIndex=0,e.replace(r,n=>Ok[n])}function uy(e,t=!1){if(e.indexOf(\"%\")===-1)return e;let r=\"\";for(let n=0;n<e.length;n++){if(e[n]===\"%\"&&n+2<e.length){let o=e.slice(n+1,n+3);if(vr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&Zu(i)?r+=i:r+=\"%\"+s,n+=2;continue}}r+=e[n]}return r}function Ik(e){let t=\"\";for(let r=0;r<e.length;r++){let n=e[r];if(n===\"%\"&&r+2<e.length){let o=e.slice(r+1,r+3);if(vr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!==\".\"&&Zu(i)?t+=i:t+=\"%\"+s,r+=2;continue}}if(ay(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=dy(o)?n:Le[o];else if(o<55296||o>57343)t+=Re(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=Re(65536+(o-55296<<10)+(s-56320)),r++):t+=Re(65533)}else t+=Re(65533)}}return t}function Ak(e,t=!1){let r=\"\",n=t&&e[0]!==\"/\";for(let o=0;o<e.length;o++){let s=e[o];if(s===\"%\"&&o+2<e.length){let i=e.slice(o+1,o+3);if(vr(i)){r+=\"%\"+i.toUpperCase(),o+=2;continue}}if(s===\"/\"&&(n=!1),ay(s)&&(s!==\":\"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Le[i];else if(i<55296||i>57343)r+=Re(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);a>=56320&&a<=57343?(r+=Re(65536+(i-55296<<10)+(a-56320)),o++):r+=Re(65533)}else r+=Re(65533)}}return r}function qu(e,t){let r=\"\";for(let n=0;n<e.length;n++){let o=e[n];if(o===\"%\"&&n+2<e.length){let s=e.slice(n+1,n+3);if(vr(s)){r+=\"%\"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Le[s];else if(s<55296||s>57343)r+=Re(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);i>=56320&&i<=57343?(r+=Re(65536+(s-55296<<10)+(i-56320)),n++):r+=Re(65533)}else r+=Re(65533)}}return r}function ly(e){return qu(e,wk)}function Nk(e){return qu(e,Du)}function Mk(e){return qu(e,Du)}function dy(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function jk(e){let t=\"\";for(let r=0;r<e.length;r++){let n=e[r];if(n===\"%\"&&r+2<e.length){let o=e.slice(r+1,r+3);if(vr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));Zu(i)?t+=i:t+=\"%\"+s,r+=2;continue}}if(Du(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=dy(o)?n:Le[o];else if(o<55296||o>57343)t+=Re(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=Re(65536+(o-55296<<10)+(s-56320)),r++):t+=Re(65533)}else t+=Re(65533)}}return t}function Zk(e){let t=\"\";for(let r=0;r<e.length;r++){if(e[r]===\"%\"&&r+2<e.length){let n=e.slice(r+1,r+3);if(vr(n)){t+=\"%\"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function Dk(e){let t=[];if(e.userinfo!==void 0&&(t.push(ly(e.userinfo)),t.push(\"@\")),e.host!==void 0){let r=e.host;if(!ju(r)){let n=Mu(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=uy(r,!0),n=Mu(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=cy(r,!1)}t.push(r)}if(typeof e.port==\"number\"||typeof e.port==\"string\"){let r=String(e.port);if(!vk(r))throw new TypeError(\"URI port is malformed.\");t.push(\":\"),t.push(r)}return t.length?t.join(\"\"):void 0}py.exports={nonSimpleDomain:Sk,recomposeAuthority:Dk,reescapeHostDelimiters:cy,normalizePercentEncoding:uy,normalizePathEncoding:Ik,serializePathEncoding:Ak,normalizeQueryFragmentEncoding:jk,encodeUserinfo:ly,encodeQuery:Nk,encodeFragment:Mk,escapePreservingEscapes:Zk,removeDotSegments:Tk,isIPv4:ju,isUUID:yk,normalizeIPv6:Mu,stringArrayToHexStripped:bk}});var _y=P((tj,gy)=>{\"use strict\";var{isUUID:qk}=Uu(),Uk=/^([\\da-z][\\d\\-a-z]{0,31}):((?:[\\w!$'()*+,\\-./:;=@]|%[\\da-f]{2})+)$/iu,Lk=[\"http\",\"https\",\"ws\",\"wss\",\"urn\",\"urn:uuid\"];function Fk(e){return Lk.indexOf(e)!==-1}function Lu(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 fy(e){return e.host||(e.error=e.error||\"HTTP URIs must have a host.\"),e}function my(e){let t=String(e.scheme).toLowerCase()===\"https\";return(e.port===(t?443:80)||e.port===\"\")&&(e.port=void 0),e.path||(e.path=\"/\"),e}function Vk(e){return e.secure=Lu(e),e.resourceName=(e.path||\"/\")+(e.query?\"?\"+e.query:\"\"),e.path=void 0,e.query=void 0,e}function Hk(e){if((e.port===(Lu(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=e.resourceName.indexOf(\"?\"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!==\"/\"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function Jk(e,t){if(!e.path)return e.error=\"URN can not be parsed\",e;let r=e.path.match(Uk);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||\"urn\";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=Fu(o);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||\"URN can not be parsed.\";return e}function Kk(e,t){if(e.nid===void 0)throw new Error(\"URN without nid cannot be serialized\");let r=t.scheme||e.scheme||\"urn\",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=Fu(o);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function Bk(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!qk(r.uuid))&&(r.error=r.error||\"UUID is not valid.\"),r}function Wk(e){let t=e;return t.nss=(e.uuid||\"\").toLowerCase(),t}var hy={scheme:\"http\",domainHost:!0,parse:fy,serialize:my},Gk={scheme:\"https\",domainHost:hy.domainHost,parse:fy,serialize:my},xi={scheme:\"ws\",domainHost:!0,parse:Vk,serialize:Hk},Xk={scheme:\"wss\",domainHost:xi.domainHost,parse:xi.parse,serialize:xi.serialize},Yk={scheme:\"urn\",parse:Jk,serialize:Kk,skipNormalize:!0},Qk={scheme:\"urn:uuid\",parse:Bk,serialize:Wk,skipNormalize:!0},zi={http:hy,https:Gk,ws:xi,wss:Xk,urn:Yk,\"urn:uuid\":Qk};Object.setPrototypeOf(zi,null);function Fu(e){return e&&(zi[e]||zi[e.toLowerCase()])||void 0}gy.exports={wsIsSecure:Lu,SCHEMES:zi,isValidSchemeName:Fk,getSchemeHandler:Fu}});var Oy=P((rj,Pi)=>{\"use strict\";var{normalizeIPv6:$y,removeDotSegments:Oo,recomposeAuthority:eP,normalizePercentEncoding:Vu,normalizePathEncoding:tP,serializePathEncoding:yy,normalizeQueryFragmentEncoding:vy,encodeQuery:rP,encodeFragment:nP,reescapeHostDelimiters:oP,isIPv4:xy,nonSimpleDomain:sP}=Uu(),{SCHEMES:zy,getSchemeHandler:Hu}=_y(),Sy=/^[A-Za-z][A-Za-z0-9+.-]*$/u,ky=\"URI scheme is malformed.\";function wy(e){let t=unescape(String(e));if(!Sy.test(t))throw new TypeError(ky);return t}function iP(e,t){return typeof e==\"string\"?e=mP(e,t):typeof e==\"object\"&&(e=ki(wr(e,t),t)),e}function aP(e,t,r){let n=r?Object.assign({scheme:\"null\"},r):{scheme:\"null\"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=Si(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:p,malformedHost:f,malformedScheme:g}=Si(t,n);if(s||d||i||m||a||p||c||f||u||g)throw new Error(o.error||l.error||\"URI is malformed.\");let h=Py(o,l,n,!0),y=Hu(r&&r.scheme||h.scheme),x=h.host,S=x!==void 0&&x!==\"\"&&(xy(x)||$y(x).isIPV6);Ey(h,r||{},y,S);let M=x&&x.indexOf(\"%\")!==-1&&!/\\P{ASCII}/u.test(x);if(h.error&&!M)throw new Error(h.error);return n.skipEscape=!0,wr(h,n)}function Py(e,t,r,n){let o={};return n||(e=ki(wr(e,r),r),t=ki(wr(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Oo(t.path||\"\"),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Oo(t.path||\"\"),o.query=t.query):(t.path?(t.path[0]===\"/\"?o.path=Oo(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path=\"/\"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf(\"/\")+1)+t.path:o.path=t.path,o.path=Oo(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function cP(e,t,r){let n=by(e,r),o=by(t,r);return n!==void 0&&o!==void 0&&n===o}function wr(e,t){let r={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:\"\"},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=wy(r.scheme));let s=Hu(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(n.skipEscape?r.path=Vu(r.path):r.path=yy(r.path,a)),n.reference!==\"suffix\"&&r.scheme&&(r.scheme=wy(r.scheme),o.push(r.scheme,\":\"));let c=eP(r);if(c!==void 0&&(n.reference!==\"suffix\"&&o.push(\"//\"),o.push(c),r.path&&r.path[0]!==\"/\"&&o.push(\"/\")),r.path!==void 0){let u=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(u=Oo(u)),a&&(u=yy(u,!0)),c===void 0&&u[0]===\"/\"&&u[1]===\"/\"&&(u=\"/%2F\"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push(\"?\",rP(r.query)),r.fragment!==void 0&&o.push(\"#\",nP(r.fragment)),o.join(\"\")}var uP=/^(?:([^#/:?]+):)?(?:\\/\\/((?:([^#/?@]*)@)?(\\[[^#/?\\]]+\\]|[^#/:?]*)(?::(\\d*))?))?([^#?]*)(?:\\?([^#]*))?(?:#((?:.|[\\n\\r])*))?/u,lP=/^(?:[^#/:?]+:)?\\/\\/([^/?#]*)/,dP=/^(?:[^#/:?]+:)?([/\\\\\\t\\n\\r]*)/;function pP(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!==\"/\")return'URI path must start with \"/\" when authority is present.';if(typeof e.port==\"number\"&&(e.port<0||e.port>65535))return\"URI port is malformed.\"}function To(e){if(e===void 0)return!1;let t=e.indexOf(\"%\");for(;t!==-1;){if(t+2>=e.length||!/^[\\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf(\"%\",t+3)}return!1}function Ju(e){return e[0]===\"[\"&&e[e.length-1]===\"]\"}function fP(e){let t=e[4];return To(e[3])||t!==void 0&&!Ju(t)&&To(t)||To(e[6])||To(e[7])||To(e[8])}function Ey(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Ju(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&sP(e.host))try{e.host=new URL(\"http://\"+e.host).hostname}catch(o){return e.error=e.error||\"Host's domain name can not be converted to ASCII: \"+o,!0}return!1}function Si(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:\"\",port:void 0,path:\"\",query:void 0,fragment:void 0},o=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;r.reference===\"suffix\"&&(r.scheme?e=r.scheme+\":\"+e:e=\"//\"+e);let d=e.match(lP);d!==null&&d[1].indexOf(\"\\\\\")!==-1&&(n.error=\"URI authority must not contain a literal backslash.\",o=!0);let m=e.match(dP);if(m!==null){let f=m[1],g=f.replace(/[\\t\\n\\r]/g,\"\");g.length>=2&&(g.slice(0,2)!==\"//\"?(n.error=n.error||\"URI authority must not contain a literal backslash.\",o=!0):f.length!==g.length&&(n.error=n.error||\"URI authority introducer must not contain whitespace.\",o=!0))}let p=e.match(uP);if(p){if(n.scheme=p[1],n.userinfo=p[3],n.host=p[4],n.port=parseInt(p[5],10),n.path=p[6]||\"\",n.query=p[7],n.fragment=p[8],n.scheme!==void 0){let h=unescape(n.scheme);Sy.test(h)?n.scheme=h.toLowerCase():(n.error=n.error||ky,u=!0)}s=fP(p),s&&(n.error=n.error||\"URI contains malformed percent-encoding.\"),isNaN(n.port)&&(n.port=p[5]);let f=pP(n,p);if(f!==void 0&&(n.error=n.error||f,o=!0),n.host)if(xy(n.host)===!1){let y=Ju(n.host),x=n.host.indexOf(\"[\")!==-1||n.host.indexOf(\"]\")!==-1,S=$y(n.host);l=S.isIPV6||S.isIPVFuture===!0,c=x&&(!y||S.error===!0),n.host=l?S.host:S.host.toLowerCase(),c&&(n.error=n.error||\"URI host is malformed.\",o=!0)}else l=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference=\"same-document\":n.scheme===void 0?n.reference=\"relative\":n.fragment===void 0?n.reference=\"absolute\":n.reference=\"uri\",r.reference&&r.reference!==\"suffix\"&&r.reference!==n.reference&&(n.error=n.error||\"URI is not a \"+r.reference+\" reference.\");let g=Hu(r.scheme||n.scheme);if(c||(a=Ey(n,r,g,l)),e.indexOf(\"%\")!==-1&&n.host!==void 0&&!c){let h=l?n.host:Vu(n.host,!0);l||(h=Vu(h.toLowerCase())),n.host=oP(h,l)}(!g||g&&!g.skipNormalize)&&(n.path&&(n.path=tP(n.path)),n.query&&(n.query=vy(n.query)),n.fragment&&(n.fragment=vy(n.fragment))),g&&g.parse&&(g.parse(n,r),g===zy.urn&&n.nid===void 0&&(i=!0))}else n.error=n.error||\"URI can not be parsed.\";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function ki(e,t){return Si(e,t).parsed}function mP(e,t){return Ty(e,t).normalized}function Ty(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=Si(e,t);return{normalized:n||o||s||i||a?e:wr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function by(e,t){if(typeof e!=\"string\"&&typeof e!=\"object\")return;let r;try{r=typeof e==\"string\"?e:wr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=Ty(r,t);return o||s||i||a||c?void 0:n}var Ku={SCHEMES:zy,normalize:iP,resolve:aP,resolveComponent:Py,equal:cP,serialize:wr,parse:ki};Pi.exports=Ku;Pi.exports.default=Ku;Pi.exports.fastUri=Ku});var Cy=P(Bu=>{\"use strict\";Object.defineProperty(Bu,\"__esModule\",{value:!0});var Ry=Oy();Ry.code='require(\"ajv/dist/runtime/uri\").default';Bu.default=Ry});var qy=P(ke=>{\"use strict\";Object.defineProperty(ke,\"__esModule\",{value:!0});ke.CodeGen=ke.Name=ke.nil=ke.stringify=ke.str=ke._=ke.KeywordCxt=void 0;var hP=Po();Object.defineProperty(ke,\"KeywordCxt\",{enumerable:!0,get:function(){return hP.KeywordCxt}});var cn=Z();Object.defineProperty(ke,\"_\",{enumerable:!0,get:function(){return cn._}});Object.defineProperty(ke,\"str\",{enumerable:!0,get:function(){return cn.str}});Object.defineProperty(ke,\"stringify\",{enumerable:!0,get:function(){return cn.stringify}});Object.defineProperty(ke,\"nil\",{enumerable:!0,get:function(){return cn.nil}});Object.defineProperty(ke,\"Name\",{enumerable:!0,get:function(){return cn.Name}});Object.defineProperty(ke,\"CodeGen\",{enumerable:!0,get:function(){return cn.CodeGen}});var gP=wi(),jy=Eo(),_P=gu(),Ro=$i(),yP=Z(),Co=zo(),Ei=xo(),Gu=V(),Iy=sy(),vP=Cy(),Zy=(e,t)=>new RegExp(e,t);Zy.code=\"new RegExp\";var wP=[\"removeAdditional\",\"useDefaults\",\"coerceTypes\"],bP=new Set([\"validate\",\"serialize\",\"parse\",\"wrapper\",\"root\",\"schema\",\"keyword\",\"pattern\",\"formats\",\"validate$data\",\"func\",\"obj\",\"Error\"]),$P={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.\"},xP={ignoreKeywordsWithRef:\"\",jsPropertySyntax:\"\",unicode:'\"minLength\"/\"maxLength\" account for unicode characters by default.'},Ay=200;function zP(e){var t,r,n,o,s,i,a,c,u,l,d,m,p,f,g,h,y,x,S,M,b,$,I,Q,q;let ce=e.strict,wt=(t=e.code)===null||t===void 0?void 0:t.optimize,tr=wt===!0||wt===void 0?1:wt||0,Pr=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Zy,Nt=(o=e.uriResolver)!==null&&o!==void 0?o:vP.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:ce)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:ce)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:ce)!==null&&l!==void 0?l:\"log\",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:ce)!==null&&m!==void 0?m:\"log\",strictRequired:(f=(p=e.strictRequired)!==null&&p!==void 0?p:ce)!==null&&f!==void 0?f:!1,code:e.code?{...e.code,optimize:tr,regExp:Pr}:{optimize:tr,regExp:Pr},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:Ay,loopEnum:(h=e.loopEnum)!==null&&h!==void 0?h:Ay,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(x=e.messages)!==null&&x!==void 0?x:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(M=e.schemaId)!==null&&M!==void 0?M:\"$id\",addUsedSchema:(b=e.addUsedSchema)!==null&&b!==void 0?b:!0,validateSchema:($=e.validateSchema)!==null&&$!==void 0?$:!0,validateFormats:(I=e.validateFormats)!==null&&I!==void 0?I:!0,unicodeRegExp:(Q=e.unicodeRegExp)!==null&&Q!==void 0?Q:!0,int32range:(q=e.int32range)!==null&&q!==void 0?q:!0,uriResolver:Nt}}var Io=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...zP(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new yP.ValueScope({scope:{},prefixes:bP,es5:r,lines:n}),this.logger=OP(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,_P.getRules)(),Ny.call(this,$P,t,\"NOT SUPPORTED\"),Ny.call(this,xP,t,\"DEPRECATED\",\"warn\"),this._metaOpts=EP.call(this),t.formats&&kP.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&PP.call(this,t.keywords),typeof t.meta==\"object\"&&this.addMetaSchema(t.meta),SP.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword(\"$async\")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Iy;n===\"id\"&&(o={...Iy},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t==\"object\"?t[r]||t:void 0}validate(t,r){let n;if(typeof t==\"string\"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref \"${t}\"`)}else n=this.compile(t);let o=n(r);return\"$async\"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!=\"function\")throw new Error(\"options.loadSchema should be a function\");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await s.call(this,l.$schema);let m=this._addSchema(l,d);return m.validate||i.call(this,m)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof jy.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,n,o);return this}let s;if(typeof t==\"object\"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!=\"string\")throw new Error(`schema ${i} must be string`)}return r=(0,Co.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t==\"boolean\")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!=\"string\")throw new 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 o=this.validate(n,t);if(!o&&r){let s=\"schema is invalid: \"+this.errorsText();if(this.opts.validateSchema===\"log\")this.logger.error(s);else throw new Error(s)}return o}getSchema(t){let r;for(;typeof(r=My.call(this,t))==\"string\";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Ro.SchemaEnv({schema:{},schemaId:n});if(r=Ro.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case\"undefined\":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case\"string\":{let r=My.call(this,t);return typeof r==\"object\"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case\"object\":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,Co.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error(\"ajv.removeSchema: invalid parameter\")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t==\"string\")n=t,typeof r==\"object\"&&(this.logger.warn(\"these parameters are deprecated, see docs for addKeyword\"),r.keyword=n);else if(typeof t==\"object\"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error(\"addKeywords: keyword must be string or non-empty array\")}else throw new Error(\"invalid addKeywords parameters\");if(CP.call(this,n,r),!r)return(0,Gu.eachItem)(n,s=>Wu.call(this,s)),this;AP.call(this,r);let o={...r,type:(0,Ei.getJSONTypes)(r.type),schemaType:(0,Ei.getJSONTypes)(r.schemaType)};return(0,Gu.eachItem)(n,o.type.length===0?s=>Wu.call(this,s,o):s=>o.type.forEach(i=>Wu.call(this,s,o,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r==\"object\"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(s=>s.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r==\"string\"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=\", \",dataVar:n=\"data\"}={}){return!t||t.length===0?\"No errors\":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let s=o.split(\"/\").slice(1),i=t;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!=\"object\")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=Dy(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o==\"string\"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t==\"object\")i=t[a];else{if(this.opts.jtd)throw new Error(\"schema must be object\");if(typeof t!=\"boolean\")throw new Error(\"schema must be object or boolean\")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,Co.normalizeId)(i||n);let u=Co.getSchemaRefs.call(this,t,n);return c=new Ro.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith(\"#\")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id \"${t}\" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Ro.compileSchema.call(this,t),!t.validate)throw new Error(\"ajv implementation error\");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{Ro.compileSchema.call(this,t)}finally{this.opts=r}}};Io.ValidationError=gP.default;Io.MissingRefError=jy.default;ke.default=Io;function Ny(e,t,r,n=\"error\"){for(let o in e){let s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function My(e){return e=(0,Co.normalizeId)(e),this.schemas[e]||this.refs[e]}function SP(){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 kP(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function PP(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 r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function EP(){let e={...this.opts};for(let t of wP)delete e[t];return e}var TP={log(){},warn(){},error(){}};function OP(e){if(e===!1)return TP;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error(\"logger must implement log, warn and error methods\")}var RP=/^[a-z_$][a-z0-9_$:-]*$/i;function CP(e,t){let{RULES:r}=this;if((0,Gu.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!RP.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!(\"code\"in t||\"validate\"in t))throw new Error('$data keyword must have \"code\" or \"validate\" function')}function Wu(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with \"post\" flag cannot have \"type\"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,Ei.getJSONTypes)(t.type),schemaType:(0,Ei.getJSONTypes)(t.schemaType)}};t.before?IP.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function IP(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function AP(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Dy(t)),e.validateSchema=this.compile(t,!0))}var NP={$ref:\"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#\"};function Dy(e){return{anyOf:[e,NP]}}});var Uy=P(Xu=>{\"use strict\";Object.defineProperty(Xu,\"__esModule\",{value:!0});var MP={keyword:\"id\",code(){throw new Error('NOT SUPPORTED: keyword \"id\", use \"$id\" for schema ID')}};Xu.default=MP});var Hy=P(br=>{\"use strict\";Object.defineProperty(br,\"__esModule\",{value:!0});br.callRef=br.getValidate=void 0;var jP=Eo(),Ly=Ye(),Fe=Z(),un=Ct(),Fy=$i(),Ti=V(),ZP={keyword:\"$ref\",schemaType:\"string\",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r===\"#\"||r===\"#/\")&&o===u.baseId)return d();let l=Fy.resolveRef.call(c,u,o,r);if(l===void 0)throw new jP.default(n.opts.uriResolver,o,r);if(l instanceof Fy.SchemaEnv)return m(l);return p(l);function d(){if(s===u)return Oi(e,i,s,s.$async);let f=t.scopeValue(\"root\",{ref:u});return Oi(e,(0,Fe._)`${f}.validate`,u,u.$async)}function m(f){let g=Vy(e,f);Oi(e,g,f,f.$async)}function p(f){let g=t.scopeValue(\"schema\",a.code.source===!0?{ref:f,code:(0,Fe.stringify)(f)}:{ref:f}),h=t.name(\"valid\"),y=e.subschema({schema:f,dataTypes:[],schemaPath:Fe.nil,topSchemaRef:g,errSchemaPath:r},h);e.mergeEvaluated(y),e.ok(h)}}};function Vy(e,t){let{gen:r}=e;return t.validate?r.scopeValue(\"validate\",{ref:t.validate}):(0,Fe._)`${r.scopeValue(\"wrapper\",{ref:t})}.validate`}br.getValidate=Vy;function Oi(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?un.default.this:Fe.nil;n?l():d();function l(){if(!a.$async)throw new Error(\"async schema referenced by sync schema\");let f=o.let(\"valid\");o.try(()=>{o.code((0,Fe._)`await ${(0,Ly.callValidateCode)(e,t,u)}`),p(t),i||o.assign(f,!0)},g=>{o.if((0,Fe._)`!(${g} instanceof ${s.ValidationError})`,()=>o.throw(g)),m(g),i||o.assign(f,!1)}),e.ok(f)}function d(){e.result((0,Ly.callValidateCode)(e,t,u),()=>p(t),()=>m(t))}function m(f){let g=(0,Fe._)`${f}.errors`;o.assign(un.default.vErrors,(0,Fe._)`${un.default.vErrors} === null ? ${g} : ${un.default.vErrors}.concat(${g})`),o.assign(un.default.errors,(0,Fe._)`${un.default.vErrors}.length`)}function p(f){var g;if(!s.opts.unevaluated)return;let h=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(h&&!h.dynamicProps)h.props!==void 0&&(s.props=Ti.mergeEvaluated.props(o,h.props,s.props));else{let y=o.var(\"props\",(0,Fe._)`${f}.evaluated.props`);s.props=Ti.mergeEvaluated.props(o,y,s.props,Fe.Name)}if(s.items!==!0)if(h&&!h.dynamicItems)h.items!==void 0&&(s.items=Ti.mergeEvaluated.items(o,h.items,s.items));else{let y=o.var(\"items\",(0,Fe._)`${f}.evaluated.items`);s.items=Ti.mergeEvaluated.items(o,y,s.items,Fe.Name)}}}br.callRef=Oi;br.default=ZP});var Jy=P(Yu=>{\"use strict\";Object.defineProperty(Yu,\"__esModule\",{value:!0});var DP=Uy(),qP=Hy(),UP=[\"$schema\",\"$id\",\"$defs\",\"$vocabulary\",{keyword:\"$comment\"},\"definitions\",DP.default,qP.default];Yu.default=UP});var Ky=P(Qu=>{\"use strict\";Object.defineProperty(Qu,\"__esModule\",{value:!0});var Ri=Z(),Yt=Ri.operators,Ci={maximum:{okStr:\"<=\",ok:Yt.LTE,fail:Yt.GT},minimum:{okStr:\">=\",ok:Yt.GTE,fail:Yt.LT},exclusiveMaximum:{okStr:\"<\",ok:Yt.LT,fail:Yt.GTE},exclusiveMinimum:{okStr:\">\",ok:Yt.GT,fail:Yt.LTE}},LP={message:({keyword:e,schemaCode:t})=>(0,Ri.str)`must be ${Ci[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ri._)`{comparison: ${Ci[e].okStr}, limit: ${t}}`},FP={keyword:Object.keys(Ci),type:\"number\",schemaType:\"number\",$data:!0,error:LP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Ri._)`${r} ${Ci[t].fail} ${n} || isNaN(${r})`)}};Qu.default=FP});var By=P(el=>{\"use strict\";Object.defineProperty(el,\"__esModule\",{value:!0});var Ao=Z(),VP={message:({schemaCode:e})=>(0,Ao.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Ao._)`{multipleOf: ${e}}`},HP={keyword:\"multipleOf\",type:\"number\",schemaType:\"number\",$data:!0,error:VP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let(\"res\"),a=s?(0,Ao._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,Ao._)`${i} !== parseInt(${i})`;e.fail$data((0,Ao._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};el.default=HP});var Gy=P(tl=>{\"use strict\";Object.defineProperty(tl,\"__esModule\",{value:!0});function Wy(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}tl.default=Wy;Wy.code='require(\"ajv/dist/runtime/ucs2length\").default'});var Xy=P(rl=>{\"use strict\";Object.defineProperty(rl,\"__esModule\",{value:!0});var $r=Z(),JP=V(),KP=Gy(),BP={message({keyword:e,schemaCode:t}){let r=e===\"maxLength\"?\"more\":\"fewer\";return(0,$r.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,$r._)`{limit: ${e}}`},WP={keyword:[\"maxLength\",\"minLength\"],type:\"string\",schemaType:\"number\",$data:!0,error:BP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t===\"maxLength\"?$r.operators.GT:$r.operators.LT,i=o.opts.unicode===!1?(0,$r._)`${r}.length`:(0,$r._)`${(0,JP.useFunc)(e.gen,KP.default)}(${r})`;e.fail$data((0,$r._)`${i} ${s} ${n}`)}};rl.default=WP});var Yy=P(nl=>{\"use strict\";Object.defineProperty(nl,\"__esModule\",{value:!0});var GP=Ye(),XP=V(),ln=Z(),YP={message:({schemaCode:e})=>(0,ln.str)`must match pattern \"${e}\"`,params:({schemaCode:e})=>(0,ln._)`{pattern: ${e}}`},QP={keyword:\"pattern\",type:\"string\",schemaType:\"string\",$data:!0,error:YP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?\"u\":\"\";if(n){let{regExp:c}=i.opts.code,u=c.code===\"new RegExp\"?(0,ln._)`new RegExp`:(0,XP.useFunc)(t,c),l=t.let(\"valid\");t.try(()=>t.assign(l,(0,ln._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,ln._)`!${l}`)}else{let c=(0,GP.usePattern)(e,o);e.fail$data((0,ln._)`!${c}.test(${r})`)}}};nl.default=QP});var Qy=P(ol=>{\"use strict\";Object.defineProperty(ol,\"__esModule\",{value:!0});var No=Z(),eE={message({keyword:e,schemaCode:t}){let r=e===\"maxProperties\"?\"more\":\"fewer\";return(0,No.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,No._)`{limit: ${e}}`},tE={keyword:[\"maxProperties\",\"minProperties\"],type:\"object\",schemaType:\"number\",$data:!0,error:eE,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t===\"maxProperties\"?No.operators.GT:No.operators.LT;e.fail$data((0,No._)`Object.keys(${r}).length ${o} ${n}`)}};ol.default=tE});var ev=P(sl=>{\"use strict\";Object.defineProperty(sl,\"__esModule\",{value:!0});var Mo=Ye(),jo=Z(),rE=V(),nE={message:({params:{missingProperty:e}})=>(0,jo.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,jo._)`{missingProperty: ${e}}`},oE={keyword:\"required\",type:\"object\",schemaType:\"array\",$data:!0,error:nE,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let p=e.parentSchema.properties,{definedProperties:f}=e.it;for(let g of r)if(p?.[g]===void 0&&!f.has(g)){let h=i.schemaEnv.baseId+i.errSchemaPath,y=`required property \"${g}\" is not defined at \"${h}\" (strictRequired)`;(0,rE.checkStrictMode)(i,y,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(jo.nil,d);else for(let p of r)(0,Mo.checkReportMissingProp)(e,p)}function l(){let p=t.let(\"missing\");if(c||s){let f=t.let(\"valid\",!0);e.block$data(f,()=>m(p,f)),e.ok(f)}else t.if((0,Mo.checkMissingProp)(e,r,p)),(0,Mo.reportMissingProp)(e,p),t.else()}function d(){t.forOf(\"prop\",n,p=>{e.setParams({missingProperty:p}),t.if((0,Mo.noPropertyInData)(t,o,p,a.ownProperties),()=>e.error())})}function m(p,f){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(f,(0,Mo.propertyInData)(t,o,p,a.ownProperties)),t.if((0,jo.not)(f),()=>{e.error(),t.break()})},jo.nil)}}};sl.default=oE});var tv=P(il=>{\"use strict\";Object.defineProperty(il,\"__esModule\",{value:!0});var Zo=Z(),sE={message({keyword:e,schemaCode:t}){let r=e===\"maxItems\"?\"more\":\"fewer\";return(0,Zo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Zo._)`{limit: ${e}}`},iE={keyword:[\"maxItems\",\"minItems\"],type:\"array\",schemaType:\"number\",$data:!0,error:sE,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t===\"maxItems\"?Zo.operators.GT:Zo.operators.LT;e.fail$data((0,Zo._)`${r}.length ${o} ${n}`)}};il.default=iE});var Ii=P(al=>{\"use strict\";Object.defineProperty(al,\"__esModule\",{value:!0});var rv=zu();rv.code='require(\"ajv/dist/runtime/equal\").default';al.default=rv});var nv=P(ul=>{\"use strict\";Object.defineProperty(ul,\"__esModule\",{value:!0});var cl=xo(),Pe=Z(),aE=V(),cE=Ii(),uE={message:({params:{i:e,j:t}})=>(0,Pe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Pe._)`{i: ${e}, j: ${t}}`},lE={keyword:\"uniqueItems\",type:\"array\",schemaType:\"boolean\",$data:!0,error:uE,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let(\"valid\"),u=s.items?(0,cl.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,Pe._)`${i} === false`),e.ok(c);function l(){let f=t.let(\"i\",(0,Pe._)`${r}.length`),g=t.let(\"j\");e.setParams({i:f,j:g}),t.assign(c,!0),t.if((0,Pe._)`${f} > 1`,()=>(d()?m:p)(f,g))}function d(){return u.length>0&&!u.some(f=>f===\"object\"||f===\"array\")}function m(f,g){let h=t.name(\"item\"),y=(0,cl.checkDataTypes)(u,h,a.opts.strictNumbers,cl.DataType.Wrong),x=t.const(\"indices\",(0,Pe._)`{}`);t.for((0,Pe._)`;${f}--;`,()=>{t.let(h,(0,Pe._)`${r}[${f}]`),t.if(y,(0,Pe._)`continue`),u.length>1&&t.if((0,Pe._)`typeof ${h} == \"string\"`,(0,Pe._)`${h} += \"_\"`),t.if((0,Pe._)`typeof ${x}[${h}] == \"number\"`,()=>{t.assign(g,(0,Pe._)`${x}[${h}]`),e.error(),t.assign(c,!1).break()}).code((0,Pe._)`${x}[${h}] = ${f}`)})}function p(f,g){let h=(0,aE.useFunc)(t,cE.default),y=t.name(\"outer\");t.label(y).for((0,Pe._)`;${f}--;`,()=>t.for((0,Pe._)`${g} = ${f}; ${g}--;`,()=>t.if((0,Pe._)`${h}(${r}[${f}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};ul.default=lE});var ov=P(dl=>{\"use strict\";Object.defineProperty(dl,\"__esModule\",{value:!0});var ll=Z(),dE=V(),pE=Ii(),fE={message:\"must be equal to constant\",params:({schemaCode:e})=>(0,ll._)`{allowedValue: ${e}}`},mE={keyword:\"const\",$data:!0,error:fE,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s==\"object\"?e.fail$data((0,ll._)`!${(0,dE.useFunc)(t,pE.default)}(${r}, ${o})`):e.fail((0,ll._)`${s} !== ${r}`)}};dl.default=mE});var sv=P(pl=>{\"use strict\";Object.defineProperty(pl,\"__esModule\",{value:!0});var Do=Z(),hE=V(),gE=Ii(),_E={message:\"must be equal to one of the allowed values\",params:({schemaCode:e})=>(0,Do._)`{allowedValues: ${e}}`},yE={keyword:\"enum\",schemaType:\"array\",$data:!0,error:_E,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw new Error(\"enum must have non-empty array\");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,hE.useFunc)(t,gE.default)),l;if(a||n)l=t.let(\"valid\"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error(\"ajv implementation error\");let p=t.const(\"vSchema\",s);l=(0,Do.or)(...o.map((f,g)=>m(p,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf(\"v\",s,p=>t.if((0,Do._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function m(p,f){let g=o[f];return typeof g==\"object\"&&g!==null?(0,Do._)`${u()}(${r}, ${p}[${f}])`:(0,Do._)`${r} === ${g}`}}};pl.default=yE});var iv=P(fl=>{\"use strict\";Object.defineProperty(fl,\"__esModule\",{value:!0});var vE=Ky(),wE=By(),bE=Xy(),$E=Yy(),xE=Qy(),zE=ev(),SE=tv(),kE=nv(),PE=ov(),EE=sv(),TE=[vE.default,wE.default,bE.default,$E.default,xE.default,zE.default,SE.default,kE.default,{keyword:\"type\",schemaType:[\"string\",\"array\"]},{keyword:\"nullable\",schemaType:\"boolean\"},PE.default,EE.default];fl.default=TE});var hl=P(qo=>{\"use strict\";Object.defineProperty(qo,\"__esModule\",{value:!0});qo.validateAdditionalItems=void 0;var xr=Z(),ml=V(),OE={message:({params:{len:e}})=>(0,xr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,xr._)`{limit: ${e}}`},RE={keyword:\"additionalItems\",type:\"array\",schemaType:[\"boolean\",\"object\"],before:\"uniqueItems\",error:OE,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,ml.checkStrictMode)(r,'\"additionalItems\" is ignored when \"items\" is not an array of schemas');return}av(e,n)}};function av(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const(\"len\",(0,xr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,xr._)`${a} <= ${t.length}`);else if(typeof n==\"object\"&&!(0,ml.alwaysValidSchema)(i,n)){let u=r.var(\"valid\",(0,xr._)`${a} <= ${t.length}`);r.if((0,xr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange(\"i\",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:ml.Type.Num},u),i.allErrors||r.if((0,xr.not)(u),()=>r.break())})}}qo.validateAdditionalItems=av;qo.default=RE});var gl=P(Uo=>{\"use strict\";Object.defineProperty(Uo,\"__esModule\",{value:!0});Uo.validateTuple=void 0;var cv=Z(),Ai=V(),CE=Ye(),IE={keyword:\"items\",type:\"array\",schemaType:[\"object\",\"array\",\"boolean\"],before:\"uniqueItems\",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return uv(e,\"additionalItems\",t);r.items=!0,!(0,Ai.alwaysValidSchema)(r,t)&&e.ok((0,CE.validateArray)(e))}};function uv(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Ai.mergeEvaluated.items(n,r.length,a.items));let c=n.name(\"valid\"),u=n.const(\"len\",(0,cv._)`${s}.length`);r.forEach((d,m)=>{(0,Ai.alwaysValidSchema)(a,d)||(n.if((0,cv._)`${u} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(d){let{opts:m,errSchemaPath:p}=a,f=r.length,g=f===d.minItems&&(f===d.maxItems||d[t]===!1);if(m.strictTuples&&!g){let h=`\"${i}\" is ${f}-tuple, but minItems or maxItems/${t} are not specified or different at path \"${p}\"`;(0,Ai.checkStrictMode)(a,h,m.strictTuples)}}}Uo.validateTuple=uv;Uo.default=IE});var lv=P(_l=>{\"use strict\";Object.defineProperty(_l,\"__esModule\",{value:!0});var AE=gl(),NE={keyword:\"prefixItems\",type:\"array\",schemaType:[\"array\"],before:\"uniqueItems\",code:e=>(0,AE.validateTuple)(e,\"items\")};_l.default=NE});var pv=P(yl=>{\"use strict\";Object.defineProperty(yl,\"__esModule\",{value:!0});var dv=Z(),ME=V(),jE=Ye(),ZE=hl(),DE={message:({params:{len:e}})=>(0,dv.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,dv._)`{limit: ${e}}`},qE={keyword:\"items\",type:\"array\",schemaType:[\"object\",\"boolean\"],before:\"uniqueItems\",error:DE,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,ME.alwaysValidSchema)(n,t)&&(o?(0,ZE.validateAdditionalItems)(e,o):e.ok((0,jE.validateArray)(e)))}};yl.default=qE});var fv=P(vl=>{\"use strict\";Object.defineProperty(vl,\"__esModule\",{value:!0});var et=Z(),Ni=V(),UE={message:({params:{min:e,max:t}})=>t===void 0?(0,et.str)`must contain at least ${e} valid item(s)`:(0,et.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,et._)`{minContains: ${e}}`:(0,et._)`{minContains: ${e}, maxContains: ${t}}`},LE={keyword:\"contains\",type:\"array\",schemaType:[\"object\",\"boolean\"],before:\"uniqueItems\",trackErrors:!0,error:UE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const(\"len\",(0,et._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Ni.checkStrictMode)(s,'\"minContains\" == 0 without \"maxContains\": \"contains\" keyword ignored');return}if(a!==void 0&&i>a){(0,Ni.checkStrictMode)(s,'\"minContains\" > \"maxContains\" is always invalid'),e.fail();return}if((0,Ni.alwaysValidSchema)(s,r)){let g=(0,et._)`${l} >= ${i}`;a!==void 0&&(g=(0,et._)`${g} && ${l} <= ${a}`),e.pass(g);return}s.items=!0;let d=t.name(\"valid\");a===void 0&&i===1?p(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,et._)`${o}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let g=t.name(\"_valid\"),h=t.let(\"count\",0);p(g,()=>t.if(g,()=>f(h)))}function p(g,h){t.forRange(\"i\",0,l,y=>{e.subschema({keyword:\"contains\",dataProp:y,dataPropType:Ni.Type.Num,compositeRule:!0},g),h()})}function f(g){t.code((0,et._)`${g}++`),a===void 0?t.if((0,et._)`${g} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,et._)`${g} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,et._)`${g} >= ${i}`,()=>t.assign(d,!0)))}}};vl.default=LE});var gv=P(gt=>{\"use strict\";Object.defineProperty(gt,\"__esModule\",{value:!0});gt.validateSchemaDeps=gt.validatePropertyDeps=gt.error=void 0;var wl=Z(),FE=V(),Lo=Ye();gt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?\"property\":\"properties\";return(0,wl.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,wl._)`{property: ${e},\n    missingProperty: ${n},\n    depsCount: ${t},\n    deps: ${r}}`};var VE={keyword:\"dependencies\",type:\"object\",schemaType:\"object\",error:gt.error,code(e){let[t,r]=HE(e);mv(e,t),hv(e,r)}};function HE({schema:e}){let t={},r={};for(let n in e){if(n===\"__proto__\")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function mv(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let(\"missing\");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,Lo.propertyInData)(r,n,i,o.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(\", \")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,Lo.checkReportMissingProp)(e,u)}):(r.if((0,wl._)`${c} && (${(0,Lo.checkMissingProp)(e,a,s)})`),(0,Lo.reportMissingProp)(e,s),r.else())}}gt.validatePropertyDeps=mv;function hv(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name(\"valid\");for(let a in t)(0,FE.alwaysValidSchema)(s,t[a])||(r.if((0,Lo.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}gt.validateSchemaDeps=hv;gt.default=VE});var yv=P(bl=>{\"use strict\";Object.defineProperty(bl,\"__esModule\",{value:!0});var _v=Z(),JE=V(),KE={message:\"property name must be valid\",params:({params:e})=>(0,_v._)`{propertyName: ${e.propertyName}}`},BE={keyword:\"propertyNames\",type:\"object\",schemaType:[\"object\",\"boolean\"],error:KE,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,JE.alwaysValidSchema)(o,r))return;let s=t.name(\"valid\");t.forIn(\"key\",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:\"propertyNames\",data:i,dataTypes:[\"string\"],propertyName:i,compositeRule:!0},s),t.if((0,_v.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};bl.default=BE});var xl=P($l=>{\"use strict\";Object.defineProperty($l,\"__esModule\",{value:!0});var Mi=Ye(),lt=Z(),WE=Ct(),ji=V(),GE={message:\"must NOT have additional properties\",params:({params:e})=>(0,lt._)`{additionalProperty: ${e.additionalProperty}}`},XE={keyword:\"additionalProperties\",type:[\"object\"],schemaType:[\"boolean\",\"object\"],allowUndefined:!0,trackErrors:!0,error:GE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw new Error(\"ajv implementation error\");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!==\"all\"&&(0,ji.alwaysValidSchema)(i,r))return;let u=(0,Mi.allSchemaProperties)(n.properties),l=(0,Mi.allSchemaProperties)(n.patternProperties);d(),e.ok((0,lt._)`${s} === ${WE.default.errors}`);function d(){t.forIn(\"key\",o,h=>{!u.length&&!l.length?f(h):t.if(m(h),()=>f(h))})}function m(h){let y;if(u.length>8){let x=(0,ji.schemaRefOrVal)(i,n.properties,\"properties\");y=(0,Mi.isOwnProperty)(t,x,h)}else u.length?y=(0,lt.or)(...u.map(x=>(0,lt._)`${h} === ${x}`)):y=lt.nil;return l.length&&(y=(0,lt.or)(y,...l.map(x=>(0,lt._)`${(0,Mi.usePattern)(e,x)}.test(${h})`))),(0,lt.not)(y)}function p(h){t.code((0,lt._)`delete ${o}[${h}]`)}function f(h){if(c.removeAdditional===\"all\"||c.removeAdditional&&r===!1){p(h);return}if(r===!1){e.setParams({additionalProperty:h}),e.error(),a||t.break();return}if(typeof r==\"object\"&&!(0,ji.alwaysValidSchema)(i,r)){let y=t.name(\"valid\");c.removeAdditional===\"failing\"?(g(h,y,!1),t.if((0,lt.not)(y),()=>{e.reset(),p(h)})):(g(h,y),a||t.if((0,lt.not)(y),()=>t.break()))}}function g(h,y,x){let S={keyword:\"additionalProperties\",dataProp:h,dataPropType:ji.Type.Str};x===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(S,y)}}};$l.default=XE});var bv=P(Sl=>{\"use strict\";Object.defineProperty(Sl,\"__esModule\",{value:!0});var YE=Po(),vv=Ye(),zl=V(),wv=xl(),QE={keyword:\"properties\",type:\"object\",schemaType:\"object\",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;s.opts.removeAdditional===\"all\"&&n.additionalProperties===void 0&&wv.default.code(new YE.KeywordCxt(s,wv.default,\"additionalProperties\"));let i=(0,vv.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=zl.mergeEvaluated.props(t,(0,zl.toHash)(i),s.props));let a=i.filter(d=>!(0,zl.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name(\"valid\");for(let d of a)u(d)?l(d):(t.if((0,vv.propertyInData)(t,o,d,s.opts.ownProperties)),l(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:\"properties\",schemaProp:d,dataProp:d},c)}}};Sl.default=QE});var Sv=P(kl=>{\"use strict\";Object.defineProperty(kl,\"__esModule\",{value:!0});var $v=Ye(),Zi=Z(),xv=V(),zv=V(),eT={keyword:\"patternProperties\",type:\"object\",schemaType:\"object\",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,$v.allSchemaProperties)(r),c=a.filter(g=>(0,xv.alwaysValidSchema)(s,r[g]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name(\"valid\");s.props!==!0&&!(s.props instanceof Zi.Name)&&(s.props=(0,zv.evaluatedPropsToName)(t,s.props));let{props:d}=s;m();function m(){for(let g of a)u&&p(g),s.allErrors?f(g):(t.var(l,!0),f(g),t.if(l))}function p(g){for(let h in u)new RegExp(g).test(h)&&(0,xv.checkStrictMode)(s,`property ${h} matches pattern ${g} (use allowMatchingProperties)`)}function f(g){t.forIn(\"key\",n,h=>{t.if((0,Zi._)`${(0,$v.usePattern)(e,g)}.test(${h})`,()=>{let y=c.includes(g);y||e.subschema({keyword:\"patternProperties\",schemaProp:g,dataProp:h,dataPropType:zv.Type.Str},l),s.opts.unevaluated&&d!==!0?t.assign((0,Zi._)`${d}[${h}]`,!0):!y&&!s.allErrors&&t.if((0,Zi.not)(l),()=>t.break())})})}}};kl.default=eT});var kv=P(Pl=>{\"use strict\";Object.defineProperty(Pl,\"__esModule\",{value:!0});var tT=V(),rT={keyword:\"not\",schemaType:[\"object\",\"boolean\"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,tT.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name(\"valid\");e.subschema({keyword:\"not\",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:\"must NOT be valid\"}};Pl.default=rT});var Pv=P(El=>{\"use strict\";Object.defineProperty(El,\"__esModule\",{value:!0});var nT=Ye(),oT={keyword:\"anyOf\",schemaType:\"array\",trackErrors:!0,code:nT.validateUnion,error:{message:\"must match a schema in anyOf\"}};El.default=oT});var Ev=P(Tl=>{\"use strict\";Object.defineProperty(Tl,\"__esModule\",{value:!0});var Di=Z(),sT=V(),iT={message:\"must match exactly one schema in oneOf\",params:({params:e})=>(0,Di._)`{passingSchemas: ${e.passing}}`},aT={keyword:\"oneOf\",schemaType:\"array\",trackErrors:!0,error:iT,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error(\"ajv implementation error\");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let(\"valid\",!1),a=t.let(\"passing\",null),c=t.name(\"_valid\");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let m;(0,sT.alwaysValidSchema)(o,l)?t.var(c,!0):m=e.subschema({keyword:\"oneOf\",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Di._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Di._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),m&&e.mergeEvaluated(m,Di.Name)})})}}};Tl.default=aT});var Tv=P(Ol=>{\"use strict\";Object.defineProperty(Ol,\"__esModule\",{value:!0});var cT=V(),uT={keyword:\"allOf\",schemaType:\"array\",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error(\"ajv implementation error\");let o=t.name(\"valid\");r.forEach((s,i)=>{if((0,cT.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:\"allOf\",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Ol.default=uT});var Cv=P(Rl=>{\"use strict\";Object.defineProperty(Rl,\"__esModule\",{value:!0});var qi=Z(),Rv=V(),lT={message:({params:e})=>(0,qi.str)`must match \"${e.ifClause}\" schema`,params:({params:e})=>(0,qi._)`{failingKeyword: ${e.ifClause}}`},dT={keyword:\"if\",schemaType:[\"object\",\"boolean\"],trackErrors:!0,error:lT,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Rv.checkStrictMode)(n,'\"if\" without \"then\" and \"else\" is ignored');let o=Ov(n,\"then\"),s=Ov(n,\"else\");if(!o&&!s)return;let i=t.let(\"valid\",!0),a=t.name(\"_valid\");if(c(),e.reset(),o&&s){let l=t.let(\"ifClause\");e.setParams({ifClause:l}),t.if(a,u(\"then\",l),u(\"else\",l))}else o?t.if(a,u(\"then\")):t.if((0,qi.not)(a),u(\"else\"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:\"if\",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let m=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(m,i),d?t.assign(d,(0,qi._)`${l}`):e.setParams({ifClause:l})}}}};function Ov(e,t){let r=e.schema[t];return r!==void 0&&!(0,Rv.alwaysValidSchema)(e,r)}Rl.default=dT});var Iv=P(Cl=>{\"use strict\";Object.defineProperty(Cl,\"__esModule\",{value:!0});var pT=V(),fT={keyword:[\"then\",\"else\"],schemaType:[\"object\",\"boolean\"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,pT.checkStrictMode)(r,`\"${e}\" without \"if\" is ignored`)}};Cl.default=fT});var Av=P(Il=>{\"use strict\";Object.defineProperty(Il,\"__esModule\",{value:!0});var mT=hl(),hT=lv(),gT=gl(),_T=pv(),yT=fv(),vT=gv(),wT=yv(),bT=xl(),$T=bv(),xT=Sv(),zT=kv(),ST=Pv(),kT=Ev(),PT=Tv(),ET=Cv(),TT=Iv();function OT(e=!1){let t=[zT.default,ST.default,kT.default,PT.default,ET.default,TT.default,wT.default,bT.default,vT.default,$T.default,xT.default];return e?t.push(hT.default,_T.default):t.push(mT.default,gT.default),t.push(yT.default),t}Il.default=OT});var Nv=P(Al=>{\"use strict\";Object.defineProperty(Al,\"__esModule\",{value:!0});var he=Z(),RT={message:({schemaCode:e})=>(0,he.str)`must match format \"${e}\"`,params:({schemaCode:e})=>(0,he._)`{format: ${e}}`},CT={keyword:\"format\",type:[\"number\",\"string\"],schemaType:\"string\",$data:!0,error:RT,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?m():p();function m(){let f=r.scopeValue(\"formats\",{ref:d.formats,code:c.code.formats}),g=r.const(\"fDef\",(0,he._)`${f}[${i}]`),h=r.let(\"fType\"),y=r.let(\"format\");r.if((0,he._)`typeof ${g} == \"object\" && !(${g} instanceof RegExp)`,()=>r.assign(h,(0,he._)`${g}.type || \"string\"`).assign(y,(0,he._)`${g}.validate`),()=>r.assign(h,(0,he._)`\"string\"`).assign(y,g)),e.fail$data((0,he.or)(x(),S()));function x(){return c.strictSchema===!1?he.nil:(0,he._)`${i} && !${y}`}function S(){let M=l.$async?(0,he._)`(${g}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,he._)`${y}(${n})`,b=(0,he._)`(typeof ${y} == \"function\" ? ${M} : ${y}.test(${n}))`;return(0,he._)`${y} && ${y} !== true && ${h} === ${t} && !${b}`}}function p(){let f=d.formats[s];if(!f){x();return}if(f===!0)return;let[g,h,y]=S(f);g===t&&e.pass(M());function x(){if(c.strictSchema===!1){d.logger.warn(b());return}throw new Error(b());function b(){return`unknown format \"${s}\" ignored in schema at path \"${u}\"`}}function S(b){let $=b instanceof RegExp?(0,he.regexpCode)(b):c.code.formats?(0,he._)`${c.code.formats}${(0,he.getProperty)(s)}`:void 0,I=r.scopeValue(\"formats\",{key:s,ref:b,code:$});return typeof b==\"object\"&&!(b instanceof RegExp)?[b.type||\"string\",b.validate,(0,he._)`${I}.validate`]:[\"string\",b,I]}function M(){if(typeof f==\"object\"&&!(f instanceof RegExp)&&f.async){if(!l.$async)throw new Error(\"async format in sync schema\");return(0,he._)`await ${y}(${n})`}return typeof h==\"function\"?(0,he._)`${y}(${n})`:(0,he._)`${y}.test(${n})`}}}};Al.default=CT});var Mv=P(Nl=>{\"use strict\";Object.defineProperty(Nl,\"__esModule\",{value:!0});var IT=Nv(),AT=[IT.default];Nl.default=AT});var jv=P(dn=>{\"use strict\";Object.defineProperty(dn,\"__esModule\",{value:!0});dn.contentVocabulary=dn.metadataVocabulary=void 0;dn.metadataVocabulary=[\"title\",\"description\",\"default\",\"deprecated\",\"readOnly\",\"writeOnly\",\"examples\"];dn.contentVocabulary=[\"contentMediaType\",\"contentEncoding\",\"contentSchema\"]});var Dv=P(Ml=>{\"use strict\";Object.defineProperty(Ml,\"__esModule\",{value:!0});var NT=Jy(),MT=iv(),jT=Av(),ZT=Mv(),Zv=jv(),DT=[NT.default,MT.default,(0,jT.default)(),ZT.default,Zv.metadataVocabulary,Zv.contentVocabulary];Ml.default=DT});var Uv=P(Ui=>{\"use strict\";Object.defineProperty(Ui,\"__esModule\",{value:!0});Ui.DiscrError=void 0;var qv;(function(e){e.Tag=\"tag\",e.Mapping=\"mapping\"})(qv||(Ui.DiscrError=qv={}))});var Fv=P(Zl=>{\"use strict\";Object.defineProperty(Zl,\"__esModule\",{value:!0});var pn=Z(),jl=Uv(),Lv=$i(),qT=Eo(),UT=V(),LT={message:({params:{discrError:e,tagName:t}})=>e===jl.DiscrError.Tag?`tag \"${t}\" must be string`:`value of tag \"${t}\" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,pn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},FT={keyword:\"discriminator\",type:\"object\",schemaType:\"object\",error:LT,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error(\"discriminator: requires discriminator option\");let a=n.propertyName;if(typeof a!=\"string\")throw new Error(\"discriminator: requires propertyName\");if(n.mapping)throw new Error(\"discriminator: mapping is not supported\");if(!i)throw new Error(\"discriminator: requires oneOf keyword\");let c=t.let(\"valid\",!1),u=t.const(\"tag\",(0,pn._)`${r}${(0,pn.getProperty)(a)}`);t.if((0,pn._)`typeof ${u} == \"string\"`,()=>l(),()=>e.error(!1,{discrError:jl.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let p=m();t.if(!1);for(let f in p)t.elseIf((0,pn._)`${u} === ${f}`),t.assign(c,d(p[f]));t.else(),e.error(!1,{discrError:jl.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(p){let f=t.name(\"valid\"),g=e.subschema({keyword:\"oneOf\",schemaProp:p},f);return e.mergeEvaluated(g,pn.Name),f}function m(){var p;let f={},g=y(o),h=!0;for(let M=0;M<i.length;M++){let b=i[M];if(b?.$ref&&!(0,UT.schemaHasRulesButRef)(b,s.self.RULES)){let I=b.$ref;if(b=Lv.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,I),b instanceof Lv.SchemaEnv&&(b=b.schema),b===void 0)throw new qT.default(s.opts.uriResolver,s.baseId,I)}let $=(p=b?.properties)===null||p===void 0?void 0:p[a];if(typeof $!=\"object\")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have \"properties/${a}\"`);h=h&&(g||y(b)),x($,M)}if(!h)throw new Error(`discriminator: \"${a}\" must be required`);return f;function y({required:M}){return Array.isArray(M)&&M.includes(a)}function x(M,b){if(M.const)S(M.const,b);else if(M.enum)for(let $ of M.enum)S($,b);else throw new Error(`discriminator: \"properties/${a}\" must have \"const\" or \"enum\"`)}function S(M,b){if(typeof M!=\"string\"||M in f)throw new Error(`discriminator: \"${a}\" values must be unique strings`);f[M]=b}}}};Zl.default=FT});var Vv=P((Vj,VT)=>{VT.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}});var ql=P((ae,Dl)=>{\"use strict\";Object.defineProperty(ae,\"__esModule\",{value:!0});ae.MissingRefError=ae.ValidationError=ae.CodeGen=ae.Name=ae.nil=ae.stringify=ae.str=ae._=ae.KeywordCxt=ae.Ajv=void 0;var HT=qy(),JT=Dv(),KT=Fv(),Hv=Vv(),BT=[\"/properties\"],Li=\"http://json-schema.org/draft-07/schema\",fn=class extends HT.default{_addVocabularies(){super._addVocabularies(),JT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(KT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Hv,BT):Hv;this.addMetaSchema(t,Li,!1),this.refs[\"http://json-schema.org/schema\"]=Li}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Li)?Li:void 0)}};ae.Ajv=fn;Dl.exports=ae=fn;Dl.exports.Ajv=fn;Object.defineProperty(ae,\"__esModule\",{value:!0});ae.default=fn;var WT=Po();Object.defineProperty(ae,\"KeywordCxt\",{enumerable:!0,get:function(){return WT.KeywordCxt}});var mn=Z();Object.defineProperty(ae,\"_\",{enumerable:!0,get:function(){return mn._}});Object.defineProperty(ae,\"str\",{enumerable:!0,get:function(){return mn.str}});Object.defineProperty(ae,\"stringify\",{enumerable:!0,get:function(){return mn.stringify}});Object.defineProperty(ae,\"nil\",{enumerable:!0,get:function(){return mn.nil}});Object.defineProperty(ae,\"Name\",{enumerable:!0,get:function(){return mn.Name}});Object.defineProperty(ae,\"CodeGen\",{enumerable:!0,get:function(){return mn.CodeGen}});var GT=wi();Object.defineProperty(ae,\"ValidationError\",{enumerable:!0,get:function(){return GT.default}});var XT=Eo();Object.defineProperty(ae,\"MissingRefError\",{enumerable:!0,get:function(){return XT.default}})});var Qv=P(yt=>{\"use strict\";Object.defineProperty(yt,\"__esModule\",{value:!0});yt.formatNames=yt.fastFormats=yt.fullFormats=void 0;function _t(e,t){return{validate:e,compare:t}}yt.fullFormats={date:_t(Wv,Vl),time:_t(Ll(!0),Hl),\"date-time\":_t(Jv(!0),Xv),\"iso-time\":_t(Ll(),Gv),\"iso-date-time\":_t(Jv(),Yv),duration:/^P(?!$)((\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+S)?)?|(\\d+W)?)$/,uri:nO,\"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:lO,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:oO,int32:{type:\"number\",validate:aO},int64:{type:\"number\",validate:cO},float:{type:\"number\",validate:Bv},double:{type:\"number\",validate:Bv},password:!0,binary:!0};yt.fastFormats={...yt.fullFormats,date:_t(/^\\d\\d\\d\\d-[0-1]\\d-[0-3]\\d$/,Vl),time:_t(/^(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)(?:\\.\\d+)?(?:z|[+-]\\d\\d(?::?\\d\\d)?)$/i,Hl),\"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,Xv),\"iso-time\":_t(/^(?:[0-2]\\d:[0-5]\\d:[0-5]\\d|23:59:60)(?:\\.\\d+)?(?:z|[+-]\\d\\d(?::?\\d\\d)?)?$/i,Gv),\"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,Yv),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};yt.formatNames=Object.keys(yt.fullFormats);function YT(e){return e%4===0&&(e%100!==0||e%400===0)}var QT=/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/,eO=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Wv(e){let t=QT.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&YT(r)?29:eO[n])}function Vl(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Ul=/^(\\d\\d):(\\d\\d):(\\d\\d(?:\\.\\d+)?)(z|([+-])(\\d\\d)(?::?(\\d\\d))?)?$/i;function Ll(e){return function(r){let n=Ul.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]===\"-\"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function Hl(e,t){if(!(e&&t))return;let r=new Date(\"2020-01-01T\"+e).valueOf(),n=new Date(\"2020-01-01T\"+t).valueOf();if(r&&n)return r-n}function Gv(e,t){if(!(e&&t))return;let r=Ul.exec(e),n=Ul.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var Fl=/t|\\s/i;function Jv(e){let t=Ll(e);return function(n){let o=n.split(Fl);return o.length===2&&Wv(o[0])&&t(o[1])}}function Xv(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function Yv(e,t){if(!(e&&t))return;let[r,n]=e.split(Fl),[o,s]=t.split(Fl),i=Vl(r,o);if(i!==void 0)return i||Hl(n,s)}var tO=/\\/|:/,rO=/^(?:[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 nO(e){return tO.test(e)&&rO.test(e)}var Kv=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function oO(e){return Kv.lastIndex=0,Kv.test(e)}var sO=-(2**31),iO=2**31-1;function aO(e){return Number.isInteger(e)&&e<=iO&&e>=sO}function cO(e){return Number.isInteger(e)}function Bv(){return!0}var uO=/[^\\\\]\\\\Z/;function lO(e){if(uO.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var ew=P(hn=>{\"use strict\";Object.defineProperty(hn,\"__esModule\",{value:!0});hn.formatLimitDefinition=void 0;var dO=ql(),dt=Z(),Qt=dt.operators,Fi={formatMaximum:{okStr:\"<=\",ok:Qt.LTE,fail:Qt.GT},formatMinimum:{okStr:\">=\",ok:Qt.GTE,fail:Qt.LT},formatExclusiveMaximum:{okStr:\"<\",ok:Qt.LT,fail:Qt.GTE},formatExclusiveMinimum:{okStr:\">\",ok:Qt.GT,fail:Qt.LTE}},pO={message:({keyword:e,schemaCode:t})=>(0,dt.str)`should be ${Fi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,dt._)`{comparison: ${Fi[e].okStr}, limit: ${t}}`};hn.formatLimitDefinition={keyword:Object.keys(Fi),type:\"string\",schemaType:\"string\",$data:!0,error:pO,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new dO.KeywordCxt(s,a.RULES.all.format.definition,\"format\");c.$data?u():l();function u(){let m=t.scopeValue(\"formats\",{ref:a.formats,code:i.code.formats}),p=t.const(\"fmt\",(0,dt._)`${m}[${c.schemaCode}]`);e.fail$data((0,dt.or)((0,dt._)`typeof ${p} != \"object\"`,(0,dt._)`${p} instanceof RegExp`,(0,dt._)`typeof ${p}.compare != \"function\"`,d(p)))}function l(){let m=c.schema,p=a.formats[m];if(!p||p===!0)return;if(typeof p!=\"object\"||p instanceof RegExp||typeof p.compare!=\"function\")throw new Error(`\"${o}\": format \"${m}\" does not define \"compare\" function`);let f=t.scopeValue(\"formats\",{key:m,ref:p,code:i.code.formats?(0,dt._)`${i.code.formats}${(0,dt.getProperty)(m)}`:void 0});e.fail$data(d(f))}function d(m){return(0,dt._)`${m}.compare(${r}, ${n}) ${Fi[o].fail} 0`}},dependencies:[\"format\"]};var fO=e=>(e.addKeyword(hn.formatLimitDefinition),e);hn.default=fO});var ow=P((Fo,nw)=>{\"use strict\";Object.defineProperty(Fo,\"__esModule\",{value:!0});var gn=Qv(),mO=ew(),Jl=Z(),tw=new Jl.Name(\"fullFormats\"),hO=new Jl.Name(\"fastFormats\"),Kl=(e,t={keywords:!0})=>{if(Array.isArray(t))return rw(e,t,gn.fullFormats,tw),e;let[r,n]=t.mode===\"fast\"?[gn.fastFormats,hO]:[gn.fullFormats,tw],o=t.formats||gn.formatNames;return rw(e,o,r,n),t.keywords&&(0,mO.default)(e),e};Kl.get=(e,t=\"full\")=>{let n=(t===\"fast\"?gn.fastFormats:gn.fullFormats)[e];if(!n)throw new Error(`Unknown format \"${e}\"`);return n};function rw(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Jl._)`require(\"ajv-formats/dist/formats\").${n}`);for(let i of t)e.addFormat(i,r[i])}nw.exports=Fo=Kl;Object.defineProperty(Fo,\"__esModule\",{value:!0});Fo.default=Kl});var yw=P(od=>{\"use strict\";var hw=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *(\"(?:[\\u000b\\u0020\\u0021\\u0023-\\u005b\\u005d-\\u007e\\u0080-\\u00ff]|\\\\[\\u000b\\u0020-\\u00ff])*\"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,bO=/^[\\u000b\\u0020-\\u007e\\u0080-\\u00ff]+$/,gw=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,$O=/\\\\([\\u000b\\u0020-\\u00ff])/g,xO=/([\\\\\"])/g,_w=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;od.format=zO;od.parse=SO;function zO(e){if(!e||typeof e!=\"object\")throw new TypeError(\"argument obj is required\");var t=e.parameters,r=e.type;if(!r||!_w.test(r))throw new TypeError(\"invalid type\");var n=r;if(t&&typeof t==\"object\")for(var o,s=Object.keys(t).sort(),i=0;i<s.length;i++){if(o=s[i],!gw.test(o))throw new TypeError(\"invalid parameter name\");n+=\"; \"+o+\"=\"+PO(t[o])}return n}function SO(e){if(!e)throw new TypeError(\"argument string is required\");var t=typeof e==\"object\"?kO(e):e;if(typeof t!=\"string\")throw new TypeError(\"argument string is required to be a string\");var r=t.indexOf(\";\"),n=r!==-1?t.slice(0,r).trim():t.trim();if(!_w.test(n))throw new TypeError(\"invalid media type\");var o=new EO(n.toLowerCase());if(r!==-1){var s,i,a;for(hw.lastIndex=r;i=hw.exec(t);){if(i.index!==r)throw new TypeError(\"invalid parameter format\");r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34&&(a=a.slice(1,-1),a.indexOf(\"\\\\\")!==-1&&(a=a.replace($O,\"$1\"))),o.parameters[s]=a}if(r!==t.length)throw new TypeError(\"invalid parameter format\")}return o}function kO(e){var t;if(typeof e.getHeader==\"function\"?t=e.getHeader(\"content-type\"):typeof e.headers==\"object\"&&(t=e.headers&&e.headers[\"content-type\"]),typeof t!=\"string\")throw new TypeError(\"content-type header is missing from object\");return t}function PO(e){var t=String(e);if(gw.test(t))return t;if(t.length>0&&!bO.test(t))throw new TypeError(\"invalid parameter value\");return'\"'+t.replace(xO,\"\\\\$1\")+'\"'}function EO(e){this.parameters=Object.create(null),this.type=e}});var aa;aa=globalThis.crypto;async function Tw(e){return(await aa).getRandomValues(new Uint8Array(e))}async function Ow(e){let t=\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~\",r=Math.pow(2,8)-Math.pow(2,8)%t.length,n=\"\";for(;n.length<e;){let o=await Tw(e-n.length);for(let s of o)s<r&&(n+=t[s%t.length])}return n}async function Rw(e){return await Ow(e)}async function Cw(e){let t=await(await aa).subtle.digest(\"SHA-256\",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\\//g,\"_\").replace(/\\+/g,\"-\").replace(/=/g,\"\")}async function ca(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await Rw(e),r=await Cw(t);return{code_verifier:t,code_challenge:r}}var A={};ea(A,{BIGINT_FORMAT_RANGES:()=>cs,CONSTANT_CATCH:()=>Jd,Class:()=>da,NUMBER_FORMAT_RANGES:()=>En,aborted:()=>rt,allowsEval:()=>ga,assert:()=>jw,assertEqual:()=>Iw,assertIs:()=>Nw,assertNever:()=>Mw,assertNotEqual:()=>Aw,assignProp:()=>He,attachSchema:()=>ls,base64ToUint8Array:()=>Vd,base64urlToUint8Array:()=>r0,cached:()=>Cr,captureStackTrace:()=>is,cleanEnum:()=>t0,cleanRegex:()=>Pn,clone:()=>Be,cloneDef:()=>qw,codePointLength:()=>Tn,constantCatch:()=>Kd,createTransparentProxy:()=>Jw,defineLazy:()=>jd,defineLazyInternal:()=>K,derived:()=>i0,esc:()=>ma,escapeRegex:()=>xt,explicitlyAborted:()=>va,extend:()=>Ww,finalizeIssue:()=>nt,floatSafeRemainder:()=>fa,getElementAtPath:()=>Uw,getEnumValues:()=>Or,getLengthableOrigin:()=>On,getParsedType:()=>Hw,getSizableOrigin:()=>Fd,hexToUint8Array:()=>o0,hide:()=>ds,installLazyProp:()=>l0,isObject:()=>or,isPlainObject:()=>Ut,issue:()=>Ar,joinValues:()=>ss,jsonStringifyReplacer:()=>Rr,members:()=>ba,merge:()=>Xw,mergeDefs:()=>$t,normalizeParams:()=>R,nullish:()=>pa,numKeys:()=>Vw,objectClone:()=>Zw,omit:()=>Bw,optionalKeys:()=>ya,own:()=>qt,parsedType:()=>wa,partial:()=>Yw,pick:()=>Kw,prefixIssues:()=>zt,primitiveTypes:()=>Ud,promiseAllObject:()=>Lw,propertyKeyTypes:()=>_a,randomString:()=>Fw,rawShape:()=>Ir,required:()=>Qw,safeExtend:()=>Gw,shallowClone:()=>qd,slugify:()=>ha,stringifyPrimitive:()=>as,toZod:()=>Md,uint8ArrayToBase64:()=>Hd,uint8ArrayToBase64url:()=>n0,uint8ArrayToHex:()=>s0,unwrapMessage:()=>Tr});function Iw(e){return e}function Aw(e){return e}function Md(){return e=>e}function Nw(e){}function Mw(e){throw new Error(\"Unexpected value in exhaustive check\")}function jw(e){}function Or(e){let t=Object.values(e).filter(n=>typeof n==\"number\");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function ss(e,t=\"|\"){return e.map(r=>as(r)).join(t)}function Rr(e,t){return typeof t==\"bigint\"?t.toString():t}var la=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Cr(e){return new la(e)}function pa(e){return e==null}function Pn(e){let t=e.startsWith(\"^\")?1:0,r=e.endsWith(\"$\")?e.length-1:e.length;return e.slice(t,r)}function fa(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var Nd=Symbol(\"evaluating\");function jd(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Nd)return n===void 0&&(n=Nd,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Zw(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function He(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ir(e){let t=Object.getOwnPropertyDescriptor(e,\"shape\");return t?.get?t.get.raw:t?.value}function bt(e){return Ir(e._zod.def)??e._zod.def.shape}function Zd(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return He(this,t,n),n},enumerable:!0,configurable:!0})}function Dd(e,t,r){t in e?He(e,t,r):e[t]=r}function nr(e,t,r,n){let o=bt(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);i.enumerable&&(i.get?Zd(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a}):Dd(e,s,n?n(i.value,s):i.value))}}function Dw(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Zd(e,r,()=>t[r]):Dd(e,r,n.value))}}function $t(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function qw(e){return $t(e._zod.def)}function Uw(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Lw(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=n[s];return o})}function Fw(e=10){let t=\"abcdefghijklmnopqrstuvwxyz\",r=\"\";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function ma(e){return JSON.stringify(e)}function ha(e){return e.toLowerCase().trim().replace(/[^\\w\\s-]/g,\"\").replace(/[\\s_-]+/g,\"-\").replace(/^-+|-+$/g,\"\")}var is=\"captureStackTrace\"in Error?Error.captureStackTrace:(...e)=>{};function or(e){return typeof e==\"object\"&&e!==null&&!Array.isArray(e)}var ga=Cr(()=>{if(Me.jitless||typeof navigator<\"u\"&&navigator?.userAgent?.includes(\"Cloudflare\"))return!1;try{let e=Function;return new e(\"\"),!0}catch{return!1}});function Ut(e){if(or(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=\"function\")return!0;let r=t.prototype;return!(or(r)===!1||Object.prototype.hasOwnProperty.call(r,\"isPrototypeOf\")===!1)}function qd(e){return Ut(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Vw(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Hw=e=>{let t=typeof e;switch(t){case\"undefined\":return\"undefined\";case\"string\":return\"string\";case\"number\":return Number.isNaN(e)?\"nan\":\"number\";case\"boolean\":return\"boolean\";case\"function\":return\"function\";case\"bigint\":return\"bigint\";case\"symbol\":return\"symbol\";case\"object\":return Array.isArray(e)?\"array\":e===null?\"null\":e.then&&typeof e.then==\"function\"&&e.catch&&typeof e.catch==\"function\"?\"promise\":typeof Map<\"u\"&&e instanceof Map?\"map\":typeof Set<\"u\"&&e instanceof Set?\"set\":typeof Date<\"u\"&&e instanceof Date?\"date\":typeof File<\"u\"&&e instanceof File?\"file\":\"object\";default:throw new Error(`Unknown data type: ${t}`)}},_a=new Set([\"string\",\"number\",\"symbol\"]),Ud=new Set([\"string\",\"number\",\"bigint\",\"boolean\",\"symbol\",\"undefined\"]);function xt(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\")}function Be(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function R(e){let t=e;if(!t)return{};if(typeof t==\"string\")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error(\"Cannot specify both `message` and `error` params\");t.error=t.message}return delete t.message,typeof t.error==\"string\"?{...t,error:()=>t.error}:t}function Jw(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,s){return t??(t=e()),Reflect.set(t,n,o,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function as(e){return typeof e==\"bigint\"?e.toString()+\"n\":typeof e==\"string\"?`\"${e}\"`:`${e}`}function ya(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===\"optional\")}var En={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},cs={int64:[BigInt(\"-9223372036854775808\"),BigInt(\"9223372036854775807\")],uint64:[BigInt(0),BigInt(\"18446744073709551615\")]};function Kw(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(\".pick() cannot be used on object schemas containing refinements\");let s={};return nr(s,e,us(e,t)),Be(e,$t(r,{shape:s,checks:[]}))}function us(e,t){let r=bt(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: \"${String(o)}\"`);t[o]&&n.push(o)}return n}function Bw(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(\".omit() cannot be used on object schemas containing refinements\");let s=new Set(us(e,t)),i={};return nr(i,e,Reflect.ownKeys(bt(e)).filter(a=>!s.has(a))),Be(e,$t(r,{shape:i,checks:[]}))}function Ww(e,t){if(!Ut(t))throw new Error(\"Invalid input to extend: expected a plain object\");let r=e._zod.def.checks;if(r&&r.length>0){let o=bt(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error(\"Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.\")}return Be(e,$t(e._zod.def,{shape:Ld(e,t)}))}function Ld(e,t){let r={};return nr(r,e,Reflect.ownKeys(bt(e))),Dw(r,t),r}function Gw(e,t){if(!Ut(t))throw new Error(\"Invalid input to safeExtend: expected a plain object\");return Be(e,$t(e._zod.def,{shape:Ld(e,t)}))}function Xw(e,t){if(!t?._zod?.def)throw new Error(\"Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.\");if(e._zod.def.checks?.length)throw new Error(\".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.\");let r={};nr(r,e,Reflect.ownKeys(bt(e))),nr(r,t,Reflect.ownKeys(bt(t)));let n=$t(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Be(e,n)}function Yw(e,t,r,n=\"partial\"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(us(t,r)):void 0,c={};return nr(c,t,Reflect.ownKeys(bt(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:\"optional\",innerType:u}))),Be(t,$t(t._zod.def,{shape:c,checks:[]}))}function Qw(e,t,r){let n=r?new Set(us(t,r)):void 0,o={};return nr(o,t,Reflect.ownKeys(bt(t)),(s,i)=>n&&!n.has(i)?s:new e({type:\"nonoptional\",innerType:s})),Be(t,$t(t._zod.def,{shape:o}))}function rt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function va(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function zt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Tr(e){return typeof e==\"string\"?e:e?.message}function ls(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function nt(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has(\"$ZodType\")&&(o.has(\"$ZodCheck\")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:Tr(e.inst?._zod.def?.error?.(e))??Tr(s?.(e))??Tr(t?.error?.(e))??Tr(r.customError?.(e))??Tr(r.localeError?.(e))??\"Invalid input\",a={};for(let c of Object.keys(e))c===\"inst\"||c===\"schema\"||c===\"continue\"||c===\"input\"||c===\"__proto__\"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=i,t?.reportInput&&(a.input=e.input),a}function Fd(e){return e instanceof Set?\"set\":e instanceof Map?\"map\":e instanceof File?\"file\":\"unknown\"}var e0=/[\\uD800-\\uDBFF]/;function Tn(e){let t=e.length;if(!e0.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function On(e){return Array.isArray(e)?\"array\":typeof e==\"string\"?\"string\":\"unknown\"}function wa(e){let t=typeof e;switch(t){case\"number\":return Number.isNaN(e)?\"nan\":\"number\";case\"object\":{if(e===null)return\"null\";if(Array.isArray(e))return\"array\";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&\"constructor\"in r&&r.constructor)return r.constructor.name}}return t}function Ar(...e){let[t,r,n]=e;return typeof t==\"string\"?{message:t,code:\"custom\",input:r,inst:n}:{...t}}function t0(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Vd(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Hd(e){let t=\"\";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function r0(e){let t=e.replace(/-/g,\"+\").replace(/_/g,\"/\"),r=\"=\".repeat((4-t.length%4)%4);return Vd(t+r)}function n0(e){return Hd(e).replace(/\\+/g,\"-\").replace(/\\//g,\"_\").replace(/=/g,\"\")}function o0(e){let t=e.replace(/^0x/,\"\");if(t.length%2!==0)throw new Error(\"Invalid hex string length\");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function s0(e){return Array.from(e).map(t=>t.toString(16).padStart(2,\"0\")).join(\"\")}var da=class{constructor(...t){}};function ba(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):a0(e,r,n.value)}}function qt(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function ds(e,t,r){return qt(e,t,r,!1)}function i0(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return qt(this,r,n(this))},set(o){qt(this,r,o)}})}return t}function a0(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:qt(this,t,r.bind(this))},set(n){qt(this,t,n)}})}function c0(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var ua,Dt=!1,u0={configurable:!0,get(){Dt=!0}};function K(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&ua!==e._zod){ua=void 0;return}ua=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,u0);let o=Dt;Dt=!1;try{let s=r(this);return Dt?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),Dt=Dt||o,s}catch(s){throw delete this[t],Dt=Dt||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function l0(e,t,r,n){let o=c0(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var Jd=\"~constantCatch\";function Kd(e){let t=()=>e;return t[Jd]=!0,t}var Bd,xa=Object.freeze({status:\"aborted\"}),$a={value:void 0,enumerable:!1},Wd=\"captureStackTrace\"in Error?Error:null;function d0(e){let t=Wd;if(t){let r=t.stackTraceLimit;if(typeof r==\"number\"){try{t.stackTraceLimit=0}catch{return Wd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function v(e,t,r,n){let o={};function s(m){this.def=m,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function c(m,p){if(m._zod){if(m._zod.traits.has(e))return}else{$a.value=new s(p);try{Object.defineProperty(m,\"_zod\",$a)}finally{$a.value=void 0}}if(m._zod.traits.add(e),t(m,p),a){let g=Object.getPrototypeOf(m),h=m._zod.constr.prototype,y=g;for(;y&&y!==h;)y=Object.getPrototypeOf(y);let x=y??g;a.has(x)||(a.add(x),ba(x,i))}let f=d.prototype;for(let g in f)Object.prototype.hasOwnProperty.call(f,g)&&(g in m||(m[g]=f[g].bind(m)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,\"name\",{value:e});function d(m){let p=n?.Parent?d0(l):this;c(p,m);let f=p._zod.deferred;if(f){for(let h of f)h();p._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;return g&&g(p),p}return Object.defineProperty(d,\"init\",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:m=>n?.Parent&&m instanceof n.Parent?!0:m?._zod?.traits?.has(e)}),Object.defineProperty(d,\"name\",{value:e}),d}var ot=class extends Error{constructor(){super(\"Encountered Promise during synchronous parse. Use .parseAsync() instead.\")}},Nr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name=\"ZodEncodeError\"}};(Bd=globalThis).__zod_globalConfig??(Bd.__zod_globalConfig={});var Me=globalThis.__zod_globalConfig;function je(e){return e&&Object.assign(Me,e),Me}function p0(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Rr,2)),e.message}function f0(e){this._zod.message=e}var m0={get:p0,set:f0,enumerable:!0,configurable:!0},Sa={value:void 0,enumerable:!1},Gd=new WeakSet([Object.prototype,Error.prototype]),Xd=(e,t)=>{e.name=\"$ZodError\",Sa.value=t,Object.defineProperty(e,\"issues\",Sa),Sa.value=void 0,Object.defineProperty(e,\"message\",m0);let r=Object.getPrototypeOf(e);Gd.has(r)||(Gd.add(r),Object.defineProperty(r,\"toString\",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,\"toString\",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,\"toString\",{value:n,configurable:!0,writable:!0})}}))},Yd=v(\"$ZodError\",Xd),Qd=v(\"$ZodError\",Xd,void 0,{Parent:Error});function h0(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t===\"__proto__\"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function ka(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?h0(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Pa(e,t=r=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code===\"invalid_union\"&&i.errors.length)i.errors.map(a=>n({issues:a},[...s,...i.path]));else if(i.code===\"invalid_key\")n({issues:i.issues},[...s,...i.path]);else if(i.code===\"invalid_element\")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u],d=u===a.length-1;if(l===\"_errors\"){d&&c._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[l];d&&m._errors.push(t(i)),c=m,u++}}}};return n(e),r}function ps(e,t){return{callee:t?.callee??e,Err:t?.Err}}var fs=e=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new ot;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>nt(u,i,je())));throw is(c,s?.callee??t),c}return a.value};return t};var ms=e=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>nt(u,i,je())));throw is(c,s?.callee??t),c}return a.value};return t};var Rn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ot;return s.issues.length?ep(e,s.issues,o):{success:!0,data:s.value}},Ea=Rn(Qd);function ep(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>nt(o,r,je()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var hs=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?ep(e,s.issues,o):{success:!0,data:s.value}};var _0=Symbol.for(\"zod.compile.invalid\"),y0=Symbol.for(\"zod.compile.fallback\"),gs=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==_0)return!0;if(n.definite===!0&&r===void 0)return!1}return v0(e,t,r)});function v0(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o?(n[y0]=!0,s=o({value:t,issues:[]},n)):s=e._zod.run({value:t,issues:[]},n),s instanceof Promise)throw new ot;return s.issues.length===0}var _s=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},tp=e=>{let t=fs(e),r=(n,o,s,i)=>{let a=s?{...s,direction:\"backward\"}:{direction:\"backward\"};return t(n,o,a,ps(r,i))};return r};var rp=e=>{let t=fs(e),r=(n,o,s,i)=>t(n,o,s,ps(r,i));return r};var np=e=>{let t=ms(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:\"backward\"}:{direction:\"backward\"};return await t(n,o,a,ps(r,i))};return r};var op=e=>{let t=ms(e),r=async(n,o,s,i)=>await t(n,o,s,ps(r,i));return r};var sp=e=>(t,r,n)=>{let o=n?{...n,direction:\"backward\"}:{direction:\"backward\"};return Rn(e)(t,r,o)};var ip=e=>(t,r,n)=>Rn(e)(t,r,n);var ap=e=>async(t,r,n)=>{let o=n?{...n,direction:\"backward\"}:{direction:\"backward\"};return hs(e)(t,r,o)};var cp=e=>async(t,r,n)=>hs(e)(t,r,n);var up=/^[cC][0-9a-z]{6,}$/,lp=/^[0-9a-z]+$/,dp=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,pp=/^[0-9a-vA-V]{20}$/,fp=/^[A-Za-z0-9]{27}$/,mp=/^[a-zA-Z0-9_-]{21}$/;function hp(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var gp=/^P(?:(\\d+W)|(?!.*W)(?=\\d|T\\d)(\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+([.,]\\d+)?S)?)?)$/;var _p=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Oa=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var yp=/^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$/;var w0=\"^(?=[\\\\s\\\\S]*[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\u20E3])[\\\\p{Extended_Pictographic}\\\\p{Emoji_Component}]+$\";function vp(){return new RegExp(w0,\"u\")}var wp=/^(?:(?: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])$/,bp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var $p=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/([0-9]|[1-2][0-9]|3[0-2])$/,xp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,zp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Sp=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var kp=/^https?$/,Pp=/^\\+[1-9]\\d{6,14}$/;var Ep=\"(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))\";function b0(e){return new RegExp(`^${e}$`)}var Tp=b0(Ep);function Ta(e){let t=\"(?:[01]\\\\d|2[0-3]):[0-5]\\\\d\";return typeof e.precision==\"number\"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\\\d`:`${t}:[0-5]\\\\d\\\\.\\\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\\\d(?:\\\\.\\\\d+)?`:`${t}(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?`}function Op(e){return new RegExp(`^${Ta(e)}$`)}function Rp(e){let t=[\"Z\"];e.offset&&t.push(\"([+-](?:[01]\\\\d|2[0-3]):[0-5]\\\\d)\");let r=`${Ta({precision:e.precision,seconds:!0})}(?:${t.join(\"|\")})`,n=e.local?`${r}|${Ta({precision:e.precision})}`:r;return new RegExp(`^${Ep}T(?:${n})$`)}var Cp=/^[\\s\\S]{0,}$/;var Ip=/^-?\\d+n?$/,Ra=/^-?\\d+$/,Cn=/^-?\\d+(?:\\.\\d+)?$/,Ap=/^(?:true|false)$/i,Np=/^null$/i;var Mp=/^[^A-Z]*$/,jp=/^[^a-z]*$/;var ve=v(\"$ZodCheck\",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ca=e=>{let t=e.value;return!pa(t)&&t.length!==void 0},ys={number:\"number\",bigint:\"bigint\",object:\"date\"},Ia=v(\"$ZodCheckLessThan\",(e,t)=>{ve.init(e,t);let r=ys[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:ys[typeof n.value]??r,code:\"too_big\",maximum:typeof t.value==\"object\"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Aa=v(\"$ZodCheckGreaterThan\",(e,t)=>{ve.init(e,t);let r=ys[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:ys[typeof n.value]??r,code:\"too_small\",minimum:typeof t.value==\"object\"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Zp=v(\"$ZodCheckMultipleOf\",(e,t)=>{ve.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error(\"Cannot mix number and bigint in multiple_of check.\");(typeof r.value==\"bigint\"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):fa(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:\"not_multiple_of\",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Dp=v(\"$ZodCheckNumberFormat\",(e,t)=>{ve.init(e,t),t.format=t.format||\"float64\";let r=t.format?.includes(\"int\"),n=r?\"int\":\"number\",[o,s]=En[t.format];e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:\"invalid_type\",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:\"too_big\",maximum:Number.MAX_SAFE_INTEGER,note:\"Integers must be within the safe integer range.\",inst:e,origin:n,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:\"too_small\",minimum:Number.MIN_SAFE_INTEGER,note:\"Integers must be within the safe integer range.\",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:\"number\",input:a,code:\"too_small\",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:\"number\",input:a,code:\"too_big\",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var qp=v(\"$ZodCheckMaxLength\",(e,t)=>{var r;ve.init(e,t),(r=e._zod.def).when??(r.when=Ca),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o==\"string\"&&s>t.maximum?Tn(o):s)<=t.maximum)return;let a=On(o);n.issues.push({origin:a,code:\"too_big\",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Up=v(\"$ZodCheckMinLength\",(e,t)=>{var r;ve.init(e,t),(r=e._zod.def).when??(r.when=Ca),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o==\"string\"&&s>=t.minimum&&s<t.minimum*2?Tn(o):s)>=t.minimum)return;let a=On(o);n.issues.push({origin:a,code:\"too_small\",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Lp=v(\"$ZodCheckLengthEquals\",(e,t)=>{var r;ve.init(e,t),(r=e._zod.def).when??(r.when=Ca),e._zod.check=n=>{let o=n.value,s=o.length,i=typeof o==\"string\"&&s>=t.length&&s<=t.length*2?Tn(o):s;if(i===t.length)return;let a=On(o),c=i>t.length;n.issues.push({origin:a,...c?{code:\"too_big\",maximum:t.length}:{code:\"too_small\",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),In=v(\"$ZodCheckStringFormat\",(e,t)=>{var r,n;ve.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:\"string\",code:\"invalid_format\",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Fp=v(\"$ZodCheckRegex\",(e,t)=>{In.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:\"string\",code:\"invalid_format\",format:\"regex\",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Vp=v(\"$ZodCheckLowerCase\",(e,t)=>{t.pattern??(t.pattern=Mp),In.init(e,t)}),Hp=v(\"$ZodCheckUpperCase\",(e,t)=>{t.pattern??(t.pattern=jp),In.init(e,t)}),Jp=v(\"$ZodCheckIncludes\",(e,t)=>{ve.init(e,t);let r=xt(t.includes),n=new RegExp(typeof t.position==\"number\"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:\"string\",code:\"invalid_format\",format:\"includes\",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Kp=v(\"$ZodCheckStartsWith\",(e,t)=>{ve.init(e,t);let r=new RegExp(`^${xt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:\"string\",code:\"invalid_format\",format:\"starts_with\",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Bp=v(\"$ZodCheckEndsWith\",(e,t)=>{ve.init(e,t);let r=new RegExp(`.*${xt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:\"string\",code:\"invalid_format\",format:\"ends_with\",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Wp=v(\"$ZodCheckOverwrite\",(e,t)=>{ve.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var vs=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t==\"function\"){t(this,{execution:\"sync\"}),t(this,{execution:\"async\"});return}let n=t.split(`\n`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>\" \".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.content??[\"\"];return new t(...Object.keys(this.closed),`return function (${this.args.join(\", \")}) {\n${r.join(`\n`)}\n};`)(...Object.values(this.closed))}};var Xp={major:4,minor:6,patch:5};var X=v(\"$ZodType\",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Xp;let n=e._zod.def.checks,o=e._zod.traits.has(\"$ZodCheck\")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=rt(a),d;for(let m of c){if(m._zod.def.when){if(va(a)||!m._zod.def.when(a))continue}else if(l)continue;let p=a.issues.length,f=m._zod.check(a);if(f instanceof Promise&&u?.async===!1)throw new ot;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(ls(a.issues,p,e),l||(l=rt(a,p)))});else{if(a.issues.length===p)continue;ls(a.issues,p,e),l||(l=rt(a,p))}}return d?d.then(()=>a):a},i=(a,c,u)=>{if(rt(a))return a.aborted=!0,a;let l=s(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new ot;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction===\"backward\"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,c)):i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new ot;return u.then(l=>s(l,o,c))}return s(u,o,c)}}},{get\"~standard\"(){return ds(this,\"~standard\",Ma(this))},set\"~standard\"(e){qt(this,\"~standard\",e)}}),uf=(e,t)=>e.issues.length?{issues:e.issues.map(r=>nt(r,t,je()))}:{value:e.value};async function $0(e,t){let r={async:!0};return uf(await e._zod.run({value:t,issues:[]},r),r)}function Ma(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return uf(n,r)}catch{}return $0(e,t)},vendor:\"zod\",version:1}}var xs=v(\"$ZodString\",(e,t)=>{X.init(e,t),e._zod.pattern=t.pattern??Cp,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value==\"string\"||r.issues.push({expected:\"string\",code:\"invalid_type\",input:r.value,inst:e}),r}}),oe=v(\"$ZodStringFormat\",(e,t)=>{In.init(e,t),xs.init(e,t)}),lf=v(\"$ZodGUID\",(e,t)=>{t.pattern??(t.pattern=_p),oe.init(e,t)}),df=v(\"$ZodUUID\",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: \"${t.version}\"`);t.pattern??(t.pattern=Oa(n))}else t.pattern??(t.pattern=Oa());oe.init(e,t)}),pf=v(\"$ZodEmail\",(e,t)=>{t.pattern??(t.pattern=yp),oe.init(e,t)}),ff=1,bs=2;function mf(e){try{return typeof URL<\"u\"&&typeof URL.canParse==\"function\"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function x0(e,t){return!(\"normalize\"in t)&&!(\"hostname\"in t)&&!(\"protocol\"in t)?mf(e)||bs:z0(e,t)}function z0(e,t){if(!t.normalize&&t.protocol?.source===kp.source&&!/^https?:\\/\\//i.test(e))return ff;try{if(typeof URL<\"u\"){let r=URL;if(typeof r.parse==\"function\")return r.parse(e)??bs}return new URL(e)}catch{return bs}}var S0=/[\\t\\n\\r]/g;function Yp(e){return e.replace(S0,\"\")}function k0(e,t){return t.lastIndex=0,t.test(e.hostname)}function P0(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(\":\")?e.protocol.slice(0,-1):e.protocol)}var hf=v(\"$ZodURL\",(e,t)=>{oe.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=x0(n,t);if(o===ff){r.issues.push({code:\"invalid_format\",format:\"url\",note:\"Invalid URL format\",input:r.value,inst:e,continue:!t.abort});return}if(o===bs){r.issues.push({code:\"invalid_format\",format:\"url\",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Yp(n);return}t.hostname&&!k0(o,t.hostname)&&r.issues.push({code:\"invalid_format\",format:\"url\",note:\"Invalid hostname\",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!P0(o,t.protocol)&&r.issues.push({code:\"invalid_format\",format:\"url\",note:\"Invalid protocol\",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:Yp(n);return}catch{r.issues.push({code:\"invalid_format\",format:\"url\",input:r.value,inst:e,continue:!t.abort})}}}),gf=v(\"$ZodEmoji\",(e,t)=>{t.pattern??(t.pattern=vp()),oe.init(e,t)}),_f=v(\"$ZodNanoID\",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?mp:hp(t.length)),oe.init(e,t)}),yf=v(\"$ZodCUID\",(e,t)=>{t.pattern??(t.pattern=up),oe.init(e,t)}),vf=v(\"$ZodCUID2\",(e,t)=>{t.pattern??(t.pattern=lp),oe.init(e,t)}),wf=v(\"$ZodULID\",(e,t)=>{t.pattern??(t.pattern=dp),oe.init(e,t)}),bf=v(\"$ZodXID\",(e,t)=>{t.pattern??(t.pattern=pp),oe.init(e,t)}),$f=v(\"$ZodKSUID\",(e,t)=>{t.pattern??(t.pattern=fp),oe.init(e,t)}),xf=v(\"$ZodISODateTime\",(e,t)=>{t.pattern??(t.pattern=Rp(t)),oe.init(e,t)}),zf=v(\"$ZodISODate\",(e,t)=>{t.pattern??(t.pattern=Tp),oe.init(e,t)}),Sf=v(\"$ZodISOTime\",(e,t)=>{t.pattern??(t.pattern=Op(t)),oe.init(e,t)}),kf=v(\"$ZodISODuration\",(e,t)=>{t.pattern??(t.pattern=gp),oe.init(e,t)}),Pf=v(\"$ZodIPv4\",(e,t)=>{t.pattern??(t.pattern=wp),oe.init(e,t)}),E0=/^[0-9a-fA-F:.]+$/;function Ef(e){return E0.test(e)?mf(`http://[${e}]`):!1}var Tf=v(\"$ZodIPv6\",(e,t)=>{t.pattern??(t.pattern=bp),oe.init(e,t),e._zod.check=r=>{Ef(r.value)||r.issues.push({code:\"invalid_format\",format:\"ipv6\",input:r.value,inst:e,continue:!t.abort})}});var Of=v(\"$ZodCIDRv4\",(e,t)=>{t.pattern??(t.pattern=$p),oe.init(e,t)});function T0(e){let t=e.split(\"/\");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Ef(r)}var Rf=v(\"$ZodCIDRv6\",(e,t)=>{t.pattern??(t.pattern=xp),oe.init(e,t),e._zod.check=r=>{T0(r.value)||r.issues.push({code:\"invalid_format\",format:\"cidrv6\",input:r.value,inst:e,continue:!t.abort})}});function Cf(e){if(e===\"\")return!0;if(/\\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var ja=/^[0-9a-zA-Z+/]*={0,2}$/,If=v(\"$ZodBase64\",(e,t)=>{t.pattern??(t.pattern=ja),oe.init(e,t),e._zod.check=r=>{Cf(r.value)||r.issues.push({code:\"invalid_format\",format:\"base64\",input:r.value,inst:e,continue:!t.abort})}}),zs=/^[A-Za-z0-9_-]*$/;function O0(e){if(!zs.test(e))return!1;let t=e.replace(/[-_]/g,n=>n===\"-\"?\"+\":\"/\"),r=t.padEnd(Math.ceil(t.length/4)*4,\"=\");return Cf(r)}var Af=v(\"$ZodBase64URL\",(e,t)=>{t.pattern??(t.pattern=zs),oe.init(e,t),e._zod.check=r=>{O0(r.value)||r.issues.push({code:\"invalid_format\",format:\"base64url\",input:r.value,inst:e,continue:!t.abort})}}),Nf=v(\"$ZodE164\",(e,t)=>{t.pattern??(t.pattern=Pp),oe.init(e,t)});function R0(e,t=null){try{let r=e.split(\".\");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!(\"typ\"in o&&o?.typ!==\"JWT\"||!o.alg||t&&(!(\"alg\"in o)||o.alg!==t))}catch{return!1}}var Mf=v(\"$ZodJWT\",(e,t)=>{oe.init(e,t),e._zod.check=r=>{R0(r.value,t.alg)||r.issues.push({code:\"invalid_format\",format:\"jwt\",input:r.value,inst:e,continue:!t.abort})}});var Za=v(\"$ZodNumber\",(e,t)=>{X.init(e,t),e._zod.pattern=Cn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o==\"number\"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o==\"number\"?Number.isNaN(o)?\"NaN\":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:\"number\",code:\"invalid_type\",input:o,inst:e,...s?{received:s}:{}}),r}}),jf=v(\"$ZodNumberFormat\",(e,t)=>{Dp.init(e,t),Za.init(e,t)}),Zf=v(\"$ZodBoolean\",(e,t)=>{X.init(e,t),e._zod.pattern=Ap,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o==\"boolean\"||r.issues.push({expected:\"boolean\",code:\"invalid_type\",input:o,inst:e}),r}}),Df=v(\"$ZodBigInt\",(e,t)=>{X.init(e,t),e._zod.pattern=Ip,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value==\"bigint\"||r.issues.push({expected:\"bigint\",code:\"invalid_type\",input:r.value,inst:e}),r}});var qf=v(\"$ZodNull\",(e,t)=>{X.init(e,t),e._zod.pattern=Np,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:\"null\",code:\"invalid_type\",input:o,inst:e}),r}}),Uf=v(\"$ZodAny\",(e,t)=>{X.init(e,t),e._zod.parse=r=>r}),Lf=v(\"$ZodUnknown\",(e,t)=>{X.init(e,t),e._zod.parse=r=>r}),Ff=v(\"$ZodNever\",(e,t)=>{X.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:\"never\",code:\"invalid_type\",input:r.value,inst:e}),r)});var Vf=v(\"$ZodDate\",(e,t)=>{X.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:\"date\",code:\"invalid_type\",input:o,...s?{received:\"Invalid Date\"}:{},inst:e}),r}});function Qp(e,t,r){e.issues.length&&t.issues.push(...zt(r,e.issues)),t.value[r]=e.value}var Hf=v(\"$ZodArray\",(e,t)=>{X.init(e,t);let r=Me.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:\"array\",code:\"invalid_type\",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],a=o?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)i.push(l.then(d=>Qp(d,n,c)));else if(Qp(l,n,c),a&&l.issues.length!==0&&rt(l))break}return i.length?Promise.all(i).then(()=>n):n}});function $s(e,t,r,n,o,s){let i=r in n,a=s===\"optional\";if(!(!i&&a&&o===\"optional\")){if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...zt(r,e.issues))}if(!i&&o===void 0){e.issues.length||t.issues.push({code:\"invalid_type\",expected:\"nonoptional\",input:void 0,path:[r]});return}e.value===void 0?(i||o===\"defaulted\"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var C0=[];function Jf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:C0,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has(\"$ZodType\"))throw new Error(`Invalid element at key \"${String(i)}\": expected a Zod schema`);let s=ya(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Kf(e,t,r,n,o,s,i){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,d=u.optin,m=u.optout,p=0;for(let f in t){if(i&&r.issues.length!==p){if(rt(r,p))break;p=r.issues.length}if(c.has(f))continue;if(f===\"__proto__\"){l===\"never\"&&a.push(f);continue}if(l===\"never\"){a.push(f);continue}let g=u.run({value:t[f],issues:[]},n);g instanceof Promise?e.push(g.then(h=>$s(h,r,f,t,d,m))):$s(g,r,f,t,d,m)}return a.length&&r.issues.push({code:\"unrecognized_keys\",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var I0=v(\"$ZodObject\",(e,t)=>{X.init(e,t);let r=Object.getOwnPropertyDescriptor(t,\"shape\"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,\"shape\",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,\"shape\",{get:u})}let o=Cr(()=>Jf(t));K(e,\"propValues\",u=>{let l=u.def.shape,d={};for(let m in l){let p=l[m]._zod;if(p.values){Object.prototype.hasOwnProperty.call(d,m)||He(d,m,new Set);for(let f of p.values)d[m].add(f);p.optin!==void 0&&d[m].add(void 0)}}return d});let s=or,i=t.catchall,a,c=Me.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let d=u.value;if(!s(d))return u.issues.push({expected:\"object\",code:\"invalid_type\",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let m=[],p=a.shape,f=l?.abortEarly,g=u.issues.length;for(let h of a.allKeys){if(f&&u.issues.length!==g){if(rt(u,g))break;g=u.issues.length}if(h===\"__proto__\")continue;let y=p[h],x=y._zod.optin,S=y._zod.optout,M=y._zod.run({value:d[h],issues:[]},l);M instanceof Promise?m.push(M.then(b=>$s(b,u,h,d,x,S))):$s(M,u,h,d,x,S)}return i?Kf(m,d,u,l,o.value,e,f===!0):m.length?Promise.all(m).then(()=>u):u}}),Bf=v(\"$ZodObjectJIT\",(e,t)=>{I0.init(e,t);let r=e._zod.parse,n=Cr(()=>Jf(t)),o=Me.memoizer,s=p=>{let f=n.value,g=f.symbolKeys,h=new vs([\"payload\",\"ctx\"],{shape:p,inst:e,memo:o,syms:g}),y=b=>`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`,x=(b,$)=>`\n          let ${b}_ab = false;\n          for (let i = 0; i < ${b}.issues.length; i++) {\n            const iss = ${b}.issues[i];\n            iss.path = iss.path ? [${$}, ...iss.path] : [${$}];\n            payload.issues.push(iss);\n            if (iss.continue !== true) ${b}_ab = true;\n          }\n          if (${b}_ab && ctx && ctx.abortEarly) {\n            payload.value = newResult;\n            return payload;\n          }`;h.write(\"const input = payload.value;\");let S=Object.create(null),M=0;for(let b of f.allKeys)S[b]=`key_${M++}`;h.write(o?\"const newResult = memo.alloc(inst, payload, {}, ctx);\":\"const newResult = {};\");for(let b of f.allKeys){if(b===\"__proto__\")continue;let $=S[b],I=typeof b==\"symbol\"?`syms[${g.indexOf(b)}]`:ma(b),Q=`${I} in input`,q=p[b],ce=q?._zod?.optin,wt=ce!==void 0,tr=q?._zod?.optout===\"optional\";if(h.write(`const ${$} = ${y(I)};`),wt&&tr){let Pr=ce===\"optional\"?`${$}_present`:`${$}.value !== undefined || ${$}_present`;h.write(`\n        const ${$}_present = ${Q};\n        if (!${$}.issues.length || ${$}_present) {\n          if (${$}.issues.length) {${x($,I)}\n          }\n\n          if (${Pr}) {\n            newResult[${I}] = ${$}.value;\n          }\n        }\n\n      `)}else wt?(h.write(`\n        if (${$}.issues.length) {${x($,I)}\n        }\n      `),ce===\"defaulted\"?h.write(`newResult[${I}] = ${$}.value;`):h.write(`\n        if (${$}.value !== undefined || ${Q}) {\n          newResult[${I}] = ${$}.value;\n        }\n      `)):h.write(`\n        const ${$}_present = ${Q};\n        if (${$}.issues.length) {${x($,I)}\n        }\n        if (!${$}_present && !${$}.issues.length) {\n          payload.issues.push({\n            code: \"invalid_type\",\n            expected: \"nonoptional\",\n            input: undefined,\n            path: [${I}]\n          });\n          if (ctx && ctx.abortEarly) {\n            payload.value = newResult;\n            return payload;\n          }\n        }\n\n        if (${$}_present) {\n          newResult[${I}] = ${$}.value;\n        }\n\n      `)}return h.write(\"payload.value = newResult;\"),h.write(\"return payload;\"),h.compile()},i,a=or,c=!Me.jitless,l=c&&ga.value,d=t.catchall,m;e._zod.parse=(p,f)=>{m??(m=n.value);let g=p.value;return a(g)?c&&l&&f?.async===!1&&f.jitless!==!0?(i||(i=s(t.shape)),p=i(p,f),d?Kf([],g,p,f,m,e,f?.abortEarly===!0):p):r(p,f):(p.issues.push({expected:\"object\",code:\"invalid_type\",input:g,inst:e}),p)}});function ef(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!rt(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:\"invalid_union\",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>nt(i,n,je())))}),t)}var Da=v(\"$ZodUnion\",(e,t)=>{X.init(e,t),K(e,\"optin\",n=>n.def.options.some(o=>o._zod.optin===\"defaulted\")?\"defaulted\":n.def.options.some(o=>o._zod.optin!==void 0)?\"optional\":void 0),K(e,\"optout\",n=>n.def.options.some(o=>o._zod.optout===\"optional\")?\"optional\":void 0),K(e,\"values\",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),K(e,\"pattern\",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Pn(s.source)).join(\"|\")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>ef(a,n,e,o)):ef(i,n,e,o)}});function A0(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index \"${e.options.indexOf(r)}\"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value \"${String(o)}\"`);t.set(o,null)}else t.set(o,r)}return t}var Wf=v(\"$ZodDiscriminatedUnion\",(e,t)=>{t.inclusive=!1,Da.init(e,t);let r=e._zod.parse;K(e,\"propValues\",o=>{let s={},i=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index \"${o.def.options.indexOf(a)}\"`);c[o.def.discriminator]?.has(void 0)&&i++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(s,u)||He(s,u,new Set);for(let d of l)s[u].add(d)}}return!o.def.unionFallback&&i>1&&s[o.def.discriminator]?.delete(void 0),s}),t.options.forEach((o,s)=>{let i=Ir(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index \"${s}\"`)});let n=Cr(()=>A0(t));e._zod.parse=(o,s)=>{let i=o.value;if(!or(i))return o.issues.push({code:\"invalid_type\",expected:\"object\",input:i,inst:e}),o;let a=i?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||s.direction!==\"backward\")?c._zod.run(o,s):t.unionFallback||s.direction===\"backward\"?r(o,s):(o.issues.push({code:\"invalid_union\",errors:[],note:\"No matching discriminator\",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),o)}}),Gf=v(\"$ZodIntersection\",(e,t)=>{X.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>tf(r,c,u)):tf(r,s,i)}});function Na(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ut(e)&&Ut(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,\"__proto__\")&&delete o.__proto__;for(let s of n){if(s===\"__proto__\")continue;let i=Na(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Na(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function tf(e,t,r){let n=new Map,o,s=new Map,i=(u,l)=>{let d;if(u.code===\"unrecognized_keys\"&&!u.path?.length)o??(o=u),d=u.keys;else if(u.code===\"invalid_key\"&&u.origin===\"record\"&&u.path?.length===1){let m=String(u.path[0]);s.has(m)||s.set(m,u),d=[m]}else return!1;for(let m of d)n.has(m)||n.set(m,{}),n.get(m)[l]=!0;return!0};for(let u of t.issues)i(u,\"l\")||e.issues.push(u);for(let u of r.issues)i(u,\"r\")||e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}let c=Na(t.value,r.value);if(!c.valid){if(rt(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Xf=v(\"$ZodRecord\",(e,t)=>{X.init(e,t);let r=Me.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Ut(s))return n.issues.push({expected:\"record\",code:\"invalid_type\",input:s,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let l of a)if(typeof l==\"string\"||typeof l==\"number\"||typeof l==\"symbol\"){if(c.add(typeof l==\"number\"?l.toString():l),l===\"__proto__\")continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw new Error(\"Async schemas not supported in object keys currently\");if(d.issues.length){n.issues.push({code:\"invalid_key\",origin:\"record\",issues:d.issues.map(f=>nt(f,o,je())),input:l,path:[l],inst:e});continue}let m=d.value;if(m===\"__proto__\")continue;let p=t.valueType._zod.run({value:s[l],issues:[]},o);p instanceof Promise?i.push(p.then(f=>{f.issues.length&&n.issues.push(...zt(l,f.issues)),n.value[m]=f.value})):(p.issues.length&&n.issues.push(...zt(l,p.issues)),n.value[m]=p.value)}let u;for(let l in s)if(!c.has(l))if(t.mode===\"loose\"){if(l===\"__proto__\")continue;n.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:\"unrecognized_keys\",input:s,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let u of Reflect.ownKeys(s)){if(u===\"__proto__\"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error(\"Async schemas not supported in object keys currently\");if(typeof u==\"string\"&&Cn.test(u)&&l.issues.length){let f=t.keyType._zod.run({value:Number(u),issues:[]},o);if(f instanceof Promise)throw new Error(\"Async schemas not supported in object keys currently\");f.issues.length===0&&(l=f)}if(l.issues.length){t.mode===\"loose\"?n.value[u]=s[u]:a?(c=c??[],c.push(u)):n.issues.push({code:\"invalid_key\",origin:\"record\",issues:l.issues.map(f=>nt(f,o,je())),input:u,path:[u],inst:e});continue}let m=l.value;if(m===\"__proto__\")continue;let p=t.valueType._zod.run({value:s[u],issues:[]},o);p instanceof Promise?i.push(p.then(f=>{f.issues.length&&n.issues.push(...zt(u,f.issues)),n.value[m]=f.value})):(p.issues.length&&n.issues.push(...zt(u,p.issues)),n.value[m]=p.value)}c&&c.length>0&&n.issues.push({code:\"unrecognized_keys\",input:s,inst:e,keys:c,continue:!0})}return i.length?Promise.all(i).then(()=>n):n}});var Yf=v(\"$ZodEnum\",(e,t)=>{X.init(e,t);let r=Or(t.entries),n=new Set(r);e._zod.values=n,K(e,\"pattern\",o=>{let s=Or(o.def.entries).filter(i=>_a.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>xt(i.toString())).join(\"|\")})$`:\"^[^\\\\s\\\\S]$\")}),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:\"invalid_value\",values:r,input:i,inst:e}),o}}),Qf=v(\"$ZodLiteral\",(e,t)=>{X.init(e,t);let r=new Set(t.values);e._zod.values=r,K(e,\"pattern\",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(s=>typeof s==\"string\"?xt(s):s?xt(s.toString()):String(s)).join(\"|\")})$`:\"^[^\\\\s\\\\S]$\")}),e._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:\"invalid_value\",values:t.values,input:s,inst:e}),n}});var em=v(\"$ZodTransform\",(e,t)=>{X.init(e,t),e._zod.optin=\"optional\",Me.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")throw new Nr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new ot;return r.value=o,r}});function rf(e,t){return e.value=t.issues.length?void 0:t.value,e}var qa=v(\"$ZodOptional\",(e,t)=>{X.init(e,t),K(e,\"optin\",r=>r.def.innerType._zod.optin===\"defaulted\"?\"defaulted\":\"optional\"),e._zod.optout=\"optional\",K(e,\"values\",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),K(e,\"pattern\",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Pn(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!==\"defaulted\")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>rf(r,s)):rf(r,o)}return t.innerType._zod.run(r,n)}}),tm=v(\"$ZodExactOptional\",(e,t)=>{qa.init(e,t),K(e,\"values\",r=>r.def.innerType._zod.values),K(e,\"pattern\",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),rm=v(\"$ZodNullable\",(e,t)=>{X.init(e,t),K(e,\"optin\",r=>r.def.innerType._zod.optin),K(e,\"optout\",r=>r.def.innerType._zod.optout),K(e,\"pattern\",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Pn(n.source)}|null)$`):void 0}),K(e,\"values\",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),nm=v(\"$ZodDefault\",(e,t)=>{X.init(e,t),e._zod.optin=\"defaulted\",K(e,\"values\",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>nf(s,t)):nf(o,t)}});function nf(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var om=v(\"$ZodPrefault\",(e,t)=>{X.init(e,t),e._zod.optin=\"defaulted\",K(e,\"values\",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction===\"backward\"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),sm=v(\"$ZodNonOptional\",(e,t)=>{X.init(e,t),K(e,\"values\",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>of(s,e)):of(o,e)}});function of(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:\"invalid_type\",expected:\"nonoptional\",input:e.value,inst:t}),e}function sf(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>nt(o,n,je()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var im=v(\"$ZodCatch\",(e,t)=>{X.init(e,t),K(e,\"optin\",r=>r.def.innerType._zod.optin===\"defaulted\"?\"defaulted\":\"optional\"),K(e,\"optout\",r=>r.def.innerType._zod.optout),K(e,\"values\",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>sf(r,s,t,n)):sf(r,o,t,n)}});var Ua=v(\"$ZodPipe\",(e,t)=>{X.init(e,t),K(e,\"values\",r=>r.def.in._zod.values),K(e,\"optin\",r=>r.def.in._zod.optin),K(e,\"optout\",r=>r.def.out._zod.optout),K(e,\"propValues\",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction===\"backward\"){let s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>ws(i,t.in,n)):ws(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>ws(s,t.out,n)):ws(o,t.out,n)}});function ws(e,t,r){return e.issues.some(n=>n.code!==\"unrecognized_keys\")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var am=v(\"$ZodPreprocess\",(e,t)=>{Ua.init(e,t)}),cm=v(\"$ZodReadonly\",(e,t)=>{X.init(e,t),K(e,\"propValues\",r=>r.def.innerType._zod.propValues),K(e,\"values\",r=>r.def.innerType._zod.values),K(e,\"optin\",r=>r.def.innerType?._zod?.optin),K(e,\"optout\",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(af):af(o)}});function af(e){return e.memo||(e.value=Object.freeze(e.value)),e}var um=v(\"$ZodCustom\",(e,t)=>{ve.init(e,t),X.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>cf(s,r,n,e));cf(o,r,n,e)}});function cf(e,t,r,n){if(!e){let o={code:\"custom\",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ar(o))}}var Fa=class extends Error{constructor(){super(\"Cannot parse a reference cycle that closes through a transform\"),this.name=\"ZodCyclicError\"}},Va=\"~memo\",lm=[];function dm(e){return e!==null&&typeof e==\"object\"}function La(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var pm=new WeakMap,An=0,Ps=1,Nn=2;function Es(e,t,r){let n=pm.get(e);if(n!==void 0)return n?Nn:An;if(t.has(e))return Nn;t.add(e);let o=An,s=l=>{if(o!==Nn&&l?._zod){let d=Es(l,t,r);d>o&&(o=d)}},i=(l,d)=>{let m=An;for(let p of Reflect.ownKeys(l)){let f=Object.getOwnPropertyDescriptor(l,p);if(d&&!f.enumerable)continue;let g=f.get?Ps:f.value?._zod?Es(f.value,t,r):An;g>m&&(m=g)}return m},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case\"object\":{let l=Ir(c);a(l?i(l,!0):Ps),s(c.catchall);break}case\"array\":s(c.element);break;case\"tuple\":for(let l of c.items)s(l);s(c.rest);break;case\"record\":case\"map\":s(c.keyType),s(c.valueType);break;case\"set\":s(c.valueType);break;case\"union\":for(let l of c.options)s(l);break;case\"intersection\":s(c.left),s(c.right);break;case\"optional\":case\"nullable\":case\"default\":case\"prefault\":case\"catch\":case\"readonly\":case\"nonoptional\":case\"promise\":case\"success\":s(c.innerType);break;case\"pipe\":s(c.in),s(c.out);break;case\"function\":s(c.input),s(c.output);break;case\"lazy\":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?Es(l,t,!1):Ps);break}case\"template_literal\":case\"string\":case\"number\":case\"int\":case\"boolean\":case\"bigint\":case\"symbol\":case\"undefined\":case\"null\":case\"void\":case\"never\":case\"any\":case\"unknown\":case\"date\":case\"nan\":case\"enum\":case\"literal\":case\"file\":case\"transform\":case\"custom\":break;default:for(let l in c){let d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;let m=d.value;if(!(!m||typeof m!=\"object\")){if(m._zod)s(m);else if(Array.isArray(m))for(let p of m)s(p)}}}return t.delete(e),N0(e,o)}function N0(e,t){return t!==Ps&&pm.set(e,t===Nn),t}function M0(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var Ss,ks=[],j0={alloc(e,t,r){let n=Ss;if(!n)return r;Ss=void 0;let o={value:r,issues:null};return n.set(t.value,o),ks.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!==\"backward\"&&Z0(s,o.value))throw new Fa;return r(o,s)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let y=Es(e,new Set,!1);if(y===An)return e._zod.parse=i,e._zod.run===a&&(e._zod.run=i),i(c,u);y===Nn||n?r=!0:n=!0}let l=c.value;if(!dm(l))return i(c,u);let d=u[Va];d||(d={buckets:new WeakMap,backEdges:void 0},u[Va]=d);let m;o===u?m=s:(m=M0(d,e),o=u,s=m);let p=m.get(l);if(p)return c.value=p.value,p.issues?p.issues.length&&c.issues.push(...La(p.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value)),c;Ss=m;let f=ks.length,g=i(c,u);Ss=void 0;let h=ks.length>f?ks.pop():void 0;return g instanceof Promise?g.then(y=>(h&&(h.issues=y.issues.length?La(y.issues):lm),y)):(h&&(h.issues=g.issues.length?La(g.issues):lm),g)};e._zod.parse=a,e._zod.run===i&&(e._zod.run=a)})}};function Ha(){return j0}function Z0(e,t){let r=e[Va]?.backEdges;return r!==void 0&&dm(t)&&r.has(t)}var D0=()=>{let e={string:{unit:\"characters\",verb:\"to have\"},file:{unit:\"bytes\",verb:\"to have\"},array:{unit:\"items\",verb:\"to have\"},set:{unit:\"items\",verb:\"to have\"},map:{unit:\"entries\",verb:\"to have\"}};function t(s){return e[s]??null}let r={regex:\"input\",email:\"email address\",url:\"URL\",emoji:\"emoji\",uuid:\"UUID\",uuidv4:\"UUIDv4\",uuidv6:\"UUIDv6\",nanoid:\"nanoid\",guid:\"GUID\",cuid:\"cuid\",cuid2:\"cuid2\",ulid:\"ULID\",xid:\"XID\",ksuid:\"KSUID\",datetime:\"ISO datetime\",date:\"ISO date\",time:\"ISO time\",duration:\"ISO duration\",ipv4:\"IPv4 address\",ipv6:\"IPv6 address\",mac:\"MAC address\",cidrv4:\"IPv4 range\",cidrv6:\"IPv6 range\",base64:\"base64-encoded string\",base64url:\"base64url-encoded string\",json_string:\"JSON string\",e164:\"E.164 number\",currency_code:\"currency code\",credit_card:\"credit card number\",iban:\"IBAN\",jwt:\"JWT\",template_literal:\"input\"},n={nan:\"NaN\"};function o(s,i){return s===\"number\"&&typeof i==\"number\"&&!Number.isFinite(i)?String(i):n[s]??s}return s=>{switch(s.code){case\"invalid_type\":{let i=o(s.expected),a=wa(s.input),c=o(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case\"invalid_value\":return s.values.length===1?`Invalid input: expected ${as(s.values[0])}`:`Invalid option: expected one of ${ss(s.values,\"|\")}`;case\"too_big\":{let i=s.exact?\"exactly \":s.inclusive?\"<=\":\"<\",a=t(s.origin);return a?`Too big: expected ${s.origin??\"value\"} to have ${i}${s.maximum.toString()} ${a.unit??\"elements\"}`:`Too big: expected ${s.origin??\"value\"} to be ${i}${s.maximum.toString()}`}case\"too_small\":{let i=s.exact?\"exactly \":s.inclusive?\">=\":\">\",a=t(s.origin);return a?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case\"invalid_format\":{let i=s;return i.format===\"starts_with\"?`Invalid string: must start with \"${i.prefix}\"`:i.format===\"ends_with\"?`Invalid string: must end with \"${i.suffix}\"`:i.format===\"includes\"?`Invalid string: must include \"${i.includes}\"`:i.format===\"regex\"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??s.format}`}case\"not_multiple_of\":return`Invalid number: must be a multiple of ${s.divisor}`;case\"unrecognized_keys\":return`Unrecognized key${s.keys.length>1?\"s\":\"\"}: ${ss(s.keys,\", \")}`;case\"invalid_key\":return`Invalid key in ${s.origin}`;case\"invalid_union\":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(a=>`'${a}'`).join(\" | \")}`:s.inclusive===!1?\"Invalid input: more than one option matched\":\"Invalid input\";case\"invalid_element\":return`Invalid value in ${s.origin}`;default:return\"Invalid input\"}}};function fm(){return{localeError:D0()}}var mm;var Ja=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n==\"object\"&&\"id\"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r==\"object\"&&\"id\"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function hm(){return new Ja}(mm=globalThis).__zod_globalRegistry??(mm.__zod_globalRegistry=hm());var Lt=globalThis.__zod_globalRegistry;function Ts(e){return e.checks&&(e.checks=[...e.checks]),e}function gm(e,t){return new e(Ts({type:\"string\",...R(t)}))}function _m(e,t){return new e(Ts({type:\"string\",coerce:!0,...R(t)}))}function ym(e,t){return new e({type:\"string\",format:\"email\",check:\"string_format\",abort:!1,...R(t)})}function vm(e,t){return new e({type:\"string\",format:\"guid\",check:\"string_format\",abort:!1,...R(t)})}function wm(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,...R(t)})}function bm(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v4\",...R(t)})}function $m(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v6\",...R(t)})}function xm(e,t){return new e({type:\"string\",format:\"uuid\",check:\"string_format\",abort:!1,version:\"v7\",...R(t)})}function Ka(e,t){return new e({type:\"string\",format:\"url\",check:\"string_format\",abort:!1,...R(t)})}function zm(e,t){return new e({type:\"string\",format:\"emoji\",check:\"string_format\",abort:!1,...R(t)})}function Sm(e,t){return new e({type:\"string\",format:\"nanoid\",check:\"string_format\",abort:!1,...R(t)})}function km(e,t){return new e({type:\"string\",format:\"cuid\",check:\"string_format\",abort:!1,...R(t)})}function Pm(e,t){return new e({type:\"string\",format:\"cuid2\",check:\"string_format\",abort:!1,...R(t)})}function Em(e,t){return new e({type:\"string\",format:\"ulid\",check:\"string_format\",abort:!1,...R(t)})}function Tm(e,t){return new e({type:\"string\",format:\"xid\",check:\"string_format\",abort:!1,...R(t)})}function Om(e,t){return new e({type:\"string\",format:\"ksuid\",check:\"string_format\",abort:!1,...R(t)})}function Rm(e,t){return new e({type:\"string\",format:\"ipv4\",check:\"string_format\",abort:!1,...R(t)})}function Cm(e,t){return new e({type:\"string\",format:\"ipv6\",check:\"string_format\",abort:!1,...R(t)})}function Im(e,t){return new e({type:\"string\",format:\"cidrv4\",check:\"string_format\",abort:!1,...R(t)})}function Am(e,t){return new e({type:\"string\",format:\"cidrv6\",check:\"string_format\",abort:!1,...R(t)})}function Nm(e,t){return new e({type:\"string\",format:\"base64\",check:\"string_format\",abort:!1,...R(t)})}function Mm(e,t){return new e({type:\"string\",format:\"base64url\",check:\"string_format\",abort:!1,...R(t)})}function jm(e,t){return new e({type:\"string\",format:\"e164\",check:\"string_format\",abort:!1,...R(t)})}function Zm(e,t){return new e({type:\"string\",format:\"jwt\",check:\"string_format\",abort:!1,...R(t)})}function Os(e,t){return new e({type:\"string\",format:\"datetime\",check:\"string_format\",offset:!1,local:!1,precision:null,...R(t)})}function Rs(e,t){return new e({type:\"string\",format:\"date\",check:\"string_format\",...R(t)})}function Cs(e,t){return new e({type:\"string\",format:\"time\",check:\"string_format\",precision:null,...R(t)})}function Is(e,t){return new e({type:\"string\",format:\"duration\",check:\"string_format\",...R(t)})}function Dm(e,t){return new e(Ts({type:\"number\",checks:[],...R(t)}))}function qm(e,t){return new e(Ts({type:\"number\",coerce:!0,checks:[],...R(t)}))}function Um(e,t){return new e({type:\"number\",check:\"number_format\",abort:!1,format:\"safeint\",...R(t)})}function Lm(e,t){return new e({type:\"boolean\",...R(t)})}function Fm(e,t){return new e({type:\"boolean\",coerce:!0,...R(t)})}function Vm(e,t){return new e({type:\"bigint\",coerce:!0,...R(t)})}function Hm(e,t){return new e({type:\"null\",...R(t)})}function Jm(e){return new e({type:\"any\"})}function Km(e){return new e({type:\"unknown\"})}function Bm(e,t){return new e({type:\"never\",...R(t)})}function Wm(e,t){return new e({type:\"date\",coerce:!0,...R(t)})}function jr(e,t){return new Ia({check:\"less_than\",...R(t),value:e,inclusive:!1})}function St(e,t){return new Ia({check:\"less_than\",...R(t),value:e,inclusive:!0})}function Zr(e,t){return new Aa({check:\"greater_than\",...R(t),value:e,inclusive:!1})}function kt(e,t){return new Aa({check:\"greater_than\",...R(t),value:e,inclusive:!0})}function Mn(e,t){return new Zp({check:\"multiple_of\",...R(t),value:e})}function As(e,t){return new qp({check:\"max_length\",...R(t),maximum:e})}function Dr(e,t){return new Up({check:\"min_length\",...R(t),minimum:e})}function Ns(e,t){return new Lp({check:\"length_equals\",...R(t),length:e})}function Ba(e,t){return new Fp({check:\"string_format\",format:\"regex\",...R(t),pattern:e})}function Wa(e){return new Vp({check:\"string_format\",format:\"lowercase\",...R(e)})}function Ga(e){return new Hp({check:\"string_format\",format:\"uppercase\",...R(e)})}function Xa(e,t){return new Jp({check:\"string_format\",format:\"includes\",...R(t),includes:e})}function Ya(e,t){return new Kp({check:\"string_format\",format:\"starts_with\",...R(t),prefix:e})}function Qa(e,t){return new Bp({check:\"string_format\",format:\"ends_with\",...R(t),suffix:e})}function Ft(e){return new Wp({check:\"overwrite\",tx:e})}function ec(e){return Ft(t=>t.normalize(e))}function tc(){return Ft(e=>e.trim())}function rc(){return Ft(e=>e.toLowerCase())}function nc(){return Ft(e=>e.toUpperCase())}function oc(){return Ft(e=>ha(e))}function Gm(e,t,r){return new e({type:\"array\",element:t,...R(r)})}function Xm(e,t,r){let n=R(r);return n.abort??(n.abort=!0),new e({type:\"custom\",check:\"custom\",fn:t,...n})}function Ym(e,t,r){return new e({type:\"custom\",check:\"custom\",fn:t,...R(r)})}function Qm(e,t){let r=q0(n=>(n.addIssue=o=>{if(typeof o==\"string\")n.issues.push(Ar(o,n.value,r._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code=\"custom\"),\"input\"in s||(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(Ar(s))}},e(n.value,n)),t);return r}function q0(e,t){let r=new ve({check:\"custom\",...R(t)});return r._zod.check=e,r}function jn(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&He(e,n,r[n]);return e}function ic(e){let t=e?.target??\"draft-2020-12\";return t===\"draft-4\"&&(t=\"draft-04\"),t===\"draft-7\"&&(t=\"draft-07\"),{processors:e.processors??{},metadataRegistry:e?.metadata??Lt,target:t,unrepresentable:e?.unrepresentable??\"throw\",override:e?.override??(()=>{}),io:e?.io??\"output\",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??\"ref\",reused:e?.reused??\"inline\",intersections:[],deferred:[],external:e?.external??void 0}}function st(e,t,r,n,o){let s=typeof t.unrepresentable==\"function\"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s===\"any\")return!1;if(s===void 0||s===\"throw\")throw new Error(o);return Object.assign(r,s),!0}function fe(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let m=i.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,m,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),fe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&jn(i.schema,c),t.io===\"input\"&&Ce(e)&&(delete i.schema.examples,delete i.schema.default),t.io===\"input\"&&\"_prefault\"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function eh(e){return e.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}function ac(e,t){let r=e.seen.get(t);if(!r)throw new Error(\"Unprocessed schema. This is a bug in Zod.\");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id \"${a}\" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=i=>{let a=e.target===\"draft-2020-12\"?\"$defs\":\"definitions\";if(e.external){let d=e.external.registry.get(i[0])?.id,m=e.external.uri??(f=>f);if(d)return{ref:m(d)};let p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${m(\"__shared\")}#/${a}/${eh(p)}`}}let c=\"#\",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+eh(l)}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles===\"throw\")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join(\"/\")}/<root>\n\nSet the \\`cycles\\` parameter to \\`\"ref\"\\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}a.count>1&&e.reused===\"ref\"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function nh(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=\"object\")return;nh(n);let o=Object.keys(n);if(o.length!==1||o[0]!==\"type\")return;let s=n.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!=\"string\")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var oh=new Set([\"type\",\"properties\",\"required\",\"additionalProperties\"]),th=[\"oneOf\",\"anyOf\"];function rh(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=\"object\"||t===null?null:Object.keys(t).length?t:null}function sc(e){let t=[];for(let s of e){if(typeof s!=\"object\"||s.type!==\"object\")return null;for(let i in s)if(!oh.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??rh(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:sc(a)??{allOf:a};He(r,i,c)}for(let i of s.required??[])n.add(i)}let o={type:\"object\",properties:r};if(n.size&&(o.required=[...n]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let a=rh(i);a&&!s.some(c=>JSON.stringify(c)===JSON.stringify(a))&&s.push(a)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function U0(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of oh)if(o in e)return;let r=t.filter(o=>th.some(s=>Array.isArray(o[s]))),n=null;if(!r.length)n=sc(t);else{let o=r[0],s=th.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let i=t.filter(c=>c!==o),a=o[s].map(c=>sc([...i,c]));if(a.some(c=>!c))return;n={[s]:a}}n&&(delete e.allOf,jn(e,n))}function cc(e,t){let r=e.seen.get(t);if(!r)throw new Error(\"Unprocessed schema. This is a bug in Zod.\");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){n(d);let p=e.seen.get(d),f=p.schema;if(f.$ref&&(e.target===\"draft-07\"||e.target===\"draft-04\"||e.target===\"openapi-3.0\")?(u.allOf=u.allOf??[],u.allOf.push(f)):jn(u,f),jn(u,l),a._zod.parent===d)for(let h in u)h===\"$ref\"||h===\"allOf\"||h in l||delete u[h];if(f.$ref&&p.def)for(let h in u)h===\"$ref\"||h===\"allOf\"||h in p.def&&JSON.stringify(u[h])===JSON.stringify(p.def[h])&&delete u[h]}let m=a._zod.parent;if(m&&m!==d){n(m);let p=e.seen.get(m);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(let f in u)f===\"$ref\"||f===\"allOf\"||f in p.def&&JSON.stringify(u[f])===JSON.stringify(p.def[f])&&delete u[f]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!==\"openapi-3.0\")for(let a of e.seen.entries())nh(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])U0(u)}}let o={};if(e.target===\"draft-2020-12\"?o.$schema=\"https://json-schema.org/draft/2020-12/schema\":e.target===\"draft-07\"?o.$schema=\"http://json-schema.org/draft-07/schema#\":e.target===\"draft-04\"?o.$schema=\"http://json-schema.org/draft-04/schema#\":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error(\"Schema is missing an `id` property\");o.$id=e.external.uri(a)}jn(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,He(i,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target===\"draft-2020-12\"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,\"~standard\",{value:{...t[\"~standard\"],jsonSchema:{input:Zn(t,\"input\",e.processors),output:Zn(t,\"output\",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error(\"Error converting schema to JSON.\")}}function Ce(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type===\"transform\")return!0;if(n.type===\"array\")return Ce(n.element,r);if(n.type===\"set\")return Ce(n.valueType,r);if(n.type===\"lazy\")return Ce(n.getter(),r);if(n.type===\"promise\"||n.type===\"optional\"||n.type===\"nonoptional\"||n.type===\"nullable\"||n.type===\"readonly\"||n.type===\"default\"||n.type===\"prefault\"||n.type===\"catch\")return Ce(n.innerType,r);if(n.type===\"intersection\")return Ce(n.left,r)||Ce(n.right,r);if(n.type===\"record\"||n.type===\"map\")return Ce(n.keyType,r)||Ce(n.valueType,r);if(n.type===\"pipe\")return e._zod.traits.has(\"$ZodCodec\")?!0:Ce(n.in,r)||Ce(n.out,r);if(n.type===\"object\"){for(let o in n.shape)if(Ce(n.shape[o],r))return!0;return!1}if(n.type===\"union\"){for(let o of n.options)if(Ce(o,r))return!0;return!1}if(n.type===\"tuple\"){for(let o of n.items)if(Ce(o,r))return!0;return!!(n.rest&&Ce(n.rest,r))}return!1}var sh=(e,t={})=>r=>{let n=ic({...r,processors:t});return fe(e,n),ac(n,e),cc(n,e)},Zn=(e,t,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=ic({...o??{},target:s,io:t,processors:r});return fe(e,i),ac(i,e),cc(i,e)};var qr=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Ur=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},ih=(e,t)=>{qr(e,\"minimum\",t),Ur(e,\"maximum\",t)},lh=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},dh=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ph=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},fh=(e,t)=>{e.format=t,t.includes(\"int\")&&(e.isInt=!0)},ah=(e,t)=>qr(e,\"minimum\",t.minimum),ch=(e,t)=>Ur(e,\"maximum\",t.maximum),uh=e=>(t,r)=>{fh(t,r.format);let[n,o]=e[r.format];qr(t,\"minimum\",n),Ur(t,\"maximum\",o)},L0={greater_than:(e,t)=>qr(e,t.inclusive?\"minimum\":\"exclusiveMinimum\",t.value),less_than:(e,t)=>Ur(e,t.inclusive?\"maximum\":\"exclusiveMaximum\",t.value),multiple_of:(e,t)=>lh(e,t.value),number_format:uh(En),bigint_format:uh(cs),min_length:ah,max_length:ch,length_equals:(e,t)=>ih(e,t.length),min_size:ah,max_size:ch,size_equals:(e,t)=>ih(e,t.size),string_format:(e,t)=>{fh(e,t.format),t.pattern&&dh(e,t.pattern),(t.format===\"base64\"||t.format===\"base64url\")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>ph(e,t.mime)};function we(e){let t={},r=e._zod.def,n=e._zod.traits.has(\"$ZodCheck\")?[e,...r.checks??[]]:r.checks??[];for(let s of n)L0[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;o.minimum!==void 0&&qr(t,\"minimum\",o.minimum),o.exclusiveMinimum!==void 0&&qr(t,\"exclusiveMinimum\",o.exclusiveMinimum),o.maximum!==void 0&&Ur(t,\"maximum\",o.maximum),o.exclusiveMaximum!==void 0&&Ur(t,\"exclusiveMaximum\",o.exclusiveMaximum),o.multipleOf!==void 0&&lh(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes(\"int\")&&(t.isInt=!0)),o.mime&&ph(t,o.mime);for(let s of o.patterns??[])dh(t,s);return t}var F0={guid:\"uuid\",url:\"uri\",datetime:\"date-time\",json_string:\"json-string\",regex:\"\"},V0=new Map([[ja,zp],[zs,Sp]]),mh=e=>V0.get(e)??e,hh=(e,t,r,n)=>{let o=r;o.type=\"string\";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=we(e);if(typeof s==\"number\"&&(o.minLength=s),typeof i==\"number\"&&(o.maxLength=i),a&&(o.format=F0[a]??a,o.format===\"\"&&delete o.format,(a===\"time\"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let d=[...c].map(mh);d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(m=>({...t.target===\"draft-07\"||t.target===\"draft-04\"||t.target===\"openapi-3.0\"?{type:\"string\"}:{},pattern:m.source}))])}},gh=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=we(e);o.type=l?\"integer\":\"number\";let d=typeof u==\"number\"&&u>=(s??Number.NEGATIVE_INFINITY),m=typeof c==\"number\"&&c<=(i??Number.POSITIVE_INFINITY),p=t.target===\"draft-04\"||t.target===\"openapi-3.0\";if(d?p?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof s==\"number\"&&(o.minimum=s),m?p?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof i==\"number\"&&(o.maximum=i),a){let f=new Set;for(let y of a)Number.isFinite(y)&&y!==0?f.add(Math.abs(y)):st(e,t,o,n,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[g,...h]=f;g!==void 0&&(o.multipleOf=g),h.length&&(o.allOf=[...o.allOf??[],...h.map(y=>({multipleOf:y}))])}},_h=(e,t,r,n)=>{r.type=\"boolean\"},yh=(e,t,r,n)=>{st(e,t,r,n,\"BigInt cannot be represented in JSON Schema\")};var vh=(e,t,r,n)=>{t.target===\"openapi-3.0\"?(r.type=\"string\",r.nullable=!0,r.enum=[null]):r.type=\"null\"};var wh=(e,t,r,n)=>{r.not={}},bh=(e,t,r,n)=>{},$h=(e,t,r,n)=>{},xh=(e,t,r,n)=>{st(e,t,r,n,\"Date cannot be represented in JSON Schema\")},zh=(e,t,r,n)=>{let o=e._zod.def,s=Or(o.entries);if(s.length===0){r.not={};return}s.every(i=>typeof i==\"number\")&&(r.type=\"number\"),s.every(i=>typeof i==\"string\")&&(r.type=\"string\"),r.enum=s},Sh=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(st(e,t,r,n,\"Literal `undefined` cannot be represented in JSON Schema\"))return}else if(typeof i==\"bigint\"){if(st(e,t,r,n,\"BigInt literals cannot be represented in JSON Schema\"))return;s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?\"null\":typeof i,t.target===\"draft-04\"||t.target===\"openapi-3.0\"?r.enum=[i]:r.const=i}else s.every(i=>typeof i==\"number\")&&(r.type=\"number\"),s.every(i=>typeof i==\"string\")&&(r.type=\"string\"),s.every(i=>typeof i==\"boolean\")&&(r.type=\"boolean\"),s.every(i=>i===null)&&(r.type=\"null\"),r.enum=s};var kh=(e,t,r,n)=>{st(e,t,r,n,\"Custom types cannot be represented in JSON Schema\")};var Ph=(e,t,r,n)=>{st(e,t,r,n,\"Transforms cannot be represented in JSON Schema\")};var Eh=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=we(e);typeof i==\"number\"&&(o.minItems=i),typeof a==\"number\"&&(o.maxItems=a),o.type=\"array\",o.items=fe(s.element,t,{...n,path:[...n.path,\"items\"]})};function Ms(e){let t=e._zod.def;return t.type===\"pipe\"&&t.in._zod.traits.has(\"$ZodTransform\")?Ms(t.out):t.type===\"catch\"?Ms(t.innerType):e._zod.optin}var Th=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&st(e,t,o,n,\"Symbol keys cannot be represented in JSON Schema\"))return;o.type=\"object\",o.properties={};for(let u in i)He(o.properties,u,fe(i[u],t,{...n,path:[...n.path,\"properties\",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];(t.io===\"input\"?Ms(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),s.catchall?._zod.def.type===\"never\"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=fe(s.catchall,t,{...n,path:[...n.path,\"additionalProperties\"]})):t.io===\"output\"&&(o.additionalProperties=!1)},Oh=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>fe(a,t,{...n,path:[...n.path,s?\"oneOf\":\"anyOf\",c]}));s?r.oneOf=i:r.anyOf=i},Rh=(e,t,r,n)=>{let o=e._zod.def,s=fe(o.left,t,{...n,path:[...n.path,\"allOf\",0]}),i=fe(o.right,t,{...n,path:[...n.path,\"allOf\",1]}),a=u=>\"allOf\"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)};function uc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let f=e.get(t)?.def;if(!f)return t;let g=uc(e,f,r);return g===f?t:g}for(let f of[\"anyOf\",\"oneOf\"]){let g=t[f];if(!Array.isArray(g))continue;let h=g.map(y=>uc(e,y,r));h.some((y,x)=>y!==g[x])&&(t={...t,[f]:h})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes(\"string\")&&n.some(f=>f===\"number\"||f===\"integer\"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some(f=>typeof f==\"number\"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:m,...p}=t;return p.enum?p.enum=p.enum.map(f=>typeof f==\"number\"?String(f):f):typeof p.const==\"number\"&&(p.const=String(p.const)),o&&(p.type=\"string\",s||(p.pattern=(n.includes(\"number\")?Cn:Ra).source)),p}var lc=new WeakMap;function H0(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of lc.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=uc(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let s=o&&r.get(o.propertyNames);s&&(o.propertyNames=s)}}var Ch=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type=\"object\";let i=s.keyType,a=we(i).patterns;if(s.mode===\"loose\"&&a&&a.size>0){let l=fe(s.valueType,t,{...n,path:[...n.path,\"patternProperties\",\"*\"]});o.patternProperties={};for(let d of a)He(o.patternProperties,mh(d).source,l)}else{if(t.target===\"draft-07\"||t.target===\"draft-2020-12\"){o.propertyNames=fe(s.keyType,t,{...n,path:[...n.path,\"propertyNames\"]});let l=lc.get(t);l||(l=[],lc.set(t,l),t.deferred.push(()=>H0(t))),l.push(e)}o.additionalProperties=fe(s.valueType,t,{...n,path:[...n.path,\"additionalProperties\"]})}let c=i._zod.values,u=t.io===\"input\"&&Ms(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter(d=>typeof d==\"string\"||typeof d==\"number\");l.length>0&&(o.required=l.map(String))}},Ih=(e,t,r,n)=>{let o=e._zod.def,s=fe(o.innerType,t,n),i=t.seen.get(e);t.target===\"openapi-3.0\"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:\"null\"}]},Ah=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},dc=Symbol();function Nh(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,c)=>typeof c!=\"bigint\"?c:(s=!0,null));return s?(st(t,r,n,o,\"BigInt defaults cannot be represented in JSON Schema\"),dc):JSON.parse(i)}var Mh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=Nh(o.defaultValue,e,t,r,n);i!==dc&&(r.default=i)},jh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!==\"input\")return;let i=Nh(o.defaultValue,e,t,r,n);i!==dc&&(r._prefault=i)},Zh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{st(e,t,r,n,\"Dynamic catch values are not supported in JSON Schema\");return}r.default=i},Dh=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has(\"$ZodTransform\"),i=t.io===\"input\"?s?o.out:o.in:o.out;fe(i,t,n);let a=t.seen.get(e);a.ref=i},qh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var pc=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var Uh=new WeakSet([Object.prototype,Error.prototype]);function js(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var eb=(e,t)=>{Yd.init(e,t),e.name=\"ZodError\";let r=Object.getPrototypeOf(e);Uh.has(r)||(Uh.add(r),js(r,\"format\",n=>o=>Pa(n,o)),js(r,\"flatten\",n=>o=>ka(n,o)),js(r,\"addIssue\",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Rr,2)}),js(r,\"addIssues\",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Rr,2)}),Object.defineProperty(r,\"isEmpty\",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var Je=v(\"ZodError\",eb,void 0,{Parent:Error});var Lh=fs(Je),Fh=ms(Je),Vh=Rn(Je),Hh=hs(Je),Jh=tp(Je),Kh=rp(Je),Bh=np(Je),Wh=op(Je),Gh=sp(Je),Xh=ip(Je),Yh=ap(Je),Qh=cp(Je);function rb(){Me.localeError||je(fm())}function Ds(){Me.memoizer||je({memoizer:Ha()})}var ee=v(\"ZodType\",(e,t)=>(rb(),X.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(A.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r==\"function\"?{_zod:{check:r,def:{check:\"custom\"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Be(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Fb(e,t))},superRefine(e,t){return this.check(Vb(e,t))},overwrite(e){return this.check(Ft(e))},optional(){return le(this)},exactOptional(){return Rb(this)},nullable(){return rg(this)},nullish(){return le(rg(this))},nonoptional(e){return jb(this,e)},array(){return z(this)},or(e){return se([this,e])},and(e){return Us(this,e)},transform(e){return ng(this,fg(e))},default(e){return Ab(this,e)},prefault(e){return Mb(this,e)},catch(e){return Db(this,e)},pipe(e){return ng(this,e)},readonly(){return Lb(this)},describe(e){let t=this.clone();return Lt.add(t,{description:e}),t},meta(...e){if(e.length===0)return Lt.get(this);let t=this.clone();return Lt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get\"~standard\"(){return A.hide(this,\"~standard\",{...Ma(this),jsonSchema:{input:Zn(this,\"input\"),output:Zn(this,\"output\")}})},set\"~standard\"(e){A.own(this,\"~standard\",e)},parse:function e(t,r){return Lh(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Fh(this,t,r,{callee:e})},safeParse(e,t){return Vh(this,e,t)},async safeParseAsync(e,t){return Hh(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){A.own(this,\"spa\",e)},validate(e,t){return gs(this,e,t)},validateAsync(e,t){return _s(this,e,t)},encode:function e(t,r){return Jh(this,t,r,{callee:e})},decode:function e(t,r){return Kh(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Bh(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Wh(this,t,r,{callee:e})},safeEncode(e,t){return Gh(this,e,t)},safeDecode(e,t){return Xh(this,e,t)},async safeEncodeAsync(e,t){return Yh(this,e,t)},async safeDecodeAsync(e,t){return Qh(this,e,t)},toJSONSchema(e){return sh(this,{})(e)},get description(){return Lt.get(this)?.description},get _def(){return this._zod.def}}),og=v(\"_ZodString\",(e,t)=>{xs.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hh(e,r,n,o)},A.derived({format:e=>we(e).format??null,minLength:e=>we(e).minimum??null,maxLength:e=>we(e).maximum??null},{regex(...e){return this.check(Ba(...e))},includes(...e){return this.check(Xa(...e))},startsWith(...e){return this.check(Ya(...e))},endsWith(...e){return this.check(Qa(...e))},min(...e){return this.check(Dr(...e))},max(...e){return this.check(As(...e))},length(...e){return this.check(Ns(...e))},nonempty(...e){return this.check(Dr(1,...e))},lowercase(e){return this.check(Wa(e))},uppercase(e){return this.check(Ga(e))},trim(){return this.check(tc())},normalize(...e){return this.check(ec(...e))},toLowerCase(){return this.check(rc())},toUpperCase(){return this.check(nc())},slugify(){return this.check(oc())}})),mc=v(\"ZodString\",(e,t)=>{xs.init(e,t),og.init(e,t)},{email(e){return this.check(ym(nb,e))},url(e){return this.check(Ka(sg,e))},jwt(e){return this.check(Zm(vb,e))},emoji(e){return this.check(zm(sb,e))},guid(e){return this.check(vm(ob,e))},uuid(e){return this.check(wm(Zs,e))},uuidv4(e){return this.check(bm(Zs,e))},uuidv6(e){return this.check($m(Zs,e))},uuidv7(e){return this.check(xm(Zs,e))},nanoid(e){return this.check(Sm(ib,e))},cuid(e){return this.check(km(ab,e))},cuid2(e){return this.check(Pm(cb,e))},ulid(e){return this.check(Em(ub,e))},base64(e){return this.check(Nm(gb,e))},base64url(e){return this.check(Mm(_b,e))},xid(e){return this.check(Tm(lb,e))},ksuid(e){return this.check(Om(db,e))},ipv4(e){return this.check(Rm(pb,e))},ipv6(e){return this.check(Cm(fb,e))},cidrv4(e){return this.check(Im(mb,e))},cidrv6(e){return this.check(Am(hb,e))},e164(e){return this.check(jm(yb,e))},datetime(e){return this.check(Os(Dn,e))},date(e){return this.check(Rs(qn,e))},time(e){return this.check(Cs(Un,e))},duration(e){return this.check(Is(Ln,e))}});function _(e){return gm(mc,e)}var pe=v(\"ZodStringFormat\",(e,t)=>{oe.init(e,t),og.init(e,t)}),Dn=v(\"ZodISODateTime\",(e,t)=>{xf.init(e,t),pe.init(e,t)}),qn=v(\"ZodISODate\",(e,t)=>{zf.init(e,t),pe.init(e,t)}),Un=v(\"ZodISOTime\",(e,t)=>{Sf.init(e,t),pe.init(e,t)}),Ln=v(\"ZodISODuration\",(e,t)=>{kf.init(e,t),pe.init(e,t)}),nb=v(\"ZodEmail\",(e,t)=>{pf.init(e,t),pe.init(e,t)});var ob=v(\"ZodGUID\",(e,t)=>{lf.init(e,t),pe.init(e,t)});var Zs=v(\"ZodUUID\",(e,t)=>{df.init(e,t),pe.init(e,t)});var sg=v(\"ZodURL\",(e,t)=>{hf.init(e,t),pe.init(e,t)});function ig(e){return Ka(sg,e)}var sb=v(\"ZodEmoji\",(e,t)=>{gf.init(e,t),pe.init(e,t)});var ib=v(\"ZodNanoID\",(e,t)=>{_f.init(e,t),pe.init(e,t)});var ab=v(\"ZodCUID\",(e,t)=>{yf.init(e,t),pe.init(e,t)});var cb=v(\"ZodCUID2\",(e,t)=>{vf.init(e,t),pe.init(e,t)});var ub=v(\"ZodULID\",(e,t)=>{wf.init(e,t),pe.init(e,t)});var lb=v(\"ZodXID\",(e,t)=>{bf.init(e,t),pe.init(e,t)});var db=v(\"ZodKSUID\",(e,t)=>{$f.init(e,t),pe.init(e,t)});var pb=v(\"ZodIPv4\",(e,t)=>{Pf.init(e,t),pe.init(e,t)});var fb=v(\"ZodIPv6\",(e,t)=>{Tf.init(e,t),pe.init(e,t)});var mb=v(\"ZodCIDRv4\",(e,t)=>{Of.init(e,t),pe.init(e,t)});var hb=v(\"ZodCIDRv6\",(e,t)=>{Rf.init(e,t),pe.init(e,t)});var gb=v(\"ZodBase64\",(e,t)=>{If.init(e,t),pe.init(e,t)});var _b=v(\"ZodBase64URL\",(e,t)=>{Af.init(e,t),pe.init(e,t)});var yb=v(\"ZodE164\",(e,t)=>{Nf.init(e,t),pe.init(e,t)});var vb=v(\"ZodJWT\",(e,t)=>{Mf.init(e,t),pe.init(e,t)});var qs=v(\"ZodNumber\",(e,t)=>{Za.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gh(e,r,n,o),e.isFinite=!0},A.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=we(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=we(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=we(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>we(e).format??null},{gt(e,t){return this.check(Zr(e,t))},gte(e,t){return this.check(kt(e,t))},min(e,t){return this.check(kt(e,t))},lt(e,t){return this.check(jr(e,t))},lte(e,t){return this.check(St(e,t))},max(e,t){return this.check(St(e,t))},int(e){return this.check(eg(e))},safe(e){return this.check(eg(e))},positive(e){return this.check(Zr(0,e))},nonnegative(e){return this.check(kt(0,e))},negative(e){return this.check(jr(0,e))},nonpositive(e){return this.check(St(0,e))},multipleOf(e,t){return this.check(Mn(e,t))},step(e,t){return this.check(Mn(e,t))},finite(){return this}}));function B(e){return Dm(qs,e)}var wb=v(\"ZodNumberFormat\",(e,t)=>{jf.init(e,t),qs.init(e,t)});function eg(e){return Um(wb,e)}var hc=v(\"ZodBoolean\",(e,t)=>{Zf.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_h(e,r,n,o)});function te(e){return Lm(hc,e)}var ag=v(\"ZodBigInt\",(e,t)=>{Df.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yh(e,r,n,o)},A.derived({minValue:e=>we(e).minimum??null,maxValue:e=>we(e).maximum??null,format:e=>we(e).format??null},{gte(e,t){return this.check(kt(e,t))},min(e,t){return this.check(kt(e,t))},gt(e,t){return this.check(Zr(e,t))},lt(e,t){return this.check(jr(e,t))},lte(e,t){return this.check(St(e,t))},max(e,t){return this.check(St(e,t))},positive(e){return this.check(Zr(BigInt(0),e))},negative(e){return this.check(jr(BigInt(0),e))},nonpositive(e){return this.check(St(BigInt(0),e))},nonnegative(e){return this.check(kt(BigInt(0),e))},multipleOf(e,t){return this.check(Mn(e,t))}}));var bb=v(\"ZodNull\",(e,t)=>{qf.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vh(e,r,n,o)});function cg(e){return Hm(bb,e)}var $b=v(\"ZodAny\",(e,t)=>{Uf.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bh(e,r,n,o)});function ug(){return Jm($b)}var xb=v(\"ZodUnknown\",(e,t)=>{Lf.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$h(e,r,n,o)});function ue(){return Km(xb)}var zb=v(\"ZodNever\",(e,t)=>{Ff.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wh(e,r,n,o)});function Sb(e){return Bm(zb,e)}var lg=v(\"ZodDate\",(e,t)=>{Vf.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xh(e,r,n,o),e.min=(r,n)=>e.check(kt(r,n)),e.max=(r,n)=>e.check(St(r,n))},A.derived({minDate:e=>{let{minimum:t}=we(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=we(e);return t?new Date(t):null}},{}));var kb=v(\"ZodArray\",(e,t)=>{Ds(),Hf.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eh(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Dr(e,t))},nonempty(e){return this.check(Dr(1,e))},max(e,t){return this.check(As(e,t))},length(e,t){return this.check(Ns(e,t))},unwrap(){return this.element}});function z(e,t){return Gm(kb,e,t)}var dg=v(\"ZodObject\",(e,t)=>{Ds(),Bf.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Th(e,r,n,o),A.installLazyProp(e,\"shape\",r=>r._zod.def.shape,!1)},{keyof(){return Ze(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(A.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(A.mergeDefs(this._zod.def,{catchall:ue()}))},loose(){return this.clone(A.mergeDefs(this._zod.def,{catchall:ue()}))},strict(){return this.clone(A.mergeDefs(this._zod.def,{catchall:Sb()}))},strip(){return this.clone(A.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return A.extend(this,e)},safeExtend(e){return A.safeExtend(this,e)},merge(e){return A.merge(this,e)},pick(e){return A.pick(this,e)},omit(e){return A.omit(this,e)},partial(...e){return A.partial(mg,this,e[0])},exactPartial(...e){return A.partial(hg,this,e[0],\"exactPartial\")},required(...e){return A.required(gg,this,e[0])}});function k(e,t){let r={type:\"object\",shape:e??{},...A.normalizeParams(t)};return new dg(r)}function ge(e,t){return new dg({type:\"object\",shape:e,catchall:ue(),...A.normalizeParams(t)})}var pg=v(\"ZodUnion\",(e,t)=>{Da.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oh(e,r,n,o),e.options=t.options});function se(e,t){return new pg({type:\"union\",options:e,...A.normalizeParams(t)})}var Pb=v(\"ZodDiscriminatedUnion\",(e,t)=>{pg.init(e,t),Wf.init(e,t)});function gc(e,t,r){return new Pb({type:\"union\",options:t,discriminator:e,...A.normalizeParams(r)})}var Eb=v(\"ZodIntersection\",(e,t)=>{Gf.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rh(e,r,n,o)});function Us(e,t){return new Eb({type:\"intersection\",left:e,right:t})}var tg=v(\"ZodRecord\",(e,t)=>{Ds(),Xf.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ch(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ne(e,t,r){return!t||!t._zod?new tg({type:\"record\",keyType:_(),valueType:e,...A.normalizeParams(t)}):new tg({type:\"record\",keyType:e,valueType:t,...A.normalizeParams(r)})}var fc=v(\"ZodEnum\",(e,t)=>{Yf.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,o,s)=>zh(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new fc({...t,checks:[],...A.normalizeParams(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new fc({...t,checks:[],...A.normalizeParams(o),entries:s})}});function Ze(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new fc({type:\"enum\",entries:r,...A.normalizeParams(t)})}var Tb=v(\"ZodLiteral\",(e,t)=>{Qf.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sh(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,\"value\",{get(){if(t.values.length>1)throw new Error(\"This schema contains multiple valid literal values. Use `.values` instead.\");return t.values[0]}})});function T(e,t){return new Tb({type:\"literal\",values:Array.isArray(e)?e:[e],...A.normalizeParams(t)})}var Ob=v(\"ZodTransform\",(e,t)=>{Ds(),em.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ph(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction===\"backward\")throw new Nr(e.constructor.name);r.addIssue=s=>{if(typeof s==\"string\")r.issues.push(A.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code=\"custom\"),\"input\"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(A.issue(i))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function fg(e){return new Ob({type:\"transform\",transform:e})}var mg=v(\"ZodOptional\",(e,t)=>{qa.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function le(e){return new mg({type:\"optional\",innerType:e})}var hg=v(\"ZodExactOptional\",(e,t)=>{tm.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Rb(e){return new hg({type:\"optional\",innerType:e})}var Cb=v(\"ZodNullable\",(e,t)=>{rm.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ih(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function rg(e){return new Cb({type:\"nullable\",innerType:e})}var Ib=v(\"ZodDefault\",(e,t)=>{nm.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ab(e,t){return new Ib({type:\"default\",innerType:e,get defaultValue(){return typeof t==\"function\"?t():A.shallowClone(t)}})}var Nb=v(\"ZodPrefault\",(e,t)=>{om.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Mb(e,t){return new Nb({type:\"prefault\",innerType:e,get defaultValue(){return typeof t==\"function\"?t():A.shallowClone(t)}})}var gg=v(\"ZodNonOptional\",(e,t)=>{sm.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ah(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function jb(e,t){return new gg({type:\"nonoptional\",innerType:e,...A.normalizeParams(t)})}var Zb=v(\"ZodCatch\",(e,t)=>{im.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Db(e,t){return new Zb({type:\"catch\",innerType:e,catchValue:typeof t==\"function\"?t:A.constantCatch(t)})}var _g=v(\"ZodPipe\",(e,t)=>{Ua.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dh(e,r,n,o),e.in=t.in,e.out=t.out});function ng(e,t){return new _g({type:\"pipe\",in:e,out:t})}var qb=v(\"ZodPreprocess\",(e,t)=>{_g.init(e,t),am.init(e,t)}),Ub=v(\"ZodReadonly\",(e,t)=>{cm.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Lb(e){return new Ub({type:\"readonly\",innerType:e})}var yg=v(\"ZodCustom\",(e,t)=>{um.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kh(e,r,n,o)});function vg(e,t){return Xm(yg,e??(()=>!0),t)}function Fb(e,t={}){return Ym(yg,e,t)}function Vb(e,t){return Qm(e,t)}function _c(e,t){return new qb({type:\"pipe\",in:fg(e),out:t})}var bg={invalid_type:\"invalid_type\",too_big:\"too_big\",too_small:\"too_small\",invalid_format:\"invalid_format\",not_multiple_of:\"not_multiple_of\",unrecognized_keys:\"unrecognized_keys\",invalid_union:\"invalid_union\",invalid_key:\"invalid_key\",invalid_element:\"invalid_element\",invalid_value:\"invalid_value\",custom:\"custom\"};var wg;wg||(wg={});var Ls={};ea(Ls,{ZodISODate:()=>qn,ZodISODateTime:()=>Dn,ZodISODuration:()=>Ln,ZodISOTime:()=>Un,date:()=>Kb,datetime:()=>Jb,duration:()=>Wb,time:()=>Bb});function Jb(e){return Os(Dn,e)}function Kb(e){return Rs(qn,e)}function Bb(e){return Cs(Un,e)}function Wb(e){return Is(Ln,e)}var Fs={};ea(Fs,{bigint:()=>Qb,boolean:()=>Yb,date:()=>e$,number:()=>Xb,string:()=>Gb});function Gb(e){return _m(mc,e)}function Xb(e){return qm(qs,e)}function Yb(e){return Fm(hc,e)}function Qb(e){return Vm(ag,e)}function e$(e){return Wm(lg,e)}var Vr=\"2025-11-25\";var $g=[Vr,\"2025-06-18\",\"2025-03-26\",\"2024-11-05\",\"2024-10-07\"],Vt=\"io.modelcontextprotocol/related-task\",Hs=\"2.0\",_e=vg(e=>e!==null&&(typeof e==\"object\"||typeof e==\"function\")),xg=se([_(),B().int()]),zg=_(),gI=ge({ttl:B().optional(),pollInterval:B().optional()}),r$=k({ttl:B().optional()}),n$=k({taskId:_()}),vc=ge({progressToken:xg.optional(),[Vt]:n$.optional()}),Ke=k({_meta:vc.optional()}),Fn=Ke.extend({task:r$.optional()}),Sg=e=>Fn.safeParse(e).success,be=k({method:_(),params:Ke.loose().optional()}),We=k({_meta:vc.optional()}),Ge=k({method:_(),params:We.loose().optional()}),$e=ge({_meta:vc.optional()}),Js=se([_(),B().int()]),kg=k({jsonrpc:T(Hs),id:Js,...be.shape}).strict(),Vn=e=>kg.safeParse(e).success,Pg=k({jsonrpc:T(Hs),...Ge.shape}).strict(),Eg=e=>Pg.safeParse(e).success,wc=k({jsonrpc:T(Hs),id:Js,result:$e}).strict(),sr=e=>wc.safeParse(e).success;var C;(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\"})(C||(C={}));var bc=k({jsonrpc:T(Hs),id:Js.optional(),error:k({code:B().int(),message:_(),data:ue().optional()})}).strict();var Tg=e=>bc.safeParse(e).success;var Hr=se([kg,Pg,wc,bc]),_I=se([wc,bc]),ir=$e.strict(),o$=We.extend({requestId:Js.optional(),reason:_().optional()}),Ks=Ge.extend({method:T(\"notifications/cancelled\"),params:o$}),s$=k({src:_(),mimeType:_().optional(),sizes:z(_()).optional(),theme:Ze([\"light\",\"dark\"]).optional()}),Hn=k({icons:z(s$).optional()}),Fr=k({name:_(),title:_().optional()}),Og=Fr.extend({...Fr.shape,...Hn.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),i$=Us(k({applyDefaults:te().optional()}),ne(_(),ue())),a$=_c(e=>e&&typeof e==\"object\"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Us(k({form:i$.optional(),url:_e.optional()}),ne(_(),ue()).optional())),c$=ge({list:_e.optional(),cancel:_e.optional(),requests:ge({sampling:ge({createMessage:_e.optional()}).optional(),elicitation:ge({create:_e.optional()}).optional()}).optional()}),u$=ge({list:_e.optional(),cancel:_e.optional(),requests:ge({tools:ge({call:_e.optional()}).optional()}).optional()}),l$=k({experimental:ne(_(),_e).optional(),sampling:k({context:_e.optional(),tools:_e.optional()}).optional(),elicitation:a$.optional(),roots:k({listChanged:te().optional()}).optional(),tasks:c$.optional(),extensions:ne(_(),_e).optional()}),d$=Ke.extend({protocolVersion:_(),capabilities:l$,clientInfo:Og}),p$=be.extend({method:T(\"initialize\"),params:d$});var f$=k({experimental:ne(_(),_e).optional(),logging:_e.optional(),completions:_e.optional(),prompts:k({listChanged:te().optional()}).optional(),resources:k({subscribe:te().optional(),listChanged:te().optional()}).optional(),tools:k({listChanged:te().optional()}).optional(),tasks:u$.optional(),extensions:ne(_(),_e).optional()}),$c=$e.extend({protocolVersion:_(),capabilities:f$,serverInfo:Og,instructions:_().optional()}),Rg=Ge.extend({method:T(\"notifications/initialized\"),params:We.optional()}),Cg=e=>Rg.safeParse(e).success,Bs=be.extend({method:T(\"ping\"),params:Ke.optional()}),m$=k({progress:B(),total:le(B()),message:le(_())}),h$=k({...We.shape,...m$.shape,progressToken:xg}),Ws=Ge.extend({method:T(\"notifications/progress\"),params:h$}),g$=Ke.extend({cursor:zg.optional()}),Jn=be.extend({params:g$.optional()}),Kn=$e.extend({nextCursor:zg.optional()}),_$=Ze([\"working\",\"input_required\",\"completed\",\"failed\",\"cancelled\"]),Bn=k({taskId:_(),status:_$,ttl:se([B(),cg()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:le(B()),statusMessage:le(_())}),ar=$e.extend({task:Bn}),y$=We.merge(Bn),Wn=Ge.extend({method:T(\"notifications/tasks/status\"),params:y$}),Gs=be.extend({method:T(\"tasks/get\"),params:Ke.extend({taskId:_()})}),Xs=$e.merge(Bn),Ys=be.extend({method:T(\"tasks/result\"),params:Ke.extend({taskId:_()})}),yI=$e.loose(),Qs=Jn.extend({method:T(\"tasks/list\")}),ei=Kn.extend({tasks:z(Bn)}),ti=be.extend({method:T(\"tasks/cancel\"),params:Ke.extend({taskId:_()})}),Ig=$e.merge(Bn),Ag=k({uri:_(),mimeType:le(_()),_meta:ne(_(),ue()).optional()}),Ng=Ag.extend({text:_()}),xc=_().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:\"Invalid Base64 string\"}),Mg=Ag.extend({blob:xc}),Gn=Ze([\"user\",\"assistant\"]),Jr=k({audience:z(Gn).optional(),priority:B().min(0).max(1).optional(),lastModified:Ls.datetime({offset:!0}).optional()}),jg=k({...Fr.shape,...Hn.shape,uri:_(),description:le(_()),mimeType:le(_()),size:le(B()),annotations:Jr.optional(),_meta:le(ge({}))}),v$=k({...Fr.shape,...Hn.shape,uriTemplate:_(),description:le(_()),mimeType:le(_()),annotations:Jr.optional(),_meta:le(ge({}))}),w$=Jn.extend({method:T(\"resources/list\")}),zc=Kn.extend({resources:z(jg)}),b$=Jn.extend({method:T(\"resources/templates/list\")}),Sc=Kn.extend({resourceTemplates:z(v$)}),kc=Ke.extend({uri:_()}),$$=kc,x$=be.extend({method:T(\"resources/read\"),params:$$}),Pc=$e.extend({contents:z(se([Ng,Mg]))}),Ec=Ge.extend({method:T(\"notifications/resources/list_changed\"),params:We.optional()}),z$=kc,S$=be.extend({method:T(\"resources/subscribe\"),params:z$}),k$=kc,P$=be.extend({method:T(\"resources/unsubscribe\"),params:k$}),E$=We.extend({uri:_()}),T$=Ge.extend({method:T(\"notifications/resources/updated\"),params:E$}),O$=k({name:_(),description:le(_()),required:le(te())}),R$=k({...Fr.shape,...Hn.shape,description:le(_()),arguments:le(z(O$)),_meta:le(ge({}))}),C$=Jn.extend({method:T(\"prompts/list\")}),Tc=Kn.extend({prompts:z(R$)}),I$=Ke.extend({name:_(),arguments:ne(_(),_()).optional()}),A$=be.extend({method:T(\"prompts/get\"),params:I$}),Oc=k({type:T(\"text\"),text:_(),annotations:Jr.optional(),_meta:ne(_(),ue()).optional()}),Rc=k({type:T(\"image\"),data:xc,mimeType:_(),annotations:Jr.optional(),_meta:ne(_(),ue()).optional()}),Cc=k({type:T(\"audio\"),data:xc,mimeType:_(),annotations:Jr.optional(),_meta:ne(_(),ue()).optional()}),N$=k({type:T(\"tool_use\"),name:_(),id:_(),input:ne(_(),ue()),_meta:ne(_(),ue()).optional()}),M$=k({type:T(\"resource\"),resource:se([Ng,Mg]),annotations:Jr.optional(),_meta:ne(_(),ue()).optional()}),j$=jg.extend({type:T(\"resource_link\")}),Ic=se([Oc,Rc,Cc,j$,M$]),Z$=k({role:Gn,content:Ic}),Ac=$e.extend({description:_().optional(),messages:z(Z$)}),Nc=Ge.extend({method:T(\"notifications/prompts/list_changed\"),params:We.optional()}),D$=k({title:_().optional(),readOnlyHint:te().optional(),destructiveHint:te().optional(),idempotentHint:te().optional(),openWorldHint:te().optional()}),q$=k({taskSupport:Ze([\"required\",\"optional\",\"forbidden\"]).optional()}),Zg=k({...Fr.shape,...Hn.shape,description:_().optional(),inputSchema:k({type:T(\"object\"),properties:ne(_(),_e).optional(),required:z(_()).optional()}).catchall(ue()),outputSchema:k({type:T(\"object\"),properties:ne(_(),_e).optional(),required:z(_()).optional()}).catchall(ue()).optional(),annotations:D$.optional(),execution:q$.optional(),_meta:ne(_(),ue()).optional()}),U$=Jn.extend({method:T(\"tools/list\")}),Kr=Kn.extend({tools:z(Zg)}),Br=$e.extend({content:z(Ic).default([]),structuredContent:ne(_(),ue()).optional(),isError:te().optional()}),vI=Br.or($e.extend({toolResult:ue()})),L$=Fn.extend({name:_(),arguments:ne(_(),ue()).optional()}),F$=be.extend({method:T(\"tools/call\"),params:L$}),Xn=Ge.extend({method:T(\"notifications/tools/list_changed\"),params:We.optional()}),Dg=k({autoRefresh:te().default(!0),debounceMs:B().int().nonnegative().default(300)}),qg=Ze([\"debug\",\"info\",\"notice\",\"warning\",\"error\",\"critical\",\"alert\",\"emergency\"]),V$=Ke.extend({level:qg}),H$=be.extend({method:T(\"logging/setLevel\"),params:V$}),J$=We.extend({level:qg,logger:_().optional(),data:ue()}),K$=Ge.extend({method:T(\"notifications/message\"),params:J$}),B$=k({name:_().optional()}),W$=k({hints:z(B$).optional(),costPriority:B().min(0).max(1).optional(),speedPriority:B().min(0).max(1).optional(),intelligencePriority:B().min(0).max(1).optional()}),G$=k({mode:Ze([\"auto\",\"required\",\"none\"]).optional()}),X$=k({type:T(\"tool_result\"),toolUseId:_().describe(\"The unique identifier for the corresponding tool call.\"),content:z(Ic).default([]),structuredContent:k({}).loose().optional(),isError:te().optional(),_meta:ne(_(),ue()).optional()}),Y$=gc(\"type\",[Oc,Rc,Cc]),Vs=gc(\"type\",[Oc,Rc,Cc,N$,X$]),Q$=k({role:Gn,content:se([Vs,z(Vs)]),_meta:ne(_(),ue()).optional()}),ex=Fn.extend({messages:z(Q$),modelPreferences:W$.optional(),systemPrompt:_().optional(),includeContext:Ze([\"none\",\"thisServer\",\"allServers\"]).optional(),temperature:B().optional(),maxTokens:B().int(),stopSequences:z(_()).optional(),metadata:_e.optional(),tools:z(Zg).optional(),toolChoice:G$.optional()}),Mc=be.extend({method:T(\"sampling/createMessage\"),params:ex}),jc=$e.extend({model:_(),stopReason:le(Ze([\"endTurn\",\"stopSequence\",\"maxTokens\"]).or(_())),role:Gn,content:Y$}),Zc=$e.extend({model:_(),stopReason:le(Ze([\"endTurn\",\"stopSequence\",\"maxTokens\",\"toolUse\"]).or(_())),role:Gn,content:se([Vs,z(Vs)])}),tx=k({type:T(\"boolean\"),title:_().optional(),description:_().optional(),default:te().optional()}),rx=k({type:T(\"string\"),title:_().optional(),description:_().optional(),minLength:B().optional(),maxLength:B().optional(),format:Ze([\"email\",\"uri\",\"date\",\"date-time\"]).optional(),default:_().optional()}),nx=k({type:Ze([\"number\",\"integer\"]),title:_().optional(),description:_().optional(),minimum:B().optional(),maximum:B().optional(),default:B().optional()}),ox=k({type:T(\"string\"),title:_().optional(),description:_().optional(),enum:z(_()),default:_().optional()}),sx=k({type:T(\"string\"),title:_().optional(),description:_().optional(),oneOf:z(k({const:_(),title:_()})),default:_().optional()}),ix=k({type:T(\"string\"),title:_().optional(),description:_().optional(),enum:z(_()),enumNames:z(_()).optional(),default:_().optional()}),ax=se([ox,sx]),cx=k({type:T(\"array\"),title:_().optional(),description:_().optional(),minItems:B().optional(),maxItems:B().optional(),items:k({type:T(\"string\"),enum:z(_())}),default:z(_()).optional()}),ux=k({type:T(\"array\"),title:_().optional(),description:_().optional(),minItems:B().optional(),maxItems:B().optional(),items:k({anyOf:z(k({const:_(),title:_()}))}),default:z(_()).optional()}),lx=se([cx,ux]),dx=se([ix,ax,lx]),px=se([dx,tx,rx,nx]),fx=Fn.extend({mode:T(\"form\").optional(),message:_(),requestedSchema:k({type:T(\"object\"),properties:ne(_(),px),required:z(_()).optional()})}),mx=Fn.extend({mode:T(\"url\"),message:_(),elicitationId:_(),url:_().url()}),hx=se([fx,mx]),Yn=be.extend({method:T(\"elicitation/create\"),params:hx}),gx=We.extend({elicitationId:_()}),_x=Ge.extend({method:T(\"notifications/elicitation/complete\"),params:gx}),Qn=$e.extend({action:Ze([\"accept\",\"decline\",\"cancel\"]),content:_c(e=>e===null?void 0:e,ne(_(),se([_(),B(),te(),z(_())])).optional())}),yx=k({type:T(\"ref/resource\"),uri:_()});var vx=k({type:T(\"ref/prompt\"),name:_()}),wx=Ke.extend({ref:se([vx,yx]),argument:k({name:_(),value:_()}),context:k({arguments:ne(_(),_()).optional()}).optional()}),bx=be.extend({method:T(\"completion/complete\"),params:wx});var Dc=$e.extend({completion:ge({values:z(_()).max(100),total:le(B().int()),hasMore:le(te())})}),$x=k({uri:_().startsWith(\"file://\"),name:_().optional(),_meta:ne(_(),ue()).optional()}),xx=be.extend({method:T(\"roots/list\"),params:Ke.optional()}),zx=$e.extend({roots:z($x)}),Sx=Ge.extend({method:T(\"notifications/roots/list_changed\"),params:We.optional()}),wI=se([Bs,p$,bx,H$,A$,C$,w$,b$,x$,S$,P$,F$,U$,Gs,Ys,Qs,ti]),bI=se([Ks,Ws,Rg,Sx,Wn]),$I=se([ir,jc,Zc,Qn,zx,Xs,ei,ar]),xI=se([Bs,Mc,Yn,xx,Gs,Ys,Qs,ti]),zI=se([Ks,Ws,K$,T$,Ec,Xn,Nc,Wn,_x]),SI=se([ir,$c,Dc,Ac,Tc,zc,Sc,Pc,Br,Kr,Xs,ei,ar]),E=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name=\"McpError\"}static fromError(t,r,n){if(t===C.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new yc(o.elicitations,r)}return new e(t,r,n)}},yc=class extends E{constructor(t,r=`URL elicitation${t.length>1?\"s\":\"\"} required`){super(C.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};var xe=ig().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:bg.custom,message:\"URL must be parseable\",fatal:!0}),xa}).refine(e=>{let t=new URL(e);return t.protocol!==\"javascript:\"&&t.protocol!==\"data:\"&&t.protocol!==\"vbscript:\"},{message:\"URL cannot use javascript:, data:, or vbscript: scheme\"}),Lg=ge({resource:_().url(),authorization_servers:z(xe).optional(),jwks_uri:_().url().optional(),scopes_supported:z(_()).optional(),bearer_methods_supported:z(_()).optional(),resource_signing_alg_values_supported:z(_()).optional(),resource_name:_().optional(),resource_documentation:_().optional(),resource_policy_uri:_().url().optional(),resource_tos_uri:_().url().optional(),tls_client_certificate_bound_access_tokens:te().optional(),authorization_details_types_supported:z(_()).optional(),dpop_signing_alg_values_supported:z(_()).optional(),dpop_bound_access_tokens_required:te().optional()}),qc=ge({issuer:_(),authorization_endpoint:xe,token_endpoint:xe,registration_endpoint:xe.optional(),scopes_supported:z(_()).optional(),response_types_supported:z(_()),response_modes_supported:z(_()).optional(),grant_types_supported:z(_()).optional(),token_endpoint_auth_methods_supported:z(_()).optional(),token_endpoint_auth_signing_alg_values_supported:z(_()).optional(),service_documentation:xe.optional(),revocation_endpoint:xe.optional(),revocation_endpoint_auth_methods_supported:z(_()).optional(),revocation_endpoint_auth_signing_alg_values_supported:z(_()).optional(),introspection_endpoint:_().optional(),introspection_endpoint_auth_methods_supported:z(_()).optional(),introspection_endpoint_auth_signing_alg_values_supported:z(_()).optional(),code_challenge_methods_supported:z(_()).optional(),client_id_metadata_document_supported:te().optional()}),kx=ge({issuer:_(),authorization_endpoint:xe,token_endpoint:xe,userinfo_endpoint:xe.optional(),jwks_uri:xe,registration_endpoint:xe.optional(),scopes_supported:z(_()).optional(),response_types_supported:z(_()),response_modes_supported:z(_()).optional(),grant_types_supported:z(_()).optional(),acr_values_supported:z(_()).optional(),subject_types_supported:z(_()),id_token_signing_alg_values_supported:z(_()),id_token_encryption_alg_values_supported:z(_()).optional(),id_token_encryption_enc_values_supported:z(_()).optional(),userinfo_signing_alg_values_supported:z(_()).optional(),userinfo_encryption_alg_values_supported:z(_()).optional(),userinfo_encryption_enc_values_supported:z(_()).optional(),request_object_signing_alg_values_supported:z(_()).optional(),request_object_encryption_alg_values_supported:z(_()).optional(),request_object_encryption_enc_values_supported:z(_()).optional(),token_endpoint_auth_methods_supported:z(_()).optional(),token_endpoint_auth_signing_alg_values_supported:z(_()).optional(),display_values_supported:z(_()).optional(),claim_types_supported:z(_()).optional(),claims_supported:z(_()).optional(),service_documentation:_().optional(),claims_locales_supported:z(_()).optional(),ui_locales_supported:z(_()).optional(),claims_parameter_supported:te().optional(),request_parameter_supported:te().optional(),request_uri_parameter_supported:te().optional(),require_request_uri_registration:te().optional(),op_policy_uri:xe.optional(),op_tos_uri:xe.optional(),client_id_metadata_document_supported:te().optional()}),Fg=k({...kx.shape,...qc.pick({code_challenge_methods_supported:!0}).shape}),Vg=k({access_token:_(),id_token:_().optional(),token_type:_(),expires_in:Fs.number().optional(),scope:_().optional(),refresh_token:_().optional(),issuer:_().optional().catch(void 0)}).strip(),Hg=k({error:_(),error_description:_().optional(),error_uri:_().optional()}),Ug=xe.optional().or(T(\"\").transform(()=>{})),Px=k({redirect_uris:z(xe),token_endpoint_auth_method:_().optional(),grant_types:z(_()).optional(),response_types:z(_()).optional(),client_name:_().optional(),client_uri:xe.optional(),logo_uri:Ug,scope:_().optional(),contacts:z(_()).optional(),tos_uri:Ug,policy_uri:_().optional(),jwks_uri:xe.optional(),jwks:ug().optional(),software_id:_().optional(),software_version:_().optional(),software_statement:_().optional()}).strip(),Ex=k({client_id:_(),client_secret:_().optional(),client_id_issued_at:B().optional(),client_secret_expires_at:B().optional(),issuer:_().optional().catch(void 0)}).strip(),Jg=Px.merge(Ex),PI=k({error:_(),error_description:_().optional()}).strip(),EI=k({token:_(),token_type_hint:_().optional()}).strip();function Kg(e){let t=typeof e==\"string\"?new URL(e):new URL(e.href);return t.hash=\"\",t}function Bg({requestedResource:e,configuredResource:t}){let r=typeof e==\"string\"?new URL(e):new URL(e.href),n=typeof t==\"string\"?new URL(t):new URL(t.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith(\"/\")?r.pathname:r.pathname+\"/\",s=n.pathname.endsWith(\"/\")?n.pathname:n.pathname+\"/\";return o.startsWith(s)}var me=class extends Error{constructor(t,r){super(t),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}},eo=class extends me{};eo.errorCode=\"invalid_request\";var cr=class extends me{};cr.errorCode=\"invalid_client\";var ur=class extends me{};ur.errorCode=\"invalid_grant\";var lr=class extends me{};lr.errorCode=\"unauthorized_client\";var to=class extends me{};to.errorCode=\"unsupported_grant_type\";var ro=class extends me{};ro.errorCode=\"invalid_scope\";var no=class extends me{};no.errorCode=\"access_denied\";var Pt=class extends me{};Pt.errorCode=\"server_error\";var oo=class extends me{};oo.errorCode=\"temporarily_unavailable\";var so=class extends me{};so.errorCode=\"unsupported_response_type\";var io=class extends me{};io.errorCode=\"unsupported_token_type\";var ao=class extends me{};ao.errorCode=\"invalid_token\";var co=class extends me{};co.errorCode=\"method_not_allowed\";var uo=class extends me{};uo.errorCode=\"too_many_requests\";var dr=class extends me{};dr.errorCode=\"invalid_client_metadata\";var lo=class extends me{};lo.errorCode=\"insufficient_scope\";var po=class extends me{};po.errorCode=\"invalid_target\";var Wg={[eo.errorCode]:eo,[cr.errorCode]:cr,[ur.errorCode]:ur,[lr.errorCode]:lr,[to.errorCode]:to,[ro.errorCode]:ro,[no.errorCode]:no,[Pt.errorCode]:Pt,[oo.errorCode]:oo,[so.errorCode]:so,[io.errorCode]:io,[ao.errorCode]:ao,[co.errorCode]:co,[uo.errorCode]:uo,[dr.errorCode]:dr,[lo.errorCode]:lo,[po.errorCode]:po};function Wr(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function ri(e=fetch,t){return t?async(r,n)=>{let o={...t,...n,headers:n?.headers?{...Wr(t.headers),...Wr(n.headers)}:t.headers};return e(r,o)}:e}var Tx=5,Ox=[301,302,303,307,308];function Rx(e,t){return e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port?!0:e.hostname===t.hostname&&e.protocol===\"http:\"&&e.port===\"\"&&t.protocol===\"https:\"&&t.port===\"\"}function Gg(e,t){let r=Ox.includes(e.status)?e.headers.get(\"location\"):null;try{return r?new URL(r,t):void 0}catch{return}}function ni(e,t,r,n,o=0){let s=Gg(n,t),i=n.status===307||n.status===308||(r?.method??\"GET\").toUpperCase()===\"GET\";if(!s||o===Tx||!i)return;let a=new URL(t);if(!((s.username||s.password)&&(s.username!==a.username||s.password!==a.password)||!Rx(a,s)))return Promise.resolve(n.body?.cancel()).then(()=>e(s,{...r,redirect:\"manual\"})).then(u=>ni(e,s,r,u,o+1)??u)}var Xg=new WeakSet;function Gr(e){let t=(r,n)=>(e??fetch)(r,n);return Xg.add(t),t}function ft(e=fetch){return Xg.has(e)?e:(t,r)=>r?.redirect===\"error\"||r?.redirect===\"manual\"?e(t,r):Promise.resolve(e(t,{...r,redirect:\"manual\"})).then(n=>ni(e,t,r,n)??n)}function Xr(e,t){if(e.type===\"opaqueredirect\")return\"Redirect not followed: this runtime does not expose the redirect target\";let r=e.url||t,n=Gg(e,r);if(n)return n.username=n.password=n.search=n.hash=\"\",n.protocol===\"http:\"&&new URL(r).protocol===\"https:\"?(n.protocol=\"https:\",`Redirect to plain http not followed; try ${n.href} instead`):`Redirect to ${n.href} not followed`}var ze=class extends Error{constructor(t){super(t??\"Unauthorized\")}};function Cx(e){return[\"client_secret_basic\",\"client_secret_post\",\"none\"].includes(e)}var Uc=\"code\",Lc=\"S256\";function Ix(e,t){let r=e.client_secret!==void 0;return\"token_endpoint_auth_method\"in e&&e.token_endpoint_auth_method&&Cx(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?r?\"client_secret_basic\":\"none\":r&&t.includes(\"client_secret_basic\")?\"client_secret_basic\":r&&t.includes(\"client_secret_post\")?\"client_secret_post\":t.includes(\"none\")?\"none\":r?\"client_secret_post\":\"none\"}function Ax(e,t,r,n){let{client_id:o,client_secret:s}=t;switch(e){case\"client_secret_basic\":Nx(o,s,r);return;case\"client_secret_post\":Mx(o,s,n);return;case\"none\":jx(o,n);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function Nx(e,t,r){if(!t)throw new Error(\"client_secret_basic authentication requires a client_secret\");let n=btoa(`${e}:${t}`);r.set(\"Authorization\",`Basic ${n}`)}function Mx(e,t,r){r.set(\"client_id\",e),t&&r.set(\"client_secret\",t)}function jx(e,t){t.set(\"client_id\",e)}async function Qg(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let n=Hg.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:i}=n,a=Wg[o]||Pt;return new a(s||\"\",i)}catch(n){let o=e instanceof Response?Xr(e,e.url):void 0,s=`${t?`HTTP ${t}: `:\"\"}${o??`Invalid OAuth error response: ${n}. Raw body: ${r}`}`;return new Pt(s)}}function Zx(e,t){let[r,n]=[e,t];try{[r,n]=[new URL(e).href,new URL(t).href]}catch{}return r===n||r.endsWith(\"/\")&&r.slice(0,-1)===n||n.endsWith(\"/\")&&n.slice(0,-1)===r}function Hc(e,t){if(e)return typeof e.issuer!=\"string\"?e.issuer==null?e:{...e,issuer:void 0}:Zx(e.issuer,t)?e:void 0}var Dx=Vg.omit({issuer:!0}),qx=Jg.omit({issuer:!0});function e_(e,t){return new Error(`OAuth client information is bound to authorization server ${e.issuer} and is not presented to ${t}. Clear the stored client information, or correct \\`expectedIssuer\\`, if the authorization server has moved.`)}async function Et(e,t){try{return await Fc(e,t)}catch(r){if(r instanceof cr||r instanceof lr)return await e.invalidateCredentials?.(\"all\"),await Fc(e,t);if(r instanceof ur)return await e.invalidateCredentials?.(\"tokens\"),await Fc(e,t);throw r}}async function Fc(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let i=await e.discoveryState?.(),a,c,u,l=o;if(!l&&i?.resourceMetadataUrl&&(l=new URL(i.resourceMetadataUrl)),i?.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await r_(c,{fetchFn:s}),!a)try{a=await t_(t,{resourceMetadataUrl:l},s)}catch{}(u!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}else{let q=await Kx(t,{resourceMetadataUrl:l,fetchFn:s});c=q.authorizationServerUrl,u=q.authorizationServerMetadata,a=q.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}let d=String(c),m=await Lx(t,e,a),p=m&&a&&!e.validateResourceURL?a.resource:m,f=n||a?.scopes_supported?.join(\" \")||e.clientMetadata.scope,g=await Promise.resolve(e.clientInformation()),h=Hc(g,d),y=e.saveClientInformation!==void 0&&!!e.redirectUrl;if(g&&!h&&!y)throw e_(g,d);let x=h?.issuer==null?h:void 0,S=async()=>{try{x&&await e.saveClientInformation?.({...x,issuer:d})}catch{}};if(!h){if(r!==void 0)throw new Error(\"Existing OAuth client information is required when exchanging an authorization code\");let q=u?.client_id_metadata_document_supported===!0,ce=e.clientMetadataUrl;if(ce&&!Ux(ce))throw new dr(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${ce}`);if(q&&ce)h={client_id:ce,issuer:d},await e.saveClientInformation?.(h);else{if(!e.saveClientInformation)throw new Error(\"OAuth client information must be saveable for dynamic registration\");h={...await Yx(c,{metadata:u,clientMetadata:e.clientMetadata,scope:f,fetchFn:s}),issuer:d},await e.saveClientInformation(h)}}let M=!e.redirectUrl;if(r!==void 0||M){let q=await Xx(e,c,{metadata:u,resource:p,authorizationCode:r,fetchFn:s});return await S(),await e.saveTokens({...q,issuer:d}),\"AUTHORIZED\"}let b=Hc(await e.tokens(),d);if(b?.refresh_token&&b.issuer==null&&console.warn(\"[mcp-sdk] stored OAuth tokens have no 'issuer' property (saved by an earlier version, or by a provider that does not keep it) and are used as-is; make sure your OAuthClientProvider stores what saveTokens() and saveClientInformation() receive unchanged.\"),b?.refresh_token)try{let q=await Gx(c,{metadata:u,clientInformation:h,refreshToken:b.refresh_token,resource:p,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await S(),await e.saveTokens({...q,issuer:d}),\"AUTHORIZED\"}catch(q){if(!(!(q instanceof me)||q instanceof Pt))throw q}let $=e.state?await e.state():void 0,{authorizationUrl:I,codeVerifier:Q}=await Bx(c,{metadata:u,clientInformation:h,state:$,redirectUrl:e.redirectUrl,scope:f,resource:p});return await e.saveCodeVerifier(Q),await e.redirectToAuthorization(I),\"REDIRECT\"}function Ux(e){if(!e)return!1;try{let t=new URL(e);return t.protocol===\"https:\"&&t.pathname!==\"/\"}catch{return!1}}async function Lx(e,t,r){let n=Kg(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r?.resource);if(r){if(!Bg({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function Yr(e){let t=e.headers.get(\"WWW-Authenticate\");if(!t)return{};let[r,n]=t.split(\" \");if(r.toLowerCase()!==\"bearer\"||!n)return{};let o=Vc(e,\"resource_metadata\")||void 0,s;if(o)try{s=new URL(o)}catch{}let i=Vc(e,\"scope\")||void 0,a=Vc(e,\"error\")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function Vc(e,t){let r=e.headers.get(\"WWW-Authenticate\");if(!r)return null;let n=new RegExp(`${t}=(?:\"([^\"]+)\"|([^\\\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function t_(e,t,r=fetch){let n=await Hx(e,\"oauth-protected-resource\",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error(\"Resource server does not implement OAuth 2.0 Protected Resource Metadata.\");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Lg.parse(await n.json())}async function Jc(e,t,r=fetch){try{return await ft(r)(e,{headers:t})}catch(n){if(n instanceof TypeError)return t?Jc(e,void 0,r):void 0;throw n}}function Fx(e,t=\"\",r={}){return t.endsWith(\"/\")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Yg(e,t,r=fetch){return await Jc(e,{\"MCP-Protocol-Version\":t},r)}function Vx(e,t){return!e||!e.ok&&e.status<500&&t!==\"/\"}async function Hx(e,t,r,n){let o=new URL(e),s=n?.protocolVersion??Vr,i;if(n?.metadataUrl)i=new URL(n.metadataUrl);else{let c=Fx(t,o.pathname);i=new URL(c,n?.metadataServerUrl??o),i.search=o.search}let a=await Yg(i,s,r);if(!n?.metadataUrl&&Vx(a,o.pathname)){let c=new URL(`/.well-known/${t}`,o);a=await Yg(c,s,r)}return a}function Jx(e){let t=typeof e==\"string\"?new URL(e):e,r=t.pathname!==\"/\",n=[];if(!r)return n.push({url:new URL(\"/.well-known/oauth-authorization-server\",t.origin),type:\"oauth\"}),n.push({url:new URL(\"/.well-known/openid-configuration\",t.origin),type:\"oidc\"}),n;let o=t.pathname;return o.endsWith(\"/\")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:\"oauth\"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:\"oidc\"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:\"oidc\"}),n}async function r_(e,{fetchFn:t=fetch,protocolVersion:r=Vr}={}){let n={\"MCP-Protocol-Version\":r,Accept:\"application/json\"},o=Jx(e);for(let{url:s,type:i}of o){let a=await Jc(s,n,t);if(a){if(!a.ok){if(await a.body?.cancel(),a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${i===\"oauth\"?\"OAuth\":\"OpenID provider\"} metadata from ${s}`)}return i===\"oauth\"?qc.parse(await a.json()):Fg.parse(await a.json())}}}async function Kx(e,t){let r,n;try{r=await t_(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL(\"/\",e)));let o=await r_(n,{fetchFn:t?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:o,resourceMetadata:r}}function n_(e){return typeof e==\"string\"?e:e.href}async function Bx(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Uc))throw new Error(`Incompatible auth server: does not support response type ${Uc}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Lc))throw new Error(`Incompatible auth server: does not support code challenge method ${Lc}`)}else a=new URL(\"/authorize\",e);let c=await ca(),u=c.code_verifier,l=c.code_challenge;return a.searchParams.set(\"response_type\",Uc),a.searchParams.set(\"client_id\",r.client_id),a.searchParams.set(\"code_challenge\",l),a.searchParams.set(\"code_challenge_method\",Lc),a.searchParams.set(\"redirect_uri\",String(n)),s&&a.searchParams.set(\"state\",s),o&&a.searchParams.set(\"scope\",o),o?.includes(\"offline_access\")&&a.searchParams.append(\"prompt\",\"consent\"),i&&a.searchParams.set(\"resource\",n_(i)),{authorizationUrl:a,codeVerifier:u}}function Wx(e,t,r){return new URLSearchParams({grant_type:\"authorization_code\",code:e,code_verifier:t,redirect_uri:String(r)})}async function o_(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:i}){let a=t?.token_endpoint?new URL(t.token_endpoint):new URL(\"/token\",e),c=new Headers({\"Content-Type\":\"application/x-www-form-urlencoded\",Accept:\"application/json\"});if(s&&r.set(\"resource\",n_(s)),o)await o(c,r,a,t);else if(n){let l=t?.token_endpoint_auth_methods_supported??[],d=Ix(n,l);Ax(d,n,c,r)}let u=await ft(i??fetch)(a,{method:\"POST\",headers:c,body:r});if(!u.ok)throw await Qg(u);return Dx.parse(await u.json())}async function Gx(e,{metadata:t,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:\"refresh_token\",refresh_token:n}),c=await o_(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:n,...c}}async function Xx(e,t,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let i=async()=>{let l=await e.clientInformation(),d=Hc(l,String(t));if(l&&!d)throw e_(l,String(t));return d},a=await i(),c=e.clientMetadata.scope,u;if(e.prepareTokenRequest&&(u=await e.prepareTokenRequest(c)),!u){if(!o)throw new Error(\"Either provider.prepareTokenRequest() or authorizationCode is required\");if(!e.redirectUrl)throw new Error(\"redirectUrl is required for authorization_code flow\");let l=await e.codeVerifier();u=Wx(o,l,e.redirectUrl)}return a??(a=await i()),o_(t,{metadata:r,tokenRequestParams:u,clientInformation:a,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:s})}async function Yx(e,{metadata:t,clientMetadata:r,scope:n,fetchFn:o}){let s;if(t){if(!t.registration_endpoint)throw new Error(\"Incompatible auth server: does not support dynamic client registration\");s=new URL(t.registration_endpoint)}else s=new URL(\"/register\",e);let i=await ft(o??fetch)(s,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await Qg(i);return qx.parse(await i.json())}function oi(e){return!!e._zod}function it(e,t){return oi(e)?Ea(e,t):e.safeParse(t)}function si(e){if(!e)return;let t;if(oi(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t==\"function\")try{return t()}catch{return}return t}}function ii(e){if(oi(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}function Ht(e){return e===\"completed\"||e===\"failed\"||e===\"cancelled\"}var I1=new Set(\"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789\");function Kc(e){let r=si(e)?.method;if(!r)throw new Error(\"Schema is missing a method literal\");let n=ii(r);if(typeof n!=\"string\")throw new Error(\"Schema method literal must be a string\");return n}function Bc(e,t){let r=it(e,t);if(!r.success)throw r.error;return r.data}var sz=6e4,ai=class{constructor(t){this._options=t,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(Ks,r=>{this._oncancel(r)}),this.setNotificationHandler(Ws,r=>{this._onprogress(r)}),this.setRequestHandler(Bs,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Gs,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new E(C.InvalidParams,\"Failed to retrieve task: Task not found\");return{...o}}),this.setRequestHandler(Ys,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(!await this._taskStore.getTask(s,n.sessionId))throw new E(C.InvalidParams,`Task not found: ${s}`);if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type===\"response\"||a.type===\"error\"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type===\"response\")l(c);else{let d=c,m=new E(d.error.code,d.error.message,d.error.data);l(m)}else{let d=a.type===\"response\"?\"Response\":\"Error\";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new E(C.InvalidParams,`Task not found: ${s}`);if(!Ht(i.status))return await this._waitForTaskUpdate(s,n.signal,n.sessionId),await o();if(Ht(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s,n.sessionId),{...a,_meta:{...a._meta,[Vt]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(Qs,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new E(C.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(ti,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new E(C.InvalidParams,`Task not found: ${r.params.taskId}`);if(Ht(o.status))throw new E(C.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,\"cancelled\",\"Client cancelled task execution.\",n.sessionId),this._clearTaskQueue(r.params.taskId,n.sessionId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new E(C.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof E?o:new E(C.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),E.fromError(C.RequestTimeout,\"Maximum total timeout exceeded\",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error(\"Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.\");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),sr(s)||Tg(s)?this._onresponse(s):Vn(s)?this._onrequest(s,i):Eg(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=E.fromError(C.ConnectionClosed,\"Connection closed\");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,s=t.params?._meta?.[Vt]?.taskId,i=o?.sessionId,a=this._taskStore,c=!0,u;if(s&&a&&this._taskMessageQueue&&i!==void 0&&(c=!1,u=(async()=>{if(!await a.getTask(s,i))throw new E(C.InvalidParams,`Task not found: ${s}`);c=!0})()),n===void 0){let f={jsonrpc:\"2.0\",id:t.id,error:{code:C.MethodNotFound,message:\"Method not found\"}};if(s&&u){let g={type:\"error\",message:f,timestamp:Date.now()};u.then(()=>this._enqueueTaskMessage(s,g,i),()=>o?.send(f)).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)))}else s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:\"error\",message:f,timestamp:Date.now()},o?.sessionId).catch(g=>this._onerror(new Error(`Failed to enqueue error response: ${g}`))):o?.send(f).catch(g=>this._onerror(new Error(`Failed to send an error response: ${g}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(t.id,l);let d=Sg(t.params)?t.params.task:void 0,m=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,p={signal:l.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async f=>{if(l.signal.aborted)return;let g={relatedRequestId:t.id};s&&(g.relatedTask={taskId:s}),await this.notification(f,g)},sendRequest:async(f,g,h)=>{if(l.signal.aborted)throw new E(C.ConnectionClosed,\"Request was cancelled\");let y={...h,relatedRequestId:t.id};s&&!y.relatedTask&&(y.relatedTask={taskId:s});let x=y.relatedTask?.taskId??s;return x&&m&&await m.updateTaskStatus(x,\"input_required\"),await this.request(f,g,y)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:m,taskRequestedTtl:d?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};(u??Promise.resolve()).then(()=>{if(u&&l.signal.aborted)throw new E(C.ConnectionClosed,\"Request was cancelled\");d&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,p)).then(async f=>{if(l.signal.aborted)return;let g={result:f,jsonrpc:\"2.0\",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:\"response\",message:g,timestamp:Date.now()},o?.sessionId):await o?.send(g)},async f=>{if(l.signal.aborted)return;let g={jsonrpc:\"2.0\",id:t.id,error:{code:Number.isSafeInteger(f.code)?f.code:C.InternalError,message:f.message??\"Internal error\",...f.data!==void 0&&{data:f.data}}};s&&this._taskMessageQueue&&c?await this._enqueueTaskMessage(s,{type:\"error\",message:g,timestamp:Date.now()},o?.sessionId):await o?.send(g)}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===l&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),sr(t))n(t);else{let i=new E(t.error.code,t.error.message,t.error.data);n(i)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(sr(t)&&t.result&&typeof t.result==\"object\"){let i=t.result;if(i.task&&typeof i.task==\"object\"){let a=i.task;typeof a.taskId==\"string\"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),sr(t))o(t);else{let i=E.fromError(t.error.code,t.error.message,t.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:\"result\",result:await this.request(t,r,n)}}catch(i){yield{type:\"error\",error:i instanceof E?i:new E(C.InternalError,String(i))}}return}let s;try{let i=await this.request(t,ar,n);if(i.task)s=i.task.taskId,yield{type:\"taskCreated\",task:i.task};else throw new E(C.InternalError,\"Task creation did not return a task\");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:\"taskStatus\",task:a},Ht(a.status)){a.status===\"completed\"?yield{type:\"result\",result:await this.getTaskResult({taskId:s},r,n)}:a.status===\"failed\"?yield{type:\"error\",error:new E(C.InternalError,`Task ${s} failed`)}:a.status===\"cancelled\"&&(yield{type:\"error\",error:new E(C.InternalError,`Task ${s} was cancelled`)});return}if(a.status===\"input_required\"){yield{type:\"result\",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:\"error\",error:i instanceof E?i:new E(C.InternalError,String(i))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=x=>{l(x)};if(!this._transport){d(new Error(\"Not connected\"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(x){d(x);return}n?.signal?.throwIfAborted();let m=this._requestMessageId++,p={...t,jsonrpc:\"2.0\",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),a&&(p.params={...p.params,task:a}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[Vt]:c}});let f=x=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:\"2.0\",method:\"notifications/cancelled\",params:{requestId:m,reason:String(x)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(M=>this._onerror(new Error(`Failed to send cancellation: ${M}`)));let S=x instanceof E?x:new E(C.RequestTimeout,String(x));l(S)};this._responseHandlers.set(m,x=>{if(!n?.signal?.aborted){if(x instanceof Error)return l(x);try{let S=it(r,x.result);S.success?u(S.data):l(S.error)}catch(S){l(S)}}}),n?.signal?.addEventListener(\"abort\",()=>{f(n?.signal?.reason)});let g=n?.timeout??sz,h=()=>f(E.fromError(C.RequestTimeout,\"Request timed out\",{timeout:g}));this._setupTimeout(m,g,n?.maxTotalTimeout,h,n?.resetTimeoutOnProgress??!1);let y=c?.taskId;if(y){let x=S=>{let M=this._responseHandlers.get(m);M?M(S):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,x),this._enqueueTaskMessage(y,{type:\"request\",message:p,timestamp:Date.now()}).catch(S=>{this._cleanupTimeout(m),l(S)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(x=>{this._cleanupTimeout(m),l(x)})})}async getTask(t,r){return this.request({method:\"tasks/get\",params:t},Xs,r)}async getTaskResult(t,r,n){return this.request({method:\"tasks/result\",params:t},r,n)}async listTasks(t,r){return this.request({method:\"tasks/list\",params:t},ei,r)}async cancelTask(t,r){return this.request({method:\"tasks/cancel\",params:t},Ig,r)}async notification(t,r){if(!this._transport)throw new Error(\"Not connected\");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:\"2.0\",params:{...t.params,_meta:{...t.params?._meta||{},[Vt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:\"notification\",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:\"2.0\"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Vt]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...t,jsonrpc:\"2.0\"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Vt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let n=Kc(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=Bc(t,o);return Promise.resolve(r(i,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Kc(t);this._notificationHandlers.set(n,o=>{let s=Bc(t,o);return Promise.resolve(r(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error(\"Cannot enqueue task message: taskStore and taskMessageQueue are not configured\");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n??this._transport?.sessionId,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type===\"request\"&&Vn(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new E(C.InternalError,\"Task cancelled or completed\")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r,n){let o=this._options?.defaultTaskPollInterval??1e3;try{let s=await this._taskStore?.getTask(t,n);s?.pollInterval&&(o=s.pollInterval)}catch{}return new Promise((s,i)=>{if(r.aborted){i(new E(C.InvalidRequest,\"Request cancelled\"));return}let a=setTimeout(s,o);r.addEventListener(\"abort\",()=>{clearTimeout(a),i(new E(C.InvalidRequest,\"Request cancelled\"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error(\"No task store configured\");return{createTask:async o=>{if(!t)throw new Error(\"No request provided\");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new E(C.InvalidParams,\"Failed to retrieve task: Task not found\");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=Wn.parse({method:\"notifications/tasks/status\",params:a});await this.notification(c),Ht(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new E(C.InvalidParams,`Task \"${o}\" not found - it may have been cleaned up`);if(Ht(a.status))throw new E(C.InvalidParams,`Cannot update task \"${o}\" from terminal status \"${a.status}\" to \"${s}\". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=Wn.parse({method:\"notifications/tasks/status\",params:c});await this.notification(u),Ht(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function s_(e){return e!==null&&typeof e==\"object\"&&!Array.isArray(e)}function i_(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];s_(i)&&s_(s)?r[o]={...i,...s}:r[o]=s}return r}var sw=ta(ql(),1),iw=ta(ow(),1);function gO(){let e=new sw.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,iw.default)(e),e}var Vi=class{constructor(t){this._ajv=t??gO()}getValidator(t){let r=\"$id\"in t&&typeof t.$id==\"string\"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Hi=class{constructor(t){this._client=t}async*callToolStream(t,r=Br,n){let o=this._client,s={...n,task:n?.task??(o.isToolTask(t.name)?{}:void 0)},i=o.requestStream({method:\"tools/call\",params:t},r,s),a=o.getToolOutputValidator(t.name);for await(let c of i){if(c.type===\"result\"&&a){let u=c.result;if(!u.structuredContent&&!u.isError){yield{type:\"error\",error:new E(C.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let l=a(u.structuredContent);if(!l.valid){yield{type:\"error\",error:new E(C.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof E){yield{type:\"error\",error:l};return}yield{type:\"error\",error:new E(C.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield c}}async getTask(t,r){return this._client.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._client.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._client.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._client.cancelTask({taskId:t},r)}requestStream(t,r,n){return this._client.requestStream(t,r,n)}};function aw(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case\"tools/call\":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function cw(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case\"sampling/createMessage\":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case\"elicitation/create\":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}function Ji(e,t){if(!(!e||t===null||typeof t!=\"object\")){if(e.type===\"object\"&&e.properties&&typeof e.properties==\"object\"){let r=t,n=e.properties;for(let o of Object.keys(n)){let s=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(s,\"default\")&&(r[o]=s.default),r[o]!==void 0&&Ji(s,r[o])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!=\"boolean\"&&Ji(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!=\"boolean\"&&Ji(r,t)}}function _O(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}var Ki=class extends ai{constructor(t,r){super(r),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new Vi,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler(\"tools\",Xn,t.tools,async()=>(await this.listTools()).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler(\"prompts\",Nc,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler(\"resources\",Ec,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Hi(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error(\"Cannot register capabilities after connecting to transport\");this._capabilities=i_(this._capabilities,t)}setRequestHandler(t,r){let o=si(t)?.method;if(!o)throw new Error(\"Schema is missing a method literal\");let s=ii(o);if(typeof s!=\"string\")throw new Error(\"Schema method literal must be a string\");let i=s;if(i===\"elicitation/create\"){let a=async(c,u)=>{let l=it(Yn,c);if(!l.success){let x=l.error instanceof Error?l.error.message:String(l.error);throw new E(C.InvalidParams,`Invalid elicitation request: ${x}`)}let{params:d}=l.data;d.mode=d.mode??\"form\";let{supportsFormMode:m,supportsUrlMode:p}=_O(this._capabilities.elicitation);if(d.mode===\"form\"&&!m)throw new E(C.InvalidParams,\"Client does not support form-mode elicitation requests\");if(d.mode===\"url\"&&!p)throw new E(C.InvalidParams,\"Client does not support URL-mode elicitation requests\");let f=await Promise.resolve(r(c,u));if(d.task){let x=it(ar,f);if(!x.success){let S=x.error instanceof Error?x.error.message:String(x.error);throw new E(C.InvalidParams,`Invalid task creation result: ${S}`)}return x.data}let g=it(Qn,f);if(!g.success){let x=g.error instanceof Error?g.error.message:String(g.error);throw new E(C.InvalidParams,`Invalid elicitation result: ${x}`)}let h=g.data,y=d.mode===\"form\"?d.requestedSchema:void 0;if(d.mode===\"form\"&&h.action===\"accept\"&&h.content&&y&&this._capabilities.elicitation?.form?.applyDefaults)try{Ji(y,h.content)}catch{}return h};return super.setRequestHandler(t,a)}if(i===\"sampling/createMessage\"){let a=async(c,u)=>{let l=it(Mc,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new E(C.InvalidParams,`Invalid sampling request: ${h}`)}let{params:d}=l.data,m=await Promise.resolve(r(c,u));if(d.task){let h=it(ar,m);if(!h.success){let y=h.error instanceof Error?h.error.message:String(h.error);throw new E(C.InvalidParams,`Invalid task creation result: ${y}`)}return h.data}let f=d.tools||d.toolChoice?Zc:jc,g=it(f,m);if(!g.success){let h=g.error instanceof Error?g.error.message:String(g.error);throw new E(C.InvalidParams,`Invalid sampling result: ${h}`)}return g.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapability(t,r){if(!this._serverCapabilities?.[t])throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(await super.connect(t),t.sessionId===void 0)try{let n=await this.request({method:\"initialize\",params:{protocolVersion:Vr,capabilities:this._capabilities,clientInfo:this._clientInfo}},$c,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!$g.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:\"notifications/initialized\"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){switch(t){case\"logging/setLevel\":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case\"prompts/get\":case\"prompts/list\":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case\"resources/list\":case\"resources/templates/list\":case\"resources/read\":case\"resources/subscribe\":case\"resources/unsubscribe\":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${t})`);if(t===\"resources/subscribe\"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case\"tools/call\":case\"tools/list\":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case\"completion/complete\":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case\"initialize\":break;case\"ping\":break}}assertNotificationCapability(t){switch(t){case\"notifications/roots/list_changed\":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break;case\"notifications/initialized\":break;case\"notifications/cancelled\":break;case\"notifications/progress\":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case\"sampling/createMessage\":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case\"elicitation/create\":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${t})`);break;case\"roots/list\":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case\"tasks/get\":case\"tasks/list\":case\"tasks/result\":case\"tasks/cancel\":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${t})`);break;case\"ping\":break}}assertTaskCapability(t){aw(this._serverCapabilities?.tasks?.requests,t,\"Server\")}assertTaskHandlerCapability(t){this._capabilities&&cw(this._capabilities.tasks?.requests,t,\"Client\")}async ping(t){return this.request({method:\"ping\"},ir,t)}async complete(t,r){return this.request({method:\"completion/complete\",params:t},Dc,r)}async setLoggingLevel(t,r){return this.request({method:\"logging/setLevel\",params:{level:t}},ir,r)}async getPrompt(t,r){return this.request({method:\"prompts/get\",params:t},Ac,r)}async listPrompts(t,r){return this.request({method:\"prompts/list\",params:t},Tc,r)}async listResources(t,r){return this.request({method:\"resources/list\",params:t},zc,r)}async listResourceTemplates(t,r){return this.request({method:\"resources/templates/list\",params:t},Sc,r)}async readResource(t,r){return this.request({method:\"resources/read\",params:t},Pc,r)}async subscribeResource(t,r){return this.request({method:\"resources/subscribe\",params:t},ir,r)}async unsubscribeResource(t,r){return this.request({method:\"resources/unsubscribe\",params:t},ir,r)}async callTool(t,r=Br,n){if(this.isToolTaskRequired(t.name))throw new E(C.InvalidRequest,`Tool \"${t.name}\" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:\"tools/call\",params:t},r,n),s=this.getToolOutputValidator(t.name);if(s){if(!o.structuredContent&&!o.isError)throw new E(C.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let i=s(o.structuredContent);if(!i.valid)throw new E(C.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof E?i:new E(C.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return o}isToolTask(t){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of t){if(r.outputSchema){let o=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,o)}let n=r.execution?.taskSupport;(n===\"required\"||n===\"optional\")&&this._cachedKnownTaskTools.add(r.name),n===\"required\"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){let n=await this.request({method:\"tools/list\",params:t},Kr,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(t,r,n,o){let s=Dg.safeParse(n);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof n.onChanged!=\"function\")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:a}=s.data,{onChanged:c}=n,u=async()=>{if(!i){c(null,null);return}try{let d=await o();c(null,d)}catch(d){let m=d instanceof Error?d:new Error(String(d));c(m,null)}},l=()=>{if(a){let d=this._listChangedDebounceTimers.get(t);d&&clearTimeout(d);let m=setTimeout(u,a);this._listChangedDebounceTimers.set(t,m)}else u()};this.setNotificationHandler(r,l)}async sendRootsListChanged(){return this.notification({method:\"notifications/roots/list_changed\"})}};var Vo=class extends Error{constructor(t,r){super(t),this.name=\"ParseError\",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}},uw=10,yO=13,zr=32;function Bl(e){}function Bi(e){if(typeof e==\"function\")throw new TypeError(\"`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?\");let{onEvent:t=Bl,onError:r=Bl,onRetry:n=Bl,onComment:o,maxBufferSize:s}=e,i=[],a=0,c=!0,u,l=\"\",d=0,m,p=!1;function f(b){if(p)throw new Error(\"Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.\");if(c&&(c=!1,b.charCodeAt(0)===239&&b.charCodeAt(1)===187&&b.charCodeAt(2)===191&&(b=b.slice(3))),i.length===0){let Q=h(b);Q!==\"\"&&(i.push(Q),a=Q.length),g();return}if(b.indexOf(`\n`)===-1&&b.indexOf(\"\\r\")===-1){i.push(b),a+=b.length,g();return}i.push(b);let $=i.join(\"\");i.length=0,a=0;let I=h($);I!==\"\"&&(i.push(I),a=I.length),g()}function g(){s!==void 0&&(a+l.length<=s||(p=!0,i.length=0,a=0,u=void 0,l=\"\",d=0,m=void 0,r(new Vo(`Buffered data exceeded max buffer size of ${s} characters`,{type:\"max-buffer-size-exceeded\"}))))}function h(b){let $=0;if(b.indexOf(\"\\r\")===-1){let I=b.indexOf(`\n`,$);for(;I!==-1;){if($===I){d>0&&t({id:u,event:m,data:l}),u=void 0,l=\"\",d=0,m=void 0,$=I+1,I=b.indexOf(`\n`,$);continue}let Q=b.charCodeAt($);if(lw(b,$,Q)){let q=b.charCodeAt($+5)===zr?$+6:$+5,ce=b.slice(q,I);if(d===0&&b.charCodeAt(I+1)===uw){t({id:u,event:m,data:ce}),u=void 0,l=\"\",m=void 0,$=I+2,I=b.indexOf(`\n`,$);continue}l=d===0?ce:`${l}\n${ce}`,d++}else dw(b,$,Q)?m=b.slice(b.charCodeAt($+6)===zr?$+7:$+6,I)||void 0:y(b,$,I);$=I+1,I=b.indexOf(`\n`,$)}return b.slice($)}for(;$<b.length;){let I=b.indexOf(\"\\r\",$),Q=b.indexOf(`\n`,$),q=-1;if(I!==-1&&Q!==-1?q=I<Q?I:Q:I!==-1?I===b.length-1?q=-1:q=I:Q!==-1&&(q=Q),q===-1)break;y(b,$,q),$=q+1,b.charCodeAt($-1)===yO&&b.charCodeAt($)===uw&&$++}return b.slice($)}function y(b,$,I){if($===I){S();return}let Q=b.charCodeAt($);if(lw(b,$,Q)){let Nt=b.charCodeAt($+5)===zr?$+6:$+5,ud=b.slice(Nt,I);l=d===0?ud:`${l}\n${ud}`,d++;return}if(dw(b,$,Q)){m=b.slice(b.charCodeAt($+6)===zr?$+7:$+6,I)||void 0;return}if(Q===105&&b.charCodeAt($+1)===100&&b.charCodeAt($+2)===58){let Nt=b.slice(b.charCodeAt($+3)===zr?$+4:$+3,I);Nt.includes(\"\\0\")||(u=Nt);return}if(Q===58){if(o){let Nt=b.slice($,I);o(Nt.slice(b.charCodeAt($+1)===zr?2:1))}return}let q=b.slice($,I),ce=q.indexOf(\":\");if(ce===-1){x(q,\"\",q);return}let wt=q.slice(0,ce),tr=q.charCodeAt(ce+1)===zr?2:1,Pr=q.slice(ce+tr);x(wt,Pr,q)}function x(b,$,I){switch(b){case\"event\":m=$||void 0;break;case\"data\":l=d===0?$:`${l}\n${$}`,d++;break;case\"id\":$.includes(\"\\0\")||(u=$);break;case\"retry\":/^\\d+$/.test($)?n(parseInt($,10)):r(new Vo(`Invalid \\`retry\\` value: \"${$}\"`,{type:\"invalid-retry\",value:$,line:I}));break;default:r(new Vo(`Unknown field \"${b.length>20?`${b.slice(0,20)}\\u2026`:b}\"`,{type:\"unknown-field\",field:b,value:$,line:I}));break}}function S(){d>0&&t({id:u,event:m,data:l}),u=void 0,l=\"\",d=0,m=void 0}function M(b={}){if(b.consume&&i.length>0){let $=i.join(\"\");y($,0,$.length)}c=!0,u=void 0,l=\"\",d=0,m=void 0,i.length=0,a=0,p=!1}return{feed:f,reset:M}}function lw(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function dw(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var Gi=class extends Event{constructor(t,r){var n,o;super(t),this.code=(n=r?.code)!=null?n:void 0,this.message=(o=r?.message)!=null?o:void 0}[Symbol.for(\"nodejs.util.inspect.custom\")](t,r,n){return n(pw(this),r)}[Symbol.for(\"Deno.customInspect\")](t,r){return t(pw(this),r)}};function vO(e){let t=globalThis.DOMException;return typeof t==\"function\"?new t(e,\"SyntaxError\"):new SyntaxError(e)}function Wl(e){return e instanceof Error?\"errors\"in e&&Array.isArray(e.errors)?e.errors.map(Wl).join(\", \"):\"cause\"in e&&e.cause instanceof Error?`${e}: ${Wl(e.cause)}`:e.message:`${e}`}function pw(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var mw=e=>{throw TypeError(e)},nd=(e,t,r)=>t.has(e)||mw(\"Cannot \"+r),L=(e,t,r)=>(nd(e,t,\"read from private field\"),r?r.call(e):t.get(e)),ye=(e,t,r)=>t.has(e)?mw(\"Cannot add the same private member more than once\"):t instanceof WeakSet?t.add(e):t.set(e,r),de=(e,t,r,n)=>(nd(e,t,\"write to private field\"),t.set(e,r),r),At=(e,t,r)=>(nd(e,t,\"access private method\"),r),Ve,Sr,_n,Wi,Xi,Ko,wn,Bo,er,yn,bn,vn,Ho,pt,Gl,Xl,Yl,fw,Ql,ed,Jo,td,rd,kr=class extends EventTarget{constructor(t,r){var n,o;super(),ye(this,pt),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,ye(this,Ve),ye(this,Sr),ye(this,_n),ye(this,Wi),ye(this,Xi),ye(this,Ko),ye(this,wn),ye(this,Bo,null),ye(this,er),ye(this,yn),ye(this,bn,null),ye(this,vn,null),ye(this,Ho,null),ye(this,Xl,async s=>{var i;L(this,yn).reset();let{body:a,redirected:c,status:u,headers:l}=s;if(u===204){At(this,pt,Jo).call(this,\"Server sent HTTP 204, not reconnecting\",204),this.close();return}if(c?de(this,_n,new URL(s.url)):de(this,_n,void 0),u!==200){At(this,pt,Jo).call(this,`Non-200 status code (${u})`,u);return}if(!(l.get(\"content-type\")||\"\").startsWith(\"text/event-stream\")){At(this,pt,Jo).call(this,'Invalid content type, expected \"text/event-stream\"',u);return}if(L(this,Ve)===this.CLOSED)return;de(this,Ve,this.OPEN);let d=new Event(\"open\");if((i=L(this,Ho))==null||i.call(this,d),this.dispatchEvent(d),typeof a!=\"object\"||!a||!(\"getReader\"in a)){At(this,pt,Jo).call(this,\"Invalid response body, expected a web ReadableStream\",u),this.close();return}let m=new TextDecoder,p=a.getReader(),f=!0;do{let{done:g,value:h}=await p.read();h&&L(this,yn).feed(m.decode(h,{stream:!g})),g&&(f=!1,L(this,yn).reset(),At(this,pt,td).call(this))}while(f)}),ye(this,Yl,s=>{de(this,er,void 0),!(s.name===\"AbortError\"||s.type===\"aborted\")&&At(this,pt,td).call(this,Wl(s))}),ye(this,Ql,s=>{typeof s.id==\"string\"&&de(this,Bo,s.id);let i=new MessageEvent(s.event||\"message\",{data:s.data,origin:L(this,_n)?L(this,_n).origin:L(this,Sr).origin,lastEventId:s.id||\"\"});L(this,vn)&&(!s.event||s.event===\"message\")&&L(this,vn).call(this,i),this.dispatchEvent(i)}),ye(this,ed,s=>{de(this,Ko,s)}),ye(this,rd,()=>{de(this,wn,void 0),L(this,Ve)===this.CONNECTING&&At(this,pt,Gl).call(this)});try{if(t instanceof URL)de(this,Sr,t);else if(typeof t==\"string\")de(this,Sr,new URL(t,wO()));else throw new Error(\"Invalid URL\")}catch{throw vO(\"An invalid or illegal string was specified\")}de(this,yn,Bi({onEvent:L(this,Ql),onRetry:L(this,ed)})),de(this,Ve,this.CONNECTING),de(this,Ko,3e3),de(this,Xi,(n=r?.fetch)!=null?n:globalThis.fetch),de(this,Wi,(o=r?.withCredentials)!=null?o:!1),At(this,pt,Gl).call(this)}get readyState(){return L(this,Ve)}get url(){return L(this,Sr).href}get withCredentials(){return L(this,Wi)}get onerror(){return L(this,bn)}set onerror(t){de(this,bn,t)}get onmessage(){return L(this,vn)}set onmessage(t){de(this,vn,t)}get onopen(){return L(this,Ho)}set onopen(t){de(this,Ho,t)}addEventListener(t,r,n){let o=r;super.addEventListener(t,o,n)}removeEventListener(t,r,n){let o=r;super.removeEventListener(t,o,n)}close(){L(this,wn)&&clearTimeout(L(this,wn)),L(this,Ve)!==this.CLOSED&&(L(this,er)&&L(this,er).abort(),de(this,Ve,this.CLOSED),de(this,er,void 0))}};Ve=new WeakMap,Sr=new WeakMap,_n=new WeakMap,Wi=new WeakMap,Xi=new WeakMap,Ko=new WeakMap,wn=new WeakMap,Bo=new WeakMap,er=new WeakMap,yn=new WeakMap,bn=new WeakMap,vn=new WeakMap,Ho=new WeakMap,pt=new WeakSet,Gl=function(){de(this,Ve,this.CONNECTING),de(this,er,new AbortController),L(this,Xi)(L(this,Sr),At(this,pt,fw).call(this)).then(L(this,Xl)).catch(L(this,Yl))},Xl=new WeakMap,Yl=new WeakMap,fw=function(){var e;let t={mode:\"cors\",redirect:\"follow\",headers:{Accept:\"text/event-stream\",...L(this,Bo)?{\"Last-Event-ID\":L(this,Bo)}:void 0},cache:\"no-store\",signal:(e=L(this,er))==null?void 0:e.signal};return\"window\"in globalThis&&(t.credentials=this.withCredentials?\"include\":\"same-origin\"),t},Ql=new WeakMap,ed=new WeakMap,Jo=function(e,t){var r;L(this,Ve)!==this.CLOSED&&de(this,Ve,this.CLOSED);let n=new Gi(\"error\",{code:t,message:e});(r=L(this,bn))==null||r.call(this,n),this.dispatchEvent(n)},td=function(e,t){var r;if(L(this,Ve)===this.CLOSED)return;de(this,Ve,this.CONNECTING);let n=new Gi(\"error\",{code:t,message:e});(r=L(this,bn))==null||r.call(this,n),this.dispatchEvent(n),de(this,wn,setTimeout(L(this,rd),L(this,Ko)))},rd=new WeakMap,kr.CONNECTING=0,kr.OPEN=1,kr.CLOSED=2;function wO(){let e=\"document\"in globalThis?globalThis.document:void 0;return e&&typeof e==\"object\"&&\"baseURI\"in e&&typeof e.baseURI==\"string\"?e.baseURI:void 0}var Wo=class extends Error{constructor(t,r,n){super(`SSE error: ${r}`),this.code=t,this.event=n}},Yi=class{constructor(t,r){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=ri(r?.fetch,r?.requestInit),this._followRedirects=r?.redirectPolicy===\"follow\",this._followRedirects&&(this._fetch=Gr(this._fetch),this._fetchWithInit=Gr(this._fetchWithInit))}_unfollowedRedirect(t,r){let n=Xr(t,r);return n&&!this._followRedirects?`${n} (redirectPolicy: 'same-origin')`:n}async _authThenStart(){if(!this._authProvider)throw new ze(\"No auth provider\");let t;try{t=await Et(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(t!==\"AUTHORIZED\")throw new ze;return await this._startOrAuth()}async _commonHeaders(){let t={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(t.Authorization=`Bearer ${n.access_token}`)}this._protocolVersion&&(t[\"mcp-protocol-version\"]=this._protocolVersion);let r=Wr(this._requestInit?.headers);return new Headers({...t,...r})}_startOrAuth(){let t=this?._eventSourceInit?.fetch??this._fetch??fetch,r=this._followRedirects?t:ft(t),n;return new Promise((o,s)=>{this._eventSource=new kr(this._url.href,{...this._eventSourceInit,fetch:async(i,a)=>{let c=await this._commonHeaders();c.set(\"Accept\",\"text/event-stream\");let u=await r(i,{...a,headers:c});if(n=this._unfollowedRedirect(u,i),u.status===401&&u.headers.has(\"www-authenticate\")){let{resourceMetadataUrl:l,scope:d}=Yr(u);this._resourceMetadataUrl=l,this._scope=d}return u}}),this._abortController=new AbortController,this._eventSource.onerror=i=>{if(i.code===401&&this._authProvider){this._authThenStart().then(o,s);return}let a=new Wo(i.code,n??i.message,i);s(a),this.onerror?.(a)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener(\"endpoint\",i=>{let a=i;try{if(this._endpoint=new URL(a.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(c){s(c),this.onerror?.(c),this.close();return}o()}),this._eventSource.onmessage=i=>{let a=i,c;try{c=Hr.parse(JSON.parse(a.data))}catch(u){this.onerror?.(u);return}this.onmessage?.(c)}})}async start(){if(this._eventSource)throw new Error(\"SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.\");return await this._startOrAuth()}async finishAuth(t){if(!this._authProvider)throw new ze(\"No auth provider\");if(await Et(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==\"AUTHORIZED\")throw new ze(\"Failed to authorize\")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(t){if(!this._endpoint)throw new Error(\"Not connected\");try{let r=await this._commonHeaders();r.set(\"content-type\",\"application/json\");let n={...this._requestInit,method:\"POST\",headers:r,body:JSON.stringify(t),signal:this._abortController?.signal},o=await ft(this._fetch??fetch)(this._endpoint,n);if(!o.ok){let s=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){let{resourceMetadataUrl:i,scope:a}=Yr(o);if(this._resourceMetadataUrl=i,this._scope=a,await Et(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==\"AUTHORIZED\")throw new ze;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${this._unfollowedRedirect(o,this._endpoint)??s}`)}await o.body?.cancel()}catch(r){throw this.onerror?.(r),r}}setProtocolVersion(t){this._protocolVersion=t}};var vw=ta(yw(),1);function ww(e){if(e)try{return vw.default.parse(e).type}catch{let t=(e.split(\";\",1)[0]??\"\").trim().toLowerCase();return t===\"\"||e.slice(t.length).includes(\",\")?void 0:t}}var Qi=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:n,maxBufferSize:o}={}){let s;super({start(i){s=Bi({onEvent:a=>{i.enqueue(a)},onError(a){typeof t==\"function\"&&t(a),(t===\"terminate\"||a.type===\"max-buffer-size-exceeded\")&&i.error(a)},onRetry:r,onComment:n,maxBufferSize:o})},transform(i){s.feed(i)}})}};var TO={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},vt=class extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}},Go=class{constructor(t,r){this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=ri(r?.fetch,r?.requestInit),this._followRedirects=r?.redirectPolicy===\"follow\",this._followRedirects&&(this._fetch=Gr(this._fetch),this._fetchWithInit=Gr(this._fetchWithInit)),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??TO}_unfollowedRedirect(t,r){let n=Xr(t,r);return n&&!this._followRedirects?`${n} (redirectPolicy: 'same-origin')`:n}async _authThenStart(){if(!this._authProvider)throw new ze(\"No auth provider\");let t;try{t=await Et(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(t!==\"AUTHORIZED\")throw new ze;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let t={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(t.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(t[\"mcp-session-id\"]=this._sessionId),this._protocolVersion&&(t[\"mcp-protocol-version\"]=this._protocolVersion);let r=Wr(this._requestInit?.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){let{resumptionToken:r}=t;try{let n=await this._commonHeaders();n.set(\"Accept\",\"text/event-stream\"),r&&n.set(\"last-event-id\",r);let o=this._fetch??fetch,s={method:\"GET\",headers:n,signal:this._abortController?.signal},i=await o(this._url,this._followRedirects?s:{...s,redirect:\"manual\"}),a=this._followRedirects?void 0:ni(o,this._url,s,i);if(a&&(i=await a),!i.ok){if(await i.body?.cancel(),i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new vt(i.status,`Failed to open SSE stream: ${this._unfollowedRedirect(i,this._url)??i.statusText}`)}this._handleSseStream(i.body,t,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,t),o)}_scheduleReconnection(t,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(s=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(t,r+1)})},o)}_handleSseStream(t,r,n){if(!t)return;let{onresumptiontoken:o,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let l=t.pipeThrough(new TextDecoderStream).pipeThrough(new Qi({onRetry:p=>{this._serverRetryMs=p}})).getReader();for(;;){let{value:p,done:f}=await l.read();if(f)break;if(p.id&&(i=p.id,a=!0,o?.(p.id)),!!p.data&&(!p.event||p.event===\"message\"))try{let g=Hr.parse(JSON.parse(p.data));sr(g)&&(c=!0,s!==void 0&&(g.id=s)),this.onmessage?.(g)}catch(g){this.onerror?.(g)}}(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(p){this.onerror?.(new Error(`Failed to reconnect: ${p instanceof Error?p.message:String(p)}`))}}})()}async start(){if(this._abortController)throw new Error(\"StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.\");this._abortController=new AbortController}async finishAuth(t){if(!this._authProvider)throw new ze(\"No auth provider\");if(await Et(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==\"AUTHORIZED\")throw new ze(\"Failed to authorize\")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(t,r){try{let{resumptionToken:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:Vn(t)?t.id:void 0}).catch(p=>this.onerror?.(p));return}let s=await this._commonHeaders();s.set(\"content-type\",\"application/json\"),s.set(\"accept\",\"application/json, text/event-stream\");let i={...this._requestInit,method:\"POST\",headers:s,body:JSON.stringify(t),signal:this._abortController?.signal},a=await ft(this._fetch??fetch)(this._url,i),c=a.headers.get(\"mcp-session-id\");if(c&&(this._sessionId=c),!a.ok){let p=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new vt(401,\"Server returned 401 after successful authentication\");let{resourceMetadataUrl:f,scope:g}=Yr(a);if(this._resourceMetadataUrl=f,this._scope=g,await Et(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==\"AUTHORIZED\")throw new ze;return this._hasCompletedAuthFlow=!0,this.send(t)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:f,scope:g,error:h}=Yr(a);if(h===\"insufficient_scope\"){let y=a.headers.get(\"WWW-Authenticate\");if(this._lastUpscopingHeader===y)throw new vt(403,\"Server returned 403 after trying upscoping\");if(g&&(this._scope=g),f&&(this._resourceMetadataUrl=f),this._lastUpscopingHeader=y??void 0,await Et(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!==\"AUTHORIZED\")throw new ze;return this.send(t)}}throw new vt(a.status,`Error POSTing to endpoint: ${this._unfollowedRedirect(a,this._url)??p}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),Cg(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(p=>this.onerror?.(p));return}let l=(Array.isArray(t)?t:[t]).filter(p=>\"method\"in p&&\"id\"in p&&p.id!==void 0).length>0,d=a.headers.get(\"content-type\"),m=ww(d);if(l)if(m===\"text/event-stream\")this._handleSseStream(a.body,{onresumptiontoken:o},!1);else if(m===\"application/json\"){let p=await a.json(),f=Array.isArray(p)?p.map(g=>Hr.parse(g)):[Hr.parse(p)];for(let g of f)this.onmessage?.(g)}else throw await a.body?.cancel(),new vt(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let t=await this._commonHeaders(),r={...this._requestInit,method:\"DELETE\",headers:t,signal:this._abortController?.signal},n=await ft(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new vt(n.status,`Failed to terminate session: ${this._unfollowedRedirect(n,this._url)??n.statusText}`);this._sessionId=void 0}catch(t){throw this.onerror?.(t),t}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,r){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:r?.onresumptiontoken})}};var sd={content:{type:\"array\",items:{type:\"object\"}},structuredContent:{type:\"object\"},isError:{type:\"boolean\"},_meta:{type:\"object\"}},OO=/^#\\/(?:\\$defs|definitions)\\/[^/]+$/,RO=new Set([\"$id\",\"$anchor\",\"$dynamicAnchor\",\"$recursiveAnchor\"]),id=e=>Array.isArray(e)?e.every(id):e===null||typeof e!=\"object\"?!0:Object.entries(e).every(([t,r])=>RO.has(t)||t===\"$dynamicRef\"||t===\"$recursiveRef\"?!1:t===\"$ref\"?typeof r==\"string\"&&OO.test(r):id(r)),CO=(e,t)=>{if(id(e)){let{$defs:r,definitions:n,$schema:o,...s}=e;return{schema:s,root:{...r===void 0?{}:{$defs:r},...n===void 0?{}:{definitions:n}}}}try{return{schema:gd(e,t),root:{}}}catch{return{schema:e,root:{}}}},IO=e=>{if(e===void 0)return{type:\"object\",properties:sd,required:[\"content\"]};let{schema:t,root:r}=CO(e,\"#/anyOf/0/properties/structuredContent\");return{...e.$schema===void 0?{}:{$schema:e.$schema},...r,anyOf:[{type:\"object\",properties:{...sd,structuredContent:t,isError:{const:!1}},required:[\"content\",\"structuredContent\"]},{type:\"object\",properties:{...sd,isError:{const:!0}},required:[\"content\",\"isError\"]}]}},bw=(e,t)=>w.gen(function*(){let r=yield*ts(t.inputSchema).pipe(w.mapError(()=>new J({phase:\"schema\",reason:\"invalid_response\"}))),n=_d(IO(t.outputSchema)),{outputSchema:o,...s}=t;return{...s,description:t.description??t.title??t.name,input:r,output:n.decoder,...t.annotations?.readOnlyHint===void 0?{}:{readOnly:t.annotations.readOnlyHint},run:(a,c)=>w.gen(function*(){let u=yield*G.decodeUnknownEffect(r)(c).pipe(w.flatMap(G.decodeUnknownEffect(pd)),w.mapError(()=>new J({phase:\"call\",reason:\"invalid_input\"})));yield*n.compile.pipe(w.mapError(()=>new J({phase:\"schema\",reason:\"invalid_response\"})));let l=yield*e.call(t.name,u,a);return l.isError===!0&&((yield*kd).failed(),yield*w.annotateCurrentSpan({\"executor.outcome\":\"failed\",\"error.type\":\"McpToolError\"})),l})}});function AO(e){return w.gen(function*(){let t=yield*$n.Clock,r=yield*Er.unbounded(),n=e,o=t.currentTimeMillisUnsafe(),s=0,i=()=>{let a=t.currentTimeMillisUnsafe();return s===0&&(n-=Math.max(0,a-o)),o=a,n};return{waitForInput:a=>w.acquireUseRelease(w.sync(()=>{i(),s++}).pipe(w.andThen(Er.offer(r,void 0))),()=>a,()=>w.sync(()=>{i(),s--}).pipe(w.andThen(Er.offer(r,void 0)))),expired:w.gen(function*(){for(;;){let a=i();if(s===0&&a<=0)return yield*new J({phase:\"call\",reason:\"timeout\"});s>0?yield*Er.take(r):yield*Er.take(r).pipe(w.raceFirst(w.sleep(Math.max(1,a))))}})}})}var $w=(e,t,r,n,o,s)=>w.scoped(w.gen(function*(){let i=yield*AO(o),a=yield*tt.make(),c=yield*w.context(),u=new Set,l=yield*w.acquireRelease(w.sync(()=>new AbortController),d=>w.promise(async()=>{d.abort(),e.removeRequestHandler(\"elicitation/create\"),await Promise.allSettled(u)}));return e.setRequestHandler(Yn,(d,m)=>{let p=AbortSignal.any([l.signal,m.signal]),f=w.gen(function*(){let h=yield*Td({...d.params,mode:d.params.mode??\"form\"}),y=n.elicit;if(y===void 0)return yield*new rr({reason:\"unavailable\"});let x=yield*i.waitForInput(zn(y,\"elicitation\")(h.request).pipe(w.mapError(S=>Mt.getOrElse(G.decodeUnknownOption(rr)(S),()=>new rr({reason:\"transport\"}))),w.timeoutOrElse({duration:wd.timeoutMs,orElse:()=>w.fail(new rr({reason:\"expired\"}))}))).pipe(w.withSpan(\"provider.mcp.elicitation\"));return yield*h.respond(x).pipe(w.flatMap(S=>w.try({try:()=>Qn.parse(S),catch:()=>new rr({reason:\"invalid-response\"})})))}).pipe(w.tapError(h=>tt.fail(a,h))),g=w.runPromiseWith(c)(f,{signal:p}).catch(()=>{throw l.signal.aborted||w.runSync(tt.fail(a,new rr({reason:\"transport\"}))),new E(C.InternalError,\"User input could not be delivered\")});return u.add(g),g.finally(()=>u.delete(g))}),yield*w.tryPromise({try:d=>e.callTool({name:t,arguments:r},void 0,{signal:AbortSignal.any([d,l.signal]),timeout:$d}),catch:d=>s(\"call\",d)}).pipe(w.raceFirst(tt.await(a)),w.raceFirst(i.expired),w.flatMap(d=>G.decodeUnknownEffect(Sd)(d).pipe(w.mapError(()=>new J({phase:\"call\",reason:\"invalid_response\"})))),w.tap(d=>w.annotateCurrentSpan(\"mcp.tool.is_error\",d.isError===!0)))})).pipe(Ne(\"upstream\",\"provider.mcp.request\",{kind:\"client\",attributes:{\"rpc.system.name\":\"jsonrpc\",\"rpc.method\":\"tools/call\",\"mcp.tool.name\":t}}));var NO=new Set([C.RequestTimeout,C.ConnectionClosed]),xw=e=>{if(!(e instanceof E)||NO.has(e.code))return;let t=`MCP error ${e.code}: `;return rs({error:{code:e.code,message:e.message.startsWith(t)?e.message.slice(t.length):e.message}})},zw={getValidator(e){let t=w.runSync(ts(e));return r=>{let n=w.runSyncExit(G.decodeUnknownEffect(t)(r));return dd.isFailure(n)?{valid:!1,data:void 0,errorMessage:\"Value does not match the supported JSON Schema\"}:{valid:!0,data:n.value,errorMessage:void 0}}}};function Sw(e,t,r){let n=e(\"discover\",i=>w.gen(function*(){let a=new Map,c=new Set,u;do{let f=yield*w.tryPromise({try:h=>i.request({method:\"tools/list\",params:u===void 0?{}:{cursor:u}},Kr,{signal:h,timeout:t}),catch:h=>r(\"discover\",h)}).pipe(Ne(\"upstream\",\"provider.mcp.request\",{kind:\"client\",attributes:{\"rpc.system.name\":\"jsonrpc\",\"rpc.method\":\"tools/list\"}})),g=yield*G.decodeUnknownEffect(G.Array(Sn))(f.tools).pipe(w.mapError(()=>new J({phase:\"discover\",reason:\"invalid_response\"})));for(let h of g){if(!h.name||a.has(h.name)||a.size>=Zt.maxTools)return yield*new J({phase:\"discover\",reason:\"invalid_response\"});a.set(h.name,h)}if(u=f.nextCursor,u!==void 0){if(c.has(u)||c.size>=Zt.maxPaginationCursors)return yield*new J({phase:\"discover\",reason:\"invalid_response\"});c.add(u)}}while(u!==void 0);let l=i.getServerVersion(),d=i.getInstructions(),m=l?.icons?.flatMap(f=>Mt.toArray(G.decodeUnknownOption(bd)(f))),p=G.decodeUnknownOption(kn)({...l?.name===void 0?{}:{name:l.name},...l?.title===void 0?{}:{title:l.title},...l?.version===void 0?{}:{version:l.version},...l?.description===void 0?{}:{description:l.description},...l?.websiteUrl===void 0?{}:{websiteUrl:l.websiteUrl},...m===void 0?{}:{icons:m},...d===void 0?{}:{instructions:d}});return{tools:[...a.values()],server:Mt.getOrElse(p,()=>({}))}})).pipe(Ne(\"upstream\",\"provider.mcp.discover\")),o=e(\"discover\",i=>w.tryPromise({try:a=>i.request({method:\"tools/list\",params:{}},Kr,{signal:a,timeout:t}),catch:a=>r(\"discover\",a)}).pipe(w.asVoid,Ne(\"upstream\",\"provider.mcp.request\",{kind:\"client\",attributes:{\"rpc.system.name\":\"jsonrpc\",\"rpc.method\":\"tools/list\"}}))).pipe(Ne(\"upstream\",\"provider.mcp.check\"));return{list:n,check:o,call:(i,a,c)=>e(\"call\",u=>$w(u,i,a,c,t,r)).pipe(Ne(\"upstream\",\"provider.mcp.call\",{attributes:{\"mcp.tool.name\":i}}))}}var MO=e=>e instanceof SyntaxError||e instanceof Error&&ld.hasProperty(e,\"issues\")&&Array.isArray(e.issues),cd=(e,t)=>{if(G.is(Qo)(t)||G.is(J)(t)||G.is(na)(t))return t;let r=t instanceof ze?401:t instanceof vt||t instanceof Wo?t.code:void 0;if(r!==void 0&&r>=300&&r<=599)return ia(r)??new J({phase:e,reason:\"request\",status:r});let n=xw(t);return new J({phase:e,reason:r!==void 0||MO(t)?\"invalid_response\":t instanceof E&&t.code===C.RequestTimeout?\"timeout\":\"request\",...n===void 0?{}:{upstream:n}})},ad={maxBytes:65536,readTimeoutMs:2e3},jO=e=>w.gen(function*(){let t=/^application\\/(?:[\\w.-]+\\+)?json$/i.test(e.headers[\"content-type\"]?.split(\";\")[0]?.trim()??\"\"),r=e.headers[\"content-length\"];if(!t||r!==void 0&&Number(r)>ad.maxBytes)return{body:jt.toReadableStream(e.stream),upstream:void 0};let n=new J({phase:\"transport\",reason:\"invalid_response\"}),o=yield*e.stream.pipe(jt.mapError(()=>n),jt.limitBytes(ad.maxBytes,()=>jt.fail(n)),jt.decodeText,jt.mkString,w.timeout(ad.readTimeoutMs),w.option);if(Mt.isNone(o))return{body:null,upstream:void 0};let s=G.decodeUnknownOption(G.fromJsonString(G.Json))(o.value);return{body:o.value,upstream:Mt.isSome(s)?rs(s.value):void 0}}),ZO=(e,t,r,n)=>(o,s)=>w.runPromiseWith(t.context)(w.gen(function*(){let i=yield*w.try({try:()=>new URL(o),catch:()=>new J({phase:\"transport\",reason:\"invalid_response\"})});if(e.url.username||e.url.password)return yield*new J({phase:\"transport\",reason:\"invalid_input\"});if(i.origin!==e.url.origin||i.username||i.password)return yield*new J({phase:\"transport\",reason:\"invalid_response\"});let a=yield*w.try({try:()=>{let f=new Headers(ra.value(e.headers));return new Headers(s?.headers).forEach((g,h)=>f.set(h,g)),f.has(\"user-agent\")||f.set(\"user-agent\",\"Executor\"),fd.fromWeb(new Request(i,{...s,headers:f}))},catch:()=>new J({phase:\"transport\",reason:\"invalid_input\"})}),u=yield*(yield*md.HttpClient).execute(a);if(yield*Ed(u).pipe(w.tapError(f=>tt.fail(r,f))),u.status<400)return new Response([204,205,304].includes(u.status)?null:jt.toReadableStream(u.stream),{status:u.status,headers:u.headers});let{body:l,upstream:d}=yield*jO(u),m=ia(u.status,u.headers);if(m!==void 0){let f=sa(m,{upstream:d});return yield*tt.fail(r,f),yield*f}let p=new Headers(s?.headers).has(\"mcp-session-id\");return yield*Yo.update(n,f=>new Map(f).set(u.status,{upstream:d,session:p})),new Response(l,{status:u.status,headers:u.headers})}).pipe(w.provide(es.layer),w.provideService(es.RequestInit,{redirect:\"manual\"}),w.provideService(es.Fetch,(i,a)=>globalThis.fetch(i,{...a,signal:AbortSignal.any([...a?.signal?[a.signal]:[],...s?.signal?[s.signal]:[]])})),w.mapError(i=>cd(\"transport\",i))),s?.signal?{signal:s.signal}:{}),DO=(e,t,r)=>{if(G.is(Qo)(e))return sa(e,{phase:t});if(t===\"call\"&&G.is(J)(e)&&e.phase===\"transport\"&&e.reason===\"request\")return new J({phase:t,reason:e.reason,...e.status===void 0?{}:{status:e.status},...e.upstream===void 0?{}:{upstream:e.upstream}});if(!G.is(J)(e)||e.status===void 0)return e;let n=r.get(e.status);if(n===void 0||(e.upstream!==void 0||n.upstream===void 0)&&!n.session)return e;let o=e.upstream??n.upstream;return new J({phase:e.phase,reason:e.reason,status:e.status,...o===void 0?{}:{upstream:o},...n.session?{session:!0}:{}})},kw=(e,t)=>r=>Yo.get(t).pipe(w.flatMap(n=>w.fail(DO(r,e,n))));function qO(e,t,r,n){let o=s=>w.scoped(w.gen(function*(){let i=yield*hd,a=yield*tt.make(),c=yield*Yo.make(new Map),u=new Set,{client:l,transport:d}=yield*w.acquireRelease(w.sync(()=>{let p=ZO(e,i,a,c),f=new Ki({name:\"executor-apps\",version:\"0.1.0\"},{jsonSchemaValidator:zw,capabilities:t===\"call\"?{elicitation:{form:{}}}:{}});return n!==void 0&&f.setNotificationHandler(Xn,()=>{let g=w.runPromiseWith(i.context)(n.pipe(w.timeout(\"5 seconds\"),w.catchCause(()=>w.logWarning(\"MCP catalog invalidation failed\"))));return u.add(g),g.finally(()=>u.delete(g))}),{client:f,transport:s===\"http\"?new Go(e.url,{fetch:p,reconnectionOptions:{maxRetries:0,initialReconnectionDelay:1e3,maxReconnectionDelay:1e3,reconnectionDelayGrowFactor:1}}):new Yi(e.url,{fetch:p})}}),({client:p,transport:f})=>w.gen(function*(){p.removeNotificationHandler(\"notifications/tools/list_changed\"),yield*w.promise(async()=>{await Promise.allSettled(u)}),f instanceof Go&&f.sessionId!==void 0&&(yield*w.tryPromise(()=>f.terminateSession()).pipe(w.timeout(Zt.cleanupTimeoutMs),w.ignore)),yield*w.tryPromise(()=>p.close()).pipe(w.timeout(Zt.cleanupTimeoutMs),w.ignore)}).pipe(Ne(\"upstream\",\"provider.mcp.close\"))),m=d;return yield*w.tryPromise({try:p=>l.connect(m,{signal:p,timeout:e.timeoutMs}),catch:p=>cd(\"connect\",p)}).pipe(w.raceFirst(tt.await(a)),w.catch(kw(\"connect\",c)),w.timeout(e.timeoutMs),Ne(\"upstream\",\"provider.mcp.connect\")),yield*r(l).pipe(w.raceFirst(tt.await(a)),w.catch(kw(t,c)))})).pipe(Ne(\"upstream\",\"provider.mcp.session\",{attributes:{\"mcp.transport\":s,\"mcp.operation\":t,\"server.address\":e.url.hostname}}));return o(\"http\").pipe(w.catch(s=>G.is(J)(s)&&s.phase===\"connect\"&&(s.status===404||s.status===405)?o(\"sse\"):w.fail(s)),s=>t===\"discover\"?s.pipe(w.timeout(e.timeoutMs)):s,w.catchTag(\"TimeoutError\",()=>w.fail(new J({phase:\"transport\",reason:\"timeout\"}))))}var Xo=(e,t)=>w.gen(function*(){let r=yield*G.decodeUnknownEffect(ns)(e).pipe(w.mapError(()=>new J({phase:\"connect\",reason:\"invalid_input\"}))),n=new URL(r.url);if(n.username||n.password||n.hash)return yield*new J({phase:\"connect\",reason:\"invalid_input\"});let o={url:n,headers:ra.make({...r.headers}),timeoutMs:r.timeoutMs??Zt.timeoutMs};return Sw((s,i)=>qO(o,s,i,t).pipe(w.mapError(a=>r.accountId===void 0?a:vd(a,r.accountId))),o.timeoutMs,cd)}),UO=e=>G.is(Qo)(e)&&xn.value(e.reason).pipe(xn.whenOr(\"unauthorized\",\"forbidden\",\"rejected\",()=>!0),xn.whenOr(\"rate_limited\",\"unavailable\",()=>!1),xn.exhaustive),Pw=(e,t)=>w.gen(function*(){let{deadline:r,timeoutMs:n,...o}=yield*G.decodeUnknownEffect(xd)({...t,accountId:e.account.id,signal:e.signal,deadline:e.deadline}).pipe(w.mapError(()=>new J({phase:\"connect\",reason:\"invalid_input\"}))),s=Math.min((yield*$n.currentTimeMillis)+(n??Zt.timeoutMs),r===void 0?Number.POSITIVE_INFINITY:r-zd),i=w.flatMap($n.currentTimeMillis,a=>s-a>=1?w.succeed(Math.floor(s-a)):w.fail(new J({phase:\"transport\",reason:\"timeout\"})));return yield*(yield*Xo({...o,timeoutMs:yield*i})).check,yield*i.pipe(w.flatMap(a=>Xo({url:o.url,signal:o.signal,timeoutMs:a})),w.flatMap(a=>a.check),w.matchEffect({onSuccess:()=>w.fail(new os({anonymous:\"answered\"})),onFailure:a=>G.is(na)(a)?w.fail(a):UO(a)?w.void:w.fail(new os({anonymous:a}))}),Ne(\"upstream\",\"provider.mcp.anonymous\"))}).pipe(Ne(\"upstream\",\"provider.mcp.health\"));var LO=Sn.mapFields(({inputSchema:e,outputSchema:t,_meta:r,...n})=>n),FO=e=>{let t=e.title??e.name;return{...t===void 0?{}:{title:t},...e.description===void 0?{}:{description:e.description},...e.instructions===void 0?{}:{instructions:e.instructions},...e.icons===void 0?{}:{icons:e.icons}}},Ew=(e,t)=>w.gen(function*(){let r=()=>new J({phase:\"connect\",reason:\"invalid_input\"}),n=yield*G.decodeUnknownEffect(ns)({url:e.url,accountId:e.account?.id,headers:e.headers,signal:e.signal,timeoutMs:e.timeoutMs}).pipe(w.mapError(r)),o=yield*Cd(e,e.headers,r),s=yield*Rd({url:n.url}),i=[\"mcp-catalog-v3\",s,\"current\"],a=o===void 0?void 0:zn(oa(o,\"invalidate\"),\"cache\")(i),c=yield*Xo(n,a),u=yield*Id({...e,cache:o,prefix:[\"mcp-catalog-v3\",s],schema:Sn,summary:{schema:LO,of:({inputSchema:h,outputSchema:y,_meta:x,...S})=>S},load:h=>(h===void 0?c.list:Xo({...n,signal:h.signal},zn(oa(h.cache,\"invalidate\"),\"cache\")(i)).pipe(w.flatMap(y=>y.list))).pipe(w.flatMap(({tools:y,server:x})=>G.encodeEffect(kn)(x).pipe(w.map(S=>({tools:y,header:S})))))}),l=h=>Object.hasOwn(t,h.name)?t[h.name]??\"mutation\":h.annotations?.readOnlyHint===!0?\"query\":\"mutation\",d=h=>({...h.annotations,readOnlyHint:l(h)===\"query\"}),m=h=>({name:h.name,description:h.description??h.title??h.name,readOnly:l(h)===\"query\",...h.title===void 0?{}:{title:h.title},annotations:d(h)}),p=h=>bw(c,h).pipe(w.map(y=>yd(Ad({selected:{...y,annotations:d(h)}},{selected:l(h)}).selected))),f=h=>p(h).pipe(w.flatMap(y=>y===void 0?w.succeed(void 0):Od(h.name,\"\",y)));return Pd({kind:\"dynamic\",meta:()=>u.header().pipe(w.flatMap(h=>h===void 0?w.succeed({}):G.decodeUnknownEffect(kn)(h)),w.map(FO)),list:()=>u.list().pipe(w.flatMap(h=>w.forEach(h,f)),w.map(h=>h.filter(y=>y!==void 0))),summaries:()=>u.summaries().pipe(w.map(h=>h.map(m))),describe:h=>u.resolve(h).pipe(w.flatMap(y=>y===void 0?w.succeed(void 0):f(y))),resolve:h=>u.resolve(h).pipe(w.flatMap(y=>y===void 0?w.succeed(void 0):p(y)))})});var $D=(e,t={})=>w.runPromise(Ew(e,t),e.signal===void 0?{}:{signal:e.signal}),xD=(e,t)=>w.runPromise(Pw(e,t),{signal:e.signal});export{os as McpCredentialsUnverified,J as McpError,xD as mcpHealth,$D as mcpRouter};\n/*! Bundled license information:\n\ncontent-type/index.js:\n  (*!\n   * content-type\n   * Copyright(c) 2015 Douglas Christopher Wilson\n   * MIT Licensed\n   *)\n*/\n","node_modules/apps/graphql.js":"import\"./chunk-EIDKD4M6.js\";import\"./chunk-6AE4BD3M.js\";import\"./chunk-6IAPTKU4.js\";import{a as Pe}from\"./chunk-RKBZVLTP.js\";import\"./chunk-4RDFZJBD.js\";import{b as Ce,g as we}from\"./chunk-H64J6GLT.js\";import{a as qe,b as Ge}from\"./chunk-Y6CTOODP.js\";import{a as Ue}from\"./chunk-M63EC7R2.js\";import{a as Ve}from\"./chunk-EYTDRABV.js\";import\"./chunk-CWIMLCDY.js\";import{W as Re,b as M,c as de,ca as Le,d as Y,da as be,ea as Fe,f as H}from\"./chunk-G6QGZRZI.js\";import{p as C,q as De,r as ke,u as J,w as ue}from\"./chunk-DI7JLZ3C.js\";import{Ob as y,ec as le,rd as c}from\"./chunk-IRY5FGME.js\";import\"./chunk-OOJM4CTU.js\";var ht=c.Struct({timeoutMs:c.Int.check(c.isGreaterThan(0)),maxTimeoutMs:c.Int.check(c.isGreaterThan(0))}),he=ht.make({timeoutMs:3e4,maxTimeoutMs:3e5}),K=c.Struct({url:ke,accountId:c.optional(De),headers:c.optional(c.Record(c.String,c.String)),signal:c.optional(c.instanceOf(AbortSignal)),timeoutMs:c.optional(c.Int.check(c.isBetween({minimum:1,maximum:he.maxTimeoutMs})))}),x=class extends c.TaggedError()(\"GraphqlError\",{phase:c.Literals([\"discover\",\"call\"]),reason:c.Literals([\"request\",\"unauthorized\",\"invalid_response\",\"invalid_input\",\"timeout\",\"execution\"]),status:c.optional(c.Number)}){},_=c.String.check(c.isPattern(/^[_A-Za-z][_0-9A-Za-z]*$/u)),Me=c.Literals([\"SCALAR\",\"OBJECT\",\"INTERFACE\",\"UNION\",\"ENUM\",\"INPUT_OBJECT\",\"LIST\",\"NON_NULL\"]),fe=c.Struct({kind:Me,name:c.NullOr(_),ofType:c.optional(c.NullOr(c.suspend(()=>fe)))}),Be=c.Struct({name:_,description:c.NullOr(c.String),type:fe,defaultValue:c.NullOr(c.String)}),ft=c.Struct({name:_,description:c.NullOr(c.String),args:c.Array(Be),type:fe}),je=c.Struct({__schema:c.Struct({queryType:c.NullOr(c.Struct({name:_})),mutationType:c.NullOr(c.Struct({name:_})),types:c.Array(c.Struct({kind:Me,name:_,fields:c.NullOr(c.Array(ft)),inputFields:c.NullOr(c.Array(Be)),enumValues:c.NullOr(c.Array(c.Struct({name:_})))}))})}),$e=c.Struct({data:c.optional(c.NullOr(C)),errors:c.optional(c.Array(C))}),me=c.Struct({name:_,kind:c.Literals([\"query\",\"mutation\"]),field:_,description:c.String,arguments:c.Array(c.Struct({name:_,type:c.String})),inputSchema:C,composite:c.Boolean,selection:c.String});function F(e,t){if(!!!e)throw new Error(t)}function Qe(e){return typeof e==\"object\"&&e!==null}function Je(e,t){if(!!!e)throw new Error(t??\"Unexpected invariant triggered.\")}var mt=/\\r\\n|[\\n\\r]/g;function w(e,t){let n=0,r=1;for(let i of e.body.matchAll(mt)){if(typeof i.index==\"number\"||Je(!1),i.index>=t)break;n=i.index+i[0].length,r+=1}return{line:r,column:t+1-n}}function Te(e){return X(e.source,w(e.source,e.start))}function X(e,t){let n=e.locationOffset.column-1,r=\"\".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,a=t.line+s,T=t.line===1?n:0,m=t.column+T,h=`${e.name}:${a}:${m}\n`,l=r.split(/\\r\\n|[\\n\\r]/g),d=l[i];if(d.length>120){let f=Math.floor(m/80),I=m%80,N=[];for(let S=0;S<d.length;S+=80)N.push(d.slice(S,S+80));return h+Ye([[`${a} |`,N[0]],...N.slice(1,f+1).map(S=>[\"|\",S]),[\"|\",\"^\".padStart(I)],[\"|\",N[f+1]]])}return h+Ye([[`${a-1} |`,l[i-1]],[`${a} |`,d],[\"|\",\"^\".padStart(m)],[`${a+1} |`,l[i+1]]])}function Ye(e){let t=e.filter(([r,i])=>i!==void 0),n=Math.max(...t.map(([r])=>r.length));return t.map(([r,i])=>r.padStart(n)+(i?\" \"+i:\"\")).join(`\n`)}function Tt(e){let t=e[0];return t==null||\"kind\"in t||\"length\"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}var z=class e extends Error{constructor(t,...n){var r,i,s;let{nodes:a,source:T,positions:m,path:h,originalError:l,extensions:d}=Tt(n);super(t),this.name=\"GraphQLError\",this.path=h??void 0,this.originalError=l??void 0,this.nodes=He(Array.isArray(a)?a:a?[a]:void 0);let f=He((r=this.nodes)===null||r===void 0?void 0:r.map(N=>N.loc).filter(N=>N!=null));this.source=T??(f==null||(i=f[0])===null||i===void 0?void 0:i.source),this.positions=m??f?.map(N=>N.start),this.locations=m&&T?m.map(N=>w(T,N)):f?.map(N=>w(N.source,N.start));let I=Qe(l?.extensions)?l?.extensions:void 0;this.extensions=(s=d??I)!==null&&s!==void 0?s:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),l!=null&&l.stack?Object.defineProperty(this,\"stack\",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,\"stack\",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return\"GraphQLError\"}toString(){let t=this.message;if(this.nodes)for(let n of this.nodes)n.loc&&(t+=`\n\n`+Te(n.loc));else if(this.source&&this.locations)for(let n of this.locations)t+=`\n\n`+X(this.source,n);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}};function He(e){return e===void 0||e.length===0?void 0:e}function O(e,t,n){return new z(`Syntax Error: ${n}`,{source:e,positions:[t]})}var V=class{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r}get[Symbol.toStringTag](){return\"Location\"}toJSON(){return{start:this.start,end:this.end}}},L=class{constructor(t,n,r,i,s,a){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=a,this.prev=null,this.next=null}get[Symbol.toStringTag](){return\"Token\"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}},ye={Name:[],Document:[\"definitions\"],OperationDefinition:[\"name\",\"variableDefinitions\",\"directives\",\"selectionSet\"],VariableDefinition:[\"variable\",\"type\",\"defaultValue\",\"directives\"],Variable:[\"name\"],SelectionSet:[\"selections\"],Field:[\"alias\",\"name\",\"arguments\",\"directives\",\"selectionSet\"],Argument:[\"name\",\"value\"],FragmentSpread:[\"name\",\"directives\"],InlineFragment:[\"typeCondition\",\"directives\",\"selectionSet\"],FragmentDefinition:[\"name\",\"variableDefinitions\",\"typeCondition\",\"directives\",\"selectionSet\"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:[\"values\"],ObjectValue:[\"fields\"],ObjectField:[\"name\",\"value\"],Directive:[\"name\",\"arguments\"],NamedType:[\"name\"],ListType:[\"type\"],NonNullType:[\"type\"],SchemaDefinition:[\"description\",\"directives\",\"operationTypes\"],OperationTypeDefinition:[\"type\"],ScalarTypeDefinition:[\"description\",\"name\",\"directives\"],ObjectTypeDefinition:[\"description\",\"name\",\"interfaces\",\"directives\",\"fields\"],FieldDefinition:[\"description\",\"name\",\"arguments\",\"type\",\"directives\"],InputValueDefinition:[\"description\",\"name\",\"type\",\"defaultValue\",\"directives\"],InterfaceTypeDefinition:[\"description\",\"name\",\"interfaces\",\"directives\",\"fields\"],UnionTypeDefinition:[\"description\",\"name\",\"directives\",\"types\"],EnumTypeDefinition:[\"description\",\"name\",\"directives\",\"values\"],EnumValueDefinition:[\"description\",\"name\",\"directives\"],InputObjectTypeDefinition:[\"description\",\"name\",\"directives\",\"fields\"],DirectiveDefinition:[\"description\",\"name\",\"arguments\",\"locations\"],SchemaExtension:[\"directives\",\"operationTypes\"],ScalarTypeExtension:[\"name\",\"directives\"],ObjectTypeExtension:[\"name\",\"interfaces\",\"directives\",\"fields\"],InterfaceTypeExtension:[\"name\",\"interfaces\",\"directives\",\"fields\"],UnionTypeExtension:[\"name\",\"directives\",\"types\"],EnumTypeExtension:[\"name\",\"directives\",\"values\"],InputObjectTypeExtension:[\"name\",\"directives\",\"fields\"]},yt=new Set(Object.keys(ye));function Ee(e){let t=e?.kind;return typeof t==\"string\"&&yt.has(t)}var g;(function(e){e.QUERY=\"query\",e.MUTATION=\"mutation\",e.SUBSCRIPTION=\"subscription\"})(g||(g={}));var B;(function(e){e.QUERY=\"QUERY\",e.MUTATION=\"MUTATION\",e.SUBSCRIPTION=\"SUBSCRIPTION\",e.FIELD=\"FIELD\",e.FRAGMENT_DEFINITION=\"FRAGMENT_DEFINITION\",e.FRAGMENT_SPREAD=\"FRAGMENT_SPREAD\",e.INLINE_FRAGMENT=\"INLINE_FRAGMENT\",e.VARIABLE_DEFINITION=\"VARIABLE_DEFINITION\",e.SCHEMA=\"SCHEMA\",e.SCALAR=\"SCALAR\",e.OBJECT=\"OBJECT\",e.FIELD_DEFINITION=\"FIELD_DEFINITION\",e.ARGUMENT_DEFINITION=\"ARGUMENT_DEFINITION\",e.INTERFACE=\"INTERFACE\",e.UNION=\"UNION\",e.ENUM=\"ENUM\",e.ENUM_VALUE=\"ENUM_VALUE\",e.INPUT_OBJECT=\"INPUT_OBJECT\",e.INPUT_FIELD_DEFINITION=\"INPUT_FIELD_DEFINITION\"})(B||(B={}));var p;(function(e){e.NAME=\"Name\",e.DOCUMENT=\"Document\",e.OPERATION_DEFINITION=\"OperationDefinition\",e.VARIABLE_DEFINITION=\"VariableDefinition\",e.SELECTION_SET=\"SelectionSet\",e.FIELD=\"Field\",e.ARGUMENT=\"Argument\",e.FRAGMENT_SPREAD=\"FragmentSpread\",e.INLINE_FRAGMENT=\"InlineFragment\",e.FRAGMENT_DEFINITION=\"FragmentDefinition\",e.VARIABLE=\"Variable\",e.INT=\"IntValue\",e.FLOAT=\"FloatValue\",e.STRING=\"StringValue\",e.BOOLEAN=\"BooleanValue\",e.NULL=\"NullValue\",e.ENUM=\"EnumValue\",e.LIST=\"ListValue\",e.OBJECT=\"ObjectValue\",e.OBJECT_FIELD=\"ObjectField\",e.DIRECTIVE=\"Directive\",e.NAMED_TYPE=\"NamedType\",e.LIST_TYPE=\"ListType\",e.NON_NULL_TYPE=\"NonNullType\",e.SCHEMA_DEFINITION=\"SchemaDefinition\",e.OPERATION_TYPE_DEFINITION=\"OperationTypeDefinition\",e.SCALAR_TYPE_DEFINITION=\"ScalarTypeDefinition\",e.OBJECT_TYPE_DEFINITION=\"ObjectTypeDefinition\",e.FIELD_DEFINITION=\"FieldDefinition\",e.INPUT_VALUE_DEFINITION=\"InputValueDefinition\",e.INTERFACE_TYPE_DEFINITION=\"InterfaceTypeDefinition\",e.UNION_TYPE_DEFINITION=\"UnionTypeDefinition\",e.ENUM_TYPE_DEFINITION=\"EnumTypeDefinition\",e.ENUM_VALUE_DEFINITION=\"EnumValueDefinition\",e.INPUT_OBJECT_TYPE_DEFINITION=\"InputObjectTypeDefinition\",e.DIRECTIVE_DEFINITION=\"DirectiveDefinition\",e.SCHEMA_EXTENSION=\"SchemaExtension\",e.SCALAR_TYPE_EXTENSION=\"ScalarTypeExtension\",e.OBJECT_TYPE_EXTENSION=\"ObjectTypeExtension\",e.INTERFACE_TYPE_EXTENSION=\"InterfaceTypeExtension\",e.UNION_TYPE_EXTENSION=\"UnionTypeExtension\",e.ENUM_TYPE_EXTENSION=\"EnumTypeExtension\",e.INPUT_OBJECT_TYPE_EXTENSION=\"InputObjectTypeExtension\"})(p||(p={}));function W(e){return e===9||e===32}function U(e){return e>=48&&e<=57}function Ke(e){return e>=97&&e<=122||e>=65&&e<=90}function Ne(e){return Ke(e)||e===95}function Xe(e){return Ke(e)||U(e)||e===95}function ze(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let a=0;a<e.length;++a){var s;let T=e[a],m=Et(T);m!==T.length&&(r=(s=r)!==null&&s!==void 0?s:a,i=a,a!==0&&m<n&&(n=m))}return e.map((a,T)=>T===0?a:a.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function Et(e){let t=0;for(;t<e.length&&W(e.charCodeAt(t));)++t;return t}function We(e,t){let n=e.replace(/\"\"\"/g,'\\\\\"\"\"'),r=n.split(/\\r\\n|[\\n\\r]/g),i=r.length===1,s=r.length>1&&r.slice(1).every(I=>I.length===0||W(I.charCodeAt(0))),a=n.endsWith('\\\\\"\"\"'),T=e.endsWith('\"')&&!a,m=e.endsWith(\"\\\\\"),h=T||m,l=!(t!=null&&t.minimize)&&(!i||e.length>70||h||s||a),d=\"\",f=i&&W(e.charCodeAt(0));return(l&&!f||s)&&(d+=`\n`),d+=n,(l||h)&&(d+=`\n`),'\"\"\"'+d+'\"\"\"'}var o;(function(e){e.SOF=\"<SOF>\",e.EOF=\"<EOF>\",e.BANG=\"!\",e.DOLLAR=\"$\",e.AMP=\"&\",e.PAREN_L=\"(\",e.PAREN_R=\")\",e.SPREAD=\"...\",e.COLON=\":\",e.EQUALS=\"=\",e.AT=\"@\",e.BRACKET_L=\"[\",e.BRACKET_R=\"]\",e.BRACE_L=\"{\",e.PIPE=\"|\",e.BRACE_R=\"}\",e.NAME=\"Name\",e.INT=\"Int\",e.FLOAT=\"Float\",e.STRING=\"String\",e.BLOCK_STRING=\"BlockString\",e.COMMENT=\"Comment\"})(o||(o={}));var $=class{constructor(t){let n=new L(o.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return\"Lexer\"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==o.EOF)do if(t.next)t=t.next;else{let n=Nt(this,t.end);t.next=n,n.prev=t,t=n}while(t.kind===o.COMMENT);return t}};function et(e){return e===o.BANG||e===o.DOLLAR||e===o.AMP||e===o.PAREN_L||e===o.PAREN_R||e===o.SPREAD||e===o.COLON||e===o.EQUALS||e===o.AT||e===o.BRACKET_L||e===o.BRACKET_R||e===o.BRACE_L||e===o.PIPE||e===o.BRACE_R}function q(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Z(e,t){return tt(e.charCodeAt(t))&&nt(e.charCodeAt(t+1))}function tt(e){return e>=55296&&e<=56319}function nt(e){return e>=56320&&e<=57343}function b(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return o.EOF;if(n>=32&&n<=126){let r=String.fromCodePoint(n);return r==='\"'?`'\"'`:`\"${r}\"`}return\"U+\"+n.toString(16).toUpperCase().padStart(4,\"0\")}function v(e,t,n,r,i){let s=e.line,a=1+n-e.lineStart;return new L(t,n,r,s,a,i)}function Nt(e,t){let n=e.source.body,r=n.length,i=t;for(;i<r;){let s=n.charCodeAt(i);switch(s){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return xt(e,i);case 33:return v(e,o.BANG,i,i+1);case 36:return v(e,o.DOLLAR,i,i+1);case 38:return v(e,o.AMP,i,i+1);case 40:return v(e,o.PAREN_L,i,i+1);case 41:return v(e,o.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return v(e,o.SPREAD,i,i+3);break;case 58:return v(e,o.COLON,i,i+1);case 61:return v(e,o.EQUALS,i,i+1);case 64:return v(e,o.AT,i,i+1);case 91:return v(e,o.BRACKET_L,i,i+1);case 93:return v(e,o.BRACKET_R,i,i+1);case 123:return v(e,o.BRACE_L,i,i+1);case 124:return v(e,o.PIPE,i,i+1);case 125:return v(e,o.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?At(e,i):Ot(e,i)}if(U(s)||s===45)return It(e,i,s);if(Ne(s))return _t(e,i);throw O(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (\")?`:q(s)||Z(n,i)?`Unexpected character: ${b(e,i)}.`:`Invalid character: ${b(e,i)}.`)}return v(e,o.EOF,r,r)}function xt(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(s===10||s===13)break;if(q(s))++i;else if(Z(n,i))i+=2;else break}return v(e,o.COMMENT,t,i,n.slice(t+1,i))}function It(e,t,n){let r=e.source.body,i=t,s=n,a=!1;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),U(s))throw O(e.source,i,`Invalid number, unexpected digit after 0: ${b(e,i)}.`)}else i=xe(e,i,s),s=r.charCodeAt(i);if(s===46&&(a=!0,s=r.charCodeAt(++i),i=xe(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(a=!0,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=xe(e,i,s),s=r.charCodeAt(i)),s===46||Ne(s))throw O(e.source,i,`Invalid number, expected digit but got: ${b(e,i)}.`);return v(e,a?o.FLOAT:o.INT,t,i,r.slice(t,i))}function xe(e,t,n){if(!U(n))throw O(e.source,t,`Invalid number, expected digit but got: ${b(e,t)}.`);let r=e.source.body,i=t+1;for(;U(r.charCodeAt(i));)++i;return i}function Ot(e,t){let n=e.source.body,r=n.length,i=t+1,s=i,a=\"\";for(;i<r;){let T=n.charCodeAt(i);if(T===34)return a+=n.slice(s,i),v(e,o.STRING,t,i+1,a);if(T===92){a+=n.slice(s,i);let m=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?vt(e,i):gt(e,i):St(e,i);a+=m.value,i+=m.size,s=i;continue}if(T===10||T===13)break;if(q(T))++i;else if(Z(n,i))i+=2;else throw O(e.source,i,`Invalid character within String: ${b(e,i)}.`)}throw O(e.source,i,\"Unterminated string.\")}function vt(e,t){let n=e.source.body,r=0,i=3;for(;i<12;){let s=n.charCodeAt(t+i++);if(s===125){if(i<5||!q(r))break;return{value:String.fromCodePoint(r),size:i}}if(r=r<<4|j(s),r<0)break}throw O(e.source,t,`Invalid Unicode escape sequence: \"${n.slice(t,t+i)}\".`)}function gt(e,t){let n=e.source.body,r=Ze(n,t+2);if(q(r))return{value:String.fromCodePoint(r),size:6};if(tt(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=Ze(n,t+8);if(nt(i))return{value:String.fromCodePoint(r,i),size:12}}throw O(e.source,t,`Invalid Unicode escape sequence: \"${n.slice(t,t+6)}\".`)}function Ze(e,t){return j(e.charCodeAt(t))<<12|j(e.charCodeAt(t+1))<<8|j(e.charCodeAt(t+2))<<4|j(e.charCodeAt(t+3))}function j(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function St(e,t){let n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return{value:'\"',size:2};case 92:return{value:\"\\\\\",size:2};case 47:return{value:\"/\",size:2};case 98:return{value:\"\\b\",size:2};case 102:return{value:\"\\f\",size:2};case 110:return{value:`\n`,size:2};case 114:return{value:\"\\r\",size:2};case 116:return{value:\"\t\",size:2}}throw O(e.source,t,`Invalid character escape sequence: \"${n.slice(t,t+2)}\".`)}function At(e,t){let n=e.source.body,r=n.length,i=e.lineStart,s=t+3,a=s,T=\"\",m=[];for(;s<r;){let h=n.charCodeAt(s);if(h===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){T+=n.slice(a,s),m.push(T);let l=v(e,o.BLOCK_STRING,t,s+3,ze(m).join(`\n`));return e.line+=m.length-1,e.lineStart=i,l}if(h===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){T+=n.slice(a,s),a=s+1,s+=4;continue}if(h===10||h===13){T+=n.slice(a,s),m.push(T),h===13&&n.charCodeAt(s+1)===10?s+=2:++s,T=\"\",a=s,i=s;continue}if(q(h))++s;else if(Z(n,s))s+=2;else throw O(e.source,s,`Invalid character within String: ${b(e,s)}.`)}throw O(e.source,s,\"Unterminated string.\")}function _t(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(Xe(s))++i;else break}return v(e,o.NAME,t,i,n.slice(t,i))}function G(e){return ee(e,[])}function ee(e,t){switch(typeof e){case\"string\":return JSON.stringify(e);case\"function\":return e.name?`[function ${e.name}]`:\"[function]\";case\"object\":return Dt(e,t);default:return String(e)}}function Dt(e,t){if(e===null)return\"null\";if(t.includes(e))return\"[Circular]\";let n=[...t,e];if(kt(e)){let r=e.toJSON();if(r!==e)return typeof r==\"string\"?r:ee(r,n)}else if(Array.isArray(e))return Ct(e,n);return Rt(e,n)}function kt(e){return typeof e.toJSON==\"function\"}function Rt(e,t){let n=Object.entries(e);return n.length===0?\"{}\":t.length>2?\"[\"+Lt(e)+\"]\":\"{ \"+n.map(([i,s])=>i+\": \"+ee(s,t)).join(\", \")+\" }\"}function Ct(e,t){if(e.length===0)return\"[]\";if(t.length>2)return\"[Array]\";let n=Math.min(10,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(ee(e[s],t));return r===1?i.push(\"... 1 more item\"):r>1&&i.push(`... ${r} more items`),\"[\"+i.join(\", \")+\"]\"}function Lt(e){let t=Object.prototype.toString.call(e).replace(/^\\[object /,\"\").replace(/]$/,\"\");if(t===\"Object\"&&typeof e.constructor==\"function\"){let n=e.constructor.name;if(typeof n==\"string\"&&n!==\"\")return n}return t}var bt=globalThis.process&&!0,it=bt?function(t,n){return t instanceof n}:function(t,n){if(t instanceof n)return!0;if(typeof t==\"object\"&&t!==null){var r;let i=n.prototype[Symbol.toStringTag],s=Symbol.toStringTag in t?t[Symbol.toStringTag]:(r=t.constructor)===null||r===void 0?void 0:r.name;if(i===s){let a=G(t);throw new Error(`Cannot use ${i} \"${a}\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.`)}}return!1};var P=class{constructor(t,n=\"GraphQL request\",r={line:1,column:1}){typeof t==\"string\"||F(!1,`Body must be a string. Received: ${G(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||F(!1,\"line in locationOffset is 1-indexed and must be positive.\"),this.locationOffset.column>0||F(!1,\"column in locationOffset is 1-indexed and must be positive.\")}get[Symbol.toStringTag](){return\"Source\"}};function rt(e){return it(e,P)}function ie(e,t){let n=new ne(e,t),r=n.parseDocument();return Object.defineProperty(r,\"tokenCount\",{enumerable:!1,value:n.tokenCount}),r}function re(e,t){let n=new ne(e,t);n.expectToken(o.SOF);let r=n.parseTypeReference();return n.expectToken(o.EOF),r}var ne=class{constructor(t,n={}){let r=rt(t)?t:new P(t);this._lexer=new $(r),this._options=n,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(o.NAME);return this.node(t,{kind:p.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:p.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===o.NAME){switch(n.value){case\"schema\":return this.parseSchemaDefinition();case\"scalar\":return this.parseScalarTypeDefinition();case\"type\":return this.parseObjectTypeDefinition();case\"interface\":return this.parseInterfaceTypeDefinition();case\"union\":return this.parseUnionTypeDefinition();case\"enum\":return this.parseEnumTypeDefinition();case\"input\":return this.parseInputObjectTypeDefinition();case\"directive\":return this.parseDirectiveDefinition()}if(t)throw O(this._lexer.source,this._lexer.token.start,\"Unexpected description, descriptions are supported only on type definitions.\");switch(n.value){case\"query\":case\"mutation\":case\"subscription\":return this.parseOperationDefinition();case\"fragment\":return this.parseFragmentDefinition();case\"extend\":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:p.OPERATION_DEFINITION,operation:g.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseOperationType(),r;return this.peek(o.NAME)&&(r=this.parseName()),this.node(t,{kind:p.OPERATION_DEFINITION,operation:n,name:r,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(o.NAME);switch(t.value){case\"query\":return g.QUERY;case\"mutation\":return g.MUTATION;case\"subscription\":return g.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:p.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:p.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:p.SELECTION_SET,selections:this.many(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),r,i;return this.expectOptionalToken(o.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:p.FIELD,alias:r,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseArgument(t=!1){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:p.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){let t=this._lexer.token;this.expectToken(o.SPREAD);let n=this.expectOptionalKeyword(\"on\");return!n&&this.peek(o.NAME)?this.node(t,{kind:p.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:p.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token;return this.expectKeyword(\"fragment\"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:p.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword(\"on\"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:p.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword(\"on\"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value===\"on\")throw this.unexpected();return this.parseName()}parseValueLiteral(t){let n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:p.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:p.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case\"true\":return this.node(n,{kind:p.BOOLEAN,value:!0});case\"false\":return this.node(n,{kind:p.BOOLEAN,value:!1});case\"null\":return this.node(n,{kind:p.NULL});default:return this.node(n,{kind:p.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){let r=this._lexer.token.value;throw O(this._lexer.source,n.start,`Unexpected variable \"$${r}\" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:p.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:p.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:p.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,r=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:p.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){let n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:p.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(o.BRACKET_L)){let r=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:p.LIST_TYPE,type:r})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:p.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:p.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword(\"schema\");let r=this.parseConstDirectives(),i=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:p.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);let r=this.parseNamedType();return this.node(t,{kind:p.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword(\"scalar\");let r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:p.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword(\"type\");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:p.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword(\"implements\")?this.delimitedMany(o.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(o.COLON);let s=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:p.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(o.COLON);let i=this.parseTypeReference(),s;this.expectOptionalToken(o.EQUALS)&&(s=this.parseConstValueLiteral());let a=this.parseConstDirectives();return this.node(t,{kind:p.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:a})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword(\"interface\");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:p.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:a})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword(\"union\");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:p.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword(\"enum\");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:p.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:p.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value===\"true\"||this._lexer.token.value===\"false\"||this._lexer.token.value===\"null\")throw O(this._lexer.source,this._lexer.token.start,`${te(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword(\"input\");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:p.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.value){case\"schema\":return this.parseSchemaExtension();case\"scalar\":return this.parseScalarTypeExtension();case\"type\":return this.parseObjectTypeExtension();case\"interface\":return this.parseInterfaceTypeExtension();case\"union\":return this.parseUnionTypeExtension();case\"enum\":return this.parseEnumTypeExtension();case\"input\":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword(\"extend\"),this.expectKeyword(\"schema\");let n=this.parseConstDirectives(),r=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:p.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword(\"extend\"),this.expectKeyword(\"scalar\");let n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:p.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword(\"extend\"),this.expectKeyword(\"type\");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:p.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword(\"extend\"),this.expectKeyword(\"interface\");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:p.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword(\"extend\"),this.expectKeyword(\"union\");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:p.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword(\"extend\"),this.expectKeyword(\"enum\");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:p.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword(\"extend\"),this.expectKeyword(\"input\");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:p.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword(\"directive\"),this.expectToken(o.AT);let r=this.parseName(),i=this.parseArgumentDefs(),s=this.expectOptionalKeyword(\"repeatable\");this.expectKeyword(\"on\");let a=this.parseDirectiveLocations();return this.node(t,{kind:p.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,repeatable:s,locations:a})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(B,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new V(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw O(this._lexer.source,n.start,`Expected ${st(t)}, found ${te(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){let n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw O(this._lexer.source,n.start,`Expected \"${t}\", found ${te(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){let n=t??this._lexer.token;return O(this._lexer.source,n.start,`Unexpected ${te(n)}.`)}any(t,n,r){this.expectToken(t);let i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return[]}many(t,n,r){this.expectToken(t);let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);let r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){let{maxTokens:t}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw O(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}};function te(e){let t=e.value;return st(e.kind)+(t!=null?` \"${t}\"`:\"\")}function st(e){return et(e)?`\"${e}\"`:e}function ot(e){return`\"${e.replace(Ft,wt)}\"`}var Ft=/[\\x00-\\x1f\\x22\\x5c\\x7f-\\x9f]/g;function wt(e){return Vt[e.charCodeAt(0)]}var Vt=[\"\\\\u0000\",\"\\\\u0001\",\"\\\\u0002\",\"\\\\u0003\",\"\\\\u0004\",\"\\\\u0005\",\"\\\\u0006\",\"\\\\u0007\",\"\\\\b\",\"\\\\t\",\"\\\\n\",\"\\\\u000B\",\"\\\\f\",\"\\\\r\",\"\\\\u000E\",\"\\\\u000F\",\"\\\\u0010\",\"\\\\u0011\",\"\\\\u0012\",\"\\\\u0013\",\"\\\\u0014\",\"\\\\u0015\",\"\\\\u0016\",\"\\\\u0017\",\"\\\\u0018\",\"\\\\u0019\",\"\\\\u001A\",\"\\\\u001B\",\"\\\\u001C\",\"\\\\u001D\",\"\\\\u001E\",\"\\\\u001F\",\"\",\"\",'\\\\\"',\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\\\\\\\\\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\\\\u007F\",\"\\\\u0080\",\"\\\\u0081\",\"\\\\u0082\",\"\\\\u0083\",\"\\\\u0084\",\"\\\\u0085\",\"\\\\u0086\",\"\\\\u0087\",\"\\\\u0088\",\"\\\\u0089\",\"\\\\u008A\",\"\\\\u008B\",\"\\\\u008C\",\"\\\\u008D\",\"\\\\u008E\",\"\\\\u008F\",\"\\\\u0090\",\"\\\\u0091\",\"\\\\u0092\",\"\\\\u0093\",\"\\\\u0094\",\"\\\\u0095\",\"\\\\u0096\",\"\\\\u0097\",\"\\\\u0098\",\"\\\\u0099\",\"\\\\u009A\",\"\\\\u009B\",\"\\\\u009C\",\"\\\\u009D\",\"\\\\u009E\",\"\\\\u009F\"];var at=Object.freeze({});function Ie(e,t,n=ye){let r=new Map;for(let D of Object.values(p))r.set(D,ct(t,D));let i,s=Array.isArray(e),a=[e],T=-1,m=[],h=e,l,d,f=[],I=[];do{T++;let D=T===a.length,Se=D&&m.length!==0;if(D){if(l=I.length===0?void 0:f[f.length-1],h=d,d=I.pop(),Se)if(s){h=h.slice();let R=0;for(let[pe,Ae]of m){let _e=pe-R;Ae===null?(h.splice(_e,1),R++):h[_e]=Ae}}else{h={...h};for(let[R,pe]of m)h[R]=pe}T=i.index,a=i.keys,m=i.edits,s=i.inArray,i=i.prev}else if(d){if(l=s?T:a[T],h=d[l],h==null)continue;f.push(l)}let k;if(!Array.isArray(h)){var N,S;Ee(h)||F(!1,`Invalid AST Node: ${G(h)}.`);let R=D?(N=r.get(h.kind))===null||N===void 0?void 0:N.leave:(S=r.get(h.kind))===null||S===void 0?void 0:S.enter;if(k=R?.call(t,h,l,d,f,I),k===at)break;if(k===!1){if(!D){f.pop();continue}}else if(k!==void 0&&(m.push([l,k]),!D))if(Ee(k))h=k;else{f.pop();continue}}if(k===void 0&&Se&&m.push([l,h]),D)f.pop();else{var ce;i={inArray:s,index:T,keys:a,edits:m,prev:i},s=Array.isArray(h),a=s?h:(ce=n[h.kind])!==null&&ce!==void 0?ce:[],T=-1,m=[],d&&I.push(d),d=h}}while(i!==void 0);return m.length!==0?m[m.length-1][1]:e}function ct(e,t){let n=e[t];return typeof n==\"object\"?n:typeof n==\"function\"?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function oe(e){return Ie(e,qt)}var Ut=80,qt={Name:{leave:e=>e.value},Variable:{leave:e=>\"$\"+e.name},Document:{leave:e=>u(e.definitions,`\n\n`)},OperationDefinition:{leave(e){let t=E(\"(\",u(e.variableDefinitions,\", \"),\")\"),n=u([e.operation,u([e.name,t]),u(e.directives,\" \")],\" \");return(n===\"query\"?\"\":n+\" \")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r})=>e+\": \"+t+E(\" = \",n)+E(\" \",u(r,\" \"))},SelectionSet:{leave:({selections:e})=>A(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){let s=E(\"\",e,\": \")+t,a=s+E(\"(\",u(n,\", \"),\")\");return a.length>Ut&&(a=s+E(`(\n`,se(u(n,`\n`)),`\n)`)),u([a,u(r,\" \"),i],\" \")}},Argument:{leave:({name:e,value:t})=>e+\": \"+t},FragmentSpread:{leave:({name:e,directives:t})=>\"...\"+e+E(\" \",u(t,\" \"))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>u([\"...\",E(\"on \",e),u(t,\" \"),n],\" \")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i})=>`fragment ${e}${E(\"(\",u(n,\", \"),\")\")} on ${t} ${E(\"\",u(r,\" \"),\" \")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?We(e):ot(e)},BooleanValue:{leave:({value:e})=>e?\"true\":\"false\"},NullValue:{leave:()=>\"null\"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>\"[\"+u(e,\", \")+\"]\"},ObjectValue:{leave:({fields:e})=>\"{\"+u(e,\", \")+\"}\"},ObjectField:{leave:({name:e,value:t})=>e+\": \"+t},Directive:{leave:({name:e,arguments:t})=>\"@\"+e+E(\"(\",u(t,\", \"),\")\")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>\"[\"+e+\"]\"},NonNullType:{leave:({type:e})=>e+\"!\"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>E(\"\",e,`\n`)+u([\"schema\",u(t,\" \"),A(n)],\" \")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+\": \"+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>E(\"\",e,`\n`)+u([\"scalar\",t,u(n,\" \")],\" \")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>E(\"\",e,`\n`)+u([\"type\",t,E(\"implements \",u(n,\" & \")),u(r,\" \"),A(i)],\" \")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>E(\"\",e,`\n`)+t+(pt(n)?E(`(\n`,se(u(n,`\n`)),`\n)`):E(\"(\",u(n,\", \"),\")\"))+\": \"+r+E(\" \",u(i,\" \"))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>E(\"\",e,`\n`)+u([t+\": \"+n,E(\"= \",r),u(i,\" \")],\" \")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>E(\"\",e,`\n`)+u([\"interface\",t,E(\"implements \",u(n,\" & \")),u(r,\" \"),A(i)],\" \")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>E(\"\",e,`\n`)+u([\"union\",t,u(n,\" \"),E(\"= \",u(r,\" | \"))],\" \")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>E(\"\",e,`\n`)+u([\"enum\",t,u(n,\" \"),A(r)],\" \")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>E(\"\",e,`\n`)+u([t,u(n,\" \")],\" \")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>E(\"\",e,`\n`)+u([\"input\",t,u(n,\" \"),A(r)],\" \")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,repeatable:r,locations:i})=>E(\"\",e,`\n`)+\"directive @\"+t+(pt(n)?E(`(\n`,se(u(n,`\n`)),`\n)`):E(\"(\",u(n,\", \"),\")\"))+(r?\" repeatable\":\"\")+\" on \"+u(i,\" | \")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>u([\"extend schema\",u(e,\" \"),A(t)],\" \")},ScalarTypeExtension:{leave:({name:e,directives:t})=>u([\"extend scalar\",e,u(t,\" \")],\" \")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>u([\"extend type\",e,E(\"implements \",u(t,\" & \")),u(n,\" \"),A(r)],\" \")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>u([\"extend interface\",e,E(\"implements \",u(t,\" & \")),u(n,\" \"),A(r)],\" \")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>u([\"extend union\",e,u(t,\" \"),E(\"= \",u(n,\" | \"))],\" \")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>u([\"extend enum\",e,u(t,\" \"),A(n)],\" \")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>u([\"extend input\",e,u(t,\" \"),A(n)],\" \")}};function u(e,t=\"\"){var n;return(n=e?.filter(r=>r).join(t))!==null&&n!==void 0?n:\"\"}function A(e){return E(`{\n`,se(u(e,`\n`)),`\n}`)}function E(e,t,n=\"\"){return t!=null&&t!==\"\"?e+t+n:\"\"}function se(e){return E(\"  \",e.replace(/\\n/g,`\n  `))}function pt(e){var t;return(t=e?.some(n=>n.includes(`\n`)))!==null&&t!==void 0?t:!1}function ae(e){let t={descriptions:!0,specifiedByUrl:!1,directiveIsRepeatable:!1,schemaDescription:!1,inputValueDeprecation:!1,oneOf:!1,...e},n=t.descriptions?\"description\":\"\",r=t.specifiedByUrl?\"specifiedByURL\":\"\",i=t.directiveIsRepeatable?\"isRepeatable\":\"\",s=t.schemaDescription?n:\"\";function a(m){return t.inputValueDeprecation?m:\"\"}let T=t.oneOf?\"isOneOf\":\"\";return`\n    query IntrospectionQuery {\n      __schema {\n        ${s}\n        queryType { name kind }\n        mutationType { name kind }\n        subscriptionType { name kind }\n        types {\n          ...FullType\n        }\n        directives {\n          name\n          ${n}\n          ${i}\n          locations\n          args${a(\"(includeDeprecated: true)\")} {\n            ...InputValue\n          }\n        }\n      }\n    }\n\n    fragment FullType on __Type {\n      kind\n      name\n      ${n}\n      ${r}\n      ${T}\n      fields(includeDeprecated: true) {\n        name\n        ${n}\n        args${a(\"(includeDeprecated: true)\")} {\n          ...InputValue\n        }\n        type {\n          ...TypeRef\n        }\n        isDeprecated\n        deprecationReason\n      }\n      inputFields${a(\"(includeDeprecated: true)\")} {\n        ...InputValue\n      }\n      interfaces {\n        ...TypeRef\n      }\n      enumValues(includeDeprecated: true) {\n        name\n        ${n}\n        isDeprecated\n        deprecationReason\n      }\n      possibleTypes {\n        ...TypeRef\n      }\n    }\n\n    fragment InputValue on __InputValue {\n      name\n      ${n}\n      type { ...TypeRef }\n      defaultValue\n      ${a(\"isDeprecated\")}\n      ${a(\"deprecationReason\")}\n    }\n\n    fragment TypeRef on __Type {\n      kind\n      name\n      ofType {\n        kind\n        name\n        ofType {\n          kind\n          name\n          ofType {\n            kind\n            name\n            ofType {\n              kind\n              name\n              ofType {\n                kind\n                name\n                ofType {\n                  kind\n                  name\n                  ofType {\n                    kind\n                    name\n                    ofType {\n                      kind\n                      name\n                      ofType {\n                        kind\n                        name\n                      }\n                    }\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  `}function Q(e){if(!e.ofType)throw new x({phase:\"discover\",reason:\"invalid_response\"});return e.ofType}function Oe(e){return e.kind===\"LIST\"||e.kind===\"NON_NULL\"?Oe(Q(e)):e}function ve(e){if(e.kind===\"NON_NULL\")return ve(Q(e))+\"!\";if(e.kind===\"LIST\")return\"[\"+ve(Q(e))+\"]\";if(!e.name)throw new x({phase:\"discover\",reason:\"invalid_response\"});return e.name}function Mt(e,t){let n=new Map,r=l=>l.kind===\"NON_NULL\"?i(Q(l)):{anyOf:[i(l),{type:\"null\"}]},i=l=>{if(l.kind===\"LIST\")return{type:\"array\",items:r(Q(l))};if(!l.name)throw new x({phase:\"discover\",reason:\"invalid_response\"});let d=t.get(l.name);if(!d)throw new x({phase:\"discover\",reason:\"invalid_response\"});if(d.kind===\"ENUM\"&&d.enumValues)return{type:\"string\",enum:d.enumValues.map(f=>f.name)};if(d.kind===\"INPUT_OBJECT\"&&d.inputFields)return n.has(d.name)||(n.set(d.name,{}),n.set(d.name,s(d.inputFields))),{$ref:\"#/$defs/\"+d.name};if(d.kind!==\"SCALAR\")throw new x({phase:\"discover\",reason:\"invalid_response\"});switch(d.name){case\"Int\":return{type:\"integer\",minimum:-2147483648,maximum:2147483647};case\"Float\":return{type:\"number\"};case\"Boolean\":return{type:\"boolean\"};case\"ID\":return{anyOf:[{type:\"string\"},{type:\"integer\"}]};case\"String\":return{type:\"string\"};default:return{}}},s=l=>({type:\"object\",additionalProperties:!1,properties:Object.fromEntries(l.map(d=>[d.name,{...r(d.type),...d.description?{description:d.description}:{}}])),required:l.filter(d=>d.type.kind===\"NON_NULL\"&&d.defaultValue===null).map(d=>d.name)}),a=Oe(e.type),T=[\"OBJECT\",\"INTERFACE\",\"UNION\"].includes(a.kind),m=t.get(a.name??\"\")?.fields?.filter(l=>{let d=Oe(l.type);return(d.kind===\"SCALAR\"||d.kind===\"ENUM\")&&l.args.every(f=>f.type.kind!==\"NON_NULL\"||f.defaultValue!==null)}).map(l=>l.name)??[],h=s(e.args);return{composite:T,selection:m.length?m.join(\" \"):\"__typename\",schema:{type:\"object\",additionalProperties:!1,properties:{arguments:h,...T?{select:{type:\"string\",minLength:1,description:\"Fields to return, e.g. id name items { id title }. Omit to select scalar fields.\"}}:{}},required:e.args.some(l=>l.type.kind===\"NON_NULL\"&&l.defaultValue===null)?[\"arguments\"]:[],$defs:Object.fromEntries(n)}}}function Bt(e){let t=ie(\"query { result { \"+e+\" } }\"),n=t.definitions[0];if(t.definitions.length!==1||n?.kind!==p.OPERATION_DEFINITION||n.selectionSet.selections.length!==1)throw new x({phase:\"call\",reason:\"invalid_input\"});let r=n.selectionSet.selections[0];if(r?.kind!==p.FIELD||r.name.value!==\"result\"||!r.selectionSet)throw new x({phase:\"call\",reason:\"invalid_input\"});return r.selectionSet}var ge=e=>y.gen(function*(){let t=yield*c.decodeUnknownEffect(K)(e).pipe(y.mapError(()=>new x({phase:\"discover\",reason:\"invalid_input\"}))),n=new URL(t.url);if(n.username||n.password||n.hash)return yield*new x({phase:\"discover\",reason:\"invalid_input\"});let r=le.make({...t.headers}),i=(a,T,m={})=>y.scoped(y.gen(function*(){let h=yield*de.HttpClient,l=yield*de.withScope(h).execute(M.post(n.href).pipe(M.setHeader(\"user-agent\",\"Executor\"),M.setHeaders(le.value(r)),M.bodyJsonUnsafe({query:T,variables:m})));if(yield*Ve(l),l.status<200||l.status>=300)return yield*Le(l.status,l.headers)??new x({phase:a,reason:\"request\",status:l.status});let d=yield*l.json.pipe(H(\"upstream\",\"provider.http.response.read\"),y.flatMap(c.decodeUnknownEffect($e)),y.mapError(()=>new x({phase:a,reason:\"invalid_response\"})));return d.errors?.length?yield*Fe(d.errors,l.status)??new x({phase:a,reason:\"execution\",status:l.status}):d.data==null?yield*new x({phase:a,reason:\"invalid_response\"}):d.data})).pipe(H(\"upstream\",\"provider.graphql.request\",{attributes:{\"executor.operation\":a,\"server.address\":n.hostname}}),y.provideService(Y.RequestInit,{redirect:\"manual\"}),y.provideService(Y.Fetch,globalThis.fetch),y.provide(Y.layer),y.timeoutOrElse({duration:t.timeoutMs??he.timeoutMs,orElse:()=>y.fail(new x({phase:a,reason:\"timeout\"}))}),y.mapError(h=>h instanceof J&&t.accountId!==void 0?be(h,t.accountId):h instanceof x||h instanceof J||h instanceof ue?h:new x({phase:a,reason:\"request\"}))),s=i(\"discover\",ae()).pipe(y.flatMap(c.decodeUnknownEffect(je)),y.mapError(a=>a instanceof x||a instanceof J||a instanceof ue?a:new x({phase:\"discover\",reason:\"invalid_response\"})));return{request:i,discover:s}}),lt=e=>y.gen(function*(){let t=new Map(e.__schema.types.map(r=>[r.name,r])),n=[{kind:g.QUERY,type:e.__schema.queryType},{kind:g.MUTATION,type:e.__schema.mutationType}].flatMap(({kind:r,type:i})=>(e.__schema.types.find(s=>s.name===i?.name)?.fields??[]).map(s=>({kind:r,field:s})));return yield*y.forEach(n,({kind:r,field:i})=>y.gen(function*(){let s=yield*y.try({try:()=>Mt(i,t),catch:()=>new x({phase:\"discover\",reason:\"invalid_response\"})});return yield*y.try({try:()=>({name:r+\"_\"+i.name,kind:r,field:i.name,description:i.description??i.name,arguments:i.args.map(a=>({name:a.name,type:ve(a.type)})),inputSchema:s.schema,composite:s.composite,selection:s.selection}),catch:()=>new x({phase:\"discover\",reason:\"invalid_response\"})})}))}),ut=(e,t)=>y.gen(function*(){let n=yield*Re(t.inputSchema).pipe(y.mapError(()=>new x({phase:\"discover\",reason:\"invalid_response\"}))),r=t.kind===\"query\"?g.QUERY:g.MUTATION,i=t.name;return{description:t.description,readOnly:r===g.QUERY,input:n,run:(a,T)=>y.gen(function*(){let m=yield*c.decodeUnknownEffect(n)(T).pipe(y.flatMap(c.decodeUnknownEffect(C)),y.mapError(()=>new x({phase:\"call\",reason:\"invalid_input\"}))),h=yield*c.decodeUnknownEffect(C)(m.arguments??{}).pipe(y.mapError(()=>new x({phase:\"call\",reason:\"invalid_input\"}))),l=yield*y.try({try:()=>{let I=t.arguments.filter(N=>Object.hasOwn(h,N.name));return oe({kind:p.DOCUMENT,definitions:[{kind:p.OPERATION_DEFINITION,operation:r,variableDefinitions:I.map(N=>({kind:p.VARIABLE_DEFINITION,variable:{kind:p.VARIABLE,name:{kind:p.NAME,value:N.name}},type:re(N.type)})),selectionSet:{kind:p.SELECTION_SET,selections:[{kind:p.FIELD,name:{kind:p.NAME,value:t.field},arguments:I.map(N=>({kind:p.ARGUMENT,name:{kind:p.NAME,value:N.name},value:{kind:p.VARIABLE,name:{kind:p.NAME,value:N.name}}})),...t.composite?{selectionSet:Bt(typeof m.select==\"string\"?m.select:t.selection)}:{}}]}}]})},catch:()=>new x({phase:\"call\",reason:\"invalid_input\"})}),d=yield*e.request(\"call\",l,h),f=Object.hasOwn(d,t.field)?d[t.field]:void 0;return f===void 0?yield*new x({phase:\"call\",reason:\"invalid_response\"}):f}).pipe(H(\"upstream\",\"provider.graphql.call\",{attributes:{\"graphql.operation.type\":r,\"executor.tool.name\":i}}))}});var jt=me.mapFields(({name:e,kind:t,description:n})=>({name:e,kind:t,description:n})),dt=(e,t)=>y.gen(function*(){let n=()=>new x({phase:\"discover\",reason:\"invalid_input\"}),r=yield*c.decodeUnknownEffect(K)({url:e.url,accountId:e.account?.id,headers:e.headers,signal:e.signal,timeoutMs:e.timeoutMs}).pipe(y.mapError(n)),i=yield*qe(e,e.headers,n),s=yield*Ue({url:r.url}),a=yield*ge(r),T=yield*Ge({...e,cache:i,prefix:[\"graphql-catalog-v2\",s],schema:me,summary:{schema:jt,of:({name:f,kind:I,description:N})=>({name:f,kind:I,description:N})},load:f=>(f===void 0?y.succeed(a):ge({...r,signal:f.signal})).pipe(y.flatMap(I=>I.discover),y.flatMap(lt),y.map(I=>({tools:I})))}),m=f=>Object.hasOwn(t,f.name)?t[f.name]??\"mutation\":f.kind,h=f=>({name:f.name,description:f.description,readOnly:m(f)===\"query\"}),l=f=>({...h(f),inputSchema:f.inputSchema});return we({kind:\"dynamic\",list:()=>T.list().pipe(y.map(f=>f.map(l))),summaries:()=>T.summaries().pipe(y.map(f=>f.map(h))),describe:f=>T.resolve(f).pipe(y.map(I=>I===void 0?void 0:l(I))),resolve:f=>y.gen(function*(){let I=yield*T.resolve(f);if(I===void 0)return;let N=yield*ut(a,I),S=Pe({selected:N},{selected:m(I)});return Ce(S.selected)})})});var hr=(e,t={})=>y.runPromise(dt(e,t),e.signal===void 0?{}:{signal:e.signal});export{x as GraphqlError,hr as graphqlRouter};\n","node_modules/apps/chunk-EIDKD4M6.js":"","node_modules/apps/chunk-6AE4BD3M.js":"import{a as fn,j as On,m as dt,n as lt,o as ut,p as pt}from\"./chunk-6IAPTKU4.js\";import{C as ht,D as gt,t as Se,u as yt,v as Ce,w as Qe,x as wt,y as mt,z as oe}from\"./chunk-4RDFZJBD.js\";import{b as Rn,m as at,n as ct}from\"./chunk-H64J6GLT.js\";import{c as ze,d as Ze}from\"./chunk-M63EC7R2.js\";import{b as Ee}from\"./chunk-EYTDRABV.js\";import{b as ft}from\"./chunk-CWIMLCDY.js\";import{H as gn,M as xe,N as Sn,O as ye,P as En,Q as kn,R as bn,S as vn,T as An,W as xn,Y as we,aa as Te,ca as Cn,da as In,f as fe,g as yn,h as wn,i as Ae,m as mn,n as hn,p as ne}from\"./chunk-G6QGZRZI.js\";import{$b as Bn,Ac as Re,Bc as Zn,Ca as Wn,Dc as et,Ec as R,Fc as nt,Gc as tt,Hc as ot,Ic as X,Ja as he,Jc as Ye,Ka as ge,Na as Nn,Nc as rt,Oa as jn,Pa as te,Ua as Fn,V as Le,X as ce,Yb as Ln,bd as it,cc as Ge,dc as Jn,dd as st,ec as Kn,fc as Vn,ga as Tn,gc as Xn,hc as L,ic as Gn,jb as Xe,kc as Yn,lb as Dn,mb as _n,na as Je,o as _,ob as Pn,p as Pe,pc as Qn,qa as Un,ra as Ke,sa as Mn,ta as Ve,vc as zn,wa as b,wc as Oe,xa as qn,xc as W,ya as me,yc as se,za as $n,zc as z}from\"./chunk-DI7JLZ3C.js\";import{Ae as Hn,D as V,Dc as A,Ea as Fe,Ob as t,Qd as _e,Rb as De,ec as pe,ne as v,oa as U,rd as a,ue as Be,xc as ee}from\"./chunk-IRY5FGME.js\";var en=(n,e)=>n.pipe(t.catchCause(o=>{if(U.hasInterrupts(o))return t.interrupt;let r=U.squash(o);if(a.is(b)(r))return t.fail(r);let{errorName:i,message:s}=oe(r,e);return t.fail(new b({reason:\"execution\",retryable:!(r instanceof qn),...i===void 0?{}:{errorName:i},...s===void 0?{}:{message:s}}))})),St=n=>e=>e.step===void 0?new b({reason:e.reason,retryable:e.retryable,step:n.slice(0,200),...e.errorName===void 0?{}:{errorName:e.errorName},...e.message.length===0?{}:{message:e.message}}):e,Et=(n,e,o,r)=>t.gen(function*(){let i=yield*t.context(),s=new Map,c=(p,l)=>t.gen(function*(){yield*a.decodeUnknownEffect(Un)(l).pipe(t.mapError(()=>new b({reason:\"input\",retryable:!1})));let h=JSON.stringify([p,l]),k=(s.get(h)??0)+1;s.set(h,k);let $=yield*t.tryPromise({try:()=>crypto.subtle.digest(\"SHA-256\",new TextEncoder().encode(JSON.stringify([n.runId,p,l,k]))),catch:()=>new b({reason:\"execution\",retryable:!1})});return Array.from(new Uint8Array($),w=>w.toString(16).padStart(2,\"0\")).join(\"\")}),u=(p,l)=>{let h=Ke(p.timeout??\"10 minutes\");return h===void 0?t.fail(new b({reason:\"input\",retryable:!1})):l.pipe(t.timeout(h),t.catchTag(\"TimeoutError\",()=>t.fail(new b({reason:\"engine\",retryable:!0}))))},y=(p,l,h)=>t.gen(function*(){let k=yield*c(\"do\",p),$=yield*a.decodeUnknownEffect(Ve)(l).pipe(t.mapError(()=>new b({reason:\"input\",retryable:!1})));return yield*n.driver.do(`do:${p.slice(0,100)}:${k}`,$,()=>u($,t.scoped(t.gen(function*(){let w=yield*t.acquireRelease(t.sync(()=>new AbortController),H=>t.sync(()=>H.abort())),m=yield*o(k,AbortSignal.any([r,w.signal])),T=yield*en(hn(h,\"step\")(m.context),m.secrets);return yield*a.decodeUnknownEffect(me)(T).pipe(t.mapError(()=>new b({reason:\"output\",retryable:!1,message:\"The step returned a value that is not JSON, such as undefined, or is larger than 1 MiB. Return null for no result.\"})))})).pipe(t.provideContext(i)))).pipe(t.mapError(St(p)))}),E=(p,l,h,k,$)=>t.gen(function*(){let w=Rn(h),m=e.tools?.kind===\"router\"?e.tools:void 0,T=ct(m).find(g=>g.operation===w&&g.operation.kind===p);if(w===void 0||T===void 0)return yield*new b({reason:\"operation\",retryable:!1});let H=yield*a.decodeUnknownEffect(_)(k).pipe(t.mapError(()=>new b({reason:\"input\",retryable:!1}))),N=yield*a.decodeUnknownEffect(Ve)($).pipe(t.mapError(()=>new b({reason:\"input\",retryable:!1}))),j=yield*c(p,l),C=Ke(N.timeout??\"10 minutes\");return C===void 0?yield*new b({reason:\"input\",retryable:!1}):yield*n.driver.do(`${p}:${l.slice(0,100)}:${j}`,N,()=>u(N,n.invoke({kind:p,name:T.name,input:H,stepId:j,timeout:C}).pipe(t.provideContext(i)))).pipe(t.mapError(St(l)))}),f=p=>ne(()=>p.pipe(t.provideContext(i)),r)(),x={do:(p,l,h)=>{let k=typeof l==\"function\"?l:h;return k===void 0?Promise.reject(new b({reason:\"input\",retryable:!1})):f(y(p,typeof l==\"function\"?{}:l,k))},runQuery:(p,l,h,k={})=>f(E(\"query\",p,l,h,k)),runMutation:(p,l,h,k={})=>f(E(\"mutation\",p,l,h,k)),sleep:(p,l)=>f(a.decodeUnknownEffect(Mn)(l).pipe(t.mapError(()=>new b({reason:\"input\",retryable:!1})),t.flatMap(h=>c(\"sleep\",p).pipe(t.flatMap(k=>n.driver.sleep(`sleep:${p.slice(0,100)}:${k}`,h)))))),sleepUntil:(p,l)=>f(c(\"until\",p).pipe(t.flatMap(h=>n.driver.sleepUntil(`until:${p.slice(0,100)}:${h}`,l instanceof Date?l.getTime():l))))};return{runId:n.runId,step:x}});var kt=\"app.elicitation.wait\",bt=\"app.workflow.control\",vt=n=>e=>t.gen(function*(){let o=yield*st;return yield*e.pipe(yn(`app.${n}`,{},r=>{let i=wn(r,\"executor\");return{around:i.observe,end:(s,c)=>{let u=i.read(s);o({elapsedMs:Number(s-r)/1e6,upstreamMs:u.upstream,elicitationMs:u.person,authoredMs:u.app,leaseMs:u.lease,backgroundMs:u.background}),c.attribute(\"executor.upstream.wait_ms\",u.upstream),c.attribute(\"executor.elicitation.wait_ms\",u.person),c.attribute(\"executor.authored_ms\",u.app),c.attribute(\"executor.lease.wait_ms\",u.lease),c.attribute(\"executor.background_ms\",u.background),c.attribute(\"executor.overhead_ms\",u.executor)}}}))});var Vt=n=>t.gen(function*(){let e=yield*a.decodeUnknownEffect(Nn)(n,{onExcessProperty:\"error\"}).pipe(t.mapError(()=>new te({reason:\"invalid-request\"}))),o=yield*xn(e.requestedSchema).pipe(t.mapError(()=>new te({reason:\"invalid-request\"})));return{request:e,respond:i=>t.gen(function*(){let s=yield*a.decodeUnknownEffect(jn)(i).pipe(t.catchTag(\"SchemaError\",()=>t.fail(new te({reason:\"invalid-response\"}))));if(s.action===\"accept\"){let c=s.content===void 0?{}:s.content;return yield*a.decodeUnknownEffect(o)(c).pipe(t.mapError(()=>new te({reason:\"invalid-response\"}))),{...s,content:c}}return s})}}),At=(n,e,o)=>ne(r=>t.gen(function*(){if(n===void 0)return yield*new te({reason:\"unavailable\"});let i=yield*Vt(r);return yield*n(i.request,e).pipe(fe(\"person\",kt),t.flatMap(i.respond))}),e,o);var on=(n,e)=>Sn(n.propertySignatures.flatMap(({name:o,type:r})=>typeof o==\"string\"?[{name:o,optional:A.isOptional(A.toEncoded(r))}]:[]),n.indexSignatures.length>0,e),Ie=n=>A.isUnion(n)?n.types.flatMap(Ie):A.isUndefined(n)||A.isVoid(n)?[]:[n],be=n=>{if(A.isLiteral(n))return[n.literal];if(A.isEnum(n))return n.enums.map(([,o])=>o);if(!A.isUnion(n))return;let e=Ie(n).map(be);return e.length>0&&e.every(o=>o!==void 0)?e.flat():void 0},Tt=n=>v.value(n).pipe(v.when(A.isObjects,e=>e.propertySignatures.length>0?on(e,En):\"object\"),v.when(A.isArrays,()=>\"array\"),v.when(A.isTemplateLiteral,()=>\"a string matching a template\"),v.when(A.isString,()=>\"string\"),v.when(A.isNumber,()=>\"number\"),v.when(A.isBoolean,()=>\"boolean\"),v.when(A.isNull,()=>\"null\"),v.orElse(()=>\"a value with other constraints\")),Xt=n=>{let[e]=n;if(!(n.length<2||e===void 0||!A.isObjects(e)))return e.propertySignatures.map(({name:o})=>o).find(o=>typeof o==\"string\"&&n.every(r=>A.isObjects(r)&&r.propertySignatures.some(i=>i.name===o&&be(A.toEncoded(i.type))!==void 0)))},Ot=n=>{let e=Ie(n),o=e.map(be),r=o.flatMap(s=>s===void 0?[]:s),i=e.filter((s,c)=>o[c]===void 0);return i.length===0?ye(r):kn([...r.length===0?[]:[ye(r)],...new Set(i.map(Tt))],Xt(e))},Gt=n=>`Expected ${Ot(n)}`,Yt=n=>{let e=A.toEncoded(n),o=be(e);if(o!==void 0)return ye(o);let r=Ie(e),[i]=r;if(i===void 0)return;if(r.length>1&&A.isUnion(e))return Ot(e);if(A.isObjects(i)&&i.propertySignatures.length>0)return on(i);let s=Tt(i);return s===\"a value with other constraints\"?void 0:s},Qt=n=>ee.hasInput(n)?\"Invalid value\":v.value(n).pipe(v.tag(\"InvalidType\",({ast:e})=>{let o=be(e);return o!==void 0?`Expected ${ye(o)}`:A.isObjects(e)&&e.propertySignatures.length>0?`Expected ${on(e)}`:ee.defaultLeafHook(n)}),v.orElse(ee.defaultLeafHook)),zt=n=>ee.hasInput(n)||ee.hasInput(n.issue)?ee.defaultCheckHook(n)??\"Invalid value\":ee.defaultCheckHook(n),Zt=ee.makeFormatterStandardSchemaV1({leafHook:Qt,checkHook:zt}),eo=(n,e)=>n!==void 0&&A.isObjects(n)?n.propertySignatures.find(({name:o})=>o===e)?.type:void 0,no=n=>e=>n.indexSignatures.length>0||n.propertySignatures.some(({name:o})=>o===e),ke=(n,e,o)=>v.value(n).pipe(v.tag(\"Pointer\",r=>{let i=r.issue._tag===\"MissingKey\"&&r.path.length===1?eo(o,r.path[0]):void 0;return i===void 0||o===void 0||!A.isObjects(o)?ke(r.issue,[...e,...r.path]):[{path:[...e,...r.path],message:bn(Yt(i)),accepts:no(o)}]}),v.tag(\"Composite\",({ast:r,issues:i})=>i.flatMap(s=>ke(s,e,r))),v.tag(\"Encoding\",r=>ke(r.issue,e)),v.tag(\"AnyOf\",({ast:r,issues:i})=>i.length===0?[{path:e,message:Gt(r)}]:i.flatMap(s=>ke(s,e))),v.orElse(r=>{let i=r._tag===\"Filter\"?An(r.filter):void 0;return Zt(r).issues.map(s=>({path:[...e,...(s.path??[]).map(c=>typeof c==\"object\"?c.key:c)],message:s.message,...i===void 0?{}:{accepts:i}}))})),to=n=>typeof n==\"number\"?`[${n}]`:typeof n==\"string\"&&xe(n)?`.${n}`:\"[key]\",nn=n=>`input${n.map(to).join(\"\")}`,tn=n=>typeof n==\"object\"&&n!==null&&!Array.isArray(n),oo=(n,e)=>e.reduce((o,r)=>Array.isArray(o)&&typeof r==\"number\"||tn(o)&&typeof r==\"string\"&&Object.hasOwn(o,r)?o[r]:void 0,n),xt=n=>n.toLowerCase().replace(/[-_]/g,\"\"),ro=(n,e,o)=>{let r=e.at(-1);if(typeof r!=\"string\"||!xe(r))return;let i=e.slice(0,-1),s=oo(n,i);if(!tn(s))return;let c=Object.keys(s).filter(f=>xe(f)&&!o(f)),u=c.find(f=>f!==r&&xt(f)===xt(r)),y=c.find(f=>{let x=s[f];return tn(x)&&Object.hasOwn(x,r)}),E=u!==void 0?[...i,u]:y!==void 0?[...i,y,r]:void 0;return E===void 0?void 0:`The input has ${String(E.at(-1))} at ${nn(E)}; did you mean ${nn(e)}?`},Rt=(n,e)=>{if(!a.isSchemaError(n))return new R;let o=ke(n.issue,[]).slice(0,et).map(({path:r,message:i,accepts:s})=>{let c=s!==void 0&&i.startsWith(vn)?ro(e,r,s):void 0;return`${nn(r)}: ${i}${c===void 0?\"\":`. ${c}`}`.slice(0,512)});return new R({problems:o})};var Ct=a.Literals([\"approved\",\"denied\",\"user-approval\"]);var io=({user:n,...e})=>e,re=(n,e)=>t.suspend(n).pipe(t.catchCause(o=>U.hasInterrupts(o)?t.interrupt:t.fail(e))),It=n=>\"app\"in n?{scope:\"app\",name:n.app}:{scope:\"user\",name:n.user},Ht=(n,e,o,r)=>t.gen(function*(){let i=n.webhooks??{};if(e.operation===\"webhooks\")return yield*t.forEach(Object.entries(i),([g,O])=>re(()=>t.gen(function*(){let q=It(O.account);if(!Object.hasOwn(r[q.scope],q.name))return yield*new L;let B=F=>{let G=gn(F);if(G!==void 0)return a.decodeUnknownEffect(Pe)(G);let ie=a.toJsonSchemaDocument(F);return a.decodeUnknownEffect(Pe)({...ie.schema,$defs:ie.definitions})},Ne=yield*B(O.config);if(O.setup===void 0?O.register===void 0||O.unregister===void 0:O.register!==void 0||O.unregister!==void 0)return yield*new L;let le=O.setup===void 0?void 0:{...yield*a.decodeUnknownEffect(_n)(O.setup),stateSchema:yield*B(O.state)};return yield*a.decodeUnknownEffect(Pn)({name:g,account:q.name,configSchema:Ne,...le===void 0?{}:{setup:le}})}),new L));let s=Object.hasOwn(i,e.name)?i[e.name]:void 0;if(s===void 0)return yield*new se;let c=It(s.account),u=c.scope===\"app\"?o.app:o.user;if(u===void 0)return yield*new W;let y=Object.hasOwn(u.accounts,c.name)?u.accounts[c.name]:void 0,E=(Array.isArray(y)?y:[y]).find(g=>typeof g==\"object\"&&g!==null&&\"id\"in g&&g.id===e.sourceAccount);if(E===void 0)return yield*new R;let f=c.scope===\"app\"?io(o):o,x=yield*re(()=>a.decodeUnknownEffect(s.config)(e.config),new R);if(e.operation===\"webhook-validate\")return yield*re(()=>a.decodeUnknownEffect(_)(x),new R);let p={config:x,subscriptionId:e.subscriptionId,account:E,callbackUrl:e.callbackUrl,secret:e.secret},l=(g,O)=>re(()=>g(f,O),new z);if(e.operation===\"webhook-complete\")return s.setup===void 0?yield*new R:yield*re(()=>a.decodeUnknownEffect(s.state)(e.state).pipe(t.flatMap(a.decodeUnknownEffect(_))),new R);if(e.operation===\"webhook-register\"){if(s.register===void 0||s.setup!==void 0)return yield*new z;let g=yield*l(s.register,p);return yield*re(()=>a.decodeUnknownEffect(s.state)(g).pipe(t.flatMap(a.decodeUnknownEffect(_))),new X)}let h=e.state===null?null:yield*re(()=>a.decodeUnknownEffect(s.state)(e.state),new R);if(e.operation===\"webhook-unregister\")return s.unregister===void 0||s.setup!==void 0?yield*new z:(yield*l(s.unregister,{...p,state:h}),null);let k=yield*t.fromResult(De.decode(e.request.body)).pipe(t.mapError(()=>new R));if(k.byteLength>Xe.maxBodyBytes)return yield*new R;let $=yield*re(()=>t.sync(()=>new Request(e.request.url,{method:e.request.method,headers:e.request.headers,...o.signal===void 0?{}:{signal:o.signal},...e.request.method===\"GET\"||e.request.method===\"HEAD\"?{}:{body:Uint8Array.from(k)}})),new R),w=yield*l(s.handle,{...p,state:h,request:$});if(!(w instanceof Response))return yield*new X;let m=[],T=0,H=w.body;H!==null&&(yield*_e.fromReadableStream({evaluate:()=>H,onError:()=>new X}).pipe(_e.runForEach(g=>t.gen(function*(){if(T+=g.byteLength,T>Xe.maxBodyBytes)return yield*new X;m.push(g)})),mn(\"webhook\")));let N=new Uint8Array(T),j=0;for(let g of m)N.set(g,j),j+=g.byteLength;let C={};return w.headers.forEach((g,O)=>{C[O]=g}),yield*re(()=>a.decodeUnknownEffect(Dn)({status:w.status,headers:C,body:De.encode(new Uint8Array(N))}),new X)});var rn=`${he}step_receipts`,sn=`${he}step_events`,an=`${he}migrations`,Mt=`${he}legacy_rows`,qt=n=>{let e=n.toArray();return{columnNames:n.columnNames,rowsRead:n.rowsRead,rowsWritten:n.rowsWritten,toArray:()=>[...e],one:()=>{if(e.length!==1)throw new Error(`Expected exactly one row, but the statement returned ${e.length}.`);return e[0]},[Symbol.iterator]:()=>e[Symbol.iterator]()}},so=n=>(typeof n==\"object\"||typeof n==\"function\")&&n!==null&&\"then\"in n&&typeof n.then==\"function\",$t=()=>{throw new Error(`This app has no database. Add its first migration, such as ${ge}/0001_create_notes.sql with a CREATE TABLE statement, and deploy again.`)},cn={exec:$t,transaction:$t},Wt=[\"foreign_keys\",\"defer_foreign_keys\",\"ignore_check_constraints\",\"legacy_alter_table\",\"recursive_triggers\",\"reverse_unordered_selects\"],qe=n=>new Map(Wt.map(e=>[e,Number(n.sql.exec(`PRAGMA ${e}`).toArray()[0]?.[e])])),ao=(n,e)=>{let o=qe(n);return Wt.find(r=>o.get(r)!==e.get(r))},Nt=(n,e)=>{let o=qe(n);for(let[r,i]of e)o.get(r)!==i&&n.sql.exec(`PRAGMA ${r} = ${i}`);n.sql.exec(\"PRAGMA case_sensitive_like = OFF\")},He=class extends Error{},jt=(n,e)=>{let o=!1,r=()=>{if(o||e.signal.aborted)throw new Error(\"This call has ended, so its ctx.sql no longer runs statements.\")},i=!1,s=0,c=qe(n),u=()=>{let w=ao(n,c);if(w!==void 0)throw f(new Error(`SQLite connection settings belong to Executor, so app code cannot change PRAGMA ${w}; the statement was rolled back. Migrations may change settings while they run.`))},y=()=>Number(n.sql.exec(\"SELECT total_changes() AS n\").toArray()[0]?.n),E,f=w=>(i&&(E??=w),w),x=(w,m,T)=>{try{return p(w,m,T)}finally{Nt(n,c)}},p=(w,m,T)=>{if(r(),m.length>100)throw f(new Error(`A statement can bind at most ${100} values, but this one binds ${m.length}. Pass a long list as one JSON array and read it with json_each(?), or split the work into batches.`));if(T===\"write\"){let C=()=>{let g=qt(n.sql.exec(w,...m));return u(),g};if(!i)return n.transactionSync(C);try{return C()}catch(g){throw f(g instanceof Error?g:new Error(String(g))),g}}if(i)return p(w,m,\"write\");let H=y(),N,j=!1;try{n.transactionSync(()=>{throw N=qt(n.sql.exec(w,...m)),j=y()!==H,u(),new He})}catch(C){if(!(C instanceof He))throw C}if(j||N===void 0)throw new Error(e.step!==void 0?\"A workflow step mutation writes only inside ctx.sql.transaction(...), so a retried step applies its writes once.\":\"Queries are read-only. Change data from a mutation.\");return N},l={exec:(w,...m)=>x(w,m,\"read\")},h=()=>{let w=!0;return{tx:{exec:(T,...H)=>{if(!w)throw new Error(\"This transaction has ended, so its tx no longer runs statements.\");return x(T,H,\"write\")}},end:()=>{w=!1}}};return{reader:l,writer:{exec:(w,...m)=>x(w,m,e.step?\"read\":\"write\"),transaction:w=>{if(r(),i)throw new Error(\"ctx.sql.transaction(...) cannot be nested.\");let m=e.step;if(m!==void 0&&s>0)throw new Error(\"A workflow step mutation opens at most one ctx.sql.transaction(...), which records the step's result.\");s+=1,E=void 0;let T=h(),H=e.emitted?.length,N=()=>{e.emitted!==void 0&&H!==void 0&&(e.emitted.length=H)},j=()=>{i=!0;try{let C=()=>{let B=w(T.tx);if(so(B))throw new Error(\"ctx.sql.transaction(...) callbacks are synchronous and cannot await. Call outside services before or after the transaction.\");if(E!==void 0)throw E;return B};if(m===void 0)return C();n.sql.exec(`CREATE TABLE IF NOT EXISTS ${rn} (id TEXT PRIMARY KEY, fingerprint TEXT NOT NULL, result TEXT NOT NULL) WITHOUT ROWID`);let g=n.sql.exec(`SELECT fingerprint, result FROM ${rn} WHERE id = ?`,m.key).toArray()[0];if(n.sql.exec(`CREATE TABLE IF NOT EXISTS ${sn} (id TEXT PRIMARY KEY, events TEXT NOT NULL) WITHOUT ROWID`),g!==void 0){if(g.fingerprint!==m.fingerprint)throw new Error(\"This workflow step already ran with different input.\");let B=n.sql.exec(`SELECT events FROM ${sn} WHERE id = ?`,m.key).toArray()[0];return B!==void 0&&e.emitted!==void 0&&e.emitted.push(...JSON.parse(String(B.events))),JSON.parse(String(g.result))}let O=JSON.stringify(C()??null),q=e.emitted?.slice(H??0)??[];return q.length>0&&n.sql.exec(`INSERT INTO ${sn} (id, events) VALUES (?, ?)`,m.key,JSON.stringify(q)),n.sql.exec(`INSERT INTO ${rn} (id, fingerprint, result) VALUES (?, ?, ?)`,m.key,m.fingerprint,O),JSON.parse(O)}finally{i=!1,T.end()}};try{return n.transactionSync(j)}catch(C){throw N(),C}}},close:()=>{o=!0}}},Ue=class extends a.TaggedError()(\"MigrationFileInvalid\",{path:a.String,reason:a.String}){get message(){return`${this.path}: ${this.reason}`}},de=class extends a.TaggedError()(\"MigrationHistoryChanged\",{reason:a.String}){get message(){return`${this.reason} Applied migrations cannot change: restore the original file and add a new migration instead. Nothing was applied; the previous version is still active.`}},Me=class extends a.TaggedError()(\"MigrationFailed\",{path:a.String,reason:a.String}){get message(){return`${this.path} failed: ${this.reason}. No migrations were applied; the previous version is still active.`}},co=/^(\\d+)_[A-Za-z0-9_-]+\\.sql$/,lo=n=>t.promise(()=>crypto.subtle.digest(\"SHA-256\",new TextEncoder().encode(n))).pipe(t.map(e=>Array.from(new Uint8Array(e),o=>o.toString(16).padStart(2,\"0\")).join(\"\"))),uo=n=>{let e=0,o=0;for(;o<n.length;){let r=n[o],i=n[o+1];if(r===\"-\"&&i===\"-\"){let c=n.indexOf(`\n`,o);o=c===-1?n.length:c+1;continue}if(r===\"/\"&&i===\"*\"){let c=n.indexOf(\"*/\",o+2);o=c===-1?n.length:c+2;continue}let s=r===\"'\"||r==='\"'||r===\"`\"?r:r===\"[\"?\"]\":void 0;if(s!==void 0){let c=o+1;for(;;){let u=n.indexOf(s,c);if(u===-1){c=n.length;break}if(s!==\"]\"&&n[u+1]===s){c=u+2;continue}c=u+1;break}o=c,e=o;continue}o+=1,r!==void 0&&!/\\s/u.test(r)&&(e=o)}return n.slice(0,e)},Ft=n=>n.some(e=>e.path.startsWith(`${ge}/`)&&e.path.endsWith(\".sql\")),po=n=>t.gen(function*(){let e=[];for(let r of n){if(!r.path.startsWith(`${ge}/`)||!r.path.endsWith(\".sql\"))continue;let i=r.path.slice(ge.length+1),s=co.exec(i);if(i.includes(\"/\")||s===null)return yield*new Ue({path:r.path,reason:\"migrations are files directly in migrations/ named like 0001_create_notes.sql: a number that orders them, an underscore, then a name.\"});let c=r.content.replaceAll(`\\r\n`,`\n`);e.push({path:r.path,order:Number(s[1]),content:c,hash:yield*lo(c)})}let o=[...e].sort((r,i)=>r.order-i.order);for(let[r,i]of o.entries()){let s=o[r-1];if(s!==void 0&&s.order===i.order)return yield*new Ue({path:i.path,reason:`it has the same number as ${s.path}; give each migration its own number.`})}return o}),fo=a.Array(a.Struct({id:a.Number,path:a.String,hash:a.String})),Dt=(n,e)=>t.gen(function*(){let o=yield*po(e),r=qe(n);return yield*t.sync(()=>n.transactionSync(()=>{n.sql.exec(`CREATE TABLE IF NOT EXISTS ${an} (id INTEGER PRIMARY KEY, path TEXT NOT NULL, hash TEXT NOT NULL, applied_at TEXT NOT NULL)`);let i=n.sql.exec(\"SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'app_rows'\").toArray().length>0;n.sql.exec(`DROP VIEW IF EXISTS ${Mt}`),n.sql.exec(`CREATE VIEW ${Mt} (table_name, id, body) AS ${i?\"SELECT table_name, id, body FROM app_rows\":\"SELECT '', '', '' WHERE 0\"}`);let s=a.decodeUnknownSync(fo)(n.sql.exec(`SELECT id, path, hash FROM ${an} ORDER BY id`).toArray());for(let[y,E]of s.entries()){let f=o[y];if(f===void 0)throw new de({reason:`${E.path} was applied to this app's database but is no longer in migrations/.`});if(f.path!==E.path)throw new de({reason:`Migration ${y+1} was applied as ${E.path}, but the build has ${f.path} in its place.`});if(f.hash!==E.hash)throw new de({reason:`${E.path} changed after it was applied to this app's database.`})}let c=o.slice(s.length),u=new Date().toISOString();for(let[y,E]of c.entries()){let f=uo(E.content);try{f!==\"\"&&n.sql.exec(f)}catch(x){throw new Me({path:E.path,reason:x instanceof Error?x.message:String(x)})}n.sql.exec(`INSERT INTO ${an} (id, path, hash, applied_at) VALUES (?, ?, ?, ?)`,s.length+y+1,E.path,E.hash,u)}return c.map((y,E)=>({id:s.length+E+1,name:y.path}))})).pipe(t.catchDefect(i=>a.is(Me)(i)||a.is(de)(i)?t.fail(i):t.die(i)),t.ensuring(t.sync(()=>Nt(n,r))))});var yo=a.Struct({tools:a.Array(a.Union([Vn,Xn])),routers:a.Array(Yn)});function I(n,e){return t.suspend(n).pipe(t.catchCause(o=>U.hasInterrupts(o)?t.interrupt:t.fail(e)))}var dn=(n,e)=>n.pipe(t.catchCause(o=>{if(U.hasInterrupts(o))return t.interrupt;let r=U.squash(o),i=Te(r),s=wt(r),c=Qe(r,e);return t.fail(V.isSome(i)?Ce(i.value,e,\"discover\"):V.isSome(s)?s.value:V.isSome(c)?c.value:new Gn(oe(r,e)))})),We=(n,e,o=[])=>new L({source:\"app\",errorName:\"HostDeclarationInvalid\",message:yt(e===void 0?n:`${n}: ${mt(e)}`,o)}),Kt=(n,e)=>t.suspend(n).pipe(t.catchCause(o=>U.hasInterrupts(o)?t.interrupt:t.fail(We(e,U.squash(o)))));function _t(n){let e=i=>Object.entries(n??{}).filter(([,s])=>s===i).map(([s])=>s).sort(),o=e(\"plain\"),r=e(\"raw\");return{...o.length===0?{}:{plain:o},...r.length===0?{}:{raw:r}}}function Pt(n){return n===void 0||n.length===0?{}:{request:Tn(n)}}function wo(n){return Kt(()=>t.gen(function*(){let e=new Map;for(let[o,r]of Object.entries(n.auth))switch(r._tag){case\"secrets\":e.set(o,{type:\"secrets\",label:r.label,fields:yield*we(r.fields),..._t(r.exposure),...Pt(r.request)});break;case\"oauth2\":e.set(o,{type:\"oauth2\",...r.config,response:yield*we(r.response),..._t(r.exposure),...Pt(r.request)});break}return yield*a.decodeUnknownEffect(Ln)({name:n.name,auth:Object.fromEntries(e),...n.hosts===void 0?{}:{hosts:[...new Set(n.hosts)].sort()}})}),`Account provider \"${n.name}\" has an invalid declaration`)}function Lt(n){return t.gen(function*(){let e=new Map;for(let[o,r]of Object.entries(n)){let i=r instanceof ce?r.provider:r;e.set(o,{cardinality:r instanceof ce?\"many\":\"one\",definition:yield*wo(i),...i.health===void 0?{}:{health:!0}})}return Object.fromEntries(e)})}function mo(n,e,o,r){return t.gen(function*(){return yield*a.decodeUnknownEffect(Bn)({accounts:{app:yield*Lt(n.app),user:yield*Lt(n.user)},capabilities:{skills:!0,toolIndex:!0,skillSources:!0,scheduledTools:!0,sharedDefinitions:!0},...e?{sql:!0}:{},...o===void 0||Object.keys(o).length===0?{}:{events:yield*Kt(()=>dt(o),\"The app's event declarations are invalid\")},...r===void 0?{}:{icons:r}}).pipe(t.mapError(i=>We(\"The app's account declarations are invalid\",i)))})}function $e(n){return Array.isArray(n)?`[${n.map($e).join(\",\")}]`:n!==null&&typeof n==\"object\"?`{${Object.entries(n).sort(([e],[o])=>e.localeCompare(o)).map(([e,o])=>`${JSON.stringify(e)}:${$e(o)}`).join(\",\")}}`:JSON.stringify(n)}function Bt({hosts:n,...e}){return{...e,auth:Object.fromEntries(Object.entries(e.auth).map(([o,{request:r,...i}])=>[o,i]))}}function ln(n,e,o){return t.gen(function*(){if(Object.keys(o).some(i=>!Object.hasOwn(n,i)))return yield*t.fail(new W);let r=new Map;for(let[i,s]of Object.entries(n)){let c=Object.hasOwn(e,i)?e[i]:void 0,u=Object.hasOwn(o,i)?o[i]:void 0;if(c===void 0||u===void 0)return yield*t.fail(new W);let y=s instanceof ce?s.provider:s,E=s instanceof ce;if(E!==Array.isArray(u))return yield*t.fail(new W);let f=Array.isArray(u)?u:[u],x=new Set,p=[];for(let l of f){if(x.has(l.id))return yield*t.fail(new W);if(x.add(l.id),$e(Bt(l.provider))!==$e(Bt(c.definition))||!Object.hasOwn(y.auth,l.method))return yield*t.fail(new W);let h=y.auth[l.method];if(h===void 0)return yield*t.fail(new W);let k=yield*a.decodeUnknownEffect(h._tag===\"secrets\"?h.fields:h.response)(l.fields),$=Object.hasOwn(l.provider.auth,l.method)?l.provider.auth[l.method]?.request:void 0;p.push(On({id:l.id,method:l.method,fields:k},$))}if(E)r.set(i,p);else{let l=p[0];if(l===void 0)return yield*t.fail(new W);r.set(i,l)}}return Object.fromEntries(r)})}function Jt(n,e,o){return I(()=>t.gen(function*(){let r=yield*a.decodeUnknownEffect(Ge)(pe.value(o.accounts)),i=yield*ln(n.app,e.accounts.app,r.app);if(r.user===void 0)return{app:{accounts:i}};let s=yield*ln(n.user,e.accounts.user,r.user);return{app:{accounts:i},user:{accounts:s}}}),new W)}var ho=n=>Object.values(n.user?.accounts??{}).flatMap(e=>(Array.isArray(e)?e:[e]).map(o=>o.id)),go=(n,e)=>t.acquireRelease(t.sync(()=>{let o=new AbortController,r=0,i=!1,s=()=>{i&&r===0&&o.abort()},c=()=>{i=!0,s()};n.addEventListener(\"abort\",c,{once:!0}),n.aborted&&c();let u=t.sync(()=>{r-=1,s()});return{signal:o.signal,close:()=>{n.removeEventListener(\"abort\",c),c()},background:y=>t.suspend(()=>(r+=1,e(y.pipe(t.ensuring(u))).pipe(t.onError(()=>u))))}}),o=>t.sync(o.close));function So(n,e,o,r,i){return t.scoped(t.gen(function*(){if(!ut(n))return yield*t.fail(We(\"The app module's default export is not an app created by defineApp\"));let s=pt(n),c=Se(o.accounts),u=Ft(o.files??[]),y=yield*mo(s.accounts,u,s.events,s.icons);if(e.operation===\"requirements\")return yield*I(()=>a.decodeUnknownEffect(_)(y),new L);if(e.operation===\"migrate\"){if(!u)return yield*new se;let d=o.storage;if(d===void 0)return yield*new z(oe(new Error(\"This host gave the app no SQL storage.\"),c));let S=yield*a.decodeUnknownEffect(a.Array(Be))(o.files??[]).pipe(t.mapError(()=>new L)),M=yield*Dt(d,S).pipe(t.mapError(P=>new z(oe(P,c))),t.withSpan(\"app.sql.migrate\"));return yield*I(()=>a.decodeUnknownEffect(_)(M),new X)}let E=yield*t.acquireRelease(t.sync(()=>new AbortController),d=>t.sync(()=>d.abort())),f=AbortSignal.any([r,E.signal]),x=o.storage,p=d=>u?x===void 0?t.fail(new z(oe(new Error(\"This host gave the app no SQL storage.\"),c))):t.acquireRelease(t.sync(()=>jt(x,{signal:f,emitted:i,...d===void 0?{}:{step:d}})),S=>t.sync(S.close)):t.succeed({reader:cn,writer:cn}),l=o.deadline===void 0?void 0:yield*I(()=>a.decodeUnknownEffect(Kn)(o.deadline),new R),h=d=>t.gen(function*(){if(l===void 0)return yield*d;let S=l-(yield*Fe.currentTimeMillis);if(S<=0)return yield*new b({reason:\"engine\",retryable:!0});let M=yield*d.pipe(t.timeout(S),t.catchTag(\"TimeoutError\",()=>t.fail(new b({reason:\"engine\",retryable:!0}))));return(yield*Fe.currentTimeMillis)>=l?yield*new b({reason:\"engine\",retryable:!0}):M});if(e.operation===\"account-check\")return yield*Eo(s.accounts,y,e.requirement,o,f,l).pipe(h);let k,$=(d,S)=>t.suspend(()=>k!==void 0&&o.elicitation!==void 0?o.elicitation(d,S).pipe(fe(\"person\",\"app.tool.elicitation\"),t.provideContext(k.context)):t.fail(new te({reason:\"unavailable\"}))),w=()=>t.fail(new b({reason:\"unavailable\",retryable:!1})),m=yield*Ae,T=(d,S)=>S.pipe(fe(\"executor\",bt,{attributes:{\"executor.workflow.operation\":d}})),H={start:ne(d=>T(\"start\",o.workflowControls===void 0?w():o.workflowControls.start(d)),f,m.context),get:ne(d=>T(\"get\",o.workflowControls===void 0?w():o.workflowControls.get(d)),f,m.context),list:ne(d=>T(\"list\",o.workflowControls===void 0?w():o.workflowControls.list(d)),f,m.context),terminate:ne(d=>T(\"terminate\",o.workflowControls===void 0?w():o.workflowControls.terminate(d)),f,m.context)},N={get:H.get,list:H.list},j=yield*a.decodeUnknownEffect(a.Array(Be))(o.files??[]).pipe(t.mapError(()=>new L)),C=0,g=o.cache??ze,O=yield*go(r,g.background),q={cache:Ze({...g,transport:d=>(C+=1,g.transport(d)),background:O.background},pe.value(o.accounts),f,m.context,l),files:j,...yield*Jt(s.accounts,y,o).pipe(t.withSpan(\"app.accounts.bind\")),workflows:N,signal:f,fetch:yield*Ee(O.signal),elicit:At($,f,m.context)},B=ho(q),Ne=[...Object.values(q.app.accounts).flatMap(d=>(Array.isArray(d)?d:[d]).map(S=>S.id)),...B],le=d=>lt({events:s.events??{},accounts:Ne,attributable:B,...d===void 0?{}:{sourceAccount:d},emitted:i}),F=yield*dn(s.evaluate(q),c).pipe(t.withSpan(\"app.evaluate\"));if(e.operation===\"skills\"){let d=F.skills??(yield*ft({files:j}).pipe(t.mapError(()=>new L))),S=F.dynamicSkills,M=C,P=S===void 0?[]:yield*dn(t.suspend(S.list),c).pipe(t.withSpan(\"app.skills.load\")),D=S!==void 0&&C>M,J=new Set([...d,...P].map(Q=>Q.name)),K=(yield*gt(F.tools).pipe(t.withSpan(\"app.skills.routers\"))).filter(Q=>!J.has(Q.name)),Y=yield*a.decodeUnknownEffect(Hn)([...d,...P,...K]).pipe(t.mapError(()=>new L));return e.sources===!0?{skills:Y,dynamic:S!==void 0,cached:D}:Y}if(e.operation===\"workflows\")return yield*t.forEach(Object.entries(F.workflows??{}),([d,S])=>I(()=>t.gen(function*(){return yield*a.decodeUnknownEffect($n)({name:d,...S.description===void 0?{}:{description:S.description},inputSchema:yield*we(S.input),...S.output===void 0?{}:{outputSchema:yield*we(S.output)}})}),new L));if(e.operation===\"workflow-validate\"||e.operation===\"workflow-run\"){let d=F.workflows!==void 0&&Object.hasOwn(F.workflows,e.name)?F.workflows[e.name]:void 0;if(d===void 0)return yield*new b({reason:\"not_found\",retryable:!1});let S=yield*I(()=>a.decodeUnknownEffect(d.input)(e.input),new b({reason:\"input\",retryable:!1}));if(e.operation===\"workflow-validate\")return yield*I(()=>a.decodeUnknownEffect(me)(S),new b({reason:\"input\",retryable:!1}));let M=o.workflow;if(M===void 0)return yield*new b({reason:\"unavailable\",retryable:!1});let P=yield*Et(M,F,(Y,Q)=>t.gen(function*(){let ae=yield*M.resolve();return{context:{...yield*I(()=>Jt(s.accounts,y,ae),new b({reason:\"credentials\",retryable:!1})),cache:Ze(o.cache??ze,pe.value(ae.accounts),Q,(yield*Ae).context),files:j,fetch:yield*Ee(Q),signal:Q,runId:M.runId,stepId:Y,idempotencyKey:Y},secrets:Se(ae.accounts)}}),f),D=yield*en(d.run(P,S),c),J=d.output,K=J===void 0?D:yield*I(()=>a.decodeUnknownEffect(J)(D),new b({reason:\"output\",retryable:!1,message:\"The workflow's result does not match its declared output schema.\"}));return yield*I(()=>a.decodeUnknownEffect(me)(K),new b({reason:\"output\",retryable:!1,message:\"The workflow returned a value that is not JSON, such as undefined, or is larger than 1 MiB. Return null for no result.\"}))}if(e.operation===\"inspect\"){let d=e.detail===\"summary\",S=yield*ht(F.tools,{summary:d,secrets:c,...e.tools===void 0?{}:{wanted:new Set(e.tools)},...e.scheduled===!0?{scheduled:!0}:{},schedules:D=>Object.entries(F.schedules??{}).filter(([,J])=>J.tool===D).map(([J,{tool:K,...Y}])=>({name:J,...Y}))}).pipe(t.withSpan(\"app.catalog.read\")),{tools:M,routers:P}=S;return yield*I(()=>(e.definitions===\"shared\"&&!d&&M.every(D=>\"inputSchema\"in D)?a.encodeEffect(Qn)(rt({tools:M,routers:P})):a.encodeEffect(yo)(S)).pipe(t.flatMap(a.decodeUnknownEffect(_))),new L)}if(e.operation===\"webhook-complete\"||e.operation===\"webhook-validate\"||e.operation===\"webhooks\"||e.operation===\"webhook-register\"||e.operation===\"webhook-handle\"||e.operation===\"webhook-unregister\"){let d=yield*p();return yield*Ht(F,e,{files:j,cache:q.cache,app:q.app,...q.user===void 0?{}:{user:q.user},workflows:H,signal:q.signal,fetch:q.fetch,sql:d.writer,events:le(\"sourceAccount\"in e?e.sourceAccount:void 0)},s.accounts)}let G=e.operation===\"call\"?e.tool:e.name,ie=at(F.tools,G),Z=ie===void 0?void 0:ie.kind===\"operation\"?ie.operation:yield*dn(ie.source.resolve(ie.name),c).pipe(t.withSpan(\"app.tool.resolve\"));if(Z===void 0)return yield*e.operation===\"call\"?new Re:new se;let je=e.operation===\"call\"?e.kind:e.operation===\"query\"?\"query\":\"mutation\";if(je!==void 0&&Z.kind!==je)return yield*new Zn({tool:G,requested:je,actual:Z.kind});let ue=Z.kind===\"query\"?\"query\":\"mutate\",ve=yield*t.suspend(()=>a.decodeUnknownEffect(Z.input)(e.input)).pipe(t.catchCause(d=>U.hasInterrupts(d)?t.interrupt:t.fail(Rt(U.squash(d),e.input))));if(o.approval!==void 0){let d=yield*I(()=>a.decodeUnknownEffect(Jn)(o.approval),new R),S=yield*I(()=>a.decodeUnknownEffect(_)(ve),new R);if(d.tool!==G||!a.toEquivalence(_)(d.input,S))return yield*new R}else if(Z.approval!==void 0){let d=Z.approval,S=yield*I(()=>d({toolName:G,toolInput:ve,signal:f}).pipe(t.withSpan(\"app.tool.approval\",{attributes:{\"executor.tool.name\":G}}),t.flatMap(a.decodeUnknownEffect(Ct))),new ot);yield*v.value(S).pipe(v.when(\"approved\",()=>t.void),v.when(\"denied\",()=>t.fail(new nt)),v.when(\"user-approval\",()=>I(()=>a.decodeUnknownEffect(_)(ve),new R).pipe(t.flatMap(M=>t.fail(new tt({input:M,elicitation:Fn(G,M)}))))),v.exhaustive)}let un=o.replay===void 0?void 0:yield*I(()=>a.decodeUnknownEffect(Wn)(o.replay),new R);if(un!==void 0&&ue!==\"mutate\")return yield*new R;let pn=yield*p(un);return yield*h(t.gen(function*(){let d=yield*t.gen(function*(){k=yield*Ae;let P=yield*Ee(O.signal);return yield*Z.run({...q,fetch:P,workflows:ue===\"mutate\"?H:N,sql:ue===\"mutate\"?pn.writer:pn.reader,...ue===\"mutate\"?{events:le()}:{}},ve)}).pipe(t.ensuring(t.sync(()=>{k=void 0})),t.catchCause(P=>{if(U.hasInterrupts(P))return t.interrupt;let D=U.squash(P),J=Te(D),K=a.decodeUnknownOption(Je)(D),Y=Qe(D,c),Q=a.decodeUnknownOption(te)(D),ae=a.is(Re)(D)?e.operation===\"call\"?new Re:new se:void 0;return t.fail(ae!==void 0?ae:V.isSome(J)?Ce(J.value,c,\"call\"):V.isSome(K)?new Je({code:K.value.code,status:K.value.status,message:K.value.message,...K.value.recovery===void 0?{}:{recovery:K.value.recovery}}):V.isSome(Y)?Y.value:V.isSome(Q)?Q.value:new z(oe(D,c)))}),t.withSpan(\"app.operation.execute\",{attributes:{\"executor.tool.name\":G,\"executor.operation\":ue}})),S=Z.output,M=S===void 0?d:yield*I(()=>a.decodeUnknownEffect(S)(d),new X);return yield*I(()=>a.decodeUnknownEffect(_)(M),new X)}))}))}function Eo(n,e,o,r,i,s){return t.gen(function*(){let c=Object.hasOwn(n.app,o)?\"app\":Object.hasOwn(n.user,o)?\"user\":void 0;if(c===void 0)return yield*new W;let u=n[c][o],y=Object.hasOwn(e.accounts[c],o)?e.accounts[c][o]:void 0;if(u===void 0||y===void 0)return yield*new W;let E=u instanceof ce?u.provider:u,f=E.health;if(f===void 0)return yield*new se;let p=(yield*I(()=>t.gen(function*(){let k=(yield*a.decodeUnknownEffect(Ge)(pe.value(r.accounts)))[c];return k===void 0?yield*new W:yield*ln({[o]:E},{[o]:{...y,cardinality:\"one\"}},k)}),new W).pipe(t.withSpan(\"app.accounts.bind\")))[o];if(p===void 0||!(\"id\"in p))return yield*new W;let l=yield*t.suspend(()=>t.gen(function*(){return yield*f.run({account:p,fetch:yield*Ee(i),signal:i,...s===void 0?{}:{deadline:s}})})).pipe(t.catchCause(h=>{if(U.hasInterrupts(h))return t.interrupt;let k=U.squash(h),$=a.decodeUnknownOption(fn)(k),w=V.isSome($)?V.fromNullishOr(Cn($.value.status)):Te(k),m=Se(r.accounts);return t.fail(V.isSome(w)?Ce(In(w.value,p.id),m):new z(oe(k,m)))}),t.withSpan(\"app.account.check\"));return yield*I(()=>a.decodeUnknownEffect(Le)(l??{}).pipe(t.flatMap(a.encodeEffect(Le)),t.flatMap(a.decodeUnknownEffect(_))),new X)})}var ko=v.type().pipe(v.tagsExhaustive({ProviderError:()=>502,McpError:()=>502,SkillLoadFailed:()=>502,OpenapiResponseError:()=>502,WorkflowFailure:()=>422,HostRequestInvalid:()=>400,HostAccountsInvalid:()=>422,HostInputInvalid:()=>422,HostOperationNotFound:()=>404,HostKindMismatch:()=>409,HostToolNotFound:()=>404,HostToolBlocked:()=>403,HostToolApprovalRequired:()=>409,HostToolPolicyFailed:()=>500,HostOperationFailed:()=>500,DatabaseLimitExceeded:()=>422,DatabaseFieldReserved:()=>422,HostDeclarationInvalid:()=>500,HostEvaluationFailed:()=>500,HostOutputInvalid:()=>500,ElicitationFailed:()=>422})),Nr=n=>(e,o)=>t.gen(function*(){if(e.method!==\"POST\")return yield*t.fail(new Oe);let r=yield*t.tryPromise({try:()=>e.json(),catch:()=>new Oe}),i=yield*a.decodeUnknownEffect(zn)(r,{onExcessProperty:\"error\"}).pipe(t.mapError(()=>new Oe));yield*t.annotateCurrentSpan({\"executor.operation\":i.operation,...i.operation===\"call\"?{\"executor.tool.name\":i.tool}:{}});let s=!1,c=[],u=yield*So(n,i,o,e.signal,c).pipe(t.provideService(it,{failed:()=>{s=!0}}),t.tapError(y=>(y._tag===\"HostEvaluationFailed\"||y._tag===\"HostOperationFailed\"||y._tag===\"HostDeclarationInvalid\")&&y.errorName!==void 0?t.annotateCurrentSpan({\"error.type\":y.errorName,...y.source===void 0?{}:{\"executor.failure.source\":y.source},...y.code===void 0?{}:{\"executor.failure.code\":y.code}}):t.void),i.operation===\"call\"||i.operation===\"query\"||i.operation===\"mutate\"?vt(i.operation):t.withSpan(`app.${i.operation}`));return s&&(yield*t.annotateCurrentSpan({\"executor.outcome\":\"failed\",\"error.type\":\"McpToolError\"})),Response.json({ok:!0,value:u,...s?{toolError:!0}:{},...c.length===0?{}:{events:c}})}).pipe(t.catch(r=>a.encodeEffect(Ye)(r).pipe(t.map(i=>Response.json({ok:!1,error:i},{status:ko(r)})),t.orDie)),t.catchCause(r=>U.hasInterrupts(r)?t.interrupt:t.logError(\"The app's request failed unexpectedly\").pipe(t.andThen(a.encodeEffect(Ye)(We(\"The app failed while it was loaded\",U.squash(r),Se(o.accounts)))),t.map(i=>Response.json({ok:!1,error:i},{status:500})),t.orDie)));export{Vt as a,Nr as b};\n","node_modules/apps/chunk-6IAPTKU4.js":"import{b as F,h as M,n as B}from\"./chunk-H64J6GLT.js\";import{Y as v,n as m,o as x,q as d,r as E,s as y}from\"./chunk-G6QGZRZI.js\";import{Bb as J,Sb as U,ba as C,ea as W,ga as j,ia as $,o as T,qb as I,tb as h,wb as K}from\"./chunk-DI7JLZ3C.js\";import{Ob as f,Q as N,rd as p}from\"./chunk-IRY5FGME.js\";var V=class extends p.TaggedError()(\"ResponseStatusError\",{status:p.Number}){get message(){return`Request failed with status ${this.status}`}},H=class extends p.TaggedError()(\"ResponseDecodeError\",{}){get message(){return\"Response body did not match the expected schema\"}};var g=e=>`${e} is a credential placement, not a string. Build placement values with t\\`...\\`, such as t\\`Bearer \\${token}\\`, instead of an untagged template literal or string concatenation.`,R=class{#e;constructor(t){this.#e=t}[Symbol.toPrimitive](){throw new TypeError(g(this.#e))}toString(){throw new TypeError(g(this.#e))}toJSON(){throw new TypeError(g(this.#e))}},A=class extends R{field;constructor(t){super(`The field reference ${JSON.stringify(t)}`),this.field=t}},w=class extends R{parts;constructor(t){super(\"A t`...` value\"),this.parts=t}},k=e=>{if(typeof e==\"string\")return e===\"\"?[]:[e];if(e instanceof A)return[{field:e.field}];if(e instanceof w)return e.parts;throw new TypeError(`A credential placement interpolates text, a field reference, t\\`...\\` or base64(...), not ${typeof e}.`)},L=e=>e.reduce((t,n)=>{let r=t.at(-1);return typeof n==\"string\"&&typeof r==\"string\"?t[t.length-1]=r+n:t.push(n),t},[]),q=(e,...t)=>new w(L(e.flatMap((n,r)=>[...k(n),...r<t.length?k(t[r]):[]]))),Z=e=>{let t=k(e).map(n=>{if(typeof n==\"object\"&&\"base64\"in n)throw new TypeError(\"base64(...) cannot contain another base64(...).\");return n});if(t.length===0)throw new TypeError(\"base64(...) needs a value.\");return new w([{base64:t}])},z=e=>{let t=k(e);if(t.length===0)throw new TypeError(\"A credential placement needs a value.\");return L(t)},Q=(e,t)=>({in:\"header\",name:e.toLowerCase(),value:z(t)}),ce=(e,t)=>({in:\"query\",name:e,value:z(t)}),le=e=>Q(\"authorization\",q`Bearer ${e}`),pe=(e,t)=>Q(\"authorization\",q`Basic ${Z(q`${e}:${t}`)}`),ue=(e,t,n,r)=>{let i=new Set(t),a=new Proxy(Object.fromEntries(t.map(s=>[s,new A(s)])),{get:(s,o)=>{if(typeof o==\"string\"&&!i.has(o))throw new TypeError(`The ${e} request references \"${o}\", which is not one of its fields: ${t.join(\", \")}.`);return Reflect.get(s,o)}}),l=r(a),u=Array.isArray(l)?l:[l];if(u.length===0)throw new TypeError(`The ${e} request declares no placements.`);if(!u.every(p.is(C)))throw new TypeError(`The ${e} request must return header(...) or query(...) placements, or an array of them.`);for(let s of u){let o=W(s);for(let c of o){if(!i.has(c))throw new TypeError(`The ${e} request references \"${c}\", which is not one of its fields: ${t.join(\", \")}.`);if(n?.[c]===\"raw\")throw new TypeError(`The ${e} request references the raw() field \"${c}\". App code reads raw fields as real values, so they are never placed; remove raw() or the reference.`)}if(![...o].some(c=>n?.[c]===void 0))throw new TypeError(`The ${e} request's ${s.in} ${s.name} references no secret field. A placement places a secret: reference a field that is not plain() or raw().`)}return j(u)},_=e=>`The ${e} account declares no request. Declare where its credentials go with request, such as request: ({ token }) => bearer(token), to use headers() and url().`,de=(e,t)=>{let n=typeof e.fields==\"object\"&&e.fields!==null?e.fields:{},r=a=>N.getOrThrowWith($(a,n),l=>new TypeError(l.message)),i=()=>{if(t===void 0||t.length===0)throw new TypeError(_(e.method));return t};return Object.defineProperties(e,{headers:{enumerable:!1,value:()=>Object.fromEntries(i().filter(a=>a.in===\"header\").map(a=>[a.name,r(a)]))},url:{enumerable:!1,value:a=>{let l=new URL(a);for(let u of i())u.in===\"query\"&&l.searchParams.set(u.name,r(u));return l.href}}})};var S=Symbol(\"apps.Workflow\"),he=(e,t)=>({[S]:{input:d(y(e.input,\"The workflow input\")),...e.output===void 0?{}:{output:d(y(e.output,\"The workflow output\"))},...e.description===void 0?{}:{description:e.description},run:(n,r)=>m(t,\"workflow\")(n,r)}}),G=e=>{if(!(typeof e!=\"object\"||e===null||!(S in e)))return e[S]};var D=Symbol(\"apps.Event\"),ee=new Set([\"string\",\"number\",\"integer\",\"boolean\"]),te=e=>{let t=e.type;if(typeof t==\"string\")return ee.has(t);let n=Array.isArray(e.enum)?e.enum:\"const\"in e?[e.const]:void 0;return n!==void 0&&n.length>0&&n.every(r=>[\"string\",\"number\",\"boolean\"].includes(typeof r))},Ae=e=>{let t=e.filters??{},n=Object.fromEntries(Object.entries(t).map(([r,i])=>[r,d(y(i,`The event filter ${JSON.stringify(r)}`))]));for(let[r,i]of Object.entries(n)){let a=f.runSync(v(i));if(!te(a))throw new TypeError(`The event filter ${JSON.stringify(r)} must be a string, number, boolean or literal`)}return{[D]:{description:e.description,filters:n,payload:d(y(e.payload,\"The event payload\"))},description:e.description,filters:t,payload:e.payload}},X=e=>typeof e==\"object\"&&e!==null&&D in e?e[D]:void 0,ke=e=>f.forEach(Object.entries(e),([t,n])=>f.gen(function*(){let r=yield*v(p.Struct(n.filters)),i=yield*v(n.payload);return[t,{description:n.description,filters:r,payload:i}]})).pipe(f.map(t=>Object.fromEntries(t))),be=e=>({emit:(t,n,...r)=>{let i=r[0]??{},a=Object.hasOwn(e.events,t)?e.events[t]:void 0;if(a===void 0)throw new TypeError(`This app declares no event named \"${t}\"`);if(e.emitted.length>=h.maxEventsPerInvocation)throw new RangeError(`An invocation can emit at most ${h.maxEventsPerInvocation} events`);let l=p.decodeUnknownSync(a.payload)(n),u=p.decodeUnknownSync(p.Struct(a.filters))(i.filters??{}),s=i.account??e.sourceAccount??(e.attributable.length===1?e.attributable[0]:void 0)??null;if(s===null&&e.attributable.length>1)throw new TypeError(\"This invocation has several accounts; name the one the event came from with { account }\");if(s!==null&&!e.accounts.includes(s))throw new TypeError(\"The event's account is not one of this invocation's accounts\");let o=i.occurredAt===void 0?Date.now():i.occurredAt instanceof Date?i.occurredAt.getTime():i.occurredAt,c=p.decodeUnknownSync(K)({name:p.decodeUnknownSync(I)(t),id:i.id??crypto.randomUUID(),occurredAt:o,data:l,filters:u,account:s});if(new TextEncoder().encode(JSON.stringify(c.data)).byteLength>h.maxDataBytes)throw new RangeError(`An event's data can be at most ${h.maxDataBytes} bytes of JSON; send a summary and a tool to read the rest`);e.emitted.push(c)}});var P=Symbol(\"apps.App\"),je=e=>typeof e==\"object\"&&e!==null&&P in e,$e=e=>e[P];function Y(e){if(\"queries\"in e||\"mutations\"in e)throw new Error(\"Put queries and mutations in a router under tools\")}function ne(e){Y(e);let t=e.webhooks===void 0?{}:{webhooks:Object.fromEntries(Object.entries(e.webhooks).map(([s,o])=>[s,{...o,...o.register===void 0?{}:{register:m(x(o,\"register\"),\"webhook\")},handle:m(x(o,\"handle\"),\"webhook\"),...o.unregister===void 0?{}:{unregister:m(x(o,\"unregister\"),\"webhook\")},...\"config\"in o&&E(o.config)?{config:d(o.config)}:{},...\"state\"in o&&E(o.state)?{state:d(o.state)}:{}}]))},n=e.workflows===void 0?{}:{workflows:Object.fromEntries(Object.entries(e.workflows).map(([s,o])=>{let c=G(o);if(c===void 0)throw new Error(\"Invalid workflow declaration\");return[s,c]}))},r=e.tools===void 0?void 0:M(e.tools);if(e.tools!==void 0&&r===void 0)throw new Error(\"tools must be a router\");let i=r===void 0?{}:{tools:r},a=r?.kind===\"router\"?B(r):[],l=new Set;for(let{operation:s}of a)if(s.kind===\"mutation\"){if(l.has(s))throw new Error(\"A mutation can be mounted at only one path in tools\");l.add(s)}let u=e.schedules===void 0?{}:{schedules:Object.fromEntries(Object.entries(e.schedules).map(([s,o])=>{let c=F(o.operation),b=a.find(({operation:O})=>O===c&&O.kind===\"mutation\");if(b===void 0)throw new Error(\"A schedule must reference a mutation in this app's tools\");if(o.scope===\"app\"&&b.operation.approval!==void 0)throw new Error(\"An app schedule must reference a mutation without an approval\");return[s,{...o.scope===\"app\"?{scope:\"app\"}:{},timing:p.decodeUnknownSync(U)(o.timing),input:p.decodeUnknownSync(T)(o.input),tool:b.name}]}))};return{...e,...t,...n,...i,...u}}function oe(e){if(\"accounts\"in e)throw new TypeError(\"Declare account requirements by scope: user: { accounts } for each caller's accounts, app: { accounts } for the app's own\");let t=e.app?.accounts??{},n=e.user?.accounts??{};for(let r of Object.keys(t))if(Object.hasOwn(n,r))throw new TypeError(`The requirement ${JSON.stringify(r)} is declared as both an app and a user account; name them differently`);return{app:t,user:n}}var Fe=(e,t)=>{let n=oe(e);typeof t!=\"function\"&&Y(t);let i=m(typeof t==\"function\"?t:async()=>t,\"factory\"),a=e.events===void 0?void 0:Object.fromEntries(Object.entries(e.events).map(([s,o])=>{let c=X(o);if(c===void 0)throw new TypeError(`The event ${JSON.stringify(s)} must be declared with event()`);return[s,c]})),l=e.icons===void 0?void 0:J(e.icons);if(l!==void 0)throw new TypeError(`The app's icons are invalid: ${l}`);let u={accounts:n,...a===void 0?{}:{events:a},...e.icons===void 0||e.icons.length===0?{}:{icons:e.icons},evaluate:s=>i(s).pipe(f.map(o=>ne(o)))};return{[P]:u,accounts:u.accounts,evaluate:s=>f.runPromise(i(s))}};export{V as a,H as b,q as c,Z as d,Q as e,ce as f,le as g,pe as h,ue as i,de as j,he as k,Ae as l,ke as m,be as n,je as o,$e as p,Fe as q};\n","node_modules/apps/openapi.js":"import{B as xr}from\"./chunk-OFSIEQZ2.js\";import{g as jr,h as Pr}from\"./chunk-U7D4LK7G.js\";import{a as Lr,b as $r}from\"./chunk-RKBZVLTP.js\";import{a as yt,b as jn,c as Pn,d as he,e as Rn,f as _r,g as Nr,h as re,i as Ot,j as Fn,k as wn,l as Mn,m as St,n as Ue,o as Zc,p as Ir,q as X,r as el,s as nl}from\"./chunk-4RDFZJBD.js\";import{b as yr,g as kr}from\"./chunk-H64J6GLT.js\";import{a as Cr}from\"./chunk-EYTDRABV.js\";import\"./chunk-CWIMLCDY.js\";import{I as hr,U as gt,X as gr,_ as Or,b as mr,ba as Sr,c as pt,ca as br,d as bn,da as Ar,f as dt,n as tn,o as rn,p as mt,v as ht}from\"./chunk-G6QGZRZI.js\";import{Ac as Tr,F as Ln,Ya as vr,ka as wr,ma as Er,na as An,oa as $n,p as ne,u as ft,w as dr}from\"./chunk-DI7JLZ3C.js\";import{D as ae,Ea as fr,Gc as Me,Hc as ut,Ob as d,Qd as Ee,Rb as pr,_ as Sn,qa as In,ra as Cn,rd as u,xc as Ce}from\"./chunk-IRY5FGME.js\";import\"./chunk-OOJM4CTU.js\";var Rr=()=>import(\"./es-KUCVESUL.js\").then(e=>e.default);var ho=u.decodeUnknownOption(Nr),Fr=e=>{let n=ho(e.headers[\"content-type\"]?.split(\";\")[0]?.trim().toLowerCase()),t=e.headers[\"content-length\"],r=t===void 0||!/^\\d{1,15}$/.test(t)?void 0:Number(t);return{status:e.status,...ae.isSome(n)?{contentType:n.value}:{},...r===void 0?{}:{bytes:r}}},go=u.decodeUnknownOption(u.Struct({recovery:wr}));function yo(e){return d.gen(function*(){if(!/^application\\/(?:[\\w.-]+\\+)?json$/i.test(e.headers[\"content-type\"]?.split(\";\")[0]?.trim()??\"\"))return;let n=e.headers[\"content-length\"];if(!(n!==void 0&&Number(n)>$n.maxBodyBytes))return yield*e.stream.pipe(Ee.mapError(()=>new re({reason:\"request\",status:e.status})),Ee.limitBytes($n.maxBodyBytes,()=>Ee.fail(new re({reason:\"request\",status:e.status}))),Ee.decodeText,Ee.mkString,d.flatMap(u.decodeUnknownEffect(u.fromJsonString(u.Json))),d.timeout($n.readTimeoutMs))}).pipe(d.catch(()=>d.succeed(void 0)))}function Oo(e,n,t){return d.gen(function*(){let r=t.filter(i=>i.status===e);for(let i of r){let o=yield*u.decodeUnknownEffect(i.decoder)(n).pipe(d.option);if(ae.isSome(o)){let s=i.message.source===\"schema\"?ae.some({message:i.message.value}):u.decodeUnknownOption(u.Struct({message:Er.fields.message}))(o.value);if(ae.isNone(s))continue;let a=go(o.value);return new An({code:i.code,status:e,message:s.value.message,...ae.isSome(a)?{recovery:a.value.recovery}:{}})}}}).pipe(d.catch(()=>d.succeed(void 0)))}var De=u.decodeUnknownSync(u.Record(u.String,u.Unknown));function Be(e){if(typeof e==\"string\"||typeof e==\"number\"||typeof e==\"boolean\")return String(e);throw new Error(\"This parameter requires scalar values\")}var So=u.decodeUnknownSync(u.Struct({url:u.String,method:u.String,headers:u.Record(u.String,u.String),body:u.optional(u.Union([u.String,u.instanceOf(Blob),u.instanceOf(FormData)]))})),bo=new Set([\":\",\"@\",\"!\",\"$\",\"&\",\"'\",\"(\",\")\",\"*\",\"+\",\",\",\";\",\"=\",\"/\"]);function Ao(e){let n=Array.isArray(e)?e.map(Be).join(\",\"):Be(e);if(/[?#\\\\]/.test(n))throw new Error(\"This path value contains a forbidden character\");let t=n.replace(/%[0-9A-Fa-f]{2}|[^]/gu,r=>{if(r.length===3&&r.startsWith(\"%\")){if(\"./\\\\?#%\".includes(String.fromCharCode(Number.parseInt(r.slice(1),16))))throw new Error(\"This path value contains a forbidden escape\");return r}return bo.has(r)?r:encodeURIComponent(r)});if(t.split(\"/\").some(r=>r===\"\"||r===\".\"||r===\"..\"))throw new Error(\"This path value would change the request path\");return t}function wo(e){let n=e.baseUrl.replace(/\\/$/,\"\")+e.path,t=\"executorPathParameter\";for(;n.includes(t);)t+=\"_\";let r=[],i=n.replace(/\\{[^{}]+\\}/g,s=>{let a=e.request.parameters.find(f=>f.in===\"path\"&&f.name===s.slice(1,-1));if(a===void 0)throw new Error(\"A path parameter is not declared\");let c=`${t}_${r.length}_`;return r.push({token:c,pattern:a.allowReserved===!0&&a.content===void 0?\".+\":\"[^/]+\"}),c}),o=new URL(i).pathname.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\");for(let s of r)o=o.replaceAll(s.token,s.pattern);return new RegExp(\"^\"+o+\"$\")}var Mr=e=>Uint8Array.from(atob(Be(e)),n=>n.charCodeAt(0));function Eo(e,n){let[t]=Object.keys(e.content??{});if(t===void 0)throw new Error(\"A querystring parameter declares no media type\");let r=Ue(t);if(r===\"form\"){let i=new URLSearchParams;for(let[o,s]of Object.entries(De(n)))for(let a of Array.isArray(s)?s:[s])i.append(o,Be(a));return i.toString()}return encodeURIComponent(r===\"json\"?JSON.stringify(n):Be(n))}function qe(e){let{methods:n,oauth:t}=e;function r(o,s){if(o.streaming===!0)return;let a={};if(s!==void 0){if(t.includes(s.method)){let l=s.fields.access_token;typeof l==\"string\"&&l.length>0&&(a[s.method]={token:{access_token:l}})}else if(Object.hasOwn(n,s.method)){let l=n[s.method]??[];for(let p of new Set(l.map(h=>h.scheme))){let h=l.filter(S=>S.scheme===p);if(!h.some(({field:S})=>typeof s.fields[S]!=\"string\"||s.fields[S]===\"\"))for(let{part:S,field:y,prefix:I}of h){let M=Be(s.fields[y]);a[p]=S===\"value\"?I+M:{...De(a[p]??{}),[S]:M}}}}}let c=o.request.security,f=c.length===0?[]:c.map(Object.keys).find(l=>l.every(p=>Object.hasOwn(a,p)));return f===void 0?void 0:Object.fromEntries(f.map(l=>[l,a[l]]))}return{available:(o,s)=>r(o,s)!==void 0,call:(o,s,a,c)=>{let f={method:o.method,path:o.path};return d.scoped(d.gen(function*(){let l=yield*d.promise(Rr),p=yield*d.try({try:()=>{let x=De(s),U=r(o,a);if(U===void 0)throw new Error(\"The selected account cannot call this tool\");let F={},V=o.path,J=[],Se=o.request.parameters.filter(m=>{let E=x[m.in===\"header\"?\"headers\":m.in],C=E===void 0?void 0:De(E)[m.name];if(m.in===\"path\"&&m.allowReserved===!0&&m.content===void 0){if(C===void 0)throw new Error(\"A required path parameter is missing\");return V=V.replaceAll(`{${m.name}}`,Ao(C)),!1}if(m.in===\"querystring\"){if(C!==void 0)J.push(Eo(m,C));else if(m.required===!0)throw new Error(\"A required querystring parameter is missing\");return!1}return E!==void 0&&(F[`${m.in}.${m.name}`]=C),!0}),we=o.request.requestBody?.content??{},le=x.contentType===void 0?Object.keys(we)[0]:Be(x.contentType),O=le===void 0?void 0:we[le],A=x.body;if(A!==void 0&&O!==void 0&&le!==void 0){let m=Ue(le);if(m===\"json\")A=JSON.stringify(A);else if(m===\"binary\")A=new Blob([Mr(A)]);else if(m===\"multipart\"){let E={...De(A)};for(let[C,D]of Object.entries(De(O.schema?.properties??{})))Mn(De(D))&&E[C]!==void 0&&(E[C]=new File([Mr(E[C])],C));A=E}}let w=So(l.buildRequest({spec:{openapi:o.openapi,servers:[{url:o.baseUrl}],components:{securitySchemes:o.securitySchemes},paths:{[V]:{[o.method.toLowerCase()]:{...o.request,parameters:Se,operationId:o.name}}}},operationId:o.name,pathName:V,method:o.method.toLowerCase(),parameters:F,securities:{authorized:U},...le===void 0?{}:{requestContentType:le},...A===void 0?{}:{requestBody:A}}));if((w.url.replace(/^[^:]+:\\/\\/[^/]*/,\"\").split(/[?#]/)[0]??\"\").split(\"/\").some(m=>/^(?:\\.|%2e){1,2}$/i.test(m)))throw new Error(\"This path value would change the request path\");let k=new URL(w.url);J.length>0&&(k.search=[k.search.slice(1),...J].filter(m=>m!==\"\").join(\"&\"));let g=new URL(o.baseUrl).origin;if(k.origin!==g||!wo(o).test(k.pathname)||k.username||k.password)throw new Error(\"The request escaped its API operation\");let b=new Headers(w.headers);return b.has(\"user-agent\")||b.set(\"user-agent\",\"Executor\"),w.body instanceof FormData&&b.delete(\"content-type\"),{...w,url:k,headers:b}},catch:()=>new re({reason:\"invalid_input\",operation:f})}),h=yield*pt.HttpClient,S=yield*d.try({try:()=>mr.fromWeb(new Request(p.url,{method:p.method,headers:p.headers,...p.body===void 0?{}:{body:p.body}})),catch:()=>new re({reason:\"invalid_input\",operation:f})}),y=yield*pt.withScope(h).execute(S);if(yield*Cr(y),y.status<200||y.status>=300){let x=br(y.status,y.headers);if(x!==void 0&&x.reason!==\"rejected\")return yield*x;let U=x!==void 0||c.some(J=>J.status===y.status)?yield*yo(y):void 0,F=U===void 0?void 0:yield*Oo(y.status,U,c),V=U===void 0?void 0:Or(U);return yield*F??(x===void 0||V===void 0?x:Sr(x,{upstream:V}))??new re({reason:\"request\",operation:f,...Fr(y)})}if(y.status===204||p.method===\"HEAD\")return null;let I=new re({reason:\"request\",operation:f,...Fr(y)}),M=y.headers[\"content-type\"]??\"text/plain\",R=yield*y.stream.pipe(Ee.mapError(()=>I),Ee.limitBytes(Ot.maxBodyBytes,()=>Ee.fail(I)),Ee.runCollect,d.timeoutOrElse({duration:Ot.readTimeoutMs,orElse:()=>d.fail(I)}),dt(\"upstream\",\"provider.http.response.read\")),j=new Uint8Array(R.reduce((x,U)=>x+U.length,0)),Y=0;for(let x of R)j.set(x,Y),Y+=x.length;if(!wn(M))return{base64:pr.encode(j),contentType:M};let H=new TextDecoder().decode(j);return M.includes(\"json\")&&!Fn(M)?yield*u.decodeUnknownEffect(u.fromJsonString(u.Json))(H).pipe(d.mapError(()=>I)):H})).pipe(dt(\"upstream\",\"provider.openapi.call\",{attributes:{\"executor.tool.name\":o.name,\"http.request.method\":o.method}}),d.provideService(bn.RequestInit,{redirect:\"manual\"}),d.provide(bn.layer),d.mapError(l=>l instanceof ft&&a?.id!==void 0?Ar(l,a.id):l instanceof re||l instanceof An||l instanceof ft||l instanceof dr?l:new re({reason:\"request\",operation:f})))}}}function Ke(e,n=new Set){if(Array.isArray(e))for(let t of e)Ke(t,n);else if(e!==null&&typeof e==\"object\")for(let[t,r]of Object.entries(e))if(t!==\"$ref\"||typeof r!=\"string\")Ke(r,n);else{let i=r.startsWith(\"#/$defs/\")?Me.parseUriFragment(r):void 0;i?.[1]!==void 0&&n.add(i[1])}return n}var Un=e=>{let n=new Map;return t=>{let r=new Map,i=[...Ke(t)];for(let s=i.pop();s!==void 0;s=i.pop()){let a=Object.hasOwn(e,s)?e[s]:void 0;if(a===void 0||r.has(s))continue;r.set(s,a);let c=n.get(s);c===void 0&&n.set(s,c=Ke(a)),i.push(...c)}if(r.size===0)return t;let o=t.$defs;return{...t,$defs:{...Object.fromEntries(r),...o!==null&&typeof o==\"object\"&&!Array.isArray(o)?o:{}}}}},Ur={path:\"path\",query:\"query\",headers:\"header\"},on=e=>e!==null&&typeof e==\"object\"&&!Array.isArray(e),Dr=(e,n)=>Object.keys(Ur).flatMap(t=>Object.entries(n?.[t]??{}).filter(([r])=>e.request.parameters.some(i=>i.name===r&&i.in===Ur[t])).map(([r,i])=>({group:t,name:r,value:i}))),bt=(e,n,t)=>{let r=Dr(e,n);if(!r.length||!on(e.input.properties))return e.input;let i={...e.input.properties},o=Array.isArray(e.input.required)?e.input.required:[];for(let s of new Set(r.map(a=>a.group))){let a=i[s];if(!on(a))continue;let c=r.filter(p=>p.group===s),f=(Array.isArray(a.required)?a.required:[]).filter(p=>!c.some(h=>h.name===p)),l=on(a.properties)?a.properties:{};i[s]={...a,required:f,...t?{properties:{...l,...Object.fromEntries(c.map(({name:p,value:h})=>{let S=on(l[p])?l[p]:{},y=\"Optional; defaults to the value bound to the selected account.\",I=typeof S.description==\"string\"?`${S.description} ${y}`:y;return[p,{...S,description:I,default:h}]}))}}:{}},f.length||(o=o.filter(p=>p!==s))}return{...e.input,properties:i,required:o}},vo=(e,n,t)=>{let r=Dr(e,n);if(!r.length||!on(t))return t;let i={...t};for(let{group:o,name:s,value:a}of r){let c=i[o]??{};if(!on(c))return t;Object.hasOwn(c,s)||(i[o]={...c,[s]:a})}return i},At=(e,n,t)=>d.gen(function*(){let r=Un(n),i=yield*gt(()=>r(bt(e,t,!1))),o=yield*d.forEach(e.errorResponses??[],s=>gt(()=>r(s.schema)).pipe(d.map(a=>({...s,decoder:a}))));return{input:i,errors:o,output:hr(()=>e.outputSchema===void 0?void 0:r(e.outputSchema))}}),Dn=(e,n)=>d.gen(function*(){let t=yield*u.decodeUnknownEffect(_r)(e).pipe(d.mapError(()=>new re({reason:\"invalid_definition\"}))),r=qe(t),i=yield*d.forEach(t.operations.filter(o=>r.available(o,t.account)),o=>d.gen(function*(){let s=n?.get(o.name)??(yield*At(o,t.definitions??{},t.parameterDefaults)),{input:a,errors:c}=s,f={description:o.description,readOnly:Rn(o.method),input:a,run:(p,h)=>u.decodeUnknownEffect(a)(vo(o,t.parameterDefaults,h)).pipe(d.mapError(()=>new re({reason:\"invalid_input\",operation:{method:o.method,path:o.path}})),d.flatMap(S=>r.call(o,S,t.account,c).pipe(d.provideService(bn.Fetch,t.fetch??globalThis.fetch))))};return o.outputSchema!==void 0&&Object.defineProperty(f,\"outputSchema\",{enumerable:!0,get:s.output}),[o.name,f]}));return Object.fromEntries(i)});var To=e=>e.replace(/([a-z0-9])([A-Z])/g,\"$1 $2\").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g,\"$1 $2\").replace(/[^a-zA-Z0-9]+/g,\" \").trim().split(/\\s+/).filter(n=>n.length>0).map(n=>n.toLowerCase()),ve=e=>{let[n,...t]=To(e);return n===void 0?\"\":`${n}${t.map(r=>`${r[0]?.toUpperCase()??\"\"}${r.slice(1)}`).join(\"\")}`},En=e=>{let n=ve(e);return`${n[0]?.toUpperCase()??\"\"}${n.slice(1)}`},wt=/^v\\d+(?:[._-]\\d+)?$/i,Et=e=>e.split(\"/\").map(n=>n.trim()).filter(n=>n.length>0),Kr=e=>Et(e).filter(n=>!wt.test(n)&&n.toLowerCase()!==\"api\"&&!(n.startsWith(\"{\")&&n.endsWith(\"}\"))&&ve(n)!==\"\"),ko=e=>ve(e.tag??\"\")||ve(Kr(e.path)[0]??\"\")||\"root\",Br=(e,n)=>{let t=Kr(e.path).map(ve),r=t.filter(o=>o!==n),i=(r.length?r:t).map(En).join(\"\");return ve(`${e.method.toLowerCase()}${i||\"Operation\"}`)},xo=(e,n)=>{if(e.operationId===void 0)return Br(e,n);let[t,...r]=e.operationId.split(/[._/]+/).filter(s=>s.length>0),i=t!==void 0&&r.length>0&&ve(t).toLowerCase()===n.toLowerCase()?r.join(\" \"):e.operationId,o=ve(i);return o===\"\"||o===n?Br(e,n):o},_o=e=>Et(e).flatMap(n=>{if(wt.test(n)||n.toLowerCase()===\"api\")return[];let t=n.startsWith(\"{\")&&n.endsWith(\"}\"),r=ve(t?n.slice(1,-1):n);return r===\"\"?[]:[{key:`${t?\"{\":\"\"}${r}`,word:r,parameter:t}]}),qr=e=>e.map((n,t)=>n.parameter?`${e[t-1]?.parameter===!0?\"And\":\"By\"}${En(n.word)}`:En(n.word)).join(\"\"),No=e=>{let n=JSON.stringify([e.method.toUpperCase(),e.path,e.operationId??null]),t=0;for(let r=0;r<n.length;r++)t=(t<<5)-t+n.charCodeAt(r)|0;return Math.abs(t).toString(36).padStart(8,\"0\").slice(0,8)},vt=e=>{let n=e.map(r=>{let i=ko(r),o=xo(r,i),s=Et(r.path).map(f=>f.toLowerCase()).find(f=>wt.test(f)),a=s===void 0?i:`${i}.${ve(s)}`,c=_o(r.path);return{input:r,group:i,leaf:o,prefix:a,versionSegment:s,tokens:c,name:`${i}.${o}`}}),t=r=>{let i=new Map;for(let o of n)i.set(o.name,[...i.get(o.name)??[],o]);for(let o of i.values())if(o.length>1){let s=o.map(a=>r(a,o));for(let[a,c]of o.entries())c.name=s[a]??c.name}};return t(r=>r.versionSegment===void 0?r.name:`${r.prefix}.${r.leaf}`),t((r,i)=>{let o=new Set(r.tokens.map(a=>a.key).filter(a=>i.every(c=>c.tokens.some(f=>f.key===a)))),s=r.tokens.filter(a=>!o.has(a.key));return s.length===0?r.name:`${r.prefix}.${r.leaf}${qr(s)}`}),t(r=>`${r.prefix}.${r.leaf}${qr(r.tokens)}`),t(r=>`${r.prefix}.${r.leaf}${En(r.input.method)}`),t(r=>`${r.prefix}.${r.leaf}${En(r.input.method)}${No(r.input)}`),n.map(r=>({...r.input,name:r.name}))};var $=Symbol(\"NOT_RESOLVED\");function oe(e,n){return{tagName:e,nodeKind:\"scalar\",implicit:n.implicit??!1,matchByTagPrefix:n.matchByTagPrefix??!1,implicitFirstChars:n.implicitFirstChars??null,resolve:n.resolve,identify:n.identify,represent:n.represent??(t=>String(t)),representTagName:n.representTagName??(()=>e)}}function Mt(e,n){let t=n.finalize===void 0;return{tagName:e,nodeKind:\"sequence\",implicit:!1,matchByTagPrefix:n.matchByTagPrefix??!1,create:n.create,addItem:n.addItem,finalize:n.finalize??(r=>r),carrierIsResult:t,identify:n.identify,represent:n.represent??(r=>r),representTagName:n.representTagName??(()=>e)}}function Jn(e,n){let t=n.finalize===void 0;return{tagName:e,nodeKind:\"mapping\",implicit:!1,matchByTagPrefix:n.matchByTagPrefix??!1,create:n.create,addPair:n.addPair,has:n.has,keys:n.keys,get:n.get,finalize:n.finalize??(r=>r),carrierIsResult:t,identify:n.identify,represent:n.represent??(r=>r),representTagName:n.representTagName??(()=>e)}}var Io=oe(\"tag:yaml.org,2002:str\",{resolve:e=>e,identify:e=>typeof e==\"string\"}),Co=[\"\",\"~\",\"null\",\"Null\",\"NULL\"],Lo=oe(\"tag:yaml.org,2002:null\",{implicit:!0,implicitFirstChars:[\"\",\"~\",\"n\",\"N\"],resolve:e=>Co.indexOf(e)!==-1?null:$,identify:e=>e===null,represent:()=>\"null\"}),$o=oe(\"tag:yaml.org,2002:null\",{implicit:!0,implicitFirstChars:[\"n\"],resolve:(e,n)=>e===\"null\"||n&&e===\"\"?null:$,identify:e=>e===null,represent:()=>\"null\"}),jo=[\"\",\"~\",\"null\",\"Null\",\"NULL\"],Po=oe(\"tag:yaml.org,2002:null\",{implicit:!0,implicitFirstChars:[\"\",\"~\",\"n\",\"N\"],resolve:e=>jo.indexOf(e)!==-1?null:$,identify:e=>e===null,represent:()=>\"null\"}),Ro=[\"true\",\"True\",\"TRUE\"],Fo=[\"false\",\"False\",\"FALSE\"],Mo=oe(\"tag:yaml.org,2002:bool\",{implicit:!0,implicitFirstChars:[\"t\",\"T\",\"f\",\"F\"],resolve:e=>Ro.indexOf(e)!==-1?!0:Fo.indexOf(e)!==-1?!1:$,identify:e=>Object.prototype.toString.call(e)===\"[object Boolean]\",represent:e=>e?\"true\":\"false\"}),Uo=[\"true\"],Do=[\"false\"],Bo=oe(\"tag:yaml.org,2002:bool\",{implicit:!0,implicitFirstChars:[\"t\",\"f\"],resolve:e=>Uo.indexOf(e)!==-1?!0:Do.indexOf(e)!==-1?!1:$,identify:e=>Object.prototype.toString.call(e)===\"[object Boolean]\",represent:e=>e?\"true\":\"false\"}),qo=[\"true\",\"True\",\"TRUE\",\"y\",\"Y\",\"yes\",\"Yes\",\"YES\",\"on\",\"On\",\"ON\"],Ko=[\"false\",\"False\",\"FALSE\",\"n\",\"N\",\"no\",\"No\",\"NO\",\"off\",\"Off\",\"OFF\"],Jo=oe(\"tag:yaml.org,2002:bool\",{implicit:!0,implicitFirstChars:[\"y\",\"Y\",\"n\",\"N\",\"t\",\"T\",\"f\",\"F\",\"o\",\"O\"],resolve:e=>qo.indexOf(e)!==-1?!0:Ko.indexOf(e)!==-1?!1:$,identify:e=>Object.prototype.toString.call(e)===\"[object Boolean]\",represent:e=>e?\"true\":\"false\"}),Wo=new RegExp(\"^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$\"),Yo=new RegExp(\"^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$\");function Ho(e){let n=e,t=1;return(n[0]===\"-\"||n[0]===\"+\")&&(n[0]===\"-\"&&(t=-1),n=n.slice(1)),n.startsWith(\"0b\")?t*parseInt(n.slice(2),2):n.startsWith(\"0o\")?t*parseInt(n.slice(2),8):n.startsWith(\"0x\")?t*parseInt(n.slice(2),16):t*parseInt(n,10)}function Vo(e,n){if(n){if(!Yo.test(e))return $}else if(!Wo.test(e))return $;let t=Ho(e);return Number.isFinite(t)?t:$}var ii=oe(\"tag:yaml.org,2002:int\",{implicit:!0,implicitFirstChars:[\"-\",\"+\",...\"0123456789\"],resolve:Vo,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf(\"e\")<0,represent:e=>e.toString(10)}),zo=new RegExp(\"^-?(?:0|[1-9][0-9]*)$\"),Go=new RegExp(\"^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$\");function Qo(e){let n=e,t=1;return(n[0]===\"-\"||n[0]===\"+\")&&(n[0]===\"-\"&&(t=-1),n=n.slice(1)),n.startsWith(\"0b\")?t*parseInt(n.slice(2),2):n.startsWith(\"0o\")?t*parseInt(n.slice(2),8):n.startsWith(\"0x\")?t*parseInt(n.slice(2),16):t*parseInt(n,10)}function Xo(e,n){if(n){if(!Go.test(e))return $}else if(!zo.test(e))return $;let t=Qo(e);return Number.isFinite(t)?t:$}var Zo=oe(\"tag:yaml.org,2002:int\",{implicit:!0,implicitFirstChars:[\"-\",...\"0123456789\"],resolve:Xo,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf(\"e\")<0,represent:e=>e.toString(10)}),es=new RegExp(\"^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$\");function ns(e){let n=e.replace(/_/g,\"\"),t=1;if((n[0]===\"-\"||n[0]===\"+\")&&(n[0]===\"-\"&&(t=-1),n=n.slice(1)),n.startsWith(\"0b\"))return t*parseInt(n.slice(2),2);if(n.startsWith(\"0x\"))return t*parseInt(n.slice(2),16);if(n.includes(\":\")){let r=0;for(let i of n.split(\":\"))r=r*60+Number(i);return t*r}return n!==\"0\"&&n[0]===\"0\"?t*parseInt(n,8):t*parseInt(n,10)}function ts(e){if(!es.test(e))return $;let n=ns(e);return Number.isFinite(n)?n:$}var It=oe(\"tag:yaml.org,2002:int\",{implicit:!0,implicitFirstChars:[\"-\",\"+\",...\"0123456789\"],resolve:ts,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf(\"e\")<0,represent:e=>e.toString(10)}),rs=new RegExp(\"^(?:[-+]?[0-9]+(?:\\\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))$\"),is=new RegExp(\"^(?:[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))$\");function os(e){if(!rs.test(e))return $;let n=e.toLowerCase(),t=n[0]===\"-\"?-1:1;if(\"+-\".includes(n[0])&&(n=n.slice(1)),n===\".inf\")return t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(n===\".nan\")return NaN;let r=t*parseFloat(n);return Number.isFinite(r)||is.test(e)?r:$}function ss(e){if(isNaN(e))return\".nan\";if(e===Number.POSITIVE_INFINITY)return\".inf\";if(e===Number.NEGATIVE_INFINITY)return\"-.inf\";if(Object.is(e,-0))return\"-0.0\";let n=e.toString(10);return/^[-+]?[0-9]+e/.test(n)?n.replace(\"e\",\".e\"):n}var oi=oe(\"tag:yaml.org,2002:float\",{implicit:!0,implicitFirstChars:[\"-\",\"+\",\".\",...\"0123456789\"],resolve:os,identify:e=>typeof e==\"number\"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf(\"e\")>=0),represent:ss}),as=new RegExp(\"^-?(?:0|[1-9][0-9]*)(?:\\\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$\"),cs=new RegExp(\"^(?:[-+]?[0-9]+(?:\\\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))$\");function ls(e,n){if(n){if(!cs.test(e))return $;let r=e.toLowerCase(),i=r[0]===\"-\"?-1:1;if(\"+-\".includes(r[0])&&(r=r.slice(1)),r===\".inf\")return i===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(r===\".nan\")return NaN;let o=i*parseFloat(r);return Number.isFinite(o)?o:$}if(!as.test(e))return $;let t=Number(e);return Number.isFinite(t)?t:$}function us(e){if(isNaN(e))return\".nan\";if(e===Number.POSITIVE_INFINITY)return\".inf\";if(e===Number.NEGATIVE_INFINITY)return\"-.inf\";if(Object.is(e,-0))return\"-0.0\";let n=e.toString(10);return/^[-+]?[0-9]+e/.test(n)?n.replace(\"e\",\".e\"):n}var fs=oe(\"tag:yaml.org,2002:float\",{implicit:!0,implicitFirstChars:[\"-\",...\"0123456789\"],resolve:ls,identify:e=>typeof e==\"number\"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf(\"e\")>=0),represent:us}),ps=new RegExp(\"^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\\\.[0-9_]*|[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))$\"),ds=new RegExp(\"^(?:[-+]?\\\\.(?:inf|Inf|INF)|\\\\.(?:nan|NaN|NAN))$\");function ms(e){if(!ps.test(e))return $;let n=e.toLowerCase().replace(/_/g,\"\"),t=n[0]===\"-\"?-1:1;if(\"+-\".includes(n[0])&&(n=n.slice(1)),n===\".inf\")return t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(n===\".nan\")return NaN;let r=0;if(n.includes(\":\")){for(let i of n.split(\":\"))r=r*60+Number(i);r*=t}else r=t*parseFloat(n);return Number.isFinite(r)||ds.test(e)?r:$}function hs(e){if(isNaN(e))return\".nan\";if(e===Number.POSITIVE_INFINITY)return\".inf\";if(e===Number.NEGATIVE_INFINITY)return\"-.inf\";if(Object.is(e,-0))return\"-0.0\";let n=e.toString(10);return/^[-+]?[0-9]+e/.test(n)?n.replace(\"e\",\".e\"):n}var Ct=oe(\"tag:yaml.org,2002:float\",{implicit:!0,implicitFirstChars:[\"-\",\"+\",\".\",...\"0123456789\"],resolve:ms,identify:e=>typeof e==\"number\"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf(\"e\")>=0),represent:hs}),gs=oe(\"tag:yaml.org,2002:merge\",{implicit:!0,implicitFirstChars:[\"<\"],resolve:(e,n)=>e===\"<<\"||n&&e===\"\"?\"<<\":$,identify:()=>!1}),ys=/^[A-Za-z0-9+/]*={0,2}$/;function Os(e){let n=e.replace(/\\s/g,\"\");if(n.length%4!==0||!ys.test(n))return $;let t=atob(n),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}function Ss(e){let n=\"\";for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return btoa(n)}var bs=oe(\"tag:yaml.org,2002:binary\",{resolve:Os,identify:e=>Object.prototype.toString.call(e)===\"[object Uint8Array]\",represent:Ss}),As=new RegExp(\"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$\"),ws=new RegExp(\"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\\\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\\\.([0-9]*))?(?:[ \\\\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$\");function Jr(e,n,t,r=0,i=0,o=0,s=0){let a=new Date(Date.UTC(e,n,t,r,i,o,s));return a.setUTCFullYear(e,n,t),a}function Es(e){let n=As.exec(e);if(n===null&&(n=ws.exec(e)),n===null)return $;let t=+n[1],r=+n[2]-1,i=+n[3];if(!n[4]){let l=Jr(t,r,i);return l.getUTCFullYear()!==t||l.getUTCMonth()!==r||l.getUTCDate()!==i?$:l}let o=+n[4],s=+n[5],a=+n[6],c=0;if(o>23||s>59||a>59)return $;if(n[7]){let l=n[7].slice(0,3);for(;l.length<3;)l+=\"0\";c=+l}let f=Jr(t,r,i,o,s,a,c);if(f.getUTCFullYear()!==t||f.getUTCMonth()!==r||f.getUTCDate()!==i)return $;if(n[9]){let l=+n[10],p=+(n[11]||0);if(l>23||p>59)return $;let h=(l*60+p)*6e4;f.setTime(f.getTime()-(n[9]===\"-\"?-h:h))}return f}var vs=oe(\"tag:yaml.org,2002:timestamp\",{implicit:!0,implicitFirstChars:[...\"0123456789\"],resolve:Es,identify:e=>e instanceof Date,represent:e=>e.toISOString()}),Ts=Mt(\"tag:yaml.org,2002:seq\",{create:()=>[],addItem:(e,n)=>{e.push(n)},identify:Array.isArray});function Wn(e){if(e===null||typeof e!=\"object\"||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===null||n===Object.prototype}function Wr(e,n){let t={};for(let r of n)e[r]!==void 0&&(t[r]=e[r]);return t}var ks=Mt(\"tag:yaml.org,2002:omap\",{create:()=>({list:[],seen:new Set}),addItem:(e,n)=>{let t;if(n instanceof Map){if(n.size!==1)return\"cannot resolve an ordered map item\";t=n.keys().next().value}else if(Wn(n)){let r=Object.keys(n);if(r.length!==1)return\"cannot resolve an ordered map item\";t=r[0]}else return\"cannot resolve an ordered map item\";return e.seen.has(t)?\"duplicate key in ordered map\":(e.seen.add(t),e.list.push(n),\"\")},finalize:e=>e.list,identify:()=>!1}),xs=Mt(\"tag:yaml.org,2002:pairs\",{create:()=>[],addItem:(e,n)=>{if(n instanceof Map)return n.size!==1?\"cannot resolve a pairs item\":(e.push(n.entries().next().value),\"\");if(Object.prototype.toString.call(n)!==\"[object Object]\")return\"cannot resolve a pairs item\";let t=n,r=Object.keys(t);return r.length!==1?\"cannot resolve a pairs item\":(e.push([r[0],t[r[0]]]),\"\")},identify:()=>!1}),_s=Jn(\"tag:yaml.org,2002:map\",{create:()=>({}),identify:Wn,represent:e=>{let n=new Map;for(let t of Object.keys(e))n.set(t,e[t]);return n},addPair:(e,n,t)=>{if(n!==null&&typeof n==\"object\")return\"object-based map does not support complex keys\";let r=String(n);return r===\"__proto__\"?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,\"\"},has:(e,n)=>n!==null&&typeof n==\"object\"?!1:Object.prototype.hasOwnProperty.call(e,String(n)),keys:e=>Object.keys(e),get:(e,n)=>{let t=String(n);return Object.prototype.hasOwnProperty.call(e,t)?e[t]:null}}),Ns=Jn(\"tag:yaml.org,2002:set\",{create:()=>new Set,identify:e=>e instanceof Set,represent:e=>{let n=new Map;for(let t of e)n.set(t,null);return n},addPair:(e,n,t)=>t!==null?\"cannot resolve a set item\":(e.add(n),\"\"),has:(e,n)=>e.has(n),keys:e=>e.keys(),get:()=>null});function Is(){return{scalar:Object.create(null),sequence:Object.create(null),mapping:Object.create(null)}}function Cs(){return{scalar:[],sequence:[],mapping:[]}}function Ls(e){let n=[];for(let t of e){let r=n.length;for(let i=0;i<n.length;i++){let o=n[i];if(o.nodeKind===t.nodeKind&&o.tagName===t.tagName&&o.matchByTagPrefix===t.matchByTagPrefix){r=i;break}}n[r]=t}return n}var Yn=class si{tags;implicitScalarTags;implicitScalarByFirstChar;implicitScalarAnyFirstChar;defaultScalarTag;defaultSequenceTag;defaultMappingTag;exact;prefix;constructor(n){let t=Ls(n),r=[],i=Is(),o=Cs();for(let l of t){if(l.nodeKind===\"scalar\"&&l.implicit){if(l.matchByTagPrefix)throw new Error(\"Implicit scalar tags cannot match by tag prefix\");r.push(l)}switch(l.nodeKind){case\"scalar\":l.matchByTagPrefix?o.scalar.push(l):i.scalar[l.tagName]=l;break;case\"sequence\":l.matchByTagPrefix?o.sequence.push(l):i.sequence[l.tagName]=l;break;case\"mapping\":l.matchByTagPrefix?o.mapping.push(l):i.mapping[l.tagName]=l;break}}let s=r.filter(l=>l.implicitFirstChars===null),a=new Set;for(let l of r)if(l.implicitFirstChars!==null)for(let p of l.implicitFirstChars)a.add(p);let c=new Map;for(let l of a)c.set(l,r.filter(p=>p.implicitFirstChars===null||p.implicitFirstChars.indexOf(l)!==-1));let f=i.scalar[\"tag:yaml.org,2002:str\"];if(!f)throw new Error(\"schema does not define the default scalar tag (tag:yaml.org,2002:str)\");this.tags=t,this.implicitScalarTags=r,this.implicitScalarByFirstChar=c,this.implicitScalarAnyFirstChar=s,this.defaultScalarTag=f,this.defaultSequenceTag=i.sequence[\"tag:yaml.org,2002:seq\"],this.defaultMappingTag=i.mapping[\"tag:yaml.org,2002:map\"],this.exact=i,this.prefix=o}lookupScalarTag(n){let t=this.exact.scalar[n];if(t)return t;for(let r of this.prefix.scalar)if(n.startsWith(r.tagName))return r}lookupSequenceTag(n){let t=this.exact.sequence[n];if(t)return t;for(let r of this.prefix.sequence)if(n.startsWith(r.tagName))return r}lookupMappingTag(n){let t=this.exact.mapping[n];if(t)return t;for(let r of this.prefix.mapping)if(n.startsWith(r.tagName))return r}resolveImplicitScalarTag(n){let t=this.implicitScalarByFirstChar.get(n.charAt(0))??this.implicitScalarAnyFirstChar;for(let i of t){let o=i.resolve(n,!1,i.tagName);if(o!==$)return{value:o,tag:i}}let r=this.defaultScalarTag;return{value:r.resolve(n,!1,r.tagName),tag:r}}withTags(...n){let t=[];for(let r of n)t=t.concat(r);return new si([...this.tags,...t])}},Ut=new Yn([Io,Ts,_s]),El=new Yn([...Ut.tags,$o,Bo,Zo,fs]),Dt=new Yn([...Ut.tags,Lo,Mo,ii,oi]),$s=new Yn([...Ut.tags,Po,Jo,It,Ct,vs,gs,bs,ks,xs,Ns]),js=$s.withTags({...It,resolve:(e,n,t)=>{let r=It.resolve(e,n,t);return r===$?ii.resolve(e,n,t):r}},{...Ct,resolve:(e,n,t)=>{let r=Ct.resolve(e,n,t);return r===$?oi.resolve(e,n,t):r}}),vl=Jn(\"tag:yaml.org,2002:map\",{create:()=>new Map,addPair:(e,n,t)=>(e.set(n,t),\"\"),has:(e,n)=>e.has(n),keys:e=>e.keys(),get:(e,n)=>e.get(n),identify:e=>e instanceof Map||Wn(e),represent:e=>{if(e instanceof Map)return e;let n=new Map,t=e;for(let r of Object.keys(t))n.set(r,t[r]);return n}});function Yr(e){if(Array.isArray(e)){let n=Array.prototype.slice.call(e);for(let t=0;t<n.length;t++){if(Array.isArray(n[t]))return null;typeof n[t]==\"object\"&&Object.prototype.toString.call(n[t])===\"[object Object]\"&&(n[t]=\"[object Object]\")}return String(n)}return typeof e==\"object\"&&Object.prototype.toString.call(e)===\"[object Object]\"?\"[object Object]\":String(e)}var Tl=Jn(\"tag:yaml.org,2002:map\",{create:()=>({}),identify:Wn,represent:e=>{let n=new Map;for(let t of Object.keys(e))n.set(t,e[t]);return n},addPair:(e,n,t)=>{let r=Yr(n);return r===null?\"nested arrays are not supported inside keys\":(r===\"__proto__\"?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,\"\")},has:(e,n)=>{let t=Yr(n);return t!==null&&Object.prototype.hasOwnProperty.call(e,t)},keys:e=>Object.keys(e),get:(e,n)=>{let t=String(n);return Object.prototype.hasOwnProperty.call(e,t)?e[t]:null}}),Ps={maxLength:79,indent:1,linesBefore:3,linesAfter:2};function Tt(e,n,t,r,i){let o=\"\",s=\"\",a=Math.floor(i/2)-1;return r-n>a&&(o=\" ... \",n=r-a+o.length),t-r>a&&(s=\" ...\",t=r+a-s.length),{str:o+e.slice(n,t).replace(/\\t/g,\"\\u2192\")+s,pos:r-n+o.length}}function kt(e,n){return\" \".repeat(Math.max(n-e.length,0))+e}function Rs(e,n){if(!e.buffer)return null;let t={...Ps,...n},r=/\\r?\\n|\\r|\\0/g,i=[0],o=[],s,a=-1;for(;s=r.exec(e.buffer);)o.push(s.index),i.push(s.index+s[0].length),e.position<=s.index&&a<0&&(a=i.length-2);a<0&&(a=i.length-1);let c=\"\",f=Math.min(e.line+t.linesAfter,o.length).toString().length,l=t.maxLength-(t.indent+f+3);for(let h=1;h<=t.linesBefore&&!(a-h<0);h++){let S=Tt(e.buffer,i[a-h],o[a-h],e.position-(i[a]-i[a-h]),l);c=`${\" \".repeat(t.indent)}${kt((e.line-h+1).toString(),f)} | ${S.str}\n${c}`}let p=Tt(e.buffer,i[a],o[a],e.position,l);c+=`${\" \".repeat(t.indent)}${kt((e.line+1).toString(),f)} | ${p.str}\n`,c+=`${\"-\".repeat(t.indent+f+3+p.pos)}^\n`;for(let h=1;h<=t.linesAfter&&!(a+h>=o.length);h++){let S=Tt(e.buffer,i[a+h],o[a+h],e.position-(i[a]-i[a+h]),l);c+=`${\" \".repeat(t.indent)}${kt((e.line+h+1).toString(),f)} | ${S.str}\n`}return c.replace(/\\n$/,\"\")}function Hr(e,n){let t=\"\";return e.mark?(e.mark.name&&(t+=`in \"${e.mark.name}\" `),t+=`(${e.mark.line+1}:${e.mark.column+1})`,!n&&e.mark.snippet&&(t+=`\n\n${e.mark.snippet}`),`${e.reason} ${t}`):e.reason}var Ye=class ai extends Error{reason;mark;constructor(n,t){super(),this.name=\"YAMLException\",this.reason=n,this.mark=t,this.message=Hr(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(n){return`${this.name}: ${Hr(this,n)}`}static throwAt(n,t,r,i=\"\"){let o=0,s=0;for(let c=0;c<t;c++){let f=n.charCodeAt(c);f===10?(o++,s=c+1):f===13&&(o++,n.charCodeAt(c+1)===10&&c++,s=c+1)}let a={name:i,buffer:n,position:t,line:o,column:t-s};throw a.snippet=Rs(a),new ai(r,a)}},W={DOCUMENT:1,SEQUENCE:2,MAPPING:3,SCALAR:4,ALIAS:5,POP:6},L={PLAIN:1,SINGLE_QUOTED:2,DOUBLE_QUOTED:3,LITERAL_BLOCK:4,FOLDED_BLOCK:5},Le={BLOCK:1,FLOW:2},fe={CLIP:1,STRIP:2,KEEP:3},Fs=-1;function Vr(e){switch(e){case 48:return\"\\0\";case 97:return\"\\x07\";case 98:return\"\\b\";case 116:return\"\t\";case 9:return\"\t\";case 110:return`\n`;case 118:return\"\\v\";case 102:return\"\\f\";case 114:return\"\\r\";case 101:return\"\\x1B\";case 32:return\" \";case 34:return'\"';case 47:return\"/\";case 92:return\"\\\\\";case 78:return\"\\x85\";case 95:return\"\\xA0\";case 76:return\"\\u2028\";case 80:return\"\\u2029\";default:return\"\"}}var ci=new Array(256),li=new Array(256);for(let e=0;e<256;e++)ci[e]=Vr(e)?1:0,li[e]=Vr(e);function Ms(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function Us(e){return e>=48&&e<=57?e-48:(e|32)-97+10}function Ds(e){return e===120?2:e===117?4:8}function Bn(e,n,t){let r=0;for(;n<t;){let i=e.charCodeAt(n);if(i===10)r++,n++;else if(i===13)r++,n++,e.charCodeAt(n)===10&&n++;else if(i===32||i===9)n++;else break}return{position:n,breaks:r}}function Bt(e){return e===1?\" \":`\n`.repeat(e-1)}function Bs(e,n,t){let r=\"\",i=n,o=n,s=n;for(;i<t;){let a=e.charCodeAt(i);if(a===10||a===13){r+=e.slice(o,s);let c=Bn(e,i,t);r+=Bt(c.breaks),i=o=s=c.position}else i++,a!==32&&a!==9&&(s=i)}return r+e.slice(o,s)}function qs(e,n,t){let r=\"\",i=n,o=n,s=n;for(;i<t;){let a=e.charCodeAt(i);if(a===39)r+=e.slice(o,i)+\"'\",i+=2,o=s=i;else if(a===10||a===13){r+=e.slice(o,s);let c=Bn(e,i,t);r+=Bt(c.breaks),i=o=s=c.position}else i++,a!==32&&a!==9&&(s=i)}return r+e.slice(o,t)}function Ks(e,n,t){let r=\"\",i=n,o=n,s=n;for(;i<t;){let a=e.charCodeAt(i);if(a===92){r+=e.slice(o,i),i++;let c=e.charCodeAt(i);if(c===10||c===13)i=Bn(e,i,t).position;else if(c<256&&ci[c])r+=li[c],i++;else{let f=Ds(c),l=0;for(;f>0;f--){i++;let p=Us(e.charCodeAt(i));l=(l<<4)+p}r+=Ms(l),i++}o=s=i}else if(a===10||a===13){r+=e.slice(o,s);let c=Bn(e,i,t);r+=Bt(c.breaks),i=o=s=c.position}else i++,a!==32&&a!==9&&(s=i)}return r+e.slice(o,t)}function zr(e,n,t,r,i,o){let s=r<0?0:r,a=e.slice(n,t).replace(/\\r\\n?/g,`\n`),c=a===\"\"?[]:(a.endsWith(`\n`)?a.slice(0,-1):a).split(`\n`),f=\"\",l=!1,p=0,h=!1;for(let S of c){let y=0;for(;y<s&&S.charCodeAt(y)===32;)y++;if(r<0||y>=S.length){p++;continue}let I=S.slice(s),M=I.charCodeAt(0);o?M===32||M===9?(h=!0,f+=`\n`.repeat(l?1+p:p)):h?(h=!1,f+=`\n`.repeat(p+1)):p===0?l&&(f+=\" \"):f+=`\n`.repeat(p):f+=`\n`.repeat(l?1+p:p),f+=I,l=!0,p=0}return i===fe.KEEP?f+=`\n`.repeat(l?1+p:p):i!==fe.STRIP&&l&&(f+=`\n`),f}function Js(e,n){if(n.valueStart===Fs)return\"\";let{valueStart:t,valueEnd:r}=n;if(n.fast)return e.slice(t,r);switch(n.style){case L.SINGLE_QUOTED:return qs(e,t,r);case L.DOUBLE_QUOTED:return Ks(e,t,r);case L.LITERAL_BLOCK:return zr(e,t,r,n.indent,n.chomping,!1);case L.FOLDED_BLOCK:return zr(e,t,r,n.indent,n.chomping,!0);default:return Bs(e,t,r)}}var Ws=Object.assign(Object.create(null),{\"!\":\"!\",\"!!\":\"tag:yaml.org,2002:\"});function ui(e,n){if(e.startsWith(\"!<\")&&e.endsWith(\">\"))return decodeURIComponent(e.slice(2,-1));let t=e.indexOf(\"!\",1),r=t===-1?\"!\":e.slice(0,t+1),i=n?.[r]??Ws[r]??r;return decodeURIComponent(i)+decodeURIComponent(e.slice(r.length))}var sn=-1,Ys=\"tag:yaml.org,2002:merge\",qt={filename:\"\",schema:Dt,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};function Hs(e){return\"tagStart\"in e&&e.tagStart!==sn?e.tagStart:\"anchorStart\"in e&&e.anchorStart!==sn?e.anchorStart:\"valueStart\"in e&&e.valueStart!==sn?e.valueStart:\"start\"in e?e.start:0}function te(e,n){Ye.throwAt(e.source,e.position,n,e.filename)}function fi(e,n,t,r){try{return t.finalize(r)}catch(i){if(i instanceof Ye)throw i;Ye.throwAt(e.source,n,i instanceof Error?i.message:String(i),e.filename)}}function Vs(e,n){let t=Js(e.source,n),r=n.tagStart===sn?\"\":e.source.slice(n.tagStart,n.tagEnd),i=e.schema.defaultScalarTag;if(r!==\"\"){if(r===\"!\")return{value:t,tag:i};let o=ui(r,e.tagHandlers),s=e.schema.lookupScalarTag(o);if(s){let c=s.resolve(t,!0,o);return c===$&&te(e,`cannot resolve a node with !<${o}> explicit tag`),{value:c,tag:s}}let a=e.schema.lookupMappingTag(o)??e.schema.lookupSequenceTag(o);if(a){t!==\"\"&&te(e,`cannot resolve a node with !<${o}> explicit tag`);let c=a.create(o);return{value:a.carrierIsResult?c:fi(e,e.position,a,c),tag:a}}te(e,`unknown scalar tag !<${o}>`)}return n.style===L.PLAIN?e.schema.resolveImplicitScalarTag(t):{value:i.resolve(t,!1,i.tagName),tag:i}}function Gr(e,n,t){let r=n.tagStart===sn?\"\":e.source.slice(n.tagStart,n.tagEnd);return r===\"\"||r===\"!\"?t:ui(r,e.tagHandlers)}function pi(e){return e.nodeKind===\"mapping\"}function Qr(e){e.totalMergeKeys++,e.maxTotalMergeKeys!==-1&&e.totalMergeKeys>e.maxTotalMergeKeys&&te(e,`merge keys exceeded maxTotalMergeKeys (${e.maxTotalMergeKeys})`)}function Xr(e,n,t,r){Qr(e);for(let i of r.keys(t)){if(Qr(e),n.tag.has(n.value,i))continue;let o=n.tag.addPair(n.value,i,r.get(t,i));o&&te(e,o),n.overridable??=new Set,n.overridable.add(i)}}function zs(e,n,t,r){if(e.position=n.keyPosition,pi(r))Xr(e,n,t,r);else if(r.nodeKind===\"sequence\"&&Array.isArray(t)){t.length>100&&te(e,\"abnormal merge sequence size\");for(let i of t){let o=e.nodeTags.get(i);o||te(e,\"cannot merge mappings; the provided source object is unacceptable\"),Xr(e,n,i,o)}}else te(e,\"cannot merge mappings; the provided source object is unacceptable\")}function Gs(e,n,t,r,i){if(e.position=n.keyPosition,n.keyIsMerge){zs(e,n,r,i);return}!e.json&&n.tag.has(n.value,t)&&!n.overridable?.has(t)&&te(e,\"duplicated mapping key\");let o=n.tag.addPair(n.value,t,r);o&&te(e,o),n.overridable?.delete(t)}function xt(e,n,t){let r=e.frames[e.frames.length-1];if(r.kind===\"document\")r.value=n,r.hasValue=!0;else if(r.kind===\"sequence\"){pi(t)&&e.nodeTags.set(n,t);let i=r.tag.addItem(r.value,n,r.index++);i&&te(e,i)}else if(r.hasKey){let i=r.key;r.key=void 0,r.hasKey=!1,Gs(e,r,i,n,t)}else r.key=n,r.keyPosition=e.position,r.hasKey=!0,r.keyIsMerge=t.tagName===Ys}function _t(e,n,t,r,i){if(n.anchorStart!==sn){let o={value:t,tag:r,isValueFinal:i};return e.anchors.set(e.source.slice(n.anchorStart,n.anchorEnd),o),o}return null}function Qs(e,n){let t={...qt,...n,events:e,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,nodeTags:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;t.eventIndex<t.events.length;){let r=t.events[t.eventIndex++];switch(t.position=Hs(r),r.type){case W.DOCUMENT:t.anchors=new Map,t.nodeTags=new Map,t.aliasCount=0,t.tagHandlers=Object.create(null);for(let i of r.directives)i.kind===\"tag\"&&(t.tagHandlers[i.handle]=i.prefix);t.frames.push({kind:\"document\",position:t.position,value:void 0,hasValue:!1});break;case W.SCALAR:{let{value:i,tag:o}=Vs(t,r);_t(t,r,i,o,!0),xt(t,i,o);break}case W.SEQUENCE:{let i=Gr(t,r,\"tag:yaml.org,2002:seq\"),o=t.schema.lookupSequenceTag(i);o||te(t,`unknown sequence tag !<${i}>`);let s=o.create(i),a=_t(t,r,s,o,o.carrierIsResult);t.frames.push({kind:\"sequence\",position:t.position,value:s,tag:o,anchor:a,index:0});break}case W.MAPPING:{let i=Gr(t,r,\"tag:yaml.org,2002:map\"),o=t.schema.lookupMappingTag(i);o||te(t,`unknown mapping tag !<${i}>`);let s=o.create(i),a=_t(t,r,s,o,o.carrierIsResult);t.frames.push({kind:\"mapping\",position:t.position,value:s,tag:o,anchor:a,key:void 0,keyPosition:t.position,hasKey:!1,keyIsMerge:!1,overridable:null});break}case W.ALIAS:{t.maxAliases!==-1&&++t.aliasCount>t.maxAliases&&te(t,`aliases exceeded maxAliases (${t.maxAliases})`);let i=t.source.slice(r.anchorStart,r.anchorEnd),o=t.anchors.get(i);o||te(t,`unidentified alias \"${i}\"`),o.isValueFinal||te(t,`recursive alias \"${i}\" is not supported for tag ${o.tag.tagName} because it uses finalize()`),xt(t,o.value,o.tag);break}case W.POP:{let i=t.frames.pop();if(i.kind===\"mapping\"&&i.hasKey&&(t.position=i.keyPosition,te(t,\"incomplete mapping pair in event stream\")),i.kind===\"document\")t.documents.push(i.value);else{let o=i.tag.carrierIsResult?i.value:fi(t,i.position,i.tag,i.value);i.anchor&&(i.anchor.value=o,i.anchor.isValueFinal=!0),xt(t,o,i.tag)}break}}}return t.documents}var P=-1,di=Object.prototype.hasOwnProperty,ln=1,Lt=2,mi=3,qn=4,Xs=/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x84\\x86-\\x9F\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/,Zs=/[,\\[\\]{}]/,hi=/^(?:!|!!|![0-9A-Za-z-]+!)$/,$t=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\\-#;/?:@&=+$,_.!~*'()\\[\\]])`,gi=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\\-#;/?:@&=+$.~*'()_])`,ea=new RegExp(`^(?:${$t})*$`),na=new RegExp(`^(?:${gi})+$`),ta=new RegExp(`^(?:!(?:${$t})*|${gi}(?:${$t})*)$`),Kt={filename:\"\",maxDepth:100};function ra(e,n,t){e.events.push({type:W.DOCUMENT,explicitStart:n,explicitEnd:t,directives:e.directives})}function yi(e,n,t,r,i,o,s){e.events.push({type:W.SEQUENCE,start:n,anchorStart:t,anchorEnd:r,tagStart:i,tagEnd:o,style:s})}function jt(e,n,t,r,i,o,s){e.events.push({type:W.MAPPING,start:n,anchorStart:t,anchorEnd:r,tagStart:i,tagEnd:o,style:s})}function Zr(e,n){e.events.splice(n.eventsLength,0,{type:W.MAPPING,start:n.position,anchorStart:P,anchorEnd:P,tagStart:P,tagEnd:P,style:Le.FLOW})}function fn(e,n,t,r,i,o,s,a,c=fe.CLIP,f=-1,l=!1){e.events.push({type:W.SCALAR,valueStart:n,valueEnd:t,anchorStart:r,anchorEnd:i,tagStart:o,tagEnd:s,style:a,chomping:c,indent:f,fast:l})}function ia(e,n,t){e.events.push({type:W.ALIAS,anchorStart:n,anchorEnd:t})}function an(e){e.events.push({type:W.POP})}function ce(e){fn(e,P,P,P,P,P,P,L.PLAIN)}function ei(){return{anchorStart:P,anchorEnd:P,tagStart:P,tagEnd:P}}function cn(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,eventsLength:e.events.length}}function Je(e,n){e.position=n.position,e.line=n.line,e.lineStart=n.lineStart,e.lineIndent=n.lineIndent,e.firstTabInLine=n.firstTabInLine,e.events.length=n.eventsLength}function T(e,n){Ye.throwAt(e.input.slice(0,e.length),e.position,n,e.filename)}function Z(e){return e===10||e===13}function He(e){return e===9||e===32}function Ae(e){return He(e)||Z(e)}function ke(e){return e===0||Ae(e)}function Ve(e){return e===44||e===91||e===93||e===123||e===125}function oa(e){return e>=48&&e<=57?e-48:-1}function sa(e){if(e>=48&&e<=57)return e-48;let n=e|32;return n>=97&&n<=102?n-97+10:-1}function aa(e){return e===120?2:e===117?4:e===85?8:0}function ca(e){return e===48||e===97||e===98||e===116||e===9||e===110||e===118||e===102||e===114||e===101||e===32||e===34||e===47||e===92||e===78||e===95||e===76||e===80}function Kn(e){e.input.charCodeAt(e.position)===10?e.position++:(e.position++,e.input.charCodeAt(e.position)===10&&e.position++),e.line++,e.lineStart=e.position,e.lineIndent=0,e.firstTabInLine=-1}function ie(e,n){let t=0,r=e.input.charCodeAt(e.position),i=e.position===e.lineStart||Ae(e.input.charCodeAt(e.position-1));for(;r!==0;){for(;He(r);)i=!0,r===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(n&&i&&r===35)do r=e.input.charCodeAt(++e.position);while(!Z(r)&&r!==0);if(!Z(r))break;for(Kn(e),t++,i=!0,r=e.input.charCodeAt(e.position);r===32;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return t}function un(e,n=e.position){let t=e.input.charCodeAt(n);if((t===45||t===46)&&t===e.input.charCodeAt(n+1)&&t===e.input.charCodeAt(n+2)){let r=e.input.charCodeAt(n+3);return r===0||Ae(r)}return!1}function Oi(e){e.position===e.lineStart&&e.input.charCodeAt(e.position)===65279&&(e.position++,e.lineStart=e.position)}function Jt(e){if(e.position!==e.lineStart)return!1;if(un(e))return!0;if(e.input.charCodeAt(e.position)!==65279)return!1;let n=cn(e);Oi(e),ie(e,!0);let t=e.input.charCodeAt(e.position),r=e.position===e.lineStart&&(t===37||t===45&&un(e));return Je(e,n),r}function ni(e){let n=e.input.charCodeAt(e.position);for(;n!==0&&!Z(n);)n=e.input.charCodeAt(++e.position)}function Si(e,n,t){Xs.test(e.input.slice(n,t))&&T(e,\"the stream contains non-printable characters\")}function la(e,n,t){if(e.input.charCodeAt(e.position)!==33)return!1;n.tagStart!==P&&T(e,\"duplication of a tag property\");let r=e.position,i=!1,o=!1,s=\"!\",a=e.input.charCodeAt(++e.position);a===60?(i=!0,a=e.input.charCodeAt(++e.position)):a===33&&(o=!0,s=\"!!\",a=e.input.charCodeAt(++e.position));let c=e.position,f;if(i){for(;a!==0&&a!==62;)a=e.input.charCodeAt(++e.position);a!==62&&T(e,\"unexpected end of the stream within a verbatim tag\"),f=e.input.slice(c,e.position),e.position++}else{for(;a!==0&&!Ae(a)&&!(t&&Ve(a));)a===33&&(o?T(e,\"tag suffix cannot contain exclamation marks\"):(s=e.input.slice(c-1,e.position+1),hi.test(s)||T(e,\"named tag handle cannot contain such characters\"),o=!0,c=e.position+1)),a=e.input.charCodeAt(++e.position);f=e.input.slice(c,e.position),Zs.test(f)&&T(e,\"tag suffix cannot contain flow indicator characters\")}return f&&!(i?ea.test(f):na.test(f))&&T(e,`tag name cannot contain such characters: ${f}`),!i&&s!==\"!\"&&s!==\"!!\"&&!di.call(e.tagHandlers,s)&&T(e,`undeclared tag handle \"${s}\"`),n.tagStart=r,n.tagEnd=e.position,!0}function ua(e,n){if(e.input.charCodeAt(e.position)!==38)return!1;n.anchorStart!==P&&T(e,\"duplication of an anchor property\"),e.position++;let t=e.position;for(;e.input.charCodeAt(e.position)!==0&&!Ae(e.input.charCodeAt(e.position))&&!Ve(e.input.charCodeAt(e.position));)e.position++;return e.position===t&&T(e,\"name of an anchor node must contain at least one character\"),n.anchorStart=t,n.anchorEnd=e.position,!0}function fa(e,n){if(e.input.charCodeAt(e.position)!==42)return!1;(n.anchorStart!==P||n.tagStart!==P)&&T(e,\"alias node should not have any properties\"),e.position++;let t=e.position;for(;e.input.charCodeAt(e.position)!==0&&!Ae(e.input.charCodeAt(e.position))&&!Ve(e.input.charCodeAt(e.position));)e.position++;return e.position===t&&T(e,\"name of an alias node must contain at least one character\"),ia(e,t,e.position),!0}function Pt(e,n){ie(e,!1),e.lineIndent<n&&T(e,\"deficient indentation\")}function pa(e,n,t){if(e.input.charCodeAt(e.position)!==39)return!1;e.position++;let r=e.position,i=!0;for(;e.input.charCodeAt(e.position)!==0;){let o=e.input.charCodeAt(e.position);if(o===39){if(e.input.charCodeAt(e.position+1)===39){i=!1,e.position+=2;continue}let s=e.position;return e.position++,fn(e,r,s,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,L.SINGLE_QUOTED,fe.CLIP,-1,i),!0}Z(o)?(i=!1,Pt(e,n)):e.position===e.lineStart&&un(e)?T(e,\"unexpected end of the document within a single quoted scalar\"):o!==9&&o<32?T(e,\"expected valid JSON character\"):e.position++}T(e,\"unexpected end of the stream within a single quoted scalar\")}function da(e,n,t){if(e.input.charCodeAt(e.position)!==34)return!1;e.position++;let r=e.position,i=!0;for(;e.input.charCodeAt(e.position)!==0;){let o=e.input.charCodeAt(e.position);if(o===34){let s=e.position;return e.position++,fn(e,r,s,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,L.DOUBLE_QUOTED,fe.CLIP,-1,i),!0}if(o===92){i=!1;let s=e.input.charCodeAt(++e.position);if(Z(s))Pt(e,n);else if(ca(s))e.position++;else{let a=aa(s);for(a===0&&T(e,\"unknown escape sequence\");a-- >0;)e.position++,sa(e.input.charCodeAt(e.position))<0&&T(e,\"expected hexadecimal character\");e.position++}}else Z(o)?(i=!1,Pt(e,n)):e.position===e.lineStart&&un(e)?T(e,\"unexpected end of the document within a double quoted scalar\"):o!==9&&o<32?T(e,\"expected valid JSON character\"):e.position++}T(e,\"unexpected end of the stream within a double quoted scalar\")}function ma(e,n,t){let r=e.input.charCodeAt(e.position),i=fe.CLIP,o=-1,s=!1;if(r!==124&&r!==62)return!1;let a=r===124?L.LITERAL_BLOCK:L.FOLDED_BLOCK;for(e.position++;e.input.charCodeAt(e.position)!==0;){let S=e.input.charCodeAt(e.position),y=oa(S);if(S===43||S===45)i!==fe.CLIP&&T(e,\"repeat of a chomping mode identifier\"),i=S===43?fe.KEEP:fe.STRIP,e.position++;else if(y>=0)y===0&&T(e,\"bad explicit indentation width of a block scalar; it cannot be less than one\"),s&&T(e,\"repeat of an indentation width identifier\"),o=n+y-1,s=!0,e.position++;else break}let c=!1;for(;He(e.input.charCodeAt(e.position));)c=!0,e.position++;c&&e.input.charCodeAt(e.position)===35&&ni(e),Z(e.input.charCodeAt(e.position))?Kn(e):e.input.charCodeAt(e.position)!==0&&T(e,\"a line break is expected\");let f=s?o:-1,l=0,p=e.position,h=e.position;for(;e.input.charCodeAt(e.position)!==0;){let S=e.position,y=0;for(;e.input.charCodeAt(S+y)===32;)y++;let I=e.input.charCodeAt(S+y);if(I===0){f>=0?y>f&&(h=S+y):y>0&&(h=S+y);break}if(Jt(e))break;if(!s&&f===-1&&Z(I)&&(l=Math.max(l,y)),!s&&f===-1&&!Z(I)&&(I===9&&y<n&&(e.position=S+y,T(e,\"tab characters must not be used in indentation\")),y<l&&(e.position=S+y,T(e,\"bad indentation of a mapping entry\"))),f===-1&&I!==0&&!Z(I)&&y<n){e.lineIndent=y,e.position=S+y;break}!s&&I!==0&&!Z(I)&&f===-1&&(f=y);let M=f===-1?n+1:f;if(I!==0&&!Z(I)&&y<M){e.lineIndent=y,e.position=S+y;break}ni(e),h=e.position,Z(e.input.charCodeAt(e.position))&&(Kn(e),h=e.position)}return Si(e,p,h),fn(e,p,h,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,a,i,f),!0}function ha(e,n){let t=e.input.charCodeAt(e.position),r=n===ln;if(t===0||Ae(t)||t===35||t===38||t===42||t===33||t===124||t===62||t===39||t===34||t===37||t===64||t===96||r&&Ve(t))return!1;if(t===63||t===45){let i=e.input.charCodeAt(e.position+1);if(ke(i)||r&&Ve(i))return!1}return!0}function ga(e,n,t,r){if(!ha(e,t))return!1;let i=e.position,o=e.position,s=e.input.charCodeAt(e.position),a=t===ln,c=!1;for(;s!==0&&!Jt(e);){if(s===58){let f=e.input.charCodeAt(e.position+1);if(ke(f)||a&&Ve(f))break}else if(s===35){if(Ae(e.input.charCodeAt(e.position-1)))break}else{if(a&&Ve(s))break;if(Z(s)){let f=e.position,l=e.line,p=e.lineStart,h=e.lineIndent;if(ie(e,!1),e.lineIndent>=n){c=!0,s=e.input.charCodeAt(e.position);continue}e.position=f,e.line=l,e.lineStart=p,e.lineIndent=h;break}}He(s)||(o=e.position+1),s=e.input.charCodeAt(++e.position)}return o===i?!1:(Si(e,i,o),fn(e,i,o,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,L.PLAIN,fe.CLIP,-1,!c),!0)}function vn(e,n){let t=e.line;ie(e,!0),(e.line>t&&e.lineIndent<n||e.firstTabInLine!==-1&&e.lineIndent<n)&&T(e,\"deficient indentation\")}function ya(e,n,t){let r=e.input.charCodeAt(e.position),i=r===123,o=e.position,s=!0;if(r!==91&&r!==123)return!1;let a=i?125:93;for(i?jt(e,o,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Le.FLOW):yi(e,o,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Le.FLOW),e.position++;e.input.charCodeAt(e.position)!==0;){vn(e,n);let c=e.input.charCodeAt(e.position);if(c===a)return e.position++,an(e),!0;s?c===44&&T(e,\"expected the node content, but found ','\"):T(e,\"missed comma between flow collection entries\");let f=!1,l=!1;c===63&&Ae(e.input.charCodeAt(e.position+1))&&(f=l=!0,e.position+=1,vn(e,n));let p=e.line,h=cn(e),S=We(e,n,ln,!1,!0);vn(e,n),c=e.input.charCodeAt(e.position),(i||l||e.line===p)&&c===58?(f=!0,e.position++,vn(e,n),i||Zr(e,h),S||ce(e),We(e,n,ln,!1,!0)||ce(e),vn(e,n),i||an(e)):i&&f?(S||ce(e),ce(e)):i?ce(e):f&&(Zr(e,h),S||ce(e),ce(e),an(e)),c=e.input.charCodeAt(e.position),c===44?(s=!0,e.position++):s=!1}T(e,\"unexpected end of the stream within a flow collection\")}function ti(e,n,t){if(e.firstTabInLine!==-1||e.input.charCodeAt(e.position)!==45||!ke(e.input.charCodeAt(e.position+1)))return!1;for(yi(e,e.position,t.anchorStart,t.anchorEnd,t.tagStart,t.tagEnd,Le.BLOCK);e.input.charCodeAt(e.position)===45&&ke(e.input.charCodeAt(e.position+1));){e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,T(e,\"tab characters must not be used in indentation\"));let r=e.line;e.position++;let i=ie(e,!0)>0;if(e.firstTabInLine!==-1&&e.input.charCodeAt(e.position)===45&&ke(e.input.charCodeAt(e.position+1))&&T(e,\"bad indentation of a sequence entry\"),i&&e.lineIndent<=n?ce(e):We(e,n,mi,!1,!0),ie(e,!0),e.lineIndent<n||e.position>=e.length)break;e.lineIndent>n&&T(e,\"bad indentation of a sequence entry\"),e.line===r&&e.input.charCodeAt(e.position)===45&&ke(e.input.charCodeAt(e.position+1))&&T(e,\"bad indentation of a sequence entry\")}return an(e),!0}function Nt(e,n,t,r){let i=!1,o=!1,s=!1,a=!1;if(e.firstTabInLine!==-1)return!1;let c=e.input.charCodeAt(e.position);for(;c!==0;){!i&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,T(e,\"tab characters must not be used in indentation\"));let f=e.input.charCodeAt(e.position+1),l=e.line;if((c===63||c===58)&&ke(f))s||(jt(e,e.position,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,Le.BLOCK),s=!0),c===63?(i&&ce(e),o=!0,i=!0):(i||(ce(e),o=!0),i=!1),e.position+=1,a=!0;else{i&&(ce(e),i=!1);let p=cn(e);if(!We(e,t,Lt,!1,!0))break;if(e.line===l){for(c=e.input.charCodeAt(e.position);He(c);)c=e.input.charCodeAt(++e.position);if(c===58){if(c=e.input.charCodeAt(++e.position),ke(c)||T(e,\"a whitespace character is expected after the key-value separator within a block mapping\"),!s){for(Je(e,p),jt(e,p.position,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,Le.BLOCK),s=!0,We(e,t,Lt,!1,!0),c=e.input.charCodeAt(e.position);He(c);)c=e.input.charCodeAt(++e.position);e.position++}o=!0,i=!1,a=!1}else if(o)T(e,\"expected ':' after a mapping key\");else return r.anchorStart!==P||r.tagStart!==P?(Je(e,p),!1):!0}else if(o)T(e,\"can not read a block mapping entry; a multiline key may not be an implicit key\");else return r.anchorStart!==P||r.tagStart!==P?(Je(e,p),!1):!0}if(We(e,n,qn,!0,a)&&(a=!1),i||a&&(ce(e),a=!1),ie(e,!0),c=e.input.charCodeAt(e.position),(e.line===l||e.lineIndent>n)&&c!==0)T(e,\"bad indentation of a mapping entry\");else if(e.lineIndent<n)break}return o?(i&&ce(e),s&&an(e),!0):!1}function We(e,n,t,r,i,o=!0){e.depth>=e.maxDepth&&T(e,`nesting exceeded maxDepth (${e.maxDepth})`),e.depth++;let s=1,a=!1,c=!1,f=null,l=ei(),p=t===qn||t===mi,h=p,S=p;if(r&&ie(e,!0)&&(a=!0,e.lineIndent>n?s=1:e.lineIndent===n?s=0:s=-1),s===1)for(;;){let y=e.input.charCodeAt(e.position),I=cn(e);if(a&&s!==1&&(y===33||y===38))break;if(a&&S&&(l.tagStart!==P||l.anchorStart!==P)&&(y===33||y===38)){let M=cn(e),R=n+1;if(Nt(e,e.position-e.lineStart,R,l)&&e.events[M.eventsLength]?.type===W.MAPPING)return e.depth--,!0;Je(e,M)}if(a&&(y===33&&l.tagStart!==P||y===38&&l.anchorStart!==P)||!la(e,l,t===ln)&&!ua(e,l))break;f===null&&(f=I),ie(e,!0)?(a=!0,h=S,e.lineIndent>n?s=1:e.lineIndent===n?s=0:s=-1):h=!1}if(h&&(h=a||i),s===1||t===qn){let y=t===ln||t===Lt?n:n+1,I=e.position-e.lineStart;if(s===1)if(h&&(ti(e,I,l)||Nt(e,I,y,l))||ya(e,y,l))c=!0;else{let M=e.input.charCodeAt(e.position);if(f!==null&&o&&S&&!h&&M!==124&&M!==62){let R=cn(e),j=f.position-f.lineStart;Je(e,f),Nt(e,j,y,ei())&&e.events[R.eventsLength]?.type===W.MAPPING?c=!0:Je(e,R)}!c&&(p&&ma(e,y,l)||pa(e,y,l)||da(e,y,l)||fa(e,l)||ga(e,y,t,l))&&(c=!0)}else s===0&&(c=h&&ti(e,I,l))}return p=p&&!c,!c&&(l.anchorStart!==P||l.tagStart!==P||p)&&(fn(e,P,P,l.anchorStart,l.anchorEnd,l.tagStart,l.tagEnd,L.PLAIN),c=!0),e.depth--,c||l.anchorStart!==P||l.tagStart!==P}function Oa(e){if(e.lineIndent>0||e.input.charCodeAt(e.position)!==37)return!1;e.position++;let n=e.position;for(;e.input.charCodeAt(e.position)!==0&&!Ae(e.input.charCodeAt(e.position));)e.position++;let t=e.input.slice(n,e.position),r=[];for(t.length===0&&T(e,\"directive name must not be less than one character in length\");e.input.charCodeAt(e.position)!==0&&!Z(e.input.charCodeAt(e.position));){for(;He(e.input.charCodeAt(e.position));)e.position++;if(e.input.charCodeAt(e.position)===35||Z(e.input.charCodeAt(e.position))||e.input.charCodeAt(e.position)===0)break;let i=e.position;for(;e.input.charCodeAt(e.position)!==0&&!Ae(e.input.charCodeAt(e.position));)e.position++;r.push(e.input.slice(i,e.position))}if(Z(e.input.charCodeAt(e.position))&&Kn(e),t===\"YAML\"){e.directives.some(o=>o.kind===\"yaml\")&&T(e,\"duplication of %YAML directive\"),r.length!==1&&T(e,\"YAML directive accepts exactly one argument\");let i=/^([0-9]+)\\.([0-9]+)$/.exec(r[0]);i===null&&T(e,\"ill-formed argument of the YAML directive\"),parseInt(i[1],10)!==1&&T(e,\"unacceptable YAML version of the document\"),e.directives.push({kind:\"yaml\",version:r[0]})}else if(t===\"TAG\"){r.length!==2&&T(e,\"TAG directive accepts exactly two arguments\");let[i,o]=r;hi.test(i)||T(e,\"ill-formed tag handle (first argument) of the TAG directive\"),di.call(e.tagHandlers,i)&&T(e,`there is a previously declared suffix for \"${i}\" tag handle`),ta.test(o)||T(e,\"ill-formed tag prefix (second argument) of the TAG directive\"),e.tagHandlers[i]=o,e.directives.push({kind:\"tag\",handle:i,prefix:o})}return!0}function Sa(e){e.directives=[],e.tagHandlers=Object.create(null);let n=!1;for(ie(e,!0);Oa(e);)n=!0,ie(e,!0);let t=!1,r=!1,i=!0;if(e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45&&ke(e.input.charCodeAt(e.position+3))){t=!0;let a=e.line;e.position+=3,ie(e,!0),i=e.line>a}else n&&T(e,\"directives end mark is expected\");let o=e.events.length;if(!t&&e.position===e.lineStart&&e.input.charCodeAt(e.position)===46&&un(e)){e.position+=3,ie(e,!0);return}if(ra(e,t,!1),We(e,e.lineIndent-1,qn,!1,i,i)||ce(e),ie(e,!0),e.position===e.lineStart&&un(e)&&(r=e.input.charCodeAt(e.position)===46,r)){let a=e.line;e.position+=3,ie(e,!0),e.line===a&&e.position<e.length&&T(e,\"end of the stream or a document separator is expected\")}let s=e.events[o];s?.type===W.DOCUMENT&&(s.explicitEnd=r),an(e),!r&&e.position<e.length&&!Jt(e)&&T(e,\"end of the stream or a document separator is expected\")}function ba(e,n){let t=e.length,r={...Kt,...n,input:`${e}\\0`,length:t,position:0,line:0,lineStart:0,lineIndent:0,firstTabInLine:-1,depth:0,directives:[],tagHandlers:Object.create(null),events:[]},i=e.indexOf(\"\\0\");for(i!==-1&&Ye.throwAt(e,i,\"null byte is not allowed in input\",r.filename);r.position<r.length&&(Oi(r),ie(r,!0),!(r.position>=r.length));){let o=r.position;Sa(r),r.position===o&&T(r,\"can not read a document\")}return r.events}var Aa={...Kt,...qt};function wa(e,n={}){let t={...Aa,...n},r=String(e),i=Object.keys(Kt),o=Object.keys(qt);return Qs(ba(r,Wr(t,i)),{...Wr(t,o),source:r})}function bi(e,n){let t=wa(e,n);if(t.length===0)throw new Ye(\"expected a document, but the input is empty\");if(t.length===1)return t[0];throw new Ye(\"expected a single document in the stream, but found more\")}function Hn(e,n){return(e&1<<n)!==0}var ri={applyQuoteFlowKeysOption:Ea,doubleQuoteForInvisibles:va,doubleQuoteWhitespaceOnly:Ta,applyForceQuotesOption:ka,tryLongOrMultilineAsBlock:xa,quoteInvalidPlain:_a,fallbackToDoubleQuoted:Na};function Ai(e){return e.presenterOptions.quoteStyle===\"single\"&&Hn(e.allowedStylesMask,L.SINGLE_QUOTED)?L.SINGLE_QUOTED:L.DOUBLE_QUOTED}function Ea(e){e.presenterOptions.quoteFlowKeys&&(!e.isKey||!e.flowOnly||e.style!==L.PLAIN||(e.style=L.DOUBLE_QUOTED))}function va(e){e.style===L.PLAIN&&/[\\t\\x7F-\\xA0\\u2028\\u2029\\uFEFF\\uFFFE\\uFFFF]/.test(e.node.value)&&(e.style=L.DOUBLE_QUOTED)}function Ta(e){e.style===L.PLAIN&&/^\\s+$/.test(e.node.value)&&(e.style=L.DOUBLE_QUOTED)}function ka(e){e.presenterOptions.forceQuotes&&(e.isKey||e.style!==L.PLAIN||e.node.tag===e.presenterOptions.schema.defaultScalarTag.tagName&&(e.style=e.node.value.includes(`\n`)?L.DOUBLE_QUOTED:Ai(e)))}function xa(e){if(e.style!==L.PLAIN||e.isKey)return;let n=e.node.value,t=n.indexOf(`\n`)!==-1;if(!Hn(e.allowedStylesMask,L.LITERAL_BLOCK)){t&&(e.style=L.DOUBLE_QUOTED);return}let r=e.presenterOptions.lineWidth;if(r===-1){t&&(e.style=L.LITERAL_BLOCK);return}let i=Math.max(Math.min(r,40),r-e.shiftOfContent),o=0,s=!1;for(;o<=n.length;){let a=n.length,c=n.indexOf(`\n`,o);c!==-1&&(a=c);let f=n.slice(o,a);if(f.length>i&&f[0]!==\" \"&&/ [^ \\t]/.test(f)&&(s=!0),c===-1)break;o=c+1}s?e.style=L.FOLDED_BLOCK:t&&(e.style=L.LITERAL_BLOCK)}function _a(e){e.style===L.PLAIN&&!Hn(e.allowedStylesMask,L.PLAIN)&&(e.style=Ai(e))}function Na(e){Hn(e.allowedStylesMask,e.style)||(e.style=L.DOUBLE_QUOTED)}var Ia=\"[\\\\x09\\\\x0A\\\\x0D\\\\x20-\\\\x7E\\\\x85\\\\xA0-\\\\uD7FF\\\\uE000-\\\\uFFFD\\\\u{10000}-\\\\u{10FFFF}]\",Ca=\"[\\\\n\\\\r]\",La=\"\\\\uFEFF\",Wt=\"[ \\\\t]\",wi=`(?:(?!(?:${Ca}|${La}))${Ia})`,Vn=`(?:(?!${Wt})${wi})`,Ei=\"[\\\\x09\\\\x20-\\\\uD7FF\\\\uE000-\\\\uFFFF\\\\u{10000}-\\\\u{10FFFF}]\",vi=\"[-?:,\\\\[\\\\]{}#&*!|>'\\\"%@`]\",$a=\"[,\\\\[\\\\]{}]\",Rt=Vn,Ft=`(?:(?!${$a})${Vn})`,ja=`(?:(?:(?!${vi})${Vn})|[?:-](?=${Rt}))`,Pa=`(?:(?:(?!${vi})${Vn})|[?:-](?=${Ft}))`,Ti=`(?:(?:(?![:#])${Rt})|:(?=${Rt}))#*`,ki=`(?:(?:(?![:#])${Ft})|:(?=${Ft}))#*`,xi=`(?:${Wt}*${Ti})*`,_i=`(?:${Wt}*${ki})*`,Ni=`${ja}#*${xi}`,Ii=`${Pa}#*${_i}`,Ra=Ni,Fa=Ii,Ma=`\\\\n+${Ti}${xi}`,Ua=`\\\\n+${ki}${_i}`,Da=`${Ni}(?:${Ma})*`,Ba=`${Ii}(?:${Ua})*`,kl=new RegExp(`^(?:${Da})$`,\"u\"),xl=new RegExp(`^(?:${Ba})$`,\"u\"),_l=new RegExp(`^(?:${Ra})$`,\"u\"),Nl=new RegExp(`^(?:${Fa})$`,\"u\"),Il=new RegExp(`^(?:${Ei})*$`,\"u\"),Cl=new RegExp(`^(?:${Ei}|\\\\n)*$`,\"u\"),Ll=new RegExp(`^(?:${wi}|\\\\n)*$`,\"u\");var qa={indent:2,seqNoIndent:!1,seqInlineFirst:!0,lineWidth:80,flowBracketPadding:!1,flowSkipCommaSpace:!1,flowSkipColonSpace:!1,quoteFlowKeys:!1,quoteStyle:\"single\",forceQuotes:!1,scalarStyleRules:Object.keys(ri).map(e=>Reflect.get(ri,e)),tagBeforeAnchor:!1};var $l={...qa,schema:js,skipInvalid:!1,noRefs:!1,flowLevel:-1,sortKeys:!1,transform:()=>{}};var jl=W.DOCUMENT,Pl=W.SEQUENCE,Rl=W.MAPPING,Fl=W.SCALAR,Ml=W.ALIAS,Ul=W.POP,Dl=L.PLAIN,Bl=L.SINGLE_QUOTED,ql=L.DOUBLE_QUOTED,Kl=L.LITERAL_BLOCK,Jl=L.FOLDED_BLOCK,Wl=Le.BLOCK,Yl=Le.FLOW,Hl=fe.CLIP,Vl=fe.STRIP,zl=fe.KEEP;var Ci=u.Struct({url:u.String,variables:u.optionalKey(ne)}),zn=u.Struct({openapi:u.String,servers:u.optionalKey(u.Array(Ci)),paths:u.Record(u.String,ne),components:u.optionalKey(u.Struct({schemas:u.optionalKey(u.Record(u.String,ne)),securitySchemes:u.optionalKey(u.Record(u.String,ne))})),security:u.optionalKey(u.Array(u.Record(u.String,u.Array(u.String))))}),Li=u.Struct({operationId:u.optionalKey(u.String),responses:u.optionalKey(u.Record(u.String,ne)),summary:u.optionalKey(u.String),description:u.optionalKey(u.String),parameters:u.optionalKey(u.Array(ne)),requestBody:u.optionalKey(ne),security:u.optionalKey(u.Array(u.Record(u.String,u.Array(u.String)))),servers:u.optionalKey(u.Array(Ci))});var pe=e=>typeof e==\"object\"&&e!==null;function ze(e,n,t=[]){let r={};for(let[i,o]of Object.entries(e)){let s=[...t,i];if(Array.isArray(o)){r[i]=o.map((a,c)=>typeof a==\"object\"&&!Array.isArray(a)&&a!==null?ze(a,n,[...s,c.toString()]):a);continue}if(pe(o)){r[i]=ze(o,n,s);continue}r[i]=o}return n(r,t)}var $e=\"application/json\";function Fi(e){let n=e[\"x-example\"],t=e[\"x-examples\"];return delete e[\"x-example\"],delete e[\"x-examples\"],{xExample:n,xExamples:t}}function Ge(e){return typeof e==\"object\"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length>0}function Ka(e){return Ge(e)&&Object.values(e).every(n=>typeof n==\"object\"&&n!==null&&!Array.isArray(n))}function Ja(e){if(!pe(e))return!0;let n=e,t=[\"enum\",\"const\",\"not\",\"format\",\"multipleOf\",\"maximum\",\"exclusiveMaximum\",\"minimum\",\"exclusiveMinimum\",\"maxLength\",\"minLength\",\"pattern\",\"maxItems\",\"minItems\",\"uniqueItems\",\"maxProperties\",\"minProperties\",\"required\"];return!(n.allOf||n.oneOf||n.anyOf||n.items||n.$ref||\"additionalProperties\"in n||t.some(r=>r in n)||typeof n.properties==\"object\"&&n.properties!==null&&Object.keys(n.properties).length>0)}function $i(e){let n=Object.keys(e);if(n.some(r=>{let i=e[r];return pe(i)&&(i.example!==void 0||i.examples!==void 0)}))for(let r of n){let i=e[r];if(!pe(i))continue;let o=i.example!==void 0||i.examples!==void 0;i.schema!==void 0&&!o&&Object.keys(i).length===1&&Ja(i.schema)&&delete e[r]}}var Wa=new Set([\"summary\",\"description\",\"value\",\"externalValue\"]);function Mi(e){if(typeof e!=\"object\"||e===null)return!1;let n=e,t=\"value\"in n||\"externalValue\"in n,r=Object.keys(n).every(i=>Wa.has(i));return t&&r}function pn(e){return Mi(e)?e:{value:e}}var Ya=/^[a-zA-Z0-9*+.-]+\\/[a-zA-Z0-9*+.+-]+$/;function Ht(e){return Ya.test(e)}function Ha(e){return Object.entries(e).reduce((n,[t,r])=>(n[t]={value:r},n),{})}var Va=e=>{switch(e){case\"application\":return\"clientCredentials\";case\"accessCode\":return\"authorizationCode\";case\"implicit\":return\"implicit\";case\"password\":return\"password\";default:return e}};function zt(e){let n=e;if(n!==null&&typeof n==\"object\"&&typeof n.swagger==\"string\"&&n.swagger?.startsWith(\"2.0\"))n.openapi=\"3.0.4\",delete n.swagger;else return n;if(n.host){let t=Array.isArray(n.schemes)&&n.schemes?.length?n.schemes:[\"http\"];n.servers=t.map(r=>({url:`${r}://${n.host}${n.basePath??\"\"}`})),delete n.basePath,delete n.schemes,delete n.host}else n.basePath&&(n.servers=[{url:n.basePath}],delete n.basePath);if(n.definitions){for(let t of Object.values(n.definitions))xe(t);n.components=Object.assign({},n.components,{schemas:n.definitions}),delete n.definitions,n=ze(n,t=>(typeof t.$ref==\"string\"&&t.$ref.startsWith(\"#/definitions/\")&&(t.$ref=t.$ref.replace(/^#\\/definitions\\//,\"#/components/schemas/\")),t))}if(n=ze(n,t=>(t.type===\"file\"&&(t.type=\"string\",t.format=\"binary\"),t)),Object.hasOwn(n,\"parameters\")){n=ze(n,o=>{if(typeof o.$ref==\"string\"&&o.$ref.startsWith(\"#/parameters/\")){let s=o.$ref.split(\"/\")[2];if(!s)return o;let a=pe(n.parameters)&&s in n.parameters?n.parameters[s]:void 0;a&&typeof a==\"object\"&&\"in\"in a&&(a.in===\"body\"||a.in===\"formData\")?o.$ref=o.$ref.replace(/^#\\/parameters\\//,\"#/components/requestBodies/\"):o.$ref=o.$ref.replace(/^#\\/parameters\\//,\"#/components/parameters/\")}return o}),n.components??={};let t={},r={},i=pe(n.parameters)?n.parameters:{};for(let[o,s]of Object.entries(i))if(s&&typeof s==\"object\"){if(\"$ref\"in s){let a=Vt(s);t[o]=a}else if(\"in\"in s)if(s.in===\"body\")r[o]=Di(s,n.consumes??[$e]);else if(s.in===\"formData\")r[o]=Bi([s],n.consumes);else{let a=Vt(s);t[o]=a}}Object.keys(t).length>0&&(n.components.parameters=t),Object.keys(r).length>0&&(n.components.requestBodies=r),delete n.parameters}if(Object.hasOwn(n,\"responses\")&&typeof n.responses==\"object\"&&n.responses!==null){n=ze(n,i=>(typeof i.$ref==\"string\"&&i.$ref.startsWith(\"#/responses/\")&&(i.$ref=i.$ref.replace(/^#\\/responses\\//,\"#/components/responses/\")),i)),n.components??={};let t={},r=n.responses;for(let[i,o]of Object.entries(r))if(pe(o))if(\"$ref\"in o)t[i]=o;else{let s=o,a=n.produces??[$e];if(s.schema){xe(s.schema),typeof s.content!=\"object\"&&(s.content={});for(let c of a)s.content[c]={schema:s.schema};delete s.schema}if(s.examples&&typeof s.examples==\"object\"){typeof s.content!=\"object\"&&(s.content={});let c=a[0]??$e;for(let[f,l]of Object.entries(s.examples))if(Ht(f))typeof s.content[f]!=\"object\"&&(s.content[f]={}),s.content[f].example=l;else{typeof s.content[c]!=\"object\"&&(s.content[c]={});let p=s.content[c];typeof p.examples!=\"object\"&&(p.examples={}),p.examples[f]=pn(l)}delete s.examples}s.content&&typeof s.content==\"object\"&&$i(s.content),pe(s.headers)&&(s.headers=Object.entries(s.headers).reduce((c,[f,l])=>l&&typeof l==\"object\"?{[f]:ji(l),...c}:c,{})),t[i]=s}Object.keys(t).length>0&&(n.components.responses=t),delete n.responses}if(typeof n.paths==\"object\"){for(let t in n.paths)if(Object.hasOwn(n.paths,t)){let r=pe(n.paths)&&t in n.paths?n.paths[t]:void 0;if(!r||typeof r!=\"object\")continue;let i;for(let o in r)if(o===\"parameters\"&&Object.hasOwn(r,o)){let s=Ri(r.parameters,n.consumes??[$e]);r.parameters=s.parameters,i=s.requestBody}else if(Object.hasOwn(r,o)){let s=r[o];if(i&&(s.requestBody=i),s.parameters){let a=Ri(s.parameters,s.consumes??n.consumes??[$e]);s.parameters=a.parameters,a.requestBody&&(s.requestBody=a.requestBody)}if(delete s.consumes,s.responses){for(let a in s.responses)if(Object.hasOwn(s.responses,a)){let c=s.responses[a];if(c.headers&&typeof c.headers==\"object\"&&(c.headers=Object.entries(c.headers).reduce((f,[l,p])=>p&&typeof p==\"object\"?{[l]:ji(p),...f}:f,{})),c.schema){xe(c.schema);let f=n.produces??s.produces??[$e];typeof c.content!=\"object\"&&(c.content={});for(let l of f)c.content[l]={schema:c.schema};delete c.schema}if(c.examples&&typeof c.examples==\"object\"){typeof c.content!=\"object\"&&(c.content={});let l=(n.produces??s.produces??[$e])[0]??$e;for(let[p,h]of Object.entries(c.examples))if(Ht(p))typeof c.content[p]!=\"object\"&&(c.content[p]={}),c.content[p].example=h;else{typeof c.content[l]!=\"object\"&&(c.content[l]={});let S=c.content[l];typeof S.examples!=\"object\"&&(S.examples={}),S.examples[p]=pn(h)}delete c.examples}c.content&&typeof c.content==\"object\"&&$i(c.content)}}delete s.produces,s.parameters?.length===0&&delete s.parameters}}}if(n.securityDefinitions){(typeof n.components!=\"object\"||n.components===null)&&(n.components={}),n.components&&typeof n.components==\"object\"&&Object.assign(n.components,{securitySchemes:{}});for(let[t,r]of Object.entries(n.securityDefinitions))if(typeof r==\"object\")if(\"type\"in r&&r.type===\"oauth2\"){let{flow:i,authorizationUrl:o,tokenUrl:s,scopes:a}=r;n.components&&typeof n.components==\"object\"&&\"securitySchemes\"in n.components&&n.components.securitySchemes&&Object.assign(n.components.securitySchemes,{[t]:{type:\"oauth2\",flows:{[Va(i||\"implicit\")]:Object.assign({},o&&{authorizationUrl:o},s&&{tokenUrl:s},a&&{scopes:a})}}})}else\"type\"in r&&r.type===\"basic\"?n.components&&typeof n.components==\"object\"&&\"securitySchemes\"in n.components&&n.components.securitySchemes&&Object.assign(n.components.securitySchemes,{[t]:{type:\"http\",scheme:\"basic\"}}):n.components&&typeof n.components==\"object\"&&\"securitySchemes\"in n.components&&n.components.securitySchemes&&Object.assign(n.components.securitySchemes,{[t]:r});delete n.securityDefinitions}return delete n.consumes,delete n.produces,n}var xe=e=>{if(pe(e)){if(typeof e[\"x-nullable\"]==\"boolean\"&&(e[\"x-nullable\"]&&(e.nullable=!0),delete e[\"x-nullable\"]),pe(e.properties))for(let n of Object.values(e.properties))xe(n);if(xe(e.items),xe(e.additionalProperties),Array.isArray(e.allOf))for(let n of e.allOf)xe(n)}};function Gt(e){let t=[\"type\",\"format\",\"default\",\"items\",\"maximum\",\"exclusiveMaximum\",\"minimum\",\"exclusiveMinimum\",\"maxLength\",\"minLength\",\"pattern\",\"maxItems\",\"minItems\",\"uniqueItems\",\"enum\",\"multipleOf\",\"x-nullable\"].reduce((r,i)=>(Object.hasOwn(e,i)&&(r[i]=e[i],delete e[i]),r),{});return xe(t),t}function za(e){if(e===\"formData\")throw new Error(\"Encountered a formData parameter which should have been filtered out by the caller\");if(e===\"body\")throw new Error(\"Encountered a body parameter which should have been filtered out by the caller\");return e}function Vt(e){if(Object.hasOwn(e,\"$ref\")&&typeof e.$ref==\"string\")return{$ref:e.$ref};let n=Ga(e),t=Gt(e),{xExample:r,xExamples:i}=Fi(e);if(Ge(r)?e.examples=Ha(r):Ge(i)&&(e.examples=Object.entries(i).reduce((o,[s,a])=>(o[s]=pn(a),o),{})),delete e.collectionFormat,delete e.default,!e.in)throw new Error('Parameter object must have an \"in\" property');return{schema:t,...n,...e,in:za(e.in)}}function ji(e){if(Object.hasOwn(e,\"$ref\")&&typeof e.$ref==\"string\")return{$ref:e.$ref};let n=Gt(e);return{...e,schema:n}}var Ui={ssv:{style:\"spaceDelimited\",explode:!1},pipes:{style:\"pipeDelimited\",explode:!1},multi:{style:\"form\",explode:!0},csv:{style:\"form\",explode:!1},tsv:{}},Pi={ssv:{},pipes:{},multi:{},csv:{style:\"simple\",explode:!1},tsv:{}},Yt={header:Pi,query:Ui,path:Pi};function Ga(e){if(e.type!==\"array\"||!(e.in===\"query\"||e.in===\"path\"||e.in===\"header\"))return{};let n=e.collectionFormat??\"csv\";return e.in in Yt&&n in Yt[e.in]?Yt[e.in][n]:{}}function Qa(e){if(e.type!==\"array\"||typeof e.collectionFormat!=\"string\")return;let n=Ui[e.collectionFormat];if(!(!n||Object.keys(n).length===0))return n}function Di(e,n){let{xExample:t,xExamples:r}=Fi(e);delete e.name,delete e.in;let{schema:i,...o}=e;xe(i);let s={content:{},...o};if(s.content)for(let a of n){if(s.content[a]={schema:i},Ge(r)&&a in r){let c=r[a];Ge(c)&&Object.values(c).every(l=>Mi(l))?s.content[a].examples=c:Ka(c)?s.content[a].examples=Object.entries(c).reduce((l,[p,h])=>(l[p]=pn(h),l),{}):s.content[a].examples={default:pn(c)}}else Ge(r)&&!Object.keys(r).some(Ht)&&(s.content[a].examples=Object.entries(r).reduce((c,[f,l])=>(c[f]=pn(l),c),{}));!s.content[a].examples&&Ge(t)&&a in t&&(s.content[a].example=t[a])}return s}function Bi(e,n=[\"multipart/form-data\"]){let t={content:{}},r=n.filter(o=>o===\"multipart/form-data\"||o===\"application/x-www-form-urlencoded\"),i=r.length>0?r:[\"multipart/form-data\"];if(t.content)for(let o of i){t.content[o]={schema:{type:\"object\",properties:{},required:[]}};let s=t.content?.[o];if(s?.schema&&typeof s.schema==\"object\"&&\"properties\"in s.schema){for(let a of e)if(a.name&&s.schema.properties){s.schema.properties[a.name]={...Gt(structuredClone(a)),...a.description!==void 0?{description:a.description}:{}};let c=Qa(a);c&&(s.encoding??={},s.encoding[a.name]=c),a.required&&Array.isArray(s.schema.required)&&s.schema.required.push(a.name)}}}return t}function Ri(e,n){let t={parameters:e.filter(o=>!(o.in===\"body\"||o.in===\"formData\")).map(o=>Vt(o))},r=structuredClone(e.find(o=>o.in===\"body\")??{});r&&Object.keys(r).length&&(t.requestBody=Di(r,n));let i=e.filter(o=>o.in===\"formData\");if(i.length>0){let o=Bi(i,n);typeof t.requestBody!=\"object\"?t.requestBody=o:t.requestBody={...t.requestBody,content:{...t.requestBody.content,...o.content}},typeof t.requestBody!=\"object\"&&(t.requestBody={content:{}})}return t}var Xa=new Set([\"properties\",\"items\",\"allOf\",\"anyOf\",\"oneOf\",\"not\",\"additionalProperties\",\"schema\",\"schemas\"]),Za=new Set([\"paths\",\"webhooks\",\"responses\",\"content\",\"headers\",\"examples\",\"links\",\"encoding\",\"variables\",\"parameters\",\"requestBodies\",\"securitySchemes\",\"pathItems\",\"scopes\"]),qi=e=>{if(!e)return!1;let n=e[0]===\"x-ext\"&&e[1]!==void 0?e.slice(2):e,t=0;for(let r of n){if(t>0){t--;continue}if(Xa.has(r)||r.endsWith(\"Schema\"))return!0;if(r===\"callbacks\"){t=2;continue}Za.has(r)&&(t=1)}return!1};var Ki=e=>typeof e==\"object\"&&e!==null&&!Array.isArray(e),ec=new Set([\"properties\",\"patternProperties\",\"$defs\",\"definitions\"]),Gn=(e,n)=>{let t=n>0?e[n-1]:void 0;return t===void 0?!1:t===\"schemas\"&&e[n-2]===\"components\"?!0:ec.has(t)},nc=new Set([\"example\",\"default\",\"const\",\"enum\"]),tc=e=>{let n=e.length-1,t=e[n];return t===void 0?!1:nc.has(t)&&!Gn(e,n)?!0:t===\"value\"&&e[n-2]===\"examples\"&&!Gn(e,n-2)},rc=e=>e.some((n,t)=>n===\"examples\"&&t>0&&!Gn(e,t)),Qe=(e,n,t)=>{let r={};for(let i of Object.keys(e))t.includes(i)||(r[i]=Object.hasOwn(n,i)?n[i]:e[i]);for(let i of Object.keys(n))Object.hasOwn(r,i)||(r[i]=n[i]);return r},ic=(e,n)=>{let t=e;if(t.type!==void 0&&t.nullable===!0)t=Qe(t,{type:[t.type,\"null\"]},[\"nullable\"]);else if(t.nullable===!0&&t.type===void 0){if(typeof t.$ref==\"string\"){let{nullable:r,$ref:i,...o}=t;return{...o,anyOf:[{$ref:i},{type:\"null\"}]}}if(Array.isArray(t.allOf)){let{nullable:r,allOf:i,...o}=t,s=i.length===1?i[0]:{allOf:i};return{...o,anyOf:[s,{type:\"null\"}]}}}if(t.exclusiveMinimum===!0&&t.minimum!==void 0?t=Qe(t,{exclusiveMinimum:t.minimum},[\"minimum\"]):typeof t.exclusiveMinimum==\"boolean\"&&(t=Qe(t,{},[\"exclusiveMinimum\"])),t.exclusiveMaximum===!0&&t.maximum!==void 0?t=Qe(t,{exclusiveMaximum:t.maximum},[\"maximum\"]):typeof t.exclusiveMaximum==\"boolean\"&&(t=Qe(t,{},[\"exclusiveMaximum\"])),t.example!==void 0&&!rc(n)&&!Gn(n,n.length)&&(t=Qe(t,{examples:qi(n)?[t.example]:{default:{value:t.example}}},[\"example\"])),t.type===\"string\"||Array.isArray(t.type)&&t.type.includes(\"string\")){if(t.format===\"binary\"){let{format:r,type:i,...o}=t;return n.at(-1)===\"schema\"&&n.at(-3)===\"content\"?o:{contentMediaType:\"application/octet-stream\",...o}}if(t.format===\"base64\"||t.format===\"byte\"){let{format:r,...i}=t;return{...i,contentEncoding:\"base64\"}}}return t[\"x-webhooks\"]!==void 0&&n.length===0&&(t=Qe(t,{webhooks:t[\"x-webhooks\"]},[\"x-webhooks\"])),t},Ji=e=>{if(typeof e.openapi!=\"string\"||!e.openapi.startsWith(\"3.0\"))return e;e.openapi=\"3.1.1\";let n=[],t=r=>{for(let i of Object.keys(r)){let o=r[i];if(n.push(i),tc(n)){n.pop();continue}if(Array.isArray(o))for(let s=0;s<o.length;s++){let a=o[s];Ki(a)&&(n.push(String(s)),o[s]=t(a),n.pop())}else Ki(o)&&(r[i]=t(o));n.pop()}return ic(r,n)};return t(e)};var _e=()=>new Promise(e=>setTimeout(e,0));var Ie=u.declare(e=>typeof e==\"object\"&&e!==null&&!Array.isArray(e),{expected:\"object\"}),Zt=u.decodeUnknownSync(Ie),Ne=Zt;function de(e,n){throw new X({code:e,reason:n})}var ge=e=>typeof e==\"object\"&&e!==null&&!Array.isArray(e),ye=e=>e.replaceAll(\"~\",\"~0\").replaceAll(\"/\",\"~1\"),oc=Ce.makeFormatterStandardSchemaV1({leafHook:e=>Ce.hasInput(e)?\"Invalid value\":Ce.defaultLeafHook(e),checkHook:e=>Ce.hasInput(e)||Ce.hasInput(e.issue)?Ce.defaultCheckHook(e)??\"Invalid value\":Ce.defaultCheckHook(e)}),Te=(e,n,t,r)=>{try{return u.decodeUnknownSync(e)(n)}catch(i){if(!u.isSchemaError(i))throw i;let[o]=oc(i.issue).issues,s=(o?.path??[]).map(a=>ye(String(typeof a==\"object\"?a.key:a)));return de(\"invalid_document\",`The ${r} at ${[t,...s].join(\"/\")} is invalid: ${o?.message??\"it does not match OpenAPI\"}.`)}},sc=new Set([\"items\",\"additionalProperties\",\"not\",\"if\",\"then\",\"else\",\"contains\",\"propertyNames\",\"unevaluatedItems\",\"unevaluatedProperties\",\"contentSchema\"]),Qt=new Set([\"allOf\",\"anyOf\",\"oneOf\",\"prefixItems\"]),ac=new Set([\"properties\",\"patternProperties\",\"$defs\",\"dependentSchemas\"]),cc=e=>typeof e==\"boolean\"||ge(e),Tn=e=>Array.isArray(e)?\"an array\":e===null?\"null\":typeof e==\"object\"?\"an object\":`a ${typeof e}`,Xt=e=>Array.isArray(e)?e.some(Xt):ge(e)&&(typeof e.$ref==\"string\"||Object.values(e).some(Xt)),lc=(e,n)=>{let t=[],r=(o,s)=>{if(cc(o))return i(o);Xt(o)&&de(\"schema_keyword\",`The schema at ${[n,...t].join(\"/\")} is invalid: ${s()}, so the reference inside it cannot be resolved.`)},i=o=>{if(ge(o))for(let[s,a]of Object.entries(o)){if(t.push(ye(s)),sc.has(s))r(a,()=>`\"${s}\" must be a schema, not ${Tn(a)}`);else if(Qt.has(s)||ac.has(s)){let c=Qt.has(s)?Array.isArray(a)?[...a.entries()]:void 0:ge(a)?Object.entries(a):void 0;if(c===void 0)r(a,()=>Qt.has(s)?`\"${s}\" must be an array of schemas, not ${Tn(a)}`:`\"${s}\" must map names to schemas, not ${Tn(a)}`);else for(let[f,l]of c)t.push(ye(String(f))),r(l,()=>`each \"${s}\" entry must be a schema, not ${Tn(l)}`),t.pop()}t.pop()}};i(e)},uc=new Set([\"paths\",\"webhooks\",\"pathItems\"]),fc=e=>{if(!e.startsWith(\"#\"))return;let n=Me.parseUriFragment(e);if(n!==void 0)return n;let t=e.slice(1);try{t=decodeURIComponent(t)}catch{}return t===\"\"?[]:t.startsWith(\"/\")?t.slice(1).split(\"/\").map(Me.unescapeToken):void 0};function pc(e){let n=new Set,t=new WeakMap,r=a=>{let c=fc(a),f=e;for(let l of c??[])if(f=ge(f)?Object.hasOwn(f,l)?f[l]:void 0:Array.isArray(f)?f[Number(l)]:void 0,f===void 0)return;return c!==void 0&&ge(f)?f:void 0},i=a=>{let c={};for(let[f,l]of Object.entries(a))c[f]=f===\"schema\"||f===\"example\"||f.startsWith(\"x-\")?l:uc.has(f)&&ge(l)?Object.fromEntries(Object.entries(l).map(([p,h])=>[p,s(h,!0)])):f===\"responses\"?o(s(l,!1)):s(l,!1);return c},o=a=>{if(!ge(a)||!Object.hasOwn(a,\"default\"))return a;let{default:c,...f}=a;return{default:c??null,...f}},s=(a,c)=>{if(Array.isArray(a))return a.map(I=>s(I,!1));if(!ge(a))return a;let f=a.$ref,l=typeof f==\"string\"&&!n.has(f)?r(f):void 0;if(typeof f!=\"string\"||l===void 0)return i(a);n.add(f);let p=s(l,c);if(n.delete(f),!ge(p))return p;let{$ref:h,...S}=a,y=c?{...p,...i(S)}:{...p,...typeof S.summary==\"string\"?{summary:S.summary}:{},...typeof S.description==\"string\"?{description:S.description}:{}};return t.set(y,f),y};return{document:Ne(s(e,!1)),origins:t}}var Wi=u.Struct({...zn.fields,paths:u.Record(u.String,Ie),components:u.optionalKey(u.Struct({schemas:u.optionalKey(u.Record(u.String,Ie)),securitySchemes:u.optionalKey(u.Record(u.String,Ie))}))}),Qn=u.Array(u.String),Yi=u.Array(Ie),Xe=u.Struct({parameters:u.optionalKey(Yi),consumes:u.optionalKey(Qn),produces:u.optionalKey(Qn),responses:u.optionalKey(Ie)}),dc=u.Struct({parameters:u.optionalKey(Yi),get:u.optionalKey(Xe),put:u.optionalKey(Xe),post:u.optionalKey(Xe),delete:u.optionalKey(Xe),options:u.optionalKey(Xe),head:u.optionalKey(Xe),patch:u.optionalKey(Xe)}),mc=u.Struct({paths:u.optionalKey(Ie),consumes:u.optionalKey(Qn),produces:u.optionalKey(Qn),securityDefinitions:u.optionalKey(u.Record(u.String,Ie))}),hc=[\"get\",\"put\",\"post\",\"delete\",\"options\",\"head\",\"patch\"];function gc(e){let n=Te(mc,e,\"#\",\"definition\");for(let[t,r]of Object.entries(n.paths??{})){if(!t.startsWith(\"/\"))continue;let i=`#/paths/${ye(t)}`,o=Te(dc,r,i,\"path item\");for(let s of hc)for(let[a,c]of Object.entries(o[s]?.responses??{}))a.startsWith(\"x-\")||Te(Ie,c,`${i}/${s}/responses/${ye(a)}`,\"response\")}}function yc(e){typeof e.swagger==\"string\"&&e.swagger.startsWith(\"2.0\")&&gc(e);let n;try{n=zt(e)}catch(t){if(!(t instanceof TypeError))throw t;return de(\"invalid_document\",\"The Swagger 2.0 definition could not be converted to OpenAPI 3.0: part of it does not have the structure Swagger 2.0 requires, such as a null entry in a path item or response map.\")}return Ne(Ji(Ne(n)))}var Oc=/^3\\.[12]\\.\\d+$/;async function Hi(e){let n=yc(Ne(e));await _e();let t=Te(Wi,n,\"#\",\"definition\");Oc.test(t.openapi)||de(\"openapi_version\",`This importer supports Swagger 2.0 and OpenAPI 3.0, 3.1 and 3.2, not openapi ${JSON.stringify(t.openapi.slice(0,32))}.`);let r=t.components?.schemas??{},i=ut.fromSchemaOpenApi3_1,o=n.components===void 0?{}:Ne(n.components),{document:s,origins:a}=pc({...n,components:{...o,schemas:{}}});await _e();let c=Te(Wi,{...s,components:{...Ne(s.components),schemas:r}},\"#\",\"definition\"),f=new Map,l=new Map;return{spec:c,definitions:f,origin(p){return ge(p)?a.get(p):void 0},resolve(p){let h=new Set;for(;p.$ref!==void 0;){let S=p.$ref,y=typeof S==\"string\"?Me.parseUriFragment(S):void 0;(typeof S!=\"string\"||y?.length!==3||y[0]!==\"components\"||y[1]!==\"schemas\"||y[2]===void 0)&&de(\"external_reference\",`The reference ${JSON.stringify(S)} does not resolve within the definition. Only local references to objects the definition declares are supported.`),h.has(S)&&de(\"circular_reference\",`The schema ${S} is a circular alias of itself.`),h.add(S),Object.hasOwn(r,y[2])||de(\"missing_component\",`The reference ${S} names a schema the definition does not declare.`),p=Ne(r[y[2]])}return p},schema(p){let h=[],S=new Set,y={},I=(R,j,Y)=>{lc(R,Y);let H;try{H=i(R,{onReference(x){let U=Me.parseUriFragment(x),F=U?.[2];(U?.length!==3||U[0]!==\"components\"||U[1]!==\"schemas\"||F===void 0)&&de(\"schema_reference\",`The schema at ${Y} references ${JSON.stringify(x)}. Only references to #/components/schemas/<name> are supported.`);let V=Object.hasOwn(r,F)?r[F]:void 0;if(V===void 0&&de(\"missing_component\",`The schema at ${Y} references ${x}, which the definition does not declare.`),j.add(F),!f.has(F)){h.push(F),f.set(F,{});let J=new Set;f.set(F,I(V,J,`#/components/schemas/${ye(F)}`)),l.set(F,J)}}})}catch(x){if(x instanceof X)throw x;return de(\"schema_keyword\",`The schema at ${Y} cannot be converted to JSON Schema 2020-12 without changing its constraints${x instanceof Error?`: ${x.message}`:\"\"}.`)}return Ne({...H.schema,...Object.keys(H.definitions).length?{$defs:H.definitions}:{}})},M=(R,j)=>{let Y=R===!0?{}:R===!1?{not:{}}:ge(R)?R:de(\"schema_keyword\",`The schema at ${j} must be a schema, not ${Tn(R)}.`),{$defs:H,...x}=I(Y,S,j);for(let[U,F]of Object.entries(H===void 0?{}:Ne(H)))Object.hasOwn(y,U)&&JSON.stringify(y[U])!==JSON.stringify(F)&&de(\"schema_reference\",`The schema at ${j} declares the local definition ${JSON.stringify(U)} differently from another schema of the same operation.`),y[U]=F;return x};try{let R=p(M);if(Object.keys(y).length){let j=new Set,Y=[...S];for(let x=Y.pop();x!==void 0;x=Y.pop())j.has(x)||(j.add(x),Y.push(...l.get(x)??[]));let H=[...j].find(x=>Object.hasOwn(y,x));H!==void 0&&de(\"schema_reference\",`A local definition named ${JSON.stringify(H)} conflicts with the component schema of the same name.`)}return{...R,...Object.keys(y).length?{$defs:y}:{},$schema:ut.META_SCHEMA_URI_DRAFT_2020_12}}catch(R){for(let j of h)f.delete(j),l.delete(j);throw R}}}}function ee(e,n){throw new X({code:e,reason:n})}var K=e=>Zt(e),Sc=u.Struct({operationId:u.optionalKey(u.String),tags:u.optionalKey(u.Array(u.String))}),bc=e=>e.replace(/[^a-zA-Z0-9_]/g,\"_\");function Zn(e,n){try{return new URL(e,n)}catch{return ee(\"server_url\",n===void 0&&!/^[a-z][a-z0-9+.-]*:/i.test(e)?\"The server URL is relative, and an inline definition has no URL to resolve it against. Set baseUrl.\":\"The server URL is not a valid URL. Set baseUrl.\")}}function Xn(e){let n=Zn(e);return n.protocol!==\"https:\"&&n.protocol!==\"http:\"&&ee(\"server_protocol\",`The server uses ${n.protocol}; only HTTP APIs can be imported.`),(n.username||n.password||n.hash||n.search||/[{}]/.test(e))&&ee(\"server_url\",\"The server URL has credentials, a query, a fragment or unresolved variables. Set baseUrl.\"),n.href.replace(/\\/$/,\"\")}function Vi(e,n,t){let r={...t?.variables,...e.variables},i=jr(e.url,{strict:!0})?Pr(e.url,Object.fromEntries(Object.entries(r).map(([c,f])=>{let l=ae.getOrUndefined(u.decodeUnknownOption(ne)(f))?.default;return[c,l==null?\"\":String(l)]})),{encoder:c=>c}):e.url,o;try{o=new URL(i)}catch{o=void 0}let s=new URL(i,\"https://relative.invalid\"),a=o?.protocol&&o.host?`${o.protocol.replace(/\\W/g,\"\")}://${o.host}${o.pathname}`:o?.pathname??(i.startsWith(\"/\")?s.pathname:s.pathname.slice(1));return Xn(Zn(`${a.endsWith(\"/\")?a.slice(0,-1):a}/`,n).href)}var zi={type:\"string\",description:\"File bytes encoded as base64.\",contentEncoding:\"base64\"},Ze=(e,n,t)=>e.origin(n)??t,et=(e,n,t,r)=>`${Ze(e,r,`${n}/content/${ye(t)}`)}/schema`,Qi=e=>e.responses===void 0?{}:K(e.responses);function Ac(e,n,t,r){if(r===\"HEAD\")return{type:\"null\"};let i=Object.entries(Qi(n)).filter(([s])=>/^2(?:[0-9]{2}|XX)$/i.test(s));if(i.length===0)return;let o=[];for(let[s,a]of i){if(s===\"204\"){o.push(()=>({type:\"null\"}));continue}let c=Ze(e,a,`${t}/responses/${ye(s)}`),f=e.resolve(K(a)).content;if(f===void 0)return;let l=Object.entries(K(f));if(l.length===0)return;for(let[p,h]of l){if(!p.includes(\"json\")||Fn(p)){o.push(()=>wn(p)?{type:\"string\"}:St);continue}let S=K(h).schema;if(S===void 0)return;let y=et(e,c,p,h);o.push(I=>I(S,y))}}return e.schema(s=>({anyOf:o.map(a=>a(s))}))}function wc(e,n){try{return e.resolve(K(n))}catch(t){if(!(t instanceof X)&&!u.isSchemaError(t))throw t;return}}function er(e,n){try{return e.resolve(n).content}catch(t){if(!(t instanceof X)&&!u.isSchemaError(t))throw t;return}}function Ec(e,n,t){let r=[],i=u.Struct({description:u.optionalKey(u.String),required:u.Array(u.String),properties:u.Record(u.String,ne)}),o=(s,a,c,f=new Set,l=[])=>{let p=u.decodeUnknownOption(ne)(a);if(ae.isNone(p))return;let h=p.value;try{if(typeof h.$ref==\"string\"&&f.has(h.$ref))return;let S=typeof h.$ref==\"string\"?new Set([...f,h.$ref]):f,y=e.resolve(h),I=typeof h.$ref==\"string\"&&h.$ref.startsWith(\"#/\")?h.$ref:c,M=y.anyOf;if(Array.isArray(M)){for(let[V,J]of M.entries())o(s,J,`${I}/anyOf/${V}`,S,[...l,{schema:h,at:c}]);return}let R=u.decodeUnknownOption(i)(y);if(ae.isNone(R)||!R.value.required.includes(\"_tag\"))return;let j=R.value.properties._tag;if(j===void 0)return;let Y=typeof j.const==\"string\"?j.const:Array.isArray(j.enum)&&j.enum.length===1?j.enum[0]:void 0,H=R.value.properties.message,x=H===void 0?void 0:e.resolve(H),U=x!==void 0&&(x.type===\"string\"||typeof x.const==\"string\"||Array.isArray(x.enum)&&x.enum.length>0&&x.enum.every(V=>typeof V==\"string\")),F=u.decodeUnknownOption(yt)({code:Y,status:s,message:U?{source:\"body\"}:{source:\"schema\",value:R.value.description},schema:e.schema(V=>({allOf:[...l,{schema:h,at:c}].map(J=>V(J.schema,J.at))}))});ae.isSome(F)&&r.push(F.value)}catch(S){if(!(S instanceof X)&&!u.isSchemaError(S))throw S}};for(let[s,a]of Object.entries(Qi(n))){if(!/^[45][0-9]{2}$/.test(s))continue;let c=er(e,K(a));if(c===void 0)continue;let f=Ze(e,a,`${t}/responses/${ye(s)}`);for(let[l,p]of Object.entries(K(c))){if(!l.split(\";\")[0]?.trim().match(/^application\\/(?:[\\w.-]+\\+)?json$/i))continue;let h=K(p).schema;h!==void 0&&o(Number(s),h,et(e,f,l,p))}}return r}var Xi=[\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"OPTIONS\"],Gi=[...Xi,\"QUERY\"],vc=u.is(he.fields.method),Tc=/^(?:\\/(?:[^/?#{}]|\\{[A-Za-z_][\\w.-]*\\})+)+$/;function kc(e){Tc.test(e)||ee(\"operation_path\",\"pathPrefix must start with /, have no empty segment, trailing /, ? or #, and write each parameter as {name}.\");let n=[...e.matchAll(/\\{([^{}]+)\\}/g)].flatMap(t=>t[1]===void 0?[]:[t[1]]);return new Set(n).size!==n.length&&ee(\"operation_path\",\"pathPrefix names the same parameter twice.\"),n}var Zi=(e,n,t={})=>{let r=n,i=()=>{let o=r;return r=void 0,o===void 0&&ee(\"invalid_document\",\"This API definition was already compiled.\"),o};return d.tryPromise({try:async()=>{let o=await Hi(i()),{spec:s}=o,a={...t.securitySchemes??s.components?.securitySchemes},c=new Map,f=[];for(let[g,b]of Object.entries(a)){let m=o.resolve(b);if(m.type===\"http\"&&m.scheme===\"bearer\"||m.type===\"apiKey\"&&(m.in===\"header\"||m.in===\"query\"||m.in===\"cookie\")&&typeof m.name==\"string\")c.set(g,[{scheme:g,field:\"token\",part:\"value\",prefix:\"\"}]);else if(m.type===\"http\"&&m.scheme===\"basic\")c.set(g,[{scheme:g,field:\"username\",part:\"username\",prefix:\"\"},{scheme:g,field:\"password\",part:\"password\",prefix:\"\"}]);else if(m.type===\"oauth2\"){let E=m.flows===void 0?void 0:K(m.flows).authorizationCode;if(E!==void 0){let C=K(E);typeof C.authorizationUrl==\"string\"&&typeof C.tokenUrl==\"string\"&&f.push({name:g,config:e.oauthDiscoveryUrl===void 0?{authorizationUrl:Xn(Zn(C.authorizationUrl,e.connectUrl).href),tokenUrl:Xn(Zn(C.tokenUrl,e.connectUrl).href),scopes:[...e.scopes??Object.keys(K(C.scopes??{}))].sort()}:{discover:Xn(e.oauthDiscoveryUrl)}})}}}let l=t.fallbackSecurity;if(c.size===0&&Object.keys(a).length===0&&e.auth?.header!==void 0){let g=/^([!#$%&'*+.^_`|~A-Za-z0-9-]+):\\s*([^{}\\r\\n]*)\\{[A-Za-z0-9_]+\\}$/.exec(e.auth.header);(!g?.[1]||g[2]===void 0)&&ee(\"auth_helper\",\"This catalog entry needs a custom authentication helper.\"),c.set(\"apiKey\",[{scheme:\"apiKey\",field:\"token\",part:\"value\",prefix:g[2]}]),a.apiKey={type:\"apiKey\",in:\"header\",name:g[1]},l=[{apiKey:[]}]}!l&&!Object.keys(a).length&&e.auth&&![\"none\",\"public\"].includes(e.auth.kind)&&ee(\"auth_missing\",\"This entry does not declare enough authentication details to generate an app.\");let p=new Map,h=[],S=[],y=s.servers?.[0],I=t.pathPrefix===void 0?[]:kc(t.pathPrefix),M=new Map,R=g=>{let b=JSON.stringify([g,y?.variables??null]),m=M.get(b);if(m===void 0){try{m={address:Vi(g,e.connectUrl,y)}}catch(E){m={error:E}}M.set(b,m)}if(\"error\"in m)throw m.error;return m.address},j=s.openapi.startsWith(\"3.2.\"),Y=Object.entries(s.paths).flatMap(([g,b])=>{let m=o.resolve(b),E=Ze(o,b,`#/paths/${ye(g)}`),C=j&&m.additionalOperations!==void 0?Object.entries(K(m.additionalOperations)).map(([z,be])=>({method:z,value:be,at:`${E}/additionalOperations/${ye(z)}`})):[];return[...(j?Gi:Xi).filter(z=>m[z.toLowerCase()]!==void 0).map(z=>({method:z,value:m[z.toLowerCase()],at:`${E}/${z.toLowerCase()}`})),...C].map(z=>({...z,path:g,item:m,itemAt:E}))});Y.length||ee(\"no_operations\",\"This API does not contain any operations.\");let H=vt(Y.map(g=>{let b=u.decodeUnknownOption(Sc)(wc(o,g.value)).pipe(ae.getOrUndefined);return{...g,operationId:b?.operationId,tag:b?.tags?.find(m=>m.trim()!==\"\")}})),x=new Map(H.map(({name:g},b)=>[g,b])),U=g=>[...g].sort((b,m)=>(x.get(b.name)??0)-(x.get(m.name)??0));for(let[g,{name:b,path:m,item:E,itemAt:C,method:D,value:z,at:be}]of H.entries()){g%100===99&&await _e();try{(!m.startsWith(\"/\")||m.includes(\"?\")||m.includes(\"#\"))&&ee(\"operation_path\",\"The path must start with / and contain no ? or #.\"),vc(D)||ee(\"operation_method\",`Executor does not send the HTTP method ${D}. It imports ${Gi.join(\", \")} operations.`);let ue=[],B=o.resolve(K(z)),q=Te(Li,B,be,\"operation\"),Re=ae.getOrUndefined(u.decodeUnknownOption(u.Array(u.NonEmptyString))(B.tags));S.some(_=>_.operation.name===b)&&ee(\"duplicate_operation\",`Another operation has the same tool name, ${b}. Give one of them a distinct operationId.`);let en=(q.servers??(Array.isArray(E.servers)?Te(zn.fields.servers,E.servers,`${C}/servers`,\"servers\"):void 0)??s.servers)?.[0],ir=t.baseUrl??en?.url;ir===void 0&&ee(\"server_missing\",\"The definition declares no server for this operation. Set baseUrl.\");let co=R(t.baseUrl===void 0&&en!==void 0?en:{url:ir}),lo=[...(Array.isArray(E.parameters)?E.parameters:[]).map((_,N)=>({parameter:_,at:Ze(o,_,`${C}/parameters/${N}`)})),...(Array.isArray(B.parameters)?B.parameters:[]).map((_,N)=>({parameter:_,at:Ze(o,_,`${be}/parameters/${N}`)}))],hn=new Map;for(let{parameter:_,at:N}of lo){let Q=Te(jn,o.resolve(K(_)),N,\"parameter\");if(Q.in===\"querystring\"){let[se,...G]=Object.keys(Q.content??{}),me=se===void 0||G.length>0?void 0:Ue(se);me!==\"form\"&&me!==\"json\"&&me!==\"text\"&&ee(\"parameter_encoding\",`The querystring parameter at ${N} must declare one form, JSON or text media type in content.`)}hn.set(`${Q.in}:${Q.name}`,{parameter:Q,at:N})}for(let _ of I){let N=`path:${_}`;m.includes(`{${_}}`)&&ee(\"operation_path\",`pathPrefix adds the path parameter {${_}}, which this operation's path already uses.`),hn.has(N)||hn.set(N,{parameter:{name:_,in:\"path\",required:!0,schema:{type:\"string\"}},at:void 0})}let ot=new Map;for(let{parameter:_,at:N}of hn.values()){let Q=_.in===\"header\"?\"headers\":_.in,se=ot.get(Q)??{properties:{},required:[]},[G,me]=_.content===void 0?[]:Object.entries(_.content)[0]??[],nn=_.schema??(me===void 0?{}:K(me).schema??{}),_n=_.schema!==void 0||G===void 0?`${N}/schema`:et(o,`${N}`,G,me);se.properties[_.name]=N===void 0?()=>nn:yn=>yn(nn,_n),(_.required||_.in===\"path\")&&se.required.push(_.name),ot.set(Q,se)}let kn={},st=[];for(let[_,N]of ot)kn[_]=Q=>({type:\"object\",properties:Object.fromEntries(Object.entries(N.properties).map(([se,G])=>[se,G(Q)])),required:N.required,additionalProperties:!1}),N.required.length&&st.push(_);let gn=[],at;if(q.requestBody){let _=Ze(o,B.requestBody,`${be}/requestBody`),N=Te(Pn,o.resolve(q.requestBody),_,\"request body\"),Q=K(o.resolve(K(B.requestBody)).content),se={};for(let[G,me]of Object.entries(N.content)){let nn=Ue(G),_n=o.resolve(me.schema??{}),yn=me.schema??{},ar=et(o,_,G,Q[G]),lt={},cr=nn===\"binary\"?()=>zi:nn===\"text\"?()=>({type:\"string\"}):Fe=>Fe(yn,ar);if(nn===\"multipart\"){let Fe={...K(_n.properties??{})},lr={};for(let[On,Nn]of Object.entries(Fe)){let ur=o.resolve(K(Nn));Mn(ur)&&(delete Fe[On],lr[On]=zi,lt[On]=ur)}let po=_n,mo=typeof yn.$ref==\"string\"?yn.$ref:ar;cr=On=>{let Nn=On({...po,properties:Fe},mo);return{...Nn,properties:{...K(Nn.properties??{}),...lr}}}}se[G]={...me.encoding===void 0?{}:{encoding:me.encoding},...Object.keys(lt).length?{schema:{type:\"object\",properties:lt}}:{}};let fo=gn.length===0;gn.push(Fe=>({properties:{contentType:{enum:[G]},body:cr(Fe)},...fo?{}:{required:[\"contentType\"]}}))}at={...N,content:se},gn.length||ee(\"request_body\",\"The request body declares no media types.\"),kn.body=()=>({}),kn.contentType=()=>({type:\"string\",enum:Object.keys(N.content),description:\"Request media type. Defaults to the first declared type.\"}),N.required&&st.push(\"body\")}let ct=q.security??s.security??l??[],xn=ct.filter(_=>Object.keys(_).every(N=>Object.hasOwn(a,N)));if(xn.length===0&&ct.length>0){let _=[...new Set(ct.flatMap(Object.keys).filter(N=>!Object.hasOwn(a,N)))];ee(\"auth_method\",`Every security requirement names a scheme securitySchemes does not declare: ${_.map(N=>JSON.stringify(N)).join(\", \")}. Declare and fill every scheme in one complete alternative (securitySchemes plus methods or oauth).`)}for(let _ of xn){let N=Object.keys(_).sort();if(!N.length||!N.every(G=>c.has(G)))continue;let Q=N.flatMap(G=>c.get(G)??[]),se=c.size===1&&N.length===1?\"apiKey\":N.join(\"_and_\");ue.push({name:se,label:Q.length===1?\"API key\":N.join(\" + \"),bindings:Q.map(G=>({...G,field:N.length===1?G.field:`${bc(G.scheme)}_${G.field}`}))})}let or=o.schema(_=>({type:\"object\",properties:Object.fromEntries(Object.entries(kn).map(([N,Q])=>[N,Q(_)])),required:st,...gn.length?{anyOf:gn.map(N=>N(_))}:{},additionalProperties:!1}));try{gr(or)}catch{ee(\"input_schema\",\"Its input schema is not valid JSON.\")}let sr=Ac(o,B,be,D),uo=Object.values(q.responses??{}).some(_=>{let N=er(o,_);return N!==void 0&&Object.hasOwn(K(N),\"text/event-stream\")});S.push({methods:ue,declared:{name:b,method:D,path:m},operation:{...uo?{streaming:!0}:{},...Re===void 0||Re.length===0?{}:{tags:Re},name:b,...q.operationId===void 0?{}:{operationId:q.operationId},description:q.summary??q.description??b,method:D,path:`${t.pathPrefix??\"\"}${m}`,baseUrl:co,openapi:s.openapi,securitySchemes:Object.fromEntries(Object.entries(a).filter(([_])=>xn.some(N=>Object.hasOwn(N,_)))),request:{parameters:[...hn.values()].map(({parameter:_})=>_),...at===void 0?{}:{requestBody:at},security:xn,responses:Object.fromEntries(Object.entries(q.responses??{}).flatMap(([_,N])=>{let Q=er(o,N);return Q===void 0?[]:[[_,{content:Object.fromEntries(Object.keys(K(Q)).map(se=>[se,{}]))}]]}))},input:or,...sr===void 0?{}:{outputSchema:sr},errorResponses:Ec(o,B,be)}})}catch(ue){if(!(ue instanceof X)&&!u.isSchemaError(ue))throw ue;h.push({name:b,method:D,path:m,...ue instanceof X?{code:ue.code,reason:ue.reason}:{code:\"invalid_document\",reason:`The operation at ${be} does not match OpenAPI.`}})}}let F=new Map;for(let{operation:g}of S){let b=new URL(g.baseUrl).origin;F.set(b,(F.get(b)??0)+1)}let V;try{y!==void 0&&(V=new URL(Vi(y,e.connectUrl)).origin)}catch(g){if(!(g instanceof X))throw g}let J=t.allowedOrigin===void 0?void 0:typeof t.allowedOrigin==\"string\"?[t.allowedOrigin]:t.allowedOrigin,Se;for(let[g,b]of J===void 0?F:[]){let m=Se===void 0?0:F.get(Se)??0;(b>m||b===m&&g===V)&&(Se=g)}let we=new Set(J??(Se===void 0?[]:[Se])),le=[];for(let{operation:g,methods:b,declared:m}of S){let E=new URL(g.baseUrl).origin;if(!we.has(E)){h.push({...m,code:\"multiple_hosts\",reason:J===void 0?`Its server origin ${E} differs from ${Se??\"the origin\"} most operations use.`:`Its server origin ${E} is not allowedOrigin ${J.join(\", \")}.`});continue}le.push({operation:g,declared:m});for(let C of b)p.set(C.name,C)}let O=le.map(({operation:g})=>g);if(!O.length){let g=U(h);if(J!==void 0&&S.length>0)throw new X({code:\"no_supported_operations\",reason:`allowedOrigin ${J.join(\", \")} is not the origin of any operation. They resolve to ${[...F.keys()].join(\", \")}. Set allowedOrigin to the origin that receives the account's credentials, or set baseUrl.`,skipped:g,origins:[...F.keys()]});let[b]=g;throw b!==void 0&&g.every(({code:m,reason:E})=>m===b.code&&E===b.reason)?new X({code:b.code,reason:b.reason,skipped:g}):new X({code:\"no_supported_operations\",reason:\"Executor cannot import any operation in this API definition.\",skipped:g})}let A=g=>{let b=Object.keys(g);return b.every(m=>c.has(m))||b.length===1&&f.some(m=>m.name===b[0])},w=g=>{let b=o.resolve(K(a[g])),m=b.type===\"oauth2\"?Object.keys(K(b.flows??{})).join(\"/\"):b.type===\"http\"?b.scheme:b.type===\"apiKey\"?`in ${String(b.in)}`:void 0;return`${g} (${[b.type,m].filter(E=>typeof E==\"string\"&&E!==\"\").join(\" \")})`},v=g=>{let b=Object.keys(g),m=b.filter(E=>!c.has(E)&&!f.some(C=>C.name===E));return m.length>0?m.map(w).join(\" and \"):`${b.map(w).join(\" with \")}, which combines OAuth sign-in with another scheme`},k=g=>{let{security:b}=g.request;if(g.streaming===!0)return{code:\"event_stream\",reason:\"It responds with text/event-stream, which a tool cannot return. Write a subscription for it.\"};if(!(b.length===0||b.some(A)))return{code:\"auth_method\",reason:`Executor cannot authenticate with any of its security requirements: ${b.map(v).join(\"; \")}.`}};if(le.every(({operation:g})=>k(g)!==void 0))throw new X({code:\"no_supported_operations\",reason:\"No operation can be called: each one is left out, streams its response, or needs authentication Executor does not support.\",skipped:U([...h,...le.flatMap(({operation:g,declared:b})=>{let m=k(g);return m===void 0?[]:[{...b,...m}]})])});return{operations:O,skipped:U(h),definitions:Object.fromEntries(o.definitions),methods:Object.fromEntries([...p.values()].map(g=>[g.name,g.bindings])),secrets:[...p.values()],oauth:f,schemes:a,pinnedOrigins:[...we],fallback:l}},catch:o=>o instanceof X?In.fail(o):u.isSchemaError(o)?In.fail(new X({code:\"invalid_document\",reason:\"The definition's structure does not match OpenAPI.\"})):In.die(o)}).pipe(d.catch(o=>o))};var eo=u.Struct({revision:u.String,summaries:u.Number,operations:u.Number,definitions:u.Number,skipped:u.Number,meta:u.optionalKey(vr)}),xc=u.Struct({name:he.fields.name,operationId:he.fields.operationId,description:he.fields.description,method:he.fields.method,request:u.Struct({security:he.fields.request.fields.security}),streaming:he.fields.streaming,tags:he.fields.tags}),_c=e=>({name:e.name,...e.operationId===void 0?{}:{operationId:e.operationId},description:e.description,method:e.method,request:{security:e.request.security},...e.streaming===void 0?{}:{streaming:e.streaming},...e.tags===void 0?{}:{tags:e.tags}}),Nc=u.Array(xc),nt=u.Record(u.String,u.Unknown),Ic=64e3,io=15e5,Cc=1e6,mn=(e,n)=>{let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0)%n},nr=e=>{let n=e.map(([r,i])=>[r,i,JSON.stringify(i).length]),t=n.reduce((r,[,,i])=>r+i,0);for(let r=Math.max(1,Math.ceil(t/Ic));;r*=2){let i=Array.from({length:r},()=>({values:{},size:0,bytes:0}));for(let[o,s,a]of n){let c=i[mn(o,r)];c!==void 0&&(c.values[o]=s,c.size++,c.bytes+=a)}if(r>=n.length||i.every(o=>o.bytes<=io||o.size===1))return i.map(o=>o.values)}},Lc=e=>{let n=[[]],t=0;for(let r of e){let i=JSON.stringify(r).length,o=n[n.length-1];o!==void 0&&o.length>0&&t+i>Cc?(n.push([r]),t=i):(o?.push(r),t+=i)}return n},$c=u.Struct({info:u.optionalKey(u.Struct({title:u.optionalKey(u.String),summary:u.optionalKey(u.String),description:u.optionalKey(u.String)})),tags:u.optionalKey(u.Array(u.Struct({name:u.NonEmptyString,description:u.optionalKey(u.String)})))}),jc=e=>{let n=u.decodeUnknownOption($c)(e);if(ae.isNone(n))return;let{info:t,tags:r}=n.value,i=t?.description??t?.summary,o=(r??[]).flatMap(a=>a.description===void 0?[]:[[a.name,a.description]]),s={...t?.title===void 0?{}:{title:t.title},...i===void 0?{}:{description:i},...o.length===0?{}:{tags:Object.fromEntries(o)}};return Object.keys(s).length===0?void 0:s},Pc=ht(u.String,!1),Rc=e=>{let n=\"\";for(let t=0;t<e.length;t+=32768)n+=String.fromCharCode(...e.subarray(t,t+32768));return btoa(n)},Fc=e=>d.tryPromise({try:async()=>Rc(new Uint8Array(await new Response(new Blob([e]).stream().pipeThrough(new CompressionStream(\"gzip\"))).arrayBuffer())),catch:n=>n}),Mc=e=>d.tryPromise({try:()=>new Response(new Blob([Uint8Array.from(atob(e),n=>n.charCodeAt(0))]).stream().pipeThrough(new DecompressionStream(\"gzip\"))).text(),catch:Oe}),Uc=e=>n=>d.try({try:()=>JSON.parse(n),catch:Oe}).pipe(d.flatMap(t=>u.decodeUnknownEffect(e)(t))),no=e=>ht(e,!1),Oe=()=>new re({reason:\"invalid_definition\"}),tr=\"openapi-v4\",Dc=Ln.batchEntries,Bc=Ln.batchBytes-5e5,rr=Math.floor(Ln.batchBytes/io),qc=e=>d.tryPromise({try:()=>crypto.subtle.digest(\"SHA-256\",new TextEncoder().encode(JSON.stringify(e))),catch:n=>n}).pipe(d.map(n=>Array.from(new Uint8Array(n),t=>t.toString(16).padStart(2,\"0\")).join(\"\"))),to=4,je=new Map,tt=0,Kc=(e,n)=>{let t=new TextEncoder().encode(JSON.stringify([n.operation,n.definitions])).byteLength;if(t>8e6)return;let r=je.get(e);for(r!==void 0&&(tt-=r.bytes,je.delete(e));je.size>=32||tt+t>8e6;){let i=je.keys().next().value;if(i===void 0)break;tt-=je.get(i)?.bytes??0,je.delete(i)}je.set(e,{...n,bytes:t}),tt+=t},Pe=new Map,rt=0,ro=(e,n)=>JSON.stringify([e,n]),Jc=(e,n,t)=>{if(t>8e6)return;let r=Pe.get(e);for(r!==void 0&&(rt-=r.bytes,Pe.delete(e));Pe.size>=4||rt+t>8e6;){let i=Pe.keys().next().value;if(i===void 0)break;rt-=Pe.get(i)?.bytes??0,Pe.delete(i)}Pe.set(e,{parts:n,bytes:t}),rt+=t},dn=new Map,Wc=3e4,Yc=e=>(u.is(re)(e)&&e.reason===\"request\"||u.is(An)(e))&&(e.status===404||e.status===405);function Hc(e,n){let t=e;for(let r of n??[]){if(!r.path.startsWith(\"/\"))throw Oe();let i=r.path.slice(1).split(\"/\").map(s=>s.replace(/~1/g,\"/\").replace(/~0/g,\"~\"));if(i.some(s=>[\"__proto__\",\"constructor\",\"prototype\"].includes(s)))throw Oe();let o=(s,a)=>{let[c,...f]=a;if(c===void 0)throw Oe();if(f.length)return{...s,[c]:o(u.decodeUnknownSync(ne)(Object.hasOwn(s,c)?s[c]:void 0),f)};if(r.op!==\"add\"&&!Object.hasOwn(s,c))throw Oe();if(r.op===\"remove\")return Object.fromEntries(Object.entries(s).filter(([l])=>l!==c));if(r.value===void 0)throw Oe();return{...s,[c]:r.value}};t=o(t,i)}return t}var Vc=(e,n)=>{let t=new Map,r=o=>{if(typeof o!=\"object\"||o===null)return 0;let s=t.get(o);if(s!==void 0)return s;let a=1;for(let c of Array.isArray(o)?o:Object.values(o))if(a+=r(c),a>n)break;return t.set(o,a),a},i=r(e);return i>n?void 0:{total:i,distinct:t.size}},zc=e=>{try{let n=bi(e,{schema:Dt,maxAliases:100}),t=Vc(n,1e7);if(t!==void 0){if(t.total===t.distinct)return n;if(t.total<=t.distinct*10+1e5)return JSON.parse(JSON.stringify(n))}}catch{}return JSON.parse(JSON.stringify(xr(e)))},Gc=(e,n)=>d.gen(function*(){let t=yield*d.tryPromise({try:()=>n.fetch(e,{...n.signal===void 0?{}:{signal:n.signal},redirect:\"manual\"}),catch:o=>o});if(!t.ok||t.body===null)return yield*Oe();let r=t.body.getReader(),i=yield*d.acquireUseRelease(d.succeed(r),o=>d.gen(function*(){let s=new TextDecoder,a=[],c=0;for(;;){let f=yield*d.tryPromise({try:()=>o.read(),catch:l=>l});if(f.done)break;if(c+=f.value.byteLength,c>4e7)return yield*Oe();a.push(s.decode(f.value,{stream:!0}))}return a.push(s.decode()),a.join(\"\")}),o=>d.tryPromise({try:()=>o.cancel(),catch:s=>s}).pipe(d.catch(()=>d.void)));return yield*d.try({try:()=>u.decodeUnknownSync(ne)(i.trimStart().startsWith(\"{\")?JSON.parse(i):zc(i)),catch:Oe})}),oo=(e,n)=>d.gen(function*(){return Hc(\"url\"in e.source?yield*Gc(e.source.url,n):u.decodeUnknownSync(ne)(JSON.parse(JSON.stringify(e.source.document))),e.patches)}),so=(e,n)=>Zi({name:\"API\",...\"url\"in e.source?{connectUrl:e.source.url}:{}},n,{allowedOrigin:e.allowedOrigin,securitySchemes:e.securitySchemes,...e.fallbackSecurity===void 0?{}:{fallbackSecurity:e.fallbackSecurity},...e.baseUrl===void 0?{}:{baseUrl:e.baseUrl},...e.pathPrefix===void 0?{}:{pathPrefix:e.pathPrefix}}),ao=(e,n)=>{let t=n.operationId??n.name;return Object.hasOwn(e??{},t)?e?.[t]??\"mutation\":Rn(n.method)?\"query\":\"mutation\"},Qc=e=>{let n=e.freshFor??\"5 minutes\",t=e.staleFor??\"1 day\",r=Sn.toMillis(Sn.fromInputUnsafe(n))+Sn.toMillis(Sn.fromInputUnsafe(t))+3e5,i=d.cached(d.tryPromise({try:async()=>{let O=new TextEncoder().encode(JSON.stringify({source:e.source,allowedOrigin:e.allowedOrigin,baseUrl:e.baseUrl,pathPrefix:e.pathPrefix,securitySchemes:e.securitySchemes,patches:e.patches,fallbackSecurity:e.fallbackSecurity})),A=await crypto.subtle.digest(\"SHA-256\",O);return Array.from(new Uint8Array(A),w=>w.toString(16).padStart(2,\"0\")).join(\"\")},catch:Oe})),o=d.runSync(i),s=o.pipe(d.map(O=>[tr,O,\"current\"])),a=(O,A,w)=>[tr,O,A,w],c=O=>d.gen(function*(){let A=yield*oo(e,O);yield*d.promise(_e);let w=yield*qc([tr,yield*o,A]),v=jc(A),g=yield*so(e,(()=>{let b=A;if(A=void 0,b===void 0)throw new Error(\"The document was already handed over.\");return b})());return{revision:w,meta:v,compiled:g}}),f=O=>d.gen(function*(){let{revision:A,meta:w,compiled:v}=yield*c(O);yield*d.promise(_e);let k=Lc(v.operations.map(_c)),g=nr(v.operations.map(B=>[B.name,B])),b=nr(Object.entries(v.definitions)),m=v.skipped.length===0?[]:nr(v.skipped.map(B=>[B.name,B])),E=[...k.map((B,q)=>({kind:\"summaries\",name:q,value:B})),...g.map((B,q)=>({kind:\"operations\",name:q,value:B})),...b.map((B,q)=>({kind:\"definitions\",name:q,value:B})),...m.map((B,q)=>({kind:\"skipped\",name:q,value:B}))],C=[],D=[],z=0,be=new Map,ue=0;for(let[B,q]of E.entries()){B%32===31&&(yield*d.promise(_e));let Re=JSON.stringify(q.value),it={key:a(A,q.kind,q.name),value:yield*Fc(Re)},en=new TextEncoder().encode(JSON.stringify(it)).byteLength;D.length&&(D.length>=Dc||z+en>Bc)&&(C.push({entries:D,bytes:z}),D=[],z=0),D.push(it),z+=en,ue+=Re.length,ue<=8e6&&be.set(ro(q.kind,q.name),Re)}return D.length&&C.push({entries:D,bytes:z}),{manifest:{revision:A,summaries:k.length,operations:g.length,definitions:b.length,skipped:m.length,...w===void 0?{}:{meta:w}},batches:C,retained:be,retainedBytes:ue}}),l=O=>d.gen(function*(){let{manifest:A,batches:w,retained:v,retainedBytes:k}=yield*f(O);return yield*d.forEach(w,({entries:g,bytes:b},m)=>tn(rn(O.cache,\"write\"),\"cache\")(g,r).pipe(d.withSpan(\"app.cache.flush\",{attributes:{\"cache.flush.index\":m,\"cache.flush.count\":w.length,\"cache.flush.entries\":g.length,\"cache.flush.bytes\":b}})),{concurrency:to,discard:!0}),Jc(A.revision,v,k),A}),p,h=d.suspend(()=>{let O=p;if(O!==void 0)return Cn.await(O);let A=Cn.makeUnsafe();return p=A,s.pipe(d.flatMap(w=>tn(rn(e.cache,\"get\"),\"cache\")({key:w,schema:no(eo),freshFor:n,staleFor:t,load:mt(l,v=>v.signal)})),d.onExit(w=>d.sync(()=>{p===A&&(p=void 0)}).pipe(d.andThen(Cn.done(A,w)))))}),S=d.gen(function*(){let O=yield*o,A=yield*fr.currentTimeMillis,w=dn.get(O);if(w!==void 0&&!w.running&&A-w.started<Wc)return yield*h;let v=w===void 0||!w.running?{started:A,running:!0}:void 0;return v!==void 0&&(dn.delete(O),dn.set(O,v),dn.size>64&&dn.delete(dn.keys().next().value??O)),yield*s.pipe(d.flatMap(k=>tn(rn(e.cache,\"revalidate\"),\"cache\")({key:k,schema:no(eo),freshFor:n,staleFor:t,load:mt(l,g=>g.signal)})),d.ensuring(d.sync(()=>{v!==void 0&&(v.running=!1)})))}),y=(O,A)=>S.pipe(d.flatMap(w=>j(w,O)),d.catch(()=>d.succeed(void 0)),d.flatMap(w=>d.fail(w!==void 0&&w.value===void 0?new Tr:A))),I=(O,A,w,v)=>{let k=Pe.get(O),g=Uc(v);if(k!==void 0)return d.forEach(w,m=>{let E=k.parts.get(ro(A,m));return E===void 0?d.succeed(void 0):g(E)});let b=Array.from({length:Math.ceil(w.length/rr)},(m,E)=>w.slice(E*rr,(E+1)*rr));return d.forEach(b,m=>tn(rn(e.cache,\"readMany\"),\"cache\")(m.map(E=>a(O,A,E)),Pc).pipe(d.flatMap(E=>d.forEach(E,C=>C===void 0?d.succeed(void 0):Mc(C).pipe(d.flatMap(g))))),{concurrency:to}).pipe(d.map(m=>m.flat()))},M=O=>Array.from({length:O},(A,w)=>w),R=O=>d.gen(function*(){let A=yield*I(O.revision,\"summaries\",M(O.summaries),Nc),w=[];for(let v of A){if(v===void 0)return;w.push(...v)}return w}),j=(O,A)=>d.gen(function*(){let[w]=yield*I(O.revision,\"operations\",[mn(A,O.operations)],nt);if(w===void 0)return;let v=Object.hasOwn(w,A)?w[A]:void 0;return{value:v===void 0?void 0:yield*u.decodeUnknownEffect(he)(v)}}),Y=(O,A)=>d.gen(function*(){if(O.skipped===0)return{value:void 0};let[w]=yield*I(O.revision,\"skipped\",[mn(A,O.skipped)],nt);if(w===void 0)return;let v=Object.hasOwn(w,A)?w[A]:void 0;if(v===void 0)return{value:void 0};let k=yield*u.decodeUnknownEffect(Ir)(v);return yield*new X({code:k.code,reason:k.reason,skipped:[k]})}),H=O=>d.gen(function*(){let A=yield*R(O);if(A===void 0)return;let w=yield*I(O.revision,\"operations\",M(O.operations),nt),v=[];for(let{name:k}of A){let g=w[mn(k,O.operations)],b=g!==void 0&&Object.hasOwn(g,k)?g[k]:void 0;if(b===void 0)return;v.push(yield*u.decodeUnknownEffect(he)(b))}return v}),x=(O,A)=>d.gen(function*(){let w={},v=new Map,k=[...Ke(A)];for(;k.length;){let g=[...new Set(k)].filter(E=>!Object.hasOwn(w,E));k=[];let b=[...new Set(g.map(E=>mn(E,O.definitions)))].filter(E=>!v.has(E)),m=yield*I(O.revision,\"definitions\",b,nt);for(let[E,C]of b.entries()){let D=m[E];if(D===void 0)return;v.set(C,D)}for(let E of g){let C=v.get(mn(E,O.definitions)),D=C!==void 0&&Object.hasOwn(C,E)?C[E]:void 0;if(D===void 0)return;let z=yield*u.decodeUnknownEffect(ne)(D);w[E]=z,k.push(...Ke(z))}}return w}),U=JSON.stringify(Object.entries(e.parameterDefaults??{}).map(([O,A])=>[O,Object.keys(A??{}).sort()])),F=O=>ao(e.kinds,O),V=O=>F(O)===\"query\",J=O=>({name:O.name,description:O.description,readOnly:V(O),...O.tags===void 0?{}:{tags:O.tags}}),Se=(O,A)=>({...J(O),inputSchema:A(bt(O,e.parameterDefaults,!0)),...O.outputSchema===void 0?{}:{outputSchema:A(O.outputSchema)}}),we=O=>d.gen(function*(){for(let A=0;A<2;A++){let w=yield*O(yield*h);if(w!==void 0)return w.value;yield*tn(rn(e.cache,\"invalidate\"),\"cache\")(yield*s)}return yield*Oe()}),le=(O,A)=>Object.fromEntries(Object.entries(O).map(([w,v])=>{let k={description:v.description,readOnly:v.readOnly,input:v.input,run:(g,b)=>v.run(g,b).pipe(d.catchIf(Yc,m=>y(A,m)))};return[w,\"outputSchema\"in v?Object.defineProperty(k,\"outputSchema\",{enumerable:!0,get:()=>v.outputSchema}):k]}));return kr({kind:\"dynamic\",meta:()=>h.pipe(d.map(O=>O.meta??{})),resolve:O=>we(A=>d.gen(function*(){let w=`${A.revision}/${U}/${O}`,v=je.get(w),k=v?.operation;if(k===void 0){let D=yield*j(A,O);if(D===void 0)return;if(D.value===void 0)return yield*Y(A,O);k=D.value}let g=v?.definitions??(yield*x(A,k));if(g===void 0)return;let b=v?.schemas??(yield*At(k,g,e.parameterDefaults));v===void 0&&Kc(w,{operation:k,definitions:g,schemas:b});let m=yield*Dn({...e,operations:[k],definitions:g},new Map([[k.name,b]])),E=Lr(le(m,O),{[k.name]:F(k)}),C=Object.hasOwn(E,O)?E[O]:void 0;return{value:C===void 0?void 0:yr(C)}})),list:()=>we(O=>d.gen(function*(){let A=yield*H(O);if(A===void 0)return;let w=yield*x(O,A);if(w===void 0)return;let v=Un(w),k=qe(e);return{value:A.filter(g=>k.available(g,e.account)).map(g=>Se(g,v))}})),summaries:()=>we(O=>d.gen(function*(){let A=yield*R(O);if(A===void 0)return;let w=qe(e);return{value:A.filter(v=>w.available(v,e.account)).map(v=>J(v))}})),describe:O=>we(A=>d.gen(function*(){let w=yield*j(A,O);if(w===void 0)return;if(w.value===void 0)return yield*Y(A,O);let v=w.value;if(!qe(e).available(v,e.account))return{value:void 0};let k=yield*x(A,v);if(k!==void 0)return{value:Se(v,Un(k))}}))})},Xc=e=>d.runPromise(d.gen(function*(){let n=yield*oo(e,{fetch:e.fetch??globalThis.fetch,...e.signal===void 0?{}:{signal:e.signal}}),t=yield*so(e,n),r=qe(e),i=[...Object.entries(e.methods).map(([s,a])=>({method:s,fields:Object.fromEntries(a.map(({field:c})=>[c,\"placeholder\"]))})),...e.oauth.map(s=>({method:s,fields:{access_token:\"placeholder\"}}))];return{tools:t.operations.flatMap(s=>{let a=i.filter(f=>r.available(s,f)).map(f=>f.method),c=r.available(s,void 0);return a.length===0&&!c?[]:[{name:s.name,method:s.method,path:s.path,...s.operationId===void 0?{}:{operationId:s.operationId},kind:ao(e.kinds,s),public:c,methods:a}]}),skipped:t.skipped}}),e.signal===void 0?{}:{signal:e.signal});var nf=(e,n={})=>d.runPromise(Dn(e).pipe(d.map(t=>$r(t,n))),e.signal===void 0?{}:{signal:e.signal});export{X as OpenapiCompileError,Zc as OpenapiCompileErrorCode,re as OpenapiError,yt as OpenapiErrorResponse,jn as OpenapiParameter,Pn as OpenapiRequestBody,Ir as OpenapiSkippedOperation,el as OpenapiToolName,nl as OpenapiToolNames,wn as isOpenapiTextMedia,Qc as liveOpenapiRouter,St as openapiBinaryResultSchema,Ue as openapiMediaKind,nf as openapiRouter,Xc as openapiToolNames,vt as planOperationNames};\n/*! Bundled license information:\n\njs-yaml/dist/js-yaml.mjs:\n  (*! js-yaml 5.4.2 https://github.com/nodeca/js-yaml @license MIT *)\n*/\n","node_modules/apps/chunk-OFSIEQZ2.js":"import{b as ms}from\"./chunk-OOJM4CTU.js\";var hs={};ms(hs,{Alias:()=>ee,CST:()=>cs,Composer:()=>be,Document:()=>se,Lexer:()=>Be,LineCounter:()=>De,Pair:()=>v,Parser:()=>we,Scalar:()=>y,Schema:()=>ve,YAMLError:()=>_e,YAMLMap:()=>$,YAMLParseError:()=>R,YAMLSeq:()=>B,YAMLWarning:()=>Pe,isAlias:()=>F,isCollection:()=>L,isDocument:()=>x,isMap:()=>U,isNode:()=>I,isPair:()=>T,isScalar:()=>E,isSeq:()=>V,parse:()=>un,parseAllDocuments:()=>fn,parseDocument:()=>us,stringify:()=>hn,visit:()=>Q,visitAsync:()=>je});var tt=Symbol.for(\"yaml.alias\"),st=Symbol.for(\"yaml.document\"),Y=Symbol.for(\"yaml.map\"),qt=Symbol.for(\"yaml.pair\"),q=Symbol.for(\"yaml.scalar\"),re=Symbol.for(\"yaml.seq\"),K=Symbol.for(\"yaml.node.type\"),F=s=>!!s&&typeof s==\"object\"&&s[K]===tt,x=s=>!!s&&typeof s==\"object\"&&s[K]===st,U=s=>!!s&&typeof s==\"object\"&&s[K]===Y,T=s=>!!s&&typeof s==\"object\"&&s[K]===qt,E=s=>!!s&&typeof s==\"object\"&&s[K]===q,V=s=>!!s&&typeof s==\"object\"&&s[K]===re;function L(s){if(s&&typeof s==\"object\")switch(s[K]){case Y:case re:return!0}return!1}function I(s){if(s&&typeof s==\"object\")switch(s[K]){case tt:case Y:case q:case re:return!0}return!1}var nt=s=>(E(s)||L(s))&&!!s.anchor;var j=Symbol(\"break visit\"),ds=Symbol(\"skip children\"),z=Symbol(\"remove node\");function Q(s,e){let t=gs(e);x(s)?ke(null,s.contents,t,Object.freeze([s]))===z&&(s.contents=null):ke(null,s,t,Object.freeze([]))}Q.BREAK=j;Q.SKIP=ds;Q.REMOVE=z;function ke(s,e,t,n){let i=ys(s,e,t,n);if(I(i)||T(i))return bs(s,n,i),ke(s,i,t,n);if(typeof i!=\"symbol\"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=ke(r,e.items[r],t,n);if(typeof o==\"number\")r=o-1;else{if(o===j)return j;o===z&&(e.items.splice(r,1),r-=1)}}}else if(T(e)){n=Object.freeze(n.concat(e));let r=ke(\"key\",e.key,t,n);if(r===j)return j;r===z&&(e.key=null);let o=ke(\"value\",e.value,t,n);if(o===j)return j;o===z&&(e.value=null)}}return i}async function je(s,e){let t=gs(e);x(s)?await Ne(null,s.contents,t,Object.freeze([s]))===z&&(s.contents=null):await Ne(null,s,t,Object.freeze([]))}je.BREAK=j;je.SKIP=ds;je.REMOVE=z;async function Ne(s,e,t,n){let i=await ys(s,e,t,n);if(I(i)||T(i))return bs(s,n,i),Ne(s,i,t,n);if(typeof i!=\"symbol\"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=await Ne(r,e.items[r],t,n);if(typeof o==\"number\")r=o-1;else{if(o===j)return j;o===z&&(e.items.splice(r,1),r-=1)}}}else if(T(e)){n=Object.freeze(n.concat(e));let r=await Ne(\"key\",e.key,t,n);if(r===j)return j;r===z&&(e.key=null);let o=await Ne(\"value\",e.value,t,n);if(o===j)return j;o===z&&(e.value=null)}}return i}function gs(s){return typeof s==\"object\"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function ys(s,e,t,n){if(typeof t==\"function\")return t(s,e,n);if(U(e))return t.Map?.(s,e,n);if(V(e))return t.Seq?.(s,e,n);if(T(e))return t.Pair?.(s,e,n);if(E(e))return t.Scalar?.(s,e,n);if(F(e))return t.Alias?.(s,e,n)}function bs(s,e,t){let n=e[e.length-1];if(L(n))n.items[s]=t;else if(T(n))s===\"key\"?n.key=t:n.value=t;else if(x(n))n.contents=t;else{let i=F(n)?\"alias\":\"scalar\";throw new Error(`Cannot replace node with ${i} parent`)}}var pn={\"!\":\"%21\",\",\":\"%2C\",\"[\":\"%5B\",\"]\":\"%5D\",\"{\":\"%7B\",\"}\":\"%7D\"},mn=s=>s.replace(/[!,[\\]{}]/g,e=>pn[e]),Z=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case\"1.1\":this.atNextDocument=!0;break;case\"1.2\":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:\"1.2\"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:\"1.1\"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \\t]+/),i=n.shift();switch(i){case\"%TAG\":{if(n.length!==2&&(t(0,\"%TAG directive should contain exactly two parts\"),n.length<2))return!1;let[r,o]=n;return this.tags[r]=o,!0}case\"%YAML\":{if(this.yaml.explicit=!0,n.length!==1)return t(0,\"%YAML directive should contain exactly one part\"),!1;let[r]=n;if(r===\"1.1\"||r===\"1.2\")return this.yaml.version=r,!0;{let o=/^\\d+\\.\\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===\"!\")return\"!\";if(e[0]!==\"!\")return t(`Not a valid tag: ${e}`),null;if(e[1]===\"<\"){let o=e.slice(2,-1);return o===\"!\"||o===\"!!\"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==\">\"&&t(\"Verbatim tags must end with a >\"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);let r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n===\"!\"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+mn(e.substring(n.length));return e[0]===\"!\"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||\"1.2\"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&I(e.contents)){let r={};Q(e.contents,(o,l)=>{I(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of n)r===\"!!\"&&o===\"tag:yaml.org,2002:\"||(!e||i.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`\n`)}};Z.defaultYaml={explicit:!1,version:\"1.2\"};Z.defaultTags={\"!!\":\"tag:yaml.org,2002:\"};function it(s){if(/[\\x00-\\x19\\s,[\\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Rt(s){let e=new Set;return Q(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function Ft(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function ws(s,e){let t=[],n=new Map,i=null;return{onAnchor:r=>{t.push(r),i??(i=Rt(s));let o=Ft(e,i);return i.add(o),o},setAnchors:()=>{for(let r of t){let o=n.get(r);if(typeof o==\"object\"&&o.anchor&&(E(o.node)||L(o.node)))o.node.anchor=o.anchor;else{let l=new Error(\"Failed to resolve repeated object (this should not happen)\");throw l.source=r,l}}},sourceObjects:n}}function fe(s,e,t,n){if(n&&typeof n==\"object\")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){let o=n[i],l=fe(s,n,String(i),o);l===void 0?delete n[i]:l!==o&&(n[i]=l)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let r=n.get(i),o=fe(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let r=fe(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(let[i,r]of Object.entries(n)){let o=fe(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}function M(s,e,t){if(Array.isArray(s))return s.map((n,i)=>M(n,String(i),t));if(s&&typeof s.toJSON==\"function\"){if(!t||!nt(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s==\"bigint\"&&!t?.keep?Number(s):s}var ue=class{constructor(e){Object.defineProperty(this,K,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!x(e))throw new TypeError(\"A document argument is required\");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==\"number\"?n:100},l=M(this,\"\",o);if(typeof i==\"function\")for(let{count:a,res:c}of o.anchors.values())i(c,a);return typeof r==\"function\"?fe(r,{\"\":l},\"\",l):l}};var ee=class extends ue{constructor(e){super(tt),this.source=e,Object.defineProperty(this,\"tag\",{set(){throw new Error(\"Alias nodes cannot have tags\")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError(\"Alias resolution is disabled\");let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Q(e,{Node:(r,o)=>{(F(o)||nt(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(let r of n){if(r===this)break;r.anchor===this.source&&(i=r)}if(i&&t){let{anchors:r,doc:o,maxAliasCount:l}=t,a=r.get(i);if(a||(M(i,null,t),a=r.get(i)),a?.res===void 0){let c=\"This should not happen: Alias anchor was not resolved?\";throw new ReferenceError(c)}if(l>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=rt(o,i,r)),a.count*a.aliasCount>l)){let c=\"Excessive alias count indicates a resource exhaustion attack\";throw new ReferenceError(c)}}return i}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return t.anchors.get(n).res}toString(e,t,n){let i=`*${this.source}`;if(e){if(it(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function rt(s,e,t){if(F(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(L(e)){let n=0;for(let i of e.items){let r=rt(s,i,t);r>n&&(n=r)}return n}else if(T(e)){let n=rt(s,e.key,t),i=rt(s,e.value,t);return Math.max(n,i)}return 1}var ot=s=>!s||typeof s!=\"function\"&&typeof s!=\"object\",y=class extends ue{constructor(e){super(q),this.value=e}toJSON(e,t){return t?.keep?this.value:M(this.value,e,t)}toString(){return String(this.value)}};y.BLOCK_FOLDED=\"BLOCK_FOLDED\";y.BLOCK_LITERAL=\"BLOCK_LITERAL\";y.PLAIN=\"PLAIN\";y.QUOTE_DOUBLE=\"QUOTE_DOUBLE\";y.QUOTE_SINGLE=\"QUOTE_SINGLE\";var dn=\"tag:yaml.org,2002:\";function gn(s,e,t){if(e){let n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function oe(s,e,t){if(x(s)&&(s=s.contents),I(s))return s;if(T(s)){let f=t.schema[Y].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<\"u\"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=t,a;if(n&&s&&typeof s==\"object\"){if(a=l.get(s),a)return a.anchor??(a.anchor=i(s)),new ee(a.anchor);a={anchor:null,node:null},l.set(s,a)}e?.startsWith(\"!!\")&&(e=dn+e.slice(2));let c=gn(s,e,o.tags);if(!c){if(s&&typeof s.toJSON==\"function\"&&(s=s.toJSON()),!s||typeof s!=\"object\"){let f=new y(s);return a&&(a.node=f),f}c=s instanceof Map?o[Y]:Symbol.iterator in Object(s)?o[re]:o[Y]}r&&(r(c),delete t.onTagObj);let p=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from==\"function\"?c.nodeClass.from(t.schema,s,t):new y(s);return e?p.tag=e:c.default||(p.tag=c.tag),a&&(a.node=p),p}function qe(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r==\"number\"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return oe(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error(\"This should not happen, please report a bug.\")},schema:s,sourceObjects:new Map})}var Ae=s=>s==null||typeof s==\"object\"&&!!s[Symbol.iterator]().next().done,Oe=class extends ue{constructor(e,t){super(e),Object.defineProperty(this,\"schema\",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>I(n)||T(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Ae(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(L(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,qe(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!0);if(L(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&E(r)?r.value:r:L(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!T(t))return!1;let n=t.value;return n==null||e&&E(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let i=this.get(t,!0);return L(i)?i.hasIn(n):!1}setIn(e,t){let[n,...i]=e;if(i.length===0)this.set(n,t);else{let r=this.get(n,!0);if(L(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,qe(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};var Ss=s=>s.replace(/^(?!$)(?: $)?/gm,\"#\");function J(s,e){return/^\\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var te=(s,e,t)=>s.endsWith(`\n`)?J(t,e):t.includes(`\n`)?`\n`+J(t,e):(s.endsWith(\" \")?\"\":\" \")+t;var xt=\"flow\",lt=\"block\",Re=\"quoted\";function Fe(s,e,t=\"flow\",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return s;i<r&&(r=0);let a=Math.max(1+r,1+i-e.length);if(s.length<=a)return s;let c=[],p={},f=i-e.length;typeof n==\"number\"&&(n>i-Math.max(2,r)?c.push(0):f=i-n);let u,d,g=!1,h=-1,m=-1,w=-1;t===lt&&(h=ks(s,h,e.length),h!==-1&&(f=h+a));for(let k;k=s[h+=1];){if(t===Re&&k===\"\\\\\"){switch(m=h,s[h+1]){case\"x\":h+=3;break;case\"u\":h+=5;break;case\"U\":h+=9;break;default:h+=1}w=h}if(k===`\n`)t===lt&&(h=ks(s,h,e.length)),f=h+e.length+a,u=void 0;else{if(k===\" \"&&d&&d!==\" \"&&d!==`\n`&&d!==\"\t\"){let N=s[h+1];N&&N!==\" \"&&N!==`\n`&&N!==\"\t\"&&(u=h)}if(h>=f)if(u)c.push(u),f=u+a,u=void 0;else if(t===Re){for(;d===\" \"||d===\"\t\";)d=k,k=s[h+=1],g=!0;let N=h>w+1?h-2:m-1;if(p[N])return s;c.push(N),p[N]=!0,f=N+a,u=void 0}else g=!0}d=k}if(g&&l&&l(),c.length===0)return s;o&&o();let S=s.slice(0,c[0]);for(let k=0;k<c.length;++k){let N=c[k],O=c[k+1]||s.length;N===0?S=`\n${e}${s.slice(0,O)}`:(t===Re&&p[N]&&(S+=`${s[N]}\\\\`),S+=`\n${e}${s.slice(N+1,O)}`)}return S}function ks(s,e,t){let n=e,i=e+1,r=s[i];for(;r===\" \"||r===\"\t\";)if(e<i+t)r=s[++e];else{do r=s[++e];while(r&&r!==`\n`);n=e,i=e+1,r=s[i]}return n}var ct=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),ft=s=>/^(%|---|\\.\\.\\.)/m.test(s);function yn(s,e,t){if(!e||e<0)return!1;let n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;r<i;++r)if(s[r]===`\n`){if(r-o>n)return!0;if(o=r+1,i-o<=n)return!1}return!0}function xe(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(ft(s)?\"  \":\"\"),o=\"\",l=0;for(let a=0,c=t[a];c;c=t[++a])if(c===\" \"&&t[a+1]===\"\\\\\"&&t[a+2]===\"n\"&&(o+=t.slice(l,a)+\"\\\\ \",a+=1,l=a,c=\"\\\\\"),c===\"\\\\\")switch(t[a+1]){case\"u\":{o+=t.slice(l,a);let p=t.substr(a+2,4);switch(p){case\"0000\":o+=\"\\\\0\";break;case\"0007\":o+=\"\\\\a\";break;case\"000b\":o+=\"\\\\v\";break;case\"001b\":o+=\"\\\\e\";break;case\"0085\":o+=\"\\\\N\";break;case\"00a0\":o+=\"\\\\_\";break;case\"2028\":o+=\"\\\\L\";break;case\"2029\":o+=\"\\\\P\";break;default:p.substr(0,2)===\"00\"?o+=\"\\\\x\"+p.substr(2):o+=t.substr(a,6)}a+=5,l=a+1}break;case\"n\":if(n||t[a+2]==='\"'||t.length<i)a+=1;else{for(o+=t.slice(l,a)+`\n\n`;t[a+2]===\"\\\\\"&&t[a+3]===\"n\"&&t[a+4]!=='\"';)o+=`\n`,a+=2;o+=r,t[a+2]===\" \"&&(o+=\"\\\\\"),a+=1,l=a+1}break;default:a+=1}return o=l?o+t.slice(l):t,n?o:Fe(o,r,Re,ct(e,!1))}function Ut(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`\n`)||/[ \\t]\\n|\\n[ \\t]/.test(s))return xe(s,e);let t=e.indent||(ft(s)?\"  \":\"\"),n=\"'\"+s.replace(/'/g,\"''\").replace(/\\n+/g,`$&\n${t}`)+\"'\";return e.implicitKey?n:Fe(n,t,xt,ct(e,!1))}function Ee(s,e){let{singleQuote:t}=e.options,n;if(t===!1)n=xe;else{let i=s.includes('\"'),r=s.includes(\"'\");i&&!r?n=Ut:r&&!i?n=xe:n=t?Ut:xe}return n(s,e)}var Vt;try{Vt=new RegExp(`(^|(?<!\n))\n+(?!\n|$)`,\"g\")}catch{Vt=/\\n+(?!\\n|$)/g}function at({comment:s,type:e,value:t},n,i,r){let{blockQuote:o,commentString:l,lineWidth:a}=n.options;if(!o||/\\n[\\t ]+$/.test(t))return Ee(t,n);let c=n.indent||(n.forceBlockIndent||ft(t)?\"  \":\"\"),p=o===\"literal\"?!0:o===\"folded\"||e===y.BLOCK_FOLDED?!1:e===y.BLOCK_LITERAL?!0:!yn(t,a,c.length);if(!t)return p?`|\n`:`>\n`;let f,u;for(u=t.length;u>0;--u){let O=t[u-1];if(O!==`\n`&&O!==\"\t\"&&O!==\" \")break}let d=t.substring(u),g=d.indexOf(`\n`);g===-1?f=\"-\":t===d||g!==d.length-1?(f=\"+\",r&&r()):f=\"\",d&&(t=t.slice(0,-d.length),d[d.length-1]===`\n`&&(d=d.slice(0,-1)),d=d.replace(Vt,`$&${c}`));let h=!1,m,w=-1;for(m=0;m<t.length;++m){let O=t[m];if(O===\" \")h=!0;else if(O===`\n`)w=m;else break}let S=t.substring(0,w<m?w+1:m);S&&(t=t.substring(S.length),S=S.replace(/\\n+/g,`$&${c}`));let N=(h?c?\"2\":\"1\":\"\")+f;if(s&&(N+=\" \"+l(s.replace(/ ?[\\r\\n]+/g,\" \")),i&&i()),!p){let O=t.replace(/\\n+/g,`\n$&`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,\"$1$2\").replace(/\\n+/g,`$&${c}`),A=!1,C=ct(n,!0);o!==\"folded\"&&e!==y.BLOCK_FOLDED&&(C.onOverflow=()=>{A=!0});let b=Fe(`${S}${O}${d}`,c,lt,C);if(!A)return`>${N}\n${c}${b}`}return t=t.replace(/\\n+/g,`$&${c}`),`|${N}\n${c}${S}${t}${d}`}function bn(s,e,t,n){let{type:i,value:r}=s,{actualString:o,implicitKey:l,indent:a,indentStep:c,inFlow:p}=e;if(l&&r.includes(`\n`)||p&&/[[\\]{},]/.test(r))return Ee(r,e);if(/^[\\n\\t ,[\\]{}#&*!|>'\"%@`]|^[?-]$|^[?-][ \\t]|[\\n:][ \\t]|[ \\t]\\n|[\\n\\t ]#|[\\n\\t :]$/.test(r))return l||p||!r.includes(`\n`)?Ee(r,e):at(s,e,t,n);if(!l&&!p&&i!==y.PLAIN&&r.includes(`\n`))return at(s,e,t,n);if(ft(r)){if(a===\"\")return e.forceBlockIndent=!0,at(s,e,t,n);if(l&&a===c)return Ee(r,e)}let f=r.replace(/\\n+/g,`$&\n${a}`);if(o){let u=h=>h.default&&h.tag!==\"tag:yaml.org,2002:str\"&&h.test?.test(f),{compat:d,tags:g}=e.doc.schema;if(g.some(u)||d?.some(u))return Ee(r,e)}return l?f:Fe(f,a,xt,ct(e,!1))}function le(s,e,t,n){let{implicitKey:i,inFlow:r}=e,o=typeof s.value==\"string\"?s:Object.assign({},s,{value:String(s.value)}),{type:l}=s;l!==y.QUOTE_DOUBLE&&/[\\x00-\\x08\\x0b-\\x1f\\x7f-\\x9f\\u{D800}-\\u{DFFF}]/u.test(o.value)&&(l=y.QUOTE_DOUBLE);let a=p=>{switch(p){case y.BLOCK_FOLDED:case y.BLOCK_LITERAL:return i||r?Ee(o.value,e):at(o,e,t,n);case y.QUOTE_DOUBLE:return xe(o.value,e);case y.QUOTE_SINGLE:return Ut(o.value,e);case y.PLAIN:return bn(o,e,t,n);default:return null}},c=a(l);if(c===null){let{defaultKeyType:p,defaultStringType:f}=e.options,u=i&&p||f;if(c=a(u),c===null)throw new Error(`Unsupported default string type ${u}`)}return c}function ut(s,e){let t=Object.assign({blockQuote:!0,commentString:Ss,defaultKeyType:null,defaultStringType:\"PLAIN\",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:\"false\",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:\"null\",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:\"true\",verifyAliasOrder:!0},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case\"block\":n=!1;break;case\"flow\":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?\" \":\"\",indent:\"\",indentStep:typeof t.indent==\"number\"?\" \".repeat(t.indent):\"  \",inFlow:n,options:t}}function wn(s,e){if(e.tag){let i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,n;if(E(e)){n=e.value;let i=s.filter(r=>r.identify?.(n));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){let i=n?.constructor?.name??(n===null?\"null\":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return t}function Sn(s,e,{anchors:t,doc:n}){if(!n.directives)return\"\";let i=[],r=(E(s)||L(s))&&s.anchor;r&&it(r)&&(t.add(r),i.push(`&${r}`));let o=s.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(\" \")}function ae(s,e,t,n){if(T(s))return s.toString(e,t,n);if(F(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError(\"Cannot stringify circular structure without alias nodes\");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i,r=I(s)?s:e.doc.createNode(s,{onTagObj:a=>i=a});i??(i=wn(e.doc.schema.tags,r));let o=Sn(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let l=typeof i.stringify==\"function\"?i.stringify(r,e,t,n):E(r)?le(r,e,t,n):r.toString(e,t,n);return o?E(r)||l[0]===\"{\"||l[0]===\"[\"?`${o} ${l}`:`${o}\n${e.indent}${l}`:l}function Ns({key:s,value:e},t,n,i){let{allNullValues:r,doc:o,indent:l,indentStep:a,options:{commentString:c,indentSeq:p,simpleKeys:f}}=t,u=I(s)&&s.comment||null;if(f){if(u)throw new Error(\"With simple keys, key nodes cannot have comments\");if(L(s)||!I(s)&&typeof s==\"object\"){let C=\"With simple keys, collection cannot be used as a key value\";throw new Error(C)}}let d=!f&&(!s||u&&e==null&&!t.inFlow||L(s)||(E(s)?s.type===y.BLOCK_FOLDED||s.type===y.BLOCK_LITERAL:typeof s==\"object\"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!d&&(f||!r),indent:l+a});let g=!1,h=!1,m=ae(s,t,()=>g=!0,()=>h=!0);if(!d&&!t.inFlow&&m.length>1024){if(f)throw new Error(\"With simple keys, single line scalar must not span more than 1024 characters\");d=!0}if(t.inFlow){if(r||e==null)return g&&n&&n(),m===\"\"?\"?\":d?`? ${m}`:m}else if(r&&!f||e==null&&d)return m=`? ${m}`,u&&!g?m+=te(m,t.indent,c(u)):h&&i&&i(),m;g&&(u=null),d?(u&&(m+=te(m,t.indent,c(u))),m=`? ${m}\n${l}:`):(m=`${m}:`,u&&(m+=te(m,t.indent,c(u))));let w,S,k;I(e)?(w=!!e.spaceBefore,S=e.commentBefore,k=e.comment):(w=!1,S=null,k=null,e&&typeof e==\"object\"&&(e=o.createNode(e))),t.implicitKey=!1,!d&&!u&&E(e)&&(t.indentAtStart=m.length+1),h=!1,!p&&a.length>=2&&!t.inFlow&&!d&&V(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let N=!1,O=ae(e,t,()=>N=!0,()=>h=!0),A=\" \";if(u||w||S){if(A=w?`\n`:\"\",S){let C=c(S);A+=`\n${J(C,t.indent)}`}O===\"\"&&!t.inFlow?A===`\n`&&k&&(A=`\n\n`):A+=`\n${t.indent}`}else if(!d&&L(e)){let C=O[0],b=O.indexOf(`\n`),_=b!==-1,ce=t.inFlow??e.flow??e.items.length===0;if(_||!ce){let Se=!1;if(_&&(C===\"&\"||C===\"!\")){let P=O.indexOf(\" \");C===\"&\"&&P!==-1&&P<b&&O[P+1]===\"!\"&&(P=O.indexOf(\" \",P+1)),(P===-1||b<P)&&(Se=!0)}Se||(A=`\n${t.indent}`)}}else(O===\"\"||O[0]===`\n`)&&(A=\"\");return m+=A+O,t.inFlow?N&&n&&n():k&&!N?m+=te(m,t.indent,c(k)):h&&i&&i(),m}function ht(s,e){(s===\"debug\"||s===\"warn\")&&console.warn(e)}var pt=\"<<\",G={identify:s=>s===pt||typeof s==\"symbol\"&&s.description===pt,default:\"key\",tag:\"tag:yaml.org,2002:merge\",test:/^<<$/,resolve:()=>Object.assign(new y(Symbol(pt)),{addToJSMap:Yt}),stringify:()=>pt},Os=(s,e)=>(G.identify(e)||E(e)&&(!e.type||e.type===y.PLAIN)&&G.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===G.tag&&t.default);function Yt(s,e,t){let n=As(s,t);if(V(n))for(let i of n.items)Jt(s,e,i);else if(Array.isArray(n))for(let i of n)Jt(s,e,i);else Jt(s,e,n)}function Jt(s,e,t){let n=As(s,t);if(!U(n))throw new Error(\"Merge sources must be maps or map aliases\");let i=n.toJSON(null,s,Map);for(let[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function As(s,e){return s&&F(e)?e.resolve(s.doc,s):e}function mt(s,e,{key:t,value:n}){if(I(t)&&t.addToJSMap)t.addToJSMap(s,e,n);else if(Os(s,t))Yt(s,e,n);else{let i=M(t,\"\",s);if(e instanceof Map)e.set(i,M(n,i,s));else if(e instanceof Set)e.add(i);else{let r=kn(t,i,s),o=M(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function kn(s,e,t){if(e===null)return\"\";if(typeof e!=\"object\")return String(e);if(I(s)&&t?.doc){let n=ut(t.doc,{});n.anchors=new Set;for(let r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'...\"'),ht(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Te(s,e,t){let n=oe(s,void 0,t),i=oe(e,void 0,t);return new v(n,i)}var v=class s{constructor(e,t=null){Object.defineProperty(this,K,{value:qt}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return I(t)&&(t=t.clone(e)),I(n)&&(n=n.clone(e)),new s(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return mt(t,n,this)}toString(e,t,n){return e?.doc?Ns(this,e,t,n):JSON.stringify(this)}};function gt(s,e,t){return(e.inFlow??s.flow?On:Nn)(s,e,t)}function Nn({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:l}){let{indent:a,options:{commentString:c}}=t,p=Object.assign({},t,{indent:r,type:null}),f=!1,u=[];for(let g=0;g<e.length;++g){let h=e[g],m=null;if(I(h))!f&&h.spaceBefore&&u.push(\"\"),dt(t,u,h.commentBefore,f),h.comment&&(m=h.comment);else if(T(h)){let S=I(h.key)?h.key:null;S&&(!f&&S.spaceBefore&&u.push(\"\"),dt(t,u,S.commentBefore,f))}f=!1;let w=ae(h,p,()=>m=null,()=>f=!0);m&&(w+=te(w,r,c(m))),f&&m&&(f=!1),u.push(n+w)}let d;if(u.length===0)d=i.start+i.end;else{d=u[0];for(let g=1;g<u.length;++g){let h=u[g];d+=h?`\n${a}${h}`:`\n`}}return s?(d+=`\n`+J(c(s),a),l&&l()):f&&o&&o(),d}function On({items:s},e,{flowChars:t,itemIndent:n}){let{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:l}}=e;n+=r;let a=Object.assign({},e,{indent:n,inFlow:!0,type:null}),c=!1,p=0,f=[];for(let g=0;g<s.length;++g){let h=s[g],m=null;if(I(h))h.spaceBefore&&f.push(\"\"),dt(e,f,h.commentBefore,!1),h.comment&&(m=h.comment);else if(T(h)){let S=I(h.key)?h.key:null;S&&(S.spaceBefore&&f.push(\"\"),dt(e,f,S.commentBefore,!1),S.comment&&(c=!0));let k=I(h.value)?h.value:null;k?(k.comment&&(m=k.comment),k.commentBefore&&(c=!0)):h.value==null&&S?.comment&&(m=S.comment)}m&&(c=!0);let w=ae(h,a,()=>m=null);c||(c=f.length>p||w.includes(`\n`)),g<s.length-1?w+=\",\":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=f.reduce((S,k)=>S+k.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=\",\")),m&&(w+=te(w,n,l(m))),f.push(w),p=f.length}let{start:u,end:d}=t;if(f.length===0)return u+d;if(!c){let g=f.reduce((h,m)=>h+m.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=u;for(let h of f)g+=h?`\n${r}${i}${h}`:`\n`;return`${g}\n${i}${d}`}else return`${u}${o}${f.join(\" \")}${o}${d}`}function dt({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\\n+/,\"\")),n){let r=J(e(n),s);t.push(r.trimStart())}}function he(s,e){let t=E(e)?e.value:e;for(let n of s)if(T(n)&&(n.key===e||n.key===t||E(n.key)&&n.key.value===t))return n}var $=class extends Oe{static get tagName(){return\"tag:yaml.org,2002:map\"}constructor(e){super(Y,e),this.items=[]}static from(e,t,n){let{keepUndefined:i,replacer:r}=n,o=new this(e),l=(a,c)=>{if(typeof r==\"function\")c=r.call(t,a,c);else if(Array.isArray(r)&&!r.includes(a))return;(c!==void 0||i)&&o.items.push(Te(a,c,n))};if(t instanceof Map)for(let[a,c]of t)l(a,c);else if(t&&typeof t==\"object\")for(let a of Object.keys(t))l(a,t[a]);return typeof e.sortMapEntries==\"function\"&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;T(e)?n=e:!e||typeof e!=\"object\"||!(\"key\"in e)?n=new v(e,e?.value):n=new v(e.key,e.value);let i=he(this.items,n.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);E(i.value)&&ot(n.value)?i.value.value=n.value:i.value=n.value}else if(r){let o=this.items.findIndex(l=>r(n,l)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=he(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let i=he(this.items,e)?.value;return(!t&&E(i)?i.value:i)??void 0}has(e){return!!he(this.items,e)}set(e,t){this.add(new v(e,t),!0)}toJSON(e,t,n){let i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(let r of this.items)mt(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!T(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),gt(this,e,{blockItemPrefix:\"\",flowChars:{start:\"{\",end:\"}\"},itemIndent:e.indent||\"\",onChompKeep:n,onComment:t})}};var W={collection:\"map\",default:!0,nodeClass:$,tag:\"tag:yaml.org,2002:map\",resolve(s,e){return U(s)||e(\"Expected a mapping for this tag\"),s},createNode:(s,e,t)=>$.from(s,e,t)};var B=class extends Oe{static get tagName(){return\"tag:yaml.org,2002:seq\"}constructor(e){super(re,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=yt(e);return typeof t!=\"number\"?!1:this.items.splice(t,1).length>0}get(e,t){let n=yt(e);if(typeof n!=\"number\")return;let i=this.items[n];return!t&&E(i)?i.value:i}has(e){let t=yt(e);return typeof t==\"number\"&&t<this.items.length}set(e,t){let n=yt(e);if(typeof n!=\"number\")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];E(i)&&ot(t)?i.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let i=0;for(let r of this.items)n.push(M(r,String(i++),t));return n}toString(e,t,n){return e?gt(this,e,{blockItemPrefix:\"- \",flowChars:{start:\"[\",end:\"]\"},itemIndent:(e.indent||\"\")+\"  \",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let l of t){if(typeof i==\"function\"){let a=t instanceof Set?l:String(o++);l=i.call(t,a,l)}r.items.push(oe(l,void 0,n))}}return r}};function yt(s){let e=E(s)?s.value:s;return e&&typeof e==\"string\"&&(e=Number(e)),typeof e==\"number\"&&Number.isInteger(e)&&e>=0?e:null}var H={collection:\"seq\",default:!0,nodeClass:B,tag:\"tag:yaml.org,2002:seq\",resolve(s,e){return V(s)||e(\"Expected a sequence for this tag\"),s},createNode:(s,e,t)=>B.from(s,e,t)};var pe={identify:s=>typeof s==\"string\",default:!0,tag:\"tag:yaml.org,2002:str\",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),le(s,e,t,n)}};var ye={identify:s=>s==null,createNode:()=>new y(null),default:!0,tag:\"tag:yaml.org,2002:null\",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new y(null),stringify:({source:s},e)=>typeof s==\"string\"&&ye.test.test(s)?s:e.options.nullStr};var Ue={identify:s=>typeof s==\"boolean\",default:!0,tag:\"tag:yaml.org,2002:bool\",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new y(s[0]===\"t\"||s[0]===\"T\"),stringify({source:s,value:e},t){if(s&&Ue.test.test(s)){let n=s[0]===\"t\"||s[0]===\"T\";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function D({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n==\"bigint\")return String(n);let i=typeof n==\"number\"?n:Number(n);if(!isFinite(i))return isNaN(i)?\".nan\":i<0?\"-.inf\":\".inf\";let r=Object.is(n,-0)?\"-0\":JSON.stringify(n);if(!s&&e&&(!t||t===\"tag:yaml.org,2002:float\")&&/^-?\\d/.test(r)&&!r.includes(\"e\")){let o=r.indexOf(\".\");o<0&&(o=r.length,r+=\".\");let l=e-(r.length-o-1);for(;l-- >0;)r+=\"0\"}return r}var bt={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",test:/^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()===\"nan\"?NaN:s[0]===\"-\"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},wt={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",format:\"EXP\",test:/^[-+]?(?:\\.[0-9]+|[0-9]+(?:\\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},St={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",test:/^[-+]?(?:\\.[0-9]+|[0-9]+\\.[0-9]*)$/,resolve(s){let e=new y(parseFloat(s)),t=s.indexOf(\".\");return t!==-1&&s[s.length-1]===\"0\"&&(e.minFractionDigits=s.length-t-1),e},stringify:D};var kt=s=>typeof s==\"bigint\"||Number.isInteger(s),Qt=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Es(s,e,t){let{value:n}=s;return kt(n)&&n>=0?t+n.toString(e):D(s)}var Nt={identify:s=>kt(s)&&s>=0,default:!0,tag:\"tag:yaml.org,2002:int\",format:\"OCT\",test:/^0o[0-7]+$/,resolve:(s,e,t)=>Qt(s,2,8,t),stringify:s=>Es(s,8,\"0o\")},Ot={identify:kt,default:!0,tag:\"tag:yaml.org,2002:int\",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>Qt(s,0,10,t),stringify:D},At={identify:s=>kt(s)&&s>=0,default:!0,tag:\"tag:yaml.org,2002:int\",format:\"HEX\",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>Qt(s,2,16,t),stringify:s=>Es(s,16,\"0x\")};var Ts=[W,H,pe,ye,Ue,Nt,Ot,At,bt,wt,St];function Is(s){return typeof s==\"bigint\"||Number.isInteger(s)}var Et=({value:s})=>JSON.stringify(s),An=[{identify:s=>typeof s==\"string\",default:!0,tag:\"tag:yaml.org,2002:str\",resolve:s=>s,stringify:Et},{identify:s=>s==null,createNode:()=>new y(null),default:!0,tag:\"tag:yaml.org,2002:null\",test:/^null$/,resolve:()=>null,stringify:Et},{identify:s=>typeof s==\"boolean\",default:!0,tag:\"tag:yaml.org,2002:bool\",test:/^true$|^false$/,resolve:s=>s===\"true\",stringify:Et},{identify:Is,default:!0,tag:\"tag:yaml.org,2002:int\",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>Is(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",test:/^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Et}],En={default:!0,tag:\"\",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Ls=[W,H].concat(An,En);var Ve={identify:s=>s instanceof Uint8Array,default:!1,tag:\"tag:yaml.org,2002:binary\",resolve(s,e){if(typeof atob==\"function\"){let t=atob(s.replace(/[\\n\\r]/g,\"\")),n=new Uint8Array(t.length);for(let i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}else return e(\"This environment does not support reading binary tags; either Buffer or atob is required\"),s},stringify({comment:s,type:e,value:t},n,i,r){if(!t)return\"\";let o=t,l;if(typeof btoa==\"function\"){let a=\"\";for(let c=0;c<o.length;++c)a+=String.fromCharCode(o[c]);l=btoa(a)}else throw new Error(\"This environment does not support writing binary tags; either Buffer or btoa is required\");if(e??(e=y.BLOCK_LITERAL),e!==y.QUOTE_DOUBLE){let a=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),c=Math.ceil(l.length/a),p=new Array(c);for(let f=0,u=0;f<c;++f,u+=a)p[f]=l.substr(u,a);l=p.join(e===y.BLOCK_LITERAL?`\n`:\" \")}return le({comment:s,type:e,value:l},n,i,r)}};function Gt(s,e){if(V(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!T(n)){if(U(n)){n.items.length>1&&e(\"Each pair must have its own sequence indicator\");let i=n.items[0]||new v(new y(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}\n${i.key.commentBefore}`:n.commentBefore),n.comment){let r=i.value??i.key;r.comment=r.comment?`${n.comment}\n${r.comment}`:n.comment}n=i}s.items[t]=T(n)?n:new v(n)}}else e(\"Expected a sequence for this tag\");return s}function Wt(s,e,t){let{replacer:n}=t,i=new B(s);i.tag=\"tag:yaml.org,2002:pairs\";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n==\"function\"&&(o=n.call(e,String(r++),o));let l,a;if(Array.isArray(o))if(o.length===2)l=o[0],a=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)l=c[0],a=o[l];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else l=o;i.items.push(Te(l,a,t))}return i}var Je={collection:\"seq\",default:!1,tag:\"tag:yaml.org,2002:pairs\",resolve:Gt,createNode:Wt};var Ie=class s extends B{constructor(){super(),this.add=$.prototype.add.bind(this),this.delete=$.prototype.delete.bind(this),this.get=$.prototype.get.bind(this),this.has=$.prototype.has.bind(this),this.set=$.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let i of this.items){let r,o;if(T(i)?(r=M(i.key,\"\",t),o=M(i.value,r,t)):r=M(i,\"\",t),n.has(r))throw new Error(\"Ordered maps must not include duplicate keys\");n.set(r,o)}return n}static from(e,t,n){let i=Wt(e,t,n),r=new this;return r.items=i.items,r}};Ie.tag=\"tag:yaml.org,2002:omap\";var Ye={collection:\"seq\",identify:s=>s instanceof Map,nodeClass:Ie,default:!1,tag:\"tag:yaml.org,2002:omap\",resolve(s,e){let t=Gt(s,e),n=[];for(let{key:i}of t.items)E(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ie,t)},createNode:(s,e,t)=>Ie.from(s,e,t)};function Cs({value:s,source:e},t){return e&&(s?Ht:Xt).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var Ht={identify:s=>s===!0,default:!0,tag:\"tag:yaml.org,2002:bool\",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new y(!0),stringify:Cs},Xt={identify:s=>s===!1,default:!0,tag:\"tag:yaml.org,2002:bool\",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new y(!1),stringify:Cs};var vs={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",test:/^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()===\"nan\"?NaN:s[0]===\"-\"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},$s={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",format:\"EXP\",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,\"\")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},_s={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",test:/^[-+]?(?:[0-9][0-9_]*)?\\.[0-9_]*$/,resolve(s){let e=new y(parseFloat(s.replace(/_/g,\"\"))),t=s.indexOf(\".\");if(t!==-1){let n=s.substring(t+1).replace(/_/g,\"\");n[n.length-1]===\"0\"&&(e.minFractionDigits=n.length)}return e},stringify:D};var Qe=s=>typeof s==\"bigint\"||Number.isInteger(s);function Tt(s,e,t,{intAsBigInt:n}){let i=s[0];if((i===\"-\"||i===\"+\")&&(e+=1),s=s.substring(e).replace(/_/g,\"\"),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return i===\"-\"?BigInt(-1)*o:o}let r=parseInt(s,t);return i===\"-\"?-1*r:r}function zt(s,e,t){let{value:n}=s;if(Qe(n)){let i=n.toString(e);return n<0?\"-\"+t+i.substr(1):t+i}return D(s)}var Ps={identify:Qe,default:!0,tag:\"tag:yaml.org,2002:int\",format:\"BIN\",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Tt(s,2,2,t),stringify:s=>zt(s,2,\"0b\")},Ms={identify:Qe,default:!0,tag:\"tag:yaml.org,2002:int\",format:\"OCT\",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Tt(s,1,8,t),stringify:s=>zt(s,8,\"0\")},Bs={identify:Qe,default:!0,tag:\"tag:yaml.org,2002:int\",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Tt(s,0,10,t),stringify:D},Ds={identify:Qe,default:!0,tag:\"tag:yaml.org,2002:int\",format:\"HEX\",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Tt(s,2,16,t),stringify:s=>zt(s,16,\"0x\")};var Le=class s extends ${constructor(e){super(e),this.tag=s.tag}add(e){let t;T(e)?t=e:e&&typeof e==\"object\"&&\"key\"in e&&\"value\"in e&&e.value===null?t=new v(e.key,null):t=new v(e,null),he(this.items,t.key)||this.items.push(t)}get(e,t){let n=he(this.items,e);return!t&&T(n)?E(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=\"boolean\")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=he(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new v(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error(\"Set items must all have null values\")}static from(e,t,n){let{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof i==\"function\"&&(o=i.call(t,o,o)),r.items.push(Te(o,null,n));return r}};Le.tag=\"tag:yaml.org,2002:set\";var Ge={collection:\"map\",identify:s=>s instanceof Set,nodeClass:Le,default:!1,tag:\"tag:yaml.org,2002:set\",createNode:(s,e,t)=>Le.from(s,e,t),resolve(s,e){if(U(s)){if(s.hasAllNullValues(!0))return Object.assign(new Le,s);e(\"Set items must all have null values\")}else e(\"Expected a mapping for this tag\");return s}};function Zt(s,e){let t=s[0],n=t===\"-\"||t===\"+\"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,\"\").split(\":\").reduce((o,l)=>o*i(60)+i(l),i(0));return t===\"-\"?i(-1)*r:r}function Ks(s){let{value:e}=s,t=o=>o;if(typeof e==\"bigint\")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return D(s);let n=\"\";e<0&&(n=\"-\",e*=t(-1));let i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>String(o).padStart(2,\"0\")).join(\":\").replace(/000000\\d*$/,\"\")}var It={identify:s=>typeof s==\"bigint\"||Number.isInteger(s),default:!0,tag:\"tag:yaml.org,2002:int\",format:\"TIME\",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>Zt(s,t),stringify:Ks},Lt={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",format:\"TIME\",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*$/,resolve:s=>Zt(s,!1),stringify:Ks},Ce={identify:s=>s instanceof Date,default:!0,tag:\"tag:yaml.org,2002:timestamp\",test:RegExp(\"^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\\\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\\\.[0-9]+)?)(?:[ \\\\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$\"),resolve(s){let e=s.match(Ce.test);if(!e)throw new Error(\"!!timestamp expects a date, starting with yyyy-mm-dd\");let[,t,n,i,r,o,l]=e.map(Number),a=e[7]?Number((e[7]+\"00\").substr(1,3)):0,c=Date.UTC(t,n-1,i,r||0,o||0,l||0,a),p=e[8];if(p&&p!==\"Z\"){let f=Zt(p,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\\.000Z$/,\"\")??\"\"};var es=[W,H,pe,ye,Ht,Xt,Ps,Ms,Bs,Ds,vs,$s,_s,Ve,G,Ye,Je,Ge,It,Lt,Ce];var js=new Map([[\"core\",Ts],[\"failsafe\",[W,H,pe]],[\"json\",Ls],[\"yaml11\",es],[\"yaml-1.1\",es]]),qs={binary:Ve,bool:Ue,float:St,floatExp:wt,floatNaN:bt,floatTime:Lt,int:Ot,intHex:At,intOct:Nt,intTime:It,map:W,merge:G,null:ye,omap:Ye,pairs:Je,seq:H,set:Ge,timestamp:Ce},Rs={\"tag:yaml.org,2002:binary\":Ve,\"tag:yaml.org,2002:merge\":G,\"tag:yaml.org,2002:omap\":Ye,\"tag:yaml.org,2002:pairs\":Je,\"tag:yaml.org,2002:set\":Ge,\"tag:yaml.org,2002:timestamp\":Ce};function Ct(s,e,t){let n=js.get(e);if(n&&!s)return t&&!n.includes(G)?n.concat(G):n.slice();let i=n;if(!i)if(Array.isArray(s))i=[];else{let r=Array.from(js.keys()).filter(o=>o!==\"yaml11\").map(o=>JSON.stringify(o)).join(\", \");throw new Error(`Unknown schema \"${e}\"; use one of ${r} or define customTags array`)}if(Array.isArray(s))for(let r of s)i=i.concat(r);else typeof s==\"function\"&&(i=s(i.slice()));return t&&(i=i.concat(G)),i.reduce((r,o)=>{let l=typeof o==\"string\"?qs[o]:o;if(!l){let a=JSON.stringify(o),c=Object.keys(qs).map(p=>JSON.stringify(p)).join(\", \");throw new Error(`Unknown custom tag ${a}; use one of ${c}`)}return r.includes(l)||r.push(l),r},[])}var Tn=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0,ve=class s{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?Ct(e,\"compat\"):e?Ct(null,e):null,this.name=typeof r==\"string\"&&r||\"core\",this.knownTags=i?Rs:{},this.tags=Ct(t,this.name,n),this.toStringOptions=l??null,Object.defineProperty(this,Y,{value:W}),Object.defineProperty(this,q,{value:pe}),Object.defineProperty(this,re,{value:H}),this.sortMapEntries=typeof o==\"function\"?o:o===!0?Tn:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function Fs(s,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&s.directives){let a=s.directives.toString(s);a?(t.push(a),n=!0):s.directives.docStart&&(n=!0)}n&&t.push(\"---\");let i=ut(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift(\"\");let a=r(s.commentBefore);t.unshift(J(a,\"\"))}let o=!1,l=null;if(s.contents){if(I(s.contents)){if(s.contents.spaceBefore&&n&&t.push(\"\"),s.contents.commentBefore){let p=r(s.contents.commentBefore);t.push(J(p,\"\"))}i.forceBlockIndent=!!s.comment,l=s.contents.comment}let a=l?void 0:()=>o=!0,c=ae(s.contents,i,()=>l=null,a);l&&(c+=te(c,\"\",r(l))),(c[0]===\"|\"||c[0]===\">\")&&t[t.length-1]===\"---\"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(ae(s.contents,i));if(s.directives?.docEnd)if(s.comment){let a=r(s.comment);a.includes(`\n`)?(t.push(\"...\"),t.push(J(a,\"\"))):t.push(`... ${a}`)}else t.push(\"...\");else{let a=s.comment;a&&o&&(a=a.replace(/^\\n+/,\"\")),a&&((!o||l)&&t[t.length-1]!==\"\"&&t.push(\"\"),t.push(J(r(a),\"\")))}return t.join(`\n`)+`\n`}var se=class s{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,K,{value:st});let i=null;typeof t==\"function\"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:\"warn\",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:\"1.2\"},n);this.options=r;let{version:o}=r;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Z({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(s.prototype,{[K]:{value:st}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=I(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){$e(this.contents)&&this.contents.add(e)}addIn(e,t){$e(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Rt(this);e.anchor=!t||n.has(t)?Ft(t||\"a\",n):t}return new ee(e.anchor)}createNode(e,t,n){let i;if(typeof t==\"function\")e=t.call({\"\":e},\"\",e),i=t;else if(Array.isArray(t)){let m=S=>typeof S==\"number\"||S instanceof String||S instanceof Number,w=t.filter(m).map(String);w.length>0&&(t=t.concat(w)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:l,keepUndefined:a,onTagObj:c,tag:p}=n??{},{onAnchor:f,setAnchors:u,sourceObjects:d}=ws(this,o||\"a\"),g={aliasDuplicateObjects:r??!0,keepUndefined:a??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:d},h=oe(e,p,g);return l&&L(h)&&(h.flow=!0),u(),h}createPair(e,t,n={}){let i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new v(i,r)}delete(e){return $e(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ae(e)?this.contents==null?!1:(this.contents=null,!0):$e(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return L(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Ae(e)?!t&&E(this.contents)?this.contents.value:this.contents:L(this.contents)?this.contents.getIn(e,t):void 0}has(e){return L(this.contents)?this.contents.has(e):!1}hasIn(e){return Ae(e)?this.contents!==void 0:L(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=qe(this.schema,[e],t):$e(this.contents)&&this.contents.set(e,t)}setIn(e,t){Ae(e)?this.contents=t:this.contents==null?this.contents=qe(this.schema,Array.from(e),t):$e(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==\"number\"&&(e=String(e));let n;switch(e){case\"1.1\":this.directives?this.directives.yaml.version=\"1.1\":this.directives=new Z({version:\"1.1\"}),n={resolveKnownTags:!1,schema:\"yaml-1.1\"};break;case\"1.2\":case\"next\":this.directives?this.directives.yaml.version=e:this.directives=new Z({version:e}),n={resolveKnownTags:!0,schema:\"core\"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new ve(Object.assign(n,t));else throw new Error(\"With a null YAML version, the { schema: Schema } option is required\")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){let l={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i==\"number\"?i:100},a=M(this.contents,t??\"\",l);if(typeof r==\"function\")for(let{count:c,res:p}of l.anchors.values())r(p,c);return typeof o==\"function\"?fe(o,{\"\":a},\"\",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error(\"Document with errors cannot be stringified\");if(\"indent\"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`\"indent\" option must be a positive integer, not ${t}`)}return Fs(this,e)}};function $e(s){if(L(s))return!0;throw new Error(\"Expected a YAML collection as document contents\")}var _e=class extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}},R=class extends _e{constructor(e,t,n){super(\"YAMLParseError\",e,t,n)}},Pe=class extends _e{constructor(e,t,n){super(\"YAMLWarning\",e,t,n)}},We=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(l=>e.linePos(l));let{line:n,col:i}=t.linePos[0];t.message+=` at line ${n}, column ${i}`;let r=i-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\\n\\r]+$/,\"\");if(r>=60&&o.length>80){let l=Math.min(r-39,o.length-79);o=\"\\u2026\"+o.substring(l),r-=l-1}if(o.length>80&&(o=o.substring(0,79)+\"\\u2026\"),n>1&&/^ *$/.test(o.substring(0,r))){let l=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);l.length>80&&(l=l.substring(0,79)+`\\u2026\n`),o=l+o}if(/[^ ]/.test(o)){let l=1,a=t.linePos[1];a?.line===n&&a.col>i&&(l=Math.max(1,Math.min(a.col-i,80-r)));let c=\" \".repeat(r)+\"^\".repeat(l);t.message+=`:\n\n${o}\n${c}\n`}};function ne(s,{flow:e,indicator:t,next:n,offset:i,onError:r,parentIndent:o,startOnNewline:l}){let a=!1,c=l,p=l,f=\"\",u=\"\",d=!1,g=!1,h=null,m=null,w=null,S=null,k=null,N=null,O=null;for(let b of s)switch(g&&(b.type!==\"space\"&&b.type!==\"newline\"&&b.type!==\"comma\"&&r(b.offset,\"MISSING_CHAR\",\"Tags and anchors must be separated from the next token by white space\"),g=!1),h&&(c&&b.type!==\"comment\"&&b.type!==\"newline\"&&r(h,\"TAB_AS_INDENT\",\"Tabs are not allowed as indentation\"),h=null),b.type){case\"space\":!e&&(t!==\"doc-start\"||n?.type!==\"flow-collection\")&&b.source.includes(\"\t\")&&(h=b),p=!0;break;case\"comment\":{p||r(b,\"MISSING_CHAR\",\"Comments must be separated from other tokens by white space characters\");let _=b.source.substring(1)||\" \";f?f+=u+_:f=_,u=\"\",c=!1;break}case\"newline\":c?f?f+=b.source:(!N||t!==\"seq-item-ind\")&&(a=!0):u+=b.source,c=!0,d=!0,(m||w)&&(S=b),p=!0;break;case\"anchor\":m&&r(b,\"MULTIPLE_ANCHORS\",\"A node can have at most one anchor\"),b.source.endsWith(\":\")&&r(b.offset+b.source.length-1,\"BAD_ALIAS\",\"Anchor ending in : is ambiguous\",!0),m=b,O??(O=b.offset),c=!1,p=!1,g=!0;break;case\"tag\":{w&&r(b,\"MULTIPLE_TAGS\",\"A node can have at most one tag\"),w=b,O??(O=b.offset),c=!1,p=!1,g=!0;break}case t:(m||w)&&r(b,\"BAD_PROP_ORDER\",`Anchors and tags must be after the ${b.source} indicator`),N&&r(b,\"UNEXPECTED_TOKEN\",`Unexpected ${b.source} in ${e??\"collection\"}`),N=b,c=t===\"seq-item-ind\"||t===\"explicit-key-ind\",p=!1;break;case\"comma\":if(e){k&&r(b,\"UNEXPECTED_TOKEN\",`Unexpected , in ${e}`),k=b,c=!1,p=!1;break}default:r(b,\"UNEXPECTED_TOKEN\",`Unexpected ${b.type} token`),c=!1,p=!1}let A=s[s.length-1],C=A?A.offset+A.source.length:i;return g&&n&&n.type!==\"space\"&&n.type!==\"newline\"&&n.type!==\"comma\"&&(n.type!==\"scalar\"||n.source!==\"\")&&r(n.offset,\"MISSING_CHAR\",\"Tags and anchors must be separated from the next token by white space\"),h&&(c&&h.indent<=o||n?.type===\"block-map\"||n?.type===\"block-seq\")&&r(h,\"TAB_AS_INDENT\",\"Tabs are not allowed as indentation\"),{comma:k,found:N,spaceBefore:a,comment:f,hasNewline:d,anchor:m,tag:w,newlineAfterProp:S,end:C,start:O??C}}function me(s){if(!s)return null;switch(s.type){case\"alias\":case\"scalar\":case\"double-quoted-scalar\":case\"single-quoted-scalar\":if(s.source.includes(`\n`))return!0;if(s.end){for(let e of s.end)if(e.type===\"newline\")return!0}return!1;case\"flow-collection\":for(let e of s.items){for(let t of e.start)if(t.type===\"newline\")return!0;if(e.sep){for(let t of e.sep)if(t.type===\"newline\")return!0}if(me(e.key)||me(e.value))return!0}return!1;default:return!0}}function He(s,e,t){if(e?.type===\"flow-collection\"){let n=e.end[0];n.indent===s&&(n.source===\"]\"||n.source===\"}\")&&me(e)&&t(n,\"BAD_INDENT\",\"Flow end indicator should be more indented than parent\",!0)}}function vt(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let i=typeof n==\"function\"?n:(r,o)=>r===o||E(r)&&E(o)&&r.value===o.value;return e.some(r=>i(r.key,t))}var xs=\"All mapping items must start at the same column\";function Us({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=r?.nodeClass??$,l=new o(t.schema);t.atRoot&&(t.atRoot=!1);let a=n.offset,c=null;for(let p of n.items){let{start:f,key:u,sep:d,value:g}=p,h=ne(f,{indicator:\"explicit-key-ind\",next:u??d?.[0],offset:a,onError:i,parentIndent:n.indent,startOnNewline:!0}),m=!h.found;if(m){if(u&&(u.type===\"block-seq\"?i(a,\"BLOCK_AS_IMPLICIT_KEY\",\"A block sequence may not be used as an implicit map key\"):\"indent\"in u&&u.indent!==n.indent&&i(a,\"BAD_INDENT\",xs)),!h.anchor&&!h.tag&&!d){c=h.end,h.comment&&(l.comment?l.comment+=`\n`+h.comment:l.comment=h.comment);continue}(h.newlineAfterProp||me(u))&&i(u??f[f.length-1],\"MULTILINE_IMPLICIT_KEY\",\"Implicit keys need to be on a single line\")}else h.found?.indent!==n.indent&&i(a,\"BAD_INDENT\",xs);t.atKey=!0;let w=h.end,S=u?s(t,u,h,i):e(t,w,f,null,h,i);t.schema.compat&&He(n.indent,u,i),t.atKey=!1,vt(t,l.items,S)&&i(w,\"DUPLICATE_KEY\",\"Map keys must be unique\");let k=ne(d??[],{indicator:\"map-value-ind\",next:g,offset:S.range[2],onError:i,parentIndent:n.indent,startOnNewline:!u||u.type===\"block-scalar\"});if(a=k.end,k.found){m&&(g?.type===\"block-map\"&&!k.hasNewline&&i(a,\"BLOCK_AS_IMPLICIT_KEY\",\"Nested mappings are not allowed in compact mappings\"),t.options.strict&&h.start<k.found.offset-1024&&i(S.range,\"KEY_OVER_1024_CHARS\",\"The : indicator must be at most 1024 chars after the start of an implicit block mapping key\"));let N=g?s(t,g,k,i):e(t,a,d,null,k,i);t.schema.compat&&He(n.indent,g,i),a=N.range[2];let O=new v(S,N);t.options.keepSourceTokens&&(O.srcToken=p),l.items.push(O)}else{m&&i(S.range,\"MISSING_CHAR\",\"Implicit map keys need to be followed by map values\"),k.comment&&(S.comment?S.comment+=`\n`+k.comment:S.comment=k.comment);let N=new v(S);t.options.keepSourceTokens&&(N.srcToken=p),l.items.push(N)}}return c&&c<a&&i(c,\"IMPOSSIBLE\",\"Map comment with trailing content\"),l.range=[n.offset,a,c??a],l}function Vs({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=r?.nodeClass??B,l=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let a=n.offset,c=null;for(let{start:p,value:f}of n.items){let u=ne(p,{indicator:\"seq-item-ind\",next:f,offset:a,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||f)f?.type===\"block-seq\"?i(u.end,\"BAD_INDENT\",\"All sequence items must start at the same column\"):i(a,\"MISSING_CHAR\",\"Sequence item without - indicator\");else{c=u.end,u.comment&&(l.comment=u.comment);continue}let d=f?s(t,f,u,i):e(t,u.end,p,null,u,i);t.schema.compat&&He(n.indent,f,i),a=d.range[2],l.items.push(d)}return l.range=[n.offset,a,c??a],l}function ie(s,e,t,n){let i=\"\";if(s){let r=!1,o=\"\";for(let l of s){let{source:a,type:c}=l;switch(c){case\"space\":r=!0;break;case\"comment\":{t&&!r&&n(l,\"MISSING_CHAR\",\"Comments must be separated from other tokens by white space characters\");let p=a.substring(1)||\" \";i?i+=o+p:i=p,o=\"\";break}case\"newline\":i&&(o+=a),r=!0;break;default:n(l,\"UNEXPECTED_TOKEN\",`Unexpected ${c} at node end`)}e+=a.length}}return{comment:i,offset:e}}var ts=\"Block collections are not allowed within flow collections\",ss=s=>s&&(s.type===\"block-map\"||s.type===\"block-seq\");function Js({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=n.start.source===\"{\",l=o?\"flow map\":\"flow sequence\",a=r?.nodeClass??(o?$:B),c=new a(t.schema);c.flow=!0;let p=t.atRoot;p&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let f=n.offset+n.start.source.length;for(let m=0;m<n.items.length;++m){let w=n.items[m],{start:S,key:k,sep:N,value:O}=w,A=ne(S,{flow:l,indicator:\"explicit-key-ind\",next:k??N?.[0],offset:f,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!N&&!O){m===0&&A.comma?i(A.comma,\"UNEXPECTED_TOKEN\",`Unexpected , in ${l}`):m<n.items.length-1&&i(A.start,\"UNEXPECTED_TOKEN\",`Unexpected empty item in ${l}`),A.comment&&(c.comment?c.comment+=`\n`+A.comment:c.comment=A.comment),f=A.end;continue}!o&&t.options.strict&&me(k)&&i(k,\"MULTILINE_IMPLICIT_KEY\",\"Implicit keys of flow sequence pairs need to be on a single line\")}if(m===0)A.comma&&i(A.comma,\"UNEXPECTED_TOKEN\",`Unexpected , in ${l}`);else if(A.comma||i(A.start,\"MISSING_CHAR\",`Missing , between ${l} items`),A.comment){let C=\"\";e:for(let b of S)switch(b.type){case\"comma\":case\"space\":break;case\"comment\":C=b.source.substring(1);break e;default:break e}if(C){let b=c.items[c.items.length-1];T(b)&&(b=b.value??b.key),b.comment?b.comment+=`\n`+C:b.comment=C,A.comment=A.comment.substring(C.length+1)}}if(!o&&!N&&!A.found){let C=O?s(t,O,A,i):e(t,A.end,N,null,A,i);c.items.push(C),f=C.range[2],ss(O)&&i(C.range,\"BLOCK_IN_FLOW\",ts)}else{t.atKey=!0;let C=A.end,b=k?s(t,k,A,i):e(t,C,S,null,A,i);ss(k)&&i(b.range,\"BLOCK_IN_FLOW\",ts),t.atKey=!1;let _=ne(N??[],{flow:l,indicator:\"map-value-ind\",next:O,offset:b.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(_.found){if(!o&&!A.found&&t.options.strict){if(N)for(let P of N){if(P===_.found)break;if(P.type===\"newline\"){i(P,\"MULTILINE_IMPLICIT_KEY\",\"Implicit keys of flow sequence pairs need to be on a single line\");break}}A.start<_.found.offset-1024&&i(_.found,\"KEY_OVER_1024_CHARS\",\"The : indicator must be at most 1024 chars after the start of an implicit flow sequence key\")}}else O&&(\"source\"in O&&O.source?.[0]===\":\"?i(O,\"MISSING_CHAR\",`Missing space after : in ${l}`):i(_.start,\"MISSING_CHAR\",`Missing , or : between ${l} items`));let ce=O?s(t,O,_,i):_.found?e(t,_.end,N,null,_,i):null;ce?ss(O)&&i(ce.range,\"BLOCK_IN_FLOW\",ts):_.comment&&(b.comment?b.comment+=`\n`+_.comment:b.comment=_.comment);let Se=new v(b,ce);if(t.options.keepSourceTokens&&(Se.srcToken=w),o){let P=c;vt(t,P.items,b)&&i(C,\"DUPLICATE_KEY\",\"Map keys must be unique\"),P.items.push(Se)}else{let P=new $(t.schema);P.flow=!0,P.items.push(Se);let ps=(ce??b).range;P.range=[b.range[0],ps[1],ps[2]],c.items.push(P)}f=ce?ce.range[2]:_.end}}let u=o?\"}\":\"]\",[d,...g]=n.end,h=f;if(d?.source===u)h=d.offset+d.source.length;else{let m=l[0].toUpperCase()+l.substring(1),w=p?`${m} must end with a ${u}`:`${m} in block collection must be sufficiently indented and end with a ${u}`;i(f,p?\"MISSING_CHAR\":\"BAD_INDENT\",w),d&&d.source.length!==1&&g.unshift(d)}if(g.length>0){let m=ie(g,h,t.options.strict,i);m.comment&&(c.comment?c.comment+=`\n`+m.comment:c.comment=m.comment),c.range=[n.offset,h,m.offset]}else c.range=[n.offset,h,h];return c}function ns(s,e,t,n,i,r){let o=t.type===\"block-map\"?Us(s,e,t,n,r):t.type===\"block-seq\"?Vs(s,e,t,n,r):Js(s,e,t,n,r),l=o.constructor;return i===\"!\"||i===l.tagName?(o.tag=l.tagName,o):(i&&(o.tag=i),o)}function Ys(s,e,t,n,i){let r=n.tag,o=r?e.directives.tagName(r.source,u=>i(r,\"TAG_RESOLVE_FAILED\",u)):null;if(t.type===\"block-seq\"){let{anchor:u,newlineAfterProp:d}=n,g=u&&r?u.offset>r.offset?u:r:u??r;g&&(!d||d.offset<g.offset)&&i(g,\"MISSING_CHAR\",\"Missing newline after block sequence props\")}let l=t.type===\"block-map\"?\"map\":t.type===\"block-seq\"?\"seq\":t.start.source===\"{\"?\"map\":\"seq\";if(!r||!o||o===\"!\"||o===$.tagName&&l===\"map\"||o===B.tagName&&l===\"seq\")return ns(s,e,t,i,o);let a=e.schema.tags.find(u=>u.tag===o&&u.collection===l);if(!a){let u=e.schema.knownTags[o];if(u?.collection===l)e.schema.tags.push(Object.assign({},u,{default:!1})),a=u;else return u?i(r,\"BAD_COLLECTION_TYPE\",`${u.tag} used for ${l} collection, but expects ${u.collection??\"scalar\"}`,!0):i(r,\"TAG_RESOLVE_FAILED\",`Unresolved tag: ${o}`,!0),ns(s,e,t,i,o)}let c=ns(s,e,t,i,o,a),p=a.resolve?.(c,u=>i(r,\"TAG_RESOLVE_FAILED\",u),e.options)??c,f=I(p)?p:new y(p);return f.range=c.range,f.tag=o,a?.format&&(f.format=a.format),f}function $t(s,e,t){let n=e.offset,i=In(e,s.options.strict,t);if(!i)return{value:\"\",type:null,comment:\"\",range:[n,n,n]};let r=i.mode===\">\"?y.BLOCK_FOLDED:y.BLOCK_LITERAL,o=e.source?Ln(e.source):[],l=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===\"\"||m===\"\\r\")l=h;else break}if(l===0){let h=i.chomp===\"+\"&&o.length>0?`\n`.repeat(Math.max(1,o.length-1)):\"\",m=n+i.length;return e.source&&(m+=e.source.length),{value:h,type:r,comment:i.comment,range:[n,m,m]}}let a=e.indent+i.indent,c=e.offset+i.length,p=0;for(let h=0;h<l;++h){let[m,w]=o[h];if(w===\"\"||w===\"\\r\")i.indent===0&&m.length>a&&(a=m.length);else{m.length<a&&t(c+m.length,\"MISSING_CHAR\",\"Block scalars with more-indented leading empty lines must use an explicit indentation indicator\"),i.indent===0&&(a=m.length),p=h,a===0&&!s.atRoot&&t(c,\"BAD_INDENT\",\"Block scalar values in collections must be indented\");break}c+=m.length+w.length+1}for(let h=o.length-1;h>=l;--h)o[h][0].length>a&&(l=h+1);let f=\"\",u=\"\",d=!1;for(let h=0;h<p;++h)f+=o[h][0].slice(a)+`\n`;for(let h=p;h<l;++h){let[m,w]=o[h];c+=m.length+w.length+1;let S=w[w.length-1]===\"\\r\";if(S&&(w=w.slice(0,-1)),w&&m.length<a){let N=`Block scalar lines must not be less indented than their ${i.indent?\"explicit indentation indicator\":\"first line\"}`;t(c-w.length-(S?2:1),\"BAD_INDENT\",N),m=\"\"}r===y.BLOCK_LITERAL?(f+=u+m.slice(a)+w,u=`\n`):m.length>a||w[0]===\"\t\"?(u===\" \"?u=`\n`:!d&&u===`\n`&&(u=`\n\n`),f+=u+m.slice(a)+w,u=`\n`,d=!0):w===\"\"?u===`\n`?f+=`\n`:u=`\n`:(f+=u+w,u=\" \",d=!1)}switch(i.chomp){case\"-\":break;case\"+\":for(let h=l;h<o.length;++h)f+=`\n`+o[h][0].slice(a);f[f.length-1]!==`\n`&&(f+=`\n`);break;default:f+=`\n`}let g=n+i.length+e.source.length;return{value:f,type:r,comment:i.comment,range:[n,g,g]}}function In({offset:s,props:e},t,n){if(e[0].type!==\"block-scalar-header\")return n(e[0],\"IMPOSSIBLE\",\"Block scalar header not found\"),null;let{source:i}=e[0],r=i[0],o=0,l=\"\",a=-1;for(let u=1;u<i.length;++u){let d=i[u];if(!l&&(d===\"-\"||d===\"+\"))l=d;else{let g=Number(d);!o&&g?o=g:a===-1&&(a=s+u)}}a!==-1&&n(a,\"UNEXPECTED_TOKEN\",`Block scalar header includes extra characters: ${i}`);let c=!1,p=\"\",f=i.length;for(let u=1;u<e.length;++u){let d=e[u];switch(d.type){case\"space\":c=!0;case\"newline\":f+=d.source.length;break;case\"comment\":t&&!c&&n(d,\"MISSING_CHAR\",\"Comments must be separated from other tokens by white space characters\"),f+=d.source.length,p=d.source.substring(1);break;case\"error\":n(d,\"UNEXPECTED_TOKEN\",d.message),f+=d.source.length;break;default:{let g=`Unexpected token in block scalar header: ${d.type}`;n(d,\"UNEXPECTED_TOKEN\",g);let h=d.source;h&&typeof h==\"string\"&&(f+=h.length)}}}return{mode:r,indent:o,chomp:l,comment:p,length:f}}function Ln(s){let e=s.split(/\\n( *)/),t=e[0],n=t.match(/^( *)/),r=[n?.[1]?[n[1],t.slice(n[1].length)]:[\"\",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function _t(s,e,t){let{offset:n,type:i,source:r,end:o}=s,l,a,c=(u,d,g)=>t(n+u,d,g);switch(i){case\"scalar\":l=y.PLAIN,a=Cn(r,c);break;case\"single-quoted-scalar\":l=y.QUOTE_SINGLE,a=vn(r,c);break;case\"double-quoted-scalar\":l=y.QUOTE_DOUBLE,a=$n(r,c);break;default:return t(s,\"UNEXPECTED_TOKEN\",`Expected a flow scalar value, but found: ${i}`),{value:\"\",type:null,comment:\"\",range:[n,n+r.length,n+r.length]}}let p=n+r.length,f=ie(o,p,e,t);return{value:a,type:l,comment:f.comment,range:[n,p,f.offset]}}function Cn(s,e){let t=\"\";switch(s[0]){case\"\t\":t=\"a tab character\";break;case\",\":t=\"flow indicator character ,\";break;case\"%\":t=\"directive indicator character %\";break;case\"|\":case\">\":{t=`block scalar indicator ${s[0]}`;break}case\"@\":case\"`\":{t=`reserved character ${s[0]}`;break}}return t&&e(0,\"BAD_SCALAR_START\",`Plain value cannot start with ${t}`),Qs(s)}function vn(s,e){return(s[s.length-1]!==\"'\"||s.length===1)&&e(s.length,\"MISSING_CHAR\",\"Missing closing 'quote\"),Qs(s.slice(1,-1)).replace(/''/g,\"'\")}function Qs(s){let e=/(.*?)\\r?\\n/sy,t=e.exec(s);if(!t)return s;let n,i;try{n=new RegExp(\"(?<![ \t])[ \t]+$\"),i=new RegExp(\"^[ \t]+|(?<![ \t])[ \t]+$\",\"g\")}catch{n=/[ \\t]+$/,i=/^[ \\t]+|[ \\t]+$/g}let r=t[1].replace(n,\"\"),o=\" \",l=e.lastIndex;for(;t=e.exec(s);){let c=t[1].replace(i,\"\");c===\"\"?o===`\n`?r+=o:o=`\n`:(r+=o+c,o=\" \"),l=e.lastIndex}let a=/[ \\t]*(.*)/sy;return a.lastIndex=l,t=a.exec(s),r+o+(t?.[1]??\"\")}function $n(s,e){let t=\"\";for(let n=1;n<s.length-1;++n){let i=s[n];if(!(i===\"\\r\"&&s[n+1]===`\n`))if(i===`\n`){let{fold:r,offset:o}=_n(s,n);t+=r,n=o}else if(i===\"\\\\\"){let r=s[++n],o=Pn[r];if(o)t+=o;else if(r===`\n`)for(r=s[n+1];r===\" \"||r===\"\t\";)r=s[++n+1];else if(r===\"\\r\"&&s[n+1]===`\n`)for(r=s[++n+1];r===\" \"||r===\"\t\";)r=s[++n+1];else if(r===\"x\"||r===\"u\"||r===\"U\"){let l=r===\"x\"?2:r===\"u\"?4:8;t+=Mn(s,n+1,l,e),n+=l}else{let l=s.substr(n-1,2);e(n-1,\"BAD_DQ_ESCAPE\",`Invalid escape sequence ${l}`),t+=l}}else if(i===\" \"||i===\"\t\"){let r=n,o=s[n+1];for(;o===\" \"||o===\"\t\";)o=s[++n+1];o!==`\n`&&!(o===\"\\r\"&&s[n+2]===`\n`)&&(t+=n>r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='\"'||s.length===1)&&e(s.length,\"MISSING_CHAR\",'Missing closing \"quote'),t}function _n(s,e){let t=\"\",n=s[e+1];for(;(n===\" \"||n===\"\t\"||n===`\n`||n===\"\\r\")&&!(n===\"\\r\"&&s[e+2]!==`\n`);)n===`\n`&&(t+=`\n`),e+=1,n=s[e+1];return t||(t=\" \"),{fold:t,offset:e}}var Pn={0:\"\\0\",a:\"\\x07\",b:\"\\b\",e:\"\\x1B\",f:\"\\f\",n:`\n`,r:\"\\r\",t:\"\t\",v:\"\\v\",N:\"\\x85\",_:\"\\xA0\",L:\"\\u2028\",P:\"\\u2029\",\" \":\" \",'\"':'\"',\"/\":\"/\",\"\\\\\":\"\\\\\",\"\t\":\"\t\"};function Mn(s,e,t,n){let i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(o)}catch{let l=s.substr(e-2,t+2);return n(e-2,\"BAD_DQ_ESCAPE\",`Invalid escape sequence ${l}`),l}}function is(s,e,t,n){let{value:i,type:r,comment:o,range:l}=e.type===\"block-scalar\"?$t(s,e,n):_t(e,s.options.strict,n),a=t?s.directives.tagName(t.source,f=>n(t,\"TAG_RESOLVE_FAILED\",f)):null,c;s.options.stringKeys&&s.atKey?c=s.schema[q]:a?c=Bn(s.schema,i,a,t,n):e.type===\"scalar\"?c=Dn(s,i,e,n):c=s.schema[q];let p;try{let f=c.resolve(i,u=>n(t??e,\"TAG_RESOLVE_FAILED\",u),s.options);p=E(f)?f:new y(f)}catch(f){let u=f instanceof Error?f.message:String(f);n(t??e,\"TAG_RESOLVE_FAILED\",u),p=new y(i)}return p.range=l,p.source=i,r&&(p.type=r),a&&(p.tag=a),c.format&&(p.format=c.format),o&&(p.comment=o),p}function Bn(s,e,t,n,i){if(t===\"!\")return s[q];let r=[];for(let l of s.tags)if(!l.collection&&l.tag===t)if(l.default&&l.test)r.push(l);else return l;for(let l of r)if(l.test?.test(e))return l;let o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,\"TAG_RESOLVE_FAILED\",`Unresolved tag: ${t}`,t!==\"tag:yaml.org,2002:str\"),s[q])}function Dn({atKey:s,directives:e,schema:t},n,i,r){let o=t.tags.find(l=>(l.default===!0||s&&l.default===\"key\")&&l.test?.test(n))||t[q];if(t.compat){let l=t.compat.find(a=>a.default&&a.test?.test(n))??t[q];if(o.tag!==l.tag){let a=e.tagString(o.tag),c=e.tagString(l.tag),p=`Value may be parsed as either ${a} or ${c}`;r(i,\"TAG_RESOLVE_FAILED\",p,!0)}}return o}function Gs(s,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case\"space\":case\"comment\":case\"newline\":s-=i.source.length;continue}for(i=e[++n];i?.type===\"space\";)s+=i.source.length,i=e[++n];break}}return s}var Kn={composeNode:rs,composeEmptyNode:Pt};function rs(s,e,t,n){let i=s.atKey,{spaceBefore:r,comment:o,anchor:l,tag:a}=t,c,p=!0;switch(e.type){case\"alias\":c=jn(s,e,n),(l||a)&&n(e,\"ALIAS_PROPS\",\"An alias node must not specify any properties\");break;case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":case\"block-scalar\":c=is(s,e,a,n),l&&(c.anchor=l.source.substring(1));break;case\"block-map\":case\"block-seq\":case\"flow-collection\":try{c=Ys(Kn,s,e,t,n),l&&(c.anchor=l.source.substring(1))}catch(f){let u=f instanceof Error?f.message:String(f);n(e,\"RESOURCE_EXHAUSTION\",u)}break;default:{let f=e.type===\"error\"?e.message:`Unsupported token (type: ${e.type})`;n(e,\"UNEXPECTED_TOKEN\",f),p=!1}}return c??(c=Pt(s,e.offset,void 0,null,t,n)),l&&c.anchor===\"\"&&n(l,\"BAD_ALIAS\",\"Anchor cannot be an empty string\"),i&&s.options.stringKeys&&(!E(c)||typeof c.value!=\"string\"||c.tag&&c.tag!==\"tag:yaml.org,2002:str\")&&n(a??e,\"NON_STRING_KEY\",\"With stringKeys, all keys must be strings\"),r&&(c.spaceBefore=!0),o&&(e.type===\"scalar\"&&e.source===\"\"?c.comment=o:c.commentBefore=o),s.options.keepSourceTokens&&p&&(c.srcToken=e),c}function Pt(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:l,end:a},c){let p={type:\"scalar\",offset:Gs(e,t,n),indent:-1,source:\"\"},f=is(s,p,l,c);return o&&(f.anchor=o.source.substring(1),f.anchor===\"\"&&c(o,\"BAD_ALIAS\",\"Anchor cannot be an empty string\")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=a),f}function jn({options:s},{offset:e,source:t,end:n},i){let r=new ee(t.substring(1));r.source===\"\"&&i(e,\"BAD_ALIAS\",\"Alias cannot be an empty string\"),r.source.endsWith(\":\")&&i(e+t.length-1,\"BAD_ALIAS\",\"Alias ending in : is ambiguous\",!0);let o=e+t.length,l=ie(n,o,s.strict,i);return r.range=[e,o,l.offset],l.comment&&(r.comment=l.comment),r}function Ws(s,e,{offset:t,start:n,value:i,end:r},o){let l=Object.assign({_directives:e},s),a=new se(void 0,l),c={atKey:!1,atRoot:!0,directives:a.directives,options:a.options,schema:a.schema},p=ne(n,{indicator:\"doc-start\",next:i??r?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});p.found&&(a.directives.docStart=!0,i&&(i.type===\"block-map\"||i.type===\"block-seq\")&&!p.hasNewline&&o(p.end,\"MISSING_CHAR\",\"Block collection cannot start on same line with directives-end marker\")),a.contents=i?rs(c,i,p,o):Pt(c,p.end,n,null,p,o);let f=a.contents.range[2],u=ie(r,f,!1,o);return u.comment&&(a.comment=u.comment),a.range=[t,f,u.offset],a}function Xe(s){if(typeof s==\"number\")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t==\"string\"?t.length:1)]}function Hs(s){let e=\"\",t=!1,n=!1;for(let i=0;i<s.length;++i){let r=s[i];switch(r[0]){case\"#\":e+=(e===\"\"?\"\":n?`\n\n`:`\n`)+(r.substring(1)||\" \"),t=!0,n=!1;break;case\"%\":s[i+1]?.[0]!==\"#\"&&(i+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}var be=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,i,r)=>{let o=Xe(t);r?this.warnings.push(new Pe(o,n,i)):this.errors.push(new R(o,n,i))},this.directives=new Z({version:e.version||\"1.2\"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:i}=Hs(this.prelude);if(n){let r=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(i||e.directives.docStart||!r)e.commentBefore=n;else if(L(r)&&!r.flow&&r.items.length>0){let o=r.items[0];T(o)&&(o=o.key);let l=o.commentBefore;o.commentBefore=l?`${n}\n${l}`:n}else{let o=r.commentBefore;r.commentBefore=o?`${n}\n${o}`:n}}if(t){for(let r=0;r<this.errors.length;++r)e.errors.push(this.errors[r]);for(let r=0;r<this.warnings.length;++r)e.warnings.push(this.warnings[r])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Hs(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(e.type){case\"directive\":this.directives.add(e.source,(t,n,i)=>{let r=Xe(e);r[0]+=t,this.onError(r,\"BAD_DIRECTIVE\",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case\"document\":{let t=Ws(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,\"MISSING_CHAR\",\"Missing directives-end/doc-start indicator line\"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case\"byte-order-mark\":case\"space\":break;case\"comment\":case\"newline\":this.prelude.push(e.source);break;case\"error\":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new R(Xe(e),\"UNEXPECTED_TOKEN\",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case\"doc-end\":{if(!this.doc){let n=\"Unexpected doc-end without preceding document\";this.errors.push(new R(Xe(e),\"UNEXPECTED_TOKEN\",n));break}this.doc.directives.docEnd=!0;let t=ie(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new R(Xe(e),\"UNEXPECTED_TOKEN\",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new se(void 0,n);this.atDirectives&&this.onError(t,\"MISSING_CHAR\",\"Missing directives-end indicator line\"),i.range=[0,t,t],this.decorate(i,!1),yield i}}};var cs={};ms(cs,{BOM:()=>ze,DOCUMENT:()=>Ze,FLOW_END:()=>et,SCALAR:()=>Me,createScalarToken:()=>zs,isCollection:()=>Fn,isScalar:()=>xn,prettyToken:()=>Un,resolveAsScalar:()=>Xs,setScalarValue:()=>Zs,stringify:()=>tn,tokenType:()=>as,visit:()=>de});function Xs(s,e=!0,t){if(s){let n=(i,r,o)=>{let l=typeof i==\"number\"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(l,r,o);else throw new R([l,l+1],r,o)};switch(s.type){case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":return _t(s,e,n);case\"block-scalar\":return $t({options:{strict:e}},s,n)}}return null}function zs(s,e){let{implicitKey:t=!1,indent:n,inFlow:i=!1,offset:r=-1,type:o=\"PLAIN\"}=e,l=le({type:o,value:s},{implicitKey:t,indent:n>0?\" \".repeat(n):\"\",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),a=e.end??[{type:\"newline\",offset:-1,indent:n,source:`\n`}];switch(l[0]){case\"|\":case\">\":{let c=l.indexOf(`\n`),p=l.substring(0,c),f=l.substring(c+1)+`\n`,u=[{type:\"block-scalar-header\",offset:r,indent:n,source:p}];return en(u,a)||u.push({type:\"newline\",offset:-1,indent:n,source:`\n`}),{type:\"block-scalar\",offset:r,indent:n,props:u,source:f}}case'\"':return{type:\"double-quoted-scalar\",offset:r,indent:n,source:l,end:a};case\"'\":return{type:\"single-quoted-scalar\",offset:r,indent:n,source:l,end:a};default:return{type:\"scalar\",offset:r,indent:n,source:l,end:a}}}function Zs(s,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,l=\"indent\"in s?s.indent:null;if(n&&typeof l==\"number\"&&(l+=2),!o)switch(s.type){case\"single-quoted-scalar\":o=\"QUOTE_SINGLE\";break;case\"double-quoted-scalar\":o=\"QUOTE_DOUBLE\";break;case\"block-scalar\":{let c=s.props[0];if(c.type!==\"block-scalar-header\")throw new Error(\"Invalid block scalar header\");o=c.source[0]===\">\"?\"BLOCK_FOLDED\":\"BLOCK_LITERAL\";break}default:o=\"PLAIN\"}let a=le({type:o,value:e},{implicitKey:i||l===null,indent:l!==null&&l>0?\" \".repeat(l):\"\",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(a[0]){case\"|\":case\">\":qn(s,a);break;case'\"':os(s,a,\"double-quoted-scalar\");break;case\"'\":os(s,a,\"single-quoted-scalar\");break;default:os(s,a,\"scalar\")}}function qn(s,e){let t=e.indexOf(`\n`),n=e.substring(0,t),i=e.substring(t+1)+`\n`;if(s.type===\"block-scalar\"){let r=s.props[0];if(r.type!==\"block-scalar-header\")throw new Error(\"Invalid block scalar header\");r.source=n,s.source=i}else{let{offset:r}=s,o=\"indent\"in s?s.indent:-1,l=[{type:\"block-scalar-header\",offset:r,indent:o,source:n}];en(l,\"end\"in s?s.end:void 0)||l.push({type:\"newline\",offset:-1,indent:o,source:`\n`});for(let a of Object.keys(s))a!==\"type\"&&a!==\"offset\"&&delete s[a];Object.assign(s,{type:\"block-scalar\",indent:o,props:l,source:i})}}function en(s,e){if(e)for(let t of e)switch(t.type){case\"space\":case\"comment\":s.push(t);break;case\"newline\":return s.push(t),!0}return!1}function os(s,e,t){switch(s.type){case\"scalar\":case\"double-quoted-scalar\":case\"single-quoted-scalar\":s.type=t,s.source=e;break;case\"block-scalar\":{let n=s.props.slice(1),i=e.length;s.props[0].type===\"block-scalar-header\"&&(i-=s.props[0].source.length);for(let r of n)r.offset+=i;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case\"block-map\":case\"block-seq\":{let i={type:\"newline\",offset:s.offset+e.length,indent:s.indent,source:`\n`};delete s.items,Object.assign(s,{type:t,source:e,end:[i]});break}default:{let n=\"indent\"in s?s.indent:-1,i=\"end\"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type===\"space\"||r.type===\"comment\"||r.type===\"newline\"):[];for(let r of Object.keys(s))r!==\"type\"&&r!==\"offset\"&&delete s[r];Object.assign(s,{type:t,indent:n,source:e,end:i})}}}var tn=s=>\"type\"in s?Bt(s):Mt(s);function Bt(s){switch(s.type){case\"block-scalar\":{let e=\"\";for(let t of s.props)e+=Bt(t);return e+s.source}case\"block-map\":case\"block-seq\":{let e=\"\";for(let t of s.items)e+=Mt(t);return e}case\"flow-collection\":{let e=s.start.source;for(let t of s.items)e+=Mt(t);for(let t of s.end)e+=t.source;return e}case\"document\":{let e=Mt(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if(\"end\"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function Mt({start:s,key:e,sep:t,value:n}){let i=\"\";for(let r of s)i+=r.source;if(e&&(i+=Bt(e)),t)for(let r of t)i+=r.source;return n&&(i+=Bt(n)),i}var ls=Symbol(\"break visit\"),Rn=Symbol(\"skip children\"),sn=Symbol(\"remove item\");function de(s,e){\"type\"in s&&s.type===\"document\"&&(s={start:s.start,value:s.value}),nn(Object.freeze([]),s,e)}de.BREAK=ls;de.SKIP=Rn;de.REMOVE=sn;de.itemAtPath=(s,e)=>{let t=s;for(let[n,i]of e){let r=t?.[n];if(r&&\"items\"in r)t=r.items[i];else return}return t};de.parentCollection=(s,e)=>{let t=de.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],i=t?.[n];if(i&&\"items\"in i)return i;throw new Error(\"Parent collection not found\")};function nn(s,e,t){let n=t(e,s);if(typeof n==\"symbol\")return n;for(let i of[\"key\",\"value\"]){let r=e[i];if(r&&\"items\"in r){for(let o=0;o<r.items.length;++o){let l=nn(Object.freeze(s.concat([[i,o]])),r.items[o],t);if(typeof l==\"number\")o=l-1;else{if(l===ls)return ls;l===sn&&(r.items.splice(o,1),o-=1)}}typeof n==\"function\"&&i===\"key\"&&(n=n(e,s))}}return typeof n==\"function\"?n(e,s):n}var ze=\"\\uFEFF\",Ze=\"\u0002\",et=\"\u0018\",Me=\"\u001f\",Fn=s=>!!s&&\"items\"in s,xn=s=>!!s&&(s.type===\"scalar\"||s.type===\"single-quoted-scalar\"||s.type===\"double-quoted-scalar\"||s.type===\"block-scalar\");function Un(s){switch(s){case ze:return\"<BOM>\";case Ze:return\"<DOC>\";case et:return\"<FLOW_END>\";case Me:return\"<SCALAR>\";default:return JSON.stringify(s)}}function as(s){switch(s){case ze:return\"byte-order-mark\";case Ze:return\"doc-mode\";case et:return\"flow-error-end\";case Me:return\"scalar\";case\"---\":return\"doc-start\";case\"...\":return\"doc-end\";case\"\":case`\n`:case`\\r\n`:return\"newline\";case\"-\":return\"seq-item-ind\";case\"?\":return\"explicit-key-ind\";case\":\":return\"map-value-ind\";case\"{\":return\"flow-map-start\";case\"}\":return\"flow-map-end\";case\"[\":return\"flow-seq-start\";case\"]\":return\"flow-seq-end\";case\",\":return\"comma\"}switch(s[0]){case\" \":case\"\t\":return\"space\";case\"#\":return\"comment\";case\"%\":return\"directive-line\";case\"*\":return\"alias\";case\"&\":return\"anchor\";case\"!\":return\"tag\";case\"'\":return\"single-quoted-scalar\";case'\"':return\"double-quoted-scalar\";case\"|\":case\">\":return\"block-scalar-header\"}return null}function X(s){switch(s){case void 0:case\" \":case`\n`:case\"\\r\":case\"\t\":return!0;default:return!1}}var rn=new Set(\"0123456789ABCDEFabcdef\"),Vn=new Set(\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()\"),Dt=new Set(\",[]{}\"),Jn=new Set(` ,[]{}\n\\r\t`),fs=s=>!s||Jn.has(s),Be=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=\"\",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=\"string\")throw TypeError(\"source is not a string\");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??\"stream\";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===\" \"||t===\"\t\";)t=this.buffer[++e];return!t||t===\"#\"||t===`\n`?!0:t===\"\\r\"?this.buffer[e+1]===`\n`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===\" \";)t=this.buffer[++n+e];if(t===\"\\r\"){let i=this.buffer[n+e+1];if(i===`\n`||!i&&!this.atEnd)return e+n+1}return t===`\n`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===\"-\"||t===\".\"){let n=this.buffer.substr(e,3);if((n===\"---\"||n===\"...\")&&X(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=\"number\"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`\n`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===\"\\r\"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case\"stream\":return yield*this.parseStream();case\"line-start\":return yield*this.parseLineStart();case\"block-start\":return yield*this.parseBlockStart();case\"doc\":return yield*this.parseDocument();case\"flow\":return yield*this.parseFlowCollection();case\"quoted-scalar\":return yield*this.parseQuotedScalar();case\"block-scalar\":return yield*this.parseBlockScalar();case\"plain-scalar\":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(\"stream\");if(e[0]===ze&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===\"%\"){let t=e.length,n=e.indexOf(\"#\");for(;n!==-1;){let r=e[n-1];if(r===\" \"||r===\"\t\"){t=n-1;break}else n=e.indexOf(\"#\",n+1)}for(;;){let r=e[t-1];if(r===\" \"||r===\"\t\")t-=1;else break}let i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),\"stream\"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),\"stream\"}return yield Ze,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(\"line-start\");if(e===\"-\"||e===\".\"){if(!this.atEnd&&!this.hasChars(4))return this.setNext(\"line-start\");let t=this.peek(3);if((t===\"---\"||t===\"...\")&&X(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t===\"---\"?\"doc\":\"stream\"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!X(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(\"block-start\");if((e===\"-\"||e===\"?\"||e===\":\")&&X(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,\"block-start\"}return\"doc\"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(\"doc\");let t=yield*this.pushIndicators();switch(e[t]){case\"#\":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case\"{\":case\"[\":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,\"flow\";case\"}\":case\"]\":return yield*this.pushCount(1),\"doc\";case\"*\":return yield*this.pushUntil(fs),\"doc\";case'\"':case\"'\":return yield*this.parseQuotedScalar();case\"|\":case\">\":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext(\"flow\");if((n!==-1&&n<this.indentNext&&i[0]!==\"#\"||n===0&&(i.startsWith(\"---\")||i.startsWith(\"...\"))&&X(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]===\"]\"||i[0]===\"}\")))return this.flowLevel=0,yield et,yield*this.parseLineStart();let r=0;for(;i[r]===\",\";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return\"flow\";case\"#\":return yield*this.pushCount(i.length-r),\"flow\";case\"{\":case\"[\":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,\"flow\";case\"}\":case\"]\":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?\"flow\":\"doc\";case\"*\":return yield*this.pushUntil(fs),\"flow\";case'\"':case\"'\":return this.flowKey=!0,yield*this.parseQuotedScalar();case\":\":{let o=this.charAt(1);if(this.flowKey||X(o)||o===\",\")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),\"flow\"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===\"'\")for(;t!==-1&&this.buffer[t+1]===\"'\";)t=this.buffer.indexOf(\"'\",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]===\"\\\\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('\"',t+1)}let n=this.buffer.substring(0,t),i=n.indexOf(`\n`,this.pos);if(i!==-1){for(;i!==-1;){let r=this.continueScalar(i+1);if(r===-1)break;i=n.indexOf(`\n`,r)}i!==-1&&(t=i-(n[i-1]===\"\\r\"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(\"quoted-scalar\");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?\"flow\":\"doc\"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===\"+\")this.blockScalarKeep=!0;else if(t>\"0\"&&t<=\"9\")this.blockScalarIndent=Number(t)-1;else if(t!==\"-\")break}return yield*this.pushUntil(t=>X(t)||t===\"#\")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case\" \":t+=1;break;case`\n`:e=r,t=0;break;case\"\\r\":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext(\"block-scalar\");if(o===`\n`)break}default:break e}if(!n&&!this.atEnd)return this.setNext(\"block-scalar\");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(`\n`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(\"block-scalar\");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===\" \";)n=this.buffer[++i];if(n===\"\t\"){for(;n===\"\t\"||n===\" \"||n===\"\\r\"||n===`\n`;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o===\"\\r\"&&(o=this.buffer[--r]);let l=r;for(;o===\" \";)o=this.buffer[--r];if(o===`\n`&&r>=this.pos&&r+1+t>l)e=r;else break}while(!0);return yield Me,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===\":\"){let r=this.buffer[n+1];if(X(r)||e&&Dt.has(r))break;t=n}else if(X(i)){let r=this.buffer[n+1];if(i===\"\\r\"&&(r===`\n`?(n+=1,i=`\n`,r=this.buffer[n+1]):t=n),r===\"#\"||e&&Dt.has(r))break;if(i===`\n`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&Dt.has(i))break;t=n}return!i&&!this.atEnd?this.setNext(\"plain-scalar\"):(yield Me,yield*this.pushToIndex(t+1,!0),e?\"flow\":\"doc\")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield\"\"),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case\"!\":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case\"&\":e+=yield*this.pushUntil(fs),e+=yield*this.pushSpaces(!0);continue e;case\"-\":case\"?\":case\":\":{let t=this.flowLevel>0,n=this.charAt(1);if(X(n)||t&&Dt.has(n)){t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)===\"<\"){let e=this.pos+2,t=this.buffer[e];for(;!X(t)&&t!==\">\";)t=this.buffer[++e];return yield*this.pushToIndex(t===\">\"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Vn.has(t))t=this.buffer[++e];else if(t===\"%\"&&rn.has(this.buffer[e+1])&&rn.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`\n`?yield*this.pushCount(1):e===\"\\r\"&&this.charAt(1)===`\n`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===\" \"||e&&n===\"\t\");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};var De=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}};function ge(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function on(s){for(let e=0;e<s.length;++e)switch(s[e].type){case\"space\":case\"comment\":case\"newline\":break;default:return e}return-1}function an(s){switch(s?.type){case\"alias\":case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":case\"flow-collection\":return!0;default:return!1}}function Kt(s){switch(s.type){case\"document\":return s.start;case\"block-map\":{let e=s.items[s.items.length-1];return e.sep??e.start}case\"block-seq\":return s.items[s.items.length-1].start;default:return[]}}function Ke(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case\"doc-start\":case\"explicit-key-ind\":case\"map-value-ind\":case\"seq-item-ind\":case\"newline\":break e}for(;s[++e]?.type===\"space\";);return s.splice(e,s.length)}function jt(s,e){if(e.length<1e5)Array.prototype.push.apply(s,e);else for(let t=0;t<e.length;++t)s.push(e[t])}function ln(s){if(s.start.type===\"flow-seq-start\")for(let e of s.items)e.sep&&!e.value&&!ge(e.start,\"explicit-key-ind\")&&!ge(e.sep,\"map-value-ind\")&&(e.key&&(e.value=e.key),delete e.key,an(e.value)?e.value.end?jt(e.value.end,e.sep):e.value.end=e.sep:jt(e.start,e.sep),delete e.sep)}var we=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=\"\",this.type=\"\",this.lexer=new Be,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=as(e);if(t)if(t===\"scalar\")this.atNewLine=!1,this.atScalar=!0,this.type=\"scalar\";else{switch(this.type=t,yield*this.step(),t){case\"newline\":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case\"space\":this.atNewLine&&e[0]===\" \"&&(this.indent+=e.length);break;case\"explicit-key-ind\":case\"map-value-ind\":case\"seq-item-ind\":this.atNewLine&&(this.indent+=e.length);break;case\"doc-mode\":case\"flow-error-end\":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:\"error\",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===\"doc-end\"&&e?.type!==\"doc-end\"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:\"doc-end\",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case\"document\":return yield*this.document(e);case\"alias\":case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":return yield*this.scalar(e);case\"block-scalar\":return yield*this.blockScalar(e);case\"block-map\":return yield*this.blockMap(e);case\"block-seq\":return yield*this.blockSequence(e);case\"flow-collection\":return yield*this.flowCollection(e);case\"doc-end\":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:\"error\",offset:this.offset,source:\"\",message:\"Tried to pop an empty stack\"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type===\"block-scalar\"?t.indent=\"indent\"in n?n.indent:0:t.type===\"flow-collection\"&&n.type===\"document\"&&(t.indent=0),t.type===\"flow-collection\"&&ln(t),n.type){case\"document\":n.value=t;break;case\"block-scalar\":n.props.push(t);break;case\"block-map\":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case\"block-seq\":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case\"flow-collection\":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type===\"document\"||n.type===\"block-map\"||n.type===\"block-seq\")&&(t.type===\"block-map\"||t.type===\"block-seq\")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&on(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!==\"comment\"||r.indent<t.indent))&&(n.type===\"document\"?n.end=i.start:n.items.push({start:i.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case\"directive-line\":yield{type:\"directive\",offset:this.offset,source:this.source};return;case\"byte-order-mark\":case\"space\":case\"comment\":case\"newline\":yield this.sourceToken;return;case\"doc-mode\":case\"doc-start\":{let e={type:\"document\",offset:this.offset,start:[]};this.type===\"doc-start\"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:\"error\",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case\"doc-start\":{on(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case\"anchor\":case\"tag\":case\"space\":case\"comment\":case\"newline\":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:\"error\",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===\"map-value-ind\"){let t=Kt(this.peek(2)),n=Ke(t),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let r={type:\"block-map\",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case\"space\":case\"comment\":case\"newline\":e.props.push(this.sourceToken);return;case\"scalar\":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`\n`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`\n`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case\"newline\":if(this.onKeyLine=!1,t.value){let n=\"end\"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===\"comment\"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case\"space\":case\"comment\":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){jt(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(t.sep||t.explicitKey)&&this.type!==\"seq-item-ind\",r=[];if(i&&t.sep&&!t.value){let o=[];for(let l=0;l<t.sep.length;++l){let a=t.sep[l];switch(a.type){case\"newline\":o.push(l);break;case\"space\":break;case\"comment\":a.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case\"anchor\":case\"tag\":i||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case\"explicit-key-ind\":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):i||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case\"map-value-ind\":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ge(t.sep,\"map-value-ind\"))this.stack.push({type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(an(t.key)&&!ge(t.sep,\"newline\")){let o=Ke(t.start),l=t.key,a=t.sep;a.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:o,key:l,sep:a}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(ge(t.start,\"newline\"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Ke(t.start);this.stack.push({type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):ge(t.sep,\"map-value-ind\")?this.stack.push({type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case\"alias\":case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":{let o=this.flowScalar(this.type);i||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type===\"block-seq\"){if(!t.explicitKey&&t.sep&&!ge(t.sep,\"newline\")){yield*this.pop({type:\"error\",offset:this.offset,message:\"Unexpected block-seq-ind on same line with key\",source:this.source});return}}else n&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case\"newline\":if(t.value){let n=\"end\"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===\"comment\"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case\"space\":case\"comment\":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){jt(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case\"anchor\":case\"tag\":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case\"seq-item-ind\":if(this.indent!==e.indent)break;t.value||ge(t.start,\"seq-item-ind\")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===\"flow-error-end\"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type===\"flow-collection\")}else if(e.end.length===0){switch(this.type){case\"comma\":case\"explicit-key-ind\":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case\"map-value-ind\":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case\"space\":case\"comment\":case\"newline\":case\"anchor\":case\"tag\":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case\"alias\":case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case\"flow-map-end\":case\"flow-seq-end\":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type===\"block-map\"&&(this.type===\"map-value-ind\"&&n.indent===e.indent||this.type===\"newline\"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===\"map-value-ind\"&&n.type!==\"flow-collection\"){let i=Kt(n),r=Ke(i);ln(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let l={type:\"block-map\",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`\n`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`\n`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case\"alias\":case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":return this.flowScalar(this.type);case\"block-scalar-header\":return{type:\"block-scalar\",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:\"\"};case\"flow-map-start\":case\"flow-seq-start\":return{type:\"flow-collection\",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case\"seq-item-ind\":return{type:\"block-seq\",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case\"explicit-key-ind\":{this.onKeyLine=!0;let t=Kt(e),n=Ke(t);return n.push(this.sourceToken),{type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case\"map-value-ind\":{this.onKeyLine=!0;let t=Kt(e),n=Ke(t);return{type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==\"comment\"||this.indent<=t?!1:e.every(n=>n.type===\"newline\"||n.type===\"space\")}*documentEnd(e){this.type!==\"doc-mode\"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===\"newline\"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case\"comma\":case\"doc-start\":case\"doc-end\":case\"flow-seq-end\":case\"flow-map-end\":case\"map-value-ind\":yield*this.pop(),yield*this.step();break;case\"newline\":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===\"newline\"&&(yield*this.pop())}}};function cn(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new De||null,prettyErrors:e}}function fn(s,e={}){let{lineCounter:t,prettyErrors:n}=cn(e),i=new we(t?.addNewLine),r=new be(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(let l of o)l.errors.forEach(We(s,t)),l.warnings.forEach(We(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function us(s,e={}){let{lineCounter:t,prettyErrors:n}=cn(e),i=new we(t?.addNewLine),r=new be(e),o=null;for(let l of r.compose(i.parse(s),!0,s.length))if(!o)o=l;else if(o.options.logLevel!==\"silent\"){o.errors.push(new R(l.range.slice(0,2),\"MULTIPLE_DOCS\",\"Source contains multiple documents; please use YAML.parseAllDocuments()\"));break}return n&&t&&(o.errors.forEach(We(s,t)),o.warnings.forEach(We(s,t))),o}function un(s,e,t){let n;typeof e==\"function\"?n=e:t===void 0&&e&&typeof e==\"object\"&&(t=e);let i=us(s,t);if(!i)return null;if(i.warnings.forEach(r=>ht(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!==\"silent\")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function hn(s,e,t){let n=null;if(typeof e==\"function\"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t==\"string\"&&(t=t.length),typeof t==\"number\"){let i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(s===void 0){let{keepUndefined:i}=t??e??{};if(!i)return}return x(s)&&!n?s.toString(t):new se(s,n,t).toString(t)}var Sc=hs;export{F as a,x as b,U as c,T as d,E as e,V as f,L as g,I as h,Q as i,je as j,ee as k,y as l,v as m,$ as n,B as o,ve as p,se as q,_e as r,R as s,Pe as t,be as u,cs as v,Be as w,De as x,we as y,fn as z,us as A,un as B,hn as C,Sc as D};\n","node_modules/apps/chunk-U7D4LK7G.js":"var G=function(){let e=g,T=F,i=this,c=\"parser.js: Parser(): \",y=function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};i.ast=void 0,i.stats=void 0,i.trace=void 0,i.callbacks=[];let a=0,M=0,b=0,A=0,L=0,f,S,r,o,s=new y,t,l,E,k=()=>{a=0,M=0,b=0,A=0,L=0,f=void 0,S=void 0,r=void 0,o=void 0,s.refresh(),t=void 0,l=void 0,E=void 0},w=()=>{let h=`${c}initializeCallbacks(): `,n;for(t=[],l=[],n=0;n<f.length;n+=1)t[n]=void 0;for(n=0;n<S.length;n+=1)l[n]=void 0;let u,p=[];for(n=0;n<f.length;n+=1)p.push(f[n].lower);for(n=0;n<S.length;n+=1)p.push(S[n].lower);for(let d in i.callbacks)if(i.callbacks.hasOwnProperty(d)){if(n=p.indexOf(d.toLowerCase()),n<0)throw new Error(`${h}syntax callback '${d}' not a rule or udt name`);if(u=i.callbacks[d]?i.callbacks[d]:void 0,typeof u==\"function\"||u===void 0)n<f.length?t[n]=u:l[n-f.length]=u;else throw new Error(`${h}syntax callback[${d}] must be function reference or falsy)`)}};i.parse=(h,n,u,p)=>{let d=`${c}parse(): `;k(),o=T.stringToChars(u),f=h.rules,S=h.udts;let x=n.toLowerCase(),C;for(let H in f)if(f.hasOwnProperty(H)&&x===f[H].lower){C=f[H].index;break}if(C===void 0)throw new Error(`${d}start rule name '${startRule}' not recognized`);w(),i.trace&&i.trace.init(f,S,o),i.stats&&i.stats.init(f,S),i.ast&&i.ast.init(f,S,o),E=p,r=[{type:e.RNM,index:C}],P(0,0),r=void 0;let N=!1;switch(s.state){case e.ACTIVE:throw new Error(`${d}final state should never be 'ACTIVE'`);case e.NOMATCH:N=!1;break;case e.EMPTY:case e.MATCH:s.phraseLength===o.length?N=!0:N=!1;break;default:throw new Error(\"unrecognized state\")}return{success:N,state:s.state,stateName:e.idName(s.state),length:o.length,matched:s.phraseLength,maxMatched:L,maxTreeDepth:b,nodeHits:A}};let $=(h,n)=>{let u=r[h];for(let p=0;p<u.children.length&&(P(u.children[p],n),s.state===e.NOMATCH);p+=1);},R=(h,n)=>{let u,p,d,x,C=r[h];i.ast&&(p=i.ast.getLength()),u=!0,d=n,x=0;for(let N=0;N<C.children.length;N+=1)if(P(C.children[N],d),s.state===e.NOMATCH){u=!1;break}else d+=s.phraseLength,x+=s.phraseLength;u?(s.state=x===0?e.EMPTY:e.MATCH,s.phraseLength=x):(s.state=e.NOMATCH,s.phraseLength=0,i.ast&&i.ast.setLength(p))},O=(h,n)=>{let u,p,d,x,C=r[h];if(C.max===0){s.state=e.EMPTY,s.phraseLength=0;return}for(p=n,d=0,x=0,i.ast&&(u=i.ast.getLength());!(p>=o.length||(P(h+1,p),s.state===e.NOMATCH)||s.state===e.EMPTY||(x+=1,d+=s.phraseLength,p+=s.phraseLength,x===C.max)););s.state===e.EMPTY||x>=C.min?(s.state=d===0?e.EMPTY:e.MATCH,s.phraseLength=d):(s.state=e.NOMATCH,s.phraseLength=0,i.ast&&i.ast.setLength(u))},D=(h,n,u,p)=>{if(n.phraseLength>u){let d=`${c}opRNM(${h.name}): callback function error: `;throw d+=`sysData.phraseLength: ${n.phraseLength}`,d+=` must be <= remaining chars: ${u}`,new Error(d)}switch(n.state){case e.ACTIVE:if(!p)throw new Error(`${c}opRNM(${h.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:n.phraseLength=0;break;case e.MATCH:n.phraseLength===0&&(n.state=e.EMPTY);break;case e.NOMATCH:n.phraseLength=0;break;default:throw new Error(`${c}opRNM(${h.name}): callback function return error. Unrecognized return state: ${n.state}`)}},v=(h,n)=>{let u,p,d,x=r[h],C=f[x.index],N=t[C.index];if(a||(p=i.ast&&i.ast.ruleDefined(x.index),p&&(u=i.ast.getLength(),i.ast.down(x.index,f[x.index].name))),N){let H=o.length-n;N(s,o,n,E),D(C,s,H,!0),s.state===e.ACTIVE&&(d=r,r=C.opcodes,P(0,n),r=d,N(s,o,n,E),D(C,s,H,!1))}else d=r,r=C.opcodes,P(0,n,s),r=d;a||p&&(s.state===e.NOMATCH?i.ast.setLength(u):i.ast.up(x.index,C.name,n,s.phraseLength))},U=(h,n)=>{let u=r[h];s.state=e.NOMATCH,n<o.length&&u.min<=o[n]&&o[n]<=u.max&&(s.state=e.MATCH,s.phraseLength=1)},B=(h,n)=>{let u=r[h],p=u.string.length;if(s.state=e.NOMATCH,n+p<=o.length){for(let d=0;d<p;d+=1)if(o[n+d]!==u.string[d])return;s.state=e.MATCH,s.phraseLength=p}},Q=(h,n)=>{let u,p=r[h];s.state=e.NOMATCH;let d=p.string.length;if(d===0){s.state=e.EMPTY;return}if(n+d<=o.length){for(let x=0;x<d;x+=1)if(u=o[n+x],u>=65&&u<=90&&(u+=32),u!==p.string[x])return;s.state=e.MATCH,s.phraseLength=d}},Z=(h,n,u)=>{if(n.phraseLength>u){let p=`${c}opUDT(${h.name}): callback function error: `;throw p+=`sysData.phraseLength: ${n.phraseLength}`,p+=` must be <= remaining chars: ${u}`,new Error(p)}switch(n.state){case e.ACTIVE:throw new Error(`${c}opUDT(${h.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(h.empty)n.phraseLength=0;else throw new Error(`${c}opUDT(${h.name}) may not return EMPTY.`);break;case e.MATCH:if(n.phraseLength===0)if(h.empty)n.state=e.EMPTY;else throw new Error(`${c}opUDT(${h.name}) may not return EMPTY.`);break;case e.NOMATCH:n.phraseLength=0;break;default:throw new Error(`${c}opUDT(${h.name}): callback function return error. Unrecognized return state: ${n.state}`)}},q=(h,n)=>{let u,p,d,x=r[h],C=S[x.index];s.UdtIndex=C.index,a||(d=i.ast&&i.ast.udtDefined(x.index),d&&(p=f.length+x.index,u=i.ast.getLength(),i.ast.down(p,C.name)));let N=o.length-n;l[x.index](s,o,n,E),Z(C,s,N),a||d&&(s.state===e.NOMATCH?i.ast.setLength(u):i.ast.up(p,C.name,n,s.phraseLength))},J=(h,n)=>{switch(a+=1,P(h+1,n),a-=1,s.phraseLength=0,s.state){case e.EMPTY:s.state=e.EMPTY;break;case e.MATCH:s.state=e.EMPTY;break;case e.NOMATCH:s.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${s.state}`)}},W=(h,n)=>{switch(a+=1,P(h+1,n),a-=1,s.phraseLength=0,s.state){case e.EMPTY:case e.MATCH:s.state=e.NOMATCH;break;case e.NOMATCH:s.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${s.state}`)}},P=(h,n)=>{let u=`${c}opExecute(): `,p=r[h];switch(A+=1,M>b&&(b=M),M+=1,s.refresh(),i.trace&&i.trace.down(p,n),p.type){case e.ALT:$(h,n);break;case e.CAT:R(h,n);break;case e.REP:O(h,n);break;case e.RNM:v(h,n);break;case e.TRG:U(h,n);break;case e.TBS:B(h,n);break;case e.TLS:Q(h,n);break;case e.UDT:q(h,n);break;case e.AND:J(h,n);break;case e.NOT:W(h,n);break;default:throw new Error(`${u}unrecognized operator`)}a||n+s.phraseLength>L&&(L=n+s.phraseLength),i.stats&&i.stats.collect(p,s),i.trace&&i.trace.up(p,s.state,n,s.phraseLength),M-=1}},I=function(){let e=\"parser.js: Ast()): \",T=g,i=F,c=this,y,a,M,b=0,A=[],L=[],f=[];c.callbacks=[],c.init=(r,o,s)=>{L.length=0,f.length=0,b=0,y=r,a=o,M=s;let t,l=[];for(t=0;t<y.length;t+=1)l.push(y[t].lower);for(t=0;t<a.length;t+=1)l.push(a[t].lower);for(b=y.length+a.length,t=0;t<b;t+=1)A[t]=void 0;for(let E in c.callbacks)if(c.callbacks.hasOwnProperty(E)){let k=E.toLowerCase();if(t=l.indexOf(k),t<0)throw new Error(`${e}init: node '${E}' not a rule or udt name`);A[t]=c.callbacks[E]}},c.ruleDefined=r=>!!A[r],c.udtDefined=r=>!!A[y.length+r],c.down=(r,o)=>{let s=f.length;return L.push(s),f.push({name:o,thisIndex:s,thatIndex:void 0,state:T.SEM_PRE,callbackIndex:r,phraseIndex:void 0,phraseLength:void 0,stack:L.length}),s},c.up=(r,o,s,t)=>{let l=f.length,E=L.pop();return f.push({name:o,thisIndex:l,thatIndex:E,state:T.SEM_POST,callbackIndex:r,phraseIndex:s,phraseLength:t,stack:L.length}),f[E].thatIndex=l,f[E].phraseIndex=s,f[E].phraseLength=t,l},c.translate=r=>{let o,s,t;for(let l=0;l<f.length;l+=1)t=f[l],s=A[t.callbackIndex],s&&(t.state===T.SEM_PRE?s(T.SEM_PRE,M,t.phraseIndex,t.phraseLength,r):s&&s(T.SEM_POST,M,t.phraseIndex,t.phraseLength,r))},c.setLength=r=>{f.length=r,r>0?L.length=f[r-1].stack:L.length=0},c.getLength=()=>f.length;function S(r){let o=\"\";for(;r-- >0;)o+=\" \";return o}c.toXml=()=>{let r=\"\",o=0;return r+=`<?xml version=\"1.0\" encoding=\"utf-8\"?>\n`,r+=`<root nodes=\"${f.length/2}\" characters=\"${M.length}\">\n`,r+=`<!-- input string -->\n`,r+=S(o+2),r+=i.charsToString(M),r+=`\n`,f.forEach(s=>{s.state===T.SEM_PRE?(o+=1,r+=S(o),r+=`<node name=\"${s.name}\" index=\"${s.phraseIndex}\" length=\"${s.phraseLength}\">\n`,r+=S(o+2),r+=i.charsToString(M,s.phraseIndex,s.phraseLength),r+=`\n`):(r+=S(o),r+=`</node><!-- name=\"${s.name}\" -->\n`,o-=1)}),r+=`</root>\n`,r}},pe=function(){let e=g,T=F,i=\"parser.js: Trace(): \",c,y,a,M=\"\",b=0,A=100,L=this,f=r=>{let o=\"\",s=0;if(r>=0)for(;r--;)s+=1,s===5?(o+=\"|\",s=0):o+=\".\";return o};L.init=(r,o,s)=>{y=r,a=o,c=s};let S=r=>{let o;switch(r.type){case e.ALT:o=\"ALT\";break;case e.CAT:o=\"CAT\";break;case e.REP:r.max===1/0?o=`REP(${r.min},inf)`:o=`REP(${r.min},${r.max})`;break;case e.RNM:o=`RNM(${y[r.index].name})`;break;case e.TRG:o=`TRG(${r.min},${r.max})`;break;case e.TBS:r.string.length>6?o=`TBS(${T.charsToString(r.string,0,3)}...)`:o=`TBS(${T.charsToString(r.string,0,6)})`;break;case e.TLS:r.string.length>6?o=`TLS(${T.charsToString(r.string,0,3)}...)`:o=`TLS(${T.charsToString(r.string,0,6)})`;break;case e.UDT:o=`UDT(${a[r.index].name})`;break;case e.AND:o=\"AND\";break;case e.NOT:o=\"NOT\";break;default:throw new Error(`${i}Trace: opName: unrecognized opcode`)}return o};L.down=(r,o)=>{let s=f(b),t=Math.min(A,c.length-o),l=T.charsToString(c,o,t);t<c.length-o&&(l+=\"...\"),l=`${s}|-|[${S(r)}]${l}\n`,M+=l,b+=1},L.up=(r,o,s,t)=>{let l=`${i}trace.up: `;b-=1;let E=f(b),k,w,$;switch(o){case e.EMPTY:$=\"|E|\",w=\"''\";break;case e.MATCH:$=\"|M|\",k=Math.min(A,t),k<t?w=`'${T.charsToString(c,s,k)}...'`:w=`'${T.charsToString(c,s,k)}'`;break;case e.NOMATCH:$=\"|N|\",w=\"\";break;default:throw new Error(`${l} unrecognized state`)}w=`${E}${$}[${S(r)}]${w}\n`,M+=w},L.displayTrace=()=>M},de=function(){let e=g,T=\"parser.js: Stats(): \",i,c,y,a=[],M=[],b=[];this.init=(t,l)=>{i=t,c=l,o()},this.collect=(t,l)=>{s(y,l.state,l.phraseLength),s(a[t.type],l.state,l.phraseLength),t.type===e.RNM&&s(M[t.index],l.state,l.phraseLength),t.type===e.UDT&&s(b[t.index],l.state,l.phraseLength)},this.displayStats=()=>{let t=\"\",l={match:0,empty:0,nomatch:0,total:0},E=(k,w,$,R,O)=>{l.match+=w,l.empty+=$,l.nomatch+=R,l.total+=O;let D=A(w),v=A($),U=A(R),B=A(O);return`${k} | ${D} | ${v} | ${U} | ${B} |\n`};return t+=`          OPERATOR STATS\n`,t+=`      |   MATCH |   EMPTY | NOMATCH |   TOTAL |\n`,t+=E(\"  ALT\",a[e.ALT].match,a[e.ALT].empty,a[e.ALT].nomatch,a[e.ALT].total),t+=E(\"  CAT\",a[e.CAT].match,a[e.CAT].empty,a[e.CAT].nomatch,a[e.CAT].total),t+=E(\"  REP\",a[e.REP].match,a[e.REP].empty,a[e.REP].nomatch,a[e.REP].total),t+=E(\"  RNM\",a[e.RNM].match,a[e.RNM].empty,a[e.RNM].nomatch,a[e.RNM].total),t+=E(\"  TRG\",a[e.TRG].match,a[e.TRG].empty,a[e.TRG].nomatch,a[e.TRG].total),t+=E(\"  TBS\",a[e.TBS].match,a[e.TBS].empty,a[e.TBS].nomatch,a[e.TBS].total),t+=E(\"  TLS\",a[e.TLS].match,a[e.TLS].empty,a[e.TLS].nomatch,a[e.TLS].total),t+=E(\"  UDT\",a[e.UDT].match,a[e.UDT].empty,a[e.UDT].nomatch,a[e.UDT].total),t+=E(\"  AND\",a[e.AND].match,a[e.AND].empty,a[e.AND].nomatch,a[e.AND].total),t+=E(\"  NOT\",a[e.NOT].match,a[e.NOT].empty,a[e.NOT].nomatch,a[e.NOT].total),t+=E(\"TOTAL\",l.match,l.empty,l.nomatch,l.total),t},this.displayHits=t=>{let l=\"\",E=(k,w,$,R,O)=>{y.match+=k,y.empty+=w,y.nomatch+=$,y.total+=R;let D=A(k),v=A(w),U=A($),B=A(R);return`| ${D} | ${v} | ${U} | ${B} | ${O}\n`};typeof t==\"string\"&&t.toLowerCase()[0]===\"a\"?(M.sort(L),b.sort(L),l+=`    RULES/UDTS ALPHABETICALLY\n`):typeof t==\"string\"&&t.toLowerCase()[0]===\"i\"?(M.sort(S),b.sort(S),l+=`    RULES/UDTS BY INDEX\n`):(M.sort(f),b.sort(f),l+=`    RULES/UDTS BY HIT COUNT\n`),l+=`|   MATCH |   EMPTY | NOMATCH |   TOTAL | NAME\n`;for(let k=0;k<M.length;k+=1){let w=M[k];w.total&&(l+=E(w.match,w.empty,w.nomatch,w.total,w.name))}for(let k=0;k<b.length;k+=1){let w=b[k];w.total&&(l+=E(w.match,w.empty,w.nomatch,w.total,w.name))}return l};let A=t=>t<10?`      ${t}`:t<100?`     ${t}`:t<1e3?`    ${t}`:t<1e4?`   ${t}`:t<1e5?`  ${t}`:t<1e6?` ${t}`:`${t}`,L=(t,l)=>t.lower<l.lower?-1:t.lower>l.lower?1:0,f=(t,l)=>t.total<l.total?1:t.total>l.total?-1:L(t,l),S=(t,l)=>t.index<l.index?-1:t.index>l.index?1:0,r=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},o=()=>{a.length=0,y=new r,a[e.ALT]=new r,a[e.CAT]=new r,a[e.REP]=new r,a[e.RNM]=new r,a[e.TRG]=new r,a[e.TBS]=new r,a[e.TLS]=new r,a[e.UDT]=new r,a[e.AND]=new r,a[e.NOT]=new r,M.length=0;for(let t=0;t<i.length;t+=1)M.push({empty:0,match:0,nomatch:0,total:0,name:i[t].name,lower:i[t].lower,index:i[t].index});if(c.length>0){b.length=0;for(let t=0;t<c.length;t+=1)b.push({empty:0,match:0,nomatch:0,total:0,name:c[t].name,lower:c[t].lower,index:c[t].index})}},s=(t,l)=>{switch(t.total+=1,l){case e.EMPTY:t.empty+=1;break;case e.MATCH:t.match+=1;break;case e.NOMATCH:t.nomatch+=1;break;default:throw new Error(`${T}collect(): incStat(): unrecognized state: ${l}`)}}},F={stringToChars:m=>[...m].map(e=>e.codePointAt(0)),charsToString:(m,e,T)=>{let i=m;for(;!(e===void 0||e<0);){if(T===void 0){i=m.slice(e);break}if(T<=0)return\"\";i=m.slice(e,e+T);break}return String.fromCodePoint(...i)}},g={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,idName:m=>{switch(m){case g.ALT:return\"ALT\";case g.CAT:return\"CAT\";case g.REP:return\"REP\";case g.RNM:return\"RNM\";case g.TRG:return\"TRG\";case g.TBS:return\"TBS\";case g.TLS:return\"TLS\";case g.UDT:return\"UDT\";case g.AND:return\"AND\";case g.NOT:return\"NOT\";case g.ACTIVE:return\"ACTIVE\";case g.EMPTY:return\"EMPTY\";case g.MATCH:return\"MATCH\";case g.NOMATCH:return\"NOMATCH\";case g.SEM_PRE:return\"SEM_PRE\";case g.SEM_POST:return\"SEM_POST\";case g.SEM_OK:return\"SEM_OK\";default:return\"UNRECOGNIZED STATE\"}}};function _(){this.grammarObject=\"grammarObject\",this.rules=[],this.rules[0]={name:\"server-url-template\",lower:\"server-url-template\",index:0,isBkr:!1},this.rules[1]={name:\"server-variable\",lower:\"server-variable\",index:1,isBkr:!1},this.rules[2]={name:\"server-variable-name\",lower:\"server-variable-name\",index:2,isBkr:!1},this.rules[3]={name:\"literals\",lower:\"literals\",index:3,isBkr:!1},this.rules[4]={name:\"DIGIT\",lower:\"digit\",index:4,isBkr:!1},this.rules[5]={name:\"HEXDIG\",lower:\"hexdig\",index:5,isBkr:!1},this.rules[6]={name:\"pct-encoded\",lower:\"pct-encoded\",index:6,isBkr:!1},this.rules[7]={name:\"ucschar\",lower:\"ucschar\",index:7,isBkr:!1},this.rules[8]={name:\"iprivate\",lower:\"iprivate\",index:8,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:1,max:1/0},this.rules[0].opcodes[1]={type:1,children:[2,3]},this.rules[0].opcodes[2]={type:4,index:3},this.rules[0].opcodes[3]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,2,3]},this.rules[1].opcodes[1]={type:7,string:[123]},this.rules[1].opcodes[2]={type:4,index:2},this.rules[1].opcodes[3]={type:7,string:[125]},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:3,min:1,max:1/0},this.rules[2].opcodes[1]={type:1,children:[2,3,4]},this.rules[2].opcodes[2]={type:5,min:0,max:122},this.rules[2].opcodes[3]={type:6,string:[124]},this.rules[2].opcodes[4]={type:5,min:126,max:1114111},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:1,max:1/0},this.rules[3].opcodes[1]={type:1,children:[2,3,4,5,6,7,8,9,10,11,12,13]},this.rules[3].opcodes[2]={type:6,string:[33]},this.rules[3].opcodes[3]={type:5,min:35,max:36},this.rules[3].opcodes[4]={type:5,min:38,max:59},this.rules[3].opcodes[5]={type:6,string:[61]},this.rules[3].opcodes[6]={type:5,min:63,max:91},this.rules[3].opcodes[7]={type:6,string:[93]},this.rules[3].opcodes[8]={type:6,string:[95]},this.rules[3].opcodes[9]={type:5,min:97,max:122},this.rules[3].opcodes[10]={type:6,string:[126]},this.rules[3].opcodes[11]={type:4,index:7},this.rules[3].opcodes[12]={type:4,index:8},this.rules[3].opcodes[13]={type:4,index:6},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:5,min:48,max:57},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2,3,4,5,6,7]},this.rules[5].opcodes[1]={type:4,index:4},this.rules[5].opcodes[2]={type:7,string:[97]},this.rules[5].opcodes[3]={type:7,string:[98]},this.rules[5].opcodes[4]={type:7,string:[99]},this.rules[5].opcodes[5]={type:7,string:[100]},this.rules[5].opcodes[6]={type:7,string:[101]},this.rules[5].opcodes[7]={type:7,string:[102]},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:2,children:[1,2,3]},this.rules[6].opcodes[1]={type:7,string:[37]},this.rules[6].opcodes[2]={type:4,index:5},this.rules[6].opcodes[3]={type:4,index:5},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]},this.rules[7].opcodes[1]={type:5,min:160,max:55295},this.rules[7].opcodes[2]={type:5,min:63744,max:64975},this.rules[7].opcodes[3]={type:5,min:65008,max:65519},this.rules[7].opcodes[4]={type:5,min:65536,max:131069},this.rules[7].opcodes[5]={type:5,min:131072,max:196605},this.rules[7].opcodes[6]={type:5,min:196608,max:262141},this.rules[7].opcodes[7]={type:5,min:262144,max:327677},this.rules[7].opcodes[8]={type:5,min:327680,max:393213},this.rules[7].opcodes[9]={type:5,min:393216,max:458749},this.rules[7].opcodes[10]={type:5,min:458752,max:524285},this.rules[7].opcodes[11]={type:5,min:524288,max:589821},this.rules[7].opcodes[12]={type:5,min:589824,max:655357},this.rules[7].opcodes[13]={type:5,min:655360,max:720893},this.rules[7].opcodes[14]={type:5,min:720896,max:786429},this.rules[7].opcodes[15]={type:5,min:786432,max:851965},this.rules[7].opcodes[16]={type:5,min:851968,max:917501},this.rules[7].opcodes[17]={type:5,min:921600,max:983037},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:1,children:[1,2,3]},this.rules[8].opcodes[1]={type:5,min:57344,max:63743},this.rules[8].opcodes[2]={type:5,min:983040,max:1048573},this.rules[8].opcodes[3]={type:5,min:1048576,max:1114109},this.toString=function(){let e=\"\";return e+=`; OpenAPI Server URL templating ABNF syntax\n`,e+=`server-url-template    = 1*( literals / server-variable ) ; variant of https://www.rfc-editor.org/rfc/rfc6570#section-2\n`,e+=`server-variable        = \"{\" server-variable-name \"}\"\n`,e+=`server-variable-name   = 1*( %x00-7A / %x7C / %x7E-10FFFF ) ; every UTF8 character except { and } (from OpenAPI)\n`,e+=`\n`,e+=`; https://www.rfc-editor.org/rfc/rfc6570#section-2.1\n`,e+=`; https://www.rfc-editor.org/errata/eid6937\n`,e+=`literals               = 1*( %x21 / %x23-24 / %x26-3B / %x3D / %x3F-5B\n`,e+=`                       / %x5D / %x5F / %x61-7A / %x7E / ucschar / iprivate\n`,e+=`                       / pct-encoded)\n`,e+=`                            ; any Unicode character except: CTL, SP,\n`,e+=`                            ;  DQUOTE, \"%\" (aside from pct-encoded),\n`,e+='                            ;  \"<\", \">\", \"\\\\\", \"^\", \"`\", \"{\", \"|\", \"}\"\\n',e+=`\n`,e+=`; https://www.rfc-editor.org/rfc/rfc6570#section-1.5\n`,e+=`DIGIT          =  %x30-39             ; 0-9\n`,e+=`HEXDIG         =  DIGIT / \"A\" / \"B\" / \"C\" / \"D\" / \"E\" / \"F\" ; case-insensitive\n`,e+=`\n`,e+=`pct-encoded    =  \"%\" HEXDIG HEXDIG\n`,e+=`\n`,e+=`ucschar        =  %xA0-D7FF / %xF900-FDCF / %xFDF0-FFEF\n`,e+=`               /  %x10000-1FFFD / %x20000-2FFFD / %x30000-3FFFD\n`,e+=`               /  %x40000-4FFFD / %x50000-5FFFD / %x60000-6FFFD\n`,e+=`               /  %x70000-7FFFD / %x80000-8FFFD / %x90000-9FFFD\n`,e+=`               /  %xA0000-AFFFD / %xB0000-BFFFD / %xC0000-CFFFD\n`,e+=`               /  %xD0000-DFFFD / %xE1000-EFFFD\n`,e+=`\n`,e+=`iprivate       =  %xE000-F8FF / %xF0000-FFFFD / %x100000-10FFFD\n`,e}}var ee=(m,e,T,i,c)=>{if(m===g.SEM_PRE){if(Array.isArray(c)===!1)throw new Error(\"parser's user data must be an array\");c.push([\"server-url-template\",F.charsToString(e,T,i)])}return g.SEM_OK},z=ee;var te=(m,e,T,i,c)=>{if(m===g.SEM_PRE){if(Array.isArray(c)===!1)throw new Error(\"parser's user data must be an array\");c.push([\"server-variable\",F.charsToString(e,T,i)])}return g.SEM_OK},V=te;var se=(m,e,T,i,c)=>{if(m===g.SEM_PRE){if(Array.isArray(c)===!1)throw new Error(\"parser's user data must be an array\");c.push([\"server-variable-name\",F.charsToString(e,T,i)])}return g.SEM_OK},j=se;var re=(m,e,T,i,c)=>{if(m===g.SEM_PRE){if(Array.isArray(c)===!1)throw new Error(\"parser's user data must be an array\");c.push([\"literals\",F.charsToString(e,T,i)])}return g.SEM_OK},K=re;var ne=new _,ae=m=>{let e=new G;return e.ast=new I,e.ast.callbacks[\"server-url-template\"]=z,e.ast.callbacks[\"server-variable\"]=V,e.ast.callbacks[\"server-variable-name\"]=j,e.ast.callbacks.literals=K,{result:e.parse(ne,\"server-url-template\",m),ast:e.ast}},Y=ae;var ie=(m,{strict:e=!1}={})=>{try{let T=Y(m);if(!T.result.success)return!1;let i=[];T.ast.translate(i);let c=i.some(([y])=>y===\"server-variable\");if(!e&&!c)try{return new URL(m,\"https://vladimirgorej.com\"),!0}catch{return!1}return e?c:!0}catch{return!1}},oe=ie;var le=m=>{try{return typeof m==\"string\"&&decodeURIComponent(m)!==m}catch{return!1}},X=m=>le(m)?m:encodeURIComponent(m).replace(/%5B/g,\"[\").replace(/%5D/g,\"]\"),ce=[\"literals\",\"server-variable-name\"],he=(m,e,T={})=>{let c={...{encoder:X},...T},y=Y(m);if(!y.result.success)return m;let a=[];return y.ast.translate(a),a.filter(([b])=>ce.includes(b)).map(([b,A])=>b===\"server-variable-name\"?Object.hasOwn(e,A)?c.encoder(e[A],A):`{${A}}`:A).join(\"\")},ue=he;export{G as a,I as b,pe as c,de as d,F as e,g as f,oe as g,ue as h};\n","node_modules/apps/chunk-RKBZVLTP.js":"import{B as s}from\"./chunk-4RDFZJBD.js\";import{a as p,b as d,g as c}from\"./chunk-H64J6GLT.js\";var m=(a,o={})=>{let e={};for(let[n,t]of Object.entries(a)){let r=Object.hasOwn(o,n)?o[n]??\"mutation\":t.readOnly===!0?\"query\":\"mutation\",f={description:t.description,...t.title===void 0?{}:{title:t.title},...t.annotations===void 0?{}:{annotations:t.annotations},...t._meta===void 0?{}:{_meta:t._meta},input:t.input,...t.output===void 0?{}:{output:t.output},run:t.run},i=Object.getOwnPropertyDescriptor(t,\"outputSchema\"),l=u=>t.output!==void 0||i===void 0||i.get===void 0&&i.value===void 0?u:Object.defineProperty(u,\"outputSchema\",{...i,enumerable:!0});e[n]=p(l({...f,kind:r}))}return e},R=(a,o={})=>{let e={};for(let[n,t]of Object.entries(m(a,o))){let r=d(t);r!==void 0&&(e[n]=r)}return c(s(e))};export{m as a,R as b};\n","node_modules/apps/chunk-4RDFZJBD.js":"import{i as ge,l as F}from\"./chunk-H64J6GLT.js\";import{a as Se}from\"./chunk-CWIMLCDY.js\";import{$ as pe,Y as U,Z as ce,aa as de}from\"./chunk-G6QGZRZI.js\";import{D as se,E as ae,F as E,Ub as fe,Vb as me,a as A,d as X,f as Z,fc as q,g as ee,gb as _,gc as K,h as te,hb as ue,hc as k,ic as ye,kc as he,l as ne,ma as P,p as h,q as oe,r as re,w as ie}from\"./chunk-DI7JLZ3C.js\";import{Ce as le,D as w,Ob as a,Q as W,ec as Y,k as b,ne as O,oa as $,rd as t,ve as M}from\"./chunk-IRY5FGME.js\";var He=t.Struct({code:P.fields.code,status:P.fields.status,message:t.Union([t.Struct({source:t.Literal(\"body\")}),t.Struct({source:t.Literal(\"schema\"),value:P.fields.message})]),schema:h}),Ue=t.Struct({name:t.String,in:t.Literals([\"path\",\"query\",\"querystring\",\"header\",\"cookie\"]),required:t.optionalKey(t.Boolean),schema:t.optionalKey(h),style:t.optionalKey(t.String),explode:t.optionalKey(t.Boolean),allowReserved:t.optionalKey(t.Boolean),allowEmptyValue:t.optionalKey(t.Boolean),content:t.optionalKey(h)}),qe=t.Struct({required:t.optionalKey(t.Boolean),content:t.Record(t.String,t.Struct({schema:t.optionalKey(h),encoding:t.optionalKey(h)}))}),Oe=t.Struct({name:t.NonEmptyString,operationId:t.optionalKey(t.String),description:t.String,method:t.Literals([\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"OPTIONS\",\"QUERY\"]),path:t.String,baseUrl:re,openapi:t.String,securitySchemes:t.Record(t.String,h),request:t.Struct({parameters:t.Array(Ue),requestBody:t.optionalKey(qe),security:t.Array(t.Record(t.String,t.Array(t.String))),responses:t.Record(t.String,h)}),streaming:t.optionalKey(t.Literal(!0)),tags:t.optionalKey(t.Array(t.NonEmptyString)),input:h,outputSchema:t.optionalKey(h),errorResponses:t.optionalKey(t.Array(He))}),wt=e=>e===\"GET\"||e===\"HEAD\"||e===\"OPTIONS\"||e===\"QUERY\",Ke=t.Struct({scheme:t.String,field:t.String,part:t.Literals([\"value\",\"username\",\"password\"]),prefix:t.String}),De=t.Struct({id:t.optional(oe),method:t.String,fields:t.Record(t.String,t.Unknown)}),Be=t.Struct({path:t.optionalKey(t.Record(t.String,t.String)),query:t.optionalKey(t.Record(t.String,t.String)),headers:t.optionalKey(t.Record(t.String,t.String))}),Et=t.Struct({operations:t.Array(Oe),definitions:t.optional(t.Record(t.String,h)),methods:t.Record(t.String,t.Array(Ke)),oauth:t.Array(t.String),account:t.optional(De),parameterDefaults:t.optional(Be),signal:t.optional(t.instanceOf(AbortSignal)),fetch:t.optional(t.declare(e=>typeof e==\"function\"))}),Ie=t.Struct({method:Oe.fields.method,path:t.String}),Je=t.String.check(t.isMaxLength(128),t.isPattern(/^[\\w!#$&^.+-]+\\/[\\w!#$&^.+-]+$/u)),C=class extends t.TaggedError()(\"OpenapiError\",{reason:t.Literals([\"invalid_definition\",\"invalid_input\",\"request\"]),status:t.optional(t.Number),operation:t.optional(Ie),contentType:t.optional(Je),bytes:t.optional(t.Int.check(t.isGreaterThanOrEqualTo(0)))}){},bt={maxBodyBytes:16777216,readTimeoutMs:3e4},we=e=>/^application\\/(?:x-)?(?:ndjson|jsonl|jsonlines|json-seq)\\s*(?:;|$)/i.test(e),ze=e=>we(e)||/^(?:text\\/|application\\/(?:[\\w.-]+\\+)?(?:json|xml)|application\\/(?:javascript|x-www-form-urlencoded))/i.test(e),kt=e=>e.contentMediaType!==void 0&&e.contentEncoding===void 0||e.type===\"string\"&&e.format===\"binary\",Tt={type:\"object\",properties:{base64:{type:\"string\",contentEncoding:\"base64\"},contentType:{type:\"string\"}},required:[\"base64\",\"contentType\"],additionalProperties:!1},xt=e=>e.includes(\"json\")&&!we(e)?\"json\":e===\"application/x-www-form-urlencoded\"?\"form\":e===\"multipart/form-data\"?\"multipart\":ze(e)?\"text\":\"binary\";var be=t.Literals([\"server_protocol\",\"server_url\",\"external_reference\",\"circular_reference\",\"schema_keyword\",\"schema_reference\",\"missing_component\",\"openapi_version\",\"auth_helper\",\"auth_missing\",\"operation_path\",\"operation_method\",\"duplicate_operation\",\"server_missing\",\"multiple_hosts\",\"parameter_encoding\",\"parameter_style\",\"request_body\",\"combined_oauth\",\"auth_method\",\"event_stream\",\"input_schema\",\"no_operations\",\"no_supported_operations\",\"invalid_document\",\"source_generation\",\"authoring_reference\"]),ke=t.Struct({name:t.String,method:t.String,path:t.String,code:be,reason:t.String}),Ge=8,Ee=240,Qe=e=>e.length<=Ee?e:`${e.slice(0,Ee-1)}\\u2026`,Ve=`To call a left-out operation anyway, write a custom tool for it in this app with the same account: see \"Custom tools beside generated ones\" in the app-authoring skill's integrations.md.`,We=e=>{let n=e.skipped??[];if(n.length===0)return e.reason;let o=n.some(({code:c})=>c!==\"event_stream\")?` ${Ve}`:\"\",r=new Map;for(let c of n){let l=JSON.stringify([c.code,c.reason]),u=r.get(l);u===void 0?r.set(l,{first:c,count:1}):u.count++}let i=({first:c,count:l})=>`${c.method} ${c.path}${l>1?` and ${l-1} more`:\"\"}`,[s,...p]=r.values();if(s!==void 0&&p.length===0&&s.first.code===e.code&&s.first.reason===e.reason)return`${e.reason} Left out: ${i(s)}.${o}`;let m=[],g=A-`${e.reason} Left out: ; and ${r.size} other reasons.${o}`.length;for(let c of r.values()){let l=`${i(c)} (${c.first.code}: ${Qe(c.first.reason.replace(/\\.$/,\"\"))})`;if(m.length===Ge||l.length+2>g)break;m.push(l),g-=l.length+2}let d=r.size-m.length;return`${e.reason} Left out: ${m.join(\"; \")}${d>0?`; and ${d} other reasons`:\"\"}.${o}`},L=class extends t.TaggedError()(\"OpenapiCompileError\",{code:be,reason:t.String,skipped:t.optionalKey(t.Array(ke)),origins:t.optionalKey(t.Array(t.String))}){get message(){return We(this)}},Ye=t.Struct({name:t.String,method:t.String,path:t.String,operationId:t.optionalKey(t.String),kind:t.Literals([\"query\",\"mutation\"]),public:t.Boolean,methods:t.Array(t.String)}),At=t.Struct({tools:t.Array(Ye),skipped:t.Array(ke)});var Xe={capacity:\"A cache key, value or batch exceeded the app cache's size limits.\",invalid:\"The app made a cache request the app cache could not accept.\",unavailable:\"The app cache was not available for this operation.\",storage:\"The app cache failed to complete the operation.\",timeout:\"The app cache did not respond in time.\"},T=e=>e.toLocaleString(\"en-US\"),Ze={keyBytes:`A cache key exceeded the app cache's limit of ${T(E.keyBytes)} bytes per key.`,entryBytes:`A cache value exceeded the app cache's limit of ${T(E.entryBytes)} bytes per entry.`,batchBytes:`A cache read or write exceeded the app cache's limit of ${T(E.batchBytes)} bytes per batch.`,batchEntries:`A cache read or write exceeded the app cache's limit of ${T(E.batchEntries)} entries per batch.`,totalBytes:`The app cache is full: it holds at most ${T(E.totalBytes)} bytes.`,totalEntries:`The app cache is full: it holds at most ${T(E.totalEntries)} entries.`},et={connect:\"connecting\",transport:\"connecting\",discover:\"listing its tools\",schema:\"reading a tool's schema\",call:\"calling a tool\"},Te=({phase:e,reason:n,status:o})=>{let r=et[e];return O.value(n).pipe(O.when(\"timeout\",()=>`The MCP server did not respond in time while ${r}.`),O.when(\"unauthorized\",()=>`The MCP server rejected the credentials while ${r}.`),O.when(\"invalid_response\",()=>`The MCP server returned a response Executor could not use while ${r}, such as an unreadable message or an address on another origin.`),O.when(\"invalid_input\",()=>\"The MCP server URL or connection settings are invalid.\"),O.when(\"request\",()=>o!==void 0?`The MCP server answered HTTP ${o} while ${r}.`:e===\"transport\"?`Executor could not reach the MCP server while ${r}.`:`The request to the MCP server failed while ${r}.`),O.exhaustive)},tt=({anonymous:e})=>e===\"answered\"?\"This MCP server answers without credentials, so Executor can't check this account. A refused key will show up when a tool is called.\":`The MCP server accepted the credentials, but the same check without them failed, so Executor can't tell whether it requires them. ${t.is(_)(e)?Te(e):e.status===void 0?\"The MCP server could not answer the request.\":`The MCP server answered HTTP ${e.status}.`}`,nt=6,D=(e,n)=>{if(typeof e==\"string\")e.length>=nt&&n.add(e);else if(Array.isArray(e))for(let o of e)D(o,n);else if(b.isObject(e))for(let o of Object.values(e))D(o,n);return n},ot=e=>{let n=new Set;if(b.isObject(e)){for(let o of[e.app,e.user])if(b.isObject(o))for(let r of Object.values(o))for(let i of Array.isArray(r)?r:[r])b.hasProperty(i,\"fields\")&&D(i.fields,n)}return[...n].sort((o,r)=>r.length-o.length)},Dt=e=>ot(Y.value(e)),B=(e,n)=>{let o=e;for(let r of n)o=o.split(r).join(\"[redacted]\");return o},xe=(e,n)=>e.length<=n?e:`${e.slice(0,n-1)}\\u2026`,I=(e,n,o)=>xe(B(e,n),o),rt=(e,n)=>{let o=0;for(let r of n)for(let i=Math.min(r.length-1,e.length);i>o;i--)if(e.endsWith(r.slice(0,i))){o=i;break}return o===0?e:`${e.slice(0,-o)}[redacted]`},x=(e,n)=>I(e,n,A),ve=(e,n)=>{if(e?.message===void 0)return e;let o=ce(e.message)?`${rt(B(e.message.slice(0,-1),n),n)}\\u2026`:B(e.message,n);return{code:e.code,message:xe(o,ne)}},Re=(e,n,o)=>pe({...e,phase:e.phase??o,upstream:ve(e.upstream,n)}),$e=(e,n)=>t.decodeUnknownOption(_)(e).pipe(w.map(({phase:o,reason:r,status:i,upstream:s,session:p})=>{let m=ve(s,n);return new fe({phase:o,reason:r,...i===void 0?{}:{status:i},...m===void 0?{}:{upstream:m},...p===void 0?{}:{session:p}})})),Ae=e=>t.decodeUnknownOption(le)(e).pipe(w.map(({reason:n,message:o,status:r,missing:i})=>new me({reason:n,...o?{message:o}:{},...r===void 0?{}:{status:r},...i===void 0?{}:{missing:i}}))),j=e=>(e.name.length>0?e.name:\"Error\").slice(0,128),it=(e,n)=>b.hasProperty(e,\"code\")&&t.is(X)(e.code)&&e.code!==\"\"?I(e.code,n,128):void 0,st=new Set([\"name\",\"message\",\"stack\",\"cause\",\"_tag\"]),at=(e,n,o)=>{let r={},i=0;for(let[s,p]of Object.entries(e)){if(i===Z)break;if(!(st.has(s)||s===\"code\"&&n!==void 0)&&t.is(te)(s)){if(typeof p==\"string\")r[s]=I(p,o,ee);else if(typeof p==\"boolean\"||typeof p==\"number\"&&Number.isFinite(p))r[s]=p;else continue;i++}}return i===0?void 0:r},Me=e=>{let n=e.cause,o=n instanceof Error&&n.message.length>0?` (caused by ${j(n)}: ${n.message})`:\"\";return e.message.length>0?`${e.message}${o}`:void 0},Bt=e=>e instanceof Error?`${j(e)}: ${Me(e)??\"(no message)\"}`:typeof e==\"string\"?e:`A non-Error ${e===null?\"null\":typeof e} value was thrown`,ct=e=>{let n=e.operation===void 0?\"The API request\":`${e.operation.method} ${e.operation.path}`;if(e.reason===\"invalid_definition\")return\"The API's OpenAPI definition for this operation is invalid.\";if(e.reason===\"invalid_input\")return e.operation===void 0?\"The input could not be encoded as a request for this API operation.\":`The input could not be encoded as a request for ${n}.`;if(e.status===void 0)return`${n} failed before a response arrived.`;let o=[e.contentType,e.bytes===void 0?void 0:`${e.bytes} bytes`].filter(i=>i!==void 0).join(\", \"),r=`${n} responded with HTTP ${e.status}${o===\"\"?\"\":` (${o})`}`;return e.status>=200&&e.status<300?`${r}, but its body could not be read within the response limits.`:`${r}, which matches no error with a message in the API's OpenAPI document.`},Pe=(e,n)=>{if(t.is(ae)(e))return{source:\"storage\",errorName:\"CacheError\",code:e.reason,message:e.limit===void 0?Xe[e.reason]:Ze[e.limit]};if(t.is(C)(e))return{source:\"service\",errorName:\"OpenapiError\",code:e.reason,message:x(ct(e),n)};if(t.is(_)(e))return{source:\"service\",errorName:\"McpError\",code:e.reason,message:Te(e)};if(t.is(ue)(e))return{source:\"service\",errorName:\"McpCredentialsUnverified\",code:e.anonymous===\"answered\"?\"anonymous_access\":e.anonymous.reason,message:tt(e)};if(t.is(L)(e))return{source:\"app\",errorName:\"OpenapiCompileError\",code:e.code,message:x(e.message,n)};if(t.is(ie)(e))return{source:\"app\",errorName:\"NetworkRefused\",code:e.refusal.reason,message:x(e.message,n)};if(t.is(se)(e))return{source:\"app\",errorName:\"FetchOptionUnsupported\",code:e.option,message:x(e.message,n)};if(e instanceof Error){let o=it(e,n),r=at(e,o,n);return{source:\"app\",errorName:j(e),...o===void 0?{}:{code:o},message:x(Me(e)??`${j(e)} was thrown without a message.`,n),...r===void 0?{}:{fields:r}}}return typeof e==\"string\"?{source:\"app\",errorName:\"string\",message:x(e,n)}:{source:\"app\",errorName:typeof e,message:`A non-Error ${e===null?\"null\":typeof e} value was thrown.`}};var pt=(e,n)=>{let o=de(e);if(w.isSome(o))return Re(o.value,n,\"discover\");let r=Ae(e);if(w.isSome(r))return r.value;let i=$e(e,n);return w.isSome(i)?i.value:t.is(k)(e)?e:new ye(Pe(e,n))},H=(e,n)=>a.suspend(e).pipe(a.catchCause(o=>$.hasInterrupts(o)?a.interrupt:a.fail(pt($.squash(o),n)))),Fe=(e,n)=>e.kind===\"router\"?a.succeed(e.meta):e.meta===void 0?a.succeed(e.overrides):H(e.meta,n).pipe(a.map(o=>ge(o,e.overrides))),N=\"tools\",dt=/^[a-z][a-z0-9]*$/,lt=e=>{let n=2166136261;for(let o=0;o<e.length;o++)n=Math.imul(n^e.charCodeAt(o),16777619)>>>0;return n.toString().padStart(10,\"0\")},Ce=e=>{if(e===\"\")return N;let n=e.split(\".\"),o=[N,...n].join(\"-\");if(n.every(s=>dt.test(s))&&o.length<=M.nameCharacters)return o;let r=lt(e),i=e.toLowerCase().replace(/[^a-z0-9]+/g,\"-\").slice(0,M.nameCharacters-N.length-r.length-2).replace(/^-+|-+$/g,\"\");return[N,i,r].filter(s=>s!==\"\").join(\"-\")},J=(e,n,o)=>t.decodeUnknownEffect(he)({path:e,...n?.title===void 0?{}:{title:n.title},...n?.description===void 0?{}:{description:n.description},...n?.icons===void 0?{}:{icons:n.icons},...n?.tags===void 0?{}:{tags:n.tags},...n?.instructions===void 0?{}:{skill:Ce(e)},...o===void 0?{}:{error:o}}).pipe(a.mapError(()=>new k)),Le=e=>e.pipe(a.catchCause(n=>$.hasInterrupts(n)?a.interrupt:a.fail(new k))),je=(e,n,o,r)=>{let i=o.kind===\"query\";return{name:e,...n===\"\"?{}:{router:n},...r===void 0?{}:{schedules:r},description:o.description??`${i?\"Query\":\"Mutate\"} ${e}`,...o.title===void 0?{}:{title:o.title},readOnly:i,annotations:{...o.annotations,readOnlyHint:i}}},Ne=(e,n,o,r)=>Le(t.decodeUnknownEffect(K)(je(e,n,o,r))),G=(e,n,o,r)=>Le(a.gen(function*(){return yield*t.decodeUnknownEffect(q)({...je(e,n,o,r),inputSchema:yield*U(o.input),...o.output===void 0?o.outputSchema===void 0?{}:{outputSchema:o.outputSchema}:{outputSchema:yield*U(o.output)},...o._meta===void 0?{}:{_meta:o._meta}})})),Zt=(e,n)=>({kind:\"dynamic\",...n===void 0?{}:{meta:()=>a.succeed(n)},list:()=>a.forEach(Object.entries(e),([o,r])=>G(o,\"\",r)),summaries:()=>a.forEach(Object.entries(e),([o,r])=>Ne(o,\"\",r)),describe:o=>{let r=Object.hasOwn(e,o)?e[o]:void 0;return r===void 0?a.succeed(void 0):G(o,\"\",r)},resolve:o=>a.succeed(Object.hasOwn(e,o)?e[o]:void 0)}),z=t.Record(t.String,t.Unknown),ut=q.mapFields(e=>({...e,inputSchema:z,outputSchema:t.optionalKey(z),_meta:t.optionalKey(z)})),ft=t.is(t.Json),mt=e=>ft(e.flatMap(n=>[n.inputSchema,n.outputSchema,n._meta].flatMap(o=>o===void 0?[]:Object.values(o)))),yt=t.Array(ut).pipe(t.refine(mt)),_e=(e,n)=>[...e].flatMap(o=>n===\"\"?[o]:o.startsWith(`${n}.`)?[o.slice(n.length+1)]:[]),en=(e,n)=>a.gen(function*(){let o=[],r=[],{wanted:i,secrets:s}=n,p=(d,c,l)=>a.gen(function*(){let u=d.describe,[f,S]=yield*a.all([Fe(d,s),n.summary&&d.summaries!==void 0?H(d.summaries,s):l!==void 0&&u!==void 0?H(()=>a.forEach(l,y=>u(y),{concurrency:\"unbounded\"}),s).pipe(a.map(y=>y.filter(R=>R!==void 0))):H(d.list,s)],{concurrency:\"unbounded\"}),v=yield*(n.summary?t.decodeUnknownEffect(t.Array(K))(S):t.decodeUnknownEffect(yt)(S)).pipe(a.mapError(()=>new k)),Q=new Set,V=[];for(let y of v){if(Q.has(y.name))return yield*new k;if(Q.add(y.name),l!==void 0&&!l.includes(y.name))continue;let R=y.readOnly===!0;V.push({...y,name:F(c,y.name),...c===\"\"?{}:{router:c},readOnly:R,annotations:{...y.annotations,readOnlyHint:R}})}return{meta:f,found:V}}),m=(d,c,l)=>a.gen(function*(){if(c===\"\"){let{meta:f,found:S}=yield*p(d,c,l);return o.push(...S),{meta:f,error:void 0}}let u=yield*a.result(p(d,c,l));return W.isFailure(u)?{meta:d.overrides,error:u.failure}:(o.push(...u.success.found),{meta:u.success.meta,error:void 0})}),g=(d,c)=>a.gen(function*(){(c!==\"\"||i===void 0&&d.meta!==void 0)&&r.push(yield*J(c,d.meta));for(let[l,u]of Object.entries(d.children)){let f=F(c,l);switch(u.kind){case\"query\":case\"mutation\":if(n.scheduled===!0&&n.schedules(f).length===0)break;(i===void 0||i.has(f))&&o.push(n.summary?yield*Ne(f,c,u,n.schedules(f)):yield*G(f,c,u,n.schedules(f)));break;case\"router\":(i===void 0||_e(i,f).length>0)&&(yield*g(u,f));break;case\"dynamic\":{if(n.scheduled===!0)break;let S=i===void 0?void 0:_e(i,f);if(S!==void 0&&S.length===0)break;let v=yield*m(u,f,S);r.push(yield*J(f,v.meta,v.error))}}}});if(e?.kind===\"router\")yield*g(e,\"\");else if(e?.kind===\"dynamic\"&&n.scheduled!==!0){let d=yield*m(e,\"\",i===void 0?void 0:[...i]);i===void 0&&d.meta!==void 0&&r.push(yield*J(\"\",d.meta))}return{tools:o,routers:r}}),tn=e=>a.gen(function*(){let n=[],o=(s,p)=>{if(n.push({path:p,node:s}),s.kind===\"router\")for(let[m,g]of Object.entries(s.children))(g.kind===\"router\"||g.kind===\"dynamic\")&&o(g,F(p,m))};e!==void 0&&o(e,\"\");let r=yield*a.forEach(n,({path:s,node:p})=>Fe(p,[]).pipe(a.flatMap(m=>ht(s,m)),a.orElseSucceed(()=>{})),{concurrency:\"unbounded\"}),i=new Set;return r.filter(s=>s===void 0||i.has(s.name)?!1:(i.add(s.name),!0))}),ht=(e,n)=>a.gen(function*(){if(n?.instructions===void 0)return;let o=Ce(e),r=([n.description,n.title].find(s=>s!==void 0&&s.trim()!==\"\")??(e===\"\"?\"How to use this app's tools\":`How to use the ${e} tools`)).slice(0,M.descriptionCharacters),i=`---\nname: ${o}\ndescription: ${JSON.stringify(r)}\n---\n\n${n.instructions}\n`;return yield*Se([{path:\"SKILL.md\",content:i}],{name:o})});export{He as a,Ue as b,qe as c,Oe as d,wt as e,Et as f,Je as g,C as h,bt as i,we as j,ze as k,kt as l,Tt as m,xt as n,be as o,ke as p,L as q,Ye as r,At as s,Dt as t,x as u,Re as v,$e as w,Ae as x,Bt as y,Pe as z,G as A,Zt as B,en as C,tn as D};\n","node_modules/apps/chunk-H64J6GLT.js":"import{n as l,q as A,s as v}from\"./chunk-G6QGZRZI.js\";import{Va as k,Wa as g,Ya as h,fc as w}from\"./chunk-DI7JLZ3C.js\";import{Ob as d,rd as y}from\"./chunk-IRY5FGME.js\";var m=Symbol(\"apps.Operation\"),O=Symbol(\"apps.Router\"),I=t=>({kind:t.kind,[m]:t}),C=t=>{if(!(typeof t!=\"object\"||t===null||!(m in t)))return t[m]},K=t=>{let e=t.approval;return{...t.description===void 0?{}:{description:t.description},...t.title===void 0?{}:{title:t.title},...t.annotations===void 0?{}:{annotations:t.annotations},...t._meta===void 0?{}:{_meta:t._meta},input:A(t.input),...e===void 0?{}:{approval:n=>l(async()=>e(n),\"approval\")()}}},M=(t,e)=>{let n=Object.defineProperties({},Object.getOwnPropertyDescriptors(t));return Object.defineProperty(n,\"approval\",{enumerable:!0,value:i=>l(async()=>e(i),\"approval\")()})},T=(t,e)=>({...t,[m]:M(t[m],e)}),H=t=>C(t)?.annotations,D=(t,e,n)=>I({...K({...e,input:v(e.input,`The ${t} input`)}),kind:t,...e.output===void 0?{}:{output:A(v(e.output,`The ${t} output`))},run:(i,u)=>l(n,\"handler\")(i,u)}),$=(t,e)=>D(\"query\",t,e);function _(t,e){return D(\"mutation\",t,e)}var f=t=>({[O]:t}),R=t=>{if(!(typeof t!=\"object\"||t===null||!(O in t)))return t[O]},S=t=>C(t)??R(t),q=t=>{if(t===void 0)return;let e=Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0));return Object.keys(e).length===0?void 0:y.decodeUnknownSync(h)(e)},Q=(t,e)=>t===void 0?e:e===void 0?t:{...t,...e};function F(t,e){let n=q(e),i=R(t);if(i!==void 0)return f(i.kind===\"router\"?{...i,...b(Q(i.meta,n))}:{...i,...P(Q(i.overrides,n))});let u={};for(let[p,a]of Object.entries(t)){if(k.has(p))throw new Error(`Router key \"${p}\" is reserved`);if(!y.is(g)(p))throw new Error(`Router key \"${p}\" must start with a letter or _ and contain no dots`);let r=S(a);if(r===void 0)throw new Error(`Router key \"${p}\" must be a query, mutation or router`);u[p]=r}return f({kind:\"router\",...b(n),children:u})}var b=t=>t===void 0?{}:{meta:t},P=t=>t===void 0?{}:{overrides:t},G=t=>{let e=t.meta;return f({kind:\"dynamic\",...e===void 0?{}:{meta:()=>l(async()=>e(),\"router\")().pipe(d.flatMap(n=>y.decodeUnknownEffect(h)(n)))},list:()=>l(async()=>t.list(),\"router\")().pipe(d.flatMap(y.decodeUnknownEffect(y.Array(w)))),resolve:n=>l(async()=>t.resolve(n),\"router\")().pipe(d.map(i=>{if(i===void 0)return;let u=C(i);if(u===void 0)throw new Error(\"Expected an operation declaration\");return u}))})},x=(t,e)=>t===\"\"?e:`${t}.${e}`,V=(t,e)=>{if(t?.kind===\"dynamic\")return{kind:\"dynamic\",source:t,router:\"\",name:e};let n=t,i=\"\",u=e;for(;n!==void 0;){let p=u.indexOf(\".\"),a=p<0?u:u.slice(0,p),r=Object.hasOwn(n.children,a)?n.children[a]:void 0;if(r===void 0)return;let o=p<0?void 0:u.slice(p+1);switch(r.kind){case\"query\":case\"mutation\":return o===void 0?{kind:\"operation\",operation:r,router:i}:void 0;case\"dynamic\":return o===void 0||o===\"\"?void 0:{kind:\"dynamic\",source:r,router:x(i,a),name:o};case\"router\":if(o===void 0)return;n=r,i=x(i,a),u=o}}},N=(t,e=\"\")=>Object.entries(t?.children??{}).flatMap(([n,i])=>{let u=x(e,n);switch(i.kind){case\"query\":case\"mutation\":return[{name:u,router:e,operation:i}];case\"router\":return N(i,u);case\"dynamic\":return[]}}),X=(t,e)=>{let n=R(t);if(n===void 0)throw new Error(\"withApprovals expects a router\");let i=(a,r)=>{let o=e(I(a),r);return o===void 0?a:M(a,o)},u=(a,r)=>{switch(a.kind){case\"query\":case\"mutation\":return i(a,r);case\"router\":case\"dynamic\":return p(a,r)}},p=(a,r)=>a.kind===\"dynamic\"?{...a,resolve:o=>a.resolve(o).pipe(d.flatMap(s=>s===void 0?d.succeed(void 0):d.try({try:()=>i(s,x(r,o)),catch:c=>c})))}:{...a,children:Object.fromEntries(Object.entries(a.children).map(([o,s])=>[o,u(s,x(r,o))]))};return f(p(n,\"\"))},Y=(t,e)=>{let n=R(t);if(n?.kind!==\"dynamic\")throw new Error(\"renameTools expects a protocol router\");let i=r=>{let o=new Set;return r.flatMap(s=>{let c=e(s.name);return c===void 0||o.has(c)?[]:(o.add(c),[{...s,name:c,source:s.name}])})},u=n.summaries??n.list,p=r=>u().pipe(d.map(o=>i(o).find(s=>s.name===r)?.source)),a=({source:r,...o})=>o;return f({...n,list:()=>n.list().pipe(d.map(r=>i(r).map(a))),...n.summaries===void 0?{}:{summaries:()=>u().pipe(d.map(r=>i(r).map(a)))},describe:r=>p(r).pipe(d.flatMap(o=>o===void 0?d.succeed(void 0):n.describe?.(o)??n.list().pipe(d.map(s=>s.find(c=>c.name===o)))),d.map(o=>o===void 0?void 0:{...o,name:r})),resolve:r=>p(r).pipe(d.flatMap(o=>o===void 0?d.succeed(void 0):n.resolve(o)))})};export{I as a,C as b,T as c,H as d,$ as e,_ as f,f as g,R as h,Q as i,F as j,G as k,x as l,V as m,N as n,X as o,Y as p};\n","node_modules/apps/skills.js":"import{a as ke,b as Se}from\"./chunk-Y6CTOODP.js\";import\"./chunk-M63EC7R2.js\";import{a as be}from\"./chunk-EYTDRABV.js\";import{a as q,b as we}from\"./chunk-CWIMLCDY.js\";import{a as ce,c as ee,ca as pe,d as I,da as he,n as de,o as fe,p as ue,v as ye}from\"./chunk-G6QGZRZI.js\";import{u as ae,w as Y,x as le}from\"./chunk-DI7JLZ3C.js\";import{Ae as ne,Be as G,Ce as x,De as $,Ob as a,Qd as Q,Rb as oe,da as ie,qe as X,rd as u,te as me,xe as te,ye as ge,ze as Me}from\"./chunk-IRY5FGME.js\";import\"./chunk-OOJM4CTU.js\";var L=class extends Error{},M=class extends Error{},N=(e,t,n)=>{let i=new Uint16Array(16),l=new Uint16Array(n);for(let r=0;r<n;r++)i[e[t+r]]++;i[0]=0;let s=new Uint16Array(16);for(let r=1;r<16;r++)s[r]=s[r-1]+i[r-1];for(let r=0;r<n;r++){let o=e[t+r];o!==0&&(l[s[o]++]=r)}return{counts:i,symbols:l}},Be=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],Ke=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ze=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],De=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Ie=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],O=new Uint8Array(318);O.fill(8,0,144);O.fill(9,144,256);O.fill(7,256,280);O.fill(8,280,288);O.fill(5,288,318);var We=N(O,0,288),_e=N(O,288,30),W=(e,t,n)=>{if(t+2>e.byteLength)throw new L(\"truncated header\");let i=e[t],l=e[t+1];if((i&15)!==8||(i<<8|l)%31!==0||l&32)throw new L(\"invalid zlib header\");let s=t+2,r=0,o=0,c=new Uint8Array(Math.min(n,1024)),d=0,h=k=>{for(;o<k;){if(s>=e.byteLength)throw new L(\"truncated stream\");r|=e[s++]<<o,o+=8}let S=r&(1<<k)-1;return r>>>=k,o-=k,S},m=({counts:k,symbols:S})=>{let E=0,v=0,C=0;for(let F=1;F<16;F++){E|=h(1);let U=k[F];if(E-U<v)return S[C+(E-v)];C+=U,v+=U,v<<=1,E<<=1}throw new L(\"invalid code\")},y=k=>{if(d+k>n)throw new M;if(d+k<=c.byteLength)return;let S=new Uint8Array(Math.min(n,Math.max(c.byteLength*2,d+k)));S.set(c.subarray(0,d)),c=S},f=(k,S)=>{for(;;){let E=m(k);if(E<256)y(1),c[d++]=E;else{if(E===256)return;{let v=E-257;if(v>=29)throw new L(\"invalid length symbol\");let C=Be[v]+h(Ke[v]),F=m(S);if(F>=30)throw new L(\"invalid distance symbol\");let U=ze[F]+h(De[F]);if(U>d)throw new L(\"distance too far back\");y(C);for(let R=0;R<C;R++,d++)c[d]=c[d-U]}}}},p=0;for(;!p;){p=h(1);let k=h(2);if(k===0){if(r=0,o=0,s+4>e.byteLength)throw new L(\"truncated stored block\");let S=e[s]|e[s+1]<<8,E=e[s+2]|e[s+3]<<8;if((S^65535)!==E)throw new L(\"invalid stored block\");if(s+=4,s+S>e.byteLength)throw new L(\"truncated stored block\");y(S),c.set(e.subarray(s,s+S),d),d+=S,s+=S}else if(k===1)f(We,_e);else if(k===2){let S=h(5)+257,E=h(5)+1,v=h(4)+4,C=new Uint8Array(19);for(let R=0;R<v;R++)C[Ie[R]]=h(3);let F=N(C,0,19),U=new Uint8Array(S+E);for(let R=0;R<U.byteLength;){let D=m(F);if(D<16){U[R++]=D;continue}let P,se=0;if(D===16){if(R===0)throw new L(\"repeat without length\");se=U[R-1],P=3+h(2)}else D===17?P=3+h(3):P=11+h(7);if(R+P>U.byteLength)throw new L(\"too many lengths\");U.fill(se,R,R+P),R+=P}f(N(U,0,S),N(U,S,E))}else throw new L(\"invalid block type\")}if(s+4>e.byteLength)throw new L(\"truncated checksum\");let b=c.subarray(0,d),g=1,T=0;for(let k=0;k<b.byteLength;k++)g=(g+b[k])%65521,T=(T+g)%65521;let V=(e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3])>>>0;if((T<<16|g)>>>0!==V)throw new L(\"checksum mismatch\");return{data:b,end:s+4}};var B=new TextEncoder,j=new TextDecoder,w=class extends Error{},H=e=>{let t=B.encode(e);return[...B.encode((t.byteLength+4).toString(16).padStart(4,\"0\")),...t]},xe=[...B.encode(\"0000\")],Ae=[...B.encode(\"0001\")],Le=e=>{let t=[];for(let n=0;n<e.byteLength;){if(n+4>e.byteLength)throw new w(\"truncated packet\");let i=Number.parseInt(j.decode(e.subarray(n,n+4)),16);if(!Number.isInteger(i)||i===3||n+Math.max(i,4)>e.byteLength)throw new w(\"invalid packet length\");if(i<4){t.push(\"boundary\"),n+=4;continue}t.push(e.subarray(n+4,n+i)),n+=i}return t},Re={\"Content-Type\":\"application/x-git-upload-pack-request\",\"Git-Protocol\":\"version=2\"},Ee=e=>e===void 0||e===\"HEAD\"?[\"HEAD\"]:[`refs/heads/${e}`,`refs/tags/${e}`],Ue=e=>new Uint8Array([...H(`command=ls-refs\n`),...Ae,...H(`peel\n`),...e.flatMap(t=>H(`ref-prefix ${t}\n`)),...xe]),Te=e=>{let t=new Map;for(let n of Le(e)){if(n===\"boundary\")continue;let i=/^([a-f0-9]{40}) (\\S+)(?: .*?peeled:([a-f0-9]{40}))?/.exec(j.decode(n));i!==null&&t.set(i[2],i[3]??i[1])}return t},ve=e=>new Uint8Array([...H(`command=fetch\n`),...Ae,...H(`no-progress\n`),...H(`ofs-delta\n`),...H(`deepen 1\n`),...H(`filter blob:none\n`),...H(`want ${e}\n`),...H(`done\n`),...xe]),Je=e=>{let t=[],n=!1;for(let s of Le(e))if(s!==\"boundary\"){if(!n){n=j.decode(s)===`packfile\n`;continue}if(s[0]===1)t.push(s.subarray(1));else if(s[0]===3)throw new w(\"remote error\")}if(!n)throw new w(\"missing packfile\");let i=new Uint8Array(t.reduce((s,r)=>s+r.byteLength,0)),l=0;for(let s of t)i.set(s,l),l+=s.byteLength;return i},Ze={1:\"commit\",2:\"tree\",3:\"blob\",4:\"tag\"},Ve=(e,t)=>{let n=0,i=()=>{let r=0,o=0,c;do{if(n>=t.byteLength)throw new w(\"truncated delta\");c=t[n++],r+=(c&127)*2**o,o+=7}while(c&128);return r};if(i()!==e.byteLength)throw new w(\"delta base size mismatch\");let l=new Uint8Array(i()),s=0;for(;n<t.byteLength;){let r=t[n++];if(r&128){let o=0,c=0;for(let d=0;d<4;d++)r&1<<d&&(o+=t[n++]*2**(8*d));for(let d=0;d<3;d++)r&1<<4+d&&(c+=t[n++]*2**(8*d));if(c===0&&(c=65536),o+c>e.byteLength||s+c>l.byteLength)throw new w(\"invalid delta copy\");l.set(e.subarray(o,o+c),s),s+=c}else if(r!==0){if(n+r>t.byteLength||s+r>l.byteLength)throw new w(\"invalid delta insert\");l.set(t.subarray(n,n+r),s),s+=r,n+=r}else throw new w(\"reserved delta opcode\")}if(s!==l.byteLength)throw new w(\"delta size mismatch\");return l},re=e=>Array.from(e,t=>t.toString(16).padStart(2,\"0\")).join(\"\"),Qe=async(e,t)=>{let n=B.encode(`${e} ${t.byteLength}\\0`),i=new Uint8Array(n.byteLength+t.byteLength);return i.set(n),i.set(t,n.byteLength),re(new Uint8Array(await crypto.subtle.digest(\"SHA-1\",i)))},Xe=async(e,t)=>{if(j.decode(e.subarray(0,4))!==\"PACK\"||e.byteLength<32)throw new w(\"invalid packfile\");let n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=n.getUint32(4);if(i!==2&&i!==3)throw new w(\"unsupported packfile version\");let l=n.getUint32(8),s=new Map,r=12;for(let h=0;h<l;h++){let m=r,y=e[r++],f=y>>4&7;for(;y&128;)y=e[r++];if(f===6){y=e[r++];let p=y&127;for(;y&128;)y=e[r++],p=(p+1)*128+(y&127);let{data:b,end:g}=W(e,r,t.objectBytes);s.set(m,{kind:\"offset\",base:m-p,delta:b}),r=g}else if(f===7){let p=re(e.subarray(r,r+20)),{data:b,end:g}=W(e,r+20,t.objectBytes);s.set(m,{kind:\"reference\",base:p,delta:b}),r=g}else{let p=Ze[f];if(p===void 0)throw new w(\"invalid object type\");let{data:b,end:g}=W(e,r,t.objectBytes);s.set(m,{kind:\"whole\",type:p,data:b}),r=g}if(r>e.byteLength)throw new w(\"truncated packfile\")}let o=new Map,c=new Map,d=new Set(s.keys());for(;d.size>0;){let h=!1;for(let m of d){let y=s.get(m),f;if(y.kind===\"whole\")f=y;else{let p=y.kind===\"offset\"?c.get(y.base):o.get(y.base);p!==void 0&&(f={type:p.type,data:Ve(p.data,y.delta)})}f!==void 0&&(c.set(m,f),o.set(await Qe(f.type,f.data),f),d.delete(m),h=!0)}if(!h)throw new w(\"unresolved delta base\")}return o},He=async(e,t,n,i)=>{let l=await Xe(Je(e),i),s=l.get(t);if(s?.type!==\"commit\")throw new w(\"missing commit\");let r=/^tree ([a-f0-9]{40})$/m.exec(j.decode(s.data))?.[1];if(r===void 0)throw new w(\"commit without tree\");let o=y=>{let f=l.get(y);if(f?.type!==\"tree\")throw new w(\"missing tree\");let p=[];for(let b=0;b<f.data.byteLength;){let g=f.data.indexOf(32,b),T=f.data.indexOf(0,g);if(g<0||T<0||T+21>f.data.byteLength)throw new w(\"invalid tree entry\");p.push({mode:j.decode(f.data.subarray(b,g)).padStart(6,\"0\"),name:j.decode(f.data.subarray(g+1,T)),id:re(f.data.subarray(T+1,T+21))}),b=T+21}return p},c=r,d=n===void 0?[]:n.split(\"/\");for(let y of d){let f=o(c).find(p=>p.name===y&&p.mode===\"040000\");if(f===void 0)return[];c=f.id}let h=[],m=(y,f)=>{for(let p of o(y)){let b=`${f}${p.name}`;p.mode===\"040000\"?m(p.id,`${b}/`):p.mode!==\"160000\"&&h.push({path:b,mode:p.mode})}};return m(c,d.length===0?\"\":`${d.join(\"/\")}/`),h};var A=e=>new x({reason:e}),Ye=(e,t)=>new x({reason:pe(e,t)?.reason===\"rate_limited\"?\"rate_limited\":\"request\",status:e}),et=(e,{reason:t,status:n})=>{switch(t){case\"rate_limited\":return`${e} is rate limiting skill requests (HTTP ${n}).`;case\"request\":return n===void 0?`Could not reach ${e} to load skills.`:`${e} returned HTTP ${n} while loading skills.`;case\"source\":return`The ${e} skill source settings are not valid.`;case\"document\":return`A skill from ${e} is not a valid skill document.`;case\"limit\":return`The skills from ${e} exceed Executor\\u2019s file or size limits.`;case\"changed\":return`The skills on ${e} changed while they were being read.`;case\"encoding\":return`A skill file from ${e} is not valid UTF-8 text.`}},J=e=>t=>e===void 0||!u.is(G)(e)?t:t.pipe(a.mapError(n=>u.is(x)(n)&&!n.message?new x({reason:n.reason,message:et(e,n),...n.status===void 0?{}:{status:n.status},...n.missing===void 0?{}:{missing:n.missing}}):n)),Fe=(e,t)=>u.is(x)(e)||u.is(Y)(e)?e:t(),Z=(e,t)=>u.decodeUnknownEffect(e)(t).pipe(a.mapError(()=>A(\"document\"))),_=e=>{if(!u.is(me)(e))return!1;try{return e.split(\"/\").every(t=>{let n=decodeURIComponent(t);return n!==\".\"&&n!==\"..\"&&!/[\\\\/]/.test(n)&&!n.includes(\"\\0\")})}catch{return!1}},$e=(e,t)=>new URL(t.split(\"/\").map(encodeURIComponent).join(\"/\"),e).href,z=e=>a.gen(function*(){let t=yield*X.make(0),n=(s,r={})=>a.gen(function*(){let o=yield*a.try({try:()=>new URL(s),catch:()=>A(\"source\")});if(![\"https:\",\"http:\"].includes(o.protocol)||o.username||o.password||o.hash)return yield*A(\"source\");let c=r.refused??(g=>g),d=ee.withScope(yield*ee.HttpClient),h={\"User-Agent\":\"executor-skills\",Accept:\"application/json, text/plain\",\"Cache-Control\":\"no-cache\",...r.headers},m=yield*(r.body===void 0?d.get(o,{headers:h}):d.post(o,{headers:h,body:ce.uint8Array(r.body,r.headers?.[\"Content-Type\"])})).pipe(a.mapError(g=>u.is(Y)(g.cause)?c(g.cause):A(\"request\")));if(yield*be(m).pipe(a.mapError(c)),m.status<200||m.status>=300)return yield*Ye(m.status,m.headers);let y=[],f=0;yield*m.stream.pipe(Q.mapError(()=>A(\"request\")),Q.runForEach(g=>a.gen(function*(){f+=g.byteLength;let T=yield*X.updateAndGet(t,V=>V+g.byteLength);if(f>$.fileBytes||T>$.totalBytes)return yield*A(\"limit\");y.push(g)})));let p=new Uint8Array(f),b=0;for(let g of y)p.set(g,b),b+=g.byteLength;return p}).pipe(a.scoped,a.provide(I.layer),a.provideService(I.RequestInit,{redirect:\"manual\"}),a.provideService(I.Fetch,e.fetch??globalThis.fetch)),i=(s,r={})=>n(s,r).pipe(a.flatMap(o=>a.try({try:()=>new TextDecoder(\"utf-8\",{fatal:!0}).decode(o),catch:()=>A(\"encoding\")})));return{fetchBytes:n,read:i,json:s=>i(s).pipe(a.flatMap(r=>Z(u.fromJsonString(u.Unknown),r)))}}),tt=()=>new x({reason:\"request\",message:\"GitHub returned a git response Executor could not read.\"}),Ce=e=>a.tryPromise({try:async()=>e(),catch:t=>t instanceof M?A(\"limit\"):tt()}),K=[\"github.com\",\"raw.githubusercontent.com\"],Oe=(e,t,n)=>{let i=r=>o=>o.refusal.reason===\"credential_host\"?new x({reason:\"source\",status:le,message:`A request with the GitHub token to ${r} was refused because the account's provider does not declare that host. The provider must declare hosts ${K.join(\" and \")}; reconnect an account connected with other hosts.`}):o;return{repo:t,authenticated:n!==void 0,upload:r=>e.fetchBytes(`https://${K[0]}/${t}.git/git-upload-pack`,{body:r,headers:{...Re,...n===void 0?{}:{Authorization:`Basic ${oe.encode(`x-access-token:${n}`)}`}},refused:i(K[0])}),file:(r,o)=>e.read($e(`https://${K[1]}/${t}/${r}/`,o),{...n===void 0?{}:{headers:{Authorization:`token ${n}`}},refused:i(K[1])})}},nt=(e,t)=>a.gen(function*(){let{repo:n}=e;if(t!==void 0&&/^[a-f0-9]{40}$/.test(t))return t;let i=Ee(t),l=yield*e.upload(Ue(i)).pipe(a.mapError(o=>!u.is(x)(o)||o.reason!==\"request\"?o:!e.authenticated&&(o.status===404||o.status===401)?new x({reason:\"source\",message:`Reading GitHub repository ${n} without credentials returned HTTP ${o.status}: it may not exist, or it may be private. To read a private repository, pass a GitHub account and its token.`,status:o.status,missing:\"repository\"}):e.authenticated&&o.status===404?new x({reason:\"request\",message:`GitHub repository ${n} is not available with the account's token (HTTP 404). Check the repository name and that the token can read it.`,status:o.status}):o)),s=yield*Ce(()=>Te(l)),r=i.map(o=>s.get(o)).find(o=>o!==void 0);return r===void 0?yield*new x({reason:\"source\",message:`The refs read from GitHub repository ${n} include no branch or tag named ${t}.`,missing:\"ref\"}):r}),rt=(e,t,n)=>e.upload(ve(t)).pipe(a.flatMap(i=>Ce(()=>He(i,t,n,{objectBytes:$.fileBytes})))),st=u.Array(u.Struct({directory:u.String,files:u.Array(u.Struct({path:u.String,mode:u.String}))})),je=(e,t,n)=>a.gen(function*(){let i=yield*rt(e,t,n),s=i.filter(r=>r.path===\"SKILL.md\"||r.path.endsWith(\"/SKILL.md\")).map(r=>{let o=r.path.slice(0,-8);return{directory:o,files:i.filter(c=>c.path.startsWith(o))}});return s.reduce((r,o)=>r+o.files.length,0)>$.files?yield*A(\"limit\"):s}),it=(e,t,n,i)=>de(fe(e,\"get\"),\"cache\")({key:[\"apps/githubSkills/directories\",1,n.repo,i,n.path??null],schema:ye(st,!1),freshFor:\"7 days\",load:ue(l=>z({fetch:t.fetch,signal:l.signal}).pipe(a.flatMap(s=>je(Oe(s,n.repo,n.token),i,n.path))),l=>l.signal)}).pipe(a.mapError(l=>Fe(l,()=>new x({reason:\"request\",message:\"Executor could not read or update the app cache for skills.\"})))),ot=e=>a.promise(()=>crypto.subtle.digest(\"SHA-256\",new TextEncoder().encode(JSON.stringify(e)))).pipe(a.map(t=>ie.encode(new Uint8Array(t)))),Pe=e=>e.pipe(a.timeoutOrElse({duration:$.checkMillis,orElse:()=>a.fail(A(\"request\"))})),Ge=(e,t,n)=>e.cache===void 0?n(e,void 0).pipe(a.flatMap(i=>i.load)):Se({cache:e.cache,...e.freshFor===void 0?{}:{freshFor:e.freshFor},...e.staleFor===void 0?{}:{staleFor:e.staleFor},stale:\"revalidate\",prefix:t,schema:ge,summary:{schema:te,of:({files:i,...l})=>l},load:(i,l)=>a.gen(function*(){let s=yield*i===void 0?n(e,e.cache):n({fetch:e.fetch,signal:i.signal},i.cache);if(s.id===void 0)return{tools:yield*s.load};let r=l===void 0?void 0:yield*l;return{tools:r?.header?.publication===s.id?yield*r.tools:yield*s.load,header:{publication:s.id}}})}).pipe(a.flatMap(i=>i.list()),a.mapError(i=>Fe(i,()=>new x({reason:\"request\",message:\"Executor could not read or update the app cache for skills.\"})))),at=u.String.check(u.isPattern(/^[\\x21-\\x7e]+$/u)),lt={\"missing-account\":\"A GitHub token needs its account. Pass account: ctx.user.accounts.<slot> or ctx.app.accounts.<slot> with it.\",\"unselected-account\":\"The GitHub account is not one of this app's selected accounts.\"},ct=e=>e.account!==void 0&&!u.is(at)(e.token)?a.fail(new x({reason:\"source\",message:\"The GitHub account was passed without a valid token.\"})):ke(e,e.token,t=>new x({reason:\"source\",message:lt[t]})),dt=e=>t=>e!==void 0&&u.is(x)(t)&&t.reason===\"request\"&&(t.status===401||t.status===403)?he(new ae({reason:t.status===401?\"unauthorized\":\"rejected\",status:t.status}),e.id):t,qe=e=>a.gen(function*(){if(!/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$/.test(e.repo)||e.path!==void 0&&!_(e.path))return yield*A(\"source\");let t=yield*ct(e);return yield*Ge(t===void 0?e:{...e,cache:t},[\"apps/githubSkills/catalog\",1,e.repo,e.ref??null,e.path??null],(n,i)=>ft(e,n,i))}).pipe(J(\"GitHub\"),a.mapError(dt(e.account))),ft=(e,t,n)=>a.gen(function*(){let i=Oe(yield*z(t),e.repo,e.token),l=yield*Pe(nt(i,e.ref));return{id:l,load:ut(e,i,l,t,n)}}),ut=(e,t,n,i,l)=>a.gen(function*(){let s=yield*l===void 0?je(t,n,e.path):it(l,i,e,n),r=yield*a.forEach(s,({directory:o,files:c})=>a.gen(function*(){let d=yield*a.forEach(c,m=>a.gen(function*(){let y=m.path.slice(o.length);return!_(m.path)||!_(y)||m.mode===\"120000\"?yield*A(\"source\"):{path:y,content:yield*t.file(n,m.path)}}),{concurrency:$.concurrency}),h=o.slice(0,-1).split(\"/\").at(-1);return yield*q(d,o===\"\"||h===void 0?{}:{name:h}).pipe(a.mapError(()=>A(\"document\")))}),{concurrency:1});return yield*Z(ne,r)}),yt=u.Struct({skills:u.Array(u.Struct({name:te.fields.name,version:u.optionalKey(u.String),files:u.Array(u.String)}))}),Ne=e=>a.gen(function*(){let t=yield*a.try({try:()=>new URL(e.url),catch:()=>A(\"source\")});return t.pathname===\"/\"?t.pathname=\"/.well-known/agent-skills/index.json\":t.pathname.endsWith(\"index.json\")||(t.pathname=`${t.pathname.replace(/\\/$/,\"\")}/index.json`),yield*Ge(e,[\"apps/wellKnownSkills/catalog\",1,t.href],n=>pt(t,n))}).pipe(J(URL.canParse(e.url)?new URL(e.url).hostname:void 0)),pt=(e,t)=>a.gen(function*(){let n=yield*z(t),i=yield*Pe(n.read(e.href)),l=yield*Z(u.fromJsonString(yt),i);return{id:l.skills.every(r=>r.version!==void 0)?yield*ot(l.skills.map(({name:r,version:o,files:c})=>[r,o,c])):void 0,load:ht(e,n,i,l)}}),ht=(e,t,n,i)=>a.gen(function*(){if(i.skills.reduce((s,r)=>s+r.files.length,0)>$.files)return yield*A(\"limit\");let l=yield*a.forEach(i.skills,s=>a.gen(function*(){let r=new URL(`${encodeURIComponent(s.name)}/`,e).href,o=yield*a.forEach(s.files,c=>a.gen(function*(){return _(c)?{path:c,content:yield*t.read($e(r,c))}:yield*A(\"source\")}),{concurrency:$.concurrency});return yield*q(o,{name:s.name}).pipe(a.mapError(()=>A(\"document\")))}),{concurrency:1});return(yield*t.read(e.href))!==n?yield*A(\"changed\"):yield*Z(ne,l)});var qt=e=>a.runPromise(qe(e),e.signal===void 0?{}:{signal:e.signal}),Nt=e=>a.runPromise(Ne(e),e.signal===void 0?{}:{signal:e.signal}),Mt=e=>a.runPromise(q(e)),Bt=e=>a.runPromise(we(e)),Kt=e=>{let t=u.decodeUnknownSync(G)(e.service),n=a.runSync(z(e)),i=l=>a.runPromise(l.pipe(J(t)),e.signal===void 0?{}:{signal:e.signal});return{text:l=>i(n.read(l)),json:l=>i(n.json(l))}};export{Me as SkillDefinitionInvalid,x as SkillLoadFailed,G as SkillServiceName,Mt as fileSkill,Bt as folderSkills,qt as githubSkills,Kt as skillReader,Nt as wellKnownSkills};\n","node_modules/apps/chunk-Y6CTOODP.js":"import{b as _}from\"./chunk-M63EC7R2.js\";import{n as m,o as g,p as q,v as G}from\"./chunk-G6QGZRZI.js\";import{E as N,p as B}from\"./chunk-DI7JLZ3C.js\";import{Ob as e,_ as S,qa as H,ra as J,rd as u}from\"./chunk-IRY5FGME.js\";var se=(t,o,h)=>{let{account:f,cache:b}=t;return f===void 0?o===void 0?e.succeed(b):e.fail(h(\"missing-account\")):b===void 0?e.succeed(void 0):e.try({try:()=>b.forAccount(f),catch:()=>h(\"unselected-account\")})},O=t=>G(t,!1),v=new Map,ee=256,ne=(t,o)=>{if(v.delete(t),v.set(t,o),v.size>ee){let h=v.keys().next();h.done!==!0&&v.delete(h.value)}},Q=u.Struct({revision:u.String,pages:u.Int,summaries:u.Int,header:u.optionalKey(B)}),le=t=>e.gen(function*(){let o=t.cache,h=[...t.prefix,\"current\"],f=(n,r,c)=>[...t.prefix,n,r,c],b=t.freshFor??\"5 minutes\",F=t.staleFor??\"1 day\",X=S.toMillis(S.fromInputUnsafe(b))+S.toMillis(S.fromInputUnsafe(F))+3e5,A=yield*e.cached(t.load()),M=(n,r,c,l,s)=>e.gen(function*(){let E=yield*e.forEach(Array.from({length:Math.ceil(l/4)},(i,p)=>p*4),i=>m(g(n,\"readMany\"),\"cache\")(Array.from({length:Math.min(4,l-i)},(p,C)=>f(r,c,i+C)),O(u.Array(s))),{concurrency:\"unbounded\"}),a=[];for(let i of E.flat()){if(i===void 0)return yield*new N({reason:\"unavailable\"});a.push(...i)}return a}),Y=n=>m(g(n,\"read\"),\"cache\")(h,O(Q)).pipe(e.map(r=>r===void 0?void 0:{header:r.header,tools:M(n,r.revision,\"page\",r.pages,t.schema)})),Z=n=>e.gen(function*(){let{tools:r,header:c}=yield*t.load(n,Y(n.cache)),l=yield*e.tryPromise({try:()=>crypto.subtle.digest(\"SHA-256\",new TextEncoder().encode(JSON.stringify({tools:r,header:c??null}))),catch:d=>d}),s=Array.from(new Uint8Array(l),d=>d.toString(16).padStart(2,\"0\")).join(\"\"),E=0,a=[],i=0,p=0,C=[],j=0,w=[],x=0,$=0,R=()=>e.suspend(()=>{let d=w,y=x;return w=[],x=0,d.length?m(g(n.cache,\"write\"),\"cache\")(d,X).pipe(e.withSpan(\"app.cache.flush\",{attributes:{\"cache.flush.index\":$++,\"cache.flush.entries\":d.length,\"cache.flush.bytes\":y}})):e.void}),T=d=>e.gen(function*(){let y=new TextEncoder().encode(JSON.stringify(d)).byteLength;w.length&&(w.length>=64||x+y>4e6)&&(yield*R()),w.push(d),x+=y}),U=()=>e.gen(function*(){a.length&&(yield*T({key:f(s,\"page\",E++),value:a}),a=[],i=0)}),P=()=>e.gen(function*(){C.length&&(yield*T({key:f(s,\"summary\",p++),value:C}),C=[],j=0)}),V=d=>u.decodeUnknownEffect(u.fromJsonString(B))(JSON.stringify(d));for(let d of r){let y=yield*V(d),K=new TextEncoder().encode(JSON.stringify(y)).byteLength;a.length&&(a.length>=64||i+K>5e5)&&(yield*U()),yield*T({key:f(s,\"tool\",d.name),value:y}),a.push(y),i+=K;let W=yield*V(t.summary.of(d)),z=new TextEncoder().encode(JSON.stringify(W)).byteLength;C.length&&j+z>5e5&&(yield*P()),C.push(W),j+=z}return yield*U(),yield*P(),yield*R(),{revision:s,pages:E,summaries:p,...c===void 0?{}:{header:yield*V(c)}}}),D={key:h,schema:O(Q),freshFor:b,staleFor:F,...t.stale===void 0?{}:{stale:t.stale},load:q(Z,n=>n.signal)},k,I=n=>e.suspend(()=>{if(o===void 0)return e.fail(new N({reason:\"unavailable\"}));let r=k;if(r!==void 0)return J.await(r).pipe(e.map(a=>({manifest:a})));let c=J.makeUnsafe();k=c;let l=Object.hasOwn(o,_)?o[_]:void 0,s;return(l===void 0?m(g(o,\"get\"),\"cache\")(D).pipe(e.map(a=>({manifest:a}))):m(g({together:l},\"together\"),\"cache\")(D,a=>(s=n===void 0?void 0:v.get(a),s===void 0||n===void 0?[]:[f(s,\"tool\",n)])).pipe(e.map(({value:a,key:i,reads:p})=>(ne(i,a.revision),a.revision===s&&p!==void 0?{manifest:a,part:{value:p[0]}}:{manifest:a})))).pipe(e.onExit(a=>e.sync(()=>{k===c&&(k=void 0)}).pipe(e.andThen(J.done(c,H.map(a,({manifest:i})=>i))))))}),L=()=>I().pipe(e.map(({manifest:n})=>n));return t.revalidate&&(o===void 0?yield*A:yield*m(g(o,\"revalidate\"),\"cache\")(D)),{list:()=>e.gen(function*(){if(o===void 0)return(yield*A).tools;let n=yield*L();return yield*M(o,n.revision,\"page\",n.pages,t.schema)}),header:()=>o===void 0?A.pipe(e.map(({header:n})=>n)):L().pipe(e.map(n=>n.header)),summaries:()=>e.gen(function*(){if(o===void 0)return(yield*A).tools.map(r=>t.summary.of(r));let n=yield*L();return yield*M(o,n.revision,\"summary\",n.summaries,t.summary.schema)}),resolve:n=>o===void 0?A.pipe(e.map(({tools:r})=>r.find(c=>c.name===n))):I(n).pipe(e.flatMap(({manifest:r,part:c})=>{let l=m(g(o,\"read\"),\"cache\")(f(r.revision,\"tool\",n),O(t.schema));return c===void 0?l:c.value===void 0?e.succeed(void 0):u.decodeUnknownEffect(t.schema)(c.value).pipe(e.catch(()=>l))}))}});export{se as a,le as b};\n","node_modules/apps/chunk-M63EC7R2.js":"import{b as _}from\"./chunk-EYTDRABV.js\";import{e as B,f as F,i as H,n as $,o as L,p as K,q as R}from\"./chunk-G6QGZRZI.js\";import{E as p,F as E,G as q,H as P,Sc as Y}from\"./chunk-DI7JLZ3C.js\";import{Ea as O,Ob as e,_ as J,qa as N,rd as d}from\"./chunk-IRY5FGME.js\";var W=l=>Array.isArray(l)?`[${l.map(W).join(\",\")}]`:l!==null&&typeof l==\"object\"?`{${Object.entries(l).sort(([y],[h])=>y<h?-1:y>h?1:0).map(([y,h])=>`${JSON.stringify(y)}:${W(h)}`).join(\",\")}}`:JSON.stringify(l),ee=l=>e.gen(function*(){let y=yield*d.decodeUnknownEffect(d.Json)(l).pipe(e.mapError(()=>new p({reason:\"invalid\"}))),h=new TextEncoder().encode(W(y));if(h.byteLength>E.keyBytes)return yield*new p({reason:\"capacity\",limit:\"keyBytes\"});let S=yield*e.tryPromise({try:()=>crypto.subtle.digest(\"SHA-256\",h),catch:()=>new p({reason:\"invalid\"})});return[...new Uint8Array(S)].map(b=>b.toString(16).padStart(2,\"0\")).join(\"\")}),z=(l,y,h=\"shared\",S,b=u=>u)=>{let u=n=>l(n).pipe(e.withSpan(\"app.cache.command\",{attributes:{\"cache.operation\":n.operation}})),C=n=>ee([h,n]),T=n=>u({operation:\"read\",keys:n}).pipe(e.flatMap(d.decodeUnknownEffect(d.Array(d.NullOr(q)))),e.mapError(()=>new p({reason:\"storage\"}))),M=(n,i=0)=>e.try({try:()=>({fresh:J.toMillis(J.fromInputUnsafe(n)),stale:J.toMillis(J.fromInputUnsafe(i))}),catch:()=>new p({reason:\"invalid\"})}).pipe(e.flatMap(({fresh:g,stale:o})=>[g,o].every(A=>Number.isFinite(A)&&A>=0)?e.succeed({fresh:Math.min(g,E.retentionMs),stale:Math.max(0,Math.min(o,E.retentionMs-g))}):e.fail(new p({reason:\"invalid\"})))),m=(n,i,g=()=>[])=>e.gen(function*(){let o=yield*C(n.key),A=g(o),t=A.length===0?void 0:yield*e.forEach(A,C),a=(c,s)=>({value:c,key:o,reads:s}),r=c=>({value:c,key:o,reads:void 0}),{fresh:w,stale:G}=yield*M(n.freshFor,n.staleFor),v=c=>d.decodeUnknownEffect(n.schema)(c),V=c=>e.gen(function*(){let s=yield*n.load.pipe(e.flatMap(v)),k=yield*d.decodeUnknownEffect(d.Json)(s).pipe(e.mapError(()=>new p({reason:\"invalid\"}))),U=yield*O.currentTimeMillis;return(yield*u({operation:\"publish\",key:o,lease:c,entry:{value:k,version:crypto.randomUUID(),freshUntil:U+w,staleUntil:U+w+G}}).pipe(e.withSpan(\"app.cache.publish\")))!==!0?yield*new p({reason:\"unavailable\"}):s}).pipe(e.withSpan(\"app.cache.load\"),e.timeout(E.loadTimeoutMs),e.onExit(s=>N.isSuccess(s)?e.void:u({operation:\"release\",key:o,lease:c}).pipe(e.catch(()=>e.void)))),Q=Math.min((yield*O.currentTimeMillis)+E.waitMs,S??Number.POSITIVE_INFINITY),x,D=e.gen(function*(){let c=yield*u({operation:\"acquire\",key:o,refresh:i,...x===void 0?{}:{version:x},...t===void 0?{}:{reads:t}}).pipe(e.flatMap(Z=>d.decodeUnknownEffect(P)(Z).pipe(e.mapError(()=>new p({reason:\"storage\"}))))),{entry:s,lease:k}=c,U=c.reads?.length===t?.length?c.reads:void 0,I=yield*O.currentTimeMillis;x===void 0&&(x=s?.version??null);let X=i&&s!==null&&s.version!==x;if(s!==null&&(X||!i&&k===null&&I<s.freshUntil))return{next:\"fresh\",entry:s,together:U};let j=!i&&s!==null&&I<s.staleUntil;return j&&n.stale!==\"revalidate\"?{next:\"stale\",entry:s,lease:k,together:U}:k!==null?{next:\"load\",lease:k,kept:j}:I>=Q?{next:\"local\"}:{next:\"wait\"}}),f=yield*D;switch(f.next===\"wait\"&&(f=yield*e.gen(function*(){for(;;){yield*e.sleep(\"100 millis\");let c=yield*D;if(c.next!==\"wait\")return c}}).pipe(b)),f.next){case\"fresh\":return yield*e.annotateCurrentSpan(\"cache.result\",\"fresh\"),a(yield*v(f.entry.value),f.together);case\"stale\":return yield*e.annotateCurrentSpan(\"cache.result\",\"stale\"),f.lease!==null&&(yield*y(V(f.lease).pipe(e.asVoid))),a(yield*v(f.entry.value),f.together);case\"load\":return yield*e.annotateCurrentSpan(\"cache.result\",f.kept?\"revalidated\":\"miss\"),r(yield*V(f.lease));case\"local\":return yield*e.annotateCurrentSpan(\"cache.result\",\"local\"),r(yield*n.load.pipe(e.flatMap(v),e.timeout(E.loadTimeoutMs),e.withSpan(\"app.cache.load\",{attributes:{\"cache.load.leased\":!1}})))}}).pipe(e.withSpan(\"app.cache.get\"));return{read:n=>e.forEach(n,C).pipe(e.flatMap(T)),write:(n,i)=>e.gen(function*(){let{fresh:g}=yield*M(i),o=yield*O.currentTimeMillis,A=yield*e.forEach(n,({key:t,value:a})=>e.gen(function*(){return{key:yield*C(t),entry:{value:a,version:crypto.randomUUID(),freshUntil:o+g,staleUntil:o+g}}}));yield*u({operation:\"write\",entries:A})}),invalidate:n=>C(n).pipe(e.flatMap(i=>u({operation:\"invalidate\",key:i})),e.asVoid),get:n=>m(n,!1).pipe(e.map(({value:i})=>i)),getWith:(n,i)=>m(n,!1,i),revalidate:n=>m(n,!0).pipe(e.map(({value:i})=>i))}};var te=Symbol(\"executor.cache.getWithReads\"),me={transport:()=>e.fail(new p({reason:\"unavailable\"})),background:()=>e.die(new Error(\"Cache background runner is unavailable\"))},ge=(l,y,h,S,b)=>{let u=(C,T=h,M=S)=>{let m=z(l.transport,t=>l.background(t.pipe(F(\"background\",\"app.cache.refresh\"))),C,b,t=>t.pipe(e.withSpan(\"app.cache.lease.wait\",B(\"lease\")))),n=t=>({key:t.key,schema:R(t.schema),freshFor:t.freshFor,...t.staleFor===void 0?{}:{staleFor:t.staleFor},...t.stale===void 0?{}:{stale:t.stale},load:e.acquireUseRelease(e.sync(()=>new AbortController),a=>e.all([_(a.signal),H]).pipe(e.flatMap(([r,w])=>$(L(t,\"load\"),\"loader\")({fetch:r,signal:a.signal,cache:u(C,a.signal,w.context)}))),a=>e.sync(()=>a.abort()))}),i=(t,a)=>m[t](n(a)),g=(t,a)=>e.forEach(t,r=>r===null?e.succeed(void 0):d.decodeUnknownEffect(R(a))(r.value)),o=(t,a)=>K((...r)=>a(...r).pipe(F(\"executor\",\"app.cache.call\",{attributes:{\"cache.method\":t}})),T,M),A={get:o(\"get\",t=>i(\"get\",t)),revalidate:o(\"revalidate\",t=>i(\"revalidate\",t)),read:o(\"read\",(t,a)=>m.read([t]).pipe(e.flatMap(r=>{let w=r[0];return w==null?e.succeed(void 0):d.decodeUnknownEffect(R(a))(w.value)}))),readMany:o(\"readMany\",(t,a)=>m.read(t).pipe(e.flatMap(r=>g(r,a)))),write:o(\"write\",m.write),invalidate:o(\"invalidate\",m.invalidate),forAccount:t=>{let a=Y(y).flatMap(([,r])=>Array.isArray(r)?r:[r]).find(r=>r.id===t.id);if(a===void 0)throw new p({reason:\"invalid\"});return u({account:a.id,method:a.method,generation:a.generation},T,M)}};return Object.defineProperty(A,te,{value:o(\"get\",(t,a)=>m.getWith(n(t),a).pipe(e.map(({value:r,key:w,reads:G})=>({value:r,key:w,reads:G?.map(v=>v===null?void 0:v.value)}))))})};return u(\"shared\")};export{ee as a,te as b,me as c,ge as d};\n","node_modules/apps/chunk-EYTDRABV.js":"import{k as h}from\"./chunk-G6QGZRZI.js\";import{B as c,C as a,D as l,x as f,y as p,z as d}from\"./chunk-DI7JLZ3C.js\";import{Ob as o,rd as r}from\"./chunk-IRY5FGME.js\";var R=(t,e)=>t===f&&e!==null&&e!==void 0?e:void 0,y=t=>{let e=R(t.status,t.headers[p]);return e===void 0?o.void:r.decodeUnknownEffect(d)(e).pipe(o.orDie,o.flatMap(o.fail))},w=t=>{for(let e of c.literals){let n=t?.[e],s=a[e];if(n!==void 0&&!s.includes(n))return new l({option:e,value:String(n),supported:s})}},m=t=>async(e,n)=>{let s=w(n);if(s!==void 0)throw s;let i=await t(e,n),u=R(i.status,i.headers.get(p));if(u===void 0)return i;throw await i.body?.cancel(),r.decodeUnknownSync(d)(u)},H=t=>h(t).pipe(o.map(m));export{y as a,H as b};\n","node_modules/apps/chunk-CWIMLCDY.js":"import{Ob as i,rd as o,te as S,ue as y,we as k,xe as h,ye as E,ze as d}from\"./chunk-IRY5FGME.js\";var g=(s,r={})=>i.gen(function*(){let m=`${r.directory===void 0?\"\":`${r.directory}/`}SKILL.md`,t=l=>new d({file:m,reason:l}),f=yield*o.decodeUnknownEffect(o.Array(y))(s).pipe(i.mapError(()=>t(\"files\"))),e=f.find(l=>l.path===\"SKILL.md\");if(e===void 0)return yield*t(\"missing-document\");let n=/^\\uFEFF?---[ \\t]*\\r?\\n([\\s\\S]*?)\\r?\\n---(?:[ \\t]*\\r?\\n|[ \\t]*$)/.exec(e.content);if(n?.[1]===void 0)return yield*t(\"frontmatter\");let a=n[1],{parseDocument:c}=(yield*i.promise(()=>import(\"./browser-LGB77CRC.js\"))).default,p=yield*i.try({try:()=>{let l=c(a);if(l.errors.length)throw l.errors[0];return l.toJS()},catch:()=>t(\"frontmatter\")}),u=yield*o.decodeUnknownEffect(h)(p).pipe(i.mapError(()=>t(\"metadata\")));return r.name!==void 0&&u.name!==r.name?yield*t(\"name-mismatch\"):yield*o.decodeUnknownEffect(E)({...u,files:f}).pipe(i.mapError(()=>t(\"files\")))}),v=s=>i.gen(function*(){let r=s.path??\"skills\";if(!o.is(S)(r))return yield*new d({file:\"SKILL.md\",reason:\"directory\"});let m=yield*o.decodeUnknownEffect(o.Array(y))(s.files).pipe(i.mapError(()=>new d({file:r,reason:\"files\"}))),t=`${r}/`,f=new Map;for(let e of m){if(!e.path.startsWith(t))continue;let[n,...a]=e.path.slice(t.length).split(\"/\");if(a.length===0)continue;if(n===void 0||!o.is(k)(n))return yield*new d({file:e.path,reason:\"directory\"});let c={path:a.join(\"/\"),content:e.content},p=f.get(n);p===void 0?f.set(n,[c]):p.push(c)}return yield*i.forEach([...f].sort(([e],[n])=>e.localeCompare(n)),([e,n])=>g(n.sort((a,c)=>a.path.localeCompare(c.path)),{name:e,directory:`${r}/${e}`}))});export{g as a,v as b};\n","node_modules/apps/chunk-G6QGZRZI.js":"import{l as oo,p as ms,q as Cc,s as _c,t as ot,u as Er}from\"./chunk-DI7JLZ3C.js\";import{$a as C,$b as Fa,$c as Ga,$d as Ec,A as te,Aa as ar,Ab as rs,Ad as oc,B as jt,Ba as cr,Bb as Ea,Bc as ss,Bd as sc,C as vi,Ca as N,Cb as ba,Cd as ic,D as v,Da as mt,Db as ns,Dd as vt,E as Qe,Ea as Vn,Eb as wa,Ec as Ka,Ed as ds,F as Hn,Fa as Xi,Fb as Sa,Fc as is,Fd as ac,Gb as Ta,Gd as cc,H as $i,Ha as Zi,Hb as ka,Hd as dc,I as Fn,Ia as Qi,Ib as Ra,Id as uc,J as Ui,Ja as qn,Jb as Oa,Jd as fc,K as Vt,Ka as ea,Kb as yr,Kd as pc,L as Y,La as dr,Lb as He,Ld as lc,M as Hi,Ma as ta,Mb as Ia,Mc as Wa,Md as mc,N as Nn,Na as fe,Nb as Pa,Nd as hc,O as Mn,Oa as Jn,Ob as f,Od as Yr,P as Fi,Pa as zn,Pb as Ca,Pd as yc,Qa as et,Qb as _a,Qd as $t,R as zo,Ra as $,Rd as us,S as Ni,Sa as ht,Sb as Wn,Sd as Gt,T as Dn,Ta as tt,Tb as Kr,Tc as gr,Td as fs,U as Bn,Ua as _e,Ub as Gn,Ud as yt,V as Mi,Va as ur,Vb as Yn,Vd as Me,W as X,Wa as rt,Wb as Aa,Wd as ie,X as se,Xa as Qo,Xb as va,Xd as ps,Y as qt,Ya as _t,Yb as $a,Yd as gc,Z as Ko,Za as ra,Zb as Ua,Zd as pe,_ as ze,_a as fr,_b as Ha,_d as xc,a as lt,aa as Ue,ab as zr,ac as Na,ad as as,ae as no,b as x,bb as pr,bc as Ma,be as xr,c as Vr,ca as Wo,cb as A,cc as Da,ce as ls,d as Vo,db as na,dc as Xn,de as bc,e as qo,ea as Di,eb as oa,ec as Zn,ed as Ya,ee as wc,f as Ri,fa as Ln,fb as sa,fc as Oe,fe as Sc,g as Oi,ga as Bi,gb as ia,gc as re,ge as Tc,h as _n,ha as Li,hb as aa,hc as zt,he as kc,i as Je,ia as Se,ib as ca,ic as Ba,ie as Xr,j as Ii,ja as ji,jb as da,jc as Kt,jd as Xa,k as qr,ka as Go,kb as At,kc as Qn,kd as Wr,ke as Rc,l as sr,la as Vi,lb as ua,lc as Wt,le as Oc,m as An,ma as qi,mb as es,mc as Fe,me as Ut,n as Jr,na as Ji,nb as Kn,nc as os,nd as Za,o as vn,oa as Ce,ob as fa,oc as La,od as Qa,oe as Ic,p as $n,pa as zi,pb as pa,pc as Ne,pe as Pc,q as Pi,qa as Jt,qb as lr,qc as nt,r as he,rb as la,rc as ja,rd as d,s as Lt,sa as Ki,sb as ma,sc as Va,sd as ec,se as Ac,t as Jo,ta as Wi,tb as ts,tc as qa,td as tc,u as Un,ua as Yo,ub as ha,uc as Ja,v as Ze,va as Xo,vb as mr,vc as za,vd as rc,w as Ci,wa as Zo,wb as hr,wc as eo,wd as cs,x as ir,xa as Gi,xb as ya,xc as to,xd as nc,y as _i,ya as jn,yb as ga,yd as ro,z as Ai,za as Yi,zb as xa,zd as Gr}from\"./chunk-IRY5FGME.js\";import{b as qe}from\"./chunk-OOJM4CTU.js\";var it={};qe(it,{Fetch:()=>ad,RequestInit:()=>Ro,layer:()=>mp});var le={};qe(le,{HttpClient:()=>pn,SpanNameGenerator:()=>od,TracerDisabledWhen:()=>rd,TracerHeaderFilter:()=>nd,TracerPropagationEnabled:()=>ko,catch:()=>Lf,catchTag:()=>jf,catchTags:()=>Vf,del:()=>Df,execute:()=>vf,filterOrElse:()=>qf,filterOrFail:()=>Jf,filterStatus:()=>zf,filterStatusOk:()=>vs,followRedirects:()=>up,get:()=>$f,head:()=>Hf,isHttpClient:()=>ed,layerMergedContext:()=>Ns,make:()=>$s,makeWith:()=>We,mapRequest:()=>Wf,mapRequestEffect:()=>Gf,mapRequestInput:()=>Yf,mapRequestInputEffect:()=>Xf,options:()=>Bf,patch:()=>Nf,post:()=>Ff,put:()=>Mf,query:()=>Uf,retry:()=>Zf,retryTransient:()=>Us,tap:()=>Hs,tapError:()=>Fs,tapRequest:()=>ap,transform:()=>As,transformResponse:()=>Te,withCookiesRef:()=>cp,withRateLimiter:()=>Qf,withScope:()=>dp});var wt={};qe(wt,{Empty:()=>io,FormData:()=>uo,HttpBodyError:()=>Zr,Raw:()=>ao,Stream:()=>fo,Uint8Array:()=>br,empty:()=>Ht,file:()=>xs,fileFromInfo:()=>Ku,formData:()=>Sr,formDataRecord:()=>gs,isHttpBody:()=>qu,isHttpBodyError:()=>Ju,json:()=>wr,jsonSchema:()=>en,jsonUnsafe:()=>Et,raw:()=>Qr,stream:()=>bt,text:()=>xt,uint8Array:()=>gt,urlParams:()=>ys});var so=\"~effect/http/HttpBody\",qu=e=>Je(e,so),hs=\"~effect/http/HttpBody/HttpBodyError\",Zr=class extends Ue(\"HttpBodyError\"){[hs]=hs},Ju=e=>Je(e,hs),Yt=class{[so];constructor(){this[so]=so}[Jr](){return this.toJSON()}toString(){return An(this,{ignoreToString:!0})}},io=class extends Yt{_tag=\"Empty\";toJSON(){return{_id:\"effect/HttpBody\",_tag:\"Empty\"}}},Ht=new io,ao=class extends Yt{_tag=\"Raw\";body;contentType;contentLength;constructor(t,r,n){super(),this.body=t,this.contentType=r,this.contentLength=n}toJSON(){return{_id:\"effect/HttpBody\",_tag:\"Raw\",body:this.body,contentType:this.contentType,contentLength:this.contentLength}}},Qr=(e,t)=>new ao(e,t?.contentType,t?.contentLength),br=class extends Yt{_tag=\"Uint8Array\";contentType;contentLength;text;_body;constructor(t,r,n,o){super(),this._body=t,this.text=o,this.contentType=r,this.contentLength=n}get body(){return this._body??=zu(this.text)}toJSON(){return{_id:\"effect/HttpBody\",_tag:\"Uint8Array\",body:this.contentType.startsWith(\"text/\")||this.contentType.endsWith(\"json\")?new TextDecoder().decode(this.body):`Uint8Array(${this.body.length})`,contentType:this.contentType,contentLength:this.contentLength}}},gt=(e,t)=>new br(e,t??\"application/octet-stream\",e.length),Hc=new TextEncoder,co=globalThis.Buffer,zu=co!==void 0?e=>co.from(e,\"utf8\"):e=>Hc.encode(e),xt=(e,t)=>{if(typeof e!=\"string\"&&(e=e===void 0?\"\":String(e)),co!==void 0)return new br(void 0,t??\"text/plain\",co.byteLength(e,\"utf8\"),e);let r=Hc.encode(e);return new br(r,t??\"text/plain\",r.length,e)},Et=(e,t)=>xt(JSON.stringify(e),t??\"application/json\"),wr=(e,t)=>_t({try:()=>xt(JSON.stringify(e),t??\"application/json\"),catch:r=>new Zr({reason:{_tag:\"JsonError\"},cause:r})}),en=(e,t)=>{let r=Ka(Qa(e));return(n,o)=>r(n,t).pipe(da(i=>new Zr({reason:{_tag:\"SchemaError\",issue:i},cause:i})),C(i=>wr(i,o)))},ys=(e,t)=>xt(eo(nt(e)),t??\"application/x-www-form-urlencoded\"),uo=class extends Yt{_tag=\"FormData\";contentType=void 0;contentLength=void 0;formData;constructor(t){super(),this.formData=t}toJSON(){return{_id:\"effect/HttpBody\",_tag:\"FormData\",formData:this.formData}}},Sr=e=>new uo(e),vc=(e,t,r)=>{if(r!=null){if(typeof r==\"object\"){e.append(t,r);return}e.append(t,String(r))}},gs=e=>{let t=new globalThis.FormData;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let o of n)vc(t,r,o);else vc(t,r,n);return Sr(t)},fo=class extends Yt{_tag=\"Stream\";stream;contentType;contentLength;constructor(t,r,n){super(),this.stream=t,this.contentType=r,this.contentLength=n}toJSON(){return{_id:\"effect/HttpBody\",_tag:\"Stream\",contentType:this.contentType,contentLength:this.contentLength}}},bt=(e,t,r)=>new fo(e,t??\"application/octet-stream\",r),$c=(e,t,r)=>{let n=_a(e);return Ze(n)?$(n.value):rt(cs({module:\"HttpBody\",method:r,description:`Invalid ${t}: ${e}`}))},Fc=He(function*(e,t,r){let n=r?.offset===void 0?Ca:yield*$c(r.offset,\"offset\",t),o=r?.bytesToRead===void 0?void 0:yield*$c(r.bytesToRead,\"bytesToRead\",t),i=n>=e?BigInt(\"0\"):e-n,s=o===void 0||o>i?i:o;return s>BigInt(Number.MAX_SAFE_INTEGER)?yield*rt(cs({module:\"HttpBody\",method:t,description:`Content length exceeds Number.MAX_SAFE_INTEGER: ${s}`})):Number(s)}),xs=(e,t)=>C(us,r=>C(r.stat(e),n=>A(Fc(n.size,\"file\",t),o=>bt(r.stream(e,t),t?.contentType,o)))),Ku=(e,t,r)=>C(us,n=>A(Fc(t.size,\"fileFromInfo\",r),o=>bt(n.stream(e,r),r?.contentType,o)));var ae={};qe(ae,{DecodeError:()=>Ae,EmptyBodyError:()=>nn,EncodeError:()=>Es,HttpClientError:()=>Z,HttpClientErrorSchema:()=>bs,InvalidUrlError:()=>rn,StatusCodeError:()=>Tr,TransportError:()=>tn,isHttpClientError:()=>Ft});var mo=\"~effect/http/HttpClientError\",Ft=e=>Je(e,mo),Z=class extends Ue(\"HttpClientError\"){constructor(t){\"cause\"in t.reason?super({...t,cause:t.reason.cause}):super(t)}[mo]=mo;get request(){return this.reason.request}get response(){return\"response\"in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},kr=e=>e.endsWith(\"Error\")?e.slice(0,-5):e,Rr=(e,t,r)=>t?`${e}: ${t} (${r})`:`${e} error (${r})`,tn=class extends Ue(\"TransportError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return Rr(kr(this._tag),this.description,this.methodAndUrl)}},Es=class extends Ue(\"EncodeError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return Rr(kr(this._tag),this.description,this.methodAndUrl)}},rn=class extends Ue(\"InvalidUrlError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return Rr(kr(this._tag),this.description,this.methodAndUrl)}},Tr=class extends Ue(\"StatusCodeError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return Rr(kr(this._tag),this.description,t)}},Ae=class extends Ue(\"DecodeError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return Rr(kr(this._tag),this.description,t)}},nn=class extends Ue(\"EmptyBodyError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return Rr(kr(this._tag),this.description,t)}},bs=class e extends Za(mo)({_tag:Ya(\"HttpError\"),kind:Ga([\"EncodeError\",\"DecodeError\",\"TransportError\",\"InvalidUrlError\",\"StatusCodeError\",\"EmptyBodyError\"]),cause:Wa(Xa())}){static fromHttpClientError(t){return new e({_tag:\"HttpError\",kind:t.reason._tag,cause:t.reason})}};var Be={};qe(Be,{accept:()=>Os,acceptJson:()=>jc,appendUrl:()=>cf,appendUrlParam:()=>ff,appendUrlParams:()=>pf,basicAuth:()=>of,bearerToken:()=>sf,bodyFile:()=>Tf,bodyFormData:()=>bf,bodyFormDataRecord:()=>wf,bodyJson:()=>yf,bodyJsonUnsafe:()=>gf,bodyStream:()=>Sf,bodyText:()=>hf,bodyUint8Array:()=>mf,bodyUrlParams:()=>Ef,delete:()=>ef,empty:()=>Or,fromWeb:()=>kf,get:()=>Yu,head:()=>tf,isHttpClientRequest:()=>cn,make:()=>De,makeWith:()=>ce,modify:()=>Rs,options:()=>rf,patch:()=>Zu,post:()=>ks,prependUrl:()=>af,put:()=>Qu,query:()=>Xu,removeHash:()=>lf,removeHeader:()=>dn,schemaBodyJson:()=>xf,setBody:()=>ye,setHash:()=>Jc,setHeader:()=>Ir,setHeaders:()=>go,setMethod:()=>yo,setUrl:()=>xo,setUrlParam:()=>uf,setUrlParams:()=>qc,toUrl:()=>un,toWeb:()=>If,toWebResult:()=>zc,trace:()=>nf,updateHeaders:()=>Lc,updateUrl:()=>df});var ws=e=>e!==\"GET\"&&e!==\"HEAD\"&&e!==\"OPTIONS\"&&e!==\"TRACE\";var Nc=[[\"GET\",\"get\"],[\"POST\",\"post\"],[\"PUT\",\"put\"],[\"DELETE\",\"del\"],[\"PATCH\",\"patch\"],[\"HEAD\",\"head\"],[\"OPTIONS\",\"options\"],[\"TRACE\",\"trace\"],[\"QUERY\",\"query\"]];var ho=(e,t)=>t._tag===\"Empty\"||t._tag===\"FormData\"?Fe(Fe(e,\"content-type\"),\"content-length\"):(e=t.contentType===void 0?Fe(e,\"content-type\"):Kt(e,\"content-type\",t.contentType),t.contentLength===void 0?Fe(e,\"content-length\"):Kt(e,\"content-length\",t.contentLength.toString())),on=e=>{if(e==null||!/^\\d+$/.test(e))return;let t=Number(e);return Number.isSafeInteger(t)?t:void 0};var sn=class extends Ue(\"UrlError\"){},an=(e,t,r)=>Nn({try:()=>{let n=new URL(e,Wu());for(let o=0;o<t.params.length;o++){let[i,s]=t.params[o];s!==void 0&&n.searchParams.append(i,s)}return r!==void 0&&(n.hash=r),n},catch:n=>new sn({cause:n})}),Wu=()=>{if(\"location\"in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname};var Ts=\"~effect/http/HttpClientRequest\",cn=e=>Je(e,Ts),Gu={[Ts]:Ts,...vn,toJSON(){return{_id:\"HttpClientRequest\",method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:sr(this.headers),body:this.body.toJSON()}},pipe(){return lt(this,arguments)}};function ce(e,t,r,n,o,i){let s=Object.create(Gu);return s.method=e,s.url=t,s.urlParams=r,s.hash=n,s.headers=o,s.body=i,s}var Or=ce(\"GET\",\"\",ja,he(),Oe,Ht),De=e=>(t,r)=>Rs(Or,{method:e,url:t,...r??void 0}),Yu=De(\"GET\"),Xu=De(\"QUERY\"),ks=De(\"POST\"),Zu=De(\"PATCH\"),Qu=De(\"PUT\"),ef=De(\"DELETE\");var tf=De(\"HEAD\"),rf=De(\"OPTIONS\"),nf=De(\"TRACE\"),Rs=x(2,(e,t)=>{let r=e;return t.method&&(r=yo(r,t.method)),t.url&&(r=xo(r,t.url)),t.headers&&(r=go(r,t.headers)),t.urlParams&&(r=qc(r,t.urlParams)),t.hash&&(r=Jc(r,t.hash)),t.body&&(r=ye(r,t.body)),t.accept&&(r=Os(r,t.accept)),t.acceptJson&&(r=jc(r)),r}),yo=x(2,(e,t)=>ce(t,e.url,e.urlParams,e.hash,e.headers,e.body)),Ir=x(3,(e,t,r)=>ce(e.method,e.url,e.urlParams,e.hash,Kt(e.headers,t,r),e.body)),go=x(2,(e,t)=>ce(e.method,e.url,e.urlParams,e.hash,Qn(e.headers,t),e.body)),Lc=x(2,(e,t)=>ce(e.method,e.url,e.urlParams,e.hash,t(e.headers),e.body)),dn=x(2,(e,t)=>Lc(e,Fe(t))),of=x(3,(e,t,r)=>Ir(e,\"Authorization\",`Basic ${btoa(`${Xn(t)}:${Xn(r)}`)}`)),sf=x(2,(e,t)=>Ir(e,\"Authorization\",`Bearer ${Xn(t)}`)),Os=x(2,(e,t)=>Ir(e,\"Accept\",t)),jc=Os(\"application/json\"),xo=x(2,(e,t)=>{if(typeof t==\"string\")return ce(e.method,t,e.urlParams,e.hash,e.headers,e.body);let r=new URL(t.toString()),n=nt(r.searchParams),o=_i(r.hash===\"\"?void 0:r.hash.slice(1));return r.search=\"\",r.hash=\"\",ce(e.method,r.toString(),n,o,e.headers,e.body)}),af=x(2,(e,t)=>t===\"\"?e:ce(e.method,Vc(t,e.url),e.urlParams,e.hash,e.headers,e.body)),cf=x(2,(e,t)=>t===\"\"?e:ce(e.method,Vc(e.url,t),e.urlParams,e.hash,e.headers,e.body)),Vc=(e,t)=>{let r=e.endsWith(\"/\"),n=t.startsWith(\"/\");return r&&n?e+t.slice(1):!r&&!n?e+\"/\"+t:e+t},df=x(2,(e,t)=>ce(e.method,t(e.url),e.urlParams,e.hash,e.headers,e.body)),uf=x(3,(e,t,r)=>ce(e.method,e.url,Va(e.urlParams,t,r),e.hash,e.headers,e.body)),qc=x(2,(e,t)=>ce(e.method,e.url,qa(e.urlParams,t),e.hash,e.headers,e.body)),ff=x(3,(e,t,r)=>ce(e.method,e.url,Ja(e.urlParams,t,r),e.hash,e.headers,e.body)),pf=x(2,(e,t)=>ce(e.method,e.url,za(e.urlParams,t),e.hash,e.headers,e.body)),Jc=x(2,(e,t)=>ce(e.method,e.url,e.urlParams,Lt(t),e.headers,e.body)),lf=e=>ce(e.method,e.url,e.urlParams,he(),e.headers,e.body),ye=x(2,(e,t)=>ce(e.method,e.url,e.urlParams,e.hash,ho(e.headers,t),t)),mf=x(e=>cn(e[0]),(e,t,r)=>ye(e,gt(t,r))),hf=x(e=>cn(e[0]),(e,t,r)=>ye(e,xt(t,r))),yf=x(2,(e,t)=>A(wr(t),r=>ye(e,r))),gf=x(2,(e,t)=>ye(e,Et(t))),xf=(e,t)=>{let r=en(e,t);return x(2,(n,o)=>A(r(o),i=>ye(n,i)))},Ef=x(2,(e,t)=>ye(e,ys(nt(t)))),bf=x(2,(e,t)=>ye(e,Sr(t))),wf=x(2,(e,t)=>ye(e,gs(t))),Sf=x(e=>cn(e[0]),(e,t,r)=>ye(e,bt(t,r?.contentType,r?.contentLength))),Tf=x(e=>cn(e[0]),(e,t,r)=>A(xs(t,r),n=>ye(e,n)));function un(e){let t=an(e.url,e.urlParams,te(e.hash));return Fi(t)?Lt(t.success):he()}var kf=e=>{let t=e.method.toUpperCase();return Rs(Or,{method:t,url:new URL(e.url),headers:e.headers,body:Rf(e,t)})},Rf=(e,t)=>!ws(t)||e.body===null?Ht:Qr(e.body,{contentType:e.headers.get(\"content-type\")??void 0,contentLength:on(e.headers.get(\"content-length\"))}),zc=(e,t)=>{let r=an(e.url,e.urlParams,te(e.hash));if(Mn(r))return Hi(r.failure);let n={method:e.method,headers:e.headers};if(t?.signal&&(n.signal=t.signal),ws(e.method))switch(e.body._tag){case\"Empty\":break;case\"Raw\":{n.body=e.body.body,Of(e.body.body)&&(n.duplex=\"half\");break}case\"Uint8Array\":{n.body=e.body.body;break}case\"FormData\":{n.body=e.body.formData;break}case\"Stream\":{n.body=Yr(e.body.stream,t?.context??Hn()),n.duplex=\"half\";break}}return Nn({try:()=>new Request(r.success,n),catch:o=>new sn({cause:o})})},Of=e=>typeof ReadableStream<\"u\"&&e instanceof ReadableStream,If=(e,t)=>hr(r=>fr(zc(e,{context:r,signal:t?.signal})));var Ke=\"~effect/http/HttpIncomingMessage\";var Eo=(e,t)=>{let r=e.headers[\"content-type\"]??\"\",n;if(r.includes(\"application/json\"))try{n=yr(e.json)}catch{}else if(r.includes(\"text/\")||r.includes(\"urlencoded\"))try{n=yr(e.text)}catch{}let o={...t,headers:sr(e.headers),remoteAddress:e.remoteAddress};return n!==void 0&&(o.body=n),o};var st=\"~effect/http/HttpClientResponse\",Kc=(e,t)=>new Is(e,t);var Wc=x(2,(e,t)=>ht(()=>t(e.status)?$(e):rt(new Z({reason:new Tr({response:e,request:e.request,description:\"invalid status code\"})})))),Gc=e=>e.status>=200&&e.status<300?$(e):rt(new Z({reason:new Tr({response:e,request:e.request,description:\"non 2xx status code\"})})),Is=class extends $n{[Ke];[st];request;source;constructor(t,r){super(),this.request=t,this.source=r,this[Ke]=Ke,this[st]=st}toJSON(){return Eo(this,{_id:\"HttpClientResponse\",request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get url(){if(this.source.url)return this.source.url.split(\"#\")[0];let t=un(this.request);return Un(t)?\"\":(t.value.hash=\"\",t.value.href)}get headers(){return re(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=Wn(this.source.headers.getSetCookie())}get remoteAddress(){return he()}get stream(){return this.source.body?vt({evaluate:()=>this.source.body,onError:t=>new Z({reason:new Ae({request:this.request,response:this,cause:t})})}):sc(new Z({reason:new nn({request:this.request,response:this,description:\"can not create stream from empty body\"})}))}get json(){return C(this.text,t=>_t({try:()=>t===\"\"?null:JSON.parse(t),catch:r=>new Z({reason:new Ae({request:this.request,response:this,cause:r})})}))}textBody;get text(){return this.textBody??=A(this.arrayBuffer,t=>new TextDecoder().decode(t))}get urlParamsBody(){return C(this.text,t=>_t({try:()=>nt(new URLSearchParams(t)),catch:r=>new Z({reason:new Ae({request:this.request,response:this,cause:r})})}))}formDataBody;get formData(){return this.formDataBody??=et({try:()=>this.source.formData(),catch:t=>new Z({reason:new Ae({request:this.request,response:this,cause:t})})}).pipe(rs,yr)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody?this.arrayBufferBody:(this.arrayBufferBody=et({try:()=>this.source.arrayBuffer(),catch:t=>new Z({reason:new Ae({request:this.request,response:this,cause:t})})}).pipe(rs,yr),this.arrayBufferBody)}pipe(){return lt(this,arguments)}};var Pr={};qe(Pr,{b3:()=>Yc,fromHeaders:()=>Pf,toHeaders:()=>Cs,w3c:()=>Zc,xb3:()=>Xc});var Cs=e=>zt({b3:`${e.traceId}-${e.spanId}-${e.sampled?\"1\":\"0\"}${Ci(e.parent,{onNone:()=>\"\",onSome:t=>`-${t.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?\"01\":\"00\"}`}),Pf=e=>{let t=Zc(e);return Ze(t)||(t=Yc(e),Ze(t))?t:Xc(e)},Yc=e=>{if(!(\"b3\"in e))return he();let t=e.b3.split(\"-\");return t.length<2?he():Lt(Ln({traceId:t[0],spanId:t[1],sampled:t[2]?t[2]===\"1\"||t[2]===\"d\":!0}))},Xc=e=>!e[\"x-b3-traceid\"]||!e[\"x-b3-spanid\"]?he():Lt(Ln({traceId:e[\"x-b3-traceid\"],spanId:e[\"x-b3-spanid\"],sampled:e[\"x-b3-flags\"]===\"1\"||(e[\"x-b3-sampled\"]?e[\"x-b3-sampled\"]===\"1\"||e[\"x-b3-sampled\"]===\"true\":!0)})),Cf=/^[0-9a-f]{32}$/i,_f=/^[0-9a-f]{16}$/i,Zc=e=>{if(!e.traceparent)return he();let t=e.traceparent.split(\"-\");if(t.length!==4)return he();let[r,n,o,i]=t;return r===\"00\"?Cf.test(n)===!1||_f.test(o)===!1||n===\"00000000000000000000000000000000\"||o===\"0000000000000000\"?he():Lt(Ln({traceId:n,spanId:o,sampled:(parseInt(i,16)&1)===1})):he()};var _s=\"~effect/http/HttpClient\",ed=e=>Je(e,_s),pn=Qe(\"effect/HttpClient\"),St=e=>(...t)=>C(pn,r=>r[e](...t)),vf=St(\"execute\"),$f=St(\"get\"),Uf=St(\"query\"),Hf=St(\"head\"),Ff=St(\"post\"),Nf=St(\"patch\"),Mf=St(\"put\"),Df=St(\"del\"),Bf=St(\"options\"),As=x(2,(e,t)=>We(C(r=>t(e.postprocess($(r)),r)),e.preprocess)),Te=x(2,(e,t)=>We(r=>t(e.postprocess(r)),e.preprocess)),Lf=x(2,(e,t)=>Te(e,sa(t)));var jf=x(3,(e,t,r)=>Te(e,n=>ia(n,t,r))),Vf=x(2,(e,t)=>Te(e,aa(t))),qf=x(3,(e,t,r)=>Te(e,la(t,r))),Jf=x(3,(e,t,r)=>Te(e,ma(t,r))),zf=x(2,(e,t)=>Te(e,C(Wc(t)))),vs=Te(C(Gc)),We=(e,t)=>{let r=Object.create(Kf);return r.preprocess=t,r.postprocess=e,r.execute=function(n){return e(t(n))},r},Kf={[_s]:_s,pipe(){return lt(this,arguments)},...vn,toJSON(){return{_id:\"effect/HttpClient\"}},...Object.fromEntries(Nc.map(([e,t])=>[t,function(r,n){return this.execute(De(e)(r,n))}]))},$s=e=>We(t=>C(t,r=>ra(n=>{let o=sd.get(r),i=o??new AbortController,s=an(r.url,r.urlParams,te(r.hash));if(Mn(s))return rt(new Z({reason:new rn({request:r,cause:s.failure})}));let a=s.success;if(n.getRef(Bi)||n.getRef(rd)(r)){let u=e(r,a,i.signal,n);return o?u:ns(p=>ts(p(u),{onSuccess(m){return So.register(m,i),$(new To(m,i))},onFailure(m){return Go(m)&&i.abort(),Qo(m)}}))}return ka(n.getRef(od)(r),{kind:\"client\"},u=>{u.attribute(\"http.request.method\",r.method),u.attribute(\"server.address\",a.origin),a.port!==\"\"&&u.attribute(\"server.port\",+a.port),u.attribute(\"url.full\",a.toString()),u.attribute(\"url.path\",a.pathname),u.attribute(\"url.scheme\",a.protocol.slice(0,-1));let p=a.search.slice(1);p!==\"\"&&u.attribute(\"url.query\",p);let m=n.getRef(La),S=n.getRef(nd);for(let h in r.headers)S(h,\"request\")&&u.attribute(`http.request.header.${h}`,os(h,m)?\"<redacted>\":r.headers[h]);return r=n.getRef(ko)?go(r,Cs(u)):r,ns(h=>h(e(r,a,i.signal,n)).pipe(Ra(u,{captureStackTrace:!1}),ts({onSuccess:l=>{u.attribute(\"http.response.status_code\",l.status);for(let g in l.headers)S(g,\"response\")&&u.attribute(`http.response.header.${g}`,os(g,m)?\"<redacted>\":l.headers[g]);return o?$(l):(So.register(l,i),$(new To(l,i)))},onFailure(l){return!o&&Go(l)&&i.abort(),Qo(l)}})))})})),$),Wf=x(2,(e,t)=>We(e.postprocess,r=>A(e.preprocess(r),t))),Gf=x(2,(e,t)=>We(e.postprocess,r=>C(e.preprocess(r),t))),Yf=x(2,(e,t)=>We(e.postprocess,r=>e.preprocess(t(r)))),Xf=x(2,(e,t)=>We(e.postprocess,r=>C(t(r),e.preprocess))),Zf=x(2,(e,t)=>Te(e,es(t))),Us=x(2,(e,t)=>{let r=Zi(t),n=r?\"errors-and-responses\":t.retryOn??\"errors-and-responses\",o=r?t:t.schedule,i=o&&qn(o),s=r?void 0:t.times;return Te(e,_n(n===\"errors-only\"?Vr:Sa({schedule:i,times:s,while:id}),n===\"response-only\"?Vr:es({while:r||t.while===void 0?Qc:Ii(Qc,t.while),schedule:o,times:s})))}),Qf=x(2,(e,t)=>{let r={initial:!0,limit:t.limit,window:qt(Dn(t.window),X(1))},n=new Map,o=t.key,i=typeof o==\"function\"?o:Vo(o),s=t.tokens,a=typeof s==\"function\"?s:Vo(s??1),c=!t.disableAdaptiveLearning,u=ep(t.responseHeaders),p=S=>{let h=n.get(S);return h!==void 0?h:(n.set(S,r),r)},m=t.disableResponseInspection?void 0:(S,h,l,g)=>{let P=p(h),z=tp(P,S,l,g,u);(z.limit!==P.limit||!Ko(z.window,P.window))&&n.set(h,z)};return As(e,function S(h,l,g=0){let z=tc().getRef(mt),xe=i(l),Ee=Math.max(a(l),1),H=p(xe),_=t.times===void 0||g<t.times;function F(W){return W?C(lr(W),()=>S(h,l,g+1)):S(h,l,g+1)}let G=(W,ne)=>{if(m?.(z,xe,W.headers,Ee),t.disableResponseInspection||W.status!==429)return $(void 0);let K=op(z,fn(W.headers,...u.retryAfter));if(K===void 0)return $(void 0);let L=td(z,W.headers,u)??K;return ne===void 0?$(L):na(t.limiter.adaptiveFeedback({key:xe,epoch:ne.epoch,tokens:Ee,status:W.status,retryAfter:L}),L)};return C(t.limiter.consume({algorithm:t.algorithm,onExceeded:\"delay\",key:xe,limit:H.limit,window:H.window,tokens:Ee}),({delay:W})=>{let ne=()=>{let K=L=>{let ke=ha(h,{onSuccess(oe){return C(G(oe,L),me=>oe.status!==429||!_?$(oe):F(me))},onFailure(oe){return pp(oe)?C(G(oe.reason.response,L),me=>_?F(me):rt(oe)):rt(oe)}});return L===void 0||Bn(L.delay)?ke:pa(ke,L.delay)};return c?C(t.limiter.adaptiveConsume({key:xe,tokens:Ee,fallbackLimit:H.limit,fallbackWindow:H.window}),L=>!Bn(L.delay)&&L.phase===\"cooldown\"?C(lr(L.delay),ne):K(L)):K(void 0)};return Bn(W)?ne():C(lr(W),ne)})})}),ep=e=>({limit:e?.limit===void 0?[\"ratelimit-limit\",\"x-ratelimit-limit\"]:[e.limit.toLowerCase()],remaining:e?.remaining===void 0?[\"ratelimit-remaining\",\"x-ratelimit-remaining\"]:[e.remaining.toLowerCase()],reset:e?.reset===void 0?[\"ratelimit-reset\",\"x-ratelimit-reset\"]:[e.reset.toLowerCase()],resetAfter:e?.resetAfter===void 0?[\"ratelimit-reset-after\",\"x-ratelimit-reset-after\"]:[e.resetAfter.toLowerCase()],retryAfter:e?.retryAfter===void 0?[\"retry-after\"]:[e.retryAfter.toLowerCase()]}),tp=(e,t,r,n,o)=>{let i=rp(e,r,n,o)??e.limit,s=td(t,r,o)??e.window;return i===e.limit&&Ko(s,e.window)?e:{limit:i,window:s,initial:!1}},rp=(e,t,r,n)=>{let o=fn(t,...n.limit),i=ln(o);if(i!==void 0&&i>0)return i;let s=np(t,n);if(s!==void 0)return e.initial?s+r:Math.max(s+r,e.limit)},np=(e,t)=>{let r=fn(e,...t.remaining),n=ln(r);return n!==void 0&&n>=0?n:void 0},td=(e,t,r)=>{let n=sp(fn(t,...r.resetAfter));return n!==void 0?n:ip(e,fn(t,...r.reset))},op=(e,t)=>{if(t===void 0)return;let r=ln(t);if(r!==void 0)return qt(se(r),X(1));let n=Date.parse(t);if(Number.isNaN(n))return;let o=n-e.currentTimeMillisUnsafe();return o<=0?X(1):X(o)},sp=e=>{let t=ln(e);if(!(t===void 0||t<=0))return qt(se(t),X(1))},ip=(e,t)=>{let r=ln(t);if(r===void 0||r<=0)return;let n=e.currentTimeMillisUnsafe();return r>1e12?X(Math.max(r-n,1)):r>1e9?X(Math.max(r*1e3-n,1)):qt(se(r),X(1))},ln=e=>{if(e===void 0)return;let t=/-?\\d+(?:\\.\\d+)?/.exec(e);if(t===null)return;let r=Number(t[0]);return Number.isFinite(r)?r:void 0},fn=(e,...t)=>{for(let r=0;r<t.length;r++){let n=e[t[r]];if(n!==void 0)return n}},Hs=x(2,(e,t)=>Te(e,pr(t))),Fs=x(2,(e,t)=>Te(e,ua(t))),ap=x(2,(e,t)=>We(e.postprocess,r=>pr(e.preprocess(r),t))),cp=x(2,(e,t)=>We(r=>pr(e.postprocess(r),n=>Pc(t,o=>Yn(o,n.cookies))),r=>C(e.preprocess(r),n=>A(Ic(t),o=>Gn(o)?n:Ir(n,\"cookie\",Ma(o)))))),dp=e=>As(e,(t,r)=>{let n=new AbortController;return sd.set(r,n),zr(xa(()=>tt(()=>n.abort())),t)}),up=x(e=>ed(e[0]),(e,t)=>We(r=>{let n=(o,i)=>ht(()=>{let s;return C(e.postprocess(A(o,a=>(s=a,a))),a=>{if(a.status<300||a.status>=400||!a.headers.location||i>=(t??10))return $(a);let c=new URL(a.headers.location,a.request.url),u=s??a.request,p=u;return((a.status===301||a.status===302)&&u.method===\"POST\"||a.status===303&&u.method!==\"GET\"&&u.method!==\"HEAD\")&&(p=yo(p,\"GET\"),p=ye(p,Ht)),c.origin!==new URL(a.request.url).origin&&(p=dn(p,\"authorization\"),p=dn(p,\"proxy-authorization\"),p=dn(p,\"cookie\")),n($(xo(p,c)),i+1)})});return n(r,0)},e.preprocess)),rd=Vt(\"effect/http/HttpClient/TracerDisabledWhen\",{defaultValue:()=>Ri}),nd=Vt(\"effect/http/HttpClient/TracerHeaderFilter\",{defaultValue:()=>qo}),ko=Vt(\"effect/http/HttpClient/TracerPropagationEnabled\",{defaultValue:qo}),od=Vt(\"effect/http/HttpClient/SpanNameGenerator\",{defaultValue:()=>e=>`http.client ${e.method}`}),Ns=e=>jn(pn)(hr(t=>A(e,r=>Te(r,ya(n=>Ui(t,n)))))),So=(()=>{if(\"FinalizationRegistry\"in globalThis&&globalThis.FinalizationRegistry){let t=new FinalizationRegistry(r=>{r.abort()});return{register(r,n){t.register(r,n,r)},unregister(r){t.unregister(r)}}}let e=new Map;return{register(t,r){e.set(t,setTimeout(()=>r.abort(),5e3))},unregister(t){let r=e.get(t);r!==void 0&&(clearTimeout(r),e.delete(t))}}})(),sd=new WeakMap,To=class{original;controller;constructor(t,r){this.original=t,this.controller=r}[st]=st;[Ke]=Ke;applyInterrupt(t){return ht(()=>(So.unregister(this.original),ba(t,()=>tt(()=>{this.controller.abort()}))))}get request(){return this.original.request}get url(){return this.original.url}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return oc(()=>(So.unregister(this.original),lc(this.original.stream,tt(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Jr](){return this.original[Jr]()}pipe(){return lt(this,arguments)}},Qc=e=>Ji(e)||fp(e),fp=e=>Ft(e)&&(e.reason._tag===\"TransportError\"||e.reason._tag===\"StatusCodeError\"&&id(e.reason.response)),pp=e=>Ft(e)&&e.reason._tag===\"StatusCodeError\"&&e.reason.response.status===429,id=e=>e.status===408||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504;var ad=Vt(\"effect/http/FetchHttpClient/Fetch\",{defaultValue:()=>globalThis.fetch}),Ro=class extends Qe()(\"effect/http/FetchHttpClient/RequestInit\"){},lp=$s((e,t,r,n)=>{let o=n.getRef(ad),i=$i(n.context,Ro)??{},s=i.headers?Wt(re(i.headers),e.headers):e.headers;s[\"content-length\"]&&(s=Fe(s,\"content-length\"));let a=c=>A(et({try:()=>o(t,{...i,method:e.method,headers:s,body:c,duplex:typeof ReadableStream<\"u\"&&c instanceof ReadableStream?\"half\":void 0,signal:r}),catch:u=>new Z({reason:new tn({request:e,cause:u})})}),u=>Kc(e,u));switch(e.body._tag){case\"Raw\":case\"Uint8Array\":return a(e.body.body);case\"FormData\":return a(e.body.formData);case\"Stream\":return C(yc(e.body.stream),a)}return a(void 0)}),mp=Ns($(lp));var _r={};qe(_r,{empty:()=>md,expireCookie:()=>Hp,expireCookieUnsafe:()=>Np,file:()=>Ip,fileWeb:()=>Pp,formData:()=>Op,fromClientResponse:()=>Kp,fromWeb:()=>Gp,html:()=>Ep,htmlStream:()=>bp,isHttpServerResponse:()=>Cr,json:()=>wp,jsonUnsafe:()=>Tp,mergeCookies:()=>Dp,omitsBody:()=>xd,raw:()=>Rp,redirect:()=>gp,removeCookie:()=>vp,removeHeader:()=>_p,replaceCookies:()=>$p,schemaJson:()=>Sp,setBody:()=>gd,setBodyKeepHeaders:()=>jp,setCookie:()=>Up,setCookieUnsafe:()=>Fp,setCookies:()=>Bp,setCookiesUnsafe:()=>Lp,setHeader:()=>Cp,setHeaders:()=>Ap,setStatus:()=>Vp,stream:()=>hd,text:()=>Ds,toClientResponse:()=>Jp,toWeb:()=>qp,uint8Array:()=>xp,updateCookies:()=>Mp,urlParams:()=>kp});var hp=Object.getPrototypeOf(Oe),cd=()=>Object.create(hp);function ud(e,...t){let r=t.length,n=new Array(r),o=[];for(let i=0;i<r;i++){let s=t[i];Jo(s)?n[i]=s._tag===\"Some\"?at(s.value):\"\":pd(s)?n[i]=at(s.value):Jn(s)?o.push([i,s]):n[i]=at(s)}return o.length===0?$(dd(e,n)):A(zn(o,([i,s])=>pr(s,a=>tt(()=>{n[i]=at(a)})),{concurrency:\"unbounded\",discard:!0}),i=>dd(e,n))}function fd(e,...t){let r=[],n=\"\";for(let o=0,i=t.length;o<i;o++){n+=e[o];let s=t[o];Jo(s)?n+=s._tag===\"Some\"?at(s.value):\"\":pd(s)?n+=at(s.value):Jn(s)?(n.length>0&&(r.push(n),n=\"\"),r.push(A(s,at))):nc(s)?(n.length>0&&(r.push(n),n=\"\"),r.push(ac(s,at))):n+=at(s)}return n+=e[e.length-1],n.length>0&&(r.push(n),n=\"\"),ic(r).pipe(cc(o=>Jn(o)?o:$(o),{concurrency:\"unbounded\"}),dc(o=>typeof o==\"string\"?Gr(o):o))}function at(e){if(Array.isArray(e))return e.map(at).join(\"\");switch(typeof e){case\"string\":return e;case\"number\":case\"bigint\":return e.toString();case\"boolean\":return e?\"true\":\"false\";default:return\"\"}}function dd(e,t){let r=\"\";for(let n=0,o=t.length;n<o;n++)r+=e[n],r+=t[n];return r+e[e.length-1]}function pd(e){return zi(e)&&e._tag===\"Success\"}var Ms=\"~effect/http/HttpServerResponse\",Cr=e=>Je(e,Ms),md=e=>B({status:e?.status??204,statusText:e?.statusText,headers:e?.headers?re(e.headers):void 0,cookies:e?.cookies}),gp=(e,t)=>{let r=zt({location:e.toString()});return B({status:t?.status??302,statusText:t?.statusText,headers:t?.headers?Wt(r,re(t.headers)):r,cookies:t?.cookies??Kr})},xp=(e,t)=>{let r=t?.headers?re(t.headers):Oe;return B({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies??Kr,body:gt(e,Xt(t,r))})},Xt=(e,t)=>{if(e?.contentType)return e.contentType;if(e?.headers)return t[\"content-type\"]},Ds=(e,t)=>{let r=t?.headers?re(t.headers):Oe;return B({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies??Kr,body:xt(e,Xt(t,r))})},Ep=(e,...t)=>typeof e==\"string\"?Ds(e,{contentType:\"text/html\"}):A(ud(e,...t),r=>Ds(r,{contentType:\"text/html\"})),bp=(e,...t)=>A(mr(),r=>hd(mc(pc(fd(e,...t)),r),{contentType:\"text/html\"})),wp=(e,t)=>{let r=t?.headers?re(t.headers):Oe;return A(wr(e,Xt(t,r)),n=>B({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies,body:n}))},Sp=(e,t)=>{let r=en(e,t);return(n,o)=>{let i=o?.headers?re(o.headers):Oe;return A(r(n,Xt(o,i)),s=>B({status:o?.status??200,statusText:o?.statusText,headers:i,cookies:o?.cookies,body:s}))}},Tp=(e,t)=>{let r=t?.headers?re(t.headers):Oe;return B({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies,body:Et(e,Xt(t,r))})},kp=(e,t)=>{let r=t?.headers?re(t.headers):Oe;return B({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies,body:xt(eo(nt(e)),Xt(t,r)??\"application/x-www-form-urlencoded\")})},Rp=(e,t)=>B({status:t?.status??200,statusText:t?.statusText,headers:t?.headers&&re(t.headers),cookies:t?.cookies,body:Qr(e,{contentType:t?.contentType,contentLength:t?.contentLength})}),Op=(e,t)=>B({status:t?.status??200,statusText:t?.statusText,headers:t?.headers&&re(t.headers),cookies:t?.cookies,body:Sr(e)}),hd=(e,t)=>{let r=t?.headers?re(t.headers):Oe;return B({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies,body:bt(e,Xt(t,r),t?.contentLength)})},yd=Qe(\"effect/http/HttpPlatform\"),Ip=(e,t)=>C(yd,r=>r.fileResponse(e,t)),Pp=(e,t)=>C(yd,r=>r.fileWebResponse(e,t)),Cp=x(3,(e,t,r)=>B(e,Kt(e.headers,t,r))),_p=x(2,(e,t)=>B({...e,headers:Fe(e.headers,t)})),Ap=x(2,(e,t)=>B(e,Qn(e.headers,t))),vp=x(2,(e,t)=>B({...e,cookies:Aa(e.cookies,t)})),$p=x(2,(e,t)=>B({...e,cookies:t})),Up=x(e=>Cr(e[0]),(e,t,r,n)=>A(fr(va(e.cookies,t,r,n)),o=>B({...e,cookies:o}))),Hp=x(e=>Cr(e[0]),(e,t,r)=>A(fr(Ua(e.cookies,t,r)),n=>B({...e,cookies:n}))),Fp=x(e=>Cr(e[0]),(e,t,r,n)=>B({...e,cookies:$a(e.cookies,t,r,n)})),Np=x(e=>Cr(e[0]),(e,t,r)=>B({...e,cookies:Ha(e.cookies,t,r)})),Mp=x(2,(e,t)=>B({...e,cookies:t(e.cookies)})),Dp=x(2,(e,t)=>B({...e,cookies:Yn(e.cookies,t)})),Bp=x(2,(e,t)=>A(fr(Fa(e.cookies,t)),r=>B({...e,cookies:r}))),Lp=x(2,(e,t)=>B({...e,cookies:Na(e.cookies,t)})),gd=x(2,(e,t)=>B({...e,body:t},ho(e.headers,t))),jp=(e,t)=>{let r=Object.create(bd);return r.status=e.status,r.statusText=e.statusText,r.headers=e.headers,r.cookies=e.cookies,r.body=t,r},Vp=x(e=>Cr(e[0]),(e,t,r)=>B({...e,status:t,statusText:r??e.statusText})),xd=(e,t=!1)=>t||e.status===204||e.status===205||e.status===304,qp=(e,t)=>{let r=new globalThis.Headers(e.headers);if(!Gn(e.cookies)){let s=Da(e.cookies);for(let a of s)r.append(\"set-cookie\",a)}let n=e.body,o=xd(e),i=o||t?.withoutBody===!0;if(n._tag===\"Raw\"&&n.body instanceof Response){let s=n.body;for(let[c,u]of r)c===\"set-cookie\"?s.headers.append(c,u):s.headers.set(c,u);if(!i)return s;let a=o?e:s;return new Response(void 0,{status:a.status,statusText:a.statusText,headers:s.headers})}if(i)return n._tag===\"Raw\"&&Ed(n.body)&&n.body.cancel().catch(Oi),new Response(void 0,{status:e.status,statusText:e.statusText,headers:r});switch(n._tag){case\"Empty\":return new Response(void 0,{status:e.status,statusText:e.statusText,headers:r});case\"Uint8Array\":return new Response(n.text??n.body,{status:e.status,statusText:e.statusText,headers:r});case\"Raw\":return new Response(n.body,{status:e.status,statusText:e.statusText,headers:r});case\"FormData\":return new Response(n.formData,{status:e.status,statusText:e.statusText,headers:r});case\"Stream\":return new Response(Yr(n.stream,t?.context??Hn()),{status:e.status,statusText:e.statusText,headers:r})}},Jp=(e,t)=>new Bs(t?.request??Or,e),Bs=class extends $n{[Ke];[st];request;response;constructor(t,r){super(),this.request=t,this.response=r,this[Ke]=Ke,this[st]=st}toJSON(){return Eo(this,{_id:\"HttpClientResponse\",request:this.request.toJSON(),status:this.status})}get status(){return this.response.status}get url(){if(this.request===Or)return\"\";let t=un(this.request);return Un(t)?\"\":(t.value.hash=\"\",t.value.href)}cachedHeaders;get headers(){return this.cachedHeaders??=this.response.body._tag===\"FormData\"?Wt(this.response.headers,re(this.getFormDataResponse().headers)):this.response.headers}get cookies(){return this.response.cookies}get remoteAddress(){return he()}get stream(){let t=this.response.body;switch(t._tag){case\"Empty\":return ro;case\"Stream\":return fc(t.stream,r=>this.decodeError(r));case\"Uint8Array\":return Gr(t.body);case\"Raw\":{let r=t.body;return r instanceof Response?r.body?vt({evaluate:()=>r.body,onError:n=>this.decodeError(n)}):ro:Ed(r)?vt({evaluate:()=>r,onError:n=>this.decodeError(n)}):r instanceof Blob?vt({evaluate:()=>r.stream(),onError:n=>this.decodeError(n)}):ds(A(this.bytes,Gr))}case\"FormData\":{let r=this.getFormDataResponse();return vt({evaluate:()=>r.body,onError:n=>this.decodeError(n)})}}}get json(){return C(this.text,t=>_t({try:()=>t===\"\"?null:JSON.parse(t),catch:r=>new Z({reason:new Ae({request:this.request,response:this,cause:r})})}))}get bytes(){let t=this.response.body;switch(t._tag){case\"Empty\":return $(new Uint8Array(0));case\"Uint8Array\":return $(t.body);case\"Stream\":return hc(this.stream);case\"Raw\":{let r=t.body;return r instanceof Response?et({try:()=>r.clone().arrayBuffer().then(n=>new Uint8Array(n)),catch:n=>this.decodeError(n)}):et({try:()=>new Response(r).arrayBuffer().then(n=>new Uint8Array(n)),catch:n=>this.decodeError(n)})}case\"FormData\":return et({try:()=>new Response(t.formData).arrayBuffer().then(r=>new Uint8Array(r)),catch:r=>this.decodeError(r)})}}get text(){return A(this.bytes,t=>zp.decode(t))}get urlParamsBody(){return C(this.text,t=>_t({try:()=>nt(new URLSearchParams(t)),catch:r=>new Z({reason:new Ae({request:this.request,response:this,cause:r})})}))}get formData(){let t=this.response.body;return t._tag===\"FormData\"?$(t.formData):hr(r=>{let n=Yr(this.stream,r);return et({try:()=>new Response(n,{headers:this.headers}).formData(),catch:o=>this.decodeError(o)})})}get arrayBuffer(){return A(this.bytes,t=>t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength))}decodeError(t){return new Z({reason:new Ae({request:this.request,response:this,cause:t})})}formDataResponse;getFormDataResponse(){return this.formDataResponse??=new Response(this.response.body.formData)}pipe(){return lt(this,arguments)}},zp=new TextDecoder,Kp=e=>{let t=Fe(e.headers,\"set-cookie\");return B({status:e.status,headers:t,cookies:e.cookies,body:bt(uc(e.stream,Wp,()=>ro),te(Ba(t,\"content-type\")),on(t[\"content-length\"]))})},Ed=e=>typeof ReadableStream<\"u\"&&e instanceof ReadableStream,Wp=e=>Ft(e)&&e.reason._tag===\"EmptyBodyError\",bd={...Pi,[Ms]:Ms,[bc]:!0,toJSON(){return{_id:\"HttpServerResponse\",status:this.status,statusText:this.statusText,headers:sr(this.headers),cookies:this.cookies.toJSON(),body:this.body.toJSON()}}},B=(e,t)=>{let r=Object.create(bd);if(r.status=e.status,r.statusText=e.statusText,r.cookies=e.cookies??Kr,r.body=e.body??Ht,r.body._tag!==\"Empty\"&&(r.body.contentType||r.body.contentLength!==void 0)){let n=t!==void 0,o=n?t:e.headers===void 0||e.headers===Oe?cd():zt({...e.headers});r.body.contentType&&(!n||o[\"content-type\"]===void 0)&&(o[\"content-type\"]=r.body.contentType),r.body.contentLength!==void 0&&(!n||o[\"content-length\"]===void 0)&&(o[\"content-length\"]=r.body.contentLength.toString()),r.headers=o}else r.headers=t??e.headers??Oe;return r},Gp=e=>{let t=new globalThis.Headers(e.headers),r=t.getSetCookie();t.delete(\"set-cookie\");let n=md({status:e.status,statusText:e.statusText,headers:t,cookies:Wn(r)});if(e.body){let o=e.headers.get(\"content-type\");n=gd(n,bt(vt({evaluate:()=>e.body,onError:i=>i}),o??void 0,on(e.headers.get(\"content-length\"))))}return n};var Ls=\"executor.owner\",Sd=Y.Reference(\"@executor-js/telemetry/SpanOwner\",{defaultValue:()=>{}}),js=e=>Y.get(e,Sd),mn=(e,t={})=>({...t,annotations:Y.add(t.annotations??Y.empty(),Sd,e)}),Vs=(e,t,r)=>n=>n.pipe(f.withSpan(t,mn(e,r))),Yp=(e,t,r)=>n=>f.useSpan(e,t,o=>{let i=f.withParentSpan(n,o);if(o.status._tag===\"Ended\")return i;let{around:s,end:a}=r(o.status.startTime);return(s===void 0?i:s(i)).pipe(f.onExit(c=>f.flatMap(Vn.currentTimeNanos,u=>f.sync(()=>{a(u,o),o.end(u,c)}))))}),Xp=[\"executor\",\"person\",\"upstream\",\"lease\",\"app\"],wd=()=>({executor:0,app:0,upstream:0,person:0,lease:0,background:0}),Zp=(e,t)=>{let r=wd(),n=wd(),o=new WeakMap,i=e,s=!1,a=0,c=h=>{if(h<=i)return;let l=Xp.find(P=>n[P]>0)??t,g=Number(h-i)/1e6;r[l]+=g,a>0&&(r.background+=g),i=h},u=h=>{let l=h.parent;for(;l!==void 0&&!l.open;)l=l.parent;return h.parent=l,l},p=h=>{if(h.owner===\"background\"){a+=1;return}let l=u(h);l!==void 0&&l.children++===0&&(n[l.owner]-=1),n[h.owner]+=1},m=h=>{if(h.open=!1,h.owner===\"background\"){a-=1;return}h.children===0&&(n[h.owner]-=1);let l=u(h);l!==void 0&&(l.children+=h.children-1,l.children===0&&(n[l.owner]+=1))},S=h=>({...h,span:l=>{let g=h.span(l);if(s)return g;let P=v.getOrUndefined(l.parent),z=P===void 0?void 0:o.get(P),Ee=z?.owner===\"background\"?\"background\":js(l.annotations),H={owner:Ee??z?.owner??t,parent:Ee===\"background\"?void 0:z,open:!0,children:0};c(l.startTime),p(H);let _={_tag:\"Span\",get name(){return g.name},get spanId(){return g.spanId},get traceId(){return g.traceId},get parent(){return g.parent},get annotations(){return g.annotations},get status(){return g.status},get attributes(){return g.attributes},get links(){return g.links},get sampled(){return g.sampled},get kind(){return g.kind},end:(F,G)=>{H.open&&!s&&(c(F),m(H)),g.end(F,G)},attribute:(F,G)=>g.attribute(F,G),event:(F,G,W)=>g.event(F,G,W),addLinks:F=>g.addLinks(F)};return o.set(_,H),_}});return{observe:h=>f.gen(function*(){let l=yield*Se.Tracer;return yield*h.pipe(f.provideService(Se.Tracer,S(l)))}),read:h=>(s||c(h),s=!0,r)}};var Td=f.gen(function*(){let e=Y.make(Se.Tracer,yield*Se.Tracer).pipe(Y.add(Ut.CurrentLoggers,yield*Ut.CurrentLoggers),Y.add(fe.MetricRegistry,yield*fe.MetricRegistry)),t=yield*f.currentSpan.pipe(f.option);return v.isSome(t)&&(e=Y.add(e,Se.ParentSpan,t.value)),{context:e}}),Qp=f.currentSpan.pipe(f.map(Pr.toHeaders),f.orElseSucceed(()=>({}))),el=(e,t)=>r=>r.pipe(f.withSpan(t,{kind:\"server\",parent:v.getOrUndefined(Pr.fromHeaders(Ne.fromInput({traceparent:e.headers.get(\"traceparent\")??void 0})))})),tl=e=>f.gen(function*(){let{context:t}=yield*Td;return(r,n)=>f.runPromiseWith(t)(f.gen(function*(){let o=yield*f.try(()=>new Request(r,n)),s=yield*(yield*le.HttpClient).execute(Be.fromWeb(o)).pipe(f.withSpan(\"provider.http.request\",mn(\"upstream\",{attributes:{\"http.request.method\":o.method}})),f.provideService(it.RequestInit,{cache:o.cache,credentials:o.credentials,integrity:o.integrity,keepalive:o.keepalive,mode:o.mode,redirect:o.redirect,referrer:o.referrer,referrerPolicy:o.referrerPolicy}),f.provideService(it.Fetch,(p,m)=>globalThis.fetch(p,{...m,signal:AbortSignal.any([e,o.signal,...m?.signal?[m.signal]:[]])}))),a=_r.fromClientResponse(s),c=a.body,u=c instanceof wt.Stream?_r.setBody(a,wt.stream(c.stream.pipe($t.withSpan(\"provider.http.response.read\",mn(\"upstream\",{attributes:{\"http.response.status_code\":s.status}}))),c.contentType,c.contentLength)):a;return _r.toWeb(u,{withoutBody:o.method===\"HEAD\",context:t})}).pipe(f.provide(it.layer)),{signal:e})});var kd=\"5 seconds\",rl=d.String.check(d.makeFilter(e=>{let t=URL.parse(e);return t!==null&&[\"http:\",\"https:\"].includes(t.protocol)&&t.username===\"\"&&t.password===\"\"},{message:\"Expected an HTTP telemetry endpoint without URL credentials\"})),qs=d.Struct({url:rl,headers:d.optional(d.RedactedFromValue(d.Record(d.String,d.String)))}),_y=d.Struct({service:d.NonEmptyString,version:d.NonEmptyString,environment:d.NonEmptyString,clock:d.optional(d.Literals([\"system\",\"cloudflare-io\"])),traces:d.optional(qs),logs:d.optional(qs),metrics:d.optional(qs),metricsProtocol:d.optional(d.Literals([\"http/json\",\"http/protobuf\"]))}),Oo=Y.Reference(\"executor/TelemetryConfig\",{defaultValue:()=>{}});function Od(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error(\"invalid varint\")}var Io=4294967296;function Js(e){let t=e[0]===\"-\";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function i(s,a){let c=Number(e.slice(s,a));o*=r,n=n*r+c,n>=Io&&(o=o+(n/Io|0),n=n%Io)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?Pd(n,o):Ks(n,o)}function Id(e,t){let r=Ks(e,t),n=r.hi&2147483648;n&&(r=Pd(r.lo,r.hi));let o=zs(r.lo,r.hi);return n?\"-\"+o:o}function zs(e,t){if({lo:e,hi:t}=nl(e,t),t<=2097151)return String(Io*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,i=r+n*6777216+o*6710656,s=n+o*8147497,a=o*2,c=1e7;return i>=c&&(s+=Math.floor(i/c),i%=c),s>=c&&(a+=Math.floor(s/c),s%=c),a.toString()+Rd(s)+Rd(i)}function nl(e,t){return{lo:e>>>0,hi:t>>>0}}function Ks(e,t){return{lo:e|0,hi:t|0}}function Pd(e,t){return t=~t,e?e=~e+1:t+=1,Ks(e,t)}var Rd=e=>{let t=String(e);return\"0000000\".slice(t.length)+t};function Cd(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error(\"invalid varint\");return this.assertBounds(),t>>>0}var Ar=ol();function ol(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==\"function\"&&typeof e.getBigInt64==\"function\"&&typeof e.getBigUint64==\"function\"&&typeof e.setBigInt64==\"function\"&&typeof e.setBigUint64==\"function\"&&(!!globalThis.Deno||typeof process!=\"object\"||typeof process.env!=\"object\"||process.env.BUF_BIGINT_DISABLE!==\"1\")){let r=BigInt(\"-9223372036854775808\"),n=BigInt(\"9223372036854775807\"),o=BigInt(\"0\"),i=BigInt(\"18446744073709551615\");return{zero:BigInt(0),supported:!0,parse(s){let a=typeof s==\"bigint\"?s:BigInt(s);if(a>n||a<r)throw new Error(`invalid int64: ${s}`);return a},uParse(s){let a=typeof s==\"bigint\"?s:BigInt(s);if(a>i||a<o)throw new Error(`invalid uint64: ${s}`);return a},enc(s){return e.setBigInt64(0,this.parse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(s){return e.setBigInt64(0,this.uParse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigInt64(0,!0)},uDec(s,a){return e.setInt32(0,s,!0),e.setInt32(4,a,!0),e.getBigUint64(0,!0)}}}return{zero:\"0\",supported:!1,parse(r){return typeof r!=\"string\"&&(r=r.toString()),_d(r),r},uParse(r){return typeof r!=\"string\"&&(r=r.toString()),Ad(r),r},enc(r){return typeof r!=\"string\"&&(r=r.toString()),_d(r),Js(r)},uEnc(r){return typeof r!=\"string\"&&(r=r.toString()),Ad(r),Js(r)},dec(r,n){return Id(r,n)},uDec(r,n){return zs(r,n)}}}function _d(e){if(!/^-?[0-9]+$/.test(e))throw new Error(\"invalid int64: \"+e)}function Ad(e){if(!/^[0-9]+$/.test(e))throw new Error(\"invalid uint64: \"+e)}var Ws=Symbol.for(\"@bufbuild/protobuf/text-encoding\");function vd(){if(globalThis[Ws]==null){let e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[Ws]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return globalThis[Ws]}var Le;(function(e){e[e.Varint=0]=\"Varint\",e[e.Bit64=1]=\"Bit64\",e[e.LengthDelimited=2]=\"LengthDelimited\",e[e.StartGroup=3]=\"StartGroup\",e[e.EndGroup=4]=\"EndGroup\",e[e.Bit32=5]=\"Bit32\"})(Le||(Le={}));var yn=class{constructor(t,r=vd().decodeUtf8){this.decodeUtf8=r,this.varint64=Od,this.uint32=Cd,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),r=t>>>3,n=t&7;if(r<=0||n<0||n>5)throw new Error(\"illegal tag: field no \"+r+\" wire type \"+n);return[r,n]}skip(t,r){let n=this.pos;switch(t){case Le.Varint:for(;this.buf[this.pos++]&128;);break;case Le.Bit64:this.pos+=4;case Le.Bit32:this.pos+=4;break;case Le.LengthDelimited:let o=this.uint32();this.pos+=o;break;case Le.StartGroup:for(;;){let[i,s]=this.tag();if(s===Le.EndGroup){if(r!==void 0&&i!==r)throw new Error(\"invalid end group tag\");break}this.skip(s,i)}break;default:throw new Error(\"cant skip wire type \"+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError(\"premature EOF\")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Ar.dec(...this.varint64())}uint64(){return Ar.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Ar.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Ar.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Ar.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(){return this.decodeUtf8(this.bytes())}};var Gs=[1,5,10,25,50,100,250,500,1e3,2500,5e3,1e4,3e4],Vy=fe.histogram(\"executor.http.response_ready_ms\",{boundaries:Gs,attributes:{unit:\"ms\"},description:\"Handler entry to response headers in milliseconds; excludes streamed body lifetime.\"}),qy=fe.counter(\"executor.http.requests\",{incremental:!0}),sl=fe.counter(\"executor.telemetry.export_failures\",{incremental:!0}),il=fe.counter(\"executor.telemetry.rejected_records\",{incremental:!0}),Jy=fe.histogram(\"executor.worker.cpu_ms\",{boundaries:Gs,attributes:{unit:\"ms\"},description:\"Native Worker CPU time in milliseconds.\"}),zy=fe.histogram(\"executor.worker.wall_ms\",{boundaries:Gs,attributes:{unit:\"ms\"},description:\"Native Worker invocation wall time, including stream and cleanup lifetime, in milliseconds.\"});var Zt=(e,t,r=0)=>{let n=e.endsWith(\"/traces\")?\"traces\":e.endsWith(\"/logs\")?\"logs\":e.endsWith(\"/metrics\")?\"metrics\":e===\"app\"?\"app\":\"other\";return fe.update(fe.withAttributes(sl,{signal:n,reason:t}),1).pipe(f.andThen(fe.update(fe.withAttributes(il,{signal:n,reason:t}),r)),f.andThen(f.logWarning(\"Telemetry export failed\").pipe(f.annotateLogs({\"executor.telemetry.signal\":n,\"executor.telemetry.failure\":t,\"executor.telemetry.rejected_records\":r}))))};var al=Y.Reference(\"executor/TelemetryClient\",{defaultValue:()=>{}}),cl=N.unwrap(al.pipe(f.map(e=>e===void 0?N.fresh(it.layer):N.succeed(le.HttpClient,e)))),Ys=d.Union([d.Number,d.NumberFromString]).check(d.isInt(),d.isGreaterThanOrEqualTo(0),d.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER)),dl=d.Struct({partialSuccess:d.optional(d.Struct({rejectedSpans:d.optional(Ys),rejectedLogRecords:d.optional(Ys),rejectedDataPoints:d.optional(Ys),errorMessage:d.optional(d.String)}))}),ul=e=>{let t=new yn(e),r=\"0\",n=\"\";for(;t.pos<t.len;){let[o,i]=t.tag();if(o!==1||i!==Le.LengthDelimited){t.skip(i,o);continue}let s=new yn(t.bytes());for(;s.pos<s.len;){let[a,c]=s.tag();a===1&&c===Le.Varint?r=String(s.int64()):a===2&&c===Le.LengthDelimited?n=s.string():s.skip(c,a)}}return{partialSuccess:{rejectedDataPoints:r,errorMessage:n}}},fl=e=>f.gen(function*(){let t=new Uint8Array(yield*e.arrayBuffer),r=yield*f.try({try:()=>t.byteLength===0?{}:e.headers[\"content-type\"]?.includes(\"application/x-protobuf\")?ul(t):JSON.parse(new TextDecoder().decode(t)),catch:()=>new ae.HttpClientError({reason:new ae.DecodeError({request:e.request,response:e,description:\"Invalid OTLP acknowledgement\"})})}),o=(yield*d.decodeUnknownEffect(dl)(r).pipe(f.mapError(()=>new ae.HttpClientError({reason:new ae.DecodeError({request:e.request,response:e,description:\"Invalid OTLP acknowledgement\"})})))).partialSuccess;if(o===void 0)return;let i=(o.rejectedSpans??0)+(o.rejectedLogRecords??0)+(o.rejectedDataPoints??0);(i>0||o.errorMessage)&&(yield*Zt(new URL(e.request.url).pathname,\"partial-success\",i))}),Po=N.effect(le.HttpClient,le.HttpClient.pipe(f.map(e=>e.pipe(le.filterStatusOk,le.transform((t,r)=>t.pipe(f.tap(fl),f.timeout(kd),f.catchTag(\"TimeoutError\",()=>f.fail(new ae.HttpClientError({reason:new ae.TransportError({request:r,description:\"Telemetry collector acknowledgement timed out\"})}))),f.tapError(n=>Zt(new URL(r.url).pathname,ae.isHttpClientError(n)&&n.reason instanceof ae.DecodeError?\"acknowledgement\":\"transport\").pipe(f.annotateLogs({\"executor.telemetry.http_status\":n.response?.status??0,\"executor.telemetry.timed_out\":n.reason instanceof ae.TransportError&&n.reason.description===\"Telemetry collector acknowledgement timed out\"}))),f.onInterrupt(()=>Zt(new URL(r.url).pathname,\"interrupted\")))),le.withScope,le.transformResponse(f.scoped))))).pipe(N.provide(cl)),pl=e=>f.gen(function*(){if(!ae.isHttpClientError(e)||e.reason._tag!==\"StatusCodeError\"||e.reason.response.status!==429&&e.reason.response.status!==503)return ze.seconds(1);let t=e.reason.response.headers[\"retry-after\"]?.trim();if(t===void 0||t===\"\")return ze.seconds(e.reason.response.status===429?5:1);let r=Number(t);if(Number.isFinite(r))return ze.seconds(r>=0?r:5);let n=Date.parse(t);return Number.isNaN(n)?ze.seconds(5):ze.millis(Math.max(n-(yield*Vn.currentTimeMillis),1))}),$d=e=>e.pipe(le.retryTransient({times:3,schedule:dr.forever.pipe(dr.passthrough,dr.addDelay(({output:t})=>pl(t)))}));var ll=e=>qr.hasProperty(e,\"_tag\")&&qr.isString(e._tag)?e._tag:void 0,Ud=(e,t)=>{let r=new Error(t);return r.name=e,r.stack=t===\"\"?e:`${e}: ${t}`,r},Xs=e=>{let t=ll(e);if(t!==void 0)return Ud(t,Ac(e)??\"\");if(!(e instanceof Error))return Ud(\"UnrecognizedFailure\",\"\");if(e.cause===void 0)return e;let r=new Error(e.message,{cause:Xs(e.cause)});return r.name=e.name,e.stack!==void 0&&(r.stack=e.stack),r},Hd=e=>Ce.fromReasons(e.reasons.flatMap(t=>{if(Ce.isInterruptReason(t))return[t];let r=Ce.isFailReason(t)?Ce.fail(Xs(t.error)):Ce.die(Xs(t.defect));return Ce.annotate(r,Ce.reasonAnnotations(t)).reasons}));var Zs=class extends d.TaggedError()(\"LogicalOperationFailed\",{}){},ml=[\"http.\",\"url.\",\"server.\",\"client.\",\"user_agent.\"],hl=new Set([\"http.request.method\",\"http.response.status_code\",\"server.address\",\"url.scheme\",\"url.path\",\"http.route\",\"http.request.header.content-type\",\"http.request.header.content-length\",\"http.request.header.user-agent\",\"http.response.header.content-type\",\"http.response.header.content-length\",\"user_agent.original\"]),Fd=e=>{let t=e.toLowerCase();return!ml.some(r=>t.startsWith(r))||hl.has(t)},yl=e=>Object.fromEntries(Object.entries(e).filter(([t])=>Fd(t)));var gl=e=>{let t=!1,r;return{_tag:\"Span\",get name(){return e.name},get spanId(){return e.spanId},get traceId(){return e.traceId},get parent(){return e.parent},get annotations(){return e.annotations},get status(){return e.status},get attributes(){return e.attributes},get links(){return e.links},get sampled(){return e.sampled},get kind(){return e.kind},end:(n,o)=>e.end(n,Jt.isSuccess(o)?e.attributes.get(\"executor.outcome\")===\"failed\"?Jt.fail(new Zs):o:Jt.failCause(Hd(o.cause))),attribute:(n,o)=>{if(Fd(n)){if(n===\"url.path\"&&typeof o==\"string\"){t=!0,e.attribute(n,r??o);return}n===\"http.route\"&&typeof o==\"string\"&&(r=o,t&&e.attribute(\"url.path\",o)),e.attribute(n,o)}},event:(n,o,i)=>e.event(n,o,i===void 0?void 0:yl(i)),addLinks:n=>e.addLinks(n)}},Qs=(e,t=!1)=>N.effect(Se.Tracer)(Se.Tracer.pipe(f.map(r=>({...r,span:n=>{let o=gl(r.span(t?{...n,sampled:!0}:n));t&&v.isSome(n.parent)&&n.parent.value._tag===\"ExternalSpan\"&&o.attribute(\"executor.trace.parent_sampled\",n.parent.value.sampled),e!==void 0&&o.attribute(\"executor.clock.type\",e);let i=js(n.annotations);return i!==void 0&&o.attribute(Ls,i),o}})))),ig=Qs();var Uo={};qe(Uo,{layer:()=>Vd,layerFromConfig:()=>Yl,make:()=>jd});var xl=e=>Ec(gr,e).pipe(Gt(t=>t.map(r=>r.toLowerCase().trim()).filter(r=>r!==\"\"))),Nd=e=>no(gr,Wr,e),vr=e=>Nd(`OTEL_EXPORTER_OTLP_${e}_HEADERS`).pipe(fs(()=>Nd(\"OTEL_EXPORTER_OTLP_HEADERS\")),Me(void 0)),$r=e=>ls(`OTEL_EXPORTER_OTLP_${e}_ENDPOINT`).pipe(fs(()=>ls(\"OTEL_EXPORTER_OTLP_ENDPOINT\").pipe(Gt(t=>{let r=t.pathname.endsWith(\"/\")?\"\":\"/\";return t.pathname+=`${r}v1/${e.toLowerCase()}`,t}))),Me(void 0)),Ur=e=>xl(`OTEL_${e}_EXPORTER`).pipe(Me([]));var El=e=>{let t=Ai(e).pipe(vi(Xi));if(Ze(t))return $(se(t.value));if(e===void 0)return $(se(5));let r=Date.parse(e);return Number.isNaN(r)?$(se(5)):A(mt,n=>X(Math.max(r-n.currentTimeMillisUnsafe(),1)))},bl=ea.pipe(qn,Qi(({output:e})=>Ft(e)&&e.reason._tag===\"StatusCodeError\"&&e.reason.response.status===429?El(e.reason.response.headers[\"retry-after\"]):$(se(1)))),Co=class extends Qe()(\"effect/observability/OtlpExporter/Flusher\"){},Tt=Gi(Co,()=>{let e=new Set;return{flush:ht(()=>e.size===0?_e:zn(e,Vr,{concurrency:\"unbounded\",discard:!0})),register:t=>C(Yo,r=>(e.add(t),Xo(r,tt(()=>e.delete(t)))))}}),Hr=He(function*(e){let t=yield*mr(),r=Fn(t,mt),n=Fn(t,Yo),o=qt(Dn(e.exportInterval),Mi),i,s=Fn(t,pn).pipe(Hs(l=>Kn(l.arrayBuffer)),Fs(l=>l.response?Kn(l.response.arrayBuffer):_e),vs,Te(ga(ko,!1)),Us({schedule:bl,times:3})),a=zt({\"user-agent\":`effect-opentelemetry-${e.label}/0.0.0`});e.headers&&(a=Wt(re(e.headers),a));let c=ks(e.url,{headers:a}),u=[],p=ht(()=>{if(i!==void 0&&r.currentTimeMillisUnsafe()<i)return _e;if(i!==void 0&&(i=void 0),u.length===0&&(e.maxBatchSize!==\"disabled\"||e.exportEmpty!==!0))return _e;let l=u;u=[];let[g,P]=e.body(l);return s.execute(ye(c,g)).pipe(zr(P),oa,Ta(!1))}).pipe(ca(l=>i!==void 0?_e:(i=r.currentTimeMillisUnsafe()+6e4,u=[],Ia(\"Disabling exporter for 60 seconds\",l))),Pa({package:\"@effect/opentelemetry\",module:e.label})),m=yield*wc(),S=yield*Tc(m)();return yield*(yield*Co).register(p),yield*Xo(n,ht(()=>i!==void 0?_e:(S(p),kc(m))).pipe(Kn,Ea,fa(e.shutdownTimeout))),yield*lr(o).pipe(zr(Sc(m,p)),C(ec),wa,Oa(n)),{push(l){i===void 0&&(u.push(l),e.maxBatchSize!==\"disabled\"&&u.length>=e.maxBatchSize&&S(p))}}});var wl=e=>{let t=e.attributes?kt(Object.entries(e.attributes)):[];return t.push({key:\"service.name\",value:{stringValue:e.serviceName}}),e.serviceVersion&&t.push({key:\"service.version\",value:{stringValue:e.serviceVersion}}),{attributes:t,droppedAttributesCount:0}},Fr=He(function*(e){let t=yield*no(Wr,Wr,\"OTEL_RESOURCE_ATTRIBUTES\").pipe(Me(void 0)),r=e?.serviceName??e?.attributes?.[\"service.name\"]??(yield*ps(as(gr),\"OTEL_SERVICE_NAME\"))??t?.[\"service.name\"]??(yield*gc(\"OTEL_SERVICE_NAME\")),n=e?.serviceVersion??e?.attributes?.[\"service.version\"]??(yield*ps(as(gr),\"OTEL_SERVICE_VERSION\"))??t?.[\"service.version\"],o={...t,...e?.attributes};return delete o[\"service.name\"],delete o[\"service.version\"],wl({serviceName:r,serviceVersion:n,attributes:o})},At),Nr=e=>{let t=e.attributes.find(r=>r.key===\"service.name\");if(!t||!t.value.stringValue)throw new Error(\"Resource does not contain a service name\");return t.value.stringValue},kt=e=>{let t=[];for(let[r,n]of e)t.push({key:r,value:Ao(n)});return t},Ao=e=>{if(Array.isArray(e))return{arrayValue:{values:e.map(Ao)}};switch(typeof e){case\"string\":return{stringValue:e};case\"bigint\":return{intValue:String(e)};case\"number\":return Number.isInteger(e)?{intValue:e}:{doubleValue:e};case\"boolean\":return{boolValue:e};default:return{stringValue:An(e)}}};var tr={};qe(tr,{OtlpSerialization:()=>Ge,layerJson:()=>Kl,layerProtobuf:()=>Wl});var gn={Varint:0,Fixed64:1,LengthDelimited:2,Fixed32:5},xn=(e,t)=>e<<3|t,Qt=e=>{let t=[],r=typeof e==\"bigint\"?e:BigInt(e);for(r<BigInt(0)&&(r=BigInt.asUintN(64,r));r>BigInt(127);)t.push(Number(r&BigInt(127))|128),r>>=BigInt(7);return t.push(Number(r)),new Uint8Array(t)},Sl=e=>{let t=new Uint8Array(8);return new DataView(t.buffer).setBigUint64(0,e,!0),t},Tl=e=>{let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),t},kl=e=>{let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),t},Rl=e=>new TextEncoder().encode(e),Ol=e=>{let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=parseInt(e.slice(r,r+2),16);return t},M=(...e)=>{let t=e.reduce((o,i)=>o+i.length,0),r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r},de=(e,t)=>M(Qt(xn(e,gn.Varint)),Qt(t)),ti=(e,t)=>de(e,t?1:0),ve=(e,t)=>M(Qt(xn(e,gn.Fixed64)),Sl(t)),$o=(e,t)=>M(Qt(xn(e,gn.Fixed32)),Tl(t)),er=(e,t)=>M(Qt(xn(e,gn.Fixed64)),kl(t)),En=(e,t)=>M(Qt(xn(e,gn.LengthDelimited)),Qt(t.length),t),Nt=(e,t)=>En(e,Rl(t)),Mt=(e,t)=>En(e,Ol(t)),ge=(e,t)=>En(e,t),J=(e,t,r)=>M(...t.map(n=>ge(e,r(n)))),Ie=(e,t)=>t!==void 0&&t!==\"\"?Nt(e,t):new Uint8Array(0);var ri=e=>e.stringValue!==void 0&&e.stringValue!==null?Nt(1,e.stringValue):e.boolValue!==void 0&&e.boolValue!==null?ti(2,e.boolValue):e.intValue!==void 0&&e.intValue!==null?de(3,BigInt(e.intValue)):e.doubleValue!==void 0&&e.doubleValue!==null?er(4,e.doubleValue):e.arrayValue!==void 0?ge(5,Pl(e.arrayValue)):e.kvlistValue!==void 0?ge(6,Cl(e.kvlistValue)):e.bytesValue!==void 0?En(7,e.bytesValue):new Uint8Array(0),Pl=e=>J(1,e.values,ri),Cl=e=>J(1,e.values,Rt),Rt=e=>M(Nt(1,e.key),ge(2,ri(e.value))),ni=e=>M(Nt(1,e.name),Ie(2,e.version),e.attributes?J(3,e.attributes,Rt):new Uint8Array(0),e.droppedAttributesCount?de(4,e.droppedAttributesCount):new Uint8Array(0)),oi=e=>M(J(1,e.attributes,Rt),e.droppedAttributesCount>0?de(2,e.droppedAttributesCount):new Uint8Array(0)),_l=e=>M(Ie(2,e.message),de(3,e.code)),Al=e=>M(ve(1,BigInt(e.timeUnixNano)),Nt(2,e.name),J(3,e.attributes,Rt),e.droppedAttributesCount>0?de(4,e.droppedAttributesCount):new Uint8Array(0)),vl=e=>M(Mt(1,e.traceId),Mt(2,e.spanId),Ie(3,e.traceState),J(4,e.attributes,Rt),e.droppedAttributesCount>0?de(5,e.droppedAttributesCount):new Uint8Array(0),e.flags!==void 0?$o(6,e.flags):new Uint8Array(0)),$l=e=>M(Mt(1,e.traceId),Mt(2,e.spanId),Ie(3,e.traceState),e.parentSpanId!==void 0?Mt(4,e.parentSpanId):new Uint8Array(0),Nt(5,e.name),de(6,e.kind),ve(7,BigInt(e.startTimeUnixNano)),ve(8,BigInt(e.endTimeUnixNano)),J(9,e.attributes,Rt),e.droppedAttributesCount>0?de(10,e.droppedAttributesCount):new Uint8Array(0),J(11,e.events,Al),e.droppedEventsCount>0?de(12,e.droppedEventsCount):new Uint8Array(0),J(13,e.links,vl),e.droppedLinksCount>0?de(14,e.droppedLinksCount):new Uint8Array(0),ge(15,_l(e.status)),e.flags!==void 0?$o(16,e.flags):new Uint8Array(0)),Ul=e=>M(ge(1,ni(e.scope)),J(2,e.spans,$l),Ie(3,e.schemaUrl)),Hl=e=>M(ge(1,oi(e.resource)),J(2,e.scopeSpans,Ul),Ie(3,e.schemaUrl)),Md=e=>J(1,e.resourceSpans,Hl),Dd=e=>M(ve(2,BigInt(e.startTimeUnixNano)),ve(3,BigInt(e.timeUnixNano)),e.asDouble!==void 0?er(4,e.asDouble):new Uint8Array(0),e.asInt!==void 0?ve(6,BigInt(e.asInt)):new Uint8Array(0),J(7,e.attributes,Rt),e.flags!==void 0?de(8,e.flags):new Uint8Array(0)),Fl=e=>{let t=M(...e.bucketCounts.map(n=>ve(6,BigInt(n)))),r=M(...e.explicitBounds.map(n=>er(7,n)));return M(ve(2,BigInt(e.startTimeUnixNano)),ve(3,BigInt(e.timeUnixNano)),ve(4,BigInt(e.count)),e.sum!==void 0?er(5,e.sum):new Uint8Array(0),t,r,J(9,e.attributes,Rt),e.flags!==void 0?de(10,e.flags):new Uint8Array(0),e.min!==void 0?er(11,e.min):new Uint8Array(0),e.max!==void 0?er(12,e.max):new Uint8Array(0))},Nl=e=>J(1,e.dataPoints,Dd),Ml=e=>M(J(1,e.dataPoints,Dd),de(2,e.aggregationTemporality),ti(3,e.isMonotonic)),Dl=e=>M(J(1,e.dataPoints,Fl),de(2,e.aggregationTemporality)),Bl=e=>M(Nt(1,e.name),Ie(2,e.description),Ie(3,e.unit),e.gauge!==void 0?ge(5,Nl(e.gauge)):new Uint8Array(0),e.sum!==void 0?ge(7,Ml(e.sum)):new Uint8Array(0),e.histogram!==void 0?ge(9,Dl(e.histogram)):new Uint8Array(0)),Ll=e=>M(ge(1,ni(e.scope)),J(2,e.metrics,Bl),Ie(3,e.schemaUrl)),jl=e=>M(ge(1,oi(e.resource)),J(2,e.scopeMetrics,Ll),Ie(3,e.schemaUrl)),Bd=e=>J(1,e.resourceMetrics,jl),Vl=e=>M(ve(1,BigInt(e.timeUnixNano)),e.severityNumber!==void 0?de(2,e.severityNumber):new Uint8Array(0),Ie(3,e.severityText),e.body!==void 0?ge(5,ri(e.body)):new Uint8Array(0),J(6,e.attributes,Rt),e.droppedAttributesCount!==void 0&&e.droppedAttributesCount>0?de(7,e.droppedAttributesCount):new Uint8Array(0),e.flags!==void 0?$o(8,e.flags):new Uint8Array(0),e.traceId!==void 0&&e.traceId!==\"\"?Mt(9,e.traceId):new Uint8Array(0),e.spanId!==void 0&&e.spanId!==\"\"?Mt(10,e.spanId):new Uint8Array(0),e.observedTimeUnixNano!==void 0?ve(11,BigInt(e.observedTimeUnixNano)):new Uint8Array(0)),ql=e=>M(ge(1,ni(e.scope)),J(2,e.logRecords,Vl),Ie(3,e.schemaUrl)),Jl=e=>M(ge(1,oi(e.resource)),J(2,e.scopeLogs,ql),Ie(3,e.schemaUrl)),Ld=e=>J(1,e.resourceLogs,Jl);var Ge=class extends Qe()(\"effect/observability/OtlpSerialization\"){},Kl=Zo(Ge,{traces:e=>Et(e),metrics:e=>Et(e),logs:e=>Et(e)}),Wl=Zo(Ge,{traces:e=>gt(Md(e),\"application/x-protobuf\"),metrics:e=>gt(Bd(e),\"application/x-protobuf\"),logs:e=>gt(Ld(e),\"application/x-protobuf\")});var jd=He(function*(e){let t=yield*Ge,r=yield*Fr(e.resource),n={name:Nr(r)},o=yield*Hr({label:\"OtlpLogger\",url:e.url,headers:e.headers,maxBatchSize:e.maxBatchSize??1e3,exportInterval:e.exportInterval??se(1),body:s=>[t.logs({resourceLogs:[{resource:r,scopeLogs:[{scope:n,logRecords:s}]}]}),_e],shutdownTimeout:e.shutdownTimeout??se(3)}),i={excludeLogSpans:e.excludeLogSpans??!1,clock:yield*mt};return Rc(s=>{o.push(Xl(s,i))})}),Vd=e=>Oc([jd(e)],{mergeWithExisting:e.mergeWithExisting??!0}).pipe(cr(Tt)),Yl=e=>ur(function*(){let{disabled:t,endpoint:r,exporters:n}=yield*yt({disabled:xr(\"OTEL_SDK_DISABLED\").pipe(Me(!1)),endpoint:$r(\"LOGS\"),exporters:Ur(\"LOGS\")});if(t||!r||!n.includes(\"otlp\"))return Tt;let{baseTimeout:o,logsTimeout:i,exportTimeout:s,scheduleDelay:a,maxBatchSize:c}=yield*yt({baseTimeout:ie(pe(\"OTEL_EXPORTER_OTLP_TIMEOUT\")),logsTimeout:ie(pe(\"OTEL_EXPORTER_OTLP_LOGS_TIMEOUT\")),exportTimeout:ie(pe(\"OTEL_BLRP_EXPORT_TIMEOUT\")),scheduleDelay:ie(pe(\"OTEL_BLRP_SCHEDULE_DELAY\")),maxBatchSize:ie(pe(\"OTEL_BLRP_MAX_EXPORT_BATCH_SIZE\"))}),u=ir([i,o,s]).pipe(jt(m=>X(m))),p=jt(a,m=>X(m));return Vd({url:r.toString(),resource:e?.resource,headers:e?.headers??(yield*vr(\"LOGS\")),exportInterval:te(p),maxBatchSize:te(c),shutdownTimeout:te(u),excludeLogSpans:e?.excludeLogSpans,mergeWithExisting:e?.mergeWithExisting})}).pipe(At,ar),Xl=(e,t)=>{let n=t.clock.currentTimeNanosUnsafe().toString(),o=e.date.getTime(),i=kt(Object.entries(e.fiber.getRef(Ki)));if(i.push({key:\"fiberId\",value:{intValue:e.fiber.id}}),!t.excludeLogSpans)for(let[c,u]of e.fiber.getRef(Wi))i.push({key:`logSpan.${c}`,value:{stringValue:`${o-u}ms`}});e.cause.reasons.length>0&&i.push({key:\"log.error\",value:{stringValue:qi(e.cause)}});let s=Ni(e.message),a={severityNumber:Zl(e.logLevel),severityText:e.logLevel,timeUnixNano:n,observedTimeUnixNano:n,attributes:i,body:Ao(s.length===1?s[0]:s),droppedAttributesCount:0};return e.fiber.cache.span&&(a.traceId=e.fiber.cache.span.traceId,a.spanId=e.fiber.cache.span.spanId),a},Zl=e=>{switch(e){case\"Trace\":return rr.SEVERITY_NUMBER_TRACE;case\"Debug\":return rr.SEVERITY_NUMBER_DEBUG;case\"Info\":return rr.SEVERITY_NUMBER_INFO;case\"Warn\":return rr.SEVERITY_NUMBER_WARN;case\"Error\":return rr.SEVERITY_NUMBER_ERROR;case\"Fatal\":return rr.SEVERITY_NUMBER_FATAL;default:return rr.SEVERITY_NUMBER_UNSPECIFIED}},rr={SEVERITY_NUMBER_UNSPECIFIED:0,SEVERITY_NUMBER_TRACE:1,SEVERITY_NUMBER_TRACE2:2,SEVERITY_NUMBER_TRACE3:3,SEVERITY_NUMBER_TRACE4:4,SEVERITY_NUMBER_DEBUG:5,SEVERITY_NUMBER_DEBUG2:6,SEVERITY_NUMBER_DEBUG3:7,SEVERITY_NUMBER_DEBUG4:8,SEVERITY_NUMBER_INFO:9,SEVERITY_NUMBER_INFO2:10,SEVERITY_NUMBER_INFO3:11,SEVERITY_NUMBER_INFO4:12,SEVERITY_NUMBER_WARN:13,SEVERITY_NUMBER_WARN2:14,SEVERITY_NUMBER_WARN3:15,SEVERITY_NUMBER_WARN4:16,SEVERITY_NUMBER_ERROR:17,SEVERITY_NUMBER_ERROR2:18,SEVERITY_NUMBER_ERROR3:19,SEVERITY_NUMBER_ERROR4:20,SEVERITY_NUMBER_FATAL:21,SEVERITY_NUMBER_FATAL2:22,SEVERITY_NUMBER_FATAL3:23,SEVERITY_NUMBER_FATAL4:24};var Ho={};qe(Ho,{layer:()=>zd,layerFromConfig:()=>Ql,make:()=>Jd});var Jd=He(function*(e){let t=yield*mt,r=yield*Ge,n=yield*t.currentTimeNanos,o=String(n),i=e.temporality??\"cumulative\",s=yield*Fr(e.resource),a={name:Nr(s)},c=yield*mr(),u=n,p=new Map,m=new Map,S=new Map,h=new Map,l=0,g=-1,P=()=>{let z=ta(c),xe=l++,Ee=t.currentTimeNanosUnsafe(),H=String(Ee),_=new Map(p),F=new Map(m),G=new Map(S),W=new Map(h),ne=[],K=new Map,L=je=>{ne.push(je),K.set(je.name,je)},ke=i===\"delta\",oe=ke?qd.AGGREGATION_TEMPORALITY_DELTA:qd.AGGREGATION_TEMPORALITY_CUMULATIVE,me=ke?String(u):o;for(let je=0,jr=z.length;je<jr;je++){let b=z[je],dt=b.attributes?.unit??b.attributes?.time_unit??\"1\",be=b.attributes?kt(Object.entries(b.attributes)):[],Ve=em(b.id,b.attributes);switch(b.type){case\"Counter\":{let D=b.state.count,q=D;if(ke){let ee=p.get(Ve);if(ee!==void 0)if(typeof D==\"bigint\"&&typeof ee==\"bigint\")q=D-ee,b.state.incremental&&q<BigInt(0)&&(q=D);else{let we=Number(D),ue=Number(ee);q=we-ue,b.state.incremental&&q<0&&(q=we)}_.set(Ve,D)}let j={attributes:be,startTimeUnixNano:me,timeUnixNano:H};typeof q==\"bigint\"?j.asInt=Number(q):j.asDouble=q,K.has(b.id)?K.get(b.id).sum.dataPoints.push(j):L({name:b.id,description:b.description,unit:dt,sum:{aggregationTemporality:oe,isMonotonic:b.state.incremental,dataPoints:[j]}});break}case\"Gauge\":{let D={attributes:be,startTimeUnixNano:o,timeUnixNano:H};typeof b.state.value==\"bigint\"?D.asInt=Number(b.state.value):D.asDouble=b.state.value,K.has(b.id)?K.get(b.id).gauge.dataPoints.push(D):L({name:b.id,description:b.description,unit:dt,gauge:{dataPoints:[D]}});break}case\"Histogram\":{let D=b.state.buckets.length,q={boundaries:zo(D-1),counts:zo(D)},j=0,ee=0;for(let[$e,pt]of b.state.buckets)j<D-1&&(q.boundaries[j]=$e),q.counts[j]=pt-ee,ee=pt,j++;let we=b.state.count,ue=b.state.sum,Pt=q.counts,ut=b.state.min,ft=b.state.max;if(ke){let $e=m.get(Ve);$e!==void 0&&(we=b.state.count-$e.count,ue=b.state.sum-$e.sum,Pt=q.counts.map((pt,or)=>Math.max(0,pt-($e.bucketCounts[or]??0)))),F.set(Ve,{count:b.state.count,sum:b.state.sum,bucketCounts:q.counts.slice(),min:b.state.min,max:b.state.max})}let Ct={attributes:be,startTimeUnixNano:me,timeUnixNano:H,count:we,min:ut,max:ft,sum:ue,bucketCounts:Pt,explicitBounds:q.boundaries};K.has(b.id)?K.get(b.id).histogram.dataPoints.push(Ct):L({name:b.id,description:b.description,unit:dt,histogram:{aggregationTemporality:oe,dataPoints:[Ct]}});break}case\"Frequency\":{let D=[],q=new Map;for(let[j,ee]of b.state.occurrences){q.set(j,ee);let we=ee;if(ke){let ue=S.get(Ve);if(ue!==void 0){let Pt=ue.get(j)??0;we=Math.max(0,ee-Pt)}}D.push({attributes:[...be,{key:\"key\",value:{stringValue:j}}],startTimeUnixNano:me,timeUnixNano:H,asInt:we})}ke&&G.set(Ve,q),K.has(b.id)?K.get(b.id).sum.dataPoints.push(...D):L({name:b.id,description:b.description,unit:dt,sum:{aggregationTemporality:oe,isMonotonic:!0,dataPoints:D}});break}case\"Summary\":{let D=[{attributes:[...be,{key:\"quantile\",value:{stringValue:\"min\"}}],startTimeUnixNano:me,timeUnixNano:H,asDouble:b.state.min}];for(let[ue,Pt]of b.state.quantiles)D.push({attributes:[...be,{key:\"quantile\",value:{stringValue:ue.toString()}}],startTimeUnixNano:me,timeUnixNano:H,asDouble:Pt??0});D.push({attributes:[...be,{key:\"quantile\",value:{stringValue:\"max\"}}],startTimeUnixNano:me,timeUnixNano:H,asDouble:b.state.max});let q=b.state.count,j=b.state.sum;if(ke){let ue=h.get(Ve);ue!==void 0&&(q=b.state.count-ue.count,j=b.state.sum-ue.sum),W.set(Ve,{count:b.state.count,sum:b.state.sum})}let ee={attributes:be,startTimeUnixNano:me,timeUnixNano:H,asInt:q},we={attributes:be,startTimeUnixNano:me,timeUnixNano:H,asDouble:j};K.has(`${b.id}_quantiles`)?(K.get(`${b.id}_quantiles`).sum.dataPoints.push(...D),K.get(`${b.id}_count`).sum.dataPoints.push(ee),K.get(`${b.id}_sum`).sum.dataPoints.push(we)):(L({name:`${b.id}_quantiles`,description:b.description,unit:dt,sum:{aggregationTemporality:oe,isMonotonic:!1,dataPoints:D}}),L({name:`${b.id}_count`,description:b.description,unit:\"1\",sum:{aggregationTemporality:oe,isMonotonic:!0,dataPoints:[ee]}}),L({name:`${b.id}_sum`,description:b.description,unit:\"1\",sum:{aggregationTemporality:oe,isMonotonic:!0,dataPoints:[we]}}));break}}}let Lr=r.metrics({resourceMetrics:[{resource:s,scopeMetrics:[{scope:a,metrics:ne}]}]}),On=ke?tt(()=>{xe<g||(p=_,m=F,S=G,h=W,u=Ee,g=xe)}):_e;return[Lr,On]};yield*Hr({label:\"OtlpMetrics\",url:e.url,headers:e.headers,maxBatchSize:\"disabled\",exportEmpty:!0,exportInterval:e.exportInterval??se(10),body:P,shutdownTimeout:e.shutdownTimeout??se(3)})}),zd=e=>Yi(Jd(e)).pipe(cr(Tt)),Ql=e=>ur(function*(){let{disabled:t,endpoint:r,exporters:n}=yield*yt({disabled:xr(\"OTEL_SDK_DISABLED\").pipe(Me(!1)),endpoint:$r(\"METRICS\"),exporters:Ur(\"METRICS\")});if(t||!r||!n.includes(\"otlp\"))return Tt;let{baseTimeout:o,metricsTimeout:i,exportTimeout:s,exportInterval:a,temporalityPreference:c}=yield*yt({baseTimeout:ie(pe(\"OTEL_EXPORTER_OTLP_TIMEOUT\")),metricsTimeout:ie(pe(\"OTEL_EXPORTER_OTLP_METRICS_TIMEOUT\")),exportTimeout:ie(pe(\"OTEL_METRIC_EXPORT_TIMEOUT\")),exportInterval:ie(pe(\"OTEL_METRIC_EXPORT_INTERVAL\").pipe(Gt(X))),temporalityPreference:ie(xc([\"delta\",\"cumulative\"],\"OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE\"))}),u=ir([i,o,s]).pipe(jt(p=>X(p)));return zd({url:r.toString(),resource:e?.resource,headers:e?.headers??(yield*vr(\"METRICS\")),exportInterval:te(a),shutdownTimeout:te(u),temporality:te(c)})}).pipe(At,ar),em=(e,t)=>{if(t===void 0||Object.keys(t).length===0)return e;let r=Object.entries(t).sort((n,o)=>n[0].localeCompare(o[0]));return`${e}:${JSON.stringify(r)}`},qd={AGGREGATION_TEMPORALITY_UNSPECIFIED:0,AGGREGATION_TEMPORALITY_DELTA:1,AGGREGATION_TEMPORALITY_CUMULATIVE:2};var Fo={};qe(Fo,{layer:()=>Wd,layerFromConfig:()=>tm,make:()=>Kd});var Kd=He(function*(e){let t=yield*Fr(e.resource),r=yield*Ge,n={name:Nr(t)},o=yield*Hr({label:\"OtlpTracer\",url:e.url,headers:e.headers,exportInterval:e.exportInterval??se(5),maxBatchSize:e.maxBatchSize??1e3,body(s){let a={resourceSpans:[{resource:t,scopeSpans:[{scope:n,spans:s}]}]};return[r.traces(a),_e]},shutdownTimeout:e.shutdownTimeout??se(3)});function i(s){s.sampled&&o.push(rm(s))}return Di({span(s){return new ii(s,i)},context:e.context?function(s,a){return a.cache.span===void 0?s[\"~effect/Effect/evaluate\"](a):e.context(s,a.cache.span)}:void 0})}),Wd=_n(Kd,jn(Li),cr(Tt)),tm=e=>ur(function*(){let{disabled:t,endpoint:r,exporters:n}=yield*yt({disabled:xr(\"OTEL_SDK_DISABLED\").pipe(Me(!1)),endpoint:$r(\"TRACES\"),exporters:Ur(\"TRACES\")});if(t||!r||!n.includes(\"otlp\"))return Tt;let{baseTimeout:o,tracesTimeout:i,exportTimeout:s,scheduleDelay:a,maxBatchSize:c}=yield*yt({baseTimeout:ie(pe(\"OTEL_EXPORTER_OTLP_TIMEOUT\")),tracesTimeout:ie(pe(\"OTEL_EXPORTER_OTLP_TRACES_TIMEOUT\")),exportTimeout:ie(pe(\"OTEL_BSP_EXPORT_TIMEOUT\")),scheduleDelay:ie(pe(\"OTEL_BSP_SCHEDULE_DELAY\").pipe(Gt(X))),maxBatchSize:ie(pe(\"OTEL_BSP_MAX_EXPORT_BATCH_SIZE\"))}),u=ir([i,o,s]).pipe(jt(p=>X(p)));return Wd({url:r.toString(),resource:e?.resource,headers:e?.headers??(yield*vr(\"TRACES\")),exportInterval:te(a),maxBatchSize:te(c),context:e?.context,shutdownTimeout:te(u)})}).pipe(At,ar),ii=class{_tag=\"Span\";name;parent;annotations;links;kind;sampled;export;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(t,r){this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.kind=t.kind,this.sampled=t.sampled,this.export=r,this.status={_tag:\"Started\",startTime:t.startTime}}get traceId(){return this._traceId??=Ze(this.parent)?this.parent.value.traceId:Wo(32)}get spanId(){return this._spanId??=Wo(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(t,r){this.status={_tag:\"Ended\",startTime:this.status.startTime,endTime:t,exit:r},this.export(this)}attribute(t,r){this.attributes.set(t,r)}event(t,r,n){this.events.push([t,r,n])}addLinks(t){this.links.push(...t)}},rm=e=>{let t=e.status,r=e._attributes===void 0?[]:kt(e._attributes),n=[];if(e._events!==void 0)for(let s=0;s<e._events.length;s++){let[a,c,u]=e._events[s];n.push({name:a,timeUnixNano:String(c),attributes:u?kt(Object.entries(u)):[],droppedAttributesCount:0})}let o;if(t.exit._tag===\"Success\")o={code:si.Ok};else if(ji(t.exit.cause))o={code:si.Ok,message:\"Interrupted\"},r.push({key:\"span.label\",value:{stringValue:\"\\u26A0\\uFE0E Interrupted\"}},{key:\"status.interrupted\",value:{boolValue:!0}});else{let s=Vi(t.exit.cause,{includeCauseInStack:!0});if(o={code:si.Error},s.length>0){o.message=s[0].message;for(let a of s)n.push({name:\"exception\",timeUnixNano:String(t.endTime),droppedAttributesCount:0,attributes:[{key:\"exception.type\",value:{stringValue:a.name}},{key:\"exception.message\",value:{stringValue:a.message}},{key:\"exception.stacktrace\",value:{stringValue:a.stack??\"No stack trace available\"}}]})}}let i=[];for(let s=0;s<e.links.length;s++){let a=e.links[s];i.push({traceId:a.span.traceId,spanId:a.span.spanId,attributes:kt(Object.entries(a.attributes)),droppedAttributesCount:0})}return{traceId:e.traceId,spanId:e.spanId,parentSpanId:Ze(e.parent)?e.parent.value.spanId:void 0,name:e.name,kind:nm[e.kind],startTimeUnixNano:String(t.startTime),endTimeUnixNano:String(t.endTime),attributes:r,droppedAttributesCount:0,events:n,droppedEventsCount:0,status:o,links:i,droppedLinksCount:0}},si={Unset:0,Ok:1,Error:2},nm={unspecified:0,internal:1,server:2,client:3,producer:4,consumer:5};var Gd=(e,t=\"process\",r=Ut.withConsoleError(Ut.formatJson),n={})=>{let o={serviceName:e.service,serviceVersion:e.version,attributes:{\"deployment.environment.name\":e.environment}},i=(a,c)=>({url:a.url,resource:o,...a.headers===void 0?{}:{headers:Zn.value(a.headers)},exportInterval:t===\"event\"?\"1 hour\":\"1 second\",shutdownTimeout:n[c]??\"3 seconds\"}),s=Ut.layer([r]);return N.mergeAll(N.succeed(Oo,e),e.traces===void 0?N.empty:Qs(e.clock,!0).pipe(N.provideMerge(Fo.layer(i(e.traces,\"traces\")).pipe(N.provide(tr.layerJson)))),e.logs===void 0?s:Uo.layer({...i(e.logs,\"logs\"),mergeWithExisting:!0}).pipe(N.provide(tr.layerJson),N.provideMerge(s)),e.metrics===void 0?N.empty:Ho.layer({...i(e.metrics,\"metrics\"),exportInterval:\"30 seconds\",temporality:\"delta\"}).pipe(N.provide(e.metricsProtocol===\"http/json\"?tr.layerJson:tr.layerProtobuf))).pipe(N.provide(Po),N.provide(s),N.provideMerge(N.sync(fe.MetricRegistry,()=>new Map)))};var ai=\"Text from the app is not recorded\",Xd=\"unrecognized\",Zd=[\"requirements\",\"inspect\",\"skills\",\"query\",\"mutate\",\"call\",\"account-check\",\"webhooks\",\"webhook-validate\",\"webhook-complete\",\"webhook-register\",\"webhook-unregister\",\"webhook-handle\",\"workflows\",\"workflow-validate\",\"workflow-run\",\"migrate\"],Qd=[\"GET\",\"HEAD\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"OPTIONS\",\"TRACE\",\"CONNECT\"],om=new Set([\"app.dispatch\",...Zd.map(e=>`app.${e}`),\"app.evaluate\",\"app.accounts.bind\",\"app.account.check\",\"app.catalog.read\",\"app.skills.load\",\"app.skills.routers\",\"app.tool.resolve\",\"app.tool.approval\",\"app.tool.elicitation\",\"app.elicitation.wait\",\"app.workflow.control\",\"app.operation.execute\",\"app.sql.migrate\",\"app.code\",\"app.cache.call\",\"app.cache.get\",\"app.cache.load\",\"app.cache.command\",\"app.cache.publish\",\"app.cache.flush\",\"app.cache.lease.renew\",\"app.cache.lease.wait\",\"app.cache.refresh\",\"provider.http.request\",\"provider.http.response.read\",\"provider.openapi.call\",\"provider.graphql.request\",\"provider.graphql.call\",\"provider.mcp.session\",\"provider.mcp.connect\",\"provider.mcp.close\",\"provider.mcp.request\",\"provider.mcp.call\",\"provider.mcp.discover\",\"provider.mcp.check\",\"provider.mcp.health\",\"provider.mcp.anonymous\",\"provider.mcp.elicitation\",\"sql.execute\",...Qd.map(e=>`http.client ${e}`)]),eu=new Set([\"HostRequestInvalid\",\"HostAccountsInvalid\",\"HostDeclarationInvalid\",\"HostEvaluationFailed\",\"HostOperationNotFound\",\"HostOperationFailed\",\"HostKindMismatch\",\"HostToolNotFound\",\"HostInputInvalid\",\"HostOutputInvalid\",\"HostToolBlocked\",\"HostToolApprovalRequired\",\"HostToolPolicyFailed\",\"ElicitationFailed\",\"DatabaseLimitExceeded\",\"DatabaseFieldReserved\",\"SkillLoadFailed\",\"WorkflowFailure\",\"ProviderError\",\"OpenapiResponseError\",\"OpenapiError\",\"OpenapiCompileError\",\"GraphqlError\",\"McpError\",\"McpToolError\",\"McpCredentialsUnverified\",\"CacheError\",\"AppDatabaseError\",\"AppStorageError\",\"AppStorageUnavailable\",\"NetworkRefused\",\"FetchOptionUnsupported\",\"LogicalOperationFailed\",\"HttpClientError\",\"SchemaError\",\"TimeoutError\",\"UnknownError\",\"InterruptError\",\"Error\",\"TypeError\",\"RangeError\",\"ReferenceError\",\"SyntaxError\",\"EvalError\",\"URIError\",\"AggregateError\",\"AbortError\",\"string\",\"number\",\"bigint\",\"boolean\",\"symbol\",\"undefined\",\"object\",\"function\"]),sm=new Set([\"unavailable\",\"storage\",\"invalid\",\"capacity\",\"timeout\",\"schema\",\"schema_changed\",\"table\",\"index\",\"range\",\"value\",\"readonly\",\"cursor\",\"limit\",\"closed\",\"replay\",\"invalid_definition\",\"invalid_input\",\"request\",\"unauthorized\",\"invalid_response\",\"forbidden\",\"rate_limited\",\"rejected\",\"anonymous_access\",\"private_address\",\"credential_host\",\"credential_app\",\"credential_expired\",\"redirect\",\"cache\",\"integrity\"]),No=e=>typeof e.stringValue==\"string\"?e.stringValue:void 0,ui=e=>{let t=e.intValue,r=typeof t==\"string\"&&/^-?\\d{1,15}$/.test(t)?Number(t):t;return typeof r==\"number\"&&Number.isSafeInteger(r)?r:void 0},Q=(...e)=>t=>{let r=No(t);return r!==void 0&&e.includes(r)?{stringValue:r}:void 0},Yd=e=>t=>{let r=No(t);return r===void 0?void 0:{stringValue:e.has(r)?r:Xd}},bn=e=>typeof e.boolValue==\"boolean\"?{boolValue:e.boolValue}:void 0,wn=e=>{let t=ui(e);return t!==void 0&&t>=0?{intValue:t}:void 0},im=e=>{let t=ui(e);return t!==void 0&&t>=100&&t<=599?{intValue:t}:void 0},Mr=e=>{let t=typeof e.doubleValue==\"number\"?e.doubleValue:ui(e);return t!==void 0&&Number.isFinite(t)&&t>=0?{doubleValue:t}:void 0},ci={\"executor.operation\":Q(...Zd,\"mutation\",\"discover\"),\"executor.outcome\":Q(\"failed\"),\"executor.clock.type\":Q(\"system\",\"cloudflare-io\"),\"executor.trace.parent_sampled\":bn,\"executor.failure.source\":Q(\"app\",\"storage\",\"service\"),\"executor.failure.code\":Yd(sm),\"error.type\":Yd(eu),\"cache.operation\":Q(\"read\",\"acquire\",\"claim\",\"publish\",\"release\",\"renew\",\"write\",\"invalidate\"),\"cache.result\":Q(\"fresh\",\"stale\",\"miss\",\"local\"),\"cache.load.leased\":bn,\"cache.flush.index\":wn,\"cache.flush.count\":wn,\"cache.flush.entries\":wn,\"cache.flush.bytes\":wn,\"cache.leases\":wn,\"mcp.transport\":Q(\"http\",\"sse\",\"stdio\"),\"mcp.operation\":Q(\"discover\",\"call\",\"check\",\"health\"),\"mcp.tool.is_error\":bn,\"rpc.system.name\":Q(\"jsonrpc\"),\"rpc.method\":Q(\"initialize\",\"tools/list\",\"tools/call\",\"ping\"),\"graphql.operation.type\":Q(\"query\",\"mutation\",\"subscription\"),\"db.system.name\":Q(\"sqlite\"),\"db.operation.name\":Q(\"execute\"),\"http.request.method\":Q(...Qd),\"http.response.status_code\":im,\"url.scheme\":Q(\"http\",\"https\"),\"span.label\":Q(\"\\u26A0\\uFE0E Interrupted\"),\"status.interrupted\":bn,\"executor.milestone.reached\":bn,\"executor.owner\":Q(\"executor\",\"app\",\"upstream\",\"person\",\"lease\",\"background\"),\"executor.app.code\":Q(\"factory\",\"router\",\"approval\",\"handler\",\"loader\",\"cache\",\"webhook\",\"check\",\"skills\",\"elicitation\",\"workflow\",\"step\"),\"executor.workflow.operation\":Q(\"start\",\"get\",\"list\",\"terminate\"),\"cache.method\":Q(\"get\",\"revalidate\",\"read\",\"readMany\",\"write\",\"invalidate\"),\"executor.upstream.wait_ms\":Mr,\"executor.elicitation.wait_ms\":Mr,\"executor.authored_ms\":Mr,\"executor.lease.wait_ms\":Mr,\"executor.background_ms\":Mr,\"executor.overhead_ms\":Mr},vg=new Set(Object.keys(ci));var am=new Set([\"The app's request failed unexpectedly\",\"App cache refresh failed\",\"MCP catalog invalidation failed\",\"Telemetry export failed\"]),Dt=e=>typeof e==\"object\"&&e!==null&&!Array.isArray(e),cm=e=>typeof e==\"string\"&&/^[a-f0-9]{16}$/.test(e)?e:void 0,Sn=e=>typeof e==\"string\"&&/^\\d{1,20}$/.test(e)?e:void 0,di=(e,t,r)=>typeof e==\"number\"&&Number.isInteger(e)&&e>=t&&e<=r?e:void 0,dm=e=>(Array.isArray(e)?e:[]).flatMap(t=>{if(!Dt(t)||typeof t.key!=\"string\")return[];let r=t.key,n=Object.hasOwn(ci,r)?ci[r]:void 0,o=t.value,i=n===void 0||!Dt(o)?void 0:n(o);return i===void 0?[]:[{key:r,value:i}]}),um=e=>{let t=(Array.isArray(e.attributes)?e.attributes:[]).find(i=>Dt(i)&&i.key===\"exception.type\"),r=Dt(t)&&Dt(t.value)?No(t.value):void 0,n=r!==void 0&&eu.has(r)?r:Xd,o=Sn(e.timeUnixNano);return{name:\"exception\",...o===void 0?{}:{timeUnixNano:o},attributes:[{key:\"exception.type\",value:{stringValue:n}},{key:\"exception.message\",value:{stringValue:ai}},{key:\"exception.stacktrace\",value:{stringValue:`${n}: ${ai}`}}]}},tu=e=>{let t=Sn(e.startTimeUnixNano),r=Sn(e.endTimeUnixNano);if(t===void 0||r===void 0)return;let n=cm(e.parentSpanId),o=di(e.kind,0,5),i=Dt(e.status)?di(e.status.code,0,2):void 0,s=typeof e.name==\"string\"&&om.has(e.name)?e.name:\"app.unrecognized\";return{traceId:e.traceId,spanId:e.spanId,...n===void 0?{}:{parentSpanId:n},name:s,...o===void 0?{}:{kind:o},startTimeUnixNano:t,endTimeUnixNano:r,attributes:dm(e.attributes),events:(Array.isArray(e.events)?e.events:[]).flatMap(a=>Dt(a)&&a.name===\"exception\"?[um(a)]:[]),...i===void 0?{}:{status:{code:i}}}},ru=e=>{let t=Sn(e.timeUnixNano),r=Sn(e.observedTimeUnixNano),n=di(e.severityNumber,1,24),o=e.severityText,i=Dt(e.body)?No(e.body):void 0;return{...e.traceId===void 0?{}:{traceId:e.traceId},...e.spanId===void 0?{}:{spanId:e.spanId},...t===void 0?{}:{timeUnixNano:t},...r===void 0?{}:{observedTimeUnixNano:r},...n===void 0?{}:{severityNumber:n},...typeof o==\"string\"&&[\"Trace\",\"Debug\",\"Info\",\"Warn\",\"Error\",\"Fatal\"].includes(o)?{severityText:o}:{},body:{stringValue:i!==void 0&&am.has(i)?i:ai}}};var fm=f.gen(function*(){let e=yield*Xr.make(),t=yield*rc.make(1),r=[],n=0,o=c=>Zt(\"app\",c),i=()=>{let c=0,u=0;for(;u<r.length&&(u===0||c+r[u].size<=lm);)c+=r[u++].size;return n-=c,r.splice(0,u)},s=f.suspend(()=>{let c=i();return c.length===0?f.void:xm(c,\"executor-app\").pipe(f.catchTag(\"TimeoutError\",()=>o(\"timeout\")),f.catch(()=>o(\"relay\")),f.andThen(s))}),a=f.suspend(()=>t.withPermitsIfAvailable(1)(s).pipe(f.flatMap(c=>v.isSome(c)&&r.length>0?a:f.void)));return yield*f.addFinalizer(()=>Xr.awaitEmpty(e).pipe(f.timeoutOption(\"3 seconds\"),f.flatMap(c=>v.isNone(c)||r.length>0?o(\"shutdown\"):f.void))),(c,u,p)=>f.suspend(()=>{let m=[...c.traces,...c.logs].reduce((S,h)=>S+h.length,0);return n+m>pm?o(\"capacity\"):(r.push({batch:c,traceId:u,source:p,size:m}),n+=m,Xr.run(e,a).pipe(f.asVoid))})}),pm=8*1048576,lm=4*1048576,Mo=262144,fi=new TextEncoder,nu=d.String.check(d.isMaxLength(Mo),d.makeFilter(e=>fi.encode(e).byteLength<=Mo)),mm=d.Struct({traces:d.Array(nu).check(d.isMaxLength(4)),logs:d.Array(nu).check(d.isMaxLength(4)),dropped:d.Int.check(d.isGreaterThanOrEqualTo(0))}),hm=e=>f.gen(function*(){let t=ou('{\"resourceSpans\":[{\"scopeSpans\":[{\"spans\":[',\"]}]}]}\"),r=ou('{\"resourceLogs\":[{\"scopeLogs\":[{\"logRecords\":[',\"]}]}]}\"),n=0,o=async(s,a)=>{let c=new Request(s,a),u=await c.text();if(new URL(c.url).pathname===\"/v1/traces\"){let p=d.decodeUnknownSync(au)(u);n+=t.append(p.resourceSpans.flatMap(m=>m.scopeSpans.flatMap(S=>S.spans)))}else{let p=d.decodeUnknownSync(cu)(u);n+=r.append(p.resourceLogs.flatMap(m=>m.scopeLogs.flatMap(S=>S.logRecords)))}return Response.json({})};return{value:yield*e.pipe(f.provide(Gd({service:\"executor-app\",version:\"invocation\",environment:\"isolated\",clock:\"WebSocketPair\"in globalThis?\"cloudflare-io\":\"system\",traces:{url:\"http://telemetry.internal/v1/traces\"},logs:{url:\"http://telemetry.internal/v1/logs\"}},\"event\")),f.provideService(it.Fetch,o)),telemetry:{traces:t.finish(),logs:r.finish(),dropped:n}}}),ou=(e,t)=>{let r=[],n=[],o=fi.encode(e+t).byteLength,i=o,s=()=>{n.length!==0&&(r.push(e+n.join(\",\")+t),n=[],i=o)};return{append(a){let c=0;for(let u of a){let p=JSON.stringify(u),m=fi.encode(p).byteLength;if(m+o>Mo||r.length>=4){c++;continue}if((n.length>=1e3||i+m+(n.length>0?1:0)>Mo)&&s(),r.length>=4){c++;continue}i+=m+(n.length>0?1:0),n.push(p)}return c},finish(){return s(),r}}},su=d.String.check(d.isPattern(/^[a-f0-9]{32}$/u)),iu=d.String.check(d.isPattern(/^[a-f0-9]{16}$/u)),ym=d.StructWithRest(d.Struct({traceId:su,spanId:iu}),[d.Record(d.String,d.Json)]),gm=d.StructWithRest(d.Struct({traceId:d.optional(su),spanId:d.optional(iu)}),[d.Record(d.String,d.Json)]),au=d.fromJsonString(d.Struct({resourceSpans:d.Array(d.Struct({scopeSpans:d.Array(d.Struct({spans:d.Array(ym).check(d.isMaxLength(1e3))}))}))})),cu=d.fromJsonString(d.Struct({resourceLogs:d.Array(d.Struct({scopeLogs:d.Array(d.Struct({logRecords:d.Array(gm).check(d.isMaxLength(1e3))}))}))}));var xm=(e,t)=>f.gen(function*(){let r=yield*Oo;if(r===void 0)return;let n=({build:s,app:a})=>({attributes:[{key:\"service.name\",value:{stringValue:t}},{key:\"service.version\",value:{stringValue:r.version}},{key:\"deployment.environment.name\",value:{stringValue:r.environment}},...s===void 0?[]:[{key:\"executor.build.id\",value:{stringValue:s}}],...a===void 0?[]:[{key:\"executor.app.id\",value:{stringValue:a}}]]}),o=$d(yield*le.HttpClient),i=e.reduce((s,{batch:a})=>s+a.dropped,0);i>0&&(yield*Zt(\"app\",\"capacity\",i));for(let s of[\"traces\",\"logs\"]){let a=r[s],c=e.filter(({batch:p})=>p[s].length>0);if(a===void 0||c.length===0)continue;let u=s===\"traces\"?{resourceSpans:yield*f.forEach(c,({batch:p,traceId:m,source:S})=>f.forEach(p.traces,h=>d.decodeUnknownEffect(au)(h)).pipe(f.map(h=>({resource:n(S),scopeSpans:[{scope:{name:t},spans:h.flatMap(l=>l.resourceSpans).flatMap(l=>l.scopeSpans.flatMap(g=>g.spans)).filter(l=>m===void 0||l.traceId===m).flatMap(l=>{if(t!==\"executor-app\")return[l];let g=tu(l);return g===void 0?[]:[g]})}]}))))}:{resourceLogs:yield*f.forEach(c,({batch:p,traceId:m,source:S})=>f.forEach(p.logs,h=>d.decodeUnknownEffect(cu)(h)).pipe(f.map(h=>({resource:n(S),scopeLogs:[{scope:{name:t},logRecords:h.flatMap(l=>l.resourceLogs).flatMap(l=>l.scopeLogs.flatMap(g=>g.logRecords)).filter(l=>m===void 0||l.traceId===m).map(l=>t===\"executor-app\"?ru(l):l)}]}))))};yield*o.execute(Be.post(a.url).pipe(Be.setHeaders(a.headers===void 0?{}:Zn.value(a.headers)),Be.bodyJsonUnsafe(u)))}}).pipe(f.provide(Po),f.provideService(Se.DisablePropagation,!0),f.timeout(\"3 seconds\"));var Dr=Symbol(\"apps.NativeCallback\"),Em=e=>Vs(\"app\",\"app.code\",{attributes:{\"executor.app.code\":e}}),Gg=(e,t)=>(...r)=>{if(Dr in e){let n=e[Dr];return n(...r)}return f.tryPromise({try:()=>e(...r),catch:n=>n}).pipe(Em(t))},Yg=(e,t)=>{let r=e[t],n=(...o)=>Reflect.apply(r,e,o);return Dr in r&&Object.assign(n,{[Dr]:r[Dr]}),n},Xg=(e,t,r)=>{let n=(...o)=>f.suspend(()=>{let i=typeof t==\"function\"?t(...o):t;if(i===void 0)return e(...o);if(i.aborted)return f.interrupt;let s=f.callback(a=>{if(i.aborted){a(f.interrupt);return}let c=()=>a(f.interrupt);return i.addEventListener(\"abort\",c,{once:!0}),f.sync(()=>i.removeEventListener(\"abort\",c))});return f.raceFirst(s,f.suspend(()=>e(...o)))});return Object.assign((...o)=>r===void 0?f.runPromise(n(...o)):f.runPromiseWith(r)(n(...o)),{[Dr]:n})};function Bt(e,t){let r=typeof e;if(r!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let o=0;o<n;o++)if(!Bt(e[o],t[o]))return!1;return!0}if(r===\"object\"){if(!e||!t)return e===t;let n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let s of n)if(!Bt(e[s],t[s]))return!1;return!0}return e===t}function Pe(e){return encodeURI(bm(e))}function bm(e){return e.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}var wm={additionalItems:!0,unevaluatedItems:!0,items:!0,contains:!0,additionalProperties:!0,unevaluatedProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Sm={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Tm={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},km={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!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},Rm=typeof self<\"u\"&&self.location&&self.location.origin!==\"null\"?new URL(self.location.origin+self.location.pathname+location.search):new URL(\"https://github.com/cfworker\");function Ye(e,t=Object.create(null),r=Rm,n=\"\"){if(e&&typeof e==\"object\"&&!Array.isArray(e)){let i=e.$id||e.id;if(i){let s=new URL(i,r.href);s.hash.length>1?t[s.href]=e:(s.hash=\"\",n===\"\"?r=s:Ye(e,t,r))}}else if(e!==!0&&e!==!1)return t;let o=r.href+(n?\"#\"+n:\"\");if(t[o]!==void 0)throw new Error(`Duplicate schema URI \"${o}\".`);if(t[o]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,\"__absolute_uri__\",{enumerable:!1,value:o}),e.$ref&&e.__absolute_ref__===void 0){let i=new URL(e.$ref,r.href);i.hash=i.hash,Object.defineProperty(e,\"__absolute_ref__\",{enumerable:!1,value:i.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let i=new URL(e.$recursiveRef,r.href);i.hash=i.hash,Object.defineProperty(e,\"__absolute_recursive_ref__\",{enumerable:!1,value:i.href})}if(e.$anchor){let i=new URL(\"#\"+e.$anchor,r.href);t[i.href]=e}for(let i in e){if(km[i])continue;let s=`${n}/${Pe(i)}`,a=e[i];if(Array.isArray(a)){if(Sm[i]){let c=a.length;for(let u=0;u<c;u++)Ye(a[u],t,r,`${s}/${u}`)}}else if(Tm[i])for(let c in a)Ye(a[c],t,r,`${s}/${Pe(c)}`);else if(wm[i])Ye(a,t,r,s);else if(i===\"dependencies\"&&a&&typeof a==\"object\")for(let c in a)Array.isArray(a[c])||Ye(a[c],t,r,`${s}/${Pe(c)}`)}return t}var Om=/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/,Im=[0,31,28,31,30,31,30,31,31,30,31,30,31],Pm=/^(\\d\\d):(\\d\\d):(\\d\\d)(\\.\\d+)?(z|[+-]\\d\\d(?::?\\d\\d)?)?$/i,Cm=/^(?=.{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,_m=/^(?:[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,Am=/^(?:(?:[^\\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,vm=/^(?:(?:https?|ftp):\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!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-z\\u{00a1}-\\u{ffff}0-9]+-?)*[a-z\\u{00a1}-\\u{ffff}0-9]+)(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-?)*[a-z\\u{00a1}-\\u{ffff}0-9]+)*(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?$/iu,$m=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Um=/^(?:\\/(?:[^~/]|~0|~1)*)*$/,Hm=/^#(?:\\/(?:[a-z0-9_\\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Fm=/^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/,Nm=e=>{if(e[0]==='\"')return!1;let[t,r,...n]=e.split(\"@\");return!t||!r||n.length!==0||t.length>64||r.length>253||t[0]===\".\"||t.endsWith(\".\")||t.includes(\"..\")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:r.split(\".\").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},Mm=/^(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$/,Dm=/^((([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,Bm=e=>e.length>1&&e.length<80&&(/^P\\d+([.,]\\d+)?W$/.test(e)||/^P[\\dYMDTHS]*(\\d[.,]\\d+)?[YMDHS]$/.test(e)&&/^P([.,\\d]+Y)?([.,\\d]+M)?([.,\\d]+D)?(T([.,\\d]+H)?([.,\\d]+M)?([.,\\d]+S)?)?$/.test(e));function ct(e){return e.test.bind(e)}var pi={date:du,time:uu.bind(void 0,!1),\"date-time\":Vm,duration:Bm,uri:zm,\"uri-reference\":ct(_m),\"uri-template\":ct(Am),url:ct(vm),email:Nm,hostname:ct(Cm),ipv4:ct(Mm),ipv6:ct(Dm),regex:Wm,uuid:ct($m),\"json-pointer\":ct(Um),\"json-pointer-uri-fragment\":ct(Hm),\"relative-json-pointer\":ct(Fm)};function Lm(e){return e%4===0&&(e%100!==0||e%400===0)}function du(e){let t=e.match(Om);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&Lm(r)?29:Im[n])}function uu(e,t){let r=t.match(Pm);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3],s=!!r[5];return(n<=23&&o<=59&&i<=59||n==23&&o==59&&i==60)&&(!e||s)}var jm=/t|\\s/i;function Vm(e){let t=e.split(jm);return t.length==2&&du(t[0])&&uu(!0,t[1])}var qm=/\\/|:/,Jm=/^(?:[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 zm(e){return qm.test(e)&&Jm.test(e)}var Km=/[^\\\\]\\\\Z/;function Wm(e){if(Km.test(e))return!1;try{return new RegExp(e,\"u\"),!0}catch{return!1}}var fu;(function(e){e[e.Flag=1]=\"Flag\",e[e.Basic=2]=\"Basic\",e[e.Detailed=4]=\"Detailed\"})(fu||(fu={}));function pu(e){let t=0,r=e.length,n=0,o;for(;n<r;)t++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<r&&(o=e.charCodeAt(n),(o&64512)==56320&&n++);return t}function V(e,t,r=\"2019-09\",n=Ye(t),o=!0,i=null,s=\"#\",a=\"#\",c=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:s,keyword:\"false\",keywordLocation:s,error:\"False boolean schema.\"}]};let u=typeof e,p;switch(u){case\"boolean\":case\"number\":case\"string\":p=u;break;case\"object\":e===null?p=\"null\":Array.isArray(e)?p=\"array\":p=\"object\";break;default:throw new Error(`Instances of \"${u}\" type are not supported.`)}let{$ref:m,$recursiveRef:S,$recursiveAnchor:h,type:l,const:g,enum:P,required:z,not:xe,anyOf:Ee,allOf:H,oneOf:_,if:F,then:G,else:W,format:ne,properties:K,patternProperties:L,additionalProperties:ke,unevaluatedProperties:oe,minProperties:me,maxProperties:Lr,propertyNames:On,dependentRequired:je,dependentSchemas:jr,dependencies:b,prefixItems:dt,items:be,additionalItems:Ve,unevaluatedItems:D,contains:q,minContains:j,maxContains:ee,minItems:we,maxItems:ue,uniqueItems:Pt,minimum:ut,maximum:ft,exclusiveMinimum:Ct,exclusiveMaximum:$e,multipleOf:pt,minLength:or,maxLength:In,pattern:Si,__absolute_ref__:Pn,__absolute_recursive_ref__:Vu}=t,E=[];if(h===!0&&i===null&&(i=t),S!==void 0){let k=i===null?n[Vu]:i,T=`${a}/$recursiveRef`,I=V(e,i===null?t:i,r,n,o,k,s,T,c);I.valid||E.push({instanceLocation:s,keyword:\"$recursiveRef\",keywordLocation:T,error:\"A subschema had errors.\"},...I.errors)}if(m!==void 0){let T=n[Pn||m];if(T===void 0){let y=`Unresolved $ref \"${m}\".`;throw Pn&&Pn!==m&&(y+=`  Absolute URI \"${Pn}\".`),y+=`\nKnown schemas:\n- ${Object.keys(n).join(`\n- `)}`,new Error(y)}let I=`${a}/$ref`,w=V(e,T,r,n,o,i,s,I,c);if(w.valid||E.push({instanceLocation:s,keyword:\"$ref\",keywordLocation:I,error:\"A subschema had errors.\"},...w.errors),r===\"4\"||r===\"7\")return{valid:E.length===0,errors:E}}if(Array.isArray(l)){let k=l.length,T=!1;for(let I=0;I<k;I++)if(p===l[I]||l[I]===\"integer\"&&p===\"number\"&&e%1===0&&e===e){T=!0;break}T||E.push({instanceLocation:s,keyword:\"type\",keywordLocation:`${a}/type`,error:`Instance type \"${p}\" is invalid. Expected \"${l.join('\", \"')}\".`})}else l===\"integer\"?(p!==\"number\"||e%1||e!==e)&&E.push({instanceLocation:s,keyword:\"type\",keywordLocation:`${a}/type`,error:`Instance type \"${p}\" is invalid. Expected \"${l}\".`}):l!==void 0&&p!==l&&E.push({instanceLocation:s,keyword:\"type\",keywordLocation:`${a}/type`,error:`Instance type \"${p}\" is invalid. Expected \"${l}\".`});if(g!==void 0&&(p===\"object\"||p===\"array\"?Bt(e,g)||E.push({instanceLocation:s,keyword:\"const\",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(g)}.`}):e!==g&&E.push({instanceLocation:s,keyword:\"const\",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(g)}.`})),P!==void 0&&(p===\"object\"||p===\"array\"?P.some(k=>Bt(e,k))||E.push({instanceLocation:s,keyword:\"enum\",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(P)}.`}):P.some(k=>e===k)||E.push({instanceLocation:s,keyword:\"enum\",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(P)}.`})),xe!==void 0){let k=`${a}/not`;V(e,xe,r,n,o,i,s,k).valid&&E.push({instanceLocation:s,keyword:\"not\",keywordLocation:k,error:'Instance matched \"not\" schema.'})}let Cn=[];if(Ee!==void 0){let k=`${a}/anyOf`,T=E.length,I=!1;for(let w=0;w<Ee.length;w++){let y=Ee[w],O=Object.create(c),R=V(e,y,r,n,o,h===!0?i:null,s,`${k}/${w}`,O);E.push(...R.errors),I=I||R.valid,R.valid&&Cn.push(O)}I?E.length=T:E.splice(T,0,{instanceLocation:s,keyword:\"anyOf\",keywordLocation:k,error:\"Instance does not match any subschemas.\"})}if(H!==void 0){let k=`${a}/allOf`,T=E.length,I=!0;for(let w=0;w<H.length;w++){let y=H[w],O=Object.create(c),R=V(e,y,r,n,o,h===!0?i:null,s,`${k}/${w}`,O);E.push(...R.errors),I=I&&R.valid,R.valid&&Cn.push(O)}I?E.length=T:E.splice(T,0,{instanceLocation:s,keyword:\"allOf\",keywordLocation:k,error:\"Instance does not match every subschema.\"})}if(_!==void 0){let k=`${a}/oneOf`,T=E.length,I=_.filter((w,y)=>{let O=Object.create(c),R=V(e,w,r,n,o,h===!0?i:null,s,`${k}/${y}`,O);return E.push(...R.errors),R.valid&&Cn.push(O),R.valid}).length;I===1?E.length=T:E.splice(T,0,{instanceLocation:s,keyword:\"oneOf\",keywordLocation:k,error:`Instance does not match exactly one subschema (${I} matches).`})}if((p===\"object\"||p===\"array\")&&Object.assign(c,...Cn),F!==void 0){let k=`${a}/if`;if(V(e,F,r,n,o,i,s,k,c).valid){if(G!==void 0){let I=V(e,G,r,n,o,i,s,`${a}/then`,c);I.valid||E.push({instanceLocation:s,keyword:\"if\",keywordLocation:k,error:'Instance does not match \"then\" schema.'},...I.errors)}}else if(W!==void 0){let I=V(e,W,r,n,o,i,s,`${a}/else`,c);I.valid||E.push({instanceLocation:s,keyword:\"if\",keywordLocation:k,error:'Instance does not match \"else\" schema.'},...I.errors)}}if(p===\"object\"){if(z!==void 0)for(let w of z)w in e||E.push({instanceLocation:s,keyword:\"required\",keywordLocation:`${a}/required`,error:`Instance does not have required property \"${w}\".`});let k=Object.keys(e);if(me!==void 0&&k.length<me&&E.push({instanceLocation:s,keyword:\"minProperties\",keywordLocation:`${a}/minProperties`,error:`Instance does not have at least ${me} properties.`}),Lr!==void 0&&k.length>Lr&&E.push({instanceLocation:s,keyword:\"maxProperties\",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${Lr} properties.`}),On!==void 0){let w=`${a}/propertyNames`;for(let y in e){let O=`${s}/${Pe(y)}`,R=V(y,On,r,n,o,i,O,w);R.valid||E.push({instanceLocation:s,keyword:\"propertyNames\",keywordLocation:w,error:`Property name \"${y}\" does not match schema.`},...R.errors)}}if(je!==void 0){let w=`${a}/dependantRequired`;for(let y in je)if(y in e){let O=je[y];for(let R of O)R in e||E.push({instanceLocation:s,keyword:\"dependentRequired\",keywordLocation:w,error:`Instance has \"${y}\" but does not have \"${R}\".`})}}if(jr!==void 0)for(let w in jr){let y=`${a}/dependentSchemas`;if(w in e){let O=V(e,jr[w],r,n,o,i,s,`${y}/${Pe(w)}`,c);O.valid||E.push({instanceLocation:s,keyword:\"dependentSchemas\",keywordLocation:y,error:`Instance has \"${w}\" but does not match dependant schema.`},...O.errors)}}if(b!==void 0){let w=`${a}/dependencies`;for(let y in b)if(y in e){let O=b[y];if(Array.isArray(O))for(let R of O)R in e||E.push({instanceLocation:s,keyword:\"dependencies\",keywordLocation:w,error:`Instance has \"${y}\" but does not have \"${R}\".`});else{let R=V(e,O,r,n,o,i,s,`${w}/${Pe(y)}`);R.valid||E.push({instanceLocation:s,keyword:\"dependencies\",keywordLocation:w,error:`Instance has \"${y}\" but does not match dependant schema.`},...R.errors)}}}let T=Object.create(null),I=!1;if(K!==void 0){let w=`${a}/properties`;for(let y in K){if(!(y in e))continue;let O=`${s}/${Pe(y)}`,R=V(e[y],K[y],r,n,o,i,O,`${w}/${Pe(y)}`);if(R.valid)c[y]=T[y]=!0;else if(I=o,E.push({instanceLocation:s,keyword:\"properties\",keywordLocation:w,error:`Property \"${y}\" does not match schema.`},...R.errors),I)break}}if(!I&&L!==void 0){let w=`${a}/patternProperties`;for(let y in L){let O=lu(y),R=L[y];for(let Re in e){if(!O.test(Re))continue;let Ti=`${s}/${Pe(Re)}`,ki=V(e[Re],R,r,n,o,i,Ti,`${w}/${Pe(y)}`);ki.valid?c[Re]=T[Re]=!0:(I=o,E.push({instanceLocation:s,keyword:\"patternProperties\",keywordLocation:w,error:`Property \"${Re}\" matches pattern \"${y}\" but does not match associated schema.`},...ki.errors))}}}if(!I&&ke!==void 0){let w=`${a}/additionalProperties`;for(let y in e){if(T[y])continue;let O=`${s}/${Pe(y)}`,R=V(e[y],ke,r,n,o,i,O,w);R.valid?c[y]=!0:(I=o,E.push({instanceLocation:s,keyword:\"additionalProperties\",keywordLocation:w,error:`Property \"${y}\" does not match additional properties schema.`},...R.errors))}}else if(!I&&oe!==void 0){let w=`${a}/unevaluatedProperties`;for(let y in e)if(!c[y]){let O=`${s}/${Pe(y)}`,R=V(e[y],oe,r,n,o,i,O,w);R.valid?c[y]=!0:E.push({instanceLocation:s,keyword:\"unevaluatedProperties\",keywordLocation:w,error:`Property \"${y}\" does not match unevaluated properties schema.`},...R.errors)}}}else if(p===\"array\"){ue!==void 0&&e.length>ue&&E.push({instanceLocation:s,keyword:\"maxItems\",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${e.length} > ${ue}).`}),we!==void 0&&e.length<we&&E.push({instanceLocation:s,keyword:\"minItems\",keywordLocation:`${a}/minItems`,error:`Array has too few items (${e.length} < ${we}).`});let k=e.length,T=0,I=!1;if(dt!==void 0){let w=`${a}/prefixItems`,y=Math.min(dt.length,k);for(;T<y;T++){let O=V(e[T],dt[T],r,n,o,i,`${s}/${T}`,`${w}/${T}`);if(c[T]=!0,!O.valid&&(I=o,E.push({instanceLocation:s,keyword:\"prefixItems\",keywordLocation:w,error:\"Items did not match schema.\"},...O.errors),I))break}}if(be!==void 0){let w=`${a}/items`;if(Array.isArray(be)){let y=Math.min(be.length,k);for(;T<y;T++){let O=V(e[T],be[T],r,n,o,i,`${s}/${T}`,`${w}/${T}`);if(c[T]=!0,!O.valid&&(I=o,E.push({instanceLocation:s,keyword:\"items\",keywordLocation:w,error:\"Items did not match schema.\"},...O.errors),I))break}}else for(;T<k;T++){let y=V(e[T],be,r,n,o,i,`${s}/${T}`,w);if(c[T]=!0,!y.valid&&(I=o,E.push({instanceLocation:s,keyword:\"items\",keywordLocation:w,error:\"Items did not match schema.\"},...y.errors),I))break}if(!I&&Ve!==void 0){let y=`${a}/additionalItems`;for(;T<k;T++){let O=V(e[T],Ve,r,n,o,i,`${s}/${T}`,y);c[T]=!0,O.valid||(I=o,E.push({instanceLocation:s,keyword:\"additionalItems\",keywordLocation:y,error:\"Items did not match additional items schema.\"},...O.errors))}}}if(q!==void 0)if(k===0&&j===void 0)E.push({instanceLocation:s,keyword:\"contains\",keywordLocation:`${a}/contains`,error:\"Array is empty. It must contain at least one item matching the schema.\"});else if(j!==void 0&&k<j)E.push({instanceLocation:s,keyword:\"minContains\",keywordLocation:`${a}/minContains`,error:`Array has less items (${k}) than minContains (${j}).`});else{let w=`${a}/contains`,y=E.length,O=0;for(let R=0;R<k;R++){let Re=V(e[R],q,r,n,o,i,`${s}/${R}`,w);Re.valid?(c[R]=!0,O++):E.push(...Re.errors)}O>=(j||0)&&(E.length=y),j===void 0&&ee===void 0&&O===0?E.splice(y,0,{instanceLocation:s,keyword:\"contains\",keywordLocation:w,error:\"Array does not contain item matching schema.\"}):j!==void 0&&O<j?E.push({instanceLocation:s,keyword:\"minContains\",keywordLocation:`${a}/minContains`,error:`Array must contain at least ${j} items matching schema. Only ${O} items were found.`}):ee!==void 0&&O>ee&&E.push({instanceLocation:s,keyword:\"maxContains\",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${ee} items matching schema. ${O} items were found.`})}if(!I&&D!==void 0){let w=`${a}/unevaluatedItems`;for(T;T<k;T++){if(c[T])continue;let y=V(e[T],D,r,n,o,i,`${s}/${T}`,w);c[T]=!0,y.valid||E.push({instanceLocation:s,keyword:\"unevaluatedItems\",keywordLocation:w,error:\"Items did not match unevaluated items schema.\"},...y.errors)}}if(Pt)for(let w=0;w<k;w++){let y=e[w],O=typeof y==\"object\"&&y!==null;for(let R=0;R<k;R++){if(w===R)continue;let Re=e[R];(y===Re||O&&(typeof Re==\"object\"&&Re!==null)&&Bt(y,Re))&&(E.push({instanceLocation:s,keyword:\"uniqueItems\",keywordLocation:`${a}/uniqueItems`,error:`Duplicate items at indexes ${w} and ${R}.`}),w=Number.MAX_SAFE_INTEGER,R=Number.MAX_SAFE_INTEGER)}}}else if(p===\"number\"){if(r===\"4\"?(ut!==void 0&&(Ct===!0&&e<=ut||e<ut)&&E.push({instanceLocation:s,keyword:\"minimum\",keywordLocation:`${a}/minimum`,error:`${e} is less than ${Ct?\"or equal to \":\"\"} ${ut}.`}),ft!==void 0&&($e===!0&&e>=ft||e>ft)&&E.push({instanceLocation:s,keyword:\"maximum\",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${$e?\"or equal to \":\"\"} ${ft}.`})):(ut!==void 0&&e<ut&&E.push({instanceLocation:s,keyword:\"minimum\",keywordLocation:`${a}/minimum`,error:`${e} is less than ${ut}.`}),ft!==void 0&&e>ft&&E.push({instanceLocation:s,keyword:\"maximum\",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${ft}.`}),Ct!==void 0&&e<=Ct&&E.push({instanceLocation:s,keyword:\"exclusiveMinimum\",keywordLocation:`${a}/exclusiveMinimum`,error:`${e} is less than ${Ct}.`}),$e!==void 0&&e>=$e&&E.push({instanceLocation:s,keyword:\"exclusiveMaximum\",keywordLocation:`${a}/exclusiveMaximum`,error:`${e} is greater than or equal to ${$e}.`})),pt!==void 0){let k=e%pt;Math.abs(0-k)>=11920929e-14&&Math.abs(pt-k)>=11920929e-14&&E.push({instanceLocation:s,keyword:\"multipleOf\",keywordLocation:`${a}/multipleOf`,error:`${e} is not a multiple of ${pt}.`})}}else if(p===\"string\"){let k=or===void 0&&In===void 0?0:pu(e);or!==void 0&&k<or&&E.push({instanceLocation:s,keyword:\"minLength\",keywordLocation:`${a}/minLength`,error:`String is too short (${k} < ${or}).`}),In!==void 0&&k>In&&E.push({instanceLocation:s,keyword:\"maxLength\",keywordLocation:`${a}/maxLength`,error:`String is too long (${k} > ${In}).`}),Si!==void 0&&!lu(Si).test(e)&&E.push({instanceLocation:s,keyword:\"pattern\",keywordLocation:`${a}/pattern`,error:\"String does not match pattern.\"}),ne!==void 0&&pi[ne]&&!pi[ne](e)&&E.push({instanceLocation:s,keyword:\"format\",keywordLocation:`${a}/format`,error:`String does not match format \"${ne}\".`})}return{valid:E.length===0,errors:E}}function lu(e){try{return new RegExp(e,\"u\")}catch(t){if(!(t instanceof SyntaxError))throw t;return new RegExp(e)}}var hi=Symbol(\"apps.Schema\"),yi=e=>e[hi],Gm=e=>typeof e==\"object\"&&e!==null&&hi in e,gi=(e,t)=>{if(Gm(e))return e;let r=e;throw new TypeError(`${t} must be a schema, such as string() or object({ ... }), but ${typeof r==\"function\"?\"it is a function. Call it, as in string().\":r===void 0?\"it is undefined. Check that it is defined and imported before this declaration.\":typeof r==\"object\"&&r!==null&&Object.getPrototypeOf(r)===Object.prototype?\"it is a plain object. Wrap its fields in object({ ... }).\":\"no apps schema constructor created it.\"}`)},li=(e,t)=>f.suspend(()=>d.decodeUnknownEffect(e)(t)).pipe(f.mapError(()=>new ot)),Ym=to.makeFormatterStandardSchemaV1({leafHook:to.defaultLeafHook}),Ix=(e,t,r,n=()=>e)=>f.suspend(()=>d.decodeUnknownEffect(e)(t)).pipe(f.catch(o=>f.suspend(()=>d.decodeUnknownEffect(n(t))(t,{errors:\"all\"})).pipe(f.flip,f.orElseSucceed(()=>o),f.flatMap(i=>f.fail(new _c({declaration:r,issues:Ym(i.issue).issues.map(s=>({path:(s.path??[]).map(a=>String(typeof a==\"object\"?a.key:a)),message:s.message}))}))))));function Xe(e,t){return{[hi]:e,optionalValue:t,parse:r=>f.runSync(li(e,r)),optional:()=>Xe(d.optional(e),!0),default:r=>{let n=f.runSync(li(e,r));return{...Xe(e.annotate({default:n}).pipe(d.withDecodingDefault(f.succeed(n))),!1),hasDefault:!0,inputOptional:t}}}}function Px(e={}){return Xe(e.minLength===void 0?d.String:d.String.check(d.isMinLength(e.minLength)),!1)}var Cx=()=>Xe(d.Finite,!1),_x=()=>Xe(d.Boolean,!1),Ax=()=>Xe(d.Json,!1),vx=e=>Xe(d.Record(d.String,yi(gi(e,\"The record() value\"))),!1);function $x(e){return typeof e==\"number\"&&f.runSync(li(d.Finite,e)),Xe(e===null?d.Null:d.Literal(e),!1)}var Ux=e=>Xe(d.Array(yi(gi(e,\"The array() item\"))),!1);function Hx(e){let t=Object.entries(e).map(([n,o])=>[n,yi(gi(o,`The object() field ${JSON.stringify(n)}`))]),r=t.length===0?Qm(d.Record(d.String,d.Unknown).pipe(d.decodeTo(d.Record(d.String,d.Never),{decode:ss.transform(()=>({})),encode:ss.transform(n=>n)})),{type:\"object\",properties:{},additionalProperties:!1}):d.Struct(Object.fromEntries(t));return{...Xe(r,!1),fields:Object.freeze({...e})}}var Tn=Symbol(\"apps.FieldExposure\"),Xm=e=>Tn in e&&(e[Tn]===\"plain\"||e[Tn]===\"raw\")?e[Tn]:void 0,Do=(e,t)=>({...e,[Tn]:t,optional:()=>Do(e.optional(),t),default:r=>Do(e.default(r),t)}),Fx=e=>Do(e,\"plain\"),Nx=e=>Do(e,\"raw\"),Mx=e=>Object.fromEntries(Object.entries(e).flatMap(([t,r])=>{let n=Xm(r);return n===void 0?[]:[[t,n]]})),Rn=Symbol(\"apps.JsonSchemaDocument\"),Zm=e=>Rn in e?e[Rn]:void 0,Qm=(e,t)=>Object.assign(e,{[Rn]:t}),Eu=e=>{let t;return()=>(t??={value:e()}).value},eh=(e,t)=>Object.defineProperty(e,Rn,{configurable:!0,enumerable:!0,get:Eu(t)}),th=(e,t)=>{let r=structuredClone(e),n=Ye(r),o=wu(r,n),i=new Map,s=(u,p)=>{if(i.has(u)||i.set(u,p),Array.isArray(u))u.forEach((m,S)=>s(m,`${p}/${S}`));else if(u!==null&&typeof u==\"object\")for(let[m,S]of Object.entries(u))s(S,`${p}/${encodeURI(m.replaceAll(\"~\",\"~0\").replaceAll(\"/\",\"~1\")).replaceAll(\"#\",\"%23\")}`)};s(r,t);let a=new Map;for(let u of o){let p={};for(let[m,S]of[[\"$ref\",u.__absolute_ref__],[\"$recursiveRef\",u.__absolute_recursive_ref__]]){if(S===void 0)continue;let h=n[S],l=i.get(h);if(l===void 0)throw new ot;p[m]=l}a.set(u,p)}let c=u=>{if(Array.isArray(u))return u.map(c);if(u===null||typeof u!=\"object\")return u;let p=a.get(u);return Object.fromEntries(Object.entries(u).filter(([m])=>p===void 0||![\"$id\",\"id\",\"$anchor\"].includes(m)).map(([m,S])=>[m,p?.[m]??c(S)]))};return d.decodeUnknownSync(d.Record(d.String,d.Json))(c(r))},rh=new Set([\"$id\",\"id\",\"$anchor\",\"$recursiveAnchor\",\"$recursiveRef\",\"$dynamicAnchor\",\"$dynamicRef\"]),nh=e=>{if(typeof e!=\"string\"||!e.startsWith(\"#/$defs/\"))return;let t=nr(e);return t.length===2?t[1]:void 0},oh=e=>{let t=e.$defs??{};if(!U(t))return;let r=[e];for(let n=r.pop();n!==void 0;n=r.pop())if(bu(n))for(let[o,i]of Object.entries(n)){if(rh.has(o))return;if(o===\"$ref\"){let s=nh(i);if(s===void 0||!Object.hasOwn(t,s))return}else Array.isArray(i)?(jo.has(o)||o===\"items\")&&r.push(...i):Lo.has(o)||o===\"dependencies\"?U(i)&&r.push(...Object.values(i)):xi.has(o)&&r.push(i)}return t},Dx=(e,t)=>{let r={},n=new Map,o=e.map((i,s)=>{let a=oh(i),c=Object.entries(a??{}).map(([m,S])=>[m,S,JSON.stringify(S)]);if(a===void 0||c.some(([m,,S])=>n.has(m)&&n.get(m)!==S))return th(i,t(s));for(let[m,S,h]of c)n.has(m)||(n.set(m,h),Object.defineProperty(r,m,{value:S,enumerable:!0,writable:!0,configurable:!0}));let{$defs:u,...p}=i;return p});return n.size===0?{schemas:o}:{$defs:r,schemas:o}},Lo=new Set([\"$defs\",\"definitions\",\"properties\",\"patternProperties\",\"dependentSchemas\"]),jo=new Set([\"allOf\",\"anyOf\",\"oneOf\",\"prefixItems\"]),xi=new Set([\"not\",\"if\",\"then\",\"else\",\"items\",\"additionalItems\",\"contains\",\"additionalProperties\",\"unevaluatedProperties\",\"unevaluatedItems\",\"propertyNames\"]),bu=e=>typeof e==\"object\"&&e!==null&&!Array.isArray(e),wu=(e,t)=>{let r=new Set,n=[e];for(let o=n.pop();o!==void 0;o=n.pop())if(!(!bu(o)||r.has(o))){r.add(o);for(let i of[o.__absolute_ref__,o.__absolute_recursive_ref__]){let s=i===void 0?void 0:t[i];s!==void 0&&n.push(s)}for(let[i,s]of Object.entries(o))Array.isArray(s)?(jo.has(i)||i===\"items\")&&n.push(...s):Lo.has(i)||i===\"dependencies\"?U(s)&&n.push(...Object.values(s)):xi.has(i)&&n.push(s)}return r};function kn(e){if(typeof e==\"boolean\")return e;if(e===null||typeof e!=\"object\"||Array.isArray(e))throw new ot;let t=[];for(let[r,n]of Object.entries(e)){if(r===\"$dynamicRef\"||r===\"$dynamicAnchor\")throw new ot;r!==\"format\"&&(Lo.has(r)&&n!==null&&typeof n==\"object\"&&!Array.isArray(n)?t.push([r,Object.fromEntries(Object.entries(n).map(([o,i])=>[o,kn(i)]))]):(jo.has(r)||r===\"items\")&&Array.isArray(n)?t.push([r,n.map(kn)]):xi.has(r)?t.push([r,kn(n)]):r===\"dependencies\"&&n!==null&&typeof n==\"object\"&&!Array.isArray(n)?t.push([r,Object.fromEntries(Object.entries(n).map(([o,i])=>[o,Array.isArray(i)?i:kn(i)]))]):t.push([r,n]))}return Object.fromEntries(t)}var sh=new Set([\"$ref\",\"$recursiveRef\",\"$dynamicRef\",\"properties\",\"patternProperties\",\"additionalProperties\",\"unevaluatedProperties\",\"propertyNames\",\"items\",\"prefixItems\",\"additionalItems\",\"unevaluatedItems\",\"contains\",\"allOf\",\"if\",\"then\",\"else\",\"dependentSchemas\"]),Su=e=>/^[A-Za-z_$][\\w$-]{0,63}$/.test(e),Tu=e=>Su(e)?e:JSON.stringify(e.slice(0,64)),ku=24,Ru=(e,t,r=ku)=>{let o=[...e.slice(0,r).map(({name:i,optional:s})=>`${Tu(i)}${s?\"?\":\"\"}`),...e.length>r?[`${e.length-r} more`]:[],...t?[\"...\"]:[]];return o.length===0?\"object {} with no keys\":`object {${o.join(\", \")}}`},ih=10,ah=200,ch=e=>typeof e==\"bigint\"?`${e}n`:JSON.stringify(e),Ei=e=>{let t=[...new Set(e.map(ch))],r=[];for(let i of t){if(r.length===ih||[...r,i].join(\", \").length>ah)break;r.push(i)}let[n]=r;if(t.length===0)return\"no value, since the schema allows none\";if(n===void 0)return t.length===1?\"a fixed value too long to list\":`one of ${t.length} values too long to list`;if(t.length===1)return n;let o=t.length-r.length;return`one of ${r.join(\", \")}${o>0?` and ${o} more`:\"\"}`},dh=8,uh=360,Ou=(e,t)=>{let r=[];for(let o of e){if(r.length>0&&[...r,o].join(\" or \").length>uh)break;r.push(o)}let n=e.length-r.length;return`${[...r,...n>0?[`${n} more`]:[]].join(\" or \")}${t===void 0?\"\":`, told apart by ${Tu(t)}`}`},fh=e=>e===void 0?mu:`${mu}. Expected ${e}`,mu=\"Missing key\",U=e=>typeof e==\"object\"&&e!==null&&!Array.isArray(e),nr=e=>e===\"#\"||e===\"\"?[]:e.replace(/^#?\\//,\"\").split(\"/\").map(t=>decodeURIComponent(t).replace(/~1/g,\"/\").replace(/~0/g,\"~\")),Iu=(e,t)=>typeof t==\"string\"&&Object.hasOwn(e,t)?e[t]:void 0,Pu=(e,t)=>U(t)?Iu(e,Reflect.get(t,\"__absolute_ref__\")??t.$ref):void 0,ph=new Set([...Lo,...jo,\"dependencies\"]),lh=new Set([\"allOf\",\"anyOf\",\"oneOf\"]),mh=(e,t,r)=>{let n=(a,c)=>c===null&&U(a)&&a.$recursiveAnchor===!0?a:c,o=[...r],i=e,s=n(e,null);for(let a=o.shift();a!==void 0;a=o.shift()){if(!U(i))return;if(a===\"$recursiveRef\"){let c=s===null?Iu(t,Reflect.get(i,\"__absolute_recursive_ref__\")):s;s!==null&&(i=s),s=c;continue}if(a===\"$ref\")i=Pu(t,i);else{let c=Object.hasOwn(i,a)?i[a]:void 0;if(ph.has(a)||a===\"items\"&&Array.isArray(c)){let u=o.shift();if(u===void 0)return c;lh.has(a)&&i.$recursiveAnchor!==!0&&(s=null),i=Array.isArray(c)?/^\\d+$/.test(u)?c[Number(u)]:void 0:U(c)&&Object.hasOwn(c,u)?c[u]:void 0}else i=c}s=n(i,s)}return i},hu=e=>{if(!U(e))return\"object\";let t=U(e.properties)?Object.keys(e.properties):[],r=new Set(Array.isArray(e.required)?e.required:[]),n=e.additionalProperties!==!1||U(e.patternProperties)&&Object.keys(e.patternProperties).length>0;return t.length===0&&n?\"object\":Ru(t.map(o=>({name:o,optional:!r.has(o)})),n)},yu=e=>JSON.stringify(e),Cu={types:void 0,properties:new Map,required:new Set,closed:!1,values:void 0},_u=(e,t)=>e===void 0?t:t===void 0?e:e.filter(r=>t.some(n=>Bt(r,n))),Bo=e=>Array.isArray(e)?e.filter(t=>typeof t==\"string\"):[],hh=(e,t)=>new Set([...e].flatMap(r=>t.has(r)?[r]:r===\"number\"&&t.has(\"integer\")||r===\"integer\"&&t.has(\"number\")?[\"integer\"]:[])),Au=(e,t)=>({types:e.types===void 0?t.types:t.types===void 0?e.types:hh(e.types,t.types),properties:new Map([...e.properties,...t.properties]),required:new Set([...e.required,...t.required]),closed:e.closed||t.closed,values:_u(e.values,t.values)}),Ot=(e,t,r=new Set)=>{if(!U(e)||r.has(e))return Cu;let n=new Set([...r,e]),o={types:typeof e.type==\"string\"?new Set([e.type]):Array.isArray(e.type)?new Set(Bo(e.type)):void 0,properties:new Map(U(e.properties)?Object.entries(e.properties):[]),required:new Set(Bo(e.required)),closed:(e.additionalProperties===!1||e.unevaluatedProperties===!1)&&!(U(e.patternProperties)&&Object.keys(e.patternProperties).length>0),values:_u(Object.hasOwn(e,\"const\")?[e.const]:void 0,Array.isArray(e.enum)?e.enum:void 0)};return[t.referenced(e),...Array.isArray(e.allOf)?e.allOf:[]].reduce((i,s)=>Au(i,Ot(s,t,n)),o)},yh=\"a value with other constraints\",vu=(e,t)=>{if(e.values!==void 0)return Ei(e.values);let r=[...e.properties.keys(),...[...e.required].filter(o=>!e.properties.has(o))],n=r.length===0&&!e.closed?\"object\":Ru(r.map(o=>({name:o,optional:!e.required.has(o)})),!e.closed,t);return e.types===void 0?r.length>0||e.closed?n:yh:[...e.types].map(o=>o===\"object\"?n:o).join(\" or \")},$u=e=>vu(e,dh),gu=e=>e.values!==void 0||e.types!==void 0,gh=(e,t)=>{let r=t.referenced(e)??e;if(U(r)&&Object.hasOwn(r,\"oneOf\"))return;let n=Ot(e,t);if(gu(n))return vu(n,ku);let i=(U(r)&&Array.isArray(r.anyOf)?r.anyOf:[]).filter(s=>s!==!1).map(s=>Ot(s,t));return i.length===0||!i.every(gu)?void 0:Ou([...new Set(i.map($u))],void 0)},xh=160,Br=(e,t)=>`${e} ${t}${e===1?\"\":\"s\"}`,Eh=(e,t)=>{if(!U(t))return;let r=t[e];if(e===\"pattern\")return typeof r!=\"string\"?void 0:r.length<=xh?`Expected a string matching the pattern ${JSON.stringify(r)}`:\"Expected a string matching the schema's pattern, which is too long to show\";if(e===\"format\")return typeof r==\"string\"?`Expected a string in the ${JSON.stringify(r.slice(0,64))} format`:void 0;if(e===\"uniqueItems\")return\"Expected an array without repeated items\";if(typeof r==\"number\")switch(e){case\"minimum\":return`Expected a number of at least ${r}`;case\"maximum\":return`Expected a number of at most ${r}`;case\"exclusiveMinimum\":return`Expected a number greater than ${r}`;case\"exclusiveMaximum\":return`Expected a number less than ${r}`;case\"multipleOf\":return`Expected a multiple of ${r}`;case\"minLength\":return`Expected a string of at least ${Br(r,\"character\")}`;case\"maxLength\":return`Expected a string of at most ${Br(r,\"character\")}`;case\"minItems\":return`Expected an array of at least ${Br(r,\"item\")}`;case\"maxItems\":return`Expected an array of at most ${Br(r,\"item\")}`;case\"minProperties\":return`Expected an object with at least ${Br(r,\"key\")}`;case\"maxProperties\":return`Expected an object with at most ${Br(r,\"key\")}`;default:return}},Uu=(e,t,r,n=0)=>!U(t)||n>16?0:Object.entries(t).reduce((o,[i,s])=>{let a=e.properties.get(i);return a===void 0?o:o+1+Uu(Ot(a,r),s,r,n+1)},0),xu=e=>e===null?\"null\":Array.isArray(e)?\"array\":typeof e==\"object\"?\"object\":typeof e,bh=(e,t)=>{let r=xu(t);return e.values!==void 0?e.values.some(n=>xu(n)===r):e.types===void 0?!0:e.types.has(r)||r===\"number\"&&e.types.has(\"integer\")&&Number.isInteger(t)},wh=(e,t)=>t.reduce((r,n)=>Array.isArray(r)?r[Number(n)]:U(r)&&Object.hasOwn(r,n)?r[n]:void 0,e),Hu=e=>U(e)&&U(e.discriminator)?e.discriminator:void 0,Fu=e=>{if(typeof e!=\"string\"||!e.startsWith(\"#/\"))return;let t=nr(e),r=t.at(-2);return r===\"$defs\"||r===\"definitions\"||r===\"schemas\"&&t.at(-3)===\"components\"?t.at(-1):void 0},Sh=(e,t)=>{let r=Hu(e);if(r===void 0||typeof t!=\"string\")return;let{mapping:n}=r,o=U(n)&&Object.hasOwn(n,t)?n[t]:t;if(typeof o==\"string\")return/^[\\w.-]+$/.test(o)?o:Fu(o)},Th=(e,t,r)=>{let n=Hu(e)?.propertyName;if(typeof n==\"string\")return n;let[o]=t;if(!(o===void 0||t.length<2))return[...o.properties.keys()].find(i=>t.every(s=>s.properties.has(i)&&Ot(s.properties.get(i),r).values!==void 0))},kh=(e,t,r)=>{let n=`${e[t]?.keywordLocation}/`,o=new Map,i=(c,u)=>{let p=o.get(c),m=Array.isArray(r)?r.slice(c+1,u).filter(S=>S===!1).length:0;p!==void 0&&p.splice(p.length-m,m)},s=t+1,a=-1;for(;s<e.length;s++){let c=e[s];if(c===void 0)break;if(c.keywordLocation.startsWith(n)){let u=Number(c.keywordLocation.slice(n.length).split(\"/\")[0]);u!==a&&i(a,u),a=u}else if(c.keyword!==\"false\")break;a>=0&&o.set(a,[...o.get(a)??[],c])}return i(a,Array.isArray(r)?r.length:a),{alternatives:o,end:s}},Nu=e=>e.map(t=>/^\\d+$/.test(t)?Number(t):t),Rh=(e,t,r,n)=>{let o=nr(e.instanceLocation),i=Nu(o);if(!Array.isArray(t))return[{path:i,issue:`Failed the \"${e.keyword}\" constraint`},...[...r.values()].flatMap(_=>mi(_,n))];let s=t.flatMap((_,F)=>_===!1?[]:[{schema:_,matched:!r.has(F),problems:()=>mi(r.get(F)??[],n)}]),[a]=s;if(a===void 0)return[{path:i,issue:\"No value is allowed here\"}];if(s.length===1)return a.problems();let c=n.schemaAt(nr(e.keywordLocation).slice(0,-1)),u=Ot(c,n),p=s.map(({schema:_})=>Ot(_,n)),m=p.map(_=>Au(u,_)),S=Th(c,p,n),h=`Expected ${Ou(m.map($u),S)}`,l=s.filter(_=>_.matched).length;if(e.keyword===\"oneOf\"&&l>1)return[{path:i,issue:`${h}. Exactly one may match, but ${l} do`}];let g=m.flatMap(({values:_})=>_===void 0?[]:[_]);if(g.length===m.length)return[{path:i,issue:e.keyword===\"oneOf\"?`${h}. Exactly one alternative must match`:`Expected ${Ei(g.flat())}`}];let P=wh(n.input,o),z=S!==void 0&&U(P)&&Object.hasOwn(P,S)?{value:P[S]}:void 0,xe=Sh(c,z?.value),H=s.map(({schema:_,problems:F},G)=>{let W=m[G]??Cu,ne=p[G]?.properties.get(S??\"\");return{index:G,problems:F(),selected:z!==void 0&&(xe!==void 0&&U(_)&&Fu(_.$ref)===xe||ne!==void 0&&Ot(ne,n).values!==void 0&&n.accepts(ne,z.value)),typed:bh(W,P),overlap:Uu(W,P,n)}}).reduce((_,F)=>([Number(F.selected)-Number(_.selected),Number(F.typed)-Number(_.typed),F.overlap-_.overlap,_.problems.length-F.problems.length].find(G=>G!==0)??0)>0?F:_);return H.selected||H.typed?[{path:i,issue:`${h}. Closest is alternative ${H.index+1}, whose problems follow`},...H.problems]:[{path:i,issue:h}]},mi=(e,t)=>{let r=new Map,n=[];for(let o=0;o<e.length;o++){let i=e[o];if(i===void 0)break;let{keyword:s,instanceLocation:a,keywordLocation:c}=i;if(s===\"anyOf\"||s===\"oneOf\"){let g=t.schemaAt(nr(c)),{alternatives:P,end:z}=kh(e,o,g);n.push(...Rh(i,g,P,t)),o=z-1;continue}let u=nr(a),p=Nu(u),m=(g,P=p)=>n.push({path:P,issue:g}),S=()=>t.schemaAt(nr(c).slice(0,-1));if(s===\"additionalProperties\"||s===\"unevaluatedProperties\"){r.set(yu(u),S());continue}if(sh.has(s))continue;if(s===\"false\"){let g=u.at(-1),P=yu(u.slice(0,-1));g===void 0||!r.has(P)?m(\"No value is allowed here\"):m(`Unexpected key${Su(g)?` \"${g}\"`:\"\"}. Expected ${hu(r.get(P))}`,p.slice(0,-1));continue}let h=s===\"required\"?/required property \"([^\"]*)\"/.exec(i.error):null;if(h!==null){let g=h[1]??\"\",P=Ot(S(),t).properties.get(g);m(fh(P===void 0?void 0:gh(P,t)),[...p,g]);continue}let l=s===\"type\"?/Expected \"([^.]*)\"\\.?$/.exec(i.error):null;if(l!==null){let g=(l[1]??\"\").split('\", \"').map(P=>P===\"object\"?hu(S()):P);m(`Expected ${g.join(\" or \")}`);continue}if(s===\"const\"||s===\"enum\"){let g=S(),P=U(g)?s===\"const\"?Object.hasOwn(g,\"const\")?[g.const]:void 0:Array.isArray(g.enum)?g.enum:void 0:void 0;m(P===void 0?\"Expected one of the allowed values\":`Expected ${Ei(P)}`);continue}m(Eh(s,S())??`Failed the \"${s}\" constraint`)}return n},Oh=e=>{let t=new Set,r=!1,n=(o,i)=>{if(i>64||typeof o!=\"object\"||o===null)return;if(Array.isArray(o)){for(let a of o)n(a,i+1);return}let s=o;if(U(s.properties))for(let a of Object.keys(s.properties))t.add(a);for(let a of Bo(s.required))t.add(a);if(U(s.dependentRequired))for(let[a,c]of Object.entries(s.dependentRequired)){t.add(a);for(let u of Bo(c))t.add(u)}(U(s.patternProperties)&&Object.keys(s.patternProperties).length>0||U(s.additionalProperties)||U(s.unevaluatedProperties))&&(r=!0);for(let a of Object.values(s))n(a,i+1)};return n(e,0),o=>r||t.has(o)},Mu=new WeakMap,Bx=e=>Mu.get(e),Ih=(e,t)=>{let r=mi(e,t);return r.length===0?!1:r},Ph=e=>f.gen(function*(){let t=yield*f.try({try:()=>{let o=e.$schema===\"http://json-schema.org/draft-07/schema#\"||e.$schema===\"https://json-schema.org/draft-07/schema\"?\"7\":\"2020-12\",i=kn(e);if(i===null||typeof i!=\"object\"||Array.isArray(i))throw new ot;let s=Ye(i);for(let c of wu(i,s)){for(let u of[c.pattern,...Object.keys(c.patternProperties??{})])if(u!==void 0)try{new RegExp(u,\"u\")}catch(p){if(!(p instanceof SyntaxError))throw p;new RegExp(u)}for(let u of[c.__absolute_ref__,c.__absolute_recursive_ref__])if(u!==void 0&&s[u]===void 0)throw new ot}return{validate:c=>V(c,i,o,s),inspection:c=>({schemaAt:u=>mh(i,s,u),referenced:u=>Pu(s,u),accepts:(u,p)=>{if(typeof u!=\"boolean\"&&!U(u))return!1;try{return V(p,u,o,s).valid}catch{return!1}},input:c})}},catch:()=>new ot}),r=d.makeFilter(o=>{try{let i=t.validate(o);return i.valid||Ih(i.errors,t.inspection(o))}catch{return!1}},{expected:\"a value matching a supported imported JSON Schema\"});Mu.set(r,Oh(e));let n=d.Json.check(r);return Object.assign(n,{[Rn]:e})}),Du=e=>{let t=Eu(e),r,n=f.suspend(()=>r??Ph(t()).pipe(f.onExit(i=>f.sync(()=>{(Jt.isSuccess(i)||!Ce.hasInterrupts(i.cause))&&(r=i)})))),o=d.declareConstructor()([],()=>(i,s,a)=>n.pipe(f.mapError(()=>new to.InvalidValue({message:\"Unsupported JSON Schema\"})),f.flatMap(c=>is.decodeUnknownEffect(c)(i,a))));return{decoder:eh(o,t),compile:n}},Bu=e=>Du(e).decoder,Ch=e=>f.sync(()=>Bu(e)),Lx=e=>Du(()=>e),_h=d.is(d.Json),Lu=e=>{if(typeof e!=\"object\"||e===null||Array.isArray(e))return;let t=Object.keys(e),r=t.map(o=>Reflect.get(e,o));if(!_h(r))return;let n={};return t.forEach((o,i)=>Object.defineProperty(n,o,{value:r[i],enumerable:!0,writable:!0,configurable:!0})),n},jx=e=>f.suspend(()=>{let t=Lu(e);return t===void 0?f.fail(new ot):Ch(()=>t)}),Vx=e=>{let t=Lu(e);if(t===void 0)throw new ot;return Xe(Bu(()=>t),!1)},qx=e=>{let t=Zm(e);if(t!==void 0)return d.decodeUnknownEffect(ms)(t);let r=d.toJsonSchemaDocument(e);return d.decodeUnknownEffect(ms)({...r.schema,$defs:r.definitions,$schema:\"https://json-schema.org/draft/2020-12/schema\"})};var wi=d.String.check(d.isPattern(/^[A-Za-z0-9._-]{1,128}$/u)),Ah=d.Struct({error:d.Struct({code:d.Union([d.Int,wi]),message:d.String})}),vh=d.Struct({error:wi,error_description:d.optional(d.String)}),$h=e=>e.length<=oo?e:`${e.slice(0,oo-1)}\\u2026`,Gx=e=>e.length===oo&&e.endsWith(\"\\u2026\"),bi=(e,t)=>({code:e,...t===void 0||t===\"\"?{}:{message:$h(t)}}),Yx=e=>{let t=d.decodeUnknownOption(Ah)(e);if(v.isSome(t))return bi(t.value.error.code,t.value.error.message);let r=d.decodeUnknownOption(vh)(e);if(v.isSome(r))return bi(r.value.error,r.value.error_description)},Uh=/([A-Za-z][A-Za-z0-9_-]*)\\s*=\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|([^\\s,\"]+))/g,ju=e=>{let t=e===void 0?-1:e.search(/\\bBearer\\b/i);if(e===void 0||t===-1)return;let r=new Map;for(let[,o,i,s]of e.slice(t+6).matchAll(Uh))o!==void 0&&!r.has(o.toLowerCase())&&r.set(o.toLowerCase(),i?.replace(/\\\\(.)/g,\"$1\")??s??\"\");let n=d.decodeUnknownOption(wi)(r.get(\"error\"));return v.isNone(n)?void 0:bi(n.value,r.get(\"error_description\"))};var It=({reason:e,status:t,accountId:r,phase:n,upstream:o})=>new Er({reason:e,...t===void 0?{}:{status:t},...r===void 0?{}:{accountId:r},...n===void 0?{}:{phase:n},...o===void 0?{}:{upstream:o}});function Hh(e){return d.decodeUnknownOption(Er)(e).pipe(v.map(It))}function rE(e,t){return It({...e,phase:e.phase??t.phase,upstream:e.upstream??t.upstream})}function nE(e,t={}){let r=ju(t[\"www-authenticate\"]);if(e>=500&&e<=599)return It({reason:\"unavailable\",status:e,upstream:r});if(e===401)return It({reason:\"unauthorized\",status:e,upstream:r});if(e===429)return It({reason:\"rate_limited\",status:e,upstream:r});if(e!==403)return;let n=t[\"retry-after\"];return t[\"x-ratelimit-remaining\"]===\"0\"||n!==void 0&&(/^\\d+$/.test(n)||Number.isFinite(Date.parse(n)))?It({reason:\"rate_limited\",status:e,upstream:r}):typeof r?.code==\"string\"&&r.code.toLowerCase()===\"insufficient_scope\"?It({reason:\"forbidden\",status:e,upstream:r}):It({reason:\"rejected\",status:e,upstream:r})}function oE(e,t){let r=Hh(e),n=d.decodeUnknownOption(Cc)(t);return v.isNone(r)||v.isNone(n)?e:It({...r.value,accountId:n.value})}function sE(e,t){let r=e.flatMap(n=>{let o=d.decodeUnknownOption(d.Struct({type:d.optional(d.String),extensions:d.optional(d.Struct({code:d.optional(d.String)}))}))(n);return v.isSome(o)?[o.value.type,o.value.extensions?.code]:[]});if(r.includes(\"RATE_LIMITED\")||r.includes(\"TOO_MANY_REQUESTS\"))return new Er({reason:\"rate_limited\",status:t});if(r.includes(\"UNAUTHENTICATED\"))return new Er({reason:\"unauthorized\",status:t});if(r.includes(\"FORBIDDEN\"))return new Er({reason:\"forbidden\",status:t})}export{wt as a,Be as b,le as c,it as d,mn as e,Vs as f,Yp as g,Zp as h,Td as i,el as j,tl as k,hm as l,Em as m,Gg as n,Yg as o,Xg as p,yi as q,Gm as r,gi as s,li as t,Ix as u,Xe as v,Px as w,Cx as x,_x as y,Ax as z,vx as A,$x as B,Ux as C,Hx as D,Fx as E,Nx as F,Mx as G,Zm as H,Eu as I,eh as J,th as K,Dx as L,Su as M,Ru as N,Ei as O,dh as P,Ou as Q,fh as R,mu as S,Bx as T,Ch as U,Lx as V,jx as W,Vx as X,qx as Y,Gx as Z,Yx as _,It as $,Hh as aa,rE as ba,nE as ca,oE as da,sE as ea};\n","node_modules/apps/chunk-DI7JLZ3C.js":"import{$c as te,Ac as cn,Ae as Uo,C as tn,Cc as pn,F as on,G as rn,Ga as Nt,Ic as ln,J as an,Jc as Mo,Kc as Ko,L as qt,Lc as Io,Mc as mn,Nc as un,Oc as ut,Pc as Fo,Q as Z,Qc as qo,Rb as Oo,Rc as Dt,Sc as No,Ta as nn,Tc as a,Uc as w,Vc as Do,Wc as i,Xc as F,Yc as Po,Zc as m,_c as v,a as Ya,ba as mt,bd as dn,cd as yn,dd as Sn,e as bo,ed as f,f as Ho,fd as g,gd as O,hd as dt,id as N,jd as Pt,je as fn,ld as Ut,md as u,nd as ke,pd as yt,qd as E,rd as e,re as xn,we as gn,xd as hn,yc as Co,z as en,zc as sn}from\"./chunk-IRY5FGME.js\";var Wi=2048,Bi=e.Literals([\"app\",\"storage\",\"service\"]),_o=e.String.check(e.isMaxLength(128)),Ji=e.String.check(e.isMaxLength(128)),Wo=e.String.check(e.isMaxLength(Wi)),zi=8,$i=256,ji=e.String.check(e.isPattern(/^[A-Za-z_$][A-Za-z0-9_$]{0,63}$/)),Vi=e.Union([e.String.check(e.isMaxLength($i)),e.Finite,e.Boolean]),Gi=e.Record(ji,Vi).check(e.isMaxProperties(zi)),_t={source:e.optionalKey(Bi),errorName:e.optionalKey(_o),code:e.optionalKey(Ji),message:e.optionalKey(Wo),fields:e.optionalKey(Gi)},Zi=1024,Ge=e.Struct({code:e.Union([e.Int,e.String.check(e.isMinLength(1),e.isMaxLength(128))]),message:e.optionalKey(e.String.check(e.isMaxLength(Zi)))}),kn=e.Literals([\"connect\",\"discover\",\"call\"]);var k=e.Json,S=e.Record(e.String,k),D=e.String.pipe(e.check(e.isStartingWith(\"acc_\"),e.isMinLength(5)),e.brand(\"acc\")),R=e.String.check(e.makeFilter(t=>{try{let o=new URL(t);return o.protocol===\"https:\"||o.protocol===\"http:\"}catch{return!1}})),Qi=e.Struct({path:e.Array(e.String),message:e.String}),Rn=class extends e.TaggedError()(\"DeclarationInvalid\",{declaration:e.String,issues:e.Array(Qi)}){get message(){let o=this.issues.map(n=>n.path.length===0?n.message:`${n.path.join(\".\")}: ${n.message}`);return`The ${this.declaration} declaration is invalid. ${o.join(\"; \")}`}},En=class extends e.TaggedError()(\"ValidationError\",{}){get message(){return\"Value did not match the schema\"}};var P=class extends e.TaggedError()(\"ProviderError\",{reason:e.Literals([\"unauthorized\",\"forbidden\",\"rate_limited\",\"unavailable\",\"rejected\"]),status:e.optional(e.Int.check(e.isBetween({minimum:100,maximum:599}))),accountId:e.optional(D),phase:e.optional(kn),upstream:e.optional(Ge)}){};var Tn=4096,Xi=e.Struct({action:e.NonEmptyString.check(e.isMaxLength(1024)),instructions:e.NonEmptyString.check(e.isMaxLength(Tn))}),vn=4096,An=e.Struct({code:e.NonEmptyString.check(e.isMaxLength(128)),status:e.Int.check(e.isBetween({minimum:400,maximum:599})),message:e.NonEmptyString.check(e.isMaxLength(vn)),recovery:e.optionalKey(Xi)}),Re=class extends e.TaggedError()(\"OpenapiResponseError\",An.fields){},Yi=e.Struct({maxBodyBytes:e.Int.check(e.isGreaterThan(0)),readTimeoutMs:e.Int.check(e.isGreaterThan(0))}),um=Yi.make({maxBodyBytes:65536,readTimeoutMs:2e3});var wn=e.Union([e.Struct({reason:e.Literal(\"private_address\")}),e.Struct({reason:e.Literal(\"credential_host\"),provider:e.String,allowedHosts:e.Array(e.String)}),e.Struct({reason:e.Literal(\"credential_app\")}),e.Struct({reason:e.Literal(\"credential_expired\"),provider:e.String}),e.Struct({reason:e.Literal(\"credential_placement\"),provider:e.String,location:e.String}),e.Struct({reason:e.Literal(\"credential_transport\"),provider:e.String}),e.Struct({reason:e.Literal(\"credential_method\"),method:e.String})]),St=class extends e.TaggedError()(\"NetworkRefused\",{host:e.String,refusal:wn}){get message(){let o=this.refusal;switch(o.reason){case\"private_address\":return`Executor refused a request to ${this.host}: apps on this instance can reach only public addresses, and ${this.host} is a private, loopback or internal address. The request was not sent.`;case\"credential_host\":return o.allowedHosts.length===0?`Executor refused this request: ${o.provider} credentials cannot be sent to ${this.host}: the provider declares no hosts.`:`Executor refused this request: ${o.provider} credentials cannot be sent to ${this.host}. The provider allows: ${o.allowedHosts.join(\", \")}.`;case\"credential_app\":return\"Executor refused this request: it carries a credential handle that is not valid for this app. Use the account fields this invocation received.\";case\"credential_expired\":return`Executor refused this request: it carries an expired ${o.provider} credential handle. Use the account fields this invocation received.`;case\"credential_placement\":return`Executor refused this request: it carries a ${o.provider} credential handle in the ${o.location}, where the provider does not place it. Send credentials only as the provider's request declares, for example with the account's headers() and url().`;case\"credential_transport\":return`Executor refused this request: ${o.provider} credentials are sent only over HTTPS, and ${this.host} was requested over plain HTTP.`;case\"credential_method\":return`Executor refused this request: credential handles are never sent with ${o.method}, which asks the service to echo the request back.`}}},Ln=421,bn=\"x-executor-refused\",ec=e.StringFromUriComponent.pipe(e.decodeTo(e.fromJsonString(St))),tc=e.encodeSync(St),oc=e.encodeSync(ec),rc=t=>new Response(JSON.stringify({...tc(t),message:t.message}),{status:Ln,statusText:\"Refused by Executor\",headers:{\"content-type\":\"application/json; charset=utf-8\",[bn]:oc(t)}}),ac=e.Literals([\"redirect\",\"cache\",\"integrity\"]),Sm={redirect:[\"follow\",\"manual\"],cache:[\"no-store\",\"no-cache\"],integrity:[\"\"]},Bo=class extends e.TaggedError()(\"FetchOptionUnsupported\",{option:ac,value:e.String,supported:e.Array(e.String)}){get message(){let o=this.supported.map(n=>JSON.stringify(n)).join(\" or \");return`fetch option ${this.option}: ${JSON.stringify(this.value)} is not supported by Executor's app runtime. Use ${o}, or omit ${this.option}.${this.advice}`}get advice(){switch(this.option){case\"redirect\":return this.value===\"error\"?' To reject redirects, send redirect: \"manual\" and treat a 3xx response as the error.':\"\";case\"cache\":return\"\";case\"integrity\":return\" To check a digest, read the body and hash it with crypto.subtle.digest.\"}}};var ht=t=>o=>{let n=Object.entries(t).filter(p=>typeof p[1]==\"string\"),s={};for(let p of Object.keys(o.fields)){let c=e.toEncoded(o.fields[p]),y=t[p];s[p]=typeof y==\"string\"?e.optionalKey(c):c,typeof y==\"string\"&&(s[y]=e.optionalKey(c))}return e.Struct(s).pipe(e.decodeTo(o,pn.transform({decode:p=>{let c={...p};for(let[y,x]of n)!Object.hasOwn(c,y)&&Object.hasOwn(c,x)&&(c[y]=c[x]),delete c[x];return c},encode:p=>{let c={...p};for(let[y,x]of n)Object.hasOwn(c,y)&&(c[x]=c[y]);return c}})))};var Ee=e.NonEmptyString.pipe(e.brand(\"wfr\")),oe=e.NonEmptyString.check(e.isMaxLength(200)),nc={millisecond:1,milliseconds:1,second:1e3,seconds:1e3,minute:6e4,minutes:6e4,hour:36e5,hours:36e5,day:864e5,days:864e5,week:6048e5,weeks:6048e5},sc=t=>{if(typeof t==\"number\")return Number.isFinite(t)&&t>=0?t:void 0;let o=/^(\\d+(?:\\.\\d+)?) (milliseconds?|seconds?|minutes?|hours?|days?|weeks?)$/.exec(t),n=o?.[2]===void 0?void 0:nc[o[2]];if(n===void 0)return;let s=Number(o?.[1])*n;return Number.isFinite(s)?s:void 0},Jo=e.Union([e.Finite.check(e.isGreaterThanOrEqualTo(0)),e.NonEmptyString]).check(e.makeFilter(t=>sc(t)!==void 0)),ic=e.Struct({retries:e.optionalKey(e.Struct({limit:e.Int.check(e.isGreaterThanOrEqualTo(0)),delay:Jo,backoff:e.optionalKey(e.Literals([\"constant\",\"linear\",\"exponential\"]))})),timeout:e.optionalKey(Jo)}),On={step:e.optionalKey(e.String.check(e.isMaxLength(200))),errorName:e.optionalKey(_o),message:e.optionalKey(Wo)},cc=e.Struct(On),re=class extends e.TaggedError()(\"WorkflowFailure\",{...On,reason:e.Literals([\"unavailable\",\"not_found\",\"input\",\"output\",\"operation\",\"approval\",\"credentials\",\"terminated\",\"execution\",\"conflict\",\"engine\"]),retryable:e.Boolean}){get[xn](){return this.step===void 0&&this.errorName===void 0&&!this.message?void 0:`The workflow failed (${this.reason}); the app's error is not recorded`}},Hn=class extends Error{name=\"NonRetryableError\"},Cn=k.check(e.makeFilter(t=>new TextEncoder().encode(JSON.stringify(t)).byteLength<=1024*1024)),vm=e.Struct({name:oe,description:e.optionalKey(e.String),inputSchema:S,outputSchema:e.optionalKey(S)}),Wt={id:Ee,app:e.NonEmptyString,version:e.NonEmptyString,workflow:oe,createdAt:e.String},pc=e.Union([e.Struct({...Wt,status:e.Literals([\"queued\",\"running\",\"waiting\",\"paused\",\"waitingForPause\"])}).pipe(ht({version:\"deployment\"})),e.Struct({...Wt,status:e.Literal(\"complete\"),output:Cn}).pipe(ht({version:\"deployment\"})),e.Struct({...Wt,status:e.Literal(\"errored\"),error:re.fields.reason,failure:e.optionalKey(cc)}).pipe(ht({version:\"deployment\"})),e.Struct({...Wt,status:e.Literal(\"terminated\")}).pipe(ht({version:\"deployment\"}))]),Am=e.Struct({items:e.Array(pc),next:e.optionalKey(Ee)}),Mn=e.Struct({key:e.NonEmptyString,fingerprint:e.NonEmptyString}),Kn=e.Union([e.Struct({operation:e.Literal(\"workflows\")}),e.Struct({operation:e.Literal(\"workflow-validate\"),name:oe,input:k}),e.Struct({operation:e.Literal(\"workflow-run\"),name:oe,input:k})]),In=e.Union([e.Struct({operation:e.Literal(\"do\"),name:oe,options:ic}),e.Struct({operation:e.Literal(\"sleep\"),name:oe,duration:Jo}),e.Struct({operation:e.Literal(\"until\"),name:oe,timestamp:e.Finite}),e.Struct({operation:e.Literal(\"context\")}),e.Struct({operation:e.Literal(\"invoke\"),kind:e.Literals([\"query\",\"mutation\"]),name:e.NonEmptyString,input:k,stepId:e.NonEmptyString,timeout:e.Finite.check(e.isGreaterThanOrEqualTo(0))})]),Fn=e.Union([e.Struct({ok:e.Literal(!0),value:k}),e.Struct({ok:e.Literal(!1),error:re})]),qn=e.Union([e.Struct({operation:e.Literal(\"start\"),workflow:oe,input:Cn,key:e.optionalKey(e.NonEmptyString.check(e.isMaxLength(128)))}),e.Struct({operation:e.Literal(\"get\"),run:Ee}),e.Struct({operation:e.Literal(\"list\"),workflow:e.optionalKey(oe),cursor:e.optionalKey(Ee),limit:e.optionalKey(e.Int.check(e.isBetween({minimum:1,maximum:100})))}),e.Struct({operation:e.Literal(\"terminate\"),run:Ee})]);var K=e.String.check(e.makeFilter(t=>/^[A-Za-z][A-Za-z0-9_]*$/.test(t)&&t.length<=128)),Bt=e.Union([e.String,e.Finite,e.Boolean]),lc=e.Struct({kind:e.Literals([\"string\",\"number\",\"boolean\",\"id\",\"userId\"]),optional:e.optional(e.Boolean),default:e.optional(Bt),references:e.optional(K)}),mc=e.Struct({name:K,fields:e.NonEmptyArray(K)}),uc=e.Struct({fields:e.Record(K,lc),indexes:e.Array(mc)}),Pn=e.Record(K,uc),zo=e.Record(e.String,Bt),bm=e.Struct({id:e.NonEmptyString,createdAt:e.String,updatedAt:e.String}),Nn=e.Record(K,e.NullOr(Bt)),dc=e.Struct({field:K,op:e.Literals([\"eq\",\"gt\",\"gte\",\"lt\",\"lte\"]),value:e.NullOr(Bt)}),yc=e.Struct({table:K,index:K,order:e.Literals([\"asc\",\"desc\"]),clauses:e.Array(dc)}),Sc=e.Union([e.Struct({kind:e.Literal(\"collect\")}),e.Struct({kind:e.Literal(\"count\")}),e.Struct({kind:e.Literal(\"first\")}),e.Struct({kind:e.Literal(\"take\"),count:e.Int.check(e.isGreaterThanOrEqualTo(0))}),e.Struct({kind:e.Literal(\"paginate\"),cursor:e.NullOr(e.String),numItems:e.Int.check(e.isGreaterThan(0))})]),Hm=e.Union([e.Struct({kind:e.Literal(\"get\"),table:K,id:e.NonEmptyString}),e.Struct({kind:e.Literal(\"insert\"),table:K,value:Nn}),e.Struct({kind:e.Literal(\"update\"),table:K,id:e.NonEmptyString,patch:Nn}),e.Struct({kind:e.Literal(\"delete\"),table:K,id:e.NonEmptyString}),e.Struct({kind:e.Literal(\"query\"),plan:yc,terminal:Sc})]),hc=e.Struct({page:e.Array(zo),continueCursor:e.NullOr(e.String),isDone:e.Boolean}),Om=e.Union([zo,e.Array(zo),hc,e.Boolean,e.Finite,e.Null]),Dn=class extends e.TaggedError()(\"AppDatabaseError\",{reason:e.Literals([\"schema\",\"schema_changed\",\"table\",\"index\",\"range\",\"value\",\"readonly\",\"cursor\",\"limit\",\"closed\",\"storage\",\"replay\"])}){},Cm=e.Struct({rowsRead:e.Int.check(e.isGreaterThan(0)),rowsReturned:e.Int.check(e.isGreaterThan(0)),bytesRead:e.Int.check(e.isGreaterThan(0)),writes:e.Int.check(e.isGreaterThan(0)),scanCalls:e.Int.check(e.isGreaterThan(0)),directGets:e.Int.check(e.isGreaterThan(0)),valueBytes:e.Int.check(e.isGreaterThan(0)),indexBytes:e.Int.check(e.isGreaterThan(0))}),Mm={rowsRead:5e3,rowsReturned:1e3,bytesRead:4*1024*1024,writes:1e3,scanCalls:100,directGets:1e3,valueBytes:64*1024,indexBytes:2048},fc=e.Literals([\"scanCalls\",\"directGets\",\"rowsRead\",\"rowsReturned\",\"pageSize\",\"bytesRead\",\"writes\",\"valueBytes\"]),L=t=>t.toLocaleString(\"en-US\"),xc={scanCalls:(t,o)=>`This invocation made ${L(o)} index queries; the limit is ${L(t)}. Each first(), take(), collect(), count() or paginate() call on withIndex(...) counts once. Read related rows with one take() or paginate() over a shared index prefix instead of one first() per item, use get(id) for known IDs, or split the work across workflow steps.`,directGets:(t,o)=>`This invocation made ${L(o)} get(id) calls, including those made by update and delete; the limit is ${L(t)}. Split the work across workflow steps or mutations.`,rowsRead:(t,o)=>`This invocation read ${L(o)} rows; the limit is ${L(t)}. Read fewer rows per call, through an index or a LIMIT, or split the work across calls or workflow steps.`,rowsReturned:(t,o)=>`This invocation returned ${L(o)} rows; the limit is ${L(t)}. collect() fails rather than truncating. Page with paginate() across calls or workflow steps.`,pageSize:(t,o)=>`One call asked for ${L(o)} rows; take(n) and paginate({ numItems }) accept at most ${L(t)}. Page with paginate() across calls or workflow steps.`,bytesRead:(t,o)=>`This invocation read ${L(o)} bytes; the limit is ${L(t)}. Read fewer or smaller rows per call, or page with paginate() across calls or workflow steps.`,writes:(t,o)=>`This invocation wrote ${L(o)} rows; the limit is ${L(t)}. Split large ingests into batches, one batch per mutation or workflow step.`,valueBytes:(t,o)=>`A row encodes to ${L(o)} bytes; each row may use at most ${L(t)}. Store large content outside the row or split it across rows.`},Te=class extends e.TaggedError()(\"DatabaseLimitExceeded\",{limit:fc,maximum:e.Int,requested:e.Int}){get message(){return xc[this.limit](this.maximum,this.requested)}},gc=[\"id\",\"createdAt\",\"updatedAt\"],ve=class extends e.TaggedError()(\"DatabaseFieldReserved\",{table:e.String,field:e.Literals(gc)}){get message(){return`Table \"${this.table}\" declares \"${this.field}\", which is reserved: the host adds id, createdAt and updatedAt to every row. Rename the field, or use the row's own ${this.field}.`}},kc=e.Struct({maxCursorChars:e.Int.check(e.isGreaterThan(0)),connectionCacheCapacity:e.Int.check(e.isGreaterThan(0)),connectionCacheTtlMs:e.Int.check(e.isGreaterThan(0))}),Km=kc.make({maxCursorChars:8192,connectionCacheCapacity:64,connectionCacheTtlMs:300*1e3});var Fm=\"_executor_\",qm=\"migrations\";var Un=\"~effect/rpc/RpcSchema/StreamSchema\";var Rc=ln(hn);function _n(t,o){return Mo(Rc.ast,{[Un]:Un,success:t,error:o})}var Wn=\"~effect/rpc/Rpc\";var Tc={[Wn]:Wn,pipe(){return Ya(this,arguments)},setSuccess(t){return le({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:t,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(t){return le({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:t,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(t){return le({_tag:this._tag,payloadSchema:Ko(t)?t:i(t),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(t){return le({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,t])})},prefix(t){return le({_tag:`${t}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(t,o){return le({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:rn(this.annotations,t,o)})},annotateMerge(t){return le({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:an(this.annotations,t)})}},le=t=>{function o(){}return Object.setPrototypeOf(o,Tc),Object.assign(o,t),o.key=`effect/rpc/Rpc/${t._tag}`,o},C=(t,o)=>{let n=o?.success??Do,s=o?.error??qo,p=o?.defect??Pt(),c;return o?.primaryKey?c=class extends u(`effect/rpc/Rpc/${t}`)(o.payload){[fn](){return o.primaryKey(this)}}:c=Ko(o?.payload)?o?.payload:o?.payload?i(o?.payload):Do,le({_tag:t,payloadSchema:c,successSchema:o?.stream?_n(n,s):n,errorSchema:o?.stream?qo:s,defectSchema:p,annotations:on(),middlewares:new Set})};var ft=(t,o)=>{let n=nn(o);return Io(t).pipe(yn({decode:cn(n),encode:Co()}),Sn(n))},r=t=>Io(t).pipe(dn(un(mn(t)),{decode:Co(),encode:sn(tn(en))})),wc=v([a,O]),cs=v([a,O]),q=class extends g()(i({_meta:r(Po(i({progressToken:r(cs)}),[E]))})){},Q=class extends g()(i({_meta:r(E)})){},Ze=class extends g()(i({_meta:r(E)})){},ps=a,Bn=class extends g()(i({...q.fields,cursor:r(ps)})){},Qe=class extends g()(i({...Q.fields,nextCursor:r(ps)})){},eo=te([\"user\",\"assistant\"]),me=class extends g()(i({audience:r(m(eo)),priority:r(O.check(dt({minimum:0,maximum:1}))),lastModified:r(a)})){},Ae=class extends u(\"@effect/ai/McpSchema/Icon\")({src:a,mimeType:r(a),sizes:r(m(a)),theme:r(te([\"light\",\"dark\"]))}){},Jt=class extends g()(i({name:a,title:r(a),version:a,icons:r(m(Ae)),description:r(a),websiteUrl:r(a)})){},$o=class extends u(\"@effect/ai/McpSchema/ClientCapabilities\")({experimental:r(F(a,i({}))),extensions:r(F(Fo([a,\"/\",a]),yt)),roots:r(i({listChanged:r(w)})),sampling:r(i({context:r(i({})),tools:r(i({}))})),elicitation:r(i({form:r(i({})),url:r(i({}))}))}){},jo=class extends g()(i({experimental:r(F(a,i({}))),extensions:r(F(Fo([a,\"/\",a]),yt)),logging:r(i({})),completions:r(i({})),prompts:r(i({listChanged:r(w)})),resources:r(i({subscribe:r(w),listChanged:r(w)})),tools:r(i({listChanged:r(w)}))})){},ue=class extends u(\"@effect/ai/McpSchema/McpErrorBase\")({code:N,message:a,data:r(Dt)}){},Lc=-32600,bc=-32601,Hc=-32602,Oc=-32603,Cc=-32700;var Vo=class extends ke(\"effect/ai/McpSchema/ParseError\")({...ue.fields,_tag:f(\"ParseError\"),code:f(Cc)}){},Go=class extends ke(\"effect/ai/McpSchema/InvalidRequest\")({...ue.fields,_tag:f(\"InvalidRequest\"),code:f(Lc)}){},Zo=class extends ke(\"effect/ai/McpSchema/MethodNotFound\")({...ue.fields,_tag:f(\"MethodNotFound\"),code:f(bc)}){},Qo=class extends ke(\"effect/ai/McpSchema/InvalidParams\")({...ue.fields,_tag:f(\"InvalidParams\"),code:f(Hc)}){},Xo=class t extends ke(\"effect/ai/McpSchema/InternalError\")({...ue.fields,_tag:f(\"InternalError\"),code:f(Oc)}){static notImplemented=new t({message:\"Not implemented\"})},ne=v([Vo,Go,Zo,Qo,Xo,ue]);var Yo=class extends g()(i({...Q.fields,protocolVersion:a,capabilities:jo,serverInfo:Jt,instructions:r(a)})){},Jn=class extends C(\"initialize\",{success:Yo,error:ne,payload:{...q.fields,protocolVersion:a,capabilities:$o,clientInfo:Jt}}){};var zn=class extends C(\"notifications/cancelled\",{payload:{...Ze.fields,requestId:wc,reason:r(a)}}){},$n=class extends C(\"notifications/progress\",{payload:{...Ze.fields,progressToken:cs,progress:O,total:r(O),message:r(a)}}){},zt=class extends u(\"@effect/ai/McpSchema/Resource\")({uri:a,name:a,title:r(a),description:r(a),mimeType:r(a),annotations:r(me),icons:r(m(Ae)),size:r(N),_meta:r(E)}){},er=class extends u(\"@effect/ai/McpSchema/ResourceTemplate\")({uriTemplate:a,name:a,title:r(a),description:r(a),mimeType:r(a),annotations:r(me),icons:r(m(Ae)),_meta:r(E)}){},$t=class extends g()(i({uri:a,mimeType:r(a),_meta:r(E)})){},jt=class extends g()(i({...$t.fields,text:a})){},Vt=class extends g()(i({...$t.fields,blob:Ut})){},jn=class extends u(\"@effect/ai/McpSchema/ListResourcesResult\")({...Qe.fields,resources:m(zt)}){};var Vn=class extends u(\"@effect/ai/McpSchema/ListResourceTemplatesResult\")({...Qe.fields,resourceTemplates:m(er)}){};var tr=class extends g()(i({...Q.fields,contents:m(v([jt,Vt]))})){},Gn=class extends C(\"resources/read\",{success:tr,error:ne,payload:{...q.fields,uri:a}}){};var Zn=class extends C(\"resources/subscribe\",{success:i({}),error:ne,payload:{...q.fields,uri:a}}){},Qn=class extends C(\"resources/unsubscribe\",{success:i({}),error:ne,payload:{...q.fields,uri:a}}){},Xn=class extends C(\"notifications/resources/updated\",{payload:{...Ze.fields,uri:a}}){},or=class extends g()(i({name:a,title:r(a),description:r(a),required:r(w)})){},rr=class extends u(\"@effect/ai/McpSchema/Prompt\")({name:a,title:r(a),description:r(a),arguments:r(m(or)),icons:r(m(Ae)),_meta:r(E)}){},Gt=class extends g()(i({type:f(\"text\"),text:a,annotations:r(me),_meta:r(E)})){},Zt=class extends g()(i({type:f(\"image\"),data:Ut,mimeType:a,annotations:r(me),_meta:r(E)})){},Qt=class extends g()(i({type:f(\"audio\"),data:Ut,mimeType:a,annotations:r(me),_meta:r(E)})){},ar=class extends g()(i({type:f(\"resource\"),resource:v([jt,Vt]),annotations:r(me),_meta:r(E)})){},nr=class extends g()(i({...zt.fields,type:f(\"resource_link\")})){},Lr=v([Gt,Zt,Qt,ar,nr]),sr=class extends g()(i({role:eo,content:Lr})){},Yn=class extends u(\"@effect/ai/McpSchema/ListPromptsResult\")({...Qe.fields,prompts:m(rr)}){};var ir=class extends u(\"@effect/ai/McpSchema/GetPromptResult\")({...Q.fields,messages:m(sr),description:r(a)}){},es=class extends C(\"prompts/get\",{success:ir,error:ne,payload:{...q.fields,name:a,title:r(a),arguments:r(F(a,a))}}){};var cr=class extends g()(i({title:r(a),readOnlyHint:ft(w,Ho),destructiveHint:ft(w,bo),idempotentHint:ft(w,Ho),openWorldHint:ft(w,bo)})){},Mc=Po(i({type:ut(\"object\"),properties:r(F(a,E)),required:r(m(a))}),[E]),Kc=E,Xt=class extends u(\"@effect/ai/McpSchema/Tool\")({name:a,title:r(a),description:r(a),inputSchema:Mc,outputSchema:r(Kc),annotations:r(cr),icons:r(m(Ae)),_meta:r(E)}){},ts=class extends u(\"@effect/ai/McpSchema/ListToolsResult\")({...Qe.fields,tools:m(Xt)}){};var pr=class extends u(\"@effect/ai/McpSchema/CallToolResult\")({...Q.fields,content:m(Lr),structuredContent:r(yt),isError:r(w)}){},os=class extends C(\"tools/call\",{success:pr,error:ne,payload:{...q.fields,name:a,arguments:ft(F(a,Dt),()=>({}))}}){};var ls=te([\"debug\",\"info\",\"notice\",\"warning\",\"error\",\"critical\",\"alert\",\"emergency\"]),rs=class extends C(\"logging/setLevel\",{payload:{...q.fields,level:ls},success:i({}),error:ne}){},as=class extends C(\"notifications/message\",{payload:i({...Ze.fields,level:ls,logger:r(a),data:Dt})}){},lr=class extends u(\"@effect/ai/McpSchema/ToolUseContent\")({type:f(\"tool_use\"),id:a,name:a,input:F(a,No),_meta:r(E)}){},mr=class extends u(\"@effect/ai/McpSchema/ToolResultContent\")({type:f(\"tool_result\"),toolUseId:a,content:m(Lr),structuredContent:r(yt),isError:r(w),_meta:r(E)}){},Yt=v([Gt,Zt,Qt,lr,mr]),ur=class extends g()(i({role:eo,content:v([Yt,m(Yt)]),_meta:r(E)})){},dr=class extends u(\"@effect/ai/McpSchema/ToolChoice\")({mode:r(te([\"auto\",\"required\",\"none\"]))}){},yr=class extends g()(i({name:r(a)})){},Sr=class extends u(\"@effect/ai/McpSchema/ModelPreferences\")({hints:r(m(yr)),costPriority:r(O.check(dt({minimum:0,maximum:1}))),speedPriority:r(O.check(dt({minimum:0,maximum:1}))),intelligencePriority:r(O.check(dt({minimum:0,maximum:1})))}){},hr=class extends u(\"@effect/ai/McpSchema/CreateMessageResult\")({role:eo,content:v([Yt,m(Yt)]),_meta:r(E),model:a,stopReason:r(a)}){},ns=class extends C(\"sampling/createMessage\",{success:hr,error:ne,payload:{messages:m(ur),modelPreferences:r(i(Sr.fields)),systemPrompt:r(a),includeContext:r(te([\"none\",\"thisServer\",\"allServers\"])),temperature:r(O),maxTokens:N,stopSequences:r(m(a)),metadata:r(F(a,No)),tools:r(m(i(Xt.fields))),toolChoice:r(i(dr.fields))}}){};var ss=class t extends g()(i({...Q.fields,completion:i({values:m(a),total:r(N),hasMore:r(w)})})){static empty=t.make({completion:{values:[],total:0,hasMore:!1}})};var fr=class extends u(\"@effect/ai/McpSchema/ElicitationString\")({type:f(\"string\"),title:r(a),description:r(a),minLength:r(N),maxLength:r(N),format:r(te([\"email\",\"uri\",\"date\",\"date-time\"])),default:r(a)}){},xr=class extends u(\"@effect/ai/McpSchema/ElicitationNumber\")({type:te([\"number\",\"integer\"]),title:r(a),description:r(a),minimum:r(O),maximum:r(O),default:r(O)}){},gr=class extends u(\"@effect/ai/McpSchema/ElicitationBoolean\")({type:f(\"boolean\"),title:r(a),description:r(a),default:r(w)}){},kr=class extends u(\"@effect/ai/McpSchema/UntitledSingleSelectEnum\")({type:f(\"string\"),title:r(a),description:r(a),enum:m(a),default:r(a)}){},Rr=class extends u(\"@effect/ai/McpSchema/TitledSingleSelectEnum\")({type:f(\"string\"),title:r(a),description:r(a),oneOf:m(i({const:a,title:a})),default:r(a)}){},Ic=v([kr,Rr]),Er=class extends u(\"@effect/ai/McpSchema/UntitledMultiSelectEnum\")({type:f(\"array\"),title:r(a),description:r(a),minItems:r(N),maxItems:r(N),items:i({type:f(\"string\"),enum:m(a)}),default:r(m(a))}){},Tr=class extends u(\"@effect/ai/McpSchema/TitledMultiSelectEnum\")({type:f(\"array\"),title:r(a),description:r(a),minItems:r(N),maxItems:r(N),items:i({anyOf:m(i({const:a,title:a}))}),default:r(m(a))}){},Fc=v([Er,Tr]),vr=class extends u(\"@effect/ai/McpSchema/LegacyTitledEnum\")({type:f(\"string\"),title:r(a),description:r(a),enum:m(a),enumNames:r(m(a)),default:r(a)}){},qc=v([vr,Ic,Fc]),Nc=v([qc,fr,xr,gr]),Dc=i({$schema:r(a),type:f(\"object\"),properties:F(a,Nc),required:r(m(a))}),ae=class extends u(\"@effect/ai/McpSchema/ElicitRequestFormParams\")({...q.fields,mode:r(ut(\"form\")),message:a,requestedSchema:Dc}){},Ar=class extends u(\"@effect/ai/McpSchema/ElicitRequestURLParams\")({...q.fields,mode:ut(\"url\"),message:a,elicitationId:a,url:a}){},Pc=v([ae,Ar]),we=class extends u(\"@effect/ai/McpSchema/ElicitAcceptResult\")({...Q.fields,action:ut(\"accept\"),content:r(F(a,v([a,O,w,m(a)])))}){},Le=class extends u(\"@effect/ai/McpSchema/ElicitDeclineResult\")({...Q.fields,action:te([\"cancel\",\"decline\"])}){},Uc=v([we,Le]);var wr=class extends C(\"elicitation/create\",{success:Uc,error:ne,payload:Pc}){};var is=class extends ke(\"@effect/ai/McpSchema/ElicitationDeclined\")({_tag:f(\"ElicitationDeclined\"),request:wr.payloadSchema,cause:r(Pt())}){};var ds=e.Struct({timeoutMs:e.Int.check(e.isGreaterThan(0))}),_c=ds.make({timeoutMs:900*1e3}),to=e.Struct({...ae.fields,mode:e.Literal(\"form\"),requestedSchema:e.toEncoded(ae.fields.requestedSchema),_meta:e.optional(S)}),Or=e.Union([e.Struct({...we.fields,_meta:e.optional(S)}),e.Struct({...Le.fields,_meta:e.optional(S)})]),de=class extends e.TaggedError()(\"ElicitationFailed\",{reason:e.Literals([\"unavailable\",\"transaction\",\"invalid-request\",\"invalid-response\",\"transport\",\"expired\",\"forbidden\"])}){},Cr=e.Union([e.Struct({ok:e.Literal(!0),response:Or}),e.Struct({ok:e.Literal(!1),error:de})]),Mr=e.Struct({...to.fields,requestedSchema:e.Struct({type:e.Literal(\"object\"),properties:e.Record(e.String,e.Never)})}),Wc=Or.check(e.makeFilter(t=>t.action!==\"accept\"||t.content===void 0||Object.keys(t.content).length===0)),xt=4e3,us=32,ys=t=>t>=55296&&t<=56319,Bc=t=>t>=56320&&t<=57343,br=(t,o)=>t.slice(0,ys(t.charCodeAt(o-1))?o-1:o),Jc=t=>Array.isArray(t),zc=t=>{let o=0;for(let n=1;n<t.length;n+=1)Bc(t.charCodeAt(n))&&ys(t.charCodeAt(n-1))&&(o+=1);return t.length-o},X=(t,o)=>{t.parts.push(o),t.room-=o.length},Ss=(t,o,n,s)=>{if(typeof t==\"string\"){t.length>o?X(s,`${JSON.stringify(br(t,o))}\\u2026 (${zc(t)} characters)`):X(s,JSON.stringify(t.length>s.room?br(t,s.room+1):t));return}if(typeof t!=\"object\"||t===null)return X(s,JSON.stringify(t));let p=`${n}  `,c=(x,H,M)=>(X(s,`${x===0?\"\":\",\"}\n${p}${H===void 0?\"\":`${JSON.stringify(H)}: `}`),s.room>=0&&Ss(M,o,p,s),s.room>=0);if(Jc(t))return t.length===0?X(s,\"[]\"):(X(s,\"[\"),t.every((x,H)=>c(H,void 0,x)),X(s,`\n${n}]`));let y=Object.entries(t);if(y.length===0)return X(s,\"{}\");X(s,\"{\"),y.every(([x,H],M)=>c(M,x,H)),X(s,`\n${n}}`)},Hr=(t,o,n)=>{let s={parts:[],room:n};return Ss(t,o,\"\",s),{text:s.parts.join(\"\"),fits:s.room>=0}},$c=t=>{let o=xt/2,n=Hr(t,o,xt);for(;!n.fits&&o>us;)o=Math.max(us,Math.floor(o/2)),n=Hr(t,o,xt);return n.fits?n.text:`${br(n.text,xt)}\n\\u2026 (the rest is not shown)`},hs=(t,o)=>({mode:\"form\",message:`Approve ${t}?\n\n${o}`,requestedSchema:{type:\"object\",properties:{}}}),fs=(t,o,n)=>{let s=Hr(o,Number.POSITIVE_INFINITY,n);return s.fits?hs(t,`Arguments:\n${s.text}`):void 0},jc=(t,o)=>{let n=fs(t,o,xt);return n!==void 0?n:hs(t,`Arguments, shortened for review. Approving runs the call with the complete arguments:\n${$c(o)}`)};var Vc=new Set([\"__proto__\",\"constructor\",\"prototype\"]),Gc=e.String.check(e.isPattern(/^[A-Za-z_][A-Za-z0-9_-]{0,99}$/u),e.makeFilter(t=>!Vc.has(t))),ye=e.Struct({src:e.NonEmptyString,mimeType:e.optionalKey(e.String),sizes:e.optionalKey(e.Array(e.String)),theme:e.optionalKey(e.Literals([\"light\",\"dark\"]))}),Zc=e.Struct({title:e.optionalKey(e.String),description:e.optionalKey(e.String),instructions:e.optionalKey(e.String),icons:e.optionalKey(e.Array(ye)),tags:e.optionalKey(e.Record(e.NonEmptyString,e.String))});var oo=e.Struct({title:e.optionalKey(e.String),readOnlyHint:e.optionalKey(e.Boolean),destructiveHint:e.optionalKey(e.Boolean),idempotentHint:e.optionalKey(e.Boolean),openWorldHint:e.optionalKey(e.Boolean)});var gs=e.Struct({timeoutMs:e.Int.check(e.isGreaterThan(0)),maxTimeoutMs:e.Int.check(e.isGreaterThan(0)),maxTools:e.Int.check(e.isGreaterThan(0)),maxPaginationCursors:e.Int.check(e.isGreaterThan(0)),cleanupTimeoutMs:e.Int.check(e.isGreaterThan(0))}),Ir=gs.make({timeoutMs:3e4,maxTimeoutMs:3e5,maxTools:5e4,maxPaginationCursors:1e3,cleanupTimeoutMs:1e3}),cu=2147483647,Qc=e.Struct({url:R,accountId:e.optional(D),headers:e.optional(e.Record(e.String,e.String)),signal:e.optional(e.instanceOf(AbortSignal)),timeoutMs:e.optional(e.Number.check(e.isInt(),e.isBetween({minimum:1,maximum:Ir.maxTimeoutMs})))}),pu=e.Struct({...Qc.fields,headers:e.Record(e.String,e.String),deadline:e.optional(e.Finite)}),lu=2*Ir.cleanupTimeoutMs+250,uu=e.Struct({content:e.Array(S),structuredContent:e.optionalKey(S),isError:e.optionalKey(e.Boolean),_meta:e.optionalKey(S)}),du=e.Struct({name:e.String,title:e.optional(e.String),description:e.optional(e.String),inputSchema:S,outputSchema:e.optional(S),annotations:e.optional(oo),_meta:e.optional(S)}),yu=e.Struct({name:e.optionalKey(e.String),title:e.optionalKey(e.String),version:e.optionalKey(e.String),description:e.optionalKey(e.String),websiteUrl:e.optionalKey(e.String),icons:e.optionalKey(e.Array(ye)),instructions:e.optionalKey(e.String)}),Kr=class extends e.TaggedError()(\"McpError\",{phase:e.Literals([\"connect\",\"discover\",\"call\",\"schema\",\"transport\"]),reason:e.Literals([\"request\",\"unauthorized\",\"invalid_response\",\"timeout\",\"invalid_input\"]),status:e.optional(e.Number),upstream:e.optional(Ge),session:e.optional(e.Literal(!0))}){},xs=class extends e.TaggedError()(\"McpCredentialsUnverified\",{anonymous:e.Union([e.Literal(\"answered\"),Kr,P])}){};var Xc=e.Struct({maxBodyBytes:e.Int.check(e.isGreaterThan(0))}),Yc=Xc.make({maxBodyBytes:1024*1024}),ks=4*Math.ceil(Yc.maxBodyBytes/3),ep=e.Struct({url:R,method:e.Literals([\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"OPTIONS\"]),headers:e.Record(e.String,e.String),body:e.String.check(e.isMaxLength(ks))}),xu=e.Struct({status:e.Int.check(e.isBetween({minimum:200,maximum:599})),headers:e.Record(e.String,e.String),body:e.String.check(e.isMaxLength(ks))}),tp=e.Struct({instructions:e.NonEmptyString,signingSecret:e.Literals([\"executor\",\"provider\"])}),op=e.Struct({...tp.fields,stateSchema:S}),gu=e.Struct({name:e.NonEmptyString,account:e.NonEmptyString,configSchema:S,setup:e.optionalKey(op)}),gt={name:e.NonEmptyString,subscriptionId:e.NonEmptyString,sourceAccount:D,callbackUrl:R,secret:e.String,config:k},Rs=e.Union([e.Struct({operation:e.Literal(\"webhooks\")}),e.Struct({operation:e.Literal(\"webhook-validate\"),...gt}),e.Struct({operation:e.Literal(\"webhook-complete\"),...gt,state:k}),e.Struct({operation:e.Literal(\"webhook-register\"),...gt}),e.Struct({operation:e.Literal(\"webhook-unregister\"),...gt,state:k}),e.Struct({operation:e.Literal(\"webhook-handle\"),...gt,state:k,request:ep})]);var Es=e.String.check(e.isPattern(/^[a-z][a-z0-9_]*(?:\\.[a-z][a-z0-9_]*)*$/u),e.isMaxLength(64)),rp=e.Union([e.String,e.Finite,e.Boolean]),ap=e.Struct({maxDataBytes:e.Int.check(e.isGreaterThan(0)),maxEventsPerInvocation:e.Int.check(e.isGreaterThan(0)),maxDescriptionLength:e.Int.check(e.isGreaterThan(0)),maxIdLength:e.Int.check(e.isGreaterThan(0))}),Fr=ap.make({maxDataBytes:250*1024,maxEventsPerInvocation:100,maxDescriptionLength:1e3,maxIdLength:200}),np=e.Struct({description:e.String.check(e.isMinLength(1),e.isMaxLength(Fr.maxDescriptionLength)),filters:S,payload:S}),Ts=e.Record(Es,np),sp=e.Struct({name:Es,id:e.String.check(e.isMinLength(1),e.isMaxLength(Fr.maxIdLength)),occurredAt:e.Int.check(e.isGreaterThanOrEqualTo(0)),data:k,filters:e.Record(e.String,rp),account:e.NullOr(D)}),vs=e.Array(sp).check(e.isMaxLength(Fr.maxEventsPerInvocation));var Se={icons:8,characters:32*1024},As=/^(?:data:image\\/(?:svg\\+xml|png|webp|jpeg);base64,[A-Za-z0-9+/]*={0,2}|https:\\/\\/\\S+)$/u,ws=e.Struct({...ye.fields,src:e.String.check(e.isPattern(As),e.isMaxLength(Se.characters))}),ro=e.Array(ws).check(e.isMaxLength(Se.icons),e.makeFilter(t=>JSON.stringify(t).length<=Se.characters,{message:`An app's icons total at most ${Se.characters} characters`})),wu=t=>{if(!Array.isArray(t))return\"icons must be an array of { src, mimeType?, sizes?, theme? }\";if(t.length>Se.icons)return`An app declares at most ${Se.icons} icons; this one declares ${t.length}`;for(let[n,s]of t.entries()){let p=typeof s==\"object\"&&s!==null?s.src:void 0;if(typeof p!=\"string\"||!As.test(p))return`icons[${n}].src must be a base64 data:image/svg+xml, image/png, image/webp or image/jpeg URI, or an https: URL`}let o=JSON.stringify(t).length;return o>Se.characters?`An app's icons total at most 32 KiB; these take ${Math.ceil(o/1024)} KiB`:e.is(ro)(t)?void 0:'Each icon is { src, mimeType?: string, sizes?: string[], theme?: \"light\" | \"dark\" }'};var bs=e.Struct({field:e.NonEmptyString}),ip=e.Union([e.String,bs]),cp=e.Struct({base64:e.Array(ip).check(e.isMinLength(1))}),pp=e.Union([e.String,bs,cp]),Ls=e.Array(pp).check(e.isMinLength(1)),lp=e.String.check(e.isPattern(/^[!#$%&'*+.^_`|~0-9a-z-]+$/u)),Hs=e.Union([e.Struct({in:e.Literal(\"header\"),name:lp,value:Ls}),e.Struct({in:e.Literal(\"query\"),name:e.NonEmptyString,value:Ls})]),Os=e.Array(Hs),Cs=t=>typeof t==\"object\"&&\"field\"in t,Uu=t=>new Set(t.value.flatMap(o=>typeof o==\"string\"?[]:Cs(o)?[o.field]:o.base64.flatMap(n=>typeof n==\"string\"?[]:[n.field]))),mp=e.encodeSync(e.fromJsonString(Hs)),up=t=>mp(t),_u=t=>[...new Map(t.map(o=>[up(o),o])).entries()].sort(([o],[n])=>o<n?-1:o>n?1:0).map(([,o])=>o),qr=class extends e.TaggedError()(\"PlacementFieldMissing\",{field:e.String}){get message(){return`The credential placement references the account field \"${this.field}\", which has no string value.`}},Wu=(t,o)=>{let n=p=>{let c=\"\";for(let y of p){if(typeof y==\"string\"){c+=y;continue}let x=Object.hasOwn(o,y.field)?o[y.field]:void 0;if(typeof x!=\"string\")return Z.fail(new qr({field:y.field}));c+=x}return Z.succeed(c)},s=\"\";for(let p of t.value){let c=typeof p==\"string\"||Cs(p)?n([p]):Z.map(n(p.base64),y=>Oo.encode(y));if(Z.isFailure(c))return c;s+=c.success}return Z.succeed(s)};var Ms=class extends mt.TaggedClass(\"secrets\"){},qs=e.Literals([\"none\",\"client_secret_post\",\"client_secret_basic\",\"client_secret_basic_raw\"]),Nr=e.Literals([\"client_secret_post\",\"client_secret_basic\",\"client_secret_basic_raw\"]),Ns=[\"response_type\",\"client_id\",\"redirect_uri\",\"state\",\"scope\",\"code_challenge\",\"code_challenge_method\",\"nonce\",\"resource\",\"request\",\"request_uri\"],Ds=new Set(Ns),Ps=e.Record(e.String,e.String).check(e.makeFilter(t=>Object.keys(t).every(o=>!Ds.has(o)),{message:\"Authorization parameters cannot replace protocol parameters such as state or scope.\"})),dp=e.makeFilter(t=>{let o=[...new URL(t.authorizationUrl).searchParams.keys()],n=o.filter(p=>Ds.has(p));if(n.length>0)return{path:[\"authorizationUrl\"],issue:`authorizationUrl cannot set protocol parameters: ${n.join(\", \")}.`};let s=o.filter(p=>Object.hasOwn(t.authorizationParams??{},p));if(s.length>0)return{path:[\"authorizationParams\"],issue:`Declare each parameter once; authorizationUrl already sets: ${s.join(\", \")}.`}}),Us=e.Literals([\"form\",\"json\"]),_s=e.Struct({path:e.String.check(e.isPattern(/^[^.]+(\\.[^.]+)*$/))}),Dr={scopeSeparator:e.optionalKey(e.String.check(e.isMinLength(1))),tokenRequestFormat:e.optionalKey(Us)},Ks={...Dr,tokenResponse:e.optionalKey(_s),grant:e.optionalKey(e.Literal(\"authorization_code\")),authorizationParams:e.optionalKey(Ps),tokenEndpointAuthMethod:e.optionalKey(qs),resource:e.optionalKey(e.NullOr(R))},kt=e.Union([e.Struct({...Ks,discover:R,authorizationServerMetadataUrl:e.optionalKey(R),authorizationUrl:e.optionalKey(e.Never),tokenUrl:e.optionalKey(e.Never),revocationUrl:e.optionalKey(e.Never),scopes:e.optionalKey(e.Array(e.String))}),e.Struct({...Ks,authorizationUrl:R,tokenUrl:R,revocationUrl:e.optionalKey(R),scopes:e.Array(e.String),issuer:e.optionalKey(R),discover:e.optionalKey(e.Never),authorizationServerMetadataUrl:e.optionalKey(e.Never)}).check(dp),e.Struct({grant:e.Literal(\"client_credentials\"),discover:R,authorizationServerMetadataUrl:e.optionalKey(R),authorizationUrl:e.optionalKey(e.Never),tokenUrl:e.optionalKey(e.Never),revocationUrl:e.optionalKey(e.Never),scopes:e.optionalKey(e.Array(e.String)),...Dr,tokenEndpointAuthMethod:Nr,resource:e.optionalKey(e.NullOr(R))}),e.Struct({grant:e.Literal(\"client_credentials\"),tokenUrl:R,revocationUrl:e.optionalKey(R),scopes:e.Array(e.String),...Dr,tokenEndpointAuthMethod:Nr,resource:e.optionalKey(e.NullOr(R)),authorizationUrl:e.optionalKey(e.Never),discover:e.optionalKey(e.Never),authorizationServerMetadataUrl:e.optionalKey(e.Never)})]),$u=e.Struct({access_token:e.String}),Is=class extends mt.TaggedClass(\"oauth2\"){},ao=e.String.check(e.isMinLength(1),e.isMaxLength(255)),Ws=e.Struct({externalId:e.optionalKey(ao),displayName:e.optionalKey(ao),username:e.optionalKey(ao),email:e.optionalKey(ao),avatarUrl:e.optionalKey(R),profileUrl:e.optionalKey(R)}),Ur=e.Struct({accountInfo:e.optionalKey(Ws)}),Fs=class extends mt.Class{many(){return new Pr({provider:this})}},Pr=class extends mt.TaggedClass(\"many\"){};var Bs=13;var h=e.String.check(e.makeFilter(t=>{try{let o=new URL(t);return o.protocol===\"https:\"||o.protocol===\"http:\"}catch{return!1}})),yp=e.Literals([\"none\",\"client_secret_post\",\"client_secret_basic\",\"client_secret_basic_raw\"]),Rt=e.Literals([\"client_secret_post\",\"client_secret_basic\",\"client_secret_basic_raw\"]),Sp=[\"response_type\",\"client_id\",\"redirect_uri\",\"state\",\"scope\",\"code_challenge\",\"code_challenge_method\",\"nonce\",\"resource\",\"request\",\"request_uri\"],Js=new Set(Sp),hp=e.Record(e.String,e.String).check(e.makeFilter(t=>Object.keys(t).every(o=>!Js.has(o)),{message:\"Authorization parameters cannot replace protocol parameters such as state or scope.\"})),_r=e.makeFilter(t=>{let o=[...new URL(t.authorizationUrl).searchParams.keys()],n=o.filter(p=>Js.has(p));if(n.length>0)return{path:[\"authorizationUrl\"],issue:`authorizationUrl cannot set protocol parameters: ${n.join(\", \")}.`};let s=o.filter(p=>Object.hasOwn(t.authorizationParams??{},p));if(s.length>0)return{path:[\"authorizationParams\"],issue:`Declare each parameter once; authorizationUrl already sets: ${s.join(\", \")}.`}}),fp=e.Literals([\"form\",\"json\"]),xp=e.Struct({path:e.String.check(e.isPattern(/^[^.]+(\\.[^.]+)*$/))}),Xe={scopeSeparator:e.optionalKey(e.String.check(e.isMinLength(1))),tokenRequestFormat:e.optionalKey(fp)},Et={...Xe,tokenResponse:e.optionalKey(xp),grant:e.optionalKey(e.Literal(\"authorization_code\")),authorizationParams:e.optionalKey(hp),tokenEndpointAuthMethod:e.optionalKey(yp),resource:e.optionalKey(e.NullOr(h))},Tt=e.Union([e.Struct({...Et,discover:h,authorizationUrl:e.optionalKey(e.Never),tokenUrl:e.optionalKey(e.Never),revocationUrl:e.optionalKey(e.Never),scopes:e.optionalKey(e.Array(e.String))}),e.Struct({...Et,authorizationUrl:h,tokenUrl:h,revocationUrl:e.optionalKey(h),scopes:e.Array(e.String),issuer:e.optionalKey(h),discover:e.optionalKey(e.Never)}).check(_r),e.Struct({grant:e.Literal(\"client_credentials\"),discover:h,authorizationUrl:e.optionalKey(e.Never),tokenUrl:e.optionalKey(e.Never),revocationUrl:e.optionalKey(e.Never),scopes:e.optionalKey(e.Array(e.String)),...Xe,tokenEndpointAuthMethod:Rt,resource:e.optionalKey(e.NullOr(h))}),e.Struct({grant:e.Literal(\"client_credentials\"),tokenUrl:h,revocationUrl:e.optionalKey(h),scopes:e.Array(e.String),...Xe,tokenEndpointAuthMethod:Rt,resource:e.optionalKey(e.NullOr(h)),authorizationUrl:e.optionalKey(e.Never),discover:e.optionalKey(e.Never)})]);var d=e.Json,l=e.Record(e.String,d),Ce=e.String.pipe(e.check(e.isStartingWith(\"acc_\"),e.isMinLength(5)),e.brand(\"acc\")),Wr=class extends e.TaggedError()(\"CacheError\",{reason:e.Literals([\"unavailable\",\"storage\",\"invalid\",\"capacity\",\"timeout\"])}){},he=e.String.check(e.isPattern(/^[a-f0-9]{64}$/)),zs=e.Finite.check(e.isGreaterThanOrEqualTo(0)),$s=e.Struct({value:e.Json,version:e.String,freshUntil:zs,staleUntil:zs}),Vr=e.Union([e.Struct({operation:e.Literal(\"read\"),keys:e.Array(he)}),e.Struct({operation:e.Literal(\"acquire\"),key:he,refresh:e.Boolean,version:e.optionalKey(e.NullOr(e.String))}),e.Struct({operation:e.Literal(\"claim\"),key:he,version:e.NullOr(e.String)}),e.Struct({operation:e.Literal(\"publish\"),key:he,lease:e.String,entry:$s}),e.Struct({operation:e.Literal(\"release\"),key:he,lease:e.String}),e.Struct({operation:e.Literal(\"renew\"),key:he,lease:e.String}),e.Struct({operation:e.Literal(\"write\"),entries:e.Array(e.Struct({key:he,entry:$s}))}),e.Struct({operation:e.Literal(\"invalidate\"),key:he})]),Gr=e.Union([e.Struct({ok:e.Literal(!0),value:e.Json}),e.Struct({ok:e.Literal(!1),error:Wr})]),At=e.String.check(e.makeFilter(t=>/^[A-Za-z][A-Za-z0-9_]*$/.test(t)&&t.length<=128)),gp=e.Union([e.String,e.Finite,e.Boolean]),kp=e.Struct({kind:e.Literals([\"string\",\"number\",\"boolean\",\"id\",\"userId\"]),optional:e.optional(e.Boolean),default:e.optional(gp),references:e.optional(At)}),Rp=e.Struct({name:At,fields:e.NonEmptyArray(At)}),Ep=e.Struct({fields:e.Record(At,kp),indexes:e.Array(Rp)}),Zr=e.Record(At,Ep),Tp=4096,vp=e.Struct({action:e.NonEmptyString.check(e.isMaxLength(1024)),instructions:e.NonEmptyString.check(e.isMaxLength(Tp))}),Ap=4096,wp=e.Struct({code:e.NonEmptyString.check(e.isMaxLength(128)),status:e.Int.check(e.isBetween({minimum:400,maximum:599})),message:e.NonEmptyString.check(e.isMaxLength(Ap)),recovery:e.optionalKey(vp)}),se=class extends e.TaggedError()(\"OpenapiResponseError\",wp.fields){},so=e.Struct({...ae.fields,mode:e.Literal(\"form\"),requestedSchema:e.toEncoded(ae.fields.requestedSchema),_meta:e.optional(l)}),Lp=e.Union([e.Struct({...we.fields,_meta:e.optional(l)}),e.Struct({...Le.fields,_meta:e.optional(l)})]),Y=class extends e.TaggedError()(\"ElicitationFailed\",{reason:e.Literals([\"unavailable\",\"transaction\",\"invalid-request\",\"invalid-response\",\"transport\",\"expired\",\"forbidden\"])}){},Qr=e.Union([e.Struct({ok:e.Literal(!0),response:Lp}),e.Struct({ok:e.Literal(!1),error:Y})]),bp=e.Struct({...so.fields,requestedSchema:e.Struct({type:e.Literal(\"object\"),properties:e.Record(e.String,e.Never)})}),Hp=6e4,Op=e.Struct({expression:e.NonEmptyString,timezone:e.NonEmptyString}).check(e.makeFilter(t=>t.expression.trim().split(/\\s+/).length===5&&Z.isSuccess(Nt.parse(t.expression,t.timezone)))),Cp=e.Union([e.Struct({kind:e.Literal(\"interval\"),milliseconds:e.Int.check(e.makeFilter(t=>t>=Hp,{message:\"Schedule intervals must be at least 60 seconds\"}),e.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER))}),e.Struct({kind:e.Literal(\"cron\"),calendar:Op})]),Xr=e.Struct({name:e.NonEmptyString,timing:Cp,input:d}),Mp=e.NonEmptyString.check(e.makeFilter(t=>!t.startsWith(\"/\")&&!t.includes(\"\\\\\")&&!t.includes(\"\\0\")&&t.split(\"/\").every(o=>o!==\"\"&&o!==\".\"&&o!==\"..\"))),Kp=e.Struct({path:Mp,content:e.String}),Br={nameCharacters:64,descriptionCharacters:1024,compatibilityCharacters:500},Yr=e.NonEmptyString.check(e.makeFilter(t=>t===t.toLowerCase()&&/^[\\p{L}\\p{N}]+(?:-[\\p{L}\\p{N}]+)*$/u.test(t)&&[...t].length<=Br.nameCharacters)),Ip=e.Struct({name:Yr,description:e.String.check(e.makeFilter(t=>t.trim().length>0&&[...t].length<=Br.descriptionCharacters)),license:e.optionalKey(e.String),compatibility:e.optionalKey(e.String.check(e.makeFilter(t=>t.trim().length>0&&[...t].length<=Br.compatibilityCharacters))),metadata:e.optionalKey(e.Record(e.String,e.String)),\"allowed-tools\":e.optionalKey(e.String)}),Fp=e.Struct({...Ip.fields,files:e.Array(Kp).check(e.makeFilter(t=>t.some(o=>o.path===\"SKILL.md\")&&new Set(t.map(o=>o.path)).size===t.length))}),wt=e.Array(Fp).check(e.makeFilter(t=>new Set(t.map(o=>o.name)).size===t.length)),ea=e.Struct({title:e.optionalKey(e.String),readOnlyHint:e.optionalKey(e.Boolean),destructiveHint:e.optionalKey(e.Boolean),idempotentHint:e.optionalKey(e.Boolean),openWorldHint:e.optionalKey(e.Boolean)}),qp=e.Struct({maxBodyBytes:e.Int.check(e.isGreaterThan(0))}),Np=qp.make({maxBodyBytes:1024*1024}),Dp=4*Math.ceil(Np.maxBodyBytes/3),Pp=e.Struct({url:h,method:e.Literals([\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"OPTIONS\"]),headers:e.Record(e.String,e.String),body:e.String.check(e.isMaxLength(Dp))}),vt={name:e.NonEmptyString,subscriptionId:e.NonEmptyString,sourceAccount:Ce,callbackUrl:h,secret:e.String,config:d},ta=e.Union([e.Struct({operation:e.Literal(\"webhooks\")}),e.Struct({operation:e.Literal(\"webhook-validate\"),...vt}),e.Struct({operation:e.Literal(\"webhook-complete\"),...vt,state:d}),e.Struct({operation:e.Literal(\"webhook-register\"),...vt}),e.Struct({operation:e.Literal(\"webhook-unregister\"),...vt,state:d}),e.Struct({operation:e.Literal(\"webhook-handle\"),...vt,state:d,request:Pp})]),fe=e.NonEmptyString.pipe(e.brand(\"wfr\")),be=e.NonEmptyString.check(e.isMaxLength(200)),Up={millisecond:1,milliseconds:1,second:1e3,seconds:1e3,minute:6e4,minutes:6e4,hour:36e5,hours:36e5,day:864e5,days:864e5,week:6048e5,weeks:6048e5},_p=t=>{if(typeof t==\"number\")return Number.isFinite(t)&&t>=0?t:void 0;let o=/^(\\d+(?:\\.\\d+)?) (milliseconds?|seconds?|minutes?|hours?|days?|weeks?)$/.exec(t),n=o?.[2]===void 0?void 0:Up[o[2]];if(n===void 0)return;let s=Number(o?.[1])*n;return Number.isFinite(s)?s:void 0},Jr=e.Union([e.Finite.check(e.isGreaterThanOrEqualTo(0)),e.NonEmptyString]).check(e.makeFilter(t=>_p(t)!==void 0)),Wp=e.Struct({retries:e.optionalKey(e.Struct({limit:e.Int.check(e.isGreaterThanOrEqualTo(0)),delay:Jr,backoff:e.optionalKey(e.Literals([\"constant\",\"linear\",\"exponential\"]))})),timeout:e.optionalKey(Jr)}),Bp=d.check(e.makeFilter(t=>new TextEncoder().encode(JSON.stringify(t)).byteLength<=1024*1024)),Lt=e.Struct({key:e.NonEmptyString,fingerprint:e.NonEmptyString}),oa=e.Union([e.Struct({operation:e.Literal(\"workflows\")}),e.Struct({operation:e.Literal(\"workflow-validate\"),name:be,input:d}),e.Struct({operation:e.Literal(\"workflow-run\"),name:be,input:d})]),ra=e.Union([e.Struct({operation:e.Literal(\"do\"),name:be,options:Wp}),e.Struct({operation:e.Literal(\"sleep\"),name:be,duration:Jr}),e.Struct({operation:e.Literal(\"until\"),name:be,timestamp:e.Finite}),e.Struct({operation:e.Literal(\"context\")}),e.Struct({operation:e.Literal(\"invoke\"),kind:e.Literals([\"query\",\"mutation\"]),name:e.NonEmptyString,input:d,stepId:e.NonEmptyString,timeout:e.Finite.check(e.isGreaterThanOrEqualTo(0))})]),aa=e.Union([e.Struct({operation:e.Literal(\"start\"),workflow:be,input:Bp,key:e.optionalKey(e.NonEmptyString.check(e.isMaxLength(128)))}),e.Struct({operation:e.Literal(\"get\"),run:fe}),e.Struct({operation:e.Literal(\"list\"),workflow:e.optionalKey(be),cursor:e.optionalKey(fe),limit:e.optionalKey(e.Int.check(e.isBetween({minimum:1,maximum:100})))}),e.Struct({operation:e.Literal(\"terminate\"),run:fe})]),He=class extends e.TaggedError()(\"ProviderError\",{reason:e.Literals([\"unauthorized\",\"forbidden\",\"rate_limited\",\"unavailable\",\"rejected\"]),status:e.optional(e.Int.check(e.isBetween({minimum:100,maximum:599}))),accountId:e.optional(Ce)}){},Oe=class extends e.TaggedError()(\"McpError\",{phase:e.Literals([\"connect\",\"discover\",\"call\",\"schema\",\"transport\"]),reason:e.Literals([\"request\",\"unauthorized\",\"invalid_response\",\"timeout\",\"invalid_input\"]),status:e.optional(e.Number)}){},ee=class extends e.TaggedError()(\"SkillLoadFailed\",{reason:e.Literals([\"source\",\"request\",\"rate_limited\",\"document\",\"limit\",\"changed\",\"encoding\"]),message:e.optional(e.String.check(e.isMaxLength(500))),status:e.optional(e.Int.check(e.isBetween({minimum:100,maximum:599})))}){},no=class extends e.TaggedError()(\"WorkflowFailure\",{reason:e.Literals([\"unavailable\",\"not_found\",\"input\",\"output\",\"operation\",\"approval\",\"credentials\",\"terminated\",\"execution\",\"conflict\",\"engine\"]),retryable:e.Boolean}){},Jp=e.Union([e.Struct({ok:e.Literal(!0),value:d}),e.Struct({ok:e.Literal(!1),error:no})]),na=e.Union([e.Struct({type:e.Literal(\"secrets\"),label:e.String,fields:l}),e.Struct({type:e.Literal(\"oauth2\"),...Tt.members[0].fields,response:l}),e.Struct({type:e.Literal(\"oauth2\"),...Tt.members[1].fields,response:l}),e.Struct({type:e.Literal(\"oauth2\"),...Tt.members[2].fields,response:l}),e.Struct({type:e.Literal(\"oauth2\"),...Tt.members[3].fields,response:l})]),et=e.Struct({name:e.NonEmptyString,auth:e.Record(e.NonEmptyString,na)}),bt=e.Struct({capabilities:e.optionalKey(e.Struct({skills:e.Literal(!0),toolIndex:e.optionalKey(e.Literal(!0)),skillSources:e.optionalKey(e.Literal(!0)),scheduledTools:e.optionalKey(e.Literal(!0))})),database:e.optionalKey(Zr),accounts:e.Record(e.NonEmptyString,e.Struct({definition:et,cardinality:e.Literals([\"one\",\"many\"])}))}),Ye=e.Struct({id:Ce,provider:et,method:e.NonEmptyString,generation:e.optionalKey(e.Int),fields:l}),Me=e.Record(e.NonEmptyString,e.Union([Ye,e.Array(Ye)])),Ke=e.Struct({tool:e.NonEmptyString,input:d}),Ie=e.Finite.check(e.isGreaterThanOrEqualTo(0)),sa=e.Struct({schedules:e.optionalKey(e.Array(Xr)),name:e.NonEmptyString,description:e.String,inputSchema:l,readOnly:e.optionalKey(e.Boolean),title:e.optionalKey(e.String),outputSchema:e.optionalKey(l),annotations:e.optionalKey(ea),_meta:e.optionalKey(l)}),js=sa.mapFields(({inputSchema:t,outputSchema:o,_meta:n,...s})=>s),zp=e.Struct({skills:wt,dynamic:e.Boolean}),$p=e.Union([zp,wt]),Ht=e.Union([oa,ta,e.Struct({operation:e.Literal(\"requirements\")}),e.Struct({operation:e.Literal(\"inspect\"),detail:e.optionalKey(e.Literal(\"summary\")),tools:e.optionalKey(e.Array(e.NonEmptyString)),scheduled:e.optionalKey(e.Literal(!0))}),e.Struct({operation:e.Literal(\"skills\"),sources:e.optionalKey(e.Literal(!0))}),e.Struct({operation:e.Literal(\"query\"),name:e.NonEmptyString,input:d}),e.Struct({operation:e.Literal(\"mutate\"),name:e.NonEmptyString,input:d}),e.Struct({operation:e.Literal(\"call\"),tool:e.NonEmptyString,input:d})]),U=class extends e.TaggedError()(\"HostRequestInvalid\",{}){},_=class extends e.TaggedError()(\"HostAccountsInvalid\",{}){},zr=class extends e.TaggedError()(\"HostDeclarationInvalid\",{}){},$r=class extends e.TaggedError()(\"HostEvaluationFailed\",{}){},W=class extends e.TaggedError()(\"HostOperationNotFound\",{}){},jr=class extends e.TaggedError()(\"HostOperationFailed\",{}){},B=class extends e.TaggedError()(\"HostToolNotFound\",{}){},ia=e.String.check(e.isMaxLength(512)),ca=10,J=class extends e.TaggedError()(\"HostInputInvalid\",{problems:e.optionalKey(e.Array(ia).check(e.isMaxLength(ca)))}){},z=class extends e.TaggedError()(\"HostToolBlocked\",{}){},$=class extends e.TaggedError()(\"HostToolApprovalRequired\",{input:d,elicitation:bp}){},j=class extends e.TaggedError()(\"HostToolPolicyFailed\",{}){},V=class extends e.TaggedError()(\"HostOutputInvalid\",{}){},jp=e.Union([se,He,Oe,ee,no,U,_,zr,$r,W,jr,B,J,V,z,$,j,Y]),Vp=e.Union([e.Struct({ok:e.Literal(!0),value:d,toolError:e.optionalKey(e.Literal(!0))}),e.Struct({ok:e.Literal(!1),error:jp})]),io=e.Struct({command:Ht,accounts:Me,approval:e.optionalKey(Ke),replay:e.optionalKey(Lt),deadline:e.optionalKey(Ie),workflowRun:e.optionalKey(fe)}),tt={version:1,schemas:{invocation:io,request:Ht,response:Vp,requirements:bt,tools:e.Array(sa),toolSummaries:e.Array(js),skills:$p,elicitationRequest:so,elicitationReply:Qr,workflowStep:ra,workflowStepReply:Jp,workflowControl:aa,cacheCommand:Vr,cacheReply:Gr}};var Vs=e.Struct({skills:wt,dynamic:e.Boolean,cached:e.optionalKey(e.Boolean)}),co=e.Union([Vs,wt]),Gp={version:2,schemas:{...tt.schemas,skills:co}};var Zp=2048,pa=e.Literals([\"app\",\"storage\",\"service\"]),lo=e.String.check(e.isMaxLength(128)),la=e.String.check(e.isMaxLength(128)),mo=e.String.check(e.isMaxLength(Zp)),Qp={step:e.optionalKey(e.String.check(e.isMaxLength(200))),errorName:e.optionalKey(lo),message:e.optionalKey(mo)},xe=class extends e.TaggedError()(\"WorkflowFailure\",{...Qp,reason:e.Literals([\"unavailable\",\"not_found\",\"input\",\"output\",\"operation\",\"approval\",\"credentials\",\"terminated\",\"execution\",\"conflict\",\"engine\"]),retryable:e.Boolean}){},Xp=e.Union([e.Struct({ok:e.Literal(!0),value:d}),e.Struct({ok:e.Literal(!1),error:xe})]),Yp=e.Literals([\"scanCalls\",\"directGets\",\"rowsRead\",\"rowsReturned\",\"pageSize\",\"bytesRead\",\"writes\",\"valueBytes\"]),Fe=class extends e.TaggedError()(\"DatabaseLimitExceeded\",{limit:Yp,maximum:e.Int,requested:e.Int}){},el=[\"id\",\"createdAt\",\"updatedAt\"],qe=class extends e.TaggedError()(\"DatabaseFieldReserved\",{table:e.String,field:e.Literals(el)}){},ma={source:e.optionalKey(pa),errorName:e.optionalKey(lo),code:e.optionalKey(la),message:e.optionalKey(mo)},ot=class extends e.TaggedError()(\"HostDeclarationInvalid\",ma){},rt=class extends e.TaggedError()(\"HostEvaluationFailed\",ma){},po=class extends e.TaggedError()(\"HostOperationFailed\",ma){},ua=e.Union([se,He,Oe,ee,xe,U,_,ot,rt,W,po,Fe,qe,B,J,V,z,$,j,Y]),tl=e.Union([e.Struct({ok:e.Literal(!0),value:d,toolError:e.optionalKey(e.Literal(!0))}),e.Struct({ok:e.Literal(!1),error:ua})]),G={version:3,schemas:{invocation:io,request:Ht,response:tl,requirements:bt,tools:tt.schemas.tools,toolSummaries:tt.schemas.toolSummaries,skills:co,elicitationRequest:so,elicitationReply:Qr,workflowStep:ra,workflowStepReply:Xp,workflowControl:aa,cacheCommand:Vr,cacheReply:Gr}};var ya=e.Struct({src:e.NonEmptyString,mimeType:e.optionalKey(e.String),sizes:e.optionalKey(e.Array(e.String)),theme:e.optionalKey(e.Literals([\"light\",\"dark\"]))}),Gs=e.Struct({schedules:e.optionalKey(e.Array(Xr)),name:e.NonEmptyString,router:e.optionalKey(e.NonEmptyString),tags:e.optionalKey(e.Array(e.NonEmptyString)),description:e.String,inputSchema:l,readOnly:e.optionalKey(e.Boolean),title:e.optionalKey(e.String),outputSchema:e.optionalKey(l),annotations:e.optionalKey(ea),_meta:e.optionalKey(l)}),ol=Gs.mapFields(({inputSchema:t,outputSchema:o,_meta:n,...s})=>s),rl=e.Union([He,Oe,ee,ot,rt]),uo=e.Struct({path:e.String,title:e.optionalKey(e.String),description:e.optionalKey(e.String),icons:e.optionalKey(e.Array(ya)),tags:e.optionalKey(e.Record(e.NonEmptyString,e.String)),skill:e.optionalKey(Yr),error:e.optionalKey(rl)}),Sa=e.Struct({tools:e.Array(Gs),routers:e.Array(uo)}),ha=e.Struct({tools:e.Array(ol),routers:e.Array(uo)}),da=e.Literals([\"query\",\"mutation\"]),Zs=e.Union([oa,ta,e.Struct({operation:e.Literal(\"requirements\")}),e.Struct({operation:e.Literal(\"inspect\"),detail:e.optionalKey(e.Literal(\"summary\")),tools:e.optionalKey(e.Array(e.NonEmptyString)),scheduled:e.optionalKey(e.Literal(!0))}),e.Struct({operation:e.Literal(\"skills\"),sources:e.optionalKey(e.Literal(!0))}),e.Struct({operation:e.Literal(\"query\"),name:e.NonEmptyString,input:d}),e.Struct({operation:e.Literal(\"mutate\"),name:e.NonEmptyString,input:d}),e.Struct({operation:e.Literal(\"call\"),tool:e.NonEmptyString,kind:e.optionalKey(da),input:d})]),Ne=class extends e.TaggedError()(\"HostKindMismatch\",{tool:e.NonEmptyString,requested:da,actual:da}){},al=e.Union([...ua.members,Ne]),nl=e.Union([e.Struct({ok:e.Literal(!0),value:d,toolError:e.optionalKey(e.Literal(!0))}),e.Struct({ok:e.Literal(!1),error:al})]),sl=e.Struct({command:Zs,accounts:Me,approval:e.optionalKey(Ke),replay:e.optionalKey(Lt),deadline:e.optionalKey(Ie),workflowRun:e.optionalKey(fe)}),yo={version:4,schemas:{invocation:sl,request:Zs,response:nl,requirements:G.schemas.requirements,catalog:Sa,catalogSummary:ha,skills:G.schemas.skills,elicitationRequest:G.schemas.elicitationRequest,elicitationReply:G.schemas.elicitationReply,workflowStep:G.schemas.workflowStep,workflowStepReply:G.schemas.workflowStepReply,workflowControl:G.schemas.workflowControl,cacheCommand:G.schemas.cacheCommand,cacheReply:G.schemas.cacheReply}};var So=e.String.check(e.isMinLength(1),e.isMaxLength(255)),il=e.Struct({externalId:e.optionalKey(So),displayName:e.optionalKey(So),username:e.optionalKey(So),email:e.optionalKey(So),avatarUrl:e.optionalKey(h),profileUrl:e.optionalKey(h)}),cl=e.Struct({accountInfo:e.optionalKey(il)}),fa=e.Struct({capabilities:e.optionalKey(e.Struct({skills:e.Literal(!0),toolIndex:e.optionalKey(e.Literal(!0)),skillSources:e.optionalKey(e.Literal(!0)),scheduledTools:e.optionalKey(e.Literal(!0))})),database:e.optionalKey(Zr),accounts:e.Record(e.NonEmptyString,e.Struct({definition:et,cardinality:e.Literals([\"one\",\"many\"]),health:e.optionalKey(e.Literal(!0))}))}),pl=e.Struct({operation:e.Literal(\"account-check\"),requirement:e.NonEmptyString}),ho=e.Union([...yo.schemas.request.members,pl]),xa=e.Struct({command:ho,accounts:Me,approval:e.optionalKey(Ke),replay:e.optionalKey(Lt),deadline:e.optionalKey(Ie),workflowRun:e.optionalKey(fe)}),ga={version:5,schemas:{...yo.schemas,invocation:xa,request:ho,requirements:fa,accountCheck:cl}};var b=e.Union([e.Struct({...Et,discover:h,authorizationServerMetadataUrl:e.optionalKey(h),authorizationUrl:e.optionalKey(e.Never),tokenUrl:e.optionalKey(e.Never),revocationUrl:e.optionalKey(e.Never),scopes:e.optionalKey(e.Array(e.String))}),e.Struct({...Et,authorizationUrl:h,tokenUrl:h,revocationUrl:e.optionalKey(h),scopes:e.Array(e.String),issuer:e.optionalKey(h),discover:e.optionalKey(e.Never),authorizationServerMetadataUrl:e.optionalKey(e.Never)}).check(_r),e.Struct({grant:e.Literal(\"client_credentials\"),discover:h,authorizationServerMetadataUrl:e.optionalKey(h),authorizationUrl:e.optionalKey(e.Never),tokenUrl:e.optionalKey(e.Never),revocationUrl:e.optionalKey(e.Never),scopes:e.optionalKey(e.Array(e.String)),...Xe,tokenEndpointAuthMethod:Rt,resource:e.optionalKey(e.NullOr(h))}),e.Struct({grant:e.Literal(\"client_credentials\"),tokenUrl:h,revocationUrl:e.optionalKey(h),scopes:e.Array(e.String),...Xe,tokenEndpointAuthMethod:Rt,resource:e.optionalKey(e.NullOr(h)),authorizationUrl:e.optionalKey(e.Never),discover:e.optionalKey(e.Never),authorizationServerMetadataUrl:e.optionalKey(e.Never)})]);var ll=e.Union([e.Struct({type:e.Literal(\"secrets\"),label:e.String,fields:l}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[0].fields,response:l}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[1].fields,response:l}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[2].fields,response:l}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[3].fields,response:l})]),Qs=e.Struct({name:e.NonEmptyString,auth:e.Record(e.NonEmptyString,ll)}),ka=e.Struct({...fa.fields,accounts:e.Record(e.NonEmptyString,e.Struct({definition:Qs,cardinality:e.Literals([\"one\",\"many\"]),health:e.optionalKey(e.Literal(!0))}))}),fo=e.Struct({...Ye.fields,provider:Qs}),Xs=e.Record(e.NonEmptyString,e.Union([fo,e.Array(fo)])),Ra=e.Struct({...xa.fields,accounts:Xs}),Ea={version:6,schemas:{...ga.schemas,requirements:ka,accounts:Xs,invocation:Ra}};var Ta=e.String.check(e.isPattern(/^(\\*\\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*(?::[0-9]{1,5})?$/)),Ot={plain:e.optionalKey(e.Array(e.NonEmptyString)),raw:e.optionalKey(e.Array(e.NonEmptyString))},ml=e.Union([e.Struct({type:e.Literal(\"secrets\"),label:e.String,fields:l,...Ot}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[0].fields,response:l,...Ot}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[1].fields,response:l,...Ot}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[2].fields,response:l,...Ot}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[3].fields,response:l,...Ot})]),Ys=e.Struct({name:e.NonEmptyString,auth:e.Record(e.NonEmptyString,ml),hosts:e.optionalKey(e.Array(Ta))}),va=e.Struct({...ka.fields,accounts:e.Record(e.NonEmptyString,e.Struct({definition:Ys,cardinality:e.Literals([\"one\",\"many\"]),health:e.optionalKey(e.Literal(!0))}))}),xo=e.Struct({...fo.fields,provider:Ys}),ei=e.Record(e.NonEmptyString,e.Union([xo,e.Array(xo)])),Aa=e.Struct({...Ra.fields,accounts:ei}),wa={version:7,schemas:{...Ea.schemas,requirements:va,accounts:ei,invocation:Aa}};var ul=8,dl=256,yl=e.String.check(e.isPattern(/^[A-Za-z_$][A-Za-z0-9_$]{0,63}$/)),Sl=e.Union([e.String.check(e.isMaxLength(dl)),e.Finite,e.Boolean]),hl=e.Record(yl,Sl).check(e.isMaxProperties(ul)),La={source:e.optionalKey(pa),errorName:e.optionalKey(lo),code:e.optionalKey(la),message:e.optionalKey(mo),fields:e.optionalKey(hl)},fl=1024,ko=e.Struct({code:e.Union([e.Int,e.String.check(e.isMinLength(1),e.isMaxLength(128))]),message:e.optionalKey(e.String.check(e.isMaxLength(fl)))}),xl=e.Literals([\"connect\",\"discover\",\"call\"]),De=class extends e.TaggedError()(\"ProviderError\",{reason:e.Literals([\"unauthorized\",\"forbidden\",\"rate_limited\",\"unavailable\",\"rejected\"]),status:e.optional(e.Int.check(e.isBetween({minimum:100,maximum:599}))),accountId:e.optional(Ce),phase:e.optional(xl),upstream:e.optional(ko)}){},go=class extends e.TaggedError()(\"McpError\",{phase:e.Literals([\"connect\",\"discover\",\"call\",\"schema\",\"transport\"]),reason:e.Literals([\"request\",\"unauthorized\",\"invalid_response\",\"timeout\",\"invalid_input\"]),status:e.optional(e.Number),upstream:e.optional(ko)}){},Pe=class extends e.TaggedError()(\"HostDeclarationInvalid\",La){},Ue=class extends e.TaggedError()(\"HostEvaluationFailed\",La){},Ct=class extends e.TaggedError()(\"HostOperationFailed\",La){},gl=e.Union([De,go,ee,Pe,Ue]),Ro=e.Struct({...uo.fields,error:e.optionalKey(gl)}),ba=e.Struct({...Sa.fields,routers:e.Array(Ro)}),Ha=e.Struct({...ha.fields,routers:e.Array(Ro)}),kl=e.Union([se,De,go,ee,xe,U,_,Pe,Ue,W,Ct,Fe,qe,B,J,V,z,$,j,Y,Ne]),Rl=e.Union([e.Struct({ok:e.Literal(!0),value:d,toolError:e.optionalKey(e.Literal(!0))}),e.Struct({ok:e.Literal(!1),error:kl})]),Oa={version:8,schemas:{...wa.schemas,response:Rl,catalog:ba,catalogSummary:Ha}};var Eo=class extends e.TaggedError()(\"McpError\",{phase:e.Literals([\"connect\",\"discover\",\"call\",\"schema\",\"transport\"]),reason:e.Literals([\"request\",\"unauthorized\",\"invalid_response\",\"timeout\",\"invalid_input\"]),status:e.optional(e.Number),upstream:e.optional(ko),session:e.optional(e.Literal(!0))}){},To=class extends e.TaggedError()(\"SkillLoadFailed\",{reason:e.Literals([\"source\",\"request\",\"rate_limited\",\"document\",\"limit\",\"changed\",\"encoding\"]),message:e.optional(e.String.check(e.isMaxLength(500))),status:e.optional(e.Int.check(e.isBetween({minimum:100,maximum:599}))),missing:e.optional(e.Literals([\"repository\",\"ref\"]))}){},El=e.Union([De,Eo,To,Pe,Ue]),ti=e.Struct({...Ro.fields,error:e.optionalKey(El)}),Tl=e.Struct({...ba.fields,routers:e.Array(ti)}),vl=e.Struct({...Ha.fields,routers:e.Array(ti)}),Ca=e.Union([se,De,Eo,To,xe,U,_,Pe,Ue,W,Ct,Fe,qe,B,J,V,z,$,j,Y,Ne]),Al=e.Union([e.Struct({ok:e.Literal(!0),value:d,toolError:e.optionalKey(e.Literal(!0))}),e.Struct({ok:e.Literal(!1),error:Ca})]),Ma={version:9,schemas:{...Oa.schemas,response:Al,catalog:Tl,catalogSummary:vl}};var Ka=e.Struct({...va.fields,sql:e.optionalKey(e.Literal(!0))}),wl=e.Struct({operation:e.Literal(\"migrate\")}),Ll=e.Array(e.Struct({id:e.Int,name:e.NonEmptyString})),oi=e.Union([...ho.members,wl]),Ia=e.Struct({...Aa.fields,command:oi}),Fa={version:10,schemas:{...Ma.schemas,request:oi,requirements:Ka,invocation:Ia,migrate:Ll}};var ri=e.String.check(e.isPattern(/^[a-z][a-z0-9_]*(?:\\.[a-z][a-z0-9_]*)*$/u),e.isMaxLength(64)),bl=e.Union([e.String,e.Finite,e.Boolean]),Hl=e.Struct({description:e.String.check(e.isMinLength(1),e.isMaxLength(1e3)),filters:l,payload:l}),Ol=e.Record(ri,Hl),Cl=e.Struct({name:ri,id:e.String.check(e.isMinLength(1),e.isMaxLength(200)),occurredAt:e.Int.check(e.isGreaterThanOrEqualTo(0)),data:d,filters:e.Record(e.String,bl),account:e.NullOr(Ce)}),Ml=e.Array(Cl).check(e.isMaxLength(100)),Na=e.Struct({...Ka.fields,events:e.optionalKey(Ol)}),Kl=e.Union([e.Struct({ok:e.Literal(!0),value:d,toolError:e.optionalKey(e.Literal(!0)),events:e.optionalKey(Ml)}),e.Struct({ok:e.Literal(!1),error:Ca})]),qa=class extends e.TaggedError()(\"CacheError\",{reason:e.Literals([\"unavailable\",\"storage\",\"invalid\",\"capacity\",\"timeout\"]),limit:e.optionalKey(e.Literals([\"keyBytes\",\"entryBytes\",\"batchBytes\",\"batchEntries\",\"totalBytes\",\"totalEntries\"]))}){},Il=e.Union([e.Struct({ok:e.Literal(!0),value:e.Json}),e.Struct({ok:e.Literal(!1),error:qa})]),Da={version:11,schemas:{...Fa.schemas,requirements:Na,response:Kl,cacheReply:Il}};var ci=e.Struct({field:e.NonEmptyString}),Fl=e.Union([e.String,ci]),ql=e.Struct({base64:e.Array(Fl).check(e.isMinLength(1))}),Nl=e.Union([e.String,ci,ql]),ai=e.Array(Nl).check(e.isMinLength(1)),Dl=e.String.check(e.isPattern(/^[!#$%&'*+.^_`|~0-9a-z-]+$/u)),Pl=e.Union([e.Struct({in:e.Literal(\"header\"),name:Dl,value:ai}),e.Struct({in:e.Literal(\"query\"),name:e.NonEmptyString,value:ai})]),Ul=e.Array(Pl),Mt={plain:e.optionalKey(e.Array(e.NonEmptyString)),raw:e.optionalKey(e.Array(e.NonEmptyString)),request:e.optionalKey(Ul)},_l=e.Union([e.Struct({type:e.Literal(\"secrets\"),label:e.String,fields:l,...Mt}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[0].fields,response:l,...Mt}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[1].fields,response:l,...Mt}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[2].fields,response:l,...Mt}),e.Struct({type:e.Literal(\"oauth2\"),...b.members[3].fields,response:l,...Mt})]),pi=e.Struct({name:e.NonEmptyString,auth:e.Record(e.NonEmptyString,_l),hosts:e.optionalKey(e.Array(Ta))}),Pa=32*1024,Wl=e.Struct({...ya.fields,src:e.String.check(e.isPattern(/^(?:data:image\\/(?:svg\\+xml|png|webp|jpeg);base64,[A-Za-z0-9+/]*={0,2}|https:\\/\\/\\S+)$/u),e.isMaxLength(Pa))}),Bl=e.Array(Wl).check(e.isMaxLength(8),e.makeFilter(t=>JSON.stringify(t).length<=Pa,{message:`An app's icons total at most ${Pa} characters`})),Jl=e.Struct({...Na.fields,accounts:e.Record(e.NonEmptyString,e.Struct({definition:pi,cardinality:e.Literals([\"one\",\"many\"]),health:e.optionalKey(e.Literal(!0))})),icons:e.optionalKey(Bl)}),ni=e.Struct({...xo.fields,provider:pi}),li=e.Record(e.NonEmptyString,e.Union([ni,e.Array(ni)])),zl=e.Struct({...Ia.fields,accounts:li}),ie=e.String.check(e.isPattern(/^[a-f0-9]{64}$/)),si=e.Finite.check(e.isGreaterThanOrEqualTo(0)),ii=e.Struct({value:e.Json,version:e.String,freshUntil:si,staleUntil:si}),$l=e.Union([e.Struct({operation:e.Literal(\"read\"),keys:e.Array(ie)}),e.Struct({operation:e.Literal(\"acquire\"),key:ie,refresh:e.Boolean,version:e.optionalKey(e.NullOr(e.String)),reads:e.optionalKey(e.Array(ie))}),e.Struct({operation:e.Literal(\"claim\"),key:ie,version:e.NullOr(e.String)}),e.Struct({operation:e.Literal(\"publish\"),key:ie,lease:e.String,entry:ii}),e.Struct({operation:e.Literal(\"release\"),key:ie,lease:e.String}),e.Struct({operation:e.Literal(\"renew\"),key:ie,lease:e.String}),e.Struct({operation:e.Literal(\"write\"),entries:e.Array(e.Struct({key:ie,entry:ii}))}),e.Struct({operation:e.Literal(\"invalidate\"),key:ie})]),jl={version:12,schemas:{...Da.schemas,requirements:Jl,accounts:li,invocation:zl,cacheCommand:$l}};var Ua=class extends e.TaggedError()(\"CacheError\",{reason:e.Literals([\"unavailable\",\"storage\",\"invalid\",\"capacity\",\"timeout\"]),limit:e.optionalKey(e.Literals([\"keyBytes\",\"entryBytes\",\"batchBytes\",\"batchEntries\",\"totalBytes\",\"totalEntries\"]))}){},my={keyBytes:8192,entryBytes:2e6,batchBytes:8e6,batchEntries:128,totalBytes:128e6,totalEntries:1e5,retentionMs:10080*60*1e3,loadTimeoutMs:9e4,leaseMs:15e3,renewMs:5e3,waitMs:1e4,commandTimeoutMs:1e4},ce=e.String.check(e.isPattern(/^[a-f0-9]{64}$/)),mi=e.Finite.check(e.isGreaterThanOrEqualTo(0)),vo=e.Struct({value:e.Json,version:e.String,freshUntil:mi,staleUntil:mi}),uy=e.Struct({entry:e.NullOr(vo),lease:e.NullOr(e.String),reads:e.optionalKey(e.Array(e.NullOr(vo)))}),ui=e.Union([e.Struct({operation:e.Literal(\"read\"),keys:e.Array(ce)}),e.Struct({operation:e.Literal(\"acquire\"),key:ce,refresh:e.Boolean,version:e.optionalKey(e.NullOr(e.String)),reads:e.optionalKey(e.Array(ce))}),e.Struct({operation:e.Literal(\"claim\"),key:ce,version:e.NullOr(e.String)}),e.Struct({operation:e.Literal(\"publish\"),key:ce,lease:e.String,entry:vo}),e.Struct({operation:e.Literal(\"release\"),key:ce,lease:e.String}),e.Struct({operation:e.Literal(\"renew\"),key:ce,lease:e.String}),e.Struct({operation:e.Literal(\"write\"),entries:e.Array(e.Struct({key:ce,entry:vo}))}),e.Struct({operation:e.Literal(\"invalidate\"),key:ce})]);var di=e.Union([e.Struct({ok:e.Literal(!0),value:e.Json}),e.Struct({ok:e.Literal(!1),error:Ua})]);var Vl=6e4,_a=e.Int.check(e.isGreaterThan(0)),at=e.optionalKey(e.Never),hy=e.Union([e.Struct({seconds:_a,minutes:at,hours:at}),e.Struct({seconds:at,minutes:_a,hours:at}),e.Struct({seconds:at,minutes:at,hours:_a})]),Gl=e.Struct({expression:e.NonEmptyString,timezone:e.NonEmptyString}).check(e.makeFilter(t=>t.expression.trim().split(/\\s+/).length===5&&Z.isSuccess(Nt.parse(t.expression,t.timezone)))),Zl=e.Union([e.Struct({kind:e.Literal(\"interval\"),milliseconds:e.Int.check(e.makeFilter(t=>t>=Vl,{message:\"Schedule intervals must be at least 60 seconds\"}),e.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER))}),e.Struct({kind:e.Literal(\"cron\"),calendar:Gl})]),yi=e.Struct({name:e.NonEmptyString,scope:e.optionalKey(e.Literal(\"app\")),timing:Zl,input:k});var _e=class extends e.TaggedError()(\"McpError\",{phase:e.Literals([\"connect\",\"discover\",\"call\",\"schema\",\"transport\"]),reason:e.Literals([\"request\",\"unauthorized\",\"invalid_response\",\"timeout\",\"invalid_input\"]),status:e.optional(e.Number),upstream:e.optional(Ge),session:e.optional(e.Literal(!0))}){},We=class extends e.TaggedError()(\"SkillLoadFailed\",{reason:e.Literals([\"source\",\"request\",\"rate_limited\",\"document\",\"limit\",\"changed\",\"encoding\"]),message:e.optional(e.String.check(e.isMaxLength(500))),status:e.optional(e.Int.check(e.isBetween({minimum:100,maximum:599}))),missing:e.optional(e.Literals([\"repository\",\"ref\"]))}){},Si=e.String.check(e.isPattern(/^(\\*\\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*(?::[0-9]{1,5})?$/)),Kt={plain:e.optionalKey(e.Array(e.NonEmptyString)),raw:e.optionalKey(e.Array(e.NonEmptyString)),request:e.optionalKey(Os)},hi=e.Union([e.Struct({type:e.Literal(\"secrets\"),label:e.String,fields:S,...Kt}),e.Struct({type:e.Literal(\"oauth2\"),...kt.members[0].fields,response:S,...Kt}),e.Struct({type:e.Literal(\"oauth2\"),...kt.members[1].fields,response:S,...Kt}),e.Struct({type:e.Literal(\"oauth2\"),...kt.members[2].fields,response:S,...Kt}),e.Struct({type:e.Literal(\"oauth2\"),...kt.members[3].fields,response:S,...Kt})]),za=e.Struct({name:e.NonEmptyString,auth:e.Record(e.NonEmptyString,hi),hosts:e.optionalKey(e.Array(Si))}),fi=e.Struct({definition:za,cardinality:e.Literals([\"one\",\"many\"]),health:e.optionalKey(e.Literal(!0))}),Wa=e.Record(e.NonEmptyString,fi),xi=e.Struct({capabilities:e.optionalKey(e.Struct({skills:e.Literal(!0),toolIndex:e.optionalKey(e.Literal(!0)),skillSources:e.optionalKey(e.Literal(!0)),scheduledTools:e.optionalKey(e.Literal(!0)),sharedDefinitions:e.optionalKey(e.Literal(!0))})),database:e.optionalKey(Pn),accounts:e.Struct({app:Wa,user:Wa}),sql:e.optionalKey(e.Literal(!0)),events:e.optionalKey(Ts),icons:e.optionalKey(ro)}),It=e.Struct({id:D,provider:za,method:e.NonEmptyString,generation:e.optionalKey(e.Int),fields:S}),Ba=e.Record(e.NonEmptyString,e.Union([It,e.Array(It)])),$a=e.Struct({app:Ba,user:e.optionalKey(Ba)}),gi=e.Struct({tool:e.NonEmptyString,input:k}),ki=e.Finite.check(e.isGreaterThanOrEqualTo(0)),Ao=e.Struct({schedules:e.optionalKey(e.Array(yi)),name:e.NonEmptyString,router:e.optionalKey(e.NonEmptyString),tags:e.optionalKey(e.Array(e.NonEmptyString)),description:e.String,inputSchema:S,readOnly:e.optionalKey(e.Boolean),title:e.optionalKey(e.String),outputSchema:e.optionalKey(S),annotations:e.optionalKey(oo),_meta:e.optionalKey(S)}),Ri=Ao.mapFields(({inputSchema:t,outputSchema:o,_meta:n,...s})=>s),pe=class extends e.TaggedError()(\"HostDeclarationInvalid\",_t){},Be=class extends e.TaggedError()(\"HostEvaluationFailed\",_t){},Ei=e.Union([P,_e,We,pe,Be]),wo=e.Struct({path:e.String,title:e.optionalKey(e.String),description:e.optionalKey(e.String),icons:e.optionalKey(e.Array(ye)),tags:e.optionalKey(e.Record(e.NonEmptyString,e.String)),skill:e.optionalKey(gn),error:e.optionalKey(Ei)}),Ti=e.Struct({tools:e.Array(Ao),routers:e.Array(wo)}),vi=e.Struct({tools:e.Array(Ri),routers:e.Array(wo)}),Ai=e.Literals([\"inputSchema\",\"outputSchema\"]),wi=e.Struct({...Ao.fields,shared:e.optionalKey(e.Array(Ai))}),Li=e.Struct({tools:e.Array(wi),routers:e.Array(wo),definitions:e.Array(k),defs:e.Array(e.Record(e.String,e.Int))}),Lo=e.Struct({skills:Uo,dynamic:e.Boolean,cached:e.optionalKey(e.Boolean)}),bi=e.Union([Lo,Uo]),Ja=e.Literals([\"query\",\"mutation\"]),Hi=e.Struct({operation:e.Literal(\"account-check\"),requirement:e.NonEmptyString}),Oi=e.Struct({operation:e.Literal(\"migrate\")}),Ci=e.Array(e.Struct({id:e.Int,name:e.NonEmptyString})),ja=e.Union([Kn,Rs,e.Struct({operation:e.Literal(\"requirements\")}),e.Struct({operation:e.Literal(\"inspect\"),detail:e.optionalKey(e.Literal(\"summary\")),tools:e.optionalKey(e.Array(e.NonEmptyString)),scheduled:e.optionalKey(e.Literal(!0)),definitions:e.optionalKey(e.Literal(\"shared\"))}),e.Struct({operation:e.Literal(\"skills\"),sources:e.optionalKey(e.Literal(!0))}),e.Struct({operation:e.Literal(\"query\"),name:e.NonEmptyString,input:k}),e.Struct({operation:e.Literal(\"mutate\"),name:e.NonEmptyString,input:k}),e.Struct({operation:e.Literal(\"call\"),tool:e.NonEmptyString,kind:e.optionalKey(Ja),input:k}),Hi,Oi]),ge=class extends e.TaggedError()(\"HostRequestInvalid\",{}){},Je=class extends e.TaggedError()(\"HostAccountsInvalid\",{}){},ze=class extends e.TaggedError()(\"HostOperationNotFound\",{}){},$e=class extends e.TaggedError()(\"HostOperationFailed\",_t){},nt=class extends e.TaggedError()(\"HostToolNotFound\",{}){},st=class extends e.TaggedError()(\"HostKindMismatch\",{tool:e.NonEmptyString,requested:Ja,actual:Ja}){},Mi=e.String.check(e.isMaxLength(512)),Ki=10,it=class extends e.TaggedError()(\"HostInputInvalid\",{problems:e.optionalKey(e.Array(Mi).check(e.isMaxLength(Ki)))}){},ct=class extends e.TaggedError()(\"HostToolBlocked\",{}){},pt=class extends e.TaggedError()(\"HostToolApprovalRequired\",{input:k,elicitation:Mr}){},lt=class extends e.TaggedError()(\"HostToolPolicyFailed\",{}){},je=class extends e.TaggedError()(\"HostOutputInvalid\",{}){},Ii=e.Union([Re,P,_e,We,re,ge,Je,pe,Be,ze,$e,Te,ve,nt,it,je,ct,pt,lt,de,st]),Fi=e.Union([e.Struct({ok:e.Literal(!0),value:k,toolError:e.optionalKey(e.Literal(!0)),events:e.optionalKey(vs)}),e.Struct({ok:e.Literal(!1),error:Ii})]),qi=e.Struct({command:ja,accounts:$a,approval:e.optionalKey(gi),replay:e.optionalKey(Mn),deadline:e.optionalKey(ki),workflowRun:e.optionalKey(Ee)});var Ql={version:13,schemas:{invocation:qi,request:ja,response:Fi,requirements:xi,catalog:Ti,catalogSummary:vi,sharedCatalog:Li,skills:bi,elicitationRequest:to,elicitationReply:Cr,workflowStep:In,workflowStepReply:Fn,workflowControl:qn,cacheCommand:ui,cacheReply:di,accountCheck:Ur,accounts:$a,migrate:Ci}};var Va=(t,o,n)=>{o===\"__proto__\"?Object.defineProperty(t,o,{value:n,enumerable:!0,writable:!0,configurable:!0}):t[o]=n},Xl=t=>typeof t==\"object\"&&t!==null&&!Array.isArray(t),Ni=t=>{let o=t?.$defs;return Xl(o)?o:void 0};var Py=t=>{let o=[],n=new Map,s=T=>{let A=n.get(T);return A===void 0&&n.set(T,A=o.push(T)-1),A},p=[],c=new Map,y=0,x=(T,A)=>{let I=c.get(T);I===void 0&&c.set(T,I=new Map);let Ve=I.get(A);return Ve===void 0&&I.set(A,Ve=y++),Ve},H=new Map,M=new Map,Ui=T=>{let A=H.get(T);if(A!==void 0)return A;let I={},Ve=[];for(let[Qa,_i]of Object.entries(T)){let Xa=s(_i);Va(I,Qa,Xa),Ve.push(x(Qa,Xa))}let Za=Ve.join(\",\"),Ft=M.get(Za);return Ft===void 0&&M.set(Za,Ft=p.push(I)-1),H.set(T,Ft),Ft},Ga=T=>{let A=Ni(T);return T===void 0||A===void 0?void 0:{...T,$defs:Ui(A)}};return{tools:t.tools.map(T=>{let A=Ga(T.inputSchema),I=Ga(T.outputSchema);return A===void 0&&I===void 0?T:{...T,...A===void 0?{}:{inputSchema:A},...I===void 0?{}:{outputSchema:I},shared:[...A===void 0?[]:[\"inputSchema\"],...I===void 0?[]:[\"outputSchema\"]]}}),routers:t.routers,definitions:o,defs:p}},Yl=t=>{let{definitions:o}=t,n=[];for(let c of t.defs){let y={};for(let[x,H]of Object.entries(c)){let M=o[H];if(M===void 0)return;Va(y,x,M)}n.push(y)}let s=c=>{let y=c?.$defs,x=typeof y==\"number\"?n[y]:void 0;return c===void 0||x===void 0?void 0:{...c,$defs:x}},p=[];for(let{shared:c,...y}of t.tools){let x=y;for(let H of c??[]){let M=s(x[H]);if(M===void 0)return;x=H===\"inputSchema\"?{...x,inputSchema:M}:{...x,outputSchema:M}}p.push(x)}return{tools:p,routers:t.routers}};var Di=e.Struct({...It.fields,managed:e.optionalKey(e.Literal(!0))}),Pi=e.Record(e.NonEmptyString,e.Union([Di,e.Array(Di)])),Gy=e.Struct({app:Pi,user:e.optionalKey(Pi)}),Zy=t=>[...Object.entries(t.app),...Object.entries(t.user??{})],Qy=t=>t?{operation:\"skills\",sources:!0}:{operation:\"skills\"},Xy=t=>e.is(Lo)(t)?t:{skills:t},Yy=t=>({operation:\"inspect\",...t.tools===void 0?{}:{tools:[...t.tools]},...t.scheduled===void 0?{}:{scheduled:t.scheduled},...t.definitions===void 0?{}:{definitions:t.definitions}}),eS={operation:\"inspect\",detail:\"summary\"},tS=t=>o=>t===void 0?o:{...o,tools:o.tools.filter(n=>t.includes(n.name))},oS=e.Union([ge,pe,ve]),em=e.Union([P,_e,We,ge,pe,Je,Be]),tm=e.Union([Re,re,em,nt,ze,st,$e,Te,it,je,ct,pt,lt,de]),rS=e.Union([P,re,ge,pe,Je,ze,$e,je]),aS=tm,nS=qt.Reference(\"apps/ToolResultObservation\",{defaultValue:()=>({failed:()=>{}})}),sS=e.Struct({elapsedMs:e.Finite,upstreamMs:e.Finite,elicitationMs:e.Finite,authoredMs:e.Finite,leaseMs:e.optionalKey(e.Finite),backgroundMs:e.optionalKey(e.Finite)}),iS=qt.Reference(\"apps/InvocationTimingSink\",{defaultValue:()=>()=>{}});export{Wi as a,Bi as b,_o as c,Ji as d,Wo as e,zi as f,$i as g,ji as h,Vi as i,Gi as j,_t as k,Zi as l,Ge as m,kn as n,k as o,S as p,D as q,R as r,Rn as s,En as t,P as u,wn as v,St as w,Ln as x,bn as y,ec as z,rc as A,ac as B,Sm as C,Bo as D,Ua as E,my as F,vo as G,uy as H,ui as I,di as J,Ms as K,qs as L,Nr as M,Ns as N,Ps as O,Us as P,_s as Q,kt as R,$u as S,Is as T,Ws as U,Ur as V,Fs as W,Pr as X,bs as Y,ip as Z,cp as _,pp as $,lp as aa,Hs as ba,Os as ca,Cs as da,Uu as ea,up as fa,_u as ga,qr as ha,Wu as ia,Tn as ja,Xi as ka,vn as la,An as ma,Re as na,um as oa,Ee as pa,oe as qa,sc as ra,Jo as sa,ic as ta,On as ua,cc as va,re as wa,Hn as xa,Cn as ya,vm as za,pc as Aa,Am as Ba,Mn as Ca,Kn as Da,In as Ea,Fn as Fa,qn as Ga,Te as Ha,ve as Ia,Fm as Ja,qm as Ka,ds as La,_c as Ma,to as Na,Or as Oa,de as Pa,Cr as Qa,Mr as Ra,Wc as Sa,fs as Ta,jc as Ua,Vc as Va,Gc as Wa,ye as Xa,Zc as Ya,gs as Za,Ir as _a,cu as $a,Qc as ab,pu as bb,lu as cb,uu as db,du as eb,yu as fb,Kr as gb,xs as hb,Xc as ib,Yc as jb,ep as kb,xu as lb,tp as mb,op as nb,gu as ob,Rs as pb,Es as qb,rp as rb,ap as sb,Fr as tb,np as ub,Ts as vb,sp as wb,vs as xb,Se as yb,ws as zb,ro as Ab,wu as Bb,Bs as Cb,tt as Db,Gp as Eb,G as Fb,yo as Gb,ga as Hb,Ea as Ib,wa as Jb,Oa as Kb,Ma as Lb,Fa as Mb,Da as Nb,jl as Ob,Vl as Pb,hy as Qb,Gl as Rb,Zl as Sb,yi as Tb,_e as Ub,We as Vb,Si as Wb,hi as Xb,za as Yb,fi as Zb,Wa as _b,xi as $b,It as ac,Ba as bc,$a as cc,gi as dc,ki as ec,Ao as fc,Ri as gc,pe as hc,Be as ic,Ei as jc,wo as kc,Ti as lc,vi as mc,Ai as nc,wi as oc,Li as pc,Lo as qc,bi as rc,Hi as sc,Oi as tc,Ci as uc,ja as vc,ge as wc,Je as xc,ze as yc,$e as zc,nt as Ac,st as Bc,Mi as Cc,Ki as Dc,it as Ec,ct as Fc,pt as Gc,lt as Hc,je as Ic,Ii as Jc,Fi as Kc,qi as Lc,Ql as Mc,Py as Nc,Yl as Oc,Di as Pc,Pi as Qc,Gy as Rc,Zy as Sc,Qy as Tc,Xy as Uc,Yy as Vc,eS as Wc,tS as Xc,oS as Yc,em as Zc,tm as _c,rS as $c,aS as ad,nS as bd,sS as cd,iS as dd};\n","node_modules/apps/chunk-IRY5FGME.js":"import{b as Ae}from\"./chunk-OOJM4CTU.js\";var bt={};Ae(bt,{Reference:()=>Ee,Service:()=>vr,ServiceTypeId:()=>Sh,add:()=>zt,addOrOmit:()=>vH,addUnsafe:()=>JO,empty:()=>tr,get:()=>Te,getOption:()=>rp,getOrElse:()=>OH,getOrUndefined:()=>tp,getOrUndefinedUnsafe:()=>_u,getUnsafe:()=>jn,hasSameCache:()=>rE,isContext:()=>Ou,isKey:()=>CH,isReference:()=>Ih,make:()=>ss,makeUnsafe:()=>ho,merge:()=>Ru,mergeAll:()=>oE,omit:()=>GO,pick:()=>RH});var K=(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 r=e;for(let n=0,o=t.length;n<o;n++)r=t[n](r);return r}}},kS={pipe(){return K(this,arguments)}},ya=(function(){function e(){}return e.prototype=kS,e})();var f=function(e,t){if(typeof e==\"function\")return function(){return e(arguments)?t.apply(this,arguments):r=>t(r,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(r,n){return arguments.length>=2?t(r,n):function(o){return t(o,r)}};case 3:return function(r,n,o){return arguments.length>=3?t(r,n,o):function(s){return t(s,r,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let r=arguments;return function(n){return t(n,...r)}}}};var _=e=>e;var $e=e=>()=>e,hr=$e(!0),_l=$e(!1),Xm=$e(null),zr=$e(void 0),wr=zr;function Rl(e,...t){return K(e,t)}function Yv(e,t,r,n,o,s,a,i,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return r(t(e.apply(this,arguments)))};case 4:return function(){return n(r(t(e.apply(this,arguments))))};case 5:return function(){return o(n(r(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(n(r(t(e.apply(this,arguments))))))};case 7:return function(){return a(s(o(n(r(t(e.apply(this,arguments)))))))};case 8:return function(){return i(a(s(o(n(r(t(e.apply(this,arguments))))))))};case 9:return function(){return c(i(a(s(o(n(r(t(e.apply(this,arguments)))))))))}}}function Tn(e){let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),o}}function yi(e){let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),o!==r&&t.set(o,o),o}}var Ml=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(\"stack\");let r=Object.getPrototypeOf(e),n=r;for(;n!==null&&n!==Object.prototype;){let o=Reflect.ownKeys(n);for(let s=0;s<o.length;s++)t.add(o[s]);n=Object.getPrototypeOf(n)}return t.has(\"constructor\")&&typeof e.constructor==\"function\"&&r===e.constructor.prototype&&t.delete(\"constructor\"),t},lu=new WeakSet,Pl=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);var bi=0,eO=()=>{bi++};var _e={};Ae(_e,{Struct:()=>tq,Tuple:()=>eq,and:()=>oq,compose:()=>Xj,eqv:()=>aq,every:()=>fq,hasProperty:()=>k,implies:()=>iq,isBigInt:()=>Fl,isBoolean:()=>Si,isDate:()=>OS,isError:()=>vS,isFunction:()=>Ht,isIterable:()=>Yo,isMap:()=>Wj,isNever:()=>AS,isNotNull:()=>Jj,isNotNullish:()=>Dl,isNotUndefined:()=>kr,isNull:()=>CS,isNullish:()=>Gj,isNumber:()=>ba,isObject:()=>kt,isObjectKeyword:()=>du,isObjectOrArray:()=>Kj,isPromise:()=>Qj,isPromiseLike:()=>Yj,isPropertyKey:()=>Ul,isReadonlyObject:()=>Vj,isRegExp:()=>tO,isSet:()=>Hj,isString:()=>ur,isSymbol:()=>pu,isTagged:()=>Nt,isTruthy:()=>qj,isTupleOf:()=>zj,isTupleOfAtLeast:()=>jj,isUint8Array:()=>Zj,isUndefined:()=>Nl,isUnknown:()=>eh,mapInput:()=>Bj,nand:()=>uq,nor:()=>cq,not:()=>rq,or:()=>nq,some:()=>lq,xor:()=>sq});var Bj=f(2,(e,t)=>r=>e(t(r))),zj=f(2,(e,t)=>e.length===t),jj=f(2,(e,t)=>e.length>=t);function qj(e){return!!e}function Hj(e){return e instanceof Set}function Wj(e){return e instanceof Map}function ur(e){return typeof e==\"string\"}function ba(e){return typeof e==\"number\"}function Si(e){return typeof e==\"boolean\"}function Fl(e){return typeof e==\"bigint\"}function pu(e){return typeof e==\"symbol\"}function Ul(e){return ur(e)||ba(e)||pu(e)}function Ht(e){return typeof e==\"function\"}function Nl(e){return e===void 0}function kr(e){return e!==void 0}function CS(e){return e===null}function Jj(e){return e!==null}function Gj(e){return e==null}function Dl(e){return e!=null}function AS(e){return!1}function eh(e){return!0}function Kj(e){return typeof e==\"object\"&&e!==null}function kt(e){return typeof e==\"object\"&&e!==null&&!Array.isArray(e)}function Vj(e){return kt(e)}function du(e){return typeof e==\"object\"&&e!==null||Ht(e)}var k=f(2,(e,t)=>du(e)&&t in e),Nt=f(2,(e,t)=>k(e,\"_tag\")&&e._tag===t);function vS(e){return e instanceof Error}function Zj(e){return e instanceof Uint8Array}function OS(e){return e instanceof Date}function Yo(e){return k(e,Symbol.iterator)||ur(e)}function Qj(e){return k(e,\"then\")&&\"catch\"in e&&Ht(e.then)&&Ht(e.catch)}function Yj(e){return k(e,\"then\")&&Ht(e.then)}function tO(e){return e instanceof RegExp}var Xj=f(2,(e,t)=>r=>e(r)&&t(r));function eq(e){return t=>{for(let r=0;r<e.length;r++)if(e[r](t[r])===!1)return!1;return!0}}function tq(e){let t=Object.keys(e);return r=>{for(let n of t)if(!e[n](r[n]))return!1;return!0}}function rq(e){return t=>!e(t)}var nq=f(2,(e,t)=>r=>e(r)||t(r)),oq=f(2,(e,t)=>r=>e(r)&&t(r)),sq=f(2,(e,t)=>r=>e(r)!==t(r)),aq=f(2,(e,t)=>r=>e(r)===t(r)),iq=f(2,(e,t)=>r=>e(r)?t(r):!0),cq=f(2,(e,t)=>r=>!(e(r)||t(r))),uq=f(2,(e,t)=>r=>!(e(r)&&t(r)));function fq(e){return t=>{for(let r of e)if(!r(t))return!1;return!0}}function lq(e){return t=>{for(let r of e)if(r(t))return!0;return!1}}var ae=\"~effect/Hash\",H=e=>{switch(typeof e){case\"number\":return Dt(e);case\"bigint\":return Ne(e.toString(10));case\"string\":return Ne(e);case\"function\":case\"object\":{if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?Ne(\"Invalid Date\"):Ne(e.toISOString());if(e instanceof RegExp)return Ne(e.toString());{if(lu.has(e))return th(e);let t=nO.get(e);if(t!==void 0)return t;if(MS.has(e))return eO(),Ne(\"[Circular]\");MS.add(e);let r=bi,n;try{ae in e?n=e[ae]():typeof e==\"function\"?n=th(e):e instanceof DataView?n=xr(Pl(e)):Array.isArray(e)||ArrayBuffer.isView(e)?n=xr(e):e instanceof Map?n=pq(e):e instanceof Set?n=dq(e):n=Ll(e)}finally{MS.delete(e)}return r===bi&&nO.set(e,n),n}}}return fr(oO(Ne(String(e))))},th=e=>(RS.has(e)||RS.set(e,fr(Math.random()*4294967296|0)),RS.get(e)),oO=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),oe=f(2,(e,t)=>oO(Math.imul(e,2654435761)+Math.imul(t,2246822507))),fr=e=>e&3221225471|e>>>1&1073741824;var _S=new DataView(new ArrayBuffer(8)),Dt=e=>{let t=e|0;return t===e?fr(t):(_S.setFloat64(0,e!==e?NaN:e),fr(oe(_S.getInt32(0),_S.getInt32(4))))},Ne=e=>{let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return fr(t)},PS=(e,t)=>{let r=12289;for(let n of t)r^=oe(H(n),H(e[n]));return fr(r)},Ll=e=>PS(e,Ml(e)),sO=(e,t)=>r=>{let n=e;for(let o of r)n^=t(o);return fr(n)},xr=e=>{let t=6151;for(let r of e)t=oe(t,H(r));return fr(t)},pq=sO(Ne(\"Map\"),([e,t])=>oe(H(e),H(t))),rO=Ne(\"Set\"),dq=sO(rO,e=>oe(rO,H(e))),RS=new WeakMap,nO=new WeakMap,MS=new WeakSet;var ie=\"~effect/Equal\";function J(){return arguments.length===1?e=>Ei(e,arguments[0]):Ei(arguments[0],arguments[1])}function Ei(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let r=typeof e;return r!==typeof t?!1:r===\"number\"&&e!==e&&t!==t?!0:r!==\"object\"&&r!==\"function\"||lu.has(e)||lu.has(t)?!1:mq(e,t)}function mq(e,t){let r=rh.length;for(let s=r;s-- >0;)if(rh[s]===e&&FS[s]===t)return!0;if(r)return aO(e,t);let n=iO.get(e);n||iO.set(e,n=new WeakMap);let o=n.get(t);return o===void 0&&n.set(t,o=aO(e,t)),o}function aO(e,t){rh.push(e),FS.push(t);try{return hq(e,t)}finally{rh.pop(),FS.pop()}}var rh=[],FS=[],iO=new WeakMap;function hq(e,t){if(H(e)!==H(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),o=t.getTime();return n===o||Number.isNaN(n)&&Number.isNaN(o)}else if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let r=uO(e);if(r!==uO(t)||typeof e==\"function\"&&!r)return!1;if(r)return e[ie](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:xq(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?cO(Pl(e),Pl(t)):cO(e,t)}else{if(e instanceof Map)return!(t instanceof Map)||e.size!==t.size?!1:US(e,t,yq,bq);if(e instanceof Set)return!(t instanceof Set)||e.size!==t.size?!1:US(e,t,H,Ei)}return gq(e,t)}function xq(e,t){for(let r=0;r<e.length;r++)if(!Ei(e[r],t[r]))return!1;return!0}function cO(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function gq(e,t){let r=Ml(e),n=Ml(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o)||!Ei(e[o],t[o]))return!1;return!0}function US(e,t,r,n){let o=new Map;for(let s of t){let a=r(s),i=o.get(a);i?i.push(s):o.set(a,[s])}e:for(let s of e){let a=o.get(r(s));if(a){for(let i=0;i<a.length;i++)if(n(s,a[i])){a[i]=a[a.length-1],a.pop();continue e}}return!1}return!0}var yq=e=>H(e[0]),bq=(e,t)=>Ei(e[0],t[0])&&Ei(e[1],t[1]),Sq=()=>0;function nh(e,t){return $l((r,n)=>e(r[0],n[0])&&t(r[1],n[1]))}function $l(e){return function(r,n){return US(r,n,Sq,e)}}var uO=e=>k(e,ie),NS=()=>J;var fO=e=>(lu.add(e),e);var Ii=Symbol.for(\"~effect/Redactable\"),Eq=e=>k(e,Ii);function $n(e){return Eq(e)?DS(e):e}function DS(e){return e[Ii](globalThis[mu]?.context??Iq)}var mu=\"~effect/Fiber/currentFiber\",lO=new Map,Iq={\"~effect/Context\":{},base:lO,depth:0,mapUnsafe:lO,pipe(){return K(this,arguments)}};function L(e,t){let r=t?.space??0,n=new WeakSet,o=r?typeof r==\"number\"?\" \".repeat(r):r:\"\",s=l=>o.repeat(l),a=(l,p)=>{let d=l?.constructor;return d&&d!==Object.prototype.constructor&&d.name?`${d.name}(${p})`:p},i=l=>{try{return Reflect.ownKeys(l)}catch{return[\"[ownKeys threw]\"]}};function c(l,p=0){try{return u(l,p)}catch{return(typeof l==\"object\"&&l!==null||typeof l==\"function\")&&n.delete(l),\"[inspection threw]\"}}function u(l,p=0){if(typeof l==\"string\")return JSON.stringify(l);if(typeof l==\"number\"||l==null||typeof l==\"boolean\"||typeof l==\"symbol\")return String(l);if(typeof l==\"bigint\")return String(l)+\"n\";if(typeof l==\"object\"||typeof l==\"function\"){if(n.has(l))return Tq;n.add(l);let d;if(Ii in l)d=c(DS(l),p);else if(Array.isArray(l))d=!o||l.length<=1?`[${l.map(m=>c(m,p)).join(\",\")}]`:`[\n${s(p+1)}${l.map(m=>c(m,p+1)).join(`,\n`+s(p+1))}\n${s(p)}]`;else if(l instanceof Date)d=LS(l);else if(!t?.ignoreToString&&k(l,\"toString\")&&typeof l.toString==\"function\"&&l.toString!==Object.prototype.toString&&l.toString!==Array.prototype.toString){let m=wq(l);d=l instanceof Error&&l.cause!==void 0?`${m} (cause: ${c(l.cause,p)})`:m}else if(Symbol.iterator in l)d=`${l.constructor.name}(${c(Array.from(l),p)})`;else{let m=i(l);if(!o||m.length<=1){let x=`{${m.map(g=>`${Xo(g)}:${c(dO(l,g),p)}`).join(\",\")}}`;d=a(l,x)}else{let x=`{\n${m.map(g=>`${s(p+1)}${Xo(g)}: ${c(dO(l,g),p+1)}`).join(`,\n`)}\n${s(p)}}`;d=a(l,x)}}return n.delete(l),d}return String(l)}return c(e,0)}var Tq=\"[Circular]\";function Xo(e){return typeof e==\"string\"?JSON.stringify(e):String(e)}function oh(e){return e.map(t=>`[${Xo(t)}]`).join(\"\")}function LS(e){try{return e.toISOString()}catch{return\"Invalid Date\"}}function wq(e){try{let t=e.toString();return typeof t==\"string\"?t:String(t)}catch{return\"[toString threw]\"}}function dO(e,t){try{return e[t]}catch{return\"[property access threw]\"}}function Os(e,t){let r=[];return JSON.stringify(e,function(n,o){let s=Object.getOwnPropertyDescriptor(this,n)?.value,a=k(s,Ii)?$n(s):$n(o);if(typeof a==\"bigint\")return L(a);if(typeof a!=\"object\"||a===null)return a;let i=a instanceof Error&&!k(a,\"toJSON\")?{...a,name:a.name,message:a.message}:a;for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(!r.includes(a))return r.push(a),i!==a&&r.push(i),i},t?.space)??\"null\"}var Ie=Symbol.for(\"nodejs.util.inspect.custom\"),Lt=e=>{try{return e=$n(e),k(e,\"toJSON\")&&Ht(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(Lt):e}catch{return\"[toJSON threw]\"}},xO=(e,t=2)=>{if(typeof e==\"string\")return e;try{return typeof e==\"object\"?Os(e,{space:t}):L(e,{space:t})}catch{return String(e)}},hu={toJSON(){return Lt(this)},[Ie](){return this.toJSON()},toString(){return L(this.toJSON())}},hO=class{[Ie](){return this.toJSON()}toString(){return L(this.toJSON())}};var kq=()=>{let e=Object.getOwnPropertyDescriptor(Error,\"stackTraceLimit\");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,\"writable\")?e.writable===!0:e.set!==void 0},Cq=kq(),Bn=()=>Error.stackTraceLimit,Cr=e=>{Cq&&(Error.stackTraceLimit=e)};var Sa=class{constructor(t){this.value=t,this.done=!1}next(t){return this.done?(this.value=t,this):(this.done=!0,{value:this.value,done:!1})}},Aq=()=>{let e=\"~effect/Utils/internal\",t={[e]:o=>o()},r={[e]:o=>o()};return Bn()!==0&&t[e](()=>new Error().stack)?.includes(e)===!0?t[e]:r[e]},Ea=Aq();function w(e,t,r){t===\"__proto__\"?Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}):e[t]=r}function ah(e,t){for(let r of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,r)&&w(e,r,t[r])}var ts=\"~effect/Effect\",Ti=\"~effect/Exit\",Oq={_A:_,_E:_,_R:_},$S=`${ts}/identifier`,me=`${ts}/args`,dt=`${ts}/evaluate`,Wt=`${ts}/successCont`,wn=`${ts}/failureCont`,wi=`${ts}/ensureCont`,Ai=Symbol.for(\"effect/Effect/Yield\"),$t={pipe(){return K(this,arguments)},toJSON(){return{...this}},toString(){return L(this.toJSON(),{ignoreToString:!0,space:2})},[Ie](){return this.toJSON()}},yO={[ae](){return PS(this,Object.keys(this))},[ie](e){let t=Object.keys(this),r=Object.keys(e);if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==r[n]||!J(this[t[n]],e[t[n]]))return!1;return!0}},_q={[ts]:Oq,...$t,[Symbol.iterator](){return new Sa(this)},toJSON(){return{_id:\"Effect\",op:this[$S],...me in this?{args:this[me]}:void 0}}},ue=e=>k(e,ts),BS=e=>k(e,Ti),Bl=\"~effect/Cause\",xu=\"~effect/Cause/Reason\",yu=e=>k(e,Bl),bO=e=>k(e,xu),es=class{constructor(t){this[Bl]=Bl,this.reasons=t}pipe(){return K(this,arguments)}toJSON(){return{_id:\"Cause\",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${L(this.reasons)})`}[Ie](){return this.toJSON()}[ie](t){return yu(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((r,n)=>J(r,t.reasons[n]))}[ae](){return xr(this.reasons)}},gO=new WeakMap,gu=class{[xu];annotations;_tag;constructor(t,r,n){if(this[xu]=xu,this._tag=t,r!==ql&&typeof n==\"object\"&&n!==null&&r.size>0){let o=gO.get(n);o&&(r=new Map([...o,...r])),gO.set(n,r)}this.annotations=r}annotate(t,r){if(t.mapUnsafe.size===0)return this;let n=new Map(this.annotations);t.mapUnsafe.forEach((s,a)=>{r?.overwrite!==!0&&n.has(a)||n.set(a,s)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=n,o}pipe(){return K(this,arguments)}toString(){return L(this)}[Ie](){return this.toString()}},ql=new Map,ki=class extends gu{constructor(t,r=ql){super(\"Fail\",r,t),this.error=t}toString(){return`Fail(${L(this.error)})`}toJSON(){return{_tag:\"Fail\",error:this.error}}[ie](t){return Rs(t)&&J(this.error,t.error)&&J(this.annotations,t.annotations)}[ae](){return oe(Ne(this._tag))(oe(H(this.error))(H(this.annotations)))}},_s=e=>new es(e),Rq=(e,t)=>{let r=new Map,n=[];for(let o of e.concat(t)){let s=H(o),a=r.get(s);if(a===void 0)r.set(s,[o]);else{if(a.some(i=>J(i,o)))continue;a.push(o)}n.push(o)}return n},vi=f(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let r=new es(Rq(e.reasons,t.reasons));return J(e,r)?e:r}),ih=new es([]),Oi=e=>new es([new ki(e)]),zl=class extends gu{constructor(t,r=ql){super(\"Die\",r,t),this.defect=t}toString(){return`Die(${L(this.defect)})`}toJSON(){return{_tag:\"Die\",defect:this.defect}}[ie](t){return _i(t)&&J(this.defect,t.defect)&&J(this.annotations,t.annotations)}[ae](){return oe(Ne(this._tag))(oe(H(this.defect))(H(this.annotations)))}},zS=e=>new es([new zl(e)]),bu=f(e=>yu(e[0]),(e,t,r)=>t.mapUnsafe.size===0?e:new es(e.reasons.map(n=>n.annotate(t,r)))),Rs=e=>e._tag===\"Fail\",_i=e=>e._tag===\"Die\",Ri=e=>e._tag===\"Interrupt\";function Mq(e){return Ar(\"Effect.evaluate: Not implemented\")}var kn=e=>({..._q,[$S]:e.op,[dt]:e[dt]??Mq,[Wt]:e[Wt],[wn]:e[wn],[wi]:e[wi]}),rs=e=>{let t=kn(e),r=function(n){this[me]=n};return r.prototype=t,function(n){return new r(n)}},SO=e=>{let t={[Ti]:Ti,_tag:e.op,get[e.prop](){return this[me]},...kn(e),toString(){return`${e.op}(${L(this[me])})`},toJSON(){return{_id:\"Exit\",_tag:e.op,[e.prop]:this[me]}},[ie](n){return BS(n)&&n._tag===this._tag&&J(this[me],n[me])},[ae](){return oe(Ne(e.op),H(this[me]))}},r=function(n){this[me]=n};return r.prototype=t,function(n){return new r(n)}},ve=SO({op:\"Success\",prop:\"value\",[dt](e){let t=e.getCont(Wt);return t?t[Wt](this[me],e,this):e.yieldWith(this)}}),ch={key:\"effect/Cause/StackTrace\"},jS={key:\"effect/Cause/InterruptorStackTrace\"},lr=SO({op:\"Failure\",prop:\"cause\",[dt](e){let t=this[me],r=!1;e.cache.stackFrame&&(t=bu(t,{mapUnsafe:new Map([[ch.key,e.cache.stackFrame]])}),r=!0);let n=e.getCont(wn),o=e._interruptedCause;if(o&&e.interruptible){let s=!1;for(;n&&e.interruptible;)s||=$S in n,n=e.getCont(wn);s&&(t=_s(t.reasons.filter(a=>a._tag!==\"Fail\"))),t=vi(t,o),r=!0}return n?n[wn](t,e,r?void 0:this):e.yieldWith(r?lr(t):this)}}),en=e=>lr(Oi(e)),Ar=e=>lr(zS(e)),re=rs({op:\"WithFiber\",[dt](e){return this[me](e)}}),EO=rs({op:\"WithFiberSucceed\",[dt](e){let t=this[me](e),r=e.getCont(Wt);return r?r[Wt](t,e):e.yieldWith(ve(t))}}),Pq=(function(){class e extends globalThis.Error{}let t=kn({op:\"YieldableError\",[dt](){return en(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),Hl=(function(){let e=Symbol.for(\"effect/Data/Error/plainArgs\");return class extends Pq{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0),r&&(ah(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),Ms=e=>{class t extends Hl{_tag=e}return t.prototype.name=e,t},jl=\"~effect/Cause/NoSuchElementError\",uh=e=>k(e,jl),fo=class extends Ms(\"NoSuchElementError\"){[jl]=jl;constructor(t){super({message:t})}},Ci=\"~effect/Cause/Done\",Wl=e=>k(e,Ci),IO={[Ci]:Ci,_tag:\"Done\",value:void 0},Mi=e=>e===void 0?IO:{[Ci]:Ci,_tag:\"Done\",value:e},Fq=en(IO),TO=e=>e===void 0?Fq:en(Mi(e));var fh=e=>kn({op:e.label,[dt]:e.evaluate});var De={};Ae(De,{Do:()=>yH,all:()=>oH,andThen:()=>Yq,as:()=>NO,asVoid:()=>Zq,bind:()=>gH,bindTo:()=>hH,composeK:()=>rH,contains:()=>dH,containsWith:()=>BO,exists:()=>mH,filter:()=>Li,filterMap:()=>cH,firstSomeOf:()=>Kq,flatMap:()=>Ni,flatMapNullishOr:()=>Xq,flatten:()=>Di,fromIterable:()=>jq,fromNullOr:()=>ZS,fromNullishOr:()=>Yl,fromUndefinedOr:()=>Ns,gen:()=>bH,getFailure:()=>Hq,getOrElse:()=>Ql,getOrNull:()=>bh,getOrThrow:()=>QS,getOrThrowWith:()=>Xl,getOrUndefined:()=>po,getSuccess:()=>qq,isNone:()=>fe,isOption:()=>vu,isSome:()=>Ue,let:()=>xH,lift2:()=>lH,liftNullishOr:()=>Vq,liftPredicate:()=>pH,liftThrowable:()=>mo,makeCombinerFailFast:()=>zO,makeEquivalence:()=>uH,makeOrder:()=>fH,makeReducer:()=>SH,makeReducerFailFast:()=>EH,map:()=>Jt,match:()=>it,none:()=>v,orElse:()=>Wq,orElseResult:()=>Gq,orElseSome:()=>Jq,partitionMap:()=>iH,product:()=>LO,productMany:()=>nH,reduceCompact:()=>sH,some:()=>O,tap:()=>DO,toArray:()=>aH,toRefinement:()=>zq,void:()=>Qq,zipLeft:()=>tH,zipRight:()=>eH,zipWith:()=>$O});function lh(e){return{combine:e}}function wO(e){return lh((t,r)=>e(t,r)===-1?t:r)}function kO(e){return lh((t,r)=>e(t,r)===1?t:r)}function Jl(e,t,r){return{combine:e,initialValue:t,combineAll:r??(n=>{let o=t;for(let s of n)o=e(o,s);return o})}}var Bt=e=>(t,r)=>t===r||e(t,r),Uq=(e,t)=>e===t,Ps=()=>Uq;function CO(e){return Bt((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e[n](t[n],r[n]))return!1;return!0})}function Su(e){return Bt((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],r[n]))return!1;return!0})}var Eu=e=>f(3,(t,r,n)=>e(t,o=>({...o,[r]:n(o)}))),Iu=e=>f(2,(t,r)=>e(t,n=>({[r]:n}))),Tu=(e,t)=>f(3,(r,n,o)=>t(r,s=>e(o(s),a=>({...s,[n]:a}))));var AO=\"~effect/Option\",vO={[AO]:{_A:e=>e},...$t,[Symbol.iterator](){return new Sa(this)}},Nq=Object.defineProperty(Object.assign(Object.create(vO),{_tag:\"Some\",_op:\"Some\",[ie](e){return ph(e)&&GS(e)&&J(this.value,e.value)},[ae](){return oe(H(this._tag))(H(this.value))},toString(){return`some(${L(this.value)})`},toJSON(){return{_id:\"Option\",_tag:this._tag,value:Lt(this.value)}}}),\"valueOrUndefined\",{get(){return this.value}}),Dq=H(\"None\"),Lq=Object.assign(Object.create(vO),{_tag:\"None\",_op:\"None\",valueOrUndefined:void 0,[ie](e){return ph(e)&&Ia(e)},[ae](){return Dq},toString(){return\"none()\"},toJSON(){return{_id:\"Option\",_tag:this._tag}}}),ph=e=>k(e,AO),Ia=e=>e._tag===\"None\",GS=e=>e._tag===\"Some\",Pi=Object.create(Lq),OO=function(e){this.value=e};OO.prototype=Nq;var Fs=e=>new OO(e);var _O=\"~effect/Result\",RO={[_O]:{_A:e=>e,_E:e=>e},...$t,[Symbol.iterator](){return new Sa(this)}},$q=Object.assign(Object.create(RO),{_tag:\"Success\",_op:\"Success\",[ie](e){return dh(e)&&ku(e)&&J(this.success,e.success)},[ae](){return oe(H(this._tag))(H(this.success))},toString(){return`success(${L(this.success)})`},toJSON(){return{_id:\"Result\",_tag:this._tag,value:Lt(this.success)}}}),Bq=Object.assign(Object.create(RO),{_tag:\"Failure\",_op:\"Failure\",[ie](e){return dh(e)&&wu(e)&&J(this.failure,e.failure)},[ae](){return oe(H(this._tag))(H(this.failure))},toString(){return`failure(${L(this.failure)})`},toJSON(){return{_id:\"Result\",_tag:this._tag,failure:Lt(this.failure)}}}),dh=e=>k(e,_O),wu=e=>e._tag===\"Failure\",ku=e=>e._tag===\"Success\",MO=function(e){this.failure=e};MO.prototype=Bq;var Gl=e=>new MO(e),PO=function(e){this.success=e};PO.prototype=$q;var Kl=e=>new PO(e),mh=e=>ku(e)?Pi:Fs(e.failure),hh=e=>wu(e)?Pi:Fs(e.success),FO=f(2,(e,t)=>Ia(e)?Gl(t()):Kl(e.value));function ns(e){return(t,r)=>t===r?0:e(t,r)}var xh=ns((e,t)=>e<t?-1:1),jr=ns((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);var Cu=ns((e,t)=>e<t?-1:1);var VS=f(2,(e,t)=>ns((r,n)=>e(t(r),t(n)))),Au=VS(jr,e=>e.getTime());var Ta=e=>f(2,(t,r)=>e(t,r)===-1),os=e=>f(2,(t,r)=>e(t,r)===1),Fi=e=>f(2,(t,r)=>e(t,r)!==1),Ui=e=>f(2,(t,r)=>e(t,r)!==-1),Vl=e=>f(2,(t,r)=>t===r||e(t,r)<1?t:r),Zl=e=>f(2,(t,r)=>t===r||e(t,r)>-1?t:r),gh=e=>f(2,(t,r)=>Vl(e)(r.maximum,Zl(e)(r.minimum,t))),yh=e=>f(2,(t,r)=>!Ta(e)(t,r.minimum)&&!os(e)(t,r.maximum));var v=()=>Pi,O=Fs,vu=ph,fe=Ia,Ue=GS,it=f(2,(e,{onNone:t,onSome:r})=>fe(e)?t():r(e.value)),zq=e=>t=>Ue(e(t)),jq=e=>{for(let t of e)return O(t);return v()},qq=hh,Hq=mh,Ql=f(2,(e,t)=>fe(e)?t():e.value),Wq=f(2,(e,t)=>fe(e)?t():e),Jq=f(2,(e,t)=>fe(e)?O(t()):e),Gq=f(2,(e,t)=>fe(e)?Jt(t(),Kl):Jt(e,Gl)),Kq=e=>{let t=v();for(t of e)if(Ue(t))return t;return t},Yl=e=>e==null?v():O(e),Ns=e=>e===void 0?v():O(e),ZS=e=>e===null?v():O(e),Vq=e=>(...t)=>Yl(e(...t)),bh=Ql(Xm),po=Ql(zr),mo=e=>(...t)=>{try{return O(e(...t))}catch{return v()}},Xl=f(2,(e,t)=>{if(Ue(e))return e.value;throw t()}),QS=Xl(()=>new Error(\"getOrThrow called on a None\")),Jt=f(2,(e,t)=>fe(e)?v():O(t(e.value))),NO=f(2,(e,t)=>Jt(e,()=>t)),Zq=NO(void 0),Qq=O(void 0);var Ni=f(2,(e,t)=>fe(e)?v():t(e.value)),Yq=f(2,(e,t)=>Ni(e,r=>{let n=Ht(t)?t(r):t;return vu(n)?n:O(n)})),Xq=f(2,(e,t)=>fe(e)?v():Yl(t(e.value))),Di=Ni(_),eH=f(2,(e,t)=>Ni(e,()=>t)),tH=f(2,(e,t)=>DO(e,()=>t)),rH=f(2,(e,t)=>r=>Ni(e(r),t)),DO=f(2,(e,t)=>Ni(e,r=>Jt(t(r),()=>r))),LO=f(2,(e,t)=>Ue(e)&&Ue(t)?O([e.value,t.value]):v()),nH=f(2,(e,t)=>{if(fe(e))return v();let r=[e.value];for(let n of t){if(fe(n))return v();r.push(n.value)}return O(r)}),oH=e=>{if(Symbol.iterator in e){let r=[];for(let n of e){if(fe(n))return v();r.push(n.value)}return O(r)}let t={};for(let r of Object.keys(e)){let n=e[r];if(fe(n))return v();w(t,r,n.value)}return O(t)},$O=f(3,(e,t,r)=>Jt(LO(e,t),([n,o])=>r(n,o))),sH=f(3,(e,t,r)=>{let n=t;for(let o of e)Ue(o)&&(n=r(n,o.value));return n}),aH=e=>fe(e)?[]:[e.value],iH=f(2,(e,t)=>{if(fe(e))return[v(),v()];let r=t(e.value);return wu(r)?[v(),O(r.failure)]:[O(r.success),v()]}),cH=f(2,(e,t)=>{if(fe(e))return v();let r=t(e.value);return ku(r)?O(r.success):v()}),Li=f(2,(e,t)=>fe(e)?v():t(e.value)?O(e.value):v()),uH=e=>Bt((t,r)=>fe(t)?fe(r):fe(r)?!1:e(t.value,r.value)),fH=e=>ns((t,r)=>Ue(t)?Ue(r)?e(t.value,r.value):1:-1),lH=e=>f(2,(t,r)=>$O(t,r,e)),pH=f(2,(e,t)=>t(e)?O(e):v()),BO=e=>f(2,(t,r)=>fe(t)?!1:e(t.value,r)),dH=BO(NS()),mH=f(2,(e,t)=>fe(e)?!1:t(e.value)),hH=Iu(Jt),xH=Eu(Jt);var gH=Tu(Jt,Ni),yH=O({}),bH=(...e)=>{let r=(e.length===1?e[0]:e[1].bind(e[0]))(),n=r.next();for(;!n.done;){let o=n.value;if(fe(o))return o;n=r.next(o.value)}return O(n.value)};function SH(e){return Jl((t,r)=>fe(t)?r:fe(r)?t:O(e.combine(t.value,r.value)),v())}function zO(e){return lh((t,r)=>fe(t)||fe(r)?v():O(e.combine(t.value,r.value)))}function EH(e){let t=zO(e).combine,r=O(e.initialValue);return Jl(t,r,n=>{let o=r;for(let s of n)if(o=t(o,s),fe(o))return o;return o})}var Sh=\"~effect/Context/Service\",vr=function(){function e(){}let t=e;Object.setPrototypeOf(t,IH);let r=(n,o)=>(t.key=n,o?.defaultValue&&(t[XS]=XS,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&jO.add(n),t);return arguments.length>0?r(arguments[0],arguments[1]):r},IH={[Sh]:Sh,...fh({label:\"Service\",evaluate(e){return ve(Te(e.context,this))}}),toJSON(){return{_id:\"Service\",key:this.key}},of(e){return e},context(e){return ss(this,e)},use(e){return re(t=>e(Te(t.context,this)))},useSync(e){return re(t=>ve(e(Te(t.context,this))))}},jO=new Set,XS=\"~effect/Context/Reference\",qO=\"~effect/Context\",TH=8,wH=8,eE=(e,t,r,n)=>{let o=Object.create(kH);return o.cacheRoot=e??o,o.base=t,o.overlay=r,o.depth=n,o._flat=void 0,o.baseHits=0,o},HO=(e,t)=>{t&&(HO(e,t.parent),e.set(t.key,t.value))},WO=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return HO(t,e.overlay),e._flat=t},tE=(e,t)=>{let r=new Map(e.mapUnsafe);return t(r),ho(r)},ep=Symbol(),Eh=(e,t)=>{let r=e;for(let o=r.overlay;o;o=o.parent)if(o.key===t)return o.value;let n=r.base.get(t);return n===void 0&&!r.base.has(t)?ep:(r.overlay&&++r.baseHits>=r.base.size&&r.baseHits>=wH&&(r.base=WO(r),r.overlay=void 0,r.depth=0),n)},ho=e=>eE(void 0,e,void 0,0),kH={get mapUnsafe(){return WO(this)},...$t,[qO]:{_Services:e=>e},toJSON(){return{_id:\"Context\",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[ie](e){if(!Ou(e))return!1;let t=this.mapUnsafe,r=e.mapUnsafe;if(t.size!==r.size)return!1;for(let[n,o]of t)if(!r.has(n)||!J(o,r.get(n)))return!1;return!0},[ae](){return Dt(this.mapUnsafe.size)}},rE=(e,t)=>e.cacheRoot===t.cacheRoot,Ou=e=>k(e,qO),CH=e=>k(e,Sh),Ih=e=>!!e[XS],tr=()=>AH,AH=ho(new Map),ss=(e,t)=>ho(new Map([[e.key,t]])),zt=f(3,(e,t,r)=>JO(e,t.key,r)),JO=(e,t,r)=>{let n=e,o=jO.has(t)?void 0:n.cacheRoot;if(n.depth>=TH){let s=new Map(n.mapUnsafe);return s.set(t,r),eE(o,s,void 0,0)}return eE(o,n.base,{key:t,value:r,parent:n.overlay},n.depth+1)},vH=f(3,(e,t,r)=>r._tag===\"None\"?GO(t)(e):zt(e,t,r.value)),OH=f(3,(e,t,r)=>{let n=Eh(e,t.key);return n!==ep?n:Ih(t)?nE(t):r()}),tp=f(2,(e,t)=>_u(e,t.key)),_u=(e,t)=>{let r=Eh(e,t);return r===ep?void 0:r},jn=f(2,(e,t)=>{let r=Eh(e,t.key);if(r===ep){if(Ih(t))return nE(t);throw _H(t)}return r}),Te=jn,YS=\"~effect/Context/defaultValue\",nE=e=>YS in e?e[YS]:e[YS]=e.defaultValue(),_H=e=>{let t=new Error(`Service not found${e.key?`: ${String(e.key)}`:\"\"}`);if(t.stack){let r=t.stack.split(`\n`);r.splice(1,3),t.stack=r.join(`\n`)}return t},rp=f(2,(e,t)=>{let r=Eh(e,t.key);return r!==ep?O(r):Ih(t)?O(nE(t)):v()}),Ru=f(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:tE(e,r=>t.mapUnsafe.forEach((n,o)=>r.set(o,n)))),oE=(...e)=>{let t=new Map;for(let r=0;r<e.length;r++)e[r].mapUnsafe.forEach((n,o)=>{t.set(o,n)});return ho(t)},RH=(...e)=>t=>{let r=new Set(e.map(n=>n.key));return tE(t,n=>n.forEach((o,s)=>{r.has(s)||n.delete(s)}))},GO=(...e)=>t=>tE(t,r=>{for(let n=0;n<e.length;n++)r.delete(e[n].key)}),Ee=vr;var Th={};Ae(Th,{MaxOpsBeforeYield:()=>iE,MixedScheduler:()=>wa,PreventSchedulerYield:()=>cE,Scheduler:()=>Mu});var Mu=Ee(\"effect/Scheduler\",{fiberCached:!0,defaultValue:()=>new wa}),KO=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},MH=\"setImmediate\"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},VO=e=>{try{return MH(e)}catch{return KO(e)}},sE=class{buckets=[];scheduleTask(t,r){let n=this.buckets,o=n.length,s,a=0;for(;a<o&&!(n[a][0]>r);a++)s=n[a];s&&s[0]===r?s[1].push(t):a===o?n.push([r,[t]]):n.splice(a,0,[r,[t]])}drain(){let t=this.buckets;return this.buckets=[],t}},wa=class{executionMode;setImmediate;constructor(t=\"async\",r){this.executionMode=t,this.setImmediate=r??(t===\"sync\"?KO:VO)}shouldYield(t){return t.currentOpCount>=t.cache.maxOpsBeforeYield}makeDispatcher(){return new aE(this.setImmediate)}},aE=class{tasks=new sE;running=void 0;setImmediate;constructor(t=VO){this.setImmediate=t}scheduleTask(t,r){this.tasks.scheduleTask(t,r),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let t=this.tasks.drain();for(let r=0;r<t.length;r++){let n=t[r][1];for(let o=0;o<n.length;o++)n[o]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},iE=Ee(\"effect/Scheduler/MaxOpsBeforeYield\",{fiberCached:!0,defaultValue:()=>2048}),cE=Ee(\"effect/Scheduler/PreventSchedulerYield\",{fiberCached:!0,defaultValue:()=>!1});var $P={};Ae($P,{Clock:()=>ec,clockWith:()=>zJ,currentTimeMillis:()=>jJ,currentTimeNanos:()=>qJ,monotonicTimeNanos:()=>HJ});var uE=e=>e.length>0;var ct=e=>e>0?Math.floor(e):0,qn=e=>Math.max(1,ct(e));var nt={};Ae(nt,{Do:()=>VH,all:()=>Pu,andThen:()=>JH,bind:()=>ZH,bindTo:()=>QH,fail:()=>D,failVoid:()=>UH,filterOrFail:()=>jH,flatMap:()=>St,flip:()=>GH,fromNullishOr:()=>NH,fromOption:()=>fE,gen:()=>KH,getFailure:()=>LH,getOrElse:()=>Aa,getOrNull:()=>qH,getOrThrow:()=>Ds,getOrThrowWith:()=>QO,getOrUndefined:()=>HH,getSuccess:()=>DH,isFailure:()=>Q,isResult:()=>Ca,isSuccess:()=>je,let:()=>YH,liftPredicate:()=>zH,makeEquivalence:()=>$H,map:()=>mt,mapBoth:()=>BH,mapError:()=>np,match:()=>rr,merge:()=>lE,orElse:()=>WH,succeed:()=>P,succeedNone:()=>pE,succeedSome:()=>tW,tap:()=>rW,transposeMapOption:()=>eW,transposeOption:()=>XH,try:()=>ZO,void:()=>FH});var P=Kl,D=Gl,FH=P(void 0);var UH=D(void 0),NH=f(2,(e,t)=>e==null?D(t(e)):P(e)),fE=FO,ZO=e=>{if(Ht(e))try{return P(e())}catch(t){return D(t)}else try{return P(e.try())}catch(t){return D(e.catch(t))}};var Ca=dh,Q=wu,je=ku,DH=hh,LH=mh,$H=(e,t)=>Bt((r,n)=>Q(r)?Q(n)&&t(r.failure,n.failure):je(n)&&e(r.success,n.success)),BH=f(2,(e,{onFailure:t,onSuccess:r})=>Q(e)?D(t(e.failure)):P(r(e.success))),np=f(2,(e,t)=>Q(e)?D(t(e.failure)):e),mt=f(2,(e,t)=>je(e)?P(t(e.success)):e),rr=f(2,(e,{onFailure:t,onSuccess:r})=>Q(e)?t(e.failure):r(e.success)),zH=f(3,(e,t,r)=>t(e)?P(e):D(r(e))),jH=f(3,(e,t,r)=>St(e,n=>t(n)?P(n):D(r(n)))),lE=rr({onFailure:_,onSuccess:_}),Aa=f(2,(e,t)=>Q(e)?t(e.failure):e.success),qH=Aa(Xm),HH=Aa(zr),QO=f(2,(e,t)=>{if(je(e))return e.success;throw t(e.failure)}),Ds=QO(_),WH=f(2,(e,t)=>Q(e)?t(e.failure):P(e.success)),St=f(2,(e,t)=>Q(e)?D(e.failure):t(e.success)),JH=f(2,(e,t)=>St(e,r=>{let n=Ht(t)?t(r):t;return Ca(n)?n:P(n)})),Pu=e=>{if(Symbol.iterator in e){let r=[];for(let n of e){if(Q(n))return n;r.push(n.success)}return P(r)}let t={};for(let r of Object.keys(e)){let n=e[r];if(Q(n))return n;w(t,r,n.success)}return P(t)},GH=e=>Q(e)?P(e.failure):D(e.success),KH=(...e)=>{let r=(e.length===1?e[0]:e[1].bind(e[0]))(),n=r.next();for(;!n.done;){let o=n.value;if(Q(o))return o;n=r.next(o.success)}return P(n.value)},VH=P({}),ZH=Tu(mt,St),QH=Iu(mt),YH=Eu(mt);var XH=e=>Ia(e)?pE:mt(e.value,Fs),eW=f(2,(e,t)=>Ia(e)?pE:mt(t(e.value),Fs)),pE=P(Pi),tW=e=>P(Fs(e)),rW=f(2,(e,t)=>(je(e)&&t(e.success),e));var YO=CO;var nW=(e,t)=>{let r=t?.length!==void 0?qn(t.length):1/0;return{[Symbol.iterator](){let n=0;return{next(){return n<r?{value:e(n++),done:!1}:{done:!0,value:void 0}}}}}};var oW=f(2,(e,t)=>iW(nW(()=>e,{length:t}))),e_=e=>oW(e,1/0);var wh=e=>{let r=e[Symbol.iterator]().next();if(r.done)throw new Error(\"headUnsafe: empty iterable\");return r.value};var t_=f(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(Si(o)){if(o)return O(n)}else if(Ue(o))return o;r++}return v()});var sW={[Symbol.iterator](){return aW}},aW={next(){return{done:!0,value:void 0}}},r_=()=>sW;var iW=e=>({[Symbol.iterator](){let t=e[Symbol.iterator](),r;function n(){for(;;){if(r===void 0){let s=t.next();if(s.done)return s;r=s.value[Symbol.iterator]()}let o=r.next();if(!o.done)return o;r=void 0}}return{next:n}}});var n_=f(2,(e,t)=>({[Symbol.iterator](){let r=e[Symbol.iterator](),n=0;return{next(){let o=r.next();for(;!o.done;){if(t(o.value,n++))return{done:!1,value:o.value};o=r.next()}return{done:!0,value:void 0}}}}}));var o_=e=>Object.keys(e).length===0;var s_=f(2,(e,t)=>Object.hasOwn(e,t));var a_=f(2,(e,t)=>{if(!s_(e,t))return{...e};let r={...e};return delete r[t],r});var Uu=f(2,(e,t)=>{let r={...e};for(let n of i_(e))w(r,n,t(e[n],n));return r});var i_=e=>Object.keys(e);var dE=f(3,(e,t,r)=>({...e,[t]:r}));var cW=e=>f(2,(t,r)=>{for(let n of i_(t))if(!s_(r,n)||!e(t[n],r[n]))return!1;return!0});var c_=e=>{let t=cW(e);return(r,n)=>t(r,n)&&t(n,r)};var va=globalThis.Array;var mE=e=>new va(ct(e)),sp=f(2,(e,t)=>{let r=qn(e),n=new va(r);for(let o=0;o<r;o++)n[o]=t(o);return n}),hE=(e,t)=>e<=t?sp(t-e+1,r=>e+r):[e];var Se=e=>va.isArray(e)?e:va.from(e),xE=e=>va.isArray(e)?e:[e];var Oa=f(2,(e,t)=>[...e,t]),kh=f(2,(e,t)=>Se(e).concat(Se(t)));var u_=va.isArray;var gr=uE,ut=uE;function Nu(e){let t=Number(e);return String(t)===e&&Number.isInteger(t)&&t>=0&&t<2**32-1}function uW(e,t){return!Number.isFinite(e)||e<0||e>=t.length}var f_=f(2,(e,t)=>{let r=Math.floor(t);if(uW(r,e))throw new Error(`Index out of bounds: ${r}`);return e[r]});var Ch=e=>e[e.length-1];var gE=t_;var $i=f(2,(e,t)=>{let r=va.from(e);return r.sort(t),r}),yE=f(3,(e,t,r)=>va.from(e).map(n=>[n,t(n)]).sort(([,n],[,o])=>r(n,o)).map(([n])=>n));var l_=f(2,(e,t)=>{let r={};for(let n of e){let o=t(n);Object.hasOwn(r,o)?r[o].push(n):w(r,o,[n])}return r}),fW=(e,t)=>{let r=H(t),n=e.get(r);if(n===void 0)return e.set(r,[t]),!0;for(let o of n)if(J(o,t))return!1;return n.push(t),!0};var At=()=>[],we=e=>[e],tn=f(2,(e,t)=>e.map(t));var Bi=f(2,(e,t)=>{let r=Se(e),n=[];for(let o=0;o<r.length;o++)t(r[o],o)&&n.push(r[o]);return n}),bE=f(2,(e,t)=>{let r=[],n=[],o=0;for(let s of e){let a=t(s,o++);je(a)?r.push(a.success):n.push(a.failure)}return[r,n]});var p_=Su;var Ah=e=>{let t=Se(e);if(t.length<2)return[...t];let r=new Map,n=[];for(let o of t)fW(r,o)&&n.push(o);return n};var An={};Ae(An,{CombinerMax:()=>FW,CombinerMin:()=>UW,Equivalence:()=>C_,Order:()=>xo,ReducerSum:()=>PW,abs:()=>E_,between:()=>kW,clamp:()=>CW,days:()=>w_,divide:()=>AW,divideUnsafe:()=>vW,equals:()=>A_,format:()=>Nh,fromInput:()=>ip,fromInputUnsafe:()=>ye,hours:()=>T_,infinity:()=>nr,isDuration:()=>Ph,isFinite:()=>Ls,isGreaterThan:()=>RW,isGreaterThanOrEqualTo:()=>MW,isLessThan:()=>_W,isLessThanOrEqualTo:()=>kE,isNegative:()=>S_,isPositive:()=>gW,isZero:()=>zi,match:()=>as,matchPair:()=>up,max:()=>TE,micros:()=>bW,millis:()=>Kt,min:()=>IE,minutes:()=>I_,nanos:()=>Cn,negate:()=>yW,negativeInfinity:()=>Or,parts:()=>v_,seconds:()=>Fh,subtract:()=>wE,sum:()=>Uh,times:()=>OW,toDays:()=>IW,toHours:()=>EW,toHrTime:()=>wW,toMillis:()=>et,toMinutes:()=>SW,toNanos:()=>cp,toNanosUnsafe:()=>ap,toSeconds:()=>EE,toWeeks:()=>TW,weeks:()=>k_,zero:()=>Ge});var Oh=\"~effect/Duration\",Hn=BigInt(0),_h=BigInt(1),lW=BigInt(2),pW=BigInt(10),d_=BigInt(24),vh=BigInt(60),Rh=BigInt(1e3),m_=BigInt(1e6),h_=BigInt(1e9),Mh=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),SE=e=>Mh(e*1e6),x_=(e,t)=>{let r=e.indexOf(\".\");if(r===-1)return BigInt(e)*t;let n=e[0]===\"-\",o=e.slice(r+1),s=pW**BigInt(o.length),a=(BigInt(e.slice(n?1:0,r))*s+BigInt(o))*t,i=a/s+(a%s*lW>=s?_h:Hn);return n?-i:i},g_=e=>{let t=e<Hn?-_h:_h,r=e<Hn?-e:e;return[Number(t*(r/h_)),Number(t*(r%h_))]},dW=/^(-?\\d+(?:\\.\\d+)?)\\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,ye=e=>{switch(typeof e){case\"number\":return Kt(e);case\"bigint\":return Cn(e);case\"string\":{if(e===\"Infinity\")return nr;if(e===\"-Infinity\")return Or;let t=dW.exec(e);if(!t)break;let[r,n,o]=t;if(o===\"nano\"||o===\"nanos\")return Cn(x_(n,_h));if(o===\"micro\"||o===\"micros\")return Cn(x_(n,Rh));let s=Number(n);switch(o){case\"milli\":case\"millis\":return Kt(s);case\"second\":case\"seconds\":return Fh(s);case\"minute\":case\"minutes\":return I_(s);case\"hour\":case\"hours\":return T_(s);case\"day\":case\"days\":return w_(s);case\"week\":case\"weeks\":return k_(s)}break}case\"object\":{if(e===null)break;if(Oh in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(ba)?y_(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Ge:e[0]===-1/0||e[1]===-1/0?Or:e[0]===1/0||e[1]===1/0?nr:Qe(Mh(e[0]*1e9+e[1]));let t=e,r=0;return t.weeks&&(r+=t.weeks*6048e5),t.days&&(r+=t.days*864e5),t.hours&&(r+=t.hours*36e5),t.minutes&&(r+=t.minutes*6e4),t.seconds&&(r+=t.seconds*1e3),t.milliseconds&&(r+=t.milliseconds),!t.microseconds&&!t.nanoseconds?Qe(r):Qe(Mh(r*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return y_(e)},y_=e=>{throw new Error(`Invalid Input: ${e}`)},ip=mo(ye),b_={_tag:\"Millis\",millis:0},mW={_tag:\"Infinity\"},hW={_tag:\"NegativeInfinity\"},xW={[Oh]:Oh,[ae](){switch(this.value._tag){case\"Millis\":{let e=this.value.millis*1e6;return Number.isFinite(e)?H(Mh(e)):Dt(this.value.millis)}case\"Nanos\":return H(this.value.nanos);default:return Ll(this.value)}},[ie](e){return Ph(e)&&A_(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\"}}},[Ie](){return this.toJSON()},pipe(){return K(this,arguments)}},Qe=e=>{let t=Object.create(xW);return typeof e==\"number\"?isNaN(e)||e===0||Object.is(e,-0)?t.value=b_:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:\"Millis\",millis:e}:t.value={_tag:\"Nanos\",nanos:SE(e)}:t.value=e>0?mW:hW:e===Hn?t.value=b_:t.value={_tag:\"Nanos\",nanos:e},t},Ph=e=>k(e,Oh),Ls=e=>e.value._tag!==\"Infinity\"&&e.value._tag!==\"NegativeInfinity\",zi=e=>{switch(e.value._tag){case\"Millis\":return e.value.millis===0;case\"Nanos\":return e.value.nanos===Hn;case\"Infinity\":case\"NegativeInfinity\":return!1}},S_=e=>{switch(e.value._tag){case\"Millis\":return e.value.millis<0;case\"Nanos\":return e.value.nanos<Hn;case\"NegativeInfinity\":return!0;case\"Infinity\":return!1}},gW=e=>{switch(e.value._tag){case\"Millis\":return e.value.millis>0;case\"Nanos\":return e.value.nanos>Hn;case\"Infinity\":return!0;case\"NegativeInfinity\":return!1}},E_=e=>{switch(e.value._tag){case\"Infinity\":case\"NegativeInfinity\":return nr;case\"Millis\":return e.value.millis<0?Qe(-e.value.millis):e;case\"Nanos\":return e.value.nanos<Hn?Qe(-e.value.nanos):e}},yW=e=>{switch(e.value._tag){case\"Infinity\":return Or;case\"NegativeInfinity\":return nr;case\"Millis\":return e.value.millis===0?e:Qe(-e.value.millis);case\"Nanos\":return e.value.nanos===Hn?e:Qe(-e.value.nanos)}},Ge=Qe(0),nr=Qe(1/0),Or=Qe(-1/0),Cn=e=>Qe(e),bW=e=>Qe(e*Rh),Kt=e=>Qe(e),Fh=e=>Qe(e*1e3),I_=e=>Qe(e*6e4),T_=e=>Qe(e*36e5),w_=e=>Qe(e*864e5),k_=e=>Qe(e*6048e5),et=e=>as(ye(e),{onMillis:_,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),EE=e=>as(ye(e),{onMillis:t=>t/1e3,onNanos:t=>Number(t)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),SW=e=>as(ye(e),{onMillis:t=>t/6e4,onNanos:t=>Number(t)/6e10,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),EW=e=>as(ye(e),{onMillis:t=>t/36e5,onNanos:t=>Number(t)/36e11,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),IW=e=>as(ye(e),{onMillis:t=>t/864e5,onNanos:t=>Number(t)/864e11,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),TW=e=>as(ye(e),{onMillis:t=>t/6048e5,onNanos:t=>Number(t)/6048e11,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),ap=e=>{let t=ye(e);switch(t.value._tag){case\"Infinity\":case\"NegativeInfinity\":throw new Error(\"Cannot convert infinite duration to nanos\");case\"Nanos\":return t.value.nanos;case\"Millis\":return SE(t.value.millis)}},cp=mo(ap),wW=e=>{let t=ye(e);switch(t.value._tag){case\"Infinity\":return[1/0,0];case\"NegativeInfinity\":return[-1/0,0];case\"Nanos\":return g_(t.value.nanos);case\"Millis\":return g_(SE(t.value.millis))}},as=f(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)()}}),up=f(3,(e,t,r)=>e.value._tag===\"Infinity\"||e.value._tag===\"NegativeInfinity\"||t.value._tag===\"Infinity\"||t.value._tag===\"NegativeInfinity\"?r.onInfinity(e,t):e.value._tag===\"Millis\"?t.value._tag===\"Millis\"?r.onMillis(e.value.millis,t.value.millis):r.onNanos(ap(e),t.value.nanos):r.onNanos(e.value.nanos,ap(t))),xo=ns((e,t)=>up(e,t,{onMillis:(r,n)=>r<n?-1:r>n?1:0,onNanos:(r,n)=>r<n?-1:r>n?1:0,onInfinity:(r,n)=>r.value._tag===n.value._tag?0:r.value._tag===\"Infinity\"?1:r.value._tag===\"NegativeInfinity\"||n.value._tag===\"Infinity\"?-1:1})),kW=yh(xo),C_=(e,t)=>up(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n,onInfinity:(r,n)=>r.value._tag===n.value._tag}),IE=Vl(xo),TE=Zl(xo),CW=gh(xo),AW=f(2,(e,t)=>Number.isFinite(t)?t===0||Object.is(t,-0)?v():as(e,{onMillis:r=>O(Qe(r/t)),onNanos:r=>{try{return O(Qe(r/BigInt(t)))}catch{return v()}},onInfinity:()=>O(t>0?nr:Or),onNegativeInfinity:()=>O(t>0?Or:nr)}):v()),vW=f(2,(e,t)=>Number.isFinite(t)?as(e,{onMillis:r=>Qe(r/t),onNanos:r=>{if(Object.is(t,0)||Object.is(t,-0)){if(r===Hn)return Ge;let n=r>Hn,o=Object.is(t,0);return n===o?nr:Or}try{return Qe(r/BigInt(t))}catch{return Ge}},onInfinity:()=>t>0?nr:t<0?Or:Ge,onNegativeInfinity:()=>t>0?Or:t<0?nr:Ge}):Ge),OW=f(2,(e,t)=>as(e,{onMillis:r=>Qe(r*t),onNanos:r=>Qe(r*BigInt(t)),onInfinity:()=>t>0?nr:t<0?Or:Ge,onNegativeInfinity:()=>t>0?Or:t<0?nr:Ge})),wE=f(2,(e,t)=>up(e,t,{onMillis:(r,n)=>Qe(r-n),onNanos:(r,n)=>Qe(r-n),onInfinity:(r,n)=>{let o=r.value._tag,s=n.value._tag;return o===\"Infinity\"?s===\"Infinity\"?Ge:nr:o===\"NegativeInfinity\"?s===\"NegativeInfinity\"?Ge:Or:s===\"Infinity\"?Or:nr}})),Uh=f(2,(e,t)=>up(e,t,{onMillis:(r,n)=>Qe(r+n),onNanos:(r,n)=>Qe(r+n),onInfinity:(r,n)=>{let o=r.value._tag,s=n.value._tag;return o===\"Infinity\"&&s===\"NegativeInfinity\"||o===\"NegativeInfinity\"&&s===\"Infinity\"?Ge:o===\"Infinity\"||s===\"Infinity\"?nr:o===\"NegativeInfinity\"||s===\"NegativeInfinity\"?Or:Ge}})),_W=Ta(xo),kE=Fi(xo),RW=os(xo),MW=Ui(xo),A_=f(2,(e,t)=>C_(e,t)),v_=e=>{if(e.value._tag===\"Infinity\")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};if(e.value._tag===\"NegativeInfinity\")return{days:-1/0,hours:-1/0,minutes:-1/0,seconds:-1/0,millis:-1/0,nanos:-1/0};let t=ap(e),r=t<Hn,n=r?-t:t,o=n/m_,s=o/Rh,a=s/vh,i=a/vh,c=i/d_,u=r?-1:1;return{days:u*Number(c),hours:u*Number(i%d_),minutes:u*Number(a%vh),seconds:u*Number(s%vh),millis:u*Number(o%Rh),nanos:u*Number(n%m_)}},Nh=e=>{if(e.value._tag===\"Infinity\")return\"Infinity\";if(e.value._tag===\"NegativeInfinity\")return\"-Infinity\";if(zi(e))return\"0\";if(S_(e))return\"-\"+Nh(E_(e));let t=v_(e),r=[];return t.days!==0&&r.push(`${t.days}d`),t.hours!==0&&r.push(`${t.hours}h`),t.minutes!==0&&r.push(`${t.minutes}m`),t.seconds!==0&&r.push(`${t.seconds}s`),t.millis!==0&&r.push(`${t.millis}ms`),t.nanos!==0&&r.push(`${t.nanos}ns`),r.join(\" \")},PW=Jl(Uh,Ge),FW=kO(xo),UW=wO(xo);var O_=e=>t=>!Q(e(t));var __=e=>t=>t.has(e)?P(t):D(t);var R_=f(2,(e,t)=>r=>{let n=e(r);return Q(n)?n:t(n.success)}),CE=f(2,(e,t)=>r=>{let n=e(r);if(Q(n))return D(r);let o=t(n.success);return Q(o)?D(r):o}),M_=e=>t=>{let r=e(t);return Q(r)?v():O(r.success)};var Jh={};Ae(Jh,{CurrentTraceLevel:()=>RE,DisablePropagation:()=>fp,MinimumTraceLevel:()=>ME,NativeSpan:()=>zh,ParentSpan:()=>go,ParentSpanKey:()=>jh,Tracer:()=>Hh,TracerKey:()=>qh,externalSpan:()=>WW,make:()=>N_,nativeTracer:()=>Wh});var _E={};Ae(_E,{decode:()=>Bh,decodeString:()=>OE,encode:()=>vE,random:()=>$h});var _a={};Ae(_a,{Class:()=>Dh,Error:()=>Lh,TaggedClass:()=>NW,TaggedError:()=>rn,taggedEnum:()=>DW});var Dh=class extends ya{constructor(e){super(),e&&ah(this,e)}},NW=e=>class extends Dh{_tag=e},DW=()=>new Proxy({},{get(e,t,r){return t===\"$is\"?Nt:t===\"$match\"?LW:n=>({...n,_tag:t})}});function LW(){if(arguments.length===1){let r=arguments[0];return function(n){return r[n._tag](n)}}let e=arguments[0];return arguments[1][e._tag](e)}var Lh=Hl,rn=Ms;var P_=\"~effect/encoding/EncodingError\",Wn=class extends rn(\"EncodingError\"){[P_]=P_};var vE=e=>F_(typeof e==\"string\"?jW.encode(e):e),$h=e=>{switch(e){case 16:return BW();case 32:return zW();default:{let t=\"\";for(let r=e>>>3;r>0;r--)t+=$W();return t}}},ne=Uint8Array.from(\"0123456789abcdef\",e=>e.charCodeAt(0)),ji=()=>Math.random()*4294967296>>>0,$W=()=>{let e=ji();return String.fromCharCode(ne[e>>>28],ne[e>>>24&15],ne[e>>>20&15],ne[e>>>16&15],ne[e>>>12&15],ne[e>>>8&15],ne[e>>>4&15],ne[e&15])},BW=()=>{let e=ji(),t=ji();return String.fromCharCode(ne[e>>>28],ne[e>>>24&15],ne[e>>>20&15],ne[e>>>16&15],ne[e>>>12&15],ne[e>>>8&15],ne[e>>>4&15],ne[e&15],ne[t>>>28],ne[t>>>24&15],ne[t>>>20&15],ne[t>>>16&15],ne[t>>>12&15],ne[t>>>8&15],ne[t>>>4&15],ne[t&15])},zW=()=>{let e=ji(),t=ji(),r=ji(),n=ji();return String.fromCharCode(ne[e>>>28],ne[e>>>24&15],ne[e>>>20&15],ne[e>>>16&15],ne[e>>>12&15],ne[e>>>8&15],ne[e>>>4&15],ne[e&15],ne[t>>>28],ne[t>>>24&15],ne[t>>>20&15],ne[t>>>16&15],ne[t>>>12&15],ne[t>>>8&15],ne[t>>>4&15],ne[t&15],ne[r>>>28],ne[r>>>24&15],ne[r>>>20&15],ne[r>>>16&15],ne[r>>>12&15],ne[r>>>8&15],ne[r>>>4&15],ne[r&15],ne[n>>>28],ne[n>>>24&15],ne[n>>>20&15],ne[n>>>16&15],ne[n>>>12&15],ne[n>>>8&15],ne[n>>>4&15],ne[n&15])},Bh=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return D(new Wn({module:\"Hex\",kind:\"Decode\",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let r=t.length/2,n=new Uint8Array(r);for(let o=0;o<r;o++){let s=U_(t[o*2]),a=U_(t[o*2+1]);n[o]=s<<4|a}return P(n)}catch(r){return D(new Wn({module:\"Hex\",kind:\"Decode\",input:e,message:r instanceof Error?r.message:\"Invalid input\"}))}},OE=e=>mt(Bh(e),t=>qW.decode(t)),jW=new TextEncoder,qW=new TextDecoder,HW=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,\"0\")),F_=e=>{let t=\"\";for(let r=0;r<e.length;r++)t+=HW[e[r]];return t},U_=e=>{if(48<=e&&e<=57)return e-48;if(97<=e&&e<=102)return e-97+10;if(65<=e&&e<=70)return e-65+10;throw new TypeError(\"Invalid input\")};var jh=\"effect/Tracer/ParentSpan\",go=class extends vr()(jh,{fiberCached:!0}){},N_=e=>e,WW=e=>({_tag:\"ExternalSpan\",spanId:e.spanId,traceId:e.traceId,sampled:e.sampled??!0,annotations:e.annotations??tr()}),fp=Ee(\"effect/Tracer/DisablePropagation\",{defaultValue:_l}),RE=Ee(\"effect/Tracer/CurrentTraceLevel\",{defaultValue:()=>\"Info\"}),ME=Ee(\"effect/Tracer/MinimumTraceLevel\",{defaultValue:()=>\"All\"}),qh=\"effect/Tracer\",Hh=Ee(qh,{fiberCached:!0,defaultValue:()=>Wh}),Wh=N_({span:e=>new zh(e)}),zh=class{_tag=\"Span\";sampled;name;parent;annotations;links;startTime;kind;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(t){this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.startTime=t.startTime,this.kind=t.kind,this.sampled=t.sampled,this.status={_tag:\"Started\",startTime:t.startTime}}get traceId(){return this._traceId??=po(this.parent)?.traceId??$h(32)}get spanId(){return this._spanId??=$h(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(t,r){this.status={_tag:\"Ended\",endTime:t,exit:r,startTime:this.status.startTime}}attribute(t,r){this.attributes.set(t,r)}event(t,r,n){this.events.push([t,r,n??{}])}addLinks(t){this.links.push(...t)}};var lp=\"effect/Metric/FiberRuntimeMetrics\";var L_=Ee(\"effect/ErrorReporter/CurrentErrorReporters\",{defaultValue:()=>new Set}),Du=Ee(\"effect/References/CurrentStackFrame\",{fiberCached:!0,defaultValue:zr}),Gh=Ee(\"effect/References/TracerEnabled\",{fiberCached:!0,defaultValue:hr}),qi=Ee(\"effect/References/TracerTimingEnabled\",{defaultValue:hr}),pp=Ee(\"effect/References/TracerSpanAnnotations\",{defaultValue:()=>({})}),dp=Ee(\"effect/References/TracerSpanLinks\",{defaultValue:()=>[]}),yo=Ee(\"effect/References/CurrentLogAnnotations\",{defaultValue:()=>({})}),PE=Ee(\"effect/References/CurrentLogLevel\",{fiberCached:!0,defaultValue:()=>\"Info\"}),FE=Ee(\"effect/References/MinimumLogLevel\",{fiberCached:!0,defaultValue:()=>\"Info\"});var Lu=Ee(\"effect/References/CurrentLogSpans\",{defaultValue:()=>[]});var Jn=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=\"boolean\")return e;let t=Bn();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};Cr(3);let r=new Error;return Cr(t),{...e,captureStackTrace:GW(()=>r.stack)}},UE=e=>t=>{let r;return()=>{if(r!==void 0)return r;let n=t();if(!n)return;let o=n.split(`\n`);if(o[e]!==void 0)return r=o[e].trim(),r}},GW=UE(3);var Kh=class extends gu{constructor(t,r=ql){super(\"Interrupt\",r,\"Interrupted\"),this.fiberId=t}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:\"Interrupt\",fiberId:this.fiberId}}[ie](t){return Ri(t)&&this.fiberId===t.fiberId&&this.annotations===t.annotations}[ae](){return oe(Ne(`${this._tag}:${this.fiberId}`))(th(this.annotations))}},J_=e=>new Kh(e),$s=e=>new es([new Kh(e)]),WE=e=>e.reasons.some(Rs),JE=e=>{let t=e.reasons.find(Rs);return t?P(t):D(e)},Kn=e=>{for(let t=0;t<e.reasons.length;t++){let r=e.reasons[t];if(r._tag===\"Fail\")return P(r.error)}return D(e)},G_=M_(Kn),ex=e=>e.reasons.some(_i),K_=e=>{let t=e.reasons.find(_i);return t?P(t):D(e)},Ip=e=>{let t=e.reasons.find(_i);return t?P(t.defect):D(e)},tx=e=>e.reasons.some(Ri),V_=e=>{let t=e.reasons.find(Ri);return t?P(t):D(e)},rx=e=>{let t;for(let r=0;r<e.reasons.length;r++){let n=e.reasons[r];n._tag===\"Interrupt\"&&(t??=new Set,n.fiberId!==void 0&&t.add(n.fiberId))}return t?P(t):D(e)},Z_=e=>{let t=rx(e);return Q(t)?VW:t.success},VW=new Set,Q_=e=>e.reasons.length>0&&e.reasons.every(Ri),Y_=e=>ho(e.annotations),X_=e=>{let t=new Map;for(let r of e.reasons)if(r.annotations.size>0)for(let[n,o]of r.annotations)t.set(n,o);return ho(t)},eR=f(2,(e,t)=>{let r=!1,n=e.reasons.map(o=>Rs(o)?(r=!0,new ki(t(o.error),o.annotations)):o);return r?_s(n):e}),nx=e=>{let t;for(let r of e.reasons){if(r._tag===\"Fail\")return r.error;r._tag===\"Die\"&&(t??=r)}return t!==void 0?t.defect:e.reasons.length>0?new globalThis.Error(\"All fibers interrupted without error\"):new globalThis.Error(\"Empty cause\")},GE=(e,t)=>{let r=[],n=[];if(e.reasons.length===0)return r;let o=Bn();o!==0&&Cr(1);try{for(let s of e.reasons){if(s._tag===\"Interrupt\"){n.push(s);continue}r.push(DE(s._tag===\"Die\"?s.defect:s.error,s.annotations,t))}if(r.length===0){let s=new Error(\"The fiber was interrupted by:\");s.name=\"InterruptCause\",s.stack=XW(s,n);let a=new globalThis.Error(\"All fibers interrupted without error\",{cause:s});a.name=\"InterruptError\",a.stack=`${a.name}: ${a.message}`,r.push(DE(a,n[0].annotations,t))}}finally{o!==0&&Cr(o)}return r},DE=(e,t,r)=>{let n=typeof e,o;if(e&&n===\"object\"){if(o=new globalThis.Error(ZW(e),{cause:e.cause?DE(e.cause):void 0}),typeof e.name==\"string\"&&(o.name=e.name),typeof e.stack==\"string\")o.stack=YW(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?tR(s,t):s}r?.includeCauseInStack&&(o.stack=nR(o));for(let s of Object.keys(e))s in o||(o[s]=e[s])}else o=new globalThis.Error(e?n===\"string\"?e:Os(e):`Unknown error: ${e}`);return o},ZW=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 Os(e)},QW=/\\((.*)\\)/g,YW=(e,t,r)=>{let n=`${t.name}: ${t.message}`,o=(e.startsWith(n)?e.slice(n.length):e).split(`\n`),s=[n];for(let a=1;a<o.length&&!/Generator\\.next|~effect\\/(?:Effect|Utils)/.test(o[a]);a++)s.push(o[a]);return r?tR(s.join(`\n`),r):s.join(`\n`)},tR=(e,t)=>{let r=t?.get(ch.key);return r&&(e=`${e}\n${rR(r)}`),e},XW=(e,t)=>{let r=[`${e.name}: ${e.message}`];for(let n of t){let o=n.fiberId!==void 0?`#${n.fiberId}`:\"unknown\",s=n.annotations.get(jS.key);r.push(`    at fiber (${o})`),s&&r.push(rR(s))}return r.join(`\n`)},rR=e=>{let t=[],r=e,n=0;for(;r&&n<10;){let o=r.stack();if(o){let s=o.matchAll(QW),a=!1;for(let[,i]of s)a=!0,t.push(`    at ${r.name} (${i})`);a||t.push(`    at ${r.name} (${o.replace(/^at /,\"\")})`)}else t.push(`    at ${r.name}`);r=r.parent,n++}return t.join(`\n`)},Bs=e=>GE(e).map(nR).join(`\n`),nR=e=>e.cause?`${e.stack} {\n${oR(e.cause,\"  \")}\n}`:e.stack,oR=(e,t)=>{let r=e.stack.split(`\n`),n=`${t}[cause]: ${r[0]}`;for(let o=1,s=r.length;o<s;o++)n+=`\n${t}${r[o]}`;return e.cause&&(n+=` {\n${oR(e.cause,`${t}  `)}\n${t}}`),n},KE=\"~effect/Fiber\",eJ={_A:_,_E:_},tJ={id:0},$_=(()=>{try{return globalThis.process?.getBuiltinModule?.(\"node:async_hooks\")?.AsyncResource}catch{return}})(),sR=()=>$_===void 0?void 0:new $_(\"effect/Fiber\"),zs=()=>globalThis[mu],Vh=class{constructor(t,r=!0){this.setContext(t),this.id=++tJ.id,this.currentOpCount=0,this.interruptible=r,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[KE](){return eJ}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(t){return Te(this.context,t)}addObserver(t){return this._exit?(t(this._exit),wr):(this._observers===void 0?this._observers=[t]:this._observers.push(t),()=>this.removeObserver(t))}removeObserver(t){if(this._exit||this._observers===void 0)return;let r=this._observers.indexOf(t);r>=0&&this._observers.splice(r,1)}interruptUnsafe(t,r){if(this._exit)return;let n=$s(t);this.cache.stackFrame&&(n=bu(n,ss(ch,this.cache.stackFrame))),r&&(n=bu(n,r)),this._interruptedCause=this._interruptedCause?vi(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Re(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(t){if(this._exit)return;if(this._asyncContext!==void 0){let o=this._asyncContext;return this._asyncContext=void 0,o.runInAsyncScope(this.evaluate,this,t)}else if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let r=this.runLoop(t);if(r===Ai){this._asyncContext=sR();return}let n=LE.interruptChildren&&LE.interruptChildren(this);if(n!==void 0)return this.evaluate($(n,()=>r));if(this._exit=r,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&(this._parent._children?.delete(this),this._parent=void 0),this._observers!==void 0){let o=this._observers;this._observers=void 0;for(let s=0;s<o.length;s++)o[s](r)}this._stack.length=0,this._children=void 0,this.context=tr()}runLoop(t){let r=globalThis[mu];globalThis[mu]=this;let n=this._running;this._running=!0;let o=!1,s=t;this.currentOpCount=0;try{for(;;){this._deferredInterrupt&&(this._deferredInterrupt=!1,s=Re(this._interruptedCause)),this.currentOpCount++;let a=this.cache;if(!o&&!a.preventYield&&a.scheduler.shouldYield(this)){o=!0;let i=s;s=$(zu,()=>i)}if(s=a.tracerContext?a.tracerContext(s,this):s[dt](this),s===Ai){let i=this._yielded;if(Ti in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Ai}}}catch(a){return k(s,dt)?this.runLoop(Ar(a)):Ar(`Fiber.runLoop: Not a valid effect: ${String(s)}`)}finally{this._running=n,globalThis[mu]=r}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,nJ;for(;;){let r=this._stack.pop();if(!r)return;let n=r[wi];if(n!==void 0){let o=n.call(r,this);if(o)return o[t]=o,o}if(r[t])return r}}succeedWith(t){if((++this.currentOpCount&oJ-1)===0)return ve(t);let r=this.getCont(Wt);return r?r[Wt](t,this):this.yieldWith(ve(t))}yieldWith(t){return this._yielded=t,Ai}children(){return this._children??=new Set}pipe(){return K(this,arguments)}setContext(t){let r=this.context;if(this.context=t,r!==void 0&&rE(r,t))return;let n=t.cacheRoot,o=n._fiberCache??=rJ(t);this.cache?.scheduler!==o.scheduler&&(this._dispatcher=void 0),this.cache=o}get currentSpanLocal(){let t=this.cache.span;return t?._tag===\"Span\"?t:void 0}},rJ=e=>{let t=_u(e,qh);return{scheduler:Te(e,Mu),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:Te(e,Gh),span:_u(e,jh),logLevel:Te(e,PE),minimumLogLevel:Te(e,FE),stackFrame:Te(e,Du),runtimeMetrics:_u(e,lp),maxOpsBeforeYield:Te(e,iE),preventYield:Te(e,cE)}},nJ={[Wt](e,t){return Re(t._interruptedCause)},[wn](e,t){return Re(t._interruptedCause)}},oJ=32,LE={interruptChildren:void 0},Tp=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(jS.key,e.cache.stackFrame),ho(t)},sJ=e=>{if(!(e._children===void 0||e._children.size===0))return Hi(e._children)},VE=e=>{let t=e;return t._exit?R(t._exit):Et(r=>t._exit?r(R(t._exit)):V(e.addObserver(n=>r(R(n)))))},wp=e=>Et(t=>{let r=e[Symbol.iterator](),n=[],o;function s(){let a=r.next();for(;!a.done;){if(a.value._exit){n.push(a.value._exit),a=r.next();continue}o=a.value.addObserver(i=>{n.push(i),s()});return}t(R(n))}return s(),V(()=>o?.())}),ZE=e=>{let t=e;return t._exit?t._exit:Et(r=>t._exit?r(t._exit):V(e.addObserver(r)))},aR=e=>Et(t=>{let r=Array.from(e);if(r.length===0)return t(R(At()));let n=new Array(r.length),o=At(),s=()=>{for(let c=0;c<o.length;c++)r[c].removeObserver(o[c])},a=0,i=!1;for(let c=0;c<r.length&&!i;c++){let u=l=>{if(a++,l._tag===\"Failure\")return i=!0,s(),t(l);n[c]=l.value,a===r.length&&t(R(n))};o.push(u),r[c].addObserver(u)}return V(()=>{i=!0,s()})}),Ji=e=>re(t=>iR(e,t.id)),iR=f(e=>k(e[0],KE),(e,t,r)=>re(n=>{let o=Tp(n);return o=o&&r?Ru(o,r):o??r,e.interruptUnsafe(t,o),qu(VE(e))})),Hi=e=>re(t=>{let r=Tp(t),n=At();for(let o of e)o.interruptUnsafe(t.id,r),n.push(o);return qu(wp(n))}),cR=f(2,(e,t)=>re(r=>{let n=Tp(r),o=At();for(let s of e)s.interruptUnsafe(t,n),o.push(s);return qu(wp(o))})),R=ve,Re=lr,Ye=en,V=rs({op:\"Sync\",[dt](e){let t=this[me](),r=e.getCont(Wt);return r?r[Wt](t,e):e.yieldWith(ve(t))}}),W=rs({op:\"Suspend\",[dt](e){return this[me]()}}),QE=f(e=>e.length>=2||vu(e[0]),(e,t)=>fe(e)?Ye(t?t():new fo(\"Effect.fromOption: Option.none\")):R(e.value)),Gi=rr({onFailure:Ye,onSuccess:R}),uR=e=>e==null?Ye(new fo):R(e),YE=rs({op:\"Yield\",[dt](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(yr)},this[me]??0),e.yieldWith(()=>{t=!0})}}),zu=YE(0),XE=e=>R(O(e)),Ki=R(v()),fR=e=>fe(e)?Ki:de(e.value,O),lR=e=>W(()=>Re(e())),js=e=>Ar(e),ox=e=>W(()=>Ye(e())),le=R(void 0);var pR=e=>{let t=typeof e==\"function\"?e:e.try,r=typeof e==\"function\"?n=>new Bu(n,\"An error occurred in Effect.try\"):e.catch;return W(()=>{try{return R(t())}catch(n){return Ye(r(n))}})};var eI=e=>tI(function(t,r){e(r).then(n=>t(R(n)),n=>t(js(n)))},e.length!==0),dR=e=>{let t=typeof e==\"function\"?e:e.try,r=typeof e==\"function\"?n=>new Bu(n,\"An error occurred in Effect.tryPromise\"):e.catch;return tI(function(n,o){let s=a=>W(()=>{try{return Ye(Ea(()=>r(a)))}catch(i){return js(i)}});try{t(o).then(a=>n(R(a)),a=>n(s(a)))}catch(a){n(s(a))}},t.length!==0)},mR=e=>re(t=>e(t.id)),hR=re(R),xR=mR(R),tI=(function(){let e=kn({op:\"Async\",[dt](r){let n=!1,o=!1,s=this.withSignal?new AbortController:void 0,a=this.register.call(r.cache.scheduler,i=>{n||(n=!0,o?r.evaluate(i):o=i)},s?.signal);return o!==!1?o:(o=!0,r._yielded=()=>{n=!0},s===void 0&&a===void 0?Ai:(r._stack.push(aJ(()=>(n=!0,s?.abort(),a??yr))),Ai))}}),t=function(r,n){this.register=r,this.withSignal=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),aJ=rs({op:\"AsyncFinalizer\",[wi](e){e.interruptible&&(e.interruptible=!1,e._stack.push(_p))},[wn](e,t){return tx(e)?$(bM(lr(e),this[me]()),()=>Re(e)):Re(e)}}),Et=e=>tI(e,e.length>=2),kp=Et(wr),sx=(...e)=>{if(e.length===1){let n=e[0];return W(()=>Wi(n()))}let[t,r]=e;return W(()=>Wi(r.call(t.self)))},Cp=(e,...t)=>{let r=t.length===0?function(){return W(()=>Wi(e.apply(this,arguments)))}:function(){let n=W(()=>Wi(e.apply(this,arguments)));for(let o=0;o<t.length;o++)n=t[o](n,...arguments);return n};return rI(e.length,r)},rI=(e,t)=>Object.defineProperty(t,\"length\",{value:e,configurable:!0}),B_=UE(2),gR=function(){let e=typeof arguments[0]==\"string\",t=e?arguments[0]:\"Effect.fn\",r=e?arguments[1]:void 0,n=Bn(),o;return n!==0&&(Cr(2),o=new globalThis.Error,Cr(n)),e?(s,...a)=>z_(t,s,o,a,e,r):z_(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,r)},z_=(e,t,r,n,o,s)=>{let a=typeof t==\"function\"?t:n.shift().bind(t.self),i=`${e} (definition)`,c=r?B_(()=>r.stack):zr;return rI(a.length,function(...u){let l=W(()=>{let m=a.apply(this,arguments);return ue(m)?m:Wi(m)});for(let m=0;m<n.length;m++)l=n[m](l,...u);if(!ue(l))return l;let p=Bn(),d;return p!==0&&(Cr(2),d=new globalThis.Error,Cr(p)),Ws(o?mp(e,s,m=>qE(l,m)):l,Du,m=>({name:e,stack:d?B_(()=>d.stack):zr,parent:{name:i,stack:c,parent:m}}))})},yR=(e,...t)=>rI(e.length,t.length===0?function(){return j_(()=>e.apply(this,arguments))}:function(){let r=j_(()=>e.apply(this,arguments));for(let n of t)r=n(r,...arguments);return r}),j_=e=>{try{let t=e(),r;for(;;){let n=t.next(r);if(n.done)return R(n.value);let o=n.value;if(o&&o._tag===\"Success\"){r=o.value;continue}else{if(o&&o._tag===\"Failure\")return n.value;{let s=!0;return W(()=>s?(s=!1,$(n.value,a=>Wi(t,a))):W(()=>Wi(e())))}}}}catch(t){return js(t)}},Wi=(function(){let e=kn({op:\"Iterator\",[Wt](r,n){let o=this.iterator;for(;;){let s=o.next(r);if(s.done)return R(s.value);if(ze(s.value)){if(s.value._tag===\"Failure\")return s.value}else return n._stack.push(this),s.value;r=s.value.value}},[dt](r){return this[Wt](this.initial,r)}}),t=function(r,n){this.iterator=r,this.initial=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),Vt=f(2,(e,t)=>new qs(e,nI,R(t))),ax=function(e){return e._stack.push(this),this[me]},iJ=kn({op:\"OnSuccess\",[dt]:ax}),qs=function(e,t,r){this[me]=e,this[Wt]=t,this.payload=r};qs.prototype=iJ;var nI=function(){return this.payload},bR=function(e,t){return t.succeedWith(this.payload)},ix=(()=>{let e=\"~effect/Effect/stackProbe\";return{[e]:function(){return new Error().stack}}[e]()?.includes(\"[as \"+e+\"]\")===!0})(),cJ=function(e,t){let r=this.payload;return t.succeedWith(ix?r(e):Ea(()=>r(e)))},SR=function(e){let t=this.payload;return t(e)},uJ=function(e){let t=this.payload;return new qs(t(e),bR,e)},fJ=function(e){return new qs(this.payload,bR,e)},ju=e=>de(e,O),ER=e=>Ku(e,{onFailure:R,onSuccess:Ye}),br=f(2,(e,t)=>new qs(e,ue(t)?nI:SR,t)),Eo=f(2,(e,t)=>new qs(e,ue(t)?fJ:uJ,t)),qu=e=>new qs(e,nI,yr),IR=e=>Hr(e,Ye),oI=(e,t)=>re(r=>{let n=new Set;return Qu(r,()=>n.size===0?void 0:Hi(n)),Et(o=>{let s=Se(e),a=s.length,i=0,c=!1,u=[],l=(p,d,m)=>{if(i++,p._tag===\"Failure\"){u.push(...p.cause.reasons),i>=a&&o(Re(_s(u)));return}let x=!c;c=!0,o(p),x&&t?.onWinner&&t.onWinner({fiber:d,index:m,parentFiber:r})};for(let p=0;p<a;p++){let d=cs(r,s[p],!0,!0,!1);if(n.add(d),d.addObserver(m=>{n.delete(d),l(m,d,p)}),c)break}})}),sI=(e,t)=>re(r=>{let n=new Set;return Qu(r,()=>n.size===0?void 0:Hi(n)),Et(o=>{let s=!1,a=0;for(let i of e){if(s)break;let c=a++,u=cs(r,i,!0,!0,!1);n.add(u),u.addObserver(l=>{n.delete(u);let p=!s;s=!0,o(l),p&&t?.onWinner&&t.onWinner({fiber:u,index:c,parentFiber:r})})}})}),TR=f(e=>ue(e[1]),(e,t,r)=>oI([e,t],r)),aI=f(e=>ue(e[1]),(e,t,r)=>sI([e,t],r)),$=f(2,(e,t)=>new qs(e,SR,t)),wR=f(2,(e,t)=>ze(e)?e._tag===\"Success\"?t.onSuccess(e.value):t.onFailure(e.cause):bo(e,t)),ze=e=>e[Ti]!==void 0,kR=f(2,(e,t)=>ze(e)?e._tag===\"Success\"?t(e.value):e:$(e,t)),CR=e=>$(e,_),de=f(2,(e,t)=>new qs(e,cJ,t)),AR=f(2,(e,t)=>ze(e)?fI(e,t):de(e,t)),vR=f(2,(e,t)=>ze(e)?lI(e,t):yI(e,t)),OR=f(2,(e,t)=>ze(e)?pI(e,t):bI(e,t)),_R=f(2,(e,t)=>{if(ze(e)){if(e._tag===\"Success\")return e;let r=Kn(e.cause);return Q(r)?e:t(r.success)}return Wr(e,t)}),Hu=e=>lr($s(e)),Hs=e=>e._tag===\"Success\",RR=e=>e._tag===\"Success\"?P(e):D(e),MR=e=>e._tag===\"Success\"?P(e.value):D(e),iI=e=>e._tag===\"Failure\",PR=e=>e._tag===\"Failure\"?P(e):D(e),Ap=e=>e._tag===\"Failure\"?P(e.cause):D(e),cI=CE(Ap,Kn),FR=CE(Ap,Ip),uI=e=>e._tag===\"Failure\"&&tx(e.cause),UR=e=>e._tag===\"Failure\"&&ex(e.cause),NR=e=>e._tag===\"Failure\"&&WE(e.cause),yr=ve(void 0),fI=f(2,(e,t)=>e._tag===\"Success\"?ve(t(e.value)):e),lI=f(2,(e,t)=>{if(e._tag===\"Success\")return e;let r=Kn(e.cause);return Q(r)?e:en(t(r.success))}),pI=f(2,(e,t)=>{if(e._tag===\"Success\")return ve(t.onSuccess(e.value));let r=Kn(e.cause);return Q(r)?e:en(t.onFailure(r.success))}),lJ=f(2,(e,t)=>Hs(e)?ve(t):e),DR=f(2,(e,t)=>Hs(e)?t:e),LR=f(2,(e,t)=>Hs(e)?t.onSuccess(e.value):t.onFailure(e.cause)),$R=lJ(void 0),dI=e=>{let t=[];for(let r of e)r._tag===\"Failure\"&&t.push(...r.cause.reasons);return t.length===0?yr:lr(_s(t))},BR=e=>Hs(e)?O(e.value):v(),zR=e=>iI(e)?O(e.cause):v(),jR=e=>{let t=cI(e);return Q(t)?v():O(t.success)},qR=e=>e,HR=e=>re(t=>R(rp(t.context,e))),pJ=e=>re(t=>QE(rp(t.context,e))),Wu=f(2,(e,t)=>re(r=>{let n=r.context,o=t(n);return n===o||(r.setContext(o),Qu(r,()=>{r.setContext(n)})),e})),Ws=f(3,(e,t,r)=>Wu(e,n=>{let o=jn(n,t),s=r(o);return o===s?n:zt(n,t,s)})),WR=(e,t,r)=>Qi(re(n=>{let o=jn(n.context,e),s=t(o);return n.setContext(zt(n.context,e,s)),is(jn(n.context,Pa),a=>{let i=rp(n.context,e);if(fe(i))return le;let c=i.value,u;if(r?.reset===void 0){if(c!==s)return le;u=o}else u=r.reset(o,s,c);return n.setContext(zt(n.context,e,u)),le})})),Vi=()=>dJ,dJ=re(e=>R(e.context)),Ma=e=>re(t=>e(t.context)),JR=f(2,(e,t)=>Wu(e,$e(t))),Io=f(2,(e,t)=>ze(e)?e:Wu(e,Ru(t))),Sr=function(){return arguments.length===1?f(2,(e,t)=>q_(e,arguments[0],t)):f(3,(e,t,r)=>q_(e,t,r)).apply(this,arguments)},q_=(e,t,r)=>Wu(e,zt(t,r)),cx=f(3,(e,t,r)=>$(r,n=>Sr(e,t,n))),GR=f(e=>ue(e[1]),(e,t,r)=>mI(e,t,(n,o)=>[n,o],r)),mI=f(e=>ue(e[1]),(e,t,r,n)=>n?.concurrent?de(Yi([e,t],{concurrency:2}),([o,s])=>r(o,s)):$(e,o=>de(t,s=>r(o,s)))),KR=f(e=>ue(e[0]),(e,t,r)=>MI(e,t,r?n=>Ye(r(n)):()=>Ye(new fo))),VR=f(2,(e,t)=>$(t,r=>r?ju(e):Ki)),hI=f(2,(e,t)=>Array.from({length:t},()=>e)),ZR=f(e=>ue(e[0]),(e,t,r)=>Yi(hI(e,t),r)),Ju=f(e=>ue(e[0]),(e,t)=>wo({while:hr,body:$e(t?.disableYield?e:$(e,r=>zu)),step:wr})),Hr=f(2,(e,t)=>new QR(e,t.length!==1?r=>t(r):t)),mJ=kn({op:\"OnFailure\",[dt]:ax}),QR=function(e,t){this[me]=e,this[wn]=t};QR.prototype=mJ;var xI=f(3,(e,t,r)=>Hr(e,n=>t(n)?r(n):Re(n))),Gu=f(3,(e,t,r)=>Hr(e,n=>{let o=t(n);return Q(o)?Re(o.failure):r(o.success,n)})),Wr=f(2,(e,t)=>Gu(e,Kn,r=>t(r))),YR=e=>Ku(e,{onFailure:t=>uh(t)?Ki:Ye(t),onSuccess:XE}),XR=f(2,(e,t)=>Gu(e,Ip,t)),eM=f(2,(e,t)=>Hr(e,r=>br(t(r),Re(r)))),tM=f(3,(e,t,r)=>xI(e,t,n=>br(r(n),Re(n)))),ux=f(3,(e,t,r)=>Hr(e,n=>{let o=t(n);return Q(o)?Re(n):br(r(o.success,n),Re(n))})),gI=f(2,(e,t)=>ux(e,Kn,r=>t(r))),rM=f(3,(e,t,r)=>{let n=Array.isArray(t)?o=>k(o,\"_tag\")&&t.includes(o._tag):Nt(t);return gI(e,o=>n(o)?r(o):le)}),nM=f(2,(e,t)=>ux(e,Ip,r=>t(r))),vp=f(e=>ue(e[0]),(e,t,r,n)=>Hr(e,o=>{let s=Kn(o);return Q(s)?Re(s.failure):t(s.success)?r(s.success):n?n(s.success):Re(o)})),fx=f(e=>ue(e[0]),(e,t,r,n)=>Hr(e,o=>{let s=Kn(o);if(Q(s))return Re(s.failure);let a=t(s.success);return Q(a)?n?n(a.failure):Re(o):r(a.success)})),lx=f(e=>ue(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>k(s,\"_tag\")&&t.includes(s._tag):Nt(t);return vp(e,o,r,n)}),oM=f(e=>ue(e[0]),(e,t,r)=>{let n;return fx(e,o=>(n??=Object.keys(t),k(o,\"_tag\")&&ur(o._tag)&&n.includes(o._tag)?P(o):D(o)),o=>t[o._tag](o),r)}),sM=f(e=>ue(e[0]),(e,t,r,n,o)=>vp(e,s=>Nt(s,t)&&k(s,\"reason\")&&(o!==void 0||Nt(s.reason,r)),s=>{let a=s.reason;return Nt(a,r)?n(a,s):o?o(a,s):Ye(s)})),aM=f(e=>ue(e[0]),(e,t,r,n)=>{let o;return vp(e,s=>Nt(s,t)&&k(s,\"reason\")&&k(s.reason,\"_tag\")&&ur(s.reason._tag)&&(n!==void 0||(o??=Object.keys(r)).includes(s.reason._tag)),s=>{let a=s.reason;return o??=Object.keys(r),o.includes(a._tag)?r[a._tag](a,s):n?n(a,s):Ye(s)})}),iM=f(2,(e,t)=>fx(e,r=>Nt(r,t)&&k(r,\"reason\")?P(r.reason):D(r),Ye)),yI=f(2,(e,t)=>Wr(e,r=>ox(()=>t(r)))),bI=f(2,(e,t)=>Ku(e,{onFailure:r=>ox(()=>t.onFailure(r)),onSuccess:r=>V(()=>t.onSuccess(r))})),px=e=>Wr(e,js),cM=f(2,(e,t)=>Wr(e,r=>V(()=>t(r)))),uM=e=>W(()=>{let t=e[Symbol.iterator](),r=t.next();if(r.done)return js(new Error(\"Received an empty collection of effects\"));function n(o){let s=t.next();return s.done?o.value:Wr(o.value,a=>n(s))}return n(r)}),SI=e=>Wr(e,t=>$(zu,()=>SI(e))),dx=f(e=>ue(e[0]),(e,t)=>{if(!t?.log)return Ku(e,{onFailure:n=>le,onSuccess:n=>le});let r=ko(t.log===!0?void 0:t.log);return bo(e,{onFailure(n){let o=JE(n);return Q(o)?Re(o.failure):t.message===void 0?r(n):r(t.message,n)},onSuccess:n=>le})}),mx=f(e=>ue(e[0]),(e,t)=>{if(!t?.log)return bo(e,{onFailure:n=>le,onSuccess:n=>le});let r=ko(t.log===!0?void 0:t.log);return bo(e,{onFailure:n=>t.message===void 0?r(n):r(t.message,n),onSuccess:n=>le})}),fM=e=>hx(e,{onFailure:v,onSuccess:O}),Ra=e=>Op(e,{onFailure:D,onSuccess:P}),bo=f(2,(e,t)=>new lM(e,t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure)),hJ=kn({op:\"OnSuccessAndFailure\",[dt]:ax}),lM=function(e,t,r){this[me]=e,this[Wt]=t,this[wn]=r};lM.prototype=hJ;var xJ=function(e,t){let r=this.payload;return t.succeedWith(ix?r.onSuccess(e):Ea(()=>r.onSuccess(e)))},pM=(e,t)=>{let r=kn({op:e,[dt]:ax,[Wt]:xJ,[wn]:t}),n=function(o,s){this[me]=o,this.payload=s};return n.prototype=r,n},gJ=pM(\"Match\",function(e,t){let r=e.reasons.find(Rs);if(r===void 0)return Re(e);let n=this.payload;return t.succeedWith(ix?n.onFailure(r.error):Ea(()=>n.onFailure(r.error)))}),yJ=pM(\"MatchCause\",function(e,t){let r=this.payload;return t.succeedWith(ix?r.onFailure(e):Ea(()=>r.onFailure(e)))}),EI=f(2,(e,t)=>new yJ(e,t)),Ku=f(2,(e,t)=>bo(e,{onFailure:r=>{let n=r.reasons.find(Rs);return n?t.onFailure(n.error):Re(r)},onSuccess:t.onSuccess})),hx=f(2,(e,t)=>new gJ(e,t)),Op=f(2,(e,t)=>{if(ze(e)){if(e._tag===\"Success\")return ve(t.onSuccess(e.value));let r=Kn(e.cause);return Q(r)?e:ve(t.onFailure(r.success))}return hx(e,t)}),dM=f(2,(e,t)=>ze(e)?e._tag===\"Success\"?ve(t.onSuccess(e.value)):ve(t.onFailure(e.cause)):EI(e,t)),Vu=e=>ze(e)?ve(e):bJ(e),bJ=rs({op:\"Exit\",[dt](e){return e._stack.push(this),this[me]},[Wt](e,t,r){return t.succeedWith(r??ve(e))},[wn](e,t,r){return t.succeedWith(r??lr(e))}}),mM=Op({onFailure:()=>!0,onSuccess:()=>!1}),hM=Op({onFailure:()=>!1,onSuccess:()=>!0}),xM=f(2,(e,t)=>br(Ua(t),e)),II=f(2,(e,t)=>$(TI(e,t.duration),r=>fe(r)?t.orElse():R(r.value))),SJ=e=>new xp(`Operation timed out after '${Nh(e)}'`),gM=f(2,(e,t)=>{let r=ye(t);return II(e,{duration:r,orElse:()=>Ye(SJ(r))})}),TI=f(2,(e,t)=>aI(ju(e),Vt(Ua(t),v()))),yM=e=>nn(t=>{let r=t.monotonicTimeNanosUnsafe();return de(e,n=>[Cn(t.monotonicTimeNanosUnsafe()-r),n])}),$E=\"~effect/Scope\",BE=\"~effect/Scope/Closeable\",Pa=vr(\"effect/Scope\"),wI=(e,t)=>re(r=>{let n=xx(e,t);return n===void 0?le:(wJ(r),n)}),xx=(e,t)=>{let r=e.state;if(r._tag===\"Closed\"||(e.state={_tag:\"Closed\",exit:t},e.parent!==void 0&&kI(e.parent,e),r._tag===\"Empty\"))return;if(r.finalizer!==void 0)return Zh(r.finalizer,t);let n=r.finalizers;return n.size===1?Zh(n.values().next().value,t):EJ(e,n,t)},Zh=(e,t)=>{try{return e(t)}catch(r){return Ar(r)}},bM=(e,t)=>Hs(e)?t:Hr(t,r=>Re(vi(e.cause,r))),EJ=Cp(function*(e,t,r){let n=[],o=[],s=Array.from(t.values()),a=zs();for(let i=s.length-1;i>=0;i--){let c=s[i];e.strategy===\"sequential\"?n.push(yield*Vu(Zh(c,r))):o.push(cs(a,Zh(c,r),!0,!0,\"inherit\"))}return o.length>0&&(n=yield*wp(o)),yield*dI(n)});var SM=(e,t)=>{let r=IM(t,e);return e.state._tag===\"Closed\"?(r.state=e.state,r):(Zu(e,r,n=>wI(r,n)),r)},is=(e,t)=>W(()=>e.state._tag===\"Closed\"?t(e.state.exit):(Zu(e,{},t),le)),EM=(e,t)=>is(e,$e(t)),Zu=(e,t,r)=>{if(e.state._tag===\"Empty\")e.state={_tag:\"Open\",finalizerKey:t,finalizer:r,finalizers:void 0};else if(e.state._tag===\"Open\"){let n=e.state;n.finalizer!==void 0&&(n.finalizers=new Map([[n.finalizerKey,n.finalizer]]),n.finalizerKey=void 0,n.finalizer=void 0),n.finalizers.set(t,r)}},kI=(e,t)=>{if(e.state._tag!==\"Open\")return;let r=e.state;r.finalizerKey===t?e.state=zE:r.finalizers!==void 0&&(r.finalizers.delete(t),r.finalizers.size===0&&(e.state=zE))},gx=e=>IM(e,void 0),IM=(e=\"sequential\",t)=>({[BE]:BE,[$E]:$E,strategy:e,parent:t,state:zE}),zE={_tag:\"Empty\"};var Zi=Pa,TM=Sr(Pa),yx=e=>re(t=>{let r=t.context,n=gx();return t.setContext(zt(t.context,Pa,n)),Qu(t,o=>(t.setContext(r),xx(n,o))),e});var bx=e=>W(()=>{let t=gx();return vn(e(t),r=>W(()=>xx(t,r)??le))}),Sx=(e,t,r)=>Ma(n=>Jr(o=>$(Zi,s=>Eo(r?.interruptible?o(e):e,a=>is(s,i=>Io(t(a,i),n)))))),Fa=e=>$(Zi,t=>Ma(r=>is(t,n=>Io(e(n),r)))),wM=(function(){let e=kn({op:\"OnExit\",[dt](r){return r._stack.push(this),this.effect},[wi](r){r.interruptible&&this.interruptible!==!0&&(r._stack.push(_p),r.interruptible=!1)},[Wt](r,n,o){o??=ve(r);let s;try{s=this.onExit(o)}catch(a){s=Ar(a)}return s?$(s,a=>o):o},[wn](r,n,o){o??=lr(r);let s;try{s=this.onExit(o)}catch(a){s=Ar(a)}return s?$(bM(o,s),a=>o):o}}),t=function(r,n,o){this.effect=r,this.onExit=n,this.interruptible=o};return t.prototype=e,t})(),To=(e,t,r)=>new wM(e,t,r),Qu=(e,t)=>{e._stack.push(new wM(void 0,t,void 0))},vn=f(2,To),kM=f(2,(e,t)=>vn(e,r=>t)),CI=f(3,(e,t,r)=>vn(e,n=>t(n)?r(n):le)),AI=f(3,(e,t,r)=>vn(e,n=>{let o=t(n);return Q(o)?le:r(o.success,n)})),vI=f(2,(e,t)=>AI(e,Ap,t)),CM=f(3,(e,t,r)=>CI(e,n=>n._tag!==\"Failure\"?!1:t(n.cause),n=>r(n.cause))),OI=f(3,(e,t,r)=>vn(e,n=>{if(n._tag!==\"Failure\")return le;let o=t(n.cause);return Q(o)?le:r(o.success,n.cause)})),AM=f(2,(e,t)=>OI(rx,t)(e)),vM=(e,t,r)=>Jr(n=>$(e,o=>To(W(()=>n(t(o))),s=>r(o,s),!0))),OM=e=>Sx(e,t=>k(t,Symbol.asyncDispose)?eI(()=>t[Symbol.asyncDispose]()):V(()=>t[Symbol.dispose]())),_I=f(2,(e,t)=>V(()=>_M(e,typeof t==\"function\"?r=>et(ye(t(r))):$e(et(ye(t)))))),IJ=$e(1/0),_M=(e,t)=>{let r=0,n,o,s=(a,i)=>(i.awaiters++,Qu(a,()=>{if(!(--i.awaiters>0||o!==i))return o=void 0,Ji(i.fiber)}),ZE(i.fiber));return[re(a=>{if(o!==void 0)return s(a,o);if(n!==void 0&&(r===1/0||a.getRef(_r).currentTimeMillisUnsafe()<r))return n;n=void 0;let i=a.getRef(_r),c={fiber:void 0,awaiters:0};return o=c,c.fiber=cs(a,To(e,u=>{if(o!==c||(o=void 0,uI(u)))return;let l=t(u);r=l===1/0?1/0:i.currentTimeMillisUnsafe()+l,n=u}),!0,!0),c.fiber._exit??s(a,c)}),V(()=>{n=void 0})]},RM=f(2,(e,t)=>de(_I(e,t),r=>r[0])),MM=e=>V(()=>_M(e,IJ)[0]),PM=re(e=>Re($s(e.id))),Qi=e=>re(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(_p)),e)),FM=rs({op:\"SetInterruptible\",[wi](e){if(e.interruptible=this[me],e._interruptedCause&&e.interruptible)return()=>Re(e._interruptedCause)}}),_p=FM(!0),TJ=FM(!1),UM=e=>{if(e.interruptible=!0,e._stack.push(TJ),e._interruptedCause)return Re(e._interruptedCause)},wJ=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(_p))};var Ex=e=>re(t=>t.interruptible?e:UM(t)??e),Jr=e=>re(t=>t.interruptible?(t.interruptible=!1,t._stack.push(_p),e(Ex)):e(_)),NM=e=>re(t=>{if(t.interruptible)return e(_);let r=UM(t),n=e(Qi);return r??n}),DM=de(Sx(V(()=>new AbortController),e=>V(()=>e.abort())),e=>e.signal),Yi=(e,t)=>Yo(e)?t?.mode===\"result\"?qr(e,Ra,t):qr(e,_,t):t?.discard?t.mode===\"result\"?qr(Object.values(e),Ra,t):qr(Object.values(e),_,t):W(()=>{let r={};return Vt(qr(Object.entries(e),([n,o])=>de(t?.mode===\"result\"?Ra(o):o,s=>{w(r,n,s)}),{discard:!0,concurrency:t?.concurrency}),r)}),RI=f(e=>Yo(e[0])&&!ue(e[0]),(e,t,r)=>de(qr(e,(n,o)=>Ra(t(n,o)),r),n=>bE(n,_))),LM=f(3,(e,t,r)=>{let n=Se(e);return n.length===0?V(t):W(()=>{let o=0,s=t();return de(wo({while:()=>o<n.length,body:()=>r(s,n[o],o),step(a){s=a,o++}}),()=>s)})}),$M=f(e=>Yo(e[0])&&!ue(e[0]),(e,t,r)=>$(RI(e,t,{concurrency:r?.concurrency}),([n,o])=>gr(o)?Ye(o):r?.discard?le:R(n))),BM=f(e=>Yo(e[0])&&!ue(e[0]),(e,t)=>W(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?R(v()):zM(r,0,t,n.value)})),zM=(e,t,r,n)=>$(r(n,t),o=>{if(o)return R(O(n));let s=e.next();return s.done?R(v()):zM(e,t+1,r,s.value)}),jM=f(e=>Yo(e[0])&&!ue(e[0]),(e,t)=>W(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?R(v()):qM(r,0,t,n.value)})),qM=(e,t,r,n)=>$(r(n,t),o=>{if(je(o))return R(O(o.success));let s=e.next();return s.done?R(v()):qM(e,t+1,r,s.value)}),wo=rs({op:\"While\",[Wt](e,t){return this[me].step(e),this[me].while()?(t._stack.push(this),this[me].body()):yr},[dt](e){return this[me].while()?(e._stack.push(this),this[me].body()):yr}}),qr=f(e=>typeof e[1]==\"function\",(e,t,r)=>W(()=>{let n=Rp(r?.concurrency);if(n===1)return kJ(e,t,r);let o=Se(e),s=o.length;if(s===0)return r?.discard?le:R([]);let a=r?.discard?void 0:new Array(s),i=CJ({f:t,out:a},o,{concurrency:n});return i?Vt(i,a):R(a)})),HM=e=>$(e,t=>{let r=t[Symbol.iterator]().next();return r.done?Ye(new fo):R(r.value)}),kJ=(e,t,r)=>W(()=>{let n=r?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),a=0;return Vt(wo({while:()=>!s.done,body:()=>t(s.value,a++),step:i=>{n&&n.push(i),s=o.next()}}),n)}),Rp=e=>e===\"unbounded\"?Number.POSITIVE_INFINITY:Math.max(1,e??1),Ix=()=>e=>{let t=e.onItem,r=e.step,n=(s,a,i,c,u)=>$(Vu(u),l=>r(s,a[i],l,i)??o(s,a,i+1,c)??le),o=(s,a,i=0,c=a.length)=>{for(;i<c;i++){let u=a[i],l=t(s,u,i);if(!ze(l))return n(s,a,i,c,l);let p=r(s,u,l,i);if(p)return p._tag===\"Failure\"?p:void 0}};return o},WM=e=>{let t=e.onItem,r=e.step;return(n,o,s)=>{let a=0,i=s.end??o.length,c=s.concurrency,u=!1,l,p,d,m,x,g=S=>{let E=Ar(S);return m=E,u=!0,p&&p.size>0?$(Qi(Hi(Array.from(p))),()=>m??E):E},y=()=>{let S=!1;for(;!m&&a<i;a++){let E=o[a],U=x??t(n,E,a);if(ze(U)){if(m=r(n,E,U,a),m)break}else if(l){x=void 0;let F=cs(l,U,!0,!0,\"inherit\");if(F._exit){if(m=r(n,E,F._exit,a),m)break;continue}p.add(F);let h=a;if(F.addObserver(I=>{p.delete(F);try{if(m){if(I._tag===\"Failure\"){let C=I.cause.reasons.filter(A=>A._tag!==\"Interrupt\");if(C.length>0){let A=_s(C);m=lr(m._tag===\"Failure\"?vi(m.cause,A):A)}}}else{let C=r(n,E,I,h);C&&(m=C,y())}if(S){let C=y();C&&d(C)}else u&&p.size===0&&d(m??le)}catch(C){d(g(C))}}),p.size<c)continue;S=!0,a++;return}else return Et(F=>{l=zs(),p=new Set,x=U,d=F;let h;try{h=y()}catch(I){return F(g(I))}return h?F(h):W(()=>(m??=yr,$(p?Hi(p):le,()=>m?._tag===\"Failure\"?m:le)))})}if(u=!0,m){if(p&&p.size>0){let E=Tp(l);p.forEach(U=>U.interruptUnsafe(l.id,E));return}if(d||m._tag===\"Failure\")return m}else if(d)if(p)p.size===0&&d(le);else return yr};return y()}},Tx=()=>e=>WM(e),CJ=WM({onItem(e,t,r){return e.f(t,r)},step(e,t,r,n){if(r._tag===\"Failure\")return r;e.out&&(e.out[n]=r.value)}}),MI=f(3,(e,t,r)=>$(e,n=>t(n)?R(n):r(n))),PI=f(3,(e,t,r)=>$(e,n=>{let o=t(n);return Q(o)?r(o.failure):R(o.success)})),JM=f(e=>ue(e[0]),(e,t,r)=>PI(e,t,r?n=>Ye(r(n)):()=>Ye(new fo))),GM=f(e=>Yo(e[0])&&!ue(e[0]),(e,t,r)=>W(()=>{let n=[];return Vt(qr(e,(o,s)=>{let a=t(o,s);return typeof a==\"boolean\"?(a&&n.push(o),le):de(a,i=>{i&&n.push(o)})},{discard:!0,concurrency:r?.concurrency}),n)})),KM=f(e=>Yo(e[0])&&!ue(e[0]),(e,t)=>W(()=>{let r=[];for(let n of e){let o=t(n);je(o)&&r.push(o.success)}return R(r)})),VM=f(e=>Yo(e[0])&&!ue(e[0]),(e,t,r)=>W(()=>{let n=[];return Vt(qr(e,o=>de(t(o),s=>{je(s)&&n.push(s.success)}),{discard:!0,concurrency:r?.concurrency}),n)})),ZM=R({}),QM=Iu(de),YM=Tu(de,$),XM=Eu(de);var eP=f(e=>ue(e[0]),(e,t)=>re(r=>($J(),R(cs(r,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),cs=(e,t,r=!1,n=!1,o=!1)=>{let s=e,a=o===\"inherit\"?s.interruptible:!o,i=new Vh(s.context,a);return r?i.evaluate(t):(i._asyncContext=sR(),s.currentDispatcher.scheduleTask(()=>i.evaluate(t),0)),!n&&!i._exit&&(s.children().add(i),i._parent=s),i},wx=f(e=>ue(e[0]),(e,t)=>re(r=>R(cs(r,e,t?.startImmediately,!0,t?.uninterruptible)))),tP=e=>re(t=>{let r=t._children&&new Set(t._children),n=t.interruptible;return To(e,o=>{let s=t._children;if(s===void 0||s.size===0)return le;r&&(s=n_(s,i=>!r.has(i)));let a=qu(wp(s));return n?Ex(a):a})}),FI=f(e=>ue(e[0]),(e,t,r)=>re(n=>{let o=cs(n,e,r?.startImmediately,!0,r?.uninterruptible);if(!o._exit)if(t.state._tag!==\"Closed\"){let s={};Zu(t,s,()=>mR(i=>i===o.id?le:Ji(o))),o.addObserver(()=>kI(t,s))}else o.interruptUnsafe(n.id,Tp(n));return R(o)})),rP=f(e=>ue(e[0]),(e,t)=>$(Zi,r=>FI(e,r,t))),Js=e=>(t,r)=>{let n=new Vh(r?.scheduler?zt(e,Mu,r.scheduler):e,r?.uninterruptible!==!0);if(n.evaluate(t),n._exit)return n;if(r?.signal)if(r.signal.aborted)n.interruptUnsafe();else{let o=()=>n.interruptUnsafe();r.signal.addEventListener(\"abort\",o,{once:!0}),n.addObserver(()=>r.signal.removeEventListener(\"abort\",o))}return r?.onFiberStart&&r.onFiberStart(n),n},nP=f(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===\"Closed\")return e.interruptUnsafe(e.id),e;let r={};return Zu(t,r,()=>Ji(e)),e.addObserver(()=>kI(t,r)),e}),oP=Js(tr()),UI=e=>{let t=Js(e);return(r,n)=>{let o=t(r,n);return n?.onExit&&o.addObserver(n.onExit),s=>o.interruptUnsafe(s)}},sP=UI(tr()),kx=e=>{let t=Js(e);return(r,n)=>{let o=t(r,n);return new Promise(s=>{o.addObserver(a=>s(a))})}},aP=kx(tr()),NI=e=>{let t=kx(e);return(r,n)=>t(r,n).then(o=>{if(o._tag===\"Failure\")throw nx(o.cause);return o.value})},iP=NI(tr()),Cx=e=>{let t=Js(e);return r=>{if(ze(r))return r;let n=new wa(\"sync\"),o=t(r,{scheduler:n});return o._dispatcher?.flush(),o._exit??Ar(new Sp(o))}},cP=Cx(tr()),DI=e=>{let t=Cx(e);return r=>{let n=t(r);if(n._tag===\"Failure\")throw nx(n.cause);return n.value}},uP=DI(tr()),H_=R(!0),W_=R(!1),jE=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return H_;if(this.scheduled===void 0)this.scheduled=this.waiters,t.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let r=0;r<this.waiters.length;r++)this.scheduled.push(this.waiters[r]);return this.waiters=[],H_}flushScheduled=()=>{if(this.scheduled===void 0)return;let t=this.scheduled;this.scheduled=void 0;for(let r=0;r<t.length;r++)t[r](yr)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let r=0;r<t.length;r++)t[r](yr)}open=re(t=>this._isOpen?W_:(this._isOpen=!0,this.scheduleUnsafe(t)));release=re(t=>this._isOpen?W_:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=Et(t=>this._isOpen?t(le):(this.waiters.push(t),V(()=>{let r=this.waiters.indexOf(t);r!==-1?this.waiters.splice(r,1):this.scheduled!==void 0&&(r=this.scheduled.indexOf(t),r!==-1&&this.scheduled.splice(r,1))})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=V(()=>this.closeUnsafe());whenOpen=t=>$(this.await,()=>t);isOpen(){return this._isOpen}},LI=e=>new jE(e??!1),fP=e=>V(()=>LI(e)),lP=re(e=>R(e.getRef(Hh))),pP=f(2,(e,t)=>Sr(e,Hh,t)),dP=Sr(Gh),mP=Sr(qi),Qh=BigInt(0),AJ={_tag:\"Span\",spanId:\"noop\",traceId:\"noop\",sampled:!1,status:{_tag:\"Ended\",startTime:Qh,endTime:Qh,exit:yr},attributes:new Map,links:[],kind:\"internal\",attribute(){},event(){},end(){},addLinks(){}},vJ=e=>Object.assign(Object.create(AJ),e),hP=e=>e?Te(e.annotations,fp)?e._tag===\"Span\"?hP(po(e.parent)):v():O(e):v(),$I=(e,t,r)=>{let n=!e.cache.tracerEnabled||r?.annotations&&Te(r.annotations,fp),o=r?.parent!==void 0?O(r.parent):r?.root?v():hP(e.cache.span),s;if(n)s=vJ({name:t,parent:o,annotations:zt(r?.annotations??tr(),fp,!0)});else{let a=e.cache.tracer??Wh,i=e.getRef(_r),c=e.getRef(qi),u=e.getRef(pp),l=e.getRef(dp),p=r?.level??e.getRef(RE),d=r?.links!==void 0?[...l,...r.links]:l.length===0?[]:l.slice();s=a.span({name:t,parent:o,annotations:r?.annotations??tr(),links:d,startTime:c?i.currentTimeNanosUnsafe():Qh,kind:r?.kind??\"internal\",root:r?.root??fe(o),sampled:r?.sampled??(Ue(o)&&o.value.sampled===!1?!1:!UP(e.getRef(ME),p))});for(let m in u)s.attribute(m,u[m]);if(r?.attributes!==void 0)for(let m in r.attributes)s.attribute(m,r.attributes[m])}return s},xP=(e,t)=>re(r=>R($I(r,e,t))),So=(e,t)=>Qi(re(r=>{let n=jn(r.context,Pa),o=$I(r,e,t??{}),s=r.getRef(_r),a=r.getRef(qi);return Vt(is(n,i=>Ax(o,i,s,a)),o)})),gP=function(){let e=typeof arguments[0]!=\"string\",t=e?arguments[1]:arguments[0],r=Jn(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return $(So(t,r),o=>$u(n,o,r))}return n=>$(So(t,r),o=>$u(n,o,r))},OJ=(e,t)=>(t=typeof t==\"function\"?t:zr,Ws(Du,r=>({name:e,stack:t,parent:r}))),yP=pp,bP=dp,SP=f(e=>ue(e[0]),(e,t,r={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:r}));return Ws(e,dp,s=>[...s,...o])}),Ax=(e,t,r,n)=>V(()=>{e.status._tag!==\"Ended\"&&e.end(n?r.currentTimeNanosUnsafe():Qh,t)}),mp=(e,...t)=>{let r=t.length===1?void 0:t[0],n=t[t.length-1];return re(o=>{let s=$I(o,e,r),a=o.getRef(_r),i=o.getRef(qi);return Qu(o,c=>Ax(s,c,a,i)),n(s)})},qE=Sr(go),$u=function(){let e=ue(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=_;return t._tag===\"Span\"&&(r=Jn(r),n=OJ(t.name,r?.captureStackTrace)),e?qE(n(arguments[0]),t):o=>qE(n(o),t)},EP=function(){let e=typeof arguments[0]!=\"string\",t=e?arguments[1]:arguments[0],r=Jn(arguments[2]);if(e){let s=arguments[0];return mp(t,arguments[2],a=>$u(s,a,r))}let n=typeof arguments[1]==\"function\"?arguments[1]:void 0,o=n?void 0:arguments[1];return(s,...a)=>mp(t,n?n(...a):o,i=>$u(s,i,r))},IP=f(e=>ue(e[0]),(e,...t)=>Ws(e,pp,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||w(n,t[0],t[1]),n})),TP=(...e)=>re(t=>{let r=t.currentSpanLocal;if(r)if(e.length===1)for(let[n,o]of Object.entries(e[0]))r.attribute(n,o);else r.attribute(e[0],e[1]);return le}),wP=re(e=>{let t=e.currentSpanLocal;return t?R(t):Ye(new fo)}),kP=pJ(go),_r=Ee(\"effect/Clock\",{defaultValue:()=>new HE}),NE=2**31-1,HE=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=V(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return _J()}currentTimeNanos=V(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return AP()}monotonicTimeNanos=V(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(et(t))}sleepMillis(t){return t<=0?zu:Number.isFinite(t)?Et(r=>{let n=t>NE?this.sleepMillis(t-NE):le,o=setTimeout(()=>r(n),Math.min(t,NE));return V(()=>clearTimeout(o))}):kp}},CP=BigInt(1e6),AP=(function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint==\"function\")return()=>e.bigint();if(typeof performance<\"u\"&&typeof performance.now==\"function\")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let r=BigInt(Date.now())*CP;return r>t&&(t=r),t}})(),_J=(function(){let e=BigInt(1e9),t;return()=>{let r=AP(),n=BigInt(Date.now())*CP;if(t===void 0)t=n-r;else{let o=t+r;(n>o?n-o:o-n)>e&&(t=n-r)}return t+r}})(),nn=e=>re(t=>e(t.getRef(_r))),Ua=e=>nn(t=>t.sleep(ye(e))),vx=nn(e=>e.currentTimeMillis),vP=nn(e=>e.currentTimeNanos),OP=nn(e=>e.monotonicTimeNanos),hp=\"~effect/Cause/TimeoutError\",_P=e=>k(e,hp),xp=class extends Ms(\"TimeoutError\"){[hp]=hp;constructor(t){super({message:t})}},gp=\"~effect/Cause/IllegalArgumentError\",RP=e=>k(e,gp),Yh=class extends Ms(\"IllegalArgumentError\"){[gp]=gp;constructor(t){super({message:t})}},yp=\"~effect/Cause/ExceededCapacityError\",MP=e=>k(e,yp),Xh=class extends Ms(\"ExceededCapacityError\"){[yp]=yp;constructor(t){super({message:t})}},bp=\"~effect/Cause/AsyncFiberError\",PP=e=>k(e,bp),Sp=class extends Ms(\"AsyncFiberError\"){[bp]=bp;constructor(t){super({message:\"An asynchronous Effect was executed with Effect.runSync\",fiber:t})}},Ep=\"~effect/Cause/UnknownError\",FP=e=>k(e,Ep),Bu=class extends Ms(\"UnknownError\"){[Ep]=Ep;constructor(t,r){super({message:r,cause:t})}},Xi=Ee(\"effect/Console\",{defaultValue:()=>globalThis.console}),RJ=e=>{switch(e){case\"All\":return Number.MIN_SAFE_INTEGER;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 Number.MAX_SAFE_INTEGER}},MJ=VS(jr,RJ),UP=os(MJ),Yu=Ee(\"effect/Logger/CurrentLoggers\",{defaultValue:()=>new Set([HI,WI])}),Ox=Ee(\"effect/Logger/LogToStderr\",{defaultValue:_l}),NP=function(){let e=typeof arguments[0]==\"string\"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return Qi(re(t=>{let r=t.getRef(yo),n={...r};for(let o=0;o<e.length;o++){let[s,a]=e[o];w(n,s,a)}return t.setContext(zt(t.context,yo,n)),is(jn(t.context,Pa),o=>{let s=t.getRef(yo),a={...s};for(let i=0;i<e.length;i++){let[c,u]=e[i];s[c]!==u&&!Object.is(s[c],u)||(Object.hasOwn(r,c)?w(a,c,r[c]):delete a[c])}return t.setContext(zt(t.context,yo,a)),le})}))},PJ=\"~effect/Logger\",FJ={[PJ]:{_Message:_,_Output:_},pipe(){return K(this,arguments)}},on=e=>{let t=Object.create(FJ);return t.log=e,t},BI=e=>e.replace(/[\\s=\"]/g,\"_\"),Mp=(e,t)=>`${BI(e[0])}=${t-e[1]}ms`,Xu=e=>{switch(typeof e){case\"function\":case\"symbol\":return String(e);default:return Lt(e)}},ko=e=>(...t)=>{let r;for(let n=0,o=t.length;n<o;n++){let s=t[n];yu(s)&&(r?t.splice(n,1):t=t.slice(0,n).concat(t.slice(n+1)),r=r?_s(r.reasons.concat(s.reasons)):s,n--)}return r===void 0&&(r=ih),re(n=>{let o=e??n.cache.logLevel;if(UP(n.cache.minimumLogLevel,o))return le;let s=n.getRef(_r),a=n.getRef(Yu);if(a.size>0){let i=new Date(s.currentTimeMillisUnsafe());for(let c of a)c.log({cause:r,fiber:n,date:i,logLevel:o,message:t})}return le})},UJ=(e,...t)=>{let r=\"\";for(let n=0;n<t.length;n++)r+=`\\x1B[${t[n]}m`;return r+e+\"\\x1B[0m\"},NJ=(e,...t)=>e,Gn={bold:\"1\",red:\"31\",green:\"32\",yellow:\"33\",blue:\"34\",cyan:\"36\",white:\"37\",gray:\"90\",black:\"30\",bgBrightRed:\"101\"},DJ={None:[],All:[],Trace:[Gn.gray],Debug:[Gn.blue],Info:[Gn.green],Warn:[Gn.yellow],Error:[Gn.red],Fatal:[Gn.bgBrightRed,Gn.black]},LJ={None:\"\",All:\"\",Trace:\"color:gray\",Debug:\"color:blue\",Info:\"color:green\",Warn:\"color:orange\",Error:\"color:red\",Fatal:\"background-color:red;color:white\"},zI=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\")}`,DP=e=>{let t=globalThis.process,r=typeof t?.stdout==\"object\"&&t.stdout!==null,n=\"Deno\"in globalThis,o=e?.mode??\"auto\";return(o===\"auto\"?r||n:o===\"tty\")?jI(e):qI(e)},jI=e=>{let t=e?.formatDate??zI,r=globalThis.process,o=typeof r?.stdout==\"object\"&&r.stdout!==null&&r.stdout.isTTY===!0,a=(typeof e?.colors==\"boolean\"?e.colors:o)?UJ:NJ,i=r?.isBun===!0;return on(({cause:c,date:u,fiber:l,logLevel:p,message:d})=>{let m=l.getRef(Xi),x=l.getRef(Ox)?m.error:m.log,g=Array.isArray(d)?d.slice():[d],y=a(`[${t(u)}]`,Gn.white)+` ${a(p.toUpperCase(),...DJ[p])} (#${l.id})`,S=u.getTime(),E=l.getRef(Lu);for(let h of E)y+=\" \"+Mp(h,S);y+=\":\";let U=0;if(g.length>0){let h=Xu(g[0]);typeof h==\"string\"&&(y+=\" \"+a(h,Gn.bold,Gn.cyan),U++)}if(x(y),i||m.group(),c.reasons.length>0&&x(Bs(c)),U<g.length)for(;U<g.length;U++)x($n(g[U]));let F=l.getRef(yo);for(let[h,I]of Object.entries(F))x(a(`${h}:`,Gn.bold,Gn.white),$n(I));i||m.groupEnd()})},qI=e=>{let t=e?.colors!==!1,r=t?\"%c\":\"\",n=e?.formatDate??zI;return on(({cause:o,date:s,fiber:a,logLevel:i,message:c})=>{let u=a.getRef(Xi),l=Array.isArray(c)?c.slice():[c],p=`${r}[${n(s)}]`,d=[];t&&d.push(\"color:gray\"),p+=` ${r}${i.toUpperCase()}${r} (#${a.id})`,t&&d.push(LJ[i],\"\");let m=s.getTime(),x=a.getRef(Lu);for(let S of x)p+=\" \"+Mp(S,m);p+=\":\";let g=0;if(l.length>0){let S=Xu(l[0]);typeof S==\"string\"&&(p+=` ${r}${S}`,t&&d.push(\"color:deepskyblue\"),g++)}if(u.groupCollapsed(p,...d),o.reasons.length>0&&u.error(Bs(o)),g<l.length)for(;g<l.length;g++)u.log($n(l[g]));let y=a.getRef(yo);for(let[S,E]of Object.entries(y)){let U=$n(E);t?u.log(`%c${S}:`,\"color:gray\",U):u.log(`${S}:`,U)}u.groupEnd()})},HI=on(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(Bs(e));let a=t.getTime(),i=r.getRef(Lu),c=\"\";for(let d of i)c+=` ${Mp(d,a)}`;let u=r.getRef(yo);Object.keys(u).length>0&&s.push(u);let l=r.getRef(Xi);(r.getRef(Ox)?l.error:l.log)(`[${zI(t)}] ${n.toUpperCase()} (#${r.id})${c}:`,...s)}),WI=on(({cause:e,fiber:t,logLevel:r,message:n})=>{let o=t.getRef(_r),s=t.getRef(yo),a=t.cache.span;if(a===void 0||a._tag===\"ExternalSpan\")return;let i={};for(let[c,u]of Object.entries(s))w(i,c,u);i[\"effect.fiberId\"]=t.id,i[\"effect.logLevel\"]=r.toUpperCase(),e.reasons.length>0&&(i[\"effect.cause\"]=Bs(e)),a.event(xO(Array.isArray(n)&&n.length===1?n[0]:n),o.currentTimeNanosUnsafe(),i)});function $J(){LE.interruptChildren??=sJ}var Pp=R(void 0);var LP=f(e=>ue(e[0]),(e,t)=>vI(e,r=>re(n=>(BJ(n,r,t?.defectsOnly),le)))),BJ=(e,t,r)=>{let n=e.getRef(L_);if(n.size===0||r&&!ex(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(_r).currentTimeNanosUnsafe()};n.forEach(s=>s.report(o))};var ec=_r,zJ=nn,jJ=vx,qJ=vP,HJ=OP;var _t={};Ae(_t,{Do:()=>S4,Transaction:()=>yf,TypeId:()=>p4,abortSignal:()=>D6,acquireDisposable:()=>C6,acquireRelease:()=>Xs,acquireUseRelease:()=>xU,addFinalizer:()=>A6,all:()=>ig,andThen:()=>Ur,annotateCurrentSpan:()=>K6,annotateLogs:()=>kV,annotateLogsScoped:()=>CV,annotateSpans:()=>G6,as:()=>Qt,asSome:()=>fg,asVoid:()=>ja,awaitAllChildren:()=>cV,bind:()=>T4,bindTo:()=>E4,cached:()=>M6,cachedInvalidateWithTTL:()=>F6,cachedWithTTL:()=>P6,callback:()=>Sf,catch:()=>If,catchCause:()=>Ot,catchCauseFilter:()=>j4,catchCauseIf:()=>z4,catchDefect:()=>od,catchEager:()=>Cf,catchFilter:()=>$4,catchIf:()=>L4,catchNoSuchElement:()=>B4,catchReason:()=>U4,catchReasons:()=>N4,catchTag:()=>P4,catchTags:()=>F4,clockWith:()=>Ic,context:()=>Ys,contextWith:()=>sd,currentParentSpan:()=>Z6,currentSpan:()=>V6,delay:()=>rT,die:()=>Kr,effectify:()=>DV,ensuring:()=>Sc,eventually:()=>G4,exit:()=>to,fail:()=>N,failCause:()=>It,failCauseSync:()=>Qs,failSync:()=>ug,fiber:()=>uV,fiberId:()=>fV,filter:()=>oT,filterMap:()=>u6,filterMapEffect:()=>sT,filterMapOrElse:()=>l6,filterMapOrFail:()=>d6,filterOrElse:()=>f6,filterOrFail:()=>p6,findFirst:()=>x4,findFirstFilter:()=>g4,firstSuccessOf:()=>r6,flatMap:()=>T,flatMapEager:()=>ft,flatten:()=>Y0,flip:()=>R4,fn:()=>gV,fnUntraced:()=>ke,fnUntracedEager:()=>gT,forEach:()=>Ba,forever:()=>sr,forkChild:()=>wf,forkDetach:()=>iV,forkIn:()=>Yt,forkScoped:()=>kf,fromNullishOr:()=>v4,fromOption:()=>C4,fromResult:()=>nd,gen:()=>Gr,head:()=>y4,ignore:()=>Q4,ignoreCause:()=>Y4,interrupt:()=>an,interruptible:()=>U6,interruptibleMask:()=>N6,isEffect:()=>ps,isFailure:()=>y6,isSuccess:()=>b6,let:()=>I4,linkSpans:()=>X6,log:()=>yV,logDebug:()=>IV,logError:()=>xT,logFatal:()=>bV,logInfo:()=>EV,logTrace:()=>TV,logWarning:()=>SV,logWithLevel:()=>mg,makeSpan:()=>dT,makeSpanScoped:()=>eV,map:()=>q,mapBoth:()=>q4,mapBothEager:()=>pr,mapEager:()=>Fn,mapError:()=>eT,mapErrorEager:()=>id,match:()=>aT,matchCause:()=>h6,matchCauseEager:()=>x6,matchCauseEffect:()=>yc,matchCauseEffectEager:()=>g6,matchEager:()=>m6,matchEffect:()=>iT,never:()=>gc,onError:()=>vo,onErrorFilter:()=>O6,onErrorIf:()=>v6,onExit:()=>Pn,onExitFilter:()=>R6,onExitIf:()=>_6,onExitPrimitive:()=>lT,onInterrupt:()=>pT,option:()=>_4,orDie:()=>tT,orElseSucceed:()=>t6,partition:()=>d4,promise:()=>cg,provide:()=>S6,provideContext:()=>ro,provideService:()=>ds,provideServiceEffect:()=>k6,race:()=>c6,raceAll:()=>nT,raceAllFirst:()=>i6,raceFirst:()=>Tf,reduce:()=>m4,repeat:()=>L6,repeatOrElse:()=>$6,replicate:()=>B6,replicateEffect:()=>z6,request:()=>sV,requestUnsafe:()=>aV,result:()=>O4,retry:()=>K4,retryOrElse:()=>V4,runCallback:()=>pV,runCallbackWith:()=>lV,runFork:()=>Ec,runForkWith:()=>cn,runPromise:()=>mT,runPromiseExit:()=>ad,runPromiseExitWith:()=>dV,runPromiseWith:()=>hT,runSync:()=>mV,runSyncExit:()=>hs,runSyncExitWith:()=>xV,runSyncWith:()=>hV,sandbox:()=>Z4,satisfiesErrorType:()=>$V,satisfiesServicesType:()=>BV,satisfiesSuccessType:()=>LV,schedule:()=>j6,scheduleFrom:()=>gU,scope:()=>bc,scoped:()=>dg,scopedWith:()=>fT,service:()=>cT,serviceOption:()=>uT,setContext:()=>E6,sleep:()=>qa,spanAnnotations:()=>Q6,spanLinks:()=>Y6,succeed:()=>b,succeedNone:()=>za,succeedSome:()=>Q0,suspend:()=>z,sync:()=>B,tap:()=>Zr,tapCause:()=>mU,tapCauseFilter:()=>J4,tapCauseIf:()=>W4,tapDefect:()=>hU,tapError:()=>lg,tapErrorTag:()=>H4,timed:()=>a6,timeout:()=>n6,timeoutOption:()=>o6,timeoutOrElse:()=>s6,tracer:()=>q6,track:()=>vV,trackDefects:()=>RV,trackDuration:()=>MV,trackErrors:()=>_V,trackSuccesses:()=>OV,transposeOption:()=>A4,try:()=>Ef,tryPromise:()=>bf,tx:()=>PV,txRetry:()=>NV,undefined:()=>b4,uninterruptible:()=>ea,uninterruptibleMask:()=>ms,unwrapReason:()=>D4,updateContext:()=>I6,updateService:()=>T6,updateServiceScoped:()=>w6,useSpan:()=>tV,validate:()=>h4,void:()=>te,when:()=>pg,whileLoop:()=>Mn,withErrorReporting:()=>e6,withExecutionPlan:()=>X4,withFiber:()=>Vr,withFiberSucceed:()=>k4,withLogSpan:()=>AV,withLogger:()=>wV,withParentSpan:()=>oV,withSpan:()=>rV,withSpanScoped:()=>nV,withTracer:()=>H6,withTracerEnabled:()=>W6,withTracerTiming:()=>J6,yieldNow:()=>rd,yieldNowWith:()=>w4,zip:()=>X0,zipWith:()=>M4});var Mr={};Ae(Mr,{asVoid:()=>rG,asVoidAll:()=>nG,die:()=>JI,fail:()=>Gs,failCause:()=>sn,filterCause:()=>ZJ,filterFailure:()=>VJ,filterSuccess:()=>GJ,filterValue:()=>KJ,findDefect:()=>YJ,findError:()=>QJ,findErrorOption:()=>aG,getCause:()=>sG,getSuccess:()=>oG,hasDies:()=>JJ,hasFails:()=>WJ,hasInterrupts:()=>KI,interrupt:()=>GI,isExit:()=>Fp,isFailure:()=>Co,isSuccess:()=>qe,map:()=>XJ,mapBoth:()=>tG,mapError:()=>eG,match:()=>VI,succeed:()=>Rr,void:()=>vt});var Fp=BS,Rr=ve,sn=lr,Gs=en,JI=Ar,GI=Hu,vt=yr;var qe=Hs,Co=iI,WJ=NR,JJ=UR,KI=uI,GJ=RR,KJ=MR,VJ=PR,ZJ=Ap,QJ=cI,YJ=FR,VI=LR,XJ=fI,eG=lI,tG=pI,rG=$R,nG=dI,oG=BR,sG=zR,aG=jR;var ic={};Ae(ic,{CurrentMemoMap:()=>nc,build:()=>rF,buildWithMemoMap:()=>ac,buildWithScope:()=>Lp,catch:()=>PG,catchCause:()=>UG,catchTag:()=>FG,effect:()=>nf,effectContext:()=>t0,effectDiscard:()=>kG,empty:()=>TG,flatMap:()=>sF,forkMemoMap:()=>IG,forkMemoMapUnsafe:()=>e0,fresh:()=>NG,fromBuild:()=>Na,fromBuildMemo:()=>Fx,isLayer:()=>Px,launch:()=>DG,makeMemoMap:()=>EG,makeMemoMapUnsafe:()=>Da,merge:()=>AG,mergeAll:()=>Ux,mock:()=>LG,orDie:()=>MG,parentSpan:()=>iF,provide:()=>rf,provideMerge:()=>vG,satisfiesErrorType:()=>zG,satisfiesServicesType:()=>jG,satisfiesSuccessType:()=>BG,span:()=>qG,succeed:()=>$p,succeedContext:()=>oc,suspend:()=>CG,sync:()=>wG,syncContext:()=>QI,tap:()=>OG,tapCause:()=>RG,tapError:()=>_G,unwrap:()=>YI,updateService:()=>aF,withParentSpan:()=>XI,withSpan:()=>HG});var tf={};Ae(tf,{await:()=>tc,complete:()=>fG,completeWith:()=>jP,die:()=>HP,dieSync:()=>dG,done:()=>ef,doneUnsafe:()=>On,fail:()=>qP,failCause:()=>ZI,failCauseSync:()=>pG,failSync:()=>lG,interrupt:()=>mG,interruptWith:()=>Up,into:()=>_x,isDeferred:()=>iG,isDone:()=>hG,isDoneUnsafe:()=>WP,make:()=>uG,makeUnsafe:()=>Ao,poll:()=>xG,succeed:()=>JP,sync:()=>gG});var BP=\"~effect/Deferred\",iG=e=>k(e,BP),cG={[BP]:{_A:_,_E:_},pipe(){return K(this,arguments)}},zP=function(){this.resumes=void 0,this.effect=void 0};zP.prototype=cG;var Ao=()=>new zP,uG=()=>V(()=>Ao()),tc=e=>Et(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),V(()=>{let r=e.resumes;if(r===void 0)return;let n=r.indexOf(t);n>=0&&r.splice(n,1)})));var fG=f(2,(e,t)=>W(()=>e.effect?R(!1):_x(t,e))),jP=f(2,(e,t)=>V(()=>On(e,t))),ef=jP,qP=f(2,(e,t)=>ef(e,en(t))),lG=f(2,(e,t)=>W(()=>qP(e,t()))),ZI=f(2,(e,t)=>ef(e,lr(t))),pG=f(2,(e,t)=>W(()=>ZI(e,t()))),HP=f(2,(e,t)=>ef(e,Ar(t))),dG=f(2,(e,t)=>W(()=>HP(e,t()))),mG=e=>re(t=>Up(e,t.id)),Up=f(2,(e,t)=>ZI(e,$s(t))),hG=e=>V(()=>WP(e)),WP=e=>e.effect!==void 0;function xG(e){return V(()=>Ns(e.effect))}var JP=f(2,(e,t)=>ef(e,ve(t))),gG=f(2,(e,t)=>W(()=>JP(e,t()))),On=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let r=e.resumes;e.resumes=void 0;for(let n=0;n<r.length;n++)r[n](t)}return!0},_x=f(2,(e,t)=>Jr(r=>$(Vu(r(e)),n=>ef(t,n))));var Np=yo;var Dp=Lu,GP=Du;var KP=qi;var Pr=Pa;var Vn=gx,Zn=TM,us=is,Er=EM;var Zt=SM,He=wI;var tF=\"~effect/Layer\",VP=\"~effect/Layer/MemoMap\",bG=(e,t)=>{let r={observers:0,deferred:Ao(),scope:Vn(),finalizer:n=>W(()=>--r.observers>0?le:(e.map.delete(t),He(r.scope,n)))};return r},ZP=(e,t)=>t.state._tag===\"Closed\"?!1:(e.observers++,Zu(t,{},e.finalizer),!0),Px=e=>k(e,tF),SG={[tF]:{_ROut:_,_E:_,_RIn:_},pipe(){return K(this,arguments)}},sc=e=>{let t=Object.create(SG);return t.build=e,t},Na=e=>sc((t,r)=>{let n=Zt(r);return vn(e(t,n),o=>o._tag===\"Failure\"?He(n,o):le)}),Fx=e=>{let t=Na((r,n)=>r.getOrElseMemoize(t,n,e));return t},Mx=class{get[VP](){return VP}parent;constructor(t){this.parent=t}map=new Map;get(t,r){let n=this.map.get(t);return n?(ZP(n,r),n.deferred.effect??tc(n.deferred)):this.parent?.get(t,r)}getOrElseMemoize(t,r,n){return W(()=>{let o;return To(W(()=>{let s=this.get(t,r);if(s)return s;let a=bG(this,t);return ZP(a,r)?(o=a.deferred,this.map.set(t,a),n(this,a.scope)):n(this,r)}),s=>{o&&On(o,s)})})}},Da=()=>new Mx,e0=e=>new Mx(e),EG=V(Da),IG=e=>V(()=>e0(e)),nc=class e extends vr()(\"effect/Layer/CurrentMemoMap\"){static forkOrCreate(t){let r=tp(t,e);return r?e0(r):Da()}},ac=f(3,(e,t,r)=>Sr(de(e.build(t,r),zt(nc,t)),nc,t)),rF=e=>re(t=>ac(e,nc.forkOrCreate(t.context),jn(t.context,Pr))),Lp=f(2,(e,t)=>re(r=>ac(e,nc.forkOrCreate(r.context),t))),$p=function(){return arguments.length===1?e=>oc(ss(arguments[0],e)):oc(ss(arguments[0],arguments[1]))},oc=e=>sc($e(R(e))),TG=oc(tr()),wG=function(){return arguments.length===1?e=>QI(()=>ss(arguments[0],e())):QI(()=>ss(arguments[0],arguments[1]()))},QI=e=>Fx($e(V(e))),nf=function(){return arguments.length===1?e=>QP(arguments[0],e):QP(arguments[0],arguments[1])},QP=(e,t)=>t0(de(t,r=>ss(e,r))),t0=e=>Fx((t,r)=>Zn(e,r)),kG=e=>t0(Vt(e,tr())),CG=e=>Fx((t,r)=>W(()=>e().build(t,r))),YP=vr(\"effect/Layer/unwrap\"),YI=e=>sF(nf(YP)(e),Te(YP)),nF=(e,t,r)=>{let n=Zt(r,\"parallel\");return qr(e,o=>o.build(t,Zt(n,\"sequential\")),{concurrency:e.length}).pipe(de(o=>oE(...o)))},Ux=(...e)=>Na((t,r)=>nF(e,t,r)),AG=f(2,(e,t)=>Ux(e,...Array.isArray(t)?t:[t])),oF=(e,t,r)=>Na((n,o)=>$(Array.isArray(t)?nF(t,n,o):t.build(n,o),s=>e.build(n,o).pipe(Io(s),de(a=>r(a,s))))),rf=f(2,(e,t)=>oF(e,t,_)),vG=f(2,(e,t)=>oF(e,t,(r,n)=>Ru(n,r))),sF=f(2,(e,t)=>Na((r,n)=>$(e.build(r,n),o=>t(o).build(r,n)))),OG=f(2,(e,t)=>Na((r,n)=>$(e.build(r,n),o=>Zn(Vt(t(o),o),n)))),_G=f(2,(e,t)=>Na((r,n)=>Wr(e.build(r,n),o=>Zn(br(t(o),Ye(o)),n)))),RG=f(2,(e,t)=>Na((r,n)=>Hr(e.build(r,n),o=>Zn(br(t(o),Re(o)),n)))),MG=e=>sc((t,r)=>px(e.build(t,r))),PG=f(2,(e,t)=>sc((r,n)=>Wr(e.build(r,n),o=>t(o).build(r,n))));var FG=f(3,(e,t,r)=>sc((n,o)=>lx(e.build(n,o),t,s=>r(s).build(n,o)))),UG=f(2,(e,t)=>sc((r,n)=>Hr(e.build(r,n),o=>t(o).build(r,n)))),aF=f(3,(e,t,r)=>rf(e,nf(t,de(t,r)))),NG=e=>sc((t,r)=>e.build(Da(),r)),DG=e=>yx(br(rF(e),kp)),LG=function(){return arguments.length===1?e=>XP(arguments[0],e):XP(arguments[0],arguments[1])},XP=(e,t)=>$p(e)(new Proxy({...t},{get(r,n,o){if(n in r)return r[n];let s=Bn();Cr(2);let a=new Error(`${e.key}: Unimplemented method \"${n.toString()}\"`);return Cr(s),a.name=\"UnimplementedError\",$G(a)},has:hr})),$G=e=>{let t=Object.assign(js(e),{[eF]:eF,channel:{[Rx]:Rx,transform:()=>R(t),pipe(){return K(this,arguments)}},[Rx]:Rx,transform:()=>R(t)});function r(){return t}return Object.assign(r,t),Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r},eF=\"~effect/Stream\",Rx=\"~effect/Channel\",BG=()=>e=>e,zG=()=>e=>e,jG=()=>e=>e,qG=(e,t)=>(t=Jn(t),nf(go,t?.onEnd?Eo(So(e,t),r=>Fa(n=>t.onEnd(r,n))):So(e,t))),iF=e=>oc(go.context(e)),HG=function(){let e=typeof arguments[0]!=\"string\",t=e?arguments[1]:arguments[0],r=Jn(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return YI(de(r?.onEnd!==void 0?Eo(So(t,r),o=>Fa(s=>r.onEnd(o,s))):So(t,r),o=>XI(n,o,r)))}return n=>YI(de(r?.onEnd!==void 0?Eo(So(t,r),o=>Fa(s=>r.onEnd(o,s))):So(t,r),o=>XI(n,o,r)))},XI=function(){let e=Px(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=_;t._tag===\"Span\"&&(r=Jn(r),n=WG(t.name,r?.captureStackTrace));let o=iF(t);return e?rf(n(arguments[0]),o):s=>rf(n(s),o)},WG=(e,t)=>(t=typeof t==\"function\"?t:zr,aF(GP,r=>({name:e,stack:t,parent:r})));var cF=\"~effect/ExecutionPlan\";var JG={[cF]:cF,get captureRequirements(){let e=this;return Ma(t=>R(GG(e.steps.map(r=>({...r,while:r.while?n=>Io(r.while(n),t):void 0,provide:Px(r.provide)?rf(r.provide,oc(t)):r.provide})))))},pipe(){return K(this,arguments)}},GG=e=>{let t=Object.create(JG);return t.steps=e,t};var Nx=Ee(\"effect/ExecutionPlan/CurrentMetadata\",{defaultValue:$e({attempt:0,stepIndex:0})});var gf={};Ae(gf,{CurrentMetadata:()=>or,addDelay:()=>fK,concat:()=>lK,concatResult:()=>GF,cron:()=>mK,duration:()=>hK,during:()=>xK,exponential:()=>bK,fibonacci:()=>SK,fixed:()=>EK,forever:()=>xf,fromStep:()=>Rn,fromStepWithMetadata:()=>dc,identity:()=>vK,isSchedule:()=>Vx,jittered:()=>IK,map:()=>Vp,max:()=>pK,min:()=>gK,modifyDelay:()=>N0,once:()=>CK,passthrough:()=>Zx,recurs:()=>Qx,setInputType:()=>OK,spaced:()=>Yx,tap:()=>TK,toStep:()=>Xn,toStepWithMetadata:()=>eo,toStepWithSleep:()=>hf,upTo:()=>wK,while:()=>mc,windowed:()=>kK});var Fr={};Ae(Fr,{AsyncFiberError:()=>T3,AsyncFiberErrorTypeId:()=>E3,Done:()=>p0,DoneTypeId:()=>d3,ExceededCapacityError:()=>d0,ExceededCapacityErrorTypeId:()=>S3,IllegalArgumentError:()=>qp,IllegalArgumentErrorTypeId:()=>g3,InterruptorStackTrace:()=>o0,NoSuchElementError:()=>p3,NoSuchElementErrorTypeId:()=>l3,ReasonTypeId:()=>VG,StackTrace:()=>n0,TimeoutError:()=>x3,TimeoutErrorTypeId:()=>m3,TypeId:()=>KG,UnknownError:()=>C3,UnknownErrorTypeId:()=>w3,annotate:()=>A3,annotations:()=>O3,combine:()=>t3,die:()=>cc,done:()=>Z,empty:()=>YG,fail:()=>XG,filterInterruptors:()=>f0,findDefect:()=>jp,findDie:()=>s3,findError:()=>u0,findErrorOption:()=>n3,findFail:()=>r3,findInterrupt:()=>i3,fromReasons:()=>of,hasDies:()=>o3,hasFails:()=>c0,hasInterrupts:()=>a3,hasInterruptsOnly:()=>zp,interrupt:()=>e3,interruptors:()=>c3,isAsyncFiberError:()=>I3,isCause:()=>s0,isDieReason:()=>ZG,isDone:()=>af,isExceededCapacityError:()=>b3,isFailReason:()=>Bp,isIllegalArgumentError:()=>y3,isInterruptReason:()=>QG,isNoSuchElementError:()=>f3,isReason:()=>a0,isTimeoutError:()=>h3,isUnknownError:()=>k3,makeDieReason:()=>Lx,makeFailReason:()=>Dx,makeInterruptReason:()=>i0,map:()=>Ks,pretty:()=>l0,prettyErrors:()=>u3,reasonAnnotations:()=>v3,squash:()=>sf});var KG=Bl,VG=xu,s0=yu,a0=bO,Bp=Rs,ZG=_i,QG=Ri,of=_s,YG=ih,XG=Oi,cc=zS,e3=$s,Dx=e=>new ki(e),Lx=e=>new zl(e),i0=J_,zp=Q_,Ks=eR,t3=vi,sf=nx,c0=WE,r3=JE,u0=Kn,n3=G_,o3=ex,s3=K_,jp=Ip,a3=tx,i3=V_,c3=Z_,f0=rx,u3=GE,l0=Bs,f3=uh,l3=jl,p3=fo,af=Wl,d3=Ci,p0=Mi,Z=TO,m3=hp,h3=_P,x3=xp,g3=gp,y3=RP,qp=Yh,b3=MP,S3=yp,d0=Xh,E3=bp,I3=PP,T3=Sp,w3=Ep,k3=FP,C3=Bu,A3=bu,v3=Y_,O3=X_,n0=class extends vr()(\"effect/Cause/StackTrace\"){},o0=class extends vr()(\"effect/Cause/InterruptorStackTrace\"){};var P0={};Ae(P0,{CronParseError:()=>_n,Equivalence:()=>jF,equals:()=>qF,format:()=>G3,isCron:()=>Jx,isCronParseError:()=>W3,make:()=>BF,match:()=>V3,next:()=>Kx,parse:()=>Gx,parseUnsafe:()=>J3,prev:()=>Z3,sequence:()=>Q3});var $x=\"~effect/DateTime\",Bx=\"~effect/DateTime/TimeZone\",fF={[$x]:$x,pipe(){return K(this,arguments)},[Ie](){return this.toString()},toJSON(){return Zs(this).toJSON()}},_3={...fF,_tag:\"Utc\",[ae](){return Dt(this.epochMilliseconds)},[ie](e){return uc(e)&&e._tag===\"Utc\"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Zs(this).toJSON()})`}},R3={...fF,_tag:\"Zoned\",[ae](){return oe(Dt(this.epochMilliseconds))(H(this.zone))},[ie](e){return uc(e)&&e._tag===\"Zoned\"&&this.epochMilliseconds===e.epochMilliseconds&&J(this.zone,e.zone)},toString(){return`DateTime.Zoned(${C0(this)})`}},lF={[Bx]:Bx,[Ie](){return this.toString()}},M3={...lF,_tag:\"Named\",[ae](){return Ne(`Named:${this.id}`)},[ie](e){return Vs(e)&&e._tag===\"Named\"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:\"TimeZone\",_tag:\"Named\",id:this.id}}},P3={...lF,_tag:\"Offset\",[ae](){return Ne(`Offset:${this.offset}`)},[ie](e){return Vs(e)&&e._tag===\"Offset\"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${E0(this.offset)})`},toJSON(){return{_id:\"TimeZone\",_tag:\"Offset\",offset:this.offset}}},fs=(e,t,r)=>{let n=Object.create(R3);return n.epochMilliseconds=e,n.zone=t,Object.defineProperty(n,\"partsUtc\",{value:r,enumerable:!1,writable:!0}),Object.defineProperty(n,\"adjustedEpochMillis\",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(n,\"partsAdjusted\",{value:void 0,enumerable:!1,writable:!0}),n},uc=e=>k(e,$x),F3=e=>uc(e[0]),Vs=e=>k(e,Bx),pF=e=>Vs(e)&&e._tag===\"Offset\",jx=e=>Vs(e)&&e._tag===\"Named\",dF=e=>e._tag===\"Utc\",x0=e=>e._tag===\"Zoned\",mF=Bt((e,t)=>e.epochMilliseconds===t.epochMilliseconds);var g0=e=>{let t=Object.create(_3);return t.epochMilliseconds=e,Object.defineProperty(t,\"partsUtc\",{value:void 0,enumerable:!1,writable:!0}),t},cf=e=>{let t=e.getTime();if(Number.isNaN(t))throw new qp(\"Invalid date\");return g0(t)},qx=e=>{if(uc(e))return e;if(e instanceof Date)return cf(e);if(typeof e==\"object\"){if(\"epochMilliseconds\"in e)return cf(new Date(e.epochMilliseconds));let t=new Date(0);return j3(t,e),cf(t)}else if(typeof e==\"string\"&&!U3(e))return cf(new Date(e+\"Z\"));return cf(new Date(e))},U3=e=>/Z|GMT|[+-]\\d{2}$|[+-]\\d{2}:?\\d{2}$|\\]$/.test(e),N3=-864e13+720*60*1e3,D3=864e13-840*60*1e3,fc=(e,t)=>{let r=t?.timeZone;if(r===void 0&&uc(e)&&x0(e))return e;let n=qx(e);if(n.epochMilliseconds<N3||n.epochMilliseconds>D3)throw new RangeError(`Epoch millis out of range: ${n.epochMilliseconds}`);r===void 0&&typeof e==\"object\"&&\"timeZoneId\"in e&&(r=e.timeZoneId);let o;if(r===void 0){let s=new Date(n.epochMilliseconds).getTimezoneOffset()*-60*1e3;o=Wp(s)}else if(Vs(r))o=r;else if(typeof r==\"number\")o=Wp(r);else{let s=Jp(r);if(fe(s))throw new qp(`Invalid time zone: ${r}`);o=s.value}return t?.adjustForTimeZone!==!0?fs(n.epochMilliseconds,o,n.partsUtc):IF(n.epochMilliseconds,o,t?.disambiguation??\"compatible\")},m0=mo(fc),hF=mo(qx),L3=/^(.{17,35})\\[(.+)\\]$/,xF=e=>{let t=L3.exec(e);if(t===null){let o=w0(e);return o!==null?m0(e,{timeZone:o}):v()}let[,r,n]=t;return m0(r,{timeZone:n})};var gF=e=>g0(e.epochMilliseconds);var zx=new Map,$3={day:\"numeric\",month:\"numeric\",year:\"numeric\",hour:\"numeric\",minute:\"numeric\",second:\"numeric\",timeZoneName:\"longOffset\",fractionalSecondDigits:3,hourCycle:\"h23\"},B3=e=>{let t=e.resolvedOptions().timeZone,r=zx.get(t);if(r!==void 0)return r;let n=Object.create(M3);return n.id=t,n.format=e,zx.set(t,n),n},y0=e=>{let t=zx.get(e);if(t!==void 0)return t;try{let r=B3(new Intl.DateTimeFormat(\"en-US\",{...$3,timeZone:e}));return zx.set(e,r),r}catch{throw new qp(`Invalid time zone: ${e}`)}},Wp=e=>{let t=Object.create(P3);return t.offset=e,t},b0=mo(y0);var z3=/^(?:GMT|[+-])/,Jp=e=>{if(z3.test(e)){let t=w0(e);return t===null?v():O(Wp(t))}return b0(e)},yF=e=>e._tag===\"Offset\"?E0(e.offset):e.id;var Zs=e=>new Date(e.epochMilliseconds),La=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(n=>n.type!==\"literal\"),r=new Date(0);return r.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),r.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),t[6]?.type===\"fractionalSecond\"?Number(t[6].value):(e.epochMilliseconds%1e3+1e3)%1e3),e.adjustedEpochMilliseconds=r.getTime(),r},S0=e=>La(e).getTime()-I0(e),E0=e=>{let t=Math.abs(e),r=Math.floor(t/(3600*1e3)),n=Math.round(t%(3600*1e3)/(60*1e3));return n===60&&(r+=1,n=0),`${e<0?\"-\":\"+\"}${String(r).padStart(2,\"0\")}:${String(n).padStart(2,\"0\")}`},bF=e=>E0(S0(e)),I0=e=>e.epochMilliseconds;var SF=e=>({millisecond:e.getUTCMilliseconds(),second:e.getUTCSeconds(),minute:e.getUTCMinutes(),hour:e.getUTCHours(),day:e.getUTCDate(),weekDay:e.getUTCDay(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}),T0=e=>e._tag===\"Utc\"?EF(e):(e.partsAdjusted!==void 0||(e.partsAdjusted=TF(e,SF)),e.partsAdjusted),EF=e=>(e.partsUtc!==void 0||(e.partsUtc=wF(e,SF)),e.partsUtc);var j3=(e,t)=>{if((t.year!==void 0||t.month!==void 0||t.day!==void 0)&&e.setUTCFullYear(t.year??e.getUTCFullYear(),t.month!==void 0?t.month-1:e.getUTCMonth(),t.day??e.getUTCDate()),t.weekDay!==void 0){let r=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+r)}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)};var uF=1440*60*1e3,IF=(e,t,r)=>{if(t._tag===\"Offset\")return fs(e-t.offset,t);let n=Hp(e-uF,e,t),o=Hp(e+uF,e,t);if(n===o)return fs(e-n,t);let s=n<o,a=n-o;if(s){if(Hp(e-o,e,t)===o)return fs(e-o,t);let u=fs(e-n,t),l=La(u).getTime();if(e!==l)switch(r){case\"reject\":{let p=new Date(e).toISOString();throw new RangeError(`Gap time: ${p} does not exist in time zone ${t.id}`)}case\"earlier\":return fs(e-o,t);case\"compatible\":case\"later\":return u}return u}if(Hp(e-n,e,t)===n){if(r===\"earlier\"||r===\"compatible\"||Hp(e-n+a,e+a,t)===n)return fs(e-n,t);if(r===\"reject\"){let u=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return fs(e-o,t)},q3=/([+-])(\\d{2}):(\\d{2})$/,w0=e=>{let t=q3.exec(e);if(t===null)return null;let[,r,n,o]=t;return(r===\"+\"?1:-1)*(Number(n)*60+Number(o))*60*1e3},Hp=(e,t,r)=>{let n=r.format.formatToParts(e).find(s=>s.type===\"timeZoneName\")?.value??\"\";if(n===\"GMT\")return 0;let o=w0(n);return o===null?S0(fs(t,r)):o},k0=f(F3,(e,t,r)=>{if(e._tag===\"Utc\"){let s=Zs(e);return t(s),g0(s.getTime())}let n=La(e),o=new Date(n.getTime());return t(o),IF(o.getTime(),e.zone,r?.disambiguation??\"compatible\")});var TF=f(2,(e,t)=>t(La(e))),wF=f(2,(e,t)=>t(Zs(e)));var kF=e=>Zs(e).toISOString();var h0=e=>{let t=La(e);return e._tag===\"Utc\"?t.toISOString():`${t.toISOString().slice(0,-1)}${bF(e)}`},C0=e=>e.zone._tag===\"Offset\"?h0(e):`${h0(e)}[${e.zone.id}]`;var AF=globalThis.Number;var OF=jr;var _F=f(2,(e,t)=>{if(!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0)return NaN;if(globalThis.Number.isInteger(e)&&globalThis.Number.isInteger(t))return e%t;let[r,n]=vF(e),[o,s]=vF(t),a=Math.min(n,s),i=r*BigInt(10)**BigInt(n-a),c=o*BigInt(10)**BigInt(s-a),u=i%c;if(u===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let l=globalThis.Number(`${u}e${a}`);return l===0?Math.sign(e)*globalThis.Number.MIN_VALUE:l});function vF(e){if(globalThis.Number.isInteger(e))return[BigInt(e),0];let t=Math.abs(e).toExponential(),r=t.indexOf(\"e\"),n=t.slice(0,r).replace(\".\",\"\");return[BigInt(n)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(r+1))-n.length+1]}var RF=e=>{let t=Math.ceil(Math.log(e)/Math.log(2));return Math.max(Math.pow(2,t),2)},lue=e=>{if(e===\"NaN\")return O(NaN);if(e===\"Infinity\")return O(1/0);if(e===\"-Infinity\")return O(-1/0);if(e.trim()===\"\")return v();let t=AF(e);return AF.isNaN(t)?v():O(t)};var pue=globalThis.String,Hx=ur,A0=xh;var v0=e=>e.toUpperCase(),Gp=e=>e.toLowerCase(),PF=e=>e.length===0?e:v0(e[0])+e.slice(1),FF=e=>e.length===0?e:Gp(e[0])+e.slice(1);var UF=e=>e.trim();var NF=e=>e.length>0;var DF=e=>{if(e.length===0)return e;let t=e[0];for(let r=1;r<e.length;r++)t+=e[r]===\"_\"?e[++r].toUpperCase():e[r];return t};var LF=e=>e.replace(/([A-Z])/g,\"_$1\").toLowerCase();var R0=\"~effect/Cron\";function O0(e){return{tz:e.tz,and:e.and,seconds:Se(e.seconds),minutes:Se(e.minutes),hours:Se(e.hours),days:Se(e.days),months:Se(e.months),weekdays:Se(e.weekdays)}}var H3={[R0]:R0,[ie](e){return Jx(e)&&qF(this,e)},[ae](){return Rl(H(this.tz),oe(H(this.and)),oe(xr(Se(this.seconds))),oe(xr(Se(this.minutes))),oe(xr(Se(this.hours))),oe(xr(Se(this.days))),oe(xr(Se(this.months))),oe(xr(Se(this.weekdays))))},toObject(){return O0(this)},toString(){return`Cron(${L(O0(this))})`},toJSON(){let e=O0(this);return e._id=\"Cron\",e},[Ie](){return this.toJSON()},pipe(){return K(this,arguments)}},Jx=e=>k(e,R0),BF=e=>{let t=Object.create(H3);t.seconds=ff.seconds(e.seconds??[0]),t.minutes=ff.minutes(e.minutes),t.hours=ff.hours(e.hours),t.days=ff.days(e.days),t.months=ff.months(e.months),t.weekdays=ff.weekdays(e.weekdays),t.and=e.and===!0,t.tz=Ns(e.tz);let r=Array.from(t.seconds),n=Array.from(t.minutes),o=Array.from(t.hours),s=Array.from(t.days),a=Array.from(t.months),i=Array.from(t.weekdays);return t.first={second:r[0]??0,minute:n[0]??0,hour:o[0]??0,day:s[0]??1,month:(a[0]??1)-1,weekday:i[0]??0},t.last={second:r[r.length-1]??59,minute:n[n.length-1]??59,hour:o[o.length-1]??23,day:s[s.length-1]??31,month:(a[a.length-1]??12)-1,weekday:i[i.length-1]??6},t.next={second:Yn.next.second(r),minute:Yn.next.minute(n),hour:Yn.next.hour(o),day:Yn.next.day(s),month:Yn.next.month(a),weekday:Yn.next.weekday(i)},t.prev={second:Yn.prev.second(r),minute:Yn.prev.minute(n),hour:Yn.prev.hour(o),day:Yn.prev.day(s),month:Yn.prev.month(a),weekday:Yn.prev.weekday(i)},t},uf=(e,t,r,n=o=>o)=>o=>{let s=[];for(let a of o){if(!Number.isInteger(a)||a<t||a>r)throw new RangeError(`${e} must contain only integers between ${t} and ${r}`);s.push(n(a))}return new Set($i(s,OF))},ff={seconds:uf(\"seconds\",0,59),minutes:uf(\"minutes\",0,59),hours:uf(\"hours\",0,23),days:uf(\"days\",1,31),months:uf(\"months\",1,12),weekdays:uf(\"weekdays\",0,7,e=>e===7?0:e)},Qn=(e,t)=>r=>{let n=new Array(e).fill(void 0);if(r.length===0)return n;let o;if(t===\"next\"){let s=r.length-1;for(let a=e-1;a>=0;a--){for(;s>=0&&r[s]>=a;)o=r[s--];n[a]=o}}else{let s=0;for(let a=0;a<e;a++){for(;s<r.length&&r[s]<=a;)o=r[s++];n[a]=o}}return n},Yn={prev:{second:Qn(60,\"prev\"),minute:Qn(60,\"prev\"),hour:Qn(24,\"prev\"),day:Qn(32,\"prev\"),month:Qn(13,\"prev\"),weekday:Qn(7,\"prev\")},next:{second:Qn(60,\"next\"),minute:Qn(60,\"next\"),hour:Qn(24,\"next\"),day:Qn(32,\"next\"),month:Qn(13,\"next\"),weekday:Qn(7,\"next\")}},M0=\"~effect/Cron/CronParseError\",_n=class extends rn(\"CronParseError\"){[M0]=M0},W3=e=>k(e,M0),Gx=(e,t)=>{let r=e.trim().split(/\\s+/).filter(NF);if(r.length!==5&&r.length!==6)return D(new _n({message:\"Invalid number of segments in cron expression\",input:e}));r.length===5&&r.unshift(\"0\");let[n,o,s,a,i,c]=r,u=t===void 0||Vs(t)?P(t):fE(Jp(t),()=>new _n({message:\"Invalid time zone in cron expression\",input:t}));return Pu({tz:u,seconds:pf(n,X3),minutes:pf(o,eK),hours:pf(s,tK),days:pf(a,rK),months:pf(i,nK),weekdays:pf(c,oK)}).pipe(mt(({tz:l,seconds:p,minutes:d,hours:m,days:x,months:g,weekdays:y})=>BF({tz:l,seconds:p.values,minutes:d.values,hours:m.values,days:x.values,months:g.values,weekdays:y.values,and:(x.wildcard||y.wildcard)&&x.values.size!==0&&y.values.size!==0})))},J3=(e,t)=>Ds(Gx(e,t)),G3=(e,t)=>{let r=[e.seconds,e.minutes,e.hours,e.days,e.months,e.weekdays].map(K3);return(t?.includeSeconds!==!0&&e.seconds.size===1&&e.seconds.has(0)?r.slice(1):r).join(\" \")},K3=e=>{if(e.size===0)return\"*\";let t=Array.from(e),r=[],n=0;for(;n<t.length;){let o=t[n],s=t[n+1]-o;if(n+2<t.length&&t[n+2]-t[n+1]===s){let a=n+2;for(;a+1<t.length&&t[a+1]-t[a]===s;)a++;r.push(`${o}-${t[a]}${s===1?\"\":`/${s}`}`),n=a+1}else r.push(`${o}`),n++}return r.join(\",\")},V3=(e,t)=>{let r=fc(t,{timeZone:po(e.tz)}).pipe(T0);return e.seconds.size!==0&&!e.seconds.has(r.second)||e.minutes.size!==0&&!e.minutes.has(r.minute)||e.hours.size!==0&&!e.hours.has(r.hour)||e.months.size!==0&&!e.months.has(r.month)?!1:e.days.size===0&&e.weekdays.size===0?!0:e.and?(e.days.size===0||e.days.has(r.day))&&(e.weekdays.size===0||e.weekdays.has(r.weekDay)):e.weekdays.size===0?e.days.has(r.day):e.days.size===0?e.weekdays.has(r.weekDay):e.days.has(r.day)||e.weekdays.has(r.weekDay)},Wx=e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0)).getUTCDate(),Kx=(e,t)=>zF(e,t,\"next\"),Z3=(e,t)=>zF(e,t,\"prev\"),zF=(e,t,r)=>{let n=po(e.tz),o=fc(t??new Date,{timeZone:n}),s=r===\"prev\",a=s?-1:1,i=e[r],c=s?e.last:e.first,u=s?(m,x)=>m<x:(m,x)=>m>x,p=n!==void 0&&jx(n)&&n.id===\"UTC\"?wr:m=>{let x=fc(m,{timeZone:o.zone,adjustForTimeZone:!0,disambiguation:s?\"later\":void 0}).pipe(La),g=m.getTime()-x.getTime();(s?g!==0:g>0)&&m.setTime(s?x.getTime():m.getTime()+g)},d=k0(o,m=>{m.setUTCSeconds(m.getUTCSeconds()+a,0);for(let x=0;x<1e4;x++){if(e.seconds.size!==0){let g=m.getUTCSeconds(),y=i.second[g];if(y===void 0){m.setUTCMinutes(m.getUTCMinutes()+a,c.second),p(m);continue}if(u(y,g)){m.setUTCSeconds(y),p(m);continue}}if(e.minutes.size!==0){let g=m.getUTCMinutes(),y=i.minute[g];if(y===void 0){m.setUTCHours(m.getUTCHours()+a,c.minute,c.second),p(m);continue}if(u(y,g)){m.setUTCMinutes(y,c.second),p(m);continue}}if(e.hours.size!==0){let g=m.getUTCHours(),y=i.hour[g];if(y===void 0){m.setUTCDate(m.getUTCDate()+a),m.setUTCHours(c.hour,c.minute,c.second),p(m);continue}if(u(y,g)){m.setUTCHours(y,c.minute,c.second),p(m);continue}}if(e.weekdays.size!==0||e.days.size!==0)if(e.and){let g=e.days.size===0||e.days.has(m.getUTCDate()),y=e.weekdays.size===0||e.weekdays.has(m.getUTCDay());if(!g||!y){m.setUTCDate(m.getUTCDate()+a),m.setUTCHours(c.hour,c.minute,c.second),p(m);continue}}else{let g=s?-1/0:1/0,y=s?-1/0:1/0;if(e.weekdays.size!==0){let E=m.getUTCDay(),U=i.weekday[E];U===void 0?g=s?c.weekday-7-E:7-E+c.weekday:g=U-E}if(e.days.size!==0&&g!==0){let E=m.getUTCDate(),U=i.day[E];if(U===void 0)if(s){let F=new Date(m);F.setUTCDate(0);let h=i.day[F.getUTCDate()];if(h===void 0&&(F.setUTCDate(0),h=i.day[F.getUTCDate()]),h===void 0)throw new Error(\"Unable to find cron date\");F.setUTCDate(h),y=(F.getTime()-m.getTime())/864e5}else y=Wx(m)-E+c.day;else!s&&U>Wx(m)?y=Wx(m)-E+c.day:y=U-E}let S=s?Math.max(g,y):Math.min(g,y);if(S!==0){m.setUTCDate(m.getUTCDate()+S),m.setUTCHours(c.hour,c.minute,c.second),p(m);continue}}if(e.months.size!==0){let g=m.getUTCMonth()+1,y=i.month[g],S=E=>{let U=Wx(new Date(Date.UTC(m.getUTCFullYear(),E+1,0)));return e.days.size!==0&&e.weekdays.size===0?s?i.day[U]??U:c.day:s?U:1};if(y===void 0){m.setUTCFullYear(m.getUTCFullYear()+a),m.setUTCMonth(c.month,S(c.month)),m.setUTCHours(c.hour,c.minute,c.second),p(m);continue}if(u(y,g)){let E=y-1;m.setUTCMonth(E,S(E)),m.setUTCHours(c.hour,c.minute,c.second),p(m);continue}}return}throw new Error(\"Unable to find cron date\")});return Zs(d)},Q3=function*(e,t){for(;;)yield t=Kx(e,t)},jF=Bt((e,t)=>J(e.tz,t.tz)&&e.and===t.and&&lf(e.seconds,t.seconds)&&lf(e.minutes,t.minutes)&&lf(e.hours,t.hours)&&lf(e.days,t.days)&&lf(e.months,t.months)&&lf(e.weekdays,t.weekdays)),Y3=Su(Ps()),lf=(e,t)=>Y3(Se(e),Se(t)),qF=f(2,(e,t)=>jF(e,t)),X3={min:0,max:59},eK={min:0,max:59},tK={min:0,max:23},rK={min:1,max:31},nK={min:1,max:12,aliases:{jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12}},oK={min:0,max:7,normalize:e=>e===7?0:e,aliases:{sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6}},pf=(e,t)=>{let r=new Set,n=e.split(\",\"),o=$F(n[0]),s=o[0]===\"*\",a=t.normalize??(c=>c),i=s&&(o[1]===void 0||o[1]===1)?wr:c=>{r.add(a(c))};for(let c=0;c<n.length;c++){let u=n[c],[l,p]=c===0?o:$F(u);if(p!==void 0){if(!Number.isInteger(p))return D(new _n({message:\"Expected step value to be a positive integer\",input:e}));if(p<1)return D(new _n({message:\"Expected step value to be greater than 0\",input:e}));if(p>t.max)return D(new _n({message:`Expected step value to be less than or equal to ${t.max}`,input:e}))}if(l===\"*\"){if(c===0&&(p===void 0||p===1))continue;for(let d=t.min;d<=t.max;d+=p??1)i(d)}else{let[d,m]=sK(l,t.aliases);if(!Number.isInteger(d))return D(new _n({message:\"Expected a positive integer\",input:e}));if(d<t.min||d>t.max)return D(new _n({message:`Expected a value between ${t.min} and ${t.max}`,input:e}));if(m===void 0)for(let x=d;x<=(p===void 0?d:t.max);x+=p??1)i(x);else{if(!Number.isInteger(m))return D(new _n({message:\"Expected a positive integer\",input:e}));if(m<t.min||m>t.max)return D(new _n({message:`Expected a value between ${t.min} and ${t.max}`,input:e}));if(d>m)return D(new _n({message:\"Invalid value range\",input:e}));for(let x=d;x<=m;x+=p??1)i(x)}}}return P({values:r,wildcard:s})},$F=e=>{let t=e.indexOf(\"/\");if(t!==-1){let r=e.slice(t+1);return[e.slice(0,t),HF.test(r)?Number(r):NaN]}return[e,void 0]},sK=(e,t)=>{let r=e.indexOf(\"-\");return r!==-1?[_0(e.slice(0,r),t),_0(e.slice(r+1),t)]:[_0(e,t),void 0]};function _0(e,t){return t?.[Gp(e)]??(HF.test(e)?Number(e):NaN)}var HF=/^\\d+$/;var WF=Ee(\"effect/Random\",{defaultValue:()=>({nextIntUnsafe(){return Math.floor(Math.random()*(Number.MAX_SAFE_INTEGER-Number.MIN_SAFE_INTEGER+1))+Number.MIN_SAFE_INTEGER},nextDoubleUnsafe(){return Math.random()}})});var Xe=f(2,(e,t)=>Gu(e,iK,r=>t(r))),ls=e=>e.reasons.some(F0),F0=e=>e._tag===\"Fail\"&&af(e.error),df=e=>{let t,r=!1;for(let n of e.reasons)F0(n)?t??=n.error:n._tag!==\"Interrupt\"&&(r=!0);return t===void 0?D(e):r?D(of(e.reasons.filter(n=>!F0(n)))):P(t)};var iK=e=>{let t=df(e);return Q(t)?t:P(t.success.value)},U0=e=>{let t=df(e);return Q(t)?sn(t.failure):Rr(t.success.value)},lc=f(2,(e,t)=>bo(e,{onSuccess:t.onSuccess,onFailure:r=>{let n=df(r);return Q(n)?t.onFailure(n.failure):t.onDone(n.success.value)}}));var JF=\"~effect/Schedule\",cK=WF.useSync(e=>e.nextDoubleUnsafe()),or=Ee(\"effect/Schedule/CurrentMetadata\",{defaultValue:$e({input:void 0,output:void 0,duration:Ge,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),uK={[JF]:{_Out:_,_In:_,_Env:_},pipe(){return K(this,arguments)}},Vx=e=>k(e,JF),Rn=e=>{let t=Object.create(uK);return t.step=e,t},mf=()=>{let e=0,t,r;return(n,o)=>{r===void 0&&(r=n);let s=n-r,a=t===void 0?0:n-t;return t=n,{input:o,attempt:++e,start:r,now:n,elapsed:s,elapsedSincePrevious:a}}},dc=e=>Rn(de(e,t=>{let r=mf();return(n,o)=>t(r(n,o))})),Xn=e=>Hr(e.step,t=>R(()=>Re(t))),eo=e=>nn(t=>de(Xn(e),r=>{let n=mf();return o=>W(()=>{let s=t.currentTimeMillisUnsafe();return $(r(s,o),([a,i])=>{let c=n(s,o);return c.output=a,c.duration=i,Vt(Ua(i),c)})})})),hf=e=>de(eo(e),t=>r=>de(t(r),n=>n.output)),fK=f(2,(e,t)=>N0(e,r=>de(t(r),n=>Uh(ye(n),r.duration)))),lK=f(2,(e,t)=>Vp(GF(e,t),({output:r})=>R(lE(r)))),GF=f(2,(e,t)=>Rn(V(()=>{let r=0,n,o=Vp(e,({output:a})=>D(a)),s=Vp(t,({output:a})=>P(a));return function a(i,c){return n?n(i,c):Xn(r===0?o:s).pipe($(u=>(r++,r===1?(n=(l,p)=>Xe(u(l,p),d=>(n=void 0,a(l,p))),n(i,c)):(n=u,n(i,c)))))}}))),pK=e=>Rn(de(Yi(e.map(Xn)),t=>(r,n)=>$(qr(t,o=>lc(o(r,n),{onSuccess:s=>R(s[1]),onDone:()=>Pp,onFailure:Re})),o=>{let s=dK(o);return s===void 0?Z(Ge):R([s,s])}))),dK=e=>{let t=e[0];for(let r=1;r<e.length&&(t=e[r]&&t&&TE(t,e[r]),t!==void 0);r++);return t},mK=(e,t)=>{let r=Jx(e)?P(e):Gx(e,t);return Rn(de(Gi(r),n=>(o,s)=>o===Number.POSITIVE_INFINITY?Z(Ge):V(()=>{let a=Kx(n,o).getTime(),i=Kt(a-o);return[i,i]})))},hK=e=>{let t=ye(e);return dc(R(r=>r.attempt===1?R([t,t]):Z(Ge)))},xK=e=>{let t=et(e);return dc(R(r=>{let n=Kt(r.elapsed);return r.elapsed>t?Z(n):R([n,Ge])}))},gK=e=>Rn(de(Yi(e.map(Xn)),t=>(r,n)=>$(qr(t,o=>lc(o(r,n),{onSuccess:s=>R(s[1]),onDone:()=>Pp,onFailure:Re})),o=>{let s=yK(o);return s===void 0?Z(Ge):R([s,s])}))),yK=e=>{let t;for(let r=0;r<e.length;r++){let n=e[r];n!==void 0&&(t=t===void 0?n:IE(t,n))}return t},bK=(e,t=2)=>{let r=et(ye(e));return dc(R(n=>{let o=Kt(r*Math.pow(t,n.attempt-1));return R([o,o])}))},SK=e=>{let t=et(ye(e));return Rn(V(()=>{let r=0,n=t;return $e(V(()=>{let o=r+n;r=n,n=o;let s=Kt(o);return[s,s]}))}))},EK=e=>{let t=et(ye(e));return dc(V(()=>{let r=0,n=0;return o=>V(()=>{if(t===0)return[o.attempt-1,Ge];if(o.attempt===1)return r=o.now,n=o.now+t,[0,Kt(t)];let s=o.now>n+t,a=t-(o.now-r)%t,i=s?0:a===0?t:a;return n=s?o.now:o.now+i,[o.attempt-1,Kt(i)]})}))},Vp=f(2,(e,t)=>Rn(de(Xn(e),r=>{let n=mf();return(o,s)=>lc(r(o,s),{onSuccess:([a,i])=>{let c=t({...n(o,s),output:a,duration:i});return ue(c)?de(c,u=>[u,i]):R([c,i])},onFailure:Re,onDone:a=>{let i=t({...n(o,s),output:a,duration:Ge});return ue(i)?$(i,Z):Z(i)}})}))),N0=f(2,(e,t)=>Rn(de(Xn(e),r=>{let n=mf();return(o,s)=>$(r(o,s),([a,i])=>de(t({...n(o,s),output:a,duration:i}),c=>[a,ye(c)]))}))),IK=e=>N0(e,({duration:t})=>de(cK,r=>{let n=et(t);return Kt(n*.8*(1-r)+n*1.2*r)})),Zx=e=>Rn(de(Xn(e),t=>(r,n)=>lc(t(r,n),{onSuccess:o=>R([n,o[1]]),onFailure:Re,onDone:()=>Z(n)}))),Qx=e=>mc(xf,({attempt:t})=>R(t<=e)),Yx=e=>{let t=ye(e);return dc(R(r=>R([r.attempt-1,t])))},TK=f(2,(e,t)=>Rn(de(Xn(e),r=>{let n=mf();return(o,s)=>Eo(r(o,s),([a,i])=>t({...n(o,s),output:a,duration:i}))}))),wK=f(2,(e,t)=>{let r=t.duration===void 0?void 0:ye(t.duration);return mc(e,({attempt:n,elapsed:o})=>R((t.times===void 0||n<=t.times)&&(r===void 0||kE(Kt(o),r))))}),mc=f(2,(e,t)=>Rn(de(Xn(e),r=>{let n=mf();return(o,s)=>$(r(o,s),a=>{let[i,c]=a,u=t({...n(o,s),output:i,duration:c});return $(ue(u)?u:R(u),l=>l?R(a):Z(i))})})));var kK=e=>{let t=et(ye(e));return dc(R(r=>V(()=>[r.attempt-1,t===0?Ge:Kt(t-r.elapsed%t)])))},xf=Yx(Ge),CK=Vp(Qx(1),()=>{}),AK=Rn(R((e,t)=>R([t,Ge]))),vK=()=>AK;var OK=()=>e=>e;var _K=(e,t,r)=>bx(n=>$(r?.local?ac(t,Da(),n):Lp(t,n),o=>Io(e,o))),Xx=f(e=>ue(e[0]),(e,t,r)=>Ou(t)?Io(e,t):_K(e,Array.isArray(t)?Ux(...t):t,r));var D0=f(3,(e,t,r)=>$(eo(t),n=>{let o=or.defaultValue();return Wr(Ju(Eo($(W(()=>Sr(e,or,o)),n),s=>V(()=>{o=s})),{disableYield:!0}),s=>Wl(s)?R(s.value):r(s,o.attempt===0?v():O(o)))})),L0=f(3,(e,t,r)=>$(eo(t),n=>{let o=or.defaultValue(),s,a=Wr(W(()=>Sr(e,or,o)),i=>(s=i,$(n(i),c=>(o=c,a))));return Xe(a,i=>Ea(()=>r(s,i)))})),VF=f(2,(e,t)=>{let r=typeof t==\"function\"?t(_):Vx(t)?t:Qp(t);return D0(e,r,Ye)}),Zp=f(2,(e,t)=>{let r=typeof t==\"function\"?t(_):Vx(t)?t:Qp(t);return L0(e,r,Ye)}),ZF=f(3,(e,t,r)=>$(eo(r),n=>{let o=or.defaultValue(),s=W(()=>Sr(e,or,o));return Wr($(n(t),a=>{o=a;let i=$e($(s,n));return wo({while:hr,body:i,step(c){o=c}})}),a=>Wl(a)?R(a.value):Ye(a))})),RK=Zx(xf),Qp=e=>{let t=e.schedule?Zx(e.schedule):RK;return e.while&&(t=mc(t,({input:r})=>{let n=e.while(r);return ue(n)?n:R(n)})),e.until&&(t=mc(t,({input:r})=>{let n=e.until(r);return ue(n)?de(n,o=>!o):R(!n)})),e.times!==void 0&&(t=mc(t,({attempt:r})=>R(r<=e.times))),t};var $0=(e,t)=>{let r=-1,n=0,o=s=>mx(e(s));return{begin:nn(s=>W(()=>{let a=t();a.stepIndex!==r&&(r=a.stepIndex,n=0),n++;let i={attempt:a.attempt,stepAttempt:n,stepIndex:a.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return Vt(o({_tag:\"AttemptStart\",attempt:i.attempt,stepAttempt:i.stepAttempt,stepIndex:i.stepIndex}),i)})),end:(s,a)=>nn(i=>{let c=Cn(i.monotonicTimeNanosUnsafe()-s.startNanos);return o(a._tag===\"Success\"?{_tag:\"AttemptSuccess\",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c}:{_tag:\"AttemptFailure\",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c,cause:a.cause})})}},YF=f(e=>ue(e[0]),(e,t,r)=>W(()=>{let n=0,o={attempt:0,stepIndex:0},s=cx(Nx,V(()=>(o={attempt:o.attempt+1,stepIndex:n},o))),a=r?.onEvent===void 0?void 0:$0(r.onEvent,()=>o),i=a===void 0?_:u=>Jr(l=>$(a.begin,p=>vn(l(u),d=>a.end(p,d)))),c;return $(wo({while:()=>n<t.steps.length&&(c===void 0||Q(c)),body(){let u=t.steps[n],l=s(i(Xx(e,u.provide)));if(c){let p=!1,d=l;l=W(()=>p?d:(p=!0,Gi(c))),l=Zp(l,Yp(u,!1))}else{let p=Yp(u,!0);l=p?Zp(l,p):l}return Ra(l)},step(u){c=u,n++}}),()=>Gi(c))})),Yp=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return Qp({schedule:e.schedule?e.schedule:e.attempts?void 0:MK,times:e.attempts,while:e.while});return Qp({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},MK=Qx(1);var PK=\"~effect/Request\",FK=fO({_E:e=>e,_A:e=>e,_R:e=>e}),Oue={...yO,[PK]:FK};var eU=e=>e;var rU=f(2,(e,t)=>{let r=n=>Et(o=>{let s=oU(n,e,o,zs());return NK(n,s)});return ue(t)?$(t,r):r(t)}),nU=(e,t)=>{let r=oU(t.resolver,e,t.onExit,{context:t.context,cache:{scheduler:Te(t.context,Mu)}});return()=>sU(t.resolver,r)},eg=[],B0=new WeakMap,oU=(e,t,r,n)=>{let o=B0.get(e);o||(o=new Map,B0.set(e,o));let s,a=!1,i=eU({request:t,context:n.context,uninterruptible:!1,completeUnsafe(u){a||(a=!0,!(s&&!s.entrySet.delete(i))&&r(u))}});if(e.preCheck!==void 0&&!e.preCheck(i))return i;let c=e.batchKey(i);if(s=o.get(c),!s){if(eg.length>0)s=eg.pop(),s.key=c,s.resolver=e,s.map=o;else{let u={key:c,resolver:e,map:o,entrySet:new Set,entries:new Set,delayEffect:$(W(()=>u.resolver.delay),l=>tU(u)),run:vn(W(()=>u.resolver.runAll(Array.from(u.entries),u.key)),l=>{for(let p of u.entrySet)p.completeUnsafe(l._tag===\"Success\"?Ar(new Error(\"Effect.request: RequestResolver did not complete request\",{cause:p.request})):l);return u.entries.clear(),eg.length<128&&(u.entrySet.clear(),u.key=void 0,u.fiber=void 0,u.resolver=void 0,u.map=void 0,eg.push(u)),le})};s=u}o.set(c,s),s.fiber=Js(n.context)(s.delayEffect,{scheduler:n.cache.scheduler})}return s.entrySet.add(i),s.entries.add(i),s.resolver.collectWhile(s.entries)||(s.fiber.interruptUnsafe(n.id),s.fiber=Js(n.context)(tU(s),{scheduler:n.cache.scheduler})),i},sU=(e,t)=>{if(t.uninterruptible)return;let r=B0.get(e);if(!r)return;let n=e.batchKey(t),o=r.get(n);if(!o||!o.entries.delete(t))return;o.entrySet.delete(t);let s;o.entries.size===0&&(r.delete(n),s=o.fiber),t.completeUnsafe(Hu()),s?.interruptUnsafe()},NK=(e,t)=>V(()=>sU(e,t));function tU(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):le}var Z0={};Ae(Z0,{CurrentMetricAttributes:()=>tg,CurrentMetricAttributesKey:()=>cU,FiberRuntimeMetrics:()=>ed,FiberRuntimeMetricsImpl:()=>V0,FiberRuntimeMetricsKey:()=>s4,MetricRegistry:()=>J0,boundariesFromIterable:()=>K0,counter:()=>sg,disableRuntimeMetrics:()=>u4,disableRuntimeMetricsLayer:()=>i4,dump:()=>VK,enableRuntimeMetrics:()=>c4,enableRuntimeMetricsLayer:()=>a4,exponentialBoundaries:()=>pU,frequency:()=>BK,gauge:()=>uU,histogram:()=>zK,isMetric:()=>$K,linearBoundaries:()=>t4,mapInput:()=>ag,modify:()=>WK,snapshot:()=>KK,snapshotUnsafe:()=>G0,summary:()=>jK,summaryWithTimestamp:()=>fU,timer:()=>qK,update:()=>xc,value:()=>HK,withAttributes:()=>GK,withConstantInput:()=>JK});var cU=\"effect/Metric/CurrentMetricAttributes\",tg=Ee(cU,{defaultValue:()=>({})}),LK=\"effect/Metric/MetricRegistry\",J0=Ee(LK,{defaultValue:()=>new Map}),Xp=\"~effect/Metric\",$a=class{[Xp]=Xp;#e;#t=\"\";id;description;attributes;constructor(t,r,n){this.id=t,this.description=r,this.attributes=n}valueUnsafe(t){return this.hook(t).get(t)}modifyUnsafe(t,r){return this.hook(r).modify(t,r)}updateUnsafe(t,r){return this.hook(r).update(t,r)}hook(t){let r=Te(t,tg);r!==this.#e&&(this.#e=r,this.#t=f4(this,og(this.attributes,r)));let n=Te(t,J0),o=n.get(this.#t);return Nl(o)&&(o={id:this.id,type:this.type,description:this.description,attributes:Object.keys(r).length>0?og(this.attributes,r):this.attributes,hooks:this.createHooks()},n.set(this.#t,o)),o.hooks}pipe(){return K(this,arguments)}},aU=BigInt(0),j0=class extends $a{type=\"Counter\";#e;#t;constructor(t,r){super(t,r?.description,hc(r?.attributes)),this.#e=r?.bigint??!1,this.#t=r?.incremental??!1}createHooks(){let t=this.#e?aU:0,r=this.#t?this.#e?o=>o>=aU:o=>o>=0:o=>!0;return td(()=>({count:t,incremental:this.#t}),o=>{r(o)&&(t=t+o)})}},q0=class extends $a{type=\"Gauge\";#e;constructor(t,r){super(t,r?.description,hc(r?.attributes)),this.#e=r?.bigint??!1}createHooks(){let t=this.#e?BigInt(0):0;return td(()=>({value:t}),o=>{t=o},o=>{t=t+o})}},H0=class extends $a{type=\"Frequency\";#e;constructor(t,r){super(t,r?.description,hc(r?.attributes)),this.#e=r?.preregisteredWords}createHooks(){let t=new Map;if(kr(this.#e))for(let n of this.#e)t.set(n,0);return td(()=>({occurrences:t}),n=>{let o=t.get(n)??0;t.set(n,o+1)})}},rg=class extends $a{type=\"Histogram\";#e;constructor(t,r){super(t,r?.description,hc(r?.attributes)),this.#e=r.boundaries}createHooks(){let t=this.#e,r=t.length,n=new Uint32Array(r+1),o=new Float64Array(r),s=0,a=0,i=Number.MAX_VALUE,c=-Number.MAX_VALUE;tn($i(t,jr),(p,d)=>{o[d]=p});let u=p=>{let d=0,m=r;for(;d!==m;){let x=Math.floor(d+(m-d)/2),g=o[x];p<=g?m=x:d=x,m===d+1&&(p<=o[d]?m=d:d=m)}n[d]=n[d]+1,s=s+1,a=a+p,p<i&&(i=p),p>c&&(c=p)},l=()=>{let p=mE(r),d=0;for(let m=0;m<r;m++){let x=o[m],g=n[m];d=d+g,p[m]=[x,d]}return p};return td(()=>({buckets:l(),count:s,min:i,max:c,sum:a}),u)}},W0=class extends $a{type=\"Summary\";#e;#t;#r;constructor(t,r){super(t,r?.description,hc(r?.attributes)),this.#e=Math.max(et(ye(r.maxAge)),0),this.#t=r.maxSize,this.#r=r.quantiles}createHooks(){let t=$i(this.#r,jr),r=mE(this.#t);for(let d of this.#r)if(d<0||d>1)throw new Error(`Quantile must be between 0 and 1, found: ${d}`);let n=0,o=0,s=0,a=Number.MAX_VALUE,i=-Number.MAX_VALUE,c=d=>{let m=[],x=0;for(;x<this.#t;){let S=r[x];if(kr(S)){let[E,U]=S,F=d-E;F>=0&&F<=this.#e&&m.push(U)}x=x+1}let g=$i(m,jr),y=g.length;return y===0?t.map(S=>[S,void 0]):t.map(S=>{if(S<=0)return[S,g[0]];if(S>=1)return[S,g[y-1]];let E=Math.ceil(S*y)-1;return[S,g[E]]})},u=(d,m)=>{if(this.#t>0){let x=n%this.#t;r[x]=[m,d],n=n+1}o=o+1,s=s+d,d<a&&(a=d),d>i&&(i=d)};return td(d=>{let m=Te(d,_r);return{quantiles:c(m.currentTimeMillisUnsafe()),count:o,min:a,max:i,sum:s}},([d,m])=>u(d,m))}},ng=class extends $a{type;metric;valueUnsafe;updateUnsafe;modifyUnsafe;constructor(t,r,n,o){super(t.id,t.description,t.attributes),this.metric=t,this.valueUnsafe=r,this.updateUnsafe=n,this.modifyUnsafe=o,this.type=t.type}createHooks(){return this.metric.createHooks()}},$K=e=>k(e,Xp)&&e[Xp]===Xp,sg=(e,t)=>new j0(e,t),uU=(e,t)=>new q0(e,t),BK=(e,t)=>new H0(e,t),zK=(e,t)=>new rg(e,t),jK=(e,t)=>ag(fU(e,t),(r,n)=>[r,Te(n,_r).currentTimeMillisUnsafe()]),fU=(e,t)=>new W0(e,t),qK=(e,t)=>{let r=kr(t?.boundaries)?t.boundaries:pU({start:.5,factor:2,count:35}),n=og(t?.attributes,{time_unit:\"milliseconds\"}),o=new rg(e,{...t,boundaries:r,attributes:n});return ag(o,et)},HK=e=>$(Vi(),t=>V(()=>e.valueUnsafe(t))),WK=f(2,(e,t)=>$(Vi(),r=>V(()=>e.modifyUnsafe(t,r)))),xc=f(2,(e,t)=>Ma(r=>V(()=>e.updateUnsafe(t,r)))),ag=f(2,(e,t)=>new ng(e,r=>e.valueUnsafe(r),(r,n)=>e.updateUnsafe(t(r,n),n),(r,n)=>e.modifyUnsafe(t(r,n),n))),JK=f(2,(e,t)=>ag(e,()=>t)),GK=f(2,(e,t)=>{let r=l4(t);return new ng(e,n=>e.valueUnsafe(r(n)),(n,o)=>e.updateUnsafe(n,r(o)),(n,o)=>e.modifyUnsafe(n,r(o)))}),KK=de(Vi(),e=>G0(e)),VK=$(Vi(),e=>{let t=G0(e);if(t.length>0){let r=t.reduce((u,l)=>{let p=l.id.length;return p>u?p:u},0)+2,n=t.reduce((u,l)=>{let p=kr(l.description)?l.description.length:0;return p>u?p:u},0)+2,o=t.reduce((u,l)=>{let p=l.type.length;return p>u?p:u},0)+2,s=t.reduce((u,l)=>{let p=kr(l.attributes)?lU(l.attributes).length:0;return p>u?p:u},0)+2,a=Object.entries(l_(t,u=>u.id)),c=yE(a,u=>u[0],A0).map(([,u])=>u.map(l=>ZK(l,r)+QK(l,n)+YK(l,o)+XK(l,s)+e4(l)).join(`\n`)).join(`\n`);return R(c)}return R(\"\")}),G0=e=>{let t=Te(e,J0);return Array.from(t.values()).map(({hooks:r,...n})=>({...n,state:r.get(e)}))},ZK=(e,t)=>`name=${e.id.padEnd(t,\" \")}`,QK=(e,t)=>`description=${(e.description??\"\").padEnd(t,\" \")}`,YK=(e,t)=>`type=${e.type.padEnd(t,\" \")}`,XK=(e,t)=>{let r=lU(e.attributes??{}),n=\" \".repeat(Math.max(0,t-r.length));return`${r}${n}`},e4=e=>{let t=\"state=\";switch(e.type){case\"Counter\":{let r=e.state;return`${t}[count: [${r.count}]]`}case\"Frequency\":{let r=e.state;return`${t}[occurrences: ${z0(r.occurrences)}]`}case\"Gauge\":{let r=e.state;return`${t}[value: [${r.value}]]`}case\"Histogram\":{let r=e.state,n=`buckets: [${z0(r.buckets)}]`,o=`count: [${r.count}]`,s=`min: [${r.min}]`,a=`max: [${r.max}]`,i=`sum: [${r.sum}]`;return`${t}[${n}, ${o}, ${s}, ${a}, ${i}]`}case\"Summary\":{let r=e.state,n=r.quantiles.map(([u,l])=>[u,l??0]),o=`quantiles: [${z0(n)}]`,s=`count: [${r.count}]`,a=`min: [${r.min}]`,i=`max: [${r.max}]`,c=`sum: [${r.sum}]`;return`${t}[${o}, ${s}, ${a}, ${i}, ${c}]`}}},z0=e=>Array.from(e).map(([t,r])=>`(${t} -> ${r})`).join(\", \"),lU=e=>{let t=Object.entries(e);return`attributes=[${yE(t,n=>n[0],A0).map(([n,o])=>`${n}: ${o}`).join(\", \")}]`},K0=e=>Oa(Bi(new Set(e),t=>t>0),Number.POSITIVE_INFINITY),t4=e=>K0(sp(e.count-1,t=>e.start+t*e.width)),pU=e=>K0(sp(e.count-1,t=>e.start*Math.pow(e.factor,t))),iU=uU(\"child_fibers_active\",{description:\"The current count of active child fibers\"}),r4=sg(\"child_fibers_started\",{description:\"The total number of child fibers that have been started\",incremental:!0}),n4=sg(\"child_fiber_successes\",{description:\"The total number of child fibers that have succeeded\",incremental:!0}),o4=sg(\"child_fiber_failures\",{description:\"The total number of child fibers that have failed\",incremental:!0}),s4=lp,ed=Ee(lp,{fiberCached:!0,defaultValue:zr}),V0={recordFiberStart(e){r4.updateUnsafe(1,e),iU.modifyUnsafe(1,e)},recordFiberEnd(e,t){iU.modifyUnsafe(-1,e),Hs(t)?n4.updateUnsafe(1,e):o4.updateUnsafe(1,e)}},a4=$p(ed)(V0),i4=$p(ed)(void 0),c4=Sr(ed,V0),u4=Sr(ed,void 0);function f4(e,t){let r=Object.entries(t).sort((n,o)=>n[0]<o[0]?-1:n[0]>o[0]?1:0);return JSON.stringify([e.type,e.id,e.description,r])}function td(e,t,r){return{get:e,update:t,modify:r??t}}function og(e,t){return{...hc(e),...hc(t)}}function hc(e){return kr(e)&&Array.isArray(e)?e.reduce((t,[r,n])=>(w(t,r,n),t),{}):e}function l4(e){let t,r={};return n=>{let o=Te(n,tg);return o!==t&&(t=o,r=og(o,e)),zt(n,tg,r)}}var p4=ts,ps=ue,ig=Yi,d4=RI,m4=LM,h4=$M,x4=BM,g4=jM,Ba=qr,y4=HM,Mn=wo,cg=eI,bf=dR,b=R,za=Ki,Q0=XE,z=W,B=V,te=le;var b4=Pp;var Sf=Et,gc=kp,S4=ZM,E4=QM,I4=XM;var T4=YM,Gr=sx,N=Ye,ug=ox,It=Re,Qs=lR,Kr=js,Ef=pR;var rd=zu,w4=YE,Vr=re,k4=EO,nd=Gi,C4=QE,A4=fR,v4=uR,T=$,Y0=CR,Ur=br,Zr=Eo,O4=Ra,_4=fM,to=Vu,q=de,Qt=Vt,fg=ju,ja=qu,R4=ER,X0=GR,M4=mI,If=Wr;var P4=lx,F4=oM,U4=sM,N4=aM,D4=iM,Ot=Hr,od=XR,L4=vp,$4=fx,B4=YR,z4=xI,j4=Gu,eT=yI,q4=bI,tT=px,lg=gI,H4=rM,mU=eM,W4=tM,J4=ux,hU=nM,G4=SI,K4=Zp,V4=L0,Z4=IR,Q4=dx,Y4=mx,X4=YF,e6=LP,t6=cM,r6=uM,n6=gM,o6=TI,s6=II,rT=xM,qa=Ua,a6=yM,nT=oI,i6=sI,c6=TR,Tf=aI,oT=GM,u6=KM,sT=VM,f6=MI,l6=PI,p6=KR,d6=JM,pg=VR,aT=hx,m6=Op,h6=EI,x6=dM,g6=wR,yc=bo,iT=Ku,y6=mM,b6=hM,Ys=Vi,sd=Ma,S6=Xx,ro=Io,E6=JR,cT=qR,uT=HR,I6=Wu,T6=Ws,w6=WR,ds=Sr,k6=cx,bc=Zi,dg=yx,fT=bx,Xs=Sx,C6=OM,xU=vM,A6=Fa,Sc=kM,vo=vI,v6=CM,O6=OI,lT=To,Pn=vn,_6=CI,R6=AI,M6=MM,P6=RM,F6=_I,an=PM,U6=Ex,pT=AM,ea=Qi,ms=Jr,N6=NM,D6=DM,sr=Ju,L6=VF,$6=D0,B6=hI,z6=ZR,j6=f(2,(e,t)=>gU(e,void 0,t)),gU=ZF,q6=lP,H6=pP,W6=dP,J6=mP,G6=IP,K6=TP,V6=wP,Z6=kP,Q6=yP,Y6=bP,X6=SP,dT=xP,eV=So,tV=mp,rV=EP,nV=gP,oV=$u,sV=rU,aV=nU,wf=eP,Yt=FI,kf=rP,iV=wx,cV=tP,uV=hR,fV=xR,Ec=oP,cn=Js,lV=UI,pV=sP,mT=iP,hT=NI,ad=aP,dV=kx,mV=uP,hV=DI,hs=cP,xV=Cx,ke=Cp,gV=gR,Ic=nn,mg=ko,yV=ko(),bV=ko(\"Fatal\"),SV=ko(\"Warn\"),xT=ko(\"Error\"),EV=ko(\"Info\"),IV=ko(\"Debug\"),TV=ko(\"Trace\"),wV=f(2,(e,t)=>Ws(e,Yu,r=>new Set([...r,t]))),kV=f(e=>ps(e[0]),(e,...t)=>Ws(e,Np,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||w(n,t[0],t[1]),n})),CV=NP,AV=f(2,(e,t)=>$(vx,r=>Ws(e,Dp,n=>[[t,r],...n]))),vV=f(e=>ps(e[0]),(e,t,r)=>Pn(e,n=>{let o=r===void 0?n:r(n);return xc(t,o)})),OV=f(e=>ps(e[0]),(e,t,r)=>Zr(e,n=>{let o=r===void 0?n:r(n);return xc(t,o)})),_V=f(e=>ps(e[0]),(e,t,r)=>lg(e,n=>{let o=r===void 0?n:r(n);return xc(t,o)})),RV=f(e=>ps(e[0]),(e,t,r)=>hU(e,n=>{let o=r===void 0?n:r(n);return xc(t,o)})),MV=f(e=>ps(e[0]),(e,t,r)=>Ic(n=>{let o=n.monotonicTimeNanosUnsafe();return Pn(e,()=>{let s=n.monotonicTimeNanosUnsafe(),a=wE(ye(s),ye(o)),i=r===void 0?a:r(a);return xc(t,i)})})),yf=class extends vr()(\"effect/Effect/Transaction\"){},PV=e=>Vr(t=>{let r=tp(t.context,yf);if(r)return e;r={journal:new Map,retry:!1};let n;return ms(o=>T(Mn({while:()=>!n,body:$e(o(e).pipe(ds(yf,r),mU(()=>r.retry?o(FV(r)):te),to)),step(s){if(r.retry||!yU(r))return dU(r);qe(s)?UV(t,r):dU(r),n=s}}),()=>n))}),yU=e=>{for(let[t,{version:r}]of e.journal)if(t.version!==r)return!1;return!0},FV=e=>Sf(t=>{if(!yU(e))return t(te);let r={},n=Array.from(e.journal.keys()),o=()=>{for(let a of n)a.pending.delete(r)},s=()=>{o(),t(te)};for(let a of n)a.pending.set(r,s);return B(o)});function UV(e,t){for(let[r,{value:n,written:o}]of t.journal)if(o){Object.is(n,r.value)||(r.version=r.version+1,r.value=n);for(let s of r.pending.values())e.currentDispatcher.scheduleTask(s,0);r.pending.clear()}}function dU(e){e.retry=!1,e.journal.clear()}var NV=T(yf,e=>(e.retry=!0,an)),DV=(e,t,r)=>(...n)=>Sf(o=>{try{e(...n,(s,a)=>{o(s?N(t?t(s,n):s):b(a))})}catch(s){o(r?N(r(s,n)):Kr(s))}}),LV=()=>e=>e,$V=()=>e=>e,BV=()=>e=>e,Fn=AR,id=vR,pr=OR,ft=kR,Cf=_R,gT=yR;var pe={};Ae(pe,{Any:()=>i9,Array:()=>We,ArrayEnsure:()=>y9,BigDecimal:()=>xL,BigDecimalFromString:()=>Y7,BigInt:()=>cl,BigIntFromString:()=>N7,Boolean:()=>uA,BooleanFromBit:()=>q7,BooleanLiterals:()=>dA,ByteSize:()=>_m,ByteSizeFromBigInt:()=>eX,ByteSizeFromNumber:()=>tX,ByteSizeFromString:()=>X7,Cause:()=>sA,CauseReason:()=>oA,Char:()=>E7,Chunk:()=>rX,Class:()=>GL,Cookie:()=>HL,Cookies:()=>WL,Date:()=>Om,DateFromMillis:()=>O7,DateFromString:()=>v7,DateTimeUtc:()=>Ab,DateTimeUtcFromDate:()=>cX,DateTimeUtcFromMillis:()=>fX,DateTimeUtcFromString:()=>uX,DateTimeZoned:()=>PL,DateTimeZonedFromString:()=>mX,Defect:()=>T7,Duration:()=>Ob,DurationFromMillis:()=>nee,DurationFromNanos:()=>ree,DurationFromString:()=>qL,Enum:()=>s9,Error:()=>KL,ErrorInstance:()=>I7,Exit:()=>oee,FalseLiterals:()=>H2,File:()=>uL,Finite:()=>Im,FiniteFromString:()=>U7,FormData:()=>fL,Graph:()=>cee,HashMap:()=>uee,HashSet:()=>fee,Headers:()=>hee,InetAddress:()=>zL,InetAddressFromString:()=>VX,InetAddressV4:()=>GX,InetAddressV6:()=>KX,Int:()=>Ts,IpAddress:()=>Xc,IpAddressFromString:()=>pl,IpInterface:()=>DL,IpInterfaceFromString:()=>qX,IpLinkLocalAddress:()=>OX,IpLinkLocalAddressFromString:()=>_X,IpLoopbackAddress:()=>AX,IpLoopbackAddressFromString:()=>vX,IpMulticastAddress:()=>hX,IpMulticastAddressFromString:()=>xX,IpNetwork:()=>BL,IpNetworkFromString:()=>JX,IpUnicastAddress:()=>bX,IpUnicastAddressFromString:()=>SX,IpUnspecifiedAddress:()=>RX,IpUnspecifiedAddressFromString:()=>MX,Ipv4Address:()=>vb,Ipv4AddressFromString:()=>IA,Ipv4BroadcastAddress:()=>TX,Ipv4BroadcastAddressFromString:()=>wX,Ipv4Interface:()=>UL,Ipv4InterfaceFromString:()=>zX,Ipv4Network:()=>LL,Ipv4NetworkFromString:()=>HX,Ipv4PrivateAddress:()=>PX,Ipv4PrivateAddressFromString:()=>FX,Ipv6Address:()=>TA,Ipv6AddressFromString:()=>FL,Ipv6Interface:()=>NL,Ipv6InterfaceFromString:()=>jX,Ipv6Network:()=>$L,Ipv6NetworkFromString:()=>WX,Ipv6UniqueLocalAddress:()=>UX,Ipv6UniqueLocalAddressFromString:()=>NX,Json:()=>_b,JsonFromUrlParamsField:()=>xee,JsonObject:()=>Hee,Literal:()=>Xt,Literals:()=>Is,MacAddress:()=>Yc,MacAddressFromString:()=>ll,MacBroadcastAddress:()=>kX,MacBroadcastAddressFromString:()=>CX,MacLocallyAdministeredAddress:()=>DX,MacLocallyAdministeredAddressFromString:()=>LX,MacMulticastAddress:()=>gX,MacMulticastAddressFromString:()=>yX,MacUnicastAddress:()=>EX,MacUnicastAddressFromString:()=>IX,MacUniversallyAdministeredAddress:()=>$X,MacUniversallyAdministeredAddressFromString:()=>BX,MutableJson:()=>Jee,Natural:()=>Vc,Never:()=>a9,NonEmptyArray:()=>lA,NonEmptyString:()=>oL,Null:()=>Sb,NullOr:()=>pA,NullishOr:()=>U2,Number:()=>il,NumberFromString:()=>F7,ObjectKeyword:()=>f9,Opaque:()=>R9,Option:()=>eu,OptionFromNullOr:()=>lee,OptionFromNullishOr:()=>dee,OptionFromOptional:()=>bee,OptionFromOptionalKey:()=>yee,OptionFromOptionalNullOr:()=>See,OptionFromUndefinedOr:()=>pee,PropertyKey:()=>nA,ReadonlyMap:()=>w7,ReadonlySet:()=>k7,Record:()=>fa,RecordFromCookies:()=>mee,RecordFromUrlParams:()=>gee,Redacted:()=>kA,RedactedFromValue:()=>Eee,RegExp:()=>C7,Result:()=>Iee,SchemaError:()=>ua,SocketAddress:()=>QX,StandardSchemaV1FailureResult:()=>j7,String:()=>X,StringForLiteralAutocomplete:()=>c9,StringFromBase64:()=>L7,StringFromBase64Url:()=>$7,StringFromHex:()=>B7,StringFromUriComponent:()=>z7,Struct:()=>Le,StructWithRest:()=>x9,Symbol:()=>M2,TaggedClass:()=>Cee,TaggedError:()=>Aee,TaggedStruct:()=>Tb,TaggedUnion:()=>_9,TemplateLiteral:()=>n9,TemplateLiteralParser:()=>o9,TimeZone:()=>RL,TimeZoneFromString:()=>dX,TimeZoneNamed:()=>OL,TimeZoneNamedFromString:()=>pX,TimeZoneOffset:()=>lX,Tree:()=>qee,Trim:()=>D7,Trimmed:()=>pL,TrueLiterals:()=>q2,Tuple:()=>Es,TupleWithRest:()=>g9,URL:()=>kb,URLFromString:()=>A7,URLSearchParams:()=>lL,Uint8Array:()=>Cb,Uint8ArrayFromBase64:()=>H7,Uint8ArrayFromBase64Url:()=>W7,Uint8ArrayFromHex:()=>J7,Undefined:()=>cA,UndefinedOr:()=>Ib,Union:()=>gt,UniqueArray:()=>b9,UniqueSymbol:()=>l9,UnixPathAddress:()=>jL,UnixPathAddressFromString:()=>ZX,Unknown:()=>Em,UnknownFromJsonString:()=>R7,UrlParams:()=>wA,Void:()=>u9,annotate:()=>_Y,annotateEncoded:()=>RY,annotateKey:()=>MY,asserts:()=>DY,brand:()=>L2,catchDecoding:()=>T9,catchDecodingWithContext:()=>z2,catchEncoding:()=>w9,catchEncodingWithContext:()=>j2,check:()=>E9,declare:()=>Je,declareConstructor:()=>gn,decode:()=>k9,decodeEffect:()=>LY,decodeExit:()=>$Y,decodeOption:()=>zY,decodePromise:()=>qY,decodeResult:()=>jY,decodeSync:()=>HY,decodeTo:()=>ee,decodeUnknownEffect:()=>gb,decodeUnknownExit:()=>T2,decodeUnknownOption:()=>BY,decodeUnknownPromise:()=>k2,decodeUnknownResult:()=>w2,decodeUnknownSync:()=>C2,encode:()=>C9,encodeEffect:()=>WY,encodeExit:()=>JY,encodeKeys:()=>m9,encodeOption:()=>KY,encodePromise:()=>ZY,encodeResult:()=>VY,encodeSync:()=>QY,encodeTo:()=>mA,encodeUnknownEffect:()=>yb,encodeUnknownExit:()=>A2,encodeUnknownOption:()=>GY,encodeUnknownPromise:()=>O2,encodeUnknownResult:()=>v2,encodeUnknownSync:()=>_2,extendTo:()=>h9,fieldsAssign:()=>p9,flip:()=>rA,fromBrand:()=>I9,fromFormData:()=>M7,fromJsonString:()=>SA,fromURLSearchParams:()=>P7,instanceOf:()=>ci,is:()=>NY,isBase64:()=>Z2,isBase64Url:()=>B9,isBetween:()=>vm,isBetweenBigDecimal:()=>Q7,isBetweenBigInt:()=>f7,isBetweenCodePoints:()=>d7,isBetweenDate:()=>a7,isBetweenLength:()=>gA,isBetweenProperties:()=>b7,isBetweenSize:()=>x7,isCapitalized:()=>J9,isEndingWith:()=>j9,isFinite:()=>K9,isGUID:()=>L9,isGreaterThan:()=>Z9,isGreaterThanBigDecimal:()=>G7,isGreaterThanBigInt:()=>i7,isGreaterThanDate:()=>r7,isGreaterThanOrEqualTo:()=>Q2,isGreaterThanOrEqualToBigDecimal:()=>K7,isGreaterThanOrEqualToBigInt:()=>Y2,isGreaterThanOrEqualToDate:()=>n7,isIncluding:()=>q9,isInt:()=>wb,isInt32:()=>e7,isLessThan:()=>Q9,isLessThanBigDecimal:()=>V7,isLessThanBigInt:()=>c7,isLessThanDate:()=>o7,isLessThanOrEqualTo:()=>Y9,isLessThanOrEqualToBigDecimal:()=>Z7,isLessThanOrEqualToBigInt:()=>u7,isLessThanOrEqualToDate:()=>s7,isLowercased:()=>W9,isMaxCodePoints:()=>p7,isMaxLength:()=>rL,isMaxProperties:()=>y7,isMaxSize:()=>h7,isMinCodePoints:()=>l7,isMinLength:()=>X2,isMinProperties:()=>g7,isMinSize:()=>m7,isMultipleOf:()=>X9,isNonEmpty:()=>tL,isPattern:()=>fl,isPropertyNames:()=>S7,isSchema:()=>bb,isSchemaError:()=>y2,isStartingWith:()=>z9,isStringBigInt:()=>F9,isStringFinite:()=>P9,isStringSymbol:()=>U9,isTrimmed:()=>V2,isULID:()=>$9,isUUID:()=>D9,isUint32:()=>t7,isUncapitalized:()=>G9,isUnique:()=>bA,isUniqueKey:()=>nL,isUppercased:()=>H9,link:()=>Me,linkDecoding:()=>ul,make:()=>G,makeFilter:()=>Be,makeFilterGroup:()=>M9,makeIsBetween:()=>Am,makeIsGreaterThan:()=>Tm,makeIsGreaterThanOrEqualTo:()=>wm,makeIsLessThan:()=>km,makeIsLessThanOrEqualTo:()=>Cm,makeIsMultipleOf:()=>V9,middlewareDecoding:()=>$2,middlewareEncoding:()=>B2,mutable:()=>S9,mutableKey:()=>e9,optional:()=>sl,optionalKey:()=>Zc,overrideToCodecIso:()=>zee,overrideToEquivalence:()=>_ee,overrideToFormatter:()=>vee,readonlyKey:()=>t9,refine:()=>D2,required:()=>XY,requiredKey:()=>YY,resolveAnnotations:()=>Gee,resolveAnnotationsKey:()=>Kee,revealBottom:()=>OY,revealCodec:()=>PY,suspend:()=>N2,tag:()=>Qc,tagDefaultOmit:()=>O9,toCodecArrayFromSingle:()=>Nee,toCodecIso:()=>Uee,toCodecJson:()=>Fee,toCodecStringTree:()=>Mm,toDifferJsonPatch:()=>jee,toEncoded:()=>al,toEncoderXml:()=>Dee,toEquivalence:()=>Ree,toFormatter:()=>Oee,toIso:()=>Lee,toIsoFocus:()=>Bee,toIsoSource:()=>$ee,toJsonSchemaDocument:()=>Pee,toRepresentation:()=>Mee,toStandardJSONSchemaV1:()=>UY,toStandardSchemaV1:()=>FY,toTaggedUnion:()=>K2,toType:()=>yn,withArrayLengthConstraints:()=>Eb,withConstructorDefault:()=>W2,withDecodingDefault:()=>G2,withDecodingDefaultKey:()=>hA,withDecodingDefaultType:()=>v9,withDecodingDefaultTypeKey:()=>A9});var bU=/^[+-]?\\d+$/,bT=\"~effect/BigDecimal\",zV={[bT]:bT,[ae](){let e=ET(this);return oe(Ne(String(e.value)),Dt(e.scale))},[ie](e){return ST(e)&&kU(this,e)===0},toString(){return`BigDecimal(${_o(this)})`},toJSON(){return{_id:\"BigDecimal\",value:String(this.value),scale:this.scale}},[Ie](){return this.toJSON()},pipe(){return K(this,arguments)}},ST=e=>k(e,bT),IU=(e,t)=>{if(!Number.isSafeInteger(t))throw new RangeError(`Scale must be a safe integer, got ${t}`);let r=Object.create(zV);return r.value=e,r.scale=t,r},TU=(e,t)=>{let r=IU(e,t);return r.normalized=r,r};var Oo=BigInt(0),jV=BigInt(1);var qV=BigInt(10),wU=TU(Oo,0);var ET=e=>{if(e.normalized===void 0)if(e.value===Oo)e.normalized=wU;else{let t=`${e.value}`,r=t.length;for(;t[r-1]===\"0\";)r--;e.normalized=TU(BigInt(t.slice(0,r)),e.scale-(t.length-r))}return e.normalized};var HV=100,WV=[jV],yT=(e,t)=>e===t?0:e<t?-1:1,SU=(e,t)=>{let r=`${e.value<Oo?-e.value:e.value}`,n=`${t.value<Oo?-t.value:t.value}`,o=BigInt(r.length-n.length)-BigInt(e.scale)+BigInt(t.scale);if(o!==Oo)return o<Oo?-1:1;let s=Math.max(r.length,n.length);return xh(r.padEnd(s,\"0\"),n.padEnd(s,\"0\"))},kU=(e,t)=>{if(e.scale===t.scale)return yT(e.value,t.value);let r=EU(e),n=EU(t);if(r!==n)return r<n?-1:1;if(r===0)return 0;let o=e.scale-t.scale,s=Math.abs(o);if(s>HV)return r===-1?SU(t,e):SU(e,t);let a=WV[s]??=qV**BigInt(s);return o>0?yT(e.value,t.value*a):yT(e.value*a,t.value)},Af=ns(kU);var EU=e=>e.value===Oo?0:e.value<Oo?-1:1;var hg=e=>{if(e===\"\")return O(wU);let t,r,n=e.search(/[eE]/);if(n!==-1){let c=e.slice(n+1);if(t=e.slice(0,n),r=Number(c),t===\"\"||!Number.isSafeInteger(r)||!bU.test(c))return v()}else t=e,r=0;let o,s,a=t.search(/\\./);if(a!==-1){let c=t.slice(0,a),u=t.slice(a+1);o=`${c}${u}`,s=u.length}else o=t,s=0;if(!bU.test(o))return v();let i=s-r;return Number.isSafeInteger(i)?O(IU(BigInt(o),i)):v()};var _o=e=>{let t=ET(e);if(Math.abs(t.scale)>=16)return JV(t);let r=t.value<Oo,n=`${r?-t.value:t.value}`,o=t.scale>0?n.padStart(t.scale+1,\"0\"):n.padEnd(n.length-t.scale,\"0\"),s=o.length-t.scale,a=t.scale>0?`${o.slice(0,s)}.${o.slice(s)}`:o;return r?`-${a}`:a},JV=e=>{if(GV(e))return\"0e+0\";let t=ET(e),r=`${t.value}`,n=t.value<Oo?2:1,o=r.slice(0,n),s=r.slice(n),a=s.length-t.scale;return`${o}${s===\"\"?\"\":`.${s}`}e${a>=0?\"+\":\"\"}${a}`};var GV=e=>e.value===Oo;var CU=globalThis.BigInt;var AU=e=>e>CU(Number.MAX_SAFE_INTEGER)||e<CU(Number.MIN_SAFE_INTEGER)?v():O(Number(e));var xg=BigInt(0),KV=BigInt(1),xs=BigInt(1e3),Ha=BigInt(1024),OU=[{symbol:\"B\",factor:KV,names:[\"B\",\"byte\",\"bytes\"]},{symbol:\"kB\",factor:xs,names:[\"kB\",\"kilobyte\",\"kilobytes\"]},{symbol:\"MB\",factor:xs**BigInt(2),names:[\"MB\",\"megabyte\",\"megabytes\"]},{symbol:\"GB\",factor:xs**BigInt(3),names:[\"GB\",\"gigabyte\",\"gigabytes\"]},{symbol:\"TB\",factor:xs**BigInt(4),names:[\"TB\",\"terabyte\",\"terabytes\"]},{symbol:\"PB\",factor:xs**BigInt(5),names:[\"PB\",\"petabyte\",\"petabytes\"]},{symbol:\"EB\",factor:xs**BigInt(6),names:[\"EB\",\"exabyte\",\"exabytes\"]},{symbol:\"ZB\",factor:xs**BigInt(7),names:[\"ZB\",\"zettabyte\",\"zettabytes\"]},{symbol:\"YB\",factor:xs**BigInt(8),names:[\"YB\",\"yottabyte\",\"yottabytes\"]},{symbol:\"RB\",factor:xs**BigInt(9),names:[\"RB\",\"ronnabyte\",\"ronnabytes\"]},{symbol:\"QB\",factor:xs**BigInt(10),names:[\"QB\",\"quettabyte\",\"quettabytes\"]}],VV=[OU[0],{symbol:\"KiB\",factor:Ha,names:[\"KiB\",\"kibibyte\",\"kibibytes\"]},{symbol:\"MiB\",factor:Ha**BigInt(2),names:[\"MiB\",\"mebibyte\",\"mebibytes\"]},{symbol:\"GiB\",factor:Ha**BigInt(3),names:[\"GiB\",\"gibibyte\",\"gibibytes\"]},{symbol:\"TiB\",factor:Ha**BigInt(4),names:[\"TiB\",\"tebibyte\",\"tebibytes\"]},{symbol:\"PiB\",factor:Ha**BigInt(5),names:[\"PiB\",\"pebibyte\",\"pebibytes\"]},{symbol:\"EiB\",factor:Ha**BigInt(6),names:[\"EiB\",\"exbibyte\",\"exbibytes\"]},{symbol:\"ZiB\",factor:Ha**BigInt(7),names:[\"ZiB\",\"zebibyte\",\"zebibytes\"]},{symbol:\"YiB\",factor:Ha**BigInt(8),names:[\"YiB\",\"yobibyte\",\"yobibytes\"]}],ZV=[...OU,...VV.slice(1)],QV=new Map(ZV.flatMap(e=>e.names.map(t=>[t,e])));var gg=e=>e,tfe=gg(xg),vf=e=>{throw new Error(`Invalid ByteSize: ${e}`)},_U=e=>!Number.isSafeInteger(e)||e<0?vf(`expected a non-negative safe integer, received ${e}`):gg(BigInt(e));var RU=e=>{let t=/^\\s*(\\d+)(?:\\.(\\d+))?\\s*([A-Za-z]+)\\s*$/.exec(e);if(t===null)return vf(`unsupported syntax ${JSON.stringify(e)}`);let r=QV.get(t[3]);if(r===void 0)return vf(`unsupported unit ${JSON.stringify(t[3])}`);let n=t[2]??\"\",o=BigInt(10)**BigInt(n.length),s=BigInt(t[1]+n)*r.factor;return s%o!==xg?vf(`${JSON.stringify(e)} does not represent an integral number of bytes`):gg(s/o)},MU=mo(RU),yg=e=>{switch(typeof e){case\"bigint\":return e<xg?vf(`expected a non-negative bigint, received ${e}`):gg(e);case\"number\":return _U(e);case\"string\":return RU(e)}return vf(`unsupported input ${e}`)},TT=mo(yg),PU=e=>typeof e==\"bigint\"?yg(e):_U(e);var FU=e=>typeof e==\"bigint\"&&e>=xg;var bg=e=>e,UU=AU;var DU=\"~effect/Chunk\";function NU(e,t,r,n,o){for(let s=t;s<Math.min(e.length,t+o);s++)r[n+s-t]=e[s];return r}var LU=[],kT=e=>Bt((t,r)=>{if(t.length!==r.length)return!1;let n=Tc(t),o=Tc(r);for(let s=0;s<n.length;s++)if(!e(n[s],o[s]))return!1;return!0}),eZ=kT(J),tZ={[DU]:{_A:e=>e},toString(){return`Chunk(${L(Tc(this))})`},toJSON(){return{_id:\"Chunk\",values:Lt(Tc(this))}},[Ie](){return this.toJSON()},[ie](e){return Eg(e)&&eZ(this,e)},[ae](){return xr(Tc(this))},[Symbol.iterator](){switch(this.backing._tag){case\"IArray\":return this.backing.array[Symbol.iterator]();case\"IEmpty\":return LU[Symbol.iterator]();default:return Tc(this)[Symbol.iterator]()}},pipe(){return K(this,arguments)}},CT=e=>{let t=Object.create(tZ);switch(t.backing=e,e._tag){case\"IEmpty\":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case\"IConcat\":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case\"IArray\":{t.length=e.array.length,t.depth=0,t.left=ta,t.right=ta;break}case\"ISingleton\":{t.length=1,t.depth=0,t.left=ta,t.right=ta;break}case\"ISlice\":{t.length=e.length,t.depth=0,t.left=ta,t.right=ta;break}}return t},Eg=e=>k(e,DU),ta=CT({_tag:\"IEmpty\"}),rZ=()=>ta;var nZ=e=>CT({_tag:\"ISingleton\",a:e}),AT=e=>Eg(e)?e:sZ(Se(e)),wT=(e,t,r)=>{switch(e.backing._tag){case\"IArray\":{NU(e.backing.array,0,t,r,e.length);break}case\"IConcat\":{wT(e.left,t,r),wT(e.right,t,r+e.left.length);break}case\"ISingleton\":{t[r]=e.backing.a;break}case\"ISlice\":{NU(Tc(e.backing.chunk),e.backing.offset,t,r,e.length);break}}};var oZ=e=>{switch(e.backing._tag){case\"IEmpty\":return LU;case\"IArray\":return e.backing.array;default:{let t=new Array(e.length);return wT(e,t,0),e.backing={_tag:\"IArray\",array:t},e.left=ta,e.right=ta,e.depth=0,t}}},Tc=oZ;var sZ=e=>e.length===0?rZ():e.length===1?nZ(e[0]):CT({_tag:\"IArray\",array:e});var $U=e=>e.length;var OT=uc,BU=Vs,zU=pF,jU=jx,qU=dF,HU=x0,WU=mF;var JU=qx;var GU=fc;var wc=hF,Ig=xF;var kc=gF;var _T=y0,cd=Wp,Tg=b0;var wg=Jp,Cc=yF;var KU=Zs;var VU=I0;var kg=kF;var ud=C0;var vg={};Ae(vg,{decode:()=>Wa,decodeString:()=>RT,encode:()=>Ac});var Ac=e=>aZ(typeof e==\"string\"?iZ.encode(e):e),Wa=e=>{let t=uZ(e),r=t.length;if(r%4!==0)return D(new Wn({kind:\"Decode\",module:\"Base64\",input:t,message:`Length must be a multiple of 4, but is ${r}`}));let n=t.indexOf(\"=\");if(n!==-1&&(n<r-2||n===r-2&&t[r-1]!==\"=\"))return D(new Wn({kind:\"Decode\",module:\"Base64\",input:t,message:\"Found a '=' character, but it is not at the end\"}));try{let o=t.endsWith(\"==\")?2:t.endsWith(\"=\")?1:0,s=new Uint8Array(3*(r/4)-o);for(let a=0,i=0;a<r;a+=4,i+=3){let c=Ag(t.charCodeAt(a))<<18|Ag(t.charCodeAt(a+1))<<12|Ag(t.charCodeAt(a+2))<<6|Ag(t.charCodeAt(a+3));s[i]=c>>16,s[i+1]=c>>8&255,s[i+2]=c&255}return P(s)}catch(o){return D(new Wn({kind:\"Decode\",module:\"Base64\",input:t,message:o instanceof Error?o.message:\"Invalid input\"}))}},RT=e=>mt(Wa(e),t=>cZ.decode(t)),aZ=e=>{let t=e.length,r=\"\",n;for(n=2;n<t;n+=3)r+=Ro[e[n-2]>>2],r+=Ro[(e[n-2]&3)<<4|e[n-1]>>4],r+=Ro[(e[n-1]&15)<<2|e[n]>>6],r+=Ro[e[n]&63];return n===t+1&&(r+=Ro[e[n-2]>>2],r+=Ro[(e[n-2]&3)<<4],r+=\"==\"),n===t&&(r+=Ro[e[n-2]>>2],r+=Ro[(e[n-2]&3)<<4|e[n-1]>>4],r+=Ro[(e[n-1]&15)<<2],r+=\"=\"),r},iZ=new TextEncoder,cZ=new TextDecoder,uZ=e=>e.replace(/[\\n\\r]/g,\"\"),Ro=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",fd=new Uint8Array(123).fill(255);for(let e=0;e<Ro.length;e++)fd[Ro.charCodeAt(e)]=e;fd[61]=0;var Ag=e=>{if(e>=fd.length||fd[e]===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return fd[e]};var _g=\"~effect/HashMap\",Mo=5,pd=1<<Mo,fZ=pd/4,ZU=pd/2,lZ=pd-1,pZ=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),ld=(e,t)=>e>>>t&lZ,Ja=(e,t)=>1<<ld(e,t),Og=(e,t)=>pZ(e&t-1);function QU(e,t,r,n,o,s){if(t>32)throw new Error(\"HashMap: max depth exceeded\");let a=Ja(r,t),i=Ja(o,t);if(a===i){let l=QU(e,t+Mo,r,n,o,s);return new _c(e,a,[l])}let c=a|i,u=a>>>0<i>>>0?[n,s]:[s,n];return new _c(e,c,u)}var dZ=Ne(\"HashMap\"),YU=(e,t)=>oe(H(e),H(t)),XU=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r];n&&(t^=n.subtreeHash())}return t},vc=class{canEdit(t){return this.edit===t}subtreeHash(){let t=this._hash;if(t===void 0){let r=bi;t=this.computeHash(),r===bi&&(this._hash=t)}return t}},MT=class extends vc{_tag=\"EmptyNode\";edit=0;get size(){return 0}get(t,r,n){return v()}has(t,r,n){return!1}set(t,r,n,o,s,a){return a.value=!0,new Oc(t,n,o,s)}remove(t,r,n,o,s){return this}canEdit(t){return!1}computeHash(){return 0}},Oc=class e extends vc{_tag=\"LeafNode\";edit;hash;key;value;constructor(t,r,n,o){super(),this.edit=t,this.hash=r,this.key=n,this.value=o}get size(){return 1}get(t,r,n){return this.hash===r&&J(this.key,n)?O(this.value):v()}has(t,r,n){return this.hash===r&&J(this.key,n)}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash===n&&J(this.key,o))return J(this.value,s)?this:this.canEdit(t)?(this.value=s,this):new e(t,n,o,s);if(a.value=!0,this.hash===n)return new PT(t,n,[[this.key,this.value],[o,s]]);let i=Ja(n,r),c=Ja(this.hash,r);if(i===c)return new _c(t,i,[this.set(t,r+Mo,n,o,s,a)]);let u=i|c,l=i>>>0<c>>>0?[new e(t,n,o,s),this]:[this,new e(t,n,o,s)];return new _c(t,u,l)}remove(t,r,n,o,s){if(this.hash===n&&J(this.key,o)){s.value=!0;return}return this}computeHash(){return YU(this.key,this.value)}},PT=class e extends vc{_tag=\"CollisionNode\";edit;hash;entries;constructor(t,r,n){super(),this.edit=t,this.hash=r,this.entries=n}get size(){return this.entries.length}get(t,r,n){if(this.hash!==r)return v();for(let[o,s]of this.entries)if(J(o,n))return O(s);return v()}has(t,r,n){if(this.hash!==r)return!1;for(let[o]of this.entries)if(J(o,n))return!0;return!1}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return a.value=!0,QU(t,r,this.hash,this,n,new Oc(t,n,o,s));for(let i=0;i<this.entries.length;i++)if(J(this.entries[i][0],o)){if(J(this.entries[i][1],s))return this;if(this.canEdit(t))return this.entries[i]=[o,s],this;let c=[...this.entries];return c[i]=[o,s],new e(t,this.hash,c)}return a.value=!0,this.canEdit(t)?(this.entries.push([o,s]),this):new e(t,this.hash,[...this.entries,[o,s]])}remove(t,r,n,o,s){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return this;let a=this.entries.findIndex(([c])=>J(c,o));if(a===-1)return this;if(s.value=!0,this.entries.length===1)return;if(this.entries.length===2){let c=this.entries[a===0?1:0];return new Oc(t,this.hash,c[0],c[1])}if(this.canEdit(t))return this.entries.splice(a,1),this;let i=[...this.entries];return i.splice(a,1),new e(t,this.hash,i)}computeHash(){let t=0,r=this.entries;for(let n=0;n<r.length;n++)t^=YU(r[n][0],r[n][1]);return t}},_c=class e extends vc{_tag=\"IndexedNode\";edit;_size;bitmap;children;constructor(t,r,n){super(),this.edit=t,this.bitmap=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+r.size,0)),this._size}get(t,r,n){let o=Ja(r,t);if((this.bitmap&o)===0)return v();let s=Og(this.bitmap,o);return this.children[s].get(t+Mo,r,n)}has(t,r,n){let o=Ja(r,t);if((this.bitmap&o)===0)return!1;let s=Og(this.bitmap,o);return this.children[s].has(t+Mo,r,n)}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=Ja(n,r),c=Og(this.bitmap,i);if((this.bitmap&i)!==0){let u=this.children[c],l=u.set(t,r+Mo,n,o,s,a);if(u===l)return this;if(this.canEdit(t))return this.children[c]=l,this;let p=[...this.children];return p[c]=l,new e(t,this.bitmap,p)}else{a.value=!0;let u=new Oc(t,n,o,s),l=this.bitmap|i;if(this.canEdit(t))return this.children.splice(c,0,u),this.bitmap=l,this._size=void 0,this.children.length>ZU?this.expand(t,l,this.children):this;let p=[...this.children];return p.splice(c,0,u),p.length>ZU?this.expand(t,l,p):new e(t,l,p)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=Ja(n,r);if((this.bitmap&a)===0)return this;let i=Og(this.bitmap,a),c=this.children[i],u=c.remove(t,r+Mo,n,o,s);if(!s.value)return this;if(u===void 0){let p=this.bitmap^a;if(p===0)return;if(this.children.length===2){let m=this.children[i===0?1:0];if(m._tag===\"LeafNode\")return m}if(this.canEdit(t))return this.children.splice(i,1),this.bitmap=p,this._size=void 0,this;let d=[...this.children];return d.splice(i,1),new e(t,p,d)}if(c===u)return this;if(this.canEdit(t))return this.children[i]=u,this;let l=[...this.children];return l[i]=u,new e(t,this.bitmap,l)}expand(t,r,n){let o=new globalThis.Array(pd),s=0;for(let a=0;a<pd;a++)(r&1<<a)!==0&&(o[a]=n[s++]);return new FT(t,n.length,o)}computeHash(){return XU(this.children)}},FT=class e extends vc{_tag=\"ArrayNode\";edit;_size;count;children;constructor(t,r,n){super(),this.edit=t,this.count=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+(r?.size??0),0)),this._size}get(t,r,n){let o=ld(r,t),s=this.children[o];return s?s.get(t+Mo,r,n):v()}has(t,r,n){let o=ld(r,t),s=this.children[o];return s?s.has(t+Mo,r,n):!1}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=ld(n,r),c=this.children[i];if(c){let u=c.set(t,r+Mo,n,o,s,a);if(c===u)return this;if(this.canEdit(t))return this.children[i]=u,this;let l=[...this.children];return l[i]=u,new e(t,this.count,l)}else{a.value=!0;let u=new Oc(t,n,o,s);if(this.canEdit(t))return this.children[i]=u,this.count++,this._size=void 0,this;let l=[...this.children];return l[i]=u,new e(t,this.count+1,l)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=ld(n,r),i=this.children[a];if(!i)return this;let c=i.remove(t,r+Mo,n,o,s);if(!s.value)return this;let u=this.count-(c?0:1);if(u<fZ)return this.pack(t,a,c);if(i===c)return this;if(this.canEdit(t))return this.children[a]=c,c||(this.count=u),this._size=void 0,this;let l=[...this.children];return l[a]=c,new e(t,u,l)}pack(t,r,n){let o=[],s=0,a=1;for(let i=0;i<this.children.length;i++){let c=i===r?n:this.children[i];c&&(o.push(c),s|=a),a<<=1}return new _c(t,s,o)}computeHash(){return XU(this.children)}},Rg=class{stack;project;entries=[];index=0;constructor(t,r){this.stack=[t],this.project=r}next(){for(;;){if(this.index<this.entries.length){let r=this.entries[this.index++];return{done:!1,value:this.project(r[0],r[1])}}if(this.stack.length===0)return{done:!0,value:void 0};let t=this.stack.pop();switch(t._tag){case\"LeafNode\":{let r=t;return{done:!1,value:this.project(r.key,r.value)}}case\"CollisionNode\":{this.entries=t.entries,this.index=0;break}case\"IndexedNode\":case\"ArrayNode\":{let r=t.children;for(let n=r.length-1;n>=0;n--){let o=r[n];o&&this.stack.push(o)}}}}}[Symbol.iterator](){return this}},mZ=(e,t)=>[e,t];var dd=class{[_g]=_g;_editable;_edit;_root;_size;constructor(t,r,n,o){this._editable=t,this._edit=r,this._root=n,this._size=o}get size(){return this._size}[Symbol.iterator](){return new Rg(this._root,mZ)}[ie](t){if(UT(t)){let r=t;if(this.size!==r.size)return!1;for(let[n,o]of this){let s=Rl(t,rN(n));if(fe(s)||!J(o,s.value))return!1}return!0}return!1}[ae](){return fr(dZ^this._root.subtreeHash())}[Ie](){return Lt(this)}toString(){return`HashMap(${L(Array.from(this))})`}toJSON(){return{_id:\"HashMap\",values:Array.from(this).map(([t,r])=>[Lt(t),Lt(r)])}}pipe(){return K(this,arguments)}},eN=new MT,UT=e=>k(e,_g),NT=()=>new dd(!1,0,eN,0);var tN=e=>{let t=eN,r=0,n={value:!1};for(let[o,s]of e){let a=H(o);n.value=!1,t=t.set(NaN,0,a,o,s,n),n.value&&r++}return new dd(!1,0,t,r)};var rN=f(2,(e,t)=>e._root.get(0,H(t),t));var DT=f(2,(e,t)=>e._root.has(0,H(t),t));var hZ=(e,t,r,n)=>{let o=e,s={value:!1},a=o._editable?o._edit:NaN,i=o._root.set(a,0,r,t,n,s);return o._editable?(o._root=i,s.value&&o._size++,e):o._root===i?e:new dd(!1,o._edit,i,o._size+(s.value?1:0))},LT=f(3,(e,t,r)=>hZ(e,t,H(t),r)),$T=e=>new Rg(e._root,_);var nN=e=>e[Symbol.iterator](),Mg=e=>e.size;var sN=UT;var BT=tN;var yZ=nN,md=e=>Array.from(yZ(e)),aN=Mg;var hd=\"~effect/HashSet\",bZ=Ne(hd),SZ={[ae](){return fr(oe(bZ,H(Pg(this))))},[ie](e){return jT(e)&&Fg(this)===Fg(e)&&uN(this,t=>cN(e,t))},[Symbol.iterator](){return $T(Pg(this))},toString(){return`HashSet(${L(Array.from(this))})`},toJSON(){return{_id:\"HashSet\",values:Lt(Array.from(this))}},[Ie](){return this.toJSON()},pipe(){return K(this,arguments)}},EZ=e=>{let t=Object.create(SZ);return t[hd]=hd,t.keyMap=e,t},jT=e=>k(e,hd),Pg=e=>e.keyMap;var iN=e=>{let t=NT();for(let r of e)t=LT(t,r,!0);return EZ(t)},cN=(e,t)=>DT(Pg(e),t);var Fg=e=>Mg(Pg(e));var uN=(e,t)=>{for(let r of e)if(!t(r))return!1;return!0};var qT=iN,fN=jT;var lN=Fg;var WT=\"~effect/http/Cookies\",Of=e=>k(e,WT),JT=\"~effect/http/Cookies/Cookie\",dN=e=>k(e,JT),pN=\"~effect/http/Cookies/CookieError\",GT=class extends Lh{},Rc=class e extends rn(\"CookiesError\"){static fromReason(t,r){return new e({reason:new GT({_tag:t,cause:r})})}[pN]=pN;get message(){return this.reason._tag}};var TZ={[WT]:WT,...hu,toJSON(){return{_id:\"effect/Cookies\",cookies:Uu(this.cookies,e=>e.toJSON())}},pipe(){return K(this,arguments)}},Ga=e=>{let t=Object.create(TZ);return t.cookies=e,t},Ug=e=>{let t={};for(let r of e)w(t,r.name,r);return Ga(t)},mN=e=>{let t=typeof e==\"string\"?[e]:e,r=[];for(let n of t){let o=wZ(n.trim());o&&r.push(o)}return Ug(r)};function wZ(e){let t=e.split(\";\").map(i=>i.trim()).filter(i=>i!==\"\");if(t.length===0)return;let r=t[0].indexOf(\"=\");if(r===-1)return;let n=t[0].slice(0,r);if(!hN.test(n))return;let o=t[0].slice(r+1),s=MZ(o);if(t.length===1)return Object.assign(Object.create(KT),{name:n,value:s,valueEncoded:o});let a={};for(let i=1;i<t.length;i++){let c=t[i],u=c.indexOf(\"=\"),l=u===-1?c:c.slice(0,u).trim(),p=u===-1?void 0:c.slice(u+1).trim();switch(l.toLowerCase()){case\"domain\":{if(p===void 0)break;let d=p.trim().replace(/^\\./,\"\");d&&(a.domain=d);break}case\"expires\":{if(p===void 0)break;let d=new Date(p);isNaN(d.getTime())||(a.expires=d);break}case\"max-age\":{if(p===void 0)break;let d=parseInt(p,10);isNaN(d)||(a.maxAge=Fh(d));break}case\"path\":{if(p===void 0)break;p[0]===\"/\"&&(a.path=p);break}case\"priority\":{if(p===void 0)break;switch(p.toLowerCase()){case\"low\":a.priority=\"low\";break;case\"medium\":a.priority=\"medium\";break;case\"high\":a.priority=\"high\";break}break}case\"httponly\":{a.httpOnly=!0;break}case\"secure\":{a.secure=!0;break}case\"partitioned\":{a.partitioned=!0;break}case\"samesite\":{if(p===void 0)break;switch(p.toLowerCase()){case\"lax\":a.sameSite=\"lax\";break;case\"strict\":a.sameSite=\"strict\";break;case\"none\":a.sameSite=\"none\";break}break}}}return Object.assign(Object.create(KT),{name:n,value:s,valueEncoded:o,options:Object.keys(a).length>0?a:void 0})}var ppe=Ug([]),dpe=e=>o_(e.cookies),kZ=/^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/,hN=/^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/,CZ=/^[\\u0009\\u0020-\\u003a\\u003c-\\u007e\\u0080-\\u00ff]+$/,AZ=/^[\\u0020-\\u003a\\u003c-\\u007e]+$/,KT={[JT]:JT,...hu,toJSON(){return{_id:\"effect/Cookies/Cookie\",name:this.name,value:this.value,options:this.options}}};function VT(e,t,r){let n=encodeURIComponent(t),o=xN(e,n,r);return o!==void 0?D(o):P(Object.assign(Object.create(KT),{name:e,value:t,valueEncoded:n,options:r}))}function xN(e,t,r){if(!hN.test(e))return Rc.fromReason(\"InvalidCookieName\");if(t&&!kZ.test(t))return Rc.fromReason(\"InvalidCookieValue\");if(r?.domain!==void 0&&!CZ.test(r.domain))return Rc.fromReason(\"InvalidCookieDomain\");if(r?.path!==void 0&&!AZ.test(r.path))return Rc.fromReason(\"InvalidCookiePath\");if(r?.maxAge!==void 0&&!Ls(ye(r.maxAge)))return Rc.fromReason(\"CookieInfinityMaxAge\")}var ZT=(e,t,r)=>Ds(VT(e,t,r));var mpe=f(2,(e,t)=>Ga({...e.cookies,...t.cookies})),hpe=f(2,(e,t)=>Ga(a_(e.cookies,t)));var vZ=f(e=>Of(e[0]),(e,t,r,n)=>mt(VT(t,r,n),o=>Ga(dE(e.cookies,t,o)))),OZ=f(e=>Of(e[0]),(e,t,r,n)=>Ga(dE(e.cookies,t,ZT(t,r,n)))),xpe=f(e=>Of(e[0]),(e,t,r)=>vZ(e,t,\"\",{...r,maxAge:0,expires:new Date(0)})),gpe=f(e=>Of(e[0]),(e,t,r)=>OZ(e,t,\"\",{...r,maxAge:0,expires:new Date(0)})),_Z=f(2,(e,t)=>{let r={...e.cookies};for(let[n,o,s]of t){let a=VT(n,o,s);if(Q(a))return a;w(r,n,a.success)}return P(Ga(r))}),ype=f(2,(e,t)=>Ds(_Z(e,t)));function RZ(e){let t=xN(e.name,e.valueEncoded,e.options);if(t!==void 0)throw t;let r=e.name+\"=\"+e.valueEncoded;if(e.options===void 0)return r;let n=e.options;if(n.maxAge!==void 0){let o=EE(ye(n.maxAge));r+=\"; Max-Age=\"+Math.trunc(o)}if(n.domain!==void 0&&(r+=\"; Domain=\"+n.domain),n.path!==void 0&&(r+=\"; Path=\"+n.path),n.priority!==void 0)switch(n.priority){case\"low\":r+=\"; Priority=Low\";break;case\"medium\":r+=\"; Priority=Medium\";break;case\"high\":r+=\"; Priority=High\";break}if(n.expires!==void 0&&(r+=\"; Expires=\"+n.expires.toUTCString()),n.httpOnly&&(r+=\"; HttpOnly\"),n.secure&&(r+=\"; Secure\"),n.partitioned&&(r+=\"; Partitioned\"),n.sameSite!==void 0)switch(n.sameSite){case\"lax\":r+=\"; SameSite=Lax\";break;case\"strict\":r+=\"; SameSite=Strict\";break;case\"none\":r+=\"; SameSite=None\";break}return r}var bpe=e=>Object.values(e.cookies).map(t=>`${t.name}=${t.valueEncoded}`).join(\"; \"),gN=e=>{let t={},r=Object.values(e.cookies);for(let n=0;n<r.length;n++){let o=r[n];w(t,o.name,o.value)}return t},yN=e=>Object.values(e.cookies).map(RZ);var MZ=e=>{try{return decodeURIComponent(e)}catch{return e}};var TN={};Ae(TN,{CurrentRedactedNames:()=>IN,Equivalence:()=>$g,TypeId:()=>Lg,empty:()=>SN,fromInput:()=>Bg,fromRecordUnsafe:()=>DZ,get:()=>$Z,has:()=>LZ,isHeaders:()=>XT,isRedactedName:()=>WZ,merge:()=>jZ,redact:()=>EN,remove:()=>qZ,removeMany:()=>HZ,set:()=>BZ,setAll:()=>zZ});var Dg={};Ae(Dg,{isRedacted:()=>Ng,make:()=>Va,makeEquivalence:()=>YT,value:()=>Mc,wipeUnsafe:()=>NZ});var Ka=new WeakMap,QT=e=>{if(Ka.has(e))return Ka.get(e);throw new Error(\"Unable to get redacted value\"+(e.label?` with label: \"${e.label}\"`:\"\"))},Spe=e=>typeof e==\"string\"?e:QT(e);var bN=\"~effect/Redacted\",Ng=e=>k(e,bN),Va=(e,t)=>{let r=Object.create(UZ);return t?.label&&(r.label=t.label),Ka.set(r,e),r},UZ={[bN]:{_A:e=>e},label:void 0,...$t,toJSON(){return this.toString()},toString(){return`<redacted${ur(this.label)?\":\"+this.label:\"\"}>`},[ae](){return H(Ka.get(this))},[ie](e){return Ng(e)&&J(Ka.get(this),Ka.get(e))}},Mc=QT,NZ=e=>Ka.delete(e),YT=e=>Bt((t,r)=>e(Mc(t),Mc(r)));var Lg=Symbol.for(\"~effect/http/Headers\"),XT=e=>k(e,Lg),xd=Object.defineProperties(Object.create(null),{[Lg]:{value:Lg},[Ii]:{value(e){return EN(this,Te(e,IN))}},toJSON:{value(){return $n(this)}},[ie]:{value(e){return $g(this,e)}},[ae]:{value(){return Ll(this)}},toString:{value:hu.toString},[Ie]:{value:hu[Ie]}}),gd=e=>Object.assign(Object.create(xd),e),$g=c_(Ps()),SN=Object.create(xd),Bg=e=>{if(e===void 0)return SN;if(Symbol.iterator in e){let r=Object.create(xd);for(let[n,o]of e)r[n.toLowerCase()]=o;return r}let t=Object.create(xd);for(let[r,n]of Object.entries(e))Array.isArray(n)?t[r.toLowerCase()]=n.join(\", \"):n!==void 0&&(t[r.toLowerCase()]=n);return t},DZ=e=>Object.setPrototypeOf(e,xd),LZ=f(2,(e,t)=>t.toLowerCase()in e),$Z=f(2,(e,t)=>Ns(e[t.toLowerCase()])),BZ=f(3,(e,t,r)=>{let n=gd(e);return n[t.toLowerCase()]=r,n}),zZ=f(2,(e,t)=>gd({...e,...Bg(t)})),jZ=f(2,(e,t)=>{let r=gd(e);return Object.assign(r,t),r}),qZ=f(2,(e,t)=>{let r=gd(e);return delete r[t.toLowerCase()],r}),HZ=f(2,(e,t)=>{let r=gd(e);for(let n of t)delete r[n.toLowerCase()];return r}),EN=f(2,(e,t)=>{let r={...e},n=o=>{if(typeof o==\"string\"){let s=o.toLowerCase();s in e&&(r[s]=Va(e[s]))}else for(let s in e)s.search(o)!==-1&&(r[s]=Va(e[s]))};if(Array.isArray(t))for(let o=0;o<t.length;o++)n(t[o]);else n(t);return r}),WZ=(e,t)=>{for(let r=0;r<t.length;r++){let n=t[r];if(typeof n==\"string\"){if(n.toLowerCase()===e.toLowerCase())return!0}else if(e.search(n)!==-1)return!0}return!1},IN=Ee(\"effect/Headers/CurrentRedactedNames\",{defaultValue:()=>[\"authorization\",\"cookie\",\"set-cookie\",\"x-api-key\"]});var ew=\"~effect/http/UrlParams\",tw=e=>k(e,ew),JZ={...$t,[ew]:ew,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:\"UrlParams\",params:Object.fromEntries(this.params)}},[ie](e){return rw(this,e)},[ae](){return xr(this.params.flat())}},ra=e=>{let t=Object.create(JZ);return t.params=e,t},yd=e=>{if(tw(e))return e;let t=wN(e),r=[];for(let n=0;n<t.length;n++)if(Array.isArray(t[n][0])){let[o,s]=t[n];r.push([`${o[0]}[${o.slice(1).join(\"][\")}]`,s])}else r.push(t[n]);return ra(r)},wN=e=>{let t=typeof e[Symbol.iterator]==\"function\"?Se(e):Object.entries(e),r=[];for(let[n,o]of t)if(Array.isArray(o))for(let s=0;s<o.length;s++)o[s]!==void 0&&r.push([n,String(o[s])]);else if(o!==null&&typeof o==\"object\"){let s=wN(o);for(let[a,i]of s)r.push([[n,...typeof a==\"string\"?[a]:a],i])}else o!==void 0&&r.push([n,String(o)]);return r},rw=Bt((e,t)=>GZ(e.params,t.params)),GZ=p_(YO([Ps(),Ps()])),Ape=ra([]);var kN=f(2,(e,t)=>gE(e.params,([r])=>r===t).pipe(Jt(([,r])=>r)));var vpe=f(3,(e,t,r)=>ra(Oa(Bi(e.params,([n])=>n!==t),[t,String(r)]))),KZ=f(2,(e,t)=>ra(t(e.params))),Ope=f(2,(e,t)=>{let r=yd(t).params.slice(),n=new Set;for(let o=0;o<r.length;o++)n.add(r[o][0]);for(let o=0;o<e.params.length;o++)n.has(e.params[o][0])||r.push(e.params[o]);return ra(r)}),_pe=f(3,(e,t,r)=>ra(Oa(e.params,[t,String(r)]))),Rpe=f(2,(e,t)=>KZ(e,kh(yd(t).params)));var Mpe=e=>new URLSearchParams(yd(e).params).toString(),VZ=e=>{let t={};for(let[r,n]of e.params)if(!Object.hasOwn(t,r))w(t,r,n);else{let o=t[r];typeof o==\"string\"?w(t,r,[o,n]):o.push(n)}return t},CN=VZ;var nw=\"~effect/Graph\",ow=e=>k(e,nw),AN=e=>e;var QZ=(e,t,r)=>(e===\"directed\"?t.source===r.source&&t.target===r.target:t.source===r.source&&t.target===r.target||t.source===r.target&&t.target===r.source)&&J(t.data,r.data),YZ=(e,t)=>e===\"directed\"?H(t):fr(oe(H(t.data),XZ(t.source,t.target))),XZ=(e,t)=>oe(0,H(e))+oe(0,H(t)),e5=Ne(\"Graph\"),t5={[nw]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[Ie](){return this.toJSON()},[ie](e){if(k(e,nw)){let t=AN(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[r,n]of this.nodes)if(!t.nodes.has(r)||!J(n,t.nodes.get(r)))return!1;for(let[r,n]of this.edges){let o=t.edges.get(r);if(o===void 0||!QZ(this.type,n,o))return!1}return!0}return!1},[ae](){let e=e5;e=e^Ne(this.type),e=e^Dt(this.nodes.size),e=e^Dt(this.edges.size);for(let[t,r]of this.nodes)e^=oe(H(t),H(r));for(let[t,r]of this.edges)e^=oe(H(t),YZ(this.type,r));return fr(e)},toJSON(){return{_id:\"Graph\",nodeCount:this.nodes.size,edgeCount:this.edges.size,type:this.type}},toString(){return`Graph(${this.type}, ${this.nodes.size}, ${this.edges.size})`},pipe(){return K(this,arguments)}},r5=(e,t)=>{let r=Object.create(t5);return r.type=e,r.mutable=t,r.transforming=!1,r.nodes=new Map,r.edges=new Map,r.adjacency=new Map,r.reverseAdjacency=new Map,r.nextNodeIndex=0,r.nextEdgeIndex=0,r.acyclic=O(!0),r};var bd=e=>{let t=AN(e);return{type:e.type,nodes:Array.from(t.nodes,([r,n])=>({index:r,data:n})).sort((r,n)=>r.index-n.index),edges:Array.from(t.edges,([r,n])=>({index:r,source:n.source,target:n.target,data:n.data})).sort((r,n)=>r.index-n.index)}},zg=e=>{let t=r5(e.type,!1);for(let r of e.nodes)t.nodes.set(r.index,r.data),t.adjacency.set(r.index,[]),t.reverseAdjacency.set(r.index,[]);for(let r of e.edges)t.edges.set(r.index,{source:r.source,target:r.target,data:r.data}),t.adjacency.get(r.source).push(r.index),t.reverseAdjacency.get(r.target).push(r.index),e.type===\"undirected\"&&(t.adjacency.get(r.target).push(r.index),t.reverseAdjacency.get(r.source).push(r.index));return t.nextNodeIndex=e.nodes.length===0?0:e.nodes[e.nodes.length-1].index+1,t.nextEdgeIndex=e.edges.length===0?0:e.edges[e.edges.length-1].index+1,t.acyclic=v(),t};function gs(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function _f(e){return t=>gs(t)?.[e]}var un=\"~structural\",Pc=\"~identifier\",Sd=\"~sentinels\",jg=\"~constructor\",vN=[\"title\",\"description\",\"default\",\"examples\",\"readOnly\",\"writeOnly\",\"format\",\"contentEncoding\",\"contentMediaType\",\"contentSchema\"],Fc=_f(\"identifier\"),sw=_f(Pc),qg=_f(\"title\"),ON=_f(\"description\"),Ed=Tn(e=>{let t=gs(e)?.identifier;return typeof t==\"string\"?t:e.getExpected(Ed)}),_N=new Set([Sd,un,\"representation\",\"arbitraryConstraint\",\"toJsonSchema\",\"toCode\",\"toEquivalence\",\"toFormatter\",\"toCodec\",\"toCodecJson\",\"toCodecStringTree\",\"toCodecIso\",\"toCodecArbitrary\"]);var xn={};Ae(xn,{Any:()=>XN,Arrays:()=>Nn,BigInt:()=>iD,Boolean:()=>sD,Context:()=>Po,Declaration:()=>zc,Enum:()=>vk,FINITE_PATTERN:()=>Bd,Filter:()=>$d,FilterGroup:()=>ei,IndexSignature:()=>my,Json:()=>$c,Link:()=>pt,Literal:()=>dn,MutableJson:()=>eC,Never:()=>YN,Null:()=>KN,Number:()=>oD,ObjectKeyword:()=>tD,Objects:()=>Df,PropertySignature:()=>dy,STRING_PATTERN:()=>Qk,String:()=>nD,Suspend:()=>xy,Symbol:()=>aD,TemplateLiteral:()=>ly,Undefined:()=>VN,Union:()=>Yr,UniqueSymbol:()=>_k,Unknown:()=>eD,Void:()=>QN,annotate:()=>so,annotateKey:()=>zf,any:()=>Ck,appendChecks:()=>Uo,applyToLastLink:()=>by,applyToSelfOrLastLinkEncoding:()=>zk,applyToSelfOrLastLinkEncodingIdempotent:()=>ni,bigInt:()=>Pk,bigIntString:()=>ky,boolean:()=>Rk,collectIssues:()=>ao,collectSentinels:()=>Lc,containsUndefined:()=>Vk,decodeTo:()=>sa,defaultParseOptions:()=>Fo,finite:()=>yy,flip:()=>mn,getAST:()=>Lf,getCandidateIndex:()=>$f,getConstructorDescriptor:()=>Xk,getContextOwner:()=>jc,getIndexSignatureKeys:()=>oa,getLastEncoding:()=>qc,isAST:()=>L5,isAny:()=>q5,isArrays:()=>iy,isBigInt:()=>G5,isBoolean:()=>J5,isDeclaration:()=>Bc,isEnum:()=>Z5,isFinite:()=>gy,isJson:()=>Wc,isLiteral:()=>Dc,isMutable:()=>Kk,isNever:()=>JN,isNull:()=>$5,isNumber:()=>W5,isObjectKeyword:()=>V5,isObjects:()=>GN,isOptional:()=>ir,isPattern:()=>Bf,isString:()=>H5,isStringBigInt:()=>wy,isStringFinite:()=>Ty,isStringSymbol:()=>Cy,isStringTree:()=>TD,isSuspend:()=>wk,isSymbol:()=>K5,isTemplateLiteral:()=>Q5,isUndefined:()=>B5,isUnion:()=>Tk,isUniqueSymbol:()=>oy,isUnknown:()=>j5,isVoid:()=>z5,makeFilter:()=>qd,makeFilterByGuard:()=>Hd,mapLink:()=>Hc,mapOrSame:()=>ti,middlewareDecoding:()=>jk,middlewareEncoding:()=>qk,mutable:()=>Dk,mutableKey:()=>Sy,never:()=>fy,null:()=>cy,number:()=>py,objectKeyword:()=>Ak,objectKeywordToJson:()=>tC,optional:()=>Wk,optionalKey:()=>oi,parameterFromPropertyKey:()=>Iy,parameterFromString:()=>Gd,parseArray:()=>fD,parseProperties:()=>yk,record:()=>Gk,replaceChecks:()=>$k,replaceContext:()=>ri,replaceContextLastLink:()=>Jd,replaceEncoding:()=>Ve,resolve:()=>y8,resolveAt:()=>b8,resolveDescription:()=>I8,resolveIdentifier:()=>S8,resolveTitle:()=>E8,runChecks:()=>Yk,stepArray:()=>cD,stepProperty:()=>ay,string:()=>pn,struct:()=>zd,structWithRest:()=>Uk,symbol:()=>Mk,symbolString:()=>SD,templateLiteralParser:()=>Ok,toEncoded:()=>hn,toType:()=>wt,tuple:()=>hy,tupleWithRest:()=>Nk,undefined:()=>uy,union:()=>jd,unknown:()=>oo,unknownToJson:()=>Ay,unknownToStringTree:()=>vy,void:()=>kk,withConstructorDefault:()=>Jk});var no={};Ae(no,{AnyOf:()=>Ff,Composite:()=>Rt,Encoding:()=>uw,Filter:()=>cw,Forbidden:()=>Pf,InvalidType:()=>xt,InvalidValue:()=>se,MissingKey:()=>ys,OneOf:()=>fw,Pointer:()=>ht,UnexpectedKey:()=>Jg,defaultCheckHook:()=>dw,defaultFormatter:()=>gw,defaultLeafHook:()=>pw,hasInput:()=>RN,isIssue:()=>Wg,makeCompositeAtKey:()=>Qr,makeFormatterDefault:()=>MN,makeFormatterStandardSchemaV1:()=>mw,makeSingle:()=>Gg,normalizeFilterOutput:()=>lw});var xe=Symbol();var dr=Rr,fn=dr(xe),Ke=dr(xe),Id=e=>e===xe?v():O(e),aw=e=>e._tag===\"None\"?fn:dr(e.value);var kd=\"~effect/SchemaIssue/Issue\";function Wg(e){return k(e,kd)&&e[kd]===kd}function RN(e){return Object.hasOwn(e,\"input\")}var Un=class{[kd]=kd;constructor(t,r){r?.reportInput===!0&&t!==xe&&(this.input=t)}},cw=class extends Un{_tag=\"Filter\";filter;issue;constructor(e,t,r,n){super(r,n),this.filter=e,this.issue=t}},uw=class extends Un{_tag=\"Encoding\";ast;issue;constructor(e,t,r,n){super(r,n),this.ast=e,this.issue=t}},ht=class extends Un{_tag=\"Pointer\";path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},ys=class extends Un{_tag=\"MissingKey\";annotations;constructor(e){super(),this.annotations=e}},Jg=class extends Un{_tag=\"UnexpectedKey\";ast;constructor(e,t,r){super(t,r),this.ast=e}},Rt=class extends Un{_tag=\"Composite\";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},xt=class extends Un{_tag=\"InvalidType\";ast;constructor(e,t,r){super(t,r),this.ast=e}},se=class extends Un{_tag=\"InvalidValue\";annotations;constructor(e,t,r){super(t,r),this.annotations=e}};function Qr(e,t,r,n,o){return new Rt(e,[new ht([t],r)],n,o)}var Pf=class extends Un{_tag=\"Forbidden\";annotations;constructor(e,t,r){super(t,r),this.annotations=e}},Ff=class extends Un{_tag=\"AnyOf\";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},fw=class extends Un{_tag=\"OneOf\";ast;successes;constructor(e,t,r,n){super(r,n),this.ast=e,this.successes=t}};function iw(e,t,r){if(Wg(e))return e;if(typeof e==\"string\")return new se({message:e},t,r);let n=typeof e.issue==\"string\"?new se({message:e.issue},t,r):e.issue;return new ht(e.path,n)}function Gg(e,t,r){if(e!==void 0)return typeof e==\"boolean\"?e?void 0:new se(void 0,t,r):iw(e,t,r)}function lw(e,t,r,n){return Array.isArray(t)?ut(t)?t.length===1?iw(t[0],r,n):new Rt(e,tn(t,o=>iw(o,r,n)),r,n):void 0:Gg(t,r,n)}var pw=e=>{let t=Mf(e);if(t!==void 0)return t;switch(e._tag){case\"InvalidType\":return Qa(Ed(e.ast),e);case\"InvalidValue\":{let r=hw(e);if(r!==void 0)return Qa(r,e);let n=Hg(e);return n===void 0?\"Expected a valid value\":`Invalid data ${n}`}case\"MissingKey\":return\"Missing key\";case\"UnexpectedKey\":{let r=Hg(e);return r===void 0?\"Expected no excess property\":`Unexpected key with value ${r}`}case\"Forbidden\":return\"Forbidden operation\";case\"OneOf\":{let r=Hg(e);return r===void 0?\"Expected exactly one member to match\":`Expected exactly one member to match the input ${r}`}}},dw=e=>Mf(e.issue)??Mf(e);function mw(e){return t=>({issues:Rf(t,[],e?.leafHook??pw,e?.checkHook??dw)})}function Hg(e){return RN(e)?L(e.input):void 0}function hw(e){let t=e.annotations?.expected;return typeof t==\"string\"?t:void 0}function Qa(e,t){let r=Hg(t);return r===void 0?`Expected ${e}`:`Expected ${e}, got ${r}`}function Rf(e,t,r,n){switch(e._tag){case\"Filter\":{let o=n(e);if(o!==void 0)return[{path:t,message:o}];if(e.issue._tag!==\"InvalidValue\")return Rf(e.issue,t,r,n);let s=hw(e.issue);return[{path:t,message:s===void 0?Qa(xw(e.filter),e):Qa(s,e.issue)}]}case\"Encoding\":return Rf(e.issue,t,r,n);case\"Pointer\":return Rf(e.issue,[...t,...e.path],r,n);case\"Composite\":return e.issues.flatMap(o=>Rf(o,t,r,n));case\"AnyOf\":return e.issues.length===0?[{path:t,message:Mf(e)??Qa(Ed(e.ast),e)}]:e.issues.flatMap(o=>Rf(o,t,r,n));default:return[{path:t,message:r(e)}]}}function xw(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(r=>xw(r)).join(\" & \")}}function MN(){return e=>wd(e,\"\")}var gw=MN();function wd(e,t){let r;switch(e._tag){case\"Filter\":{let n=dw(e);if(n!==void 0)r=n;else{if(e.issue._tag!==\"InvalidValue\")return wd(e.issue,t);let o=hw(e.issue);r=o===void 0?Qa(xw(e.filter),e):Qa(o,e.issue)}break}case\"Encoding\":return wd(e.issue,t);case\"Pointer\":return wd(e.issue,t+oh(e.path));case\"Composite\":case\"AnyOf\":{if(e._tag===\"Composite\"||e.issues.length>0)return e.issues.map(n=>wd(n,t)).join(`\n`);r=Mf(e)??Qa(Ed(e.ast),e);break}default:r=pw(e);break}return t?`${r}\n  at ${t}`:r}function Mf(e){if(e._tag===\"Pointer\")return;if(e._tag===\"Encoding\")return Mf(e.issue);let r=(e._tag===\"Filter\"?e.filter.annotations:\"annotations\"in e?e.annotations:e.ast.annotations)?.[e._tag===\"MissingKey\"?\"messageMissingKey\":e._tag===\"UnexpectedKey\"?\"messageUnexpectedKey\":\"message\"];if(typeof r==\"string\")return r}function Cd(e){let t;for(let r of e.reasons){if(!Bp(r)||!Wg(r.error))return;t??=r.error}return t}function ln(e,t){let r=Cd(e);if(r===void 0)throw new Error(t,{cause:e});return r}var bs={};Ae(bs,{BigInt:()=>Iw,Boolean:()=>d5,Date:()=>Qg,Number:()=>_d,String:()=>Xa,camelToSnake:()=>Aw,capitalize:()=>ww,checkEffect:()=>p5,collectBracketPathEntries:()=>Kw,compose:()=>Ya,dateTimeUtcFromInput:()=>m5,decodeBase64:()=>Uw,decodeBase64String:()=>Nw,decodeBase64Url:()=>Dw,decodeBase64UrlString:()=>Lw,decodeFormData:()=>qw,decodeHex:()=>$w,decodeHexString:()=>Bw,decodeURLSearchParams:()=>Ww,decodeUriComponent:()=>jw,encodeBase64:()=>Yg,encodeBase64Url:()=>Rd,encodeFormData:()=>Hw,encodeHex:()=>Md,encodeURLSearchParams:()=>Jw,encodeUriComponent:()=>zw,fail:()=>NN,forbidden:()=>vd,forbiddenEncoding:()=>Sw,joinKeyValue:()=>Pw,makeTreeRecord:()=>Gw,map:()=>i5,omit:()=>Vg,parseJson:()=>_w,passthrough:()=>ar,passthroughSubtype:()=>f5,passthroughSupertype:()=>u5,required:()=>l5,run:()=>a5,snakeToCamel:()=>Cw,split:()=>Fw,splitKeyValue:()=>Mw,stringifyJson:()=>Rw,succeed:()=>c5,toLowerCase:()=>vw,toUpperCase:()=>Ow,transform:()=>Y,transformEffect:()=>lt,transformOptional:()=>na,transformOptionalEffect:()=>Od,trim:()=>Tw,uncapitalize:()=>kw,withDefault:()=>Zg});var FN=e=>Ac(e).replace(/=/g,\"\").replace(/\\+/g,\"-\").replace(/\\//g,\"_\"),yw=e=>{let t=e.replace(/[\\n\\r]/g,\"\"),r=t.length;if(r%4===1)return D(new Wn({module:\"Base64Url\",kind:\"Decode\",input:t,message:`Length should be a multiple of 4, but is ${r}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return D(new Wn({module:\"Base64Url\",kind:\"Decode\",input:t,message:\"Invalid input\"}));let n=r%4===2?`${t}==`:r%4===3?`${t}=`:t;return n=n.replace(/-/g,\"+\").replace(/_/g,\"/\"),Wa(n)},UN=e=>mt(yw(e),t=>o5.decode(t)),o5=new TextDecoder;var bw=(e,t,r)=>{switch(e._tag){case\"Passthrough\":return b(t);case\"Transform\":return b(Jt(t,e.transform));case\"TransformOptional\":return b(e.transform(t));case\"TransformEffect\":return fe(t)?za:Fn(e.transform(t.value,r),O);case\"TransformOptionalEffect\":return e.transform(t,r)}},a5=f(3,bw),Ad=e=>Object.assign(Object.create(kS),e),Kg=(e,t)=>Od((r,n)=>ft(bw(e,r,n),o=>bw(t,o,n))),Ya=f(2,(e,t)=>{if(e._tag===\"Passthrough\")return t;if(t._tag===\"Passthrough\")return e;switch(e._tag){case\"Transform\":switch(t._tag){case\"Transform\":return Y(r=>t.transform(e.transform(r)));case\"TransformOptional\":return na(r=>t.transform(Jt(r,e.transform)));case\"TransformEffect\":return lt((r,n)=>t.transform(e.transform(r),n));case\"TransformOptionalEffect\":return Kg(e,t)}case\"TransformOptional\":switch(t._tag){case\"Transform\":return na(r=>Jt(e.transform(r),t.transform));case\"TransformOptional\":return na(r=>t.transform(e.transform(r)));case\"TransformEffect\":case\"TransformOptionalEffect\":return Kg(e,t)}case\"TransformEffect\":switch(t._tag){case\"Transform\":return lt((r,n)=>Fn(e.transform(r,n),t.transform));case\"TransformOptional\":case\"TransformOptionalEffect\":return Kg(e,t);case\"TransformEffect\":return lt((r,n)=>ft(e.transform(r,n),o=>t.transform(o,n)))}case\"TransformOptionalEffect\":return Kg(e,t)}}),i5=f(2,(e,t)=>Ya(e,Y(t)));function c5(e){return na(()=>O(e))}function NN(e){return Od((t,r)=>N(e(t,r)))}function vd(e){return NN((t,r)=>{let n={message:e(t)};return Ue(t)?new Pf(n,t.value,r):new Pf(n)})}var Sw=vd(()=>\"Encoding is not supported\"),Ew=Ad({_tag:\"Passthrough\"});function ar(){return Ew}function u5(){return Ew}function f5(){return Ew}function l5(e){return Od(t=>fe(t)?N(new ys(e)):b(t))}function p5(e){return lt((t,r)=>e(t,r).pipe(ft(n=>{let o=Gg(n,t,r);return o?N(o):b(t)})))}function Y(e){return Ad({_tag:\"Transform\",transform:e})}function lt(e){return Ad({_tag:\"TransformEffect\",transform:e})}function na(e){return Ad({_tag:\"TransformOptional\",transform:e})}function Od(e){return Ad({_tag:\"TransformOptionalEffect\",transform:e})}function Vg(){return na(()=>v())}function Zg(e){return Od(t=>{let r=Li(t,kr);return Ue(r)?b(r):Fn(e,O)})}function Xa(){return Y(globalThis.String)}function _d(){return Y(globalThis.Number)}function d5(){return Y(globalThis.Boolean)}function Iw(){return Y(globalThis.BigInt)}function Qg(){return Y(e=>new globalThis.Date(e))}function Tw(){return Y(UF)}function ww(){return Y(PF)}function kw(){return Y(FF)}function Cw(){return Y(DF)}function Aw(){return Y(LF)}function vw(){return Y(Gp)}function Ow(){return Y(v0)}function _w(e){return lt((t,r)=>Ef({try:()=>JSON.parse(t,e?.reviver),catch:()=>new se({expected:\"a valid JSON string\"},t,r)}))}function Rw(e){return lt((t,r)=>Ef({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw new TypeError(\"Value cannot be represented as JSON\");return n},catch:()=>new se({expected:\"a JSON-serializable value\"},t,r)}))}function Mw(e){let t=e?.separator??\",\",r=e?.keyValueSeparator??\"=\";return Y(n=>n.split(t).reduce((o,s)=>{let[a,i]=s.split(r);return a&&i&&w(o,a,i),o},{}))}function Pw(e){let t=e?.separator??\",\",r=e?.keyValueSeparator??\"=\";return Y(n=>Object.entries(n).map(([o,s])=>`${o}${r}${s}`).join(t))}function Fw(e){let t=e?.separator??\",\";return Y(r=>r===\"\"?[]:r.split(t))}function Yg(){return Y(Ac)}function Rd(){return Y(FN)}function Md(){return Y(vE)}function Uw(){return lt((e,t)=>id(nd(Wa(e)),()=>new se({expected:\"a valid Base64 string\"},e,t)))}function Nw(){return lt((e,t)=>rr(RT(e),{onFailure:()=>N(new se({expected:\"a valid Base64 string\"},e,t)),onSuccess:b}))}function Dw(){return lt((e,t)=>rr(yw(e),{onFailure:()=>N(new se({expected:\"a valid Base64Url string\"},e,t)),onSuccess:b}))}function Lw(){return lt((e,t)=>rr(UN(e),{onFailure:()=>N(new se({expected:\"a valid Base64Url string\"},e,t)),onSuccess:b}))}function $w(){return lt((e,t)=>rr(Bh(e),{onFailure:()=>N(new se({expected:\"a valid hexadecimal string\"},e,t)),onSuccess:b}))}function Bw(){return lt((e,t)=>rr(OE(e),{onFailure:()=>N(new se({expected:\"a valid hexadecimal string\"},e,t)),onSuccess:b}))}function zw(){return Y(encodeURIComponent)}function jw(){return lt((e,t)=>{try{return b(globalThis.decodeURIComponent(e))}catch{return N(new se({expected:\"a valid URI component\"},e,t))}})}function m5(){return lt((e,t)=>it(wc(e),{onNone:()=>N(new se({message:\"Invalid DateTime input\"},e,t)),onSome:r=>b(kc(r))}))}function qw(){return Y(e=>Gw(Array.from(e.entries())))}var h5=Kw(e=>typeof e==\"string\"||typeof Blob<\"u\"&&e instanceof Blob);function Hw(){return Y(e=>{let t=new FormData;return typeof e==\"object\"&&e!==null&&h5(e).forEach(([n,o])=>{t.append(n,o)}),t})}function Ww(){return Y(e=>Gw(Array.from(e.entries())))}var x5=Kw(ur);function Jw(){return Y(e=>typeof e==\"object\"&&e!==null?new URLSearchParams(x5(e)):new URLSearchParams)}function g5(e){if(e===\"\")return[\"\"];let t=e.replace(/\\[(.*?)\\]/g,\".$1\"),r=t.split(\".\"),n=t.startsWith(\".\")?1:0;return r.slice(n).map(o=>Nu(o)?globalThis.Number(o):o)}function Gw(e){let t={},r=new WeakSet,n=new WeakSet;function o(s,a,i){let c=Object.hasOwn(s,a)?s[a]:void 0;if(r.has(c)&&Array.isArray(c)===i)return c;let u=i?[]:{};return r.add(u),w(s,a,u),u}return e.forEach(([s,a])=>{let i=g5(s),c=t;i.forEach((u,l)=>{let p=l===i.length-1;if(Array.isArray(c)&&u===\"\")if(p)c.push(a);else{let d=i[l+1],m=typeof d==\"number\"||d===\"\",x=c.length;c=o(c,x,m)}else if(p){let d=Object.hasOwn(c,u);if(d&&Array.isArray(c[u])&&(r.has(c[u])||n.has(c[u])))c[u].push(a);else if(d){let m=[c[u],a];n.add(m),w(c,u,m)}else w(c,u,a)}else{let d=i[l+1];c=o(c,u,typeof d==\"number\"||d===\"\")}})}),t}function Kw(e){return t=>{let r=[];function n(o,s){if(e(s))r.push([o,s]);else if(Array.isArray(s))s.every(e)?s.forEach(i=>{r.push([o,i])}):s.forEach((i,c)=>{n(`${o}[${c}]`,i)});else if(typeof s==\"object\"&&s!==null)for(let[a,i]of Object.entries(s))n(`${o}[${a}]`,i)}for(let[o,s]of Object.entries(t))n(o,s);return r}}var Uf={};Ae(Uf,{Middleware:()=>Fd,Transformation:()=>be,bigDecimalFromString:()=>M5,bigintFromString:()=>Dd,byteSizeFromBigInt:()=>Xw,byteSizeFromNumber:()=>ek,byteSizeFromString:()=>ey,capitalize:()=>I5,composeTransformation:()=>y5,dateFromMillis:()=>Yw,dateFromString:()=>Xg,dateTimeUtcFromString:()=>N5,dateTimeZonedFromString:()=>D5,defectFromJson:()=>rk,durationFromMillis:()=>v5,durationFromNanos:()=>A5,durationFromString:()=>C5,errorFromJsonError:()=>tk,fromFormData:()=>dk,fromJsonString:()=>pk,fromURLSearchParams:()=>mk,isTransformation:()=>DN,makeTransformation:()=>Ud,numberFromString:()=>Nc,optionFromNullOr:()=>nk,optionFromNullishOr:()=>sk,optionFromOptional:()=>ik,optionFromOptionalKey:()=>ak,optionFromUndefinedOr:()=>ok,passthrough:()=>Uc,passthroughSubtype:()=>k5,passthroughSupertype:()=>w5,snakeToCamel:()=>b5,splitKeyValue:()=>Zw,stringFromBase64String:()=>ck,stringFromBase64UrlString:()=>uk,stringFromHexString:()=>fk,stringFromUriComponent:()=>lk,timeZoneFromString:()=>U5,timeZoneNamedFromString:()=>F5,timeZoneOffsetFromNumber:()=>P5,toLowerCase:()=>S5,toUpperCase:()=>E5,transform:()=>Oe,transformEffect:()=>ot,transformOptional:()=>Nd,trim:()=>Vw,uint8ArrayFromBase64String:()=>ry,uncapitalize:()=>T5,urlFromString:()=>ty});var Fd=class extends ya{_tag=\"Middleware\";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Fd(this.encode,this.decode)}},Pd=\"~effect/SchemaTransformation/Transformation\",be=class extends ya{[Pd]=Pd;_tag=\"Transformation\";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new be(this.encode,this.decode)}},y5=f(2,(e,t)=>new be(Ya(e.decode,t.decode),Ya(t.encode,e.encode)));function DN(e){return k(e,Pd)&&e[Pd]===Pd}var Ud=e=>DN(e)?e:new be(e.decode,e.encode);function ot(e){return new be(lt(e.decode),lt(e.encode))}function Oe(e){return new be(Y(e.decode),Y(e.encode))}function Nd(e){return new be(na(e.decode),na(e.encode))}function Vw(){return new be(Tw(),ar())}function b5(){return new be(Cw(),Aw())}function S5(){return new be(vw(),ar())}function E5(){return new be(Ow(),ar())}function I5(){return new be(ww(),ar())}function T5(){return new be(kw(),ar())}function Zw(e){return new be(Mw(e),Pw(e))}var Qw=new be(ar(),ar());function Uc(){return Qw}function w5(){return Qw}function k5(){return Qw}var Nc=new be(_d(),Xa()),Dd=new be(Iw(),Xa()),Xg=new be(Qg(),Y(LS)),Yw=new be(Qg(),Y(e=>e.getTime())),C5=ot({decode:(e,t)=>it(ip(e),{onNone:()=>N(new se({expected:\"a valid Duration string\"},e,t)),onSome:b}),encode:e=>b(String(e))}),A5=ot({decode:e=>b(Cn(e)),encode:(e,t)=>it(cp(e),{onNone:()=>N(new se({expected:\"a Duration representable as a bigint\"},e,t)),onSome:r=>b(r)})}),v5=Oe({decode:e=>Kt(e),encode:e=>et(e)}),ey=ot({decode:(e,t)=>it(MU(e),{onNone:()=>N(new se({expected:\"a valid ByteSize string\"},e,t)),onSome:b}),encode:e=>b(`${e} ${e===BigInt(1)?\"byte\":\"bytes\"}`)}),Xw=ot({decode:(e,t)=>it(TT(e),{onNone:()=>N(new se({expected:\"a non-negative bigint byte count\"},e,t)),onSome:b}),encode:e=>b(bg(e))}),ek=ot({decode:(e,t)=>it(TT(e),{onNone:()=>N(new se({expected:\"a non-negative safe-integer byte count\"},e,t)),onSome:b}),encode:(e,t)=>it(UU(e),{onNone:()=>N(new se({expected:\"a ByteSize representable as a safe integer\"},e,t)),onSome:b})}),O5=e=>kt(e)&&typeof e.message==\"string\",LN=e=>{let r=Object.hasOwn(e,\"cause\")?new Error(e.message,{cause:BN(e.cause)}):new Error(e.message);return typeof e.name==\"string\"&&e.name!==\"Error\"&&(r.name=e.name),typeof e.stack==\"string\"&&(r.stack=e.stack),r},_5=e=>{try{let t=Os(e);return t===void 0?L(e):JSON.parse(t)}catch{return L(e)}},R5=(e,t,r)=>{let n={name:e.name,message:typeof e.message==\"string\"?e.message:\"\"};return t?.includeStack&&typeof e.stack==\"string\"&&(n.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(n.cause=r(e.cause)),n},$N=e=>{let t=new WeakSet,r=n=>{if(vS(n)){if(t.has(n))return\"[Circular]\";t.add(n);let o=R5(n,e,r);return t.delete(n),o}return _5(n)};return r},BN=e=>O5(e)?LN(e):e,tk=e=>Oe({decode:LN,encode:t=>$N(e)(t)}),rk=e=>Oe({decode:BN,encode:$N(e)});function nk(){return Oe({decode:ZS,encode:bh})}function ok(){return Oe({decode:Ns,encode:po})}function sk(e){return Oe({decode:Yl,encode:e?.onNoneEncoding===null?bh:po})}function ak(){return Nd({decode:O,encode:Di})}function ik(){return Nd({decode:e=>e.pipe(Li(kr),O),encode:Di})}var ty=ot({decode:(e,t)=>URL.canParse(e)?b(new URL(e)):N(new se({expected:\"a valid URL string\"},e,t)),encode:e=>b(e.href)}),M5=ot({decode:(e,t)=>{let r=hg(e);return fe(r)?N(new se({expected:\"a valid BigDecimal string\"},e,t)):b(r.value)},encode:e=>b(_o(e))}),ry=new be(Uw(),Yg()),ck=new be(Nw(),Yg()),uk=new be(Lw(),Rd()),fk=new be(Bw(),Md()),lk=new be(jw(),zw());function pk(e){return new be(_w(e??{}),Rw(e))}var dk=new be(qw(),Hw()),mk=new be(Ww(),Jw()),P5=Oe({decode:e=>cd(e),encode:e=>e.offset}),F5=ot({decode:(e,t)=>it(Tg(e),{onNone:()=>N(new se({expected:\"a valid IANA time zone\"},e,t)),onSome:b}),encode:e=>b(e.id)}),U5=ot({decode:(e,t)=>it(wg(e),{onNone:()=>N(new se({expected:\"a valid time zone\"},e,t)),onSome:b}),encode:e=>b(Cc(e))}),N5=ot({decode:(e,t)=>it(wc(e),{onNone:()=>N(new se({expected:\"a valid UTC DateTime string\"},e,t)),onSome:r=>b(kc(r))}),encode:e=>b(kg(e))}),D5=ot({decode:(e,t)=>it(Ig(e),{onNone:()=>N(new se({expected:\"a valid Zoned DateTime string\"},e,t)),onSome:b}),encode:e=>b(ud(e))});function qt(e){return t=>t._tag===e}function L5(e){return k(e,Ld)&&e[Ld]===Ld}var Bc=qt(\"Declaration\"),$5=qt(\"Null\"),B5=qt(\"Undefined\"),z5=qt(\"Void\"),JN=qt(\"Never\"),j5=qt(\"Unknown\"),q5=qt(\"Any\"),H5=qt(\"String\"),W5=qt(\"Number\"),J5=qt(\"Boolean\"),G5=qt(\"BigInt\"),K5=qt(\"Symbol\"),Dc=qt(\"Literal\"),oy=qt(\"UniqueSymbol\"),V5=qt(\"ObjectKeyword\"),Z5=qt(\"Enum\"),Q5=qt(\"TemplateLiteral\"),iy=qt(\"Arrays\"),GN=qt(\"Objects\"),Tk=qt(\"Union\"),wk=qt(\"Suspend\"),pt=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},Fo={},Po=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,r=void 0,n=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=r,this.annotations=n}},Ld=\"~effect/Schema\",Tt=class{[Ld]=Ld;annotations;checks;encoding;context;constructor(t=void 0,r=void 0,n=void 0,o=void 0){this.annotations=t,this.checks=r,this.encoding=n,this.context=o}toString(){return`<${this._tag}>`}},zc=class extends Tt{_tag=\"Declaration\";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,r,n,o,s,a,i){super(r,n,o,s),this.typeParameters=e,this.run=t,this.encodingChecks=a,this.encodingRun=i}getParser(){let e;return(t,r)=>t===xe?fn:(e??=this.run(this.typeParameters))(t,this,r)}_rebuild(e,t,r,n,o){let s=ti(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&r===this.encodingChecks&&n===this.run&&o===this.encodingRun?this:new zc(s,n,this.annotations,t,void 0,this.context,r,o)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e==\"string\"?e:\"<Declaration>\"}},KN=class extends Tt{_tag=\"Null\";getParser(){return Ey(this,null)}getExpected(){return\"null\"}},cy=new KN;var VN=class extends Tt{_tag=\"Undefined\";getParser(){return Ey(this,void 0)}toCodecJson(){return Ve(this,[ZN])}getExpected(){return\"undefined\"}},ZN=new pt(cy,new be(Y(()=>{}),Y(()=>null))),uy=new VN;var QN=class extends Tt{_tag=\"Void\";getParser(){let e=dr(void 0);return t=>t===xe?fn:e}toCodecJson(){return Ve(this,[ZN])}getExpected(){return\"void\"}},kk=new QN;var YN=class extends Tt{_tag=\"Never\";getParser(){return No(this,AS)}getExpected(){return\"never\"}},fy=new YN,XN=class extends Tt{_tag=\"Any\";getParser(){return No(this,eh)}getExpected(){return\"any\"}},Ck=new XN,eD=class extends Tt{_tag=\"Unknown\";getParser(){return No(this,eh)}getExpected(){return\"unknown\"}},oo=new eD,tD=class extends Tt{_tag=\"ObjectKeyword\";getParser(){return No(this,du)}getExpected(){return\"object | array | function\"}},Ak=new tD,vk=class extends Tt{_tag=\"Enum\";enums;constructor(e,t,r,n,o){super(t,r,n,o);for(let[,s]of e)if(typeof s==\"number\"&&!globalThis.Number.isFinite(s))throw new Error(`A numeric enum value must be finite, got ${L(s)}`);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return No(this,t=>e.has(t))}toCodecStringTree(){if(this.enums.some(([e,t])=>typeof t==\"number\")){let e=Object.fromEntries(this.enums.map(([t,r])=>[globalThis.String(r),r]));return Ve(this,[new pt(new Yr(Object.keys(e).map(t=>new dn(t))),new be(Y(t=>e[t]),Xa()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(\" | \")}};function hk(e){return typeof e==\"number\"?`parts[${e}]`:e}function xk(e,t,r){if(r.has(e))return!0;if(e.encoding)throw new Error(`TemplateLiteral parts cannot have an encoding at ${hk(t)}`);let n;switch(e._tag){case\"String\":case\"Number\":case\"BigInt\":n=!0;break;case\"Literal\":n=!e.checks;break;case\"TemplateLiteral\":{let o=hk(t);n=!e.checks&&e.parts.every((s,a)=>xk(s,`${o}.parts[${a}]`,r));break}case\"Union\":{let o=hk(t);n=!e.checks&&e.types.every((s,a)=>xk(s,`${o}.types[${a}]`,r));break}default:return!1}return n&&r.add(e),n}var ly=class extends Tt{_tag=\"TemplateLiteral\";parts;encodedParts;literals;suffixLengths;constructor(e,t,r,n,o){super(t,r,n,o);let s=[],a=[],i=new Set;for(let u=0;u<e.length;u++){let l=e[u];if(!xk(l,u,i))throw new Error(`Invalid TemplateLiteral part ${l._tag}`);s.push(l),a.push(l._tag===\"Literal\"?globalThis.String(l.literal):void 0)}let c=new Array(s.length+1);c[s.length]=0;for(let u=s.length-1;u>=0;u--)c[u]=c[u+1]+(a[u]?.length??0);this.parts=e,this.encodedParts=s,this.literals=a,this.suffixLengths=c}getParser(e){let t=new Nn(!1,this.parts.map(Zk),[]),r=e(sa(pn,t,rD(this)));return(n,o)=>{if(n===xe)return fn;let s=r(n,o);return s._tag===\"Success\"?Ke:pr(s,{onSuccess:()=>n,onFailure:a=>new Rt(this,[a],n,o)})}}getExpected(){return\"string\"}matchPart(e,t){return yD(this,e,t)===void 0?void 0:e}};function Ok(e){let t=Tn(o=>{if(o._tag!==\"Union\")return o;let s=ti(o.types,t);return(o.options?.mode??\"anyOf\")===\"anyOf\"&&s===o.types?o:new Yr(s,o.options===void 0?void 0:{...o.options,mode:\"anyOf\"},o.annotations,o.checks,void 0,o.context)}),r=new ly(e.map(o=>t(hn(o)))),n=new Nn(!1,e.map(Zk),[]);return sa(r,n,rD(r))}function rD(e){return new be(lt((t,r)=>{let n=yD(e,t,r);return n?b(n):N(new se({expected:\"a string matching template literal parts\"},t,r))}),Y(t=>t.join(\"\")))}var _k=class extends Tt{_tag=\"UniqueSymbol\";symbol;constructor(e,t,r,n,o){super(t,r,n,o),this.symbol=e}getParser(){return Ey(this,this.symbol)}toCodecStringTree(){let e=globalThis.Symbol.keyFor(this.symbol);return Ve(this,[new pt(e===void 0?fy:new dn(globalThis.String(this.symbol)),ED.transformation)])}getExpected(){return globalThis.String(this.symbol)}},dn=class extends Tt{_tag=\"Literal\";literal;constructor(e,t,r,n,o){if(super(t,r,n,o),typeof e==\"number\"&&!globalThis.Number.isFinite(e))throw new Error(`A numeric literal must be finite, got ${L(e)}`);this.literal=e}getParser(){return Ey(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==\"bigint\"?zN(this):this}toCodecStringTree(){return typeof this.literal==\"string\"?this:zN(this)}getExpected(){return typeof this.literal==\"string\"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function zN(e){let t=globalThis.String(e.literal);return Ve(e,[new pt(new dn(t),new be(Y(()=>e.literal),Y(()=>t)))])}var nD=class extends Tt{_tag=\"String\";getParser(){return No(this,ur)}matchPart(e,t){let r=this.checks;return r&&!t.disableChecks&&ao(r,e,void 0,this,t)?void 0:e}getExpected(){return\"string\"}},pn=new nD,oD=class extends Tt{_tag=\"Number\";getParser(){return No(this,ba)}matchKey(e,t){return this._match(p8,e,t)}matchPart(e,t){return this._match(Sk,e,t)}_match(e,t,r){if(!e.test(t))return;let n=globalThis.Number(t);return r.disableChecks||!this.checks?n:ao(this.checks,n,void 0,this,r)?void 0:n}toCodecJson(){return this.checks&&(gk(this.checks,\"effect/schema/isFinite\")||gk(this.checks,\"effect/schema/isInt\"))?this:Ve(this,[s8])}toCodecStringTree(){return this.toCodecJson()===this?Ve(this,[d8]):Ve(this,[m8])}getExpected(){return\"number\"}};function gk(e,t){return e.some(r=>r.annotations?.representation?.id===t||r._tag===\"FilterGroup\"&&gk(r.checks,t))}var py=new oD,sD=class extends Tt{_tag=\"Boolean\";getParser(){return No(this,Si)}getExpected(){return\"boolean\"}},Rk=new sD,aD=class extends Tt{_tag=\"Symbol\";getParser(){return No(this,pu)}matchKey(e,t){return t.disableChecks||!this.checks?e:ao(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return Ve(this,[ED])}getExpected(){return\"symbol\"}},Mk=new aD,iD=class extends Tt{_tag=\"BigInt\";getParser(){return No(this,Fl)}matchPart(e,t){if(!Ek.test(e))return;let r=globalThis.BigInt(e);return t.disableChecks||!this.checks?r:ao(this.checks,r,void 0,this,t)?void 0:r}toCodecStringTree(){return Ve(this,[x8])}getExpected(){return\"bigint\"}},Pk=new iD,Nn=class extends Tt{_tag=\"Arrays\";isMutable;elements;rest;encodingChecks;constructor(e,t,r,n,o,s,a,i){super(n,o,s,a),this.isMutable=e,this.elements=t,this.rest=r,this.encodingChecks=i;let c=!1;for(let u=0;u<t.length;u++)if(ir(t[u]))c=!0;else if(c)throw new Error(\"A required element cannot follow an optional element. ts(1257)\");if(c&&r.length>1)throw new Error(\"A required element cannot follow an optional element. ts(1257)\");for(let u=1;u<r.length;u++)if(ir(r[u]))throw new Error(\"An optional element cannot follow a rest element. ts(1266)\")}getParser(e,t=e){let r=this,n,o,s=r.elements.length,a=Math.max(0,r.rest.length-1);function i(l,p){return p<s?n[p]:p>=l?o[p-l+1]:o[0]}let c=l=>{let{input:p,len:d,options:m}=l;if(r.rest.length===0&&d>s)for(let x=s;x<d;x++){let g=new Jg(r,p[x],m),y=new ht([x],g);if(m.errors===\"all\")l.issues?l.issues.push(y):l.issues=[y];else return N(new Rt(r,[y],p,m))}return l.issues?N(new Rt(r,l.issues,p,m)):dr(l.output)},u=(l,p)=>{let d=l.length,m={ast:r,getParser:i,input:l,len:d,tailThreshold:Math.max(s,d-a),output:new globalThis.Array(d),issues:void 0,options:p},x=r.rest.length===0?s:Math.max(d,s+a),g=p.concurrency===void 0?1:Rp(p.concurrency),y=g===1?fD(m,l,0,x):Y5(m,l,{concurrency:g,end:x});if(!y)return c(m);if(ze(y))return ft(y,()=>c(m));let S=!0;return z(()=>S?(S=!1,T(y,()=>c(m))):u(l,p))};return(l,p)=>{if(l===xe)return fn;try{return Array.isArray(l)?(n||(n=r.elements.map(d=>({ast:d,parser:t(d)})),o=r.rest.map(d=>({ast:d,parser:t(d)}))),u(l,p)):N(new xt(r,l,p))}catch(d){return Kr(d)}}}_rebuild(e,t,r){let n=ti(this.elements,e),o=ti(this.rest,e);return n===this.elements&&o===this.rest&&t===this.checks&&r===this.encodingChecks?this:new Nn(this.isMutable,n,o,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return\"array\"}};function cD(e,t,r,n){if(r._tag===\"Failure\")return sy(e,e.ast,n,r);let o=r===Ke?t:r[me];if(o!==xe)e.output[n]=o;else{let s=e.getParser(e.tailThreshold,n);if(ir(s.ast))return;let a=new ht([n],new ys(s.ast.context?.annotations));if(e.options.errors===\"all\")e.issues?e.issues.push(a):e.issues=[a];else return Gs(new Rt(e.ast,[a],e.input,e.options))}}var uD={onItem(e,t,r){let n=r<e.len?t:xe;return e.getParser(e.tailThreshold,r).parser(n,e.options)},step:cD},fD=Ix()(uD),Y5=Tx()(uD),sy=(e,t,r,n)=>{if(n.cause.reasons.length===0)return n;let o=Cd(n.cause);if(o===void 0)return sn(Ks(n.cause,a=>new Rt(t,[new ht([r],a)],e.input,e.options)));let s=new ht([r],o);if(e.options.errors===\"all\")e.issues?e.issues.push(s):e.issues=[s];else return Gs(new Rt(t,[s],e.input,e.options))},Bd=\"[+-]?\\\\d*\\\\.?\\\\d+(?:[Ee][+-]?\\\\d+)?\";function oa(e,t,r=Fo){let n,o;function s(a){switch(a._tag){case\"String\":case\"TemplateLiteral\":return(n??=Object.keys(e)).filter(i=>a.matchPart(i,r)!==void 0);case\"Number\":return(n??=Object.keys(e)).filter(i=>a.matchKey(i,r)!==void 0);case\"Symbol\":return(o??=Object.getOwnPropertySymbols(e)).filter(i=>Object.prototype.propertyIsEnumerable.call(e,i)&&a.matchKey(i,r)!==void 0);case\"Union\":return[...new Set(a.types.flatMap(s))];default:return[]}}return s(Iy(hn(t)))}var dy=class{name;type;constructor(e,t){this.name=e,this.type=t}};function lD(e){switch(e._tag){case\"String\":case\"Number\":case\"Symbol\":case\"TemplateLiteral\":return!0;case\"Union\":return e.types.every(lD);default:return!1}}function pD(e){let t=qc(e);switch(t._tag){case\"String\":case\"Number\":case\"Symbol\":case\"TemplateLiteral\":return!0;case\"Union\":return t.types.every(pD);default:return!1}}function X5(e){return lD(e)&&pD(e)}var my=class{parameter;type;constructor(e,t){if(!X5(e))throw new Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,ir(t)&&!Vk(t))throw new Error(\"Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.\")}},Df=class extends Tt{_tag=\"Objects\";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,r,n,o,s,a){super(r,n,o,s),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=a}getParser(e,t=e){let r=this,n=r.propertySignatures.length,o=r.indexSignatures.length;if(!n&&!o)return No(r,Dl);let s,a,i=()=>(s||(s=r.propertySignatures.map(p=>({parser:t(p.type),name:p.name,type:p.type})),a=o?r.indexSignatures.map(p=>({is:p,parserKey:e(Iy(p.parameter)),parserValue:t(p.type)})):void 0),s),c=()=>{let p=new Set(r.propertySignatures.map(y=>typeof y.name==\"number\"?globalThis.String(y.name):y.name)),d=(y,S,E,U,F)=>{if(F._tag===\"Failure\")return sy(y,r,S,F)??vt;let h=F===Ke?U:F[me];if(E!==xe&&h!==xe){if(n&&(p.has(S)||p.has(typeof E==\"number\"?globalThis.String(E):E)))return vt;w(y.out,E,h)}return vt},m=(y,S,E,U)=>{if(!U){let C=E.parserKey(S,y.options);if(!ze(C))return T(to(C),A=>m(y,S,E,A));U=C}if(U._tag===\"Failure\")return sy(y,r,S,U)??vt;let F=U===Ke?S:U[me],h=y.input[S],I=E.parserValue(h,y.options);return ze(I)?d(y,S,F,h,I):T(to(I),C=>d(y,S,F,h,C))},x=(y,S,E)=>{let U=y.input[S],F=E.parserValue(U,y.options);return ze(F)?d(y,S,S,U,F):T(to(F),h=>d(y,S,S,U,h))},g=o?Tx()({onItem:(y,[S,E])=>E.is.parameter===pn?x(y,S,E):m(y,S,E),step:(y,S,E)=>E._tag===\"Failure\"?E:void 0}):void 0;return gT(function*(y,S){if(y===xe)return xe;if(!(typeof y==\"object\"&&y!==null&&!Array.isArray(y)))return yield*N(new xt(r,y,S));i();let E=y,U={},F={ast:r,input:E,out:U,issues:void 0,options:S},h=S.errors===\"all\",I=S.onExcessProperty===\"error\",C=S.concurrency===void 0?1:Rp(S.concurrency),A=o&&I?r.indexSignatures.map(j=>oa(E,j.parameter,S)):void 0;if(I){let j=A?new Set(p):p;if(A)for(let ge of A)for(let Fe of ge)j.add(Fe);let ce=Reflect.ownKeys(E);for(let ge=0;ge<ce.length;ge++){let Fe=ce[ge];if(!j.has(Fe)&&Object.prototype.propertyIsEnumerable.call(E,Fe)){let Ut=new Jg(r,E[Fe],S),rt=new ht([Fe],Ut);if(h){F.issues?F.issues.push(rt):F.issues=[rt];continue}else return yield*N(new Rt(r,[rt],y,S))}}}if(n){let j=C===1?yk(F,s):e8(F,s,{concurrency:C});j&&(yield*j)}if(o&&C===1)for(let j=0;j<o;j++){let ce=a[j],ge=ce.is.parameter===pn?x:m,Fe=A?.[j]??(ce.is.parameter===pn?Object.keys(E):oa(E,ce.is.parameter,S));for(let Ut=0;Ut<Fe.length;Ut++){let rt=ge(F,Fe[Ut],ce);if(!ze(rt))yield*rt;else if(rt._tag===\"Failure\")return yield*rt}}else if(g){let j=At();for(let ge=0;ge<o;ge++){let Fe=a[ge],Ut=A?.[ge]??(Fe.is.parameter===pn?Object.keys(E):oa(E,Fe.is.parameter,S));for(let rt=0;rt<Ut.length;rt++)j.push([Ut[rt],Fe])}let ce=g(F,j,{concurrency:C});ce&&(yield*ce)}return F.issues?yield*N(new Rt(r,F.issues,y,S)):U})};if(o)return c();let u,l=(p,d,m)=>{let x=s[d];return T(to(m),g=>{let y=ay(p,x,g);if(y)return y;let S=()=>dr(p.out),E=yk(p,s.slice(d+1));return E?ft(E,S):S()})};return(p,d)=>{if(p===xe)return fn;if(d.errors===\"all\"||d.onExcessProperty!==void 0||d.concurrency!==void 0&&Rp(d.concurrency)!==1)return(u??=c())(p,d);if(!(typeof p==\"object\"&&p!==null&&!Array.isArray(p)))return N(new xt(r,p,d));let m=i(),x=p,g={},y={ast:r,input:x,out:g,issues:void 0,options:d};try{for(let S=0;S<m.length;S++){let E=m[S],U=E.name,F=Nf(x,U),h=F?x[U]:xe,I=E.parser(h,d);if(!ze(I))return l(y,S,I);if(I===Ke){F&&w(g,U,h);continue}let C=ay(y,E,I);if(C)return C}}catch(S){return Kr(S)}return dr(g)}}_rebuild(e,t,r,n){let o=ti(this.propertySignatures,a=>{let i=e(a.type);return i===a.type?a:new dy(a.name,i)}),s=ti(this.indexSignatures,a=>{let i=t(a.parameter),c=e(a.type);return i===a.parameter&&c===a.type?a:new my(i,c)});return o===this.propertySignatures&&s===this.indexSignatures&&r===this.checks&&n===this.encodingChecks?this:new Df(o,s,this.annotations,r,void 0,this.context,n)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?\"object | array\":\"object\"}};function ay(e,t,r){if(r._tag===\"Failure\")return sy(e,e.ast,t.name,r);if(r===Ke)return;let n=r[me];if(n!==xe){w(e.out,t.name,n);return}if(delete e.out[t.name],!ir(t.type)){let o=new ht([t.name],new ys(t.type.context?.annotations));if(e.options.errors===\"all\"){e.issues?e.issues.push(o):e.issues=[o];return}else return Gs(new Rt(e.ast,[o],e.input,e.options))}}var dD={onItem(e,t){if(!Nf(e.input,t.name))return t.parser(xe,e.options);let r=e.input[t.name];return w(e.out,t.name,r),t.parser(r,e.options)},step:ay},yk=Ix()(dD),e8=Tx()(dD);function Fk(e,t){return e?t?[...e,...t]:e:t}function zd(e,t,r){return new Df(Reflect.ownKeys(e).map(n=>new dy(n,e[n].ast)),[],r,t)}function Lf(e){return e.ast}function hy(e,t=void 0){return new Nn(!1,e.map(r=>r.ast),[],void 0,t)}function jd(e,t,r){return new Yr(e.map(Lf),t,void 0,r)}function Uk(e,t){if(e.encoding||t.some(s=>s.encoding))throw new Error(\"StructWithRest does not support encodings\");let r=e.propertySignatures,n=e.indexSignatures,o=e.checks;for(let s of t){for(let a of s.propertySignatures)if(r.some(i=>i.name===a.name))throw new Error(`Duplicate identifier: ${JSON.stringify(a.name)}. ts(2300)`);r=r.concat(s.propertySignatures),n=n.concat(s.indexSignatures),o=Fk(o,s.checks)}return new Df(r,n,void 0,o)}function Nk(e,t){if(e.encoding)throw new Error(\"TupleWithRest does not support encodings\");return new Nn(e.isMutable,e.elements,t,void 0,e.checks)}function Dk(e){if(e.encoding)throw new Error(\"mutable does not support encodings\");return new Nn(!0,e.elements,e.rest,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}var Lk=yi(e=>{for(;;){if(wk(e))return oo;let t=e.encoding;if(!t)return e.recur?.(Lk,_)??e;if(t.some(r=>r.transformation._tag===\"Middleware\"&&r.transformation.decode!==_))return oo;e=t[t.length-1].to}});function mD(e){switch(e._tag){case\"Null\":return[\"null\"];case\"Undefined\":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\"]:[\"string\",\"number\",\"boolean\",\"symbol\",\"bigint\",\"object\",\"array\",\"function\"];case\"Enum\":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case\"Literal\":return[typeof e.literal];case\"Union\":return Array.from(new Set(e.types.flatMap(mD)));default:return[\"null\",\"undefined\",\"string\",\"number\",\"boolean\",\"symbol\",\"bigint\",\"object\",\"array\",\"function\"]}}function Lc(e){switch(e._tag){default:return[];case\"Declaration\":{let t=e.annotations?.[Sd];return Array.isArray(t)?t:[]}case\"Objects\":return e.propertySignatures.flatMap(t=>{let r=t.type;if(!ir(r)){if(Dc(r))return[{key:t.name,literal:r.literal}];if(oy(r))return[{key:t.name,literal:r.symbol}]}return[]});case\"Arrays\":return e.elements.flatMap((t,r)=>{if(!ir(t)){if(Dc(t))return[{key:r,literal:t.literal}];if(oy(t))return[{key:r,literal:t.symbol}]}return[]});case\"Union\":{if(e.types.length===0)return[];let t=e.types.map(r=>Lc(Lk(r)));return t[0].filter(r=>t.every(n=>n.some(o=>o.key===r.key&&o.literal===r.literal)))}case\"Suspend\":return Lc(e.thunk())}}var jN=new WeakMap,ny=Object.freeze([]),qN=e=>e===null?\"null\":Array.isArray(e)?\"array\":typeof e,Nf=(e,t)=>t===\"__proto__\"?Object.hasOwn(e,t):t in e;function $f(e){let t=jN.get(e);if(t)return t;let r,n=0,o,s,a=!0,i=[];for(let l=0;l<e.length;l++){let p=e[l],d=Lk(p);if(JN(d))continue;if(Dc(d)||oy(d)){s??=new Map;let x=Dc(d)?d.literal:d.symbol;i[l]=x;let g=s.get(x);g||s.set(x,g=[]),g.push(l)}else a=!1;let m=Lc(d);if(m.length){r??=new Map,n++;for(let{key:x,literal:g}of m){let y=r.get(x);y||r.set(x,y=[new Map,new Set]),y[1].add(l);let S=y[0].get(g);S||y[0].set(g,S=new Set),S.add(l)}}else{o??={};let x=mD(d);for(let g of x)(o[g]??=[]).push(l)}}let c={},u=l=>c[l]??=Object.freeze(o?.[l]??ny);if(a&&s)s.forEach(Object.freeze),t=l=>s.get(l)??ny;else if(r?.size===1&&!o){let[l,[p]]=r.entries().next().value,d=new Map;for(let[x,g]of p)d.set(x,Object.freeze(Array.from(g)));let m=Object.freeze(e.map((x,g)=>g));t=(x,g)=>{if(du(x)){let y=Nf(x,l)?x[l]:void 0;if(y!==void 0)return d.get(y)??ny;if(g)return m}return ny}}else if(r){let l;for(let p of r)(!l||p[1][0].size>l[1][0].size)&&p[1][1].size===n&&(l=p);t=(p,d)=>{let m=qN(p);if(!du(p))return u(m);let x=new Set(o?.[m]),g;if(l){let[y,[S]]=l,E=Nf(p,y),U=E?p[y]:void 0;if(E&&(!d||U!==void 0)){let F=S.get(U);if(!F)return u(m);for(let h of F)x.add(h);g=y}}if(g===void 0)for(let[y,[S,E]]of r){let U=Nf(p,y),F=U?p[y]:void 0;if(U&&(!d||F!==void 0)){let h=S.get(F);if(h)for(let I of h)x.add(I)}else if(d)for(let h of E)x.add(h)}for(let[y,[S,E]]of r){if(y===g)continue;let U=Nf(p,y),F=U?p[y]:void 0;if(U&&(!d||F!==void 0)){let h=S.get(F);for(let I of x)E.has(I)&&!h?.has(I)&&x.delete(I)}}return Array.from(x).sort((y,S)=>y-S)}}else t=l=>{let p=u(qN(l));return s?p.filter(d=>i[d]===void 0||i[d]===l):p};return jN.set(e,t),t}var Yr=class extends Tt{_tag=\"Union\";types;options;encodingChecks;constructor(e,t,r,n,o,s,a){super(r,n,o,s),this.types=e,this.options=t,this.encodingChecks=a}getParser(e,t){let r=this,n=t!==void 0,o=[],s=i=>o[i]??=e(r.types[i]),a;return(i,c)=>{if(i===xe)return fn;let u=(a??=$f(r.types))(i,n);if(u.length===0)return N(new Ff(r,[],i,c));if(u.length===1){let l=s(u[0])(i,c);return l._tag===\"Success\"?l:ze(l)?hD(r,l.cause,i,c):t8(r,l,i,c)}return r8(r,s,u,i,c)}}_rebuild(e,t,r){let n=ti(this.types,e);return n===this.types&&t===this.checks&&r===this.encodingChecks?this:new Yr(n,this.options,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let r of this.types){let n=r.matchPart(e,t);if(n!==void 0)return n}}getExpected(e){let t=this.annotations?.expected;if(typeof t==\"string\")return t;if(this.types.length===0)return\"never\";let r=this.types.map(n=>{let o=hn(n);switch(o._tag){case\"Arrays\":{let s=o.elements.filter(Dc);if(s.length>0)return`${HN(o.isMutable)}[ ${s.map(a=>e(a)+WN(a.context?.isOptional)).join(\", \")}, ... ]`;break}case\"Objects\":{let s=o.propertySignatures.filter(a=>Dc(a.type));if(s.length>0)return`{ ${s.map(a=>`${HN(a.type.context?.isMutable)}${Xo(a.name)}${WN(a.type.context?.isOptional)}: ${e(a.type)}`).join(\", \")}, ... }`;break}}return e(o)});return Array.from(new Set(r)).join(\" | \")}};function hD(e,t,r,n){let o=Cd(t);return o?Gs(new Ff(e,[o],r,n)):sn(t)}function t8(e,t,r,n){return Ot(t,o=>hD(e,o,r,n))}function r8(e,t,r,n,o){let s={ast:e,parser:t,input:n,out:void 0,successes:e.options?.mode===\"oneOf\"?[]:void 0,issues:void 0,options:o},a=o8(s,r);return a?n8(a,s):s.out?s.out:N(new Ff(e,s.issues??[],n,o))}function n8(e,t){return ft(e,r=>t.out===Ke?b(t.input):t.out?t.out:N(new Ff(t.ast,t.issues??[],t.input,t.options)))}var o8=Ix()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,r){if(r._tag===\"Failure\"){let n=Cd(r.cause);if(n===void 0)return r;e.issues?e.issues.push(n):e.issues=[n]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),Gs(new fw(e.ast,e.successes,e.input,e.options));if(e.out=r,e.successes)e.successes.push(e.ast.types[t]);else return vt}}}),xD=new Yr([new dn(\"Infinity\"),new dn(\"-Infinity\"),new dn(\"NaN\")]);function HN(e){return e?\"\":\"readonly \"}function WN(e){return e?\"?\":\"\"}var xy=class extends Tt{_tag=\"Suspend\";thunk;constructor(e,t,r,n,o){if(r)throw new Error(\"Cannot add checks to Suspend\");super(t,void 0,n,o);let s;this.thunk=()=>s??=e()}getParser(e){let t;return(r,n)=>(t??=e(this.thunk()))(r,n)}recur(e){return new xy(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},$d=class extends ya{_tag=\"Filter\";run;annotations;aborted;constructor(e,t=void 0,r=!1){super(),this.run=e,this.annotations=t,this.aborted=r}annotate(e){return new $d(this.run,{...this.annotations,...e},this.aborted)}abort(){return new $d(this.run,this.annotations,!0)}and(e,t){return new ei([this,e],t)}},ei=class extends ya{_tag=\"FilterGroup\";checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new ei(this.checks,{...this.annotations,...e})}and(e,t){return new ei([this,e],t)}};function qd(e,t,r=!1){return new $d((n,o,s)=>lw(o,e(n,o,s),n,s),t,r)}function Hd(e,t){return new $d((r,n,o)=>e(r)?void 0:new se(void 0,r,o),t,!0)}function gy(e){return qd(t=>globalThis.Number.isFinite(t),{expected:\"a finite number\",representation:{id:\"effect/schema/isFinite\",payload:null},toJsonSchema:()=>({type:\"number\"}),toCode:()=>({runtime:\"Schema.isFinite()\"}),arbitraryConstraint:{number:\"finite\"},...e})}var yy=Uo(py,[gy()]),s8=new pt(new Yr([yy,xD]),new be(_d(),Y(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Bf(e,t){let r=new globalThis.RegExp(e),n={source:r.source,flags:r.flags};return qd(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n.source}`,representation:{id:\"effect/schema/isPattern\",payload:n},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[n]},...t})}var bk=new WeakMap;function Wd(e,t){let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(n=>n===\"context\"||n===\"encoding\")&&bk.set(r,jc(e)),r}function jc(e){let t=bk.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return bk.set(e,r),r}function Ve(e,t){return e.encoding===t?e:Wd(e,{encoding:t})}function ri(e,t){if(e.context===t)return e;let r=jc(e);return r.context===t&&r.encoding===e.encoding?r:Wd(e,{context:t})}function qc(e){return e.encoding?qc(e.encoding[e.encoding.length-1].to):e}function so(e,t){if(e.checks){let r=e.checks[e.checks.length-1];return $k(e,Oa(e.checks.slice(0,-1),r.annotate(t)))}return Wd(e,{annotations:{...e.annotations,...t}})}function $k(e,t){if(e._tag===\"Suspend\"&&t)throw new Error(\"Cannot add checks to Suspend\");return e.checks===t?e:Wd(e,{checks:t})}function Uo(e,t){return $k(e,Fk(e.checks,t))}function Hc(e,t){let r=t(e.to);return r===e.to?e:new pt(r,e.transformation)}function Bk(e,t){let r=e,n=r[r.length-1],o=Hc(n,t);return o===n?e:Oa(e.slice(0,e.length-1),o)}function by(e){return t=>t.encoding?Ve(t,Bk(t.encoding,e)):t}function Jd(e,t){return by(r=>ri(r,t))(e)}function zk(e){function t(r){return r.encoding?Ve(r,Bk(r.encoding,t)):e(r)}return Tn(t)}function ni(e,t){function r(n){if(n.encoding){let o=n.encoding[n.encoding.length-1];return t?.stopAt?.(o)?n:Ve(n,Bk(n.encoding,r))}return e(n)}return yi(r)}function jk(e,t){return Hk(e,t,wt(e))}function qk(e,t){return Hk(hn(e),t,e)}function Hk(e,t,r){let n=new pt(e,t);return Ve(r,r.encoding?[...r.encoding,n]:[n])}function ti(e,t){let r;for(let n=0;n<e.length;n++){let o=e[n],s=t(o);if(r)r[n]=s;else if(s!==o){r=new Array(e.length);for(let a=0;a<n;a++)r[a]=e[a];r[n]=s}}return r??e}function zf(e,t){let r=e.context?new Po(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Po(!1,!1,void 0,t);return ri(e,r)}var oi=yi(e=>{let t=e.context?e.context.isOptional===!1?new Po(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Po(!0,!1);return a8(ri(e,t))}),a8=by(oi),Wk=Tn(e=>oi(new Yr([e,uy]))),Sy=yi(e=>{let t=e.context?e.context.isMutable===!1?new Po(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new Po(!1,!0);return i8(ri(e,t))}),i8=by(Sy);function Jk(e,t){let r=e.context?new Po(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new Po(!1,!1,t);return ri(e,r)}function sa(e,t,r){return Hk(e,r,t)}function c8(e){let t=[],r=[];function n(o){switch(o._tag){case\"Literal\":Ul(o.literal)&&!t.includes(o.literal)&&t.push(o.literal);return;case\"UniqueSymbol\":t.includes(o.symbol)||t.push(o.symbol);return;case\"Never\":return;case\"Union\":for(let s=0;s<o.types.length;s++)n(o.types[s]);return;default:r.push(o)}}return n(e),{literals:t,parameters:r}}function Gk(e,t){let{literals:r,parameters:n}=c8(e);return new Df(r.map(o=>new dy(o,t)),n.map(o=>new my(o,t)))}function ir(e){return e.context?.isOptional??!1}function Kk(e){return e.context?.isMutable??!1}function gD(e){return e.annotations?.[un]===!0||e._tag===\"FilterGroup\"&&e.checks.every(gD)}function u8(e){function t(n){return gD(n)?[n]:n._tag===\"FilterGroup\"?n.checks.flatMap(t):[]}let r=e.flatMap(t);return gr(r)?r:void 0}function f8(e){let t=!0;function r(n){return t=t&&!n.encoding&&!wk(n),t&&\"recur\"in n&&n.recur(r),n}return\"recur\"in e&&e.recur(r),t}var wt=yi(e=>{let t=jc(e);if(t!==e){let n=wt(t);return n===t&&e.encoding===void 0?e:ri(n,e.context)}let r=\"recur\"in e?e.recur(wt):e;if(\"encodingChecks\"in r&&r.encodingChecks){let n=f8(e)?r.encodingChecks:iy(r)||GN(r)||Bc(r)&&r.typeParameters.length>0?u8(r.encodingChecks):void 0;return Wd(r,{encodingChecks:void 0,checks:Fk(r.checks,n)})}return r}),hn=yi(e=>wt(mn(e)));function l8(e,t){let r=t,n=r.length,o=r[n-1],s=[new pt(mn(Ve(e,void 0)),r[0].transformation.flip())];for(let i=1;i<n;i++)s.unshift(new pt(mn(r[i-1].to),r[i].transformation.flip()));let a=mn(o.to);return a.encoding?Ve(a,[...a.encoding,...s]):Ve(a,s)}var mn=Tn(e=>{if(e.encoding)return l8(e,e.encoding);let t=jc(e);if(t!==e){let r=mn(t);return r===t?e:ri(r,e.context)}return\"flip\"in e?e.flip(mn):\"recur\"in e?e.recur(mn):e});function Vk(e){switch(e._tag){case\"Undefined\":return!0;case\"Union\":return e.types.some(Vk);default:return!1}}function Ey(e,t){let r=t===0?Ke:dr(t);return(n,o)=>n===xe?fn:n===t?r:N(new xt(e,n,o))}function No(e,t){return(r,n)=>r===xe?fn:t(r)?Ke:N(new xt(e,r,n))}function yD(e,t,r){let n=e.encodedParts,o=e.literals,s=t.length;for(let u=0;u<o.length;u++){let l=o[u];if(l&&!t.includes(l))return}if(e.suffixLengths[0]>s)return;let a=new Array(n.length),i;function c(u,l){if(u===n.length)return l===s;if(i?.has(u*(s+1)+l))return!1;let p=n[u];if(u===n.length-1){let d=t.slice(l);if(p.matchPart(d,r)!==void 0)return a[u]=d,!0}else if(p._tag===\"Literal\"){let d=o[u];if(t.startsWith(d,l)&&c(u+1,l+d.length))return a[u]=d,!0}else{let d=s-e.suffixLengths[u+1],m=o[u+1],x=m===void 0?d:t.lastIndexOf(m,d);for(;x>=l;){let g=t.slice(l,x);if(p.matchPart(g,r)!==void 0&&c(u+1,x))return a[u]=g,!0;if(x===0)break;x=m===void 0?x-1:t.lastIndexOf(m,x-1)}}return i??=new Set,i.add(u*(s+1)+l),!1}return c(0,0)?a:void 0}var Iy=ni(e=>{switch(e._tag){default:return e;case\"Number\":return e.toCodecStringTree();case\"Union\":return e.recur(Iy)}}),Gd=ni(e=>{switch(e._tag){default:return e;case\"Symbol\":case\"UniqueSymbol\":return e.toCodecStringTree();case\"Union\":return e.recur(Gd)}}),Zk=ni(e=>{switch(e._tag){default:return e;case\"Number\":case\"Literal\":case\"BigInt\":return e.toCodecStringTree();case\"Union\":return e.recur(Zk)}}),Qk=\"[\\\\s\\\\S]*?\",Sk=new globalThis.RegExp(`^${Bd}$`),p8=new globalThis.RegExp(`^(?:${Bd}|Infinity|-Infinity|NaN)$`);function Ty(e){return Bf(Sk,{expected:\"a string representing a finite number\",representation:{id:\"effect/schema/isStringFinite\",payload:null},toJsonSchema:()=>({pattern:Sk.source}),...e})}var bD=Uo(pn,[Ty()]),d8=new pt(bD,Nc),m8=new pt(new Yr([bD,xD]),Nc),h8=\"-?\\\\d+\",Ek=new globalThis.RegExp(`^${h8}$`);function wy(e){return Bf(Ek,{expected:\"a string representing a bigint\",representation:{id:\"effect/schema/isStringBigInt\",payload:null},toJsonSchema:()=>({pattern:Ek.source}),...e})}var ky=Uo(pn,[wy({expected:\"a string representing a bigint\"})]),x8=new pt(ky,Dd),g8=\"Symbol\\\\(([\\\\s\\\\S]*)\\\\)\",Ik=new globalThis.RegExp(`^${g8}$`),SD=Uo(pn,[Cy()]),ED=new pt(SD,new be(Y(e=>globalThis.Symbol.for(Ik.exec(e)[1])),lt((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?b(globalThis.String(e)):N(new Pf({message:\"cannot serialize to string, Symbol is not registered\"},e,t)))));function Cy(e){return Bf(Ik,{expected:\"a string representing a symbol\",representation:{id:\"effect/schema/isStringSymbol\",payload:null},toJsonSchema:()=>({pattern:Ik.source}),...e})}function ao(e,t,r,n,o){for(let s=0;s<e.length;s++){let a=e[s];if(a._tag===\"FilterGroup\"){if(r=ao(a.checks,t,r,n,o),r&&(o.errors!==\"all\"||r[r.length-1].filter.aborted))return r}else{let i=a.run(t,n,o);if(i){let c=new cw(a,i,t,o);if(r?r.push(c):r=[c],o.errors!==\"all\"||a.aborted)return r}}}return r}function Yk(e,t){let r=ao(e,t,void 0,oo,{errors:\"all\"});if(r){let n=new Rt(oo,r);return D(n)}return P(t)}function Xk(e){if(!Bc(e))return;let t=e.annotations?.[jg];return Ht(t)?t(e.typeParameters):void 0}var y8=gs,b8=_f,S8=Fc,E8=qg,I8=ON;function T8(e){return e===null||typeof e==\"string\"||typeof e==\"boolean\"||typeof e==\"number\"&&globalThis.Number.isFinite(e)}function w8(e){return e===void 0||typeof e==\"string\"}function ID(e,t){let r=new WeakMap,n=[];e:for(;;){if(typeof e!=\"object\"||e===null){if(!t(e))return!1}else{let o=e,s=r.get(o);if(s===!1)return!1;if(s===void 0){let a=Array.isArray(o);if(!a){let i=Object.getPrototypeOf(o);if(i!==null&&i!==Object.prototype&&Object.getPrototypeOf(i)!==null)return!1}r.set(o,!1),n.push({value:o,keys:a?o.length:Object.keys(o),index:0})}}for(;n.length>0;){let o=n[n.length-1],s=o.keys;if(typeof s==\"number\"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}r.set(o.value,!0),n.pop()}return!0}}function Wc(e){return ID(e,T8)}var $c=new zc([],()=>(e,t,r)=>Wc(e)?Ke:N(new xt(t,e,r)),{representation:{id:\"effect/schema/Json\",payload:null},expected:\"JSON value\",toCodecJson:()=>{},toCodecStringTree:()=>vy}),eC=so($c,{representation:{id:\"effect/schema/MutableJson\",payload:null}}),Ay=new pt($c,Uc()),tC=new pt(new Yr([new Nn(!1,[],[$c]),new Df([],[new my(pn,$c)])]),Uc());function TD(e){return ID(e,w8)}var k8=new zc([],()=>(e,t,r)=>TD(e)?Ke:N(new xt(t,e,r)),{expected:\"StringTree\",toCodecStringTree:()=>{}}),vy=new pt(k8,Uc());var Do={};Ae(Do,{_is:()=>si,_issue:()=>sC,asOption:()=>mC,asserts:()=>aC,decodeEffect:()=>Qd,decodeExit:()=>N8,decodeOption:()=>iC,decodePromise:()=>U8,decodeResult:()=>D8,decodeSync:()=>Yd,decodeUnknownEffect:()=>tt,decodeUnknownExit:()=>Ny,decodeUnknownOption:()=>Dy,decodeUnknownPromise:()=>F8,decodeUnknownResult:()=>Ly,decodeUnknownSync:()=>_D,encodeEffect:()=>cC,encodeExit:()=>$8,encodeOption:()=>uC,encodePromise:()=>L8,encodeResult:()=>B8,encodeSync:()=>Xd,encodeUnknownEffect:()=>aa,encodeUnknownExit:()=>$y,encodeUnknownOption:()=>By,encodeUnknownPromise:()=>RD,encodeUnknownResult:()=>zy,encodeUnknownSync:()=>MD,is:()=>Uy,make:()=>Zd,makeEffect:()=>Fy,makeOption:()=>Vd,run:()=>em});var Oy=(e,t,r)=>e===Ke?r(t):ft(e,r);function kD(e){if(e._tag===\"Middleware\")return(r,n,o)=>{let s=r===Ke?e.decode(dr(Id(n)),o):e.decode(Fn(r,Id),o);return wD(s)};let t=e.decode;switch(t._tag){case\"Passthrough\":return(r,n)=>r===Ke?dr(n):r;case\"Transform\":{let r=n=>n===xe?fn:dr(t.transform(n));return(n,o)=>Oy(n,o,r)}case\"TransformOptional\":{let r=n=>aw(t.transform(Id(n)));return(n,o)=>Oy(n,o,r)}case\"TransformEffect\":return(r,n,o)=>Oy(r,n,s=>s===xe?fn:t.transform(s,o));case\"TransformOptionalEffect\":return(r,n,o)=>Oy(r,n,s=>wD(t.transform(Id(s),o)))}}var wD=e=>ft(e,aw),CD=(e,t,r,n)=>Ot(n,o=>Qs(()=>Ks(o,s=>new uw(e,s,t,r))));function C8(e,t){let r=kD(e.link.transformation),n;return(o,s)=>{if(o===xe)return fn;if(e.isConstructed(o))return Ke;let a=(n??=t(e.link.to))(o,s);return r(a,o,s)}}function A8(e,t){let r=e.context.constructorDefault;return(n,o)=>{if(n!==xe&&n!==void 0)return t(n,o);let s=r;if(ze(s)&&s._tag===\"Success\"){let a=t(s[me],o);return a===Ke?s:a}return ft(CD(e,n,o,s),a=>{let i=t(a,o);return i===Ke?dr(a):i})}}function rC(e,t){let r=t(e);return e.context?.constructorDefault===void 0?r:A8(e,r)}function Kd(e,t,r,n,o){if(e._tag===\"Declaration\")for(let x of e.typeParameters)t(x);let s=r?Xk(e):void 0,a=s?C8(s,t):n??e.getParser(t,r),i=e.checks,c=e.encoding,u=c?.map(x=>kD(x.transformation)),l=e.encodingChecks;if(!c&&!i&&!l)return a;let p,d=(x,g)=>{let y=a(x,g);if(l&&!g.disableChecks)if(ze(y)){if(y._tag===\"Success\"){let S=y===Ke?x:y[me];if(x!==xe&&S!==xe){let E=ao(l,x,void 0,e,g);E&&(y=N(new Rt(e,E,x,g)))}}}else y=T(y,S=>{if(x!==xe&&S!==xe){let E=ao(l,x,void 0,e,g);if(E)return N(new Rt(e,E,x,g))}return b(S)});if(i&&!g.disableChecks)if(ze(y)){if(y._tag===\"Success\"){let S=y===Ke?x:y[me];if(S===xe)return y;let E=ao(i,S,void 0,e,g);E&&(y=N(new Rt(e,E,S,g)))}}else y=T(y,S=>{if(S!==xe){let E=ao(i,S,void 0,e,g);if(E)return N(new Rt(e,E,S,g))}return b(S)});return y},m=o===void 0?d:o(d);return c?(x,g)=>{let y=p??=c.map(U=>t(U.to)),S=x,E=y[y.length-1](x,g);for(let U=c.length-1;U>=0;U--)if(E=u[U](E,S,g),U!==0){let F=y[U-1];E._tag===\"Success\"?(S=E[me],E=F(S,g)):E=ft(E,h=>{let I=F(h,g);return I===Ke?dr(h):I})}if(E._tag===\"Success\"){let U=E[me],F=m(U,g);return F===Ke?E:F}return E=CD(e,x,g,E),ft(E,U=>{let F=m(U,g);return F===Ke?dr(U):F})}:m}var My=Symbol(),AD=new WeakMap,vD,jf=!1;var O8=e=>jf?Ry(Dn,e,\"parser\"):Dn(e).parser,OD=e=>jf?Ry(Dn,e,\"makeEffect\"):Dn(e).makeEffect,_8=e=>rC(e,OD),_y=class{ast;constructor(t){this.ast=t}get decodeEffect(){return this.cachedDecodeEffect??=Kd(this.ast,O8)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=Kd(this.ast,OD,_8)}},nC=class extends _y{compiled;resolve;constructor(t,r,n){super(t),this.compiled=r,this.resolve=n}save(t,r){return Object.defineProperty(this,t,{value:r}),r}operation(t){let r=this.compiled;return typeof r==\"function\"?r(this.ast,this.resolve,t):r?.[t]}get is(){return this.save(\"is\",this.operation(\"is\"))}get decode(){return this.save(\"decode\",this.operation(\"decode\"))}get make(){return this.save(\"make\",this.operation(\"make\"))}get decodeEffect(){return this.save(\"decodeEffect\",this.operation(\"decodeEffect\")??Kd(this.ast,t=>Ry(this.resolve,t,\"parser\")))}get parser(){let t=this.decode;return t===void 0?this.decodeEffect:this.save(\"parser\",R8(t,()=>this.decodeEffect))}get makeEffect(){let t=this.operation(\"makeEffect\");if(t!==void 0)return this.save(\"makeEffect\",t);let r=n=>Ry(this.resolve,n,\"makeEffect\");return this.save(\"makeEffect\",Kd(this.ast,r,n=>rC(n,r)))}};function R8(e,t){let r;return(n,o)=>{if(n!==xe)try{let s=e(n,o);if(s!==My)return s===n?Ke:dr(s)}catch(s){return Kr(s)}return(r??=t())(n,o)}}function Ry(e,t,r){let n=e(t);if(n.compiled===void 0||Object.hasOwn(n,r))return n[r];let o;return(s,a)=>(o??=n[r])(s,a)}function Dn(e){let t=AD.get(e);if(t!==void 0)return t;let r=vD===void 0?new _y(e):new nC(e,vD(e,Dn),Dn);return AD.set(e,r),r}function Fy(e){let t=e.ast,r;return(n,o)=>(r??=pC(W8,wt(t)))(n,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function Vd(e){let t=Fy(e);return(r,n)=>{let o=hs(t(r,n));return qe(o)?O(o.value):(ln(o.cause,\"Option adapter can only return none for schema issues\"),v())}}function Zd(e){return q8(wt(e.ast))}function Uy(e){return si(e.ast)}function P8(e){if(!jf){let o=qf(em(e));return s=>{let a=o(s,Fo);return qe(a)?!0:(ln(a.cause,\"Type guard adapter can only return false for schema issues\"),!1)}}let t=Dn(e),r=t.is;if(r!==void 0)return o=>{try{return r(o,Fo)}catch(s){return ln(cc(s),\"Type guard adapter can only return false for schema issues\"),!1}};let n=t.parser;return o=>{let s=hs(lC(n(o,Fo),o));return qe(s)?!0:(ln(s.cause,\"Type guard adapter can only return false for schema issues\"),!1)}}function si(e){let t=wt(e),r=n=>(r=P8(t),r(n));return n=>r(n)}function sC(e){let t=em(e);return(r,n)=>{let o=hs(t(r,n));if(!qe(o))return ln(o.cause,\"Issue adapter can only return schema issues\")}}function aC(e,t){let r=wt(e.ast),n=Dn(r).parser(t,Fo),o=hs(lC(n,t));if(Co(o)){let s=ln(o.cause,\"Assertion adapter can only throw schema issues\");throw new Error(\"Schema validation failed\",{cause:s})}}function tt(e,t){let r=em(e.ast);return t===void 0?r:(n,o)=>r(n,fC(t,o))}var Qd=tt;function F8(e,t){return dC(tt(e,t))}function U8(e,t){return dC(Qd(e,t))}function Ny(e,t){return qf(tt(e,t))}var N8=Ny;function Dy(e,t){return mC(tt(e,t))}var iC=Dy;function Ly(e,t){return PD(tt(e,t))}var D8=Ly;function _D(e,t){return jf?FD(e.ast,t):hC(tt(e,t))}var Yd=_D;function aa(e,t){let r=em(mn(e.ast));return t===void 0?r:(n,o)=>r(n,fC(t,o))}var cC=aa,RD=(e,t)=>dC(aa(e,t)),L8=RD;function $y(e,t){return qf(aa(e,t))}var $8=$y;function By(e,t){return mC(aa(e,t))}var uC=By;function zy(e,t){return PD(aa(e,t))}var B8=zy;function MD(e,t){return jf?FD(mn(e.ast),t):hC(aa(e,t))}var Xd=MD,fC=(e,t)=>t?{...e,...t}:e,Py=e=>e===xe?N(new se):b(e);function em(e){return pC(H8,e)}function lC(e,t){return e===Ke?b(t):ze(e)?e[me]===xe?Py(xe):e:ft(e,Py)}function pC(e,t){let r;return(n,o)=>{let s=(r??=e(t))(n,o??Fo);return s===Ke?b(n):ze(s)?s[me]===xe?Py(xe):s:ft(s,Py)}}function dC(e){return(t,r)=>ad(e(t,r)).then(n=>{if(qe(n))return n.value;let o=ln(n.cause,\"Promise adapter can only reject schema issues\");throw new Error(\"Schema validation failed\",{cause:o})})}function qf(e){return(t,r)=>hs(e(t,r))}function mC(e){let t=qf(e);return(r,n)=>{let o=t(r,n);return qe(o)?O(o.value):(ln(o.cause,\"Option adapter can only return none for schema issues\"),v())}}function PD(e){let t=qf(e);return(r,n)=>{let o=t(r,n);return qe(o)?P(o.value):D(ln(o.cause,\"Result adapter can only return schema issues\"))}}function FD(e,t){let r;return(n,o)=>(r??=z8(Dn(e),t))(n,o)}function z8(e,t){let r=e.decode,n,o=r===void 0?(s,a=Fo)=>(n??=oC(e))(s,a):(s,a=Fo)=>{if(s===xe)return(n??=oC(e))(s,a);let i;try{i=r(s,a)}catch(c){throw ln(cc(c),\"Sync adapter can only throw schema issues\"),c}return i!==My?i:(n??=oC(e))(s,a)};return t===void 0?o:(s,a)=>o(s,fC(t,a))}function oC(e){return hC(pC(()=>e.decodeEffect,e.ast))}function hC(e){let t=qf(e);return(r,n)=>{let o=t(r,n);if(qe(o))return o.value;let s=ln(o.cause,\"Sync adapter can only throw schema issues\");throw new Error(\"Schema validation failed\",{cause:s})}}function j8(e,t){let r=hs(e);if(qe(r))return r.value;let n=ln(r.cause,t);throw new Error(\"Schema validation failed\",{cause:n})}function q8(e){let t,r;return(n,o)=>{t??=Dn(e);let s=o?.disableChecks?o.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions??Fo,a=t.make;if(a!==void 0&&n!==xe){let c;try{c=a(n,s)}catch(u){throw ln(cc(u),\"Constructor adapter can only throw schema issues\"),u}if(c!==My&&c!==xe)return c}let i=(r??=t.makeEffect)(n,s);return j8(lC(i,n),\"Constructor adapter can only throw schema issues\")}}var H8=e=>Dn(e).parser,W8=e=>Dn(e).makeEffect;var jy=\"~effect/Schema/Schema\",UD=Symbol(),J8={[jy]:jy,get make(){let e=Zd(this);return Object.defineProperty(this,\"make\",{value:e,enumerable:!0}),e},get makeEffect(){let e=Fy(this);return Object.defineProperty(this,\"makeEffect\",{value:e,enumerable:!0}),e},get makeOption(){let e=Vd(this);return Object.defineProperty(this,\"makeOption\",{value:e,enumerable:!0}),e},pipe(){return K(this,arguments)},annotate(e){return this.rebuild(so(this.ast,e))},annotateKey(e){return this.rebuild(zf(this.ast,e))},check(...e){return this.rebuild(Uo(this.ast,e))},rebuild(e){return Lo(e,this[UD])}};function Lo(e,t){function r(){}let n=Object.setPrototypeOf(r,J8);return t&&(Object.hasOwn(t,\"name\")||Object.hasOwn(t,\"length\")||Object.hasOwn(t,\"__proto__\"))?Object.defineProperties(n,Object.getOwnPropertyDescriptors({...t})):Object.assign(n,t),n[UD]=t,n.ast=e,n}var wC={};Ae(wC,{META_SCHEMA_URI_DRAFT_04:()=>jD,META_SCHEMA_URI_DRAFT_07:()=>yC,META_SCHEMA_URI_DRAFT_2020_12:()=>rm,VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP:()=>gC,fromSchemaDraft07:()=>V8,fromSchemaDraft2020_12:()=>Ky,fromSchemaOpenApi3_0:()=>Q8,fromSchemaOpenApi3_1:()=>Z8,getReferenceKey:()=>eQ,rewriteRefs:()=>EC,sanitizeOpenApiComponentsSchemasKey:()=>HD,toDocumentDraft04:()=>Y8,toDocumentDraft07:()=>bC,toMultiDocumentOpenApi3_1:()=>X8});var DD={};Ae(DD,{decodeUriFragment:()=>Wy,escapeToken:()=>qy,formatUriFragment:()=>tm,formatUriFragmentToken:()=>Hy,parseUriFragment:()=>Wf,unescapeToken:()=>Hf});function qy(e){return e.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}function Hf(e){return e.replace(/~1/g,\"/\").replace(/~0/g,\"~\")}function Hy(e){return encodeURI(qy(e)).replace(/#/g,\"%23\")}function Wy(e){if(e.length===0||e===\"#\")return\"\";if(!e.startsWith(\"#\"))return;let t=e.slice(1);try{if(encodeURI(t).replace(/%25/g,\"%\").replace(/#/g,\"%23\")!==t)return;let r=decodeURIComponent(t);return r.startsWith(\"/\")&&!/~(?:[^01]|$)/.test(r)?r:void 0}catch{return}}function Wf(e){let t=Wy(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split(\"/\").map(Hf)}function tm(e){return e.reduce((t,r)=>`${t}/${Hy(r)}`,\"#\")}var jD=\"http://json-schema.org/draft-04/schema#\",yC=\"http://json-schema.org/draft-07/schema#\",rm=\"https://json-schema.org/draft/2020-12/schema\",G8=\"https://spec.openapis.org/oas/3.1/dialect/base\";function Gy(e,t){return e===t||e===(t.endsWith(\"#\")?t.slice(0,-1):`${t}#`)}function qD(e){let t=e.startsWith(\"#\")?Wf(e):void 0;return t!==void 0&&t[0]===\"components\"&&t[1]===\"schemas\"?tm([\"$defs\",...t.slice(2)]):e}var K8=[\"example\",\"discriminator\",\"xml\",\"externalDocs\"];function V8(e){return Ky(fQ(e))}function Ky(e){let{$defs:t,...r}=e;return{dialect:\"draft-2020-12\",schema:r,definitions:kt(t)?t:{}}}function Z8(e,t){let r=Vy(e.$id),n=SC(e,(o,s)=>{if(typeof o.$ref==\"string\"&&t?.onReference?.(o.$ref),typeof o.$dynamicRef==\"string\"&&t?.onReference?.(o.$dynamicRef),!r&&!s&&IC(o,qD),Gy(o.$schema,G8)&&w(o,\"$schema\",rm),Object.hasOwn(o,\"example\")){let a=o.examples;(a===void 0||Array.isArray(a))&&(w(o,\"examples\",[o.example,...a??[]]),delete o.example)}});return Ky(n)}function Q8(e,t){return Ky(mQ(e,t))}function bC(e){return{dialect:\"draft-07\",...KD(e,dQ)}}function Y8(e){return{dialect:\"draft-04\",...KD(e,xQ,{booleanAdapter:t=>t?{}:{not:{}}})}}function X8(e){let t=Object.keys(e.definitions),r=new Map,n=new Set(t.filter(c=>gC.test(c))),o=t.filter(c=>!gC.test(c)).sort().map(c=>[c,HD(c)]);for(let[c,u]of o)n.has(u)||(n.add(u),r.set(c,u));for(let[c,u]of o){if(r.has(c))continue;let l,p=0;do l=`${u}_${++p}`;while(n.has(l));n.add(l),r.set(c,l)}function s(c,u=!1){let l=Vy(c.$id),p=kt(c.$defs)?c.$defs:void 0;return SC(c,(d,m)=>{nm(d,K8,\"OpenAPI 3.1\",\"Draft 2020-12\"),IC(d,(x,g)=>{let y=x.startsWith(\"#\")?Wf(x):void 0;if(y===void 0||y[0]!==\"$defs\"||y.length<2)return x;let S=y[1];return l?(u&&!m&&Object.hasOwn(e.definitions,S)&&(p===void 0||!Object.hasOwn(p,S))&&io(g,\"OpenAPI 3.1\",\"a schema resource cannot reference the shared definitions pool\"),x):m?x:tm([\"components\",\"schemas\",r.get(S)??S,...y.slice(2)])})})}let a=e.schemas.map(c=>s(c,!0)),i={};for(let c of t)w(i,r.get(c)??c,s(e.definitions[c]));return{dialect:\"openapi-3.1\",schemas:a,definitions:i}}var gC=/^[a-zA-Z0-9.\\-_]+$/;function HD(e){return e.length===0?\"_\":e.replace(/[^a-zA-Z0-9._-]/gu,\"_\")}function eQ(e){let t=e.startsWith(\"#\")?Wf(e):void 0;return t!==void 0&&t.length===2&&t[0]===\"$defs\"?t[1]:void 0}function SC(e,t){return r(e,!1,!0);function r(n,o,s=!1){if(!kt(n))return n;let a=o||!s&&Vy(n.$id),i={};for(let c of Object.keys(n)){let u=n[c],l=u;switch(c){case\"$defs\":case\"properties\":case\"patternProperties\":case\"dependentSchemas\":l=TC(u,p=>r(p,a))??u;break;case\"allOf\":case\"anyOf\":case\"oneOf\":case\"prefixItems\":l=Array.isArray(u)?u.map(p=>r(p,a)):u;break;case\"not\":case\"additionalProperties\":case\"propertyNames\":case\"unevaluatedProperties\":case\"items\":case\"contains\":case\"unevaluatedItems\":case\"if\":case\"then\":case\"else\":case\"contentSchema\":l=r(u,a)}w(i,c,l)}return t(i,a),i}}function EC(e,t){return SC(e,r=>{IC(r,t)})}function IC(e,t){typeof e.$ref==\"string\"&&w(e,\"$ref\",t(e.$ref,\"$ref\")),typeof e.$dynamicRef==\"string\"&&w(e,\"$dynamicRef\",t(e.$dynamicRef,\"$dynamicRef\"))}function TC(e,t){if(!kt(e))return;let r={};for(let n of Object.keys(e))w(r,n,t(e[n],n));return r}function WD(e,t,r){let n=new Map,o=[],s=xC;function a(d,m=[],x=[]){if(m.length===0&&t?.trackIds){let g=kt(d)?l(d):void 0;s=LD(g,xC)??xC}return u(d,m,x,{sourceRoot:[],targetRoot:[],uri:s})}function i(){for(let[d,m,x]of o){let g=m,y=JD(m,x);if(y!==void 0){let S=Wf(y.hash);if(y.hash=\"\",S!==void 0){let E=n.get($D(y.href,S));E!==void 0&&(g=tQ(m,E))}}w(d,\"$ref\",g)}}let c=r(a);return i(),c;function u(d,m,x,g){if(typeof d==\"boolean\")return p(m,x,g),t?.booleanAdapter?.(d)??d;if(!kt(d))return d;let y=g,S=l(d);if(m.length>0&&t?.trackIds&&Vy(S)){let F=LD(S,g.uri);F!==void 0&&(y={parent:g,sourceRoot:m,targetRoot:x,uri:F})}p(m,x,y);let E=y.uri,U={isDocumentRoot:m.length===0,schema(F,h,I=h){return u(F,[...m,h],[...x,I],y)},schemaAt(F,h,I){return u(F,[...m,...h],[...x,...I],y)},schemaArray(F,h,I=h){return Array.isArray(F)?F.map((C,A)=>u(C,[...m,h,String(A)],[...x,I,String(A)],y)):F},schemaMap(F,h,I=h){return kt(F)?TC(F,(C,A)=>u(C,[...m,h,A],[...x,I,A],y)):F},reference(F,h){typeof h==\"string\"?o.push([F,h,E]):w(F,\"$ref\",h)}};return e(d,U)}function l(d){return t?.ignoreRefSiblings===!0&&typeof d.$ref==\"string\"?void 0:d.$id}function p(d,m,x){x.parent!==void 0&&p(d,m,x.parent),n.set($D(x.uri,d.slice(x.sourceRoot.length)),m.slice(x.targetRoot.length))}}var xC=\"https://effect.invalid/.json-schema/\";function JD(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function LD(e,t){if(typeof e!=\"string\")return;let r=JD(e,t);if(r!==void 0)return r.hash=\"\",r.href}function tQ(e,t){let r=e.indexOf(\"#\");return r===-1&&t.length===0?e:`${r===-1?e:e.slice(0,r)}${tm(t)}`}function $D(e,t){return`${e}\\0${JSON.stringify(t)}`}function Vy(e){return typeof e==\"string\"&&e.length>0&&e[0]!==\"#\"}function GD(e,t,r){return WD(t,r,n=>n(e))}function KD(e,t,r){return WD(t,{...r,trackIds:!0},n=>({schema:n(e.schema),definitions:TC(e.definitions,(o,s)=>n(o,[\"$defs\",s],[\"definitions\",s]))}))}var rQ=new Set([\"properties\",\"patternProperties\"]),nQ=new Set([\"allOf\",\"anyOf\",\"oneOf\"]),VD=new Set([\"not\",\"additionalProperties\",\"propertyNames\",\"contains\",\"if\",\"then\",\"else\",\"contentSchema\"]),oQ=new Set([\"properties\"]),sQ=new Set([\"not\",\"items\",\"additionalProperties\"]),aQ=new Set([\"not\",\"additionalProperties\",\"contentSchema\"]);function Zy(e,t,r,n,o,s=rQ){let a;if(s.has(t))a=n.schemaMap(r,t);else if(nQ.has(t))a=n.schemaArray(r,t);else if(o.has(t))a=n.schema(r,t);else return!1;return w(e,t,a),!0}var ZD=[\"$anchor\",\"$defs\",\"$dynamicAnchor\",\"$dynamicRef\",\"$vocabulary\",\"contentSchema\",\"dependentRequired\",\"dependentSchemas\",\"maxContains\",\"minContains\",\"prefixItems\",\"unevaluatedItems\",\"unevaluatedProperties\"],iQ=[...ZD,\"deprecated\"],cQ=[...ZD,\"$comment\",\"$id\",\"$schema\",\"const\",\"contains\",\"contentEncoding\",\"contentMediaType\",\"else\",\"examples\",\"if\",\"patternProperties\",\"propertyNames\",\"then\"],QD=/^[A-Za-z_][-A-Za-z0-9._]*$/,uQ=/^[A-Za-z][-A-Za-z0-9._:]*$/;function fQ(e){return GD(e,(t,r)=>{let n={};if(typeof t.$ref==\"string\")return r.reference(n,t.$ref),Object.hasOwn(t,\"definitions\")&&w(n,\"$defs\",r.schemaMap(t.definitions,\"definitions\",\"$defs\")),n;nm(t,iQ,\"Draft 2020-12\",\"Draft-07\");let o,s;for(let a of Object.keys(t)){let i=t[a];if(!Zy(n,a,i,r,VD))switch(a){case\"$schema\":w(n,a,Gy(i,yC)?rm:i);break;case\"$id\":lQ(n,i);break;case\"definitions\":w(n,\"$defs\",r.schemaMap(i,a,\"$defs\"));break;case\"dependencies\":{if(!kt(i)){w(n,a,i);break}let c={},u={};for(let l of Object.keys(i)){let p=i[l];w(Array.isArray(p)?c:u,l,Array.isArray(p)?p:r.schemaAt(p,[\"dependencies\",l],[\"dependentSchemas\",l]))}Object.keys(c).length>0&&w(n,\"dependentRequired\",c),Object.keys(u).length>0&&w(n,\"dependentSchemas\",u);break}case\"items\":o=i;break;case\"additionalItems\":s=i;break;default:w(n,a,i)}}return o!==void 0&&(Array.isArray(o)?(w(n,\"prefixItems\",r.schemaArray(o,\"items\",\"prefixItems\")),s!==void 0&&w(n,\"items\",r.schema(s,\"additionalItems\",\"items\"))):w(n,\"items\",r.schema(o,\"items\"))),n},{trackIds:!0,ignoreRefSiblings:!0})}function lQ(e,t){if(typeof t!=\"string\"||!t.includes(\"#\")){w(e,\"$id\",t);return}let r=t.indexOf(\"#\"),n=t.slice(0,r),o=t.slice(r+1);if(o.length===0){n.length>0&&w(e,\"$id\",n);return}QD.test(o)||io(\"$id\",\"Draft 2020-12\",`fragment \"#${o}\" is not a valid $anchor`),n.length>0&&w(e,\"$id\",n),w(e,\"$anchor\",o)}function io(e,t,r){throw new Error(`Cannot convert JSON Schema keyword \"${e}\" to ${t}: ${r}`)}function nm(e,t,r,n){for(let o of t)Object.hasOwn(e,o)&&io(o,r,`it is not active in ${n} but would become active in the target`)}var pQ=[\"additionalItems\",\"definitions\",\"dependencies\"];function YD(e,t,r,n,o){r.isDocumentRoot?w(e,\"$schema\",Gy(t,rm)?n:t):Gy(t,rm)||io(\"$schema\",o,\"an embedded resource cannot declare a different dialect\")}function dQ(e,t){nm(e,pQ,\"Draft-07\",\"Draft 2020-12\");let r={},n,o,s;for(let a of Object.keys(e)){let i=e[a];if(!Zy(r,a,i,t,VD))switch(a){case\"$ref\":n=i;break;case\"$schema\":YD(r,i,t,yC,\"Draft-07\");break;case\"$id\":case\"$anchor\":break;case\"$defs\":w(r,\"definitions\",t.schemaMap(i,a,\"definitions\"));break;case\"prefixItems\":o=i;break;case\"items\":s=i;break;case\"dependentRequired\":case\"dependentSchemas\":case\"minContains\":case\"maxContains\":break;case\"$dynamicRef\":case\"$dynamicAnchor\":case\"$vocabulary\":case\"unevaluatedProperties\":case\"unevaluatedItems\":io(a,\"Draft-07\",\"the target dialect has no equivalent\");case\"required\":if(Array.isArray(i)&&i.length===0)break;w(r,a,i);break;default:w(r,a,i)}}if(XD(r,o,s,t),Object.hasOwn(e,\"contains\")){let a=e.minContains,i=e.maxContains;(a!==void 0&&a!==1||i!==void 0)&&io(\"minContains/maxContains\",\"Draft-07\",\"contains cardinality cannot be represented\"),Object.hasOwn(e,\"minContains\")&&w(r,\"minContains\",a)}else Object.hasOwn(e,\"minContains\")&&w(r,\"minContains\",e.minContains),Object.hasOwn(e,\"maxContains\")&&w(r,\"maxContains\",e.maxContains);return t1(e,r,t,\"draft-07\"),r1(e,r,\"$id\",\"Draft-07\"),e1(r,n,t),r}function XD(e,t,r,n){if(t===void 0){r!==void 0&&w(e,\"items\",n.schema(r,\"items\"));return}w(e,\"items\",n.schemaArray(t,\"prefixItems\",\"items\")),r!==void 0&&w(e,\"additionalItems\",n.schema(r,\"items\",\"additionalItems\"))}function e1(e,t,r){if(t!==void 0)if(typeof t==\"string\"&&Object.keys(e).length>0){let n={};r.reference(n,t),Qy(e,n)}else r.reference(e,t)}function t1(e,t,r,n){let o=kt(e.dependentRequired)?e.dependentRequired:void 0,s=kt(e.dependentSchemas)?e.dependentSchemas:void 0;if(o===void 0&&s===void 0)return;let a={},i=new Set([...Object.keys(o??{}),...Object.keys(s??{})]);for(let c of i){let u=o?.[c],l=s?.[c],p=n===\"draft-04\"&&Array.isArray(u)&&u.length===0;l===void 0?p||w(a,c,u):u===void 0||p?w(a,c,r.schemaAt(l,[\"dependentSchemas\",c],[\"dependencies\",c])):w(a,c,{allOf:[r.schemaAt(l,[\"dependentSchemas\",c],[\"dependencies\",c,\"allOf\",\"0\"]),{required:u}]})}Object.keys(a).length>0&&w(t,\"dependencies\",a)}function mQ(e,t){return GD(e,(r,n)=>{let o={};if(typeof r.$ref==\"string\")return t?.onReference?.(r.$ref),n.reference(o,qD(r.$ref)),o;nm(r,cQ,\"Draft 2020-12\",\"OpenAPI 3.0\");for(let s of Object.keys(r)){let a=r[s];if(!Zy(o,s,a,n,sQ,oQ))switch(s){case\"example\":w(o,\"examples\",[a]);break;case\"nullable\":case\"exclusiveMinimum\":case\"exclusiveMaximum\":break;default:w(o,s,a)}}return BD(r,o,\"minimum\"),BD(r,o,\"maximum\"),r.nullable===!0&&typeof r.type==\"string\"&&w(o,\"type\",[r.type,\"null\"]),o})}function BD(e,t,r){let n=r===\"minimum\"?\"exclusiveMinimum\":\"exclusiveMaximum\",o=e[n];if(typeof o!=\"boolean\"){o!==void 0&&w(t,n,o);return}o&&typeof e[r]==\"number\"&&(w(t,n,e[r]),delete t[r])}var hQ=[\"additionalItems\",\"definitions\",\"dependencies\",\"id\"];function xQ(e,t){nm(e,hQ,\"Draft-04\",\"Draft 2020-12\");let r={},n,o,s,a;for(let i of Object.keys(e)){let c=e[i];if(!Zy(r,i,c,t,aQ))switch(i){case\"$ref\":n=c;break;case\"$schema\":YD(r,c,t,jD,\"Draft-04\");break;case\"$id\":case\"$anchor\":break;case\"$defs\":w(r,\"definitions\",t.schemaMap(c,i,\"definitions\"));break;case\"prefixItems\":o=c;break;case\"items\":s=c;break;case\"$dynamicRef\":case\"$dynamicAnchor\":case\"$vocabulary\":case\"unevaluatedProperties\":case\"unevaluatedItems\":case\"propertyNames\":io(i,\"Draft-04\",\"the target dialect has no equivalent\");case\"dependentRequired\":case\"dependentSchemas\":case\"contains\":case\"minContains\":case\"maxContains\":case\"if\":case\"then\":case\"else\":case\"minimum\":case\"maximum\":case\"exclusiveMinimum\":case\"exclusiveMaximum\":break;case\"const\":a={enum:[c]};break;case\"required\":if(Array.isArray(c)&&c.length===0)break;w(r,i,c);break;default:w(r,i,c)}}return XD(r,o,s,t),zD(e,r,\"minimum\"),zD(e,r,\"maximum\"),t1(e,r,t,\"draft-04\"),r1(e,r,\"id\",\"Draft-04\"),gQ(e,r,t),yQ(e,r,t),a!==void 0&&(Object.hasOwn(e,\"enum\")?Qy(r,a):w(r,\"enum\",a.enum)),e1(r,n,t),r}function gQ(e,t,r){let n=Object.hasOwn(e,\"if\"),o=Object.hasOwn(e,\"then\"),s=Object.hasOwn(e,\"else\");if(!n||!o&&!s){n&&w(t,\"if\",r.schema(e.if,\"if\")),o&&w(t,\"then\",r.schema(e.then,\"then\")),s&&w(t,\"else\",r.schema(e.else,\"else\"));return}let a=Array.isArray(t.allOf)?t.allOf.length:0,i=[\"allOf\",String(a),\"anyOf\"],c=(l,p)=>r.schemaAt(e[l],[l],[...i,...p]),u;o&&s?(Jy(e.if)&&io(\"if\",\"Draft-04\",\"lowering both branches would duplicate a schema identifier\"),u={anyOf:[{allOf:[c(\"if\",[\"0\",\"allOf\",\"0\"]),c(\"then\",[\"0\",\"allOf\",\"1\"])]},{allOf:[{not:c(\"if\",[\"1\",\"allOf\",\"0\",\"not\"])},c(\"else\",[\"1\",\"allOf\",\"1\"])]}]}):o?u={anyOf:[{not:c(\"if\",[\"0\",\"not\"])},c(\"then\",[\"1\"])]}:u={anyOf:[c(\"if\",[\"0\"]),c(\"else\",[\"1\"])]},Qy(t,u)}function Jy(e){if(!kt(e))return!1;if(Object.hasOwn(e,\"$id\")||Object.hasOwn(e,\"$anchor\"))return!0;for(let t of Object.keys(e)){let r=e[t];switch(t){case\"$defs\":case\"properties\":case\"patternProperties\":case\"dependentSchemas\":if(kt(r)&&Object.values(r).some(Jy))return!0;break;case\"allOf\":case\"anyOf\":case\"oneOf\":case\"prefixItems\":if(Array.isArray(r)&&r.some(Jy))return!0;break;case\"not\":case\"additionalProperties\":case\"propertyNames\":case\"unevaluatedProperties\":case\"items\":case\"contains\":case\"unevaluatedItems\":case\"if\":case\"then\":case\"else\":case\"contentSchema\":if(Jy(r))return!0}}return!1}function yQ(e,t,r){if(!Object.hasOwn(e,\"contains\")){Object.hasOwn(e,\"minContains\")&&w(t,\"minContains\",e.minContains),Object.hasOwn(e,\"maxContains\")&&w(t,\"maxContains\",e.maxContains);return}let n=e.minContains,o=e.maxContains;(n!==void 0&&n!==1||o!==void 0)&&io(\"minContains/maxContains\",\"Draft-04\",\"contains cardinality cannot be represented\");let s=Array.isArray(t.allOf)?t.allOf.length:0,a=r.schemaAt(e.contains,[\"contains\"],[\"allOf\",String(s),\"anyOf\",\"1\",\"not\",\"items\",\"not\"]);Qy(t,{anyOf:[{not:{type:\"array\"}},{not:{items:{not:a}}}]})}function Qy(e,t){Array.isArray(e.allOf)?e.allOf.push(t):w(e,\"allOf\",[t])}function r1(e,t,r,n){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&w(t,r,o);return}(typeof s!=\"string\"||!QD.test(s))&&io(\"$anchor\",n,\"the anchor is not valid\"),uQ.test(s)||io(\"$anchor\",n,\"the anchor cannot be represented as a plain-name fragment identifier\"),o===void 0?w(t,r,`#${s}`):io(\"$anchor\",n,\"it cannot be combined with the schema $id\")}function zD(e,t,r){let n=r===\"minimum\"?\"exclusiveMinimum\":\"exclusiveMaximum\",o=e[r],s=e[n];typeof s==\"number\"?typeof o==\"number\"&&(r===\"minimum\"?o>s:o<s)?w(t,r,o):(w(t,r,s),w(t,n,!0)):o!==void 0&&w(t,r,o)}function Yy(e){return Lo(Jf(e.ast),{schema:e})}var Jf=ni(e=>{let t=SQ(e,Jf),r=e.context;return t===e||r===void 0?t:Jd(t,kC(r))});function kC(e){return e.constructorDefault===void 0?e:new Po(e.isOptional,e.isMutable,void 0,e.annotations)}function o1(e){if(e.propertySignatures.some(t=>typeof t.name!=\"string\"))throw new globalThis.Error(\"Objects property names must be strings\",{cause:e})}function s1(e){return t=>{let r=[...t].sort((o,s)=>e(hn(o))-e(hn(s)));return r.some((o,s)=>o!==t[s])?r:t}}var bQ=s1(e=>{switch(e._tag){case\"BigInt\":case\"Symbol\":case\"UniqueSymbol\":return 0;default:return 1}});function SQ(e,t){switch(e._tag){case\"Declaration\":{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!Ht(r))return Ve(e,[Ay]);let n=e.typeParameters.map(s=>Lo(hn(s))),o=r(n);return o===void 0?e:Ve(e,[Hc(o,t)])}case\"Unknown\":return Ve(e,[Ay]);case\"ObjectKeyword\":return Ve(e,[tC]);case\"Undefined\":case\"Void\":case\"Literal\":case\"Number\":return e.toCodecJson();case\"UniqueSymbol\":case\"Symbol\":case\"BigInt\":return e.toCodecStringTree();case\"Objects\":return o1(e),e.recur(t,Gd);case\"Union\":{let r=bQ(e.types);return r!==e.types?new Yr(r,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case\"Arrays\":case\"Suspend\":return e.recur(t)}return e}function Xy(e){return Lo(a1(wt(e.ast)))}var a1=Tn(e=>{let t=EQ(e,a1);return t!==e&&e.context!==void 0?Jd(t,kC(e.context)):t});function EQ(e,t){switch(e._tag){case\"Declaration\":{let r=e.annotations?.toCodecIso??e.annotations?.toCodec;if(Ht(r)){let n=r(e.typeParameters.map(o=>Lo(o)));return Ve(e,[Hc(n,t)])}return e}case\"Arrays\":case\"Objects\":case\"Union\":case\"Suspend\":return e.recur(t)}return e}function eb(e){return Lo(f1(e.ast),{schema:e})}function i1(e){return Lo(l1(e.ast))}var IQ=s1(e=>{switch(e._tag){case\"Null\":case\"Boolean\":case\"Number\":case\"BigInt\":case\"Symbol\":case\"UniqueSymbol\":return 0;default:return 1}});function TQ(e,t,r){switch(e._tag){case\"Declaration\":{let n=e.typeParameters.map(u=>Lo(t(hn(u)))),o=e.annotations?.toCodecStringTree;if(Ht(o)){let u=o(n);return u===void 0?e:Ve(e,[Hc(u,t)])}let s=e.annotations?.toCodecJson,a=Ht(s)?s(n):void 0,i=a===void 0?e.annotations?.toCodec:void 0,c=a??(Ht(i)?i(n):void 0);return c===void 0?r(e):Ve(e,[Hc(c,t)])}case\"Null\":return Ve(e,[wQ]);case\"Boolean\":return Ve(e,[kQ]);case\"Unknown\":case\"ObjectKeyword\":return Ve(e,[vy]);case\"Enum\":case\"Number\":case\"Literal\":case\"UniqueSymbol\":case\"Symbol\":case\"BigInt\":return e.toCodecStringTree();case\"Objects\":return o1(e),e.recur(t,Gd);case\"Union\":{let n=IQ(e.types);return n!==e.types?new Yr(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case\"Arrays\":case\"Suspend\":return e.recur(t)}return e}var wQ=new pt(new dn(\"null\"),new be(Y(()=>null),Y(()=>\"null\"))),kQ=new pt(new Yr([new dn(\"true\"),new dn(\"false\")]),new be(Y(e=>e===\"true\"),Xa())),c1=new be(Y(e=>typeof e==\"string\"?[e]:e),ar()),u1=e=>e.transformation===c1,f1=ni(e=>{let t=TQ(e,f1,r=>{throw new globalThis.Error(\"Missing structural codec for StringTree\",{cause:r})});return t!==e&&e.context!==void 0?Jd(t,kC(e.context)):t},{stopAt:u1}),n1=e=>ir(e)?oi(oo):oo,l1=ni(e=>{let t=CQ(e);if(iy(t)){let r=sa(new Yr([new Nn(t.isMutable,t.elements.map(n1),t.rest.map(n1)),pn],{mode:\"anyOf\"}),t,c1);return ir(e)?oi(r):r}return t},{stopAt:u1});function CQ(e){return e._tag===\"Declaration\"||e._tag===\"Arrays\"||e._tag===\"Objects\"||e._tag===\"Union\"||e._tag===\"Suspend\"?e.recur(l1):e}var Dde=globalThis.RegExp;var ia=e=>e.replace(/[/\\\\^$*+?.()|[\\]{}]/g,\"\\\\$&\");function ai(e,t){return t.length>0&&(e+=`\n  at ${oh(t)}`),new Error(e)}function p1(e){return`#/$defs/${Hy(e)}`}var AQ=new Set([..._N,Pc,...vN]);function sm(e,t){if(e===void 0)return;let r={},n=e.title;typeof n==\"string\"&&(r.title=n);let o=e.description,s=e.expected;typeof o==\"string\"?r.description=o:t?.generateDescriptions===!0&&typeof s==\"string\"&&(r.description=s);let a=e.default;Wc(a)&&(r.default=a);let i=e.examples;Array.isArray(i)&&Wc(i)&&(r.examples=i);let c=e.readOnly;typeof c==\"boolean\"&&(r.readOnly=c);let u=e.writeOnly;typeof u==\"boolean\"&&(r.writeOnly=u);let l=e.format;typeof l==\"string\"&&(r.format=l);let p=e.contentEncoding;typeof p==\"string\"&&(r.contentEncoding=p);let d=e.contentMediaType;typeof d==\"string\"&&(r.contentMediaType=d);let m=e.contentSchema;if(Wc(m)&&(r.contentSchema=m),t?.includeAnnotationKey!==void 0)for(let[x,g]of Object.entries(e))AQ.has(x)||!t.includeAnnotationKey(x)||Wc(g)&&w(r,x,g);return Object.keys(r).length===0?void 0:r}function m1(e){let t=e.type===\"number\"||e.type===\"integer\"?e.type:void 0,r=e;if(t!==void 0&&(r={...e},delete r.type),Array.isArray(r.allOf)){let n=[],o=!1;for(let s of r.allOf){let a=m1(s);a.type!==void 0&&(o=!0,(t===void 0||a.type===\"integer\")&&(t=a.type)),Object.keys(a.schema).length>0&&n.push(a.schema)}if(o){let{allOf:s,...a}=r;r=n.length===0?a:{...a,allOf:n}}}return{type:t,schema:r}}function vQ(e){if(!Array.isArray(e.anyOf)||e.anyOf.length!==2||e.anyOf[0]?.type!==\"number\")return!1;let t=e.anyOf[1];return t?.type===\"string\"&&Array.isArray(t.enum)&&t.enum.length===3&&t.enum.includes(\"NaN\")&&t.enum.includes(\"Infinity\")&&t.enum.includes(\"-Infinity\")}var h1=\"|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|\";function tb(e,t){return Object.keys(e).every(r=>t.includes(`|${r}|`))}function d1(e,t){return typeof e.$ref!=\"string\"&&t.every(r=>!Object.hasOwn(e,r))}var vC=\"|title|description|default|examples|readOnly|writeOnly|\",OQ=h1+vC;function am(e,t,r){if(Object.keys(e).length===0)return t;let n=Object.keys(t);if(n.length===0)return e;let o=e.type===\"number\"||e.type===\"integer\"?e.type:void 0,s=vQ(e);if(o!==void 0||s){let i=m1(t);if(i.type!==void 0){let c=o===\"integer\"||i.type===\"integer\"?\"integer\":\"number\",u={...e,type:c};s&&delete u.anyOf;let l=Object.keys(i.schema);return l.length===0?u:tb(i.schema,vC)&&d1(u,l)?{...u,...i.schema}:am(u,i.schema,r)}}if(r&&d1(e,n))return{...e,...t};let a=Array.isArray(t.allOf)&&n.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...a]}:typeof e.$ref==\"string\"?{allOf:[e,...a]}:{...e,allOf:a}}function AC(e,t=new Set){return typeof e==\"boolean\"?e:t.has(e)?!0:(t.add(e),e.every(r=>AC(r,t)))}function _Q(e){return Array.isArray(e)}function RQ(e,t,r,n){let o=new Map,s=new Map,a=new WeakMap,i=new Map,c=new Map,u=Object.keys(r);for(let h of u)x(h,[\"references\",h]);let l=tn(e,(h,I)=>E(h,t[I],[]));for(let[h,I]of i.values())if(!AC(h))for(let C of I)Array.isArray(C.oneOf)&&(C.anyOf=C.oneOf,delete C.oneOf);for(let h of u){let I=r[h],C=y(I);if(C===void 0)continue;let A=o.get(h)[0],j=c.get(C),ce=j?.find(ge=>J(o.get(ge)[0],A));ce===void 0?j===void 0?c.set(C,[h]):j.push(h):s.set(h,ce)}let p=tn(l,g),d={};for(let h of u)s.has(h)||w(d,h,g(o.get(h)[0]));return{dialect:\"draft-2020-12\",schemas:p,definitions:d};function m(h){return Array.isArray(h.oneOf)&&i.get(h.oneOf)?.[1].push(h),h}function x(h,I){if(!Object.hasOwn(r,h))throw ai(`Invalid reference ${h}`,[...I,\"$ref\"]);let C=o.get(h);if(C!==void 0)return C;let A=[{},[]];return o.set(h,A),A[0]=E(r[h],[\"references\",h],A[1]),A}function g(h){return EC(h,I=>{let C=Wy(I);if(C===void 0){if(/^#(?:\\/|%2f)/i.test(I))throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(I)}`);return I}if(!C.startsWith(\"/$defs/\"))return I;let A=C.indexOf(\"/\",7),j=s.get(Hf(C.slice(7,A<0?void 0:A)));return j===void 0?I:I.replace(/^#(?:\\/|%2f).*?(?:\\/|%2f).*?(?=\\/|%2f|$)/i,p1(j))})}function y(h){if(h._tag===\"Reference\")return;let I=h.checks.length===0?h.annotations:h.checks[h.checks.length-1].annotations;return typeof I?.identifier!=\"string\"&&typeof I?.[Pc]==\"string\"?I[Pc]:void 0}function S(h,I,C,A){let j=h.annotations,ce=j?.toJsonSchema;if(ce!==void 0){let rt=h.representation?.schemas?.map((Ol,$j)=>E(Ol,[...C,\"representation\",\"schemas\",$j],A))??[],ga=ce({type:I,schemas:rt}),at=_Q(ga);at&&A.push(!1);let cr=at?ga[0]:ga,Tr=sm(j,n),vs=Tr===void 0?cr:{...cr,...Tr},xi=Tr===void 0?h1:OQ;return[vs,h._tag===\"Filter\"&&tb(vs,xi)&&(Tr===void 0||tb(Tr,vC))?!0:void 0]}if(h._tag===\"Filter\"){A.push(!1);return}let ge=h.checks.flatMap((rt,ga)=>{let at=S(rt,I,[...C,\"checks\",ga],A);return at===void 0?[]:[at[0]]});if(ge.length===0)return;let Fe=sm(j,n),Ut={allOf:ge};return[Fe===void 0?Ut:{...Ut,...Fe}]}function E(h,I,C){if(h._tag===\"Reference\")return C.push(x(h.$ref,I)[1]),{$ref:p1(h.$ref)};let A=a.get(h);if(A!==void 0)return C.push(A[1]),A[0];let j=[];C.push(j);let ce=U(h,I,j),ge=sm(h.annotations,n);ge!==void 0&&(ce={...ce,...ge});for(let Fe=0;Fe<h.checks.length;Fe++){let Ut=typeof ce.type==\"string\"&&MQ(ce.type)?ce.type:void 0,rt=S(h.checks[Fe],Ut,[...I,\"checks\",Fe],j);rt!==void 0&&(ce=am(ce,...rt))}return a.set(h,[ce,j]),m(ce)}function U(h,I,C){switch(h._tag){case\"Any\":case\"Unknown\":return{};case\"ObjectKeyword\":return{anyOf:[{type:\"object\"},{type:\"array\"}]};case\"Void\":case\"Undefined\":case\"Null\":return{type:\"null\"};case\"BigInt\":return{type:\"string\",allOf:[{pattern:\"^-?\\\\d+$\"}]};case\"Symbol\":return{type:\"string\",allOf:[{pattern:\"^Symbol\\\\(([\\\\s\\\\S]*)\\\\)$\"}]};case\"UniqueSymbol\":return globalThis.Symbol.keyFor(h.symbol)===void 0?{not:{}}:{type:\"string\",enum:[globalThis.String(h.symbol)]};case\"Declaration\":return C.push(!1),{};case\"Suspend\":return E(h.thunk,[...I,\"thunk\"],C);case\"Never\":return{not:{}};case\"String\":return{type:\"string\"};case\"Number\":return{anyOf:[{type:\"number\"},{type:\"string\",enum:[\"NaN\",\"Infinity\",\"-Infinity\"]}]};case\"Boolean\":return{type:\"boolean\"};case\"Literal\":{let A=h.literal;return typeof A==\"bigint\"?{type:\"string\",enum:[globalThis.String(A)]}:{type:typeof A,enum:[A]}}case\"Enum\":{let A=h.enums.map(([j,ce],ge)=>{if(typeof ce==\"number\"&&!globalThis.Number.isFinite(ce))throw ai(`Invalid numeric enum value ${globalThis.String(ce)}`,[...I,\"enums\",ge,1]);return{type:typeof ce,enum:[ce],title:j}});return A.length===0?{not:{}}:{anyOf:A}}case\"TemplateLiteral\":return{type:\"string\",pattern:`^${h.parts.map(rb).join(\"\")}$`};case\"Arrays\":{if(h.rest.length>1)throw ai(\"Invalid schema representation document\",[...I,\"rest\"]);let A={type:\"array\"},j=h.elements.length,ce=h.elements.map((ge,Fe)=>{ge.isOptional&&j--;let Ut=E(ge.type,[...I,\"elements\",Fe,\"type\"],C),rt=sm(ge.annotations,n);return rt===void 0?Ut:m(am(Ut,rt))});if(ce.length>0?(A.prefixItems=ce,A.maxItems=h.elements.length,j>0&&(A.minItems=j)):A.items=!1,h.rest.length===1){delete A.maxItems;let ge=E(h.rest[0],[...I,\"rest\",0],C);Object.keys(ge).length>0?A.items=ge:delete A.items}return A}case\"Objects\":{if(h.propertySignatures.length===0&&h.indexSignatures.length===0)return{not:{type:\"null\"}};let A={type:\"object\"},j={},ce=[];for(let at=0;at<h.propertySignatures.length;at++){let cr=h.propertySignatures[at];if(typeof cr.name!=\"string\")throw ai(\"Invalid schema representation document\",[...I,\"propertySignatures\",at,\"name\"]);let Tr=cr.name,vs=E(cr.type,[...I,\"propertySignatures\",at,\"type\"],C),xi=sm(cr.annotations,n);w(j,Tr,xi===void 0?vs:m(am(vs,xi))),cr.isOptional||ce.push(Tr)}h.propertySignatures.length>0&&(A.properties=j),ce.length>0&&(A.required=ce);let ge={},Fe=[],Ut=[],rt=!1;for(let at=0;at<h.indexSignatures.length;at++){let cr=h.indexSignatures[at],Tr=E(cr.type,[...I,\"indexSignatures\",at,\"type\"],C);J(Tr,{not:{}})&&(Tr=!1),Ut.push(Tr);let vs=F(cr.parameter,[...I,\"indexSignatures\",at,\"parameter\"],new Set);if(vs===void 0){rt=!0,C.push(!1);continue}if(vs.length===0)Fe.push(Tr);else for(let xi of vs){let Ol=ge[xi];w(ge,xi,Ol===void 0?Tr:Ol===!1||Tr===!1?!1:m(am(Ol,Tr)))}}let ga=Object.keys(ge).length>0;if(ga&&(A.patternProperties=ge),rt&&n?.onExcessProperty===\"error\"){let at=[];h.propertySignatures.length>0&&at.push({enum:Object.keys(j)});for(let cr=0;cr<h.indexSignatures.length;cr++)at.push(E(h.indexSignatures[cr].parameter,[...I,\"indexSignatures\",cr,\"parameter\"],C));A.propertyNames=at.length===1?at[0]:{anyOf:at},A.additionalProperties=Ut.length===1?Ut[0]:{anyOf:Ut},Fe.length>0&&(A.allOf=Fe.map(cr=>({type:\"object\",additionalProperties:cr})))}else Fe.length===0?A.additionalProperties=rt||n?.onExcessProperty!==\"error\":Fe.length===1&&h.propertySignatures.length===0&&!ga?A.additionalProperties=Fe[0]:Fe.length>0&&(A.allOf=Fe.map(at=>({type:\"object\",additionalProperties:at})));return typeof A.additionalProperties==\"object\"&&A.additionalProperties!==null&&Object.keys(A.additionalProperties).length===0&&delete A.additionalProperties,A}case\"Union\":{let A=[],j=h.types.map((ge,Fe)=>E(ge,[...I,\"types\",Fe],A));if(C.push(A),j.length===0)return{not:{}};let ce=h.options?.mode??\"anyOf\";if(ce===\"anyOf\"&&j.length>1){let ge=PQ(j);if(ge!==void 0)return ge}return ce===\"oneOf\"&&i.set(j,[A,[]]),{[ce]:j}}}}function F(h,I,C){switch(h._tag){case\"Reference\":{if(!Object.hasOwn(r,h.$ref))throw ai(`Invalid reference ${h.$ref}`,[...I,\"$ref\"]);if(x(h.$ref,I),C.has(h.$ref))return;let A=new Set(C).add(h.$ref);return F(r[h.$ref],[\"references\",h.$ref],A)}case\"String\":{if(h.checks.length===0)return[];if(h.checks.length!==1||h.checks[0]._tag!==\"Filter\"||h.checks[0].annotations?.toJsonSchema===void 0)return;let A=[],j=E(h,I,A);return AC(A)&&j.type===\"string\"&&typeof j.pattern==\"string\"&&tb(j,\"|type|pattern|title|description|default|examples|readOnly|writeOnly|\")?[j.pattern]:void 0}case\"TemplateLiteral\":return h.checks.length===0?[`^${h.parts.map(rb).join(\"\")}$`]:void 0;case\"Union\":{if(h.types.length===0||h.checks.length>0||h.options?.mode===\"oneOf\")return;let A=[];for(let j=0;j<h.types.length;j++){let ce=F(h.types[j],[...I,\"types\",j],C);if(ce===void 0)return;if(ce.length===0)return[];A.push(...ce)}return A}default:throw ai(\"Invalid schema representation document\",I)}}}function MQ(e){return e===\"string\"||e===\"number\"||e===\"boolean\"||e===\"array\"||e===\"object\"||e===\"null\"||e===\"integer\"}function PQ(e){let t,r=[];for(let n of e){if(Object.keys(n).length!==2||n.type===void 0||!Array.isArray(n.enum)||n.enum.length===0)return;if(t===void 0)t=n.type;else if(n.type!==t)return;for(let s of n.enum){if(r.includes(s))return;r.push(s)}}return{type:t,enum:r}}function rb(e){switch(e._tag){case\"Literal\":return ia(globalThis.String(e.literal));case\"String\":return Qk;case\"Number\":return Bd;case\"TemplateLiteral\":return e.parts.map(rb).join(\"\");case\"Union\":return`(?:${e.types.map(rb).join(\"|\")})`;default:throw ai(\"Invalid schema representation document\",[])}}function nb(e,t){let r=RQ([e.representation],[[\"representation\"]],e.references,t);return{dialect:r.dialect,schema:r.schemas[0],definitions:r.definitions}}var FQ=({identifier:e})=>e;function $o(e){return e===void 0?void 0:{annotations:e}}function im(e,t){let{references:r,representations:n}=UQ([e],t);return{representation:n[0],references:r}}function UQ(e,t){let r={},n=new Map,o=new Set,s=new Map,a=new Set;for(let h of e)m(h);let i=t?.referencePolicy??FQ;for(let h of s.values())for(let I of h.values()){let C=i({ast:I.ast,occurrences:I.occurrences,identifier:I.identifier});if(C!==void 0){let A=C===I.identifier||!C.endsWith(\"_\")?\"_\":\"\";I.reference=u(C,I,A)}else I.isRecursive&&(I.reference=u(`${I.ast._tag}_`,I,\"\"))}return{representations:tn(e,h=>g(h)),references:r};function u(h,I,C=\"_\"){let A=h,j=0;for(;n.has(A);){if(n.get(A)===I)return A;A=`${h}${C}${++j}`}return n.set(A,I),A}function l(h,I,C){let A=I.fallback;return A!==void 0?sw(h)===A?h:so(h,{[Pc]:A}):C===I.identifier?h:so(h,{identifier:C})}function p(h,I){if(!Object.hasOwn(r,h)&&!o.has(h)){o.add(h);let C=y(I);o.delete(h),w(r,h,C)}return{_tag:\"Reference\",$ref:h}}function d(h){let I=qc(h),C=jc(I),A=Fc(I),j=A===void 0?(I!==h?Fc(h):void 0)??sw(I):void 0;j!==void 0&&(A=`${j}Encoded`);let ce=s.get(C);ce===void 0&&(ce=new Map,s.set(C,ce));let ge=ce.get(A);return ge===void 0&&(ge={ast:C,identifier:A,fallback:j,occurrences:0,isRecursive:!1,reference:void 0},ce.set(A,ge)),ge}function m(h){let I=d(h),C=I.ast;if(I.occurrences++,a.has(I)){I.isRecursive=!0;return}if(!(I.occurrences>1)){switch(a.add(I),x(C.checks),C._tag){case\"Declaration\":case\"Arrays\":case\"Objects\":case\"Union\":C.recur(A=>(m(A),A));break;case\"TemplateLiteral\":C.parts.forEach(m);break;case\"Suspend\":m(C.thunk());break}a.delete(I)}}function x(h){h?.forEach(I=>{I.annotations?.representation?.schemas?.forEach(C=>m(wt(C))),I._tag===\"FilterGroup\"&&x(I.checks)})}function g(h){let I=d(h),C=I.ast,A=I.reference;if(A!==void 0){let j=I.identifier===void 0?C:l(C,I,A);return p(A,j)}return y(C)}function y(h){let I=S(h.checks);switch(h._tag){case\"Declaration\":return{_tag:\"Declaration\",typeParameters:h.typeParameters.map(C=>g(C)),checks:I,...U(h.annotations)};case\"Null\":case\"Undefined\":case\"Void\":case\"Never\":case\"Unknown\":case\"Any\":case\"String\":case\"Boolean\":case\"Number\":case\"BigInt\":case\"Symbol\":case\"ObjectKeyword\":return{_tag:h._tag,checks:I,...$o(h.annotations)};case\"Literal\":return{_tag:\"Literal\",literal:h.literal,checks:I,...$o(h.annotations)};case\"UniqueSymbol\":return{_tag:\"UniqueSymbol\",symbol:h.symbol,checks:I,...$o(h.annotations)};case\"Enum\":return{_tag:\"Enum\",enums:h.enums,checks:I,...$o(h.annotations)};case\"TemplateLiteral\":return{_tag:\"TemplateLiteral\",parts:h.parts.map(C=>g(C)),checks:I,...$o(h.annotations)};case\"Arrays\":return{_tag:\"Arrays\",elements:h.elements.map(C=>{let A=qc(C),j=A.context?.annotations;return{isOptional:ir(A),type:g(C),...$o(j)}}),rest:h.rest.map(C=>g(C)),checks:I,...$o(h.annotations)};case\"Objects\":return{_tag:\"Objects\",propertySignatures:h.propertySignatures.map(C=>{let A=qc(C.type),j=A.context?.annotations;return{name:C.name,type:g(C.type),isOptional:ir(A),isMutable:Kk(A),...$o(j)}}),indexSignatures:h.indexSignatures.map(C=>({parameter:g(C.parameter),type:g(C.type)})),checks:I,...$o(h.annotations)};case\"Union\":return{_tag:\"Union\",types:h.types.map(C=>g(C)),...h.options===void 0?{}:{options:h.options},checks:I,...$o(h.annotations)};case\"Suspend\":return{_tag:\"Suspend\",checks:[],thunk:g(h.thunk()),...$o(h.annotations)}}}function S(h){return h?.map(E)??[]}function E(h){switch(h._tag){case\"Filter\":return{_tag:\"Filter\",aborted:h.aborted,...F(h.annotations)};case\"FilterGroup\":return{_tag:\"FilterGroup\",checks:tn(h.checks,E),...F(h.annotations)}}}function U(h){if(h===void 0)return;let{representation:I,...C}=h;return{...I===void 0?void 0:{representation:I},...Object.keys(C).length===0?void 0:{annotations:C}}}function F(h){if(h===void 0)return;let{representation:I,...C}=h,A=I===void 0?void 0:I.schemas===void 0?I:{...I,schemas:I.schemas.map(j=>g(wt(j)))};return{...A===void 0?void 0:{representation:A},...Object.keys(C).length===0?void 0:{annotations:C}}}}function y1(e){return qe(e)?e.value:{issues:[{message:l0(e.cause)}]}}function S1(e,t){let r=tt(e),n={errors:\"all\",...t?.parseOptions},o=mw(t),s=a=>{let i=new wa(\"sync\"),c=Ec(aT(r(a,n),{onFailure:o,onSuccess:l=>({value:l})}),{scheduler:i});c.currentDispatcher?.flush();let u=c.pollUnsafe();return u?y1(u):new Promise(l=>{c.addObserver(p=>{l(y1(p))})})};if(\"~standard\"in e){let a=e;return\"validate\"in a[\"~standard\"]||Object.assign(a[\"~standard\"],{validate:s}),a}return Object.assign(e,{\"~standard\":{version:1,vendor:\"effect\",validate:s}})}function NQ(e){let t=im(Jf(e));return nb(t)}function b1(e,t){let r=NQ(e);if(t===\"draft-2020-12\"){let n=r.schema;return Object.keys(r.definitions).length>0&&(n.$defs=r.definitions),n}else if(t===\"draft-07\"){let n=bC(r),o=n.schema;return Object.keys(n.definitions).length>0&&(o.definitions=n.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function E1(e){let t={input(r){return b1(e.ast,r.target)},output(r){return b1(wt(e.ast),r.target)}};if(\"~standard\"in e){let r=e;return\"jsonSchema\"in r[\"~standard\"]||Object.assign(r[\"~standard\"],{jsonSchema:t}),r}return Object.assign(e,{\"~standard\":{version:1,vendor:\"effect\",jsonSchema:t}})}function T1(e,t){let r=[];return OC(e,t,\"\",r),r}function OC(e,t,r,n){if(!Object.is(e,t)){if(Array.isArray(e)&&Array.isArray(t)){let o=e.length,s=t.length,a=Math.min(o,s);for(let i=0;i<a;i++)OC(e[i],t[i],`${r}/${i}`,n);for(let i=o-1;i>=s;i--)n.push({op:\"remove\",path:`${r}/${i}`});for(let i=o;i<s;i++)n.push({op:\"add\",path:`${r}/${i}`,value:t[i]});return}if(ob(e)&&ob(t)){let o=Object.keys(e),s=Object.keys(t),a=Array.from(new Set([...o,...s])).sort();for(let i of a){let c=`${r}/${qy(i)}`,u=Object.hasOwn(e,i),l=Object.hasOwn(t,i);u&&l?OC(e[i],t[i],c,n):!u&&l?n.push({op:\"add\",path:c,value:t[i]}):n.push({op:\"remove\",path:c})}return}n.push({op:\"replace\",path:r,value:t})}}function w1(e,t){let r=t;for(let n of e)r=$Q(r,n);return r}function ob(e){return typeof e==\"object\"&&e!==null&&!Array.isArray(e)}function LQ(e){if(e===\"\")return[];if(e.charCodeAt(0)!==47)throw new Error(`Invalid JSON Pointer, it must start with \"/\": ${JSON.stringify(e)}`);return e.split(\"/\").slice(1).map(Hf)}function k1(e){if(!/^(0|[1-9]\\d*)$/.test(e))throw new Error(`Invalid array index: \"${e}\"`);return Number(e)}function $Q(e,t){if(t.path===\"\"){if(t.op===\"remove\")throw new Error(\"Unsupported operation at the root\");return t.value}let r=BQ(e,t.path);if(r===null)throw new Error(`Cannot ${t.op} at \"${t.path}\" (parent not found or not a container).`);let{lastToken:n,parent:o,stack:s}=r;if(Array.isArray(o)){if(n===\"-\"&&t.op!==\"add\")throw new Error(`\"-\" is not valid for ${t.op} at \"${t.path}\".`);let a=n===\"-\"?o.length:k1(n),i=t.op===\"add\"?o.length:o.length-1;if(a>i)throw new Error(`Array index out of bounds at \"${t.path}\".`);let c=o.slice();return t.op===\"add\"?c.splice(a,0,t.value):t.op===\"remove\"?c.splice(a,1):c[a]=t.value,I1(s,c)}if(ob(o)){if(t.op!==\"add\"&&!Object.hasOwn(o,n))throw new Error(`Property \"${n}\" does not exist at \"${t.path}\".`);let a={...o};return t.op===\"remove\"?delete a[n]:w(a,n,t.value),I1(s,a)}throw new Error(`Cannot ${t.op} at \"${t.path}\" (parent not found or not a container).`)}function BQ(e,t){let r=LQ(t);if(r.length===0)return null;let n=r[r.length-1],o=[],s=e;for(let a=0;a<r.length-1;a++){let i=r[a];if(Array.isArray(s)){let c=k1(i);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(ob(s)){if(!Object.hasOwn(s,i))return null;o.push({container:s,token:i}),s=s[i];continue}return null}return{stack:o,parent:s,lastToken:n}}function I1(e,t){let r=t;for(let n=e.length-1;n>=0;n--){let{container:o,token:s}=e[n];if(Array.isArray(o)){let a=o.slice();a[s]=r,r=a}else{let a={...o};w(a,s,r),r=a}}return r}function A1(e){let t=Yy(e),r=Xd(t),n=Yd(t);return{empty:[],diff:(o,s)=>T1(r(o),r(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let a=r(o),i=w1(s,a);return Object.is(i,a)?o:n(i)}}}function v1(e,t){let r=Fc(e.ast)??qg(e.ast),n=cC(eb(e));return o=>n(o).pipe(q(s=>jQ(s,{rootName:r,...t})))}function jQ(e,t){let r=t.rootName??\"root\",n=t.arrayItemName??\"item\",o=t.pretty??!0,s=t.indent??\"  \",a=t.sortKeys??!0,i=new Set,c=[];return l(r,e,0),c.join(o?`\n`:\"\");function u(p,d){c.push(o?s.repeat(p)+d:d)}function l(p,d,m,x){let{attrs:g,safe:y}=Gf.tagInfo(p,x);if(d===void 0)u(m,`<${y}${g}/>`);else if(typeof d==\"string\")u(m,`<${y}${g}>${Gf.escapeText(d)}</${y}>`);else if(typeof d!=\"object\"||d===null)u(m,`<${y}${g}>${Gf.escapeText(L(d))}</${y}>`);else{if(i.has(d))throw new globalThis.Error(\"Cycle detected while serializing to XML.\",{cause:d});i.add(d);try{if(globalThis.Array.isArray(d)){if(d.length===0){u(m,`<${y}${g}/>`);return}u(m,`<${y}${g}>`);for(let U of d)l(n,U,m+1);u(m,`</${y}>`);return}let S=d,E=Object.keys(S);if(a&&E.sort(),E.length===0){u(m,`<${y}${g}/>`);return}u(m,`<${y}${g}>`);for(let U of E)l(Gf.parseTagName(U).safe,S[U],m+1,U);u(m,`</${y}>`)}finally{i.delete(d)}}}}var Gf={escapeText(e){return e.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\")},escapeAttribute(e){return e.replace(/&/g,\"&amp;\").replace(/\"/g,\"&quot;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\")},parseTagName(e){let t=e,r=e;return/^[A-Za-z_]/.test(r)||(r=\"_\"+r),r=r.replace(/[^A-Za-z0-9._-]/g,\"_\"),/^xml/i.test(r)&&(r=\"_\"+r),{safe:r,changed:r!==t}},tagInfo(e,t){let{changed:r,safe:n}=Gf.parseTagName(e),s=r||t&&t!==e?` data-name=\"${Gf.escapeAttribute(t??e)}\"`:\"\";return{safe:n,attrs:s}}};var _C=Tn(e=>ii(e));function ii(e){let t=gs(e)?.toEquivalence;if(t)return t(Bc(e)?e.typeParameters.map(ii):[]);switch(e._tag){case\"Never\":return Ps();case\"Declaration\":return HQ(e);case\"Null\":case\"Undefined\":case\"Void\":case\"Unknown\":case\"Any\":case\"String\":case\"Number\":case\"Boolean\":case\"BigInt\":case\"Symbol\":case\"Literal\":case\"UniqueSymbol\":case\"ObjectKeyword\":case\"Enum\":case\"TemplateLiteral\":return J;case\"Arrays\":{let r=e.elements.map(ii),n=e.rest.map(ii),[o,...s]=n,a=s.length;return Bt((i,c)=>{if(!Array.isArray(i)||!Array.isArray(c))return!1;let u=i.length;if(u!==c.length)return!1;let l=0;for(;l<Math.min(u,e.elements.length);l++)if(!r[l](i[l],c[l]))return!1;if(n.length>0){for(;l<u-a;l++)if(!o(i[l],c[l]))return!1;for(let p=0;p<a;p++)if(!s[p](i[l+p],c[l+p]))return!1}return!0})}case\"Objects\":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return J;let r=e.propertySignatures.map(o=>ii(o.type)),n=e.indexSignatures.map(o=>ii(o.type));return Bt((o,s)=>{if(!kt(o)||!kt(s))return!1;for(let a=0;a<r.length;a++){let i=e.propertySignatures[a],c=i.name,u=Object.hasOwn(o,c),l=Object.hasOwn(s,c);if(ir(i.type)&&u!==l||u&&l&&!r[a](o[c],s[c]))return!1}for(let a=0;a<n.length;a++){let i=e.indexSignatures[a],c=oa(o,i.parameter),u=oa(s,i.parameter);if(c.length!==u.length)return!1;for(let l=0;l<c.length;l++){let p=c[l];if(!Object.hasOwn(s,p)||!n[a](o[p],s[p]))return!1}}return!0})}case\"Union\":{let r=wt(e).types,n=$f(r),o=r.map((s,a)=>[si(s),ii(e.types[a])]);return Bt((s,a)=>{let i=n(s,!1);for(let c=0;c<i.length;c++){let[u,l]=o[i[c]];if(u(s)&&u(a))return l(s,a)}return!1})}case\"Suspend\":{let r;return Bt((n,o)=>(r??=_C(e.thunk()))(n,o))}}}function HQ(e){let t=e.annotations?.representation;if(t===void 0)return J;switch(t.id){case\"effect/schema/Option\":{let[r]=Jc(e);return(n,o)=>n._tag===o._tag&&(n._tag===\"None\"||r(n.value,o.value))}case\"effect/schema/Result\":{let[r,n]=Jc(e);return(o,s)=>o._tag===s._tag&&(o._tag===\"Success\"?r(o.success,s.success):n(o.failure,s.failure))}case\"effect/schema/CauseReason\":{let[r,n]=Jc(e);return _1(r,n)}case\"effect/schema/Cause\":{let[r,n]=Jc(e);return O1(r,n)}case\"effect/schema/Exit\":{let[r,n,o]=Jc(e),s=O1(n,o);return(a,i)=>a._tag===i._tag&&(a._tag===\"Success\"?r(a.value,i.value):s(a.cause,i.cause))}case\"effect/schema/ReadonlyMap\":{let[r,n]=Jc(e);return nh(r,n)}case\"effect/schema/ReadonlySet\":return $l(Jc(e)[0]);case\"effect/schema/RegExp\":return(r,n)=>r.source===n.source&&r.flags===n.flags;case\"effect/schema/URL\":return(r,n)=>r.toString()===n.toString();default:return J}}function Jc(e){return e.typeParameters.map(ii)}function _1(e,t){return(r,n)=>{if(r._tag!==n._tag)return!1;switch(r._tag){case\"Fail\":return e(r.error,n.error);case\"Die\":return t(r.defect,n.defect);case\"Interrupt\":return r.fiberId===n.fiberId}}}function O1(e,t){let r=Su(_1(e,t));return(n,o)=>r(n.reasons,o.reasons)}function M1(e,t){return r=>{switch(r._tag){case\"Fail\":return`Fail(${e(r.error)})`;case\"Die\":return`Die(${t(r.defect)})`;case\"Interrupt\":return\"Interrupt\"}}}function R1(e,t){let r=M1(e,t);return n=>`Cause([${n.reasons.map(r).join(\", \")}])`}function P1(e,t){let r=new Map;return n(e);function n(a){let i=r.get(a);return i===void 0&&(i=o(a),r.set(a,i)),i}function o(a){let i=gs(a)?.toFormatter;if(typeof i==\"function\")return i(Bc(a)?a.typeParameters.map(n):[]);if(t?.onBefore){let c=t.onBefore(a,n);if(c!==void 0)return c}return s(a)}function s(a){switch(a._tag){default:return L;case\"Never\":return()=>\"never\";case\"Void\":return()=>\"void\";case\"Declaration\":{let i=a.annotations?.representation;if(i===void 0)return L;let c=a.typeParameters.map(n);switch(i.id){case\"effect/schema/Option\":{let[u]=c;return it({onNone:()=>\"none()\",onSome:l=>`some(${u(l)})`})}case\"effect/schema/Result\":{let[u,l]=c;return rr({onSuccess:p=>`success(${u(p)})`,onFailure:p=>`failure(${l(p)})`})}case\"effect/schema/CauseReason\":return M1(c[0],c[1]);case\"effect/schema/Cause\":return R1(c[0],c[1]);case\"effect/schema/Exit\":{let[u,l,p]=c,d=R1(l,p);return m=>{switch(m._tag){case\"Success\":return`Exit.Success(${u(m.value)})`;case\"Failure\":return`Exit.Failure(${d(m.cause)})`}}}case\"effect/schema/ReadonlyMap\":{let[u,l]=c;return p=>{let d=p.size;if(d===0)return\"ReadonlyMap(0) {}\";let m=globalThis.Array.from(p.entries()).sort().map(([x,g])=>`${u(x)} => ${l(g)}`);return`ReadonlyMap(${d}) { ${m.join(\", \")} }`}}case\"effect/schema/HashMap\":{let[u,l]=c;return p=>{let d=aN(p);if(d===0)return\"HashMap(0) {}\";let m=md(p).sort().map(([x,g])=>`${u(x)} => ${l(g)}`);return`HashMap(${d}) { ${m.join(\", \")} }`}}case\"effect/schema/ReadonlySet\":{let[u]=c;return l=>{let p=l.size;if(p===0)return\"ReadonlySet(0) {}\";let d=globalThis.Array.from(l.values()).sort().map(m=>`${u(m)}`);return`ReadonlySet(${p}) { ${d.join(\", \")} }`}}case\"effect/schema/HashSet\":{let[u]=c;return l=>{let p=lN(l);if(p===0)return\"HashSet(0) {}\";let d=globalThis.Array.from(l).sort().map(m=>`${u(m)}`);return`HashSet(${p}) { ${d.join(\", \")} }`}}case\"effect/schema/Chunk\":{let[u]=c;return l=>{let p=$U(l);if(p===0)return\"Chunk(0) {}\";let d=globalThis.Array.from(l).sort().map(m=>`${u(m)}`);return`Chunk(${p}) { ${d.join(\", \")} }`}}default:return L}}case\"Arrays\":{let i=a.elements.map(d=>n(d)),c=a.rest.map(n),[u,...l]=c,p=l.length;return d=>{let m=[],x=0;for(;x<i.length;x++)if(d.length<x+1){if(ir(a.elements[x]))continue}else m.push(i[x](d[x]));if(c.length>0){for(;x<d.length-p;x++)m.push(u(d[x]));for(let g=0;g<p;g++)m.push(l[g](d[x+g]))}return\"[\"+m.join(\", \")+\"]\"}}case\"Objects\":{let i=a.propertySignatures.map(u=>n(u.type)),c=a.indexSignatures.map(u=>n(u.type));return a.propertySignatures.length===0&&a.indexSignatures.length===0?L:u=>{let l=[],p=new Set;for(let d=0;d<i.length;d++){let m=a.propertySignatures[d],x=m.name;p.add(x),!(ir(m.type)&&!Object.hasOwn(u,x))&&l.push(`${Xo(x)}: ${i[d](u[x])}`)}for(let d=0;d<c.length;d++){let m=oa(u,a.indexSignatures[d].parameter);for(let x of m)p.has(x)||(p.add(x),l.push(`${Xo(x)}: ${c[d](u[x])}`))}return l.length>0?\"{ \"+l.join(\", \")+\" }\":\"{}\"}}case\"Union\":{let i=wt(a).types,c=$f(i),u=i.map((l,p)=>[si(l),n(a.types[p])]);return l=>{let p=c(l,!1);for(let d=0;d<p.length;d++){let[m,x]=u[p[d]];if(m(l))return x(l)}return L(l)}}case\"Suspend\":{let i;return c=>(i??=n(a.thunk()))(c)}}}}var RC=f(2,(e,t)=>FC(e,(r,n)=>U1(t,r)?[r,n]:void 0)),MC=f(2,(e,t)=>FC(e,(r,n)=>U1(t,r)?void 0:[r,n])),F1=f(2,(e,t)=>({...e,...t}));var PC=f(2,(e,t)=>FC(e,(r,n)=>[Object.hasOwn(t,r)?t[r]:r,n]));var Nr=e=>e;function U1(e,t){return e.some(r=>r===t||typeof r==\"number\"&&String(r)===t)}function FC(e,t){let r={};for(let n of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;let o=t(n,e[n]);if(o){let[s,a]=o;w(r,s,a)}}return r}function L1(e,t){return Bo(Kf(\"Iso\",e,t))}function N1(e,t){return Bo(Kf(\"Lens\",e,t))}function Kf(e,t,r){return[{_tag:\"PrimitiveNode\",kind:e,get:t,set:r}]}var GQ={kind:\"Iso\",get:_,set:_},sb=class{_tag=\"PathNode\";kind=\"Lens\";path;get;set;constructor(t){this.path=t,this.get=r=>{let n=r;for(let o=0;o<t.length;o++)n=n[t[o]];return n},this.set=(r,n)=>{let o=ab(n),s=o,a=0;for(;a<t.length-1;a++){let i=t[a];w(s,i,ab(s[i])),s=s[i]}return w(s,t[a],r),o}}},cm=class{_tag=\"CheckNode\";kind=\"Prism\";checks;get;set=_;constructor(t){this.checks=t,this.get=r=>Yk(t,r)}};function Gc(e,t){if(e.length===0)return t;if(t.length===0)return e;let r=e.slice();for(let n=0;n<t.length;n++){let o=t[n],s=r[r.length-1];s._tag===\"PathNode\"&&o._tag===\"PathNode\"?r[r.length-1]=new sb([...s.path,...o.path]):s._tag===\"CheckNode\"&&o._tag===\"CheckNode\"?r[r.length-1]=new cm([...s.checks,...o.checks]):r.push(o)}return r}function KQ(e,t){return Bo(Kf(\"Optional\",e,t))}var Vf=class{node;getResult;replaceResult;constructor(t,r,n){this.node=t,this.getResult=r,this.replaceResult=n}replace(t,r){return Aa(this.replaceResult(t,r),()=>r)}modify(t){return r=>Aa(St(this.getResult(r),n=>this.replaceResult(t(n),r)),()=>r)}compose(t){return Bo(Gc(this.node,t.node))}key(t){return Bo(Gc(this.node,[new sb([t])]))}optionalKey(t){return Bo(Gc(this.node,Kf(\"Lens\",r=>r[t],(r,n)=>{let o=ab(n);return r===void 0?Array.isArray(o)&&(typeof t==\"number\"||typeof t==\"string\"&&Nu(t))?o.splice(Number(t),1):delete o[t]:w(o,t,r),o})))}check(...t){return Bo(Gc(this.node,[new cm(t)]))}refine(t,r){return Bo(Gc(this.node,[new cm([Hd(t,r)])]))}tag(t){let r=D(new se({expected:`${JSON.stringify(t)} tag`}));return Bo(Gc(this.node,Kf(\"Prism\",n=>n._tag===t?P(n):r,_)))}at(t,...r){let n=D(new ht([t],new ys(void 0)));return Bo(Gc(this.node,Kf(\"Optional\",o=>Object.hasOwn(o,t)?P(o[t]):n,(o,s)=>{if(Object.hasOwn(s,t)){let a=ab(s);return w(a,t,o),P(a)}else return n})))}pick(t){return this.compose(N1(RC(t),(r,n)=>({...MC(n,t),...r})))}omit(t){return this.compose(N1(MC(t),(r,n)=>({...RC(n,t),...r})))}notUndefined(){return this.refine(kr,{expected:\"a value other than `undefined`\"})}forEach(t){let r=t(ib());return KQ(n=>mt(this.getResult(n),o=>{let s=[];for(let a=0;a<o.length;a++){let i=r.getResult(o[a]);je(i)&&s.push(i.success)}return s}),(n,o)=>St(this.getResult(o),s=>{let a=[];for(let c=0;c<s.length;c++)je(r.getResult(s[c]))&&a.push(c);if(n.length!==a.length)return D(new se({message:`each: replacement length mismatch: ${n.length} !== ${a.length}`}));let i=s.slice();for(let c=0;c<a.length;c++){let u=a[c],l=r.replaceResult(n[c],s[u]);if(Q(l))return D(new ht([u],l.failure));i[u]=l.success}return this.replaceResult(i,o)}))}modifyAll(t){return r=>Aa(St(this.getResult(r),n=>this.replaceResult(n.map(t),r)),()=>r)}},NC=class extends Vf{get;set;constructor(t,r,n){super(t,o=>P(r(o)),o=>P(n(o))),this.get=r,this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>this.set(t(this.get(r)))}},DC=class extends Vf{get;constructor(t,r,n){super(t,o=>P(r(o)),(o,s)=>P(n(o,s))),this.get=r,this.replace=n}modify(t){return r=>this.replace(t(this.get(r)),r)}},LC=class extends Vf{set;constructor(t,r,n){super(t,r,(o,s)=>P(n(o))),this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>Aa(mt(this.getResult(r),n=>this.set(t(n))),()=>r)}};function Bo(e){let t=e[0]??GQ;if(e.length>1){let r=e.reduce((n,o)=>QQ(n,o.kind),\"Iso\");t={kind:r,get:VQ(e,r),set:ZQ(e,r)}}switch(t.kind){case\"Iso\":return new NC(e,t.get,t.set);case\"Lens\":return new DC(e,t.get,t.set);case\"Prism\":return new LC(e,t.get,t.set);case\"Optional\":return new Vf(e,t.get,t.set)}}function ab(e){if(Array.isArray(e))return e.slice();if(typeof e==\"object\"&&e!==null){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Error(\"Cannot clone object with non-Object constructor or null prototype\");return{...e}}return e}function VQ(e,t){return r=>{for(let n=0;n<e.length;n++){let o=e[n],s=o.get(r);if($C(o.kind)){if(Q(s))return s;r=s.success}else r=s}return $C(t)?P(r):r}}function ZQ(e,t){return D1(t)?r=>{for(let n=e.length-1;n>=0;n--)r=e[n].set(r);return r}:(r,n)=>{let o=e.length,s=new Array(o);for(let a=0;a<o;a++){s[a]=n;let i=e[a];if($C(i.kind)){let c=i.get(n);if(Q(c))return c;n=c.success}else n=i.get(n)}for(let a=o-1;a>=0;a--){let i=e[a];if(D1(i.kind))r=i.set(r);else if(i.kind===\"Lens\")r=i.set(r,s[a]);else{let c=i.set(r,s[a]);if(Q(c))return c;r=c.success}}return t===\"Optional\"?P(r):r}}function $C(e){return e===\"Prism\"||e===\"Optional\"}function D1(e){return e===\"Iso\"||e===\"Prism\"}function QQ(e,t){return e===\"Iso\"?t:t===\"Iso\"||e===t?e:\"Optional\"}var YQ=Bo([]);function ib(){return YQ}function B1(e){let t=Xy(e);return L1(Xd(t),Yd(t))}function z1(e){return ib()}function j1(e){return ib()}var Zf=\"~effect/Schema/SchemaError\";function q1(e){return k(e,Zf)&&e[Zf]===Zf}var Ln=\"~effect/net/NetAddress\";var zo=e=>e.value,jo=e=>e,ca=e=>e.bytes,Kc=class extends rn(\"NetAddressError\"){},Qf=e=>k(e,Ln),Dr=e=>Qf(e)&&e._tag===\"Ipv4Address\",Ss=e=>Qf(e)&&e._tag===\"Ipv6Address\",H1=e=>Dr(e)||Ss(e),Yf=e=>Dr(e)?32:128,Xf=e=>Qf(e)&&e._tag===\"MacAddress\",fm=e=>Qf(e)&&e._tag===\"InetAddressV4\",lm=e=>Qf(e)&&e._tag===\"InetAddressV6\",BC=e=>fm(e)||lm(e),cb=e=>Qf(e)&&e._tag===\"UnixPathAddress\",W1=e=>BC(e)||cb(e),eY={_tag:\"Ipv4Address\",[Ln]:Ln,[ie](e){return Dr(e)&&zo(this)===zo(e)},[ae](){return fr(oe(oY,zo(this)|0))},toString(){return qo(this)},toJSON(){return this.toString()},[Ie](){return this.toJSON()}},tY={_tag:\"Ipv6Address\",[Ln]:Ln,[ie](e){if(!Ss(e))return!1;let t=jo(this),r=jo(e);return t.w0===r.w0&&t.w1===r.w1&&t.w2===r.w2&&t.w3===r.w3},[ae](){let e=jo(this),t=oe(sY,e.w0|0);return t=oe(t,e.w1|0),t=oe(t,e.w2|0),fr(oe(t,e.w3|0))},toString(){return qo(this)},toJSON(){return this.toString()},[Ie](){return this.toJSON()}},rY={_tag:\"MacAddress\",[Ln]:Ln,[ie](e){return Xf(e)&&nY(ca(this),ca(e))},[ae](){return oe(aY,xr(ca(this)))},toString(){return jC(this)},toJSON(){return this.toString()},[Ie](){return this.toJSON()}},nY=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},oY=Ne(\"Ipv4Address\"),sY=Ne(\"Ipv6Address\"),aY=Ne(\"MacAddress\"),iY=e=>{let t=Object.create(eY);return t.value=e>>>0,Object.freeze(t)},cY=(e,t,r,n)=>{let o=Object.create(tY);return o.w0=e>>>0,o.w1=t>>>0,o.w2=r>>>0,o.w3=n>>>0,Object.freeze(o)},uY=(e,t,r,n)=>(e<<24|t<<16|r<<8|n)>>>0;var um=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],fY=e=>{let t=Object.assign(Object.create(rY),{bytes:new Uint8Array(e)});return Object.freeze(t)};var Mt=(e,t)=>D(new Kc({input:e,message:t})),lY=e=>e.every(t=>Number.isInteger(t)&&t>=0&&t<=255)?P(iY(uY(e[0],e[1],e[2],e[3]))):Mt(e,\"octets must be integers from 0 through 255\"),pY=e=>e.every(t=>Number.isInteger(t)&&t>=0&&t<=65535)?P(cY(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):Mt(e,\"segments must be integers from 0 through 65535\");var J1=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?P(fY(new Uint8Array(e.split(\":\").map(t=>Number.parseInt(t,16))))):Mt(e,\"expected six two-digit hexadecimal octets separated by colons\");var el=e=>{let t=e.split(\".\");if(t.length!==4||t.some(n=>!/^\\d{1,3}$/.test(n)))return Mt(e,\"expected exactly four decimal octets\");if(t.some(n=>n.length>1&&n[0]===\"0\"))return Mt(e,\"leading zeroes are not allowed\");let r=t.map(Number);return r.some(n=>n>255)?Mt(e,\"octets must be at most 255\"):lY([r[0],r[1],r[2],r[3]])},dY=e=>{if(e.includes(\"[\")||e.includes(\"]\")||e.includes(\"%\"))return Mt(e,\"brackets and zone identifiers are not valid in a bare IPv6 address\");let t=e.split(\"::\");if(t.length>2)return Mt(e,\"only one compression marker is allowed\");let r=t[0]===\"\"?[]:t[0].split(\":\"),n=t.length===2&&t[1]!==\"\"?t[1].split(\":\"):[];if(r.some(l=>l===\"\")||n.some(l=>l===\"\"))return Mt(e,\"empty segments are only valid in the compression marker\");let o=n.length>0?n[n.length-1]:r.length>0?r[r.length-1]:\"\",s;if(o.includes(\".\")){if(t.length===2&&n.length===0)return Mt(e,\"embedded IPv4 syntax must be trailing\");let l=mt(el(o),p=>{let d=zo(p);return[d>>>16,d&65535]});if(Q(l))return l;s=l.success,n.length>0?n.pop():r.pop()}let a=r.length+n.length+(s?2:0);if(t.length===1?a!==8:a>=8)return Mt(e,t.length===1?\"expected eight segments\":\"compression must replace at least one segment\");let i=l=>/^[0-9a-fA-F]{1,4}$/.test(l)?Number.parseInt(l,16):void 0,c=r.map(i),u=n.map(i);return c.some(l=>l===void 0)||u.some(l=>l===void 0)?Mt(e,\"segments must contain one through four hexadecimal digits\"):P([...c,...Array(8-a).fill(0),...u,...s??[]])},pm=e=>St(dY(e),t=>pY(t)),dm=e=>e.includes(\":\")?pm(e):el(e);var zC=e=>um(zo(e)),mY=e=>{let{w0:t,w1:r,w2:n,w3:o}=jo(e);return[t>>>16,t&65535,r>>>16,r&65535,n>>>16,n&65535,o>>>16,o&65535]},G1=e=>{let{w0:t,w1:r,w2:n,w3:o}=jo(e);return[...um(t),...um(r),...um(n),...um(o)]};var jC=e=>Array.from(ca(e),t=>t.toString(16).padStart(2,\"0\")).join(\":\"),ub=e=>ca(e).every(t=>t===255),hY=e=>(ca(e)[0]&1)!==0,fb=e=>(ca(e)[0]&1)===0,qC=e=>(ca(e)[0]&2)!==0,HC=e=>(ca(e)[0]&2)===0;var qo=e=>{if(Dr(e))return zC(e).join(\".\");let t=mY(e);if(xY(e))return`::ffff:${t[6]>>8}.${t[6]&255}.${t[7]>>8}.${t[7]&255}`;let r=-1,n=0,o=-1;for(let i=0;i<=8;i++)i<8&&t[i]===0?o===-1&&(o=i):o!==-1&&(i-o>n&&(r=o,n=i-o),o=-1);if(n<2)return t.map(i=>i.toString(16)).join(\":\");let s=t.slice(0,r).map(i=>i.toString(16)).join(\":\"),a=t.slice(r+n).map(i=>i.toString(16)).join(\":\");return`${s}::${a}`},lb=e=>{if(Dr(e))return zo(e)===0;let{w0:t,w1:r,w2:n,w3:o}=jo(e);return t===0&&r===0&&n===0&&o===0},WC=e=>{if(Dr(e))return zo(e)>>>24===127;let{w0:t,w1:r,w2:n,w3:o}=jo(e);return t===0&&r===0&&n===0&&o===1},tl=e=>Xf(e)?hY(e):Dr(e)?zo(e)>>>28===14:jo(e).w0>>>24===255,pb=e=>Xf(e)?ub(e):zo(e)===4294967295,JC=e=>Xf(e)?fb(e):!tl(e)&&!lb(e)&&(!Dr(e)||!pb(e)),GC=e=>Dr(e)?zo(e)>>>16===43518:(jo(e).w0>>>16&65472)===65152,KC=e=>{let t=zo(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},VC=e=>(jo(e).w0>>>24&254)===252,xY=e=>{let{w0:t,w1:r,w2:n}=jo(e);return t===0&&r===0&&n===65535};var gY={_tag:\"InetAddressV4\",[Ln]:Ln,[ie](e){return fm(e)&&this.port===e.port&&J(this.address,e.address)},[ae](){return oe(H(this.address),Dt(this.port))},toString(){return db(this)},toJSON(){return this.toString()},[Ie](){return this.toJSON()}},yY={_tag:\"InetAddressV6\",[Ln]:Ln,[ie](e){return lm(e)&&this.port===e.port&&this.scopeId===e.scopeId&&J(this.address,e.address)},[ae](){return oe(oe(H(this.address),Dt(this.port)),Dt(this.scopeId))},toString(){return db(this)},toJSON(){return this.toString()},[Ie](){return this.toJSON()}},K1=e=>Number.isInteger(e)&&e>=0&&e<=65535,bY=(e,t)=>{if(!K1(t))return Mt(e,\"port must be an integer from 0 through 65535\");let r=Object.create(gY);return r.address=e,r.port=t,P(Object.freeze(r))},SY=(e,t,r)=>{if(!K1(t))return Mt(e,\"port must be an integer from 0 through 65535\");let n=r?.scopeId??0;if(!Number.isInteger(n)||n<0||n>4294967295)return Mt(e,\"scopeId must be an unsigned 32-bit integer\");let o=Object.create(yY);return o.address=e,o.port=t,o.scopeId=n,P(Object.freeze(o))};var V1=e=>{let t,r,n=0,o=e.startsWith(\"[\");if(o){let s=e.indexOf(\"]\");if(s<0||e[s+1]!==\":\"||e.indexOf(\"]\",s+1)!==-1)return Mt(e,\"expected [IPv6]:port\");t=e.slice(1,s),r=e.slice(s+2);let a=t.indexOf(\"%\");if(a!==-1){let i=t.slice(a+1);if(t.indexOf(\"%\",a+1)!==-1||!/^\\d+$/.test(i))return Mt(e,\"scope identifier must be decimal\");if(n=Number(i),!Number.isInteger(n)||n>4294967295)return Mt(e,\"scope identifier must be an unsigned 32-bit integer\");t=t.slice(0,a)}}else{let s=e.lastIndexOf(\":\");if(s<0)return Mt(e,\"expected host:port or [IPv6]:port\");if(e.indexOf(\":\")!==s)return Mt(e,\"IPv6 addresses must be bracketed\");t=e.slice(0,s),r=e.slice(s+1)}return/^(0|[1-9]\\d*)$/.test(r)?St(dm(t),s=>o!==Ss(s)?Mt(e,\"only IPv6 addresses use brackets\"):Ss(s)?SY(s,Number(r),{scopeId:n}):bY(s,Number(r))):Mt(e,\"port must be an unpadded decimal integer\")};var EY=e=>qo(e.address)+(lm(e)&&e.scopeId!==0?`%${e.scopeId}`:\"\");var db=e=>{let t=EY(e);return fm(e)?`${t}:${e.port}`:`[${t}]:${e.port}`};var IY={_tag:\"UnixPathAddress\",[Ln]:Ln,[ie](e){return cb(e)&&this.path===e.path},[ae](){return oe(Ne(\"UnixPathAddress\"),Ne(this.path))},toString(){return this.path},toJSON(){return this.toString()},[Ie](){return this.toJSON()}},Z1=e=>{let t=Object.create(IY);return t.path=e,Object.freeze(t)};var QC=\"~effect/net/IpInterface\",Q1=e=>mm(e)&&Dr(e.address),Y1=e=>mm(e)&&Ss(e.address),mm=e=>k(e,QC),TY={_tag:\"IpInterface\",[QC]:QC,[ie](e){return mm(e)&&this.prefixLength===e.prefixLength&&J(this.address,e.address)},[ae](){return oe(H(this.address),Dt(this.prefixLength))},toString(){return xm(this)},toJSON(){return this.toString()},[Ie](){return this.toJSON()}},YC=(e,t)=>D(new Kc({input:e,message:t})),hm=(e,t)=>{let r=Yf(e);if(!Number.isInteger(t)||t<0||t>r)return YC(e,`prefix length must be an integer from 0 through ${r}`);let n=Object.assign(Object.create(TY),{address:e,prefixLength:t});return P(Object.freeze(n))},XC=(e,t)=>{let r=e.indexOf(\"/\");if(r===-1&&t?.prefix!==\"required\")return P({address:e,prefixLength:void 0});if(r<=0||r!==e.lastIndexOf(\"/\")||r===e.length-1)return YC(e,\"expected an address and prefix length separated by one slash\");let n=e.slice(r+1);return/^(0|[1-9][0-9]*)$/.test(n)?P({address:e.slice(0,r),prefixLength:Number(n)}):YC(e,\"prefix length must be an unpadded ASCII decimal integer\")},mb=(e,t)=>St(XC(e,t),r=>St(el(r.address),n=>hm(n,r.prefixLength??Yf(n)))),hb=(e,t)=>St(XC(e,t),r=>St(pm(r.address),n=>hm(n,r.prefixLength??Yf(n)))),xb=(e,t)=>St(XC(e,t),r=>St(dm(r.address),n=>hm(n,r.prefixLength??Yf(n))));var xm=e=>`${qo(e.address)}/${e.prefixLength}`;var eA=\"~effect/net/IpNetwork\",e2=e=>gm(e)&&Dr(e.address),t2=e=>gm(e)&&Ss(e.address),gm=e=>k(e,eA),wY={_tag:\"IpNetwork\",[eA]:eA,[ie](e){return gm(e)&&this.prefixLength===e.prefixLength&&J(this.address,e.address)},[ae](){return oe(H(this.address),Dt(this.prefixLength))},toString(){return ym(this)},toJSON(){return this.toString()},[Ie](){return this.toJSON()}},kY=e=>{let t=Object.assign(Object.create(wY),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},CY=e=>Dr(e)?zC(e):G1(e);var AY=(e,t)=>{let r=Math.floor(t/8),n=t%8;return e.map((o,s)=>s<r?o:s===r&&n!==0?o&(255<<8-n&255):0)},tA=(e,t)=>St(hm(e,t),r=>{let n=CY(e),o=AY(n,t);return n.some((s,a)=>s!==o[a])?D(new Kc({input:e,message:\"address has non-zero host bits\"})):P(kY(r))});var r2=e=>St(mb(e,{prefix:\"required\"}),t=>tA(t.address,t.prefixLength)),n2=e=>St(hb(e,{prefix:\"required\"}),t=>tA(t.address,t.prefixLength)),o2=e=>St(xb(e,{prefix:\"required\"}),t=>tA(t.address,t.prefixLength));var ym=e=>`${qo(e.address)}/${e.prefixLength}`;var bm=jy;function gn(){return(e,t,r)=>G(new zc(e.map(Lf),n=>t(n.map(o=>G(o))),r))}function Je(e,t){return gn()([],()=>(r,n,o)=>e(r)?b(r):N(new xt(n,r,o)),t)}function OY(e){return e}function _Y(e){return t=>t.annotate(e)}function RY(e){return t=>rA(rA(t).annotate(e))}function MY(e){return t=>t.rebuild(zf(t.ast,e))}function PY(e){return e}var ua=class extends rn(\"SchemaError\"){[Zf]=Zf;constructor(t){let r=Bn();Cr(0);try{super({issue:t})}finally{Cr(r)}}get message(){return gw(this.issue)}toString(){return`SchemaError(${this.message})`}};function y2(e){return q1(e)}function b2(e){return ze(e)?iA(e):Ot(e,t=>Qs(()=>Ks(t,r=>new ua(r))))}function iA(e){return qe(e)?e:sn(Ks(e.cause,t=>new ua(t)))}function S2(e,t){let r;for(let n of e.reasons){if(!Bp(n)||!y2(n.error))throw new globalThis.Error(t,{cause:e});r??=n.error}if(r===void 0)throw new globalThis.Error(t,{cause:e});return r}function E2(e){return ad(e).then(t=>{if(qe(t))return t.value;throw S2(t.cause,\"Promise adapter can only reject schema errors\")})}function I2(e){let t=hs(e);if(qe(t))return t.value;throw S2(t.cause,\"Sync adapter can only throw schema errors\")}function FY(e,t){return S1(e,t)}function UY(e){return E1(e)}var NY=Uy,DY=aC;function gb(e,t){let r=tt(e,t);return(n,o)=>b2(r(n,o))}var LY=gb;function T2(e,t){let r=Ny(e,t);return(n,o)=>iA(r(n,o))}var $Y=T2,BY=Dy,zY=iC;function w2(e,t){let r=Ly(e,t);return(n,o)=>np(r(n,o),s=>new ua(s))}var jY=w2;function k2(e,t){let r=gb(e,t);return(n,o)=>E2(r(n,o))}var qY=k2;function C2(e,t){let r=gb(e,t);return(n,o)=>I2(r(n,o))}var HY=C2;function yb(e,t){let r=aa(e,t);return(n,o)=>b2(r(n,o))}var WY=yb;function A2(e,t){let r=$y(e,t);return(n,o)=>iA(r(n,o))}var JY=A2,GY=By,KY=uC;function v2(e,t){let r=zy(e,t);return(n,o)=>np(r(n,o),s=>new ua(s))}var VY=v2;function O2(e,t){let r=yb(e,t);return(n,o)=>E2(r(n,o))}var ZY=O2;function _2(e,t){let r=yb(e,t);return(n,o)=>I2(r(n,o))}var QY=_2,G=Lo;function bb(e){return k(e,bm)&&e[bm]===bm}var Zc=Nr(e=>G(oi(e.ast),{schema:e})),YY=Nr(e=>e.schema),sl=Nr(e=>{let t=Ib(e);return G(Wk(e.ast),{schema:t})}),XY=Nr(e=>e.schema.members[0]),e9=Nr(e=>G(Sy(e.ast),{schema:e})),t9=Nr(e=>e.schema),yn=Nr(e=>G(wt(e.ast),{schema:e})),al=Nr(e=>G(hn(e.ast),{schema:e})),Sm=\"~effect/Schema/flip\";function r9(e){return k(e,Sm)&&e[Sm]===Sm}function rA(e){return r9(e)?e.schema.rebuild(mn(e.ast)):G(mn(e.ast),{[Sm]:Sm,schema:e})}function Xt(e){let t=G(new dn(e),{literal:e,transform(r){return t.pipe(ee(Xt(r),{decode:Y(()=>r),encode:Y(()=>e)}))}});return t}function R2(e){return e.map(t=>bb(t)?t.ast:new dn(t))}function n9(e){return G(new ly(R2(e)),{parts:e})}function o9(e){return G(Ok(R2(e)),{parts:e})}function s9(e){return G(new vk(Object.keys(e).filter(t=>typeof e[e[t]]!=\"number\").map(t=>[t,e[t]])),{enums:e})}var a9=G(fy),i9=G(Ck),Em=G(oo),Sb=G(cy),cA=G(uy),X=G(pn),c9=X,il=G(py),uA=G(Rk),M2=G(Mk),cl=G(Pk),u9=G(kk),f9=G(Ak);function l9(e){return G(new _k(e))}function fA(e,t){return G(e,{fields:t,mapFields(r,n){let o=r(this.fields);return fA(zd(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Le(e){return fA(zd(e,void 0),e)}function p9(e){return Nr(t=>t.mapFields(F1(e)))}var d9=e=>typeof e==\"symbol\"?e:globalThis.String(e);function m9(e){return function(t){let r={},n=Object.create(null),o=Object.create(null),s=new Set;for(let a of Reflect.ownKeys(t.fields)){let i=al(t.fields[a]),c=Object.hasOwn(e,a),u=c?e[a]:a,l=d9(u);if(s.has(l))throw new globalThis.Error(`Duplicate encoded keys: ${Xo(u)}`);s.add(l),w(r,u,i),c&&(n[a]=u,o[u]=a)}return Le(r).pipe(ee(t,Oe({decode:PC(o),encode:PC(n)})))}}function h9(e,t){return r=>{let n=Uu(r.fields,yn),o=Le({...n,...e});return r.pipe(ee(o,Oe({decode:s=>{let a={...s};for(let i in e){let c=t[i],u=c(s);Ue(u)&&w(a,i,u.value)}return a},encode:s=>{let a={...s};for(let i in e)delete a[i];return a}})))}}function fa(e,t){return G(Gk(e.ast,t.ast),{key:e,value:t})}function x9(e,t){return G(Uk(e.ast,t.map(Lf)),{schema:e,records:t})}function P2(e,t){return G(e,{elements:t,mapElements(r,n){let o=r(this.elements);return P2(hy(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Es(e){return P2(hy(e),e)}function g9(e,t){return G(Nk(e.ast,t.map(Lf)),{schema:e,rest:t})}var We=Nr(e=>G(new Nn(!1,[],[e.ast]),{value:e}));function Eb(e,t,r){return t!==void 0&&r!==void 0?e.check(gA(t,r)):t!==void 0?e.check(X2(t)):r!==void 0?e.check(rL(r)):e}var lA=Nr(e=>G(new Nn(!1,[e.ast],[e.ast]),{value:e}));function y9(e){let t=We(e),r=We(yn(e)),n=ee(Es([Em]),Oe({decode:o=>[o],encode:([o])=>o}))(e);return G(gt([n,t]).pipe(ee(r)).ast,{from:gt([e,t]),to:r})}function b9(e){return We(e).check(bA())}var S9=Nr(e=>G(Dk(e.ast),{schema:e}));function F2(e,t){return G(e,{members:t,mapMembers(r,n){let o=r(this.members);return F2(jd(o,this.ast.options,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function gt(e,t){return F2(jd(e,t,void 0),e)}function Is(e){let t=e.map(Xt);return G(jd(t,void 0,void 0),{literals:e,members:t,mapMembers(r){return gt(r(this.members))},pick(r){return Is(r)},transform(r){return gt(t.map((n,o)=>n.transform(r[o])))}})}var pA=Nr(e=>gt([e,Sb])),Ib=Nr(e=>gt([e,cA])),U2=Nr(e=>gt([e,Sb,cA]));function N2(e){return G(new xy(()=>e().ast))}function E9(...e){return t=>t.check(...e)}function D2(e,t){return r=>G(Uo(r.ast,[Hd(e,t)]),{schema:r})}function L2(e){return t=>G(t.ast,{schema:t,identifier:e})}function I9(e,t){return r=>(t.checks?r.check(...t.checks):r).pipe(L2(e))}function $2(e){return t=>G(jk(t.ast,new Fd(e,_)),{schema:t})}function B2(e){return t=>G(qk(t.ast,new Fd(_,e)),{schema:t})}function T9(e){return z2(e)}function z2(e){return t=>$2(Cf(e))(t)}function w9(e){return j2(e)}function j2(e){return t=>B2(Cf(e))(t)}function ee(e,t){return r=>G(sa(r.ast,e.ast,t?Ud(t):Uc()),{from:r,to:e})}function ul(){return(e,t)=>Me()(e,{decode:t,encode:Sw})}var q2=Is([\"true\",\"yes\",\"on\",\"1\",\"y\"]),H2=Is([\"false\",\"no\",\"off\",\"0\",\"n\"]),dA=Is([...q2.literals,...H2.literals]).pipe(ee(uA,Oe({decode:e=>e===\"true\"||e===\"yes\"||e===\"on\"||e===\"1\"||e===\"y\",encode:e=>e?\"true\":\"false\"})));function k9(e){return t=>ee(yn(t),e)(t)}function mA(e,t){return r=>t?ee(r,t)(e):ee(r)(e)}function C9(e){return t=>ee(t,e)(al(t))}function W2(e){return t=>G(Jk(t.ast,e),{schema:t})}function J2(e){return Ot(e,t=>Qs(()=>Ks(t,r=>r.issue)))}function hA(e,t){let r=t?.encodingStrategy===\"omit\"?Vg():ar();return n=>Zc(al(n)).pipe(ee(n,{decode:Zg(J2(e)),encode:r}))}function A9(e,t){return r=>yn(r).pipe(hA(e,t),mA(Zc(r)))}function G2(e,t){let r=t?.encodingStrategy===\"omit\"?Vg():ar();return n=>sl(al(n)).pipe(ee(n,{decode:Zg(J2(e)),encode:r}))}function v9(e,t){return r=>yn(r).pipe(G2(e,t),mA(sl(r)))}function Qc(e){return Xt(e).pipe(W2(b(e)))}function O9(e){return Qc(e).pipe(hA(b(e),{encodingStrategy:\"omit\"}))}function Tb(e,t){return Le({_tag:Qc(e),...t})}function K2(e){return t=>{let r={},n=[],o=new Set,s={},a=l=>p=>l.includes(p[e]);return i(t),Object.assign(t,{cases:r,discriminants:n,isAnyOf:a,guards:s,match:c,matchOrElse:u});function i(l){let p=l.ast;if(Tk(p)&&\"members\"in l&&globalThis.Array.isArray(l.members)&&l.members.every(bb))return l.members.forEach(i);let d=Lc(p);if(d.length>0){let m=d.find(x=>x.key===e)?.literal;if(Ul(m)){let x=typeof m==\"number\"?globalThis.String(m):m;if(o.has(x))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);o.add(x),n.push(m),w(r,m,l),w(s,m,Uy(yn(l)));return}}throw new globalThis.Error(\"No literal or unique symbol found\")}function c(){if(arguments.length===1){let x=arguments[0];return function(g){let y=g[e];return(Object.hasOwn(x,y)?x[y]:void 0)(g)}}let l=arguments[0],p=arguments[1],d=l[e];return(Object.hasOwn(p,d)?p[d]:void 0)(l)}function u(){if(arguments.length===2){let g=arguments[0],y=arguments[1];return function(S){let E=S[e];return(Object.hasOwn(g,E)?g[E]??y:y)(S)}}let l=arguments[0],p=arguments[1],d=arguments[2],m=l[e];return(Object.hasOwn(p,m)?p[m]??d:d)(l)}}}function _9(e){let t={},r=[];for(let c of Object.keys(e)){let u=Tb(c,e[c]);w(t,c,u),r.push(u)}let n=gt(r),{guards:o,isAnyOf:s,match:a,matchOrElse:i}=K2(\"_tag\")(n);return G(n.ast,{cases:t,isAnyOf:s,guards:o,match:a,matchOrElse:i})}function R9(){return e=>e}function ci(e,t){return Je(r=>r instanceof e,t)}function Me(){return(e,t)=>new pt(e.ast,Ud(t))}var Be=qd;function M9(e,t=void 0){return new ei(e,t)}var s2=\"^\\\\S[\\\\s\\\\S]*\\\\S$|^\\\\S$|^$\";function V2(e){let t=new globalThis.RegExp(s2);return Be(r=>r.trim()===r,{expected:\"a string with no leading or trailing whitespace\",representation:{id:\"effect/schema/isTrimmed\",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:\"Schema.isTrimmed()\"}),arbitraryConstraint:{patterns:[{source:s2,flags:\"\"}]},...e})}function fl(e,t){let r=e.source,n=e.flags,o=/^[dg]*uy?$/.test(n),s=n===\"\"?`new RegExp(${L(r)})`:`new RegExp(${L(r)}, ${L(n)})`;return Bf(e,{toJsonSchema:()=>o?{pattern:n.endsWith(\"y\")?`^(?:${r})`:r}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${s})`}),...t})}function P9(e){return Ty({toCode:()=>({runtime:\"Schema.isStringFinite()\"}),...e})}function F9(e){return wy({toCode:()=>({runtime:\"Schema.isStringBigInt()\"}),...e})}function U9(e){return Cy({toCode:()=>({runtime:\"Schema.isStringSymbol()\"}),...e})}var N9=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;function D9(e,t){let r=N9(e);return fl(r,{expected:e?`a UUID v${e}`:\"a UUID\",representation:{id:\"effect/schema/isUUID\",payload:{version:e??null}},toJsonSchema:()=>({pattern:r.source,format:\"uuid\"}),toCode:()=>({runtime:e===void 0?\"Schema.isUUID()\":`Schema.isUUID(${e})`}),...t})}var a2=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;function L9(e){return fl(a2,{expected:\"a GUID\",representation:{id:\"effect/schema/isGUID\",payload:null},toJsonSchema:()=>({pattern:a2.source}),toCode:()=>({runtime:\"Schema.isGUID()\"}),...e})}function $9(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return fl(t,{representation:{id:\"effect/schema/isULID\",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:\"Schema.isULID()\"}),...e})}function Z2(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return fl(t,{expected:\"a base64 encoded string\",representation:{id:\"effect/schema/isBase64\",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:\"Schema.isBase64()\"}),...e})}function B9(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return fl(t,{expected:\"a base64url encoded string\",representation:{id:\"effect/schema/isBase64Url\",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:\"Schema.isBase64Url()\"}),...e})}function xA(e,t,r){if(e.length===0)return t.length===0?{}:[{},!0];let n={pattern:new globalThis.RegExp(r).source};return e===t?n:[n,!0]}function z9(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`^${ia(e)}`),o=e.replace(/[\\uD800-\\uDBFF]$/,\"\");return Be(s=>s.startsWith(e),{expected:`a string starting with ${r}`,representation:{id:\"effect/schema/isStartingWith\",payload:{startsWith:e}},toJsonSchema:()=>xA(o,e,`^${ia(o)}`),toCode:()=>({runtime:`Schema.isStartingWith(${L(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function j9(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`${ia(e)}$`),o=e.replace(/^[\\uDC00-\\uDFFF]/,\"\");return Be(s=>s.endsWith(e),{expected:`a string ending with ${r}`,representation:{id:\"effect/schema/isEndingWith\",payload:{endsWith:e}},toJsonSchema:()=>xA(o,e,`${ia(o)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${L(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function q9(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(ia(e)),o=e.replace(/^[\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF]$/g,\"\");return Be(s=>s.includes(e),{expected:`a string including ${r}`,representation:{id:\"effect/schema/isIncluding\",payload:{includes:e}},toJsonSchema:()=>xA(o,e,ia(o)),toCode:()=>({runtime:`Schema.isIncluding(${L(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}var i2=\"^[^a-z]*$\";function H9(e){let t=new globalThis.RegExp(i2);return Be(r=>r.toUpperCase()===r,{expected:\"a string with all characters in uppercase\",representation:{id:\"effect/schema/isUppercased\",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:\"Schema.isUppercased()\"}),arbitraryConstraint:{patterns:[{source:i2,flags:\"\"}]},...e})}var c2=\"^[^A-Z]*$\";function W9(e){let t=new globalThis.RegExp(c2);return Be(r=>r.toLowerCase()===r,{expected:\"a string with all characters in lowercase\",representation:{id:\"effect/schema/isLowercased\",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:\"Schema.isLowercased()\"}),arbitraryConstraint:{patterns:[{source:c2,flags:\"\"}]},...e})}var u2=\"^(?:[^a-z][\\\\s\\\\S]*)?$\";function J9(e){let t=new globalThis.RegExp(u2);return Be(r=>r.charAt(0).toUpperCase()===r.charAt(0),{expected:\"a string with the first character in uppercase\",representation:{id:\"effect/schema/isCapitalized\",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:\"Schema.isCapitalized()\"}),arbitraryConstraint:{patterns:[{source:u2,flags:\"\"}]},...e})}var f2=\"^(?:[^A-Z][\\\\s\\\\S]*)?$\";function G9(e){let t=new globalThis.RegExp(f2);return Be(r=>r.charAt(0).toLowerCase()===r.charAt(0),{expected:\"a string with the first character in lowercase\",representation:{id:\"effect/schema/isUncapitalized\",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:\"Schema.isUncapitalized()\"}),arbitraryConstraint:{patterns:[{source:f2,flags:\"\"}]},...e})}var Im=G(yy),K9=gy;function Tm(e){let t=os(e.order),r=e.formatter??L;return(n,o)=>Be(s=>t(s,n),{expected:`a value greater than ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n,exclusiveMinimum:!0},...e.annotate?.(n),...o})}function wm(e){let t=Ui(e.order),r=e.formatter??L;return(n,o)=>Be(s=>t(s,n),{expected:`a value greater than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n},...e.annotate?.(n),...o})}function km(e){let t=Ta(e.order),r=e.formatter??L;return(n,o)=>Be(s=>t(s,n),{expected:`a value less than ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n,exclusiveMaximum:!0},...e.annotate?.(n),...o})}function Cm(e){let t=Fi(e.order),r=e.formatter??L;return(n,o)=>Be(s=>t(s,n),{expected:`a value less than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n},...e.annotate?.(n),...o})}function Am(e){let t=Ui(e.order),r=os(e.order),n=Fi(e.order),o=Ta(e.order),s=e.formatter??L;return(a,i)=>{let c=a.exclusiveMinimum?r:t,u=a.exclusiveMaximum?o:n;return Be(l=>c(l,a.minimum)&&u(l,a.maximum),{expected:`a value between ${s(a.minimum)}${a.exclusiveMinimum?\" (excluded)\":\"\"} and ${s(a.maximum)}${a.exclusiveMaximum?\" (excluded)\":\"\"}`,arbitraryConstraint:{order:e.order,minimum:a.minimum,maximum:a.maximum,...a.exclusiveMinimum&&{exclusiveMinimum:!0},...a.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(a),...i})}}function V9(e){return(t,r)=>{let n=e.formatter??L;return Be(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${n(t)}`,...e.annotate?.(t),...r})}}function rl(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${L(e)}`);return e}var Z9=Tm({order:jr,annotate:e=>({representation:{id:\"effect/schema/isGreaterThan\",payload:{exclusiveMinimum:rl(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${L(e)})`})})}),Q2=wm({order:jr,annotate:e=>({representation:{id:\"effect/schema/isGreaterThanOrEqualTo\",payload:{minimum:rl(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${L(e)})`})})}),Q9=km({order:jr,annotate:e=>({representation:{id:\"effect/schema/isLessThan\",payload:{exclusiveMaximum:rl(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${L(e)})`})})}),Y9=Cm({order:jr,annotate:e=>({representation:{id:\"effect/schema/isLessThanOrEqualTo\",payload:{maximum:rl(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${L(e)})`})})}),vm=Am({order:jr,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:\"effect/schema/isBetween\",payload:{minimum:rl(e.minimum),maximum:rl(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>({[t?\"exclusiveMinimum\":\"minimum\"]:e.minimum,[r?\"exclusiveMaximum\":\"maximum\"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${L(e.minimum)}, maximum: ${L(e.maximum)}, exclusiveMinimum: ${L(t)}, exclusiveMaximum: ${L(r)} })`})}}});function X9(e,t){if(!globalThis.Number.isFinite(e)||e===0)throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(e)}`);return e=globalThis.Math.abs(e),Be(r=>_F(r,e)===0,{expected:`a value that is a multiple of ${e}`,representation:{id:\"effect/schema/isMultipleOf\",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${L(e)})`}),...t})}function wb(e){return Be(t=>globalThis.Number.isSafeInteger(t),{expected:\"an integer\",representation:{id:\"effect/schema/isInt\",payload:null},toJsonSchema:()=>[{type:\"integer\"},!0],toCode:()=>({runtime:\"Schema.isInt()\"}),arbitraryConstraint:{number:\"integer\"},...e})}var Ts=il.check(wb()),Vc=Ts.check(Q2(0));function e7(e){return new ei([wb(),vm({minimum:-2147483648,maximum:2147483647})],{expected:\"a 32-bit integer\",...e})}function t7(e){return new ei([wb(),vm({minimum:0,maximum:4294967295})],{expected:\"a 32-bit unsigned integer\",...e})}function nl(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${L(e)}`);return e.toISOString()}function ol(e){return`new Date(${L(e.getTime())})`}var r7=Tm({order:Au,annotate:e=>({representation:{id:\"effect/schema/isGreaterThanDate\",payload:{exclusiveMinimum:nl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${ol(e)})`})})}),n7=wm({order:Au,annotate:e=>({representation:{id:\"effect/schema/isGreaterThanOrEqualToDate\",payload:{minimum:nl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${ol(e)})`})})}),o7=km({order:Au,annotate:e=>({representation:{id:\"effect/schema/isLessThanDate\",payload:{exclusiveMaximum:nl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${ol(e)})`})})}),s7=Cm({order:Au,annotate:e=>({representation:{id:\"effect/schema/isLessThanOrEqualToDate\",payload:{maximum:nl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${ol(e)})`})})}),a7=Am({order:Au,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:\"effect/schema/isBetweenDate\",payload:{minimum:nl(e.minimum),maximum:nl(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${ol(e.minimum)}, maximum: ${ol(e.maximum)}, exclusiveMinimum: ${L(t)}, exclusiveMaximum: ${L(r)} })`})}}}),i7=Tm({order:Cu,annotate:e=>({representation:{id:\"effect/schema/isGreaterThanBigInt\",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${L(e)})`})})}),Y2=wm({order:Cu,annotate:e=>({representation:{id:\"effect/schema/isGreaterThanOrEqualToBigInt\",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${L(e)})`})})}),c7=km({order:Cu,annotate:e=>({representation:{id:\"effect/schema/isLessThanBigInt\",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${L(e)})`})})}),u7=Cm({order:Cu,annotate:e=>({representation:{id:\"effect/schema/isLessThanOrEqualToBigInt\",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${L(e)})`})})}),f7=Am({order:Cu,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:\"effect/schema/isBetweenBigInt\",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${L(e.minimum)}, maximum: ${L(e.maximum)}, exclusiveMinimum: ${L(t)}, exclusiveMaximum: ${L(r)} })`})}}});function X2(e,t){return e=Lr(e),eL(e,Math.ceil(e/2),t)}function eL(e,t,r){return Be(n=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:\"effect/schema/isMinLength\",payload:{minLength:e}},toJsonSchema:({type:n})=>n===\"string\"?e<=1?{minLength:t}:[{minLength:t},!0]:n===\"array\"?{minItems:e}:n===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[un]:!0,arbitraryConstraint:{minLength:e},...r})}function tL(e){return eL(1,1,e)}function rL(e,t){return e=Lr(e),Be(r=>r.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:\"effect/schema/isMaxLength\",payload:{maxLength:e}},toJsonSchema:({type:r})=>r===\"string\"?e===0?{maxLength:e}:[{maxLength:e},!0]:r===\"array\"?{maxItems:e}:r===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[un]:!0,arbitraryConstraint:{maxLength:e},...t})}function gA(e,t,r){return e=Lr(e),t=Lr(t),Be(n=>n.length>=e&&n.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:\"effect/schema/isBetweenLength\",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n===\"string\"?t===0||Math.ceil(e/2)>t?{minLength:Math.ceil(e/2),maxLength:t}:[{minLength:Math.ceil(e/2),maxLength:t},!0]:n===\"array\"?{minItems:e,maxItems:t}:n===void 0?[{minLength:Math.ceil(e/2),maxLength:t,minItems:e,maxItems:t},!0]:[{},!0],toCode:()=>({runtime:`Schema.isBetweenLength(${e}, ${t})`}),[un]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...r})}function l7(e,t){return e=Lr(e),Be(r=>yA(r,e)>=e,{expected:`a string with at least ${e} code points`,representation:{id:\"effect/schema/isMinCodePoints\",payload:{minCodePoints:e}},toJsonSchema:()=>({minLength:e}),toCode:()=>({runtime:`Schema.isMinCodePoints(${e})`}),arbitraryConstraint:{minCodePoints:e},...t})}function p7(e,t){return e=Lr(e),Be(r=>yA(r,e+1)<=e,{expected:`a string with at most ${e} code points`,representation:{id:\"effect/schema/isMaxCodePoints\",payload:{maxCodePoints:e}},toJsonSchema:()=>({maxLength:e}),toCode:()=>({runtime:`Schema.isMaxCodePoints(${e})`}),arbitraryConstraint:{maxCodePoints:e},...t})}function d7(e,t,r){return e=Lr(e),t=Lr(t),Be(n=>{let o=yA(n,t+1);return o>=e&&o<=t},{expected:e===t?`a string with ${e} code points`:`a string with between ${e} and ${t} code points`,representation:{id:\"effect/schema/isBetweenCodePoints\",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({allOf:[{minLength:e},{maxLength:t}]}),toCode:()=>({runtime:`Schema.isBetweenCodePoints(${e}, ${t})`}),arbitraryConstraint:{minCodePoints:e,maxCodePoints:t},...r})}function yA(e,t){if(t===0)return 0;let r=0;for(let n of e)if(++r>=t)break;return r}function Lr(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function m7(e,t){return e=Lr(e),Be(r=>r.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:\"effect/schema/isMinSize\",payload:{minSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[un]:!0,arbitraryConstraint:{minSize:e},...t})}function h7(e,t){return e=Lr(e),Be(r=>r.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:\"effect/schema/isMaxSize\",payload:{maxSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[un]:!0,arbitraryConstraint:{maxSize:e},...t})}function x7(e,t,r){return e=Lr(e),t=Lr(t),Be(n=>n.size>=e&&n.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:\"effect/schema/isBetweenSize\",payload:{minimum:e,maximum:t}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenSize(${e}, ${t})`}),[un]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...r})}function g7(e,t){return e=Lr(e),Be(r=>Reflect.ownKeys(r).length>=e,{expected:`a value with at least ${e===1?\"1 entry\":`${e} entries`}`,representation:{id:\"effect/schema/isMinProperties\",payload:{minProperties:e}},toJsonSchema:({type:r})=>r===\"object\"?{minProperties:e}:[{minProperties:e},!0],toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[un]:!0,arbitraryConstraint:{minProperties:e},...t})}function y7(e,t){return e=Lr(e),Be(r=>Reflect.ownKeys(r).length<=e,{expected:`a value with at most ${e===1?\"1 entry\":`${e} entries`}`,representation:{id:\"effect/schema/isMaxProperties\",payload:{maxProperties:e}},toJsonSchema:({type:r})=>r===\"object\"?{maxProperties:e}:[{maxProperties:e},!0],toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[un]:!0,arbitraryConstraint:{maxProperties:e},...t})}function b7(e,t,r){return e=Lr(e),t=Lr(t),Be(n=>Reflect.ownKeys(n).length>=e&&Reflect.ownKeys(n).length<=t,{expected:e===t?`a value with exactly ${e===1?\"1 entry\":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:\"effect/schema/isBetweenProperties\",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n===\"object\"?{minProperties:e,maxProperties:t}:[{minProperties:e,maxProperties:t},!0],toCode:()=>({runtime:`Schema.isBetweenProperties(${e}, ${t})`}),[un]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...r})}function S7(e,t){let r=al(e),n=sC(r.ast);return Be((o,s,a)=>{let i=Reflect.ownKeys(o),c=[];for(let u of i){let l=n(u,a);if(l!==void 0&&(c.push(new ht([u],l)),a.errors===\"first\"))break}return gr(c)?new Rt(s,c,o,a):!0},{expected:\"an object with property names matching the schema\",representation:{id:\"effect/schema/isPropertyNames\",payload:null,schemas:[r.ast]},toJsonSchema:({schemas:o,type:s})=>s===\"object\"?{propertyNames:o[0]}:[{propertyNames:o[0]},!0],toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[un]:!0,...t})}function bA(e){return Be(t=>Ah(t).length===t.length,{expected:\"an array with unique items\",representation:{id:\"effect/schema/isUnique\",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:\"Schema.isUnique()\"}),arbitraryConstraint:{uniqueBy:_},...e})}function nL(e){return Be(t=>Ah(t.map(([r])=>r)).length===t.length,{expected:\"an array with unique keys\",representation:{id:\"effect/schema/isUniqueKey\",payload:null},toCode:()=>({runtime:\"Schema.isUniqueKey()\"}),arbitraryConstraint:{uniqueBy:t=>t[0]},...e})}var oL=X.check(tL()),E7=X.check(gA(1,1)),sL=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),aL=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},l2=[];function I7(e){let t=sL(e),r=l2[t];if(r!==void 0)return r;let n=aL(t),o=ci(globalThis.Error,{representation:{id:\"effect/schema/Error\",payload:n??null},toCode:()=>({runtime:n!==void 0?`Schema.ErrorInstance(${L(n)})`:\"Schema.ErrorInstance()\",Type:\"globalThis.Error\"}),expected:\"Error\",toCodecJson:()=>Me()(Wee,tk(n))});return l2[t]=o,o}var p2=[];function T7(e){let t=sL(e),r=p2[t];if(r!==void 0)return r;let n=_b.pipe(ee(Em,rk(aL(t))));return p2[t]=n,n}function w7(e,t){let r=gn()([e,t],([n,o])=>{let s=We(Es([n,o]));return(a,i,c)=>a instanceof globalThis.Map?pr(tt(s)([...a],c),{onSuccess:u=>new globalThis.Map(u),onFailure:u=>Qr(i,\"entries\",u,a,c)}):N(new xt(i,a,c))},{representation:{id:\"effect/schema/ReadonlyMap\",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlyMap(${n[0].runtime}, ${n[1].runtime})`,Type:`globalThis.ReadonlyMap<${n[0].Type}, ${n[1].Type}>`}),expected:\"ReadonlyMap\",toCodec:([n,o])=>Me()(We(Es([n,o])),Oe({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]}))});return G(r.ast,{key:e,value:t})}function k7(e){let t=gn()([e],([r])=>{let n=We(r);return(o,s,a)=>o instanceof globalThis.Set?pr(tt(n)([...o],a),{onSuccess:i=>new globalThis.Set(i),onFailure:i=>Qr(s,\"values\",i,o,a)}):N(new xt(s,o,a))},{representation:{id:\"effect/schema/ReadonlySet\",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlySet(${r[0].runtime})`,Type:`globalThis.ReadonlySet<${r[0].Type}>`}),expected:\"ReadonlySet\",toCodec:([r])=>Me()(We(r),Oe({decode:n=>new globalThis.Set(n),encode:n=>[...n.values()]}))});return G(t.ast,{value:e})}var C7=ci(globalThis.RegExp,{representation:{id:\"effect/schema/RegExp\",payload:null},toCode:()=>({runtime:\"Schema.RegExp\",Type:\"globalThis.RegExp\"}),expected:\"RegExp\",toCodecJson:()=>Me()(Le({source:X,flags:X}),ot({decode:(e,t)=>Ef({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new se({expected:\"valid RegExp source and flags\"},e,t)}),encode:e=>b({source:e.source,flags:e.flags})}))}),iL=X.annotate({expected:\"a string that will be decoded as a URL\"}),kb=ci(globalThis.URL,{representation:{id:\"effect/schema/URL\",payload:null},toCode:()=>({runtime:\"Schema.URL\",Type:\"globalThis.URL\"}),expected:\"URL\",toCodecJson:()=>Me()(iL,ty)}),A7=iL.pipe(ee(kb,ty)),cL=X.annotate({expected:\"a string that will be decoded as a Date\"}),Om=Je(e=>e instanceof globalThis.Date&&!globalThis.Number.isNaN(e.getTime()),{representation:{id:\"effect/schema/Date\",payload:null},toCode:()=>({runtime:\"Schema.Date\",Type:\"globalThis.Date\"}),expected:\"a valid Date\",toCodecJson:()=>Me()(cL,Xg)}),v7=cL.pipe(ee(Om,Xg)),O7=Ts.pipe(ee(Om,Yw)),_7=X.annotate({expected:\"a string that will be decoded as JSON\",contentMediaType:\"application/json\"});function SA(e,t){return _7.pipe(ee(e,pk(t)))}var R7=SA(Em),uL=ci(globalThis.File,{representation:{id:\"effect/schema/File\",payload:null},toCode:()=>({runtime:\"Schema.File\",Type:\"globalThis.File\"}),expected:\"File\",toCodecJson:()=>Me()(Le({data:X.check(Z2()),type:X,name:X,lastModified:Ts}),ot({decode:(e,t)=>rr(Wa(e.data),{onFailure:()=>N(new se({expected:\"a valid Base64 string\"},e.data,t)),onSuccess:r=>{let n=new globalThis.Uint8Array(r);return b(new globalThis.File([n],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>bf({try:async()=>{let r=new globalThis.Uint8Array(await e.arrayBuffer());return{data:Ac(r),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new se({expected:\"a readable File\"},e,t)})}))}),fL=ci(globalThis.FormData,{representation:{id:\"effect/schema/FormData\",payload:null},toCode:()=>({runtime:\"Schema.FormData\",Type:\"globalThis.FormData\"}),expected:\"FormData\",toCodecJson:()=>Me()(We(Es([X,gt([Le({_tag:Qc(\"String\"),value:X}),Le({_tag:Qc(\"File\"),value:uL})])])),ot({decode:e=>{let t=new globalThis.FormData;for(let[r,n]of e)t.append(r,n.value);return b(t)},encode:e=>b(globalThis.Array.from(e.entries()).map(([t,r])=>typeof r==\"string\"?[t,{_tag:\"String\",value:r}]:[t,{_tag:\"File\",value:r}]))}))});function M7(e){return fL.pipe(ee(e,dk))}var lL=ci(globalThis.URLSearchParams,{representation:{id:\"effect/schema/URLSearchParams\",payload:null},toCode:()=>({runtime:\"Schema.URLSearchParams\",Type:\"globalThis.URLSearchParams\"}),expected:\"URLSearchParams\",toCodecJson:()=>Me()(X.annotate({expected:\"a query string that will be decoded as URLSearchParams\"}),Oe({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});function P7(e){return lL.pipe(ee(e,mk))}var F7=X.annotate({expected:\"a string that will be decoded as a number\"}).pipe(ee(il,Nc)),U7=X.annotate({expected:\"a string that will be decoded as a finite number\"}).pipe(ee(Im,Nc)),N7=G(ky).pipe(ee(cl,Dd)),pL=X.check(V2()),D7=X.annotate({expected:\"a string that will be decoded as a trimmed string\"}).pipe(ee(pL,Vw())),L7=X.annotate({expected:\"a base64 encoded string that will be decoded as a UTF-8 string\"}).pipe(ee(X,ck)),$7=X.annotate({expected:\"a base64 (URL) encoded string that will be decoded as a UTF-8 string\"}).pipe(ee(X,uk)),B7=X.annotate({expected:\"a hex encoded string that will be decoded as a UTF-8 string\"}).pipe(ee(X,fk)),z7=X.annotate({expected:\"a URI component encoded string that will be decoded as a UTF-8 string\"}).pipe(ee(X,lk)),nA=gt([Im,M2,X]),j7=Le({issues:We(Le({message:X,path:sl(We(gt([nA,Le({key:nA})])))}))}),q7=Is([0,1]).pipe(ee(uA,Oe({decode:e=>e===1,encode:e=>e?1:0}))),dL=X.annotate({expected:\"a base64 encoded string that will be decoded as Uint8Array\",format:\"byte\",contentEncoding:\"base64\"}),Cb=ci(globalThis.Uint8Array,{representation:{id:\"effect/schema/Uint8Array\",payload:null},toCode:()=>({runtime:\"Schema.Uint8Array\",Type:\"globalThis.Uint8Array\"}),expected:\"Uint8Array\",toCodecJson:()=>Me()(dL,ry)}),H7=dL.pipe(ee(Cb,ry)),W7=X.annotate({expected:\"a base64 (URL) encoded string that will be decoded as a Uint8Array\"}).pipe(ee(Cb,{decode:Dw(),encode:Rd()})),J7=X.annotate({expected:\"a hex encoded string that will be decoded as a Uint8Array\"}).pipe(ee(Cb,{decode:$w(),encode:Md()})),mL=ot({decode:(e,t)=>{let r=hg(e);return fe(r)?N(new se({expected:\"a valid BigDecimal string\"},e,t)):b(r.value)},encode:e=>b(_o(e))}),G7=Tm({order:Af,formatter:e=>_o(e)}),K7=wm({order:Af,formatter:e=>_o(e)}),V7=km({order:Af,formatter:e=>_o(e)}),Z7=Cm({order:Af,formatter:e=>_o(e)}),Q7=Am({order:Af,formatter:e=>_o(e)}),hL=X.annotate({expected:\"a string that will be decoded as a BigDecimal\"}),xL=Je(ST,{representation:{id:\"effect/schema/BigDecimal\",payload:null},toCode:()=>({runtime:\"Schema.BigDecimal\",Type:\"BigDecimal.BigDecimal\",importDeclarations:['import * as BigDecimal from \"effect/BigDecimal\"']}),expected:\"BigDecimal\",toCodecJson:()=>Me()(hL,mL),toFormatter:()=>e=>_o(e)}),Y7=hL.pipe(ee(xL,mL)),_m=Je(FU,{representation:{id:\"effect/schema/ByteSize\",payload:null},toCode:()=>({runtime:\"Schema.ByteSize\",Type:\"ByteSize.ByteSize\",importDeclarations:['import * as ByteSize from \"effect/ByteSize\"']}),expected:\"ByteSize\",toCodecJson:()=>Me()(cl.check(Y2(globalThis.BigInt(0))),Oe({decode:PU,encode:bg})),toCodecStringTree:()=>Me()(gL,ey)}),gL=X.annotate({expected:\"a string that will be decoded as a ByteSize\"}),X7=gL.pipe(ee(_m,ey)),eX=cl.pipe(ee(_m,Xw)),tX=il.pipe(ee(_m,ek));function oA(e,t){let r=gn()([e,t],([n,o])=>(s,a,i)=>{if(!a0(s))return N(new xt(a,s,i));switch(s._tag){case\"Fail\":return pr(tt(n)(s.error,i),{onSuccess:Dx,onFailure:c=>Qr(a,\"error\",c,s,i)});case\"Die\":return pr(tt(o)(s.defect,i),{onSuccess:Lx,onFailure:c=>Qr(a,\"defect\",c,s,i)});case\"Interrupt\":return b(s)}},{representation:{id:\"effect/schema/CauseReason\",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.CauseReason(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Failure<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from \"effect/Cause\"']}),expected:\"Cause.Failure\",toCodec:([n,o])=>Me()(gt([Le({_tag:Xt(\"Fail\"),error:n}),Le({_tag:Xt(\"Die\"),defect:o}),Le({_tag:Xt(\"Interrupt\"),fiberId:Ib(Im)})]),Oe({decode:s=>{switch(s._tag){case\"Fail\":return Dx(s.error);case\"Die\":return Lx(s.defect);case\"Interrupt\":return i0(s.fiberId)}},encode:s=>{switch(s._tag){case\"Fail\":return{_tag:\"Fail\",error:s.error};case\"Die\":return{_tag:\"Die\",defect:s.defect};case\"Interrupt\":return{_tag:\"Interrupt\",fiberId:s.fiberId}}}}))});return G(r.ast,{error:e,defect:t})}function sA(e,t){let r=gn()([e,t],([n,o])=>{let s=We(oA(n,o));return(a,i,c)=>s0(a)?pr(tt(s)(a.reasons,c),{onSuccess:of,onFailure:u=>Qr(i,\"failures\",u,a,c)}):N(new xt(i,a,c))},{representation:{id:\"effect/schema/Cause\",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Cause(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Cause<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from \"effect/Cause\"']}),expected:\"Cause\",toCodec:([n,o])=>Me()(We(oA(n,o)),Oe({decode:of,encode:({reasons:s})=>s}))});return G(r.ast,{error:e,defect:t})}function d2(e){return Me()(e,Oe({decode:AT,encode:Se}))}function rX(e){let t=gn()([e],([r])=>{let n=We(r);return(o,s,a)=>Eg(o)?pr(tt(n)(Se(o),a),{onSuccess:AT,onFailure:i=>Qr(s,\"values\",i,o,a)}):N(new xt(s,o,a))},{representation:{id:\"effect/schema/Chunk\",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Chunk(${r[0].runtime})`,Type:`Chunk.Chunk<${r[0].Type}>`}),expected:\"Chunk\",toCodec:([r])=>d2(We(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>d2(Eb(We(n),r?.minLength,r?.maxLength)),toEquivalence:([r])=>kT(r)});return G(t.ast,{value:e})}function yL(){return lt((e,t)=>it(wc(e),{onNone:()=>N(new se({message:\"Invalid DateTime input\"},e,t)),onSome:r=>b(kc(r))}))}var nX=Oe({decode:e=>cd(e),encode:e=>e.offset}),bL=ot({decode:(e,t)=>it(Tg(e),{onNone:()=>N(new se({expected:\"a valid IANA time zone\"},e,t)),onSome:b}),encode:e=>b(e.id)}),SL=ot({decode:(e,t)=>it(wg(e),{onNone:()=>N(new se({expected:\"a valid time zone\"},e,t)),onSome:b}),encode:e=>b(Cc(e))}),EL=ot({decode:(e,t)=>it(wc(e),{onNone:()=>N(new se({expected:\"a valid UTC DateTime string\"},e,t)),onSome:r=>b(kc(r))}),encode:e=>b(kg(e))}),IL=ot({decode:(e,t)=>it(Ig(e),{onNone:()=>N(new se({expected:\"a valid Zoned DateTime string\"},e,t)),onSome:b}),encode:e=>b(ud(e))}),TL=-864e13,wL=864e13,oX=TL+840*60*1e3,sX=wL-840*60*1e3,aX=-720*60*1e3,iX=840*60*1e3,kL=[\"UTC\",\"Europe/London\",\"America/New_York\",\"Asia/Tokyo\",\"Australia/Sydney\"];function CL(e,t,r){let n=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+(e.exclusiveMinimum===!0?1:0)),o=Math.min(r,e?.maximum===void 0?r:e.maximum.epochMilliseconds-(e.exclusiveMaximum===!0?1:0));return n<=o?[n,o]:[t,r]}function EA(e,t){return Ts.check(vm({minimum:e,maximum:t}))}function AL(){return gt([EA(aX,iX),Is(kL)])}var Ab=Je(e=>OT(e)&&qU(e),{representation:{id:\"effect/schema/DateTimeUtc\",payload:null},toCode:()=>({runtime:\"Schema.DateTimeUtc\",Type:\"DateTime.Utc\",importDeclarations:['import * as DateTime from \"effect/DateTime\"']}),expected:\"DateTime.Utc\",toCodecArbitrary:({constraint:e})=>{let[t,r]=CL(e,TL,wL);return ul()(EA(t,r),Y(JU))},toCodecJson:()=>Me()(X,EL),toFormatter:()=>e=>e.toString()}),cX=Om.pipe(ee(Ab,{decode:yL(),encode:Y(KU)})),uX=X.annotate({expected:\"a string that will be decoded as a DateTime.Utc\"}).pipe(ee(Ab,EL)),fX=Ts.pipe(ee(Ab,{decode:yL(),encode:Y(VU)})),lX=Je(zU,{representation:{id:\"effect/schema/TimeZoneOffset\",payload:null},toCode:()=>({runtime:\"Schema.TimeZoneOffset\",Type:\"DateTime.TimeZone.Offset\",importDeclarations:['import * as DateTime from \"effect/DateTime\"']}),expected:\"DateTime.TimeZone.Offset\",toCodecJson:()=>Me()(Ts,nX),toFormatter:()=>e=>Cc(e)}),vL=X.annotate({expected:\"an IANA time zone identifier\"}),OL=Je(jU,{representation:{id:\"effect/schema/TimeZoneNamed\",payload:null},toCode:()=>({runtime:\"Schema.TimeZoneNamed\",Type:\"DateTime.TimeZone.Named\",importDeclarations:['import * as DateTime from \"effect/DateTime\"']}),expected:\"DateTime.TimeZone.Named\",toCodecArbitrary:()=>ul()(Is(kL),Y(_T)),toCodecJson:()=>Me()(vL,bL),toFormatter:()=>e=>Cc(e)}),pX=vL.pipe(ee(OL,bL)),_L=X.annotate({expected:\"a time zone string (IANA identifier or offset like +03:00)\"}),RL=Je(BU,{representation:{id:\"effect/schema/TimeZone\",payload:null},toCode:()=>({runtime:\"Schema.TimeZone\",Type:\"DateTime.TimeZone\",importDeclarations:['import * as DateTime from \"effect/DateTime\"']}),expected:\"DateTime.TimeZone\",toCodecArbitrary:()=>ul()(AL(),Y(e=>typeof e==\"number\"?cd(e):_T(e))),toCodecJson:()=>Me()(_L,SL),toFormatter:()=>e=>Cc(e)}),dX=_L.pipe(ee(RL,SL)),ML=X.annotate({expected:\"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])\"}),PL=Je(e=>OT(e)&&HU(e),{representation:{id:\"effect/schema/DateTimeZoned\",payload:null},toCode:()=>({runtime:\"Schema.DateTimeZoned\",Type:\"DateTime.Zoned\",importDeclarations:['import * as DateTime from \"effect/DateTime\"']}),expected:\"DateTime.Zoned\",toCodecArbitrary:({constraint:e})=>{let[t,r]=CL(e,oX,sX);return ul()(Le({epochMilliseconds:EA(t,r),timeZone:AL()}),Y(({epochMilliseconds:n,timeZone:o})=>GU(n,{timeZone:o})))},toCodecJson:()=>Me()(ML,IL),toFormatter:()=>e=>ud(e),toEquivalence:()=>WU}),mX=ML.pipe(ee(PL,IL)),Ho=(e,t,r,n)=>X.pipe(ee(e,ot({decode:(o,s)=>{let a=t(o);return je(a)?b(a.success):N(new se({message:a.failure.message},o,s))},encode:o=>b(r(o))}))).annotate({identifier:n}),Yc=Je(Xf,{identifier:\"MacAddress\"}),ll=Ho(Yc,J1,jC,\"MacAddressFromString\"),vb=Je(Dr,{identifier:\"Ipv4Address\"}),IA=Ho(vb,el,qo,\"Ipv4AddressFromString\"),TA=Je(Ss,{identifier:\"Ipv6Address\"}),FL=Ho(TA,pm,qo,\"Ipv6AddressFromString\"),Xc=Je(H1,{identifier:\"IpAddress\"}),pl=Ho(Xc,dm,qo,\"IpAddressFromString\"),st=(e,t,r,n)=>D2(t,{expected:r})(e).annotate({identifier:n}),hX=st(Xc,tl,\"a multicast address\",\"IpMulticastAddress\"),xX=st(pl,tl,\"a multicast address\",\"IpMulticastAddressFromString\"),gX=st(Yc,tl,\"a multicast address\",\"MacMulticastAddress\"),yX=st(ll,tl,\"a multicast address\",\"MacMulticastAddressFromString\"),bX=st(Xc,JC,\"a unicast address\",\"IpUnicastAddress\"),SX=st(pl,JC,\"a unicast address\",\"IpUnicastAddressFromString\"),EX=st(Yc,fb,\"a unicast address\",\"MacUnicastAddress\"),IX=st(ll,fb,\"a unicast address\",\"MacUnicastAddressFromString\"),TX=st(vb,pb,\"a broadcast address\",\"Ipv4BroadcastAddress\"),wX=st(IA,pb,\"a broadcast address\",\"Ipv4BroadcastAddressFromString\"),kX=st(Yc,ub,\"a broadcast address\",\"MacBroadcastAddress\"),CX=st(ll,ub,\"a broadcast address\",\"MacBroadcastAddressFromString\"),AX=st(Xc,WC,\"a loopback address\",\"IpLoopbackAddress\"),vX=st(pl,WC,\"a loopback address\",\"IpLoopbackAddressFromString\"),OX=st(Xc,GC,\"a link-local address\",\"IpLinkLocalAddress\"),_X=st(pl,GC,\"a link-local address\",\"IpLinkLocalAddressFromString\"),RX=st(Xc,lb,\"an unspecified address\",\"IpUnspecifiedAddress\"),MX=st(pl,lb,\"an unspecified address\",\"IpUnspecifiedAddressFromString\"),PX=st(vb,KC,\"a private address\",\"Ipv4PrivateAddress\"),FX=st(IA,KC,\"a private address\",\"Ipv4PrivateAddressFromString\"),UX=st(TA,VC,\"a unique-local address\",\"Ipv6UniqueLocalAddress\"),NX=st(FL,VC,\"a unique-local address\",\"Ipv6UniqueLocalAddressFromString\"),DX=st(Yc,qC,\"a locally administered address\",\"MacLocallyAdministeredAddress\"),LX=st(ll,qC,\"a locally administered address\",\"MacLocallyAdministeredAddressFromString\"),$X=st(Yc,HC,\"a universally administered address\",\"MacUniversallyAdministeredAddress\"),BX=st(ll,HC,\"a universally administered address\",\"MacUniversallyAdministeredAddressFromString\"),UL=Je(Q1,{identifier:\"Ipv4Interface\"}),zX=Ho(UL,mb,xm,\"Ipv4InterfaceFromString\"),NL=Je(Y1,{identifier:\"Ipv6Interface\"}),jX=Ho(NL,hb,xm,\"Ipv6InterfaceFromString\"),DL=Je(mm,{identifier:\"IpInterface\"}),qX=Ho(DL,xb,xm,\"IpInterfaceFromString\"),LL=Je(e2,{identifier:\"Ipv4Network\"}),HX=Ho(LL,r2,ym,\"Ipv4NetworkFromString\"),$L=Je(t2,{identifier:\"Ipv6Network\"}),WX=Ho($L,n2,ym,\"Ipv6NetworkFromString\"),BL=Je(gm,{identifier:\"IpNetwork\"}),JX=Ho(BL,o2,ym,\"IpNetworkFromString\"),GX=Je(fm,{identifier:\"InetAddressV4\"}),KX=Je(lm,{identifier:\"InetAddressV6\"}),zL=Je(BC,{identifier:\"InetAddress\"}),VX=Ho(zL,V1,db,\"InetAddressFromString\"),jL=Je(cb,{identifier:\"UnixPathAddress\"}),ZX=X.pipe(ee(jL,Oe({decode:Z1,encode:e=>e.path}))).annotate({identifier:\"UnixPathAddressFromString\"}),QX=Je(W1,{identifier:\"SocketAddress\"}),YX=ot({decode:(e,t)=>it(ip(e),{onNone:()=>N(new se({expected:\"a valid Duration string\"},e,t)),onSome:b}),encode:e=>b(globalThis.String(e))}),XX=ot({decode:e=>b(Cn(e)),encode:(e,t)=>it(cp(e),{onNone:()=>N(new se({expected:\"a Duration representable as a bigint\"},e,t)),onSome:r=>b(r)})}),eee=Oe({decode:e=>Kt(e),encode:e=>et(e)}),Ob=Je(Ph,{representation:{id:\"effect/schema/Duration\",payload:null},toCode:()=>({runtime:\"Schema.Duration\",Type:\"Duration.Duration\",importDeclarations:['import * as Duration from \"effect/Duration\"']}),expected:\"Duration\",toCodecJson:()=>Me()(gt([Le({_tag:Xt(\"Infinity\")}),Le({_tag:Xt(\"NegativeInfinity\")}),Le({_tag:Xt(\"Nanos\"),value:cl}),Le({_tag:Xt(\"Millis\"),value:Ts})]),Oe({decode:e=>{switch(e._tag){case\"Infinity\":return nr;case\"NegativeInfinity\":return Or;case\"Nanos\":return Cn(e.value);case\"Millis\":return Kt(e.value)}},encode:e=>{switch(e.value._tag){case\"Infinity\":return{_tag:\"Infinity\"};case\"NegativeInfinity\":return{_tag:\"NegativeInfinity\"};case\"Nanos\":return{_tag:\"Nanos\",value:e.value.nanos};case\"Millis\":return{_tag:\"Millis\",value:e.value.millis}}}}))}),tee=X.annotate({expected:\"a string that will be decoded as a Duration\"}),qL=tee.pipe(ee(Ob,YX)),ree=cl.pipe(ee(Ob,XX)),nee=il.pipe(ee(Ob,eee));function oee(e,t,r){let n=gn()([e,t,r],([o,s,a])=>{let i=sA(s,a);return(c,u,l)=>{if(!Fp(c))return N(new xt(u,c,l));switch(c._tag){case\"Success\":return pr(tt(o)(c.value,l),{onSuccess:Rr,onFailure:p=>Qr(u,\"value\",p,c,l)});case\"Failure\":return pr(tt(i)(c.cause,l),{onSuccess:sn,onFailure:p=>Qr(u,\"cause\",p,c,l)})}}},{representation:{id:\"effect/schema/Exit\",payload:null},toCode:({typeParameters:o})=>({runtime:`Schema.Exit(${o[0].runtime}, ${o[1].runtime}, ${o[2].runtime})`,Type:`Exit.Exit<${o[0].Type}, ${o[1].Type}, ${o[2].Type}>`,importDeclarations:['import * as Exit from \"effect/Exit\"']}),expected:\"Exit\",toCodec:([o,s,a])=>Me()(gt([Le({_tag:Xt(\"Success\"),value:o}),Le({_tag:Xt(\"Failure\"),cause:sA(s,a)})]),Oe({decode:i=>i._tag===\"Success\"?Rr(i.value):sn(i.cause),encode:i=>qe(i)?{_tag:\"Success\",value:i.value}:{_tag:\"Failure\",cause:i.cause}}))});return G(n.ast,{value:e,error:t,defect:r})}function m2(e,t,r){return Le({type:Xt(e),nodes:We(Le({index:Vc,data:t})),edges:We(Le({index:Vc,source:Vc,target:Vc,data:r}))})}function h2(e,t){let r=-1,n=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=r)return N(new ht([\"nodes\",o,\"index\"],new se({expected:\"a strictly increasing node index\"},s,t)));r=s,n.add(s)}r=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=r)return N(new ht([\"edges\",o,\"index\"],new se({expected:\"a strictly increasing edge index\"},s.index,t)));if(r=s.index,!n.has(s.source))return N(new ht([\"edges\",o,\"source\"],new se({expected:\"an encoded node index\"},s.source,t)));if(!n.has(s.target))return N(new ht([\"edges\",o,\"target\"],new se({expected:\"an encoded node index\"},s.target,t)))}return b(zg(e))}function see(e,t,r){return!ow(e)||e.mutable||e.type!==t?N(new se({expected:`an immutable ${t} Graph`},e,r)):b(bd(e))}function aee(e,t){return(r,n)=>{let o=bd(r),s=bd(n);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let a=0;a<o.nodes.length;a++)if(o.nodes[a].index!==s.nodes[a].index||!e(o.nodes[a].data,s.nodes[a].data))return!1;for(let a=0;a<o.edges.length;a++){let i=o.edges[a],c=s.edges[a],u=o.type===\"directed\"?i.source===c.source&&i.target===c.target:i.source===c.source&&i.target===c.target||i.source===c.target&&i.target===c.source;if(i.index!==c.index||!u||!t(i.data,c.data))return!1}return!0}}function iee(e,t,r){return ul()(gt([Sb,Le({nodes:lA(t),edges:We(Es([Vc,Vc,r]))})]),Y(n=>{if(n===null)return zg({type:e,nodes:[],edges:[]});let o=n.nodes.map((s,a)=>({index:a,data:s}));return zg({type:e,nodes:o,edges:n.edges.map(([s,a,i],c)=>({index:c,source:s%o.length,target:a%o.length,data:i}))})}))}function cee(e,t,r){let n=gn()([t,r],([o,s])=>{let a=m2(e,o,s);return(i,c,u)=>!ow(i)||i.mutable||i.type!==e?N(new xt(c,i,u)):T(tt(a)(bd(i),u),l=>h2(l,u))},{representation:{id:\"effect/schema/Graph\",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${L(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${L(e)}>`,importDeclarations:['import * as Graph from \"effect/Graph\"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Me()(m2(e,o,s),ot({decode:h2,encode:(a,i)=>see(a,e,i)})),toCodecArbitrary:({typeParameters:[o,s]})=>iee(e,o,s),toEquivalence:([o,s])=>aee(o,s)});return G(n.ast,{type:e,node:t,edge:r})}function x2(e){return Me()(e,Oe({decode:BT,encode:md}))}function uee(e,t){let r=gn()([e,t],([n,o])=>{let s=We(Es([n,o]));return(a,i,c)=>sN(a)?pr(tt(s)(md(a),c),{onSuccess:BT,onFailure:u=>Qr(i,\"entries\",u,a,c)}):N(new xt(i,a,c))},{representation:{id:\"effect/schema/HashMap\",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashMap(${n[0].runtime}, ${n[1].runtime})`,Type:`HashMap.HashMap<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as HashMap from \"effect/HashMap\"']}),expected:\"HashMap\",toCodec:([n,o])=>x2(We(Es([n,o]))),toCodecArbitrary:({constraint:n,typeParameters:[o,s]})=>x2(Eb(We(Es([o,s])).check(nL()),n?.minSize,n?.maxSize)),toEquivalence:([n,o])=>nh(n,o)});return G(r.ast,{key:e,value:t})}function g2(e){return Me()(e,Oe({decode:qT,encode:Se}))}function fee(e){let t=gn()([e],([r])=>{let n=We(r);return(o,s,a)=>fN(o)?pr(tt(n)(Se(o),a),{onSuccess:qT,onFailure:i=>Qr(s,\"values\",i,o,a)}):N(new xt(s,o,a))},{representation:{id:\"effect/schema/HashSet\",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashSet(${r[0].runtime})`,Type:`HashSet.HashSet<${r[0].Type}>`}),expected:\"HashSet\",toCodec:([r])=>g2(We(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>g2(Eb(We(n).check(bA()),r?.minSize,r?.maxSize)),toEquivalence:([r])=>$l(r)});return G(t.ast,{value:e})}function eu(e){let t=gn()([e],([r])=>(n,o,s)=>vu(n)?fe(n)?za:pr(tt(r)(n.value,s),{onSuccess:O,onFailure:a=>Qr(o,\"value\",a,n,s)}):N(new xt(o,n,s)),{representation:{id:\"effect/schema/Option\",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Option(${r[0].runtime})`,Type:`Option.Option<${r[0].Type}>`,importDeclarations:['import * as Option from \"effect/Option\"']}),expected:\"Option\",toCodec:([r])=>Me()(gt([Le({_tag:Xt(\"Some\"),value:r}),Le({_tag:Xt(\"None\")})]),Oe({decode:n=>n._tag===\"None\"?v():O(n.value),encode:n=>Ue(n)?{_tag:\"Some\",value:n.value}:{_tag:\"None\"}}))});return G(t.ast,{value:e})}function lee(e){return pA(e).pipe(ee(eu(yn(e)),nk()))}function pee(e){return Ib(e).pipe(ee(eu(yn(e)),ok()))}function dee(e,t){return U2(e).pipe(ee(eu(yn(e)),sk(t)))}var HL=Je(dN,{representation:{id:\"effect/http/Cookie\",payload:null},toCode:()=>({runtime:\"Schema.Cookie\",Type:\"Cookies.Cookie\",importDeclarations:['import * as Cookies from \"effect/http/Cookies\"']}),expected:\"Cookie\"}),WL=Je(Of,{representation:{id:\"effect/http/Cookies\",payload:null},toCode:()=>({runtime:\"Schema.Cookies\",Type:\"Cookies.Cookies\",importDeclarations:['import * as Cookies from \"effect/http/Cookies\"']}),expected:\"Cookies\",toCodecJson:()=>Me()(We(X),Oe({decode:mN,encode:yN})),toCodecIso:()=>Me()(fa(X,HL),Oe({decode:Ga,encode:e=>e.cookies}))}),mee=WL.pipe(ee(fa(X,X),Oe({decode:gN,encode:e=>Ug(globalThis.Object.entries(e).map(([t,r])=>ZT(t,r)))}))),hee=Je(XT,{representation:{id:\"effect/http/Headers\",payload:null},toCode:()=>({runtime:\"Schema.Headers\",Type:\"Headers.Headers\",importDeclarations:['import * as Headers from \"effect/http/Headers\"']}),expected:\"Headers\",toEquivalence:()=>$g,toCodec:()=>Me()(fa(X,X),Oe({decode:Bg,encode:e=>({...e})}))}),wA=Je(tw,{representation:{id:\"effect/http/UrlParams\",payload:null},toCode:()=>({runtime:\"Schema.UrlParams\",Type:\"UrlParams.UrlParams\",importDeclarations:['import * as UrlParams from \"effect/http/UrlParams\"']}),expected:\"UrlParams\",toEquivalence:()=>rw,toCodec:()=>Me()(We(Es([X,X])),Oe({decode:ra,encode:e=>e.params}))}),xee=(e,t)=>wA.pipe(ee(SA(Em,t),ot({decode:r=>it(kN(r,e),{onNone:()=>N(new ht([e],new ys(void 0))),onSome:b}),encode:r=>b(ra([[e,r]]))}))),gee=wA.pipe(ee(fa(X,gt([X,lA(X)])),Oe({decode:CN,encode:yd})));function yee(e){return Zc(e).pipe(ee(eu(yn(e)),ak()))}function bee(e){return sl(e).pipe(ee(eu(yn(e)),ik()))}function See(e,t){let r=t===void 0?\"omit\":t.onNoneEncoding,n=r===null?null:void 0;return sl(pA(e)).pipe(ee(eu(yn(e)),Nd({decode:o=>o.pipe(Li(Dl),O),encode:r===\"omit\"?Di:o=>O(Ql(Di(o),()=>n))})))}function kA(e,t){let r=typeof t?.label==\"string\"?t.label:void 0,n=t?.disallowJsonEncode===!0,o=r!==void 0?n?{label:r,disallowJsonEncode:!0}:{label:r}:n?{disallowJsonEncode:!0}:void 0,s=r!==void 0?tt(Xt(r)):void 0,a=gn()([e],([i])=>(c,u,l)=>{if(Ng(c)){let p=s!==void 0?id(s(c.label,l),d=>new ht([\"label\"],d)):te;return ft(p,()=>pr(tt(i)(Mc(c),l),{onSuccess:d=>Va(d,{label:c.label}),onFailure:()=>new Rt(u,[new ht([\"value\"],new se(void 0,c,l))],c,l)}))}return N(new xt(u,c,l))},{representation:{id:\"effect/schema/Redacted\",payload:o??null},toCode:({typeParameters:i})=>({runtime:o!==void 0?`Schema.Redacted(${i[0].runtime}, ${L(o)})`:`Schema.Redacted(${i[0].runtime})`,Type:`Redacted.Redacted<${i[0].Type}>`,importDeclarations:['import * as Redacted from \"effect/Redacted\"']}),expected:\"Redacted\",toCodecJson:([i])=>Me()(i,{decode:Y(c=>Va(c,{label:r})),encode:n?vd(c=>\"Cannot serialize Redacted\"+(Ue(c)&&typeof c.value.label==\"string\"?` with label: \"${c.value.label}\"`:\"\")):Y(Mc)}),toEquivalence:([i])=>YT(i)});return G(a.ast,{value:e})}function Eee(e,t){return ee(kA(yn(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Y(r=>Va(r,{label:t?.label})),encode:t?.disallowEncode?vd(r=>\"Cannot encode Redacted\"+(Ue(r)&&typeof r.value.label==\"string\"?` with label: \"${r.value.label}\"`:\"\")):Y(Mc)})(e)}function Iee(e,t){let r=gn()([e,t],([n,o])=>(s,a,i)=>{if(!Ca(s))return N(new xt(a,s,i));switch(s._tag){case\"Success\":return pr(Qd(n)(s.success,i),{onSuccess:P,onFailure:c=>Qr(a,\"success\",c,s,i)});case\"Failure\":return pr(Qd(o)(s.failure,i),{onSuccess:D,onFailure:c=>Qr(a,\"failure\",c,s,i)})}},{representation:{id:\"effect/schema/Result\",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Result(${n[0].runtime}, ${n[1].runtime})`,Type:`Result.Result<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Result from \"effect/Result\"']}),expected:\"Result\",toCodec:([n,o])=>Me()(gt([Le({_tag:Xt(\"Success\"),success:n}),Le({_tag:Xt(\"Failure\"),failure:o})]),Oe({decode:s=>s._tag===\"Success\"?P(s.success):D(s.failure),encode:s=>je(s)?{_tag:\"Success\",success:s.success}:{_tag:\"Failure\",failure:s.failure}}))});return G(r.ast,{success:e,failure:t})}var Tee=globalThis.Symbol.for(\"immer-draftable\"),aA={};function CA(e,t,r,n,o){let s=kee(r,t,n),a=JL(t),i=class extends e{constructor(...[c,u]){let p=u?.[\"~payload\"],d=p?.token===aA?p.value:r.make(c??{},u);super(d,{...u,disableChecks:!0,\"~payload\":{token:aA,value:d}})}static[bm]=bm;get[a](){return a}static[Tee]=!0;static identifier=t;static fields=r.fields;static get ast(){return s(this).ast}static pipe(){return K(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return Zd(s(this))(c??{},u)}static makeOption(c,u){return Vd(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(so(this.ast,c))}static annotateKey(c){return this.rebuild(zf(this.ast,c))}static check(...c){return this.rebuild(Uo(this.ast,c))}static extend(c){return(u,l)=>{let p=Rm(u)?u:Le(u),d={...r.fields,...p.fields},m=zd(d,r.ast.checks,{identifier:c});return CA(this,c,fA(Uo(m,p.ast.checks),d),l,o)}}static mapFields(c,u){return r.mapFields(c,u)}};return o!==void 0&&Object.assign(i.prototype,o(t)),i}function wee(e){return new be(Y(t=>new e(t,{\"~payload\":{token:aA,value:t}})),ar())}function JL(e){return`~effect/Schema/Class/${e}`}function kee(e,t,r){let n;return o=>{if(n!==void 0)return n;let s=JL(t),a=u=>u instanceof o||k(u,s),i=wee(o),c=G(new zc([e.ast],()=>(u,l,p)=>a(u)?b(u):N(new xt(l,u,p)),{identifier:t,[jg]:([u])=>({isConstructed:a,link:new pt(u,i)}),toCodec:([u])=>new pt(u.ast,i),toEquivalence:([u])=>u,toFormatter:([u])=>l=>`${o.identifier}(${u(l)})`,[Sd]:Lc(e.ast),...r}));return n=ee(c,i)(e)}}function Rm(e){return bb(e)}var GL=e=>(t,r)=>{let n=Rm(t)?t:Le(t);return CA(Dh,e,n,r,o=>({toString(){return`${o}(${L({...this})})`}}))},Cee=e=>(t,r,n)=>{let o=Rm(r)?r.mapFields(s=>({_tag:Qc(t),...s}),{unsafePreserveChecks:!0}):Tb(t,r);return GL(e??t)(o,n)},KL=e=>(t,r)=>{let n=Rm(t)?t:Le(t);return CA(Hl,e,n,r,s=>({name:s}))},Aee=e=>(t,r,n)=>{let o=Rm(r)?r.mapFields(s=>({_tag:Qc(t),...s}),{unsafePreserveChecks:!0}):Tb(t,r);return KL(e??t)(o,n)};function vee(e){return t=>t.annotate({toFormatter:e})}function Oee(e,t){return P1(e.ast,t)}function _ee(e){return t=>t.annotate({toEquivalence:e})}function Ree(e){return _C(e.ast)}function Mee(e,t){return im(e.ast,t)}function Pee(e,t){let r=im(Jf(e.ast),t);return nb(r,t)}var Fee=Yy,Uee=Xy,Mm=eb,Nee=i1;function Dee(e,t){return v1(e,t)}function Lee(e){return B1(e)}function $ee(e){return z1(e)}function Bee(e){return j1(e)}function zee(e,t){return r=>G(so(r.ast,{toCodecIso:()=>new pt(e.ast,Ud(t))}),{schema:r})}function jee(e){return A1(e)}function qee(e){let t=N2(()=>r),r=gt([e,We(t),fa(X,t)]);return r}var _b=G(so($c,{toCode:()=>({runtime:\"Schema.Json\",Type:\"Schema.Json\"})})),Hee=fa(X,_b),Wee=Le({message:X,name:Zc(X),stack:Zc(X),cause:Zc(_b)}),Jee=G(so(eC,{toCode:()=>({runtime:\"Schema.MutableJson\",Type:\"Schema.MutableJson\"})}));function Gee(e){return gs(e.ast)}function Kee(e){return e.ast.context?.annotations}var VL=\"~effect/MutableHashMap\";var Vee={[VL]:VL,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${L(Array.from(this))})`},toJSON(){return{_id:\"MutableHashMap\",values:Lt(Array.from(this))}},[Ie](){return this.toJSON()},pipe(){return K(this,arguments)}},Pm=()=>{let e=Object.create(Vee);return e.backing=new Map,e.buckets=new Map,e};var ws=f(2,(e,t)=>{if(e.backing.has(t))return O(e.backing.get(t));if(AA(t))return v();let r=H(t),n=e.buckets.get(r);return n===void 0?v():Zee(e,n,t)}),AA=e=>typeof e!=\"object\"&&typeof e!=\"function\";var Zee=(e,t,r)=>{for(let n=0,o=t.length;n<o;n++)if(J(r,t[n])){let s=t[n];return O(e.backing.get(s))}return v()};var Fm=f(3,(e,t,r)=>{if(e.backing.has(t)||AA(t))return e.backing.set(t,r),e;let n=H(t),o=e.buckets.get(n);if(o===void 0)return e.buckets.set(n,[t]),e.backing.set(t,r),e;let s=Qee(o,t);return s===void 0&&(o.push(t),s=t),e.backing.set(s,r),e}),Qee=(e,t)=>{for(let r=0,n=e.length;r<n;r++)if(J(t,e[r]))return e[r]};var dl=f(2,(e,t)=>{if(AA(t))return e.backing.delete(t),e;let r=H(t),n=e.buckets.get(r);if(n===void 0)return e;for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a===t||J(t,a)){e.backing.delete(a),n.splice(o,1);break}}return n.length===0&&e.buckets.delete(r),e}),Rb=e=>(e.backing.clear(),e.buckets.clear(),e),ZL=e=>e.backing.size;var Mb=VE;var ui=ZE,QL=aR,Wo=Ji;var YL=Hi,XL=cR;var ml=zs,fi=nP;var bn=LI,e$=fP;var t$=\"~effect/MutableRef\",Yee={[t$]:t$,...$t,toJSON(){return{_id:\"MutableRef\",current:Lt(this.current)}}},li=e=>{let t=Object.create(Yee);return t.current=e,t};var r$=e=>e.current;var xl=f(2,(e,t)=>(e.current=t,e));var $r=Symbol.for(\"effect/MutableList/Empty\"),pa=()=>({head:void 0,tail:void 0,length:0}),OA=e=>{let t=e.head;t.offset>=1024&&t===e.tail&&t.mutable&&(t.array.length-t.offset)*8<=t.offset&&(e.head=e.tail={array:t.array.slice(t.offset),mutable:!0,offset:0,next:void 0})},n$=()=>({array:[],mutable:!0,offset:0,next:void 0}),Jo=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=n$(),e.tail=e.tail.next):e.head=e.tail=n$(),e.tail.array.push(t),e.length++},_A=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||(e.tail=e.head),e.length++};var Ub=(e,t)=>Nb(e,Se(t),!Array.isArray(t)),Nb=(e,t,r=!1)=>{if(t.length===0)return 0;let n={array:t,mutable:r,offset:0,next:void 0};return e.head?e.tail=e.tail.next=n:e.head=e.tail=n,e.length+=t.length,t.length},la=e=>{e.head=e.tail=void 0,e.length=0},tu=(e,t)=>{if(t=ct(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return la(e),s}let r=new Array(t),n=0,o=e.head;for(;o;){for(;o.offset<o.array.length;)if(r[n++]=o.array[o.offset],o.mutable&&(o.array[o.offset]=void 0),o.offset++,n===t)return e.head=o.offset===o.array.length&&o.next?o.next:o,e.length-=t,e.length===0?la(e):OA(e),r;o=o.next}return la(e),r},Um=(e,t)=>{if(t=ct(t),t<=0||!e.head)return;if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){la(e);return}let r=0,n=e.head;for(;n;){let o=n.array.length-n.offset;if(r+o>t){n.offset+=t-r,e.head=n,e.length-=t,OA(e);return}r+=o,n=n.next}la(e)},da=e=>tu(e,e.length),ru=e=>{if(!e.head)return $r;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:la(e):OA(e),t},o$=(e,t)=>{if(t=ct(t),t<=0)return[];let r=Math.min(t,e.length),n=new Array(r),o=0,s=e.head;for(;s;){for(let a=s.offset;a<s.array.length;a++)if(n[o++]=s.array[a],o===r)return n;s=s.next}return n};var RA=(e,t)=>{let r=[],n=e.head,o=0;for(;n;){for(let s=n.offset;s<n.array.length;s++)t(n.array[s],o++)&&r.push(n.array[s]);n=n.next}if(r.length===0){la(e);return}e.head=e.tail={array:r,mutable:!0,offset:0,next:void 0},e.length=r.length},s$=(e,t)=>RA(e,r=>r!==t);var Xee=\"~effect/PubSub\";var ete=\"~effect/PubSub/Subscription\",zb=e=>B(()=>ate(e.atomicPubSub(),new Map,Vn(),bn(!1),li(!1),e.strategy(),li(v()))),jb=e=>zb({atomicPubSub:()=>qA(e),strategy:()=>new Lb}),qb=e=>zb({atomicPubSub:()=>qA(e),strategy:()=>new $b}),Hb=e=>zb({atomicPubSub:()=>qA(e),strategy:()=>new jA}),Wb=e=>zb({atomicPubSub:()=>a$(e),strategy:()=>new $b}),qA=e=>{let t=typeof e==\"number\"?{capacity:e}:e;if(ite(t.capacity),t.capacity===1/0)return a$(t);let r=t.replay&&t.replay>0?new Bb(Math.ceil(t.replay)):void 0;return t.capacity===1?new NA(r):RF(t.capacity)===t.capacity?new FA(t.capacity,r):new MA(t.capacity,r)},a$=e=>{let t=e?.replay;return new LA(t&&t>0?new Bb(Math.ceil(t)):void 0)};var Nm=e=>ea(Vr(t=>(xl(e.shutdownFlag,!0),He(e.scope,GI(t.id)).pipe(Ur(e.strategy.shutdown),pg(e.shutdownHook.open),ja)))),Jb=f(2,(e,t)=>B(()=>tte(e,t))),tte=f(2,(e,t)=>{if(e.shutdownFlag.current||Ue(e.ended.current))return!1;if(xl(e.ended,O(t)),e.strategy instanceof Lb)for(let[n,o,s]of da(e.strategy.publishers))s&&On(o,Rr(!1));let r=Rr(t);for(let n of e.subscribers.values())for(let o of n){let s;for(;(s=ru(o))!==$r;)On(s,r)}return e.subscribers.clear(),!0});var Gb=f(2,(e,t)=>z(()=>e.shutdownFlag.current||Ue(e.ended.current)?b(!1):e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),b(!0)):e.strategy.handleSurplus(e.pubsub,e.subscribers,[t],e.shutdownFlag)));var i$=f(2,(e,t)=>z(()=>{if(e.shutdownFlag.current||Ue(e.ended.current))return b(!1);let r=e.pubsub.publishAll(t);return e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),r.length===0?b(!0):e.strategy.handleSurplus(e.pubsub,e.subscribers,r,e.shutdownFlag)})),Dm=e=>ea(sd(t=>{let r=Te(t,Pr),n=Zt(e.scope),o=ste(e.pubsub,e.subscribers,e.strategy,e.ended);return Er(n,rte(o)).pipe(Ur(us(r,s=>He(n,s))),Qt(o))})),rte=e=>ea(Vr(t=>(xl(e.shutdownFlag,!0),Ba(da(e.pollers),r=>Up(r,t.id),{discard:!0,concurrency:\"unbounded\"}).pipe(Zr(()=>B(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),pg(e.shutdownHook.open),ja)))),Kb=e=>z(()=>{if(e.shutdownFlag.current)return an;if(e.replayWindow.remaining>0){let r=e.replayWindow.take();return b(r)}let t=e.pollers.length===0?e.subscription.poll():$r;return t===$r?u$(e):(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),b(t))}),c$=e=>z(function t(r){if(e.shutdownFlag.current)return an;let n=e.pollers.length===0?e.subscription.pollUpTo(Number.POSITIVE_INFINITY):[];return r&&(n=r.concat(n)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?b(e.replayWindow.takeAll().concat(n)):gr(n)?b(n):T(u$(e),o=>t([o]))}),u$=e=>Sf(t=>{if(e.shutdownFlag.current)return t(an);if(Ue(e.ended.current))return t(b(e.ended.current.value));let r=Ao(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),Jo(e.pollers,r),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),r.effect?t(r.effect):(r.resumes=[t],B(()=>s$(e.pollers,r)))});var Pt=Symbol.for(\"effect/PubSub/AbsentValue\"),nte=(e,t,r)=>{e.has(t)||e.set(t,new Set),e.get(t).add(r)},ote=(e,t,r)=>{if(!e.has(t))return;let n=e.get(t);n.delete(r),n.size===0&&e.delete(t)},ste=(e,t,r,n)=>new BA(e,t,e.subscribe(),pa(),bn(!1),li(!1),r,e.replayWindow(),n),MA=class{array;replayIndices;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new gl(this.replayBuffer):Vb}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex%this.capacity;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Se(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,a=Math.min(n,s);if(a===0)return r;let i=0,c=this.publisherIndex+a;for(;this.publisherIndex!==c;){let u=r[i++],l=this.publisherIndex%this.capacity;this.array[l]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[l]=p),this.subscribers[l]=this.subscriberCount,this.publisherIndex+=1}return r.slice(i)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex%this.capacity,r=this.array[t];this.array[t]=Pt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new PA(this,this.publisherIndex,!1)}},PA=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return $r;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex%this.self.capacity,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Pt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return $r}pollUpTo(t){if(t=ct(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let a=this.subscriberIndex%this.self.capacity,i=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=Pt,this.self.subscribersIndex+=1),o.push(i),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex%this.self.capacity;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Pt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},FA=class{array;replayIndices;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.mask=t-1,this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new gl(this.replayBuffer):Vb}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex&this.mask;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Se(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,a=Math.min(n,s);if(a===0)return r;let i=0,c=this.publisherIndex+a;for(;this.publisherIndex!==c;){let u=r[i++],l=this.publisherIndex&this.mask;this.array[l]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[l]=p),this.subscribers[l]=this.subscriberCount,this.publisherIndex+=1}return r.slice(i)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex&this.mask,r=this.array[t];this.array[t]=Pt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new UA(this,this.publisherIndex,!1)}},UA=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return $r;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex&this.self.mask,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Pt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return $r}pollUpTo(t){if(t=ct(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let a=this.subscriberIndex&this.self.mask,i=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=Pt,this.self.subscribersIndex+=1),o.push(i),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex&this.self.mask;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Pt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},NA=class{publisherIndex=0;subscriberCount=0;subscribers=0;value=Pt;replayIndex=0;capacity=1;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new gl(this.replayBuffer):Vb}pipe(){return K(this,arguments)}isEmpty(){return this.subscribers===0}isFull(){return!this.isEmpty()}size(){return this.isEmpty()?0:1}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);return this.subscriberCount!==0&&(this.value=t,r!==void 0&&(this.replayIndex=r),this.subscribers=this.subscriberCount,this.publisherIndex+=1),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=Se(t);return r.length===0?r:this.publish(r[0])?r.slice(1):r}slide(){if(this.isFull()){let t=this.value;this.subscribers=0,this.value=Pt,this.replayBuffer?.slide(t,this.replayIndex)}}subscribe(){return this.subscriberCount+=1,new DA(this,this.publisherIndex,!1)}},DA=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(){if(this.isEmpty())return $r;let t=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Pt),this.subscriberIndex=this.self.publisherIndex,t}pollUpTo(t){return ct(t)<1||this.isEmpty()?[]:[this.poll()]}unsubscribe(){this.unsubscribed||(this.unsubscribed=!0,this.self.subscriberCount-=1,this.self.subscribers!==0&&this.subscriberIndex!==this.self.publisherIndex&&(this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Pt)))}},LA=class{publisherHead={value:Pt,replayIndex:void 0,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=Number.MAX_SAFE_INTEGER;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new gl(this.replayBuffer):Vb}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(t){let r=this.replayBuffer?.offer(t),n=this.publisherTail.subscribers;if(n!==0){let o={value:t,replayIndex:r,subscribers:n,next:null};this.publisherTail.next=o,this.publisherTail=this.publisherTail.next,this.publisherIndex+=1}return!0}publishAll(t){if(this.publisherTail.subscribers!==0)for(let r of t)this.publish(r);else this.replayBuffer&&this.replayBuffer.offerAll(t);return[]}slide(){if(this.publisherHead!==this.publisherTail){let t=this.publisherHead.next,r=t.value;this.publisherHead=this.publisherHead.next,this.publisherHead.value=Pt,this.subscribersIndex+=1,this.replayBuffer?.slide(r,t.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new $A(this,this.publisherTail,this.publisherIndex,!1)}},$A=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(t,r,n,o){this.self=t,this.subscriberHead=r,this.subscriberIndex=n,this.unsubscribed=o}isEmpty(){if(this.unsubscribed)return!0;let t=!0,r=!0;for(;r;)this.subscriberHead===this.self.publisherTail?r=!1:this.subscriberHead.next.value!==Pt?(t=!1,r=!1):(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1);return t}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return $r;let t=!0,r=$r;for(;t;)if(this.subscriberHead===this.self.publisherTail)t=!1;else{let n=this.subscriberHead.next.value;n!==Pt&&(r=n,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Pt,this.self.subscribersIndex+=1),t=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return r}pollUpTo(t){t=ct(t);let r=[],n=0;for(;n!==t;){let o=this.poll();o===$r?n=t:(r.push(o),n+=1)}return r}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==Pt&&(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Pt,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},BA=class{[ete]={_A:_};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;ended;constructor(t,r,n,o,s,a,i,c,u){this.pubsub=t,this.subscribers=r,this.subscription=n,this.pollers=o,this.shutdownHook=s,this.shutdownFlag=a,this.strategy=i,this.replayWindow=c,this.ended=u}pipe(){return K(this,arguments)}},zA=class{[Xee]={_A:_};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;ended;constructor(t,r,n,o,s,a,i){this.pubsub=t,this.subscribers=r,this.scope=n,this.shutdownHook=o,this.shutdownFlag=s,this.strategy=a,this.ended=i}pipe(){return K(this,arguments)}},ate=(e,t,r,n,o,s,a)=>new zA(e,t,r,n,o,s,a),ite=e=>{if(e<=0)throw new Error(`Cannot construct PubSub with capacity of ${e}`)},Lb=class{publishers=pa();get shutdown(){return Vr(t=>Ba(da(this.publishers),([r,n,o])=>o?Up(n,t.id):te,{concurrency:\"unbounded\",discard:!0}))}handleSurplus(t,r,n,o){return Sf(s=>{let a=Ao();return this.offerUnsafe(n,a),this.onPubSubEmptySpaceUnsafe(t,r),this.completeSubscribersUnsafe(t,r),r$(o)?(this.removeUnsafe(a),s(an)):a.effect?s(a.effect):(a.resumes=[s],B(()=>this.removeUnsafe(a)))})}onPubSubEmptySpaceUnsafe(t,r){let n=!0;for(;n&&!t.isFull();){let o=ru(this.publishers);if(o===$r)n=!1;else{let[s,a]=o,i=t.publish(s);i&&o[2]?On(a,Rr(!0)):i||_A(this.publishers,o),this.completeSubscribersUnsafe(t,r)}}}completePollersUnsafe(t,r,n,o){return HA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return WA(this,t,r)}offerUnsafe(t,r){let n=t[Symbol.iterator](),o=n.next();if(!o.done)for(;;){let s=o.value;if(o=n.next(),o.done){Jo(this.publishers,[s,r,!0]);break}Jo(this.publishers,[s,r,!1])}}removeUnsafe(t){RA(this.publishers,([r,n])=>n!==t)}},$b=class{get shutdown(){return te}handleSurplus(t,r,n,o){return b(!1)}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return HA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return WA(this,t,r)}},jA=class{get shutdown(){return te}handleSurplus(t,r,n,o){return B(()=>(this.slidingPublishUnsafe(t,n),this.completeSubscribersUnsafe(t,r),!0))}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return HA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return WA(this,t,r)}slidingPublishUnsafe(t,r){let n=r[Symbol.iterator](),o=n.next();if(!o.done&&t.capacity>0){let s=o.value,a=!0;for(;a;){t.slide();let i=t.publish(s);i&&(o=n.next())&&!o.done?s=o.value:i&&(a=!1)}}}},HA=(e,t,r,n,o)=>{let s=!0;for(;s&&!n.isEmpty();){let a=ru(o);if(a===$r)ote(r,n,o),o.length===0?s=!1:nte(r,n,o);else{let i=n.poll();i===$r?_A(o,a):(On(a,Rr(i)),e.onPubSubEmptySpaceUnsafe(t,r))}}},WA=(e,t,r)=>{for(let[n,o]of r)for(let s of o)e.completePollersUnsafe(t,r,n,s)},Bb=class{capacity;head={value:Pt,index:0,next:null};tail=this.head;slideValues=[];size=0;index=0;publisherIndex=0;constructor(t){this.capacity=t}slide(t,r){this.slideValues[this.index%this.capacity]={value:t,index:r},this.index++}offer(t){let r=this.publisherIndex++;return this.tail.value=t,this.tail.index=r,this.tail.next={value:Pt,index:0,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1,r}offerAll(t){for(let r of t)this.offer(r)}},gl=class{buffer;values;index=0;remaining;slideIndex;newestIndex=-1;constructor(t){this.buffer=t,this.remaining=t.size,this.slideIndex=t.index,this.values=new Array(this.remaining);let r=t.head;for(let n=0;n<this.remaining;n++)this.values[n]=r.value,this.newestIndex=r.index,r=r.next}close(){this.values.length=0,this.remaining=0}sync(){let t=this.buffer.index-this.slideIndex;if(t===0||this.remaining===0)return;let r=Math.min(t,this.buffer.capacity),n=this.buffer.index-r;for(let o=0;o<r;o++){let s=this.buffer.slideValues[(n+o)%this.buffer.capacity];s.index>this.newestIndex&&(this.index=(this.index+1)%this.values.length,this.values[(this.index+this.remaining-1)%this.values.length]=s.value,this.newestIndex=s.index)}this.slideIndex=this.buffer.index}take(){if(this.remaining===0)return;this.sync();let t=this.values[this.index];return this.values[this.index]=Pt,this.index=(this.index+1)%this.values.length,this.remaining--,this.remaining===0&&this.close(),t}takeN(t){t=ct(t);let r=Math.min(t,this.remaining),n=new Array(r);for(let o=0;o<r;o++)n[o]=this.take();return n}takeAll(){return this.takeN(this.remaining)}},Vb={remaining:0,take:()=>{},takeN:()=>[],takeAll:()=>[],close:()=>{}};var tS={};Ae(tS,{asDequeue:()=>pte,asEnqueue:()=>lte,await:()=>Tte,bounded:()=>bl,clear:()=>yte,collect:()=>bte,dropping:()=>hte,end:()=>Bm,endUnsafe:()=>zm,fail:()=>xte,failCause:()=>Ft,failCauseUnsafe:()=>ma,flush:()=>Ite,flushUnsafe:()=>h$,interrupt:()=>gte,into:()=>Cte,isDequeue:()=>fte,isEnqueue:()=>ute,isFull:()=>kte,isFullUnsafe:()=>x$,isQueue:()=>cte,make:()=>Xr,offer:()=>Sn,offerAll:()=>pi,offerAllUnsafe:()=>$m,offerUnsafe:()=>Lm,peek:()=>m$,poll:()=>Ete,shutdown:()=>co,shutdownUnsafe:()=>d$,size:()=>wte,sizeUnsafe:()=>Yb,sliding:()=>mte,take:()=>ks,takeAll:()=>di,takeBetween:()=>Qb,takeN:()=>Ste,takeUnsafe:()=>VA,unbounded:()=>KA});var f$=\"~effect/Queue\",l$=\"~effect/Queue/Enqueue\",p$=\"~effect/Queue/Dequeue\",cte=e=>k(e,f$),ute=e=>k(e,l$),fte=e=>k(e,p$),lte=e=>e,pte=_,GA={_A:_,_E:_},dte={[f$]:GA,[l$]:GA,[p$]:GA,...$t,toJSON(){return{_id:\"effect/Queue\",state:this.state._tag,size:Yb(this)}}},Xr=e=>re(t=>{let r=Object.create(dte);return r.dispatcher=t.currentDispatcher,r.capacity=e?.capacity??Number.POSITIVE_INFINITY,r.strategy=e?.strategy??\"suspend\",r.messages=pa(),r.scheduleRunning=!1,r.state={_tag:\"Open\",takers:new Set,offers:new Set,awaiters:new Set},R(r)}),bl=e=>Xr({capacity:e}),mte=e=>Xr({capacity:e,strategy:\"sliding\"}),hte=e=>Xr({capacity:e,strategy:\"dropping\"}),KA=()=>Xr(),Sn=f(2,(e,t)=>W(()=>Lm(e,t)?Xb:e.state._tag===\"Open\"&&e.strategy===\"suspend\"?_te(e,t):g$)),Lm=(e,t)=>e.state._tag!==\"Open\"?!1:e.messages.length>=e.capacity?e.strategy===\"sliding\"?(ru(e.messages),Jo(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(Jo(e.messages,t),ZA(e),!0):!1:(Jo(e.messages,t),Zb(e),!0),pi=f(2,(e,t)=>Et(r=>{let n=$m(e,t);return n.length===0||e.strategy===\"dropping\"?r(ve(n)):y$(e,{_tag:\"Array\",remaining:n,offset:0,resume:r})})),$m=(e,t)=>{if(e.state._tag!==\"Open\")return Se(t);if(e.capacity===Number.POSITIVE_INFINITY||e.strategy===\"sliding\")return Ub(e.messages,t),e.strategy===\"sliding\"&&tu(e.messages,e.messages.length-e.capacity),Zb(e),[];let r=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(r===0)return Se(t);let n=[],o=0;for(let s of t)o<r?Jo(e.messages,s):n.push(s),o++;return Zb(e),n},xte=f(2,(e,t)=>Ft(e,Oi(t))),Ft=f(2,(e,t)=>V(()=>ma(e,t))),ma=(e,t)=>{if(e.state._tag!==\"Open\")return!1;let r=lr(t),n=DR(r,Ate);return e.state.offers.size===0&&e.messages.length===0?(eS(e,n),!0):(e.state={...e.state,_tag:\"Closing\",exit:n},Zb(e),!0)},Bm=e=>Ft(e,Oi(Mi())),zm=e=>ma(e,Oi(Mi())),gte=e=>re(t=>Ft(e,$s(t.id))),co=e=>V(()=>d$(e)),d$=e=>{if(e.state._tag===\"Done\")return!1;la(e.messages);let t=e.state.offers;eS(e,e.state._tag===\"Open\"?vte:e.state.exit);for(let r of t)b$(r);return!0},yte=e=>W(()=>{if(e.state._tag===\"Done\")return ls(e.state.exit.cause)?R([]):e.state.exit;let t=Rte(e);return yl(e),R(t)}),di=e=>Qb(e,1,Number.POSITIVE_INFINITY),bte=e=>W(()=>{let t=At();return Vt(Xe(wo({while:hr,body:$e(di(e)),step(r){for(let n=0;n<r.length;n++)t.push(r[n])}}),()=>le),t)}),Ste=f(2,(e,t)=>Qb(e,t,t)),Qb=f(3,(e,t,r)=>(t=ct(t),r=ct(r),W(()=>Ote(e,t,r)??br(YA(e,()=>QA(e,t)),Qb(e,t,r))))),ks=e=>W(()=>VA(e)??br(YA(e,()=>QA(e,1)),ks(e))),Ete=e=>W(()=>{let t=VA(e);return t===void 0?R(v()):t._tag===\"Success\"?R(O(t.value)):R(v())}),m$=e=>W(()=>e.state._tag===\"Done\"?e.state.exit:e.messages.length>0&&e.messages.head?R(e.messages.head.array[e.messages.head.offset]):br(YA(e,()=>e.messages.length>0),m$(e))),VA=e=>{if(e.state._tag===\"Done\")return e.state.exit;if(e.messages.length>0){let t=ru(e.messages);return yl(e),ve(t)}else if(e.capacity<=0&&e.state.offers.size>0){let t=XA(e.state.offers);return yl(e),ve(t)}},h$=e=>ZA(e),Ite=e=>V(()=>h$(e)),Tte=e=>Et(t=>{let r=n=>t(Xe(n,()=>yr));return e.state._tag===\"Done\"?r(e.state.exit):(e.state.awaiters.add(r),V(()=>{e.state._tag!==\"Done\"&&e.state.awaiters.delete(r)}))});var wte=e=>V(()=>Yb(e)),kte=e=>V(()=>x$(e)),Yb=e=>e.state._tag===\"Done\"?0:e.messages.length,x$=e=>Yb(e)===e.capacity,Cte=f(2,(e,t)=>Jr(r=>bo(r(e),{onFailure:n=>Ft(t,n),onSuccess:n=>Bm(t)}))),g$=ve(!1),Xb=ve(!0),Ate=en(Mi()),vte=Hu(),ZA=e=>{if(!(e.state._tag===\"Done\"||e.state.takers.size===0)){for(let t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(yr),e.messages.length===0))break}},Zb=e=>{e.scheduleRunning||e.state._tag===\"Done\"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,ZA(e)},0))},Ote=(e,t,r)=>{if(e.state._tag===\"Done\")return e.state.exit;if(r<=0||t<=0)return ve([]);if(!QA(e,t))return;let n=e.messages.length>0?tu(e.messages,r):[XA(e.state.offers)];return yl(e),ve(n)},QA=(e,t)=>e.messages.length>=(e.state._tag===\"Closing\"?1:Math.min(t,e.capacity||1))||e.capacity<=0&&e.state._tag!==\"Done\"&&e.state.offers.size>0,YA=(e,t)=>Et(r=>{if(e.state._tag===\"Done\")return r(e.state.exit);if(t())return r(yr);let n={ready:t,resume:r};return e.state.takers.add(n),V(()=>{e.state._tag!==\"Done\"&&e.state.takers.delete(n)})}),_te=(e,t)=>Et(r=>Lm(e,t)?r(Xb):y$(e,{_tag:\"Single\",message:t,resume:r})),y$=(e,t)=>{if(e.state._tag!==\"Open\")return b$(t);let r=e.state.offers;return r.add(t),V(()=>{e.state._tag!==\"Done\"&&(r.delete(t),e.state._tag===\"Closing\"&&r.size===0&&e.messages.length===0&&eS(e,e.state.exit))})},b$=e=>e._tag===\"Single\"?e.resume(g$):e.resume(ve(e.remaining.slice(e.offset))),XA=e=>{let t=e.values().next().value;if(t._tag===\"Single\")return e.delete(t),t.resume(Xb),t.message;let r=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(ve([]))),r},yl=e=>{if(e.state._tag===\"Done\")return ls(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===\"Closing\"&&e.messages.length===0?(eS(e,e.state.exit),ls(e.state.exit.cause)):!1;for(let t of e.state.offers){let r=e.capacity-e.messages.length;if(r<=0)break;if(t._tag===\"Single\")Jo(e.messages,t.message),e.state.offers.delete(t),t.resume(Xb);else{for(;t.offset<t.remaining.length;t.offset++){if(r===0)return!1;Jo(e.messages,t.remaining[t.offset]),r--}e.state.offers.delete(t),t.resume(ve([]))}}return!1},Rte=e=>{if(e.messages.length>0){let t=da(e.messages);return yl(e),t}else if(e.state._tag!==\"Done\"&&e.state.offers.size>0){let t=[XA(e.state.offers)];return yl(e),t}return[]},eS=(e,t)=>{if(e.state._tag===\"Done\")return;let r=e.state;e.state={_tag:\"Done\",exit:t};for(let n of r.takers)n.resume(t);r.takers.clear();for(let n of r.awaiters)n(t);r.awaiters.clear()};var ev={};Ae(ev,{make:()=>Mte,makeUnsafe:()=>jm,release:()=>$te,releaseAll:()=>Bte,resize:()=>Pte,take:()=>Dte,takeIfAvailable:()=>Lte,withPermit:()=>Ute,withPermits:()=>Fte,withPermitsIfAvailable:()=>Nte});var jm=e=>new rS(e),S$=(e,t,r)=>Et(n=>{if(e.free>=t)return n(r);let o=()=>{e.free<t||(e.waiters.delete(o),n(r))};return e.waiters.add(o),V(()=>{e.waiters.delete(o)})}),rS=class{waiters=new Set;taken=0;permits;constructor(t){this.permits=t}get free(){return this.permits-this.taken}take(t){let r=W(()=>this.free<t?S$(this,t,r):(this.taken+=t,R(t)));return r}takeIfAvailable(t){return W(()=>this.free<t?R(!1):(this.taken+=t,R(!0)))}releaseUnsafe(t,r){return this.taken-=r,this.waiters.size>0&&t.currentDispatcher.scheduleTask(()=>{for(let n of this.waiters){if(this.free<=0)break;n()}},0),this.free}resize(t){return re(r=>(this.permits=t,this.free<0?le:(this.releaseUnsafe(r,0),le)))}release(t){return re(r=>R(this.releaseUnsafe(r,t)))}get releaseAll(){return re(t=>R(this.releaseUnsafe(t,this.taken)))}withPermits(t){return r=>Jr(n=>{let o=W(()=>{if(this.free<t){let s=S$(this,t,le);return $(n(s),()=>o)}return this.taken+=t,To(n(r),()=>{this.releaseUnsafe(zs(),t)},!0)});return o})}withPermit=this.withPermits(1);withPermitsIfAvailable(t){return r=>Jr(n=>this.free<t?Ki:(this.taken+=t,To(n(ju(r)),()=>{this.releaseUnsafe(zs(),t)},!0)))}},Mte=e=>V(()=>new rS(e)),Pte=f(2,(e,t)=>e.resize(t)),Fte=(e,t,r)=>{let n=e.withPermits(t);return r?n(r):n},Ute=(e,t)=>t?e.withPermit(t):e.withPermit,Nte=(e,t,r)=>{let n=e.withPermitsIfAvailable(t);return r?n(r):n},Dte=f(2,(e,t)=>e.take(t)),Lte=f(2,(e,t)=>e.takeIfAvailable(t)),$te=f(2,(e,t)=>e.release(t)),Bte=e=>e.releaseAll;var tv=e=>Fp(e)?qe(e)?Z(e.value):e:b(e);var w$=\"~effect/Channel\",Ir=e=>k(e,w$),zte={[w$]:{_Env:_,_InErr:_,_InElem:_,_OutErr:_,_OutElem:_},pipe(){return K(this,arguments)}},Pe=e=>{let t=Object.create(zte);return t.transform=(r,n)=>Ot(e(r,n),o=>b(It(o))),t},Ko=(e,t)=>Pe((r,n)=>T(he(e)(r,n),o=>t(o,n))),mr=e=>Pe((t,r)=>e),Vo=e=>Pe(ke(function*(t,r){let n=Zt(r),o=a=>He(n,U0(a)),s=yield*vo(e(t,r,n),o);return vo(s,o)})),he=e=>e.transform,qm=4096,jte=(e,t,r)=>Xr({capacity:r?.bufferSize,strategy:r?.strategy}).pipe(Zr(n=>Er(e,co(n))),Zr(n=>Yt(Zn(t(n),e),e)));var k$=(e,t)=>Pe((r,n)=>q(jte(n,e,t),di)),nS=e=>Pe((t,r)=>z(()=>he(e())(t,r))),qte=(e,t,r)=>Vo(ke(function*(n,o,s){let a=v();yield*us(s,c=>Ue(a)?r(a.value,c):te);let i=yield*ea(e);return a=O(i),yield*he(t(i))(n,o)}));var C$=e=>mr(B(()=>{let t=e();return z(()=>{let r=t.next();return r.done?Z(r.value):b(r.value)})})),rv=e=>mr(B(()=>{let t=0;return z(()=>t>=e.length?Z():b(e[t++]))}));var nv=(e,t=qm)=>{let r=qn(t);return mr(B(()=>{let n=e(),o=v();return z(()=>{if(o._tag===\"Some\")return Z(o.value);let s=[];for(;s.length<r;){let a=n.next();if(a.done){if(s.length===0)return Z(a.value);o=O(a.value);break}s.push(a.value)}return b(s)})}))};var A$=(e,t=qm)=>nv(()=>e[Symbol.iterator](),t),oS=e=>sS(b(e));var v$=e=>sS(B(e)),Sl=mr(b(Z())),O$=mr(b(gc)),Cs=e=>mr(b(N(e))),_$=e=>mr(ug(e)),Hm=e=>mr(It(e)),R$=e=>mr(Qs(e)),ov=e=>Hm(cc(e)),sS=e=>mr(B(()=>{let t=!1;return z(()=>t?Z():(t=!0,e))}));var M$=e=>mr(T(e,()=>Z())),sv=e=>mr(b(T(e,tv)));var P$=e=>mr(b(di(e)));var av=e=>mr(b(pT(c$(e),()=>Z())));var F$=e=>mi(q(Dm(e),av)),U$=e=>mi(q(Dm(e),t=>sv(Kb(t))));var N$=e=>Pe((t,r)=>Hte({scope:r,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd}));var Hte=e=>{let t=e.readable.getReader(),r=e.exit??li(void 0),n=z(()=>r.current?r.current:yc(bf({try:()=>t.read(),catch:e.onError}),{onFailure:o=>r.current??It(o),onSuccess:({done:o,value:s})=>r.current?r.current:o?Z():b(we(s))}));return Qt(Er(e.scope,e.releaseLockOnEnd?B(()=>t.releaseLock()):cg(()=>t.cancel().catch(wr))),n)},Wte=(e,t)=>Pe(ke(function*(r,n){let o=e[Symbol.asyncIterator]();return o.return&&(yield*Er(n,cg(()=>o.return()))),T(bf({try:()=>o.next(),catch:t}),s=>s.done?Z(s.value):b(s.value))})),D$=(e,t)=>Zo(Wte(e,t),we),Zo=f(2,(e,t)=>Ko(e,r=>B(()=>{let n=0;return q(r,o=>t(o,n++))})));var L$=e=>e===void 0||e!==\"unbounded\"&&e<=1,aS=f(e=>Ir(e[0]),(e,t,r)=>L$(r?.concurrency)?$$(e,t):Jte(e,t,r)),$$=(e,t)=>Pe((r,n)=>{let o=0;return q(he(e)(r,n),T(s=>t(s,o++)))}),Jte=(e,t,r)=>Vo(ke(function*(n,o,s){let a=0,i=yield*he(e)(n,o),c=r.concurrency===\"unbounded\"?Number.MAX_SAFE_INTEGER:r.concurrency,u=yield*bl(0);yield*Er(s,co(u));let l=cn(yield*Ys()),p=fi(s);if(r.unordered){let d=jm(c),m=$e(d.release(1)),x=yc({onFailure:g=>T(Ft(u,g),m),onSuccess:g=>T(Sn(u,g),m)});yield*d.take(1).pipe(T(()=>i),T(g=>{let y=a++;return p(l(x(z(()=>t(g,y))))),te}),sr({disableYield:!0}),Ot(g=>d.withPermits(c-1)(Ft(u,g))),Yt(s))}else{let d=yield*bl(c-2);yield*Er(s,co(d)),yield*ks(d).pipe(Y0,T(g=>Sn(u,g)),sr({disableYield:!0}),Ot(g=>Ft(u,g)),Yt(s));let m,x=g=>{g._tag!==\"Success\"&&(m=g.cause,ma(u,g.cause))};yield*i.pipe(T(g=>{if(m)return It(m);let y=a++,S=l(z(()=>t(g,y)));return p(S),S.addObserver(x),Sn(d,ui(S))}),sr({disableYield:!0}),Ot(g=>Sn(d,sn(g)).pipe(Ur(Ft(d,g)))),Yt(s))}return ks(u)}));var iv=f(e=>Ir(e[0]),(e,t,r)=>L$(r?.concurrency)?Gte(e,t):Kte(e,t,r)),Gte=(e,t)=>Pe((r,n)=>q(he(e)(r,n),o=>{let s,a,i=T(o,u=>(a??=Zt(n),ft(he(t(u))(r,a),l=>(s=c(l),s)))),c=Xe(u=>{if(s=void 0,a.state._tag===\"Empty\")return i;let l=He(a,vt);return a=void 0,T(l,()=>i)});return z(()=>s??i)})),Kte=(e,t,r)=>e.pipe(Zo(t),uS(r)),B$=f(2,(e,t)=>Pe((r,n)=>B(()=>{let o,s=Zt(n),a=T(he(e)(r,s),i=>(o=Xe(i,c=>He(s,vt).pipe(T(()=>he(t(c))(r,n)),T(u=>(o=u,u)))),o));return z(()=>o??a)})));var cv=f(4,(e,t,r,n)=>Pe(ke(function*(o,s){let a=yield*he(e)(o,s),i=yield*he(t)(o,s),c=r();return z(()=>{let u=n(c,a,i);return q(u,([l,p])=>(c=p,l))})}))),z$=f(2,(e,t)=>Pe((r,n)=>B(()=>{let o,s=Zt(n),a=T(he(e)(r,s),i=>{let c=i.pipe(Zr(()=>(o=i,te)),Xe(u=>He(s,Rr(u)).pipe(Ur(he(t(u))(r,n)),T(l=>(o=l,l)))));return o=c,c});return z(()=>o??a)}))),j$=e=>iv(e,_),Br=e=>Ko(e,t=>{let r,n=0,o=z(function s(){if(r===void 0)return T(t,i=>{switch(i.length){case 0:return s();case 1:return b(i[0]);default:return r=i,b(i[n++])}});let a=r[n++];return n>=r.length&&(r=void 0,n=0),b(a)});return b(o)}),q$=e=>$$(e,tv),H$=e=>Ko(e,t=>b(sr(t,{disableYield:!0}))),W$=f(2,(e,t)=>eo(typeof t==\"function\"?t(_):t).pipe(q(r=>{let n=or.defaultValue();return J$(dS(e,or,B(()=>n)),o=>r(o).pipe(q(s=>{n=s}),Xe(()=>Z(o))))}),mi)),J$=(e,t)=>Pe((r,n)=>B(()=>{let o,s=()=>{let a=Zt(n);return T(he(e)(r,a),i=>(o=Xe(i,c=>He(a,vt).pipe(T(()=>t(c)),T(s))),o))};return z(()=>o??s())})),G$=e=>J$(e,()=>te),K$=f(2,(e,t)=>Ko(e,(r,n)=>q(hf(t),o=>Zr(r,o)))),V$=f(2,(e,t)=>Pe((r,n)=>q(he(e)(r,n),o=>T(o,function s(a){return t(a)?b(a):T(o,s)}))));var Z$=f(2,(e,t)=>Ko(e,r=>b(T(r,function n(o){let s=[];for(let a=0;a<o.length;a++)t(o[a])&&s.push(o[a]);return ut(s)?b(s):T(r,n)})))),Q$=f(2,(e,t)=>Ko(e,r=>b(T(r,function n(o){let s=[];for(let a=0;a<o.length;a++){let i=t(o[a]);je(i)&&s.push(i.success)}return ut(s)?b(s):T(r,n)})))),Y$=f(2,(e,t)=>Ko(e,r=>{let n=T(r,o=>oT(o,t));return b(T(n,function o(s){return ut(s)?b(s):T(n,o)}))})),X$=f(2,(e,t)=>Ko(e,r=>b(T(r,function n(o){return T(sT(o,t),s=>ut(s)?b(s):T(r,n))})))),El=f(e=>Ir(e[0]),(e,t,r,n)=>Pe((o,s)=>q(he(e)(o,s),a=>{let i=t(),c,u=0,l,p=yc(a,{onFailure(m){l=m;let x=n?.onHalt&&n.onHalt(i);return x&&x.length>0?b([i,x]):It(m)},onSuccess(m){let x=r(i,m);return u_(x)?b(x):x}});return z(function m(){if(c===void 0)return l?It(l):T(p,([g,y])=>(i=g,y.length===0?m():y.length===1?b(y[0]):(c=y,m())));let x=c[u++];return u>=c.length&&(c=void 0,u=0),b(x)})})));var eB=f(3,(e,t,r)=>Pe((n,o)=>q(he(e)(n,o),s=>{let a=t,i=!0;return z(()=>i?(i=!1,b(a)):q(T(s,c=>r(a,c)),c=>(a=c,a)))}))),Il=f(2,(e,t)=>Pe((r,n)=>{let o=Zt(n);return q(he(e)(r,o),s=>{let a=s.pipe(Ot(i=>{if(ls(i))return It(i);let c=o;return o=Zt(n),He(c,sn(i)).pipe(Ur(he(t(i))(r,o)),T(u=>(a=u,u)))}));return z(()=>a)})})),tB=f(2,(e,t)=>cS(e,jp,t)),iS=f(2,(e,t)=>Il(e,r=>M$(T(t(r),n=>It(r))))),rB=f(3,(e,t,r)=>Il(e,n=>t(n)?r(n):Hm(n))),cS=f(3,(e,t,r)=>Il(e,n=>{let o=t(n);return Q(o)?Hm(o.failure):r(o.success,n)})),Go=f(2,(e,t)=>cS(e,u0,r=>t(r)));var nB=f(2,(e,t)=>Ko(e,r=>b(lg(r,n=>af(n)?te:ja(t(n)))))),oB=f(e=>Ir(e[0]),(e,t,r,n)=>Go(e,o=>t(o)?r(o):n?n(o):Cs(o))),sB=f(e=>Ir(e[0]),(e,t,r,n)=>Go(e,o=>{let s=t(o);return Q(s)?n?n(s.failure):Cs(s.failure):r(s.success)}));var aB=f(e=>Ir(e[0]),(e,t,r,n,o)=>Go(e,s=>{if(Nt(s,t)&&k(s,\"reason\")){let a=s.reason;return Nt(a,r)?n(a,s):o?o(a,s):Cs(s)}return Cs(s)})),iB=f(e=>Ir(e[0]),(e,t,r,n)=>{let o;return Go(e,s=>{if(Nt(s,t)&&k(s,\"reason\")&&k(s.reason,\"_tag\")&&Hx(s.reason._tag)){let a=s.reason;return o??=new Set(Object.keys(r)),o.has(a._tag)?r[a._tag](a,s):n?n(a,s):Cs(s)}return Cs(s)})});var cB=f(2,(e,t)=>Go(e,r=>Cs(t(r)))),uB=e=>Go(e,ov),fB=f(e=>Ir(e[0]),(e,t)=>{if(!t?.log)return Go(e,()=>Sl);let r=mg(t.log===!0?void 0:t.log);return Go(iS(e,n=>c0(n)?r(n):te),()=>Sl)}),I$=e=>Il(e,()=>Sl),lB=f(e=>Ir(e[0]),(e,t)=>{if(!t?.log)return I$(e);let r=mg(t.log===!0?void 0:t.log);return I$(iS(e,n=>r(n)))}),pB=f(2,(e,t)=>nS(()=>{let r,n=or.defaultValue(),o=dS(e,or,B(()=>n)),s=lv(o,()=>(r=void 0,te)),a=typeof t==\"function\"?t(_):t,i=Go(s,ke(function*(c){return r||(r=yield*eo(a)),n=yield*r(c),i},(c,u)=>Xe(c,()=>b(Cs(u))),mi));return i})),dB=f(e=>Ir(e[0]),(e,t,r)=>e.pipe(Zo(t),uS({...r,concurrency:r?.concurrency??1,switch:!0}))),uS=f(2,(e,{bufferSize:t=16,concurrency:r,switch:n=!1})=>Vo(ke(function*(o,s,a){let i=r===\"unbounded\"?Number.MAX_SAFE_INTEGER:Math.max(1,r),c=n?void 0:jm(i),u=yield*e$(!0),l=new Set,p=yield*bl(t);yield*Er(a,co(p));let d=yield*he(e)(o,s);return yield*Gr(function*(){for(;;){let m;c&&(l.size<i?yield*c.take(1):(m=yield*wf(d),yield*Tf(c.take(1),Ur(ui(m),gc))));let x=m===void 0?yield*d:yield*ui(m),g=Zt(a),y=yield*he(x)(o,g);for(;l.size>=i;){let E=wh(l);l.delete(E),l.size===0&&(yield*u.open),yield*Wo(E)}let S=yield*y.pipe(Zr(()=>rd),T(E=>Sn(p,E)),sr({disableYield:!0}),vo(ke(function*(E){let U=df(E);if(yield*to(He(g,Q(U)?sn(U.failure):Rr(U.success.value))),!!l.has(S)&&(l.delete(S),c&&(yield*c.release(1)),l.size===0&&(yield*u.open),!je(U)))return yield*Ft(p,E)})),wf);u.closeUnsafe(),l.add(S)}}).pipe(Ot(m=>{let x=df(m);return je(x)?u.whenOpen(Ft(p,m)):Ft(p,m)}),Yt(a)),ks(p)}))),fS=f(e=>Ir(e[0])&&Ir(e[1]),(e,t,r)=>Vo(ke(function*(n,o,s){let a=r?.haltStrategy??\"both\",i=yield*bl(0);yield*Er(s,co(i));let c=0;function u(p,d){if(c++,!ls(d))return Ft(i,d);switch(a){case\"both\":return c===2?Ft(i,d):te;case\"left\":case\"right\":return p===a?Ft(i,d):te;case\"either\":return Ft(i,d)}}let l=(p,d,m)=>he(d)(n,m).pipe(T(x=>x.pipe(T(g=>Sn(i,g)),sr)),vo(x=>Ur(He(m,U0(x)),u(p,x))),Yt(s));return yield*l(\"left\",e,Zt(s)),yield*l(\"right\",t,Zt(s)),ks(i)}))),mB=f(2,(e,t)=>fS(e,M$(t),{haltStrategy:\"left\"})),hB=()=>Pe((e,t)=>B(()=>{let r=\"\",n=!1,o=v();function s(c){let u=[];function l(p){r.length===0?u.push(p):(u.push(r+p),r=\"\")}for(let p=0;p<c.length;p++){let d=c[p];if(d.length!==0){let m=0,x=d.indexOf(\"\\r\"),g=d.indexOf(`\n`);for(n&&(g===0&&(m=1,g=d.indexOf(`\n`,m)),n=!1);x!==-1||g!==-1;)x===-1||g!==-1&&g<x?(l(d.substring(m,g)),m=g+1,g=d.indexOf(`\n`,m)):(l(d.substring(m,x)),d.length===x+1?(n=!0,m=d.length,x=-1):(m=x+(g===x+1?2:1),x=d.indexOf(\"\\r\",m),g=d.indexOf(`\n`,m)));r=r+d.substring(m)}}return ut(u)?u:null}let a=z(()=>o._tag===\"Some\"?Z(o.value):lc(e,{onSuccess:i,onFailure:It,onDone:c=>{if(o=O(c),r.length>0){let u=r;return r=\"\",n=!1,b([u])}return Z(c)}}));function i(c){let u=s(c);return u!==null?b(u):a}return a}));var uv=f(2,(e,t)=>Pe((r,n)=>T(he(e)(r,n),o=>he(t)(o,n)))),fv=f(2,(e,t)=>Pe((r,n)=>T(he(e)(r,n),o=>{let s=Ot(o,a=>ls(a)?It(a):Kr(p0(a)));return q(he(t)(s,n),a=>od(a,i=>af(i)?It(i.value):Kr(i)))}))),mi=e=>Pe((t,r)=>{let n;return b(z(()=>n||e.pipe(Zn(r),T(o=>he(o)(t,r)),T(o=>n=o))))}),xB=e=>Vo((t,r,n)=>q(Zn(he(e)(t,r),n),Zn(n)));var gB=f(2,(e,t)=>Pe(ke(function*(r,n){let o=yield*he(e)(r,n),s=yield*Xr({capacity:t.capacity===\"unbounded\"?void 0:t.capacity,strategy:t.capacity===\"unbounded\"?void 0:t.strategy});return yield*Er(n,co(s)),yield*o.pipe(T(a=>Sn(s,a)),sr({disableYield:!0}),vo(a=>Ft(s,a)),Yt(n)),ks(s)}))),yB=f(2,(e,t)=>Pe(ke(function*(r,n){let o=yield*he(e)(r,n),s=yield*Xr({capacity:t.capacity===\"unbounded\"?void 0:t.capacity,strategy:t.capacity===\"unbounded\"?void 0:t.strategy});return yield*Er(n,co(s)),yield*o.pipe(T(a=>pi(s,a)),sr({disableYield:!0}),vo(a=>Ft(s,a)),Yt(n)),di(s)}))),bB=f(2,(e,t)=>fS(e,mr(b(T(t,Z))),{haltStrategy:\"either\"})),SB=f(2,(e,t)=>Vo(ke(function*(r,n,o){let s=yield*he(e)(r,n),a=yield*Yt(t,o,{startImmediately:!0});return z(()=>{let i=a.pollUnsafe();return i===void 0?s:VI(i,{onFailure:It,onSuccess:Z})})}))),EB=f(2,(e,t)=>Wm(e,r=>Co(r)?t(r.cause):te)),Wm=f(2,(e,t)=>Vo((r,n,o)=>us(o,t).pipe(Ur(he(e)(r,n))))),IB=f(2,(e,t)=>mi(Qt(t,e))),lv=f(2,(e,t)=>Ko(e,r=>B(()=>{let n=!0,o=Zr(r,s=>(n=!1,t(s)));return z(()=>n?o:r)}))),TB=f(2,(e,t)=>Ko(e,r=>b(Xe(r,n=>T(t,()=>Z(n)))))),wB=f(2,(e,t)=>Wm(e,r=>t)),nu=(e,t,r)=>z(()=>{let n=Vn(),o=he(e)(Z(),n);return Xe(T(o,t),r||b).pipe(Pn(s=>He(n,s)))});var lS=f(2,(e,t)=>Pe((r,n)=>q(ro(he(e)(r,n),t),ro(t)))),pS=f(3,(e,t,r)=>Pe((n,o)=>q(ds(he(e)(n,o),t,r),ds(t,r)))),dS=f(3,(e,t,r)=>Pe((n,o)=>T(r,s=>he(pS(e,t,s))(n,o)))),kB=f(e=>Ir(e[0]),(e,t,r)=>Ou(t)?lS(e,t):Pe((n,o)=>T(r?.local?ac(t,Da(),o):Lp(t,o),s=>q(ro(he(e)(n,o),s),ro(s))))),CB=f(2,(e,t)=>Pe((r,n)=>sd(o=>{let s=t(o);return he(lS(e,s))(r,n)})));var pv=function(){let e=Ir(arguments[0]),t=e?arguments[1]:arguments[0],r=Jn(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return T$(n,t,r)}return n=>T$(n,t,r)},T$=(e,t,r)=>qte(dT(t,r),n=>pS(e,go,n),(n,o)=>Vr(s=>{let a=s.getRef(_r),i=s.getRef(KP);return Ax(n,o,a,i)}));var AB=e=>nu(e,t=>sr(t,{disableYield:!0})),ou=f(2,(e,t)=>nu(e,r=>sr(T(r,t),{disableYield:!0}))),vB=f(2,(e,t)=>nu(e,r=>r.pipe(T(t),T(n=>n?te:Z()),sr({disableYield:!0})))),dv=e=>q(su(e,()=>({bytes:0,arrays:[]}),(t,r)=>{for(let n=0;n<r.length;n++)t.bytes+=r[n].length,t.arrays.push(r[n]);return t}),({arrays:t,bytes:r})=>{let n=new Uint8Array(r),o=0;for(let s=0;s<t.length;s++){let a=t[s];n.set(a,o),o+=a.length}return n});var OB=e=>z(()=>{let t=v();return nu(e,r=>r.pipe(fg,T(n=>(t=n,Z()))),()=>b(t))}),_B=e=>z(()=>{let t=Symbol(),r=t;return nu(e,n=>sr(T(n,o=>(r=o,te)),{disableYield:!0}),()=>r===t?za:Q0(r))}),su=f(3,(e,t,r)=>z(()=>{let n=t();return nu(e,o=>Mn({while:hr,body:()=>o,step:s=>{n=r(n,s)}}),()=>b(n))})),RB=f(3,(e,t,r)=>z(()=>{let n=t();return nu(e,o=>Mn({while:hr,body:$e(o.pipe(T(s=>r(n,s)),q(s=>{n=s}))),step:wr}),()=>b(n))})),mv=ke(function*(e){let t=jm(1),r=yield*Ys(),n=Te(r,Pr);return(yield*he(e)(Z(),n)).pipe(ro(r),t.withPermits(1))},Ot(e=>b(It(e)))),As=(e,t)=>he(e)(Z(),t);var hv=f(e=>Ir(e[0]),(e,t)=>ms(r=>ou(e,n=>pi(t,n)).pipe(r,to,T(n=>(qe(n)?zm(t):ma(t,n.cause),te)))));var MB=f(e=>Ir(e[0]),ke(function*(e,t){let r=yield*bc,n=yield*Xr({capacity:typeof t.capacity==\"number\"?t.capacity:void 0,strategy:typeof t.capacity==\"number\"?t.strategy:void 0});return yield*Er(r,co(n)),yield*Yt(hv(e,n),r),n}));var PB=e=>Xs(e.capacity===\"unbounded\"?Wb(e):e.strategy===\"dropping\"?qb(e):e.strategy===\"sliding\"?Hb(e):jb(e),Nm),FB=f(2,ke(function*(e,t){let r=yield*PB(t);return yield*kf(xv(e,r,{shutdownOnEnd:t.shutdownOnEnd!==!1})),r})),xv=f(e=>Ir(e[0]),(e,t,r)=>ou(e,n=>i$(t,n)).pipe(r?.shutdownOnEnd===!0?Sc(Nm(t)):_)),UB=f(2,ke(function*(e,t){let r=yield*PB(t);return yield*ou(e,n=>Gb(r,n)).pipe(Pn(n=>Jb(r,n)),kf),r}));var NB=\"~effect/PlatformError\",yv=class extends rn(\"BadArgument\"){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:\"\"}`}};var bv=class extends rn(\"PlatformError\"){constructor(t){\"cause\"in t?super({reason:t,cause:t.cause}):super({reason:t})}[NB]=NB;get message(){return this.reason.message}};var Mme=e=>new bv(new yv(e));var Zte=\"~effect/Stream\",Qte={_R:_,_E:_,_A:_},DB=function(e){this.channel=e};DB.prototype={[Zte]:Qte,pipe(){return K(this,arguments)}};var LB=e=>new DB(e);var Xte=\"~effect/Sink\";var ere={_A:_,_In:_,_L:_,_E:_,_R:_},tre={[Xte]:ere,pipe(){return K(this,arguments)}};var rre=e=>{let t=Object.create(tre);return t.transform=e,t},$B=e=>Pe((t,r)=>b(T(e.transform(t,r),Z)));var BB=e=>{let t=ct(e);return rre(r=>{let n=[];if(t===0)return b([n]);let o;return r.pipe(T(s=>{if(n.length+s.length<=t)return n.push(...s),n.length===t?Z():te;for(let a=0;a<s.length;a++)if(n.push(s[a]),n.length===t)return a+1<s.length&&(o=s.slice(a+1)),Z();return te}),sr({disableYield:!0}),Xe(()=>b([n,o])))})};var zz={};Ae(zz,{DefaultChunkSize:()=>ez,Do:()=>Woe,TypeId:()=>XB,accumulate:()=>voe,aggregate:()=>Soe,aggregateWithin:()=>Rv,as:()=>Nre,bind:()=>Goe,bindEffect:()=>Koe,bindTo:()=>Voe,broadcast:()=>vz,broadcastN:()=>Eoe,buffer:()=>Ane,bufferArray:()=>vne,callback:()=>nz,catch:()=>Vm,catchCause:()=>mz,catchCauseFilter:()=>Lne,catchCauseIf:()=>Dne,catchDefect:()=>One,catchFilter:()=>Ov,catchIf:()=>xz,catchReason:()=>Fne,catchReasons:()=>Une,catchTag:()=>Mne,catchTags:()=>Pne,changes:()=>Ooe,changesWith:()=>Oz,changesWithEffect:()=>_oe,chunks:()=>Tz,collect:()=>Aoe,combine:()=>noe,combineArray:()=>ooe,concat:()=>kl,cross:()=>ane,crossWith:()=>pz,debounce:()=>foe,decodeText:()=>Roe,die:()=>yre,drain:()=>Wre,drainFork:()=>Jre,drop:()=>_v,dropRight:()=>eoe,dropUntil:()=>Qne,dropUntilEffect:()=>Yne,dropWhile:()=>Ez,dropWhileEffect:()=>Iz,dropWhileFilter:()=>Xne,empty:()=>xa,encodeText:()=>Moe,ensuring:()=>Boe,fail:()=>Tl,failCause:()=>oz,failCauseSync:()=>bre,failSync:()=>gre,filter:()=>bne,filterEffect:()=>Ene,filterMap:()=>Sne,filterMapEffect:()=>Ine,flatMap:()=>Cl,flatten:()=>uz,flattenArray:()=>Hre,flattenEffect:()=>Lre,flattenIterable:()=>Yre,flattenTake:()=>Xre,forever:()=>Qre,fromArray:()=>hS,fromArrayEffect:()=>Tre,fromArrays:()=>wre,fromAsyncIterable:()=>Are,fromChannel:()=>M,fromEffect:()=>mS,fromEffectDrain:()=>tz,fromEffectRepeat:()=>rz,fromEffectSchedule:()=>dre,fromEventListener:()=>_re,fromIterable:()=>iu,fromIterableEffect:()=>Ere,fromIterableEffectRepeat:()=>Ire,fromIteratorSucceed:()=>Sre,fromPubSub:()=>kre,fromPubSubTake:()=>sz,fromPull:()=>Qo,fromQueue:()=>wl,fromReadableStream:()=>Cre,fromSchedule:()=>vre,fromSubscription:()=>Ore,groupAdjacentBy:()=>yoe,groupBy:()=>xoe,groupByKey:()=>goe,grouped:()=>moe,groupedWithin:()=>hoe,haltWhen:()=>Doe,ignore:()=>jne,ignoreCause:()=>qne,interleave:()=>Uoe,interleaveWith:()=>Rz,interruptWhen:()=>Noe,intersperse:()=>_z,intersperseAffixes:()=>Foe,isStream:()=>Ce,iterate:()=>Mre,let:()=>Joe,limitBytes:()=>Gne,make:()=>hre,map:()=>In,mapAccum:()=>soe,mapAccumArray:()=>cu,mapAccumArrayEffect:()=>ioe,mapAccumEffect:()=>aoe,mapArray:()=>iz,mapArrayEffect:()=>$re,mapBoth:()=>Dre,mapEffect:()=>Km,mapError:()=>gz,merge:()=>wv,mergeAll:()=>sne,mergeEffect:()=>xS,mergeLeft:()=>nne,mergeResult:()=>rne,mergeRight:()=>one,mkArrayBuffer:()=>ase,mkString:()=>sse,mkUint8Array:()=>ise,never:()=>Fre,onEnd:()=>$oe,onError:()=>Loe,onExit:()=>Mz,onFirst:()=>Fz,onStart:()=>Pz,orDie:()=>zne,orElseIfEmpty:()=>$ne,orElseSucceed:()=>Bne,paginate:()=>Rre,partition:()=>wne,partitionEffect:()=>Tne,partitionQueue:()=>Av,peel:()=>Cne,pipeThrough:()=>Coe,pipeThroughChannel:()=>woe,pipeThroughChannelOrFail:()=>koe,prepend:()=>tne,provide:()=>Uz,provideContext:()=>zoe,provideService:()=>joe,provideServiceEffect:()=>Mv,race:()=>yne,raceAll:()=>dz,range:()=>Pre,rechunk:()=>wz,repeat:()=>Gre,repeatElements:()=>Zre,result:()=>Bre,retry:()=>Hne,run:()=>Dz,runCollect:()=>Lz,runCount:()=>Zoe,runDrain:()=>yS,runFold:()=>Yoe,runFoldEffect:()=>Xoe,runForEach:()=>rse,runForEachArray:()=>$z,runForEachWhile:()=>nse,runHead:()=>ese,runIntoPubSub:()=>pse,runIntoQueue:()=>hse,runLast:()=>tse,runSum:()=>Qoe,scan:()=>coe,scanEffect:()=>uoe,schedule:()=>Kre,scoped:()=>Ure,service:()=>lre,serviceOption:()=>pre,share:()=>Toe,sliding:()=>toe,slidingSize:()=>kz,split:()=>roe,splitLines:()=>Poe,succeed:()=>au,suspend:()=>En,switchMap:()=>qre,sync:()=>xre,take:()=>Jne,takeRight:()=>Kne,takeUntil:()=>yz,takeUntilEffect:()=>bz,takeWhile:()=>Sz,takeWhileEffect:()=>Zne,takeWhileFilter:()=>Vne,tap:()=>cz,tapBoth:()=>zre,tapCause:()=>hz,tapDefect:()=>Rne,tapError:()=>vv,tapErrorTag:()=>_ne,tapSink:()=>jre,throttle:()=>doe,throttleEffect:()=>Cz,tick:()=>mre,timeout:()=>Vre,timeoutOrElse:()=>fz,toAsyncIterable:()=>lse,toAsyncIterableEffect:()=>fse,toAsyncIterableWith:()=>Fv,toChannel:()=>uo,toPubSub:()=>dse,toPubSubTake:()=>Bz,toPull:()=>ose,toQueue:()=>mse,toReadableStream:()=>cse,toReadableStreamEffect:()=>use,toReadableStreamWith:()=>Pv,transduce:()=>boe,transformPull:()=>er,transformPullBracket:()=>Tv,unfold:()=>az,unwrap:()=>hi,unwrapReason:()=>Nne,updateContext:()=>Nz,updateService:()=>qoe,when:()=>kne,withExecutionPlan:()=>Wne,withSpan:()=>Hoe,zip:()=>cne,zipFlatten:()=>lne,zipLatest:()=>xne,zipLatestAll:()=>Cv,zipLatestWith:()=>gne,zipLeft:()=>une,zipRight:()=>fne,zipWith:()=>kv,zipWithArray:()=>gS,zipWithIndex:()=>pne,zipWithNext:()=>dne,zipWithPrevious:()=>mne,zipWithPreviousAndNext:()=>hne});var jB=\"~effect/RcMap\",nre=e=>({[jB]:jB,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:\"Open\",map:Pm()},pipe(){return K(this,arguments)}}),qB=e=>Vr(t=>{let r=t.context,n=Te(r,Pr),o=nre({lookup:e.lookup,context:r,scope:n,idleTimeToLive:typeof e.idleTimeToLive==\"function\"?Yv(e.idleTimeToLive,ye):$e(ye(e.idleTimeToLive??Ge)),capacity:Math.max(e.capacity??Number.POSITIVE_INFINITY,0)});return Qt(us(n,()=>{if(o.state._tag===\"Closed\")return te;let s=o.state.map;return o.state={_tag:\"Closed\"},Ba(s,([,a])=>to(Jm(a))).pipe(Zr(()=>B(()=>{Rb(s)})))}),o)}),Sv=f(2,(e,t)=>ms(r=>{if(e.state._tag===\"Closed\")return an;let n=e.state,o=ml(),s=ws(n.map,t),a;if(s._tag===\"Some\")a=s.value,a.refCount++;else{if(Number.isFinite(e.capacity)&&ZL(e.state.map)>=e.capacity)return N(new d0(`RcMap attempted to exceed capacity of ${e.capacity}`));{a={deferred:Ao(),scope:Vn(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},a.finalizer=sre(e,t,a),Fm(n.map,t,a);let c=new Map(e.context.mapUnsafe);o.context.mapUnsafe.forEach((l,p)=>{c.set(p,l)}),c.set(Pr.key,a.scope);let u=ho(c);z(()=>e.lookup(t)).pipe(cn(u),fi(a.scope)).addObserver(l=>{KI(l)&&ore(e,t,a,u),On(a.deferred,l)})}}let i=jn(o.context,Pr);return Er(i,a.finalizer).pipe(Ur(r(tc(a.deferred))))}));var ore=(e,t,r,n)=>{if(e.state._tag===\"Closed\")return;let o=ws(e.state.map,t);o._tag===\"None\"||o.value!==r||(dl(e.state.map,t),!(r.refCount>0)&&Jm(r).pipe(cn(n),fi(e.scope)))},Jm=e=>e.fiber?Wo(e.fiber).pipe(Ur(He(e.scope,vt))):He(e.scope,vt),sre=(e,t,r)=>Vr(n=>{if(r.refCount--,r.refCount>0)return te;if(e.state._tag===\"Closed\")return Jm(r);let o=ws(e.state.map,t);if(o._tag===\"None\"||o.value!==r)return Jm(r);if(zi(r.idleTimeToLive))return dl(e.state.map,t),Jm(r);if(!Ls(r.idleTimeToLive))return te;let s=n.getRef(ec);return r.expiresAt=s.currentTimeMillisUnsafe()+et(r.idleTimeToLive),r.fiber?te:(r.fiber=ms(function a(i){let c=s.currentTimeMillisUnsafe(),u=r.expiresAt-c;if(u<=0){if(e.state._tag===\"Closed\"||r.refCount>0)return te;let l=ws(e.state.map,t);return l._tag===\"None\"||l.value!==r?te:(dl(e.state.map,t),He(r.scope,vt))}return T(i(s.sleep(Kt(u))),()=>a(i))}).pipe(Sc(B(()=>{r.fiber=void 0})),cn(n.context),fi(e.scope)),te)});var Ev=f(2,(e,t)=>Ic(r=>{if(e.state._tag===\"Closed\")return te;let n=ws(e.state.map,t);if(n._tag===\"None\"||zi(n.value.idleTimeToLive))return te;let o=n.value;return o.expiresAt=r.currentTimeMillisUnsafe()+et(o.idleTimeToLive),te}));var are=\"~effect/RcRef\",Gm={_tag:\"Empty\"},ire={_tag:\"Closed\"},cre={_A:_,_E:_},Iv=class{[are]=cre;pipe(){return K(this,arguments)}state=Gm;acquire;context;scope;idleTimeToLive;constructor(t,r,n,o){this.acquire=t,this.context=r,this.scope=n,this.idleTimeToLive=o}},JB=e=>Vr(t=>{let r=t.context,n=Te(r,Pr),o=new Iv(e.acquire,r,n,e.idleTimeToLive!==void 0?ye(e.idleTimeToLive):void 0);return Qt(us(n,()=>{let s=o.state;return o.state=ire,s._tag===\"Acquired\"?He(s.scope,vt):s._tag===\"Acquiring\"?Wo(s.fiber):te}),o)}),ure=(e,t)=>{switch(e.state._tag){case\"Closed\":return an;case\"Acquired\":{let r=e.state;return r.refCount++,r.fiber?Qt(Wo(r.fiber),r):b(r)}case\"Acquiring\":{let r=e.state;return r.awaiters++,WB(e,r,t)}case\"Empty\":{let r={_tag:\"Acquiring\",fiber:void 0,awaiters:1,acquired:void 0};e.state=r;let n=Vn(),o=ro(e.acquire,zt(e.context,Pr,n)).pipe(T(s=>{if(e.state!==r)return an;let a={_tag:\"Acquired\",value:s,scope:n,fiber:void 0,refCount:r.awaiters,invalidated:!1};return e.state=a,r.acquired=a,b(a)}),Pn(s=>qe(s)?te:(e.state===r&&(e.state=Gm),He(n,s))));return r.fiber=cn(ml().context)(o),WB(e,r,t)}}},WB=(e,t,r)=>Pn(r(ui(t.fiber)),n=>{let o=t.acquired;return o!==void 0?Co(n)?KB(e,o):te:--t.awaiters>0||e.state!==t?te:(e.state=Gm,Wo(t.fiber))}),GB=e=>{let t=e;return ms(r=>T(bc,n=>T(ure(t,r),o=>Qt(us(n,()=>KB(t,o)),o.value))))},KB=(e,t)=>{if(t.refCount--,t.refCount>0)return te;let r=e.idleTimeToLive;return r===void 0||t.invalidated?(e.state===t&&(e.state=Gm),He(t.scope,vt)):Ls(r)?(t.fiber=ms(n=>T(n(qa(r)),()=>e.state===t&&t.refCount===0?(e.state=Gm,He(t.scope,vt)):te)).pipe(Sc(B(()=>{t.fiber=void 0})),cn(e.context),fi(e.scope)),te):te};var VB=JB,ZB=GB;var XB=\"~effect/Stream\",Ce=e=>k(e,XB),ez=qm,M=LB,mS=e=>M(sS(q(e,we))),lre=e=>mS(cT(e)),pre=e=>mS(uT(e)),tz=e=>Qo(b(T(e,()=>Z()))),rz=e=>Qo(b(q(e,we))),dre=(e,t)=>Qo(Gr(function*(){let r=yield*eo(t),n=yield*ds(e,or,or.defaultValue()),o=!0,s=z(()=>r(n)).pipe(T(a=>ds(e,or,a)),q(a=>(n=a,we(a))));return z(()=>o?(o=!1,b(we(n))):s)})),mre=e=>Qo(B(()=>{let t=!0,r=b(we(void 0)),n=rT(r,e);return z(()=>t?(t=!1,r):n)})),Qo=e=>M(mr(e)),er=(e,t)=>M(Pe((r,n)=>T(As(e.channel,n),o=>t(o,n)))),Tv=(e,t)=>M(Vo((r,n,o)=>T(As(e.channel,n),s=>t(s,n,o)))),uo=e=>e.channel,nz=(e,t)=>M(k$(e,t)),xa=M(Sl),au=e=>M(oS(we(e))),hre=(...e)=>hS(e),xre=e=>M(v$(()=>we(e()))),En=e=>M(nS(()=>e().channel)),Tl=e=>M(Cs(e)),gre=e=>M(_$(e)),oz=e=>M(Hm(e)),yre=e=>M(ov(e)),bre=e=>M(R$(e)),Sre=(e,t)=>M(nv(()=>e,t)),iu=(e,t)=>Array.isArray(e)&&t?.chunkSize===void 0?hS(e):M(A$(e,t?.chunkSize)),Ere=e=>hi(q(e,iu)),Ire=e=>Cl(rz(e),iu),hS=e=>ut(e)?M(oS(e)):xa,Tre=e=>hi(q(e,hS)),wre=(...e)=>M(rv(Bi(e,ut))),wl=e=>M(P$(e)),kre=e=>M(F$(e)),sz=e=>M(U$(e)),Cre=e=>M(N$(e)),Are=(e,t)=>M(D$(e,t)),vre=e=>Qo(q(hf(e),t=>Xe(q(t(void 0),we),()=>Z()))),Ore=e=>M(av(e)),_re=(e,t,r)=>nz(n=>{let o=typeof r==\"object\"&&r.once;function s(a){Lm(n,a),o&&zm(n)}return Xs(B(()=>e.addEventListener(t,s,r)),()=>B(()=>e.removeEventListener(t,s,r)))},{bufferSize:typeof r==\"object\"?r.bufferSize:void 0}),az=(e,t)=>Qo(B(()=>{let r=e;return T(z(()=>t(r)),n=>n===void 0?Z():(r=n[1],b(we(n[0]))))})),Rre=(e,t)=>Qo(B(()=>{let r=e,n=!1;return z(function o(){return n?Z():T(t(r),([s,a])=>(fe(a)?n=!0:r=a.value,ut(s)?b(s):o()))})})),Mre=(e,t)=>az(e,r=>b([r,t(r)])),Pre=(e,t,r=qm)=>e>t?xa:Qo(B(()=>{let n=qn(r),o=e,s=!1;return z(()=>{if(s)return Z();let a=t-o+1;if(a>n){let c=hE(o,o+n-1);return o+=n,b(c)}let i=hE(o,o+a-1);return s=!0,b(i)})})),Fre=M(O$),hi=e=>M(mi(q(e,uo))),Ure=e=>M(xB(e.channel)),In=f(2,(e,t)=>En(()=>{let r=0;return M(Zo(e.channel,tn(n=>t(n,r++))))})),Nre=f(2,(e,t)=>In(e,()=>t)),Dre=f(2,(e,t)=>e.pipe(In(t.onElement),gz(t.onError))),iz=f(2,(e,t)=>M(Zo(e.channel,t))),Km=f(e=>Ce(e[0]),(e,t,r)=>e.channel.pipe(Br,aS(t,r),Zo(we),M)),Lre=f(e=>Ce(e[0]),(e,t)=>Km(e,_,t)),$re=f(2,(e,t)=>M(aS(e.channel,t))),Bre=e=>e.pipe(In(P),Vm(t=>au(D(t)))),cz=f(e=>Ce(e[0]),(e,t,r)=>Km(e,n=>Qt(t(n),n),r)),zre=f(2,(e,t)=>e.pipe(vv(t.onError),cz(t.onElement,{concurrency:t.concurrency}))),jre=f(2,(e,t)=>Tv(e,ke(function*(r,n,o){let s=bn(),a=bn(),i,c,u=!1,l=!1,p=s.whenOpen(z(()=>{if(i){let m=i;return i=void 0,l||s.closeUnsafe(),Qt(a.open,m)}return Z()}));yield*z(()=>t.transform(p,o)).pipe(m=>lT(m,x=>(u=!0,Co(x)&&(c=x.cause),a.open),!0),Yt(o));let d=r.pipe(T(m=>(i=m,a.closeUnsafe(),s.openUnsafe(),Qt(a.await,m))),Xe(()=>(l=!0,a.closeUnsafe(),s.openUnsafe(),T(a.await,()=>Z()))));return z(()=>c?It(c):u?r:d)}))),Cl=f(e=>Ce(e[0]),(e,t,r)=>e.channel.pipe(Br,iv(n=>t(n).channel,r),M)),qre=f(e=>Ce(e[0]),(e,t,r)=>e.channel.pipe(Br,dB(n=>t(n).channel,r),M)),uz=f(e=>Ce(e[0]),(e,t)=>Cl(e,_,t)),Hre=e=>M(Br(e.channel)),Wre=e=>M(H$(e.channel)),Jre=f(2,(e,t)=>xS(e,yS(t))),Gre=f(2,(e,t)=>M(W$(e.channel,t))),Kre=f(2,(e,t)=>e.channel.pipe(Br,K$(t),Zo(we),M)),Vre=f(2,(e,t)=>fz(e,{duration:t,orElse:()=>xa})),fz=f(2,(e,t)=>{let r=ye(t.duration);if(!Ls(r))return e;if(zi(r))return En(t.orElse);let n=Symbol();return mz(En(()=>{let s=ml().getRef(ec),a=et(r),i,c=bn(!1);return wv(er(e,(u,l)=>z(()=>(i=s.currentTimeMillisUnsafe()+a,c.openUnsafe(),u)).pipe(q(p=>(c.closeUnsafe(),i=void 0,p)),b)),tz(Gr(function*(){for(;;)if(yield*c.await,!(i===void 0||(yield*qa(i-s.currentTimeMillisUnsafe()),i===void 0)||i-s.currentTimeMillisUnsafe()>0))return yield*Kr(n)})),{haltStrategy:\"left\"})}),o=>o.reasons.find(a=>a._tag===\"Die\"&&a.defect===n)?t.orElse():oz(o))}),Zre=f(2,(e,t)=>M(Pe((r,n)=>q(he(Br(e.channel))(r,n),o=>{let s,a=Gr(function*(){let i=yield*o,c=we(i);return s=(yield*hf(t))(i).pipe(Qt(c),Xe(l=>(s=void 0,a))),c});return z(()=>s??a)})))),Qre=e=>M(G$(e.channel)),Yre=e=>Cl(e,iu),Xre=e=>e.channel.pipe(Br,q$,M),kl=f(2,(e,t)=>{let r=M(j$(C$(()=>ene(e,t))));return lz.set(r,[e,t]),r}),lz=new WeakMap;function*ene(e,t){let r=[t,e];for(;r.length>0;){let n=r.pop(),o=lz.get(n);o===void 0?yield n.channel:r.push(o[1],o[0])}}var tne=f(2,(e,t)=>kl(iu(t),e)),wv=f(e=>Ce(e[0])&&Ce(e[1]),(e,t,r)=>M(fS(uo(e),uo(t),r))),xS=f(2,(e,t)=>e.channel.pipe(mB(t),M)),rne=f(2,(e,t)=>wv(In(e,P),In(t,D))),nne=f(2,(e,t)=>xS(e,yS(t))),one=f(2,(e,t)=>xS(t,yS(e))),sne=f(2,(e,t)=>uz(iu(e),t)),ane=f(2,(e,t)=>pz(e,t,(r,n)=>[r,n])),pz=f(3,(e,t,r)=>Cl(e,n=>In(t,o=>r(n,o)))),kv=f(3,(e,t,r)=>gS(e,t,ine(r))),ine=e=>(t,r)=>{let n=Math.min(t.length,r.length),o=[];for(let s=0;s<n;s++)o.push(e(t[s],r[s]));return[o,t.slice(n),r.slice(n)]},gS=f(3,(e,t,r)=>M(Vo(ke(function*(n,o){let s=yield*As(e.channel,o),a=yield*As(t.channel,o),i=Gr(function*(){let l=yield*Yt(s,o),p=yield*Yt(a,o);return yield*QL([l,p])}),c={_tag:\"PullBoth\"};return Gr(function*(){let[l,p]=c._tag===\"PullBoth\"?yield*i:c._tag===\"PullLeft\"?[yield*s,c.rightArray]:[c.leftArray,yield*a],d=r(l,p);return ut(d[1])?c={_tag:\"PullRight\",leftArray:d[1]}:ut(d[2])?c={_tag:\"PullLeft\",rightArray:d[2]}:c={_tag:\"PullBoth\"},d[0]})})))),cne=f(2,(e,t)=>kv(e,t,(r,n)=>[r,n])),une=f(2,(e,t)=>gS(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=r.slice(0,o),a=r.slice(o),i=n.slice(o);return[s,a,i]})),fne=f(2,(e,t)=>gS(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=n.slice(0,o),a=r.slice(o),i=n.slice(o);return[s,a,i]})),lne=f(2,(e,t)=>kv(e,t,(r,n)=>[...r,n])),pne=e=>In(e,(t,r)=>[t,r]),dne=e=>cu(e,v,(t,r)=>{let n=0;t._tag===\"None\"&&(n=1,t=O(r[0]));let o=At();for(;n<r.length;n++){let s=t.value;t=O(r[n]),o.push([s,t])}return[t,o]},{onHalt(t){return t._tag===\"Some\"?[[t.value,v()]]:[]}}),mne=e=>cu(e,v,(t,r)=>{let n=At();for(let o=0;o<r.length;o++){let s=r[o];n.push([t,s]),t=O(r[o])}return[t,n]}),hne=e=>cu(e,()=>({prev:v(),current:v()}),(t,r)=>{let n=0,o;t.current._tag===\"None\"?(n=1,o=r[0],t.current=O(o)):o=t.current.value;let s=At();for(;n<r.length;n++){let a=r[n];t.current=O(a),s.push([t.prev,o,t.current]),t.prev=O(o),o=a}return[t,s]},{onHalt(t){return t.current._tag===\"Some\"?[[t.prev,t.current.value,v()]]:[]}}),Cv=(...e)=>M(nS(()=>{let t=[],r=new Set,n=bn();return uS(rv(e.map((o,s)=>o.channel.pipe(Br,aS(a=>(t[s]=a,r.has(s)?b(we(t.slice())):(r.add(s),r.size<e.length?n.await:Qt(n.open,we(t.slice()))))),V$(kr)))),{concurrency:\"unbounded\",bufferSize:0})})),xne=f(2,(e,t)=>Cv(e,t)),gne=f(3,(e,t,r)=>In(Cv(e,t),([n,o])=>r(n,o))),dz=(...e)=>M(Pe((t,r)=>B(()=>{let n,o=nT(e.map(s=>{let a=Zt(r);return As(s.channel,a).pipe(T(i=>X0(b(i),i)),Pn(i=>i._tag===\"Success\"?n?He(a,i):(n=i.value[0],te):He(a,i)),q(([,i])=>i))}));return z(()=>n??o)}))),yne=f(2,(e,t)=>dz(e,t)),bne=f(2,(e,t)=>M(Z$(uo(e),t))),Sne=f(2,(e,t)=>M(Q$(uo(e),t))),Ene=f(2,(e,t)=>M(Y$(uo(e),t))),Ine=f(2,(e,t)=>M(X$(uo(e),t))),Av=f(e=>Ce(e[0]),ke(function*(e,t,r){let n=yield*bc,o=yield*As(e.channel,n),s=r?.capacity===\"unbounded\"?void 0:r?.capacity??ez,a=yield*Xr({capacity:s}),i=yield*Xr({capacity:s});return yield*Gr(function*(){for(;;){let c=yield*o,u=[],l=[];for(let d=0;d<c.length;d++){let m=t(c[d]);Q(m)?u.push(m.failure):l.push(m.success)}let p;if(l.length>0){let d=$m(a,l);d.length>0&&(p=yield*wf(pi(a,d)))}if(u.length>0){let d=$m(i,u);d.length>0&&(yield*pi(i,d))}p&&(yield*ui(p))}}).pipe(vo(c=>(ma(a,c),ma(i,c),te)),Yt(n)),[a,i]})),Tne=f(e=>Ce(e[0]),(e,t,r)=>q(Av(Km(e,n=>t(n),r),n=>n,r),([n,o])=>[wl(n),wl(o)])),wne=f(e=>Ce(e[0]),(e,t,r)=>q(Av(e,t,{capacity:r?.capacity??16}),([n,o])=>[wl(n),wl(o)])),kne=f(2,(e,t)=>t.pipe(q(r=>r?e:xa),hi)),Cne=f(2,ke(function*(e,t){let r,n=yield*mv(e.channel),o=Ot(n,i=>(r=i,It(i))),s=Qo(b(o)),a=yield*Dz(s,t);return r?[a,xa]:(s=Qo(b(n)),[a,s])})),Ane=f(2,(e,t)=>M(yB(e.channel,t))),vne=f(2,(e,t)=>M(gB(e.channel,t))),mz=f(2,(e,t)=>e.channel.pipe(Il(r=>t(r).channel),M)),One=f(2,(e,t)=>e.channel.pipe(tB(r=>t(r).channel),M)),hz=f(2,(e,t)=>e.channel.pipe(iS(t),M)),Vm=f(2,(e,t)=>M(Go(e.channel,r=>t(r).channel)));var vv=f(2,(e,t)=>e.channel.pipe(nB(t),M)),_ne=f(3,(e,t,r)=>{let n=Array.isArray(t)?o=>k(o,\"_tag\")&&t.includes(o._tag):Nt(t);return vv(e,o=>n(o)?r(o):te)}),Rne=f(2,(e,t)=>hz(e,r=>{let n=jp(r);return je(n)?t(n.success):te})),xz=f(e=>Ce(e[0]),(e,t,r,n)=>M(oB(uo(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),Ov=f(e=>Ce(e[0]),(e,t,r,n)=>M(sB(uo(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),Mne=f(e=>Ce(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>k(s,\"_tag\")&&t.includes(s._tag):Nt(t);return xz(e,o,r,n)}),Pne=f(e=>Ce(e[0]),(e,t,r)=>{let n;return Ov(e,o=>(n??=Object.keys(t),k(o,\"_tag\")&&Hx(o._tag)&&n.includes(o._tag)?P(o):D(o)),o=>t[o._tag](o),r)}),Fne=f(e=>Ce(e[0]),(e,t,r,n,o)=>M(aB(uo(e),t,r,(s,a)=>n(s,a).channel,o&&((s,a)=>o(s,a).channel)))),Une=f(e=>Ce(e[0]),(e,t,r,n)=>{let o=Object.create(null);for(let a of Object.keys(r)){let i=r[a];o[a]=(c,u)=>i(c,u).channel}let s=n&&((a,i)=>n(a,i).channel);return M(iB(e.channel,t,o,s))}),Nne=f(2,(e,t)=>Ov(e,r=>Nt(r,t)&&k(r,\"reason\")?P(r.reason):D(r),Tl)),gz=f(2,(e,t)=>M(cB(e.channel,t))),Dne=f(3,(e,t,r)=>M(rB(e.channel,t,n=>r(n).channel))),Lne=f(3,(e,t,r)=>M(cS(e.channel,t,(n,o)=>r(n,o).channel))),$ne=f(2,(e,t)=>M(z$(e.channel,r=>uo(t())))),Bne=f(2,(e,t)=>Vm(e,r=>au(t(r)))),zne=e=>M(uB(e.channel)),jne=f(e=>Ce(e[0]),(e,t)=>M(fB(e.channel,t))),qne=f(e=>Ce(e[0]),(e,t)=>M(lB(e.channel,t))),Hne=f(2,(e,t)=>M(pB(e.channel,t))),YB=(e,t)=>hi(q(eo(t),r=>{let n=or.defaultValue(),o=()=>Vm(Mv(e,or,B(()=>n)),s=>hi(Xe(q(r(s),a=>(n=a,hi(Qt(rd,o())))),()=>b(Tl(s)))));return o()})),Wne=f(e=>Ce(e[0]),(e,t,r)=>En(()=>{let n=r?.preventFallbackOnPartialStream??!1,o=0,s={attempt:0,stepIndex:0},a=Mv(Nx,B(()=>(s={attempt:s.attempt+1,stepIndex:o},s))),i=r?.onEvent===void 0?void 0:$0(r.onEvent,()=>s),c,u=i===void 0?_:d=>Mz(Pz(d,q(i.begin,m=>{c=m})),m=>z(()=>{if(c===void 0)return te;let x=c;return c=void 0,i.end(x,m)})),l=v(),p=En(()=>{let d=t.steps[o];if(!d)return Tl(QS(l));let m=a(u(Uz(e,d.provide))),x=!1;if(Ue(l)){let g=l.value,y=!1,S=m;m=En(()=>y?S:(y=!0,Tl(g))),m=YB(m,Yp(d,!1))}else{let g=Yp(d,!0);m=g?YB(m,g):m}return Vm(n?Fz(m,g=>(x=!0,te)):m,g=>(o++,n&&x?Tl(g):(l=O(g),p)))});return p})),Jne=f(2,(e,t)=>{let r=ct(t);return r===0?xa:yz(e,(n,o)=>o===r-1)}),Gne=f(3,(e,t,r)=>En(()=>{let n=yg(t),o=BigInt(0),s=!1;return kl(Sz(e,a=>{let i=o+BigInt(a.length);return i>n?(s=!0,!1):(o=i,!0)}),En(()=>s?r():xa))})),Kne=f(2,(e,t)=>{let r=ct(t);return r===0?xa:cu(e,pa,(n,o)=>(Ub(n,o),n.length>r&&Um(n,n.length-r),[n,ha]),{onHalt(n){return da(n)}})}),yz=f(e=>Ce(e[0]),(e,t,r)=>er(e,(n,o)=>B(()=>{let s=0,a=!1;return T(z(()=>a?Z():n),c=>{let u=c.findIndex(l=>t(l,s++));if(u>=0){a=!0;let l=c.slice(0,r?.excludeLast?u:u+1);return ut(l)?b(l):Z()}return b(c)})}))),bz=f(e=>Ce(e[0]),(e,t,r)=>er(e,(n,o)=>B(()=>{let s=0,a=!1;return Gr(function*(){if(a)return yield*Z();let i=yield*n;for(let c=0;c<i.length;c++)if(yield*t(i[c],s++)){a=!0;let u=i.slice(0,r?.excludeLast?c:c+1);return ut(u)?u:yield*Z()}return i})}))),Sz=f(2,(e,t)=>er(e,(r,n)=>B(()=>{let o=0,s=!1,a=T(z(()=>s?Z():r),i=>{let c=[];for(let u=0;u<i.length;u++){if(!t(i[u],o++)){s=!0;break}c.push(i[u])}return ut(c)?b(c):s?Z():a});return a}))),Vne=f(2,(e,t)=>er(e,(r,n)=>B(()=>{let o=!1,s=T(z(()=>o?Z():r),a=>{let i=[];for(let c=0;c<a.length;c++){let u=t(a[c]);if(Q(u)){o=!0;break}i.push(u.success)}return ut(i)?b(i):o?Z():s});return s}))),Zne=f(2,(e,t)=>bz(e,(r,n)=>q(t(r,n),o=>!o),{excludeLast:!0})),_v=f(2,(e,t)=>{let r=ct(t);return r===0?e:er(e,(n,o)=>B(()=>{let s=0,a=n.pipe(T(i=>s>=r?b(i):(s+=i.length,s<=r?a:b(i.slice(r-s)))));return a}))}),Qne=f(2,(e,t)=>_v(Ez(e,(r,n)=>!t(r,n)),1)),Yne=f(2,(e,t)=>_v(Iz(e,(r,n)=>q(t(r,n),o=>!o)),1)),Ez=f(2,(e,t)=>er(e,(r,n)=>B(()=>{let o=!0,s=0,a=T(r,i=>{let c=i.findIndex(u=>!t(u,s++));return c===-1?a:(o=!1,b(i.slice(c)))});return z(()=>o?a:r)}))),Xne=f(2,(e,t)=>er(e,(r,n)=>B(()=>{let o=!0,s=T(r,a=>{let i=a.findIndex(c=>Q(t(c)));return i===-1?s:(o=!1,b(a.slice(i)))});return z(()=>o?s:r)}))),Iz=f(2,(e,t)=>er(e,(r,n)=>B(()=>{let o=!0,s=0,a=Gr(function*(){for(;;){let i=yield*r;for(let c=0;c<i.length;c++)if(!(yield*t(i[c],s++)))return o=!1,i.slice(c)}});return z(()=>o?a:r)}))),eoe=f(2,(e,t)=>{let r=ct(t);return r===0?e:er(e,(n,o)=>B(()=>{let s=pa(),a=T(n,i=>{Nb(s,i);let c=s.length-r,u=tu(s,c);return gr(u)?b(u):a});return a}))}),Tz=e=>e.channel.pipe(Zo(we),M),wz=f(2,(e,t)=>(t=qn(t),er(e,(r,n)=>B(()=>{let o=At(),s=0,a,i=!1;return z(function c(){if(i)return Z();if(a===void 0)return T(r,u=>{if(o.length===0&&u.length===t)return b(u);if(o.length+u.length<t){for(let l=0;l<u.length;l++)o.push(u[l]);return c()}return a=u,c()});for(;s<a.length;)if(o.push(a[s++]),o.length===t){let u=o;return o=[],b(u)}return s=0,a=void 0,c()}).pipe(Xe(()=>{if(o.length===0)return Z();let c=o;return i=!0,o=[],b(c)}))})))),toe=f(2,(e,t)=>kz(e,t,1)),kz=f(3,(e,t,r)=>{let n=qn(t),o=qn(r);return er(e,(s,a)=>B(()=>{let i=null,c=pa(),u=!1,l=0,p=yc(s,{onSuccess(d){if(Nb(c,d),l>0){let x=c.length;Um(c,l),l=Math.max(0,l-x)}if(c.length<n)return p;u=!0;let m=[];for(;c.length>=n;)if(n===o)m.push(tu(c,n));else{m.push(o$(c,n));let x=c.length;Um(c,o),l=Math.max(0,o-x)}return b(m)},onFailure(d){return u&&Um(c,n-o),c.length===0?It(d):(i=d,b(we(da(c))))}});return z(()=>i?It(i):p)}))}),roe=f(2,(e,t)=>cu(e,At,(r,n)=>{let o=At();for(let s=0;s<n.length;s++)t(n[s])?gr(r)&&(o.push(r),r=[]):r.push(n[s]);return[r,o]},{onHalt(r){return gr(r)?we(r):ha}})),noe=f(4,(e,t,r,n)=>cv(Br(e.channel),Br(t.channel),r,n).pipe(Zo(we),M)),ooe=f(4,(e,t,r,n)=>M(cv(e.channel,t.channel,r,n))),soe=f(e=>Ce(e[0]),(e,t,r,n)=>M(El(e.channel,t,(o,s)=>{let a=At();for(let i=0;i<s.length;i++){let[c,u]=r(o,s[i]);o=c,a.push(...u)}return[o,gr(a)?we(a):ha]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return ut(s)?we(s):ha}}:void 0))),cu=f(e=>Ce(e[0]),(e,t,r,n)=>M(El(e.channel,t,(o,s)=>{let[a,i]=r(o,s);return o=a,[o,ut(i)?we(i):ha]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return ut(s)?we(s):ha}}:void 0))),ha=At(),aoe=f(e=>Ce(e[0]),(e,t,r,n)=>e.channel.pipe(Br,El(t,(o,s)=>q(r(o,s),([a,i])=>[a,ut(i)?we(i):At()]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return ut(s)?we(s):ha}}:void 0),M)),ioe=f(e=>Ce(e[0]),(e,t,r,n)=>e.channel.pipe(El(t,(o,s)=>q(r(o,s),([a,i])=>[a,ut(i)?we(i):ha]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return ut(s)?we(s):ha}}:void 0),M)),coe=f(3,(e,t,r)=>En(()=>{let n=t();return kl(au(n),M(El(e.channel,()=>n,(o,s)=>{let a=At();for(let i=0;i<s.length;i++)o=r(o,s[i]),a.push(o);return[o,we(a)]})))})),uoe=f(3,(e,t,r)=>En(()=>e.channel.pipe(Br,eB(t(),r),Zo(we),M))),foe=f(2,(e,t)=>er(e,ke(function*(r,n){let o=yield*ec,s=et(ye(t)),a,i,c=1/0,u=bn(),l=bn(),p=bn();yield*r.pipe(u.whenOpen,T(m=>(l.openUnsafe(),a=m,c=o.currentTimeMillisUnsafe()+s,te)),sr({disableYield:!0}),vo(m=>(i=m,c=o.currentTimeMillisUnsafe(),l.openUnsafe(),p.openUnsafe(),te)),Yt(n));let d=z(function m(){let x=o.currentTimeMillisUnsafe(),g=c<x?s:Math.min(s,c-x);return T(Tf(qa(g),p.await),()=>{if(o.currentTimeMillisUnsafe()<c)return m();if(a){l.closeUnsafe(),u.closeUnsafe();let S=b(we(Ch(a)));return a=void 0,S}else if(i)return It(i);return m()})});return z(()=>{if(i){if(a){let m=b(we(Ch(a)));return a=void 0,m}return It(i)}return u.openUnsafe(),l.whenOpen(d)})}))),Cz=f(2,(e,t)=>{let r=t.burst??0;return t.strategy===\"enforce\"?loe(e,t.cost,t.units,t.duration,r):poe(e,t.cost,t.units,t.duration,r)}),loe=(e,t,r,n,o)=>er(e,s=>Ic(a=>{let i=et(ye(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,l=a.currentTimeMillisUnsafe();return b(T(s,function p(d){return T(t(d),m=>{let x=a.currentTimeMillisUnsafe(),y=(x-l)/i,S=u+y*r,E=S<0?c:Math.min(S,c);return m<=E?(u=E-m,l=x,b(d)):T(s,p)})}))})),poe=(e,t,r,n,o)=>er(e,s=>Ic(a=>{let i=et(ye(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,l=a.monotonicTimeNanosUnsafe();return b(T(s,p=>T(t(p),d=>{let m=a.monotonicTimeNanosUnsafe(),g=Number(m-l)/1e6/i,y=u+g*r,E=Math.min(y,c)-d;if(E>=0)return u=E,l=m,b(p);let U=-E/r,F=Math.max(0,U*i);return F>0?T(qa(F),()=>(u=E,l=m,b(p))):(u=E,l=m,b(p))})))})),doe=f(2,(e,t)=>Cz(e,{...t,cost:r=>b(t.cost(r))})),moe=f(2,(e,t)=>Tz(wz(e,t))),hoe=f(3,(e,t,r)=>Rv(e,BB(qn(t)),Yx(r))),xoe=f(e=>Ce(e[0]),(e,t,r)=>Az(e,ke(function*(n,o,s){for(let a=0;a<n.length;a++){let[i,c]=yield*t(n[a]),u=ws(s,i),l=Ue(u)?u.value:yield*dg(Sv(o,i));yield*Ev(o,i),yield*Sn(l,c)}}),r)),goe=f(e=>Ce(e[0]),(e,t,r)=>En(()=>{let n=Pm();return Az(e,ke(function*(o,s,a){for(let i=0;i<o.length;i++){let c=t(o[i]),u=ws(n,c);fe(u)?Fm(n,c,[o[i]]):u.value.push(o[i])}for(let[i,c]of n){let u=ws(a,i),l=Ue(u)?u.value:yield*dg(Sv(s,i));yield*Ev(s,i),yield*pi(l,c)}Rb(n)}),r)})),Az=(e,t,r)=>Tv(e,ke(function*(n,o,s){let a=yield*KA();yield*Er(o,co(a));let i=Pm(),c=yield*qB({lookup:u=>Xs(Xr({capacity:r?.bufferSize??4096}).pipe(Zr(l=>(Fm(i,u,l),Sn(a,[u,wl(l)])))),l=>(dl(i,u),Bm(l))),idleTimeToLive:r?.idleTimeToLive??nr}).pipe(Zn(s));return yield*Mn({while:hr,body:$e(T(n,u=>t(u,c,i))),step:wr}).pipe(Ot(u=>Ft(a,u)),Yt(o)),di(a)})),yoe=f(2,(e,t)=>er(e,(r,n)=>B(()=>{let o,s,a=At(),i=r.pipe(T(u=>{for(let l=0;l<u.length;l++){let p=u[l],d=t(p);if(s===void 0){o=d,s=[p];continue}else if(J(d,o)){s.push(p);continue}a.push([o,s]),o=d,s=[p]}if(gr(a)){let l=a;return a=[],b(l)}return i})),c=!1;return Xe(z(()=>c?Z():i),()=>{c=!0;let u=s;return s=void 0,u&&gr(u)?b(we([o,u])):Z()})}))),boe=f(2,(e,t)=>er(e,(r,n)=>B(()=>{let o,s,a=z(()=>{if(s!==void 0){let c=s;return s=void 0,b(c)}return r}).pipe(If(c=>(o=Gs(c),Z()))),i=q(z(()=>t.transform(a,n)),([c,u])=>(s=u,we(c)));return z(()=>o||i)}))),Soe=f(2,(e,t)=>Rv(e,t,xf)),Rv=f(3,(e,t,r)=>M(Vo(ke(function*(n,o,s){let a=yield*As(e.channel,o),i=bn(!1),c=Symbol(),u=yield*Xr({capacity:0});yield*a.pipe(i.whenOpen,T(h=>(i.closeUnsafe(),Sn(u,h))),sr,Ot(h=>Ft(u,h)),Yt(s));let l=yield*ec,p=yield*Xn(r),d=bn(!1),m=l.currentTimeMillisUnsafe(),x=0,g=v(),y,S=h=>(d.openUnsafe()&&(x=l.currentTimeMillisUnsafe()),b(h)),E=d.await.pipe(T(()=>p(m,g)),T(([,h])=>qa(h)),T(()=>Sn(u,c)),Xe(()=>Bm(u)),T(()=>gc)),U=z(()=>{if(y!==void 0){let h=y;return y=void 0,S(h)}return u.state._tag===\"Open\"&&i.openUnsafe(),T(ks(u),h=>h===c?Z():S(h))}),F=T(([h,I])=>{if(d.isOpen())m+=l.currentTimeMillisUnsafe()-x;else if(u.state._tag===\"Done\")return Z();return g=O(h),y=I,b(we(h))});return z(()=>{if(u.state._tag===\"Done\"&&y===void 0)return u.state.exit;d.closeUnsafe();let h=F(z(()=>t.transform(U,s)));return u.state._tag===\"Open\"?Tf(h,E):h})})))),Eoe=f(2,ke(function*(e,t){let r=ct(t.n),n=yield*Ioe(t),o=new Array(r),s=yield*Pr;for(let a=0;a<r;a++){let i=Zt(s),c=yield*Dm(n).pipe(ds(Pr,i));o[a]=sv(Kb(c)).pipe(Wm(u=>He(i,u)),M)}return yield*ou(e.channel,a=>Gb(n,a)).pipe(Pn(a=>Jb(n,a)),kf),o})),Ioe=e=>Xs(e.capacity===\"unbounded\"?Wb(e):e.strategy===\"dropping\"?qb(e):e.strategy===\"sliding\"?Hb(e):jb(e),Nm),vz=f(2,(e,t)=>q(Bz(e,t),sz)),Toe=f(2,(e,t)=>q(VB({acquire:vz(e,t),idleTimeToLive:t.idleTimeToLive}),r=>hi(ZB(r)))),woe=f(2,(e,t)=>M(uv(e.channel,t))),koe=f(2,(e,t)=>M(fv(e.channel,t))),Coe=f(2,(e,t)=>e.channel.pipe(fv($B(t)),B$(([r,n])=>n?oS(n):Sl),M)),Aoe=e=>mS(Lz(e)),voe=e=>cu(e,At,(t,r)=>{let n=kh(t,r);return[n,[n]]}),Ooe=e=>Oz(e,J),Oz=f(2,(e,t)=>er(e,(r,n)=>B(()=>{let o=!0,s;return T(r,function a(i){let c=[],u=0;for(o&&(o=!1,s=i[0],u=1,c.push(s));u<i.length;u++){let l=i[u];t(l,s)||(s=l,c.push(l))}return gr(c)?b(c):T(r,a)})}))),_oe=f(2,(e,t)=>er(e,(r,n)=>B(()=>{let o=!0,s;return T(r,ke(function*a(i){let c=[],u=0;for(o&&(o=!1,s=i[0],u=1,c.push(s));u<i.length;u++){let l=i[u];(yield*t(l,s))||(s=l,c.push(l))}return gr(c)?c:yield*T(r,ke(a))}))}))),Roe=f(e=>Ce(e[0]),(e,t)=>En(()=>{let r=new TextDecoder(t?.encoding);return In(e,n=>r.decode(n,{stream:!0}))})),Moe=e=>En(()=>{let t=new TextEncoder;return In(e,r=>t.encode(r))}),Poe=e=>e.channel.pipe(uv(hB()),M),_z=f(2,(e,t)=>iz(e,(r,n)=>{let o=n===0?[]:[t],s=r.length-1;for(let a=0;a<r.length;a++)a===s?o.push(r[a]):o.push(r[a],t);return o})),Foe=f(2,(e,t)=>au(t.start).pipe(kl(_z(e,t.middle)),kl(au(t.end)))),Uoe=f(2,(e,t)=>Rz(e,t,iu(e_([!0,!1])))),Rz=f(3,(e,t,r)=>M(Pe(ke(function*(n,o){let s=yield*he(Br(r.channel))(n,o),a=Symbol(),i=!1,c=!1,u=(yield*he(Br(e.channel))(n,o)).pipe(Xe(()=>(i=!0,b(a)))),l=(yield*he(Br(t.channel))(n,o)).pipe(Xe(()=>(c=!0,b(a))));return Gr(function*(){for(;;){if(i&&c)return yield*Z();let p=yield*s;if(p&&i||!p&&c)continue;let d=yield*p?u:l;if(d!==a)return we(d)}})})))),Noe=f(2,(e,t)=>M(bB(e.channel,t))),Doe=f(2,(e,t)=>M(SB(e.channel,t))),Mz=f(2,(e,t)=>M(Wm(e.channel,t))),Loe=f(2,(e,t)=>M(EB(e.channel,t))),Pz=f(2,(e,t)=>M(IB(e.channel,t))),Fz=f(2,(e,t)=>M(lv(e.channel,r=>t(r[0])))),$oe=f(2,(e,t)=>M(TB(e.channel,t))),Boe=f(2,(e,t)=>M(wB(e.channel,t))),Uz=f(e=>Ce(e[0]),(e,t,r)=>M(kB(e.channel,t,r))),zoe=f(2,(e,t)=>M(lS(e.channel,t))),joe=f(3,(e,t,r)=>M(pS(e.channel,t,r))),Mv=f(3,(e,t,r)=>M(dS(e.channel,t,r))),Nz=f(2,(e,t)=>M(CB(e.channel,t))),qoe=f(3,(e,t,r)=>Nz(e,n=>zt(n,t,r(Te(n,t))))),Hoe=function(){let e=Ce(arguments[0]),t=e?arguments[1]:arguments[0],r=Jn(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return M(pv(n.channel,t,r))}return n=>M(pv(n.channel,t,r))},Woe=au({}),Joe=f(3,(e,t,r)=>In(e,n=>({...n,[t]:r(n)})));var Goe=f(e=>Ce(e[0]),(e,t,r,n)=>Cl(e,o=>In(r(o),s=>({...o,[t]:s})),n)),Koe=f(e=>Ce(e[0]),(e,t,r,n)=>Km(e,o=>q(r(o),s=>({...o,[t]:s})),n)),Voe=f(2,(e,t)=>In(e,r=>({[t]:r}))),Dz=f(2,(e,t)=>fT(r=>As(e.channel,r).pipe(T(n=>t.transform(n,r)),q(([n])=>n)))),Lz=e=>su(e.channel,()=>[],(t,r)=>{for(let n=0;n<r.length;n++)t.push(r[n]);return t}),Zoe=e=>su(e.channel,()=>0,(t,r)=>t+r.length),Qoe=e=>su(e.channel,()=>0,(t,r)=>{for(let n=0;n<r.length;n++)t+=r[n];return t}),Yoe=f(3,(e,t,r)=>su(e.channel,t,(n,o)=>{for(let s=0;s<o.length;s++)n=r(n,o[s]);return n})),Xoe=f(3,(e,t,r)=>RB(e.channel,t,(n,o)=>{let s=0,a=n;return q(Mn({while:()=>s<o.length,body:()=>r(a,o[s]),step(i){a=i,s++}}),()=>a)})),ese=e=>q(OB(e.channel),Jt(f_(0))),tse=e=>q(_B(e.channel),Jt(Ch)),rse=f(2,(e,t)=>ou(e.channel,r=>{let n=0;return Mn({while:()=>n<r.length,body:()=>t(r[n++]),step:wr})})),nse=f(2,(e,t)=>vB(e.channel,r=>{let n=!1,o=0;return q(Mn({while:()=>!n&&o<r.length,body:()=>t(r[o]),step(s){o++,s||(n=!0)}}),()=>!n)})),$z=f(2,(e,t)=>ou(e.channel,t)),yS=e=>AB(e.channel),ose=e=>mv(e.channel),sse=e=>su(e.channel,()=>\"\",(t,r)=>t+r.join(\"\")),ase=e=>q(dv(e.channel),t=>t.buffer),ise=e=>dv(e.channel),Pv=f(e=>Ce(e[0]),(e,t,r)=>{let n,o,s=bn(!1);return new ReadableStream({start(a){o=Ec(ro($z(e,i=>s.whenOpen(B(()=>{s.closeUnsafe();for(let c=0;c<i.length;c++)a.enqueue(i[c]);n(),n=void 0}))),t)),o.addObserver(i=>{i._tag===\"Failure\"?a.error(sf(i.cause)):a.close()})},pull(){return new Promise(a=>{n=a,s.openUnsafe()})},cancel(){if(o)return mT(ja(Wo(o)))}},r?.strategy)}),cse=f(e=>Ce(e[0]),(e,t)=>Pv(e,tr(),t)),use=f(e=>Ce(e[0]),(e,t)=>q(Ys(),r=>Pv(e,r,t))),Fv=f(2,(e,t)=>({[Symbol.asyncIterator](){let r=hT(t),n=cn(t),o=Vn(),s,a,i,c,u=p=>{if(c)return c;let d=i;return c=r(Qt(Ur(d?Wo(d):te,He(o,p)),{done:!0,value:void 0})),c},l=async p=>{try{await u(p)}catch(d){await r(xT(\"Suppressed error while closing Stream async iterator\",d))}};return{async next(){if(c)return c;if(a){let m=a.next();if(!m.done)return m;a=void 0}let p=n(s??T(As(e.channel,o),m=>(s=m,m)));i=p;let d=await r(Mb(p));if(i===p&&(i=void 0),qe(d))return a=d.value[Symbol.iterator](),a.next();if(ls(d.cause))return u(vt);if(c&&zp(d.cause))return c;throw await l(d),sf(d.cause)},return(){return u(vt)},async throw(p){throw await l(JI(p)),p}}}})),fse=e=>q(Ys(),t=>Fv(e,t)),lse=e=>Fv(e,tr()),pse=f(e=>Ce(e[0]),(e,t,r)=>xv(e.channel,t,r)),dse=f(2,(e,t)=>FB(e.channel,t)),Bz=f(2,(e,t)=>UB(e.channel,t)),mse=f(2,(e,t)=>MB(e.channel,t)),hse=f(2,(e,t)=>hv(e.channel,t));var jz=vr(\"effect/FileSystem\");function xse(e){return{_tag:\"Value\",value:e}}function gse(e,t){return{_tag:\"Record\",keys:e,value:t}}function yse(e,t){return{_tag:\"Array\",length:e,value:t}}var Hz=Ee(\"effect/ConfigProvider\",{defaultValue:()=>kse()}),bse={...$t,toJSON(){return{_id:\"ConfigProvider\"}}},Sse=e=>e;function Ese(e,t){let r=Object.create(bse);return r.load=e,r.mapInput=t,r}function Wz(e,t){return Ese(r=>e(t(r)),r=>Wz(e,n=>r(t(n))))}function Ise(e){return Wz(e,Sse)}function Tse(e,t){return e===\"\"&&!t?void 0:e}function wse(e,t){let r=t?.preserveEmptyStrings===!0,n=Cse(e);return Ise(o=>b(Ase(n,e,o,r)))}function kse(e){let t=e?.env??{...globalThis.process?.env,...import.meta?.env};return wse(t,{preserveEmptyStrings:e?.preserveEmptyStrings})}function Cse(e){let t={};for(let[r,n]of Object.entries(e)){if(n===void 0)continue;let o=r.split(\"_\"),s=t;for(let a of o){let i=s.children??=Object.create(null);s=i[a]??={}}}return t}function Ase(e,t,r,n){let o=r.map(String).join(\"_\"),s=Tse(Object.hasOwn(t,o)?t[o]:void 0,n),a=vse(e,r),i=a?.children?Object.keys(a.children):[];if(i.length===0)return s===void 0?void 0:xse(s);if(i.every(Nu)){let u=Math.max(...i.map(l=>parseInt(l,10)))+1;return yse(u,s)}return gse(new Set(i),s)}function vse(e,t){if(t.length===0)return e;let r=e;for(let n of t)if(r=r?.children?.[String(n)],!r)return;return r}var Gz=\"~effect/Config\";var bS=class{_tag=\"ConfigError\";name=\"ConfigError\";cause;constructor(t){this.cause=t}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}},Ose={...fh({label:\"Config\",evaluate(e){return this.parse(e.getRef(Hz))}}),[Gz]:Gz,toJSON(){return{_id:\"Config\"}}};function Zm(e){let t=Object.create(Ose);return t.evaluator=e,t.parse=r=>ft(e(r,[]),nd),t}var uu=(e,t,r)=>e.evaluator(t,r),_se=f(2,(e,t)=>Zm((r,n)=>q(uu(e,r,n),mt(t))));var ehe=f(2,(e,t)=>Zm((r,n)=>iT(uu(e,r,n),{onFailure:o=>uu(t(o),r,n),onSuccess:o=>Q(o)?uu(t(o.failure),r,n):b(o)})));function the(e){let t=globalThis.Array.isArray(e)?e:Symbol.iterator in e?[...e]:e;return Zm((r,n)=>globalThis.Array.isArray(t)?Fn(ig(t.map(o=>uu(o,r,n))),Pu):Fn(ig(Uu(t,o=>uu(o,r,n))),Pu))}var Rse=f(2,(e,t)=>Zm((r,n)=>Fn(uu(e,r,n),o=>Q(o)?P(t):o))),rhe=e=>e.pipe(_se(O),Rse(v()));var Mse=e=>Nt(e,\"SourceError\"),Pse=()=>\"<configuration>\",Vz=(e,t)=>e.load(t).pipe(tT,Fn(r=>({provider:e,path:t,node:r,toString:Pse}))),Kz=(e,t)=>Vz(e.provider,[...e.path,t]),Uv=(e,t)=>sa(oo,e,new be(lt(r=>t(r)),ar())),Zz=e=>{switch(e._tag){case\"Union\":return e.types.every(Zz);case\"Objects\":case\"Arrays\":case\"Suspend\":return!1;default:return!0}},Nv=(e,t)=>{switch(e._tag){case\"Objects\":return t?._tag===\"Record\";case\"Arrays\":return t?._tag===\"Array\";case\"Union\":return e.types.some(r=>Nv(r,t));case\"Suspend\":return Nv(e.thunk(),t);default:return t?.value!==void 0}},Fse=Tn(e=>{let t=new WeakSet,r=zk(n=>{switch(t.add(n),n._tag){case\"Objects\":{let o=n.indexSignatures.map(a=>si(a.parameter)),s=ke(function*(a){if(a.node?._tag!==\"Record\")return;let i=a.node,c=new Set;for(let l of n.propertySignatures)typeof l.name==\"string\"&&c.add(l.name);if(o.length>0)for(let l of i.keys)o.some(p=>p(l))&&c.add(l);let u={};for(let l of c){let p=yield*Kz(a,l);p.node!==void 0&&w(u,l,p)}return u});return Uv(n.recur(r,a=>a),s)}case\"Arrays\":{let o=ke(function*(s){if(s.node?._tag!==\"Array\")return;let a=[];for(let i=0;i<s.node.length;i++)a.push(yield*Kz(s,i));return a});return Uv(n.recur(r),o)}case\"Union\":for(let o of n.types)r(o);if(!Zz(n))return n.recur(r);break;case\"Suspend\":{let o=n.thunk();return t.has(o)||r(o),n.recur(r)}case\"Declaration\":case\"Any\":throw new globalThis.Error(\"Config.schema does not support opaque StringTree encodings\",{cause:n})}return Uv(n,o=>b(o.node?.value))});return r(e)});function fu(e,t){let r=Mm(e),n=hn(r.ast),o=tt(G(Fse(r.ast))),s=typeof t==\"string\"?[t]:t??[];return Zm((a,i)=>{let c=[...i,...s];return Vz(a,c).pipe(ft(u=>o(u).pipe(Fn(P),Cf(l=>{let p=new bS(new ua(c.length>0?new ht(c,l):l));return Nv(n,u.node)?N(p):b(D(p))}))),od(u=>Mse(u)?N(new bS(u)):Kr(u)))})}var Qz=e=>ur(e)||globalThis.Array.isArray(e);function nhe(e){return fu(X,e)}function ohe(e){return fu(Ts,e)}function she(e,t){return fu(Is(e),t)}function ahe(e,t,r){let n=Qz(t),o=n?r:t,s=We(e),a=o?.separator??\",\",i=X.pipe(ee(Mm(s),{decode:Fw(o),encode:Ya(ar({strict:!1}),Y(c=>c.join(a)))}));return fu(gt([i,s]),n?t:void 0)}function ihe(e,t,r,n){let o=Qz(r),s=fa(e,t),a=Zw(o?n:r),i=X.pipe(ee(Mm(s),{decode:a.decode,encode:Ya(ar({strict:!1}),a.encode)}));return fu(gt([s,i]),o?r:void 0)}function che(e){return fu(dA,e)}function uhe(e){return fu(kb,e)}var fhe=\"~effect/ErrorReporter/ignore\";var tj={};Ae(tj,{add:()=>jse,addUnsafe:()=>SS,awaitEmpty:()=>Gse,clear:()=>qse,isFiberSet:()=>Lv,join:()=>Jse,make:()=>$v,makeRuntime:()=>$se,makeRuntimePromise:()=>Bse,run:()=>Hse,runtime:()=>zv,runtimePromise:()=>ej,size:()=>Wse});var Dv=\"~effect/FiberSet\",Lv=e=>k(e,Dv),Dse={[Dv]:Dv,[Symbol.iterator](){return this.state._tag===\"Closed\"?r_():this.state.backing[Symbol.iterator]()},...$t,toJSON(){return{_id:\"FiberSet\",state:this.state}}},Lse=(e,t)=>{let r=Object.create(Dse);return r.state={_tag:\"Open\",backing:e},r.deferred=t,r},$v=()=>Xs(B(()=>Lse(new Set,Ao())),e=>z(()=>{let t=e.state;if(t._tag===\"Closed\")return te;e.state={_tag:\"Closed\"};let r=t.backing;return YL(r).pipe(_x(e.deferred))})),$se=()=>T($v(),e=>zv(e)()),Bse=()=>T($v(),e=>ej(e)()),Bv=-1,zse=O_(R_(f0,__(Bv))),SS=f(e=>Lv(e[0]),(e,t,r)=>{if(e.state._tag===\"Closed\"){t.interruptUnsafe(Bv);return}else if(e.state.backing.has(t))return;e.state.backing.add(t),t.addObserver(n=>{e.state._tag!==\"Closed\"&&(e.state.backing.delete(t),Co(n)&&(r?.propagateInterruption===!0?!zse(n.cause):!zp(n.cause))&&On(e.deferred,n))})}),jse=f(e=>Lv(e[0]),(e,t,r)=>B(()=>SS(e,t,r))),qse=e=>z(()=>e.state._tag===\"Closed\"?te:XL(e.state.backing,Bv)),Xz=(function(){let e;return()=>(e===void 0&&(e=Ec(an)),e)})(),Hse=function(){let e=arguments[0];if(!ps(arguments[1])){let t=arguments[1];return r=>Yz(e,r,t)}return Yz(e,arguments[1],arguments[2])},Yz=(e,t,r)=>Vr(n=>{if(e.state._tag===\"Closed\")return B(Xz);let o=cs(n,t,r?.startImmediately??!0,!0);return SS(e,o,r),b(o)}),zv=e=>()=>q(Ys(),t=>{let r=cn(t);return(n,o)=>{if(e.state._tag===\"Closed\")return Xz();let s=r(n,o);return SS(e,s,o),s}}),ej=e=>()=>q(zv(e)(),t=>(r,n)=>new Promise((o,s)=>t(r,n).addObserver(a=>{qe(a)?o(a.value):s(sf(a.cause))}))),Wse=e=>B(()=>e.state._tag===\"Closed\"?0:e.state.backing.size),Jse=e=>tc(e.deferred),Gse=e=>Mn({while:()=>e.state._tag===\"Open\"&&e.state.backing.size>0,body:()=>Mb(wh(e)),step:wr});var dhe=\"~effect/PrimaryKey\";var fj={};Ae(fj,{CurrentLoggers:()=>nj,LogToStderr:()=>Zse,batched:()=>uj,consoleJson:()=>uae,consoleLogFmt:()=>iae,consolePretty:()=>oae,consolePrettyBrowser:()=>sae,consolePrettyTty:()=>aae,consoleStructured:()=>cae,defaultLogger:()=>rae,formatJson:()=>cj,formatLogFmt:()=>ij,formatSimple:()=>nae,formatStructured:()=>jv,isLogger:()=>rj,layer:()=>lae,make:()=>tae,map:()=>oj,toFile:()=>pae,tracerLogger:()=>fae,withConsoleError:()=>Qse,withConsoleLog:()=>ES,withLeveledConsole:()=>Yse});var Vse=\"~effect/Logger\",rj=e=>k(e,Vse),nj=Yu,Zse=Ox,oj=f(2,(e,t)=>on(r=>t(e.log(r)))),ES=e=>on(t=>t.fiber.getRef(Xi).log(e.log(t))),Qse=e=>on(t=>t.fiber.getRef(Xi).error(e.log(t))),Yse=e=>on(t=>{let r=t.fiber.getRef(Xi),n=e.log(t);switch(t.logLevel){case\"Debug\":return r.debug(n);case\"Info\":return r.info(n);case\"Trace\":return r.trace(n);case\"Warn\":return r.warn(n);case\"Error\":case\"Fatal\":return r.error(n);default:return r.log(n)}}),Xse=/^[^\\s\"=]*$/,eae=e=>`\"${e.replace(/\\\\([\\s\\S])|(\")/g,\"\\\\$1$2\")}\"`,sj=e=>`#${e}`,aj=(e,t)=>({cause:r,date:n,fiber:o,logLevel:s,message:a})=>{let i=y=>typeof y==\"string\"?y:L(y,{space:t}),c=y=>y.match(Xse)?y:e(y),u=(y,S)=>`${BI(y)}=${c(S)}`,l=(y,S)=>\" \"+u(y,S),p=u(\"timestamp\",n.toISOString());p+=l(\"level\",s.toUpperCase()),p+=l(\"fiber\",sj(o.id));let d=xE(a);for(let y=0;y<d.length;y++)p+=l(\"message\",i(d[y]));r.reasons.length>0&&(p+=l(\"cause\",Bs(r)));let m=n.getTime(),x=o.getRef(Dp);for(let y of x)p+=\" \"+Mp(y,m);let g=o.getRef(Np);for(let[y,S]of Object.entries(g))p+=l(y,i(S));return p},tae=on,rae=HI,nae=on(aj(eae)),ij=on(aj(JSON.stringify,0)),jv=on(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s={},a={},i=r.getRef(Np);for(let[p,d]of Object.entries(i))w(s,p,Xu(d));let c=t.getTime(),u=r.getRef(Dp);for(let[p,d]of u)w(a,p,c-d);let l=xE(o);return{message:l.length===1?Xu(l[0]):l.map(Xu),level:n.toUpperCase(),timestamp:t.toISOString(),cause:e.reasons.length>0?Bs(e):void 0,annotations:s,spans:a,fiberId:sj(r.id)}}),cj=oj(jv,Os),uj=f(2,(e,t)=>$(Zi,r=>{let n=[],o=W(()=>{if(n.length===0)return le;let s=n;return n=[],t.flush(s)});return Jr(s=>s(Ua(t.window).pipe(br(o),Ju)).pipe(wx,$(a=>is(r,()=>Ji(a))),br(Fa(()=>o)),Vt(on(a=>{n.push(e.log(a))}))))})),oae=DP,sae=qI,aae=jI,iae=ES(ij),cae=ES(jv),uae=ES(cj),fae=WI,lae=(e,t)=>nf(nj,re(Cp(function*(r){let n=new Set(t?.mergeWithExisting===!0?r.getRef(Yu):[]);for(let o of e)n.add(ue(o)?yield*o:o);return n}))),pae=f(e=>rj(e[0]),(e,t,r)=>sx(function*(){let o=yield*(yield*jz).open(t,{flag:\"a+\",...r}),s=new TextEncoder;return yield*uj(e,{window:r?.batchWindow??1e3,flush:a=>dx(o.writeAll(s.encode(a.join(`\n`)+`\n`)))})}));var Rj={};Ae(Rj,{any:()=>zae,bigint:()=>Jae,boolean:()=>qae,date:()=>Kae,defined:()=>jae,discriminator:()=>vae,discriminatorStartsWith:()=>Oae,discriminators:()=>_ae,discriminatorsExhaustive:()=>Rae,exhaustive:()=>rie,fn:()=>Sae,instanceOf:()=>Zae,instanceOfUnsafe:()=>Qae,is:()=>Lae,nonEmptyString:()=>Dae,not:()=>Nae,null:()=>Wae,number:()=>Bae,option:()=>tie,orElse:()=>Yae,orElseAbsurd:()=>Xae,record:()=>Vae,result:()=>eie,string:()=>$ae,symbol:()=>Gae,tag:()=>Mae,tagStartsWith:()=>Pae,tags:()=>Fae,tagsExhaustive:()=>Uae,type:()=>bae,typeTags:()=>Tae,undefined:()=>Hae,value:()=>Eae,valueTags:()=>Iae,when:()=>kae,whenAnd:()=>Aae,whenOr:()=>Cae,withReturnType:()=>wae});var Hv=\"~effect/Match/Matcher\",dae={[Hv]:{_input:_,_filters:_,_remaining:_,_result:_,_return:_,_args:_},_tag:\"TypeMatcher\",add(e){return Qm(this.select,[...this.cases,e])},pipe(){return K(this,arguments)}};function Qm(e,t){let r=Object.create(dae);return r.select=e,r.cases=t,r}var mae={[Hv]:{_input:_,_filters:_,_result:_,_return:_,_flavor:_},_tag:\"ValueMatcher\",add(e){return je(this.value)?this:e._tag===\"When\"&&e.guard(this.provided)===!0?qv(this.provided,P(e.evaluate(this.provided))):e._tag===\"Not\"&&e.guard(this.provided)===!1?qv(this.provided,P(e.evaluate(this.provided))):this},pipe(){return K(this,arguments)}};function qv(e,t){let r=Object.create(mae);return r.provided=e,r.value=t,r}var vl=(e,t)=>({_tag:\"When\",guard:e,evaluate:t}),hae=(e,t)=>({_tag:\"Not\",guard:e,evaluate:t}),Al=e=>{if(typeof e==\"function\")return e;if(Array.isArray(e)){let t=e.map(Al),r=t.length;return n=>{if(!Array.isArray(n))return!1;for(let o=0;o<r;o++)if(t[o](n[o])===!1)return!1;return!0}}else if(e!==null&&typeof e==\"object\"){let t=Reflect.ownKeys(e).map(n=>[n,Al(e[n])]),r=t.length;return n=>{if(typeof n!=\"object\"||n===null)return!1;for(let o=0;o<r;o++){let[s,a]=t[o];if(!(s in n)||a(n[s])===!1)return!1}return!0}}return t=>t===e},xae=e=>{let t=e.map(Al),r=t.length;return n=>{for(let o=0;o<r;o++)if(t[o](n)===!0)return!0;return!1}},gae=e=>{let t=e.map(Al),r=t.length;return n=>{for(let o=0;o<r;o++)if(t[o](n)===!1)return!1;return!0}},pj=()=>Qm(_,[]),dj=e=>Qm(e,[]),mj=e=>qv(e,D(e)),hj=f(2,(e,t)=>TS(t)(Qm(_,[]))(e)),xj=()=>e=>{let t=TS(e)(Qm(_,[]));return r=>t(r)},gj=()=>e=>e,yj=(e,t)=>r=>r.add(vl(Al(e),t)),bj=(...e)=>t=>{let r=e[e.length-1],n=e.slice(0,-1);return t.add(vl(xae(n),r))},Sj=(...e)=>t=>{let r=e[e.length-1],n=e.slice(0,-1);return t.add(vl(gae(n),r))},Wv=e=>(...t)=>{let r=t[t.length-1],n=t.slice(0,-1),o=n.length===1?s=>s!=null&&s[e]===n[0]:s=>s!=null&&n.includes(s[e]);return s=>s.add(vl(o,r))},Jv=e=>(t,r)=>{let n=o=>o!=null&&typeof o[e]==\"string\"&&o[e].startsWith(t);return o=>o.add(vl(n,r))},IS=e=>t=>{let r=vl(n=>n!=null&&Object.hasOwn(t,n[e]),n=>t[n[e]](n));return n=>n.add(r)},Gv=e=>t=>{let r=IS(e)(t);return n=>Zv(r(n))},Ej=Wv(\"_tag\"),Ij=Jv(\"_tag\"),Tj=IS(\"_tag\"),TS=Gv(\"_tag\"),wj=(e,t)=>r=>r.add(hae(Al(e),t)),kj=e=>typeof e==\"string\"&&e.length>0,Cj=(...e)=>{let t=e.length;return r=>{for(let n=0;n<t;n++)if(r===e[n])return!0;return!1}},Aj=()=>!0,vj=e=>e!=null,Kv=e=>t=>t instanceof e,Vv=e=>t=>{let r=Ym(t);return Ca(r)?r._tag===\"Success\"?r.success:e(r.failure):(...n)=>{let o=r(...n);return je(o)?o.success:e(o.failure,...n)}},Oj=e=>Vv(()=>{throw new Error(\"effect/Match/orElseAbsurd: absurd\")})(e),Ym=e=>{if(e._tag===\"ValueMatcher\")return e.value;let t=e.cases.length;if(t===1){let r=e.cases[0];return(...n)=>{let o=e.select(...n);return r._tag===\"When\"&&r.guard(o)===!0?P(r.evaluate(o,...n)):r._tag===\"Not\"&&r.guard(o)===!1?P(r.evaluate(o,...n)):D(o)}}return(...r)=>{let n=e.select(...r);for(let o=0;o<t;o++){let s=e.cases[o];if(s._tag===\"When\"&&s.guard(n)===!0)return P(s.evaluate(n,...r));if(s._tag===\"Not\"&&s.guard(n)===!1)return P(s.evaluate(n,...r))}return D(n)}},_j=e=>{let t=Ym(e);return Ca(t)?rr(t,{onFailure:()=>v(),onSuccess:O}):(...r)=>rr(t(...r),{onFailure:()=>v(),onSuccess:O})},lj=\"effect/match/Match/exhaustive: absurd\",Zv=e=>{let t=Ym(e);if(Ca(t)){if(je(t))return t.success;throw new Error(lj)}return(...r)=>{let n=t(...r);if(je(n))return n.success;throw new Error(lj)}};var bae=pj,Sae=dj,Eae=mj,Iae=hj,Tae=xj,wae=gj,kae=yj,Cae=bj,Aae=Sj,vae=Wv,Oae=Jv,_ae=IS,Rae=Gv,Mae=Ej,Pae=Ij,Fae=Tj,Uae=TS,Nae=wj,Dae=kj,Lae=Cj,$ae=ur,Bae=ba,zae=Aj,jae=vj,qae=Si,Hae=Nl;var Wae=CS;var Jae=Fl,Gae=pu,Kae=OS,Vae=kt,Zae=Kv,Qae=Kv,Yae=Vv,Xae=Oj,eie=Ym,tie=_j,rie=Zv;var Fj={};Ae(Fj,{get:()=>aie,getAndSet:()=>cie,getAndUpdate:()=>uie,getAndUpdateSome:()=>fie,getUnsafe:()=>gie,make:()=>sie,makeUnsafe:()=>Mj,modify:()=>Pj,modifySome:()=>pie,set:()=>iie,setAndGet:()=>lie,update:()=>die,updateAndGet:()=>mie,updateSome:()=>hie,updateSomeAndGet:()=>xie});var nie=\"~effect/Ref\",oie={[nie]:{_A:_},...$t,toJSON(){return{_id:\"Ref\",ref:this.ref}}},Mj=e=>{let t=Object.create(oie);return t.ref=li(e),t},sie=e=>B(()=>Mj(e)),aie=e=>B(()=>e.ref.current),iie=f(2,(e,t)=>B(()=>xl(e.ref,t))),cie=f(2,(e,t)=>B(()=>{let r=e.ref.current;return e.ref.current=t,r})),uie=f(2,(e,t)=>B(()=>{let r=e.ref.current;return e.ref.current=t(r),r})),fie=f(2,(e,t)=>B(()=>{let r=e.ref.current,n=t(r);return n._tag===\"Some\"&&(e.ref.current=n.value),r})),lie=f(2,(e,t)=>B(()=>e.ref.current=t)),Pj=f(2,(e,t)=>B(()=>{let[r,n]=t(e.ref.current);return e.ref.current=n,r})),pie=f(2,(e,t)=>Pj(e,r=>{let[n,o]=t(r);return[n,o._tag===\"None\"?r:o.value]})),die=f(2,(e,t)=>B(()=>{e.ref.current=t(e.ref.current)})),mie=f(2,(e,t)=>B(()=>e.ref.current=t(e.ref.current))),hie=f(2,(e,t)=>B(()=>{let r=t(e.ref.current);r._tag===\"Some\"&&(e.ref.current=r.value)})),xie=f(2,(e,t)=>B(()=>{let r=t(e.ref.current);return r._tag===\"Some\"&&(e.ref.current=r.value),e.ref.current})),gie=e=>e.ref.current;var wS=Symbol.for(\"@executor-js/utils/RecordedMessage\"),Exe=e=>{if(_e.hasProperty(e,wS)){let t=e[wS];return typeof t==\"string\"?t:void 0}return bie(e)??Iie(e)};var yie={[-32700]:\"Parse error\",[-32600]:\"Invalid request\",[-32601]:\"Method not found\",[-32602]:\"Invalid params\",[-32603]:\"Internal error\",[-32002]:\"Resource not found\"},bie=e=>{if(!_e.isTagged(e,\"ProtocolError\")||!_e.hasProperty(e,\"code\")||typeof e.code!=\"number\"||!_e.hasProperty(e,\"message\")||!_e.isString(e.message))return;let t=e.code,r=/^Tool '.*' not found$/s.test(e.message)?\": the requested tool does not exist\":e.message.startsWith(\"Invalid parameters for tool '\")?\": the tool's arguments failed validation\":\"\",n=yie[t];return(n===void 0?\"JSON-RPC error with an unlisted code\":`${n} (${t})`)+r},Sie=new Set([\"ConnectionError\",\"AuthenticationError\",\"AuthorizationError\",\"SqlSyntaxError\",\"UniqueViolation\",\"ConstraintError\",\"DeadlockError\",\"SerializationError\",\"LockTimeoutError\",\"StatementTimeoutError\",\"UnknownError\"]),Eie=new Set([\"A pipelined query completed out of order\",\"Connection closed\",\"Connection closed during startup\",\"Connection is closed\",\"Connection timed out\",\"Failed to connect\",\"Failed to decode row\",\"Failed to encode query\",\"Failed to negotiate TLS\",\"Failed to parse SSLRequest error response\",\"Failed to parse server messages\",\"Failed to parse server response\",\"Failed to write query\",\"Failed to write query batch\",\"Invalid SSLRequest response\",\"MD5 authentication failed\",\"No password configured\",\"Protocol desync\",\"Query cancellation timed out\",\"Query failed\",\"SCRAM authentication failed\",\"SCRAM exchange did not complete\",\"SCRAM server verification failed\",\"Server refused TLS\",\"Socket error\",\"Stream cancellation timed out\",\"The server reported an error\",\"Unsupported authentication method\"].map(e=>`PgConnection: ${e}`)),Iie=e=>{if(!_e.isTagged(e,\"SqlError\")||!_e.hasProperty(e,\"reason\"))return;let t=e.reason,r=_e.hasProperty(t,\"_tag\")&&_e.isString(t._tag)&&Sie.has(t._tag)?t._tag:\"an unlisted kind\",n=_e.hasProperty(t,\"message\")&&_e.isString(t.message)&&Eie.has(t.message)?`: ${t.message}`:\"\";return`The database failed (${r})${n}`};var Tie=pe.String.pipe(pe.decodeTo(pe.optionalKey(pe.String),{decode:bs.omit(),encode:bs.passthrough()}));function Uj(e){let t=e.fields,r=e.message,n=typeof r==\"string\"?{description:r}:{},o=pe.Error(e.tag)(pe.TaggedStruct(e.tag,{...t,message:Tie}).annotate(n),{httpApiStatus:e.status,...n}),s=e.recorded??(typeof r==\"string\"?()=>r:void 0);return Object.defineProperties(o.prototype,{message:{get(){return typeof r==\"string\"?r:r(this)}},...s===void 0?{}:{[wS]:{get(){return s(this)}}}}),o}function wie(e){return\"fields\"in e?Uj(e):Uj({...e,fields:{}})}var Nj={define:wie};var Lj=pe.NonEmptyString.check(pe.makeFilter(e=>!e.startsWith(\"/\")&&!e.includes(\"\\\\\")&&!e.includes(\"\\0\")&&e.split(\"/\").every(t=>t!==\"\"&&t!==\".\"&&t!==\"..\"))),kie=pe.Struct({path:Lj,content:pe.String}),Qv={nameCharacters:64,descriptionCharacters:1024,compatibilityCharacters:500},Cie=pe.NonEmptyString.check(pe.makeFilter(e=>e===e.toLowerCase()&&/^[\\p{L}\\p{N}]+(?:-[\\p{L}\\p{N}]+)*$/u.test(e)&&[...e].length<=Qv.nameCharacters)),Aie=pe.Struct({name:Cie,description:pe.String.check(pe.makeFilter(e=>e.trim().length>0&&[...e].length<=Qv.descriptionCharacters)),license:pe.optionalKey(pe.String),compatibility:pe.optionalKey(pe.String.check(pe.makeFilter(e=>e.trim().length>0&&[...e].length<=Qv.compatibilityCharacters))),metadata:pe.optionalKey(pe.Record(pe.String,pe.String)),\"allowed-tools\":pe.optionalKey(pe.String)}),vie=pe.Struct({...Aie.fields,files:pe.Array(kie).check(pe.makeFilter(e=>e.some(t=>t.path===\"SKILL.md\")&&new Set(e.map(t=>t.path)).size===e.length))}),Oie={files:e=>`The skill files of \\u201C${e}\\u201D are invalid: each needs a unique relative path, text content and a SKILL.md document.`,directory:e=>`\\u201C${e}\\u201D is not a valid skill directory. Skill directory names use lowercase letters and digits separated by single hyphens.`,\"missing-document\":e=>`\\u201C${e}\\u201D is missing.`,frontmatter:e=>`\\u201C${e}\\u201D must start with valid YAML frontmatter between --- lines.`,metadata:e=>`The frontmatter of \\u201C${e}\\u201D needs a valid name and description within the Agent Skills limits.`,\"name-mismatch\":e=>`The name in \\u201C${e}\\u201D does not match its skill directory.`},vxe=Nj.define({tag:\"SkillDefinitionInvalid\",status:400,fields:{file:Lj,reason:pe.Literals([\"files\",\"directory\",\"missing-document\",\"frontmatter\",\"metadata\",\"name-mismatch\"])},message:({file:e,reason:t})=>Oie[t](e),recorded:({reason:e})=>`The app's skill definition is invalid (${e})`}),Oxe=pe.Array(vie).check(pe.makeFilter(e=>new Set(e.map(t=>t.name)).size===e.length)),_xe=pe.String.check(pe.isPattern(/^[A-Za-z0-9](?:[A-Za-z0-9 .-]{0,98}[A-Za-z0-9])?$/u)),Dj=class extends pe.TaggedError()(\"SkillLoadFailed\",{reason:pe.Literals([\"source\",\"request\",\"rate_limited\",\"document\",\"limit\",\"changed\",\"encoding\"]),message:pe.optional(pe.String.check(pe.isMaxLength(500))),status:pe.optional(pe.Int.check(pe.isBetween({minimum:100,maximum:599}))),missing:pe.optional(pe.Literals([\"repository\",\"ref\"]))}){},Rxe={files:1e3,fileBytes:2e6,totalBytes:2e7,concurrency:8,checkMillis:5e3};export{K as a,f as b,_ as c,$e as d,hr as e,_l as f,wr as g,Yv as h,k as i,nq as j,_e as k,$n as l,L as m,Ie as n,hu as o,hO as p,$t as q,v as r,O as s,vu as t,fe as u,Ue as v,it as w,Kq as x,Yl as y,Ns as z,po as A,Jt as B,Ni as C,De as D,vr as E,tr as F,zt as G,tp as H,Te as I,Ru as J,Ee as K,bt as L,D as M,ZO as N,Q as O,je as P,nt as Q,mE as R,xE as S,ye as T,zi as U,Ge as V,Kt as W,Fh as X,TE as Y,A_ as Z,An as _,Th as $,rn as aa,_a as ba,$h as ca,_E as da,N_ as ea,WW as fa,fp as ga,Hh as ha,Jh as ia,zp as ja,a3 as ka,u3 as la,l0 as ma,h3 as na,Fr as oa,Fp as pa,Mr as qa,tf as ra,Np as sa,Dp as ta,Pr as ua,Er as va,$p as wa,wG as xa,nf as ya,kG as za,YI as Aa,vG as Ba,ic as Ca,ec as Da,$P as Ea,lue as Fa,P0 as Ga,Vx as Ha,fK as Ia,Zx as Ja,xf as Ka,gf as La,G0 as Ma,Z0 as Na,ps as Oa,Ba as Pa,bf as Qa,b as Ra,z as Sa,B as Ta,te as Ua,Gr as Va,N as Wa,It as Xa,Ef as Ya,Vr as Za,nd as _a,T as $a,Ur as ab,Zr as bb,q as cb,Qt as db,ja as eb,If as fb,P4 as gb,F4 as hb,Ot as ib,eT as jb,tT as kb,lg as lb,K4 as mb,Q4 as nb,o6 as ob,rT as pb,qa as qb,f6 as rb,p6 as sb,yc as tb,iT as ub,Ys as vb,sd as wb,I6 as xb,ds as yb,A6 as zb,M6 as Ab,U6 as Bb,pT as Cb,ms as Db,sr as Eb,L6 as Fb,W6 as Gb,tV as Hb,oV as Ib,Yt as Jb,mV as Kb,ke as Lb,IV as Mb,kV as Nb,_t as Ob,tfe as Pb,TT as Qb,vg as Rb,mN as Sb,ppe as Tb,dpe as Ub,mpe as Vb,hpe as Wb,vZ as Xb,OZ as Yb,xpe as Zb,gpe as _b,_Z as $b,ype as ac,bpe as bc,yN as cc,Spe as dc,Dg as ec,SN as fc,Bg as gc,DZ as hc,$Z as ic,BZ as jc,zZ as kc,jZ as lc,qZ as mc,WZ as nc,IN as oc,TN as pc,yd as qc,Ape as rc,vpe as sc,Ope as tc,_pe as uc,Rpe as vc,Mpe as wc,no as xc,ar as yc,na as zc,Zg as Ac,bs as Bc,Uf as Cc,xn as Dc,aa as Ec,Do as Fc,DD as Gc,wC as Hc,Je as Ic,G as Jc,bb as Kc,Zc as Lc,sl as Mc,yn as Nc,Xt as Oc,n9 as Pc,a9 as Qc,i9 as Rc,Em as Sc,X as Tc,uA as Uc,u9 as Vc,Le as Wc,fa as Xc,x9 as Yc,We as Zc,gt as _c,Is as $c,Ib as ad,ee as bd,k9 as cd,W2 as dd,Qc as ed,R9 as fd,Im as gd,vm as hd,Ts as id,T7 as jd,z7 as kd,H7 as ld,GL as md,KL as nd,Fee as od,_b as pd,Hee as qd,pe as rd,Mb as sd,ml as td,tS as ud,ev as vd,Mme as wd,Ce as xd,xa as yd,au as zd,En as Ad,Tl as Bd,iu as Cd,Cre as Dd,hi as Ed,In as Fd,Km as Gd,Cl as Hd,xz as Id,gz as Jd,Moe as Kd,Boe as Ld,zoe as Md,ise as Nd,Pv as Od,use as Pd,zz as Qd,jz as Rd,_se as Sd,ehe as Td,the as Ud,Rse as Vd,rhe as Wd,fu as Xd,nhe as Yd,ohe as Zd,she as _d,ahe as $d,ihe as ae,che as be,uhe as ce,fhe as de,$v as ee,Hse as fe,zv as ge,Gse as he,tj as ie,dhe as je,tae as ke,lae as le,fj as me,Rj as ne,aie as oe,die as pe,Fj as qe,wS as re,Exe as se,Lj as te,kie as ue,Qv as ve,Cie as we,Aie as xe,vie as ye,vxe as ze,Oxe as Ae,_xe as Be,Dj as Ce,Rxe as De};\n","node_modules/apps/chunk-OOJM4CTU.js":"var g=Object.create;var e=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>{try{return a||b((a={exports:{}}).exports,a),a.exports}catch(c){throw a=0,c}},n=(b,a)=>{for(var c in a)e(b,c,{get:a[c],enumerable:!0})},l=(b,a,c,f)=>{if(a&&typeof a==\"object\"||typeof a==\"function\")for(let d of i(a))!k.call(b,d)&&d!==c&&e(b,d,{get:()=>a[d],enumerable:!(f=h(a,d))||f.enumerable});return b};var o=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?e(c,\"default\",{value:b,enumerable:!0}):c,b));export{m as a,n as b,o as c};\n"},"browser":{"node_modules/apps/index.js":"import{Ab as Ke,C as x,Ea as B,Fa as V,G as Pe,Ga as L,H as qe,I as Ne,J as z,K as Fe,L as Te,M as H,O as Q,Oa as K,P as S,Pa as G,Q as je,R as We,S as $,T as Je,Y as f,g as Se,h as xe,kb as R,lb as X,ma as Ue,n as Ae,na as _e,nb as He,o as ke,ob as Qe,s as O,sb as $e,t as h,tb as Be,u as M,ub as Ve,v as g,va as ze,vb as Le,w as P,x as q,z as w}from\"./chunk-5TGEXQYL.js\";import{A as Oe,B as ge,C as we,D as ve,E as Ce,F as Re,G as be,H as Ee,I as De,J as Ie,K as W,L as J,M as U,N as _,O as C,Z as Me,a as I,b as k,e as ye,f as he,u as v,v as N,x as F,y as T,z as j}from\"./chunk-3SCWQGZI.js\";import{Af as p,kd as a}from\"./chunk-MN25OBZU.js\";import\"./chunk-WOT6VMZA.js\";var Y=(e,t)=>a.gen(function*(){if(e.status<200||e.status>=300)return yield*a.fail(new O({status:e.status}));let o=yield*e.json();return yield*F(t,o).pipe(a.mapError(()=>new h))});var Z=e=>new M(e),Ge=p.is(p.Struct({grant:p.Literal(\"client_credentials\")})),Xe=e=>{let[t,o,n,r]=g.members,s=typeof e==\"object\"&&e!==null&&Object.hasOwn(e,\"discover\");return Ge(e)?s?n:r:s?t:o},ee=(e,t,o,n)=>T(g,e,\"oauth2()\",Xe).pipe(a.map(r=>new q({config:r,response:t,...o===void 0?{}:{exposure:o},...n===void 0?{}:{request:n}}))),Ye=({health:e,...t})=>{let o=Object.entries(t.auth).filter(([,r])=>r.request!==void 0);if(t.hosts===void 0&&o.length>0)throw new TypeError(`Provider \"${t.name}\" declares a request for ${o.map(([r])=>r).join(\", \")} but no hosts. Declare the hosts its credentials may be sent to.`);if(e===void 0)return new w(t);let n=x(e,\"check\");return new w({...t,health:{run:n}})};var oe=e=>{let t=J(e);if(t!==void 0)return p.decodeUnknownSync(k)(t);let o=p.toJsonSchemaDocument(e);return p.decodeUnknownSync(k)({...o.schema,$defs:o.definitions})},ne=e=>{let t=new Map;for(let[s,d]of e){let u=JSON.stringify(d),c=t.get(u);c===void 0?t.set(u,{schema:d,first:s,rest:[]}):c.rest.push(s)}let o=[...t.values()],{$defs:n,schemas:r}=C(o.map(({schema:s})=>s),s=>`#/anyOf/${s}/properties/input`);return{type:\"object\",...n===void 0?{}:{$defs:n},anyOf:r.map((s,d)=>{let{first:u,rest:c}=o[d];return{type:\"object\",properties:{accountId:c.length===0?{type:\"string\",const:u}:{type:\"string\",enum:[u,...c]},input:s},required:[\"accountId\",\"input\"]}})}},re=e=>{let{$defs:t,schemas:o}=C([...new Map(e.map(n=>[JSON.stringify(n),n])).values()],n=>`#/anyOf/${n}`);return{...t===void 0?{}:{$defs:t},anyOf:o}},Ze=e=>{if(e.output!==void 0)return!0;let t=Object.getOwnPropertyDescriptor(e,\"outputSchema\");return t!==void 0&&(t.get!==void 0||t.value!==void 0)},et=e=>e.output===void 0?e.outputSchema:oe(e.output),se=e=>{let t=[...e.values()],o=t[0];if(o===void 0)throw new Error(\"An account operation must have at least one account\");let n=t.every(i=>i.kind===\"query\")?\"query\":\"mutation\",r=i=>{let l=e.get(i.accountId);if(l===void 0)throw new Error(\"Account selection must be decoded before execution\");return l},s=p.Union([...e].map(([i,l])=>p.Struct({accountId:p.Literal(i),input:l.input}))),d=()=>ne([...e].map(([i,l])=>[i,oe(l.input)])),u=Q({kind:n,...o.description===void 0?{}:{description:o.description},...o.title===void 0?{}:{title:o.title},...o.annotations===void 0||!t.every(i=>JSON.stringify(i.annotations)===JSON.stringify(o.annotations))?{}:{annotations:o.annotations},...o._meta===void 0||!t.every(i=>JSON.stringify(i._meta)===JSON.stringify(o._meta))?{}:{_meta:o._meta},input:_(s,d),approval:i=>{let l=r(i.toolInput);return l.approval===void 0?a.succeed(\"approved\"):l.approval({...i,toolInput:i.toolInput.input})},run:(i,l)=>{let y=r(l);return y.run(i,l.input).pipe(a.mapError(m=>f(m,l.accountId)),a.flatMap(m=>y.output===void 0?a.succeed(m):p.decodeUnknownEffect(y.output)(m)))}});if(t.every(Ze)){let i=U(()=>re(t.flatMap(y=>{let m=et(y);return m===void 0?[]:[m]}))),l=S(u);l!==void 0&&Object.defineProperty(l,\"outputSchema\",{enumerable:!0,get:i})}let c=S(u);if(c===void 0)throw new Error(\"Expected a combined operation\");return c},ae=(e,t)=>{let o=t[0]?.[1][e];return o!==void 0&&t.every(([,n])=>JSON.stringify(n[e])===JSON.stringify(o))?{[e]:o}:{}},ie=(e,t)=>{let o=t[0]?.[1];if(o===void 0)throw new Error(\"Expected a source operation\");return p.decodeUnknownSync(G)({name:e,description:o.description,...o.title===void 0?{}:{title:o.title},readOnly:t.every(([,n])=>n.readOnly===!0),...ae(\"annotations\",t)})},te=(e,t)=>p.decodeUnknownSync(K)({...ie(e,t),inputSchema:ne(t.map(([o,n])=>[o,n.inputSchema])),...t.every(([,o])=>o.outputSchema!==void 0)?{outputSchema:re(t.flatMap(([,o])=>o.outputSchema===void 0?[]:[o.outputSchema]))}:{},...ae(\"_meta\",t)}),tt=e=>{let t=[...e.values()][0],o=n=>a.gen(function*(){let r=new Map;for(let[s,d]of e){let u=yield*n(d).pipe(a.mapError(c=>f(c,s)));for(let c of u){let i=r.get(c.name)??[];if(i.some(([l])=>l===s))return yield*a.die(new Error(\"Duplicate source operation\"));i.push([s,c]),r.set(c.name,i)}}return r});return{kind:\"dynamic\",...t?.meta===void 0?{}:{meta:t.meta},...t?.overrides===void 0?{}:{overrides:t.overrides},list:()=>o(n=>n.list()).pipe(a.map(n=>[...n].map(([r,s])=>te(r,s)))),summaries:()=>o(n=>n.summaries===void 0?n.list():n.summaries()).pipe(a.map(n=>[...n].map(([r,s])=>ie(r,s)))),describe:n=>a.gen(function*(){let r=[];for(let[s,d]of e){let u=yield*(d.describe===void 0?d.list().pipe(a.map(c=>c.find(i=>i.name===n))):d.describe(n)).pipe(a.mapError(c=>f(c,s)));u!==void 0&&r.push([s,u])}return r.length===0?void 0:te(n,r)}),resolve:n=>a.gen(function*(){let r=new Map;for(let[s,d]of e){let u=yield*d.resolve(n).pipe(a.mapError(c=>f(c,s)));u!==void 0&&r.set(s,u)}return r.size===0?void 0:se(r)})}},ce=e=>{let o=[...e.values()][0];if(o===void 0)throw new Error(\"An account operation must have at least one account\");switch(o.kind){case\"query\":case\"mutation\":return se(b(e,n=>n.kind===\"query\"||n.kind===\"mutation\"));case\"dynamic\":return tt(b(e,n=>n.kind===\"dynamic\"));case\"router\":{let n=b(e,s=>s.kind===\"router\"),r=new Set([...n.values()].flatMap(s=>Object.keys(s.children)));return{kind:\"router\",...o.meta===void 0?{}:{meta:o.meta},children:Object.fromEntries([...r].map(s=>{let d=new Map;for(let[u,c]of n){let i=Object.hasOwn(c.children,s)?c.children[s]:void 0;i!==void 0&&d.set(u,i)}return[s,ce(d)]}))}}}},b=(e,t)=>{let o=new Map;for(let[n,r]of e){if(!t(r))throw new Error(\"Each account's router must have the same shape\");o.set(n,r)}return o},ot=(e,t,o)=>a.runPromise(a.gen(function*(){let n=new Map;for(let s of e){let d=yield*a.tryPromise({try:async()=>t(s),catch:c=>f(c,s.id)});if(n.has(s.id))return yield*a.die(new Error(\"Account selections must be unique\"));let u=X(d);if(u===void 0)return yield*a.die(new Error(\"Expected a protocol router\"));n.set(s.id,u)}if(n.size===0)return R({kind:\"router\",children:{}});let r=ce(n);return r.kind!==\"router\"&&r.kind!==\"dynamic\"?yield*a.die(new Error(\"Expected a protocol router\")):R(r)}),o);var nt=e=>({list:x(async()=>e.list(),\"skills\")});var E=class extends p.TaggedError()(\"NotImplemented\",{operation:p.String}){};var A=(e,t,o,n)=>{let r=S(o);if(r===void 0||r.kind!==\"mutation\")throw new Error(\"A schedule must reference a mutation\");if(e===\"app\"&&r.approval!==void 0)throw new Error(\"An app schedule must reference a mutation without an approval\");return p.decodeUnknownSync(r.input)(n),{scope:e,operation:o,timing:t,input:p.decodeUnknownSync(I)(n)}},pe=e=>{let t=p.decodeUnknownSync(B)(e),o=t.seconds!==void 0?t.seconds*1e3:t.minutes!==void 0?t.minutes*6e4:t.hours*36e5;return p.decodeUnknownSync(L)({kind:\"interval\",milliseconds:o})},ue=e=>({kind:\"cron\",calendar:p.decodeUnknownSync(V)({...e,timezone:e.timezone??\"UTC\"})}),rt=(e,t,o)=>A(\"user\",pe(e),t,o),st=(e,t,o)=>A(\"user\",ue(e),t,o),at=(e,t,o)=>A(\"app\",pe(e),t,o),it=(e,t,o)=>A(\"app\",ue(e),t,o);var de=e=>typeof e==\"object\"&&e!==null&&Object.values(e).every(N),le=e=>v(e),D=e=>{let t=\"fields\"in e&&de(e.fields)?W(e.fields):{};return Object.keys(t).length===0?{}:{exposure:t}},ct=e=>\"fields\"in e&&de(e.fields)?Object.keys(e.fields):e===fe?[\"access_token\"]:[],me=(e,t,o)=>o===void 0?{}:{request:H(e,ct(t),D(t).exposure,o)},fe=j(P,!1),Ht=e=>Z({label:e.label,fields:le(e.fields),...D(e.fields),...me(`\"${e.label}\"`,e.fields,e.request)});function Qt(e){let{response:t=fe,request:o,...n}=e;return a.runSync(ee(n,le(t),D(t).exposure,me(\"OAuth\",t,o).request))}var $t=(e,t)=>{let o={status:e.status,json:()=>a.tryPromise({try:()=>e.json(),catch:n=>n}).pipe(a.catch(n=>n instanceof SyntaxError?a.fail(new h):a.die(n)))};return a.runPromise(Y(o,v(t)))};function Bt(e,t){return typeof e==\"string\"?z(e,t):$(e,t)}export{ke as CacheError,ye as DeclarationInvalid,ze as ElicitationFailed,Ae as FetchOptionUnsupported,xe as NetworkRefused,_e as NonRetryableError,E as NotImplemented,fe as OAuth2AccessToken,Se as ProviderError,h as ResponseDecodeError,O as ResponseStatusError,he as ValidationError,Ue as WorkflowFailure,ot as accountRouter,it as appCron,at as appInterval,be as array,qe as base64,Te as basic,Fe as bearer,we as boolean,$t as decodeJson,Ke as defineApp,Ye as defineProvider,Qe as dynamicRouter,nt as dynamicSkills,Le as event,Ne as header,ve as json,Me as jsonSchema,Re as literal,Je as mutation,ge as number,Qt as oauth2,Ee as object,De as plain,Bt as query,Ie as raw,Ce as record,Be as renameTools,He as router,Ht as secrets,Oe as string,Pe as t,We as toolAnnotations,st as userCron,rt as userInterval,je as withApproval,$e as withApprovals,Ve as workflow};\n","node_modules/apps/client.js":"import{$ as Ie,a as q,aa as ne,ba as Te,ca as _e,da as Ue,ea as ue,g as Se,h as te,n as ke,o as Ee,r as xe,s as Oe,t as Ae,u as Z}from\"./chunk-3SCWQGZI.js\";import{a as R,b as Re,c as M,d as Le}from\"./chunk-IJBGBWKG.js\";import{Af as t,Hb as j,Jb as be,Mf as se,Nf as we,Qa as ae,Rb as H,Ug as ee,W as L,Yg as ve,Zg as he,fa as ge,gb as D,kd as e,nb as z,ob as C,zg as k}from\"./chunk-MN25OBZU.js\";import\"./chunk-WOT6VMZA.js\";var ce=t.NonEmptyString.check(t.isMaxLength(200)),N=class extends t.TaggedError()(\"AppQueryFailed\",{}){};var He=n=>({name:t.decodeUnknownSync(ce)(n),kind:\"query\"}),Be=n=>({name:t.decodeUnknownSync(ce)(n),kind:\"mutation\"}),ze=(n,l,a)=>M.make(k.unwrap(e.gen(function*(){let i=yield*t.decodeUnknownEffect(q)(l).pipe(e.mapError(()=>new N)),y=yield*e.tryPromise({try:()=>a.transport.subscribe({name:n.name,input:i}),catch:()=>new N});return k.fromAsyncIterable(y,()=>new N).pipe(k.mapEffect(E=>t.decodeUnknownEffect(Z(a.output))(E).pipe(e.mapError(()=>new N))))})));var F=t.Number.check(t.isFinite(),t.isGreaterThanOrEqualTo(0)),$e=t.Struct({name:t.String,startTime:F,duration:F,domainLookupStart:F,domainLookupEnd:F,connectStart:F,connectEnd:F,secureConnectionStart:F,requestStart:F,responseStart:F,responseEnd:F,deliveryType:t.optional(t.String),transferSize:t.optional(F),decodedBodySize:t.optional(F),serverTiming:t.Array(t.Struct({name:t.String,description:t.String,duration:F}))}),We=t.decodeUnknownOption($e),Ce=(n,l)=>{let a=We(n);if(L.isNone(a))return;let i=a.value;if(i.deliveryType===\"cache\"||i.transferSize===0&&i.decodedBodySize!==void 0&&i.decodedBodySize>0||!URL.canParse(i.name))return;let y=new URL(i.name);if(y.origin!==l||/\\/api\\/telemetry\\/(traces|logs)\\/?$/.test(y.pathname))return;let E=i.serverTiming.find(g=>g.name===\"executor-trace\")?.description;if(E===void 0||!/^[a-f0-9]{32}$/.test(E))return;let w={\"executor.trace_id\":E,\"browser.request.duration_ms\":i.duration},x=i.serverTiming.find(g=>g.name===\"executor-span\")?.description;x!==void 0&&/^(?!0{16}$)[a-f0-9]{16}$/.test(x)&&(w[\"executor.span_id\"]=x);let v=i.serverTiming.find(g=>g.name===\"executor-sampled\")?.description;(v===\"1\"||v===\"0\")&&(w[\"executor.trace_sampled\"]=Number(v));let O=i.serverTiming.find(g=>g.name===\"cf-ray\")?.description;O!==void 0&&/^[a-f0-9]{16,32}(?:-[A-Z]{3})?$/i.test(O)&&(w[\"cloudflare.ray_id\"]=O.replace(/-[A-Z]{3}$/i,\"\"));let I=(g,r,u)=>{r>0&&u>=r&&(w[`browser.request.${g}_ms`]=u-r)};I(\"dns\",i.domainLookupStart,i.domainLookupEnd),I(\"connection\",i.connectStart,i.connectEnd),I(\"tls\",i.secureConnectionStart,i.connectEnd),I(\"waiting_for_headers\",i.requestStart,i.responseStart),I(\"body\",i.responseStart,i.responseEnd),i.responseStart>0&&i.responseStart>=i.startTime&&(w[\"browser.request.time_to_first_byte_ms\"]=i.responseStart-i.startTime);let T=i.serverTiming.find(g=>g.name===\"executor\");return T!==void 0&&(w[\"executor.handler.duration_ms\"]=T.duration),w};var Ke=t.decodeUnknownOption(t.Struct({value:t.Number,hadRecentInput:t.Boolean})),Ge=t.decodeUnknownOption(t.Struct({interactionId:t.Number,processingStart:t.Number,processingEnd:t.Number})),Fe=104,Pe=e.gen(function*(){let n=window.performance;if(n===void 0||typeof PerformanceObserver>\"u\")return{flush:e.void,pause:e.void,resume:e.void,hide:e.void,restore:e.void,navigation:U=>e.void};let l=window.location.pathname,a=new Map,i=new Set,y=l,E=0,w=0,x=0,v=document.visibilityState!==\"hidden\",O=v?1/0:0,I=!0,T,g,r,u,o=!1,s=0,m,A=0,h=0,d=0,f={count:0,duration:0,blocking:0,max:0},c={count:0,duration:0,inputDelay:0,processing:0},b=yield*ee.makeRuntime(),$=(U,p)=>e.logInfo(U).pipe(e.annotateLogs(p),e.withSpan(U,{root:!0,attributes:p,links:Oe({traceId:p[\"executor.trace_id\"],spanId:p[\"executor.span_id\"],sampled:p[\"executor.trace_sampled\"]===void 0?void 0:p[\"executor.trace_sampled\"]===1},\"request-timing\")})),W=U=>{for(let p of U)if(!(p.startTime<x))switch(p.entryType){case\"resource\":{let S=Ce(p,window.location.origin);S!==void 0&&b($(\"ui.request.timing\",S));break}case\"paint\":p.name===\"first-contentful-paint\"&&p.startTime<O&&(T=p.startTime);break;case\"largest-contentful-paint\":!o&&p.startTime<O&&(g=p.startTime);break;case\"layout-shift\":{let S=Ke(p);if(!v||L.isNone(S)||S.value.hadRecentInput)break;let P=S.value.value;if(!Number.isFinite(P)||P<0)break;d>0&&p.startTime-h<1e3&&p.startTime-A<5e3?d+=P:(A=p.startTime,d=P),h=p.startTime,s=Math.max(s,d);break}case\"longtask\":v&&(f.count+=1,f.duration+=p.duration,f.blocking+=Math.max(0,p.duration-50),f.max=Math.max(f.max,p.duration));break;case\"event\":{let S=Ge(p);if(!v||L.isNone(S)||S.value.interactionId===0)break;c.count+=1,c.duration=Math.max(c.duration,p.duration),c.inputDelay=Math.max(c.inputDelay,S.value.processingStart-p.startTime),c.processing=Math.max(c.processing,S.value.processingEnd-S.value.processingStart);break}}},J=()=>{for(let U of a.values())W(U.takeRecords())},K=()=>{for(let U of a.values())U.disconnect();a.clear()},Y=U=>{for(let p of[\"paint\",\"largest-contentful-paint\",\"layout-shift\",\"longtask\",\"event\",\"resource\"]){if(!PerformanceObserver.supportedEntryTypes?.includes(p))continue;let S=new PerformanceObserver(P=>W(P.getEntries()));try{S.observe({type:p,buffered:U,...p===\"event\"?{durationThreshold:Fe}:{}}),i.add(p),a.set(p,S)}catch{S.disconnect()}}};Y(!0);let _=e.gen(function*(){J();let U={\"browser.page.time_origin_ms\":n.timeOrigin,\"browser.page.restore_count\":E},p=[],S=(B,je,Je)=>{p.push({name:\"ui.performance.vital\",attributes:{...U,\"url.path\":l,\"browser.vital.name\":B,\"browser.vital.value\":je,\"browser.vital.unit\":Je}})};T!==void 0&&T!==r&&(S(\"FCP\",T,\"ms\"),r=T),g!==void 0&&g!==u&&(S(\"LCP\",g,\"ms\"),u=g),i.has(\"layout-shift\")&&(T!==void 0||E>0)&&s!==m&&(S(\"CLS\",s,\"1\"),m=s);let P=n.now(),G={...U,\"url.path\":y,\"browser.observation.duration_ms\":P-w};f.count>0&&p.push({name:\"ui.performance.long-tasks\",attributes:{...G,\"browser.long_task.count\":f.count,\"browser.long_task.duration_ms\":f.duration,\"browser.long_task.blocking_ms\":f.blocking,\"browser.long_task.max_duration_ms\":f.max}}),c.count>0&&p.push({name:\"ui.performance.interactions\",attributes:{...G,\"browser.interaction.slow_event_count\":c.count,\"browser.interaction.max_duration_ms\":c.duration,\"browser.interaction.max_input_delay_ms\":c.inputDelay,\"browser.interaction.max_processing_ms\":c.processing,\"browser.interaction.duration_threshold_ms\":Fe}}),w=P,f={count:0,duration:0,blocking:0,max:0},c={count:0,duration:0,inputDelay:0,processing:0},yield*e.forEach(p,B=>$(B.name,B.attributes))}),V=()=>{J(),o=!0,a.get(\"largest-contentful-paint\")?.disconnect(),a.delete(\"largest-contentful-paint\")};return window.addEventListener(\"keydown\",V,{capture:!0}),window.addEventListener(\"pointerdown\",V,{capture:!0}),yield*e.addFinalizer(()=>_.pipe(e.ensuring(e.sync(()=>{K(),window.removeEventListener(\"keydown\",V,{capture:!0}),window.removeEventListener(\"pointerdown\",V,{capture:!0})})))),yield*$(\"ui.performance.support\",{\"browser.performance.paint\":i.has(\"paint\"),\"browser.performance.largest_contentful_paint\":i.has(\"largest-contentful-paint\"),\"browser.performance.layout_shift\":i.has(\"layout-shift\"),\"browser.performance.long_task\":i.has(\"longtask\"),\"browser.performance.event_timing\":i.has(\"event\")}),yield*_.pipe(e.repeat(H.spaced(\"30 seconds\")),e.forkScoped),{flush:_,pause:e.sync(()=>{J(),O=Math.min(O,n.now()),V(),v=!1}),resume:e.sync(()=>{J(),v=I,w=n.now()}),hide:e.sync(()=>{J(),I=!1,v=!1,K()}),restore:e.sync(()=>{K(),E+=1,x=n.now(),l=window.location.pathname,w=x,T=r=g=u=void 0,o=!1,s=A=h=d=0,m=void 0,I=!0,v=document.visibilityState!==\"hidden\",O=v?1/0:x,f={count:0,duration:0,blocking:0,max:0},c={count:0,duration:0,inputDelay:0,processing:0},Y(!1)}),navigation:U=>_.pipe(e.andThen(e.sync(()=>{y=U})))}});var pe=class extends ge.Service()(\"executor/BrowserTelemetry\"){},Ze=n=>j.unwrap(n.pipe(e.map(l=>j.effect(pe,e.gen(function*(){let a=yield*ke.Flusher,i=yield*ee.makeRuntime(),y,E=yield*Pe,w=E.flush.pipe(e.andThen(a.flush),e.timeoutOption(\"2 seconds\"),e.asVoid),x=(r,u)=>i(e.logError(D.die(u)).pipe(e.andThen(e.fail(u)),e.withSpan(r),e.ignore)),v=r=>x(\"ui.error\",r.error??new Error(r.message)),O=r=>x(\"ui.unhandled-rejection\",r.reason),I=()=>{y!==void 0&&document.visibilityState===\"hidden\"&&(y.hidden=!0),i(document.visibilityState===\"hidden\"?E.pause.pipe(e.andThen(w)):E.resume)},T=()=>{i(E.hide.pipe(e.andThen(w)))},g=r=>{r.persisted&&i(E.restore)};return window.addEventListener(\"error\",v),window.addEventListener(\"unhandledrejection\",O),window.addEventListener(\"pagehide\",T),window.addEventListener(\"pageshow\",g),document.addEventListener(\"visibilitychange\",I),yield*e.addFinalizer(()=>e.sync(()=>{window.removeEventListener(\"error\",v),window.removeEventListener(\"unhandledrejection\",O),window.removeEventListener(\"pagehide\",T),window.removeEventListener(\"pageshow\",g),document.removeEventListener(\"visibilitychange\",I)})),{flush:w,navigation:r=>e.sync(()=>{if(r.type===\"load\")return;if(r.type===\"end\"){y!==void 0&&C.doneUnsafe(y.done,e.void),y=void 0;return}y!==void 0&&C.doneUnsafe(y.done,e.interrupt);let u={done:C.makeUnsafe(),hidden:document.visibilityState===\"hidden\"};y=u,i(C.await(u.done).pipe(e.ensuring(e.suspend(()=>e.annotateCurrentSpan(\"executor.navigation.hidden\",u.hidden))),e.withSpan(\"ui.navigation\",{root:!0,attributes:{\"url.path\":r.path}}),e.ignore))}).pipe(e.andThen(r.type===\"end\"?e.void:E.navigation(r.path)))}})).pipe(j.provideMerge(Ee(l,\"process\",ve.consoleJson)),j.provide(j.succeed(te.RequestInit,{keepalive:!0,credentials:\"same-origin\"})))))),qe=n=>{let l=Ze(n),a=j.makeMemoMapUnsafe(),i=he.make(l,{memoMap:a}),y=M.context({memoMap:a});return y.addGlobalLayer(l),{runtime:i,atoms:y}},Me=(n,l)=>e.sync(()=>({service:l,clock:\"system\",version:document.querySelector('meta[name=\"executor-build\"]')?.content??\"development\",environment:document.querySelector('meta[name=\"executor-environment\"]')?.content??\"development\",traces:{url:new URL(`${n}/traces`,window.location.origin).href},logs:{url:new URL(`${n}/logs`,window.location.origin).href}}));var Ne=t.Struct({version:t.NonEmptyString,accounts:t.optional(t.Record(t.NonEmptyString,t.Array(t.NonEmptyString)))}),Qe=Ne.pipe(ue({version:\"deployment\"})),de=t.Struct({...Ne.fields,name:t.NonEmptyString,input:q}).pipe(ue({version:\"deployment\"})),le=class extends t.TaggedError()(\"UiUnauthorized\",{},{httpApiStatus:401}){},me=class extends t.TaggedError()(\"UiForbidden\",{},{httpApiStatus:403}){},X=class extends t.TaggedError()(\"UiDeploymentChanged\",{},{httpApiStatus:409}){},Q=class extends t.TaggedError()(\"UiFailed\",{reason:t.Literals([\"unavailable\",\"operation_failed\",\"account_required\"])},{httpApiStatus:422}){},Xe=t.Union([t.Struct({type:t.Literal(\"snapshot\"),value:q,trace:t.optional(t.Unknown)}),t.Struct({type:t.Literal(\"failure\"),error:Q}),t.Struct({type:t.Literal(\"heartbeat\")})]),re=[le,me,X,Q],Ve=Te.make(\"app-ui\").add(Ue.make(\"ui\").add(ne.post(\"query\",\"/_executor/api/query\",{payload:de,success:q,error:re})).add(ne.post(\"mutate\",\"/_executor/api/mutate\",{payload:de,success:q,error:re})).add(ne.post(\"subscribe\",\"/_executor/api/subscribe\",{payload:de,success:Ie.StreamSse({data:Xe,error:t.Union(re)}),error:re})));var ye=n=>Array.isArray(n)?n.map(ye):n!==null&&typeof n==\"object\"?Object.fromEntries(Object.entries(n).sort(([l],[a])=>l.localeCompare(a)).map(([l,a])=>[l,ye(a)])):n,fe=(n,l)=>JSON.stringify([n,ye(l)]),oe=t.decodeUnknownSync(q),De=n=>{let l=Re.make({defaultIdleTTL:0}),a=new Map,i=new Set,y=new Set,E=we.makeUnsafe(1),w=!1,x=!0,v=()=>{let r=new Map([...a].map(([o,s])=>[o,L.getOrUndefined(R.value(s.base))])),u=new Set;for(let o of i){let s=new Map(r),m=new Set,A={getQuery:(h,d)=>structuredClone(s.get(fe(h.name,oe(d)))),getAllQueries:h=>[...a].filter(([,d])=>d.name===h.name).map(([d,f])=>({input:structuredClone(f.input),value:structuredClone(s.get(d))})),setQuery:(h,d,f)=>{let c=fe(h.name,oe(d)),b=a.get(c);b!==void 0&&(s.set(c,structuredClone(b.schema.parse(f))),m.add(c))}};try{if(o.project(A)!==void 0)throw new Error(\"Optimistic updates must be synchronous and return nothing.\");r=s;for(let d of m)u.add(d)}catch(h){o.invalid=!0,i.delete(o),o.sent||C.doneUnsafe(o.result,e.fail(h)),n.reportProjectionError({operationId:o.operationId,name:o.name,sent:o.sent})}}M.batch(()=>{for(let[o,s]of a)l.set(s.visible,u.has(o)?R.isInitial(s.base)?R.success(r.get(o)):R.map(s.base,()=>r.get(o)):s.base)})},O=r=>{r.generation++,r.stop?.(),r.stop=void 0},I=r=>{O(r);let u=r.generation;r.stop=l.subscribe(n.source(r.name,r.input,r.schema),o=>{w||u!==r.generation||!x||R.isInitial(o)||(r.base=o,v())},{immediate:!0})},T=e.gen(function*(){for(let r of a.values())r.staged=void 0;for(;!w;){let r=[...a.values()].filter(u=>u.staged===void 0);if(r.length===0)break;yield*e.forEach(r,u=>e.gen(function*(){yield*e.raceFirst(e.gen(function*(){let o=yield*e.exit(n.read(u.name,u.input,u.schema).pipe(e.timeout(\"30 seconds\")));u.staged=z.isSuccess(o)?R.success(o.value):R.failureWithPrevious(o.cause,{previous:L.some(u.base)})}),C.await(u.released))}),{concurrency:\"unbounded\",discard:!0})}for(let r of a.values())r.staged!==void 0&&(r.base=r.staged),r.staged=void 0}),g=(r,u,o)=>Object.assign(m=>{if(w)return Promise.reject(new Error(\"App client is disposed.\"));let A,h;try{A=structuredClone(oe(m)),h=structuredClone(m)}catch(c){return Promise.reject(c)}let d=C.makeUnsafe(),f={operationId:crypto.randomUUID(),name:r.name,project:c=>o?.(c,structuredClone(h)),result:d,sent:!1,invalid:!1};return y.add(d),i.add(f),v(),n.fork(E.withPermits(1)(e.gen(function*(){if(w||f.invalid)return;x=!1;for(let b of a.values())O(b);f.sent=!0;let c=yield*e.exit(n.write(r.name,A,u).pipe(e.annotateSpans(\"executor.operation.id\",f.operationId)));C.doneUnsafe(d,c),y.delete(d),z.isFailure(c)&&(i.delete(f),v()),yield*T,i.delete(f),x=!0,v();for(let b of a.values())I(b)})).pipe(e.ensuring(e.sync(()=>{y.delete(d),i.delete(f)})),e.ignore)),n.run(C.await(d)).then(c=>u.parse(c))},{withOptimisticUpdate:m=>g(r,u,m)});return{mutation:(r,u)=>g(r,u),queryAtom:(r,u,o)=>{let s=structuredClone(oe(u)),m=fe(r.name,s);return M.readable(A=>{if(w)return R.failure(D.fail(new Error(\"App client is disposed.\")));let h=a.get(m);h===void 0&&(h={name:r.name,input:s,schema:o,visible:M.make(R.initial()),base:R.initial(),staged:void 0,stop:void 0,generation:0,subscribers:0,released:C.makeUnsafe()},a.set(m,h),x&&I(h),v());let d=h;d.subscribers++;let f=b=>b,c=l.subscribe(d.visible,b=>A.setSelf(f(b)));return A.addFinalizer(()=>{c(),d.subscribers--,d.subscribers===0&&(O(d),a.delete(m),C.doneUnsafe(d.released,e.void))}),f(l.get(d.visible))}).pipe(M.setIdleTTL(0))},dispose:()=>{w=!0;for(let r of a.values())O(r);for(let r of y)C.doneUnsafe(r,e.fail(new Error(\"App client is disposed.\")));a.clear(),i.clear(),y.clear(),l.dispose()}}};var Ye=H.min([H.exponential(\"1 second\"),H.spaced(\"1 minute\")]).pipe(H.jittered),et=n=>t.is(Q)(n)&&n.reason===\"operation_failed\",tt=n=>Se.isHttpClientError(n)||D.isTimeoutError(n)||t.is(Q)(n)&&n.reason!==\"account_required\",ie=class{constructor(l,a){this.error=l;this.previous=a}error;previous},nt=n=>{let l=R.value(n);if(L.isNone(l)||!(l.value instanceof ie))return n;let a=L.map(L.fromUndefinedOr(l.value.previous),R.success);return R.isSuccess(n)?R.failureWithPrevious(D.fail(l.value.error),{previous:a,waiting:!0}):R.failureWithPrevious(R.isFailure(n)?n.cause:D.empty,{previous:a})},rt=()=>{let{runtime:n,atoms:l}=qe(Me(\"/_executor/api/telemetry\",\"executor-app-web\")),a=l(j.empty),i=e.sync(()=>{window.dispatchEvent(new Event(\"executor:deployment-changed\"))}),y=0,E=o=>{o.preventDefault(),o.returnValue=\"\"},w=o=>(y++===0&&window.addEventListener(\"beforeunload\",E),n.runPromise(o).finally(()=>{--y===0&&window.removeEventListener(\"beforeunload\",E)})),x=o=>{o.persisted||v().catch(s=>console.error(s))},v=async()=>{window.removeEventListener(\"pagehide\",x),window.removeEventListener(\"beforeunload\",E),u.dispose(),await n.dispose()};window.addEventListener(\"pagehide\",x),n.runFork(e.void);let O=e.try({try:()=>document.getElementById(\"executor-context\")?.textContent,catch:()=>new Q({reason:\"unavailable\"})}).pipe(e.flatMap(t.decodeUnknownEffect(t.fromJsonString(Qe)))),I=_e.make(Ve).pipe(e.provide(te.layer)),T=(o,s)=>e.gen(function*(){return{...yield*O,name:o,input:yield*t.decodeUnknownEffect(q)(s)}}),g=(o,s,m,A)=>e.gen(function*(){let d=yield*(yield*I).ui[o]({payload:yield*T(s,m)});return yield*t.decodeUnknownEffect(Z(A))(d)}).pipe(e.tapErrorTag(\"UiDeploymentChanged\",()=>i),e.withSpan(`ui.app.${o}`,{attributes:{\"executor.operation.name\":s}})),u=De({source:(o,s,m)=>a.atom(k.suspend(()=>{let A,h=0,d,f=k.unwrap(e.gen(function*(){let c=h++,b=yield*Ae(\"ui.app.first_result\",{attributes:{\"executor.operation.name\":o,\"executor.subscription.attempt\":c},links:A===void 0?[]:[{span:A,attributes:{\"executor.link.kind\":\"retry\"}}]});A=ae.externalSpan({traceId:b.span.traceId,spanId:b.span.spanId,sampled:b.span.sampled});let $=_=>b.finish(_).pipe(e.andThen(z.isFailure(_)&&!D.hasInterrupts(_.cause)?e.fail(new N).pipe(e.withSpan(\"ui.app.subscription.failure\",{parent:b.span,attributes:{\"executor.operation.name\":o,\"executor.subscription.attempt\":c}}),e.ignore):e.void)),W=yield*be.Clock,J=W.currentTimeMillisUnsafe(),K=yield*e.gen(function*(){return yield*(yield*I).ui.subscribe({payload:yield*T(o,s)})}).pipe(e.withSpan(\"ui.app.subscribe\",{parent:b.span,attributes:{\"executor.operation.name\":o}}),e.onError(_=>$(z.failCause(_)))),Y=0;return K.pipe(k.timeout(\"45 seconds\"),k.concat(k.fail(new Q({reason:\"unavailable\"}))),k.filter(_=>_.type!==\"heartbeat\"),k.mapEffect(_=>{if(_.type===\"failure\")return e.fail(_.error);let V=xe(_.trace);return e.gen(function*(){let U=yield*t.decodeUnknownEffect(Z(m))(_.value).pipe(e.mapError(()=>new N)),p=yield*e.currentSpan,S=W.currentTimeMillisUnsafe(),P=Y++;yield*e.annotateCurrentSpan({\"executor.operation.name\":o,\"executor.snapshot.revision\":P,\"browser.query.elapsed_ms\":S-J,\"executor.trace.context_valid\":L.isSome(V)}),yield*b.finish(z.void);let G=!1;return{value:U,commit:()=>{if(G)return;G=!0;let B=W.currentTimeMillisUnsafe();n.runFork(e.void.pipe(e.withSpan(\"ui.app.result.commit\",{parent:p,attributes:{\"executor.operation.name\":o,\"executor.snapshot.revision\":P,\"browser.query.elapsed_ms\":B-J,\"browser.query.receive_to_commit_ms\":B-S,\"browser.page.hidden\":document.visibilityState===\"hidden\"}})))}}}).pipe(e.withSpan(\"ui.app.result.receive\",{parent:L.isSome(V)?V.value:b.span,kind:\"consumer\"}))}),k.onExit($),k.provideService(ae.ParentSpan,b.span))})).pipe(k.catch(c=>t.is(X)(c)?k.unwrap(i.pipe(e.as(k.never))):k.fail(c)),k.tap(c=>e.sync(()=>{d=c})));return k.unwrap(e.gen(function*(){let c=yield*se.unbounded();return k.merge(f.pipe(k.retry(Ye.pipe(H.while(({input:b})=>tt(b)?et(b)?se.offer(c,new ie(b,d)).pipe(e.as(!0)):!0:!1)))),k.fromQueue(c),{haltStrategy:\"left\"})}))})).pipe(M.map(A=>Le(nt(A)))),read:(o,s,m)=>g(\"query\",o,s,m),write:(o,s,m)=>g(\"mutate\",o,s,m),fork:o=>{n.runFork(o)},run:w,reportProjectionError:({operationId:o,name:s,sent:m})=>{n.runFork(e.fail(new Q({reason:\"operation_failed\"})).pipe(e.withSpan(\"ui.optimistic.failure\",{attributes:{\"executor.operation.id\":o,\"executor.operation.name\":s,\"executor.optimistic.sent\":m}}),e.ignore))}});return{dispose:v,query:(o,s,m)=>n.runPromise(g(\"query\",o.name,s,m)),mutate:(o,s,m)=>u.mutation(o,m)(s),mutation:u.mutation,queryAtom:u.queryAtom}};export{N as AppQueryFailed,rt as createAppClient,ze as liveQueryAtom,Be as mutationReference,He as queryReference};\n","node_modules/apps/effect.js":"import{$ as Be,$a as ro,A as Ee,Aa as bt,B as hn,Ba as Bn,C as Je,Ca as Vn,D as yn,Da as Gn,E as te,F as An,Ha as Xn,Ia as zn,Ja as Yn,Ka as Qn,La as vt,Ma as Zn,N as On,Na as eo,Oa as He,P as xn,Pa as Ne,Qa as j,Ra as Xe,Sa as ze,Ta as to,U as Tn,Ua as no,V as Rn,Va as Ye,W as be,Wa as D,X as Cn,Xa as ye,Y as Mn,Ya as se,Z as $n,Za as Qe,_ as ve,_a as oo,a as De,aa as Un,ab as F,b as Xt,ba as In,bb as io,c as zt,ca as Fn,cb as ao,d as Yt,da as $e,db as so,e as Qt,ea as Hn,eb as ne,f as Zt,fa as Nn,fb as At,ga as Ve,gb as co,h as tn,ha as St,hb as lo,i as nn,ia as qn,ib as po,j as on,ja as Et,jb as uo,k as rn,ka as jn,l as an,la as kt,m as sn,ma as C,mb as fo,n as We,na as Pn,o as B,oa as Ue,p as V,pa as _n,pb as Ze,q as cn,qa as Ln,qb as mo,r as dn,ra as Ie,rb as ho,s as ln,sa as Fe,ta as Dn,ua as Wn,va as de,wa as Jn,wb as yo,xa as hr,xb as go,y as gt,ya as Ge,yb as wo,za as Kn,zb as So}from\"./chunk-5TGEXQYL.js\";import{L as gn,P as Ke,Q as wn,R as Me,S as Sn,T as En,U as kn,V as bn,W as vn,X as mr,Y as wt,_ as fe,a as J,b as K,c as en,d as yt,f as ur,i as pn,j as ue,k as un,l as fn,p as ke,q as mn,u as Ce,z as fr}from\"./chunk-3SCWQGZI.js\";import{Af as r,Ea as Re,Fd as he,Jb as pe,W as q,_g as A,be as ce,gb as I,kd as o,la as Vt,nb as Gt,o as Se,pd as mt,se as U,zg as ht}from\"./chunk-MN25OBZU.js\";import\"./chunk-WOT6VMZA.js\";var Ot=r.Literals([\"approved\",\"denied\",\"user-approval\"]);var xt=(e,t={})=>o.gen(function*(){let n=`${t.directory===void 0?\"\":`${t.directory}/`}SKILL.md`,i=h=>new $e({file:n,reason:h}),a=yield*r.decodeUnknownEffect(r.Array(ve))(e).pipe(o.mapError(()=>i(\"files\"))),s=a.find(h=>h.path===\"SKILL.md\");if(s===void 0)return yield*i(\"missing-document\");let c=/^\\uFEFF?---[ \\t]*\\r?\\n([\\s\\S]*?)\\r?\\n---(?:[ \\t]*\\r?\\n|[ \\t]*$)/.exec(s.content);if(c?.[1]===void 0)return yield*i(\"frontmatter\");let p=c[1],{parseDocument:g}=(yield*o.promise(()=>import(\"./browser-IVZC54ZA.js\"))).default,m=yield*o.try({try:()=>{let h=g(p);if(h.errors.length)throw h.errors[0];return h.toJS()},catch:()=>i(\"frontmatter\")}),d=yield*r.decodeUnknownEffect(In)(m).pipe(o.mapError(()=>i(\"metadata\")));return t.name!==void 0&&d.name!==t.name?yield*i(\"name-mismatch\"):yield*r.decodeUnknownEffect(Fn)({...d,files:a}).pipe(o.mapError(()=>i(\"files\")))}),Eo=e=>o.gen(function*(){let t=e.path??\"skills\";if(!r.is($n)(t))return yield*new $e({file:\"SKILL.md\",reason:\"directory\"});let n=yield*r.decodeUnknownEffect(r.Array(ve))(e.files).pipe(o.mapError(()=>new $e({file:t,reason:\"files\"}))),i=`${t}/`,a=new Map;for(let s of n){if(!s.path.startsWith(i))continue;let[c,...p]=s.path.slice(i.length).split(\"/\");if(p.length===0)continue;if(c===void 0||!r.is(Un)(c))return yield*new $e({file:s.path,reason:\"directory\"});let g={path:p.join(\"/\"),content:s.content},m=a.get(c);m===void 0?a.set(c,[g]):m.push(g)}return yield*o.forEach([...a].sort(([s],[c])=>s.localeCompare(c)),([s,c])=>xt(c.sort((p,g)=>p.path.localeCompare(g.path)),{name:s,directory:`${t}/${s}`}))});var yr=r.Struct({code:Ve.fields.code,status:Ve.fields.status,message:r.Union([r.Struct({source:r.Literal(\"body\")}),r.Struct({source:r.Literal(\"schema\"),value:Ve.fields.message})]),schema:K}),gr=r.Struct({name:r.String,in:r.Literals([\"path\",\"query\",\"querystring\",\"header\",\"cookie\"]),required:r.optionalKey(r.Boolean),schema:r.optionalKey(K),style:r.optionalKey(r.String),explode:r.optionalKey(r.Boolean),allowReserved:r.optionalKey(r.Boolean),allowEmptyValue:r.optionalKey(r.Boolean),content:r.optionalKey(K)}),wr=r.Struct({required:r.optionalKey(r.Boolean),content:r.Record(r.String,r.Struct({schema:r.optionalKey(K),encoding:r.optionalKey(K)}))}),ko=r.Struct({name:r.NonEmptyString,operationId:r.optionalKey(r.String),description:r.String,method:r.Literals([\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"OPTIONS\",\"QUERY\"]),path:r.String,baseUrl:yt,openapi:r.String,securitySchemes:r.Record(r.String,K),request:r.Struct({parameters:r.Array(gr),requestBody:r.optionalKey(wr),security:r.Array(r.Record(r.String,r.Array(r.String))),responses:r.Record(r.String,K)}),streaming:r.optionalKey(r.Literal(!0)),tags:r.optionalKey(r.Array(r.NonEmptyString)),input:K,outputSchema:r.optionalKey(K),errorResponses:r.optionalKey(r.Array(yr))});var Sr=r.Struct({scheme:r.String,field:r.String,part:r.Literals([\"value\",\"username\",\"password\"]),prefix:r.String}),Er=r.Struct({id:r.optional(en),method:r.String,fields:r.Record(r.String,r.Unknown)}),kr=r.Struct({path:r.optionalKey(r.Record(r.String,r.String)),query:r.optionalKey(r.Record(r.String,r.String)),headers:r.optionalKey(r.Record(r.String,r.String))}),Pi=r.Struct({operations:r.Array(ko),definitions:r.optional(r.Record(r.String,K)),methods:r.Record(r.String,r.Array(Sr)),oauth:r.Array(r.String),account:r.optional(Er),parameterDefaults:r.optional(kr),signal:r.optional(r.instanceOf(AbortSignal)),fetch:r.optional(r.declare(e=>typeof e==\"function\"))}),br=r.Struct({method:ko.fields.method,path:r.String}),vr=r.String.check(r.isMaxLength(128),r.isPattern(/^[\\w!#$&^.+-]+\\/[\\w!#$&^.+-]+$/u)),et=class extends r.TaggedError()(\"OpenapiError\",{reason:r.Literals([\"invalid_definition\",\"invalid_input\",\"request\"]),status:r.optional(r.Number),operation:r.optional(br),contentType:r.optional(vr),bytes:r.optional(r.Int.check(r.isGreaterThanOrEqualTo(0)))}){};var vo=r.Literals([\"server_protocol\",\"server_url\",\"external_reference\",\"circular_reference\",\"schema_keyword\",\"schema_reference\",\"missing_component\",\"openapi_version\",\"auth_helper\",\"auth_missing\",\"operation_path\",\"operation_method\",\"duplicate_operation\",\"server_missing\",\"multiple_hosts\",\"parameter_encoding\",\"parameter_style\",\"request_body\",\"combined_oauth\",\"auth_method\",\"event_stream\",\"input_schema\",\"no_operations\",\"no_supported_operations\",\"invalid_document\",\"source_generation\",\"authoring_reference\"]),Ao=r.Struct({name:r.String,method:r.String,path:r.String,code:vo,reason:r.String}),Ar=8,bo=240,Or=e=>e.length<=bo?e:`${e.slice(0,bo-1)}\\u2026`,xr=`To call a left-out operation anyway, write a custom tool for it in this app with the same account: see \"Custom tools beside generated ones\" in the app-authoring skill's integrations.md.`,Tr=e=>{let t=e.skipped??[];if(t.length===0)return e.reason;let n=t.some(({code:d})=>d!==\"event_stream\")?` ${xr}`:\"\",i=new Map;for(let d of t){let h=JSON.stringify([d.code,d.reason]),f=i.get(h);f===void 0?i.set(h,{first:d,count:1}):f.count++}let a=({first:d,count:h})=>`${d.method} ${d.path}${h>1?` and ${h-1} more`:\"\"}`,[s,...c]=i.values();if(s!==void 0&&c.length===0&&s.first.code===e.code&&s.first.reason===e.reason)return`${e.reason} Left out: ${a(s)}.${n}`;let p=[],g=De-`${e.reason} Left out: ; and ${i.size} other reasons.${n}`.length;for(let d of i.values()){let h=`${a(d)} (${d.first.code}: ${Or(d.first.reason.replace(/\\.$/,\"\"))})`;if(p.length===Ar||h.length+2>g)break;p.push(h),g-=h.length+2}let m=i.size-p.length;return`${e.reason} Left out: ${p.join(\"; \")}${m>0?`; and ${m} other reasons`:\"\"}.${n}`},tt=class extends r.TaggedError()(\"OpenapiCompileError\",{code:vo,reason:r.String,skipped:r.optionalKey(r.Array(Ao)),origins:r.optionalKey(r.Array(r.String))}){get message(){return Tr(this)}},Rr=r.Struct({name:r.String,method:r.String,path:r.String,operationId:r.optionalKey(r.String),kind:r.Literals([\"query\",\"mutation\"]),public:r.Boolean,methods:r.Array(r.String)}),Wi=r.Struct({tools:r.Array(Rr),skipped:r.Array(Ao)});var Cr={capacity:\"A cache key, value or batch exceeded the app cache's size limits.\",invalid:\"The app made a cache request the app cache could not accept.\",unavailable:\"The app cache was not available for this operation.\",storage:\"The app cache failed to complete the operation.\",timeout:\"The app cache did not respond in time.\"},Ae=e=>e.toLocaleString(\"en-US\"),Mr={keyBytes:`A cache key exceeded the app cache's limit of ${Ae(V.keyBytes)} bytes per key.`,entryBytes:`A cache value exceeded the app cache's limit of ${Ae(V.entryBytes)} bytes per entry.`,batchBytes:`A cache read or write exceeded the app cache's limit of ${Ae(V.batchBytes)} bytes per batch.`,batchEntries:`A cache read or write exceeded the app cache's limit of ${Ae(V.batchEntries)} entries per batch.`,totalBytes:`The app cache is full: it holds at most ${Ae(V.totalBytes)} bytes.`,totalEntries:`The app cache is full: it holds at most ${Ae(V.totalEntries)} entries.`},$r={connect:\"connecting\",transport:\"connecting\",discover:\"listing its tools\",schema:\"reading a tool's schema\",call:\"calling a tool\"},Oo=({phase:e,reason:t,status:n})=>{let i=$r[e];return A.value(t).pipe(A.when(\"timeout\",()=>`The MCP server did not respond in time while ${i}.`),A.when(\"unauthorized\",()=>`The MCP server rejected the credentials while ${i}.`),A.when(\"invalid_response\",()=>`The MCP server returned a response Executor could not use while ${i}, such as an unreadable message or an address on another origin.`),A.when(\"invalid_input\",()=>\"The MCP server URL or connection settings are invalid.\"),A.when(\"request\",()=>n!==void 0?`The MCP server answered HTTP ${n} while ${i}.`:e===\"transport\"?`Executor could not reach the MCP server while ${i}.`:`The request to the MCP server failed while ${i}.`),A.exhaustive)},Ur=({anonymous:e})=>e===\"answered\"?\"This MCP server answers without credentials, so Executor can't check this account. A refused key will show up when a tool is called.\":`The MCP server accepted the credentials, but the same check without them failed, so Executor can't tell whether it requires them. ${r.is(Ge)(e)?Oo(e):e.status===void 0?\"The MCP server could not answer the request.\":`The MCP server answered HTTP ${e.status}.`}`,Ir=6,Tt=(e,t)=>{if(typeof e==\"string\")e.length>=Ir&&t.add(e);else if(Array.isArray(e))for(let n of e)Tt(n,t);else if(Se.isObject(e))for(let n of Object.values(e))Tt(n,t);return t},Fr=e=>{let t=new Set;if(Se.isObject(e)){for(let n of[e.app,e.user])if(Se.isObject(n))for(let i of Object.values(n))for(let a of Array.isArray(i)?i:[i])Se.hasProperty(a,\"fields\")&&Tt(a.fields,t)}return[...t].sort((n,i)=>i.length-n.length)},qe=e=>Fr(he.value(e)),Rt=(e,t)=>{let n=e;for(let i of t)n=n.split(i).join(\"[redacted]\");return n},xo=(e,t)=>e.length<=t?e:`${e.slice(0,t-1)}\\u2026`,Ct=(e,t,n)=>xo(Rt(e,t),n),Hr=(e,t)=>{let n=0;for(let i of t)for(let a=Math.min(i.length-1,e.length);a>n;a--)if(e.endsWith(i.slice(0,a))){n=a;break}return n===0?e:`${e.slice(0,-n)}[redacted]`},me=(e,t)=>Ct(e,t,De),To=(e,t)=>{if(e?.message===void 0)return e;let n=Tn(e.message)?`${Hr(Rt(e.message.slice(0,-1),t),t)}\\u2026`:Rt(e.message,t);return{code:e.code,message:xo(n,Zt)}},Oe=(e,t,n)=>Rn({...e,phase:e.phase??n,upstream:To(e.upstream,t)}),je=(e,t)=>r.decodeUnknownOption(Ge)(e).pipe(q.map(({phase:n,reason:i,status:a,upstream:s,session:c})=>{let p=To(s,t);return new Xn({phase:n,reason:i,...a===void 0?{}:{status:a},...p===void 0?{}:{upstream:p},...c===void 0?{}:{session:c}})})),ot=e=>r.decodeUnknownOption(Nn)(e).pipe(q.map(({reason:t,message:n,status:i,missing:a})=>new zn({reason:t,...n?{message:n}:{},...i===void 0?{}:{status:i},...a===void 0?{}:{missing:a}}))),nt=e=>(e.name.length>0?e.name:\"Error\").slice(0,128),Nr=(e,t)=>Se.hasProperty(e,\"code\")&&r.is(Xt)(e.code)&&e.code!==\"\"?Ct(e.code,t,128):void 0,qr=new Set([\"name\",\"message\",\"stack\",\"cause\",\"_tag\"]),jr=(e,t,n)=>{let i={},a=0;for(let[s,c]of Object.entries(e)){if(a===zt)break;if(!(qr.has(s)||s===\"code\"&&t!==void 0)&&r.is(Qt)(s)){if(typeof c==\"string\")i[s]=Ct(c,n,Yt);else if(typeof c==\"boolean\"||typeof c==\"number\"&&Number.isFinite(c))i[s]=c;else continue;a++}}return a===0?void 0:i},Ro=e=>{let t=e.cause,n=t instanceof Error&&t.message.length>0?` (caused by ${nt(t)}: ${t.message})`:\"\";return e.message.length>0?`${e.message}${n}`:void 0},Co=e=>e instanceof Error?`${nt(e)}: ${Ro(e)??\"(no message)\"}`:typeof e==\"string\"?e:`A non-Error ${e===null?\"null\":typeof e} value was thrown`,Pr=e=>{let t=e.operation===void 0?\"The API request\":`${e.operation.method} ${e.operation.path}`;if(e.reason===\"invalid_definition\")return\"The API's OpenAPI definition for this operation is invalid.\";if(e.reason===\"invalid_input\")return e.operation===void 0?\"The input could not be encoded as a request for this API operation.\":`The input could not be encoded as a request for ${t}.`;if(e.status===void 0)return`${t} failed before a response arrived.`;let n=[e.contentType,e.bytes===void 0?void 0:`${e.bytes} bytes`].filter(a=>a!==void 0).join(\", \"),i=`${t} responded with HTTP ${e.status}${n===\"\"?\"\":` (${n})`}`;return e.status>=200&&e.status<300?`${i}, but its body could not be read within the response limits.`:`${i}, which matches no error with a message in the API's OpenAPI document.`},oe=(e,t)=>{if(r.is(B)(e))return{source:\"storage\",errorName:\"CacheError\",code:e.reason,message:e.limit===void 0?Cr[e.reason]:Mr[e.limit]};if(r.is(et)(e))return{source:\"service\",errorName:\"OpenapiError\",code:e.reason,message:me(Pr(e),t)};if(r.is(Ge)(e))return{source:\"service\",errorName:\"McpError\",code:e.reason,message:Oo(e)};if(r.is(Kn)(e))return{source:\"service\",errorName:\"McpCredentialsUnverified\",code:e.anonymous===\"answered\"?\"anonymous_access\":e.anonymous.reason,message:Ur(e)};if(r.is(tt)(e))return{source:\"app\",errorName:\"OpenapiCompileError\",code:e.code,message:me(e.message,t)};if(r.is(tn)(e))return{source:\"app\",errorName:\"NetworkRefused\",code:e.refusal.reason,message:me(e.message,t)};if(r.is(We)(e))return{source:\"app\",errorName:\"FetchOptionUnsupported\",code:e.option,message:me(e.message,t)};if(e instanceof Error){let n=Nr(e,t),i=jr(e,n,t);return{source:\"app\",errorName:nt(e),...n===void 0?{}:{code:n},message:me(Ro(e)??`${nt(e)} was thrown without a message.`,t),...i===void 0?{}:{fields:i}}}return typeof e==\"string\"?{source:\"app\",errorName:\"string\",message:me(e,t)}:{source:\"app\",errorName:typeof e,message:`A non-Error ${e===null?\"null\":typeof e} value was thrown.`}};var Mt=(e,t)=>e.pipe(o.catchCause(n=>{if(I.hasInterrupts(n))return o.interrupt;let i=I.squash(n);if(r.is(C)(i))return o.fail(i);let{errorName:a,message:s}=oe(i,t);return o.fail(new C({reason:\"execution\",retryable:!(i instanceof Pn),...a===void 0?{}:{errorName:a},...s===void 0?{}:{message:s}}))})),Mo=e=>t=>t.step===void 0?new C({reason:t.reason,retryable:t.retryable,step:e.slice(0,200),...t.errorName===void 0?{}:{errorName:t.errorName},...t.message.length===0?{}:{message:t.message}}):t,$o=(e,t,n,i)=>o.gen(function*(){let a=yield*o.context(),s=new Map,c=(f,l)=>o.gen(function*(){yield*r.decodeUnknownEffect(qn)(l).pipe(o.mapError(()=>new C({reason:\"input\",retryable:!1})));let E=JSON.stringify([f,l]),u=(s.get(E)??0)+1;s.set(E,u);let k=yield*o.tryPromise({try:()=>crypto.subtle.digest(\"SHA-256\",new TextEncoder().encode(JSON.stringify([e.runId,f,l,u]))),catch:()=>new C({reason:\"execution\",retryable:!1})});return Array.from(new Uint8Array(k),y=>y.toString(16).padStart(2,\"0\")).join(\"\")}),p=(f,l)=>{let E=Et(f.timeout??\"10 minutes\");return E===void 0?o.fail(new C({reason:\"input\",retryable:!1})):l.pipe(o.timeout(E),o.catchTag(\"TimeoutError\",()=>o.fail(new C({reason:\"engine\",retryable:!0}))))},g=(f,l,E)=>o.gen(function*(){let u=yield*c(\"do\",f),k=yield*r.decodeUnknownEffect(kt)(l).pipe(o.mapError(()=>new C({reason:\"input\",retryable:!1})));return yield*e.driver.do(`do:${f.slice(0,100)}:${u}`,k,()=>p(k,o.scoped(o.gen(function*(){let y=yield*o.acquireRelease(o.sync(()=>new AbortController),M=>o.sync(()=>M.abort())),w=yield*n(u,AbortSignal.any([i,y.signal])),T=yield*Mt(Je(E,\"step\")(w.context),w.secrets);return yield*r.decodeUnknownEffect(Ue)(T).pipe(o.mapError(()=>new C({reason:\"output\",retryable:!1,message:\"The step returned a value that is not JSON, such as undefined, or is larger than 1 MiB. Return null for no result.\"})))})).pipe(o.provideContext(a)))).pipe(o.mapError(Mo(f)))}),m=(f,l,E,u,k)=>o.gen(function*(){let y=xn(E),w=t.tools?.kind===\"router\"?t.tools:void 0,T=ho(w).find(b=>b.operation===y&&b.operation.kind===f);if(y===void 0||T===void 0)return yield*new C({reason:\"operation\",retryable:!1});let M=yield*r.decodeUnknownEffect(J)(u).pipe(o.mapError(()=>new C({reason:\"input\",retryable:!1}))),P=yield*r.decodeUnknownEffect(kt)(k).pipe(o.mapError(()=>new C({reason:\"input\",retryable:!1}))),L=yield*c(f,l),$=Et(P.timeout??\"10 minutes\");return $===void 0?yield*new C({reason:\"input\",retryable:!1}):yield*e.driver.do(`${f}:${l.slice(0,100)}:${L}`,P,()=>p(P,e.invoke({kind:f,name:T.name,input:M,stepId:L,timeout:$}).pipe(o.provideContext(a)))).pipe(o.mapError(Mo(l)))}),d=f=>te(()=>f.pipe(o.provideContext(a)),i)(),h={do:(f,l,E)=>{let u=typeof l==\"function\"?l:E;return u===void 0?Promise.reject(new C({reason:\"input\",retryable:!1})):d(g(f,typeof l==\"function\"?{}:l,u))},runQuery:(f,l,E,u={})=>d(m(\"query\",f,l,E,u)),runMutation:(f,l,E,u={})=>d(m(\"mutation\",f,l,E,u)),sleep:(f,l)=>d(r.decodeUnknownEffect(jn)(l).pipe(o.mapError(()=>new C({reason:\"input\",retryable:!1})),o.flatMap(E=>c(\"sleep\",f).pipe(o.flatMap(u=>e.driver.sleep(`sleep:${f.slice(0,100)}:${u}`,E)))))),sleepUntil:(f,l)=>d(c(\"until\",f).pipe(o.flatMap(E=>e.driver.sleepUntil(`until:${f.slice(0,100)}:${E}`,l instanceof Date?l.getTime():l))))};return{runId:e.runId,step:h}});var _r=(e,t)=>e===nn&&t!==null&&t!==void 0?t:void 0;var Lr=e=>{for(let t of an.literals){let n=e?.[t],i=sn[t];if(n!==void 0&&!i.includes(n))return new We({option:t,value:String(n),supported:i})}},Dr=e=>async(t,n)=>{let i=Lr(n);if(i!==void 0)throw i;let a=await e(t,n),s=_r(a.status,a.headers.get(on));if(s===void 0)return a;throw await a.body?.cancel(),r.decodeUnknownSync(rn)(s)},ge=e=>mn(e).pipe(o.map(Dr));var Uo=\"app.elicitation.wait\",Io=\"app.workflow.control\",Fo=e=>t=>o.gen(function*(){let n=yield*uo;return yield*t.pipe(un(`app.${e}`,{},i=>{let a=fn(i,\"executor\");return{around:a.observe,end:(s,c)=>{let p=a.read(s);n({elapsedMs:Number(s-i)/1e6,upstreamMs:p.upstream,elicitationMs:p.person,authoredMs:p.app,leaseMs:p.lease,backgroundMs:p.background}),c.attribute(\"executor.upstream.wait_ms\",p.upstream),c.attribute(\"executor.elicitation.wait_ms\",p.person),c.attribute(\"executor.authored_ms\",p.app),c.attribute(\"executor.lease.wait_ms\",p.lease),c.attribute(\"executor.background_ms\",p.background),c.attribute(\"executor.overhead_ms\",p.executor)}}}))});var Ho=e=>o.gen(function*(){let t=yield*r.decodeUnknownEffect(Dn)(e,{onExcessProperty:\"error\"}).pipe(o.mapError(()=>new de({reason:\"invalid-request\"}))),n=yield*wt(t.requestedSchema).pipe(o.mapError(()=>new de({reason:\"invalid-request\"})));return{request:t,respond:a=>o.gen(function*(){let s=yield*r.decodeUnknownEffect(Wn)(a).pipe(o.catchTag(\"SchemaError\",()=>o.fail(new de({reason:\"invalid-response\"}))));if(s.action===\"accept\"){let c=s.content===void 0?{}:s.content;return yield*r.decodeUnknownEffect(n)(c).pipe(o.mapError(()=>new de({reason:\"invalid-response\"}))),{...s,content:c}}return s})}}),No=(e,t,n)=>te(i=>o.gen(function*(){if(e===void 0)return yield*new de({reason:\"unavailable\"});let a=yield*Ho(i);return yield*e(a.request,t).pipe(ue(\"person\",Uo),o.flatMap(a.respond))}),t,n);var It=(e,t)=>wn(e.propertySignatures.flatMap(({name:n,type:i})=>typeof n==\"string\"?[{name:n,optional:U.isOptional(U.toEncoded(i))}]:[]),e.indexSignatures.length>0,t),rt=e=>U.isUnion(e)?e.types.flatMap(rt):U.isUndefined(e)||U.isVoid(e)?[]:[e],_e=e=>{if(U.isLiteral(e))return[e.literal];if(U.isEnum(e))return e.enums.map(([,n])=>n);if(!U.isUnion(e))return;let t=rt(e).map(_e);return t.length>0&&t.every(n=>n!==void 0)?t.flat():void 0},jo=e=>A.value(e).pipe(A.when(U.isObjects,t=>t.propertySignatures.length>0?It(t,Sn):\"object\"),A.when(U.isArrays,()=>\"array\"),A.when(U.isTemplateLiteral,()=>\"a string matching a template\"),A.when(U.isString,()=>\"string\"),A.when(U.isNumber,()=>\"number\"),A.when(U.isBoolean,()=>\"boolean\"),A.when(U.isNull,()=>\"null\"),A.orElse(()=>\"a value with other constraints\")),Wr=e=>{let[t]=e;if(!(e.length<2||t===void 0||!U.isObjects(t)))return t.propertySignatures.map(({name:n})=>n).find(n=>typeof n==\"string\"&&e.every(i=>U.isObjects(i)&&i.propertySignatures.some(a=>a.name===n&&_e(U.toEncoded(a.type))!==void 0)))},Po=e=>{let t=rt(e),n=t.map(_e),i=n.flatMap(s=>s===void 0?[]:s),a=t.filter((s,c)=>n[c]===void 0);return a.length===0?Me(i):En([...i.length===0?[]:[Me(i)],...new Set(a.map(jo))],Wr(t))},Jr=e=>`Expected ${Po(e)}`,Kr=e=>{let t=U.toEncoded(e),n=_e(t);if(n!==void 0)return Me(n);let i=rt(t),[a]=i;if(a===void 0)return;if(i.length>1&&U.isUnion(t))return Po(t);if(U.isObjects(a)&&a.propertySignatures.length>0)return It(a);let s=jo(a);return s===\"a value with other constraints\"?void 0:s},Br=e=>ce.hasInput(e)?\"Invalid value\":A.value(e).pipe(A.tag(\"InvalidType\",({ast:t})=>{let n=_e(t);return n!==void 0?`Expected ${Me(n)}`:U.isObjects(t)&&t.propertySignatures.length>0?`Expected ${It(t)}`:ce.defaultLeafHook(e)}),A.orElse(ce.defaultLeafHook)),Vr=e=>ce.hasInput(e)||ce.hasInput(e.issue)?ce.defaultCheckHook(e)??\"Invalid value\":ce.defaultCheckHook(e),Gr=ce.makeFormatterStandardSchemaV1({leafHook:Br,checkHook:Vr}),Xr=(e,t)=>e!==void 0&&U.isObjects(e)?e.propertySignatures.find(({name:n})=>n===t)?.type:void 0,zr=e=>t=>e.indexSignatures.length>0||e.propertySignatures.some(({name:n})=>n===t),Pe=(e,t,n)=>A.value(e).pipe(A.tag(\"Pointer\",i=>{let a=i.issue._tag===\"MissingKey\"&&i.path.length===1?Xr(n,i.path[0]):void 0;return a===void 0||n===void 0||!U.isObjects(n)?Pe(i.issue,[...t,...i.path]):[{path:[...t,...i.path],message:kn(Kr(a)),accepts:zr(n)}]}),A.tag(\"Composite\",({ast:i,issues:a})=>a.flatMap(s=>Pe(s,t,i))),A.tag(\"Encoding\",i=>Pe(i.issue,t)),A.tag(\"AnyOf\",({ast:i,issues:a})=>a.length===0?[{path:t,message:Jr(i)}]:a.flatMap(s=>Pe(s,t))),A.orElse(i=>{let a=i._tag===\"Filter\"?vn(i.filter):void 0;return Gr(i).issues.map(s=>({path:[...t,...(s.path??[]).map(c=>typeof c==\"object\"?c.key:c)],message:s.message,...a===void 0?{}:{accepts:a}}))})),Yr=e=>typeof e==\"number\"?`[${e}]`:typeof e==\"string\"&&Ke(e)?`.${e}`:\"[key]\",$t=e=>`input${e.map(Yr).join(\"\")}`,Ut=e=>typeof e==\"object\"&&e!==null&&!Array.isArray(e),Qr=(e,t)=>t.reduce((n,i)=>Array.isArray(n)&&typeof i==\"number\"||Ut(n)&&typeof i==\"string\"&&Object.hasOwn(n,i)?n[i]:void 0,e),qo=e=>e.toLowerCase().replace(/[-_]/g,\"\"),Zr=(e,t,n)=>{let i=t.at(-1);if(typeof i!=\"string\"||!Ke(i))return;let a=t.slice(0,-1),s=Qr(e,a);if(!Ut(s))return;let c=Object.keys(s).filter(d=>Ke(d)&&!n(d)),p=c.find(d=>d!==i&&qo(d)===qo(i)),g=c.find(d=>{let h=s[d];return Ut(h)&&Object.hasOwn(h,i)}),m=p!==void 0?[...a,p]:g!==void 0?[...a,g,i]:void 0;return m===void 0?void 0:`The input has ${String(m.at(-1))} at ${$t(m)}; did you mean ${$t(t)}?`},_o=(e,t)=>{if(!r.isSchemaError(e))return new F;let n=Pe(e.issue,[]).slice(0,ro).map(({path:i,message:a,accepts:s})=>{let c=s!==void 0&&a.startsWith(bn)?Zr(t,i,s):void 0;return`${$t(i)}: ${a}${c===void 0?\"\":`. ${c}`}`.slice(0,512)});return new F({problems:n})};var ei=(e,t)=>{let n=be(e);if(q.isSome(n))return Oe(n.value,t,\"discover\");let i=ot(e);if(q.isSome(i))return i.value;let a=je(e,t);return q.isSome(a)?a.value:r.is(j)(e)?e:new Xe(oe(e,t))},at=(e,t)=>o.suspend(e).pipe(o.catchCause(n=>I.hasInterrupts(n)?o.interrupt:o.fail(ei(I.squash(n),t)))),Do=(e,t)=>e.kind===\"router\"?o.succeed(e.meta):e.meta===void 0?o.succeed(e.overrides):at(e.meta,t).pipe(o.map(n=>fo(n,e.overrides))),it=\"tools\",ti=/^[a-z][a-z0-9]*$/,ni=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619)>>>0;return t.toString().padStart(10,\"0\")},Wo=e=>{if(e===\"\")return it;let t=e.split(\".\"),n=[it,...t].join(\"-\");if(t.every(s=>ti.test(s))&&n.length<=Be.nameCharacters)return n;let i=ni(e),a=e.toLowerCase().replace(/[^a-z0-9]+/g,\"-\").slice(0,Be.nameCharacters-it.length-i.length-2).replace(/^-+|-+$/g,\"\");return[it,a,i].filter(s=>s!==\"\").join(\"-\")},Ft=(e,t,n)=>r.decodeUnknownEffect(ze)({path:e,...t?.title===void 0?{}:{title:t.title},...t?.description===void 0?{}:{description:t.description},...t?.icons===void 0?{}:{icons:t.icons},...t?.tags===void 0?{}:{tags:t.tags},...t?.instructions===void 0?{}:{skill:Wo(e)},...n===void 0?{}:{error:n}}).pipe(o.mapError(()=>new j)),Jo=e=>e.pipe(o.catchCause(t=>I.hasInterrupts(t)?o.interrupt:o.fail(new j))),Ko=(e,t,n,i)=>{let a=n.kind===\"query\";return{name:e,...t===\"\"?{}:{router:t},...i===void 0?{}:{schedules:i},description:n.description??`${a?\"Query\":\"Mutate\"} ${e}`,...n.title===void 0?{}:{title:n.title},readOnly:a,annotations:{...n.annotations,readOnlyHint:a}}},oi=(e,t,n,i)=>Jo(r.decodeUnknownEffect(Ne)(Ko(e,t,n,i))),ri=(e,t,n,i)=>Jo(o.gen(function*(){return yield*r.decodeUnknownEffect(He)({...Ko(e,t,n,i),inputSchema:yield*fe(n.input),...n.output===void 0?n.outputSchema===void 0?{}:{outputSchema:n.outputSchema}:{outputSchema:yield*fe(n.output)},...n._meta===void 0?{}:{_meta:n._meta}})}));var Ht=r.Record(r.String,r.Unknown),ii=He.mapFields(e=>({...e,inputSchema:Ht,outputSchema:r.optionalKey(Ht),_meta:r.optionalKey(Ht)})),ai=r.is(r.Json),si=e=>ai(e.flatMap(t=>[t.inputSchema,t.outputSchema,t._meta].flatMap(n=>n===void 0?[]:Object.values(n)))),ci=r.Array(ii).pipe(r.refine(si)),Lo=(e,t)=>[...e].flatMap(n=>t===\"\"?[n]:n.startsWith(`${t}.`)?[n.slice(t.length+1)]:[]),Bo=(e,t)=>o.gen(function*(){let n=[],i=[],{wanted:a,secrets:s}=t,c=(m,d,h)=>o.gen(function*(){let f=m.describe,[l,E]=yield*o.all([Do(m,s),t.summary&&m.summaries!==void 0?at(m.summaries,s):h!==void 0&&f!==void 0?at(()=>o.forEach(h,w=>f(w),{concurrency:\"unbounded\"}),s).pipe(o.map(w=>w.filter(T=>T!==void 0))):at(m.list,s)],{concurrency:\"unbounded\"}),u=yield*(t.summary?r.decodeUnknownEffect(r.Array(Ne))(E):r.decodeUnknownEffect(ci)(E)).pipe(o.mapError(()=>new j)),k=new Set,y=[];for(let w of u){if(k.has(w.name))return yield*new j;if(k.add(w.name),h!==void 0&&!h.includes(w.name))continue;let T=w.readOnly===!0;y.push({...w,name:Ze(d,w.name),...d===\"\"?{}:{router:d},readOnly:T,annotations:{...w.annotations,readOnlyHint:T}})}return{meta:l,found:y}}),p=(m,d,h)=>o.gen(function*(){if(d===\"\"){let{meta:l,found:E}=yield*c(m,d,h);return n.push(...E),{meta:l,error:void 0}}let f=yield*o.result(c(m,d,h));return Vt.isFailure(f)?{meta:m.overrides,error:f.failure}:(n.push(...f.success.found),{meta:f.success.meta,error:void 0})}),g=(m,d)=>o.gen(function*(){(d!==\"\"||a===void 0&&m.meta!==void 0)&&i.push(yield*Ft(d,m.meta));for(let[h,f]of Object.entries(m.children)){let l=Ze(d,h);switch(f.kind){case\"query\":case\"mutation\":if(t.scheduled===!0&&t.schedules(l).length===0)break;(a===void 0||a.has(l))&&n.push(t.summary?yield*oi(l,d,f,t.schedules(l)):yield*ri(l,d,f,t.schedules(l)));break;case\"router\":(a===void 0||Lo(a,l).length>0)&&(yield*g(f,l));break;case\"dynamic\":{if(t.scheduled===!0)break;let E=a===void 0?void 0:Lo(a,l);if(E!==void 0&&E.length===0)break;let u=yield*p(f,l,E);i.push(yield*Ft(l,u.meta,u.error))}}}});if(e?.kind===\"router\")yield*g(e,\"\");else if(e?.kind===\"dynamic\"&&t.scheduled!==!0){let m=yield*p(e,\"\",a===void 0?void 0:[...a]);a===void 0&&m.meta!==void 0&&i.push(yield*Ft(\"\",m.meta))}return{tools:n,routers:i}}),Vo=e=>o.gen(function*(){let t=[],n=(s,c)=>{if(t.push({path:c,node:s}),s.kind===\"router\")for(let[p,g]of Object.entries(s.children))(g.kind===\"router\"||g.kind===\"dynamic\")&&n(g,Ze(c,p))};e!==void 0&&n(e,\"\");let i=yield*o.forEach(t,({path:s,node:c})=>Do(c,[]).pipe(o.flatMap(p=>di(s,p)),o.orElseSucceed(()=>{})),{concurrency:\"unbounded\"}),a=new Set;return i.filter(s=>s===void 0||a.has(s.name)?!1:(a.add(s.name),!0))}),di=(e,t)=>o.gen(function*(){if(t?.instructions===void 0)return;let n=Wo(e),i=([t.description,t.title].find(s=>s!==void 0&&s.trim()!==\"\")??(e===\"\"?\"How to use this app's tools\":`How to use the ${e} tools`)).slice(0,Be.descriptionCharacters),a=`---\nname: ${n}\ndescription: ${JSON.stringify(i)}\n---\n\n${t.instructions}\n`;return yield*xt([{path:\"SKILL.md\",content:a}],{name:n})});var li=({user:e,...t})=>t,le=(e,t)=>o.suspend(e).pipe(o.catchCause(n=>I.hasInterrupts(n)?o.interrupt:o.fail(t))),Go=e=>\"app\"in e?{scope:\"app\",name:e.app}:{scope:\"user\",name:e.user},Xo=(e,t,n,i)=>o.gen(function*(){let a=e.webhooks??{};if(t.operation===\"webhooks\")return yield*o.forEach(Object.entries(a),([b,O])=>le(()=>o.gen(function*(){let x=Go(O.account);if(!Object.hasOwn(i[x.scope],x.name))return yield*new j;let R=H=>{let X=gn(H);if(X!==void 0)return r.decodeUnknownEffect(K)(X);let Y=r.toJsonSchemaDocument(H);return r.decodeUnknownEffect(K)({...Y.schema,$defs:Y.definitions})},re=yield*R(O.config);if(O.setup===void 0?O.register===void 0||O.unregister===void 0:O.register!==void 0||O.unregister!==void 0)return yield*new j;let z=O.setup===void 0?void 0:{...yield*r.decodeUnknownEffect(Vn)(O.setup),stateSchema:yield*R(O.state)};return yield*r.decodeUnknownEffect(Gn)({name:b,account:x.name,configSchema:re,...z===void 0?{}:{setup:z}})}),new j));let s=Object.hasOwn(a,t.name)?a[t.name]:void 0;if(s===void 0)return yield*new ye;let c=Go(s.account),p=c.scope===\"app\"?n.app:n.user;if(p===void 0)return yield*new D;let g=Object.hasOwn(p.accounts,c.name)?p.accounts[c.name]:void 0,m=(Array.isArray(g)?g:[g]).find(b=>typeof b==\"object\"&&b!==null&&\"id\"in b&&b.id===t.sourceAccount);if(m===void 0)return yield*new F;let d=c.scope===\"app\"?li(n):n,h=yield*le(()=>r.decodeUnknownEffect(s.config)(t.config),new F);if(t.operation===\"webhook-validate\")return yield*le(()=>r.decodeUnknownEffect(J)(h),new F);let f={config:h,subscriptionId:t.subscriptionId,account:m,callbackUrl:t.callbackUrl,secret:t.secret},l=(b,O)=>le(()=>b(d,O),new se);if(t.operation===\"webhook-complete\")return s.setup===void 0?yield*new F:yield*le(()=>r.decodeUnknownEffect(s.state)(t.state).pipe(o.flatMap(r.decodeUnknownEffect(J))),new F);if(t.operation===\"webhook-register\"){if(s.register===void 0||s.setup!==void 0)return yield*new se;let b=yield*l(s.register,f);return yield*le(()=>r.decodeUnknownEffect(s.state)(b).pipe(o.flatMap(r.decodeUnknownEffect(J))),new ne)}let E=t.state===null?null:yield*le(()=>r.decodeUnknownEffect(s.state)(t.state),new F);if(t.operation===\"webhook-unregister\")return s.unregister===void 0||s.setup!==void 0?yield*new se:(yield*l(s.unregister,{...f,state:E}),null);let u=yield*o.fromResult(mt.decode(t.request.body)).pipe(o.mapError(()=>new F));if(u.byteLength>bt.maxBodyBytes)return yield*new F;let k=yield*le(()=>o.sync(()=>new Request(t.request.url,{method:t.request.method,headers:t.request.headers,...n.signal===void 0?{}:{signal:n.signal},...t.request.method===\"GET\"||t.request.method===\"HEAD\"?{}:{body:Uint8Array.from(u)}})),new F),y=yield*l(s.handle,{...f,state:E,request:k});if(!(y instanceof Response))return yield*new ne;let w=[],T=0,M=y.body;M!==null&&(yield*ht.fromReadableStream({evaluate:()=>M,onError:()=>new ne}).pipe(ht.runForEach(b=>o.gen(function*(){if(T+=b.byteLength,T>bt.maxBodyBytes)return yield*new ne;w.push(b)})),hn(\"webhook\")));let P=new Uint8Array(T),L=0;for(let b of w)P.set(b,L),L+=b.byteLength;let $={};return y.headers.forEach((b,O)=>{$[O]=b}),yield*le(()=>r.decodeUnknownEffect(Bn)({status:y.status,headers:$,body:mt.encode(new Uint8Array(P))}),new ne)});var Nt=`${Ie}step_receipts`,qt=`${Ie}step_events`,jt=`${Ie}migrations`,Yo=`${Ie}legacy_rows`,Qo=e=>{let t=e.toArray();return{columnNames:e.columnNames,rowsRead:e.rowsRead,rowsWritten:e.rowsWritten,toArray:()=>[...t],one:()=>{if(t.length!==1)throw new Error(`Expected exactly one row, but the statement returned ${t.length}.`);return t[0]},[Symbol.iterator]:()=>t[Symbol.iterator]()}},pi=e=>(typeof e==\"object\"||typeof e==\"function\")&&e!==null&&\"then\"in e&&typeof e.then==\"function\",Zo=()=>{throw new Error(`This app has no database. Add its first migration, such as ${Fe}/0001_create_notes.sql with a CREATE TABLE statement, and deploy again.`)},Pt={exec:Zo,transaction:Zo},er=[\"foreign_keys\",\"defer_foreign_keys\",\"ignore_check_constraints\",\"legacy_alter_table\",\"recursive_triggers\",\"reverse_unordered_selects\"],lt=e=>new Map(er.map(t=>[t,Number(e.sql.exec(`PRAGMA ${t}`).toArray()[0]?.[t])])),ui=(e,t)=>{let n=lt(e);return er.find(i=>n.get(i)!==t.get(i))},tr=(e,t)=>{let n=lt(e);for(let[i,a]of t)n.get(i)!==a&&e.sql.exec(`PRAGMA ${i} = ${a}`);e.sql.exec(\"PRAGMA case_sensitive_like = OFF\")},st=class extends Error{},nr=(e,t)=>{let n=!1,i=()=>{if(n||t.signal.aborted)throw new Error(\"This call has ended, so its ctx.sql no longer runs statements.\")},a=!1,s=0,c=lt(e),p=()=>{let y=ui(e,c);if(y!==void 0)throw d(new Error(`SQLite connection settings belong to Executor, so app code cannot change PRAGMA ${y}; the statement was rolled back. Migrations may change settings while they run.`))},g=()=>Number(e.sql.exec(\"SELECT total_changes() AS n\").toArray()[0]?.n),m,d=y=>(a&&(m??=y),y),h=(y,w,T)=>{try{return f(y,w,T)}finally{tr(e,c)}},f=(y,w,T)=>{if(i(),w.length>100)throw d(new Error(`A statement can bind at most ${100} values, but this one binds ${w.length}. Pass a long list as one JSON array and read it with json_each(?), or split the work into batches.`));if(T===\"write\"){let $=()=>{let b=Qo(e.sql.exec(y,...w));return p(),b};if(!a)return e.transactionSync($);try{return $()}catch(b){throw d(b instanceof Error?b:new Error(String(b))),b}}if(a)return f(y,w,\"write\");let M=g(),P,L=!1;try{e.transactionSync(()=>{throw P=Qo(e.sql.exec(y,...w)),L=g()!==M,p(),new st})}catch($){if(!($ instanceof st))throw $}if(L||P===void 0)throw new Error(t.step!==void 0?\"A workflow step mutation writes only inside ctx.sql.transaction(...), so a retried step applies its writes once.\":\"Queries are read-only. Change data from a mutation.\");return P},l={exec:(y,...w)=>h(y,w,\"read\")},E=()=>{let y=!0;return{tx:{exec:(T,...M)=>{if(!y)throw new Error(\"This transaction has ended, so its tx no longer runs statements.\");return h(T,M,\"write\")}},end:()=>{y=!1}}};return{reader:l,writer:{exec:(y,...w)=>h(y,w,t.step?\"read\":\"write\"),transaction:y=>{if(i(),a)throw new Error(\"ctx.sql.transaction(...) cannot be nested.\");let w=t.step;if(w!==void 0&&s>0)throw new Error(\"A workflow step mutation opens at most one ctx.sql.transaction(...), which records the step's result.\");s+=1,m=void 0;let T=E(),M=t.emitted?.length,P=()=>{t.emitted!==void 0&&M!==void 0&&(t.emitted.length=M)},L=()=>{a=!0;try{let $=()=>{let R=y(T.tx);if(pi(R))throw new Error(\"ctx.sql.transaction(...) callbacks are synchronous and cannot await. Call outside services before or after the transaction.\");if(m!==void 0)throw m;return R};if(w===void 0)return $();e.sql.exec(`CREATE TABLE IF NOT EXISTS ${Nt} (id TEXT PRIMARY KEY, fingerprint TEXT NOT NULL, result TEXT NOT NULL) WITHOUT ROWID`);let b=e.sql.exec(`SELECT fingerprint, result FROM ${Nt} WHERE id = ?`,w.key).toArray()[0];if(e.sql.exec(`CREATE TABLE IF NOT EXISTS ${qt} (id TEXT PRIMARY KEY, events TEXT NOT NULL) WITHOUT ROWID`),b!==void 0){if(b.fingerprint!==w.fingerprint)throw new Error(\"This workflow step already ran with different input.\");let R=e.sql.exec(`SELECT events FROM ${qt} WHERE id = ?`,w.key).toArray()[0];return R!==void 0&&t.emitted!==void 0&&t.emitted.push(...JSON.parse(String(R.events))),JSON.parse(String(b.result))}let O=JSON.stringify($()??null),x=t.emitted?.slice(M??0)??[];return x.length>0&&e.sql.exec(`INSERT INTO ${qt} (id, events) VALUES (?, ?)`,w.key,JSON.stringify(x)),e.sql.exec(`INSERT INTO ${Nt} (id, fingerprint, result) VALUES (?, ?, ?)`,w.key,w.fingerprint,O),JSON.parse(O)}finally{a=!1,T.end()}};try{return e.transactionSync(L)}catch($){throw P(),$}}},close:()=>{n=!0}}},ct=class extends r.TaggedError()(\"MigrationFileInvalid\",{path:r.String,reason:r.String}){get message(){return`${this.path}: ${this.reason}`}},xe=class extends r.TaggedError()(\"MigrationHistoryChanged\",{reason:r.String}){get message(){return`${this.reason} Applied migrations cannot change: restore the original file and add a new migration instead. Nothing was applied; the previous version is still active.`}},dt=class extends r.TaggedError()(\"MigrationFailed\",{path:r.String,reason:r.String}){get message(){return`${this.path} failed: ${this.reason}. No migrations were applied; the previous version is still active.`}},fi=/^(\\d+)_[A-Za-z0-9_-]+\\.sql$/,mi=e=>o.promise(()=>crypto.subtle.digest(\"SHA-256\",new TextEncoder().encode(e))).pipe(o.map(t=>Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,\"0\")).join(\"\"))),hi=e=>{let t=0,n=0;for(;n<e.length;){let i=e[n],a=e[n+1];if(i===\"-\"&&a===\"-\"){let c=e.indexOf(`\n`,n);n=c===-1?e.length:c+1;continue}if(i===\"/\"&&a===\"*\"){let c=e.indexOf(\"*/\",n+2);n=c===-1?e.length:c+2;continue}let s=i===\"'\"||i==='\"'||i===\"`\"?i:i===\"[\"?\"]\":void 0;if(s!==void 0){let c=n+1;for(;;){let p=e.indexOf(s,c);if(p===-1){c=e.length;break}if(s!==\"]\"&&e[p+1]===s){c=p+2;continue}c=p+1;break}n=c,t=n;continue}n+=1,i!==void 0&&!/\\s/u.test(i)&&(t=n)}return e.slice(0,t)},or=e=>e.some(t=>t.path.startsWith(`${Fe}/`)&&t.path.endsWith(\".sql\")),yi=e=>o.gen(function*(){let t=[];for(let i of e){if(!i.path.startsWith(`${Fe}/`)||!i.path.endsWith(\".sql\"))continue;let a=i.path.slice(Fe.length+1),s=fi.exec(a);if(a.includes(\"/\")||s===null)return yield*new ct({path:i.path,reason:\"migrations are files directly in migrations/ named like 0001_create_notes.sql: a number that orders them, an underscore, then a name.\"});let c=i.content.replaceAll(`\\r\n`,`\n`);t.push({path:i.path,order:Number(s[1]),content:c,hash:yield*mi(c)})}let n=[...t].sort((i,a)=>i.order-a.order);for(let[i,a]of n.entries()){let s=n[i-1];if(s!==void 0&&s.order===a.order)return yield*new ct({path:a.path,reason:`it has the same number as ${s.path}; give each migration its own number.`})}return n}),gi=r.Array(r.Struct({id:r.Number,path:r.String,hash:r.String})),rr=(e,t)=>o.gen(function*(){let n=yield*yi(t),i=lt(e);return yield*o.sync(()=>e.transactionSync(()=>{e.sql.exec(`CREATE TABLE IF NOT EXISTS ${jt} (id INTEGER PRIMARY KEY, path TEXT NOT NULL, hash TEXT NOT NULL, applied_at TEXT NOT NULL)`);let a=e.sql.exec(\"SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'app_rows'\").toArray().length>0;e.sql.exec(`DROP VIEW IF EXISTS ${Yo}`),e.sql.exec(`CREATE VIEW ${Yo} (table_name, id, body) AS ${a?\"SELECT table_name, id, body FROM app_rows\":\"SELECT '', '', '' WHERE 0\"}`);let s=r.decodeUnknownSync(gi)(e.sql.exec(`SELECT id, path, hash FROM ${jt} ORDER BY id`).toArray());for(let[g,m]of s.entries()){let d=n[g];if(d===void 0)throw new xe({reason:`${m.path} was applied to this app's database but is no longer in migrations/.`});if(d.path!==m.path)throw new xe({reason:`Migration ${g+1} was applied as ${m.path}, but the build has ${d.path} in its place.`});if(d.hash!==m.hash)throw new xe({reason:`${m.path} changed after it was applied to this app's database.`})}let c=n.slice(s.length),p=new Date().toISOString();for(let[g,m]of c.entries()){let d=hi(m.content);try{d!==\"\"&&e.sql.exec(d)}catch(h){throw new dt({path:m.path,reason:h instanceof Error?h.message:String(h)})}e.sql.exec(`INSERT INTO ${jt} (id, path, hash, applied_at) VALUES (?, ?, ?, ?)`,s.length+g+1,m.path,m.hash,p)}return c.map((g,m)=>({id:s.length+m+1,name:g.path}))})).pipe(o.catchDefect(a=>r.is(dt)(a)||r.is(xe)(a)?o.fail(a):o.die(a)),o.ensuring(o.sync(()=>tr(e,i))))});var _t=e=>Array.isArray(e)?`[${e.map(_t).join(\",\")}]`:e!==null&&typeof e==\"object\"?`{${Object.entries(e).sort(([t],[n])=>t<n?-1:t>n?1:0).map(([t,n])=>`${JSON.stringify(t)}:${_t(n)}`).join(\",\")}}`:JSON.stringify(e),wi=e=>o.gen(function*(){let t=yield*r.decodeUnknownEffect(r.Json)(e).pipe(o.mapError(()=>new B({reason:\"invalid\"}))),n=new TextEncoder().encode(_t(t));if(n.byteLength>V.keyBytes)return yield*new B({reason:\"capacity\",limit:\"keyBytes\"});let i=yield*o.tryPromise({try:()=>crypto.subtle.digest(\"SHA-256\",n),catch:()=>new B({reason:\"invalid\"})});return[...new Uint8Array(i)].map(a=>a.toString(16).padStart(2,\"0\")).join(\"\")}),ir=(e,t,n=\"shared\",i,a=s=>s)=>{let s=d=>e(d).pipe(o.withSpan(\"app.cache.command\",{attributes:{\"cache.operation\":d.operation}})),c=d=>wi([n,d]),p=d=>s({operation:\"read\",keys:d}).pipe(o.flatMap(r.decodeUnknownEffect(r.Array(r.NullOr(cn)))),o.mapError(()=>new B({reason:\"storage\"}))),g=(d,h=0)=>o.try({try:()=>({fresh:Re.toMillis(Re.fromInputUnsafe(d)),stale:Re.toMillis(Re.fromInputUnsafe(h))}),catch:()=>new B({reason:\"invalid\"})}).pipe(o.flatMap(({fresh:f,stale:l})=>[f,l].every(E=>Number.isFinite(E)&&E>=0)?o.succeed({fresh:Math.min(f,V.retentionMs),stale:Math.max(0,Math.min(l,V.retentionMs-f))}):o.fail(new B({reason:\"invalid\"})))),m=(d,h,f=()=>[])=>o.gen(function*(){let l=yield*c(d.key),E=f(l),u=E.length===0?void 0:yield*o.forEach(E,c),k=(x,R)=>({value:x,key:l,reads:R}),y=x=>({value:x,key:l,reads:void 0}),{fresh:w,stale:T}=yield*g(d.freshFor,d.staleFor),M=x=>r.decodeUnknownEffect(d.schema)(x),P=x=>o.gen(function*(){let R=yield*d.load.pipe(o.flatMap(M)),re=yield*r.decodeUnknownEffect(r.Json)(R).pipe(o.mapError(()=>new B({reason:\"invalid\"}))),z=yield*pe.currentTimeMillis;return(yield*s({operation:\"publish\",key:l,lease:x,entry:{value:re,version:crypto.randomUUID(),freshUntil:z+w,staleUntil:z+w+T}}).pipe(o.withSpan(\"app.cache.publish\")))!==!0?yield*new B({reason:\"unavailable\"}):R}).pipe(o.withSpan(\"app.cache.load\"),o.timeout(V.loadTimeoutMs),o.onExit(R=>Gt.isSuccess(R)?o.void:s({operation:\"release\",key:l,lease:x}).pipe(o.catch(()=>o.void)))),L=Math.min((yield*pe.currentTimeMillis)+V.waitMs,i??Number.POSITIVE_INFINITY),$,b=o.gen(function*(){let x=yield*s({operation:\"acquire\",key:l,refresh:h,...$===void 0?{}:{version:$},...u===void 0?{}:{reads:u}}).pipe(o.flatMap(Q=>r.decodeUnknownEffect(dn)(Q).pipe(o.mapError(()=>new B({reason:\"storage\"}))))),{entry:R,lease:re}=x,z=x.reads?.length===u?.length?x.reads:void 0,H=yield*pe.currentTimeMillis;$===void 0&&($=R?.version??null);let X=h&&R!==null&&R.version!==$;if(R!==null&&(X||!h&&re===null&&H<R.freshUntil))return{next:\"fresh\",entry:R,together:z};let Y=!h&&R!==null&&H<R.staleUntil;return Y&&d.stale!==\"revalidate\"?{next:\"stale\",entry:R,lease:re,together:z}:re!==null?{next:\"load\",lease:re,kept:Y}:H>=L?{next:\"local\"}:{next:\"wait\"}}),O=yield*b;switch(O.next===\"wait\"&&(O=yield*o.gen(function*(){for(;;){yield*o.sleep(\"100 millis\");let x=yield*b;if(x.next!==\"wait\")return x}}).pipe(a)),O.next){case\"fresh\":return yield*o.annotateCurrentSpan(\"cache.result\",\"fresh\"),k(yield*M(O.entry.value),O.together);case\"stale\":return yield*o.annotateCurrentSpan(\"cache.result\",\"stale\"),O.lease!==null&&(yield*t(P(O.lease).pipe(o.asVoid))),k(yield*M(O.entry.value),O.together);case\"load\":return yield*o.annotateCurrentSpan(\"cache.result\",O.kept?\"revalidated\":\"miss\"),y(yield*P(O.lease));case\"local\":return yield*o.annotateCurrentSpan(\"cache.result\",\"local\"),y(yield*d.load.pipe(o.flatMap(M),o.timeout(V.loadTimeoutMs),o.withSpan(\"app.cache.load\",{attributes:{\"cache.load.leased\":!1}})))}}).pipe(o.withSpan(\"app.cache.get\"));return{read:d=>o.forEach(d,c).pipe(o.flatMap(p)),write:(d,h)=>o.gen(function*(){let{fresh:f}=yield*g(h),l=yield*pe.currentTimeMillis,E=yield*o.forEach(d,({key:u,value:k})=>o.gen(function*(){return{key:yield*c(u),entry:{value:k,version:crypto.randomUUID(),freshUntil:l+f,staleUntil:l+f}}}));yield*s({operation:\"write\",entries:E})}),invalidate:d=>c(d).pipe(o.flatMap(h=>s({operation:\"invalidate\",key:h})),o.asVoid),get:d=>m(d,!1).pipe(o.map(({value:h})=>h)),getWith:(d,h)=>m(d,!1,h),revalidate:d=>m(d,!0).pipe(o.map(({value:h})=>h))}};var Si=Symbol(\"executor.cache.getWithReads\"),Lt={transport:()=>o.fail(new B({reason:\"unavailable\"})),background:()=>o.die(new Error(\"Cache background runner is unavailable\"))},Dt=(e,t,n,i,a)=>{let s=(c,p=n,g=i)=>{let m=ir(e.transport,u=>e.background(u.pipe(ue(\"background\",\"app.cache.refresh\"))),c,a,u=>u.pipe(o.withSpan(\"app.cache.lease.wait\",pn(\"lease\")))),d=u=>({key:u.key,schema:Ce(u.schema),freshFor:u.freshFor,...u.staleFor===void 0?{}:{staleFor:u.staleFor},...u.stale===void 0?{}:{stale:u.stale},load:o.acquireUseRelease(o.sync(()=>new AbortController),k=>o.all([ge(k.signal),ke]).pipe(o.flatMap(([y,w])=>Je(yn(u,\"load\"),\"loader\")({fetch:y,signal:k.signal,cache:s(c,k.signal,w.context)}))),k=>o.sync(()=>k.abort()))}),h=(u,k)=>m[u](d(k)),f=(u,k)=>o.forEach(u,y=>y===null?o.succeed(void 0):r.decodeUnknownEffect(Ce(k))(y.value)),l=(u,k)=>te((...y)=>k(...y).pipe(ue(\"executor\",\"app.cache.call\",{attributes:{\"cache.method\":u}})),p,g),E={get:l(\"get\",u=>h(\"get\",u)),revalidate:l(\"revalidate\",u=>h(\"revalidate\",u)),read:l(\"read\",(u,k)=>m.read([u]).pipe(o.flatMap(y=>{let w=y[0];return w==null?o.succeed(void 0):r.decodeUnknownEffect(Ce(k))(w.value)}))),readMany:l(\"readMany\",(u,k)=>m.read(u).pipe(o.flatMap(y=>f(y,k)))),write:l(\"write\",m.write),invalidate:l(\"invalidate\",m.invalidate),forAccount:u=>{let k=lo(t).flatMap(([,y])=>Array.isArray(y)?y:[y]).find(y=>y.id===u.id);if(k===void 0)throw new B({reason:\"invalid\"});return s({account:k.id,method:k.method,generation:k.generation},p,g)}};return Object.defineProperty(E,Si,{value:l(\"get\",(u,k)=>m.getWith(d(u),k).pipe(o.map(({value:y,key:w,reads:T})=>({value:y,key:w,reads:T?.map(M=>M===null?void 0:M.value)}))))})};return s(\"shared\")};var Ei=r.Struct({tools:r.Array(r.Union([He,Ne])),routers:r.Array(ze)});function N(e,t){return o.suspend(e).pipe(o.catchCause(n=>I.hasInterrupts(n)?o.interrupt:o.fail(t)))}var Wt=(e,t)=>e.pipe(o.catchCause(n=>{if(I.hasInterrupts(n))return o.interrupt;let i=I.squash(n),a=be(i),s=ot(i),c=je(i,t);return o.fail(q.isSome(a)?Oe(a.value,t,\"discover\"):q.isSome(s)?s.value:q.isSome(c)?c.value:new Xe(oe(i,t)))})),ut=(e,t,n=[])=>new j({source:\"app\",errorName:\"HostDeclarationInvalid\",message:me(t===void 0?e:`${e}: ${Co(t)}`,n)}),pr=(e,t)=>o.suspend(e).pipe(o.catchCause(n=>I.hasInterrupts(n)?o.interrupt:o.fail(ut(t,I.squash(n)))));function ar(e){let t=a=>Object.entries(e??{}).filter(([,s])=>s===a).map(([s])=>s).sort(),n=t(\"plain\"),i=t(\"raw\");return{...n.length===0?{}:{plain:n},...i.length===0?{}:{raw:i}}}function sr(e){return e===void 0||e.length===0?{}:{request:An(e)}}function ki(e){return pr(()=>o.gen(function*(){let t=new Map;for(let[n,i]of Object.entries(e.auth))switch(i._tag){case\"secrets\":t.set(n,{type:\"secrets\",label:i.label,fields:yield*fe(i.fields),...ar(i.exposure),...sr(i.request)});break;case\"oauth2\":t.set(n,{type:\"oauth2\",...i.config,response:yield*fe(i.response),...ar(i.exposure),...sr(i.request)});break}return yield*r.decodeUnknownEffect(Yn)({name:e.name,auth:Object.fromEntries(t),...e.hosts===void 0?{}:{hosts:[...new Set(e.hosts)].sort()}})}),`Account provider \"${e.name}\" has an invalid declaration`)}function cr(e){return o.gen(function*(){let t=new Map;for(let[n,i]of Object.entries(e)){let a=i instanceof Ee?i.provider:i;t.set(n,{cardinality:i instanceof Ee?\"many\":\"one\",definition:yield*ki(a),...a.health===void 0?{}:{health:!0}})}return Object.fromEntries(t)})}function bi(e,t,n,i){return o.gen(function*(){return yield*r.decodeUnknownEffect(Qn)({accounts:{app:yield*cr(e.app),user:yield*cr(e.user)},capabilities:{skills:!0,toolIndex:!0,skillSources:!0,scheduledTools:!0,sharedDefinitions:!0},...t?{sql:!0}:{},...n===void 0||Object.keys(n).length===0?{}:{events:yield*pr(()=>yo(n),\"The app's event declarations are invalid\")},...i===void 0?{}:{icons:i}}).pipe(o.mapError(a=>ut(\"The app's account declarations are invalid\",a)))})}function pt(e){return Array.isArray(e)?`[${e.map(pt).join(\",\")}]`:e!==null&&typeof e==\"object\"?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${pt(n)}`).join(\",\")}}`:JSON.stringify(e)}function dr({hosts:e,...t}){return{...t,auth:Object.fromEntries(Object.entries(t.auth).map(([n,{request:i,...a}])=>[n,a]))}}function Jt(e,t,n){return o.gen(function*(){if(Object.keys(n).some(a=>!Object.hasOwn(e,a)))return yield*o.fail(new D);let i=new Map;for(let[a,s]of Object.entries(e)){let c=Object.hasOwn(t,a)?t[a]:void 0,p=Object.hasOwn(n,a)?n[a]:void 0;if(c===void 0||p===void 0)return yield*o.fail(new D);let g=s instanceof Ee?s.provider:s,m=s instanceof Ee;if(m!==Array.isArray(p))return yield*o.fail(new D);let d=Array.isArray(p)?p:[p],h=new Set,f=[];for(let l of d){if(h.has(l.id))return yield*o.fail(new D);if(h.add(l.id),pt(dr(l.provider))!==pt(dr(c.definition))||!Object.hasOwn(g.auth,l.method))return yield*o.fail(new D);let E=g.auth[l.method];if(E===void 0)return yield*o.fail(new D);let u=yield*r.decodeUnknownEffect(E._tag===\"secrets\"?E.fields:E.response)(l.fields),k=Object.hasOwn(l.provider.auth,l.method)?l.provider.auth[l.method]?.request:void 0;f.push(On({id:l.id,method:l.method,fields:u},k))}if(m)i.set(a,f);else{let l=f[0];if(l===void 0)return yield*o.fail(new D);i.set(a,l)}}return Object.fromEntries(i)})}function lr(e,t,n){return N(()=>o.gen(function*(){let i=yield*r.decodeUnknownEffect(vt)(he.value(n.accounts)),a=yield*Jt(e.app,t.accounts.app,i.app);if(i.user===void 0)return{app:{accounts:a}};let s=yield*Jt(e.user,t.accounts.user,i.user);return{app:{accounts:a},user:{accounts:s}}}),new D)}var vi=e=>Object.values(e.user?.accounts??{}).flatMap(t=>(Array.isArray(t)?t:[t]).map(n=>n.id)),Ai=(e,t)=>o.acquireRelease(o.sync(()=>{let n=new AbortController,i=0,a=!1,s=()=>{a&&i===0&&n.abort()},c=()=>{a=!0,s()};e.addEventListener(\"abort\",c,{once:!0}),e.aborted&&c();let p=o.sync(()=>{i-=1,s()});return{signal:n.signal,close:()=>{e.removeEventListener(\"abort\",c),c()},background:g=>o.suspend(()=>(i+=1,t(g.pipe(o.ensuring(p))).pipe(o.onError(()=>p))))}}),n=>o.sync(n.close));function Oi(e,t,n,i,a){return o.scoped(o.gen(function*(){if(!wo(e))return yield*o.fail(ut(\"The app module's default export is not an app created by defineApp\"));let s=So(e),c=qe(n.accounts),p=or(n.files??[]),g=yield*bi(s.accounts,p,s.events,s.icons);if(t.operation===\"requirements\")return yield*N(()=>r.decodeUnknownEffect(J)(g),new j);if(t.operation===\"migrate\"){if(!p)return yield*new ye;let S=n.storage;if(S===void 0)return yield*new se(oe(new Error(\"This host gave the app no SQL storage.\"),c));let v=yield*r.decodeUnknownEffect(r.Array(ve))(n.files??[]).pipe(o.mapError(()=>new j)),_=yield*rr(S,v).pipe(o.mapError(G=>new se(oe(G,c))),o.withSpan(\"app.sql.migrate\"));return yield*N(()=>r.decodeUnknownEffect(J)(_),new ne)}let m=yield*o.acquireRelease(o.sync(()=>new AbortController),S=>o.sync(()=>S.abort())),d=AbortSignal.any([i,m.signal]),h=n.storage,f=S=>p?h===void 0?o.fail(new se(oe(new Error(\"This host gave the app no SQL storage.\"),c))):o.acquireRelease(o.sync(()=>nr(h,{signal:d,emitted:a,...S===void 0?{}:{step:S}})),v=>o.sync(v.close)):o.succeed({reader:Pt,writer:Pt}),l=n.deadline===void 0?void 0:yield*N(()=>r.decodeUnknownEffect(eo)(n.deadline),new F),E=S=>o.gen(function*(){if(l===void 0)return yield*S;let v=l-(yield*pe.currentTimeMillis);if(v<=0)return yield*new C({reason:\"engine\",retryable:!0});let _=yield*S.pipe(o.timeout(v),o.catchTag(\"TimeoutError\",()=>o.fail(new C({reason:\"engine\",retryable:!0}))));return(yield*pe.currentTimeMillis)>=l?yield*new C({reason:\"engine\",retryable:!0}):_});if(t.operation===\"account-check\")return yield*xi(s.accounts,g,t.requirement,n,d,l).pipe(E);let u,k=(S,v)=>o.suspend(()=>u!==void 0&&n.elicitation!==void 0?n.elicitation(S,v).pipe(ue(\"person\",\"app.tool.elicitation\"),o.provideContext(u.context)):o.fail(new de({reason:\"unavailable\"}))),y=()=>o.fail(new C({reason:\"unavailable\",retryable:!1})),w=yield*ke,T=(S,v)=>v.pipe(ue(\"executor\",Io,{attributes:{\"executor.workflow.operation\":S}})),M={start:te(S=>T(\"start\",n.workflowControls===void 0?y():n.workflowControls.start(S)),d,w.context),get:te(S=>T(\"get\",n.workflowControls===void 0?y():n.workflowControls.get(S)),d,w.context),list:te(S=>T(\"list\",n.workflowControls===void 0?y():n.workflowControls.list(S)),d,w.context),terminate:te(S=>T(\"terminate\",n.workflowControls===void 0?y():n.workflowControls.terminate(S)),d,w.context)},P={get:M.get,list:M.list},L=yield*r.decodeUnknownEffect(r.Array(ve))(n.files??[]).pipe(o.mapError(()=>new j)),$=0,b=n.cache??Lt,O=yield*Ai(i,b.background),x={cache:Dt({...b,transport:S=>($+=1,b.transport(S)),background:O.background},he.value(n.accounts),d,w.context,l),files:L,...yield*lr(s.accounts,g,n).pipe(o.withSpan(\"app.accounts.bind\")),workflows:P,signal:d,fetch:yield*ge(O.signal),elicit:No(k,d,w.context)},R=vi(x),re=[...Object.values(x.app.accounts).flatMap(S=>(Array.isArray(S)?S:[S]).map(v=>v.id)),...R],z=S=>go({events:s.events??{},accounts:re,attributable:R,...S===void 0?{}:{sourceAccount:S},emitted:a}),H=yield*Wt(s.evaluate(x),c).pipe(o.withSpan(\"app.evaluate\"));if(t.operation===\"skills\"){let S=H.skills??(yield*Eo({files:L}).pipe(o.mapError(()=>new j))),v=H.dynamicSkills,_=$,G=v===void 0?[]:yield*Wt(o.suspend(v.list),c).pipe(o.withSpan(\"app.skills.load\")),W=v!==void 0&&$>_,Z=new Set([...S,...G].map(ae=>ae.name)),ee=(yield*Vo(H.tools).pipe(o.withSpan(\"app.skills.routers\"))).filter(ae=>!Z.has(ae.name)),ie=yield*r.decodeUnknownEffect(Hn)([...S,...G,...ee]).pipe(o.mapError(()=>new j));return t.sources===!0?{skills:ie,dynamic:v!==void 0,cached:W}:ie}if(t.operation===\"workflows\")return yield*o.forEach(Object.entries(H.workflows??{}),([S,v])=>N(()=>o.gen(function*(){return yield*r.decodeUnknownEffect(_n)({name:S,...v.description===void 0?{}:{description:v.description},inputSchema:yield*fe(v.input),...v.output===void 0?{}:{outputSchema:yield*fe(v.output)}})}),new j));if(t.operation===\"workflow-validate\"||t.operation===\"workflow-run\"){let S=H.workflows!==void 0&&Object.hasOwn(H.workflows,t.name)?H.workflows[t.name]:void 0;if(S===void 0)return yield*new C({reason:\"not_found\",retryable:!1});let v=yield*N(()=>r.decodeUnknownEffect(S.input)(t.input),new C({reason:\"input\",retryable:!1}));if(t.operation===\"workflow-validate\")return yield*N(()=>r.decodeUnknownEffect(Ue)(v),new C({reason:\"input\",retryable:!1}));let _=n.workflow;if(_===void 0)return yield*new C({reason:\"unavailable\",retryable:!1});let G=yield*$o(_,H,(ie,ae)=>o.gen(function*(){let we=yield*_.resolve();return{context:{...yield*N(()=>lr(s.accounts,g,we),new C({reason:\"credentials\",retryable:!1})),cache:Dt(n.cache??Lt,he.value(we.accounts),ae,(yield*ke).context),files:L,fetch:yield*ge(ae),signal:ae,runId:_.runId,stepId:ie,idempotencyKey:ie},secrets:qe(we.accounts)}}),d),W=yield*Mt(S.run(G,v),c),Z=S.output,ee=Z===void 0?W:yield*N(()=>r.decodeUnknownEffect(Z)(W),new C({reason:\"output\",retryable:!1,message:\"The workflow's result does not match its declared output schema.\"}));return yield*N(()=>r.decodeUnknownEffect(Ue)(ee),new C({reason:\"output\",retryable:!1,message:\"The workflow returned a value that is not JSON, such as undefined, or is larger than 1 MiB. Return null for no result.\"}))}if(t.operation===\"inspect\"){let S=t.detail===\"summary\",v=yield*Bo(H.tools,{summary:S,secrets:c,...t.tools===void 0?{}:{wanted:new Set(t.tools)},...t.scheduled===!0?{scheduled:!0}:{},schedules:W=>Object.entries(H.schedules??{}).filter(([,Z])=>Z.tool===W).map(([Z,{tool:ee,...ie}])=>({name:Z,...ie}))}).pipe(o.withSpan(\"app.catalog.read\")),{tools:_,routers:G}=v;return yield*N(()=>(t.definitions===\"shared\"&&!S&&_.every(W=>\"inputSchema\"in W)?r.encodeEffect(to)(co({tools:_,routers:G})):r.encodeEffect(Ei)(v)).pipe(o.flatMap(r.decodeUnknownEffect(J))),new j)}if(t.operation===\"webhook-complete\"||t.operation===\"webhook-validate\"||t.operation===\"webhooks\"||t.operation===\"webhook-register\"||t.operation===\"webhook-handle\"||t.operation===\"webhook-unregister\"){let S=yield*f();return yield*Xo(H,t,{files:L,cache:x.cache,app:x.app,...x.user===void 0?{}:{user:x.user},workflows:M,signal:x.signal,fetch:x.fetch,sql:S.writer,events:z(\"sourceAccount\"in t?t.sourceAccount:void 0)},s.accounts)}let X=t.operation===\"call\"?t.tool:t.name,Y=mo(H.tools,X),Q=Y===void 0?void 0:Y.kind===\"operation\"?Y.operation:yield*Wt(Y.source.resolve(Y.name),c).pipe(o.withSpan(\"app.tool.resolve\"));if(Q===void 0)return yield*t.operation===\"call\"?new Qe:new ye;let ft=t.operation===\"call\"?t.kind:t.operation===\"query\"?\"query\":\"mutation\";if(ft!==void 0&&Q.kind!==ft)return yield*new oo({tool:X,requested:ft,actual:Q.kind});let Te=Q.kind===\"query\"?\"query\":\"mutate\",Le=yield*o.suspend(()=>r.decodeUnknownEffect(Q.input)(t.input)).pipe(o.catchCause(S=>I.hasInterrupts(S)?o.interrupt:o.fail(_o(I.squash(S),t.input))));if(n.approval!==void 0){let S=yield*N(()=>r.decodeUnknownEffect(Zn)(n.approval),new F),v=yield*N(()=>r.decodeUnknownEffect(J)(Le),new F);if(S.tool!==X||!r.toEquivalence(J)(S.input,v))return yield*new F}else if(Q.approval!==void 0){let S=Q.approval,v=yield*N(()=>S({toolName:X,toolInput:Le,signal:d}).pipe(o.withSpan(\"app.tool.approval\",{attributes:{\"executor.tool.name\":X}}),o.flatMap(r.decodeUnknownEffect(Ot))),new so);yield*A.value(v).pipe(A.when(\"approved\",()=>o.void),A.when(\"denied\",()=>o.fail(new io)),A.when(\"user-approval\",()=>N(()=>r.decodeUnknownEffect(J)(Le),new F).pipe(o.flatMap(_=>o.fail(new ao({input:_,elicitation:Jn(X,_)}))))),A.exhaustive)}let Kt=n.replay===void 0?void 0:yield*N(()=>r.decodeUnknownEffect(Ln)(n.replay),new F);if(Kt!==void 0&&Te!==\"mutate\")return yield*new F;let Bt=yield*f(Kt);return yield*E(o.gen(function*(){let S=yield*o.gen(function*(){u=yield*ke;let G=yield*ge(O.signal);return yield*Q.run({...x,fetch:G,workflows:Te===\"mutate\"?M:P,sql:Te===\"mutate\"?Bt.writer:Bt.reader,...Te===\"mutate\"?{events:z()}:{}},Le)}).pipe(o.ensuring(o.sync(()=>{u=void 0})),o.catchCause(G=>{if(I.hasInterrupts(G))return o.interrupt;let W=I.squash(G),Z=be(W),ee=r.decodeUnknownOption(St)(W),ie=je(W,c),ae=r.decodeUnknownOption(de)(W),we=r.is(Qe)(W)?t.operation===\"call\"?new Qe:new ye:void 0;return o.fail(we!==void 0?we:q.isSome(Z)?Oe(Z.value,c,\"call\"):q.isSome(ee)?new St({code:ee.value.code,status:ee.value.status,message:ee.value.message,...ee.value.recovery===void 0?{}:{recovery:ee.value.recovery}}):q.isSome(ie)?ie.value:q.isSome(ae)?ae.value:new se(oe(W,c)))}),o.withSpan(\"app.operation.execute\",{attributes:{\"executor.tool.name\":X,\"executor.operation\":Te}})),v=Q.output,_=v===void 0?S:yield*N(()=>r.decodeUnknownEffect(v)(S),new ne);return yield*N(()=>r.decodeUnknownEffect(J)(_),new ne)}))}))}function xi(e,t,n,i,a,s){return o.gen(function*(){let c=Object.hasOwn(e.app,n)?\"app\":Object.hasOwn(e.user,n)?\"user\":void 0;if(c===void 0)return yield*new D;let p=e[c][n],g=Object.hasOwn(t.accounts[c],n)?t.accounts[c][n]:void 0;if(p===void 0||g===void 0)return yield*new D;let m=p instanceof Ee?p.provider:p,d=m.health;if(d===void 0)return yield*new ye;let f=(yield*N(()=>o.gen(function*(){let u=(yield*r.decodeUnknownEffect(vt)(he.value(i.accounts)))[c];return u===void 0?yield*new D:yield*Jt({[n]:m},{[n]:{...g,cardinality:\"one\"}},u)}),new D).pipe(o.withSpan(\"app.accounts.bind\")))[n];if(f===void 0||!(\"id\"in f))return yield*new D;let l=yield*o.suspend(()=>o.gen(function*(){return yield*d.run({account:f,fetch:yield*ge(a),signal:a,...s===void 0?{}:{deadline:s}})})).pipe(o.catchCause(E=>{if(I.hasInterrupts(E))return o.interrupt;let u=I.squash(E),k=r.decodeUnknownOption(ln)(u),y=q.isSome(k)?q.fromNullishOr(Cn(k.value.status)):be(u),w=qe(i.accounts);return o.fail(q.isSome(y)?Oe(Mn(y.value,f.id),w):new se(oe(u,w)))}),o.withSpan(\"app.account.check\"));return yield*N(()=>r.decodeUnknownEffect(gt)(l??{}).pipe(o.flatMap(r.encodeEffect(gt)),o.flatMap(r.decodeUnknownEffect(J))),new ne)})}var Ti=A.type().pipe(A.tagsExhaustive({ProviderError:()=>502,McpError:()=>502,SkillLoadFailed:()=>502,OpenapiResponseError:()=>502,WorkflowFailure:()=>422,HostRequestInvalid:()=>400,HostAccountsInvalid:()=>422,HostInputInvalid:()=>422,HostOperationNotFound:()=>404,HostKindMismatch:()=>409,HostToolNotFound:()=>404,HostToolBlocked:()=>403,HostToolApprovalRequired:()=>409,HostToolPolicyFailed:()=>500,HostOperationFailed:()=>500,DatabaseLimitExceeded:()=>422,DatabaseFieldReserved:()=>422,HostDeclarationInvalid:()=>500,HostEvaluationFailed:()=>500,HostOutputInvalid:()=>500,ElicitationFailed:()=>422})),Ri=e=>(t,n)=>o.gen(function*(){if(t.method!==\"POST\")return yield*o.fail(new Ye);let i=yield*o.tryPromise({try:()=>t.json(),catch:()=>new Ye}),a=yield*r.decodeUnknownEffect(no)(i,{onExcessProperty:\"error\"}).pipe(o.mapError(()=>new Ye));yield*o.annotateCurrentSpan({\"executor.operation\":a.operation,...a.operation===\"call\"?{\"executor.tool.name\":a.tool}:{}});let s=!1,c=[],p=yield*Oi(e,a,n,t.signal,c).pipe(o.provideService(po,{failed:()=>{s=!0}}),o.tapError(g=>(g._tag===\"HostEvaluationFailed\"||g._tag===\"HostOperationFailed\"||g._tag===\"HostDeclarationInvalid\")&&g.errorName!==void 0?o.annotateCurrentSpan({\"error.type\":g.errorName,...g.source===void 0?{}:{\"executor.failure.source\":g.source},...g.code===void 0?{}:{\"executor.failure.code\":g.code}}):o.void),a.operation===\"call\"||a.operation===\"query\"||a.operation===\"mutate\"?Fo(a.operation):o.withSpan(`app.${a.operation}`));return s&&(yield*o.annotateCurrentSpan({\"executor.outcome\":\"failed\",\"error.type\":\"McpToolError\"})),Response.json({ok:!0,value:p,...s?{toolError:!0}:{},...c.length===0?{}:{events:c}})}).pipe(o.catch(i=>r.encodeEffect(At)(i).pipe(o.map(a=>Response.json({ok:!1,error:a},{status:Ti(i)})),o.orDie)),o.catchCause(i=>I.hasInterrupts(i)?o.interrupt:o.logError(\"The app's request failed unexpectedly\").pipe(o.andThen(r.encodeEffect(At)(ut(\"The app failed while it was loaded\",I.squash(i),qe(n.accounts)))),o.map(a=>Response.json({ok:!1,error:a},{status:500})),o.orDie)));export{Ot as ApprovalDecision,yt as HttpUrl,K as JsonObject,hr as ToolAnnotations,ur as ValidationError,mr as compileJsonSchemaDecoder,Ri as createAppHandler,Ce as decoderOf,wt as jsonSchemaDecoder,Ho as prepareElicitation,fr as wrap};\n","node_modules/apps/chunk-5TGEXQYL.js":"import{_ as st,a as R,b as S,c as F,d as A,ea as He,j as Ir,m as it,u as N,v as zt,w as j}from\"./chunk-3SCWQGZI.js\";import{Af as e,Ge as _t,He as Ht,Ie as Wt,Je as vr,Ka as Fe,Ke as Tr,Lb as kr,Le as Ne,Me as Ut,N as fr,Ne as $t,Oe as rt,Pe as jt,Re as i,S as yr,Se as b,Te as Jt,Ue as u,Ve as L,Vg as Dr,W as Q,We as Bt,Wf as Mr,Xe as f,Ye as v,Z as Sr,Ze as $,_ as xr,a as hr,ac as Rr,af as br,bf as Or,ce as Kt,cf as Cr,da as gr,de as Ar,df as g,e as Lt,ee as wr,f as Ft,fa as tt,fe as ot,ff as k,if as M,jf as Ke,kd as h,kf as _,la as H,lf as nt,pd as Nt,qf as at,uf as y,vf as re,xe as Er,yf as _e,zf as w}from\"./chunk-MN25OBZU.js\";var Ta=2048,ba=e.Literals([\"app\",\"storage\",\"service\"]),Vt=e.String.check(e.isMaxLength(128)),Oa=e.String.check(e.isMaxLength(128)),Gt=e.String.check(e.isMaxLength(Ta)),Ca=8,Ma=256,Da=e.String.check(e.isPattern(/^[A-Za-z_$][A-Za-z0-9_$]{0,63}$/)),Ia=e.Union([e.String.check(e.isMaxLength(Ma)),e.Finite,e.Boolean]),qa=e.Record(Da,Ia).check(e.isMaxProperties(Ca)),ct={source:e.optionalKey(ba),errorName:e.optionalKey(Vt),code:e.optionalKey(Oa),message:e.optionalKey(Gt),fields:e.optionalKey(qa)},We=1024,xe=e.Struct({code:e.Union([e.Int,e.String.check(e.isMinLength(1),e.isMaxLength(128))]),message:e.optionalKey(e.String.check(e.isMaxLength(We)))}),qr=e.Literals([\"connect\",\"discover\",\"call\"]);var I=class extends e.TaggedError()(\"ProviderError\",{reason:e.Literals([\"unauthorized\",\"forbidden\",\"rate_limited\",\"unavailable\",\"rejected\"]),status:e.optional(e.Int.check(e.isBetween({minimum:100,maximum:599}))),accountId:e.optional(F),phase:e.optional(qr),upstream:e.optional(xe)}){};var Pa=e.Union([e.Struct({reason:e.Literal(\"private_address\")}),e.Struct({reason:e.Literal(\"credential_host\"),provider:e.String,allowedHosts:e.Array(e.String)}),e.Struct({reason:e.Literal(\"credential_app\")}),e.Struct({reason:e.Literal(\"credential_expired\"),provider:e.String}),e.Struct({reason:e.Literal(\"credential_placement\"),provider:e.String,location:e.String}),e.Struct({reason:e.Literal(\"credential_transport\"),provider:e.String}),e.Struct({reason:e.Literal(\"credential_method\"),method:e.String})]),pt=class extends e.TaggedError()(\"NetworkRefused\",{host:e.String,refusal:Pa}){get message(){let o=this.refusal;switch(o.reason){case\"private_address\":return`Executor refused a request to ${this.host}: apps on this instance can reach only public addresses, and ${this.host} is a private, loopback or internal address. The request was not sent.`;case\"credential_host\":return o.allowedHosts.length===0?`Executor refused this request: ${o.provider} credentials cannot be sent to ${this.host}: the provider declares no hosts.`:`Executor refused this request: ${o.provider} credentials cannot be sent to ${this.host}. The provider allows: ${o.allowedHosts.join(\", \")}.`;case\"credential_app\":return\"Executor refused this request: it carries a credential handle that is not valid for this app. Use the account fields this invocation received.\";case\"credential_expired\":return`Executor refused this request: it carries an expired ${o.provider} credential handle. Use the account fields this invocation received.`;case\"credential_placement\":return`Executor refused this request: it carries a ${o.provider} credential handle in the ${o.location}, where the provider does not place it. Send credentials only as the provider's request declares, for example with the account's headers() and url().`;case\"credential_transport\":return`Executor refused this request: ${o.provider} credentials are sent only over HTTPS, and ${this.host} was requested over plain HTTP.`;case\"credential_method\":return`Executor refused this request: credential handles are never sent with ${o.method}, which asks the service to echo the request back.`}}},zs=421,Vs=\"x-executor-refused\",La=e.StringFromUriComponent.pipe(e.decodeTo(e.fromJsonString(pt))),Gs=e.encodeSync(pt),Qs=e.encodeSync(La);var Fa=e.Literals([\"redirect\",\"cache\",\"integrity\"]),Zs={redirect:[\"follow\",\"manual\"],cache:[\"no-store\",\"no-cache\"],integrity:[\"\"]},Pr=class extends e.TaggedError()(\"FetchOptionUnsupported\",{option:Fa,value:e.String,supported:e.Array(e.String)}){get message(){let o=this.supported.map(r=>JSON.stringify(r)).join(\" or \");return`fetch option ${this.option}: ${JSON.stringify(this.value)} is not supported by Executor's app runtime. Use ${o}, or omit ${this.option}.${this.advice}`}get advice(){switch(this.option){case\"redirect\":return this.value===\"error\"?' To reject redirects, send redirect: \"manual\" and treat a 3xx response as the error.':\"\";case\"cache\":return\"\";case\"integrity\":return\" To check a digest, read the body and hash it with crypto.subtle.digest.\"}}};var Qt=class extends e.TaggedError()(\"CacheError\",{reason:e.Literals([\"unavailable\",\"storage\",\"invalid\",\"capacity\",\"timeout\"]),limit:e.optionalKey(e.Literals([\"keyBytes\",\"entryBytes\",\"batchBytes\",\"batchEntries\",\"totalBytes\",\"totalEntries\"]))}){},ec={keyBytes:8192,entryBytes:2e6,batchBytes:8e6,batchEntries:128,totalBytes:128e6,totalEntries:1e5,retentionMs:10080*60*1e3,loadTimeoutMs:9e4,leaseMs:15e3,renewMs:5e3,waitMs:1e4,commandTimeoutMs:1e4},J=e.String.check(e.isPattern(/^[a-f0-9]{64}$/)),Lr=e.Finite.check(e.isGreaterThanOrEqualTo(0)),lt=e.Struct({value:e.Json,version:e.String,freshUntil:Lr,staleUntil:Lr}),tc=e.Struct({entry:e.NullOr(lt),lease:e.NullOr(e.String),reads:e.optionalKey(e.Array(e.NullOr(lt)))}),oc=e.Union([e.Struct({operation:e.Literal(\"read\"),keys:e.Array(J)}),e.Struct({operation:e.Literal(\"acquire\"),key:J,refresh:e.Boolean,version:e.optionalKey(e.NullOr(e.String)),reads:e.optionalKey(e.Array(J))}),e.Struct({operation:e.Literal(\"claim\"),key:J,version:e.NullOr(e.String)}),e.Struct({operation:e.Literal(\"publish\"),key:J,lease:e.String,entry:lt}),e.Struct({operation:e.Literal(\"release\"),key:J,lease:e.String}),e.Struct({operation:e.Literal(\"renew\"),key:J,lease:e.String}),e.Struct({operation:e.Literal(\"write\"),entries:e.Array(e.Struct({key:J,entry:lt}))}),e.Struct({operation:e.Literal(\"invalidate\"),key:J})]);var rc=e.Union([e.Struct({ok:e.Literal(!0),value:e.Json}),e.Struct({ok:e.Literal(!1),error:Qt})]);var Fr=class extends e.TaggedError()(\"ResponseStatusError\",{status:e.Number}){get message(){return`Request failed with status ${this.status}`}},Nr=class extends e.TaggedError()(\"ResponseDecodeError\",{}){get message(){return\"Response body did not match the expected schema\"}};var Kr=class extends Fe.TaggedClass(\"secrets\"){},Na=e.Literals([\"none\",\"client_secret_post\",\"client_secret_basic\",\"client_secret_basic_raw\"]),_r=e.Literals([\"client_secret_post\",\"client_secret_basic\",\"client_secret_basic_raw\"]),Ka=[\"response_type\",\"client_id\",\"redirect_uri\",\"state\",\"scope\",\"code_challenge\",\"code_challenge_method\",\"nonce\",\"resource\",\"request\",\"request_uri\"],$r=new Set(Ka),_a=e.Record(e.String,e.String).check(e.makeFilter(t=>Object.keys(t).every(o=>!$r.has(o)),{message:\"Authorization parameters cannot replace protocol parameters such as state or scope.\"})),Ha=e.makeFilter(t=>{let o=[...new URL(t.authorizationUrl).searchParams.keys()],r=o.filter(s=>$r.has(s));if(r.length>0)return{path:[\"authorizationUrl\"],issue:`authorizationUrl cannot set protocol parameters: ${r.join(\", \")}.`};let a=o.filter(s=>Object.hasOwn(t.authorizationParams??{},s));if(a.length>0)return{path:[\"authorizationParams\"],issue:`Declare each parameter once; authorizationUrl already sets: ${a.join(\", \")}.`}}),Wa=e.Literals([\"form\",\"json\"]),Ua=e.Struct({path:e.String.check(e.isPattern(/^[^.]+(\\.[^.]+)*$/))}),Zt={scopeSeparator:e.optionalKey(e.String.check(e.isMinLength(1))),tokenRequestFormat:e.optionalKey(Wa)},Hr={...Zt,tokenResponse:e.optionalKey(Ua),grant:e.optionalKey(e.Literal(\"authorization_code\")),authorizationParams:e.optionalKey(_a),tokenEndpointAuthMethod:e.optionalKey(Na),resource:e.optionalKey(e.NullOr(A))},Ue=e.Union([e.Struct({...Hr,discover:A,authorizationServerMetadataUrl:e.optionalKey(A),authorizationUrl:e.optionalKey(e.Never),tokenUrl:e.optionalKey(e.Never),revocationUrl:e.optionalKey(e.Never),scopes:e.optionalKey(e.Array(e.String))}),e.Struct({...Hr,authorizationUrl:A,tokenUrl:A,revocationUrl:e.optionalKey(A),scopes:e.Array(e.String),issuer:e.optionalKey(A),discover:e.optionalKey(e.Never),authorizationServerMetadataUrl:e.optionalKey(e.Never)}).check(Ha),e.Struct({grant:e.Literal(\"client_credentials\"),discover:A,authorizationServerMetadataUrl:e.optionalKey(A),authorizationUrl:e.optionalKey(e.Never),tokenUrl:e.optionalKey(e.Never),revocationUrl:e.optionalKey(e.Never),scopes:e.optionalKey(e.Array(e.String)),...Zt,tokenEndpointAuthMethod:_r,resource:e.optionalKey(e.NullOr(A))}),e.Struct({grant:e.Literal(\"client_credentials\"),tokenUrl:A,revocationUrl:e.optionalKey(A),scopes:e.Array(e.String),...Zt,tokenEndpointAuthMethod:_r,resource:e.optionalKey(e.NullOr(A)),authorizationUrl:e.optionalKey(e.Never),discover:e.optionalKey(e.Never),authorizationServerMetadataUrl:e.optionalKey(e.Never)})]),pc=e.Struct({access_token:e.String}),Wr=class extends Fe.TaggedClass(\"oauth2\"){},dt=e.String.check(e.isMinLength(1),e.isMaxLength(255)),$a=e.Struct({externalId:e.optionalKey(dt),displayName:e.optionalKey(dt),username:e.optionalKey(dt),email:e.optionalKey(dt),avatarUrl:e.optionalKey(A),profileUrl:e.optionalKey(A)}),ja=e.Struct({accountInfo:e.optionalKey($a)}),Ur=class extends Fe.Class{many(){return new Yt({provider:this})}},Yt=class extends Fe.TaggedClass(\"many\"){};var ge=Symbol(\"apps.NativeCallback\"),Ja=t=>Ir(\"app\",\"app.code\",{attributes:{\"executor.app.code\":t}}),C=(t,o)=>(...r)=>{if(ge in t){let a=t[ge];return a(...r)}return h.tryPromise({try:()=>t(...r),catch:a=>a}).pipe(Ja(o))},ut=(t,o)=>{let r=t[o],a=(...s)=>Reflect.apply(r,t,s);return ge in r&&Object.assign(a,{[ge]:r[ge]}),a},mc=(t,o,r)=>{let a=(...s)=>h.suspend(()=>{let p=typeof o==\"function\"?o(...s):o;if(p===void 0)return t(...s);if(p.aborted)return h.interrupt;let d=h.callback(l=>{if(p.aborted){l(h.interrupt);return}let c=()=>l(h.interrupt);return p.addEventListener(\"abort\",c,{once:!0}),h.sync(()=>p.removeEventListener(\"abort\",c))});return h.raceFirst(d,h.suspend(()=>t(...s)))});return Object.assign((...s)=>r===void 0?h.runPromise(a(...s)):h.runPromiseWith(r)(a(...s)),{[ge]:a})};var Jr=e.Struct({field:e.NonEmptyString}),Ba=e.Union([e.String,Jr]),za=e.Struct({base64:e.Array(Ba).check(e.isMinLength(1))}),Va=e.Union([e.String,Jr,za]),jr=e.Array(Va).check(e.isMinLength(1)),Ga=e.String.check(e.isPattern(/^[!#$%&'*+.^_`|~0-9a-z-]+$/u)),mt=e.Union([e.Struct({in:e.Literal(\"header\"),name:Ga,value:jr}),e.Struct({in:e.Literal(\"query\"),name:e.NonEmptyString,value:jr})]),Br=e.Array(mt),zr=t=>typeof t==\"object\"&&\"field\"in t,Vr=t=>new Set(t.value.flatMap(o=>typeof o==\"string\"?[]:zr(o)?[o.field]:o.base64.flatMap(r=>typeof r==\"string\"?[]:[r.field]))),Qa=e.encodeSync(e.fromJsonString(mt)),Za=t=>Qa(t),Gr=t=>[...new Map(t.map(o=>[Za(o),o])).entries()].sort(([o],[r])=>o<r?-1:o>r?1:0).map(([,o])=>o),Xt=class extends e.TaggedError()(\"PlacementFieldMissing\",{field:e.String}){get message(){return`The credential placement references the account field \"${this.field}\", which has no string value.`}},Qr=(t,o)=>{let r=s=>{let p=\"\";for(let d of s){if(typeof d==\"string\"){p+=d;continue}let l=Object.hasOwn(o,d.field)?o[d.field]:void 0;if(typeof l!=\"string\")return H.fail(new Xt({field:d.field}));p+=l}return H.succeed(p)},a=\"\";for(let s of t.value){let p=typeof s==\"string\"||zr(s)?r([s]):H.map(r(s.base64),d=>Nt.encode(d));if(H.isFailure(p))return p;a+=p.success}return H.succeed(a)};var eo=t=>`${t} is a credential placement, not a string. Build placement values with t\\`...\\`, such as t\\`Bearer \\${token}\\`, instead of an untagged template literal or string concatenation.`,ht=class{#e;constructor(o){this.#e=o}[Symbol.toPrimitive](){throw new TypeError(eo(this.#e))}toString(){throw new TypeError(eo(this.#e))}toJSON(){throw new TypeError(eo(this.#e))}},ft=class extends ht{field;constructor(o){super(`The field reference ${JSON.stringify(o)}`),this.field=o}},$e=class extends ht{parts;constructor(o){super(\"A t`...` value\"),this.parts=o}},yt=t=>{if(typeof t==\"string\")return t===\"\"?[]:[t];if(t instanceof ft)return[{field:t.field}];if(t instanceof $e)return t.parts;throw new TypeError(`A credential placement interpolates text, a field reference, t\\`...\\` or base64(...), not ${typeof t}.`)},Zr=t=>t.reduce((o,r)=>{let a=o.at(-1);return typeof r==\"string\"&&typeof a==\"string\"?o[o.length-1]=a+r:o.push(r),o},[]),to=(t,...o)=>new $e(Zr(t.flatMap((r,a)=>[...yt(r),...a<o.length?yt(o[a]):[]]))),Ya=t=>{let o=yt(t).map(r=>{if(typeof r==\"object\"&&\"base64\"in r)throw new TypeError(\"base64(...) cannot contain another base64(...).\");return r});if(o.length===0)throw new TypeError(\"base64(...) needs a value.\");return new $e([{base64:o}])},Yr=t=>{let o=yt(t);if(o.length===0)throw new TypeError(\"A credential placement needs a value.\");return Zr(o)},Xr=(t,o)=>({in:\"header\",name:t.toLowerCase(),value:Yr(o)}),Mc=(t,o)=>({in:\"query\",name:t,value:Yr(o)}),Dc=t=>Xr(\"authorization\",to`Bearer ${t}`),Ic=(t,o)=>Xr(\"authorization\",to`Basic ${Ya(to`${t}:${o}`)}`),qc=(t,o,r,a)=>{let s=new Set(o),p=new Proxy(Object.fromEntries(o.map(c=>[c,new ft(c)])),{get:(c,m)=>{if(typeof m==\"string\"&&!s.has(m))throw new TypeError(`The ${t} request references \"${m}\", which is not one of its fields: ${o.join(\", \")}.`);return Reflect.get(c,m)}}),d=a(p),l=Array.isArray(d)?d:[d];if(l.length===0)throw new TypeError(`The ${t} request declares no placements.`);if(!l.every(e.is(mt)))throw new TypeError(`The ${t} request must return header(...) or query(...) placements, or an array of them.`);for(let c of l){let m=Vr(c);for(let x of m){if(!s.has(x))throw new TypeError(`The ${t} request references \"${x}\", which is not one of its fields: ${o.join(\", \")}.`);if(r?.[x]===\"raw\")throw new TypeError(`The ${t} request references the raw() field \"${x}\". App code reads raw fields as real values, so they are never placed; remove raw() or the reference.`)}if(![...m].some(x=>r?.[x]===void 0))throw new TypeError(`The ${t} request's ${c.in} ${c.name} references no secret field. A placement places a secret: reference a field that is not plain() or raw().`)}return Gr(l)},Xa=t=>`The ${t} account declares no request. Declare where its credentials go with request, such as request: ({ token }) => bearer(token), to use headers() and url().`,Pc=(t,o)=>{let r=typeof t.fields==\"object\"&&t.fields!==null?t.fields:{},a=p=>H.getOrThrowWith(Qr(p,r),d=>new TypeError(d.message)),s=()=>{if(o===void 0||o.length===0)throw new TypeError(Xa(t.method));return o};return Object.defineProperties(t,{headers:{enumerable:!1,value:()=>Object.fromEntries(s().filter(p=>p.in===\"header\").map(p=>[p.name,a(p)]))},url:{enumerable:!1,value:p=>{let d=new URL(p);for(let l of s())l.in===\"query\"&&d.searchParams.set(l.name,a(l));return d.href}}})};var je=Symbol(\"apps.Operation\"),St=Symbol(\"apps.Router\"),oo=t=>({kind:t.kind,[je]:t}),ke=t=>{if(!(typeof t!=\"object\"||t===null||!(je in t)))return t[je]},ei=t=>{let o=t.approval;return{...t.description===void 0?{}:{description:t.description},...t.title===void 0?{}:{title:t.title},...t.annotations===void 0?{}:{annotations:t.annotations},...t._meta===void 0?{}:{_meta:t._meta},input:N(t.input),...o===void 0?{}:{approval:r=>C(async()=>o(r),\"approval\")()}}},ro=(t,o)=>{let r=Object.defineProperties({},Object.getOwnPropertyDescriptors(t));return Object.defineProperty(r,\"approval\",{enumerable:!0,value:a=>C(async()=>o(a),\"approval\")()})},Kc=(t,o)=>({...t,[je]:ro(t[je],o)}),_c=t=>ke(t)?.annotations,en=(t,o,r)=>oo({...ei({...o,input:j(o.input,`The ${t} input`)}),kind:t,...o.output===void 0?{}:{output:N(j(o.output,`The ${t} output`))},run:(a,s)=>C(r,\"handler\")(a,s)}),Hc=(t,o)=>en(\"query\",t,o);function Wc(t,o){return en(\"mutation\",t,o)}var ne=e.NonEmptyString.pipe(e.brand(\"wfr\")),B=e.NonEmptyString.check(e.isMaxLength(200)),ti={millisecond:1,milliseconds:1,second:1e3,seconds:1e3,minute:6e4,minutes:6e4,hour:36e5,hours:36e5,day:864e5,days:864e5,week:6048e5,weeks:6048e5},oi=t=>{if(typeof t==\"number\")return Number.isFinite(t)&&t>=0?t:void 0;let o=/^(\\d+(?:\\.\\d+)?) (milliseconds?|seconds?|minutes?|hours?|days?|weeks?)$/.exec(t),r=o?.[2]===void 0?void 0:ti[o[2]];if(r===void 0)return;let a=Number(o?.[1])*r;return Number.isFinite(a)?a:void 0},no=e.Union([e.Finite.check(e.isGreaterThanOrEqualTo(0)),e.NonEmptyString]).check(e.makeFilter(t=>oi(t)!==void 0)),ri=e.Struct({retries:e.optionalKey(e.Struct({limit:e.Int.check(e.isGreaterThanOrEqualTo(0)),delay:no,backoff:e.optionalKey(e.Literals([\"constant\",\"linear\",\"exponential\"]))})),timeout:e.optionalKey(no)}),on={step:e.optionalKey(e.String.check(e.isMaxLength(200))),errorName:e.optionalKey(Vt),message:e.optionalKey(Gt)},ni=e.Struct(on),z=class extends e.TaggedError()(\"WorkflowFailure\",{...on,reason:e.Literals([\"unavailable\",\"not_found\",\"input\",\"output\",\"operation\",\"approval\",\"credentials\",\"terminated\",\"execution\",\"conflict\",\"engine\"]),retryable:e.Boolean}){get[it](){return this.step===void 0&&this.errorName===void 0&&!this.message?void 0:`The workflow failed (${this.reason}); the app's error is not recorded`}},tn=class extends Error{name=\"NonRetryableError\"},rn=R.check(e.makeFilter(t=>new TextEncoder().encode(JSON.stringify(t)).byteLength<=1024*1024)),Vc=e.Struct({name:B,description:e.optionalKey(e.String),inputSchema:S,outputSchema:e.optionalKey(S)}),xt={id:ne,app:e.NonEmptyString,version:e.NonEmptyString,workflow:B,createdAt:e.String},ai=e.Union([e.Struct({...xt,status:e.Literals([\"queued\",\"running\",\"waiting\",\"paused\",\"waitingForPause\"])}).pipe(He({version:\"deployment\"})),e.Struct({...xt,status:e.Literal(\"complete\"),output:rn}).pipe(He({version:\"deployment\"})),e.Struct({...xt,status:e.Literal(\"errored\"),error:z.fields.reason,failure:e.optionalKey(ni)}).pipe(He({version:\"deployment\"})),e.Struct({...xt,status:e.Literal(\"terminated\")}).pipe(He({version:\"deployment\"}))]),Gc=e.Struct({items:e.Array(ai),next:e.optionalKey(ne)}),nn=e.Struct({key:e.NonEmptyString,fingerprint:e.NonEmptyString}),an=e.Union([e.Struct({operation:e.Literal(\"workflows\")}),e.Struct({operation:e.Literal(\"workflow-validate\"),name:B,input:R}),e.Struct({operation:e.Literal(\"workflow-run\"),name:B,input:R})]),ii=e.Union([e.Struct({operation:e.Literal(\"do\"),name:B,options:ri}),e.Struct({operation:e.Literal(\"sleep\"),name:B,duration:no}),e.Struct({operation:e.Literal(\"until\"),name:B,timestamp:e.Finite}),e.Struct({operation:e.Literal(\"context\")}),e.Struct({operation:e.Literal(\"invoke\"),kind:e.Literals([\"query\",\"mutation\"]),name:e.NonEmptyString,input:R,stepId:e.NonEmptyString,timeout:e.Finite.check(e.isGreaterThanOrEqualTo(0))})]),si=e.Union([e.Struct({ok:e.Literal(!0),value:R}),e.Struct({ok:e.Literal(!1),error:z})]),ci=e.Union([e.Struct({operation:e.Literal(\"start\"),workflow:B,input:rn,key:e.optionalKey(e.NonEmptyString.check(e.isMaxLength(128)))}),e.Struct({operation:e.Literal(\"get\"),run:ne}),e.Struct({operation:e.Literal(\"list\"),workflow:e.optionalKey(B),cursor:e.optionalKey(ne),limit:e.optionalKey(e.Int.check(e.isBetween({minimum:1,maximum:100})))}),e.Struct({operation:e.Literal(\"terminate\"),run:ne})]);var sn=\"~effect/rpc/RpcSchema/StreamSchema\";var pi=Er(Mr);function cn(t,o){return _t(pi.ast,{[sn]:sn,success:t,error:o})}var pn=\"~effect/rpc/Rpc\";var di={[pn]:pn,pipe(){return hr(this,arguments)},setSuccess(t){return Z({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:t,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(t){return Z({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:t,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(t){return Z({_tag:this._tag,payloadSchema:Ht(t)?t:u(t),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(t){return Z({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,t])})},prefix(t){return Z({_tag:`${t}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(t,o){return Z({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:xr(this.annotations,t,o)})},annotateMerge(t){return Z({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:gr(this.annotations,t)})}},Z=t=>{function o(){}return Object.setPrototypeOf(o,di),Object.assign(o,t),o.key=`effect/rpc/Rpc/${t._tag}`,o},D=(t,o)=>{let r=o?.success??Jt,a=o?.error??$t,s=o?.defect??nt(),p;return o?.primaryKey?p=class extends y(`effect/rpc/Rpc/${t}`)(o.payload){[Dr](){return o.primaryKey(this)}}:p=Ht(o?.payload)?o?.payload:o?.payload?u(o?.payload):Jt,Z({_tag:t,payloadSchema:p,successSchema:o?.stream?cn(r,a):r,errorSchema:o?.stream?$t:a,defectSchema:s,annotations:Sr(),middlewares:new Set})};var Je=(t,o)=>{let r=Rr(o);return Wt(t).pipe(Or({decode:wr(r),encode:Kt()}),Cr(r))},n=t=>Wt(t).pipe(br(Tr(vr(t)),{decode:Kt(),encode:Ar(yr(fr))})),mi=v([i,M]),Cn=v([i,M]),K=class extends k()(u({_meta:n(Bt(u({progressToken:n(Cn)}),[w]))})){},W=class extends k()(u({_meta:n(w)})){},Re=class extends k()(u({_meta:n(w)})){},Mn=i,ln=class extends k()(u({...K.fields,cursor:n(Mn)})){},Ae=class extends k()(u({...W.fields,nextCursor:n(Mn)})){},Ct=$([\"user\",\"assistant\"]),Y=class extends k()(u({audience:n(f(Ct)),priority:n(M.check(Ke({minimum:0,maximum:1}))),lastModified:n(i)})){},ae=class extends y(\"@effect/ai/McpSchema/Icon\")({src:i,mimeType:n(i),sizes:n(f(i)),theme:n($([\"light\",\"dark\"]))}){},gt=class extends k()(u({name:i,title:n(i),version:i,icons:n(f(ae)),description:n(i),websiteUrl:n(i)})){},ao=class extends y(\"@effect/ai/McpSchema/ClientCapabilities\")({experimental:n(L(i,u({}))),extensions:n(L(Ut([i,\"/\",i]),_e)),roots:n(u({listChanged:n(b)})),sampling:n(u({context:n(u({})),tools:n(u({}))})),elicitation:n(u({form:n(u({})),url:n(u({}))}))}){},io=class extends k()(u({experimental:n(L(i,u({}))),extensions:n(L(Ut([i,\"/\",i]),_e)),logging:n(u({})),completions:n(u({})),prompts:n(u({listChanged:n(b)})),resources:n(u({subscribe:n(b),listChanged:n(b)})),tools:n(u({listChanged:n(b)}))})){},X=class extends y(\"@effect/ai/McpSchema/McpErrorBase\")({code:_,message:i,data:n(rt)}){},hi=-32600,fi=-32601,yi=-32602,Si=-32603,xi=-32700;var so=class extends re(\"effect/ai/McpSchema/ParseError\")({...X.fields,_tag:g(\"ParseError\"),code:g(xi)}){},co=class extends re(\"effect/ai/McpSchema/InvalidRequest\")({...X.fields,_tag:g(\"InvalidRequest\"),code:g(hi)}){},po=class extends re(\"effect/ai/McpSchema/MethodNotFound\")({...X.fields,_tag:g(\"MethodNotFound\"),code:g(fi)}){},lo=class extends re(\"effect/ai/McpSchema/InvalidParams\")({...X.fields,_tag:g(\"InvalidParams\"),code:g(yi)}){},uo=class t extends re(\"effect/ai/McpSchema/InternalError\")({...X.fields,_tag:g(\"InternalError\"),code:g(Si)}){static notImplemented=new t({message:\"Not implemented\"})},V=v([so,co,po,lo,uo,X]);var mo=class extends k()(u({...W.fields,protocolVersion:i,capabilities:io,serverInfo:gt,instructions:n(i)})){},dn=class extends D(\"initialize\",{success:mo,error:V,payload:{...K.fields,protocolVersion:i,capabilities:ao,clientInfo:gt}}){};var un=class extends D(\"notifications/cancelled\",{payload:{...Re.fields,requestId:mi,reason:n(i)}}){},mn=class extends D(\"notifications/progress\",{payload:{...Re.fields,progressToken:Cn,progress:M,total:n(M),message:n(i)}}){},kt=class extends y(\"@effect/ai/McpSchema/Resource\")({uri:i,name:i,title:n(i),description:n(i),mimeType:n(i),annotations:n(Y),icons:n(f(ae)),size:n(_),_meta:n(w)}){},ho=class extends y(\"@effect/ai/McpSchema/ResourceTemplate\")({uriTemplate:i,name:i,title:n(i),description:n(i),mimeType:n(i),annotations:n(Y),icons:n(f(ae)),_meta:n(w)}){},Rt=class extends k()(u({uri:i,mimeType:n(i),_meta:n(w)})){},At=class extends k()(u({...Rt.fields,text:i})){},wt=class extends k()(u({...Rt.fields,blob:at})){},hn=class extends y(\"@effect/ai/McpSchema/ListResourcesResult\")({...Ae.fields,resources:f(kt)}){};var fn=class extends y(\"@effect/ai/McpSchema/ListResourceTemplatesResult\")({...Ae.fields,resourceTemplates:f(ho)}){};var fo=class extends k()(u({...W.fields,contents:f(v([At,wt]))})){},yn=class extends D(\"resources/read\",{success:fo,error:V,payload:{...K.fields,uri:i}}){};var Sn=class extends D(\"resources/subscribe\",{success:u({}),error:V,payload:{...K.fields,uri:i}}){},xn=class extends D(\"resources/unsubscribe\",{success:u({}),error:V,payload:{...K.fields,uri:i}}){},gn=class extends D(\"notifications/resources/updated\",{payload:{...Re.fields,uri:i}}){},yo=class extends k()(u({name:i,title:n(i),description:n(i),required:n(b)})){},So=class extends y(\"@effect/ai/McpSchema/Prompt\")({name:i,title:n(i),description:n(i),arguments:n(f(yo)),icons:n(f(ae)),_meta:n(w)}){},Et=class extends k()(u({type:g(\"text\"),text:i,annotations:n(Y),_meta:n(w)})){},vt=class extends k()(u({type:g(\"image\"),data:at,mimeType:i,annotations:n(Y),_meta:n(w)})){},Tt=class extends k()(u({type:g(\"audio\"),data:at,mimeType:i,annotations:n(Y),_meta:n(w)})){},xo=class extends k()(u({type:g(\"resource\"),resource:v([At,wt]),annotations:n(Y),_meta:n(w)})){},go=class extends k()(u({...kt.fields,type:g(\"resource_link\")})){},Wo=v([Et,vt,Tt,xo,go]),ko=class extends k()(u({role:Ct,content:Wo})){},kn=class extends y(\"@effect/ai/McpSchema/ListPromptsResult\")({...Ae.fields,prompts:f(So)}){};var Ro=class extends y(\"@effect/ai/McpSchema/GetPromptResult\")({...W.fields,messages:f(ko),description:n(i)}){},Rn=class extends D(\"prompts/get\",{success:Ro,error:V,payload:{...K.fields,name:i,title:n(i),arguments:n(L(i,i))}}){};var Ao=class extends k()(u({title:n(i),readOnlyHint:Je(b,Ft),destructiveHint:Je(b,Lt),idempotentHint:Je(b,Ft),openWorldHint:Je(b,Lt)})){},gi=Bt(u({type:Ne(\"object\"),properties:n(L(i,w)),required:n(f(i))}),[w]),ki=w,bt=class extends y(\"@effect/ai/McpSchema/Tool\")({name:i,title:n(i),description:n(i),inputSchema:gi,outputSchema:n(ki),annotations:n(Ao),icons:n(f(ae)),_meta:n(w)}){},An=class extends y(\"@effect/ai/McpSchema/ListToolsResult\")({...Ae.fields,tools:f(bt)}){};var wo=class extends y(\"@effect/ai/McpSchema/CallToolResult\")({...W.fields,content:f(Wo),structuredContent:n(_e),isError:n(b)}){},wn=class extends D(\"tools/call\",{success:wo,error:V,payload:{...K.fields,name:i,arguments:Je(L(i,rt),()=>({}))}}){};var Dn=$([\"debug\",\"info\",\"notice\",\"warning\",\"error\",\"critical\",\"alert\",\"emergency\"]),En=class extends D(\"logging/setLevel\",{payload:{...K.fields,level:Dn},success:u({}),error:V}){},vn=class extends D(\"notifications/message\",{payload:u({...Re.fields,level:Dn,logger:n(i),data:rt})}){},Eo=class extends y(\"@effect/ai/McpSchema/ToolUseContent\")({type:g(\"tool_use\"),id:i,name:i,input:L(i,jt),_meta:n(w)}){},vo=class extends y(\"@effect/ai/McpSchema/ToolResultContent\")({type:g(\"tool_result\"),toolUseId:i,content:f(Wo),structuredContent:n(_e),isError:n(b),_meta:n(w)}){},Ot=v([Et,vt,Tt,Eo,vo]),To=class extends k()(u({role:Ct,content:v([Ot,f(Ot)]),_meta:n(w)})){},bo=class extends y(\"@effect/ai/McpSchema/ToolChoice\")({mode:n($([\"auto\",\"required\",\"none\"]))}){},Oo=class extends k()(u({name:n(i)})){},Co=class extends y(\"@effect/ai/McpSchema/ModelPreferences\")({hints:n(f(Oo)),costPriority:n(M.check(Ke({minimum:0,maximum:1}))),speedPriority:n(M.check(Ke({minimum:0,maximum:1}))),intelligencePriority:n(M.check(Ke({minimum:0,maximum:1})))}){},Mo=class extends y(\"@effect/ai/McpSchema/CreateMessageResult\")({role:Ct,content:v([Ot,f(Ot)]),_meta:n(w),model:i,stopReason:n(i)}){},Tn=class extends D(\"sampling/createMessage\",{success:Mo,error:V,payload:{messages:f(To),modelPreferences:n(u(Co.fields)),systemPrompt:n(i),includeContext:n($([\"none\",\"thisServer\",\"allServers\"])),temperature:n(M),maxTokens:_,stopSequences:n(f(i)),metadata:n(L(i,jt)),tools:n(f(u(bt.fields))),toolChoice:n(u(bo.fields))}}){};var bn=class t extends k()(u({...W.fields,completion:u({values:f(i),total:n(_),hasMore:n(b)})})){static empty=t.make({completion:{values:[],total:0,hasMore:!1}})};var Do=class extends y(\"@effect/ai/McpSchema/ElicitationString\")({type:g(\"string\"),title:n(i),description:n(i),minLength:n(_),maxLength:n(_),format:n($([\"email\",\"uri\",\"date\",\"date-time\"])),default:n(i)}){},Io=class extends y(\"@effect/ai/McpSchema/ElicitationNumber\")({type:$([\"number\",\"integer\"]),title:n(i),description:n(i),minimum:n(M),maximum:n(M),default:n(M)}){},qo=class extends y(\"@effect/ai/McpSchema/ElicitationBoolean\")({type:g(\"boolean\"),title:n(i),description:n(i),default:n(b)}){},Po=class extends y(\"@effect/ai/McpSchema/UntitledSingleSelectEnum\")({type:g(\"string\"),title:n(i),description:n(i),enum:f(i),default:n(i)}){},Lo=class extends y(\"@effect/ai/McpSchema/TitledSingleSelectEnum\")({type:g(\"string\"),title:n(i),description:n(i),oneOf:f(u({const:i,title:i})),default:n(i)}){},Ri=v([Po,Lo]),Fo=class extends y(\"@effect/ai/McpSchema/UntitledMultiSelectEnum\")({type:g(\"array\"),title:n(i),description:n(i),minItems:n(_),maxItems:n(_),items:u({type:g(\"string\"),enum:f(i)}),default:n(f(i))}){},No=class extends y(\"@effect/ai/McpSchema/TitledMultiSelectEnum\")({type:g(\"array\"),title:n(i),description:n(i),minItems:n(_),maxItems:n(_),items:u({anyOf:f(u({const:i,title:i}))}),default:n(f(i))}){},Ai=v([Fo,No]),Ko=class extends y(\"@effect/ai/McpSchema/LegacyTitledEnum\")({type:g(\"string\"),title:n(i),description:n(i),enum:f(i),enumNames:n(f(i)),default:n(i)}){},wi=v([Ko,Ri,Ai]),Ei=v([wi,Do,Io,qo]),vi=u({$schema:n(i),type:g(\"object\"),properties:L(i,Ei),required:n(f(i))}),we=class extends y(\"@effect/ai/McpSchema/ElicitRequestFormParams\")({...K.fields,mode:n(Ne(\"form\")),message:i,requestedSchema:vi}){},_o=class extends y(\"@effect/ai/McpSchema/ElicitRequestURLParams\")({...K.fields,mode:Ne(\"url\"),message:i,elicitationId:i,url:i}){},Ti=v([we,_o]),Be=class extends y(\"@effect/ai/McpSchema/ElicitAcceptResult\")({...W.fields,action:Ne(\"accept\"),content:n(L(i,v([i,M,b,f(i)])))}){},ze=class extends y(\"@effect/ai/McpSchema/ElicitDeclineResult\")({...W.fields,action:$([\"cancel\",\"decline\"])}){},bi=v([Be,ze]);var Ho=class extends D(\"elicitation/create\",{success:bi,error:V,payload:Ti}){};var On=class extends re(\"@effect/ai/McpSchema/ElicitationDeclined\")({_tag:g(\"ElicitationDeclined\"),request:Ho.payloadSchema,cause:n(nt())}){};var Ci=e.Struct({timeoutMs:e.Int.check(e.isGreaterThan(0))}),cp=Ci.make({timeoutMs:900*1e3}),qn=e.Struct({...we.fields,mode:e.Literal(\"form\"),requestedSchema:e.toEncoded(we.fields.requestedSchema),_meta:e.optional(S)}),Pn=e.Union([e.Struct({...Be.fields,_meta:e.optional(S)}),e.Struct({...ze.fields,_meta:e.optional(S)})]),ie=class extends e.TaggedError()(\"ElicitationFailed\",{reason:e.Literals([\"unavailable\",\"transaction\",\"invalid-request\",\"invalid-response\",\"transport\",\"expired\",\"forbidden\"])}){},Mi=e.Union([e.Struct({ok:e.Literal(!0),response:Pn}),e.Struct({ok:e.Literal(!1),error:ie})]),Ln=e.Struct({...qn.fields,requestedSchema:e.Struct({type:e.Literal(\"object\"),properties:e.Record(e.String,e.Never)})}),pp=Pn.check(e.makeFilter(t=>t.action!==\"accept\"||t.content===void 0||Object.keys(t.content).length===0)),Ve=4e3,In=32,Fn=t=>t>=55296&&t<=56319,Di=t=>t>=56320&&t<=57343,Uo=(t,o)=>t.slice(0,Fn(t.charCodeAt(o-1))?o-1:o),Ii=t=>Array.isArray(t),qi=t=>{let o=0;for(let r=1;r<t.length;r+=1)Di(t.charCodeAt(r))&&Fn(t.charCodeAt(r-1))&&(o+=1);return t.length-o},U=(t,o)=>{t.parts.push(o),t.room-=o.length},Nn=(t,o,r,a)=>{if(typeof t==\"string\"){t.length>o?U(a,`${JSON.stringify(Uo(t,o))}\\u2026 (${qi(t)} characters)`):U(a,JSON.stringify(t.length>a.room?Uo(t,a.room+1):t));return}if(typeof t!=\"object\"||t===null)return U(a,JSON.stringify(t));let s=`${r}  `,p=(l,c,m)=>(U(a,`${l===0?\"\":\",\"}\n${s}${c===void 0?\"\":`${JSON.stringify(c)}: `}`),a.room>=0&&Nn(m,o,s,a),a.room>=0);if(Ii(t))return t.length===0?U(a,\"[]\"):(U(a,\"[\"),t.every((l,c)=>p(c,void 0,l)),U(a,`\n${r}]`));let d=Object.entries(t);if(d.length===0)return U(a,\"{}\");U(a,\"{\"),d.every(([l,c],m)=>p(m,l,c)),U(a,`\n${r}}`)},$o=(t,o,r)=>{let a={parts:[],room:r};return Nn(t,o,\"\",a),{text:a.parts.join(\"\"),fits:a.room>=0}},Pi=t=>{let o=Ve/2,r=$o(t,o,Ve);for(;!r.fits&&o>In;)o=Math.max(In,Math.floor(o/2)),r=$o(t,o,Ve);return r.fits?r.text:`${Uo(r.text,Ve)}\n\\u2026 (the rest is not shown)`},Kn=(t,o)=>({mode:\"form\",message:`Approve ${t}?\n\n${o}`,requestedSchema:{type:\"object\",properties:{}}}),Li=(t,o,r)=>{let a=$o(o,Number.POSITIVE_INFINITY,r);return a.fits?Kn(t,`Arguments:\n${a.text}`):void 0},lp=(t,o)=>{let r=Li(t,o,Ve);return r!==void 0?r:Kn(t,`Arguments, shortened for review. Approving runs the call with the complete arguments:\n${Pi(o)}`)};var Mt=e.Struct({title:e.optionalKey(e.String),readOnlyHint:e.optionalKey(e.Boolean),destructiveHint:e.optionalKey(e.Boolean),idempotentHint:e.optionalKey(e.Boolean),openWorldHint:e.optionalKey(e.Boolean)});var Fi=e.String.pipe(e.decodeTo(e.optionalKey(e.String),{decode:ot.omit(),encode:ot.passthrough()}));function _n(t){let o=t.fields,r=t.message,a=typeof r==\"string\"?{description:r}:{},s=e.Error(t.tag)(e.TaggedStruct(t.tag,{...o,message:Fi}).annotate(a),{httpApiStatus:t.status,...a}),p=t.recorded??(typeof r==\"string\"?()=>r:void 0);return Object.defineProperties(s.prototype,{message:{get(){return typeof r==\"string\"?r:r(this)}},...p===void 0?{}:{[it]:{get(){return p(this)}}}}),s}function Ni(t){return\"fields\"in t?_n(t):_n({...t,fields:{}})}var Hn={define:Ni};var Un=e.NonEmptyString.check(e.makeFilter(t=>!t.startsWith(\"/\")&&!t.includes(\"\\\\\")&&!t.includes(\"\\0\")&&t.split(\"/\").every(o=>o!==\"\"&&o!==\".\"&&o!==\"..\"))),Ki=e.Struct({path:Un,content:e.String}),jo={nameCharacters:64,descriptionCharacters:1024,compatibilityCharacters:500},Jo=e.NonEmptyString.check(e.makeFilter(t=>t===t.toLowerCase()&&/^[\\p{L}\\p{N}]+(?:-[\\p{L}\\p{N}]+)*$/u.test(t)&&[...t].length<=jo.nameCharacters)),_i=e.Struct({name:Jo,description:e.String.check(e.makeFilter(t=>t.trim().length>0&&[...t].length<=jo.descriptionCharacters)),license:e.optionalKey(e.String),compatibility:e.optionalKey(e.String.check(e.makeFilter(t=>t.trim().length>0&&[...t].length<=jo.compatibilityCharacters))),metadata:e.optionalKey(e.Record(e.String,e.String)),\"allowed-tools\":e.optionalKey(e.String)}),Hi=e.Struct({..._i.fields,files:e.Array(Ki).check(e.makeFilter(t=>t.some(o=>o.path===\"SKILL.md\")&&new Set(t.map(o=>o.path)).size===t.length))}),Wi={files:t=>`The skill files of \\u201C${t}\\u201D are invalid: each needs a unique relative path, text content and a SKILL.md document.`,directory:t=>`\\u201C${t}\\u201D is not a valid skill directory. Skill directory names use lowercase letters and digits separated by single hyphens.`,\"missing-document\":t=>`\\u201C${t}\\u201D is missing.`,frontmatter:t=>`\\u201C${t}\\u201D must start with valid YAML frontmatter between --- lines.`,metadata:t=>`The frontmatter of \\u201C${t}\\u201D needs a valid name and description within the Agent Skills limits.`,\"name-mismatch\":t=>`The name in \\u201C${t}\\u201D does not match its skill directory.`},gp=Hn.define({tag:\"SkillDefinitionInvalid\",status:400,fields:{file:Un,reason:e.Literals([\"files\",\"directory\",\"missing-document\",\"frontmatter\",\"metadata\",\"name-mismatch\"])},message:({file:t,reason:o})=>Wi[o](t),recorded:({reason:t})=>`The app's skill definition is invalid (${t})`}),Bo=e.Array(Hi).check(e.makeFilter(t=>new Set(t.map(o=>o.name)).size===t.length)),kp=e.String.check(e.isPattern(/^[A-Za-z0-9](?:[A-Za-z0-9 .-]{0,98}[A-Za-z0-9])?$/u)),Wn=class extends e.TaggedError()(\"SkillLoadFailed\",{reason:e.Literals([\"source\",\"request\",\"rate_limited\",\"document\",\"limit\",\"changed\",\"encoding\"]),message:e.optional(e.String.check(e.isMaxLength(500))),status:e.optional(e.Int.check(e.isBetween({minimum:100,maximum:599}))),missing:e.optional(e.Literals([\"repository\",\"ref\"]))}){};var Ui=4096,$i=e.Struct({action:e.NonEmptyString.check(e.isMaxLength(1024)),instructions:e.NonEmptyString.check(e.isMaxLength(Ui))}),ji=4096,Ji=e.Struct({code:e.NonEmptyString.check(e.isMaxLength(128)),status:e.Int.check(e.isBetween({minimum:400,maximum:599})),message:e.NonEmptyString.check(e.isMaxLength(ji)),recovery:e.optionalKey($i)}),Ee=class extends e.TaggedError()(\"OpenapiResponseError\",Ji.fields){},Bi=e.Struct({maxBodyBytes:e.Int.check(e.isGreaterThan(0)),readTimeoutMs:e.Int.check(e.isGreaterThan(0))}),wp=Bi.make({maxBodyBytes:65536,readTimeoutMs:2e3});var q=e.String.check(e.makeFilter(t=>/^[A-Za-z][A-Za-z0-9_]*$/.test(t)&&t.length<=128)),Dt=e.Union([e.String,e.Finite,e.Boolean]),zi=e.Struct({kind:e.Literals([\"string\",\"number\",\"boolean\",\"id\",\"userId\"]),optional:e.optional(e.Boolean),default:e.optional(Dt),references:e.optional(q)}),Vi=e.Struct({name:q,fields:e.NonEmptyArray(q)}),Gi=e.Struct({fields:e.Record(q,zi),indexes:e.Array(Vi)}),Jn=e.Record(q,Gi),zo=e.Record(e.String,Dt),Tp=e.Struct({id:e.NonEmptyString,createdAt:e.String,updatedAt:e.String}),$n=e.Record(q,e.NullOr(Dt)),Qi=e.Struct({field:q,op:e.Literals([\"eq\",\"gt\",\"gte\",\"lt\",\"lte\"]),value:e.NullOr(Dt)}),Zi=e.Struct({table:q,index:q,order:e.Literals([\"asc\",\"desc\"]),clauses:e.Array(Qi)}),Yi=e.Union([e.Struct({kind:e.Literal(\"collect\")}),e.Struct({kind:e.Literal(\"count\")}),e.Struct({kind:e.Literal(\"first\")}),e.Struct({kind:e.Literal(\"take\"),count:e.Int.check(e.isGreaterThanOrEqualTo(0))}),e.Struct({kind:e.Literal(\"paginate\"),cursor:e.NullOr(e.String),numItems:e.Int.check(e.isGreaterThan(0))})]),bp=e.Union([e.Struct({kind:e.Literal(\"get\"),table:q,id:e.NonEmptyString}),e.Struct({kind:e.Literal(\"insert\"),table:q,value:$n}),e.Struct({kind:e.Literal(\"update\"),table:q,id:e.NonEmptyString,patch:$n}),e.Struct({kind:e.Literal(\"delete\"),table:q,id:e.NonEmptyString}),e.Struct({kind:e.Literal(\"query\"),plan:Zi,terminal:Yi})]),Xi=e.Struct({page:e.Array(zo),continueCursor:e.NullOr(e.String),isDone:e.Boolean}),Op=e.Union([zo,e.Array(zo),Xi,e.Boolean,e.Finite,e.Null]),jn=class extends e.TaggedError()(\"AppDatabaseError\",{reason:e.Literals([\"schema\",\"schema_changed\",\"table\",\"index\",\"range\",\"value\",\"readonly\",\"cursor\",\"limit\",\"closed\",\"storage\",\"replay\"])}){},Cp=e.Struct({rowsRead:e.Int.check(e.isGreaterThan(0)),rowsReturned:e.Int.check(e.isGreaterThan(0)),bytesRead:e.Int.check(e.isGreaterThan(0)),writes:e.Int.check(e.isGreaterThan(0)),scanCalls:e.Int.check(e.isGreaterThan(0)),directGets:e.Int.check(e.isGreaterThan(0)),valueBytes:e.Int.check(e.isGreaterThan(0)),indexBytes:e.Int.check(e.isGreaterThan(0))}),Mp={rowsRead:5e3,rowsReturned:1e3,bytesRead:4*1024*1024,writes:1e3,scanCalls:100,directGets:1e3,valueBytes:64*1024,indexBytes:2048},es=e.Literals([\"scanCalls\",\"directGets\",\"rowsRead\",\"rowsReturned\",\"pageSize\",\"bytesRead\",\"writes\",\"valueBytes\"]),O=t=>t.toLocaleString(\"en-US\"),ts={scanCalls:(t,o)=>`This invocation made ${O(o)} index queries; the limit is ${O(t)}. Each first(), take(), collect(), count() or paginate() call on withIndex(...) counts once. Read related rows with one take() or paginate() over a shared index prefix instead of one first() per item, use get(id) for known IDs, or split the work across workflow steps.`,directGets:(t,o)=>`This invocation made ${O(o)} get(id) calls, including those made by update and delete; the limit is ${O(t)}. Split the work across workflow steps or mutations.`,rowsRead:(t,o)=>`This invocation read ${O(o)} rows; the limit is ${O(t)}. Read fewer rows per call, through an index or a LIMIT, or split the work across calls or workflow steps.`,rowsReturned:(t,o)=>`This invocation returned ${O(o)} rows; the limit is ${O(t)}. collect() fails rather than truncating. Page with paginate() across calls or workflow steps.`,pageSize:(t,o)=>`One call asked for ${O(o)} rows; take(n) and paginate({ numItems }) accept at most ${O(t)}. Page with paginate() across calls or workflow steps.`,bytesRead:(t,o)=>`This invocation read ${O(o)} bytes; the limit is ${O(t)}. Read fewer or smaller rows per call, or page with paginate() across calls or workflow steps.`,writes:(t,o)=>`This invocation wrote ${O(o)} rows; the limit is ${O(t)}. Split large ingests into batches, one batch per mutation or workflow step.`,valueBytes:(t,o)=>`A row encodes to ${O(o)} bytes; each row may use at most ${O(t)}. Store large content outside the row or split it across rows.`},ve=class extends e.TaggedError()(\"DatabaseLimitExceeded\",{limit:es,maximum:e.Int,requested:e.Int}){get message(){return ts[this.limit](this.maximum,this.requested)}},os=[\"id\",\"createdAt\",\"updatedAt\"],Te=class extends e.TaggedError()(\"DatabaseFieldReserved\",{table:e.String,field:e.Literals(os)}){get message(){return`Table \"${this.table}\" declares \"${this.field}\", which is reserved: the host adds id, createdAt and updatedAt to every row. Rename the field, or use the row's own ${this.field}.`}},rs=e.Struct({maxCursorChars:e.Int.check(e.isGreaterThan(0)),connectionCacheCapacity:e.Int.check(e.isGreaterThan(0)),connectionCacheTtlMs:e.Int.check(e.isGreaterThan(0))}),Dp=rs.make({maxCursorChars:8192,connectionCacheCapacity:64,connectionCacheTtlMs:300*1e3});var qp=\"_executor_\",Pp=\"migrations\";var Vo=new Set([\"__proto__\",\"constructor\",\"prototype\"]),Bn=e.String.check(e.isPattern(/^[A-Za-z_][A-Za-z0-9_-]{0,99}$/u),e.makeFilter(t=>!Vo.has(t))),se=e.Struct({src:e.NonEmptyString,mimeType:e.optionalKey(e.String),sizes:e.optionalKey(e.Array(e.String)),theme:e.optionalKey(e.Literals([\"light\",\"dark\"]))}),Go=e.Struct({title:e.optionalKey(e.String),description:e.optionalKey(e.String),instructions:e.optionalKey(e.String),icons:e.optionalKey(e.Array(se)),tags:e.optionalKey(e.Record(e.NonEmptyString,e.String))});var ns=e.Struct({timeoutMs:e.Int.check(e.isGreaterThan(0)),maxTimeoutMs:e.Int.check(e.isGreaterThan(0)),maxTools:e.Int.check(e.isGreaterThan(0)),maxPaginationCursors:e.Int.check(e.isGreaterThan(0)),cleanupTimeoutMs:e.Int.check(e.isGreaterThan(0))}),Vn=ns.make({timeoutMs:3e4,maxTimeoutMs:3e5,maxTools:5e4,maxPaginationCursors:1e3,cleanupTimeoutMs:1e3});var as=e.Struct({url:A,accountId:e.optional(F),headers:e.optional(e.Record(e.String,e.String)),signal:e.optional(e.instanceOf(AbortSignal)),timeoutMs:e.optional(e.Number.check(e.isInt(),e.isBetween({minimum:1,maximum:Vn.maxTimeoutMs})))}),jp=e.Struct({...as.fields,headers:e.Record(e.String,e.String),deadline:e.optional(e.Finite)}),Jp=2*Vn.cleanupTimeoutMs+250,zp=e.Struct({content:e.Array(S),structuredContent:e.optionalKey(S),isError:e.optionalKey(e.Boolean),_meta:e.optionalKey(S)}),Vp=e.Struct({name:e.String,title:e.optional(e.String),description:e.optional(e.String),inputSchema:S,outputSchema:e.optional(S),annotations:e.optional(Mt),_meta:e.optional(S)}),Gp=e.Struct({name:e.optionalKey(e.String),title:e.optionalKey(e.String),version:e.optionalKey(e.String),description:e.optionalKey(e.String),websiteUrl:e.optionalKey(e.String),icons:e.optionalKey(e.Array(se)),instructions:e.optionalKey(e.String)}),Qo=class extends e.TaggedError()(\"McpError\",{phase:e.Literals([\"connect\",\"discover\",\"call\",\"schema\",\"transport\"]),reason:e.Literals([\"request\",\"unauthorized\",\"invalid_response\",\"timeout\",\"invalid_input\"]),status:e.optional(e.Number),upstream:e.optional(xe),session:e.optional(e.Literal(!0))}){},zn=class extends e.TaggedError()(\"McpCredentialsUnverified\",{anonymous:e.Union([e.Literal(\"answered\"),Qo,I])}){};var is=e.Struct({maxBodyBytes:e.Int.check(e.isGreaterThan(0))}),ss=is.make({maxBodyBytes:1024*1024}),Gn=4*Math.ceil(ss.maxBodyBytes/3),cs=e.Struct({url:A,method:e.Literals([\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"OPTIONS\"]),headers:e.Record(e.String,e.String),body:e.String.check(e.isMaxLength(Gn))}),Xp=e.Struct({status:e.Int.check(e.isBetween({minimum:200,maximum:599})),headers:e.Record(e.String,e.String),body:e.String.check(e.isMaxLength(Gn))}),ps=e.Struct({instructions:e.NonEmptyString,signingSecret:e.Literals([\"executor\",\"provider\"])}),ls=e.Struct({...ps.fields,stateSchema:S}),el=e.Struct({name:e.NonEmptyString,account:e.NonEmptyString,configSchema:S,setup:e.optionalKey(ls)}),Ge={name:e.NonEmptyString,subscriptionId:e.NonEmptyString,sourceAccount:F,callbackUrl:A,secret:e.String,config:R},Qn=e.Union([e.Struct({operation:e.Literal(\"webhooks\")}),e.Struct({operation:e.Literal(\"webhook-validate\"),...Ge}),e.Struct({operation:e.Literal(\"webhook-complete\"),...Ge,state:R}),e.Struct({operation:e.Literal(\"webhook-register\"),...Ge}),e.Struct({operation:e.Literal(\"webhook-unregister\"),...Ge,state:R}),e.Struct({operation:e.Literal(\"webhook-handle\"),...Ge,state:R,request:cs})]);var It=e.String.check(e.isPattern(/^[a-z][a-z0-9_]*(?:\\.[a-z][a-z0-9_]*)*$/u),e.isMaxLength(64)),ds=e.Union([e.String,e.Finite,e.Boolean]),us=e.Struct({maxDataBytes:e.Int.check(e.isGreaterThan(0)),maxEventsPerInvocation:e.Int.check(e.isGreaterThan(0)),maxDescriptionLength:e.Int.check(e.isGreaterThan(0)),maxIdLength:e.Int.check(e.isGreaterThan(0))}),ee=us.make({maxDataBytes:250*1024,maxEventsPerInvocation:100,maxDescriptionLength:1e3,maxIdLength:200}),ms=e.Struct({description:e.String.check(e.isMinLength(1),e.isMaxLength(ee.maxDescriptionLength)),filters:S,payload:S}),Zn=e.Record(It,ms),Zo=e.Struct({name:It,id:e.String.check(e.isMinLength(1),e.isMaxLength(ee.maxIdLength)),occurredAt:e.Int.check(e.isGreaterThanOrEqualTo(0)),data:R,filters:e.Record(e.String,ds),account:e.NullOr(F)}),Yn=e.Array(Zo).check(e.isMaxLength(ee.maxEventsPerInvocation));var ce={icons:8,characters:32*1024},Xn=/^(?:data:image\\/(?:svg\\+xml|png|webp|jpeg);base64,[A-Za-z0-9+/]*={0,2}|https:\\/\\/\\S+)$/u,hs=e.Struct({...se.fields,src:e.String.check(e.isPattern(Xn),e.isMaxLength(ce.characters))}),Yo=e.Array(hs).check(e.isMaxLength(ce.icons),e.makeFilter(t=>JSON.stringify(t).length<=ce.characters,{message:`An app's icons total at most ${ce.characters} characters`})),ea=t=>{if(!Array.isArray(t))return\"icons must be an array of { src, mimeType?, sizes?, theme? }\";if(t.length>ce.icons)return`An app declares at most ${ce.icons} icons; this one declares ${t.length}`;for(let[r,a]of t.entries()){let s=typeof a==\"object\"&&a!==null?a.src:void 0;if(typeof s!=\"string\"||!Xn.test(s))return`icons[${r}].src must be a base64 data:image/svg+xml, image/png, image/webp or image/jpeg URI, or an https: URL`}let o=JSON.stringify(t).length;return o>ce.characters?`An app's icons total at most 32 KiB; these take ${Math.ceil(o/1024)} KiB`:e.is(Yo)(t)?void 0:'Each icon is { src, mimeType?: string, sizes?: string[], theme?: \"light\" | \"dark\" }'};var fs=6e4,Xo=e.Int.check(e.isGreaterThan(0)),be=e.optionalKey(e.Never),ll=e.Union([e.Struct({seconds:Xo,minutes:be,hours:be}),e.Struct({seconds:be,minutes:Xo,hours:be}),e.Struct({seconds:be,minutes:be,hours:Xo})]),ys=e.Struct({expression:e.NonEmptyString,timezone:e.NonEmptyString}).check(e.makeFilter(t=>t.expression.trim().split(/\\s+/).length===5&&H.isSuccess(kr.parse(t.expression,t.timezone)))),er=e.Union([e.Struct({kind:e.Literal(\"interval\"),milliseconds:e.Int.check(e.makeFilter(t=>t>=fs,{message:\"Schedule intervals must be at least 60 seconds\"}),e.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER))}),e.Struct({kind:e.Literal(\"cron\"),calendar:ys})]),ta=e.Struct({name:e.NonEmptyString,scope:e.optionalKey(e.Literal(\"app\")),timing:er,input:R});var pe=class extends e.TaggedError()(\"McpError\",{phase:e.Literals([\"connect\",\"discover\",\"call\",\"schema\",\"transport\"]),reason:e.Literals([\"request\",\"unauthorized\",\"invalid_response\",\"timeout\",\"invalid_input\"]),status:e.optional(e.Number),upstream:e.optional(xe),session:e.optional(e.Literal(!0))}){},le=class extends e.TaggedError()(\"SkillLoadFailed\",{reason:e.Literals([\"source\",\"request\",\"rate_limited\",\"document\",\"limit\",\"changed\",\"encoding\"]),message:e.optional(e.String.check(e.isMaxLength(500))),status:e.optional(e.Int.check(e.isBetween({minimum:100,maximum:599}))),missing:e.optional(e.Literals([\"repository\",\"ref\"]))}){},Ss=e.String.check(e.isPattern(/^(\\*\\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*(?::[0-9]{1,5})?$/)),Qe={plain:e.optionalKey(e.Array(e.NonEmptyString)),raw:e.optionalKey(e.Array(e.NonEmptyString)),request:e.optionalKey(Br)},oa=e.Union([e.Struct({type:e.Literal(\"secrets\"),label:e.String,fields:S,...Qe}),e.Struct({type:e.Literal(\"oauth2\"),...Ue.members[0].fields,response:S,...Qe}),e.Struct({type:e.Literal(\"oauth2\"),...Ue.members[1].fields,response:S,...Qe}),e.Struct({type:e.Literal(\"oauth2\"),...Ue.members[2].fields,response:S,...Qe}),e.Struct({type:e.Literal(\"oauth2\"),...Ue.members[3].fields,response:S,...Qe})]),nr=e.Struct({name:e.NonEmptyString,auth:e.Record(e.NonEmptyString,oa),hosts:e.optionalKey(e.Array(Ss))}),ra=e.Struct({definition:nr,cardinality:e.Literals([\"one\",\"many\"]),health:e.optionalKey(e.Literal(!0))}),tr=e.Record(e.NonEmptyString,ra),xs=e.Struct({capabilities:e.optionalKey(e.Struct({skills:e.Literal(!0),toolIndex:e.optionalKey(e.Literal(!0)),skillSources:e.optionalKey(e.Literal(!0)),scheduledTools:e.optionalKey(e.Literal(!0)),sharedDefinitions:e.optionalKey(e.Literal(!0))})),database:e.optionalKey(Jn),accounts:e.Struct({app:tr,user:tr}),sql:e.optionalKey(e.Literal(!0)),events:e.optionalKey(Zn),icons:e.optionalKey(Yo)}),Ze=e.Struct({id:F,provider:nr,method:e.NonEmptyString,generation:e.optionalKey(e.Int),fields:S}),or=e.Record(e.NonEmptyString,e.Union([Ze,e.Array(Ze)])),na=e.Struct({app:or,user:e.optionalKey(or)}),aa=e.Struct({tool:e.NonEmptyString,input:R}),ia=e.Finite.check(e.isGreaterThanOrEqualTo(0)),Pe=e.Struct({schedules:e.optionalKey(e.Array(ta)),name:e.NonEmptyString,router:e.optionalKey(e.NonEmptyString),tags:e.optionalKey(e.Array(e.NonEmptyString)),description:e.String,inputSchema:S,readOnly:e.optionalKey(e.Boolean),title:e.optionalKey(e.String),outputSchema:e.optionalKey(S),annotations:e.optionalKey(Mt),_meta:e.optionalKey(S)}),sa=Pe.mapFields(({inputSchema:t,outputSchema:o,_meta:r,...a})=>a),G=class extends e.TaggedError()(\"HostDeclarationInvalid\",ct){},de=class extends e.TaggedError()(\"HostEvaluationFailed\",ct){},ca=e.Union([I,pe,le,G,de]),qt=e.Struct({path:e.String,title:e.optionalKey(e.String),description:e.optionalKey(e.String),icons:e.optionalKey(e.Array(se)),tags:e.optionalKey(e.Record(e.NonEmptyString,e.String)),skill:e.optionalKey(Jo),error:e.optionalKey(ca)}),gs=e.Struct({tools:e.Array(Pe),routers:e.Array(qt)}),ks=e.Struct({tools:e.Array(sa),routers:e.Array(qt)}),pa=e.Literals([\"inputSchema\",\"outputSchema\"]),la=e.Struct({...Pe.fields,shared:e.optionalKey(e.Array(pa))}),Rs=e.Struct({tools:e.Array(la),routers:e.Array(qt),definitions:e.Array(R),defs:e.Array(e.Record(e.String,e.Int))}),ar=e.Struct({skills:Bo,dynamic:e.Boolean,cached:e.optionalKey(e.Boolean)}),As=e.Union([ar,Bo]),rr=e.Literals([\"query\",\"mutation\"]),ws=e.Struct({operation:e.Literal(\"account-check\"),requirement:e.NonEmptyString}),Es=e.Struct({operation:e.Literal(\"migrate\")}),Cl=e.Array(e.Struct({id:e.Int,name:e.NonEmptyString})),da=e.Union([an,Qn,e.Struct({operation:e.Literal(\"requirements\")}),e.Struct({operation:e.Literal(\"inspect\"),detail:e.optionalKey(e.Literal(\"summary\")),tools:e.optionalKey(e.Array(e.NonEmptyString)),scheduled:e.optionalKey(e.Literal(!0)),definitions:e.optionalKey(e.Literal(\"shared\"))}),e.Struct({operation:e.Literal(\"skills\"),sources:e.optionalKey(e.Literal(!0))}),e.Struct({operation:e.Literal(\"query\"),name:e.NonEmptyString,input:R}),e.Struct({operation:e.Literal(\"mutate\"),name:e.NonEmptyString,input:R}),e.Struct({operation:e.Literal(\"call\"),tool:e.NonEmptyString,kind:e.optionalKey(rr),input:R}),ws,Es]),te=class extends e.TaggedError()(\"HostRequestInvalid\",{}){},ue=class extends e.TaggedError()(\"HostAccountsInvalid\",{}){},me=class extends e.TaggedError()(\"HostOperationNotFound\",{}){},he=class extends e.TaggedError()(\"HostOperationFailed\",ct){},Oe=class extends e.TaggedError()(\"HostToolNotFound\",{}){},Ce=class extends e.TaggedError()(\"HostKindMismatch\",{tool:e.NonEmptyString,requested:rr,actual:rr}){},ua=e.String.check(e.isMaxLength(512)),ma=10,Me=class extends e.TaggedError()(\"HostInputInvalid\",{problems:e.optionalKey(e.Array(ua).check(e.isMaxLength(ma)))}){},De=class extends e.TaggedError()(\"HostToolBlocked\",{}){},Ie=class extends e.TaggedError()(\"HostToolApprovalRequired\",{input:R,elicitation:Ln}){},qe=class extends e.TaggedError()(\"HostToolPolicyFailed\",{}){},fe=class extends e.TaggedError()(\"HostOutputInvalid\",{}){},ha=e.Union([Ee,I,pe,le,z,te,ue,G,de,me,he,ve,Te,Oe,Me,fe,De,Ie,qe,ie,Ce]),vs=e.Union([e.Struct({ok:e.Literal(!0),value:R,toolError:e.optionalKey(e.Literal(!0)),events:e.optionalKey(Yn)}),e.Struct({ok:e.Literal(!1),error:ha})]),Ts=e.Struct({command:da,accounts:na,approval:e.optionalKey(aa),replay:e.optionalKey(nn),deadline:e.optionalKey(ia),workflowRun:e.optionalKey(ne)});var fa=(t,o,r)=>{o===\"__proto__\"?Object.defineProperty(t,o,{value:r,enumerable:!0,writable:!0,configurable:!0}):t[o]=r},bs=t=>typeof t==\"object\"&&t!==null&&!Array.isArray(t),ya=t=>{let o=t?.$defs;return bs(o)?o:void 0};var ql=t=>{let o=[],r=new Map,a=E=>{let T=r.get(E);return T===void 0&&r.set(E,T=o.push(E)-1),T},s=[],p=new Map,d=0,l=(E,T)=>{let P=p.get(E);P===void 0&&p.set(E,P=new Map);let Se=P.get(T);return Se===void 0&&P.set(T,Se=d++),Se},c=new Map,m=new Map,x=E=>{let T=c.get(E);if(T!==void 0)return T;let P={},Se=[];for(let[ur,va]of Object.entries(E)){let mr=a(va);fa(P,ur,mr),Se.push(l(ur,mr))}let dr=Se.join(\",\"),et=m.get(dr);return et===void 0&&m.set(dr,et=s.push(P)-1),c.set(E,et),et},ye=E=>{let T=ya(E);return E===void 0||T===void 0?void 0:{...E,$defs:x(T)}};return{tools:t.tools.map(E=>{let T=ye(E.inputSchema),P=ye(E.outputSchema);return T===void 0&&P===void 0?E:{...E,...T===void 0?{}:{inputSchema:T},...P===void 0?{}:{outputSchema:P},shared:[...T===void 0?[]:[\"inputSchema\"],...P===void 0?[]:[\"outputSchema\"]]}}),routers:t.routers,definitions:o,defs:s}};var Sa=e.Struct({...Ze.fields,managed:e.optionalKey(e.Literal(!0))}),xa=e.Record(e.NonEmptyString,e.Union([Sa,e.Array(Sa)])),$l=e.Struct({app:xa,user:e.optionalKey(xa)}),jl=t=>[...Object.entries(t.app),...Object.entries(t.user??{})];var Jl=e.Union([te,G,Te]),Os=e.Union([I,pe,le,te,G,ue,de]),Bl=e.Union([Ee,z,Os,Oe,me,Ce,he,ve,Me,fe,De,Ie,qe,ie]),zl=e.Union([I,z,te,G,ue,me,he,fe]);var Vl=tt.Reference(\"apps/ToolResultObservation\",{defaultValue:()=>({failed:()=>{}})}),Gl=e.Struct({elapsedMs:e.Finite,upstreamMs:e.Finite,elicitationMs:e.Finite,authoredMs:e.Finite,leaseMs:e.optionalKey(e.Finite),backgroundMs:e.optionalKey(e.Finite)}),Ql=tt.Reference(\"apps/InvocationTimingSink\",{defaultValue:()=>()=>{}});var Ye=t=>({[St]:t}),Le=t=>{if(!(typeof t!=\"object\"||t===null||!(St in t)))return t[St]},Cs=t=>ke(t)??Le(t),Ms=t=>{if(t===void 0)return;let o=Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0));return Object.keys(o).length===0?void 0:e.decodeUnknownSync(Go)(o)},ga=(t,o)=>t===void 0?o:o===void 0?t:{...t,...o};function md(t,o){let r=Ms(o),a=Le(t);if(a!==void 0)return Ye(a.kind===\"router\"?{...a,...ka(ga(a.meta,r))}:{...a,...Ds(ga(a.overrides,r))});let s={};for(let[p,d]of Object.entries(t)){if(Vo.has(p))throw new Error(`Router key \"${p}\" is reserved`);if(!e.is(Bn)(p))throw new Error(`Router key \"${p}\" must start with a letter or _ and contain no dots`);let l=Cs(d);if(l===void 0)throw new Error(`Router key \"${p}\" must be a query, mutation or router`);s[p]=l}return Ye({kind:\"router\",...ka(r),children:s})}var ka=t=>t===void 0?{}:{meta:t},Ds=t=>t===void 0?{}:{overrides:t},hd=t=>{let o=t.meta;return Ye({kind:\"dynamic\",...o===void 0?{}:{meta:()=>C(async()=>o(),\"router\")().pipe(h.flatMap(r=>e.decodeUnknownEffect(Go)(r)))},list:()=>C(async()=>t.list(),\"router\")().pipe(h.flatMap(e.decodeUnknownEffect(e.Array(Pe)))),resolve:r=>C(async()=>t.resolve(r),\"router\")().pipe(h.map(a=>{if(a===void 0)return;let s=ke(a);if(s===void 0)throw new Error(\"Expected an operation declaration\");return s}))})},Xe=(t,o)=>t===\"\"?o:`${t}.${o}`,fd=(t,o)=>{if(t?.kind===\"dynamic\")return{kind:\"dynamic\",source:t,router:\"\",name:o};let r=t,a=\"\",s=o;for(;r!==void 0;){let p=s.indexOf(\".\"),d=p<0?s:s.slice(0,p),l=Object.hasOwn(r.children,d)?r.children[d]:void 0;if(l===void 0)return;let c=p<0?void 0:s.slice(p+1);switch(l.kind){case\"query\":case\"mutation\":return c===void 0?{kind:\"operation\",operation:l,router:a}:void 0;case\"dynamic\":return c===void 0||c===\"\"?void 0:{kind:\"dynamic\",source:l,router:Xe(a,d),name:c};case\"router\":if(c===void 0)return;r=l,a=Xe(a,d),s=c}}},ir=(t,o=\"\")=>Object.entries(t?.children??{}).flatMap(([r,a])=>{let s=Xe(o,r);switch(a.kind){case\"query\":case\"mutation\":return[{name:s,router:o,operation:a}];case\"router\":return ir(a,s);case\"dynamic\":return[]}}),yd=(t,o)=>{let r=Le(t);if(r===void 0)throw new Error(\"withApprovals expects a router\");let a=(d,l)=>{let c=o(oo(d),l);return c===void 0?d:ro(d,c)},s=(d,l)=>{switch(d.kind){case\"query\":case\"mutation\":return a(d,l);case\"router\":case\"dynamic\":return p(d,l)}},p=(d,l)=>d.kind===\"dynamic\"?{...d,resolve:c=>d.resolve(c).pipe(h.flatMap(m=>m===void 0?h.succeed(void 0):h.try({try:()=>a(m,Xe(l,c)),catch:x=>x})))}:{...d,children:Object.fromEntries(Object.entries(d.children).map(([c,m])=>[c,s(m,Xe(l,c))]))};return Ye(p(r,\"\"))},Sd=(t,o)=>{let r=Le(t);if(r?.kind!==\"dynamic\")throw new Error(\"renameTools expects a protocol router\");let a=l=>{let c=new Set;return l.flatMap(m=>{let x=o(m.name);return x===void 0||c.has(x)?[]:(c.add(x),[{...m,name:x,source:m.name}])})},s=r.summaries??r.list,p=l=>s().pipe(h.map(c=>a(c).find(m=>m.name===l)?.source)),d=({source:l,...c})=>c;return Ye({...r,list:()=>r.list().pipe(h.map(l=>a(l).map(d))),...r.summaries===void 0?{}:{summaries:()=>s().pipe(h.map(l=>a(l).map(d)))},describe:l=>p(l).pipe(h.flatMap(c=>c===void 0?h.succeed(void 0):r.describe?.(c)??r.list().pipe(h.map(m=>m.find(x=>x.name===c)))),h.map(c=>c===void 0?void 0:{...c,name:l})),resolve:l=>p(l).pipe(h.flatMap(c=>c===void 0?h.succeed(void 0):r.resolve(c)))})};var sr=Symbol(\"apps.Workflow\"),Rd=(t,o)=>({[sr]:{input:N(j(t.input,\"The workflow input\")),...t.output===void 0?{}:{output:N(j(t.output,\"The workflow output\"))},...t.description===void 0?{}:{description:t.description},run:(r,a)=>C(o,\"workflow\")(r,a)}}),Ra=t=>{if(!(typeof t!=\"object\"||t===null||!(sr in t)))return t[sr]};var cr=Symbol(\"apps.Event\"),Is=new Set([\"string\",\"number\",\"integer\",\"boolean\"]),qs=t=>{let o=t.type;if(typeof o==\"string\")return Is.has(o);let r=Array.isArray(t.enum)?t.enum:\"const\"in t?[t.const]:void 0;return r!==void 0&&r.length>0&&r.every(a=>[\"string\",\"number\",\"boolean\"].includes(typeof a))},Td=t=>{let o=t.filters??{},r=Object.fromEntries(Object.entries(o).map(([a,s])=>[a,N(j(s,`The event filter ${JSON.stringify(a)}`))]));for(let[a,s]of Object.entries(r)){let p=h.runSync(st(s));if(!qs(p))throw new TypeError(`The event filter ${JSON.stringify(a)} must be a string, number, boolean or literal`)}return{[cr]:{description:t.description,filters:r,payload:N(j(t.payload,\"The event payload\"))},description:t.description,filters:o,payload:t.payload}},Aa=t=>typeof t==\"object\"&&t!==null&&cr in t?t[cr]:void 0,bd=t=>h.forEach(Object.entries(t),([o,r])=>h.gen(function*(){let a=yield*st(e.Struct(r.filters)),s=yield*st(r.payload);return[o,{description:r.description,filters:a,payload:s}]})).pipe(h.map(o=>Object.fromEntries(o))),Od=t=>({emit:(o,r,...a)=>{let s=a[0]??{},p=Object.hasOwn(t.events,o)?t.events[o]:void 0;if(p===void 0)throw new TypeError(`This app declares no event named \"${o}\"`);if(t.emitted.length>=ee.maxEventsPerInvocation)throw new RangeError(`An invocation can emit at most ${ee.maxEventsPerInvocation} events`);let d=e.decodeUnknownSync(p.payload)(r),l=e.decodeUnknownSync(e.Struct(p.filters))(s.filters??{}),c=s.account??t.sourceAccount??(t.attributable.length===1?t.attributable[0]:void 0)??null;if(c===null&&t.attributable.length>1)throw new TypeError(\"This invocation has several accounts; name the one the event came from with { account }\");if(c!==null&&!t.accounts.includes(c))throw new TypeError(\"The event's account is not one of this invocation's accounts\");let m=s.occurredAt===void 0?Date.now():s.occurredAt instanceof Date?s.occurredAt.getTime():s.occurredAt,x=e.decodeUnknownSync(Zo)({name:e.decodeUnknownSync(It)(o),id:s.id??crypto.randomUUID(),occurredAt:m,data:d,filters:l,account:c});if(new TextEncoder().encode(JSON.stringify(x.data)).byteLength>ee.maxDataBytes)throw new RangeError(`An event's data can be at most ${ee.maxDataBytes} bytes of JSON; send a summary and a tool to read the rest`);t.emitted.push(x)}});var pr=Symbol(\"apps.App\"),Hd=t=>typeof t==\"object\"&&t!==null&&pr in t,Wd=t=>t[pr];function wa(t){if(\"queries\"in t||\"mutations\"in t)throw new Error(\"Put queries and mutations in a router under tools\")}function Ps(t){wa(t);let o=t.webhooks===void 0?{}:{webhooks:Object.fromEntries(Object.entries(t.webhooks).map(([c,m])=>[c,{...m,...m.register===void 0?{}:{register:C(ut(m,\"register\"),\"webhook\")},handle:C(ut(m,\"handle\"),\"webhook\"),...m.unregister===void 0?{}:{unregister:C(ut(m,\"unregister\"),\"webhook\")},...\"config\"in m&&zt(m.config)?{config:N(m.config)}:{},...\"state\"in m&&zt(m.state)?{state:N(m.state)}:{}}]))},r=t.workflows===void 0?{}:{workflows:Object.fromEntries(Object.entries(t.workflows).map(([c,m])=>{let x=Ra(m);if(x===void 0)throw new Error(\"Invalid workflow declaration\");return[c,x]}))},a=t.tools===void 0?void 0:Le(t.tools);if(t.tools!==void 0&&a===void 0)throw new Error(\"tools must be a router\");let s=a===void 0?{}:{tools:a},p=a?.kind===\"router\"?ir(a):[],d=new Set;for(let{operation:c}of p)if(c.kind===\"mutation\"){if(d.has(c))throw new Error(\"A mutation can be mounted at only one path in tools\");d.add(c)}let l=t.schedules===void 0?{}:{schedules:Object.fromEntries(Object.entries(t.schedules).map(([c,m])=>{let x=ke(m.operation),ye=p.find(({operation:Pt})=>Pt===x&&Pt.kind===\"mutation\");if(ye===void 0)throw new Error(\"A schedule must reference a mutation in this app's tools\");if(m.scope===\"app\"&&ye.operation.approval!==void 0)throw new Error(\"An app schedule must reference a mutation without an approval\");return[c,{...m.scope===\"app\"?{scope:\"app\"}:{},timing:e.decodeUnknownSync(er)(m.timing),input:e.decodeUnknownSync(R)(m.input),tool:ye.name}]}))};return{...t,...o,...r,...s,...l}}function Ls(t){if(\"accounts\"in t)throw new TypeError(\"Declare account requirements by scope: user: { accounts } for each caller's accounts, app: { accounts } for the app's own\");let o=t.app?.accounts??{},r=t.user?.accounts??{};for(let a of Object.keys(o))if(Object.hasOwn(r,a))throw new TypeError(`The requirement ${JSON.stringify(a)} is declared as both an app and a user account; name them differently`);return{app:o,user:r}}var Ud=(t,o)=>{let r=Ls(t);typeof o!=\"function\"&&wa(o);let s=C(typeof o==\"function\"?o:async()=>o,\"factory\"),p=t.events===void 0?void 0:Object.fromEntries(Object.entries(t.events).map(([c,m])=>{let x=Aa(m);if(x===void 0)throw new TypeError(`The event ${JSON.stringify(c)} must be declared with event()`);return[c,x]})),d=t.icons===void 0?void 0:ea(t.icons);if(d!==void 0)throw new TypeError(`The app's icons are invalid: ${d}`);let l={accounts:r,...p===void 0?{}:{events:p},...t.icons===void 0||t.icons.length===0?{}:{icons:t.icons},evaluate:c=>s(c).pipe(h.map(m=>Ps(m)))};return{[pr]:l,accounts:l.accounts,evaluate:c=>h.runPromise(s(c))}};var lr=e.String.check(e.isPattern(/^[A-Za-z0-9._-]{1,128}$/u)),zd=e.Struct({error:e.Struct({code:e.Union([e.Int,lr]),message:e.String})}),Vd=e.Struct({error:lr,error_description:e.optional(e.String)}),Fs=t=>t.length<=We?t:`${t.slice(0,We-1)}\\u2026`,Gd=t=>t.length===We&&t.endsWith(\"\\u2026\"),Ns=(t,o)=>({code:t,...o===void 0||o===\"\"?{}:{message:Fs(o)}});var Ks=/([A-Za-z][A-Za-z0-9_-]*)\\s*=\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|([^\\s,\"]+))/g,Ea=t=>{let o=t===void 0?-1:t.search(/\\bBearer\\b/i);if(t===void 0||o===-1)return;let r=new Map;for(let[,s,p,d]of t.slice(o+6).matchAll(Ks))s!==void 0&&!r.has(s.toLowerCase())&&r.set(s.toLowerCase(),p?.replace(/\\\\(.)/g,\"$1\")??d??\"\");let a=e.decodeUnknownOption(lr)(r.get(\"error\"));return Q.isNone(a)?void 0:Ns(a.value,r.get(\"error_description\"))};var oe=({reason:t,status:o,accountId:r,phase:a,upstream:s})=>new I({reason:t,...o===void 0?{}:{status:o},...r===void 0?{}:{accountId:r},...a===void 0?{}:{phase:a},...s===void 0?{}:{upstream:s}});function _s(t){return e.decodeUnknownOption(I)(t).pipe(Q.map(oe))}function tu(t,o={}){let r=Ea(o[\"www-authenticate\"]);if(t>=500&&t<=599)return oe({reason:\"unavailable\",status:t,upstream:r});if(t===401)return oe({reason:\"unauthorized\",status:t,upstream:r});if(t===429)return oe({reason:\"rate_limited\",status:t,upstream:r});if(t!==403)return;let a=o[\"retry-after\"];return o[\"x-ratelimit-remaining\"]===\"0\"||a!==void 0&&(/^\\d+$/.test(a)||Number.isFinite(Date.parse(a)))?oe({reason:\"rate_limited\",status:t,upstream:r}):typeof r?.code==\"string\"&&r.code.toLowerCase()===\"insufficient_scope\"?oe({reason:\"forbidden\",status:t,upstream:r}):oe({reason:\"rejected\",status:t,upstream:r})}function ou(t,o){let r=_s(t),a=e.decodeUnknownOption(F)(o);return Q.isNone(r)||Q.isNone(a)?t:oe({...r.value,accountId:a.value})}export{Ta as a,Oa as b,Ca as c,Ma as d,Da as e,We as f,I as g,pt as h,zs as i,Vs as j,La as k,Fa as l,Zs as m,Pr as n,Qt as o,ec as p,lt as q,tc as r,Fr as s,Nr as t,Kr as u,Ue as v,pc as w,Wr as x,ja as y,Ur as z,Yt as A,Ja as B,C,ut as D,mc as E,Gr as F,to as G,Ya as H,Xr as I,Mc as J,Dc as K,Ic as L,qc as M,Pc as N,oo as O,ke as P,Kc as Q,_c as R,Hc as S,Wc as T,Gd as U,oe as V,_s as W,tu as X,ou as Y,Un as Z,Ki as _,jo as $,Jo as aa,_i as ba,Hi as ca,gp as da,Bo as ea,Wn as fa,Ji as ga,Ee as ha,B as ia,oi as ja,no as ka,ri as la,z as ma,tn as na,rn as oa,Vc as pa,nn as qa,qp as ra,Pp as sa,qn as ta,Pn as ua,ie as va,lp as wa,Mt as xa,Qo as ya,zn as za,ss as Aa,Xp as Ba,ps as Ca,el as Da,ll as Ea,ys as Fa,er as Ga,pe as Ha,le as Ia,nr as Ja,xs as Ka,na as La,aa as Ma,ia as Na,Pe as Oa,sa as Pa,G as Qa,de as Ra,qt as Sa,Rs as Ta,da as Ua,te as Va,ue as Wa,me as Xa,he as Ya,Oe as Za,Ce as _a,ma as $a,Me as ab,De as bb,Ie as cb,qe as db,fe as eb,ha as fb,ql as gb,jl as hb,Vl as ib,Ql as jb,Ye as kb,Le as lb,ga as mb,md as nb,hd as ob,Xe as pb,fd as qb,ir as rb,yd as sb,Sd as tb,Rd as ub,Td as vb,bd as wb,Od as xb,Hd as yb,Wd as zb,Ud as Ab};\n","node_modules/apps/chunk-3SCWQGZI.js":"import{$ as xt,$b as ve,$e as mi,$f as qr,$g as Uu,A as ht,Aa as he,Ab as Yd,Ac as ff,Ad as _f,Af as l,Ag as bn,Bb as to,Bc as uf,Bd as $f,Bg as Tu,C as yt,Ca as Or,Cb as Xa,Cc as yn,Cd as Ff,Ce as uo,Cg as Vr,D as Sd,Da as Ja,Db as ys,Dc as pf,Dd as oi,Dg as gi,E as ce,Eb as Ar,Ec as lf,Ed as Cs,Eg as zt,F as st,Fb as Xd,Fc as Qa,Fd as Df,Fe as ui,Ff as ou,Fg as dt,G as Na,Gb as cr,Gc as mf,Gd as ze,Ge as po,Gg as ye,H as Cr,Ha as Pd,Hb as z,Hc as Et,Hd as fe,He as Br,Hf as su,Hg as xi,I as Xe,Ia as vd,Ib as qt,Ic as fr,Id as Mr,Ig as Ru,J as ja,Ja as ae,Jb as ro,Jc as hf,Jd as Bf,Je as gn,Jg as ke,Kb as Zd,Kc as ei,Kd as _r,Ke as lo,Kg as Cu,L as un,La as Wa,Ld as ks,Le as pi,Lg as ku,M as Ed,Ma as Hd,Mb as Qd,Md as $r,Mg as Bs,N as bd,Na as ms,Nb as ef,Nd as et,Ne as Kf,Ng as wn,Oa as Id,Ob as tf,Oc as yf,Od as si,Of as Us,Og as Si,P as le,Pa as Ud,Pb as gs,Pd as Lf,Pe as mo,Pf as au,Pg as ur,Qa as De,Qb as rf,Qc as Vt,Qd as Ce,Qe as Yf,Qf as iu,Qg as Ou,R as kr,Ra as Md,Rc as gf,Rd as oo,Re as He,Rf as cu,Rg as Au,S as wd,Sa as _d,Sb as nf,Sc as xf,Sd as Nf,Sf as du,Sg as Pu,Tb as Re,Tc as ti,Td as jf,Te as li,Tg as vu,Ua as $d,Ub as Pr,Uc as Sf,Ud as qf,Ue as Je,Uf as fu,Va as Fd,Vb as of,Vc as Ef,Vd as Vf,Vf as hi,W as ee,Wb as xs,Wc as bf,Wd as Fr,Wf as Ms,Wg as Hu,X as se,Xc as wf,Xf as uu,Xg as Iu,Y as Zn,Yb as Pe,Yc as Tf,Ye as Lr,Yf as pu,Yg as pr,Z as gt,Zb as v,Zc as Rf,Ze as Xf,_ as sr,_a as Ga,_d as so,_e as ho,_f as jr,a as Fe,aa as Td,ab as Dd,ac as Le,ae as Os,af as Ie,ag as lu,ah as Mu,b,ba as qa,bb as Bd,bc as de,bd as at,be as ao,bg as xo,bh as Ls,c as ot,ca as ar,cg as _s,d as dn,da as St,db as Ld,dd as Ve,df as Hs,e as La,ea as Ae,eb as Nd,ec as Ze,ed as Cf,eg as it,f as hd,fa as J,fb as jd,fc as q,fd as ri,fe as ai,fg as yi,g as ss,ga as Rd,gb as Be,gc as vr,ge as ii,gf as Zf,gg as $s,ha as ds,hb as qd,hc as Qe,he as bt,hg as mu,i as as,ia as fs,ic as Hr,ie as io,ig as hu,j as yd,ja as us,jb as Vd,jc as Ir,je as zf,k as gd,ka as Cd,kb as Ka,kc as k,kd as m,ke as As,kg as yu,l as Q,lc as ln,ld as kf,le as Jf,lf as Is,lg as Sn,ma as ir,mc as mn,md as ni,me as Ps,mf as yo,mg as So,n as xd,na as Va,nb as Ht,nc as _,nd as Of,ne as ci,nf as Qf,o as oe,oa as kd,oc as Ss,od as Af,oe as di,of as go,og as gu,pa as Qn,pb as zd,pe as Wf,pf as eu,pg as xu,qb as Jd,qc as sf,qd as ws,qe as Dr,qg as Su,ra as pn,rb as eo,rc as af,rd as no,re as vs,rf as tu,rg as Fs,sa as za,sc as Es,sd as Ts,sg as Eu,tb as Ya,tc as cf,td as Rs,tf as ru,tg as bu,ua as Od,uc as hn,ud as Pf,ue as Gf,va as ps,vc as Ur,vd as vf,ve as fi,vf as nu,w as fn,wb as Wd,wc as dr,wd as Hf,wf as Nr,wg as Ds,x as is,xa as ls,xb as Gd,xc as df,xd as If,xe as co,xf as xn,xg as En,y as Xn,ya as Ad,yb as hs,yc as Za,yd as Uf,ye as fo,yg as wu,z as cs,za as ie,zb as Kd,zc as bs,zd as Mf,zg as ct}from\"./chunk-MN25OBZU.js\";import{a as Te}from\"./chunk-WOT6VMZA.js\";var Jm=l.Json,Ei=l.Record(l.String,Jm),bb=l.String.pipe(l.check(l.isStartingWith(\"acc_\"),l.isMinLength(5)),l.brand(\"acc\")),wb=l.String.check(l.makeFilter(e=>{try{let t=new URL(e);return t.protocol===\"https:\"||t.protocol===\"http:\"}catch{return!1}})),Wm=l.Struct({path:l.Array(l.String),message:l.String}),Ns=class extends l.TaggedError()(\"DeclarationInvalid\",{declaration:l.String,issues:l.Array(Wm)}){get message(){let t=this.issues.map(r=>r.path.length===0?r.message:`${r.path.join(\".\")}: ${r.message}`);return`The ${this.declaration} declaration is invalid. ${t.join(\"; \")}`}},ft=class extends l.TaggedError()(\"ValidationError\",{}){get message(){return\"Value did not match the schema\"}};function lr(e,t){let r=typeof e;if(r!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let o=0;o<n;o++)if(!lr(e[o],t[o]))return!1;return!0}if(r===\"object\"){if(!e||!t)return e===t;let n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let s of n)if(!lr(e[s],t[s]))return!1;return!0}return e===t}function We(e){return encodeURI(Gm(e))}function Gm(e){return e.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}var Km={additionalItems:!0,unevaluatedItems:!0,items:!0,contains:!0,additionalProperties:!0,unevaluatedProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Ym={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Xm={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Zm={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!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},Qm=typeof self<\"u\"&&self.location&&self.location.origin!==\"null\"?new URL(self.location.origin+self.location.pathname+location.search):new URL(\"https://github.com/cfworker\");function wt(e,t=Object.create(null),r=Qm,n=\"\"){if(e&&typeof e==\"object\"&&!Array.isArray(e)){let a=e.$id||e.id;if(a){let s=new URL(a,r.href);s.hash.length>1?t[s.href]=e:(s.hash=\"\",n===\"\"?r=s:wt(e,t,r))}}else if(e!==!0&&e!==!1)return t;let o=r.href+(n?\"#\"+n:\"\");if(t[o]!==void 0)throw new Error(`Duplicate schema URI \"${o}\".`);if(t[o]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,\"__absolute_uri__\",{enumerable:!1,value:o}),e.$ref&&e.__absolute_ref__===void 0){let a=new URL(e.$ref,r.href);a.hash=a.hash,Object.defineProperty(e,\"__absolute_ref__\",{enumerable:!1,value:a.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let a=new URL(e.$recursiveRef,r.href);a.hash=a.hash,Object.defineProperty(e,\"__absolute_recursive_ref__\",{enumerable:!1,value:a.href})}if(e.$anchor){let a=new URL(\"#\"+e.$anchor,r.href);t[a.href]=e}for(let a in e){if(Zm[a])continue;let s=`${n}/${We(a)}`,i=e[a];if(Array.isArray(i)){if(Ym[a]){let c=i.length;for(let d=0;d<c;d++)wt(i[d],t,r,`${s}/${d}`)}}else if(Xm[a])for(let c in i)wt(i[c],t,r,`${s}/${We(c)}`);else if(Km[a])wt(i,t,r,s);else if(a===\"dependencies\"&&i&&typeof i==\"object\")for(let c in i)Array.isArray(i[c])||wt(i[c],t,r,`${s}/${We(c)}`)}return t}var eh=/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/,th=[0,31,28,31,30,31,30,31,31,30,31,30,31],rh=/^(\\d\\d):(\\d\\d):(\\d\\d)(\\.\\d+)?(z|[+-]\\d\\d(?::?\\d\\d)?)?$/i,nh=/^(?=.{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,oh=/^(?:[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,sh=/^(?:(?:[^\\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,ah=/^(?:(?:https?|ftp):\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!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-z\\u{00a1}-\\u{ffff}0-9]+-?)*[a-z\\u{00a1}-\\u{ffff}0-9]+)(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}0-9]+-?)*[a-z\\u{00a1}-\\u{ffff}0-9]+)*(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?$/iu,ih=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,ch=/^(?:\\/(?:[^~/]|~0|~1)*)*$/,dh=/^#(?:\\/(?:[a-z0-9_\\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,fh=/^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/,uh=e=>{if(e[0]==='\"')return!1;let[t,r,...n]=e.split(\"@\");return!t||!r||n.length!==0||t.length>64||r.length>253||t[0]===\".\"||t.endsWith(\".\")||t.includes(\"..\")||!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:r.split(\".\").every(o=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},ph=/^(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$/,lh=/^((([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,mh=e=>e.length>1&&e.length<80&&(/^P\\d+([.,]\\d+)?W$/.test(e)||/^P[\\dYMDTHS]*(\\d[.,]\\d+)?[YMDHS]$/.test(e)&&/^P([.,\\d]+Y)?([.,\\d]+M)?([.,\\d]+D)?(T([.,\\d]+H)?([.,\\d]+M)?([.,\\d]+S)?)?$/.test(e));function It(e){return e.test.bind(e)}var bi={date:_u,time:$u.bind(void 0,!1),\"date-time\":gh,duration:mh,uri:Eh,\"uri-reference\":It(oh),\"uri-template\":It(sh),url:It(ah),email:uh,hostname:It(nh),ipv4:It(ph),ipv6:It(lh),regex:wh,uuid:It(ih),\"json-pointer\":It(ch),\"json-pointer-uri-fragment\":It(dh),\"relative-json-pointer\":It(fh)};function hh(e){return e%4===0&&(e%100!==0||e%400===0)}function _u(e){let t=e.match(eh);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&hh(r)?29:th[n])}function $u(e,t){let r=t.match(rh);if(!r)return!1;let n=+r[1],o=+r[2],a=+r[3],s=!!r[5];return(n<=23&&o<=59&&a<=59||n==23&&o==59&&a==60)&&(!e||s)}var yh=/t|\\s/i;function gh(e){let t=e.split(yh);return t.length==2&&_u(t[0])&&$u(!0,t[1])}var xh=/\\/|:/,Sh=/^(?:[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 Eh(e){return xh.test(e)&&Sh.test(e)}var bh=/[^\\\\]\\\\Z/;function wh(e){if(bh.test(e))return!1;try{return new RegExp(e,\"u\"),!0}catch{return!1}}var Fu;(function(e){e[e.Flag=1]=\"Flag\",e[e.Basic=2]=\"Basic\",e[e.Detailed=4]=\"Detailed\"})(Fu||(Fu={}));function Du(e){let t=0,r=e.length,n=0,o;for(;n<r;)t++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<r&&(o=e.charCodeAt(n),(o&64512)==56320&&n++);return t}function X(e,t,r=\"2019-09\",n=wt(t),o=!0,a=null,s=\"#\",i=\"#\",c=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:s,keyword:\"false\",keywordLocation:s,error:\"False boolean schema.\"}]};let d=typeof e,p;switch(d){case\"boolean\":case\"number\":case\"string\":p=d;break;case\"object\":e===null?p=\"null\":Array.isArray(e)?p=\"array\":p=\"object\";break;default:throw new Error(`Instances of \"${d}\" type are not supported.`)}let{$ref:f,$recursiveRef:h,$recursiveAnchor:y,type:u,const:g,enum:x,required:C,not:L,anyOf:F,allOf:O,oneOf:H,if:D,then:S,else:A,format:B,properties:j,patternProperties:N,additionalProperties:re,unevaluatedProperties:me,minProperties:Oe,maxProperties:Kn,propertyNames:ts,dependentRequired:lt,dependentSchemas:Yn,dependencies:T,prefixItems:Bt,items:_e,additionalItems:mt,unevaluatedItems:G,contains:Z,minContains:Y,maxContains:pe,minItems:$e,maxItems:we,uniqueItems:nr,minimum:Lt,maximum:Nt,exclusiveMinimum:or,exclusiveMaximum:nt,multipleOf:jt,minLength:cn,maxLength:rs,pattern:pd,__absolute_ref__:ns,__absolute_recursive_ref__:zm}=t,w=[];if(y===!0&&a===null&&(a=t),h!==void 0){let I=a===null?n[zm]:a,P=`${i}/$recursiveRef`,$=X(e,a===null?t:a,r,n,o,I,s,P,c);$.valid||w.push({instanceLocation:s,keyword:\"$recursiveRef\",keywordLocation:P,error:\"A subschema had errors.\"},...$.errors)}if(f!==void 0){let P=n[ns||f];if(P===void 0){let E=`Unresolved $ref \"${f}\".`;throw ns&&ns!==f&&(E+=`  Absolute URI \"${ns}\".`),E+=`\nKnown schemas:\n- ${Object.keys(n).join(`\n- `)}`,new Error(E)}let $=`${i}/$ref`,R=X(e,P,r,n,o,a,s,$,c);if(R.valid||w.push({instanceLocation:s,keyword:\"$ref\",keywordLocation:$,error:\"A subschema had errors.\"},...R.errors),r===\"4\"||r===\"7\")return{valid:w.length===0,errors:w}}if(Array.isArray(u)){let I=u.length,P=!1;for(let $=0;$<I;$++)if(p===u[$]||u[$]===\"integer\"&&p===\"number\"&&e%1===0&&e===e){P=!0;break}P||w.push({instanceLocation:s,keyword:\"type\",keywordLocation:`${i}/type`,error:`Instance type \"${p}\" is invalid. Expected \"${u.join('\", \"')}\".`})}else u===\"integer\"?(p!==\"number\"||e%1||e!==e)&&w.push({instanceLocation:s,keyword:\"type\",keywordLocation:`${i}/type`,error:`Instance type \"${p}\" is invalid. Expected \"${u}\".`}):u!==void 0&&p!==u&&w.push({instanceLocation:s,keyword:\"type\",keywordLocation:`${i}/type`,error:`Instance type \"${p}\" is invalid. Expected \"${u}\".`});if(g!==void 0&&(p===\"object\"||p===\"array\"?lr(e,g)||w.push({instanceLocation:s,keyword:\"const\",keywordLocation:`${i}/const`,error:`Instance does not match ${JSON.stringify(g)}.`}):e!==g&&w.push({instanceLocation:s,keyword:\"const\",keywordLocation:`${i}/const`,error:`Instance does not match ${JSON.stringify(g)}.`})),x!==void 0&&(p===\"object\"||p===\"array\"?x.some(I=>lr(e,I))||w.push({instanceLocation:s,keyword:\"enum\",keywordLocation:`${i}/enum`,error:`Instance does not match any of ${JSON.stringify(x)}.`}):x.some(I=>e===I)||w.push({instanceLocation:s,keyword:\"enum\",keywordLocation:`${i}/enum`,error:`Instance does not match any of ${JSON.stringify(x)}.`})),L!==void 0){let I=`${i}/not`;X(e,L,r,n,o,a,s,I).valid&&w.push({instanceLocation:s,keyword:\"not\",keywordLocation:I,error:'Instance matched \"not\" schema.'})}let os=[];if(F!==void 0){let I=`${i}/anyOf`,P=w.length,$=!1;for(let R=0;R<F.length;R++){let E=F[R],M=Object.create(c),U=X(e,E,r,n,o,y===!0?a:null,s,`${I}/${R}`,M);w.push(...U.errors),$=$||U.valid,U.valid&&os.push(M)}$?w.length=P:w.splice(P,0,{instanceLocation:s,keyword:\"anyOf\",keywordLocation:I,error:\"Instance does not match any subschemas.\"})}if(O!==void 0){let I=`${i}/allOf`,P=w.length,$=!0;for(let R=0;R<O.length;R++){let E=O[R],M=Object.create(c),U=X(e,E,r,n,o,y===!0?a:null,s,`${I}/${R}`,M);w.push(...U.errors),$=$&&U.valid,U.valid&&os.push(M)}$?w.length=P:w.splice(P,0,{instanceLocation:s,keyword:\"allOf\",keywordLocation:I,error:\"Instance does not match every subschema.\"})}if(H!==void 0){let I=`${i}/oneOf`,P=w.length,$=H.filter((R,E)=>{let M=Object.create(c),U=X(e,R,r,n,o,y===!0?a:null,s,`${I}/${E}`,M);return w.push(...U.errors),U.valid&&os.push(M),U.valid}).length;$===1?w.length=P:w.splice(P,0,{instanceLocation:s,keyword:\"oneOf\",keywordLocation:I,error:`Instance does not match exactly one subschema (${$} matches).`})}if((p===\"object\"||p===\"array\")&&Object.assign(c,...os),D!==void 0){let I=`${i}/if`;if(X(e,D,r,n,o,a,s,I,c).valid){if(S!==void 0){let $=X(e,S,r,n,o,a,s,`${i}/then`,c);$.valid||w.push({instanceLocation:s,keyword:\"if\",keywordLocation:I,error:'Instance does not match \"then\" schema.'},...$.errors)}}else if(A!==void 0){let $=X(e,A,r,n,o,a,s,`${i}/else`,c);$.valid||w.push({instanceLocation:s,keyword:\"if\",keywordLocation:I,error:'Instance does not match \"else\" schema.'},...$.errors)}}if(p===\"object\"){if(C!==void 0)for(let R of C)R in e||w.push({instanceLocation:s,keyword:\"required\",keywordLocation:`${i}/required`,error:`Instance does not have required property \"${R}\".`});let I=Object.keys(e);if(Oe!==void 0&&I.length<Oe&&w.push({instanceLocation:s,keyword:\"minProperties\",keywordLocation:`${i}/minProperties`,error:`Instance does not have at least ${Oe} properties.`}),Kn!==void 0&&I.length>Kn&&w.push({instanceLocation:s,keyword:\"maxProperties\",keywordLocation:`${i}/maxProperties`,error:`Instance does not have at least ${Kn} properties.`}),ts!==void 0){let R=`${i}/propertyNames`;for(let E in e){let M=`${s}/${We(E)}`,U=X(E,ts,r,n,o,a,M,R);U.valid||w.push({instanceLocation:s,keyword:\"propertyNames\",keywordLocation:R,error:`Property name \"${E}\" does not match schema.`},...U.errors)}}if(lt!==void 0){let R=`${i}/dependantRequired`;for(let E in lt)if(E in e){let M=lt[E];for(let U of M)U in e||w.push({instanceLocation:s,keyword:\"dependentRequired\",keywordLocation:R,error:`Instance has \"${E}\" but does not have \"${U}\".`})}}if(Yn!==void 0)for(let R in Yn){let E=`${i}/dependentSchemas`;if(R in e){let M=X(e,Yn[R],r,n,o,a,s,`${E}/${We(R)}`,c);M.valid||w.push({instanceLocation:s,keyword:\"dependentSchemas\",keywordLocation:E,error:`Instance has \"${R}\" but does not match dependant schema.`},...M.errors)}}if(T!==void 0){let R=`${i}/dependencies`;for(let E in T)if(E in e){let M=T[E];if(Array.isArray(M))for(let U of M)U in e||w.push({instanceLocation:s,keyword:\"dependencies\",keywordLocation:R,error:`Instance has \"${E}\" but does not have \"${U}\".`});else{let U=X(e,M,r,n,o,a,s,`${R}/${We(E)}`);U.valid||w.push({instanceLocation:s,keyword:\"dependencies\",keywordLocation:R,error:`Instance has \"${E}\" but does not match dependant schema.`},...U.errors)}}}let P=Object.create(null),$=!1;if(j!==void 0){let R=`${i}/properties`;for(let E in j){if(!(E in e))continue;let M=`${s}/${We(E)}`,U=X(e[E],j[E],r,n,o,a,M,`${R}/${We(E)}`);if(U.valid)c[E]=P[E]=!0;else if($=o,w.push({instanceLocation:s,keyword:\"properties\",keywordLocation:R,error:`Property \"${E}\" does not match schema.`},...U.errors),$)break}}if(!$&&N!==void 0){let R=`${i}/patternProperties`;for(let E in N){let M=Bu(E),U=N[E];for(let qe in e){if(!M.test(qe))continue;let ld=`${s}/${We(qe)}`,md=X(e[qe],U,r,n,o,a,ld,`${R}/${We(E)}`);md.valid?c[qe]=P[qe]=!0:($=o,w.push({instanceLocation:s,keyword:\"patternProperties\",keywordLocation:R,error:`Property \"${qe}\" matches pattern \"${E}\" but does not match associated schema.`},...md.errors))}}}if(!$&&re!==void 0){let R=`${i}/additionalProperties`;for(let E in e){if(P[E])continue;let M=`${s}/${We(E)}`,U=X(e[E],re,r,n,o,a,M,R);U.valid?c[E]=!0:($=o,w.push({instanceLocation:s,keyword:\"additionalProperties\",keywordLocation:R,error:`Property \"${E}\" does not match additional properties schema.`},...U.errors))}}else if(!$&&me!==void 0){let R=`${i}/unevaluatedProperties`;for(let E in e)if(!c[E]){let M=`${s}/${We(E)}`,U=X(e[E],me,r,n,o,a,M,R);U.valid?c[E]=!0:w.push({instanceLocation:s,keyword:\"unevaluatedProperties\",keywordLocation:R,error:`Property \"${E}\" does not match unevaluated properties schema.`},...U.errors)}}}else if(p===\"array\"){we!==void 0&&e.length>we&&w.push({instanceLocation:s,keyword:\"maxItems\",keywordLocation:`${i}/maxItems`,error:`Array has too many items (${e.length} > ${we}).`}),$e!==void 0&&e.length<$e&&w.push({instanceLocation:s,keyword:\"minItems\",keywordLocation:`${i}/minItems`,error:`Array has too few items (${e.length} < ${$e}).`});let I=e.length,P=0,$=!1;if(Bt!==void 0){let R=`${i}/prefixItems`,E=Math.min(Bt.length,I);for(;P<E;P++){let M=X(e[P],Bt[P],r,n,o,a,`${s}/${P}`,`${R}/${P}`);if(c[P]=!0,!M.valid&&($=o,w.push({instanceLocation:s,keyword:\"prefixItems\",keywordLocation:R,error:\"Items did not match schema.\"},...M.errors),$))break}}if(_e!==void 0){let R=`${i}/items`;if(Array.isArray(_e)){let E=Math.min(_e.length,I);for(;P<E;P++){let M=X(e[P],_e[P],r,n,o,a,`${s}/${P}`,`${R}/${P}`);if(c[P]=!0,!M.valid&&($=o,w.push({instanceLocation:s,keyword:\"items\",keywordLocation:R,error:\"Items did not match schema.\"},...M.errors),$))break}}else for(;P<I;P++){let E=X(e[P],_e,r,n,o,a,`${s}/${P}`,R);if(c[P]=!0,!E.valid&&($=o,w.push({instanceLocation:s,keyword:\"items\",keywordLocation:R,error:\"Items did not match schema.\"},...E.errors),$))break}if(!$&&mt!==void 0){let E=`${i}/additionalItems`;for(;P<I;P++){let M=X(e[P],mt,r,n,o,a,`${s}/${P}`,E);c[P]=!0,M.valid||($=o,w.push({instanceLocation:s,keyword:\"additionalItems\",keywordLocation:E,error:\"Items did not match additional items schema.\"},...M.errors))}}}if(Z!==void 0)if(I===0&&Y===void 0)w.push({instanceLocation:s,keyword:\"contains\",keywordLocation:`${i}/contains`,error:\"Array is empty. It must contain at least one item matching the schema.\"});else if(Y!==void 0&&I<Y)w.push({instanceLocation:s,keyword:\"minContains\",keywordLocation:`${i}/minContains`,error:`Array has less items (${I}) than minContains (${Y}).`});else{let R=`${i}/contains`,E=w.length,M=0;for(let U=0;U<I;U++){let qe=X(e[U],Z,r,n,o,a,`${s}/${U}`,R);qe.valid?(c[U]=!0,M++):w.push(...qe.errors)}M>=(Y||0)&&(w.length=E),Y===void 0&&pe===void 0&&M===0?w.splice(E,0,{instanceLocation:s,keyword:\"contains\",keywordLocation:R,error:\"Array does not contain item matching schema.\"}):Y!==void 0&&M<Y?w.push({instanceLocation:s,keyword:\"minContains\",keywordLocation:`${i}/minContains`,error:`Array must contain at least ${Y} items matching schema. Only ${M} items were found.`}):pe!==void 0&&M>pe&&w.push({instanceLocation:s,keyword:\"maxContains\",keywordLocation:`${i}/maxContains`,error:`Array may contain at most ${pe} items matching schema. ${M} items were found.`})}if(!$&&G!==void 0){let R=`${i}/unevaluatedItems`;for(P;P<I;P++){if(c[P])continue;let E=X(e[P],G,r,n,o,a,`${s}/${P}`,R);c[P]=!0,E.valid||w.push({instanceLocation:s,keyword:\"unevaluatedItems\",keywordLocation:R,error:\"Items did not match unevaluated items schema.\"},...E.errors)}}if(nr)for(let R=0;R<I;R++){let E=e[R],M=typeof E==\"object\"&&E!==null;for(let U=0;U<I;U++){if(R===U)continue;let qe=e[U];(E===qe||M&&(typeof qe==\"object\"&&qe!==null)&&lr(E,qe))&&(w.push({instanceLocation:s,keyword:\"uniqueItems\",keywordLocation:`${i}/uniqueItems`,error:`Duplicate items at indexes ${R} and ${U}.`}),R=Number.MAX_SAFE_INTEGER,U=Number.MAX_SAFE_INTEGER)}}}else if(p===\"number\"){if(r===\"4\"?(Lt!==void 0&&(or===!0&&e<=Lt||e<Lt)&&w.push({instanceLocation:s,keyword:\"minimum\",keywordLocation:`${i}/minimum`,error:`${e} is less than ${or?\"or equal to \":\"\"} ${Lt}.`}),Nt!==void 0&&(nt===!0&&e>=Nt||e>Nt)&&w.push({instanceLocation:s,keyword:\"maximum\",keywordLocation:`${i}/maximum`,error:`${e} is greater than ${nt?\"or equal to \":\"\"} ${Nt}.`})):(Lt!==void 0&&e<Lt&&w.push({instanceLocation:s,keyword:\"minimum\",keywordLocation:`${i}/minimum`,error:`${e} is less than ${Lt}.`}),Nt!==void 0&&e>Nt&&w.push({instanceLocation:s,keyword:\"maximum\",keywordLocation:`${i}/maximum`,error:`${e} is greater than ${Nt}.`}),or!==void 0&&e<=or&&w.push({instanceLocation:s,keyword:\"exclusiveMinimum\",keywordLocation:`${i}/exclusiveMinimum`,error:`${e} is less than ${or}.`}),nt!==void 0&&e>=nt&&w.push({instanceLocation:s,keyword:\"exclusiveMaximum\",keywordLocation:`${i}/exclusiveMaximum`,error:`${e} is greater than or equal to ${nt}.`})),jt!==void 0){let I=e%jt;Math.abs(0-I)>=11920929e-14&&Math.abs(jt-I)>=11920929e-14&&w.push({instanceLocation:s,keyword:\"multipleOf\",keywordLocation:`${i}/multipleOf`,error:`${e} is not a multiple of ${jt}.`})}}else if(p===\"string\"){let I=cn===void 0&&rs===void 0?0:Du(e);cn!==void 0&&I<cn&&w.push({instanceLocation:s,keyword:\"minLength\",keywordLocation:`${i}/minLength`,error:`String is too short (${I} < ${cn}).`}),rs!==void 0&&I>rs&&w.push({instanceLocation:s,keyword:\"maxLength\",keywordLocation:`${i}/maxLength`,error:`String is too long (${I} > ${rs}).`}),pd!==void 0&&!Bu(pd).test(e)&&w.push({instanceLocation:s,keyword:\"pattern\",keywordLocation:`${i}/pattern`,error:\"String does not match pattern.\"}),B!==void 0&&bi[B]&&!bi[B](e)&&w.push({instanceLocation:s,keyword:\"format\",keywordLocation:`${i}/format`,error:`String does not match format \"${B}\".`})}return{valid:w.length===0,errors:w}}function Bu(e){try{return new RegExp(e,\"u\")}catch(t){if(!(t instanceof SyntaxError))throw t;return new RegExp(e)}}var Ri=Symbol(\"apps.Schema\"),Ci=e=>e[Ri],Th=e=>typeof e==\"object\"&&e!==null&&Ri in e,ki=(e,t)=>{if(Th(e))return e;let r=e;throw new TypeError(`${t} must be a schema, such as string() or object({ ... }), but ${typeof r==\"function\"?\"it is a function. Call it, as in string().\":r===void 0?\"it is undefined. Check that it is defined and imported before this declaration.\":typeof r==\"object\"&&r!==null&&Object.getPrototypeOf(r)===Object.prototype?\"it is a plain object. Wrap its fields in object({ ... }).\":\"no apps schema constructor created it.\"}`)},wi=(e,t)=>m.suspend(()=>l.decodeUnknownEffect(e)(t)).pipe(m.mapError(()=>new ft)),Rh=ao.makeFormatterStandardSchemaV1({leafHook:ao.defaultLeafHook}),Zb=(e,t,r,n=()=>e)=>m.suspend(()=>l.decodeUnknownEffect(e)(t)).pipe(m.catch(o=>m.suspend(()=>l.decodeUnknownEffect(n(t))(t,{errors:\"all\"})).pipe(m.flip,m.orElseSucceed(()=>o),m.flatMap(a=>m.fail(new Ns({declaration:r,issues:Rh(a.issue).issues.map(s=>({path:(s.path??[]).map(i=>String(typeof i==\"object\"?i.key:i)),message:s.message}))}))))));function Tt(e,t){return{[Ri]:e,optionalValue:t,parse:r=>m.runSync(wi(e,r)),optional:()=>Tt(l.optional(e),!0),default:r=>{let n=m.runSync(wi(e,r));return{...Tt(e.annotate({default:n}).pipe(l.withDecodingDefault(m.succeed(n))),!1),hasDefault:!0,inputOptional:t}}}}function Qb(e={}){return Tt(e.minLength===void 0?l.String:l.String.check(l.isMinLength(e.minLength)),!1)}var ew=()=>Tt(l.Finite,!1),tw=()=>Tt(l.Boolean,!1),rw=()=>Tt(l.Json,!1),nw=e=>Tt(l.Record(l.String,Ci(ki(e,\"The record() value\"))),!1);function ow(e){return typeof e==\"number\"&&m.runSync(wi(l.Finite,e)),Tt(e===null?l.Null:l.Literal(e),!1)}var sw=e=>Tt(l.Array(Ci(ki(e,\"The array() item\"))),!1);function aw(e){let t=Object.entries(e).map(([n,o])=>[n,Ci(ki(o,`The object() field ${JSON.stringify(n)}`))]),r=t.length===0?Oh(l.Record(l.String,l.Unknown).pipe(l.decodeTo(l.Record(l.String,l.Never),{decode:ai.transform(()=>({})),encode:ai.transform(n=>n)})),{type:\"object\",properties:{},additionalProperties:!1}):l.Struct(Object.fromEntries(t));return{...Tt(r,!1),fields:Object.freeze({...e})}}var Eo=Symbol(\"apps.FieldExposure\"),Ch=e=>Eo in e&&(e[Eo]===\"plain\"||e[Eo]===\"raw\")?e[Eo]:void 0,js=(e,t)=>({...e,[Eo]:t,optional:()=>js(e.optional(),t),default:r=>js(e.default(r),t)}),iw=e=>js(e,\"plain\"),cw=e=>js(e,\"raw\"),dw=e=>Object.fromEntries(Object.entries(e).flatMap(([t,r])=>{let n=Ch(r);return n===void 0?[]:[[t,n]]})),wo=Symbol(\"apps.JsonSchemaDocument\"),kh=e=>wo in e?e[wo]:void 0,Oh=(e,t)=>Object.assign(e,{[wo]:t}),zu=e=>{let t;return()=>(t??={value:e()}).value},Ah=(e,t)=>Object.defineProperty(e,wo,{configurable:!0,enumerable:!0,get:zu(t)}),Ph=(e,t)=>{let r=structuredClone(e),n=wt(r),o=Wu(r,n),a=new Map,s=(d,p)=>{if(a.has(d)||a.set(d,p),Array.isArray(d))d.forEach((f,h)=>s(f,`${p}/${h}`));else if(d!==null&&typeof d==\"object\")for(let[f,h]of Object.entries(d))s(h,`${p}/${encodeURI(f.replaceAll(\"~\",\"~0\").replaceAll(\"/\",\"~1\")).replaceAll(\"#\",\"%23\")}`)};s(r,t);let i=new Map;for(let d of o){let p={};for(let[f,h]of[[\"$ref\",d.__absolute_ref__],[\"$recursiveRef\",d.__absolute_recursive_ref__]]){if(h===void 0)continue;let y=n[h],u=a.get(y);if(u===void 0)throw new ft;p[f]=u}i.set(d,p)}let c=d=>{if(Array.isArray(d))return d.map(c);if(d===null||typeof d!=\"object\")return d;let p=i.get(d);return Object.fromEntries(Object.entries(d).filter(([f])=>p===void 0||![\"$id\",\"id\",\"$anchor\"].includes(f)).map(([f,h])=>[f,p?.[f]??c(h)]))};return l.decodeUnknownSync(l.Record(l.String,l.Json))(c(r))},vh=new Set([\"$id\",\"id\",\"$anchor\",\"$recursiveAnchor\",\"$recursiveRef\",\"$dynamicAnchor\",\"$dynamicRef\"]),Hh=e=>{if(typeof e!=\"string\"||!e.startsWith(\"#/$defs/\"))return;let t=zr(e);return t.length===2?t[1]:void 0},Ih=e=>{let t=e.$defs??{};if(!V(t))return;let r=[e];for(let n=r.pop();n!==void 0;n=r.pop())if(Ju(n))for(let[o,a]of Object.entries(n)){if(vh.has(o))return;if(o===\"$ref\"){let s=Hh(a);if(s===void 0||!Object.hasOwn(t,s))return}else Array.isArray(a)?(zs.has(o)||o===\"items\")&&r.push(...a):Vs.has(o)||o===\"dependencies\"?V(a)&&r.push(...Object.values(a)):Oi.has(o)&&r.push(a)}return t},fw=(e,t)=>{let r={},n=new Map,o=e.map((a,s)=>{let i=Ih(a),c=Object.entries(i??{}).map(([f,h])=>[f,h,JSON.stringify(h)]);if(i===void 0||c.some(([f,,h])=>n.has(f)&&n.get(f)!==h))return Ph(a,t(s));for(let[f,h,y]of c)n.has(f)||(n.set(f,y),Object.defineProperty(r,f,{value:h,enumerable:!0,writable:!0,configurable:!0}));let{$defs:d,...p}=a;return p});return n.size===0?{schemas:o}:{$defs:r,schemas:o}},Vs=new Set([\"$defs\",\"definitions\",\"properties\",\"patternProperties\",\"dependentSchemas\"]),zs=new Set([\"allOf\",\"anyOf\",\"oneOf\",\"prefixItems\"]),Oi=new Set([\"not\",\"if\",\"then\",\"else\",\"items\",\"additionalItems\",\"contains\",\"additionalProperties\",\"unevaluatedProperties\",\"unevaluatedItems\",\"propertyNames\"]),Ju=e=>typeof e==\"object\"&&e!==null&&!Array.isArray(e),Wu=(e,t)=>{let r=new Set,n=[e];for(let o=n.pop();o!==void 0;o=n.pop())if(!(!Ju(o)||r.has(o))){r.add(o);for(let a of[o.__absolute_ref__,o.__absolute_recursive_ref__]){let s=a===void 0?void 0:t[a];s!==void 0&&n.push(s)}for(let[a,s]of Object.entries(o))Array.isArray(s)?(zs.has(a)||a===\"items\")&&n.push(...s):Vs.has(a)||a===\"dependencies\"?V(s)&&n.push(...Object.values(s)):Oi.has(a)&&n.push(s)}return r};function bo(e){if(typeof e==\"boolean\")return e;if(e===null||typeof e!=\"object\"||Array.isArray(e))throw new ft;let t=[];for(let[r,n]of Object.entries(e)){if(r===\"$dynamicRef\"||r===\"$dynamicAnchor\")throw new ft;r!==\"format\"&&(Vs.has(r)&&n!==null&&typeof n==\"object\"&&!Array.isArray(n)?t.push([r,Object.fromEntries(Object.entries(n).map(([o,a])=>[o,bo(a)]))]):(zs.has(r)||r===\"items\")&&Array.isArray(n)?t.push([r,n.map(bo)]):Oi.has(r)?t.push([r,bo(n)]):r===\"dependencies\"&&n!==null&&typeof n==\"object\"&&!Array.isArray(n)?t.push([r,Object.fromEntries(Object.entries(n).map(([o,a])=>[o,Array.isArray(a)?a:bo(a)]))]):t.push([r,n]))}return Object.fromEntries(t)}var Uh=new Set([\"$ref\",\"$recursiveRef\",\"$dynamicRef\",\"properties\",\"patternProperties\",\"additionalProperties\",\"unevaluatedProperties\",\"propertyNames\",\"items\",\"prefixItems\",\"additionalItems\",\"unevaluatedItems\",\"contains\",\"allOf\",\"if\",\"then\",\"else\",\"dependentSchemas\"]),Gu=e=>/^[A-Za-z_$][\\w$-]{0,63}$/.test(e),Ku=e=>Gu(e)?e:JSON.stringify(e.slice(0,64)),Yu=24,Xu=(e,t,r=Yu)=>{let o=[...e.slice(0,r).map(({name:a,optional:s})=>`${Ku(a)}${s?\"?\":\"\"}`),...e.length>r?[`${e.length-r} more`]:[],...t?[\"...\"]:[]];return o.length===0?\"object {} with no keys\":`object {${o.join(\", \")}}`},Mh=10,_h=200,$h=e=>typeof e==\"bigint\"?`${e}n`:JSON.stringify(e),Ai=e=>{let t=[...new Set(e.map($h))],r=[];for(let a of t){if(r.length===Mh||[...r,a].join(\", \").length>_h)break;r.push(a)}let[n]=r;if(t.length===0)return\"no value, since the schema allows none\";if(n===void 0)return t.length===1?\"a fixed value too long to list\":`one of ${t.length} values too long to list`;if(t.length===1)return n;let o=t.length-r.length;return`one of ${r.join(\", \")}${o>0?` and ${o} more`:\"\"}`},Fh=8,Dh=360,Zu=(e,t)=>{let r=[];for(let o of e){if(r.length>0&&[...r,o].join(\" or \").length>Dh)break;r.push(o)}let n=e.length-r.length;return`${[...r,...n>0?[`${n} more`]:[]].join(\" or \")}${t===void 0?\"\":`, told apart by ${Ku(t)}`}`},Bh=e=>e===void 0?Lu:`${Lu}. Expected ${e}`,Lu=\"Missing key\",V=e=>typeof e==\"object\"&&e!==null&&!Array.isArray(e),zr=e=>e===\"#\"||e===\"\"?[]:e.replace(/^#?\\//,\"\").split(\"/\").map(t=>decodeURIComponent(t).replace(/~1/g,\"/\").replace(/~0/g,\"~\")),Qu=(e,t)=>typeof t==\"string\"&&Object.hasOwn(e,t)?e[t]:void 0,ep=(e,t)=>V(t)?Qu(e,Reflect.get(t,\"__absolute_ref__\")??t.$ref):void 0,Lh=new Set([...Vs,...zs,\"dependencies\"]),Nh=new Set([\"allOf\",\"anyOf\",\"oneOf\"]),jh=(e,t,r)=>{let n=(i,c)=>c===null&&V(i)&&i.$recursiveAnchor===!0?i:c,o=[...r],a=e,s=n(e,null);for(let i=o.shift();i!==void 0;i=o.shift()){if(!V(a))return;if(i===\"$recursiveRef\"){let c=s===null?Qu(t,Reflect.get(a,\"__absolute_recursive_ref__\")):s;s!==null&&(a=s),s=c;continue}if(i===\"$ref\")a=ep(t,a);else{let c=Object.hasOwn(a,i)?a[i]:void 0;if(Lh.has(i)||i===\"items\"&&Array.isArray(c)){let d=o.shift();if(d===void 0)return c;Nh.has(i)&&a.$recursiveAnchor!==!0&&(s=null),a=Array.isArray(c)?/^\\d+$/.test(d)?c[Number(d)]:void 0:V(c)&&Object.hasOwn(c,d)?c[d]:void 0}else a=c}s=n(a,s)}return a},Nu=e=>{if(!V(e))return\"object\";let t=V(e.properties)?Object.keys(e.properties):[],r=new Set(Array.isArray(e.required)?e.required:[]),n=e.additionalProperties!==!1||V(e.patternProperties)&&Object.keys(e.patternProperties).length>0;return t.length===0&&n?\"object\":Xu(t.map(o=>({name:o,optional:!r.has(o)})),n)},ju=e=>JSON.stringify(e),tp={types:void 0,properties:new Map,required:new Set,closed:!1,values:void 0},rp=(e,t)=>e===void 0?t:t===void 0?e:e.filter(r=>t.some(n=>lr(r,n))),qs=e=>Array.isArray(e)?e.filter(t=>typeof t==\"string\"):[],qh=(e,t)=>new Set([...e].flatMap(r=>t.has(r)?[r]:r===\"number\"&&t.has(\"integer\")||r===\"integer\"&&t.has(\"number\")?[\"integer\"]:[])),np=(e,t)=>({types:e.types===void 0?t.types:t.types===void 0?e.types:qh(e.types,t.types),properties:new Map([...e.properties,...t.properties]),required:new Set([...e.required,...t.required]),closed:e.closed||t.closed,values:rp(e.values,t.values)}),Jt=(e,t,r=new Set)=>{if(!V(e)||r.has(e))return tp;let n=new Set([...r,e]),o={types:typeof e.type==\"string\"?new Set([e.type]):Array.isArray(e.type)?new Set(qs(e.type)):void 0,properties:new Map(V(e.properties)?Object.entries(e.properties):[]),required:new Set(qs(e.required)),closed:(e.additionalProperties===!1||e.unevaluatedProperties===!1)&&!(V(e.patternProperties)&&Object.keys(e.patternProperties).length>0),values:rp(Object.hasOwn(e,\"const\")?[e.const]:void 0,Array.isArray(e.enum)?e.enum:void 0)};return[t.referenced(e),...Array.isArray(e.allOf)?e.allOf:[]].reduce((a,s)=>np(a,Jt(s,t,n)),o)},Vh=\"a value with other constraints\",op=(e,t)=>{if(e.values!==void 0)return Ai(e.values);let r=[...e.properties.keys(),...[...e.required].filter(o=>!e.properties.has(o))],n=r.length===0&&!e.closed?\"object\":Xu(r.map(o=>({name:o,optional:!e.required.has(o)})),!e.closed,t);return e.types===void 0?r.length>0||e.closed?n:Vh:[...e.types].map(o=>o===\"object\"?n:o).join(\" or \")},sp=e=>op(e,Fh),qu=e=>e.values!==void 0||e.types!==void 0,zh=(e,t)=>{let r=t.referenced(e)??e;if(V(r)&&Object.hasOwn(r,\"oneOf\"))return;let n=Jt(e,t);if(qu(n))return op(n,Yu);let a=(V(r)&&Array.isArray(r.anyOf)?r.anyOf:[]).filter(s=>s!==!1).map(s=>Jt(s,t));return a.length===0||!a.every(qu)?void 0:Zu([...new Set(a.map(sp))],void 0)},Jh=160,Tn=(e,t)=>`${e} ${t}${e===1?\"\":\"s\"}`,Wh=(e,t)=>{if(!V(t))return;let r=t[e];if(e===\"pattern\")return typeof r!=\"string\"?void 0:r.length<=Jh?`Expected a string matching the pattern ${JSON.stringify(r)}`:\"Expected a string matching the schema's pattern, which is too long to show\";if(e===\"format\")return typeof r==\"string\"?`Expected a string in the ${JSON.stringify(r.slice(0,64))} format`:void 0;if(e===\"uniqueItems\")return\"Expected an array without repeated items\";if(typeof r==\"number\")switch(e){case\"minimum\":return`Expected a number of at least ${r}`;case\"maximum\":return`Expected a number of at most ${r}`;case\"exclusiveMinimum\":return`Expected a number greater than ${r}`;case\"exclusiveMaximum\":return`Expected a number less than ${r}`;case\"multipleOf\":return`Expected a multiple of ${r}`;case\"minLength\":return`Expected a string of at least ${Tn(r,\"character\")}`;case\"maxLength\":return`Expected a string of at most ${Tn(r,\"character\")}`;case\"minItems\":return`Expected an array of at least ${Tn(r,\"item\")}`;case\"maxItems\":return`Expected an array of at most ${Tn(r,\"item\")}`;case\"minProperties\":return`Expected an object with at least ${Tn(r,\"key\")}`;case\"maxProperties\":return`Expected an object with at most ${Tn(r,\"key\")}`;default:return}},ap=(e,t,r,n=0)=>!V(t)||n>16?0:Object.entries(t).reduce((o,[a,s])=>{let i=e.properties.get(a);return i===void 0?o:o+1+ap(Jt(i,r),s,r,n+1)},0),Vu=e=>e===null?\"null\":Array.isArray(e)?\"array\":typeof e==\"object\"?\"object\":typeof e,Gh=(e,t)=>{let r=Vu(t);return e.values!==void 0?e.values.some(n=>Vu(n)===r):e.types===void 0?!0:e.types.has(r)||r===\"number\"&&e.types.has(\"integer\")&&Number.isInteger(t)},Kh=(e,t)=>t.reduce((r,n)=>Array.isArray(r)?r[Number(n)]:V(r)&&Object.hasOwn(r,n)?r[n]:void 0,e),ip=e=>V(e)&&V(e.discriminator)?e.discriminator:void 0,cp=e=>{if(typeof e!=\"string\"||!e.startsWith(\"#/\"))return;let t=zr(e),r=t.at(-2);return r===\"$defs\"||r===\"definitions\"||r===\"schemas\"&&t.at(-3)===\"components\"?t.at(-1):void 0},Yh=(e,t)=>{let r=ip(e);if(r===void 0||typeof t!=\"string\")return;let{mapping:n}=r,o=V(n)&&Object.hasOwn(n,t)?n[t]:t;if(typeof o==\"string\")return/^[\\w.-]+$/.test(o)?o:cp(o)},Xh=(e,t,r)=>{let n=ip(e)?.propertyName;if(typeof n==\"string\")return n;let[o]=t;if(!(o===void 0||t.length<2))return[...o.properties.keys()].find(a=>t.every(s=>s.properties.has(a)&&Jt(s.properties.get(a),r).values!==void 0))},Zh=(e,t,r)=>{let n=`${e[t]?.keywordLocation}/`,o=new Map,a=(c,d)=>{let p=o.get(c),f=Array.isArray(r)?r.slice(c+1,d).filter(h=>h===!1).length:0;p!==void 0&&p.splice(p.length-f,f)},s=t+1,i=-1;for(;s<e.length;s++){let c=e[s];if(c===void 0)break;if(c.keywordLocation.startsWith(n)){let d=Number(c.keywordLocation.slice(n.length).split(\"/\")[0]);d!==i&&a(i,d),i=d}else if(c.keyword!==\"false\")break;i>=0&&o.set(i,[...o.get(i)??[],c])}return a(i,Array.isArray(r)?r.length:i),{alternatives:o,end:s}},dp=e=>e.map(t=>/^\\d+$/.test(t)?Number(t):t),Qh=(e,t,r,n)=>{let o=zr(e.instanceLocation),a=dp(o);if(!Array.isArray(t))return[{path:a,issue:`Failed the \"${e.keyword}\" constraint`},...[...r.values()].flatMap(H=>Ti(H,n))];let s=t.flatMap((H,D)=>H===!1?[]:[{schema:H,matched:!r.has(D),problems:()=>Ti(r.get(D)??[],n)}]),[i]=s;if(i===void 0)return[{path:a,issue:\"No value is allowed here\"}];if(s.length===1)return i.problems();let c=n.schemaAt(zr(e.keywordLocation).slice(0,-1)),d=Jt(c,n),p=s.map(({schema:H})=>Jt(H,n)),f=p.map(H=>np(d,H)),h=Xh(c,p,n),y=`Expected ${Zu(f.map(sp),h)}`,u=s.filter(H=>H.matched).length;if(e.keyword===\"oneOf\"&&u>1)return[{path:a,issue:`${y}. Exactly one may match, but ${u} do`}];let g=f.flatMap(({values:H})=>H===void 0?[]:[H]);if(g.length===f.length)return[{path:a,issue:e.keyword===\"oneOf\"?`${y}. Exactly one alternative must match`:`Expected ${Ai(g.flat())}`}];let x=Kh(n.input,o),C=h!==void 0&&V(x)&&Object.hasOwn(x,h)?{value:x[h]}:void 0,L=Yh(c,C?.value),O=s.map(({schema:H,problems:D},S)=>{let A=f[S]??tp,B=p[S]?.properties.get(h??\"\");return{index:S,problems:D(),selected:C!==void 0&&(L!==void 0&&V(H)&&cp(H.$ref)===L||B!==void 0&&Jt(B,n).values!==void 0&&n.accepts(B,C.value)),typed:Gh(A,x),overlap:ap(A,x,n)}}).reduce((H,D)=>([Number(D.selected)-Number(H.selected),Number(D.typed)-Number(H.typed),D.overlap-H.overlap,H.problems.length-D.problems.length].find(S=>S!==0)??0)>0?D:H);return O.selected||O.typed?[{path:a,issue:`${y}. Closest is alternative ${O.index+1}, whose problems follow`},...O.problems]:[{path:a,issue:y}]},Ti=(e,t)=>{let r=new Map,n=[];for(let o=0;o<e.length;o++){let a=e[o];if(a===void 0)break;let{keyword:s,instanceLocation:i,keywordLocation:c}=a;if(s===\"anyOf\"||s===\"oneOf\"){let g=t.schemaAt(zr(c)),{alternatives:x,end:C}=Zh(e,o,g);n.push(...Qh(a,g,x,t)),o=C-1;continue}let d=zr(i),p=dp(d),f=(g,x=p)=>n.push({path:x,issue:g}),h=()=>t.schemaAt(zr(c).slice(0,-1));if(s===\"additionalProperties\"||s===\"unevaluatedProperties\"){r.set(ju(d),h());continue}if(Uh.has(s))continue;if(s===\"false\"){let g=d.at(-1),x=ju(d.slice(0,-1));g===void 0||!r.has(x)?f(\"No value is allowed here\"):f(`Unexpected key${Gu(g)?` \"${g}\"`:\"\"}. Expected ${Nu(r.get(x))}`,p.slice(0,-1));continue}let y=s===\"required\"?/required property \"([^\"]*)\"/.exec(a.error):null;if(y!==null){let g=y[1]??\"\",x=Jt(h(),t).properties.get(g);f(Bh(x===void 0?void 0:zh(x,t)),[...p,g]);continue}let u=s===\"type\"?/Expected \"([^.]*)\"\\.?$/.exec(a.error):null;if(u!==null){let g=(u[1]??\"\").split('\", \"').map(x=>x===\"object\"?Nu(h()):x);f(`Expected ${g.join(\" or \")}`);continue}if(s===\"const\"||s===\"enum\"){let g=h(),x=V(g)?s===\"const\"?Object.hasOwn(g,\"const\")?[g.const]:void 0:Array.isArray(g.enum)?g.enum:void 0:void 0;f(x===void 0?\"Expected one of the allowed values\":`Expected ${Ai(x)}`);continue}f(Wh(s,h())??`Failed the \"${s}\" constraint`)}return n},ey=e=>{let t=new Set,r=!1,n=(o,a)=>{if(a>64||typeof o!=\"object\"||o===null)return;if(Array.isArray(o)){for(let i of o)n(i,a+1);return}let s=o;if(V(s.properties))for(let i of Object.keys(s.properties))t.add(i);for(let i of qs(s.required))t.add(i);if(V(s.dependentRequired))for(let[i,c]of Object.entries(s.dependentRequired)){t.add(i);for(let d of qs(c))t.add(d)}(V(s.patternProperties)&&Object.keys(s.patternProperties).length>0||V(s.additionalProperties)||V(s.unevaluatedProperties))&&(r=!0);for(let i of Object.values(s))n(i,a+1)};return n(e,0),o=>r||t.has(o)},fp=new WeakMap,uw=e=>fp.get(e),ty=(e,t)=>{let r=Ti(e,t);return r.length===0?!1:r},ry=e=>m.gen(function*(){let t=yield*m.try({try:()=>{let o=e.$schema===\"http://json-schema.org/draft-07/schema#\"||e.$schema===\"https://json-schema.org/draft-07/schema\"?\"7\":\"2020-12\",a=bo(e);if(a===null||typeof a!=\"object\"||Array.isArray(a))throw new ft;let s=wt(a);for(let c of Wu(a,s)){for(let d of[c.pattern,...Object.keys(c.patternProperties??{})])if(d!==void 0)try{new RegExp(d,\"u\")}catch(p){if(!(p instanceof SyntaxError))throw p;new RegExp(d)}for(let d of[c.__absolute_ref__,c.__absolute_recursive_ref__])if(d!==void 0&&s[d]===void 0)throw new ft}return{validate:c=>X(c,a,o,s),inspection:c=>({schemaAt:d=>jh(a,s,d),referenced:d=>ep(s,d),accepts:(d,p)=>{if(typeof d!=\"boolean\"&&!V(d))return!1;try{return X(p,d,o,s).valid}catch{return!1}},input:c})}},catch:()=>new ft}),r=l.makeFilter(o=>{try{let a=t.validate(o);return a.valid||ty(a.errors,t.inspection(o))}catch{return!1}},{expected:\"a value matching a supported imported JSON Schema\"});fp.set(r,ey(e));let n=l.Json.check(r);return Object.assign(n,{[wo]:e})}),ny=e=>{let t=zu(e),r,n=m.suspend(()=>r??ry(t()).pipe(m.onExit(a=>m.sync(()=>{(Ht.isSuccess(a)||!Be.hasInterrupts(a.cause))&&(r=a)})))),o=l.declareConstructor()([],()=>(a,s,i)=>n.pipe(m.mapError(()=>new ao.InvalidValue({message:\"Unsupported JSON Schema\"})),m.flatMap(c=>fi.decodeUnknownEffect(c)(a,i))));return{decoder:Ah(o,t),compile:n}},up=e=>ny(e).decoder,oy=e=>m.sync(()=>up(e));var sy=l.is(l.Json),pp=e=>{if(typeof e!=\"object\"||e===null||Array.isArray(e))return;let t=Object.keys(e),r=t.map(o=>Reflect.get(e,o));if(!sy(r))return;let n={};return t.forEach((o,a)=>Object.defineProperty(n,o,{value:r[a],enumerable:!0,writable:!0,configurable:!0})),n},pw=e=>m.suspend(()=>{let t=pp(e);return t===void 0?m.fail(new ft):oy(()=>t)}),lw=e=>{let t=pp(e);if(t===void 0)throw new ft;return Tt(up(()=>t),!1)},mw=e=>{let t=kh(e);if(t!==void 0)return l.decodeUnknownEffect(Ei)(t);let r=l.toJsonSchemaDocument(e);return l.decodeUnknownEffect(Ei)({...r.schema,$defs:r.definitions,$schema:\"https://json-schema.org/draft/2020-12/schema\"})};var ge={};Te(ge,{DecodeError:()=>Ue,EmptyBodyError:()=>Co,EncodeError:()=>Pi,HttpClientError:()=>ne,HttpClientErrorSchema:()=>vi,InvalidUrlError:()=>Ro,StatusCodeError:()=>mr,TransportError:()=>To,isHttpClientError:()=>hr});var Js=\"~effect/http/HttpClientError\",hr=e=>Q(e,Js),ne=class extends ae(\"HttpClientError\"){constructor(t){\"cause\"in t.reason?super({...t,cause:t.reason.cause}):super(t)}[Js]=Js;get request(){return this.reason.request}get response(){return\"response\"in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},Rn=e=>e.endsWith(\"Error\")?e.slice(0,-5):e,Cn=(e,t,r)=>t?`${e}: ${t} (${r})`:`${e} error (${r})`,To=class extends ae(\"TransportError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return Cn(Rn(this._tag),this.description,this.methodAndUrl)}},Pi=class extends ae(\"EncodeError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return Cn(Rn(this._tag),this.description,this.methodAndUrl)}},Ro=class extends ae(\"InvalidUrlError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return Cn(Rn(this._tag),this.description,this.methodAndUrl)}},mr=class extends ae(\"StatusCodeError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return Cn(Rn(this._tag),this.description,t)}},Ue=class extends ae(\"DecodeError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return Cn(Rn(this._tag),this.description,t)}},Co=class extends ae(\"EmptyBodyError\"){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this.response.status} ${this.methodAndUrl}`;return Cn(Rn(this._tag),this.description,t)}},vi=class e extends nu(Js)({_tag:Hs(\"HttpError\"),kind:Xf([\"EncodeError\",\"DecodeError\",\"TransportError\",\"InvalidUrlError\",\"StatusCodeError\",\"EmptyBodyError\"]),cause:gn(Is())}){static fromHttpClientError(t){return new e({_tag:\"HttpError\",kind:t.reason._tag,cause:t.reason})}};var xr={};Te(xr,{Fetch:()=>jp,RequestInit:()=>ca,layer:()=>Cg});var je={};Te(je,{HttpClient:()=>Gr,SpanNameGenerator:()=>Bp,TracerDisabledWhen:()=>Fp,TracerHeaderFilter:()=>Dp,TracerPropagationEnabled:()=>ia,catch:()=>Qy,catchTag:()=>eg,catchTags:()=>tg,del:()=>Xy,execute:()=>Vy,filterOrElse:()=>rg,filterOrFail:()=>ng,filterStatus:()=>og,filterStatusOk:()=>Gi,followRedirects:()=>bg,get:()=>zy,head:()=>Wy,isHttpClient:()=>_p,layerMergedContext:()=>ec,make:()=>Ki,makeWith:()=>kt,mapRequest:()=>Yi,mapRequestEffect:()=>ag,mapRequestInput:()=>ig,mapRequestInputEffect:()=>cg,options:()=>Zy,patch:()=>Ky,post:()=>Gy,put:()=>Yy,query:()=>Jy,retry:()=>dg,retryTransient:()=>Xi,tap:()=>Zi,tapError:()=>Qi,tapRequest:()=>xg,transform:()=>Wi,transformResponse:()=>Ne,withCookiesRef:()=>Sg,withRateLimiter:()=>fg,withScope:()=>Eg});var Ut={};Te(Ut,{Empty:()=>Gs,FormData:()=>Xs,HttpBodyError:()=>Oo,Raw:()=>Ks,Stream:()=>Zs,Uint8Array:()=>kn,empty:()=>yr,file:()=>Mi,fileFromInfo:()=>dy,formData:()=>vn,formDataRecord:()=>Ui,isHttpBody:()=>Ii,isHttpBodyError:()=>iy,json:()=>Pn,jsonSchema:()=>Po,jsonUnsafe:()=>Wt,raw:()=>Ao,stream:()=>Gt,text:()=>ut,uint8Array:()=>Rt,urlParams:()=>vo});var Ws=\"~effect/http/HttpBody\",Ii=e=>Q(e,Ws),Hi=\"~effect/http/HttpBody/HttpBodyError\",Oo=class extends ae(\"HttpBodyError\"){[Hi]=Hi},iy=e=>Q(e,Hi),Jr=class{[Ws];constructor(){this[Ws]=Ws}[Xn](){return this.toJSON()}toString(){return is(this,{ignoreToString:!0})}},Gs=class extends Jr{_tag=\"Empty\";toJSON(){return{_id:\"effect/HttpBody\",_tag:\"Empty\"}}},yr=new Gs,Ks=class extends Jr{_tag=\"Raw\";body;contentType;contentLength;constructor(t,r,n){super(),this.body=t,this.contentType=r,this.contentLength=n}toJSON(){return{_id:\"effect/HttpBody\",_tag:\"Raw\",body:this.body,contentType:this.contentType,contentLength:this.contentLength}}},Ao=(e,t)=>new Ks(e,t?.contentType,t?.contentLength),kn=class extends Jr{_tag=\"Uint8Array\";contentType;contentLength;text;_body;constructor(t,r,n,o){super(),this._body=t,this.text=o,this.contentType=r,this.contentLength=n}get body(){return this._body??=cy(this.text)}toJSON(){return{_id:\"effect/HttpBody\",_tag:\"Uint8Array\",body:this.contentType.startsWith(\"text/\")||this.contentType.endsWith(\"json\")?new TextDecoder().decode(this.body):`Uint8Array(${this.body.length})`,contentType:this.contentType,contentLength:this.contentLength}}},Rt=(e,t)=>new kn(e,t??\"application/octet-stream\",e.length),yp=new TextEncoder,Ys=globalThis.Buffer,cy=Ys!==void 0?e=>Ys.from(e,\"utf8\"):e=>yp.encode(e),ut=(e,t)=>{if(typeof e!=\"string\"&&(e=e===void 0?\"\":String(e)),Ys!==void 0)return new kn(void 0,t??\"text/plain\",Ys.byteLength(e,\"utf8\"),e);let r=yp.encode(e);return new kn(r,t??\"text/plain\",r.length,e)},Wt=(e,t)=>ut(JSON.stringify(e),t??\"application/json\"),Pn=(e,t)=>Qe({try:()=>ut(JSON.stringify(e),t??\"application/json\"),catch:r=>new Oo({reason:{_tag:\"JsonError\"},cause:r})}),Po=(e,t)=>{let r=Gf(Nr(e));return(n,o)=>r(n,t).pipe(Ur(a=>new Oo({reason:{_tag:\"SchemaError\",issue:a},cause:a})),k(a=>Pn(a,o)))},vo=(e,t)=>ut(Fr(Ce(e)),t??\"application/x-www-form-urlencoded\"),Xs=class extends Jr{_tag=\"FormData\";contentType=void 0;contentLength=void 0;formData;constructor(t){super(),this.formData=t}toJSON(){return{_id:\"effect/HttpBody\",_tag:\"FormData\",formData:this.formData}}},vn=e=>new Xs(e),lp=(e,t,r)=>{if(r!=null){if(typeof r==\"object\"){e.append(t,r);return}e.append(t,String(r))}},Ui=e=>{let t=new globalThis.FormData;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let o of n)lp(t,r,o);else lp(t,r,n);return vn(t)},Zs=class extends Jr{_tag=\"Stream\";stream;contentType;contentLength;constructor(t,r,n){super(),this.stream=t,this.contentType=r,this.contentLength=n}toJSON(){return{_id:\"effect/HttpBody\",_tag:\"Stream\",contentType:this.contentType,contentLength:this.contentLength}}},Gt=(e,t,r)=>new Zs(e,t??\"application/octet-stream\",r),mp=(e,t,r)=>{let n=Of(e);return Xe(n)?v(n.value):q(hi({module:\"HttpBody\",method:r,description:`Invalid ${t}: ${e}`}))},gp=Ve(function*(e,t,r){let n=r?.offset===void 0?kf:yield*mp(r.offset,\"offset\",t),o=r?.bytesToRead===void 0?void 0:yield*mp(r.bytesToRead,\"bytesToRead\",t),a=n>=e?BigInt(\"0\"):e-n,s=o===void 0||o>a?a:o;return s>BigInt(Number.MAX_SAFE_INTEGER)?yield*q(hi({module:\"HttpBody\",method:t,description:`Content length exceeds Number.MAX_SAFE_INTEGER: ${s}`})):Number(s)}),Mi=(e,t)=>k(bn,r=>k(r.stat(e),n=>_(gp(n.size,\"file\",t),o=>Gt(r.stream(e,t),t?.contentType,o)))),dy=(e,t,r)=>k(bn,n=>_(gp(t.size,\"fileFromInfo\",r),o=>Gt(n.stream(e,r),r?.contentType,o)));var Kt={};Te(Kt,{accept:()=>ji,acceptJson:()=>bp,appendUrl:()=>by,appendUrlParam:()=>Ry,appendUrlParams:()=>ra,basicAuth:()=>Sy,bearerToken:()=>Ey,bodyFile:()=>My,bodyFormData:()=>qi,bodyFormDataRecord:()=>Iy,bodyJson:()=>Ay,bodyJsonUnsafe:()=>Py,bodyStream:()=>Uy,bodyText:()=>Oy,bodyUint8Array:()=>ky,bodyUrlParams:()=>Hy,delete:()=>hy,empty:()=>Hn,fromWeb:()=>_y,get:()=>Bi,head:()=>yy,isHttpClientRequest:()=>Mo,make:()=>Ge,makeWith:()=>xe,modify:()=>Ni,options:()=>gy,patch:()=>ly,post:()=>Li,prependUrl:()=>ta,put:()=>my,query:()=>py,removeHash:()=>Cy,removeHeader:()=>_o,schemaBodyJson:()=>vy,setBody:()=>Se,setHash:()=>Rp,setHeader:()=>In,setHeaders:()=>Un,setMethod:()=>ea,setUrl:()=>Mn,setUrlParam:()=>Ty,setUrlParams:()=>Tp,toUrl:()=>$o,toWeb:()=>Dy,toWebResult:()=>Cp,trace:()=>xy,updateHeaders:()=>Ep,updateUrl:()=>wy});var gr=e=>e!==\"GET\"&&e!==\"HEAD\"&&e!==\"OPTIONS\"&&e!==\"TRACE\";var xp=[[\"GET\",\"get\"],[\"POST\",\"post\"],[\"PUT\",\"put\"],[\"DELETE\",\"del\"],[\"PATCH\",\"patch\"],[\"HEAD\",\"head\"],[\"OPTIONS\",\"options\"],[\"TRACE\",\"trace\"],[\"QUERY\",\"query\"]];var Qs=(e,t)=>t._tag===\"Empty\"||t._tag===\"FormData\"?et(et(e,\"content-type\"),\"content-length\"):(e=t.contentType===void 0?et(e,\"content-type\"):_r(e,\"content-type\",t.contentType),t.contentLength===void 0?et(e,\"content-length\"):_r(e,\"content-length\",t.contentLength.toString())),Ho=e=>{if(e==null||!/^\\d+$/.test(e))return;let t=Number(e);return Number.isSafeInteger(t)?t:void 0};var Io=class extends ae(\"UrlError\"){},Uo=(e,t,r)=>fs({try:()=>{let n=new URL(e,fy());for(let o=0;o<t.params.length;o++){let[a,s]=t.params[o];s!==void 0&&n.searchParams.append(a,s)}return r!==void 0&&(n.hash=r),n},catch:n=>new Io({cause:n})}),fy=()=>{if(\"location\"in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname};var Di=\"~effect/http/HttpClientRequest\",Mo=e=>Q(e,Di),uy={[Di]:Di,...cs,toJSON(){return{_id:\"HttpClientRequest\",method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:fn(this.headers),body:this.body.toJSON()}},pipe(){return Fe(this,arguments)}};function xe(e,t,r,n,o,a){let s=Object.create(uy);return s.method=e,s.url=t,s.urlParams=r,s.hash=n,s.headers=o,s.body=a,s}var Hn=xe(\"GET\",\"\",oo,ce(),ze,yr),Ge=e=>(t,r)=>Ni(Hn,{method:e,url:t,...r??void 0}),Bi=Ge(\"GET\"),py=Ge(\"QUERY\"),Li=Ge(\"POST\"),ly=Ge(\"PATCH\"),my=Ge(\"PUT\"),hy=Ge(\"DELETE\");var yy=Ge(\"HEAD\"),gy=Ge(\"OPTIONS\"),xy=Ge(\"TRACE\"),Ni=b(2,(e,t)=>{let r=e;return t.method&&(r=ea(r,t.method)),t.url&&(r=Mn(r,t.url)),t.headers&&(r=Un(r,t.headers)),t.urlParams&&(r=Tp(r,t.urlParams)),t.hash&&(r=Rp(r,t.hash)),t.body&&(r=Se(r,t.body)),t.accept&&(r=ji(r,t.accept)),t.acceptJson&&(r=bp(r)),r}),ea=b(2,(e,t)=>xe(t,e.url,e.urlParams,e.hash,e.headers,e.body)),In=b(3,(e,t,r)=>xe(e.method,e.url,e.urlParams,e.hash,_r(e.headers,t,r),e.body)),Un=b(2,(e,t)=>xe(e.method,e.url,e.urlParams,e.hash,ks(e.headers,t),e.body)),Ep=b(2,(e,t)=>xe(e.method,e.url,e.urlParams,e.hash,t(e.headers),e.body)),_o=b(2,(e,t)=>Ep(e,et(t))),Sy=b(3,(e,t,r)=>In(e,\"Authorization\",`Basic ${btoa(`${Cs(t)}:${Cs(r)}`)}`)),Ey=b(2,(e,t)=>In(e,\"Authorization\",`Bearer ${Cs(t)}`)),ji=b(2,(e,t)=>In(e,\"Accept\",t)),bp=ji(\"application/json\"),Mn=b(2,(e,t)=>{if(typeof t==\"string\")return xe(e.method,t,e.urlParams,e.hash,e.headers,e.body);let r=new URL(t.toString()),n=Ce(r.searchParams),o=Ed(r.hash===\"\"?void 0:r.hash.slice(1));return r.search=\"\",r.hash=\"\",xe(e.method,r.toString(),n,o,e.headers,e.body)}),ta=b(2,(e,t)=>t===\"\"?e:xe(e.method,wp(t,e.url),e.urlParams,e.hash,e.headers,e.body)),by=b(2,(e,t)=>t===\"\"?e:xe(e.method,wp(e.url,t),e.urlParams,e.hash,e.headers,e.body)),wp=(e,t)=>{let r=e.endsWith(\"/\"),n=t.startsWith(\"/\");return r&&n?e+t.slice(1):!r&&!n?e+\"/\"+t:e+t},wy=b(2,(e,t)=>xe(e.method,t(e.url),e.urlParams,e.hash,e.headers,e.body)),Ty=b(3,(e,t,r)=>xe(e.method,e.url,Nf(e.urlParams,t,r),e.hash,e.headers,e.body)),Tp=b(2,(e,t)=>xe(e.method,e.url,jf(e.urlParams,t),e.hash,e.headers,e.body)),Ry=b(3,(e,t,r)=>xe(e.method,e.url,qf(e.urlParams,t,r),e.hash,e.headers,e.body)),ra=b(2,(e,t)=>xe(e.method,e.url,Vf(e.urlParams,t),e.hash,e.headers,e.body)),Rp=b(2,(e,t)=>xe(e.method,e.url,e.urlParams,st(t),e.headers,e.body)),Cy=e=>xe(e.method,e.url,e.urlParams,ce(),e.headers,e.body),Se=b(2,(e,t)=>xe(e.method,e.url,e.urlParams,e.hash,Qs(e.headers,t),t)),ky=b(e=>Mo(e[0]),(e,t,r)=>Se(e,Rt(t,r))),Oy=b(e=>Mo(e[0]),(e,t,r)=>Se(e,ut(t,r))),Ay=b(2,(e,t)=>_(Pn(t),r=>Se(e,r))),Py=b(2,(e,t)=>Se(e,Wt(t))),vy=(e,t)=>{let r=Po(e,t);return b(2,(n,o)=>_(r(o),a=>Se(n,a)))},Hy=b(2,(e,t)=>Se(e,vo(Ce(t)))),qi=b(2,(e,t)=>Se(e,vn(t))),Iy=b(2,(e,t)=>Se(e,Ui(t))),Uy=b(e=>Mo(e[0]),(e,t,r)=>Se(e,Gt(t,r?.contentType,r?.contentLength))),My=b(e=>Mo(e[0]),(e,t,r)=>_(Mi(t,r),n=>Se(e,n)));function $o(e){let t=Uo(e.url,e.urlParams,le(e.hash));return Cd(t)?st(t.success):ce()}var _y=e=>{let t=e.method.toUpperCase();return Ni(Hn,{method:t,url:new URL(e.url),headers:e.headers,body:$y(e,t)})},$y=(e,t)=>!gr(t)||e.body===null?yr:Ao(e.body,{contentType:e.headers.get(\"content-type\")??void 0,contentLength:Ho(e.headers.get(\"content-length\"))}),Cp=(e,t)=>{let r=Uo(e.url,e.urlParams,le(e.hash));if(us(r))return ds(r.failure);let n={method:e.method,headers:e.headers};if(t?.signal&&(n.signal=t.signal),gr(e.method))switch(e.body._tag){case\"Empty\":break;case\"Raw\":{n.body=e.body.body,Fy(e.body.body)&&(n.duplex=\"half\");break}case\"Uint8Array\":{n.body=e.body.body;break}case\"FormData\":{n.body=e.body.formData;break}case\"Stream\":{n.body=En(e.body.stream,t?.context??gt()),n.duplex=\"half\";break}}return fs({try:()=>new Request(r.success,n),catch:o=>new Io({cause:o})})},Fy=e=>typeof ReadableStream<\"u\"&&e instanceof ReadableStream,Dy=(e,t)=>fr(r=>Ir(Cp(e,{context:r,signal:t?.signal})));var Ee=\"~effect/http/HttpIncomingMessage\";var kp=Ae(\"effect/http/HttpIncomingMessage/MaxBodySize\",{defaultValue:()=>{}}),Wr=(e,t)=>{let r=e.headers[\"content-type\"]??\"\",n;if(r.includes(\"application/json\"))try{n=at(e.json)}catch{}else if(r.includes(\"text/\")||r.includes(\"urlencoded\"))try{n=at(e.text)}catch{}let o={...t,headers:fn(e.headers),remoteAddress:e.remoteAddress};return n!==void 0&&(o.body=n),o};var Mt=\"~effect/http/HttpClientResponse\",Op=(e,t)=>new Vi(e,t);var Ap=b(2,(e,t)=>ve(()=>t(e.status)?v(e):q(new ne({reason:new mr({response:e,request:e.request,description:\"invalid status code\"})})))),Pp=e=>e.status>=200&&e.status<300?v(e):q(new ne({reason:new mr({response:e,request:e.request,description:\"non 2xx status code\"})})),Vi=class extends ht{[Ee];[Mt];request;source;constructor(t,r){super(),this.request=t,this.source=r,this[Ee]=Ee,this[Mt]=Mt}toJSON(){return Wr(this,{_id:\"HttpClientResponse\",request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get url(){if(this.source.url)return this.source.url.split(\"#\")[0];let t=$o(this.request);return Cr(t)?\"\":(t.value.hash=\"\",t.value.href)}get headers(){return fe(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=ws(this.source.headers.getSetCookie())}get remoteAddress(){return ce()}get stream(){return this.source.body?it({evaluate:()=>this.source.body,onError:t=>new ne({reason:new Ue({request:this.request,response:this,cause:t})})}):xo(new ne({reason:new Co({request:this.request,response:this,description:\"can not create stream from empty body\"})}))}get json(){return k(this.text,t=>Qe({try:()=>t===\"\"?null:JSON.parse(t),catch:r=>new ne({reason:new Ue({request:this.request,response:this,cause:r})})}))}textBody;get text(){return this.textBody??=_(this.arrayBuffer,t=>new TextDecoder().decode(t))}get urlParamsBody(){return k(this.text,t=>Qe({try:()=>Ce(new URLSearchParams(t)),catch:r=>new ne({reason:new Ue({request:this.request,response:this,cause:r})})}))}formDataBody;get formData(){return this.formDataBody??=Pe({try:()=>this.source.formData(),catch:t=>new ne({reason:new Ue({request:this.request,response:this,cause:t})})}).pipe(Vt,at)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody?this.arrayBufferBody:(this.arrayBufferBody=Pe({try:()=>this.source.arrayBuffer(),catch:t=>new ne({reason:new Ue({request:this.request,response:this,cause:t})})}).pipe(Vt,at),this.arrayBufferBody)}pipe(){return Fe(this,arguments)}};var Fo={};Te(Fo,{b3:()=>vp,fromHeaders:()=>Ly,toHeaders:()=>zi,w3c:()=>Ip,xb3:()=>Hp});var zi=e=>Mr({b3:`${e.traceId}-${e.spanId}-${e.sampled?\"1\":\"0\"}${ja(e.parent,{onNone:()=>\"\",onSome:t=>`-${t.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?\"01\":\"00\"}`}),Ly=e=>{let t=Ip(e);return Xe(t)||(t=vp(e),Xe(t))?t:Hp(e)},vp=e=>{if(!(\"b3\"in e))return ce();let t=e.b3.split(\"-\");return t.length<2?ce():st(ms({traceId:t[0],spanId:t[1],sampled:t[2]?t[2]===\"1\"||t[2]===\"d\":!0}))},Hp=e=>!e[\"x-b3-traceid\"]||!e[\"x-b3-spanid\"]?ce():st(ms({traceId:e[\"x-b3-traceid\"],spanId:e[\"x-b3-spanid\"],sampled:e[\"x-b3-flags\"]===\"1\"||(e[\"x-b3-sampled\"]?e[\"x-b3-sampled\"]===\"1\"||e[\"x-b3-sampled\"]===\"true\":!0)})),Ny=/^[0-9a-f]{32}$/i,jy=/^[0-9a-f]{16}$/i,Ip=e=>{if(!e.traceparent)return ce();let t=e.traceparent.split(\"-\");if(t.length!==4)return ce();let[r,n,o,a]=t;return r===\"00\"?Ny.test(n)===!1||jy.test(o)===!1||n===\"00000000000000000000000000000000\"||o===\"0000000000000000\"?ce():st(ms({traceId:n,spanId:o,sampled:(parseInt(a,16)&1)===1})):ce()};var Ji=\"~effect/http/HttpClient\",_p=e=>Q(e,Ji),Gr=se(\"effect/HttpClient\"),Yt=e=>(...t)=>k(Gr,r=>r[e](...t)),Vy=Yt(\"execute\"),zy=Yt(\"get\"),Jy=Yt(\"query\"),Wy=Yt(\"head\"),Gy=Yt(\"post\"),Ky=Yt(\"patch\"),Yy=Yt(\"put\"),Xy=Yt(\"del\"),Zy=Yt(\"options\"),Wi=b(2,(e,t)=>kt(k(r=>t(e.postprocess(v(r)),r)),e.preprocess)),Ne=b(2,(e,t)=>kt(r=>t(e.postprocess(r)),e.preprocess)),Qy=b(2,(e,t)=>Ne(e,af(t)));var eg=b(3,(e,t,r)=>Ne(e,n=>Es(n,t,r))),tg=b(2,(e,t)=>Ne(e,cf(t))),rg=b(3,(e,t,r)=>Ne(e,pf(t,r))),ng=b(3,(e,t,r)=>Ne(e,lf(t,r))),og=b(2,(e,t)=>Ne(e,k(Ap(t)))),Gi=Ne(k(Pp)),kt=(e,t)=>{let r=Object.create(sg);return r.preprocess=t,r.postprocess=e,r.execute=function(n){return e(t(n))},r},sg={[Ji]:Ji,pipe(){return Fe(this,arguments)},...cs,toJSON(){return{_id:\"effect/HttpClient\"}},...Object.fromEntries(xp.map(([e,t])=>[t,function(r,n){return this.execute(Ge(e)(r,n))}]))},Ki=e=>kt(t=>k(t,r=>Hr(n=>{let o=Lp.get(r),a=o??new AbortController,s=Uo(r.url,r.urlParams,le(r.hash));if(us(s))return q(new ne({reason:new Ro({request:r,cause:s.failure})}));let i=s.success;if(n.getRef(Id)||n.getRef(Fp)(r)){let d=e(r,i,a.signal,n);return o?d:ti(p=>Qa(p(d),{onSuccess(f){return sa.register(f,a),v(new aa(f,a))},onFailure(f){return Ga(f)&&a.abort(),vr(f)}}))}return wf(n.getRef(Bp)(r),{kind:\"client\"},d=>{d.attribute(\"http.request.method\",r.method),d.attribute(\"server.address\",i.origin),i.port!==\"\"&&d.attribute(\"server.port\",+i.port),d.attribute(\"url.full\",i.toString()),d.attribute(\"url.path\",i.pathname),d.attribute(\"url.scheme\",i.protocol.slice(0,-1));let p=i.search.slice(1);p!==\"\"&&d.attribute(\"url.query\",p);let f=n.getRef(Lf),h=n.getRef(Dp);for(let y in r.headers)h(y,\"request\")&&d.attribute(`http.request.header.${y}`,si(y,f)?\"<redacted>\":r.headers[y]);return r=n.getRef(ia)?Un(r,zi(d)):r,ti(y=>y(e(r,i,a.signal,n)).pipe(Tf(d,{captureStackTrace:!1}),Qa({onSuccess:u=>{d.attribute(\"http.response.status_code\",u.status);for(let g in u.headers)h(g,\"response\")&&d.attribute(`http.response.header.${g}`,si(g,f)?\"<redacted>\":u.headers[g]);return o?v(u):(sa.register(u,a),v(new aa(u,a)))},onFailure(u){return!o&&Ga(u)&&a.abort(),vr(u)}})))})})),v),Yi=b(2,(e,t)=>kt(e.postprocess,r=>_(e.preprocess(r),t))),ag=b(2,(e,t)=>kt(e.postprocess,r=>k(e.preprocess(r),t))),ig=b(2,(e,t)=>kt(e.postprocess,r=>e.preprocess(t(r)))),cg=b(2,(e,t)=>kt(e.postprocess,r=>k(t(r),e.preprocess))),dg=b(2,(e,t)=>Ne(e,Za(t))),Xi=b(2,(e,t)=>{let r=ef(t),n=r?\"errors-and-responses\":t.retryOn??\"errors-and-responses\",o=r?t:t.schedule,a=o&&gs(o),s=r?void 0:t.times;return Ne(e,as(n===\"errors-only\"?ot:Ef({schedule:a,times:s,while:Np}),n===\"response-only\"?ot:Za({while:r||t.while===void 0?Up:xd(Up,t.while),schedule:o,times:s})))}),fg=b(2,(e,t)=>{let r={initial:!0,limit:t.limit,window:Or(ps(t.window),ie(1))},n=new Map,o=t.key,a=typeof o==\"function\"?o:dn(o),s=t.tokens,i=typeof s==\"function\"?s:dn(s??1),c=!t.disableAdaptiveLearning,d=ug(t.responseHeaders),p=h=>{let y=n.get(h);return y!==void 0?y:(n.set(h,r),r)},f=t.disableResponseInspection?void 0:(h,y,u,g)=>{let x=p(y),C=pg(x,h,u,g,d);(C.limit!==x.limit||!Ja(C.window,x.window))&&n.set(y,C)};return Wi(e,function h(y,u,g=0){let C=su().getRef(qt),L=a(u),F=Math.max(i(u),1),O=p(L),H=t.times===void 0||g<t.times;function D(A){return A?k(yn(A),()=>h(y,u,g+1)):h(y,u,g+1)}let S=(A,B)=>{if(f?.(C,L,A.headers,F),t.disableResponseInspection||A.status!==429)return v(void 0);let j=hg(C,Do(A.headers,...d.retryAfter));if(j===void 0)return v(void 0);let N=$p(C,A.headers,d)??j;return B===void 0?v(N):Ss(t.limiter.adaptiveFeedback({key:L,epoch:B.epoch,tokens:F,status:A.status,retryAfter:N}),N)};return k(t.limiter.consume({algorithm:t.algorithm,onExceeded:\"delay\",key:L,limit:O.limit,window:O.window,tokens:F}),({delay:A})=>{let B=()=>{let j=N=>{let re=mf(y,{onSuccess(me){return k(S(me,N),Oe=>me.status!==429||!H?v(me):D(Oe))},onFailure(me){return Tg(me)?k(S(me.reason.response,N),Oe=>H?D(Oe):q(me)):q(me)}});return N===void 0||ls(N.delay)?re:uf(re,N.delay)};return c?k(t.limiter.adaptiveConsume({key:L,tokens:F,fallbackLimit:O.limit,fallbackWindow:O.window}),N=>!ls(N.delay)&&N.phase===\"cooldown\"?k(yn(N.delay),B):j(N)):j(void 0)};return ls(A)?B():k(yn(A),B)})})}),ug=e=>({limit:e?.limit===void 0?[\"ratelimit-limit\",\"x-ratelimit-limit\"]:[e.limit.toLowerCase()],remaining:e?.remaining===void 0?[\"ratelimit-remaining\",\"x-ratelimit-remaining\"]:[e.remaining.toLowerCase()],reset:e?.reset===void 0?[\"ratelimit-reset\",\"x-ratelimit-reset\"]:[e.reset.toLowerCase()],resetAfter:e?.resetAfter===void 0?[\"ratelimit-reset-after\",\"x-ratelimit-reset-after\"]:[e.resetAfter.toLowerCase()],retryAfter:e?.retryAfter===void 0?[\"retry-after\"]:[e.retryAfter.toLowerCase()]}),pg=(e,t,r,n,o)=>{let a=lg(e,r,n,o)??e.limit,s=$p(t,r,o)??e.window;return a===e.limit&&Ja(s,e.window)?e:{limit:a,window:s,initial:!1}},lg=(e,t,r,n)=>{let o=Do(t,...n.limit),a=Bo(o);if(a!==void 0&&a>0)return a;let s=mg(t,n);if(s!==void 0)return e.initial?s+r:Math.max(s+r,e.limit)},mg=(e,t)=>{let r=Do(e,...t.remaining),n=Bo(r);return n!==void 0&&n>=0?n:void 0},$p=(e,t,r)=>{let n=yg(Do(t,...r.resetAfter));return n!==void 0?n:gg(e,Do(t,...r.reset))},hg=(e,t)=>{if(t===void 0)return;let r=Bo(t);if(r!==void 0)return Or(he(r),ie(1));let n=Date.parse(t);if(Number.isNaN(n))return;let o=n-e.currentTimeMillisUnsafe();return o<=0?ie(1):ie(o)},yg=e=>{let t=Bo(e);if(!(t===void 0||t<=0))return Or(he(t),ie(1))},gg=(e,t)=>{let r=Bo(t);if(r===void 0||r<=0)return;let n=e.currentTimeMillisUnsafe();return r>1e12?ie(Math.max(r-n,1)):r>1e9?ie(Math.max(r*1e3-n,1)):Or(he(r),ie(1))},Bo=e=>{if(e===void 0)return;let t=/-?\\d+(?:\\.\\d+)?/.exec(e);if(t===null)return;let r=Number(t[0]);return Number.isFinite(r)?r:void 0},Do=(e,...t)=>{for(let r=0;r<t.length;r++){let n=e[t[r]];if(n!==void 0)return n}},Zi=b(2,(e,t)=>Ne(e,mn(t))),Qi=b(2,(e,t)=>Ne(e,df(t))),xg=b(2,(e,t)=>kt(e.postprocess,r=>mn(e.preprocess(r),t))),Sg=b(2,(e,t)=>kt(r=>mn(e.postprocess(r),n=>Mu(t,o=>Rs(o,n.cookies))),r=>k(e.preprocess(r),n=>_(Uu(t),o=>Ts(o)?n:In(n,\"cookie\",$f(o)))))),Eg=e=>Wi(e,(t,r)=>{let n=new AbortController;return Lp.set(r,n),ln(yf(()=>Le(()=>n.abort())),t)}),bg=b(e=>_p(e[0]),(e,t)=>kt(r=>{let n=(o,a)=>ve(()=>{let s;return k(e.postprocess(_(o,i=>(s=i,i))),i=>{if(i.status<300||i.status>=400||!i.headers.location||a>=(t??10))return v(i);let c=new URL(i.headers.location,i.request.url),d=s??i.request,p=d;return((i.status===301||i.status===302)&&d.method===\"POST\"||i.status===303&&d.method!==\"GET\"&&d.method!==\"HEAD\")&&(p=ea(p,\"GET\"),p=Se(p,yr)),c.origin!==new URL(i.request.url).origin&&(p=_o(p,\"authorization\"),p=_o(p,\"proxy-authorization\"),p=_o(p,\"cookie\")),n(v(Mn(p,c)),a+1)})});return n(r,0)},e.preprocess)),Fp=Ae(\"effect/http/HttpClient/TracerDisabledWhen\",{defaultValue:()=>hd}),Dp=Ae(\"effect/http/HttpClient/TracerHeaderFilter\",{defaultValue:()=>La}),ia=Ae(\"effect/http/HttpClient/TracerPropagationEnabled\",{defaultValue:La}),Bp=Ae(\"effect/http/HttpClient/SpanNameGenerator\",{defaultValue:()=>e=>`http.client ${e.method}`}),ec=e=>to(Gr)(fr(t=>_(e,r=>Ne(r,hf(n=>St(t,n)))))),sa=(()=>{if(\"FinalizationRegistry\"in globalThis&&globalThis.FinalizationRegistry){let t=new FinalizationRegistry(r=>{r.abort()});return{register(r,n){t.register(r,n,r)},unregister(r){t.unregister(r)}}}let e=new Map;return{register(t,r){e.set(t,setTimeout(()=>r.abort(),5e3))},unregister(t){let r=e.get(t);r!==void 0&&(clearTimeout(r),e.delete(t))}}})(),Lp=new WeakMap,aa=class{original;controller;constructor(t,r){this.original=t,this.controller=r}[Mt]=Mt;[Ee]=Ee;applyInterrupt(t){return ve(()=>(sa.unregister(this.original),xf(t,()=>Le(()=>{this.controller.abort()}))))}get request(){return this.original.request}get url(){return this.original.url}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return lu(()=>(sa.unregister(this.original),Su(this.original.stream,Le(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[Xn](){return this.original[Xn]()}pipe(){return Fe(this,arguments)}},Up=e=>jd(e)||wg(e),wg=e=>hr(e)&&(e.reason._tag===\"TransportError\"||e.reason._tag===\"StatusCodeError\"&&Np(e.reason.response)),Tg=e=>hr(e)&&e.reason._tag===\"StatusCodeError\"&&e.reason.response.status===429,Np=e=>e.status===408||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504;var jp=Ae(\"effect/http/FetchHttpClient/Fetch\",{defaultValue:()=>globalThis.fetch}),ca=class extends se()(\"effect/http/FetchHttpClient/RequestInit\"){},Rg=Ki((e,t,r,n)=>{let o=n.getRef(jp),a=xt(n.context,ca)??{},s=a.headers?$r(fe(a.headers),e.headers):e.headers;s[\"content-length\"]&&(s=et(s,\"content-length\"));let i=c=>_(Pe({try:()=>o(t,{...a,method:e.method,headers:s,body:c,duplex:typeof ReadableStream<\"u\"&&c instanceof ReadableStream?\"half\":void 0,signal:r}),catch:d=>new ne({reason:new To({request:e,cause:d})})}),d=>Op(e,d));switch(e.body._tag){case\"Raw\":case\"Uint8Array\":return i(e.body.body);case\"FormData\":return i(e.body.formData);case\"Stream\":return k(wu(e.body.stream),i)}return i(void 0)}),Cg=ec(v(Rg));var Sr={};Te(Sr,{empty:()=>Xt,expireCookie:()=>Jg,expireCookieUnsafe:()=>Gg,file:()=>Dg,fileWeb:()=>Bg,formData:()=>Fg,fromClientResponse:()=>ox,fromWeb:()=>ax,html:()=>vg,htmlStream:()=>Hg,isHttpServerResponse:()=>Kr,json:()=>Ig,jsonUnsafe:()=>Mg,mergeCookies:()=>Yg,omitsBody:()=>Qp,raw:()=>$g,redirect:()=>Ag,removeCookie:()=>qg,removeHeader:()=>Ng,replaceCookies:()=>Vg,schemaJson:()=>Ug,setBody:()=>Zp,setBodyKeepHeaders:()=>Qg,setCookie:()=>zg,setCookieUnsafe:()=>Wg,setCookies:()=>Xg,setCookiesUnsafe:()=>Zg,setHeader:()=>Lg,setHeaders:()=>jg,setStatus:()=>ex,stream:()=>Yp,text:()=>rc,toClientResponse:()=>rx,toWeb:()=>tx,uint8Array:()=>Pg,updateCookies:()=>Kg,urlParams:()=>_g});var kg=Object.getPrototypeOf(ze),qp=()=>Object.create(kg);function zp(e,...t){let r=t.length,n=new Array(r),o=[];for(let a=0;a<r;a++){let s=t[a];Na(s)?n[a]=s._tag===\"Some\"?_t(s.value):\"\":Wp(s)?n[a]=_t(s.value):Pr(s)?o.push([a,s]):n[a]=_t(s)}return o.length===0?v(Vp(e,n)):_(xs(o,([a,s])=>mn(s,i=>Le(()=>{n[a]=_t(i)})),{concurrency:\"unbounded\",discard:!0}),a=>Vp(e,n))}function Jp(e,...t){let r=[],n=\"\";for(let o=0,a=t.length;o<a;o++){n+=e[o];let s=t[o];Na(s)?n+=s._tag===\"Some\"?_t(s.value):\"\":Wp(s)?n+=_t(s.value):Pr(s)?(n.length>0&&(r.push(n),n=\"\"),r.push(_(s,_t))):Ms(s)?(n.length>0&&(r.push(n),n=\"\"),r.push($s(s,_t))):n+=_t(s)}return n+=e[e.length-1],n.length>0&&(r.push(n),n=\"\"),_s(r).pipe(mu(o=>Pr(o)?o:v(o),{concurrency:\"unbounded\"}),hu(o=>typeof o==\"string\"?qr(o):o))}function _t(e){if(Array.isArray(e))return e.map(_t).join(\"\");switch(typeof e){case\"string\":return e;case\"number\":case\"bigint\":return e.toString();case\"boolean\":return e?\"true\":\"false\";default:return\"\"}}function Vp(e,t){let r=\"\";for(let n=0,o=t.length;n<o;n++)r+=e[n],r+=t[n];return r+e[e.length-1]}function Wp(e){return qd(e)&&e._tag===\"Success\"}var tc=\"~effect/http/HttpServerResponse\",Kr=e=>Q(e,tc),Xt=e=>K({status:e?.status??204,statusText:e?.statusText,headers:e?.headers?fe(e.headers):void 0,cookies:e?.cookies}),Ag=(e,t)=>{let r=Mr({location:e.toString()});return K({status:t?.status??302,statusText:t?.statusText,headers:t?.headers?$r(r,fe(t.headers)):r,cookies:t?.cookies??no})},Pg=(e,t)=>{let r=t?.headers?fe(t.headers):ze;return K({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies??no,body:Rt(e,Yr(t,r))})},Yr=(e,t)=>{if(e?.contentType)return e.contentType;if(e?.headers)return t[\"content-type\"]},rc=(e,t)=>{let r=t?.headers?fe(t.headers):ze;return K({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies??no,body:ut(e,Yr(t,r))})},vg=(e,...t)=>typeof e==\"string\"?rc(e,{contentType:\"text/html\"}):_(zp(e,...t),r=>rc(r,{contentType:\"text/html\"})),Hg=(e,...t)=>_(Et(),r=>Yp(Fs(xu(Jp(e,...t)),r),{contentType:\"text/html\"})),Ig=(e,t)=>{let r=t?.headers?fe(t.headers):ze;return _(Pn(e,Yr(t,r)),n=>K({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies,body:n}))},Ug=(e,t)=>{let r=Po(e,t);return(n,o)=>{let a=o?.headers?fe(o.headers):ze;return _(r(n,Yr(o,a)),s=>K({status:o?.status??200,statusText:o?.statusText,headers:a,cookies:o?.cookies,body:s}))}},Mg=(e,t)=>{let r=t?.headers?fe(t.headers):ze;return K({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies,body:Wt(e,Yr(t,r))})},_g=(e,t)=>{let r=t?.headers?fe(t.headers):ze;return K({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies,body:ut(Fr(Ce(e)),Yr(t,r)??\"application/x-www-form-urlencoded\")})},$g=(e,t)=>K({status:t?.status??200,statusText:t?.statusText,headers:t?.headers&&fe(t.headers),cookies:t?.cookies,body:Ao(e,{contentType:t?.contentType,contentLength:t?.contentLength})}),Fg=(e,t)=>K({status:t?.status??200,statusText:t?.statusText,headers:t?.headers&&fe(t.headers),cookies:t?.cookies,body:vn(e)}),Yp=(e,t)=>{let r=t?.headers?fe(t.headers):ze;return K({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies,body:Gt(e,Yr(t,r),t?.contentLength)})},Xp=se(\"effect/http/HttpPlatform\"),Dg=(e,t)=>k(Xp,r=>r.fileResponse(e,t)),Bg=(e,t)=>k(Xp,r=>r.fileWebResponse(e,t)),Lg=b(3,(e,t,r)=>K(e,_r(e.headers,t,r))),Ng=b(2,(e,t)=>K({...e,headers:et(e.headers,t)})),jg=b(2,(e,t)=>K(e,ks(e.headers,t))),qg=b(2,(e,t)=>K({...e,cookies:Pf(e.cookies,t)})),Vg=b(2,(e,t)=>K({...e,cookies:t})),zg=b(e=>Kr(e[0]),(e,t,r,n)=>_(Ir(vf(e.cookies,t,r,n)),o=>K({...e,cookies:o}))),Jg=b(e=>Kr(e[0]),(e,t,r)=>_(Ir(If(e.cookies,t,r)),n=>K({...e,cookies:n}))),Wg=b(e=>Kr(e[0]),(e,t,r,n)=>K({...e,cookies:Hf(e.cookies,t,r,n)})),Gg=b(e=>Kr(e[0]),(e,t,r)=>K({...e,cookies:Uf(e.cookies,t,r)})),Kg=b(2,(e,t)=>K({...e,cookies:t(e.cookies)})),Yg=b(2,(e,t)=>K({...e,cookies:Rs(e.cookies,t)})),Xg=b(2,(e,t)=>_(Ir(Mf(e.cookies,t)),r=>K({...e,cookies:r}))),Zg=b(2,(e,t)=>K({...e,cookies:_f(e.cookies,t)})),Zp=b(2,(e,t)=>K({...e,body:t},Qs(e.headers,t))),Qg=(e,t)=>{let r=Object.create(tl);return r.status=e.status,r.statusText=e.statusText,r.headers=e.headers,r.cookies=e.cookies,r.body=t,r},ex=b(e=>Kr(e[0]),(e,t,r)=>K({...e,status:t,statusText:r??e.statusText})),Qp=(e,t=!1)=>t||e.status===204||e.status===205||e.status===304,tx=(e,t)=>{let r=new globalThis.Headers(e.headers);if(!Ts(e.cookies)){let s=Ff(e.cookies);for(let i of s)r.append(\"set-cookie\",i)}let n=e.body,o=Qp(e),a=o||t?.withoutBody===!0;if(n._tag===\"Raw\"&&n.body instanceof Response){let s=n.body;for(let[c,d]of r)c===\"set-cookie\"?s.headers.append(c,d):s.headers.set(c,d);if(!a)return s;let i=o?e:s;return new Response(void 0,{status:i.status,statusText:i.statusText,headers:s.headers})}if(a)return n._tag===\"Raw\"&&el(n.body)&&n.body.cancel().catch(ss),new Response(void 0,{status:e.status,statusText:e.statusText,headers:r});switch(n._tag){case\"Empty\":return new Response(void 0,{status:e.status,statusText:e.statusText,headers:r});case\"Uint8Array\":return new Response(n.text??n.body,{status:e.status,statusText:e.statusText,headers:r});case\"Raw\":return new Response(n.body,{status:e.status,statusText:e.statusText,headers:r});case\"FormData\":return new Response(n.formData,{status:e.status,statusText:e.statusText,headers:r});case\"Stream\":return new Response(En(n.stream,t?.context??gt()),{status:e.status,statusText:e.statusText,headers:r})}},rx=(e,t)=>new nc(t?.request??Hn,e),nc=class extends ht{[Ee];[Mt];request;response;constructor(t,r){super(),this.request=t,this.response=r,this[Ee]=Ee,this[Mt]=Mt}toJSON(){return Wr(this,{_id:\"HttpClientResponse\",request:this.request.toJSON(),status:this.status})}get status(){return this.response.status}get url(){if(this.request===Hn)return\"\";let t=$o(this.request);return Cr(t)?\"\":(t.value.hash=\"\",t.value.href)}cachedHeaders;get headers(){return this.cachedHeaders??=this.response.body._tag===\"FormData\"?$r(this.response.headers,fe(this.getFormDataResponse().headers)):this.response.headers}get cookies(){return this.response.cookies}get remoteAddress(){return ce()}get stream(){let t=this.response.body;switch(t._tag){case\"Empty\":return jr;case\"Stream\":return Sn(t.stream,r=>this.decodeError(r));case\"Uint8Array\":return qr(t.body);case\"Raw\":{let r=t.body;return r instanceof Response?r.body?it({evaluate:()=>r.body,onError:n=>this.decodeError(n)}):jr:el(r)?it({evaluate:()=>r,onError:n=>this.decodeError(n)}):r instanceof Blob?it({evaluate:()=>r.stream(),onError:n=>this.decodeError(n)}):yi(_(this.bytes,qr))}case\"FormData\":{let r=this.getFormDataResponse();return it({evaluate:()=>r.body,onError:n=>this.decodeError(n)})}}}get json(){return k(this.text,t=>Qe({try:()=>t===\"\"?null:JSON.parse(t),catch:r=>new ne({reason:new Ue({request:this.request,response:this,cause:r})})}))}get bytes(){let t=this.response.body;switch(t._tag){case\"Empty\":return v(new Uint8Array(0));case\"Uint8Array\":return v(t.body);case\"Stream\":return Ds(this.stream);case\"Raw\":{let r=t.body;return r instanceof Response?Pe({try:()=>r.clone().arrayBuffer().then(n=>new Uint8Array(n)),catch:n=>this.decodeError(n)}):Pe({try:()=>new Response(r).arrayBuffer().then(n=>new Uint8Array(n)),catch:n=>this.decodeError(n)})}case\"FormData\":return Pe({try:()=>new Response(t.formData).arrayBuffer().then(r=>new Uint8Array(r)),catch:r=>this.decodeError(r)})}}get text(){return _(this.bytes,t=>nx.decode(t))}get urlParamsBody(){return k(this.text,t=>Qe({try:()=>Ce(new URLSearchParams(t)),catch:r=>new ne({reason:new Ue({request:this.request,response:this,cause:r})})}))}get formData(){let t=this.response.body;return t._tag===\"FormData\"?v(t.formData):fr(r=>{let n=En(this.stream,r);return Pe({try:()=>new Response(n,{headers:this.headers}).formData(),catch:o=>this.decodeError(o)})})}get arrayBuffer(){return _(this.bytes,t=>t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength))}decodeError(t){return new ne({reason:new Ue({request:this.request,response:this,cause:t})})}formDataResponse;getFormDataResponse(){return this.formDataResponse??=new Response(this.response.body.formData)}pipe(){return Fe(this,arguments)}},nx=new TextDecoder,ox=e=>{let t=et(e.headers,\"set-cookie\");return K({status:e.status,headers:t,cookies:e.cookies,body:Gt(yu(e.stream,sx,()=>jr),le(Bf(t,\"content-type\")),Ho(t[\"content-length\"]))})},el=e=>typeof ReadableStream<\"u\"&&e instanceof ReadableStream,sx=e=>hr(e)&&e.reason._tag===\"EmptyBodyError\",tl={...Sd,[tc]:tc,[ur]:!0,toJSON(){return{_id:\"HttpServerResponse\",status:this.status,statusText:this.statusText,headers:fn(this.headers),cookies:this.cookies.toJSON(),body:this.body.toJSON()}}},K=(e,t)=>{let r=Object.create(tl);if(r.status=e.status,r.statusText=e.statusText,r.cookies=e.cookies??no,r.body=e.body??yr,r.body._tag!==\"Empty\"&&(r.body.contentType||r.body.contentLength!==void 0)){let n=t!==void 0,o=n?t:e.headers===void 0||e.headers===ze?qp():Mr({...e.headers});r.body.contentType&&(!n||o[\"content-type\"]===void 0)&&(o[\"content-type\"]=r.body.contentType),r.body.contentLength!==void 0&&(!n||o[\"content-length\"]===void 0)&&(o[\"content-length\"]=r.body.contentLength.toString()),r.headers=o}else r.headers=t??e.headers??ze;return r},ax=e=>{let t=new globalThis.Headers(e.headers),r=t.getSetCookie();t.delete(\"set-cookie\");let n=Xt({status:e.status,statusText:e.statusText,headers:t,cookies:ws(r)});if(e.body){let o=e.headers.get(\"content-type\");n=Zp(n,Gt(it({evaluate:()=>e.body,onError:a=>a}),o??void 0,Ho(e.headers.get(\"content-length\"))))}return n};var Zt=\"~effect/http/HttpServerRespondable\";var rl=\"~effect/http/HttpServerError\",Ot=class extends ae(\"HttpServerError\"){constructor(t){\"cause\"in t.reason?super({...t,cause:t.reason.cause}):super(t)}[rl]=rl;stack=`${this.name}: ${this.message}`;get request(){return this.reason.request}get response(){return\"response\"in this.reason?this.reason.response:void 0}[Zt](){return this.reason[Zt]()}get[ur](){return this.reason[ur]??!1}get message(){return this.reason.message}},At=class extends ae(\"RequestParseError\"){[Zt](){return v(Xt({status:400}))}get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return sc(this._tag,this.description,this.methodAndUrl)}},nl=class extends ae(\"RouteNotFound\"){[Zt](){return v(Xt({status:404}))}[ur]=!0;get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return sc(this._tag,this.description,this.methodAndUrl)}},ol=class extends ae(\"InternalError\"){[Zt](){return v(Xt({status:500}))}get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return sc(this._tag,this.description,this.methodAndUrl)}};var sl=class extends ae(\"ResponseError\"){[Zt](){return v(Xt({status:500}))}get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let t=`${this._tag} (${this.response.status} ${this.methodAndUrl})`;return this.description?`${t}: ${this.description}`:t}};var sc=(e,t,r)=>{let n=`${e} (${r})`;return t?`${n}: ${t}`:n};var al=/; *([!#$%&'*+.^\\w`|~-]+)=(\"(?:[\\v\\u0020\\u0021\\u0023-\\u005b\\u005d-\\u007e\\u0080-\\u{10ffff}]|\\\\[\\v\\u0020-\\u{10ffff}])*\"|[!#$%&'*+.^\\w`|~-]+) */gu,il=/\\\\([\\v\\u0020-\\u{10ffff}])/gu,cx=/^[!#$%&'*+.^\\w|~-]+\\/[!#$%&'*+.^\\w|~-]+$/u,dx=/^[!#$%&'*+.^\\w|~-]+$/u,da={value:\"\",parameters:Object.create(null)};function fa(e,t=!1){if(typeof e!=\"string\")return da;let r=e.indexOf(\";\"),n=r!==-1?e.slice(0,r).trim():e.trim();if((t?dx:cx).test(n)===!1)return da;let a={value:n.toLowerCase(),parameters:Object.create(null)};if(r===-1)return a;let s,i,c;for(al.lastIndex=r;i=al.exec(e);){if(i.index!==r)return da;r+=i[0].length,s=i[1].toLowerCase(),c=i[2],c[0]==='\"'&&(c=c.slice(1,c.length-1),!t&&il.test(c)&&(c=c.replace(il,\"$1\"))),a.parameters[s]=c}return r!==e.length?da:a}var $t={key:0,whitespace:1,value:2},Lo={_tag:\"Continue\"},cl=new Uint8Array(256);for(let e of\"!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\")cl[e.charCodeAt(0)]=1;var ua=new Uint8Array(256);ua[9]=1;for(let e=32;e<=126;e++)ua[e]=1;for(let e=128;e<=255;e++)ua[e]=1;function dl(){let e=new TextDecoder,t={state:$t.key,headers:Object.create(null),key:\"\",value:void 0,crlf:0,previousChunk:void 0,pairs:0,size:0};function r(a){return t.state=$t.key,t.headers=Object.create(null),t.key=\"\",t.value=void 0,t.crlf=0,t.previousChunk=void 0,t.pairs=0,t.size=0,a}function n(a,s){let i=new Uint8Array(a.length+s.length);return i.set(a),i.set(s,a.length),i}function o(a){return r({_tag:\"Failure\",reason:a,headers:t.headers})}return function(s,i){let c=0,d;if(t.previousChunk!==void 0){c=t.previousChunk.length,d=c;let f=new Uint8Array(s.length+c);f.set(t.previousChunk),f.set(s,c),t.previousChunk=void 0,s=f}let p=s.length;e:for(;i<p;){if(t.state===$t.key){let f=i;for(;f<p;f++){if(t.size++>16384)return o(\"HeaderTooLarge\");if(s[f]===58){if(t.key+=e.decode(s.subarray(i,f)).toLowerCase(),t.key.length===0)return o(\"InvalidHeaderName\");s[f+1]===32&&s[f+2]!==32&&s[f+2]!==9?(i=f+2,t.state=$t.value,t.size++):s[f+1]!==32&&s[f+1]!==9?(i=f+1,t.state=$t.value):(i=f+1,t.state=$t.whitespace);break}else if(cl[s[f]]!==1)return o(\"InvalidHeaderName\")}if(f===p)return t.key+=e.decode(s.subarray(i,p)).toLowerCase(),Lo}if(t.state===$t.whitespace){for(;i<p;i++){if(t.size++>16384)return o(\"HeaderTooLarge\");if(s[i]!==32&&s[i]!==9){t.state=$t.value;break}}if(i===p)return Lo}if(t.state===$t.value){let f=i;for(d!==void 0&&(f=d,d=void 0);f<p;f++){if(t.size++>16384)return o(\"HeaderTooLarge\");if(s[f]===13||t.crlf>0){let h=s[f];if(h===13&&t.crlf===0&&(t.crlf=1,f++,t.size++,h=s[f]),h===10&&t.crlf===1&&(t.crlf=2,f++,t.size++,h=s[f]),h===13&&t.crlf===2&&(t.crlf=3,f++,t.size++,h=s[f]),h===10&&t.crlf===3&&(t.crlf=4,f++,t.size++),t.crlf<4&&f>=p)return t.previousChunk=s.subarray(i),Lo;if(t.crlf>=2){t.value=t.value===void 0?s.subarray(i,f-t.crlf):n(t.value,s.subarray(i,f-t.crlf));let y=e.decode(t.value);if(t.headers[t.key]===void 0?t.headers[t.key]=y:typeof t.headers[t.key]==\"string\"?t.headers[t.key]=[t.headers[t.key],y]:t.headers[t.key].push(y),i=f,t.size--,t.crlf!==4&&t.pairs===100)return o(\"TooManyHeaders\");if(t.crlf===3)return o(\"InvalidHeaderValue\");if(t.crlf===4)return r({_tag:\"Headers\",headers:t.headers,endPosition:i-c});t.pairs++,t.key=\"\",t.value=void 0,t.crlf=0,t.state=$t.key;continue e}}else if(ua[s[f]]!==1)return o(\"InvalidHeaderValue\")}if(f===p)return t.value=t.value===void 0?s.subarray(i,p):n(t.value,s.subarray(i,p)),Lo}}return i>p&&(t.size+=p-i),Lo}}function px(e){let t=new TextEncoder().encode(e),r=t.length,n={};for(let o=0;o<r;o++){let a=t[o];n[a]===void 0&&(n[a]=[]),n[a].push(o)}return{needle:t,needleLength:r,indexes:n,firstByte:t[0],previousChunk:void 0,previousChunkLength:0,matchIndex:0}}function fl(e,t,r,n){let o=px(e),a=n??o.needleLength;r!==void 0&&(o.previousChunk=r,o.previousChunkLength=r.length);function s(){if(\"Buffer\"in globalThis&&!(\"Bun\"in globalThis||\"Deno\"in globalThis))return function(f,h,y){return Buffer.prototype.indexOf.call(f,h,y)};let p=new Uint8Array(256).fill(o.needle.length);for(let f=0,h=o.needle.length-1;f<h;++f)p[o.needle[f]]=h-f;return function(f,h,y){let u=f.length,g=y+o.needleLength-1;for(;g<u;){for(let x=o.needleLength-1,C=g;x>=0&&f[C]===h[x];x--,C--)if(x===0)return C;g+=p[f[g]]}return-1}}let i=s();function c(p){let f=p.length;if(o.previousChunk!==void 0){let y=new Uint8Array(o.previousChunkLength+f);y.set(o.previousChunk),y.set(p,o.previousChunkLength),p=y,f=o.previousChunkLength+f,o.previousChunk=void 0}let h=0;for(;h<f;){let y=f-h;if(y<a){o.previousChunk=p.subarray(h),o.previousChunkLength=y;return}let u=i(p,o.needle,h);if(u>-1){u>h&&t(o.matchIndex,p.subarray(h,u)),o.matchIndex+=1,h=u+o.needleLength;continue}else if(p[f-1]in o.indexes){let g=o.indexes[p[f-1]],x=-1;for(let C=0,L=g.length;C<L;C++){let F=g[C];p[f-1-F]===o.firstByte&&C>x&&(x=F)}x===-1?h===0?t(o.matchIndex,p):t(o.matchIndex,p.subarray(h)):(f-1-x>h&&t(o.matchIndex,p.subarray(h,f-1-x)),o.previousChunk=p.subarray(f-1-x),o.previousChunkLength=x+1)}else h===0?t(o.matchIndex,p):t(o.matchIndex,p.subarray(h));break}}function d(){o.previousChunk!==void 0&&o.previousChunk!==r&&t(o.matchIndex,o.previousChunk),o.previousChunk=r,o.previousChunkLength=r?.length??0,o.matchIndex=0}return{write:c,end:d}}var Xr={headers:0,body:1},mx={_tag:\"InvalidDisposition\"},hx={_tag:\"EndNotReached\"},yx={_tag:\"ReachedLimit\",limit:\"MaxParts\"},gx={_tag:\"ReachedLimit\",limit:\"MaxTotalSize\"},xx={_tag:\"ReachedLimit\",limit:\"MaxPartSize\"},ul={_tag:\"ReachedLimit\",limit:\"MaxFieldSize\"},Sx=new TextEncoder().encode(`\\r\n`);function ic(e){return e.filename!==void 0||e.contentType===\"application/octet-stream\"}function Ex(e){return fa(e[\"content-type\"]).parameters.boundary}function pa(e){}var ac=e=>e===1/0?1/0:Number(ni(e));function ll({headers:e,onFile:t,onField:r,onError:n,onDone:o,isFile:a=ic,maxParts:s=1/0,maxTotalSize:i=1/0,maxPartSize:c=1/0,maxFieldSize:d=1024*1024}){let p=ac(i),f=ac(c),h=ac(d),y=Ex(e);if(y===void 0)return n({_tag:\"InvalidBoundary\"}),{write:pa,end(){}};let u={state:Xr.headers,index:0,parts:0,onChunk:pa,info:void 0,headerSkip:0,partSize:0,totalSize:0,isFile:!1,fieldChunks:[],fieldSize:0,done:!1,stopped:!1};function g(){u.state=Xr.body,u.isFile=!0,u.onChunk=pa}function x(F){u.stopped=!0,u.state===Xr.body&&u.isFile&&u.onChunk(null),n(F)}let C=dl(),L=fl(`\\r\n--${y}`,function(F,O){if(!u.stopped){if(F===0){g();return}else if(F!==u.index){if(u.index>0)if(u.isFile)u.onChunk(null);else{if(u.fieldChunks.length===1)r(u.info,u.fieldChunks[0]);else{let H=new Uint8Array(u.fieldSize),D=0;for(let S=0;S<u.fieldChunks.length;S++){let A=u.fieldChunks[S];H.set(A,D),D+=A.length}r(u.info,H)}u.fieldSize=0,u.fieldChunks=[]}if(u.partSize=0,u.state=Xr.headers,u.index=F,u.headerSkip=2,O[0]===45&&O[1]===45)return u.done=!0,o();if(u.parts++,u.parts>s)return x(yx)}if((u.partSize+=O.length)>f)return x(xx);if(u.state===Xr.headers){let H=C(O,u.headerSkip);if(u.headerSkip=0,H._tag===\"Continue\")return;if(H._tag===\"Failure\")return g(),n({_tag:\"BadHeaders\",error:H});let D=fa(H.headers[\"content-type\"]),S=fa(H.headers[\"content-disposition\"],!0);if(S.value===\"form-data\"&&!(\"name\"in S.parameters))return g(),n(mx);let A;if(\"filename*\"in S.parameters){let B=S.parameters[\"filename*\"].split(\"''\");if(B.length===2)try{A=decodeURIComponent(B[1])}catch{A=B[1]}}if(u.info={name:S.parameters.name??\"\",filename:A??S.parameters.filename,contentType:D.value===\"\"?S.parameters.filename!==void 0?\"application/octet-stream\":\"text/plain\":D.value,contentTypeParameters:D.parameters,contentDisposition:S.value,contentDispositionParameters:S.parameters,headers:H.headers},u.state=Xr.body,u.isFile=a(u.info),u.isFile&&(u.onChunk=t(u.info)),H.endPosition<O.length)if(u.isFile)u.onChunk(O.subarray(H.endPosition));else{let B=O.subarray(H.endPosition);if((u.fieldSize+=B.length)>h)return x(ul);u.fieldChunks.push(B)}}else if(u.isFile)u.onChunk(O);else{if((u.fieldSize+=O.length)>h)return x(ul);u.fieldChunks.push(O)}}},Sx,2);return{write(F){if(!u.stopped)return(u.totalSize+=F.length)>p?x(gx):L.write(F)},end(){L.end(),!u.done&&!u.stopped&&x(hx),u.state=Xr.headers,u.index=0,u.parts=0,u.onChunk=pa,u.info=void 0,u.totalSize=0,u.partSize=0,u.fieldChunks=[],u.fieldSize=0,u.done=!1,u.stopped=!1}}}var pl=new TextDecoder(\"utf-8\");function bx(e){if(e===\"utf-8\"||e===\"utf8\"||e===\"\")return pl;try{return new TextDecoder(e)}catch{return pl}}function ml(e,t){return bx(e.contentTypeParameters.charset??\"utf-8\").decode(t)}var hl=ll,yl=ic,gl=ml;var Ft=\"~effect/http/Multipart\";var cc=\"~effect/http/Multipart/MultipartError\",Sl=e=>Cx(e)?e:Ke.fromReason(\"InternalError\",e),dc=class extends vd{},Rx={FileTooLarge:413,FieldTooLarge:413,BodyTooLarge:413,TooManyParts:413,InternalError:500,Parse:400},Ke=class e extends ae(\"MultipartError\"){static fromReason(t,r){return new e({reason:new dc({_tag:t,cause:r})})}[cc]=cc;[ur]=!0;[Zt](){return v(Xt({status:Rx[this.reason._tag]}))}get message(){return this.reason._tag}},Cx=e=>Q(e,cc);var kx=e=>Hr(t=>{let r=ar(t.context,Ix);return v({headers:e,maxParts:t.getRef(Px),maxFieldSize:t.getRef(vx),maxPartSize:t.getRef(Hx),maxTotalSize:t.getRef(kp),isFile:r.length===0?void 0:n=>!r.some(o=>n.contentType.includes(o))&&yl(n)})}),lc=e=>Us(t=>_(kx(e),r=>{let n=[],o=ce(),a=!1,s=hl({...r,onField(c,d){n.push(new fc(c.name,c.contentType,gl(c,d)))},onFile(c){let d=[],p=!1,f=au(v(ve(function h(){if(!za(d))return p?Nd():Xe(o)?o.value:k(i,h);let y=d;return d=[],v(y)})));return n.push(new uc(c,iu(f,Sl))),function(h){h===null?p=!0:d.push(h)}},onError(c){o=st(Ka(Ox(c)))},onDone(){Cr(o)&&(o=st(Ka(Ld())))}}),i=t.pipe(k(c=>{for(let d=0;d<c.length;d++)s.write(c[d]);return de}),hn(c=>(Qd(c)?a||(a=!0,s.end()):o=st(Vd(c)),de)));return ve(function c(){if(!za(n))return Xe(o)?o.value:k(i,c);let d=n;return n=[],v(d)})}));function Ox(e){switch(e._tag){case\"ReachedLimit\":switch(e.limit){case\"MaxParts\":return Ke.fromReason(\"TooManyParts\",e);case\"MaxFieldSize\":return Ke.fromReason(\"FieldTooLarge\",e);case\"MaxPartSize\":return Ke.fromReason(\"FileTooLarge\",e);case\"MaxTotalSize\":return Ke.fromReason(\"BodyTooLarge\",e)}default:return Ke.fromReason(\"Parse\",e)}}var No=class extends ht{[Ft];constructor(){super(),this[Ft]=Ft}},fc=class extends No{_tag=\"Field\";key;contentType;value;constructor(t,r,n){super(),this.key=t,this.contentType=r,this.value=n}toJSON(){return{_id:\"@effect/platform/Multipart/Part\",_tag:\"Field\",key:this.key,contentType:this.contentType,value:this.value}}},uc=class extends No{_tag=\"File\";key;name;contentType;content;contentEffect;constructor(t,r){super(),this.key=t.name,this.name=t.filename??t.name,this.contentType=t.contentType,this.content=uu(r),this.contentEffect=du(r)}toJSON(){return{_id:\"@effect/platform/Multipart/Part\",_tag:\"File\",key:this.key,name:this.name,contentType:this.contentType}}},Ax=(e,t)=>k(bn,r=>Ur(Eu(t.content,r.sink(e)),Sl));var mc=(e,t=Ax)=>Ze(function*(){let r=yield*bn,n=yield*Tu,o=yield*r.makeTempDirectoryScoped(),a=Object.create(null),s=new Set,i=0;return yield*bu(e,c=>{if(c._tag===\"Field\")return c.key in a?typeof a[c.key]==\"string\"?a[c.key]=[a[c.key],c.value]:a[c.key].push(c.value):a[c.key]=c.value,de;if(c.name===\"\")return de;let d=c,p=n.basename(d.name).slice(-128),f=n.join(o,p);for(;s.has(f);)f=n.join(o,`${i++}-${p}`);s.add(f);let h=new pc(d.key,d.name,d.contentType,f);return Array.isArray(a[c.key])?a[c.key].push(h):a[c.key]=[h],t(f,d)}),a}).pipe(Es(\"PlatformError\",r=>q(Ke.fromReason(\"InternalError\",r)))),pc=class extends No{_tag=\"PersistedFile\";key;name;contentType;path;constructor(t,r,n,o){super(),this.key=t,this.name=r,this.contentType=n,this.path=o}toJSON(){return{_id:\"@effect/platform/Multipart/Part\",_tag:\"PersistedFile\",key:this.key,name:this.name,contentType:this.contentType,path:this.path}}};var Px=Ae(\"effect/http/Multipart/MaxParts\",{defaultValue:()=>{}}),vx=Ae(\"effect/http/Multipart/MaxFieldSize\",{defaultValue:dn(Af(10))}),Hx=Ae(\"effect/http/Multipart/MaxFileSize\",{defaultValue:()=>{}}),Ix=Ae(\"effect/http/Multipart/FieldMimeTypes\",{defaultValue:dn([\"application/json\"])});var Dn=\"~effect/http/HttpServerRequest\",Tl=se(\"effect/http/HttpServerRequest\");var Ux=e=>{if(e[0]===\"/\")return e;let t=e.indexOf(\"/\",e.indexOf(\"//\")+2);return t===-1?\"/\":e.slice(t)},bl=class e extends ht{[Dn];[Ee];source;url;headersOverride;remoteAddressOverride;constructor(t,r,n,o){super(),this[Dn]=Dn,this[Ee]=Ee,this.source=t,this.url=r,this.headersOverride=n,this.remoteAddressOverride=o}toJSON(){return Wr(this,{_id:\"HttpServerRequest\",method:this.method,url:this.originalUrl})}modify(t){return new e(this.source,t.url??this.url,t.headers??this.headersOverride,\"remoteAddress\"in t?t.remoteAddress:this.remoteAddressOverride)}get method(){return this.source.method.toUpperCase()}get originalUrl(){return this.source.url}get remoteAddress(){return this.remoteAddressOverride??ce()}get headers(){return this.headersOverride??=fe(this.source.headers),this.headersOverride}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=oi(this.headers.cookie??\"\")}get stream(){return this.source.body?it({evaluate:()=>this.source.body,onError:t=>new Ot({reason:new At({request:this,cause:t})})}):xo(new Ot({reason:new At({request:this,description:\"can not create stream from empty body\"})}))}textEffect;get text(){return this.textEffect?this.textEffect:(this.textEffect=at(Vt(Pe({try:()=>this.source.text(),catch:t=>new Ot({reason:new At({request:this,cause:t})})}))),this.textEffect)}get json(){return k(this.text,t=>Qe({try:()=>JSON.parse(t),catch:r=>new Ot({reason:new At({request:this,cause:r})})}))}get urlParamsBody(){return k(this.text,t=>Qe({try:()=>Ce(new URLSearchParams(t)),catch:r=>new Ot({reason:new At({request:this,cause:r})})}))}multipartEffect;get multipart(){return this.multipartEffect?this.multipartEffect:(this.multipartEffect=at(Vt(mc(this.multipartStream))),this.multipartEffect)}get multipartStream(){return So(Sn(this.stream,t=>Ke.fromReason(\"InternalError\",t)),lc(this.headers))}arrayBufferEffect;get arrayBuffer(){return this.arrayBufferEffect?this.arrayBufferEffect:(this.arrayBufferEffect=at(Vt(Pe({try:()=>this.source.arrayBuffer(),catch:t=>new Ot({reason:new At({request:this,cause:t})})}))),this.arrayBufferEffect)}get upgrade(){return q(new Ot({reason:new At({request:this,description:\"Not an upgradeable ServerRequest\"})}))}},wl=class e extends ht{[Dn];[Ee];source;originalUrl;headersOverride;remoteAddressOverride;urlOverride;constructor(t,r,n,o,a){super(),this[Dn]=Dn,this[Ee]=Ee,this.source=t,this.originalUrl=r,this.urlOverride=n,this.headersOverride=o,this.remoteAddressOverride=a}toJSON(){return Wr(this,{_id:\"HttpServerRequest\",method:this.method,url:this.originalUrl})}modify(t){return new e(this.source,this.originalUrl,t.url??this.url,t.headers??this.headersOverride,\"remoteAddress\"in t?t.remoteAddress:this.remoteAddressOverride)}get method(){return this.source.method}get url(){return this.urlOverride??Ux(this.originalUrl)}get remoteAddress(){return this.remoteAddressOverride??ce()}get headers(){return this.headersOverride??=this.source.headers}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=oi(this.headers.cookie??\"\")}get stream(){let t=this.source.body;switch(t._tag){case\"Empty\":return jr;case\"Uint8Array\":return qr(t.body);case\"Stream\":return Sn(t.stream,r=>Qt(this,void 0,r));case\"FormData\":return la(this,new Response(t.formData).body);case\"Raw\":return Mx(this,t.body)}}bytesEffect;get bytes(){if(this.bytesEffect)return this.bytesEffect;let t=this.source.body,r;switch(t._tag){case\"Empty\":{r=v(new Uint8Array(0));break}case\"Uint8Array\":{r=v(t.body);break}case\"FormData\":{r=Rl(this,t.formData);break}case\"Stream\":{r=Ds(this.stream);break}case\"Raw\":{r=_x(this,t.body);break}}return this.bytesEffect=at(Vt(r)),this.bytesEffect}get text(){return _(this.bytes,t=>Dx.decode(t))}get json(){return k(this.text,t=>Qe({try:()=>t===\"\"?null:JSON.parse(t),catch:r=>Qt(this,void 0,r)}))}get urlParamsBody(){return k(this.text,t=>Qe({try:()=>Ce(new URLSearchParams(t)),catch:r=>Qt(this,void 0,r)}))}multipartEffect;get multipart(){return this.multipartEffect?this.multipartEffect:(this.multipartEffect=at(Vt(mc(this.multipartStream))),this.multipartEffect)}get multipartStream(){let t=this.source.body._tag===\"FormData\"&&this.source.body.formData;return t?_s($x(t)):So(Sn(this.stream,r=>Ke.fromReason(\"InternalError\",r)),lc(this.headers))}get arrayBuffer(){return _(this.bytes,t=>t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength))}get upgrade(){return q(Qt(this,\"Not an upgradeable ServerRequest\"))}};var Mx=(e,t)=>t instanceof Request?la(e,t.body):Cl(t)?la(e,t):kl(t)?la(e,new Response(t).body):xo(Qt(e,\"Unsupported body type\")),_x=(e,t)=>t instanceof Request?Pe({try:()=>t.arrayBuffer().then(r=>new Uint8Array(r)),catch:r=>Qt(e,void 0,r)}):kl(t)?Rl(e,t):q(Qt(e,\"Unsupported body type\")),Rl=(e,t)=>Pe({try:()=>new Response(t).arrayBuffer().then(r=>new Uint8Array(r)),catch:r=>Qt(e,void 0,r)}),la=(e,t)=>t?it({evaluate:()=>t,onError:r=>Qt(e,void 0,r)}):jr,Qt=(e,t,r)=>new Ot({reason:new At({request:e,...t===void 0?void 0:{description:t},...r===void 0?void 0:{cause:r}})}),$x=e=>{let t=[];for(let[r,n]of e.entries())t.push(typeof n==\"string\"?new hc(r,n):new yc(r,n));return t},hc=class extends ht{[Ft];_tag=\"Field\";contentType=\"text/plain\";key;value;constructor(t,r){super(),this[Ft]=Ft,this.key=t,this.value=r}toJSON(){return{_id:\"@effect/platform/Multipart/Part\",_tag:\"Field\",key:this.key,contentType:this.contentType,value:this.value}}},yc=class extends ht{[Ft];_tag=\"File\";key;name;contentType;content;contentEffect;constructor(t,r){super(),this[Ft]=Ft,this.key=t,this.name=r.name,this.contentType=r.type,this.content=it({evaluate:()=>r.stream(),onError:n=>Ke.fromReason(\"InternalError\",n)}),this.contentEffect=Pe({try:()=>r.arrayBuffer().then(n=>new Uint8Array(n)),catch:n=>Ke.fromReason(\"InternalError\",n)})}toJSON(){return{_id:\"@effect/platform/Multipart/Part\",_tag:\"File\",key:this.key,name:this.name,contentType:this.contentType}}},Cl=e=>typeof ReadableStream<\"u\"&&e instanceof ReadableStream,Fx=e=>typeof FormData<\"u\"&&e instanceof FormData,kl=e=>typeof e==\"string\"||typeof ArrayBuffer<\"u\"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Blob<\"u\"&&e instanceof Blob||Fx(e)||typeof URLSearchParams<\"u\"&&e instanceof URLSearchParams||Cl(e),Dx=new TextDecoder;var Lx=new WeakSet;var Ol=e=>Hr(t=>{let r=qa(t.context,Tl);return Lx.add(r.source),e});var jx=se(\"effect/http/HttpRouter\");var qx=e=>e.endsWith(\"/\")?e.slice(0,-1):e,Hl=b(2,(e,t)=>(t=qx(t),e===\"*\"?`${t}/*`:e===\"/\"?t:t+e));var Vx=\"~effect/http/HttpRouter/Middleware\",zx=function(){return arguments.length===0?Pl:Pl(arguments[0],arguments[1])},Pl=(e,t)=>t?.global?ys(Ze(function*(){let r=yield*jx,n=Pr(e)?yield*e:e;yield*r.addGlobalMiddleware(n)})):new xc(Pr(e)?Xa(_(e,r=>Zn(new Map([[gc,r]])))):Kd(Zn(new Map([[gc,e]])))),Jx=0,gc=\"effect/http/HttpRouter/MiddlewareFn\",xc=class e{[Vx]={};layerFn;dependencies;constructor(t,r){this.layerFn=t,this.dependencies=r;let n=`effect/http/HttpRouter/Middleware-${++Jx}`;this.layer=Xa(Ze({self:this},function*(){let o=yield*Et(),a=[Td(o,gc)];if(this.dependencies){let s=yield*Wd,i=ar(o,eo),c=yield*Gd(this.dependencies,s,i);a.push(...Wx(c))}return Zn(new Map([[n,a]]))})).pipe(Xd(this.layerFn))}layer;combine(t){return new e(this.layerFn,this.dependencies?cr(this.dependencies,t.layer):t.layer)}},vl=new WeakMap,Wx=e=>{let t=vl.get(e);if(t)return t;let r=Od(),n=0;for(let[o,a]of e.mapUnsafe)o.startsWith(\"effect/http/HttpRouter/Middleware-\")&&(r.push(a),a.length>n&&(n=a.length));if(r.length===0)t=[];else{let o=new Set;for(let a=n-1;a>=0;a--)for(let s of r)a<s.length&&o.add(s[a]);t=kd(o).reverse()}return vl.set(e,t),t};var d0=zx(Ol).layer;var Gx={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,OK:200,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511},Ul=e=>Gx[e];var Sc=\"executor.owner\",$l=J.Reference(\"@executor-js/telemetry/SpanOwner\",{defaultValue:()=>{}}),Ec=e=>J.get(e,$l),jo=(e,t={})=>({...t,annotations:J.add(t.annotations??J.empty(),$l,e)}),Kx=(e,t,r)=>n=>n.pipe(m.withSpan(t,jo(e,r))),Yx=(e,t,r)=>n=>m.useSpan(e,t,o=>{let a=m.withParentSpan(n,o);if(o.status._tag===\"Ended\")return a;let{around:s,end:i}=r(o.status.startTime);return(s===void 0?a:s(a)).pipe(m.onExit(c=>m.flatMap(ro.currentTimeNanos,d=>m.sync(()=>{i(d,o),o.end(d,c)}))))}),Xx=[\"executor\",\"person\",\"upstream\",\"lease\",\"app\"],_l=()=>({executor:0,app:0,upstream:0,person:0,lease:0,background:0}),Zx=(e,t)=>{let r=_l(),n=_l(),o=new WeakMap,a=e,s=!1,i=0,c=y=>{if(y<=a)return;let u=Xx.find(x=>n[x]>0)??t,g=Number(y-a)/1e6;r[u]+=g,i>0&&(r.background+=g),a=y},d=y=>{let u=y.parent;for(;u!==void 0&&!u.open;)u=u.parent;return y.parent=u,u},p=y=>{if(y.owner===\"background\"){i+=1;return}let u=d(y);u!==void 0&&u.children++===0&&(n[u.owner]-=1),n[y.owner]+=1},f=y=>{if(y.open=!1,y.owner===\"background\"){i-=1;return}y.children===0&&(n[y.owner]-=1);let u=d(y);u!==void 0&&(u.children+=y.children-1,u.children===0&&(n[u.owner]+=1))},h=y=>({...y,span:u=>{let g=y.span(u);if(s)return g;let x=ee.getOrUndefined(u.parent),C=x===void 0?void 0:o.get(x),F=C?.owner===\"background\"?\"background\":Ec(u.annotations),O={owner:F??C?.owner??t,parent:F===\"background\"?void 0:C,open:!0,children:0};c(u.startTime),p(O);let H={_tag:\"Span\",get name(){return g.name},get spanId(){return g.spanId},get traceId(){return g.traceId},get parent(){return g.parent},get annotations(){return g.annotations},get status(){return g.status},get attributes(){return g.attributes},get links(){return g.links},get sampled(){return g.sampled},get kind(){return g.kind},end:(D,S)=>{O.open&&!s&&(c(D),f(O)),g.end(D,S)},attribute:(D,S)=>g.attribute(D,S),event:(D,S,A)=>g.event(D,S,A),addLinks:D=>g.addLinks(D)};return o.set(H,O),H}});return{observe:y=>m.gen(function*(){let u=yield*De.Tracer;return yield*y.pipe(m.provideService(De.Tracer,h(u)))}),read:y=>(s||c(y),s=!0,r)}};var Fl=Symbol.for(\"@executor-js/utils/RecordedMessage\"),Dl=e=>{if(oe.hasProperty(e,Fl)){let t=e[Fl];return typeof t==\"string\"?t:void 0}return eS(e)??nS(e)};var Qx={[-32700]:\"Parse error\",[-32600]:\"Invalid request\",[-32601]:\"Method not found\",[-32602]:\"Invalid params\",[-32603]:\"Internal error\",[-32002]:\"Resource not found\"},eS=e=>{if(!oe.isTagged(e,\"ProtocolError\")||!oe.hasProperty(e,\"code\")||typeof e.code!=\"number\"||!oe.hasProperty(e,\"message\")||!oe.isString(e.message))return;let t=e.code,r=/^Tool '.*' not found$/s.test(e.message)?\": the requested tool does not exist\":e.message.startsWith(\"Invalid parameters for tool '\")?\": the tool's arguments failed validation\":\"\",n=Qx[t];return(n===void 0?\"JSON-RPC error with an unlisted code\":`${n} (${t})`)+r},tS=new Set([\"ConnectionError\",\"AuthenticationError\",\"AuthorizationError\",\"SqlSyntaxError\",\"UniqueViolation\",\"ConstraintError\",\"DeadlockError\",\"SerializationError\",\"LockTimeoutError\",\"StatementTimeoutError\",\"UnknownError\"]),rS=new Set([\"A pipelined query completed out of order\",\"Connection closed\",\"Connection closed during startup\",\"Connection is closed\",\"Connection timed out\",\"Failed to connect\",\"Failed to decode row\",\"Failed to encode query\",\"Failed to negotiate TLS\",\"Failed to parse SSLRequest error response\",\"Failed to parse server messages\",\"Failed to parse server response\",\"Failed to write query\",\"Failed to write query batch\",\"Invalid SSLRequest response\",\"MD5 authentication failed\",\"No password configured\",\"Protocol desync\",\"Query cancellation timed out\",\"Query failed\",\"SCRAM authentication failed\",\"SCRAM exchange did not complete\",\"SCRAM server verification failed\",\"Server refused TLS\",\"Socket error\",\"Stream cancellation timed out\",\"The server reported an error\",\"Unsupported authentication method\"].map(e=>`PgConnection: ${e}`)),nS=e=>{if(!oe.isTagged(e,\"SqlError\")||!oe.hasProperty(e,\"reason\"))return;let t=e.reason,r=oe.hasProperty(t,\"_tag\")&&oe.isString(t._tag)&&tS.has(t._tag)?t._tag:\"an unlisted kind\",n=oe.hasProperty(t,\"message\")&&oe.isString(t.message)&&rS.has(t.message)?`: ${t.message}`:\"\";return`The database failed (${r})${n}`};var Bl=m.gen(function*(){let e=J.make(De.Tracer,yield*De.Tracer).pipe(J.add(pr.CurrentLoggers,yield*pr.CurrentLoggers),J.add(Re.MetricRegistry,yield*Re.MetricRegistry)),t=yield*m.currentSpan.pipe(m.option);return ee.isSome(t)&&(e=J.add(e,De.ParentSpan,t.value)),{context:e}}),oS=m.currentSpan.pipe(m.map(Fo.toHeaders),m.orElseSucceed(()=>({})));var sS=e=>m.gen(function*(){let{context:t}=yield*Bl;return(r,n)=>m.runPromiseWith(t)(m.gen(function*(){let o=yield*m.try(()=>new Request(r,n)),s=yield*(yield*je.HttpClient).execute(Kt.fromWeb(o)).pipe(m.withSpan(\"provider.http.request\",jo(\"upstream\",{attributes:{\"http.request.method\":o.method}})),m.provideService(xr.RequestInit,{cache:o.cache,credentials:o.credentials,integrity:o.integrity,keepalive:o.keepalive,mode:o.mode,redirect:o.redirect,referrer:o.referrer,referrerPolicy:o.referrerPolicy}),m.provideService(xr.Fetch,(p,f)=>globalThis.fetch(p,{...f,signal:AbortSignal.any([e,o.signal,...f?.signal?[f.signal]:[]])}))),i=Sr.fromClientResponse(s),c=i.body,d=c instanceof Ut.Stream?Sr.setBody(i,Ut.stream(c.stream.pipe(ct.withSpan(\"provider.http.response.read\",jo(\"upstream\",{attributes:{\"http.response.status_code\":s.status}}))),c.contentType,c.contentLength)):i;return Sr.toWeb(d,{withoutBody:o.method===\"HEAD\",context:t})}).pipe(m.provide(xr.layer)),{signal:e})});var Ll=l.Struct({traceId:l.String.check(l.isPattern(/^(?!0{32}$)[a-f0-9]{32}$/u)),spanId:l.String.check(l.isPattern(/^(?!0{16}$)[a-f0-9]{16}$/u)),sampled:l.Boolean}),aS=m.currentSpan.pipe(m.option,m.map(ee.map(e=>({traceId:e.traceId,spanId:e.spanId,sampled:e.sampled}))),m.map(ee.getOrUndefined)),Nl=e=>l.decodeUnknownOption(Ll)(e).pipe(ee.map(t=>De.externalSpan(t))),iS=(e,t)=>{let r=Nl(e);return ee.isSome(r)?[{span:r.value,attributes:{\"executor.link.kind\":t}}]:[]};var cS=(e,t)=>m.gen(function*(){let r=yield*m.makeSpan(e,t),n=yield*ro.Clock,o=!0,a=(s,i)=>m.sync(()=>{o&&(o=!1,r.attribute(\"executor.milestone.reached\",i),r.end(n.currentTimeNanosUnsafe(),s))});return yield*m.addFinalizer(s=>a(s,!1)),{span:r,finish:s=>a(s,Ht.isSuccess(s))}});var jl=\"5 seconds\",dS=l.String.check(l.makeFilter(e=>{let t=URL.parse(e);return t!==null&&[\"http:\",\"https:\"].includes(t.protocol)&&t.username===\"\"&&t.password===\"\"},{message:\"Expected an HTTP telemetry endpoint without URL credentials\"})),bc=l.Struct({url:dS,headers:l.optional(l.RedactedFromValue(l.Record(l.String,l.String)))}),H0=l.Struct({service:l.NonEmptyString,version:l.NonEmptyString,environment:l.NonEmptyString,clock:l.optional(l.Literals([\"system\",\"cloudflare-io\"])),traces:l.optional(bc),logs:l.optional(bc),metrics:l.optional(bc),metricsProtocol:l.optional(l.Literals([\"http/json\",\"http/protobuf\"]))}),ql=J.Reference(\"executor/TelemetryConfig\",{defaultValue:()=>{}});function zl(){let e=0,t=0;for(let n=0;n<28;n+=7){let o=this.buf[this.pos++];if(e|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(r&15)<<28,t=(r&112)>>4,(r&128)==0)return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let o=this.buf[this.pos++];if(t|=(o&127)<<n,(o&128)==0)return this.assertBounds(),[e,t]}throw new Error(\"invalid varint\")}var ma=4294967296;function wc(e){let t=e[0]===\"-\";t&&(e=e.slice(1));let r=1e6,n=0,o=0;function a(s,i){let c=Number(e.slice(s,i));o*=r,n=n*r+c,n>=ma&&(o=o+(n/ma|0),n=n%ma)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?Wl(n,o):Rc(n,o)}function Jl(e,t){let r=Rc(e,t),n=r.hi&2147483648;n&&(r=Wl(r.lo,r.hi));let o=Tc(r.lo,r.hi);return n?\"-\"+o:o}function Tc(e,t){if({lo:e,hi:t}=fS(e,t),t<=2097151)return String(ma*t+e);let r=e&16777215,n=(e>>>24|t<<8)&16777215,o=t>>16&65535,a=r+n*6777216+o*6710656,s=n+o*8147497,i=o*2,c=1e7;return a>=c&&(s+=Math.floor(a/c),a%=c),s>=c&&(i+=Math.floor(s/c),s%=c),i.toString()+Vl(s)+Vl(a)}function fS(e,t){return{lo:e>>>0,hi:t>>>0}}function Rc(e,t){return{lo:e|0,hi:t|0}}function Wl(e,t){return t=~t,e?e=~e+1:t+=1,Rc(e,t)}var Vl=e=>{let t=String(e);return\"0000000\".slice(t.length)+t};function Gl(){let e=this.buf[this.pos++],t=e&127;if((e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,(e&128)==0)return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,(e&128)==0)return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let r=5;(e&128)!==0&&r<10;r++)e=this.buf[this.pos++];if((e&128)!=0)throw new Error(\"invalid varint\");return this.assertBounds(),t>>>0}var Bn=uS();function uS(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==\"function\"&&typeof e.getBigInt64==\"function\"&&typeof e.getBigUint64==\"function\"&&typeof e.setBigInt64==\"function\"&&typeof e.setBigUint64==\"function\"&&(!!globalThis.Deno||typeof process!=\"object\"||typeof process.env!=\"object\"||process.env.BUF_BIGINT_DISABLE!==\"1\")){let r=BigInt(\"-9223372036854775808\"),n=BigInt(\"9223372036854775807\"),o=BigInt(\"0\"),a=BigInt(\"18446744073709551615\");return{zero:BigInt(0),supported:!0,parse(s){let i=typeof s==\"bigint\"?s:BigInt(s);if(i>n||i<r)throw new Error(`invalid int64: ${s}`);return i},uParse(s){let i=typeof s==\"bigint\"?s:BigInt(s);if(i>a||i<o)throw new Error(`invalid uint64: ${s}`);return i},enc(s){return e.setBigInt64(0,this.parse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(s){return e.setBigInt64(0,this.uParse(s),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(s,i){return e.setInt32(0,s,!0),e.setInt32(4,i,!0),e.getBigInt64(0,!0)},uDec(s,i){return e.setInt32(0,s,!0),e.setInt32(4,i,!0),e.getBigUint64(0,!0)}}}return{zero:\"0\",supported:!1,parse(r){return typeof r!=\"string\"&&(r=r.toString()),Kl(r),r},uParse(r){return typeof r!=\"string\"&&(r=r.toString()),Yl(r),r},enc(r){return typeof r!=\"string\"&&(r=r.toString()),Kl(r),wc(r)},uEnc(r){return typeof r!=\"string\"&&(r=r.toString()),Yl(r),wc(r)},dec(r,n){return Jl(r,n)},uDec(r,n){return Tc(r,n)}}}function Kl(e){if(!/^-?[0-9]+$/.test(e))throw new Error(\"invalid int64: \"+e)}function Yl(e){if(!/^[0-9]+$/.test(e))throw new Error(\"invalid uint64: \"+e)}var Cc=Symbol.for(\"@bufbuild/protobuf/text-encoding\");function Xl(){if(globalThis[Cc]==null){let e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[Cc]={encodeUtf8(r){return e.encode(r)},decodeUtf8(r){return t.decode(r)},checkUtf8(r){try{return encodeURIComponent(r),!0}catch{return!1}}}}return globalThis[Cc]}var pt;(function(e){e[e.Varint=0]=\"Varint\",e[e.Bit64=1]=\"Bit64\",e[e.LengthDelimited=2]=\"LengthDelimited\",e[e.StartGroup=3]=\"StartGroup\",e[e.EndGroup=4]=\"EndGroup\",e[e.Bit32=5]=\"Bit32\"})(pt||(pt={}));var Vo=class{constructor(t,r=Xl().decodeUtf8){this.decodeUtf8=r,this.varint64=zl,this.uint32=Gl,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),r=t>>>3,n=t&7;if(r<=0||n<0||n>5)throw new Error(\"illegal tag: field no \"+r+\" wire type \"+n);return[r,n]}skip(t,r){let n=this.pos;switch(t){case pt.Varint:for(;this.buf[this.pos++]&128;);break;case pt.Bit64:this.pos+=4;case pt.Bit32:this.pos+=4;break;case pt.LengthDelimited:let o=this.uint32();this.pos+=o;break;case pt.StartGroup:for(;;){let[a,s]=this.tag();if(s===pt.EndGroup){if(r!==void 0&&a!==r)throw new Error(\"invalid end group tag\");break}this.skip(s,a)}break;default:throw new Error(\"cant skip wire type \"+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError(\"premature EOF\")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Bn.dec(...this.varint64())}uint64(){return Bn.uDec(...this.varint64())}sint64(){let[t,r]=this.varint64(),n=-(t&1);return t=(t>>>1|(r&1)<<31)^n,r=r>>>1^n,Bn.dec(t,r)}bool(){let[t,r]=this.varint64();return t!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Bn.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Bn.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),r=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(r,r+t)}string(){return this.decodeUtf8(this.bytes())}};var kc=[1,5,10,25,50,100,250,500,1e3,2500,5e3,1e4,3e4],V0=Re.histogram(\"executor.http.response_ready_ms\",{boundaries:kc,attributes:{unit:\"ms\"},description:\"Handler entry to response headers in milliseconds; excludes streamed body lifetime.\"}),z0=Re.counter(\"executor.http.requests\",{incremental:!0}),pS=Re.counter(\"executor.telemetry.export_failures\",{incremental:!0}),lS=Re.counter(\"executor.telemetry.rejected_records\",{incremental:!0}),J0=Re.histogram(\"executor.worker.cpu_ms\",{boundaries:kc,attributes:{unit:\"ms\"},description:\"Native Worker CPU time in milliseconds.\"}),W0=Re.histogram(\"executor.worker.wall_ms\",{boundaries:kc,attributes:{unit:\"ms\"},description:\"Native Worker invocation wall time, including stream and cleanup lifetime, in milliseconds.\"});var ha=(e,t,r=0)=>{let n=e.endsWith(\"/traces\")?\"traces\":e.endsWith(\"/logs\")?\"logs\":e.endsWith(\"/metrics\")?\"metrics\":e===\"app\"?\"app\":\"other\";return Re.update(Re.withAttributes(pS,{signal:n,reason:t}),1).pipe(m.andThen(Re.update(Re.withAttributes(lS,{signal:n,reason:t}),r)),m.andThen(m.logWarning(\"Telemetry export failed\").pipe(m.annotateLogs({\"executor.telemetry.signal\":n,\"executor.telemetry.failure\":t,\"executor.telemetry.rejected_records\":r}))))};var mS=J.Reference(\"executor/TelemetryClient\",{defaultValue:()=>{}}),hS=z.unwrap(mS.pipe(m.map(e=>e===void 0?z.fresh(xr.layer):z.succeed(je.HttpClient,e)))),Oc=l.Union([l.Number,l.NumberFromString]).check(l.isInt(),l.isGreaterThanOrEqualTo(0),l.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER)),yS=l.Struct({partialSuccess:l.optional(l.Struct({rejectedSpans:l.optional(Oc),rejectedLogRecords:l.optional(Oc),rejectedDataPoints:l.optional(Oc),errorMessage:l.optional(l.String)}))}),gS=e=>{let t=new Vo(e),r=\"0\",n=\"\";for(;t.pos<t.len;){let[o,a]=t.tag();if(o!==1||a!==pt.LengthDelimited){t.skip(a,o);continue}let s=new Vo(t.bytes());for(;s.pos<s.len;){let[i,c]=s.tag();i===1&&c===pt.Varint?r=String(s.int64()):i===2&&c===pt.LengthDelimited?n=s.string():s.skip(c,i)}}return{partialSuccess:{rejectedDataPoints:r,errorMessage:n}}},xS=e=>m.gen(function*(){let t=new Uint8Array(yield*e.arrayBuffer),r=yield*m.try({try:()=>t.byteLength===0?{}:e.headers[\"content-type\"]?.includes(\"application/x-protobuf\")?gS(t):JSON.parse(new TextDecoder().decode(t)),catch:()=>new ge.HttpClientError({reason:new ge.DecodeError({request:e.request,response:e,description:\"Invalid OTLP acknowledgement\"})})}),o=(yield*l.decodeUnknownEffect(yS)(r).pipe(m.mapError(()=>new ge.HttpClientError({reason:new ge.DecodeError({request:e.request,response:e,description:\"Invalid OTLP acknowledgement\"})})))).partialSuccess;if(o===void 0)return;let a=(o.rejectedSpans??0)+(o.rejectedLogRecords??0)+(o.rejectedDataPoints??0);(a>0||o.errorMessage)&&(yield*ha(new URL(e.request.url).pathname,\"partial-success\",a))}),Zl=z.effect(je.HttpClient,je.HttpClient.pipe(m.map(e=>e.pipe(je.filterStatusOk,je.transform((t,r)=>t.pipe(m.tap(xS),m.timeout(jl),m.catchTag(\"TimeoutError\",()=>m.fail(new ge.HttpClientError({reason:new ge.TransportError({request:r,description:\"Telemetry collector acknowledgement timed out\"})}))),m.tapError(n=>ha(new URL(r.url).pathname,ge.isHttpClientError(n)&&n.reason instanceof ge.DecodeError?\"acknowledgement\":\"transport\").pipe(m.annotateLogs({\"executor.telemetry.http_status\":n.response?.status??0,\"executor.telemetry.timed_out\":n.reason instanceof ge.TransportError&&n.reason.description===\"Telemetry collector acknowledgement timed out\"}))),m.onInterrupt(()=>ha(new URL(r.url).pathname,\"interrupted\")))),je.withScope,je.transformResponse(m.scoped))))).pipe(z.provide(hS));var SS=e=>oe.hasProperty(e,\"_tag\")&&oe.isString(e._tag)?e._tag:void 0,Ql=(e,t)=>{let r=new Error(t);return r.name=e,r.stack=t===\"\"?e:`${e}: ${t}`,r},Ac=e=>{let t=SS(e);if(t!==void 0)return Ql(t,Dl(e)??\"\");if(!(e instanceof Error))return Ql(\"UnrecognizedFailure\",\"\");if(e.cause===void 0)return e;let r=new Error(e.message,{cause:Ac(e.cause)});return r.name=e.name,e.stack!==void 0&&(r.stack=e.stack),r},em=e=>Be.fromReasons(e.reasons.flatMap(t=>{if(Be.isInterruptReason(t))return[t];let r=Be.isFailReason(t)?Be.fail(Ac(t.error)):Be.die(Ac(t.defect));return Be.annotate(r,Be.reasonAnnotations(t)).reasons}));var Pc=class extends l.TaggedError()(\"LogicalOperationFailed\",{}){},ES=[\"http.\",\"url.\",\"server.\",\"client.\",\"user_agent.\"],bS=new Set([\"http.request.method\",\"http.response.status_code\",\"server.address\",\"url.scheme\",\"url.path\",\"http.route\",\"http.request.header.content-type\",\"http.request.header.content-length\",\"http.request.header.user-agent\",\"http.response.header.content-type\",\"http.response.header.content-length\",\"user_agent.original\"]),tm=e=>{let t=e.toLowerCase();return!ES.some(r=>t.startsWith(r))||bS.has(t)},wS=e=>Object.fromEntries(Object.entries(e).filter(([t])=>tm(t)));var TS=e=>{let t=!1,r;return{_tag:\"Span\",get name(){return e.name},get spanId(){return e.spanId},get traceId(){return e.traceId},get parent(){return e.parent},get annotations(){return e.annotations},get status(){return e.status},get attributes(){return e.attributes},get links(){return e.links},get sampled(){return e.sampled},get kind(){return e.kind},end:(n,o)=>e.end(n,Ht.isSuccess(o)?e.attributes.get(\"executor.outcome\")===\"failed\"?Ht.fail(new Pc):o:Ht.failCause(em(o.cause))),attribute:(n,o)=>{if(tm(n)){if(n===\"url.path\"&&typeof o==\"string\"){t=!0,e.attribute(n,r??o);return}n===\"http.route\"&&typeof o==\"string\"&&(r=o,t&&e.attribute(\"url.path\",o)),e.attribute(n,o)}},event:(n,o,a)=>e.event(n,o,a===void 0?void 0:wS(a)),addLinks:n=>e.addLinks(n)}},vc=(e,t=!1)=>z.effect(De.Tracer)(De.Tracer.pipe(m.map(r=>({...r,span:n=>{let o=TS(r.span(t?{...n,sampled:!0}:n));t&&ee.isSome(n.parent)&&n.parent.value._tag===\"ExternalSpan\"&&o.attribute(\"executor.trace.parent_sampled\",n.parent.value.sampled),e!==void 0&&o.attribute(\"executor.clock.type\",e);let a=Ec(n.annotations);return a!==void 0&&o.attribute(Sc,a),o}})))),iT=vc();var Sa={};Te(Sa,{layer:()=>cm,layerFromConfig:()=>tE,make:()=>im});var RS=e=>ku(He,e).pipe(Vr(t=>t.map(r=>r.toLowerCase().trim()).filter(r=>r!==\"\"))),rm=e=>Bs(He,go,e),Ln=e=>rm(`OTEL_EXPORTER_OTLP_${e}_HEADERS`).pipe(gi(()=>rm(\"OTEL_EXPORTER_OTLP_HEADERS\")),dt(void 0)),Nn=e=>Si(`OTEL_EXPORTER_OTLP_${e}_ENDPOINT`).pipe(gi(()=>Si(\"OTEL_EXPORTER_OTLP_ENDPOINT\").pipe(Vr(t=>{let r=t.pathname.endsWith(\"/\")?\"\":\"/\";return t.pathname+=`${r}v1/${e.toLowerCase()}`,t}))),dt(void 0)),jn=e=>RS(`OTEL_${e}_EXPORTER`).pipe(dt([]));var Jo={};Te(Jo,{Flusher:()=>zo,layerFlusher:()=>Dt,make:()=>Zr});var CS=e=>{let t=bd(e).pipe(wd(Zd));if(Xe(t))return v(he(t.value));if(e===void 0)return v(he(5));let r=Date.parse(e);return Number.isNaN(r)?v(he(5)):_(qt,n=>ie(Math.max(r-n.currentTimeMillisUnsafe(),1)))},kS=rf.pipe(gs,tf(({output:e})=>hr(e)&&e.reason._tag===\"StatusCodeError\"&&e.reason.response.status===429?CS(e.reason.response.headers[\"retry-after\"]):v(he(1)))),zo=class extends se()(\"effect/observability/OtlpExporter/Flusher\"){},Dt=Yd(zo,()=>{let e=new Set;return{flush:ve(()=>e.size===0?de:xs(e,ot,{concurrency:\"unbounded\",discard:!0})),register:t=>k(eo,r=>(e.add(t),Ya(r,Le(()=>e.delete(t)))))}}),Zr=Ve(function*(e){let t=yield*Et(),r=ar(t,qt),n=ar(t,eo),o=Or(ps(e.exportInterval),Ad),a,s=ar(t,Gr).pipe(Zi(u=>bs(u.arrayBuffer)),Qi(u=>u.response?bs(u.response.arrayBuffer):de),Gi,Ne(ei(ia,!1)),Xi({schedule:kS,times:3})),i=Mr({\"user-agent\":`effect-opentelemetry-${e.label}/0.0.0`});e.headers&&(i=$r(fe(e.headers),i));let c=Li(e.url,{headers:i}),d=[],p=ve(()=>{if(a!==void 0&&r.currentTimeMillisUnsafe()<a)return de;if(a!==void 0&&(a=void 0),d.length===0&&(e.maxBatchSize!==\"disabled\"||e.exportEmpty!==!0))return de;let u=d;d=[];let[g,x]=e.body(u);return s.execute(Se(c,g)).pipe(ln(x),sf,bf(!1))}).pipe(hn(u=>a!==void 0?de:(a=r.currentTimeMillisUnsafe()+6e4,d=[],Cf(\"Disabling exporter for 60 seconds\",u))),ri({package:\"@effect/opentelemetry\",module:e.label})),f=yield*Ou(),h=yield*Pu(f)();return yield*(yield*zo).register(p),yield*Ya(n,ve(()=>a!==void 0?de:(h(p),vu(f))).pipe(bs,gf,ff(e.shutdownTimeout))),yield*yn(o).pipe(ln(Au(f,p)),k(ou),Sf,Rf(n)),{push(u){a===void 0&&(d.push(u),e.maxBatchSize!==\"disabled\"&&d.length>=e.maxBatchSize&&h(p))}}});var OS=e=>{let t=e.attributes?er(Object.entries(e.attributes)):[];return t.push({key:\"service.name\",value:{stringValue:e.serviceName}}),e.serviceVersion&&t.push({key:\"service.version\",value:{stringValue:e.serviceVersion}}),{attributes:t,droppedAttributesCount:0}},qn=Ve(function*(e){let t=yield*Bs(go,go,\"OTEL_RESOURCE_ATTRIBUTES\").pipe(dt(void 0)),r=e?.serviceName??e?.attributes?.[\"service.name\"]??(yield*xi(ho(He),\"OTEL_SERVICE_NAME\"))??t?.[\"service.name\"]??(yield*Ru(\"OTEL_SERVICE_NAME\")),n=e?.serviceVersion??e?.attributes?.[\"service.version\"]??(yield*xi(ho(He),\"OTEL_SERVICE_VERSION\"))??t?.[\"service.version\"],o={...t,...e?.attributes};return delete o[\"service.name\"],delete o[\"service.version\"],OS({serviceName:r,serviceVersion:n,attributes:o})},dr),Vn=e=>{let t=e.attributes.find(r=>r.key===\"service.name\");if(!t||!t.value.stringValue)throw new Error(\"Resource does not contain a service name\");return t.value.stringValue},er=e=>{let t=[];for(let[r,n]of e)t.push({key:r,value:ya(n)});return t},ya=e=>{if(Array.isArray(e))return{arrayValue:{values:e.map(ya)}};switch(typeof e){case\"string\":return{stringValue:e};case\"bigint\":return{intValue:String(e)};case\"number\":return Number.isInteger(e)?{intValue:e}:{doubleValue:e};case\"boolean\":return{boolValue:e};default:return{stringValue:is(e)}}};var tn={};Te(tn,{OtlpSerialization:()=>Pt,layerJson:()=>QS,layerProtobuf:()=>eE});var Wo={Varint:0,Fixed64:1,LengthDelimited:2,Fixed32:5},Go=(e,t)=>e<<3|t,Qr=e=>{let t=[],r=typeof e==\"bigint\"?e:BigInt(e);for(r<BigInt(0)&&(r=BigInt.asUintN(64,r));r>BigInt(127);)t.push(Number(r&BigInt(127))|128),r>>=BigInt(7);return t.push(Number(r)),new Uint8Array(t)},AS=e=>{let t=new Uint8Array(8);return new DataView(t.buffer).setBigUint64(0,e,!0),t},PS=e=>{let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),t},vS=e=>{let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),t},HS=e=>new TextEncoder().encode(e),IS=e=>{let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=parseInt(e.slice(r,r+2),16);return t},W=(...e)=>{let t=e.reduce((o,a)=>o+a.length,0),r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r},be=(e,t)=>W(Qr(Go(e,Wo.Varint)),Qr(t)),Ic=(e,t)=>be(e,t?1:0),tt=(e,t)=>W(Qr(Go(e,Wo.Fixed64)),AS(t)),xa=(e,t)=>W(Qr(Go(e,Wo.Fixed32)),PS(t)),en=(e,t)=>W(Qr(Go(e,Wo.Fixed64)),vS(t)),Ko=(e,t)=>W(Qr(Go(e,Wo.LengthDelimited)),Qr(t.length),t),Er=(e,t)=>Ko(e,HS(t)),br=(e,t)=>Ko(e,IS(t)),Me=(e,t)=>Ko(e,t),te=(e,t,r)=>W(...t.map(n=>Me(e,r(n)))),Ye=(e,t)=>t!==void 0&&t!==\"\"?Er(e,t):new Uint8Array(0);var Uc=e=>e.stringValue!==void 0&&e.stringValue!==null?Er(1,e.stringValue):e.boolValue!==void 0&&e.boolValue!==null?Ic(2,e.boolValue):e.intValue!==void 0&&e.intValue!==null?be(3,BigInt(e.intValue)):e.doubleValue!==void 0&&e.doubleValue!==null?en(4,e.doubleValue):e.arrayValue!==void 0?Me(5,MS(e.arrayValue)):e.kvlistValue!==void 0?Me(6,_S(e.kvlistValue)):e.bytesValue!==void 0?Ko(7,e.bytesValue):new Uint8Array(0),MS=e=>te(1,e.values,Uc),_S=e=>te(1,e.values,tr),tr=e=>W(Er(1,e.key),Me(2,Uc(e.value))),Mc=e=>W(Er(1,e.name),Ye(2,e.version),e.attributes?te(3,e.attributes,tr):new Uint8Array(0),e.droppedAttributesCount?be(4,e.droppedAttributesCount):new Uint8Array(0)),_c=e=>W(te(1,e.attributes,tr),e.droppedAttributesCount>0?be(2,e.droppedAttributesCount):new Uint8Array(0)),$S=e=>W(Ye(2,e.message),be(3,e.code)),FS=e=>W(tt(1,BigInt(e.timeUnixNano)),Er(2,e.name),te(3,e.attributes,tr),e.droppedAttributesCount>0?be(4,e.droppedAttributesCount):new Uint8Array(0)),DS=e=>W(br(1,e.traceId),br(2,e.spanId),Ye(3,e.traceState),te(4,e.attributes,tr),e.droppedAttributesCount>0?be(5,e.droppedAttributesCount):new Uint8Array(0),e.flags!==void 0?xa(6,e.flags):new Uint8Array(0)),BS=e=>W(br(1,e.traceId),br(2,e.spanId),Ye(3,e.traceState),e.parentSpanId!==void 0?br(4,e.parentSpanId):new Uint8Array(0),Er(5,e.name),be(6,e.kind),tt(7,BigInt(e.startTimeUnixNano)),tt(8,BigInt(e.endTimeUnixNano)),te(9,e.attributes,tr),e.droppedAttributesCount>0?be(10,e.droppedAttributesCount):new Uint8Array(0),te(11,e.events,FS),e.droppedEventsCount>0?be(12,e.droppedEventsCount):new Uint8Array(0),te(13,e.links,DS),e.droppedLinksCount>0?be(14,e.droppedLinksCount):new Uint8Array(0),Me(15,$S(e.status)),e.flags!==void 0?xa(16,e.flags):new Uint8Array(0)),LS=e=>W(Me(1,Mc(e.scope)),te(2,e.spans,BS),Ye(3,e.schemaUrl)),NS=e=>W(Me(1,_c(e.resource)),te(2,e.scopeSpans,LS),Ye(3,e.schemaUrl)),nm=e=>te(1,e.resourceSpans,NS),om=e=>W(tt(2,BigInt(e.startTimeUnixNano)),tt(3,BigInt(e.timeUnixNano)),e.asDouble!==void 0?en(4,e.asDouble):new Uint8Array(0),e.asInt!==void 0?tt(6,BigInt(e.asInt)):new Uint8Array(0),te(7,e.attributes,tr),e.flags!==void 0?be(8,e.flags):new Uint8Array(0)),jS=e=>{let t=W(...e.bucketCounts.map(n=>tt(6,BigInt(n)))),r=W(...e.explicitBounds.map(n=>en(7,n)));return W(tt(2,BigInt(e.startTimeUnixNano)),tt(3,BigInt(e.timeUnixNano)),tt(4,BigInt(e.count)),e.sum!==void 0?en(5,e.sum):new Uint8Array(0),t,r,te(9,e.attributes,tr),e.flags!==void 0?be(10,e.flags):new Uint8Array(0),e.min!==void 0?en(11,e.min):new Uint8Array(0),e.max!==void 0?en(12,e.max):new Uint8Array(0))},qS=e=>te(1,e.dataPoints,om),VS=e=>W(te(1,e.dataPoints,om),be(2,e.aggregationTemporality),Ic(3,e.isMonotonic)),zS=e=>W(te(1,e.dataPoints,jS),be(2,e.aggregationTemporality)),JS=e=>W(Er(1,e.name),Ye(2,e.description),Ye(3,e.unit),e.gauge!==void 0?Me(5,qS(e.gauge)):new Uint8Array(0),e.sum!==void 0?Me(7,VS(e.sum)):new Uint8Array(0),e.histogram!==void 0?Me(9,zS(e.histogram)):new Uint8Array(0)),WS=e=>W(Me(1,Mc(e.scope)),te(2,e.metrics,JS),Ye(3,e.schemaUrl)),GS=e=>W(Me(1,_c(e.resource)),te(2,e.scopeMetrics,WS),Ye(3,e.schemaUrl)),sm=e=>te(1,e.resourceMetrics,GS),KS=e=>W(tt(1,BigInt(e.timeUnixNano)),e.severityNumber!==void 0?be(2,e.severityNumber):new Uint8Array(0),Ye(3,e.severityText),e.body!==void 0?Me(5,Uc(e.body)):new Uint8Array(0),te(6,e.attributes,tr),e.droppedAttributesCount!==void 0&&e.droppedAttributesCount>0?be(7,e.droppedAttributesCount):new Uint8Array(0),e.flags!==void 0?xa(8,e.flags):new Uint8Array(0),e.traceId!==void 0&&e.traceId!==\"\"?br(9,e.traceId):new Uint8Array(0),e.spanId!==void 0&&e.spanId!==\"\"?br(10,e.spanId):new Uint8Array(0),e.observedTimeUnixNano!==void 0?tt(11,BigInt(e.observedTimeUnixNano)):new Uint8Array(0)),YS=e=>W(Me(1,Mc(e.scope)),te(2,e.logRecords,KS),Ye(3,e.schemaUrl)),XS=e=>W(Me(1,_c(e.resource)),te(2,e.scopeLogs,YS),Ye(3,e.schemaUrl)),am=e=>te(1,e.resourceLogs,XS);var Pt=class extends se()(\"effect/observability/OtlpSerialization\"){},QS=hs(Pt,{traces:e=>Wt(e),metrics:e=>Wt(e),logs:e=>Wt(e)}),eE=hs(Pt,{traces:e=>Rt(nm(e),\"application/x-protobuf\"),metrics:e=>Rt(sm(e),\"application/x-protobuf\"),logs:e=>Rt(am(e),\"application/x-protobuf\")});var im=Ve(function*(e){let t=yield*Pt,r=yield*qn(e.resource),n={name:Vn(r)},o=yield*Zr({label:\"OtlpLogger\",url:e.url,headers:e.headers,maxBatchSize:e.maxBatchSize??1e3,exportInterval:e.exportInterval??he(1),body:s=>[t.logs({resourceLogs:[{resource:r,scopeLogs:[{scope:n,logRecords:s}]}]}),de],shutdownTimeout:e.shutdownTimeout??he(3)}),a={excludeLogSpans:e.excludeLogSpans??!1,clock:yield*qt};return Hu(s=>{o.push(rE(s,a))})}),cm=e=>Iu([im(e)],{mergeWithExisting:e.mergeWithExisting??!0}).pipe(cr(Dt)),tE=e=>Ze(function*(){let{disabled:t,endpoint:r,exporters:n}=yield*zt({disabled:wn(\"OTEL_SDK_DISABLED\").pipe(dt(!1)),endpoint:Nn(\"LOGS\"),exporters:jn(\"LOGS\")});if(t||!r||!n.includes(\"otlp\"))return Dt;let{baseTimeout:o,logsTimeout:a,exportTimeout:s,scheduleDelay:i,maxBatchSize:c}=yield*zt({baseTimeout:ye(ke(\"OTEL_EXPORTER_OTLP_TIMEOUT\")),logsTimeout:ye(ke(\"OTEL_EXPORTER_OTLP_LOGS_TIMEOUT\")),exportTimeout:ye(ke(\"OTEL_BLRP_EXPORT_TIMEOUT\")),scheduleDelay:ye(ke(\"OTEL_BLRP_SCHEDULE_DELAY\")),maxBatchSize:ye(ke(\"OTEL_BLRP_MAX_EXPORT_BATCH_SIZE\"))}),d=un([a,o,s]).pipe(kr(f=>ie(f))),p=kr(i,f=>ie(f));return cm({url:r.toString(),resource:e?.resource,headers:e?.headers??(yield*Ln(\"LOGS\")),exportInterval:le(p),maxBatchSize:le(c),shutdownTimeout:le(d),excludeLogSpans:e?.excludeLogSpans,mergeWithExisting:e?.mergeWithExisting})}).pipe(dr,Ar),rE=(e,t)=>{let n=t.clock.currentTimeNanosUnsafe().toString(),o=e.date.getTime(),a=er(Object.entries(e.fiber.getRef(zd)));if(a.push({key:\"fiberId\",value:{intValue:e.fiber.id}}),!t.excludeLogSpans)for(let[c,d]of e.fiber.getRef(Jd))a.push({key:`logSpan.${c}`,value:{stringValue:`${o-d}ms`}});e.cause.reasons.length>0&&a.push({key:\"log.error\",value:{stringValue:Bd(e.cause)}});let s=Qn(e.message),i={severityNumber:nE(e.logLevel),severityText:e.logLevel,timeUnixNano:n,observedTimeUnixNano:n,attributes:a,body:ya(s.length===1?s[0]:s),droppedAttributesCount:0};return e.fiber.cache.span&&(i.traceId=e.fiber.cache.span.traceId,i.spanId=e.fiber.cache.span.spanId),i},nE=e=>{switch(e){case\"Trace\":return rn.SEVERITY_NUMBER_TRACE;case\"Debug\":return rn.SEVERITY_NUMBER_DEBUG;case\"Info\":return rn.SEVERITY_NUMBER_INFO;case\"Warn\":return rn.SEVERITY_NUMBER_WARN;case\"Error\":return rn.SEVERITY_NUMBER_ERROR;case\"Fatal\":return rn.SEVERITY_NUMBER_FATAL;default:return rn.SEVERITY_NUMBER_UNSPECIFIED}},rn={SEVERITY_NUMBER_UNSPECIFIED:0,SEVERITY_NUMBER_TRACE:1,SEVERITY_NUMBER_TRACE2:2,SEVERITY_NUMBER_TRACE3:3,SEVERITY_NUMBER_TRACE4:4,SEVERITY_NUMBER_DEBUG:5,SEVERITY_NUMBER_DEBUG2:6,SEVERITY_NUMBER_DEBUG3:7,SEVERITY_NUMBER_DEBUG4:8,SEVERITY_NUMBER_INFO:9,SEVERITY_NUMBER_INFO2:10,SEVERITY_NUMBER_INFO3:11,SEVERITY_NUMBER_INFO4:12,SEVERITY_NUMBER_WARN:13,SEVERITY_NUMBER_WARN2:14,SEVERITY_NUMBER_WARN3:15,SEVERITY_NUMBER_WARN4:16,SEVERITY_NUMBER_ERROR:17,SEVERITY_NUMBER_ERROR2:18,SEVERITY_NUMBER_ERROR3:19,SEVERITY_NUMBER_ERROR4:20,SEVERITY_NUMBER_FATAL:21,SEVERITY_NUMBER_FATAL2:22,SEVERITY_NUMBER_FATAL3:23,SEVERITY_NUMBER_FATAL4:24};var Ea={};Te(Ea,{layer:()=>um,layerFromConfig:()=>oE,make:()=>fm});var fm=Ve(function*(e){let t=yield*qt,r=yield*Pt,n=yield*t.currentTimeNanos,o=String(n),a=e.temporality??\"cumulative\",s=yield*qn(e.resource),i={name:Vn(s)},c=yield*Et(),d=n,p=new Map,f=new Map,h=new Map,y=new Map,u=0,g=-1,x=()=>{let C=nf(c),L=u++,F=t.currentTimeNanosUnsafe(),O=String(F),H=new Map(p),D=new Map(f),S=new Map(h),A=new Map(y),B=[],j=new Map,N=lt=>{B.push(lt),j.set(lt.name,lt)},re=a===\"delta\",me=re?dm.AGGREGATION_TEMPORALITY_DELTA:dm.AGGREGATION_TEMPORALITY_CUMULATIVE,Oe=re?String(d):o;for(let lt=0,Yn=C.length;lt<Yn;lt++){let T=C[lt],Bt=T.attributes?.unit??T.attributes?.time_unit??\"1\",_e=T.attributes?er(Object.entries(T.attributes)):[],mt=sE(T.id,T.attributes);switch(T.type){case\"Counter\":{let G=T.state.count,Z=G;if(re){let pe=p.get(mt);if(pe!==void 0)if(typeof G==\"bigint\"&&typeof pe==\"bigint\")Z=G-pe,T.state.incremental&&Z<BigInt(0)&&(Z=G);else{let $e=Number(G),we=Number(pe);Z=$e-we,T.state.incremental&&Z<0&&(Z=$e)}H.set(mt,G)}let Y={attributes:_e,startTimeUnixNano:Oe,timeUnixNano:O};typeof Z==\"bigint\"?Y.asInt=Number(Z):Y.asDouble=Z,j.has(T.id)?j.get(T.id).sum.dataPoints.push(Y):N({name:T.id,description:T.description,unit:Bt,sum:{aggregationTemporality:me,isMonotonic:T.state.incremental,dataPoints:[Y]}});break}case\"Gauge\":{let G={attributes:_e,startTimeUnixNano:o,timeUnixNano:O};typeof T.state.value==\"bigint\"?G.asInt=Number(T.state.value):G.asDouble=T.state.value,j.has(T.id)?j.get(T.id).gauge.dataPoints.push(G):N({name:T.id,description:T.description,unit:Bt,gauge:{dataPoints:[G]}});break}case\"Histogram\":{let G=T.state.buckets.length,Z={boundaries:Va(G-1),counts:Va(G)},Y=0,pe=0;for(let[nt,jt]of T.state.buckets)Y<G-1&&(Z.boundaries[Y]=nt),Z.counts[Y]=jt-pe,pe=jt,Y++;let $e=T.state.count,we=T.state.sum,nr=Z.counts,Lt=T.state.min,Nt=T.state.max;if(re){let nt=f.get(mt);nt!==void 0&&($e=T.state.count-nt.count,we=T.state.sum-nt.sum,nr=Z.counts.map((jt,cn)=>Math.max(0,jt-(nt.bucketCounts[cn]??0)))),D.set(mt,{count:T.state.count,sum:T.state.sum,bucketCounts:Z.counts.slice(),min:T.state.min,max:T.state.max})}let or={attributes:_e,startTimeUnixNano:Oe,timeUnixNano:O,count:$e,min:Lt,max:Nt,sum:we,bucketCounts:nr,explicitBounds:Z.boundaries};j.has(T.id)?j.get(T.id).histogram.dataPoints.push(or):N({name:T.id,description:T.description,unit:Bt,histogram:{aggregationTemporality:me,dataPoints:[or]}});break}case\"Frequency\":{let G=[],Z=new Map;for(let[Y,pe]of T.state.occurrences){Z.set(Y,pe);let $e=pe;if(re){let we=h.get(mt);if(we!==void 0){let nr=we.get(Y)??0;$e=Math.max(0,pe-nr)}}G.push({attributes:[..._e,{key:\"key\",value:{stringValue:Y}}],startTimeUnixNano:Oe,timeUnixNano:O,asInt:$e})}re&&S.set(mt,Z),j.has(T.id)?j.get(T.id).sum.dataPoints.push(...G):N({name:T.id,description:T.description,unit:Bt,sum:{aggregationTemporality:me,isMonotonic:!0,dataPoints:G}});break}case\"Summary\":{let G=[{attributes:[..._e,{key:\"quantile\",value:{stringValue:\"min\"}}],startTimeUnixNano:Oe,timeUnixNano:O,asDouble:T.state.min}];for(let[we,nr]of T.state.quantiles)G.push({attributes:[..._e,{key:\"quantile\",value:{stringValue:we.toString()}}],startTimeUnixNano:Oe,timeUnixNano:O,asDouble:nr??0});G.push({attributes:[..._e,{key:\"quantile\",value:{stringValue:\"max\"}}],startTimeUnixNano:Oe,timeUnixNano:O,asDouble:T.state.max});let Z=T.state.count,Y=T.state.sum;if(re){let we=y.get(mt);we!==void 0&&(Z=T.state.count-we.count,Y=T.state.sum-we.sum),A.set(mt,{count:T.state.count,sum:T.state.sum})}let pe={attributes:_e,startTimeUnixNano:Oe,timeUnixNano:O,asInt:Z},$e={attributes:_e,startTimeUnixNano:Oe,timeUnixNano:O,asDouble:Y};j.has(`${T.id}_quantiles`)?(j.get(`${T.id}_quantiles`).sum.dataPoints.push(...G),j.get(`${T.id}_count`).sum.dataPoints.push(pe),j.get(`${T.id}_sum`).sum.dataPoints.push($e)):(N({name:`${T.id}_quantiles`,description:T.description,unit:Bt,sum:{aggregationTemporality:me,isMonotonic:!1,dataPoints:G}}),N({name:`${T.id}_count`,description:T.description,unit:\"1\",sum:{aggregationTemporality:me,isMonotonic:!0,dataPoints:[pe]}}),N({name:`${T.id}_sum`,description:T.description,unit:\"1\",sum:{aggregationTemporality:me,isMonotonic:!0,dataPoints:[$e]}}));break}}}let Kn=r.metrics({resourceMetrics:[{resource:s,scopeMetrics:[{scope:i,metrics:B}]}]}),ts=re?Le(()=>{L<g||(p=H,f=D,h=S,y=A,d=F,g=L)}):de;return[Kn,ts]};yield*Zr({label:\"OtlpMetrics\",url:e.url,headers:e.headers,maxBatchSize:\"disabled\",exportEmpty:!0,exportInterval:e.exportInterval??he(10),body:x,shutdownTimeout:e.shutdownTimeout??he(3)})}),um=e=>ys(fm(e)).pipe(cr(Dt)),oE=e=>Ze(function*(){let{disabled:t,endpoint:r,exporters:n}=yield*zt({disabled:wn(\"OTEL_SDK_DISABLED\").pipe(dt(!1)),endpoint:Nn(\"METRICS\"),exporters:jn(\"METRICS\")});if(t||!r||!n.includes(\"otlp\"))return Dt;let{baseTimeout:o,metricsTimeout:a,exportTimeout:s,exportInterval:i,temporalityPreference:c}=yield*zt({baseTimeout:ye(ke(\"OTEL_EXPORTER_OTLP_TIMEOUT\")),metricsTimeout:ye(ke(\"OTEL_EXPORTER_OTLP_METRICS_TIMEOUT\")),exportTimeout:ye(ke(\"OTEL_METRIC_EXPORT_TIMEOUT\")),exportInterval:ye(ke(\"OTEL_METRIC_EXPORT_INTERVAL\").pipe(Vr(ie))),temporalityPreference:ye(Cu([\"delta\",\"cumulative\"],\"OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE\"))}),d=un([a,o,s]).pipe(kr(p=>ie(p)));return um({url:r.toString(),resource:e?.resource,headers:e?.headers??(yield*Ln(\"METRICS\")),exportInterval:le(i),shutdownTimeout:le(d),temporality:le(c)})}).pipe(dr,Ar),sE=(e,t)=>{if(t===void 0||Object.keys(t).length===0)return e;let r=Object.entries(t).sort((n,o)=>n[0].localeCompare(o[0]));return`${e}:${JSON.stringify(r)}`},dm={AGGREGATION_TEMPORALITY_UNSPECIFIED:0,AGGREGATION_TEMPORALITY_DELTA:1,AGGREGATION_TEMPORALITY_CUMULATIVE:2};var ba={};Te(ba,{layer:()=>lm,layerFromConfig:()=>aE,make:()=>pm});var pm=Ve(function*(e){let t=yield*qn(e.resource),r=yield*Pt,n={name:Vn(t)},o=yield*Zr({label:\"OtlpTracer\",url:e.url,headers:e.headers,exportInterval:e.exportInterval??he(5),maxBatchSize:e.maxBatchSize??1e3,body(s){let i={resourceSpans:[{resource:t,scopeSpans:[{scope:n,spans:s}]}]};return[r.traces(i),de]},shutdownTimeout:e.shutdownTimeout??he(3)});function a(s){s.sampled&&o.push(iE(s))}return Hd({span(s){return new Fc(s,a)},context:e.context?function(s,i){return i.cache.span===void 0?s[\"~effect/Effect/evaluate\"](i):e.context(s,i.cache.span)}:void 0})}),lm=as(pm,to(Ud),cr(Dt)),aE=e=>Ze(function*(){let{disabled:t,endpoint:r,exporters:n}=yield*zt({disabled:wn(\"OTEL_SDK_DISABLED\").pipe(dt(!1)),endpoint:Nn(\"TRACES\"),exporters:jn(\"TRACES\")});if(t||!r||!n.includes(\"otlp\"))return Dt;let{baseTimeout:o,tracesTimeout:a,exportTimeout:s,scheduleDelay:i,maxBatchSize:c}=yield*zt({baseTimeout:ye(ke(\"OTEL_EXPORTER_OTLP_TIMEOUT\")),tracesTimeout:ye(ke(\"OTEL_EXPORTER_OTLP_TRACES_TIMEOUT\")),exportTimeout:ye(ke(\"OTEL_BSP_EXPORT_TIMEOUT\")),scheduleDelay:ye(ke(\"OTEL_BSP_SCHEDULE_DELAY\").pipe(Vr(ie))),maxBatchSize:ye(ke(\"OTEL_BSP_MAX_EXPORT_BATCH_SIZE\"))}),d=un([a,o,s]).pipe(kr(p=>ie(p)));return lm({url:r.toString(),resource:e?.resource,headers:e?.headers??(yield*Ln(\"TRACES\")),exportInterval:le(i),maxBatchSize:le(c),context:e?.context,shutdownTimeout:le(d)})}).pipe(dr,Ar),Fc=class{_tag=\"Span\";name;parent;annotations;links;kind;sampled;export;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(t,r){this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.kind=t.kind,this.sampled=t.sampled,this.export=r,this.status={_tag:\"Started\",startTime:t.startTime}}get traceId(){return this._traceId??=Xe(this.parent)?this.parent.value.traceId:Wa(32)}get spanId(){return this._spanId??=Wa(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(t,r){this.status={_tag:\"Ended\",startTime:this.status.startTime,endTime:t,exit:r},this.export(this)}attribute(t,r){this.attributes.set(t,r)}event(t,r,n){this.events.push([t,r,n])}addLinks(t){this.links.push(...t)}},iE=e=>{let t=e.status,r=e._attributes===void 0?[]:er(e._attributes),n=[];if(e._events!==void 0)for(let s=0;s<e._events.length;s++){let[i,c,d]=e._events[s];n.push({name:i,timeUnixNano:String(c),attributes:d?er(Object.entries(d)):[],droppedAttributesCount:0})}let o;if(t.exit._tag===\"Success\")o={code:$c.Ok};else if($d(t.exit.cause))o={code:$c.Ok,message:\"Interrupted\"},r.push({key:\"span.label\",value:{stringValue:\"\\u26A0\\uFE0E Interrupted\"}},{key:\"status.interrupted\",value:{boolValue:!0}});else{let s=Dd(t.exit.cause,{includeCauseInStack:!0});if(o={code:$c.Error},s.length>0){o.message=s[0].message;for(let i of s)n.push({name:\"exception\",timeUnixNano:String(t.endTime),droppedAttributesCount:0,attributes:[{key:\"exception.type\",value:{stringValue:i.name}},{key:\"exception.message\",value:{stringValue:i.message}},{key:\"exception.stacktrace\",value:{stringValue:i.stack??\"No stack trace available\"}}]})}}let a=[];for(let s=0;s<e.links.length;s++){let i=e.links[s];a.push({traceId:i.span.traceId,spanId:i.span.spanId,attributes:er(Object.entries(i.attributes)),droppedAttributesCount:0})}return{traceId:e.traceId,spanId:e.spanId,parentSpanId:Xe(e.parent)?e.parent.value.spanId:void 0,name:e.name,kind:cE[e.kind],startTimeUnixNano:String(t.startTime),endTimeUnixNano:String(t.endTime),attributes:r,droppedAttributesCount:0,events:n,droppedEventsCount:0,status:o,links:a,droppedLinksCount:0}},$c={Unset:0,Ok:1,Error:2},cE={unspecified:0,internal:1,server:2,client:3,producer:4,consumer:5};var IT=(e,t=\"process\",r=pr.withConsoleError(pr.formatJson),n={})=>{let o={serviceName:e.service,serviceVersion:e.version,attributes:{\"deployment.environment.name\":e.environment}},a=(i,c)=>({url:i.url,resource:o,...i.headers===void 0?{}:{headers:Df.value(i.headers)},exportInterval:t===\"event\"?\"1 hour\":\"1 second\",shutdownTimeout:n[c]??\"3 seconds\"}),s=pr.layer([r]);return z.mergeAll(z.succeed(ql,e),e.traces===void 0?z.empty:vc(e.clock,!0).pipe(z.provideMerge(ba.layer(a(e.traces,\"traces\")).pipe(z.provide(tn.layerJson)))),e.logs===void 0?s:Sa.layer({...a(e.logs,\"logs\"),mergeWithExisting:!0}).pipe(z.provide(tn.layerJson),z.provideMerge(s)),e.metrics===void 0?z.empty:Ea.layer({...a(e.metrics,\"metrics\"),exportInterval:\"30 seconds\",temporality:\"delta\"}).pipe(z.provide(e.metricsProtocol===\"http/json\"?tn.layerJson:tn.layerProtobuf))).pipe(z.provide(Zl),z.provide(s),z.provideMerge(z.sync(Re.MetricRegistry,()=>new Map)))};var qm={};Te(qm,{endpoint:()=>tb,group:()=>eb,make:()=>QE,makeClient:()=>Ba,makeWith:()=>Fm,urlBuilder:()=>rb});var mm=\"~effect/encoding/Sse/SseError\",Bc=class extends ae(\"EventTooLarge\"){get message(){return`Pending SSE event exceeded the maximum size of ${this.maxEventSize}`}},Lc=class extends ae(\"SseError\"){[mm]=mm;get message(){return this.reason.message}},dE=10*1024*1024,fE=e=>Us((t,r)=>Le(()=>{let n=[],o,a=uE(i=>{i._tag===\"Retry\"?o=i:n.push(i)},e),s=k(t,i=>{for(let c=0;c<i.length;c++){let d=a.feed(i[c]);if(d!==void 0)return q(d)}return de});return ve(function i(){if(pn(n)){let c=n;return n=[],v(c)}else if(o)return q(o);return k(s,i)})})),jc=(e,t,r)=>cu(fE(t),fu(pE.pipe(Ie(e,lE)),r)());function uE(e,t){let r=t?.maxEventSize??dE,n,o,a,s,i,c,d,p;return f(),{feed:h,reset:f};function f(){n=!0,o=\"\",a=0,s=-1,i=!1,c=void 0,d=void 0,p=\"\"}function h(u){o=o?o+u:u,n&&o.startsWith(hm)&&(o=o.slice(hm.length)),n=!1;let g=o.length,x=0;for(;x<g;){i&&(o[x]===`\n`&&++x,i=!1);let C=-1,L=s,F;for(let O=x+a;C<0&&O<g;++O)F=o[O],F===\":\"&&L<0?L=O-x:F===\"\\r\"?(i=!0,C=O-x):F===`\n`&&(C=O-x);if(C<0){a=g-x,s=L;break}else a=0,s=-1;y(o,x,L,C),x+=C+1}if(x===g?o=\"\":x>0&&(o=o.slice(x)),o.length+p.length>r){let C=new Lc({reason:new Bc({maxEventSize:r})});return f(),C}}function y(u,g,x,C){if(C===0){p.length>0&&(e({_tag:\"Event\",id:c,event:d||\"message\",data:p.slice(0,-1)}),p=\"\"),d=void 0;return}let L=x<0,F=u.slice(g,g+(L?C:x)),O=0;L?O=C:u[g+x+1]===\" \"?O=x+2:O=x+1;let H=g+O,D=C-O,S=u.slice(H,H+D).toString();if(F===\"data\")p+=S?`${S}\n`:`\n`;else if(F===\"event\")d=S;else if(F===\"id\"&&!S.includes(\"\\0\"))c=S;else if(F===\"retry\"&&/^\\d+$/.test(S)){let A=parseInt(S,10);e(new Nc({duration:ie(A),lastEventId:c}))}}}var hm=\"\\uFEFF\";var ym=Je({id:gn(He),event:He,data:He}),pE=Je({_tag:Hs(\"Event\"),id:ho(He),event:He,data:He}),lE=bt({decode:e=>e.id===void 0?{event:e.event,data:e.data}:{id:e.id,event:e.event,data:e.data},encode:e=>({_tag:\"Event\",id:e.id,event:e.event??\"message\",data:e.data})}),Dc=\"~effect/encoding/Sse/Retry\",Nc=class e extends Pd(\"Retry\"){[Dc]=Dc;static is(t){return Q(t,Dc)}static filter(t){return e.is(t)?Rd(t):ds(t)}};var cd={};Te(cd,{AdditionalSchemas:()=>id,ErrorParseOptions:()=>$a,HeadersParseOptions:()=>Ua,ParamsParseOptions:()=>Ha,ParseOptions:()=>va,PayloadParseOptions:()=>Ma,QueryParseOptions:()=>Ia,SuccessParseOptions:()=>_a,getSlotParseOptions:()=>Da,isHttpApi:()=>GE,make:()=>YE,reflect:()=>Fa});var Pa={};Te(Pa,{delete:()=>VE,get:()=>BE,getErrorSchemas:()=>od,getPayloadSchemas:()=>rd,getSuccessSchemas:()=>nd,head:()=>zE,isHttpApiEndpoint:()=>PE,make:()=>rr,options:()=>JE,patch:()=>qE,post:()=>NE,put:()=>jE,query:()=>LE});var Qo={};Te(Qo,{Accepted:()=>hE,Created:()=>mE,Empty:()=>Ta,MultipartStreamTypeId:()=>Tm,MultipartTypeId:()=>wm,NoContent:()=>Jc,StreamSse:()=>gE,StreamUint8Array:()=>xE,WithHeaders:()=>EE,WithHeadersTypeId:()=>zn,WithHeadersValueTypeId:()=>wa,asFormUrlEncoded:()=>Xc,asJson:()=>RE,asMultipart:()=>wE,asMultipartStream:()=>TE,asNoContent:()=>yE,asText:()=>CE,asUint8Array:()=>kE,encodeToWithHeaders:()=>bE,getPayloadEncoding:()=>Wn,getResponseEncoding:()=>nn,getResponseEncodingSchema:()=>Tr,getStatusError:()=>Vc,getStatusErrorSchema:()=>Zo,getStatusSuccess:()=>qc,getStatusSuccessSchema:()=>wr,getWithHeadersAnnotation:()=>on,isNoContent:()=>Jn,isStreamSchema:()=>rt,isStreamSse:()=>Wc,isStreamUint8Array:()=>Gc,isWithHeaders:()=>ue,isWithHeadersValue:()=>bm,rebuildWithHeaders:()=>Kc,status:()=>xm,withHeaders:()=>Ra});var Yo=\"~effect/http-api/HttpApiSchema/Stream\";function xm(e){let t=typeof e==\"string\"?Ul(e):e;return r=>r.annotate({httpApiStatus:t})}var Ta=e=>li.pipe(xm(e)),Jc=Ta(204),mE=Ta(201),hE=Ta(202);function yE(e){return t=>li.pipe(Ie(lo(t),bt({decode:e.decode,encode:ss})))}var Sm=co(Ms),gE=e=>{let t=e.events??(e.data===void 0?void 0:Je({...ym.fields,data:yo(e.data)}));if(t===void 0)throw new Error(\"StreamSse requires either an events schema or a data schema\");return po(Sm.ast,{[Yo]:Yo,_tag:\"StreamSse\",mode:\"sse\",sseMode:e.events===void 0?\"data\":\"events\",contentType:e.contentType??Em(\"sse\"),events:t,error:e.error??Kf})},xE=e=>po(Sm.ast,{[Yo]:Yo,_tag:\"StreamUint8Array\",mode:\"uint8array\",contentType:e?.contentType??Em(\"uint8array\")}),rt=e=>Br(e)&&Q(e,Yo),Wc=e=>rt(e)&&e._tag===\"StreamSse\",Gc=e=>rt(e)&&e._tag===\"StreamUint8Array\";function Em(e){switch(e){case\"sse\":return\"text/event-stream\";case\"uint8array\":return\"application/octet-stream\"}}var zn=\"~effect/http-api/HttpApiSchema/WithHeaders\",wa=\"~effect/http-api/HttpApiSchema/WithHeadersValue\",bm=e=>Q(e,wa),SE=co(bm);function EE(e,t){if(ue(e))throw new Error(\"WithHeaders schemas cannot be nested\");return po(SE.ast,{[zn]:zn,schema:e,headers:Br(t)?t:Je(t)})}var Ra=e=>({[wa]:wa,body:e.body,headers:e.headers}),ue=e=>Br(e)&&Q(e,zn);function Kc(e,t,r){return po(e.ast,{[zn]:zn,schema:t,headers:r})}function bE(e,t){return r=>{let n=e.body,o=Je(e.headers),a=Xo(n.ast),s=ka(n.ast);return Je({body:n,headers:o}).pipe(Ie(lo(r),bt(t))).annotate({\"~httpApiWithHeaders\":{body:n,headers:o,bodyCodec:n,headersCodec:o,transformation:t},httpApiStatus:a,\"~httpApiEncoding\":s})}}var wm=\"~effect/http-api/HttpApiSchema/Multipart\";function wE(e){return t=>t.pipe(mi(wm)).annotate({\"~httpApiEncoding\":{_tag:\"Multipart\",mode:\"buffered\",contentType:Yc(\"Multipart\"),limits:e}})}var Tm=\"~effect/http-api/HttpApiSchema/MultipartStream\";function TE(e){return t=>t.pipe(mi(Tm)).annotate({\"~httpApiEncoding\":{_tag:\"Multipart\",mode:\"stream\",contentType:Yc(\"Multipart\"),limits:e}})}function Ca(e,t){return e.annotate({\"~httpApiEncoding\":{_tag:t._tag,contentType:t.contentType??Yc(t._tag)}})}function Yc(e){switch(e){case\"Multipart\":return\"multipart/form-data\";case\"Json\":return\"application/json\";case\"FormUrlEncoded\":return\"application/x-www-form-urlencoded\";case\"Uint8Array\":return\"application/octet-stream\";case\"Text\":return\"text/plain\"}}function RE(e){return t=>Ca(t,{_tag:\"Json\",...e})}function Xc(e){return t=>Ca(t,{_tag:\"FormUrlEncoded\",...e})}function CE(e){return t=>Ca(t,{_tag:\"Text\",...e})}function kE(e){return t=>Ca(t,{_tag:\"Uint8Array\",...e})}var Jn=e=>{if(As(e))return!0;let t=Dr(e);if(As(t))return!0;let r=e.encoding?.[0].to;return r===void 0?!1:As(r)},ka=vs(\"~httpApiEncoding\"),on=vs(\"~httpApiWithHeaders\"),Xo=vs(\"httpApiStatus\"),Rm={_tag:\"Json\",contentType:\"application/json\"},OE={_tag:\"FormUrlEncoded\",contentType:\"application/x-www-form-urlencoded\"};function AE(e){return ka(e)??Rm}function Wn(e,t){let r=ka(e);return r||(gr(t)?Rm:OE)}function nn(e){let t=AE(e);if(t._tag===\"Multipart\")throw new Error(\"Multipart is not supported in response\");return t}function qc(e){return Xo(e)??200}function wr(e){return ue(e)?Xo(e.ast)??qc(e.schema.ast):qc(e.ast)}function Tr(e){return ue(e)&&ka(e.ast)===void 0?nn(e.schema.ast):nn(e.ast)}function Vc(e){return Xo(e)??500}function Zo(e){return ue(e)?Xo(e.ast)??Vc(e.schema.ast):Vc(e.ast)}function vt(e){let t=e.toLowerCase().trim(),r=t.indexOf(\";\");return r===-1?t:t.slice(0,r).trim()}var Qc=\"~effect/http-api/HttpApiEndpoint\",PE=e=>Q(e,Qc);function rd(e){let t=[];for(let{schemas:r}of e.payload.values())t.push(...r);return t}function nd(e){let t=Array.from(e.success);return pn(t)?t:[Jc]}function od(e){let t=new Set(e.error),r=e.disableCodecs?ot:sd;for(let n of e.middlewares){let o=n;for(let a of o.error)t.add(r(a))}return Array.from(t)}var vE={[Qc]:Qc,pipe(){return Fe(this,arguments)},prefix(e){return es({...Oa(this),path:Hl(this.path,e)})},middleware(e){return es({...Oa(this),middlewares:new Set([...this.middlewares,e])})},annotate(e,t){return es({...Oa(this),annotations:sr(this.annotations,e,t)})},annotateMerge(e){return es({...Oa(this),annotations:St(this.annotations,e)})}},Oa=e=>({identifier:e.identifier,path:e.path,method:e.method,params:e.params,query:e.query,headers:e.headers,payload:e.payload,success:e.success,error:e.error,annotations:e.annotations,middlewares:e.middlewares,disableCodecs:e.disableCodecs});function es(e){function t(){}return Object.setPrototypeOf(t,vE),Object.assign(t,e)}var rr=e=>(t,r,n)=>{let o=n?.disableCodecs??!1,a=o?ot:xn;return es({identifier:t,path:r,method:e,params:Zc(n?.params,a),query:Zc(n?.query,a),headers:Zc(n?.headers,a),payload:HE(n?.payload,e,o),success:IE(n?.success,e,o),error:UE(n?.error,o),annotations:gt(),middlewares:new Set,disableCodecs:o})};function Zc(e,t){if(e!==void 0)return Br(e)?t(e):t(Je(e))}function HE(e,t,r){let n=new Map;if(e===void 0)return n;let o=Array.isArray(e)?e:Br(e)?[e]:[Je(e).pipe(Xc())],a=r?ot:DE;for(let s of o){let i=Wn(s.ast,t),c=vt(i.contentType),d=n.get(c);if(d){if(d.encoding._tag!==i._tag)throw new Error(`Multiple payload encodings for content-type: ${i.contentType}`);if(d.encoding._tag===\"Multipart\")throw new Error(`Multiple multipart payloads for content-type: ${i.contentType}`);d.schemas.push(a(s,t))}else n.set(c,{encoding:i,schemas:[a(s,t)]})}return n}var Om=\"effect/http-api/stream/failure\";function IE(e,t,r){if(e===void 0)return new Set;let n=Qn(e);return ME(n,t),new Set(r?n:n.map(sd))}var sd=yd(e=>{if(rt(e))return e;if(ue(e)){let t=rt(e.schema)?e.schema:td(e.schema,Tr(e));return Kc(e,t,xn(e.headers))}return FE(e)});function UE(e,t){if(e===void 0)return new Set;let r=Qn(e);for(let n of r){let o=ue(n)?n.schema:n;if(rt(o))throw new Error(\"Streaming schemas are not supported in error responses\")}return Am(r,Zo),new Set(t?r:r.map(sd))}function ME(e,t){let r=!1,n=new Map;for(let o of e){let a=ue(o)?o.schema:o,s=wr(o);if(rt(a)){if(_E(a,t),r)throw new Error(\"Multiple streaming success responses are not supported\");r=!0;let i=km(n,s);if(i.noContent)throw new Error(`Cannot combine no-content and streaming success responses for status: ${s}`);if(i.bufferedContentTypes.has(vt(a.contentType)))throw new Error(`Cannot combine buffered and streaming success responses for status ${s} and content-type: ${a.contentType}`);n.set(s,{...i,stream:a})}else{let i=km(n,s),c=Jn(a.ast);if(i.stream!==void 0){if(c)throw new Error(`Cannot combine no-content and streaming success responses for status: ${s}`);let d=Tr(o);if(vt(d.contentType)===vt(i.stream.contentType))throw new Error(`Cannot combine buffered and streaming success responses for status ${s} and content-type: ${d.contentType}`)}c||i.bufferedContentTypes.add(vt(Tr(o).contentType)),i.noContent=i.noContent||c}}Am(e,wr)}function km(e,t){let r=e.get(t);return r===void 0&&(r={bufferedContentTypes:new Set,noContent:!1},e.set(t,r)),r}function Am(e,t){let r=new Map;for(let n of e){let o=t(n),a=on(n.ast),s=ue(n)?n.schema:a?.body??n,i=Jn(s.ast)?\"\":vt(rt(s)?s.contentType:Tr(n).contentType),c=r.get(o);c===void 0&&(c={headerContentType:void 0,plainContentTypes:new Set},r.set(o,c));let d=()=>new Error(`Cannot combine a response with headers with another response for status ${o} and content-type: ${i||\"<no content>\"}`);if(ue(n)||a!==void 0){if(c.headerContentType!==void 0)throw new Error(`Cannot declare multiple responses with headers for status ${o}`);if(c.plainContentTypes.has(i))throw d();c.headerContentType=i}else{if(c.headerContentType===i)throw d();c.plainContentTypes.add(i)}}}function _E(e,t){if(t===\"HEAD\")throw new Error(\"HEAD endpoints cannot declare streaming success responses\");if(Wc(e)&&$E(e.events.ast))throw new Error(`SSE event name is reserved: ${Om}`)}function $E(e){return ed(Dr(e),new Set)}function ed(e,t){if(t.has(e))return!1;if(t.add(e),ci(e))return e.types.some(n=>ed(n,t));if(di(e))return ed(e.thunk(),t);if(!Ps(e))return!1;let r=e.propertySignatures.find(n=>n.name===\"event\");return r!==void 0&&Aa(r.type,t)}function Aa(e,t){if(t.has(e))return!1;t.add(e);let r=Dr(e);return r!==e?Aa(r,t):Jf(e)?e.literal===Om:ci(e)?e.types.some(n=>Aa(n,t)):di(e)?Aa(e.thunk(),t):!1}function FE(e){let t=nn(e.ast),r=on(e.ast);return r===void 0?td(e,t):e.annotate({\"~httpApiWithHeaders\":{...r,bodyCodec:td(r.body,t),headersCodec:xn(r.headers)}})}function td(e,t){switch(t._tag){case\"Json\":return Nr(e);case\"FormUrlEncoded\":return xn(e);case\"Text\":case\"Uint8Array\":return e}}function DE(e,t){switch(Wn(e.ast,t)._tag){case\"Json\":return Nr(e);case\"FormUrlEncoded\":return xn(e);case\"Text\":case\"Uint8Array\":case\"Multipart\":return e}}var BE=rr(\"GET\"),LE=rr(\"QUERY\"),NE=rr(\"POST\"),jE=rr(\"PUT\"),qE=rr(\"PATCH\"),VE=rr(\"DELETE\");var zE=rr(\"HEAD\"),JE=rr(\"OPTIONS\");var ad=\"~effect/http-api/HttpApi\",GE=e=>Q(e,ad),KE={[ad]:ad,pipe(){return Fe(this,arguments)},add(...e){let t={...this.groups};for(let r of e)yt(t,r.identifier,r);return sn({...Gn(this),groups:t})},addHttpApi(e){let t={...this.groups};for(let r of Object.keys(e.groups)){let n=e.groups[r];yt(t,r,n.annotateMerge(St(e.annotations,n.annotations)))}return sn({...Gn(this),groups:t})},prefix(e){return sn({...Gn(this),groups:ir(this.groups,t=>t.prefix(e))})},middleware(e){return sn({...Gn(this),groups:ir(this.groups,t=>t.middleware(e))})},annotate(e,t){return sn({...Gn(this),annotations:sr(this.annotations,e,t)})},annotateMerge(e){return sn({...Gn(this),annotations:St(this.annotations,e)})}},Gn=e=>({identifier:e.identifier,groups:e.groups,annotations:e.annotations}),sn=e=>{function t(){}return Object.setPrototypeOf(t,KE),Object.assign(t,e)},YE=e=>sn({identifier:e,groups:{},annotations:gt()}),Fa=(e,t)=>{let r=Object.values(e.groups);for(let n of r){let o=St(e.annotations,n.annotations);t.onGroup({group:n,mergedAnnotations:o});let a=Object.values(n.endpoints);for(let s of a)t.predicate&&!t.predicate({endpoint:s,group:n})||t.onEndpoint({group:n,endpoint:s,middleware:s.middlewares,mergedAnnotations:St(o,s.annotations),successes:Pm(nd(s),wr),errors:Pm(od(s),Zo)})}},Pm=(e,t)=>{let r=new Map;return e.forEach(n),r;function n(o){let a=ue(o)?o.schema:o;if(rt(a))return;let s=t(o),i=r.get(s);i===void 0?r.set(s,[o]):i.push(o)}},id=class extends se()(\"effect/http-api/HttpApi/AdditionalSchemas\"){},va=class extends se()(\"effect/http-api/HttpApi/ParseOptions\"){},Ha=class extends se()(\"effect/http-api/HttpApi/ParamsParseOptions\"){},Ia=class extends se()(\"effect/http-api/HttpApi/QueryParseOptions\"){},Ua=class extends se()(\"effect/http-api/HttpApi/HeadersParseOptions\"){},Ma=class extends se()(\"effect/http-api/HttpApi/PayloadParseOptions\"){},_a=class extends se()(\"effect/http-api/HttpApi/SuccessParseOptions\"){},$a=class extends se()(\"effect/http-api/HttpApi/ErrorParseOptions\"){},Da=e=>{let t=xt(e,va);return{params:xt(e,Ha)??t,query:xt(e,Ia)??t,headers:xt(e,Ua)??t,payload:xt(e,Ma)??t,success:xt(e,_a)??t,error:xt(e,$a)??t}};var XE=new Set;function Hm(e){if(e===void 0)return XE;let t=Wf(e.ast);return Ps(t)&&t.indexSignatures.length===0?new Set(t.propertySignatures.map(r=>String(r.name))):void 0}var Ba=(e,t)=>Ze(function*(){let r=yield*Et(),n=t.httpClient.pipe(t?.baseUrl===void 0?ot:Yi(ta(t.baseUrl.toString())));function o(a,s,i,c,d){if(d===-1)return n.execute(i);let p=r.mapUnsafe.get(c[d]);return p===void 0?o(a,s,i,c,d-1):p({endpoint:s,group:a,request:i,next(f){return o(a,s,f,c,d-1)}})}Fa(e,{predicate:t?.predicate,onGroup(a){t.onGroup?.(a)},onEndpoint(a){let{group:s,endpoint:i,errors:c,successes:d,mergedAnnotations:p}=a,f=Da(p),h=Dm(i.path,i.params),y={orElse:lb},u=new Map;for(let[S,A]of c.entries()){let B=Mm(A);for(let[j,N]of B.entries())dd(u,S,j,Im(N,f.error,f.headers))}for(let[S,A]of u.entries()){let B=Um(A);y[S]=j=>k(hn(B(j),N=>vr(Fd(_d(new ne({reason:new mr({request:j.request,response:j})})),N))),q)}let g=new Map;for(let[S,A]of d.entries()){let B=Mm(A);for(let[j,N]of B.entries())dd(g,S,j,Im(N,f.success,f.headers))}for(let S of ib(i)){let A=Lm(S)?S.schema:S;dd(g,wr(S),A.contentType,cb(S,f.success,f.headers))}for(let[S,A]of g.entries())y[S]=Um(A);let x=Ls(i.params,S=>uo(S,f.params)),C=rd(i),L=pn(C)?uo(gr(i.method)?hb(C,i.method):Lr(C),f.payload):void 0,F=Ls(i.headers,S=>uo(S,f.headers)),O=Ls(i.query,S=>uo(S,f.query)),H=Array.from(a.middleware,S=>`${S.key}/Client`),D=Ve(function*(S){let A=Ge(i.method)(i.path);if(S!==void 0){if(x!==void 0){let re=yield*x(S.params);A=Mn(A,h(re))}if(L!==void 0)if(gr(i.method))if(S.payload instanceof FormData)A=qi(A,S.payload);else{let re=yield*L(S.payload);A=Se(A,re)}else{let re=yield*L(S.payload);A=ra(A,re)}if(F!==void 0){let re=yield*F(S.headers);A=Un(A,re)}if(O!==void 0){let re=yield*O(S.query);A=ra(A,re)}}let B=yield*o(s,i,A,H,H.length-1);if(S?.responseMode===\"response-only\")return B;let j=(y[B.status]??y.orElse)(B,S?.sseOptions),N=yield*t.transformResponse===void 0?j:t.transformResponse(j);return S?.responseMode===\"decoded-and-response\"?[N,B]:N});t.onEndpoint({...a,endpointFn:D})}})}),QE=(e,t)=>k(Gr,r=>Fm(e,{...t,httpClient:t?.transformClient?t.transformClient(r):r})),Fm=(e,t)=>{let r={};return Ba(e,{...t,onGroup({group:n}){n.topLevel||yt(r,n.identifier,{})},onEndpoint({endpoint:n,endpointFn:o,group:a}){yt(a.topLevel?r:r[a.identifier],n.identifier,o)}}).pipe(Ss(r))},eb=(e,t)=>{let r={};return Ba(e,{...t,predicate:({group:n})=>n.identifier===t.group,onEndpoint({endpoint:n,endpointFn:o}){yt(r,n.identifier,o)}}).pipe(_(()=>r))},tb=(e,t)=>{let r;return Ba(e,{...t,httpClient:t.transformClient?t.transformClient(t.httpClient):t.httpClient,predicate:({endpoint:n,group:o})=>o.identifier===t.group&&n.identifier===t.endpoint,onEndpoint({endpointFn:n}){r=n}}).pipe(_(()=>r))},rb=(e,t)=>{let r={};return Fa(e,{onGroup({group:n}){n.topLevel||yt(r,n.identifier,{})},onEndpoint({group:n,endpoint:o,mergedAnnotations:a}){let s=Da(a),i=Dm(o.path,o.params),c=o.params===void 0?void 0:ui(o.params,s.params),d=o.query===void 0?void 0:ui(o.query,s.query),p=f=>{let h=f?.params,y=h===void 0?o.path:i(c===void 0?h:c(h)),u=f?.query===void 0?void 0:d===void 0?f.query:d(f.query),g=u===void 0?oo:Ce(u);if(t?.baseUrl===void 0){let C=Fr(g);return C===\"\"?y:`${y}?${C}`}let x=new URL(ta(Bi(y),t.baseUrl.toString()).url);for(let[C,L]of g.params)L!==void 0&&x.searchParams.append(C,L);return x.toString()};yt(n.topLevel?r:r[n.identifier],o.identifier,p)}}),r},nb=/(\\/?):(\\w+)(\\?)?/g,Dm=(e,t)=>{if(t===void 0||!e.includes(\":\"))return n=>e;let r=Hm(t);return n=>e.replace(nb,(o,a,s,i)=>{if(r!==void 0&&!r.has(s))return o;let c=n[s];if(c===void 0){if(i!==void 0)return\"\";throw new Error(`Missing path parameter: ${s}`)}return`${a}${encodeURIComponent(c)}`})};function Im(e,t,r){let n=e.some(s=>ue(s)||on(s.ast)!==void 0),o=n?Lr(e.map(s=>sb(s,t,r))):pb(e),a=fo(o,t);return s=>k(s.arrayBuffer,n?i=>a({body:i,headers:s.headers}):a)}var ob=Je({body:mo,headers:mo});function sb(e,t,r){let n=on(e.ast),o=n!==void 0?{body:n.bodyCodec,headers:n.headersCodec,toValue:n.transformation.decode}:ue(e)?{body:e.schema,headers:e.headers,toValue:Ra}:{body:e,headers:mo,toValue:i=>i.body},a=fo(jm(o.body).pipe(Ie(o.body)),t),s=fo(o.headers,r);return ob.pipe(Ie(ue(e)?e:lo(e),ii({decode:i=>of({body:a(i.body),headers:s(i.headers)}).pipe(_(o.toValue),Ur(c=>c.issue)),encode:(i,c)=>q(new Os({message:\"Decode only schema\"},i,c))})))}function dd(e,t,r,n){let o=vt(r),a=e.get(t);a===void 0?e.set(t,[{contentType:o,decode:n}]):a.push({contentType:o,decode:n})}function Um(e){let t=e[0];return e.length===1&&t!==void 0?t.decode:(r,n)=>{let o=vt(r.headers[\"content-type\"]??\"\"),a=e.find(s=>s.contentType===o);return a===void 0?ab(r,o,e):a.decode(r,n)}}function Mm(e){let t=new Map;for(let r of e){let n=ue(r)?r.schema:r,o=Jn(n.ast)?\"\":vt(Tr(r).contentType),a=t.get(o);a===void 0?t.set(o,[r]):a.push(r)}return t}function ab(e,t,r){let n=Array.from(new Set(r.map(o=>o.contentType))).join(\", \");return q(new ne({reason:new Ue({request:e.request,response:e,description:`Unsupported response content-type for status ${e.status}: ${t||\"<missing>\"}. Expected one of: ${n}`})}))}var Bm=\"effect/http-api/stream/failure\",Lm=e=>ue(e);function ib(e){let t=[];for(let r of e.success){let n=ue(r)?r.schema:r;rt(n)&&t.push(r)}return t}function cb(e,t,r){let n=Lm(e),o=n?e.schema:e,a=Gc(o)?void 0:{declaration:o,decoder:db(o,t)},s=(c,d)=>_(Et(),p=>Fs(a===void 0?c.stream:fb(c.stream,a.declaration,a.decoder(d)),p));if(!n)return s;let i=fo(e.headers,r);return(c,d)=>k(i(c.headers),p=>_(s(c,d),f=>Ra({body:f,headers:p})))}function db(e,t){let r=Lr([Je({id:gn(He),event:pi(Bm),data:yo(Nr(tu(e.error,Is())))}),e.events]),n=jc(r,void 0,t);return o=>o===void 0?n:jc(r,o,t)}function fb(e,t,r){let n=pu(e.pipe(gu,So(r)),o=>Le(()=>{let a;return ve(()=>a!==void 0?vr(a):k(o,s=>{for(let i=0;i<s.length;i++){let c=s[i];if(c.event===Bm&&Md(c.data)){if(i===0)return vr(c.data);a=c.data,s=s.slice(0,i);break}}return v(s)}))}));return t.sseMode===\"data\"?$s(n,o=>o.data):n}var Nm=Zf(globalThis.ArrayBuffer,{expected:\"ArrayBuffer\"}),ub=Nm.pipe(Ie(eu,bt({decode(e){return new Uint8Array(e)},encode(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}}))),fd=Nm.pipe(Ie(He,bt({decode(e){return new TextDecoder().decode(e)},encode(e){let t=new TextEncoder().encode(e);return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}}))),_m=fd.pipe(Ie(Lr([pi(\"\").pipe(Ie(Yf,bt({decode:()=>{},encode:()=>\"\"}))),Qf])));function pb(e){return Lr(e.map(t));function t(r){return jm(r).pipe(Ie(r))}}function jm(e){switch(nn(e.ast)._tag){case\"Json\":return zf(Dr(e.ast))?_m.pipe(Ie(mo,bt({decode:n=>n===void 0?null:n,encode:n=>n===null?void 0:n}))):_m;case\"FormUrlEncoded\":return fd.pipe(Ie(ru,bt({decode:r=>Ce(new URLSearchParams(r)),encode:Fr})));case\"Uint8Array\":return ub;case\"Text\":return fd}}var lb=e=>q(new ne({reason:new Ue({request:e.request,response:e})})),mb=co(Ii);function hb(e,t){return Lr(e.map(r=>yb(r,t)))}var $m=new WeakMap;function yb(e,t){let r=e.ast,n=$m.get(r);if(n!==void 0)return n;let o=Wn(r,t),a=mb.pipe(Ie(e,ii({decode(s,i){return q(new Os({message:\"Encode only schema\"},s,i))},encode(s,i){switch(o._tag){case\"Multipart\":return q(new Os({message:\"Payload must be a FormData\"},s,i));case\"Json\":try{let c=JSON.stringify(s);return v(ut(c,o.contentType))}catch{return q(new so({expected:\"a JSON-serializable request body\"},s,i))}case\"Text\":return typeof s!=\"string\"?q(new so({message:\"Expected a string\"},s,i)):v(ut(s,o.contentType));case\"FormUrlEncoded\":return gd(s)?v(vo(Ce(s),o.contentType)):q(new so({message:\"Expected a record\"},s,i));case\"Uint8Array\":return s instanceof Uint8Array?v(Rt(s,o.contentType)):q(new so({message:\"Expected a Uint8Array\"},s,i))}}})));return $m.set(r,a),a}var Vm={};Te(Vm,{isHttpApiGroup:()=>gb,make:()=>Sb});var ud=\"~effect/http-api/HttpApiGroup\",gb=e=>Q(e,ud),xb={[ud]:ud,add(...e){let t={...this.endpoints};for(let r of e)yt(t,r.identifier,r);return Rr({...an(this),endpoints:t})},prefix(e){return Rr({...an(this),endpoints:ir(this.endpoints,t=>t.prefix(e))})},middleware(e){return Rr({...an(this),endpoints:ir(this.endpoints,t=>t.middleware(e))})},annotateMerge(e){return Rr({...an(this),annotations:St(this.annotations,e)})},annotate(e,t){return Rr({...an(this),annotations:sr(this.annotations,e,t)})},annotateEndpointsMerge(e){return Rr({...an(this),endpoints:ir(this.endpoints,t=>t.annotateMerge(e))})},annotateEndpoints(e,t){return Rr({...an(this),endpoints:ir(this.endpoints,r=>r.annotate(e,t))})},pipe(){return Fe(this,arguments)}},an=e=>({identifier:e.identifier,topLevel:e.topLevel,endpoints:e.endpoints,annotations:e.annotations}),Rr=e=>{function t(){}return Object.setPrototypeOf(t,xb),t.key=`effect/http-api/HttpApiGroup/${e.identifier}`,Object.assign(t,e)},Sb=(e,t)=>Rr({identifier:e,topLevel:t?.topLevel??!1,endpoints:{},annotations:gt()});var pR=e=>t=>{let r=Object.entries(e).filter(o=>typeof o[1]==\"string\"),n={};for(let o of Object.keys(t.fields)){let a=l.toEncoded(t.fields[o]),s=e[o];n[o]=typeof s==\"string\"?l.optionalKey(a):a,typeof s==\"string\"&&(n[s]=l.optionalKey(a))}return l.Struct(n).pipe(l.decodeTo(t,io.transform({decode:o=>{let a={...o};for(let[s,i]of r)!Object.hasOwn(a,s)&&Object.hasOwn(a,i)&&(a[s]=a[i]),delete a[i];return a},encode:o=>{let a={...o};for(let[s,i]of r)Object.hasOwn(a,s)&&(a[i]=a[s]);return a}})))};export{Jm as a,Ei as b,bb as c,wb as d,Ns as e,ft as f,ge as g,xr as h,jo as i,Kx as j,Yx as k,Zx as l,Fl as m,Jo as n,IT as o,Bl as p,sS as q,Nl as r,iS as s,cS as t,Ci as u,Th as v,ki as w,wi as x,Zb as y,Tt as z,Qb as A,ew as B,tw as C,rw as D,nw as E,ow as F,sw as G,aw as H,iw as I,cw as J,dw as K,kh as L,zu as M,Ah as N,fw as O,Gu as P,Xu as Q,Ai as R,Fh as S,Zu as T,Bh as U,Lu as V,uw as W,ry as X,pw as Y,lw as Z,mw as _,Qo as $,Pa as aa,cd as ba,qm as ca,Vm as da,pR as ea};\n","node_modules/apps/react.js":"import{a as s,b as n,e as i}from\"./chunk-IJBGBWKG.js\";import{W as u}from\"./chunk-MN25OBZU.js\";import\"./chunk-WOT6VMZA.js\";import{useEffect as c,useLayoutEffect as A,useState as d}from\"react\";var R=e=>{let[o,a]=d();c(()=>{let r=n.make(),l=r.subscribe(e,p=>a({atom:e,result:p}),{immediate:!0});return()=>{l(),r.dispose()}},[e]);let t=o?.atom===e?o.result:s.initial();A(()=>i(t),[t]);let m=s.value(t);return{data:u.getOrUndefined(m),pending:t._tag===\"Initial\",error:t._tag===\"Failure\"?\"Could not load app data.\":void 0}};export{R as useAppQuery};\n","node_modules/apps/chunk-IJBGBWKG.js":"import{$ as Ri,$a as Ui,$b as pe,$c as Ee,$d as Rt,Ae as ds,B as dt,Ba as fe,Bb as Pe,Be as ms,Bf as At,C as mt,Cf as Qe,D as yi,De as ps,Df as Tt,E as v,Ee as hs,Ef as Os,F as p,Fa as pt,Fb as Bi,Fc as Qi,Fe as ys,Ga as ht,Gb as $e,Gf as As,H as M,Hc as Yi,Hf as Ye,I as j,Ic as Be,If as Ts,J as vi,Ja as _i,Jf as xs,K as C,Kc as Xi,Kf as we,Lc as We,Lf as Fs,Mb as Et,Mc as Ji,Nc as Gi,Ne as Ot,O as Si,P as Ue,Pc as Zi,Q as gi,R as k,S as G,Sa as yt,Se as He,T as Ei,Ta as Ni,Tf as Is,U as wi,Ua as Ci,Ub as De,V as bi,W as Z,Wa as ze,Wf as xt,X as H,Xa as vt,Xb as Wi,Xd as as,Ya as St,Yd as os,Ye as vs,Z as Ve,Za as Li,Zb as g,Zd as cs,Zf as Ft,_ as q,_b as me,_c as es,_f as _s,a as ut,ac as b,ad as ts,b as d,ba as Oi,bc as he,bd as wt,c as lt,ca as ce,cb as ee,cc as te,cd as is,ch as zs,d as oi,dc as ye,dg as Ns,dh as ie,e as Ce,ec as ve,ef as qe,eh as Nt,fc as Se,fg as be,fh as Ms,g as Le,gc as ge,gd as ss,gh as Ct,h as ci,hb as Vi,hd as rs,he as us,hf as Ss,hg as It,i as ui,ib as zi,id as bt,ja as ue,jb as Me,jd as ns,jg as _t,kb as Mi,kc as L,kf as gs,l as W,lb as ki,lf as Es,m as li,mb as ke,mc as ji,mf as ws,nc as _,ng as Cs,oc as Hi,p as fi,pc as qi,q as oe,qa as Ai,qg as Ls,r as di,rb as K,rf as bs,s as mi,sa as Ti,sb as Pi,sf as Rs,t as pi,ta as xi,tb as de,te as je,u as ft,ua as Fi,ub as $i,uc as Ki,ug as Us,v as hi,va as le,vb as Di,vg as Vs,wa as Ii,we as ls,wf as Ke,xb as gt,ze as fs}from\"./chunk-MN25OBZU.js\";import{a as ct}from\"./chunk-WOT6VMZA.js\";var Y={};ct(Y,{Schema:()=>Br,TypeId:()=>Ut,all:()=>$r,builder:()=>Dr,cause:()=>Ur,error:()=>Vr,fail:()=>Cr,failWithPrevious:()=>Vt,failure:()=>P,failureWithPrevious:()=>Q,flatMap:()=>zr,fromExit:()=>_r,fromExitWithPrevious:()=>Ge,getOrElse:()=>Lr,getOrThrow:()=>et,initial:()=>R,isAsyncResult:()=>$,isFailure:()=>U,isInitial:()=>Re,isInterrupted:()=>Nr,isNotInitial:()=>Ze,isSuccess:()=>O,isWaiting:()=>Ir,map:()=>Te,match:()=>Mr,matchWithError:()=>kr,matchWithWaiting:()=>Pr,replacePrevious:()=>se,success:()=>h,toExit:()=>D,touch:()=>$s,value:()=>Ae,waiting:()=>V,waitingFrom:()=>Oe});var Ut=\"~effect/reactivity/AsyncResult\",$=e=>W(e,Ut),Je={[Ut]:{E:lt,A:lt},pipe(){return ut(this,arguments)},[pi](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case\"Initial\":return!0;case\"Success\":return ft(this.value,e.value);case\"Failure\":return ft(this.cause,e.cause)}},[fi](){let e=mi(`${this._tag}:${this.waiting}`);return this._tag===\"Initial\"?e:di(e)(this._tag===\"Success\"?oe(this.value):oe(this.cause))}},Ir=e=>e.waiting,_r=e=>e._tag===\"Success\"?h(e.value):P(e.cause),Ge=(e,t)=>e._tag===\"Success\"?h(e.value):Q(e.cause,{previous:t}),Oe=e=>e._tag===\"None\"?R(!0):V(e.value),Re=e=>e._tag===\"Initial\",Ze=e=>e._tag!==\"Initial\",R=(e=!1)=>{let t=Object.create(Je);return t._tag=\"Initial\",t.waiting=e,t},O=e=>e._tag===\"Success\",h=(e,t)=>{let i=Object.create(Je);return i._tag=\"Success\",i.value=e,i.waiting=t?.waiting??!1,i.timestamp=t?.timestamp??Date.now(),i},U=e=>e._tag===\"Failure\",Nr=e=>e._tag===\"Failure\"&&Ci(e.cause),P=(e,t)=>{let i=Object.create(Je);return i._tag=\"Failure\",i.cause=e,i.previousSuccess=t?.previousSuccess??v(),i.waiting=t?.waiting??!1,i},Q=(e,t)=>P(e,{previousSuccess:G(t.previous,i=>O(i)?p(i):U(i)?i.previousSuccess:v()),waiting:t.waiting}),Cr=(e,t)=>P(yt(e),t),Vt=(e,t)=>Q(yt(e),t),V=d(e=>$(e[0]),(e,t)=>{if(e.waiting)return t?.touch?$s(e):e;let i=Object.assign(Object.create(Je),e);return i.waiting=!0,t?.touch&&O(i)&&(i.timestamp=Date.now()),i}),$s=e=>O(e)?h(e.value,{waiting:e.waiting}):e,se=d(2,(e,t)=>e._tag===\"Failure\"?Q(e.cause,{previous:t,waiting:e.waiting}):e),Ae=e=>e._tag===\"Success\"?p(e.value):e._tag===\"Failure\"?k(e.previousSuccess,t=>t.value):v(),Lr=d(2,(e,t)=>C(Ae(e),t)),et=e=>gi(Ae(e),()=>new ee(\"AsyncResult.getOrThrow: no value found\")),Ur=e=>e._tag===\"Failure\"?p(e.cause):v(),Vr=e=>e._tag===\"Failure\"?St(e.cause):v(),D=e=>{switch(e._tag){case\"Success\":return zi(e.value);case\"Failure\":return Me(e.cause);default:return Mi(new ee)}},Te=d(2,(e,t)=>{switch(e._tag){case\"Initial\":return e;case\"Failure\":return P(e.cause,{previousSuccess:k(e.previousSuccess,i=>h(t(i.value),i)),waiting:e.waiting});case\"Success\":return h(t(e.value),e)}}),zr=d(2,(e,t)=>{switch(e._tag){case\"Initial\":return e;case\"Failure\":return P(e.cause,{previousSuccess:G(e.previousSuccess,i=>{let s=t(i.value,i);return O(s)?p(s):v()}),waiting:e.waiting});case\"Success\":return t(e.value,e)}}),Mr=d(2,(e,t)=>{switch(e._tag){case\"Initial\":return t.onInitial(e);case\"Failure\":return t.onFailure(e);case\"Success\":return t.onSuccess(e)}}),kr=d(2,(e,t)=>{switch(e._tag){case\"Initial\":return t.onInitial(e);case\"Failure\":{let i=vt(e.cause);return ue(i)?t.onDefect(ze(i.failure),e):t.onError(i.success,e)}case\"Success\":return t.onSuccess(e)}}),Pr=d(2,(e,t)=>{if(e.waiting)return t.onWaiting(e);switch(e._tag){case\"Initial\":return t.onWaiting(e);case\"Failure\":{let i=vt(e.cause);return ue(i)?t.onDefect(ze(i.failure),e):t.onError(i.success,e)}case\"Success\":return t.onSuccess(e)}}),$r=e=>{let t=li(e),i=t?Array.from(e,(n,a)=>[a,n]):Object.entries(e),s=t?[]:{},r=!1;for(let n=0;n<i.length;n++){let[a,o]=i[n];if($(o)){if(!O(o))return o}else{mt(s,a,o);continue}mt(s,a,o.value),o.waiting&&(r=!0)}return h(s,{waiting:r})},Dr=e=>new Lt(e),Lt=class{constructor(t){this.result=t}result;output=v();when(t,i){if(M(this.output)&&t(this.result)){let s=i(this.result);j(s)&&(this.output=s)}return this}pipe(){return ut(this,arguments)}onWaiting(t){return this.when(i=>i.waiting,i=>p(t(i)))}onInitialOrWaiting(t){return this.when(i=>Re(i)||i.waiting,i=>p(t(i)))}onInitial(t){return this.when(Re,i=>p(t(i)))}onSuccess(t){return this.when(O,i=>p(t(i.value,i)))}onFailure(t){return this.when(U,i=>p(t(i.cause,i)))}onError(t){return this.onErrorIf(Ce,t)}onErrorIf(t,i){return this.when(U,s=>St(s.cause).pipe(bi(t),k(r=>i(r,s))))}onErrorTag(t,i){return this.onErrorIf(s=>W(s,\"_tag\")&&(Array.isArray(t)?t.includes(s._tag):s._tag===t),i)}onDefect(t){return this.when(U,i=>{let s=Li(i.cause);return ue(s)?v():p(t(s.success,i))})}onInterrupt(t){return this.when(U,i=>{let s=Ui(i.cause);return ue(s)?v():p(t(s.success,i))})}orElse(t){return C(this.output,t)}orNull(){return Si(this.output)}render(){if(j(this.output))return this.output.value;if(U(this.result))throw ze(this.result.cause);return null}exhaustive(){return this.render()}},Br=e=>{let t=e.success??Ot,i=e.error??Ot,s=ls()([t,bs(i,Es())],([r,n])=>(a,o,c)=>{if(!$(a))return Se(new cs(o,a,c));switch(a._tag){case\"Initial\":return g(a);case\"Success\":return bt(je(r)(a.value,c),{onSuccess:u=>h(u,a),onFailure:u=>Rt(o,\"value\",u,a,c)});case\"Failure\":{let u=a.previousSuccess.pipe(k(f=>bt(je(r)(f.value,c),{onSuccess:m=>p(h(m,f)),onFailure:m=>new os(o,[new as([\"previousSuccess\",\"value\"],m)],a,c)})),C(()=>me)),l=rs(je(n)(a.cause,c),f=>Rt(o,\"cause\",f,a,c));return ns(u,f=>ss(l,m=>P(m,{previousSuccess:f,waiting:a.waiting})))}}},{expected:\"AsyncResult\",toCodec([r,n]){let a=qe(\"Success\",{value:r,waiting:He,timestamp:gs});return Ss()(vs([qe(\"Initial\",{waiting:He}),a,qe(\"Failure\",{cause:n,previousSuccess:Rs(a),waiting:He})]),us({decode:o=>{switch(o._tag){case\"Initial\":return R(o.waiting);case\"Success\":return h(o.value,{waiting:o.waiting,timestamp:o.timestamp});case\"Failure\":return P(o.cause,{previousSuccess:k(o.previousSuccess,c=>h(c.value,c)),waiting:o.waiting})}},encode(o){switch(o._tag){case\"Initial\":return{_tag:\"Initial\",waiting:o.waiting};case\"Success\":return{_tag:\"Success\",value:o.value,waiting:o.waiting,timestamp:o.timestamp};case\"Failure\":return{_tag:\"Failure\",cause:o.cause,previousSuccess:o.previousSuccess,waiting:o.waiting}}}}))},toEquivalence:hi,toFormatter:([r,n])=>a=>{switch(a._tag){case\"Success\":return`AsyncResult.Success(${r(a.value)}, ${a.waiting}, ${a.timestamp})`;case\"Failure\":return`AsyncResult.Failure(${n(a.cause)}, ${a.waiting})`;case\"Initial\":return`AsyncResult.Initial(${a.waiting}, ${a.waiting})`}}});return Object.assign(s,{success:t,error:i})};var Ht={};ct(Ht,{AtomRegistry:()=>w,BatchPhase:()=>z,TypeId:()=>re,batch:()=>jt,batchState:()=>y,getResult:()=>Bt,isAtomRegistry:()=>Hs,layer:()=>jr,layerOptions:()=>Ks,make:()=>qs,mount:()=>Wt,toStream:()=>tt,toStreamResult:()=>Dt});var re=\"~effect/reactivity/AtomRegistry\",Hs=e=>W(e,re),qs=e=>new Mt(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),w=H(re),Ks=e=>Pe(w,ve(function*(){let t=yield*We,i=qs({...e,scheduleTask:e?.scheduleTask});return yield*de(t,b(()=>i.dispose())),i})),jr=Ks(),tt=d(2,(e,t)=>Ft(i=>pe(()=>{let s=Ye(),r=Oi(s.context,K),n=e.subscribe(t,a=>we(i,a),{immediate:!0});return de(r,b(n))}))),Dt=d(2,(e,t)=>tt(e,t).pipe(_t(Ze),It(i=>i._tag===\"Success\"?g(i.value):ge(i.cause)),Cs)),Bt=d(e=>Hs(e[0]),(e,t,i)=>{let s=i?.suspendOnWaiting??!1;return te(r=>{let n=e.get(t);if(n._tag!==\"Initial\"&&!(s&&n.waiting))return r(D(n));let a=e.subscribe(t,o=>{o._tag!==\"Initial\"&&!(s&&o.waiting)&&(r(D(o)),a())});return b(a)})}),Wt=d(2,(e,t)=>Gi(b(()=>e.mount(t)),i=>b(i))),Hr={immediate:!0},Qs=e=>{e()},E={};function Fe(e,t){let i=E;for(let s of e)try{t(s)}catch(r){i===E&&(i=r)}if(i!==E)throw i}var zt=\"~effect-atom/atom/Atom/Serializable\",xe=e=>zt in e?e[zt].key:e,Mt=class{[re];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(t,i,s,r){if(this[re]=re,this.scheduler=new ht(\"sync\",i),this.schedulerAsync=new ht(\"async\",i),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=r,s===void 0&&r!==void 0?this.timeoutResolution=Math.round(r/2):this.timeoutResolution=s??1e3,t!==void 0)for(let[n,a]of t){let o=n;for(;o.initialValueTarget;)o=o.initialValueTarget;this.ensureNode(o).setInitialValue(a)}}nodes=new Map;preloadedSerializable=new Map;timeoutBuckets=new Map;nodeTimeoutBucket=new Map;disposed=!1;getNodes(){return this.nodes}get(t){return this.ensureNode(t).value()}set(t,i){t.write(this.ensureNode(t).writeContext,i)}setSerializable(t,i){this.preloadedSerializable.set(t,i)}modify(t,i){let s=this.ensureNode(t),r=i(s.value());return t.write(s.writeContext,r[1]),r[0]}update(t,i){let s=this.ensureNode(t);t.write(s.writeContext,i(s.value()))}refresh=t=>{t.refresh!==void 0?t.refresh(this.refresh):this.invalidateAtom(t)};subscribe(t,i,s){let r=this.ensureNode(t);s?.immediate?i(r.value()):r.state===S.stale&&r.value();let n=r.subscribe(function(){i(r._value)});return()=>{n(),r.canBeRemoved&&this.scheduleNodeRemoval(r)}}mount(t){return this.subscribe(t,Le,Hr)}atomHasTtl(t){return!t.keepAlive&&t.idleTTL!==0&&(t.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(t){let i=xe(t),s=this.nodes.get(i);if(s===void 0?(s=this.createNode(t),this.nodes.set(i,s),this.onNodeAdded?.(s)):this.atomHasTtl(t)&&this.removeNodeTimeout(s),typeof i==\"string\"&&this.preloadedSerializable.has(i)){let r=this.preloadedSerializable.get(i);this.preloadedSerializable.delete(i);let n=t[zt].decode(r),a=t;for(;a.initialValueTarget;)a=a.initialValueTarget;a===t?s.setValue(n):this.ensureNode(a).setInitialValue(n)}return s}createNode(t){if(this.disposed)throw new Error(`Cannot access Atom ${t}: registry is disposed`);return t.keepAlive||this.scheduleAtomRemoval(t),new kt(this,t)}invalidateAtom=t=>{this.ensureNode(t).invalidate()};scheduleAtomRemoval(t){this.dispatcher.scheduleTask(()=>{let i=this.nodes.get(xe(t));i!==void 0&&i.canBeRemoved&&this.removeNode(i)},0)}scheduleNodeRemoval(t){this.dispatcher.scheduleTask(()=>{t.canBeRemoved&&this.removeNode(t)},0)}removeNode(t){this.atomHasTtl(t.atom)?this.setNodeTimeout(t):(this.nodes.delete(xe(t.atom)),t.remove(),this.onNodeRemoved?.(t))}setNodeTimeout(t){if(this.nodeTimeoutBucket.has(t))return;let i=t.atom.idleTTL??this.defaultIdleTTL;if(this.#e!==null&&(i-=this.#e,i<=0)){this.nodes.delete(xe(t.atom)),t.remove(),this.onNodeRemoved?.(t);return}let s=Math.ceil(i/this.timeoutResolution)*this.timeoutResolution,r=Date.now()+s,n=r-r%this.timeoutResolution+this.timeoutResolution,a=this.timeoutBuckets.get(n);a===void 0&&(a=[new Set,setTimeout(()=>this.sweepBucket(n),n-Date.now())],this.timeoutBuckets.set(n,a)),a[0].add(t),this.nodeTimeoutBucket.set(t,n)}removeNodeTimeout(t){let i=this.nodeTimeoutBucket.get(t);if(i===void 0)return;this.nodeTimeoutBucket.delete(t),this.scheduleNodeRemoval(t);let[s,r]=this.timeoutBuckets.get(i);s.delete(t),s.size===0&&(clearTimeout(r),this.timeoutBuckets.delete(i))}#e=null;sweepBucket(t){let i=this.timeoutBuckets.get(t)[0];this.timeoutBuckets.delete(t),Fe(i,this.removeIdleNode)}removeIdleNode=t=>{if(this.nodeTimeoutBucket.delete(t),!!t.canBeRemoved){this.nodes.delete(xe(t.atom)),this.onNodeRemoved?.(t),this.#e=t.atom.idleTTL??this.defaultIdleTTL;try{t.remove()}finally{this.#e=null}}};reset(){this.timeoutBuckets.forEach(([,i])=>clearTimeout(i)),this.timeoutBuckets.clear(),this.nodeTimeoutBucket.clear();let t=Array.from(this.nodes.values());this.nodes.clear();for(let i of t)i.state=S.removed;Fe(t,this.destroyNode)}destroyNode=t=>{t.remove(),this.onNodeRemoved?.(t)};dispose(){this.disposed=!0,this.reset()}},T={alive:1,initialized:2,waitingForValue:4},S={uninitialized:T.alive|T.waitingForValue,stale:T.alive|T.initialized|T.waitingForValue,valid:T.alive|T.initialized,removed:0},kt=class{constructor(t,i){this.registry=t,this.atom=i,this.writeContext=new Pt(t,this)}registry;atom;state=S.uninitialized;lifetime;writeContext;preserveInitialValueOnBuild=!1;invalidatedDuringBuild=!1;failed=!1;parents=new Set;children=new Set;listeners=new Set;observedChildren=0;currentState(){switch(this.state){case S.uninitialized:return\"uninitialized\";case S.stale:return\"stale\";case S.valid:return\"valid\";default:return\"removed\"}}get canBeRemoved(){return!this.atom.keepAlive&&this.listeners.size===0&&this.children.size===0&&this.state!==0}get building(){return this.lifetime!==void 0&&this.lifetime.reads!==void 0}get isObserved(){return!this.atom.lazy||this.listeners.size>0||this.observedChildren>0}childObserved(t){let i=this.isObserved;this.observedChildren+=t,i!==this.isObserved&&this.observedChanged(t)}observedChanged(t){for(let i of this.parents)i.childObserved(t)}_value=void 0;value(){for(;(this.state&T.waitingForValue)!==0;)this.build();return this._value}build(){this.disposeLifetime(),this.invalidatedDuringBuild=!1;let t=Kr(this);this.lifetime=t;let i,s=!1;try{i=this.atom.read(t),s=!0}finally{let r=t.reads;t.reads=void 0,this.lifetime===t&&(this.dropUnread(r),s||this.fail())}if(this.lifetime===t&&(this.state&T.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.failed=!1,this.state=S.valid):this.setValue(i)),t.failure!==E)throw t.failure}fail(){this.failed=!0;try{this.invalidateChildren()}catch{}}readTracked(t,i){let s=this.registry.ensureNode(t);this.parents.has(s)||(this.parents.add(s),s.children.add(this),this.isObserved&&s.childObserved(1));try{return s.value()}catch(r){if(i.reads===void 0||s.state!==S.valid)throw r;return i.failure===E&&(i.failure=r),s._value}finally{i.reads!==void 0&&!i.disposed&&i.reads.add(s)}}dropUnread(t){if(t.size===this.parents.size)return;let i=this.isObserved;for(let s of this.parents)t.has(s)||(this.parents.delete(s),s.children.delete(this),i&&s.childObserved(-1),s.canBeRemoved&&this.registry.scheduleNodeRemoval(s))}valueOption(){return(this.state&T.initialized)===0?v():p(this._value)}setInitialValue(t){if((this.state&T.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=S.stale,this._value=t,this.listeners.size>0&&this.announce();return}this.setValue(t)}setValue(t){let i=this.failed;this.failed=!1;let s=(this.state&T.initialized)!==0;if(this.state=S.valid,s&&this.atom.equals(this._value,t)){i&&this.invalidateChildren();return}this._value=t;let r=E;try{this.invalidateChildren()}catch(n){r=n}if(this.listeners.size>0)try{this.announce()}catch(n){r===E&&(r=n)}if(r!==E)throw r}announce(){y.phase===z.collect?y.notify.add(this):this.notify()}invalidate(){if(this.state===S.valid){this.state=S.stale;try{this.disposeLifetime()}finally{this.propagate()}}else this.building&&y.phase!==z.collect?this.build():this.propagate()}propagate(){y.phase===z.collect?(this.building&&(this.invalidatedDuringBuild=!0),y.stale.push(this)):this.isObserved?this.value():this.invalidateChildren()}invalidateChildren(){if(this.children.size===0)return;let t=E;for(let i of Array.from(this.children))if(i.affectedBy(this))try{i.invalidate()}catch(s){t===E&&(t=s)}if(t!==E)throw t}affectedBy(t){if(this.state===S.valid)return!0;let i=this.lifetime?.reads;return i!==void 0?i.has(t):this.isObserved&&t.state===S.valid}notify(){y.phase===z.commit&&y.notify.delete(this),Fe(this.listeners,Qs)}disposeLifetime(){let t=this.lifetime;t!==void 0&&(this.lifetime=void 0,t.dispose())}remove(){let t=this.isObserved;this.state=S.removed,this.listeners.clear();try{this.disposeLifetime()}finally{let i=Array.from(this.parents);this.parents.clear(),Fe(i,s=>{s.children.delete(this),t&&s.childObserved(-1),s.canBeRemoved&&this.registry.removeNode(s)})}}subscribe(t){let i=this.isObserved;return this.listeners.add(t),i||this.observedChanged(1),()=>{this.listeners.delete(t)&&!this.isObserved&&this.observedChanged(-1)}}},qr={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){return this.disposed?this.node.registry.get(e):this.node.readTracked(e,this)},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let i=this.get(e);if(t?.suspendOnWaiting&&i.waiting)return ye;switch(i._tag){case\"Initial\":return ye;case\"Failure\":return Me(i.cause);case\"Success\":return g(i.value)}},resultOnce(e,t){return te(i=>{let s=this.once(e);if(s._tag!==\"Initial\"&&!(t?.suspendOnWaiting&&s.waiting))return i(D(s));let r=this.node.registry.subscribe(e,n=>{n._tag===\"Initial\"||t?.suspendOnWaiting&&n.waiting||(r(),i(D(n)))},{immediate:!1});return b(r)})},setResult(e,t){return this.disposed?ye:(this.node.registry.set(e,t),this.resultOnce(e,{suspendOnWaiting:!0}))},some(e){if(this.disposed||this.isFn)return this.someOnce(e);let t=this.get(e);return t._tag===\"None\"?ye:g(t.value)},someOnce(e){return te(t=>{let i=this.once(e);if(j(i))return t(g(i.value));let s=this.node.registry.subscribe(e,r=>{M(r)||(s(),t(g(r.value)))},{immediate:!1});return b(s)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?v():this.node.valueOption()},refresh(e){this.disposed||this.node.registry.refresh(e)},refreshSelf(){this.disposed||this.node.invalidate()},mount(e){this.disposed||this.addFinalizer(this.node.registry.mount(e))},subscribe(e,t,i){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,i))},setSelf(e){this.disposed||this.node.setValue(e)},set(e,t){this.disposed||this.node.registry.set(e,t)},stream(e,t){return this.disposed?_s:Ft(i=>b(()=>{this.subscribe(e,s=>we(i,s),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(_t(Ze),It(i=>i._tag===\"Success\"?g(i.value):ge(i.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0,Fe(e.reverse(),Qs)}},Kr=e=>{function t(i){return t.disposed||t.isFn?e.registry.get(i):e.readTracked(i,t)}return Object.setPrototypeOf(t,qr),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t.reads=new Set,t.failure=E,t},Pt=class{constructor(t,i){this.registry=t,this.node=i}registry;node;get(t){return this.registry.get(t)}set(t,i){return this.registry.set(t,i)}setSelf(t){return this.node.setValue(t)}refreshSelf(){return this.node.invalidate()}},z={disabled:0,collect:1,commit:2},y={phase:z.disabled,depth:0,stale:[],notify:new Set};function jt(e){let t=y.phase;y.phase=z.collect,y.depth++;let i=E;try{e()}catch(s){i=s}if(y.depth===1){let{notify:s,stale:r}=y,n=0;do{for(y.phase=z.collect;n<r.length;n++)try{Qr(r[n])}catch(a){i===E&&(i=a)}y.phase=z.commit;for(let a of s)try{a.notify()}catch(o){i===E&&(i=o)}}while(n<r.length);y.stale=[],s.clear()}if(y.depth--,y.phase=t,i!==E)throw i}function Qr(e){if(e.state===S.valid){if(!e.invalidatedDuringBuild)return;e.invalidatedDuringBuild=!1,e.state=S.stale,e.disposeLifetime()}e.value()}var Or={};ct(Or,{Interrupt:()=>rt,Reset:()=>mr,SerializableTypeId:()=>ni,ServerValueTypeId:()=>at,TypeId:()=>Ie,WritableTypeId:()=>nt,autoDispose:()=>gr,batch:()=>ri,context:()=>ur,debounce:()=>pn,family:()=>an,fn:()=>pr,fnSync:()=>rn,get:()=>xn,getResult:()=>Nn,getServerValue:()=>Mn,initialValue:()=>fn,isAtom:()=>Gt,isSerializable:()=>Un,isWritable:()=>ei,keepAlive:()=>Sr,kvs:()=>bn,make:()=>Xt,makeRefreshOnSignal:()=>br,map:()=>Er,mapResult:()=>mn,modify:()=>Fn,mount:()=>Ln,optimistic:()=>gn,optimisticFn:()=>En,pull:()=>nn,readable:()=>A,refresh:()=>Cn,refreshOnWindowFocus:()=>wn,runtime:()=>lr,searchParam:()=>Rn,serializable:()=>Vn,set:()=>In,setIdleTTL:()=>or,setLazy:()=>cn,subscriptionRef:()=>sn,swr:()=>yn,toStream:()=>An,toStreamResult:()=>Tn,transform:()=>J,update:()=>_n,windowFocusSignal:()=>wr,withEquality:()=>un,withFallback:()=>on,withLabel:()=>ln,withReactivity:()=>tn,withRefresh:()=>hn,withServerValue:()=>Rr,withServerValueInitial:()=>zn,writable:()=>x});var Ys=\"~effect/reactivity/Reactivity\",ne=H(\"effect/reactivity/Reactivity\"),Yr=b(()=>{let e=new Map,t=c=>{qt(c,u=>{let l=e.get(u);l!==void 0&&l.forEach(f=>f())})},i=c=>Be(u=>{let l=Ri(u,it);return l?qt(c,f=>{l.add(f)}):t(c),he}),s=(c,u)=>ji(u,i(c)),r=(c,u)=>{let l=[];return qt(c,f=>{l.push(f);let m=e.get(f);m===void 0&&(m=new Set,e.set(f,m)),m.add(u)}),()=>{for(let f=0;f<l.length;f++){let m=e.get(l[f]);m!==void 0&&(m.delete(u),m.size===0&&e.delete(l[f]))}}},n=(c,u)=>ve(function*(){let l=yield*Yi(),f=ce(l,K),m=yield*xs(),N=ui(Ee(l),Ts(f)),B=!1,ae=!1,Ne=ot=>{ot._tag===\"Failure\"?Fs(m,ot.cause):we(m,ot.value),ae?(ae=!1,N(u).addObserver(Ne)):B=!1};function ai(){if(B){ae=!0;return}B=!0,N(u).addObserver(Ne)}let Tr=r(c,ai);return yield*de(f,b(Tr)),ai(),m}),a=(c,u)=>n(c,u).pipe(_(Ns),be),o=c=>pe(()=>{let u=new Set;return c.pipe(Xi(it,u),Zi(l=>b(()=>{u.forEach(f=>{let m=e.get(f);m!==void 0&&m.forEach(N=>N())})})))});return ne.of({[Ys]:Ys,mutation:s,query:n,stream:a,invalidateUnsafe:t,invalidate:i,registerUnsafe:r,withBatch:o})}),it=class extends H()(\"effect/reactivity/Reactivity/PendingInvalidation\"){},Js=d(2,(e,t)=>ne.use(i=>i.mutation(t,e)));var Gs=e=>ne.use(t=>t.invalidate(e)),st=Pe(ne)(Yr);function Xs(e){switch(typeof e){case\"string\":case\"number\":case\"bigint\":case\"boolean\":return String(e);default:return oe(e)}}var qt=(e,t)=>{if(Array.isArray(e)){for(let i=0;i<e.length;i++)t(Xs(e[i]));return}for(let i in e){t(i);let s=e[i];for(let r=0;r<s.length;r++)t(`${i}:${Xs(s[r])}`)}};var er=\"~effect/persistence/KeyValueStore/KeyValueStoreError\",tr=class extends _i(\"KeyValueStoreError\"){[er]=er},Kt=H(\"effect/persistence/KeyValueStore\");var ir=\"~effect/persistence/KeyValueStore/SchemaStore\",Qt=(e,t)=>{let i=Ke(t),s=ws(i),r=fs(s),n=ps(s),a=u=>L(e.get(u),zs({onUndefined:()=>me,onDefined:l=>qi(r(l))})),o=(u,l)=>L(n(l),f=>e.set(u,f)),c=(u,l)=>L(a(u),f=>{if(M(f))return me;let m=l(f.value);return Hi(o(u,m),p(m))});return{[ir]:ir,get:a,set:o,modify:c,remove:e.remove,clear:e.clear,size:e.size,has:e.has,isEmpty:e.isEmpty}};var Ie=\"~effect/reactivity/Atom\",Gt=e=>W(e,Ie),nt=\"~effect/reactivity/Atom/Writable\",or=d(2,(e,t)=>{let i=le(t),s=Ii(i);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!s,idleTTL:s?fe(i):void 0})}),I=or(0),Zt={[Ie]:Ie,equals:Object.is,...yi,toJSON(){return{_id:\"Atom\",keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},Jr={...Zt,atom(e,t){let i=ti(e,t);return A(s=>{let r=s.self(),n=s(this);return n._tag!==\"Success\"?se(n,r):i(s,n.value)})},fn(e,t){return arguments.length===0?(i,s)=>sr(this,i,s):sr(this,e,t)},pull(e,t){let i=I(X(0)),s=A(r=>{let n=r.self(),a=r(this);return a._tag!==\"Success\"?se(a,n):_e(r,yr(r,i,e,t),R(!0),a.value)});return vr(i,s)},subscriptionRef(e){return dr(I(A(t=>{let i=t.self(),s=t(this);if(s._tag!==\"Success\")return se(s,i);let r=typeof e==\"function\"?e(t):e;return ie(r)?r:_e(t,r,R(!0),s.value)})),(t,i)=>{let s=et(t(this));return fr(t,i,s)})}},sr=(e,t,i)=>{let[s,r,n]=hr(i?.reactivityKeys?(a,o)=>{let c=t(a,o);return De(c)?Js(c,i.reactivityKeys):Ls(c,Gs(i.reactivityKeys))}:t,i);return x(a=>{a.get(n);let o=a.self(),c=a.get(e);return c._tag!==\"Success\"?se(c,o):s(a,c.value)},r)},Gr={...Zt,[nt]:nt},ei=e=>nt in e,A=(e,t)=>{let i=Object.create(Zt);return i.keepAlive=!1,i.lazy=!0,i.read=e,i.refresh=t,i},x=(e,t,i)=>{let s=Object.create(Gr);return s.keepAlive=!1,s.lazy=!0,s.read=e,s.write=t,s.refresh=i,s};function Zr(e,t){e.setSelf(t)}var Xt=(e,t)=>{let i=ti(e,t);return Ie in i?i:A(i)},ti=(e,t)=>{if(typeof e==\"function\"&&!De(e)&&!xt(e)){let i=e;return function(s,r){let n=i(s);switch(typeof n){case\"function\":case\"object\":return n===null?n:cr in n?Jt(s,n,t,r):en in n?rr(s,n,t,r):n;default:return n}}}else{if(De(e))return function(i,s){return Jt(i,e,t,s)};if(xt(e))return function(i,s){return rr(i,e,t,s)}}return X(e)},cr=\"~effect/Effect\",en=\"~effect/Stream\",X=e=>x(function(t){return e},Zr),Jt=(e,t,i,s)=>{let r=i?.initialValue!==void 0?h(i.initialValue):R();return _e(e,t,r,s,i?.uninterruptible)};function _e(e,t,i,s=Ve(),r=!1){let n=e.self(),a=Pi();e.addFinalizer(()=>{Ee(s)($i(a,ki))});let o,c=!1,u=ii(s.pipe(q(K,a),q(w,e.registry),q(pt,e.registry.scheduler)),t,function(l){o=Ge(l,n),c&&e.setSelf(o)},r);return c=!0,u!==void 0&&e.addFinalizer(u),o!==void 0?o:n._tag===\"Some\"?Oe(n):V(i)}function ii(e,t,i,s=!1){if(Vi(t)){i(t);return}let n=Ee(e)(t);n.currentDispatcher?.flush();let a=n.pollUnsafe();if(a){i(a);return}let o=n.addObserver(i);function c(){o(),s||n.interruptUnsafe()}return c}function ur(e){let t=e?.memoMap??I(Xt(()=>Di())),i=a=>Gt(t)?a(t):t,s=st;function r(a){let o=Object.create(Jr);o.keepAlive=!1,o.lazy=!0,o.refresh=void 0,o.factory=r;let c=Sr(A(typeof a==\"function\"?u=>$e(a(u),s):()=>$e(a,s)));return o.layer=c,o.read=function(l){let f=l(c),m=L(We,N=>gt(f,i(l),N));return Jt(l,m,{uninterruptible:!0})},o}r.memoMap=t,r.addGlobalLayer=a=>{s=$e(s,Bi(a,st))};let n=I(Xt(a=>Be(o=>gt(st,i(a),ce(o,K))).pipe(_(ce(ne)))));return r.withReactivity=a=>o=>J(o,c=>{let u=et(c(n));return c.addFinalizer(u.registerUnsafe(a,()=>{c.refresh(o)})),c.subscribe(o,l=>c.setSelf(l)),c.once(o)},{initialValueTarget:o}),r}var lr=ur(),tn=lr.withReactivity,rr=(e,t,i,s)=>{let r=i?.initialValue!==void 0?h(i.initialValue):R();return si(e,t,r,s)};function si(e,t,i,s=Ve()){let r=e.self();s=q(s,w,e.registry);let n=Ji(o=>L(Is(t.channel,o),c=>Wi({while:Ce,body:()=>c,step(u){e.setSelf(h(xi(u),{waiting:!0}))}}))).pipe(Ki(o=>(Et(o)?ci(e.self(),G(Ae),vi({onNone:()=>e.setSelf(Vt(new ee,{previous:e.self()})),onSome:c=>e.setSelf(h(c))})):e.setSelf(Q(o,{previous:e.self()})),he))),a=ii(s.pipe(q(w,e.registry),q(pt,e.registry.scheduler)),n,Le,!1);return a!==void 0&&e.addFinalizer(a),r._tag===\"Some\"?Oe(r):V(i)}var sn=e=>dr(A(t=>{let i=typeof e==\"function\"?e(t):e;return ie(i)?i:_e(t,i,R(!0))}),fr),fr=(e,t,i=Ve())=>ie(t)?(e.addFinalizer(Nt(t).pipe(Us(s=>{for(let r=0;r<s.length;r++)e.setSelf(s[r]);return he}),ts(i))),is(i)(Ms(t))):t._tag!==\"Success\"?t:si(e,Nt(t.value),R(!0),i),dr=(e,t)=>{function i(s,r){let n=s.get(e);ie(n)?wt(Ct(n,r)):O(n)&&wt(Ct(n.value,r))}return x(s=>{let r=s(e);return ie(r)||O(r)?t(s,r):r},i)},rn=function(...e){return e.length===0?nr:nr(...e)},nr=(e,t)=>{let i=I(X([0,void 0])),s=t?.initialValue!==void 0;return x(function(r){r.isFn=!0;let[n,a]=r.get(i);return n===0?s?t.initialValue:v():s?e(a,r):p(e(a,r))},function(r,n){ri(()=>{r.set(i,[r.get(i)[0]+1,n]),r.refreshSelf()})})},mr=Symbol.for(\"effect/reactivity/atom/Atom/Reset\"),rt=Symbol.for(\"effect/reactivity/atom/Atom/Interrupt\"),pr=function(...e){return e.length===0?ar:ar(...e)},ar=(e,t)=>{let[i,s]=hr(e,t);return x(i,s)};function hr(e,t){let i=I(X([0,void 0])),s=t?.initialValue!==void 0?h(t.initialValue):R(),r=t?.concurrent?I(A(o=>{let c=new Set;return o.addFinalizer(()=>c.forEach(u=>u.interruptUnsafe())),c})):void 0;function n(o,c){let u=r?o(r):void 0;o.isFn=!0;let[l,f]=o.get(i);if(l===0)return s;if(f===rt)return Q(Ni(),{previous:o.self()});let m=e(f,o);return cr in m?(u&&(m=L(es(m,{startImmediately:!0}),B=>{u.add(B);let ae=Array.from(u);return B.addObserver(()=>u.delete(B)),_(As(ae),Ne=>Ne[0])})),_e(o,m,s,c,!1)):si(o,m,s,c)}function a(o,c){ri(()=>{c===mr?o.set(i,[0,void 0]):c===rt?o.set(i,[o.get(i)[0]+1,rt]):o.set(i,[o.get(i)[0]+1,c]),o.refreshSelf()})}return[n,a,i]}var nn=(e,t)=>{let i=I(X(0)),s=A(ti(function(r){return yr(r,i,e,t)}));return vr(i,s)},yr=(e,t,i,s)=>L(Vs(typeof i==\"function\"?i(e):i),r=>{let a=Ye().context,o=Fi(),c=Qi(r,{onFailure(l){return Et(l)?Ti(o)?g({done:!0,items:o}):Se(new ee(\"Atom.pull: no items\")):ge(l)},onSuccess(l){let f;return s?.disableAccumulation?f=l:(f=Ai(o,l),o=f),g({done:!1,items:f})}}),u=new Set;return e.addFinalizer(()=>{for(let l of u)l()}),e.once(t),e.subscribe(t,()=>{e.setSelf(Oe(e.self()));let l;l=ii(a,c,f=>{l&&u.delete(l);let m=Ge(f,e.self()),N=u.size>0;e.setSelf(N?V(m):m)}),l&&u.add(l)}),c}),vr=(e,t)=>x(t.read,function(i,s){i.set(e,i.get(e)+1)}),an=typeof WeakRef>\"u\"||typeof FinalizationRegistry>\"u\"?e=>{let t=At();return function(i){let s=Qe(t,i);if(s._tag===\"Some\")return s.value;let r=e(i);return Tt(t,i,r),r}}:e=>{let t=At(),i=new FinalizationRegistry(s=>{let r=Qe(t,s);r._tag===\"Some\"&&r.value.deref()===void 0&&Os(t,s)});return function(s){let r=Qe(t,s).pipe(Ei(a=>a.deref()));if(r._tag===\"Some\")return r.value;let n=e(s);return Tt(t,s,new WeakRef(n)),i.register(n,s),n}},on=d(2,(e,t)=>{function i(s){let r=s(e);return r._tag===\"Initial\"?V(s(t)):r}return ei(e)?x(i,function(s,r){s.set(e,r)},e.refresh??function(s){s(e)}):A(i,e.refresh??function(s){s(e)})}),Sr=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0}),gr=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!1}),cn=d(2,(e,t)=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,lazy:t})),un=d(2,(e,t)=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,equals:t})),ln=d(2,(e,t)=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,label:[t,dt()===0?\"\":new Error().stack?.split(`\n`)[5]??\"\"]})),fn=d(2,(e,t)=>[e,t]),J=d(e=>Gt(e[0]),(e,t,i)=>{let s=I(ei(e)?x(r=>t(r,e),function(r,n){r.set(e,n)},e.refresh??function(r){r(e)}):A(r=>t(r,e),e.refresh??function(r){r(e)}));return i?.initialValueTarget&&(s.initialValueTarget=dn(i.initialValueTarget)),s}),dn=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t},Er=d(2,(e,t)=>J(e,i=>t(i(e)))),mn=d(2,(e,t)=>Er(e,Te(t))),pn=d(2,(e,t)=>{let i=fe(le(t));return J(e,function(s){let r,n=s.once(e);function a(){r=void 0,s.setSelf(n)}return s.addFinalizer(function(){r&&clearTimeout(r)}),s.subscribe(e,function(o){n=o,r&&clearTimeout(r),r=setTimeout(a,i)}),n},{initialValueTarget:e})}),hn=d(2,(e,t)=>{let i=fe(le(t));return J(e,function(s){let r=setTimeout(()=>s.refresh(e),i);return s.addFinalizer(()=>clearTimeout(r)),s(e)},{initialValueTarget:e})}),yn=d(2,(e,t)=>{let i=fe(le(t.staleTime));return J(e,s=>{let r=s.once(e);if(s.subscribe(e,a=>{s.setSelf(a)}),t.revalidateOnFocus&&t.focusSignal&&(s.once(t.focusSignal),s.subscribe(t.focusSignal,t.revalidateOnFocus===\"always\"?()=>s.refresh(e):()=>{let a=s.once(e);Yt(a,i)&&s.refresh(e)})),M(s.self())&&t.revalidateOnMount===!1)return r;if(Yt(r,i)){let a=!0;s.addFinalizer(()=>{a=!1}),s.registry.schedulerAsync.makeDispatcher().scheduleTask(()=>{a&&Yt(s.once(e),i)&&s.refresh(e)},0)}return r},{initialValueTarget:e})}),vn=e=>e._tag===\"Success\"?p(e.timestamp):e._tag===\"Failure\"?k(e.previousSuccess,t=>t.timestamp):v(),Sn=(e,t,i)=>i-e<t,Yt=(e,t)=>{if(e.waiting)return!1;let i=Ue(vn(e));return i===void 0?e._tag!==\"Initial\":!Sn(i,t,Date.now())},gn=e=>{let t=0,i=I(X([t,void 0]));return x(s=>{let r=s.once(e),n=!1;s.subscribe(e,c=>{if(r=c,a.size>0)return;if(n=!1,!$(c))return s.setSelf(c);let u=Ue(s.self());switch(c._tag){case\"Initial\":{Re(u)&&s.setSelf(c);return}case\"Success\":{O(u)?!c.waiting&&c.timestamp>=u.timestamp&&s.setSelf(c):s.setSelf(c);return}case\"Failure\":return s.setSelf(c)}});let a=new Set,o=new Set;return s.subscribe(i,([,c])=>{if(a.has(c))return;a.add(c);let u;u=s.registry.subscribe(c,l=>{if(O(l)&&l.waiting)return s.setSelf(l.value);a.delete(c),u&&(o.delete(u),u()),!n&&!U(l)&&(n=!0),a.size===0&&(n?(n=!1,s.refresh(e)):s.setSelf(r))},{immediate:!0}),a.has(c)?o.add(u):u()}),s.addFinalizer(()=>{for(let c of o)c();a.clear(),o.clear()}),r},(s,r)=>s.set(i,[++t,r]),s=>s(e))},En=d(2,(e,t)=>{let i=I(X(R()));return pr((s,r)=>{let n=t.reducer(r(e),s);$(n)&&(n=V(n,{touch:!0})),r.set(i,h(n,{waiting:!0})),r.set(e,i);let a=typeof t.fn==\"function\"?gr(t.fn(o=>r.set(i,h($(o)?V(o):o,{waiting:!0})))):t.fn;return r.set(a,s),te(o=>{r.subscribe(a,c=>{c._tag===\"Initial\"||c.waiting||(r.set(i,Te(c,()=>n)),o(D(c)))},{immediate:!0})})})}),ri=jt,wr=A(e=>{let t=0;function i(){document.visibilityState===\"visible\"&&e.setSelf(++t)}return window.addEventListener(\"visibilitychange\",i),e.addFinalizer(()=>{window.removeEventListener(\"visibilitychange\",i)}),t}),br=e=>t=>J(t,i=>(i.once(e),i.subscribe(e,s=>i.refresh(t)),i.subscribe(t,s=>i.setSelf(s)),i.once(t)),{initialValueTarget:t}),wn=br(wr),bn=e=>{let t=e.runtime.fn(s=>Kt.use(r=>Qt(r,e.schema).set(e.key,s))),i=e.runtime.atom(Kt.use(s=>Qt(s,e.schema).get(e.key)));return x(e.mode===\"async\"?s=>{s.mount(t);let r=Te(C(()=>{let n=e.defaultValue();return s.set(t,n),n}));return s.subscribe(i,n=>s.setSelf(r(n))),r(s.once(i))}:s=>(s.mount(t),s.subscribe(i,r=>{if(O(r))if(j(r.value))s.setSelf(r.value.value);else{let n=C(s.self(),e.defaultValue);s.setSelf(n),s.set(t,n)}},{immediate:!0}),C(s.self(),e.defaultValue)),(s,r)=>{s.set(t,r),s.setSelf(e.mode===\"async\"?h(r):r)})},Rn=(e,t)=>{let i=t?.schema&&ds(t.schema),s=t?.schema&&hs(t.schema);return x(r=>{if(typeof window>\"u\")return i?v():\"\";let n=()=>{if(F.updating)return;let c=new URLSearchParams(window.location.search).get(e)||\"\";i?r.setSelf(ke(i(c))):c!==Ue(r.self())&&r.setSelf(c)};window.addEventListener(\"popstate\",n),window.addEventListener(\"pushstate\",n),r.addFinalizer(()=>{window.removeEventListener(\"popstate\",n),window.removeEventListener(\"pushstate\",n)});let a=new URLSearchParams(window.location.search).get(e)||\"\";return i?ke(i(a)):a},(r,n)=>{if(typeof window>\"u\"){r.setSelf(n);return}if(s){let a=G(n,o=>ke(s(o)));F.updates.set(e,C(a,()=>\"\")),n=wi(a,n)}else F.updates.set(e,n);r.setSelf(n),F.timeout&&clearTimeout(F.timeout),F.timeout=setTimeout(On,500)})},F={timeout:void 0,updates:new Map,updating:!1};function On(){F.timeout=void 0,F.updating=!0;let e=new URLSearchParams(window.location.search);for(let[i,s]of F.updates.entries())s.length>0?e.set(i,s):e.delete(i);F.updates.clear();let t=`${window.location.pathname}?${e.toString()}`;window.history.pushState({},\"\",t),F.updating=!1}var An=e=>be(w.use(t=>g(tt(t,e)))),Tn=e=>be(w.use(t=>g(Dt(t,e)))),xn=e=>w.use(t=>g(t.get(e))),Fn=d(2,(e,t)=>_(w,i=>i.modify(e,t))),In=d(2,(e,t)=>_(w,i=>i.set(e,t))),_n=d(2,(e,t)=>_(w,i=>i.update(e,t))),Nn=(e,t)=>w.use(Bt(e,t)),Cn=e=>_(w,t=>t.refresh(e)),Ln=e=>w.use(t=>Wt(t,e)),ni=\"~effect-atom/atom/Atom/Serializable\",Un=e=>ni in e,Vn=d(2,(e,t)=>{let i=Ke(t.schema);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,label:e.label??[t.key,dt()===0?\"\":new Error().stack?.split(`\n`)[5]??\"\"],[ni]:{key:t.key,encode:ys(i),decode:ms(i)}})}),at=\"~effect-atom/atom/Atom/ServerValue\",Rr=d(2,(e,t)=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,[at]:t})),zn=e=>Rr(e,oi(R(!0))),Mn=d(2,(e,t)=>at in e?e[at](i=>t.get(i)):t.get(e));var Ar=new WeakMap,xa=e=>{let t=Y.map(e,s=>s.value),i=Y.value(e);return Z.isSome(i)&&Ar.set(t,i.value.commit),t},Fa=e=>{Ar.get(e)?.()};export{Y as a,Ht as b,Or as c,xa as d,Fa as e};\n","node_modules/apps/chunk-MN25OBZU.js":"import{a as $e}from\"./chunk-WOT6VMZA.js\";var Fe={};$e(Fe,{Do:()=>eH,all:()=>Bq,andThen:()=>Fq,as:()=>TO,asVoid:()=>Pq,bind:()=>Xq,bindTo:()=>Qq,composeK:()=>Lq,contains:()=>Vq,containsWith:()=>AO,exists:()=>Zq,filter:()=>Li,filterMap:()=>Hq,firstSomeOf:()=>_q,flatMap:()=>Ni,flatMapNullishOr:()=>Uq,flatten:()=>Di,fromIterable:()=>wq,fromNullOr:()=>DS,fromNullishOr:()=>Xl,fromUndefinedOr:()=>Ns,gen:()=>tH,getFailure:()=>kq,getOrElse:()=>Yl,getOrNull:()=>Eh,getOrThrow:()=>LS,getOrThrowWith:()=>ep,getOrUndefined:()=>lo,getSuccess:()=>Cq,isNone:()=>fe,isOption:()=>Ru,isSome:()=>Oe,let:()=>Yq,lift2:()=>Gq,liftNullishOr:()=>Rq,liftPredicate:()=>Kq,liftThrowable:()=>po,makeCombinerFailFast:()=>vO,makeEquivalence:()=>Wq,makeOrder:()=>Jq,makeReducer:()=>rH,makeReducerFailFast:()=>nH,map:()=>Wt,match:()=>at,none:()=>v,orElse:()=>Aq,orElseResult:()=>Oq,orElseSome:()=>vq,partitionMap:()=>qq,product:()=>CO,productMany:()=>$q,reduceCompact:()=>zq,some:()=>O,tap:()=>wO,toArray:()=>jq,toRefinement:()=>Tq,void:()=>Mq,zipLeft:()=>Dq,zipRight:()=>Nq,zipWith:()=>kO});function rh(e){return{combine:e}}function $v(e){return rh((t,r)=>e(t,r)===-1?t:r)}function Bv(e){return rh((t,r)=>e(t,r)===1?t:r)}var K=(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 r=e;for(let n=0,o=t.length;n<o;n++)r=t[n](r);return r}}},mS={pipe(){return K(this,arguments)}},ba=(function(){function e(){}return e.prototype=mS,e})();var l=function(e,t){if(typeof e==\"function\")return function(){return e(arguments)?t.apply(this,arguments):r=>t(r,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(r,n){return arguments.length>=2?t(r,n):function(o){return t(o,r)}};case 3:return function(r,n,o){return arguments.length>=3?t(r,n,o):function(s){return t(s,r,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let r=arguments;return function(n){return t(n,...r)}}}};var A=e=>e;var Ne=e=>()=>e,mr=Ne(!0),Rl=Ne(!1),nh=Ne(null),Hr=Ne(void 0),vr=Hr;function Pl(e,...t){return K(e,t)}function zv(e,t,r,n,o,s,a,i,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return r(t(e.apply(this,arguments)))};case 4:return function(){return n(r(t(e.apply(this,arguments))))};case 5:return function(){return o(n(r(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(n(r(t(e.apply(this,arguments))))))};case 7:return function(){return a(s(o(n(r(t(e.apply(this,arguments)))))))};case 8:return function(){return i(a(s(o(n(r(t(e.apply(this,arguments))))))))};case 9:return function(){return c(i(a(s(o(n(r(t(e.apply(this,arguments)))))))))}}}function wn(e){let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),o}}function yi(e){let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),o!==r&&t.set(o,o),o}}var Ml=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(\"stack\");let r=Object.getPrototypeOf(e),n=r;for(;n!==null&&n!==Object.prototype;){let o=Reflect.ownKeys(n);for(let s=0;s<o.length;s++)t.add(o[s]);n=Object.getPrototypeOf(n)}return t.has(\"constructor\")&&typeof e.constructor==\"function\"&&r===e.constructor.prototype&&t.delete(\"constructor\"),t},mu=new WeakSet,Fl=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);var bi=0,qv=()=>{bi++};var bt={};$e(bt,{Struct:()=>Dj,Tuple:()=>Nj,and:()=>Bj,compose:()=>Uj,eqv:()=>jj,every:()=>Jj,hasProperty:()=>w,implies:()=>qj,isBigInt:()=>Ul,isBoolean:()=>Si,isDate:()=>yS,isError:()=>gS,isFunction:()=>qt,isIterable:()=>Qo,isMap:()=>Aj,isNever:()=>xS,isNotNull:()=>vj,isNotNullish:()=>Ll,isNotUndefined:()=>Or,isNull:()=>hS,isNullish:()=>Oj,isNumber:()=>Sa,isObject:()=>hr,isObjectKeyword:()=>xu,isObjectOrArray:()=>_j,isPromise:()=>Mj,isPromiseLike:()=>Fj,isPropertyKey:()=>Nl,isReadonlyObject:()=>Rj,isRegExp:()=>Hv,isSet:()=>kj,isString:()=>ir,isSymbol:()=>hu,isTagged:()=>Nt,isTruthy:()=>Cj,isTupleOf:()=>Tj,isTupleOfAtLeast:()=>wj,isUint8Array:()=>Pj,isUndefined:()=>Dl,isUnknown:()=>oh,mapInput:()=>Ij,nand:()=>Wj,nor:()=>Hj,not:()=>Lj,or:()=>$j,some:()=>Gj,xor:()=>zj});var Ij=l(2,(e,t)=>r=>e(t(r))),Tj=l(2,(e,t)=>e.length===t),wj=l(2,(e,t)=>e.length>=t);function Cj(e){return!!e}function kj(e){return e instanceof Set}function Aj(e){return e instanceof Map}function ir(e){return typeof e==\"string\"}function Sa(e){return typeof e==\"number\"}function Si(e){return typeof e==\"boolean\"}function Ul(e){return typeof e==\"bigint\"}function hu(e){return typeof e==\"symbol\"}function Nl(e){return ir(e)||Sa(e)||hu(e)}function qt(e){return typeof e==\"function\"}function Dl(e){return e===void 0}function Or(e){return e!==void 0}function hS(e){return e===null}function vj(e){return e!==null}function Oj(e){return e==null}function Ll(e){return e!=null}function xS(e){return!1}function oh(e){return!0}function _j(e){return typeof e==\"object\"&&e!==null}function hr(e){return typeof e==\"object\"&&e!==null&&!Array.isArray(e)}function Rj(e){return hr(e)}function xu(e){return typeof e==\"object\"&&e!==null||qt(e)}var w=l(2,(e,t)=>xu(e)&&t in e),Nt=l(2,(e,t)=>w(e,\"_tag\")&&e._tag===t);function gS(e){return e instanceof Error}function Pj(e){return e instanceof Uint8Array}function yS(e){return e instanceof Date}function Qo(e){return w(e,Symbol.iterator)||ir(e)}function Mj(e){return w(e,\"then\")&&\"catch\"in e&&qt(e.then)&&qt(e.catch)}function Fj(e){return w(e,\"then\")&&qt(e.then)}function Hv(e){return e instanceof RegExp}var Uj=l(2,(e,t)=>r=>e(r)&&t(r));function Nj(e){return t=>{for(let r=0;r<e.length;r++)if(e[r](t[r])===!1)return!1;return!0}}function Dj(e){let t=Object.keys(e);return r=>{for(let n of t)if(!e[n](r[n]))return!1;return!0}}function Lj(e){return t=>!e(t)}var $j=l(2,(e,t)=>r=>e(r)||t(r)),Bj=l(2,(e,t)=>r=>e(r)&&t(r)),zj=l(2,(e,t)=>r=>e(r)!==t(r)),jj=l(2,(e,t)=>r=>e(r)===t(r)),qj=l(2,(e,t)=>r=>e(r)?t(r):!0),Hj=l(2,(e,t)=>r=>!(e(r)||t(r))),Wj=l(2,(e,t)=>r=>!(e(r)&&t(r)));function Jj(e){return t=>{for(let r of e)if(!r(t))return!1;return!0}}function Gj(e){return t=>{for(let r of e)if(r(t))return!0;return!1}}var ae=\"~effect/Hash\",H=e=>{switch(typeof e){case\"number\":return Dt(e);case\"bigint\":return Me(e.toString(10));case\"string\":return Me(e);case\"function\":case\"object\":{if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?Me(\"Invalid Date\"):Me(e.toISOString());if(e instanceof RegExp)return Me(e.toString());{if(mu.has(e))return sh(e);let t=Jv.get(e);if(t!==void 0)return t;if(ES.has(e))return qv(),Me(\"[Circular]\");ES.add(e);let r=bi,n;try{ae in e?n=e[ae]():typeof e==\"function\"?n=sh(e):e instanceof DataView?n=xr(Fl(e)):Array.isArray(e)||ArrayBuffer.isView(e)?n=xr(e):e instanceof Map?n=Kj(e):e instanceof Set?n=Vj(e):n=$l(e)}finally{ES.delete(e)}return r===bi&&Jv.set(e,n),n}}}return cr(Gv(Me(String(e))))},sh=e=>(SS.has(e)||SS.set(e,cr(Math.random()*4294967296|0)),SS.get(e)),Gv=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),oe=l(2,(e,t)=>Gv(Math.imul(e,2654435761)+Math.imul(t,2246822507))),cr=e=>e&3221225471|e>>>1&1073741824;var bS=new DataView(new ArrayBuffer(8)),Dt=e=>{let t=e|0;return t===e?cr(t):(bS.setFloat64(0,e!==e?NaN:e),cr(oe(bS.getInt32(0),bS.getInt32(4))))},Me=e=>{let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return cr(t)},IS=(e,t)=>{let r=12289;for(let n of t)r^=oe(H(n),H(e[n]));return cr(r)},$l=e=>IS(e,Ml(e)),Kv=(e,t)=>r=>{let n=e;for(let o of r)n^=t(o);return cr(n)},xr=e=>{let t=6151;for(let r of e)t=oe(t,H(r));return cr(t)},Kj=Kv(Me(\"Map\"),([e,t])=>oe(H(e),H(t))),Wv=Me(\"Set\"),Vj=Kv(Wv,e=>oe(Wv,H(e))),SS=new WeakMap,Jv=new WeakMap,ES=new WeakSet;var ie=\"~effect/Equal\";function J(){return arguments.length===1?e=>Ei(e,arguments[0]):Ei(arguments[0],arguments[1])}function Ei(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let r=typeof e;return r!==typeof t?!1:r===\"number\"&&e!==e&&t!==t?!0:r!==\"object\"&&r!==\"function\"||mu.has(e)||mu.has(t)?!1:Zj(e,t)}function Zj(e,t){let r=ah.length;for(let s=r;s-- >0;)if(ah[s]===e&&TS[s]===t)return!0;if(r)return Vv(e,t);let n=Zv.get(e);n||Zv.set(e,n=new WeakMap);let o=n.get(t);return o===void 0&&n.set(t,o=Vv(e,t)),o}function Vv(e,t){ah.push(e),TS.push(t);try{return Qj(e,t)}finally{ah.pop(),TS.pop()}}var ah=[],TS=[],Zv=new WeakMap;function Qj(e,t){if(H(e)!==H(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),o=t.getTime();return n===o||Number.isNaN(n)&&Number.isNaN(o)}else if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let r=Yv(e);if(r!==Yv(t)||typeof e==\"function\"&&!r)return!1;if(r)return e[ie](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:Yj(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?Qv(Fl(e),Fl(t)):Qv(e,t)}else{if(e instanceof Map)return!(t instanceof Map)||e.size!==t.size?!1:wS(e,t,eq,tq);if(e instanceof Set)return!(t instanceof Set)||e.size!==t.size?!1:wS(e,t,H,Ei)}return Xj(e,t)}function Yj(e,t){for(let r=0;r<e.length;r++)if(!Ei(e[r],t[r]))return!1;return!0}function Qv(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function Xj(e,t){let r=Ml(e),n=Ml(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o)||!Ei(e[o],t[o]))return!1;return!0}function wS(e,t,r,n){let o=new Map;for(let s of t){let a=r(s),i=o.get(a);i?i.push(s):o.set(a,[s])}e:for(let s of e){let a=o.get(r(s));if(a){for(let i=0;i<a.length;i++)if(n(s,a[i])){a[i]=a[a.length-1],a.pop();continue e}}return!1}return!0}var eq=e=>H(e[0]),tq=(e,t)=>Ei(e[0],t[0])&&Ei(e[1],t[1]),rq=()=>0;function ih(e,t){return Bl((r,n)=>e(r[0],n[0])&&t(r[1],n[1]))}function Bl(e){return function(r,n){return wS(r,n,rq,e)}}var Yv=e=>w(e,ie),CS=()=>J;var Xv=e=>(mu.add(e),e);function zl(e,t,r){return{combine:e,initialValue:t,combineAll:r??(n=>{let o=t;for(let s of n)o=e(o,s);return o})}}var Lt=e=>(t,r)=>t===r||e(t,r),nq=(e,t)=>e===t,Os=()=>nq;function eO(e){return Lt((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e[n](t[n],r[n]))return!1;return!0})}function gu(e){return Lt((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],r[n]))return!1;return!0})}var yu=e=>l(3,(t,r,n)=>e(t,o=>({...o,[r]:n(o)}))),bu=e=>l(2,(t,r)=>e(t,n=>({[r]:n}))),Su=(e,t)=>l(3,(r,n,o)=>t(r,s=>e(o(s),a=>({...s,[n]:a}))));var Ii=Symbol.for(\"~effect/Redactable\"),oq=e=>w(e,Ii);function zn(e){return oq(e)?vS(e):e}function vS(e){return e[Ii](globalThis[Eu]?.context??sq)}var Eu=\"~effect/Fiber/currentFiber\",tO=new Map,sq={\"~effect/Context\":{},base:tO,depth:0,mapUnsafe:tO,pipe(){return K(this,arguments)}};function L(e,t){let r=t?.space??0,n=new WeakSet,o=r?typeof r==\"number\"?\" \".repeat(r):r:\"\",s=f=>o.repeat(f),a=(f,p)=>{let d=f?.constructor;return d&&d!==Object.prototype.constructor&&d.name?`${d.name}(${p})`:p},i=f=>{try{return Reflect.ownKeys(f)}catch{return[\"[ownKeys threw]\"]}};function c(f,p=0){try{return u(f,p)}catch{return(typeof f==\"object\"&&f!==null||typeof f==\"function\")&&n.delete(f),\"[inspection threw]\"}}function u(f,p=0){if(typeof f==\"string\")return JSON.stringify(f);if(typeof f==\"number\"||f==null||typeof f==\"boolean\"||typeof f==\"symbol\")return String(f);if(typeof f==\"bigint\")return String(f)+\"n\";if(typeof f==\"object\"||typeof f==\"function\"){if(n.has(f))return aq;n.add(f);let d;if(Ii in f)d=c(vS(f),p);else if(Array.isArray(f))d=!o||f.length<=1?`[${f.map(m=>c(m,p)).join(\",\")}]`:`[\n${s(p+1)}${f.map(m=>c(m,p+1)).join(`,\n`+s(p+1))}\n${s(p)}]`;else if(f instanceof Date)d=OS(f);else if(!t?.ignoreToString&&w(f,\"toString\")&&typeof f.toString==\"function\"&&f.toString!==Object.prototype.toString&&f.toString!==Array.prototype.toString){let m=iq(f);d=f instanceof Error&&f.cause!==void 0?`${m} (cause: ${c(f.cause,p)})`:m}else if(Symbol.iterator in f)d=`${f.constructor.name}(${c(Array.from(f),p)})`;else{let m=i(f);if(!o||m.length<=1){let x=`{${m.map(g=>`${Yo(g)}:${c(nO(f,g),p)}`).join(\",\")}}`;d=a(f,x)}else{let x=`{\n${m.map(g=>`${s(p+1)}${Yo(g)}: ${c(nO(f,g),p+1)}`).join(`,\n`)}\n${s(p)}}`;d=a(f,x)}}return n.delete(f),d}return String(f)}return c(e,0)}var aq=\"[Circular]\";function Yo(e){return typeof e==\"string\"?JSON.stringify(e):String(e)}function ch(e){return e.map(t=>`[${Yo(t)}]`).join(\"\")}function OS(e){try{return e.toISOString()}catch{return\"Invalid Date\"}}function iq(e){try{let t=e.toString();return typeof t==\"string\"?t:String(t)}catch{return\"[toString threw]\"}}function nO(e,t){try{return e[t]}catch{return\"[property access threw]\"}}function _s(e,t){let r=[];return JSON.stringify(e,function(n,o){let s=Object.getOwnPropertyDescriptor(this,n)?.value,a=w(s,Ii)?zn(s):zn(o);if(typeof a==\"bigint\")return L(a);if(typeof a!=\"object\"||a===null)return a;let i=a instanceof Error&&!w(a,\"toJSON\")?{...a,name:a.name,message:a.message}:a;for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(!r.includes(a))return r.push(a),i!==a&&r.push(i),i},t?.space)??\"null\"}var Ee=Symbol.for(\"nodejs.util.inspect.custom\"),$t=e=>{try{return e=zn(e),w(e,\"toJSON\")&&qt(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map($t):e}catch{return\"[toJSON threw]\"}},aO=(e,t=2)=>{if(typeof e==\"string\")return e;try{return typeof e==\"object\"?_s(e,{space:t}):L(e,{space:t})}catch{return String(e)}},Iu={toJSON(){return $t(this)},[Ee](){return this.toJSON()},toString(){return L(this.toJSON())}},sO=class{[Ee](){return this.toJSON()}toString(){return L(this.toJSON())}};var cq=()=>{let e=Object.getOwnPropertyDescriptor(Error,\"stackTraceLimit\");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,\"writable\")?e.writable===!0:e.set!==void 0},uq=cq(),jn=()=>Error.stackTraceLimit,_r=e=>{uq&&(Error.stackTraceLimit=e)};var Ea=class{constructor(t){this.value=t,this.done=!1}next(t){return this.done?(this.value=t,this):(this.done=!0,{value:this.value,done:!1})}},fq=()=>{let e=\"~effect/Utils/internal\",t={[e]:o=>o()},r={[e]:o=>o()};return jn()!==0&&t[e](()=>new Error().stack)?.includes(e)===!0?t[e]:r[e]},Ia=fq();function N(e,t,r){t===\"__proto__\"?Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}):e[t]=r}function fh(e,t){for(let r of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,r)&&N(e,r,t[r])}var es=\"~effect/Effect\",Ti=\"~effect/Exit\",pq={_A:A,_E:A,_R:A},_S=`${es}/identifier`,de=`${es}/args`,pt=`${es}/evaluate`,Ht=`${es}/successCont`,Cn=`${es}/failureCont`,wi=`${es}/ensureCont`,Ai=Symbol.for(\"effect/Effect/Yield\"),Et={pipe(){return K(this,arguments)},toJSON(){return{...this}},toString(){return L(this.toJSON(),{ignoreToString:!0,space:2})},[Ee](){return this.toJSON()}},cO={[ae](){return IS(this,Object.keys(this))},[ie](e){let t=Object.keys(this),r=Object.keys(e);if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==r[n]||!J(this[t[n]],e[t[n]]))return!1;return!0}},dq={[es]:pq,...Et,[Symbol.iterator](){return new Ea(this)},toJSON(){return{_id:\"Effect\",op:this[_S],...de in this?{args:this[de]}:void 0}}},ue=e=>w(e,es),RS=e=>w(e,Ti),jl=\"~effect/Cause\",Tu=\"~effect/Cause/Reason\",Cu=e=>w(e,jl),uO=e=>w(e,Tu),Xo=class{constructor(t){this[jl]=jl,this.reasons=t}pipe(){return K(this,arguments)}toJSON(){return{_id:\"Cause\",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${L(this.reasons)})`}[Ee](){return this.toJSON()}[ie](t){return Cu(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((r,n)=>J(r,t.reasons[n]))}[ae](){return xr(this.reasons)}},iO=new WeakMap,wu=class{[Tu];annotations;_tag;constructor(t,r,n){if(this[Tu]=Tu,this._tag=t,r!==Wl&&typeof n==\"object\"&&n!==null&&r.size>0){let o=iO.get(n);o&&(r=new Map([...o,...r])),iO.set(n,r)}this.annotations=r}annotate(t,r){if(t.mapUnsafe.size===0)return this;let n=new Map(this.annotations);t.mapUnsafe.forEach((s,a)=>{r?.overwrite!==!0&&n.has(a)||n.set(a,s)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=n,o}pipe(){return K(this,arguments)}toString(){return L(this)}[Ee](){return this.toString()}},Wl=new Map,Ci=class extends wu{constructor(t,r=Wl){super(\"Fail\",r,t),this.error=t}toString(){return`Fail(${L(this.error)})`}toJSON(){return{_tag:\"Fail\",error:this.error}}[ie](t){return Ps(t)&&J(this.error,t.error)&&J(this.annotations,t.annotations)}[ae](){return oe(Me(this._tag))(oe(H(this.error))(H(this.annotations)))}},Rs=e=>new Xo(e),mq=(e,t)=>{let r=new Map,n=[];for(let o of e.concat(t)){let s=H(o),a=r.get(s);if(a===void 0)r.set(s,[o]);else{if(a.some(i=>J(i,o)))continue;a.push(o)}n.push(o)}return n},vi=l(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let r=new Xo(mq(e.reasons,t.reasons));return J(e,r)?e:r}),lh=new Xo([]),Oi=e=>new Xo([new Ci(e)]),ql=class extends wu{constructor(t,r=Wl){super(\"Die\",r,t),this.defect=t}toString(){return`Die(${L(this.defect)})`}toJSON(){return{_tag:\"Die\",defect:this.defect}}[ie](t){return _i(t)&&J(this.defect,t.defect)&&J(this.annotations,t.annotations)}[ae](){return oe(Me(this._tag))(oe(H(this.defect))(H(this.annotations)))}},PS=e=>new Xo([new ql(e)]),ku=l(e=>Cu(e[0]),(e,t,r)=>t.mapUnsafe.size===0?e:new Xo(e.reasons.map(n=>n.annotate(t,r)))),Ps=e=>e._tag===\"Fail\",_i=e=>e._tag===\"Die\",Ri=e=>e._tag===\"Interrupt\";function hq(e){return Rr(\"Effect.evaluate: Not implemented\")}var kn=e=>({...dq,[_S]:e.op,[pt]:e[pt]??hq,[Ht]:e[Ht],[Cn]:e[Cn],[wi]:e[wi]}),ts=e=>{let t=kn(e),r=function(n){this[de]=n};return r.prototype=t,function(n){return new r(n)}},fO=e=>{let t={[Ti]:Ti,_tag:e.op,get[e.prop](){return this[de]},...kn(e),toString(){return`${e.op}(${L(this[de])})`},toJSON(){return{_id:\"Exit\",_tag:e.op,[e.prop]:this[de]}},[ie](n){return RS(n)&&n._tag===this._tag&&J(this[de],n[de])},[ae](){return oe(Me(e.op),H(this[de]))}},r=function(n){this[de]=n};return r.prototype=t,function(n){return new r(n)}},Ae=fO({op:\"Success\",prop:\"value\",[pt](e){let t=e.getCont(Ht);return t?t[Ht](this[de],e,this):e.yieldWith(this)}}),ph={key:\"effect/Cause/StackTrace\"},MS={key:\"effect/Cause/InterruptorStackTrace\"},ur=fO({op:\"Failure\",prop:\"cause\",[pt](e){let t=this[de],r=!1;e.cache.stackFrame&&(t=ku(t,{mapUnsafe:new Map([[ph.key,e.cache.stackFrame]])}),r=!0);let n=e.getCont(Cn),o=e._interruptedCause;if(o&&e.interruptible){let s=!1;for(;n&&e.interruptible;)s||=_S in n,n=e.getCont(Cn);s&&(t=Rs(t.reasons.filter(a=>a._tag!==\"Fail\"))),t=vi(t,o),r=!0}return n?n[Cn](t,e,r?void 0:this):e.yieldWith(r?ur(t):this)}}),en=e=>ur(Oi(e)),Rr=e=>ur(PS(e)),re=ts({op:\"WithFiber\",[pt](e){return this[de](e)}}),lO=ts({op:\"WithFiberSucceed\",[pt](e){let t=this[de](e),r=e.getCont(Ht);return r?r[Ht](t,e):e.yieldWith(Ae(t))}}),xq=(function(){class e extends globalThis.Error{}let t=kn({op:\"YieldableError\",[pt](){return en(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),Jl=(function(){let e=Symbol.for(\"effect/Data/Error/plainArgs\");return class extends xq{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0),r&&(fh(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),Ms=e=>{class t extends Jl{_tag=e}return t.prototype.name=e,t},Hl=\"~effect/Cause/NoSuchElementError\",dh=e=>w(e,Hl),uo=class extends Ms(\"NoSuchElementError\"){[Hl]=Hl;constructor(t){super({message:t})}},ki=\"~effect/Cause/Done\",Gl=e=>w(e,ki),pO={[ki]:ki,_tag:\"Done\",value:void 0},Pi=e=>e===void 0?pO:{[ki]:ki,_tag:\"Done\",value:e},gq=en(pO),dO=e=>e===void 0?gq:en(Pi(e));var mO=\"~effect/Option\",hO={[mO]:{_A:e=>e},...Et,[Symbol.iterator](){return new Ea(this)}},yq=Object.defineProperty(Object.assign(Object.create(hO),{_tag:\"Some\",_op:\"Some\",[ie](e){return mh(e)&&FS(e)&&J(this.value,e.value)},[ae](){return oe(H(this._tag))(H(this.value))},toString(){return`some(${L(this.value)})`},toJSON(){return{_id:\"Option\",_tag:this._tag,value:$t(this.value)}}}),\"valueOrUndefined\",{get(){return this.value}}),bq=H(\"None\"),Sq=Object.assign(Object.create(hO),{_tag:\"None\",_op:\"None\",valueOrUndefined:void 0,[ie](e){return mh(e)&&Ta(e)},[ae](){return bq},toString(){return\"none()\"},toJSON(){return{_id:\"Option\",_tag:this._tag}}}),mh=e=>w(e,mO),Ta=e=>e._tag===\"None\",FS=e=>e._tag===\"Some\",Mi=Object.create(Sq),xO=function(e){this.value=e};xO.prototype=yq;var Fs=e=>new xO(e);var gO=\"~effect/Result\",yO={[gO]:{_A:e=>e,_E:e=>e},...Et,[Symbol.iterator](){return new Ea(this)}},Eq=Object.assign(Object.create(yO),{_tag:\"Success\",_op:\"Success\",[ie](e){return hh(e)&&vu(e)&&J(this.success,e.success)},[ae](){return oe(H(this._tag))(H(this.success))},toString(){return`success(${L(this.success)})`},toJSON(){return{_id:\"Result\",_tag:this._tag,value:$t(this.success)}}}),Iq=Object.assign(Object.create(yO),{_tag:\"Failure\",_op:\"Failure\",[ie](e){return hh(e)&&Au(e)&&J(this.failure,e.failure)},[ae](){return oe(H(this._tag))(H(this.failure))},toString(){return`failure(${L(this.failure)})`},toJSON(){return{_id:\"Result\",_tag:this._tag,failure:$t(this.failure)}}}),hh=e=>w(e,gO),Au=e=>e._tag===\"Failure\",vu=e=>e._tag===\"Success\",bO=function(e){this.failure=e};bO.prototype=Iq;var Kl=e=>new bO(e),SO=function(e){this.success=e};SO.prototype=Eq;var Vl=e=>new SO(e),xh=e=>vu(e)?Mi:Fs(e.failure),gh=e=>Au(e)?Mi:Fs(e.success),EO=l(2,(e,t)=>Ta(e)?Kl(t()):Vl(e.value));function rs(e){return(t,r)=>t===r?0:e(t,r)}var yh=rs((e,t)=>e<t?-1:1),Wr=rs((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);var Ou=rs((e,t)=>e<t?-1:1);var NS=l(2,(e,t)=>rs((r,n)=>e(t(r),t(n)))),_u=NS(Wr,e=>e.getTime());var wa=e=>l(2,(t,r)=>e(t,r)===-1),ns=e=>l(2,(t,r)=>e(t,r)===1),Fi=e=>l(2,(t,r)=>e(t,r)!==1),Ui=e=>l(2,(t,r)=>e(t,r)!==-1),Zl=e=>l(2,(t,r)=>t===r||e(t,r)<1?t:r),Ql=e=>l(2,(t,r)=>t===r||e(t,r)>-1?t:r),bh=e=>l(2,(t,r)=>Zl(e)(r.maximum,Ql(e)(r.minimum,t))),Sh=e=>l(2,(t,r)=>!wa(e)(t,r.minimum)&&!ns(e)(t,r.maximum));var v=()=>Mi,O=Fs,Ru=mh,fe=Ta,Oe=FS,at=l(2,(e,{onNone:t,onSome:r})=>fe(e)?t():r(e.value)),Tq=e=>t=>Oe(e(t)),wq=e=>{for(let t of e)return O(t);return v()},Cq=gh,kq=xh,Yl=l(2,(e,t)=>fe(e)?t():e.value),Aq=l(2,(e,t)=>fe(e)?t():e),vq=l(2,(e,t)=>fe(e)?O(t()):e),Oq=l(2,(e,t)=>fe(e)?Wt(t(),Vl):Wt(e,Kl)),_q=e=>{let t=v();for(t of e)if(Oe(t))return t;return t},Xl=e=>e==null?v():O(e),Ns=e=>e===void 0?v():O(e),DS=e=>e===null?v():O(e),Rq=e=>(...t)=>Xl(e(...t)),Eh=Yl(nh),lo=Yl(Hr),po=e=>(...t)=>{try{return O(e(...t))}catch{return v()}},ep=l(2,(e,t)=>{if(Oe(e))return e.value;throw t()}),LS=ep(()=>new Error(\"getOrThrow called on a None\")),Wt=l(2,(e,t)=>fe(e)?v():O(t(e.value))),TO=l(2,(e,t)=>Wt(e,()=>t)),Pq=TO(void 0),Mq=O(void 0);var Ni=l(2,(e,t)=>fe(e)?v():t(e.value)),Fq=l(2,(e,t)=>Ni(e,r=>{let n=qt(t)?t(r):t;return Ru(n)?n:O(n)})),Uq=l(2,(e,t)=>fe(e)?v():Xl(t(e.value))),Di=Ni(A),Nq=l(2,(e,t)=>Ni(e,()=>t)),Dq=l(2,(e,t)=>wO(e,()=>t)),Lq=l(2,(e,t)=>r=>Ni(e(r),t)),wO=l(2,(e,t)=>Ni(e,r=>Wt(t(r),()=>r))),CO=l(2,(e,t)=>Oe(e)&&Oe(t)?O([e.value,t.value]):v()),$q=l(2,(e,t)=>{if(fe(e))return v();let r=[e.value];for(let n of t){if(fe(n))return v();r.push(n.value)}return O(r)}),Bq=e=>{if(Symbol.iterator in e){let r=[];for(let n of e){if(fe(n))return v();r.push(n.value)}return O(r)}let t={};for(let r of Object.keys(e)){let n=e[r];if(fe(n))return v();N(t,r,n.value)}return O(t)},kO=l(3,(e,t,r)=>Wt(CO(e,t),([n,o])=>r(n,o))),zq=l(3,(e,t,r)=>{let n=t;for(let o of e)Oe(o)&&(n=r(n,o.value));return n}),jq=e=>fe(e)?[]:[e.value],qq=l(2,(e,t)=>{if(fe(e))return[v(),v()];let r=t(e.value);return Au(r)?[v(),O(r.failure)]:[O(r.success),v()]}),Hq=l(2,(e,t)=>{if(fe(e))return v();let r=t(e.value);return vu(r)?O(r.success):v()}),Li=l(2,(e,t)=>fe(e)?v():t(e.value)?O(e.value):v()),Wq=e=>Lt((t,r)=>fe(t)?fe(r):fe(r)?!1:e(t.value,r.value)),Jq=e=>rs((t,r)=>Oe(t)?Oe(r)?e(t.value,r.value):1:-1),Gq=e=>l(2,(t,r)=>kO(t,r,e)),Kq=l(2,(e,t)=>t(e)?O(e):v()),AO=e=>l(2,(t,r)=>fe(t)?!1:e(t.value,r)),Vq=AO(CS()),Zq=l(2,(e,t)=>fe(e)?!1:t(e.value)),Qq=bu(Wt),Yq=yu(Wt);var Xq=Su(Wt,Ni),eH=O({}),tH=(...e)=>{let r=(e.length===1?e[0]:e[1].bind(e[0]))(),n=r.next();for(;!n.done;){let o=n.value;if(fe(o))return o;n=r.next(o.value)}return O(n.value)};function rH(e){return zl((t,r)=>fe(t)?r:fe(r)?t:O(e.combine(t.value,r.value)),v())}function vO(e){return rh((t,r)=>fe(t)||fe(r)?v():O(e.combine(t.value,r.value)))}function nH(e){let t=vO(e).combine,r=O(e.initialValue);return zl(t,r,n=>{let o=r;for(let s of n)if(o=t(o,s),fe(o))return o;return o})}var rt={};$e(rt,{Do:()=>r6,Transaction:()=>Sf,TypeId:()=>K3,abortSignal:()=>bK,acquireDisposable:()=>cK,acquireRelease:()=>ea,acquireUseRelease:()=>cU,addFinalizer:()=>uK,all:()=>ig,andThen:()=>Dr,annotateCurrentSpan:()=>_K,annotateLogs:()=>tV,annotateLogsScoped:()=>rV,annotateSpans:()=>OK,as:()=>Vt,asSome:()=>fg,asVoid:()=>qa,awaitAllChildren:()=>HK,bind:()=>s6,bindTo:()=>n6,cached:()=>mK,cachedInvalidateWithTTL:()=>xK,cachedWithTTL:()=>hK,callback:()=>If,catch:()=>wf,catchCause:()=>_t,catchCauseFilter:()=>w6,catchCauseIf:()=>T6,catchDefect:()=>id,catchEager:()=>vf,catchFilter:()=>E6,catchIf:()=>S6,catchNoSuchElement:()=>I6,catchReason:()=>g6,catchReasons:()=>y6,catchTag:()=>h6,catchTags:()=>x6,clockWith:()=>Ec,context:()=>Xs,contextWith:()=>cd,currentParentSpan:()=>PK,currentSpan:()=>RK,delay:()=>z0,die:()=>Tr,effectify:()=>dV,ensuring:()=>yc,eventually:()=>O6,exit:()=>to,fail:()=>M,failCause:()=>Ct,failCauseSync:()=>Ys,failSync:()=>ug,fiber:()=>WK,fiberId:()=>JK,filter:()=>q0,filterMap:()=>W6,filterMapEffect:()=>H0,filterMapOrElse:()=>G6,filterMapOrFail:()=>V6,filterOrElse:()=>J6,filterOrFail:()=>K6,findFirst:()=>Y3,findFirstFilter:()=>X3,firstSuccessOf:()=>L6,flatMap:()=>T,flatMapEager:()=>ut,flatten:()=>ad,flip:()=>d6,fn:()=>GK,fnUntraced:()=>we,fnUntracedEager:()=>aT,forEach:()=>za,forever:()=>nr,forkChild:()=>kf,forkDetach:()=>qK,forkIn:()=>Zt,forkScoped:()=>Af,fromNullishOr:()=>f6,fromOption:()=>c6,fromResult:()=>sd,gen:()=>Zr,head:()=>e6,ignore:()=>M6,ignoreCause:()=>F6,interrupt:()=>un,interruptible:()=>gK,interruptibleMask:()=>yK,isEffect:()=>ps,isFailure:()=>eK,isSuccess:()=>tK,let:()=>o6,linkSpans:()=>UK,log:()=>KK,logDebug:()=>YK,logError:()=>sT,logFatal:()=>VK,logInfo:()=>QK,logTrace:()=>XK,logWarning:()=>ZK,logWithLevel:()=>mg,makeSpan:()=>Y0,makeSpanScoped:()=>NK,map:()=>q,mapBoth:()=>C6,mapBothEager:()=>lr,mapEager:()=>Un,mapError:()=>$0,mapErrorEager:()=>fd,match:()=>W0,matchCause:()=>Q6,matchCauseEager:()=>Y6,matchCauseEffect:()=>xc,matchCauseEffectEager:()=>X6,matchEager:()=>Z6,matchEffect:()=>J0,never:()=>hc,onError:()=>Ao,onErrorFilter:()=>lK,onErrorIf:()=>fK,onExit:()=>Fn,onExitFilter:()=>dK,onExitIf:()=>pK,onExitPrimitive:()=>Z0,onInterrupt:()=>Q0,option:()=>p6,orDie:()=>B0,orElseSucceed:()=>D6,partition:()=>V3,promise:()=>cg,provide:()=>rK,provideContext:()=>cn,provideService:()=>ds,provideServiceEffect:()=>iK,race:()=>H6,raceAll:()=>j0,raceAllFirst:()=>q6,raceFirst:()=>Cf,reduce:()=>Z3,repeat:()=>SK,repeatOrElse:()=>EK,replicate:()=>IK,replicateEffect:()=>TK,request:()=>zK,requestUnsafe:()=>jK,result:()=>l6,retry:()=>_6,retryOrElse:()=>R6,runCallback:()=>eT,runCallbackWith:()=>X0,runFork:()=>hs,runForkWith:()=>Lr,runPromise:()=>bc,runPromiseExit:()=>Sc,runPromiseExitWith:()=>tT,runPromiseWith:()=>ud,runSync:()=>rT,runSyncExit:()=>ro,runSyncExitWith:()=>oT,runSyncWith:()=>nT,sandbox:()=>P6,satisfiesErrorType:()=>hV,satisfiesServicesType:()=>xV,satisfiesSuccessType:()=>mV,schedule:()=>wK,scheduleFrom:()=>uU,scope:()=>gc,scoped:()=>dg,scopedWith:()=>V0,service:()=>G0,serviceOption:()=>K0,setContext:()=>nK,sleep:()=>Ha,spanAnnotations:()=>MK,spanLinks:()=>FK,succeed:()=>b,succeedNone:()=>ja,succeedSome:()=>D0,suspend:()=>$,sync:()=>j,tap:()=>Cr,tapCause:()=>aU,tapCauseFilter:()=>v6,tapCauseIf:()=>A6,tapDefect:()=>iU,tapError:()=>lg,tapErrorTag:()=>k6,timed:()=>j6,timeout:()=>$6,timeoutOption:()=>B6,timeoutOrElse:()=>z6,tracer:()=>CK,track:()=>oV,trackDefects:()=>iV,trackDuration:()=>cV,trackErrors:()=>aV,trackSuccesses:()=>sV,transposeOption:()=>u6,try:()=>Tf,tryPromise:()=>Ef,tx:()=>uV,txRetry:()=>pV,undefined:()=>t6,uninterruptible:()=>ta,uninterruptibleMask:()=>ms,unwrapReason:()=>b6,updateContext:()=>oK,updateService:()=>sK,updateServiceScoped:()=>aK,useSpan:()=>DK,validate:()=>Q3,void:()=>te,when:()=>pg,whileLoop:()=>Mn,withErrorReporting:()=>N6,withExecutionPlan:()=>U6,withFiber:()=>wr,withFiberSucceed:()=>i6,withLogSpan:()=>nV,withLogger:()=>eV,withParentSpan:()=>BK,withSpan:()=>LK,withSpanScoped:()=>$K,withTracer:()=>kK,withTracerEnabled:()=>AK,withTracerTiming:()=>vK,yieldNow:()=>od,yieldNowWith:()=>a6,zip:()=>L0,zipWith:()=>m6});var dt={};$e(dt,{Reference:()=>Se,Service:()=>fr,ServiceTypeId:()=>Th,add:()=>Bt,addOrOmit:()=>fH,addUnsafe:()=>MO,empty:()=>Xt,get:()=>Ie,getOption:()=>np,getOrElse:()=>lH,getOrUndefined:()=>rp,getOrUndefinedUnsafe:()=>Mu,getUnsafe:()=>qn,hasSameCache:()=>HS,isContext:()=>Pu,isKey:()=>cH,isReference:()=>Ch,make:()=>os,makeUnsafe:()=>mo,merge:()=>Fu,mergeAll:()=>JS,omit:()=>FO,pick:()=>dH});var Ih=e=>kn({op:e.label,[pt]:e.evaluate});var Th=\"~effect/Context/Service\",fr=function(){function e(){}let t=e;Object.setPrototypeOf(t,oH);let r=(n,o)=>(t.key=n,o?.defaultValue&&(t[zS]=zS,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&OO.add(n),t);return arguments.length>0?r(arguments[0],arguments[1]):r},oH={[Th]:Th,...Ih({label:\"Service\",evaluate(e){return Ae(Ie(e.context,this))}}),toJSON(){return{_id:\"Service\",key:this.key}},of(e){return e},context(e){return os(this,e)},use(e){return re(t=>e(Ie(t.context,this)))},useSync(e){return re(t=>Ae(e(Ie(t.context,this))))}},OO=new Set,zS=\"~effect/Context/Reference\",_O=\"~effect/Context\",sH=8,aH=8,jS=(e,t,r,n)=>{let o=Object.create(iH);return o.cacheRoot=e??o,o.base=t,o.overlay=r,o.depth=n,o._flat=void 0,o.baseHits=0,o},RO=(e,t)=>{t&&(RO(e,t.parent),e.set(t.key,t.value))},PO=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return RO(t,e.overlay),e._flat=t},qS=(e,t)=>{let r=new Map(e.mapUnsafe);return t(r),mo(r)},tp=Symbol(),wh=(e,t)=>{let r=e;for(let o=r.overlay;o;o=o.parent)if(o.key===t)return o.value;let n=r.base.get(t);return n===void 0&&!r.base.has(t)?tp:(r.overlay&&++r.baseHits>=r.base.size&&r.baseHits>=aH&&(r.base=PO(r),r.overlay=void 0,r.depth=0),n)},mo=e=>jS(void 0,e,void 0,0),iH={get mapUnsafe(){return PO(this)},...Et,[_O]:{_Services:e=>e},toJSON(){return{_id:\"Context\",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[ie](e){if(!Pu(e))return!1;let t=this.mapUnsafe,r=e.mapUnsafe;if(t.size!==r.size)return!1;for(let[n,o]of t)if(!r.has(n)||!J(o,r.get(n)))return!1;return!0},[ae](){return Dt(this.mapUnsafe.size)}},HS=(e,t)=>e.cacheRoot===t.cacheRoot,Pu=e=>w(e,_O),cH=e=>w(e,Th),Ch=e=>!!e[zS],Xt=()=>uH,uH=mo(new Map),os=(e,t)=>mo(new Map([[e.key,t]])),Bt=l(3,(e,t,r)=>MO(e,t.key,r)),MO=(e,t,r)=>{let n=e,o=OO.has(t)?void 0:n.cacheRoot;if(n.depth>=sH){let s=new Map(n.mapUnsafe);return s.set(t,r),jS(o,s,void 0,0)}return jS(o,n.base,{key:t,value:r,parent:n.overlay},n.depth+1)},fH=l(3,(e,t,r)=>r._tag===\"None\"?FO(t)(e):Bt(e,t,r.value)),lH=l(3,(e,t,r)=>{let n=wh(e,t.key);return n!==tp?n:Ch(t)?WS(t):r()}),rp=l(2,(e,t)=>Mu(e,t.key)),Mu=(e,t)=>{let r=wh(e,t);return r===tp?void 0:r},qn=l(2,(e,t)=>{let r=wh(e,t.key);if(r===tp){if(Ch(t))return WS(t);throw pH(t)}return r}),Ie=qn,BS=\"~effect/Context/defaultValue\",WS=e=>BS in e?e[BS]:e[BS]=e.defaultValue(),pH=e=>{let t=new Error(`Service not found${e.key?`: ${String(e.key)}`:\"\"}`);if(t.stack){let r=t.stack.split(`\n`);r.splice(1,3),t.stack=r.join(`\n`)}return t},np=l(2,(e,t)=>{let r=wh(e,t.key);return r!==tp?O(r):Ch(t)?O(WS(t)):v()}),Fu=l(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:qS(e,r=>t.mapUnsafe.forEach((n,o)=>r.set(o,n)))),JS=(...e)=>{let t=new Map;for(let r=0;r<e.length;r++)e[r].mapUnsafe.forEach((n,o)=>{t.set(o,n)});return mo(t)},dH=(...e)=>t=>{let r=new Set(e.map(n=>n.key));return qS(t,n=>n.forEach((o,s)=>{r.has(s)||n.delete(s)}))},FO=(...e)=>t=>qS(t,r=>{for(let n=0;n<e.length;n++)r.delete(e[n].key)}),Se=fr;var vn={};$e(vn,{CombinerMax:()=>DH,CombinerMin:()=>LH,Equivalence:()=>KO,Order:()=>ho,ReducerSum:()=>NH,abs:()=>qO,between:()=>vH,clamp:()=>OH,days:()=>JO,divide:()=>_H,divideUnsafe:()=>RH,equals:()=>VO,format:()=>Fh,fromInput:()=>sp,fromInputUnsafe:()=>ge,hours:()=>WO,infinity:()=>er,isDuration:()=>Rh,isFinite:()=>Ds,isGreaterThan:()=>FH,isGreaterThanOrEqualTo:()=>UH,isLessThan:()=>MH,isLessThanOrEqualTo:()=>YS,isNegative:()=>jO,isPositive:()=>SH,isZero:()=>$i,match:()=>ss,matchPair:()=>ip,max:()=>ZS,micros:()=>IH,millis:()=>Jt,min:()=>VS,minutes:()=>HO,nanos:()=>An,negate:()=>EH,negativeInfinity:()=>Pr,parts:()=>ZO,seconds:()=>Ph,subtract:()=>QS,sum:()=>Mh,times:()=>PH,toDays:()=>CH,toHours:()=>wH,toHrTime:()=>AH,toMillis:()=>Ye,toMinutes:()=>TH,toNanos:()=>ap,toNanosUnsafe:()=>op,toSeconds:()=>KS,toWeeks:()=>kH,weeks:()=>GO,zero:()=>We});var Ah=\"~effect/Duration\",Hn=BigInt(0),vh=BigInt(1),mH=BigInt(2),hH=BigInt(10),UO=BigInt(24),kh=BigInt(60),Oh=BigInt(1e3),NO=BigInt(1e6),DO=BigInt(1e9),_h=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),GS=e=>_h(e*1e6),LO=(e,t)=>{let r=e.indexOf(\".\");if(r===-1)return BigInt(e)*t;let n=e[0]===\"-\",o=e.slice(r+1),s=hH**BigInt(o.length),a=(BigInt(e.slice(n?1:0,r))*s+BigInt(o))*t,i=a/s+(a%s*mH>=s?vh:Hn);return n?-i:i},$O=e=>{let t=e<Hn?-vh:vh,r=e<Hn?-e:e;return[Number(t*(r/DO)),Number(t*(r%DO))]},xH=/^(-?\\d+(?:\\.\\d+)?)\\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,ge=e=>{switch(typeof e){case\"number\":return Jt(e);case\"bigint\":return An(e);case\"string\":{if(e===\"Infinity\")return er;if(e===\"-Infinity\")return Pr;let t=xH.exec(e);if(!t)break;let[r,n,o]=t;if(o===\"nano\"||o===\"nanos\")return An(LO(n,vh));if(o===\"micro\"||o===\"micros\")return An(LO(n,Oh));let s=Number(n);switch(o){case\"milli\":case\"millis\":return Jt(s);case\"second\":case\"seconds\":return Ph(s);case\"minute\":case\"minutes\":return HO(s);case\"hour\":case\"hours\":return WO(s);case\"day\":case\"days\":return JO(s);case\"week\":case\"weeks\":return GO(s)}break}case\"object\":{if(e===null)break;if(Ah in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(Sa)?BO(e):Number.isNaN(e[0])||Number.isNaN(e[1])?We:e[0]===-1/0||e[1]===-1/0?Pr:e[0]===1/0||e[1]===1/0?er:Ve(_h(e[0]*1e9+e[1]));let t=e,r=0;return t.weeks&&(r+=t.weeks*6048e5),t.days&&(r+=t.days*864e5),t.hours&&(r+=t.hours*36e5),t.minutes&&(r+=t.minutes*6e4),t.seconds&&(r+=t.seconds*1e3),t.milliseconds&&(r+=t.milliseconds),!t.microseconds&&!t.nanoseconds?Ve(r):Ve(_h(r*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return BO(e)},BO=e=>{throw new Error(`Invalid Input: ${e}`)},sp=po(ge),zO={_tag:\"Millis\",millis:0},gH={_tag:\"Infinity\"},yH={_tag:\"NegativeInfinity\"},bH={[Ah]:Ah,[ae](){switch(this.value._tag){case\"Millis\":{let e=this.value.millis*1e6;return Number.isFinite(e)?H(_h(e)):Dt(this.value.millis)}case\"Nanos\":return H(this.value.nanos);default:return $l(this.value)}},[ie](e){return Rh(e)&&VO(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\"}}},[Ee](){return this.toJSON()},pipe(){return K(this,arguments)}},Ve=e=>{let t=Object.create(bH);return typeof e==\"number\"?isNaN(e)||e===0||Object.is(e,-0)?t.value=zO:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:\"Millis\",millis:e}:t.value={_tag:\"Nanos\",nanos:GS(e)}:t.value=e>0?gH:yH:e===Hn?t.value=zO:t.value={_tag:\"Nanos\",nanos:e},t},Rh=e=>w(e,Ah),Ds=e=>e.value._tag!==\"Infinity\"&&e.value._tag!==\"NegativeInfinity\",$i=e=>{switch(e.value._tag){case\"Millis\":return e.value.millis===0;case\"Nanos\":return e.value.nanos===Hn;case\"Infinity\":case\"NegativeInfinity\":return!1}},jO=e=>{switch(e.value._tag){case\"Millis\":return e.value.millis<0;case\"Nanos\":return e.value.nanos<Hn;case\"NegativeInfinity\":return!0;case\"Infinity\":return!1}},SH=e=>{switch(e.value._tag){case\"Millis\":return e.value.millis>0;case\"Nanos\":return e.value.nanos>Hn;case\"Infinity\":return!0;case\"NegativeInfinity\":return!1}},qO=e=>{switch(e.value._tag){case\"Infinity\":case\"NegativeInfinity\":return er;case\"Millis\":return e.value.millis<0?Ve(-e.value.millis):e;case\"Nanos\":return e.value.nanos<Hn?Ve(-e.value.nanos):e}},EH=e=>{switch(e.value._tag){case\"Infinity\":return Pr;case\"NegativeInfinity\":return er;case\"Millis\":return e.value.millis===0?e:Ve(-e.value.millis);case\"Nanos\":return e.value.nanos===Hn?e:Ve(-e.value.nanos)}},We=Ve(0),er=Ve(1/0),Pr=Ve(-1/0),An=e=>Ve(e),IH=e=>Ve(e*Oh),Jt=e=>Ve(e),Ph=e=>Ve(e*1e3),HO=e=>Ve(e*6e4),WO=e=>Ve(e*36e5),JO=e=>Ve(e*864e5),GO=e=>Ve(e*6048e5),Ye=e=>ss(ge(e),{onMillis:A,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),KS=e=>ss(ge(e),{onMillis:t=>t/1e3,onNanos:t=>Number(t)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),TH=e=>ss(ge(e),{onMillis:t=>t/6e4,onNanos:t=>Number(t)/6e10,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),wH=e=>ss(ge(e),{onMillis:t=>t/36e5,onNanos:t=>Number(t)/36e11,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),CH=e=>ss(ge(e),{onMillis:t=>t/864e5,onNanos:t=>Number(t)/864e11,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),kH=e=>ss(ge(e),{onMillis:t=>t/6048e5,onNanos:t=>Number(t)/6048e11,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),op=e=>{let t=ge(e);switch(t.value._tag){case\"Infinity\":case\"NegativeInfinity\":throw new Error(\"Cannot convert infinite duration to nanos\");case\"Nanos\":return t.value.nanos;case\"Millis\":return GS(t.value.millis)}},ap=po(op),AH=e=>{let t=ge(e);switch(t.value._tag){case\"Infinity\":return[1/0,0];case\"NegativeInfinity\":return[-1/0,0];case\"Nanos\":return $O(t.value.nanos);case\"Millis\":return $O(GS(t.value.millis))}},ss=l(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)()}}),ip=l(3,(e,t,r)=>e.value._tag===\"Infinity\"||e.value._tag===\"NegativeInfinity\"||t.value._tag===\"Infinity\"||t.value._tag===\"NegativeInfinity\"?r.onInfinity(e,t):e.value._tag===\"Millis\"?t.value._tag===\"Millis\"?r.onMillis(e.value.millis,t.value.millis):r.onNanos(op(e),t.value.nanos):r.onNanos(e.value.nanos,op(t))),ho=rs((e,t)=>ip(e,t,{onMillis:(r,n)=>r<n?-1:r>n?1:0,onNanos:(r,n)=>r<n?-1:r>n?1:0,onInfinity:(r,n)=>r.value._tag===n.value._tag?0:r.value._tag===\"Infinity\"?1:r.value._tag===\"NegativeInfinity\"||n.value._tag===\"Infinity\"?-1:1})),vH=Sh(ho),KO=(e,t)=>ip(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n,onInfinity:(r,n)=>r.value._tag===n.value._tag}),VS=Zl(ho),ZS=Ql(ho),OH=bh(ho),_H=l(2,(e,t)=>Number.isFinite(t)?t===0||Object.is(t,-0)?v():ss(e,{onMillis:r=>O(Ve(r/t)),onNanos:r=>{try{return O(Ve(r/BigInt(t)))}catch{return v()}},onInfinity:()=>O(t>0?er:Pr),onNegativeInfinity:()=>O(t>0?Pr:er)}):v()),RH=l(2,(e,t)=>Number.isFinite(t)?ss(e,{onMillis:r=>Ve(r/t),onNanos:r=>{if(Object.is(t,0)||Object.is(t,-0)){if(r===Hn)return We;let n=r>Hn,o=Object.is(t,0);return n===o?er:Pr}try{return Ve(r/BigInt(t))}catch{return We}},onInfinity:()=>t>0?er:t<0?Pr:We,onNegativeInfinity:()=>t>0?Pr:t<0?er:We}):We),PH=l(2,(e,t)=>ss(e,{onMillis:r=>Ve(r*t),onNanos:r=>Ve(r*BigInt(t)),onInfinity:()=>t>0?er:t<0?Pr:We,onNegativeInfinity:()=>t>0?Pr:t<0?er:We})),QS=l(2,(e,t)=>ip(e,t,{onMillis:(r,n)=>Ve(r-n),onNanos:(r,n)=>Ve(r-n),onInfinity:(r,n)=>{let o=r.value._tag,s=n.value._tag;return o===\"Infinity\"?s===\"Infinity\"?We:er:o===\"NegativeInfinity\"?s===\"NegativeInfinity\"?We:Pr:s===\"Infinity\"?Pr:er}})),Mh=l(2,(e,t)=>ip(e,t,{onMillis:(r,n)=>Ve(r+n),onNanos:(r,n)=>Ve(r+n),onInfinity:(r,n)=>{let o=r.value._tag,s=n.value._tag;return o===\"Infinity\"&&s===\"NegativeInfinity\"||o===\"NegativeInfinity\"&&s===\"Infinity\"?We:o===\"Infinity\"||s===\"Infinity\"?er:o===\"NegativeInfinity\"||s===\"NegativeInfinity\"?Pr:We}})),MH=wa(ho),YS=Fi(ho),FH=ns(ho),UH=Ui(ho),VO=l(2,(e,t)=>KO(e,t)),ZO=e=>{if(e.value._tag===\"Infinity\")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};if(e.value._tag===\"NegativeInfinity\")return{days:-1/0,hours:-1/0,minutes:-1/0,seconds:-1/0,millis:-1/0,nanos:-1/0};let t=op(e),r=t<Hn,n=r?-t:t,o=n/NO,s=o/Oh,a=s/kh,i=a/kh,c=i/UO,u=r?-1:1;return{days:u*Number(c),hours:u*Number(i%UO),minutes:u*Number(a%kh),seconds:u*Number(s%kh),millis:u*Number(o%Oh),nanos:u*Number(n%NO)}},Fh=e=>{if(e.value._tag===\"Infinity\")return\"Infinity\";if(e.value._tag===\"NegativeInfinity\")return\"-Infinity\";if($i(e))return\"0\";if(jO(e))return\"-\"+Fh(qO(e));let t=ZO(e),r=[];return t.days!==0&&r.push(`${t.days}d`),t.hours!==0&&r.push(`${t.hours}h`),t.minutes!==0&&r.push(`${t.minutes}m`),t.seconds!==0&&r.push(`${t.seconds}s`),t.millis!==0&&r.push(`${t.millis}ms`),t.nanos!==0&&r.push(`${t.nanos}ns`),r.join(\" \")},NH=zl(Mh,We),DH=Bv(ho),LH=$v(ho);var Er={};$e(Er,{asVoid:()=>FJ,asVoidAll:()=>UJ,die:()=>PI,fail:()=>Gs,failCause:()=>sn,filterCause:()=>vJ,filterFailure:()=>AJ,filterSuccess:()=>CJ,filterValue:()=>kJ,findDefect:()=>_J,findError:()=>OJ,findErrorOption:()=>LJ,getCause:()=>DJ,getSuccess:()=>NJ,hasDies:()=>wJ,hasFails:()=>TJ,hasInterrupts:()=>FI,interrupt:()=>MI,isExit:()=>Np,isFailure:()=>Co,isSuccess:()=>je,map:()=>RJ,mapBoth:()=>MJ,mapError:()=>PJ,match:()=>UI,succeed:()=>Fr,void:()=>ht});var XS=e=>e.length>0;var it=e=>e>0?Math.floor(e):0,Wn=e=>Math.max(1,it(e));var tt={};$e(tt,{Do:()=>tW,all:()=>Uu,andThen:()=>YH,bind:()=>rW,bindTo:()=>nW,fail:()=>D,failVoid:()=>zH,filterOrFail:()=>KH,flatMap:()=>It,flip:()=>XH,fromNullishOr:()=>jH,fromOption:()=>eE,gen:()=>eW,getFailure:()=>HH,getOrElse:()=>Aa,getOrNull:()=>VH,getOrThrow:()=>Ls,getOrThrowWith:()=>YO,getOrUndefined:()=>ZH,getSuccess:()=>qH,isFailure:()=>Q,isResult:()=>ka,isSuccess:()=>ze,let:()=>oW,liftPredicate:()=>GH,makeEquivalence:()=>WH,map:()=>mt,mapBoth:()=>JH,mapError:()=>cp,match:()=>tr,merge:()=>tE,orElse:()=>QH,succeed:()=>P,succeedNone:()=>rE,succeedSome:()=>iW,tap:()=>cW,transposeMapOption:()=>aW,transposeOption:()=>sW,try:()=>QO,void:()=>BH});var P=Vl,D=Kl,BH=P(void 0);var zH=D(void 0),jH=l(2,(e,t)=>e==null?D(t(e)):P(e)),eE=EO,QO=e=>{if(qt(e))try{return P(e())}catch(t){return D(t)}else try{return P(e.try())}catch(t){return D(e.catch(t))}};var ka=hh,Q=Au,ze=vu,qH=gh,HH=xh,WH=(e,t)=>Lt((r,n)=>Q(r)?Q(n)&&t(r.failure,n.failure):ze(n)&&e(r.success,n.success)),JH=l(2,(e,{onFailure:t,onSuccess:r})=>Q(e)?D(t(e.failure)):P(r(e.success))),cp=l(2,(e,t)=>Q(e)?D(t(e.failure)):e),mt=l(2,(e,t)=>ze(e)?P(t(e.success)):e),tr=l(2,(e,{onFailure:t,onSuccess:r})=>Q(e)?t(e.failure):r(e.success)),GH=l(3,(e,t,r)=>t(e)?P(e):D(r(e))),KH=l(3,(e,t,r)=>It(e,n=>t(n)?P(n):D(r(n)))),tE=tr({onFailure:A,onSuccess:A}),Aa=l(2,(e,t)=>Q(e)?t(e.failure):e.success),VH=Aa(nh),ZH=Aa(Hr),YO=l(2,(e,t)=>{if(ze(e))return e.success;throw t(e.failure)}),Ls=YO(A),QH=l(2,(e,t)=>Q(e)?t(e.failure):P(e.success)),It=l(2,(e,t)=>Q(e)?D(e.failure):t(e.success)),YH=l(2,(e,t)=>It(e,r=>{let n=qt(t)?t(r):t;return ka(n)?n:P(n)})),Uu=e=>{if(Symbol.iterator in e){let r=[];for(let n of e){if(Q(n))return n;r.push(n.success)}return P(r)}let t={};for(let r of Object.keys(e)){let n=e[r];if(Q(n))return n;N(t,r,n.success)}return P(t)},XH=e=>Q(e)?P(e.failure):D(e.success),eW=(...e)=>{let r=(e.length===1?e[0]:e[1].bind(e[0]))(),n=r.next();for(;!n.done;){let o=n.value;if(Q(o))return o;n=r.next(o.success)}return P(n.value)},tW=P({}),rW=Su(mt,It),nW=bu(mt),oW=yu(mt);var sW=e=>Ta(e)?rE:mt(e.value,Fs),aW=l(2,(e,t)=>Ta(e)?rE:mt(t(e.value),Fs)),rE=P(Mi),iW=e=>P(Fs(e)),cW=l(2,(e,t)=>(ze(e)&&t(e.success),e));var XO=eO;var uW=(e,t)=>{let r=t?.length!==void 0?Wn(t.length):1/0;return{[Symbol.iterator](){let n=0;return{next(){return n<r?{value:e(n++),done:!1}:{done:!0,value:void 0}}}}}};var fW=l(2,(e,t)=>dW(uW(()=>e,{length:t}))),t_=e=>fW(e,1/0);var Uh=e=>{let r=e[Symbol.iterator]().next();if(r.done)throw new Error(\"headUnsafe: empty iterable\");return r.value};var r_=l(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(Si(o)){if(o)return O(n)}else if(Oe(o))return o;r++}return v()});var lW={[Symbol.iterator](){return pW}},pW={next(){return{done:!0,value:void 0}}},n_=()=>lW;var dW=e=>({[Symbol.iterator](){let t=e[Symbol.iterator](),r;function n(){for(;;){if(r===void 0){let s=t.next();if(s.done)return s;r=s.value[Symbol.iterator]()}let o=r.next();if(!o.done)return o;r=void 0}}return{next:n}}});var o_=l(2,(e,t)=>({[Symbol.iterator](){let r=e[Symbol.iterator](),n=0;return{next(){let o=r.next();for(;!o.done;){if(t(o.value,n++))return{done:!1,value:o.value};o=r.next()}return{done:!0,value:void 0}}}}}));var s_=e=>Object.keys(e).length===0;var a_=l(2,(e,t)=>Object.hasOwn(e,t));var i_=l(2,(e,t)=>{if(!a_(e,t))return{...e};let r={...e};return delete r[t],r});var Du=l(2,(e,t)=>{let r={...e};for(let n of c_(e))N(r,n,t(e[n],n));return r});var c_=e=>Object.keys(e);var nE=l(3,(e,t,r)=>({...e,[t]:r}));var mW=e=>l(2,(t,r)=>{for(let n of c_(t))if(!a_(r,n)||!e(t[n],r[n]))return!1;return!0});var u_=e=>{let t=mW(e);return(r,n)=>t(r,n)&&t(n,r)};var va=globalThis.Array;var oE=e=>new va(it(e)),fp=l(2,(e,t)=>{let r=Wn(e),n=new va(r);for(let o=0;o<r;o++)n[o]=t(o);return n}),sE=(e,t)=>e<=t?fp(t-e+1,r=>e+r):[e];var be=e=>va.isArray(e)?e:va.from(e),aE=e=>va.isArray(e)?e:[e];var Oa=l(2,(e,t)=>[...e,t]),Nh=l(2,(e,t)=>be(e).concat(be(t)));var f_=va.isArray;var gr=XS,ct=XS;function Lu(e){let t=Number(e);return String(t)===e&&Number.isInteger(t)&&t>=0&&t<2**32-1}function hW(e,t){return!Number.isFinite(e)||e<0||e>=t.length}var l_=l(2,(e,t)=>{let r=Math.floor(t);if(hW(r,e))throw new Error(`Index out of bounds: ${r}`);return e[r]});var Dh=e=>e[e.length-1];var iE=r_;var Bi=l(2,(e,t)=>{let r=va.from(e);return r.sort(t),r}),cE=l(3,(e,t,r)=>va.from(e).map(n=>[n,t(n)]).sort(([,n],[,o])=>r(n,o)).map(([n])=>n));var p_=l(2,(e,t)=>{let r={};for(let n of e){let o=t(n);Object.hasOwn(r,o)?r[o].push(n):N(r,o,[n])}return r}),xW=(e,t)=>{let r=H(t),n=e.get(r);if(n===void 0)return e.set(r,[t]),!0;for(let o of n)if(J(o,t))return!1;return n.push(t),!0};var Ot=()=>[],Te=e=>[e],tn=l(2,(e,t)=>e.map(t));var zi=l(2,(e,t)=>{let r=be(e),n=[];for(let o=0;o<r.length;o++)t(r[o],o)&&n.push(r[o]);return n}),uE=l(2,(e,t)=>{let r=[],n=[],o=0;for(let s of e){let a=t(s,o++);ze(a)?r.push(a.success):n.push(a.failure)}return[r,n]});var d_=gu;var Lh=e=>{let t=be(e);if(t.length<2)return[...t];let r=new Map,n=[];for(let o of t)xW(r,o)&&n.push(o);return n};var m_=e=>t=>!Q(e(t));var h_=e=>t=>t.has(e)?P(t):D(t);var x_=l(2,(e,t)=>r=>{let n=e(r);return Q(n)?n:t(n.success)}),fE=l(2,(e,t)=>r=>{let n=e(r);if(Q(n))return D(r);let o=t(n.success);return Q(o)?D(r):o}),g_=e=>t=>{let r=e(t);return Q(r)?v():O(r.success)};var lp=Se(\"effect/Scheduler\",{fiberCached:!0,defaultValue:()=>new ji}),y_=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},gW=\"setImmediate\"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},b_=e=>{try{return gW(e)}catch{return y_(e)}},pE=class{buckets=[];scheduleTask(t,r){let n=this.buckets,o=n.length,s,a=0;for(;a<o&&!(n[a][0]>r);a++)s=n[a];s&&s[0]===r?s[1].push(t):a===o?n.push([r,[t]]):n.splice(a,0,[r,[t]])}drain(){let t=this.buckets;return this.buckets=[],t}},ji=class{executionMode;setImmediate;constructor(t=\"async\",r){this.executionMode=t,this.setImmediate=r??(t===\"sync\"?y_:b_)}shouldYield(t){return t.currentOpCount>=t.cache.maxOpsBeforeYield}makeDispatcher(){return new dE(this.setImmediate)}},dE=class{tasks=new pE;running=void 0;setImmediate;constructor(t=b_){this.setImmediate=t}scheduleTask(t,r){this.tasks.scheduleTask(t,r),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let t=this.tasks.drain();for(let r=0;r<t.length;r++){let n=t[r][1];for(let o=0;o<n.length;o++)n[o]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},S_=Se(\"effect/Scheduler/MaxOpsBeforeYield\",{fiberCached:!0,defaultValue:()=>2048}),E_=Se(\"effect/Scheduler/PreventSchedulerYield\",{fiberCached:!0,defaultValue:()=>!1});var Jh={};$e(Jh,{CurrentTraceLevel:()=>gE,DisablePropagation:()=>pp,MinimumTraceLevel:()=>yE,NativeSpan:()=>zh,ParentSpan:()=>xo,ParentSpanKey:()=>jh,Tracer:()=>Hh,TracerKey:()=>qh,externalSpan:()=>AW,make:()=>v_,nativeTracer:()=>Wh});var _a={};$e(_a,{Class:()=>$h,Error:()=>Bh,TaggedClass:()=>yW,TaggedError:()=>rn,taggedEnum:()=>bW});var $h=class extends ba{constructor(e){super(),e&&fh(this,e)}},yW=e=>class extends $h{_tag=e},bW=()=>new Proxy({},{get(e,t,r){return t===\"$is\"?Nt:t===\"$match\"?SW:n=>({...n,_tag:t})}});function SW(){if(arguments.length===1){let r=arguments[0];return function(n){return r[n._tag](n)}}let e=arguments[0];return arguments[1][e._tag](e)}var Bh=Jl,rn=Ms;var I_=\"~effect/encoding/EncodingError\",Jn=class extends rn(\"EncodingError\"){[I_]=I_};var C_=e=>T_(typeof e==\"string\"?wW.encode(e):e),hE=e=>{switch(e){case 16:return IW();case 32:return TW();default:{let t=\"\";for(let r=e>>>3;r>0;r--)t+=EW();return t}}},ne=Uint8Array.from(\"0123456789abcdef\",e=>e.charCodeAt(0)),qi=()=>Math.random()*4294967296>>>0,EW=()=>{let e=qi();return String.fromCharCode(ne[e>>>28],ne[e>>>24&15],ne[e>>>20&15],ne[e>>>16&15],ne[e>>>12&15],ne[e>>>8&15],ne[e>>>4&15],ne[e&15])},IW=()=>{let e=qi(),t=qi();return String.fromCharCode(ne[e>>>28],ne[e>>>24&15],ne[e>>>20&15],ne[e>>>16&15],ne[e>>>12&15],ne[e>>>8&15],ne[e>>>4&15],ne[e&15],ne[t>>>28],ne[t>>>24&15],ne[t>>>20&15],ne[t>>>16&15],ne[t>>>12&15],ne[t>>>8&15],ne[t>>>4&15],ne[t&15])},TW=()=>{let e=qi(),t=qi(),r=qi(),n=qi();return String.fromCharCode(ne[e>>>28],ne[e>>>24&15],ne[e>>>20&15],ne[e>>>16&15],ne[e>>>12&15],ne[e>>>8&15],ne[e>>>4&15],ne[e&15],ne[t>>>28],ne[t>>>24&15],ne[t>>>20&15],ne[t>>>16&15],ne[t>>>12&15],ne[t>>>8&15],ne[t>>>4&15],ne[t&15],ne[r>>>28],ne[r>>>24&15],ne[r>>>20&15],ne[r>>>16&15],ne[r>>>12&15],ne[r>>>8&15],ne[r>>>4&15],ne[r&15],ne[n>>>28],ne[n>>>24&15],ne[n>>>20&15],ne[n>>>16&15],ne[n>>>12&15],ne[n>>>8&15],ne[n>>>4&15],ne[n&15])},xE=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return D(new Jn({module:\"Hex\",kind:\"Decode\",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let r=t.length/2,n=new Uint8Array(r);for(let o=0;o<r;o++){let s=w_(t[o*2]),a=w_(t[o*2+1]);n[o]=s<<4|a}return P(n)}catch(r){return D(new Jn({module:\"Hex\",kind:\"Decode\",input:e,message:r instanceof Error?r.message:\"Invalid input\"}))}},k_=e=>mt(xE(e),t=>CW.decode(t)),wW=new TextEncoder,CW=new TextDecoder,kW=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,\"0\")),T_=e=>{let t=\"\";for(let r=0;r<e.length;r++)t+=kW[e[r]];return t},w_=e=>{if(48<=e&&e<=57)return e-48;if(97<=e&&e<=102)return e-97+10;if(65<=e&&e<=70)return e-65+10;throw new TypeError(\"Invalid input\")};var jh=\"effect/Tracer/ParentSpan\",xo=class extends fr()(jh,{fiberCached:!0}){},v_=e=>e,AW=e=>({_tag:\"ExternalSpan\",spanId:e.spanId,traceId:e.traceId,sampled:e.sampled??!0,annotations:e.annotations??Xt()}),pp=Se(\"effect/Tracer/DisablePropagation\",{defaultValue:Rl}),gE=Se(\"effect/Tracer/CurrentTraceLevel\",{defaultValue:()=>\"Info\"}),yE=Se(\"effect/Tracer/MinimumTraceLevel\",{defaultValue:()=>\"All\"}),qh=\"effect/Tracer\",Hh=Se(qh,{fiberCached:!0,defaultValue:()=>Wh}),Wh=v_({span:e=>new zh(e)}),zh=class{_tag=\"Span\";sampled;name;parent;annotations;links;startTime;kind;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(t){this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.startTime=t.startTime,this.kind=t.kind,this.sampled=t.sampled,this.status={_tag:\"Started\",startTime:t.startTime}}get traceId(){return this._traceId??=lo(this.parent)?.traceId??hE(32)}get spanId(){return this._spanId??=hE(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(t,r){this.status={_tag:\"Ended\",endTime:t,exit:r,startTime:this.status.startTime}}attribute(t,r){this.attributes.set(t,r)}event(t,r,n){this.events.push([t,r,n??{}])}addLinks(t){this.links.push(...t)}};var dp=\"effect/Metric/FiberRuntimeMetrics\";var __=Se(\"effect/ErrorReporter/CurrentErrorReporters\",{defaultValue:()=>new Set}),$u=Se(\"effect/References/CurrentStackFrame\",{fiberCached:!0,defaultValue:Hr}),Gh=Se(\"effect/References/TracerEnabled\",{fiberCached:!0,defaultValue:mr}),Hi=Se(\"effect/References/TracerTimingEnabled\",{defaultValue:mr}),mp=Se(\"effect/References/TracerSpanAnnotations\",{defaultValue:()=>({})}),hp=Se(\"effect/References/TracerSpanLinks\",{defaultValue:()=>[]}),go=Se(\"effect/References/CurrentLogAnnotations\",{defaultValue:()=>({})}),bE=Se(\"effect/References/CurrentLogLevel\",{fiberCached:!0,defaultValue:()=>\"Info\"}),SE=Se(\"effect/References/MinimumLogLevel\",{fiberCached:!0,defaultValue:()=>\"Info\"});var Bu=Se(\"effect/References/CurrentLogSpans\",{defaultValue:()=>[]});var Gn=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=\"boolean\")return e;let t=jn();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};_r(3);let r=new Error;return _r(t),{...e,captureStackTrace:OW(()=>r.stack)}},EE=e=>t=>{let r;return()=>{if(r!==void 0)return r;let n=t();if(!n)return;let o=n.split(`\n`);if(o[e]!==void 0)return r=o[e].trim(),r}},OW=EE(3);var Kh=class extends wu{constructor(t,r=Wl){super(\"Interrupt\",r,\"Interrupted\"),this.fiberId=t}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:\"Interrupt\",fiberId:this.fiberId}}[ie](t){return Ri(t)&&this.fiberId===t.fiberId&&this.annotations===t.annotations}[ae](){return oe(Me(`${this._tag}:${this.fiberId}`))(sh(this.annotations))}},L_=e=>new Kh(e),$s=e=>new Xo([new Kh(e)]),RE=e=>e.reasons.some(Ps),PE=e=>{let t=e.reasons.find(Ps);return t?P(t):D(e)},Vn=e=>{for(let t=0;t<e.reasons.length;t++){let r=e.reasons[t];if(r._tag===\"Fail\")return P(r.error)}return D(e)},$_=g_(Vn),ex=e=>e.reasons.some(_i),B_=e=>{let t=e.reasons.find(_i);return t?P(t):D(e)},wp=e=>{let t=e.reasons.find(_i);return t?P(t.defect):D(e)},tx=e=>e.reasons.some(Ri),z_=e=>{let t=e.reasons.find(Ri);return t?P(t):D(e)},rx=e=>{let t;for(let r=0;r<e.reasons.length;r++){let n=e.reasons[r];n._tag===\"Interrupt\"&&(t??=new Set,n.fiberId!==void 0&&t.add(n.fiberId))}return t?P(t):D(e)},j_=e=>{let t=rx(e);return Q(t)?RW:t.success},RW=new Set,q_=e=>e.reasons.length>0&&e.reasons.every(Ri),H_=e=>mo(e.annotations),W_=e=>{let t=new Map;for(let r of e.reasons)if(r.annotations.size>0)for(let[n,o]of r.annotations)t.set(n,o);return mo(t)},J_=l(2,(e,t)=>{let r=!1,n=e.reasons.map(o=>Ps(o)?(r=!0,new Ci(t(o.error),o.annotations)):o);return r?Rs(n):e}),nx=e=>{let t;for(let r of e.reasons){if(r._tag===\"Fail\")return r.error;r._tag===\"Die\"&&(t??=r)}return t!==void 0?t.defect:e.reasons.length>0?new globalThis.Error(\"All fibers interrupted without error\"):new globalThis.Error(\"Empty cause\")},ME=(e,t)=>{let r=[],n=[];if(e.reasons.length===0)return r;let o=jn();o!==0&&_r(1);try{for(let s of e.reasons){if(s._tag===\"Interrupt\"){n.push(s);continue}r.push(TE(s._tag===\"Die\"?s.defect:s.error,s.annotations,t))}if(r.length===0){let s=new Error(\"The fiber was interrupted by:\");s.name=\"InterruptCause\",s.stack=UW(s,n);let a=new globalThis.Error(\"All fibers interrupted without error\",{cause:s});a.name=\"InterruptError\",a.stack=`${a.name}: ${a.message}`,r.push(TE(a,n[0].annotations,t))}}finally{o!==0&&_r(o)}return r},TE=(e,t,r)=>{let n=typeof e,o;if(e&&n===\"object\"){if(o=new globalThis.Error(PW(e),{cause:e.cause?TE(e.cause):void 0}),typeof e.name==\"string\"&&(o.name=e.name),typeof e.stack==\"string\")o.stack=FW(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?G_(s,t):s}r?.includeCauseInStack&&(o.stack=V_(o));for(let s of Object.keys(e))s in o||(o[s]=e[s])}else o=new globalThis.Error(e?n===\"string\"?e:_s(e):`Unknown error: ${e}`);return o},PW=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 _s(e)},MW=/\\((.*)\\)/g,FW=(e,t,r)=>{let n=`${t.name}: ${t.message}`,o=(e.startsWith(n)?e.slice(n.length):e).split(`\n`),s=[n];for(let a=1;a<o.length&&!/Generator\\.next|~effect\\/(?:Effect|Utils)/.test(o[a]);a++)s.push(o[a]);return r?G_(s.join(`\n`),r):s.join(`\n`)},G_=(e,t)=>{let r=t?.get(ph.key);return r&&(e=`${e}\n${K_(r)}`),e},UW=(e,t)=>{let r=[`${e.name}: ${e.message}`];for(let n of t){let o=n.fiberId!==void 0?`#${n.fiberId}`:\"unknown\",s=n.annotations.get(MS.key);r.push(`    at fiber (${o})`),s&&r.push(K_(s))}return r.join(`\n`)},K_=e=>{let t=[],r=e,n=0;for(;r&&n<10;){let o=r.stack();if(o){let s=o.matchAll(MW),a=!1;for(let[,i]of s)a=!0,t.push(`    at ${r.name} (${i})`);a||t.push(`    at ${r.name} (${o.replace(/^at /,\"\")})`)}else t.push(`    at ${r.name}`);r=r.parent,n++}return t.join(`\n`)},Bs=e=>ME(e).map(V_).join(`\n`),V_=e=>e.cause?`${e.stack} {\n${Z_(e.cause,\"  \")}\n}`:e.stack,Z_=(e,t)=>{let r=e.stack.split(`\n`),n=`${t}[cause]: ${r[0]}`;for(let o=1,s=r.length;o<s;o++)n+=`\n${t}${r[o]}`;return e.cause&&(n+=` {\n${Z_(e.cause,`${t}  `)}\n${t}}`),n},FE=\"~effect/Fiber\",NW={_A:A,_E:A},DW={id:0},R_=(()=>{try{return globalThis.process?.getBuiltinModule?.(\"node:async_hooks\")?.AsyncResource}catch{return}})(),Q_=()=>R_===void 0?void 0:new R_(\"effect/Fiber\"),zs=()=>globalThis[Eu],Vh=class{constructor(t,r=!0){this.setContext(t),this.id=++DW.id,this.currentOpCount=0,this.interruptible=r,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[FE](){return NW}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(t){return Ie(this.context,t)}addObserver(t){return this._exit?(t(this._exit),vr):(this._observers===void 0?this._observers=[t]:this._observers.push(t),()=>this.removeObserver(t))}removeObserver(t){if(this._exit||this._observers===void 0)return;let r=this._observers.indexOf(t);r>=0&&this._observers.splice(r,1)}interruptUnsafe(t,r){if(this._exit)return;let n=$s(t);this.cache.stackFrame&&(n=ku(n,os(ph,this.cache.stackFrame))),r&&(n=ku(n,r)),this._interruptedCause=this._interruptedCause?vi(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(_e(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(t){if(this._exit)return;if(this._asyncContext!==void 0){let o=this._asyncContext;return this._asyncContext=void 0,o.runInAsyncScope(this.evaluate,this,t)}else if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let r=this.runLoop(t);if(r===Ai){this._asyncContext=Q_();return}let n=wE.interruptChildren&&wE.interruptChildren(this);if(n!==void 0)return this.evaluate(B(n,()=>r));if(this._exit=r,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&(this._parent._children?.delete(this),this._parent=void 0),this._observers!==void 0){let o=this._observers;this._observers=void 0;for(let s=0;s<o.length;s++)o[s](r)}this._stack.length=0,this._children=void 0,this.context=Xt()}runLoop(t){let r=globalThis[Eu];globalThis[Eu]=this;let n=this._running;this._running=!0;let o=!1,s=t;this.currentOpCount=0;try{for(;;){this._deferredInterrupt&&(this._deferredInterrupt=!1,s=_e(this._interruptedCause)),this.currentOpCount++;let a=this.cache;if(!o&&!a.preventYield&&a.scheduler.shouldYield(this)){o=!0;let i=s;s=B(qu,()=>i)}if(s=a.tracerContext?a.tracerContext(s,this):s[pt](this),s===Ai){let i=this._yielded;if(Ti in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Ai}}}catch(a){return w(s,pt)?this.runLoop(Rr(a)):Rr(`Fiber.runLoop: Not a valid effect: ${String(s)}`)}finally{this._running=n,globalThis[Eu]=r}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,$W;for(;;){let r=this._stack.pop();if(!r)return;let n=r[wi];if(n!==void 0){let o=n.call(r,this);if(o)return o[t]=o,o}if(r[t])return r}}succeedWith(t){if((++this.currentOpCount&BW-1)===0)return Ae(t);let r=this.getCont(Ht);return r?r[Ht](t,this):this.yieldWith(Ae(t))}yieldWith(t){return this._yielded=t,Ai}children(){return this._children??=new Set}pipe(){return K(this,arguments)}setContext(t){let r=this.context;if(this.context=t,r!==void 0&&HS(r,t))return;let n=t.cacheRoot,o=n._fiberCache??=LW(t);this.cache?.scheduler!==o.scheduler&&(this._dispatcher=void 0),this.cache=o}get currentSpanLocal(){let t=this.cache.span;return t?._tag===\"Span\"?t:void 0}},LW=e=>{let t=Mu(e,qh);return{scheduler:Ie(e,lp),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:Ie(e,Gh),span:Mu(e,jh),logLevel:Ie(e,bE),minimumLogLevel:Ie(e,SE),stackFrame:Ie(e,$u),runtimeMetrics:Mu(e,dp),maxOpsBeforeYield:Ie(e,S_),preventYield:Ie(e,E_)}},$W={[Ht](e,t){return _e(t._interruptedCause)},[Cn](e,t){return _e(t._interruptedCause)}},BW=32,wE={interruptChildren:void 0},Cp=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(MS.key,e.cache.stackFrame),mo(t)},zW=e=>{if(!(e._children===void 0||e._children.size===0))return Wi(e._children)},UE=e=>{let t=e;return t._exit?_(t._exit):Tt(r=>t._exit?r(_(t._exit)):V(e.addObserver(n=>r(_(n)))))},kp=e=>Tt(t=>{let r=e[Symbol.iterator](),n=[],o;function s(){let a=r.next();for(;!a.done;){if(a.value._exit){n.push(a.value._exit),a=r.next();continue}o=a.value.addObserver(i=>{n.push(i),s()});return}t(_(n))}return s(),V(()=>o?.())}),NE=e=>{let t=e;return t._exit?t._exit:Tt(r=>t._exit?r(t._exit):V(e.addObserver(r)))},Y_=e=>Tt(t=>{let r=Array.from(e);if(r.length===0)return t(_(Ot()));let n=new Array(r.length),o=Ot(),s=()=>{for(let c=0;c<o.length;c++)r[c].removeObserver(o[c])},a=0,i=!1;for(let c=0;c<r.length&&!i;c++){let u=f=>{if(a++,f._tag===\"Failure\")return i=!0,s(),t(f);n[c]=f.value,a===r.length&&t(_(n))};o.push(u),r[c].addObserver(u)}return V(()=>{i=!0,s()})}),Gi=e=>re(t=>X_(e,t.id)),X_=l(e=>w(e[0],FE),(e,t,r)=>re(n=>{let o=Cp(n);return o=o&&r?Fu(o,r):o??r,e.interruptUnsafe(t,o),Wu(UE(e))})),Wi=e=>re(t=>{let r=Cp(t),n=Ot();for(let o of e)o.interruptUnsafe(t.id,r),n.push(o);return Wu(kp(n))}),eR=l(2,(e,t)=>re(r=>{let n=Cp(r),o=Ot();for(let s of e)s.interruptUnsafe(t,n),o.push(s);return Wu(kp(o))})),_=Ae,_e=ur,Ze=en,V=ts({op:\"Sync\",[pt](e){let t=this[de](),r=e.getCont(Ht);return r?r[Ht](t,e):e.yieldWith(Ae(t))}}),W=ts({op:\"Suspend\",[pt](e){return this[de]()}}),DE=l(e=>e.length>=2||Ru(e[0]),(e,t)=>fe(e)?Ze(t?t():new uo(\"Effect.fromOption: Option.none\")):_(e.value)),Ki=tr({onFailure:Ze,onSuccess:_}),tR=e=>e==null?Ze(new uo):_(e),LE=ts({op:\"Yield\",[pt](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(yr)},this[de]??0),e.yieldWith(()=>{t=!0})}}),qu=LE(0),$E=e=>_(O(e)),Vi=_(v()),rR=e=>fe(e)?Vi:pe(e.value,O),nR=e=>W(()=>_e(e())),js=e=>Rr(e),ox=e=>W(()=>Ze(e())),le=_(void 0);var oR=e=>{let t=typeof e==\"function\"?e:e.try,r=typeof e==\"function\"?n=>new ju(n,\"An error occurred in Effect.try\"):e.catch;return W(()=>{try{return _(t())}catch(n){return Ze(r(n))}})};var BE=e=>zE(function(t,r){e(r).then(n=>t(_(n)),n=>t(js(n)))},e.length!==0),sR=e=>{let t=typeof e==\"function\"?e:e.try,r=typeof e==\"function\"?n=>new ju(n,\"An error occurred in Effect.tryPromise\"):e.catch;return zE(function(n,o){let s=a=>W(()=>{try{return Ze(Ia(()=>r(a)))}catch(i){return js(i)}});try{t(o).then(a=>n(_(a)),a=>n(s(a)))}catch(a){n(s(a))}},t.length!==0)},aR=e=>re(t=>e(t.id)),iR=re(_),cR=aR(_),zE=(function(){let e=kn({op:\"Async\",[pt](r){let n=!1,o=!1,s=this.withSignal?new AbortController:void 0,a=this.register.call(r.cache.scheduler,i=>{n||(n=!0,o?r.evaluate(i):o=i)},s?.signal);return o!==!1?o:(o=!0,r._yielded=()=>{n=!0},s===void 0&&a===void 0?Ai:(r._stack.push(jW(()=>(n=!0,s?.abort(),a??yr))),Ai))}}),t=function(r,n){this.register=r,this.withSignal=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),jW=ts({op:\"AsyncFinalizer\",[wi](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Pp))},[Cn](e,t){return tx(e)?B(lP(ur(e),this[de]()),()=>_e(e)):_e(e)}}),Tt=e=>zE(e,e.length>=2),Ap=Tt(vr),sx=(...e)=>{if(e.length===1){let n=e[0];return W(()=>Ji(n()))}let[t,r]=e;return W(()=>Ji(r.call(t.self)))},vp=(e,...t)=>{let r=t.length===0?function(){return W(()=>Ji(e.apply(this,arguments)))}:function(){let n=W(()=>Ji(e.apply(this,arguments)));for(let o=0;o<t.length;o++)n=t[o](n,...arguments);return n};return jE(e.length,r)},jE=(e,t)=>Object.defineProperty(t,\"length\",{value:e,configurable:!0}),P_=EE(2),uR=function(){let e=typeof arguments[0]==\"string\",t=e?arguments[0]:\"Effect.fn\",r=e?arguments[1]:void 0,n=jn(),o;return n!==0&&(_r(2),o=new globalThis.Error,_r(n)),e?(s,...a)=>M_(t,s,o,a,e,r):M_(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,r)},M_=(e,t,r,n,o,s)=>{let a=typeof t==\"function\"?t:n.shift().bind(t.self),i=`${e} (definition)`,c=r?P_(()=>r.stack):Hr;return jE(a.length,function(...u){let f=W(()=>{let m=a.apply(this,arguments);return ue(m)?m:Ji(m)});for(let m=0;m<n.length;m++)f=n[m](f,...u);if(!ue(f))return f;let p=jn(),d;return p!==0&&(_r(2),d=new globalThis.Error,_r(p)),Ws(o?xp(e,s,m=>OE(f,m)):f,$u,m=>({name:e,stack:d?P_(()=>d.stack):Hr,parent:{name:i,stack:c,parent:m}}))})},fR=(e,...t)=>jE(e.length,t.length===0?function(){return F_(()=>e.apply(this,arguments))}:function(){let r=F_(()=>e.apply(this,arguments));for(let n of t)r=n(r,...arguments);return r}),F_=e=>{try{let t=e(),r;for(;;){let n=t.next(r);if(n.done)return _(n.value);let o=n.value;if(o&&o._tag===\"Success\"){r=o.value;continue}else{if(o&&o._tag===\"Failure\")return n.value;{let s=!0;return W(()=>s?(s=!1,B(n.value,a=>Ji(t,a))):W(()=>Ji(e())))}}}}catch(t){return js(t)}},Ji=(function(){let e=kn({op:\"Iterator\",[Ht](r,n){let o=this.iterator;for(;;){let s=o.next(r);if(s.done)return _(s.value);if(Be(s.value)){if(s.value._tag===\"Failure\")return s.value}else return n._stack.push(this),s.value;r=s.value.value}},[pt](r){return this[Ht](this.initial,r)}}),t=function(r,n){this.iterator=r,this.initial=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),Kt=l(2,(e,t)=>new qs(e,qE,_(t))),ax=function(e){return e._stack.push(this),this[de]},qW=kn({op:\"OnSuccess\",[pt]:ax}),qs=function(e,t,r){this[de]=e,this[Ht]=t,this.payload=r};qs.prototype=qW;var qE=function(){return this.payload},lR=function(e,t){return t.succeedWith(this.payload)},ix=(()=>{let e=\"~effect/Effect/stackProbe\";return{[e]:function(){return new Error().stack}}[e]()?.includes(\"[as \"+e+\"]\")===!0})(),HW=function(e,t){let r=this.payload;return t.succeedWith(ix?r(e):Ia(()=>r(e)))},pR=function(e){let t=this.payload;return t(e)},WW=function(e){let t=this.payload;return new qs(t(e),lR,e)},JW=function(e){return new qs(this.payload,lR,e)},Hu=e=>pe(e,O),dR=e=>Zu(e,{onFailure:_,onSuccess:Ze}),br=l(2,(e,t)=>new qs(e,ue(t)?qE:pR,t)),So=l(2,(e,t)=>new qs(e,ue(t)?JW:WW,t)),Wu=e=>new qs(e,qE,yr),mR=e=>Gr(e,Ze),HE=(e,t)=>re(r=>{let n=new Set;return Xu(r,()=>n.size===0?void 0:Wi(n)),Tt(o=>{let s=be(e),a=s.length,i=0,c=!1,u=[],f=(p,d,m)=>{if(i++,p._tag===\"Failure\"){u.push(...p.cause.reasons),i>=a&&o(_e(Rs(u)));return}let x=!c;c=!0,o(p),x&&t?.onWinner&&t.onWinner({fiber:d,index:m,parentFiber:r})};for(let p=0;p<a;p++){let d=is(r,s[p],!0,!0,!1);if(n.add(d),d.addObserver(m=>{n.delete(d),f(m,d,p)}),c)break}})}),WE=(e,t)=>re(r=>{let n=new Set;return Xu(r,()=>n.size===0?void 0:Wi(n)),Tt(o=>{let s=!1,a=0;for(let i of e){if(s)break;let c=a++,u=is(r,i,!0,!0,!1);n.add(u),u.addObserver(f=>{n.delete(u);let p=!s;s=!0,o(f),p&&t?.onWinner&&t.onWinner({fiber:u,index:c,parentFiber:r})})}})}),hR=l(e=>ue(e[1]),(e,t,r)=>HE([e,t],r)),JE=l(e=>ue(e[1]),(e,t,r)=>WE([e,t],r)),B=l(2,(e,t)=>new qs(e,pR,t)),xR=l(2,(e,t)=>Be(e)?e._tag===\"Success\"?t.onSuccess(e.value):t.onFailure(e.cause):yo(e,t)),Be=e=>e[Ti]!==void 0,gR=l(2,(e,t)=>Be(e)?e._tag===\"Success\"?t(e.value):e:B(e,t)),yR=e=>B(e,A),pe=l(2,(e,t)=>new qs(e,HW,t)),bR=l(2,(e,t)=>Be(e)?ZE(e,t):pe(e,t)),SR=l(2,(e,t)=>Be(e)?QE(e,t):oI(e,t)),ER=l(2,(e,t)=>Be(e)?YE(e,t):sI(e,t)),IR=l(2,(e,t)=>{if(Be(e)){if(e._tag===\"Success\")return e;let r=Vn(e.cause);return Q(r)?e:t(r.success)}return Kr(e,t)}),Ju=e=>ur($s(e)),Hs=e=>e._tag===\"Success\",TR=e=>e._tag===\"Success\"?P(e):D(e),wR=e=>e._tag===\"Success\"?P(e.value):D(e),GE=e=>e._tag===\"Failure\",CR=e=>e._tag===\"Failure\"?P(e):D(e),Op=e=>e._tag===\"Failure\"?P(e.cause):D(e),KE=fE(Op,Vn),kR=fE(Op,wp),VE=e=>e._tag===\"Failure\"&&tx(e.cause),AR=e=>e._tag===\"Failure\"&&ex(e.cause),vR=e=>e._tag===\"Failure\"&&RE(e.cause),yr=Ae(void 0),ZE=l(2,(e,t)=>e._tag===\"Success\"?Ae(t(e.value)):e),QE=l(2,(e,t)=>{if(e._tag===\"Success\")return e;let r=Vn(e.cause);return Q(r)?e:en(t(r.success))}),YE=l(2,(e,t)=>{if(e._tag===\"Success\")return Ae(t.onSuccess(e.value));let r=Vn(e.cause);return Q(r)?e:en(t.onFailure(r.success))}),GW=l(2,(e,t)=>Hs(e)?Ae(t):e),OR=l(2,(e,t)=>Hs(e)?t:e),_R=l(2,(e,t)=>Hs(e)?t.onSuccess(e.value):t.onFailure(e.cause)),RR=GW(void 0),XE=e=>{let t=[];for(let r of e)r._tag===\"Failure\"&&t.push(...r.cause.reasons);return t.length===0?yr:ur(Rs(t))},PR=e=>Hs(e)?O(e.value):v(),MR=e=>GE(e)?O(e.cause):v(),FR=e=>{let t=KE(e);return Q(t)?v():O(t.success)},UR=e=>e,NR=e=>re(t=>_(np(t.context,e))),KW=e=>re(t=>DE(np(t.context,e))),Gu=l(2,(e,t)=>re(r=>{let n=r.context,o=t(n);return n===o||(r.setContext(o),Xu(r,()=>{r.setContext(n)})),e})),Ws=l(3,(e,t,r)=>Gu(e,n=>{let o=qn(n,t),s=r(o);return o===s?n:Bt(n,t,s)})),DR=(e,t,r)=>Yi(re(n=>{let o=qn(n.context,e),s=t(o);return n.setContext(Bt(n.context,e,s)),as(qn(n.context,Ma),a=>{let i=np(n.context,e);if(fe(i))return le;let c=i.value,u;if(r?.reset===void 0){if(c!==s)return le;u=o}else u=r.reset(o,s,c);return n.setContext(Bt(n.context,e,u)),le})})),Zi=()=>VW,VW=re(e=>_(e.context)),Pa=e=>re(t=>e(t.context)),LR=l(2,(e,t)=>Gu(e,Ne(t))),Eo=l(2,(e,t)=>Be(e)?e:Gu(e,Fu(t))),Sr=function(){return arguments.length===1?l(2,(e,t)=>U_(e,arguments[0],t)):l(3,(e,t,r)=>U_(e,t,r)).apply(this,arguments)},U_=(e,t,r)=>Gu(e,Bt(t,r)),cx=l(3,(e,t,r)=>B(r,n=>Sr(e,t,n))),$R=l(e=>ue(e[1]),(e,t,r)=>eI(e,t,(n,o)=>[n,o],r)),eI=l(e=>ue(e[1]),(e,t,r,n)=>n?.concurrent?pe(Xi([e,t],{concurrency:2}),([o,s])=>r(o,s)):B(e,o=>pe(t,s=>r(o,s)))),BR=l(e=>ue(e[0]),(e,t,r)=>yI(e,t,r?n=>Ze(r(n)):()=>Ze(new uo))),zR=l(2,(e,t)=>B(t,r=>r?Hu(e):Vi)),tI=l(2,(e,t)=>Array.from({length:t},()=>e)),jR=l(e=>ue(e[0]),(e,t,r)=>Xi(tI(e,t),r)),Ku=l(e=>ue(e[0]),(e,t)=>To({while:mr,body:Ne(t?.disableYield?e:B(e,r=>qu)),step:vr})),Gr=l(2,(e,t)=>new qR(e,t.length!==1?r=>t(r):t)),ZW=kn({op:\"OnFailure\",[pt]:ax}),qR=function(e,t){this[de]=e,this[Cn]=t};qR.prototype=ZW;var rI=l(3,(e,t,r)=>Gr(e,n=>t(n)?r(n):_e(n))),Vu=l(3,(e,t,r)=>Gr(e,n=>{let o=t(n);return Q(o)?_e(o.failure):r(o.success,n)})),Kr=l(2,(e,t)=>Vu(e,Vn,r=>t(r))),HR=e=>Zu(e,{onFailure:t=>dh(t)?Vi:Ze(t),onSuccess:$E}),WR=l(2,(e,t)=>Vu(e,wp,t)),JR=l(2,(e,t)=>Gr(e,r=>br(t(r),_e(r)))),GR=l(3,(e,t,r)=>rI(e,t,n=>br(r(n),_e(n)))),ux=l(3,(e,t,r)=>Gr(e,n=>{let o=t(n);return Q(o)?_e(n):br(r(o.success,n),_e(n))})),nI=l(2,(e,t)=>ux(e,Vn,r=>t(r))),KR=l(3,(e,t,r)=>{let n=Array.isArray(t)?o=>w(o,\"_tag\")&&t.includes(o._tag):Nt(t);return nI(e,o=>n(o)?r(o):le)}),VR=l(2,(e,t)=>ux(e,wp,r=>t(r))),_p=l(e=>ue(e[0]),(e,t,r,n)=>Gr(e,o=>{let s=Vn(o);return Q(s)?_e(s.failure):t(s.success)?r(s.success):n?n(s.success):_e(o)})),fx=l(e=>ue(e[0]),(e,t,r,n)=>Gr(e,o=>{let s=Vn(o);if(Q(s))return _e(s.failure);let a=t(s.success);return Q(a)?n?n(a.failure):_e(o):r(a.success)})),lx=l(e=>ue(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>w(s,\"_tag\")&&t.includes(s._tag):Nt(t);return _p(e,o,r,n)}),ZR=l(e=>ue(e[0]),(e,t,r)=>{let n;return fx(e,o=>(n??=Object.keys(t),w(o,\"_tag\")&&ir(o._tag)&&n.includes(o._tag)?P(o):D(o)),o=>t[o._tag](o),r)}),QR=l(e=>ue(e[0]),(e,t,r,n,o)=>_p(e,s=>Nt(s,t)&&w(s,\"reason\")&&(o!==void 0||Nt(s.reason,r)),s=>{let a=s.reason;return Nt(a,r)?n(a,s):o?o(a,s):Ze(s)})),YR=l(e=>ue(e[0]),(e,t,r,n)=>{let o;return _p(e,s=>Nt(s,t)&&w(s,\"reason\")&&w(s.reason,\"_tag\")&&ir(s.reason._tag)&&(n!==void 0||(o??=Object.keys(r)).includes(s.reason._tag)),s=>{let a=s.reason;return o??=Object.keys(r),o.includes(a._tag)?r[a._tag](a,s):n?n(a,s):Ze(s)})}),XR=l(2,(e,t)=>fx(e,r=>Nt(r,t)&&w(r,\"reason\")?P(r.reason):D(r),Ze)),oI=l(2,(e,t)=>Kr(e,r=>ox(()=>t(r)))),sI=l(2,(e,t)=>Zu(e,{onFailure:r=>ox(()=>t.onFailure(r)),onSuccess:r=>V(()=>t.onSuccess(r))})),px=e=>Kr(e,js),eP=l(2,(e,t)=>Kr(e,r=>V(()=>t(r)))),tP=e=>W(()=>{let t=e[Symbol.iterator](),r=t.next();if(r.done)return js(new Error(\"Received an empty collection of effects\"));function n(o){let s=t.next();return s.done?o.value:Kr(o.value,a=>n(s))}return n(r)}),aI=e=>Kr(e,t=>B(qu,()=>aI(e))),dx=l(e=>ue(e[0]),(e,t)=>{if(!t?.log)return Zu(e,{onFailure:n=>le,onSuccess:n=>le});let r=wo(t.log===!0?void 0:t.log);return yo(e,{onFailure(n){let o=PE(n);return Q(o)?_e(o.failure):t.message===void 0?r(n):r(t.message,n)},onSuccess:n=>le})}),mx=l(e=>ue(e[0]),(e,t)=>{if(!t?.log)return yo(e,{onFailure:n=>le,onSuccess:n=>le});let r=wo(t.log===!0?void 0:t.log);return yo(e,{onFailure:n=>t.message===void 0?r(n):r(t.message,n),onSuccess:n=>le})}),rP=e=>hx(e,{onFailure:v,onSuccess:O}),Ra=e=>Rp(e,{onFailure:D,onSuccess:P}),yo=l(2,(e,t)=>new nP(e,t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure)),QW=kn({op:\"OnSuccessAndFailure\",[pt]:ax}),nP=function(e,t,r){this[de]=e,this[Ht]=t,this[Cn]=r};nP.prototype=QW;var YW=function(e,t){let r=this.payload;return t.succeedWith(ix?r.onSuccess(e):Ia(()=>r.onSuccess(e)))},oP=(e,t)=>{let r=kn({op:e,[pt]:ax,[Ht]:YW,[Cn]:t}),n=function(o,s){this[de]=o,this.payload=s};return n.prototype=r,n},XW=oP(\"Match\",function(e,t){let r=e.reasons.find(Ps);if(r===void 0)return _e(e);let n=this.payload;return t.succeedWith(ix?n.onFailure(r.error):Ia(()=>n.onFailure(r.error)))}),eJ=oP(\"MatchCause\",function(e,t){let r=this.payload;return t.succeedWith(ix?r.onFailure(e):Ia(()=>r.onFailure(e)))}),iI=l(2,(e,t)=>new eJ(e,t)),Zu=l(2,(e,t)=>yo(e,{onFailure:r=>{let n=r.reasons.find(Ps);return n?t.onFailure(n.error):_e(r)},onSuccess:t.onSuccess})),hx=l(2,(e,t)=>new XW(e,t)),Rp=l(2,(e,t)=>{if(Be(e)){if(e._tag===\"Success\")return Ae(t.onSuccess(e.value));let r=Vn(e.cause);return Q(r)?e:Ae(t.onFailure(r.success))}return hx(e,t)}),sP=l(2,(e,t)=>Be(e)?e._tag===\"Success\"?Ae(t.onSuccess(e.value)):Ae(t.onFailure(e.cause)):iI(e,t)),Qu=e=>Be(e)?Ae(e):tJ(e),tJ=ts({op:\"Exit\",[pt](e){return e._stack.push(this),this[de]},[Ht](e,t,r){return t.succeedWith(r??Ae(e))},[Cn](e,t,r){return t.succeedWith(r??ur(e))}}),aP=Rp({onFailure:()=>!0,onSuccess:()=>!1}),iP=Rp({onFailure:()=>!1,onSuccess:()=>!0}),cP=l(2,(e,t)=>br(Ua(t),e)),cI=l(2,(e,t)=>B(uI(e,t.duration),r=>fe(r)?t.orElse():_(r.value))),rJ=e=>new yp(`Operation timed out after '${Fh(e)}'`),uP=l(2,(e,t)=>{let r=ge(t);return cI(e,{duration:r,orElse:()=>Ze(rJ(r))})}),uI=l(2,(e,t)=>JE(Hu(e),Kt(Ua(t),v()))),fP=e=>nn(t=>{let r=t.monotonicTimeNanosUnsafe();return pe(e,n=>[An(t.monotonicTimeNanosUnsafe()-r),n])}),CE=\"~effect/Scope\",kE=\"~effect/Scope/Closeable\",Ma=fr(\"effect/Scope\"),fI=(e,t)=>re(r=>{let n=xx(e,t);return n===void 0?le:(aJ(r),n)}),xx=(e,t)=>{let r=e.state;if(r._tag===\"Closed\"||(e.state={_tag:\"Closed\",exit:t},e.parent!==void 0&&lI(e.parent,e),r._tag===\"Empty\"))return;if(r.finalizer!==void 0)return Zh(r.finalizer,t);let n=r.finalizers;return n.size===1?Zh(n.values().next().value,t):nJ(e,n,t)},Zh=(e,t)=>{try{return e(t)}catch(r){return Rr(r)}},lP=(e,t)=>Hs(e)?t:Gr(t,r=>_e(vi(e.cause,r))),nJ=vp(function*(e,t,r){let n=[],o=[],s=Array.from(t.values()),a=zs();for(let i=s.length-1;i>=0;i--){let c=s[i];e.strategy===\"sequential\"?n.push(yield*Qu(Zh(c,r))):o.push(is(a,Zh(c,r),!0,!0,\"inherit\"))}return o.length>0&&(n=yield*kp(o)),yield*XE(n)});var pP=(e,t)=>{let r=mP(t,e);return e.state._tag===\"Closed\"?(r.state=e.state,r):(Yu(e,r,n=>fI(r,n)),r)},as=(e,t)=>W(()=>e.state._tag===\"Closed\"?t(e.state.exit):(Yu(e,{},t),le)),dP=(e,t)=>as(e,Ne(t)),Yu=(e,t,r)=>{if(e.state._tag===\"Empty\")e.state={_tag:\"Open\",finalizerKey:t,finalizer:r,finalizers:void 0};else if(e.state._tag===\"Open\"){let n=e.state;n.finalizer!==void 0&&(n.finalizers=new Map([[n.finalizerKey,n.finalizer]]),n.finalizerKey=void 0,n.finalizer=void 0),n.finalizers.set(t,r)}},lI=(e,t)=>{if(e.state._tag!==\"Open\")return;let r=e.state;r.finalizerKey===t?e.state=AE:r.finalizers!==void 0&&(r.finalizers.delete(t),r.finalizers.size===0&&(e.state=AE))},gx=e=>mP(e,void 0),mP=(e=\"sequential\",t)=>({[kE]:kE,[CE]:CE,strategy:e,parent:t,state:AE}),AE={_tag:\"Empty\"};var Qi=Ma,hP=Sr(Ma),yx=e=>re(t=>{let r=t.context,n=gx();return t.setContext(Bt(t.context,Ma,n)),Xu(t,o=>(t.setContext(r),xx(n,o))),e});var bx=e=>W(()=>{let t=gx();return On(e(t),r=>W(()=>xx(t,r)??le))}),Sx=(e,t,r)=>Pa(n=>Vr(o=>B(Qi,s=>So(r?.interruptible?o(e):e,a=>as(s,i=>Eo(t(a,i),n)))))),Fa=e=>B(Qi,t=>Pa(r=>as(t,n=>Eo(e(n),r)))),xP=(function(){let e=kn({op:\"OnExit\",[pt](r){return r._stack.push(this),this.effect},[wi](r){r.interruptible&&this.interruptible!==!0&&(r._stack.push(Pp),r.interruptible=!1)},[Ht](r,n,o){o??=Ae(r);let s;try{s=this.onExit(o)}catch(a){s=Rr(a)}return s?B(s,a=>o):o},[Cn](r,n,o){o??=ur(r);let s;try{s=this.onExit(o)}catch(a){s=Rr(a)}return s?B(lP(o,s),a=>o):o}}),t=function(r,n,o){this.effect=r,this.onExit=n,this.interruptible=o};return t.prototype=e,t})(),Io=(e,t,r)=>new xP(e,t,r),Xu=(e,t)=>{e._stack.push(new xP(void 0,t,void 0))},On=l(2,Io),gP=l(2,(e,t)=>On(e,r=>t)),pI=l(3,(e,t,r)=>On(e,n=>t(n)?r(n):le)),dI=l(3,(e,t,r)=>On(e,n=>{let o=t(n);return Q(o)?le:r(o.success,n)})),mI=l(2,(e,t)=>dI(e,Op,t)),yP=l(3,(e,t,r)=>pI(e,n=>n._tag!==\"Failure\"?!1:t(n.cause),n=>r(n.cause))),hI=l(3,(e,t,r)=>On(e,n=>{if(n._tag!==\"Failure\")return le;let o=t(n.cause);return Q(o)?le:r(o.success,n.cause)})),bP=l(2,(e,t)=>hI(rx,t)(e)),SP=(e,t,r)=>Vr(n=>B(e,o=>Io(W(()=>n(t(o))),s=>r(o,s),!0))),EP=e=>Sx(e,t=>w(t,Symbol.asyncDispose)?BE(()=>t[Symbol.asyncDispose]()):V(()=>t[Symbol.dispose]())),xI=l(2,(e,t)=>V(()=>IP(e,typeof t==\"function\"?r=>Ye(ge(t(r))):Ne(Ye(ge(t)))))),oJ=Ne(1/0),IP=(e,t)=>{let r=0,n,o,s=(a,i)=>(i.awaiters++,Xu(a,()=>{if(!(--i.awaiters>0||o!==i))return o=void 0,Gi(i.fiber)}),NE(i.fiber));return[re(a=>{if(o!==void 0)return s(a,o);if(n!==void 0&&(r===1/0||a.getRef(Mr).currentTimeMillisUnsafe()<r))return n;n=void 0;let i=a.getRef(Mr),c={fiber:void 0,awaiters:0};return o=c,c.fiber=is(a,Io(e,u=>{if(o!==c||(o=void 0,VE(u)))return;let f=t(u);r=f===1/0?1/0:i.currentTimeMillisUnsafe()+f,n=u}),!0,!0),c.fiber._exit??s(a,c)}),V(()=>{n=void 0})]},TP=l(2,(e,t)=>pe(xI(e,t),r=>r[0])),wP=e=>V(()=>IP(e,oJ)[0]),CP=re(e=>_e($s(e.id))),Yi=e=>re(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(Pp)),e)),kP=ts({op:\"SetInterruptible\",[wi](e){if(e.interruptible=this[de],e._interruptedCause&&e.interruptible)return()=>_e(e._interruptedCause)}}),Pp=kP(!0),sJ=kP(!1),AP=e=>{if(e.interruptible=!0,e._stack.push(sJ),e._interruptedCause)return _e(e._interruptedCause)},aJ=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(Pp))};var Ex=e=>re(t=>t.interruptible?e:AP(t)??e),Vr=e=>re(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Pp),e(Ex)):e(A)),vP=e=>re(t=>{if(t.interruptible)return e(A);let r=AP(t),n=e(Yi);return r??n}),OP=pe(Sx(V(()=>new AbortController),e=>V(()=>e.abort())),e=>e.signal),Xi=(e,t)=>Qo(e)?t?.mode===\"result\"?Jr(e,Ra,t):Jr(e,A,t):t?.discard?t.mode===\"result\"?Jr(Object.values(e),Ra,t):Jr(Object.values(e),A,t):W(()=>{let r={};return Kt(Jr(Object.entries(e),([n,o])=>pe(t?.mode===\"result\"?Ra(o):o,s=>{N(r,n,s)}),{discard:!0,concurrency:t?.concurrency}),r)}),gI=l(e=>Qo(e[0])&&!ue(e[0]),(e,t,r)=>pe(Jr(e,(n,o)=>Ra(t(n,o)),r),n=>uE(n,A))),_P=l(3,(e,t,r)=>{let n=be(e);return n.length===0?V(t):W(()=>{let o=0,s=t();return pe(To({while:()=>o<n.length,body:()=>r(s,n[o],o),step(a){s=a,o++}}),()=>s)})}),RP=l(e=>Qo(e[0])&&!ue(e[0]),(e,t,r)=>B(gI(e,t,{concurrency:r?.concurrency}),([n,o])=>gr(o)?Ze(o):r?.discard?le:_(n))),PP=l(e=>Qo(e[0])&&!ue(e[0]),(e,t)=>W(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?_(v()):MP(r,0,t,n.value)})),MP=(e,t,r,n)=>B(r(n,t),o=>{if(o)return _(O(n));let s=e.next();return s.done?_(v()):MP(e,t+1,r,s.value)}),FP=l(e=>Qo(e[0])&&!ue(e[0]),(e,t)=>W(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?_(v()):UP(r,0,t,n.value)})),UP=(e,t,r,n)=>B(r(n,t),o=>{if(ze(o))return _(O(o.success));let s=e.next();return s.done?_(v()):UP(e,t+1,r,s.value)}),To=ts({op:\"While\",[Ht](e,t){return this[de].step(e),this[de].while()?(t._stack.push(this),this[de].body()):yr},[pt](e){return this[de].while()?(e._stack.push(this),this[de].body()):yr}}),Jr=l(e=>typeof e[1]==\"function\",(e,t,r)=>W(()=>{let n=Mp(r?.concurrency);if(n===1)return iJ(e,t,r);let o=be(e),s=o.length;if(s===0)return r?.discard?le:_([]);let a=r?.discard?void 0:new Array(s),i=cJ({f:t,out:a},o,{concurrency:n});return i?Kt(i,a):_(a)})),NP=e=>B(e,t=>{let r=t[Symbol.iterator]().next();return r.done?Ze(new uo):_(r.value)}),iJ=(e,t,r)=>W(()=>{let n=r?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),a=0;return Kt(To({while:()=>!s.done,body:()=>t(s.value,a++),step:i=>{n&&n.push(i),s=o.next()}}),n)}),Mp=e=>e===\"unbounded\"?Number.POSITIVE_INFINITY:Math.max(1,e??1),Ix=()=>e=>{let t=e.onItem,r=e.step,n=(s,a,i,c,u)=>B(Qu(u),f=>r(s,a[i],f,i)??o(s,a,i+1,c)??le),o=(s,a,i=0,c=a.length)=>{for(;i<c;i++){let u=a[i],f=t(s,u,i);if(!Be(f))return n(s,a,i,c,f);let p=r(s,u,f,i);if(p)return p._tag===\"Failure\"?p:void 0}};return o},DP=e=>{let t=e.onItem,r=e.step;return(n,o,s)=>{let a=0,i=s.end??o.length,c=s.concurrency,u=!1,f,p,d,m,x,g=S=>{let E=Rr(S);return m=E,u=!0,p&&p.size>0?B(Yi(Wi(Array.from(p))),()=>m??E):E},y=()=>{let S=!1;for(;!m&&a<i;a++){let E=o[a],U=x??t(n,E,a);if(Be(U)){if(m=r(n,E,U,a),m)break}else if(f){x=void 0;let F=is(f,U,!0,!0,\"inherit\");if(F._exit){if(m=r(n,E,F._exit,a),m)break;continue}p.add(F);let h=a;if(F.addObserver(I=>{p.delete(F);try{if(m){if(I._tag===\"Failure\"){let C=I.cause.reasons.filter(k=>k._tag!==\"Interrupt\");if(C.length>0){let k=Rs(C);m=ur(m._tag===\"Failure\"?vi(m.cause,k):k)}}}else{let C=r(n,E,I,h);C&&(m=C,y())}if(S){let C=y();C&&d(C)}else u&&p.size===0&&d(m??le)}catch(C){d(g(C))}}),p.size<c)continue;S=!0,a++;return}else return Tt(F=>{f=zs(),p=new Set,x=U,d=F;let h;try{h=y()}catch(I){return F(g(I))}return h?F(h):W(()=>(m??=yr,B(p?Wi(p):le,()=>m?._tag===\"Failure\"?m:le)))})}if(u=!0,m){if(p&&p.size>0){let E=Cp(f);p.forEach(U=>U.interruptUnsafe(f.id,E));return}if(d||m._tag===\"Failure\")return m}else if(d)if(p)p.size===0&&d(le);else return yr};return y()}},Tx=()=>e=>DP(e),cJ=DP({onItem(e,t,r){return e.f(t,r)},step(e,t,r,n){if(r._tag===\"Failure\")return r;e.out&&(e.out[n]=r.value)}}),yI=l(3,(e,t,r)=>B(e,n=>t(n)?_(n):r(n))),bI=l(3,(e,t,r)=>B(e,n=>{let o=t(n);return Q(o)?r(o.failure):_(o.success)})),LP=l(e=>ue(e[0]),(e,t,r)=>bI(e,t,r?n=>Ze(r(n)):()=>Ze(new uo))),$P=l(e=>Qo(e[0])&&!ue(e[0]),(e,t,r)=>W(()=>{let n=[];return Kt(Jr(e,(o,s)=>{let a=t(o,s);return typeof a==\"boolean\"?(a&&n.push(o),le):pe(a,i=>{i&&n.push(o)})},{discard:!0,concurrency:r?.concurrency}),n)})),BP=l(e=>Qo(e[0])&&!ue(e[0]),(e,t)=>W(()=>{let r=[];for(let n of e){let o=t(n);ze(o)&&r.push(o.success)}return _(r)})),zP=l(e=>Qo(e[0])&&!ue(e[0]),(e,t,r)=>W(()=>{let n=[];return Kt(Jr(e,o=>pe(t(o),s=>{ze(s)&&n.push(s.success)}),{discard:!0,concurrency:r?.concurrency}),n)})),jP=_({}),qP=bu(pe),HP=Su(pe,B),WP=yu(pe);var JP=l(e=>ue(e[0]),(e,t)=>re(r=>(EJ(),_(is(r,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),is=(e,t,r=!1,n=!1,o=!1)=>{let s=e,a=o===\"inherit\"?s.interruptible:!o,i=new Vh(s.context,a);return r?i.evaluate(t):(i._asyncContext=Q_(),s.currentDispatcher.scheduleTask(()=>i.evaluate(t),0)),!n&&!i._exit&&(s.children().add(i),i._parent=s),i},wx=l(e=>ue(e[0]),(e,t)=>re(r=>_(is(r,e,t?.startImmediately,!0,t?.uninterruptible)))),GP=e=>re(t=>{let r=t._children&&new Set(t._children),n=t.interruptible;return Io(e,o=>{let s=t._children;if(s===void 0||s.size===0)return le;r&&(s=o_(s,i=>!r.has(i)));let a=Wu(kp(s));return n?Ex(a):a})}),SI=l(e=>ue(e[0]),(e,t,r)=>re(n=>{let o=is(n,e,r?.startImmediately,!0,r?.uninterruptible);if(!o._exit)if(t.state._tag!==\"Closed\"){let s={};Yu(t,s,()=>aR(i=>i===o.id?le:Gi(o))),o.addObserver(()=>lI(t,s))}else o.interruptUnsafe(n.id,Cp(n));return _(o)})),KP=l(e=>ue(e[0]),(e,t)=>B(Qi,r=>SI(e,r,t))),Js=e=>(t,r)=>{let n=new Vh(r?.scheduler?Bt(e,lp,r.scheduler):e,r?.uninterruptible!==!0);if(n.evaluate(t),n._exit)return n;if(r?.signal)if(r.signal.aborted)n.interruptUnsafe();else{let o=()=>n.interruptUnsafe();r.signal.addEventListener(\"abort\",o,{once:!0}),n.addObserver(()=>r.signal.removeEventListener(\"abort\",o))}return r?.onFiberStart&&r.onFiberStart(n),n},VP=l(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===\"Closed\")return e.interruptUnsafe(e.id),e;let r={};return Yu(t,r,()=>Gi(e)),e.addObserver(()=>lI(t,r)),e}),ZP=Js(Xt()),EI=e=>{let t=Js(e);return(r,n)=>{let o=t(r,n);return n?.onExit&&o.addObserver(n.onExit),s=>o.interruptUnsafe(s)}},QP=EI(Xt()),Cx=e=>{let t=Js(e);return(r,n)=>{let o=t(r,n);return new Promise(s=>{o.addObserver(a=>s(a))})}},YP=Cx(Xt()),II=e=>{let t=Cx(e);return(r,n)=>t(r,n).then(o=>{if(o._tag===\"Failure\")throw nx(o.cause);return o.value})},XP=II(Xt()),kx=e=>{let t=Js(e);return r=>{if(Be(r))return r;let n=new ji(\"sync\"),o=t(r,{scheduler:n});return o._dispatcher?.flush(),o._exit??Rr(new Ip(o))}},eM=kx(Xt()),TI=e=>{let t=kx(e);return r=>{let n=t(r);if(n._tag===\"Failure\")throw nx(n.cause);return n.value}},tM=TI(Xt()),N_=_(!0),D_=_(!1),vE=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return N_;if(this.scheduled===void 0)this.scheduled=this.waiters,t.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let r=0;r<this.waiters.length;r++)this.scheduled.push(this.waiters[r]);return this.waiters=[],N_}flushScheduled=()=>{if(this.scheduled===void 0)return;let t=this.scheduled;this.scheduled=void 0;for(let r=0;r<t.length;r++)t[r](yr)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let r=0;r<t.length;r++)t[r](yr)}open=re(t=>this._isOpen?D_:(this._isOpen=!0,this.scheduleUnsafe(t)));release=re(t=>this._isOpen?D_:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=Tt(t=>this._isOpen?t(le):(this.waiters.push(t),V(()=>{let r=this.waiters.indexOf(t);r!==-1?this.waiters.splice(r,1):this.scheduled!==void 0&&(r=this.scheduled.indexOf(t),r!==-1&&this.scheduled.splice(r,1))})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=V(()=>this.closeUnsafe());whenOpen=t=>B(this.await,()=>t);isOpen(){return this._isOpen}},wI=e=>new vE(e??!1),rM=e=>V(()=>wI(e)),nM=re(e=>_(e.getRef(Hh))),oM=l(2,(e,t)=>Sr(e,Hh,t)),sM=Sr(Gh),aM=Sr(Hi),Qh=BigInt(0),uJ={_tag:\"Span\",spanId:\"noop\",traceId:\"noop\",sampled:!1,status:{_tag:\"Ended\",startTime:Qh,endTime:Qh,exit:yr},attributes:new Map,links:[],kind:\"internal\",attribute(){},event(){},end(){},addLinks(){}},fJ=e=>Object.assign(Object.create(uJ),e),iM=e=>e?Ie(e.annotations,pp)?e._tag===\"Span\"?iM(lo(e.parent)):v():O(e):v(),CI=(e,t,r)=>{let n=!e.cache.tracerEnabled||r?.annotations&&Ie(r.annotations,pp),o=r?.parent!==void 0?O(r.parent):r?.root?v():iM(e.cache.span),s;if(n)s=fJ({name:t,parent:o,annotations:Bt(r?.annotations??Xt(),pp,!0)});else{let a=e.cache.tracer??Wh,i=e.getRef(Mr),c=e.getRef(Hi),u=e.getRef(mp),f=e.getRef(hp),p=r?.level??e.getRef(gE),d=r?.links!==void 0?[...f,...r.links]:f.length===0?[]:f.slice();s=a.span({name:t,parent:o,annotations:r?.annotations??Xt(),links:d,startTime:c?i.currentTimeNanosUnsafe():Qh,kind:r?.kind??\"internal\",root:r?.root??fe(o),sampled:r?.sampled??(Oe(o)&&o.value.sampled===!1?!1:!AM(e.getRef(yE),p))});for(let m in u)s.attribute(m,u[m]);if(r?.attributes!==void 0)for(let m in r.attributes)s.attribute(m,r.attributes[m])}return s},cM=(e,t)=>re(r=>_(CI(r,e,t))),bo=(e,t)=>Yi(re(r=>{let n=qn(r.context,Ma),o=CI(r,e,t??{}),s=r.getRef(Mr),a=r.getRef(Hi);return Kt(as(n,i=>Ax(o,i,s,a)),o)})),uM=function(){let e=typeof arguments[0]!=\"string\",t=e?arguments[1]:arguments[0],r=Gn(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return B(bo(t,r),o=>zu(n,o,r))}return n=>B(bo(t,r),o=>zu(n,o,r))},lJ=(e,t)=>(t=typeof t==\"function\"?t:Hr,Ws($u,r=>({name:e,stack:t,parent:r}))),fM=mp,lM=hp,pM=l(e=>ue(e[0]),(e,t,r={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:r}));return Ws(e,hp,s=>[...s,...o])}),Ax=(e,t,r,n)=>V(()=>{e.status._tag!==\"Ended\"&&e.end(n?r.currentTimeNanosUnsafe():Qh,t)}),xp=(e,...t)=>{let r=t.length===1?void 0:t[0],n=t[t.length-1];return re(o=>{let s=CI(o,e,r),a=o.getRef(Mr),i=o.getRef(Hi);return Xu(o,c=>Ax(s,c,a,i)),n(s)})},OE=Sr(xo),zu=function(){let e=ue(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=A;return t._tag===\"Span\"&&(r=Gn(r),n=lJ(t.name,r?.captureStackTrace)),e?OE(n(arguments[0]),t):o=>OE(n(o),t)},dM=function(){let e=typeof arguments[0]!=\"string\",t=e?arguments[1]:arguments[0],r=Gn(arguments[2]);if(e){let s=arguments[0];return xp(t,arguments[2],a=>zu(s,a,r))}let n=typeof arguments[1]==\"function\"?arguments[1]:void 0,o=n?void 0:arguments[1];return(s,...a)=>xp(t,n?n(...a):o,i=>zu(s,i,r))},mM=l(e=>ue(e[0]),(e,...t)=>Ws(e,mp,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||N(n,t[0],t[1]),n})),hM=(...e)=>re(t=>{let r=t.currentSpanLocal;if(r)if(e.length===1)for(let[n,o]of Object.entries(e[0]))r.attribute(n,o);else r.attribute(e[0],e[1]);return le}),xM=re(e=>{let t=e.currentSpanLocal;return t?_(t):Ze(new uo)}),gM=KW(xo),Mr=Se(\"effect/Clock\",{defaultValue:()=>new _E}),IE=2**31-1,_E=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=V(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return pJ()}currentTimeNanos=V(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return bM()}monotonicTimeNanos=V(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Ye(t))}sleepMillis(t){return t<=0?qu:Number.isFinite(t)?Tt(r=>{let n=t>IE?this.sleepMillis(t-IE):le,o=setTimeout(()=>r(n),Math.min(t,IE));return V(()=>clearTimeout(o))}):Ap}},yM=BigInt(1e6),bM=(function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint==\"function\")return()=>e.bigint();if(typeof performance<\"u\"&&typeof performance.now==\"function\")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let r=BigInt(Date.now())*yM;return r>t&&(t=r),t}})(),pJ=(function(){let e=BigInt(1e9),t;return()=>{let r=bM(),n=BigInt(Date.now())*yM;if(t===void 0)t=n-r;else{let o=t+r;(n>o?n-o:o-n)>e&&(t=n-r)}return t+r}})(),nn=e=>re(t=>e(t.getRef(Mr))),Ua=e=>nn(t=>t.sleep(ge(e))),vx=nn(e=>e.currentTimeMillis),SM=nn(e=>e.currentTimeNanos),EM=nn(e=>e.monotonicTimeNanos),gp=\"~effect/Cause/TimeoutError\",IM=e=>w(e,gp),yp=class extends Ms(\"TimeoutError\"){[gp]=gp;constructor(t){super({message:t})}},bp=\"~effect/Cause/IllegalArgumentError\",TM=e=>w(e,bp),Yh=class extends Ms(\"IllegalArgumentError\"){[bp]=bp;constructor(t){super({message:t})}},Sp=\"~effect/Cause/ExceededCapacityError\",wM=e=>w(e,Sp),Xh=class extends Ms(\"ExceededCapacityError\"){[Sp]=Sp;constructor(t){super({message:t})}},Ep=\"~effect/Cause/AsyncFiberError\",CM=e=>w(e,Ep),Ip=class extends Ms(\"AsyncFiberError\"){[Ep]=Ep;constructor(t){super({message:\"An asynchronous Effect was executed with Effect.runSync\",fiber:t})}},Tp=\"~effect/Cause/UnknownError\",kM=e=>w(e,Tp),ju=class extends Ms(\"UnknownError\"){[Tp]=Tp;constructor(t,r){super({message:r,cause:t})}},ec=Se(\"effect/Console\",{defaultValue:()=>globalThis.console}),dJ=e=>{switch(e){case\"All\":return Number.MIN_SAFE_INTEGER;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 Number.MAX_SAFE_INTEGER}},mJ=NS(Wr,dJ),AM=ns(mJ),ef=Se(\"effect/Logger/CurrentLoggers\",{defaultValue:()=>new Set([_I,RI])}),Ox=Se(\"effect/Logger/LogToStderr\",{defaultValue:Rl}),vM=function(){let e=typeof arguments[0]==\"string\"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return Yi(re(t=>{let r=t.getRef(go),n={...r};for(let o=0;o<e.length;o++){let[s,a]=e[o];N(n,s,a)}return t.setContext(Bt(t.context,go,n)),as(qn(t.context,Ma),o=>{let s=t.getRef(go),a={...s};for(let i=0;i<e.length;i++){let[c,u]=e[i];s[c]!==u&&!Object.is(s[c],u)||(Object.hasOwn(r,c)?N(a,c,r[c]):delete a[c])}return t.setContext(Bt(t.context,go,a)),le})}))},hJ=\"~effect/Logger\",xJ={[hJ]:{_Message:A,_Output:A},pipe(){return K(this,arguments)}},on=e=>{let t=Object.create(xJ);return t.log=e,t},kI=e=>e.replace(/[\\s=\"]/g,\"_\"),Fp=(e,t)=>`${kI(e[0])}=${t-e[1]}ms`,tf=e=>{switch(typeof e){case\"function\":case\"symbol\":return String(e);default:return $t(e)}},wo=e=>(...t)=>{let r;for(let n=0,o=t.length;n<o;n++){let s=t[n];Cu(s)&&(r?t.splice(n,1):t=t.slice(0,n).concat(t.slice(n+1)),r=r?Rs(r.reasons.concat(s.reasons)):s,n--)}return r===void 0&&(r=lh),re(n=>{let o=e??n.cache.logLevel;if(AM(n.cache.minimumLogLevel,o))return le;let s=n.getRef(Mr),a=n.getRef(ef);if(a.size>0){let i=new Date(s.currentTimeMillisUnsafe());for(let c of a)c.log({cause:r,fiber:n,date:i,logLevel:o,message:t})}return le})},gJ=(e,...t)=>{let r=\"\";for(let n=0;n<t.length;n++)r+=`\\x1B[${t[n]}m`;return r+e+\"\\x1B[0m\"},yJ=(e,...t)=>e,Kn={bold:\"1\",red:\"31\",green:\"32\",yellow:\"33\",blue:\"34\",cyan:\"36\",white:\"37\",gray:\"90\",black:\"30\",bgBrightRed:\"101\"},bJ={None:[],All:[],Trace:[Kn.gray],Debug:[Kn.blue],Info:[Kn.green],Warn:[Kn.yellow],Error:[Kn.red],Fatal:[Kn.bgBrightRed,Kn.black]},SJ={None:\"\",All:\"\",Trace:\"color:gray\",Debug:\"color:blue\",Info:\"color:green\",Warn:\"color:orange\",Error:\"color:red\",Fatal:\"background-color:red;color:white\"},AI=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\")}`,OM=e=>{let t=globalThis.process,r=typeof t?.stdout==\"object\"&&t.stdout!==null,n=\"Deno\"in globalThis,o=e?.mode??\"auto\";return(o===\"auto\"?r||n:o===\"tty\")?vI(e):OI(e)},vI=e=>{let t=e?.formatDate??AI,r=globalThis.process,o=typeof r?.stdout==\"object\"&&r.stdout!==null&&r.stdout.isTTY===!0,a=(typeof e?.colors==\"boolean\"?e.colors:o)?gJ:yJ,i=r?.isBun===!0;return on(({cause:c,date:u,fiber:f,logLevel:p,message:d})=>{let m=f.getRef(ec),x=f.getRef(Ox)?m.error:m.log,g=Array.isArray(d)?d.slice():[d],y=a(`[${t(u)}]`,Kn.white)+` ${a(p.toUpperCase(),...bJ[p])} (#${f.id})`,S=u.getTime(),E=f.getRef(Bu);for(let h of E)y+=\" \"+Fp(h,S);y+=\":\";let U=0;if(g.length>0){let h=tf(g[0]);typeof h==\"string\"&&(y+=\" \"+a(h,Kn.bold,Kn.cyan),U++)}if(x(y),i||m.group(),c.reasons.length>0&&x(Bs(c)),U<g.length)for(;U<g.length;U++)x(zn(g[U]));let F=f.getRef(go);for(let[h,I]of Object.entries(F))x(a(`${h}:`,Kn.bold,Kn.white),zn(I));i||m.groupEnd()})},OI=e=>{let t=e?.colors!==!1,r=t?\"%c\":\"\",n=e?.formatDate??AI;return on(({cause:o,date:s,fiber:a,logLevel:i,message:c})=>{let u=a.getRef(ec),f=Array.isArray(c)?c.slice():[c],p=`${r}[${n(s)}]`,d=[];t&&d.push(\"color:gray\"),p+=` ${r}${i.toUpperCase()}${r} (#${a.id})`,t&&d.push(SJ[i],\"\");let m=s.getTime(),x=a.getRef(Bu);for(let S of x)p+=\" \"+Fp(S,m);p+=\":\";let g=0;if(f.length>0){let S=tf(f[0]);typeof S==\"string\"&&(p+=` ${r}${S}`,t&&d.push(\"color:deepskyblue\"),g++)}if(u.groupCollapsed(p,...d),o.reasons.length>0&&u.error(Bs(o)),g<f.length)for(;g<f.length;g++)u.log(zn(f[g]));let y=a.getRef(go);for(let[S,E]of Object.entries(y)){let U=zn(E);t?u.log(`%c${S}:`,\"color:gray\",U):u.log(`${S}:`,U)}u.groupEnd()})},_I=on(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(Bs(e));let a=t.getTime(),i=r.getRef(Bu),c=\"\";for(let d of i)c+=` ${Fp(d,a)}`;let u=r.getRef(go);Object.keys(u).length>0&&s.push(u);let f=r.getRef(ec);(r.getRef(Ox)?f.error:f.log)(`[${AI(t)}] ${n.toUpperCase()} (#${r.id})${c}:`,...s)}),RI=on(({cause:e,fiber:t,logLevel:r,message:n})=>{let o=t.getRef(Mr),s=t.getRef(go),a=t.cache.span;if(a===void 0||a._tag===\"ExternalSpan\")return;let i={};for(let[c,u]of Object.entries(s))N(i,c,u);i[\"effect.fiberId\"]=t.id,i[\"effect.logLevel\"]=r.toUpperCase(),e.reasons.length>0&&(i[\"effect.cause\"]=Bs(e)),a.event(aO(Array.isArray(n)&&n.length===1?n[0]:n),o.currentTimeNanosUnsafe(),i)});function EJ(){wE.interruptChildren??=zW}var Up=_(void 0);var _M=l(e=>ue(e[0]),(e,t)=>mI(e,r=>re(n=>(IJ(n,r,t?.defectsOnly),le)))),IJ=(e,t,r)=>{let n=e.getRef(__);if(n.size===0||r&&!ex(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(Mr).currentTimeNanosUnsafe()};n.forEach(s=>s.report(o))};var Np=RS,Fr=Ae,sn=ur,Gs=en,PI=Rr,MI=Ju,ht=yr;var je=Hs,Co=GE,TJ=vR,wJ=AR,FI=VE,CJ=TR,kJ=wR,AJ=CR,vJ=Op,OJ=KE,_J=kR,UI=_R,RJ=ZE,PJ=QE,MJ=YE,FJ=RR,UJ=XE,NJ=PR,DJ=MR,LJ=FR;var La={};$e(La,{CurrentMemoMap:()=>rc,build:()=>GM,buildWithMemoMap:()=>Ks,buildWithScope:()=>Bp,catch:()=>lG,catchCause:()=>dG,catchTag:()=>pG,effect:()=>sf,effectContext:()=>zI,effectDiscard:()=>nG,empty:()=>tG,flatMap:()=>ZM,forkMemoMap:()=>eG,forkMemoMapUnsafe:()=>BI,fresh:()=>mG,fromBuild:()=>Da,fromBuildMemo:()=>Fx,isLayer:()=>Mx,launch:()=>hG,makeMemoMap:()=>XJ,makeMemoMapUnsafe:()=>us,merge:()=>sG,mergeAll:()=>Ux,mock:()=>xG,orDie:()=>fG,parentSpan:()=>YM,provide:()=>of,provideMerge:()=>aG,satisfiesErrorType:()=>bG,satisfiesServicesType:()=>SG,satisfiesSuccessType:()=>yG,span:()=>EG,succeed:()=>zp,succeedContext:()=>nc,suspend:()=>oG,sync:()=>rG,syncContext:()=>DI,tap:()=>iG,tapCause:()=>uG,tapError:()=>cG,unwrap:()=>LI,updateService:()=>QM,withParentSpan:()=>$I,withSpan:()=>IG});var nf={};$e(nf,{await:()=>tc,complete:()=>jJ,completeWith:()=>MM,die:()=>UM,dieSync:()=>WJ,done:()=>rf,doneUnsafe:()=>_n,fail:()=>FM,failCause:()=>NI,failCauseSync:()=>HJ,failSync:()=>qJ,interrupt:()=>JJ,interruptWith:()=>Dp,into:()=>_x,isDeferred:()=>$J,isDone:()=>GJ,isDoneUnsafe:()=>NM,make:()=>zJ,makeUnsafe:()=>ko,poll:()=>KJ,succeed:()=>DM,sync:()=>VJ});var RM=\"~effect/Deferred\",$J=e=>w(e,RM),BJ={[RM]:{_A:A,_E:A},pipe(){return K(this,arguments)}},PM=function(){this.resumes=void 0,this.effect=void 0};PM.prototype=BJ;var ko=()=>new PM,zJ=()=>V(()=>ko()),tc=e=>Tt(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),V(()=>{let r=e.resumes;if(r===void 0)return;let n=r.indexOf(t);n>=0&&r.splice(n,1)})));var jJ=l(2,(e,t)=>W(()=>e.effect?_(!1):_x(t,e))),MM=l(2,(e,t)=>V(()=>_n(e,t))),rf=MM,FM=l(2,(e,t)=>rf(e,en(t))),qJ=l(2,(e,t)=>W(()=>FM(e,t()))),NI=l(2,(e,t)=>rf(e,ur(t))),HJ=l(2,(e,t)=>W(()=>NI(e,t()))),UM=l(2,(e,t)=>rf(e,Rr(t))),WJ=l(2,(e,t)=>W(()=>UM(e,t()))),JJ=e=>re(t=>Dp(e,t.id)),Dp=l(2,(e,t)=>NI(e,$s(t))),GJ=e=>V(()=>NM(e)),NM=e=>e.effect!==void 0;function KJ(e){return V(()=>Ns(e.effect))}var DM=l(2,(e,t)=>rf(e,Ae(t))),VJ=l(2,(e,t)=>W(()=>DM(e,t()))),_n=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let r=e.resumes;e.resumes=void 0;for(let n=0;n<r.length;n++)r[n](t)}return!0},_x=l(2,(e,t)=>Vr(r=>B(Qu(r(e)),n=>rf(t,n))));var Lp=go;var $p=Bu,LM=$u;var $M=Hi;var Ur=Ma;var an=gx,Zn=hP,cs=as,Ir=dP;var wt=pP,De=fI;var JM=\"~effect/Layer\",BM=\"~effect/Layer/MemoMap\",QJ=(e,t)=>{let r={observers:0,deferred:ko(),scope:an(),finalizer:n=>W(()=>--r.observers>0?le:(e.map.delete(t),De(r.scope,n)))};return r},zM=(e,t)=>t.state._tag===\"Closed\"?!1:(e.observers++,Yu(t,{},e.finalizer),!0),Mx=e=>w(e,JM),YJ={[JM]:{_ROut:A,_E:A,_RIn:A},pipe(){return K(this,arguments)}},oc=e=>{let t=Object.create(YJ);return t.build=e,t},Da=e=>oc((t,r)=>{let n=wt(r);return On(e(t,n),o=>o._tag===\"Failure\"?De(n,o):le)}),Fx=e=>{let t=Da((r,n)=>r.getOrElseMemoize(t,n,e));return t},Px=class{get[BM](){return BM}parent;constructor(t){this.parent=t}map=new Map;get(t,r){let n=this.map.get(t);return n?(zM(n,r),n.deferred.effect??tc(n.deferred)):this.parent?.get(t,r)}getOrElseMemoize(t,r,n){return W(()=>{let o;return Io(W(()=>{let s=this.get(t,r);if(s)return s;let a=QJ(this,t);return zM(a,r)?(o=a.deferred,this.map.set(t,a),n(this,a.scope)):n(this,r)}),s=>{o&&_n(o,s)})})}},us=()=>new Px,BI=e=>new Px(e),XJ=V(us),eG=e=>V(()=>BI(e)),rc=class e extends fr()(\"effect/Layer/CurrentMemoMap\"){static forkOrCreate(t){let r=rp(t,e);return r?BI(r):us()}},Ks=l(3,(e,t,r)=>Sr(pe(e.build(t,r),Bt(rc,t)),rc,t)),GM=e=>re(t=>Ks(e,rc.forkOrCreate(t.context),qn(t.context,Ur))),Bp=l(2,(e,t)=>re(r=>Ks(e,rc.forkOrCreate(r.context),t))),zp=function(){return arguments.length===1?e=>nc(os(arguments[0],e)):nc(os(arguments[0],arguments[1]))},nc=e=>oc(Ne(_(e))),tG=nc(Xt()),rG=function(){return arguments.length===1?e=>DI(()=>os(arguments[0],e())):DI(()=>os(arguments[0],arguments[1]()))},DI=e=>Fx(Ne(V(e))),sf=function(){return arguments.length===1?e=>jM(arguments[0],e):jM(arguments[0],arguments[1])},jM=(e,t)=>zI(pe(t,r=>os(e,r))),zI=e=>Fx((t,r)=>Zn(e,r)),nG=e=>zI(Kt(e,Xt())),oG=e=>Fx((t,r)=>W(()=>e().build(t,r))),qM=fr(\"effect/Layer/unwrap\"),LI=e=>ZM(sf(qM)(e),Ie(qM)),KM=(e,t,r)=>{let n=wt(r,\"parallel\");return Jr(e,o=>o.build(t,wt(n,\"sequential\")),{concurrency:e.length}).pipe(pe(o=>JS(...o)))},Ux=(...e)=>Da((t,r)=>KM(e,t,r)),sG=l(2,(e,t)=>Ux(e,...Array.isArray(t)?t:[t])),VM=(e,t,r)=>Da((n,o)=>B(Array.isArray(t)?KM(t,n,o):t.build(n,o),s=>e.build(n,o).pipe(Eo(s),pe(a=>r(a,s))))),of=l(2,(e,t)=>VM(e,t,A)),aG=l(2,(e,t)=>VM(e,t,(r,n)=>Fu(n,r))),ZM=l(2,(e,t)=>Da((r,n)=>B(e.build(r,n),o=>t(o).build(r,n)))),iG=l(2,(e,t)=>Da((r,n)=>B(e.build(r,n),o=>Zn(Kt(t(o),o),n)))),cG=l(2,(e,t)=>Da((r,n)=>Kr(e.build(r,n),o=>Zn(br(t(o),Ze(o)),n)))),uG=l(2,(e,t)=>Da((r,n)=>Gr(e.build(r,n),o=>Zn(br(t(o),_e(o)),n)))),fG=e=>oc((t,r)=>px(e.build(t,r))),lG=l(2,(e,t)=>oc((r,n)=>Kr(e.build(r,n),o=>t(o).build(r,n))));var pG=l(3,(e,t,r)=>oc((n,o)=>lx(e.build(n,o),t,s=>r(s).build(n,o)))),dG=l(2,(e,t)=>oc((r,n)=>Gr(e.build(r,n),o=>t(o).build(r,n)))),QM=l(3,(e,t,r)=>of(e,sf(t,pe(t,r)))),mG=e=>oc((t,r)=>e.build(us(),r)),hG=e=>yx(br(GM(e),Ap)),xG=function(){return arguments.length===1?e=>HM(arguments[0],e):HM(arguments[0],arguments[1])},HM=(e,t)=>zp(e)(new Proxy({...t},{get(r,n,o){if(n in r)return r[n];let s=jn();_r(2);let a=new Error(`${e.key}: Unimplemented method \"${n.toString()}\"`);return _r(s),a.name=\"UnimplementedError\",gG(a)},has:mr})),gG=e=>{let t=Object.assign(js(e),{[WM]:WM,channel:{[Rx]:Rx,transform:()=>_(t),pipe(){return K(this,arguments)}},[Rx]:Rx,transform:()=>_(t)});function r(){return t}return Object.assign(r,t),Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r},WM=\"~effect/Stream\",Rx=\"~effect/Channel\",yG=()=>e=>e,bG=()=>e=>e,SG=()=>e=>e,EG=(e,t)=>(t=Gn(t),sf(xo,t?.onEnd?So(bo(e,t),r=>Fa(n=>t.onEnd(r,n))):bo(e,t))),YM=e=>nc(xo.context(e)),IG=function(){let e=typeof arguments[0]!=\"string\",t=e?arguments[1]:arguments[0],r=Gn(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return LI(pe(r?.onEnd!==void 0?So(bo(t,r),o=>Fa(s=>r.onEnd(o,s))):bo(t,r),o=>$I(n,o,r)))}return n=>LI(pe(r?.onEnd!==void 0?So(bo(t,r),o=>Fa(s=>r.onEnd(o,s))):bo(t,r),o=>$I(n,o,r)))},$I=function(){let e=Mx(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=A;t._tag===\"Span\"&&(r=Gn(r),n=TG(t.name,r?.captureStackTrace));let o=YM(t);return e?of(n(arguments[0]),o):s=>of(n(s),o)},TG=(e,t)=>(t=typeof t==\"function\"?t:Hr,QM(LM,r=>({name:e,stack:t,parent:r})));var XM=\"~effect/ExecutionPlan\";var wG={[XM]:XM,get captureRequirements(){let e=this;return Pa(t=>_(CG(e.steps.map(r=>({...r,while:r.while?n=>Eo(r.while(n),t):void 0,provide:Mx(r.provide)?of(r.provide,nc(t)):r.provide})))))},pipe(){return K(this,arguments)}},CG=e=>{let t=Object.create(wG);return t.steps=e,t};var Nx=Se(\"effect/ExecutionPlan/CurrentMetadata\",{defaultValue:Ne({attempt:0,stepIndex:0})});var bf={};$e(bf,{CurrentMetadata:()=>rr,addDelay:()=>J4,concat:()=>G4,concatResult:()=>$F,cron:()=>Z4,duration:()=>Q4,during:()=>Y4,exponential:()=>t3,fibonacci:()=>r3,fixed:()=>n3,forever:()=>yf,fromStep:()=>Pn,fromStepWithMetadata:()=>lc,identity:()=>f3,isSchedule:()=>Vx,jittered:()=>o3,map:()=>Qp,max:()=>K4,min:()=>X4,modifyDelay:()=>I0,once:()=>c3,passthrough:()=>Zx,recurs:()=>Qx,setInputType:()=>l3,spaced:()=>Yx,tap:()=>s3,toStep:()=>Xn,toStepWithMetadata:()=>eo,toStepWithSleep:()=>gf,upTo:()=>a3,while:()=>pc,windowed:()=>i3});var Nr={};$e(Nr,{AsyncFiberError:()=>t4,AsyncFiberErrorTypeId:()=>XG,Done:()=>YI,DoneTypeId:()=>WG,ExceededCapacityError:()=>XI,ExceededCapacityErrorTypeId:()=>YG,IllegalArgumentError:()=>Wp,IllegalArgumentErrorTypeId:()=>VG,InterruptorStackTrace:()=>HI,NoSuchElementError:()=>HG,NoSuchElementErrorTypeId:()=>qG,ReasonTypeId:()=>AG,StackTrace:()=>qI,TimeoutError:()=>KG,TimeoutErrorTypeId:()=>JG,TypeId:()=>kG,UnknownError:()=>o4,UnknownErrorTypeId:()=>r4,annotate:()=>s4,annotations:()=>i4,combine:()=>MG,die:()=>sc,done:()=>Z,empty:()=>_G,fail:()=>RG,filterInterruptors:()=>ZI,findDefect:()=>Hp,findDie:()=>DG,findError:()=>VI,findErrorOption:()=>UG,findFail:()=>FG,findInterrupt:()=>$G,fromReasons:()=>af,hasDies:()=>NG,hasFails:()=>KI,hasInterrupts:()=>LG,hasInterruptsOnly:()=>qp,interrupt:()=>PG,interruptors:()=>BG,isAsyncFiberError:()=>e4,isCause:()=>WI,isDieReason:()=>vG,isDone:()=>uf,isExceededCapacityError:()=>QG,isFailReason:()=>jp,isIllegalArgumentError:()=>ZG,isInterruptReason:()=>OG,isNoSuchElementError:()=>jG,isReason:()=>JI,isTimeoutError:()=>GG,isUnknownError:()=>n4,makeDieReason:()=>Lx,makeFailReason:()=>Dx,makeInterruptReason:()=>GI,map:()=>Vs,pretty:()=>QI,prettyErrors:()=>zG,reasonAnnotations:()=>a4,squash:()=>cf});var kG=jl,AG=Tu,WI=Cu,JI=uO,jp=Ps,vG=_i,OG=Ri,af=Rs,_G=lh,RG=Oi,sc=PS,PG=$s,Dx=e=>new Ci(e),Lx=e=>new ql(e),GI=L_,qp=q_,Vs=J_,MG=vi,cf=nx,KI=RE,FG=PE,VI=Vn,UG=$_,NG=ex,DG=B_,Hp=wp,LG=tx,$G=z_,BG=j_,ZI=rx,zG=ME,QI=Bs,jG=dh,qG=Hl,HG=uo,uf=Gl,WG=ki,YI=Pi,Z=dO,JG=gp,GG=IM,KG=yp,VG=bp,ZG=TM,Wp=Yh,QG=wM,YG=Sp,XI=Xh,XG=Ep,e4=CM,t4=Ip,r4=Tp,n4=kM,o4=ju,s4=ku,a4=H_,i4=W_,qI=class extends fr()(\"effect/Cause/StackTrace\"){},HI=class extends fr()(\"effect/Cause/InterruptorStackTrace\"){};var b0={};$e(b0,{CronParseError:()=>Rn,Equivalence:()=>FF,equals:()=>UF,format:()=>O4,isCron:()=>Jx,isCronParseError:()=>A4,make:()=>PF,match:()=>R4,next:()=>Kx,parse:()=>Gx,parseUnsafe:()=>v4,prev:()=>P4,sequence:()=>M4});var eF={};$e(eF,{Clock:()=>ac,clockWith:()=>c4,currentTimeMillis:()=>u4,currentTimeNanos:()=>f4,monotonicTimeNanos:()=>l4});var ac=Mr,c4=nn,u4=vx,f4=SM,l4=EM;var $x=\"~effect/DateTime\",Bx=\"~effect/DateTime/TimeZone\",rF={[$x]:$x,pipe(){return K(this,arguments)},[Ee](){return this.toString()},toJSON(){return Qs(this).toJSON()}},p4={...rF,_tag:\"Utc\",[ae](){return Dt(this.epochMilliseconds)},[ie](e){return ic(e)&&e._tag===\"Utc\"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Qs(this).toJSON()})`}},d4={...rF,_tag:\"Zoned\",[ae](){return oe(Dt(this.epochMilliseconds))(H(this.zone))},[ie](e){return ic(e)&&e._tag===\"Zoned\"&&this.epochMilliseconds===e.epochMilliseconds&&J(this.zone,e.zone)},toString(){return`DateTime.Zoned(${p0(this)})`}},nF={[Bx]:Bx,[Ee](){return this.toString()}},m4={...nF,_tag:\"Named\",[ae](){return Me(`Named:${this.id}`)},[ie](e){return Zs(e)&&e._tag===\"Named\"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:\"TimeZone\",_tag:\"Named\",id:this.id}}},h4={...nF,_tag:\"Offset\",[ae](){return Me(`Offset:${this.offset}`)},[ie](e){return Zs(e)&&e._tag===\"Offset\"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${i0(this.offset)})`},toJSON(){return{_id:\"TimeZone\",_tag:\"Offset\",offset:this.offset}}},fs=(e,t,r)=>{let n=Object.create(d4);return n.epochMilliseconds=e,n.zone=t,Object.defineProperty(n,\"partsUtc\",{value:r,enumerable:!1,writable:!0}),Object.defineProperty(n,\"adjustedEpochMillis\",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(n,\"partsAdjusted\",{value:void 0,enumerable:!1,writable:!0}),n},ic=e=>w(e,$x),x4=e=>ic(e[0]),Zs=e=>w(e,Bx),oF=e=>Zs(e)&&e._tag===\"Offset\",jx=e=>Zs(e)&&e._tag===\"Named\",sF=e=>e._tag===\"Utc\",r0=e=>e._tag===\"Zoned\",aF=Lt((e,t)=>e.epochMilliseconds===t.epochMilliseconds);var n0=e=>{let t=Object.create(p4);return t.epochMilliseconds=e,Object.defineProperty(t,\"partsUtc\",{value:void 0,enumerable:!1,writable:!0}),t},ff=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Wp(\"Invalid date\");return n0(t)},qx=e=>{if(ic(e))return e;if(e instanceof Date)return ff(e);if(typeof e==\"object\"){if(\"epochMilliseconds\"in e)return ff(new Date(e.epochMilliseconds));let t=new Date(0);return w4(t,e),ff(t)}else if(typeof e==\"string\"&&!g4(e))return ff(new Date(e+\"Z\"));return ff(new Date(e))},g4=e=>/Z|GMT|[+-]\\d{2}$|[+-]\\d{2}:?\\d{2}$|\\]$/.test(e),y4=-864e13+720*60*1e3,b4=864e13-840*60*1e3,cc=(e,t)=>{let r=t?.timeZone;if(r===void 0&&ic(e)&&r0(e))return e;let n=qx(e);if(n.epochMilliseconds<y4||n.epochMilliseconds>b4)throw new RangeError(`Epoch millis out of range: ${n.epochMilliseconds}`);r===void 0&&typeof e==\"object\"&&\"timeZoneId\"in e&&(r=e.timeZoneId);let o;if(r===void 0){let s=new Date(n.epochMilliseconds).getTimezoneOffset()*-60*1e3;o=Gp(s)}else if(Zs(r))o=r;else if(typeof r==\"number\")o=Gp(r);else{let s=Kp(r);if(fe(s))throw new Wp(`Invalid time zone: ${r}`);o=s.value}return t?.adjustForTimeZone!==!0?fs(n.epochMilliseconds,o,n.partsUtc):mF(n.epochMilliseconds,o,t?.disambiguation??\"compatible\")},e0=po(cc),iF=po(qx),S4=/^(.{17,35})\\[(.+)\\]$/,cF=e=>{let t=S4.exec(e);if(t===null){let o=f0(e);return o!==null?e0(e,{timeZone:o}):v()}let[,r,n]=t;return e0(r,{timeZone:n})};var uF=e=>n0(e.epochMilliseconds);var zx=new Map,E4={day:\"numeric\",month:\"numeric\",year:\"numeric\",hour:\"numeric\",minute:\"numeric\",second:\"numeric\",timeZoneName:\"longOffset\",fractionalSecondDigits:3,hourCycle:\"h23\"},I4=e=>{let t=e.resolvedOptions().timeZone,r=zx.get(t);if(r!==void 0)return r;let n=Object.create(m4);return n.id=t,n.format=e,zx.set(t,n),n},o0=e=>{let t=zx.get(e);if(t!==void 0)return t;try{let r=I4(new Intl.DateTimeFormat(\"en-US\",{...E4,timeZone:e}));return zx.set(e,r),r}catch{throw new Wp(`Invalid time zone: ${e}`)}},Gp=e=>{let t=Object.create(h4);return t.offset=e,t},s0=po(o0);var T4=/^(?:GMT|[+-])/,Kp=e=>{if(T4.test(e)){let t=f0(e);return t===null?v():O(Gp(t))}return s0(e)},fF=e=>e._tag===\"Offset\"?i0(e.offset):e.id;var Qs=e=>new Date(e.epochMilliseconds),$a=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(n=>n.type!==\"literal\"),r=new Date(0);return r.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),r.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),t[6]?.type===\"fractionalSecond\"?Number(t[6].value):(e.epochMilliseconds%1e3+1e3)%1e3),e.adjustedEpochMilliseconds=r.getTime(),r},a0=e=>$a(e).getTime()-c0(e),i0=e=>{let t=Math.abs(e),r=Math.floor(t/(3600*1e3)),n=Math.round(t%(3600*1e3)/(60*1e3));return n===60&&(r+=1,n=0),`${e<0?\"-\":\"+\"}${String(r).padStart(2,\"0\")}:${String(n).padStart(2,\"0\")}`},lF=e=>i0(a0(e)),c0=e=>e.epochMilliseconds;var pF=e=>({millisecond:e.getUTCMilliseconds(),second:e.getUTCSeconds(),minute:e.getUTCMinutes(),hour:e.getUTCHours(),day:e.getUTCDate(),weekDay:e.getUTCDay(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}),u0=e=>e._tag===\"Utc\"?dF(e):(e.partsAdjusted!==void 0||(e.partsAdjusted=hF(e,pF)),e.partsAdjusted),dF=e=>(e.partsUtc!==void 0||(e.partsUtc=xF(e,pF)),e.partsUtc);var w4=(e,t)=>{if((t.year!==void 0||t.month!==void 0||t.day!==void 0)&&e.setUTCFullYear(t.year??e.getUTCFullYear(),t.month!==void 0?t.month-1:e.getUTCMonth(),t.day??e.getUTCDate()),t.weekDay!==void 0){let r=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+r)}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)};var tF=1440*60*1e3,mF=(e,t,r)=>{if(t._tag===\"Offset\")return fs(e-t.offset,t);let n=Jp(e-tF,e,t),o=Jp(e+tF,e,t);if(n===o)return fs(e-n,t);let s=n<o,a=n-o;if(s){if(Jp(e-o,e,t)===o)return fs(e-o,t);let u=fs(e-n,t),f=$a(u).getTime();if(e!==f)switch(r){case\"reject\":{let p=new Date(e).toISOString();throw new RangeError(`Gap time: ${p} does not exist in time zone ${t.id}`)}case\"earlier\":return fs(e-o,t);case\"compatible\":case\"later\":return u}return u}if(Jp(e-n,e,t)===n){if(r===\"earlier\"||r===\"compatible\"||Jp(e-n+a,e+a,t)===n)return fs(e-n,t);if(r===\"reject\"){let u=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return fs(e-o,t)},C4=/([+-])(\\d{2}):(\\d{2})$/,f0=e=>{let t=C4.exec(e);if(t===null)return null;let[,r,n,o]=t;return(r===\"+\"?1:-1)*(Number(n)*60+Number(o))*60*1e3},Jp=(e,t,r)=>{let n=r.format.formatToParts(e).find(s=>s.type===\"timeZoneName\")?.value??\"\";if(n===\"GMT\")return 0;let o=f0(n);return o===null?a0(fs(t,r)):o},l0=l(x4,(e,t,r)=>{if(e._tag===\"Utc\"){let s=Qs(e);return t(s),n0(s.getTime())}let n=$a(e),o=new Date(n.getTime());return t(o),mF(o.getTime(),e.zone,r?.disambiguation??\"compatible\")});var hF=l(2,(e,t)=>t($a(e))),xF=l(2,(e,t)=>t(Qs(e)));var gF=e=>Qs(e).toISOString();var t0=e=>{let t=$a(e);return e._tag===\"Utc\"?t.toISOString():`${t.toISOString().slice(0,-1)}${lF(e)}`},p0=e=>e.zone._tag===\"Offset\"?t0(e):`${t0(e)}[${e.zone.id}]`;var bF=globalThis.Number;var EF=Wr;var IF=l(2,(e,t)=>{if(!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0)return NaN;if(globalThis.Number.isInteger(e)&&globalThis.Number.isInteger(t))return e%t;let[r,n]=SF(e),[o,s]=SF(t),a=Math.min(n,s),i=r*BigInt(10)**BigInt(n-a),c=o*BigInt(10)**BigInt(s-a),u=i%c;if(u===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let f=globalThis.Number(`${u}e${a}`);return f===0?Math.sign(e)*globalThis.Number.MIN_VALUE:f});function SF(e){if(globalThis.Number.isInteger(e))return[BigInt(e),0];let t=Math.abs(e).toExponential(),r=t.indexOf(\"e\"),n=t.slice(0,r).replace(\".\",\"\");return[BigInt(n)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(r+1))-n.length+1]}var TF=e=>{let t=Math.ceil(Math.log(e)/Math.log(2));return Math.max(Math.pow(2,t),2)},Tce=e=>{if(e===\"NaN\")return O(NaN);if(e===\"Infinity\")return O(1/0);if(e===\"-Infinity\")return O(-1/0);if(e.trim()===\"\")return v();let t=bF(e);return bF.isNaN(t)?v():O(t)};var wce=globalThis.String,Hx=ir,d0=yh;var m0=e=>e.toUpperCase(),Vp=e=>e.toLowerCase(),CF=e=>e.length===0?e:m0(e[0])+e.slice(1),kF=e=>e.length===0?e:Vp(e[0])+e.slice(1);var AF=e=>e.trim();var vF=e=>e.length>0;var OF=e=>{if(e.length===0)return e;let t=e[0];for(let r=1;r<e.length;r++)t+=e[r]===\"_\"?e[++r].toUpperCase():e[r];return t};var _F=e=>e.replace(/([A-Z])/g,\"_$1\").toLowerCase();var g0=\"~effect/Cron\";function h0(e){return{tz:e.tz,and:e.and,seconds:be(e.seconds),minutes:be(e.minutes),hours:be(e.hours),days:be(e.days),months:be(e.months),weekdays:be(e.weekdays)}}var k4={[g0]:g0,[ie](e){return Jx(e)&&UF(this,e)},[ae](){return Pl(H(this.tz),oe(H(this.and)),oe(xr(be(this.seconds))),oe(xr(be(this.minutes))),oe(xr(be(this.hours))),oe(xr(be(this.days))),oe(xr(be(this.months))),oe(xr(be(this.weekdays))))},toObject(){return h0(this)},toString(){return`Cron(${L(h0(this))})`},toJSON(){let e=h0(this);return e._id=\"Cron\",e},[Ee](){return this.toJSON()},pipe(){return K(this,arguments)}},Jx=e=>w(e,g0),PF=e=>{let t=Object.create(k4);t.seconds=pf.seconds(e.seconds??[0]),t.minutes=pf.minutes(e.minutes),t.hours=pf.hours(e.hours),t.days=pf.days(e.days),t.months=pf.months(e.months),t.weekdays=pf.weekdays(e.weekdays),t.and=e.and===!0,t.tz=Ns(e.tz);let r=Array.from(t.seconds),n=Array.from(t.minutes),o=Array.from(t.hours),s=Array.from(t.days),a=Array.from(t.months),i=Array.from(t.weekdays);return t.first={second:r[0]??0,minute:n[0]??0,hour:o[0]??0,day:s[0]??1,month:(a[0]??1)-1,weekday:i[0]??0},t.last={second:r[r.length-1]??59,minute:n[n.length-1]??59,hour:o[o.length-1]??23,day:s[s.length-1]??31,month:(a[a.length-1]??12)-1,weekday:i[i.length-1]??6},t.next={second:Yn.next.second(r),minute:Yn.next.minute(n),hour:Yn.next.hour(o),day:Yn.next.day(s),month:Yn.next.month(a),weekday:Yn.next.weekday(i)},t.prev={second:Yn.prev.second(r),minute:Yn.prev.minute(n),hour:Yn.prev.hour(o),day:Yn.prev.day(s),month:Yn.prev.month(a),weekday:Yn.prev.weekday(i)},t},lf=(e,t,r,n=o=>o)=>o=>{let s=[];for(let a of o){if(!Number.isInteger(a)||a<t||a>r)throw new RangeError(`${e} must contain only integers between ${t} and ${r}`);s.push(n(a))}return new Set(Bi(s,EF))},pf={seconds:lf(\"seconds\",0,59),minutes:lf(\"minutes\",0,59),hours:lf(\"hours\",0,23),days:lf(\"days\",1,31),months:lf(\"months\",1,12),weekdays:lf(\"weekdays\",0,7,e=>e===7?0:e)},Qn=(e,t)=>r=>{let n=new Array(e).fill(void 0);if(r.length===0)return n;let o;if(t===\"next\"){let s=r.length-1;for(let a=e-1;a>=0;a--){for(;s>=0&&r[s]>=a;)o=r[s--];n[a]=o}}else{let s=0;for(let a=0;a<e;a++){for(;s<r.length&&r[s]<=a;)o=r[s++];n[a]=o}}return n},Yn={prev:{second:Qn(60,\"prev\"),minute:Qn(60,\"prev\"),hour:Qn(24,\"prev\"),day:Qn(32,\"prev\"),month:Qn(13,\"prev\"),weekday:Qn(7,\"prev\")},next:{second:Qn(60,\"next\"),minute:Qn(60,\"next\"),hour:Qn(24,\"next\"),day:Qn(32,\"next\"),month:Qn(13,\"next\"),weekday:Qn(7,\"next\")}},y0=\"~effect/Cron/CronParseError\",Rn=class extends rn(\"CronParseError\"){[y0]=y0},A4=e=>w(e,y0),Gx=(e,t)=>{let r=e.trim().split(/\\s+/).filter(vF);if(r.length!==5&&r.length!==6)return D(new Rn({message:\"Invalid number of segments in cron expression\",input:e}));r.length===5&&r.unshift(\"0\");let[n,o,s,a,i,c]=r,u=t===void 0||Zs(t)?P(t):eE(Kp(t),()=>new Rn({message:\"Invalid time zone in cron expression\",input:t}));return Uu({tz:u,seconds:mf(n,U4),minutes:mf(o,N4),hours:mf(s,D4),days:mf(a,L4),months:mf(i,$4),weekdays:mf(c,B4)}).pipe(mt(({tz:f,seconds:p,minutes:d,hours:m,days:x,months:g,weekdays:y})=>PF({tz:f,seconds:p.values,minutes:d.values,hours:m.values,days:x.values,months:g.values,weekdays:y.values,and:(x.wildcard||y.wildcard)&&x.values.size!==0&&y.values.size!==0})))},v4=(e,t)=>Ls(Gx(e,t)),O4=(e,t)=>{let r=[e.seconds,e.minutes,e.hours,e.days,e.months,e.weekdays].map(_4);return(t?.includeSeconds!==!0&&e.seconds.size===1&&e.seconds.has(0)?r.slice(1):r).join(\" \")},_4=e=>{if(e.size===0)return\"*\";let t=Array.from(e),r=[],n=0;for(;n<t.length;){let o=t[n],s=t[n+1]-o;if(n+2<t.length&&t[n+2]-t[n+1]===s){let a=n+2;for(;a+1<t.length&&t[a+1]-t[a]===s;)a++;r.push(`${o}-${t[a]}${s===1?\"\":`/${s}`}`),n=a+1}else r.push(`${o}`),n++}return r.join(\",\")},R4=(e,t)=>{let r=cc(t,{timeZone:lo(e.tz)}).pipe(u0);return e.seconds.size!==0&&!e.seconds.has(r.second)||e.minutes.size!==0&&!e.minutes.has(r.minute)||e.hours.size!==0&&!e.hours.has(r.hour)||e.months.size!==0&&!e.months.has(r.month)?!1:e.days.size===0&&e.weekdays.size===0?!0:e.and?(e.days.size===0||e.days.has(r.day))&&(e.weekdays.size===0||e.weekdays.has(r.weekDay)):e.weekdays.size===0?e.days.has(r.day):e.days.size===0?e.weekdays.has(r.weekDay):e.days.has(r.day)||e.weekdays.has(r.weekDay)},Wx=e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+1,0)).getUTCDate(),Kx=(e,t)=>MF(e,t,\"next\"),P4=(e,t)=>MF(e,t,\"prev\"),MF=(e,t,r)=>{let n=lo(e.tz),o=cc(t??new Date,{timeZone:n}),s=r===\"prev\",a=s?-1:1,i=e[r],c=s?e.last:e.first,u=s?(m,x)=>m<x:(m,x)=>m>x,p=n!==void 0&&jx(n)&&n.id===\"UTC\"?vr:m=>{let x=cc(m,{timeZone:o.zone,adjustForTimeZone:!0,disambiguation:s?\"later\":void 0}).pipe($a),g=m.getTime()-x.getTime();(s?g!==0:g>0)&&m.setTime(s?x.getTime():m.getTime()+g)},d=l0(o,m=>{m.setUTCSeconds(m.getUTCSeconds()+a,0);for(let x=0;x<1e4;x++){if(e.seconds.size!==0){let g=m.getUTCSeconds(),y=i.second[g];if(y===void 0){m.setUTCMinutes(m.getUTCMinutes()+a,c.second),p(m);continue}if(u(y,g)){m.setUTCSeconds(y),p(m);continue}}if(e.minutes.size!==0){let g=m.getUTCMinutes(),y=i.minute[g];if(y===void 0){m.setUTCHours(m.getUTCHours()+a,c.minute,c.second),p(m);continue}if(u(y,g)){m.setUTCMinutes(y,c.second),p(m);continue}}if(e.hours.size!==0){let g=m.getUTCHours(),y=i.hour[g];if(y===void 0){m.setUTCDate(m.getUTCDate()+a),m.setUTCHours(c.hour,c.minute,c.second),p(m);continue}if(u(y,g)){m.setUTCHours(y,c.minute,c.second),p(m);continue}}if(e.weekdays.size!==0||e.days.size!==0)if(e.and){let g=e.days.size===0||e.days.has(m.getUTCDate()),y=e.weekdays.size===0||e.weekdays.has(m.getUTCDay());if(!g||!y){m.setUTCDate(m.getUTCDate()+a),m.setUTCHours(c.hour,c.minute,c.second),p(m);continue}}else{let g=s?-1/0:1/0,y=s?-1/0:1/0;if(e.weekdays.size!==0){let E=m.getUTCDay(),U=i.weekday[E];U===void 0?g=s?c.weekday-7-E:7-E+c.weekday:g=U-E}if(e.days.size!==0&&g!==0){let E=m.getUTCDate(),U=i.day[E];if(U===void 0)if(s){let F=new Date(m);F.setUTCDate(0);let h=i.day[F.getUTCDate()];if(h===void 0&&(F.setUTCDate(0),h=i.day[F.getUTCDate()]),h===void 0)throw new Error(\"Unable to find cron date\");F.setUTCDate(h),y=(F.getTime()-m.getTime())/864e5}else y=Wx(m)-E+c.day;else!s&&U>Wx(m)?y=Wx(m)-E+c.day:y=U-E}let S=s?Math.max(g,y):Math.min(g,y);if(S!==0){m.setUTCDate(m.getUTCDate()+S),m.setUTCHours(c.hour,c.minute,c.second),p(m);continue}}if(e.months.size!==0){let g=m.getUTCMonth()+1,y=i.month[g],S=E=>{let U=Wx(new Date(Date.UTC(m.getUTCFullYear(),E+1,0)));return e.days.size!==0&&e.weekdays.size===0?s?i.day[U]??U:c.day:s?U:1};if(y===void 0){m.setUTCFullYear(m.getUTCFullYear()+a),m.setUTCMonth(c.month,S(c.month)),m.setUTCHours(c.hour,c.minute,c.second),p(m);continue}if(u(y,g)){let E=y-1;m.setUTCMonth(E,S(E)),m.setUTCHours(c.hour,c.minute,c.second),p(m);continue}}return}throw new Error(\"Unable to find cron date\")});return Qs(d)},M4=function*(e,t){for(;;)yield t=Kx(e,t)},FF=Lt((e,t)=>J(e.tz,t.tz)&&e.and===t.and&&df(e.seconds,t.seconds)&&df(e.minutes,t.minutes)&&df(e.hours,t.hours)&&df(e.days,t.days)&&df(e.months,t.months)&&df(e.weekdays,t.weekdays)),F4=gu(Os()),df=(e,t)=>F4(be(e),be(t)),UF=l(2,(e,t)=>FF(e,t)),U4={min:0,max:59},N4={min:0,max:59},D4={min:0,max:23},L4={min:1,max:31},$4={min:1,max:12,aliases:{jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12}},B4={min:0,max:7,normalize:e=>e===7?0:e,aliases:{sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6}},mf=(e,t)=>{let r=new Set,n=e.split(\",\"),o=RF(n[0]),s=o[0]===\"*\",a=t.normalize??(c=>c),i=s&&(o[1]===void 0||o[1]===1)?vr:c=>{r.add(a(c))};for(let c=0;c<n.length;c++){let u=n[c],[f,p]=c===0?o:RF(u);if(p!==void 0){if(!Number.isInteger(p))return D(new Rn({message:\"Expected step value to be a positive integer\",input:e}));if(p<1)return D(new Rn({message:\"Expected step value to be greater than 0\",input:e}));if(p>t.max)return D(new Rn({message:`Expected step value to be less than or equal to ${t.max}`,input:e}))}if(f===\"*\"){if(c===0&&(p===void 0||p===1))continue;for(let d=t.min;d<=t.max;d+=p??1)i(d)}else{let[d,m]=z4(f,t.aliases);if(!Number.isInteger(d))return D(new Rn({message:\"Expected a positive integer\",input:e}));if(d<t.min||d>t.max)return D(new Rn({message:`Expected a value between ${t.min} and ${t.max}`,input:e}));if(m===void 0)for(let x=d;x<=(p===void 0?d:t.max);x+=p??1)i(x);else{if(!Number.isInteger(m))return D(new Rn({message:\"Expected a positive integer\",input:e}));if(m<t.min||m>t.max)return D(new Rn({message:`Expected a value between ${t.min} and ${t.max}`,input:e}));if(d>m)return D(new Rn({message:\"Invalid value range\",input:e}));for(let x=d;x<=m;x+=p??1)i(x)}}}return P({values:r,wildcard:s})},RF=e=>{let t=e.indexOf(\"/\");if(t!==-1){let r=e.slice(t+1);return[e.slice(0,t),NF.test(r)?Number(r):NaN]}return[e,void 0]},z4=(e,t)=>{let r=e.indexOf(\"-\");return r!==-1?[x0(e.slice(0,r),t),x0(e.slice(r+1),t)]:[x0(e,t),void 0]};function x0(e,t){return t?.[Vp(e)]??(NF.test(e)?Number(e):NaN)}var NF=/^\\d+$/;var DF=Se(\"effect/Random\",{defaultValue:()=>({nextIntUnsafe(){return Math.floor(Math.random()*(Number.MAX_SAFE_INTEGER-Number.MIN_SAFE_INTEGER+1))+Number.MIN_SAFE_INTEGER},nextDoubleUnsafe(){return Math.random()}})});var Qe=l(2,(e,t)=>Vu(e,q4,r=>t(r))),ls=e=>e.reasons.some(S0),S0=e=>e._tag===\"Fail\"&&uf(e.error),hf=e=>{let t,r=!1;for(let n of e.reasons)S0(n)?t??=n.error:n._tag!==\"Interrupt\"&&(r=!0);return t===void 0?D(e):r?D(af(e.reasons.filter(n=>!S0(n)))):P(t)};var q4=e=>{let t=hf(e);return Q(t)?t:P(t.success.value)},E0=e=>{let t=hf(e);return Q(t)?sn(t.failure):Fr(t.success.value)},uc=l(2,(e,t)=>yo(e,{onSuccess:t.onSuccess,onFailure:r=>{let n=hf(r);return Q(n)?t.onFailure(n.failure):t.onDone(n.success.value)}}));var LF=\"~effect/Schedule\",H4=DF.useSync(e=>e.nextDoubleUnsafe()),rr=Se(\"effect/Schedule/CurrentMetadata\",{defaultValue:Ne({input:void 0,output:void 0,duration:We,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),W4={[LF]:{_Out:A,_In:A,_Env:A},pipe(){return K(this,arguments)}},Vx=e=>w(e,LF),Pn=e=>{let t=Object.create(W4);return t.step=e,t},xf=()=>{let e=0,t,r;return(n,o)=>{r===void 0&&(r=n);let s=n-r,a=t===void 0?0:n-t;return t=n,{input:o,attempt:++e,start:r,now:n,elapsed:s,elapsedSincePrevious:a}}},lc=e=>Pn(pe(e,t=>{let r=xf();return(n,o)=>t(r(n,o))})),Xn=e=>Gr(e.step,t=>_(()=>_e(t))),eo=e=>nn(t=>pe(Xn(e),r=>{let n=xf();return o=>W(()=>{let s=t.currentTimeMillisUnsafe();return B(r(s,o),([a,i])=>{let c=n(s,o);return c.output=a,c.duration=i,Kt(Ua(i),c)})})})),gf=e=>pe(eo(e),t=>r=>pe(t(r),n=>n.output)),J4=l(2,(e,t)=>I0(e,r=>pe(t(r),n=>Mh(ge(n),r.duration)))),G4=l(2,(e,t)=>Qp($F(e,t),({output:r})=>_(tE(r)))),$F=l(2,(e,t)=>Pn(V(()=>{let r=0,n,o=Qp(e,({output:a})=>D(a)),s=Qp(t,({output:a})=>P(a));return function a(i,c){return n?n(i,c):Xn(r===0?o:s).pipe(B(u=>(r++,r===1?(n=(f,p)=>Qe(u(f,p),d=>(n=void 0,a(f,p))),n(i,c)):(n=u,n(i,c)))))}}))),K4=e=>Pn(pe(Xi(e.map(Xn)),t=>(r,n)=>B(Jr(t,o=>uc(o(r,n),{onSuccess:s=>_(s[1]),onDone:()=>Up,onFailure:_e})),o=>{let s=V4(o);return s===void 0?Z(We):_([s,s])}))),V4=e=>{let t=e[0];for(let r=1;r<e.length&&(t=e[r]&&t&&ZS(t,e[r]),t!==void 0);r++);return t},Z4=(e,t)=>{let r=Jx(e)?P(e):Gx(e,t);return Pn(pe(Ki(r),n=>(o,s)=>o===Number.POSITIVE_INFINITY?Z(We):V(()=>{let a=Kx(n,o).getTime(),i=Jt(a-o);return[i,i]})))},Q4=e=>{let t=ge(e);return lc(_(r=>r.attempt===1?_([t,t]):Z(We)))},Y4=e=>{let t=Ye(e);return lc(_(r=>{let n=Jt(r.elapsed);return r.elapsed>t?Z(n):_([n,We])}))},X4=e=>Pn(pe(Xi(e.map(Xn)),t=>(r,n)=>B(Jr(t,o=>uc(o(r,n),{onSuccess:s=>_(s[1]),onDone:()=>Up,onFailure:_e})),o=>{let s=e3(o);return s===void 0?Z(We):_([s,s])}))),e3=e=>{let t;for(let r=0;r<e.length;r++){let n=e[r];n!==void 0&&(t=t===void 0?n:VS(t,n))}return t},t3=(e,t=2)=>{let r=Ye(ge(e));return lc(_(n=>{let o=Jt(r*Math.pow(t,n.attempt-1));return _([o,o])}))},r3=e=>{let t=Ye(ge(e));return Pn(V(()=>{let r=0,n=t;return Ne(V(()=>{let o=r+n;r=n,n=o;let s=Jt(o);return[s,s]}))}))},n3=e=>{let t=Ye(ge(e));return lc(V(()=>{let r=0,n=0;return o=>V(()=>{if(t===0)return[o.attempt-1,We];if(o.attempt===1)return r=o.now,n=o.now+t,[0,Jt(t)];let s=o.now>n+t,a=t-(o.now-r)%t,i=s?0:a===0?t:a;return n=s?o.now:o.now+i,[o.attempt-1,Jt(i)]})}))},Qp=l(2,(e,t)=>Pn(pe(Xn(e),r=>{let n=xf();return(o,s)=>uc(r(o,s),{onSuccess:([a,i])=>{let c=t({...n(o,s),output:a,duration:i});return ue(c)?pe(c,u=>[u,i]):_([c,i])},onFailure:_e,onDone:a=>{let i=t({...n(o,s),output:a,duration:We});return ue(i)?B(i,Z):Z(i)}})}))),I0=l(2,(e,t)=>Pn(pe(Xn(e),r=>{let n=xf();return(o,s)=>B(r(o,s),([a,i])=>pe(t({...n(o,s),output:a,duration:i}),c=>[a,ge(c)]))}))),o3=e=>I0(e,({duration:t})=>pe(H4,r=>{let n=Ye(t);return Jt(n*.8*(1-r)+n*1.2*r)})),Zx=e=>Pn(pe(Xn(e),t=>(r,n)=>uc(t(r,n),{onSuccess:o=>_([n,o[1]]),onFailure:_e,onDone:()=>Z(n)}))),Qx=e=>pc(yf,({attempt:t})=>_(t<=e)),Yx=e=>{let t=ge(e);return lc(_(r=>_([r.attempt-1,t])))},s3=l(2,(e,t)=>Pn(pe(Xn(e),r=>{let n=xf();return(o,s)=>So(r(o,s),([a,i])=>t({...n(o,s),output:a,duration:i}))}))),a3=l(2,(e,t)=>{let r=t.duration===void 0?void 0:ge(t.duration);return pc(e,({attempt:n,elapsed:o})=>_((t.times===void 0||n<=t.times)&&(r===void 0||YS(Jt(o),r))))}),pc=l(2,(e,t)=>Pn(pe(Xn(e),r=>{let n=xf();return(o,s)=>B(r(o,s),a=>{let[i,c]=a,u=t({...n(o,s),output:i,duration:c});return B(ue(u)?u:_(u),f=>f?_(a):Z(i))})})));var i3=e=>{let t=Ye(ge(e));return lc(_(r=>V(()=>[r.attempt-1,t===0?We:Jt(t-r.elapsed%t)])))},yf=Yx(We),c3=Qp(Qx(1),()=>{}),u3=Pn(_((e,t)=>_([t,We]))),f3=()=>u3;var l3=()=>e=>e;var p3=(e,t,r)=>bx(n=>B(r?.local?Ks(t,us(),n):Bp(t,n),o=>Eo(e,o))),Xx=l(e=>ue(e[0]),(e,t,r)=>Pu(t)?Eo(e,t):p3(e,Array.isArray(t)?Ux(...t):t,r));var T0=l(3,(e,t,r)=>B(eo(t),n=>{let o=rr.defaultValue();return Kr(Ku(So(B(W(()=>Sr(e,rr,o)),n),s=>V(()=>{o=s})),{disableYield:!0}),s=>Gl(s)?_(s.value):r(s,o.attempt===0?v():O(o)))})),w0=l(3,(e,t,r)=>B(eo(t),n=>{let o=rr.defaultValue(),s,a=Kr(W(()=>Sr(e,rr,o)),i=>(s=i,B(n(i),c=>(o=c,a))));return Qe(a,i=>Ia(()=>r(s,i)))})),zF=l(2,(e,t)=>{let r=typeof t==\"function\"?t(A):Vx(t)?t:Xp(t);return T0(e,r,Ze)}),Yp=l(2,(e,t)=>{let r=typeof t==\"function\"?t(A):Vx(t)?t:Xp(t);return w0(e,r,Ze)}),jF=l(3,(e,t,r)=>B(eo(r),n=>{let o=rr.defaultValue(),s=W(()=>Sr(e,rr,o));return Kr(B(n(t),a=>{o=a;let i=Ne(B(s,n));return To({while:mr,body:i,step(c){o=c}})}),a=>Gl(a)?_(a.value):Ze(a))})),d3=Zx(yf),Xp=e=>{let t=e.schedule?Zx(e.schedule):d3;return e.while&&(t=pc(t,({input:r})=>{let n=e.while(r);return ue(n)?n:_(n)})),e.until&&(t=pc(t,({input:r})=>{let n=e.until(r);return ue(n)?pe(n,o=>!o):_(!n)})),e.times!==void 0&&(t=pc(t,({attempt:r})=>_(r<=e.times))),t};var C0=(e,t)=>{let r=-1,n=0,o=s=>mx(e(s));return{begin:nn(s=>W(()=>{let a=t();a.stepIndex!==r&&(r=a.stepIndex,n=0),n++;let i={attempt:a.attempt,stepAttempt:n,stepIndex:a.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return Kt(o({_tag:\"AttemptStart\",attempt:i.attempt,stepAttempt:i.stepAttempt,stepIndex:i.stepIndex}),i)})),end:(s,a)=>nn(i=>{let c=An(i.monotonicTimeNanosUnsafe()-s.startNanos);return o(a._tag===\"Success\"?{_tag:\"AttemptSuccess\",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c}:{_tag:\"AttemptFailure\",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c,cause:a.cause})})}},HF=l(e=>ue(e[0]),(e,t,r)=>W(()=>{let n=0,o={attempt:0,stepIndex:0},s=cx(Nx,V(()=>(o={attempt:o.attempt+1,stepIndex:n},o))),a=r?.onEvent===void 0?void 0:C0(r.onEvent,()=>o),i=a===void 0?A:u=>Vr(f=>B(a.begin,p=>On(f(u),d=>a.end(p,d)))),c;return B(To({while:()=>n<t.steps.length&&(c===void 0||Q(c)),body(){let u=t.steps[n],f=s(i(Xx(e,u.provide)));if(c){let p=!1,d=f;f=W(()=>p?d:(p=!0,Ki(c))),f=Yp(f,ed(u,!1))}else{let p=ed(u,!0);f=p?Yp(f,p):f}return Ra(f)},step(u){c=u,n++}}),()=>Ki(c))})),ed=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return Xp({schedule:e.schedule?e.schedule:e.attempts?void 0:m3,times:e.attempts,while:e.while});return Xp({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},m3=Qx(1);var h3=\"~effect/Request\",x3=Xv({_E:e=>e,_A:e=>e,_R:e=>e}),zce={...cO,[h3]:x3};var JF=e=>e;var KF=l(2,(e,t)=>{let r=n=>Tt(o=>{let s=ZF(n,e,o,zs());return y3(n,s)});return ue(t)?B(t,r):r(t)}),VF=(e,t)=>{let r=ZF(t.resolver,e,t.onExit,{context:t.context,cache:{scheduler:Ie(t.context,lp)}});return()=>QF(t.resolver,r)},eg=[],k0=new WeakMap,ZF=(e,t,r,n)=>{let o=k0.get(e);o||(o=new Map,k0.set(e,o));let s,a=!1,i=JF({request:t,context:n.context,uninterruptible:!1,completeUnsafe(u){a||(a=!0,!(s&&!s.entrySet.delete(i))&&r(u))}});if(e.preCheck!==void 0&&!e.preCheck(i))return i;let c=e.batchKey(i);if(s=o.get(c),!s){if(eg.length>0)s=eg.pop(),s.key=c,s.resolver=e,s.map=o;else{let u={key:c,resolver:e,map:o,entrySet:new Set,entries:new Set,delayEffect:B(W(()=>u.resolver.delay),f=>GF(u)),run:On(W(()=>u.resolver.runAll(Array.from(u.entries),u.key)),f=>{for(let p of u.entrySet)p.completeUnsafe(f._tag===\"Success\"?Rr(new Error(\"Effect.request: RequestResolver did not complete request\",{cause:p.request})):f);return u.entries.clear(),eg.length<128&&(u.entrySet.clear(),u.key=void 0,u.fiber=void 0,u.resolver=void 0,u.map=void 0,eg.push(u)),le})};s=u}o.set(c,s),s.fiber=Js(n.context)(s.delayEffect,{scheduler:n.cache.scheduler})}return s.entrySet.add(i),s.entries.add(i),s.resolver.collectWhile(s.entries)||(s.fiber.interruptUnsafe(n.id),s.fiber=Js(n.context)(GF(s),{scheduler:n.cache.scheduler})),i},QF=(e,t)=>{if(t.uninterruptible)return;let r=k0.get(e);if(!r)return;let n=e.batchKey(t),o=r.get(n);if(!o||!o.entries.delete(t))return;o.entrySet.delete(t);let s;o.entries.size===0&&(r.delete(n),s=o.fiber),t.completeUnsafe(Ju()),s?.interruptUnsafe()},y3=(e,t)=>V(()=>QF(e,t));function GF(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):le}var N0={};$e(N0,{CurrentMetricAttributes:()=>tg,CurrentMetricAttributesKey:()=>eU,FiberRuntimeMetrics:()=>rd,FiberRuntimeMetricsImpl:()=>U0,FiberRuntimeMetricsKey:()=>z3,MetricRegistry:()=>P0,boundariesFromIterable:()=>F0,counter:()=>sg,disableRuntimeMetrics:()=>W3,disableRuntimeMetricsLayer:()=>q3,dump:()=>R3,enableRuntimeMetrics:()=>H3,enableRuntimeMetricsLayer:()=>j3,exponentialBoundaries:()=>oU,frequency:()=>I3,gauge:()=>tU,histogram:()=>T3,isMetric:()=>E3,linearBoundaries:()=>D3,mapInput:()=>ag,modify:()=>A3,snapshot:()=>_3,snapshotUnsafe:()=>M0,summary:()=>w3,summaryWithTimestamp:()=>rU,timer:()=>C3,update:()=>mc,value:()=>k3,withAttributes:()=>O3,withConstantInput:()=>v3});var eU=\"effect/Metric/CurrentMetricAttributes\",tg=Se(eU,{defaultValue:()=>({})}),S3=\"effect/Metric/MetricRegistry\",P0=Se(S3,{defaultValue:()=>new Map}),td=\"~effect/Metric\",Ba=class{[td]=td;#e;#t=\"\";id;description;attributes;constructor(t,r,n){this.id=t,this.description=r,this.attributes=n}valueUnsafe(t){return this.hook(t).get(t)}modifyUnsafe(t,r){return this.hook(r).modify(t,r)}updateUnsafe(t,r){return this.hook(r).update(t,r)}hook(t){let r=Ie(t,tg);r!==this.#e&&(this.#e=r,this.#t=J3(this,og(this.attributes,r)));let n=Ie(t,P0),o=n.get(this.#t);return Dl(o)&&(o={id:this.id,type:this.type,description:this.description,attributes:Object.keys(r).length>0?og(this.attributes,r):this.attributes,hooks:this.createHooks()},n.set(this.#t,o)),o.hooks}pipe(){return K(this,arguments)}},YF=BigInt(0),v0=class extends Ba{type=\"Counter\";#e;#t;constructor(t,r){super(t,r?.description,dc(r?.attributes)),this.#e=r?.bigint??!1,this.#t=r?.incremental??!1}createHooks(){let t=this.#e?YF:0,r=this.#t?this.#e?o=>o>=YF:o=>o>=0:o=>!0;return nd(()=>({count:t,incremental:this.#t}),o=>{r(o)&&(t=t+o)})}},O0=class extends Ba{type=\"Gauge\";#e;constructor(t,r){super(t,r?.description,dc(r?.attributes)),this.#e=r?.bigint??!1}createHooks(){let t=this.#e?BigInt(0):0;return nd(()=>({value:t}),o=>{t=o},o=>{t=t+o})}},_0=class extends Ba{type=\"Frequency\";#e;constructor(t,r){super(t,r?.description,dc(r?.attributes)),this.#e=r?.preregisteredWords}createHooks(){let t=new Map;if(Or(this.#e))for(let n of this.#e)t.set(n,0);return nd(()=>({occurrences:t}),n=>{let o=t.get(n)??0;t.set(n,o+1)})}},rg=class extends Ba{type=\"Histogram\";#e;constructor(t,r){super(t,r?.description,dc(r?.attributes)),this.#e=r.boundaries}createHooks(){let t=this.#e,r=t.length,n=new Uint32Array(r+1),o=new Float64Array(r),s=0,a=0,i=Number.MAX_VALUE,c=-Number.MAX_VALUE;tn(Bi(t,Wr),(p,d)=>{o[d]=p});let u=p=>{let d=0,m=r;for(;d!==m;){let x=Math.floor(d+(m-d)/2),g=o[x];p<=g?m=x:d=x,m===d+1&&(p<=o[d]?m=d:d=m)}n[d]=n[d]+1,s=s+1,a=a+p,p<i&&(i=p),p>c&&(c=p)},f=()=>{let p=oE(r),d=0;for(let m=0;m<r;m++){let x=o[m],g=n[m];d=d+g,p[m]=[x,d]}return p};return nd(()=>({buckets:f(),count:s,min:i,max:c,sum:a}),u)}},R0=class extends Ba{type=\"Summary\";#e;#t;#r;constructor(t,r){super(t,r?.description,dc(r?.attributes)),this.#e=Math.max(Ye(ge(r.maxAge)),0),this.#t=r.maxSize,this.#r=r.quantiles}createHooks(){let t=Bi(this.#r,Wr),r=oE(this.#t);for(let d of this.#r)if(d<0||d>1)throw new Error(`Quantile must be between 0 and 1, found: ${d}`);let n=0,o=0,s=0,a=Number.MAX_VALUE,i=-Number.MAX_VALUE,c=d=>{let m=[],x=0;for(;x<this.#t;){let S=r[x];if(Or(S)){let[E,U]=S,F=d-E;F>=0&&F<=this.#e&&m.push(U)}x=x+1}let g=Bi(m,Wr),y=g.length;return y===0?t.map(S=>[S,void 0]):t.map(S=>{if(S<=0)return[S,g[0]];if(S>=1)return[S,g[y-1]];let E=Math.ceil(S*y)-1;return[S,g[E]]})},u=(d,m)=>{if(this.#t>0){let x=n%this.#t;r[x]=[m,d],n=n+1}o=o+1,s=s+d,d<a&&(a=d),d>i&&(i=d)};return nd(d=>{let m=Ie(d,Mr);return{quantiles:c(m.currentTimeMillisUnsafe()),count:o,min:a,max:i,sum:s}},([d,m])=>u(d,m))}},ng=class extends Ba{type;metric;valueUnsafe;updateUnsafe;modifyUnsafe;constructor(t,r,n,o){super(t.id,t.description,t.attributes),this.metric=t,this.valueUnsafe=r,this.updateUnsafe=n,this.modifyUnsafe=o,this.type=t.type}createHooks(){return this.metric.createHooks()}},E3=e=>w(e,td)&&e[td]===td,sg=(e,t)=>new v0(e,t),tU=(e,t)=>new O0(e,t),I3=(e,t)=>new _0(e,t),T3=(e,t)=>new rg(e,t),w3=(e,t)=>ag(rU(e,t),(r,n)=>[r,Ie(n,Mr).currentTimeMillisUnsafe()]),rU=(e,t)=>new R0(e,t),C3=(e,t)=>{let r=Or(t?.boundaries)?t.boundaries:oU({start:.5,factor:2,count:35}),n=og(t?.attributes,{time_unit:\"milliseconds\"}),o=new rg(e,{...t,boundaries:r,attributes:n});return ag(o,Ye)},k3=e=>B(Zi(),t=>V(()=>e.valueUnsafe(t))),A3=l(2,(e,t)=>B(Zi(),r=>V(()=>e.modifyUnsafe(t,r)))),mc=l(2,(e,t)=>Pa(r=>V(()=>e.updateUnsafe(t,r)))),ag=l(2,(e,t)=>new ng(e,r=>e.valueUnsafe(r),(r,n)=>e.updateUnsafe(t(r,n),n),(r,n)=>e.modifyUnsafe(t(r,n),n))),v3=l(2,(e,t)=>ag(e,()=>t)),O3=l(2,(e,t)=>{let r=G3(t);return new ng(e,n=>e.valueUnsafe(r(n)),(n,o)=>e.updateUnsafe(n,r(o)),(n,o)=>e.modifyUnsafe(n,r(o)))}),_3=pe(Zi(),e=>M0(e)),R3=B(Zi(),e=>{let t=M0(e);if(t.length>0){let r=t.reduce((u,f)=>{let p=f.id.length;return p>u?p:u},0)+2,n=t.reduce((u,f)=>{let p=Or(f.description)?f.description.length:0;return p>u?p:u},0)+2,o=t.reduce((u,f)=>{let p=f.type.length;return p>u?p:u},0)+2,s=t.reduce((u,f)=>{let p=Or(f.attributes)?nU(f.attributes).length:0;return p>u?p:u},0)+2,a=Object.entries(p_(t,u=>u.id)),c=cE(a,u=>u[0],d0).map(([,u])=>u.map(f=>P3(f,r)+M3(f,n)+F3(f,o)+U3(f,s)+N3(f)).join(`\n`)).join(`\n`);return _(c)}return _(\"\")}),M0=e=>{let t=Ie(e,P0);return Array.from(t.values()).map(({hooks:r,...n})=>({...n,state:r.get(e)}))},P3=(e,t)=>`name=${e.id.padEnd(t,\" \")}`,M3=(e,t)=>`description=${(e.description??\"\").padEnd(t,\" \")}`,F3=(e,t)=>`type=${e.type.padEnd(t,\" \")}`,U3=(e,t)=>{let r=nU(e.attributes??{}),n=\" \".repeat(Math.max(0,t-r.length));return`${r}${n}`},N3=e=>{let t=\"state=\";switch(e.type){case\"Counter\":{let r=e.state;return`${t}[count: [${r.count}]]`}case\"Frequency\":{let r=e.state;return`${t}[occurrences: ${A0(r.occurrences)}]`}case\"Gauge\":{let r=e.state;return`${t}[value: [${r.value}]]`}case\"Histogram\":{let r=e.state,n=`buckets: [${A0(r.buckets)}]`,o=`count: [${r.count}]`,s=`min: [${r.min}]`,a=`max: [${r.max}]`,i=`sum: [${r.sum}]`;return`${t}[${n}, ${o}, ${s}, ${a}, ${i}]`}case\"Summary\":{let r=e.state,n=r.quantiles.map(([u,f])=>[u,f??0]),o=`quantiles: [${A0(n)}]`,s=`count: [${r.count}]`,a=`min: [${r.min}]`,i=`max: [${r.max}]`,c=`sum: [${r.sum}]`;return`${t}[${o}, ${s}, ${a}, ${i}, ${c}]`}}},A0=e=>Array.from(e).map(([t,r])=>`(${t} -> ${r})`).join(\", \"),nU=e=>{let t=Object.entries(e);return`attributes=[${cE(t,n=>n[0],d0).map(([n,o])=>`${n}: ${o}`).join(\", \")}]`},F0=e=>Oa(zi(new Set(e),t=>t>0),Number.POSITIVE_INFINITY),D3=e=>F0(fp(e.count-1,t=>e.start+t*e.width)),oU=e=>F0(fp(e.count-1,t=>e.start*Math.pow(e.factor,t))),XF=tU(\"child_fibers_active\",{description:\"The current count of active child fibers\"}),L3=sg(\"child_fibers_started\",{description:\"The total number of child fibers that have been started\",incremental:!0}),$3=sg(\"child_fiber_successes\",{description:\"The total number of child fibers that have succeeded\",incremental:!0}),B3=sg(\"child_fiber_failures\",{description:\"The total number of child fibers that have failed\",incremental:!0}),z3=dp,rd=Se(dp,{fiberCached:!0,defaultValue:Hr}),U0={recordFiberStart(e){L3.updateUnsafe(1,e),XF.modifyUnsafe(1,e)},recordFiberEnd(e,t){XF.modifyUnsafe(-1,e),Hs(t)?$3.updateUnsafe(1,e):B3.updateUnsafe(1,e)}},j3=zp(rd)(U0),q3=zp(rd)(void 0),H3=Sr(rd,U0),W3=Sr(rd,void 0);function J3(e,t){let r=Object.entries(t).sort((n,o)=>n[0]<o[0]?-1:n[0]>o[0]?1:0);return JSON.stringify([e.type,e.id,e.description,r])}function nd(e,t,r){return{get:e,update:t,modify:r??t}}function og(e,t){return{...dc(e),...dc(t)}}function dc(e){return Or(e)&&Array.isArray(e)?e.reduce((t,[r,n])=>(N(t,r,n),t),{}):e}function G3(e){let t,r={};return n=>{let o=Ie(n,tg);return o!==t&&(t=o,r=og(o,e)),Bt(n,tg,r)}}var K3=es,ps=ue,ig=Xi,V3=gI,Z3=_P,Q3=RP,Y3=PP,X3=FP,za=Jr,e6=NP,Mn=To,cg=BE,Ef=sR,b=_,ja=Vi,D0=$E,$=W,j=V,te=le;var t6=Up;var If=Tt,hc=Ap,r6=jP,n6=qP,o6=WP;var s6=HP,Zr=sx,M=Ze,ug=ox,Ct=_e,Ys=nR,Tr=js,Tf=oR;var od=qu,a6=LE,wr=re,i6=lO,sd=Ki,c6=DE,u6=rR,f6=tR,T=B,ad=yR,Dr=br,Cr=So,l6=Ra,p6=rP,to=Qu,q=pe,Vt=Kt,fg=Hu,qa=Wu,d6=dR,L0=$R,m6=eI,wf=Kr;var h6=lx,x6=ZR,g6=QR,y6=YR,b6=XR,_t=Gr,id=WR,S6=_p,E6=fx,I6=HR,T6=rI,w6=Vu,$0=oI,C6=sI,B0=px,lg=nI,k6=KR,aU=JR,A6=GR,v6=ux,iU=VR,O6=aI,_6=Yp,R6=w0,P6=mR,M6=dx,F6=mx,U6=HF,N6=_M,D6=eP,L6=tP,$6=uP,B6=uI,z6=cI,z0=cP,Ha=Ua,j6=fP,j0=HE,q6=WE,H6=hR,Cf=JE,q0=$P,W6=BP,H0=zP,J6=yI,G6=bI,K6=BR,V6=LP,pg=zR,W0=hx,Z6=Rp,Q6=iI,Y6=sP,X6=xR,xc=yo,J0=Zu,eK=aP,tK=iP,Xs=Zi,cd=Pa,rK=Xx,cn=Eo,nK=LR,G0=UR,K0=NR,oK=Gu,sK=Ws,aK=DR,ds=Sr,iK=cx,gc=Qi,dg=yx,V0=bx,ea=Sx,cK=EP,cU=SP,uK=Fa,yc=gP,Ao=mI,fK=yP,lK=hI,Z0=Io,Fn=On,pK=pI,dK=dI,mK=wP,hK=TP,xK=xI,un=CP,gK=Ex,Q0=bP,ta=Yi,ms=Vr,yK=vP,bK=OP,nr=Ku,SK=zF,EK=T0,IK=tI,TK=jR,wK=l(2,(e,t)=>uU(e,void 0,t)),uU=jF,CK=nM,kK=oM,AK=sM,vK=aM,OK=mM,_K=hM,RK=xM,PK=gM,MK=fM,FK=lM,UK=pM,Y0=cM,NK=bo,DK=xp,LK=dM,$K=uM,BK=zu,zK=KF,jK=VF,kf=JP,Zt=SI,Af=KP,qK=wx,HK=GP,WK=iR,JK=cR,hs=ZP,Lr=Js,X0=EI,eT=QP,bc=XP,ud=II,Sc=YP,tT=Cx,rT=tM,nT=TI,ro=eM,oT=kx,we=vp,GK=uR,Ec=nn,mg=wo,KK=wo(),VK=wo(\"Fatal\"),ZK=wo(\"Warn\"),sT=wo(\"Error\"),QK=wo(\"Info\"),YK=wo(\"Debug\"),XK=wo(\"Trace\"),eV=l(2,(e,t)=>Ws(e,ef,r=>new Set([...r,t]))),tV=l(e=>ps(e[0]),(e,...t)=>Ws(e,Lp,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||N(n,t[0],t[1]),n})),rV=vM,nV=l(2,(e,t)=>B(vx,r=>Ws(e,$p,n=>[[t,r],...n]))),oV=l(e=>ps(e[0]),(e,t,r)=>Fn(e,n=>{let o=r===void 0?n:r(n);return mc(t,o)})),sV=l(e=>ps(e[0]),(e,t,r)=>Cr(e,n=>{let o=r===void 0?n:r(n);return mc(t,o)})),aV=l(e=>ps(e[0]),(e,t,r)=>lg(e,n=>{let o=r===void 0?n:r(n);return mc(t,o)})),iV=l(e=>ps(e[0]),(e,t,r)=>iU(e,n=>{let o=r===void 0?n:r(n);return mc(t,o)})),cV=l(e=>ps(e[0]),(e,t,r)=>Ec(n=>{let o=n.monotonicTimeNanosUnsafe();return Fn(e,()=>{let s=n.monotonicTimeNanosUnsafe(),a=QS(ge(s),ge(o)),i=r===void 0?a:r(a);return mc(t,i)})})),Sf=class extends fr()(\"effect/Effect/Transaction\"){},uV=e=>wr(t=>{let r=rp(t.context,Sf);if(r)return e;r={journal:new Map,retry:!1};let n;return ms(o=>T(Mn({while:()=>!n,body:Ne(o(e).pipe(ds(Sf,r),aU(()=>r.retry?o(fV(r)):te),to)),step(s){if(r.retry||!fU(r))return sU(r);je(s)?lV(t,r):sU(r),n=s}}),()=>n))}),fU=e=>{for(let[t,{version:r}]of e.journal)if(t.version!==r)return!1;return!0},fV=e=>If(t=>{if(!fU(e))return t(te);let r={},n=Array.from(e.journal.keys()),o=()=>{for(let a of n)a.pending.delete(r)},s=()=>{o(),t(te)};for(let a of n)a.pending.set(r,s);return j(o)});function lV(e,t){for(let[r,{value:n,written:o}]of t.journal)if(o){Object.is(n,r.value)||(r.version=r.version+1,r.value=n);for(let s of r.pending.values())e.currentDispatcher.scheduleTask(s,0);r.pending.clear()}}function sU(e){e.retry=!1,e.journal.clear()}var pV=T(Sf,e=>(e.retry=!0,un)),dV=(e,t,r)=>(...n)=>If(o=>{try{e(...n,(s,a)=>{o(s?M(t?t(s,n):s):b(a))})}catch(s){o(r?M(r(s,n)):Tr(s))}}),mV=()=>e=>e,hV=()=>e=>e,xV=()=>e=>e,Un=bR,fd=SR,lr=ER,ut=gR,vf=IR,aT=fR;var lU=/^[+-]?\\d+$/,cT=\"~effect/BigDecimal\",gV={[cT]:cT,[ae](){let e=fT(this);return oe(Me(String(e.value)),Dt(e.scale))},[ie](e){return uT(e)&&gU(this,e)===0},toString(){return`BigDecimal(${Oo(this)})`},toJSON(){return{_id:\"BigDecimal\",value:String(this.value),scale:this.scale}},[Ee](){return this.toJSON()},pipe(){return K(this,arguments)}},uT=e=>w(e,cT),mU=(e,t)=>{if(!Number.isSafeInteger(t))throw new RangeError(`Scale must be a safe integer, got ${t}`);let r=Object.create(gV);return r.value=e,r.scale=t,r},hU=(e,t)=>{let r=mU(e,t);return r.normalized=r,r};var vo=BigInt(0),yV=BigInt(1);var bV=BigInt(10),xU=hU(vo,0);var fT=e=>{if(e.normalized===void 0)if(e.value===vo)e.normalized=xU;else{let t=`${e.value}`,r=t.length;for(;t[r-1]===\"0\";)r--;e.normalized=hU(BigInt(t.slice(0,r)),e.scale-(t.length-r))}return e.normalized};var SV=100,EV=[yV],iT=(e,t)=>e===t?0:e<t?-1:1,pU=(e,t)=>{let r=`${e.value<vo?-e.value:e.value}`,n=`${t.value<vo?-t.value:t.value}`,o=BigInt(r.length-n.length)-BigInt(e.scale)+BigInt(t.scale);if(o!==vo)return o<vo?-1:1;let s=Math.max(r.length,n.length);return yh(r.padEnd(s,\"0\"),n.padEnd(s,\"0\"))},gU=(e,t)=>{if(e.scale===t.scale)return iT(e.value,t.value);let r=dU(e),n=dU(t);if(r!==n)return r<n?-1:1;if(r===0)return 0;let o=e.scale-t.scale,s=Math.abs(o);if(s>SV)return r===-1?pU(t,e):pU(e,t);let a=EV[s]??=bV**BigInt(s);return o>0?iT(e.value,t.value*a):iT(e.value*a,t.value)},Of=rs(gU);var dU=e=>e.value===vo?0:e.value<vo?-1:1;var hg=e=>{if(e===\"\")return O(xU);let t,r,n=e.search(/[eE]/);if(n!==-1){let c=e.slice(n+1);if(t=e.slice(0,n),r=Number(c),t===\"\"||!Number.isSafeInteger(r)||!lU.test(c))return v()}else t=e,r=0;let o,s,a=t.search(/\\./);if(a!==-1){let c=t.slice(0,a),u=t.slice(a+1);o=`${c}${u}`,s=u.length}else o=t,s=0;if(!lU.test(o))return v();let i=s-r;return Number.isSafeInteger(i)?O(mU(BigInt(o),i)):v()};var Oo=e=>{let t=fT(e);if(Math.abs(t.scale)>=16)return IV(t);let r=t.value<vo,n=`${r?-t.value:t.value}`,o=t.scale>0?n.padStart(t.scale+1,\"0\"):n.padEnd(n.length-t.scale,\"0\"),s=o.length-t.scale,a=t.scale>0?`${o.slice(0,s)}.${o.slice(s)}`:o;return r?`-${a}`:a},IV=e=>{if(TV(e))return\"0e+0\";let t=fT(e),r=`${t.value}`,n=t.value<vo?2:1,o=r.slice(0,n),s=r.slice(n),a=s.length-t.scale;return`${o}${s===\"\"?\"\":`.${s}`}e${a>=0?\"+\":\"\"}${a}`};var TV=e=>e.value===vo;var yb={};$e(yb,{Any:()=>AY,Array:()=>qe,ArrayEnsure:()=>LY,BigDecimal:()=>eL,BigDecimalFromString:()=>y7,BigInt:()=>cl,BigIntFromString:()=>r7,Boolean:()=>Qk,BooleanFromBit:()=>u7,BooleanLiterals:()=>eA,ByteSize:()=>Pm,ByteSizeFromBigInt:()=>S7,ByteSizeFromNumber:()=>E7,ByteSizeFromString:()=>b7,Cause:()=>Jk,CauseReason:()=>Wk,Char:()=>z9,Chunk:()=>I7,Class:()=>RL,Cookie:()=>vL,Cookies:()=>OL,Date:()=>Rm,DateFromMillis:()=>V9,DateFromString:()=>K9,DateTimeUtc:()=>mb,DateTimeUtcFromDate:()=>v7,DateTimeUtcFromMillis:()=>_7,DateTimeUtcFromString:()=>O7,DateTimeZoned:()=>gL,DateTimeZonedFromString:()=>F7,Defect:()=>q9,Duration:()=>xb,DurationFromMillis:()=>TX,DurationFromNanos:()=>IX,DurationFromString:()=>AL,Enum:()=>CY,Error:()=>PL,ErrorInstance:()=>j9,Exit:()=>wX,FalseLiterals:()=>v2,File:()=>G2,Finite:()=>wm,FiniteFromString:()=>t7,FormData:()=>K2,Graph:()=>vX,HashMap:()=>OX,HashSet:()=>_X,Headers:()=>UX,InetAddress:()=>CL,InetAddressFromString:()=>hX,InetAddressV4:()=>dX,InetAddressV6:()=>mX,Int:()=>Is,IpAddress:()=>eu,IpAddressFromString:()=>pl,IpInterface:()=>EL,IpInterfaceFromString:()=>uX,IpLinkLocalAddress:()=>V7,IpLinkLocalAddressFromString:()=>Z7,IpLoopbackAddress:()=>G7,IpLoopbackAddressFromString:()=>K7,IpMulticastAddress:()=>U7,IpMulticastAddressFromString:()=>N7,IpNetwork:()=>wL,IpNetworkFromString:()=>pX,IpUnicastAddress:()=>$7,IpUnicastAddressFromString:()=>B7,IpUnspecifiedAddress:()=>Q7,IpUnspecifiedAddressFromString:()=>Y7,Ipv4Address:()=>hb,Ipv4AddressFromString:()=>uA,Ipv4BroadcastAddress:()=>q7,Ipv4BroadcastAddressFromString:()=>H7,Ipv4Interface:()=>bL,Ipv4InterfaceFromString:()=>iX,Ipv4Network:()=>IL,Ipv4NetworkFromString:()=>fX,Ipv4PrivateAddress:()=>X7,Ipv4PrivateAddressFromString:()=>eX,Ipv6Address:()=>fA,Ipv6AddressFromString:()=>yL,Ipv6Interface:()=>SL,Ipv6InterfaceFromString:()=>cX,Ipv6Network:()=>TL,Ipv6NetworkFromString:()=>lX,Ipv6UniqueLocalAddress:()=>tX,Ipv6UniqueLocalAddressFromString:()=>rX,Json:()=>gb,JsonFromUrlParamsField:()=>NX,JsonObject:()=>fee,Literal:()=>Qt,Literals:()=>Es,MacAddress:()=>Xc,MacAddressFromString:()=>ll,MacBroadcastAddress:()=>W7,MacBroadcastAddressFromString:()=>J7,MacLocallyAdministeredAddress:()=>nX,MacLocallyAdministeredAddressFromString:()=>oX,MacMulticastAddress:()=>D7,MacMulticastAddressFromString:()=>L7,MacUnicastAddress:()=>z7,MacUnicastAddressFromString:()=>j7,MacUniversallyAdministeredAddress:()=>sX,MacUniversallyAdministeredAddressFromString:()=>aX,MutableJson:()=>pee,Natural:()=>Zc,Never:()=>kY,NonEmptyArray:()=>Tm,NonEmptyString:()=>j2,Null:()=>ib,NullOr:()=>Xk,NullishOr:()=>b2,Number:()=>il,NumberFromString:()=>e7,ObjectKeyword:()=>_Y,Opaque:()=>QY,Option:()=>tu,OptionFromNullOr:()=>RX,OptionFromNullishOr:()=>MX,OptionFromOptional:()=>$X,OptionFromOptionalKey:()=>LX,OptionFromOptionalNullOr:()=>BX,OptionFromUndefinedOr:()=>PX,PropertyKey:()=>Hk,ReadonlyMap:()=>H9,ReadonlySet:()=>W9,Record:()=>la,RecordFromCookies:()=>FX,RecordFromUrlParams:()=>DX,Redacted:()=>pA,RedactedFromValue:()=>zX,RegExp:()=>J9,Result:()=>jX,SchemaError:()=>fa,SocketAddress:()=>gX,StandardSchemaV1FailureResult:()=>c7,String:()=>X,StringForLiteralAutocomplete:()=>vY,StringFromBase64:()=>o7,StringFromBase64Url:()=>s7,StringFromHex:()=>a7,StringFromUriComponent:()=>i7,Struct:()=>Ue,StructWithRest:()=>NY,Symbol:()=>x2,TaggedClass:()=>JX,TaggedError:()=>GX,TaggedStruct:()=>fb,TaggedUnion:()=>ZY,TemplateLiteral:()=>TY,TemplateLiteralParser:()=>wY,TimeZone:()=>hL,TimeZoneFromString:()=>M7,TimeZoneNamed:()=>dL,TimeZoneNamedFromString:()=>P7,TimeZoneOffset:()=>R7,Tree:()=>uee,Trim:()=>n7,Trimmed:()=>Z2,TrueLiterals:()=>A2,Tuple:()=>Ss,TupleWithRest:()=>DY,URL:()=>pb,URLFromString:()=>G9,URLSearchParams:()=>V2,Uint8Array:()=>db,Uint8ArrayFromBase64:()=>f7,Uint8ArrayFromBase64Url:()=>l7,Uint8ArrayFromHex:()=>p7,Undefined:()=>Zk,UndefinedOr:()=>ub,Union:()=>yt,UniqueArray:()=>$Y,UniqueSymbol:()=>RY,UnixPathAddress:()=>kL,UnixPathAddressFromString:()=>xX,Unknown:()=>Im,UnknownFromJsonString:()=>Q9,UrlParams:()=>lA,Void:()=>OY,annotate:()=>YQ,annotateEncoded:()=>XQ,annotateKey:()=>eY,asserts:()=>sY,brand:()=>I2,catchDecoding:()=>qY,catchDecodingWithContext:()=>C2,catchEncoding:()=>HY,catchEncodingWithContext:()=>k2,check:()=>zY,declare:()=>He,declareConstructor:()=>yn,decode:()=>WY,decodeEffect:()=>Vk,decodeExit:()=>aY,decodeOption:()=>cY,decodePromise:()=>fY,decodeResult:()=>uY,decodeSync:()=>lY,decodeTo:()=>ee,decodeUnknownEffect:()=>ob,decodeUnknownExit:()=>a2,decodeUnknownOption:()=>iY,decodeUnknownPromise:()=>c2,decodeUnknownResult:()=>i2,decodeUnknownSync:()=>u2,encode:()=>JY,encodeEffect:()=>f2,encodeExit:()=>pY,encodeKeys:()=>FY,encodeOption:()=>mY,encodePromise:()=>xY,encodeResult:()=>hY,encodeSync:()=>gY,encodeTo:()=>tA,encodeUnknownEffect:()=>sb,encodeUnknownExit:()=>l2,encodeUnknownOption:()=>dY,encodeUnknownPromise:()=>d2,encodeUnknownResult:()=>p2,encodeUnknownSync:()=>m2,extendTo:()=>UY,fieldsAssign:()=>PY,flip:()=>qk,fromBrand:()=>jY,fromFormData:()=>Y9,fromJsonString:()=>iA,fromURLSearchParams:()=>X9,instanceOf:()=>fi,is:()=>oY,isBase64:()=>F2,isBase64Url:()=>a9,isBetween:()=>_m,isBetweenBigDecimal:()=>g7,isBetweenBigInt:()=>_9,isBetweenCodePoints:()=>M9,isBetweenDate:()=>k9,isBetweenLength:()=>oA,isBetweenProperties:()=>$9,isBetweenSize:()=>N9,isCapitalized:()=>p9,isEndingWith:()=>c9,isFinite:()=>m9,isGUID:()=>o9,isGreaterThan:()=>x9,isGreaterThanBigDecimal:()=>d7,isGreaterThanBigInt:()=>A9,isGreaterThanDate:()=>I9,isGreaterThanOrEqualTo:()=>U2,isGreaterThanOrEqualToBigDecimal:()=>m7,isGreaterThanOrEqualToBigInt:()=>N2,isGreaterThanOrEqualToDate:()=>T9,isIncluding:()=>u9,isInt:()=>lb,isInt32:()=>S9,isLessThan:()=>g9,isLessThanBigDecimal:()=>h7,isLessThanBigInt:()=>v9,isLessThanDate:()=>w9,isLessThanOrEqualTo:()=>y9,isLessThanOrEqualToBigDecimal:()=>x7,isLessThanOrEqualToBigInt:()=>O9,isLessThanOrEqualToDate:()=>C9,isLowercased:()=>l9,isMaxCodePoints:()=>P9,isMaxLength:()=>B2,isMaxProperties:()=>L9,isMaxSize:()=>U9,isMinCodePoints:()=>R9,isMinLength:()=>D2,isMinProperties:()=>D9,isMinSize:()=>F9,isMultipleOf:()=>b9,isNonEmpty:()=>$2,isPattern:()=>fl,isPropertyNames:()=>B9,isSchema:()=>ab,isSchemaError:()=>t2,isStartingWith:()=>i9,isStringBigInt:()=>e9,isStringFinite:()=>XY,isStringSymbol:()=>t9,isTrimmed:()=>M2,isULID:()=>s9,isUUID:()=>n9,isUint32:()=>E9,isUncapitalized:()=>d9,isUnique:()=>aA,isUniqueKey:()=>z2,isUppercased:()=>f9,link:()=>Re,linkDecoding:()=>ul,make:()=>G,makeFilter:()=>Le,makeFilterGroup:()=>YY,makeIsBetween:()=>Om,makeIsGreaterThan:()=>Cm,makeIsGreaterThanOrEqualTo:()=>km,makeIsLessThan:()=>Am,makeIsLessThanOrEqualTo:()=>vm,makeIsMultipleOf:()=>h9,middlewareDecoding:()=>T2,middlewareEncoding:()=>w2,mutable:()=>BY,mutableKey:()=>SY,optional:()=>sl,optionalKey:()=>Qc,overrideToCodecIso:()=>iee,overrideToEquivalence:()=>ZX,overrideToFormatter:()=>KX,readonlyKey:()=>EY,refine:()=>E2,required:()=>bY,requiredKey:()=>yY,resolveAnnotations:()=>dee,resolveAnnotationsKey:()=>mee,revealBottom:()=>QQ,revealCodec:()=>tY,suspend:()=>S2,tag:()=>Yc,tagDefaultOmit:()=>VY,toCodecArrayFromSingle:()=>ree,toCodecIso:()=>tee,toCodecJson:()=>eee,toCodecStringTree:()=>Fm,toDifferJsonPatch:()=>cee,toEncoded:()=>al,toEncoderXml:()=>nee,toEquivalence:()=>QX,toFormatter:()=>VX,toIso:()=>oee,toIsoFocus:()=>aee,toIsoSource:()=>see,toJsonSchemaDocument:()=>XX,toRepresentation:()=>YX,toStandardJSONSchemaV1:()=>nY,toStandardSchemaV1:()=>rY,toTaggedUnion:()=>P2,toType:()=>bn,withArrayLengthConstraints:()=>cb,withConstructorDefault:()=>O2,withDecodingDefault:()=>R2,withDecodingDefaultKey:()=>rA,withDecodingDefaultType:()=>KY,withDecodingDefaultTypeKey:()=>GY});var yU=globalThis.BigInt;var bU=e=>e>yU(Number.MAX_SAFE_INTEGER)||e<yU(Number.MIN_SAFE_INTEGER)?v():O(Number(e));var ld=BigInt(0),wV=BigInt(1),xs=BigInt(1e3),Wa=BigInt(1024),EU=[{symbol:\"B\",factor:wV,names:[\"B\",\"byte\",\"bytes\"]},{symbol:\"kB\",factor:xs,names:[\"kB\",\"kilobyte\",\"kilobytes\"]},{symbol:\"MB\",factor:xs**BigInt(2),names:[\"MB\",\"megabyte\",\"megabytes\"]},{symbol:\"GB\",factor:xs**BigInt(3),names:[\"GB\",\"gigabyte\",\"gigabytes\"]},{symbol:\"TB\",factor:xs**BigInt(4),names:[\"TB\",\"terabyte\",\"terabytes\"]},{symbol:\"PB\",factor:xs**BigInt(5),names:[\"PB\",\"petabyte\",\"petabytes\"]},{symbol:\"EB\",factor:xs**BigInt(6),names:[\"EB\",\"exabyte\",\"exabytes\"]},{symbol:\"ZB\",factor:xs**BigInt(7),names:[\"ZB\",\"zettabyte\",\"zettabytes\"]},{symbol:\"YB\",factor:xs**BigInt(8),names:[\"YB\",\"yottabyte\",\"yottabytes\"]},{symbol:\"RB\",factor:xs**BigInt(9),names:[\"RB\",\"ronnabyte\",\"ronnabytes\"]},{symbol:\"QB\",factor:xs**BigInt(10),names:[\"QB\",\"quettabyte\",\"quettabytes\"]}],CV=[EU[0],{symbol:\"KiB\",factor:Wa,names:[\"KiB\",\"kibibyte\",\"kibibytes\"]},{symbol:\"MiB\",factor:Wa**BigInt(2),names:[\"MiB\",\"mebibyte\",\"mebibytes\"]},{symbol:\"GiB\",factor:Wa**BigInt(3),names:[\"GiB\",\"gibibyte\",\"gibibytes\"]},{symbol:\"TiB\",factor:Wa**BigInt(4),names:[\"TiB\",\"tebibyte\",\"tebibytes\"]},{symbol:\"PiB\",factor:Wa**BigInt(5),names:[\"PiB\",\"pebibyte\",\"pebibytes\"]},{symbol:\"EiB\",factor:Wa**BigInt(6),names:[\"EiB\",\"exbibyte\",\"exbibytes\"]},{symbol:\"ZiB\",factor:Wa**BigInt(7),names:[\"ZiB\",\"zebibyte\",\"zebibytes\"]},{symbol:\"YiB\",factor:Wa**BigInt(8),names:[\"YiB\",\"yobibyte\",\"yobibytes\"]}],IU=[...EU,...CV.slice(1)],kV=new Map(IU.flatMap(e=>e.names.map(t=>[t,e]))),AV=new Map(IU.map(e=>[e.symbol,e])),_f=e=>e,due=_f(ld),Ja=e=>{throw new Error(`Invalid ByteSize: ${e}`)},TU=e=>!Number.isSafeInteger(e)||e<0?Ja(`expected a non-negative safe integer, received ${e}`):_f(BigInt(e)),vV=(e,t)=>{if(typeof e==\"bigint\")return e<ld?Ja(`expected a non-negative quantity, received ${e}`):_f(e*t.factor);let r=e*Number(t.factor);return!Number.isSafeInteger(r)||r<0?Ja(`expected an exact non-negative safe-integer byte result, received ${e} ${t.symbol}`):_f(BigInt(r))},wU=e=>{let t=/^\\s*(\\d+)(?:\\.(\\d+))?\\s*([A-Za-z]+)\\s*$/.exec(e);if(t===null)return Ja(`unsupported syntax ${JSON.stringify(e)}`);let r=kV.get(t[3]);if(r===void 0)return Ja(`unsupported unit ${JSON.stringify(t[3])}`);let n=t[2]??\"\",o=BigInt(10)**BigInt(n.length),s=BigInt(t[1]+n)*r.factor;return s%o!==ld?Ja(`${JSON.stringify(e)} does not represent an integral number of bytes`):_f(s/o)},CU=po(wU),xg=e=>{switch(typeof e){case\"bigint\":return e<ld?Ja(`expected a non-negative bigint, received ${e}`):_f(e);case\"number\":return TU(e);case\"string\":return wU(e)}return Ja(`unsupported input ${e}`)},pT=po(xg),kU=e=>typeof e==\"bigint\"?xg(e):TU(e),OV=e=>t=>vV(t,AV.get(e));var mue=OV(\"MiB\");var AU=e=>typeof e==\"bigint\"&&e>=ld;var gg=e=>e,vU=bU;var _U=\"~effect/Chunk\";function OU(e,t,r,n,o){for(let s=t;s<Math.min(e.length,t+o);s++)r[n+s-t]=e[s];return r}var RU=[],mT=e=>Lt((t,r)=>{if(t.length!==r.length)return!1;let n=Ic(t),o=Ic(r);for(let s=0;s<n.length;s++)if(!e(n[s],o[s]))return!1;return!0}),PV=mT(J),MV={[_U]:{_A:e=>e},toString(){return`Chunk(${L(Ic(this))})`},toJSON(){return{_id:\"Chunk\",values:$t(Ic(this))}},[Ee](){return this.toJSON()},[ie](e){return bg(e)&&PV(this,e)},[ae](){return xr(Ic(this))},[Symbol.iterator](){switch(this.backing._tag){case\"IArray\":return this.backing.array[Symbol.iterator]();case\"IEmpty\":return RU[Symbol.iterator]();default:return Ic(this)[Symbol.iterator]()}},pipe(){return K(this,arguments)}},hT=e=>{let t=Object.create(MV);switch(t.backing=e,e._tag){case\"IEmpty\":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case\"IConcat\":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case\"IArray\":{t.length=e.array.length,t.depth=0,t.left=ra,t.right=ra;break}case\"ISingleton\":{t.length=1,t.depth=0,t.left=ra,t.right=ra;break}case\"ISlice\":{t.length=e.length,t.depth=0,t.left=ra,t.right=ra;break}}return t},bg=e=>w(e,_U),ra=hT({_tag:\"IEmpty\"}),FV=()=>ra;var UV=e=>hT({_tag:\"ISingleton\",a:e}),xT=e=>bg(e)?e:DV(be(e)),dT=(e,t,r)=>{switch(e.backing._tag){case\"IArray\":{OU(e.backing.array,0,t,r,e.length);break}case\"IConcat\":{dT(e.left,t,r),dT(e.right,t,r+e.left.length);break}case\"ISingleton\":{t[r]=e.backing.a;break}case\"ISlice\":{OU(Ic(e.backing.chunk),e.backing.offset,t,r,e.length);break}}};var NV=e=>{switch(e.backing._tag){case\"IEmpty\":return RU;case\"IArray\":return e.backing.array;default:{let t=new Array(e.length);return dT(e,t,0),e.backing={_tag:\"IArray\",array:t},e.left=ra,e.right=ra,e.depth=0,t}}},Ic=NV;var DV=e=>e.length===0?FV():e.length===1?UV(e[0]):hT({_tag:\"IArray\",array:e});var PU=e=>e.length;var yT=ic,MU=Zs,FU=oF,UU=jx,NU=sF,DU=r0,LU=aF;var $U=qx;var BU=cc;var Tc=iF,Sg=cF;var wc=uF;var bT=o0,pd=Gp,Eg=s0;var Ig=Kp,Cc=fF;var zU=Qs;var jU=c0;var Tg=gF;var dd=p0;var kg={};$e(kg,{decode:()=>Ga,decodeString:()=>ST,encode:()=>kc});var kc=e=>LV(typeof e==\"string\"?$V.encode(e):e),Ga=e=>{let t=zV(e),r=t.length;if(r%4!==0)return D(new Jn({kind:\"Decode\",module:\"Base64\",input:t,message:`Length must be a multiple of 4, but is ${r}`}));let n=t.indexOf(\"=\");if(n!==-1&&(n<r-2||n===r-2&&t[r-1]!==\"=\"))return D(new Jn({kind:\"Decode\",module:\"Base64\",input:t,message:\"Found a '=' character, but it is not at the end\"}));try{let o=t.endsWith(\"==\")?2:t.endsWith(\"=\")?1:0,s=new Uint8Array(3*(r/4)-o);for(let a=0,i=0;a<r;a+=4,i+=3){let c=Cg(t.charCodeAt(a))<<18|Cg(t.charCodeAt(a+1))<<12|Cg(t.charCodeAt(a+2))<<6|Cg(t.charCodeAt(a+3));s[i]=c>>16,s[i+1]=c>>8&255,s[i+2]=c&255}return P(s)}catch(o){return D(new Jn({kind:\"Decode\",module:\"Base64\",input:t,message:o instanceof Error?o.message:\"Invalid input\"}))}},ST=e=>mt(Ga(e),t=>BV.decode(t)),LV=e=>{let t=e.length,r=\"\",n;for(n=2;n<t;n+=3)r+=_o[e[n-2]>>2],r+=_o[(e[n-2]&3)<<4|e[n-1]>>4],r+=_o[(e[n-1]&15)<<2|e[n]>>6],r+=_o[e[n]&63];return n===t+1&&(r+=_o[e[n-2]>>2],r+=_o[(e[n-2]&3)<<4],r+=\"==\"),n===t&&(r+=_o[e[n-2]>>2],r+=_o[(e[n-2]&3)<<4|e[n-1]>>4],r+=_o[(e[n-1]&15)<<2],r+=\"=\"),r},$V=new TextEncoder,BV=new TextDecoder,zV=e=>e.replace(/[\\n\\r]/g,\"\"),_o=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",md=new Uint8Array(123).fill(255);for(let e=0;e<_o.length;e++)md[_o.charCodeAt(e)]=e;md[61]=0;var Cg=e=>{if(e>=md.length||md[e]===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return md[e]};var vg=\"~effect/HashMap\",Ro=5,xd=1<<Ro,jV=xd/4,qU=xd/2,qV=xd-1,HV=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),hd=(e,t)=>e>>>t&qV,Ka=(e,t)=>1<<hd(e,t),Ag=(e,t)=>HV(e&t-1);function HU(e,t,r,n,o,s){if(t>32)throw new Error(\"HashMap: max depth exceeded\");let a=Ka(r,t),i=Ka(o,t);if(a===i){let f=HU(e,t+Ro,r,n,o,s);return new Oc(e,a,[f])}let c=a|i,u=a>>>0<i>>>0?[n,s]:[s,n];return new Oc(e,c,u)}var WV=Me(\"HashMap\"),WU=(e,t)=>oe(H(e),H(t)),JU=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r];n&&(t^=n.subtreeHash())}return t},Ac=class{canEdit(t){return this.edit===t}subtreeHash(){let t=this._hash;if(t===void 0){let r=bi;t=this.computeHash(),r===bi&&(this._hash=t)}return t}},ET=class extends Ac{_tag=\"EmptyNode\";edit=0;get size(){return 0}get(t,r,n){return v()}has(t,r,n){return!1}set(t,r,n,o,s,a){return a.value=!0,new vc(t,n,o,s)}remove(t,r,n,o,s){return this}canEdit(t){return!1}computeHash(){return 0}},vc=class e extends Ac{_tag=\"LeafNode\";edit;hash;key;value;constructor(t,r,n,o){super(),this.edit=t,this.hash=r,this.key=n,this.value=o}get size(){return 1}get(t,r,n){return this.hash===r&&J(this.key,n)?O(this.value):v()}has(t,r,n){return this.hash===r&&J(this.key,n)}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash===n&&J(this.key,o))return J(this.value,s)?this:this.canEdit(t)?(this.value=s,this):new e(t,n,o,s);if(a.value=!0,this.hash===n)return new IT(t,n,[[this.key,this.value],[o,s]]);let i=Ka(n,r),c=Ka(this.hash,r);if(i===c)return new Oc(t,i,[this.set(t,r+Ro,n,o,s,a)]);let u=i|c,f=i>>>0<c>>>0?[new e(t,n,o,s),this]:[this,new e(t,n,o,s)];return new Oc(t,u,f)}remove(t,r,n,o,s){if(this.hash===n&&J(this.key,o)){s.value=!0;return}return this}computeHash(){return WU(this.key,this.value)}},IT=class e extends Ac{_tag=\"CollisionNode\";edit;hash;entries;constructor(t,r,n){super(),this.edit=t,this.hash=r,this.entries=n}get size(){return this.entries.length}get(t,r,n){if(this.hash!==r)return v();for(let[o,s]of this.entries)if(J(o,n))return O(s);return v()}has(t,r,n){if(this.hash!==r)return!1;for(let[o]of this.entries)if(J(o,n))return!0;return!1}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return a.value=!0,HU(t,r,this.hash,this,n,new vc(t,n,o,s));for(let i=0;i<this.entries.length;i++)if(J(this.entries[i][0],o)){if(J(this.entries[i][1],s))return this;if(this.canEdit(t))return this.entries[i]=[o,s],this;let c=[...this.entries];return c[i]=[o,s],new e(t,this.hash,c)}return a.value=!0,this.canEdit(t)?(this.entries.push([o,s]),this):new e(t,this.hash,[...this.entries,[o,s]])}remove(t,r,n,o,s){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return this;let a=this.entries.findIndex(([c])=>J(c,o));if(a===-1)return this;if(s.value=!0,this.entries.length===1)return;if(this.entries.length===2){let c=this.entries[a===0?1:0];return new vc(t,this.hash,c[0],c[1])}if(this.canEdit(t))return this.entries.splice(a,1),this;let i=[...this.entries];return i.splice(a,1),new e(t,this.hash,i)}computeHash(){let t=0,r=this.entries;for(let n=0;n<r.length;n++)t^=WU(r[n][0],r[n][1]);return t}},Oc=class e extends Ac{_tag=\"IndexedNode\";edit;_size;bitmap;children;constructor(t,r,n){super(),this.edit=t,this.bitmap=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+r.size,0)),this._size}get(t,r,n){let o=Ka(r,t);if((this.bitmap&o)===0)return v();let s=Ag(this.bitmap,o);return this.children[s].get(t+Ro,r,n)}has(t,r,n){let o=Ka(r,t);if((this.bitmap&o)===0)return!1;let s=Ag(this.bitmap,o);return this.children[s].has(t+Ro,r,n)}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=Ka(n,r),c=Ag(this.bitmap,i);if((this.bitmap&i)!==0){let u=this.children[c],f=u.set(t,r+Ro,n,o,s,a);if(u===f)return this;if(this.canEdit(t))return this.children[c]=f,this;let p=[...this.children];return p[c]=f,new e(t,this.bitmap,p)}else{a.value=!0;let u=new vc(t,n,o,s),f=this.bitmap|i;if(this.canEdit(t))return this.children.splice(c,0,u),this.bitmap=f,this._size=void 0,this.children.length>qU?this.expand(t,f,this.children):this;let p=[...this.children];return p.splice(c,0,u),p.length>qU?this.expand(t,f,p):new e(t,f,p)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=Ka(n,r);if((this.bitmap&a)===0)return this;let i=Ag(this.bitmap,a),c=this.children[i],u=c.remove(t,r+Ro,n,o,s);if(!s.value)return this;if(u===void 0){let p=this.bitmap^a;if(p===0)return;if(this.children.length===2){let m=this.children[i===0?1:0];if(m._tag===\"LeafNode\")return m}if(this.canEdit(t))return this.children.splice(i,1),this.bitmap=p,this._size=void 0,this;let d=[...this.children];return d.splice(i,1),new e(t,p,d)}if(c===u)return this;if(this.canEdit(t))return this.children[i]=u,this;let f=[...this.children];return f[i]=u,new e(t,this.bitmap,f)}expand(t,r,n){let o=new globalThis.Array(xd),s=0;for(let a=0;a<xd;a++)(r&1<<a)!==0&&(o[a]=n[s++]);return new TT(t,n.length,o)}computeHash(){return JU(this.children)}},TT=class e extends Ac{_tag=\"ArrayNode\";edit;_size;count;children;constructor(t,r,n){super(),this.edit=t,this.count=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+(r?.size??0),0)),this._size}get(t,r,n){let o=hd(r,t),s=this.children[o];return s?s.get(t+Ro,r,n):v()}has(t,r,n){let o=hd(r,t),s=this.children[o];return s?s.has(t+Ro,r,n):!1}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=hd(n,r),c=this.children[i];if(c){let u=c.set(t,r+Ro,n,o,s,a);if(c===u)return this;if(this.canEdit(t))return this.children[i]=u,this;let f=[...this.children];return f[i]=u,new e(t,this.count,f)}else{a.value=!0;let u=new vc(t,n,o,s);if(this.canEdit(t))return this.children[i]=u,this.count++,this._size=void 0,this;let f=[...this.children];return f[i]=u,new e(t,this.count+1,f)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=hd(n,r),i=this.children[a];if(!i)return this;let c=i.remove(t,r+Ro,n,o,s);if(!s.value)return this;let u=this.count-(c?0:1);if(u<jV)return this.pack(t,a,c);if(i===c)return this;if(this.canEdit(t))return this.children[a]=c,c||(this.count=u),this._size=void 0,this;let f=[...this.children];return f[a]=c,new e(t,u,f)}pack(t,r,n){let o=[],s=0,a=1;for(let i=0;i<this.children.length;i++){let c=i===r?n:this.children[i];c&&(o.push(c),s|=a),a<<=1}return new Oc(t,s,o)}computeHash(){return JU(this.children)}},Og=class{stack;project;entries=[];index=0;constructor(t,r){this.stack=[t],this.project=r}next(){for(;;){if(this.index<this.entries.length){let r=this.entries[this.index++];return{done:!1,value:this.project(r[0],r[1])}}if(this.stack.length===0)return{done:!0,value:void 0};let t=this.stack.pop();switch(t._tag){case\"LeafNode\":{let r=t;return{done:!1,value:this.project(r.key,r.value)}}case\"CollisionNode\":{this.entries=t.entries,this.index=0;break}case\"IndexedNode\":case\"ArrayNode\":{let r=t.children;for(let n=r.length-1;n>=0;n--){let o=r[n];o&&this.stack.push(o)}}}}}[Symbol.iterator](){return this}},JV=(e,t)=>[e,t];var gd=class{[vg]=vg;_editable;_edit;_root;_size;constructor(t,r,n,o){this._editable=t,this._edit=r,this._root=n,this._size=o}get size(){return this._size}[Symbol.iterator](){return new Og(this._root,JV)}[ie](t){if(wT(t)){let r=t;if(this.size!==r.size)return!1;for(let[n,o]of this){let s=Pl(t,VU(n));if(fe(s)||!J(o,s.value))return!1}return!0}return!1}[ae](){return cr(WV^this._root.subtreeHash())}[Ee](){return $t(this)}toString(){return`HashMap(${L(Array.from(this))})`}toJSON(){return{_id:\"HashMap\",values:Array.from(this).map(([t,r])=>[$t(t),$t(r)])}}pipe(){return K(this,arguments)}},GU=new ET,wT=e=>w(e,vg),CT=()=>new gd(!1,0,GU,0);var KU=e=>{let t=GU,r=0,n={value:!1};for(let[o,s]of e){let a=H(o);n.value=!1,t=t.set(NaN,0,a,o,s,n),n.value&&r++}return new gd(!1,0,t,r)};var VU=l(2,(e,t)=>e._root.get(0,H(t),t));var kT=l(2,(e,t)=>e._root.has(0,H(t),t));var GV=(e,t,r,n)=>{let o=e,s={value:!1},a=o._editable?o._edit:NaN,i=o._root.set(a,0,r,t,n,s);return o._editable?(o._root=i,s.value&&o._size++,e):o._root===i?e:new gd(!1,o._edit,i,o._size+(s.value?1:0))},AT=l(3,(e,t,r)=>GV(e,t,H(t),r)),vT=e=>new Og(e._root,A);var ZU=e=>e[Symbol.iterator](),_g=e=>e.size;var YU=wT;var OT=KU;var ZV=ZU,yd=e=>Array.from(ZV(e)),XU=_g;var bd=\"~effect/HashSet\",QV=Me(bd),YV={[ae](){return cr(oe(QV,H(Rg(this))))},[ie](e){return RT(e)&&Pg(this)===Pg(e)&&rN(this,t=>tN(e,t))},[Symbol.iterator](){return vT(Rg(this))},toString(){return`HashSet(${L(Array.from(this))})`},toJSON(){return{_id:\"HashSet\",values:$t(Array.from(this))}},[Ee](){return this.toJSON()},pipe(){return K(this,arguments)}},XV=e=>{let t=Object.create(YV);return t[bd]=bd,t.keyMap=e,t},RT=e=>w(e,bd),Rg=e=>e.keyMap;var eN=e=>{let t=CT();for(let r of e)t=AT(t,r,!0);return XV(t)},tN=(e,t)=>kT(Rg(e),t);var Pg=e=>_g(Rg(e));var rN=(e,t)=>{for(let r of e)if(!t(r))return!1;return!0};var PT=eN,nN=RT;var oN=Pg;var FT=\"~effect/http/Cookies\",Rf=e=>w(e,FT),UT=\"~effect/http/Cookies/Cookie\",aN=e=>w(e,UT),sN=\"~effect/http/Cookies/CookieError\",NT=class extends Bh{},_c=class e extends rn(\"CookiesError\"){static fromReason(t,r){return new e({reason:new NT({_tag:t,cause:r})})}[sN]=sN;get message(){return this.reason._tag}};var tZ={[FT]:FT,...Iu,toJSON(){return{_id:\"effect/Cookies\",cookies:Du(this.cookies,e=>e.toJSON())}},pipe(){return K(this,arguments)}},Va=e=>{let t=Object.create(tZ);return t.cookies=e,t},Mg=e=>{let t={};for(let r of e)N(t,r.name,r);return Va(t)},iN=e=>{let t=typeof e==\"string\"?[e]:e,r=[];for(let n of t){let o=rZ(n.trim());o&&r.push(o)}return Mg(r)};function rZ(e){let t=e.split(\";\").map(i=>i.trim()).filter(i=>i!==\"\");if(t.length===0)return;let r=t[0].indexOf(\"=\");if(r===-1)return;let n=t[0].slice(0,r);if(!cN.test(n))return;let o=t[0].slice(r+1),s=pN(o);if(t.length===1)return Object.assign(Object.create(DT),{name:n,value:s,valueEncoded:o});let a={};for(let i=1;i<t.length;i++){let c=t[i],u=c.indexOf(\"=\"),f=u===-1?c:c.slice(0,u).trim(),p=u===-1?void 0:c.slice(u+1).trim();switch(f.toLowerCase()){case\"domain\":{if(p===void 0)break;let d=p.trim().replace(/^\\./,\"\");d&&(a.domain=d);break}case\"expires\":{if(p===void 0)break;let d=new Date(p);isNaN(d.getTime())||(a.expires=d);break}case\"max-age\":{if(p===void 0)break;let d=parseInt(p,10);isNaN(d)||(a.maxAge=Ph(d));break}case\"path\":{if(p===void 0)break;p[0]===\"/\"&&(a.path=p);break}case\"priority\":{if(p===void 0)break;switch(p.toLowerCase()){case\"low\":a.priority=\"low\";break;case\"medium\":a.priority=\"medium\";break;case\"high\":a.priority=\"high\";break}break}case\"httponly\":{a.httpOnly=!0;break}case\"secure\":{a.secure=!0;break}case\"partitioned\":{a.partitioned=!0;break}case\"samesite\":{if(p===void 0)break;switch(p.toLowerCase()){case\"lax\":a.sameSite=\"lax\";break;case\"strict\":a.sameSite=\"strict\";break;case\"none\":a.sameSite=\"none\";break}break}}}return Object.assign(Object.create(DT),{name:n,value:s,valueEncoded:o,options:Object.keys(a).length>0?a:void 0})}var Cle=Mg([]),kle=e=>s_(e.cookies),nZ=/^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/,cN=/^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/,oZ=/^[\\u0009\\u0020-\\u003a\\u003c-\\u007e\\u0080-\\u00ff]+$/,sZ=/^[\\u0020-\\u003a\\u003c-\\u007e]+$/,DT={[UT]:UT,...Iu,toJSON(){return{_id:\"effect/Cookies/Cookie\",name:this.name,value:this.value,options:this.options}}};function LT(e,t,r){let n=encodeURIComponent(t),o=uN(e,n,r);return o!==void 0?D(o):P(Object.assign(Object.create(DT),{name:e,value:t,valueEncoded:n,options:r}))}function uN(e,t,r){if(!cN.test(e))return _c.fromReason(\"InvalidCookieName\");if(t&&!nZ.test(t))return _c.fromReason(\"InvalidCookieValue\");if(r?.domain!==void 0&&!oZ.test(r.domain))return _c.fromReason(\"InvalidCookieDomain\");if(r?.path!==void 0&&!sZ.test(r.path))return _c.fromReason(\"InvalidCookiePath\");if(r?.maxAge!==void 0&&!Ds(ge(r.maxAge)))return _c.fromReason(\"CookieInfinityMaxAge\")}var $T=(e,t,r)=>Ls(LT(e,t,r));var Ale=l(2,(e,t)=>Va({...e.cookies,...t.cookies})),vle=l(2,(e,t)=>Va(i_(e.cookies,t)));var aZ=l(e=>Rf(e[0]),(e,t,r,n)=>mt(LT(t,r,n),o=>Va(nE(e.cookies,t,o)))),iZ=l(e=>Rf(e[0]),(e,t,r,n)=>Va(nE(e.cookies,t,$T(t,r,n)))),Ole=l(e=>Rf(e[0]),(e,t,r)=>aZ(e,t,\"\",{...r,maxAge:0,expires:new Date(0)})),_le=l(e=>Rf(e[0]),(e,t,r)=>iZ(e,t,\"\",{...r,maxAge:0,expires:new Date(0)})),cZ=l(2,(e,t)=>{let r={...e.cookies};for(let[n,o,s]of t){let a=LT(n,o,s);if(Q(a))return a;N(r,n,a.success)}return P(Va(r))}),Rle=l(2,(e,t)=>Ls(cZ(e,t)));function uZ(e){let t=uN(e.name,e.valueEncoded,e.options);if(t!==void 0)throw t;let r=e.name+\"=\"+e.valueEncoded;if(e.options===void 0)return r;let n=e.options;if(n.maxAge!==void 0){let o=KS(ge(n.maxAge));r+=\"; Max-Age=\"+Math.trunc(o)}if(n.domain!==void 0&&(r+=\"; Domain=\"+n.domain),n.path!==void 0&&(r+=\"; Path=\"+n.path),n.priority!==void 0)switch(n.priority){case\"low\":r+=\"; Priority=Low\";break;case\"medium\":r+=\"; Priority=Medium\";break;case\"high\":r+=\"; Priority=High\";break}if(n.expires!==void 0&&(r+=\"; Expires=\"+n.expires.toUTCString()),n.httpOnly&&(r+=\"; HttpOnly\"),n.secure&&(r+=\"; Secure\"),n.partitioned&&(r+=\"; Partitioned\"),n.sameSite!==void 0)switch(n.sameSite){case\"lax\":r+=\"; SameSite=Lax\";break;case\"strict\":r+=\"; SameSite=Strict\";break;case\"none\":r+=\"; SameSite=None\";break}return r}var Ple=e=>Object.values(e.cookies).map(t=>`${t.name}=${t.valueEncoded}`).join(\"; \"),fN=e=>{let t={},r=Object.values(e.cookies);for(let n=0;n<r.length;n++){let o=r[n];N(t,o.name,o.value)}return t},lN=e=>Object.values(e.cookies).map(uZ);function Mle(e){let t={},r=e.length,n=0,o=0;for(;o!==r;){o=e.indexOf(\";\",n),o===-1&&(o=r);let s=e.indexOf(\"=\",n);if(s===-1)break;if(s>o){n=o+1;continue}let a=e.substring(n,s++).trim();if(!Object.hasOwn(t,a)){let i=e.charCodeAt(s)===34?e.substring(s+1,o-1).trim():e.substring(s,o).trim();N(t,a,i.indexOf(\"%\")!==-1?pN(i):i)}n=o+1}return t}var pN=e=>{try{return decodeURIComponent(e)}catch{return e}};var Ug={};$e(Ug,{isRedacted:()=>Fg,make:()=>Qa,makeEquivalence:()=>zT,value:()=>Rc,wipeUnsafe:()=>dZ});var Za=new WeakMap,BT=e=>{if(Za.has(e))return Za.get(e);throw new Error(\"Unable to get redacted value\"+(e.label?` with label: \"${e.label}\"`:\"\"))},Fle=e=>typeof e==\"string\"?e:BT(e);var dN=\"~effect/Redacted\",Fg=e=>w(e,dN),Qa=(e,t)=>{let r=Object.create(pZ);return t?.label&&(r.label=t.label),Za.set(r,e),r},pZ={[dN]:{_A:e=>e},label:void 0,...Et,toJSON(){return this.toString()},toString(){return`<redacted${ir(this.label)?\":\"+this.label:\"\"}>`},[ae](){return H(Za.get(this))},[ie](e){return Fg(e)&&J(Za.get(this),Za.get(e))}},Rc=BT,dZ=e=>Za.delete(e),zT=e=>Lt((t,r)=>e(Rc(t),Rc(r)));var jT=Symbol.for(\"~effect/http/Headers\"),mN=e=>w(e,jT),Sd=Object.defineProperties(Object.create(null),{[jT]:{value:jT},[Ii]:{value(e){return hZ(this,Ie(e,xZ))}},toJSON:{value(){return zn(this)}},[ie]:{value(e){return qT(this,e)}},[ae]:{value(){return $l(this)}},toString:{value:Iu.toString},[Ee]:{value:Iu[Ee]}}),Ng=e=>Object.assign(Object.create(Sd),e),qT=u_(Os()),mZ=Object.create(Sd),HT=e=>{if(e===void 0)return mZ;if(Symbol.iterator in e){let r=Object.create(Sd);for(let[n,o]of e)r[n.toLowerCase()]=o;return r}let t=Object.create(Sd);for(let[r,n]of Object.entries(e))Array.isArray(n)?t[r.toLowerCase()]=n.join(\", \"):n!==void 0&&(t[r.toLowerCase()]=n);return t},Lle=e=>Object.setPrototypeOf(e,Sd);var $le=l(2,(e,t)=>Ns(e[t.toLowerCase()])),Ble=l(3,(e,t,r)=>{let n=Ng(e);return n[t.toLowerCase()]=r,n}),zle=l(2,(e,t)=>Ng({...e,...HT(t)})),jle=l(2,(e,t)=>{let r=Ng(e);return Object.assign(r,t),r}),qle=l(2,(e,t)=>{let r=Ng(e);return delete r[t.toLowerCase()],r});var hZ=l(2,(e,t)=>{let r={...e},n=o=>{if(typeof o==\"string\"){let s=o.toLowerCase();s in e&&(r[s]=Qa(e[s]))}else for(let s in e)s.search(o)!==-1&&(r[s]=Qa(e[s]))};if(Array.isArray(t))for(let o=0;o<t.length;o++)n(t[o]);else n(t);return r}),Hle=(e,t)=>{for(let r=0;r<t.length;r++){let n=t[r];if(typeof n==\"string\"){if(n.toLowerCase()===e.toLowerCase())return!0}else if(e.search(n)!==-1)return!0}return!1},xZ=Se(\"effect/Headers/CurrentRedactedNames\",{defaultValue:()=>[\"authorization\",\"cookie\",\"set-cookie\",\"x-api-key\"]});var WT=\"~effect/http/UrlParams\",JT=e=>w(e,WT),yZ={...Et,[WT]:WT,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:\"UrlParams\",params:Object.fromEntries(this.params)}},[ie](e){return GT(this,e)},[ae](){return xr(this.params.flat())}},na=e=>{let t=Object.create(yZ);return t.params=e,t},Ed=e=>{if(JT(e))return e;let t=hN(e),r=[];for(let n=0;n<t.length;n++)if(Array.isArray(t[n][0])){let[o,s]=t[n];r.push([`${o[0]}[${o.slice(1).join(\"][\")}]`,s])}else r.push(t[n]);return na(r)},hN=e=>{let t=typeof e[Symbol.iterator]==\"function\"?be(e):Object.entries(e),r=[];for(let[n,o]of t)if(Array.isArray(o))for(let s=0;s<o.length;s++)o[s]!==void 0&&r.push([n,String(o[s])]);else if(o!==null&&typeof o==\"object\"){let s=hN(o);for(let[a,i]of s)r.push([[n,...typeof a==\"string\"?[a]:a],i])}else o!==void 0&&r.push([n,String(o)]);return r},GT=Lt((e,t)=>bZ(e.params,t.params)),bZ=d_(XO([Os(),Os()])),Kle=na([]);var xN=l(2,(e,t)=>iE(e.params,([r])=>r===t).pipe(Wt(([,r])=>r)));var Vle=l(3,(e,t,r)=>na(Oa(zi(e.params,([n])=>n!==t),[t,String(r)]))),SZ=l(2,(e,t)=>na(t(e.params))),Zle=l(2,(e,t)=>{let r=Ed(t).params.slice(),n=new Set;for(let o=0;o<r.length;o++)n.add(r[o][0]);for(let o=0;o<e.params.length;o++)n.has(e.params[o][0])||r.push(e.params[o]);return na(r)}),Qle=l(3,(e,t,r)=>na(Oa(e.params,[t,String(r)]))),Yle=l(2,(e,t)=>SZ(e,Nh(Ed(t).params)));var Xle=e=>new URLSearchParams(Ed(e).params).toString(),EZ=e=>{let t={};for(let[r,n]of e.params)if(!Object.hasOwn(t,r))N(t,r,n);else{let o=t[r];typeof o==\"string\"?N(t,r,[o,n]):o.push(n)}return t},gN=EZ;var KT=\"~effect/Graph\",VT=e=>w(e,KT),yN=e=>e;var TZ=(e,t,r)=>(e===\"directed\"?t.source===r.source&&t.target===r.target:t.source===r.source&&t.target===r.target||t.source===r.target&&t.target===r.source)&&J(t.data,r.data),wZ=(e,t)=>e===\"directed\"?H(t):cr(oe(H(t.data),CZ(t.source,t.target))),CZ=(e,t)=>oe(0,H(e))+oe(0,H(t)),kZ=Me(\"Graph\"),AZ={[KT]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[Ee](){return this.toJSON()},[ie](e){if(w(e,KT)){let t=yN(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[r,n]of this.nodes)if(!t.nodes.has(r)||!J(n,t.nodes.get(r)))return!1;for(let[r,n]of this.edges){let o=t.edges.get(r);if(o===void 0||!TZ(this.type,n,o))return!1}return!0}return!1},[ae](){let e=kZ;e=e^Me(this.type),e=e^Dt(this.nodes.size),e=e^Dt(this.edges.size);for(let[t,r]of this.nodes)e^=oe(H(t),H(r));for(let[t,r]of this.edges)e^=oe(H(t),wZ(this.type,r));return cr(e)},toJSON(){return{_id:\"Graph\",nodeCount:this.nodes.size,edgeCount:this.edges.size,type:this.type}},toString(){return`Graph(${this.type}, ${this.nodes.size}, ${this.edges.size})`},pipe(){return K(this,arguments)}},vZ=(e,t)=>{let r=Object.create(AZ);return r.type=e,r.mutable=t,r.transforming=!1,r.nodes=new Map,r.edges=new Map,r.adjacency=new Map,r.reverseAdjacency=new Map,r.nextNodeIndex=0,r.nextEdgeIndex=0,r.acyclic=O(!0),r};var Id=e=>{let t=yN(e);return{type:e.type,nodes:Array.from(t.nodes,([r,n])=>({index:r,data:n})).sort((r,n)=>r.index-n.index),edges:Array.from(t.edges,([r,n])=>({index:r,source:n.source,target:n.target,data:n.data})).sort((r,n)=>r.index-n.index)}},Dg=e=>{let t=vZ(e.type,!1);for(let r of e.nodes)t.nodes.set(r.index,r.data),t.adjacency.set(r.index,[]),t.reverseAdjacency.set(r.index,[]);for(let r of e.edges)t.edges.set(r.index,{source:r.source,target:r.target,data:r.data}),t.adjacency.get(r.source).push(r.index),t.reverseAdjacency.get(r.target).push(r.index),e.type===\"undirected\"&&(t.adjacency.get(r.target).push(r.index),t.reverseAdjacency.get(r.source).push(r.index));return t.nextNodeIndex=e.nodes.length===0?0:e.nodes[e.nodes.length-1].index+1,t.nextEdgeIndex=e.edges.length===0?0:e.edges[e.edges.length-1].index+1,t.acyclic=v(),t};function gs(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Pf(e){return t=>gs(t)?.[e]}var fn=\"~structural\",Pc=\"~identifier\",Td=\"~sentinels\",Lg=\"~constructor\",bN=[\"title\",\"description\",\"default\",\"examples\",\"readOnly\",\"writeOnly\",\"format\",\"contentEncoding\",\"contentMediaType\",\"contentSchema\"],Mc=Pf(\"identifier\"),ZT=Pf(Pc),$g=Pf(\"title\"),SN=Pf(\"description\"),wd=wn(e=>{let t=gs(e)?.identifier;return typeof t==\"string\"?t:e.getExpected(wd)}),EN=new Set([Td,fn,\"representation\",\"arbitraryConstraint\",\"toJsonSchema\",\"toCode\",\"toEquivalence\",\"toFormatter\",\"toCodec\",\"toCodecJson\",\"toCodecStringTree\",\"toCodecIso\",\"toCodecArbitrary\"]);var gn={};$e(gn,{Any:()=>HN,Arrays:()=>Dn,BigInt:()=>YN,Boolean:()=>ZN,Context:()=>Po,Declaration:()=>zc,Enum:()=>bC,FINITE_PATTERN:()=>qd,Filter:()=>jd,FilterGroup:()=>ri,IndexSignature:()=>fy,Json:()=>$c,Link:()=>lt,Literal:()=>mn,MutableJson:()=>WC,Never:()=>qN,Null:()=>$N,Number:()=>VN,ObjectKeyword:()=>JN,Objects:()=>$f,PropertySignature:()=>uy,STRING_PATTERN:()=>jC,String:()=>KN,Suspend:()=>py,Symbol:()=>QN,TemplateLiteral:()=>iy,Undefined:()=>BN,Union:()=>Yr,UniqueSymbol:()=>EC,Unknown:()=>WN,Void:()=>jN,annotate:()=>so,annotateKey:()=>qf,any:()=>gC,appendChecks:()=>Fo,applyToLastLink:()=>hy,applyToSelfOrLastLinkEncoding:()=>PC,applyToSelfOrLastLinkEncodingIdempotent:()=>si,bigInt:()=>wC,bigIntString:()=>Ey,boolean:()=>IC,collectIssues:()=>ao,collectSentinels:()=>Lc,containsUndefined:()=>BC,decodeTo:()=>aa,defaultParseOptions:()=>Mo,finite:()=>my,flip:()=>hn,getAST:()=>Bf,getCandidateIndex:()=>zf,getConstructorDescriptor:()=>HC,getContextOwner:()=>jc,getIndexSignatureKeys:()=>sa,getLastEncoding:()=>qc,isAST:()=>f5,isAny:()=>h5,isArrays:()=>ny,isBigInt:()=>b5,isBoolean:()=>y5,isDeclaration:()=>Bc,isEnum:()=>I5,isFinite:()=>dy,isJson:()=>Wc,isLiteral:()=>Dc,isMutable:()=>$C,isNever:()=>DN,isNull:()=>l5,isNumber:()=>g5,isObjectKeyword:()=>E5,isObjects:()=>LN,isOptional:()=>sr,isPattern:()=>jf,isString:()=>x5,isStringBigInt:()=>Sy,isStringFinite:()=>by,isStringSymbol:()=>Iy,isStringTree:()=>m1,isSuspend:()=>hC,isSymbol:()=>S5,isTemplateLiteral:()=>T5,isUndefined:()=>p5,isUnion:()=>mC,isUniqueSymbol:()=>ey,isUnknown:()=>m5,isVoid:()=>d5,makeFilter:()=>Jd,makeFilterByGuard:()=>Gd,mapLink:()=>Hc,mapOrSame:()=>ni,middlewareDecoding:()=>MC,middlewareEncoding:()=>FC,mutable:()=>vC,mutableKey:()=>xy,never:()=>ay,null:()=>oy,number:()=>cy,objectKeyword:()=>yC,objectKeywordToJson:()=>JC,optional:()=>NC,optionalKey:()=>ai,parameterFromPropertyKey:()=>yy,parameterFromString:()=>Zd,parseArray:()=>t1,parseProperties:()=>uC,record:()=>LC,replaceChecks:()=>_C,replaceContext:()=>oi,replaceContextLastLink:()=>Vd,replaceEncoding:()=>Ge,resolve:()=>H5,resolveAt:()=>W5,resolveDescription:()=>K5,resolveIdentifier:()=>J5,resolveTitle:()=>G5,runChecks:()=>qC,stepArray:()=>XN,stepProperty:()=>ry,string:()=>dn,struct:()=>Hd,structWithRest:()=>kC,symbol:()=>TC,symbolString:()=>l1,templateLiteralParser:()=>SC,toEncoded:()=>xn,toType:()=>At,tuple:()=>ly,tupleWithRest:()=>AC,undefined:()=>sy,union:()=>Wd,unknown:()=>oo,unknownToJson:()=>Ty,unknownToStringTree:()=>wy,void:()=>xC,withConstructorDefault:()=>DC});var no={};$e(no,{AnyOf:()=>Nf,Composite:()=>Rt,Encoding:()=>ew,Filter:()=>XT,Forbidden:()=>Uf,InvalidType:()=>gt,InvalidValue:()=>se,MissingKey:()=>ys,OneOf:()=>tw,Pointer:()=>xt,UnexpectedKey:()=>jg,defaultCheckHook:()=>ow,defaultFormatter:()=>cw,defaultLeafHook:()=>nw,hasInput:()=>IN,isIssue:()=>zg,makeCompositeAtKey:()=>Qr,makeFormatterDefault:()=>TN,makeFormatterStandardSchemaV1:()=>sw,makeSingle:()=>qg,normalizeFilterOutput:()=>rw});var he=Symbol();var pr=Fr,ln=pr(he),Je=pr(he),Cd=e=>e===he?v():O(e),QT=e=>e._tag===\"None\"?ln:pr(e.value);var vd=\"~effect/SchemaIssue/Issue\";function zg(e){return w(e,vd)&&e[vd]===vd}function IN(e){return Object.hasOwn(e,\"input\")}var Nn=class{[vd]=vd;constructor(t,r){r?.reportInput===!0&&t!==he&&(this.input=t)}},XT=class extends Nn{_tag=\"Filter\";filter;issue;constructor(e,t,r,n){super(r,n),this.filter=e,this.issue=t}},ew=class extends Nn{_tag=\"Encoding\";ast;issue;constructor(e,t,r,n){super(r,n),this.ast=e,this.issue=t}},xt=class extends Nn{_tag=\"Pointer\";path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},ys=class extends Nn{_tag=\"MissingKey\";annotations;constructor(e){super(),this.annotations=e}},jg=class extends Nn{_tag=\"UnexpectedKey\";ast;constructor(e,t,r){super(t,r),this.ast=e}},Rt=class extends Nn{_tag=\"Composite\";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},gt=class extends Nn{_tag=\"InvalidType\";ast;constructor(e,t,r){super(t,r),this.ast=e}},se=class extends Nn{_tag=\"InvalidValue\";annotations;constructor(e,t,r){super(t,r),this.annotations=e}};function Qr(e,t,r,n,o){return new Rt(e,[new xt([t],r)],n,o)}var Uf=class extends Nn{_tag=\"Forbidden\";annotations;constructor(e,t,r){super(t,r),this.annotations=e}},Nf=class extends Nn{_tag=\"AnyOf\";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},tw=class extends Nn{_tag=\"OneOf\";ast;successes;constructor(e,t,r,n){super(r,n),this.ast=e,this.successes=t}};function YT(e,t,r){if(zg(e))return e;if(typeof e==\"string\")return new se({message:e},t,r);let n=typeof e.issue==\"string\"?new se({message:e.issue},t,r):e.issue;return new xt(e.path,n)}function qg(e,t,r){if(e!==void 0)return typeof e==\"boolean\"?e?void 0:new se(void 0,t,r):YT(e,t,r)}function rw(e,t,r,n){return Array.isArray(t)?ct(t)?t.length===1?YT(t[0],r,n):new Rt(e,tn(t,o=>YT(o,r,n)),r,n):void 0:qg(t,r,n)}var nw=e=>{let t=Ff(e);if(t!==void 0)return t;switch(e._tag){case\"InvalidType\":return Xa(wd(e.ast),e);case\"InvalidValue\":{let r=aw(e);if(r!==void 0)return Xa(r,e);let n=Bg(e);return n===void 0?\"Expected a valid value\":`Invalid data ${n}`}case\"MissingKey\":return\"Missing key\";case\"UnexpectedKey\":{let r=Bg(e);return r===void 0?\"Expected no excess property\":`Unexpected key with value ${r}`}case\"Forbidden\":return\"Forbidden operation\";case\"OneOf\":{let r=Bg(e);return r===void 0?\"Expected exactly one member to match\":`Expected exactly one member to match the input ${r}`}}},ow=e=>Ff(e.issue)??Ff(e);function sw(e){return t=>({issues:Mf(t,[],e?.leafHook??nw,e?.checkHook??ow)})}function Bg(e){return IN(e)?L(e.input):void 0}function aw(e){let t=e.annotations?.expected;return typeof t==\"string\"?t:void 0}function Xa(e,t){let r=Bg(t);return r===void 0?`Expected ${e}`:`Expected ${e}, got ${r}`}function Mf(e,t,r,n){switch(e._tag){case\"Filter\":{let o=n(e);if(o!==void 0)return[{path:t,message:o}];if(e.issue._tag!==\"InvalidValue\")return Mf(e.issue,t,r,n);let s=aw(e.issue);return[{path:t,message:s===void 0?Xa(iw(e.filter),e):Xa(s,e.issue)}]}case\"Encoding\":return Mf(e.issue,t,r,n);case\"Pointer\":return Mf(e.issue,[...t,...e.path],r,n);case\"Composite\":return e.issues.flatMap(o=>Mf(o,t,r,n));case\"AnyOf\":return e.issues.length===0?[{path:t,message:Ff(e)??Xa(wd(e.ast),e)}]:e.issues.flatMap(o=>Mf(o,t,r,n));default:return[{path:t,message:r(e)}]}}function iw(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(r=>iw(r)).join(\" & \")}}function TN(){return e=>Ad(e,\"\")}var cw=TN();function Ad(e,t){let r;switch(e._tag){case\"Filter\":{let n=ow(e);if(n!==void 0)r=n;else{if(e.issue._tag!==\"InvalidValue\")return Ad(e.issue,t);let o=aw(e.issue);r=o===void 0?Xa(iw(e.filter),e):Xa(o,e.issue)}break}case\"Encoding\":return Ad(e.issue,t);case\"Pointer\":return Ad(e.issue,t+ch(e.path));case\"Composite\":case\"AnyOf\":{if(e._tag===\"Composite\"||e.issues.length>0)return e.issues.map(n=>Ad(n,t)).join(`\n`);r=Ff(e)??Xa(wd(e.ast),e);break}default:r=nw(e);break}return t?`${r}\n  at ${t}`:r}function Ff(e){if(e._tag===\"Pointer\")return;if(e._tag===\"Encoding\")return Ff(e.issue);let r=(e._tag===\"Filter\"?e.filter.annotations:\"annotations\"in e?e.annotations:e.ast.annotations)?.[e._tag===\"MissingKey\"?\"messageMissingKey\":e._tag===\"UnexpectedKey\"?\"messageUnexpectedKey\":\"message\"];if(typeof r==\"string\")return r}function Od(e){let t;for(let r of e.reasons){if(!jp(r)||!zg(r.error))return;t??=r.error}return t}function pn(e,t){let r=Od(e);if(r===void 0)throw new Error(t,{cause:e});return r}var Fc={};$e(Fc,{BigInt:()=>dw,Boolean:()=>$Z,Date:()=>Gg,Number:()=>Md,String:()=>ti,camelToSnake:()=>yw,capitalize:()=>hw,checkEffect:()=>LZ,collectBracketPathEntries:()=>$w,compose:()=>ei,dateTimeUtcFromInput:()=>BZ,decodeBase64:()=>kw,decodeBase64String:()=>Aw,decodeBase64Url:()=>vw,decodeBase64UrlString:()=>Ow,decodeFormData:()=>Fw,decodeHex:()=>_w,decodeHexString:()=>Rw,decodeURLSearchParams:()=>Nw,decodeUriComponent:()=>Mw,encodeBase64:()=>Kg,encodeBase64Url:()=>Fd,encodeFormData:()=>Uw,encodeHex:()=>Ud,encodeURLSearchParams:()=>Dw,encodeUriComponent:()=>Pw,fail:()=>AN,forbidden:()=>Rd,forbiddenEncoding:()=>lw,joinKeyValue:()=>ww,makeTreeRecord:()=>Lw,map:()=>MZ,omit:()=>Wg,parseJson:()=>Ew,passthrough:()=>or,passthroughSubtype:()=>NZ,passthroughSupertype:()=>UZ,required:()=>DZ,run:()=>PZ,snakeToCamel:()=>gw,split:()=>Cw,splitKeyValue:()=>Tw,stringifyJson:()=>Iw,succeed:()=>FZ,toLowerCase:()=>bw,toUpperCase:()=>Sw,transform:()=>Y,transformEffect:()=>ft,transformOptional:()=>oa,transformOptionalEffect:()=>Pd,trim:()=>mw,uncapitalize:()=>xw,withDefault:()=>Jg});var CN=e=>kc(e).replace(/=/g,\"\").replace(/\\+/g,\"-\").replace(/\\//g,\"_\"),uw=e=>{let t=e.replace(/[\\n\\r]/g,\"\"),r=t.length;if(r%4===1)return D(new Jn({module:\"Base64Url\",kind:\"Decode\",input:t,message:`Length should be a multiple of 4, but is ${r}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return D(new Jn({module:\"Base64Url\",kind:\"Decode\",input:t,message:\"Invalid input\"}));let n=r%4===2?`${t}==`:r%4===3?`${t}=`:t;return n=n.replace(/-/g,\"+\").replace(/_/g,\"/\"),Ga(n)},kN=e=>mt(uw(e),t=>_Z.decode(t)),_Z=new TextDecoder;var fw=(e,t,r)=>{switch(e._tag){case\"Passthrough\":return b(t);case\"Transform\":return b(Wt(t,e.transform));case\"TransformOptional\":return b(e.transform(t));case\"TransformEffect\":return fe(t)?ja:Un(e.transform(t.value,r),O);case\"TransformOptionalEffect\":return e.transform(t,r)}},PZ=l(3,fw),_d=e=>Object.assign(Object.create(mS),e),Hg=(e,t)=>Pd((r,n)=>ut(fw(e,r,n),o=>fw(t,o,n))),ei=l(2,(e,t)=>{if(e._tag===\"Passthrough\")return t;if(t._tag===\"Passthrough\")return e;switch(e._tag){case\"Transform\":switch(t._tag){case\"Transform\":return Y(r=>t.transform(e.transform(r)));case\"TransformOptional\":return oa(r=>t.transform(Wt(r,e.transform)));case\"TransformEffect\":return ft((r,n)=>t.transform(e.transform(r),n));case\"TransformOptionalEffect\":return Hg(e,t)}case\"TransformOptional\":switch(t._tag){case\"Transform\":return oa(r=>Wt(e.transform(r),t.transform));case\"TransformOptional\":return oa(r=>t.transform(e.transform(r)));case\"TransformEffect\":case\"TransformOptionalEffect\":return Hg(e,t)}case\"TransformEffect\":switch(t._tag){case\"Transform\":return ft((r,n)=>Un(e.transform(r,n),t.transform));case\"TransformOptional\":case\"TransformOptionalEffect\":return Hg(e,t);case\"TransformEffect\":return ft((r,n)=>ut(e.transform(r,n),o=>t.transform(o,n)))}case\"TransformOptionalEffect\":return Hg(e,t)}}),MZ=l(2,(e,t)=>ei(e,Y(t)));function FZ(e){return oa(()=>O(e))}function AN(e){return Pd((t,r)=>M(e(t,r)))}function Rd(e){return AN((t,r)=>{let n={message:e(t)};return Oe(t)?new Uf(n,t.value,r):new Uf(n)})}var lw=Rd(()=>\"Encoding is not supported\"),pw=_d({_tag:\"Passthrough\"});function or(){return pw}function UZ(){return pw}function NZ(){return pw}function DZ(e){return Pd(t=>fe(t)?M(new ys(e)):b(t))}function LZ(e){return ft((t,r)=>e(t,r).pipe(ut(n=>{let o=qg(n,t,r);return o?M(o):b(t)})))}function Y(e){return _d({_tag:\"Transform\",transform:e})}function ft(e){return _d({_tag:\"TransformEffect\",transform:e})}function oa(e){return _d({_tag:\"TransformOptional\",transform:e})}function Pd(e){return _d({_tag:\"TransformOptionalEffect\",transform:e})}function Wg(){return oa(()=>v())}function Jg(e){return Pd(t=>{let r=Li(t,Or);return Oe(r)?b(r):Un(e,O)})}function ti(){return Y(globalThis.String)}function Md(){return Y(globalThis.Number)}function $Z(){return Y(globalThis.Boolean)}function dw(){return Y(globalThis.BigInt)}function Gg(){return Y(e=>new globalThis.Date(e))}function mw(){return Y(AF)}function hw(){return Y(CF)}function xw(){return Y(kF)}function gw(){return Y(OF)}function yw(){return Y(_F)}function bw(){return Y(Vp)}function Sw(){return Y(m0)}function Ew(e){return ft((t,r)=>Tf({try:()=>JSON.parse(t,e?.reviver),catch:()=>new se({expected:\"a valid JSON string\"},t,r)}))}function Iw(e){return ft((t,r)=>Tf({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw new TypeError(\"Value cannot be represented as JSON\");return n},catch:()=>new se({expected:\"a JSON-serializable value\"},t,r)}))}function Tw(e){let t=e?.separator??\",\",r=e?.keyValueSeparator??\"=\";return Y(n=>n.split(t).reduce((o,s)=>{let[a,i]=s.split(r);return a&&i&&N(o,a,i),o},{}))}function ww(e){let t=e?.separator??\",\",r=e?.keyValueSeparator??\"=\";return Y(n=>Object.entries(n).map(([o,s])=>`${o}${r}${s}`).join(t))}function Cw(e){let t=e?.separator??\",\";return Y(r=>r===\"\"?[]:r.split(t))}function Kg(){return Y(kc)}function Fd(){return Y(CN)}function Ud(){return Y(C_)}function kw(){return ft((e,t)=>fd(sd(Ga(e)),()=>new se({expected:\"a valid Base64 string\"},e,t)))}function Aw(){return ft((e,t)=>tr(ST(e),{onFailure:()=>M(new se({expected:\"a valid Base64 string\"},e,t)),onSuccess:b}))}function vw(){return ft((e,t)=>tr(uw(e),{onFailure:()=>M(new se({expected:\"a valid Base64Url string\"},e,t)),onSuccess:b}))}function Ow(){return ft((e,t)=>tr(kN(e),{onFailure:()=>M(new se({expected:\"a valid Base64Url string\"},e,t)),onSuccess:b}))}function _w(){return ft((e,t)=>tr(xE(e),{onFailure:()=>M(new se({expected:\"a valid hexadecimal string\"},e,t)),onSuccess:b}))}function Rw(){return ft((e,t)=>tr(k_(e),{onFailure:()=>M(new se({expected:\"a valid hexadecimal string\"},e,t)),onSuccess:b}))}function Pw(){return Y(encodeURIComponent)}function Mw(){return ft((e,t)=>{try{return b(globalThis.decodeURIComponent(e))}catch{return M(new se({expected:\"a valid URI component\"},e,t))}})}function BZ(){return ft((e,t)=>at(Tc(e),{onNone:()=>M(new se({message:\"Invalid DateTime input\"},e,t)),onSome:r=>b(wc(r))}))}function Fw(){return Y(e=>Lw(Array.from(e.entries())))}var zZ=$w(e=>typeof e==\"string\"||typeof Blob<\"u\"&&e instanceof Blob);function Uw(){return Y(e=>{let t=new FormData;return typeof e==\"object\"&&e!==null&&zZ(e).forEach(([n,o])=>{t.append(n,o)}),t})}function Nw(){return Y(e=>Lw(Array.from(e.entries())))}var jZ=$w(ir);function Dw(){return Y(e=>typeof e==\"object\"&&e!==null?new URLSearchParams(jZ(e)):new URLSearchParams)}function qZ(e){if(e===\"\")return[\"\"];let t=e.replace(/\\[(.*?)\\]/g,\".$1\"),r=t.split(\".\"),n=t.startsWith(\".\")?1:0;return r.slice(n).map(o=>Lu(o)?globalThis.Number(o):o)}function Lw(e){let t={},r=new WeakSet,n=new WeakSet;function o(s,a,i){let c=Object.hasOwn(s,a)?s[a]:void 0;if(r.has(c)&&Array.isArray(c)===i)return c;let u=i?[]:{};return r.add(u),N(s,a,u),u}return e.forEach(([s,a])=>{let i=qZ(s),c=t;i.forEach((u,f)=>{let p=f===i.length-1;if(Array.isArray(c)&&u===\"\")if(p)c.push(a);else{let d=i[f+1],m=typeof d==\"number\"||d===\"\",x=c.length;c=o(c,x,m)}else if(p){let d=Object.hasOwn(c,u);if(d&&Array.isArray(c[u])&&(r.has(c[u])||n.has(c[u])))c[u].push(a);else if(d){let m=[c[u],a];n.add(m),N(c,u,m)}else N(c,u,a)}else{let d=i[f+1];c=o(c,u,typeof d==\"number\"||d===\"\")}})}),t}function $w(e){return t=>{let r=[];function n(o,s){if(e(s))r.push([o,s]);else if(Array.isArray(s))s.every(e)?s.forEach(i=>{r.push([o,i])}):s.forEach((i,c)=>{n(`${o}[${c}]`,i)});else if(typeof s==\"object\"&&s!==null)for(let[a,i]of Object.entries(s))n(`${o}[${a}]`,i)}for(let[o,s]of Object.entries(t))n(o,s);return r}}var Df={};$e(Df,{Middleware:()=>Dd,Transformation:()=>ye,bigDecimalFromString:()=>o5,bigintFromString:()=>Bd,byteSizeFromBigInt:()=>Hw,byteSizeFromNumber:()=>Ww,byteSizeFromString:()=>Zg,capitalize:()=>KZ,composeTransformation:()=>HZ,dateFromMillis:()=>qw,dateFromString:()=>Vg,dateTimeUtcFromString:()=>c5,dateTimeZonedFromString:()=>u5,defectFromJson:()=>Gw,durationFromMillis:()=>e5,durationFromNanos:()=>XZ,durationFromString:()=>YZ,errorFromJsonError:()=>Jw,fromFormData:()=>oC,fromJsonString:()=>nC,fromURLSearchParams:()=>sC,isTransformation:()=>vN,makeTransformation:()=>Ld,numberFromString:()=>Nc,optionFromNullOr:()=>Kw,optionFromNullishOr:()=>Zw,optionFromOptional:()=>Yw,optionFromOptionalKey:()=>Qw,optionFromUndefinedOr:()=>Vw,passthrough:()=>Uc,passthroughSubtype:()=>QZ,passthroughSupertype:()=>ZZ,snakeToCamel:()=>WZ,splitKeyValue:()=>zw,stringFromBase64String:()=>Xw,stringFromBase64UrlString:()=>eC,stringFromHexString:()=>tC,stringFromUriComponent:()=>rC,timeZoneFromString:()=>i5,timeZoneNamedFromString:()=>a5,timeZoneOffsetFromNumber:()=>s5,toLowerCase:()=>JZ,toUpperCase:()=>GZ,transform:()=>ve,transformEffect:()=>nt,transformOptional:()=>$d,trim:()=>Bw,uint8ArrayFromBase64String:()=>Yg,uncapitalize:()=>VZ,urlFromString:()=>Qg});var Dd=class extends ba{_tag=\"Middleware\";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Dd(this.encode,this.decode)}},Nd=\"~effect/SchemaTransformation/Transformation\",ye=class extends ba{[Nd]=Nd;_tag=\"Transformation\";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new ye(this.encode,this.decode)}},HZ=l(2,(e,t)=>new ye(ei(e.decode,t.decode),ei(t.encode,e.encode)));function vN(e){return w(e,Nd)&&e[Nd]===Nd}var Ld=e=>vN(e)?e:new ye(e.decode,e.encode);function nt(e){return new ye(ft(e.decode),ft(e.encode))}function ve(e){return new ye(Y(e.decode),Y(e.encode))}function $d(e){return new ye(oa(e.decode),oa(e.encode))}function Bw(){return new ye(mw(),or())}function WZ(){return new ye(gw(),yw())}function JZ(){return new ye(bw(),or())}function GZ(){return new ye(Sw(),or())}function KZ(){return new ye(hw(),or())}function VZ(){return new ye(xw(),or())}function zw(e){return new ye(Tw(e),ww(e))}var jw=new ye(or(),or());function Uc(){return jw}function ZZ(){return jw}function QZ(){return jw}var Nc=new ye(Md(),ti()),Bd=new ye(dw(),ti()),Vg=new ye(Gg(),Y(OS)),qw=new ye(Gg(),Y(e=>e.getTime())),YZ=nt({decode:(e,t)=>at(sp(e),{onNone:()=>M(new se({expected:\"a valid Duration string\"},e,t)),onSome:b}),encode:e=>b(String(e))}),XZ=nt({decode:e=>b(An(e)),encode:(e,t)=>at(ap(e),{onNone:()=>M(new se({expected:\"a Duration representable as a bigint\"},e,t)),onSome:r=>b(r)})}),e5=ve({decode:e=>Jt(e),encode:e=>Ye(e)}),Zg=nt({decode:(e,t)=>at(CU(e),{onNone:()=>M(new se({expected:\"a valid ByteSize string\"},e,t)),onSome:b}),encode:e=>b(`${e} ${e===BigInt(1)?\"byte\":\"bytes\"}`)}),Hw=nt({decode:(e,t)=>at(pT(e),{onNone:()=>M(new se({expected:\"a non-negative bigint byte count\"},e,t)),onSome:b}),encode:e=>b(gg(e))}),Ww=nt({decode:(e,t)=>at(pT(e),{onNone:()=>M(new se({expected:\"a non-negative safe-integer byte count\"},e,t)),onSome:b}),encode:(e,t)=>at(vU(e),{onNone:()=>M(new se({expected:\"a ByteSize representable as a safe integer\"},e,t)),onSome:b})}),t5=e=>hr(e)&&typeof e.message==\"string\",ON=e=>{let r=Object.hasOwn(e,\"cause\")?new Error(e.message,{cause:RN(e.cause)}):new Error(e.message);return typeof e.name==\"string\"&&e.name!==\"Error\"&&(r.name=e.name),typeof e.stack==\"string\"&&(r.stack=e.stack),r},r5=e=>{try{let t=_s(e);return t===void 0?L(e):JSON.parse(t)}catch{return L(e)}},n5=(e,t,r)=>{let n={name:e.name,message:typeof e.message==\"string\"?e.message:\"\"};return t?.includeStack&&typeof e.stack==\"string\"&&(n.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(n.cause=r(e.cause)),n},_N=e=>{let t=new WeakSet,r=n=>{if(gS(n)){if(t.has(n))return\"[Circular]\";t.add(n);let o=n5(n,e,r);return t.delete(n),o}return r5(n)};return r},RN=e=>t5(e)?ON(e):e,Jw=e=>ve({decode:ON,encode:t=>_N(e)(t)}),Gw=e=>ve({decode:RN,encode:_N(e)});function Kw(){return ve({decode:DS,encode:Eh})}function Vw(){return ve({decode:Ns,encode:lo})}function Zw(e){return ve({decode:Xl,encode:e?.onNoneEncoding===null?Eh:lo})}function Qw(){return $d({decode:O,encode:Di})}function Yw(){return $d({decode:e=>e.pipe(Li(Or),O),encode:Di})}var Qg=nt({decode:(e,t)=>URL.canParse(e)?b(new URL(e)):M(new se({expected:\"a valid URL string\"},e,t)),encode:e=>b(e.href)}),o5=nt({decode:(e,t)=>{let r=hg(e);return fe(r)?M(new se({expected:\"a valid BigDecimal string\"},e,t)):b(r.value)},encode:e=>b(Oo(e))}),Yg=new ye(kw(),Kg()),Xw=new ye(Aw(),Kg()),eC=new ye(Ow(),Fd()),tC=new ye(Rw(),Ud()),rC=new ye(Mw(),Pw());function nC(e){return new ye(Ew(e??{}),Iw(e))}var oC=new ye(Fw(),Uw()),sC=new ye(Nw(),Dw()),s5=ve({decode:e=>pd(e),encode:e=>e.offset}),a5=nt({decode:(e,t)=>at(Eg(e),{onNone:()=>M(new se({expected:\"a valid IANA time zone\"},e,t)),onSome:b}),encode:e=>b(e.id)}),i5=nt({decode:(e,t)=>at(Ig(e),{onNone:()=>M(new se({expected:\"a valid time zone\"},e,t)),onSome:b}),encode:e=>b(Cc(e))}),c5=nt({decode:(e,t)=>at(Tc(e),{onNone:()=>M(new se({expected:\"a valid UTC DateTime string\"},e,t)),onSome:r=>b(wc(r))}),encode:e=>b(Tg(e))}),u5=nt({decode:(e,t)=>at(Sg(e),{onNone:()=>M(new se({expected:\"a valid Zoned DateTime string\"},e,t)),onSome:b}),encode:e=>b(dd(e))});function jt(e){return t=>t._tag===e}function f5(e){return w(e,zd)&&e[zd]===zd}var Bc=jt(\"Declaration\"),l5=jt(\"Null\"),p5=jt(\"Undefined\"),d5=jt(\"Void\"),DN=jt(\"Never\"),m5=jt(\"Unknown\"),h5=jt(\"Any\"),x5=jt(\"String\"),g5=jt(\"Number\"),y5=jt(\"Boolean\"),b5=jt(\"BigInt\"),S5=jt(\"Symbol\"),Dc=jt(\"Literal\"),ey=jt(\"UniqueSymbol\"),E5=jt(\"ObjectKeyword\"),I5=jt(\"Enum\"),T5=jt(\"TemplateLiteral\"),ny=jt(\"Arrays\"),LN=jt(\"Objects\"),mC=jt(\"Union\"),hC=jt(\"Suspend\"),lt=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},Mo={},Po=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,r=void 0,n=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=r,this.annotations=n}},zd=\"~effect/Schema\",kt=class{[zd]=zd;annotations;checks;encoding;context;constructor(t=void 0,r=void 0,n=void 0,o=void 0){this.annotations=t,this.checks=r,this.encoding=n,this.context=o}toString(){return`<${this._tag}>`}},zc=class extends kt{_tag=\"Declaration\";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,r,n,o,s,a,i){super(r,n,o,s),this.typeParameters=e,this.run=t,this.encodingChecks=a,this.encodingRun=i}getParser(){let e;return(t,r)=>t===he?ln:(e??=this.run(this.typeParameters))(t,this,r)}_rebuild(e,t,r,n,o){let s=ni(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&r===this.encodingChecks&&n===this.run&&o===this.encodingRun?this:new zc(s,n,this.annotations,t,void 0,this.context,r,o)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e==\"string\"?e:\"<Declaration>\"}},$N=class extends kt{_tag=\"Null\";getParser(){return gy(this,null)}getExpected(){return\"null\"}},oy=new $N;var BN=class extends kt{_tag=\"Undefined\";getParser(){return gy(this,void 0)}toCodecJson(){return Ge(this,[zN])}getExpected(){return\"undefined\"}},zN=new lt(oy,new ye(Y(()=>{}),Y(()=>null))),sy=new BN;var jN=class extends kt{_tag=\"Void\";getParser(){let e=pr(void 0);return t=>t===he?ln:e}toCodecJson(){return Ge(this,[zN])}getExpected(){return\"void\"}},xC=new jN;var qN=class extends kt{_tag=\"Never\";getParser(){return Uo(this,xS)}getExpected(){return\"never\"}},ay=new qN,HN=class extends kt{_tag=\"Any\";getParser(){return Uo(this,oh)}getExpected(){return\"any\"}},gC=new HN,WN=class extends kt{_tag=\"Unknown\";getParser(){return Uo(this,oh)}getExpected(){return\"unknown\"}},oo=new WN,JN=class extends kt{_tag=\"ObjectKeyword\";getParser(){return Uo(this,xu)}getExpected(){return\"object | array | function\"}},yC=new JN,bC=class extends kt{_tag=\"Enum\";enums;constructor(e,t,r,n,o){super(t,r,n,o);for(let[,s]of e)if(typeof s==\"number\"&&!globalThis.Number.isFinite(s))throw new Error(`A numeric enum value must be finite, got ${L(s)}`);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return Uo(this,t=>e.has(t))}toCodecStringTree(){if(this.enums.some(([e,t])=>typeof t==\"number\")){let e=Object.fromEntries(this.enums.map(([t,r])=>[globalThis.String(r),r]));return Ge(this,[new lt(new Yr(Object.keys(e).map(t=>new mn(t))),new ye(Y(t=>e[t]),ti()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(\" | \")}};function aC(e){return typeof e==\"number\"?`parts[${e}]`:e}function iC(e,t,r){if(r.has(e))return!0;if(e.encoding)throw new Error(`TemplateLiteral parts cannot have an encoding at ${aC(t)}`);let n;switch(e._tag){case\"String\":case\"Number\":case\"BigInt\":n=!0;break;case\"Literal\":n=!e.checks;break;case\"TemplateLiteral\":{let o=aC(t);n=!e.checks&&e.parts.every((s,a)=>iC(s,`${o}.parts[${a}]`,r));break}case\"Union\":{let o=aC(t);n=!e.checks&&e.types.every((s,a)=>iC(s,`${o}.types[${a}]`,r));break}default:return!1}return n&&r.add(e),n}var iy=class extends kt{_tag=\"TemplateLiteral\";parts;encodedParts;literals;suffixLengths;constructor(e,t,r,n,o){super(t,r,n,o);let s=[],a=[],i=new Set;for(let u=0;u<e.length;u++){let f=e[u];if(!iC(f,u,i))throw new Error(`Invalid TemplateLiteral part ${f._tag}`);s.push(f),a.push(f._tag===\"Literal\"?globalThis.String(f.literal):void 0)}let c=new Array(s.length+1);c[s.length]=0;for(let u=s.length-1;u>=0;u--)c[u]=c[u+1]+(a[u]?.length??0);this.parts=e,this.encodedParts=s,this.literals=a,this.suffixLengths=c}getParser(e){let t=new Dn(!1,this.parts.map(zC),[]),r=e(aa(dn,t,GN(this)));return(n,o)=>{if(n===he)return ln;let s=r(n,o);return s._tag===\"Success\"?Je:lr(s,{onSuccess:()=>n,onFailure:a=>new Rt(this,[a],n,o)})}}getExpected(){return\"string\"}matchPart(e,t){return u1(this,e,t)===void 0?void 0:e}};function SC(e){let t=wn(o=>{if(o._tag!==\"Union\")return o;let s=ni(o.types,t);return(o.options?.mode??\"anyOf\")===\"anyOf\"&&s===o.types?o:new Yr(s,o.options===void 0?void 0:{...o.options,mode:\"anyOf\"},o.annotations,o.checks,void 0,o.context)}),r=new iy(e.map(o=>t(xn(o)))),n=new Dn(!1,e.map(zC),[]);return aa(r,n,GN(r))}function GN(e){return new ye(ft((t,r)=>{let n=u1(e,t,r);return n?b(n):M(new se({expected:\"a string matching template literal parts\"},t,r))}),Y(t=>t.join(\"\")))}var EC=class extends kt{_tag=\"UniqueSymbol\";symbol;constructor(e,t,r,n,o){super(t,r,n,o),this.symbol=e}getParser(){return gy(this,this.symbol)}toCodecStringTree(){let e=globalThis.Symbol.keyFor(this.symbol);return Ge(this,[new lt(e===void 0?ay:new mn(globalThis.String(this.symbol)),p1.transformation)])}getExpected(){return globalThis.String(this.symbol)}},mn=class extends kt{_tag=\"Literal\";literal;constructor(e,t,r,n,o){if(super(t,r,n,o),typeof e==\"number\"&&!globalThis.Number.isFinite(e))throw new Error(`A numeric literal must be finite, got ${L(e)}`);this.literal=e}getParser(){return gy(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==\"bigint\"?PN(this):this}toCodecStringTree(){return typeof this.literal==\"string\"?this:PN(this)}getExpected(){return typeof this.literal==\"string\"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function PN(e){let t=globalThis.String(e.literal);return Ge(e,[new lt(new mn(t),new ye(Y(()=>e.literal),Y(()=>t)))])}var KN=class extends kt{_tag=\"String\";getParser(){return Uo(this,ir)}matchPart(e,t){let r=this.checks;return r&&!t.disableChecks&&ao(r,e,void 0,this,t)?void 0:e}getExpected(){return\"string\"}},dn=new KN,VN=class extends kt{_tag=\"Number\";getParser(){return Uo(this,Sa)}matchKey(e,t){return this._match(L5,e,t)}matchPart(e,t){return this._match(lC,e,t)}_match(e,t,r){if(!e.test(t))return;let n=globalThis.Number(t);return r.disableChecks||!this.checks?n:ao(this.checks,n,void 0,this,r)?void 0:n}toCodecJson(){return this.checks&&(cC(this.checks,\"effect/schema/isFinite\")||cC(this.checks,\"effect/schema/isInt\"))?this:Ge(this,[R5])}toCodecStringTree(){return this.toCodecJson()===this?Ge(this,[$5]):Ge(this,[B5])}getExpected(){return\"number\"}};function cC(e,t){return e.some(r=>r.annotations?.representation?.id===t||r._tag===\"FilterGroup\"&&cC(r.checks,t))}var cy=new VN,ZN=class extends kt{_tag=\"Boolean\";getParser(){return Uo(this,Si)}getExpected(){return\"boolean\"}},IC=new ZN,QN=class extends kt{_tag=\"Symbol\";getParser(){return Uo(this,hu)}matchKey(e,t){return t.disableChecks||!this.checks?e:ao(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return Ge(this,[p1])}getExpected(){return\"symbol\"}},TC=new QN,YN=class extends kt{_tag=\"BigInt\";getParser(){return Uo(this,Ul)}matchPart(e,t){if(!pC.test(e))return;let r=globalThis.BigInt(e);return t.disableChecks||!this.checks?r:ao(this.checks,r,void 0,this,t)?void 0:r}toCodecStringTree(){return Ge(this,[j5])}getExpected(){return\"bigint\"}},wC=new YN,Dn=class extends kt{_tag=\"Arrays\";isMutable;elements;rest;encodingChecks;constructor(e,t,r,n,o,s,a,i){super(n,o,s,a),this.isMutable=e,this.elements=t,this.rest=r,this.encodingChecks=i;let c=!1;for(let u=0;u<t.length;u++)if(sr(t[u]))c=!0;else if(c)throw new Error(\"A required element cannot follow an optional element. ts(1257)\");if(c&&r.length>1)throw new Error(\"A required element cannot follow an optional element. ts(1257)\");for(let u=1;u<r.length;u++)if(sr(r[u]))throw new Error(\"An optional element cannot follow a rest element. ts(1266)\")}getParser(e,t=e){let r=this,n,o,s=r.elements.length,a=Math.max(0,r.rest.length-1);function i(f,p){return p<s?n[p]:p>=f?o[p-f+1]:o[0]}let c=f=>{let{input:p,len:d,options:m}=f;if(r.rest.length===0&&d>s)for(let x=s;x<d;x++){let g=new jg(r,p[x],m),y=new xt([x],g);if(m.errors===\"all\")f.issues?f.issues.push(y):f.issues=[y];else return M(new Rt(r,[y],p,m))}return f.issues?M(new Rt(r,f.issues,p,m)):pr(f.output)},u=(f,p)=>{let d=f.length,m={ast:r,getParser:i,input:f,len:d,tailThreshold:Math.max(s,d-a),output:new globalThis.Array(d),issues:void 0,options:p},x=r.rest.length===0?s:Math.max(d,s+a),g=p.concurrency===void 0?1:Mp(p.concurrency),y=g===1?t1(m,f,0,x):w5(m,f,{concurrency:g,end:x});if(!y)return c(m);if(Be(y))return ut(y,()=>c(m));let S=!0;return $(()=>S?(S=!1,T(y,()=>c(m))):u(f,p))};return(f,p)=>{if(f===he)return ln;try{return Array.isArray(f)?(n||(n=r.elements.map(d=>({ast:d,parser:t(d)})),o=r.rest.map(d=>({ast:d,parser:t(d)}))),u(f,p)):M(new gt(r,f,p))}catch(d){return Tr(d)}}}_rebuild(e,t,r){let n=ni(this.elements,e),o=ni(this.rest,e);return n===this.elements&&o===this.rest&&t===this.checks&&r===this.encodingChecks?this:new Dn(this.isMutable,n,o,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return\"array\"}};function XN(e,t,r,n){if(r._tag===\"Failure\")return ty(e,e.ast,n,r);let o=r===Je?t:r[de];if(o!==he)e.output[n]=o;else{let s=e.getParser(e.tailThreshold,n);if(sr(s.ast))return;let a=new xt([n],new ys(s.ast.context?.annotations));if(e.options.errors===\"all\")e.issues?e.issues.push(a):e.issues=[a];else return Gs(new Rt(e.ast,[a],e.input,e.options))}}var e1={onItem(e,t,r){let n=r<e.len?t:he;return e.getParser(e.tailThreshold,r).parser(n,e.options)},step:XN},t1=Ix()(e1),w5=Tx()(e1),ty=(e,t,r,n)=>{if(n.cause.reasons.length===0)return n;let o=Od(n.cause);if(o===void 0)return sn(Vs(n.cause,a=>new Rt(t,[new xt([r],a)],e.input,e.options)));let s=new xt([r],o);if(e.options.errors===\"all\")e.issues?e.issues.push(s):e.issues=[s];else return Gs(new Rt(t,[s],e.input,e.options))},qd=\"[+-]?\\\\d*\\\\.?\\\\d+(?:[Ee][+-]?\\\\d+)?\";function sa(e,t,r=Mo){let n,o;function s(a){switch(a._tag){case\"String\":case\"TemplateLiteral\":return(n??=Object.keys(e)).filter(i=>a.matchPart(i,r)!==void 0);case\"Number\":return(n??=Object.keys(e)).filter(i=>a.matchKey(i,r)!==void 0);case\"Symbol\":return(o??=Object.getOwnPropertySymbols(e)).filter(i=>Object.prototype.propertyIsEnumerable.call(e,i)&&a.matchKey(i,r)!==void 0);case\"Union\":return[...new Set(a.types.flatMap(s))];default:return[]}}return s(yy(xn(t)))}var uy=class{name;type;constructor(e,t){this.name=e,this.type=t}};function r1(e){switch(e._tag){case\"String\":case\"Number\":case\"Symbol\":case\"TemplateLiteral\":return!0;case\"Union\":return e.types.every(r1);default:return!1}}function n1(e){let t=qc(e);switch(t._tag){case\"String\":case\"Number\":case\"Symbol\":case\"TemplateLiteral\":return!0;case\"Union\":return t.types.every(n1);default:return!1}}function C5(e){return r1(e)&&n1(e)}var fy=class{parameter;type;constructor(e,t){if(!C5(e))throw new Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,sr(t)&&!BC(t))throw new Error(\"Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.\")}},$f=class extends kt{_tag=\"Objects\";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,r,n,o,s,a){super(r,n,o,s),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=a}getParser(e,t=e){let r=this,n=r.propertySignatures.length,o=r.indexSignatures.length;if(!n&&!o)return Uo(r,Ll);let s,a,i=()=>(s||(s=r.propertySignatures.map(p=>({parser:t(p.type),name:p.name,type:p.type})),a=o?r.indexSignatures.map(p=>({is:p,parserKey:e(yy(p.parameter)),parserValue:t(p.type)})):void 0),s),c=()=>{let p=new Set(r.propertySignatures.map(y=>typeof y.name==\"number\"?globalThis.String(y.name):y.name)),d=(y,S,E,U,F)=>{if(F._tag===\"Failure\")return ty(y,r,S,F)??ht;let h=F===Je?U:F[de];if(E!==he&&h!==he){if(n&&(p.has(S)||p.has(typeof E==\"number\"?globalThis.String(E):E)))return ht;N(y.out,E,h)}return ht},m=(y,S,E,U)=>{if(!U){let C=E.parserKey(S,y.options);if(!Be(C))return T(to(C),k=>m(y,S,E,k));U=C}if(U._tag===\"Failure\")return ty(y,r,S,U)??ht;let F=U===Je?S:U[de],h=y.input[S],I=E.parserValue(h,y.options);return Be(I)?d(y,S,F,h,I):T(to(I),C=>d(y,S,F,h,C))},x=(y,S,E)=>{let U=y.input[S],F=E.parserValue(U,y.options);return Be(F)?d(y,S,S,U,F):T(to(F),h=>d(y,S,S,U,h))},g=o?Tx()({onItem:(y,[S,E])=>E.is.parameter===dn?x(y,S,E):m(y,S,E),step:(y,S,E)=>E._tag===\"Failure\"?E:void 0}):void 0;return aT(function*(y,S){if(y===he)return he;if(!(typeof y==\"object\"&&y!==null&&!Array.isArray(y)))return yield*M(new gt(r,y,S));i();let E=y,U={},F={ast:r,input:E,out:U,issues:void 0,options:S},h=S.errors===\"all\",I=S.onExcessProperty===\"error\",C=S.concurrency===void 0?1:Mp(S.concurrency),k=o&&I?r.indexSignatures.map(z=>sa(E,z.parameter,S)):void 0;if(I){let z=k?new Set(p):p;if(k)for(let xe of k)for(let Pe of xe)z.add(Pe);let ce=Reflect.ownKeys(E);for(let xe=0;xe<ce.length;xe++){let Pe=ce[xe];if(!z.has(Pe)&&Object.prototype.propertyIsEnumerable.call(E,Pe)){let Ut=new jg(r,E[Pe],S),et=new xt([Pe],Ut);if(h){F.issues?F.issues.push(et):F.issues=[et];continue}else return yield*M(new Rt(r,[et],y,S))}}}if(n){let z=C===1?uC(F,s):k5(F,s,{concurrency:C});z&&(yield*z)}if(o&&C===1)for(let z=0;z<o;z++){let ce=a[z],xe=ce.is.parameter===dn?x:m,Pe=k?.[z]??(ce.is.parameter===dn?Object.keys(E):sa(E,ce.is.parameter,S));for(let Ut=0;Ut<Pe.length;Ut++){let et=xe(F,Pe[Ut],ce);if(!Be(et))yield*et;else if(et._tag===\"Failure\")return yield*et}}else if(g){let z=Ot();for(let xe=0;xe<o;xe++){let Pe=a[xe],Ut=k?.[xe]??(Pe.is.parameter===dn?Object.keys(E):sa(E,Pe.is.parameter,S));for(let et=0;et<Ut.length;et++)z.push([Ut[et],Pe])}let ce=g(F,z,{concurrency:C});ce&&(yield*ce)}return F.issues?yield*M(new Rt(r,F.issues,y,S)):U})};if(o)return c();let u,f=(p,d,m)=>{let x=s[d];return T(to(m),g=>{let y=ry(p,x,g);if(y)return y;let S=()=>pr(p.out),E=uC(p,s.slice(d+1));return E?ut(E,S):S()})};return(p,d)=>{if(p===he)return ln;if(d.errors===\"all\"||d.onExcessProperty!==void 0||d.concurrency!==void 0&&Mp(d.concurrency)!==1)return(u??=c())(p,d);if(!(typeof p==\"object\"&&p!==null&&!Array.isArray(p)))return M(new gt(r,p,d));let m=i(),x=p,g={},y={ast:r,input:x,out:g,issues:void 0,options:d};try{for(let S=0;S<m.length;S++){let E=m[S],U=E.name,F=Lf(x,U),h=F?x[U]:he,I=E.parser(h,d);if(!Be(I))return f(y,S,I);if(I===Je){F&&N(g,U,h);continue}let C=ry(y,E,I);if(C)return C}}catch(S){return Tr(S)}return pr(g)}}_rebuild(e,t,r,n){let o=ni(this.propertySignatures,a=>{let i=e(a.type);return i===a.type?a:new uy(a.name,i)}),s=ni(this.indexSignatures,a=>{let i=t(a.parameter),c=e(a.type);return i===a.parameter&&c===a.type?a:new fy(i,c)});return o===this.propertySignatures&&s===this.indexSignatures&&r===this.checks&&n===this.encodingChecks?this:new $f(o,s,this.annotations,r,void 0,this.context,n)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?\"object | array\":\"object\"}};function ry(e,t,r){if(r._tag===\"Failure\")return ty(e,e.ast,t.name,r);if(r===Je)return;let n=r[de];if(n!==he){N(e.out,t.name,n);return}if(delete e.out[t.name],!sr(t.type)){let o=new xt([t.name],new ys(t.type.context?.annotations));if(e.options.errors===\"all\"){e.issues?e.issues.push(o):e.issues=[o];return}else return Gs(new Rt(e.ast,[o],e.input,e.options))}}var o1={onItem(e,t){if(!Lf(e.input,t.name))return t.parser(he,e.options);let r=e.input[t.name];return N(e.out,t.name,r),t.parser(r,e.options)},step:ry},uC=Ix()(o1),k5=Tx()(o1);function CC(e,t){return e?t?[...e,...t]:e:t}function Hd(e,t,r){return new $f(Reflect.ownKeys(e).map(n=>new uy(n,e[n].ast)),[],r,t)}function Bf(e){return e.ast}function ly(e,t=void 0){return new Dn(!1,e.map(r=>r.ast),[],void 0,t)}function Wd(e,t,r){return new Yr(e.map(Bf),t,void 0,r)}function kC(e,t){if(e.encoding||t.some(s=>s.encoding))throw new Error(\"StructWithRest does not support encodings\");let r=e.propertySignatures,n=e.indexSignatures,o=e.checks;for(let s of t){for(let a of s.propertySignatures)if(r.some(i=>i.name===a.name))throw new Error(`Duplicate identifier: ${JSON.stringify(a.name)}. ts(2300)`);r=r.concat(s.propertySignatures),n=n.concat(s.indexSignatures),o=CC(o,s.checks)}return new $f(r,n,void 0,o)}function AC(e,t){if(e.encoding)throw new Error(\"TupleWithRest does not support encodings\");return new Dn(e.isMutable,e.elements,t,void 0,e.checks)}function vC(e){if(e.encoding)throw new Error(\"mutable does not support encodings\");return new Dn(!0,e.elements,e.rest,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}var OC=yi(e=>{for(;;){if(hC(e))return oo;let t=e.encoding;if(!t)return e.recur?.(OC,A)??e;if(t.some(r=>r.transformation._tag===\"Middleware\"&&r.transformation.decode!==A))return oo;e=t[t.length-1].to}});function s1(e){switch(e._tag){case\"Null\":return[\"null\"];case\"Undefined\":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\"]:[\"string\",\"number\",\"boolean\",\"symbol\",\"bigint\",\"object\",\"array\",\"function\"];case\"Enum\":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case\"Literal\":return[typeof e.literal];case\"Union\":return Array.from(new Set(e.types.flatMap(s1)));default:return[\"null\",\"undefined\",\"string\",\"number\",\"boolean\",\"symbol\",\"bigint\",\"object\",\"array\",\"function\"]}}function Lc(e){switch(e._tag){default:return[];case\"Declaration\":{let t=e.annotations?.[Td];return Array.isArray(t)?t:[]}case\"Objects\":return e.propertySignatures.flatMap(t=>{let r=t.type;if(!sr(r)){if(Dc(r))return[{key:t.name,literal:r.literal}];if(ey(r))return[{key:t.name,literal:r.symbol}]}return[]});case\"Arrays\":return e.elements.flatMap((t,r)=>{if(!sr(t)){if(Dc(t))return[{key:r,literal:t.literal}];if(ey(t))return[{key:r,literal:t.symbol}]}return[]});case\"Union\":{if(e.types.length===0)return[];let t=e.types.map(r=>Lc(OC(r)));return t[0].filter(r=>t.every(n=>n.some(o=>o.key===r.key&&o.literal===r.literal)))}case\"Suspend\":return Lc(e.thunk())}}var MN=new WeakMap,Xg=Object.freeze([]),FN=e=>e===null?\"null\":Array.isArray(e)?\"array\":typeof e,Lf=(e,t)=>t===\"__proto__\"?Object.hasOwn(e,t):t in e;function zf(e){let t=MN.get(e);if(t)return t;let r,n=0,o,s,a=!0,i=[];for(let f=0;f<e.length;f++){let p=e[f],d=OC(p);if(DN(d))continue;if(Dc(d)||ey(d)){s??=new Map;let x=Dc(d)?d.literal:d.symbol;i[f]=x;let g=s.get(x);g||s.set(x,g=[]),g.push(f)}else a=!1;let m=Lc(d);if(m.length){r??=new Map,n++;for(let{key:x,literal:g}of m){let y=r.get(x);y||r.set(x,y=[new Map,new Set]),y[1].add(f);let S=y[0].get(g);S||y[0].set(g,S=new Set),S.add(f)}}else{o??={};let x=s1(d);for(let g of x)(o[g]??=[]).push(f)}}let c={},u=f=>c[f]??=Object.freeze(o?.[f]??Xg);if(a&&s)s.forEach(Object.freeze),t=f=>s.get(f)??Xg;else if(r?.size===1&&!o){let[f,[p]]=r.entries().next().value,d=new Map;for(let[x,g]of p)d.set(x,Object.freeze(Array.from(g)));let m=Object.freeze(e.map((x,g)=>g));t=(x,g)=>{if(xu(x)){let y=Lf(x,f)?x[f]:void 0;if(y!==void 0)return d.get(y)??Xg;if(g)return m}return Xg}}else if(r){let f;for(let p of r)(!f||p[1][0].size>f[1][0].size)&&p[1][1].size===n&&(f=p);t=(p,d)=>{let m=FN(p);if(!xu(p))return u(m);let x=new Set(o?.[m]),g;if(f){let[y,[S]]=f,E=Lf(p,y),U=E?p[y]:void 0;if(E&&(!d||U!==void 0)){let F=S.get(U);if(!F)return u(m);for(let h of F)x.add(h);g=y}}if(g===void 0)for(let[y,[S,E]]of r){let U=Lf(p,y),F=U?p[y]:void 0;if(U&&(!d||F!==void 0)){let h=S.get(F);if(h)for(let I of h)x.add(I)}else if(d)for(let h of E)x.add(h)}for(let[y,[S,E]]of r){if(y===g)continue;let U=Lf(p,y),F=U?p[y]:void 0;if(U&&(!d||F!==void 0)){let h=S.get(F);for(let I of x)E.has(I)&&!h?.has(I)&&x.delete(I)}}return Array.from(x).sort((y,S)=>y-S)}}else t=f=>{let p=u(FN(f));return s?p.filter(d=>i[d]===void 0||i[d]===f):p};return MN.set(e,t),t}var Yr=class extends kt{_tag=\"Union\";types;options;encodingChecks;constructor(e,t,r,n,o,s,a){super(r,n,o,s),this.types=e,this.options=t,this.encodingChecks=a}getParser(e,t){let r=this,n=t!==void 0,o=[],s=i=>o[i]??=e(r.types[i]),a;return(i,c)=>{if(i===he)return ln;let u=(a??=zf(r.types))(i,n);if(u.length===0)return M(new Nf(r,[],i,c));if(u.length===1){let f=s(u[0])(i,c);return f._tag===\"Success\"?f:Be(f)?a1(r,f.cause,i,c):A5(r,f,i,c)}return v5(r,s,u,i,c)}}_rebuild(e,t,r){let n=ni(this.types,e);return n===this.types&&t===this.checks&&r===this.encodingChecks?this:new Yr(n,this.options,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let r of this.types){let n=r.matchPart(e,t);if(n!==void 0)return n}}getExpected(e){let t=this.annotations?.expected;if(typeof t==\"string\")return t;if(this.types.length===0)return\"never\";let r=this.types.map(n=>{let o=xn(n);switch(o._tag){case\"Arrays\":{let s=o.elements.filter(Dc);if(s.length>0)return`${UN(o.isMutable)}[ ${s.map(a=>e(a)+NN(a.context?.isOptional)).join(\", \")}, ... ]`;break}case\"Objects\":{let s=o.propertySignatures.filter(a=>Dc(a.type));if(s.length>0)return`{ ${s.map(a=>`${UN(a.type.context?.isMutable)}${Yo(a.name)}${NN(a.type.context?.isOptional)}: ${e(a.type)}`).join(\", \")}, ... }`;break}}return e(o)});return Array.from(new Set(r)).join(\" | \")}};function a1(e,t,r,n){let o=Od(t);return o?Gs(new Nf(e,[o],r,n)):sn(t)}function A5(e,t,r,n){return _t(t,o=>a1(e,o,r,n))}function v5(e,t,r,n,o){let s={ast:e,parser:t,input:n,out:void 0,successes:e.options?.mode===\"oneOf\"?[]:void 0,issues:void 0,options:o},a=_5(s,r);return a?O5(a,s):s.out?s.out:M(new Nf(e,s.issues??[],n,o))}function O5(e,t){return ut(e,r=>t.out===Je?b(t.input):t.out?t.out:M(new Nf(t.ast,t.issues??[],t.input,t.options)))}var _5=Ix()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,r){if(r._tag===\"Failure\"){let n=Od(r.cause);if(n===void 0)return r;e.issues?e.issues.push(n):e.issues=[n]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),Gs(new tw(e.ast,e.successes,e.input,e.options));if(e.out=r,e.successes)e.successes.push(e.ast.types[t]);else return ht}}}),i1=new Yr([new mn(\"Infinity\"),new mn(\"-Infinity\"),new mn(\"NaN\")]);function UN(e){return e?\"\":\"readonly \"}function NN(e){return e?\"?\":\"\"}var py=class extends kt{_tag=\"Suspend\";thunk;constructor(e,t,r,n,o){if(r)throw new Error(\"Cannot add checks to Suspend\");super(t,void 0,n,o);let s;this.thunk=()=>s??=e()}getParser(e){let t;return(r,n)=>(t??=e(this.thunk()))(r,n)}recur(e){return new py(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},jd=class extends ba{_tag=\"Filter\";run;annotations;aborted;constructor(e,t=void 0,r=!1){super(),this.run=e,this.annotations=t,this.aborted=r}annotate(e){return new jd(this.run,{...this.annotations,...e},this.aborted)}abort(){return new jd(this.run,this.annotations,!0)}and(e,t){return new ri([this,e],t)}},ri=class extends ba{_tag=\"FilterGroup\";checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new ri(this.checks,{...this.annotations,...e})}and(e,t){return new ri([this,e],t)}};function Jd(e,t,r=!1){return new jd((n,o,s)=>rw(o,e(n,o,s),n,s),t,r)}function Gd(e,t){return new jd((r,n,o)=>e(r)?void 0:new se(void 0,r,o),t,!0)}function dy(e){return Jd(t=>globalThis.Number.isFinite(t),{expected:\"a finite number\",representation:{id:\"effect/schema/isFinite\",payload:null},toJsonSchema:()=>({type:\"number\"}),toCode:()=>({runtime:\"Schema.isFinite()\"}),arbitraryConstraint:{number:\"finite\"},...e})}var my=Fo(cy,[dy()]),R5=new lt(new Yr([my,i1]),new ye(Md(),Y(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function jf(e,t){let r=new globalThis.RegExp(e),n={source:r.source,flags:r.flags};return Jd(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n.source}`,representation:{id:\"effect/schema/isPattern\",payload:n},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[n]},...t})}var fC=new WeakMap;function Kd(e,t){let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(n=>n===\"context\"||n===\"encoding\")&&fC.set(r,jc(e)),r}function jc(e){let t=fC.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return fC.set(e,r),r}function Ge(e,t){return e.encoding===t?e:Kd(e,{encoding:t})}function oi(e,t){if(e.context===t)return e;let r=jc(e);return r.context===t&&r.encoding===e.encoding?r:Kd(e,{context:t})}function qc(e){return e.encoding?qc(e.encoding[e.encoding.length-1].to):e}function so(e,t){if(e.checks){let r=e.checks[e.checks.length-1];return _C(e,Oa(e.checks.slice(0,-1),r.annotate(t)))}return Kd(e,{annotations:{...e.annotations,...t}})}function _C(e,t){if(e._tag===\"Suspend\"&&t)throw new Error(\"Cannot add checks to Suspend\");return e.checks===t?e:Kd(e,{checks:t})}function Fo(e,t){return _C(e,CC(e.checks,t))}function Hc(e,t){let r=t(e.to);return r===e.to?e:new lt(r,e.transformation)}function RC(e,t){let r=e,n=r[r.length-1],o=Hc(n,t);return o===n?e:Oa(e.slice(0,e.length-1),o)}function hy(e){return t=>t.encoding?Ge(t,RC(t.encoding,e)):t}function Vd(e,t){return hy(r=>oi(r,t))(e)}function PC(e){function t(r){return r.encoding?Ge(r,RC(r.encoding,t)):e(r)}return wn(t)}function si(e,t){function r(n){if(n.encoding){let o=n.encoding[n.encoding.length-1];return t?.stopAt?.(o)?n:Ge(n,RC(n.encoding,r))}return e(n)}return yi(r)}function MC(e,t){return UC(e,t,At(e))}function FC(e,t){return UC(xn(e),t,e)}function UC(e,t,r){let n=new lt(e,t);return Ge(r,r.encoding?[...r.encoding,n]:[n])}function ni(e,t){let r;for(let n=0;n<e.length;n++){let o=e[n],s=t(o);if(r)r[n]=s;else if(s!==o){r=new Array(e.length);for(let a=0;a<n;a++)r[a]=e[a];r[n]=s}}return r??e}function qf(e,t){let r=e.context?new Po(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Po(!1,!1,void 0,t);return oi(e,r)}var ai=yi(e=>{let t=e.context?e.context.isOptional===!1?new Po(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Po(!0,!1);return P5(oi(e,t))}),P5=hy(ai),NC=wn(e=>ai(new Yr([e,sy]))),xy=yi(e=>{let t=e.context?e.context.isMutable===!1?new Po(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new Po(!1,!0);return M5(oi(e,t))}),M5=hy(xy);function DC(e,t){let r=e.context?new Po(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new Po(!1,!1,t);return oi(e,r)}function aa(e,t,r){return UC(e,r,t)}function F5(e){let t=[],r=[];function n(o){switch(o._tag){case\"Literal\":Nl(o.literal)&&!t.includes(o.literal)&&t.push(o.literal);return;case\"UniqueSymbol\":t.includes(o.symbol)||t.push(o.symbol);return;case\"Never\":return;case\"Union\":for(let s=0;s<o.types.length;s++)n(o.types[s]);return;default:r.push(o)}}return n(e),{literals:t,parameters:r}}function LC(e,t){let{literals:r,parameters:n}=F5(e);return new $f(r.map(o=>new uy(o,t)),n.map(o=>new fy(o,t)))}function sr(e){return e.context?.isOptional??!1}function $C(e){return e.context?.isMutable??!1}function c1(e){return e.annotations?.[fn]===!0||e._tag===\"FilterGroup\"&&e.checks.every(c1)}function U5(e){function t(n){return c1(n)?[n]:n._tag===\"FilterGroup\"?n.checks.flatMap(t):[]}let r=e.flatMap(t);return gr(r)?r:void 0}function N5(e){let t=!0;function r(n){return t=t&&!n.encoding&&!hC(n),t&&\"recur\"in n&&n.recur(r),n}return\"recur\"in e&&e.recur(r),t}var At=yi(e=>{let t=jc(e);if(t!==e){let n=At(t);return n===t&&e.encoding===void 0?e:oi(n,e.context)}let r=\"recur\"in e?e.recur(At):e;if(\"encodingChecks\"in r&&r.encodingChecks){let n=N5(e)?r.encodingChecks:ny(r)||LN(r)||Bc(r)&&r.typeParameters.length>0?U5(r.encodingChecks):void 0;return Kd(r,{encodingChecks:void 0,checks:CC(r.checks,n)})}return r}),xn=yi(e=>At(hn(e)));function D5(e,t){let r=t,n=r.length,o=r[n-1],s=[new lt(hn(Ge(e,void 0)),r[0].transformation.flip())];for(let i=1;i<n;i++)s.unshift(new lt(hn(r[i-1].to),r[i].transformation.flip()));let a=hn(o.to);return a.encoding?Ge(a,[...a.encoding,...s]):Ge(a,s)}var hn=wn(e=>{if(e.encoding)return D5(e,e.encoding);let t=jc(e);if(t!==e){let r=hn(t);return r===t?e:oi(r,e.context)}return\"flip\"in e?e.flip(hn):\"recur\"in e?e.recur(hn):e});function BC(e){switch(e._tag){case\"Undefined\":return!0;case\"Union\":return e.types.some(BC);default:return!1}}function gy(e,t){let r=t===0?Je:pr(t);return(n,o)=>n===he?ln:n===t?r:M(new gt(e,n,o))}function Uo(e,t){return(r,n)=>r===he?ln:t(r)?Je:M(new gt(e,r,n))}function u1(e,t,r){let n=e.encodedParts,o=e.literals,s=t.length;for(let u=0;u<o.length;u++){let f=o[u];if(f&&!t.includes(f))return}if(e.suffixLengths[0]>s)return;let a=new Array(n.length),i;function c(u,f){if(u===n.length)return f===s;if(i?.has(u*(s+1)+f))return!1;let p=n[u];if(u===n.length-1){let d=t.slice(f);if(p.matchPart(d,r)!==void 0)return a[u]=d,!0}else if(p._tag===\"Literal\"){let d=o[u];if(t.startsWith(d,f)&&c(u+1,f+d.length))return a[u]=d,!0}else{let d=s-e.suffixLengths[u+1],m=o[u+1],x=m===void 0?d:t.lastIndexOf(m,d);for(;x>=f;){let g=t.slice(f,x);if(p.matchPart(g,r)!==void 0&&c(u+1,x))return a[u]=g,!0;if(x===0)break;x=m===void 0?x-1:t.lastIndexOf(m,x-1)}}return i??=new Set,i.add(u*(s+1)+f),!1}return c(0,0)?a:void 0}var yy=si(e=>{switch(e._tag){default:return e;case\"Number\":return e.toCodecStringTree();case\"Union\":return e.recur(yy)}}),Zd=si(e=>{switch(e._tag){default:return e;case\"Symbol\":case\"UniqueSymbol\":return e.toCodecStringTree();case\"Union\":return e.recur(Zd)}}),zC=si(e=>{switch(e._tag){default:return e;case\"Number\":case\"Literal\":case\"BigInt\":return e.toCodecStringTree();case\"Union\":return e.recur(zC)}}),jC=\"[\\\\s\\\\S]*?\",lC=new globalThis.RegExp(`^${qd}$`),L5=new globalThis.RegExp(`^(?:${qd}|Infinity|-Infinity|NaN)$`);function by(e){return jf(lC,{expected:\"a string representing a finite number\",representation:{id:\"effect/schema/isStringFinite\",payload:null},toJsonSchema:()=>({pattern:lC.source}),...e})}var f1=Fo(dn,[by()]),$5=new lt(f1,Nc),B5=new lt(new Yr([f1,i1]),Nc),z5=\"-?\\\\d+\",pC=new globalThis.RegExp(`^${z5}$`);function Sy(e){return jf(pC,{expected:\"a string representing a bigint\",representation:{id:\"effect/schema/isStringBigInt\",payload:null},toJsonSchema:()=>({pattern:pC.source}),...e})}var Ey=Fo(dn,[Sy({expected:\"a string representing a bigint\"})]),j5=new lt(Ey,Bd),q5=\"Symbol\\\\(([\\\\s\\\\S]*)\\\\)\",dC=new globalThis.RegExp(`^${q5}$`),l1=Fo(dn,[Iy()]),p1=new lt(l1,new ye(Y(e=>globalThis.Symbol.for(dC.exec(e)[1])),ft((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?b(globalThis.String(e)):M(new Uf({message:\"cannot serialize to string, Symbol is not registered\"},e,t)))));function Iy(e){return jf(dC,{expected:\"a string representing a symbol\",representation:{id:\"effect/schema/isStringSymbol\",payload:null},toJsonSchema:()=>({pattern:dC.source}),...e})}function ao(e,t,r,n,o){for(let s=0;s<e.length;s++){let a=e[s];if(a._tag===\"FilterGroup\"){if(r=ao(a.checks,t,r,n,o),r&&(o.errors!==\"all\"||r[r.length-1].filter.aborted))return r}else{let i=a.run(t,n,o);if(i){let c=new XT(a,i,t,o);if(r?r.push(c):r=[c],o.errors!==\"all\"||a.aborted)return r}}}return r}function qC(e,t){let r=ao(e,t,void 0,oo,{errors:\"all\"});if(r){let n=new Rt(oo,r);return D(n)}return P(t)}function HC(e){if(!Bc(e))return;let t=e.annotations?.[Lg];return qt(t)?t(e.typeParameters):void 0}var H5=gs,W5=Pf,J5=Mc,G5=$g,K5=SN;function V5(e){return e===null||typeof e==\"string\"||typeof e==\"boolean\"||typeof e==\"number\"&&globalThis.Number.isFinite(e)}function Z5(e){return e===void 0||typeof e==\"string\"}function d1(e,t){let r=new WeakMap,n=[];e:for(;;){if(typeof e!=\"object\"||e===null){if(!t(e))return!1}else{let o=e,s=r.get(o);if(s===!1)return!1;if(s===void 0){let a=Array.isArray(o);if(!a){let i=Object.getPrototypeOf(o);if(i!==null&&i!==Object.prototype&&Object.getPrototypeOf(i)!==null)return!1}r.set(o,!1),n.push({value:o,keys:a?o.length:Object.keys(o),index:0})}}for(;n.length>0;){let o=n[n.length-1],s=o.keys;if(typeof s==\"number\"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}r.set(o.value,!0),n.pop()}return!0}}function Wc(e){return d1(e,V5)}var $c=new zc([],()=>(e,t,r)=>Wc(e)?Je:M(new gt(t,e,r)),{representation:{id:\"effect/schema/Json\",payload:null},expected:\"JSON value\",toCodecJson:()=>{},toCodecStringTree:()=>wy}),WC=so($c,{representation:{id:\"effect/schema/MutableJson\",payload:null}}),Ty=new lt($c,Uc()),JC=new lt(new Yr([new Dn(!1,[],[$c]),new $f([],[new fy(dn,$c)])]),Uc());function m1(e){return d1(e,Z5)}var Q5=new zc([],()=>(e,t,r)=>m1(e)?Je:M(new gt(t,e,r)),{expected:\"StringTree\",toCodecStringTree:()=>{}}),wy=new lt(Q5,Uc());var No={};$e(No,{_is:()=>ii,_issue:()=>ZC,asOption:()=>sk,asserts:()=>QC,decodeEffect:()=>em,decodeExit:()=>c8,decodeOption:()=>YC,decodePromise:()=>i8,decodeResult:()=>u8,decodeSync:()=>tm,decodeUnknownEffect:()=>Xe,decodeUnknownExit:()=>Py,decodeUnknownOption:()=>My,decodeUnknownPromise:()=>a8,decodeUnknownResult:()=>Fy,decodeUnknownSync:()=>E1,encodeEffect:()=>XC,encodeExit:()=>l8,encodeOption:()=>ek,encodePromise:()=>f8,encodeResult:()=>p8,encodeSync:()=>rm,encodeUnknownEffect:()=>ia,encodeUnknownExit:()=>Uy,encodeUnknownOption:()=>Ny,encodeUnknownPromise:()=>I1,encodeUnknownResult:()=>Dy,encodeUnknownSync:()=>T1,is:()=>Ry,make:()=>Xd,makeEffect:()=>_y,makeOption:()=>Yd,run:()=>nm});var Cy=(e,t,r)=>e===Je?r(t):ut(e,r);function x1(e){if(e._tag===\"Middleware\")return(r,n,o)=>{let s=r===Je?e.decode(pr(Cd(n)),o):e.decode(Un(r,Cd),o);return h1(s)};let t=e.decode;switch(t._tag){case\"Passthrough\":return(r,n)=>r===Je?pr(n):r;case\"Transform\":{let r=n=>n===he?ln:pr(t.transform(n));return(n,o)=>Cy(n,o,r)}case\"TransformOptional\":{let r=n=>QT(t.transform(Cd(n)));return(n,o)=>Cy(n,o,r)}case\"TransformEffect\":return(r,n,o)=>Cy(r,n,s=>s===he?ln:t.transform(s,o));case\"TransformOptionalEffect\":return(r,n,o)=>Cy(r,n,s=>h1(t.transform(Cd(s),o)))}}var h1=e=>ut(e,QT),g1=(e,t,r,n)=>_t(n,o=>Ys(()=>Vs(o,s=>new ew(e,s,t,r))));function Y5(e,t){let r=x1(e.link.transformation),n;return(o,s)=>{if(o===he)return ln;if(e.isConstructed(o))return Je;let a=(n??=t(e.link.to))(o,s);return r(a,o,s)}}function X5(e,t){let r=e.context.constructorDefault;return(n,o)=>{if(n!==he&&n!==void 0)return t(n,o);let s=r;if(Be(s)&&s._tag===\"Success\"){let a=t(s[de],o);return a===Je?s:a}return ut(g1(e,n,o,s),a=>{let i=t(a,o);return i===Je?pr(a):i})}}function GC(e,t){let r=t(e);return e.context?.constructorDefault===void 0?r:X5(e,r)}function Qd(e,t,r,n,o){if(e._tag===\"Declaration\")for(let x of e.typeParameters)t(x);let s=r?HC(e):void 0,a=s?Y5(s,t):n??e.getParser(t,r),i=e.checks,c=e.encoding,u=c?.map(x=>x1(x.transformation)),f=e.encodingChecks;if(!c&&!i&&!f)return a;let p,d=(x,g)=>{let y=a(x,g);if(f&&!g.disableChecks)if(Be(y)){if(y._tag===\"Success\"){let S=y===Je?x:y[de];if(x!==he&&S!==he){let E=ao(f,x,void 0,e,g);E&&(y=M(new Rt(e,E,x,g)))}}}else y=T(y,S=>{if(x!==he&&S!==he){let E=ao(f,x,void 0,e,g);if(E)return M(new Rt(e,E,x,g))}return b(S)});if(i&&!g.disableChecks)if(Be(y)){if(y._tag===\"Success\"){let S=y===Je?x:y[de];if(S===he)return y;let E=ao(i,S,void 0,e,g);E&&(y=M(new Rt(e,E,S,g)))}}else y=T(y,S=>{if(S!==he){let E=ao(i,S,void 0,e,g);if(E)return M(new Rt(e,E,S,g))}return b(S)});return y},m=o===void 0?d:o(d);return c?(x,g)=>{let y=p??=c.map(U=>t(U.to)),S=x,E=y[y.length-1](x,g);for(let U=c.length-1;U>=0;U--)if(E=u[U](E,S,g),U!==0){let F=y[U-1];E._tag===\"Success\"?(S=E[de],E=F(S,g)):E=ut(E,h=>{let I=F(h,g);return I===Je?pr(h):I})}if(E._tag===\"Success\"){let U=E[de],F=m(U,g);return F===Je?E:F}return E=g1(e,x,g,E),ut(E,U=>{let F=m(U,g);return F===Je?pr(U):F})}:m}var vy=Symbol(),y1=new WeakMap,b1,Hf=!1;var t8=e=>Hf?Ay(Ln,e,\"parser\"):Ln(e).parser,S1=e=>Hf?Ay(Ln,e,\"makeEffect\"):Ln(e).makeEffect,r8=e=>GC(e,S1),ky=class{ast;constructor(t){this.ast=t}get decodeEffect(){return this.cachedDecodeEffect??=Qd(this.ast,t8)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=Qd(this.ast,S1,r8)}},KC=class extends ky{compiled;resolve;constructor(t,r,n){super(t),this.compiled=r,this.resolve=n}save(t,r){return Object.defineProperty(this,t,{value:r}),r}operation(t){let r=this.compiled;return typeof r==\"function\"?r(this.ast,this.resolve,t):r?.[t]}get is(){return this.save(\"is\",this.operation(\"is\"))}get decode(){return this.save(\"decode\",this.operation(\"decode\"))}get make(){return this.save(\"make\",this.operation(\"make\"))}get decodeEffect(){return this.save(\"decodeEffect\",this.operation(\"decodeEffect\")??Qd(this.ast,t=>Ay(this.resolve,t,\"parser\")))}get parser(){let t=this.decode;return t===void 0?this.decodeEffect:this.save(\"parser\",n8(t,()=>this.decodeEffect))}get makeEffect(){let t=this.operation(\"makeEffect\");if(t!==void 0)return this.save(\"makeEffect\",t);let r=n=>Ay(this.resolve,n,\"makeEffect\");return this.save(\"makeEffect\",Qd(this.ast,r,n=>GC(n,r)))}};function n8(e,t){let r;return(n,o)=>{if(n!==he)try{let s=e(n,o);if(s!==vy)return s===n?Je:pr(s)}catch(s){return Tr(s)}return(r??=t())(n,o)}}function Ay(e,t,r){let n=e(t);if(n.compiled===void 0||Object.hasOwn(n,r))return n[r];let o;return(s,a)=>(o??=n[r])(s,a)}function Ln(e){let t=y1.get(e);if(t!==void 0)return t;let r=b1===void 0?new ky(e):new KC(e,b1(e,Ln),Ln);return y1.set(e,r),r}function _y(e){let t=e.ast,r;return(n,o)=>(r??=nk(g8,At(t)))(n,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function Yd(e){let t=_y(e);return(r,n)=>{let o=ro(t(r,n));return je(o)?O(o.value):(pn(o.cause,\"Option adapter can only return none for schema issues\"),v())}}function Xd(e){return h8(At(e.ast))}function Ry(e){return ii(e.ast)}function s8(e){if(!Hf){let o=Wf(nm(e));return s=>{let a=o(s,Mo);return je(a)?!0:(pn(a.cause,\"Type guard adapter can only return false for schema issues\"),!1)}}let t=Ln(e),r=t.is;if(r!==void 0)return o=>{try{return r(o,Mo)}catch(s){return pn(sc(s),\"Type guard adapter can only return false for schema issues\"),!1}};let n=t.parser;return o=>{let s=ro(rk(n(o,Mo),o));return je(s)?!0:(pn(s.cause,\"Type guard adapter can only return false for schema issues\"),!1)}}function ii(e){let t=At(e),r=n=>(r=s8(t),r(n));return n=>r(n)}function ZC(e){let t=nm(e);return(r,n)=>{let o=ro(t(r,n));if(!je(o))return pn(o.cause,\"Issue adapter can only return schema issues\")}}function QC(e,t){let r=At(e.ast),n=Ln(r).parser(t,Mo),o=ro(rk(n,t));if(Co(o)){let s=pn(o.cause,\"Assertion adapter can only throw schema issues\");throw new Error(\"Schema validation failed\",{cause:s})}}function Xe(e,t){let r=nm(e.ast);return t===void 0?r:(n,o)=>r(n,tk(t,o))}var em=Xe;function a8(e,t){return ok(Xe(e,t))}function i8(e,t){return ok(em(e,t))}function Py(e,t){return Wf(Xe(e,t))}var c8=Py;function My(e,t){return sk(Xe(e,t))}var YC=My;function Fy(e,t){return w1(Xe(e,t))}var u8=Fy;function E1(e,t){return Hf?C1(e.ast,t):ak(Xe(e,t))}var tm=E1;function ia(e,t){let r=nm(hn(e.ast));return t===void 0?r:(n,o)=>r(n,tk(t,o))}var XC=ia,I1=(e,t)=>ok(ia(e,t)),f8=I1;function Uy(e,t){return Wf(ia(e,t))}var l8=Uy;function Ny(e,t){return sk(ia(e,t))}var ek=Ny;function Dy(e,t){return w1(ia(e,t))}var p8=Dy;function T1(e,t){return Hf?C1(hn(e.ast),t):ak(ia(e,t))}var rm=T1,tk=(e,t)=>t?{...e,...t}:e,Oy=e=>e===he?M(new se):b(e);function nm(e){return nk(x8,e)}function rk(e,t){return e===Je?b(t):Be(e)?e[de]===he?Oy(he):e:ut(e,Oy)}function nk(e,t){let r;return(n,o)=>{let s=(r??=e(t))(n,o??Mo);return s===Je?b(n):Be(s)?s[de]===he?Oy(he):s:ut(s,Oy)}}function ok(e){return(t,r)=>Sc(e(t,r)).then(n=>{if(je(n))return n.value;let o=pn(n.cause,\"Promise adapter can only reject schema issues\");throw new Error(\"Schema validation failed\",{cause:o})})}function Wf(e){return(t,r)=>ro(e(t,r))}function sk(e){let t=Wf(e);return(r,n)=>{let o=t(r,n);return je(o)?O(o.value):(pn(o.cause,\"Option adapter can only return none for schema issues\"),v())}}function w1(e){let t=Wf(e);return(r,n)=>{let o=t(r,n);return je(o)?P(o.value):D(pn(o.cause,\"Result adapter can only return schema issues\"))}}function C1(e,t){let r;return(n,o)=>(r??=d8(Ln(e),t))(n,o)}function d8(e,t){let r=e.decode,n,o=r===void 0?(s,a=Mo)=>(n??=VC(e))(s,a):(s,a=Mo)=>{if(s===he)return(n??=VC(e))(s,a);let i;try{i=r(s,a)}catch(c){throw pn(sc(c),\"Sync adapter can only throw schema issues\"),c}return i!==vy?i:(n??=VC(e))(s,a)};return t===void 0?o:(s,a)=>o(s,tk(t,a))}function VC(e){return ak(nk(()=>e.decodeEffect,e.ast))}function ak(e){let t=Wf(e);return(r,n)=>{let o=t(r,n);if(je(o))return o.value;let s=pn(o.cause,\"Sync adapter can only throw schema issues\");throw new Error(\"Schema validation failed\",{cause:s})}}function m8(e,t){let r=ro(e);if(je(r))return r.value;let n=pn(r.cause,t);throw new Error(\"Schema validation failed\",{cause:n})}function h8(e){let t,r;return(n,o)=>{t??=Ln(e);let s=o?.disableChecks?o.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions??Mo,a=t.make;if(a!==void 0&&n!==he){let c;try{c=a(n,s)}catch(u){throw pn(sc(u),\"Constructor adapter can only throw schema issues\"),u}if(c!==vy&&c!==he)return c}let i=(r??=t.makeEffect)(n,s);return m8(rk(i,n),\"Constructor adapter can only throw schema issues\")}}var x8=e=>Ln(e).parser,g8=e=>Ln(e).makeEffect;var Ly=\"~effect/Schema/Schema\",k1=Symbol(),y8={[Ly]:Ly,get make(){let e=Xd(this);return Object.defineProperty(this,\"make\",{value:e,enumerable:!0}),e},get makeEffect(){let e=_y(this);return Object.defineProperty(this,\"makeEffect\",{value:e,enumerable:!0}),e},get makeOption(){let e=Yd(this);return Object.defineProperty(this,\"makeOption\",{value:e,enumerable:!0}),e},pipe(){return K(this,arguments)},annotate(e){return this.rebuild(so(this.ast,e))},annotateKey(e){return this.rebuild(qf(this.ast,e))},check(...e){return this.rebuild(Fo(this.ast,e))},rebuild(e){return Do(e,this[k1])}};function Do(e,t){function r(){}let n=Object.setPrototypeOf(r,y8);return t&&(Object.hasOwn(t,\"name\")||Object.hasOwn(t,\"length\")||Object.hasOwn(t,\"__proto__\"))?Object.defineProperties(n,Object.getOwnPropertyDescriptors({...t})):Object.assign(n,t),n[k1]=t,n.ast=e,n}function ik(e){return e.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}function om(e){return e.replace(/~1/g,\"/\").replace(/~0/g,\"~\")}function ck(e){return encodeURI(ik(e)).replace(/#/g,\"%23\")}function uk(e){if(e.length===0||e===\"#\")return\"\";if(!e.startsWith(\"#\"))return;let t=e.slice(1);try{if(encodeURI(t).replace(/%25/g,\"%\").replace(/#/g,\"%23\")!==t)return;let r=decodeURIComponent(t);return r.startsWith(\"/\")&&!/~(?:[^01]|$)/.test(r)?r:void 0}catch{return}}function v1(e){let t=uk(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split(\"/\").map(om)}function O1(e){return e.reduce((t,r)=>`${t}/${ck(r)}`,\"#\")}var S8=\"http://json-schema.org/draft-07/schema#\",_1=\"https://json-schema.org/draft/2020-12/schema\";function R1(e,t){return e===t||e===(t.endsWith(\"#\")?t.slice(0,-1):`${t}#`)}function F1(e){return{dialect:\"draft-07\",...C8(e,U8)}}function E8(e,t){return r(e,!1,!0);function r(n,o,s=!1){if(!hr(n))return n;let a=o||!s&&D1(n.$id),i={};for(let c of Object.keys(n)){let u=n[c],f=u;switch(c){case\"$defs\":case\"properties\":case\"patternProperties\":case\"dependentSchemas\":f=lk(u,p=>r(p,a))??u;break;case\"allOf\":case\"anyOf\":case\"oneOf\":case\"prefixItems\":f=Array.isArray(u)?u.map(p=>r(p,a)):u;break;case\"not\":case\"additionalProperties\":case\"propertyNames\":case\"unevaluatedProperties\":case\"items\":case\"contains\":case\"unevaluatedItems\":case\"if\":case\"then\":case\"else\":case\"contentSchema\":f=r(u,a)}N(i,c,f)}return t(i,a),i}}function U1(e,t){return E8(e,r=>{I8(r,t)})}function I8(e,t){typeof e.$ref==\"string\"&&N(e,\"$ref\",t(e.$ref,\"$ref\")),typeof e.$dynamicRef==\"string\"&&N(e,\"$dynamicRef\",t(e.$dynamicRef,\"$dynamicRef\"))}function lk(e,t){if(!hr(e))return;let r={};for(let n of Object.keys(e))N(r,n,t(e[n],n));return r}function T8(e,t,r){let n=new Map,o=[],s=fk;function a(d,m=[],x=[]){if(m.length===0&&t?.trackIds){let g=hr(d)?f(d):void 0;s=P1(g,fk)??fk}return u(d,m,x,{sourceRoot:[],targetRoot:[],uri:s})}function i(){for(let[d,m,x]of o){let g=m,y=N1(m,x);if(y!==void 0){let S=v1(y.hash);if(y.hash=\"\",S!==void 0){let E=n.get(M1(y.href,S));E!==void 0&&(g=w8(m,E))}}N(d,\"$ref\",g)}}let c=r(a);return i(),c;function u(d,m,x,g){if(typeof d==\"boolean\")return p(m,x,g),t?.booleanAdapter?.(d)??d;if(!hr(d))return d;let y=g,S=f(d);if(m.length>0&&t?.trackIds&&D1(S)){let F=P1(S,g.uri);F!==void 0&&(y={parent:g,sourceRoot:m,targetRoot:x,uri:F})}p(m,x,y);let E=y.uri,U={isDocumentRoot:m.length===0,schema(F,h,I=h){return u(F,[...m,h],[...x,I],y)},schemaAt(F,h,I){return u(F,[...m,...h],[...x,...I],y)},schemaArray(F,h,I=h){return Array.isArray(F)?F.map((C,k)=>u(C,[...m,h,String(k)],[...x,I,String(k)],y)):F},schemaMap(F,h,I=h){return hr(F)?lk(F,(C,k)=>u(C,[...m,h,k],[...x,I,k],y)):F},reference(F,h){typeof h==\"string\"?o.push([F,h,E]):N(F,\"$ref\",h)}};return e(d,U)}function f(d){return t?.ignoreRefSiblings===!0&&typeof d.$ref==\"string\"?void 0:d.$id}function p(d,m,x){x.parent!==void 0&&p(d,m,x.parent),n.set(M1(x.uri,d.slice(x.sourceRoot.length)),m.slice(x.targetRoot.length))}}var fk=\"https://effect.invalid/.json-schema/\";function N1(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function P1(e,t){if(typeof e!=\"string\")return;let r=N1(e,t);if(r!==void 0)return r.hash=\"\",r.href}function w8(e,t){let r=e.indexOf(\"#\");return r===-1&&t.length===0?e:`${r===-1?e:e.slice(0,r)}${O1(t)}`}function M1(e,t){return`${e}\\0${JSON.stringify(t)}`}function D1(e){return typeof e==\"string\"&&e.length>0&&e[0]!==\"#\"}function C8(e,t,r){return T8(t,{...r,trackIds:!0},n=>({schema:n(e.schema),definitions:lk(e.definitions,(o,s)=>n(o,[\"$defs\",s],[\"definitions\",s]))}))}var k8=new Set([\"properties\",\"patternProperties\"]),A8=new Set([\"allOf\",\"anyOf\",\"oneOf\"]),v8=new Set([\"not\",\"additionalProperties\",\"propertyNames\",\"contains\",\"if\",\"then\",\"else\",\"contentSchema\"]);function O8(e,t,r,n,o,s=k8){let a;if(s.has(t))a=n.schemaMap(r,t);else if(A8.has(t))a=n.schemaArray(r,t);else if(o.has(t))a=n.schema(r,t);else return!1;return N(e,t,a),!0}var L1=[\"$anchor\",\"$defs\",\"$dynamicAnchor\",\"$dynamicRef\",\"$vocabulary\",\"contentSchema\",\"dependentRequired\",\"dependentSchemas\",\"maxContains\",\"minContains\",\"prefixItems\",\"unevaluatedItems\",\"unevaluatedProperties\"],nde=[...L1,\"deprecated\"],ode=[...L1,\"$comment\",\"$id\",\"$schema\",\"const\",\"contains\",\"contentEncoding\",\"contentMediaType\",\"else\",\"examples\",\"if\",\"patternProperties\",\"propertyNames\",\"then\"],_8=/^[A-Za-z_][-A-Za-z0-9._]*$/,R8=/^[A-Za-z][-A-Za-z0-9._:]*$/;function Jc(e,t,r){throw new Error(`Cannot convert JSON Schema keyword \"${e}\" to ${t}: ${r}`)}function P8(e,t,r,n){for(let o of t)Object.hasOwn(e,o)&&Jc(o,r,`it is not active in ${n} but would become active in the target`)}var M8=[\"additionalItems\",\"definitions\",\"dependencies\"];function F8(e,t,r,n,o){r.isDocumentRoot?N(e,\"$schema\",R1(t,_1)?n:t):R1(t,_1)||Jc(\"$schema\",o,\"an embedded resource cannot declare a different dialect\")}function U8(e,t){P8(e,M8,\"Draft-07\",\"Draft 2020-12\");let r={},n,o,s;for(let a of Object.keys(e)){let i=e[a];if(!O8(r,a,i,t,v8))switch(a){case\"$ref\":n=i;break;case\"$schema\":F8(r,i,t,S8,\"Draft-07\");break;case\"$id\":case\"$anchor\":break;case\"$defs\":N(r,\"definitions\",t.schemaMap(i,a,\"definitions\"));break;case\"prefixItems\":o=i;break;case\"items\":s=i;break;case\"dependentRequired\":case\"dependentSchemas\":case\"minContains\":case\"maxContains\":break;case\"$dynamicRef\":case\"$dynamicAnchor\":case\"$vocabulary\":case\"unevaluatedProperties\":case\"unevaluatedItems\":Jc(a,\"Draft-07\",\"the target dialect has no equivalent\");case\"required\":if(Array.isArray(i)&&i.length===0)break;N(r,a,i);break;default:N(r,a,i)}}if(N8(r,o,s,t),Object.hasOwn(e,\"contains\")){let a=e.minContains,i=e.maxContains;(a!==void 0&&a!==1||i!==void 0)&&Jc(\"minContains/maxContains\",\"Draft-07\",\"contains cardinality cannot be represented\"),Object.hasOwn(e,\"minContains\")&&N(r,\"minContains\",a)}else Object.hasOwn(e,\"minContains\")&&N(r,\"minContains\",e.minContains),Object.hasOwn(e,\"maxContains\")&&N(r,\"maxContains\",e.maxContains);return L8(e,r,t,\"draft-07\"),B8(e,r,\"$id\",\"Draft-07\"),D8(r,n,t),r}function N8(e,t,r,n){if(t===void 0){r!==void 0&&N(e,\"items\",n.schema(r,\"items\"));return}N(e,\"items\",n.schemaArray(t,\"prefixItems\",\"items\")),r!==void 0&&N(e,\"additionalItems\",n.schema(r,\"items\",\"additionalItems\"))}function D8(e,t,r){if(t!==void 0)if(typeof t==\"string\"&&Object.keys(e).length>0){let n={};r.reference(n,t),$8(e,n)}else r.reference(e,t)}function L8(e,t,r,n){let o=hr(e.dependentRequired)?e.dependentRequired:void 0,s=hr(e.dependentSchemas)?e.dependentSchemas:void 0;if(o===void 0&&s===void 0)return;let a={},i=new Set([...Object.keys(o??{}),...Object.keys(s??{})]);for(let c of i){let u=o?.[c],f=s?.[c],p=n===\"draft-04\"&&Array.isArray(u)&&u.length===0;f===void 0?p||N(a,c,u):u===void 0||p?N(a,c,r.schemaAt(f,[\"dependentSchemas\",c],[\"dependencies\",c])):N(a,c,{allOf:[r.schemaAt(f,[\"dependentSchemas\",c],[\"dependencies\",c,\"allOf\",\"0\"]),{required:u}]})}Object.keys(a).length>0&&N(t,\"dependencies\",a)}function $8(e,t){Array.isArray(e.allOf)?e.allOf.push(t):N(e,\"allOf\",[t])}function B8(e,t,r,n){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&N(t,r,o);return}(typeof s!=\"string\"||!_8.test(s))&&Jc(\"$anchor\",n,\"the anchor is not valid\"),R8.test(s)||Jc(\"$anchor\",n,\"the anchor cannot be represented as a plain-name fragment identifier\"),o===void 0?N(t,r,`#${s}`):Jc(\"$anchor\",n,\"it cannot be combined with the schema $id\")}function $y(e){return Do(Jf(e.ast),{schema:e})}var Jf=si(e=>{let t=j8(e,Jf),r=e.context;return t===e||r===void 0?t:Vd(t,pk(r))});function pk(e){return e.constructorDefault===void 0?e:new Po(e.isOptional,e.isMutable,void 0,e.annotations)}function z1(e){if(e.propertySignatures.some(t=>typeof t.name!=\"string\"))throw new globalThis.Error(\"Objects property names must be strings\",{cause:e})}function j1(e){return t=>{let r=[...t].sort((o,s)=>e(xn(o))-e(xn(s)));return r.some((o,s)=>o!==t[s])?r:t}}var z8=j1(e=>{switch(e._tag){case\"BigInt\":case\"Symbol\":case\"UniqueSymbol\":return 0;default:return 1}});function j8(e,t){switch(e._tag){case\"Declaration\":{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!qt(r))return Ge(e,[Ty]);let n=e.typeParameters.map(s=>Do(xn(s))),o=r(n);return o===void 0?e:Ge(e,[Hc(o,t)])}case\"Unknown\":return Ge(e,[Ty]);case\"ObjectKeyword\":return Ge(e,[JC]);case\"Undefined\":case\"Void\":case\"Literal\":case\"Number\":return e.toCodecJson();case\"UniqueSymbol\":case\"Symbol\":case\"BigInt\":return e.toCodecStringTree();case\"Objects\":return z1(e),e.recur(t,Zd);case\"Union\":{let r=z8(e.types);return r!==e.types?new Yr(r,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case\"Arrays\":case\"Suspend\":return e.recur(t)}return e}function By(e){return Do(q1(At(e.ast)))}var q1=wn(e=>{let t=q8(e,q1);return t!==e&&e.context!==void 0?Vd(t,pk(e.context)):t});function q8(e,t){switch(e._tag){case\"Declaration\":{let r=e.annotations?.toCodecIso??e.annotations?.toCodec;if(qt(r)){let n=r(e.typeParameters.map(o=>Do(o)));return Ge(e,[Hc(n,t)])}return e}case\"Arrays\":case\"Objects\":case\"Union\":case\"Suspend\":return e.recur(t)}return e}function zy(e){return Do(G1(e.ast),{schema:e})}function H1(e){return Do(K1(e.ast))}var H8=j1(e=>{switch(e._tag){case\"Null\":case\"Boolean\":case\"Number\":case\"BigInt\":case\"Symbol\":case\"UniqueSymbol\":return 0;default:return 1}});function W8(e,t,r){switch(e._tag){case\"Declaration\":{let n=e.typeParameters.map(u=>Do(t(xn(u)))),o=e.annotations?.toCodecStringTree;if(qt(o)){let u=o(n);return u===void 0?e:Ge(e,[Hc(u,t)])}let s=e.annotations?.toCodecJson,a=qt(s)?s(n):void 0,i=a===void 0?e.annotations?.toCodec:void 0,c=a??(qt(i)?i(n):void 0);return c===void 0?r(e):Ge(e,[Hc(c,t)])}case\"Null\":return Ge(e,[J8]);case\"Boolean\":return Ge(e,[G8]);case\"Unknown\":case\"ObjectKeyword\":return Ge(e,[wy]);case\"Enum\":case\"Number\":case\"Literal\":case\"UniqueSymbol\":case\"Symbol\":case\"BigInt\":return e.toCodecStringTree();case\"Objects\":return z1(e),e.recur(t,Zd);case\"Union\":{let n=H8(e.types);return n!==e.types?new Yr(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case\"Arrays\":case\"Suspend\":return e.recur(t)}return e}var J8=new lt(new mn(\"null\"),new ye(Y(()=>null),Y(()=>\"null\"))),G8=new lt(new Yr([new mn(\"true\"),new mn(\"false\")]),new ye(Y(e=>e===\"true\"),ti())),W1=new ye(Y(e=>typeof e==\"string\"?[e]:e),or()),J1=e=>e.transformation===W1,G1=si(e=>{let t=W8(e,G1,r=>{throw new globalThis.Error(\"Missing structural codec for StringTree\",{cause:r})});return t!==e&&e.context!==void 0?Vd(t,pk(e.context)):t},{stopAt:J1}),B1=e=>sr(e)?ai(oo):oo,K1=si(e=>{let t=K8(e);if(ny(t)){let r=aa(new Yr([new Dn(t.isMutable,t.elements.map(B1),t.rest.map(B1)),dn],{mode:\"anyOf\"}),t,W1);return sr(e)?ai(r):r}return t},{stopAt:J1});function K8(e){return e._tag===\"Declaration\"||e._tag===\"Arrays\"||e._tag===\"Objects\"||e._tag===\"Union\"||e._tag===\"Suspend\"?e.recur(K1):e}var ade=globalThis.RegExp;var ca=e=>e.replace(/[/\\\\^$*+?.()|[\\]{}]/g,\"\\\\$&\");function ci(e,t){return t.length>0&&(e+=`\n  at ${ch(t)}`),new Error(e)}function V1(e){return`#/$defs/${ck(e)}`}var V8=new Set([...EN,Pc,...bN]);function am(e,t){if(e===void 0)return;let r={},n=e.title;typeof n==\"string\"&&(r.title=n);let o=e.description,s=e.expected;typeof o==\"string\"?r.description=o:t?.generateDescriptions===!0&&typeof s==\"string\"&&(r.description=s);let a=e.default;Wc(a)&&(r.default=a);let i=e.examples;Array.isArray(i)&&Wc(i)&&(r.examples=i);let c=e.readOnly;typeof c==\"boolean\"&&(r.readOnly=c);let u=e.writeOnly;typeof u==\"boolean\"&&(r.writeOnly=u);let f=e.format;typeof f==\"string\"&&(r.format=f);let p=e.contentEncoding;typeof p==\"string\"&&(r.contentEncoding=p);let d=e.contentMediaType;typeof d==\"string\"&&(r.contentMediaType=d);let m=e.contentSchema;if(Wc(m)&&(r.contentSchema=m),t?.includeAnnotationKey!==void 0)for(let[x,g]of Object.entries(e))V8.has(x)||!t.includeAnnotationKey(x)||Wc(g)&&N(r,x,g);return Object.keys(r).length===0?void 0:r}function Q1(e){let t=e.type===\"number\"||e.type===\"integer\"?e.type:void 0,r=e;if(t!==void 0&&(r={...e},delete r.type),Array.isArray(r.allOf)){let n=[],o=!1;for(let s of r.allOf){let a=Q1(s);a.type!==void 0&&(o=!0,(t===void 0||a.type===\"integer\")&&(t=a.type)),Object.keys(a.schema).length>0&&n.push(a.schema)}if(o){let{allOf:s,...a}=r;r=n.length===0?a:{...a,allOf:n}}}return{type:t,schema:r}}function Z8(e){if(!Array.isArray(e.anyOf)||e.anyOf.length!==2||e.anyOf[0]?.type!==\"number\")return!1;let t=e.anyOf[1];return t?.type===\"string\"&&Array.isArray(t.enum)&&t.enum.length===3&&t.enum.includes(\"NaN\")&&t.enum.includes(\"Infinity\")&&t.enum.includes(\"-Infinity\")}var Y1=\"|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|\";function jy(e,t){return Object.keys(e).every(r=>t.includes(`|${r}|`))}function Z1(e,t){return typeof e.$ref!=\"string\"&&t.every(r=>!Object.hasOwn(e,r))}var hk=\"|title|description|default|examples|readOnly|writeOnly|\",Q8=Y1+hk;function im(e,t,r){if(Object.keys(e).length===0)return t;let n=Object.keys(t);if(n.length===0)return e;let o=e.type===\"number\"||e.type===\"integer\"?e.type:void 0,s=Z8(e);if(o!==void 0||s){let i=Q1(t);if(i.type!==void 0){let c=o===\"integer\"||i.type===\"integer\"?\"integer\":\"number\",u={...e,type:c};s&&delete u.anyOf;let f=Object.keys(i.schema);return f.length===0?u:jy(i.schema,hk)&&Z1(u,f)?{...u,...i.schema}:im(u,i.schema,r)}}if(r&&Z1(e,n))return{...e,...t};let a=Array.isArray(t.allOf)&&n.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...a]}:typeof e.$ref==\"string\"?{allOf:[e,...a]}:{...e,allOf:a}}function mk(e,t=new Set){return typeof e==\"boolean\"?e:t.has(e)?!0:(t.add(e),e.every(r=>mk(r,t)))}function Y8(e){return Array.isArray(e)}function X8(e,t,r,n){let o=new Map,s=new Map,a=new WeakMap,i=new Map,c=new Map,u=Object.keys(r);for(let h of u)x(h,[\"references\",h]);let f=tn(e,(h,I)=>E(h,t[I],[]));for(let[h,I]of i.values())if(!mk(h))for(let C of I)Array.isArray(C.oneOf)&&(C.anyOf=C.oneOf,delete C.oneOf);for(let h of u){let I=r[h],C=y(I);if(C===void 0)continue;let k=o.get(h)[0],z=c.get(C),ce=z?.find(xe=>J(o.get(xe)[0],k));ce===void 0?z===void 0?c.set(C,[h]):z.push(h):s.set(h,ce)}let p=tn(f,g),d={};for(let h of u)s.has(h)||N(d,h,g(o.get(h)[0]));return{dialect:\"draft-2020-12\",schemas:p,definitions:d};function m(h){return Array.isArray(h.oneOf)&&i.get(h.oneOf)?.[1].push(h),h}function x(h,I){if(!Object.hasOwn(r,h))throw ci(`Invalid reference ${h}`,[...I,\"$ref\"]);let C=o.get(h);if(C!==void 0)return C;let k=[{},[]];return o.set(h,k),k[0]=E(r[h],[\"references\",h],k[1]),k}function g(h){return U1(h,I=>{let C=uk(I);if(C===void 0){if(/^#(?:\\/|%2f)/i.test(I))throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(I)}`);return I}if(!C.startsWith(\"/$defs/\"))return I;let k=C.indexOf(\"/\",7),z=s.get(om(C.slice(7,k<0?void 0:k)));return z===void 0?I:I.replace(/^#(?:\\/|%2f).*?(?:\\/|%2f).*?(?=\\/|%2f|$)/i,V1(z))})}function y(h){if(h._tag===\"Reference\")return;let I=h.checks.length===0?h.annotations:h.checks[h.checks.length-1].annotations;return typeof I?.identifier!=\"string\"&&typeof I?.[Pc]==\"string\"?I[Pc]:void 0}function S(h,I,C,k){let z=h.annotations,ce=z?.toJsonSchema;if(ce!==void 0){let et=h.representation?.schemas?.map((_l,Ej)=>E(_l,[...C,\"representation\",\"schemas\",Ej],k))??[],ya=ce({type:I,schemas:et}),st=Y8(ya);st&&k.push(!1);let ar=st?ya[0]:ya,Ar=am(z,n),vs=Ar===void 0?ar:{...ar,...Ar},xi=Ar===void 0?Y1:Q8;return[vs,h._tag===\"Filter\"&&jy(vs,xi)&&(Ar===void 0||jy(Ar,hk))?!0:void 0]}if(h._tag===\"Filter\"){k.push(!1);return}let xe=h.checks.flatMap((et,ya)=>{let st=S(et,I,[...C,\"checks\",ya],k);return st===void 0?[]:[st[0]]});if(xe.length===0)return;let Pe=am(z,n),Ut={allOf:xe};return[Pe===void 0?Ut:{...Ut,...Pe}]}function E(h,I,C){if(h._tag===\"Reference\")return C.push(x(h.$ref,I)[1]),{$ref:V1(h.$ref)};let k=a.get(h);if(k!==void 0)return C.push(k[1]),k[0];let z=[];C.push(z);let ce=U(h,I,z),xe=am(h.annotations,n);xe!==void 0&&(ce={...ce,...xe});for(let Pe=0;Pe<h.checks.length;Pe++){let Ut=typeof ce.type==\"string\"&&eQ(ce.type)?ce.type:void 0,et=S(h.checks[Pe],Ut,[...I,\"checks\",Pe],z);et!==void 0&&(ce=im(ce,...et))}return a.set(h,[ce,z]),m(ce)}function U(h,I,C){switch(h._tag){case\"Any\":case\"Unknown\":return{};case\"ObjectKeyword\":return{anyOf:[{type:\"object\"},{type:\"array\"}]};case\"Void\":case\"Undefined\":case\"Null\":return{type:\"null\"};case\"BigInt\":return{type:\"string\",allOf:[{pattern:\"^-?\\\\d+$\"}]};case\"Symbol\":return{type:\"string\",allOf:[{pattern:\"^Symbol\\\\(([\\\\s\\\\S]*)\\\\)$\"}]};case\"UniqueSymbol\":return globalThis.Symbol.keyFor(h.symbol)===void 0?{not:{}}:{type:\"string\",enum:[globalThis.String(h.symbol)]};case\"Declaration\":return C.push(!1),{};case\"Suspend\":return E(h.thunk,[...I,\"thunk\"],C);case\"Never\":return{not:{}};case\"String\":return{type:\"string\"};case\"Number\":return{anyOf:[{type:\"number\"},{type:\"string\",enum:[\"NaN\",\"Infinity\",\"-Infinity\"]}]};case\"Boolean\":return{type:\"boolean\"};case\"Literal\":{let k=h.literal;return typeof k==\"bigint\"?{type:\"string\",enum:[globalThis.String(k)]}:{type:typeof k,enum:[k]}}case\"Enum\":{let k=h.enums.map(([z,ce],xe)=>{if(typeof ce==\"number\"&&!globalThis.Number.isFinite(ce))throw ci(`Invalid numeric enum value ${globalThis.String(ce)}`,[...I,\"enums\",xe,1]);return{type:typeof ce,enum:[ce],title:z}});return k.length===0?{not:{}}:{anyOf:k}}case\"TemplateLiteral\":return{type:\"string\",pattern:`^${h.parts.map(qy).join(\"\")}$`};case\"Arrays\":{if(h.rest.length>1)throw ci(\"Invalid schema representation document\",[...I,\"rest\"]);let k={type:\"array\"},z=h.elements.length,ce=h.elements.map((xe,Pe)=>{xe.isOptional&&z--;let Ut=E(xe.type,[...I,\"elements\",Pe,\"type\"],C),et=am(xe.annotations,n);return et===void 0?Ut:m(im(Ut,et))});if(ce.length>0?(k.prefixItems=ce,k.maxItems=h.elements.length,z>0&&(k.minItems=z)):k.items=!1,h.rest.length===1){delete k.maxItems;let xe=E(h.rest[0],[...I,\"rest\",0],C);Object.keys(xe).length>0?k.items=xe:delete k.items}return k}case\"Objects\":{if(h.propertySignatures.length===0&&h.indexSignatures.length===0)return{not:{type:\"null\"}};let k={type:\"object\"},z={},ce=[];for(let st=0;st<h.propertySignatures.length;st++){let ar=h.propertySignatures[st];if(typeof ar.name!=\"string\")throw ci(\"Invalid schema representation document\",[...I,\"propertySignatures\",st,\"name\"]);let Ar=ar.name,vs=E(ar.type,[...I,\"propertySignatures\",st,\"type\"],C),xi=am(ar.annotations,n);N(z,Ar,xi===void 0?vs:m(im(vs,xi))),ar.isOptional||ce.push(Ar)}h.propertySignatures.length>0&&(k.properties=z),ce.length>0&&(k.required=ce);let xe={},Pe=[],Ut=[],et=!1;for(let st=0;st<h.indexSignatures.length;st++){let ar=h.indexSignatures[st],Ar=E(ar.type,[...I,\"indexSignatures\",st,\"type\"],C);J(Ar,{not:{}})&&(Ar=!1),Ut.push(Ar);let vs=F(ar.parameter,[...I,\"indexSignatures\",st,\"parameter\"],new Set);if(vs===void 0){et=!0,C.push(!1);continue}if(vs.length===0)Pe.push(Ar);else for(let xi of vs){let _l=xe[xi];N(xe,xi,_l===void 0?Ar:_l===!1||Ar===!1?!1:m(im(_l,Ar)))}}let ya=Object.keys(xe).length>0;if(ya&&(k.patternProperties=xe),et&&n?.onExcessProperty===\"error\"){let st=[];h.propertySignatures.length>0&&st.push({enum:Object.keys(z)});for(let ar=0;ar<h.indexSignatures.length;ar++)st.push(E(h.indexSignatures[ar].parameter,[...I,\"indexSignatures\",ar,\"parameter\"],C));k.propertyNames=st.length===1?st[0]:{anyOf:st},k.additionalProperties=Ut.length===1?Ut[0]:{anyOf:Ut},Pe.length>0&&(k.allOf=Pe.map(ar=>({type:\"object\",additionalProperties:ar})))}else Pe.length===0?k.additionalProperties=et||n?.onExcessProperty!==\"error\":Pe.length===1&&h.propertySignatures.length===0&&!ya?k.additionalProperties=Pe[0]:Pe.length>0&&(k.allOf=Pe.map(st=>({type:\"object\",additionalProperties:st})));return typeof k.additionalProperties==\"object\"&&k.additionalProperties!==null&&Object.keys(k.additionalProperties).length===0&&delete k.additionalProperties,k}case\"Union\":{let k=[],z=h.types.map((xe,Pe)=>E(xe,[...I,\"types\",Pe],k));if(C.push(k),z.length===0)return{not:{}};let ce=h.options?.mode??\"anyOf\";if(ce===\"anyOf\"&&z.length>1){let xe=tQ(z);if(xe!==void 0)return xe}return ce===\"oneOf\"&&i.set(z,[k,[]]),{[ce]:z}}}}function F(h,I,C){switch(h._tag){case\"Reference\":{if(!Object.hasOwn(r,h.$ref))throw ci(`Invalid reference ${h.$ref}`,[...I,\"$ref\"]);if(x(h.$ref,I),C.has(h.$ref))return;let k=new Set(C).add(h.$ref);return F(r[h.$ref],[\"references\",h.$ref],k)}case\"String\":{if(h.checks.length===0)return[];if(h.checks.length!==1||h.checks[0]._tag!==\"Filter\"||h.checks[0].annotations?.toJsonSchema===void 0)return;let k=[],z=E(h,I,k);return mk(k)&&z.type===\"string\"&&typeof z.pattern==\"string\"&&jy(z,\"|type|pattern|title|description|default|examples|readOnly|writeOnly|\")?[z.pattern]:void 0}case\"TemplateLiteral\":return h.checks.length===0?[`^${h.parts.map(qy).join(\"\")}$`]:void 0;case\"Union\":{if(h.types.length===0||h.checks.length>0||h.options?.mode===\"oneOf\")return;let k=[];for(let z=0;z<h.types.length;z++){let ce=F(h.types[z],[...I,\"types\",z],C);if(ce===void 0)return;if(ce.length===0)return[];k.push(...ce)}return k}default:throw ci(\"Invalid schema representation document\",I)}}}function eQ(e){return e===\"string\"||e===\"number\"||e===\"boolean\"||e===\"array\"||e===\"object\"||e===\"null\"||e===\"integer\"}function tQ(e){let t,r=[];for(let n of e){if(Object.keys(n).length!==2||n.type===void 0||!Array.isArray(n.enum)||n.enum.length===0)return;if(t===void 0)t=n.type;else if(n.type!==t)return;for(let s of n.enum){if(r.includes(s))return;r.push(s)}}return{type:t,enum:r}}function qy(e){switch(e._tag){case\"Literal\":return ca(globalThis.String(e.literal));case\"String\":return jC;case\"Number\":return qd;case\"TemplateLiteral\":return e.parts.map(qy).join(\"\");case\"Union\":return`(?:${e.types.map(qy).join(\"|\")})`;default:throw ci(\"Invalid schema representation document\",[])}}function Hy(e,t){let r=X8([e.representation],[[\"representation\"]],e.references,t);return{dialect:r.dialect,schema:r.schemas[0],definitions:r.definitions}}var rQ=({identifier:e})=>e;function Lo(e){return e===void 0?void 0:{annotations:e}}function cm(e,t){let{references:r,representations:n}=nQ([e],t);return{representation:n[0],references:r}}function nQ(e,t){let r={},n=new Map,o=new Set,s=new Map,a=new Set;for(let h of e)m(h);let i=t?.referencePolicy??rQ;for(let h of s.values())for(let I of h.values()){let C=i({ast:I.ast,occurrences:I.occurrences,identifier:I.identifier});if(C!==void 0){let k=C===I.identifier||!C.endsWith(\"_\")?\"_\":\"\";I.reference=u(C,I,k)}else I.isRecursive&&(I.reference=u(`${I.ast._tag}_`,I,\"\"))}return{representations:tn(e,h=>g(h)),references:r};function u(h,I,C=\"_\"){let k=h,z=0;for(;n.has(k);){if(n.get(k)===I)return k;k=`${h}${C}${++z}`}return n.set(k,I),k}function f(h,I,C){let k=I.fallback;return k!==void 0?ZT(h)===k?h:so(h,{[Pc]:k}):C===I.identifier?h:so(h,{identifier:C})}function p(h,I){if(!Object.hasOwn(r,h)&&!o.has(h)){o.add(h);let C=y(I);o.delete(h),N(r,h,C)}return{_tag:\"Reference\",$ref:h}}function d(h){let I=qc(h),C=jc(I),k=Mc(I),z=k===void 0?(I!==h?Mc(h):void 0)??ZT(I):void 0;z!==void 0&&(k=`${z}Encoded`);let ce=s.get(C);ce===void 0&&(ce=new Map,s.set(C,ce));let xe=ce.get(k);return xe===void 0&&(xe={ast:C,identifier:k,fallback:z,occurrences:0,isRecursive:!1,reference:void 0},ce.set(k,xe)),xe}function m(h){let I=d(h),C=I.ast;if(I.occurrences++,a.has(I)){I.isRecursive=!0;return}if(!(I.occurrences>1)){switch(a.add(I),x(C.checks),C._tag){case\"Declaration\":case\"Arrays\":case\"Objects\":case\"Union\":C.recur(k=>(m(k),k));break;case\"TemplateLiteral\":C.parts.forEach(m);break;case\"Suspend\":m(C.thunk());break}a.delete(I)}}function x(h){h?.forEach(I=>{I.annotations?.representation?.schemas?.forEach(C=>m(At(C))),I._tag===\"FilterGroup\"&&x(I.checks)})}function g(h){let I=d(h),C=I.ast,k=I.reference;if(k!==void 0){let z=I.identifier===void 0?C:f(C,I,k);return p(k,z)}return y(C)}function y(h){let I=S(h.checks);switch(h._tag){case\"Declaration\":return{_tag:\"Declaration\",typeParameters:h.typeParameters.map(C=>g(C)),checks:I,...U(h.annotations)};case\"Null\":case\"Undefined\":case\"Void\":case\"Never\":case\"Unknown\":case\"Any\":case\"String\":case\"Boolean\":case\"Number\":case\"BigInt\":case\"Symbol\":case\"ObjectKeyword\":return{_tag:h._tag,checks:I,...Lo(h.annotations)};case\"Literal\":return{_tag:\"Literal\",literal:h.literal,checks:I,...Lo(h.annotations)};case\"UniqueSymbol\":return{_tag:\"UniqueSymbol\",symbol:h.symbol,checks:I,...Lo(h.annotations)};case\"Enum\":return{_tag:\"Enum\",enums:h.enums,checks:I,...Lo(h.annotations)};case\"TemplateLiteral\":return{_tag:\"TemplateLiteral\",parts:h.parts.map(C=>g(C)),checks:I,...Lo(h.annotations)};case\"Arrays\":return{_tag:\"Arrays\",elements:h.elements.map(C=>{let k=qc(C),z=k.context?.annotations;return{isOptional:sr(k),type:g(C),...Lo(z)}}),rest:h.rest.map(C=>g(C)),checks:I,...Lo(h.annotations)};case\"Objects\":return{_tag:\"Objects\",propertySignatures:h.propertySignatures.map(C=>{let k=qc(C.type),z=k.context?.annotations;return{name:C.name,type:g(C.type),isOptional:sr(k),isMutable:$C(k),...Lo(z)}}),indexSignatures:h.indexSignatures.map(C=>({parameter:g(C.parameter),type:g(C.type)})),checks:I,...Lo(h.annotations)};case\"Union\":return{_tag:\"Union\",types:h.types.map(C=>g(C)),...h.options===void 0?{}:{options:h.options},checks:I,...Lo(h.annotations)};case\"Suspend\":return{_tag:\"Suspend\",checks:[],thunk:g(h.thunk()),...Lo(h.annotations)}}}function S(h){return h?.map(E)??[]}function E(h){switch(h._tag){case\"Filter\":return{_tag:\"Filter\",aborted:h.aborted,...F(h.annotations)};case\"FilterGroup\":return{_tag:\"FilterGroup\",checks:tn(h.checks,E),...F(h.annotations)}}}function U(h){if(h===void 0)return;let{representation:I,...C}=h;return{...I===void 0?void 0:{representation:I},...Object.keys(C).length===0?void 0:{annotations:C}}}function F(h){if(h===void 0)return;let{representation:I,...C}=h,k=I===void 0?void 0:I.schemas===void 0?I:{...I,schemas:I.schemas.map(z=>g(At(z)))};return{...k===void 0?void 0:{representation:k},...Object.keys(C).length===0?void 0:{annotations:C}}}}function tD(e){return je(e)?e.value:{issues:[{message:QI(e.cause)}]}}function nD(e,t){let r=Xe(e),n={errors:\"all\",...t?.parseOptions},o=sw(t),s=a=>{let i=new ji(\"sync\"),c=hs(W0(r(a,n),{onFailure:o,onSuccess:f=>({value:f})}),{scheduler:i});c.currentDispatcher?.flush();let u=c.pollUnsafe();return u?tD(u):new Promise(f=>{c.addObserver(p=>{f(tD(p))})})};if(\"~standard\"in e){let a=e;return\"validate\"in a[\"~standard\"]||Object.assign(a[\"~standard\"],{validate:s}),a}return Object.assign(e,{\"~standard\":{version:1,vendor:\"effect\",validate:s}})}function oQ(e){let t=cm(Jf(e));return Hy(t)}function rD(e,t){let r=oQ(e);if(t===\"draft-2020-12\"){let n=r.schema;return Object.keys(r.definitions).length>0&&(n.$defs=r.definitions),n}else if(t===\"draft-07\"){let n=F1(r),o=n.schema;return Object.keys(n.definitions).length>0&&(o.definitions=n.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function oD(e){let t={input(r){return rD(e.ast,r.target)},output(r){return rD(At(e.ast),r.target)}};if(\"~standard\"in e){let r=e;return\"jsonSchema\"in r[\"~standard\"]||Object.assign(r[\"~standard\"],{jsonSchema:t}),r}return Object.assign(e,{\"~standard\":{version:1,vendor:\"effect\",jsonSchema:t}})}function aD(e,t){let r=[];return xk(e,t,\"\",r),r}function xk(e,t,r,n){if(!Object.is(e,t)){if(Array.isArray(e)&&Array.isArray(t)){let o=e.length,s=t.length,a=Math.min(o,s);for(let i=0;i<a;i++)xk(e[i],t[i],`${r}/${i}`,n);for(let i=o-1;i>=s;i--)n.push({op:\"remove\",path:`${r}/${i}`});for(let i=o;i<s;i++)n.push({op:\"add\",path:`${r}/${i}`,value:t[i]});return}if(Wy(e)&&Wy(t)){let o=Object.keys(e),s=Object.keys(t),a=Array.from(new Set([...o,...s])).sort();for(let i of a){let c=`${r}/${ik(i)}`,u=Object.hasOwn(e,i),f=Object.hasOwn(t,i);u&&f?xk(e[i],t[i],c,n):!u&&f?n.push({op:\"add\",path:c,value:t[i]}):n.push({op:\"remove\",path:c})}return}n.push({op:\"replace\",path:r,value:t})}}function iD(e,t){let r=t;for(let n of e)r=iQ(r,n);return r}function Wy(e){return typeof e==\"object\"&&e!==null&&!Array.isArray(e)}function aQ(e){if(e===\"\")return[];if(e.charCodeAt(0)!==47)throw new Error(`Invalid JSON Pointer, it must start with \"/\": ${JSON.stringify(e)}`);return e.split(\"/\").slice(1).map(om)}function cD(e){if(!/^(0|[1-9]\\d*)$/.test(e))throw new Error(`Invalid array index: \"${e}\"`);return Number(e)}function iQ(e,t){if(t.path===\"\"){if(t.op===\"remove\")throw new Error(\"Unsupported operation at the root\");return t.value}let r=cQ(e,t.path);if(r===null)throw new Error(`Cannot ${t.op} at \"${t.path}\" (parent not found or not a container).`);let{lastToken:n,parent:o,stack:s}=r;if(Array.isArray(o)){if(n===\"-\"&&t.op!==\"add\")throw new Error(`\"-\" is not valid for ${t.op} at \"${t.path}\".`);let a=n===\"-\"?o.length:cD(n),i=t.op===\"add\"?o.length:o.length-1;if(a>i)throw new Error(`Array index out of bounds at \"${t.path}\".`);let c=o.slice();return t.op===\"add\"?c.splice(a,0,t.value):t.op===\"remove\"?c.splice(a,1):c[a]=t.value,sD(s,c)}if(Wy(o)){if(t.op!==\"add\"&&!Object.hasOwn(o,n))throw new Error(`Property \"${n}\" does not exist at \"${t.path}\".`);let a={...o};return t.op===\"remove\"?delete a[n]:N(a,n,t.value),sD(s,a)}throw new Error(`Cannot ${t.op} at \"${t.path}\" (parent not found or not a container).`)}function cQ(e,t){let r=aQ(t);if(r.length===0)return null;let n=r[r.length-1],o=[],s=e;for(let a=0;a<r.length-1;a++){let i=r[a];if(Array.isArray(s)){let c=cD(i);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(Wy(s)){if(!Object.hasOwn(s,i))return null;o.push({container:s,token:i}),s=s[i];continue}return null}return{stack:o,parent:s,lastToken:n}}function sD(e,t){let r=t;for(let n=e.length-1;n>=0;n--){let{container:o,token:s}=e[n];if(Array.isArray(o)){let a=o.slice();a[s]=r,r=a}else{let a={...o};N(a,s,r),r=a}}return r}function fD(e){let t=$y(e),r=rm(t),n=tm(t);return{empty:[],diff:(o,s)=>aD(r(o),r(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let a=r(o),i=iD(s,a);return Object.is(i,a)?o:n(i)}}}function lD(e,t){let r=Mc(e.ast)??$g(e.ast),n=XC(zy(e));return o=>n(o).pipe(q(s=>fQ(s,{rootName:r,...t})))}function fQ(e,t){let r=t.rootName??\"root\",n=t.arrayItemName??\"item\",o=t.pretty??!0,s=t.indent??\"  \",a=t.sortKeys??!0,i=new Set,c=[];return f(r,e,0),c.join(o?`\n`:\"\");function u(p,d){c.push(o?s.repeat(p)+d:d)}function f(p,d,m,x){let{attrs:g,safe:y}=Gf.tagInfo(p,x);if(d===void 0)u(m,`<${y}${g}/>`);else if(typeof d==\"string\")u(m,`<${y}${g}>${Gf.escapeText(d)}</${y}>`);else if(typeof d!=\"object\"||d===null)u(m,`<${y}${g}>${Gf.escapeText(L(d))}</${y}>`);else{if(i.has(d))throw new globalThis.Error(\"Cycle detected while serializing to XML.\",{cause:d});i.add(d);try{if(globalThis.Array.isArray(d)){if(d.length===0){u(m,`<${y}${g}/>`);return}u(m,`<${y}${g}>`);for(let U of d)f(n,U,m+1);u(m,`</${y}>`);return}let S=d,E=Object.keys(S);if(a&&E.sort(),E.length===0){u(m,`<${y}${g}/>`);return}u(m,`<${y}${g}>`);for(let U of E)f(Gf.parseTagName(U).safe,S[U],m+1,U);u(m,`</${y}>`)}finally{i.delete(d)}}}}var Gf={escapeText(e){return e.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\")},escapeAttribute(e){return e.replace(/&/g,\"&amp;\").replace(/\"/g,\"&quot;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\")},parseTagName(e){let t=e,r=e;return/^[A-Za-z_]/.test(r)||(r=\"_\"+r),r=r.replace(/[^A-Za-z0-9._-]/g,\"_\"),/^xml/i.test(r)&&(r=\"_\"+r),{safe:r,changed:r!==t}},tagInfo(e,t){let{changed:r,safe:n}=Gf.parseTagName(e),s=r||t&&t!==e?` data-name=\"${Gf.escapeAttribute(t??e)}\"`:\"\";return{safe:n,attrs:s}}};var gk=wn(e=>ui(e));function ui(e){let t=gs(e)?.toEquivalence;if(t)return t(Bc(e)?e.typeParameters.map(ui):[]);switch(e._tag){case\"Never\":return Os();case\"Declaration\":return pQ(e);case\"Null\":case\"Undefined\":case\"Void\":case\"Unknown\":case\"Any\":case\"String\":case\"Number\":case\"Boolean\":case\"BigInt\":case\"Symbol\":case\"Literal\":case\"UniqueSymbol\":case\"ObjectKeyword\":case\"Enum\":case\"TemplateLiteral\":return J;case\"Arrays\":{let r=e.elements.map(ui),n=e.rest.map(ui),[o,...s]=n,a=s.length;return Lt((i,c)=>{if(!Array.isArray(i)||!Array.isArray(c))return!1;let u=i.length;if(u!==c.length)return!1;let f=0;for(;f<Math.min(u,e.elements.length);f++)if(!r[f](i[f],c[f]))return!1;if(n.length>0){for(;f<u-a;f++)if(!o(i[f],c[f]))return!1;for(let p=0;p<a;p++)if(!s[p](i[f+p],c[f+p]))return!1}return!0})}case\"Objects\":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return J;let r=e.propertySignatures.map(o=>ui(o.type)),n=e.indexSignatures.map(o=>ui(o.type));return Lt((o,s)=>{if(!hr(o)||!hr(s))return!1;for(let a=0;a<r.length;a++){let i=e.propertySignatures[a],c=i.name,u=Object.hasOwn(o,c),f=Object.hasOwn(s,c);if(sr(i.type)&&u!==f||u&&f&&!r[a](o[c],s[c]))return!1}for(let a=0;a<n.length;a++){let i=e.indexSignatures[a],c=sa(o,i.parameter),u=sa(s,i.parameter);if(c.length!==u.length)return!1;for(let f=0;f<c.length;f++){let p=c[f];if(!Object.hasOwn(s,p)||!n[a](o[p],s[p]))return!1}}return!0})}case\"Union\":{let r=At(e).types,n=zf(r),o=r.map((s,a)=>[ii(s),ui(e.types[a])]);return Lt((s,a)=>{let i=n(s,!1);for(let c=0;c<i.length;c++){let[u,f]=o[i[c]];if(u(s)&&u(a))return f(s,a)}return!1})}case\"Suspend\":{let r;return Lt((n,o)=>(r??=gk(e.thunk()))(n,o))}}}function pQ(e){let t=e.annotations?.representation;if(t===void 0)return J;switch(t.id){case\"effect/schema/Option\":{let[r]=Gc(e);return(n,o)=>n._tag===o._tag&&(n._tag===\"None\"||r(n.value,o.value))}case\"effect/schema/Result\":{let[r,n]=Gc(e);return(o,s)=>o._tag===s._tag&&(o._tag===\"Success\"?r(o.success,s.success):n(o.failure,s.failure))}case\"effect/schema/CauseReason\":{let[r,n]=Gc(e);return dD(r,n)}case\"effect/schema/Cause\":{let[r,n]=Gc(e);return pD(r,n)}case\"effect/schema/Exit\":{let[r,n,o]=Gc(e),s=pD(n,o);return(a,i)=>a._tag===i._tag&&(a._tag===\"Success\"?r(a.value,i.value):s(a.cause,i.cause))}case\"effect/schema/ReadonlyMap\":{let[r,n]=Gc(e);return ih(r,n)}case\"effect/schema/ReadonlySet\":return Bl(Gc(e)[0]);case\"effect/schema/RegExp\":return(r,n)=>r.source===n.source&&r.flags===n.flags;case\"effect/schema/URL\":return(r,n)=>r.toString()===n.toString();default:return J}}function Gc(e){return e.typeParameters.map(ui)}function dD(e,t){return(r,n)=>{if(r._tag!==n._tag)return!1;switch(r._tag){case\"Fail\":return e(r.error,n.error);case\"Die\":return t(r.defect,n.defect);case\"Interrupt\":return r.fiberId===n.fiberId}}}function pD(e,t){let r=gu(dD(e,t));return(n,o)=>r(n.reasons,o.reasons)}function hD(e,t){return r=>{switch(r._tag){case\"Fail\":return`Fail(${e(r.error)})`;case\"Die\":return`Die(${t(r.defect)})`;case\"Interrupt\":return\"Interrupt\"}}}function mD(e,t){let r=hD(e,t);return n=>`Cause([${n.reasons.map(r).join(\", \")}])`}function xD(e,t){let r=new Map;return n(e);function n(a){let i=r.get(a);return i===void 0&&(i=o(a),r.set(a,i)),i}function o(a){let i=gs(a)?.toFormatter;if(typeof i==\"function\")return i(Bc(a)?a.typeParameters.map(n):[]);if(t?.onBefore){let c=t.onBefore(a,n);if(c!==void 0)return c}return s(a)}function s(a){switch(a._tag){default:return L;case\"Never\":return()=>\"never\";case\"Void\":return()=>\"void\";case\"Declaration\":{let i=a.annotations?.representation;if(i===void 0)return L;let c=a.typeParameters.map(n);switch(i.id){case\"effect/schema/Option\":{let[u]=c;return at({onNone:()=>\"none()\",onSome:f=>`some(${u(f)})`})}case\"effect/schema/Result\":{let[u,f]=c;return tr({onSuccess:p=>`success(${u(p)})`,onFailure:p=>`failure(${f(p)})`})}case\"effect/schema/CauseReason\":return hD(c[0],c[1]);case\"effect/schema/Cause\":return mD(c[0],c[1]);case\"effect/schema/Exit\":{let[u,f,p]=c,d=mD(f,p);return m=>{switch(m._tag){case\"Success\":return`Exit.Success(${u(m.value)})`;case\"Failure\":return`Exit.Failure(${d(m.cause)})`}}}case\"effect/schema/ReadonlyMap\":{let[u,f]=c;return p=>{let d=p.size;if(d===0)return\"ReadonlyMap(0) {}\";let m=globalThis.Array.from(p.entries()).sort().map(([x,g])=>`${u(x)} => ${f(g)}`);return`ReadonlyMap(${d}) { ${m.join(\", \")} }`}}case\"effect/schema/HashMap\":{let[u,f]=c;return p=>{let d=XU(p);if(d===0)return\"HashMap(0) {}\";let m=yd(p).sort().map(([x,g])=>`${u(x)} => ${f(g)}`);return`HashMap(${d}) { ${m.join(\", \")} }`}}case\"effect/schema/ReadonlySet\":{let[u]=c;return f=>{let p=f.size;if(p===0)return\"ReadonlySet(0) {}\";let d=globalThis.Array.from(f.values()).sort().map(m=>`${u(m)}`);return`ReadonlySet(${p}) { ${d.join(\", \")} }`}}case\"effect/schema/HashSet\":{let[u]=c;return f=>{let p=oN(f);if(p===0)return\"HashSet(0) {}\";let d=globalThis.Array.from(f).sort().map(m=>`${u(m)}`);return`HashSet(${p}) { ${d.join(\", \")} }`}}case\"effect/schema/Chunk\":{let[u]=c;return f=>{let p=PU(f);if(p===0)return\"Chunk(0) {}\";let d=globalThis.Array.from(f).sort().map(m=>`${u(m)}`);return`Chunk(${p}) { ${d.join(\", \")} }`}}default:return L}}case\"Arrays\":{let i=a.elements.map(d=>n(d)),c=a.rest.map(n),[u,...f]=c,p=f.length;return d=>{let m=[],x=0;for(;x<i.length;x++)if(d.length<x+1){if(sr(a.elements[x]))continue}else m.push(i[x](d[x]));if(c.length>0){for(;x<d.length-p;x++)m.push(u(d[x]));for(let g=0;g<p;g++)m.push(f[g](d[x+g]))}return\"[\"+m.join(\", \")+\"]\"}}case\"Objects\":{let i=a.propertySignatures.map(u=>n(u.type)),c=a.indexSignatures.map(u=>n(u.type));return a.propertySignatures.length===0&&a.indexSignatures.length===0?L:u=>{let f=[],p=new Set;for(let d=0;d<i.length;d++){let m=a.propertySignatures[d],x=m.name;p.add(x),!(sr(m.type)&&!Object.hasOwn(u,x))&&f.push(`${Yo(x)}: ${i[d](u[x])}`)}for(let d=0;d<c.length;d++){let m=sa(u,a.indexSignatures[d].parameter);for(let x of m)p.has(x)||(p.add(x),f.push(`${Yo(x)}: ${c[d](u[x])}`))}return f.length>0?\"{ \"+f.join(\", \")+\" }\":\"{}\"}}case\"Union\":{let i=At(a).types,c=zf(i),u=i.map((f,p)=>[ii(f),n(a.types[p])]);return f=>{let p=c(f,!1);for(let d=0;d<p.length;d++){let[m,x]=u[p[d]];if(m(f))return x(f)}return L(f)}}case\"Suspend\":{let i;return c=>(i??=n(a.thunk()))(c)}}}}var yk=l(2,(e,t)=>Ek(e,(r,n)=>yD(t,r)?[r,n]:void 0)),bk=l(2,(e,t)=>Ek(e,(r,n)=>yD(t,r)?void 0:[r,n])),gD=l(2,(e,t)=>({...e,...t}));var Sk=l(2,(e,t)=>Ek(e,(r,n)=>[Object.hasOwn(t,r)?t[r]:r,n]));var $r=e=>e;function yD(e,t){return e.some(r=>r===t||typeof r==\"number\"&&String(r)===t)}function Ek(e,t){let r={};for(let n of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;let o=t(n,e[n]);if(o){let[s,a]=o;N(r,s,a)}}return r}function ED(e,t){return $o(Kf(\"Iso\",e,t))}function bD(e,t){return $o(Kf(\"Lens\",e,t))}function Kf(e,t,r){return[{_tag:\"PrimitiveNode\",kind:e,get:t,set:r}]}var hQ={kind:\"Iso\",get:A,set:A},Jy=class{_tag=\"PathNode\";kind=\"Lens\";path;get;set;constructor(t){this.path=t,this.get=r=>{let n=r;for(let o=0;o<t.length;o++)n=n[t[o]];return n},this.set=(r,n)=>{let o=Gy(n),s=o,a=0;for(;a<t.length-1;a++){let i=t[a];N(s,i,Gy(s[i])),s=s[i]}return N(s,t[a],r),o}}},um=class{_tag=\"CheckNode\";kind=\"Prism\";checks;get;set=A;constructor(t){this.checks=t,this.get=r=>qC(t,r)}};function Kc(e,t){if(e.length===0)return t;if(t.length===0)return e;let r=e.slice();for(let n=0;n<t.length;n++){let o=t[n],s=r[r.length-1];s._tag===\"PathNode\"&&o._tag===\"PathNode\"?r[r.length-1]=new Jy([...s.path,...o.path]):s._tag===\"CheckNode\"&&o._tag===\"CheckNode\"?r[r.length-1]=new um([...s.checks,...o.checks]):r.push(o)}return r}function xQ(e,t){return $o(Kf(\"Optional\",e,t))}var Vf=class{node;getResult;replaceResult;constructor(t,r,n){this.node=t,this.getResult=r,this.replaceResult=n}replace(t,r){return Aa(this.replaceResult(t,r),()=>r)}modify(t){return r=>Aa(It(this.getResult(r),n=>this.replaceResult(t(n),r)),()=>r)}compose(t){return $o(Kc(this.node,t.node))}key(t){return $o(Kc(this.node,[new Jy([t])]))}optionalKey(t){return $o(Kc(this.node,Kf(\"Lens\",r=>r[t],(r,n)=>{let o=Gy(n);return r===void 0?Array.isArray(o)&&(typeof t==\"number\"||typeof t==\"string\"&&Lu(t))?o.splice(Number(t),1):delete o[t]:N(o,t,r),o})))}check(...t){return $o(Kc(this.node,[new um(t)]))}refine(t,r){return $o(Kc(this.node,[new um([Gd(t,r)])]))}tag(t){let r=D(new se({expected:`${JSON.stringify(t)} tag`}));return $o(Kc(this.node,Kf(\"Prism\",n=>n._tag===t?P(n):r,A)))}at(t,...r){let n=D(new xt([t],new ys(void 0)));return $o(Kc(this.node,Kf(\"Optional\",o=>Object.hasOwn(o,t)?P(o[t]):n,(o,s)=>{if(Object.hasOwn(s,t)){let a=Gy(s);return N(a,t,o),P(a)}else return n})))}pick(t){return this.compose(bD(yk(t),(r,n)=>({...bk(n,t),...r})))}omit(t){return this.compose(bD(bk(t),(r,n)=>({...yk(n,t),...r})))}notUndefined(){return this.refine(Or,{expected:\"a value other than `undefined`\"})}forEach(t){let r=t(Ky());return xQ(n=>mt(this.getResult(n),o=>{let s=[];for(let a=0;a<o.length;a++){let i=r.getResult(o[a]);ze(i)&&s.push(i.success)}return s}),(n,o)=>It(this.getResult(o),s=>{let a=[];for(let c=0;c<s.length;c++)ze(r.getResult(s[c]))&&a.push(c);if(n.length!==a.length)return D(new se({message:`each: replacement length mismatch: ${n.length} !== ${a.length}`}));let i=s.slice();for(let c=0;c<a.length;c++){let u=a[c],f=r.replaceResult(n[c],s[u]);if(Q(f))return D(new xt([u],f.failure));i[u]=f.success}return this.replaceResult(i,o)}))}modifyAll(t){return r=>Aa(It(this.getResult(r),n=>this.replaceResult(n.map(t),r)),()=>r)}},Tk=class extends Vf{get;set;constructor(t,r,n){super(t,o=>P(r(o)),o=>P(n(o))),this.get=r,this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>this.set(t(this.get(r)))}},wk=class extends Vf{get;constructor(t,r,n){super(t,o=>P(r(o)),(o,s)=>P(n(o,s))),this.get=r,this.replace=n}modify(t){return r=>this.replace(t(this.get(r)),r)}},Ck=class extends Vf{set;constructor(t,r,n){super(t,r,(o,s)=>P(n(o))),this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>Aa(mt(this.getResult(r),n=>this.set(t(n))),()=>r)}};function $o(e){let t=e[0]??hQ;if(e.length>1){let r=e.reduce((n,o)=>bQ(n,o.kind),\"Iso\");t={kind:r,get:gQ(e,r),set:yQ(e,r)}}switch(t.kind){case\"Iso\":return new Tk(e,t.get,t.set);case\"Lens\":return new wk(e,t.get,t.set);case\"Prism\":return new Ck(e,t.get,t.set);case\"Optional\":return new Vf(e,t.get,t.set)}}function Gy(e){if(Array.isArray(e))return e.slice();if(typeof e==\"object\"&&e!==null){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Error(\"Cannot clone object with non-Object constructor or null prototype\");return{...e}}return e}function gQ(e,t){return r=>{for(let n=0;n<e.length;n++){let o=e[n],s=o.get(r);if(kk(o.kind)){if(Q(s))return s;r=s.success}else r=s}return kk(t)?P(r):r}}function yQ(e,t){return SD(t)?r=>{for(let n=e.length-1;n>=0;n--)r=e[n].set(r);return r}:(r,n)=>{let o=e.length,s=new Array(o);for(let a=0;a<o;a++){s[a]=n;let i=e[a];if(kk(i.kind)){let c=i.get(n);if(Q(c))return c;n=c.success}else n=i.get(n)}for(let a=o-1;a>=0;a--){let i=e[a];if(SD(i.kind))r=i.set(r);else if(i.kind===\"Lens\")r=i.set(r,s[a]);else{let c=i.set(r,s[a]);if(Q(c))return c;r=c.success}}return t===\"Optional\"?P(r):r}}function kk(e){return e===\"Prism\"||e===\"Optional\"}function SD(e){return e===\"Iso\"||e===\"Prism\"}function bQ(e,t){return e===\"Iso\"?t:t===\"Iso\"||e===t?e:\"Optional\"}var SQ=$o([]);function Ky(){return SQ}function TD(e){let t=By(e);return ED(rm(t),tm(t))}function wD(e){return Ky()}function CD(e){return Ky()}var Zf=\"~effect/Schema/SchemaError\";function kD(e){return w(e,Zf)&&e[Zf]===Zf}var $n=\"~effect/net/NetAddress\";var Bo=e=>e.value,zo=e=>e,ua=e=>e.bytes,Vc=class extends rn(\"NetAddressError\"){},Qf=e=>w(e,$n),Br=e=>Qf(e)&&e._tag===\"Ipv4Address\",bs=e=>Qf(e)&&e._tag===\"Ipv6Address\",AD=e=>Br(e)||bs(e),Yf=e=>Br(e)?32:128,Xf=e=>Qf(e)&&e._tag===\"MacAddress\",lm=e=>Qf(e)&&e._tag===\"InetAddressV4\",pm=e=>Qf(e)&&e._tag===\"InetAddressV6\",Ak=e=>lm(e)||pm(e),Vy=e=>Qf(e)&&e._tag===\"UnixPathAddress\",vD=e=>Ak(e)||Vy(e),IQ={_tag:\"Ipv4Address\",[$n]:$n,[ie](e){return Br(e)&&Bo(this)===Bo(e)},[ae](){return cr(oe(kQ,Bo(this)|0))},toString(){return jo(this)},toJSON(){return this.toString()},[Ee](){return this.toJSON()}},TQ={_tag:\"Ipv6Address\",[$n]:$n,[ie](e){if(!bs(e))return!1;let t=zo(this),r=zo(e);return t.w0===r.w0&&t.w1===r.w1&&t.w2===r.w2&&t.w3===r.w3},[ae](){let e=zo(this),t=oe(AQ,e.w0|0);return t=oe(t,e.w1|0),t=oe(t,e.w2|0),cr(oe(t,e.w3|0))},toString(){return jo(this)},toJSON(){return this.toString()},[Ee](){return this.toJSON()}},wQ={_tag:\"MacAddress\",[$n]:$n,[ie](e){return Xf(e)&&CQ(ua(this),ua(e))},[ae](){return oe(vQ,xr(ua(this)))},toString(){return Ok(this)},toJSON(){return this.toString()},[Ee](){return this.toJSON()}},CQ=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},kQ=Me(\"Ipv4Address\"),AQ=Me(\"Ipv6Address\"),vQ=Me(\"MacAddress\"),OQ=e=>{let t=Object.create(IQ);return t.value=e>>>0,Object.freeze(t)},_Q=(e,t,r,n)=>{let o=Object.create(TQ);return o.w0=e>>>0,o.w1=t>>>0,o.w2=r>>>0,o.w3=n>>>0,Object.freeze(o)},RQ=(e,t,r,n)=>(e<<24|t<<16|r<<8|n)>>>0;var fm=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],PQ=e=>{let t=Object.assign(Object.create(wQ),{bytes:new Uint8Array(e)});return Object.freeze(t)};var Pt=(e,t)=>D(new Vc({input:e,message:t})),MQ=e=>e.every(t=>Number.isInteger(t)&&t>=0&&t<=255)?P(OQ(RQ(e[0],e[1],e[2],e[3]))):Pt(e,\"octets must be integers from 0 through 255\"),FQ=e=>e.every(t=>Number.isInteger(t)&&t>=0&&t<=65535)?P(_Q(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):Pt(e,\"segments must be integers from 0 through 65535\");var OD=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?P(PQ(new Uint8Array(e.split(\":\").map(t=>Number.parseInt(t,16))))):Pt(e,\"expected six two-digit hexadecimal octets separated by colons\");var el=e=>{let t=e.split(\".\");if(t.length!==4||t.some(n=>!/^\\d{1,3}$/.test(n)))return Pt(e,\"expected exactly four decimal octets\");if(t.some(n=>n.length>1&&n[0]===\"0\"))return Pt(e,\"leading zeroes are not allowed\");let r=t.map(Number);return r.some(n=>n>255)?Pt(e,\"octets must be at most 255\"):MQ([r[0],r[1],r[2],r[3]])},UQ=e=>{if(e.includes(\"[\")||e.includes(\"]\")||e.includes(\"%\"))return Pt(e,\"brackets and zone identifiers are not valid in a bare IPv6 address\");let t=e.split(\"::\");if(t.length>2)return Pt(e,\"only one compression marker is allowed\");let r=t[0]===\"\"?[]:t[0].split(\":\"),n=t.length===2&&t[1]!==\"\"?t[1].split(\":\"):[];if(r.some(f=>f===\"\")||n.some(f=>f===\"\"))return Pt(e,\"empty segments are only valid in the compression marker\");let o=n.length>0?n[n.length-1]:r.length>0?r[r.length-1]:\"\",s;if(o.includes(\".\")){if(t.length===2&&n.length===0)return Pt(e,\"embedded IPv4 syntax must be trailing\");let f=mt(el(o),p=>{let d=Bo(p);return[d>>>16,d&65535]});if(Q(f))return f;s=f.success,n.length>0?n.pop():r.pop()}let a=r.length+n.length+(s?2:0);if(t.length===1?a!==8:a>=8)return Pt(e,t.length===1?\"expected eight segments\":\"compression must replace at least one segment\");let i=f=>/^[0-9a-fA-F]{1,4}$/.test(f)?Number.parseInt(f,16):void 0,c=r.map(i),u=n.map(i);return c.some(f=>f===void 0)||u.some(f=>f===void 0)?Pt(e,\"segments must contain one through four hexadecimal digits\"):P([...c,...Array(8-a).fill(0),...u,...s??[]])},dm=e=>It(UQ(e),t=>FQ(t)),mm=e=>e.includes(\":\")?dm(e):el(e);var vk=e=>fm(Bo(e)),NQ=e=>{let{w0:t,w1:r,w2:n,w3:o}=zo(e);return[t>>>16,t&65535,r>>>16,r&65535,n>>>16,n&65535,o>>>16,o&65535]},_D=e=>{let{w0:t,w1:r,w2:n,w3:o}=zo(e);return[...fm(t),...fm(r),...fm(n),...fm(o)]};var Ok=e=>Array.from(ua(e),t=>t.toString(16).padStart(2,\"0\")).join(\":\"),Zy=e=>ua(e).every(t=>t===255),DQ=e=>(ua(e)[0]&1)!==0,Qy=e=>(ua(e)[0]&1)===0,_k=e=>(ua(e)[0]&2)!==0,Rk=e=>(ua(e)[0]&2)===0;var jo=e=>{if(Br(e))return vk(e).join(\".\");let t=NQ(e);if(LQ(e))return`::ffff:${t[6]>>8}.${t[6]&255}.${t[7]>>8}.${t[7]&255}`;let r=-1,n=0,o=-1;for(let i=0;i<=8;i++)i<8&&t[i]===0?o===-1&&(o=i):o!==-1&&(i-o>n&&(r=o,n=i-o),o=-1);if(n<2)return t.map(i=>i.toString(16)).join(\":\");let s=t.slice(0,r).map(i=>i.toString(16)).join(\":\"),a=t.slice(r+n).map(i=>i.toString(16)).join(\":\");return`${s}::${a}`},Yy=e=>{if(Br(e))return Bo(e)===0;let{w0:t,w1:r,w2:n,w3:o}=zo(e);return t===0&&r===0&&n===0&&o===0},Pk=e=>{if(Br(e))return Bo(e)>>>24===127;let{w0:t,w1:r,w2:n,w3:o}=zo(e);return t===0&&r===0&&n===0&&o===1},tl=e=>Xf(e)?DQ(e):Br(e)?Bo(e)>>>28===14:zo(e).w0>>>24===255,Xy=e=>Xf(e)?Zy(e):Bo(e)===4294967295,Mk=e=>Xf(e)?Qy(e):!tl(e)&&!Yy(e)&&(!Br(e)||!Xy(e)),Fk=e=>Br(e)?Bo(e)>>>16===43518:(zo(e).w0>>>16&65472)===65152,Uk=e=>{let t=Bo(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},Nk=e=>(zo(e).w0>>>24&254)===252,LQ=e=>{let{w0:t,w1:r,w2:n}=zo(e);return t===0&&r===0&&n===65535};var $Q={_tag:\"InetAddressV4\",[$n]:$n,[ie](e){return lm(e)&&this.port===e.port&&J(this.address,e.address)},[ae](){return oe(H(this.address),Dt(this.port))},toString(){return eb(this)},toJSON(){return this.toString()},[Ee](){return this.toJSON()}},BQ={_tag:\"InetAddressV6\",[$n]:$n,[ie](e){return pm(e)&&this.port===e.port&&this.scopeId===e.scopeId&&J(this.address,e.address)},[ae](){return oe(oe(H(this.address),Dt(this.port)),Dt(this.scopeId))},toString(){return eb(this)},toJSON(){return this.toString()},[Ee](){return this.toJSON()}},RD=e=>Number.isInteger(e)&&e>=0&&e<=65535,zQ=(e,t)=>{if(!RD(t))return Pt(e,\"port must be an integer from 0 through 65535\");let r=Object.create($Q);return r.address=e,r.port=t,P(Object.freeze(r))},jQ=(e,t,r)=>{if(!RD(t))return Pt(e,\"port must be an integer from 0 through 65535\");let n=r?.scopeId??0;if(!Number.isInteger(n)||n<0||n>4294967295)return Pt(e,\"scopeId must be an unsigned 32-bit integer\");let o=Object.create(BQ);return o.address=e,o.port=t,o.scopeId=n,P(Object.freeze(o))};var PD=e=>{let t,r,n=0,o=e.startsWith(\"[\");if(o){let s=e.indexOf(\"]\");if(s<0||e[s+1]!==\":\"||e.indexOf(\"]\",s+1)!==-1)return Pt(e,\"expected [IPv6]:port\");t=e.slice(1,s),r=e.slice(s+2);let a=t.indexOf(\"%\");if(a!==-1){let i=t.slice(a+1);if(t.indexOf(\"%\",a+1)!==-1||!/^\\d+$/.test(i))return Pt(e,\"scope identifier must be decimal\");if(n=Number(i),!Number.isInteger(n)||n>4294967295)return Pt(e,\"scope identifier must be an unsigned 32-bit integer\");t=t.slice(0,a)}}else{let s=e.lastIndexOf(\":\");if(s<0)return Pt(e,\"expected host:port or [IPv6]:port\");if(e.indexOf(\":\")!==s)return Pt(e,\"IPv6 addresses must be bracketed\");t=e.slice(0,s),r=e.slice(s+1)}return/^(0|[1-9]\\d*)$/.test(r)?It(mm(t),s=>o!==bs(s)?Pt(e,\"only IPv6 addresses use brackets\"):bs(s)?jQ(s,Number(r),{scopeId:n}):zQ(s,Number(r))):Pt(e,\"port must be an unpadded decimal integer\")};var qQ=e=>jo(e.address)+(pm(e)&&e.scopeId!==0?`%${e.scopeId}`:\"\");var eb=e=>{let t=qQ(e);return lm(e)?`${t}:${e.port}`:`[${t}]:${e.port}`};var HQ={_tag:\"UnixPathAddress\",[$n]:$n,[ie](e){return Vy(e)&&this.path===e.path},[ae](){return oe(Me(\"UnixPathAddress\"),Me(this.path))},toString(){return this.path},toJSON(){return this.toString()},[Ee](){return this.toJSON()}},MD=e=>{let t=Object.create(HQ);return t.path=e,Object.freeze(t)};var Lk=\"~effect/net/IpInterface\",FD=e=>hm(e)&&Br(e.address),UD=e=>hm(e)&&bs(e.address),hm=e=>w(e,Lk),WQ={_tag:\"IpInterface\",[Lk]:Lk,[ie](e){return hm(e)&&this.prefixLength===e.prefixLength&&J(this.address,e.address)},[ae](){return oe(H(this.address),Dt(this.prefixLength))},toString(){return gm(this)},toJSON(){return this.toString()},[Ee](){return this.toJSON()}},$k=(e,t)=>D(new Vc({input:e,message:t})),xm=(e,t)=>{let r=Yf(e);if(!Number.isInteger(t)||t<0||t>r)return $k(e,`prefix length must be an integer from 0 through ${r}`);let n=Object.assign(Object.create(WQ),{address:e,prefixLength:t});return P(Object.freeze(n))},Bk=(e,t)=>{let r=e.indexOf(\"/\");if(r===-1&&t?.prefix!==\"required\")return P({address:e,prefixLength:void 0});if(r<=0||r!==e.lastIndexOf(\"/\")||r===e.length-1)return $k(e,\"expected an address and prefix length separated by one slash\");let n=e.slice(r+1);return/^(0|[1-9][0-9]*)$/.test(n)?P({address:e.slice(0,r),prefixLength:Number(n)}):$k(e,\"prefix length must be an unpadded ASCII decimal integer\")},tb=(e,t)=>It(Bk(e,t),r=>It(el(r.address),n=>xm(n,r.prefixLength??Yf(n)))),rb=(e,t)=>It(Bk(e,t),r=>It(dm(r.address),n=>xm(n,r.prefixLength??Yf(n)))),nb=(e,t)=>It(Bk(e,t),r=>It(mm(r.address),n=>xm(n,r.prefixLength??Yf(n))));var gm=e=>`${jo(e.address)}/${e.prefixLength}`;var zk=\"~effect/net/IpNetwork\",DD=e=>ym(e)&&Br(e.address),LD=e=>ym(e)&&bs(e.address),ym=e=>w(e,zk),JQ={_tag:\"IpNetwork\",[zk]:zk,[ie](e){return ym(e)&&this.prefixLength===e.prefixLength&&J(this.address,e.address)},[ae](){return oe(H(this.address),Dt(this.prefixLength))},toString(){return bm(this)},toJSON(){return this.toString()},[Ee](){return this.toJSON()}},GQ=e=>{let t=Object.assign(Object.create(JQ),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},KQ=e=>Br(e)?vk(e):_D(e);var VQ=(e,t)=>{let r=Math.floor(t/8),n=t%8;return e.map((o,s)=>s<r?o:s===r&&n!==0?o&(255<<8-n&255):0)},jk=(e,t)=>It(xm(e,t),r=>{let n=KQ(e),o=VQ(n,t);return n.some((s,a)=>s!==o[a])?D(new Vc({input:e,message:\"address has non-zero host bits\"})):P(GQ(r))});var $D=e=>It(tb(e,{prefix:\"required\"}),t=>jk(t.address,t.prefixLength)),BD=e=>It(rb(e,{prefix:\"required\"}),t=>jk(t.address,t.prefixLength)),zD=e=>It(nb(e,{prefix:\"required\"}),t=>jk(t.address,t.prefixLength));var bm=e=>`${jo(e.address)}/${e.prefixLength}`;var Sm=Ly;function yn(){return(e,t,r)=>G(new zc(e.map(Bf),n=>t(n.map(o=>G(o))),r))}function He(e,t){return yn()([],()=>(r,n,o)=>e(r)?b(r):M(new gt(n,r,o)),t)}function QQ(e){return e}function YQ(e){return t=>t.annotate(e)}function XQ(e){return t=>qk(qk(t).annotate(e))}function eY(e){return t=>t.rebuild(qf(t.ast,e))}function tY(e){return e}var fa=class extends rn(\"SchemaError\"){[Zf]=Zf;constructor(t){let r=jn();_r(0);try{super({issue:t})}finally{_r(r)}}get message(){return cw(this.issue)}toString(){return`SchemaError(${this.message})`}};function t2(e){return kD(e)}function r2(e){return Be(e)?Kk(e):_t(e,t=>Ys(()=>Vs(t,r=>new fa(r))))}function Kk(e){return je(e)?e:sn(Vs(e.cause,t=>new fa(t)))}function n2(e,t){let r;for(let n of e.reasons){if(!jp(n)||!t2(n.error))throw new globalThis.Error(t,{cause:e});r??=n.error}if(r===void 0)throw new globalThis.Error(t,{cause:e});return r}function o2(e){return Sc(e).then(t=>{if(je(t))return t.value;throw n2(t.cause,\"Promise adapter can only reject schema errors\")})}function s2(e){let t=ro(e);if(je(t))return t.value;throw n2(t.cause,\"Sync adapter can only throw schema errors\")}function rY(e,t){return nD(e,t)}function nY(e){return oD(e)}var oY=Ry,sY=QC;function ob(e,t){let r=Xe(e,t);return(n,o)=>r2(r(n,o))}var Vk=ob;function a2(e,t){let r=Py(e,t);return(n,o)=>Kk(r(n,o))}var aY=a2,iY=My,cY=YC;function i2(e,t){let r=Fy(e,t);return(n,o)=>cp(r(n,o),s=>new fa(s))}var uY=i2;function c2(e,t){let r=ob(e,t);return(n,o)=>o2(r(n,o))}var fY=c2;function u2(e,t){let r=ob(e,t);return(n,o)=>s2(r(n,o))}var lY=u2;function sb(e,t){let r=ia(e,t);return(n,o)=>r2(r(n,o))}var f2=sb;function l2(e,t){let r=Uy(e,t);return(n,o)=>Kk(r(n,o))}var pY=l2,dY=Ny,mY=ek;function p2(e,t){let r=Dy(e,t);return(n,o)=>cp(r(n,o),s=>new fa(s))}var hY=p2;function d2(e,t){let r=sb(e,t);return(n,o)=>o2(r(n,o))}var xY=d2;function m2(e,t){let r=sb(e,t);return(n,o)=>s2(r(n,o))}var gY=m2,G=Do;function ab(e){return w(e,Sm)&&e[Sm]===Sm}var Qc=$r(e=>G(ai(e.ast),{schema:e})),yY=$r(e=>e.schema),sl=$r(e=>{let t=ub(e);return G(NC(e.ast),{schema:t})}),bY=$r(e=>e.schema.members[0]),SY=$r(e=>G(xy(e.ast),{schema:e})),EY=$r(e=>e.schema),bn=$r(e=>G(At(e.ast),{schema:e})),al=$r(e=>G(xn(e.ast),{schema:e})),Em=\"~effect/Schema/flip\";function IY(e){return w(e,Em)&&e[Em]===Em}function qk(e){return IY(e)?e.schema.rebuild(hn(e.ast)):G(hn(e.ast),{[Em]:Em,schema:e})}function Qt(e){let t=G(new mn(e),{literal:e,transform(r){return t.pipe(ee(Qt(r),{decode:Y(()=>r),encode:Y(()=>e)}))}});return t}function h2(e){return e.map(t=>ab(t)?t.ast:new mn(t))}function TY(e){return G(new iy(h2(e)),{parts:e})}function wY(e){return G(SC(h2(e)),{parts:e})}function CY(e){return G(new bC(Object.keys(e).filter(t=>typeof e[e[t]]!=\"number\").map(t=>[t,e[t]])),{enums:e})}var kY=G(ay),AY=G(gC),Im=G(oo),ib=G(oy),Zk=G(sy),X=G(dn),vY=X,il=G(cy),Qk=G(IC),x2=G(TC),cl=G(wC),OY=G(xC),_Y=G(yC);function RY(e){return G(new EC(e))}function Yk(e,t){return G(e,{fields:t,mapFields(r,n){let o=r(this.fields);return Yk(Hd(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Ue(e){return Yk(Hd(e,void 0),e)}function PY(e){return $r(t=>t.mapFields(gD(e)))}var MY=e=>typeof e==\"symbol\"?e:globalThis.String(e);function FY(e){return function(t){let r={},n=Object.create(null),o=Object.create(null),s=new Set;for(let a of Reflect.ownKeys(t.fields)){let i=al(t.fields[a]),c=Object.hasOwn(e,a),u=c?e[a]:a,f=MY(u);if(s.has(f))throw new globalThis.Error(`Duplicate encoded keys: ${Yo(u)}`);s.add(f),N(r,u,i),c&&(n[a]=u,o[u]=a)}return Ue(r).pipe(ee(t,ve({decode:Sk(o),encode:Sk(n)})))}}function UY(e,t){return r=>{let n=Du(r.fields,bn),o=Ue({...n,...e});return r.pipe(ee(o,ve({decode:s=>{let a={...s};for(let i in e){let c=t[i],u=c(s);Oe(u)&&N(a,i,u.value)}return a},encode:s=>{let a={...s};for(let i in e)delete a[i];return a}})))}}function la(e,t){return G(LC(e.ast,t.ast),{key:e,value:t})}function NY(e,t){return G(kC(e.ast,t.map(Bf)),{schema:e,records:t})}function g2(e,t){return G(e,{elements:t,mapElements(r,n){let o=r(this.elements);return g2(ly(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Ss(e){return g2(ly(e),e)}function DY(e,t){return G(AC(e.ast,t.map(Bf)),{schema:e,rest:t})}var qe=$r(e=>G(new Dn(!1,[],[e.ast]),{value:e}));function cb(e,t,r){return t!==void 0&&r!==void 0?e.check(oA(t,r)):t!==void 0?e.check(D2(t)):r!==void 0?e.check(B2(r)):e}var Tm=$r(e=>G(new Dn(!1,[e.ast],[e.ast]),{value:e}));function LY(e){let t=qe(e),r=qe(bn(e)),n=ee(Ss([Im]),ve({decode:o=>[o],encode:([o])=>o}))(e);return G(yt([n,t]).pipe(ee(r)).ast,{from:yt([e,t]),to:r})}function $Y(e){return qe(e).check(aA())}var BY=$r(e=>G(vC(e.ast),{schema:e}));function y2(e,t){return G(e,{members:t,mapMembers(r,n){let o=r(this.members);return y2(Wd(o,this.ast.options,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function yt(e,t){return y2(Wd(e,t,void 0),e)}function Es(e){let t=e.map(Qt);return G(Wd(t,void 0,void 0),{literals:e,members:t,mapMembers(r){return yt(r(this.members))},pick(r){return Es(r)},transform(r){return yt(t.map((n,o)=>n.transform(r[o])))}})}var Xk=$r(e=>yt([e,ib])),ub=$r(e=>yt([e,Zk])),b2=$r(e=>yt([e,ib,Zk]));function S2(e){return G(new py(()=>e().ast))}function zY(...e){return t=>t.check(...e)}function E2(e,t){return r=>G(Fo(r.ast,[Gd(e,t)]),{schema:r})}function I2(e){return t=>G(t.ast,{schema:t,identifier:e})}function jY(e,t){return r=>(t.checks?r.check(...t.checks):r).pipe(I2(e))}function T2(e){return t=>G(MC(t.ast,new Dd(e,A)),{schema:t})}function w2(e){return t=>G(FC(t.ast,new Dd(A,e)),{schema:t})}function qY(e){return C2(e)}function C2(e){return t=>T2(vf(e))(t)}function HY(e){return k2(e)}function k2(e){return t=>w2(vf(e))(t)}function ee(e,t){return r=>G(aa(r.ast,e.ast,t?Ld(t):Uc()),{from:r,to:e})}function ul(){return(e,t)=>Re()(e,{decode:t,encode:lw})}var A2=Es([\"true\",\"yes\",\"on\",\"1\",\"y\"]),v2=Es([\"false\",\"no\",\"off\",\"0\",\"n\"]),eA=Es([...A2.literals,...v2.literals]).pipe(ee(Qk,ve({decode:e=>e===\"true\"||e===\"yes\"||e===\"on\"||e===\"1\"||e===\"y\",encode:e=>e?\"true\":\"false\"})));function WY(e){return t=>ee(bn(t),e)(t)}function tA(e,t){return r=>t?ee(r,t)(e):ee(r)(e)}function JY(e){return t=>ee(t,e)(al(t))}function O2(e){return t=>G(DC(t.ast,e),{schema:t})}function _2(e){return _t(e,t=>Ys(()=>Vs(t,r=>r.issue)))}function rA(e,t){let r=t?.encodingStrategy===\"omit\"?Wg():or();return n=>Qc(al(n)).pipe(ee(n,{decode:Jg(_2(e)),encode:r}))}function GY(e,t){return r=>bn(r).pipe(rA(e,t),tA(Qc(r)))}function R2(e,t){let r=t?.encodingStrategy===\"omit\"?Wg():or();return n=>sl(al(n)).pipe(ee(n,{decode:Jg(_2(e)),encode:r}))}function KY(e,t){return r=>bn(r).pipe(R2(e,t),tA(sl(r)))}function Yc(e){return Qt(e).pipe(O2(b(e)))}function VY(e){return Yc(e).pipe(rA(b(e),{encodingStrategy:\"omit\"}))}function fb(e,t){return Ue({_tag:Yc(e),...t})}function P2(e){return t=>{let r={},n=[],o=new Set,s={},a=f=>p=>f.includes(p[e]);return i(t),Object.assign(t,{cases:r,discriminants:n,isAnyOf:a,guards:s,match:c,matchOrElse:u});function i(f){let p=f.ast;if(mC(p)&&\"members\"in f&&globalThis.Array.isArray(f.members)&&f.members.every(ab))return f.members.forEach(i);let d=Lc(p);if(d.length>0){let m=d.find(x=>x.key===e)?.literal;if(Nl(m)){let x=typeof m==\"number\"?globalThis.String(m):m;if(o.has(x))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);o.add(x),n.push(m),N(r,m,f),N(s,m,Ry(bn(f)));return}}throw new globalThis.Error(\"No literal or unique symbol found\")}function c(){if(arguments.length===1){let x=arguments[0];return function(g){let y=g[e];return(Object.hasOwn(x,y)?x[y]:void 0)(g)}}let f=arguments[0],p=arguments[1],d=f[e];return(Object.hasOwn(p,d)?p[d]:void 0)(f)}function u(){if(arguments.length===2){let g=arguments[0],y=arguments[1];return function(S){let E=S[e];return(Object.hasOwn(g,E)?g[E]??y:y)(S)}}let f=arguments[0],p=arguments[1],d=arguments[2],m=f[e];return(Object.hasOwn(p,m)?p[m]??d:d)(f)}}}function ZY(e){let t={},r=[];for(let c of Object.keys(e)){let u=fb(c,e[c]);N(t,c,u),r.push(u)}let n=yt(r),{guards:o,isAnyOf:s,match:a,matchOrElse:i}=P2(\"_tag\")(n);return G(n.ast,{cases:t,isAnyOf:s,guards:o,match:a,matchOrElse:i})}function QY(){return e=>e}function fi(e,t){return He(r=>r instanceof e,t)}function Re(){return(e,t)=>new lt(e.ast,Ld(t))}var Le=Jd;function YY(e,t=void 0){return new ri(e,t)}var jD=\"^\\\\S[\\\\s\\\\S]*\\\\S$|^\\\\S$|^$\";function M2(e){let t=new globalThis.RegExp(jD);return Le(r=>r.trim()===r,{expected:\"a string with no leading or trailing whitespace\",representation:{id:\"effect/schema/isTrimmed\",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:\"Schema.isTrimmed()\"}),arbitraryConstraint:{patterns:[{source:jD,flags:\"\"}]},...e})}function fl(e,t){let r=e.source,n=e.flags,o=/^[dg]*uy?$/.test(n),s=n===\"\"?`new RegExp(${L(r)})`:`new RegExp(${L(r)}, ${L(n)})`;return jf(e,{toJsonSchema:()=>o?{pattern:n.endsWith(\"y\")?`^(?:${r})`:r}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${s})`}),...t})}function XY(e){return by({toCode:()=>({runtime:\"Schema.isStringFinite()\"}),...e})}function e9(e){return Sy({toCode:()=>({runtime:\"Schema.isStringBigInt()\"}),...e})}function t9(e){return Iy({toCode:()=>({runtime:\"Schema.isStringSymbol()\"}),...e})}var r9=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;function n9(e,t){let r=r9(e);return fl(r,{expected:e?`a UUID v${e}`:\"a UUID\",representation:{id:\"effect/schema/isUUID\",payload:{version:e??null}},toJsonSchema:()=>({pattern:r.source,format:\"uuid\"}),toCode:()=>({runtime:e===void 0?\"Schema.isUUID()\":`Schema.isUUID(${e})`}),...t})}var qD=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;function o9(e){return fl(qD,{expected:\"a GUID\",representation:{id:\"effect/schema/isGUID\",payload:null},toJsonSchema:()=>({pattern:qD.source}),toCode:()=>({runtime:\"Schema.isGUID()\"}),...e})}function s9(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return fl(t,{representation:{id:\"effect/schema/isULID\",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:\"Schema.isULID()\"}),...e})}function F2(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return fl(t,{expected:\"a base64 encoded string\",representation:{id:\"effect/schema/isBase64\",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:\"Schema.isBase64()\"}),...e})}function a9(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return fl(t,{expected:\"a base64url encoded string\",representation:{id:\"effect/schema/isBase64Url\",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:\"Schema.isBase64Url()\"}),...e})}function nA(e,t,r){if(e.length===0)return t.length===0?{}:[{},!0];let n={pattern:new globalThis.RegExp(r).source};return e===t?n:[n,!0]}function i9(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`^${ca(e)}`),o=e.replace(/[\\uD800-\\uDBFF]$/,\"\");return Le(s=>s.startsWith(e),{expected:`a string starting with ${r}`,representation:{id:\"effect/schema/isStartingWith\",payload:{startsWith:e}},toJsonSchema:()=>nA(o,e,`^${ca(o)}`),toCode:()=>({runtime:`Schema.isStartingWith(${L(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function c9(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`${ca(e)}$`),o=e.replace(/^[\\uDC00-\\uDFFF]/,\"\");return Le(s=>s.endsWith(e),{expected:`a string ending with ${r}`,representation:{id:\"effect/schema/isEndingWith\",payload:{endsWith:e}},toJsonSchema:()=>nA(o,e,`${ca(o)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${L(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function u9(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(ca(e)),o=e.replace(/^[\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF]$/g,\"\");return Le(s=>s.includes(e),{expected:`a string including ${r}`,representation:{id:\"effect/schema/isIncluding\",payload:{includes:e}},toJsonSchema:()=>nA(o,e,ca(o)),toCode:()=>({runtime:`Schema.isIncluding(${L(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}var HD=\"^[^a-z]*$\";function f9(e){let t=new globalThis.RegExp(HD);return Le(r=>r.toUpperCase()===r,{expected:\"a string with all characters in uppercase\",representation:{id:\"effect/schema/isUppercased\",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:\"Schema.isUppercased()\"}),arbitraryConstraint:{patterns:[{source:HD,flags:\"\"}]},...e})}var WD=\"^[^A-Z]*$\";function l9(e){let t=new globalThis.RegExp(WD);return Le(r=>r.toLowerCase()===r,{expected:\"a string with all characters in lowercase\",representation:{id:\"effect/schema/isLowercased\",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:\"Schema.isLowercased()\"}),arbitraryConstraint:{patterns:[{source:WD,flags:\"\"}]},...e})}var JD=\"^(?:[^a-z][\\\\s\\\\S]*)?$\";function p9(e){let t=new globalThis.RegExp(JD);return Le(r=>r.charAt(0).toUpperCase()===r.charAt(0),{expected:\"a string with the first character in uppercase\",representation:{id:\"effect/schema/isCapitalized\",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:\"Schema.isCapitalized()\"}),arbitraryConstraint:{patterns:[{source:JD,flags:\"\"}]},...e})}var GD=\"^(?:[^A-Z][\\\\s\\\\S]*)?$\";function d9(e){let t=new globalThis.RegExp(GD);return Le(r=>r.charAt(0).toLowerCase()===r.charAt(0),{expected:\"a string with the first character in lowercase\",representation:{id:\"effect/schema/isUncapitalized\",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:\"Schema.isUncapitalized()\"}),arbitraryConstraint:{patterns:[{source:GD,flags:\"\"}]},...e})}var wm=G(my),m9=dy;function Cm(e){let t=ns(e.order),r=e.formatter??L;return(n,o)=>Le(s=>t(s,n),{expected:`a value greater than ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n,exclusiveMinimum:!0},...e.annotate?.(n),...o})}function km(e){let t=Ui(e.order),r=e.formatter??L;return(n,o)=>Le(s=>t(s,n),{expected:`a value greater than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n},...e.annotate?.(n),...o})}function Am(e){let t=wa(e.order),r=e.formatter??L;return(n,o)=>Le(s=>t(s,n),{expected:`a value less than ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n,exclusiveMaximum:!0},...e.annotate?.(n),...o})}function vm(e){let t=Fi(e.order),r=e.formatter??L;return(n,o)=>Le(s=>t(s,n),{expected:`a value less than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n},...e.annotate?.(n),...o})}function Om(e){let t=Ui(e.order),r=ns(e.order),n=Fi(e.order),o=wa(e.order),s=e.formatter??L;return(a,i)=>{let c=a.exclusiveMinimum?r:t,u=a.exclusiveMaximum?o:n;return Le(f=>c(f,a.minimum)&&u(f,a.maximum),{expected:`a value between ${s(a.minimum)}${a.exclusiveMinimum?\" (excluded)\":\"\"} and ${s(a.maximum)}${a.exclusiveMaximum?\" (excluded)\":\"\"}`,arbitraryConstraint:{order:e.order,minimum:a.minimum,maximum:a.maximum,...a.exclusiveMinimum&&{exclusiveMinimum:!0},...a.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(a),...i})}}function h9(e){return(t,r)=>{let n=e.formatter??L;return Le(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${n(t)}`,...e.annotate?.(t),...r})}}function rl(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${L(e)}`);return e}var x9=Cm({order:Wr,annotate:e=>({representation:{id:\"effect/schema/isGreaterThan\",payload:{exclusiveMinimum:rl(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${L(e)})`})})}),U2=km({order:Wr,annotate:e=>({representation:{id:\"effect/schema/isGreaterThanOrEqualTo\",payload:{minimum:rl(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${L(e)})`})})}),g9=Am({order:Wr,annotate:e=>({representation:{id:\"effect/schema/isLessThan\",payload:{exclusiveMaximum:rl(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${L(e)})`})})}),y9=vm({order:Wr,annotate:e=>({representation:{id:\"effect/schema/isLessThanOrEqualTo\",payload:{maximum:rl(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${L(e)})`})})}),_m=Om({order:Wr,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:\"effect/schema/isBetween\",payload:{minimum:rl(e.minimum),maximum:rl(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>({[t?\"exclusiveMinimum\":\"minimum\"]:e.minimum,[r?\"exclusiveMaximum\":\"maximum\"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${L(e.minimum)}, maximum: ${L(e.maximum)}, exclusiveMinimum: ${L(t)}, exclusiveMaximum: ${L(r)} })`})}}});function b9(e,t){if(!globalThis.Number.isFinite(e)||e===0)throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(e)}`);return e=globalThis.Math.abs(e),Le(r=>IF(r,e)===0,{expected:`a value that is a multiple of ${e}`,representation:{id:\"effect/schema/isMultipleOf\",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${L(e)})`}),...t})}function lb(e){return Le(t=>globalThis.Number.isSafeInteger(t),{expected:\"an integer\",representation:{id:\"effect/schema/isInt\",payload:null},toJsonSchema:()=>[{type:\"integer\"},!0],toCode:()=>({runtime:\"Schema.isInt()\"}),arbitraryConstraint:{number:\"integer\"},...e})}var Is=il.check(lb()),Zc=Is.check(U2(0));function S9(e){return new ri([lb(),_m({minimum:-2147483648,maximum:2147483647})],{expected:\"a 32-bit integer\",...e})}function E9(e){return new ri([lb(),_m({minimum:0,maximum:4294967295})],{expected:\"a 32-bit unsigned integer\",...e})}function nl(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${L(e)}`);return e.toISOString()}function ol(e){return`new Date(${L(e.getTime())})`}var I9=Cm({order:_u,annotate:e=>({representation:{id:\"effect/schema/isGreaterThanDate\",payload:{exclusiveMinimum:nl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${ol(e)})`})})}),T9=km({order:_u,annotate:e=>({representation:{id:\"effect/schema/isGreaterThanOrEqualToDate\",payload:{minimum:nl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${ol(e)})`})})}),w9=Am({order:_u,annotate:e=>({representation:{id:\"effect/schema/isLessThanDate\",payload:{exclusiveMaximum:nl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${ol(e)})`})})}),C9=vm({order:_u,annotate:e=>({representation:{id:\"effect/schema/isLessThanOrEqualToDate\",payload:{maximum:nl(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${ol(e)})`})})}),k9=Om({order:_u,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:\"effect/schema/isBetweenDate\",payload:{minimum:nl(e.minimum),maximum:nl(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${ol(e.minimum)}, maximum: ${ol(e.maximum)}, exclusiveMinimum: ${L(t)}, exclusiveMaximum: ${L(r)} })`})}}}),A9=Cm({order:Ou,annotate:e=>({representation:{id:\"effect/schema/isGreaterThanBigInt\",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${L(e)})`})})}),N2=km({order:Ou,annotate:e=>({representation:{id:\"effect/schema/isGreaterThanOrEqualToBigInt\",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${L(e)})`})})}),v9=Am({order:Ou,annotate:e=>({representation:{id:\"effect/schema/isLessThanBigInt\",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${L(e)})`})})}),O9=vm({order:Ou,annotate:e=>({representation:{id:\"effect/schema/isLessThanOrEqualToBigInt\",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${L(e)})`})})}),_9=Om({order:Ou,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:\"effect/schema/isBetweenBigInt\",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${L(e.minimum)}, maximum: ${L(e.maximum)}, exclusiveMinimum: ${L(t)}, exclusiveMaximum: ${L(r)} })`})}}});function D2(e,t){return e=zr(e),L2(e,Math.ceil(e/2),t)}function L2(e,t,r){return Le(n=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:\"effect/schema/isMinLength\",payload:{minLength:e}},toJsonSchema:({type:n})=>n===\"string\"?e<=1?{minLength:t}:[{minLength:t},!0]:n===\"array\"?{minItems:e}:n===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[fn]:!0,arbitraryConstraint:{minLength:e},...r})}function $2(e){return L2(1,1,e)}function B2(e,t){return e=zr(e),Le(r=>r.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:\"effect/schema/isMaxLength\",payload:{maxLength:e}},toJsonSchema:({type:r})=>r===\"string\"?e===0?{maxLength:e}:[{maxLength:e},!0]:r===\"array\"?{maxItems:e}:r===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[fn]:!0,arbitraryConstraint:{maxLength:e},...t})}function oA(e,t,r){return e=zr(e),t=zr(t),Le(n=>n.length>=e&&n.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:\"effect/schema/isBetweenLength\",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n===\"string\"?t===0||Math.ceil(e/2)>t?{minLength:Math.ceil(e/2),maxLength:t}:[{minLength:Math.ceil(e/2),maxLength:t},!0]:n===\"array\"?{minItems:e,maxItems:t}:n===void 0?[{minLength:Math.ceil(e/2),maxLength:t,minItems:e,maxItems:t},!0]:[{},!0],toCode:()=>({runtime:`Schema.isBetweenLength(${e}, ${t})`}),[fn]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...r})}function R9(e,t){return e=zr(e),Le(r=>sA(r,e)>=e,{expected:`a string with at least ${e} code points`,representation:{id:\"effect/schema/isMinCodePoints\",payload:{minCodePoints:e}},toJsonSchema:()=>({minLength:e}),toCode:()=>({runtime:`Schema.isMinCodePoints(${e})`}),arbitraryConstraint:{minCodePoints:e},...t})}function P9(e,t){return e=zr(e),Le(r=>sA(r,e+1)<=e,{expected:`a string with at most ${e} code points`,representation:{id:\"effect/schema/isMaxCodePoints\",payload:{maxCodePoints:e}},toJsonSchema:()=>({maxLength:e}),toCode:()=>({runtime:`Schema.isMaxCodePoints(${e})`}),arbitraryConstraint:{maxCodePoints:e},...t})}function M9(e,t,r){return e=zr(e),t=zr(t),Le(n=>{let o=sA(n,t+1);return o>=e&&o<=t},{expected:e===t?`a string with ${e} code points`:`a string with between ${e} and ${t} code points`,representation:{id:\"effect/schema/isBetweenCodePoints\",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({allOf:[{minLength:e},{maxLength:t}]}),toCode:()=>({runtime:`Schema.isBetweenCodePoints(${e}, ${t})`}),arbitraryConstraint:{minCodePoints:e,maxCodePoints:t},...r})}function sA(e,t){if(t===0)return 0;let r=0;for(let n of e)if(++r>=t)break;return r}function zr(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function F9(e,t){return e=zr(e),Le(r=>r.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:\"effect/schema/isMinSize\",payload:{minSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[fn]:!0,arbitraryConstraint:{minSize:e},...t})}function U9(e,t){return e=zr(e),Le(r=>r.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:\"effect/schema/isMaxSize\",payload:{maxSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[fn]:!0,arbitraryConstraint:{maxSize:e},...t})}function N9(e,t,r){return e=zr(e),t=zr(t),Le(n=>n.size>=e&&n.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:\"effect/schema/isBetweenSize\",payload:{minimum:e,maximum:t}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenSize(${e}, ${t})`}),[fn]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...r})}function D9(e,t){return e=zr(e),Le(r=>Reflect.ownKeys(r).length>=e,{expected:`a value with at least ${e===1?\"1 entry\":`${e} entries`}`,representation:{id:\"effect/schema/isMinProperties\",payload:{minProperties:e}},toJsonSchema:({type:r})=>r===\"object\"?{minProperties:e}:[{minProperties:e},!0],toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[fn]:!0,arbitraryConstraint:{minProperties:e},...t})}function L9(e,t){return e=zr(e),Le(r=>Reflect.ownKeys(r).length<=e,{expected:`a value with at most ${e===1?\"1 entry\":`${e} entries`}`,representation:{id:\"effect/schema/isMaxProperties\",payload:{maxProperties:e}},toJsonSchema:({type:r})=>r===\"object\"?{maxProperties:e}:[{maxProperties:e},!0],toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[fn]:!0,arbitraryConstraint:{maxProperties:e},...t})}function $9(e,t,r){return e=zr(e),t=zr(t),Le(n=>Reflect.ownKeys(n).length>=e&&Reflect.ownKeys(n).length<=t,{expected:e===t?`a value with exactly ${e===1?\"1 entry\":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:\"effect/schema/isBetweenProperties\",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n===\"object\"?{minProperties:e,maxProperties:t}:[{minProperties:e,maxProperties:t},!0],toCode:()=>({runtime:`Schema.isBetweenProperties(${e}, ${t})`}),[fn]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...r})}function B9(e,t){let r=al(e),n=ZC(r.ast);return Le((o,s,a)=>{let i=Reflect.ownKeys(o),c=[];for(let u of i){let f=n(u,a);if(f!==void 0&&(c.push(new xt([u],f)),a.errors===\"first\"))break}return gr(c)?new Rt(s,c,o,a):!0},{expected:\"an object with property names matching the schema\",representation:{id:\"effect/schema/isPropertyNames\",payload:null,schemas:[r.ast]},toJsonSchema:({schemas:o,type:s})=>s===\"object\"?{propertyNames:o[0]}:[{propertyNames:o[0]},!0],toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[fn]:!0,...t})}function aA(e){return Le(t=>Lh(t).length===t.length,{expected:\"an array with unique items\",representation:{id:\"effect/schema/isUnique\",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:\"Schema.isUnique()\"}),arbitraryConstraint:{uniqueBy:A},...e})}function z2(e){return Le(t=>Lh(t.map(([r])=>r)).length===t.length,{expected:\"an array with unique keys\",representation:{id:\"effect/schema/isUniqueKey\",payload:null},toCode:()=>({runtime:\"Schema.isUniqueKey()\"}),arbitraryConstraint:{uniqueBy:t=>t[0]},...e})}var j2=X.check($2()),z9=X.check(oA(1,1)),q2=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),H2=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},KD=[];function j9(e){let t=q2(e),r=KD[t];if(r!==void 0)return r;let n=H2(t),o=fi(globalThis.Error,{representation:{id:\"effect/schema/Error\",payload:n??null},toCode:()=>({runtime:n!==void 0?`Schema.ErrorInstance(${L(n)})`:\"Schema.ErrorInstance()\",Type:\"globalThis.Error\"}),expected:\"Error\",toCodecJson:()=>Re()(lee,Jw(n))});return KD[t]=o,o}var VD=[];function q9(e){let t=q2(e),r=VD[t];if(r!==void 0)return r;let n=gb.pipe(ee(Im,Gw(H2(t))));return VD[t]=n,n}function H9(e,t){let r=yn()([e,t],([n,o])=>{let s=qe(Ss([n,o]));return(a,i,c)=>a instanceof globalThis.Map?lr(Xe(s)([...a],c),{onSuccess:u=>new globalThis.Map(u),onFailure:u=>Qr(i,\"entries\",u,a,c)}):M(new gt(i,a,c))},{representation:{id:\"effect/schema/ReadonlyMap\",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlyMap(${n[0].runtime}, ${n[1].runtime})`,Type:`globalThis.ReadonlyMap<${n[0].Type}, ${n[1].Type}>`}),expected:\"ReadonlyMap\",toCodec:([n,o])=>Re()(qe(Ss([n,o])),ve({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]}))});return G(r.ast,{key:e,value:t})}function W9(e){let t=yn()([e],([r])=>{let n=qe(r);return(o,s,a)=>o instanceof globalThis.Set?lr(Xe(n)([...o],a),{onSuccess:i=>new globalThis.Set(i),onFailure:i=>Qr(s,\"values\",i,o,a)}):M(new gt(s,o,a))},{representation:{id:\"effect/schema/ReadonlySet\",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlySet(${r[0].runtime})`,Type:`globalThis.ReadonlySet<${r[0].Type}>`}),expected:\"ReadonlySet\",toCodec:([r])=>Re()(qe(r),ve({decode:n=>new globalThis.Set(n),encode:n=>[...n.values()]}))});return G(t.ast,{value:e})}var J9=fi(globalThis.RegExp,{representation:{id:\"effect/schema/RegExp\",payload:null},toCode:()=>({runtime:\"Schema.RegExp\",Type:\"globalThis.RegExp\"}),expected:\"RegExp\",toCodecJson:()=>Re()(Ue({source:X,flags:X}),nt({decode:(e,t)=>Tf({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new se({expected:\"valid RegExp source and flags\"},e,t)}),encode:e=>b({source:e.source,flags:e.flags})}))}),W2=X.annotate({expected:\"a string that will be decoded as a URL\"}),pb=fi(globalThis.URL,{representation:{id:\"effect/schema/URL\",payload:null},toCode:()=>({runtime:\"Schema.URL\",Type:\"globalThis.URL\"}),expected:\"URL\",toCodecJson:()=>Re()(W2,Qg)}),G9=W2.pipe(ee(pb,Qg)),J2=X.annotate({expected:\"a string that will be decoded as a Date\"}),Rm=He(e=>e instanceof globalThis.Date&&!globalThis.Number.isNaN(e.getTime()),{representation:{id:\"effect/schema/Date\",payload:null},toCode:()=>({runtime:\"Schema.Date\",Type:\"globalThis.Date\"}),expected:\"a valid Date\",toCodecJson:()=>Re()(J2,Vg)}),K9=J2.pipe(ee(Rm,Vg)),V9=Is.pipe(ee(Rm,qw)),Z9=X.annotate({expected:\"a string that will be decoded as JSON\",contentMediaType:\"application/json\"});function iA(e,t){return Z9.pipe(ee(e,nC(t)))}var Q9=iA(Im),G2=fi(globalThis.File,{representation:{id:\"effect/schema/File\",payload:null},toCode:()=>({runtime:\"Schema.File\",Type:\"globalThis.File\"}),expected:\"File\",toCodecJson:()=>Re()(Ue({data:X.check(F2()),type:X,name:X,lastModified:Is}),nt({decode:(e,t)=>tr(Ga(e.data),{onFailure:()=>M(new se({expected:\"a valid Base64 string\"},e.data,t)),onSuccess:r=>{let n=new globalThis.Uint8Array(r);return b(new globalThis.File([n],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>Ef({try:async()=>{let r=new globalThis.Uint8Array(await e.arrayBuffer());return{data:kc(r),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new se({expected:\"a readable File\"},e,t)})}))}),K2=fi(globalThis.FormData,{representation:{id:\"effect/schema/FormData\",payload:null},toCode:()=>({runtime:\"Schema.FormData\",Type:\"globalThis.FormData\"}),expected:\"FormData\",toCodecJson:()=>Re()(qe(Ss([X,yt([Ue({_tag:Yc(\"String\"),value:X}),Ue({_tag:Yc(\"File\"),value:G2})])])),nt({decode:e=>{let t=new globalThis.FormData;for(let[r,n]of e)t.append(r,n.value);return b(t)},encode:e=>b(globalThis.Array.from(e.entries()).map(([t,r])=>typeof r==\"string\"?[t,{_tag:\"String\",value:r}]:[t,{_tag:\"File\",value:r}]))}))});function Y9(e){return K2.pipe(ee(e,oC))}var V2=fi(globalThis.URLSearchParams,{representation:{id:\"effect/schema/URLSearchParams\",payload:null},toCode:()=>({runtime:\"Schema.URLSearchParams\",Type:\"globalThis.URLSearchParams\"}),expected:\"URLSearchParams\",toCodecJson:()=>Re()(X.annotate({expected:\"a query string that will be decoded as URLSearchParams\"}),ve({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});function X9(e){return V2.pipe(ee(e,sC))}var e7=X.annotate({expected:\"a string that will be decoded as a number\"}).pipe(ee(il,Nc)),t7=X.annotate({expected:\"a string that will be decoded as a finite number\"}).pipe(ee(wm,Nc)),r7=G(Ey).pipe(ee(cl,Bd)),Z2=X.check(M2()),n7=X.annotate({expected:\"a string that will be decoded as a trimmed string\"}).pipe(ee(Z2,Bw())),o7=X.annotate({expected:\"a base64 encoded string that will be decoded as a UTF-8 string\"}).pipe(ee(X,Xw)),s7=X.annotate({expected:\"a base64 (URL) encoded string that will be decoded as a UTF-8 string\"}).pipe(ee(X,eC)),a7=X.annotate({expected:\"a hex encoded string that will be decoded as a UTF-8 string\"}).pipe(ee(X,tC)),i7=X.annotate({expected:\"a URI component encoded string that will be decoded as a UTF-8 string\"}).pipe(ee(X,rC)),Hk=yt([wm,x2,X]),c7=Ue({issues:qe(Ue({message:X,path:sl(qe(yt([Hk,Ue({key:Hk})])))}))}),u7=Es([0,1]).pipe(ee(Qk,ve({decode:e=>e===1,encode:e=>e?1:0}))),Q2=X.annotate({expected:\"a base64 encoded string that will be decoded as Uint8Array\",format:\"byte\",contentEncoding:\"base64\"}),db=fi(globalThis.Uint8Array,{representation:{id:\"effect/schema/Uint8Array\",payload:null},toCode:()=>({runtime:\"Schema.Uint8Array\",Type:\"globalThis.Uint8Array\"}),expected:\"Uint8Array\",toCodecJson:()=>Re()(Q2,Yg)}),f7=Q2.pipe(ee(db,Yg)),l7=X.annotate({expected:\"a base64 (URL) encoded string that will be decoded as a Uint8Array\"}).pipe(ee(db,{decode:vw(),encode:Fd()})),p7=X.annotate({expected:\"a hex encoded string that will be decoded as a Uint8Array\"}).pipe(ee(db,{decode:_w(),encode:Ud()})),Y2=nt({decode:(e,t)=>{let r=hg(e);return fe(r)?M(new se({expected:\"a valid BigDecimal string\"},e,t)):b(r.value)},encode:e=>b(Oo(e))}),d7=Cm({order:Of,formatter:e=>Oo(e)}),m7=km({order:Of,formatter:e=>Oo(e)}),h7=Am({order:Of,formatter:e=>Oo(e)}),x7=vm({order:Of,formatter:e=>Oo(e)}),g7=Om({order:Of,formatter:e=>Oo(e)}),X2=X.annotate({expected:\"a string that will be decoded as a BigDecimal\"}),eL=He(uT,{representation:{id:\"effect/schema/BigDecimal\",payload:null},toCode:()=>({runtime:\"Schema.BigDecimal\",Type:\"BigDecimal.BigDecimal\",importDeclarations:['import * as BigDecimal from \"effect/BigDecimal\"']}),expected:\"BigDecimal\",toCodecJson:()=>Re()(X2,Y2),toFormatter:()=>e=>Oo(e)}),y7=X2.pipe(ee(eL,Y2)),Pm=He(AU,{representation:{id:\"effect/schema/ByteSize\",payload:null},toCode:()=>({runtime:\"Schema.ByteSize\",Type:\"ByteSize.ByteSize\",importDeclarations:['import * as ByteSize from \"effect/ByteSize\"']}),expected:\"ByteSize\",toCodecJson:()=>Re()(cl.check(N2(globalThis.BigInt(0))),ve({decode:kU,encode:gg})),toCodecStringTree:()=>Re()(tL,Zg)}),tL=X.annotate({expected:\"a string that will be decoded as a ByteSize\"}),b7=tL.pipe(ee(Pm,Zg)),S7=cl.pipe(ee(Pm,Hw)),E7=il.pipe(ee(Pm,Ww));function Wk(e,t){let r=yn()([e,t],([n,o])=>(s,a,i)=>{if(!JI(s))return M(new gt(a,s,i));switch(s._tag){case\"Fail\":return lr(Xe(n)(s.error,i),{onSuccess:Dx,onFailure:c=>Qr(a,\"error\",c,s,i)});case\"Die\":return lr(Xe(o)(s.defect,i),{onSuccess:Lx,onFailure:c=>Qr(a,\"defect\",c,s,i)});case\"Interrupt\":return b(s)}},{representation:{id:\"effect/schema/CauseReason\",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.CauseReason(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Failure<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from \"effect/Cause\"']}),expected:\"Cause.Failure\",toCodec:([n,o])=>Re()(yt([Ue({_tag:Qt(\"Fail\"),error:n}),Ue({_tag:Qt(\"Die\"),defect:o}),Ue({_tag:Qt(\"Interrupt\"),fiberId:ub(wm)})]),ve({decode:s=>{switch(s._tag){case\"Fail\":return Dx(s.error);case\"Die\":return Lx(s.defect);case\"Interrupt\":return GI(s.fiberId)}},encode:s=>{switch(s._tag){case\"Fail\":return{_tag:\"Fail\",error:s.error};case\"Die\":return{_tag:\"Die\",defect:s.defect};case\"Interrupt\":return{_tag:\"Interrupt\",fiberId:s.fiberId}}}}))});return G(r.ast,{error:e,defect:t})}function Jk(e,t){let r=yn()([e,t],([n,o])=>{let s=qe(Wk(n,o));return(a,i,c)=>WI(a)?lr(Xe(s)(a.reasons,c),{onSuccess:af,onFailure:u=>Qr(i,\"failures\",u,a,c)}):M(new gt(i,a,c))},{representation:{id:\"effect/schema/Cause\",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Cause(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Cause<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from \"effect/Cause\"']}),expected:\"Cause\",toCodec:([n,o])=>Re()(qe(Wk(n,o)),ve({decode:af,encode:({reasons:s})=>s}))});return G(r.ast,{error:e,defect:t})}function ZD(e){return Re()(e,ve({decode:xT,encode:be}))}function I7(e){let t=yn()([e],([r])=>{let n=qe(r);return(o,s,a)=>bg(o)?lr(Xe(n)(be(o),a),{onSuccess:xT,onFailure:i=>Qr(s,\"values\",i,o,a)}):M(new gt(s,o,a))},{representation:{id:\"effect/schema/Chunk\",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Chunk(${r[0].runtime})`,Type:`Chunk.Chunk<${r[0].Type}>`}),expected:\"Chunk\",toCodec:([r])=>ZD(qe(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>ZD(cb(qe(n),r?.minLength,r?.maxLength)),toEquivalence:([r])=>mT(r)});return G(t.ast,{value:e})}function rL(){return ft((e,t)=>at(Tc(e),{onNone:()=>M(new se({message:\"Invalid DateTime input\"},e,t)),onSome:r=>b(wc(r))}))}var T7=ve({decode:e=>pd(e),encode:e=>e.offset}),nL=nt({decode:(e,t)=>at(Eg(e),{onNone:()=>M(new se({expected:\"a valid IANA time zone\"},e,t)),onSome:b}),encode:e=>b(e.id)}),oL=nt({decode:(e,t)=>at(Ig(e),{onNone:()=>M(new se({expected:\"a valid time zone\"},e,t)),onSome:b}),encode:e=>b(Cc(e))}),sL=nt({decode:(e,t)=>at(Tc(e),{onNone:()=>M(new se({expected:\"a valid UTC DateTime string\"},e,t)),onSome:r=>b(wc(r))}),encode:e=>b(Tg(e))}),aL=nt({decode:(e,t)=>at(Sg(e),{onNone:()=>M(new se({expected:\"a valid Zoned DateTime string\"},e,t)),onSome:b}),encode:e=>b(dd(e))}),iL=-864e13,cL=864e13,w7=iL+840*60*1e3,C7=cL-840*60*1e3,k7=-720*60*1e3,A7=840*60*1e3,uL=[\"UTC\",\"Europe/London\",\"America/New_York\",\"Asia/Tokyo\",\"Australia/Sydney\"];function fL(e,t,r){let n=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+(e.exclusiveMinimum===!0?1:0)),o=Math.min(r,e?.maximum===void 0?r:e.maximum.epochMilliseconds-(e.exclusiveMaximum===!0?1:0));return n<=o?[n,o]:[t,r]}function cA(e,t){return Is.check(_m({minimum:e,maximum:t}))}function lL(){return yt([cA(k7,A7),Es(uL)])}var mb=He(e=>yT(e)&&NU(e),{representation:{id:\"effect/schema/DateTimeUtc\",payload:null},toCode:()=>({runtime:\"Schema.DateTimeUtc\",Type:\"DateTime.Utc\",importDeclarations:['import * as DateTime from \"effect/DateTime\"']}),expected:\"DateTime.Utc\",toCodecArbitrary:({constraint:e})=>{let[t,r]=fL(e,iL,cL);return ul()(cA(t,r),Y($U))},toCodecJson:()=>Re()(X,sL),toFormatter:()=>e=>e.toString()}),v7=Rm.pipe(ee(mb,{decode:rL(),encode:Y(zU)})),O7=X.annotate({expected:\"a string that will be decoded as a DateTime.Utc\"}).pipe(ee(mb,sL)),_7=Is.pipe(ee(mb,{decode:rL(),encode:Y(jU)})),R7=He(FU,{representation:{id:\"effect/schema/TimeZoneOffset\",payload:null},toCode:()=>({runtime:\"Schema.TimeZoneOffset\",Type:\"DateTime.TimeZone.Offset\",importDeclarations:['import * as DateTime from \"effect/DateTime\"']}),expected:\"DateTime.TimeZone.Offset\",toCodecJson:()=>Re()(Is,T7),toFormatter:()=>e=>Cc(e)}),pL=X.annotate({expected:\"an IANA time zone identifier\"}),dL=He(UU,{representation:{id:\"effect/schema/TimeZoneNamed\",payload:null},toCode:()=>({runtime:\"Schema.TimeZoneNamed\",Type:\"DateTime.TimeZone.Named\",importDeclarations:['import * as DateTime from \"effect/DateTime\"']}),expected:\"DateTime.TimeZone.Named\",toCodecArbitrary:()=>ul()(Es(uL),Y(bT)),toCodecJson:()=>Re()(pL,nL),toFormatter:()=>e=>Cc(e)}),P7=pL.pipe(ee(dL,nL)),mL=X.annotate({expected:\"a time zone string (IANA identifier or offset like +03:00)\"}),hL=He(MU,{representation:{id:\"effect/schema/TimeZone\",payload:null},toCode:()=>({runtime:\"Schema.TimeZone\",Type:\"DateTime.TimeZone\",importDeclarations:['import * as DateTime from \"effect/DateTime\"']}),expected:\"DateTime.TimeZone\",toCodecArbitrary:()=>ul()(lL(),Y(e=>typeof e==\"number\"?pd(e):bT(e))),toCodecJson:()=>Re()(mL,oL),toFormatter:()=>e=>Cc(e)}),M7=mL.pipe(ee(hL,oL)),xL=X.annotate({expected:\"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])\"}),gL=He(e=>yT(e)&&DU(e),{representation:{id:\"effect/schema/DateTimeZoned\",payload:null},toCode:()=>({runtime:\"Schema.DateTimeZoned\",Type:\"DateTime.Zoned\",importDeclarations:['import * as DateTime from \"effect/DateTime\"']}),expected:\"DateTime.Zoned\",toCodecArbitrary:({constraint:e})=>{let[t,r]=fL(e,w7,C7);return ul()(Ue({epochMilliseconds:cA(t,r),timeZone:lL()}),Y(({epochMilliseconds:n,timeZone:o})=>BU(n,{timeZone:o})))},toCodecJson:()=>Re()(xL,aL),toFormatter:()=>e=>dd(e),toEquivalence:()=>LU}),F7=xL.pipe(ee(gL,aL)),qo=(e,t,r,n)=>X.pipe(ee(e,nt({decode:(o,s)=>{let a=t(o);return ze(a)?b(a.success):M(new se({message:a.failure.message},o,s))},encode:o=>b(r(o))}))).annotate({identifier:n}),Xc=He(Xf,{identifier:\"MacAddress\"}),ll=qo(Xc,OD,Ok,\"MacAddressFromString\"),hb=He(Br,{identifier:\"Ipv4Address\"}),uA=qo(hb,el,jo,\"Ipv4AddressFromString\"),fA=He(bs,{identifier:\"Ipv6Address\"}),yL=qo(fA,dm,jo,\"Ipv6AddressFromString\"),eu=He(AD,{identifier:\"IpAddress\"}),pl=qo(eu,mm,jo,\"IpAddressFromString\"),ot=(e,t,r,n)=>E2(t,{expected:r})(e).annotate({identifier:n}),U7=ot(eu,tl,\"a multicast address\",\"IpMulticastAddress\"),N7=ot(pl,tl,\"a multicast address\",\"IpMulticastAddressFromString\"),D7=ot(Xc,tl,\"a multicast address\",\"MacMulticastAddress\"),L7=ot(ll,tl,\"a multicast address\",\"MacMulticastAddressFromString\"),$7=ot(eu,Mk,\"a unicast address\",\"IpUnicastAddress\"),B7=ot(pl,Mk,\"a unicast address\",\"IpUnicastAddressFromString\"),z7=ot(Xc,Qy,\"a unicast address\",\"MacUnicastAddress\"),j7=ot(ll,Qy,\"a unicast address\",\"MacUnicastAddressFromString\"),q7=ot(hb,Xy,\"a broadcast address\",\"Ipv4BroadcastAddress\"),H7=ot(uA,Xy,\"a broadcast address\",\"Ipv4BroadcastAddressFromString\"),W7=ot(Xc,Zy,\"a broadcast address\",\"MacBroadcastAddress\"),J7=ot(ll,Zy,\"a broadcast address\",\"MacBroadcastAddressFromString\"),G7=ot(eu,Pk,\"a loopback address\",\"IpLoopbackAddress\"),K7=ot(pl,Pk,\"a loopback address\",\"IpLoopbackAddressFromString\"),V7=ot(eu,Fk,\"a link-local address\",\"IpLinkLocalAddress\"),Z7=ot(pl,Fk,\"a link-local address\",\"IpLinkLocalAddressFromString\"),Q7=ot(eu,Yy,\"an unspecified address\",\"IpUnspecifiedAddress\"),Y7=ot(pl,Yy,\"an unspecified address\",\"IpUnspecifiedAddressFromString\"),X7=ot(hb,Uk,\"a private address\",\"Ipv4PrivateAddress\"),eX=ot(uA,Uk,\"a private address\",\"Ipv4PrivateAddressFromString\"),tX=ot(fA,Nk,\"a unique-local address\",\"Ipv6UniqueLocalAddress\"),rX=ot(yL,Nk,\"a unique-local address\",\"Ipv6UniqueLocalAddressFromString\"),nX=ot(Xc,_k,\"a locally administered address\",\"MacLocallyAdministeredAddress\"),oX=ot(ll,_k,\"a locally administered address\",\"MacLocallyAdministeredAddressFromString\"),sX=ot(Xc,Rk,\"a universally administered address\",\"MacUniversallyAdministeredAddress\"),aX=ot(ll,Rk,\"a universally administered address\",\"MacUniversallyAdministeredAddressFromString\"),bL=He(FD,{identifier:\"Ipv4Interface\"}),iX=qo(bL,tb,gm,\"Ipv4InterfaceFromString\"),SL=He(UD,{identifier:\"Ipv6Interface\"}),cX=qo(SL,rb,gm,\"Ipv6InterfaceFromString\"),EL=He(hm,{identifier:\"IpInterface\"}),uX=qo(EL,nb,gm,\"IpInterfaceFromString\"),IL=He(DD,{identifier:\"Ipv4Network\"}),fX=qo(IL,$D,bm,\"Ipv4NetworkFromString\"),TL=He(LD,{identifier:\"Ipv6Network\"}),lX=qo(TL,BD,bm,\"Ipv6NetworkFromString\"),wL=He(ym,{identifier:\"IpNetwork\"}),pX=qo(wL,zD,bm,\"IpNetworkFromString\"),dX=He(lm,{identifier:\"InetAddressV4\"}),mX=He(pm,{identifier:\"InetAddressV6\"}),CL=He(Ak,{identifier:\"InetAddress\"}),hX=qo(CL,PD,eb,\"InetAddressFromString\"),kL=He(Vy,{identifier:\"UnixPathAddress\"}),xX=X.pipe(ee(kL,ve({decode:MD,encode:e=>e.path}))).annotate({identifier:\"UnixPathAddressFromString\"}),gX=He(vD,{identifier:\"SocketAddress\"}),yX=nt({decode:(e,t)=>at(sp(e),{onNone:()=>M(new se({expected:\"a valid Duration string\"},e,t)),onSome:b}),encode:e=>b(globalThis.String(e))}),bX=nt({decode:e=>b(An(e)),encode:(e,t)=>at(ap(e),{onNone:()=>M(new se({expected:\"a Duration representable as a bigint\"},e,t)),onSome:r=>b(r)})}),SX=ve({decode:e=>Jt(e),encode:e=>Ye(e)}),xb=He(Rh,{representation:{id:\"effect/schema/Duration\",payload:null},toCode:()=>({runtime:\"Schema.Duration\",Type:\"Duration.Duration\",importDeclarations:['import * as Duration from \"effect/Duration\"']}),expected:\"Duration\",toCodecJson:()=>Re()(yt([Ue({_tag:Qt(\"Infinity\")}),Ue({_tag:Qt(\"NegativeInfinity\")}),Ue({_tag:Qt(\"Nanos\"),value:cl}),Ue({_tag:Qt(\"Millis\"),value:Is})]),ve({decode:e=>{switch(e._tag){case\"Infinity\":return er;case\"NegativeInfinity\":return Pr;case\"Nanos\":return An(e.value);case\"Millis\":return Jt(e.value)}},encode:e=>{switch(e.value._tag){case\"Infinity\":return{_tag:\"Infinity\"};case\"NegativeInfinity\":return{_tag:\"NegativeInfinity\"};case\"Nanos\":return{_tag:\"Nanos\",value:e.value.nanos};case\"Millis\":return{_tag:\"Millis\",value:e.value.millis}}}}))}),EX=X.annotate({expected:\"a string that will be decoded as a Duration\"}),AL=EX.pipe(ee(xb,yX)),IX=cl.pipe(ee(xb,bX)),TX=il.pipe(ee(xb,SX));function wX(e,t,r){let n=yn()([e,t,r],([o,s,a])=>{let i=Jk(s,a);return(c,u,f)=>{if(!Np(c))return M(new gt(u,c,f));switch(c._tag){case\"Success\":return lr(Xe(o)(c.value,f),{onSuccess:Fr,onFailure:p=>Qr(u,\"value\",p,c,f)});case\"Failure\":return lr(Xe(i)(c.cause,f),{onSuccess:sn,onFailure:p=>Qr(u,\"cause\",p,c,f)})}}},{representation:{id:\"effect/schema/Exit\",payload:null},toCode:({typeParameters:o})=>({runtime:`Schema.Exit(${o[0].runtime}, ${o[1].runtime}, ${o[2].runtime})`,Type:`Exit.Exit<${o[0].Type}, ${o[1].Type}, ${o[2].Type}>`,importDeclarations:['import * as Exit from \"effect/Exit\"']}),expected:\"Exit\",toCodec:([o,s,a])=>Re()(yt([Ue({_tag:Qt(\"Success\"),value:o}),Ue({_tag:Qt(\"Failure\"),cause:Jk(s,a)})]),ve({decode:i=>i._tag===\"Success\"?Fr(i.value):sn(i.cause),encode:i=>je(i)?{_tag:\"Success\",value:i.value}:{_tag:\"Failure\",cause:i.cause}}))});return G(n.ast,{value:e,error:t,defect:r})}function QD(e,t,r){return Ue({type:Qt(e),nodes:qe(Ue({index:Zc,data:t})),edges:qe(Ue({index:Zc,source:Zc,target:Zc,data:r}))})}function YD(e,t){let r=-1,n=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=r)return M(new xt([\"nodes\",o,\"index\"],new se({expected:\"a strictly increasing node index\"},s,t)));r=s,n.add(s)}r=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=r)return M(new xt([\"edges\",o,\"index\"],new se({expected:\"a strictly increasing edge index\"},s.index,t)));if(r=s.index,!n.has(s.source))return M(new xt([\"edges\",o,\"source\"],new se({expected:\"an encoded node index\"},s.source,t)));if(!n.has(s.target))return M(new xt([\"edges\",o,\"target\"],new se({expected:\"an encoded node index\"},s.target,t)))}return b(Dg(e))}function CX(e,t,r){return!VT(e)||e.mutable||e.type!==t?M(new se({expected:`an immutable ${t} Graph`},e,r)):b(Id(e))}function kX(e,t){return(r,n)=>{let o=Id(r),s=Id(n);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let a=0;a<o.nodes.length;a++)if(o.nodes[a].index!==s.nodes[a].index||!e(o.nodes[a].data,s.nodes[a].data))return!1;for(let a=0;a<o.edges.length;a++){let i=o.edges[a],c=s.edges[a],u=o.type===\"directed\"?i.source===c.source&&i.target===c.target:i.source===c.source&&i.target===c.target||i.source===c.target&&i.target===c.source;if(i.index!==c.index||!u||!t(i.data,c.data))return!1}return!0}}function AX(e,t,r){return ul()(yt([ib,Ue({nodes:Tm(t),edges:qe(Ss([Zc,Zc,r]))})]),Y(n=>{if(n===null)return Dg({type:e,nodes:[],edges:[]});let o=n.nodes.map((s,a)=>({index:a,data:s}));return Dg({type:e,nodes:o,edges:n.edges.map(([s,a,i],c)=>({index:c,source:s%o.length,target:a%o.length,data:i}))})}))}function vX(e,t,r){let n=yn()([t,r],([o,s])=>{let a=QD(e,o,s);return(i,c,u)=>!VT(i)||i.mutable||i.type!==e?M(new gt(c,i,u)):T(Xe(a)(Id(i),u),f=>YD(f,u))},{representation:{id:\"effect/schema/Graph\",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${L(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${L(e)}>`,importDeclarations:['import * as Graph from \"effect/Graph\"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Re()(QD(e,o,s),nt({decode:YD,encode:(a,i)=>CX(a,e,i)})),toCodecArbitrary:({typeParameters:[o,s]})=>AX(e,o,s),toEquivalence:([o,s])=>kX(o,s)});return G(n.ast,{type:e,node:t,edge:r})}function XD(e){return Re()(e,ve({decode:OT,encode:yd}))}function OX(e,t){let r=yn()([e,t],([n,o])=>{let s=qe(Ss([n,o]));return(a,i,c)=>YU(a)?lr(Xe(s)(yd(a),c),{onSuccess:OT,onFailure:u=>Qr(i,\"entries\",u,a,c)}):M(new gt(i,a,c))},{representation:{id:\"effect/schema/HashMap\",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashMap(${n[0].runtime}, ${n[1].runtime})`,Type:`HashMap.HashMap<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as HashMap from \"effect/HashMap\"']}),expected:\"HashMap\",toCodec:([n,o])=>XD(qe(Ss([n,o]))),toCodecArbitrary:({constraint:n,typeParameters:[o,s]})=>XD(cb(qe(Ss([o,s])).check(z2()),n?.minSize,n?.maxSize)),toEquivalence:([n,o])=>ih(n,o)});return G(r.ast,{key:e,value:t})}function e2(e){return Re()(e,ve({decode:PT,encode:be}))}function _X(e){let t=yn()([e],([r])=>{let n=qe(r);return(o,s,a)=>nN(o)?lr(Xe(n)(be(o),a),{onSuccess:PT,onFailure:i=>Qr(s,\"values\",i,o,a)}):M(new gt(s,o,a))},{representation:{id:\"effect/schema/HashSet\",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashSet(${r[0].runtime})`,Type:`HashSet.HashSet<${r[0].Type}>`}),expected:\"HashSet\",toCodec:([r])=>e2(qe(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>e2(cb(qe(n).check(aA()),r?.minSize,r?.maxSize)),toEquivalence:([r])=>Bl(r)});return G(t.ast,{value:e})}function tu(e){let t=yn()([e],([r])=>(n,o,s)=>Ru(n)?fe(n)?ja:lr(Xe(r)(n.value,s),{onSuccess:O,onFailure:a=>Qr(o,\"value\",a,n,s)}):M(new gt(o,n,s)),{representation:{id:\"effect/schema/Option\",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Option(${r[0].runtime})`,Type:`Option.Option<${r[0].Type}>`,importDeclarations:['import * as Option from \"effect/Option\"']}),expected:\"Option\",toCodec:([r])=>Re()(yt([Ue({_tag:Qt(\"Some\"),value:r}),Ue({_tag:Qt(\"None\")})]),ve({decode:n=>n._tag===\"None\"?v():O(n.value),encode:n=>Oe(n)?{_tag:\"Some\",value:n.value}:{_tag:\"None\"}}))});return G(t.ast,{value:e})}function RX(e){return Xk(e).pipe(ee(tu(bn(e)),Kw()))}function PX(e){return ub(e).pipe(ee(tu(bn(e)),Vw()))}function MX(e,t){return b2(e).pipe(ee(tu(bn(e)),Zw(t)))}var vL=He(aN,{representation:{id:\"effect/http/Cookie\",payload:null},toCode:()=>({runtime:\"Schema.Cookie\",Type:\"Cookies.Cookie\",importDeclarations:['import * as Cookies from \"effect/http/Cookies\"']}),expected:\"Cookie\"}),OL=He(Rf,{representation:{id:\"effect/http/Cookies\",payload:null},toCode:()=>({runtime:\"Schema.Cookies\",Type:\"Cookies.Cookies\",importDeclarations:['import * as Cookies from \"effect/http/Cookies\"']}),expected:\"Cookies\",toCodecJson:()=>Re()(qe(X),ve({decode:iN,encode:lN})),toCodecIso:()=>Re()(la(X,vL),ve({decode:Va,encode:e=>e.cookies}))}),FX=OL.pipe(ee(la(X,X),ve({decode:fN,encode:e=>Mg(globalThis.Object.entries(e).map(([t,r])=>$T(t,r)))}))),UX=He(mN,{representation:{id:\"effect/http/Headers\",payload:null},toCode:()=>({runtime:\"Schema.Headers\",Type:\"Headers.Headers\",importDeclarations:['import * as Headers from \"effect/http/Headers\"']}),expected:\"Headers\",toEquivalence:()=>qT,toCodec:()=>Re()(la(X,X),ve({decode:HT,encode:e=>({...e})}))}),lA=He(JT,{representation:{id:\"effect/http/UrlParams\",payload:null},toCode:()=>({runtime:\"Schema.UrlParams\",Type:\"UrlParams.UrlParams\",importDeclarations:['import * as UrlParams from \"effect/http/UrlParams\"']}),expected:\"UrlParams\",toEquivalence:()=>GT,toCodec:()=>Re()(qe(Ss([X,X])),ve({decode:na,encode:e=>e.params}))}),NX=(e,t)=>lA.pipe(ee(iA(Im,t),nt({decode:r=>at(xN(r,e),{onNone:()=>M(new xt([e],new ys(void 0))),onSome:b}),encode:r=>b(na([[e,r]]))}))),DX=lA.pipe(ee(la(X,yt([X,Tm(X)])),ve({decode:gN,encode:Ed})));function LX(e){return Qc(e).pipe(ee(tu(bn(e)),Qw()))}function $X(e){return sl(e).pipe(ee(tu(bn(e)),Yw()))}function BX(e,t){let r=t===void 0?\"omit\":t.onNoneEncoding,n=r===null?null:void 0;return sl(Xk(e)).pipe(ee(tu(bn(e)),$d({decode:o=>o.pipe(Li(Ll),O),encode:r===\"omit\"?Di:o=>O(Yl(Di(o),()=>n))})))}function pA(e,t){let r=typeof t?.label==\"string\"?t.label:void 0,n=t?.disallowJsonEncode===!0,o=r!==void 0?n?{label:r,disallowJsonEncode:!0}:{label:r}:n?{disallowJsonEncode:!0}:void 0,s=r!==void 0?Xe(Qt(r)):void 0,a=yn()([e],([i])=>(c,u,f)=>{if(Fg(c)){let p=s!==void 0?fd(s(c.label,f),d=>new xt([\"label\"],d)):te;return ut(p,()=>lr(Xe(i)(Rc(c),f),{onSuccess:d=>Qa(d,{label:c.label}),onFailure:()=>new Rt(u,[new xt([\"value\"],new se(void 0,c,f))],c,f)}))}return M(new gt(u,c,f))},{representation:{id:\"effect/schema/Redacted\",payload:o??null},toCode:({typeParameters:i})=>({runtime:o!==void 0?`Schema.Redacted(${i[0].runtime}, ${L(o)})`:`Schema.Redacted(${i[0].runtime})`,Type:`Redacted.Redacted<${i[0].Type}>`,importDeclarations:['import * as Redacted from \"effect/Redacted\"']}),expected:\"Redacted\",toCodecJson:([i])=>Re()(i,{decode:Y(c=>Qa(c,{label:r})),encode:n?Rd(c=>\"Cannot serialize Redacted\"+(Oe(c)&&typeof c.value.label==\"string\"?` with label: \"${c.value.label}\"`:\"\")):Y(Rc)}),toEquivalence:([i])=>zT(i)});return G(a.ast,{value:e})}function zX(e,t){return ee(pA(bn(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Y(r=>Qa(r,{label:t?.label})),encode:t?.disallowEncode?Rd(r=>\"Cannot encode Redacted\"+(Oe(r)&&typeof r.value.label==\"string\"?` with label: \"${r.value.label}\"`:\"\")):Y(Rc)})(e)}function jX(e,t){let r=yn()([e,t],([n,o])=>(s,a,i)=>{if(!ka(s))return M(new gt(a,s,i));switch(s._tag){case\"Success\":return lr(em(n)(s.success,i),{onSuccess:P,onFailure:c=>Qr(a,\"success\",c,s,i)});case\"Failure\":return lr(em(o)(s.failure,i),{onSuccess:D,onFailure:c=>Qr(a,\"failure\",c,s,i)})}},{representation:{id:\"effect/schema/Result\",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Result(${n[0].runtime}, ${n[1].runtime})`,Type:`Result.Result<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Result from \"effect/Result\"']}),expected:\"Result\",toCodec:([n,o])=>Re()(yt([Ue({_tag:Qt(\"Success\"),success:n}),Ue({_tag:Qt(\"Failure\"),failure:o})]),ve({decode:s=>s._tag===\"Success\"?P(s.success):D(s.failure),encode:s=>ze(s)?{_tag:\"Success\",success:s.success}:{_tag:\"Failure\",failure:s.failure}}))});return G(r.ast,{success:e,failure:t})}var qX=globalThis.Symbol.for(\"immer-draftable\"),Gk={};function dA(e,t,r,n,o){let s=WX(r,t,n),a=_L(t),i=class extends e{constructor(...[c,u]){let p=u?.[\"~payload\"],d=p?.token===Gk?p.value:r.make(c??{},u);super(d,{...u,disableChecks:!0,\"~payload\":{token:Gk,value:d}})}static[Sm]=Sm;get[a](){return a}static[qX]=!0;static identifier=t;static fields=r.fields;static get ast(){return s(this).ast}static pipe(){return K(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return Xd(s(this))(c??{},u)}static makeOption(c,u){return Yd(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(so(this.ast,c))}static annotateKey(c){return this.rebuild(qf(this.ast,c))}static check(...c){return this.rebuild(Fo(this.ast,c))}static extend(c){return(u,f)=>{let p=Mm(u)?u:Ue(u),d={...r.fields,...p.fields},m=Hd(d,r.ast.checks,{identifier:c});return dA(this,c,Yk(Fo(m,p.ast.checks),d),f,o)}}static mapFields(c,u){return r.mapFields(c,u)}};return o!==void 0&&Object.assign(i.prototype,o(t)),i}function HX(e){return new ye(Y(t=>new e(t,{\"~payload\":{token:Gk,value:t}})),or())}function _L(e){return`~effect/Schema/Class/${e}`}function WX(e,t,r){let n;return o=>{if(n!==void 0)return n;let s=_L(t),a=u=>u instanceof o||w(u,s),i=HX(o),c=G(new zc([e.ast],()=>(u,f,p)=>a(u)?b(u):M(new gt(f,u,p)),{identifier:t,[Lg]:([u])=>({isConstructed:a,link:new lt(u,i)}),toCodec:([u])=>new lt(u.ast,i),toEquivalence:([u])=>u,toFormatter:([u])=>f=>`${o.identifier}(${u(f)})`,[Td]:Lc(e.ast),...r}));return n=ee(c,i)(e)}}function Mm(e){return ab(e)}var RL=e=>(t,r)=>{let n=Mm(t)?t:Ue(t);return dA($h,e,n,r,o=>({toString(){return`${o}(${L({...this})})`}}))},JX=e=>(t,r,n)=>{let o=Mm(r)?r.mapFields(s=>({_tag:Yc(t),...s}),{unsafePreserveChecks:!0}):fb(t,r);return RL(e??t)(o,n)},PL=e=>(t,r)=>{let n=Mm(t)?t:Ue(t);return dA(Jl,e,n,r,s=>({name:s}))},GX=e=>(t,r,n)=>{let o=Mm(r)?r.mapFields(s=>({_tag:Yc(t),...s}),{unsafePreserveChecks:!0}):fb(t,r);return PL(e??t)(o,n)};function KX(e){return t=>t.annotate({toFormatter:e})}function VX(e,t){return xD(e.ast,t)}function ZX(e){return t=>t.annotate({toEquivalence:e})}function QX(e){return gk(e.ast)}function YX(e,t){return cm(e.ast,t)}function XX(e,t){let r=cm(Jf(e.ast),t);return Hy(r,t)}var eee=$y,tee=By,Fm=zy,ree=H1;function nee(e,t){return lD(e,t)}function oee(e){return TD(e)}function see(e){return wD(e)}function aee(e){return CD(e)}function iee(e,t){return r=>G(so(r.ast,{toCodecIso:()=>new lt(e.ast,Ld(t))}),{schema:r})}function cee(e){return fD(e)}function uee(e){let t=S2(()=>r),r=yt([e,qe(t),la(X,t)]);return r}var gb=G(so($c,{toCode:()=>({runtime:\"Schema.Json\",Type:\"Schema.Json\"})})),fee=la(X,gb),lee=Ue({message:X,name:Qc(X),stack:Qc(X),cause:Qc(gb)}),pee=G(so(WC,{toCode:()=>({runtime:\"Schema.MutableJson\",Type:\"Schema.MutableJson\"})}));function dee(e){return gs(e.ast)}function mee(e){return e.ast.context?.annotations}var ML=\"~effect/MutableHashMap\";var hee={[ML]:ML,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${L(Array.from(this))})`},toJSON(){return{_id:\"MutableHashMap\",values:$t(Array.from(this))}},[Ee](){return this.toJSON()},pipe(){return K(this,arguments)}},Um=()=>{let e=Object.create(hee);return e.backing=new Map,e.buckets=new Map,e};var Ts=l(2,(e,t)=>{if(e.backing.has(t))return O(e.backing.get(t));if(mA(t))return v();let r=H(t),n=e.buckets.get(r);return n===void 0?v():xee(e,n,t)}),mA=e=>typeof e!=\"object\"&&typeof e!=\"function\";var xee=(e,t,r)=>{for(let n=0,o=t.length;n<o;n++)if(J(r,t[n])){let s=t[n];return O(e.backing.get(s))}return v()};var Nm=l(3,(e,t,r)=>{if(e.backing.has(t)||mA(t))return e.backing.set(t,r),e;let n=H(t),o=e.buckets.get(n);if(o===void 0)return e.buckets.set(n,[t]),e.backing.set(t,r),e;let s=gee(o,t);return s===void 0&&(o.push(t),s=t),e.backing.set(s,r),e}),gee=(e,t)=>{for(let r=0,n=e.length;r<n;r++)if(J(t,e[r]))return e[r]};var dl=l(2,(e,t)=>{if(mA(t))return e.backing.delete(t),e;let r=H(t),n=e.buckets.get(r);if(n===void 0)return e;for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a===t||J(t,a)){e.backing.delete(a),n.splice(o,1);break}}return n.length===0&&e.buckets.delete(r),e}),bb=e=>(e.backing.clear(),e.buckets.clear(),e),FL=e=>e.backing.size;var ml=UE;var li=NE,UL=Y_,Ho=Gi;var NL=Wi,DL=eR;var hl=zs,ws=VP;var Sn=wI,LL=rM;var $L=\"~effect/MutableRef\",yee={[$L]:$L,...Et,toJSON(){return{_id:\"MutableRef\",current:$t(this.current)}}},xl=e=>{let t=Object.create(yee);return t.current=e,t};var BL=e=>e.current;var Eb=l(2,(e,t)=>(e.current=t,e));var jr=Symbol.for(\"effect/MutableList/Empty\"),da=()=>({head:void 0,tail:void 0,length:0}),gA=e=>{let t=e.head;t.offset>=1024&&t===e.tail&&t.mutable&&(t.array.length-t.offset)*8<=t.offset&&(e.head=e.tail={array:t.array.slice(t.offset),mutable:!0,offset:0,next:void 0})},zL=()=>({array:[],mutable:!0,offset:0,next:void 0}),Wo=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=zL(),e.tail=e.tail.next):e.head=e.tail=zL(),e.tail.array.push(t),e.length++},yA=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||(e.tail=e.head),e.length++};var Ib=(e,t)=>Tb(e,be(t),!Array.isArray(t)),Tb=(e,t,r=!1)=>{if(t.length===0)return 0;let n={array:t,mutable:r,offset:0,next:void 0};return e.head?e.tail=e.tail.next=n:e.head=e.tail=n,e.length+=t.length,t.length},pa=e=>{e.head=e.tail=void 0,e.length=0},nu=(e,t)=>{if(t=it(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return pa(e),s}let r=new Array(t),n=0,o=e.head;for(;o;){for(;o.offset<o.array.length;)if(r[n++]=o.array[o.offset],o.mutable&&(o.array[o.offset]=void 0),o.offset++,n===t)return e.head=o.offset===o.array.length&&o.next?o.next:o,e.length-=t,e.length===0?pa(e):gA(e),r;o=o.next}return pa(e),r},Dm=(e,t)=>{if(t=it(t),t<=0||!e.head)return;if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){pa(e);return}let r=0,n=e.head;for(;n;){let o=n.array.length-n.offset;if(r+o>t){n.offset+=t-r,e.head=n,e.length-=t,gA(e);return}r+=o,n=n.next}pa(e)},ma=e=>nu(e,e.length),ou=e=>{if(!e.head)return jr;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:pa(e):gA(e),t},jL=(e,t)=>{if(t=it(t),t<=0)return[];let r=Math.min(t,e.length),n=new Array(r),o=0,s=e.head;for(;s;){for(let a=s.offset;a<s.array.length;a++)if(n[o++]=s.array[a],o===r)return n;s=s.next}return n};var bA=(e,t)=>{let r=[],n=e.head,o=0;for(;n;){for(let s=n.offset;s<n.array.length;s++)t(n.array[s],o++)&&r.push(n.array[s]);n=n.next}if(r.length===0){pa(e);return}e.head=e.tail={array:r,mutable:!0,offset:0,next:void 0},e.length=r.length},qL=(e,t)=>bA(e,r=>r!==t);var bee=\"~effect/PubSub\";var See=\"~effect/PubSub/Subscription\",vb=e=>j(()=>kee(e.atomicPubSub(),new Map,an(),Sn(!1),xl(!1),e.strategy(),xl(v()))),Ob=e=>vb({atomicPubSub:()=>RA(e),strategy:()=>new Cb}),_b=e=>vb({atomicPubSub:()=>RA(e),strategy:()=>new kb}),Rb=e=>vb({atomicPubSub:()=>RA(e),strategy:()=>new _A}),Lm=e=>vb({atomicPubSub:()=>HL(e),strategy:()=>new kb}),RA=e=>{let t=typeof e==\"number\"?{capacity:e}:e;if(Aee(t.capacity),t.capacity===1/0)return HL(t);let r=t.replay&&t.replay>0?new Ab(Math.ceil(t.replay)):void 0;return t.capacity===1?new wA(r):TF(t.capacity)===t.capacity?new IA(t.capacity,r):new SA(t.capacity,r)},HL=e=>{let t=e?.replay;return new kA(t&&t>0?new Ab(Math.ceil(t)):void 0)};var $m=e=>ta(wr(t=>(Eb(e.shutdownFlag,!0),De(e.scope,MI(t.id)).pipe(Dr(e.strategy.shutdown),pg(e.shutdownHook.open),qa)))),Pb=l(2,(e,t)=>j(()=>Eee(e,t))),Eee=l(2,(e,t)=>{if(e.shutdownFlag.current||Oe(e.ended.current))return!1;if(Eb(e.ended,O(t)),e.strategy instanceof Cb)for(let[n,o,s]of ma(e.strategy.publishers))s&&_n(o,Fr(!1));let r=Fr(t);for(let n of e.subscribers.values())for(let o of n){let s;for(;(s=ou(o))!==jr;)_n(s,r)}return e.subscribers.clear(),!0});var Mb=l(2,(e,t)=>$(()=>e.shutdownFlag.current||Oe(e.ended.current)?b(!1):e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),b(!0)):e.strategy.handleSurplus(e.pubsub,e.subscribers,[t],e.shutdownFlag))),WL=l(2,(e,t)=>e.shutdownFlag.current||Oe(e.ended.current)?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),JL=l(2,(e,t)=>$(()=>{if(e.shutdownFlag.current||Oe(e.ended.current))return b(!1);let r=e.pubsub.publishAll(t);return e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),r.length===0?b(!0):e.strategy.handleSurplus(e.pubsub,e.subscribers,r,e.shutdownFlag)})),Bm=e=>ta(cd(t=>{let r=Ie(t,Ur),n=wt(e.scope),o=Cee(e.pubsub,e.subscribers,e.strategy,e.ended);return Ir(n,Iee(o)).pipe(Dr(cs(r,s=>De(n,s))),Vt(o))})),Iee=e=>ta(wr(t=>(Eb(e.shutdownFlag,!0),za(ma(e.pollers),r=>Dp(r,t.id),{discard:!0,concurrency:\"unbounded\"}).pipe(Cr(()=>j(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),pg(e.shutdownHook.open),qa)))),Fb=e=>$(()=>{if(e.shutdownFlag.current)return un;if(e.replayWindow.remaining>0){let r=e.replayWindow.take();return b(r)}let t=e.pollers.length===0?e.subscription.poll():jr;return t===jr?KL(e):(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),b(t))}),GL=e=>$(function t(r){if(e.shutdownFlag.current)return un;let n=e.pollers.length===0?e.subscription.pollUpTo(Number.POSITIVE_INFINITY):[];return r&&(n=r.concat(n)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?b(e.replayWindow.takeAll().concat(n)):gr(n)?b(n):T(KL(e),o=>t([o]))}),KL=e=>If(t=>{if(e.shutdownFlag.current)return t(un);if(Oe(e.ended.current))return t(b(e.ended.current.value));let r=ko(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),Wo(e.pollers,r),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),r.effect?t(r.effect):(r.resumes=[t],j(()=>qL(e.pollers,r)))});var Mt=Symbol.for(\"effect/PubSub/AbsentValue\"),Tee=(e,t,r)=>{e.has(t)||e.set(t,new Set),e.get(t).add(r)},wee=(e,t,r)=>{if(!e.has(t))return;let n=e.get(t);n.delete(r),n.size===0&&e.delete(t)},Cee=(e,t,r,n)=>new vA(e,t,e.subscribe(),da(),Sn(!1),xl(!1),r,e.replayWindow(),n),SA=class{array;replayIndices;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new gl(this.replayBuffer):Ub}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex%this.capacity;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=be(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,a=Math.min(n,s);if(a===0)return r;let i=0,c=this.publisherIndex+a;for(;this.publisherIndex!==c;){let u=r[i++],f=this.publisherIndex%this.capacity;this.array[f]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[f]=p),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return r.slice(i)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex%this.capacity,r=this.array[t];this.array[t]=Mt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new EA(this,this.publisherIndex,!1)}},EA=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return jr;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex%this.self.capacity,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Mt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return jr}pollUpTo(t){if(t=it(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let a=this.subscriberIndex%this.self.capacity,i=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=Mt,this.self.subscribersIndex+=1),o.push(i),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex%this.self.capacity;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Mt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},IA=class{array;replayIndices;mask;publisherIndex=0;subscribers;subscriberCount=0;subscribersIndex=0;capacity;replayBuffer;constructor(t,r){this.capacity=t,this.replayBuffer=r,this.array=Array.from({length:t}),this.replayIndices=r?Array.from({length:t}):[],this.mask=t-1,this.subscribers=Array.from({length:t})}replayWindow(){return this.replayBuffer?new gl(this.replayBuffer):Ub}isEmpty(){return this.publisherIndex===this.subscribersIndex}isFull(){return this.publisherIndex===this.subscribersIndex+this.capacity}size(){return this.publisherIndex-this.subscribersIndex}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);if(this.subscriberCount!==0){let n=this.publisherIndex&this.mask;this.array[n]=t,r!==void 0&&(this.replayIndices[n]=r),this.subscribers[n]=this.subscriberCount,this.publisherIndex+=1}return!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=be(t),n=r.length,o=this.publisherIndex-this.subscribersIndex,s=this.capacity-o,a=Math.min(n,s);if(a===0)return r;let i=0,c=this.publisherIndex+a;for(;this.publisherIndex!==c;){let u=r[i++],f=this.publisherIndex&this.mask;this.array[f]=u;let p=this.replayBuffer?.offer(u);p!==void 0&&(this.replayIndices[f]=p),this.subscribers[f]=this.subscriberCount,this.publisherIndex+=1}return r.slice(i)}slide(){if(this.subscribersIndex!==this.publisherIndex){let t=this.subscribersIndex&this.mask,r=this.array[t];this.array[t]=Mt,this.subscribers[t]=0,this.subscribersIndex+=1,this.replayBuffer?.slide(r,this.replayIndices[t])}}subscribe(){return this.subscriberCount+=1,new TA(this,this.publisherIndex,!1)}},TA=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.publisherIndex===this.subscriberIndex||this.self.publisherIndex===this.self.subscribersIndex}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return jr;if(this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex),this.subscriberIndex!==this.self.publisherIndex){let t=this.subscriberIndex&this.self.mask,r=this.self.array[t];return this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Mt,this.self.subscribersIndex+=1),this.subscriberIndex+=1,r}return jr}pollUpTo(t){if(t=it(t),this.unsubscribed)return[];this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);let r=this.self.publisherIndex-this.subscriberIndex,n=Math.min(t,r);if(n<=0)return[];let o=[],s=this.subscriberIndex+n;for(;this.subscriberIndex!==s;){let a=this.subscriberIndex&this.self.mask,i=this.self.array[a];this.self.subscribers[a]-=1,this.self.subscribers[a]===0&&(this.self.array[a]=Mt,this.self.subscribersIndex+=1),o.push(i),this.subscriberIndex+=1}return o}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.subscriberCount-=1,this.subscriberIndex=Math.max(this.subscriberIndex,this.self.subscribersIndex);this.subscriberIndex!==this.self.publisherIndex;){let t=this.subscriberIndex&this.self.mask;this.self.subscribers[t]-=1,this.self.subscribers[t]===0&&(this.self.array[t]=Mt,this.self.subscribersIndex+=1),this.subscriberIndex+=1}}},wA=class{publisherIndex=0;subscriberCount=0;subscribers=0;value=Mt;replayIndex=0;capacity=1;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new gl(this.replayBuffer):Ub}pipe(){return K(this,arguments)}isEmpty(){return this.subscribers===0}isFull(){return!this.isEmpty()}size(){return this.isEmpty()?0:1}publish(t){if(this.isFull())return!1;let r=this.replayBuffer?.offer(t);return this.subscriberCount!==0&&(this.value=t,r!==void 0&&(this.replayIndex=r),this.subscribers=this.subscriberCount,this.publisherIndex+=1),!0}publishAll(t){if(this.subscriberCount===0)return this.replayBuffer&&this.replayBuffer.offerAll(t),[];let r=be(t);return r.length===0?r:this.publish(r[0])?r.slice(1):r}slide(){if(this.isFull()){let t=this.value;this.subscribers=0,this.value=Mt,this.replayBuffer?.slide(t,this.replayIndex)}}subscribe(){return this.subscriberCount+=1,new CA(this,this.publisherIndex,!1)}},CA=class{self;subscriberIndex;unsubscribed;constructor(t,r,n){this.self=t,this.subscriberIndex=r,this.unsubscribed=n}isEmpty(){return this.unsubscribed||this.self.subscribers===0||this.subscriberIndex===this.self.publisherIndex}size(){return this.isEmpty()?0:1}poll(){if(this.isEmpty())return jr;let t=this.self.value;return this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Mt),this.subscriberIndex=this.self.publisherIndex,t}pollUpTo(t){return it(t)<1||this.isEmpty()?[]:[this.poll()]}unsubscribe(){this.unsubscribed||(this.unsubscribed=!0,this.self.subscriberCount-=1,this.self.subscribers!==0&&this.subscriberIndex!==this.self.publisherIndex&&(this.self.subscribers-=1,this.self.subscribers===0&&(this.self.value=Mt)))}},kA=class{publisherHead={value:Mt,replayIndex:void 0,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=Number.MAX_SAFE_INTEGER;replayBuffer;constructor(t){this.replayBuffer=t}replayWindow(){return this.replayBuffer?new gl(this.replayBuffer):Ub}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(t){let r=this.replayBuffer?.offer(t),n=this.publisherTail.subscribers;if(n!==0){let o={value:t,replayIndex:r,subscribers:n,next:null};this.publisherTail.next=o,this.publisherTail=this.publisherTail.next,this.publisherIndex+=1}return!0}publishAll(t){if(this.publisherTail.subscribers!==0)for(let r of t)this.publish(r);else this.replayBuffer&&this.replayBuffer.offerAll(t);return[]}slide(){if(this.publisherHead!==this.publisherTail){let t=this.publisherHead.next,r=t.value;this.publisherHead=this.publisherHead.next,this.publisherHead.value=Mt,this.subscribersIndex+=1,this.replayBuffer?.slide(r,t.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new AA(this,this.publisherTail,this.publisherIndex,!1)}},AA=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(t,r,n,o){this.self=t,this.subscriberHead=r,this.subscriberIndex=n,this.unsubscribed=o}isEmpty(){if(this.unsubscribed)return!0;let t=!0,r=!0;for(;r;)this.subscriberHead===this.self.publisherTail?r=!1:this.subscriberHead.next.value!==Mt?(t=!1,r=!1):(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1);return t}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return jr;let t=!0,r=jr;for(;t;)if(this.subscriberHead===this.self.publisherTail)t=!1;else{let n=this.subscriberHead.next.value;n!==Mt&&(r=n,this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Mt,this.self.subscribersIndex+=1),t=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return r}pollUpTo(t){t=it(t);let r=[],n=0;for(;n!==t;){let o=this.poll();o===jr?n=t:(r.push(o),n+=1)}return r}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,this.self.publisherTail.subscribers-=1;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==Mt&&(this.subscriberHead.subscribers-=1,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Mt,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},vA=class{[See]={_A:A};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;ended;constructor(t,r,n,o,s,a,i,c,u){this.pubsub=t,this.subscribers=r,this.subscription=n,this.pollers=o,this.shutdownHook=s,this.shutdownFlag=a,this.strategy=i,this.replayWindow=c,this.ended=u}pipe(){return K(this,arguments)}},OA=class{[bee]={_A:A};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;ended;constructor(t,r,n,o,s,a,i){this.pubsub=t,this.subscribers=r,this.scope=n,this.shutdownHook=o,this.shutdownFlag=s,this.strategy=a,this.ended=i}pipe(){return K(this,arguments)}},kee=(e,t,r,n,o,s,a)=>new OA(e,t,r,n,o,s,a),Aee=e=>{if(e<=0)throw new Error(`Cannot construct PubSub with capacity of ${e}`)},Cb=class{publishers=da();get shutdown(){return wr(t=>za(ma(this.publishers),([r,n,o])=>o?Dp(n,t.id):te,{concurrency:\"unbounded\",discard:!0}))}handleSurplus(t,r,n,o){return If(s=>{let a=ko();return this.offerUnsafe(n,a),this.onPubSubEmptySpaceUnsafe(t,r),this.completeSubscribersUnsafe(t,r),BL(o)?(this.removeUnsafe(a),s(un)):a.effect?s(a.effect):(a.resumes=[s],j(()=>this.removeUnsafe(a)))})}onPubSubEmptySpaceUnsafe(t,r){let n=!0;for(;n&&!t.isFull();){let o=ou(this.publishers);if(o===jr)n=!1;else{let[s,a]=o,i=t.publish(s);i&&o[2]?_n(a,Fr(!0)):i||yA(this.publishers,o),this.completeSubscribersUnsafe(t,r)}}}completePollersUnsafe(t,r,n,o){return PA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return MA(this,t,r)}offerUnsafe(t,r){let n=t[Symbol.iterator](),o=n.next();if(!o.done)for(;;){let s=o.value;if(o=n.next(),o.done){Wo(this.publishers,[s,r,!0]);break}Wo(this.publishers,[s,r,!1])}}removeUnsafe(t){bA(this.publishers,([r,n])=>n!==t)}},kb=class{get shutdown(){return te}handleSurplus(t,r,n,o){return b(!1)}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return PA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return MA(this,t,r)}},_A=class{get shutdown(){return te}handleSurplus(t,r,n,o){return j(()=>(this.slidingPublishUnsafe(t,n),this.completeSubscribersUnsafe(t,r),!0))}onPubSubEmptySpaceUnsafe(t,r){}completePollersUnsafe(t,r,n,o){return PA(this,t,r,n,o)}completeSubscribersUnsafe(t,r){return MA(this,t,r)}slidingPublishUnsafe(t,r){let n=r[Symbol.iterator](),o=n.next();if(!o.done&&t.capacity>0){let s=o.value,a=!0;for(;a;){t.slide();let i=t.publish(s);i&&(o=n.next())&&!o.done?s=o.value:i&&(a=!1)}}}},PA=(e,t,r,n,o)=>{let s=!0;for(;s&&!n.isEmpty();){let a=ou(o);if(a===jr)wee(r,n,o),o.length===0?s=!1:Tee(r,n,o);else{let i=n.poll();i===jr?yA(o,a):(_n(a,Fr(i)),e.onPubSubEmptySpaceUnsafe(t,r))}}},MA=(e,t,r)=>{for(let[n,o]of r)for(let s of o)e.completePollersUnsafe(t,r,n,s)},Ab=class{capacity;head={value:Mt,index:0,next:null};tail=this.head;slideValues=[];size=0;index=0;publisherIndex=0;constructor(t){this.capacity=t}slide(t,r){this.slideValues[this.index%this.capacity]={value:t,index:r},this.index++}offer(t){let r=this.publisherIndex++;return this.tail.value=t,this.tail.index=r,this.tail.next={value:Mt,index:0,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1,r}offerAll(t){for(let r of t)this.offer(r)}},gl=class{buffer;values;index=0;remaining;slideIndex;newestIndex=-1;constructor(t){this.buffer=t,this.remaining=t.size,this.slideIndex=t.index,this.values=new Array(this.remaining);let r=t.head;for(let n=0;n<this.remaining;n++)this.values[n]=r.value,this.newestIndex=r.index,r=r.next}close(){this.values.length=0,this.remaining=0}sync(){let t=this.buffer.index-this.slideIndex;if(t===0||this.remaining===0)return;let r=Math.min(t,this.buffer.capacity),n=this.buffer.index-r;for(let o=0;o<r;o++){let s=this.buffer.slideValues[(n+o)%this.buffer.capacity];s.index>this.newestIndex&&(this.index=(this.index+1)%this.values.length,this.values[(this.index+this.remaining-1)%this.values.length]=s.value,this.newestIndex=s.index)}this.slideIndex=this.buffer.index}take(){if(this.remaining===0)return;this.sync();let t=this.values[this.index];return this.values[this.index]=Mt,this.index=(this.index+1)%this.values.length,this.remaining--,this.remaining===0&&this.close(),t}takeN(t){t=it(t);let r=Math.min(t,this.remaining),n=new Array(r);for(let o=0;o<r;o++)n[o]=this.take();return n}takeAll(){return this.takeN(this.remaining)}},Ub={remaining:0,take:()=>{},takeN:()=>[],takeAll:()=>[],close:()=>{}};var jb={};$e(jb,{asDequeue:()=>Pee,asEnqueue:()=>Ree,await:()=>qee,bounded:()=>bl,clear:()=>Lee,collect:()=>$ee,dropping:()=>Uee,end:()=>qm,endUnsafe:()=>Hm,fail:()=>Nee,failCause:()=>Ft,failCauseUnsafe:()=>ha,flush:()=>jee,flushUnsafe:()=>e$,interrupt:()=>Dee,into:()=>Jee,isDequeue:()=>_ee,isEnqueue:()=>Oee,isFull:()=>Wee,isFullUnsafe:()=>t$,isQueue:()=>vee,make:()=>Xr,offer:()=>En,offerAll:()=>pi,offerAllUnsafe:()=>jm,offerUnsafe:()=>zm,peek:()=>XL,poll:()=>zee,shutdown:()=>io,shutdownUnsafe:()=>YL,size:()=>Hee,sizeUnsafe:()=>$b,sliding:()=>Fee,take:()=>Cs,takeAll:()=>di,takeBetween:()=>Lb,takeN:()=>Bee,takeUnsafe:()=>NA,unbounded:()=>UA});var VL=\"~effect/Queue\",ZL=\"~effect/Queue/Enqueue\",QL=\"~effect/Queue/Dequeue\",vee=e=>w(e,VL),Oee=e=>w(e,ZL),_ee=e=>w(e,QL),Ree=e=>e,Pee=A,FA={_A:A,_E:A},Mee={[VL]:FA,[ZL]:FA,[QL]:FA,...Et,toJSON(){return{_id:\"effect/Queue\",state:this.state._tag,size:$b(this)}}},Xr=e=>re(t=>{let r=Object.create(Mee);return r.dispatcher=t.currentDispatcher,r.capacity=e?.capacity??Number.POSITIVE_INFINITY,r.strategy=e?.strategy??\"suspend\",r.messages=da(),r.scheduleRunning=!1,r.state={_tag:\"Open\",takers:new Set,offers:new Set,awaiters:new Set},_(r)}),bl=e=>Xr({capacity:e}),Fee=e=>Xr({capacity:e,strategy:\"sliding\"}),Uee=e=>Xr({capacity:e,strategy:\"dropping\"}),UA=()=>Xr(),En=l(2,(e,t)=>W(()=>zm(e,t)?Bb:e.state._tag===\"Open\"&&e.strategy===\"suspend\"?Zee(e,t):r$)),zm=(e,t)=>e.state._tag!==\"Open\"?!1:e.messages.length>=e.capacity?e.strategy===\"sliding\"?(ou(e.messages),Wo(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(Wo(e.messages,t),DA(e),!0):!1:(Wo(e.messages,t),Db(e),!0),pi=l(2,(e,t)=>Tt(r=>{let n=jm(e,t);return n.length===0||e.strategy===\"dropping\"?r(Ae(n)):n$(e,{_tag:\"Array\",remaining:n,offset:0,resume:r})})),jm=(e,t)=>{if(e.state._tag!==\"Open\")return be(t);if(e.capacity===Number.POSITIVE_INFINITY||e.strategy===\"sliding\")return Ib(e.messages,t),e.strategy===\"sliding\"&&nu(e.messages,e.messages.length-e.capacity),Db(e),[];let r=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(r===0)return be(t);let n=[],o=0;for(let s of t)o<r?Wo(e.messages,s):n.push(s),o++;return Db(e),n},Nee=l(2,(e,t)=>Ft(e,Oi(t))),Ft=l(2,(e,t)=>V(()=>ha(e,t))),ha=(e,t)=>{if(e.state._tag!==\"Open\")return!1;let r=ur(t),n=OR(r,Gee);return e.state.offers.size===0&&e.messages.length===0?(zb(e,n),!0):(e.state={...e.state,_tag:\"Closing\",exit:n},Db(e),!0)},qm=e=>Ft(e,Oi(Pi())),Hm=e=>ha(e,Oi(Pi())),Dee=e=>re(t=>Ft(e,$s(t.id))),io=e=>V(()=>YL(e)),YL=e=>{if(e.state._tag===\"Done\")return!1;pa(e.messages);let t=e.state.offers;zb(e,e.state._tag===\"Open\"?Kee:e.state.exit);for(let r of t)o$(r);return!0},Lee=e=>W(()=>{if(e.state._tag===\"Done\")return ls(e.state.exit.cause)?_([]):e.state.exit;let t=Qee(e);return yl(e),_(t)}),di=e=>Lb(e,1,Number.POSITIVE_INFINITY),$ee=e=>W(()=>{let t=Ot();return Kt(Qe(To({while:mr,body:Ne(di(e)),step(r){for(let n=0;n<r.length;n++)t.push(r[n])}}),()=>le),t)}),Bee=l(2,(e,t)=>Lb(e,t,t)),Lb=l(3,(e,t,r)=>(t=it(t),r=it(r),W(()=>Vee(e,t,r)??br($A(e,()=>LA(e,t)),Lb(e,t,r))))),Cs=e=>W(()=>NA(e)??br($A(e,()=>LA(e,1)),Cs(e))),zee=e=>W(()=>{let t=NA(e);return t===void 0?_(v()):t._tag===\"Success\"?_(O(t.value)):_(v())}),XL=e=>W(()=>e.state._tag===\"Done\"?e.state.exit:e.messages.length>0&&e.messages.head?_(e.messages.head.array[e.messages.head.offset]):br($A(e,()=>e.messages.length>0),XL(e))),NA=e=>{if(e.state._tag===\"Done\")return e.state.exit;if(e.messages.length>0){let t=ou(e.messages);return yl(e),Ae(t)}else if(e.capacity<=0&&e.state.offers.size>0){let t=BA(e.state.offers);return yl(e),Ae(t)}},e$=e=>DA(e),jee=e=>V(()=>e$(e)),qee=e=>Tt(t=>{let r=n=>t(Qe(n,()=>yr));return e.state._tag===\"Done\"?r(e.state.exit):(e.state.awaiters.add(r),V(()=>{e.state._tag!==\"Done\"&&e.state.awaiters.delete(r)}))});var Hee=e=>V(()=>$b(e)),Wee=e=>V(()=>t$(e)),$b=e=>e.state._tag===\"Done\"?0:e.messages.length,t$=e=>$b(e)===e.capacity,Jee=l(2,(e,t)=>Vr(r=>yo(r(e),{onFailure:n=>Ft(t,n),onSuccess:n=>qm(t)}))),r$=Ae(!1),Bb=Ae(!0),Gee=en(Pi()),Kee=Ju(),DA=e=>{if(!(e.state._tag===\"Done\"||e.state.takers.size===0)){for(let t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(yr),e.messages.length===0))break}},Db=e=>{e.scheduleRunning||e.state._tag===\"Done\"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,DA(e)},0))},Vee=(e,t,r)=>{if(e.state._tag===\"Done\")return e.state.exit;if(r<=0||t<=0)return Ae([]);if(!LA(e,t))return;let n=e.messages.length>0?nu(e.messages,r):[BA(e.state.offers)];return yl(e),Ae(n)},LA=(e,t)=>e.messages.length>=(e.state._tag===\"Closing\"?1:Math.min(t,e.capacity||1))||e.capacity<=0&&e.state._tag!==\"Done\"&&e.state.offers.size>0,$A=(e,t)=>Tt(r=>{if(e.state._tag===\"Done\")return r(e.state.exit);if(t())return r(yr);let n={ready:t,resume:r};return e.state.takers.add(n),V(()=>{e.state._tag!==\"Done\"&&e.state.takers.delete(n)})}),Zee=(e,t)=>Tt(r=>zm(e,t)?r(Bb):n$(e,{_tag:\"Single\",message:t,resume:r})),n$=(e,t)=>{if(e.state._tag!==\"Open\")return o$(t);let r=e.state.offers;return r.add(t),V(()=>{e.state._tag!==\"Done\"&&(r.delete(t),e.state._tag===\"Closing\"&&r.size===0&&e.messages.length===0&&zb(e,e.state.exit))})},o$=e=>e._tag===\"Single\"?e.resume(r$):e.resume(Ae(e.remaining.slice(e.offset))),BA=e=>{let t=e.values().next().value;if(t._tag===\"Single\")return e.delete(t),t.resume(Bb),t.message;let r=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(Ae([]))),r},yl=e=>{if(e.state._tag===\"Done\")return ls(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===\"Closing\"&&e.messages.length===0?(zb(e,e.state.exit),ls(e.state.exit.cause)):!1;for(let t of e.state.offers){let r=e.capacity-e.messages.length;if(r<=0)break;if(t._tag===\"Single\")Wo(e.messages,t.message),e.state.offers.delete(t),t.resume(Bb);else{for(;t.offset<t.remaining.length;t.offset++){if(r===0)return!1;Wo(e.messages,t.remaining[t.offset]),r--}e.state.offers.delete(t),t.resume(Ae([]))}}return!1},Qee=e=>{if(e.messages.length>0){let t=ma(e.messages);return yl(e),t}else if(e.state._tag!==\"Done\"&&e.state.offers.size>0){let t=[BA(e.state.offers)];return yl(e),t}return[]},zb=(e,t)=>{if(e.state._tag===\"Done\")return;let r=e.state;e.state={_tag:\"Done\",exit:t};for(let n of r.takers)n.resume(t);r.takers.clear();for(let n of r.awaiters)n(t);r.awaiters.clear()};var zA={};$e(zA,{make:()=>Yee,makeUnsafe:()=>Wm,release:()=>ste,releaseAll:()=>ate,resize:()=>Xee,take:()=>nte,takeIfAvailable:()=>ote,withPermit:()=>tte,withPermits:()=>ete,withPermitsIfAvailable:()=>rte});var Wm=e=>new qb(e),s$=(e,t,r)=>Tt(n=>{if(e.free>=t)return n(r);let o=()=>{e.free<t||(e.waiters.delete(o),n(r))};return e.waiters.add(o),V(()=>{e.waiters.delete(o)})}),qb=class{waiters=new Set;taken=0;permits;constructor(t){this.permits=t}get free(){return this.permits-this.taken}take(t){let r=W(()=>this.free<t?s$(this,t,r):(this.taken+=t,_(t)));return r}takeIfAvailable(t){return W(()=>this.free<t?_(!1):(this.taken+=t,_(!0)))}releaseUnsafe(t,r){return this.taken-=r,this.waiters.size>0&&t.currentDispatcher.scheduleTask(()=>{for(let n of this.waiters){if(this.free<=0)break;n()}},0),this.free}resize(t){return re(r=>(this.permits=t,this.free<0?le:(this.releaseUnsafe(r,0),le)))}release(t){return re(r=>_(this.releaseUnsafe(r,t)))}get releaseAll(){return re(t=>_(this.releaseUnsafe(t,this.taken)))}withPermits(t){return r=>Vr(n=>{let o=W(()=>{if(this.free<t){let s=s$(this,t,le);return B(n(s),()=>o)}return this.taken+=t,Io(n(r),()=>{this.releaseUnsafe(zs(),t)},!0)});return o})}withPermit=this.withPermits(1);withPermitsIfAvailable(t){return r=>Vr(n=>this.free<t?Vi:(this.taken+=t,Io(n(Hu(r)),()=>{this.releaseUnsafe(zs(),t)},!0)))}},Yee=e=>V(()=>new qb(e)),Xee=l(2,(e,t)=>e.resize(t)),ete=(e,t,r)=>{let n=e.withPermits(t);return r?n(r):n},tte=(e,t)=>t?e.withPermit(t):e.withPermit,rte=(e,t,r)=>{let n=e.withPermitsIfAvailable(t);return r?n(r):n},nte=l(2,(e,t)=>e.take(t)),ote=l(2,(e,t)=>e.takeIfAvailable(t)),ste=l(2,(e,t)=>e.release(t)),ate=e=>e.releaseAll;var jA=e=>Np(e)?je(e)?Z(e.value):e:b(e);var u$=\"~effect/Channel\",kr=e=>w(e,u$),ite={[u$]:{_Env:A,_InErr:A,_InElem:A,_OutErr:A,_OutElem:A},pipe(){return K(this,arguments)}},ke=e=>{let t=Object.create(ite);return t.transform=(r,n)=>_t(e(r,n),o=>b(Ct(o))),t},Go=(e,t)=>ke((r,n)=>T(me(e)(r,n),o=>t(o,n))),dr=e=>ke((t,r)=>e),Ko=e=>ke(we(function*(t,r){let n=wt(r),o=a=>De(n,E0(a)),s=yield*Ao(e(t,r,n),o);return Ao(s,o)})),me=e=>e.transform,Jm=4096,cte=(e,t,r)=>Xr({capacity:r?.bufferSize,strategy:r?.strategy}).pipe(Cr(n=>Ir(e,io(n))),Cr(n=>Zt(Zn(t(n),e),e)));var f$=(e,t)=>ke((r,n)=>q(cte(n,e,t),di)),Hb=e=>ke((t,r)=>$(()=>me(e())(t,r))),ute=(e,t,r)=>Ko(we(function*(n,o,s){let a=v();yield*cs(s,c=>Oe(a)?r(a.value,c):te);let i=yield*ta(e);return a=O(i),yield*me(t(i))(n,o)}));var l$=e=>dr(j(()=>{let t=e();return $(()=>{let r=t.next();return r.done?Z(r.value):b(r.value)})})),qA=e=>dr(j(()=>{let t=0;return $(()=>t>=e.length?Z():b(e[t++]))}));var HA=(e,t=Jm)=>{let r=Wn(t);return dr(j(()=>{let n=e(),o=v();return $(()=>{if(o._tag===\"Some\")return Z(o.value);let s=[];for(;s.length<r;){let a=n.next();if(a.done){if(s.length===0)return Z(a.value);o=O(a.value);break}s.push(a.value)}return b(s)})}))};var p$=(e,t=Jm)=>HA(()=>e[Symbol.iterator](),t),Wb=e=>Jb(b(e));var d$=e=>Jb(j(e)),Sl=dr(b(Z())),m$=dr(b(hc)),ks=e=>dr(b(M(e))),h$=e=>dr(ug(e)),Gm=e=>dr(Ct(e)),x$=e=>dr(Ys(e)),WA=e=>Gm(sc(e)),Jb=e=>dr(j(()=>{let t=!1;return $(()=>t?Z():(t=!0,e))}));var g$=e=>dr(T(e,()=>Z())),JA=e=>dr(b(T(e,jA)));var y$=e=>dr(b(di(e)));var GA=e=>dr(b(Q0(GL(e),()=>Z())));var b$=e=>mi(q(Bm(e),GA)),S$=e=>mi(q(Bm(e),t=>JA(Fb(t))));var E$=e=>ke((t,r)=>fte({scope:r,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd}));var fte=e=>{let t=e.readable.getReader(),r=e.exit??xl(void 0),n=$(()=>r.current?r.current:xc(Ef({try:()=>t.read(),catch:e.onError}),{onFailure:o=>r.current??Ct(o),onSuccess:({done:o,value:s})=>r.current?r.current:o?Z():b(Te(s))}));return Vt(Ir(e.scope,e.releaseLockOnEnd?j(()=>t.releaseLock()):cg(()=>t.cancel().catch(vr))),n)},lte=(e,t)=>ke(we(function*(r,n){let o=e[Symbol.asyncIterator]();return o.return&&(yield*Ir(n,cg(()=>o.return()))),T(Ef({try:()=>o.next(),catch:t}),s=>s.done?Z(s.value):b(s.value))})),I$=(e,t)=>Vo(lte(e,t),Te),Vo=l(2,(e,t)=>Go(e,r=>j(()=>{let n=0;return q(r,o=>t(o,n++))})));var T$=e=>e===void 0||e!==\"unbounded\"&&e<=1,Gb=l(e=>kr(e[0]),(e,t,r)=>T$(r?.concurrency)?w$(e,t):pte(e,t,r)),w$=(e,t)=>ke((r,n)=>{let o=0;return q(me(e)(r,n),T(s=>t(s,o++)))}),pte=(e,t,r)=>Ko(we(function*(n,o,s){let a=0,i=yield*me(e)(n,o),c=r.concurrency===\"unbounded\"?Number.MAX_SAFE_INTEGER:r.concurrency,u=yield*bl(0);yield*Ir(s,io(u));let f=Lr(yield*Xs()),p=ws(s);if(r.unordered){let d=Wm(c),m=Ne(d.release(1)),x=xc({onFailure:g=>T(Ft(u,g),m),onSuccess:g=>T(En(u,g),m)});yield*d.take(1).pipe(T(()=>i),T(g=>{let y=a++;return p(f(x($(()=>t(g,y))))),te}),nr({disableYield:!0}),_t(g=>d.withPermits(c-1)(Ft(u,g))),Zt(s))}else{let d=yield*bl(c-2);yield*Ir(s,io(d)),yield*Cs(d).pipe(ad,T(g=>En(u,g)),nr({disableYield:!0}),_t(g=>Ft(u,g)),Zt(s));let m,x=g=>{g._tag!==\"Success\"&&(m=g.cause,ha(u,g.cause))};yield*i.pipe(T(g=>{if(m)return Ct(m);let y=a++,S=f($(()=>t(g,y)));return p(S),S.addObserver(x),En(d,li(S))}),nr({disableYield:!0}),_t(g=>En(d,sn(g)).pipe(Dr(Ft(d,g)))),Zt(s))}return Cs(u)}));var KA=l(e=>kr(e[0]),(e,t,r)=>T$(r?.concurrency)?dte(e,t):mte(e,t,r)),dte=(e,t)=>ke((r,n)=>q(me(e)(r,n),o=>{let s,a,i=T(o,u=>(a??=wt(n),ut(me(t(u))(r,a),f=>(s=c(f),s)))),c=Qe(u=>{if(s=void 0,a.state._tag===\"Empty\")return i;let f=De(a,ht);return a=void 0,T(f,()=>i)});return $(()=>s??i)})),mte=(e,t,r)=>e.pipe(Vo(t),Zb(r)),C$=l(2,(e,t)=>ke((r,n)=>j(()=>{let o,s=wt(n),a=T(me(e)(r,s),i=>(o=Qe(i,c=>De(s,ht).pipe(T(()=>me(t(c))(r,n)),T(u=>(o=u,u)))),o));return $(()=>o??a)})));var VA=l(4,(e,t,r,n)=>ke(we(function*(o,s){let a=yield*me(e)(o,s),i=yield*me(t)(o,s),c=r();return $(()=>{let u=n(c,a,i);return q(u,([f,p])=>(c=p,f))})}))),k$=l(2,(e,t)=>ke((r,n)=>j(()=>{let o,s=wt(n),a=T(me(e)(r,s),i=>{let c=i.pipe(Cr(()=>(o=i,te)),Qe(u=>De(s,Fr(u)).pipe(Dr(me(t(u))(r,n)),T(f=>(o=f,f)))));return o=c,c});return $(()=>o??a)}))),A$=e=>KA(e,A),qr=e=>Go(e,t=>{let r,n=0,o=$(function s(){if(r===void 0)return T(t,i=>{switch(i.length){case 0:return s();case 1:return b(i[0]);default:return r=i,b(i[n++])}});let a=r[n++];return n>=r.length&&(r=void 0,n=0),b(a)});return b(o)}),v$=e=>w$(e,jA),O$=e=>Go(e,t=>b(nr(t,{disableYield:!0}))),_$=l(2,(e,t)=>eo(typeof t==\"function\"?t(A):t).pipe(q(r=>{let n=rr.defaultValue();return R$(tS(e,rr,j(()=>n)),o=>r(o).pipe(q(s=>{n=s}),Qe(()=>Z(o))))}),mi)),R$=(e,t)=>ke((r,n)=>j(()=>{let o,s=()=>{let a=wt(n);return T(me(e)(r,a),i=>(o=Qe(i,c=>De(a,ht).pipe(T(()=>t(c)),T(s))),o))};return $(()=>o??s())})),P$=e=>R$(e,()=>te),M$=l(2,(e,t)=>Go(e,(r,n)=>q(gf(t),o=>Cr(r,o)))),F$=l(2,(e,t)=>ke((r,n)=>q(me(e)(r,n),o=>T(o,function s(a){return t(a)?b(a):T(o,s)}))));var U$=l(2,(e,t)=>Go(e,r=>b(T(r,function n(o){let s=[];for(let a=0;a<o.length;a++)t(o[a])&&s.push(o[a]);return ct(s)?b(s):T(r,n)})))),N$=l(2,(e,t)=>Go(e,r=>b(T(r,function n(o){let s=[];for(let a=0;a<o.length;a++){let i=t(o[a]);ze(i)&&s.push(i.success)}return ct(s)?b(s):T(r,n)})))),D$=l(2,(e,t)=>Go(e,r=>{let n=T(r,o=>q0(o,t));return b(T(n,function o(s){return ct(s)?b(s):T(n,o)}))})),L$=l(2,(e,t)=>Go(e,r=>b(T(r,function n(o){return T(H0(o,t),s=>ct(s)?b(s):T(r,n))})))),El=l(e=>kr(e[0]),(e,t,r,n)=>ke((o,s)=>q(me(e)(o,s),a=>{let i=t(),c,u=0,f,p=xc(a,{onFailure(m){f=m;let x=n?.onHalt&&n.onHalt(i);return x&&x.length>0?b([i,x]):Ct(m)},onSuccess(m){let x=r(i,m);return f_(x)?b(x):x}});return $(function m(){if(c===void 0)return f?Ct(f):T(p,([g,y])=>(i=g,y.length===0?m():y.length===1?b(y[0]):(c=y,m())));let x=c[u++];return u>=c.length&&(c=void 0,u=0),b(x)})})));var $$=l(3,(e,t,r)=>ke((n,o)=>q(me(e)(n,o),s=>{let a=t,i=!0;return $(()=>i?(i=!1,b(a)):q(T(s,c=>r(a,c)),c=>(a=c,a)))}))),Il=l(2,(e,t)=>ke((r,n)=>{let o=wt(n);return q(me(e)(r,o),s=>{let a=s.pipe(_t(i=>{if(ls(i))return Ct(i);let c=o;return o=wt(n),De(c,sn(i)).pipe(Dr(me(t(i))(r,o)),T(u=>(a=u,u)))}));return $(()=>a)})})),B$=l(2,(e,t)=>Vb(e,Hp,t)),Kb=l(2,(e,t)=>Il(e,r=>g$(T(t(r),n=>Ct(r))))),z$=l(3,(e,t,r)=>Il(e,n=>t(n)?r(n):Gm(n))),Vb=l(3,(e,t,r)=>Il(e,n=>{let o=t(n);return Q(o)?Gm(o.failure):r(o.success,n)})),Jo=l(2,(e,t)=>Vb(e,VI,r=>t(r)));var j$=l(2,(e,t)=>Go(e,r=>b(lg(r,n=>uf(n)?te:qa(t(n)))))),q$=l(e=>kr(e[0]),(e,t,r,n)=>Jo(e,o=>t(o)?r(o):n?n(o):ks(o))),H$=l(e=>kr(e[0]),(e,t,r,n)=>Jo(e,o=>{let s=t(o);return Q(s)?n?n(s.failure):ks(s.failure):r(s.success)}));var W$=l(e=>kr(e[0]),(e,t,r,n,o)=>Jo(e,s=>{if(Nt(s,t)&&w(s,\"reason\")){let a=s.reason;return Nt(a,r)?n(a,s):o?o(a,s):ks(s)}return ks(s)})),J$=l(e=>kr(e[0]),(e,t,r,n)=>{let o;return Jo(e,s=>{if(Nt(s,t)&&w(s,\"reason\")&&w(s.reason,\"_tag\")&&Hx(s.reason._tag)){let a=s.reason;return o??=new Set(Object.keys(r)),o.has(a._tag)?r[a._tag](a,s):n?n(a,s):ks(s)}return ks(s)})});var G$=l(2,(e,t)=>Jo(e,r=>ks(t(r)))),K$=e=>Jo(e,WA),V$=l(e=>kr(e[0]),(e,t)=>{if(!t?.log)return Jo(e,()=>Sl);let r=mg(t.log===!0?void 0:t.log);return Jo(Kb(e,n=>KI(n)?r(n):te),()=>Sl)}),i$=e=>Il(e,()=>Sl),Z$=l(e=>kr(e[0]),(e,t)=>{if(!t?.log)return i$(e);let r=mg(t.log===!0?void 0:t.log);return i$(Kb(e,n=>r(n)))}),Q$=l(2,(e,t)=>Hb(()=>{let r,n=rr.defaultValue(),o=tS(e,rr,j(()=>n)),s=QA(o,()=>(r=void 0,te)),a=typeof t==\"function\"?t(A):t,i=Jo(s,we(function*(c){return r||(r=yield*eo(a)),n=yield*r(c),i},(c,u)=>Qe(c,()=>b(ks(u))),mi));return i})),Y$=l(e=>kr(e[0]),(e,t,r)=>e.pipe(Vo(t),Zb({...r,concurrency:r?.concurrency??1,switch:!0}))),Zb=l(2,(e,{bufferSize:t=16,concurrency:r,switch:n=!1})=>Ko(we(function*(o,s,a){let i=r===\"unbounded\"?Number.MAX_SAFE_INTEGER:Math.max(1,r),c=n?void 0:Wm(i),u=yield*LL(!0),f=new Set,p=yield*bl(t);yield*Ir(a,io(p));let d=yield*me(e)(o,s);return yield*Zr(function*(){for(;;){let m;c&&(f.size<i?yield*c.take(1):(m=yield*kf(d),yield*Cf(c.take(1),Dr(li(m),hc))));let x=m===void 0?yield*d:yield*li(m),g=wt(a),y=yield*me(x)(o,g);for(;f.size>=i;){let E=Uh(f);f.delete(E),f.size===0&&(yield*u.open),yield*Ho(E)}let S=yield*y.pipe(Cr(()=>od),T(E=>En(p,E)),nr({disableYield:!0}),Ao(we(function*(E){let U=hf(E);if(yield*to(De(g,Q(U)?sn(U.failure):Fr(U.success.value))),!!f.has(S)&&(f.delete(S),c&&(yield*c.release(1)),f.size===0&&(yield*u.open),!ze(U)))return yield*Ft(p,E)})),kf);u.closeUnsafe(),f.add(S)}}).pipe(_t(m=>{let x=hf(m);return ze(x)?u.whenOpen(Ft(p,m)):Ft(p,m)}),Zt(a)),Cs(p)}))),Qb=l(e=>kr(e[0])&&kr(e[1]),(e,t,r)=>Ko(we(function*(n,o,s){let a=r?.haltStrategy??\"both\",i=yield*bl(0);yield*Ir(s,io(i));let c=0;function u(p,d){if(c++,!ls(d))return Ft(i,d);switch(a){case\"both\":return c===2?Ft(i,d):te;case\"left\":case\"right\":return p===a?Ft(i,d):te;case\"either\":return Ft(i,d)}}let f=(p,d,m)=>me(d)(n,m).pipe(T(x=>x.pipe(T(g=>En(i,g)),nr)),Ao(x=>Dr(De(m,E0(x)),u(p,x))),Zt(s));return yield*f(\"left\",e,wt(s)),yield*f(\"right\",t,wt(s)),Cs(i)}))),X$=l(2,(e,t)=>Qb(e,g$(t),{haltStrategy:\"left\"})),eB=()=>ke((e,t)=>j(()=>{let r=\"\",n=!1,o=v();function s(c){let u=[];function f(p){r.length===0?u.push(p):(u.push(r+p),r=\"\")}for(let p=0;p<c.length;p++){let d=c[p];if(d.length!==0){let m=0,x=d.indexOf(\"\\r\"),g=d.indexOf(`\n`);for(n&&(g===0&&(m=1,g=d.indexOf(`\n`,m)),n=!1);x!==-1||g!==-1;)x===-1||g!==-1&&g<x?(f(d.substring(m,g)),m=g+1,g=d.indexOf(`\n`,m)):(f(d.substring(m,x)),d.length===x+1?(n=!0,m=d.length,x=-1):(m=x+(g===x+1?2:1),x=d.indexOf(\"\\r\",m),g=d.indexOf(`\n`,m)));r=r+d.substring(m)}}return ct(u)?u:null}let a=$(()=>o._tag===\"Some\"?Z(o.value):uc(e,{onSuccess:i,onFailure:Ct,onDone:c=>{if(o=O(c),r.length>0){let u=r;return r=\"\",n=!1,b([u])}return Z(c)}}));function i(c){let u=s(c);return u!==null?b(u):a}return a}));var Yb=l(2,(e,t)=>ke((r,n)=>T(me(e)(r,n),o=>me(t)(o,n)))),ZA=l(2,(e,t)=>ke((r,n)=>T(me(e)(r,n),o=>{let s=_t(o,a=>ls(a)?Ct(a):Tr(YI(a)));return q(me(t)(s,n),a=>id(a,i=>uf(i)?Ct(i.value):Tr(i)))}))),mi=e=>ke((t,r)=>{let n;return b($(()=>n||e.pipe(Zn(r),T(o=>me(o)(t,r)),T(o=>n=o))))}),tB=e=>Ko((t,r,n)=>q(Zn(me(e)(t,r),n),Zn(n)));var rB=l(2,(e,t)=>ke(we(function*(r,n){let o=yield*me(e)(r,n),s=yield*Xr({capacity:t.capacity===\"unbounded\"?void 0:t.capacity,strategy:t.capacity===\"unbounded\"?void 0:t.strategy});return yield*Ir(n,io(s)),yield*o.pipe(T(a=>En(s,a)),nr({disableYield:!0}),Ao(a=>Ft(s,a)),Zt(n)),Cs(s)}))),nB=l(2,(e,t)=>ke(we(function*(r,n){let o=yield*me(e)(r,n),s=yield*Xr({capacity:t.capacity===\"unbounded\"?void 0:t.capacity,strategy:t.capacity===\"unbounded\"?void 0:t.strategy});return yield*Ir(n,io(s)),yield*o.pipe(T(a=>pi(s,a)),nr({disableYield:!0}),Ao(a=>Ft(s,a)),Zt(n)),di(s)}))),oB=l(2,(e,t)=>Qb(e,dr(b(T(t,Z))),{haltStrategy:\"either\"})),sB=l(2,(e,t)=>Ko(we(function*(r,n,o){let s=yield*me(e)(r,n),a=yield*Zt(t,o,{startImmediately:!0});return $(()=>{let i=a.pollUnsafe();return i===void 0?s:UI(i,{onFailure:Ct,onSuccess:Z})})}))),aB=l(2,(e,t)=>Km(e,r=>Co(r)?t(r.cause):te)),Km=l(2,(e,t)=>Ko((r,n,o)=>cs(o,t).pipe(Dr(me(e)(r,n))))),iB=l(2,(e,t)=>mi(Vt(t,e))),QA=l(2,(e,t)=>Go(e,r=>j(()=>{let n=!0,o=Cr(r,s=>(n=!1,t(s)));return $(()=>n?o:r)}))),cB=l(2,(e,t)=>Go(e,r=>b(Qe(r,n=>T(t,()=>Z(n)))))),uB=l(2,(e,t)=>Km(e,r=>t)),su=(e,t,r)=>$(()=>{let n=an(),o=me(e)(Z(),n);return Qe(T(o,t),r||b).pipe(Fn(s=>De(n,s)))});var Xb=l(2,(e,t)=>ke((r,n)=>q(cn(me(e)(r,n),t),cn(t)))),eS=l(3,(e,t,r)=>ke((n,o)=>q(ds(me(e)(n,o),t,r),ds(t,r)))),tS=l(3,(e,t,r)=>ke((n,o)=>T(r,s=>me(eS(e,t,s))(n,o)))),fB=l(e=>kr(e[0]),(e,t,r)=>Pu(t)?Xb(e,t):ke((n,o)=>T(r?.local?Ks(t,us(),o):Bp(t,o),s=>q(cn(me(e)(n,o),s),cn(s))))),lB=l(2,(e,t)=>ke((r,n)=>cd(o=>{let s=t(o);return me(Xb(e,s))(r,n)})));var YA=function(){let e=kr(arguments[0]),t=e?arguments[1]:arguments[0],r=Gn(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return c$(n,t,r)}return n=>c$(n,t,r)},c$=(e,t,r)=>ute(Y0(t,r),n=>eS(e,xo,n),(n,o)=>wr(s=>{let a=s.getRef(Mr),i=s.getRef($M);return Ax(n,o,a,i)}));var pB=e=>su(e,t=>nr(t,{disableYield:!0})),au=l(2,(e,t)=>su(e,r=>nr(T(r,t),{disableYield:!0}))),dB=l(2,(e,t)=>su(e,r=>r.pipe(T(t),T(n=>n?te:Z()),nr({disableYield:!0})))),XA=e=>q(iu(e,()=>({bytes:0,arrays:[]}),(t,r)=>{for(let n=0;n<r.length;n++)t.bytes+=r[n].length,t.arrays.push(r[n]);return t}),({arrays:t,bytes:r})=>{let n=new Uint8Array(r),o=0;for(let s=0;s<t.length;s++){let a=t[s];n.set(a,o),o+=a.length}return n});var mB=e=>$(()=>{let t=v();return su(e,r=>r.pipe(fg,T(n=>(t=n,Z()))),()=>b(t))}),hB=e=>$(()=>{let t=Symbol(),r=t;return su(e,n=>nr(T(n,o=>(r=o,te)),{disableYield:!0}),()=>r===t?ja:D0(r))}),iu=l(3,(e,t,r)=>$(()=>{let n=t();return su(e,o=>Mn({while:mr,body:()=>o,step:s=>{n=r(n,s)}}),()=>b(n))})),xB=l(3,(e,t,r)=>$(()=>{let n=t();return su(e,o=>Mn({while:mr,body:Ne(o.pipe(T(s=>r(n,s)),q(s=>{n=s}))),step:vr}),()=>b(n))})),ev=we(function*(e){let t=Wm(1),r=yield*Xs(),n=Ie(r,Ur);return(yield*me(e)(Z(),n)).pipe(cn(r),t.withPermits(1))},_t(e=>b(Ct(e)))),As=(e,t)=>me(e)(Z(),t);var tv=l(e=>kr(e[0]),(e,t)=>ms(r=>au(e,n=>pi(t,n)).pipe(r,to,T(n=>(je(n)?Hm(t):ha(t,n.cause),te)))));var gB=l(e=>kr(e[0]),we(function*(e,t){let r=yield*gc,n=yield*Xr({capacity:typeof t.capacity==\"number\"?t.capacity:void 0,strategy:typeof t.capacity==\"number\"?t.strategy:void 0});return yield*Ir(r,io(n)),yield*Zt(tv(e,n),r),n}));var yB=e=>ea(e.capacity===\"unbounded\"?Lm(e):e.strategy===\"dropping\"?_b(e):e.strategy===\"sliding\"?Rb(e):Ob(e),$m),bB=l(2,we(function*(e,t){let r=yield*yB(t);return yield*Af(rv(e,r,{shutdownOnEnd:t.shutdownOnEnd!==!1})),r})),rv=l(e=>kr(e[0]),(e,t,r)=>au(e,n=>JL(t,n)).pipe(r?.shutdownOnEnd===!0?yc($m(t)):A)),SB=l(2,we(function*(e,t){let r=yield*yB(t);return yield*au(e,n=>Mb(r,n)).pipe(Fn(n=>Pb(r,n)),Af),r}));var tme=(e,t)=>()=>{let r=Vk(Tm(e),t);return ke((n,o)=>b(T(n,s=>r(s))))};var EB=\"~effect/PlatformError\",cu=class extends rn(\"BadArgument\"){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:\"\"}`}};var nv=class extends rn(\"PlatformError\"){constructor(t){\"cause\"in t?super({reason:t,cause:t.cause}):super({reason:t})}[EB]=EB;get message(){return this.reason.message}};var rme=e=>new nv(new cu(e));var gte=\"~effect/Stream\",yte={_R:A,_E:A,_A:A},IB=function(e){this.channel=e};IB.prototype={[gte]:yte,pipe(){return K(this,arguments)}};var TB=e=>new IB(e);var Ste=\"~effect/Sink\";var Ete={_A:A,_In:A,_L:A,_E:A,_R:A},Ite={[Ste]:Ete,pipe(){return K(this,arguments)}};var Tte=e=>{let t=Object.create(Ite);return t.transform=e,t},wB=e=>ke((t,r)=>b(T(e.transform(t,r),Z)));var CB=e=>{let t=it(e);return Tte(r=>{let n=[];if(t===0)return b([n]);let o;return r.pipe(T(s=>{if(n.length+s.length<=t)return n.push(...s),n.length===t?Z():te;for(let a=0;a<s.length;a++)if(n.push(s[a]),n.length===t)return a+1<s.length&&(o=s.slice(a+1)),Z();return te}),nr({disableYield:!0}),Qe(()=>b([n,o])))})};var Sv={};$e(Sv,{DefaultChunkSize:()=>$B,Do:()=>loe,TypeId:()=>LB,accumulate:()=>Kne,aggregate:()=>Bne,aggregateWithin:()=>xv,as:()=>rre,bind:()=>doe,bindEffect:()=>moe,bindTo:()=>hoe,broadcast:()=>dz,broadcastN:()=>zne,buffer:()=>Gre,bufferArray:()=>Kre,callback:()=>jB,catch:()=>Ym,catchCause:()=>XB,catchCauseFilter:()=>one,catchCauseIf:()=>nne,catchDefect:()=>Vre,catchFilter:()=>mv,catchIf:()=>tz,catchReason:()=>ene,catchReasons:()=>tne,catchTag:()=>Yre,catchTags:()=>Xre,changes:()=>Vne,changesWith:()=>mz,changesWithEffect:()=>Zne,chunks:()=>cz,collect:()=>Gne,combine:()=>Tne,combineArray:()=>wne,concat:()=>Cl,cross:()=>kre,crossWith:()=>QB,debounce:()=>_ne,decodeText:()=>Qne,die:()=>$te,drain:()=>lre,drainFork:()=>pre,drop:()=>hv,dropRight:()=>Sne,dropUntil:()=>gne,dropUntilEffect:()=>yne,dropWhile:()=>az,dropWhileEffect:()=>iz,dropWhileFilter:()=>bne,empty:()=>ga,encodeText:()=>Yne,ensuring:()=>aoe,fail:()=>Tl,failCause:()=>qB,failCauseSync:()=>Bte,failSync:()=>Lte,filter:()=>$re,filterEffect:()=>zre,filterMap:()=>Bre,filterMapEffect:()=>jre,flatMap:()=>kl,flatten:()=>KB,flattenArray:()=>fre,flattenEffect:()=>ore,flattenIterable:()=>yre,flattenTake:()=>bre,forever:()=>gre,fromArray:()=>oS,fromArrayEffect:()=>Hte,fromArrays:()=>Wte,fromAsyncIterable:()=>Gte,fromChannel:()=>R,fromEffect:()=>nS,fromEffectDrain:()=>BB,fromEffectRepeat:()=>zB,fromEffectSchedule:()=>Fte,fromEventListener:()=>Zte,fromIterable:()=>fu,fromIterableEffect:()=>jte,fromIterableEffectRepeat:()=>qte,fromIteratorSucceed:()=>zte,fromPubSub:()=>cv,fromPubSubTake:()=>HB,fromPull:()=>Zo,fromQueue:()=>wl,fromReadableStream:()=>Jte,fromSchedule:()=>Kte,fromSubscription:()=>Vte,groupAdjacentBy:()=>Lne,groupBy:()=>Nne,groupByKey:()=>Dne,grouped:()=>Fne,groupedWithin:()=>Une,haltWhen:()=>noe,ignore:()=>cne,ignoreCause:()=>une,interleave:()=>toe,interleaveWith:()=>xz,interruptWhen:()=>roe,intersperse:()=>hz,intersperseAffixes:()=>eoe,isStream:()=>Ce,iterate:()=>Yte,let:()=>poe,limitBytes:()=>dne,make:()=>Nte,map:()=>Tn,mapAccum:()=>Cne,mapAccumArray:()=>lu,mapAccumArrayEffect:()=>Ane,mapAccumEffect:()=>kne,mapArray:()=>JB,mapArrayEffect:()=>sre,mapBoth:()=>nre,mapEffect:()=>Qm,mapError:()=>rz,merge:()=>uv,mergeAll:()=>Cre,mergeEffect:()=>sS,mergeLeft:()=>Tre,mergeResult:()=>Ire,mergeRight:()=>wre,mkArrayBuffer:()=>koe,mkString:()=>Coe,mkUint8Array:()=>Aoe,never:()=>ere,onEnd:()=>soe,onError:()=>ooe,onExit:()=>gz,onFirst:()=>bz,onStart:()=>yz,orDie:()=>ine,orElseIfEmpty:()=>sne,orElseSucceed:()=>ane,paginate:()=>Qte,partition:()=>Hre,partitionEffect:()=>qre,partitionQueue:()=>pv,peel:()=>Jre,pipeThrough:()=>Jne,pipeThroughChannel:()=>Hne,pipeThroughChannelOrFail:()=>Wne,prepend:()=>Ere,provide:()=>Sz,provideContext:()=>ioe,provideService:()=>coe,provideServiceEffect:()=>gv,race:()=>Lre,raceAll:()=>YB,range:()=>Xte,rechunk:()=>uz,repeat:()=>dre,repeatElements:()=>xre,result:()=>are,retry:()=>fne,run:()=>Iz,runCollect:()=>Tz,runCount:()=>xoe,runDrain:()=>iS,runFold:()=>yoe,runFoldEffect:()=>boe,runForEach:()=>Ioe,runForEachArray:()=>wz,runForEachWhile:()=>Toe,runHead:()=>Soe,runIntoPubSub:()=>Poe,runIntoQueue:()=>Uoe,runLast:()=>Eoe,runSum:()=>goe,scan:()=>vne,scanEffect:()=>One,schedule:()=>mre,scoped:()=>tre,service:()=>Pte,serviceOption:()=>Mte,share:()=>qne,sliding:()=>Ene,slidingSize:()=>fz,split:()=>Ine,splitLines:()=>Xne,succeed:()=>uu,suspend:()=>In,switchMap:()=>ure,sync:()=>Dte,take:()=>pne,takeRight:()=>mne,takeUntil:()=>nz,takeUntilEffect:()=>oz,takeWhile:()=>sz,takeWhileEffect:()=>xne,takeWhileFilter:()=>hne,tap:()=>GB,tapBoth:()=>ire,tapCause:()=>ez,tapDefect:()=>Qre,tapError:()=>dv,tapErrorTag:()=>Zre,tapSink:()=>cre,throttle:()=>Mne,throttleEffect:()=>lz,tick:()=>Ute,timeout:()=>hre,timeoutOrElse:()=>VB,toAsyncIterable:()=>Roe,toAsyncIterableEffect:()=>_oe,toAsyncIterableWith:()=>bv,toChannel:()=>co,toPubSub:()=>Moe,toPubSubTake:()=>Cz,toPull:()=>woe,toQueue:()=>Foe,toReadableStream:()=>voe,toReadableStreamEffect:()=>Ooe,toReadableStreamWith:()=>yv,transduce:()=>$ne,transformPull:()=>Yt,transformPullBracket:()=>iv,unfold:()=>WB,unwrap:()=>hi,unwrapReason:()=>rne,updateContext:()=>Ez,updateService:()=>uoe,when:()=>Wre,withExecutionPlan:()=>lne,withSpan:()=>foe,zip:()=>vre,zipFlatten:()=>Rre,zipLatest:()=>Nre,zipLatestAll:()=>lv,zipLatestWith:()=>Dre,zipLeft:()=>Ore,zipRight:()=>_re,zipWith:()=>fv,zipWithArray:()=>aS,zipWithIndex:()=>Pre,zipWithNext:()=>Mre,zipWithPrevious:()=>Fre,zipWithPreviousAndNext:()=>Ure});var AB=\"~effect/RcMap\",wte=e=>({[AB]:AB,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:\"Open\",map:Um()},pipe(){return K(this,arguments)}}),vB=e=>wr(t=>{let r=t.context,n=Ie(r,Ur),o=wte({lookup:e.lookup,context:r,scope:n,idleTimeToLive:typeof e.idleTimeToLive==\"function\"?zv(e.idleTimeToLive,ge):Ne(ge(e.idleTimeToLive??We)),capacity:Math.max(e.capacity??Number.POSITIVE_INFINITY,0)});return Vt(cs(n,()=>{if(o.state._tag===\"Closed\")return te;let s=o.state.map;return o.state={_tag:\"Closed\"},za(s,([,a])=>to(Vm(a))).pipe(Cr(()=>j(()=>{bb(s)})))}),o)}),ov=l(2,(e,t)=>ms(r=>{if(e.state._tag===\"Closed\")return un;let n=e.state,o=hl(),s=Ts(n.map,t),a;if(s._tag===\"Some\")a=s.value,a.refCount++;else{if(Number.isFinite(e.capacity)&&FL(e.state.map)>=e.capacity)return M(new XI(`RcMap attempted to exceed capacity of ${e.capacity}`));{a={deferred:ko(),scope:an(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},a.finalizer=kte(e,t,a),Nm(n.map,t,a);let c=new Map(e.context.mapUnsafe);o.context.mapUnsafe.forEach((f,p)=>{c.set(p,f)}),c.set(Ur.key,a.scope);let u=mo(c);$(()=>e.lookup(t)).pipe(Lr(u),ws(a.scope)).addObserver(f=>{FI(f)&&Cte(e,t,a,u),_n(a.deferred,f)})}}let i=qn(o.context,Ur);return Ir(i,a.finalizer).pipe(Dr(r(tc(a.deferred))))}));var Cte=(e,t,r,n)=>{if(e.state._tag===\"Closed\")return;let o=Ts(e.state.map,t);o._tag===\"None\"||o.value!==r||(dl(e.state.map,t),!(r.refCount>0)&&Vm(r).pipe(Lr(n),ws(e.scope)))},Vm=e=>e.fiber?Ho(e.fiber).pipe(Dr(De(e.scope,ht))):De(e.scope,ht),kte=(e,t,r)=>wr(n=>{if(r.refCount--,r.refCount>0)return te;if(e.state._tag===\"Closed\")return Vm(r);let o=Ts(e.state.map,t);if(o._tag===\"None\"||o.value!==r)return Vm(r);if($i(r.idleTimeToLive))return dl(e.state.map,t),Vm(r);if(!Ds(r.idleTimeToLive))return te;let s=n.getRef(ac);return r.expiresAt=s.currentTimeMillisUnsafe()+Ye(r.idleTimeToLive),r.fiber?te:(r.fiber=ms(function a(i){let c=s.currentTimeMillisUnsafe(),u=r.expiresAt-c;if(u<=0){if(e.state._tag===\"Closed\"||r.refCount>0)return te;let f=Ts(e.state.map,t);return f._tag===\"None\"||f.value!==r?te:(dl(e.state.map,t),De(r.scope,ht))}return T(i(s.sleep(Jt(u))),()=>a(i))}).pipe(yc(j(()=>{r.fiber=void 0})),Lr(n.context),ws(e.scope)),te)});var sv=l(2,(e,t)=>Ec(r=>{if(e.state._tag===\"Closed\")return te;let n=Ts(e.state.map,t);if(n._tag===\"None\"||$i(n.value.idleTimeToLive))return te;let o=n.value;return o.expiresAt=r.currentTimeMillisUnsafe()+Ye(o.idleTimeToLive),te}));var Ate=\"~effect/RcRef\",Zm={_tag:\"Empty\"},vte={_tag:\"Closed\"},Ote={_A:A,_E:A},av=class{[Ate]=Ote;pipe(){return K(this,arguments)}state=Zm;acquire;context;scope;idleTimeToLive;constructor(t,r,n,o){this.acquire=t,this.context=r,this.scope=n,this.idleTimeToLive=o}},RB=e=>wr(t=>{let r=t.context,n=Ie(r,Ur),o=new av(e.acquire,r,n,e.idleTimeToLive!==void 0?ge(e.idleTimeToLive):void 0);return Vt(cs(n,()=>{let s=o.state;return o.state=vte,s._tag===\"Acquired\"?De(s.scope,ht):s._tag===\"Acquiring\"?Ho(s.fiber):te}),o)}),_te=(e,t)=>{switch(e.state._tag){case\"Closed\":return un;case\"Acquired\":{let r=e.state;return r.refCount++,r.fiber?Vt(Ho(r.fiber),r):b(r)}case\"Acquiring\":{let r=e.state;return r.awaiters++,_B(e,r,t)}case\"Empty\":{let r={_tag:\"Acquiring\",fiber:void 0,awaiters:1,acquired:void 0};e.state=r;let n=an(),o=cn(e.acquire,Bt(e.context,Ur,n)).pipe(T(s=>{if(e.state!==r)return un;let a={_tag:\"Acquired\",value:s,scope:n,fiber:void 0,refCount:r.awaiters,invalidated:!1};return e.state=a,r.acquired=a,b(a)}),Fn(s=>je(s)?te:(e.state===r&&(e.state=Zm),De(n,s))));return r.fiber=Lr(hl().context)(o),_B(e,r,t)}}},_B=(e,t,r)=>Fn(r(li(t.fiber)),n=>{let o=t.acquired;return o!==void 0?Co(n)?MB(e,o):te:--t.awaiters>0||e.state!==t?te:(e.state=Zm,Ho(t.fiber))}),PB=e=>{let t=e;return ms(r=>T(gc,n=>T(_te(t,r),o=>Vt(cs(n,()=>MB(t,o)),o.value))))},MB=(e,t)=>{if(t.refCount--,t.refCount>0)return te;let r=e.idleTimeToLive;return r===void 0||t.invalidated?(e.state===t&&(e.state=Zm),De(t.scope,ht)):Ds(r)?(t.fiber=ms(n=>T(n(Ha(r)),()=>e.state===t&&t.refCount===0?(e.state=Zm,De(t.scope,ht)):te)).pipe(yc(j(()=>{t.fiber=void 0})),Lr(e.context),ws(e.scope)),te):te};var FB=RB,UB=PB;var LB=\"~effect/Stream\",Ce=e=>w(e,LB),$B=Jm,R=TB,nS=e=>R(Jb(q(e,Te))),Pte=e=>nS(G0(e)),Mte=e=>nS(K0(e)),BB=e=>Zo(b(T(e,()=>Z()))),zB=e=>Zo(b(q(e,Te))),Fte=(e,t)=>Zo(Zr(function*(){let r=yield*eo(t),n=yield*ds(e,rr,rr.defaultValue()),o=!0,s=$(()=>r(n)).pipe(T(a=>ds(e,rr,a)),q(a=>(n=a,Te(a))));return $(()=>o?(o=!1,b(Te(n))):s)})),Ute=e=>Zo(j(()=>{let t=!0,r=b(Te(void 0)),n=z0(r,e);return $(()=>t?(t=!1,r):n)})),Zo=e=>R(dr(e)),Yt=(e,t)=>R(ke((r,n)=>T(As(e.channel,n),o=>t(o,n)))),iv=(e,t)=>R(Ko((r,n,o)=>T(As(e.channel,n),s=>t(s,n,o)))),co=e=>e.channel,jB=(e,t)=>R(f$(e,t)),ga=R(Sl),uu=e=>R(Wb(Te(e))),Nte=(...e)=>oS(e),Dte=e=>R(d$(()=>Te(e()))),In=e=>R(Hb(()=>e().channel)),Tl=e=>R(ks(e)),Lte=e=>R(h$(e)),qB=e=>R(Gm(e)),$te=e=>R(WA(e)),Bte=e=>R(x$(e)),zte=(e,t)=>R(HA(()=>e,t)),fu=(e,t)=>Array.isArray(e)&&t?.chunkSize===void 0?oS(e):R(p$(e,t?.chunkSize)),jte=e=>hi(q(e,fu)),qte=e=>kl(zB(e),fu),oS=e=>ct(e)?R(Wb(e)):ga,Hte=e=>hi(q(e,oS)),Wte=(...e)=>R(qA(zi(e,ct))),wl=e=>R(y$(e)),cv=e=>R(b$(e)),HB=e=>R(S$(e)),Jte=e=>R(E$(e)),Gte=(e,t)=>R(I$(e,t)),Kte=e=>Zo(q(gf(e),t=>Qe(q(t(void 0),Te),()=>Z()))),Vte=e=>R(GA(e)),Zte=(e,t,r)=>jB(n=>{let o=typeof r==\"object\"&&r.once;function s(a){zm(n,a),o&&Hm(n)}return ea(j(()=>e.addEventListener(t,s,r)),()=>j(()=>e.removeEventListener(t,s,r)))},{bufferSize:typeof r==\"object\"?r.bufferSize:void 0}),WB=(e,t)=>Zo(j(()=>{let r=e;return T($(()=>t(r)),n=>n===void 0?Z():(r=n[1],b(Te(n[0]))))})),Qte=(e,t)=>Zo(j(()=>{let r=e,n=!1;return $(function o(){return n?Z():T(t(r),([s,a])=>(fe(a)?n=!0:r=a.value,ct(s)?b(s):o()))})})),Yte=(e,t)=>WB(e,r=>b([r,t(r)])),Xte=(e,t,r=Jm)=>e>t?ga:Zo(j(()=>{let n=Wn(r),o=e,s=!1;return $(()=>{if(s)return Z();let a=t-o+1;if(a>n){let c=sE(o,o+n-1);return o+=n,b(c)}let i=sE(o,o+a-1);return s=!0,b(i)})})),ere=R(m$),hi=e=>R(mi(q(e,co))),tre=e=>R(tB(e.channel)),Tn=l(2,(e,t)=>In(()=>{let r=0;return R(Vo(e.channel,tn(n=>t(n,r++))))})),rre=l(2,(e,t)=>Tn(e,()=>t)),nre=l(2,(e,t)=>e.pipe(Tn(t.onElement),rz(t.onError))),JB=l(2,(e,t)=>R(Vo(e.channel,t))),Qm=l(e=>Ce(e[0]),(e,t,r)=>e.channel.pipe(qr,Gb(t,r),Vo(Te),R)),ore=l(e=>Ce(e[0]),(e,t)=>Qm(e,A,t)),sre=l(2,(e,t)=>R(Gb(e.channel,t))),are=e=>e.pipe(Tn(P),Ym(t=>uu(D(t)))),GB=l(e=>Ce(e[0]),(e,t,r)=>Qm(e,n=>Vt(t(n),n),r)),ire=l(2,(e,t)=>e.pipe(dv(t.onError),GB(t.onElement,{concurrency:t.concurrency}))),cre=l(2,(e,t)=>iv(e,we(function*(r,n,o){let s=Sn(),a=Sn(),i,c,u=!1,f=!1,p=s.whenOpen($(()=>{if(i){let m=i;return i=void 0,f||s.closeUnsafe(),Vt(a.open,m)}return Z()}));yield*$(()=>t.transform(p,o)).pipe(m=>Z0(m,x=>(u=!0,Co(x)&&(c=x.cause),a.open),!0),Zt(o));let d=r.pipe(T(m=>(i=m,a.closeUnsafe(),s.openUnsafe(),Vt(a.await,m))),Qe(()=>(f=!0,a.closeUnsafe(),s.openUnsafe(),T(a.await,()=>Z()))));return $(()=>c?Ct(c):u?r:d)}))),kl=l(e=>Ce(e[0]),(e,t,r)=>e.channel.pipe(qr,KA(n=>t(n).channel,r),R)),ure=l(e=>Ce(e[0]),(e,t,r)=>e.channel.pipe(qr,Y$(n=>t(n).channel,r),R)),KB=l(e=>Ce(e[0]),(e,t)=>kl(e,A,t)),fre=e=>R(qr(e.channel)),lre=e=>R(O$(e.channel)),pre=l(2,(e,t)=>sS(e,iS(t))),dre=l(2,(e,t)=>R(_$(e.channel,t))),mre=l(2,(e,t)=>e.channel.pipe(qr,M$(t),Vo(Te),R)),hre=l(2,(e,t)=>VB(e,{duration:t,orElse:()=>ga})),VB=l(2,(e,t)=>{let r=ge(t.duration);if(!Ds(r))return e;if($i(r))return In(t.orElse);let n=Symbol();return XB(In(()=>{let s=hl().getRef(ac),a=Ye(r),i,c=Sn(!1);return uv(Yt(e,(u,f)=>$(()=>(i=s.currentTimeMillisUnsafe()+a,c.openUnsafe(),u)).pipe(q(p=>(c.closeUnsafe(),i=void 0,p)),b)),BB(Zr(function*(){for(;;)if(yield*c.await,!(i===void 0||(yield*Ha(i-s.currentTimeMillisUnsafe()),i===void 0)||i-s.currentTimeMillisUnsafe()>0))return yield*Tr(n)})),{haltStrategy:\"left\"})}),o=>o.reasons.find(a=>a._tag===\"Die\"&&a.defect===n)?t.orElse():qB(o))}),xre=l(2,(e,t)=>R(ke((r,n)=>q(me(qr(e.channel))(r,n),o=>{let s,a=Zr(function*(){let i=yield*o,c=Te(i);return s=(yield*gf(t))(i).pipe(Vt(c),Qe(f=>(s=void 0,a))),c});return $(()=>s??a)})))),gre=e=>R(P$(e.channel)),yre=e=>kl(e,fu),bre=e=>e.channel.pipe(qr,v$,R),Cl=l(2,(e,t)=>{let r=R(A$(l$(()=>Sre(e,t))));return ZB.set(r,[e,t]),r}),ZB=new WeakMap;function*Sre(e,t){let r=[t,e];for(;r.length>0;){let n=r.pop(),o=ZB.get(n);o===void 0?yield n.channel:r.push(o[1],o[0])}}var Ere=l(2,(e,t)=>Cl(fu(t),e)),uv=l(e=>Ce(e[0])&&Ce(e[1]),(e,t,r)=>R(Qb(co(e),co(t),r))),sS=l(2,(e,t)=>e.channel.pipe(X$(t),R)),Ire=l(2,(e,t)=>uv(Tn(e,P),Tn(t,D))),Tre=l(2,(e,t)=>sS(e,iS(t))),wre=l(2,(e,t)=>sS(t,iS(e))),Cre=l(2,(e,t)=>KB(fu(e),t)),kre=l(2,(e,t)=>QB(e,t,(r,n)=>[r,n])),QB=l(3,(e,t,r)=>kl(e,n=>Tn(t,o=>r(n,o)))),fv=l(3,(e,t,r)=>aS(e,t,Are(r))),Are=e=>(t,r)=>{let n=Math.min(t.length,r.length),o=[];for(let s=0;s<n;s++)o.push(e(t[s],r[s]));return[o,t.slice(n),r.slice(n)]},aS=l(3,(e,t,r)=>R(Ko(we(function*(n,o){let s=yield*As(e.channel,o),a=yield*As(t.channel,o),i=Zr(function*(){let f=yield*Zt(s,o),p=yield*Zt(a,o);return yield*UL([f,p])}),c={_tag:\"PullBoth\"};return Zr(function*(){let[f,p]=c._tag===\"PullBoth\"?yield*i:c._tag===\"PullLeft\"?[yield*s,c.rightArray]:[c.leftArray,yield*a],d=r(f,p);return ct(d[1])?c={_tag:\"PullRight\",leftArray:d[1]}:ct(d[2])?c={_tag:\"PullLeft\",rightArray:d[2]}:c={_tag:\"PullBoth\"},d[0]})})))),vre=l(2,(e,t)=>fv(e,t,(r,n)=>[r,n])),Ore=l(2,(e,t)=>aS(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=r.slice(0,o),a=r.slice(o),i=n.slice(o);return[s,a,i]})),_re=l(2,(e,t)=>aS(e,t,(r,n)=>{let o=Math.min(r.length,n.length),s=n.slice(0,o),a=r.slice(o),i=n.slice(o);return[s,a,i]})),Rre=l(2,(e,t)=>fv(e,t,(r,n)=>[...r,n])),Pre=e=>Tn(e,(t,r)=>[t,r]),Mre=e=>lu(e,v,(t,r)=>{let n=0;t._tag===\"None\"&&(n=1,t=O(r[0]));let o=Ot();for(;n<r.length;n++){let s=t.value;t=O(r[n]),o.push([s,t])}return[t,o]},{onHalt(t){return t._tag===\"Some\"?[[t.value,v()]]:[]}}),Fre=e=>lu(e,v,(t,r)=>{let n=Ot();for(let o=0;o<r.length;o++){let s=r[o];n.push([t,s]),t=O(r[o])}return[t,n]}),Ure=e=>lu(e,()=>({prev:v(),current:v()}),(t,r)=>{let n=0,o;t.current._tag===\"None\"?(n=1,o=r[0],t.current=O(o)):o=t.current.value;let s=Ot();for(;n<r.length;n++){let a=r[n];t.current=O(a),s.push([t.prev,o,t.current]),t.prev=O(o),o=a}return[t,s]},{onHalt(t){return t.current._tag===\"Some\"?[[t.prev,t.current.value,v()]]:[]}}),lv=(...e)=>R(Hb(()=>{let t=[],r=new Set,n=Sn();return Zb(qA(e.map((o,s)=>o.channel.pipe(qr,Gb(a=>(t[s]=a,r.has(s)?b(Te(t.slice())):(r.add(s),r.size<e.length?n.await:Vt(n.open,Te(t.slice()))))),F$(Or)))),{concurrency:\"unbounded\",bufferSize:0})})),Nre=l(2,(e,t)=>lv(e,t)),Dre=l(3,(e,t,r)=>Tn(lv(e,t),([n,o])=>r(n,o))),YB=(...e)=>R(ke((t,r)=>j(()=>{let n,o=j0(e.map(s=>{let a=wt(r);return As(s.channel,a).pipe(T(i=>L0(b(i),i)),Fn(i=>i._tag===\"Success\"?n?De(a,i):(n=i.value[0],te):De(a,i)),q(([,i])=>i))}));return $(()=>n??o)}))),Lre=l(2,(e,t)=>YB(e,t)),$re=l(2,(e,t)=>R(U$(co(e),t))),Bre=l(2,(e,t)=>R(N$(co(e),t))),zre=l(2,(e,t)=>R(D$(co(e),t))),jre=l(2,(e,t)=>R(L$(co(e),t))),pv=l(e=>Ce(e[0]),we(function*(e,t,r){let n=yield*gc,o=yield*As(e.channel,n),s=r?.capacity===\"unbounded\"?void 0:r?.capacity??$B,a=yield*Xr({capacity:s}),i=yield*Xr({capacity:s});return yield*Zr(function*(){for(;;){let c=yield*o,u=[],f=[];for(let d=0;d<c.length;d++){let m=t(c[d]);Q(m)?u.push(m.failure):f.push(m.success)}let p;if(f.length>0){let d=jm(a,f);d.length>0&&(p=yield*kf(pi(a,d)))}if(u.length>0){let d=jm(i,u);d.length>0&&(yield*pi(i,d))}p&&(yield*li(p))}}).pipe(Ao(c=>(ha(a,c),ha(i,c),te)),Zt(n)),[a,i]})),qre=l(e=>Ce(e[0]),(e,t,r)=>q(pv(Qm(e,n=>t(n),r),n=>n,r),([n,o])=>[wl(n),wl(o)])),Hre=l(e=>Ce(e[0]),(e,t,r)=>q(pv(e,t,{capacity:r?.capacity??16}),([n,o])=>[wl(n),wl(o)])),Wre=l(2,(e,t)=>t.pipe(q(r=>r?e:ga),hi)),Jre=l(2,we(function*(e,t){let r,n=yield*ev(e.channel),o=_t(n,i=>(r=i,Ct(i))),s=Zo(b(o)),a=yield*Iz(s,t);return r?[a,ga]:(s=Zo(b(n)),[a,s])})),Gre=l(2,(e,t)=>R(nB(e.channel,t))),Kre=l(2,(e,t)=>R(rB(e.channel,t))),XB=l(2,(e,t)=>e.channel.pipe(Il(r=>t(r).channel),R)),Vre=l(2,(e,t)=>e.channel.pipe(B$(r=>t(r).channel),R)),ez=l(2,(e,t)=>e.channel.pipe(Kb(t),R)),Ym=l(2,(e,t)=>R(Jo(e.channel,r=>t(r).channel)));var dv=l(2,(e,t)=>e.channel.pipe(j$(t),R)),Zre=l(3,(e,t,r)=>{let n=Array.isArray(t)?o=>w(o,\"_tag\")&&t.includes(o._tag):Nt(t);return dv(e,o=>n(o)?r(o):te)}),Qre=l(2,(e,t)=>ez(e,r=>{let n=Hp(r);return ze(n)?t(n.success):te})),tz=l(e=>Ce(e[0]),(e,t,r,n)=>R(q$(co(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),mv=l(e=>Ce(e[0]),(e,t,r,n)=>R(H$(co(e),t,o=>r(o).channel,n&&(o=>n(o).channel)))),Yre=l(e=>Ce(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>w(s,\"_tag\")&&t.includes(s._tag):Nt(t);return tz(e,o,r,n)}),Xre=l(e=>Ce(e[0]),(e,t,r)=>{let n;return mv(e,o=>(n??=Object.keys(t),w(o,\"_tag\")&&Hx(o._tag)&&n.includes(o._tag)?P(o):D(o)),o=>t[o._tag](o),r)}),ene=l(e=>Ce(e[0]),(e,t,r,n,o)=>R(W$(co(e),t,r,(s,a)=>n(s,a).channel,o&&((s,a)=>o(s,a).channel)))),tne=l(e=>Ce(e[0]),(e,t,r,n)=>{let o=Object.create(null);for(let a of Object.keys(r)){let i=r[a];o[a]=(c,u)=>i(c,u).channel}let s=n&&((a,i)=>n(a,i).channel);return R(J$(e.channel,t,o,s))}),rne=l(2,(e,t)=>mv(e,r=>Nt(r,t)&&w(r,\"reason\")?P(r.reason):D(r),Tl)),rz=l(2,(e,t)=>R(G$(e.channel,t))),nne=l(3,(e,t,r)=>R(z$(e.channel,t,n=>r(n).channel))),one=l(3,(e,t,r)=>R(Vb(e.channel,t,(n,o)=>r(n,o).channel))),sne=l(2,(e,t)=>R(k$(e.channel,r=>co(t())))),ane=l(2,(e,t)=>Ym(e,r=>uu(t(r)))),ine=e=>R(K$(e.channel)),cne=l(e=>Ce(e[0]),(e,t)=>R(V$(e.channel,t))),une=l(e=>Ce(e[0]),(e,t)=>R(Z$(e.channel,t))),fne=l(2,(e,t)=>R(Q$(e.channel,t))),DB=(e,t)=>hi(q(eo(t),r=>{let n=rr.defaultValue(),o=()=>Ym(gv(e,rr,j(()=>n)),s=>hi(Qe(q(r(s),a=>(n=a,hi(Vt(od,o())))),()=>b(Tl(s)))));return o()})),lne=l(e=>Ce(e[0]),(e,t,r)=>In(()=>{let n=r?.preventFallbackOnPartialStream??!1,o=0,s={attempt:0,stepIndex:0},a=gv(Nx,j(()=>(s={attempt:s.attempt+1,stepIndex:o},s))),i=r?.onEvent===void 0?void 0:C0(r.onEvent,()=>s),c,u=i===void 0?A:d=>gz(yz(d,q(i.begin,m=>{c=m})),m=>$(()=>{if(c===void 0)return te;let x=c;return c=void 0,i.end(x,m)})),f=v(),p=In(()=>{let d=t.steps[o];if(!d)return Tl(LS(f));let m=a(u(Sz(e,d.provide))),x=!1;if(Oe(f)){let g=f.value,y=!1,S=m;m=In(()=>y?S:(y=!0,Tl(g))),m=DB(m,ed(d,!1))}else{let g=ed(d,!0);m=g?DB(m,g):m}return Ym(n?bz(m,g=>(x=!0,te)):m,g=>(o++,n&&x?Tl(g):(f=O(g),p)))});return p})),pne=l(2,(e,t)=>{let r=it(t);return r===0?ga:nz(e,(n,o)=>o===r-1)}),dne=l(3,(e,t,r)=>In(()=>{let n=xg(t),o=BigInt(0),s=!1;return Cl(sz(e,a=>{let i=o+BigInt(a.length);return i>n?(s=!0,!1):(o=i,!0)}),In(()=>s?r():ga))})),mne=l(2,(e,t)=>{let r=it(t);return r===0?ga:lu(e,da,(n,o)=>(Ib(n,o),n.length>r&&Dm(n,n.length-r),[n,xa]),{onHalt(n){return ma(n)}})}),nz=l(e=>Ce(e[0]),(e,t,r)=>Yt(e,(n,o)=>j(()=>{let s=0,a=!1;return T($(()=>a?Z():n),c=>{let u=c.findIndex(f=>t(f,s++));if(u>=0){a=!0;let f=c.slice(0,r?.excludeLast?u:u+1);return ct(f)?b(f):Z()}return b(c)})}))),oz=l(e=>Ce(e[0]),(e,t,r)=>Yt(e,(n,o)=>j(()=>{let s=0,a=!1;return Zr(function*(){if(a)return yield*Z();let i=yield*n;for(let c=0;c<i.length;c++)if(yield*t(i[c],s++)){a=!0;let u=i.slice(0,r?.excludeLast?c:c+1);return ct(u)?u:yield*Z()}return i})}))),sz=l(2,(e,t)=>Yt(e,(r,n)=>j(()=>{let o=0,s=!1,a=T($(()=>s?Z():r),i=>{let c=[];for(let u=0;u<i.length;u++){if(!t(i[u],o++)){s=!0;break}c.push(i[u])}return ct(c)?b(c):s?Z():a});return a}))),hne=l(2,(e,t)=>Yt(e,(r,n)=>j(()=>{let o=!1,s=T($(()=>o?Z():r),a=>{let i=[];for(let c=0;c<a.length;c++){let u=t(a[c]);if(Q(u)){o=!0;break}i.push(u.success)}return ct(i)?b(i):o?Z():s});return s}))),xne=l(2,(e,t)=>oz(e,(r,n)=>q(t(r,n),o=>!o),{excludeLast:!0})),hv=l(2,(e,t)=>{let r=it(t);return r===0?e:Yt(e,(n,o)=>j(()=>{let s=0,a=n.pipe(T(i=>s>=r?b(i):(s+=i.length,s<=r?a:b(i.slice(r-s)))));return a}))}),gne=l(2,(e,t)=>hv(az(e,(r,n)=>!t(r,n)),1)),yne=l(2,(e,t)=>hv(iz(e,(r,n)=>q(t(r,n),o=>!o)),1)),az=l(2,(e,t)=>Yt(e,(r,n)=>j(()=>{let o=!0,s=0,a=T(r,i=>{let c=i.findIndex(u=>!t(u,s++));return c===-1?a:(o=!1,b(i.slice(c)))});return $(()=>o?a:r)}))),bne=l(2,(e,t)=>Yt(e,(r,n)=>j(()=>{let o=!0,s=T(r,a=>{let i=a.findIndex(c=>Q(t(c)));return i===-1?s:(o=!1,b(a.slice(i)))});return $(()=>o?s:r)}))),iz=l(2,(e,t)=>Yt(e,(r,n)=>j(()=>{let o=!0,s=0,a=Zr(function*(){for(;;){let i=yield*r;for(let c=0;c<i.length;c++)if(!(yield*t(i[c],s++)))return o=!1,i.slice(c)}});return $(()=>o?a:r)}))),Sne=l(2,(e,t)=>{let r=it(t);return r===0?e:Yt(e,(n,o)=>j(()=>{let s=da(),a=T(n,i=>{Tb(s,i);let c=s.length-r,u=nu(s,c);return gr(u)?b(u):a});return a}))}),cz=e=>e.channel.pipe(Vo(Te),R),uz=l(2,(e,t)=>(t=Wn(t),Yt(e,(r,n)=>j(()=>{let o=Ot(),s=0,a,i=!1;return $(function c(){if(i)return Z();if(a===void 0)return T(r,u=>{if(o.length===0&&u.length===t)return b(u);if(o.length+u.length<t){for(let f=0;f<u.length;f++)o.push(u[f]);return c()}return a=u,c()});for(;s<a.length;)if(o.push(a[s++]),o.length===t){let u=o;return o=[],b(u)}return s=0,a=void 0,c()}).pipe(Qe(()=>{if(o.length===0)return Z();let c=o;return i=!0,o=[],b(c)}))})))),Ene=l(2,(e,t)=>fz(e,t,1)),fz=l(3,(e,t,r)=>{let n=Wn(t),o=Wn(r);return Yt(e,(s,a)=>j(()=>{let i=null,c=da(),u=!1,f=0,p=xc(s,{onSuccess(d){if(Tb(c,d),f>0){let x=c.length;Dm(c,f),f=Math.max(0,f-x)}if(c.length<n)return p;u=!0;let m=[];for(;c.length>=n;)if(n===o)m.push(nu(c,n));else{m.push(jL(c,n));let x=c.length;Dm(c,o),f=Math.max(0,o-x)}return b(m)},onFailure(d){return u&&Dm(c,n-o),c.length===0?Ct(d):(i=d,b(Te(ma(c))))}});return $(()=>i?Ct(i):p)}))}),Ine=l(2,(e,t)=>lu(e,Ot,(r,n)=>{let o=Ot();for(let s=0;s<n.length;s++)t(n[s])?gr(r)&&(o.push(r),r=[]):r.push(n[s]);return[r,o]},{onHalt(r){return gr(r)?Te(r):xa}})),Tne=l(4,(e,t,r,n)=>VA(qr(e.channel),qr(t.channel),r,n).pipe(Vo(Te),R)),wne=l(4,(e,t,r,n)=>R(VA(e.channel,t.channel,r,n))),Cne=l(e=>Ce(e[0]),(e,t,r,n)=>R(El(e.channel,t,(o,s)=>{let a=Ot();for(let i=0;i<s.length;i++){let[c,u]=r(o,s[i]);o=c,a.push(...u)}return[o,gr(a)?Te(a):xa]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return ct(s)?Te(s):xa}}:void 0))),lu=l(e=>Ce(e[0]),(e,t,r,n)=>R(El(e.channel,t,(o,s)=>{let[a,i]=r(o,s);return o=a,[o,ct(i)?Te(i):xa]},n?.onHalt?{onHalt(o){let s=n.onHalt(o);return ct(s)?Te(s):xa}}:void 0))),xa=Ot(),kne=l(e=>Ce(e[0]),(e,t,r,n)=>e.channel.pipe(qr,El(t,(o,s)=>q(r(o,s),([a,i])=>[a,ct(i)?Te(i):Ot()]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return ct(s)?Te(s):xa}}:void 0),R)),Ane=l(e=>Ce(e[0]),(e,t,r,n)=>e.channel.pipe(El(t,(o,s)=>q(r(o,s),([a,i])=>[a,ct(i)?Te(i):xa]),n?.onHalt?{onHalt(o){let s=n.onHalt(o);return ct(s)?Te(s):xa}}:void 0),R)),vne=l(3,(e,t,r)=>In(()=>{let n=t();return Cl(uu(n),R(El(e.channel,()=>n,(o,s)=>{let a=Ot();for(let i=0;i<s.length;i++)o=r(o,s[i]),a.push(o);return[o,Te(a)]})))})),One=l(3,(e,t,r)=>In(()=>e.channel.pipe(qr,$$(t(),r),Vo(Te),R))),_ne=l(2,(e,t)=>Yt(e,we(function*(r,n){let o=yield*ac,s=Ye(ge(t)),a,i,c=1/0,u=Sn(),f=Sn(),p=Sn();yield*r.pipe(u.whenOpen,T(m=>(f.openUnsafe(),a=m,c=o.currentTimeMillisUnsafe()+s,te)),nr({disableYield:!0}),Ao(m=>(i=m,c=o.currentTimeMillisUnsafe(),f.openUnsafe(),p.openUnsafe(),te)),Zt(n));let d=$(function m(){let x=o.currentTimeMillisUnsafe(),g=c<x?s:Math.min(s,c-x);return T(Cf(Ha(g),p.await),()=>{if(o.currentTimeMillisUnsafe()<c)return m();if(a){f.closeUnsafe(),u.closeUnsafe();let S=b(Te(Dh(a)));return a=void 0,S}else if(i)return Ct(i);return m()})});return $(()=>{if(i){if(a){let m=b(Te(Dh(a)));return a=void 0,m}return Ct(i)}return u.openUnsafe(),f.whenOpen(d)})}))),lz=l(2,(e,t)=>{let r=t.burst??0;return t.strategy===\"enforce\"?Rne(e,t.cost,t.units,t.duration,r):Pne(e,t.cost,t.units,t.duration,r)}),Rne=(e,t,r,n,o)=>Yt(e,s=>Ec(a=>{let i=Ye(ge(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,f=a.currentTimeMillisUnsafe();return b(T(s,function p(d){return T(t(d),m=>{let x=a.currentTimeMillisUnsafe(),y=(x-f)/i,S=u+y*r,E=S<0?c:Math.min(S,c);return m<=E?(u=E-m,f=x,b(d)):T(s,p)})}))})),Pne=(e,t,r,n,o)=>Yt(e,s=>Ec(a=>{let i=Ye(ge(n)),c=r+o<0?Number.POSITIVE_INFINITY:r+o,u=r,f=a.monotonicTimeNanosUnsafe();return b(T(s,p=>T(t(p),d=>{let m=a.monotonicTimeNanosUnsafe(),g=Number(m-f)/1e6/i,y=u+g*r,E=Math.min(y,c)-d;if(E>=0)return u=E,f=m,b(p);let U=-E/r,F=Math.max(0,U*i);return F>0?T(Ha(F),()=>(u=E,f=m,b(p))):(u=E,f=m,b(p))})))})),Mne=l(2,(e,t)=>lz(e,{...t,cost:r=>b(t.cost(r))})),Fne=l(2,(e,t)=>cz(uz(e,t))),Une=l(3,(e,t,r)=>xv(e,CB(Wn(t)),Yx(r))),Nne=l(e=>Ce(e[0]),(e,t,r)=>pz(e,we(function*(n,o,s){for(let a=0;a<n.length;a++){let[i,c]=yield*t(n[a]),u=Ts(s,i),f=Oe(u)?u.value:yield*dg(ov(o,i));yield*sv(o,i),yield*En(f,c)}}),r)),Dne=l(e=>Ce(e[0]),(e,t,r)=>In(()=>{let n=Um();return pz(e,we(function*(o,s,a){for(let i=0;i<o.length;i++){let c=t(o[i]),u=Ts(n,c);fe(u)?Nm(n,c,[o[i]]):u.value.push(o[i])}for(let[i,c]of n){let u=Ts(a,i),f=Oe(u)?u.value:yield*dg(ov(s,i));yield*sv(s,i),yield*pi(f,c)}bb(n)}),r)})),pz=(e,t,r)=>iv(e,we(function*(n,o,s){let a=yield*UA();yield*Ir(o,io(a));let i=Um(),c=yield*vB({lookup:u=>ea(Xr({capacity:r?.bufferSize??4096}).pipe(Cr(f=>(Nm(i,u,f),En(a,[u,wl(f)])))),f=>(dl(i,u),qm(f))),idleTimeToLive:r?.idleTimeToLive??er}).pipe(Zn(s));return yield*Mn({while:mr,body:Ne(T(n,u=>t(u,c,i))),step:vr}).pipe(_t(u=>Ft(a,u)),Zt(o)),di(a)})),Lne=l(2,(e,t)=>Yt(e,(r,n)=>j(()=>{let o,s,a=Ot(),i=r.pipe(T(u=>{for(let f=0;f<u.length;f++){let p=u[f],d=t(p);if(s===void 0){o=d,s=[p];continue}else if(J(d,o)){s.push(p);continue}a.push([o,s]),o=d,s=[p]}if(gr(a)){let f=a;return a=[],b(f)}return i})),c=!1;return Qe($(()=>c?Z():i),()=>{c=!0;let u=s;return s=void 0,u&&gr(u)?b(Te([o,u])):Z()})}))),$ne=l(2,(e,t)=>Yt(e,(r,n)=>j(()=>{let o,s,a=$(()=>{if(s!==void 0){let c=s;return s=void 0,b(c)}return r}).pipe(wf(c=>(o=Gs(c),Z()))),i=q($(()=>t.transform(a,n)),([c,u])=>(s=u,Te(c)));return $(()=>o||i)}))),Bne=l(2,(e,t)=>xv(e,t,yf)),xv=l(3,(e,t,r)=>R(Ko(we(function*(n,o,s){let a=yield*As(e.channel,o),i=Sn(!1),c=Symbol(),u=yield*Xr({capacity:0});yield*a.pipe(i.whenOpen,T(h=>(i.closeUnsafe(),En(u,h))),nr,_t(h=>Ft(u,h)),Zt(s));let f=yield*ac,p=yield*Xn(r),d=Sn(!1),m=f.currentTimeMillisUnsafe(),x=0,g=v(),y,S=h=>(d.openUnsafe()&&(x=f.currentTimeMillisUnsafe()),b(h)),E=d.await.pipe(T(()=>p(m,g)),T(([,h])=>Ha(h)),T(()=>En(u,c)),Qe(()=>qm(u)),T(()=>hc)),U=$(()=>{if(y!==void 0){let h=y;return y=void 0,S(h)}return u.state._tag===\"Open\"&&i.openUnsafe(),T(Cs(u),h=>h===c?Z():S(h))}),F=T(([h,I])=>{if(d.isOpen())m+=f.currentTimeMillisUnsafe()-x;else if(u.state._tag===\"Done\")return Z();return g=O(h),y=I,b(Te(h))});return $(()=>{if(u.state._tag===\"Done\"&&y===void 0)return u.state.exit;d.closeUnsafe();let h=F($(()=>t.transform(U,s)));return u.state._tag===\"Open\"?Cf(h,E):h})})))),zne=l(2,we(function*(e,t){let r=it(t.n),n=yield*jne(t),o=new Array(r),s=yield*Ur;for(let a=0;a<r;a++){let i=wt(s),c=yield*Bm(n).pipe(ds(Ur,i));o[a]=JA(Fb(c)).pipe(Km(u=>De(i,u)),R)}return yield*au(e.channel,a=>Mb(n,a)).pipe(Fn(a=>Pb(n,a)),Af),o})),jne=e=>ea(e.capacity===\"unbounded\"?Lm(e):e.strategy===\"dropping\"?_b(e):e.strategy===\"sliding\"?Rb(e):Ob(e),$m),dz=l(2,(e,t)=>q(Cz(e,t),HB)),qne=l(2,(e,t)=>q(FB({acquire:dz(e,t),idleTimeToLive:t.idleTimeToLive}),r=>hi(UB(r)))),Hne=l(2,(e,t)=>R(Yb(e.channel,t))),Wne=l(2,(e,t)=>R(ZA(e.channel,t))),Jne=l(2,(e,t)=>e.channel.pipe(ZA(wB(t)),C$(([r,n])=>n?Wb(n):Sl),R)),Gne=e=>nS(Tz(e)),Kne=e=>lu(e,Ot,(t,r)=>{let n=Nh(t,r);return[n,[n]]}),Vne=e=>mz(e,J),mz=l(2,(e,t)=>Yt(e,(r,n)=>j(()=>{let o=!0,s;return T(r,function a(i){let c=[],u=0;for(o&&(o=!1,s=i[0],u=1,c.push(s));u<i.length;u++){let f=i[u];t(f,s)||(s=f,c.push(f))}return gr(c)?b(c):T(r,a)})}))),Zne=l(2,(e,t)=>Yt(e,(r,n)=>j(()=>{let o=!0,s;return T(r,we(function*a(i){let c=[],u=0;for(o&&(o=!1,s=i[0],u=1,c.push(s));u<i.length;u++){let f=i[u];(yield*t(f,s))||(s=f,c.push(f))}return gr(c)?c:yield*T(r,we(a))}))}))),Qne=l(e=>Ce(e[0]),(e,t)=>In(()=>{let r=new TextDecoder(t?.encoding);return Tn(e,n=>r.decode(n,{stream:!0}))})),Yne=e=>In(()=>{let t=new TextEncoder;return Tn(e,r=>t.encode(r))}),Xne=e=>e.channel.pipe(Yb(eB()),R),hz=l(2,(e,t)=>JB(e,(r,n)=>{let o=n===0?[]:[t],s=r.length-1;for(let a=0;a<r.length;a++)a===s?o.push(r[a]):o.push(r[a],t);return o})),eoe=l(2,(e,t)=>uu(t.start).pipe(Cl(hz(e,t.middle)),Cl(uu(t.end)))),toe=l(2,(e,t)=>xz(e,t,fu(t_([!0,!1])))),xz=l(3,(e,t,r)=>R(ke(we(function*(n,o){let s=yield*me(qr(r.channel))(n,o),a=Symbol(),i=!1,c=!1,u=(yield*me(qr(e.channel))(n,o)).pipe(Qe(()=>(i=!0,b(a)))),f=(yield*me(qr(t.channel))(n,o)).pipe(Qe(()=>(c=!0,b(a))));return Zr(function*(){for(;;){if(i&&c)return yield*Z();let p=yield*s;if(p&&i||!p&&c)continue;let d=yield*p?u:f;if(d!==a)return Te(d)}})})))),roe=l(2,(e,t)=>R(oB(e.channel,t))),noe=l(2,(e,t)=>R(sB(e.channel,t))),gz=l(2,(e,t)=>R(Km(e.channel,t))),ooe=l(2,(e,t)=>R(aB(e.channel,t))),yz=l(2,(e,t)=>R(iB(e.channel,t))),bz=l(2,(e,t)=>R(QA(e.channel,r=>t(r[0])))),soe=l(2,(e,t)=>R(cB(e.channel,t))),aoe=l(2,(e,t)=>R(uB(e.channel,t))),Sz=l(e=>Ce(e[0]),(e,t,r)=>R(fB(e.channel,t,r))),ioe=l(2,(e,t)=>R(Xb(e.channel,t))),coe=l(3,(e,t,r)=>R(eS(e.channel,t,r))),gv=l(3,(e,t,r)=>R(tS(e.channel,t,r))),Ez=l(2,(e,t)=>R(lB(e.channel,t))),uoe=l(3,(e,t,r)=>Ez(e,n=>Bt(n,t,r(Ie(n,t))))),foe=function(){let e=Ce(arguments[0]),t=e?arguments[1]:arguments[0],r=Gn(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return R(YA(n.channel,t,r))}return n=>R(YA(n.channel,t,r))},loe=uu({}),poe=l(3,(e,t,r)=>Tn(e,n=>({...n,[t]:r(n)})));var doe=l(e=>Ce(e[0]),(e,t,r,n)=>kl(e,o=>Tn(r(o),s=>({...o,[t]:s})),n)),moe=l(e=>Ce(e[0]),(e,t,r,n)=>Qm(e,o=>q(r(o),s=>({...o,[t]:s})),n)),hoe=l(2,(e,t)=>Tn(e,r=>({[t]:r}))),Iz=l(2,(e,t)=>V0(r=>As(e.channel,r).pipe(T(n=>t.transform(n,r)),q(([n])=>n)))),Tz=e=>iu(e.channel,()=>[],(t,r)=>{for(let n=0;n<r.length;n++)t.push(r[n]);return t}),xoe=e=>iu(e.channel,()=>0,(t,r)=>t+r.length),goe=e=>iu(e.channel,()=>0,(t,r)=>{for(let n=0;n<r.length;n++)t+=r[n];return t}),yoe=l(3,(e,t,r)=>iu(e.channel,t,(n,o)=>{for(let s=0;s<o.length;s++)n=r(n,o[s]);return n})),boe=l(3,(e,t,r)=>xB(e.channel,t,(n,o)=>{let s=0,a=n;return q(Mn({while:()=>s<o.length,body:()=>r(a,o[s]),step(i){a=i,s++}}),()=>a)})),Soe=e=>q(mB(e.channel),Wt(l_(0))),Eoe=e=>q(hB(e.channel),Wt(Dh)),Ioe=l(2,(e,t)=>au(e.channel,r=>{let n=0;return Mn({while:()=>n<r.length,body:()=>t(r[n++]),step:vr})})),Toe=l(2,(e,t)=>dB(e.channel,r=>{let n=!1,o=0;return q(Mn({while:()=>!n&&o<r.length,body:()=>t(r[o]),step(s){o++,s||(n=!0)}}),()=>!n)})),wz=l(2,(e,t)=>au(e.channel,t)),iS=e=>pB(e.channel),woe=e=>ev(e.channel),Coe=e=>iu(e.channel,()=>\"\",(t,r)=>t+r.join(\"\")),koe=e=>q(XA(e.channel),t=>t.buffer),Aoe=e=>XA(e.channel),yv=l(e=>Ce(e[0]),(e,t,r)=>{let n,o,s=Sn(!1);return new ReadableStream({start(a){o=hs(cn(wz(e,i=>s.whenOpen(j(()=>{s.closeUnsafe();for(let c=0;c<i.length;c++)a.enqueue(i[c]);n(),n=void 0}))),t)),o.addObserver(i=>{i._tag===\"Failure\"?a.error(cf(i.cause)):a.close()})},pull(){return new Promise(a=>{n=a,s.openUnsafe()})},cancel(){if(o)return bc(qa(Ho(o)))}},r?.strategy)}),voe=l(e=>Ce(e[0]),(e,t)=>yv(e,Xt(),t)),Ooe=l(e=>Ce(e[0]),(e,t)=>q(Xs(),r=>yv(e,r,t))),bv=l(2,(e,t)=>({[Symbol.asyncIterator](){let r=ud(t),n=Lr(t),o=an(),s,a,i,c,u=p=>{if(c)return c;let d=i;return c=r(Vt(Dr(d?Ho(d):te,De(o,p)),{done:!0,value:void 0})),c},f=async p=>{try{await u(p)}catch(d){await r(sT(\"Suppressed error while closing Stream async iterator\",d))}};return{async next(){if(c)return c;if(a){let m=a.next();if(!m.done)return m;a=void 0}let p=n(s??T(As(e.channel,o),m=>(s=m,m)));i=p;let d=await r(ml(p));if(i===p&&(i=void 0),je(d))return a=d.value[Symbol.iterator](),a.next();if(ls(d.cause))return u(ht);if(c&&qp(d.cause))return c;throw await f(d),cf(d.cause)},return(){return u(ht)},async throw(p){throw await f(PI(p)),p}}}})),_oe=e=>q(Xs(),t=>bv(e,t)),Roe=e=>bv(e,Xt()),Poe=l(e=>Ce(e[0]),(e,t,r)=>rv(e.channel,t,r)),Moe=l(2,(e,t)=>bB(e.channel,t)),Cz=l(2,(e,t)=>SB(e.channel,t)),Foe=l(2,(e,t)=>gB(e.channel,t)),Uoe=l(2,(e,t)=>tv(e.channel,t));var kz=fr(\"effect/FileSystem\");var vz=\"~effect/Path\",Noe=fr(\"effect/Path\");function Oz(e,t){let r=\"\",n=0,o=-1,s=0,a;for(let i=0;i<=e.length;++i){if(i<e.length)a=e.charCodeAt(i);else{if(a===47)break;a=47}if(a===47){if(!(o===i-1||s===1))if(o!==i-1&&s===2){if(r.length<2||n!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){let c=r.lastIndexOf(\"/\");if(c!==r.length-1){c===-1?(r=\"\",n=0):(r=r.slice(0,c),n=r.length-1-r.lastIndexOf(\"/\")),o=i,s=0;continue}}else if(r.length===2||r.length===1){r=\"\",n=0,o=i,s=0;continue}}t&&(r.length>0?r+=\"/..\":r=\"..\",n=2)}else r.length>0?r+=\"/\"+e.slice(o+1,i):r=e.slice(o+1,i),n=i-o-1;o=i,s=0}else a===46&&s!==-1?++s:s=-1}return r}function Doe(e,t){let r=t.dir||t.root,n=t.base||(t.name||\"\")+(t.ext||\"\");return r?r===t.root?r+n:r+e+n:n}function Loe(e){if(e.protocol!==\"file:\")return M(new cu({module:\"Path\",method:\"fromFileUrl\",description:\"URL must be of scheme file\"}));if(e.hostname!==\"\")return M(new cu({module:\"Path\",method:\"fromFileUrl\",description:\"Invalid file URL host\"}));let t=e.pathname;for(let r=0;r<t.length;r++)if(t[r]===\"%\"){let n=t.codePointAt(r+2)|32;if(t[r+1]===\"2\"&&n===102)return M(new cu({module:\"Path\",method:\"fromFileUrl\",description:\"must not include encoded / characters\"}))}return b(decodeURIComponent(t))}var _z=function(){let t=\"\",r=!1,n;for(let o=arguments.length-1;o>=-1&&!r;o--){let s;if(o>=0)s=arguments[o];else{let a=globalThis.process;n===void 0&&\"process\"in globalThis&&typeof a==\"object\"&&a!==null&&typeof a.cwd==\"function\"&&(n=a.cwd()),s=n}s.length!==0&&(t=s+\"/\"+t,r=s.charCodeAt(0)===47)}return t=Oz(t,!r),r?t.length>0?\"/\"+t:\"/\":t.length>0?t:\".\"},$oe=47;function Boe(e){let t=new URL(\"file://\"),r=_z(e);return e.charCodeAt(e.length-1)===$oe&&r[r.length-1]!==\"/\"&&(r+=\"/\"),t.pathname=Joe(r),b(t)}var zoe=/%/g,joe=/\\\\/g,qoe=/\\n/g,Hoe=/\\r/g,Woe=/\\t/g;function Joe(e){return e.includes(\"%\")&&(e=e.replace(zoe,\"%25\")),e.includes(\"\\\\\")&&(e=e.replace(joe,\"%5C\")),e.includes(`\n`)&&(e=e.replace(qoe,\"%0A\")),e.includes(\"\\r\")&&(e=e.replace(Hoe,\"%0D\")),e.includes(\"\t\")&&(e=e.replace(Woe,\"%09\")),e}var Ev=Noe.of({[vz]:vz,resolve:_z,normalize(e){if(e.length===0)return\".\";let t=e.charCodeAt(0)===47,r=e.charCodeAt(e.length-1)===47;return e=Oz(e,!t),e.length===0&&!t&&(e=\".\"),e.length>0&&r&&(e+=\"/\"),t?\"/\"+e:e},isAbsolute(e){return e.length>0&&e.charCodeAt(0)===47},join(){if(arguments.length===0)return\".\";let e;for(let t=0;t<arguments.length;++t){let r=arguments[t];r.length>0&&(e===void 0?e=r:e+=\"/\"+r)}return e===void 0?\".\":Ev.normalize(e)},relative(e,t){if(e===t||(e=Ev.resolve(e),t=Ev.resolve(t),e===t))return\"\";let r=1;for(;r<e.length&&e.charCodeAt(r)===47;++r);let n=e.length,o=n-r,s=1;for(;s<t.length&&t.charCodeAt(s)===47;++s);let i=t.length-s,c=o<i?o:i,u=-1,f=0;for(;f<=c;++f){if(f===c){if(i>c){if(t.charCodeAt(s+f)===47)return t.slice(s+f+1);if(f===0)return t.slice(s+f)}else o>c&&(e.charCodeAt(r+f)===47?u=f:f===0&&(u=0));break}let d=e.charCodeAt(r+f),m=t.charCodeAt(s+f);if(d!==m)break;d===47&&(u=f)}let p=\"\";for(f=r+u+1;f<=n;++f)(f===n||e.charCodeAt(f)===47)&&(p.length===0?p+=\"..\":p+=\"/..\");return p.length>0?p+t.slice(s+u):(s+=u,t.charCodeAt(s)===47&&++s,t.slice(s))},dirname(e){if(e.length===0)return\".\";let t=e.charCodeAt(0),r=t===47,n=-1,o=!0;for(let s=e.length-1;s>=1;--s)if(t=e.charCodeAt(s),t===47){if(!o){n=s;break}}else o=!1;return n===-1?r?\"/\":\".\":r&&n===1?\"//\":e.slice(0,n)},basename(e,t){let r=0,n=-1,o=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return\"\";let a=t.length-1,i=-1;for(s=e.length-1;s>=0;--s){let c=e.charCodeAt(s);if(c===47){if(!o){r=s+1;break}}else i===-1&&(o=!1,i=s+1),a>=0&&(c===t.charCodeAt(a)?--a===-1&&(n=s):(a=-1,n=i))}return r===n?n=i:n===-1&&(n=e.length),e.slice(r,n)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!o){r=s+1;break}}else n===-1&&(o=!1,n=s+1);return n===-1?\"\":e.slice(r,n)}},extname(e){let t=-1,r=0,n=-1,o=!0,s=0;for(let a=e.length-1;a>=0;--a){let i=e.charCodeAt(a);if(i===47){if(!o){r=a+1;break}continue}n===-1&&(o=!1,n=a+1),i===46?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||n===-1||s===0||s===1&&t===n-1&&t===r+1?\"\":e.slice(t,n)},format:function(t){if(t===null||typeof t!=\"object\")throw new TypeError('The \"pathObject\" argument must be of type Object. Received type '+typeof t);return Doe(\"/\",t)},parse(e){let t={root:\"\",dir:\"\",base:\"\",ext:\"\",name:\"\"};if(e.length===0)return t;let r=e.charCodeAt(0),n=r===47,o;n?(t.root=\"/\",o=1):o=0;let s=-1,a=0,i=-1,c=!0,u=e.length-1,f=0;for(;u>=o;--u){if(r=e.charCodeAt(u),r===47){if(!c){a=u+1;break}continue}i===-1&&(c=!1,i=u+1),r===46?s===-1?s=u:f!==1&&(f=1):s!==-1&&(f=-1)}return s===-1||i===-1||f===0||f===1&&s===i-1&&s===a+1?i!==-1&&(a===0&&n?t.base=t.name=e.slice(1,i):t.base=t.name=e.slice(a,i)):(a===0&&n?(t.name=e.slice(1,s),t.base=e.slice(1,i)):(t.name=e.slice(a,s),t.base=e.slice(a,i)),t.ext=e.slice(s,i)),a>0?t.dir=e.slice(0,a-1):n&&(t.dir=\"/\"),t},sep:\"/\",fromFileUrl:Loe,toFileUrl:Boe,toNamespacedPath:A});function Koe(e){return{_tag:\"Value\",value:e}}function Voe(e,t){return{_tag:\"Record\",keys:e,value:t}}function Zoe(e,t){return{_tag:\"Array\",length:e,value:t}}var Rz=Se(\"effect/ConfigProvider\",{defaultValue:()=>nse()}),Qoe={...Et,toJSON(){return{_id:\"ConfigProvider\"}}},Yoe=e=>e;function Xoe(e,t){let r=Object.create(Qoe);return r.load=e,r.mapInput=t,r}function Pz(e,t){return Xoe(r=>e(t(r)),r=>Pz(e,n=>r(t(n))))}function ese(e){return Pz(e,Yoe)}function tse(e,t){return e===\"\"&&!t?void 0:e}function rse(e,t){let r=t?.preserveEmptyStrings===!0,n=ose(e);return ese(o=>b(sse(n,e,o,r)))}function nse(e){let t=e?.env??{...globalThis.process?.env,...import.meta?.env};return rse(t,{preserveEmptyStrings:e?.preserveEmptyStrings})}function ose(e){let t={};for(let[r,n]of Object.entries(e)){if(n===void 0)continue;let o=r.split(\"_\"),s=t;for(let a of o){let i=s.children??=Object.create(null);s=i[a]??={}}}return t}function sse(e,t,r,n){let o=r.map(String).join(\"_\"),s=tse(Object.hasOwn(t,o)?t[o]:void 0,n),a=ase(e,r),i=a?.children?Object.keys(a.children):[];if(i.length===0)return s===void 0?void 0:Koe(s);if(i.every(Lu)){let u=Math.max(...i.map(f=>parseInt(f,10)))+1;return Zoe(u,s)}return Voe(new Set(i),s)}function ase(e,t){if(t.length===0)return e;let r=e;for(let n of t)if(r=r?.children?.[String(n)],!r)return;return r}var Fz=\"~effect/Config\";var cS=class{_tag=\"ConfigError\";name=\"ConfigError\";cause;constructor(t){this.cause=t}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}},ise={...Ih({label:\"Config\",evaluate(e){return this.parse(e.getRef(Rz))}}),[Fz]:Fz,toJSON(){return{_id:\"Config\"}}};function Xm(e){let t=Object.create(ise);return t.evaluator=e,t.parse=r=>ut(e(r,[]),sd),t}var pu=(e,t,r)=>e.evaluator(t,r),cse=l(2,(e,t)=>Xm((r,n)=>q(pu(e,r,n),mt(t))));var kme=l(2,(e,t)=>Xm((r,n)=>J0(pu(e,r,n),{onFailure:o=>pu(t(o),r,n),onSuccess:o=>Q(o)?pu(t(o.failure),r,n):b(o)})));function Ame(e){let t=globalThis.Array.isArray(e)?e:Symbol.iterator in e?[...e]:e;return Xm((r,n)=>globalThis.Array.isArray(t)?Un(ig(t.map(o=>pu(o,r,n))),Uu):Un(ig(Du(t,o=>pu(o,r,n))),Uu))}var use=l(2,(e,t)=>Xm((r,n)=>Un(pu(e,r,n),o=>Q(o)?P(t):o))),vme=e=>e.pipe(cse(O),use(v()));var fse=e=>Nt(e,\"SourceError\"),lse=()=>\"<configuration>\",Nz=(e,t)=>e.load(t).pipe(B0,Un(r=>({provider:e,path:t,node:r,toString:lse}))),Uz=(e,t)=>Nz(e.provider,[...e.path,t]),Iv=(e,t)=>aa(oo,e,new ye(ft(r=>t(r)),or())),Dz=e=>{switch(e._tag){case\"Union\":return e.types.every(Dz);case\"Objects\":case\"Arrays\":case\"Suspend\":return!1;default:return!0}},Tv=(e,t)=>{switch(e._tag){case\"Objects\":return t?._tag===\"Record\";case\"Arrays\":return t?._tag===\"Array\";case\"Union\":return e.types.some(r=>Tv(r,t));case\"Suspend\":return Tv(e.thunk(),t);default:return t?.value!==void 0}},pse=wn(e=>{let t=new WeakSet,r=PC(n=>{switch(t.add(n),n._tag){case\"Objects\":{let o=n.indexSignatures.map(a=>ii(a.parameter)),s=we(function*(a){if(a.node?._tag!==\"Record\")return;let i=a.node,c=new Set;for(let f of n.propertySignatures)typeof f.name==\"string\"&&c.add(f.name);if(o.length>0)for(let f of i.keys)o.some(p=>p(f))&&c.add(f);let u={};for(let f of c){let p=yield*Uz(a,f);p.node!==void 0&&N(u,f,p)}return u});return Iv(n.recur(r,a=>a),s)}case\"Arrays\":{let o=we(function*(s){if(s.node?._tag!==\"Array\")return;let a=[];for(let i=0;i<s.node.length;i++)a.push(yield*Uz(s,i));return a});return Iv(n.recur(r),o)}case\"Union\":for(let o of n.types)r(o);if(!Dz(n))return n.recur(r);break;case\"Suspend\":{let o=n.thunk();return t.has(o)||r(o),n.recur(r)}case\"Declaration\":case\"Any\":throw new globalThis.Error(\"Config.schema does not support opaque StringTree encodings\",{cause:n})}return Iv(n,o=>b(o.node?.value))});return r(e)});function du(e,t){let r=Fm(e),n=xn(r.ast),o=Xe(G(pse(r.ast))),s=typeof t==\"string\"?[t]:t??[];return Xm((a,i)=>{let c=[...i,...s];return Nz(a,c).pipe(ut(u=>o(u).pipe(Un(P),vf(f=>{let p=new cS(new fa(c.length>0?new xt(c,f):f));return Tv(n,u.node)?M(p):b(D(p))}))),id(u=>fse(u)?M(new cS(u)):Tr(u)))})}var Lz=e=>ir(e)||globalThis.Array.isArray(e);function Ome(e){return du(X,e)}function _me(e){return du(Is,e)}function Rme(e,t){return du(Es(e),t)}function Pme(e,t,r){let n=Lz(t),o=n?r:t,s=qe(e),a=o?.separator??\",\",i=X.pipe(ee(Fm(s),{decode:Cw(o),encode:ei(or({strict:!1}),Y(c=>c.join(a)))}));return du(yt([i,s]),n?t:void 0)}function Mme(e,t,r,n){let o=Lz(r),s=la(e,t),a=zw(o?n:r),i=X.pipe(ee(Fm(s),{decode:a.decode,encode:ei(or({strict:!1}),a.encode)}));return du(yt([s,i]),o?r:void 0)}function Fme(e){return du(eA,e)}function Ume(e){return du(pb,e)}var Nme=\"~effect/ErrorReporter/ignore\";var jz={};$e(jz,{add:()=>Sse,addUnsafe:()=>uS,awaitEmpty:()=>Cse,clear:()=>Ese,isFiberSet:()=>Cv,join:()=>wse,make:()=>kv,makeRuntime:()=>gse,makeRuntimePromise:()=>yse,run:()=>Ise,runtime:()=>vv,runtimePromise:()=>zz,size:()=>Tse});var wv=\"~effect/FiberSet\",Cv=e=>w(e,wv),hse={[wv]:wv,[Symbol.iterator](){return this.state._tag===\"Closed\"?n_():this.state.backing[Symbol.iterator]()},...Et,toJSON(){return{_id:\"FiberSet\",state:this.state}}},xse=(e,t)=>{let r=Object.create(hse);return r.state={_tag:\"Open\",backing:e},r.deferred=t,r},kv=()=>ea(j(()=>xse(new Set,ko())),e=>$(()=>{let t=e.state;if(t._tag===\"Closed\")return te;e.state={_tag:\"Closed\"};let r=t.backing;return NL(r).pipe(_x(e.deferred))})),gse=()=>T(kv(),e=>vv(e)()),yse=()=>T(kv(),e=>zz(e)()),Av=-1,bse=m_(x_(ZI,h_(Av))),uS=l(e=>Cv(e[0]),(e,t,r)=>{if(e.state._tag===\"Closed\"){t.interruptUnsafe(Av);return}else if(e.state.backing.has(t))return;e.state.backing.add(t),t.addObserver(n=>{e.state._tag!==\"Closed\"&&(e.state.backing.delete(t),Co(n)&&(r?.propagateInterruption===!0?!bse(n.cause):!qp(n.cause))&&_n(e.deferred,n))})}),Sse=l(e=>Cv(e[0]),(e,t,r)=>j(()=>uS(e,t,r))),Ese=e=>$(()=>e.state._tag===\"Closed\"?te:DL(e.state.backing,Av)),Bz=(function(){let e;return()=>(e===void 0&&(e=hs(un)),e)})(),Ise=function(){let e=arguments[0];if(!ps(arguments[1])){let t=arguments[1];return r=>$z(e,r,t)}return $z(e,arguments[1],arguments[2])},$z=(e,t,r)=>wr(n=>{if(e.state._tag===\"Closed\")return j(Bz);let o=is(n,t,r?.startImmediately??!0,!0);return uS(e,o,r),b(o)}),vv=e=>()=>q(Xs(),t=>{let r=Lr(t);return(n,o)=>{if(e.state._tag===\"Closed\")return Bz();let s=r(n,o);return uS(e,s,o),s}}),zz=e=>()=>q(vv(e)(),t=>(r,n)=>new Promise((o,s)=>t(r,n).addObserver(a=>{je(a)?o(a.value):s(cf(a.cause))}))),Tse=e=>j(()=>e.state._tag===\"Closed\"?0:e.state.backing.size),wse=e=>tc(e.deferred),Cse=e=>Mn({while:()=>e.state._tag===\"Open\"&&e.state.backing.size>0,body:()=>ml(Uh(e)),step:vr});var $me=\"~effect/PrimaryKey\";var Qz={};$e(Qz,{CurrentLoggers:()=>Hz,LogToStderr:()=>vse,batched:()=>Zz,consoleJson:()=>zse,consoleLogFmt:()=>$se,consolePretty:()=>Nse,consolePrettyBrowser:()=>Dse,consolePrettyTty:()=>Lse,consoleStructured:()=>Bse,defaultLogger:()=>Fse,formatJson:()=>Vz,formatLogFmt:()=>Kz,formatSimple:()=>Use,formatStructured:()=>Ov,isLogger:()=>qz,layer:()=>qse,make:()=>Mse,map:()=>Wz,toFile:()=>Hse,tracerLogger:()=>jse,withConsoleError:()=>Ose,withConsoleLog:()=>fS,withLeveledConsole:()=>_se});var Ase=\"~effect/Logger\",qz=e=>w(e,Ase),Hz=ef,vse=Ox,Wz=l(2,(e,t)=>on(r=>t(e.log(r)))),fS=e=>on(t=>t.fiber.getRef(ec).log(e.log(t))),Ose=e=>on(t=>t.fiber.getRef(ec).error(e.log(t))),_se=e=>on(t=>{let r=t.fiber.getRef(ec),n=e.log(t);switch(t.logLevel){case\"Debug\":return r.debug(n);case\"Info\":return r.info(n);case\"Trace\":return r.trace(n);case\"Warn\":return r.warn(n);case\"Error\":case\"Fatal\":return r.error(n);default:return r.log(n)}}),Rse=/^[^\\s\"=]*$/,Pse=e=>`\"${e.replace(/\\\\([\\s\\S])|(\")/g,\"\\\\$1$2\")}\"`,Jz=e=>`#${e}`,Gz=(e,t)=>({cause:r,date:n,fiber:o,logLevel:s,message:a})=>{let i=y=>typeof y==\"string\"?y:L(y,{space:t}),c=y=>y.match(Rse)?y:e(y),u=(y,S)=>`${kI(y)}=${c(S)}`,f=(y,S)=>\" \"+u(y,S),p=u(\"timestamp\",n.toISOString());p+=f(\"level\",s.toUpperCase()),p+=f(\"fiber\",Jz(o.id));let d=aE(a);for(let y=0;y<d.length;y++)p+=f(\"message\",i(d[y]));r.reasons.length>0&&(p+=f(\"cause\",Bs(r)));let m=n.getTime(),x=o.getRef($p);for(let y of x)p+=\" \"+Fp(y,m);let g=o.getRef(Lp);for(let[y,S]of Object.entries(g))p+=f(y,i(S));return p},Mse=on,Fse=_I,Use=on(Gz(Pse)),Kz=on(Gz(JSON.stringify,0)),Ov=on(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s={},a={},i=r.getRef(Lp);for(let[p,d]of Object.entries(i))N(s,p,tf(d));let c=t.getTime(),u=r.getRef($p);for(let[p,d]of u)N(a,p,c-d);let f=aE(o);return{message:f.length===1?tf(f[0]):f.map(tf),level:n.toUpperCase(),timestamp:t.toISOString(),cause:e.reasons.length>0?Bs(e):void 0,annotations:s,spans:a,fiberId:Jz(r.id)}}),Vz=Wz(Ov,_s),Zz=l(2,(e,t)=>B(Qi,r=>{let n=[],o=W(()=>{if(n.length===0)return le;let s=n;return n=[],t.flush(s)});return Vr(s=>s(Ua(t.window).pipe(br(o),Ku)).pipe(wx,B(a=>as(r,()=>Gi(a))),br(Fa(()=>o)),Kt(on(a=>{n.push(e.log(a))}))))})),Nse=OM,Dse=OI,Lse=vI,$se=fS(Kz),Bse=fS(Ov),zse=fS(Vz),jse=RI,qse=(e,t)=>sf(Hz,re(vp(function*(r){let n=new Set(t?.mergeWithExisting===!0?r.getRef(ef):[]);for(let o of e)n.add(ue(o)?yield*o:o);return n}))),Hse=l(e=>qz(e[0]),(e,t,r)=>sx(function*(){let o=yield*(yield*kz).open(t,{flag:\"a+\",...r}),s=new TextEncoder;return yield*Zz(e,{window:r?.batchWindow??1e3,flush:a=>dx(o.writeAll(s.encode(a.join(`\n`)+`\n`)))})}));var Yz={};$e(Yz,{isManagedRuntime:()=>Wse,make:()=>Jse});var _v=\"~effect/ManagedRuntime\",Wse=e=>w(e,_v),Jse=(e,t)=>{let r=t?.memoMap??us(),n=an(\"sequential\"),o=wt(n,\"sequential\"),s=wt(n,\"parallel\"),a={onFiberStart:ws(s)},i=p=>p?{...p,onFiberStart:p.onFiberStart?d=>{a.onFiberStart(d),p.onFiberStart(d)}:a.onFiberStart}:a,c,u=wr(p=>(c||(c=hs(Cr(Ks(e,r,o),d=>j(()=>{f.cachedContext=d})),{...a,scheduler:p.cache.scheduler})),ad(ml(c)))),f={[_v]:_v,memoMap:r,scope:n,contextEffect:u,cachedContext:void 0,context(){return f.cachedContext===void 0?bc(f.contextEffect):Promise.resolve(f.cachedContext)},dispose(){return bc(f.disposeEffect)},[Symbol.asyncDispose](){return f.dispose()},disposeEffect:$(()=>(f.contextEffect=Tr(\"ManagedRuntime disposed\"),f.cachedContext=void 0,De(f.scope,ht))),runFork(p,d){return f.cachedContext===void 0?hs(Al(f,p),i(d)):Lr(f.cachedContext)(p,i(d))},runCallback(p,d){return f.cachedContext===void 0?eT(Al(f,p),i(d)):X0(f.cachedContext)(p,i(d))},runSyncExit(p){return f.cachedContext===void 0?ro(Al(f,p)):oT(f.cachedContext)(p)},runSync(p){return f.cachedContext===void 0?rT(Al(f,p)):nT(f.cachedContext)(p)},runPromiseExit(p,d){return f.cachedContext===void 0?Sc(Al(f,p),i(d)):tT(f.cachedContext)(p,i(d))},runPromise(p,d){return f.cachedContext===void 0?bc(Al(f,p),i(d)):ud(f.cachedContext)(p,i(d))}};return f};function Al(e,t){return T(e.contextEffect,r=>cn(t,r))}var bj={};$e(bj,{any:()=>Eae,bigint:()=>kae,boolean:()=>Tae,date:()=>vae,defined:()=>Iae,discriminator:()=>cae,discriminatorStartsWith:()=>uae,discriminators:()=>fae,discriminatorsExhaustive:()=>lae,exhaustive:()=>Nae,fn:()=>eae,instanceOf:()=>_ae,instanceOfUnsafe:()=>Rae,is:()=>yae,nonEmptyString:()=>gae,not:()=>xae,null:()=>Cae,number:()=>Sae,option:()=>Uae,orElse:()=>Pae,orElseAbsurd:()=>Mae,record:()=>Oae,result:()=>Fae,string:()=>bae,symbol:()=>Aae,tag:()=>pae,tagStartsWith:()=>dae,tags:()=>mae,tagsExhaustive:()=>hae,type:()=>Xse,typeTags:()=>nae,undefined:()=>wae,value:()=>tae,valueTags:()=>rae,when:()=>sae,whenAnd:()=>iae,whenOr:()=>aae,withReturnType:()=>oae});var Pv=\"~effect/Match/Matcher\",Gse={[Pv]:{_input:A,_filters:A,_remaining:A,_result:A,_return:A,_args:A},_tag:\"TypeMatcher\",add(e){return eh(this.select,[...this.cases,e])},pipe(){return K(this,arguments)}};function eh(e,t){let r=Object.create(Gse);return r.select=e,r.cases=t,r}var Kse={[Pv]:{_input:A,_filters:A,_result:A,_return:A,_flavor:A},_tag:\"ValueMatcher\",add(e){return ze(this.value)?this:e._tag===\"When\"&&e.guard(this.provided)===!0?Rv(this.provided,P(e.evaluate(this.provided))):e._tag===\"Not\"&&e.guard(this.provided)===!1?Rv(this.provided,P(e.evaluate(this.provided))):this},pipe(){return K(this,arguments)}};function Rv(e,t){let r=Object.create(Kse);return r.provided=e,r.value=t,r}var Ol=(e,t)=>({_tag:\"When\",guard:e,evaluate:t}),Vse=(e,t)=>({_tag:\"Not\",guard:e,evaluate:t}),vl=e=>{if(typeof e==\"function\")return e;if(Array.isArray(e)){let t=e.map(vl),r=t.length;return n=>{if(!Array.isArray(n))return!1;for(let o=0;o<r;o++)if(t[o](n[o])===!1)return!1;return!0}}else if(e!==null&&typeof e==\"object\"){let t=Reflect.ownKeys(e).map(n=>[n,vl(e[n])]),r=t.length;return n=>{if(typeof n!=\"object\"||n===null)return!1;for(let o=0;o<r;o++){let[s,a]=t[o];if(!(s in n)||a(n[s])===!1)return!1}return!0}}return t=>t===e},Zse=e=>{let t=e.map(vl),r=t.length;return n=>{for(let o=0;o<r;o++)if(t[o](n)===!0)return!0;return!1}},Qse=e=>{let t=e.map(vl),r=t.length;return n=>{for(let o=0;o<r;o++)if(t[o](n)===!1)return!1;return!0}},ej=()=>eh(A,[]),tj=e=>eh(e,[]),rj=e=>Rv(e,D(e)),nj=l(2,(e,t)=>pS(t)(eh(A,[]))(e)),oj=()=>e=>{let t=pS(e)(eh(A,[]));return r=>t(r)},sj=()=>e=>e,aj=(e,t)=>r=>r.add(Ol(vl(e),t)),ij=(...e)=>t=>{let r=e[e.length-1],n=e.slice(0,-1);return t.add(Ol(Zse(n),r))},cj=(...e)=>t=>{let r=e[e.length-1],n=e.slice(0,-1);return t.add(Ol(Qse(n),r))},Mv=e=>(...t)=>{let r=t[t.length-1],n=t.slice(0,-1),o=n.length===1?s=>s!=null&&s[e]===n[0]:s=>s!=null&&n.includes(s[e]);return s=>s.add(Ol(o,r))},Fv=e=>(t,r)=>{let n=o=>o!=null&&typeof o[e]==\"string\"&&o[e].startsWith(t);return o=>o.add(Ol(n,r))},lS=e=>t=>{let r=Ol(n=>n!=null&&Object.hasOwn(t,n[e]),n=>t[n[e]](n));return n=>n.add(r)},Uv=e=>t=>{let r=lS(e)(t);return n=>Lv(r(n))},uj=Mv(\"_tag\"),fj=Fv(\"_tag\"),lj=lS(\"_tag\"),pS=Uv(\"_tag\"),pj=(e,t)=>r=>r.add(Vse(vl(e),t)),dj=e=>typeof e==\"string\"&&e.length>0,mj=(...e)=>{let t=e.length;return r=>{for(let n=0;n<t;n++)if(r===e[n])return!0;return!1}},hj=()=>!0,xj=e=>e!=null,Nv=e=>t=>t instanceof e,Dv=e=>t=>{let r=th(t);return ka(r)?r._tag===\"Success\"?r.success:e(r.failure):(...n)=>{let o=r(...n);return ze(o)?o.success:e(o.failure,...n)}},gj=e=>Dv(()=>{throw new Error(\"effect/Match/orElseAbsurd: absurd\")})(e),th=e=>{if(e._tag===\"ValueMatcher\")return e.value;let t=e.cases.length;if(t===1){let r=e.cases[0];return(...n)=>{let o=e.select(...n);return r._tag===\"When\"&&r.guard(o)===!0?P(r.evaluate(o,...n)):r._tag===\"Not\"&&r.guard(o)===!1?P(r.evaluate(o,...n)):D(o)}}return(...r)=>{let n=e.select(...r);for(let o=0;o<t;o++){let s=e.cases[o];if(s._tag===\"When\"&&s.guard(n)===!0)return P(s.evaluate(n,...r));if(s._tag===\"Not\"&&s.guard(n)===!1)return P(s.evaluate(n,...r))}return D(n)}},yj=e=>{let t=th(e);return ka(t)?tr(t,{onFailure:()=>v(),onSuccess:O}):(...r)=>tr(t(...r),{onFailure:()=>v(),onSuccess:O})},Xz=\"effect/match/Match/exhaustive: absurd\",Lv=e=>{let t=th(e);if(ka(t)){if(ze(t))return t.success;throw new Error(Xz)}return(...r)=>{let n=t(...r);if(ze(n))return n.success;throw new Error(Xz)}};var Xse=ej,eae=tj,tae=rj,rae=nj,nae=oj,oae=sj,sae=aj,aae=ij,iae=cj,cae=Mv,uae=Fv,fae=lS,lae=Uv,pae=uj,dae=fj,mae=lj,hae=pS,xae=pj,gae=dj,yae=mj,bae=ir,Sae=Sa,Eae=hj,Iae=xj,Tae=Si,wae=Dl;var Cae=hS;var kae=Ul,Aae=hu,vae=yS,Oae=hr,_ae=Nv,Rae=Nv,Pae=Dv,Mae=gj,Fae=th,Uae=yj,Nae=Lv;var Dae=\"~effect/Ref\",Kme={[Dae]:{_A:A},...Et,toJSON(){return{_id:\"Ref\",ref:this.ref}}};var Vme=e=>j(()=>e.ref.current);var Zme=l(2,(e,t)=>j(()=>{e.ref.current=t(e.ref.current)}));var Yme=l(2,(e,t)=>e===void 0?void 0:t(e)),Xme=l(2,(e,{onDefined:t,onUndefined:r})=>e===void 0?r():t(e));var Sj=\"~effect/SubscriptionRef\",nhe=e=>w(e,Sj),ohe={...Et,[Sj]:{_A:A},toJSON(){return{_id:\"SubscriptionRef\",value:this.value}}};var she=e=>cv(e.pubsub);var ahe=e=>j(()=>e.value);var Bae=(e,t)=>{e.value=t,WL(e.pubsub,t)};var ihe=l(2,(e,t)=>e.semaphore.withPermit(j(()=>Bae(e,t))));export{K as a,l as b,A as c,Ne as d,mr as e,Rl as f,vr as g,Pl as h,zv as i,wn as j,hr as k,w as l,Qo as m,$j as n,bt as o,ae as p,H as q,oe as r,Me as s,ie as t,J as u,CS as v,zn as w,L as x,Ee as y,Iu as z,sO as A,jn as B,N as C,Et as D,v as E,O as F,Ru as G,fe as H,Oe as I,at as J,Yl as K,_q as L,Xl as M,Ns as N,Eh as O,lo as P,ep as Q,Wt as R,Ni as S,Uq as T,Nq as U,Li as V,Fe as W,fr as X,mo as Y,Xt as Z,Bt as _,rp as $,Mu as aa,qn as ba,Ie as ca,Fu as da,Se as ea,dt as fa,P as ga,D as ha,QO as ia,Q as ja,ze as ka,tt as la,Du as ma,oE as na,be as oa,aE as pa,Nh as qa,gr as ra,ct as sa,Dh as ta,Ot as ua,ge as va,Ds as wa,$i as xa,We as ya,Jt as za,Ph as Aa,Ye as Ba,ZS as Ca,VO as Da,vn as Ea,lp as Fa,ji as Ga,yW as Ha,Bh as Ia,rn as Ja,_a as Ka,hE as La,v_ as Ma,AW as Na,pp as Oa,Hh as Pa,Jh as Qa,WI as Ra,RG as Sa,PG as Ta,qp as Ua,MG as Va,cf as Wa,VI as Xa,UG as Ya,Hp as Za,LG as _a,ZI as $a,zG as ab,QI as bb,HG as cb,YI as db,Z as eb,GG as fb,Nr as gb,Np as hb,Fr as ib,sn as jb,Gs as kb,ht as lb,NJ as mb,Er as nb,nf as ob,Lp as pb,$p as qb,Ur as rb,an as sb,Ir as tb,De as ub,us as vb,rc as wb,Ks as xb,zp as yb,nc as zb,rG as Ab,sf as Bb,zI as Cb,nG as Db,LI as Eb,of as Fb,aG as Gb,La as Hb,ac as Ib,eF as Jb,Tce as Kb,b0 as Lb,ls as Mb,Vx as Nb,J4 as Ob,Zx as Pb,yf as Qb,bf as Rb,M0 as Sb,N0 as Tb,ps as Ub,ig as Vb,za as Wb,Mn as Xb,Ef as Yb,b as Zb,ja as _b,$ as $b,j as ac,te as bc,If as cc,hc as dc,Zr as ec,M as fc,Ct as gc,Tf as hc,wr as ic,sd as jc,T as kc,Dr as lc,Cr as mc,q as nc,Vt as oc,fg as pc,qa as qc,wf as rc,h6 as sc,x6 as tc,_t as uc,$0 as vc,B0 as wc,lg as xc,_6 as yc,M6 as zc,B6 as Ac,z0 as Bc,Ha as Cc,J6 as Dc,K6 as Ec,xc as Fc,J0 as Gc,Xs as Hc,cd as Ic,oK as Jc,ds as Kc,gc as Lc,V0 as Mc,ea as Nc,uK as Oc,Fn as Pc,mK as Qc,gK as Rc,Q0 as Sc,ms as Tc,nr as Uc,SK as Vc,AK as Wc,DK as Xc,BK as Yc,Zt as Zc,qK as _c,Lr as $c,X0 as ad,rT as bd,nT as cd,we as dd,YK as ed,tV as fd,Un as gd,fd as hd,lr as id,ut as jd,rt as kd,due as ld,xg as md,pT as nd,mue as od,kg as pd,iN as qd,Cle as rd,kle as sd,Ale as td,vle as ud,aZ as vd,iZ as wd,Ole as xd,_le as yd,cZ as zd,Rle as Ad,Ple as Bd,lN as Cd,Mle as Dd,Fle as Ed,Ug as Fd,mZ as Gd,HT as Hd,Lle as Id,$le as Jd,Ble as Kd,zle as Ld,jle as Md,qle as Nd,Hle as Od,xZ as Pd,Ed as Qd,Kle as Rd,Vle as Sd,Zle as Td,Qle as Ud,Yle as Vd,Xle as Wd,xt as Xd,Rt as Yd,gt as Zd,se as _d,Qr as $d,Uf as ae,no as be,or as ce,oa as de,Jg as ee,Fc as fe,nt as ge,ve as he,Df as ie,l5 as je,d5 as ke,Dc as le,LN as me,mC as ne,hC as oe,qc as pe,xn as qe,W5 as re,gn as se,Xe as te,ia as ue,No as ve,yn as we,He as xe,ob as ye,Vk as ze,aY as Ae,lY as Be,sb as Ce,f2 as De,pY as Ee,gY as Fe,G as Ge,ab as He,Qc as Ie,sl as Je,bn as Ke,Qt as Le,TY as Me,kY as Ne,AY as Oe,Im as Pe,Zk as Qe,X as Re,Qk as Se,OY as Te,Ue,la as Ve,NY as We,qe as Xe,yt as Ye,Es as Ze,ub as _e,I2 as $e,ee as af,WY as bf,O2 as cf,Yc as df,fb as ef,QY as ff,fi as gf,Re as hf,wm as if,_m as jf,Is as kf,q9 as lf,iA as mf,Q9 as nf,i7 as of,db as pf,f7 as qf,Jk as rf,tu as sf,DX as tf,RL as uf,PL as vf,eee as wf,Fm as xf,gb as yf,fee as zf,yb as Af,Um as Bf,Ts as Cf,Nm as Df,dl as Ef,ml as Ff,UL as Gf,hl as Hf,ws as If,Xr as Jf,zm as Kf,ha as Lf,jb as Mf,zA as Nf,ke as Of,dr as Pf,G$ as Qf,Yb as Rf,XA as Sf,As as Tf,tme as Uf,rme as Vf,Ce as Wf,R as Xf,Yt as Yf,jB as Zf,ga as _f,uu as $f,In as ag,Tl as bg,fu as cg,wl as dg,Jte as eg,hi as fg,Tn as gg,Qm as hg,kl as ig,$re as jg,tz as kg,rz as lg,Hne as mg,Vne as ng,Qne as og,Yne as pg,aoe as qg,ioe as rg,Iz as sg,Ioe as tg,wz as ug,woe as vg,Aoe as wg,yv as xg,Ooe as yg,Sv as zg,kz as Ag,Noe as Bg,cse as Cg,kme as Dg,Ame as Eg,use as Fg,vme as Gg,du as Hg,Ome as Ig,_me as Jg,Rme as Kg,Pme as Lg,Mme as Mg,Fme as Ng,Ume as Og,Nme as Pg,kv as Qg,Ise as Rg,vv as Sg,Cse as Tg,jz as Ug,$me as Vg,Mse as Wg,qse as Xg,Qz as Yg,Yz as Zg,bj as _g,Vme as $g,Zme as ah,Yme as bh,Xme as ch,nhe as dh,she as eh,ahe as fh,ihe as gh};\n","node_modules/apps/browser-IVZC54ZA.js":"import{a as ms}from\"./chunk-WOT6VMZA.js\";var hs={};ms(hs,{Alias:()=>ee,CST:()=>cs,Composer:()=>be,Document:()=>se,Lexer:()=>Be,LineCounter:()=>De,Pair:()=>v,Parser:()=>we,Scalar:()=>y,Schema:()=>ve,YAMLError:()=>_e,YAMLMap:()=>$,YAMLParseError:()=>R,YAMLSeq:()=>B,YAMLWarning:()=>Pe,isAlias:()=>F,isCollection:()=>L,isDocument:()=>x,isMap:()=>U,isNode:()=>I,isPair:()=>T,isScalar:()=>E,isSeq:()=>V,parse:()=>un,parseAllDocuments:()=>fn,parseDocument:()=>us,stringify:()=>hn,visit:()=>Q,visitAsync:()=>je});var tt=Symbol.for(\"yaml.alias\"),st=Symbol.for(\"yaml.document\"),Y=Symbol.for(\"yaml.map\"),qt=Symbol.for(\"yaml.pair\"),q=Symbol.for(\"yaml.scalar\"),re=Symbol.for(\"yaml.seq\"),K=Symbol.for(\"yaml.node.type\"),F=s=>!!s&&typeof s==\"object\"&&s[K]===tt,x=s=>!!s&&typeof s==\"object\"&&s[K]===st,U=s=>!!s&&typeof s==\"object\"&&s[K]===Y,T=s=>!!s&&typeof s==\"object\"&&s[K]===qt,E=s=>!!s&&typeof s==\"object\"&&s[K]===q,V=s=>!!s&&typeof s==\"object\"&&s[K]===re;function L(s){if(s&&typeof s==\"object\")switch(s[K]){case Y:case re:return!0}return!1}function I(s){if(s&&typeof s==\"object\")switch(s[K]){case tt:case Y:case q:case re:return!0}return!1}var nt=s=>(E(s)||L(s))&&!!s.anchor;var j=Symbol(\"break visit\"),ds=Symbol(\"skip children\"),z=Symbol(\"remove node\");function Q(s,e){let t=gs(e);x(s)?ke(null,s.contents,t,Object.freeze([s]))===z&&(s.contents=null):ke(null,s,t,Object.freeze([]))}Q.BREAK=j;Q.SKIP=ds;Q.REMOVE=z;function ke(s,e,t,n){let i=ys(s,e,t,n);if(I(i)||T(i))return bs(s,n,i),ke(s,i,t,n);if(typeof i!=\"symbol\"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=ke(r,e.items[r],t,n);if(typeof o==\"number\")r=o-1;else{if(o===j)return j;o===z&&(e.items.splice(r,1),r-=1)}}}else if(T(e)){n=Object.freeze(n.concat(e));let r=ke(\"key\",e.key,t,n);if(r===j)return j;r===z&&(e.key=null);let o=ke(\"value\",e.value,t,n);if(o===j)return j;o===z&&(e.value=null)}}return i}async function je(s,e){let t=gs(e);x(s)?await Ne(null,s.contents,t,Object.freeze([s]))===z&&(s.contents=null):await Ne(null,s,t,Object.freeze([]))}je.BREAK=j;je.SKIP=ds;je.REMOVE=z;async function Ne(s,e,t,n){let i=await ys(s,e,t,n);if(I(i)||T(i))return bs(s,n,i),Ne(s,i,t,n);if(typeof i!=\"symbol\"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=await Ne(r,e.items[r],t,n);if(typeof o==\"number\")r=o-1;else{if(o===j)return j;o===z&&(e.items.splice(r,1),r-=1)}}}else if(T(e)){n=Object.freeze(n.concat(e));let r=await Ne(\"key\",e.key,t,n);if(r===j)return j;r===z&&(e.key=null);let o=await Ne(\"value\",e.value,t,n);if(o===j)return j;o===z&&(e.value=null)}}return i}function gs(s){return typeof s==\"object\"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function ys(s,e,t,n){if(typeof t==\"function\")return t(s,e,n);if(U(e))return t.Map?.(s,e,n);if(V(e))return t.Seq?.(s,e,n);if(T(e))return t.Pair?.(s,e,n);if(E(e))return t.Scalar?.(s,e,n);if(F(e))return t.Alias?.(s,e,n)}function bs(s,e,t){let n=e[e.length-1];if(L(n))n.items[s]=t;else if(T(n))s===\"key\"?n.key=t:n.value=t;else if(x(n))n.contents=t;else{let i=F(n)?\"alias\":\"scalar\";throw new Error(`Cannot replace node with ${i} parent`)}}var pn={\"!\":\"%21\",\",\":\"%2C\",\"[\":\"%5B\",\"]\":\"%5D\",\"{\":\"%7B\",\"}\":\"%7D\"},mn=s=>s.replace(/[!,[\\]{}]/g,e=>pn[e]),Z=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case\"1.1\":this.atNextDocument=!0;break;case\"1.2\":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:\"1.2\"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:\"1.1\"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \\t]+/),i=n.shift();switch(i){case\"%TAG\":{if(n.length!==2&&(t(0,\"%TAG directive should contain exactly two parts\"),n.length<2))return!1;let[r,o]=n;return this.tags[r]=o,!0}case\"%YAML\":{if(this.yaml.explicit=!0,n.length!==1)return t(0,\"%YAML directive should contain exactly one part\"),!1;let[r]=n;if(r===\"1.1\"||r===\"1.2\")return this.yaml.version=r,!0;{let o=/^\\d+\\.\\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===\"!\")return\"!\";if(e[0]!==\"!\")return t(`Not a valid tag: ${e}`),null;if(e[1]===\"<\"){let o=e.slice(2,-1);return o===\"!\"||o===\"!!\"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==\">\"&&t(\"Verbatim tags must end with a >\"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);let r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n===\"!\"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+mn(e.substring(n.length));return e[0]===\"!\"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||\"1.2\"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&I(e.contents)){let r={};Q(e.contents,(o,l)=>{I(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of n)r===\"!!\"&&o===\"tag:yaml.org,2002:\"||(!e||i.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`\n`)}};Z.defaultYaml={explicit:!1,version:\"1.2\"};Z.defaultTags={\"!!\":\"tag:yaml.org,2002:\"};function it(s){if(/[\\x00-\\x19\\s,[\\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Rt(s){let e=new Set;return Q(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function Ft(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function ws(s,e){let t=[],n=new Map,i=null;return{onAnchor:r=>{t.push(r),i??(i=Rt(s));let o=Ft(e,i);return i.add(o),o},setAnchors:()=>{for(let r of t){let o=n.get(r);if(typeof o==\"object\"&&o.anchor&&(E(o.node)||L(o.node)))o.node.anchor=o.anchor;else{let l=new Error(\"Failed to resolve repeated object (this should not happen)\");throw l.source=r,l}}},sourceObjects:n}}function fe(s,e,t,n){if(n&&typeof n==\"object\")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){let o=n[i],l=fe(s,n,String(i),o);l===void 0?delete n[i]:l!==o&&(n[i]=l)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let r=n.get(i),o=fe(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let r=fe(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(let[i,r]of Object.entries(n)){let o=fe(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}function M(s,e,t){if(Array.isArray(s))return s.map((n,i)=>M(n,String(i),t));if(s&&typeof s.toJSON==\"function\"){if(!t||!nt(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s==\"bigint\"&&!t?.keep?Number(s):s}var ue=class{constructor(e){Object.defineProperty(this,K,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!x(e))throw new TypeError(\"A document argument is required\");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==\"number\"?n:100},l=M(this,\"\",o);if(typeof i==\"function\")for(let{count:a,res:c}of o.anchors.values())i(c,a);return typeof r==\"function\"?fe(r,{\"\":l},\"\",l):l}};var ee=class extends ue{constructor(e){super(tt),this.source=e,Object.defineProperty(this,\"tag\",{set(){throw new Error(\"Alias nodes cannot have tags\")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError(\"Alias resolution is disabled\");let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Q(e,{Node:(r,o)=>{(F(o)||nt(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(let r of n){if(r===this)break;r.anchor===this.source&&(i=r)}if(i&&t){let{anchors:r,doc:o,maxAliasCount:l}=t,a=r.get(i);if(a||(M(i,null,t),a=r.get(i)),a?.res===void 0){let c=\"This should not happen: Alias anchor was not resolved?\";throw new ReferenceError(c)}if(l>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=rt(o,i,r)),a.count*a.aliasCount>l)){let c=\"Excessive alias count indicates a resource exhaustion attack\";throw new ReferenceError(c)}}return i}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return t.anchors.get(n).res}toString(e,t,n){let i=`*${this.source}`;if(e){if(it(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function rt(s,e,t){if(F(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(L(e)){let n=0;for(let i of e.items){let r=rt(s,i,t);r>n&&(n=r)}return n}else if(T(e)){let n=rt(s,e.key,t),i=rt(s,e.value,t);return Math.max(n,i)}return 1}var ot=s=>!s||typeof s!=\"function\"&&typeof s!=\"object\",y=class extends ue{constructor(e){super(q),this.value=e}toJSON(e,t){return t?.keep?this.value:M(this.value,e,t)}toString(){return String(this.value)}};y.BLOCK_FOLDED=\"BLOCK_FOLDED\";y.BLOCK_LITERAL=\"BLOCK_LITERAL\";y.PLAIN=\"PLAIN\";y.QUOTE_DOUBLE=\"QUOTE_DOUBLE\";y.QUOTE_SINGLE=\"QUOTE_SINGLE\";var dn=\"tag:yaml.org,2002:\";function gn(s,e,t){if(e){let n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function oe(s,e,t){if(x(s)&&(s=s.contents),I(s))return s;if(T(s)){let f=t.schema[Y].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<\"u\"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=t,a;if(n&&s&&typeof s==\"object\"){if(a=l.get(s),a)return a.anchor??(a.anchor=i(s)),new ee(a.anchor);a={anchor:null,node:null},l.set(s,a)}e?.startsWith(\"!!\")&&(e=dn+e.slice(2));let c=gn(s,e,o.tags);if(!c){if(s&&typeof s.toJSON==\"function\"&&(s=s.toJSON()),!s||typeof s!=\"object\"){let f=new y(s);return a&&(a.node=f),f}c=s instanceof Map?o[Y]:Symbol.iterator in Object(s)?o[re]:o[Y]}r&&(r(c),delete t.onTagObj);let p=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from==\"function\"?c.nodeClass.from(t.schema,s,t):new y(s);return e?p.tag=e:c.default||(p.tag=c.tag),a&&(a.node=p),p}function qe(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r==\"number\"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return oe(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error(\"This should not happen, please report a bug.\")},schema:s,sourceObjects:new Map})}var Ae=s=>s==null||typeof s==\"object\"&&!!s[Symbol.iterator]().next().done,Oe=class extends ue{constructor(e,t){super(e),Object.defineProperty(this,\"schema\",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>I(n)||T(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Ae(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(L(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,qe(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!0);if(L(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&E(r)?r.value:r:L(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!T(t))return!1;let n=t.value;return n==null||e&&E(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let i=this.get(t,!0);return L(i)?i.hasIn(n):!1}setIn(e,t){let[n,...i]=e;if(i.length===0)this.set(n,t);else{let r=this.get(n,!0);if(L(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,qe(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};var Ss=s=>s.replace(/^(?!$)(?: $)?/gm,\"#\");function J(s,e){return/^\\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var te=(s,e,t)=>s.endsWith(`\n`)?J(t,e):t.includes(`\n`)?`\n`+J(t,e):(s.endsWith(\" \")?\"\":\" \")+t;var xt=\"flow\",lt=\"block\",Re=\"quoted\";function Fe(s,e,t=\"flow\",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return s;i<r&&(r=0);let a=Math.max(1+r,1+i-e.length);if(s.length<=a)return s;let c=[],p={},f=i-e.length;typeof n==\"number\"&&(n>i-Math.max(2,r)?c.push(0):f=i-n);let u,d,g=!1,h=-1,m=-1,w=-1;t===lt&&(h=ks(s,h,e.length),h!==-1&&(f=h+a));for(let k;k=s[h+=1];){if(t===Re&&k===\"\\\\\"){switch(m=h,s[h+1]){case\"x\":h+=3;break;case\"u\":h+=5;break;case\"U\":h+=9;break;default:h+=1}w=h}if(k===`\n`)t===lt&&(h=ks(s,h,e.length)),f=h+e.length+a,u=void 0;else{if(k===\" \"&&d&&d!==\" \"&&d!==`\n`&&d!==\"\t\"){let N=s[h+1];N&&N!==\" \"&&N!==`\n`&&N!==\"\t\"&&(u=h)}if(h>=f)if(u)c.push(u),f=u+a,u=void 0;else if(t===Re){for(;d===\" \"||d===\"\t\";)d=k,k=s[h+=1],g=!0;let N=h>w+1?h-2:m-1;if(p[N])return s;c.push(N),p[N]=!0,f=N+a,u=void 0}else g=!0}d=k}if(g&&l&&l(),c.length===0)return s;o&&o();let S=s.slice(0,c[0]);for(let k=0;k<c.length;++k){let N=c[k],O=c[k+1]||s.length;N===0?S=`\n${e}${s.slice(0,O)}`:(t===Re&&p[N]&&(S+=`${s[N]}\\\\`),S+=`\n${e}${s.slice(N+1,O)}`)}return S}function ks(s,e,t){let n=e,i=e+1,r=s[i];for(;r===\" \"||r===\"\t\";)if(e<i+t)r=s[++e];else{do r=s[++e];while(r&&r!==`\n`);n=e,i=e+1,r=s[i]}return n}var ct=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),ft=s=>/^(%|---|\\.\\.\\.)/m.test(s);function yn(s,e,t){if(!e||e<0)return!1;let n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;r<i;++r)if(s[r]===`\n`){if(r-o>n)return!0;if(o=r+1,i-o<=n)return!1}return!0}function xe(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(ft(s)?\"  \":\"\"),o=\"\",l=0;for(let a=0,c=t[a];c;c=t[++a])if(c===\" \"&&t[a+1]===\"\\\\\"&&t[a+2]===\"n\"&&(o+=t.slice(l,a)+\"\\\\ \",a+=1,l=a,c=\"\\\\\"),c===\"\\\\\")switch(t[a+1]){case\"u\":{o+=t.slice(l,a);let p=t.substr(a+2,4);switch(p){case\"0000\":o+=\"\\\\0\";break;case\"0007\":o+=\"\\\\a\";break;case\"000b\":o+=\"\\\\v\";break;case\"001b\":o+=\"\\\\e\";break;case\"0085\":o+=\"\\\\N\";break;case\"00a0\":o+=\"\\\\_\";break;case\"2028\":o+=\"\\\\L\";break;case\"2029\":o+=\"\\\\P\";break;default:p.substr(0,2)===\"00\"?o+=\"\\\\x\"+p.substr(2):o+=t.substr(a,6)}a+=5,l=a+1}break;case\"n\":if(n||t[a+2]==='\"'||t.length<i)a+=1;else{for(o+=t.slice(l,a)+`\n\n`;t[a+2]===\"\\\\\"&&t[a+3]===\"n\"&&t[a+4]!=='\"';)o+=`\n`,a+=2;o+=r,t[a+2]===\" \"&&(o+=\"\\\\\"),a+=1,l=a+1}break;default:a+=1}return o=l?o+t.slice(l):t,n?o:Fe(o,r,Re,ct(e,!1))}function Ut(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`\n`)||/[ \\t]\\n|\\n[ \\t]/.test(s))return xe(s,e);let t=e.indent||(ft(s)?\"  \":\"\"),n=\"'\"+s.replace(/'/g,\"''\").replace(/\\n+/g,`$&\n${t}`)+\"'\";return e.implicitKey?n:Fe(n,t,xt,ct(e,!1))}function Ee(s,e){let{singleQuote:t}=e.options,n;if(t===!1)n=xe;else{let i=s.includes('\"'),r=s.includes(\"'\");i&&!r?n=Ut:r&&!i?n=xe:n=t?Ut:xe}return n(s,e)}var Vt;try{Vt=new RegExp(`(^|(?<!\n))\n+(?!\n|$)`,\"g\")}catch{Vt=/\\n+(?!\\n|$)/g}function at({comment:s,type:e,value:t},n,i,r){let{blockQuote:o,commentString:l,lineWidth:a}=n.options;if(!o||/\\n[\\t ]+$/.test(t))return Ee(t,n);let c=n.indent||(n.forceBlockIndent||ft(t)?\"  \":\"\"),p=o===\"literal\"?!0:o===\"folded\"||e===y.BLOCK_FOLDED?!1:e===y.BLOCK_LITERAL?!0:!yn(t,a,c.length);if(!t)return p?`|\n`:`>\n`;let f,u;for(u=t.length;u>0;--u){let O=t[u-1];if(O!==`\n`&&O!==\"\t\"&&O!==\" \")break}let d=t.substring(u),g=d.indexOf(`\n`);g===-1?f=\"-\":t===d||g!==d.length-1?(f=\"+\",r&&r()):f=\"\",d&&(t=t.slice(0,-d.length),d[d.length-1]===`\n`&&(d=d.slice(0,-1)),d=d.replace(Vt,`$&${c}`));let h=!1,m,w=-1;for(m=0;m<t.length;++m){let O=t[m];if(O===\" \")h=!0;else if(O===`\n`)w=m;else break}let S=t.substring(0,w<m?w+1:m);S&&(t=t.substring(S.length),S=S.replace(/\\n+/g,`$&${c}`));let N=(h?c?\"2\":\"1\":\"\")+f;if(s&&(N+=\" \"+l(s.replace(/ ?[\\r\\n]+/g,\" \")),i&&i()),!p){let O=t.replace(/\\n+/g,`\n$&`).replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g,\"$1$2\").replace(/\\n+/g,`$&${c}`),A=!1,C=ct(n,!0);o!==\"folded\"&&e!==y.BLOCK_FOLDED&&(C.onOverflow=()=>{A=!0});let b=Fe(`${S}${O}${d}`,c,lt,C);if(!A)return`>${N}\n${c}${b}`}return t=t.replace(/\\n+/g,`$&${c}`),`|${N}\n${c}${S}${t}${d}`}function bn(s,e,t,n){let{type:i,value:r}=s,{actualString:o,implicitKey:l,indent:a,indentStep:c,inFlow:p}=e;if(l&&r.includes(`\n`)||p&&/[[\\]{},]/.test(r))return Ee(r,e);if(/^[\\n\\t ,[\\]{}#&*!|>'\"%@`]|^[?-]$|^[?-][ \\t]|[\\n:][ \\t]|[ \\t]\\n|[\\n\\t ]#|[\\n\\t :]$/.test(r))return l||p||!r.includes(`\n`)?Ee(r,e):at(s,e,t,n);if(!l&&!p&&i!==y.PLAIN&&r.includes(`\n`))return at(s,e,t,n);if(ft(r)){if(a===\"\")return e.forceBlockIndent=!0,at(s,e,t,n);if(l&&a===c)return Ee(r,e)}let f=r.replace(/\\n+/g,`$&\n${a}`);if(o){let u=h=>h.default&&h.tag!==\"tag:yaml.org,2002:str\"&&h.test?.test(f),{compat:d,tags:g}=e.doc.schema;if(g.some(u)||d?.some(u))return Ee(r,e)}return l?f:Fe(f,a,xt,ct(e,!1))}function le(s,e,t,n){let{implicitKey:i,inFlow:r}=e,o=typeof s.value==\"string\"?s:Object.assign({},s,{value:String(s.value)}),{type:l}=s;l!==y.QUOTE_DOUBLE&&/[\\x00-\\x08\\x0b-\\x1f\\x7f-\\x9f\\u{D800}-\\u{DFFF}]/u.test(o.value)&&(l=y.QUOTE_DOUBLE);let a=p=>{switch(p){case y.BLOCK_FOLDED:case y.BLOCK_LITERAL:return i||r?Ee(o.value,e):at(o,e,t,n);case y.QUOTE_DOUBLE:return xe(o.value,e);case y.QUOTE_SINGLE:return Ut(o.value,e);case y.PLAIN:return bn(o,e,t,n);default:return null}},c=a(l);if(c===null){let{defaultKeyType:p,defaultStringType:f}=e.options,u=i&&p||f;if(c=a(u),c===null)throw new Error(`Unsupported default string type ${u}`)}return c}function ut(s,e){let t=Object.assign({blockQuote:!0,commentString:Ss,defaultKeyType:null,defaultStringType:\"PLAIN\",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:\"false\",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:\"null\",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:\"true\",verifyAliasOrder:!0},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case\"block\":n=!1;break;case\"flow\":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?\" \":\"\",indent:\"\",indentStep:typeof t.indent==\"number\"?\" \".repeat(t.indent):\"  \",inFlow:n,options:t}}function wn(s,e){if(e.tag){let i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,n;if(E(e)){n=e.value;let i=s.filter(r=>r.identify?.(n));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){let i=n?.constructor?.name??(n===null?\"null\":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return t}function Sn(s,e,{anchors:t,doc:n}){if(!n.directives)return\"\";let i=[],r=(E(s)||L(s))&&s.anchor;r&&it(r)&&(t.add(r),i.push(`&${r}`));let o=s.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(\" \")}function ae(s,e,t,n){if(T(s))return s.toString(e,t,n);if(F(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError(\"Cannot stringify circular structure without alias nodes\");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i,r=I(s)?s:e.doc.createNode(s,{onTagObj:a=>i=a});i??(i=wn(e.doc.schema.tags,r));let o=Sn(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let l=typeof i.stringify==\"function\"?i.stringify(r,e,t,n):E(r)?le(r,e,t,n):r.toString(e,t,n);return o?E(r)||l[0]===\"{\"||l[0]===\"[\"?`${o} ${l}`:`${o}\n${e.indent}${l}`:l}function Ns({key:s,value:e},t,n,i){let{allNullValues:r,doc:o,indent:l,indentStep:a,options:{commentString:c,indentSeq:p,simpleKeys:f}}=t,u=I(s)&&s.comment||null;if(f){if(u)throw new Error(\"With simple keys, key nodes cannot have comments\");if(L(s)||!I(s)&&typeof s==\"object\"){let C=\"With simple keys, collection cannot be used as a key value\";throw new Error(C)}}let d=!f&&(!s||u&&e==null&&!t.inFlow||L(s)||(E(s)?s.type===y.BLOCK_FOLDED||s.type===y.BLOCK_LITERAL:typeof s==\"object\"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!d&&(f||!r),indent:l+a});let g=!1,h=!1,m=ae(s,t,()=>g=!0,()=>h=!0);if(!d&&!t.inFlow&&m.length>1024){if(f)throw new Error(\"With simple keys, single line scalar must not span more than 1024 characters\");d=!0}if(t.inFlow){if(r||e==null)return g&&n&&n(),m===\"\"?\"?\":d?`? ${m}`:m}else if(r&&!f||e==null&&d)return m=`? ${m}`,u&&!g?m+=te(m,t.indent,c(u)):h&&i&&i(),m;g&&(u=null),d?(u&&(m+=te(m,t.indent,c(u))),m=`? ${m}\n${l}:`):(m=`${m}:`,u&&(m+=te(m,t.indent,c(u))));let w,S,k;I(e)?(w=!!e.spaceBefore,S=e.commentBefore,k=e.comment):(w=!1,S=null,k=null,e&&typeof e==\"object\"&&(e=o.createNode(e))),t.implicitKey=!1,!d&&!u&&E(e)&&(t.indentAtStart=m.length+1),h=!1,!p&&a.length>=2&&!t.inFlow&&!d&&V(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let N=!1,O=ae(e,t,()=>N=!0,()=>h=!0),A=\" \";if(u||w||S){if(A=w?`\n`:\"\",S){let C=c(S);A+=`\n${J(C,t.indent)}`}O===\"\"&&!t.inFlow?A===`\n`&&k&&(A=`\n\n`):A+=`\n${t.indent}`}else if(!d&&L(e)){let C=O[0],b=O.indexOf(`\n`),_=b!==-1,ce=t.inFlow??e.flow??e.items.length===0;if(_||!ce){let Se=!1;if(_&&(C===\"&\"||C===\"!\")){let P=O.indexOf(\" \");C===\"&\"&&P!==-1&&P<b&&O[P+1]===\"!\"&&(P=O.indexOf(\" \",P+1)),(P===-1||b<P)&&(Se=!0)}Se||(A=`\n${t.indent}`)}}else(O===\"\"||O[0]===`\n`)&&(A=\"\");return m+=A+O,t.inFlow?N&&n&&n():k&&!N?m+=te(m,t.indent,c(k)):h&&i&&i(),m}function ht(s,e){(s===\"debug\"||s===\"warn\")&&console.warn(e)}var pt=\"<<\",G={identify:s=>s===pt||typeof s==\"symbol\"&&s.description===pt,default:\"key\",tag:\"tag:yaml.org,2002:merge\",test:/^<<$/,resolve:()=>Object.assign(new y(Symbol(pt)),{addToJSMap:Yt}),stringify:()=>pt},Os=(s,e)=>(G.identify(e)||E(e)&&(!e.type||e.type===y.PLAIN)&&G.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===G.tag&&t.default);function Yt(s,e,t){let n=As(s,t);if(V(n))for(let i of n.items)Jt(s,e,i);else if(Array.isArray(n))for(let i of n)Jt(s,e,i);else Jt(s,e,n)}function Jt(s,e,t){let n=As(s,t);if(!U(n))throw new Error(\"Merge sources must be maps or map aliases\");let i=n.toJSON(null,s,Map);for(let[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function As(s,e){return s&&F(e)?e.resolve(s.doc,s):e}function mt(s,e,{key:t,value:n}){if(I(t)&&t.addToJSMap)t.addToJSMap(s,e,n);else if(Os(s,t))Yt(s,e,n);else{let i=M(t,\"\",s);if(e instanceof Map)e.set(i,M(n,i,s));else if(e instanceof Set)e.add(i);else{let r=kn(t,i,s),o=M(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function kn(s,e,t){if(e===null)return\"\";if(typeof e!=\"object\")return String(e);if(I(s)&&t?.doc){let n=ut(t.doc,{});n.anchors=new Set;for(let r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'...\"'),ht(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Te(s,e,t){let n=oe(s,void 0,t),i=oe(e,void 0,t);return new v(n,i)}var v=class s{constructor(e,t=null){Object.defineProperty(this,K,{value:qt}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return I(t)&&(t=t.clone(e)),I(n)&&(n=n.clone(e)),new s(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return mt(t,n,this)}toString(e,t,n){return e?.doc?Ns(this,e,t,n):JSON.stringify(this)}};function gt(s,e,t){return(e.inFlow??s.flow?On:Nn)(s,e,t)}function Nn({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:l}){let{indent:a,options:{commentString:c}}=t,p=Object.assign({},t,{indent:r,type:null}),f=!1,u=[];for(let g=0;g<e.length;++g){let h=e[g],m=null;if(I(h))!f&&h.spaceBefore&&u.push(\"\"),dt(t,u,h.commentBefore,f),h.comment&&(m=h.comment);else if(T(h)){let S=I(h.key)?h.key:null;S&&(!f&&S.spaceBefore&&u.push(\"\"),dt(t,u,S.commentBefore,f))}f=!1;let w=ae(h,p,()=>m=null,()=>f=!0);m&&(w+=te(w,r,c(m))),f&&m&&(f=!1),u.push(n+w)}let d;if(u.length===0)d=i.start+i.end;else{d=u[0];for(let g=1;g<u.length;++g){let h=u[g];d+=h?`\n${a}${h}`:`\n`}}return s?(d+=`\n`+J(c(s),a),l&&l()):f&&o&&o(),d}function On({items:s},e,{flowChars:t,itemIndent:n}){let{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:l}}=e;n+=r;let a=Object.assign({},e,{indent:n,inFlow:!0,type:null}),c=!1,p=0,f=[];for(let g=0;g<s.length;++g){let h=s[g],m=null;if(I(h))h.spaceBefore&&f.push(\"\"),dt(e,f,h.commentBefore,!1),h.comment&&(m=h.comment);else if(T(h)){let S=I(h.key)?h.key:null;S&&(S.spaceBefore&&f.push(\"\"),dt(e,f,S.commentBefore,!1),S.comment&&(c=!0));let k=I(h.value)?h.value:null;k?(k.comment&&(m=k.comment),k.commentBefore&&(c=!0)):h.value==null&&S?.comment&&(m=S.comment)}m&&(c=!0);let w=ae(h,a,()=>m=null);c||(c=f.length>p||w.includes(`\n`)),g<s.length-1?w+=\",\":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=f.reduce((S,k)=>S+k.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=\",\")),m&&(w+=te(w,n,l(m))),f.push(w),p=f.length}let{start:u,end:d}=t;if(f.length===0)return u+d;if(!c){let g=f.reduce((h,m)=>h+m.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=u;for(let h of f)g+=h?`\n${r}${i}${h}`:`\n`;return`${g}\n${i}${d}`}else return`${u}${o}${f.join(\" \")}${o}${d}`}function dt({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\\n+/,\"\")),n){let r=J(e(n),s);t.push(r.trimStart())}}function he(s,e){let t=E(e)?e.value:e;for(let n of s)if(T(n)&&(n.key===e||n.key===t||E(n.key)&&n.key.value===t))return n}var $=class extends Oe{static get tagName(){return\"tag:yaml.org,2002:map\"}constructor(e){super(Y,e),this.items=[]}static from(e,t,n){let{keepUndefined:i,replacer:r}=n,o=new this(e),l=(a,c)=>{if(typeof r==\"function\")c=r.call(t,a,c);else if(Array.isArray(r)&&!r.includes(a))return;(c!==void 0||i)&&o.items.push(Te(a,c,n))};if(t instanceof Map)for(let[a,c]of t)l(a,c);else if(t&&typeof t==\"object\")for(let a of Object.keys(t))l(a,t[a]);return typeof e.sortMapEntries==\"function\"&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;T(e)?n=e:!e||typeof e!=\"object\"||!(\"key\"in e)?n=new v(e,e?.value):n=new v(e.key,e.value);let i=he(this.items,n.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);E(i.value)&&ot(n.value)?i.value.value=n.value:i.value=n.value}else if(r){let o=this.items.findIndex(l=>r(n,l)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=he(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let i=he(this.items,e)?.value;return(!t&&E(i)?i.value:i)??void 0}has(e){return!!he(this.items,e)}set(e,t){this.add(new v(e,t),!0)}toJSON(e,t,n){let i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(let r of this.items)mt(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!T(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),gt(this,e,{blockItemPrefix:\"\",flowChars:{start:\"{\",end:\"}\"},itemIndent:e.indent||\"\",onChompKeep:n,onComment:t})}};var W={collection:\"map\",default:!0,nodeClass:$,tag:\"tag:yaml.org,2002:map\",resolve(s,e){return U(s)||e(\"Expected a mapping for this tag\"),s},createNode:(s,e,t)=>$.from(s,e,t)};var B=class extends Oe{static get tagName(){return\"tag:yaml.org,2002:seq\"}constructor(e){super(re,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=yt(e);return typeof t!=\"number\"?!1:this.items.splice(t,1).length>0}get(e,t){let n=yt(e);if(typeof n!=\"number\")return;let i=this.items[n];return!t&&E(i)?i.value:i}has(e){let t=yt(e);return typeof t==\"number\"&&t<this.items.length}set(e,t){let n=yt(e);if(typeof n!=\"number\")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];E(i)&&ot(t)?i.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let i=0;for(let r of this.items)n.push(M(r,String(i++),t));return n}toString(e,t,n){return e?gt(this,e,{blockItemPrefix:\"- \",flowChars:{start:\"[\",end:\"]\"},itemIndent:(e.indent||\"\")+\"  \",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let l of t){if(typeof i==\"function\"){let a=t instanceof Set?l:String(o++);l=i.call(t,a,l)}r.items.push(oe(l,void 0,n))}}return r}};function yt(s){let e=E(s)?s.value:s;return e&&typeof e==\"string\"&&(e=Number(e)),typeof e==\"number\"&&Number.isInteger(e)&&e>=0?e:null}var H={collection:\"seq\",default:!0,nodeClass:B,tag:\"tag:yaml.org,2002:seq\",resolve(s,e){return V(s)||e(\"Expected a sequence for this tag\"),s},createNode:(s,e,t)=>B.from(s,e,t)};var pe={identify:s=>typeof s==\"string\",default:!0,tag:\"tag:yaml.org,2002:str\",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),le(s,e,t,n)}};var ye={identify:s=>s==null,createNode:()=>new y(null),default:!0,tag:\"tag:yaml.org,2002:null\",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new y(null),stringify:({source:s},e)=>typeof s==\"string\"&&ye.test.test(s)?s:e.options.nullStr};var Ue={identify:s=>typeof s==\"boolean\",default:!0,tag:\"tag:yaml.org,2002:bool\",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new y(s[0]===\"t\"||s[0]===\"T\"),stringify({source:s,value:e},t){if(s&&Ue.test.test(s)){let n=s[0]===\"t\"||s[0]===\"T\";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function D({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n==\"bigint\")return String(n);let i=typeof n==\"number\"?n:Number(n);if(!isFinite(i))return isNaN(i)?\".nan\":i<0?\"-.inf\":\".inf\";let r=Object.is(n,-0)?\"-0\":JSON.stringify(n);if(!s&&e&&(!t||t===\"tag:yaml.org,2002:float\")&&/^-?\\d/.test(r)&&!r.includes(\"e\")){let o=r.indexOf(\".\");o<0&&(o=r.length,r+=\".\");let l=e-(r.length-o-1);for(;l-- >0;)r+=\"0\"}return r}var bt={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",test:/^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()===\"nan\"?NaN:s[0]===\"-\"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},wt={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",format:\"EXP\",test:/^[-+]?(?:\\.[0-9]+|[0-9]+(?:\\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},St={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",test:/^[-+]?(?:\\.[0-9]+|[0-9]+\\.[0-9]*)$/,resolve(s){let e=new y(parseFloat(s)),t=s.indexOf(\".\");return t!==-1&&s[s.length-1]===\"0\"&&(e.minFractionDigits=s.length-t-1),e},stringify:D};var kt=s=>typeof s==\"bigint\"||Number.isInteger(s),Qt=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Es(s,e,t){let{value:n}=s;return kt(n)&&n>=0?t+n.toString(e):D(s)}var Nt={identify:s=>kt(s)&&s>=0,default:!0,tag:\"tag:yaml.org,2002:int\",format:\"OCT\",test:/^0o[0-7]+$/,resolve:(s,e,t)=>Qt(s,2,8,t),stringify:s=>Es(s,8,\"0o\")},Ot={identify:kt,default:!0,tag:\"tag:yaml.org,2002:int\",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>Qt(s,0,10,t),stringify:D},At={identify:s=>kt(s)&&s>=0,default:!0,tag:\"tag:yaml.org,2002:int\",format:\"HEX\",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>Qt(s,2,16,t),stringify:s=>Es(s,16,\"0x\")};var Ts=[W,H,pe,ye,Ue,Nt,Ot,At,bt,wt,St];function Is(s){return typeof s==\"bigint\"||Number.isInteger(s)}var Et=({value:s})=>JSON.stringify(s),An=[{identify:s=>typeof s==\"string\",default:!0,tag:\"tag:yaml.org,2002:str\",resolve:s=>s,stringify:Et},{identify:s=>s==null,createNode:()=>new y(null),default:!0,tag:\"tag:yaml.org,2002:null\",test:/^null$/,resolve:()=>null,stringify:Et},{identify:s=>typeof s==\"boolean\",default:!0,tag:\"tag:yaml.org,2002:bool\",test:/^true$|^false$/,resolve:s=>s===\"true\",stringify:Et},{identify:Is,default:!0,tag:\"tag:yaml.org,2002:int\",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>Is(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",test:/^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Et}],En={default:!0,tag:\"\",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Ls=[W,H].concat(An,En);var Ve={identify:s=>s instanceof Uint8Array,default:!1,tag:\"tag:yaml.org,2002:binary\",resolve(s,e){if(typeof atob==\"function\"){let t=atob(s.replace(/[\\n\\r]/g,\"\")),n=new Uint8Array(t.length);for(let i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}else return e(\"This environment does not support reading binary tags; either Buffer or atob is required\"),s},stringify({comment:s,type:e,value:t},n,i,r){if(!t)return\"\";let o=t,l;if(typeof btoa==\"function\"){let a=\"\";for(let c=0;c<o.length;++c)a+=String.fromCharCode(o[c]);l=btoa(a)}else throw new Error(\"This environment does not support writing binary tags; either Buffer or btoa is required\");if(e??(e=y.BLOCK_LITERAL),e!==y.QUOTE_DOUBLE){let a=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),c=Math.ceil(l.length/a),p=new Array(c);for(let f=0,u=0;f<c;++f,u+=a)p[f]=l.substr(u,a);l=p.join(e===y.BLOCK_LITERAL?`\n`:\" \")}return le({comment:s,type:e,value:l},n,i,r)}};function Gt(s,e){if(V(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!T(n)){if(U(n)){n.items.length>1&&e(\"Each pair must have its own sequence indicator\");let i=n.items[0]||new v(new y(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}\n${i.key.commentBefore}`:n.commentBefore),n.comment){let r=i.value??i.key;r.comment=r.comment?`${n.comment}\n${r.comment}`:n.comment}n=i}s.items[t]=T(n)?n:new v(n)}}else e(\"Expected a sequence for this tag\");return s}function Wt(s,e,t){let{replacer:n}=t,i=new B(s);i.tag=\"tag:yaml.org,2002:pairs\";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n==\"function\"&&(o=n.call(e,String(r++),o));let l,a;if(Array.isArray(o))if(o.length===2)l=o[0],a=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)l=c[0],a=o[l];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else l=o;i.items.push(Te(l,a,t))}return i}var Je={collection:\"seq\",default:!1,tag:\"tag:yaml.org,2002:pairs\",resolve:Gt,createNode:Wt};var Ie=class s extends B{constructor(){super(),this.add=$.prototype.add.bind(this),this.delete=$.prototype.delete.bind(this),this.get=$.prototype.get.bind(this),this.has=$.prototype.has.bind(this),this.set=$.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let i of this.items){let r,o;if(T(i)?(r=M(i.key,\"\",t),o=M(i.value,r,t)):r=M(i,\"\",t),n.has(r))throw new Error(\"Ordered maps must not include duplicate keys\");n.set(r,o)}return n}static from(e,t,n){let i=Wt(e,t,n),r=new this;return r.items=i.items,r}};Ie.tag=\"tag:yaml.org,2002:omap\";var Ye={collection:\"seq\",identify:s=>s instanceof Map,nodeClass:Ie,default:!1,tag:\"tag:yaml.org,2002:omap\",resolve(s,e){let t=Gt(s,e),n=[];for(let{key:i}of t.items)E(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ie,t)},createNode:(s,e,t)=>Ie.from(s,e,t)};function Cs({value:s,source:e},t){return e&&(s?Ht:Xt).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var Ht={identify:s=>s===!0,default:!0,tag:\"tag:yaml.org,2002:bool\",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new y(!0),stringify:Cs},Xt={identify:s=>s===!1,default:!0,tag:\"tag:yaml.org,2002:bool\",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new y(!1),stringify:Cs};var vs={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",test:/^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()===\"nan\"?NaN:s[0]===\"-\"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},$s={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",format:\"EXP\",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,\"\")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},_s={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",test:/^[-+]?(?:[0-9][0-9_]*)?\\.[0-9_]*$/,resolve(s){let e=new y(parseFloat(s.replace(/_/g,\"\"))),t=s.indexOf(\".\");if(t!==-1){let n=s.substring(t+1).replace(/_/g,\"\");n[n.length-1]===\"0\"&&(e.minFractionDigits=n.length)}return e},stringify:D};var Qe=s=>typeof s==\"bigint\"||Number.isInteger(s);function Tt(s,e,t,{intAsBigInt:n}){let i=s[0];if((i===\"-\"||i===\"+\")&&(e+=1),s=s.substring(e).replace(/_/g,\"\"),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return i===\"-\"?BigInt(-1)*o:o}let r=parseInt(s,t);return i===\"-\"?-1*r:r}function zt(s,e,t){let{value:n}=s;if(Qe(n)){let i=n.toString(e);return n<0?\"-\"+t+i.substr(1):t+i}return D(s)}var Ps={identify:Qe,default:!0,tag:\"tag:yaml.org,2002:int\",format:\"BIN\",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Tt(s,2,2,t),stringify:s=>zt(s,2,\"0b\")},Ms={identify:Qe,default:!0,tag:\"tag:yaml.org,2002:int\",format:\"OCT\",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Tt(s,1,8,t),stringify:s=>zt(s,8,\"0\")},Bs={identify:Qe,default:!0,tag:\"tag:yaml.org,2002:int\",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Tt(s,0,10,t),stringify:D},Ds={identify:Qe,default:!0,tag:\"tag:yaml.org,2002:int\",format:\"HEX\",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Tt(s,2,16,t),stringify:s=>zt(s,16,\"0x\")};var Le=class s extends ${constructor(e){super(e),this.tag=s.tag}add(e){let t;T(e)?t=e:e&&typeof e==\"object\"&&\"key\"in e&&\"value\"in e&&e.value===null?t=new v(e.key,null):t=new v(e,null),he(this.items,t.key)||this.items.push(t)}get(e,t){let n=he(this.items,e);return!t&&T(n)?E(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=\"boolean\")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=he(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new v(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error(\"Set items must all have null values\")}static from(e,t,n){let{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof i==\"function\"&&(o=i.call(t,o,o)),r.items.push(Te(o,null,n));return r}};Le.tag=\"tag:yaml.org,2002:set\";var Ge={collection:\"map\",identify:s=>s instanceof Set,nodeClass:Le,default:!1,tag:\"tag:yaml.org,2002:set\",createNode:(s,e,t)=>Le.from(s,e,t),resolve(s,e){if(U(s)){if(s.hasAllNullValues(!0))return Object.assign(new Le,s);e(\"Set items must all have null values\")}else e(\"Expected a mapping for this tag\");return s}};function Zt(s,e){let t=s[0],n=t===\"-\"||t===\"+\"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,\"\").split(\":\").reduce((o,l)=>o*i(60)+i(l),i(0));return t===\"-\"?i(-1)*r:r}function Ks(s){let{value:e}=s,t=o=>o;if(typeof e==\"bigint\")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return D(s);let n=\"\";e<0&&(n=\"-\",e*=t(-1));let i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>String(o).padStart(2,\"0\")).join(\":\").replace(/000000\\d*$/,\"\")}var It={identify:s=>typeof s==\"bigint\"||Number.isInteger(s),default:!0,tag:\"tag:yaml.org,2002:int\",format:\"TIME\",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>Zt(s,t),stringify:Ks},Lt={identify:s=>typeof s==\"number\",default:!0,tag:\"tag:yaml.org,2002:float\",format:\"TIME\",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*$/,resolve:s=>Zt(s,!1),stringify:Ks},Ce={identify:s=>s instanceof Date,default:!0,tag:\"tag:yaml.org,2002:timestamp\",test:RegExp(\"^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\\\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\\\.[0-9]+)?)(?:[ \\\\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$\"),resolve(s){let e=s.match(Ce.test);if(!e)throw new Error(\"!!timestamp expects a date, starting with yyyy-mm-dd\");let[,t,n,i,r,o,l]=e.map(Number),a=e[7]?Number((e[7]+\"00\").substr(1,3)):0,c=Date.UTC(t,n-1,i,r||0,o||0,l||0,a),p=e[8];if(p&&p!==\"Z\"){let f=Zt(p,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\\.000Z$/,\"\")??\"\"};var es=[W,H,pe,ye,Ht,Xt,Ps,Ms,Bs,Ds,vs,$s,_s,Ve,G,Ye,Je,Ge,It,Lt,Ce];var js=new Map([[\"core\",Ts],[\"failsafe\",[W,H,pe]],[\"json\",Ls],[\"yaml11\",es],[\"yaml-1.1\",es]]),qs={binary:Ve,bool:Ue,float:St,floatExp:wt,floatNaN:bt,floatTime:Lt,int:Ot,intHex:At,intOct:Nt,intTime:It,map:W,merge:G,null:ye,omap:Ye,pairs:Je,seq:H,set:Ge,timestamp:Ce},Rs={\"tag:yaml.org,2002:binary\":Ve,\"tag:yaml.org,2002:merge\":G,\"tag:yaml.org,2002:omap\":Ye,\"tag:yaml.org,2002:pairs\":Je,\"tag:yaml.org,2002:set\":Ge,\"tag:yaml.org,2002:timestamp\":Ce};function Ct(s,e,t){let n=js.get(e);if(n&&!s)return t&&!n.includes(G)?n.concat(G):n.slice();let i=n;if(!i)if(Array.isArray(s))i=[];else{let r=Array.from(js.keys()).filter(o=>o!==\"yaml11\").map(o=>JSON.stringify(o)).join(\", \");throw new Error(`Unknown schema \"${e}\"; use one of ${r} or define customTags array`)}if(Array.isArray(s))for(let r of s)i=i.concat(r);else typeof s==\"function\"&&(i=s(i.slice()));return t&&(i=i.concat(G)),i.reduce((r,o)=>{let l=typeof o==\"string\"?qs[o]:o;if(!l){let a=JSON.stringify(o),c=Object.keys(qs).map(p=>JSON.stringify(p)).join(\", \");throw new Error(`Unknown custom tag ${a}; use one of ${c}`)}return r.includes(l)||r.push(l),r},[])}var Tn=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0,ve=class s{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?Ct(e,\"compat\"):e?Ct(null,e):null,this.name=typeof r==\"string\"&&r||\"core\",this.knownTags=i?Rs:{},this.tags=Ct(t,this.name,n),this.toStringOptions=l??null,Object.defineProperty(this,Y,{value:W}),Object.defineProperty(this,q,{value:pe}),Object.defineProperty(this,re,{value:H}),this.sortMapEntries=typeof o==\"function\"?o:o===!0?Tn:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function Fs(s,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&s.directives){let a=s.directives.toString(s);a?(t.push(a),n=!0):s.directives.docStart&&(n=!0)}n&&t.push(\"---\");let i=ut(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift(\"\");let a=r(s.commentBefore);t.unshift(J(a,\"\"))}let o=!1,l=null;if(s.contents){if(I(s.contents)){if(s.contents.spaceBefore&&n&&t.push(\"\"),s.contents.commentBefore){let p=r(s.contents.commentBefore);t.push(J(p,\"\"))}i.forceBlockIndent=!!s.comment,l=s.contents.comment}let a=l?void 0:()=>o=!0,c=ae(s.contents,i,()=>l=null,a);l&&(c+=te(c,\"\",r(l))),(c[0]===\"|\"||c[0]===\">\")&&t[t.length-1]===\"---\"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(ae(s.contents,i));if(s.directives?.docEnd)if(s.comment){let a=r(s.comment);a.includes(`\n`)?(t.push(\"...\"),t.push(J(a,\"\"))):t.push(`... ${a}`)}else t.push(\"...\");else{let a=s.comment;a&&o&&(a=a.replace(/^\\n+/,\"\")),a&&((!o||l)&&t[t.length-1]!==\"\"&&t.push(\"\"),t.push(J(r(a),\"\")))}return t.join(`\n`)+`\n`}var se=class s{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,K,{value:st});let i=null;typeof t==\"function\"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:\"warn\",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:\"1.2\"},n);this.options=r;let{version:o}=r;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Z({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(s.prototype,{[K]:{value:st}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=I(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){$e(this.contents)&&this.contents.add(e)}addIn(e,t){$e(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Rt(this);e.anchor=!t||n.has(t)?Ft(t||\"a\",n):t}return new ee(e.anchor)}createNode(e,t,n){let i;if(typeof t==\"function\")e=t.call({\"\":e},\"\",e),i=t;else if(Array.isArray(t)){let m=S=>typeof S==\"number\"||S instanceof String||S instanceof Number,w=t.filter(m).map(String);w.length>0&&(t=t.concat(w)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:l,keepUndefined:a,onTagObj:c,tag:p}=n??{},{onAnchor:f,setAnchors:u,sourceObjects:d}=ws(this,o||\"a\"),g={aliasDuplicateObjects:r??!0,keepUndefined:a??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:d},h=oe(e,p,g);return l&&L(h)&&(h.flow=!0),u(),h}createPair(e,t,n={}){let i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new v(i,r)}delete(e){return $e(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ae(e)?this.contents==null?!1:(this.contents=null,!0):$e(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return L(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Ae(e)?!t&&E(this.contents)?this.contents.value:this.contents:L(this.contents)?this.contents.getIn(e,t):void 0}has(e){return L(this.contents)?this.contents.has(e):!1}hasIn(e){return Ae(e)?this.contents!==void 0:L(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=qe(this.schema,[e],t):$e(this.contents)&&this.contents.set(e,t)}setIn(e,t){Ae(e)?this.contents=t:this.contents==null?this.contents=qe(this.schema,Array.from(e),t):$e(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==\"number\"&&(e=String(e));let n;switch(e){case\"1.1\":this.directives?this.directives.yaml.version=\"1.1\":this.directives=new Z({version:\"1.1\"}),n={resolveKnownTags:!1,schema:\"yaml-1.1\"};break;case\"1.2\":case\"next\":this.directives?this.directives.yaml.version=e:this.directives=new Z({version:e}),n={resolveKnownTags:!0,schema:\"core\"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new ve(Object.assign(n,t));else throw new Error(\"With a null YAML version, the { schema: Schema } option is required\")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){let l={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i==\"number\"?i:100},a=M(this.contents,t??\"\",l);if(typeof r==\"function\")for(let{count:c,res:p}of l.anchors.values())r(p,c);return typeof o==\"function\"?fe(o,{\"\":a},\"\",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error(\"Document with errors cannot be stringified\");if(\"indent\"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`\"indent\" option must be a positive integer, not ${t}`)}return Fs(this,e)}};function $e(s){if(L(s))return!0;throw new Error(\"Expected a YAML collection as document contents\")}var _e=class extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}},R=class extends _e{constructor(e,t,n){super(\"YAMLParseError\",e,t,n)}},Pe=class extends _e{constructor(e,t,n){super(\"YAMLWarning\",e,t,n)}},We=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(l=>e.linePos(l));let{line:n,col:i}=t.linePos[0];t.message+=` at line ${n}, column ${i}`;let r=i-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\\n\\r]+$/,\"\");if(r>=60&&o.length>80){let l=Math.min(r-39,o.length-79);o=\"\\u2026\"+o.substring(l),r-=l-1}if(o.length>80&&(o=o.substring(0,79)+\"\\u2026\"),n>1&&/^ *$/.test(o.substring(0,r))){let l=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);l.length>80&&(l=l.substring(0,79)+`\\u2026\n`),o=l+o}if(/[^ ]/.test(o)){let l=1,a=t.linePos[1];a?.line===n&&a.col>i&&(l=Math.max(1,Math.min(a.col-i,80-r)));let c=\" \".repeat(r)+\"^\".repeat(l);t.message+=`:\n\n${o}\n${c}\n`}};function ne(s,{flow:e,indicator:t,next:n,offset:i,onError:r,parentIndent:o,startOnNewline:l}){let a=!1,c=l,p=l,f=\"\",u=\"\",d=!1,g=!1,h=null,m=null,w=null,S=null,k=null,N=null,O=null;for(let b of s)switch(g&&(b.type!==\"space\"&&b.type!==\"newline\"&&b.type!==\"comma\"&&r(b.offset,\"MISSING_CHAR\",\"Tags and anchors must be separated from the next token by white space\"),g=!1),h&&(c&&b.type!==\"comment\"&&b.type!==\"newline\"&&r(h,\"TAB_AS_INDENT\",\"Tabs are not allowed as indentation\"),h=null),b.type){case\"space\":!e&&(t!==\"doc-start\"||n?.type!==\"flow-collection\")&&b.source.includes(\"\t\")&&(h=b),p=!0;break;case\"comment\":{p||r(b,\"MISSING_CHAR\",\"Comments must be separated from other tokens by white space characters\");let _=b.source.substring(1)||\" \";f?f+=u+_:f=_,u=\"\",c=!1;break}case\"newline\":c?f?f+=b.source:(!N||t!==\"seq-item-ind\")&&(a=!0):u+=b.source,c=!0,d=!0,(m||w)&&(S=b),p=!0;break;case\"anchor\":m&&r(b,\"MULTIPLE_ANCHORS\",\"A node can have at most one anchor\"),b.source.endsWith(\":\")&&r(b.offset+b.source.length-1,\"BAD_ALIAS\",\"Anchor ending in : is ambiguous\",!0),m=b,O??(O=b.offset),c=!1,p=!1,g=!0;break;case\"tag\":{w&&r(b,\"MULTIPLE_TAGS\",\"A node can have at most one tag\"),w=b,O??(O=b.offset),c=!1,p=!1,g=!0;break}case t:(m||w)&&r(b,\"BAD_PROP_ORDER\",`Anchors and tags must be after the ${b.source} indicator`),N&&r(b,\"UNEXPECTED_TOKEN\",`Unexpected ${b.source} in ${e??\"collection\"}`),N=b,c=t===\"seq-item-ind\"||t===\"explicit-key-ind\",p=!1;break;case\"comma\":if(e){k&&r(b,\"UNEXPECTED_TOKEN\",`Unexpected , in ${e}`),k=b,c=!1,p=!1;break}default:r(b,\"UNEXPECTED_TOKEN\",`Unexpected ${b.type} token`),c=!1,p=!1}let A=s[s.length-1],C=A?A.offset+A.source.length:i;return g&&n&&n.type!==\"space\"&&n.type!==\"newline\"&&n.type!==\"comma\"&&(n.type!==\"scalar\"||n.source!==\"\")&&r(n.offset,\"MISSING_CHAR\",\"Tags and anchors must be separated from the next token by white space\"),h&&(c&&h.indent<=o||n?.type===\"block-map\"||n?.type===\"block-seq\")&&r(h,\"TAB_AS_INDENT\",\"Tabs are not allowed as indentation\"),{comma:k,found:N,spaceBefore:a,comment:f,hasNewline:d,anchor:m,tag:w,newlineAfterProp:S,end:C,start:O??C}}function me(s){if(!s)return null;switch(s.type){case\"alias\":case\"scalar\":case\"double-quoted-scalar\":case\"single-quoted-scalar\":if(s.source.includes(`\n`))return!0;if(s.end){for(let e of s.end)if(e.type===\"newline\")return!0}return!1;case\"flow-collection\":for(let e of s.items){for(let t of e.start)if(t.type===\"newline\")return!0;if(e.sep){for(let t of e.sep)if(t.type===\"newline\")return!0}if(me(e.key)||me(e.value))return!0}return!1;default:return!0}}function He(s,e,t){if(e?.type===\"flow-collection\"){let n=e.end[0];n.indent===s&&(n.source===\"]\"||n.source===\"}\")&&me(e)&&t(n,\"BAD_INDENT\",\"Flow end indicator should be more indented than parent\",!0)}}function vt(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let i=typeof n==\"function\"?n:(r,o)=>r===o||E(r)&&E(o)&&r.value===o.value;return e.some(r=>i(r.key,t))}var xs=\"All mapping items must start at the same column\";function Us({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=r?.nodeClass??$,l=new o(t.schema);t.atRoot&&(t.atRoot=!1);let a=n.offset,c=null;for(let p of n.items){let{start:f,key:u,sep:d,value:g}=p,h=ne(f,{indicator:\"explicit-key-ind\",next:u??d?.[0],offset:a,onError:i,parentIndent:n.indent,startOnNewline:!0}),m=!h.found;if(m){if(u&&(u.type===\"block-seq\"?i(a,\"BLOCK_AS_IMPLICIT_KEY\",\"A block sequence may not be used as an implicit map key\"):\"indent\"in u&&u.indent!==n.indent&&i(a,\"BAD_INDENT\",xs)),!h.anchor&&!h.tag&&!d){c=h.end,h.comment&&(l.comment?l.comment+=`\n`+h.comment:l.comment=h.comment);continue}(h.newlineAfterProp||me(u))&&i(u??f[f.length-1],\"MULTILINE_IMPLICIT_KEY\",\"Implicit keys need to be on a single line\")}else h.found?.indent!==n.indent&&i(a,\"BAD_INDENT\",xs);t.atKey=!0;let w=h.end,S=u?s(t,u,h,i):e(t,w,f,null,h,i);t.schema.compat&&He(n.indent,u,i),t.atKey=!1,vt(t,l.items,S)&&i(w,\"DUPLICATE_KEY\",\"Map keys must be unique\");let k=ne(d??[],{indicator:\"map-value-ind\",next:g,offset:S.range[2],onError:i,parentIndent:n.indent,startOnNewline:!u||u.type===\"block-scalar\"});if(a=k.end,k.found){m&&(g?.type===\"block-map\"&&!k.hasNewline&&i(a,\"BLOCK_AS_IMPLICIT_KEY\",\"Nested mappings are not allowed in compact mappings\"),t.options.strict&&h.start<k.found.offset-1024&&i(S.range,\"KEY_OVER_1024_CHARS\",\"The : indicator must be at most 1024 chars after the start of an implicit block mapping key\"));let N=g?s(t,g,k,i):e(t,a,d,null,k,i);t.schema.compat&&He(n.indent,g,i),a=N.range[2];let O=new v(S,N);t.options.keepSourceTokens&&(O.srcToken=p),l.items.push(O)}else{m&&i(S.range,\"MISSING_CHAR\",\"Implicit map keys need to be followed by map values\"),k.comment&&(S.comment?S.comment+=`\n`+k.comment:S.comment=k.comment);let N=new v(S);t.options.keepSourceTokens&&(N.srcToken=p),l.items.push(N)}}return c&&c<a&&i(c,\"IMPOSSIBLE\",\"Map comment with trailing content\"),l.range=[n.offset,a,c??a],l}function Vs({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=r?.nodeClass??B,l=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let a=n.offset,c=null;for(let{start:p,value:f}of n.items){let u=ne(p,{indicator:\"seq-item-ind\",next:f,offset:a,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||f)f?.type===\"block-seq\"?i(u.end,\"BAD_INDENT\",\"All sequence items must start at the same column\"):i(a,\"MISSING_CHAR\",\"Sequence item without - indicator\");else{c=u.end,u.comment&&(l.comment=u.comment);continue}let d=f?s(t,f,u,i):e(t,u.end,p,null,u,i);t.schema.compat&&He(n.indent,f,i),a=d.range[2],l.items.push(d)}return l.range=[n.offset,a,c??a],l}function ie(s,e,t,n){let i=\"\";if(s){let r=!1,o=\"\";for(let l of s){let{source:a,type:c}=l;switch(c){case\"space\":r=!0;break;case\"comment\":{t&&!r&&n(l,\"MISSING_CHAR\",\"Comments must be separated from other tokens by white space characters\");let p=a.substring(1)||\" \";i?i+=o+p:i=p,o=\"\";break}case\"newline\":i&&(o+=a),r=!0;break;default:n(l,\"UNEXPECTED_TOKEN\",`Unexpected ${c} at node end`)}e+=a.length}}return{comment:i,offset:e}}var ts=\"Block collections are not allowed within flow collections\",ss=s=>s&&(s.type===\"block-map\"||s.type===\"block-seq\");function Js({composeNode:s,composeEmptyNode:e},t,n,i,r){let o=n.start.source===\"{\",l=o?\"flow map\":\"flow sequence\",a=r?.nodeClass??(o?$:B),c=new a(t.schema);c.flow=!0;let p=t.atRoot;p&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let f=n.offset+n.start.source.length;for(let m=0;m<n.items.length;++m){let w=n.items[m],{start:S,key:k,sep:N,value:O}=w,A=ne(S,{flow:l,indicator:\"explicit-key-ind\",next:k??N?.[0],offset:f,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!N&&!O){m===0&&A.comma?i(A.comma,\"UNEXPECTED_TOKEN\",`Unexpected , in ${l}`):m<n.items.length-1&&i(A.start,\"UNEXPECTED_TOKEN\",`Unexpected empty item in ${l}`),A.comment&&(c.comment?c.comment+=`\n`+A.comment:c.comment=A.comment),f=A.end;continue}!o&&t.options.strict&&me(k)&&i(k,\"MULTILINE_IMPLICIT_KEY\",\"Implicit keys of flow sequence pairs need to be on a single line\")}if(m===0)A.comma&&i(A.comma,\"UNEXPECTED_TOKEN\",`Unexpected , in ${l}`);else if(A.comma||i(A.start,\"MISSING_CHAR\",`Missing , between ${l} items`),A.comment){let C=\"\";e:for(let b of S)switch(b.type){case\"comma\":case\"space\":break;case\"comment\":C=b.source.substring(1);break e;default:break e}if(C){let b=c.items[c.items.length-1];T(b)&&(b=b.value??b.key),b.comment?b.comment+=`\n`+C:b.comment=C,A.comment=A.comment.substring(C.length+1)}}if(!o&&!N&&!A.found){let C=O?s(t,O,A,i):e(t,A.end,N,null,A,i);c.items.push(C),f=C.range[2],ss(O)&&i(C.range,\"BLOCK_IN_FLOW\",ts)}else{t.atKey=!0;let C=A.end,b=k?s(t,k,A,i):e(t,C,S,null,A,i);ss(k)&&i(b.range,\"BLOCK_IN_FLOW\",ts),t.atKey=!1;let _=ne(N??[],{flow:l,indicator:\"map-value-ind\",next:O,offset:b.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(_.found){if(!o&&!A.found&&t.options.strict){if(N)for(let P of N){if(P===_.found)break;if(P.type===\"newline\"){i(P,\"MULTILINE_IMPLICIT_KEY\",\"Implicit keys of flow sequence pairs need to be on a single line\");break}}A.start<_.found.offset-1024&&i(_.found,\"KEY_OVER_1024_CHARS\",\"The : indicator must be at most 1024 chars after the start of an implicit flow sequence key\")}}else O&&(\"source\"in O&&O.source?.[0]===\":\"?i(O,\"MISSING_CHAR\",`Missing space after : in ${l}`):i(_.start,\"MISSING_CHAR\",`Missing , or : between ${l} items`));let ce=O?s(t,O,_,i):_.found?e(t,_.end,N,null,_,i):null;ce?ss(O)&&i(ce.range,\"BLOCK_IN_FLOW\",ts):_.comment&&(b.comment?b.comment+=`\n`+_.comment:b.comment=_.comment);let Se=new v(b,ce);if(t.options.keepSourceTokens&&(Se.srcToken=w),o){let P=c;vt(t,P.items,b)&&i(C,\"DUPLICATE_KEY\",\"Map keys must be unique\"),P.items.push(Se)}else{let P=new $(t.schema);P.flow=!0,P.items.push(Se);let ps=(ce??b).range;P.range=[b.range[0],ps[1],ps[2]],c.items.push(P)}f=ce?ce.range[2]:_.end}}let u=o?\"}\":\"]\",[d,...g]=n.end,h=f;if(d?.source===u)h=d.offset+d.source.length;else{let m=l[0].toUpperCase()+l.substring(1),w=p?`${m} must end with a ${u}`:`${m} in block collection must be sufficiently indented and end with a ${u}`;i(f,p?\"MISSING_CHAR\":\"BAD_INDENT\",w),d&&d.source.length!==1&&g.unshift(d)}if(g.length>0){let m=ie(g,h,t.options.strict,i);m.comment&&(c.comment?c.comment+=`\n`+m.comment:c.comment=m.comment),c.range=[n.offset,h,m.offset]}else c.range=[n.offset,h,h];return c}function ns(s,e,t,n,i,r){let o=t.type===\"block-map\"?Us(s,e,t,n,r):t.type===\"block-seq\"?Vs(s,e,t,n,r):Js(s,e,t,n,r),l=o.constructor;return i===\"!\"||i===l.tagName?(o.tag=l.tagName,o):(i&&(o.tag=i),o)}function Ys(s,e,t,n,i){let r=n.tag,o=r?e.directives.tagName(r.source,u=>i(r,\"TAG_RESOLVE_FAILED\",u)):null;if(t.type===\"block-seq\"){let{anchor:u,newlineAfterProp:d}=n,g=u&&r?u.offset>r.offset?u:r:u??r;g&&(!d||d.offset<g.offset)&&i(g,\"MISSING_CHAR\",\"Missing newline after block sequence props\")}let l=t.type===\"block-map\"?\"map\":t.type===\"block-seq\"?\"seq\":t.start.source===\"{\"?\"map\":\"seq\";if(!r||!o||o===\"!\"||o===$.tagName&&l===\"map\"||o===B.tagName&&l===\"seq\")return ns(s,e,t,i,o);let a=e.schema.tags.find(u=>u.tag===o&&u.collection===l);if(!a){let u=e.schema.knownTags[o];if(u?.collection===l)e.schema.tags.push(Object.assign({},u,{default:!1})),a=u;else return u?i(r,\"BAD_COLLECTION_TYPE\",`${u.tag} used for ${l} collection, but expects ${u.collection??\"scalar\"}`,!0):i(r,\"TAG_RESOLVE_FAILED\",`Unresolved tag: ${o}`,!0),ns(s,e,t,i,o)}let c=ns(s,e,t,i,o,a),p=a.resolve?.(c,u=>i(r,\"TAG_RESOLVE_FAILED\",u),e.options)??c,f=I(p)?p:new y(p);return f.range=c.range,f.tag=o,a?.format&&(f.format=a.format),f}function $t(s,e,t){let n=e.offset,i=In(e,s.options.strict,t);if(!i)return{value:\"\",type:null,comment:\"\",range:[n,n,n]};let r=i.mode===\">\"?y.BLOCK_FOLDED:y.BLOCK_LITERAL,o=e.source?Ln(e.source):[],l=o.length;for(let h=o.length-1;h>=0;--h){let m=o[h][1];if(m===\"\"||m===\"\\r\")l=h;else break}if(l===0){let h=i.chomp===\"+\"&&o.length>0?`\n`.repeat(Math.max(1,o.length-1)):\"\",m=n+i.length;return e.source&&(m+=e.source.length),{value:h,type:r,comment:i.comment,range:[n,m,m]}}let a=e.indent+i.indent,c=e.offset+i.length,p=0;for(let h=0;h<l;++h){let[m,w]=o[h];if(w===\"\"||w===\"\\r\")i.indent===0&&m.length>a&&(a=m.length);else{m.length<a&&t(c+m.length,\"MISSING_CHAR\",\"Block scalars with more-indented leading empty lines must use an explicit indentation indicator\"),i.indent===0&&(a=m.length),p=h,a===0&&!s.atRoot&&t(c,\"BAD_INDENT\",\"Block scalar values in collections must be indented\");break}c+=m.length+w.length+1}for(let h=o.length-1;h>=l;--h)o[h][0].length>a&&(l=h+1);let f=\"\",u=\"\",d=!1;for(let h=0;h<p;++h)f+=o[h][0].slice(a)+`\n`;for(let h=p;h<l;++h){let[m,w]=o[h];c+=m.length+w.length+1;let S=w[w.length-1]===\"\\r\";if(S&&(w=w.slice(0,-1)),w&&m.length<a){let N=`Block scalar lines must not be less indented than their ${i.indent?\"explicit indentation indicator\":\"first line\"}`;t(c-w.length-(S?2:1),\"BAD_INDENT\",N),m=\"\"}r===y.BLOCK_LITERAL?(f+=u+m.slice(a)+w,u=`\n`):m.length>a||w[0]===\"\t\"?(u===\" \"?u=`\n`:!d&&u===`\n`&&(u=`\n\n`),f+=u+m.slice(a)+w,u=`\n`,d=!0):w===\"\"?u===`\n`?f+=`\n`:u=`\n`:(f+=u+w,u=\" \",d=!1)}switch(i.chomp){case\"-\":break;case\"+\":for(let h=l;h<o.length;++h)f+=`\n`+o[h][0].slice(a);f[f.length-1]!==`\n`&&(f+=`\n`);break;default:f+=`\n`}let g=n+i.length+e.source.length;return{value:f,type:r,comment:i.comment,range:[n,g,g]}}function In({offset:s,props:e},t,n){if(e[0].type!==\"block-scalar-header\")return n(e[0],\"IMPOSSIBLE\",\"Block scalar header not found\"),null;let{source:i}=e[0],r=i[0],o=0,l=\"\",a=-1;for(let u=1;u<i.length;++u){let d=i[u];if(!l&&(d===\"-\"||d===\"+\"))l=d;else{let g=Number(d);!o&&g?o=g:a===-1&&(a=s+u)}}a!==-1&&n(a,\"UNEXPECTED_TOKEN\",`Block scalar header includes extra characters: ${i}`);let c=!1,p=\"\",f=i.length;for(let u=1;u<e.length;++u){let d=e[u];switch(d.type){case\"space\":c=!0;case\"newline\":f+=d.source.length;break;case\"comment\":t&&!c&&n(d,\"MISSING_CHAR\",\"Comments must be separated from other tokens by white space characters\"),f+=d.source.length,p=d.source.substring(1);break;case\"error\":n(d,\"UNEXPECTED_TOKEN\",d.message),f+=d.source.length;break;default:{let g=`Unexpected token in block scalar header: ${d.type}`;n(d,\"UNEXPECTED_TOKEN\",g);let h=d.source;h&&typeof h==\"string\"&&(f+=h.length)}}}return{mode:r,indent:o,chomp:l,comment:p,length:f}}function Ln(s){let e=s.split(/\\n( *)/),t=e[0],n=t.match(/^( *)/),r=[n?.[1]?[n[1],t.slice(n[1].length)]:[\"\",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function _t(s,e,t){let{offset:n,type:i,source:r,end:o}=s,l,a,c=(u,d,g)=>t(n+u,d,g);switch(i){case\"scalar\":l=y.PLAIN,a=Cn(r,c);break;case\"single-quoted-scalar\":l=y.QUOTE_SINGLE,a=vn(r,c);break;case\"double-quoted-scalar\":l=y.QUOTE_DOUBLE,a=$n(r,c);break;default:return t(s,\"UNEXPECTED_TOKEN\",`Expected a flow scalar value, but found: ${i}`),{value:\"\",type:null,comment:\"\",range:[n,n+r.length,n+r.length]}}let p=n+r.length,f=ie(o,p,e,t);return{value:a,type:l,comment:f.comment,range:[n,p,f.offset]}}function Cn(s,e){let t=\"\";switch(s[0]){case\"\t\":t=\"a tab character\";break;case\",\":t=\"flow indicator character ,\";break;case\"%\":t=\"directive indicator character %\";break;case\"|\":case\">\":{t=`block scalar indicator ${s[0]}`;break}case\"@\":case\"`\":{t=`reserved character ${s[0]}`;break}}return t&&e(0,\"BAD_SCALAR_START\",`Plain value cannot start with ${t}`),Qs(s)}function vn(s,e){return(s[s.length-1]!==\"'\"||s.length===1)&&e(s.length,\"MISSING_CHAR\",\"Missing closing 'quote\"),Qs(s.slice(1,-1)).replace(/''/g,\"'\")}function Qs(s){let e=/(.*?)\\r?\\n/sy,t=e.exec(s);if(!t)return s;let n,i;try{n=new RegExp(\"(?<![ \t])[ \t]+$\"),i=new RegExp(\"^[ \t]+|(?<![ \t])[ \t]+$\",\"g\")}catch{n=/[ \\t]+$/,i=/^[ \\t]+|[ \\t]+$/g}let r=t[1].replace(n,\"\"),o=\" \",l=e.lastIndex;for(;t=e.exec(s);){let c=t[1].replace(i,\"\");c===\"\"?o===`\n`?r+=o:o=`\n`:(r+=o+c,o=\" \"),l=e.lastIndex}let a=/[ \\t]*(.*)/sy;return a.lastIndex=l,t=a.exec(s),r+o+(t?.[1]??\"\")}function $n(s,e){let t=\"\";for(let n=1;n<s.length-1;++n){let i=s[n];if(!(i===\"\\r\"&&s[n+1]===`\n`))if(i===`\n`){let{fold:r,offset:o}=_n(s,n);t+=r,n=o}else if(i===\"\\\\\"){let r=s[++n],o=Pn[r];if(o)t+=o;else if(r===`\n`)for(r=s[n+1];r===\" \"||r===\"\t\";)r=s[++n+1];else if(r===\"\\r\"&&s[n+1]===`\n`)for(r=s[++n+1];r===\" \"||r===\"\t\";)r=s[++n+1];else if(r===\"x\"||r===\"u\"||r===\"U\"){let l=r===\"x\"?2:r===\"u\"?4:8;t+=Mn(s,n+1,l,e),n+=l}else{let l=s.substr(n-1,2);e(n-1,\"BAD_DQ_ESCAPE\",`Invalid escape sequence ${l}`),t+=l}}else if(i===\" \"||i===\"\t\"){let r=n,o=s[n+1];for(;o===\" \"||o===\"\t\";)o=s[++n+1];o!==`\n`&&!(o===\"\\r\"&&s[n+2]===`\n`)&&(t+=n>r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='\"'||s.length===1)&&e(s.length,\"MISSING_CHAR\",'Missing closing \"quote'),t}function _n(s,e){let t=\"\",n=s[e+1];for(;(n===\" \"||n===\"\t\"||n===`\n`||n===\"\\r\")&&!(n===\"\\r\"&&s[e+2]!==`\n`);)n===`\n`&&(t+=`\n`),e+=1,n=s[e+1];return t||(t=\" \"),{fold:t,offset:e}}var Pn={0:\"\\0\",a:\"\\x07\",b:\"\\b\",e:\"\\x1B\",f:\"\\f\",n:`\n`,r:\"\\r\",t:\"\t\",v:\"\\v\",N:\"\\x85\",_:\"\\xA0\",L:\"\\u2028\",P:\"\\u2029\",\" \":\" \",'\"':'\"',\"/\":\"/\",\"\\\\\":\"\\\\\",\"\t\":\"\t\"};function Mn(s,e,t,n){let i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(o)}catch{let l=s.substr(e-2,t+2);return n(e-2,\"BAD_DQ_ESCAPE\",`Invalid escape sequence ${l}`),l}}function is(s,e,t,n){let{value:i,type:r,comment:o,range:l}=e.type===\"block-scalar\"?$t(s,e,n):_t(e,s.options.strict,n),a=t?s.directives.tagName(t.source,f=>n(t,\"TAG_RESOLVE_FAILED\",f)):null,c;s.options.stringKeys&&s.atKey?c=s.schema[q]:a?c=Bn(s.schema,i,a,t,n):e.type===\"scalar\"?c=Dn(s,i,e,n):c=s.schema[q];let p;try{let f=c.resolve(i,u=>n(t??e,\"TAG_RESOLVE_FAILED\",u),s.options);p=E(f)?f:new y(f)}catch(f){let u=f instanceof Error?f.message:String(f);n(t??e,\"TAG_RESOLVE_FAILED\",u),p=new y(i)}return p.range=l,p.source=i,r&&(p.type=r),a&&(p.tag=a),c.format&&(p.format=c.format),o&&(p.comment=o),p}function Bn(s,e,t,n,i){if(t===\"!\")return s[q];let r=[];for(let l of s.tags)if(!l.collection&&l.tag===t)if(l.default&&l.test)r.push(l);else return l;for(let l of r)if(l.test?.test(e))return l;let o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,\"TAG_RESOLVE_FAILED\",`Unresolved tag: ${t}`,t!==\"tag:yaml.org,2002:str\"),s[q])}function Dn({atKey:s,directives:e,schema:t},n,i,r){let o=t.tags.find(l=>(l.default===!0||s&&l.default===\"key\")&&l.test?.test(n))||t[q];if(t.compat){let l=t.compat.find(a=>a.default&&a.test?.test(n))??t[q];if(o.tag!==l.tag){let a=e.tagString(o.tag),c=e.tagString(l.tag),p=`Value may be parsed as either ${a} or ${c}`;r(i,\"TAG_RESOLVE_FAILED\",p,!0)}}return o}function Gs(s,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case\"space\":case\"comment\":case\"newline\":s-=i.source.length;continue}for(i=e[++n];i?.type===\"space\";)s+=i.source.length,i=e[++n];break}}return s}var Kn={composeNode:rs,composeEmptyNode:Pt};function rs(s,e,t,n){let i=s.atKey,{spaceBefore:r,comment:o,anchor:l,tag:a}=t,c,p=!0;switch(e.type){case\"alias\":c=jn(s,e,n),(l||a)&&n(e,\"ALIAS_PROPS\",\"An alias node must not specify any properties\");break;case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":case\"block-scalar\":c=is(s,e,a,n),l&&(c.anchor=l.source.substring(1));break;case\"block-map\":case\"block-seq\":case\"flow-collection\":try{c=Ys(Kn,s,e,t,n),l&&(c.anchor=l.source.substring(1))}catch(f){let u=f instanceof Error?f.message:String(f);n(e,\"RESOURCE_EXHAUSTION\",u)}break;default:{let f=e.type===\"error\"?e.message:`Unsupported token (type: ${e.type})`;n(e,\"UNEXPECTED_TOKEN\",f),p=!1}}return c??(c=Pt(s,e.offset,void 0,null,t,n)),l&&c.anchor===\"\"&&n(l,\"BAD_ALIAS\",\"Anchor cannot be an empty string\"),i&&s.options.stringKeys&&(!E(c)||typeof c.value!=\"string\"||c.tag&&c.tag!==\"tag:yaml.org,2002:str\")&&n(a??e,\"NON_STRING_KEY\",\"With stringKeys, all keys must be strings\"),r&&(c.spaceBefore=!0),o&&(e.type===\"scalar\"&&e.source===\"\"?c.comment=o:c.commentBefore=o),s.options.keepSourceTokens&&p&&(c.srcToken=e),c}function Pt(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:l,end:a},c){let p={type:\"scalar\",offset:Gs(e,t,n),indent:-1,source:\"\"},f=is(s,p,l,c);return o&&(f.anchor=o.source.substring(1),f.anchor===\"\"&&c(o,\"BAD_ALIAS\",\"Anchor cannot be an empty string\")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=a),f}function jn({options:s},{offset:e,source:t,end:n},i){let r=new ee(t.substring(1));r.source===\"\"&&i(e,\"BAD_ALIAS\",\"Alias cannot be an empty string\"),r.source.endsWith(\":\")&&i(e+t.length-1,\"BAD_ALIAS\",\"Alias ending in : is ambiguous\",!0);let o=e+t.length,l=ie(n,o,s.strict,i);return r.range=[e,o,l.offset],l.comment&&(r.comment=l.comment),r}function Ws(s,e,{offset:t,start:n,value:i,end:r},o){let l=Object.assign({_directives:e},s),a=new se(void 0,l),c={atKey:!1,atRoot:!0,directives:a.directives,options:a.options,schema:a.schema},p=ne(n,{indicator:\"doc-start\",next:i??r?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});p.found&&(a.directives.docStart=!0,i&&(i.type===\"block-map\"||i.type===\"block-seq\")&&!p.hasNewline&&o(p.end,\"MISSING_CHAR\",\"Block collection cannot start on same line with directives-end marker\")),a.contents=i?rs(c,i,p,o):Pt(c,p.end,n,null,p,o);let f=a.contents.range[2],u=ie(r,f,!1,o);return u.comment&&(a.comment=u.comment),a.range=[t,f,u.offset],a}function Xe(s){if(typeof s==\"number\")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t==\"string\"?t.length:1)]}function Hs(s){let e=\"\",t=!1,n=!1;for(let i=0;i<s.length;++i){let r=s[i];switch(r[0]){case\"#\":e+=(e===\"\"?\"\":n?`\n\n`:`\n`)+(r.substring(1)||\" \"),t=!0,n=!1;break;case\"%\":s[i+1]?.[0]!==\"#\"&&(i+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}var be=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,i,r)=>{let o=Xe(t);r?this.warnings.push(new Pe(o,n,i)):this.errors.push(new R(o,n,i))},this.directives=new Z({version:e.version||\"1.2\"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:i}=Hs(this.prelude);if(n){let r=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(i||e.directives.docStart||!r)e.commentBefore=n;else if(L(r)&&!r.flow&&r.items.length>0){let o=r.items[0];T(o)&&(o=o.key);let l=o.commentBefore;o.commentBefore=l?`${n}\n${l}`:n}else{let o=r.commentBefore;r.commentBefore=o?`${n}\n${o}`:n}}if(t){for(let r=0;r<this.errors.length;++r)e.errors.push(this.errors[r]);for(let r=0;r<this.warnings.length;++r)e.warnings.push(this.warnings[r])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Hs(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(e.type){case\"directive\":this.directives.add(e.source,(t,n,i)=>{let r=Xe(e);r[0]+=t,this.onError(r,\"BAD_DIRECTIVE\",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case\"document\":{let t=Ws(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,\"MISSING_CHAR\",\"Missing directives-end/doc-start indicator line\"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case\"byte-order-mark\":case\"space\":break;case\"comment\":case\"newline\":this.prelude.push(e.source);break;case\"error\":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new R(Xe(e),\"UNEXPECTED_TOKEN\",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case\"doc-end\":{if(!this.doc){let n=\"Unexpected doc-end without preceding document\";this.errors.push(new R(Xe(e),\"UNEXPECTED_TOKEN\",n));break}this.doc.directives.docEnd=!0;let t=ie(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new R(Xe(e),\"UNEXPECTED_TOKEN\",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),i=new se(void 0,n);this.atDirectives&&this.onError(t,\"MISSING_CHAR\",\"Missing directives-end indicator line\"),i.range=[0,t,t],this.decorate(i,!1),yield i}}};var cs={};ms(cs,{BOM:()=>ze,DOCUMENT:()=>Ze,FLOW_END:()=>et,SCALAR:()=>Me,createScalarToken:()=>zs,isCollection:()=>Fn,isScalar:()=>xn,prettyToken:()=>Un,resolveAsScalar:()=>Xs,setScalarValue:()=>Zs,stringify:()=>tn,tokenType:()=>as,visit:()=>de});function Xs(s,e=!0,t){if(s){let n=(i,r,o)=>{let l=typeof i==\"number\"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(l,r,o);else throw new R([l,l+1],r,o)};switch(s.type){case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":return _t(s,e,n);case\"block-scalar\":return $t({options:{strict:e}},s,n)}}return null}function zs(s,e){let{implicitKey:t=!1,indent:n,inFlow:i=!1,offset:r=-1,type:o=\"PLAIN\"}=e,l=le({type:o,value:s},{implicitKey:t,indent:n>0?\" \".repeat(n):\"\",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),a=e.end??[{type:\"newline\",offset:-1,indent:n,source:`\n`}];switch(l[0]){case\"|\":case\">\":{let c=l.indexOf(`\n`),p=l.substring(0,c),f=l.substring(c+1)+`\n`,u=[{type:\"block-scalar-header\",offset:r,indent:n,source:p}];return en(u,a)||u.push({type:\"newline\",offset:-1,indent:n,source:`\n`}),{type:\"block-scalar\",offset:r,indent:n,props:u,source:f}}case'\"':return{type:\"double-quoted-scalar\",offset:r,indent:n,source:l,end:a};case\"'\":return{type:\"single-quoted-scalar\",offset:r,indent:n,source:l,end:a};default:return{type:\"scalar\",offset:r,indent:n,source:l,end:a}}}function Zs(s,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,l=\"indent\"in s?s.indent:null;if(n&&typeof l==\"number\"&&(l+=2),!o)switch(s.type){case\"single-quoted-scalar\":o=\"QUOTE_SINGLE\";break;case\"double-quoted-scalar\":o=\"QUOTE_DOUBLE\";break;case\"block-scalar\":{let c=s.props[0];if(c.type!==\"block-scalar-header\")throw new Error(\"Invalid block scalar header\");o=c.source[0]===\">\"?\"BLOCK_FOLDED\":\"BLOCK_LITERAL\";break}default:o=\"PLAIN\"}let a=le({type:o,value:e},{implicitKey:i||l===null,indent:l!==null&&l>0?\" \".repeat(l):\"\",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(a[0]){case\"|\":case\">\":qn(s,a);break;case'\"':os(s,a,\"double-quoted-scalar\");break;case\"'\":os(s,a,\"single-quoted-scalar\");break;default:os(s,a,\"scalar\")}}function qn(s,e){let t=e.indexOf(`\n`),n=e.substring(0,t),i=e.substring(t+1)+`\n`;if(s.type===\"block-scalar\"){let r=s.props[0];if(r.type!==\"block-scalar-header\")throw new Error(\"Invalid block scalar header\");r.source=n,s.source=i}else{let{offset:r}=s,o=\"indent\"in s?s.indent:-1,l=[{type:\"block-scalar-header\",offset:r,indent:o,source:n}];en(l,\"end\"in s?s.end:void 0)||l.push({type:\"newline\",offset:-1,indent:o,source:`\n`});for(let a of Object.keys(s))a!==\"type\"&&a!==\"offset\"&&delete s[a];Object.assign(s,{type:\"block-scalar\",indent:o,props:l,source:i})}}function en(s,e){if(e)for(let t of e)switch(t.type){case\"space\":case\"comment\":s.push(t);break;case\"newline\":return s.push(t),!0}return!1}function os(s,e,t){switch(s.type){case\"scalar\":case\"double-quoted-scalar\":case\"single-quoted-scalar\":s.type=t,s.source=e;break;case\"block-scalar\":{let n=s.props.slice(1),i=e.length;s.props[0].type===\"block-scalar-header\"&&(i-=s.props[0].source.length);for(let r of n)r.offset+=i;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case\"block-map\":case\"block-seq\":{let i={type:\"newline\",offset:s.offset+e.length,indent:s.indent,source:`\n`};delete s.items,Object.assign(s,{type:t,source:e,end:[i]});break}default:{let n=\"indent\"in s?s.indent:-1,i=\"end\"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type===\"space\"||r.type===\"comment\"||r.type===\"newline\"):[];for(let r of Object.keys(s))r!==\"type\"&&r!==\"offset\"&&delete s[r];Object.assign(s,{type:t,indent:n,source:e,end:i})}}}var tn=s=>\"type\"in s?Bt(s):Mt(s);function Bt(s){switch(s.type){case\"block-scalar\":{let e=\"\";for(let t of s.props)e+=Bt(t);return e+s.source}case\"block-map\":case\"block-seq\":{let e=\"\";for(let t of s.items)e+=Mt(t);return e}case\"flow-collection\":{let e=s.start.source;for(let t of s.items)e+=Mt(t);for(let t of s.end)e+=t.source;return e}case\"document\":{let e=Mt(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if(\"end\"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function Mt({start:s,key:e,sep:t,value:n}){let i=\"\";for(let r of s)i+=r.source;if(e&&(i+=Bt(e)),t)for(let r of t)i+=r.source;return n&&(i+=Bt(n)),i}var ls=Symbol(\"break visit\"),Rn=Symbol(\"skip children\"),sn=Symbol(\"remove item\");function de(s,e){\"type\"in s&&s.type===\"document\"&&(s={start:s.start,value:s.value}),nn(Object.freeze([]),s,e)}de.BREAK=ls;de.SKIP=Rn;de.REMOVE=sn;de.itemAtPath=(s,e)=>{let t=s;for(let[n,i]of e){let r=t?.[n];if(r&&\"items\"in r)t=r.items[i];else return}return t};de.parentCollection=(s,e)=>{let t=de.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],i=t?.[n];if(i&&\"items\"in i)return i;throw new Error(\"Parent collection not found\")};function nn(s,e,t){let n=t(e,s);if(typeof n==\"symbol\")return n;for(let i of[\"key\",\"value\"]){let r=e[i];if(r&&\"items\"in r){for(let o=0;o<r.items.length;++o){let l=nn(Object.freeze(s.concat([[i,o]])),r.items[o],t);if(typeof l==\"number\")o=l-1;else{if(l===ls)return ls;l===sn&&(r.items.splice(o,1),o-=1)}}typeof n==\"function\"&&i===\"key\"&&(n=n(e,s))}}return typeof n==\"function\"?n(e,s):n}var ze=\"\\uFEFF\",Ze=\"\u0002\",et=\"\u0018\",Me=\"\u001f\",Fn=s=>!!s&&\"items\"in s,xn=s=>!!s&&(s.type===\"scalar\"||s.type===\"single-quoted-scalar\"||s.type===\"double-quoted-scalar\"||s.type===\"block-scalar\");function Un(s){switch(s){case ze:return\"<BOM>\";case Ze:return\"<DOC>\";case et:return\"<FLOW_END>\";case Me:return\"<SCALAR>\";default:return JSON.stringify(s)}}function as(s){switch(s){case ze:return\"byte-order-mark\";case Ze:return\"doc-mode\";case et:return\"flow-error-end\";case Me:return\"scalar\";case\"---\":return\"doc-start\";case\"...\":return\"doc-end\";case\"\":case`\n`:case`\\r\n`:return\"newline\";case\"-\":return\"seq-item-ind\";case\"?\":return\"explicit-key-ind\";case\":\":return\"map-value-ind\";case\"{\":return\"flow-map-start\";case\"}\":return\"flow-map-end\";case\"[\":return\"flow-seq-start\";case\"]\":return\"flow-seq-end\";case\",\":return\"comma\"}switch(s[0]){case\" \":case\"\t\":return\"space\";case\"#\":return\"comment\";case\"%\":return\"directive-line\";case\"*\":return\"alias\";case\"&\":return\"anchor\";case\"!\":return\"tag\";case\"'\":return\"single-quoted-scalar\";case'\"':return\"double-quoted-scalar\";case\"|\":case\">\":return\"block-scalar-header\"}return null}function X(s){switch(s){case void 0:case\" \":case`\n`:case\"\\r\":case\"\t\":return!0;default:return!1}}var rn=new Set(\"0123456789ABCDEFabcdef\"),Vn=new Set(\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()\"),Dt=new Set(\",[]{}\"),Jn=new Set(` ,[]{}\n\\r\t`),fs=s=>!s||Jn.has(s),Be=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=\"\",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=\"string\")throw TypeError(\"source is not a string\");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??\"stream\";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===\" \"||t===\"\t\";)t=this.buffer[++e];return!t||t===\"#\"||t===`\n`?!0:t===\"\\r\"?this.buffer[e+1]===`\n`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===\" \";)t=this.buffer[++n+e];if(t===\"\\r\"){let i=this.buffer[n+e+1];if(i===`\n`||!i&&!this.atEnd)return e+n+1}return t===`\n`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===\"-\"||t===\".\"){let n=this.buffer.substr(e,3);if((n===\"---\"||n===\"...\")&&X(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=\"number\"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`\n`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===\"\\r\"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case\"stream\":return yield*this.parseStream();case\"line-start\":return yield*this.parseLineStart();case\"block-start\":return yield*this.parseBlockStart();case\"doc\":return yield*this.parseDocument();case\"flow\":return yield*this.parseFlowCollection();case\"quoted-scalar\":return yield*this.parseQuotedScalar();case\"block-scalar\":return yield*this.parseBlockScalar();case\"plain-scalar\":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(\"stream\");if(e[0]===ze&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===\"%\"){let t=e.length,n=e.indexOf(\"#\");for(;n!==-1;){let r=e[n-1];if(r===\" \"||r===\"\t\"){t=n-1;break}else n=e.indexOf(\"#\",n+1)}for(;;){let r=e[t-1];if(r===\" \"||r===\"\t\")t-=1;else break}let i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),\"stream\"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),\"stream\"}return yield Ze,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(\"line-start\");if(e===\"-\"||e===\".\"){if(!this.atEnd&&!this.hasChars(4))return this.setNext(\"line-start\");let t=this.peek(3);if((t===\"---\"||t===\"...\")&&X(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t===\"---\"?\"doc\":\"stream\"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!X(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(\"block-start\");if((e===\"-\"||e===\"?\"||e===\":\")&&X(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,\"block-start\"}return\"doc\"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(\"doc\");let t=yield*this.pushIndicators();switch(e[t]){case\"#\":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case\"{\":case\"[\":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,\"flow\";case\"}\":case\"]\":return yield*this.pushCount(1),\"doc\";case\"*\":return yield*this.pushUntil(fs),\"doc\";case'\"':case\"'\":return yield*this.parseQuotedScalar();case\"|\":case\">\":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let i=this.getLine();if(i===null)return this.setNext(\"flow\");if((n!==-1&&n<this.indentNext&&i[0]!==\"#\"||n===0&&(i.startsWith(\"---\")||i.startsWith(\"...\"))&&X(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]===\"]\"||i[0]===\"}\")))return this.flowLevel=0,yield et,yield*this.parseLineStart();let r=0;for(;i[r]===\",\";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return\"flow\";case\"#\":return yield*this.pushCount(i.length-r),\"flow\";case\"{\":case\"[\":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,\"flow\";case\"}\":case\"]\":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?\"flow\":\"doc\";case\"*\":return yield*this.pushUntil(fs),\"flow\";case'\"':case\"'\":return this.flowKey=!0,yield*this.parseQuotedScalar();case\":\":{let o=this.charAt(1);if(this.flowKey||X(o)||o===\",\")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),\"flow\"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===\"'\")for(;t!==-1&&this.buffer[t+1]===\"'\";)t=this.buffer.indexOf(\"'\",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]===\"\\\\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('\"',t+1)}let n=this.buffer.substring(0,t),i=n.indexOf(`\n`,this.pos);if(i!==-1){for(;i!==-1;){let r=this.continueScalar(i+1);if(r===-1)break;i=n.indexOf(`\n`,r)}i!==-1&&(t=i-(n[i-1]===\"\\r\"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(\"quoted-scalar\");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?\"flow\":\"doc\"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===\"+\")this.blockScalarKeep=!0;else if(t>\"0\"&&t<=\"9\")this.blockScalarIndent=Number(t)-1;else if(t!==\"-\")break}return yield*this.pushUntil(t=>X(t)||t===\"#\")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case\" \":t+=1;break;case`\n`:e=r,t=0;break;case\"\\r\":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext(\"block-scalar\");if(o===`\n`)break}default:break e}if(!n&&!this.atEnd)return this.setNext(\"block-scalar\");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(`\n`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(\"block-scalar\");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===\" \";)n=this.buffer[++i];if(n===\"\t\"){for(;n===\"\t\"||n===\" \"||n===\"\\r\"||n===`\n`;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o===\"\\r\"&&(o=this.buffer[--r]);let l=r;for(;o===\" \";)o=this.buffer[--r];if(o===`\n`&&r>=this.pos&&r+1+t>l)e=r;else break}while(!0);return yield Me,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===\":\"){let r=this.buffer[n+1];if(X(r)||e&&Dt.has(r))break;t=n}else if(X(i)){let r=this.buffer[n+1];if(i===\"\\r\"&&(r===`\n`?(n+=1,i=`\n`,r=this.buffer[n+1]):t=n),r===\"#\"||e&&Dt.has(r))break;if(i===`\n`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&Dt.has(i))break;t=n}return!i&&!this.atEnd?this.setNext(\"plain-scalar\"):(yield Me,yield*this.pushToIndex(t+1,!0),e?\"flow\":\"doc\")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield\"\"),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case\"!\":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case\"&\":e+=yield*this.pushUntil(fs),e+=yield*this.pushSpaces(!0);continue e;case\"-\":case\"?\":case\":\":{let t=this.flowLevel>0,n=this.charAt(1);if(X(n)||t&&Dt.has(n)){t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)===\"<\"){let e=this.pos+2,t=this.buffer[e];for(;!X(t)&&t!==\">\";)t=this.buffer[++e];return yield*this.pushToIndex(t===\">\"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Vn.has(t))t=this.buffer[++e];else if(t===\"%\"&&rn.has(this.buffer[e+1])&&rn.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`\n`?yield*this.pushCount(1):e===\"\\r\"&&this.charAt(1)===`\n`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===\" \"||e&&n===\"\t\");let i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};var De=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}};function ge(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function on(s){for(let e=0;e<s.length;++e)switch(s[e].type){case\"space\":case\"comment\":case\"newline\":break;default:return e}return-1}function an(s){switch(s?.type){case\"alias\":case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":case\"flow-collection\":return!0;default:return!1}}function Kt(s){switch(s.type){case\"document\":return s.start;case\"block-map\":{let e=s.items[s.items.length-1];return e.sep??e.start}case\"block-seq\":return s.items[s.items.length-1].start;default:return[]}}function Ke(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case\"doc-start\":case\"explicit-key-ind\":case\"map-value-ind\":case\"seq-item-ind\":case\"newline\":break e}for(;s[++e]?.type===\"space\";);return s.splice(e,s.length)}function jt(s,e){if(e.length<1e5)Array.prototype.push.apply(s,e);else for(let t=0;t<e.length;++t)s.push(e[t])}function ln(s){if(s.start.type===\"flow-seq-start\")for(let e of s.items)e.sep&&!e.value&&!ge(e.start,\"explicit-key-ind\")&&!ge(e.sep,\"map-value-ind\")&&(e.key&&(e.value=e.key),delete e.key,an(e.value)?e.value.end?jt(e.value.end,e.sep):e.value.end=e.sep:jt(e.start,e.sep),delete e.sep)}var we=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=\"\",this.type=\"\",this.lexer=new Be,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=as(e);if(t)if(t===\"scalar\")this.atNewLine=!1,this.atScalar=!0,this.type=\"scalar\";else{switch(this.type=t,yield*this.step(),t){case\"newline\":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case\"space\":this.atNewLine&&e[0]===\" \"&&(this.indent+=e.length);break;case\"explicit-key-ind\":case\"map-value-ind\":case\"seq-item-ind\":this.atNewLine&&(this.indent+=e.length);break;case\"doc-mode\":case\"flow-error-end\":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:\"error\",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===\"doc-end\"&&e?.type!==\"doc-end\"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:\"doc-end\",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case\"document\":return yield*this.document(e);case\"alias\":case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":return yield*this.scalar(e);case\"block-scalar\":return yield*this.blockScalar(e);case\"block-map\":return yield*this.blockMap(e);case\"block-seq\":return yield*this.blockSequence(e);case\"flow-collection\":return yield*this.flowCollection(e);case\"doc-end\":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:\"error\",offset:this.offset,source:\"\",message:\"Tried to pop an empty stack\"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type===\"block-scalar\"?t.indent=\"indent\"in n?n.indent:0:t.type===\"flow-collection\"&&n.type===\"document\"&&(t.indent=0),t.type===\"flow-collection\"&&ln(t),n.type){case\"document\":n.value=t;break;case\"block-scalar\":n.props.push(t);break;case\"block-map\":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case\"block-seq\":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case\"flow-collection\":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type===\"document\"||n.type===\"block-map\"||n.type===\"block-seq\")&&(t.type===\"block-map\"||t.type===\"block-seq\")){let i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&on(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!==\"comment\"||r.indent<t.indent))&&(n.type===\"document\"?n.end=i.start:n.items.push({start:i.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case\"directive-line\":yield{type:\"directive\",offset:this.offset,source:this.source};return;case\"byte-order-mark\":case\"space\":case\"comment\":case\"newline\":yield this.sourceToken;return;case\"doc-mode\":case\"doc-start\":{let e={type:\"document\",offset:this.offset,start:[]};this.type===\"doc-start\"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:\"error\",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case\"doc-start\":{on(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case\"anchor\":case\"tag\":case\"space\":case\"comment\":case\"newline\":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:\"error\",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===\"map-value-ind\"){let t=Kt(this.peek(2)),n=Ke(t),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let r={type:\"block-map\",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case\"space\":case\"comment\":case\"newline\":e.props.push(this.sourceToken);return;case\"scalar\":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`\n`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`\n`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case\"newline\":if(this.onKeyLine=!1,t.value){let n=\"end\"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===\"comment\"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case\"space\":case\"comment\":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){jt(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(t.sep||t.explicitKey)&&this.type!==\"seq-item-ind\",r=[];if(i&&t.sep&&!t.value){let o=[];for(let l=0;l<t.sep.length;++l){let a=t.sep[l];switch(a.type){case\"newline\":o.push(l);break;case\"space\":break;case\"comment\":a.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case\"anchor\":case\"tag\":i||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case\"explicit-key-ind\":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):i||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case\"map-value-ind\":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ge(t.sep,\"map-value-ind\"))this.stack.push({type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(an(t.key)&&!ge(t.sep,\"newline\")){let o=Ke(t.start),l=t.key,a=t.sep;a.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:o,key:l,sep:a}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(ge(t.start,\"newline\"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Ke(t.start);this.stack.push({type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):ge(t.sep,\"map-value-ind\")?this.stack.push({type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case\"alias\":case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":{let o=this.flowScalar(this.type);i||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type===\"block-seq\"){if(!t.explicitKey&&t.sep&&!ge(t.sep,\"newline\")){yield*this.pop({type:\"error\",offset:this.offset,message:\"Unexpected block-seq-ind on same line with key\",source:this.source});return}}else n&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case\"newline\":if(t.value){let n=\"end\"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===\"comment\"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case\"space\":case\"comment\":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){jt(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case\"anchor\":case\"tag\":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case\"seq-item-ind\":if(this.indent!==e.indent)break;t.value||ge(t.start,\"seq-item-ind\")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===\"flow-error-end\"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type===\"flow-collection\")}else if(e.end.length===0){switch(this.type){case\"comma\":case\"explicit-key-ind\":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case\"map-value-ind\":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case\"space\":case\"comment\":case\"newline\":case\"anchor\":case\"tag\":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case\"alias\":case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":{let i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case\"flow-map-end\":case\"flow-seq-end\":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type===\"block-map\"&&(this.type===\"map-value-ind\"&&n.indent===e.indent||this.type===\"newline\"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===\"map-value-ind\"&&n.type!==\"flow-collection\"){let i=Kt(n),r=Ke(i);ln(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let l={type:\"block-map\",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`\n`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`\n`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case\"alias\":case\"scalar\":case\"single-quoted-scalar\":case\"double-quoted-scalar\":return this.flowScalar(this.type);case\"block-scalar-header\":return{type:\"block-scalar\",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:\"\"};case\"flow-map-start\":case\"flow-seq-start\":return{type:\"flow-collection\",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case\"seq-item-ind\":return{type:\"block-seq\",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case\"explicit-key-ind\":{this.onKeyLine=!0;let t=Kt(e),n=Ke(t);return n.push(this.sourceToken),{type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case\"map-value-ind\":{this.onKeyLine=!0;let t=Kt(e),n=Ke(t);return{type:\"block-map\",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==\"comment\"||this.indent<=t?!1:e.every(n=>n.type===\"newline\"||n.type===\"space\")}*documentEnd(e){this.type!==\"doc-mode\"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===\"newline\"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case\"comma\":case\"doc-start\":case\"doc-end\":case\"flow-seq-end\":case\"flow-map-end\":case\"map-value-ind\":yield*this.pop(),yield*this.step();break;case\"newline\":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===\"newline\"&&(yield*this.pop())}}};function cn(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new De||null,prettyErrors:e}}function fn(s,e={}){let{lineCounter:t,prettyErrors:n}=cn(e),i=new we(t?.addNewLine),r=new be(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(let l of o)l.errors.forEach(We(s,t)),l.warnings.forEach(We(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function us(s,e={}){let{lineCounter:t,prettyErrors:n}=cn(e),i=new we(t?.addNewLine),r=new be(e),o=null;for(let l of r.compose(i.parse(s),!0,s.length))if(!o)o=l;else if(o.options.logLevel!==\"silent\"){o.errors.push(new R(l.range.slice(0,2),\"MULTIPLE_DOCS\",\"Source contains multiple documents; please use YAML.parseAllDocuments()\"));break}return n&&t&&(o.errors.forEach(We(s,t)),o.warnings.forEach(We(s,t))),o}function un(s,e,t){let n;typeof e==\"function\"?n=e:t===void 0&&e&&typeof e==\"object\"&&(t=e);let i=us(s,t);if(!i)return null;if(i.warnings.forEach(r=>ht(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!==\"silent\")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function hn(s,e,t){let n=null;if(typeof e==\"function\"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t==\"string\"&&(t=t.length),typeof t==\"number\"){let i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(s===void 0){let{keepUndefined:i}=t??e??{};if(!i)return}return x(s)&&!n?s.toString(t):new se(s,n,t).toString(t)}var Sc=hs;export{ee as Alias,cs as CST,be as Composer,se as Document,Be as Lexer,De as LineCounter,v as Pair,we as Parser,y as Scalar,ve as Schema,_e as YAMLError,$ as YAMLMap,R as YAMLParseError,B as YAMLSeq,Pe as YAMLWarning,Sc as default,F as isAlias,L as isCollection,x as isDocument,U as isMap,I as isNode,T as isPair,E as isScalar,V as isSeq,un as parse,fn as parseAllDocuments,us as parseDocument,hn as stringify,Q as visit,je as visitAsync};\n","node_modules/apps/chunk-WOT6VMZA.js":"var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:!0})};export{e as a};\n"}}