@mdlx/cli 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -0
- package/package.json +1 -1
- package/release/cli.js +2 -2
package/release/cli.js
CHANGED
|
@@ -389,7 +389,7 @@ ${U}`,I}},C=A.spanOptions&&"captureStackTrace"in A.spanOptions?A.spanOptions:{ca
|
|
|
389
389
|
at path: ${Tx(B)}`;if(Q!==void 0)D+=`
|
|
390
390
|
details: ${Q}`;if(I)D+=`
|
|
391
391
|
schema (${I._tag}): ${I}`;return D},kx=(A)=>b3("Invalid Argument",A),Ee=(A,Q,B)=>b3("Unsupported schema",A,Q,B);var vZA=(A,Q)=>Ee("Cannot build an Equivalence",Q,A);var Ce=(A,Q,B)=>b3("Unsupported schema or overlapping types",`cannot extend ${A} with ${Q}`,B),bZA=(A)=>b3("Unsupported template literal span",void 0,void 0,A),_F=(A)=>Ee(void 0,void 0,A),xZA=(A)=>b3("Unsupported key schema",void 0,void 0,A),hZA=(A)=>b3("Unsupported literal",`literal value: ${U1(A)}`),Je=(A)=>b3("Duplicate index signature",`${A} index signature`),mZA=b3("Unsupported index signature parameter","An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),fZA=b3("Invalid element","A required element cannot follow an optional element. ts(1257)"),Ge=(A)=>b3("Duplicate property signature transformation",`Duplicate key ${U1(A)}`),uZA=(A)=>Ee(void 0,void 0,A),jx=(A)=>b3("Duplicate property signature",`Duplicate key ${U1(A)}`);var dZA=Symbol.for("effect/annotation/TypeConstructor"),Xe=Symbol.for("effect/annotation/Brand"),pZA=Symbol.for("effect/annotation/SchemaId"),Ze=Symbol.for("effect/annotation/Message"),yx=Symbol.for("effect/annotation/MissingMessage"),iS=Symbol.for("effect/annotation/Identifier"),S1=Symbol.for("effect/annotation/Title"),I5=Symbol.for("effect/annotation/AutoTitle"),jF=Symbol.for("effect/annotation/Description"),Ke=Symbol.for("effect/annotation/Examples"),Ue=Symbol.for("effect/annotation/Default"),$e=Symbol.for("effect/annotation/JSONSchema"),Ye=Symbol.for("effect/annotation/Arbitrary"),We=Symbol.for("effect/annotation/Pretty"),gx=Symbol.for("effect/annotation/Equivalence"),oZA=Symbol.for("effect/annotation/Documentation"),ze=Symbol.for("effect/annotation/Concurrency"),qe=Symbol.for("effect/annotation/Batching"),Oe=Symbol.for("effect/annotation/ParseIssueTitle"),Ve=Symbol.for("effect/annotation/ParseOptions"),we=Symbol.for("effect/annotation/DecodingFallback"),rS=Symbol.for("effect/annotation/Surrogate"),sS=Symbol.for("effect/annotation/StableFilter"),j2=y(2,(A,Q)=>Object.prototype.hasOwnProperty.call(A.annotations,Q)?oA(A.annotations[Q]):pA());var Ne=j2(Xe);var nZA=j2(Ze),iZA=j2(yx),Re=j2(S1),Le=j2(I5),tS=j2(iS),Me=j2(jF);var rZA=j2(ze),sZA=j2(qe),tZA=j2(Oe),aZA=j2(Ve),eZA=j2(we),D5=j2(rS),VdA=j2(sS),Pe=(A)=>E8A(VdA(A),(Q)=>Q===!0),vx=Symbol.for("effect/annotation/JSONIdentifier"),wdA=j2(vx),NdA=(A)=>a4(wdA(A),()=>tS(A)),AKA=Symbol.for("effect/schema/ParseJson");class ez{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag="Declaration";constructor(A,Q,B,I={}){this.typeParameters=A,this.decodeUnknown=Q,this.encodeUnknown=B,this.annotations=I}toString(){return eI($J(this),()=>"<declaration schema>")}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map((A)=>A.toJSON()),annotations:dE(this.annotations)}}}var $4=(A)=>(Q)=>Q._tag===A;class HG{literal;annotations;_tag="Literal";constructor(A,Q={}){this.literal=A,this.annotations=Q}toString(){return eI($J(this),()=>U1(this.literal))}toJSON(){return{_tag:this._tag,literal:ZH(this.literal)?String(this.literal):this.literal,annotations:dE(this.annotations)}}}var XG=$4("Literal"),QKA=new HG(null);class Aq{symbol;annotations;_tag="UniqueSymbol";constructor(A,Q={}){this.symbol=A,this.annotations=Q}toString(){return eI($J(this),()=>U1(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:dE(this.annotations)}}}var RdA=$4("UniqueSymbol");class BKA{annotations;_tag="UndefinedKeyword";constructor(A={}){this.annotations=A}toString(){return f3(this)}toJSON(){return{_tag:this._tag,annotations:dE(this.annotations)}}}var wU=new BKA({[S1]:"undefined"});class IKA{annotations;_tag="VoidKeyword";constructor(A={}){this.annotations=A}toString(){return f3(this)}toJSON(){return{_tag:this._tag,annotations:dE(this.annotations)}}}var DKA=new IKA({[S1]:"void"});class EKA{annotations;_tag="NeverKeyword";constructor(A={}){this.annotations=A}toString(){return f3(this)}toJSON(){return{_tag:this._tag,annotations:dE(this.annotations)}}}var aS=new EKA({[S1]:"never"}),LdA=$4("NeverKeyword");class CKA{annotations;_tag="UnknownKeyword";constructor(A={}){this.annotations=A}toString(){return f3(this)}toJSON(){return{_tag:this._tag,annotations:dE(this.annotations)}}}var Se=new CKA({[S1]:"unknown"});class JKA{annotations;_tag="AnyKeyword";constructor(A={}){this.annotations=A}toString(){return f3(this)}toJSON(){return{_tag:this._tag,annotations:dE(this.annotations)}}}var Te=new JKA({[S1]:"any"});class GKA{annotations;_tag="StringKeyword";constructor(A={}){this.annotations=A}toString(){return f3(this)}toJSON(){return{_tag:this._tag,annotations:dE(this.annotations)}}}var bx=new GKA({[S1]:"string",[jF]:"a string"}),eS=$4("StringKeyword");class FKA{annotations;_tag="NumberKeyword";constructor(A={}){this.annotations=A}toString(){return f3(this)}toJSON(){return{_tag:this._tag,annotations:dE(this.annotations)}}}var xx=new FKA({[S1]:"number",[jF]:"a number"}),_e=$4("NumberKeyword");class HKA{annotations;_tag="BooleanKeyword";constructor(A={}){this.annotations=A}toString(){return f3(this)}toJSON(){return{_tag:this._tag,annotations:dE(this.annotations)}}}var hx=new HKA({[S1]:"boolean",[jF]:"a boolean"}),ke=$4("BooleanKeyword");class XKA{annotations;_tag="BigIntKeyword";constructor(A={}){this.annotations=A}toString(){return f3(this)}toJSON(){return{_tag:this._tag,annotations:dE(this.annotations)}}}var ZKA=new XKA({[S1]:"bigint",[jF]:"a bigint"});class KKA{annotations;_tag="SymbolKeyword";constructor(A={}){this.annotations=A}toString(){return f3(this)}toJSON(){return{_tag:this._tag,annotations:dE(this.annotations)}}}var UKA=new KKA({[S1]:"symbol",[jF]:"a symbol"}),mx=$4("SymbolKeyword");class $KA{annotations;_tag="ObjectKeyword";constructor(A={}){this.annotations=A}toString(){return f3(this)}toJSON(){return{_tag:this._tag,annotations:dE(this.annotations)}}}var YKA=new $KA({[S1]:"object",[jF]:"an object in the TypeScript meaning, i.e. the `object` type"});class je{enums;annotations;_tag="Enums";constructor(A,Q={}){this.enums=A,this.annotations=Q}toString(){return eI($J(this),()=>`<enum ${this.enums.length} value(s): ${this.enums.map(([A,Q])=>JSON.stringify(Q)).join(" | ")}>`)}toJSON(){return{_tag:this._tag,enums:this.enums,annotations:dE(this.annotations)}}}var MdA=$4("Enums"),WKA=(A)=>{switch(A._tag){case"Literal":case"NumberKeyword":case"StringKeyword":case"TemplateLiteral":return!0;case"Union":return A.types.every(WKA)}return!1},zKA=(A)=>{switch(A._tag){case"Literal":return JSON.stringify(String(A.literal));case"StringKeyword":return"string";case"NumberKeyword":return"number";case"TemplateLiteral":return String(A);case"Union":return A.types.map(zKA).join(" | ")}},PdA=(A)=>{switch(A._tag){case"Literal":return String(A.literal);case"StringKeyword":return"${string}";case"NumberKeyword":return"${number}";case"TemplateLiteral":return"${"+String(A)+"}";case"Union":return"${"+A.types.map(zKA).join(" | ")+"}"}};class NU{literal;type;constructor(A,Q){if(this.literal=Q,WKA(A))this.type=A;else throw Error(bZA(A))}toString(){return PdA(this.type)+this.literal}toJSON(){return{type:this.type.toJSON(),literal:this.literal}}}class fx{head;spans;annotations;_tag="TemplateLiteral";constructor(A,Q,B={}){this.head=A,this.spans=Q,this.annotations=B}toString(){return eI($J(this),()=>SdA(this))}toJSON(){return{_tag:this._tag,head:this.head,spans:this.spans.map((A)=>A.toJSON()),annotations:dE(this.annotations)}}}var SdA=(A)=>"`"+A.head+A.spans.map(String).join("")+"`",qKA=$4("TemplateLiteral");class RU{type;annotations;constructor(A,Q={}){this.type=A,this.annotations=Q}toJSON(){return{type:this.type.toJSON(),annotations:dE(this.annotations)}}toString(){return String(this.type)}}class T1 extends RU{isOptional;constructor(A,Q,B={}){super(A,B);this.isOptional=Q}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:dE(this.annotations)}}toString(){return String(this.type)+(this.isOptional?"?":"")}}var ux=(A)=>A.map((Q)=>Q.type);class E5{elements;rest;isReadonly;annotations;_tag="TupleType";constructor(A,Q,B,I={}){this.elements=A,this.rest=Q,this.isReadonly=B,this.annotations=I;let D=!1,C=!1;for(let G of A)if(G.isOptional)D=!0;else if(D){C=!0;break}if(C||D&&Q.length>1)throw Error(fZA)}toString(){return eI($J(this),()=>TdA(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map((A)=>A.toJSON()),rest:this.rest.map((A)=>A.toJSON()),isReadonly:this.isReadonly,annotations:dE(this.annotations)}}}var TdA=(A)=>{let Q=A.elements.map(String).join(", ");return G8A(A.rest,{onEmpty:()=>`readonly [${Q}]`,onNonEmpty:(B,I)=>{let D=String(B),C=D.includes(" | ")?`(${D})`:D;if(I.length>0){let G=I.map(String).join(", ");if(A.elements.length>0)return`readonly [${Q}, ...${C}[], ${G}]`;else return`readonly [...${C}[], ${G}]`}else if(A.elements.length>0)return`readonly [${Q}, ...${C}[]]`;else return`ReadonlyArray<${D}>`}})};class JE extends T1{name;isReadonly;constructor(A,Q,B,I,D){super(Q,B,D);this.name=A,this.isReadonly=I}toString(){return(this.isReadonly?"readonly ":"")+String(this.name)+(this.isOptional?"?":"")+": "+this.type}toJSON(){return{name:String(this.name),type:this.type.toJSON(),isOptional:this.isOptional,isReadonly:this.isReadonly,annotations:dE(this.annotations)}}}var OKA=(A)=>{switch(A._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return!0;case"Refinement":return OKA(A.from)}return!1};class C5{type;isReadonly;parameter;constructor(A,Q,B){if(this.type=Q,this.isReadonly=B,OKA(A))this.parameter=A;else throw Error(mZA)}toString(){return(this.isReadonly?"readonly ":"")+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}}class H2{annotations;_tag="TypeLiteral";propertySignatures;indexSignatures;constructor(A,Q,B={}){this.annotations=B;let I={};for(let C=0;C<A.length;C++){let G=A[C].name;if(Object.prototype.hasOwnProperty.call(I,G))throw Error(jx(G));I[G]=null}let D={string:!1,symbol:!1};for(let C=0;C<Q.length;C++){let G=kF(Q[C].parameter);if(eS(G)){if(D.string)throw Error(Je("string"));D.string=!0}else if(mx(G)){if(D.symbol)throw Error(Je("symbol"));D.symbol=!0}}this.propertySignatures=A,this.indexSignatures=Q}toString(){return eI($J(this),()=>_dA(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map((A)=>A.toJSON()),indexSignatures:this.indexSignatures.map((A)=>A.toJSON()),annotations:dE(this.annotations)}}}var lZA=(A)=>A.map(String).join("; "),_dA=(A)=>{if(A.propertySignatures.length>0){let Q=A.propertySignatures.map(String).join("; ");if(A.indexSignatures.length>0)return`{ ${Q}; ${lZA(A.indexSignatures)} }`;else return`{ ${Q} }`}else if(A.indexSignatures.length>0)return`{ ${lZA(A.indexSignatures)} }`;else return"{}"},ye=$4("TypeLiteral"),kdA=n2(dW(G2,(A)=>{switch(A._tag){case"AnyKeyword":return 0;case"UnknownKeyword":return 1;case"ObjectKeyword":return 2;case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":return 3}return 4})),jdA={string:"StringKeyword",number:"NumberKeyword",boolean:"BooleanKeyword",bigint:"BigIntKeyword"},VKA=(A)=>UK(A,(Q)=>AT(Q)?VKA(Q.types):[Q]),ydA=(A)=>{let Q=kdA(A),B=[],I={},D=[];for(let C of Q)switch(C._tag){case"NeverKeyword":break;case"AnyKeyword":return[Te];case"UnknownKeyword":return[Se];case"ObjectKeyword":case"UndefinedKeyword":case"VoidKeyword":case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":{if(!I[C._tag])I[C._tag]=C,B.push(C);break}case"Literal":{let G=typeof C.literal;switch(G){case"string":case"number":case"bigint":case"boolean":{let H=jdA[G];if(!I[H]&&!D.includes(C.literal))D.push(C.literal),B.push(C);break}case"object":{if(!D.includes(C.literal))D.push(C.literal),B.push(C);break}}break}case"UniqueSymbol":{if(!I.SymbolKeyword&&!D.includes(C.symbol))D.push(C.symbol),B.push(C);break}case"TupleType":{if(!I.ObjectKeyword)B.push(C);break}case"TypeLiteral":{if(C.propertySignatures.length===0&&C.indexSignatures.length===0){if(!I["{}"])I["{}"]=C,B.push(C)}else if(!I.ObjectKeyword)B.push(C);break}default:B.push(C)}return B};class qE{types;annotations;static make=(A,Q)=>{return cx(A)?new qE(A,Q):A.length===1?A[0]:aS};static unify=(A,Q)=>{return qE.make(ydA(VKA(A)),Q)};_tag="Union";constructor(A,Q={}){this.types=A,this.annotations=Q}toString(){return eI($J(this),()=>this.types.map(String).join(" | "))}toJSON(){return{_tag:this._tag,types:this.types.map((A)=>A.toJSON()),annotations:dE(this.annotations)}}}var wKA=(A,Q)=>A.map(Q),cx=(A)=>A.length>1,AT=$4("Union"),Fe=$B(Symbol.for("effect/Schema/AST/toJSONMemoMap"),()=>new WeakMap);class m3{f;annotations;_tag="Suspend";constructor(A,Q={}){this.f=A,this.annotations=Q,this.f=sz(A)}toString(){return $J(this).pipe(a4(()=>R8(iW(this.f)(),(A)=>$J(A))),eI(()=>"<suspended schema>"))}toJSON(){let A=this.f(),Q=Fe.get(A);if(Q)return Q;return Fe.set(A,{_tag:this._tag}),Q={_tag:this._tag,ast:A.toJSON(),annotations:dE(this.annotations)},Fe.set(A,Q),Q}}class J5{from;filter;annotations;_tag="Refinement";constructor(A,Q,B={}){this.from=A,this.filter=Q,this.annotations=B}toString(){return tS(this).pipe(eI(()=>gI(yKA(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:(A)=>G5(this.from)?String(this.from)+" & "+A:A})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:dE(this.annotations)}}}var G5=$4("Refinement"),lx={};class k2{from;to;transformation;annotations;_tag="Transformation";constructor(A,Q,B,I={}){this.from=A,this.to=Q,this.transformation=B,this.annotations=I}toString(){return eI($J(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:dE(this.annotations)}}}var NKA=$4("Transformation");class dx{decode;encode;_tag="FinalTransformation";constructor(A,Q){this.decode=A,this.encode=Q}}var gdA=(A)=>(Q)=>Q._tag===A;class RKA{_tag="ComposeTransformation"}var px=new RKA;class QT{from;to;decode;encode;constructor(A,Q,B,I){this.from=A,this.to=Q,this.decode=B,this.encode=I}}var LKA=(A)=>A.decode===rQ&&A.encode===rQ;class F5{propertySignatureTransformations;_tag="TypeLiteralTransformation";constructor(A){this.propertySignatureTransformations=A;let Q={},B={};for(let I of A){let D=I.from;if(Q[D])throw Error(Ge(D));Q[D]=!0;let C=I.to;if(B[C])throw Error(Ge(C));B[C]=!0}}}var BT=gdA("TypeLiteralTransformation"),IT=(A,Q)=>{let B=Object.getOwnPropertyDescriptors(A),I={...A.annotations};delete I[iS];let D={...I,...Q},C=D5(A);if(YI(C))D[rS]=IT(C.value,Q);return B.annotations.value=D,Object.create(Object.getPrototypeOf(A),B)},MKA=(A)=>qE.unify(tz(A)),vdA="[\\s\\S]*?",bdA="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",PKA=(A,Q)=>{switch(A._tag){case"Literal":return Rz(String(A.literal));case"StringKeyword":return vdA;case"NumberKeyword":return bdA;case"TemplateLiteral":return ge(A,Q,!1);case"Union":return A.types.map((B)=>PKA(B,Q)).join("|")}},xdA=(A,Q,B,I)=>{if(AT(A)){if(B&&!I)return`(?:${Q})`}else if(!B||!I)return Q;return`(${Q})`},ge=(A,Q,B)=>{let I="";if(A.head!==""){let D=Rz(A.head);I+=Q&&B?`(${D})`:D}for(let D of A.spans){let C=PKA(D.type,Q);if(I+=xdA(D.type,C,Q,B),D.literal!==""){let G=Rz(D.literal);I+=Q&&B?`(${G})`:G}}return I},ve=(A)=>new RegExp(`^${ge(A,!1,!0)}$`),SKA=(A)=>new RegExp(`^${ge(A,!0,!0)}$`);var dS=(A)=>{let Q=D5(A);if(YI(Q))return dS(Q.value);switch(A._tag){case"TypeLiteral":return A.indexSignatures.slice();case"Suspend":return dS(A.f());case"Refinement":return dS(A.from);case"Transformation":return dS(A.to)}return[]},pS=(A)=>{switch(A._tag){case"TupleType":{let Q=!1,B=[];for(let I of A.elements){if(I.isOptional)Q=!0;B.push(I.type)}if(Q)B.push(wU);return B=B.concat(ux(A.rest)),qE.make(B)}case"Refinement":return pS(A.from);case"Union":return qE.make(A.types.map(pS));case"Suspend":return pS(A.f())}throw Error(_F(A))},TKA=(A,Q)=>{let B=Nn(A.propertySignatures,(I)=>I.name===Q);if(YI(B))return B.value;if(cE(Q)){let I=void 0;for(let D of A.indexSignatures){let C=kF(D.parameter);switch(C._tag){case"TemplateLiteral":{if(ve(C).test(Q))return new JE(Q,D.type,!1,!0);break}case"StringKeyword":if(I===void 0)I=new JE(Q,D.type,!1,!0)}}if(I)return I}else if(c9(Q))for(let I of A.indexSignatures){let D=kF(I.parameter);if(mx(D))return new JE(Q,I.type,!1,!0)}},B5=(A,Q)=>{let B=D5(A);if(YI(B))return B5(B.value,Q);switch(A._tag){case"TypeLiteral":{let I=TKA(A,Q);if(I)return I;break}case"Union":return new JE(Q,qE.make(A.types.map((I)=>B5(I,Q).type)),!1,!0);case"Suspend":return B5(A.f(),Q);case"Refinement":return B5(A.from,Q);case"Transformation":return B5(A.to,Q)}throw Error(_F(A))},qU=(A)=>{let Q=D5(A);if(YI(Q))return qU(Q.value);switch(A._tag){case"TypeLiteral":return A.propertySignatures.map((B)=>B.name);case"Union":return A.types.slice(1).reduce((B,I)=>Pn(B,qU(I)),qU(A.types[0]));case"Suspend":return qU(A.f());case"Refinement":return qU(A.from);case"Transformation":return qU(A.to)}return[]},be=(A,Q)=>{let B=[],I=[],D=(C)=>{switch(C._tag){case"NeverKeyword":break;case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":case"Refinement":I.push(new C5(C,Q,!0));break;case"Literal":if(cE(C.literal)||z8(C.literal))B.push(new JE(C.literal,Q,!1,!0));else throw Error(hZA(C.literal));break;case"Enums":{for(let[G,H]of C.enums)B.push(new JE(H,Q,!1,!0));break}case"UniqueSymbol":B.push(new JE(C.symbol,Q,!1,!0));break;case"Union":C.types.forEach(D);break;default:throw Error(xZA(C))}};return D(A),{propertySignatures:B,indexSignatures:I}},h3=(A,Q)=>{let B=D5(A);if(YI(B))return h3(B.value,Q);switch(A._tag){case"TypeLiteral":{let I=[],D={};for(let C of A.propertySignatures)if(D[C.name]=null,Q.includes(C.name))I.push(C);for(let C of Q)if(!(C in D)){let G=TKA(A,C);if(G)I.push(G)}return new H2(I,[])}case"Union":return new H2(Q.map((I)=>B5(A,I)),[]);case"Suspend":return h3(A.f(),Q);case"Refinement":return h3(A.from,Q);case"Transformation":switch(A.transformation._tag){case"ComposeTransformation":return new k2(h3(A.from,Q),h3(A.to,Q),px);case"TypeLiteralTransformation":{let I=[],D=[];for(let C of Q){let G=A.transformation.propertySignatureTransformations.find((H)=>H.to===C);if(G)I.push(G),D.push(G.from);else D.push(C)}return LD(I)?new k2(h3(A.from,D),h3(A.to,Q),new F5(I)):h3(A.from,D)}}}throw Error(_F(A))},_KA=(A,Q)=>{let B=dS(A);if(B.length>0){if(B.some((I)=>eS(kF(I.parameter))))B=B.filter((I)=>!qKA(kF(I.parameter)));return new H2([],B)}return h3(A,qU(A).filter((I)=>!Q.includes(I)))},oS=(A)=>qE.make([A,wU]),VU=(A,Q)=>{let B=Q?.exact===!0;switch(A._tag){case"TupleType":return new E5(A.elements.map((I)=>new T1(B?I.type:oS(I.type),!0)),zn(A.rest,{onEmpty:()=>A.rest,onNonEmpty:(I)=>[new RU(qE.make([...ux(I),wU]))]}),A.isReadonly);case"TypeLiteral":return new H2(A.propertySignatures.map((I)=>new JE(I.name,B?I.type:oS(I.type),!0,I.isReadonly,I.annotations)),A.indexSignatures.map((I)=>new C5(I.parameter,oS(I.type),I.isReadonly)));case"Union":return qE.make(A.types.map((I)=>VU(I,Q)));case"Suspend":return new m3(()=>VU(A.f(),Q));case"Declaration":case"Refinement":throw Error(_F(A));case"Transformation":{if(BT(A.transformation)&&A.transformation.propertySignatureTransformations.every(LKA))return new k2(VU(A.from,Q),VU(A.to,Q),A.transformation);throw Error(_F(A))}}return A},az=(A)=>{switch(A._tag){case"TupleType":return new E5(A.elements.map((Q)=>new T1(Q.type,!1)),A.rest,A.isReadonly);case"TypeLiteral":return new H2(A.propertySignatures.map((Q)=>new JE(Q.name,Q.type,!1,Q.isReadonly,Q.annotations)),A.indexSignatures);case"Union":return qE.make(A.types.map((Q)=>az(Q)));case"Suspend":return new m3(()=>az(A.f()));case"Declaration":case"Refinement":throw Error(_F(A));case"Transformation":{if(BT(A.transformation)&&A.transformation.propertySignatureTransformations.every(LKA))return new k2(az(A.from),az(A.to),A.transformation);throw Error(_F(A))}}return A},OU=(A)=>{switch(A._tag){case"TupleType":return A.isReadonly===!1?A:new E5(A.elements,A.rest,!1,A.annotations);case"TypeLiteral":{let Q=k8(A.propertySignatures,(I)=>I.isReadonly===!1?I:new JE(I.name,I.type,I.isOptional,!1,I.annotations)),B=k8(A.indexSignatures,(I)=>I.isReadonly===!1?I:new C5(I.parameter,I.type,!1));return Q===A.propertySignatures&&B===A.indexSignatures?A:new H2(Q,B,A.annotations)}case"Union":{let Q=k8(A.types,OU);return Q===A.types?A:qE.make(Q,A.annotations)}case"Suspend":return new m3(()=>OU(A.f()),A.annotations);case"Refinement":{let Q=OU(A.from);return Q===A.from?A:new J5(Q,A.filter,A.annotations)}case"Transformation":{let Q=OU(A.from),B=OU(A.to);return Q===A.from&&B===A.to?A:new k2(Q,B,A.transformation,A.annotations)}}return A};var xe=(A)=>(Q)=>{let B=void 0;for(let I of A)if(Object.prototype.hasOwnProperty.call(Q.annotations,I)){if(B===void 0)B={};B[I]=Q.annotations[I]}return B},kKA=(A)=>(Q)=>{let B={...Q.annotations};for(let I of A)delete B[I];return B},hdA=xe([Ke,Ue,$e,Ye,We,gx]),xD=(A)=>{switch(A._tag){case"Declaration":{let Q=k8(A.typeParameters,xD);return Q===A.typeParameters?A:new ez(Q,A.decodeUnknown,A.encodeUnknown,A.annotations)}case"TupleType":{let Q=k8(A.elements,(D)=>{let C=xD(D.type);return C===D.type?D:new T1(C,D.isOptional)}),B=ux(A.rest),I=k8(B,xD);return Q===A.elements&&I===B?A:new E5(Q,I.map((D)=>new RU(D)),A.isReadonly,A.annotations)}case"TypeLiteral":{let Q=k8(A.propertySignatures,(I)=>{let D=xD(I.type);return D===I.type?I:new JE(I.name,D,I.isOptional,I.isReadonly)}),B=k8(A.indexSignatures,(I)=>{let D=xD(I.type);return D===I.type?I:new C5(I.parameter,D,I.isReadonly)});return Q===A.propertySignatures&&B===A.indexSignatures?A:new H2(Q,B,A.annotations)}case"Union":{let Q=k8(A.types,xD);return Q===A.types?A:qE.make(Q,A.annotations)}case"Suspend":return new m3(()=>xD(A.f()),A.annotations);case"Refinement":{let Q=xD(A.from);return Q===A.from?A:new J5(Q,A.filter,A.annotations)}case"Transformation":{let Q=hdA(A);return xD(Q!==void 0?IT(A.to,Q):A.to)}}return A};function k8(A,Q){let B=!1,I=KK(A.length);for(let D=0;D<A.length;D++){let C=A[D],G=Q(C);if(G!==C)B=!0;I[D]=G}return B?I:A}var He=(A)=>{switch(A._tag){case"Transformation":return A.from;case"Refinement":return He(A.from);case"Suspend":return He(A.f())}},x3=(A,Q)=>{switch(A._tag){case"Declaration":{let B=k8(A.typeParameters,(I)=>x3(I,Q));return B===A.typeParameters?A:new ez(B,A.decodeUnknown,A.encodeUnknown)}case"TupleType":{let B=k8(A.elements,(C)=>{let G=x3(C.type,Q);return G===C.type?C:new T1(G,C.isOptional)}),I=ux(A.rest),D=k8(I,(C)=>x3(C,Q));return B===A.elements&&D===I?A:new E5(B,D.map((C)=>new RU(C)),A.isReadonly)}case"TypeLiteral":{let B=k8(A.propertySignatures,(D)=>{let C=x3(D.type,Q);return C===D.type?D:new JE(D.name,C,D.isOptional,D.isReadonly)}),I=k8(A.indexSignatures,(D)=>{let C=x3(D.type,Q);return C===D.type?D:new C5(D.parameter,C,D.isReadonly)});return B===A.propertySignatures&&I===A.indexSignatures?A:new H2(B,I)}case"Union":{let B=k8(A.types,(I)=>x3(I,Q));return B===A.types?A:qE.make(B)}case"Suspend":{let B=void 0,I=NdA(A);if(YI(I)){let D=Q?"Bound":"";B={[vx]:`${I.value}Encoded${D}`}}return new m3(()=>x3(A.f(),Q),B)}case"Refinement":{let B=x3(A.from,Q);if(Q){if(B===A.from)return A;if(He(A.from)===void 0&&Pe(A))return new J5(B,A.filter,A.annotations);return B}else return B}case"Transformation":return x3(A.from,Q)}return A},DT=(A)=>x3(A,!1),jKA=(A)=>x3(A,!0),dE=(A)=>{let Q={};for(let B of Object.getOwnPropertySymbols(A))Q[String(B)]=A[B];return Q},kF=(A)=>{switch(A._tag){case"StringKeyword":case"SymbolKeyword":case"TemplateLiteral":return A;case"Refinement":return kF(A.from)}},he=(A,Q)=>{switch(A._tag){case"Literal":return XG(Q)&&Q.literal===A.literal;case"UniqueSymbol":return RdA(Q)&&Q.symbol===A.symbol;case"UndefinedKeyword":case"VoidKeyword":case"NeverKeyword":case"UnknownKeyword":case"AnyKeyword":case"StringKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"SymbolKeyword":case"ObjectKeyword":return Q._tag===A._tag;case"TemplateLiteral":return qKA(Q)&&Q.head===A.head&&mdA(Q.spans,A.spans);case"Enums":return MdA(Q)&&fdA(Q.enums,A.enums);case"Union":return AT(Q)&&udA(A.types,Q.types);case"Refinement":case"TupleType":case"TypeLiteral":case"Suspend":case"Transformation":case"Declaration":return A===Q}},mdA=M2((A,Q)=>{return A.literal===Q.literal&&he(A.type,Q.type)}),fdA=M2((A,Q)=>Q[0]===A[0]&&Q[1]===A[1]),udA=M2(he),cdA=Mn(he),tz=(A)=>{switch(A._tag){case"Declaration":{let Q=D5(A);if(YI(Q))return tz(Q.value);break}case"TypeLiteral":return A.propertySignatures.map((Q)=>c9(Q.name)?new Aq(Q.name):new HG(Q.name)).concat(A.indexSignatures.map((Q)=>kF(Q.parameter)));case"Suspend":return tz(A.f());case"Union":return A.types.slice(1).reduce((Q,B)=>cdA(Q,tz(B)),tz(A.types[0]));case"Transformation":return tz(A.to)}throw Error(_F(A))},me=(A,Q)=>new k2(A,Q,px),nS=(A,Q)=>{switch(A._tag){case"TypeLiteral":{let B=[];for(let I of Reflect.ownKeys(Q)){let D=Q[I];if(D!==void 0)B.push(new QT(I,D,rQ,rQ))}if(B.length===0)return A;return new k2(A,new H2(A.propertySignatures.map((I)=>{let D=Q[I.name];return new JE(D===void 0?I.name:D,xD(I.type),I.isOptional,I.isReadonly,I.annotations)}),A.indexSignatures),new F5(B))}case"Union":return qE.make(A.types.map((B)=>nS(B,Q)));case"Suspend":return new m3(()=>nS(A.f(),Q));case"Transformation":return me(A,nS(xD(A),Q))}throw Error(uZA(A))},f3=(A)=>eI($J(A),()=>A._tag);function ldA(A){return gI(Ne(A),{onNone:()=>"",onSome:(Q)=>Q.map((B)=>` & Brand<${U1(B)}>`).join("")})}var yKA=(A)=>Re(A).pipe(a4(()=>Me(A)),a4(()=>Le(A)),N8((Q)=>Q+ldA(A))),$J=(A)=>a4(tS(A),()=>yKA(A)),gKA=(A,Q,B)=>{switch(A._tag){case"UndefinedKeyword":return aS;case"Union":{let I=[],D=!1;for(let C of A.types){let G=Q(C);if(G){if(D=!0,!LdA(G))I.push(G)}else I.push(C)}if(D)return qE.make(I);break}case"Suspend":return Q(A.f());case"Transformation":return B(A)}};class wC{path;actual;issue;_tag="Pointer";constructor(A,Q,B){this.path=A,this.actual=Q,this.issue=B}}class nx{actual;message;_tag="Unexpected";constructor(A,Q){this.actual=A,this.message=Q}}class MU{ast;message;_tag="Missing";actual=void 0;constructor(A,Q){this.ast=A,this.message=Q}}class pE{ast;actual;issues;output;_tag="Composite";constructor(A,Q,B,I){this.ast=A,this.actual=Q,this.issues=B,this.output=I}}class CT{ast;actual;kind;issue;_tag="Refinement";constructor(A,Q,B,I){this.ast=A,this.actual=Q,this.kind=B,this.issue=I}}class JT{ast;actual;kind;issue;_tag="Transformation";constructor(A,Q,B,I){this.ast=A,this.actual=Q,this.kind=B,this.issue=I}}class eB{ast;actual;message;_tag="Type";constructor(A,Q,B){this.ast=A,this.actual=Q,this.message=B}}class ix{ast;actual;message;_tag="Forbidden";constructor(A,Q,B){this.ast=A,this.actual=Q,this.message=B}}var rx=Symbol.for("effect/Schema/ParseErrorTypeId"),ddA=(A)=>VQ(A,rx);class le extends Cx("ParseError"){[rx]=rx;get message(){return this.toString()}toString(){return PU.formatIssueSync(this.issue)}toJSON(){return{_id:"ParseError",message:this.toString()}}[kB](){return this.toJSON()}}var ZG=(A)=>new le({issue:A}),ZD=cQ,_E=mQ,SU=GK;var Eq=uW,y2=cW,_1=y(2,(A,Q)=>{return y2(A)?l9(A,{onLeft:mQ,onRight:Q}):UJ(A,Q)}),lC=y(2,(A,Q)=>{return y2(A)?V8(A,Q):U4(A,Q)}),H5=y(2,(A,Q)=>{return y2(A)?Q4(A,Q):Be(A,Q)}),pdA=(A)=>{if(y2(A))return A},de=y(2,(A,Q)=>{return y2(A)?Xn(A,{onLeft:Q.onFailure,onRight:Q.onSuccess}):Qe(A,Q)}),pe=y(2,(A,Q)=>{return y2(A)?l9(A,{onLeft:Q,onRight:cQ}):Ae(A,Q)}),Cq=(A,Q)=>{if(Q===void 0||z8(Q))return A;if(A===void 0)return Q;return{...A,...Q}},GT=(A,Q,B)=>{let I=cC(A,Q);return(D,C)=>I(D,Cq(B,C))},oe=(A,Q,B)=>{let I=GT(A,Q,B);return(D,C)=>nM(I(D,C),ZG)},sx=(A,Q,B)=>{let I=GT(A,Q,B);return(D,C)=>e2A(I(D,C))},ne=(A,Q,B)=>{let I=cC(A,Q);return(D,C)=>I(D,{...Cq(B,C),isEffectAllowed:!0})},tx=(A,Q)=>oe(A.ast,!0,Q),ax=(A,Q)=>sx(A.ast,!0,Q),FT=(A,Q)=>GT(A.ast,!0,Q),hKA=(A,Q)=>{let B=l0(A,Q);return(I,D)=>TF(B(I,D))},l0=(A,Q)=>ne(A.ast,!0,Q),ex=(A,Q)=>oe(A.ast,!1,Q),Ah=(A,Q)=>sx(A.ast,!1,Q),Qh=(A,Q)=>GT(A.ast,!1,Q),mKA=(A,Q)=>{let B=d0(A,Q);return(I,D)=>TF(B(I,D))},d0=(A,Q)=>ne(A.ast,!1,Q),ie=tx,re=ax,odA=FT,ndA=hKA,idA=l0,Z5=(A,Q)=>oe(xD(A.ast),!0,Q),se=(A,Q)=>sx(xD(A.ast),!0,Q),te=(A,Q)=>GT(xD(A.ast),!0,Q),rdA=(A,Q)=>{let B=Bh(A,Q);return(I,D)=>TF(B(I,D))},Bh=(A,Q)=>ne(xD(A.ast),!0,Q),Jq=(A,Q)=>{let B=cC(xD(A.ast),!0);return(I,D)=>O8(B(I,{exact:!0,...Cq(Q,D)}))},ae=(A,Q)=>{let B=cC(xD(A.ast),!0);return(I,D)=>{let C=B(I,{exact:!0,...Cq(Q,D)});if(dI(C))throw ZG(C.left)}},ee=ex,AAA=Ah,sdA=Qh,tdA=mKA,adA=d0,edA=$B(Symbol.for("effect/ParseResult/decodeMemoMap"),()=>new WeakMap),ApA=$B(Symbol.for("effect/ParseResult/encodeMemoMap"),()=>new WeakMap),cC=(A,Q)=>{let B=Q?edA:ApA,I=B.get(A);if(I)return I;let D=QpA(A,Q),C=aZA(A),G=YI(C)?(U,O)=>D(U,Cq(O,C.value)):D,H=eZA(A),Z=Q&&YI(H)?(U,O)=>ET(pe(G(U,O),H.value),A,U,O):G;return B.set(A,Z),Z},fe=(A)=>PE(rZA(A)),ue=(A)=>PE(sZA(A)),QpA=(A,Q)=>{switch(A._tag){case"Refinement":if(Q){let B=cC(A.from,!0);return(I,D)=>{D=D??lx;let C=D?.errors==="all",G=_1(pe(B(I,D),(H)=>{let Z=new CT(A,I,"From",H);if(C&&Pe(A)&&BAA(H))return gI(A.filter(I,D,A),{onNone:()=>mQ(Z),onSome:(U)=>mQ(new pE(A,I,[Z,new CT(A,I,"Predicate",U)]))});return mQ(Z)}),(H)=>gI(A.filter(H,D,A),{onNone:()=>cQ(H),onSome:(Z)=>mQ(new CT(A,I,"Predicate",Z))}));return ET(G,A,I,D)}}else{let B=cC(xD(A),!0),I=cC(fKA(A.from),!1);return(D,C)=>ET(_1(B(D,C),(G)=>I(G,C)),A,D,C)}case"Transformation":{let B=uKA(A.transformation,Q),I=Q?cC(A.from,!0):cC(A.to,!1),D=Q?cC(A.to,!0):cC(A.from,!1);return(C,G)=>ET(_1(H5(I(C,G),(H)=>new JT(A,C,Q?"Encoded":"Type",H)),(H)=>_1(H5(B(H,G??lx,A,C),(Z)=>new JT(A,C,"Transformation",Z)),(Z)=>H5(D(Z,G),(U)=>new JT(A,C,Q?"Type":"Encoded",U)))),A,C,G)}case"Declaration":{let B=Q?A.decodeUnknown(...A.typeParameters):A.encodeUnknown(...A.typeParameters);return(I,D)=>ET(B(I,D??lx,A),A,I,D)}case"Literal":return Y4(A,(B)=>B===A.literal);case"UniqueSymbol":return Y4(A,(B)=>B===A.symbol);case"UndefinedKeyword":return Y4(A,N2A);case"NeverKeyword":return Y4(A,L2A);case"UnknownKeyword":case"AnyKeyword":case"VoidKeyword":return cQ;case"StringKeyword":return Y4(A,cE);case"NumberKeyword":return Y4(A,z8);case"BooleanKeyword":return Y4(A,q3);case"BigIntKeyword":return Y4(A,ZH);case"SymbolKeyword":return Y4(A,c9);case"ObjectKeyword":return Y4(A,$C);case"Enums":return Y4(A,(B)=>A.enums.some(([I,D])=>D===B));case"TemplateLiteral":{let B=ve(A);return Y4(A,(I)=>cE(I)&&B.test(I))}case"TupleType":{let B=A.elements.map((U)=>cC(U.type,Q)),I=A.rest.map((U)=>cC(U.type,Q)),D=A.elements.filter((U)=>!U.isOptional);if(A.rest.length>0)D=D.concat(A.rest.slice(1));let C=D.length,G=A.elements.length>0?A.elements.map((U,O)=>O).join(" | "):"never",H=fe(A),Z=ue(A);return(U,O)=>{if(!On(U))return mQ(new eB(A,U));let w=O?.errors==="all",L=[],P=0,k=[],_=U.length;for(let o=_;o<=C-1;o++){let BA=new wC(o,U,new MU(D[o-_]));if(w){L.push([P++,BA]);continue}else return mQ(new pE(A,U,BA,k))}if(A.rest.length===0)for(let o=A.elements.length;o<=_-1;o++){let BA=new wC(o,U,new nx(U[o],`is unexpected, expected: ${G}`));if(w){L.push([P++,BA]);continue}else return mQ(new pE(A,U,BA,k))}let x=0,l=void 0;for(;x<B.length;x++)if(_<x+1){if(A.elements[x].isOptional)continue}else{let o=B[x],BA=o(U[x],O);if(y2(BA)){if(dI(BA)){let JA=new wC(x,U,BA.left);if(w){L.push([P++,JA]);continue}else return mQ(new pE(A,U,JA,u3(k)))}k.push([P++,BA.right])}else{let JA=P++,XA=x;if(!l)l=[];l.push(({es:UA,output:OA})=>UJ(Q5(BA),(fA)=>{if(dI(fA)){let RA=new wC(XA,U,fA.left);if(w)return UA.push([JA,RA]),P1;else return mQ(new pE(A,U,RA,u3(OA)))}return OA.push([JA,fA.right]),P1}))}}if(LD(I)){let[o,...BA]=I;for(;x<_-BA.length;x++){let JA=o(U[x],O);if(y2(JA))if(dI(JA)){let XA=new wC(x,U,JA.left);if(w){L.push([P++,XA]);continue}else return mQ(new pE(A,U,XA,u3(k)))}else k.push([P++,JA.right]);else{let XA=P++,UA=x;if(!l)l=[];l.push(({es:OA,output:fA})=>UJ(Q5(JA),(RA)=>{if(dI(RA)){let LA=new wC(UA,U,RA.left);if(w)return OA.push([XA,LA]),P1;else return mQ(new pE(A,U,LA,u3(fA)))}else return fA.push([XA,RA.right]),P1}))}}for(let JA=0;JA<BA.length;JA++){let XA=x+JA;if(_<XA+1)continue;else{let UA=BA[JA](U[XA],O);if(y2(UA)){if(dI(UA)){let OA=new wC(XA,U,UA.left);if(w){L.push([P++,OA]);continue}else return mQ(new pE(A,U,OA,u3(k)))}k.push([P++,UA.right])}else{let OA=P++;if(!l)l=[];l.push(({es:fA,output:RA})=>UJ(Q5(UA),(LA)=>{if(dI(LA)){let DQ=new wC(XA,U,LA.left);if(w)return fA.push([OA,DQ]),P1;else return mQ(new pE(A,U,DQ,u3(RA)))}return RA.push([OA,LA.right]),P1}))}}}}let GA=({es:o,output:BA})=>d9(o)?mQ(new pE(A,U,u3(o),u3(BA))):cQ(u3(BA));if(l&&l.length>0){let o=l;return rz(()=>{let BA={es:sW(L),output:sW(k)};return UJ(zU(o,(JA)=>JA(BA),{concurrency:H,batching:Z,discard:!0}),()=>GA(BA))})}return GA({output:k,es:L})}}case"TypeLiteral":{if(A.propertySignatures.length===0&&A.indexSignatures.length===0)return Y4(A,M2A);let B=[],I={},D=[];for(let O of A.propertySignatures)B.push([cC(O.type,Q),O]),I[O.name]=null,D.push(O.name);let C=A.indexSignatures.map((O)=>[cC(O.parameter,Q),cC(O.type,Q),O.parameter]),G=qE.make(A.indexSignatures.map((O)=>O.parameter).concat(D.map((O)=>c9(O)?new Aq(O):new HG(O)))),H=cC(G,Q),Z=fe(A),U=ue(A);return(O,w)=>{if(!mM(O))return mQ(new eB(A,O));let L=w?.errors==="all",P=[],k=0,_=w?.onExcessProperty==="error",x=w?.onExcessProperty==="preserve",l={},GA;if(_||x){GA=Reflect.ownKeys(O);for(let XA of GA){let UA=H(XA,w);if(y2(UA)&&dI(UA))if(_){let OA=new wC(XA,O,new nx(O[XA],`is unexpected, expected: ${String(G)}`));if(L){P.push([k++,OA]);continue}else return mQ(new pE(A,O,OA,l))}else l[XA]=O[XA]}}let o=void 0,BA=w?.exact===!0;for(let XA=0;XA<B.length;XA++){let UA=B[XA][1],OA=UA.name,fA=Object.prototype.hasOwnProperty.call(O,OA);if(!fA){if(UA.isOptional)continue;else if(BA){let DQ=new wC(OA,O,new MU(UA));if(L){P.push([k++,DQ]);continue}else return mQ(new pE(A,O,DQ,l))}}let RA=B[XA][0],LA=RA(O[OA],w);if(y2(LA)){if(dI(LA)){let DQ=new wC(OA,O,fA?LA.left:new MU(UA));if(L){P.push([k++,DQ]);continue}else return mQ(new pE(A,O,DQ,l))}l[OA]=LA.right}else{let DQ=k++,lQ=OA;if(!o)o=[];o.push(({es:SQ,output:iA})=>UJ(Q5(LA),(vA)=>{if(dI(vA)){let zA=new wC(lQ,O,fA?vA.left:new MU(UA));if(L)return SQ.push([DQ,zA]),P1;else return mQ(new pE(A,O,zA,iA))}return iA[lQ]=vA.right,P1}))}}for(let XA=0;XA<C.length;XA++){let UA=C[XA],OA=UA[0],fA=UA[1],RA=De(O,UA[2]);for(let LA of RA){let DQ=OA(LA,w);if(y2(DQ)&&O8(DQ)){let lQ=fA(O[LA],w);if(y2(lQ)){if(dI(lQ)){let SQ=new wC(LA,O,lQ.left);if(L){P.push([k++,SQ]);continue}else return mQ(new pE(A,O,SQ,l))}else if(!Object.prototype.hasOwnProperty.call(I,LA))l[LA]=lQ.right}else{let SQ=k++,iA=LA;if(!o)o=[];o.push(({es:vA,output:zA})=>UJ(Q5(lQ),(kA)=>{if(dI(kA)){let xA=new wC(iA,O,kA.left);if(L)return vA.push([SQ,xA]),P1;else return mQ(new pE(A,O,xA,zA))}else{if(!Object.prototype.hasOwnProperty.call(I,LA))zA[LA]=kA.right;return P1}}))}}}}let JA=({es:XA,output:UA})=>{if(d9(XA))return mQ(new pE(A,O,u3(XA),UA));if(w?.propertyOrder==="original"){let OA=GA||Reflect.ownKeys(O);for(let RA of D)if(OA.indexOf(RA)===-1)OA.push(RA);let fA={};for(let RA of OA)if(Object.prototype.hasOwnProperty.call(UA,RA))fA[RA]=UA[RA];return cQ(fA)}return cQ(UA)};if(o&&o.length>0){let XA=o;return rz(()=>{let UA={es:sW(P),output:Object.assign({},l)};return UJ(zU(XA,(OA)=>OA(UA),{concurrency:Z,batching:U,discard:!0}),()=>JA(UA))})}return JA({es:P,output:l})}}case"Union":{let B=Ih(A.types,Q),I=Reflect.ownKeys(B.keys),D=I.length,C=A.types.length,G=new Map;for(let U=0;U<C;U++)G.set(A.types[U],cC(A.types[U],Q));let H=fe(A)??1,Z=ue(A);return(U,O)=>{let w=[],L=0,P=[];if(D>0)if(yW(U))for(let x=0;x<D;x++){let l=I[x],GA=B.keys[l].buckets;if(Object.prototype.hasOwnProperty.call(U,l)){let o=String(U[l]);if(Object.prototype.hasOwnProperty.call(GA,o))P=P.concat(GA[o]);else{let{candidates:BA,literals:JA}=B.keys[l],XA=qE.make(JA),UA=BA.length===C?new H2([new JE(l,XA,!1,!0)],[]):qE.make(BA);w.push([L++,new pE(UA,U,new wC(l,U,new eB(XA,U[l])))])}}else{let{candidates:o,literals:BA}=B.keys[l],JA=new JE(l,qE.make(BA),!1,!0),XA=o.length===C?new H2([JA],[]):qE.make(o);w.push([L++,new pE(XA,U,new wC(l,U,new MU(JA)))])}}else{let x=B.candidates.length===C?A:qE.make(B.candidates);w.push([L++,new eB(x,U)])}if(B.otherwise.length>0)P=P.concat(B.otherwise);let k=void 0;for(let x=0;x<P.length;x++){let l=P[x],GA=G.get(l)(U,O);if(y2(GA)&&(!k||k.length===0))if(O8(GA))return GA;else w.push([L++,GA.left]);else{let o=L++;if(!k)k=[];k.push((BA)=>rz(()=>{if("finalResult"in BA)return P1;else return UJ(Q5(GA),(JA)=>{if(O8(JA))BA.finalResult=JA;else BA.es.push([o,JA.left]);return P1})}))}}let _=(x)=>d9(x)?x.length===1&&x[0][1]._tag==="Type"?mQ(x[0][1]):mQ(new pE(A,U,u3(x))):mQ(new eB(A,U));if(k&&k.length>0){let x=k;return rz(()=>{let l={es:sW(w)};return UJ(zU(x,(GA)=>GA(l),{concurrency:H,batching:Z,discard:!0}),()=>{if("finalResult"in l)return l.finalResult;return _(l.es)})})}return _(w)}}case"Suspend":{let B=sz(()=>cC(A.f(),Q));return(I,D)=>B()(I,D)}}},Y4=(A,Q)=>(B)=>Q(B)?cQ(B):mQ(new eB(A,B)),Iq=(A,Q)=>{switch(A._tag){case"Declaration":{let B=D5(A);if(YI(B))return Iq(B.value,Q);break}case"TypeLiteral":{let B=[];for(let I=0;I<A.propertySignatures.length;I++){let D=A.propertySignatures[I],C=Q?DT(D.type):xD(D.type);if(XG(C)&&!D.isOptional)B.push([D.name,C])}return B}case"TupleType":{let B=[];for(let I=0;I<A.elements.length;I++){let D=A.elements[I],C=Q?DT(D.type):xD(D.type);if(XG(C)&&!D.isOptional)B.push([I,C])}return B}case"Refinement":return Iq(A.from,Q);case"Suspend":return Iq(A.f(),Q);case"Transformation":return Iq(Q?A.from:A.to,Q)}return[]},Ih=(A,Q)=>{let B={},I=[],D=[];for(let C=0;C<A.length;C++){let G=A[C],H=Iq(G,Q);if(H.length>0){D.push(G);for(let Z=0;Z<H.length;Z++){let[U,O]=H[Z],w=String(O.literal);B[U]=B[U]||{buckets:{},literals:[],candidates:[]};let L=B[U].buckets;if(Object.prototype.hasOwnProperty.call(L,w)){if(Z<H.length-1)continue;L[w].push(G),B[U].literals.push(O),B[U].candidates.push(G)}else{L[w]=[G],B[U].literals.push(O),B[U].candidates.push(G);break}}}else I.push(G)}return{keys:B,otherwise:I,candidates:D}},fKA=(A)=>G5(A)?fKA(A.from):A,ET=(A,Q,B,I)=>{if(I?.isEffectAllowed===!0)return A;if(y2(A))return A;let D=new eK,C=lS(A,{scheduler:D});D.flush();let G=C.unsafePoll();if(G){if(Rb(G))return cQ(G.value);let H=G.cause;if(P7A(H))return mQ(H.error);return mQ(new ix(Q,B,PS(H)))}return mQ(new ix(Q,B,"cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work"))},BpA=([A],[Q])=>A>Q?1:A<Q?-1:0;function u3(A){return A.sort(BpA).map((Q)=>Q[1])}var uKA=(A,Q)=>{switch(A._tag){case"FinalTransformation":return Q?A.decode:A.encode;case"ComposeTransformation":return cQ;case"TypeLiteralTransformation":return(B)=>{let I=cQ(B);for(let D of A.propertySignatureTransformations){let[C,G]=Q?[D.from,D.to]:[D.to,D.from],H=Q?D.decode:D.encode;I=lC(I,(U)=>{let O=H(Object.prototype.hasOwnProperty.call(U,C)?oA(U[C]):pA());if(delete U[C],YI(O))U[G]=O.value;return U})}return I}}},j8=(A,Q=[])=>({value:A,forest:Q}),PU={formatIssue:(A)=>lC(Qq(A),IpA),formatIssueSync:(A)=>{let Q=PU.formatIssue(A);return y2(Q)?Kg(Q):Px(Q)},formatError:(A)=>PU.formatIssue(A.issue),formatErrorSync:(A)=>PU.formatIssueSync(A.issue)},IpA=(A)=>A.value+cKA(`
|
|
392
|
-
`,A.forest),cKA=(A,Q)=>{let B="",I=Q.length,D;for(let C=0;C<I;C++){D=Q[C];let G=C===I-1;B+=A+(G?"└":"├")+"─ "+D.value,B+=cKA(A+(I>1&&!G?"│ ":" "),D.forest)}return B},DpA=(A)=>{switch(A){case"Encoded":return"Encoded side transformation failure";case"Transformation":return"Transformation process failure";case"Type":return"Type side transformation failure"}},EpA=(A)=>{switch(A){case"From":return"From side refinement failure";case"Predicate":return"Predicate refinement failure"}},lKA=(A)=>("ast"in A)?oA(A.ast):pA(),ce=cQ(void 0),CpA=(A)=>lKA(A).pipe(R8(nZA),gI({onNone:()=>ce,onSome:(Q)=>{let B=Q(A);if(cE(B))return cQ({message:B,override:!1});if(ta(B))return U4(B,(I)=>({message:I,override:!1}));if(cE(B.message))return cQ({message:B.message,override:B.override});return U4(B.message,(I)=>({message:I,override:B.override}))}})),QAA=(A)=>(Q)=>Q._tag===A,BAA=QAA("Composite"),bKA=QAA("Refinement"),xKA=QAA("Transformation"),X5=(A)=>_1(CpA(A),(Q)=>{if(Q!==void 0)return!Q.override&&(BAA(A)||bKA(A)&&A.kind==="From"||xKA(A)&&A.kind!=="Transformation")?xKA(A)||bKA(A)?X5(A.issue):ce:cQ(Q.message);return ce}),dKA=(A)=>lKA(A).pipe(R8(tZA),B8A((Q)=>Q(A)),PE);function pKA(A){return Me(A).pipe(a4(()=>Re(A)),a4(()=>Le(A)),a4(()=>tS(A)),eI(()=>`{ ${A.from} | filter }`))}function JpA(A){if(A.message!==void 0)return A.message;return`Expected ${G5(A.ast)?pKA(A.ast):String(A.ast)}, actual ${U1(A.actual)}`}var oKA=(A)=>lC(X5(A),(Q)=>Q??dKA(A)??JpA(A)),ox=(A)=>dKA(A)??String(A.ast),nKA=(A)=>A.message??"is forbidden",iKA=(A)=>A.message??"is unexpected",rKA=(A)=>{let Q=iZA(A.ast);if(YI(Q)){let B=Q.value();return cE(B)?cQ(B):B}return cQ(A.message??"is missing")},Qq=(A)=>{switch(A._tag){case"Type":return lC(oKA(A),j8);case"Forbidden":return cQ(j8(ox(A),[j8(nKA(A))]));case"Unexpected":return cQ(j8(iKA(A)));case"Missing":return lC(rKA(A),j8);case"Transformation":return _1(X5(A),(Q)=>{if(Q!==void 0)return cQ(j8(Q));return lC(Qq(A.issue),(B)=>j8(ox(A),[j8(DpA(A.kind),[B])]))});case"Refinement":return _1(X5(A),(Q)=>{if(Q!==void 0)return cQ(j8(Q));return lC(Qq(A.issue),(B)=>j8(ox(A),[j8(EpA(A.kind),[B])]))});case"Pointer":return lC(Qq(A.issue),(Q)=>j8(Tx(A.path),[Q]));case"Composite":return _1(X5(A),(Q)=>{if(Q!==void 0)return cQ(j8(Q));let B=ox(A);return Sx(A.issues)?lC(zU(A.issues,Qq),(I)=>j8(B,I)):lC(Qq(A.issues),(I)=>j8(B,[I]))})}},LU=(A,Q,B)=>({_tag:A,path:Q,message:B}),Dq={formatIssue:(A)=>Bq(A,void 0,[]),formatIssueSync:(A)=>{let Q=Dq.formatIssue(A);return y2(Q)?Kg(Q):Px(Q)},formatError:(A)=>Dq.formatIssue(A.issue),formatErrorSync:(A)=>Dq.formatIssueSync(A.issue)},Bq=(A,Q,B)=>{let I=A._tag;switch(I){case"Type":return lC(oKA(A),(D)=>[LU(Q??I,B,D)]);case"Forbidden":return cQ([LU(I,B,nKA(A))]);case"Unexpected":return cQ([LU(I,B,iKA(A))]);case"Missing":return lC(rKA(A),(D)=>[LU(I,B,D)]);case"Pointer":return Bq(A.issue,void 0,B.concat(A.path));case"Composite":return _1(X5(A),(D)=>{if(D!==void 0)return cQ([LU(I,B,D)]);return Sx(A.issues)?lC(zU(A.issues,(C)=>Bq(C,void 0,B)),tW):Bq(A.issues,void 0,B)});case"Refinement":return _1(X5(A),(D)=>{if(D!==void 0)return cQ([LU(I,B,D)]);return Bq(A.issue,A.kind==="Predicate"?I:void 0,B)});case"Transformation":return _1(X5(A),(D)=>{if(D!==void 0)return cQ([LU(I,B,D)]);return Bq(A.issue,A.kind==="Transformation"?I:void 0,B)})}};var K5={};e1(K5,{zipWith:()=>eoA,zipRight:()=>aoA,zipLeft:()=>toA,windowed:()=>soA,whileOutputEffect:()=>roA,whileOutput:()=>ioA,whileInputEffect:()=>noA,whileInput:()=>ooA,upTo:()=>poA,untilOutputEffect:()=>doA,untilOutput:()=>loA,untilInputEffect:()=>coA,untilInput:()=>uoA,unionWith:()=>foA,union:()=>moA,unfold:()=>hoA,tapOutput:()=>xoA,tapInput:()=>boA,sync:()=>voA,succeed:()=>goA,stop:()=>yoA,spaced:()=>joA,secondOfMinute:()=>ypA,run:()=>koA,resetWhen:()=>_oA,resetAfter:()=>ToA,repetitions:()=>SoA,repeatForever:()=>PoA,reduceEffect:()=>MoA,reduce:()=>LoA,recurs:()=>RoA,recurWhileEffect:()=>NoA,recurWhile:()=>woA,recurUpTo:()=>VoA,recurUntilOption:()=>OoA,recurUntilEffect:()=>qoA,recurUntil:()=>zoA,provideService:()=>WoA,provideContext:()=>YoA,passthrough:()=>DoA,once:()=>$oA,onDecision:()=>UoA,modifyDelayEffect:()=>KoA,modifyDelay:()=>ZoA,minuteOfHour:()=>gpA,mapInputEffect:()=>TpA,mapInputContext:()=>_pA,mapInput:()=>SpA,mapEffect:()=>XoA,mapBothEffect:()=>lpA,mapBoth:()=>cpA,map:()=>HoA,makeWithState:()=>HpA,linear:()=>FoA,jitteredWith:()=>GoA,jittered:()=>JoA,isSchedule:()=>XpA,intersectWith:()=>CoA,intersect:()=>EoA,identity:()=>IoA,hourOfDay:()=>vpA,fromFunction:()=>BoA,fromDelays:()=>QoA,fromDelay:()=>AoA,forever:()=>epA,fixed:()=>apA,fibonacci:()=>tpA,exponential:()=>spA,ensuring:()=>rpA,elapsed:()=>ipA,eitherWith:()=>npA,either:()=>opA,duration:()=>ppA,driver:()=>dpA,delays:()=>upA,delayedSchedule:()=>fpA,delayedEffect:()=>mpA,delayed:()=>hpA,dayOfWeek:()=>xpA,dayOfMonth:()=>bpA,cron:()=>jpA,count:()=>kpA,compose:()=>PpA,collectWhileEffect:()=>MpA,collectWhile:()=>LpA,collectUntilEffect:()=>RpA,collectUntil:()=>NpA,collectAllOutputs:()=>wpA,collectAllInputs:()=>VpA,checkEffect:()=>OpA,check:()=>qpA,bothInOut:()=>zpA,asVoid:()=>WpA,as:()=>YpA,andThenEither:()=>$pA,andThen:()=>UpA,addDelayEffect:()=>KpA,addDelay:()=>ZpA,ScheduleTypeId:()=>GpA,ScheduleDriverTypeId:()=>FpA,CurrentIterationMetadata:()=>AnA});var GpA=Kx,FpA=Wa,HpA=XD,XpA=Ux,ZpA=$x,KpA=za,UpA=l5A,$pA=qa,YpA=d5A,WpA=Yx,zpA=p5A,qpA=oz,OpA=YU,VpA=o5A,wpA=WU,NpA=n5A,RpA=i5A,LpA=r5A,MpA=s5A,PpA=t5A,SpA=Oa,TpA=Wx,_pA=a5A,kpA=tXA,jpA=e5A,ypA=SXA,gpA=zXA,vpA=$XA,bpA=AXA,xpA=QXA,hpA=BXA,mpA=zx,fpA=vS,upA=IXA,cpA=DXA,lpA=EXA,dpA=bS,ppA=Va,opA=CXA,npA=JXA,ipA=Rx,rpA=GXA,spA=FXA,tpA=HXA,apA=XXA,epA=v3,AoA=ZXA,QoA=KXA,BoA=UXA,IoA=SF,DoA=Ra,EoA=A5,CoA=wa,JoA=YXA,GoA=Na,FoA=WXA,HoA=F2,XoA=qx,ZoA=qXA,KoA=xS,UoA=OXA,$oA=Lx,YoA=VXA,WoA=wXA,zoA=La,qoA=Ma,OoA=NXA,VoA=Pa,woA=Sa,NoA=Ta,RoA=nz,LoA=Ox,MoA=_a,PoA=v3,SoA=RXA,ToA=LXA,_oA=ka,koA=MXA,joA=TXA,yoA=aXA,goA=_XA,voA=kXA,boA=jXA,xoA=yXA,hoA=hS,moA=ja,foA=Vx,uoA=ya,coA=mS,loA=ga,doA=gXA,poA=vXA,ooA=va,noA=fS,ioA=wx,roA=bXA,soA=xXA,toA=ba,aoA=hXA,eoA=mXA,AnA=$U;var VB={};e1(VB,{withDefaults:()=>MiA,withDecodingDefault:()=>lYA,withConstructorDefault:()=>Y5,validateSync:()=>Z5,validatePromise:()=>HiA,validateOption:()=>se,validateEither:()=>FiA,validate:()=>TYA,validDate:()=>sQA,uppercased:()=>CWA,uncapitalized:()=>HWA,typeSchema:()=>dB,trimmed:()=>aYA,transformOrFail:()=>oE,transformLiterals:()=>liA,transformLiteral:()=>sYA,transform:()=>xB,tag:()=>pYA,symbolWithResult:()=>hF,symbolSerializable:()=>ST,suspend:()=>Wh,successSchema:()=>VQA,startsWith:()=>iiA,standardSchemaV1:()=>IiA,split:()=>tiA,serializeSuccess:()=>LtA,serializeFailure:()=>NtA,serializeExit:()=>PtA,serialize:()=>OtA,serializableSchema:()=>qtA,requiredToOptional:()=>SiA,required:()=>miA,rename:()=>oiA,propertySignature:()=>Kq,positiveBigInt:()=>lQA,positiveBigDecimal:()=>czA,positive:()=>hWA,pluck:()=>viA,pickLiteral:()=>ZiA,pick:()=>nYA,pattern:()=>_QA,partialWith:()=>hiA,partial:()=>xiA,parseNumber:()=>cWA,parseJson:()=>WWA,optionalWith:()=>kiA,optionalToRequired:()=>vF,optionalToOptional:()=>cAA,optionalElement:()=>ViA,optional:()=>_iA,omit:()=>giA,nonPositiveBigInt:()=>oQA,nonPositiveBigDecimal:()=>izA,nonPositive:()=>fWA,nonNegativeBigInt:()=>pQA,nonNegativeBigDecimal:()=>dzA,nonNegative:()=>uWA,nonNaN:()=>xWA,nonEmptyString:()=>vQA,negativeBigInt:()=>dQA,negativeBigDecimal:()=>ozA,negative:()=>mWA,mutable:()=>fiA,multipleOf:()=>ArA,minLength:()=>QWA,minItems:()=>krA,maxLength:()=>niA,maxItems:()=>jrA,makePropertySignature:()=>$G,make:()=>CI,lowercased:()=>DWA,lessThanOrEqualToDuration:()=>VrA,lessThanOrEqualToDate:()=>hrA,lessThanOrEqualToBigInt:()=>IzA,lessThanOrEqualToBigDecimal:()=>wsA,lessThanOrEqualTo:()=>gWA,lessThanDuration:()=>qrA,lessThanDate:()=>xrA,lessThanBigInt:()=>BzA,lessThanBigDecimal:()=>VsA,lessThan:()=>jWA,length:()=>BWA,keyof:()=>OiA,itemsCount:()=>yrA,isSchema:()=>dC,isPropertySignature:()=>yh,is:()=>Jq,int:()=>mQA,instanceOf:()=>vYA,includes:()=>siA,headOrElse:()=>brA,headNonEmpty:()=>vrA,head:()=>grA,greaterThanOrEqualToDuration:()=>NrA,greaterThanOrEqualToDate:()=>frA,greaterThanOrEqualToBigInt:()=>QzA,greaterThanOrEqualToBigDecimal:()=>OsA,greaterThanOrEqualTo:()=>SWA,greaterThanDuration:()=>wrA,greaterThanDate:()=>mrA,greaterThanBigInt:()=>AzA,greaterThanBigDecimal:()=>qsA,greaterThan:()=>MWA,getNumberIndexedAccess:()=>hh,getClassTag:()=>lh,fromKey:()=>PiA,fromBrand:()=>ziA,format:()=>aD,finite:()=>hQA,filterEffect:()=>ciA,filter:()=>pB,failureSchema:()=>OQA,extend:()=>LT,exitSchema:()=>JBA,equivalence:()=>ktA,endsWith:()=>riA,encodedSchema:()=>Lh,encodedBoundSchema:()=>wQA,encodeUnknownSync:()=>ex,encodeUnknownPromise:()=>MYA,encodeUnknownOption:()=>Ah,encodeUnknownEither:()=>LYA,encodeUnknown:()=>Mh,encodeSync:()=>ee,encodePromise:()=>EiA,encodeOption:()=>AAA,encodeEither:()=>DiA,encode:()=>Ph,element:()=>fAA,deserializeSuccess:()=>MtA,deserializeFailure:()=>RtA,deserializeExit:()=>StA,deserialize:()=>VtA,decodeUnknownSync:()=>tx,decodeUnknownPromise:()=>SYA,decodeUnknownOption:()=>ax,decodeUnknownEither:()=>PYA,decodeUnknown:()=>gU,decodeSync:()=>ie,decodePromise:()=>GiA,decodeOption:()=>re,decodeEither:()=>JiA,decode:()=>CiA,declare:()=>kE,compose:()=>Yh,clampDuration:()=>zrA,clampBigInt:()=>BrA,clampBigDecimal:()=>PsA,clamp:()=>QrA,capitalized:()=>GWA,brand:()=>biA,betweenDuration:()=>KzA,betweenDate:()=>urA,betweenBigInt:()=>cQA,betweenBigDecimal:()=>rzA,between:()=>fQA,attachPropertySignature:()=>diA,asserts:()=>ae,asWithResult:()=>wtA,asSerializableWithResult:()=>TtA,asSerializable:()=>ztA,asSchema:()=>kD,annotations:()=>piA,Void:()=>bYA,ValidDateSchemaId:()=>IQA,ValidDateFromSelf:()=>zzA,UppercasedSchemaId:()=>EWA,Uppercased:()=>jQA,Uppercase:()=>KWA,Unknown:()=>$q,UniqueSymbolFromSelf:()=>kYA,Union:()=>pC,UndefinedOr:()=>jU,Undefined:()=>Sh,UncapitalizedSchemaId:()=>FWA,Uncapitalized:()=>gQA,Uncapitalize:()=>$WA,Uint8ArrayFromSelf:()=>xh,Uint8ArrayFromHex:()=>MrA,Uint8ArrayFromBase64Url:()=>LrA,Uint8ArrayFromBase64:()=>RrA,Uint8Array:()=>UzA,Uint8:()=>nQA,UUIDSchemaId:()=>qWA,UUID:()=>OWA,URLFromSelf:()=>xQA,URL:()=>NWA,ULIDSchemaId:()=>VWA,ULID:()=>wWA,TypeId:()=>z5,Tuple:()=>WJ,TrimmedSchemaId:()=>tYA,Trimmed:()=>vh,Trim:()=>YWA,ToPropertySignature:()=>UG,TimeZoneOffsetFromSelf:()=>mh,TimeZoneOffset:()=>LzA,TimeZoneNamedFromSelf:()=>fh,TimeZoneNamed:()=>PzA,TimeZoneFromSelf:()=>eQA,TimeZone:()=>SzA,TemplateLiteralParser:()=>$iA,TemplateLiteral:()=>yYA,TaggedStruct:()=>RT,TaggedRequest:()=>_tA,TaggedError:()=>fsA,TaggedClass:()=>msA,SymbolFromSelf:()=>kh,Symbol:()=>eWA,Struct:()=>FE,StringFromUriComponent:()=>_rA,StringFromHex:()=>TrA,StringFromBase64Url:()=>SrA,StringFromBase64:()=>PrA,String:()=>iI,StartsWithSchemaId:()=>pAA,SortedSetFromSelf:()=>FqA,SortedSet:()=>YtA,SetFromSelf:()=>hzA,Set:()=>YsA,RefineSchemaId:()=>SQA,RedactedFromSelf:()=>CzA,Redacted:()=>XrA,Record:()=>MQA,ReadonlySetFromSelf:()=>xzA,ReadonlySet:()=>$sA,ReadonlyMapFromSelf:()=>BBA,ReadonlyMapFromRecord:()=>HsA,ReadonlyMap:()=>GsA,PropertySignatureTypeId:()=>RQA,PropertySignatureTransformation:()=>p3,PropertySignatureDeclaration:()=>q5,PropertyKey:()=>GBA,PositiveBigIntFromSelf:()=>IrA,PositiveBigInt:()=>DrA,PositiveBigDecimalSchemaId:()=>uzA,PositiveBigDecimalFromSelf:()=>NsA,Positive:()=>pWA,PatternSchemaId:()=>dAA,OptionFromUndefinedOr:()=>erA,OptionFromSelf:()=>bU,OptionFromNullishOr:()=>arA,OptionFromNullOr:()=>trA,OptionFromNonEmptyTrimmedString:()=>kzA,Option:()=>srA,Object:()=>hYA,NumberFromString:()=>uQA,Number:()=>X2,NullishOr:()=>qT,NullOr:()=>zT,Null:()=>Th,Not:()=>sWA,NonPositiveBigIntFromSelf:()=>JrA,NonPositiveBigInt:()=>GrA,NonPositiveBigDecimalSchemaId:()=>nzA,NonPositiveBigDecimalFromSelf:()=>MsA,NonPositive:()=>nWA,NonNegativeInt:()=>qh,NonNegativeBigIntFromSelf:()=>DzA,NonNegativeBigInt:()=>FrA,NonNegativeBigDecimalSchemaId:()=>lzA,NonNegativeBigDecimalFromSelf:()=>RsA,NonNegative:()=>bh,NonNaNSchemaId:()=>bWA,NonNaN:()=>dWA,NonEmptyTrimmedString:()=>bQA,NonEmptyString:()=>zWA,NonEmptyChunkFromSelf:()=>tzA,NonEmptyChunk:()=>ysA,NonEmptyArrayEnsure:()=>RiA,NonEmptyArray:()=>Wq,Never:()=>_h,NegativeBigIntFromSelf:()=>ErA,NegativeBigInt:()=>CrA,NegativeBigDecimalSchemaId:()=>pzA,NegativeBigDecimalFromSelf:()=>LsA,Negative:()=>oWA,MultipleOfSchemaId:()=>TWA,MinLengthSchemaId:()=>AWA,MinItemsSchemaId:()=>$zA,MaxLengthSchemaId:()=>eYA,MaxItemsSchemaId:()=>YzA,MapFromSelf:()=>IBA,MapFromRecord:()=>XsA,Map:()=>FsA,LowercasedSchemaId:()=>IWA,Lowercased:()=>kQA,Lowercase:()=>ZWA,Literal:()=>GE,ListFromSelf:()=>GqA,List:()=>KtA,LessThanSchemaId:()=>kWA,LessThanOrEqualToSchemaId:()=>yWA,LessThanOrEqualToDurationSchemaId:()=>OrA,LessThanOrEqualToDateSchemaId:()=>EQA,LessThanOrEqualToBigIntSchemaId:()=>aAA,LessThanOrEqualToBigDecimalSchemaId:()=>YQA,LessThanDurationSchemaId:()=>VT,LessThanDateSchemaId:()=>DQA,LessThanBigIntSchemaId:()=>tAA,LessThanBigDecimalSchemaId:()=>$QA,LengthSchemaId:()=>lAA,JsonNumberSchemaId:()=>iWA,JsonNumber:()=>rWA,ItemsCountSchemaId:()=>WzA,IntSchemaId:()=>_WA,Int:()=>zh,InstanceOfSchemaId:()=>mAA,IncludesSchemaId:()=>nAA,HashSetFromSelf:()=>CqA,HashSet:()=>EtA,HashMapFromSelf:()=>JqA,HashMap:()=>FtA,GreaterThanSchemaId:()=>LWA,GreaterThanOrEqualToSchemaId:()=>PWA,GreaterThanOrEqualToDurationSchemaId:()=>QQA,GreaterThanOrEqualToDateSchemaId:()=>JQA,GreaterThanOrEqualToBigIntSchemaId:()=>sAA,GreaterThanOrEqualToBigDecimalSchemaId:()=>UQA,GreaterThanDurationSchemaId:()=>AQA,GreaterThanDateSchemaId:()=>CQA,GreaterThanBigIntSchemaId:()=>rAA,GreaterThanBigDecimalSchemaId:()=>KQA,FromPropertySignature:()=>O5,FiniteSchemaId:()=>RWA,Finite:()=>lWA,FiberIdFromSelf:()=>CBA,FiberId:()=>QqA,ExitFromSelf:()=>EqA,Exit:()=>qQA,Enums:()=>UiA,EndsWithSchemaId:()=>oAA,EitherFromUnion:()=>DsA,EitherFromSelf:()=>QBA,Either:()=>IsA,DurationFromSelf:()=>MT,DurationFromNanos:()=>JzA,DurationFromMillis:()=>GzA,Duration:()=>ZzA,Defect:()=>Rh,DateTimeZonedFromSelf:()=>ABA,DateTimeZoned:()=>TzA,DateTimeUtcFromSelf:()=>PT,DateTimeUtcFromNumber:()=>VzA,DateTimeUtcFromDate:()=>wzA,DateTimeUtc:()=>NzA,DateFromString:()=>tQA,DateFromSelfSchemaId:()=>FQA,DateFromSelf:()=>zq,DateFromNumber:()=>OzA,Date:()=>qzA,DataFromSelf:()=>azA,Data:()=>bsA,Config:()=>WtA,Class:()=>hsA,ChunkFromSelf:()=>szA,Chunk:()=>_sA,Char:()=>XWA,CauseFromSelf:()=>Nh,Cause:()=>ssA,CapitalizedSchemaId:()=>JWA,Capitalized:()=>yQA,Capitalize:()=>UWA,BrandSchemaId:()=>hAA,BooleanFromUnknown:()=>HqA,BooleanFromString:()=>XqA,Boolean:()=>Yq,BigIntFromSelf:()=>V5,BigIntFromNumber:()=>EzA,BigInt:()=>vU,BigDecimalFromSelf:()=>w5,BigDecimalFromNumber:()=>fzA,BigDecimal:()=>mzA,BetweenSchemaId:()=>vWA,BetweenDurationSchemaId:()=>BQA,BetweenDateSchemaId:()=>GQA,BetweenBigIntSchemaId:()=>eAA,BetweenBigDecimalSchemaId:()=>WQA,ArrayFormatterIssue:()=>ZqA,ArrayEnsure:()=>NiA,Array:()=>eD,Any:()=>xYA});var sKA=/^[+-]?\d+$/,IAA=Symbol.for("effect/BigDecimal"),QnA={[IAA]:IAA,[hQ](){let A=TU(this);return IA(LQ(A.value),GB(c6(A.scale)),_B(this))},[xQ](A){return EAA(A)&&InA(this,A)},toString(){return`BigDecimal(${l3(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[kB](){return this.toJSON()},pipe(){return RQ(this,arguments)}},EAA=(A)=>VQ(A,IAA),U5=(A,Q)=>{let B=Object.create(QnA);return B.value=A,B.scale=Q,B},aKA=(A,Q)=>{if(A!==c3&&A%DAA===c3)throw RangeError("Value must be normalized");let B=U5(A,Q);return B.normalized=B,B},c3=BigInt(0);var DAA=BigInt(10),eKA=aKA(c3,0),TU=(A)=>{if(A.normalized===void 0)if(A.value===c3)A.normalized=eKA;else{let Q=`${A.value}`,B=0;for(let C=Q.length-1;C>=0;C--)if(Q[C]==="0")B++;else break;if(B===0)A.normalized=A;let I=BigInt(Q.substring(0,Q.length-B)),D=A.scale-B;A.normalized=aKA(I,D)}return A.normalized},Dh=y(2,(A,Q)=>{if(Q>A.scale)return U5(A.value*DAA**BigInt(Q-A.scale),Q);if(Q<A.scale)return U5(A.value/DAA**BigInt(A.scale-Q),Q);return A});var Gq=HK((A,Q)=>{let B=Ug(tKA(A),tKA(Q));if(B!==0)return B;if(A.scale>Q.scale)return lW(A.value,Dh(Q,A.scale).value);if(A.scale<Q.scale)return lW(Dh(A,Q.scale).value,Q.value);return lW(A.value,Q.value)}),AUA=pW(Gq),QUA=rM(Gq),BUA=XK(Gq),IUA=sM(Gq),DUA=oW(Gq),EUA=WH(Gq);var tKA=(A)=>A.value===c3?0:A.value<c3?-1:1,BnA=(A)=>A.value<c3?U5(-A.value,A.scale):A;var CAA=$E((A,Q)=>{if(A.scale>Q.scale)return Dh(Q,A.scale).value===A.value;if(A.scale<Q.scale)return Dh(A,Q.scale).value===Q.value;return A.value===Q.value}),InA=y(2,(A,Q)=>CAA(A,Q));var CUA=(A)=>Yn(DnA(A),()=>RangeError(`Number must be finite, got ${A}`));var DnA=(A)=>{if(!Number.isFinite(A))return pA();let Q=`${A}`;if(Q.includes("e"))return JAA(Q);let[B,I=""]=Q.split(".");return oA(U5(BigInt(`${B}${I}`),I.length))},JAA=(A)=>{if(A==="")return oA(eKA);let Q,B,I=A.search(/[eE]/);if(I!==-1){let Z=A.slice(I+1);if(Q=A.slice(0,I),B=Number(Z),Q===""||!Number.isSafeInteger(B)||!sKA.test(Z))return pA()}else Q=A,B=0;let D,C,G=Q.search(/\./);if(G!==-1){let Z=Q.slice(0,G),U=Q.slice(G+1);D=`${Z}${U}`,C=U.length}else D=Q,C=0;if(!sKA.test(D))return pA();let H=C-B;if(!Number.isSafeInteger(H))return pA();return oA(U5(BigInt(D),H))};var l3=(A)=>{let Q=TU(A);if(Math.abs(Q.scale)>=16)return EnA(Q);let B=Q.value<c3,I=B?`${Q.value}`.substring(1):`${Q.value}`,D,C;if(Q.scale>=I.length)D="0",C="0".repeat(Q.scale-I.length)+I;else{let H=I.length-Q.scale;if(H>I.length){let Z=H-I.length;D=`${I}${"0".repeat(Z)}`,C=""}else C=I.slice(H),D=I.slice(0,H)}let G=C===""?D:`${D}.${C}`;return B?`-${G}`:G},EnA=(A)=>{if(CnA(A))return"0e+0";let Q=TU(A),B=`${BnA(Q).value}`,I=B.slice(0,1),D=B.slice(1),C=`${GAA(Q)?"-":""}${I}`;if(D!=="")C+=`.${D}`;let G=D.length-Q.scale;return`${C}e${G>=0?"+":""}${G}`},JUA=(A)=>Number(l3(A));var CnA=(A)=>A.value===c3,GAA=(A)=>A.value<c3,GUA=(A)=>A.value>c3;var GnA=lW;var FUA=WH(GnA);var HUA=(A)=>{if(A>BigInt(Number.MAX_SAFE_INTEGER)||A<BigInt(Number.MIN_SAFE_INTEGER))return pA();return oA(Number(A))},XUA=(A)=>{try{return A.trim()===""?pA():oA(BigInt(A))}catch{return pA()}},ZUA=(A)=>{if(A>Number.MAX_SAFE_INTEGER||A<Number.MIN_SAFE_INTEGER)return pA();try{return oA(BigInt(A))}catch{return pA()}};var KUA=yr;var UUA="effect/Redacted",Fq=$B("effect/Redacted/redactedRegistry",()=>new WeakMap),FAA=Symbol.for(UUA),XnA={[FAA]:{_A:(A)=>A},pipe(){return RQ(this,arguments)},toString(){return"<redacted>"},toJSON(){return"<redacted>"},[kB](){return"<redacted>"},[hQ](){return IA(LQ(UUA),GB(LQ(Fq.get(this))),_B(this))},[xQ](A){return HAA(A)&&NQ(Fq.get(this),Fq.get(A))}},HAA=(A)=>VQ(A,FAA),$UA=(A)=>{let Q=Object.create(XnA);return Fq.set(Q,A),Q},YUA=(A)=>{if(Fq.has(A))return Fq.get(A);else throw Error("Unable to get redacted value")};var KnA="effect/Config",WUA=Symbol.for(KnA),UnA={_A:(A)=>A},XAA={...O3,[WUA]:UnA,commit(){return vJA(this)}};var zUA=y(2,(A,Q)=>{let B=Object.create(XAA);return B._tag=xv,B.original=A,B.mapOrFail=Q,B}),qUA=y(2,(A,Q)=>{let B=Object.create(XAA);return B._tag=hv,B.name=Q,B.config=A,B});var OUA=(A,Q)=>{let B=Object.create(XAA);return B._tag=mv,B.description=A,B.parse=Q,B};var VUA=(A)=>{let Q=OUA("a text property",cQ);return A===void 0?Q:qUA(Q,A)};var wUA=zUA;var NUA=VUA;var ZAA=KU;var RUA=U5A,LUA=Fx,MUA=$5A,PUA=Qa,KAA=Y5A;var SUA=lz,TUA=Ba,_UA=UU;var kUA=z5A;var UAA=Ia,$AA=jS;var jUA=yS,yUA=O5A;var gUA=PF;var vUA=Ca;var bUA=P5A;var xUA=Ha;var YAA=Symbol.for("effect/Encoding/errors/Decode"),YJ=(A,Q)=>{let B={_tag:"DecodeException",[YAA]:YAA,input:A};if(cE(Q))B.message=Q;return B};var WAA=Symbol.for("effect/Encoding/errors/Encode"),hUA=(A,Q)=>{let B={_tag:"EncodeException",[WAA]:WAA,input:A};if(cE(Q))B.message=Q;return B};var Eh=new TextEncoder,Ch=new TextDecoder;var XT=(A)=>{let Q=A.length,B="",I;for(I=2;I<Q;I+=3)B+=yF[A[I-2]>>2],B+=yF[(A[I-2]&3)<<4|A[I-1]>>4],B+=yF[(A[I-1]&15)<<2|A[I]>>6],B+=yF[A[I]&63];if(I===Q+1)B+=yF[A[I-2]>>2],B+=yF[(A[I-2]&3)<<4],B+="==";if(I===Q)B+=yF[A[I-2]>>2],B+=yF[(A[I-2]&3)<<4|A[I-1]>>4],B+=yF[(A[I-1]&15)<<2],B+="=";return B},Gh=(A)=>{let Q=zAA(A),B=Q.length;if(B%4!==0)return mQ(YJ(Q,`Length must be a multiple of 4, but is ${B}`));let I=Q.indexOf("=");if(I!==-1&&(I<B-2||I===B-2&&Q[B-1]!=="="))return mQ(YJ(Q,"Found a '=' character, but it is not at the end"));try{let D=Q.endsWith("==")?2:Q.endsWith("=")?1:0,C=new Uint8Array(3*(B/4)-D);for(let G=0,H=0;G<B;G+=4,H+=3){let Z=Jh(Q.charCodeAt(G))<<18|Jh(Q.charCodeAt(G+1))<<12|Jh(Q.charCodeAt(G+2))<<6|Jh(Q.charCodeAt(G+3));C[H]=Z>>16,C[H+1]=Z>>8&255,C[H+2]=Z&255}return cQ(C)}catch(D){return mQ(YJ(Q,D instanceof Error?D.message:"Invalid input"))}},zAA=(A)=>A.replace(/[\n\r]/g,"");function Jh(A){if(A>=mUA.length)throw TypeError(`Invalid character ${String.fromCharCode(A)}`);let Q=mUA[A];if(Q===255)throw TypeError(`Invalid character ${String.fromCharCode(A)}`);return Q}var yF=["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","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","0","1","2","3","4","5","6","7","8","9","+","/"],mUA=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];var qAA=(A)=>XT(A).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),uUA=(A)=>{let Q=zAA(A),B=Q.length;if(B%4===1)return mQ(YJ(Q,`Length should be a multiple of 4, but is ${B}`));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(Q))return mQ(YJ(Q,"Invalid input"));let I=B%4===2?`${Q}==`:B%4===3?`${Q}=`:Q;return I=I.replace(/-/g,"+").replace(/_/g,"/"),Gh(I)};var OAA=(A)=>{let Q="";for(let B=0;B<A.length;++B)Q+=OnA[A[B]];return Q},lUA=(A)=>{let Q=new TextEncoder().encode(A);if(Q.length%2!==0)return mQ(YJ(A,`Length must be a multiple of 2, but is ${Q.length}`));try{let B=Q.length/2,I=new Uint8Array(B);for(let D=0;D<B;D++){let C=cUA(Q[D*2]),G=cUA(Q[D*2+1]);I[D]=C<<4|G}return cQ(I)}catch(B){return mQ(YJ(A,B instanceof Error?B.message:"Invalid input"))}},OnA=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],cUA=(A)=>{if(48<=A&&A<=57)return A-48;if(97<=A&&A<=102)return A-97+10;if(65<=A&&A<=70)return A-65+10;throw TypeError("Invalid input")};var VAA=(A)=>typeof A==="string"?XT(Eh.encode(A)):XT(A),wAA=(A)=>Gh(A),dUA=(A)=>V8(wAA(A),(Q)=>Ch.decode(Q)),NAA=(A)=>typeof A==="string"?qAA(Eh.encode(A)):qAA(A),RAA=(A)=>uUA(A),pUA=(A)=>V8(RAA(A),(Q)=>Ch.decode(Q)),LAA=(A)=>typeof A==="string"?OAA(Eh.encode(A)):OAA(A),MAA=(A)=>lUA(A),oUA=(A)=>V8(MAA(A),(Q)=>Ch.decode(Q)),nUA=(A)=>GK({try:()=>encodeURIComponent(A),catch:(Q)=>NnA(A,Q instanceof Error?Q.message:"Invalid input")}),iUA=(A)=>GK({try:()=>decodeURIComponent(A),catch:(Q)=>wnA(A,Q instanceof Error?Q.message:"Invalid input")});var wnA=YJ;var NnA=hUA;class Fh{[Symbol.iterator](){return this}next(A){return{value:A,done:!0}}}Fh.nil=new Fh;function rUA(){return Fh.nil}function*sUA(A,Q){for(let B of A)yield Q(B)}function*tUA(A,Q){for(let B of A)yield*Q(B)}function*aUA(A,Q){for(let B of A)if(Q(B))yield B}function*eUA(A,Q){for(let B=0;B<Q;++B){let I=A.next();if(I.done)break;yield I.value}}function*A$A(A,Q){let B=A.next();while(!B.done&&Q(B.value))yield B.value,B=A.next()}function*Q$A(A,Q){for(let B=A.next();!B.done;B=A.next())yield B.value;for(let B of Q)for(let I=B.next();!I.done;I=B.next())yield I.value}var LnA=Symbol.iterator;class IC{static nil(){return new IC(rUA())}static of(...A){return new IC(A[LnA]())}constructor(A){this.g=A}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(A){return new IC(sUA(this.g,A))}flatMap(A){return new IC(tUA(this.g,A))}dropWhile(A){let Q=!1;function*B(I){if(Q||!A(I))Q=!0,yield I}return this.flatMap(B)}drop(A){if(A<=0)return this;let Q=0;function B(){return Q++<A}return this.dropWhile(B)}takeWhile(A){return new IC(A$A(this.g,A))}take(A){return new IC(eUA(this.g,A))}filter(A){return new IC(aUA(this.g,A))}every(A){for(let Q of this.g)if(!A(Q))return!1;return!0}has(A){for(let Q of this.g)if(A(Q))return[!0,Q];return[!1,null]}join(...A){return new IC(Q$A(this.g,A))}getNthOrLast(A){let Q=A,B=null;for(let I of this.g){if(Q--===0)return I;B=I}return B}}function PAA(A){return new IC(A)}var gF=Symbol.for("fast-check/cloneMethod");function ZT(A){return A!==null&&(typeof A==="object"||typeof A==="function")&&gF in A&&typeof A[gF]==="function"}function KT(A){return ZT(A)?A[gF]():A}var MnA=Object.defineProperty;class p0{constructor(A,Q,B=void 0){if(this.value_=A,this.context=Q,this.hasToBeCloned=B!==void 0||ZT(A),this.readOnce=!1,this.hasToBeCloned)MnA(this,"value",{get:B!==void 0?B:this.getValue});else this.value=A}getValue(){if(this.hasToBeCloned){if(!this.readOnce)return this.readOnce=!0,this.value_;return this.value_[gF]()}return this.value_}}var B$A=Object.assign;class KG{filter(A){return new E$A(this,A)}map(A,Q){return new D$A(this,A,Q)}chain(A){return new I$A(this,A)}noShrink(){return new C$A(this)}noBias(){return new J$A(this)}}class I$A extends KG{constructor(A,Q){super();this.arb=A,this.chainer=Q}generate(A,Q){let B=A.clone(),I=this.arb.generate(A,Q);return this.valueChainer(I,A,B,Q)}canShrinkWithoutContext(A){return!1}shrink(A,Q){if(this.isSafeContext(Q))return(!Q.stoppedForOriginal?this.arb.shrink(Q.originalValue,Q.originalContext).map((B)=>this.valueChainer(B,Q.clonedMrng.clone(),Q.clonedMrng,Q.originalBias)):IC.nil()).join(Q.chainedArbitrary.shrink(A,Q.chainedContext).map((B)=>{let I=B$A(B$A({},Q),{chainedContext:B.context,stoppedForOriginal:!0});return new p0(B.value_,I)}));return IC.nil()}valueChainer(A,Q,B,I){let D=this.chainer(A.value_),C=D.generate(Q,I),G={originalBias:I,originalValue:A.value_,originalContext:A.context,stoppedForOriginal:!1,chainedArbitrary:D,chainedContext:C.context,clonedMrng:B};return new p0(C.value_,G)}isSafeContext(A){return A!=null&&typeof A==="object"&&"originalBias"in A&&"originalValue"in A&&"originalContext"in A&&"stoppedForOriginal"in A&&"chainedArbitrary"in A&&"chainedContext"in A&&"clonedMrng"in A}}class D$A extends KG{constructor(A,Q,B){super();this.arb=A,this.mapper=Q,this.unmapper=B,this.bindValueMapper=(I)=>this.valueMapper(I)}generate(A,Q){let B=this.arb.generate(A,Q);return this.valueMapper(B)}canShrinkWithoutContext(A){if(this.unmapper!==void 0)try{let Q=this.unmapper(A);return this.arb.canShrinkWithoutContext(Q)}catch(Q){return!1}return!1}shrink(A,Q){if(this.isSafeContext(Q))return this.arb.shrink(Q.originalValue,Q.originalContext).map(this.bindValueMapper);if(this.unmapper!==void 0){let B=this.unmapper(A);return this.arb.shrink(B,void 0).map(this.bindValueMapper)}return IC.nil()}mapperWithCloneIfNeeded(A){let Q=A.value,B=this.mapper(Q);if(A.hasToBeCloned&&(typeof B==="object"&&B!==null||typeof B==="function")&&Object.isExtensible(B)&&!ZT(B))Object.defineProperty(B,gF,{get:()=>()=>this.mapperWithCloneIfNeeded(A)[0]});return[B,Q]}valueMapper(A){let[Q,B]=this.mapperWithCloneIfNeeded(A),I={originalValue:B,originalContext:A.context};return new p0(Q,I)}isSafeContext(A){return A!=null&&typeof A==="object"&&"originalValue"in A&&"originalContext"in A}}class E$A extends KG{constructor(A,Q){super();this.arb=A,this.refinement=Q,this.bindRefinementOnValue=(B)=>this.refinementOnValue(B)}generate(A,Q){while(!0){let B=this.arb.generate(A,Q);if(this.refinementOnValue(B))return B}}canShrinkWithoutContext(A){return this.arb.canShrinkWithoutContext(A)&&this.refinement(A)}shrink(A,Q){return this.arb.shrink(A,Q).filter(this.bindRefinementOnValue)}refinementOnValue(A){return this.refinement(A.value)}}class C$A extends KG{constructor(A){super();this.arb=A}generate(A,Q){return this.arb.generate(A,Q)}canShrinkWithoutContext(A){return this.arb.canShrinkWithoutContext(A)}shrink(A,Q){return IC.nil()}noShrink(){return this}}class J$A extends KG{constructor(A){super();this.arb=A}generate(A,Q){return this.arb.generate(A,void 0)}canShrinkWithoutContext(A){return this.arb.canShrinkWithoutContext(A)}shrink(A,Q){return this.arb.shrink(A,Q)}noBias(){return this}}var G$A=Function.prototype.apply,SAA=Symbol("apply");function PnA(A){try{return A.apply}catch(Q){return}}function SnA(A,Q,B){let I=A;I[SAA]=G$A;let D=I[SAA](Q,B);return delete I[SAA],D}function _U(A,Q,B){if(PnA(A)===G$A)return A.apply(Q,B);return SnA(A,Q,B)}var URQ=Array.prototype.forEach,F$A=Array.prototype.indexOf,$RQ=Array.prototype.join,H$A=Array.prototype.map,YRQ=Array.prototype.filter,X$A=Array.prototype.push,WRQ=Array.prototype.pop,zRQ=Array.prototype.splice,Z$A=Array.prototype.slice,qRQ=Array.prototype.sort,ORQ=Array.prototype.every;function TnA(A){try{return A.indexOf}catch(Q){return}}function _nA(A){try{return A.map}catch(Q){return}}function knA(A){try{return A.push}catch(Q){return}}function jnA(A){try{return A.slice}catch(Q){return}}function TAA(A,...Q){if(TnA(A)===F$A)return A.indexOf(...Q);return _U(F$A,A,Q)}function UT(A,Q){if(_nA(A)===H$A)return A.map(Q);return _U(H$A,A,[Q])}function $5(A,...Q){if(knA(A)===X$A)return A.push(...Q);return _U(X$A,A,Q)}function Hq(A,...Q){if(jnA(A)===Z$A)return A.slice(...Q);return _U(Z$A,A,Q)}var VRQ=Date.prototype.getTime,wRQ=Date.prototype.toISOString;var NRQ=Set.prototype.add,RRQ=Set.prototype.has;var LRQ=WeakMap.prototype.set,MRQ=WeakMap.prototype.get;var K$A=Map.prototype.set,U$A=Map.prototype.get;function ynA(A){try{return A.set}catch(Q){return}}function gnA(A){try{return A.get}catch(Q){return}}function $$A(A,Q,B){if(ynA(A)===K$A)return A.set(Q,B);return _U(K$A,A,[Q,B])}function Y$A(A,Q){if(gnA(A)===U$A)return A.get(Q);return _U(U$A,A,[Q])}var PRQ=String.prototype.split,SRQ=String.prototype.startsWith,TRQ=String.prototype.endsWith,_RQ=String.prototype.substring,kRQ=String.prototype.toLowerCase,jRQ=String.prototype.toUpperCase,yRQ=String.prototype.padStart,gRQ=String.prototype.charCodeAt,vRQ=String.prototype.normalize,bRQ=String.prototype.replace;var xRQ=Number.prototype.toString;class W$A{constructor(A){this.producer=A}[Symbol.iterator](){if(this.it===void 0)this.it=this.producer();return this.it}next(){if(this.it===void 0)this.it=this.producer();return this.it.next()}}function Hh(A){return new W$A(A)}var vnA={};function z$A(){return vnA}var{floor:bnA,log:q$A}=Math;function O$A(A){return bnA(q$A(A)/q$A(2))}function V$A(A,Q,B){if(A===Q)return[{min:A,max:Q}];if(A<0&&Q>0){let G=B(-A),H=B(Q);return[{min:-G,max:H},{min:Q-H,max:Q},{min:A,max:A+G}]}let I=B(Q-A),D={min:A,max:A+I},C={min:Q-I,max:Q};return A<0?[C,D]:[D,C]}var{ceil:xnA,floor:hnA}=Math;function w$A(A){return hnA(A/2)}function N$A(A){return xnA(A/2)}function _AA(A,Q,B){let I=A-Q;function*D(){let G=B?void 0:Q,H=B?I:w$A(I);for(let Z=H;Z>0;Z=w$A(Z)){let U=Z===I?Q:A-Z;yield new p0(U,G),G=U}}function*C(){let G=B?void 0:Q,H=B?I:N$A(I);for(let Z=H;Z<0;Z=N$A(Z)){let U=Z===I?Q:A-Z;yield new p0(U,G),G=U}}return I>0?PAA(D()):PAA(C())}var R$A=Math.sign,mnA=Number.isInteger,fnA=Object.is;class Xh extends KG{constructor(A,Q){super();this.min=A,this.max=Q}generate(A,Q){let B=this.computeGenerateRange(A,Q);return new p0(A.nextInt(B.min,B.max),void 0)}canShrinkWithoutContext(A){return typeof A==="number"&&mnA(A)&&!fnA(A,-0)&&this.min<=A&&A<=this.max}shrink(A,Q){if(!Xh.isValidContext(A,Q)){let B=this.defaultTarget();return _AA(A,B,!0)}if(this.isLastChanceTry(A,Q))return IC.of(new p0(Q,void 0));return _AA(A,Q,!1)}defaultTarget(){if(this.min<=0&&this.max>=0)return 0;return this.min<0?this.max:this.min}computeGenerateRange(A,Q){if(Q===void 0||A.nextInt(1,Q)!==1)return{min:this.min,max:this.max};let B=V$A(this.min,this.max,O$A);if(B.length===1)return B[0];let I=A.nextInt(-2*(B.length-1),B.length-2);return I<0?B[0]:B[I+1]}isLastChanceTry(A,Q){if(A>0)return A===Q+1&&A>this.min;if(A<0)return A===Q-1&&A<this.max;return!1}static isValidContext(A,Q){if(Q===void 0)return!1;if(typeof Q!=="number")throw Error("Invalid context type passed to IntegerArbitrary (#1)");if(Q!==0&&R$A(A)!==R$A(Q))throw Error("Invalid context value passed to IntegerArbitrary (#2)");return!0}}var L$A=Number.isInteger;function unA(A){let Q=A.min!==void 0?A.min:-2147483648,B=A.max!==void 0?A.max:2147483647;return{min:Q,max:B}}function kAA(A={}){let Q=unA(A);if(Q.min>Q.max)throw Error("fc.integer maximum value should be equal or greater than the minimum one");if(!L$A(Q.min))throw Error("fc.integer minimum value should be an integer");if(!L$A(Q.max))throw Error("fc.integer maximum value should be an integer");return new Xh(Q.min,Q.max)}var M$A=new Map;function P$A(A){if(A===void 0)return{depth:0};if(typeof A!=="string")return A;let Q=Y$A(M$A,A);if(Q!==void 0)return Q;let B={depth:0};return $$A(M$A,A,B),B}class jAA{constructor(A,Q,B){this.arb=A,this.mrng=Q,this.biasFactor=B}attemptExact(){return}next(){return this.arb.generate(this.mrng,this.biasFactor)}}var{min:cnA,max:lnA}=Math;class yAA{constructor(A,Q,B,I){this.arb=A,this.mrng=Q,this.slices=B,this.biasFactor=I,this.activeSliceIndex=0,this.nextIndexInSlice=0,this.lastIndexInSlice=-1}attemptExact(A){if(A!==0&&this.mrng.nextInt(1,this.biasFactor)===1){let Q=[];for(let B=0;B!==this.slices.length;++B)if(this.slices[B].length===A)$5(Q,B);if(Q.length===0)return;this.activeSliceIndex=Q[this.mrng.nextInt(0,Q.length-1)],this.nextIndexInSlice=0,this.lastIndexInSlice=A-1}}next(){if(this.nextIndexInSlice<=this.lastIndexInSlice)return new p0(this.slices[this.activeSliceIndex][this.nextIndexInSlice++],void 0);if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.arb.generate(this.mrng,this.biasFactor);this.activeSliceIndex=this.mrng.nextInt(0,this.slices.length-1);let A=this.slices[this.activeSliceIndex];if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.nextIndexInSlice=1,this.lastIndexInSlice=A.length-1,new p0(A[0],void 0);let Q=this.mrng.nextInt(0,A.length-1),B=this.mrng.nextInt(0,A.length-1);return this.nextIndexInSlice=cnA(Q,B),this.lastIndexInSlice=lnA(Q,B),new p0(A[this.nextIndexInSlice++],void 0)}}function gAA(A,Q,B,I){if(I===void 0||B.length===0||Q.nextInt(1,I)!==1)return new jAA(A,Q,I);return new yAA(A,Q,B,I)}var{floor:dnA,log:S$A,max:T$A}=Math,pnA=Array.isArray;function vAA(A,Q){if(A===Q)return A;return A+dnA(S$A(Q-A)/S$A(2))}class Zh extends KG{constructor(A,Q,B,I,D,C,G){super();this.arb=A,this.minLength=Q,this.maxGeneratedLength=B,this.maxLength=I,this.setBuilder=C,this.customSlices=G,this.lengthArb=kAA({min:Q,max:B}),this.depthContext=P$A(D)}preFilter(A){if(this.setBuilder===void 0)return A;let Q=this.setBuilder();for(let B=0;B!==A.length;++B)Q.tryAdd(A[B]);return Q.getData()}static makeItCloneable(A,Q){return A[gF]=()=>{let B=[];for(let I=0;I!==Q.length;++I)$5(B,Q[I].value);return this.makeItCloneable(B,Q),B},A}generateNItemsNoDuplicates(A,Q,B,I){let D=0,C=A(),G=gAA(this.arb,B,this.customSlices,I);while(C.size()<Q&&D<this.maxGeneratedLength){let H=G.next();if(C.tryAdd(H))D=0;else D+=1}return C.getData()}safeGenerateNItemsNoDuplicates(A,Q,B,I){let D=T$A(0,Q-vAA(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=D;try{return this.generateNItemsNoDuplicates(A,Q,B,I)}finally{this.depthContext.depth-=D}}generateNItems(A,Q,B){let I=[],D=gAA(this.arb,Q,this.customSlices,B);D.attemptExact(A);for(let C=0;C!==A;++C){let G=D.next();$5(I,G)}return I}safeGenerateNItems(A,Q,B){let I=T$A(0,A-vAA(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=I;try{return this.generateNItems(A,Q,B)}finally{this.depthContext.depth-=I}}wrapper(A,Q,B,I){let D=Q?this.preFilter(A):A,C=!1,G=[],H=[];for(let U=0;U!==D.length;++U){let O=D[U];C=C||O.hasToBeCloned,$5(G,O.value),$5(H,O.context)}if(C)Zh.makeItCloneable(G,D);let Z={shrunkOnce:Q,lengthContext:A.length===D.length&&B!==void 0?B:void 0,itemsContexts:H,startIndex:I};return new p0(G,Z)}generate(A,Q){let B=this.applyBias(A,Q),I=B.size,D=this.setBuilder!==void 0?this.safeGenerateNItemsNoDuplicates(this.setBuilder,I,A,B.biasFactorItems):this.safeGenerateNItems(I,A,B.biasFactorItems);return this.wrapper(D,!1,void 0,0)}applyBias(A,Q){if(Q===void 0)return{size:this.lengthArb.generate(A,void 0).value};if(this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(A,void 0).value,biasFactorItems:Q};if(A.nextInt(1,Q)!==1)return{size:this.lengthArb.generate(A,void 0).value};if(A.nextInt(1,Q)!==1||this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(A,void 0).value,biasFactorItems:Q};let B=vAA(this.minLength,this.maxGeneratedLength);return{size:kAA({min:this.minLength,max:B}).generate(A,void 0).value,biasFactorItems:Q}}canShrinkWithoutContext(A){if(!pnA(A)||this.minLength>A.length||A.length>this.maxLength)return!1;for(let B=0;B!==A.length;++B){if(!(B in A))return!1;if(!this.arb.canShrinkWithoutContext(A[B]))return!1}return this.preFilter(UT(A,(B)=>new p0(B,void 0))).length===A.length}shrinkItemByItem(A,Q,B){let I=[];for(let D=Q.startIndex;D<B;++D)$5(I,Hh(()=>this.arb.shrink(A[D],Q.itemsContexts[D]).map((C)=>{let G=UT(Hq(A,0,D),(Z,U)=>new p0(KT(Z),Q.itemsContexts[U])),H=UT(Hq(A,D+1),(Z,U)=>new p0(KT(Z),Q.itemsContexts[U+D+1]));return[[...G,C,...H],void 0,D]})));return IC.nil().join(...I)}shrinkImpl(A,Q){if(A.length===0)return IC.nil();let B=Q!==void 0?Q:{shrunkOnce:!1,lengthContext:void 0,itemsContexts:[],startIndex:0};return this.lengthArb.shrink(A.length,B.lengthContext).drop(B.shrunkOnce&&B.lengthContext===void 0&&A.length>this.minLength+1?1:0).map((I)=>{let D=A.length-I.value;return[UT(Hq(A,D),(C,G)=>new p0(KT(C),B.itemsContexts[G+D])),I.context,0]}).join(Hh(()=>A.length>this.minLength?this.shrinkItemByItem(A,B,1):this.shrinkItemByItem(A,B,A.length))).join(A.length>this.minLength?Hh(()=>{let I={shrunkOnce:!1,lengthContext:void 0,itemsContexts:Hq(B.itemsContexts,1),startIndex:0};return this.shrinkImpl(Hq(A,1),I).filter((D)=>this.minLength<=D[0].length+1).map((D)=>{return[[new p0(KT(A[0]),B.itemsContexts[0]),...D[0]],void 0,0]})}):IC.nil())}shrink(A,Q){return this.shrinkImpl(A,Q).map((B)=>this.wrapper(B[0],!0,B[1],B[2]))}}var{floor:onA,min:nnA}=Math,_$A=2147483647,Xq=["xsmall","small","medium","large","xlarge"],inA=["-4","-3","-2","-1","=","+1","+2","+3","+4"],rnA="small";function snA(A,Q){switch(Q){case"xsmall":return onA(1.1*A)+1;case"small":return 2*A+10;case"medium":return 11*A+100;case"large":return 101*A+1000;case"xlarge":return 1001*A+1e4;default:throw Error(`Unable to compute lengths based on received size: ${Q}`)}}function tnA(A,Q){let B=TAA(inA,A);if(B===-1)return A;let I=TAA(Xq,Q);if(I===-1)throw Error(`Unable to offset size based on the unknown defaulted one: ${Q}`);let D=I+B-4;return D<0?Xq[0]:D>=Xq.length?Xq[Xq.length-1]:Xq[D]}function k$A(A,Q,B,I){let{baseSize:D=rnA,defaultSizeToMaxWhenMaxSpecified:C}=z$A()||{},G=A!==void 0?A:I&&C?"max":D;if(G==="max")return B;let H=tnA(G,D);return nnA(snA(Q,H),B)}function bAA(A,Q={}){let B=Q.size,I=Q.minLength||0,D=Q.maxLength,C=Q.depthIdentifier,G=D!==void 0?D:_$A,Z=k$A(B,I,G,D!==void 0),U=Q.experimentalCustomSlices||[];return new Zh(A,I,Z,G,C,void 0,U)}var j$A=Symbol.for("effect/SchemaId/DateFromSelf"),y$A=Symbol.for("effect/SchemaId/GreaterThan"),g$A=Symbol.for("effect/SchemaId/GreaterThanOrEqualTo"),v$A=Symbol.for("effect/SchemaId/LessThan"),b$A=Symbol.for("effect/SchemaId/LessThanOrEqualTo"),x$A=Symbol.for("effect/SchemaId/Int"),h$A=Symbol.for("effect/SchemaId/NonNaN"),m$A=Symbol.for("effect/SchemaId/Finite"),f$A=Symbol.for("effect/SchemaId/JsonNumber"),u$A=Symbol.for("effect/SchemaId/Between"),c$A=Symbol.for("effect/SchemaId/GreaterThanBigint"),l$A=Symbol.for("effect/SchemaId/GreaterThanOrEqualToBigint"),d$A=Symbol.for("effect/SchemaId/LessThanBigint"),p$A=Symbol.for("effect/SchemaId/LessThanOrEqualToBigint"),o$A=Symbol.for("effect/SchemaId/BetweenBigint"),n$A=Symbol.for("effect/SchemaId/MinLength"),i$A=Symbol.for("effect/SchemaId/MaxLength"),r$A=Symbol.for("effect/SchemaId/Length"),s$A=Symbol.for("effect/SchemaId/MinItems"),t$A=Symbol.for("effect/SchemaId/MaxItems"),a$A=Symbol.for("effect/SchemaId/ItemsCount");var e$A=HAA,Kh=$UA,$T=YUA;var AYA=(A)=>$E((Q,B)=>A($T(Q),$T(B)));var QYA=y((A)=>$C(A[0]),(A,...Q)=>{let B={};for(let I of Q)if(I in A)B[I]=A[I];return B}),BYA=y((A)=>$C(A[0]),(A,...Q)=>{let B={...A};for(let I of Q)delete B[I];return B});var z5=Symbol.for("effect/Schema");function CI(A){return class{[z5]=xAA;static ast=A;static annotations(B){return CI(k1(this.ast,B))}static pipe(){return RQ(this,arguments)}static toString(){return String(A)}static Type;static Encoded;static Context;static[z5]=xAA}}var xAA={_A:(A)=>A,_I:(A)=>A,_R:(A)=>A},IYA=(A)=>Rb(A)?A.value:QiA(PS(A.cause)),QiA=(A)=>({issues:[{message:A}]}),BiA=(A)=>U4(Dq.formatIssue(A),(Q)=>({issues:Q.map((B)=>({path:B.path,message:B.message}))})),IiA=(A,Q)=>{let B=l0(A,{errors:"all"});return class extends CI(A.ast){static "~standard"={version:1,vendor:"effect",validate(D){let C=new eK,G=lS(Ie(B(D,Q),{onFailure:BiA,onSuccess:(Z)=>aa({value:Z})}),{scheduler:C});C.flush();let H=G.unsafePoll();if(H)return IYA(H);return new Promise((Z)=>{G.addObserver((U)=>{Z(IYA(U))})})}}}},DYA={typeConstructor:dZA,schemaId:pZA,message:Ze,missingMessage:yx,identifier:iS,title:S1,description:jF,examples:Ke,default:Ue,documentation:oZA,jsonSchema:$e,arbitrary:Ye,pretty:We,equivalence:gx,concurrency:ze,batching:qe,parseIssueTitle:Oe,parseOptions:Ve,decodingFallback:we},xF=(A)=>{if(!A)return{};let Q={...A};for(let B in DYA)if(B in A){let I=DYA[B];Q[I]=A[B],delete Q[B]}return Q},k1=(A,Q)=>IT(A,xF(Q));function kD(A){return A}var aD=(A)=>String(A.ast),Lh=(A)=>CI(DT(A.ast)),wQA=(A)=>CI(jKA(A.ast)),dB=(A)=>CI(xD(A.ast)),Mh=(A,Q)=>{let B=d0(A,Q);return(I,D)=>H5(B(I,D),ZG)},LYA=(A,Q)=>{let B=Qh(A,Q);return(I,D)=>Q4(B(I,D),ZG)},MYA=(A,Q)=>{let B=Mh(A,Q);return(I,D)=>TF(B(I,D))},Ph=Mh,DiA=LYA,EiA=MYA,gU=(A,Q)=>{let B=l0(A,Q);return(I,D)=>H5(B(I,D),ZG)},PYA=(A,Q)=>{let B=FT(A,Q);return(I,D)=>Q4(B(I,D),ZG)},SYA=(A,Q)=>{let B=gU(A,Q);return(I,D)=>TF(B(I,D))},CiA=gU,JiA=PYA,GiA=SYA,TYA=(A,Q)=>{let B=Bh(A,Q);return(I,D)=>H5(B(I,D),ZG)},FiA=(A,Q)=>{let B=te(A,Q);return(I,D)=>Q4(B(I,D),ZG)},HiA=(A,Q)=>{let B=TYA(A,Q);return(I,D)=>TF(B(I,D))},dC=(A)=>VQ(A,z5)&&$C(A[z5]);function XiA(A){return cx(A)?qE.make(wKA(A,(Q)=>new HG(Q))):new HG(A[0])}function _YA(A,Q=XiA(A)){return class extends CI(Q){static annotations(I){return _YA(this.literals,k1(this.ast,I))}static literals=[...A]}}function GE(...A){return LD(A)?_YA(A):_h}var ZiA=(...A)=>(Q)=>GE(...A),kYA=(A)=>CI(new Aq(A)),KiA=(A)=>new je(Object.keys(A).filter((Q)=>typeof A[A[Q]]!=="number").map((Q)=>[Q,A[Q]])),jYA=(A,Q=KiA(A))=>class extends CI(Q){static annotations(I){return jYA(this.enums,k1(this.ast,I))}static enums={...A}},UiA=(A)=>jYA(A),yYA=(...[A,...Q])=>{let B=[],I="",D=Q;if(dC(A))if(XG(A.ast))I=String(A.ast.literal);else D=[A,...D];else I=String(A);for(let C=0;C<D.length;C++){let G=D[C];if(dC(G)){if(C<D.length-1){let H=D[C+1];if(dC(H)){if(XG(H.ast)){B.push(new NU(G.ast,String(H.ast.literal))),C++;continue}}else{B.push(new NU(G.ast,String(H))),C++;continue}}B.push(new NU(G.ast,""))}else B.push(new NU(new HG(G),""))}if(d9(B))return CI(new fx(I,B));else return CI(new fx("",[new NU(new HG(I),"")]))};function gYA(A,Q){let B=A.ast;switch(B._tag){case"Literal":{let I=B.literal;if(!cE(I)){let D=String(I);return xB(GE(D),Q,{strict:!0,decode:()=>I,encode:()=>D})}break}case"NumberKeyword":return Yh(uQA,Q);case"Union":{let I=[],D=!1;for(let C of B.types){let G=CI(C),H=Lh(G),Z=gYA(H,G);if(Z)D=!0;I.push(Z??G)}return D?Yh(pC(...I),Q):Q}}}var $iA=(...A)=>{let Q=[],B=[],I=[],D=!1;for(let Z=0;Z<A.length;Z++){let U=A[Z],O=dC(U)?U:GE(U);I.push(O);let w=Lh(O);Q.push(w);let L=gYA(w,O);if(L)B.push(L),D=!0;else B.push(O)}let C=yYA(...Q),G=SKA(C.ast),H=WJ(...B);if(D)H=H.annotations({[I5]:aD(WJ(...I))});return class extends oE(C,H,{strict:!1,decode:(U,O,w)=>{let L=G.exec(U);return L?ZD(L.slice(1,A.length+1)):_E(new eB(w,U,`${G.source}: no match for ${JSON.stringify(U)}`))},encode:(U)=>ZD(U.join(""))}){static params=A.slice()}},YiA=(A,Q,B)=>NQA(A,new ez(A.map((I)=>I.ast),(...I)=>Q.decode(...I.map(CI)),(...I)=>Q.encode(...I.map(CI)),xF(B))),WiA=(A,Q)=>{let B=()=>(D,C,G)=>A(D)?ZD(D):_E(new eB(G,D));return NQA([],new ez([],B,B,xF(Q)))};function NQA(A,Q){return class extends CI(Q){static annotations(I){return NQA(this.typeParameters,k1(this.ast,I))}static typeParameters=[...A]}}var kE=function(){if(Array.isArray(arguments[0])){let B=arguments[0],I=arguments[1],D=arguments[2];return YiA(B,I,D)}let A=arguments[0],Q=arguments[1];return WiA(A,Q)},hAA=Symbol.for("effect/SchemaId/Brand"),ziA=(A,Q)=>(B)=>{return PQA(B,new J5(B.ast,function(C,G,H){let Z=A.either(C);return dI(Z)?oA(new eB(H,C,Z.left.map((U)=>U.message).join(", "))):pA()},xF({schemaId:hAA,[hAA]:{constructor:A},...Q})))},mAA=Symbol.for("effect/SchemaId/InstanceOf"),vYA=(A,Q)=>kE((B)=>B instanceof A,{title:A.name,description:`an instance of ${A.name}`,pretty:()=>String,schemaId:mAA,[mAA]:{constructor:A},...Q});class Sh extends CI(wU){}class bYA extends CI(DKA){}class Th extends CI(QKA){}class _h extends CI(aS){}class $q extends CI(Se){}class xYA extends CI(Te){}class V5 extends CI(ZKA){}class kh extends CI(UKA){}class iI extends CI(bx){}class X2 extends CI(xx){}class Yq extends CI(hx){}class hYA extends CI(YKA){}var qiA=(A)=>qE.make(A.map((Q)=>Q.ast));function mYA(A,Q=qiA(A)){return class extends CI(Q){static annotations(I){return mYA(this.members,k1(this.ast,I))}static members=[...A]}}function pC(...A){return cx(A)?mYA(A):LD(A)?A[0]:_h}var zT=(A)=>pC(A,Th),jU=(A)=>pC(A,Sh),qT=(A)=>pC(A,Th,Sh),OiA=(A)=>CI(MKA(A.ast)),fAA=(A)=>new jh(new T1(A.ast,!1),A),ViA=(A)=>new jh(new T1(A.ast,!0),A);class jh{ast;from;[z5];_Token;constructor(A,Q){this.ast=A,this.from=Q}annotations(A){return new jh(new T1(this.ast.type,this.ast.isOptional,{...this.ast.annotations,...xF(A)}),this.from)}toString(){return`${this.ast.type}${this.ast.isOptional?"?":""}`}}var wiA=(A,Q)=>new E5(A.map((B)=>dC(B)?new T1(B.ast,!1):B.ast),Q.map((B)=>dC(B)?new RU(B.ast):B.ast),!0);function OT(A,Q,B=wiA(A,Q)){return class extends CI(B){static annotations(D){return OT(this.elements,this.rest,k1(this.ast,D))}static elements=[...A];static rest=[...Q]}}function WJ(...A){return Array.isArray(A[0])?OT(A[0],A.slice(1)):OT(A,[])}function fYA(A,Q){return class extends OT([],[A],Q){static annotations(I){return fYA(this.value,k1(this.ast,I))}static value=A}}var eD=(A)=>fYA(A);function uYA(A,Q){return class extends OT([A],[A],Q){static annotations(I){return uYA(this.value,k1(this.ast,I))}static value=A}}var Wq=(A)=>uYA(A);function NiA(A){return xB(pC(A,eD(A)),eD(dB(kD(A))),{strict:!0,decode:(Q)=>$g(Q),encode:(Q)=>Q.length===1?Q[0]:Q})}function RiA(A){return xB(pC(A,Wq(A)),Wq(dB(kD(A))),{strict:!0,decode:(Q)=>LD(Q)?Q:zC(Q),encode:(Q)=>Q.length===1?Q[0]:Q})}var uAA=(A)=>A?'"?:"':'":"';class q5 extends T1{isReadonly;defaultValue;_tag="PropertySignatureDeclaration";constructor(A,Q,B,I,D){super(A,Q,I);this.isReadonly=B,this.defaultValue=D}toString(){let A=uAA(this.isOptional),Q=String(this.type);return`PropertySignature<${A}, ${Q}, never, ${A}, ${Q}>`}}class O5 extends T1{isReadonly;fromKey;constructor(A,Q,B,I,D){super(A,Q,I);this.isReadonly=B,this.fromKey=D}}class UG extends T1{isReadonly;defaultValue;constructor(A,Q,B,I,D){super(A,Q,I);this.isReadonly=B,this.defaultValue=D}}var LiA=(A)=>{if(A===void 0)return"never";if(cE(A))return JSON.stringify(A);return String(A)};class p3{from;to;decode;encode;_tag="PropertySignatureTransformation";constructor(A,Q,B,I){this.from=A,this.to=Q,this.decode=B,this.encode=I}toString(){return`PropertySignature<${uAA(this.to.isOptional)}, ${this.to.type}, ${LiA(this.from.fromKey)}, ${uAA(this.from.isOptional)}, ${this.from.type}>`}}var cYA=(A,Q)=>{switch(A._tag){case"PropertySignatureDeclaration":return new q5(A.type,A.isOptional,A.isReadonly,{...A.annotations,...Q},A.defaultValue);case"PropertySignatureTransformation":return new p3(A.from,new UG(A.to.type,A.to.isOptional,A.to.isReadonly,{...A.to.annotations,...Q},A.to.defaultValue),A.decode,A.encode)}},RQA=Symbol.for("effect/PropertySignature"),yh=(A)=>VQ(A,RQA);class gh{ast;[z5];[RQA]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(A){this.ast=A}pipe(){return RQ(this,arguments)}annotations(A){return new gh(cYA(this.ast,xF(A)))}toString(){return String(this.ast)}}var $G=(A)=>new gh(A);class NT extends gh{from;constructor(A,Q){super(A);this.from=Q}annotations(A){return new NT(cYA(this.ast,xF(A)),this.from)}}var Kq=(A)=>new NT(new q5(A.ast,!1,!0,{},void 0),A),Y5=y(2,(A,Q)=>{let B=A.ast;switch(B._tag){case"PropertySignatureDeclaration":return $G(new q5(B.type,B.isOptional,B.isReadonly,B.annotations,Q));case"PropertySignatureTransformation":return $G(new p3(B.from,new UG(B.to.type,B.to.isOptional,B.to.isReadonly,B.to.annotations,Q),B.decode,B.encode))}}),EYA=(A,Q)=>gI(A,{onNone:()=>oA(Q()),onSome:(B)=>oA(B===void 0?Q():B)}),Uh=(A)=>gKA(A,Uh,(Q)=>{let B=Uh(Q.to);if(B)return new k2(Q.from,B,Q.transformation)}),lYA=y(2,(A,Q)=>{let B=A.ast;switch(B._tag){case"PropertySignatureDeclaration":{let I=xD(B.type);return $G(new p3(new O5(B.type,B.isOptional,B.isReadonly,B.annotations),new UG(Uh(I)??I,!1,!0,{},B.defaultValue),(D)=>EYA(D,Q),rQ))}case"PropertySignatureTransformation":{let I=B.to.type;return $G(new p3(B.from,new UG(Uh(I)??I,!1,B.to.isReadonly,B.to.annotations,B.to.defaultValue),(D)=>EYA(B.decode(D),Q),B.encode))}}}),MiA=y(2,(A,Q)=>A.pipe(lYA(Q.decoding),Y5(Q.constructor))),PiA=y(2,(A,Q)=>{let B=A.ast;switch(B._tag){case"PropertySignatureDeclaration":return $G(new p3(new O5(B.type,B.isOptional,B.isReadonly,B.annotations,Q),new UG(xD(B.type),B.isOptional,B.isReadonly,{},B.defaultValue),rQ,rQ));case"PropertySignatureTransformation":return $G(new p3(new O5(B.from.type,B.from.isOptional,B.from.isReadonly,B.from.annotations,Q),B.to,B.decode,B.encode))}}),vF=(A,Q,B)=>$G(new p3(new O5(A.ast,!0,!0,{},void 0),new UG(Q.ast,!1,!0,{},void 0),(I)=>oA(B.decode(I)),R8(B.encode))),SiA=(A,Q,B)=>$G(new p3(new O5(A.ast,!1,!0,{},void 0),new UG(Q.ast,!0,!0,{},void 0),R8(B.decode),(I)=>oA(B.encode(I)))),cAA=(A,Q,B)=>$G(new p3(new O5(A.ast,!0,!0,{},void 0),new UG(Q.ast,!0,!0,{},void 0),B.decode,B.encode)),TiA=(A,Q)=>{let B=Q?.exact,I=Q?.default,D=Q?.nullable,C=Q?.as=="Option",G=Q?.onNoneEncoding?a4(Q.onNoneEncoding):rQ;if(B)if(I)if(D)return Y5(vF(zT(A),dB(A),{decode:gI({onNone:I,onSome:(H)=>H===null?I():H}),encode:oA}),I).ast;else return Y5(vF(A,dB(A),{decode:gI({onNone:I,onSome:rQ}),encode:oA}),I).ast;else if(C){let H=HQA(dB(A));if(D)return vF(zT(A),H,{decode:ZK(ay),encode:G}).ast;else return vF(A,H,{decode:rQ,encode:rQ}).ast}else if(D)return cAA(zT(A),dB(A),{decode:ZK(ay),encode:rQ}).ast;else return new q5(A.ast,!0,!0,{},void 0);else if(I)if(D)return Y5(vF(qT(A),dB(A),{decode:gI({onNone:I,onSome:(H)=>H==null?I():H}),encode:oA}),I).ast;else return Y5(vF(jU(A),dB(A),{decode:gI({onNone:I,onSome:(H)=>H===void 0?I():H}),encode:oA}),I).ast;else if(C){let H=HQA(dB(A));if(D)return vF(qT(A),H,{decode:ZK((Z)=>Z!=null),encode:G}).ast;else return vF(jU(A),H,{decode:ZK(R2A),encode:G}).ast}else if(D)return cAA(qT(A),jU(dB(A)),{decode:ZK(ay),encode:rQ}).ast;else return new q5(jU(A).ast,!0,!0,{},void 0)},_iA=(A)=>{let Q=A.ast===wU||A.ast===aS?wU:jU(A).ast;return new NT(new q5(Q,!0,!0,{},void 0),A)},kiA=y((A)=>dC(A[0]),(A,Q)=>{return new NT(TiA(A,Q),A)}),jiA=xe([yx]),yiA=(A,Q)=>{let B=Reflect.ownKeys(A),I=[];if(B.length>0){let C=[],G=[],H=[];for(let Z=0;Z<B.length;Z++){let U=B[Z],O=A[U];if(yh(O)){let w=O.ast;switch(w._tag){case"PropertySignatureDeclaration":{let{type:L,isOptional:P,annotations:k}=w;C.push(new JE(U,L,P,!0,jiA(w))),G.push(new JE(U,xD(L),P,!0,k)),I.push(new JE(U,L,P,!0,k));break}case"PropertySignatureTransformation":{let L=w.from.fromKey??U;C.push(new JE(L,w.from.type,w.from.isOptional,!0,w.from.annotations)),G.push(new JE(U,w.to.type,w.to.isOptional,!0,w.to.annotations)),H.push(new QT(L,U,w.decode,w.encode));break}}}else C.push(new JE(U,O.ast,!1,!0)),G.push(new JE(U,xD(O.ast),!1,!0)),I.push(new JE(U,O.ast,!1,!0))}if(LD(H)){let Z=[],U=[];for(let O of Q){let{indexSignatures:w,propertySignatures:L}=be(O.key.ast,O.value.ast);L.forEach((P)=>{C.push(P),G.push(new JE(P.name,xD(P.type),P.isOptional,P.isReadonly,P.annotations))}),w.forEach((P)=>{Z.push(P),U.push(new C5(P.parameter,xD(P.type),P.isReadonly))})}return new k2(new H2(C,Z,{[I5]:"Struct (Encoded side)"}),new H2(G,U,{[I5]:"Struct (Type side)"}),new F5(H))}}let D=[];for(let C of Q){let{indexSignatures:G,propertySignatures:H}=be(C.key.ast,C.value.ast);H.forEach((Z)=>I.push(Z)),G.forEach((Z)=>D.push(Z))}return new H2(I,D)},dYA=(A,Q)=>{let B=Reflect.ownKeys(A);for(let I of B){let D=A[I];if(Q[I]===void 0&&yh(D)){let C=D.ast,G=C._tag==="PropertySignatureDeclaration"?C.defaultValue:C.to.defaultValue;if(G!==void 0)Q[I]=G()}}return Q};function LQA(A,Q,B=yiA(A,Q)){return class extends CI(B){static annotations(D){return LQA(this.fields,this.records,k1(this.ast,D))}static fields={...A};static records=[...Q];static make=(D,C)=>{let G=dYA(A,{...D});return dh(C)?G:Z5(this)(G)};static pick(...D){return FE(QYA(A,...D))}static omit(...D){return FE(BYA(A,...D))}}}function FE(A,...Q){return LQA(A,Q)}var pYA=(A)=>GE(A).pipe(Kq,Y5(()=>A)),RT=(A,Q)=>FE({_tag:pYA(A),...Q});function oYA(A,Q,B){return class extends LQA({},[{key:A,value:Q}],B){static annotations(D){return oYA(A,Q,k1(this.ast,D))}static key=A;static value=Q}}var MQA=(A)=>oYA(A.key,A.value),nYA=(...A)=>(Q)=>CI(h3(Q.ast,A)),giA=(...A)=>(Q)=>CI(_KA(Q.ast,A)),viA=y(2,(A,Q)=>{let B=B5(xD(A.ast),Q),I=CI(B.isOptional?oS(B.type):B.type);return xB(A.pipe(nYA(Q)),I,{strict:!0,decode:(C)=>C[Q],encode:(C)=>B.isOptional&&C===void 0?{}:{[Q]:C}})});function PQA(A,Q){return class extends CI(Q){static annotations(I){return PQA(this.from,k1(this.ast,I))}static make=(I,D)=>{return dh(D)?I:Z5(this)(I)};static from=A}}var biA=(A,Q)=>(B)=>{let I=gI(Ne(B.ast),{onNone:()=>[A],onSome:(C)=>[...C,A]}),D=IT(B.ast,xF({[Xe]:I,...Q}));return PQA(B,D)},xiA=(A)=>CI(VU(A.ast)),hiA=y((A)=>dC(A[0]),(A,Q)=>CI(VU(A.ast,Q))),miA=(A)=>CI(az(A.ast)),fiA=(A)=>CI(OU(A.ast)),YT=(A,Q,B)=>{if(ye(A)&&ye(Q)){let I=[...A.propertySignatures];for(let D of Q.propertySignatures){let C=D.name,G=I.findIndex((H)=>H.name===C);if(G===-1)I.push(D);else{let{isOptional:H,type:Z}=I[G];I[G]=new JE(C,$h(Z,D.type,B.concat(C)),H,!0)}}return new H2(I,A.indexSignatures.concat(Q.indexSignatures))}throw Error(Ce(A,Q,B))},uiA=kKA([iS]),WT=(A,Q)=>Q.map((B)=>new J5(B,A.filter,uiA(A))),$h=(A,Q,B)=>qE.make(bF([A],[Q],B)),kU=(A)=>AT(A)?A.types:[A],bF=(A,Q,B)=>UK(A,(I)=>UK(Q,(D)=>{switch(D._tag){case"Literal":{if(cE(D.literal)&&eS(I)||z8(D.literal)&&_e(I)||q3(D.literal)&&ke(I))return[D];break}case"StringKeyword":{if(D===bx){if(eS(I)||XG(I)&&cE(I.literal))return[I];else if(G5(I))return WT(I,bF(kU(I.from),[D],B))}else if(I===bx)return[D];break}case"NumberKeyword":{if(D===xx){if(_e(I)||XG(I)&&z8(I.literal))return[I];else if(G5(I))return WT(I,bF(kU(I.from),[D],B))}else if(I===xx)return[D];break}case"BooleanKeyword":{if(D===hx){if(ke(I)||XG(I)&&q3(I.literal))return[I];else if(G5(I))return WT(I,bF(kU(I.from),[D],B))}else if(I===hx)return[D];break}case"Union":return bF(kU(I),D.types,B);case"Suspend":return[new m3(()=>$h(I,D.f(),B))];case"Refinement":return WT(D,bF(kU(I),kU(D.from),B));case"TypeLiteral":{switch(I._tag){case"Union":return bF(I.types,[D],B);case"Suspend":return[new m3(()=>$h(I.f(),D,B))];case"Refinement":return WT(I,bF(kU(I.from),[D],B));case"TypeLiteral":return[YT(I,D,B)];case"Transformation":{let C=I.transformation,G=YT(I.from,D,B),H=YT(I.to,xD(D),B);switch(C._tag){case"TypeLiteralTransformation":return[new k2(G,H,new F5(C.propertySignatureTransformations))];case"ComposeTransformation":return[new k2(G,H,px)];case"FinalTransformation":return[new k2(G,H,new dx((Z,U,O,w)=>lC(C.decode(Z,U,O,w),(L)=>({...Z,...L})),(Z,U,O,w)=>lC(C.encode(Z,U,O,w),(L)=>({...Z,...L}))))]}}}break}case"Transformation":{if(NKA(I)){if(BT(D.transformation)&&BT(I.transformation))return[new k2(YT(I.from,D.from,B),YT(I.to,D.to,B),new F5(D.transformation.propertySignatureTransformations.concat(I.transformation.propertySignatureTransformations)))]}else return bF([D],[I],B);break}}throw Error(Ce(I,D,B))})),LT=y(2,(A,Q)=>CI($h(A.ast,Q.ast,[]))),Yh=y((A)=>dC(A[1]),(A,Q)=>TQA(A,Q,me(A.ast,Q.ast))),Wh=(A)=>CI(new m3(()=>A().ast)),SQA=Symbol.for("effect/SchemaId/Refine");function iYA(A,Q,B){return class extends CI(B){static annotations(D){return iYA(this.from,this.filter,k1(this.ast,D))}static[SQA]=A;static from=A;static filter=Q;static make=(D,C)=>{return dh(C)?D:Z5(this)(D)}}}var CYA=(A,Q,B)=>{if(q3(A))return A?pA():oA(new eB(Q,B));if(cE(A))return oA(new eB(Q,B,A));if(A!==void 0){if("_tag"in A)return oA(A);let I=new eB(Q,B,A.message);return oA(LD(A.path)?new wC(A.path,B,I):I)}return pA()},rYA=(A,Q,B)=>{if(gZA(A))return CYA(A,Q,B);if(LD(A)){let I=zH(A,(D)=>CYA(D,Q,B));if(LD(I))return oA(I.length===1?I[0]:new pE(Q,B,I))}return pA()};function pB(A,Q){return(B)=>{function I(C,G,H){return rYA(A(C,G,H),H,C)}let D=new J5(B.ast,I,xF(Q));return iYA(B,I,D)}}var ciA=y(2,(A,Q)=>oE(A,dB(A),{strict:!0,decode:(B,I,D)=>_1(Q(B,I,D),(C)=>gI(rYA(C,D,B),{onNone:()=>ZD(B),onSome:_E})),encode:(B)=>ZD(B)}));function TQA(A,Q,B){return class extends CI(B){static annotations(D){return TQA(this.from,this.to,k1(this.ast,D))}static from=A;static to=Q}}var oE=y((A)=>dC(A[0])&&dC(A[1]),(A,Q,B)=>TQA(A,Q,new k2(A.ast,Q.ast,new dx(B.decode,B.encode)))),xB=y((A)=>dC(A[0])&&dC(A[1]),(A,Q,B)=>oE(A,Q,{strict:!0,decode:(I,D,C,G)=>ZD(B.decode(I,G)),encode:(I,D,C,G)=>ZD(B.encode(I,G))}));function sYA(A,Q){return xB(GE(A),GE(Q),{strict:!0,decode:()=>Q,encode:()=>A})}function liA(...A){return pC(...A.map(([Q,B])=>sYA(Q,B)))}var diA=y((A)=>dC(A[0]),(A,Q,B,I)=>{let D=LT(dB(A),FE({[Q]:c9(B)?kYA(B):GE(B)})).ast;return CI(new k2(A.ast,I?k1(D,I):D,new F5([new QT(Q,Q,()=>oA(B),()=>pA())])))}),piA=y(2,(A,Q)=>A.annotations(Q)),oiA=y(2,(A,Q)=>CI(nS(A.ast,Q))),tYA=Symbol.for("effect/SchemaId/Trimmed"),aYA=(A)=>(Q)=>Q.pipe(pB((B)=>B===B.trim(),{schemaId:tYA,title:"trimmed",description:"a string with no leading or trailing whitespace",jsonSchema:{pattern:"^\\S[\\s\\S]*\\S$|^\\S$|^$"},...A})),eYA=i$A,niA=(A,Q)=>(B)=>B.pipe(pB((I)=>I.length<=A,{schemaId:eYA,title:`maxLength(${A})`,description:`a string at most ${A} character(s) long`,jsonSchema:{maxLength:A},...Q})),AWA=n$A,QWA=(A,Q)=>(B)=>B.pipe(pB((I)=>I.length>=A,{schemaId:AWA,title:`minLength(${A})`,description:`a string at least ${A} character(s) long`,jsonSchema:{minLength:A},...Q})),lAA=r$A,BWA=(A,Q)=>(B)=>{let I=$C(A)?Math.max(0,Math.floor(A.min)):Math.max(0,Math.floor(A)),D=$C(A)?Math.max(I,Math.floor(A.max)):I;if(I!==D)return B.pipe(pB((C)=>C.length>=I&&C.length<=D,{schemaId:lAA,title:`length({ min: ${I}, max: ${D})`,description:`a string at least ${I} character(s) and at most ${D} character(s) long`,jsonSchema:{minLength:I,maxLength:D},...Q}));return B.pipe(pB((C)=>C.length===I,{schemaId:lAA,title:`length(${I})`,description:I===1?"a single character":`a string ${I} character(s) long`,jsonSchema:{minLength:I,maxLength:I},...Q}))},dAA=Symbol.for("effect/SchemaId/Pattern"),_QA=(A,Q)=>(B)=>{let I=A.source;return B.pipe(pB((D)=>{return A.lastIndex=0,A.test(D)},{schemaId:dAA,[dAA]:{regex:A},description:`a string matching the pattern ${I}`,jsonSchema:{pattern:I},...Q}))},pAA=Symbol.for("effect/SchemaId/StartsWith"),iiA=(A,Q)=>(B)=>{let I=JSON.stringify(A);return B.pipe(pB((D)=>D.startsWith(A),{schemaId:pAA,[pAA]:{startsWith:A},title:`startsWith(${I})`,description:`a string starting with ${I}`,jsonSchema:{pattern:`^${A}`},...Q}))},oAA=Symbol.for("effect/SchemaId/EndsWith"),riA=(A,Q)=>(B)=>{let I=JSON.stringify(A);return B.pipe(pB((D)=>D.endsWith(A),{schemaId:oAA,[oAA]:{endsWith:A},title:`endsWith(${I})`,description:`a string ending with ${I}`,jsonSchema:{pattern:`^.*${A}$`},...Q}))},nAA=Symbol.for("effect/SchemaId/Includes"),siA=(A,Q)=>(B)=>{let I=JSON.stringify(A);return B.pipe(pB((D)=>D.includes(A),{schemaId:nAA,[nAA]:{includes:A},title:`includes(${I})`,description:`a string including ${I}`,jsonSchema:{pattern:`.*${A}.*`},...Q}))},IWA=Symbol.for("effect/SchemaId/Lowercased"),DWA=(A)=>(Q)=>Q.pipe(pB((B)=>B===B.toLowerCase(),{schemaId:IWA,title:"lowercased",description:"a lowercase string",jsonSchema:{pattern:"^[^A-Z]*$"},...A}));class kQA extends iI.pipe(DWA({identifier:"Lowercased"})){}var EWA=Symbol.for("effect/SchemaId/Uppercased"),CWA=(A)=>(Q)=>Q.pipe(pB((B)=>B===B.toUpperCase(),{schemaId:EWA,title:"uppercased",description:"an uppercase string",jsonSchema:{pattern:"^[^a-z]*$"},...A}));class jQA extends iI.pipe(CWA({identifier:"Uppercased"})){}var JWA=Symbol.for("effect/SchemaId/Capitalized"),GWA=(A)=>(Q)=>Q.pipe(pB((B)=>B[0]?.toUpperCase()===B[0],{schemaId:JWA,title:"capitalized",description:"a capitalized string",jsonSchema:{pattern:"^[^a-z]?.*$"},...A}));class yQA extends iI.pipe(GWA({identifier:"Capitalized"})){}var FWA=Symbol.for("effect/SchemaId/Uncapitalized"),HWA=(A)=>(Q)=>Q.pipe(pB((B)=>B[0]?.toLowerCase()===B[0],{schemaId:FWA,title:"uncapitalized",description:"a uncapitalized string",jsonSchema:{pattern:"^[^A-Z]?.*$"},...A}));class gQA extends iI.pipe(HWA({identifier:"Uncapitalized"})){}class XWA extends iI.pipe(BWA(1,{identifier:"Char"})){}var vQA=(A)=>QWA(1,{title:"nonEmptyString",description:"a non empty string",...A});class ZWA extends xB(iI.annotations({description:"a string that will be converted to lowercase"}),kQA,{strict:!0,decode:(A)=>A.toLowerCase(),encode:rQ}).annotations({identifier:"Lowercase"}){}class KWA extends xB(iI.annotations({description:"a string that will be converted to uppercase"}),jQA,{strict:!0,decode:(A)=>A.toUpperCase(),encode:rQ}).annotations({identifier:"Uppercase"}){}class UWA extends xB(iI.annotations({description:"a string that will be converted to a capitalized format"}),yQA,{strict:!0,decode:(A)=>T5A(A),encode:rQ}).annotations({identifier:"Capitalize"}){}class $WA extends xB(iI.annotations({description:"a string that will be converted to an uncapitalized format"}),gQA,{strict:!0,decode:(A)=>_5A(A),encode:rQ}).annotations({identifier:"Uncapitalize"}){}class vh extends iI.pipe(aYA({identifier:"Trimmed"})){}class bQA extends vh.pipe(vQA({identifier:"NonEmptyTrimmedString"})){}class YWA extends xB(iI.annotations({description:"a string that will be trimmed"}),vh,{strict:!0,decode:(A)=>A.trim(),encode:rQ}).annotations({identifier:"Trim"}){}var tiA=(A)=>xB(iI.annotations({description:"a string that will be split"}),eD(iI),{strict:!0,decode:(Q)=>Q.split(A),encode:(Q)=>Q.join(A)}),iAA=(A)=>A instanceof Error?A.message:String(A),aiA=(A)=>oE(iI.annotations({description:"a string to be decoded into JSON"}),$q,{strict:!0,decode:(Q,B,I)=>SU({try:()=>JSON.parse(Q,A?.reviver),catch:(D)=>new eB(I,Q,iAA(D))}),encode:(Q,B,I)=>SU({try:()=>JSON.stringify(Q,A?.replacer,A?.space),catch:(D)=>new eB(I,Q,iAA(D))})}).annotations({title:"parseJson",schemaId:AKA}),WWA=(A,Q)=>dC(A)?Yh(WWA(Q),A):aiA(A);class zWA extends iI.pipe(vQA({identifier:"NonEmptyString"})){}var qWA=Symbol.for("effect/SchemaId/UUID"),JYA=/^[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}$/i;class OWA extends iI.pipe(_QA(JYA,{schemaId:qWA,identifier:"UUID",jsonSchema:{format:"uuid",pattern:JYA.source},description:"a Universally Unique Identifier",arbitrary:()=>(A)=>A.uuid()})){}var VWA=Symbol.for("effect/SchemaId/ULID"),eiA=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i;class wWA extends iI.pipe(_QA(eiA,{schemaId:VWA,identifier:"ULID",description:"a Universally Unique Lexicographically Sortable Identifier",arbitrary:()=>(A)=>A.ulid()})){}class xQA extends vYA(URL,{typeConstructor:{_tag:"URL"},identifier:"URLFromSelf",arbitrary:()=>(A)=>A.webUrl().map((Q)=>new URL(Q)),pretty:()=>(A)=>A.toString()}){}class NWA extends oE(iI.annotations({description:"a string to be decoded into a URL"}),xQA,{strict:!0,decode:(A,Q,B)=>SU({try:()=>new URL(A),catch:(I)=>new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a URL. ${iAA(I)}`)}),encode:(A)=>ZD(A.toString())}).annotations({identifier:"URL",pretty:()=>(A)=>A.toString()}){}var RWA=m$A,hQA=(A)=>(Q)=>Q.pipe(pB(Number.isFinite,{schemaId:RWA,title:"finite",description:"a finite number",jsonSchema:{},...A})),LWA=y$A,MWA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>A,{schemaId:LWA,title:`greaterThan(${A})`,description:A===0?"a positive number":`a number greater than ${A}`,jsonSchema:{exclusiveMinimum:A},...Q})),PWA=g$A,SWA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>=A,{schemaId:PWA,title:`greaterThanOrEqualTo(${A})`,description:A===0?"a non-negative number":`a number greater than or equal to ${A}`,jsonSchema:{minimum:A},...Q})),TWA=Symbol.for("effect/SchemaId/MultipleOf"),ArA=(A,Q)=>(B)=>{let I=Math.abs(A);return B.pipe(pB((D)=>GJA(D,A)===0,{schemaId:TWA,title:`multipleOf(${I})`,description:`a number divisible by ${I}`,jsonSchema:{multipleOf:I},...Q}))},_WA=x$A,mQA=(A)=>(Q)=>Q.pipe(pB((B)=>Number.isSafeInteger(B),{schemaId:_WA,title:"int",description:"an integer",jsonSchema:{type:"integer"},...A})),kWA=v$A,jWA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<A,{schemaId:kWA,title:`lessThan(${A})`,description:A===0?"a negative number":`a number less than ${A}`,jsonSchema:{exclusiveMaximum:A},...Q})),yWA=b$A,gWA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<=A,{schemaId:yWA,title:`lessThanOrEqualTo(${A})`,description:A===0?"a non-positive number":`a number less than or equal to ${A}`,jsonSchema:{maximum:A},...Q})),vWA=u$A,fQA=(A,Q,B)=>(I)=>I.pipe(pB((D)=>D>=A&&D<=Q,{schemaId:vWA,title:`between(${A}, ${Q})`,description:`a number between ${A} and ${Q}`,jsonSchema:{minimum:A,maximum:Q},...B})),bWA=h$A,xWA=(A)=>(Q)=>Q.pipe(pB((B)=>!Number.isNaN(B),{schemaId:bWA,title:"nonNaN",description:"a number excluding NaN",...A})),hWA=(A)=>MWA(0,{title:"positive",...A}),mWA=(A)=>jWA(0,{title:"negative",...A}),fWA=(A)=>gWA(0,{title:"nonPositive",...A}),uWA=(A)=>SWA(0,{title:"nonNegative",...A}),QrA=(A,Q)=>(B)=>{return xB(B,dB(B).pipe(fQA(A,Q)),{strict:!1,decode:(I)=>JJA(I,{minimum:A,maximum:Q}),encode:rQ})};function cWA(A){return oE(A,X2,{strict:!1,decode:(Q,B,I)=>Eq(FJA(Q),()=>new eB(I,Q,`Unable to decode ${JSON.stringify(Q)} into a number`)),encode:(Q)=>ZD(String(Q))})}class uQA extends cWA(iI.annotations({description:"a string to be decoded into a number"})).annotations({identifier:"NumberFromString"}){}class lWA extends X2.pipe(hQA({identifier:"Finite"})){}class zh extends X2.pipe(mQA({identifier:"Int"})){}class dWA extends X2.pipe(xWA({identifier:"NonNaN"})){}class pWA extends X2.pipe(hWA({identifier:"Positive"})){}class oWA extends X2.pipe(mWA({identifier:"Negative"})){}class nWA extends X2.pipe(fWA({identifier:"NonPositive"})){}class bh extends X2.pipe(uWA({identifier:"NonNegative"})){}var iWA=f$A;class rWA extends X2.pipe(hQA({schemaId:iWA,identifier:"JsonNumber"})){}class sWA extends xB(Yq.annotations({description:"a boolean that will be negated"}),Yq,{strict:!0,decode:(A)=>sP(A),encode:(A)=>sP(A)}){}var tWA=(A,Q)=>{let B=Symbol.keyFor(A);return B===void 0?_E(new eB(Q,A,`Unable to encode a unique symbol ${String(A)} into a string`)):ZD(B)},aWA=(A)=>ZD(Symbol.for(A));class eWA extends oE(iI.annotations({description:"a string to be decoded into a globally shared symbol"}),kh,{strict:!1,decode:(A)=>aWA(A),encode:(A,Q,B)=>tWA(A,B)}).annotations({identifier:"Symbol"}){}var rAA=c$A,AzA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>A,{schemaId:rAA,[rAA]:{min:A},title:`greaterThanBigInt(${A})`,description:A===0n?"a positive bigint":`a bigint greater than ${A}n`,...Q})),sAA=l$A,QzA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>=A,{schemaId:sAA,[sAA]:{min:A},title:`greaterThanOrEqualToBigInt(${A})`,description:A===0n?"a non-negative bigint":`a bigint greater than or equal to ${A}n`,...Q})),tAA=d$A,BzA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<A,{schemaId:tAA,[tAA]:{max:A},title:`lessThanBigInt(${A})`,description:A===0n?"a negative bigint":`a bigint less than ${A}n`,...Q})),aAA=p$A,IzA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<=A,{schemaId:aAA,[aAA]:{max:A},title:`lessThanOrEqualToBigInt(${A})`,description:A===0n?"a non-positive bigint":`a bigint less than or equal to ${A}n`,...Q})),eAA=o$A,cQA=(A,Q,B)=>(I)=>I.pipe(pB((D)=>D>=A&&D<=Q,{schemaId:eAA,[eAA]:{min:A,max:Q},title:`betweenBigInt(${A}, ${Q})`,description:`a bigint between ${A}n and ${Q}n`,...B})),lQA=(A)=>AzA(0n,{title:"positiveBigInt",...A}),dQA=(A)=>BzA(0n,{title:"negativeBigInt",...A}),pQA=(A)=>QzA(0n,{title:"nonNegativeBigInt",...A}),oQA=(A)=>IzA(0n,{title:"nonPositiveBigInt",...A}),BrA=(A,Q)=>(B)=>xB(B,B.pipe(dB,cQA(A,Q)),{strict:!1,decode:(I)=>FUA(I,{minimum:A,maximum:Q}),encode:rQ});class vU extends oE(iI.annotations({description:"a string to be decoded into a bigint"}),V5,{strict:!0,decode:(A,Q,B)=>Eq(XUA(A),()=>new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a bigint`)),encode:(A)=>ZD(String(A))}).annotations({identifier:"BigInt"}){}var IrA=V5.pipe(lQA({identifier:"PositiveBigintFromSelf"})),DrA=vU.pipe(lQA({identifier:"PositiveBigint"})),ErA=V5.pipe(dQA({identifier:"NegativeBigintFromSelf"})),CrA=vU.pipe(dQA({identifier:"NegativeBigint"})),JrA=V5.pipe(oQA({identifier:"NonPositiveBigintFromSelf"})),GrA=vU.pipe(oQA({identifier:"NonPositiveBigint"})),DzA=V5.pipe(pQA({identifier:"NonNegativeBigintFromSelf"})),FrA=vU.pipe(pQA({identifier:"NonNegativeBigint"}));class EzA extends oE(X2.annotations({description:"a number to be decoded into a bigint"}),V5.pipe(cQA(BigInt(Number.MIN_SAFE_INTEGER),BigInt(Number.MAX_SAFE_INTEGER))),{strict:!0,decode:(A,Q,B)=>Eq(ZUA(A),()=>new eB(B,A,`Unable to decode ${A} into a bigint`)),encode:(A,Q,B)=>Eq(HUA(A),()=>new eB(B,A,`Unable to encode ${A}n into a number`))}).annotations({identifier:"BigIntFromNumber"}){}var HrA=(A)=>(Q)=>A(Q).map(Kh),e2=(A,Q,B,I)=>de(A,{onFailure:(D)=>new pE(B,I,D),onSuccess:Q}),GYA=(A)=>(Q,B,I)=>e$A(Q)?e2(A($T(Q),B),Kh,I,Q):_E(new eB(I,Q)),CzA=(A)=>kE([A],{decode:(Q)=>GYA(l0(Q)),encode:(Q)=>GYA(d0(Q))},{typeConstructor:{_tag:"effect/Redacted"},description:"Redacted(<redacted>)",pretty:()=>()=>"Redacted(<redacted>)",arbitrary:HrA,equivalence:AYA});function XrA(A){return xB(A,CzA(dB(kD(A))),{strict:!0,decode:(Q)=>Kh(Q),encode:(Q)=>$T(Q)})}class MT extends kE(ug,{typeConstructor:{_tag:"effect/Duration"},identifier:"DurationFromSelf",pretty:()=>String,arbitrary:()=>(A)=>A.oneof(A.constant($P),A.bigInt({min:0n}).map((Q)=>s9(Q)),A.maxSafeNat().map((Q)=>J2(Q))),equivalence:()=>Xi}){}class JzA extends oE(DzA.annotations({description:"a bigint to be decoded into a Duration"}),MT.pipe(pB((A)=>w1A(A),{description:"a finite duration"})),{strict:!0,decode:(A)=>ZD(s9(A)),encode:(A,Q,B)=>gI(N1A(A),{onNone:()=>_E(new eB(B,A,`Unable to encode ${A} into a bigint`)),onSome:(I)=>ZD(I)})}).annotations({identifier:"DurationFromNanos"}){}var qh=bh.pipe(mQA()).annotations({identifier:"NonNegativeInt"});class GzA extends xB(bh.annotations({description:"a non-negative number to be decoded into a Duration"}),MT,{strict:!0,decode:(A)=>J2(A),encode:(A)=>hC(A)}).annotations({identifier:"DurationFromMillis"}){}var FzA=RT("Millis",{millis:qh}),HzA=RT("Nanos",{nanos:vU}),XzA=RT("Infinity",{}),ZrA=XzA.make({}),KrA=pC(FzA,HzA,XzA).annotations({identifier:"DurationValue",description:"an JSON-compatible tagged union to be decoded into a Duration"}),UrA=WJ(fAA(qh).annotations({title:"seconds"}),fAA(qh).annotations({title:"nanos"})).annotations({identifier:"FiniteHRTime"}),$rA=WJ(GE(-1),GE(0)).annotations({identifier:"InfiniteHRTime"}),YrA=pC(UrA,$rA).annotations({identifier:"HRTime",description:"a tuple of seconds and nanos to be decoded into a Duration"}),WrA=(A)=>typeof A==="object";class ZzA extends xB(pC(KrA,YrA),MT,{strict:!0,decode:(A)=>{if(WrA(A))switch(A._tag){case"Millis":return J2(A.millis);case"Nanos":return s9(A.nanos);case"Infinity":return $P}let[Q,B]=A;return Q===-1?$P:s9(BigInt(Q)*BigInt(1e9)+BigInt(B))},encode:(A)=>{switch(A.value._tag){case"Millis":return FzA.make({millis:A.value.millis});case"Nanos":return HzA.make({nanos:A.value.nanos});case"Infinity":return ZrA}}}).annotations({identifier:"Duration"}){}var zrA=(A,Q)=>(B)=>xB(B,B.pipe(dB,KzA(A,Q)),{strict:!1,decode:(I)=>P1A(I,{minimum:A,maximum:Q}),encode:rQ}),VT=Symbol.for("effect/SchemaId/LessThanDuration"),qrA=(A,Q)=>(B)=>B.pipe(pB((I)=>cg(I,A),{schemaId:VT,[VT]:{max:A},title:`lessThanDuration(${A})`,description:`a Duration less than ${SI(A)}`,...Q})),OrA=Symbol.for("effect/schema/LessThanOrEqualToDuration"),VrA=(A,Q)=>(B)=>B.pipe(pB((I)=>lg(I,A),{schemaId:VT,[VT]:{max:A},title:`lessThanOrEqualToDuration(${A})`,description:`a Duration less than or equal to ${SI(A)}`,...Q})),AQA=Symbol.for("effect/SchemaId/GreaterThanDuration"),wrA=(A,Q)=>(B)=>B.pipe(pB((I)=>S1A(I,A),{schemaId:AQA,[AQA]:{min:A},title:`greaterThanDuration(${A})`,description:`a Duration greater than ${SI(A)}`,...Q})),QQA=Symbol.for("effect/schema/GreaterThanOrEqualToDuration"),NrA=(A,Q)=>(B)=>B.pipe(pB((I)=>Gz(I,A),{schemaId:QQA,[QQA]:{min:A},title:`greaterThanOrEqualToDuration(${A})`,description:`a Duration greater than or equal to ${SI(A)}`,...Q})),BQA=Symbol.for("effect/SchemaId/BetweenDuration"),KzA=(A,Q,B)=>(I)=>I.pipe(pB((D)=>M1A(D,{minimum:A,maximum:Q}),{schemaId:BQA,[BQA]:{maximum:Q,minimum:A},title:`betweenDuration(${A}, ${Q})`,description:`a Duration between ${SI(A)} and ${SI(Q)}`,...B}));class xh extends kE(P2A,{typeConstructor:{_tag:"Uint8Array"},identifier:"Uint8ArrayFromSelf",pretty:()=>(A)=>`new Uint8Array(${JSON.stringify(Array.from(A))})`,arbitrary:()=>(A)=>A.uint8Array(),equivalence:()=>M2(NQ)}){}class nQA extends X2.pipe(fQA(0,255,{identifier:"Uint8",description:"a 8-bit unsigned integer"})){}class UzA extends xB(eD(nQA).annotations({description:"an array of 8-bit unsigned integers to be decoded into a Uint8Array"}),xh,{strict:!0,decode:(A)=>Uint8Array.from(A),encode:(A)=>Array.from(A)}).annotations({identifier:"Uint8Array"}){}var iQA=(A,Q,B)=>oE(iI.annotations({description:"a string to be decoded into a Uint8Array"}),xh,{strict:!0,decode:(I,D,C)=>Q4(Q(I),(G)=>new eB(C,I,G.message)),encode:(I)=>ZD(B(I))}).annotations({identifier:A}),RrA=iQA("Uint8ArrayFromBase64",wAA,VAA),LrA=iQA("Uint8ArrayFromBase64Url",RAA,NAA),MrA=iQA("Uint8ArrayFromHex",MAA,LAA),rQA=(A,Q,B)=>oE(iI.annotations({description:`A string that is interpreted as being ${A}-encoded and will be decoded into a UTF-8 string`}),iI,{strict:!0,decode:(I,D,C)=>Q4(Q(I),(G)=>new eB(C,I,G.message)),encode:(I)=>ZD(B(I))}).annotations({identifier:`StringFrom${A}`}),PrA=rQA("Base64",dUA,VAA),SrA=rQA("Base64Url",pUA,NAA),TrA=rQA("Hex",oUA,LAA),_rA=oE(iI.annotations({description:"A string that is interpreted as being UriComponent-encoded and will be decoded into a UTF-8 string"}),iI,{strict:!0,decode:(A,Q,B)=>Q4(iUA(A),(I)=>new eB(B,A,I.message)),encode:(A,Q,B)=>Q4(nUA(A),(I)=>new eB(B,A,I.message))}).annotations({identifier:"StringFromUriComponent"}),$zA=s$A,krA=(A,Q)=>(B)=>{let I=Math.floor(A);if(I<1)throw Error(kx(`Expected an integer greater than or equal to 1, actual ${A}`));return B.pipe(pB((D)=>D.length>=I,{schemaId:$zA,title:`minItems(${I})`,description:`an array of at least ${I} item(s)`,jsonSchema:{minItems:I},[sS]:!0,...Q}))},YzA=t$A,jrA=(A,Q)=>(B)=>{let I=Math.floor(A);if(I<1)throw Error(kx(`Expected an integer greater than or equal to 1, actual ${A}`));return B.pipe(pB((D)=>D.length<=I,{schemaId:YzA,title:`maxItems(${I})`,description:`an array of at most ${I} item(s)`,jsonSchema:{maxItems:I},[sS]:!0,...Q}))},WzA=a$A,yrA=(A,Q)=>(B)=>{let I=Math.floor(A);if(I<0)throw Error(kx(`Expected an integer greater than or equal to 0, actual ${A}`));return B.pipe(pB((D)=>D.length===I,{schemaId:WzA,title:`itemsCount(${I})`,description:`an array of exactly ${I} item(s)`,jsonSchema:{minItems:I,maxItems:I},[sS]:!0,...Q}))},hh=(A)=>CI(pS(A.ast));function grA(A){return xB(A,bU(hh(dB(A))),{strict:!1,decode:(Q)=>p9(Q),encode:(Q)=>gI(Q,{onNone:()=>[],onSome:zC})})}function vrA(A){return xB(A,hh(dB(A)),{strict:!1,decode:(Q)=>AC(Q),encode:(Q)=>zC(Q)})}var brA=y((A)=>dC(A[0]),(A,Q)=>oE(A,hh(dB(A)),{strict:!0,decode:(B,I,D)=>B.length>0?ZD(B[0]):Q?ZD(Q()):_E(new eB(D,B,"Unable to retrieve the first element of an empty array")),encode:(B)=>ZD(zC(B))})),IQA=Symbol.for("effect/SchemaId/ValidDate"),sQA=(A)=>(Q)=>Q.pipe(pB((B)=>!Number.isNaN(B.getTime()),{schemaId:IQA,[IQA]:{noInvalidDate:!0},title:"validDate",description:"a valid Date",...A})),DQA=Symbol.for("effect/SchemaId/LessThanDate"),xrA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<A,{schemaId:DQA,[DQA]:{max:A},title:`lessThanDate(${q8(A)})`,description:`a date before ${q8(A)}`,...Q})),EQA=Symbol.for("effect/schema/LessThanOrEqualToDate"),hrA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<=A,{schemaId:EQA,[EQA]:{max:A},title:`lessThanOrEqualToDate(${q8(A)})`,description:`a date before or equal to ${q8(A)}`,...Q})),CQA=Symbol.for("effect/SchemaId/GreaterThanDate"),mrA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>A,{schemaId:CQA,[CQA]:{min:A},title:`greaterThanDate(${q8(A)})`,description:`a date after ${q8(A)}`,...Q})),JQA=Symbol.for("effect/schema/GreaterThanOrEqualToDate"),frA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>=A,{schemaId:JQA,[JQA]:{min:A},title:`greaterThanOrEqualToDate(${q8(A)})`,description:`a date after or equal to ${q8(A)}`,...Q})),GQA=Symbol.for("effect/SchemaId/BetweenDate"),urA=(A,Q,B)=>(I)=>I.pipe(pB((D)=>D<=Q&&D>=A,{schemaId:GQA,[GQA]:{max:Q,min:A},title:`betweenDate(${q8(A)}, ${q8(Q)})`,description:`a date between ${q8(A)} and ${q8(Q)}`,...B})),FQA=j$A;class zq extends kE(ey,{typeConstructor:{_tag:"Date"},identifier:"DateFromSelf",schemaId:FQA,[FQA]:{noInvalidDate:!1},description:"a potentially invalid Date instance",pretty:()=>(A)=>`new Date(${JSON.stringify(A)})`,arbitrary:()=>(A)=>A.date({noInvalidDate:!1}),equivalence:()=>z2A}){}class zzA extends zq.pipe(sQA({identifier:"ValidDateFromSelf",description:"a valid Date instance"})){}class tQA extends xB(iI.annotations({description:"a string to be decoded into a Date"}),zq,{strict:!0,decode:(A)=>new Date(A),encode:(A)=>q8(A)}).annotations({identifier:"DateFromString"}){}class qzA extends tQA.pipe(sQA({identifier:"Date"})){}class OzA extends xB(X2.annotations({description:"a number to be decoded into a Date"}),zq,{strict:!0,decode:(A)=>new Date(A),encode:(A)=>A.getTime()}).annotations({identifier:"DateFromNumber"}){}class PT extends kE((A)=>ZAA(A)&&MUA(A),{typeConstructor:{_tag:"effect/DateTime.Utc"},identifier:"DateTimeUtcFromSelf",description:"a DateTime.Utc instance",pretty:()=>(A)=>A.toString(),arbitrary:()=>(A)=>A.date({noInvalidDate:!0}).map((Q)=>SUA(Q)),equivalence:()=>KAA}){}var aQA=(A,Q)=>SU({try:()=>TUA(A),catch:()=>new eB(Q,A,`Unable to decode ${U1(A)} into a DateTime.Utc`)});class VzA extends oE(X2.annotations({description:"a number to be decoded into a DateTime.Utc"}),PT,{strict:!0,decode:(A,Q,B)=>aQA(A,B),encode:(A)=>ZD(vUA(A))}).annotations({identifier:"DateTimeUtcFromNumber"}){}class wzA extends oE(zq.annotations({description:"a Date to be decoded into a DateTime.Utc"}),PT,{strict:!0,decode:(A,Q,B)=>aQA(A,B),encode:(A)=>ZD(gUA(A))}).annotations({identifier:"DateTimeUtcFromDate"}){}class NzA extends oE(iI.annotations({description:"a string to be decoded into a DateTime.Utc"}),PT,{strict:!0,decode:(A,Q,B)=>aQA(A,B),encode:(A)=>ZD(bUA(A))}).annotations({identifier:"DateTimeUtc"}){}var RzA=()=>(A)=>A.integer({min:-43200000,max:50400000}).map($AA);class mh extends kE(RUA,{typeConstructor:{_tag:"effect/DateTime.TimeZone.Offset"},identifier:"TimeZoneOffsetFromSelf",description:"a TimeZone.Offset instance",pretty:()=>(A)=>A.toString(),arbitrary:RzA}){}class LzA extends xB(X2.annotations({description:"a number to be decoded into a TimeZone.Offset"}),mh,{strict:!0,decode:(A)=>$AA(A),encode:(A)=>A.offset}).annotations({identifier:"TimeZoneOffset"}){}var MzA=()=>(A)=>A.constantFrom(...Intl.supportedValuesOf("timeZone")).map(UAA);class fh extends kE(LUA,{typeConstructor:{_tag:"effect/DateTime.TimeZone.Named"},identifier:"TimeZoneNamedFromSelf",description:"a TimeZone.Named instance",pretty:()=>(A)=>A.toString(),arbitrary:MzA}){}class PzA extends oE(iI.annotations({description:"a string to be decoded into a TimeZone.Named"}),fh,{strict:!0,decode:(A,Q,B)=>SU({try:()=>UAA(A),catch:()=>new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a TimeZone.Named`)}),encode:(A)=>ZD(A.id)}).annotations({identifier:"TimeZoneNamed"}){}class eQA extends pC(mh,fh){}class SzA extends oE(iI.annotations({description:"a string to be decoded into a TimeZone"}),eQA,{strict:!0,decode:(A,Q,B)=>gI(jUA(A),{onNone:()=>_E(new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a TimeZone`)),onSome:ZD}),encode:(A)=>ZD(yUA(A))}).annotations({identifier:"TimeZone"}){}var crA=(A)=>A.oneof(RzA()(A),MzA()(A));class ABA extends kE((A)=>ZAA(A)&&PUA(A),{typeConstructor:{_tag:"effect/DateTime.Zoned"},identifier:"DateTimeZonedFromSelf",description:"a DateTime.Zoned instance",pretty:()=>(A)=>A.toString(),arbitrary:()=>(A)=>A.tuple(A.integer({min:-31536000000000,max:31536000000000}),crA(A)).map(([Q,B])=>_UA(Q,{timeZone:B})),equivalence:()=>KAA}){}class TzA extends oE(iI.annotations({description:"a string to be decoded into a DateTime.Zoned"}),ABA,{strict:!0,decode:(A,Q,B)=>gI(kUA(A),{onNone:()=>_E(new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a DateTime.Zoned`)),onSome:ZD}),encode:(A)=>ZD(xUA(A))}).annotations({identifier:"DateTimeZoned"}){}var lrA=FE({_tag:GE("None")}).annotations({description:"NoneEncoded"}),drA=(A)=>FE({_tag:GE("Some"),value:A}).annotations({description:`SomeEncoded<${aD(A)}>`}),prA=(A)=>pC(lrA,drA(A)).annotations({description:`OptionEncoded<${aD(A)}>`}),_zA=(A)=>A._tag==="None"?pA():oA(A.value),orA=(A,Q)=>(B)=>B.oneof(Q,B.record({_tag:B.constant("None")}),B.record({_tag:B.constant("Some"),value:A(B)})).map(_zA),nrA=(A)=>gI({onNone:()=>"none()",onSome:(Q)=>`some(${A(Q)})`}),FYA=(A)=>(Q,B,I)=>a2A(Q)?ED(Q)?ZD(pA()):e2(A(Q.value,B),oA,I,Q):_E(new eB(I,Q)),HQA=(A)=>{return kE([A],{decode:(Q)=>FYA(l0(Q)),encode:(Q)=>FYA(d0(Q))},{typeConstructor:{_tag:"effect/Option"},pretty:nrA,arbitrary:orA,equivalence:I8A})},bU=(A)=>{return HQA(A).annotations({description:`Option<${aD(A)}>`})},irA={_tag:"None"},rrA=(A)=>({_tag:"Some",value:A});function srA(A){let Q=kD(A);return xB(prA(Q),bU(dB(Q)),{strict:!0,decode:(I)=>_zA(I),encode:(I)=>gI(I,{onNone:()=>irA,onSome:rrA})})}function trA(A){return xB(zT(A),bU(dB(kD(A))),{strict:!0,decode:(Q)=>w8(Q),encode:(Q)=>$n(Q)})}function arA(A,Q){return xB(qT(A),bU(dB(kD(A))),{strict:!0,decode:(B)=>w8(B),encode:Q===null?(B)=>$n(B):(B)=>PE(B)})}function erA(A){return xB(jU(A),bU(dB(kD(A))),{strict:!0,decode:(Q)=>w8(Q),encode:(Q)=>PE(Q)})}class kzA extends xB(iI,bU(bQA),{strict:!0,decode:(A)=>ZK(oA(A.trim()),Hx),encode:(A)=>eI(A,()=>"")}){}var jzA=(A)=>FE({_tag:GE("Right"),right:A}).annotations({description:`RightEncoded<${aD(A)}>`}),yzA=(A)=>FE({_tag:GE("Left"),left:A}).annotations({description:`LeftEncoded<${aD(A)}>`}),AsA=(A,Q)=>pC(jzA(A),yzA(Q)).annotations({description:`EitherEncoded<${aD(Q)}, ${aD(A)}>`}),gzA=(A)=>A._tag==="Left"?mQ(A.left):cQ(A.right),QsA=(A,Q)=>(B)=>B.oneof(B.record({_tag:B.constant("Left"),left:Q(B)}),B.record({_tag:B.constant("Right"),right:A(B)})).map(gzA),BsA=(A,Q)=>l9({onLeft:(B)=>`left(${Q(B)})`,onRight:(B)=>`right(${A(B)})`}),HYA=(A,Q)=>(B,I,D)=>cW(B)?l9(B,{onLeft:(C)=>e2(Q(C,I),mQ,D,B),onRight:(C)=>e2(A(C,I),cQ,D,B)}):_E(new eB(D,B)),QBA=({left:A,right:Q})=>{return kE([Q,A],{decode:(B,I)=>HYA(l0(B),l0(I)),encode:(B,I)=>HYA(d0(B),d0(I))},{typeConstructor:{_tag:"effect/Either"},description:`Either<${aD(Q)}, ${aD(A)}>`,pretty:BsA,arbitrary:QsA,equivalence:(B,I)=>Hn({left:I,right:B})})},XQA=(A)=>({_tag:"Left",left:A}),ZQA=(A)=>({_tag:"Right",right:A}),IsA=({left:A,right:Q})=>{let B=kD(Q),I=kD(A);return xB(AsA(B,I),QBA({left:dB(I),right:dB(B)}),{strict:!0,decode:(C)=>gzA(C),encode:(C)=>l9(C,{onLeft:XQA,onRight:ZQA})})},DsA=({left:A,right:Q})=>{let B=kD(Q),I=kD(A),D=dB(B),C=dB(I),G=xB(B,jzA(D),{strict:!0,decode:(U)=>ZQA(U),encode:(U)=>U.right}),H=xB(I,yzA(C),{strict:!0,decode:(U)=>XQA(U),encode:(U)=>U.left});return xB(pC(G,H),QBA({left:C,right:D}),{strict:!0,decode:(U)=>U._tag==="Left"?mQ(U.left):cQ(U.right),encode:(U)=>l9(U,{onLeft:XQA,onRight:ZQA})})},EsA=(A,Q,B)=>{return(I)=>{let D=I.array(I.tuple(A(I),Q(I)));return(B.depthIdentifier!==void 0?I.oneof(B,I.constant([]),D):D).map((C)=>new Map(C))}},CsA=(A,Q)=>(B)=>`new Map([${Array.from(B.entries()).map(([I,D])=>`[${A(I)}, ${Q(D)}]`).join(", ")}])`,JsA=(A,Q)=>{let B=M2($E(([I,D],[C,G])=>A(I,C)&&Q(D,G)));return $E((I,D)=>B(Array.from(I.entries()),Array.from(D.entries())))},XYA=(A)=>(Q,B,I)=>w2A(Q)?e2(A(Array.from(Q.entries()),B),(D)=>new Map(D),I,Q):_E(new eB(I,Q)),vzA=(A,Q,B)=>kE([A,Q],{decode:(I,D)=>XYA(l0(eD(WJ(I,D)))),encode:(I,D)=>XYA(d0(eD(WJ(I,D))))},{typeConstructor:{_tag:"ReadonlyMap"},description:B,pretty:CsA,arbitrary:EsA,equivalence:JsA}),BBA=({key:A,value:Q})=>vzA(A,Q,`ReadonlyMap<${aD(A)}, ${aD(Q)}>`),IBA=({key:A,value:Q})=>vzA(A,Q,`Map<${aD(A)}, ${aD(Q)}>`);function GsA({key:A,value:Q}){return xB(eD(WJ(A,Q)),BBA({key:dB(kD(A)),value:dB(kD(Q))}),{strict:!0,decode:(B)=>new Map(B),encode:(B)=>Array.from(B.entries())})}function FsA({key:A,value:Q}){return xB(eD(WJ(A,Q)),IBA({key:dB(kD(A)),value:dB(kD(Q))}),{strict:!0,decode:(B)=>new Map(B),encode:(B)=>Array.from(B.entries())})}var HsA=({key:A,value:Q})=>xB(MQA({key:wQA(A),value:Q}).annotations({description:"a record to be decoded into a ReadonlyMap"}),BBA({key:A,value:dB(Q)}),{strict:!0,decode:(B)=>new Map(Object.entries(B)),encode:(B)=>Object.fromEntries(B)}),XsA=({key:A,value:Q})=>xB(MQA({key:wQA(A),value:Q}).annotations({description:"a record to be decoded into a Map"}),IBA({key:A,value:dB(Q)}),{strict:!0,decode:(B)=>new Map(Object.entries(B)),encode:(B)=>Object.fromEntries(B)}),ZsA=(A,Q)=>(B)=>{let I=B.array(A(B));return(Q.depthIdentifier!==void 0?B.oneof(Q,B.constant([]),I):I).map((D)=>new Set(D))},KsA=(A)=>(Q)=>`new Set([${Array.from(Q.values()).map((B)=>A(B)).join(", ")}])`,UsA=(A)=>{let Q=M2(A);return $E((B,I)=>Q(Array.from(B.values()),Array.from(I.values())))},ZYA=(A)=>(Q,B,I)=>V2A(Q)?e2(A(Array.from(Q.values()),B),(D)=>new Set(D),I,Q):_E(new eB(I,Q)),bzA=(A,Q)=>kE([A],{decode:(B)=>ZYA(l0(eD(B))),encode:(B)=>ZYA(d0(eD(B)))},{typeConstructor:{_tag:"ReadonlySet"},description:Q,pretty:KsA,arbitrary:ZsA,equivalence:UsA}),xzA=(A)=>bzA(A,`ReadonlySet<${aD(A)}>`),hzA=(A)=>bzA(A,`Set<${aD(A)}>`);function $sA(A){return xB(eD(A),xzA(dB(kD(A))),{strict:!0,decode:(Q)=>new Set(Q),encode:(Q)=>Array.from(Q)})}function YsA(A){return xB(eD(A),hzA(dB(kD(A))),{strict:!0,decode:(Q)=>new Set(Q),encode:(Q)=>Array.from(Q)})}var WsA=()=>(A)=>`BigDecimal(${l3(TU(A))})`,zsA=()=>(A)=>A.tuple(A.bigInt(),A.integer({min:-18,max:18})).map(([Q,B])=>U5(Q,B));class w5 extends kE(EAA,{typeConstructor:{_tag:"effect/BigDecimal"},identifier:"BigDecimalFromSelf",pretty:WsA,arbitrary:zsA,equivalence:()=>CAA}){}class mzA extends oE(iI.annotations({description:"a string to be decoded into a BigDecimal"}),w5,{strict:!0,decode:(A,Q,B)=>JAA(A).pipe(gI({onNone:()=>_E(new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a BigDecimal`)),onSome:(I)=>ZD(TU(I))})),encode:(A)=>ZD(l3(TU(A)))}).annotations({identifier:"BigDecimal"}){}class fzA extends xB(X2.annotations({description:"a number to be decoded into a BigDecimal"}),w5,{strict:!0,decode:(A)=>CUA(A),encode:(A)=>JUA(A)}).annotations({identifier:"BigDecimalFromNumber"}){}var KQA=Symbol.for("effect/SchemaId/GreaterThanBigDecimal"),qsA=(A,Q)=>(B)=>{let I=l3(A);return B.pipe(pB((D)=>BUA(D,A),{schemaId:KQA,[KQA]:{min:A},title:`greaterThanBigDecimal(${I})`,description:`a BigDecimal greater than ${I}`,...Q}))},UQA=Symbol.for("effect/schema/GreaterThanOrEqualToBigDecimal"),OsA=(A,Q)=>(B)=>{let I=l3(A);return B.pipe(pB((D)=>IUA(D,A),{schemaId:UQA,[UQA]:{min:A},title:`greaterThanOrEqualToBigDecimal(${I})`,description:`a BigDecimal greater than or equal to ${I}`,...Q}))},$QA=Symbol.for("effect/SchemaId/LessThanBigDecimal"),VsA=(A,Q)=>(B)=>{let I=l3(A);return B.pipe(pB((D)=>AUA(D,A),{schemaId:$QA,[$QA]:{max:A},title:`lessThanBigDecimal(${I})`,description:`a BigDecimal less than ${I}`,...Q}))},YQA=Symbol.for("effect/schema/LessThanOrEqualToBigDecimal"),wsA=(A,Q)=>(B)=>{let I=l3(A);return B.pipe(pB((D)=>QUA(D,A),{schemaId:YQA,[YQA]:{max:A},title:`lessThanOrEqualToBigDecimal(${I})`,description:`a BigDecimal less than or equal to ${I}`,...Q}))},uzA=Symbol.for("effect/schema/PositiveBigDecimal"),czA=(A)=>(Q)=>Q.pipe(pB((B)=>GUA(B),{schemaId:uzA,title:"positiveBigDecimal",description:"a positive BigDecimal",...A})),NsA=w5.pipe(czA({identifier:"PositiveBigDecimalFromSelf"})),lzA=Symbol.for("effect/schema/NonNegativeBigDecimal"),dzA=(A)=>(Q)=>Q.pipe(pB((B)=>B.value>=0n,{schemaId:lzA,title:"nonNegativeBigDecimal",description:"a non-negative BigDecimal",...A})),RsA=w5.pipe(dzA({identifier:"NonNegativeBigDecimalFromSelf"})),pzA=Symbol.for("effect/schema/NegativeBigDecimal"),ozA=(A)=>(Q)=>Q.pipe(pB((B)=>GAA(B),{schemaId:pzA,title:"negativeBigDecimal",description:"a negative BigDecimal",...A})),LsA=w5.pipe(ozA({identifier:"NegativeBigDecimalFromSelf"})),nzA=Symbol.for("effect/schema/NonPositiveBigDecimal"),izA=(A)=>(Q)=>Q.pipe(pB((B)=>B.value<=0n,{schemaId:nzA,title:"nonPositiveBigDecimal",description:"a non-positive BigDecimal",...A})),MsA=w5.pipe(izA({identifier:"NonPositiveBigDecimalFromSelf"})),WQA=Symbol.for("effect/SchemaId/BetweenBigDecimal"),rzA=(A,Q,B)=>(I)=>{let D=l3(A),C=l3(Q);return I.pipe(pB((G)=>DUA(G,{minimum:A,maximum:Q}),{schemaId:WQA,[WQA]:{maximum:Q,minimum:A},title:`betweenBigDecimal(${D}, ${C})`,description:`a BigDecimal between ${D} and ${C}`,...B}))},PsA=(A,Q)=>(B)=>xB(B,B.pipe(dB,rzA(A,Q)),{strict:!1,decode:(I)=>EUA(I,{minimum:A,maximum:Q}),encode:rQ}),SsA=(A,Q)=>(B)=>{let I=B.array(A(B));return(Q.depthIdentifier!==void 0?B.oneof(Q,B.constant([]),I):I).map(e4)},TsA=(A)=>(Q)=>`Chunk(${xC(Q).map(A).join(", ")})`,KYA=(A)=>(Q,B,I)=>AP(Q)?eW(Q)?ZD(YE()):e2(A(xC(Q),B),e4,I,Q):_E(new eB(I,Q)),szA=(A)=>{return kE([A],{decode:(Q)=>KYA(l0(eD(Q))),encode:(Q)=>KYA(d0(eD(Q)))},{typeConstructor:{_tag:"effect/Chunk"},description:`Chunk<${aD(A)}>`,pretty:TsA,arbitrary:SsA,equivalence:zg})};function _sA(A){return xB(eD(A),szA(dB(kD(A))),{strict:!0,decode:(Q)=>Q.length===0?YE():e4(Q),encode:(Q)=>xC(Q)})}var ksA=(A)=>(Q)=>bAA(A(Q),{minLength:1}).map((B)=>IP(B)),jsA=(A)=>(Q)=>`NonEmptyChunk(${xC(Q).map(A).join(", ")})`,UYA=(A)=>(Q,B,I)=>AP(Q)&&cD(Q)?e2(A(xC(Q),B),IP,I,Q):_E(new eB(I,Q)),tzA=(A)=>{return kE([A],{decode:(Q)=>UYA(l0(Wq(Q))),encode:(Q)=>UYA(d0(Wq(Q)))},{typeConstructor:{_tag:"effect/Chunk.NonEmptyChunk"},description:`NonEmptyChunk<${aD(A)}>`,pretty:jsA,arbitrary:ksA,equivalence:zg})};function ysA(A){return xB(Wq(A),tzA(dB(kD(A))),{strict:!0,decode:(Q)=>IP(Q),encode:(Q)=>xC(Q)})}var DBA=(A)=>Array.isArray(A)?F5A(A):G5A(A),gsA=(A)=>(Q)=>A(Q).map(DBA),vsA=(A)=>(Q)=>`Data(${A(Q)})`,$YA=(A)=>(Q,B,I)=>UH(Q)?e2(A(Q,B),DBA,I,Q):_E(new eB(I,Q)),azA=(A)=>{return kE([A],{decode:(Q)=>$YA(l0(Q)),encode:(Q)=>$YA(d0(Q))},{description:`Data<${aD(A)}>`,pretty:vsA,arbitrary:gsA})},bsA=(A)=>{return xB(A,azA(dB(A)),{strict:!1,decode:(Q)=>DBA(Q),encode:(Q)=>Array.isArray(Q)?Array.from(Q):Object.assign({},Q)})},xsA=(A)=>dC(A)||yh(A),ezA=(A)=>Reflect.ownKeys(A).every((Q)=>xsA(A[Q])),EBA=(A)=>("fields"in A)?A.fields:EBA(A[SQA]),uh=(A)=>ezA(A)?FE(A):dC(A)?A:FE(EBA(A)),ch=(A)=>ezA(A)?A:EBA(A),hsA=(A)=>(Q,B)=>yU({kind:"Class",identifier:A,schema:uh(Q),fields:ch(Q),Base:tt,annotations:B}),lh=(A)=>Y5(Kq(GE(A)),()=>A),msA=(A)=>(Q,B,I)=>{let D=ch(B),C=uh(B),G={_tag:lh(Q)},H=Uq(G,D);return class extends yU({kind:"TaggedClass",identifier:A??Q,schema:LT(C,FE(G)),fields:H,Base:tt,annotations:I}){static _tag=Q}},fsA=(A)=>(Q,B,I)=>{class D extends at{}D.prototype.name=Q;let C=ch(B),G=uh(B),H={_tag:lh(Q)},Z=Uq(H,C),U="message"in Z;class O extends yU({kind:"TaggedError",identifier:A??Q,schema:LT(G,FE(H)),fields:Z,Base:D,annotations:I,disableToString:!0}){static _tag=Q}if(!U)Object.defineProperty(O.prototype,"message",{get(){return`{ ${Reflect.ownKeys(C).map((w)=>`${$H(w)}: ${U1(this[w])}`).join(", ")} }`},enumerable:!1,configurable:!0});return O},Uq=(A,Q)=>{let B={...A};for(let I of Reflect.ownKeys(Q)){if(I in A)throw Error(jx(I));B[I]=Q[I]}return B};function dh(A){return q3(A)?A:A?.disableValidation??!1}var YYA=$B("effect/Schema/astCache",()=>new WeakMap),usA=(A)=>{if(A===void 0)return[];else if(Array.isArray(A))return A;else return[A]},yU=({Base:A,annotations:Q,disableToString:B,fields:I,identifier:D,kind:C,schema:G})=>{let H=Symbol.for(`effect/Schema/${C}/${D}`),[Z,U,O]=usA(Q),w=dB(G),L=w.annotations({identifier:D,...Z}),P=w.annotations({[I5]:`${D} (Type side)`,...Z}),k=G.annotations({[I5]:`${D} (Constructor)`,...Z}),_=G.annotations({[I5]:`${D} (Encoded side)`,...O}),x=G.annotations({...O,...Z,...U}),l=(o)=>VQ(o,H)&&Jq(P)(o),GA=class extends A{constructor(o={},BA=!1){if(o={...o},C!=="Class")delete o._tag;if(o=dYA(I,o),!dh(BA))o=Z5(k)(o);super(o,!0)}static[z5]=xAA;static get ast(){let o=YYA.get(this);if(o)return o;let BA=kE([G],{decode:()=>(JA,XA,UA)=>JA instanceof this||l(JA)?ZD(JA):_E(new eB(UA,JA)),encode:()=>(JA,XA)=>JA instanceof this?ZD(JA):lC(d0(P)(JA,XA),(UA)=>new this(UA,!0))},{identifier:D,pretty:(JA)=>(XA)=>`${D}(${JA(XA)})`,arbitrary:(JA)=>(XA)=>JA(XA).map((UA)=>new this(UA)),equivalence:rQ,[rS]:L.ast,...Z});return o=xB(_,BA,{strict:!0,decode:(JA)=>new this(JA,!0),encode:rQ}).annotations({[rS]:x.ast,...U}).ast,YYA.set(this,o),o}static pipe(){return RQ(this,arguments)}static annotations(o){return CI(this.ast).annotations(o)}static toString(){return`(${String(_)} <-> ${D})`}static make(...o){return new this(...o)}static fields={...I};static identifier=D;static extend(o){return(BA,JA)=>{let XA=ch(BA),UA=uh(BA),OA=Uq(I,XA);return yU({kind:C,identifier:o,schema:LT(G,UA),fields:OA,Base:this,annotations:JA})}}static transformOrFail(o){return(BA,JA,XA)=>{let UA=Uq(I,BA);return yU({kind:C,identifier:o,schema:oE(G,dB(FE(UA)),JA),fields:UA,Base:this,annotations:XA})}}static transformOrFailFrom(o){return(BA,JA,XA)=>{let UA=Uq(I,BA);return yU({kind:C,identifier:o,schema:oE(Lh(G),FE(UA),JA),fields:UA,Base:this,annotations:XA})}}get[H](){return H}};if(B!==!0)Object.defineProperty(GA.prototype,"toString",{value(){return`${D}({ ${Reflect.ownKeys(I).map((o)=>`${$H(o)}: ${U1(this[o])}`).join(", ")} })`},configurable:!0,writable:!0});return GA},csA=FE({_tag:GE("None")}).annotations({identifier:"FiberIdNoneEncoded"}),lsA=FE({_tag:GE("Runtime"),id:zh,startTimeMillis:zh}).annotations({identifier:"FiberIdRuntimeEncoded"}),dsA=FE({_tag:GE("Composite"),left:Wh(()=>Oh),right:Wh(()=>Oh)}).annotations({identifier:"FiberIdCompositeEncoded"}),Oh=pC(csA,lsA,dsA).annotations({identifier:"FiberIdEncoded"}),AqA=(A)=>A.letrec((Q)=>({None:A.record({_tag:A.constant("None")}),Runtime:A.record({_tag:A.constant("Runtime"),id:A.integer(),startTimeMillis:A.integer()}),Composite:A.record({_tag:A.constant("Composite"),left:Q("FiberId"),right:Q("FiberId")}),FiberId:A.oneof(Q("None"),Q("Runtime"),Q("Composite"))})).FiberId.map(wT),Vh=(A)=>{switch(A._tag){case"None":return"FiberId.none";case"Runtime":return`FiberId.runtime(${A.id}, ${A.startTimeMillis})`;case"Composite":return`FiberId.composite(${Vh(A.right)}, ${Vh(A.left)})`}};class CBA extends kE(m1A,{typeConstructor:{_tag:"effect/FiberId"},identifier:"FiberIdFromSelf",pretty:()=>Vh,arbitrary:()=>AqA}){}var wT=(A)=>{switch(A._tag){case"None":return s2;case"Runtime":return x1A(A.id,A.startTimeMillis);case"Composite":return h1A(wT(A.left),wT(A.right))}},zQA=(A)=>{switch(A._tag){case"None":return{_tag:"None"};case"Runtime":return{_tag:"Runtime",id:A.id,startTimeMillis:A.startTimeMillis};case"Composite":return{_tag:"Composite",left:zQA(A.left),right:zQA(A.right)}}};class QqA extends xB(Oh,CBA,{strict:!0,decode:(A)=>wT(A),encode:(A)=>zQA(A)}).annotations({identifier:"FiberId"}){}var psA=(A)=>FE({_tag:GE("Die"),defect:A}),osA=FE({_tag:GE("Empty")}),nsA=(A)=>FE({_tag:GE("Fail"),error:A}),isA=FE({_tag:GE("Interrupt"),fiberId:Oh}),rsA=0,wh=(A,Q)=>{let B=kD(A),I=kD(Q),D=Wh(()=>C),C=pC(osA,nsA(B),psA(I),isA,FE({_tag:GE("Sequential"),left:D,right:D}),FE({_tag:GE("Parallel"),left:D,right:D})).annotations({title:`CauseEncoded<${aD(A)}>`,[vx]:`CauseEncoded${rsA++}`});return C},BqA=(A,Q)=>(B)=>B.letrec((I)=>({Empty:B.record({_tag:B.constant("Empty")}),Fail:B.record({_tag:B.constant("Fail"),error:A(B)}),Die:B.record({_tag:B.constant("Die"),defect:Q(B)}),Interrupt:B.record({_tag:B.constant("Interrupt"),fiberId:AqA(B)}),Sequential:B.record({_tag:B.constant("Sequential"),left:I("Cause"),right:I("Cause")}),Parallel:B.record({_tag:B.constant("Parallel"),left:I("Cause"),right:I("Cause")}),Cause:B.oneof(I("Empty"),I("Fail"),I("Die"),I("Interrupt"),I("Sequential"),I("Parallel"))})).Cause.map(W5),IqA=(A)=>(Q)=>{let B=(I)=>{switch(I._tag){case"Empty":return"Cause.empty";case"Fail":return`Cause.fail(${A(I.error)})`;case"Die":return`Cause.die(${PS(I)})`;case"Interrupt":return`Cause.interrupt(${Vh(I.fiberId)})`;case"Sequential":return`Cause.sequential(${B(I.left)}, ${B(I.right)})`;case"Parallel":return`Cause.parallel(${B(I.left)}, ${B(I.right)})`}};return B(Q)},WYA=(A)=>(Q,B,I)=>M7A(Q)?e2(A(Zq(Q),B),W5,I,Q):_E(new eB(I,Q)),Nh=({defect:A,error:Q})=>{return kE([Q,A],{decode:(B,I)=>WYA(l0(wh(B,I))),encode:(B,I)=>WYA(d0(wh(B,I)))},{typeConstructor:{_tag:"effect/Cause"},title:`Cause<${Q.ast}>`,pretty:IqA,arbitrary:BqA})};function W5(A){switch(A._tag){case"Empty":return O7A;case"Fail":return V7A(A.error);case"Die":return w7A(A.defect);case"Interrupt":return N7A(wT(A.fiberId));case"Sequential":return L7A(W5(A.left),W5(A.right));case"Parallel":return R7A(W5(A.left),W5(A.right))}}function Zq(A){switch(A._tag){case"Empty":return{_tag:"Empty"};case"Fail":return{_tag:"Fail",error:A.error};case"Die":return{_tag:"Die",defect:A.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:A.fiberId};case"Sequential":return{_tag:"Sequential",left:Zq(A.left),right:Zq(A.right)};case"Parallel":return{_tag:"Parallel",left:Zq(A.left),right:Zq(A.right)}}}var ssA=({defect:A,error:Q})=>{let B=kD(Q),I=kD(A);return xB(wh(B,I),Nh({error:dB(B),defect:dB(I)}),{strict:!1,decode:(C)=>W5(C),encode:(C)=>Zq(C)})};class Rh extends xB($q,$q,{strict:!0,decode:(A)=>{if($C(A)&&"message"in A&&typeof A.message==="string"){let Q=Error(A.message,{cause:A});if("name"in A&&typeof A.name==="string")Q.name=A.name;return Q.stack="stack"in A&&typeof A.stack==="string"?A.stack:"",Q}return mg(A)},encode:(A)=>{if(A instanceof Error)return{name:A.name,message:A.message};return mg(A)}}).annotations({identifier:"Defect"}){}var tsA=(A,Q)=>FE({_tag:GE("Failure"),cause:wh(A,Q)}),asA=(A)=>FE({_tag:GE("Success"),value:A}),esA=(A,Q,B)=>{return pC(tsA(Q,B),asA(A)).annotations({title:`ExitEncoded<${aD(A)}, ${aD(Q)}, ${aD(B)}>`})},DqA=(A)=>{switch(A._tag){case"Failure":return ps(W5(A.cause));case"Success":return CS(A.value)}},AtA=(A,Q,B)=>(I)=>I.oneof(I.record({_tag:I.constant("Failure"),cause:BqA(Q,B)(I)}),I.record({_tag:I.constant("Success"),value:A(I)})).map(DqA),QtA=(A,Q)=>(B)=>B._tag==="Failure"?`Exit.failCause(${IqA(Q)(B.cause)})`:`Exit.succeed(${A(B.value)})`,zYA=(A,Q)=>(B,I,D)=>oGA(B)?iGA(B,{onFailure:(C)=>e2(Q(C,I),ps,D,B),onSuccess:(C)=>e2(A(C,I),CS,D,B)}):_E(new eB(D,B)),EqA=({defect:A,failure:Q,success:B})=>kE([B,Q,A],{decode:(I,D,C)=>zYA(l0(I),l0(Nh({error:D,defect:C}))),encode:(I,D,C)=>zYA(d0(I),d0(Nh({error:D,defect:C})))},{typeConstructor:{_tag:"effect/Exit"},title:`Exit<${B.ast}, ${Q.ast}>`,pretty:QtA,arbitrary:AtA}),qQA=({defect:A,failure:Q,success:B})=>{let I=kD(B),D=kD(Q),C=kD(A);return xB(esA(I,D,C),EqA({failure:dB(D),success:dB(I),defect:dB(C)}),{strict:!1,decode:(H)=>DqA(H),encode:(H)=>H._tag==="Failure"?{_tag:"Failure",cause:H.cause}:{_tag:"Success",value:H.value}})},BtA=(A,Q)=>(B)=>{let I=B.array(A(B));return(Q.depthIdentifier!==void 0?B.oneof(Q,B.constant([]),I):I).map(NH)},ItA=(A)=>(Q)=>`HashSet(${Array.from(Q).map((B)=>A(B)).join(", ")})`,DtA=(A)=>{let Q=M2(A);return $E((B,I)=>Q(Array.from(B),Array.from(I)))},qYA=(A)=>(Q,B,I)=>o8A(Q)?e2(A(Array.from(Q),B),NH,I,Q):_E(new eB(I,Q)),CqA=(A)=>{return kE([A],{decode:(Q)=>qYA(l0(eD(Q))),encode:(Q)=>qYA(d0(eD(Q)))},{typeConstructor:{_tag:"effect/HashSet"},description:`HashSet<${aD(A)}>`,pretty:ItA,arbitrary:BtA,equivalence:DtA})};function EtA(A){return xB(eD(A),CqA(dB(kD(A))),{strict:!0,decode:(Q)=>NH(Q),encode:(Q)=>Array.from(Q)})}var CtA=(A,Q,B)=>(I)=>{let D=I.array(I.tuple(A(I),Q(I)));return(B.depthIdentifier!==void 0?I.oneof(B,I.constant([]),D):D).map(Xz)},JtA=(A,Q)=>(B)=>`HashMap([${Array.from(B).map(([I,D])=>`[${A(I)}, ${Q(D)}]`).join(", ")}])`,GtA=(A,Q)=>{let B=M2($E(([I,D],[C,G])=>A(I,C)&&Q(D,G)));return $E((I,D)=>B(Array.from(I),Array.from(D)))},OYA=(A)=>(Q,B,I)=>u1A(Q)?e2(A(Array.from(Q),B),Xz,I,Q):_E(new eB(I,Q)),JqA=({key:A,value:Q})=>{return kE([A,Q],{decode:(B,I)=>OYA(l0(eD(WJ(B,I)))),encode:(B,I)=>OYA(d0(eD(WJ(B,I))))},{typeConstructor:{_tag:"effect/HashMap"},description:`HashMap<${aD(A)}, ${aD(Q)}>`,pretty:JtA,arbitrary:CtA,equivalence:GtA})},FtA=({key:A,value:Q})=>{return xB(eD(WJ(A,Q)),JqA({key:dB(kD(A)),value:dB(kD(Q))}),{strict:!0,decode:(B)=>Xz(B),encode:(B)=>Array.from(B)})},HtA=(A,Q)=>(B)=>{let I=B.array(A(B));return(Q.depthIdentifier!==void 0?B.oneof(Q,B.constant([]),I):I).map(tg)},XtA=(A)=>(Q)=>`List(${Array.from(Q).map((B)=>A(B)).join(", ")})`,ZtA=(A)=>{let Q=M2(A);return $E((B,I)=>Q(Array.from(B),Array.from(I)))},VYA=(A)=>(Q,B,I)=>sg(Q)?e2(A(Array.from(Q),B),tg,I,Q):_E(new eB(I,Q)),GqA=(A)=>{return kE([A],{decode:(Q)=>VYA(l0(eD(Q))),encode:(Q)=>VYA(d0(eD(Q)))},{typeConstructor:{_tag:"effect/List"},description:`List<${aD(A)}>`,pretty:XtA,arbitrary:HtA,equivalence:ZtA})};function KtA(A){return xB(eD(A),GqA(dB(kD(A))),{strict:!0,decode:(Q)=>tg(Q),encode:(Q)=>Array.from(Q)})}var UtA=(A,Q,B)=>(I)=>{let D=I.array(A(I));return(B.depthIdentifier!==void 0?I.oneof(B,I.constant([]),D):D).map((C)=>kb(C,Q))},$tA=(A)=>(Q)=>`new SortedSet([${Array.from(jb(Q)).map((B)=>A(B)).join(", ")}])`,wYA=(A,Q)=>(B,I,D)=>Ut(B)?e2(A(Array.from(jb(B)),I),(C)=>kb(C,Q),D,B):_E(new eB(D,B)),FqA=(A,Q,B)=>{return kE([A],{decode:(I)=>wYA(l0(eD(I)),Q),encode:(I)=>wYA(d0(eD(I)),B)},{typeConstructor:{_tag:"effect/SortedSet"},description:`SortedSet<${aD(A)}>`,pretty:$tA,arbitrary:(I,D)=>UtA(I,Q,D),equivalence:()=>LFA()})};function YtA(A,Q){let B=dB(kD(A));return xB(eD(A),FqA(B,Q,Q),{strict:!0,decode:(I)=>kb(I,Q),encode:(I)=>Array.from(jb(I))})}class HqA extends xB($q,Yq,{strict:!0,decode:(A)=>O2A(A),encode:rQ}).annotations({identifier:"BooleanFromUnknown"}){}class XqA extends xB(GE("true","false").annotations({description:"a string to be decoded into a boolean"}),Yq,{strict:!0,decode:(A)=>A==="true",encode:(A)=>A?"true":"false"}).annotations({identifier:"BooleanFromString"}){}var WtA=(A,Q)=>{let B=FT(Q);return NUA(A).pipe(wUA((I)=>B(I).pipe(Q4((D)=>KUA([],PU.formatIssueSync(D))))))},ST=Symbol.for("effect/Schema/Serializable/symbol"),ztA=(A)=>A,qtA=(A)=>A[ST],OtA=(A)=>Mh(A[ST])(A),VtA=y(2,(A,Q)=>gU(A[ST])(Q)),hF=Symbol.for("effect/Schema/Serializable/symbolResult"),wtA=(A)=>A,OQA=(A)=>A[hF].failure,VQA=(A)=>A[hF].success,NYA=$B("effect/Schema/Serializable/exitSchemaCache",()=>new WeakMap),JBA=(A)=>{let Q=Object.getPrototypeOf(A);if(!(hF in Q))return qQA({failure:OQA(A),success:VQA(A),defect:Rh});let B=NYA.get(Q);if(B===void 0)B=qQA({failure:OQA(A),success:VQA(A),defect:Rh}),NYA.set(Q,B);return B},NtA=y(2,(A,Q)=>Ph(A[hF].failure)(Q)),RtA=y(2,(A,Q)=>gU(A[hF].failure)(Q)),LtA=y(2,(A,Q)=>Ph(A[hF].success)(Q)),MtA=y(2,(A,Q)=>gU(A[hF].success)(Q)),PtA=y(2,(A,Q)=>Ph(JBA(A))(Q)),StA=y(2,(A,Q)=>gU(JBA(A))(Q)),TtA=(A)=>A,_tA=(A)=>(Q,B,I)=>{let D=Uq({_tag:lh(Q)},B.payload);return class extends yU({kind:"TaggedRequest",identifier:A??Q,schema:FE(D),fields:D,Base:RZA,annotations:I}){static _tag=Q;static success=B.success;static failure=B.failure;get[ST](){return this.constructor}get[hF](){return{failure:B.failure,success:B.success}}}},ktA=(A)=>d3(A.ast,[]),jtA=j2(gx),d3=(A,Q)=>{let B=jtA(A);if(YI(B))switch(A._tag){case"Declaration":return B.value(...A.typeParameters.map((I)=>d3(I,Q)));case"Refinement":return B.value(d3(A.from,Q));default:return B.value()}switch(A._tag){case"NeverKeyword":throw Error(vZA(A,Q));case"Transformation":return d3(A.to,Q);case"Declaration":case"Literal":case"StringKeyword":case"TemplateLiteral":case"UniqueSymbol":case"SymbolKeyword":case"UnknownKeyword":case"AnyKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"UndefinedKeyword":case"VoidKeyword":case"Enums":case"ObjectKeyword":return NQ;case"Refinement":return d3(A.from,Q);case"Suspend":{let I=sz(()=>d3(A.f(),Q));return(D,C)=>I()(D,C)}case"TupleType":{let I=A.elements.map((C,G)=>d3(C.type,Q.concat(G))),D=A.rest.map((C)=>d3(C.type,Q));return $E((C,G)=>{if(!Array.isArray(C)||!Array.isArray(G))return!1;let H=C.length;if(H!==G.length)return!1;let Z=0;for(;Z<Math.min(H,A.elements.length);Z++)if(!I[Z](C[Z],G[Z]))return!1;if(LD(D)){let[U,...O]=D;for(;Z<H-O.length;Z++)if(!U(C[Z],G[Z]))return!1;for(let w=0;w<O.length;w++)if(Z+=w,!O[w](C[Z],G[Z]))return!1}return!0})}case"TypeLiteral":{if(A.propertySignatures.length===0&&A.indexSignatures.length===0)return NQ;let I=A.propertySignatures.map((C)=>d3(C.type,Q.concat(C.name))),D=A.indexSignatures.map((C)=>d3(C.type,Q));return $E((C,G)=>{if(!mM(C)||!mM(G))return!1;let H=Object.keys(C),Z=Object.getOwnPropertySymbols(C);for(let w=0;w<I.length;w++){let L=A.propertySignatures[w],P=L.name,k=Object.prototype.hasOwnProperty.call(C,P),_=Object.prototype.hasOwnProperty.call(G,P);if(L.isOptional){if(k!==_)return!1}if(k&&_&&!I[w](C[P],G[P]))return!1}let U,O;for(let w=0;w<D.length;w++){let L=A.indexSignatures[w],P=kF(L.parameter),k=mx(P);if(k){if(U=U||Object.getOwnPropertySymbols(G),Z.length!==U.length)return!1}else if(O=O||Object.keys(G),H.length!==O.length)return!1;let _=k?Z:H;for(let x=0;x<_.length;x++){let l=_[x];if(!Object.prototype.hasOwnProperty.call(G,l)||!D[w](C[l],G[l]))return!1}}return!0})}case"Union":{let I=Ih(A.types,!0),D=Reflect.ownKeys(I.keys),C=D.length;return $E((G,H)=>{let Z=[];if(C>0&&yW(G))for(let O=0;O<C;O++){let w=D[O],L=I.keys[w].buckets;if(Object.prototype.hasOwnProperty.call(G,w)){let P=String(G[w]);if(Object.prototype.hasOwnProperty.call(L,P))Z=Z.concat(L[P])}}if(I.otherwise.length>0)Z=Z.concat(I.otherwise);let U=Z.map((O)=>[d3(O,Q),Jq({ast:O})]);for(let O=0;O<U.length;O++){let[w,L]=U[O];if(L(G)&&L(H)){if(w(G,H))return!0}}return!1})}}},RYA=RT("symbol",{key:iI}).annotations({description:"an object to be decoded into a globally shared symbol"}),ytA=oE(RYA,kh,{strict:!0,decode:(A)=>aWA(A.key),encode:(A,Q,B)=>lC(tWA(A,B),(I)=>RYA.make({key:I}))});class GBA extends pC(iI,X2,ytA).annotations({identifier:"PropertyKey"}){}class ZqA extends FE({_tag:Kq(GE("Pointer","Unexpected","Missing","Composite","Refinement","Transformation","Type","Forbidden")).annotations({description:"The tag identifying the type of parse issue"}),path:Kq(eD(GBA)).annotations({description:"The path to the property where the issue occurred"}),message:Kq(iI).annotations({description:"A descriptive message explaining the issue"})}).annotations({identifier:"ArrayFormatterIssue",description:"Represents an issue returned by the ArrayFormatter formatter"}){}var UqA="0.0.16";var $qA={name:"@mdl/cli",version:UqA,description:"Interactive CLI for syncing music locally via YouTube.",type:"module",author:"Labithiotis",license:"MIT",keywords:["cli","mdl","music","downloader","spotify","apple music","amazon music","youtube music","soundcloud","bandcamp","qobuz","deezer","tidal"],bin:{mdl:"release/cli.js"},engines:{bun:">=1",node:">=18"},files:["release"],exports:{".":"./src/cli.tsx","./lib/*":"./src/lib/*.ts","./ui/app":"./src/ui/app.tsx"},homepage:"https://github.com/labithiotis/mdl",repository:{type:"git",url:"git+https://github.com/labithiotis/mdl.git"},scripts:{dev:"bun run src/cli.tsx",build:"bun build --compile --minify ./src/cli.tsx --outfile release/mdl","build:npm":"bun build --minify --target=node ./src/cli.tsx --outfile release/cli.js",check:"tsc --noEmit",typecheck:"tsc --noEmit",test:"bun test src","test:unit":"bun test src"},dependencies:{effect:"3.21.0",ink:"6.8.0","ink-scroll-view":"0.3.6","ink-spinner":"5.0.0","ink-text-input":"6.0.0",react:"19.2.0","sanitize-filename":"1.6.4","youtubei.js":"17.0.1"},devDependencies:{"@types/react":"19.2.2","ink-testing-library":"4.0.0","react-devtools-core":"7.0.1"}};var gtA=5000,vtA=2;class qq extends VB.TaggedError()("CliArgumentError",{message:VB.String}){}class ph extends VB.TaggedError()("ManifestDecodeError",{message:VB.String}){}class Oq extends VB.TaggedError()("TrackSyncError",{reason:VB.String,stage:VB.String,trackTitle:VB.String}){}function TT(A,Q){return VB.decodeUnknownEither(A)(Q)}function N5(A,Q){return VB.decodeUnknownSync(A)(Q)}function FBA(A){return A.message.replace(/\s+/g," ").trim()}function _T(A){if(A instanceof Oq)return`Failed ${xtA(A.stage)} for ${A.trackTitle}: ${A.reason}`;if(A instanceof ph)return`Invalid manifest data: ${A.message}`;if(A instanceof qq)return A.message;if(HT.isParseError(A))return FBA(A);if(A instanceof Error)return A.message;return String(A)}function btA(A){let Q=A?.baseDelayMs??gtA,B=A?.maxRetries??vtA;return K5.exponential(`${Q} millis`).pipe(K5.compose(K5.recurs(B)),K5.jittered)}function kT(A){let Q=0,B=A.shouldRetry??(()=>!0),I=btA({baseDelayMs:A.baseDelayMs,maxRetries:A.maxRetries}).pipe(K5.tapInput((D)=>VC.sync(()=>{Q+=1,A.onRetry?.(Q,D)})));return A.effect.pipe(VC.retry({schedule:I,while:B}))}function Z0(...A){return A.find((Q)=>Q?.trim())?.trim()}function xtA(A){switch(A){case"downloading-audio":return"downloading audio";case"searching-youtube":return"searching YouTube";case"writing-metadata":return"writing metadata";case"writing-manifest":return"writing manifest";default:return A.replaceAll("-"," ")}}var HBA=["mp3","m4a","opus","flac","wav"],XBA=["best","0","1","2","3","4","5","6","7","8","9","10","128K","192K","256K","320K"],YqA=10,WqA="mp3",zqA="best",htA=VB.Literal(...HBA),mtA=VB.Literal(...XBA);function qqA(A){let Q={audioFormat:WqA,audioQuality:zqA,downloadParallelism:YqA};for(let B=0;B<A.length;B+=1){let I=A[B];if(I==="--help"||I==="-h")ftA(),process.exit(0);if(I==="--version"||I==="-v")utA(),process.exit(0);if(I==="--output"||I==="-o"){let D=A[B+1];if(!D)throw Error("Missing value for --output.");Q.outputDir=D,B+=1;continue}if(I==="--parallel"||I==="-p"){let D=A[B+1];if(!D)throw Error("Missing value for --parallel.");Q.downloadParallelism=ctA(D,"--parallel"),B+=1;continue}if(I==="--format"||I==="-f"){let D=A[B+1];if(!D)throw Error("Missing value for --format.");Q.audioFormat=ltA(D,"--format"),B+=1;continue}if(I==="--bitrate"||I==="-b"){let D=A[B+1];if(!D)throw Error("Missing value for --bitrate.");Q.audioQuality=dtA(ptA(D),"--bitrate"),B+=1;continue}if(!Q.url){Q.url=I;continue}throw Error(`Unexpected argument: ${I}`)}return Q}function ftA(){process.stdout.write(`mdl (MusicDownLoader)
|
|
392
|
+
`,A.forest),cKA=(A,Q)=>{let B="",I=Q.length,D;for(let C=0;C<I;C++){D=Q[C];let G=C===I-1;B+=A+(G?"└":"├")+"─ "+D.value,B+=cKA(A+(I>1&&!G?"│ ":" "),D.forest)}return B},DpA=(A)=>{switch(A){case"Encoded":return"Encoded side transformation failure";case"Transformation":return"Transformation process failure";case"Type":return"Type side transformation failure"}},EpA=(A)=>{switch(A){case"From":return"From side refinement failure";case"Predicate":return"Predicate refinement failure"}},lKA=(A)=>("ast"in A)?oA(A.ast):pA(),ce=cQ(void 0),CpA=(A)=>lKA(A).pipe(R8(nZA),gI({onNone:()=>ce,onSome:(Q)=>{let B=Q(A);if(cE(B))return cQ({message:B,override:!1});if(ta(B))return U4(B,(I)=>({message:I,override:!1}));if(cE(B.message))return cQ({message:B.message,override:B.override});return U4(B.message,(I)=>({message:I,override:B.override}))}})),QAA=(A)=>(Q)=>Q._tag===A,BAA=QAA("Composite"),bKA=QAA("Refinement"),xKA=QAA("Transformation"),X5=(A)=>_1(CpA(A),(Q)=>{if(Q!==void 0)return!Q.override&&(BAA(A)||bKA(A)&&A.kind==="From"||xKA(A)&&A.kind!=="Transformation")?xKA(A)||bKA(A)?X5(A.issue):ce:cQ(Q.message);return ce}),dKA=(A)=>lKA(A).pipe(R8(tZA),B8A((Q)=>Q(A)),PE);function pKA(A){return Me(A).pipe(a4(()=>Re(A)),a4(()=>Le(A)),a4(()=>tS(A)),eI(()=>`{ ${A.from} | filter }`))}function JpA(A){if(A.message!==void 0)return A.message;return`Expected ${G5(A.ast)?pKA(A.ast):String(A.ast)}, actual ${U1(A.actual)}`}var oKA=(A)=>lC(X5(A),(Q)=>Q??dKA(A)??JpA(A)),ox=(A)=>dKA(A)??String(A.ast),nKA=(A)=>A.message??"is forbidden",iKA=(A)=>A.message??"is unexpected",rKA=(A)=>{let Q=iZA(A.ast);if(YI(Q)){let B=Q.value();return cE(B)?cQ(B):B}return cQ(A.message??"is missing")},Qq=(A)=>{switch(A._tag){case"Type":return lC(oKA(A),j8);case"Forbidden":return cQ(j8(ox(A),[j8(nKA(A))]));case"Unexpected":return cQ(j8(iKA(A)));case"Missing":return lC(rKA(A),j8);case"Transformation":return _1(X5(A),(Q)=>{if(Q!==void 0)return cQ(j8(Q));return lC(Qq(A.issue),(B)=>j8(ox(A),[j8(DpA(A.kind),[B])]))});case"Refinement":return _1(X5(A),(Q)=>{if(Q!==void 0)return cQ(j8(Q));return lC(Qq(A.issue),(B)=>j8(ox(A),[j8(EpA(A.kind),[B])]))});case"Pointer":return lC(Qq(A.issue),(Q)=>j8(Tx(A.path),[Q]));case"Composite":return _1(X5(A),(Q)=>{if(Q!==void 0)return cQ(j8(Q));let B=ox(A);return Sx(A.issues)?lC(zU(A.issues,Qq),(I)=>j8(B,I)):lC(Qq(A.issues),(I)=>j8(B,[I]))})}},LU=(A,Q,B)=>({_tag:A,path:Q,message:B}),Dq={formatIssue:(A)=>Bq(A,void 0,[]),formatIssueSync:(A)=>{let Q=Dq.formatIssue(A);return y2(Q)?Kg(Q):Px(Q)},formatError:(A)=>Dq.formatIssue(A.issue),formatErrorSync:(A)=>Dq.formatIssueSync(A.issue)},Bq=(A,Q,B)=>{let I=A._tag;switch(I){case"Type":return lC(oKA(A),(D)=>[LU(Q??I,B,D)]);case"Forbidden":return cQ([LU(I,B,nKA(A))]);case"Unexpected":return cQ([LU(I,B,iKA(A))]);case"Missing":return lC(rKA(A),(D)=>[LU(I,B,D)]);case"Pointer":return Bq(A.issue,void 0,B.concat(A.path));case"Composite":return _1(X5(A),(D)=>{if(D!==void 0)return cQ([LU(I,B,D)]);return Sx(A.issues)?lC(zU(A.issues,(C)=>Bq(C,void 0,B)),tW):Bq(A.issues,void 0,B)});case"Refinement":return _1(X5(A),(D)=>{if(D!==void 0)return cQ([LU(I,B,D)]);return Bq(A.issue,A.kind==="Predicate"?I:void 0,B)});case"Transformation":return _1(X5(A),(D)=>{if(D!==void 0)return cQ([LU(I,B,D)]);return Bq(A.issue,A.kind==="Transformation"?I:void 0,B)})}};var K5={};e1(K5,{zipWith:()=>eoA,zipRight:()=>aoA,zipLeft:()=>toA,windowed:()=>soA,whileOutputEffect:()=>roA,whileOutput:()=>ioA,whileInputEffect:()=>noA,whileInput:()=>ooA,upTo:()=>poA,untilOutputEffect:()=>doA,untilOutput:()=>loA,untilInputEffect:()=>coA,untilInput:()=>uoA,unionWith:()=>foA,union:()=>moA,unfold:()=>hoA,tapOutput:()=>xoA,tapInput:()=>boA,sync:()=>voA,succeed:()=>goA,stop:()=>yoA,spaced:()=>joA,secondOfMinute:()=>ypA,run:()=>koA,resetWhen:()=>_oA,resetAfter:()=>ToA,repetitions:()=>SoA,repeatForever:()=>PoA,reduceEffect:()=>MoA,reduce:()=>LoA,recurs:()=>RoA,recurWhileEffect:()=>NoA,recurWhile:()=>woA,recurUpTo:()=>VoA,recurUntilOption:()=>OoA,recurUntilEffect:()=>qoA,recurUntil:()=>zoA,provideService:()=>WoA,provideContext:()=>YoA,passthrough:()=>DoA,once:()=>$oA,onDecision:()=>UoA,modifyDelayEffect:()=>KoA,modifyDelay:()=>ZoA,minuteOfHour:()=>gpA,mapInputEffect:()=>TpA,mapInputContext:()=>_pA,mapInput:()=>SpA,mapEffect:()=>XoA,mapBothEffect:()=>lpA,mapBoth:()=>cpA,map:()=>HoA,makeWithState:()=>HpA,linear:()=>FoA,jitteredWith:()=>GoA,jittered:()=>JoA,isSchedule:()=>XpA,intersectWith:()=>CoA,intersect:()=>EoA,identity:()=>IoA,hourOfDay:()=>vpA,fromFunction:()=>BoA,fromDelays:()=>QoA,fromDelay:()=>AoA,forever:()=>epA,fixed:()=>apA,fibonacci:()=>tpA,exponential:()=>spA,ensuring:()=>rpA,elapsed:()=>ipA,eitherWith:()=>npA,either:()=>opA,duration:()=>ppA,driver:()=>dpA,delays:()=>upA,delayedSchedule:()=>fpA,delayedEffect:()=>mpA,delayed:()=>hpA,dayOfWeek:()=>xpA,dayOfMonth:()=>bpA,cron:()=>jpA,count:()=>kpA,compose:()=>PpA,collectWhileEffect:()=>MpA,collectWhile:()=>LpA,collectUntilEffect:()=>RpA,collectUntil:()=>NpA,collectAllOutputs:()=>wpA,collectAllInputs:()=>VpA,checkEffect:()=>OpA,check:()=>qpA,bothInOut:()=>zpA,asVoid:()=>WpA,as:()=>YpA,andThenEither:()=>$pA,andThen:()=>UpA,addDelayEffect:()=>KpA,addDelay:()=>ZpA,ScheduleTypeId:()=>GpA,ScheduleDriverTypeId:()=>FpA,CurrentIterationMetadata:()=>AnA});var GpA=Kx,FpA=Wa,HpA=XD,XpA=Ux,ZpA=$x,KpA=za,UpA=l5A,$pA=qa,YpA=d5A,WpA=Yx,zpA=p5A,qpA=oz,OpA=YU,VpA=o5A,wpA=WU,NpA=n5A,RpA=i5A,LpA=r5A,MpA=s5A,PpA=t5A,SpA=Oa,TpA=Wx,_pA=a5A,kpA=tXA,jpA=e5A,ypA=SXA,gpA=zXA,vpA=$XA,bpA=AXA,xpA=QXA,hpA=BXA,mpA=zx,fpA=vS,upA=IXA,cpA=DXA,lpA=EXA,dpA=bS,ppA=Va,opA=CXA,npA=JXA,ipA=Rx,rpA=GXA,spA=FXA,tpA=HXA,apA=XXA,epA=v3,AoA=ZXA,QoA=KXA,BoA=UXA,IoA=SF,DoA=Ra,EoA=A5,CoA=wa,JoA=YXA,GoA=Na,FoA=WXA,HoA=F2,XoA=qx,ZoA=qXA,KoA=xS,UoA=OXA,$oA=Lx,YoA=VXA,WoA=wXA,zoA=La,qoA=Ma,OoA=NXA,VoA=Pa,woA=Sa,NoA=Ta,RoA=nz,LoA=Ox,MoA=_a,PoA=v3,SoA=RXA,ToA=LXA,_oA=ka,koA=MXA,joA=TXA,yoA=aXA,goA=_XA,voA=kXA,boA=jXA,xoA=yXA,hoA=hS,moA=ja,foA=Vx,uoA=ya,coA=mS,loA=ga,doA=gXA,poA=vXA,ooA=va,noA=fS,ioA=wx,roA=bXA,soA=xXA,toA=ba,aoA=hXA,eoA=mXA,AnA=$U;var VB={};e1(VB,{withDefaults:()=>MiA,withDecodingDefault:()=>lYA,withConstructorDefault:()=>Y5,validateSync:()=>Z5,validatePromise:()=>HiA,validateOption:()=>se,validateEither:()=>FiA,validate:()=>TYA,validDate:()=>sQA,uppercased:()=>CWA,uncapitalized:()=>HWA,typeSchema:()=>dB,trimmed:()=>aYA,transformOrFail:()=>oE,transformLiterals:()=>liA,transformLiteral:()=>sYA,transform:()=>xB,tag:()=>pYA,symbolWithResult:()=>hF,symbolSerializable:()=>ST,suspend:()=>Wh,successSchema:()=>VQA,startsWith:()=>iiA,standardSchemaV1:()=>IiA,split:()=>tiA,serializeSuccess:()=>LtA,serializeFailure:()=>NtA,serializeExit:()=>PtA,serialize:()=>OtA,serializableSchema:()=>qtA,requiredToOptional:()=>SiA,required:()=>miA,rename:()=>oiA,propertySignature:()=>Kq,positiveBigInt:()=>lQA,positiveBigDecimal:()=>czA,positive:()=>hWA,pluck:()=>viA,pickLiteral:()=>ZiA,pick:()=>nYA,pattern:()=>_QA,partialWith:()=>hiA,partial:()=>xiA,parseNumber:()=>cWA,parseJson:()=>WWA,optionalWith:()=>kiA,optionalToRequired:()=>vF,optionalToOptional:()=>cAA,optionalElement:()=>ViA,optional:()=>_iA,omit:()=>giA,nonPositiveBigInt:()=>oQA,nonPositiveBigDecimal:()=>izA,nonPositive:()=>fWA,nonNegativeBigInt:()=>pQA,nonNegativeBigDecimal:()=>dzA,nonNegative:()=>uWA,nonNaN:()=>xWA,nonEmptyString:()=>vQA,negativeBigInt:()=>dQA,negativeBigDecimal:()=>ozA,negative:()=>mWA,mutable:()=>fiA,multipleOf:()=>ArA,minLength:()=>QWA,minItems:()=>krA,maxLength:()=>niA,maxItems:()=>jrA,makePropertySignature:()=>$G,make:()=>CI,lowercased:()=>DWA,lessThanOrEqualToDuration:()=>VrA,lessThanOrEqualToDate:()=>hrA,lessThanOrEqualToBigInt:()=>IzA,lessThanOrEqualToBigDecimal:()=>wsA,lessThanOrEqualTo:()=>gWA,lessThanDuration:()=>qrA,lessThanDate:()=>xrA,lessThanBigInt:()=>BzA,lessThanBigDecimal:()=>VsA,lessThan:()=>jWA,length:()=>BWA,keyof:()=>OiA,itemsCount:()=>yrA,isSchema:()=>dC,isPropertySignature:()=>yh,is:()=>Jq,int:()=>mQA,instanceOf:()=>vYA,includes:()=>siA,headOrElse:()=>brA,headNonEmpty:()=>vrA,head:()=>grA,greaterThanOrEqualToDuration:()=>NrA,greaterThanOrEqualToDate:()=>frA,greaterThanOrEqualToBigInt:()=>QzA,greaterThanOrEqualToBigDecimal:()=>OsA,greaterThanOrEqualTo:()=>SWA,greaterThanDuration:()=>wrA,greaterThanDate:()=>mrA,greaterThanBigInt:()=>AzA,greaterThanBigDecimal:()=>qsA,greaterThan:()=>MWA,getNumberIndexedAccess:()=>hh,getClassTag:()=>lh,fromKey:()=>PiA,fromBrand:()=>ziA,format:()=>aD,finite:()=>hQA,filterEffect:()=>ciA,filter:()=>pB,failureSchema:()=>OQA,extend:()=>LT,exitSchema:()=>JBA,equivalence:()=>ktA,endsWith:()=>riA,encodedSchema:()=>Lh,encodedBoundSchema:()=>wQA,encodeUnknownSync:()=>ex,encodeUnknownPromise:()=>MYA,encodeUnknownOption:()=>Ah,encodeUnknownEither:()=>LYA,encodeUnknown:()=>Mh,encodeSync:()=>ee,encodePromise:()=>EiA,encodeOption:()=>AAA,encodeEither:()=>DiA,encode:()=>Ph,element:()=>fAA,deserializeSuccess:()=>MtA,deserializeFailure:()=>RtA,deserializeExit:()=>StA,deserialize:()=>VtA,decodeUnknownSync:()=>tx,decodeUnknownPromise:()=>SYA,decodeUnknownOption:()=>ax,decodeUnknownEither:()=>PYA,decodeUnknown:()=>gU,decodeSync:()=>ie,decodePromise:()=>GiA,decodeOption:()=>re,decodeEither:()=>JiA,decode:()=>CiA,declare:()=>kE,compose:()=>Yh,clampDuration:()=>zrA,clampBigInt:()=>BrA,clampBigDecimal:()=>PsA,clamp:()=>QrA,capitalized:()=>GWA,brand:()=>biA,betweenDuration:()=>KzA,betweenDate:()=>urA,betweenBigInt:()=>cQA,betweenBigDecimal:()=>rzA,between:()=>fQA,attachPropertySignature:()=>diA,asserts:()=>ae,asWithResult:()=>wtA,asSerializableWithResult:()=>TtA,asSerializable:()=>ztA,asSchema:()=>kD,annotations:()=>piA,Void:()=>bYA,ValidDateSchemaId:()=>IQA,ValidDateFromSelf:()=>zzA,UppercasedSchemaId:()=>EWA,Uppercased:()=>jQA,Uppercase:()=>KWA,Unknown:()=>$q,UniqueSymbolFromSelf:()=>kYA,Union:()=>pC,UndefinedOr:()=>jU,Undefined:()=>Sh,UncapitalizedSchemaId:()=>FWA,Uncapitalized:()=>gQA,Uncapitalize:()=>$WA,Uint8ArrayFromSelf:()=>xh,Uint8ArrayFromHex:()=>MrA,Uint8ArrayFromBase64Url:()=>LrA,Uint8ArrayFromBase64:()=>RrA,Uint8Array:()=>UzA,Uint8:()=>nQA,UUIDSchemaId:()=>qWA,UUID:()=>OWA,URLFromSelf:()=>xQA,URL:()=>NWA,ULIDSchemaId:()=>VWA,ULID:()=>wWA,TypeId:()=>z5,Tuple:()=>WJ,TrimmedSchemaId:()=>tYA,Trimmed:()=>vh,Trim:()=>YWA,ToPropertySignature:()=>UG,TimeZoneOffsetFromSelf:()=>mh,TimeZoneOffset:()=>LzA,TimeZoneNamedFromSelf:()=>fh,TimeZoneNamed:()=>PzA,TimeZoneFromSelf:()=>eQA,TimeZone:()=>SzA,TemplateLiteralParser:()=>$iA,TemplateLiteral:()=>yYA,TaggedStruct:()=>RT,TaggedRequest:()=>_tA,TaggedError:()=>fsA,TaggedClass:()=>msA,SymbolFromSelf:()=>kh,Symbol:()=>eWA,Struct:()=>FE,StringFromUriComponent:()=>_rA,StringFromHex:()=>TrA,StringFromBase64Url:()=>SrA,StringFromBase64:()=>PrA,String:()=>iI,StartsWithSchemaId:()=>pAA,SortedSetFromSelf:()=>FqA,SortedSet:()=>YtA,SetFromSelf:()=>hzA,Set:()=>YsA,RefineSchemaId:()=>SQA,RedactedFromSelf:()=>CzA,Redacted:()=>XrA,Record:()=>MQA,ReadonlySetFromSelf:()=>xzA,ReadonlySet:()=>$sA,ReadonlyMapFromSelf:()=>BBA,ReadonlyMapFromRecord:()=>HsA,ReadonlyMap:()=>GsA,PropertySignatureTypeId:()=>RQA,PropertySignatureTransformation:()=>p3,PropertySignatureDeclaration:()=>q5,PropertyKey:()=>GBA,PositiveBigIntFromSelf:()=>IrA,PositiveBigInt:()=>DrA,PositiveBigDecimalSchemaId:()=>uzA,PositiveBigDecimalFromSelf:()=>NsA,Positive:()=>pWA,PatternSchemaId:()=>dAA,OptionFromUndefinedOr:()=>erA,OptionFromSelf:()=>bU,OptionFromNullishOr:()=>arA,OptionFromNullOr:()=>trA,OptionFromNonEmptyTrimmedString:()=>kzA,Option:()=>srA,Object:()=>hYA,NumberFromString:()=>uQA,Number:()=>X2,NullishOr:()=>qT,NullOr:()=>zT,Null:()=>Th,Not:()=>sWA,NonPositiveBigIntFromSelf:()=>JrA,NonPositiveBigInt:()=>GrA,NonPositiveBigDecimalSchemaId:()=>nzA,NonPositiveBigDecimalFromSelf:()=>MsA,NonPositive:()=>nWA,NonNegativeInt:()=>qh,NonNegativeBigIntFromSelf:()=>DzA,NonNegativeBigInt:()=>FrA,NonNegativeBigDecimalSchemaId:()=>lzA,NonNegativeBigDecimalFromSelf:()=>RsA,NonNegative:()=>bh,NonNaNSchemaId:()=>bWA,NonNaN:()=>dWA,NonEmptyTrimmedString:()=>bQA,NonEmptyString:()=>zWA,NonEmptyChunkFromSelf:()=>tzA,NonEmptyChunk:()=>ysA,NonEmptyArrayEnsure:()=>RiA,NonEmptyArray:()=>Wq,Never:()=>_h,NegativeBigIntFromSelf:()=>ErA,NegativeBigInt:()=>CrA,NegativeBigDecimalSchemaId:()=>pzA,NegativeBigDecimalFromSelf:()=>LsA,Negative:()=>oWA,MultipleOfSchemaId:()=>TWA,MinLengthSchemaId:()=>AWA,MinItemsSchemaId:()=>$zA,MaxLengthSchemaId:()=>eYA,MaxItemsSchemaId:()=>YzA,MapFromSelf:()=>IBA,MapFromRecord:()=>XsA,Map:()=>FsA,LowercasedSchemaId:()=>IWA,Lowercased:()=>kQA,Lowercase:()=>ZWA,Literal:()=>GE,ListFromSelf:()=>GqA,List:()=>KtA,LessThanSchemaId:()=>kWA,LessThanOrEqualToSchemaId:()=>yWA,LessThanOrEqualToDurationSchemaId:()=>OrA,LessThanOrEqualToDateSchemaId:()=>EQA,LessThanOrEqualToBigIntSchemaId:()=>aAA,LessThanOrEqualToBigDecimalSchemaId:()=>YQA,LessThanDurationSchemaId:()=>VT,LessThanDateSchemaId:()=>DQA,LessThanBigIntSchemaId:()=>tAA,LessThanBigDecimalSchemaId:()=>$QA,LengthSchemaId:()=>lAA,JsonNumberSchemaId:()=>iWA,JsonNumber:()=>rWA,ItemsCountSchemaId:()=>WzA,IntSchemaId:()=>_WA,Int:()=>zh,InstanceOfSchemaId:()=>mAA,IncludesSchemaId:()=>nAA,HashSetFromSelf:()=>CqA,HashSet:()=>EtA,HashMapFromSelf:()=>JqA,HashMap:()=>FtA,GreaterThanSchemaId:()=>LWA,GreaterThanOrEqualToSchemaId:()=>PWA,GreaterThanOrEqualToDurationSchemaId:()=>QQA,GreaterThanOrEqualToDateSchemaId:()=>JQA,GreaterThanOrEqualToBigIntSchemaId:()=>sAA,GreaterThanOrEqualToBigDecimalSchemaId:()=>UQA,GreaterThanDurationSchemaId:()=>AQA,GreaterThanDateSchemaId:()=>CQA,GreaterThanBigIntSchemaId:()=>rAA,GreaterThanBigDecimalSchemaId:()=>KQA,FromPropertySignature:()=>O5,FiniteSchemaId:()=>RWA,Finite:()=>lWA,FiberIdFromSelf:()=>CBA,FiberId:()=>QqA,ExitFromSelf:()=>EqA,Exit:()=>qQA,Enums:()=>UiA,EndsWithSchemaId:()=>oAA,EitherFromUnion:()=>DsA,EitherFromSelf:()=>QBA,Either:()=>IsA,DurationFromSelf:()=>MT,DurationFromNanos:()=>JzA,DurationFromMillis:()=>GzA,Duration:()=>ZzA,Defect:()=>Rh,DateTimeZonedFromSelf:()=>ABA,DateTimeZoned:()=>TzA,DateTimeUtcFromSelf:()=>PT,DateTimeUtcFromNumber:()=>VzA,DateTimeUtcFromDate:()=>wzA,DateTimeUtc:()=>NzA,DateFromString:()=>tQA,DateFromSelfSchemaId:()=>FQA,DateFromSelf:()=>zq,DateFromNumber:()=>OzA,Date:()=>qzA,DataFromSelf:()=>azA,Data:()=>bsA,Config:()=>WtA,Class:()=>hsA,ChunkFromSelf:()=>szA,Chunk:()=>_sA,Char:()=>XWA,CauseFromSelf:()=>Nh,Cause:()=>ssA,CapitalizedSchemaId:()=>JWA,Capitalized:()=>yQA,Capitalize:()=>UWA,BrandSchemaId:()=>hAA,BooleanFromUnknown:()=>HqA,BooleanFromString:()=>XqA,Boolean:()=>Yq,BigIntFromSelf:()=>V5,BigIntFromNumber:()=>EzA,BigInt:()=>vU,BigDecimalFromSelf:()=>w5,BigDecimalFromNumber:()=>fzA,BigDecimal:()=>mzA,BetweenSchemaId:()=>vWA,BetweenDurationSchemaId:()=>BQA,BetweenDateSchemaId:()=>GQA,BetweenBigIntSchemaId:()=>eAA,BetweenBigDecimalSchemaId:()=>WQA,ArrayFormatterIssue:()=>ZqA,ArrayEnsure:()=>NiA,Array:()=>eD,Any:()=>xYA});var sKA=/^[+-]?\d+$/,IAA=Symbol.for("effect/BigDecimal"),QnA={[IAA]:IAA,[hQ](){let A=TU(this);return IA(LQ(A.value),GB(c6(A.scale)),_B(this))},[xQ](A){return EAA(A)&&InA(this,A)},toString(){return`BigDecimal(${l3(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[kB](){return this.toJSON()},pipe(){return RQ(this,arguments)}},EAA=(A)=>VQ(A,IAA),U5=(A,Q)=>{let B=Object.create(QnA);return B.value=A,B.scale=Q,B},aKA=(A,Q)=>{if(A!==c3&&A%DAA===c3)throw RangeError("Value must be normalized");let B=U5(A,Q);return B.normalized=B,B},c3=BigInt(0);var DAA=BigInt(10),eKA=aKA(c3,0),TU=(A)=>{if(A.normalized===void 0)if(A.value===c3)A.normalized=eKA;else{let Q=`${A.value}`,B=0;for(let C=Q.length-1;C>=0;C--)if(Q[C]==="0")B++;else break;if(B===0)A.normalized=A;let I=BigInt(Q.substring(0,Q.length-B)),D=A.scale-B;A.normalized=aKA(I,D)}return A.normalized},Dh=y(2,(A,Q)=>{if(Q>A.scale)return U5(A.value*DAA**BigInt(Q-A.scale),Q);if(Q<A.scale)return U5(A.value/DAA**BigInt(A.scale-Q),Q);return A});var Gq=HK((A,Q)=>{let B=Ug(tKA(A),tKA(Q));if(B!==0)return B;if(A.scale>Q.scale)return lW(A.value,Dh(Q,A.scale).value);if(A.scale<Q.scale)return lW(Dh(A,Q.scale).value,Q.value);return lW(A.value,Q.value)}),AUA=pW(Gq),QUA=rM(Gq),BUA=XK(Gq),IUA=sM(Gq),DUA=oW(Gq),EUA=WH(Gq);var tKA=(A)=>A.value===c3?0:A.value<c3?-1:1,BnA=(A)=>A.value<c3?U5(-A.value,A.scale):A;var CAA=$E((A,Q)=>{if(A.scale>Q.scale)return Dh(Q,A.scale).value===A.value;if(A.scale<Q.scale)return Dh(A,Q.scale).value===Q.value;return A.value===Q.value}),InA=y(2,(A,Q)=>CAA(A,Q));var CUA=(A)=>Yn(DnA(A),()=>RangeError(`Number must be finite, got ${A}`));var DnA=(A)=>{if(!Number.isFinite(A))return pA();let Q=`${A}`;if(Q.includes("e"))return JAA(Q);let[B,I=""]=Q.split(".");return oA(U5(BigInt(`${B}${I}`),I.length))},JAA=(A)=>{if(A==="")return oA(eKA);let Q,B,I=A.search(/[eE]/);if(I!==-1){let Z=A.slice(I+1);if(Q=A.slice(0,I),B=Number(Z),Q===""||!Number.isSafeInteger(B)||!sKA.test(Z))return pA()}else Q=A,B=0;let D,C,G=Q.search(/\./);if(G!==-1){let Z=Q.slice(0,G),U=Q.slice(G+1);D=`${Z}${U}`,C=U.length}else D=Q,C=0;if(!sKA.test(D))return pA();let H=C-B;if(!Number.isSafeInteger(H))return pA();return oA(U5(BigInt(D),H))};var l3=(A)=>{let Q=TU(A);if(Math.abs(Q.scale)>=16)return EnA(Q);let B=Q.value<c3,I=B?`${Q.value}`.substring(1):`${Q.value}`,D,C;if(Q.scale>=I.length)D="0",C="0".repeat(Q.scale-I.length)+I;else{let H=I.length-Q.scale;if(H>I.length){let Z=H-I.length;D=`${I}${"0".repeat(Z)}`,C=""}else C=I.slice(H),D=I.slice(0,H)}let G=C===""?D:`${D}.${C}`;return B?`-${G}`:G},EnA=(A)=>{if(CnA(A))return"0e+0";let Q=TU(A),B=`${BnA(Q).value}`,I=B.slice(0,1),D=B.slice(1),C=`${GAA(Q)?"-":""}${I}`;if(D!=="")C+=`.${D}`;let G=D.length-Q.scale;return`${C}e${G>=0?"+":""}${G}`},JUA=(A)=>Number(l3(A));var CnA=(A)=>A.value===c3,GAA=(A)=>A.value<c3,GUA=(A)=>A.value>c3;var GnA=lW;var FUA=WH(GnA);var HUA=(A)=>{if(A>BigInt(Number.MAX_SAFE_INTEGER)||A<BigInt(Number.MIN_SAFE_INTEGER))return pA();return oA(Number(A))},XUA=(A)=>{try{return A.trim()===""?pA():oA(BigInt(A))}catch{return pA()}},ZUA=(A)=>{if(A>Number.MAX_SAFE_INTEGER||A<Number.MIN_SAFE_INTEGER)return pA();try{return oA(BigInt(A))}catch{return pA()}};var KUA=yr;var UUA="effect/Redacted",Fq=$B("effect/Redacted/redactedRegistry",()=>new WeakMap),FAA=Symbol.for(UUA),XnA={[FAA]:{_A:(A)=>A},pipe(){return RQ(this,arguments)},toString(){return"<redacted>"},toJSON(){return"<redacted>"},[kB](){return"<redacted>"},[hQ](){return IA(LQ(UUA),GB(LQ(Fq.get(this))),_B(this))},[xQ](A){return HAA(A)&&NQ(Fq.get(this),Fq.get(A))}},HAA=(A)=>VQ(A,FAA),$UA=(A)=>{let Q=Object.create(XnA);return Fq.set(Q,A),Q},YUA=(A)=>{if(Fq.has(A))return Fq.get(A);else throw Error("Unable to get redacted value")};var KnA="effect/Config",WUA=Symbol.for(KnA),UnA={_A:(A)=>A},XAA={...O3,[WUA]:UnA,commit(){return vJA(this)}};var zUA=y(2,(A,Q)=>{let B=Object.create(XAA);return B._tag=xv,B.original=A,B.mapOrFail=Q,B}),qUA=y(2,(A,Q)=>{let B=Object.create(XAA);return B._tag=hv,B.name=Q,B.config=A,B});var OUA=(A,Q)=>{let B=Object.create(XAA);return B._tag=mv,B.description=A,B.parse=Q,B};var VUA=(A)=>{let Q=OUA("a text property",cQ);return A===void 0?Q:qUA(Q,A)};var wUA=zUA;var NUA=VUA;var ZAA=KU;var RUA=U5A,LUA=Fx,MUA=$5A,PUA=Qa,KAA=Y5A;var SUA=lz,TUA=Ba,_UA=UU;var kUA=z5A;var UAA=Ia,$AA=jS;var jUA=yS,yUA=O5A;var gUA=PF;var vUA=Ca;var bUA=P5A;var xUA=Ha;var YAA=Symbol.for("effect/Encoding/errors/Decode"),YJ=(A,Q)=>{let B={_tag:"DecodeException",[YAA]:YAA,input:A};if(cE(Q))B.message=Q;return B};var WAA=Symbol.for("effect/Encoding/errors/Encode"),hUA=(A,Q)=>{let B={_tag:"EncodeException",[WAA]:WAA,input:A};if(cE(Q))B.message=Q;return B};var Eh=new TextEncoder,Ch=new TextDecoder;var XT=(A)=>{let Q=A.length,B="",I;for(I=2;I<Q;I+=3)B+=yF[A[I-2]>>2],B+=yF[(A[I-2]&3)<<4|A[I-1]>>4],B+=yF[(A[I-1]&15)<<2|A[I]>>6],B+=yF[A[I]&63];if(I===Q+1)B+=yF[A[I-2]>>2],B+=yF[(A[I-2]&3)<<4],B+="==";if(I===Q)B+=yF[A[I-2]>>2],B+=yF[(A[I-2]&3)<<4|A[I-1]>>4],B+=yF[(A[I-1]&15)<<2],B+="=";return B},Gh=(A)=>{let Q=zAA(A),B=Q.length;if(B%4!==0)return mQ(YJ(Q,`Length must be a multiple of 4, but is ${B}`));let I=Q.indexOf("=");if(I!==-1&&(I<B-2||I===B-2&&Q[B-1]!=="="))return mQ(YJ(Q,"Found a '=' character, but it is not at the end"));try{let D=Q.endsWith("==")?2:Q.endsWith("=")?1:0,C=new Uint8Array(3*(B/4)-D);for(let G=0,H=0;G<B;G+=4,H+=3){let Z=Jh(Q.charCodeAt(G))<<18|Jh(Q.charCodeAt(G+1))<<12|Jh(Q.charCodeAt(G+2))<<6|Jh(Q.charCodeAt(G+3));C[H]=Z>>16,C[H+1]=Z>>8&255,C[H+2]=Z&255}return cQ(C)}catch(D){return mQ(YJ(Q,D instanceof Error?D.message:"Invalid input"))}},zAA=(A)=>A.replace(/[\n\r]/g,"");function Jh(A){if(A>=mUA.length)throw TypeError(`Invalid character ${String.fromCharCode(A)}`);let Q=mUA[A];if(Q===255)throw TypeError(`Invalid character ${String.fromCharCode(A)}`);return Q}var yF=["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","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","0","1","2","3","4","5","6","7","8","9","+","/"],mUA=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];var qAA=(A)=>XT(A).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),uUA=(A)=>{let Q=zAA(A),B=Q.length;if(B%4===1)return mQ(YJ(Q,`Length should be a multiple of 4, but is ${B}`));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(Q))return mQ(YJ(Q,"Invalid input"));let I=B%4===2?`${Q}==`:B%4===3?`${Q}=`:Q;return I=I.replace(/-/g,"+").replace(/_/g,"/"),Gh(I)};var OAA=(A)=>{let Q="";for(let B=0;B<A.length;++B)Q+=OnA[A[B]];return Q},lUA=(A)=>{let Q=new TextEncoder().encode(A);if(Q.length%2!==0)return mQ(YJ(A,`Length must be a multiple of 2, but is ${Q.length}`));try{let B=Q.length/2,I=new Uint8Array(B);for(let D=0;D<B;D++){let C=cUA(Q[D*2]),G=cUA(Q[D*2+1]);I[D]=C<<4|G}return cQ(I)}catch(B){return mQ(YJ(A,B instanceof Error?B.message:"Invalid input"))}},OnA=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],cUA=(A)=>{if(48<=A&&A<=57)return A-48;if(97<=A&&A<=102)return A-97+10;if(65<=A&&A<=70)return A-65+10;throw TypeError("Invalid input")};var VAA=(A)=>typeof A==="string"?XT(Eh.encode(A)):XT(A),wAA=(A)=>Gh(A),dUA=(A)=>V8(wAA(A),(Q)=>Ch.decode(Q)),NAA=(A)=>typeof A==="string"?qAA(Eh.encode(A)):qAA(A),RAA=(A)=>uUA(A),pUA=(A)=>V8(RAA(A),(Q)=>Ch.decode(Q)),LAA=(A)=>typeof A==="string"?OAA(Eh.encode(A)):OAA(A),MAA=(A)=>lUA(A),oUA=(A)=>V8(MAA(A),(Q)=>Ch.decode(Q)),nUA=(A)=>GK({try:()=>encodeURIComponent(A),catch:(Q)=>NnA(A,Q instanceof Error?Q.message:"Invalid input")}),iUA=(A)=>GK({try:()=>decodeURIComponent(A),catch:(Q)=>wnA(A,Q instanceof Error?Q.message:"Invalid input")});var wnA=YJ;var NnA=hUA;class Fh{[Symbol.iterator](){return this}next(A){return{value:A,done:!0}}}Fh.nil=new Fh;function rUA(){return Fh.nil}function*sUA(A,Q){for(let B of A)yield Q(B)}function*tUA(A,Q){for(let B of A)yield*Q(B)}function*aUA(A,Q){for(let B of A)if(Q(B))yield B}function*eUA(A,Q){for(let B=0;B<Q;++B){let I=A.next();if(I.done)break;yield I.value}}function*A$A(A,Q){let B=A.next();while(!B.done&&Q(B.value))yield B.value,B=A.next()}function*Q$A(A,Q){for(let B=A.next();!B.done;B=A.next())yield B.value;for(let B of Q)for(let I=B.next();!I.done;I=B.next())yield I.value}var LnA=Symbol.iterator;class IC{static nil(){return new IC(rUA())}static of(...A){return new IC(A[LnA]())}constructor(A){this.g=A}next(){return this.g.next()}[Symbol.iterator](){return this.g}map(A){return new IC(sUA(this.g,A))}flatMap(A){return new IC(tUA(this.g,A))}dropWhile(A){let Q=!1;function*B(I){if(Q||!A(I))Q=!0,yield I}return this.flatMap(B)}drop(A){if(A<=0)return this;let Q=0;function B(){return Q++<A}return this.dropWhile(B)}takeWhile(A){return new IC(A$A(this.g,A))}take(A){return new IC(eUA(this.g,A))}filter(A){return new IC(aUA(this.g,A))}every(A){for(let Q of this.g)if(!A(Q))return!1;return!0}has(A){for(let Q of this.g)if(A(Q))return[!0,Q];return[!1,null]}join(...A){return new IC(Q$A(this.g,A))}getNthOrLast(A){let Q=A,B=null;for(let I of this.g){if(Q--===0)return I;B=I}return B}}function PAA(A){return new IC(A)}var gF=Symbol.for("fast-check/cloneMethod");function ZT(A){return A!==null&&(typeof A==="object"||typeof A==="function")&&gF in A&&typeof A[gF]==="function"}function KT(A){return ZT(A)?A[gF]():A}var MnA=Object.defineProperty;class p0{constructor(A,Q,B=void 0){if(this.value_=A,this.context=Q,this.hasToBeCloned=B!==void 0||ZT(A),this.readOnce=!1,this.hasToBeCloned)MnA(this,"value",{get:B!==void 0?B:this.getValue});else this.value=A}getValue(){if(this.hasToBeCloned){if(!this.readOnce)return this.readOnce=!0,this.value_;return this.value_[gF]()}return this.value_}}var B$A=Object.assign;class KG{filter(A){return new E$A(this,A)}map(A,Q){return new D$A(this,A,Q)}chain(A){return new I$A(this,A)}noShrink(){return new C$A(this)}noBias(){return new J$A(this)}}class I$A extends KG{constructor(A,Q){super();this.arb=A,this.chainer=Q}generate(A,Q){let B=A.clone(),I=this.arb.generate(A,Q);return this.valueChainer(I,A,B,Q)}canShrinkWithoutContext(A){return!1}shrink(A,Q){if(this.isSafeContext(Q))return(!Q.stoppedForOriginal?this.arb.shrink(Q.originalValue,Q.originalContext).map((B)=>this.valueChainer(B,Q.clonedMrng.clone(),Q.clonedMrng,Q.originalBias)):IC.nil()).join(Q.chainedArbitrary.shrink(A,Q.chainedContext).map((B)=>{let I=B$A(B$A({},Q),{chainedContext:B.context,stoppedForOriginal:!0});return new p0(B.value_,I)}));return IC.nil()}valueChainer(A,Q,B,I){let D=this.chainer(A.value_),C=D.generate(Q,I),G={originalBias:I,originalValue:A.value_,originalContext:A.context,stoppedForOriginal:!1,chainedArbitrary:D,chainedContext:C.context,clonedMrng:B};return new p0(C.value_,G)}isSafeContext(A){return A!=null&&typeof A==="object"&&"originalBias"in A&&"originalValue"in A&&"originalContext"in A&&"stoppedForOriginal"in A&&"chainedArbitrary"in A&&"chainedContext"in A&&"clonedMrng"in A}}class D$A extends KG{constructor(A,Q,B){super();this.arb=A,this.mapper=Q,this.unmapper=B,this.bindValueMapper=(I)=>this.valueMapper(I)}generate(A,Q){let B=this.arb.generate(A,Q);return this.valueMapper(B)}canShrinkWithoutContext(A){if(this.unmapper!==void 0)try{let Q=this.unmapper(A);return this.arb.canShrinkWithoutContext(Q)}catch(Q){return!1}return!1}shrink(A,Q){if(this.isSafeContext(Q))return this.arb.shrink(Q.originalValue,Q.originalContext).map(this.bindValueMapper);if(this.unmapper!==void 0){let B=this.unmapper(A);return this.arb.shrink(B,void 0).map(this.bindValueMapper)}return IC.nil()}mapperWithCloneIfNeeded(A){let Q=A.value,B=this.mapper(Q);if(A.hasToBeCloned&&(typeof B==="object"&&B!==null||typeof B==="function")&&Object.isExtensible(B)&&!ZT(B))Object.defineProperty(B,gF,{get:()=>()=>this.mapperWithCloneIfNeeded(A)[0]});return[B,Q]}valueMapper(A){let[Q,B]=this.mapperWithCloneIfNeeded(A),I={originalValue:B,originalContext:A.context};return new p0(Q,I)}isSafeContext(A){return A!=null&&typeof A==="object"&&"originalValue"in A&&"originalContext"in A}}class E$A extends KG{constructor(A,Q){super();this.arb=A,this.refinement=Q,this.bindRefinementOnValue=(B)=>this.refinementOnValue(B)}generate(A,Q){while(!0){let B=this.arb.generate(A,Q);if(this.refinementOnValue(B))return B}}canShrinkWithoutContext(A){return this.arb.canShrinkWithoutContext(A)&&this.refinement(A)}shrink(A,Q){return this.arb.shrink(A,Q).filter(this.bindRefinementOnValue)}refinementOnValue(A){return this.refinement(A.value)}}class C$A extends KG{constructor(A){super();this.arb=A}generate(A,Q){return this.arb.generate(A,Q)}canShrinkWithoutContext(A){return this.arb.canShrinkWithoutContext(A)}shrink(A,Q){return IC.nil()}noShrink(){return this}}class J$A extends KG{constructor(A){super();this.arb=A}generate(A,Q){return this.arb.generate(A,void 0)}canShrinkWithoutContext(A){return this.arb.canShrinkWithoutContext(A)}shrink(A,Q){return this.arb.shrink(A,Q)}noBias(){return this}}var G$A=Function.prototype.apply,SAA=Symbol("apply");function PnA(A){try{return A.apply}catch(Q){return}}function SnA(A,Q,B){let I=A;I[SAA]=G$A;let D=I[SAA](Q,B);return delete I[SAA],D}function _U(A,Q,B){if(PnA(A)===G$A)return A.apply(Q,B);return SnA(A,Q,B)}var URQ=Array.prototype.forEach,F$A=Array.prototype.indexOf,$RQ=Array.prototype.join,H$A=Array.prototype.map,YRQ=Array.prototype.filter,X$A=Array.prototype.push,WRQ=Array.prototype.pop,zRQ=Array.prototype.splice,Z$A=Array.prototype.slice,qRQ=Array.prototype.sort,ORQ=Array.prototype.every;function TnA(A){try{return A.indexOf}catch(Q){return}}function _nA(A){try{return A.map}catch(Q){return}}function knA(A){try{return A.push}catch(Q){return}}function jnA(A){try{return A.slice}catch(Q){return}}function TAA(A,...Q){if(TnA(A)===F$A)return A.indexOf(...Q);return _U(F$A,A,Q)}function UT(A,Q){if(_nA(A)===H$A)return A.map(Q);return _U(H$A,A,[Q])}function $5(A,...Q){if(knA(A)===X$A)return A.push(...Q);return _U(X$A,A,Q)}function Hq(A,...Q){if(jnA(A)===Z$A)return A.slice(...Q);return _U(Z$A,A,Q)}var VRQ=Date.prototype.getTime,wRQ=Date.prototype.toISOString;var NRQ=Set.prototype.add,RRQ=Set.prototype.has;var LRQ=WeakMap.prototype.set,MRQ=WeakMap.prototype.get;var K$A=Map.prototype.set,U$A=Map.prototype.get;function ynA(A){try{return A.set}catch(Q){return}}function gnA(A){try{return A.get}catch(Q){return}}function $$A(A,Q,B){if(ynA(A)===K$A)return A.set(Q,B);return _U(K$A,A,[Q,B])}function Y$A(A,Q){if(gnA(A)===U$A)return A.get(Q);return _U(U$A,A,[Q])}var PRQ=String.prototype.split,SRQ=String.prototype.startsWith,TRQ=String.prototype.endsWith,_RQ=String.prototype.substring,kRQ=String.prototype.toLowerCase,jRQ=String.prototype.toUpperCase,yRQ=String.prototype.padStart,gRQ=String.prototype.charCodeAt,vRQ=String.prototype.normalize,bRQ=String.prototype.replace;var xRQ=Number.prototype.toString;class W$A{constructor(A){this.producer=A}[Symbol.iterator](){if(this.it===void 0)this.it=this.producer();return this.it}next(){if(this.it===void 0)this.it=this.producer();return this.it.next()}}function Hh(A){return new W$A(A)}var vnA={};function z$A(){return vnA}var{floor:bnA,log:q$A}=Math;function O$A(A){return bnA(q$A(A)/q$A(2))}function V$A(A,Q,B){if(A===Q)return[{min:A,max:Q}];if(A<0&&Q>0){let G=B(-A),H=B(Q);return[{min:-G,max:H},{min:Q-H,max:Q},{min:A,max:A+G}]}let I=B(Q-A),D={min:A,max:A+I},C={min:Q-I,max:Q};return A<0?[C,D]:[D,C]}var{ceil:xnA,floor:hnA}=Math;function w$A(A){return hnA(A/2)}function N$A(A){return xnA(A/2)}function _AA(A,Q,B){let I=A-Q;function*D(){let G=B?void 0:Q,H=B?I:w$A(I);for(let Z=H;Z>0;Z=w$A(Z)){let U=Z===I?Q:A-Z;yield new p0(U,G),G=U}}function*C(){let G=B?void 0:Q,H=B?I:N$A(I);for(let Z=H;Z<0;Z=N$A(Z)){let U=Z===I?Q:A-Z;yield new p0(U,G),G=U}}return I>0?PAA(D()):PAA(C())}var R$A=Math.sign,mnA=Number.isInteger,fnA=Object.is;class Xh extends KG{constructor(A,Q){super();this.min=A,this.max=Q}generate(A,Q){let B=this.computeGenerateRange(A,Q);return new p0(A.nextInt(B.min,B.max),void 0)}canShrinkWithoutContext(A){return typeof A==="number"&&mnA(A)&&!fnA(A,-0)&&this.min<=A&&A<=this.max}shrink(A,Q){if(!Xh.isValidContext(A,Q)){let B=this.defaultTarget();return _AA(A,B,!0)}if(this.isLastChanceTry(A,Q))return IC.of(new p0(Q,void 0));return _AA(A,Q,!1)}defaultTarget(){if(this.min<=0&&this.max>=0)return 0;return this.min<0?this.max:this.min}computeGenerateRange(A,Q){if(Q===void 0||A.nextInt(1,Q)!==1)return{min:this.min,max:this.max};let B=V$A(this.min,this.max,O$A);if(B.length===1)return B[0];let I=A.nextInt(-2*(B.length-1),B.length-2);return I<0?B[0]:B[I+1]}isLastChanceTry(A,Q){if(A>0)return A===Q+1&&A>this.min;if(A<0)return A===Q-1&&A<this.max;return!1}static isValidContext(A,Q){if(Q===void 0)return!1;if(typeof Q!=="number")throw Error("Invalid context type passed to IntegerArbitrary (#1)");if(Q!==0&&R$A(A)!==R$A(Q))throw Error("Invalid context value passed to IntegerArbitrary (#2)");return!0}}var L$A=Number.isInteger;function unA(A){let Q=A.min!==void 0?A.min:-2147483648,B=A.max!==void 0?A.max:2147483647;return{min:Q,max:B}}function kAA(A={}){let Q=unA(A);if(Q.min>Q.max)throw Error("fc.integer maximum value should be equal or greater than the minimum one");if(!L$A(Q.min))throw Error("fc.integer minimum value should be an integer");if(!L$A(Q.max))throw Error("fc.integer maximum value should be an integer");return new Xh(Q.min,Q.max)}var M$A=new Map;function P$A(A){if(A===void 0)return{depth:0};if(typeof A!=="string")return A;let Q=Y$A(M$A,A);if(Q!==void 0)return Q;let B={depth:0};return $$A(M$A,A,B),B}class jAA{constructor(A,Q,B){this.arb=A,this.mrng=Q,this.biasFactor=B}attemptExact(){return}next(){return this.arb.generate(this.mrng,this.biasFactor)}}var{min:cnA,max:lnA}=Math;class yAA{constructor(A,Q,B,I){this.arb=A,this.mrng=Q,this.slices=B,this.biasFactor=I,this.activeSliceIndex=0,this.nextIndexInSlice=0,this.lastIndexInSlice=-1}attemptExact(A){if(A!==0&&this.mrng.nextInt(1,this.biasFactor)===1){let Q=[];for(let B=0;B!==this.slices.length;++B)if(this.slices[B].length===A)$5(Q,B);if(Q.length===0)return;this.activeSliceIndex=Q[this.mrng.nextInt(0,Q.length-1)],this.nextIndexInSlice=0,this.lastIndexInSlice=A-1}}next(){if(this.nextIndexInSlice<=this.lastIndexInSlice)return new p0(this.slices[this.activeSliceIndex][this.nextIndexInSlice++],void 0);if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.arb.generate(this.mrng,this.biasFactor);this.activeSliceIndex=this.mrng.nextInt(0,this.slices.length-1);let A=this.slices[this.activeSliceIndex];if(this.mrng.nextInt(1,this.biasFactor)!==1)return this.nextIndexInSlice=1,this.lastIndexInSlice=A.length-1,new p0(A[0],void 0);let Q=this.mrng.nextInt(0,A.length-1),B=this.mrng.nextInt(0,A.length-1);return this.nextIndexInSlice=cnA(Q,B),this.lastIndexInSlice=lnA(Q,B),new p0(A[this.nextIndexInSlice++],void 0)}}function gAA(A,Q,B,I){if(I===void 0||B.length===0||Q.nextInt(1,I)!==1)return new jAA(A,Q,I);return new yAA(A,Q,B,I)}var{floor:dnA,log:S$A,max:T$A}=Math,pnA=Array.isArray;function vAA(A,Q){if(A===Q)return A;return A+dnA(S$A(Q-A)/S$A(2))}class Zh extends KG{constructor(A,Q,B,I,D,C,G){super();this.arb=A,this.minLength=Q,this.maxGeneratedLength=B,this.maxLength=I,this.setBuilder=C,this.customSlices=G,this.lengthArb=kAA({min:Q,max:B}),this.depthContext=P$A(D)}preFilter(A){if(this.setBuilder===void 0)return A;let Q=this.setBuilder();for(let B=0;B!==A.length;++B)Q.tryAdd(A[B]);return Q.getData()}static makeItCloneable(A,Q){return A[gF]=()=>{let B=[];for(let I=0;I!==Q.length;++I)$5(B,Q[I].value);return this.makeItCloneable(B,Q),B},A}generateNItemsNoDuplicates(A,Q,B,I){let D=0,C=A(),G=gAA(this.arb,B,this.customSlices,I);while(C.size()<Q&&D<this.maxGeneratedLength){let H=G.next();if(C.tryAdd(H))D=0;else D+=1}return C.getData()}safeGenerateNItemsNoDuplicates(A,Q,B,I){let D=T$A(0,Q-vAA(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=D;try{return this.generateNItemsNoDuplicates(A,Q,B,I)}finally{this.depthContext.depth-=D}}generateNItems(A,Q,B){let I=[],D=gAA(this.arb,Q,this.customSlices,B);D.attemptExact(A);for(let C=0;C!==A;++C){let G=D.next();$5(I,G)}return I}safeGenerateNItems(A,Q,B){let I=T$A(0,A-vAA(this.minLength,this.maxGeneratedLength));this.depthContext.depth+=I;try{return this.generateNItems(A,Q,B)}finally{this.depthContext.depth-=I}}wrapper(A,Q,B,I){let D=Q?this.preFilter(A):A,C=!1,G=[],H=[];for(let U=0;U!==D.length;++U){let O=D[U];C=C||O.hasToBeCloned,$5(G,O.value),$5(H,O.context)}if(C)Zh.makeItCloneable(G,D);let Z={shrunkOnce:Q,lengthContext:A.length===D.length&&B!==void 0?B:void 0,itemsContexts:H,startIndex:I};return new p0(G,Z)}generate(A,Q){let B=this.applyBias(A,Q),I=B.size,D=this.setBuilder!==void 0?this.safeGenerateNItemsNoDuplicates(this.setBuilder,I,A,B.biasFactorItems):this.safeGenerateNItems(I,A,B.biasFactorItems);return this.wrapper(D,!1,void 0,0)}applyBias(A,Q){if(Q===void 0)return{size:this.lengthArb.generate(A,void 0).value};if(this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(A,void 0).value,biasFactorItems:Q};if(A.nextInt(1,Q)!==1)return{size:this.lengthArb.generate(A,void 0).value};if(A.nextInt(1,Q)!==1||this.minLength===this.maxGeneratedLength)return{size:this.lengthArb.generate(A,void 0).value,biasFactorItems:Q};let B=vAA(this.minLength,this.maxGeneratedLength);return{size:kAA({min:this.minLength,max:B}).generate(A,void 0).value,biasFactorItems:Q}}canShrinkWithoutContext(A){if(!pnA(A)||this.minLength>A.length||A.length>this.maxLength)return!1;for(let B=0;B!==A.length;++B){if(!(B in A))return!1;if(!this.arb.canShrinkWithoutContext(A[B]))return!1}return this.preFilter(UT(A,(B)=>new p0(B,void 0))).length===A.length}shrinkItemByItem(A,Q,B){let I=[];for(let D=Q.startIndex;D<B;++D)$5(I,Hh(()=>this.arb.shrink(A[D],Q.itemsContexts[D]).map((C)=>{let G=UT(Hq(A,0,D),(Z,U)=>new p0(KT(Z),Q.itemsContexts[U])),H=UT(Hq(A,D+1),(Z,U)=>new p0(KT(Z),Q.itemsContexts[U+D+1]));return[[...G,C,...H],void 0,D]})));return IC.nil().join(...I)}shrinkImpl(A,Q){if(A.length===0)return IC.nil();let B=Q!==void 0?Q:{shrunkOnce:!1,lengthContext:void 0,itemsContexts:[],startIndex:0};return this.lengthArb.shrink(A.length,B.lengthContext).drop(B.shrunkOnce&&B.lengthContext===void 0&&A.length>this.minLength+1?1:0).map((I)=>{let D=A.length-I.value;return[UT(Hq(A,D),(C,G)=>new p0(KT(C),B.itemsContexts[G+D])),I.context,0]}).join(Hh(()=>A.length>this.minLength?this.shrinkItemByItem(A,B,1):this.shrinkItemByItem(A,B,A.length))).join(A.length>this.minLength?Hh(()=>{let I={shrunkOnce:!1,lengthContext:void 0,itemsContexts:Hq(B.itemsContexts,1),startIndex:0};return this.shrinkImpl(Hq(A,1),I).filter((D)=>this.minLength<=D[0].length+1).map((D)=>{return[[new p0(KT(A[0]),B.itemsContexts[0]),...D[0]],void 0,0]})}):IC.nil())}shrink(A,Q){return this.shrinkImpl(A,Q).map((B)=>this.wrapper(B[0],!0,B[1],B[2]))}}var{floor:onA,min:nnA}=Math,_$A=2147483647,Xq=["xsmall","small","medium","large","xlarge"],inA=["-4","-3","-2","-1","=","+1","+2","+3","+4"],rnA="small";function snA(A,Q){switch(Q){case"xsmall":return onA(1.1*A)+1;case"small":return 2*A+10;case"medium":return 11*A+100;case"large":return 101*A+1000;case"xlarge":return 1001*A+1e4;default:throw Error(`Unable to compute lengths based on received size: ${Q}`)}}function tnA(A,Q){let B=TAA(inA,A);if(B===-1)return A;let I=TAA(Xq,Q);if(I===-1)throw Error(`Unable to offset size based on the unknown defaulted one: ${Q}`);let D=I+B-4;return D<0?Xq[0]:D>=Xq.length?Xq[Xq.length-1]:Xq[D]}function k$A(A,Q,B,I){let{baseSize:D=rnA,defaultSizeToMaxWhenMaxSpecified:C}=z$A()||{},G=A!==void 0?A:I&&C?"max":D;if(G==="max")return B;let H=tnA(G,D);return nnA(snA(Q,H),B)}function bAA(A,Q={}){let B=Q.size,I=Q.minLength||0,D=Q.maxLength,C=Q.depthIdentifier,G=D!==void 0?D:_$A,Z=k$A(B,I,G,D!==void 0),U=Q.experimentalCustomSlices||[];return new Zh(A,I,Z,G,C,void 0,U)}var j$A=Symbol.for("effect/SchemaId/DateFromSelf"),y$A=Symbol.for("effect/SchemaId/GreaterThan"),g$A=Symbol.for("effect/SchemaId/GreaterThanOrEqualTo"),v$A=Symbol.for("effect/SchemaId/LessThan"),b$A=Symbol.for("effect/SchemaId/LessThanOrEqualTo"),x$A=Symbol.for("effect/SchemaId/Int"),h$A=Symbol.for("effect/SchemaId/NonNaN"),m$A=Symbol.for("effect/SchemaId/Finite"),f$A=Symbol.for("effect/SchemaId/JsonNumber"),u$A=Symbol.for("effect/SchemaId/Between"),c$A=Symbol.for("effect/SchemaId/GreaterThanBigint"),l$A=Symbol.for("effect/SchemaId/GreaterThanOrEqualToBigint"),d$A=Symbol.for("effect/SchemaId/LessThanBigint"),p$A=Symbol.for("effect/SchemaId/LessThanOrEqualToBigint"),o$A=Symbol.for("effect/SchemaId/BetweenBigint"),n$A=Symbol.for("effect/SchemaId/MinLength"),i$A=Symbol.for("effect/SchemaId/MaxLength"),r$A=Symbol.for("effect/SchemaId/Length"),s$A=Symbol.for("effect/SchemaId/MinItems"),t$A=Symbol.for("effect/SchemaId/MaxItems"),a$A=Symbol.for("effect/SchemaId/ItemsCount");var e$A=HAA,Kh=$UA,$T=YUA;var AYA=(A)=>$E((Q,B)=>A($T(Q),$T(B)));var QYA=y((A)=>$C(A[0]),(A,...Q)=>{let B={};for(let I of Q)if(I in A)B[I]=A[I];return B}),BYA=y((A)=>$C(A[0]),(A,...Q)=>{let B={...A};for(let I of Q)delete B[I];return B});var z5=Symbol.for("effect/Schema");function CI(A){return class{[z5]=xAA;static ast=A;static annotations(B){return CI(k1(this.ast,B))}static pipe(){return RQ(this,arguments)}static toString(){return String(A)}static Type;static Encoded;static Context;static[z5]=xAA}}var xAA={_A:(A)=>A,_I:(A)=>A,_R:(A)=>A},IYA=(A)=>Rb(A)?A.value:QiA(PS(A.cause)),QiA=(A)=>({issues:[{message:A}]}),BiA=(A)=>U4(Dq.formatIssue(A),(Q)=>({issues:Q.map((B)=>({path:B.path,message:B.message}))})),IiA=(A,Q)=>{let B=l0(A,{errors:"all"});return class extends CI(A.ast){static "~standard"={version:1,vendor:"effect",validate(D){let C=new eK,G=lS(Ie(B(D,Q),{onFailure:BiA,onSuccess:(Z)=>aa({value:Z})}),{scheduler:C});C.flush();let H=G.unsafePoll();if(H)return IYA(H);return new Promise((Z)=>{G.addObserver((U)=>{Z(IYA(U))})})}}}},DYA={typeConstructor:dZA,schemaId:pZA,message:Ze,missingMessage:yx,identifier:iS,title:S1,description:jF,examples:Ke,default:Ue,documentation:oZA,jsonSchema:$e,arbitrary:Ye,pretty:We,equivalence:gx,concurrency:ze,batching:qe,parseIssueTitle:Oe,parseOptions:Ve,decodingFallback:we},xF=(A)=>{if(!A)return{};let Q={...A};for(let B in DYA)if(B in A){let I=DYA[B];Q[I]=A[B],delete Q[B]}return Q},k1=(A,Q)=>IT(A,xF(Q));function kD(A){return A}var aD=(A)=>String(A.ast),Lh=(A)=>CI(DT(A.ast)),wQA=(A)=>CI(jKA(A.ast)),dB=(A)=>CI(xD(A.ast)),Mh=(A,Q)=>{let B=d0(A,Q);return(I,D)=>H5(B(I,D),ZG)},LYA=(A,Q)=>{let B=Qh(A,Q);return(I,D)=>Q4(B(I,D),ZG)},MYA=(A,Q)=>{let B=Mh(A,Q);return(I,D)=>TF(B(I,D))},Ph=Mh,DiA=LYA,EiA=MYA,gU=(A,Q)=>{let B=l0(A,Q);return(I,D)=>H5(B(I,D),ZG)},PYA=(A,Q)=>{let B=FT(A,Q);return(I,D)=>Q4(B(I,D),ZG)},SYA=(A,Q)=>{let B=gU(A,Q);return(I,D)=>TF(B(I,D))},CiA=gU,JiA=PYA,GiA=SYA,TYA=(A,Q)=>{let B=Bh(A,Q);return(I,D)=>H5(B(I,D),ZG)},FiA=(A,Q)=>{let B=te(A,Q);return(I,D)=>Q4(B(I,D),ZG)},HiA=(A,Q)=>{let B=TYA(A,Q);return(I,D)=>TF(B(I,D))},dC=(A)=>VQ(A,z5)&&$C(A[z5]);function XiA(A){return cx(A)?qE.make(wKA(A,(Q)=>new HG(Q))):new HG(A[0])}function _YA(A,Q=XiA(A)){return class extends CI(Q){static annotations(I){return _YA(this.literals,k1(this.ast,I))}static literals=[...A]}}function GE(...A){return LD(A)?_YA(A):_h}var ZiA=(...A)=>(Q)=>GE(...A),kYA=(A)=>CI(new Aq(A)),KiA=(A)=>new je(Object.keys(A).filter((Q)=>typeof A[A[Q]]!=="number").map((Q)=>[Q,A[Q]])),jYA=(A,Q=KiA(A))=>class extends CI(Q){static annotations(I){return jYA(this.enums,k1(this.ast,I))}static enums={...A}},UiA=(A)=>jYA(A),yYA=(...[A,...Q])=>{let B=[],I="",D=Q;if(dC(A))if(XG(A.ast))I=String(A.ast.literal);else D=[A,...D];else I=String(A);for(let C=0;C<D.length;C++){let G=D[C];if(dC(G)){if(C<D.length-1){let H=D[C+1];if(dC(H)){if(XG(H.ast)){B.push(new NU(G.ast,String(H.ast.literal))),C++;continue}}else{B.push(new NU(G.ast,String(H))),C++;continue}}B.push(new NU(G.ast,""))}else B.push(new NU(new HG(G),""))}if(d9(B))return CI(new fx(I,B));else return CI(new fx("",[new NU(new HG(I),"")]))};function gYA(A,Q){let B=A.ast;switch(B._tag){case"Literal":{let I=B.literal;if(!cE(I)){let D=String(I);return xB(GE(D),Q,{strict:!0,decode:()=>I,encode:()=>D})}break}case"NumberKeyword":return Yh(uQA,Q);case"Union":{let I=[],D=!1;for(let C of B.types){let G=CI(C),H=Lh(G),Z=gYA(H,G);if(Z)D=!0;I.push(Z??G)}return D?Yh(pC(...I),Q):Q}}}var $iA=(...A)=>{let Q=[],B=[],I=[],D=!1;for(let Z=0;Z<A.length;Z++){let U=A[Z],O=dC(U)?U:GE(U);I.push(O);let w=Lh(O);Q.push(w);let L=gYA(w,O);if(L)B.push(L),D=!0;else B.push(O)}let C=yYA(...Q),G=SKA(C.ast),H=WJ(...B);if(D)H=H.annotations({[I5]:aD(WJ(...I))});return class extends oE(C,H,{strict:!1,decode:(U,O,w)=>{let L=G.exec(U);return L?ZD(L.slice(1,A.length+1)):_E(new eB(w,U,`${G.source}: no match for ${JSON.stringify(U)}`))},encode:(U)=>ZD(U.join(""))}){static params=A.slice()}},YiA=(A,Q,B)=>NQA(A,new ez(A.map((I)=>I.ast),(...I)=>Q.decode(...I.map(CI)),(...I)=>Q.encode(...I.map(CI)),xF(B))),WiA=(A,Q)=>{let B=()=>(D,C,G)=>A(D)?ZD(D):_E(new eB(G,D));return NQA([],new ez([],B,B,xF(Q)))};function NQA(A,Q){return class extends CI(Q){static annotations(I){return NQA(this.typeParameters,k1(this.ast,I))}static typeParameters=[...A]}}var kE=function(){if(Array.isArray(arguments[0])){let B=arguments[0],I=arguments[1],D=arguments[2];return YiA(B,I,D)}let A=arguments[0],Q=arguments[1];return WiA(A,Q)},hAA=Symbol.for("effect/SchemaId/Brand"),ziA=(A,Q)=>(B)=>{return PQA(B,new J5(B.ast,function(C,G,H){let Z=A.either(C);return dI(Z)?oA(new eB(H,C,Z.left.map((U)=>U.message).join(", "))):pA()},xF({schemaId:hAA,[hAA]:{constructor:A},...Q})))},mAA=Symbol.for("effect/SchemaId/InstanceOf"),vYA=(A,Q)=>kE((B)=>B instanceof A,{title:A.name,description:`an instance of ${A.name}`,pretty:()=>String,schemaId:mAA,[mAA]:{constructor:A},...Q});class Sh extends CI(wU){}class bYA extends CI(DKA){}class Th extends CI(QKA){}class _h extends CI(aS){}class $q extends CI(Se){}class xYA extends CI(Te){}class V5 extends CI(ZKA){}class kh extends CI(UKA){}class iI extends CI(bx){}class X2 extends CI(xx){}class Yq extends CI(hx){}class hYA extends CI(YKA){}var qiA=(A)=>qE.make(A.map((Q)=>Q.ast));function mYA(A,Q=qiA(A)){return class extends CI(Q){static annotations(I){return mYA(this.members,k1(this.ast,I))}static members=[...A]}}function pC(...A){return cx(A)?mYA(A):LD(A)?A[0]:_h}var zT=(A)=>pC(A,Th),jU=(A)=>pC(A,Sh),qT=(A)=>pC(A,Th,Sh),OiA=(A)=>CI(MKA(A.ast)),fAA=(A)=>new jh(new T1(A.ast,!1),A),ViA=(A)=>new jh(new T1(A.ast,!0),A);class jh{ast;from;[z5];_Token;constructor(A,Q){this.ast=A,this.from=Q}annotations(A){return new jh(new T1(this.ast.type,this.ast.isOptional,{...this.ast.annotations,...xF(A)}),this.from)}toString(){return`${this.ast.type}${this.ast.isOptional?"?":""}`}}var wiA=(A,Q)=>new E5(A.map((B)=>dC(B)?new T1(B.ast,!1):B.ast),Q.map((B)=>dC(B)?new RU(B.ast):B.ast),!0);function OT(A,Q,B=wiA(A,Q)){return class extends CI(B){static annotations(D){return OT(this.elements,this.rest,k1(this.ast,D))}static elements=[...A];static rest=[...Q]}}function WJ(...A){return Array.isArray(A[0])?OT(A[0],A.slice(1)):OT(A,[])}function fYA(A,Q){return class extends OT([],[A],Q){static annotations(I){return fYA(this.value,k1(this.ast,I))}static value=A}}var eD=(A)=>fYA(A);function uYA(A,Q){return class extends OT([A],[A],Q){static annotations(I){return uYA(this.value,k1(this.ast,I))}static value=A}}var Wq=(A)=>uYA(A);function NiA(A){return xB(pC(A,eD(A)),eD(dB(kD(A))),{strict:!0,decode:(Q)=>$g(Q),encode:(Q)=>Q.length===1?Q[0]:Q})}function RiA(A){return xB(pC(A,Wq(A)),Wq(dB(kD(A))),{strict:!0,decode:(Q)=>LD(Q)?Q:zC(Q),encode:(Q)=>Q.length===1?Q[0]:Q})}var uAA=(A)=>A?'"?:"':'":"';class q5 extends T1{isReadonly;defaultValue;_tag="PropertySignatureDeclaration";constructor(A,Q,B,I,D){super(A,Q,I);this.isReadonly=B,this.defaultValue=D}toString(){let A=uAA(this.isOptional),Q=String(this.type);return`PropertySignature<${A}, ${Q}, never, ${A}, ${Q}>`}}class O5 extends T1{isReadonly;fromKey;constructor(A,Q,B,I,D){super(A,Q,I);this.isReadonly=B,this.fromKey=D}}class UG extends T1{isReadonly;defaultValue;constructor(A,Q,B,I,D){super(A,Q,I);this.isReadonly=B,this.defaultValue=D}}var LiA=(A)=>{if(A===void 0)return"never";if(cE(A))return JSON.stringify(A);return String(A)};class p3{from;to;decode;encode;_tag="PropertySignatureTransformation";constructor(A,Q,B,I){this.from=A,this.to=Q,this.decode=B,this.encode=I}toString(){return`PropertySignature<${uAA(this.to.isOptional)}, ${this.to.type}, ${LiA(this.from.fromKey)}, ${uAA(this.from.isOptional)}, ${this.from.type}>`}}var cYA=(A,Q)=>{switch(A._tag){case"PropertySignatureDeclaration":return new q5(A.type,A.isOptional,A.isReadonly,{...A.annotations,...Q},A.defaultValue);case"PropertySignatureTransformation":return new p3(A.from,new UG(A.to.type,A.to.isOptional,A.to.isReadonly,{...A.to.annotations,...Q},A.to.defaultValue),A.decode,A.encode)}},RQA=Symbol.for("effect/PropertySignature"),yh=(A)=>VQ(A,RQA);class gh{ast;[z5];[RQA]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(A){this.ast=A}pipe(){return RQ(this,arguments)}annotations(A){return new gh(cYA(this.ast,xF(A)))}toString(){return String(this.ast)}}var $G=(A)=>new gh(A);class NT extends gh{from;constructor(A,Q){super(A);this.from=Q}annotations(A){return new NT(cYA(this.ast,xF(A)),this.from)}}var Kq=(A)=>new NT(new q5(A.ast,!1,!0,{},void 0),A),Y5=y(2,(A,Q)=>{let B=A.ast;switch(B._tag){case"PropertySignatureDeclaration":return $G(new q5(B.type,B.isOptional,B.isReadonly,B.annotations,Q));case"PropertySignatureTransformation":return $G(new p3(B.from,new UG(B.to.type,B.to.isOptional,B.to.isReadonly,B.to.annotations,Q),B.decode,B.encode))}}),EYA=(A,Q)=>gI(A,{onNone:()=>oA(Q()),onSome:(B)=>oA(B===void 0?Q():B)}),Uh=(A)=>gKA(A,Uh,(Q)=>{let B=Uh(Q.to);if(B)return new k2(Q.from,B,Q.transformation)}),lYA=y(2,(A,Q)=>{let B=A.ast;switch(B._tag){case"PropertySignatureDeclaration":{let I=xD(B.type);return $G(new p3(new O5(B.type,B.isOptional,B.isReadonly,B.annotations),new UG(Uh(I)??I,!1,!0,{},B.defaultValue),(D)=>EYA(D,Q),rQ))}case"PropertySignatureTransformation":{let I=B.to.type;return $G(new p3(B.from,new UG(Uh(I)??I,!1,B.to.isReadonly,B.to.annotations,B.to.defaultValue),(D)=>EYA(B.decode(D),Q),B.encode))}}}),MiA=y(2,(A,Q)=>A.pipe(lYA(Q.decoding),Y5(Q.constructor))),PiA=y(2,(A,Q)=>{let B=A.ast;switch(B._tag){case"PropertySignatureDeclaration":return $G(new p3(new O5(B.type,B.isOptional,B.isReadonly,B.annotations,Q),new UG(xD(B.type),B.isOptional,B.isReadonly,{},B.defaultValue),rQ,rQ));case"PropertySignatureTransformation":return $G(new p3(new O5(B.from.type,B.from.isOptional,B.from.isReadonly,B.from.annotations,Q),B.to,B.decode,B.encode))}}),vF=(A,Q,B)=>$G(new p3(new O5(A.ast,!0,!0,{},void 0),new UG(Q.ast,!1,!0,{},void 0),(I)=>oA(B.decode(I)),R8(B.encode))),SiA=(A,Q,B)=>$G(new p3(new O5(A.ast,!1,!0,{},void 0),new UG(Q.ast,!0,!0,{},void 0),R8(B.decode),(I)=>oA(B.encode(I)))),cAA=(A,Q,B)=>$G(new p3(new O5(A.ast,!0,!0,{},void 0),new UG(Q.ast,!0,!0,{},void 0),B.decode,B.encode)),TiA=(A,Q)=>{let B=Q?.exact,I=Q?.default,D=Q?.nullable,C=Q?.as=="Option",G=Q?.onNoneEncoding?a4(Q.onNoneEncoding):rQ;if(B)if(I)if(D)return Y5(vF(zT(A),dB(A),{decode:gI({onNone:I,onSome:(H)=>H===null?I():H}),encode:oA}),I).ast;else return Y5(vF(A,dB(A),{decode:gI({onNone:I,onSome:rQ}),encode:oA}),I).ast;else if(C){let H=HQA(dB(A));if(D)return vF(zT(A),H,{decode:ZK(ay),encode:G}).ast;else return vF(A,H,{decode:rQ,encode:rQ}).ast}else if(D)return cAA(zT(A),dB(A),{decode:ZK(ay),encode:rQ}).ast;else return new q5(A.ast,!0,!0,{},void 0);else if(I)if(D)return Y5(vF(qT(A),dB(A),{decode:gI({onNone:I,onSome:(H)=>H==null?I():H}),encode:oA}),I).ast;else return Y5(vF(jU(A),dB(A),{decode:gI({onNone:I,onSome:(H)=>H===void 0?I():H}),encode:oA}),I).ast;else if(C){let H=HQA(dB(A));if(D)return vF(qT(A),H,{decode:ZK((Z)=>Z!=null),encode:G}).ast;else return vF(jU(A),H,{decode:ZK(R2A),encode:G}).ast}else if(D)return cAA(qT(A),jU(dB(A)),{decode:ZK(ay),encode:rQ}).ast;else return new q5(jU(A).ast,!0,!0,{},void 0)},_iA=(A)=>{let Q=A.ast===wU||A.ast===aS?wU:jU(A).ast;return new NT(new q5(Q,!0,!0,{},void 0),A)},kiA=y((A)=>dC(A[0]),(A,Q)=>{return new NT(TiA(A,Q),A)}),jiA=xe([yx]),yiA=(A,Q)=>{let B=Reflect.ownKeys(A),I=[];if(B.length>0){let C=[],G=[],H=[];for(let Z=0;Z<B.length;Z++){let U=B[Z],O=A[U];if(yh(O)){let w=O.ast;switch(w._tag){case"PropertySignatureDeclaration":{let{type:L,isOptional:P,annotations:k}=w;C.push(new JE(U,L,P,!0,jiA(w))),G.push(new JE(U,xD(L),P,!0,k)),I.push(new JE(U,L,P,!0,k));break}case"PropertySignatureTransformation":{let L=w.from.fromKey??U;C.push(new JE(L,w.from.type,w.from.isOptional,!0,w.from.annotations)),G.push(new JE(U,w.to.type,w.to.isOptional,!0,w.to.annotations)),H.push(new QT(L,U,w.decode,w.encode));break}}}else C.push(new JE(U,O.ast,!1,!0)),G.push(new JE(U,xD(O.ast),!1,!0)),I.push(new JE(U,O.ast,!1,!0))}if(LD(H)){let Z=[],U=[];for(let O of Q){let{indexSignatures:w,propertySignatures:L}=be(O.key.ast,O.value.ast);L.forEach((P)=>{C.push(P),G.push(new JE(P.name,xD(P.type),P.isOptional,P.isReadonly,P.annotations))}),w.forEach((P)=>{Z.push(P),U.push(new C5(P.parameter,xD(P.type),P.isReadonly))})}return new k2(new H2(C,Z,{[I5]:"Struct (Encoded side)"}),new H2(G,U,{[I5]:"Struct (Type side)"}),new F5(H))}}let D=[];for(let C of Q){let{indexSignatures:G,propertySignatures:H}=be(C.key.ast,C.value.ast);H.forEach((Z)=>I.push(Z)),G.forEach((Z)=>D.push(Z))}return new H2(I,D)},dYA=(A,Q)=>{let B=Reflect.ownKeys(A);for(let I of B){let D=A[I];if(Q[I]===void 0&&yh(D)){let C=D.ast,G=C._tag==="PropertySignatureDeclaration"?C.defaultValue:C.to.defaultValue;if(G!==void 0)Q[I]=G()}}return Q};function LQA(A,Q,B=yiA(A,Q)){return class extends CI(B){static annotations(D){return LQA(this.fields,this.records,k1(this.ast,D))}static fields={...A};static records=[...Q];static make=(D,C)=>{let G=dYA(A,{...D});return dh(C)?G:Z5(this)(G)};static pick(...D){return FE(QYA(A,...D))}static omit(...D){return FE(BYA(A,...D))}}}function FE(A,...Q){return LQA(A,Q)}var pYA=(A)=>GE(A).pipe(Kq,Y5(()=>A)),RT=(A,Q)=>FE({_tag:pYA(A),...Q});function oYA(A,Q,B){return class extends LQA({},[{key:A,value:Q}],B){static annotations(D){return oYA(A,Q,k1(this.ast,D))}static key=A;static value=Q}}var MQA=(A)=>oYA(A.key,A.value),nYA=(...A)=>(Q)=>CI(h3(Q.ast,A)),giA=(...A)=>(Q)=>CI(_KA(Q.ast,A)),viA=y(2,(A,Q)=>{let B=B5(xD(A.ast),Q),I=CI(B.isOptional?oS(B.type):B.type);return xB(A.pipe(nYA(Q)),I,{strict:!0,decode:(C)=>C[Q],encode:(C)=>B.isOptional&&C===void 0?{}:{[Q]:C}})});function PQA(A,Q){return class extends CI(Q){static annotations(I){return PQA(this.from,k1(this.ast,I))}static make=(I,D)=>{return dh(D)?I:Z5(this)(I)};static from=A}}var biA=(A,Q)=>(B)=>{let I=gI(Ne(B.ast),{onNone:()=>[A],onSome:(C)=>[...C,A]}),D=IT(B.ast,xF({[Xe]:I,...Q}));return PQA(B,D)},xiA=(A)=>CI(VU(A.ast)),hiA=y((A)=>dC(A[0]),(A,Q)=>CI(VU(A.ast,Q))),miA=(A)=>CI(az(A.ast)),fiA=(A)=>CI(OU(A.ast)),YT=(A,Q,B)=>{if(ye(A)&&ye(Q)){let I=[...A.propertySignatures];for(let D of Q.propertySignatures){let C=D.name,G=I.findIndex((H)=>H.name===C);if(G===-1)I.push(D);else{let{isOptional:H,type:Z}=I[G];I[G]=new JE(C,$h(Z,D.type,B.concat(C)),H,!0)}}return new H2(I,A.indexSignatures.concat(Q.indexSignatures))}throw Error(Ce(A,Q,B))},uiA=kKA([iS]),WT=(A,Q)=>Q.map((B)=>new J5(B,A.filter,uiA(A))),$h=(A,Q,B)=>qE.make(bF([A],[Q],B)),kU=(A)=>AT(A)?A.types:[A],bF=(A,Q,B)=>UK(A,(I)=>UK(Q,(D)=>{switch(D._tag){case"Literal":{if(cE(D.literal)&&eS(I)||z8(D.literal)&&_e(I)||q3(D.literal)&&ke(I))return[D];break}case"StringKeyword":{if(D===bx){if(eS(I)||XG(I)&&cE(I.literal))return[I];else if(G5(I))return WT(I,bF(kU(I.from),[D],B))}else if(I===bx)return[D];break}case"NumberKeyword":{if(D===xx){if(_e(I)||XG(I)&&z8(I.literal))return[I];else if(G5(I))return WT(I,bF(kU(I.from),[D],B))}else if(I===xx)return[D];break}case"BooleanKeyword":{if(D===hx){if(ke(I)||XG(I)&&q3(I.literal))return[I];else if(G5(I))return WT(I,bF(kU(I.from),[D],B))}else if(I===hx)return[D];break}case"Union":return bF(kU(I),D.types,B);case"Suspend":return[new m3(()=>$h(I,D.f(),B))];case"Refinement":return WT(D,bF(kU(I),kU(D.from),B));case"TypeLiteral":{switch(I._tag){case"Union":return bF(I.types,[D],B);case"Suspend":return[new m3(()=>$h(I.f(),D,B))];case"Refinement":return WT(I,bF(kU(I.from),[D],B));case"TypeLiteral":return[YT(I,D,B)];case"Transformation":{let C=I.transformation,G=YT(I.from,D,B),H=YT(I.to,xD(D),B);switch(C._tag){case"TypeLiteralTransformation":return[new k2(G,H,new F5(C.propertySignatureTransformations))];case"ComposeTransformation":return[new k2(G,H,px)];case"FinalTransformation":return[new k2(G,H,new dx((Z,U,O,w)=>lC(C.decode(Z,U,O,w),(L)=>({...Z,...L})),(Z,U,O,w)=>lC(C.encode(Z,U,O,w),(L)=>({...Z,...L}))))]}}}break}case"Transformation":{if(NKA(I)){if(BT(D.transformation)&&BT(I.transformation))return[new k2(YT(I.from,D.from,B),YT(I.to,D.to,B),new F5(D.transformation.propertySignatureTransformations.concat(I.transformation.propertySignatureTransformations)))]}else return bF([D],[I],B);break}}throw Error(Ce(I,D,B))})),LT=y(2,(A,Q)=>CI($h(A.ast,Q.ast,[]))),Yh=y((A)=>dC(A[1]),(A,Q)=>TQA(A,Q,me(A.ast,Q.ast))),Wh=(A)=>CI(new m3(()=>A().ast)),SQA=Symbol.for("effect/SchemaId/Refine");function iYA(A,Q,B){return class extends CI(B){static annotations(D){return iYA(this.from,this.filter,k1(this.ast,D))}static[SQA]=A;static from=A;static filter=Q;static make=(D,C)=>{return dh(C)?D:Z5(this)(D)}}}var CYA=(A,Q,B)=>{if(q3(A))return A?pA():oA(new eB(Q,B));if(cE(A))return oA(new eB(Q,B,A));if(A!==void 0){if("_tag"in A)return oA(A);let I=new eB(Q,B,A.message);return oA(LD(A.path)?new wC(A.path,B,I):I)}return pA()},rYA=(A,Q,B)=>{if(gZA(A))return CYA(A,Q,B);if(LD(A)){let I=zH(A,(D)=>CYA(D,Q,B));if(LD(I))return oA(I.length===1?I[0]:new pE(Q,B,I))}return pA()};function pB(A,Q){return(B)=>{function I(C,G,H){return rYA(A(C,G,H),H,C)}let D=new J5(B.ast,I,xF(Q));return iYA(B,I,D)}}var ciA=y(2,(A,Q)=>oE(A,dB(A),{strict:!0,decode:(B,I,D)=>_1(Q(B,I,D),(C)=>gI(rYA(C,D,B),{onNone:()=>ZD(B),onSome:_E})),encode:(B)=>ZD(B)}));function TQA(A,Q,B){return class extends CI(B){static annotations(D){return TQA(this.from,this.to,k1(this.ast,D))}static from=A;static to=Q}}var oE=y((A)=>dC(A[0])&&dC(A[1]),(A,Q,B)=>TQA(A,Q,new k2(A.ast,Q.ast,new dx(B.decode,B.encode)))),xB=y((A)=>dC(A[0])&&dC(A[1]),(A,Q,B)=>oE(A,Q,{strict:!0,decode:(I,D,C,G)=>ZD(B.decode(I,G)),encode:(I,D,C,G)=>ZD(B.encode(I,G))}));function sYA(A,Q){return xB(GE(A),GE(Q),{strict:!0,decode:()=>Q,encode:()=>A})}function liA(...A){return pC(...A.map(([Q,B])=>sYA(Q,B)))}var diA=y((A)=>dC(A[0]),(A,Q,B,I)=>{let D=LT(dB(A),FE({[Q]:c9(B)?kYA(B):GE(B)})).ast;return CI(new k2(A.ast,I?k1(D,I):D,new F5([new QT(Q,Q,()=>oA(B),()=>pA())])))}),piA=y(2,(A,Q)=>A.annotations(Q)),oiA=y(2,(A,Q)=>CI(nS(A.ast,Q))),tYA=Symbol.for("effect/SchemaId/Trimmed"),aYA=(A)=>(Q)=>Q.pipe(pB((B)=>B===B.trim(),{schemaId:tYA,title:"trimmed",description:"a string with no leading or trailing whitespace",jsonSchema:{pattern:"^\\S[\\s\\S]*\\S$|^\\S$|^$"},...A})),eYA=i$A,niA=(A,Q)=>(B)=>B.pipe(pB((I)=>I.length<=A,{schemaId:eYA,title:`maxLength(${A})`,description:`a string at most ${A} character(s) long`,jsonSchema:{maxLength:A},...Q})),AWA=n$A,QWA=(A,Q)=>(B)=>B.pipe(pB((I)=>I.length>=A,{schemaId:AWA,title:`minLength(${A})`,description:`a string at least ${A} character(s) long`,jsonSchema:{minLength:A},...Q})),lAA=r$A,BWA=(A,Q)=>(B)=>{let I=$C(A)?Math.max(0,Math.floor(A.min)):Math.max(0,Math.floor(A)),D=$C(A)?Math.max(I,Math.floor(A.max)):I;if(I!==D)return B.pipe(pB((C)=>C.length>=I&&C.length<=D,{schemaId:lAA,title:`length({ min: ${I}, max: ${D})`,description:`a string at least ${I} character(s) and at most ${D} character(s) long`,jsonSchema:{minLength:I,maxLength:D},...Q}));return B.pipe(pB((C)=>C.length===I,{schemaId:lAA,title:`length(${I})`,description:I===1?"a single character":`a string ${I} character(s) long`,jsonSchema:{minLength:I,maxLength:I},...Q}))},dAA=Symbol.for("effect/SchemaId/Pattern"),_QA=(A,Q)=>(B)=>{let I=A.source;return B.pipe(pB((D)=>{return A.lastIndex=0,A.test(D)},{schemaId:dAA,[dAA]:{regex:A},description:`a string matching the pattern ${I}`,jsonSchema:{pattern:I},...Q}))},pAA=Symbol.for("effect/SchemaId/StartsWith"),iiA=(A,Q)=>(B)=>{let I=JSON.stringify(A);return B.pipe(pB((D)=>D.startsWith(A),{schemaId:pAA,[pAA]:{startsWith:A},title:`startsWith(${I})`,description:`a string starting with ${I}`,jsonSchema:{pattern:`^${A}`},...Q}))},oAA=Symbol.for("effect/SchemaId/EndsWith"),riA=(A,Q)=>(B)=>{let I=JSON.stringify(A);return B.pipe(pB((D)=>D.endsWith(A),{schemaId:oAA,[oAA]:{endsWith:A},title:`endsWith(${I})`,description:`a string ending with ${I}`,jsonSchema:{pattern:`^.*${A}$`},...Q}))},nAA=Symbol.for("effect/SchemaId/Includes"),siA=(A,Q)=>(B)=>{let I=JSON.stringify(A);return B.pipe(pB((D)=>D.includes(A),{schemaId:nAA,[nAA]:{includes:A},title:`includes(${I})`,description:`a string including ${I}`,jsonSchema:{pattern:`.*${A}.*`},...Q}))},IWA=Symbol.for("effect/SchemaId/Lowercased"),DWA=(A)=>(Q)=>Q.pipe(pB((B)=>B===B.toLowerCase(),{schemaId:IWA,title:"lowercased",description:"a lowercase string",jsonSchema:{pattern:"^[^A-Z]*$"},...A}));class kQA extends iI.pipe(DWA({identifier:"Lowercased"})){}var EWA=Symbol.for("effect/SchemaId/Uppercased"),CWA=(A)=>(Q)=>Q.pipe(pB((B)=>B===B.toUpperCase(),{schemaId:EWA,title:"uppercased",description:"an uppercase string",jsonSchema:{pattern:"^[^a-z]*$"},...A}));class jQA extends iI.pipe(CWA({identifier:"Uppercased"})){}var JWA=Symbol.for("effect/SchemaId/Capitalized"),GWA=(A)=>(Q)=>Q.pipe(pB((B)=>B[0]?.toUpperCase()===B[0],{schemaId:JWA,title:"capitalized",description:"a capitalized string",jsonSchema:{pattern:"^[^a-z]?.*$"},...A}));class yQA extends iI.pipe(GWA({identifier:"Capitalized"})){}var FWA=Symbol.for("effect/SchemaId/Uncapitalized"),HWA=(A)=>(Q)=>Q.pipe(pB((B)=>B[0]?.toLowerCase()===B[0],{schemaId:FWA,title:"uncapitalized",description:"a uncapitalized string",jsonSchema:{pattern:"^[^A-Z]?.*$"},...A}));class gQA extends iI.pipe(HWA({identifier:"Uncapitalized"})){}class XWA extends iI.pipe(BWA(1,{identifier:"Char"})){}var vQA=(A)=>QWA(1,{title:"nonEmptyString",description:"a non empty string",...A});class ZWA extends xB(iI.annotations({description:"a string that will be converted to lowercase"}),kQA,{strict:!0,decode:(A)=>A.toLowerCase(),encode:rQ}).annotations({identifier:"Lowercase"}){}class KWA extends xB(iI.annotations({description:"a string that will be converted to uppercase"}),jQA,{strict:!0,decode:(A)=>A.toUpperCase(),encode:rQ}).annotations({identifier:"Uppercase"}){}class UWA extends xB(iI.annotations({description:"a string that will be converted to a capitalized format"}),yQA,{strict:!0,decode:(A)=>T5A(A),encode:rQ}).annotations({identifier:"Capitalize"}){}class $WA extends xB(iI.annotations({description:"a string that will be converted to an uncapitalized format"}),gQA,{strict:!0,decode:(A)=>_5A(A),encode:rQ}).annotations({identifier:"Uncapitalize"}){}class vh extends iI.pipe(aYA({identifier:"Trimmed"})){}class bQA extends vh.pipe(vQA({identifier:"NonEmptyTrimmedString"})){}class YWA extends xB(iI.annotations({description:"a string that will be trimmed"}),vh,{strict:!0,decode:(A)=>A.trim(),encode:rQ}).annotations({identifier:"Trim"}){}var tiA=(A)=>xB(iI.annotations({description:"a string that will be split"}),eD(iI),{strict:!0,decode:(Q)=>Q.split(A),encode:(Q)=>Q.join(A)}),iAA=(A)=>A instanceof Error?A.message:String(A),aiA=(A)=>oE(iI.annotations({description:"a string to be decoded into JSON"}),$q,{strict:!0,decode:(Q,B,I)=>SU({try:()=>JSON.parse(Q,A?.reviver),catch:(D)=>new eB(I,Q,iAA(D))}),encode:(Q,B,I)=>SU({try:()=>JSON.stringify(Q,A?.replacer,A?.space),catch:(D)=>new eB(I,Q,iAA(D))})}).annotations({title:"parseJson",schemaId:AKA}),WWA=(A,Q)=>dC(A)?Yh(WWA(Q),A):aiA(A);class zWA extends iI.pipe(vQA({identifier:"NonEmptyString"})){}var qWA=Symbol.for("effect/SchemaId/UUID"),JYA=/^[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}$/i;class OWA extends iI.pipe(_QA(JYA,{schemaId:qWA,identifier:"UUID",jsonSchema:{format:"uuid",pattern:JYA.source},description:"a Universally Unique Identifier",arbitrary:()=>(A)=>A.uuid()})){}var VWA=Symbol.for("effect/SchemaId/ULID"),eiA=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i;class wWA extends iI.pipe(_QA(eiA,{schemaId:VWA,identifier:"ULID",description:"a Universally Unique Lexicographically Sortable Identifier",arbitrary:()=>(A)=>A.ulid()})){}class xQA extends vYA(URL,{typeConstructor:{_tag:"URL"},identifier:"URLFromSelf",arbitrary:()=>(A)=>A.webUrl().map((Q)=>new URL(Q)),pretty:()=>(A)=>A.toString()}){}class NWA extends oE(iI.annotations({description:"a string to be decoded into a URL"}),xQA,{strict:!0,decode:(A,Q,B)=>SU({try:()=>new URL(A),catch:(I)=>new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a URL. ${iAA(I)}`)}),encode:(A)=>ZD(A.toString())}).annotations({identifier:"URL",pretty:()=>(A)=>A.toString()}){}var RWA=m$A,hQA=(A)=>(Q)=>Q.pipe(pB(Number.isFinite,{schemaId:RWA,title:"finite",description:"a finite number",jsonSchema:{},...A})),LWA=y$A,MWA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>A,{schemaId:LWA,title:`greaterThan(${A})`,description:A===0?"a positive number":`a number greater than ${A}`,jsonSchema:{exclusiveMinimum:A},...Q})),PWA=g$A,SWA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>=A,{schemaId:PWA,title:`greaterThanOrEqualTo(${A})`,description:A===0?"a non-negative number":`a number greater than or equal to ${A}`,jsonSchema:{minimum:A},...Q})),TWA=Symbol.for("effect/SchemaId/MultipleOf"),ArA=(A,Q)=>(B)=>{let I=Math.abs(A);return B.pipe(pB((D)=>GJA(D,A)===0,{schemaId:TWA,title:`multipleOf(${I})`,description:`a number divisible by ${I}`,jsonSchema:{multipleOf:I},...Q}))},_WA=x$A,mQA=(A)=>(Q)=>Q.pipe(pB((B)=>Number.isSafeInteger(B),{schemaId:_WA,title:"int",description:"an integer",jsonSchema:{type:"integer"},...A})),kWA=v$A,jWA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<A,{schemaId:kWA,title:`lessThan(${A})`,description:A===0?"a negative number":`a number less than ${A}`,jsonSchema:{exclusiveMaximum:A},...Q})),yWA=b$A,gWA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<=A,{schemaId:yWA,title:`lessThanOrEqualTo(${A})`,description:A===0?"a non-positive number":`a number less than or equal to ${A}`,jsonSchema:{maximum:A},...Q})),vWA=u$A,fQA=(A,Q,B)=>(I)=>I.pipe(pB((D)=>D>=A&&D<=Q,{schemaId:vWA,title:`between(${A}, ${Q})`,description:`a number between ${A} and ${Q}`,jsonSchema:{minimum:A,maximum:Q},...B})),bWA=h$A,xWA=(A)=>(Q)=>Q.pipe(pB((B)=>!Number.isNaN(B),{schemaId:bWA,title:"nonNaN",description:"a number excluding NaN",...A})),hWA=(A)=>MWA(0,{title:"positive",...A}),mWA=(A)=>jWA(0,{title:"negative",...A}),fWA=(A)=>gWA(0,{title:"nonPositive",...A}),uWA=(A)=>SWA(0,{title:"nonNegative",...A}),QrA=(A,Q)=>(B)=>{return xB(B,dB(B).pipe(fQA(A,Q)),{strict:!1,decode:(I)=>JJA(I,{minimum:A,maximum:Q}),encode:rQ})};function cWA(A){return oE(A,X2,{strict:!1,decode:(Q,B,I)=>Eq(FJA(Q),()=>new eB(I,Q,`Unable to decode ${JSON.stringify(Q)} into a number`)),encode:(Q)=>ZD(String(Q))})}class uQA extends cWA(iI.annotations({description:"a string to be decoded into a number"})).annotations({identifier:"NumberFromString"}){}class lWA extends X2.pipe(hQA({identifier:"Finite"})){}class zh extends X2.pipe(mQA({identifier:"Int"})){}class dWA extends X2.pipe(xWA({identifier:"NonNaN"})){}class pWA extends X2.pipe(hWA({identifier:"Positive"})){}class oWA extends X2.pipe(mWA({identifier:"Negative"})){}class nWA extends X2.pipe(fWA({identifier:"NonPositive"})){}class bh extends X2.pipe(uWA({identifier:"NonNegative"})){}var iWA=f$A;class rWA extends X2.pipe(hQA({schemaId:iWA,identifier:"JsonNumber"})){}class sWA extends xB(Yq.annotations({description:"a boolean that will be negated"}),Yq,{strict:!0,decode:(A)=>sP(A),encode:(A)=>sP(A)}){}var tWA=(A,Q)=>{let B=Symbol.keyFor(A);return B===void 0?_E(new eB(Q,A,`Unable to encode a unique symbol ${String(A)} into a string`)):ZD(B)},aWA=(A)=>ZD(Symbol.for(A));class eWA extends oE(iI.annotations({description:"a string to be decoded into a globally shared symbol"}),kh,{strict:!1,decode:(A)=>aWA(A),encode:(A,Q,B)=>tWA(A,B)}).annotations({identifier:"Symbol"}){}var rAA=c$A,AzA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>A,{schemaId:rAA,[rAA]:{min:A},title:`greaterThanBigInt(${A})`,description:A===0n?"a positive bigint":`a bigint greater than ${A}n`,...Q})),sAA=l$A,QzA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>=A,{schemaId:sAA,[sAA]:{min:A},title:`greaterThanOrEqualToBigInt(${A})`,description:A===0n?"a non-negative bigint":`a bigint greater than or equal to ${A}n`,...Q})),tAA=d$A,BzA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<A,{schemaId:tAA,[tAA]:{max:A},title:`lessThanBigInt(${A})`,description:A===0n?"a negative bigint":`a bigint less than ${A}n`,...Q})),aAA=p$A,IzA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<=A,{schemaId:aAA,[aAA]:{max:A},title:`lessThanOrEqualToBigInt(${A})`,description:A===0n?"a non-positive bigint":`a bigint less than or equal to ${A}n`,...Q})),eAA=o$A,cQA=(A,Q,B)=>(I)=>I.pipe(pB((D)=>D>=A&&D<=Q,{schemaId:eAA,[eAA]:{min:A,max:Q},title:`betweenBigInt(${A}, ${Q})`,description:`a bigint between ${A}n and ${Q}n`,...B})),lQA=(A)=>AzA(0n,{title:"positiveBigInt",...A}),dQA=(A)=>BzA(0n,{title:"negativeBigInt",...A}),pQA=(A)=>QzA(0n,{title:"nonNegativeBigInt",...A}),oQA=(A)=>IzA(0n,{title:"nonPositiveBigInt",...A}),BrA=(A,Q)=>(B)=>xB(B,B.pipe(dB,cQA(A,Q)),{strict:!1,decode:(I)=>FUA(I,{minimum:A,maximum:Q}),encode:rQ});class vU extends oE(iI.annotations({description:"a string to be decoded into a bigint"}),V5,{strict:!0,decode:(A,Q,B)=>Eq(XUA(A),()=>new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a bigint`)),encode:(A)=>ZD(String(A))}).annotations({identifier:"BigInt"}){}var IrA=V5.pipe(lQA({identifier:"PositiveBigintFromSelf"})),DrA=vU.pipe(lQA({identifier:"PositiveBigint"})),ErA=V5.pipe(dQA({identifier:"NegativeBigintFromSelf"})),CrA=vU.pipe(dQA({identifier:"NegativeBigint"})),JrA=V5.pipe(oQA({identifier:"NonPositiveBigintFromSelf"})),GrA=vU.pipe(oQA({identifier:"NonPositiveBigint"})),DzA=V5.pipe(pQA({identifier:"NonNegativeBigintFromSelf"})),FrA=vU.pipe(pQA({identifier:"NonNegativeBigint"}));class EzA extends oE(X2.annotations({description:"a number to be decoded into a bigint"}),V5.pipe(cQA(BigInt(Number.MIN_SAFE_INTEGER),BigInt(Number.MAX_SAFE_INTEGER))),{strict:!0,decode:(A,Q,B)=>Eq(ZUA(A),()=>new eB(B,A,`Unable to decode ${A} into a bigint`)),encode:(A,Q,B)=>Eq(HUA(A),()=>new eB(B,A,`Unable to encode ${A}n into a number`))}).annotations({identifier:"BigIntFromNumber"}){}var HrA=(A)=>(Q)=>A(Q).map(Kh),e2=(A,Q,B,I)=>de(A,{onFailure:(D)=>new pE(B,I,D),onSuccess:Q}),GYA=(A)=>(Q,B,I)=>e$A(Q)?e2(A($T(Q),B),Kh,I,Q):_E(new eB(I,Q)),CzA=(A)=>kE([A],{decode:(Q)=>GYA(l0(Q)),encode:(Q)=>GYA(d0(Q))},{typeConstructor:{_tag:"effect/Redacted"},description:"Redacted(<redacted>)",pretty:()=>()=>"Redacted(<redacted>)",arbitrary:HrA,equivalence:AYA});function XrA(A){return xB(A,CzA(dB(kD(A))),{strict:!0,decode:(Q)=>Kh(Q),encode:(Q)=>$T(Q)})}class MT extends kE(ug,{typeConstructor:{_tag:"effect/Duration"},identifier:"DurationFromSelf",pretty:()=>String,arbitrary:()=>(A)=>A.oneof(A.constant($P),A.bigInt({min:0n}).map((Q)=>s9(Q)),A.maxSafeNat().map((Q)=>J2(Q))),equivalence:()=>Xi}){}class JzA extends oE(DzA.annotations({description:"a bigint to be decoded into a Duration"}),MT.pipe(pB((A)=>w1A(A),{description:"a finite duration"})),{strict:!0,decode:(A)=>ZD(s9(A)),encode:(A,Q,B)=>gI(N1A(A),{onNone:()=>_E(new eB(B,A,`Unable to encode ${A} into a bigint`)),onSome:(I)=>ZD(I)})}).annotations({identifier:"DurationFromNanos"}){}var qh=bh.pipe(mQA()).annotations({identifier:"NonNegativeInt"});class GzA extends xB(bh.annotations({description:"a non-negative number to be decoded into a Duration"}),MT,{strict:!0,decode:(A)=>J2(A),encode:(A)=>hC(A)}).annotations({identifier:"DurationFromMillis"}){}var FzA=RT("Millis",{millis:qh}),HzA=RT("Nanos",{nanos:vU}),XzA=RT("Infinity",{}),ZrA=XzA.make({}),KrA=pC(FzA,HzA,XzA).annotations({identifier:"DurationValue",description:"an JSON-compatible tagged union to be decoded into a Duration"}),UrA=WJ(fAA(qh).annotations({title:"seconds"}),fAA(qh).annotations({title:"nanos"})).annotations({identifier:"FiniteHRTime"}),$rA=WJ(GE(-1),GE(0)).annotations({identifier:"InfiniteHRTime"}),YrA=pC(UrA,$rA).annotations({identifier:"HRTime",description:"a tuple of seconds and nanos to be decoded into a Duration"}),WrA=(A)=>typeof A==="object";class ZzA extends xB(pC(KrA,YrA),MT,{strict:!0,decode:(A)=>{if(WrA(A))switch(A._tag){case"Millis":return J2(A.millis);case"Nanos":return s9(A.nanos);case"Infinity":return $P}let[Q,B]=A;return Q===-1?$P:s9(BigInt(Q)*BigInt(1e9)+BigInt(B))},encode:(A)=>{switch(A.value._tag){case"Millis":return FzA.make({millis:A.value.millis});case"Nanos":return HzA.make({nanos:A.value.nanos});case"Infinity":return ZrA}}}).annotations({identifier:"Duration"}){}var zrA=(A,Q)=>(B)=>xB(B,B.pipe(dB,KzA(A,Q)),{strict:!1,decode:(I)=>P1A(I,{minimum:A,maximum:Q}),encode:rQ}),VT=Symbol.for("effect/SchemaId/LessThanDuration"),qrA=(A,Q)=>(B)=>B.pipe(pB((I)=>cg(I,A),{schemaId:VT,[VT]:{max:A},title:`lessThanDuration(${A})`,description:`a Duration less than ${SI(A)}`,...Q})),OrA=Symbol.for("effect/schema/LessThanOrEqualToDuration"),VrA=(A,Q)=>(B)=>B.pipe(pB((I)=>lg(I,A),{schemaId:VT,[VT]:{max:A},title:`lessThanOrEqualToDuration(${A})`,description:`a Duration less than or equal to ${SI(A)}`,...Q})),AQA=Symbol.for("effect/SchemaId/GreaterThanDuration"),wrA=(A,Q)=>(B)=>B.pipe(pB((I)=>S1A(I,A),{schemaId:AQA,[AQA]:{min:A},title:`greaterThanDuration(${A})`,description:`a Duration greater than ${SI(A)}`,...Q})),QQA=Symbol.for("effect/schema/GreaterThanOrEqualToDuration"),NrA=(A,Q)=>(B)=>B.pipe(pB((I)=>Gz(I,A),{schemaId:QQA,[QQA]:{min:A},title:`greaterThanOrEqualToDuration(${A})`,description:`a Duration greater than or equal to ${SI(A)}`,...Q})),BQA=Symbol.for("effect/SchemaId/BetweenDuration"),KzA=(A,Q,B)=>(I)=>I.pipe(pB((D)=>M1A(D,{minimum:A,maximum:Q}),{schemaId:BQA,[BQA]:{maximum:Q,minimum:A},title:`betweenDuration(${A}, ${Q})`,description:`a Duration between ${SI(A)} and ${SI(Q)}`,...B}));class xh extends kE(P2A,{typeConstructor:{_tag:"Uint8Array"},identifier:"Uint8ArrayFromSelf",pretty:()=>(A)=>`new Uint8Array(${JSON.stringify(Array.from(A))})`,arbitrary:()=>(A)=>A.uint8Array(),equivalence:()=>M2(NQ)}){}class nQA extends X2.pipe(fQA(0,255,{identifier:"Uint8",description:"a 8-bit unsigned integer"})){}class UzA extends xB(eD(nQA).annotations({description:"an array of 8-bit unsigned integers to be decoded into a Uint8Array"}),xh,{strict:!0,decode:(A)=>Uint8Array.from(A),encode:(A)=>Array.from(A)}).annotations({identifier:"Uint8Array"}){}var iQA=(A,Q,B)=>oE(iI.annotations({description:"a string to be decoded into a Uint8Array"}),xh,{strict:!0,decode:(I,D,C)=>Q4(Q(I),(G)=>new eB(C,I,G.message)),encode:(I)=>ZD(B(I))}).annotations({identifier:A}),RrA=iQA("Uint8ArrayFromBase64",wAA,VAA),LrA=iQA("Uint8ArrayFromBase64Url",RAA,NAA),MrA=iQA("Uint8ArrayFromHex",MAA,LAA),rQA=(A,Q,B)=>oE(iI.annotations({description:`A string that is interpreted as being ${A}-encoded and will be decoded into a UTF-8 string`}),iI,{strict:!0,decode:(I,D,C)=>Q4(Q(I),(G)=>new eB(C,I,G.message)),encode:(I)=>ZD(B(I))}).annotations({identifier:`StringFrom${A}`}),PrA=rQA("Base64",dUA,VAA),SrA=rQA("Base64Url",pUA,NAA),TrA=rQA("Hex",oUA,LAA),_rA=oE(iI.annotations({description:"A string that is interpreted as being UriComponent-encoded and will be decoded into a UTF-8 string"}),iI,{strict:!0,decode:(A,Q,B)=>Q4(iUA(A),(I)=>new eB(B,A,I.message)),encode:(A,Q,B)=>Q4(nUA(A),(I)=>new eB(B,A,I.message))}).annotations({identifier:"StringFromUriComponent"}),$zA=s$A,krA=(A,Q)=>(B)=>{let I=Math.floor(A);if(I<1)throw Error(kx(`Expected an integer greater than or equal to 1, actual ${A}`));return B.pipe(pB((D)=>D.length>=I,{schemaId:$zA,title:`minItems(${I})`,description:`an array of at least ${I} item(s)`,jsonSchema:{minItems:I},[sS]:!0,...Q}))},YzA=t$A,jrA=(A,Q)=>(B)=>{let I=Math.floor(A);if(I<1)throw Error(kx(`Expected an integer greater than or equal to 1, actual ${A}`));return B.pipe(pB((D)=>D.length<=I,{schemaId:YzA,title:`maxItems(${I})`,description:`an array of at most ${I} item(s)`,jsonSchema:{maxItems:I},[sS]:!0,...Q}))},WzA=a$A,yrA=(A,Q)=>(B)=>{let I=Math.floor(A);if(I<0)throw Error(kx(`Expected an integer greater than or equal to 0, actual ${A}`));return B.pipe(pB((D)=>D.length===I,{schemaId:WzA,title:`itemsCount(${I})`,description:`an array of exactly ${I} item(s)`,jsonSchema:{minItems:I,maxItems:I},[sS]:!0,...Q}))},hh=(A)=>CI(pS(A.ast));function grA(A){return xB(A,bU(hh(dB(A))),{strict:!1,decode:(Q)=>p9(Q),encode:(Q)=>gI(Q,{onNone:()=>[],onSome:zC})})}function vrA(A){return xB(A,hh(dB(A)),{strict:!1,decode:(Q)=>AC(Q),encode:(Q)=>zC(Q)})}var brA=y((A)=>dC(A[0]),(A,Q)=>oE(A,hh(dB(A)),{strict:!0,decode:(B,I,D)=>B.length>0?ZD(B[0]):Q?ZD(Q()):_E(new eB(D,B,"Unable to retrieve the first element of an empty array")),encode:(B)=>ZD(zC(B))})),IQA=Symbol.for("effect/SchemaId/ValidDate"),sQA=(A)=>(Q)=>Q.pipe(pB((B)=>!Number.isNaN(B.getTime()),{schemaId:IQA,[IQA]:{noInvalidDate:!0},title:"validDate",description:"a valid Date",...A})),DQA=Symbol.for("effect/SchemaId/LessThanDate"),xrA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<A,{schemaId:DQA,[DQA]:{max:A},title:`lessThanDate(${q8(A)})`,description:`a date before ${q8(A)}`,...Q})),EQA=Symbol.for("effect/schema/LessThanOrEqualToDate"),hrA=(A,Q)=>(B)=>B.pipe(pB((I)=>I<=A,{schemaId:EQA,[EQA]:{max:A},title:`lessThanOrEqualToDate(${q8(A)})`,description:`a date before or equal to ${q8(A)}`,...Q})),CQA=Symbol.for("effect/SchemaId/GreaterThanDate"),mrA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>A,{schemaId:CQA,[CQA]:{min:A},title:`greaterThanDate(${q8(A)})`,description:`a date after ${q8(A)}`,...Q})),JQA=Symbol.for("effect/schema/GreaterThanOrEqualToDate"),frA=(A,Q)=>(B)=>B.pipe(pB((I)=>I>=A,{schemaId:JQA,[JQA]:{min:A},title:`greaterThanOrEqualToDate(${q8(A)})`,description:`a date after or equal to ${q8(A)}`,...Q})),GQA=Symbol.for("effect/SchemaId/BetweenDate"),urA=(A,Q,B)=>(I)=>I.pipe(pB((D)=>D<=Q&&D>=A,{schemaId:GQA,[GQA]:{max:Q,min:A},title:`betweenDate(${q8(A)}, ${q8(Q)})`,description:`a date between ${q8(A)} and ${q8(Q)}`,...B})),FQA=j$A;class zq extends kE(ey,{typeConstructor:{_tag:"Date"},identifier:"DateFromSelf",schemaId:FQA,[FQA]:{noInvalidDate:!1},description:"a potentially invalid Date instance",pretty:()=>(A)=>`new Date(${JSON.stringify(A)})`,arbitrary:()=>(A)=>A.date({noInvalidDate:!1}),equivalence:()=>z2A}){}class zzA extends zq.pipe(sQA({identifier:"ValidDateFromSelf",description:"a valid Date instance"})){}class tQA extends xB(iI.annotations({description:"a string to be decoded into a Date"}),zq,{strict:!0,decode:(A)=>new Date(A),encode:(A)=>q8(A)}).annotations({identifier:"DateFromString"}){}class qzA extends tQA.pipe(sQA({identifier:"Date"})){}class OzA extends xB(X2.annotations({description:"a number to be decoded into a Date"}),zq,{strict:!0,decode:(A)=>new Date(A),encode:(A)=>A.getTime()}).annotations({identifier:"DateFromNumber"}){}class PT extends kE((A)=>ZAA(A)&&MUA(A),{typeConstructor:{_tag:"effect/DateTime.Utc"},identifier:"DateTimeUtcFromSelf",description:"a DateTime.Utc instance",pretty:()=>(A)=>A.toString(),arbitrary:()=>(A)=>A.date({noInvalidDate:!0}).map((Q)=>SUA(Q)),equivalence:()=>KAA}){}var aQA=(A,Q)=>SU({try:()=>TUA(A),catch:()=>new eB(Q,A,`Unable to decode ${U1(A)} into a DateTime.Utc`)});class VzA extends oE(X2.annotations({description:"a number to be decoded into a DateTime.Utc"}),PT,{strict:!0,decode:(A,Q,B)=>aQA(A,B),encode:(A)=>ZD(vUA(A))}).annotations({identifier:"DateTimeUtcFromNumber"}){}class wzA extends oE(zq.annotations({description:"a Date to be decoded into a DateTime.Utc"}),PT,{strict:!0,decode:(A,Q,B)=>aQA(A,B),encode:(A)=>ZD(gUA(A))}).annotations({identifier:"DateTimeUtcFromDate"}){}class NzA extends oE(iI.annotations({description:"a string to be decoded into a DateTime.Utc"}),PT,{strict:!0,decode:(A,Q,B)=>aQA(A,B),encode:(A)=>ZD(bUA(A))}).annotations({identifier:"DateTimeUtc"}){}var RzA=()=>(A)=>A.integer({min:-43200000,max:50400000}).map($AA);class mh extends kE(RUA,{typeConstructor:{_tag:"effect/DateTime.TimeZone.Offset"},identifier:"TimeZoneOffsetFromSelf",description:"a TimeZone.Offset instance",pretty:()=>(A)=>A.toString(),arbitrary:RzA}){}class LzA extends xB(X2.annotations({description:"a number to be decoded into a TimeZone.Offset"}),mh,{strict:!0,decode:(A)=>$AA(A),encode:(A)=>A.offset}).annotations({identifier:"TimeZoneOffset"}){}var MzA=()=>(A)=>A.constantFrom(...Intl.supportedValuesOf("timeZone")).map(UAA);class fh extends kE(LUA,{typeConstructor:{_tag:"effect/DateTime.TimeZone.Named"},identifier:"TimeZoneNamedFromSelf",description:"a TimeZone.Named instance",pretty:()=>(A)=>A.toString(),arbitrary:MzA}){}class PzA extends oE(iI.annotations({description:"a string to be decoded into a TimeZone.Named"}),fh,{strict:!0,decode:(A,Q,B)=>SU({try:()=>UAA(A),catch:()=>new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a TimeZone.Named`)}),encode:(A)=>ZD(A.id)}).annotations({identifier:"TimeZoneNamed"}){}class eQA extends pC(mh,fh){}class SzA extends oE(iI.annotations({description:"a string to be decoded into a TimeZone"}),eQA,{strict:!0,decode:(A,Q,B)=>gI(jUA(A),{onNone:()=>_E(new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a TimeZone`)),onSome:ZD}),encode:(A)=>ZD(yUA(A))}).annotations({identifier:"TimeZone"}){}var crA=(A)=>A.oneof(RzA()(A),MzA()(A));class ABA extends kE((A)=>ZAA(A)&&PUA(A),{typeConstructor:{_tag:"effect/DateTime.Zoned"},identifier:"DateTimeZonedFromSelf",description:"a DateTime.Zoned instance",pretty:()=>(A)=>A.toString(),arbitrary:()=>(A)=>A.tuple(A.integer({min:-31536000000000,max:31536000000000}),crA(A)).map(([Q,B])=>_UA(Q,{timeZone:B})),equivalence:()=>KAA}){}class TzA extends oE(iI.annotations({description:"a string to be decoded into a DateTime.Zoned"}),ABA,{strict:!0,decode:(A,Q,B)=>gI(kUA(A),{onNone:()=>_E(new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a DateTime.Zoned`)),onSome:ZD}),encode:(A)=>ZD(xUA(A))}).annotations({identifier:"DateTimeZoned"}){}var lrA=FE({_tag:GE("None")}).annotations({description:"NoneEncoded"}),drA=(A)=>FE({_tag:GE("Some"),value:A}).annotations({description:`SomeEncoded<${aD(A)}>`}),prA=(A)=>pC(lrA,drA(A)).annotations({description:`OptionEncoded<${aD(A)}>`}),_zA=(A)=>A._tag==="None"?pA():oA(A.value),orA=(A,Q)=>(B)=>B.oneof(Q,B.record({_tag:B.constant("None")}),B.record({_tag:B.constant("Some"),value:A(B)})).map(_zA),nrA=(A)=>gI({onNone:()=>"none()",onSome:(Q)=>`some(${A(Q)})`}),FYA=(A)=>(Q,B,I)=>a2A(Q)?ED(Q)?ZD(pA()):e2(A(Q.value,B),oA,I,Q):_E(new eB(I,Q)),HQA=(A)=>{return kE([A],{decode:(Q)=>FYA(l0(Q)),encode:(Q)=>FYA(d0(Q))},{typeConstructor:{_tag:"effect/Option"},pretty:nrA,arbitrary:orA,equivalence:I8A})},bU=(A)=>{return HQA(A).annotations({description:`Option<${aD(A)}>`})},irA={_tag:"None"},rrA=(A)=>({_tag:"Some",value:A});function srA(A){let Q=kD(A);return xB(prA(Q),bU(dB(Q)),{strict:!0,decode:(I)=>_zA(I),encode:(I)=>gI(I,{onNone:()=>irA,onSome:rrA})})}function trA(A){return xB(zT(A),bU(dB(kD(A))),{strict:!0,decode:(Q)=>w8(Q),encode:(Q)=>$n(Q)})}function arA(A,Q){return xB(qT(A),bU(dB(kD(A))),{strict:!0,decode:(B)=>w8(B),encode:Q===null?(B)=>$n(B):(B)=>PE(B)})}function erA(A){return xB(jU(A),bU(dB(kD(A))),{strict:!0,decode:(Q)=>w8(Q),encode:(Q)=>PE(Q)})}class kzA extends xB(iI,bU(bQA),{strict:!0,decode:(A)=>ZK(oA(A.trim()),Hx),encode:(A)=>eI(A,()=>"")}){}var jzA=(A)=>FE({_tag:GE("Right"),right:A}).annotations({description:`RightEncoded<${aD(A)}>`}),yzA=(A)=>FE({_tag:GE("Left"),left:A}).annotations({description:`LeftEncoded<${aD(A)}>`}),AsA=(A,Q)=>pC(jzA(A),yzA(Q)).annotations({description:`EitherEncoded<${aD(Q)}, ${aD(A)}>`}),gzA=(A)=>A._tag==="Left"?mQ(A.left):cQ(A.right),QsA=(A,Q)=>(B)=>B.oneof(B.record({_tag:B.constant("Left"),left:Q(B)}),B.record({_tag:B.constant("Right"),right:A(B)})).map(gzA),BsA=(A,Q)=>l9({onLeft:(B)=>`left(${Q(B)})`,onRight:(B)=>`right(${A(B)})`}),HYA=(A,Q)=>(B,I,D)=>cW(B)?l9(B,{onLeft:(C)=>e2(Q(C,I),mQ,D,B),onRight:(C)=>e2(A(C,I),cQ,D,B)}):_E(new eB(D,B)),QBA=({left:A,right:Q})=>{return kE([Q,A],{decode:(B,I)=>HYA(l0(B),l0(I)),encode:(B,I)=>HYA(d0(B),d0(I))},{typeConstructor:{_tag:"effect/Either"},description:`Either<${aD(Q)}, ${aD(A)}>`,pretty:BsA,arbitrary:QsA,equivalence:(B,I)=>Hn({left:I,right:B})})},XQA=(A)=>({_tag:"Left",left:A}),ZQA=(A)=>({_tag:"Right",right:A}),IsA=({left:A,right:Q})=>{let B=kD(Q),I=kD(A);return xB(AsA(B,I),QBA({left:dB(I),right:dB(B)}),{strict:!0,decode:(C)=>gzA(C),encode:(C)=>l9(C,{onLeft:XQA,onRight:ZQA})})},DsA=({left:A,right:Q})=>{let B=kD(Q),I=kD(A),D=dB(B),C=dB(I),G=xB(B,jzA(D),{strict:!0,decode:(U)=>ZQA(U),encode:(U)=>U.right}),H=xB(I,yzA(C),{strict:!0,decode:(U)=>XQA(U),encode:(U)=>U.left});return xB(pC(G,H),QBA({left:C,right:D}),{strict:!0,decode:(U)=>U._tag==="Left"?mQ(U.left):cQ(U.right),encode:(U)=>l9(U,{onLeft:XQA,onRight:ZQA})})},EsA=(A,Q,B)=>{return(I)=>{let D=I.array(I.tuple(A(I),Q(I)));return(B.depthIdentifier!==void 0?I.oneof(B,I.constant([]),D):D).map((C)=>new Map(C))}},CsA=(A,Q)=>(B)=>`new Map([${Array.from(B.entries()).map(([I,D])=>`[${A(I)}, ${Q(D)}]`).join(", ")}])`,JsA=(A,Q)=>{let B=M2($E(([I,D],[C,G])=>A(I,C)&&Q(D,G)));return $E((I,D)=>B(Array.from(I.entries()),Array.from(D.entries())))},XYA=(A)=>(Q,B,I)=>w2A(Q)?e2(A(Array.from(Q.entries()),B),(D)=>new Map(D),I,Q):_E(new eB(I,Q)),vzA=(A,Q,B)=>kE([A,Q],{decode:(I,D)=>XYA(l0(eD(WJ(I,D)))),encode:(I,D)=>XYA(d0(eD(WJ(I,D))))},{typeConstructor:{_tag:"ReadonlyMap"},description:B,pretty:CsA,arbitrary:EsA,equivalence:JsA}),BBA=({key:A,value:Q})=>vzA(A,Q,`ReadonlyMap<${aD(A)}, ${aD(Q)}>`),IBA=({key:A,value:Q})=>vzA(A,Q,`Map<${aD(A)}, ${aD(Q)}>`);function GsA({key:A,value:Q}){return xB(eD(WJ(A,Q)),BBA({key:dB(kD(A)),value:dB(kD(Q))}),{strict:!0,decode:(B)=>new Map(B),encode:(B)=>Array.from(B.entries())})}function FsA({key:A,value:Q}){return xB(eD(WJ(A,Q)),IBA({key:dB(kD(A)),value:dB(kD(Q))}),{strict:!0,decode:(B)=>new Map(B),encode:(B)=>Array.from(B.entries())})}var HsA=({key:A,value:Q})=>xB(MQA({key:wQA(A),value:Q}).annotations({description:"a record to be decoded into a ReadonlyMap"}),BBA({key:A,value:dB(Q)}),{strict:!0,decode:(B)=>new Map(Object.entries(B)),encode:(B)=>Object.fromEntries(B)}),XsA=({key:A,value:Q})=>xB(MQA({key:wQA(A),value:Q}).annotations({description:"a record to be decoded into a Map"}),IBA({key:A,value:dB(Q)}),{strict:!0,decode:(B)=>new Map(Object.entries(B)),encode:(B)=>Object.fromEntries(B)}),ZsA=(A,Q)=>(B)=>{let I=B.array(A(B));return(Q.depthIdentifier!==void 0?B.oneof(Q,B.constant([]),I):I).map((D)=>new Set(D))},KsA=(A)=>(Q)=>`new Set([${Array.from(Q.values()).map((B)=>A(B)).join(", ")}])`,UsA=(A)=>{let Q=M2(A);return $E((B,I)=>Q(Array.from(B.values()),Array.from(I.values())))},ZYA=(A)=>(Q,B,I)=>V2A(Q)?e2(A(Array.from(Q.values()),B),(D)=>new Set(D),I,Q):_E(new eB(I,Q)),bzA=(A,Q)=>kE([A],{decode:(B)=>ZYA(l0(eD(B))),encode:(B)=>ZYA(d0(eD(B)))},{typeConstructor:{_tag:"ReadonlySet"},description:Q,pretty:KsA,arbitrary:ZsA,equivalence:UsA}),xzA=(A)=>bzA(A,`ReadonlySet<${aD(A)}>`),hzA=(A)=>bzA(A,`Set<${aD(A)}>`);function $sA(A){return xB(eD(A),xzA(dB(kD(A))),{strict:!0,decode:(Q)=>new Set(Q),encode:(Q)=>Array.from(Q)})}function YsA(A){return xB(eD(A),hzA(dB(kD(A))),{strict:!0,decode:(Q)=>new Set(Q),encode:(Q)=>Array.from(Q)})}var WsA=()=>(A)=>`BigDecimal(${l3(TU(A))})`,zsA=()=>(A)=>A.tuple(A.bigInt(),A.integer({min:-18,max:18})).map(([Q,B])=>U5(Q,B));class w5 extends kE(EAA,{typeConstructor:{_tag:"effect/BigDecimal"},identifier:"BigDecimalFromSelf",pretty:WsA,arbitrary:zsA,equivalence:()=>CAA}){}class mzA extends oE(iI.annotations({description:"a string to be decoded into a BigDecimal"}),w5,{strict:!0,decode:(A,Q,B)=>JAA(A).pipe(gI({onNone:()=>_E(new eB(B,A,`Unable to decode ${JSON.stringify(A)} into a BigDecimal`)),onSome:(I)=>ZD(TU(I))})),encode:(A)=>ZD(l3(TU(A)))}).annotations({identifier:"BigDecimal"}){}class fzA extends xB(X2.annotations({description:"a number to be decoded into a BigDecimal"}),w5,{strict:!0,decode:(A)=>CUA(A),encode:(A)=>JUA(A)}).annotations({identifier:"BigDecimalFromNumber"}){}var KQA=Symbol.for("effect/SchemaId/GreaterThanBigDecimal"),qsA=(A,Q)=>(B)=>{let I=l3(A);return B.pipe(pB((D)=>BUA(D,A),{schemaId:KQA,[KQA]:{min:A},title:`greaterThanBigDecimal(${I})`,description:`a BigDecimal greater than ${I}`,...Q}))},UQA=Symbol.for("effect/schema/GreaterThanOrEqualToBigDecimal"),OsA=(A,Q)=>(B)=>{let I=l3(A);return B.pipe(pB((D)=>IUA(D,A),{schemaId:UQA,[UQA]:{min:A},title:`greaterThanOrEqualToBigDecimal(${I})`,description:`a BigDecimal greater than or equal to ${I}`,...Q}))},$QA=Symbol.for("effect/SchemaId/LessThanBigDecimal"),VsA=(A,Q)=>(B)=>{let I=l3(A);return B.pipe(pB((D)=>AUA(D,A),{schemaId:$QA,[$QA]:{max:A},title:`lessThanBigDecimal(${I})`,description:`a BigDecimal less than ${I}`,...Q}))},YQA=Symbol.for("effect/schema/LessThanOrEqualToBigDecimal"),wsA=(A,Q)=>(B)=>{let I=l3(A);return B.pipe(pB((D)=>QUA(D,A),{schemaId:YQA,[YQA]:{max:A},title:`lessThanOrEqualToBigDecimal(${I})`,description:`a BigDecimal less than or equal to ${I}`,...Q}))},uzA=Symbol.for("effect/schema/PositiveBigDecimal"),czA=(A)=>(Q)=>Q.pipe(pB((B)=>GUA(B),{schemaId:uzA,title:"positiveBigDecimal",description:"a positive BigDecimal",...A})),NsA=w5.pipe(czA({identifier:"PositiveBigDecimalFromSelf"})),lzA=Symbol.for("effect/schema/NonNegativeBigDecimal"),dzA=(A)=>(Q)=>Q.pipe(pB((B)=>B.value>=0n,{schemaId:lzA,title:"nonNegativeBigDecimal",description:"a non-negative BigDecimal",...A})),RsA=w5.pipe(dzA({identifier:"NonNegativeBigDecimalFromSelf"})),pzA=Symbol.for("effect/schema/NegativeBigDecimal"),ozA=(A)=>(Q)=>Q.pipe(pB((B)=>GAA(B),{schemaId:pzA,title:"negativeBigDecimal",description:"a negative BigDecimal",...A})),LsA=w5.pipe(ozA({identifier:"NegativeBigDecimalFromSelf"})),nzA=Symbol.for("effect/schema/NonPositiveBigDecimal"),izA=(A)=>(Q)=>Q.pipe(pB((B)=>B.value<=0n,{schemaId:nzA,title:"nonPositiveBigDecimal",description:"a non-positive BigDecimal",...A})),MsA=w5.pipe(izA({identifier:"NonPositiveBigDecimalFromSelf"})),WQA=Symbol.for("effect/SchemaId/BetweenBigDecimal"),rzA=(A,Q,B)=>(I)=>{let D=l3(A),C=l3(Q);return I.pipe(pB((G)=>DUA(G,{minimum:A,maximum:Q}),{schemaId:WQA,[WQA]:{maximum:Q,minimum:A},title:`betweenBigDecimal(${D}, ${C})`,description:`a BigDecimal between ${D} and ${C}`,...B}))},PsA=(A,Q)=>(B)=>xB(B,B.pipe(dB,rzA(A,Q)),{strict:!1,decode:(I)=>EUA(I,{minimum:A,maximum:Q}),encode:rQ}),SsA=(A,Q)=>(B)=>{let I=B.array(A(B));return(Q.depthIdentifier!==void 0?B.oneof(Q,B.constant([]),I):I).map(e4)},TsA=(A)=>(Q)=>`Chunk(${xC(Q).map(A).join(", ")})`,KYA=(A)=>(Q,B,I)=>AP(Q)?eW(Q)?ZD(YE()):e2(A(xC(Q),B),e4,I,Q):_E(new eB(I,Q)),szA=(A)=>{return kE([A],{decode:(Q)=>KYA(l0(eD(Q))),encode:(Q)=>KYA(d0(eD(Q)))},{typeConstructor:{_tag:"effect/Chunk"},description:`Chunk<${aD(A)}>`,pretty:TsA,arbitrary:SsA,equivalence:zg})};function _sA(A){return xB(eD(A),szA(dB(kD(A))),{strict:!0,decode:(Q)=>Q.length===0?YE():e4(Q),encode:(Q)=>xC(Q)})}var ksA=(A)=>(Q)=>bAA(A(Q),{minLength:1}).map((B)=>IP(B)),jsA=(A)=>(Q)=>`NonEmptyChunk(${xC(Q).map(A).join(", ")})`,UYA=(A)=>(Q,B,I)=>AP(Q)&&cD(Q)?e2(A(xC(Q),B),IP,I,Q):_E(new eB(I,Q)),tzA=(A)=>{return kE([A],{decode:(Q)=>UYA(l0(Wq(Q))),encode:(Q)=>UYA(d0(Wq(Q)))},{typeConstructor:{_tag:"effect/Chunk.NonEmptyChunk"},description:`NonEmptyChunk<${aD(A)}>`,pretty:jsA,arbitrary:ksA,equivalence:zg})};function ysA(A){return xB(Wq(A),tzA(dB(kD(A))),{strict:!0,decode:(Q)=>IP(Q),encode:(Q)=>xC(Q)})}var DBA=(A)=>Array.isArray(A)?F5A(A):G5A(A),gsA=(A)=>(Q)=>A(Q).map(DBA),vsA=(A)=>(Q)=>`Data(${A(Q)})`,$YA=(A)=>(Q,B,I)=>UH(Q)?e2(A(Q,B),DBA,I,Q):_E(new eB(I,Q)),azA=(A)=>{return kE([A],{decode:(Q)=>$YA(l0(Q)),encode:(Q)=>$YA(d0(Q))},{description:`Data<${aD(A)}>`,pretty:vsA,arbitrary:gsA})},bsA=(A)=>{return xB(A,azA(dB(A)),{strict:!1,decode:(Q)=>DBA(Q),encode:(Q)=>Array.isArray(Q)?Array.from(Q):Object.assign({},Q)})},xsA=(A)=>dC(A)||yh(A),ezA=(A)=>Reflect.ownKeys(A).every((Q)=>xsA(A[Q])),EBA=(A)=>("fields"in A)?A.fields:EBA(A[SQA]),uh=(A)=>ezA(A)?FE(A):dC(A)?A:FE(EBA(A)),ch=(A)=>ezA(A)?A:EBA(A),hsA=(A)=>(Q,B)=>yU({kind:"Class",identifier:A,schema:uh(Q),fields:ch(Q),Base:tt,annotations:B}),lh=(A)=>Y5(Kq(GE(A)),()=>A),msA=(A)=>(Q,B,I)=>{let D=ch(B),C=uh(B),G={_tag:lh(Q)},H=Uq(G,D);return class extends yU({kind:"TaggedClass",identifier:A??Q,schema:LT(C,FE(G)),fields:H,Base:tt,annotations:I}){static _tag=Q}},fsA=(A)=>(Q,B,I)=>{class D extends at{}D.prototype.name=Q;let C=ch(B),G=uh(B),H={_tag:lh(Q)},Z=Uq(H,C),U="message"in Z;class O extends yU({kind:"TaggedError",identifier:A??Q,schema:LT(G,FE(H)),fields:Z,Base:D,annotations:I,disableToString:!0}){static _tag=Q}if(!U)Object.defineProperty(O.prototype,"message",{get(){return`{ ${Reflect.ownKeys(C).map((w)=>`${$H(w)}: ${U1(this[w])}`).join(", ")} }`},enumerable:!1,configurable:!0});return O},Uq=(A,Q)=>{let B={...A};for(let I of Reflect.ownKeys(Q)){if(I in A)throw Error(jx(I));B[I]=Q[I]}return B};function dh(A){return q3(A)?A:A?.disableValidation??!1}var YYA=$B("effect/Schema/astCache",()=>new WeakMap),usA=(A)=>{if(A===void 0)return[];else if(Array.isArray(A))return A;else return[A]},yU=({Base:A,annotations:Q,disableToString:B,fields:I,identifier:D,kind:C,schema:G})=>{let H=Symbol.for(`effect/Schema/${C}/${D}`),[Z,U,O]=usA(Q),w=dB(G),L=w.annotations({identifier:D,...Z}),P=w.annotations({[I5]:`${D} (Type side)`,...Z}),k=G.annotations({[I5]:`${D} (Constructor)`,...Z}),_=G.annotations({[I5]:`${D} (Encoded side)`,...O}),x=G.annotations({...O,...Z,...U}),l=(o)=>VQ(o,H)&&Jq(P)(o),GA=class extends A{constructor(o={},BA=!1){if(o={...o},C!=="Class")delete o._tag;if(o=dYA(I,o),!dh(BA))o=Z5(k)(o);super(o,!0)}static[z5]=xAA;static get ast(){let o=YYA.get(this);if(o)return o;let BA=kE([G],{decode:()=>(JA,XA,UA)=>JA instanceof this||l(JA)?ZD(JA):_E(new eB(UA,JA)),encode:()=>(JA,XA)=>JA instanceof this?ZD(JA):lC(d0(P)(JA,XA),(UA)=>new this(UA,!0))},{identifier:D,pretty:(JA)=>(XA)=>`${D}(${JA(XA)})`,arbitrary:(JA)=>(XA)=>JA(XA).map((UA)=>new this(UA)),equivalence:rQ,[rS]:L.ast,...Z});return o=xB(_,BA,{strict:!0,decode:(JA)=>new this(JA,!0),encode:rQ}).annotations({[rS]:x.ast,...U}).ast,YYA.set(this,o),o}static pipe(){return RQ(this,arguments)}static annotations(o){return CI(this.ast).annotations(o)}static toString(){return`(${String(_)} <-> ${D})`}static make(...o){return new this(...o)}static fields={...I};static identifier=D;static extend(o){return(BA,JA)=>{let XA=ch(BA),UA=uh(BA),OA=Uq(I,XA);return yU({kind:C,identifier:o,schema:LT(G,UA),fields:OA,Base:this,annotations:JA})}}static transformOrFail(o){return(BA,JA,XA)=>{let UA=Uq(I,BA);return yU({kind:C,identifier:o,schema:oE(G,dB(FE(UA)),JA),fields:UA,Base:this,annotations:XA})}}static transformOrFailFrom(o){return(BA,JA,XA)=>{let UA=Uq(I,BA);return yU({kind:C,identifier:o,schema:oE(Lh(G),FE(UA),JA),fields:UA,Base:this,annotations:XA})}}get[H](){return H}};if(B!==!0)Object.defineProperty(GA.prototype,"toString",{value(){return`${D}({ ${Reflect.ownKeys(I).map((o)=>`${$H(o)}: ${U1(this[o])}`).join(", ")} })`},configurable:!0,writable:!0});return GA},csA=FE({_tag:GE("None")}).annotations({identifier:"FiberIdNoneEncoded"}),lsA=FE({_tag:GE("Runtime"),id:zh,startTimeMillis:zh}).annotations({identifier:"FiberIdRuntimeEncoded"}),dsA=FE({_tag:GE("Composite"),left:Wh(()=>Oh),right:Wh(()=>Oh)}).annotations({identifier:"FiberIdCompositeEncoded"}),Oh=pC(csA,lsA,dsA).annotations({identifier:"FiberIdEncoded"}),AqA=(A)=>A.letrec((Q)=>({None:A.record({_tag:A.constant("None")}),Runtime:A.record({_tag:A.constant("Runtime"),id:A.integer(),startTimeMillis:A.integer()}),Composite:A.record({_tag:A.constant("Composite"),left:Q("FiberId"),right:Q("FiberId")}),FiberId:A.oneof(Q("None"),Q("Runtime"),Q("Composite"))})).FiberId.map(wT),Vh=(A)=>{switch(A._tag){case"None":return"FiberId.none";case"Runtime":return`FiberId.runtime(${A.id}, ${A.startTimeMillis})`;case"Composite":return`FiberId.composite(${Vh(A.right)}, ${Vh(A.left)})`}};class CBA extends kE(m1A,{typeConstructor:{_tag:"effect/FiberId"},identifier:"FiberIdFromSelf",pretty:()=>Vh,arbitrary:()=>AqA}){}var wT=(A)=>{switch(A._tag){case"None":return s2;case"Runtime":return x1A(A.id,A.startTimeMillis);case"Composite":return h1A(wT(A.left),wT(A.right))}},zQA=(A)=>{switch(A._tag){case"None":return{_tag:"None"};case"Runtime":return{_tag:"Runtime",id:A.id,startTimeMillis:A.startTimeMillis};case"Composite":return{_tag:"Composite",left:zQA(A.left),right:zQA(A.right)}}};class QqA extends xB(Oh,CBA,{strict:!0,decode:(A)=>wT(A),encode:(A)=>zQA(A)}).annotations({identifier:"FiberId"}){}var psA=(A)=>FE({_tag:GE("Die"),defect:A}),osA=FE({_tag:GE("Empty")}),nsA=(A)=>FE({_tag:GE("Fail"),error:A}),isA=FE({_tag:GE("Interrupt"),fiberId:Oh}),rsA=0,wh=(A,Q)=>{let B=kD(A),I=kD(Q),D=Wh(()=>C),C=pC(osA,nsA(B),psA(I),isA,FE({_tag:GE("Sequential"),left:D,right:D}),FE({_tag:GE("Parallel"),left:D,right:D})).annotations({title:`CauseEncoded<${aD(A)}>`,[vx]:`CauseEncoded${rsA++}`});return C},BqA=(A,Q)=>(B)=>B.letrec((I)=>({Empty:B.record({_tag:B.constant("Empty")}),Fail:B.record({_tag:B.constant("Fail"),error:A(B)}),Die:B.record({_tag:B.constant("Die"),defect:Q(B)}),Interrupt:B.record({_tag:B.constant("Interrupt"),fiberId:AqA(B)}),Sequential:B.record({_tag:B.constant("Sequential"),left:I("Cause"),right:I("Cause")}),Parallel:B.record({_tag:B.constant("Parallel"),left:I("Cause"),right:I("Cause")}),Cause:B.oneof(I("Empty"),I("Fail"),I("Die"),I("Interrupt"),I("Sequential"),I("Parallel"))})).Cause.map(W5),IqA=(A)=>(Q)=>{let B=(I)=>{switch(I._tag){case"Empty":return"Cause.empty";case"Fail":return`Cause.fail(${A(I.error)})`;case"Die":return`Cause.die(${PS(I)})`;case"Interrupt":return`Cause.interrupt(${Vh(I.fiberId)})`;case"Sequential":return`Cause.sequential(${B(I.left)}, ${B(I.right)})`;case"Parallel":return`Cause.parallel(${B(I.left)}, ${B(I.right)})`}};return B(Q)},WYA=(A)=>(Q,B,I)=>M7A(Q)?e2(A(Zq(Q),B),W5,I,Q):_E(new eB(I,Q)),Nh=({defect:A,error:Q})=>{return kE([Q,A],{decode:(B,I)=>WYA(l0(wh(B,I))),encode:(B,I)=>WYA(d0(wh(B,I)))},{typeConstructor:{_tag:"effect/Cause"},title:`Cause<${Q.ast}>`,pretty:IqA,arbitrary:BqA})};function W5(A){switch(A._tag){case"Empty":return O7A;case"Fail":return V7A(A.error);case"Die":return w7A(A.defect);case"Interrupt":return N7A(wT(A.fiberId));case"Sequential":return L7A(W5(A.left),W5(A.right));case"Parallel":return R7A(W5(A.left),W5(A.right))}}function Zq(A){switch(A._tag){case"Empty":return{_tag:"Empty"};case"Fail":return{_tag:"Fail",error:A.error};case"Die":return{_tag:"Die",defect:A.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:A.fiberId};case"Sequential":return{_tag:"Sequential",left:Zq(A.left),right:Zq(A.right)};case"Parallel":return{_tag:"Parallel",left:Zq(A.left),right:Zq(A.right)}}}var ssA=({defect:A,error:Q})=>{let B=kD(Q),I=kD(A);return xB(wh(B,I),Nh({error:dB(B),defect:dB(I)}),{strict:!1,decode:(C)=>W5(C),encode:(C)=>Zq(C)})};class Rh extends xB($q,$q,{strict:!0,decode:(A)=>{if($C(A)&&"message"in A&&typeof A.message==="string"){let Q=Error(A.message,{cause:A});if("name"in A&&typeof A.name==="string")Q.name=A.name;return Q.stack="stack"in A&&typeof A.stack==="string"?A.stack:"",Q}return mg(A)},encode:(A)=>{if(A instanceof Error)return{name:A.name,message:A.message};return mg(A)}}).annotations({identifier:"Defect"}){}var tsA=(A,Q)=>FE({_tag:GE("Failure"),cause:wh(A,Q)}),asA=(A)=>FE({_tag:GE("Success"),value:A}),esA=(A,Q,B)=>{return pC(tsA(Q,B),asA(A)).annotations({title:`ExitEncoded<${aD(A)}, ${aD(Q)}, ${aD(B)}>`})},DqA=(A)=>{switch(A._tag){case"Failure":return ps(W5(A.cause));case"Success":return CS(A.value)}},AtA=(A,Q,B)=>(I)=>I.oneof(I.record({_tag:I.constant("Failure"),cause:BqA(Q,B)(I)}),I.record({_tag:I.constant("Success"),value:A(I)})).map(DqA),QtA=(A,Q)=>(B)=>B._tag==="Failure"?`Exit.failCause(${IqA(Q)(B.cause)})`:`Exit.succeed(${A(B.value)})`,zYA=(A,Q)=>(B,I,D)=>oGA(B)?iGA(B,{onFailure:(C)=>e2(Q(C,I),ps,D,B),onSuccess:(C)=>e2(A(C,I),CS,D,B)}):_E(new eB(D,B)),EqA=({defect:A,failure:Q,success:B})=>kE([B,Q,A],{decode:(I,D,C)=>zYA(l0(I),l0(Nh({error:D,defect:C}))),encode:(I,D,C)=>zYA(d0(I),d0(Nh({error:D,defect:C})))},{typeConstructor:{_tag:"effect/Exit"},title:`Exit<${B.ast}, ${Q.ast}>`,pretty:QtA,arbitrary:AtA}),qQA=({defect:A,failure:Q,success:B})=>{let I=kD(B),D=kD(Q),C=kD(A);return xB(esA(I,D,C),EqA({failure:dB(D),success:dB(I),defect:dB(C)}),{strict:!1,decode:(H)=>DqA(H),encode:(H)=>H._tag==="Failure"?{_tag:"Failure",cause:H.cause}:{_tag:"Success",value:H.value}})},BtA=(A,Q)=>(B)=>{let I=B.array(A(B));return(Q.depthIdentifier!==void 0?B.oneof(Q,B.constant([]),I):I).map(NH)},ItA=(A)=>(Q)=>`HashSet(${Array.from(Q).map((B)=>A(B)).join(", ")})`,DtA=(A)=>{let Q=M2(A);return $E((B,I)=>Q(Array.from(B),Array.from(I)))},qYA=(A)=>(Q,B,I)=>o8A(Q)?e2(A(Array.from(Q),B),NH,I,Q):_E(new eB(I,Q)),CqA=(A)=>{return kE([A],{decode:(Q)=>qYA(l0(eD(Q))),encode:(Q)=>qYA(d0(eD(Q)))},{typeConstructor:{_tag:"effect/HashSet"},description:`HashSet<${aD(A)}>`,pretty:ItA,arbitrary:BtA,equivalence:DtA})};function EtA(A){return xB(eD(A),CqA(dB(kD(A))),{strict:!0,decode:(Q)=>NH(Q),encode:(Q)=>Array.from(Q)})}var CtA=(A,Q,B)=>(I)=>{let D=I.array(I.tuple(A(I),Q(I)));return(B.depthIdentifier!==void 0?I.oneof(B,I.constant([]),D):D).map(Xz)},JtA=(A,Q)=>(B)=>`HashMap([${Array.from(B).map(([I,D])=>`[${A(I)}, ${Q(D)}]`).join(", ")}])`,GtA=(A,Q)=>{let B=M2($E(([I,D],[C,G])=>A(I,C)&&Q(D,G)));return $E((I,D)=>B(Array.from(I),Array.from(D)))},OYA=(A)=>(Q,B,I)=>u1A(Q)?e2(A(Array.from(Q),B),Xz,I,Q):_E(new eB(I,Q)),JqA=({key:A,value:Q})=>{return kE([A,Q],{decode:(B,I)=>OYA(l0(eD(WJ(B,I)))),encode:(B,I)=>OYA(d0(eD(WJ(B,I))))},{typeConstructor:{_tag:"effect/HashMap"},description:`HashMap<${aD(A)}, ${aD(Q)}>`,pretty:JtA,arbitrary:CtA,equivalence:GtA})},FtA=({key:A,value:Q})=>{return xB(eD(WJ(A,Q)),JqA({key:dB(kD(A)),value:dB(kD(Q))}),{strict:!0,decode:(B)=>Xz(B),encode:(B)=>Array.from(B)})},HtA=(A,Q)=>(B)=>{let I=B.array(A(B));return(Q.depthIdentifier!==void 0?B.oneof(Q,B.constant([]),I):I).map(tg)},XtA=(A)=>(Q)=>`List(${Array.from(Q).map((B)=>A(B)).join(", ")})`,ZtA=(A)=>{let Q=M2(A);return $E((B,I)=>Q(Array.from(B),Array.from(I)))},VYA=(A)=>(Q,B,I)=>sg(Q)?e2(A(Array.from(Q),B),tg,I,Q):_E(new eB(I,Q)),GqA=(A)=>{return kE([A],{decode:(Q)=>VYA(l0(eD(Q))),encode:(Q)=>VYA(d0(eD(Q)))},{typeConstructor:{_tag:"effect/List"},description:`List<${aD(A)}>`,pretty:XtA,arbitrary:HtA,equivalence:ZtA})};function KtA(A){return xB(eD(A),GqA(dB(kD(A))),{strict:!0,decode:(Q)=>tg(Q),encode:(Q)=>Array.from(Q)})}var UtA=(A,Q,B)=>(I)=>{let D=I.array(A(I));return(B.depthIdentifier!==void 0?I.oneof(B,I.constant([]),D):D).map((C)=>kb(C,Q))},$tA=(A)=>(Q)=>`new SortedSet([${Array.from(jb(Q)).map((B)=>A(B)).join(", ")}])`,wYA=(A,Q)=>(B,I,D)=>Ut(B)?e2(A(Array.from(jb(B)),I),(C)=>kb(C,Q),D,B):_E(new eB(D,B)),FqA=(A,Q,B)=>{return kE([A],{decode:(I)=>wYA(l0(eD(I)),Q),encode:(I)=>wYA(d0(eD(I)),B)},{typeConstructor:{_tag:"effect/SortedSet"},description:`SortedSet<${aD(A)}>`,pretty:$tA,arbitrary:(I,D)=>UtA(I,Q,D),equivalence:()=>LFA()})};function YtA(A,Q){let B=dB(kD(A));return xB(eD(A),FqA(B,Q,Q),{strict:!0,decode:(I)=>kb(I,Q),encode:(I)=>Array.from(jb(I))})}class HqA extends xB($q,Yq,{strict:!0,decode:(A)=>O2A(A),encode:rQ}).annotations({identifier:"BooleanFromUnknown"}){}class XqA extends xB(GE("true","false").annotations({description:"a string to be decoded into a boolean"}),Yq,{strict:!0,decode:(A)=>A==="true",encode:(A)=>A?"true":"false"}).annotations({identifier:"BooleanFromString"}){}var WtA=(A,Q)=>{let B=FT(Q);return NUA(A).pipe(wUA((I)=>B(I).pipe(Q4((D)=>KUA([],PU.formatIssueSync(D))))))},ST=Symbol.for("effect/Schema/Serializable/symbol"),ztA=(A)=>A,qtA=(A)=>A[ST],OtA=(A)=>Mh(A[ST])(A),VtA=y(2,(A,Q)=>gU(A[ST])(Q)),hF=Symbol.for("effect/Schema/Serializable/symbolResult"),wtA=(A)=>A,OQA=(A)=>A[hF].failure,VQA=(A)=>A[hF].success,NYA=$B("effect/Schema/Serializable/exitSchemaCache",()=>new WeakMap),JBA=(A)=>{let Q=Object.getPrototypeOf(A);if(!(hF in Q))return qQA({failure:OQA(A),success:VQA(A),defect:Rh});let B=NYA.get(Q);if(B===void 0)B=qQA({failure:OQA(A),success:VQA(A),defect:Rh}),NYA.set(Q,B);return B},NtA=y(2,(A,Q)=>Ph(A[hF].failure)(Q)),RtA=y(2,(A,Q)=>gU(A[hF].failure)(Q)),LtA=y(2,(A,Q)=>Ph(A[hF].success)(Q)),MtA=y(2,(A,Q)=>gU(A[hF].success)(Q)),PtA=y(2,(A,Q)=>Ph(JBA(A))(Q)),StA=y(2,(A,Q)=>gU(JBA(A))(Q)),TtA=(A)=>A,_tA=(A)=>(Q,B,I)=>{let D=Uq({_tag:lh(Q)},B.payload);return class extends yU({kind:"TaggedRequest",identifier:A??Q,schema:FE(D),fields:D,Base:RZA,annotations:I}){static _tag=Q;static success=B.success;static failure=B.failure;get[ST](){return this.constructor}get[hF](){return{failure:B.failure,success:B.success}}}},ktA=(A)=>d3(A.ast,[]),jtA=j2(gx),d3=(A,Q)=>{let B=jtA(A);if(YI(B))switch(A._tag){case"Declaration":return B.value(...A.typeParameters.map((I)=>d3(I,Q)));case"Refinement":return B.value(d3(A.from,Q));default:return B.value()}switch(A._tag){case"NeverKeyword":throw Error(vZA(A,Q));case"Transformation":return d3(A.to,Q);case"Declaration":case"Literal":case"StringKeyword":case"TemplateLiteral":case"UniqueSymbol":case"SymbolKeyword":case"UnknownKeyword":case"AnyKeyword":case"NumberKeyword":case"BooleanKeyword":case"BigIntKeyword":case"UndefinedKeyword":case"VoidKeyword":case"Enums":case"ObjectKeyword":return NQ;case"Refinement":return d3(A.from,Q);case"Suspend":{let I=sz(()=>d3(A.f(),Q));return(D,C)=>I()(D,C)}case"TupleType":{let I=A.elements.map((C,G)=>d3(C.type,Q.concat(G))),D=A.rest.map((C)=>d3(C.type,Q));return $E((C,G)=>{if(!Array.isArray(C)||!Array.isArray(G))return!1;let H=C.length;if(H!==G.length)return!1;let Z=0;for(;Z<Math.min(H,A.elements.length);Z++)if(!I[Z](C[Z],G[Z]))return!1;if(LD(D)){let[U,...O]=D;for(;Z<H-O.length;Z++)if(!U(C[Z],G[Z]))return!1;for(let w=0;w<O.length;w++)if(Z+=w,!O[w](C[Z],G[Z]))return!1}return!0})}case"TypeLiteral":{if(A.propertySignatures.length===0&&A.indexSignatures.length===0)return NQ;let I=A.propertySignatures.map((C)=>d3(C.type,Q.concat(C.name))),D=A.indexSignatures.map((C)=>d3(C.type,Q));return $E((C,G)=>{if(!mM(C)||!mM(G))return!1;let H=Object.keys(C),Z=Object.getOwnPropertySymbols(C);for(let w=0;w<I.length;w++){let L=A.propertySignatures[w],P=L.name,k=Object.prototype.hasOwnProperty.call(C,P),_=Object.prototype.hasOwnProperty.call(G,P);if(L.isOptional){if(k!==_)return!1}if(k&&_&&!I[w](C[P],G[P]))return!1}let U,O;for(let w=0;w<D.length;w++){let L=A.indexSignatures[w],P=kF(L.parameter),k=mx(P);if(k){if(U=U||Object.getOwnPropertySymbols(G),Z.length!==U.length)return!1}else if(O=O||Object.keys(G),H.length!==O.length)return!1;let _=k?Z:H;for(let x=0;x<_.length;x++){let l=_[x];if(!Object.prototype.hasOwnProperty.call(G,l)||!D[w](C[l],G[l]))return!1}}return!0})}case"Union":{let I=Ih(A.types,!0),D=Reflect.ownKeys(I.keys),C=D.length;return $E((G,H)=>{let Z=[];if(C>0&&yW(G))for(let O=0;O<C;O++){let w=D[O],L=I.keys[w].buckets;if(Object.prototype.hasOwnProperty.call(G,w)){let P=String(G[w]);if(Object.prototype.hasOwnProperty.call(L,P))Z=Z.concat(L[P])}}if(I.otherwise.length>0)Z=Z.concat(I.otherwise);let U=Z.map((O)=>[d3(O,Q),Jq({ast:O})]);for(let O=0;O<U.length;O++){let[w,L]=U[O];if(L(G)&&L(H)){if(w(G,H))return!0}}return!1})}}},RYA=RT("symbol",{key:iI}).annotations({description:"an object to be decoded into a globally shared symbol"}),ytA=oE(RYA,kh,{strict:!0,decode:(A)=>aWA(A.key),encode:(A,Q,B)=>lC(tWA(A,B),(I)=>RYA.make({key:I}))});class GBA extends pC(iI,X2,ytA).annotations({identifier:"PropertyKey"}){}class ZqA extends FE({_tag:Kq(GE("Pointer","Unexpected","Missing","Composite","Refinement","Transformation","Type","Forbidden")).annotations({description:"The tag identifying the type of parse issue"}),path:Kq(eD(GBA)).annotations({description:"The path to the property where the issue occurred"}),message:Kq(iI).annotations({description:"A descriptive message explaining the issue"})}).annotations({identifier:"ArrayFormatterIssue",description:"Represents an issue returned by the ArrayFormatter formatter"}){}var UqA="0.0.19";var $qA={name:"@mdlx/cli",version:UqA,description:"Interactive CLI for syncing music locally via YouTube.",type:"module",author:"Labithiotis",license:"MIT",keywords:["cli","mdl","music","downloader","spotify","apple music","amazon music","youtube music","soundcloud","bandcamp","qobuz","deezer","tidal"],bin:{mdl:"release/cli.js"},engines:{bun:">=1",node:">=18"},files:["release"],exports:{".":"./src/cli.tsx","./lib/*":"./src/lib/*.ts","./ui/app":"./src/ui/app.tsx"},homepage:"https://github.com/labithiotis/mdl",repository:{type:"git",url:"git+https://github.com/labithiotis/mdl.git"},scripts:{dev:"bun run src/cli.tsx",build:"bun build --compile --minify ./src/cli.tsx --outfile release/mdl","build:npm":"bun build --minify --target=node ./src/cli.tsx --outfile release/cli.js",check:"tsc --noEmit",typecheck:"tsc --noEmit",test:"bun test src","test:unit":"bun test src"},dependencies:{effect:"3.21.0",ink:"6.8.0","ink-scroll-view":"0.3.6","ink-spinner":"5.0.0","ink-text-input":"6.0.0",react:"19.2.0","sanitize-filename":"1.6.4","youtubei.js":"17.0.1"},devDependencies:{"@types/react":"19.2.2","ink-testing-library":"4.0.0","react-devtools-core":"7.0.1"}};var gtA=5000,vtA=2;class qq extends VB.TaggedError()("CliArgumentError",{message:VB.String}){}class ph extends VB.TaggedError()("ManifestDecodeError",{message:VB.String}){}class Oq extends VB.TaggedError()("TrackSyncError",{reason:VB.String,stage:VB.String,trackTitle:VB.String}){}function TT(A,Q){return VB.decodeUnknownEither(A)(Q)}function N5(A,Q){return VB.decodeUnknownSync(A)(Q)}function FBA(A){return A.message.replace(/\s+/g," ").trim()}function _T(A){if(A instanceof Oq)return`Failed ${xtA(A.stage)} for ${A.trackTitle}: ${A.reason}`;if(A instanceof ph)return`Invalid manifest data: ${A.message}`;if(A instanceof qq)return A.message;if(HT.isParseError(A))return FBA(A);if(A instanceof Error)return A.message;return String(A)}function btA(A){let Q=A?.baseDelayMs??gtA,B=A?.maxRetries??vtA;return K5.exponential(`${Q} millis`).pipe(K5.compose(K5.recurs(B)),K5.jittered)}function kT(A){let Q=0,B=A.shouldRetry??(()=>!0),I=btA({baseDelayMs:A.baseDelayMs,maxRetries:A.maxRetries}).pipe(K5.tapInput((D)=>VC.sync(()=>{Q+=1,A.onRetry?.(Q,D)})));return A.effect.pipe(VC.retry({schedule:I,while:B}))}function Z0(...A){return A.find((Q)=>Q?.trim())?.trim()}function xtA(A){switch(A){case"downloading-audio":return"downloading audio";case"searching-youtube":return"searching YouTube";case"writing-metadata":return"writing metadata";case"writing-manifest":return"writing manifest";default:return A.replaceAll("-"," ")}}var HBA=["mp3","m4a","opus","flac","wav"],XBA=["best","0","1","2","3","4","5","6","7","8","9","10","128K","192K","256K","320K"],YqA=10,WqA="mp3",zqA="best",htA=VB.Literal(...HBA),mtA=VB.Literal(...XBA);function qqA(A){let Q={audioFormat:WqA,audioQuality:zqA,downloadParallelism:YqA};for(let B=0;B<A.length;B+=1){let I=A[B];if(I==="--help"||I==="-h")ftA(),process.exit(0);if(I==="--version"||I==="-v")utA(),process.exit(0);if(I==="--output"||I==="-o"){let D=A[B+1];if(!D)throw Error("Missing value for --output.");Q.outputDir=D,B+=1;continue}if(I==="--parallel"||I==="-p"){let D=A[B+1];if(!D)throw Error("Missing value for --parallel.");Q.downloadParallelism=ctA(D,"--parallel"),B+=1;continue}if(I==="--format"||I==="-f"){let D=A[B+1];if(!D)throw Error("Missing value for --format.");Q.audioFormat=ltA(D,"--format"),B+=1;continue}if(I==="--bitrate"||I==="-b"){let D=A[B+1];if(!D)throw Error("Missing value for --bitrate.");Q.audioQuality=dtA(ptA(D),"--bitrate"),B+=1;continue}if(!Q.url){Q.url=I;continue}throw Error(`Unexpected argument: ${I}`)}return Q}function ftA(){process.stdout.write(`mdl (MusicDownLoader)
|
|
393
393
|
|
|
394
394
|
Interactive playlist and album downloader for streaming collections -> YouTube audio.
|
|
395
395
|
|
|
@@ -521,7 +521,7 @@ ${JIA(A,Q.key_info)}`);break;default:sB.warn(Q$,"Unreachable code reached at Par
|
|
|
521
521
|
}
|
|
522
522
|
|
|
523
523
|
return process("${A||""}", "${Q||""}", "${B||""}");`}import iwA from"crypto";import P_ from"path";import qIQ from"os";import F$ from"fs/promises";class Ll extends Event{#A;constructor(A,Q){super(A,Q);this.#A=Q?.detail??null}get detail(){return this.#A}}import{fileURLToPath as OIQ}from"url";function OIA(A,Q){throw Error("To decipher URLs, you must provide your own JavaScript evaluator. See https://ytjs.dev/guide/getting-started.html#providing-a-custom-javascript-interpreter for more details.")}class W_{session;constructor(A){this.session=A}async stats(A,Q,B){let I=new URL(A);I.searchParams.set("ver","2"),I.searchParams.set("c",Q.client_name.toLowerCase()),I.searchParams.set("cbrver",Q.client_version),I.searchParams.set("cver",Q.client_version);for(let D of Object.keys(B))I.searchParams.set(D,B[D]);return await this.session.http.fetch(I)}async execute(A,Q){let B;if(Q&&!Q.protobuf){if(B={...Q},Reflect.has(B,"browseId")&&!Q.skip_auth_check){if(this.#Q(B.browseId)&&!this.session.logged_in)throw new s("You must be signed in to perform this operation.")}if(Reflect.has(B,"skip_auth_check"))delete B.skip_auth_check;if(Reflect.has(B,"override_endpoint"))delete B.override_endpoint;if(Reflect.has(B,"parse"))delete B.parse;if(Reflect.has(B,"request"))delete B.request;if(Reflect.has(B,"clientActions"))delete B.clientActions;if(Reflect.has(B,"settingItemIdForClient"))delete B.settingItemIdForClient;if(Reflect.has(B,"action"))B.actions=[B.action],delete B.action;if(Reflect.has(B,"boolValue"))B.newValue={boolValue:B.boolValue},delete B.boolValue;if(Reflect.has(B,"token"))B.continuation=B.token,delete B.token;if(B?.client==="YTMUSIC")B.isAudioOnly=!0}else if(Q)B=Q.serialized_data;let I=Reflect.has(Q||{},"override_endpoint")?Q?.override_endpoint:A,D=await this.session.http.fetch(I,{method:"POST",body:Q?.protobuf?B:JSON.stringify(B||{}),headers:{"Content-Type":Q?.protobuf?"application/x-protobuf":"application/json"}});if(Q?.parse){let C=N.parseResponse(await D.json());if(this.#A(C)&&C.on_response_received_actions?.[0]?.type==="navigateAction"){let G=C.on_response_received_actions.firstOfType(eU);if(G)C=await G.endpoint.call(this,{parse:!0})}return C}return{success:D.ok,status_code:D.status,data:await D.json()}}#A(A){return"on_response_received_actions"in A}#Q(A){return["FElibrary","FEhistory","FEsubscriptions","FEchannels","FEplaylist_aggregation","FEmusic_listening_review","FEmusic_library_landing","SPaccount_overview","SPaccount_notifications","SPaccount_privacy","SPtime_watched"].includes(A)}}var z_="OAuth2";class q_{#A;YTTV_URL;AUTH_SERVER_CODE_URL;AUTH_SERVER_TOKEN_URL;AUTH_SERVER_REVOKE_TOKEN_URL;client_id;oauth2_tokens;constructor(A){this.#A=A,this.YTTV_URL=new URL("/tv",RI.URLS.YT_BASE),this.AUTH_SERVER_CODE_URL=new URL("/o/oauth2/device/code",RI.URLS.YT_BASE),this.AUTH_SERVER_TOKEN_URL=new URL("/o/oauth2/token",RI.URLS.YT_BASE),this.AUTH_SERVER_REVOKE_TOKEN_URL=new URL("/o/oauth2/revoke",RI.URLS.YT_BASE)}async init(A){if(A){if(this.setTokens(A),this.shouldRefreshToken())await this.refreshAccessToken();this.#A.emit("auth",{credentials:this.oauth2_tokens});return}if(await this.#Q()){sB.info(z_,"Loaded OAuth2 tokens from cache.",this.oauth2_tokens);return}if(!this.client_id)this.client_id=await this.getClientID();let B=await this.getDeviceAndUserCode();this.#A.emit("auth-pending",B),this.pollForAccessToken(B)}setTokens(A){let Q=A;if(Q.expires_in)Q.expiry_date=new Date(Date.now()+Q.expires_in*1000).toISOString(),delete Q.expires_in;if(!this.validateTokens(Q))throw new U2("Invalid tokens provided.");if(this.oauth2_tokens=Q,Q.client)sB.info(z_,"Using provided client id and secret."),this.client_id=Q.client}async cacheCredentials(){let Q=new TextEncoder().encode(JSON.stringify(this.oauth2_tokens));await this.#A.cache?.set("youtubei_oauth_credentials",Q.buffer)}async#Q(){let A=await this.#A.cache?.get("youtubei_oauth_credentials");if(!A)return!1;let B=JSON.parse(new TextDecoder().decode(A));return this.setTokens(B),this.#A.emit("auth",{credentials:B}),!0}async removeCache(){await this.#A.cache?.remove("youtubei_oauth_credentials")}pollForAccessToken(A){if(!this.client_id)throw new U2("Client ID is missing.");let{device_code:Q,interval:B}=A,{client_id:I,client_secret:D}=this.client_id,C={client_id:I,client_secret:D,code:Q,grant_type:"http://oauth.net/grant_type/device/1.0"},G=setInterval(async()=>{let Z=await(await this.#B.fetch_function(this.AUTH_SERVER_TOKEN_URL,{body:JSON.stringify(C),method:"POST",headers:{"Content-Type":"application/json"}})).json();if(Z.error){switch(Z.error){case"access_denied":this.#A.emit("auth-error",new U2("Access was denied.",Z)),clearInterval(G);break;case"expired_token":this.#A.emit("auth-error",new U2("The device code has expired.",Z)),clearInterval(G);break;case"authorization_pending":case"slow_down":sB.info(z_,"Polling for access token...");break;default:this.#A.emit("auth-error",new U2("Server returned an unexpected error.",Z)),clearInterval(G);break}return}this.setTokens(Z),this.#A.emit("auth",{credentials:this.oauth2_tokens}),clearInterval(G)},B*1000)}async revokeCredentials(){if(!this.oauth2_tokens)throw new U2("Access token not found");await this.removeCache();let A=this.AUTH_SERVER_REVOKE_TOKEN_URL;return A.searchParams.set("token",this.oauth2_tokens.access_token),this.#A.http.fetch_function(A,{method:"POST"})}async refreshAccessToken(){if(!this.client_id)this.client_id=await this.getClientID();if(!this.oauth2_tokens)throw new U2("No tokens available to refresh.");let{client_id:A,client_secret:Q}=this.client_id,{refresh_token:B}=this.oauth2_tokens,I={client_id:A,client_secret:Q,refresh_token:B,grant_type:"refresh_token"},D=await this.#B.fetch_function(this.AUTH_SERVER_TOKEN_URL,{body:JSON.stringify(I),method:"POST",headers:{"Content-Type":"application/json"}});if(!D.ok)throw new U2(`Failed to refresh access token: ${D.status}`);let C=await D.json();if(C.error_code)throw new U2("Authorization server returned an error",C);this.oauth2_tokens.access_token=C.access_token,this.oauth2_tokens.expiry_date=new Date(Date.now()+C.expires_in*1000).toISOString(),this.#A.emit("update-credentials",{credentials:this.oauth2_tokens})}async getDeviceAndUserCode(){if(!this.client_id)throw new U2("Client ID is missing.");let{client_id:A}=this.client_id,Q={client_id:A,scope:"http://gdata.youtube.com https://www.googleapis.com/auth/youtube-paid-content",device_id:uI.shim.uuidv4(),device_model:"ytlr::"},B=await this.#B.fetch_function(this.AUTH_SERVER_CODE_URL,{body:JSON.stringify(Q),method:"POST",headers:{"Content-Type":"application/json"}});if(!B.ok)throw new U2(`Failed to get device/user code: ${B.status}`);let I=await B.json();if(I.error_code)throw new U2("Authorization server returned an error",I);return I}async getClientID(){let A=await this.#B.fetch_function(this.YTTV_URL,{headers:{"User-Agent":"Mozilla/5.0 (ChromiumStylePlatform) Cobalt/Version",Referer:"https://www.youtube.com/tv","Accept-Language":"en-US"}});if(!A.ok)throw new U2(`Failed to get client ID: ${A.status}`);let Q=await A.text(),B;if((B=RI.OAUTH.REGEX.TV_SCRIPT.exec(Q))!==null){sB.info(z_,`Got YouTubeTV script URL (${B[1]})`);let I=await this.#B.fetch(B[1],{baseURL:RI.URLS.YT_BASE});if(!I.ok)throw new U2(`TV script request failed with status code ${I.status}`);let C=(await I.text()).match(RI.OAUTH.REGEX.CLIENT_IDENTITY);if(!C||!C.groups)throw new U2("Could not obtain client ID.");let{client_id:G,client_secret:H}=C.groups;return sB.info(z_,`Client identity retrieved (clientId=${G}, clientSecret=${H}).`),{client_id:G,client_secret:H}}throw new U2("Could not obtain script URL.")}shouldRefreshToken(){if(!this.oauth2_tokens)return!1;return Date.now()>new Date(this.oauth2_tokens.expiry_date).getTime()}validateTokens(A){return!(!A.access_token||!A.refresh_token||!A.expiry_date)}get#B(){return this.#A.http}}var B9="Player";class A7{player_id;signature_timestamp;data;po_token;constructor(A,Q,B){this.player_id=A,this.signature_timestamp=Q,this.data=B}static async create(A,Q=uI.shim.fetch,B,I){if(!I){let _=new URL("/iframe_api",RI.URLS.YT_BASE),x=await Q(_);if(!x.ok)throw new eF(`Failed to get player id: ${x.status} (${x.statusText})`);let l=await x.text();I=n3(l,"player\\/","\\/")}if(sB.info(B9,`Using player id (${I}). Checking for cached players..`),!I)throw new eF("Failed to get player id");if(A){let _=await A7.fromCache(A,I);if(_)return sB.info(B9,"Found up-to-date player data in cache."),_.po_token=B,_}let D=new URL(`/s/player/${I}/player_es6.vflset/en_US/base.js`,RI.URLS.YT_BASE);sB.info(B9,`Could not find any cached player. Will download a new player from ${D}.`);let C=await Q(D,{headers:{"user-agent":Rl("desktop")}});if(!C.ok)throw new eF(`Failed to get player data: ${C.status}`);let G=await C.text(),H="nsigFunction",Z="signatureTimestampVar",O=new Om(G,{extractions:[{friendlyName:H,match:xOA},{friendlyName:Z,match:hOA,collectDependencies:!1}]}),L=new Vm(O).buildScript({disallowSideEffectInitializers:!0,exportRawValues:!0,rawValueOnly:[Z]});if(L.exportedRawValues&&!(Z in L.exportedRawValues))sB.warn(B9,"Failed to extract signature timestamp.");if(!L.exported.includes(H))sB.warn(B9,"Failed to extract n/sig decipher function.");let P=L.exportedRawValues?.[Z],k=await A7.fromSource(I,{cache:A,signature_timestamp:parseInt(P)||0,data:L});return k.po_token=B,k}async decipher(A,Q,B,I){if(A=A||Q||B,!A)throw new eF("No valid URL to decipher");let D=new URLSearchParams(A),C=new URL(D.get("url")||A),G=C.searchParams.get("n"),H=D.get("s"),Z=D.get("sp");if(this.data&&(Q||B||G)){let w={};if(Q||B)w.sig=H,w.sp=Z;if(G)if(I?.has(G)){let L=I.get(G);C.searchParams.set("n",L)}else w.n=G;if(Object.keys(w).length>0){let L={...this.data};L.output=`${L.output}
|
|
524
|
-
${BwA(w.n,w.sp,w.sig)}`;let P=await uI.shim.eval(L,w);if(typeof P!=="object"||P===null)throw new eF("Got invalid result from player script evaluation.");if(typeof w.sig==="string"){let k=P.sig;if(sB.info(B9,`Transformed signature from ${H} to ${k}.`),typeof k!=="string")throw new eF("Got invalid signature from player script evaluation.");if(Z)C.searchParams.set(Z,k);else C.searchParams.set("signature",k)}if(typeof w.n==="string"){let k=P.n;if(sB.info(B9,`Transformed n from ${G} to ${k}.`),typeof k!=="string")throw new eF("Failed to decipher nsig");if(k.startsWith("enhanced_except_"))sB.warn(B9,`Decipher script returned an error (n=${G}):`,k);else if(I)I.set(G,k);C.searchParams.set("n",k)}}}if(C.searchParams.get("sabr")!=="1"&&this.po_token)C.searchParams.set("pot",this.po_token);switch(C.searchParams.get("c")){case"WEB":C.searchParams.set("cver",RI.CLIENTS.WEB.VERSION);break;case"MWEB":C.searchParams.set("cver",RI.CLIENTS.MWEB.VERSION);break;case"WEB_REMIX":C.searchParams.set("cver",RI.CLIENTS.YTMUSIC.VERSION);break;case"WEB_KIDS":C.searchParams.set("cver",RI.CLIENTS.WEB_KIDS.VERSION);break;case"TVHTML5":C.searchParams.set("cver",RI.CLIENTS.TV.VERSION);break;case"TVHTML5_SIMPLY":C.searchParams.set("cver",RI.CLIENTS.TV_SIMPLY.VERSION);break;case"TVHTML5_SIMPLY_EMBEDDED_PLAYER":C.searchParams.set("cver",RI.CLIENTS.TV_EMBEDDED.VERSION);break;case"WEB_EMBEDDED_PLAYER":C.searchParams.set("cver",RI.CLIENTS.WEB_EMBEDDED.VERSION);break}let O=C.toString();return sB.info(B9,`Deciphered URL: ${O}`),C.toString()}static async fromCache(A,Q){let B=await A.get(Q);if(!B)return null;try{let I=L5.deserialize(new Uint8Array(B));if(I.libraryVersion!==A8.version)return sB.warn(B9,`Cached player data is from a different library version (${I.libraryVersion}). Ignoring it.`),null;return new A7(I.playerId,I.signatureTimestamp,I.data)}catch(I){return sB.error(B9,"Failed to deserialize player data from cache:",I),null}}static async fromSource(A,Q){let B=new A7(A,Q.signature_timestamp,Q.data);return await B.cache(Q.cache),B}async cache(A){if(!A||!this.data)return;let Q=L5.serialize({playerId:this.player_id,signatureTimestamp:this.signature_timestamp,libraryVersion:A8.version,data:this.data});await A.set(this.player_id,Q)}get url(){return new URL(`/s/player/${this.player_id}/player_ias.vflset/en_US/base.js`,RI.URLS.YT_BASE).toString()}static get LIBRARY_VERSION(){return 14}}var $BQ={WEB:"WEB",MWEB:"MWEB",KIDS:"WEB_KIDS",MUSIC:"WEB_REMIX",IOS:"iOS",ANDROID:"ANDROID",ANDROID_VR:"ANDROID_VR",ANDROID_MUSIC:"ANDROID_MUSIC",ANDROID_CREATOR:"ANDROID_CREATOR",TV:"TVHTML5",TV_SIMPLY:"TVHTML5_SIMPLY",TV_EMBEDDED:"TVHTML5_SIMPLY_EMBEDDED_PLAYER",WEB_EMBEDDED:"WEB_EMBEDDED_PLAYER",WEB_CREATOR:"WEB_CREATOR"},hG="Session";class G$ extends hU{context;api_key;api_version;account_index;config_data;player;cookie;cache;po_token;oauth;http;logged_in;actions;user_agent;constructor(A,Q,B,I,D,C,G,H,Z,U){super();this.context=A,this.api_key=Q,this.api_version=B,this.account_index=I,this.config_data=D,this.player=C,this.cookie=G,this.cache=Z,this.po_token=U,this.http=new vT(this,G,H),this.actions=new W_(this),this.oauth=new q_(this),this.logged_in=!!G,this.user_agent=A.client.userAgent}on(A,Q){super.on(A,Q)}once(A,Q){super.once(A,Q)}static async create(A={}){let{context:Q,api_key:B,api_version:I,account_index:D,config_data:C}=await G$.getSessionData(A.lang,A.location,A.account_index,A.visitor_data,A.user_agent,A.enable_safety_mode,A.generate_session_locally,A.fail_fast,A.device_category,A.client_type,A.timezone,A.fetch,A.on_behalf_of_user,A.cache,A.enable_session_cache,A.po_token,A.retrieve_innertube_config);return new G$(Q,B,I,D,C,A.retrieve_player===!1?void 0:await A7.create(A.cache,A.fetch,A.po_token,A.player_id),A.cookie,A.fetch,A.cache,A.po_token)}static async fromCache(A,Q){let B=await A.get("innertube_session_data");if(!B)return null;try{let I=L5.deserialize(new Uint8Array(B));if(I.library_version!==parseInt(A8.version.split(".",1)[0]))return sB.warn(hG,`Cached session data is from a different library version (${I.library_version}). Regenerating session data.`),null;if(Q.visitor_data)I.context.client.visitorData=Q.visitor_data;if(Q.lang)I.context.client.hl=Q.lang;if(Q.location)I.context.client.gl=Q.location;if(Q.on_behalf_of_user)I.context.user.onBehalfOfUser=Q.on_behalf_of_user;if(Q.user_agent)I.context.client.userAgent=Q.user_agent;if(Q.client_name){let D=Object.values(fB).find((C)=>C.NAME===Q.client_name);if(D)I.context.client.clientName=D.NAME,I.context.client.clientVersion=D.VERSION;else sB.warn(hG,`Unknown client name: ${Q.client_name}.`)}return I.context.client.timeZone=Q.time_zone,I.context.client.platform=Q.device_category.toUpperCase(),I.context.user.enableSafetyMode=Q.enable_safety_mode,I}catch(I){return sB.error(hG,"Failed to deserialize session data from cache.",I),null}}static async getSessionData(A="",Q="",B=0,I="",D=Rl("desktop"),C=!1,G=!1,H=!1,Z="desktop",U=$BQ.WEB,O=Intl.DateTimeFormat().resolvedOptions().timeZone,w=uI.shim.fetch,L,P,k=!0,_,x=!0){let l={lang:A,location:Q,time_zone:O,user_agent:D,device_category:Z,client_name:U,enable_safety_mode:C,visitor_data:I,on_behalf_of_user:L,po_token:_},GA;if(P&&k){let o=await this.fromCache(P,l);if(o)sB.info(hG,"Found session data in cache."),GA=o}if(!GA){sB.info(hG,"Generating session data.");let o=fB.WEB.API_KEY,BA=fB.WEB.API_VERSION,JA={hl:A||"en",gl:Q||"US",remote_host:"",user_agent:D,visitor_data:I||mU.encodeVisitorData(yJ(11),Math.floor(Date.now()/1000)),client_name:U,client_version:Object.values(fB).find((XA)=>XA.NAME===U)?.VERSION??fB.WEB.VERSION,device_category:Z.toUpperCase(),os_name:"Windows",os_version:"10.0",time_zone:O,browser_name:"Chrome",browser_version:"125.0.0.0",device_make:"",device_model:"",enable_safety_mode:C};if(!G)try{let XA=await this.#Q(l,w);o=XA.api_key,BA=XA.api_version,JA=XA.context_data}catch(XA){if(H)throw XA;sB.error(hG,"Failed to retrieve session data from server. Session data generated locally will be used instead.",XA)}if(L)JA.on_behalf_of_user=L;if(GA={api_key:o,api_version:BA,context:this.#B(JA)},x)try{sB.info(hG,"Retrieving InnerTube config data.");let XA={"Accept-Language":A,Accept:"*/*",Referer:NC.YT_BASE,"X-Goog-Visitor-Id":JA.visitor_data,"X-Origin":NC.YT_BASE,"X-Youtube-Client-Version":JA.client_version};if(uI.shim.server)XA["User-Agent"]=D,XA.Origin=NC.YT_BASE;let OA=await(await w(`${NC.API.PRODUCTION_1}v1/config?prettyPrint=false`,{headers:XA,method:"POST",body:JSON.stringify({context:GA.context})})).json(),fA=OA.responseContext?.globalConfigGroup?.rawColdConfigGroup?.configData,RA=OA.responseContext?.globalConfigGroup?.coldHashData,LA=OA.responseContext?.globalConfigGroup?.hotHashData;GA.config_data=OA.configData,GA.context.client.configInfo={...GA.context.client.configInfo,coldConfigData:fA,coldHashData:RA,hotHashData:LA}}catch(XA){sB.error(hG,"Failed to retrieve config data.",XA)}if(k)await this.#A(GA,P)}return sB.debug(hG,"Session data:",GA),{...GA,account_index:B}}static async#A(A,Q){if(!Q)return;sB.info(hG,"Compressing and caching session data.");let B=L5.serialize({...A,library_version:parseInt(A8.version)});await Q.set("innertube_session_data",B)}static async#Q(A,Q=uI.shim.fetch){let B=yJ(11);if(A.visitor_data)B=this.#I(A.visitor_data);let I=new URL("/sw.js_data",NC.YT_BASE),D=await Q(I,{headers:{"Accept-Language":A.lang||"en-US","User-Agent":A.user_agent,Accept:"*/*",Referer:`${NC.YT_BASE}/sw.js`,Cookie:`PREF=tz=${A.time_zone.replace("/",".")};VISITOR_INFO1_LIVE=${B};`}});if(!D.ok)throw new Nl(`Failed to retrieve session data: ${D.status}`);let C=await D.text();if(!C.startsWith(")]}'"))throw new Nl("Invalid JSPB response");let H=JSON.parse(C.replace(/^\)\]\}'/,""))[0][2],Z=fB.WEB.API_VERSION,[[U],O]=H,w=U[61],L=w[w.length-1];return{context_data:{hl:A.lang||U[0],gl:A.location||U[1],remote_host:U[3],visitor_data:A.visitor_data||U[13],user_agent:A.user_agent,client_name:A.client_name,client_version:A.client_name==="WEB"?U[16]:Object.values(fB).find((k)=>k.NAME===A.client_name)?.VERSION||U[16],os_name:U[17],os_version:U[18],time_zone:U[79]||A.time_zone,device_category:A.device_category,browser_name:U[86],browser_version:U[87],device_make:U[11],device_model:U[12],app_install_data:L,device_experiment_id:U[103],rollout_token:U[107],enable_safety_mode:A.enable_safety_mode},api_key:O,api_version:Z}}static#B(A){let Q={client:{hl:A.hl||"en",gl:A.gl||"US",remoteHost:A.remote_host,screenDensityFloat:1,screenHeightPoints:1440,screenPixelDensity:1,screenWidthPoints:2560,visitorData:A.visitor_data,clientName:A.client_name,clientVersion:A.client_version,osName:A.os_name,osVersion:A.os_version,userAgent:A.user_agent,platform:A.device_category.toUpperCase(),clientFormFactor:"UNKNOWN_FORM_FACTOR",userInterfaceTheme:"USER_INTERFACE_THEME_LIGHT",timeZone:A.time_zone,originalUrl:NC.YT_BASE,deviceMake:A.device_make,deviceModel:A.device_model,browserName:A.browser_name,browserVersion:A.browser_version,utcOffsetMinutes:-Math.floor(new Date().getTimezoneOffset()),memoryTotalKbytes:"8000000",rolloutToken:A.rollout_token,deviceExperimentId:A.device_experiment_id,mainAppWebInfo:{graftUrl:NC.YT_BASE,pwaInstallabilityStatus:"PWA_INSTALLABILITY_STATUS_UNKNOWN",webDisplayMode:"WEB_DISPLAY_MODE_BROWSER",isWebNativeShareAvailable:!0}},user:{enableSafetyMode:A.enable_safety_mode,lockedSafetyMode:!1},request:{useSsl:!0,internalExperimentFlags:[]}};if(A.app_install_data)Q.client.configInfo={appInstallData:A.app_install_data};if(A.on_behalf_of_user)Q.user.onBehalfOfUser=A.on_behalf_of_user;return Q}static#I(A){return mU.decodeVisitorData(A).id}async signIn(A){return new Promise(async(Q,B)=>{let I=(D)=>B(D);this.once("auth-error",I),this.once("auth",()=>{this.off("auth-error",I),this.logged_in=!0,Q()});try{await this.oauth.init(A)}catch(D){B(D)}})}async signOut(){if(!this.logged_in)throw new s("You must be signed in to perform this operation.");let A=await this.oauth.revokeCredentials();return this.logged_in=!1,A}get client_version(){return this.context.client.clientVersion}get client_name(){return this.context.client.clientName}get lang(){return this.context.client.hl}}class O_{#A;constructor(A){this.#A=A}async search(A){let B=await new h({searchEndpoint:{query:A}}).call(this.#A.actions,{client:"YTKIDS"});return new U_(this.#A.actions,B)}async getInfo(A,Q){let B={videoId:A},I=new h({watchEndpoint:B}),D=new h({watchNextEndpoint:B}),C=this.#A,G={playbackContext:{contentPlaybackContext:{vis:0,splay:!1,lactMilliseconds:"-1",signatureTimestamp:C.player?.signature_timestamp}},client:"YTKIDS"};if(Q?.po_token)G.serviceIntegrityDimensions={poToken:Q.po_token};else if(C.po_token)G.serviceIntegrityDimensions={poToken:C.po_token};let H=I.call(C.actions,G),Z=D.call(C.actions,{client:"YTKIDS"}),U=await Promise.all([H,Z]),O=yJ(16);return new $_(U,C.actions,O)}async getChannel(A){let B=await new h({browseEndpoint:{browseId:A}}).call(this.#A.actions,{client:"YTKIDS"});return new _N(this.#A.actions,B)}async getHomeFeed(){let Q=await new h({browseEndpoint:{browseId:"FEkids_home"}}).call(this.#A.actions,{client:"YTKIDS"});return new kN(this.#A.actions,Q)}async blockChannel(A){let Q=this.#A;if(!Q.logged_in)throw new s("You must be signed in to perform this operation.");let C={contents:(await new h({getKidsBlocklistPickerCommand:{blockedForKidsContent:{external_channel_id:A}}}).call(Q.actions,{client:"YTKIDS"})).data.command.confirmDialogEndpoint.content,engagementPanels:[]},H=N.parseResponse(C).contents_memo?.getType(gX);if(!H)throw new s("Could not find any kids profiles or supervised accounts.");let Z=[];for(let U of H)if(!U.block_button?.is_toggled)U.setActions(Q.actions),Z.push(await U.blockChannel());return Z}}class V_{#A;#Q;constructor(A){this.#A=A,this.#Q=A.actions}getInfo(A,Q){if(A instanceof qX)return this.#I(A.endpoint,Q);else if(A instanceof D8)return this.#I(A.overlay?.content?.endpoint??A.endpoint,Q);else if(A instanceof h)return this.#I(A,Q);return this.#B(A,Q)}async#B(A,Q){let B={videoId:A,racyCheckOk:!0,contentCheckOk:!0},I=new h({watchEndpoint:B}),D=new h({watchNextEndpoint:B}),C={playbackContext:{contentPlaybackContext:{vis:0,splay:!1,lactMilliseconds:"-1",signatureTimestamp:this.#A.player?.signature_timestamp}},client:"YTMUSIC"};if(Q?.po_token)C.serviceIntegrityDimensions={poToken:Q.po_token};else if(this.#A.po_token)C.serviceIntegrityDimensions={poToken:this.#A.po_token};let G=I.call(this.#Q,C),H=D.call(this.#Q,{client:"YTMUSIC"}),Z=await Promise.all([G,H]),U=yJ(16);return new wl(Z,this.#Q,U)}async#I(A,Q){if(!A)throw Error("This item does not have an endpoint.");let B={playbackContext:{contentPlaybackContext:{vis:0,splay:!1,lactMilliseconds:"-1",signatureTimestamp:this.#A.player?.signature_timestamp}},client:"YTMUSIC"};if(Q?.po_token)B.serviceIntegrityDimensions={poToken:Q.po_token};else if(this.#A.po_token)B.serviceIntegrityDimensions={poToken:this.#A.po_token};let I=A.call(this.#Q,B),D=A.call(this.#Q,{client:"YTMUSIC",enablePersistentPlaylistPanel:!0,override_endpoint:"/next"}),C=yJ(16),G=await Promise.all([I,D]);return new wl(G,this.#Q,C)}async search(A,Q={}){UD({query:A});let B;if(Q.type&&Q.type!=="all"){let C=th.encode({filters:{musicSearchType:{[Q.type]:!0}}});B=encodeURIComponent(oC(C.finish()))}let D=await new h({searchEndpoint:{query:A,params:B}}).call(this.#Q,{client:"YTMUSIC"});return new J$(D,this.#Q,Reflect.has(Q,"type")&&Q.type!=="all")}async getHomeFeed(){let Q=await new h({browseEndpoint:{browseId:"FEmusic_home"}}).call(this.#Q,{client:"YTMUSIC"});return new C$(Q,this.#Q)}async getExplore(){let Q=await new h({browseEndpoint:{browseId:"FEmusic_explore"}}).call(this.#Q,{client:"YTMUSIC"});return new Z_(Q)}async getLibrary(){let Q=await new h({browseEndpoint:{browseId:"FEmusic_library_landing"}}).call(this.#Q,{client:"YTMUSIC"});return new TN(Q,this.#Q)}async getArtist(A){if(!A||!A.startsWith("UC")&&!A.startsWith("FEmusic_library_privately_owned_artist"))throw new s("Invalid artist id",A);let B=await new h({browseEndpoint:{browseId:A}}).call(this.#Q,{client:"YTMUSIC"});return new X_(B,this.#Q)}async getAlbum(A){if(!A||!A.startsWith("MPR")&&!A.startsWith("FEmusic_library_privately_owned_release"))throw new s("Invalid album id",A);let B=await new h({browseEndpoint:{browseId:A}}).call(this.#Q,{client:"YTMUSIC"});return new H_(B)}async getPlaylist(A){if(!A.startsWith("VL"))A=`VL${A}`;let B=await new h({browseEndpoint:{browseId:A}}).call(this.#Q,{client:"YTMUSIC"});return new mX(B,this.#Q)}async getUpNext(A,Q=!0){UD({video_id:A});let C=(await new h({watchNextEndpoint:{videoId:A}}).call(this.#Q,{client:"YTMUSIC",parse:!0})).contents_memo?.getType(nE)?.[0];if(!C)throw new s("Could not find target tab.");let G=C.content?.as(VX);if(!G||!G.content)throw new s("Music queue was empty, the given id is probably invalid.",G);let H=G.content.as(V4);if(!H.playlist_id&&Q){let Z=H.contents.firstOfType(zG);if(!Z)throw new s("Automix item not found");let U=await Z.playlist_video?.endpoint.call(this.#Q,{videoId:A,client:"YTMUSIC",parse:!0});if(!U||!U.contents_memo)throw new s("Could not fetch automix");return U.contents_memo.getType(V4)[0]}return H}async getRelated(A){UD({video_id:A});let D=(await new h({watchNextEndpoint:{videoId:A}}).call(this.#Q,{client:"YTMUSIC",parse:!0})).contents_memo?.getType(nE)?.find((G)=>G.endpoint.payload.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType==="MUSIC_PAGE_TYPE_TRACK_RELATED");if(!D)throw new s("Could not find target tab.");let C=await D.endpoint.call(this.#Q,{client:"YTMUSIC",parse:!0});if(!C.contents)throw new s("Unexpected response",C);return C.contents.item().as(WI,EC)}async getLyrics(A){UD({video_id:A});let D=(await new h({watchNextEndpoint:{videoId:A}}).call(this.#Q,{client:"YTMUSIC",parse:!0})).contents_memo?.getType(nE)?.find((H)=>H.endpoint.payload.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType==="MUSIC_PAGE_TYPE_TRACK_LYRICS");if(!D)throw new s("Could not find target tab.");let C=await D.endpoint.call(this.#Q,{client:"YTMUSIC",parse:!0});if(!C.contents)throw new s("Unexpected response",C);if(C.contents.item().type==="Message")throw new s(C.contents.item().as(EC).text.toString(),A);return C.contents.item().as(WI).contents.firstOfType(SG)}async getRecap(){let Q=await new h({browseEndpoint:{browseId:"FEmusic_listening_review"}}).call(this.#Q,{client:"YTMUSIC"});return new K_(Q,this.#Q)}async getSearchSuggestions(A){let Q=await this.#Q.execute("/music/get_search_suggestions",{input:A,client:"YTMUSIC",parse:!0});if(!Q.contents_memo)return[];return Q.contents_memo.getType(BN)}}function YBQ(){return{profile:void 0,supportedCapabilities:[],disabledCapabilities:[],snapshot:void 0}}var VIA={encode(A,Q=new wQ){if(A.profile!==void 0)Q.uint32(10).string(A.profile);for(let B of A.supportedCapabilities)Ml.encode(B,Q.uint32(18).fork()).join();for(let B of A.disabledCapabilities)Ml.encode(B,Q.uint32(26).fork()).join();if(A.snapshot!==void 0)Q.uint32(42).string(A.snapshot);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=YBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.profile=B.string();continue}case 2:{if(C!==18)break;D.supportedCapabilities.push(Ml.decode(B,B.uint32()));continue}case 3:{if(C!==26)break;D.disabledCapabilities.push(Ml.decode(B,B.uint32()));continue}case 5:{if(C!==42)break;D.snapshot=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function WBQ(){return{capability:void 0,features:void 0,experimentFlags:void 0}}var Ml={encode(A,Q=new wQ){if(A.capability!==void 0)Q.uint32(8).uint32(A.capability);if(A.features!==void 0)Q.uint32(16).uint32(A.features);if(A.experimentFlags!==void 0)Q.uint32(50).string(A.experimentFlags);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=WBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.capability=B.uint32();continue}case 2:{if(C!==16)break;D.features=B.uint32();continue}case 6:{if(C!==50)break;D.experimentFlags=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function zBQ(){return{hl:void 0,gl:void 0,remoteHost:void 0,deviceId:void 0,debugDeviceIdOverride:void 0,carrierGeo:void 0,crackedHl:void 0,deviceMake:void 0,deviceModel:void 0,visitorData:void 0,userAgent:void 0,clientName:void 0,clientVersion:void 0,osName:void 0,osVersion:void 0,projectId:void 0,acceptLanguage:void 0,acceptRegion:void 0,originalUrl:void 0,rawDeviceId:void 0,configData:void 0,spacecastToken:void 0,internalGeo:void 0,screenWidthPoints:void 0,screenHeightPoints:void 0,screenWidthInches:void 0,screenHeightInches:void 0,screenPixelDensity:void 0,platform:void 0,spacecastClientInfo:void 0,clientFormFactor:void 0,forwardedFor:void 0,mobileDataPlanInfo:void 0,gmscoreVersionCode:void 0,webpSupport:void 0,cameraType:void 0,experimentsToken:void 0,windowWidthPoints:void 0,windowHeightPoints:void 0,configInfo:void 0,unpluggedLocationInfo:void 0,androidSdkVersion:void 0,screenDensityFloat:void 0,firstTimeSignInExperimentIds:void 0,utcOffsetMinutes:void 0,animatedWebpSupport:void 0,kidsAppInfo:void 0,musicAppInfo:void 0,tvAppInfo:void 0,internalGeoIp:void 0,unpluggedAppInfo:void 0,locationInfo:void 0,contentSizeCategory:void 0,fontScale:void 0,userInterfaceTheme:void 0,timeZone:void 0,homeGroupInfo:void 0,emlTemplateContext:void 0,coldAppBundleConfigData:void 0,browserName:void 0,browserVersion:void 0,locationPlayabilityToken:void 0,chipset:void 0,firmwareVersion:void 0,memoryTotalKbytes:void 0,mainAppWebInfo:void 0,notificationPermissionInfo:void 0,deviceBrand:void 0,glDeviceInfo:void 0}}var w_={encode(A,Q=new wQ){if(A.hl!==void 0)Q.uint32(10).string(A.hl);if(A.gl!==void 0)Q.uint32(18).string(A.gl);if(A.remoteHost!==void 0)Q.uint32(34).string(A.remoteHost);if(A.deviceId!==void 0)Q.uint32(50).string(A.deviceId);if(A.debugDeviceIdOverride!==void 0)Q.uint32(66).string(A.debugDeviceIdOverride);if(A.carrierGeo!==void 0)Q.uint32(82).string(A.carrierGeo);if(A.crackedHl!==void 0)Q.uint32(88).bool(A.crackedHl);if(A.deviceMake!==void 0)Q.uint32(98).string(A.deviceMake);if(A.deviceModel!==void 0)Q.uint32(106).string(A.deviceModel);if(A.visitorData!==void 0)Q.uint32(114).string(A.visitorData);if(A.userAgent!==void 0)Q.uint32(122).string(A.userAgent);if(A.clientName!==void 0)Q.uint32(128).int32(A.clientName);if(A.clientVersion!==void 0)Q.uint32(138).string(A.clientVersion);if(A.osName!==void 0)Q.uint32(146).string(A.osName);if(A.osVersion!==void 0)Q.uint32(154).string(A.osVersion);if(A.projectId!==void 0)Q.uint32(162).string(A.projectId);if(A.acceptLanguage!==void 0)Q.uint32(170).string(A.acceptLanguage);if(A.acceptRegion!==void 0)Q.uint32(178).string(A.acceptRegion);if(A.originalUrl!==void 0)Q.uint32(186).string(A.originalUrl);if(A.rawDeviceId!==void 0)Q.uint32(202).string(A.rawDeviceId);if(A.configData!==void 0)Q.uint32(218).string(A.configData);if(A.spacecastToken!==void 0)Q.uint32(250).string(A.spacecastToken);if(A.internalGeo!==void 0)Q.uint32(274).string(A.internalGeo);if(A.screenWidthPoints!==void 0)Q.uint32(296).int32(A.screenWidthPoints);if(A.screenHeightPoints!==void 0)Q.uint32(304).int32(A.screenHeightPoints);if(A.screenWidthInches!==void 0)Q.uint32(317).float(A.screenWidthInches);if(A.screenHeightInches!==void 0)Q.uint32(325).float(A.screenHeightInches);if(A.screenPixelDensity!==void 0)Q.uint32(328).int32(A.screenPixelDensity);if(A.platform!==void 0)Q.uint32(336).int32(A.platform);if(A.spacecastClientInfo!==void 0)CwA.encode(A.spacecastClientInfo,Q.uint32(362).fork()).join();if(A.clientFormFactor!==void 0)Q.uint32(368).int32(A.clientFormFactor);if(A.forwardedFor!==void 0)Q.uint32(386).string(A.forwardedFor);if(A.mobileDataPlanInfo!==void 0)GwA.encode(A.mobileDataPlanInfo,Q.uint32(394).fork()).join();if(A.gmscoreVersionCode!==void 0)Q.uint32(400).int32(A.gmscoreVersionCode);if(A.webpSupport!==void 0)Q.uint32(408).bool(A.webpSupport);if(A.cameraType!==void 0)Q.uint32(416).int32(A.cameraType);if(A.experimentsToken!==void 0)Q.uint32(434).string(A.experimentsToken);if(A.windowWidthPoints!==void 0)Q.uint32(440).int32(A.windowWidthPoints);if(A.windowHeightPoints!==void 0)Q.uint32(448).int32(A.windowHeightPoints);if(A.configInfo!==void 0)FwA.encode(A.configInfo,Q.uint32(498).fork()).join();if(A.unpluggedLocationInfo!==void 0)HwA.encode(A.unpluggedLocationInfo,Q.uint32(506).fork()).join();if(A.androidSdkVersion!==void 0)Q.uint32(512).int32(A.androidSdkVersion);if(A.screenDensityFloat!==void 0)Q.uint32(525).float(A.screenDensityFloat);if(A.firstTimeSignInExperimentIds!==void 0)Q.uint32(528).int32(A.firstTimeSignInExperimentIds);if(A.utcOffsetMinutes!==void 0)Q.uint32(536).int32(A.utcOffsetMinutes);if(A.animatedWebpSupport!==void 0)Q.uint32(544).bool(A.animatedWebpSupport);if(A.kidsAppInfo!==void 0)XwA.encode(A.kidsAppInfo,Q.uint32(554).fork()).join();if(A.musicAppInfo!==void 0)$wA.encode(A.musicAppInfo,Q.uint32(562).fork()).join();if(A.tvAppInfo!==void 0)YwA.encode(A.tvAppInfo,Q.uint32(570).fork()).join();if(A.internalGeoIp!==void 0)Q.uint32(578).string(A.internalGeoIp);if(A.unpluggedAppInfo!==void 0)zwA.encode(A.unpluggedAppInfo,Q.uint32(586).fork()).join();if(A.locationInfo!==void 0)qwA.encode(A.locationInfo,Q.uint32(594).fork()).join();if(A.contentSizeCategory!==void 0)Q.uint32(610).string(A.contentSizeCategory);if(A.fontScale!==void 0)Q.uint32(621).float(A.fontScale);if(A.userInterfaceTheme!==void 0)Q.uint32(624).int32(A.userInterfaceTheme);if(A.timeZone!==void 0)Q.uint32(642).string(A.timeZone);if(A.homeGroupInfo!==void 0)VwA.encode(A.homeGroupInfo,Q.uint32(650).fork()).join();if(A.emlTemplateContext!==void 0)Q.uint32(674).bytes(A.emlTemplateContext);if(A.coldAppBundleConfigData!==void 0)Q.uint32(682).bytes(A.coldAppBundleConfigData);if(A.browserName!==void 0)Q.uint32(698).string(A.browserName);if(A.browserVersion!==void 0)Q.uint32(706).string(A.browserVersion);if(A.locationPlayabilityToken!==void 0)Q.uint32(714).string(A.locationPlayabilityToken);if(A.chipset!==void 0)Q.uint32(738).string(A.chipset);if(A.firmwareVersion!==void 0)Q.uint32(746).string(A.firmwareVersion);if(A.memoryTotalKbytes!==void 0)Q.uint32(760).int64(A.memoryTotalKbytes);if(A.mainAppWebInfo!==void 0)IwA.encode(A.mainAppWebInfo,Q.uint32(770).fork()).join();if(A.notificationPermissionInfo!==void 0)DwA.encode(A.notificationPermissionInfo,Q.uint32(778).fork()).join();if(A.deviceBrand!==void 0)Q.uint32(786).string(A.deviceBrand);if(A.glDeviceInfo!==void 0)EwA.encode(A.glDeviceInfo,Q.uint32(818).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=zBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.hl=B.string();continue}case 2:{if(C!==18)break;D.gl=B.string();continue}case 4:{if(C!==34)break;D.remoteHost=B.string();continue}case 6:{if(C!==50)break;D.deviceId=B.string();continue}case 8:{if(C!==66)break;D.debugDeviceIdOverride=B.string();continue}case 10:{if(C!==82)break;D.carrierGeo=B.string();continue}case 11:{if(C!==88)break;D.crackedHl=B.bool();continue}case 12:{if(C!==98)break;D.deviceMake=B.string();continue}case 13:{if(C!==106)break;D.deviceModel=B.string();continue}case 14:{if(C!==114)break;D.visitorData=B.string();continue}case 15:{if(C!==122)break;D.userAgent=B.string();continue}case 16:{if(C!==128)break;D.clientName=B.int32();continue}case 17:{if(C!==138)break;D.clientVersion=B.string();continue}case 18:{if(C!==146)break;D.osName=B.string();continue}case 19:{if(C!==154)break;D.osVersion=B.string();continue}case 20:{if(C!==162)break;D.projectId=B.string();continue}case 21:{if(C!==170)break;D.acceptLanguage=B.string();continue}case 22:{if(C!==178)break;D.acceptRegion=B.string();continue}case 23:{if(C!==186)break;D.originalUrl=B.string();continue}case 25:{if(C!==202)break;D.rawDeviceId=B.string();continue}case 27:{if(C!==218)break;D.configData=B.string();continue}case 31:{if(C!==250)break;D.spacecastToken=B.string();continue}case 34:{if(C!==274)break;D.internalGeo=B.string();continue}case 37:{if(C!==296)break;D.screenWidthPoints=B.int32();continue}case 38:{if(C!==304)break;D.screenHeightPoints=B.int32();continue}case 39:{if(C!==317)break;D.screenWidthInches=B.float();continue}case 40:{if(C!==325)break;D.screenHeightInches=B.float();continue}case 41:{if(C!==328)break;D.screenPixelDensity=B.int32();continue}case 42:{if(C!==336)break;D.platform=B.int32();continue}case 45:{if(C!==362)break;D.spacecastClientInfo=CwA.decode(B,B.uint32());continue}case 46:{if(C!==368)break;D.clientFormFactor=B.int32();continue}case 48:{if(C!==386)break;D.forwardedFor=B.string();continue}case 49:{if(C!==394)break;D.mobileDataPlanInfo=GwA.decode(B,B.uint32());continue}case 50:{if(C!==400)break;D.gmscoreVersionCode=B.int32();continue}case 51:{if(C!==408)break;D.webpSupport=B.bool();continue}case 52:{if(C!==416)break;D.cameraType=B.int32();continue}case 54:{if(C!==434)break;D.experimentsToken=B.string();continue}case 55:{if(C!==440)break;D.windowWidthPoints=B.int32();continue}case 56:{if(C!==448)break;D.windowHeightPoints=B.int32();continue}case 62:{if(C!==498)break;D.configInfo=FwA.decode(B,B.uint32());continue}case 63:{if(C!==506)break;D.unpluggedLocationInfo=HwA.decode(B,B.uint32());continue}case 64:{if(C!==512)break;D.androidSdkVersion=B.int32();continue}case 65:{if(C!==525)break;D.screenDensityFloat=B.float();continue}case 66:{if(C!==528)break;D.firstTimeSignInExperimentIds=B.int32();continue}case 67:{if(C!==536)break;D.utcOffsetMinutes=B.int32();continue}case 68:{if(C!==544)break;D.animatedWebpSupport=B.bool();continue}case 69:{if(C!==554)break;D.kidsAppInfo=XwA.decode(B,B.uint32());continue}case 70:{if(C!==562)break;D.musicAppInfo=$wA.decode(B,B.uint32());continue}case 71:{if(C!==570)break;D.tvAppInfo=YwA.decode(B,B.uint32());continue}case 72:{if(C!==578)break;D.internalGeoIp=B.string();continue}case 73:{if(C!==586)break;D.unpluggedAppInfo=zwA.decode(B,B.uint32());continue}case 74:{if(C!==594)break;D.locationInfo=qwA.decode(B,B.uint32());continue}case 76:{if(C!==610)break;D.contentSizeCategory=B.string();continue}case 77:{if(C!==621)break;D.fontScale=B.float();continue}case 78:{if(C!==624)break;D.userInterfaceTheme=B.int32();continue}case 80:{if(C!==642)break;D.timeZone=B.string();continue}case 81:{if(C!==650)break;D.homeGroupInfo=VwA.decode(B,B.uint32());continue}case 84:{if(C!==674)break;D.emlTemplateContext=B.bytes();continue}case 85:{if(C!==682)break;D.coldAppBundleConfigData=B.bytes();continue}case 87:{if(C!==698)break;D.browserName=B.string();continue}case 88:{if(C!==706)break;D.browserVersion=B.string();continue}case 89:{if(C!==714)break;D.locationPlayabilityToken=B.string();continue}case 92:{if(C!==738)break;D.chipset=B.string();continue}case 93:{if(C!==746)break;D.firmwareVersion=B.string();continue}case 95:{if(C!==760)break;D.memoryTotalKbytes=Pl(B.int64());continue}case 96:{if(C!==770)break;D.mainAppWebInfo=IwA.decode(B,B.uint32());continue}case 97:{if(C!==778)break;D.notificationPermissionInfo=DwA.decode(B,B.uint32());continue}case 98:{if(C!==786)break;D.deviceBrand=B.string();continue}case 102:{if(C!==818)break;D.glDeviceInfo=EwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function qBQ(){return{graftUrl:void 0,pwaInstallabilityStatus:void 0,webDisplayMode:void 0,isWebNativeShareAvailable:void 0,storeDigitalGoodsApiSupportStatus:void 0}}var IwA={encode(A,Q=new wQ){if(A.graftUrl!==void 0)Q.uint32(10).string(A.graftUrl);if(A.pwaInstallabilityStatus!==void 0)Q.uint32(16).int32(A.pwaInstallabilityStatus);if(A.webDisplayMode!==void 0)Q.uint32(24).int32(A.webDisplayMode);if(A.isWebNativeShareAvailable!==void 0)Q.uint32(32).bool(A.isWebNativeShareAvailable);if(A.storeDigitalGoodsApiSupportStatus!==void 0)Q.uint32(40).int32(A.storeDigitalGoodsApiSupportStatus);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=qBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.graftUrl=B.string();continue}case 2:{if(C!==16)break;D.pwaInstallabilityStatus=B.int32();continue}case 3:{if(C!==24)break;D.webDisplayMode=B.int32();continue}case 4:{if(C!==32)break;D.isWebNativeShareAvailable=B.bool();continue}case 5:{if(C!==40)break;D.storeDigitalGoodsApiSupportStatus=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function OBQ(){return{notificationsSetting:void 0,lastDeviceOptInChangeTimeAgoSec:void 0}}var DwA={encode(A,Q=new wQ){if(A.notificationsSetting!==void 0)Q.uint32(8).int32(A.notificationsSetting);if(A.lastDeviceOptInChangeTimeAgoSec!==void 0)Q.uint32(16).int64(A.lastDeviceOptInChangeTimeAgoSec);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=OBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.notificationsSetting=B.int32();continue}case 2:{if(C!==16)break;D.lastDeviceOptInChangeTimeAgoSec=Pl(B.int64());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function VBQ(){return{glRenderer:void 0,glEsVersionMajor:void 0,glEsVersionMinor:void 0}}var EwA={encode(A,Q=new wQ){if(A.glRenderer!==void 0)Q.uint32(10).string(A.glRenderer);if(A.glEsVersionMajor!==void 0)Q.uint32(16).int32(A.glEsVersionMajor);if(A.glEsVersionMinor!==void 0)Q.uint32(24).int32(A.glEsVersionMinor);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=VBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.glRenderer=B.string();continue}case 2:{if(C!==16)break;D.glEsVersionMajor=B.int32();continue}case 3:{if(C!==24)break;D.glEsVersionMinor=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function wBQ(){return{appliances:void 0,interactionLevel:void 0}}var CwA={encode(A,Q=new wQ){if(A.appliances!==void 0)JwA.encode(A.appliances,Q.uint32(10).fork()).join();if(A.interactionLevel!==void 0)Q.uint32(16).int32(A.interactionLevel);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=wBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.appliances=JwA.decode(B,B.uint32());continue}case 2:{if(C!==16)break;D.interactionLevel=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function NBQ(){return{contentProfileToken:void 0,status:void 0,hostname:void 0,active:void 0,deviceId:void 0}}var JwA={encode(A,Q=new wQ){if(A.contentProfileToken!==void 0)Q.uint32(10).bytes(A.contentProfileToken);if(A.status!==void 0)Q.uint32(16).int32(A.status);if(A.hostname!==void 0)Q.uint32(26).string(A.hostname);if(A.active!==void 0)Q.uint32(32).bool(A.active);if(A.deviceId!==void 0)Q.uint32(42).string(A.deviceId);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=NBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.contentProfileToken=B.bytes();continue}case 2:{if(C!==16)break;D.status=B.int32();continue}case 3:{if(C!==26)break;D.hostname=B.string();continue}case 4:{if(C!==32)break;D.active=B.bool();continue}case 5:{if(C!==42)break;D.deviceId=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function RBQ(){return{cpid:void 0,serializedDataPlanStatus:void 0,dataSavingQualityPickerEnabled:void 0,mccmnc:void 0}}var GwA={encode(A,Q=new wQ){if(A.cpid!==void 0)Q.uint32(394).string(A.cpid);if(A.serializedDataPlanStatus!==void 0)Q.uint32(402).string(A.serializedDataPlanStatus);if(A.dataSavingQualityPickerEnabled!==void 0)Q.uint32(416).bool(A.dataSavingQualityPickerEnabled);if(A.mccmnc!==void 0)Q.uint32(426).string(A.mccmnc);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=RBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 49:{if(C!==394)break;D.cpid=B.string();continue}case 50:{if(C!==402)break;D.serializedDataPlanStatus=B.string();continue}case 52:{if(C!==416)break;D.dataSavingQualityPickerEnabled=B.bool();continue}case 53:{if(C!==426)break;D.mccmnc=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function LBQ(){return{coldConfigData:void 0,coldHashData:void 0,hotHashData:void 0,appInstallData:void 0}}var FwA={encode(A,Q=new wQ){if(A.coldConfigData!==void 0)Q.uint32(10).string(A.coldConfigData);if(A.coldHashData!==void 0)Q.uint32(26).string(A.coldHashData);if(A.hotHashData!==void 0)Q.uint32(42).string(A.hotHashData);if(A.appInstallData!==void 0)Q.uint32(50).string(A.appInstallData);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=LBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.coldConfigData=B.string();continue}case 3:{if(C!==26)break;D.coldHashData=B.string();continue}case 5:{if(C!==42)break;D.hotHashData=B.string();continue}case 6:{if(C!==50)break;D.appInstallData=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function MBQ(){return{latitudeE7:void 0,longitudeE7:void 0,localTimestampMs:void 0,ipAddress:void 0,timezone:void 0,prefer24HourTime:void 0,locationRadiusMeters:void 0,isInitialLoad:void 0,browserPermissionGranted:void 0,clientPermissionState:void 0,locationOverrideToken:void 0}}var HwA={encode(A,Q=new wQ){if(A.latitudeE7!==void 0)Q.uint32(8).int32(A.latitudeE7);if(A.longitudeE7!==void 0)Q.uint32(16).int32(A.longitudeE7);if(A.localTimestampMs!==void 0)Q.uint32(24).int64(A.localTimestampMs);if(A.ipAddress!==void 0)Q.uint32(34).string(A.ipAddress);if(A.timezone!==void 0)Q.uint32(42).string(A.timezone);if(A.prefer24HourTime!==void 0)Q.uint32(48).bool(A.prefer24HourTime);if(A.locationRadiusMeters!==void 0)Q.uint32(56).int32(A.locationRadiusMeters);if(A.isInitialLoad!==void 0)Q.uint32(64).bool(A.isInitialLoad);if(A.browserPermissionGranted!==void 0)Q.uint32(72).bool(A.browserPermissionGranted);if(A.clientPermissionState!==void 0)Q.uint32(80).int32(A.clientPermissionState);if(A.locationOverrideToken!==void 0)Q.uint32(90).string(A.locationOverrideToken);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=MBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.latitudeE7=B.int32();continue}case 2:{if(C!==16)break;D.longitudeE7=B.int32();continue}case 3:{if(C!==24)break;D.localTimestampMs=Pl(B.int64());continue}case 4:{if(C!==34)break;D.ipAddress=B.string();continue}case 5:{if(C!==42)break;D.timezone=B.string();continue}case 6:{if(C!==48)break;D.prefer24HourTime=B.bool();continue}case 7:{if(C!==56)break;D.locationRadiusMeters=B.int32();continue}case 8:{if(C!==64)break;D.isInitialLoad=B.bool();continue}case 9:{if(C!==72)break;D.browserPermissionGranted=B.bool();continue}case 10:{if(C!==80)break;D.clientPermissionState=B.int32();continue}case 11:{if(C!==90)break;D.locationOverrideToken=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function PBQ(){return{contentSettings:void 0,parentCurationMode:void 0,categorySettings:void 0,userEducationSettings:void 0}}var XwA={encode(A,Q=new wQ){if(A.contentSettings!==void 0)ZwA.encode(A.contentSettings,Q.uint32(10).fork()).join();if(A.parentCurationMode!==void 0)Q.uint32(16).int32(A.parentCurationMode);if(A.categorySettings!==void 0)KwA.encode(A.categorySettings,Q.uint32(26).fork()).join();if(A.userEducationSettings!==void 0)UwA.encode(A.userEducationSettings,Q.uint32(34).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=PBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.contentSettings=ZwA.decode(B,B.uint32());continue}case 2:{if(C!==16)break;D.parentCurationMode=B.int32();continue}case 3:{if(C!==26)break;D.categorySettings=KwA.decode(B,B.uint32());continue}case 4:{if(C!==34)break;D.userEducationSettings=UwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function SBQ(){return{kidsNoSearchMode:void 0,ageUpMode:void 0,contentDensity:void 0}}var ZwA={encode(A,Q=new wQ){if(A.kidsNoSearchMode!==void 0)Q.uint32(8).int32(A.kidsNoSearchMode);if(A.ageUpMode!==void 0)Q.uint32(16).int32(A.ageUpMode);if(A.contentDensity!==void 0)Q.uint32(24).int32(A.contentDensity);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=SBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.kidsNoSearchMode=B.int32();continue}case 2:{if(C!==16)break;D.ageUpMode=B.int32();continue}case 3:{if(C!==24)break;D.contentDensity=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function TBQ(){return{enabledCategories:void 0}}var KwA={encode(A,Q=new wQ){if(A.enabledCategories!==void 0)Q.uint32(10).string(A.enabledCategories);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=TBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.enabledCategories=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function _BQ(){return{hasSeenHomeChipBarUserEducation:void 0,hasSeenHomePivotBarUserEducation:void 0,hasSeenParentMuirUserEducation:void 0}}var UwA={encode(A,Q=new wQ){if(A.hasSeenHomeChipBarUserEducation!==void 0)Q.uint32(8).bool(A.hasSeenHomeChipBarUserEducation);if(A.hasSeenHomePivotBarUserEducation!==void 0)Q.uint32(16).bool(A.hasSeenHomePivotBarUserEducation);if(A.hasSeenParentMuirUserEducation!==void 0)Q.uint32(24).bool(A.hasSeenParentMuirUserEducation);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=_BQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.hasSeenHomeChipBarUserEducation=B.bool();continue}case 2:{if(C!==16)break;D.hasSeenHomePivotBarUserEducation=B.bool();continue}case 3:{if(C!==24)break;D.hasSeenParentMuirUserEducation=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function kBQ(){return{playBackMode:void 0,musicLocationMasterSwitch:void 0,musicActivityMasterSwitch:void 0,offlineMixtapeEnabled:void 0,autoOfflineEnabled:void 0,iosBackgroundRefreshStatus:void 0,smartDownloadsSongLimit:void 0,transitionedFromMixtapeToSmartDownloads:void 0,pwaInstallabilityStatus:void 0,webDisplayMode:void 0,musicTier:void 0,storeDigitalGoodsApiSupportStatus:void 0,smartDownloadsTimeSinceLastOptOutSec:void 0}}var $wA={encode(A,Q=new wQ){if(A.playBackMode!==void 0)Q.uint32(8).int32(A.playBackMode);if(A.musicLocationMasterSwitch!==void 0)Q.uint32(16).int32(A.musicLocationMasterSwitch);if(A.musicActivityMasterSwitch!==void 0)Q.uint32(24).int32(A.musicActivityMasterSwitch);if(A.offlineMixtapeEnabled!==void 0)Q.uint32(32).bool(A.offlineMixtapeEnabled);if(A.autoOfflineEnabled!==void 0)Q.uint32(40).bool(A.autoOfflineEnabled);if(A.iosBackgroundRefreshStatus!==void 0)Q.uint32(48).int32(A.iosBackgroundRefreshStatus);if(A.smartDownloadsSongLimit!==void 0)Q.uint32(56).int32(A.smartDownloadsSongLimit);if(A.transitionedFromMixtapeToSmartDownloads!==void 0)Q.uint32(64).bool(A.transitionedFromMixtapeToSmartDownloads);if(A.pwaInstallabilityStatus!==void 0)Q.uint32(72).int32(A.pwaInstallabilityStatus);if(A.webDisplayMode!==void 0)Q.uint32(80).int32(A.webDisplayMode);if(A.musicTier!==void 0)Q.uint32(88).int32(A.musicTier);if(A.storeDigitalGoodsApiSupportStatus!==void 0)Q.uint32(96).int32(A.storeDigitalGoodsApiSupportStatus);if(A.smartDownloadsTimeSinceLastOptOutSec!==void 0)Q.uint32(104).int64(A.smartDownloadsTimeSinceLastOptOutSec);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=kBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.playBackMode=B.int32();continue}case 2:{if(C!==16)break;D.musicLocationMasterSwitch=B.int32();continue}case 3:{if(C!==24)break;D.musicActivityMasterSwitch=B.int32();continue}case 4:{if(C!==32)break;D.offlineMixtapeEnabled=B.bool();continue}case 5:{if(C!==40)break;D.autoOfflineEnabled=B.bool();continue}case 6:{if(C!==48)break;D.iosBackgroundRefreshStatus=B.int32();continue}case 7:{if(C!==56)break;D.smartDownloadsSongLimit=B.int32();continue}case 8:{if(C!==64)break;D.transitionedFromMixtapeToSmartDownloads=B.bool();continue}case 9:{if(C!==72)break;D.pwaInstallabilityStatus=B.int32();continue}case 10:{if(C!==80)break;D.webDisplayMode=B.int32();continue}case 11:{if(C!==88)break;D.musicTier=B.int32();continue}case 12:{if(C!==96)break;D.storeDigitalGoodsApiSupportStatus=B.int32();continue}case 13:{if(C!==104)break;D.smartDownloadsTimeSinceLastOptOutSec=Pl(B.int64());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function jBQ(){return{mdxImpactedSessionsServerEvents:void 0,enablePrivacyFilter:void 0,zylonLeftNav:void 0,certificationScope:void 0,livingRoomPoTokenId:void 0,jsEngineString:void 0,voiceCapability:void 0,systemIntegrator:void 0,androidBuildFingerprint:void 0,cobaltAppVersion:void 0,cobaltStarboardVersion:void 0,useStartPlaybackPreviewCommand:void 0,shouldShowPersistentSigninOnHome:void 0,androidPlayServicesVersion:void 0}}var YwA={encode(A,Q=new wQ){if(A.mdxImpactedSessionsServerEvents!==void 0)Q.uint32(26).string(A.mdxImpactedSessionsServerEvents);if(A.enablePrivacyFilter!==void 0)Q.uint32(48).bool(A.enablePrivacyFilter);if(A.zylonLeftNav!==void 0)Q.uint32(56).bool(A.zylonLeftNav);if(A.certificationScope!==void 0)Q.uint32(74).string(A.certificationScope);if(A.livingRoomPoTokenId!==void 0)Q.uint32(82).string(A.livingRoomPoTokenId);if(A.jsEngineString!==void 0)Q.uint32(98).string(A.jsEngineString);if(A.voiceCapability!==void 0)WwA.encode(A.voiceCapability,Q.uint32(106).fork()).join();if(A.systemIntegrator!==void 0)Q.uint32(114).string(A.systemIntegrator);if(A.androidBuildFingerprint!==void 0)Q.uint32(146).string(A.androidBuildFingerprint);if(A.cobaltAppVersion!==void 0)Q.uint32(154).string(A.cobaltAppVersion);if(A.cobaltStarboardVersion!==void 0)Q.uint32(162).string(A.cobaltStarboardVersion);if(A.useStartPlaybackPreviewCommand!==void 0)Q.uint32(176).bool(A.useStartPlaybackPreviewCommand);if(A.shouldShowPersistentSigninOnHome!==void 0)Q.uint32(184).bool(A.shouldShowPersistentSigninOnHome);if(A.androidPlayServicesVersion!==void 0)Q.uint32(194).string(A.androidPlayServicesVersion);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=jBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 3:{if(C!==26)break;D.mdxImpactedSessionsServerEvents=B.string();continue}case 6:{if(C!==48)break;D.enablePrivacyFilter=B.bool();continue}case 7:{if(C!==56)break;D.zylonLeftNav=B.bool();continue}case 9:{if(C!==74)break;D.certificationScope=B.string();continue}case 10:{if(C!==82)break;D.livingRoomPoTokenId=B.string();continue}case 12:{if(C!==98)break;D.jsEngineString=B.string();continue}case 13:{if(C!==106)break;D.voiceCapability=WwA.decode(B,B.uint32());continue}case 14:{if(C!==114)break;D.systemIntegrator=B.string();continue}case 18:{if(C!==146)break;D.androidBuildFingerprint=B.string();continue}case 19:{if(C!==154)break;D.cobaltAppVersion=B.string();continue}case 20:{if(C!==162)break;D.cobaltStarboardVersion=B.string();continue}case 22:{if(C!==176)break;D.useStartPlaybackPreviewCommand=B.bool();continue}case 23:{if(C!==184)break;D.shouldShowPersistentSigninOnHome=B.bool();continue}case 24:{if(C!==194)break;D.androidPlayServicesVersion=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function yBQ(){return{hasSoftMicSupport:void 0,hasHardMicSupport:void 0}}var WwA={encode(A,Q=new wQ){if(A.hasSoftMicSupport!==void 0)Q.uint32(8).bool(A.hasSoftMicSupport);if(A.hasHardMicSupport!==void 0)Q.uint32(16).bool(A.hasHardMicSupport);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=yBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.hasSoftMicSupport=B.bool();continue}case 2:{if(C!==16)break;D.hasHardMicSupport=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function gBQ(){return{enableFilterMode:void 0,iosNotificationPermission:void 0,forceEnableEpg3:void 0}}var zwA={encode(A,Q=new wQ){if(A.enableFilterMode!==void 0)Q.uint32(16).bool(A.enableFilterMode);if(A.iosNotificationPermission!==void 0)Q.uint32(24).bool(A.iosNotificationPermission);if(A.forceEnableEpg3!==void 0)Q.uint32(56).bool(A.forceEnableEpg3);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=gBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 2:{if(C!==16)break;D.enableFilterMode=B.bool();continue}case 3:{if(C!==24)break;D.iosNotificationPermission=B.bool();continue}case 7:{if(C!==56)break;D.forceEnableEpg3=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function vBQ(){return{locationInfoStatus:void 0,ulrStatus:void 0,latitudeE7:void 0,longitudeE7:void 0,horizontalAccuracyMeters:void 0,locationFreshnessMs:void 0,locationPermissionAuthorizationStatus:void 0,locationOverrideToken:void 0,forceLocationPlayabilityTokenRefresh:void 0}}var qwA={encode(A,Q=new wQ){if(A.locationInfoStatus!==void 0)Q.uint32(8).int32(A.locationInfoStatus);if(A.ulrStatus!==void 0)OwA.encode(A.ulrStatus,Q.uint32(18).fork()).join();if(A.latitudeE7!==void 0)Q.uint32(26).string(A.latitudeE7);if(A.longitudeE7!==void 0)Q.uint32(34).string(A.longitudeE7);if(A.horizontalAccuracyMeters!==void 0)Q.uint32(42).string(A.horizontalAccuracyMeters);if(A.locationFreshnessMs!==void 0)Q.uint32(50).string(A.locationFreshnessMs);if(A.locationPermissionAuthorizationStatus!==void 0)Q.uint32(56).int32(A.locationPermissionAuthorizationStatus);if(A.locationOverrideToken!==void 0)Q.uint32(66).string(A.locationOverrideToken);if(A.forceLocationPlayabilityTokenRefresh!==void 0)Q.uint32(72).bool(A.forceLocationPlayabilityTokenRefresh);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=vBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.locationInfoStatus=B.int32();continue}case 2:{if(C!==18)break;D.ulrStatus=OwA.decode(B,B.uint32());continue}case 3:{if(C!==26)break;D.latitudeE7=B.string();continue}case 4:{if(C!==34)break;D.longitudeE7=B.string();continue}case 5:{if(C!==42)break;D.horizontalAccuracyMeters=B.string();continue}case 6:{if(C!==50)break;D.locationFreshnessMs=B.string();continue}case 7:{if(C!==56)break;D.locationPermissionAuthorizationStatus=B.int32();continue}case 8:{if(C!==66)break;D.locationOverrideToken=B.string();continue}case 9:{if(C!==72)break;D.forceLocationPlayabilityTokenRefresh=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function bBQ(){return{reportingEnabledSetting:void 0,historyEnabledSetting:void 0,isAllowed:void 0,isActive:void 0}}var OwA={encode(A,Q=new wQ){if(A.reportingEnabledSetting!==void 0)Q.uint32(8).int32(A.reportingEnabledSetting);if(A.historyEnabledSetting!==void 0)Q.uint32(16).int32(A.historyEnabledSetting);if(A.isAllowed!==void 0)Q.uint32(24).bool(A.isAllowed);if(A.isActive!==void 0)Q.uint32(32).bool(A.isActive);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=bBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.reportingEnabledSetting=B.int32();continue}case 2:{if(C!==16)break;D.historyEnabledSetting=B.int32();continue}case 3:{if(C!==24)break;D.isAllowed=B.bool();continue}case 4:{if(C!==32)break;D.isActive=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function xBQ(){return{isPartOfGroup:void 0,isGroup:void 0}}var VwA={encode(A,Q=new wQ){if(A.isPartOfGroup!==void 0)Q.uint32(8).bool(A.isPartOfGroup);if(A.isGroup!==void 0)Q.uint32(24).bool(A.isGroup);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=xBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.isPartOfGroup=B.bool();continue}case 3:{if(C!==24)break;D.isGroup=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function Pl(A){let Q=globalThis.Number(A.toString());if(Q>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(Q<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return Q}function hBQ(){return{challenge:void 0,webResponse:void 0,androidResponse:void 0,iosResponse:void 0,error:void 0,adblockReporting:void 0}}var wIA={encode(A,Q=new wQ){if(A.challenge!==void 0)Q.uint32(10).string(A.challenge);if(A.webResponse!==void 0)Q.uint32(18).string(A.webResponse);if(A.androidResponse!==void 0)Q.uint32(26).string(A.androidResponse);if(A.iosResponse!==void 0)Q.uint32(34).bytes(A.iosResponse);if(A.error!==void 0)Q.uint32(40).int32(A.error);if(A.adblockReporting!==void 0)wwA.encode(A.adblockReporting,Q.uint32(50).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=hBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.challenge=B.string();continue}case 2:{if(C!==18)break;D.webResponse=B.string();continue}case 3:{if(C!==26)break;D.androidResponse=B.string();continue}case 4:{if(C!==34)break;D.iosResponse=B.bytes();continue}case 5:{if(C!==40)break;D.error=B.int32();continue}case 6:{if(C!==50)break;D.adblockReporting=wwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function mBQ(){return{reportingStatus:void 0,broadSpectrumDetectionResult:void 0}}var wwA={encode(A,Q=new wQ){if(A.reportingStatus!==void 0)Q.uint32(8).uint64(A.reportingStatus);if(A.broadSpectrumDetectionResult!==void 0)Q.uint32(16).uint64(A.broadSpectrumDetectionResult);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=mBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.reportingStatus=NwA(B.uint64());continue}case 2:{if(C!==16)break;D.broadSpectrumDetectionResult=NwA(B.uint64());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function NwA(A){let Q=globalThis.Number(A.toString());if(Q>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(Q<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return Q}function fBQ(){return{thirdPartyDigest:void 0,useSsl:void 0,returnErrorDetail:void 0,ifNoneMatch:void 0,returnLogEntry:void 0,isPrefetch:void 0,internalExperimentFlags:[],returnDebugData:void 0,innertubez:void 0,traceProto:void 0,returnLogEntryJson:void 0,sherlogUsername:void 0,reauthRequestInfo:void 0,sessionInfo:void 0,returnLogEntryProto:void 0,externalPrequestContext:void 0,attestationResponseData:void 0,eats:void 0,requestQos:void 0}}var NIA={encode(A,Q=new wQ){if(A.thirdPartyDigest!==void 0)Q.uint32(50).string(A.thirdPartyDigest);if(A.useSsl!==void 0)Q.uint32(56).bool(A.useSsl);if(A.returnErrorDetail!==void 0)Q.uint32(72).bool(A.returnErrorDetail);if(A.ifNoneMatch!==void 0)Q.uint32(98).string(A.ifNoneMatch);if(A.returnLogEntry!==void 0)Q.uint32(104).bool(A.returnLogEntry);if(A.isPrefetch!==void 0)Q.uint32(112).bool(A.isPrefetch);for(let B of A.internalExperimentFlags)yG.encode(B,Q.uint32(122).fork()).join();if(A.returnDebugData!==void 0)Q.uint32(128).bool(A.returnDebugData);if(A.innertubez!==void 0)Q.uint32(146).string(A.innertubez);if(A.traceProto!==void 0)Q.uint32(184).bool(A.traceProto);if(A.returnLogEntryJson!==void 0)Q.uint32(192).bool(A.returnLogEntryJson);if(A.sherlogUsername!==void 0)Q.uint32(202).string(A.sherlogUsername);if(A.reauthRequestInfo!==void 0)MwA.encode(A.reauthRequestInfo,Q.uint32(234).fork()).join();if(A.sessionInfo!==void 0)LwA.encode(A.sessionInfo,Q.uint32(242).fork()).join();if(A.returnLogEntryProto!==void 0)Q.uint32(248).bool(A.returnLogEntryProto);if(A.externalPrequestContext!==void 0)Q.uint32(258).string(A.externalPrequestContext);if(A.attestationResponseData!==void 0)wIA.encode(A.attestationResponseData,Q.uint32(274).fork()).join();if(A.eats!==void 0)Q.uint32(282).bytes(A.eats);if(A.requestQos!==void 0)RwA.encode(A.requestQos,Q.uint32(290).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=fBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 6:{if(C!==50)break;D.thirdPartyDigest=B.string();continue}case 7:{if(C!==56)break;D.useSsl=B.bool();continue}case 9:{if(C!==72)break;D.returnErrorDetail=B.bool();continue}case 12:{if(C!==98)break;D.ifNoneMatch=B.string();continue}case 13:{if(C!==104)break;D.returnLogEntry=B.bool();continue}case 14:{if(C!==112)break;D.isPrefetch=B.bool();continue}case 15:{if(C!==122)break;D.internalExperimentFlags.push(yG.decode(B,B.uint32()));continue}case 16:{if(C!==128)break;D.returnDebugData=B.bool();continue}case 18:{if(C!==146)break;D.innertubez=B.string();continue}case 23:{if(C!==184)break;D.traceProto=B.bool();continue}case 24:{if(C!==192)break;D.returnLogEntryJson=B.bool();continue}case 25:{if(C!==202)break;D.sherlogUsername=B.string();continue}case 29:{if(C!==234)break;D.reauthRequestInfo=MwA.decode(B,B.uint32());continue}case 30:{if(C!==242)break;D.sessionInfo=LwA.decode(B,B.uint32());continue}case 31:{if(C!==248)break;D.returnLogEntryProto=B.bool();continue}case 32:{if(C!==258)break;D.externalPrequestContext=B.string();continue}case 34:{if(C!==274)break;D.attestationResponseData=wIA.decode(B,B.uint32());continue}case 35:{if(C!==282)break;D.eats=B.bytes();continue}case 36:{if(C!==290)break;D.requestQos=RwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function uBQ(){return{criticality:void 0}}var RwA={encode(A,Q=new wQ){if(A.criticality!==void 0)Q.uint32(8).int32(A.criticality);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=uBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.criticality=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function cBQ(){return{token:void 0}}var LwA={encode(A,Q=new wQ){if(A.token!==void 0)Q.uint32(10).string(A.token);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=cBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.token=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function lBQ(){return{encodedReauthProofToken:void 0}}var MwA={encode(A,Q=new wQ){if(A.encodedReauthProofToken!==void 0)Q.uint32(10).string(A.encodedReauthProofToken);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=lBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.encodedReauthProofToken=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function dBQ(){return{developerKey:void 0,appName:void 0,appPublisher:void 0,embedUrl:void 0,appVersion:void 0,embeddedPlayerContext:void 0}}var RIA={encode(A,Q=new wQ){if(A.developerKey!==void 0)Q.uint32(10).string(A.developerKey);if(A.appName!==void 0)Q.uint32(18).string(A.appName);if(A.appPublisher!==void 0)Q.uint32(26).string(A.appPublisher);if(A.embedUrl!==void 0)Q.uint32(34).string(A.embedUrl);if(A.appVersion!==void 0)Q.uint32(50).string(A.appVersion);if(A.embeddedPlayerContext!==void 0)PwA.encode(A.embeddedPlayerContext,Q.uint32(58).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=dBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.developerKey=B.string();continue}case 2:{if(C!==18)break;D.appName=B.string();continue}case 3:{if(C!==26)break;D.appPublisher=B.string();continue}case 4:{if(C!==34)break;D.embedUrl=B.string();continue}case 6:{if(C!==50)break;D.appVersion=B.string();continue}case 7:{if(C!==58)break;D.embeddedPlayerContext=PwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function pBQ(){return{ancestorOrigins:void 0,embeddedPlayerEncryptedContext:void 0,ancestorOriginsSupported:void 0}}var PwA={encode(A,Q=new wQ){if(A.ancestorOrigins!==void 0)Q.uint32(10).string(A.ancestorOrigins);if(A.embeddedPlayerEncryptedContext!==void 0)Q.uint32(18).string(A.embeddedPlayerEncryptedContext);if(A.ancestorOriginsSupported!==void 0)Q.uint32(24).bool(A.ancestorOriginsSupported);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=pBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.ancestorOrigins=B.string();continue}case 2:{if(C!==18)break;D.embeddedPlayerEncryptedContext=B.string();continue}case 3:{if(C!==24)break;D.ancestorOriginsSupported=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function oBQ(){return{onBehalfOfUser:void 0,enableSafetyMode:void 0,credentialTransferTokens:[],delegatePurchases:void 0,kidsParent:void 0,isIncognito:void 0,lockedSafetyMode:void 0,delegationContext:void 0,serializedDelegationContext:void 0}}var LIA={encode(A,Q=new wQ){if(A.onBehalfOfUser!==void 0)Q.uint32(26).string(A.onBehalfOfUser);if(A.enableSafetyMode!==void 0)Q.uint32(56).bool(A.enableSafetyMode);for(let B of A.credentialTransferTokens)kwA.encode(B,Q.uint32(98).fork()).join();if(A.delegatePurchases!==void 0)TwA.encode(A.delegatePurchases,Q.uint32(106).fork()).join();if(A.kidsParent!==void 0)SwA.encode(A.kidsParent,Q.uint32(114).fork()).join();if(A.isIncognito!==void 0)Q.uint32(120).bool(A.isIncognito);if(A.lockedSafetyMode!==void 0)Q.uint32(128).bool(A.lockedSafetyMode);if(A.delegationContext!==void 0)_wA.encode(A.delegationContext,Q.uint32(138).fork()).join();if(A.serializedDelegationContext!==void 0)Q.uint32(146).string(A.serializedDelegationContext);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=oBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 3:{if(C!==26)break;D.onBehalfOfUser=B.string();continue}case 7:{if(C!==56)break;D.enableSafetyMode=B.bool();continue}case 12:{if(C!==98)break;D.credentialTransferTokens.push(kwA.decode(B,B.uint32()));continue}case 13:{if(C!==106)break;D.delegatePurchases=TwA.decode(B,B.uint32());continue}case 14:{if(C!==114)break;D.kidsParent=SwA.decode(B,B.uint32());continue}case 15:{if(C!==120)break;D.isIncognito=B.bool();continue}case 16:{if(C!==128)break;D.lockedSafetyMode=B.bool();continue}case 17:{if(C!==138)break;D.delegationContext=_wA.decode(B,B.uint32());continue}case 18:{if(C!==146)break;D.serializedDelegationContext=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function nBQ(){return{}}var SwA={encode(A,Q=new wQ){return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=nBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function iBQ(){return{}}var TwA={encode(A,Q=new wQ){return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=iBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function rBQ(){return{}}var _wA={encode(A,Q=new wQ){return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=rBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function sBQ(){return{}}var kwA={encode(A,Q=new wQ){return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=sBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function tBQ(){return{client:void 0,user:void 0,capabilities:void 0,request:void 0,clickTracking:void 0,thirdParty:void 0,remoteClient:void 0,adSignalsInfo:void 0,experimentalData:void 0,clientScreenNonce:void 0,activePlayers:[]}}var MIA={encode(A,Q=new wQ){if(A.client!==void 0)w_.encode(A.client,Q.uint32(10).fork()).join();if(A.user!==void 0)LIA.encode(A.user,Q.uint32(26).fork()).join();if(A.capabilities!==void 0)VIA.encode(A.capabilities,Q.uint32(34).fork()).join();if(A.request!==void 0)NIA.encode(A.request,Q.uint32(42).fork()).join();if(A.clickTracking!==void 0)gwA.encode(A.clickTracking,Q.uint32(50).fork()).join();if(A.thirdParty!==void 0)RIA.encode(A.thirdParty,Q.uint32(58).fork()).join();if(A.remoteClient!==void 0)w_.encode(A.remoteClient,Q.uint32(66).fork()).join();if(A.adSignalsInfo!==void 0)vwA.encode(A.adSignalsInfo,Q.uint32(74).fork()).join();if(A.experimentalData!==void 0)jwA.encode(A.experimentalData,Q.uint32(82).fork()).join();if(A.clientScreenNonce!==void 0)Q.uint32(90).string(A.clientScreenNonce);for(let B of A.activePlayers)ywA.encode(B,Q.uint32(98).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=tBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.client=w_.decode(B,B.uint32());continue}case 3:{if(C!==26)break;D.user=LIA.decode(B,B.uint32());continue}case 4:{if(C!==34)break;D.capabilities=VIA.decode(B,B.uint32());continue}case 5:{if(C!==42)break;D.request=NIA.decode(B,B.uint32());continue}case 6:{if(C!==50)break;D.clickTracking=gwA.decode(B,B.uint32());continue}case 7:{if(C!==58)break;D.thirdParty=RIA.decode(B,B.uint32());continue}case 8:{if(C!==66)break;D.remoteClient=w_.decode(B,B.uint32());continue}case 9:{if(C!==74)break;D.adSignalsInfo=vwA.decode(B,B.uint32());continue}case 10:{if(C!==82)break;D.experimentalData=jwA.decode(B,B.uint32());continue}case 11:{if(C!==90)break;D.clientScreenNonce=B.string();continue}case 12:{if(C!==98)break;D.activePlayers.push(ywA.decode(B,B.uint32()));continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function aBQ(){return{params:[]}}var jwA={encode(A,Q=new wQ){for(let B of A.params)yG.encode(B,Q.uint32(10).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=aBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.params.push(yG.decode(B,B.uint32()));continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function eBQ(){return{playerContextParams:void 0}}var ywA={encode(A,Q=new wQ){if(A.playerContextParams!==void 0)Q.uint32(10).bytes(A.playerContextParams);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=eBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.playerContextParams=B.bytes();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function AIQ(){return{clickTrackingParams:void 0}}var gwA={encode(A,Q=new wQ){if(A.clickTrackingParams!==void 0)Q.uint32(18).bytes(A.clickTrackingParams);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=AIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 2:{if(C!==18)break;D.clickTrackingParams=B.bytes();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function QIQ(){return{params:[],bid:void 0,mutsuId:void 0,consentBumpState:void 0,advertisingId:void 0,limitAdTracking:void 0,attributionOsSupportedVersion:void 0}}var vwA={encode(A,Q=new wQ){for(let B of A.params)yG.encode(B,Q.uint32(10).fork()).join();if(A.bid!==void 0)Q.uint32(18).string(A.bid);if(A.mutsuId!==void 0)Q.uint32(26).string(A.mutsuId);if(A.consentBumpState!==void 0)Q.uint32(34).string(A.consentBumpState);if(A.advertisingId!==void 0)Q.uint32(58).string(A.advertisingId);if(A.limitAdTracking!==void 0)Q.uint32(72).bool(A.limitAdTracking);if(A.attributionOsSupportedVersion!==void 0)Q.uint32(82).string(A.attributionOsSupportedVersion);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=QIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.params.push(yG.decode(B,B.uint32()));continue}case 2:{if(C!==18)break;D.bid=B.string();continue}case 3:{if(C!==26)break;D.mutsuId=B.string();continue}case 4:{if(C!==34)break;D.consentBumpState=B.string();continue}case 7:{if(C!==58)break;D.advertisingId=B.string();continue}case 9:{if(C!==72)break;D.limitAdTracking=B.bool();continue}case 10:{if(C!==82)break;D.attributionOsSupportedVersion=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function BIQ(){return{context:void 0,encryptedVideoId:void 0,title:void 0,description:void 0,privacy:void 0,tags:void 0,category:void 0,license:void 0,ageRestriction:void 0,videoStill:void 0,madeForKids:void 0,racy:void 0}}var nwA={encode(A,Q=new wQ){if(A.context!==void 0)MIA.encode(A.context,Q.uint32(10).fork()).join();if(A.encryptedVideoId!==void 0)Q.uint32(18).string(A.encryptedVideoId);if(A.title!==void 0)bwA.encode(A.title,Q.uint32(26).fork()).join();if(A.description!==void 0)xwA.encode(A.description,Q.uint32(34).fork()).join();if(A.privacy!==void 0)hwA.encode(A.privacy,Q.uint32(42).fork()).join();if(A.tags!==void 0)mwA.encode(A.tags,Q.uint32(50).fork()).join();if(A.category!==void 0)fwA.encode(A.category,Q.uint32(58).fork()).join();if(A.license!==void 0)uwA.encode(A.license,Q.uint32(66).fork()).join();if(A.ageRestriction!==void 0)dwA.encode(A.ageRestriction,Q.uint32(90).fork()).join();if(A.videoStill!==void 0)pwA.encode(A.videoStill,Q.uint32(162).fork()).join();if(A.madeForKids!==void 0)cwA.encode(A.madeForKids,Q.uint32(546).fork()).join();if(A.racy!==void 0)lwA.encode(A.racy,Q.uint32(554).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=BIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.context=MIA.decode(B,B.uint32());continue}case 2:{if(C!==18)break;D.encryptedVideoId=B.string();continue}case 3:{if(C!==26)break;D.title=bwA.decode(B,B.uint32());continue}case 4:{if(C!==34)break;D.description=xwA.decode(B,B.uint32());continue}case 5:{if(C!==42)break;D.privacy=hwA.decode(B,B.uint32());continue}case 6:{if(C!==50)break;D.tags=mwA.decode(B,B.uint32());continue}case 7:{if(C!==58)break;D.category=fwA.decode(B,B.uint32());continue}case 8:{if(C!==66)break;D.license=uwA.decode(B,B.uint32());continue}case 11:{if(C!==90)break;D.ageRestriction=dwA.decode(B,B.uint32());continue}case 20:{if(C!==162)break;D.videoStill=pwA.decode(B,B.uint32());continue}case 68:{if(C!==546)break;D.madeForKids=cwA.decode(B,B.uint32());continue}case 69:{if(C!==554)break;D.racy=lwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function IIQ(){return{newTitle:void 0}}var bwA={encode(A,Q=new wQ){if(A.newTitle!==void 0)Q.uint32(10).string(A.newTitle);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=IIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.newTitle=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function DIQ(){return{newDescription:void 0}}var xwA={encode(A,Q=new wQ){if(A.newDescription!==void 0)Q.uint32(10).string(A.newDescription);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=DIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.newDescription=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function EIQ(){return{newPrivacy:void 0,clearPrivacyDraft:void 0}}var hwA={encode(A,Q=new wQ){if(A.newPrivacy!==void 0)Q.uint32(8).int32(A.newPrivacy);if(A.clearPrivacyDraft!==void 0)Q.uint32(16).bool(A.clearPrivacyDraft);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=EIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.newPrivacy=B.int32();continue}case 2:{if(C!==16)break;D.clearPrivacyDraft=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function CIQ(){return{newTags:[]}}var mwA={encode(A,Q=new wQ){for(let B of A.newTags)Q.uint32(10).string(B);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=CIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.newTags.push(B.string());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function JIQ(){return{newCategoryId:void 0}}var fwA={encode(A,Q=new wQ){if(A.newCategoryId!==void 0)Q.uint32(8).int32(A.newCategoryId);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=JIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.newCategoryId=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function GIQ(){return{newLicenseId:void 0}}var uwA={encode(A,Q=new wQ){if(A.newLicenseId!==void 0)Q.uint32(10).string(A.newLicenseId);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=GIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.newLicenseId=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function FIQ(){return{operation:void 0,newMfk:void 0}}var cwA={encode(A,Q=new wQ){if(A.operation!==void 0)Q.uint32(8).int32(A.operation);if(A.newMfk!==void 0)Q.uint32(16).int32(A.newMfk);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=FIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.operation=B.int32();continue}case 2:{if(C!==16)break;D.newMfk=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function HIQ(){return{operation:void 0,newRacy:void 0}}var lwA={encode(A,Q=new wQ){if(A.operation!==void 0)Q.uint32(8).int32(A.operation);if(A.newRacy!==void 0)Q.uint32(16).int32(A.newRacy);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=HIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.operation=B.int32();continue}case 2:{if(C!==16)break;D.newRacy=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function XIQ(){return{newIsAgeRestricted:void 0}}var dwA={encode(A,Q=new wQ){if(A.newIsAgeRestricted!==void 0)Q.uint32(8).bool(A.newIsAgeRestricted);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=XIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.newIsAgeRestricted=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function ZIQ(){return{operation:void 0,newStillId:void 0,image:void 0,testImage:void 0,experimentImage:[]}}var pwA={encode(A,Q=new wQ){if(A.operation!==void 0)Q.uint32(8).int32(A.operation);if(A.newStillId!==void 0)Q.uint32(16).int32(A.newStillId);if(A.image!==void 0)jN.encode(A.image,Q.uint32(26).fork()).join();if(A.testImage!==void 0)jN.encode(A.testImage,Q.uint32(34).fork()).join();for(let B of A.experimentImage)owA.encode(B,Q.uint32(50).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=ZIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.operation=B.int32();continue}case 2:{if(C!==16)break;D.newStillId=B.int32();continue}case 3:{if(C!==26)break;D.image=jN.decode(B,B.uint32());continue}case 4:{if(C!==34)break;D.testImage=jN.decode(B,B.uint32());continue}case 6:{if(C!==50)break;D.experimentImage.push(owA.decode(B,B.uint32()));continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function KIQ(){return{image:void 0}}var owA={encode(A,Q=new wQ){if(A.image!==void 0)jN.encode(A.image,Q.uint32(10).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=KIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.image=jN.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function UIQ(){return{rawBytes:void 0,dataUri:void 0,frameTimestampUs:void 0,isVertical:void 0}}var jN={encode(A,Q=new wQ){if(A.rawBytes!==void 0)Q.uint32(10).bytes(A.rawBytes);if(A.dataUri!==void 0)Q.uint32(18).string(A.dataUri);if(A.frameTimestampUs!==void 0)Q.uint32(32).int64(A.frameTimestampUs);if(A.isVertical!==void 0)Q.uint32(40).bool(A.isVertical);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=UIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.rawBytes=B.bytes();continue}case 2:{if(C!==18)break;D.dataUri=B.string();continue}case 4:{if(C!==32)break;D.frameTimestampUs=$IQ(B.int64());continue}case 5:{if(C!==40)break;D.isVertical=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function $IQ(A){let Q=globalThis.Number(A.toString());if(Q>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(Q<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return Q}class N_{#A;constructor(A){this.#A=A}async updateVideoMetadata(A,Q){let B=this.#A;if(!B.logged_in)throw new s("You must be signed in to perform this operation.");let I={context:{client:{osName:"Android",clientName:parseInt(RI.CLIENT_NAME_IDS.ANDROID),clientVersion:RI.CLIENTS.ANDROID.VERSION,androidSdkVersion:RI.CLIENTS.ANDROID.SDK_VERSION,visitorData:B.context.client.visitorData,osVersion:"13",acceptLanguage:B.context.client.hl,acceptRegion:B.context.client.gl,deviceMake:"Google",deviceModel:"sdk_gphone64_x86_64",screenHeightPoints:840,screenWidthPoints:432,configInfo:{appInstallData:B.context.client.configInfo?.appInstallData},timeZone:B.context.client.timeZone,chipset:"qcom;taro"},activePlayers:[]},encryptedVideoId:A};if(Q.title)I.title={newTitle:Q.title};if(Q.description)I.description={newDescription:Q.description};if(Q.license)I.license={newLicenseId:Q.license};if(Q.tags)I.tags={newTags:Q.tags};if(Q.thumbnail)I.videoStill={operation:3,image:{rawBytes:Q.thumbnail},experimentImage:[]};if(Reflect.has(Q,"category"))I.category={newCategoryId:Q.category};if(Reflect.has(Q,"privacy"))switch(Q.privacy){case"PUBLIC":I.privacy={newPrivacy:1};break;case"UNLISTED":I.privacy={newPrivacy:2};break;case"PRIVATE":I.privacy={newPrivacy:3};break;default:throw Error("Invalid privacy setting")}if(Reflect.has(Q,"made_for_kids"))I.madeForKids={operation:1,newMfk:Q.made_for_kids?1:2};if(Reflect.has(Q,"age_restricted"))I.racy={operation:1,newRacy:Q.age_restricted?1:2};let D=nwA.encode(I);return await B.actions.execute("/video_manager/metadata_update",{protobuf:!0,serialized_data:D.finish()})}async upload(A,Q={}){if(!this.#A.logged_in)throw new s("You must be signed in to perform this operation.");let B=await this.#Q(),I=await this.#B(B.upload_url,A);if(I.status!=="STATUS_SUCCESS")throw new s("Could not process video.");return await this.#I(B,I,Q)}async#Q(){let A=`innertube_android:${uI.shim.uuidv4()}:0:v=3,api=1,cf=3`,Q={frontendUploadId:A,deviceDisplayName:"Pixel 6 Pro",fileId:`goog-edited-video://generated?videoFileUri=content://media/external/video/media/${uI.shim.uuidv4()}`,mp4MoovAtomRelocationStatus:"UNSUPPORTED",transcodeResult:"DISABLED",connectionType:"WIFI"},B=await this.#A.http.fetch("/upload/youtubei",{baseURL:RI.URLS.YT_UPLOAD,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","x-goog-upload-command":"start","x-goog-upload-protocol":"resumable"},body:JSON.stringify(Q)});if(!B.ok)throw new s("Could not get initial upload data");return{frontend_upload_id:A,upload_id:B.headers.get("x-guploader-uploadid"),upload_url:B.headers.get("x-goog-upload-url"),scotty_resource_id:B.headers.get("x-goog-upload-header-scotty-resource-id"),chunk_granularity:B.headers.get("x-goog-upload-chunk-granularity")}}async#B(A,Q){let B=await this.#A.http.fetch_function(A,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","x-goog-upload-command":"upload, finalize","x-goog-upload-file-name":`file-${Date.now()}`,"x-goog-upload-offset":"0"},body:Q});if(!B.ok)throw new s("Could not upload video");return await B.json()}async#I(A,Q,B){return await this.#A.actions.execute("/upload/createvideo",{resourceId:{scottyResourceId:{id:Q.scottyResourceId}},frontendUploadId:A.frontend_upload_id,initialMetadata:{title:{newTitle:B.title},description:{newDescription:B.description,shouldSegment:!0},privacy:{newPrivacy:B.privacy||"PRIVATE"},draftState:{isDraft:!!B.is_draft}}})}}class R_{#A;constructor(A){this.#A=A}async getInfo(A=!1){if(!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");if(!A&&!!this.#A.session.context.user.onBehalfOfUser)throw new s('Boolean argument must be true when "on_behalf_of_user" is specified.');if(A)return(await new h({getAccountsListInnertubeEndpoint:{requestType:"ACCOUNTS_LIST_REQUEST_TYPE_CHANNEL_SWITCHER",callCircumstance:"SWITCHING_USERS_FULL"}}).call(this.#A,{client:"WEB",parse:!0})).actions_memo?.getType(j5)||[];let B=await new h({getAccountsListInnertubeEndpoint:{}}).call(this.#A,{client:"TV"});return new D_(B)}async getSettings(){let Q=await new h({browseEndpoint:{browseId:"SPaccount_overview"}}).call(this.#A);return new SN(this.#A,Q)}}class L_{#A;constructor(A){this.#A=A}async create(A,Q){if(UD({title:A,video_ids:Q}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let I=await new h({createPlaylistServiceEndpoint:{title:A,videoIds:Q}}).call(this.#A);return{success:I.success,status_code:I.status_code,playlist_id:I.data.playlistId,data:I.data}}async delete(A){if(UD({playlist_id:A}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let B=await new h({deletePlaylistServiceEndpoint:{sourcePlaylistId:A}}).call(this.#A);return{playlist_id:A,success:B.success,status_code:B.status_code,data:B.data}}async addToLibrary(A){if(UD({playlist_id:A}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");return await new h({likeEndpoint:{status:"LIKE",target:A}}).call(this.#A)}async removeFromLibrary(A){if(UD({playlist_id:A}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");return await new h({likeEndpoint:{status:"INDIFFERENT",target:A}}).call(this.#A)}async addVideos(A,Q){if(UD({playlist_id:A,video_ids:Q}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let I=await new h({playlistEditEndpoint:{playlistId:A,actions:Q.map((D)=>({action:"ACTION_ADD_VIDEO",addedVideoId:D}))}}).call(this.#A);return{playlist_id:A,action_result:I.data.actions}}async removeVideos(A,Q,B=!1){if(UD({playlist_id:A,video_ids:Q}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let I=await this.#Q(A);if(!I.info.is_editable)throw new s("This playlist cannot be edited.",A);let D={playlistId:A,actions:[]},C=async(Z)=>{let U=B?"set_video_id":"id";if(Z.videos.filter((w)=>Q.includes(w.key(U).string())).forEach((w)=>D.actions.push({action:"ACTION_REMOVE_VIDEO",setVideoId:w.key("set_video_id").string()})),D.actions.length<Q.length){let w=await Z.getContinuation();return C(w)}};if(await C(I),!D.actions.length)throw new s("Given video ids were not found in this playlist.",Q);let H=await new h({playlistEditEndpoint:D}).call(this.#A);return{playlist_id:A,action_result:H.data.actions}}async moveVideo(A,Q,B){if(UD({playlist_id:A,moved_video_id:Q,predecessor_video_id:B}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let I=await this.#Q(A);if(!I.info.is_editable)throw new s("This playlist cannot be edited.",A);let D={playlistId:A,actions:[]},C,G,H=async(O)=>{let w=O.videos.find((P)=>Q===P.key("id").string()),L=O.videos.find((P)=>B===P.key("id").string());if(C=C||w?.key("set_video_id").string(),G=G||L?.key("set_video_id").string(),!C||!G){let P=await O.getContinuation();return H(P)}};await H(I),D.actions.push({action:"ACTION_MOVE_VIDEO_AFTER",setVideoId:C,movedSetVideoIdPredecessor:G});let U=await new h({playlistEditEndpoint:D}).call(this.#A);return{playlist_id:A,action_result:U.data.actions}}async#Q(A){if(!A.startsWith("VL"))A=`VL${A}`;let B=await new h({browseEndpoint:{browseId:A}}).call(this.#A,{parse:!0});return new xG(this.#A,B,!0)}async setName(A,Q){if(UD({playlist_id:A,name:Q}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let B={playlist_id:A,actions:[]};B.actions.push({action:"ACTION_SET_PLAYLIST_NAME",playlistName:Q});let D=await new h({playlistEditEndpoint:B}).call(this.#A);return{playlist_id:A,action_result:D.data.actions}}async setDescription(A,Q){if(UD({playlist_id:A,description:Q}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let B={playlistId:A,actions:[]};B.actions.push({action:"ACTION_SET_PLAYLIST_DESCRIPTION",playlistDescription:Q});let D=await new h({playlistEditEndpoint:B}).call(this.#A);return{playlist_id:A,action_result:D.data.actions}}}class M_{#A;constructor(A){this.#A=A}async like(A){if(UD({video_id:A}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");return new h({likeEndpoint:{status:"LIKE",target:A}}).call(this.#A,{client:"TV"})}async dislike(A){if(UD({video_id:A}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");return new h({likeEndpoint:{status:"DISLIKE",target:A}}).call(this.#A,{client:"TV"})}async removeRating(A){if(UD({video_id:A}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");return new h({likeEndpoint:{status:"INDIFFERENT",target:A}}).call(this.#A,{client:"TV"})}async subscribe(A){if(UD({channel_id:A}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");return new h({subscribeEndpoint:{channelIds:[A],params:"EgIIAhgA"}}).call(this.#A)}async unsubscribe(A){if(UD({channel_id:A}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");return new h({unsubscribeEndpoint:{channelIds:[A],params:"CgIIAhgA"}}).call(this.#A)}async comment(A,Q){if(UD({video_id:A,text:Q}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");let B=POA.encode({videoId:A,params:{index:0},number:7}),I=encodeURIComponent(oC(B.finish()));return new h({createCommentEndpoint:{commentText:Q,createCommentParams:I}}).call(this.#A)}async translate(A,Q,B={}){UD({text:A,target_language:Q});let I=bT(22,{text:A,target_language:Q,...B}),C=await new h({performCommentActionEndpoint:{action:I}}).call(this.#A),G=C.data.frameworkUpdates.entityBatchUpdate.mutations[0].payload.commentEntityPayload;return{success:C.success,status_code:C.status_code,translated_content:G.translatedContent.content,data:C.data}}async setNotificationPreferences(A,Q){if(UD({channel_id:A,type:Q}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");let B={PERSONALIZED:1,ALL:2,NONE:3};if(!Object.keys(B).includes(Q.toUpperCase()))throw Error(`Invalid notification preference type: ${Q}`);let I=ROA.encode({channelId:A,prefId:{index:B[Q.toUpperCase()]},number0:0,number1:4}),D=encodeURIComponent(oC(I.finish()));return new h({modifyChannelNotificationPreferenceEndpoint:{params:D}}).call(this.#A)}}class Q7{#A;constructor(A){this.#A=A}static async create(A={}){return new Q7(await G$.create(A))}async getInfo(A,Q){UD({target:A});let B={videoId:A instanceof h?A.payload?.videoId:A,playlistId:A instanceof h?A.payload?.playlistId:void 0,playlistIndex:A instanceof h?A.payload?.playlistIndex:void 0,params:A instanceof h?A.payload?.params:void 0,racyCheckOk:!0,contentCheckOk:!0},I=new h({watchEndpoint:B}),D=new h({watchNextEndpoint:B}),C=this.#A,G={playbackContext:{contentPlaybackContext:{vis:0,splay:!1,lactMilliseconds:"-1",signatureTimestamp:C.player?.signature_timestamp}},client:Q?.client};if(Q?.po_token)G.serviceIntegrityDimensions={poToken:Q.po_token};else if(C.po_token)G.serviceIntegrityDimensions={poToken:C.po_token};let H=I.call(C.actions,G),Z=D.call(C.actions),U=await Promise.all([H,Z]),O=yJ(16);return new E$(U,C.actions,O)}async getBasicInfo(A,Q){UD({video_id:A});let B=new h({watchEndpoint:{videoId:A,racyCheckOk:!0,contentCheckOk:!0}}),I=this.#A,D={playbackContext:{contentPlaybackContext:{vis:0,splay:!1,lactMilliseconds:"-1",signatureTimestamp:I.player?.signature_timestamp}},client:Q?.client};if(Q?.po_token)D.serviceIntegrityDimensions={poToken:Q.po_token};else if(I.po_token)D.serviceIntegrityDimensions={poToken:I.po_token};let C=await B.call(I.actions,D),G=yJ(16);return new E$([C],I.actions,G)}async getShortsVideoInfo(A,Q){UD({video_id:A});let B=new h({reelWatchEndpoint:{disablePlayerResponse:!1,params:"CAUwAg%3D%3D",videoId:A}}),I=this.#A.actions,D=B.call(I,{client:Q}),C=_OA.encode({shortId:A,params:{number:5},feature2:25,feature3:0}),G=encodeURIComponent(oC(C.finish())),H=I.execute("/reel/reel_watch_sequence",{sequenceParams:G}),Z=await Promise.all([D,H]),U=yJ(16);return new Y_([Z[0]],I,U,Z[1])}async search(A,Q={}){UD({query:A});let B={};if(B.filters={},Q.prioritize)B.prioritize=OOA[Q.prioritize.toUpperCase()];if(Q.upload_date)B.filters.uploadDate=VOA[Q.upload_date.toUpperCase()];if(Q.type)B.filters.type=wOA[Q.type.toUpperCase()];if(Q.duration)B.filters.duration=NOA[Q.duration.toUpperCase()];if(Q.features)for(let C of Q.features)switch(C){case"360":B.filters.features360=!0;break;case"3d":B.filters.features3d=!0;break;case"4k":B.filters.features4k=!0;break;case"creative_commons":B.filters.featuresCreativeCommons=!0;break;case"hd":B.filters.featuresHd=!0;break;case"hdr":B.filters.featuresHdr=!0;break;case"live":B.filters.featuresLive=!0;break;case"location":B.filters.featuresLocation=!0;break;case"purchased":B.filters.featuresPurchased=!0;break;case"subtitles":B.filters.featuresSubtitles=!0;break;case"vr180":B.filters.featuresVr180=!0;break;default:break}let D=await new h({searchEndpoint:{query:A,params:Q?encodeURIComponent(oC(th.encode(B).finish())):void 0}}).call(this.#A.actions);return new D$(this.actions,D)}async getSearchSuggestions(A,Q){let B=this.#A,I=new URL(`${NC.YT_SUGGESTIONS}/complete/search`);if(I.searchParams.set("client","youtube"),I.searchParams.set("gs_ri","youtube"),I.searchParams.set("gs_id","0"),I.searchParams.set("cp","0"),I.searchParams.set("ds","yt"),I.searchParams.set("sugexp",fB.WEB.SUGG_EXP_ID),I.searchParams.set("hl",B.context.client.hl),I.searchParams.set("gl",B.context.client.gl),I.searchParams.set("q",A),Q)I.searchParams.set("pq",Q);let C=await(await B.http.fetch_function(I,{headers:{Cookie:B.cookie||""}})).text();return JSON.parse(C.replace("window.google.ac.h(","").slice(0,-1))[1].map((H)=>H[0])}async getComments(A,Q,B){UD({video_id:A});let I={TOP_COMMENTS:0,NEWEST_FIRST:1},D=MOA.encode({ctx:{videoId:A},unkParam:6,params:{opts:{videoId:A,sortBy:I[Q||"TOP_COMMENTS"],type:2,commentId:B||""},target:"comments-section"}}),C=encodeURIComponent(oC(D.finish())),H=await new h({continuationCommand:{request:"CONTINUATION_REQUEST_TYPE_WATCH_NEXT",token:C}}).call(this.#A.actions);return new xX(this.actions,H.data)}async getHomeFeed(){let Q=await new h({browseEndpoint:{browseId:"FEwhat_to_watch"}}).call(this.#A.actions);return new I$(this.actions,Q)}async getGuide(){let A=await this.actions.execute("/guide");return new E_(A.data)}async getLibrary(){let Q=await new h({browseEndpoint:{browseId:"FElibrary"}}).call(this.#A.actions);return new J_(this.actions,Q)}async getHistory(){let Q=await new h({browseEndpoint:{browseId:"FEhistory"}}).call(this.#A.actions);return new hX(this.actions,Q)}async getCourses(){let Q=await new h({browseEndpoint:{browseId:"FEcourses_destination"}}).call(this.#A.actions,{parse:!0});return new VD(this.actions,Q)}async getSubscriptionsFeed(){let Q=await new h({browseEndpoint:{browseId:"FEsubscriptions"}}).call(this.#A.actions,{parse:!0});return new VD(this.actions,Q)}async getChannelsFeed(){let Q=await new h({browseEndpoint:{browseId:"FEchannels"}}).call(this.#A.actions,{parse:!0});return new VD(this.actions,Q)}async getChannel(A){UD({id:A});let B=await new h({browseEndpoint:{browseId:A}}).call(this.#A.actions,{parse:!0});if(B.on_response_received_actions?.[0]?.is(eU))B=await B.on_response_received_actions[0].endpoint.call(this.#A.actions,{parse:!0});return new b2(this.actions,B,!0)}async getNotifications(){let A=await this.actions.execute("/notification/get_notification_menu",{notificationsMenuRequestType:"NOTIFICATIONS_MENU_REQUEST_TYPE_INBOX"});return new PN(this.actions,A)}async getUnseenNotificationsCount(){let A=await this.actions.execute("/notification/get_unseen_count");return A.data?.unseenCount||A.data?.actions?.[0].updateNotificationsUnseenCountAction?.unseenCount||0}async getPlaylists(){let Q=await new h({browseEndpoint:{browseId:"FEplaylist_aggregation"}}).call(this.#A.actions,{parse:!0});return new VD(this.actions,Q)}async getPlaylist(A){if(UD({id:A}),!A.startsWith("VL"))A=`VL${A}`;let B=await new h({browseEndpoint:{browseId:A}}).call(this.#A.actions);return new xG(this.actions,B)}async getHashtag(A){UD({hashtag:A});let Q=TOA.encode({params:{hashtag:A,type:1}}),B=encodeURIComponent(oC(Q.finish())),D=await new h({browseEndpoint:{browseId:"FEhashtag",params:B}}).call(this.#A.actions);return new MN(this.actions,D)}async getStreamingData(A,Q={}){let I=(await this.getBasicInfo(A,Q)).chooseFormat(Q);return I.url=await I.decipher(this.#A.player),I}async download(A,Q){return(await this.getBasicInfo(A,Q)).download(Q)}async resolveURL(A){let Q=await this.actions.execute("/navigation/resolve_url",{url:A,parse:!0});if(!Q.endpoint)throw new s("Failed to resolve URL. Expected a NavigationEndpoint but got undefined",Q);return Q.endpoint}async getPost(A,Q){UD({post_id:A,channel_id:Q});let B=jOA.encode({f1:{ucid1:Q,postId:A,ucid2:Q}}),I=encodeURIComponent(oC(B.finish()).replace(/\+/g,"-").replace(/\//g,"_")),C=await new h({browseEndpoint:{browseId:"FEpost_detail",params:I}}).call(this.#A.actions,{parse:!0});return new VD(this.actions,C)}async getPostComments(A,Q,B){UD({post_id:A,channel_id:Q});let I={TOP_COMMENTS:0,NEWEST_FIRST:1},D=gOA.encode({title:"posts",commentDataContainer:{title:"comments-section",commentData:{sortBy:I[B||"TOP_COMMENTS"],f0:2,f1:0,channelId:Q,postId:A},f0:0}}),C=yOA.encode({f0:{location:"FEcomment_post_detail_page_web_top_level",protoData:encodeURIComponent(oC(D.finish()).replace(/\+/g,"-").replace(/\//g,"_"))}}),G=encodeURIComponent(oC(C.finish())),Z=await new h({continuationCommand:{request:"CONTINUATION_REQUEST_TYPE_BROWSE",token:G}}).call(this.#A.actions);return new xX(this.actions,Z.data)}async getAttestationChallenge(A,Q){let B={engagementType:A};if(Q)B.ids=Q;return this.actions.execute("/att/get",{parse:!0,...B})}call(A,Q){return A.call(this.actions,Q)}get music(){return new V_(this.#A)}get studio(){return new N_(this.#A)}get kids(){return new O_(this.#A)}get account(){return new R_(this.#A.actions)}get playlist(){return new L_(this.#A.actions)}get interact(){return new M_(this.#A.actions)}get actions(){return this.#A.actions}get session(){return this.#A}}var __dirname="/Users/labithiotis/Work/public/mdl/node_modules/.bun/youtubei.js@17.0.1/node_modules/youtubei.js/dist/src/platform",rwA=import.meta.url,VIQ=!rwA,wIQ=VIQ?__dirname:P_.dirname(OIQ(rwA));class Sl{#A;#Q;constructor(A=!1,Q){this.#A=Q||Sl.default_persistent_directory,this.#Q=A}static get temp_directory(){return`${qIQ.tmpdir()}/youtubei.js`}static get default_persistent_directory(){return P_.resolve(wIQ,"..","..",".cache","youtubei.js")}get cache_dir(){return this.#Q?this.#A:Sl.temp_directory}async#B(){let A=this.cache_dir;try{if(!(await F$.stat(A)).isDirectory())throw Error("An unexpected file was found in place of the cache directory")}catch(Q){if(Q?.code==="ENOENT")await F$.mkdir(A,{recursive:!0});else throw Q}}async get(A){await this.#B();let Q=P_.resolve(this.cache_dir,A);try{if((await F$.stat(Q)).isFile())return(await F$.readFile(Q)).buffer;throw Error("An unexpected file was found in place of the cache key")}catch(B){if(B?.code==="ENOENT")return;throw B}}async set(A,Q){await this.#B();let B=P_.resolve(this.cache_dir,A);await F$.writeFile(B,new Uint8Array(Q))}async remove(A){await this.#B();let Q=P_.resolve(this.cache_dir,A);try{await F$.unlink(Q)}catch(B){if(B?.code==="ENOENT")return;throw B}}}uI.load({runtime:"node",server:!0,Cache:Sl,sha1Hash:async(A)=>{return iwA.createHash("sha1").update(A).digest("hex")},uuidv4(){return iwA.randomUUID()},eval:OIA,fetch:globalThis.fetch,Request:globalThis.Request,Response:globalThis.Response,Headers:globalThis.Headers,FormData:globalThis.FormData,File:globalThis.File,ReadableStream:zIQ,CustomEvent:Ll});class PIA{provider="youtube-music";displayName="YouTube Music";youtubeClientPromise=null;matchesUrl(A){let Q=A.pathname.replace(/\/+$/,"")||"/";return["music.youtube.com","www.youtube.com","youtube.com"].includes(A.hostname.toLowerCase())&&([/^\/playlist$/i].some((B)=>B.test(Q))&&Boolean(A.searchParams.get("list"))||/^\/watch$/i.test(Q)&&Boolean(A.searchParams.get("v"))||[/^\/browse\/(?:MPRE|FEmusic_library_privately_owned_release)[A-Za-z0-9_-]+$/i].some((B)=>B.test(Q)))}async fetch(A,Q){let B=await this.getClient(),I=this.extractAlbumId(A),D=this.extractVideoId(A);if(I){let U=await B.music.getAlbum(I),O=U.header,w=this.extractPlaylistId(U.url??A),L=O?.thumbnail?.contents?.[0]?.url?.trim()||void 0,P=U.contents.map((k,_)=>this.normalizeTrack(k,_,w,L)).filter((k)=>k!==null);if(P.length===0)throw Error("No tracks were found in the YouTube Music album.");return N5(R5,{id:I,title:O?.title?.toString?.().trim()||"YouTube Music Album",artworkUrl:L,provider:"youtube-music",sourceUrl:U.url||A,tracks:P})}if(D)return this.fetchTrack(B,A,D);let C=this.extractPlaylistId(A),{header:G,items:H}=await this.fetchPlaylistItems(B,C),Z=H.map((U,O)=>this.normalizeTrack(U,O,C,G?.thumbnail?.contents?.[0]?.url?.trim()||void 0)).filter((U)=>U!==null);if(Z.length===0)throw Error("No tracks were found in the YouTube Music playlist.");return N5(R5,{id:C,title:G?.title?.toString?.().trim()||"YouTube Music Playlist",artworkUrl:G?.thumbnail?.contents?.[0]?.url?.trim()||void 0,provider:"youtube-music",sourceUrl:A,tracks:Z})}async fetchTrack(A,Q,B){let I=this.tryExtractPlaylistId(Q);if(I){let{header:Z,items:U}=await this.fetchPlaylistItems(A,I),O=U.map((w,L)=>this.normalizeTrack(w,L,I,Z?.thumbnail?.contents?.[0]?.url?.trim()||void 0)).find((w)=>w?.id===B);if(!O)throw Error("Could not find the YouTube Music track in the playlist.");return N5(R5,{id:O.id,title:O.title,owner:O.artists[0],artworkUrl:O.artworkUrl,provider:"youtube-music",sourceUrl:O.sourceUrl||Q,tracks:[O]})}let D=await A.music.getInfo(B),C=D.basic_info?.title?.trim(),G=D.basic_info?.author?.trim();if(!C||!G||!D.basic_info?.id)throw Error("Could not find YouTube Music track metadata.");let H={id:D.basic_info.id,title:C,artists:[G],artworkUrl:D.basic_info.thumbnail?.[0]?.url?.trim()||void 0,durationMs:typeof D.basic_info.duration==="number"?D.basic_info.duration*1000:void 0,sourceUrl:D.basic_info.url_canonical?.trim()||Q};return N5(R5,{id:H.id,title:H.title,owner:G,artworkUrl:H.artworkUrl,provider:"youtube-music",sourceUrl:H.sourceUrl||Q,tracks:[H]})}normalizeTrack(A,Q,B,I){if(A.item_type!=="video")return null;let D=A.title?.toString?.().trim(),C=this.extractContributorNames(A.artists,A.authors);if(!A.id||!D||C.length===0)return null;return{id:A.id,title:D,artists:C,album:A.album?.toString?.().trim()||void 0,artworkUrl:Z0(A.thumbnail?.contents?.[0]?.url,I),durationMs:this.parseDurationMs(A.duration?.toString?.()),sourceUrl:`https://music.youtube.com/watch?v=${A.id}&list=${B}`}}extractContributorNames(A,Q){return((A?.length)?A:Q??[]).map((I)=>typeof I==="object"&&("name"in I)?I.name?.trim():I?.toString?.().trim()).filter((I)=>Boolean(I))}extractPlaylistId(A){let Q=this.tryExtractPlaylistId(A);if(!Q)throw Error("Could not determine the YouTube Music playlist id from the URL.");return Q}tryExtractPlaylistId(A){return new URL(A).searchParams.get("list")?.trim()||null}extractVideoId(A){let Q=new URL(A);if(!/^\/watch$/i.test(Q.pathname))return null;return Q.searchParams.get("v")?.trim()||null}extractAlbumId(A){return new URL(A).pathname.match(/\/browse\/((?:MPRE|FEmusic_library_privately_owned_release)[A-Za-z0-9_-]+)/i)?.[1]??null}parseDurationMs(A){if(!A)return;let Q=A.split(":").map((C)=>Number.parseInt(C,10)).filter((C)=>Number.isFinite(C));if(Q.length<2||Q.length>3)return;let[B,I,D]=Q.length===3?Q:[0,Q[0],Q[1]];return((B*60+I)*60+D)*1000}async getClient(){return this.youtubeClientPromise??=Q7.create(),this.youtubeClientPromise}async fetchPlaylistItems(A,Q){let B=await A.music.getPlaylist(Q),I=[...B.items];while(B.has_continuation)B=await B.getContinuation(),I.push(...B.items);return{header:B.header,items:I}}}var twA=[new qBA,new UBA,new KBA,new PIA,new zBA,new $BA,new WBA,new YBA,new VBA],SIA=Object.fromEntries(twA.map((A)=>[A.provider,A])),TIA=twA,kl=TIA.map(({provider:A})=>A);function mG(A){return SIA[A]?.displayName??"Spotify"}function awA(A){let Q=_l(A);if(!Q)return"unknown";return Tl(Q)?.provider??kIA(Q)??"unknown"}function _IA(A){let Q=A.trim();if(!Q)return"Enter a music URL.";let B=_l(Q);if(!B)return"Invalid URL. Provide a full http:// or https:// music URL.";if(Tl(B)||kIA(B))return null;return`Unsupported music URL. Recognized providers: ${kl.map(mG).join(", ")}.`}async function ewA(A,Q){let B=_IA(A);if(B)throw Error(B);let I=_l(A);if(!I)throw Error("Invalid URL. Provide a full http:// or https:// music URL.");let D=Tl(I);if(D)return D;let C=kIA(I);if(!C)throw Error(`Unsupported music URL. Recognized providers: ${kl.map(mG).join(", ")}.`);let H=await(Q?.resolveUrl??LIQ)(I.toString()),Z=_l(H);if(!Z)throw Error(`Could not resolve the ${mG(C)} short link to a valid music URL.`);let U=Tl(Z);if(!U||U.provider!==C)throw Error(`Could not resolve the ${mG(C)} short link to a supported music URL.`);return U}function Tl(A){let Q=TIA.find((B)=>B.matchesUrl(A));if(!Q)return null;return{provider:Q.provider,normalizedUrl:RIQ(A,Q.provider)}}function kIA(A){let Q=A.hostname.toLowerCase();return TIA.find((B)=>B.shortLinkHosts?.includes(Q))?.provider??null}function _l(A){try{let Q=new URL(A.trim());if(Q.protocol!=="http:"&&Q.protocol!=="https:")return null;return Q}catch{return null}}function NIQ(A){let Q=new URL(A.toString());return Q.search="",Q.hash="",Q.toString()}function RIQ(A,Q){if(Q==="apple-music")return swA(A,["i"]);if(Q==="amazon-music")return swA(A,["trackAsin"]);if(Q!=="youtube-music")return NIQ(A);let B=new URL(A.toString()),I=B.searchParams.get("list")?.trim(),D=B.searchParams.get("v")?.trim();if(B.search="",B.hash="",D)B.searchParams.set("v",D);if(I)B.searchParams.set("list",I);return B.toString()}function swA(A,Q){let B=new URL(A.toString()),I=Q.map((D)=>[D,B.searchParams.get(D)?.trim()]).filter((D)=>Boolean(D[1]));B.search="",B.hash="";for(let[D,C]of I)B.searchParams.set(D,C);return B.toString()}async function LIQ(A){let Q=await fetch(A,{headers:{"user-agent":"mdl/0.1"},redirect:"follow"});if(!Q.ok)throw Error(`Short link request failed with status ${Q.status}.`);if(Q.url&&Q.url!==A)return Q.url;let B=await Q.text();return MIQ(B)??Q.url??A}function MIQ(A){return A.match(/https?:\/\/[^\s"'<>]+/i)?.[0]??null}import{access as GDQ,stat as FDQ}from"node:fs/promises";import S_ from"node:path";var vIA=kQ(jIA(),1);import{execFile as xIQ}from"node:child_process";import{mkdtemp as hIQ,rename as mIQ,rm as fIQ,writeFile as uIQ}from"node:fs/promises";import yN from"node:path";import{promisify as cIQ}from"node:util";var lIQ=cIQ(xIQ),dIQ=".mdl-metadata-";async function CNA(A){let{filePath:Q,track:B,signal:I}=A,D=await Vq(),C=await hIQ(yN.join(yN.dirname(Q),dIQ)),G=yN.join(C,yN.basename(Q)),H=B.artworkUrl?yN.join(C,nIQ(B.artworkUrl)):null;try{if(H&&B.artworkUrl)try{await oIQ(B.artworkUrl,H,I)}catch{H=null}let Z=["-y","-i",Q,...H?["-i",H]:[],"-map","0:a",...H?["-map","1:v"]:[],"-c","copy","-id3v2_version","3",...pIQ(B,Boolean(H)),G];await lIQ(D,Z,{maxBuffer:8388608,signal:I}),await mIQ(G,Q)}finally{await fIQ(C,{recursive:!0,force:!0})}}function pIQ(A,Q){let B=["-metadata",`title=${A.title}`,"-metadata",`artist=${A.artists.join(", ")}`];if(A.album)B.push("-metadata",`album=${A.album}`);if(Q)B.push("-metadata:s:v","title=Album cover","-metadata:s:v","comment=Cover (front)","-disposition:v:0","attached_pic");return B}async function oIQ(A,Q,B){let I=await fetch(A,{signal:B});if(!I.ok)throw Error(`Failed to download artwork (${I.status})`);let D=await I.arrayBuffer();await uIQ(Q,Buffer.from(D))}function nIQ(A){return`cover${yN.extname(new URL(A).pathname)||".jpg"}`}var XNA=kQ(jIA(),1);import{execFile as HNA}from"node:child_process";import{mkdir as iIQ}from"node:fs/promises";import rIQ from"node:path";import{Readable as sIQ}from"node:stream";import{pipeline as tIQ}from"node:stream/promises";import{promisify as aIQ}from"node:util";var wjB=aIQ(HNA),eIQ=5,JNA=null;sB.setLevel(sB.Level.ERROR);async function ZNA(A){let Q=`${A.artists.join(", ")} - ${A.title} audio`,I=(await ADQ(Q)).videos.filter((D)=>D.id&&D.url).sort((D,C)=>GNA(A,C)-GNA(A,D));if(I.length===0)throw Error(`No YouTube match found for ${A.artists.join(", ")} - ${A.title}.`);return I}async function KNA(A){let{audioFormat:Q="mp3",audioQuality:B="best",destinationDir:I,index:D,onProgress:C,track:G,youtubeUrl:H,signal:Z}=A,O=`${`${String(D).padStart(2,"0")} - ${XNA.default(`${G.artists.join(", ")} - ${G.title}`)||`track-${D}`}`}.${Q}`,w=rIQ.join(I,O);return await iIQ(I,{recursive:!0}),await BDQ({audioFormat:Q,audioQuality:B,destinationPath:w,onProgress:C,youtubeUrl:H,signal:Z}),{fileName:O,relativePath:O}}async function ADQ(A){return{videos:(await(await UNA()).search(A)).results.map((D)=>QDQ(D)).filter((D)=>D!==null).slice(0,eIQ)}}function QDQ(A){if(A.type!=="Video"||!A.id)return null;let Q=A.title?.toString?.().trim();if(!Q)return null;return{id:A.id,title:Q,author:A.author?.name?.trim(),url:`https://www.youtube.com/watch?v=${A.id}`,seconds:JDQ(A.duration?.text)}}function GNA(A,Q){let B=0,I=`${Q.title} ${Q.author??""}`.toLowerCase();if(I.includes(A.title.toLowerCase()))B+=5;for(let D of A.artists)if(I.includes(D.toLowerCase()))B+=3;if(!I.includes("live"))B+=1;if(!I.includes("cover"))B+=1;if(typeof A.durationMs==="number"&&typeof Q.seconds==="number"){let D=Math.abs(A.durationMs/1000-Q.seconds);B+=Math.max(0,10-D/5)}return B}async function BDQ(A){let Q=await Vq(),B=await IDQ(A.youtubeUrl,A.audioFormat),I=DDQ({audioFormat:A.audioFormat,audioQuality:A.audioQuality,destinationPath:A.destinationPath,inputFormat:B.format}),D=HNA(Q,I,{signal:A.signal,windowsHide:!0}),C=sIQ.fromWeb(B.stream);if(!D.stdin)throw C.destroy(),Error("ffmpeg stdin was not available for audio piping.");let G="",H=EDQ((U)=>{A.onProgress?.({currentSpeed:U.currentSpeed,eta:U.eta,percent:typeof B.contentLength==="number"&&B.contentLength>0?Math.min(100,U.totalSizeBytes/B.contentLength*100):void 0,totalSize:FNA(B.contentLength)||FNA(U.totalSizeBytes)})});D.stderr?.on("data",(U)=>{let O=U.toString();G+=O,H(O)});let Z=new Promise((U,O)=>{D.on("error",O),D.on("close",(w)=>{if(w===0){U();return}O(Error(G.trim()||`ffmpeg exited with code ${w}.`))})});try{await Promise.all([tIQ(C,D.stdin),Z])}catch(U){throw C.destroy(),D.kill("SIGKILL"),U}}async function IDQ(A,Q){let B=CDQ(A),I=await UNA(),D=await I.getStreamingData(B,{client:"ANDROID",type:"audio",format:Q==="opus"?"webm":"mp4"}),C=await I.download(B,{client:"ANDROID",type:"audio",format:Q==="opus"?"webm":"mp4"}),G=String(D.mime_type),H=G.includes("webm")?"webm":"mp4";return{contentLength:typeof D.content_length==="number"?D.content_length:void 0,format:H,mimeType:G,stream:C}}function DDQ(A){let Q=["-y","-v","error","-nostats","-progress","pipe:2","-f",A.inputFormat,"-i","pipe:0","-vn"];if(A.audioQuality!=="best"){if(/^\d+K$/i.test(A.audioQuality))Q.push("-b:a",A.audioQuality);else if(/^\d+$/.test(A.audioQuality)&&A.audioFormat==="mp3")Q.push("-q:a",A.audioQuality)}switch(A.audioFormat){case"m4a":Q.push("-c:a","aac");break;case"opus":Q.push("-c:a","libopus");break;case"flac":Q.push("-c:a","flac");break;case"wav":Q.push("-c:a","pcm_s16le");break;default:Q.push("-c:a","libmp3lame");break}return Q.push(A.destinationPath),Q}function EDQ(A){let Q="",B={totalSizeBytes:0};return(I)=>{Q+=I;while(Q.includes(`
|
|
524
|
+
${BwA(w.n,w.sp,w.sig)}`;let P=await uI.shim.eval(L,w);if(typeof P!=="object"||P===null)throw new eF("Got invalid result from player script evaluation.");if(typeof w.sig==="string"){let k=P.sig;if(sB.info(B9,`Transformed signature from ${H} to ${k}.`),typeof k!=="string")throw new eF("Got invalid signature from player script evaluation.");if(Z)C.searchParams.set(Z,k);else C.searchParams.set("signature",k)}if(typeof w.n==="string"){let k=P.n;if(sB.info(B9,`Transformed n from ${G} to ${k}.`),typeof k!=="string")throw new eF("Failed to decipher nsig");if(k.startsWith("enhanced_except_"))sB.warn(B9,`Decipher script returned an error (n=${G}):`,k);else if(I)I.set(G,k);C.searchParams.set("n",k)}}}if(C.searchParams.get("sabr")!=="1"&&this.po_token)C.searchParams.set("pot",this.po_token);switch(C.searchParams.get("c")){case"WEB":C.searchParams.set("cver",RI.CLIENTS.WEB.VERSION);break;case"MWEB":C.searchParams.set("cver",RI.CLIENTS.MWEB.VERSION);break;case"WEB_REMIX":C.searchParams.set("cver",RI.CLIENTS.YTMUSIC.VERSION);break;case"WEB_KIDS":C.searchParams.set("cver",RI.CLIENTS.WEB_KIDS.VERSION);break;case"TVHTML5":C.searchParams.set("cver",RI.CLIENTS.TV.VERSION);break;case"TVHTML5_SIMPLY":C.searchParams.set("cver",RI.CLIENTS.TV_SIMPLY.VERSION);break;case"TVHTML5_SIMPLY_EMBEDDED_PLAYER":C.searchParams.set("cver",RI.CLIENTS.TV_EMBEDDED.VERSION);break;case"WEB_EMBEDDED_PLAYER":C.searchParams.set("cver",RI.CLIENTS.WEB_EMBEDDED.VERSION);break}let O=C.toString();return sB.info(B9,`Deciphered URL: ${O}`),C.toString()}static async fromCache(A,Q){let B=await A.get(Q);if(!B)return null;try{let I=L5.deserialize(new Uint8Array(B));if(I.libraryVersion!==A8.version)return sB.warn(B9,`Cached player data is from a different library version (${I.libraryVersion}). Ignoring it.`),null;return new A7(I.playerId,I.signatureTimestamp,I.data)}catch(I){return sB.error(B9,"Failed to deserialize player data from cache:",I),null}}static async fromSource(A,Q){let B=new A7(A,Q.signature_timestamp,Q.data);return await B.cache(Q.cache),B}async cache(A){if(!A||!this.data)return;let Q=L5.serialize({playerId:this.player_id,signatureTimestamp:this.signature_timestamp,libraryVersion:A8.version,data:this.data});await A.set(this.player_id,Q)}get url(){return new URL(`/s/player/${this.player_id}/player_ias.vflset/en_US/base.js`,RI.URLS.YT_BASE).toString()}static get LIBRARY_VERSION(){return 14}}var $BQ={WEB:"WEB",MWEB:"MWEB",KIDS:"WEB_KIDS",MUSIC:"WEB_REMIX",IOS:"iOS",ANDROID:"ANDROID",ANDROID_VR:"ANDROID_VR",ANDROID_MUSIC:"ANDROID_MUSIC",ANDROID_CREATOR:"ANDROID_CREATOR",TV:"TVHTML5",TV_SIMPLY:"TVHTML5_SIMPLY",TV_EMBEDDED:"TVHTML5_SIMPLY_EMBEDDED_PLAYER",WEB_EMBEDDED:"WEB_EMBEDDED_PLAYER",WEB_CREATOR:"WEB_CREATOR"},hG="Session";class G$ extends hU{context;api_key;api_version;account_index;config_data;player;cookie;cache;po_token;oauth;http;logged_in;actions;user_agent;constructor(A,Q,B,I,D,C,G,H,Z,U){super();this.context=A,this.api_key=Q,this.api_version=B,this.account_index=I,this.config_data=D,this.player=C,this.cookie=G,this.cache=Z,this.po_token=U,this.http=new vT(this,G,H),this.actions=new W_(this),this.oauth=new q_(this),this.logged_in=!!G,this.user_agent=A.client.userAgent}on(A,Q){super.on(A,Q)}once(A,Q){super.once(A,Q)}static async create(A={}){let{context:Q,api_key:B,api_version:I,account_index:D,config_data:C}=await G$.getSessionData(A.lang,A.location,A.account_index,A.visitor_data,A.user_agent,A.enable_safety_mode,A.generate_session_locally,A.fail_fast,A.device_category,A.client_type,A.timezone,A.fetch,A.on_behalf_of_user,A.cache,A.enable_session_cache,A.po_token,A.retrieve_innertube_config);return new G$(Q,B,I,D,C,A.retrieve_player===!1?void 0:await A7.create(A.cache,A.fetch,A.po_token,A.player_id),A.cookie,A.fetch,A.cache,A.po_token)}static async fromCache(A,Q){let B=await A.get("innertube_session_data");if(!B)return null;try{let I=L5.deserialize(new Uint8Array(B));if(I.library_version!==parseInt(A8.version.split(".",1)[0]))return sB.warn(hG,`Cached session data is from a different library version (${I.library_version}). Regenerating session data.`),null;if(Q.visitor_data)I.context.client.visitorData=Q.visitor_data;if(Q.lang)I.context.client.hl=Q.lang;if(Q.location)I.context.client.gl=Q.location;if(Q.on_behalf_of_user)I.context.user.onBehalfOfUser=Q.on_behalf_of_user;if(Q.user_agent)I.context.client.userAgent=Q.user_agent;if(Q.client_name){let D=Object.values(fB).find((C)=>C.NAME===Q.client_name);if(D)I.context.client.clientName=D.NAME,I.context.client.clientVersion=D.VERSION;else sB.warn(hG,`Unknown client name: ${Q.client_name}.`)}return I.context.client.timeZone=Q.time_zone,I.context.client.platform=Q.device_category.toUpperCase(),I.context.user.enableSafetyMode=Q.enable_safety_mode,I}catch(I){return sB.error(hG,"Failed to deserialize session data from cache.",I),null}}static async getSessionData(A="",Q="",B=0,I="",D=Rl("desktop"),C=!1,G=!1,H=!1,Z="desktop",U=$BQ.WEB,O=Intl.DateTimeFormat().resolvedOptions().timeZone,w=uI.shim.fetch,L,P,k=!0,_,x=!0){let l={lang:A,location:Q,time_zone:O,user_agent:D,device_category:Z,client_name:U,enable_safety_mode:C,visitor_data:I,on_behalf_of_user:L,po_token:_},GA;if(P&&k){let o=await this.fromCache(P,l);if(o)sB.info(hG,"Found session data in cache."),GA=o}if(!GA){sB.info(hG,"Generating session data.");let o=fB.WEB.API_KEY,BA=fB.WEB.API_VERSION,JA={hl:A||"en",gl:Q||"US",remote_host:"",user_agent:D,visitor_data:I||mU.encodeVisitorData(yJ(11),Math.floor(Date.now()/1000)),client_name:U,client_version:Object.values(fB).find((XA)=>XA.NAME===U)?.VERSION??fB.WEB.VERSION,device_category:Z.toUpperCase(),os_name:"Windows",os_version:"10.0",time_zone:O,browser_name:"Chrome",browser_version:"125.0.0.0",device_make:"",device_model:"",enable_safety_mode:C};if(!G)try{let XA=await this.#Q(l,w);o=XA.api_key,BA=XA.api_version,JA=XA.context_data}catch(XA){if(H)throw XA;sB.error(hG,"Failed to retrieve session data from server. Session data generated locally will be used instead.",XA)}if(L)JA.on_behalf_of_user=L;if(GA={api_key:o,api_version:BA,context:this.#B(JA)},x)try{sB.info(hG,"Retrieving InnerTube config data.");let XA={"Accept-Language":A,Accept:"*/*",Referer:NC.YT_BASE,"X-Goog-Visitor-Id":JA.visitor_data,"X-Origin":NC.YT_BASE,"X-Youtube-Client-Version":JA.client_version};if(uI.shim.server)XA["User-Agent"]=D,XA.Origin=NC.YT_BASE;let OA=await(await w(`${NC.API.PRODUCTION_1}v1/config?prettyPrint=false`,{headers:XA,method:"POST",body:JSON.stringify({context:GA.context})})).json(),fA=OA.responseContext?.globalConfigGroup?.rawColdConfigGroup?.configData,RA=OA.responseContext?.globalConfigGroup?.coldHashData,LA=OA.responseContext?.globalConfigGroup?.hotHashData;GA.config_data=OA.configData,GA.context.client.configInfo={...GA.context.client.configInfo,coldConfigData:fA,coldHashData:RA,hotHashData:LA}}catch(XA){sB.error(hG,"Failed to retrieve config data.",XA)}if(k)await this.#A(GA,P)}return sB.debug(hG,"Session data:",GA),{...GA,account_index:B}}static async#A(A,Q){if(!Q)return;sB.info(hG,"Compressing and caching session data.");let B=L5.serialize({...A,library_version:parseInt(A8.version)});await Q.set("innertube_session_data",B)}static async#Q(A,Q=uI.shim.fetch){let B=yJ(11);if(A.visitor_data)B=this.#I(A.visitor_data);let I=new URL("/sw.js_data",NC.YT_BASE),D=await Q(I,{headers:{"Accept-Language":A.lang||"en-US","User-Agent":A.user_agent,Accept:"*/*",Referer:`${NC.YT_BASE}/sw.js`,Cookie:`PREF=tz=${A.time_zone.replace("/",".")};VISITOR_INFO1_LIVE=${B};`}});if(!D.ok)throw new Nl(`Failed to retrieve session data: ${D.status}`);let C=await D.text();if(!C.startsWith(")]}'"))throw new Nl("Invalid JSPB response");let H=JSON.parse(C.replace(/^\)\]\}'/,""))[0][2],Z=fB.WEB.API_VERSION,[[U],O]=H,w=U[61],L=w[w.length-1];return{context_data:{hl:A.lang||U[0],gl:A.location||U[1],remote_host:U[3],visitor_data:A.visitor_data||U[13],user_agent:A.user_agent,client_name:A.client_name,client_version:A.client_name==="WEB"?U[16]:Object.values(fB).find((k)=>k.NAME===A.client_name)?.VERSION||U[16],os_name:U[17],os_version:U[18],time_zone:U[79]||A.time_zone,device_category:A.device_category,browser_name:U[86],browser_version:U[87],device_make:U[11],device_model:U[12],app_install_data:L,device_experiment_id:U[103],rollout_token:U[107],enable_safety_mode:A.enable_safety_mode},api_key:O,api_version:Z}}static#B(A){let Q={client:{hl:A.hl||"en",gl:A.gl||"US",remoteHost:A.remote_host,screenDensityFloat:1,screenHeightPoints:1440,screenPixelDensity:1,screenWidthPoints:2560,visitorData:A.visitor_data,clientName:A.client_name,clientVersion:A.client_version,osName:A.os_name,osVersion:A.os_version,userAgent:A.user_agent,platform:A.device_category.toUpperCase(),clientFormFactor:"UNKNOWN_FORM_FACTOR",userInterfaceTheme:"USER_INTERFACE_THEME_LIGHT",timeZone:A.time_zone,originalUrl:NC.YT_BASE,deviceMake:A.device_make,deviceModel:A.device_model,browserName:A.browser_name,browserVersion:A.browser_version,utcOffsetMinutes:-Math.floor(new Date().getTimezoneOffset()),memoryTotalKbytes:"8000000",rolloutToken:A.rollout_token,deviceExperimentId:A.device_experiment_id,mainAppWebInfo:{graftUrl:NC.YT_BASE,pwaInstallabilityStatus:"PWA_INSTALLABILITY_STATUS_UNKNOWN",webDisplayMode:"WEB_DISPLAY_MODE_BROWSER",isWebNativeShareAvailable:!0}},user:{enableSafetyMode:A.enable_safety_mode,lockedSafetyMode:!1},request:{useSsl:!0,internalExperimentFlags:[]}};if(A.app_install_data)Q.client.configInfo={appInstallData:A.app_install_data};if(A.on_behalf_of_user)Q.user.onBehalfOfUser=A.on_behalf_of_user;return Q}static#I(A){return mU.decodeVisitorData(A).id}async signIn(A){return new Promise(async(Q,B)=>{let I=(D)=>B(D);this.once("auth-error",I),this.once("auth",()=>{this.off("auth-error",I),this.logged_in=!0,Q()});try{await this.oauth.init(A)}catch(D){B(D)}})}async signOut(){if(!this.logged_in)throw new s("You must be signed in to perform this operation.");let A=await this.oauth.revokeCredentials();return this.logged_in=!1,A}get client_version(){return this.context.client.clientVersion}get client_name(){return this.context.client.clientName}get lang(){return this.context.client.hl}}class O_{#A;constructor(A){this.#A=A}async search(A){let B=await new h({searchEndpoint:{query:A}}).call(this.#A.actions,{client:"YTKIDS"});return new U_(this.#A.actions,B)}async getInfo(A,Q){let B={videoId:A},I=new h({watchEndpoint:B}),D=new h({watchNextEndpoint:B}),C=this.#A,G={playbackContext:{contentPlaybackContext:{vis:0,splay:!1,lactMilliseconds:"-1",signatureTimestamp:C.player?.signature_timestamp}},client:"YTKIDS"};if(Q?.po_token)G.serviceIntegrityDimensions={poToken:Q.po_token};else if(C.po_token)G.serviceIntegrityDimensions={poToken:C.po_token};let H=I.call(C.actions,G),Z=D.call(C.actions,{client:"YTKIDS"}),U=await Promise.all([H,Z]),O=yJ(16);return new $_(U,C.actions,O)}async getChannel(A){let B=await new h({browseEndpoint:{browseId:A}}).call(this.#A.actions,{client:"YTKIDS"});return new _N(this.#A.actions,B)}async getHomeFeed(){let Q=await new h({browseEndpoint:{browseId:"FEkids_home"}}).call(this.#A.actions,{client:"YTKIDS"});return new kN(this.#A.actions,Q)}async blockChannel(A){let Q=this.#A;if(!Q.logged_in)throw new s("You must be signed in to perform this operation.");let C={contents:(await new h({getKidsBlocklistPickerCommand:{blockedForKidsContent:{external_channel_id:A}}}).call(Q.actions,{client:"YTKIDS"})).data.command.confirmDialogEndpoint.content,engagementPanels:[]},H=N.parseResponse(C).contents_memo?.getType(gX);if(!H)throw new s("Could not find any kids profiles or supervised accounts.");let Z=[];for(let U of H)if(!U.block_button?.is_toggled)U.setActions(Q.actions),Z.push(await U.blockChannel());return Z}}class V_{#A;#Q;constructor(A){this.#A=A,this.#Q=A.actions}getInfo(A,Q){if(A instanceof qX)return this.#I(A.endpoint,Q);else if(A instanceof D8)return this.#I(A.overlay?.content?.endpoint??A.endpoint,Q);else if(A instanceof h)return this.#I(A,Q);return this.#B(A,Q)}async#B(A,Q){let B={videoId:A,racyCheckOk:!0,contentCheckOk:!0},I=new h({watchEndpoint:B}),D=new h({watchNextEndpoint:B}),C={playbackContext:{contentPlaybackContext:{vis:0,splay:!1,lactMilliseconds:"-1",signatureTimestamp:this.#A.player?.signature_timestamp}},client:"YTMUSIC"};if(Q?.po_token)C.serviceIntegrityDimensions={poToken:Q.po_token};else if(this.#A.po_token)C.serviceIntegrityDimensions={poToken:this.#A.po_token};let G=I.call(this.#Q,C),H=D.call(this.#Q,{client:"YTMUSIC"}),Z=await Promise.all([G,H]),U=yJ(16);return new wl(Z,this.#Q,U)}async#I(A,Q){if(!A)throw Error("This item does not have an endpoint.");let B={playbackContext:{contentPlaybackContext:{vis:0,splay:!1,lactMilliseconds:"-1",signatureTimestamp:this.#A.player?.signature_timestamp}},client:"YTMUSIC"};if(Q?.po_token)B.serviceIntegrityDimensions={poToken:Q.po_token};else if(this.#A.po_token)B.serviceIntegrityDimensions={poToken:this.#A.po_token};let I=A.call(this.#Q,B),D=A.call(this.#Q,{client:"YTMUSIC",enablePersistentPlaylistPanel:!0,override_endpoint:"/next"}),C=yJ(16),G=await Promise.all([I,D]);return new wl(G,this.#Q,C)}async search(A,Q={}){UD({query:A});let B;if(Q.type&&Q.type!=="all"){let C=th.encode({filters:{musicSearchType:{[Q.type]:!0}}});B=encodeURIComponent(oC(C.finish()))}let D=await new h({searchEndpoint:{query:A,params:B}}).call(this.#Q,{client:"YTMUSIC"});return new J$(D,this.#Q,Reflect.has(Q,"type")&&Q.type!=="all")}async getHomeFeed(){let Q=await new h({browseEndpoint:{browseId:"FEmusic_home"}}).call(this.#Q,{client:"YTMUSIC"});return new C$(Q,this.#Q)}async getExplore(){let Q=await new h({browseEndpoint:{browseId:"FEmusic_explore"}}).call(this.#Q,{client:"YTMUSIC"});return new Z_(Q)}async getLibrary(){let Q=await new h({browseEndpoint:{browseId:"FEmusic_library_landing"}}).call(this.#Q,{client:"YTMUSIC"});return new TN(Q,this.#Q)}async getArtist(A){if(!A||!A.startsWith("UC")&&!A.startsWith("FEmusic_library_privately_owned_artist"))throw new s("Invalid artist id",A);let B=await new h({browseEndpoint:{browseId:A}}).call(this.#Q,{client:"YTMUSIC"});return new X_(B,this.#Q)}async getAlbum(A){if(!A||!A.startsWith("MPR")&&!A.startsWith("FEmusic_library_privately_owned_release"))throw new s("Invalid album id",A);let B=await new h({browseEndpoint:{browseId:A}}).call(this.#Q,{client:"YTMUSIC"});return new H_(B)}async getPlaylist(A){if(!A.startsWith("VL"))A=`VL${A}`;let B=await new h({browseEndpoint:{browseId:A}}).call(this.#Q,{client:"YTMUSIC"});return new mX(B,this.#Q)}async getUpNext(A,Q=!0){UD({video_id:A});let C=(await new h({watchNextEndpoint:{videoId:A}}).call(this.#Q,{client:"YTMUSIC",parse:!0})).contents_memo?.getType(nE)?.[0];if(!C)throw new s("Could not find target tab.");let G=C.content?.as(VX);if(!G||!G.content)throw new s("Music queue was empty, the given id is probably invalid.",G);let H=G.content.as(V4);if(!H.playlist_id&&Q){let Z=H.contents.firstOfType(zG);if(!Z)throw new s("Automix item not found");let U=await Z.playlist_video?.endpoint.call(this.#Q,{videoId:A,client:"YTMUSIC",parse:!0});if(!U||!U.contents_memo)throw new s("Could not fetch automix");return U.contents_memo.getType(V4)[0]}return H}async getRelated(A){UD({video_id:A});let D=(await new h({watchNextEndpoint:{videoId:A}}).call(this.#Q,{client:"YTMUSIC",parse:!0})).contents_memo?.getType(nE)?.find((G)=>G.endpoint.payload.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType==="MUSIC_PAGE_TYPE_TRACK_RELATED");if(!D)throw new s("Could not find target tab.");let C=await D.endpoint.call(this.#Q,{client:"YTMUSIC",parse:!0});if(!C.contents)throw new s("Unexpected response",C);return C.contents.item().as(WI,EC)}async getLyrics(A){UD({video_id:A});let D=(await new h({watchNextEndpoint:{videoId:A}}).call(this.#Q,{client:"YTMUSIC",parse:!0})).contents_memo?.getType(nE)?.find((H)=>H.endpoint.payload.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType==="MUSIC_PAGE_TYPE_TRACK_LYRICS");if(!D)throw new s("Could not find target tab.");let C=await D.endpoint.call(this.#Q,{client:"YTMUSIC",parse:!0});if(!C.contents)throw new s("Unexpected response",C);if(C.contents.item().type==="Message")throw new s(C.contents.item().as(EC).text.toString(),A);return C.contents.item().as(WI).contents.firstOfType(SG)}async getRecap(){let Q=await new h({browseEndpoint:{browseId:"FEmusic_listening_review"}}).call(this.#Q,{client:"YTMUSIC"});return new K_(Q,this.#Q)}async getSearchSuggestions(A){let Q=await this.#Q.execute("/music/get_search_suggestions",{input:A,client:"YTMUSIC",parse:!0});if(!Q.contents_memo)return[];return Q.contents_memo.getType(BN)}}function YBQ(){return{profile:void 0,supportedCapabilities:[],disabledCapabilities:[],snapshot:void 0}}var VIA={encode(A,Q=new wQ){if(A.profile!==void 0)Q.uint32(10).string(A.profile);for(let B of A.supportedCapabilities)Ml.encode(B,Q.uint32(18).fork()).join();for(let B of A.disabledCapabilities)Ml.encode(B,Q.uint32(26).fork()).join();if(A.snapshot!==void 0)Q.uint32(42).string(A.snapshot);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=YBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.profile=B.string();continue}case 2:{if(C!==18)break;D.supportedCapabilities.push(Ml.decode(B,B.uint32()));continue}case 3:{if(C!==26)break;D.disabledCapabilities.push(Ml.decode(B,B.uint32()));continue}case 5:{if(C!==42)break;D.snapshot=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function WBQ(){return{capability:void 0,features:void 0,experimentFlags:void 0}}var Ml={encode(A,Q=new wQ){if(A.capability!==void 0)Q.uint32(8).uint32(A.capability);if(A.features!==void 0)Q.uint32(16).uint32(A.features);if(A.experimentFlags!==void 0)Q.uint32(50).string(A.experimentFlags);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=WBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.capability=B.uint32();continue}case 2:{if(C!==16)break;D.features=B.uint32();continue}case 6:{if(C!==50)break;D.experimentFlags=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function zBQ(){return{hl:void 0,gl:void 0,remoteHost:void 0,deviceId:void 0,debugDeviceIdOverride:void 0,carrierGeo:void 0,crackedHl:void 0,deviceMake:void 0,deviceModel:void 0,visitorData:void 0,userAgent:void 0,clientName:void 0,clientVersion:void 0,osName:void 0,osVersion:void 0,projectId:void 0,acceptLanguage:void 0,acceptRegion:void 0,originalUrl:void 0,rawDeviceId:void 0,configData:void 0,spacecastToken:void 0,internalGeo:void 0,screenWidthPoints:void 0,screenHeightPoints:void 0,screenWidthInches:void 0,screenHeightInches:void 0,screenPixelDensity:void 0,platform:void 0,spacecastClientInfo:void 0,clientFormFactor:void 0,forwardedFor:void 0,mobileDataPlanInfo:void 0,gmscoreVersionCode:void 0,webpSupport:void 0,cameraType:void 0,experimentsToken:void 0,windowWidthPoints:void 0,windowHeightPoints:void 0,configInfo:void 0,unpluggedLocationInfo:void 0,androidSdkVersion:void 0,screenDensityFloat:void 0,firstTimeSignInExperimentIds:void 0,utcOffsetMinutes:void 0,animatedWebpSupport:void 0,kidsAppInfo:void 0,musicAppInfo:void 0,tvAppInfo:void 0,internalGeoIp:void 0,unpluggedAppInfo:void 0,locationInfo:void 0,contentSizeCategory:void 0,fontScale:void 0,userInterfaceTheme:void 0,timeZone:void 0,homeGroupInfo:void 0,emlTemplateContext:void 0,coldAppBundleConfigData:void 0,browserName:void 0,browserVersion:void 0,locationPlayabilityToken:void 0,chipset:void 0,firmwareVersion:void 0,memoryTotalKbytes:void 0,mainAppWebInfo:void 0,notificationPermissionInfo:void 0,deviceBrand:void 0,glDeviceInfo:void 0}}var w_={encode(A,Q=new wQ){if(A.hl!==void 0)Q.uint32(10).string(A.hl);if(A.gl!==void 0)Q.uint32(18).string(A.gl);if(A.remoteHost!==void 0)Q.uint32(34).string(A.remoteHost);if(A.deviceId!==void 0)Q.uint32(50).string(A.deviceId);if(A.debugDeviceIdOverride!==void 0)Q.uint32(66).string(A.debugDeviceIdOverride);if(A.carrierGeo!==void 0)Q.uint32(82).string(A.carrierGeo);if(A.crackedHl!==void 0)Q.uint32(88).bool(A.crackedHl);if(A.deviceMake!==void 0)Q.uint32(98).string(A.deviceMake);if(A.deviceModel!==void 0)Q.uint32(106).string(A.deviceModel);if(A.visitorData!==void 0)Q.uint32(114).string(A.visitorData);if(A.userAgent!==void 0)Q.uint32(122).string(A.userAgent);if(A.clientName!==void 0)Q.uint32(128).int32(A.clientName);if(A.clientVersion!==void 0)Q.uint32(138).string(A.clientVersion);if(A.osName!==void 0)Q.uint32(146).string(A.osName);if(A.osVersion!==void 0)Q.uint32(154).string(A.osVersion);if(A.projectId!==void 0)Q.uint32(162).string(A.projectId);if(A.acceptLanguage!==void 0)Q.uint32(170).string(A.acceptLanguage);if(A.acceptRegion!==void 0)Q.uint32(178).string(A.acceptRegion);if(A.originalUrl!==void 0)Q.uint32(186).string(A.originalUrl);if(A.rawDeviceId!==void 0)Q.uint32(202).string(A.rawDeviceId);if(A.configData!==void 0)Q.uint32(218).string(A.configData);if(A.spacecastToken!==void 0)Q.uint32(250).string(A.spacecastToken);if(A.internalGeo!==void 0)Q.uint32(274).string(A.internalGeo);if(A.screenWidthPoints!==void 0)Q.uint32(296).int32(A.screenWidthPoints);if(A.screenHeightPoints!==void 0)Q.uint32(304).int32(A.screenHeightPoints);if(A.screenWidthInches!==void 0)Q.uint32(317).float(A.screenWidthInches);if(A.screenHeightInches!==void 0)Q.uint32(325).float(A.screenHeightInches);if(A.screenPixelDensity!==void 0)Q.uint32(328).int32(A.screenPixelDensity);if(A.platform!==void 0)Q.uint32(336).int32(A.platform);if(A.spacecastClientInfo!==void 0)CwA.encode(A.spacecastClientInfo,Q.uint32(362).fork()).join();if(A.clientFormFactor!==void 0)Q.uint32(368).int32(A.clientFormFactor);if(A.forwardedFor!==void 0)Q.uint32(386).string(A.forwardedFor);if(A.mobileDataPlanInfo!==void 0)GwA.encode(A.mobileDataPlanInfo,Q.uint32(394).fork()).join();if(A.gmscoreVersionCode!==void 0)Q.uint32(400).int32(A.gmscoreVersionCode);if(A.webpSupport!==void 0)Q.uint32(408).bool(A.webpSupport);if(A.cameraType!==void 0)Q.uint32(416).int32(A.cameraType);if(A.experimentsToken!==void 0)Q.uint32(434).string(A.experimentsToken);if(A.windowWidthPoints!==void 0)Q.uint32(440).int32(A.windowWidthPoints);if(A.windowHeightPoints!==void 0)Q.uint32(448).int32(A.windowHeightPoints);if(A.configInfo!==void 0)FwA.encode(A.configInfo,Q.uint32(498).fork()).join();if(A.unpluggedLocationInfo!==void 0)HwA.encode(A.unpluggedLocationInfo,Q.uint32(506).fork()).join();if(A.androidSdkVersion!==void 0)Q.uint32(512).int32(A.androidSdkVersion);if(A.screenDensityFloat!==void 0)Q.uint32(525).float(A.screenDensityFloat);if(A.firstTimeSignInExperimentIds!==void 0)Q.uint32(528).int32(A.firstTimeSignInExperimentIds);if(A.utcOffsetMinutes!==void 0)Q.uint32(536).int32(A.utcOffsetMinutes);if(A.animatedWebpSupport!==void 0)Q.uint32(544).bool(A.animatedWebpSupport);if(A.kidsAppInfo!==void 0)XwA.encode(A.kidsAppInfo,Q.uint32(554).fork()).join();if(A.musicAppInfo!==void 0)$wA.encode(A.musicAppInfo,Q.uint32(562).fork()).join();if(A.tvAppInfo!==void 0)YwA.encode(A.tvAppInfo,Q.uint32(570).fork()).join();if(A.internalGeoIp!==void 0)Q.uint32(578).string(A.internalGeoIp);if(A.unpluggedAppInfo!==void 0)zwA.encode(A.unpluggedAppInfo,Q.uint32(586).fork()).join();if(A.locationInfo!==void 0)qwA.encode(A.locationInfo,Q.uint32(594).fork()).join();if(A.contentSizeCategory!==void 0)Q.uint32(610).string(A.contentSizeCategory);if(A.fontScale!==void 0)Q.uint32(621).float(A.fontScale);if(A.userInterfaceTheme!==void 0)Q.uint32(624).int32(A.userInterfaceTheme);if(A.timeZone!==void 0)Q.uint32(642).string(A.timeZone);if(A.homeGroupInfo!==void 0)VwA.encode(A.homeGroupInfo,Q.uint32(650).fork()).join();if(A.emlTemplateContext!==void 0)Q.uint32(674).bytes(A.emlTemplateContext);if(A.coldAppBundleConfigData!==void 0)Q.uint32(682).bytes(A.coldAppBundleConfigData);if(A.browserName!==void 0)Q.uint32(698).string(A.browserName);if(A.browserVersion!==void 0)Q.uint32(706).string(A.browserVersion);if(A.locationPlayabilityToken!==void 0)Q.uint32(714).string(A.locationPlayabilityToken);if(A.chipset!==void 0)Q.uint32(738).string(A.chipset);if(A.firmwareVersion!==void 0)Q.uint32(746).string(A.firmwareVersion);if(A.memoryTotalKbytes!==void 0)Q.uint32(760).int64(A.memoryTotalKbytes);if(A.mainAppWebInfo!==void 0)IwA.encode(A.mainAppWebInfo,Q.uint32(770).fork()).join();if(A.notificationPermissionInfo!==void 0)DwA.encode(A.notificationPermissionInfo,Q.uint32(778).fork()).join();if(A.deviceBrand!==void 0)Q.uint32(786).string(A.deviceBrand);if(A.glDeviceInfo!==void 0)EwA.encode(A.glDeviceInfo,Q.uint32(818).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=zBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.hl=B.string();continue}case 2:{if(C!==18)break;D.gl=B.string();continue}case 4:{if(C!==34)break;D.remoteHost=B.string();continue}case 6:{if(C!==50)break;D.deviceId=B.string();continue}case 8:{if(C!==66)break;D.debugDeviceIdOverride=B.string();continue}case 10:{if(C!==82)break;D.carrierGeo=B.string();continue}case 11:{if(C!==88)break;D.crackedHl=B.bool();continue}case 12:{if(C!==98)break;D.deviceMake=B.string();continue}case 13:{if(C!==106)break;D.deviceModel=B.string();continue}case 14:{if(C!==114)break;D.visitorData=B.string();continue}case 15:{if(C!==122)break;D.userAgent=B.string();continue}case 16:{if(C!==128)break;D.clientName=B.int32();continue}case 17:{if(C!==138)break;D.clientVersion=B.string();continue}case 18:{if(C!==146)break;D.osName=B.string();continue}case 19:{if(C!==154)break;D.osVersion=B.string();continue}case 20:{if(C!==162)break;D.projectId=B.string();continue}case 21:{if(C!==170)break;D.acceptLanguage=B.string();continue}case 22:{if(C!==178)break;D.acceptRegion=B.string();continue}case 23:{if(C!==186)break;D.originalUrl=B.string();continue}case 25:{if(C!==202)break;D.rawDeviceId=B.string();continue}case 27:{if(C!==218)break;D.configData=B.string();continue}case 31:{if(C!==250)break;D.spacecastToken=B.string();continue}case 34:{if(C!==274)break;D.internalGeo=B.string();continue}case 37:{if(C!==296)break;D.screenWidthPoints=B.int32();continue}case 38:{if(C!==304)break;D.screenHeightPoints=B.int32();continue}case 39:{if(C!==317)break;D.screenWidthInches=B.float();continue}case 40:{if(C!==325)break;D.screenHeightInches=B.float();continue}case 41:{if(C!==328)break;D.screenPixelDensity=B.int32();continue}case 42:{if(C!==336)break;D.platform=B.int32();continue}case 45:{if(C!==362)break;D.spacecastClientInfo=CwA.decode(B,B.uint32());continue}case 46:{if(C!==368)break;D.clientFormFactor=B.int32();continue}case 48:{if(C!==386)break;D.forwardedFor=B.string();continue}case 49:{if(C!==394)break;D.mobileDataPlanInfo=GwA.decode(B,B.uint32());continue}case 50:{if(C!==400)break;D.gmscoreVersionCode=B.int32();continue}case 51:{if(C!==408)break;D.webpSupport=B.bool();continue}case 52:{if(C!==416)break;D.cameraType=B.int32();continue}case 54:{if(C!==434)break;D.experimentsToken=B.string();continue}case 55:{if(C!==440)break;D.windowWidthPoints=B.int32();continue}case 56:{if(C!==448)break;D.windowHeightPoints=B.int32();continue}case 62:{if(C!==498)break;D.configInfo=FwA.decode(B,B.uint32());continue}case 63:{if(C!==506)break;D.unpluggedLocationInfo=HwA.decode(B,B.uint32());continue}case 64:{if(C!==512)break;D.androidSdkVersion=B.int32();continue}case 65:{if(C!==525)break;D.screenDensityFloat=B.float();continue}case 66:{if(C!==528)break;D.firstTimeSignInExperimentIds=B.int32();continue}case 67:{if(C!==536)break;D.utcOffsetMinutes=B.int32();continue}case 68:{if(C!==544)break;D.animatedWebpSupport=B.bool();continue}case 69:{if(C!==554)break;D.kidsAppInfo=XwA.decode(B,B.uint32());continue}case 70:{if(C!==562)break;D.musicAppInfo=$wA.decode(B,B.uint32());continue}case 71:{if(C!==570)break;D.tvAppInfo=YwA.decode(B,B.uint32());continue}case 72:{if(C!==578)break;D.internalGeoIp=B.string();continue}case 73:{if(C!==586)break;D.unpluggedAppInfo=zwA.decode(B,B.uint32());continue}case 74:{if(C!==594)break;D.locationInfo=qwA.decode(B,B.uint32());continue}case 76:{if(C!==610)break;D.contentSizeCategory=B.string();continue}case 77:{if(C!==621)break;D.fontScale=B.float();continue}case 78:{if(C!==624)break;D.userInterfaceTheme=B.int32();continue}case 80:{if(C!==642)break;D.timeZone=B.string();continue}case 81:{if(C!==650)break;D.homeGroupInfo=VwA.decode(B,B.uint32());continue}case 84:{if(C!==674)break;D.emlTemplateContext=B.bytes();continue}case 85:{if(C!==682)break;D.coldAppBundleConfigData=B.bytes();continue}case 87:{if(C!==698)break;D.browserName=B.string();continue}case 88:{if(C!==706)break;D.browserVersion=B.string();continue}case 89:{if(C!==714)break;D.locationPlayabilityToken=B.string();continue}case 92:{if(C!==738)break;D.chipset=B.string();continue}case 93:{if(C!==746)break;D.firmwareVersion=B.string();continue}case 95:{if(C!==760)break;D.memoryTotalKbytes=Pl(B.int64());continue}case 96:{if(C!==770)break;D.mainAppWebInfo=IwA.decode(B,B.uint32());continue}case 97:{if(C!==778)break;D.notificationPermissionInfo=DwA.decode(B,B.uint32());continue}case 98:{if(C!==786)break;D.deviceBrand=B.string();continue}case 102:{if(C!==818)break;D.glDeviceInfo=EwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function qBQ(){return{graftUrl:void 0,pwaInstallabilityStatus:void 0,webDisplayMode:void 0,isWebNativeShareAvailable:void 0,storeDigitalGoodsApiSupportStatus:void 0}}var IwA={encode(A,Q=new wQ){if(A.graftUrl!==void 0)Q.uint32(10).string(A.graftUrl);if(A.pwaInstallabilityStatus!==void 0)Q.uint32(16).int32(A.pwaInstallabilityStatus);if(A.webDisplayMode!==void 0)Q.uint32(24).int32(A.webDisplayMode);if(A.isWebNativeShareAvailable!==void 0)Q.uint32(32).bool(A.isWebNativeShareAvailable);if(A.storeDigitalGoodsApiSupportStatus!==void 0)Q.uint32(40).int32(A.storeDigitalGoodsApiSupportStatus);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=qBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.graftUrl=B.string();continue}case 2:{if(C!==16)break;D.pwaInstallabilityStatus=B.int32();continue}case 3:{if(C!==24)break;D.webDisplayMode=B.int32();continue}case 4:{if(C!==32)break;D.isWebNativeShareAvailable=B.bool();continue}case 5:{if(C!==40)break;D.storeDigitalGoodsApiSupportStatus=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function OBQ(){return{notificationsSetting:void 0,lastDeviceOptInChangeTimeAgoSec:void 0}}var DwA={encode(A,Q=new wQ){if(A.notificationsSetting!==void 0)Q.uint32(8).int32(A.notificationsSetting);if(A.lastDeviceOptInChangeTimeAgoSec!==void 0)Q.uint32(16).int64(A.lastDeviceOptInChangeTimeAgoSec);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=OBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.notificationsSetting=B.int32();continue}case 2:{if(C!==16)break;D.lastDeviceOptInChangeTimeAgoSec=Pl(B.int64());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function VBQ(){return{glRenderer:void 0,glEsVersionMajor:void 0,glEsVersionMinor:void 0}}var EwA={encode(A,Q=new wQ){if(A.glRenderer!==void 0)Q.uint32(10).string(A.glRenderer);if(A.glEsVersionMajor!==void 0)Q.uint32(16).int32(A.glEsVersionMajor);if(A.glEsVersionMinor!==void 0)Q.uint32(24).int32(A.glEsVersionMinor);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=VBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.glRenderer=B.string();continue}case 2:{if(C!==16)break;D.glEsVersionMajor=B.int32();continue}case 3:{if(C!==24)break;D.glEsVersionMinor=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function wBQ(){return{appliances:void 0,interactionLevel:void 0}}var CwA={encode(A,Q=new wQ){if(A.appliances!==void 0)JwA.encode(A.appliances,Q.uint32(10).fork()).join();if(A.interactionLevel!==void 0)Q.uint32(16).int32(A.interactionLevel);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=wBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.appliances=JwA.decode(B,B.uint32());continue}case 2:{if(C!==16)break;D.interactionLevel=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function NBQ(){return{contentProfileToken:void 0,status:void 0,hostname:void 0,active:void 0,deviceId:void 0}}var JwA={encode(A,Q=new wQ){if(A.contentProfileToken!==void 0)Q.uint32(10).bytes(A.contentProfileToken);if(A.status!==void 0)Q.uint32(16).int32(A.status);if(A.hostname!==void 0)Q.uint32(26).string(A.hostname);if(A.active!==void 0)Q.uint32(32).bool(A.active);if(A.deviceId!==void 0)Q.uint32(42).string(A.deviceId);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=NBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.contentProfileToken=B.bytes();continue}case 2:{if(C!==16)break;D.status=B.int32();continue}case 3:{if(C!==26)break;D.hostname=B.string();continue}case 4:{if(C!==32)break;D.active=B.bool();continue}case 5:{if(C!==42)break;D.deviceId=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function RBQ(){return{cpid:void 0,serializedDataPlanStatus:void 0,dataSavingQualityPickerEnabled:void 0,mccmnc:void 0}}var GwA={encode(A,Q=new wQ){if(A.cpid!==void 0)Q.uint32(394).string(A.cpid);if(A.serializedDataPlanStatus!==void 0)Q.uint32(402).string(A.serializedDataPlanStatus);if(A.dataSavingQualityPickerEnabled!==void 0)Q.uint32(416).bool(A.dataSavingQualityPickerEnabled);if(A.mccmnc!==void 0)Q.uint32(426).string(A.mccmnc);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=RBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 49:{if(C!==394)break;D.cpid=B.string();continue}case 50:{if(C!==402)break;D.serializedDataPlanStatus=B.string();continue}case 52:{if(C!==416)break;D.dataSavingQualityPickerEnabled=B.bool();continue}case 53:{if(C!==426)break;D.mccmnc=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function LBQ(){return{coldConfigData:void 0,coldHashData:void 0,hotHashData:void 0,appInstallData:void 0}}var FwA={encode(A,Q=new wQ){if(A.coldConfigData!==void 0)Q.uint32(10).string(A.coldConfigData);if(A.coldHashData!==void 0)Q.uint32(26).string(A.coldHashData);if(A.hotHashData!==void 0)Q.uint32(42).string(A.hotHashData);if(A.appInstallData!==void 0)Q.uint32(50).string(A.appInstallData);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=LBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.coldConfigData=B.string();continue}case 3:{if(C!==26)break;D.coldHashData=B.string();continue}case 5:{if(C!==42)break;D.hotHashData=B.string();continue}case 6:{if(C!==50)break;D.appInstallData=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function MBQ(){return{latitudeE7:void 0,longitudeE7:void 0,localTimestampMs:void 0,ipAddress:void 0,timezone:void 0,prefer24HourTime:void 0,locationRadiusMeters:void 0,isInitialLoad:void 0,browserPermissionGranted:void 0,clientPermissionState:void 0,locationOverrideToken:void 0}}var HwA={encode(A,Q=new wQ){if(A.latitudeE7!==void 0)Q.uint32(8).int32(A.latitudeE7);if(A.longitudeE7!==void 0)Q.uint32(16).int32(A.longitudeE7);if(A.localTimestampMs!==void 0)Q.uint32(24).int64(A.localTimestampMs);if(A.ipAddress!==void 0)Q.uint32(34).string(A.ipAddress);if(A.timezone!==void 0)Q.uint32(42).string(A.timezone);if(A.prefer24HourTime!==void 0)Q.uint32(48).bool(A.prefer24HourTime);if(A.locationRadiusMeters!==void 0)Q.uint32(56).int32(A.locationRadiusMeters);if(A.isInitialLoad!==void 0)Q.uint32(64).bool(A.isInitialLoad);if(A.browserPermissionGranted!==void 0)Q.uint32(72).bool(A.browserPermissionGranted);if(A.clientPermissionState!==void 0)Q.uint32(80).int32(A.clientPermissionState);if(A.locationOverrideToken!==void 0)Q.uint32(90).string(A.locationOverrideToken);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=MBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.latitudeE7=B.int32();continue}case 2:{if(C!==16)break;D.longitudeE7=B.int32();continue}case 3:{if(C!==24)break;D.localTimestampMs=Pl(B.int64());continue}case 4:{if(C!==34)break;D.ipAddress=B.string();continue}case 5:{if(C!==42)break;D.timezone=B.string();continue}case 6:{if(C!==48)break;D.prefer24HourTime=B.bool();continue}case 7:{if(C!==56)break;D.locationRadiusMeters=B.int32();continue}case 8:{if(C!==64)break;D.isInitialLoad=B.bool();continue}case 9:{if(C!==72)break;D.browserPermissionGranted=B.bool();continue}case 10:{if(C!==80)break;D.clientPermissionState=B.int32();continue}case 11:{if(C!==90)break;D.locationOverrideToken=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function PBQ(){return{contentSettings:void 0,parentCurationMode:void 0,categorySettings:void 0,userEducationSettings:void 0}}var XwA={encode(A,Q=new wQ){if(A.contentSettings!==void 0)ZwA.encode(A.contentSettings,Q.uint32(10).fork()).join();if(A.parentCurationMode!==void 0)Q.uint32(16).int32(A.parentCurationMode);if(A.categorySettings!==void 0)KwA.encode(A.categorySettings,Q.uint32(26).fork()).join();if(A.userEducationSettings!==void 0)UwA.encode(A.userEducationSettings,Q.uint32(34).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=PBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.contentSettings=ZwA.decode(B,B.uint32());continue}case 2:{if(C!==16)break;D.parentCurationMode=B.int32();continue}case 3:{if(C!==26)break;D.categorySettings=KwA.decode(B,B.uint32());continue}case 4:{if(C!==34)break;D.userEducationSettings=UwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function SBQ(){return{kidsNoSearchMode:void 0,ageUpMode:void 0,contentDensity:void 0}}var ZwA={encode(A,Q=new wQ){if(A.kidsNoSearchMode!==void 0)Q.uint32(8).int32(A.kidsNoSearchMode);if(A.ageUpMode!==void 0)Q.uint32(16).int32(A.ageUpMode);if(A.contentDensity!==void 0)Q.uint32(24).int32(A.contentDensity);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=SBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.kidsNoSearchMode=B.int32();continue}case 2:{if(C!==16)break;D.ageUpMode=B.int32();continue}case 3:{if(C!==24)break;D.contentDensity=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function TBQ(){return{enabledCategories:void 0}}var KwA={encode(A,Q=new wQ){if(A.enabledCategories!==void 0)Q.uint32(10).string(A.enabledCategories);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=TBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.enabledCategories=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function _BQ(){return{hasSeenHomeChipBarUserEducation:void 0,hasSeenHomePivotBarUserEducation:void 0,hasSeenParentMuirUserEducation:void 0}}var UwA={encode(A,Q=new wQ){if(A.hasSeenHomeChipBarUserEducation!==void 0)Q.uint32(8).bool(A.hasSeenHomeChipBarUserEducation);if(A.hasSeenHomePivotBarUserEducation!==void 0)Q.uint32(16).bool(A.hasSeenHomePivotBarUserEducation);if(A.hasSeenParentMuirUserEducation!==void 0)Q.uint32(24).bool(A.hasSeenParentMuirUserEducation);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=_BQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.hasSeenHomeChipBarUserEducation=B.bool();continue}case 2:{if(C!==16)break;D.hasSeenHomePivotBarUserEducation=B.bool();continue}case 3:{if(C!==24)break;D.hasSeenParentMuirUserEducation=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function kBQ(){return{playBackMode:void 0,musicLocationMasterSwitch:void 0,musicActivityMasterSwitch:void 0,offlineMixtapeEnabled:void 0,autoOfflineEnabled:void 0,iosBackgroundRefreshStatus:void 0,smartDownloadsSongLimit:void 0,transitionedFromMixtapeToSmartDownloads:void 0,pwaInstallabilityStatus:void 0,webDisplayMode:void 0,musicTier:void 0,storeDigitalGoodsApiSupportStatus:void 0,smartDownloadsTimeSinceLastOptOutSec:void 0}}var $wA={encode(A,Q=new wQ){if(A.playBackMode!==void 0)Q.uint32(8).int32(A.playBackMode);if(A.musicLocationMasterSwitch!==void 0)Q.uint32(16).int32(A.musicLocationMasterSwitch);if(A.musicActivityMasterSwitch!==void 0)Q.uint32(24).int32(A.musicActivityMasterSwitch);if(A.offlineMixtapeEnabled!==void 0)Q.uint32(32).bool(A.offlineMixtapeEnabled);if(A.autoOfflineEnabled!==void 0)Q.uint32(40).bool(A.autoOfflineEnabled);if(A.iosBackgroundRefreshStatus!==void 0)Q.uint32(48).int32(A.iosBackgroundRefreshStatus);if(A.smartDownloadsSongLimit!==void 0)Q.uint32(56).int32(A.smartDownloadsSongLimit);if(A.transitionedFromMixtapeToSmartDownloads!==void 0)Q.uint32(64).bool(A.transitionedFromMixtapeToSmartDownloads);if(A.pwaInstallabilityStatus!==void 0)Q.uint32(72).int32(A.pwaInstallabilityStatus);if(A.webDisplayMode!==void 0)Q.uint32(80).int32(A.webDisplayMode);if(A.musicTier!==void 0)Q.uint32(88).int32(A.musicTier);if(A.storeDigitalGoodsApiSupportStatus!==void 0)Q.uint32(96).int32(A.storeDigitalGoodsApiSupportStatus);if(A.smartDownloadsTimeSinceLastOptOutSec!==void 0)Q.uint32(104).int64(A.smartDownloadsTimeSinceLastOptOutSec);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=kBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.playBackMode=B.int32();continue}case 2:{if(C!==16)break;D.musicLocationMasterSwitch=B.int32();continue}case 3:{if(C!==24)break;D.musicActivityMasterSwitch=B.int32();continue}case 4:{if(C!==32)break;D.offlineMixtapeEnabled=B.bool();continue}case 5:{if(C!==40)break;D.autoOfflineEnabled=B.bool();continue}case 6:{if(C!==48)break;D.iosBackgroundRefreshStatus=B.int32();continue}case 7:{if(C!==56)break;D.smartDownloadsSongLimit=B.int32();continue}case 8:{if(C!==64)break;D.transitionedFromMixtapeToSmartDownloads=B.bool();continue}case 9:{if(C!==72)break;D.pwaInstallabilityStatus=B.int32();continue}case 10:{if(C!==80)break;D.webDisplayMode=B.int32();continue}case 11:{if(C!==88)break;D.musicTier=B.int32();continue}case 12:{if(C!==96)break;D.storeDigitalGoodsApiSupportStatus=B.int32();continue}case 13:{if(C!==104)break;D.smartDownloadsTimeSinceLastOptOutSec=Pl(B.int64());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function jBQ(){return{mdxImpactedSessionsServerEvents:void 0,enablePrivacyFilter:void 0,zylonLeftNav:void 0,certificationScope:void 0,livingRoomPoTokenId:void 0,jsEngineString:void 0,voiceCapability:void 0,systemIntegrator:void 0,androidBuildFingerprint:void 0,cobaltAppVersion:void 0,cobaltStarboardVersion:void 0,useStartPlaybackPreviewCommand:void 0,shouldShowPersistentSigninOnHome:void 0,androidPlayServicesVersion:void 0}}var YwA={encode(A,Q=new wQ){if(A.mdxImpactedSessionsServerEvents!==void 0)Q.uint32(26).string(A.mdxImpactedSessionsServerEvents);if(A.enablePrivacyFilter!==void 0)Q.uint32(48).bool(A.enablePrivacyFilter);if(A.zylonLeftNav!==void 0)Q.uint32(56).bool(A.zylonLeftNav);if(A.certificationScope!==void 0)Q.uint32(74).string(A.certificationScope);if(A.livingRoomPoTokenId!==void 0)Q.uint32(82).string(A.livingRoomPoTokenId);if(A.jsEngineString!==void 0)Q.uint32(98).string(A.jsEngineString);if(A.voiceCapability!==void 0)WwA.encode(A.voiceCapability,Q.uint32(106).fork()).join();if(A.systemIntegrator!==void 0)Q.uint32(114).string(A.systemIntegrator);if(A.androidBuildFingerprint!==void 0)Q.uint32(146).string(A.androidBuildFingerprint);if(A.cobaltAppVersion!==void 0)Q.uint32(154).string(A.cobaltAppVersion);if(A.cobaltStarboardVersion!==void 0)Q.uint32(162).string(A.cobaltStarboardVersion);if(A.useStartPlaybackPreviewCommand!==void 0)Q.uint32(176).bool(A.useStartPlaybackPreviewCommand);if(A.shouldShowPersistentSigninOnHome!==void 0)Q.uint32(184).bool(A.shouldShowPersistentSigninOnHome);if(A.androidPlayServicesVersion!==void 0)Q.uint32(194).string(A.androidPlayServicesVersion);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=jBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 3:{if(C!==26)break;D.mdxImpactedSessionsServerEvents=B.string();continue}case 6:{if(C!==48)break;D.enablePrivacyFilter=B.bool();continue}case 7:{if(C!==56)break;D.zylonLeftNav=B.bool();continue}case 9:{if(C!==74)break;D.certificationScope=B.string();continue}case 10:{if(C!==82)break;D.livingRoomPoTokenId=B.string();continue}case 12:{if(C!==98)break;D.jsEngineString=B.string();continue}case 13:{if(C!==106)break;D.voiceCapability=WwA.decode(B,B.uint32());continue}case 14:{if(C!==114)break;D.systemIntegrator=B.string();continue}case 18:{if(C!==146)break;D.androidBuildFingerprint=B.string();continue}case 19:{if(C!==154)break;D.cobaltAppVersion=B.string();continue}case 20:{if(C!==162)break;D.cobaltStarboardVersion=B.string();continue}case 22:{if(C!==176)break;D.useStartPlaybackPreviewCommand=B.bool();continue}case 23:{if(C!==184)break;D.shouldShowPersistentSigninOnHome=B.bool();continue}case 24:{if(C!==194)break;D.androidPlayServicesVersion=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function yBQ(){return{hasSoftMicSupport:void 0,hasHardMicSupport:void 0}}var WwA={encode(A,Q=new wQ){if(A.hasSoftMicSupport!==void 0)Q.uint32(8).bool(A.hasSoftMicSupport);if(A.hasHardMicSupport!==void 0)Q.uint32(16).bool(A.hasHardMicSupport);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=yBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.hasSoftMicSupport=B.bool();continue}case 2:{if(C!==16)break;D.hasHardMicSupport=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function gBQ(){return{enableFilterMode:void 0,iosNotificationPermission:void 0,forceEnableEpg3:void 0}}var zwA={encode(A,Q=new wQ){if(A.enableFilterMode!==void 0)Q.uint32(16).bool(A.enableFilterMode);if(A.iosNotificationPermission!==void 0)Q.uint32(24).bool(A.iosNotificationPermission);if(A.forceEnableEpg3!==void 0)Q.uint32(56).bool(A.forceEnableEpg3);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=gBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 2:{if(C!==16)break;D.enableFilterMode=B.bool();continue}case 3:{if(C!==24)break;D.iosNotificationPermission=B.bool();continue}case 7:{if(C!==56)break;D.forceEnableEpg3=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function vBQ(){return{locationInfoStatus:void 0,ulrStatus:void 0,latitudeE7:void 0,longitudeE7:void 0,horizontalAccuracyMeters:void 0,locationFreshnessMs:void 0,locationPermissionAuthorizationStatus:void 0,locationOverrideToken:void 0,forceLocationPlayabilityTokenRefresh:void 0}}var qwA={encode(A,Q=new wQ){if(A.locationInfoStatus!==void 0)Q.uint32(8).int32(A.locationInfoStatus);if(A.ulrStatus!==void 0)OwA.encode(A.ulrStatus,Q.uint32(18).fork()).join();if(A.latitudeE7!==void 0)Q.uint32(26).string(A.latitudeE7);if(A.longitudeE7!==void 0)Q.uint32(34).string(A.longitudeE7);if(A.horizontalAccuracyMeters!==void 0)Q.uint32(42).string(A.horizontalAccuracyMeters);if(A.locationFreshnessMs!==void 0)Q.uint32(50).string(A.locationFreshnessMs);if(A.locationPermissionAuthorizationStatus!==void 0)Q.uint32(56).int32(A.locationPermissionAuthorizationStatus);if(A.locationOverrideToken!==void 0)Q.uint32(66).string(A.locationOverrideToken);if(A.forceLocationPlayabilityTokenRefresh!==void 0)Q.uint32(72).bool(A.forceLocationPlayabilityTokenRefresh);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=vBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.locationInfoStatus=B.int32();continue}case 2:{if(C!==18)break;D.ulrStatus=OwA.decode(B,B.uint32());continue}case 3:{if(C!==26)break;D.latitudeE7=B.string();continue}case 4:{if(C!==34)break;D.longitudeE7=B.string();continue}case 5:{if(C!==42)break;D.horizontalAccuracyMeters=B.string();continue}case 6:{if(C!==50)break;D.locationFreshnessMs=B.string();continue}case 7:{if(C!==56)break;D.locationPermissionAuthorizationStatus=B.int32();continue}case 8:{if(C!==66)break;D.locationOverrideToken=B.string();continue}case 9:{if(C!==72)break;D.forceLocationPlayabilityTokenRefresh=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function bBQ(){return{reportingEnabledSetting:void 0,historyEnabledSetting:void 0,isAllowed:void 0,isActive:void 0}}var OwA={encode(A,Q=new wQ){if(A.reportingEnabledSetting!==void 0)Q.uint32(8).int32(A.reportingEnabledSetting);if(A.historyEnabledSetting!==void 0)Q.uint32(16).int32(A.historyEnabledSetting);if(A.isAllowed!==void 0)Q.uint32(24).bool(A.isAllowed);if(A.isActive!==void 0)Q.uint32(32).bool(A.isActive);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=bBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.reportingEnabledSetting=B.int32();continue}case 2:{if(C!==16)break;D.historyEnabledSetting=B.int32();continue}case 3:{if(C!==24)break;D.isAllowed=B.bool();continue}case 4:{if(C!==32)break;D.isActive=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function xBQ(){return{isPartOfGroup:void 0,isGroup:void 0}}var VwA={encode(A,Q=new wQ){if(A.isPartOfGroup!==void 0)Q.uint32(8).bool(A.isPartOfGroup);if(A.isGroup!==void 0)Q.uint32(24).bool(A.isGroup);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=xBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.isPartOfGroup=B.bool();continue}case 3:{if(C!==24)break;D.isGroup=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function Pl(A){let Q=globalThis.Number(A.toString());if(Q>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(Q<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return Q}function hBQ(){return{challenge:void 0,webResponse:void 0,androidResponse:void 0,iosResponse:void 0,error:void 0,adblockReporting:void 0}}var wIA={encode(A,Q=new wQ){if(A.challenge!==void 0)Q.uint32(10).string(A.challenge);if(A.webResponse!==void 0)Q.uint32(18).string(A.webResponse);if(A.androidResponse!==void 0)Q.uint32(26).string(A.androidResponse);if(A.iosResponse!==void 0)Q.uint32(34).bytes(A.iosResponse);if(A.error!==void 0)Q.uint32(40).int32(A.error);if(A.adblockReporting!==void 0)wwA.encode(A.adblockReporting,Q.uint32(50).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=hBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.challenge=B.string();continue}case 2:{if(C!==18)break;D.webResponse=B.string();continue}case 3:{if(C!==26)break;D.androidResponse=B.string();continue}case 4:{if(C!==34)break;D.iosResponse=B.bytes();continue}case 5:{if(C!==40)break;D.error=B.int32();continue}case 6:{if(C!==50)break;D.adblockReporting=wwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function mBQ(){return{reportingStatus:void 0,broadSpectrumDetectionResult:void 0}}var wwA={encode(A,Q=new wQ){if(A.reportingStatus!==void 0)Q.uint32(8).uint64(A.reportingStatus);if(A.broadSpectrumDetectionResult!==void 0)Q.uint32(16).uint64(A.broadSpectrumDetectionResult);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=mBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.reportingStatus=NwA(B.uint64());continue}case 2:{if(C!==16)break;D.broadSpectrumDetectionResult=NwA(B.uint64());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function NwA(A){let Q=globalThis.Number(A.toString());if(Q>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(Q<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return Q}function fBQ(){return{thirdPartyDigest:void 0,useSsl:void 0,returnErrorDetail:void 0,ifNoneMatch:void 0,returnLogEntry:void 0,isPrefetch:void 0,internalExperimentFlags:[],returnDebugData:void 0,innertubez:void 0,traceProto:void 0,returnLogEntryJson:void 0,sherlogUsername:void 0,reauthRequestInfo:void 0,sessionInfo:void 0,returnLogEntryProto:void 0,externalPrequestContext:void 0,attestationResponseData:void 0,eats:void 0,requestQos:void 0}}var NIA={encode(A,Q=new wQ){if(A.thirdPartyDigest!==void 0)Q.uint32(50).string(A.thirdPartyDigest);if(A.useSsl!==void 0)Q.uint32(56).bool(A.useSsl);if(A.returnErrorDetail!==void 0)Q.uint32(72).bool(A.returnErrorDetail);if(A.ifNoneMatch!==void 0)Q.uint32(98).string(A.ifNoneMatch);if(A.returnLogEntry!==void 0)Q.uint32(104).bool(A.returnLogEntry);if(A.isPrefetch!==void 0)Q.uint32(112).bool(A.isPrefetch);for(let B of A.internalExperimentFlags)yG.encode(B,Q.uint32(122).fork()).join();if(A.returnDebugData!==void 0)Q.uint32(128).bool(A.returnDebugData);if(A.innertubez!==void 0)Q.uint32(146).string(A.innertubez);if(A.traceProto!==void 0)Q.uint32(184).bool(A.traceProto);if(A.returnLogEntryJson!==void 0)Q.uint32(192).bool(A.returnLogEntryJson);if(A.sherlogUsername!==void 0)Q.uint32(202).string(A.sherlogUsername);if(A.reauthRequestInfo!==void 0)MwA.encode(A.reauthRequestInfo,Q.uint32(234).fork()).join();if(A.sessionInfo!==void 0)LwA.encode(A.sessionInfo,Q.uint32(242).fork()).join();if(A.returnLogEntryProto!==void 0)Q.uint32(248).bool(A.returnLogEntryProto);if(A.externalPrequestContext!==void 0)Q.uint32(258).string(A.externalPrequestContext);if(A.attestationResponseData!==void 0)wIA.encode(A.attestationResponseData,Q.uint32(274).fork()).join();if(A.eats!==void 0)Q.uint32(282).bytes(A.eats);if(A.requestQos!==void 0)RwA.encode(A.requestQos,Q.uint32(290).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=fBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 6:{if(C!==50)break;D.thirdPartyDigest=B.string();continue}case 7:{if(C!==56)break;D.useSsl=B.bool();continue}case 9:{if(C!==72)break;D.returnErrorDetail=B.bool();continue}case 12:{if(C!==98)break;D.ifNoneMatch=B.string();continue}case 13:{if(C!==104)break;D.returnLogEntry=B.bool();continue}case 14:{if(C!==112)break;D.isPrefetch=B.bool();continue}case 15:{if(C!==122)break;D.internalExperimentFlags.push(yG.decode(B,B.uint32()));continue}case 16:{if(C!==128)break;D.returnDebugData=B.bool();continue}case 18:{if(C!==146)break;D.innertubez=B.string();continue}case 23:{if(C!==184)break;D.traceProto=B.bool();continue}case 24:{if(C!==192)break;D.returnLogEntryJson=B.bool();continue}case 25:{if(C!==202)break;D.sherlogUsername=B.string();continue}case 29:{if(C!==234)break;D.reauthRequestInfo=MwA.decode(B,B.uint32());continue}case 30:{if(C!==242)break;D.sessionInfo=LwA.decode(B,B.uint32());continue}case 31:{if(C!==248)break;D.returnLogEntryProto=B.bool();continue}case 32:{if(C!==258)break;D.externalPrequestContext=B.string();continue}case 34:{if(C!==274)break;D.attestationResponseData=wIA.decode(B,B.uint32());continue}case 35:{if(C!==282)break;D.eats=B.bytes();continue}case 36:{if(C!==290)break;D.requestQos=RwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function uBQ(){return{criticality:void 0}}var RwA={encode(A,Q=new wQ){if(A.criticality!==void 0)Q.uint32(8).int32(A.criticality);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=uBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.criticality=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function cBQ(){return{token:void 0}}var LwA={encode(A,Q=new wQ){if(A.token!==void 0)Q.uint32(10).string(A.token);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=cBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.token=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function lBQ(){return{encodedReauthProofToken:void 0}}var MwA={encode(A,Q=new wQ){if(A.encodedReauthProofToken!==void 0)Q.uint32(10).string(A.encodedReauthProofToken);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=lBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.encodedReauthProofToken=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function dBQ(){return{developerKey:void 0,appName:void 0,appPublisher:void 0,embedUrl:void 0,appVersion:void 0,embeddedPlayerContext:void 0}}var RIA={encode(A,Q=new wQ){if(A.developerKey!==void 0)Q.uint32(10).string(A.developerKey);if(A.appName!==void 0)Q.uint32(18).string(A.appName);if(A.appPublisher!==void 0)Q.uint32(26).string(A.appPublisher);if(A.embedUrl!==void 0)Q.uint32(34).string(A.embedUrl);if(A.appVersion!==void 0)Q.uint32(50).string(A.appVersion);if(A.embeddedPlayerContext!==void 0)PwA.encode(A.embeddedPlayerContext,Q.uint32(58).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=dBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.developerKey=B.string();continue}case 2:{if(C!==18)break;D.appName=B.string();continue}case 3:{if(C!==26)break;D.appPublisher=B.string();continue}case 4:{if(C!==34)break;D.embedUrl=B.string();continue}case 6:{if(C!==50)break;D.appVersion=B.string();continue}case 7:{if(C!==58)break;D.embeddedPlayerContext=PwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function pBQ(){return{ancestorOrigins:void 0,embeddedPlayerEncryptedContext:void 0,ancestorOriginsSupported:void 0}}var PwA={encode(A,Q=new wQ){if(A.ancestorOrigins!==void 0)Q.uint32(10).string(A.ancestorOrigins);if(A.embeddedPlayerEncryptedContext!==void 0)Q.uint32(18).string(A.embeddedPlayerEncryptedContext);if(A.ancestorOriginsSupported!==void 0)Q.uint32(24).bool(A.ancestorOriginsSupported);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=pBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.ancestorOrigins=B.string();continue}case 2:{if(C!==18)break;D.embeddedPlayerEncryptedContext=B.string();continue}case 3:{if(C!==24)break;D.ancestorOriginsSupported=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function oBQ(){return{onBehalfOfUser:void 0,enableSafetyMode:void 0,credentialTransferTokens:[],delegatePurchases:void 0,kidsParent:void 0,isIncognito:void 0,lockedSafetyMode:void 0,delegationContext:void 0,serializedDelegationContext:void 0}}var LIA={encode(A,Q=new wQ){if(A.onBehalfOfUser!==void 0)Q.uint32(26).string(A.onBehalfOfUser);if(A.enableSafetyMode!==void 0)Q.uint32(56).bool(A.enableSafetyMode);for(let B of A.credentialTransferTokens)kwA.encode(B,Q.uint32(98).fork()).join();if(A.delegatePurchases!==void 0)TwA.encode(A.delegatePurchases,Q.uint32(106).fork()).join();if(A.kidsParent!==void 0)SwA.encode(A.kidsParent,Q.uint32(114).fork()).join();if(A.isIncognito!==void 0)Q.uint32(120).bool(A.isIncognito);if(A.lockedSafetyMode!==void 0)Q.uint32(128).bool(A.lockedSafetyMode);if(A.delegationContext!==void 0)_wA.encode(A.delegationContext,Q.uint32(138).fork()).join();if(A.serializedDelegationContext!==void 0)Q.uint32(146).string(A.serializedDelegationContext);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=oBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 3:{if(C!==26)break;D.onBehalfOfUser=B.string();continue}case 7:{if(C!==56)break;D.enableSafetyMode=B.bool();continue}case 12:{if(C!==98)break;D.credentialTransferTokens.push(kwA.decode(B,B.uint32()));continue}case 13:{if(C!==106)break;D.delegatePurchases=TwA.decode(B,B.uint32());continue}case 14:{if(C!==114)break;D.kidsParent=SwA.decode(B,B.uint32());continue}case 15:{if(C!==120)break;D.isIncognito=B.bool();continue}case 16:{if(C!==128)break;D.lockedSafetyMode=B.bool();continue}case 17:{if(C!==138)break;D.delegationContext=_wA.decode(B,B.uint32());continue}case 18:{if(C!==146)break;D.serializedDelegationContext=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function nBQ(){return{}}var SwA={encode(A,Q=new wQ){return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=nBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function iBQ(){return{}}var TwA={encode(A,Q=new wQ){return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=iBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function rBQ(){return{}}var _wA={encode(A,Q=new wQ){return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=rBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function sBQ(){return{}}var kwA={encode(A,Q=new wQ){return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=sBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function tBQ(){return{client:void 0,user:void 0,capabilities:void 0,request:void 0,clickTracking:void 0,thirdParty:void 0,remoteClient:void 0,adSignalsInfo:void 0,experimentalData:void 0,clientScreenNonce:void 0,activePlayers:[]}}var MIA={encode(A,Q=new wQ){if(A.client!==void 0)w_.encode(A.client,Q.uint32(10).fork()).join();if(A.user!==void 0)LIA.encode(A.user,Q.uint32(26).fork()).join();if(A.capabilities!==void 0)VIA.encode(A.capabilities,Q.uint32(34).fork()).join();if(A.request!==void 0)NIA.encode(A.request,Q.uint32(42).fork()).join();if(A.clickTracking!==void 0)gwA.encode(A.clickTracking,Q.uint32(50).fork()).join();if(A.thirdParty!==void 0)RIA.encode(A.thirdParty,Q.uint32(58).fork()).join();if(A.remoteClient!==void 0)w_.encode(A.remoteClient,Q.uint32(66).fork()).join();if(A.adSignalsInfo!==void 0)vwA.encode(A.adSignalsInfo,Q.uint32(74).fork()).join();if(A.experimentalData!==void 0)jwA.encode(A.experimentalData,Q.uint32(82).fork()).join();if(A.clientScreenNonce!==void 0)Q.uint32(90).string(A.clientScreenNonce);for(let B of A.activePlayers)ywA.encode(B,Q.uint32(98).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=tBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.client=w_.decode(B,B.uint32());continue}case 3:{if(C!==26)break;D.user=LIA.decode(B,B.uint32());continue}case 4:{if(C!==34)break;D.capabilities=VIA.decode(B,B.uint32());continue}case 5:{if(C!==42)break;D.request=NIA.decode(B,B.uint32());continue}case 6:{if(C!==50)break;D.clickTracking=gwA.decode(B,B.uint32());continue}case 7:{if(C!==58)break;D.thirdParty=RIA.decode(B,B.uint32());continue}case 8:{if(C!==66)break;D.remoteClient=w_.decode(B,B.uint32());continue}case 9:{if(C!==74)break;D.adSignalsInfo=vwA.decode(B,B.uint32());continue}case 10:{if(C!==82)break;D.experimentalData=jwA.decode(B,B.uint32());continue}case 11:{if(C!==90)break;D.clientScreenNonce=B.string();continue}case 12:{if(C!==98)break;D.activePlayers.push(ywA.decode(B,B.uint32()));continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function aBQ(){return{params:[]}}var jwA={encode(A,Q=new wQ){for(let B of A.params)yG.encode(B,Q.uint32(10).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=aBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.params.push(yG.decode(B,B.uint32()));continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function eBQ(){return{playerContextParams:void 0}}var ywA={encode(A,Q=new wQ){if(A.playerContextParams!==void 0)Q.uint32(10).bytes(A.playerContextParams);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=eBQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.playerContextParams=B.bytes();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function AIQ(){return{clickTrackingParams:void 0}}var gwA={encode(A,Q=new wQ){if(A.clickTrackingParams!==void 0)Q.uint32(18).bytes(A.clickTrackingParams);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=AIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 2:{if(C!==18)break;D.clickTrackingParams=B.bytes();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function QIQ(){return{params:[],bid:void 0,mutsuId:void 0,consentBumpState:void 0,advertisingId:void 0,limitAdTracking:void 0,attributionOsSupportedVersion:void 0}}var vwA={encode(A,Q=new wQ){for(let B of A.params)yG.encode(B,Q.uint32(10).fork()).join();if(A.bid!==void 0)Q.uint32(18).string(A.bid);if(A.mutsuId!==void 0)Q.uint32(26).string(A.mutsuId);if(A.consentBumpState!==void 0)Q.uint32(34).string(A.consentBumpState);if(A.advertisingId!==void 0)Q.uint32(58).string(A.advertisingId);if(A.limitAdTracking!==void 0)Q.uint32(72).bool(A.limitAdTracking);if(A.attributionOsSupportedVersion!==void 0)Q.uint32(82).string(A.attributionOsSupportedVersion);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=QIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.params.push(yG.decode(B,B.uint32()));continue}case 2:{if(C!==18)break;D.bid=B.string();continue}case 3:{if(C!==26)break;D.mutsuId=B.string();continue}case 4:{if(C!==34)break;D.consentBumpState=B.string();continue}case 7:{if(C!==58)break;D.advertisingId=B.string();continue}case 9:{if(C!==72)break;D.limitAdTracking=B.bool();continue}case 10:{if(C!==82)break;D.attributionOsSupportedVersion=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function BIQ(){return{context:void 0,encryptedVideoId:void 0,title:void 0,description:void 0,privacy:void 0,tags:void 0,category:void 0,license:void 0,ageRestriction:void 0,videoStill:void 0,madeForKids:void 0,racy:void 0}}var nwA={encode(A,Q=new wQ){if(A.context!==void 0)MIA.encode(A.context,Q.uint32(10).fork()).join();if(A.encryptedVideoId!==void 0)Q.uint32(18).string(A.encryptedVideoId);if(A.title!==void 0)bwA.encode(A.title,Q.uint32(26).fork()).join();if(A.description!==void 0)xwA.encode(A.description,Q.uint32(34).fork()).join();if(A.privacy!==void 0)hwA.encode(A.privacy,Q.uint32(42).fork()).join();if(A.tags!==void 0)mwA.encode(A.tags,Q.uint32(50).fork()).join();if(A.category!==void 0)fwA.encode(A.category,Q.uint32(58).fork()).join();if(A.license!==void 0)uwA.encode(A.license,Q.uint32(66).fork()).join();if(A.ageRestriction!==void 0)dwA.encode(A.ageRestriction,Q.uint32(90).fork()).join();if(A.videoStill!==void 0)pwA.encode(A.videoStill,Q.uint32(162).fork()).join();if(A.madeForKids!==void 0)cwA.encode(A.madeForKids,Q.uint32(546).fork()).join();if(A.racy!==void 0)lwA.encode(A.racy,Q.uint32(554).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=BIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.context=MIA.decode(B,B.uint32());continue}case 2:{if(C!==18)break;D.encryptedVideoId=B.string();continue}case 3:{if(C!==26)break;D.title=bwA.decode(B,B.uint32());continue}case 4:{if(C!==34)break;D.description=xwA.decode(B,B.uint32());continue}case 5:{if(C!==42)break;D.privacy=hwA.decode(B,B.uint32());continue}case 6:{if(C!==50)break;D.tags=mwA.decode(B,B.uint32());continue}case 7:{if(C!==58)break;D.category=fwA.decode(B,B.uint32());continue}case 8:{if(C!==66)break;D.license=uwA.decode(B,B.uint32());continue}case 11:{if(C!==90)break;D.ageRestriction=dwA.decode(B,B.uint32());continue}case 20:{if(C!==162)break;D.videoStill=pwA.decode(B,B.uint32());continue}case 68:{if(C!==546)break;D.madeForKids=cwA.decode(B,B.uint32());continue}case 69:{if(C!==554)break;D.racy=lwA.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function IIQ(){return{newTitle:void 0}}var bwA={encode(A,Q=new wQ){if(A.newTitle!==void 0)Q.uint32(10).string(A.newTitle);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=IIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.newTitle=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function DIQ(){return{newDescription:void 0}}var xwA={encode(A,Q=new wQ){if(A.newDescription!==void 0)Q.uint32(10).string(A.newDescription);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=DIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.newDescription=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function EIQ(){return{newPrivacy:void 0,clearPrivacyDraft:void 0}}var hwA={encode(A,Q=new wQ){if(A.newPrivacy!==void 0)Q.uint32(8).int32(A.newPrivacy);if(A.clearPrivacyDraft!==void 0)Q.uint32(16).bool(A.clearPrivacyDraft);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=EIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.newPrivacy=B.int32();continue}case 2:{if(C!==16)break;D.clearPrivacyDraft=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function CIQ(){return{newTags:[]}}var mwA={encode(A,Q=new wQ){for(let B of A.newTags)Q.uint32(10).string(B);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=CIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.newTags.push(B.string());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function JIQ(){return{newCategoryId:void 0}}var fwA={encode(A,Q=new wQ){if(A.newCategoryId!==void 0)Q.uint32(8).int32(A.newCategoryId);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=JIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.newCategoryId=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function GIQ(){return{newLicenseId:void 0}}var uwA={encode(A,Q=new wQ){if(A.newLicenseId!==void 0)Q.uint32(10).string(A.newLicenseId);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=GIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.newLicenseId=B.string();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function FIQ(){return{operation:void 0,newMfk:void 0}}var cwA={encode(A,Q=new wQ){if(A.operation!==void 0)Q.uint32(8).int32(A.operation);if(A.newMfk!==void 0)Q.uint32(16).int32(A.newMfk);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=FIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.operation=B.int32();continue}case 2:{if(C!==16)break;D.newMfk=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function HIQ(){return{operation:void 0,newRacy:void 0}}var lwA={encode(A,Q=new wQ){if(A.operation!==void 0)Q.uint32(8).int32(A.operation);if(A.newRacy!==void 0)Q.uint32(16).int32(A.newRacy);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=HIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.operation=B.int32();continue}case 2:{if(C!==16)break;D.newRacy=B.int32();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function XIQ(){return{newIsAgeRestricted:void 0}}var dwA={encode(A,Q=new wQ){if(A.newIsAgeRestricted!==void 0)Q.uint32(8).bool(A.newIsAgeRestricted);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=XIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.newIsAgeRestricted=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function ZIQ(){return{operation:void 0,newStillId:void 0,image:void 0,testImage:void 0,experimentImage:[]}}var pwA={encode(A,Q=new wQ){if(A.operation!==void 0)Q.uint32(8).int32(A.operation);if(A.newStillId!==void 0)Q.uint32(16).int32(A.newStillId);if(A.image!==void 0)jN.encode(A.image,Q.uint32(26).fork()).join();if(A.testImage!==void 0)jN.encode(A.testImage,Q.uint32(34).fork()).join();for(let B of A.experimentImage)owA.encode(B,Q.uint32(50).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=ZIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==8)break;D.operation=B.int32();continue}case 2:{if(C!==16)break;D.newStillId=B.int32();continue}case 3:{if(C!==26)break;D.image=jN.decode(B,B.uint32());continue}case 4:{if(C!==34)break;D.testImage=jN.decode(B,B.uint32());continue}case 6:{if(C!==50)break;D.experimentImage.push(owA.decode(B,B.uint32()));continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function KIQ(){return{image:void 0}}var owA={encode(A,Q=new wQ){if(A.image!==void 0)jN.encode(A.image,Q.uint32(10).fork()).join();return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=KIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.image=jN.decode(B,B.uint32());continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function UIQ(){return{rawBytes:void 0,dataUri:void 0,frameTimestampUs:void 0,isVertical:void 0}}var jN={encode(A,Q=new wQ){if(A.rawBytes!==void 0)Q.uint32(10).bytes(A.rawBytes);if(A.dataUri!==void 0)Q.uint32(18).string(A.dataUri);if(A.frameTimestampUs!==void 0)Q.uint32(32).int64(A.frameTimestampUs);if(A.isVertical!==void 0)Q.uint32(40).bool(A.isVertical);return Q},decode(A,Q){let B=A instanceof VA?A:new VA(A),I=Q===void 0?B.len:B.pos+Q,D=UIQ();while(B.pos<I){let C=B.uint32();switch(C>>>3){case 1:{if(C!==10)break;D.rawBytes=B.bytes();continue}case 2:{if(C!==18)break;D.dataUri=B.string();continue}case 4:{if(C!==32)break;D.frameTimestampUs=$IQ(B.int64());continue}case 5:{if(C!==40)break;D.isVertical=B.bool();continue}}if((C&7)===4||C===0)break;B.skip(C&7)}return D}};function $IQ(A){let Q=globalThis.Number(A.toString());if(Q>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(Q<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return Q}class N_{#A;constructor(A){this.#A=A}async updateVideoMetadata(A,Q){let B=this.#A;if(!B.logged_in)throw new s("You must be signed in to perform this operation.");let I={context:{client:{osName:"Android",clientName:parseInt(RI.CLIENT_NAME_IDS.ANDROID),clientVersion:RI.CLIENTS.ANDROID.VERSION,androidSdkVersion:RI.CLIENTS.ANDROID.SDK_VERSION,visitorData:B.context.client.visitorData,osVersion:"13",acceptLanguage:B.context.client.hl,acceptRegion:B.context.client.gl,deviceMake:"Google",deviceModel:"sdk_gphone64_x86_64",screenHeightPoints:840,screenWidthPoints:432,configInfo:{appInstallData:B.context.client.configInfo?.appInstallData},timeZone:B.context.client.timeZone,chipset:"qcom;taro"},activePlayers:[]},encryptedVideoId:A};if(Q.title)I.title={newTitle:Q.title};if(Q.description)I.description={newDescription:Q.description};if(Q.license)I.license={newLicenseId:Q.license};if(Q.tags)I.tags={newTags:Q.tags};if(Q.thumbnail)I.videoStill={operation:3,image:{rawBytes:Q.thumbnail},experimentImage:[]};if(Reflect.has(Q,"category"))I.category={newCategoryId:Q.category};if(Reflect.has(Q,"privacy"))switch(Q.privacy){case"PUBLIC":I.privacy={newPrivacy:1};break;case"UNLISTED":I.privacy={newPrivacy:2};break;case"PRIVATE":I.privacy={newPrivacy:3};break;default:throw Error("Invalid privacy setting")}if(Reflect.has(Q,"made_for_kids"))I.madeForKids={operation:1,newMfk:Q.made_for_kids?1:2};if(Reflect.has(Q,"age_restricted"))I.racy={operation:1,newRacy:Q.age_restricted?1:2};let D=nwA.encode(I);return await B.actions.execute("/video_manager/metadata_update",{protobuf:!0,serialized_data:D.finish()})}async upload(A,Q={}){if(!this.#A.logged_in)throw new s("You must be signed in to perform this operation.");let B=await this.#Q(),I=await this.#B(B.upload_url,A);if(I.status!=="STATUS_SUCCESS")throw new s("Could not process video.");return await this.#I(B,I,Q)}async#Q(){let A=`innertube_android:${uI.shim.uuidv4()}:0:v=3,api=1,cf=3`,Q={frontendUploadId:A,deviceDisplayName:"Pixel 6 Pro",fileId:`goog-edited-video://generated?videoFileUri=content://media/external/video/media/${uI.shim.uuidv4()}`,mp4MoovAtomRelocationStatus:"UNSUPPORTED",transcodeResult:"DISABLED",connectionType:"WIFI"},B=await this.#A.http.fetch("/upload/youtubei",{baseURL:RI.URLS.YT_UPLOAD,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","x-goog-upload-command":"start","x-goog-upload-protocol":"resumable"},body:JSON.stringify(Q)});if(!B.ok)throw new s("Could not get initial upload data");return{frontend_upload_id:A,upload_id:B.headers.get("x-guploader-uploadid"),upload_url:B.headers.get("x-goog-upload-url"),scotty_resource_id:B.headers.get("x-goog-upload-header-scotty-resource-id"),chunk_granularity:B.headers.get("x-goog-upload-chunk-granularity")}}async#B(A,Q){let B=await this.#A.http.fetch_function(A,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","x-goog-upload-command":"upload, finalize","x-goog-upload-file-name":`file-${Date.now()}`,"x-goog-upload-offset":"0"},body:Q});if(!B.ok)throw new s("Could not upload video");return await B.json()}async#I(A,Q,B){return await this.#A.actions.execute("/upload/createvideo",{resourceId:{scottyResourceId:{id:Q.scottyResourceId}},frontendUploadId:A.frontend_upload_id,initialMetadata:{title:{newTitle:B.title},description:{newDescription:B.description,shouldSegment:!0},privacy:{newPrivacy:B.privacy||"PRIVATE"},draftState:{isDraft:!!B.is_draft}}})}}class R_{#A;constructor(A){this.#A=A}async getInfo(A=!1){if(!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");if(!A&&!!this.#A.session.context.user.onBehalfOfUser)throw new s('Boolean argument must be true when "on_behalf_of_user" is specified.');if(A)return(await new h({getAccountsListInnertubeEndpoint:{requestType:"ACCOUNTS_LIST_REQUEST_TYPE_CHANNEL_SWITCHER",callCircumstance:"SWITCHING_USERS_FULL"}}).call(this.#A,{client:"WEB",parse:!0})).actions_memo?.getType(j5)||[];let B=await new h({getAccountsListInnertubeEndpoint:{}}).call(this.#A,{client:"TV"});return new D_(B)}async getSettings(){let Q=await new h({browseEndpoint:{browseId:"SPaccount_overview"}}).call(this.#A);return new SN(this.#A,Q)}}class L_{#A;constructor(A){this.#A=A}async create(A,Q){if(UD({title:A,video_ids:Q}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let I=await new h({createPlaylistServiceEndpoint:{title:A,videoIds:Q}}).call(this.#A);return{success:I.success,status_code:I.status_code,playlist_id:I.data.playlistId,data:I.data}}async delete(A){if(UD({playlist_id:A}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let B=await new h({deletePlaylistServiceEndpoint:{sourcePlaylistId:A}}).call(this.#A);return{playlist_id:A,success:B.success,status_code:B.status_code,data:B.data}}async addToLibrary(A){if(UD({playlist_id:A}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");return await new h({likeEndpoint:{status:"LIKE",target:A}}).call(this.#A)}async removeFromLibrary(A){if(UD({playlist_id:A}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");return await new h({likeEndpoint:{status:"INDIFFERENT",target:A}}).call(this.#A)}async addVideos(A,Q){if(UD({playlist_id:A,video_ids:Q}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let I=await new h({playlistEditEndpoint:{playlistId:A,actions:Q.map((D)=>({action:"ACTION_ADD_VIDEO",addedVideoId:D}))}}).call(this.#A);return{playlist_id:A,action_result:I.data.actions}}async removeVideos(A,Q,B=!1){if(UD({playlist_id:A,video_ids:Q}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let I=await this.#Q(A);if(!I.info.is_editable)throw new s("This playlist cannot be edited.",A);let D={playlistId:A,actions:[]},C=async(Z)=>{let U=B?"set_video_id":"id";if(Z.videos.filter((w)=>Q.includes(w.key(U).string())).forEach((w)=>D.actions.push({action:"ACTION_REMOVE_VIDEO",setVideoId:w.key("set_video_id").string()})),D.actions.length<Q.length){let w=await Z.getContinuation();return C(w)}};if(await C(I),!D.actions.length)throw new s("Given video ids were not found in this playlist.",Q);let H=await new h({playlistEditEndpoint:D}).call(this.#A);return{playlist_id:A,action_result:H.data.actions}}async moveVideo(A,Q,B){if(UD({playlist_id:A,moved_video_id:Q,predecessor_video_id:B}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let I=await this.#Q(A);if(!I.info.is_editable)throw new s("This playlist cannot be edited.",A);let D={playlistId:A,actions:[]},C,G,H=async(O)=>{let w=O.videos.find((P)=>Q===P.key("id").string()),L=O.videos.find((P)=>B===P.key("id").string());if(C=C||w?.key("set_video_id").string(),G=G||L?.key("set_video_id").string(),!C||!G){let P=await O.getContinuation();return H(P)}};await H(I),D.actions.push({action:"ACTION_MOVE_VIDEO_AFTER",setVideoId:C,movedSetVideoIdPredecessor:G});let U=await new h({playlistEditEndpoint:D}).call(this.#A);return{playlist_id:A,action_result:U.data.actions}}async#Q(A){if(!A.startsWith("VL"))A=`VL${A}`;let B=await new h({browseEndpoint:{browseId:A}}).call(this.#A,{parse:!0});return new xG(this.#A,B,!0)}async setName(A,Q){if(UD({playlist_id:A,name:Q}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let B={playlist_id:A,actions:[]};B.actions.push({action:"ACTION_SET_PLAYLIST_NAME",playlistName:Q});let D=await new h({playlistEditEndpoint:B}).call(this.#A);return{playlist_id:A,action_result:D.data.actions}}async setDescription(A,Q){if(UD({playlist_id:A,description:Q}),!this.#A.session.logged_in)throw new s("You must be signed in to perform this operation.");let B={playlistId:A,actions:[]};B.actions.push({action:"ACTION_SET_PLAYLIST_DESCRIPTION",playlistDescription:Q});let D=await new h({playlistEditEndpoint:B}).call(this.#A);return{playlist_id:A,action_result:D.data.actions}}}class M_{#A;constructor(A){this.#A=A}async like(A){if(UD({video_id:A}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");return new h({likeEndpoint:{status:"LIKE",target:A}}).call(this.#A,{client:"TV"})}async dislike(A){if(UD({video_id:A}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");return new h({likeEndpoint:{status:"DISLIKE",target:A}}).call(this.#A,{client:"TV"})}async removeRating(A){if(UD({video_id:A}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");return new h({likeEndpoint:{status:"INDIFFERENT",target:A}}).call(this.#A,{client:"TV"})}async subscribe(A){if(UD({channel_id:A}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");return new h({subscribeEndpoint:{channelIds:[A],params:"EgIIAhgA"}}).call(this.#A)}async unsubscribe(A){if(UD({channel_id:A}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");return new h({unsubscribeEndpoint:{channelIds:[A],params:"CgIIAhgA"}}).call(this.#A)}async comment(A,Q){if(UD({video_id:A,text:Q}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");let B=POA.encode({videoId:A,params:{index:0},number:7}),I=encodeURIComponent(oC(B.finish()));return new h({createCommentEndpoint:{commentText:Q,createCommentParams:I}}).call(this.#A)}async translate(A,Q,B={}){UD({text:A,target_language:Q});let I=bT(22,{text:A,target_language:Q,...B}),C=await new h({performCommentActionEndpoint:{action:I}}).call(this.#A),G=C.data.frameworkUpdates.entityBatchUpdate.mutations[0].payload.commentEntityPayload;return{success:C.success,status_code:C.status_code,translated_content:G.translatedContent.content,data:C.data}}async setNotificationPreferences(A,Q){if(UD({channel_id:A,type:Q}),!this.#A.session.logged_in)throw Error("You must be signed in to perform this operation.");let B={PERSONALIZED:1,ALL:2,NONE:3};if(!Object.keys(B).includes(Q.toUpperCase()))throw Error(`Invalid notification preference type: ${Q}`);let I=ROA.encode({channelId:A,prefId:{index:B[Q.toUpperCase()]},number0:0,number1:4}),D=encodeURIComponent(oC(I.finish()));return new h({modifyChannelNotificationPreferenceEndpoint:{params:D}}).call(this.#A)}}class Q7{#A;constructor(A){this.#A=A}static async create(A={}){return new Q7(await G$.create(A))}async getInfo(A,Q){UD({target:A});let B={videoId:A instanceof h?A.payload?.videoId:A,playlistId:A instanceof h?A.payload?.playlistId:void 0,playlistIndex:A instanceof h?A.payload?.playlistIndex:void 0,params:A instanceof h?A.payload?.params:void 0,racyCheckOk:!0,contentCheckOk:!0},I=new h({watchEndpoint:B}),D=new h({watchNextEndpoint:B}),C=this.#A,G={playbackContext:{contentPlaybackContext:{vis:0,splay:!1,lactMilliseconds:"-1",signatureTimestamp:C.player?.signature_timestamp}},client:Q?.client};if(Q?.po_token)G.serviceIntegrityDimensions={poToken:Q.po_token};else if(C.po_token)G.serviceIntegrityDimensions={poToken:C.po_token};let H=I.call(C.actions,G),Z=D.call(C.actions),U=await Promise.all([H,Z]),O=yJ(16);return new E$(U,C.actions,O)}async getBasicInfo(A,Q){UD({video_id:A});let B=new h({watchEndpoint:{videoId:A,racyCheckOk:!0,contentCheckOk:!0}}),I=this.#A,D={playbackContext:{contentPlaybackContext:{vis:0,splay:!1,lactMilliseconds:"-1",signatureTimestamp:I.player?.signature_timestamp}},client:Q?.client};if(Q?.po_token)D.serviceIntegrityDimensions={poToken:Q.po_token};else if(I.po_token)D.serviceIntegrityDimensions={poToken:I.po_token};let C=await B.call(I.actions,D),G=yJ(16);return new E$([C],I.actions,G)}async getShortsVideoInfo(A,Q){UD({video_id:A});let B=new h({reelWatchEndpoint:{disablePlayerResponse:!1,params:"CAUwAg%3D%3D",videoId:A}}),I=this.#A.actions,D=B.call(I,{client:Q}),C=_OA.encode({shortId:A,params:{number:5},feature2:25,feature3:0}),G=encodeURIComponent(oC(C.finish())),H=I.execute("/reel/reel_watch_sequence",{sequenceParams:G}),Z=await Promise.all([D,H]),U=yJ(16);return new Y_([Z[0]],I,U,Z[1])}async search(A,Q={}){UD({query:A});let B={};if(B.filters={},Q.prioritize)B.prioritize=OOA[Q.prioritize.toUpperCase()];if(Q.upload_date)B.filters.uploadDate=VOA[Q.upload_date.toUpperCase()];if(Q.type)B.filters.type=wOA[Q.type.toUpperCase()];if(Q.duration)B.filters.duration=NOA[Q.duration.toUpperCase()];if(Q.features)for(let C of Q.features)switch(C){case"360":B.filters.features360=!0;break;case"3d":B.filters.features3d=!0;break;case"4k":B.filters.features4k=!0;break;case"creative_commons":B.filters.featuresCreativeCommons=!0;break;case"hd":B.filters.featuresHd=!0;break;case"hdr":B.filters.featuresHdr=!0;break;case"live":B.filters.featuresLive=!0;break;case"location":B.filters.featuresLocation=!0;break;case"purchased":B.filters.featuresPurchased=!0;break;case"subtitles":B.filters.featuresSubtitles=!0;break;case"vr180":B.filters.featuresVr180=!0;break;default:break}let D=await new h({searchEndpoint:{query:A,params:Q?encodeURIComponent(oC(th.encode(B).finish())):void 0}}).call(this.#A.actions);return new D$(this.actions,D)}async getSearchSuggestions(A,Q){let B=this.#A,I=new URL(`${NC.YT_SUGGESTIONS}/complete/search`);if(I.searchParams.set("client","youtube"),I.searchParams.set("gs_ri","youtube"),I.searchParams.set("gs_id","0"),I.searchParams.set("cp","0"),I.searchParams.set("ds","yt"),I.searchParams.set("sugexp",fB.WEB.SUGG_EXP_ID),I.searchParams.set("hl",B.context.client.hl),I.searchParams.set("gl",B.context.client.gl),I.searchParams.set("q",A),Q)I.searchParams.set("pq",Q);let C=await(await B.http.fetch_function(I,{headers:{Cookie:B.cookie||""}})).text();return JSON.parse(C.replace("window.google.ac.h(","").slice(0,-1))[1].map((H)=>H[0])}async getComments(A,Q,B){UD({video_id:A});let I={TOP_COMMENTS:0,NEWEST_FIRST:1},D=MOA.encode({ctx:{videoId:A},unkParam:6,params:{opts:{videoId:A,sortBy:I[Q||"TOP_COMMENTS"],type:2,commentId:B||""},target:"comments-section"}}),C=encodeURIComponent(oC(D.finish())),H=await new h({continuationCommand:{request:"CONTINUATION_REQUEST_TYPE_WATCH_NEXT",token:C}}).call(this.#A.actions);return new xX(this.actions,H.data)}async getHomeFeed(){let Q=await new h({browseEndpoint:{browseId:"FEwhat_to_watch"}}).call(this.#A.actions);return new I$(this.actions,Q)}async getGuide(){let A=await this.actions.execute("/guide");return new E_(A.data)}async getLibrary(){let Q=await new h({browseEndpoint:{browseId:"FElibrary"}}).call(this.#A.actions);return new J_(this.actions,Q)}async getHistory(){let Q=await new h({browseEndpoint:{browseId:"FEhistory"}}).call(this.#A.actions);return new hX(this.actions,Q)}async getCourses(){let Q=await new h({browseEndpoint:{browseId:"FEcourses_destination"}}).call(this.#A.actions,{parse:!0});return new VD(this.actions,Q)}async getSubscriptionsFeed(){let Q=await new h({browseEndpoint:{browseId:"FEsubscriptions"}}).call(this.#A.actions,{parse:!0});return new VD(this.actions,Q)}async getChannelsFeed(){let Q=await new h({browseEndpoint:{browseId:"FEchannels"}}).call(this.#A.actions,{parse:!0});return new VD(this.actions,Q)}async getChannel(A){UD({id:A});let B=await new h({browseEndpoint:{browseId:A}}).call(this.#A.actions,{parse:!0});if(B.on_response_received_actions?.[0]?.is(eU))B=await B.on_response_received_actions[0].endpoint.call(this.#A.actions,{parse:!0});return new b2(this.actions,B,!0)}async getNotifications(){let A=await this.actions.execute("/notification/get_notification_menu",{notificationsMenuRequestType:"NOTIFICATIONS_MENU_REQUEST_TYPE_INBOX"});return new PN(this.actions,A)}async getUnseenNotificationsCount(){let A=await this.actions.execute("/notification/get_unseen_count");return A.data?.unseenCount||A.data?.actions?.[0].updateNotificationsUnseenCountAction?.unseenCount||0}async getPlaylists(){let Q=await new h({browseEndpoint:{browseId:"FEplaylist_aggregation"}}).call(this.#A.actions,{parse:!0});return new VD(this.actions,Q)}async getPlaylist(A){if(UD({id:A}),!A.startsWith("VL"))A=`VL${A}`;let B=await new h({browseEndpoint:{browseId:A}}).call(this.#A.actions);return new xG(this.actions,B)}async getHashtag(A){UD({hashtag:A});let Q=TOA.encode({params:{hashtag:A,type:1}}),B=encodeURIComponent(oC(Q.finish())),D=await new h({browseEndpoint:{browseId:"FEhashtag",params:B}}).call(this.#A.actions);return new MN(this.actions,D)}async getStreamingData(A,Q={}){let I=(await this.getBasicInfo(A,Q)).chooseFormat(Q);return I.url=await I.decipher(this.#A.player),I}async download(A,Q){return(await this.getBasicInfo(A,Q)).download(Q)}async resolveURL(A){let Q=await this.actions.execute("/navigation/resolve_url",{url:A,parse:!0});if(!Q.endpoint)throw new s("Failed to resolve URL. Expected a NavigationEndpoint but got undefined",Q);return Q.endpoint}async getPost(A,Q){UD({post_id:A,channel_id:Q});let B=jOA.encode({f1:{ucid1:Q,postId:A,ucid2:Q}}),I=encodeURIComponent(oC(B.finish()).replace(/\+/g,"-").replace(/\//g,"_")),C=await new h({browseEndpoint:{browseId:"FEpost_detail",params:I}}).call(this.#A.actions,{parse:!0});return new VD(this.actions,C)}async getPostComments(A,Q,B){UD({post_id:A,channel_id:Q});let I={TOP_COMMENTS:0,NEWEST_FIRST:1},D=gOA.encode({title:"posts",commentDataContainer:{title:"comments-section",commentData:{sortBy:I[B||"TOP_COMMENTS"],f0:2,f1:0,channelId:Q,postId:A},f0:0}}),C=yOA.encode({f0:{location:"FEcomment_post_detail_page_web_top_level",protoData:encodeURIComponent(oC(D.finish()).replace(/\+/g,"-").replace(/\//g,"_"))}}),G=encodeURIComponent(oC(C.finish())),Z=await new h({continuationCommand:{request:"CONTINUATION_REQUEST_TYPE_BROWSE",token:G}}).call(this.#A.actions);return new xX(this.actions,Z.data)}async getAttestationChallenge(A,Q){let B={engagementType:A};if(Q)B.ids=Q;return this.actions.execute("/att/get",{parse:!0,...B})}call(A,Q){return A.call(this.actions,Q)}get music(){return new V_(this.#A)}get studio(){return new N_(this.#A)}get kids(){return new O_(this.#A)}get account(){return new R_(this.#A.actions)}get playlist(){return new L_(this.#A.actions)}get interact(){return new M_(this.#A.actions)}get actions(){return this.#A.actions}get session(){return this.#A}}var __dirname="/home/runner/work/mdl/mdl/node_modules/.bun/youtubei.js@17.0.1/node_modules/youtubei.js/dist/src/platform",rwA=import.meta.url,VIQ=!rwA,wIQ=VIQ?__dirname:P_.dirname(OIQ(rwA));class Sl{#A;#Q;constructor(A=!1,Q){this.#A=Q||Sl.default_persistent_directory,this.#Q=A}static get temp_directory(){return`${qIQ.tmpdir()}/youtubei.js`}static get default_persistent_directory(){return P_.resolve(wIQ,"..","..",".cache","youtubei.js")}get cache_dir(){return this.#Q?this.#A:Sl.temp_directory}async#B(){let A=this.cache_dir;try{if(!(await F$.stat(A)).isDirectory())throw Error("An unexpected file was found in place of the cache directory")}catch(Q){if(Q?.code==="ENOENT")await F$.mkdir(A,{recursive:!0});else throw Q}}async get(A){await this.#B();let Q=P_.resolve(this.cache_dir,A);try{if((await F$.stat(Q)).isFile())return(await F$.readFile(Q)).buffer;throw Error("An unexpected file was found in place of the cache key")}catch(B){if(B?.code==="ENOENT")return;throw B}}async set(A,Q){await this.#B();let B=P_.resolve(this.cache_dir,A);await F$.writeFile(B,new Uint8Array(Q))}async remove(A){await this.#B();let Q=P_.resolve(this.cache_dir,A);try{await F$.unlink(Q)}catch(B){if(B?.code==="ENOENT")return;throw B}}}uI.load({runtime:"node",server:!0,Cache:Sl,sha1Hash:async(A)=>{return iwA.createHash("sha1").update(A).digest("hex")},uuidv4(){return iwA.randomUUID()},eval:OIA,fetch:globalThis.fetch,Request:globalThis.Request,Response:globalThis.Response,Headers:globalThis.Headers,FormData:globalThis.FormData,File:globalThis.File,ReadableStream:zIQ,CustomEvent:Ll});class PIA{provider="youtube-music";displayName="YouTube Music";youtubeClientPromise=null;matchesUrl(A){let Q=A.pathname.replace(/\/+$/,"")||"/";return["music.youtube.com","www.youtube.com","youtube.com"].includes(A.hostname.toLowerCase())&&([/^\/playlist$/i].some((B)=>B.test(Q))&&Boolean(A.searchParams.get("list"))||/^\/watch$/i.test(Q)&&Boolean(A.searchParams.get("v"))||[/^\/browse\/(?:MPRE|FEmusic_library_privately_owned_release)[A-Za-z0-9_-]+$/i].some((B)=>B.test(Q)))}async fetch(A,Q){let B=await this.getClient(),I=this.extractAlbumId(A),D=this.extractVideoId(A);if(I){let U=await B.music.getAlbum(I),O=U.header,w=this.extractPlaylistId(U.url??A),L=O?.thumbnail?.contents?.[0]?.url?.trim()||void 0,P=U.contents.map((k,_)=>this.normalizeTrack(k,_,w,L)).filter((k)=>k!==null);if(P.length===0)throw Error("No tracks were found in the YouTube Music album.");return N5(R5,{id:I,title:O?.title?.toString?.().trim()||"YouTube Music Album",artworkUrl:L,provider:"youtube-music",sourceUrl:U.url||A,tracks:P})}if(D)return this.fetchTrack(B,A,D);let C=this.extractPlaylistId(A),{header:G,items:H}=await this.fetchPlaylistItems(B,C),Z=H.map((U,O)=>this.normalizeTrack(U,O,C,G?.thumbnail?.contents?.[0]?.url?.trim()||void 0)).filter((U)=>U!==null);if(Z.length===0)throw Error("No tracks were found in the YouTube Music playlist.");return N5(R5,{id:C,title:G?.title?.toString?.().trim()||"YouTube Music Playlist",artworkUrl:G?.thumbnail?.contents?.[0]?.url?.trim()||void 0,provider:"youtube-music",sourceUrl:A,tracks:Z})}async fetchTrack(A,Q,B){let I=this.tryExtractPlaylistId(Q);if(I){let{header:Z,items:U}=await this.fetchPlaylistItems(A,I),O=U.map((w,L)=>this.normalizeTrack(w,L,I,Z?.thumbnail?.contents?.[0]?.url?.trim()||void 0)).find((w)=>w?.id===B);if(!O)throw Error("Could not find the YouTube Music track in the playlist.");return N5(R5,{id:O.id,title:O.title,owner:O.artists[0],artworkUrl:O.artworkUrl,provider:"youtube-music",sourceUrl:O.sourceUrl||Q,tracks:[O]})}let D=await A.music.getInfo(B),C=D.basic_info?.title?.trim(),G=D.basic_info?.author?.trim();if(!C||!G||!D.basic_info?.id)throw Error("Could not find YouTube Music track metadata.");let H={id:D.basic_info.id,title:C,artists:[G],artworkUrl:D.basic_info.thumbnail?.[0]?.url?.trim()||void 0,durationMs:typeof D.basic_info.duration==="number"?D.basic_info.duration*1000:void 0,sourceUrl:D.basic_info.url_canonical?.trim()||Q};return N5(R5,{id:H.id,title:H.title,owner:G,artworkUrl:H.artworkUrl,provider:"youtube-music",sourceUrl:H.sourceUrl||Q,tracks:[H]})}normalizeTrack(A,Q,B,I){if(A.item_type!=="video")return null;let D=A.title?.toString?.().trim(),C=this.extractContributorNames(A.artists,A.authors);if(!A.id||!D||C.length===0)return null;return{id:A.id,title:D,artists:C,album:A.album?.toString?.().trim()||void 0,artworkUrl:Z0(A.thumbnail?.contents?.[0]?.url,I),durationMs:this.parseDurationMs(A.duration?.toString?.()),sourceUrl:`https://music.youtube.com/watch?v=${A.id}&list=${B}`}}extractContributorNames(A,Q){return((A?.length)?A:Q??[]).map((I)=>typeof I==="object"&&("name"in I)?I.name?.trim():I?.toString?.().trim()).filter((I)=>Boolean(I))}extractPlaylistId(A){let Q=this.tryExtractPlaylistId(A);if(!Q)throw Error("Could not determine the YouTube Music playlist id from the URL.");return Q}tryExtractPlaylistId(A){return new URL(A).searchParams.get("list")?.trim()||null}extractVideoId(A){let Q=new URL(A);if(!/^\/watch$/i.test(Q.pathname))return null;return Q.searchParams.get("v")?.trim()||null}extractAlbumId(A){return new URL(A).pathname.match(/\/browse\/((?:MPRE|FEmusic_library_privately_owned_release)[A-Za-z0-9_-]+)/i)?.[1]??null}parseDurationMs(A){if(!A)return;let Q=A.split(":").map((C)=>Number.parseInt(C,10)).filter((C)=>Number.isFinite(C));if(Q.length<2||Q.length>3)return;let[B,I,D]=Q.length===3?Q:[0,Q[0],Q[1]];return((B*60+I)*60+D)*1000}async getClient(){return this.youtubeClientPromise??=Q7.create(),this.youtubeClientPromise}async fetchPlaylistItems(A,Q){let B=await A.music.getPlaylist(Q),I=[...B.items];while(B.has_continuation)B=await B.getContinuation(),I.push(...B.items);return{header:B.header,items:I}}}var twA=[new qBA,new UBA,new KBA,new PIA,new zBA,new $BA,new WBA,new YBA,new VBA],SIA=Object.fromEntries(twA.map((A)=>[A.provider,A])),TIA=twA,kl=TIA.map(({provider:A})=>A);function mG(A){return SIA[A]?.displayName??"Spotify"}function awA(A){let Q=_l(A);if(!Q)return"unknown";return Tl(Q)?.provider??kIA(Q)??"unknown"}function _IA(A){let Q=A.trim();if(!Q)return"Enter a music URL.";let B=_l(Q);if(!B)return"Invalid URL. Provide a full http:// or https:// music URL.";if(Tl(B)||kIA(B))return null;return`Unsupported music URL. Recognized providers: ${kl.map(mG).join(", ")}.`}async function ewA(A,Q){let B=_IA(A);if(B)throw Error(B);let I=_l(A);if(!I)throw Error("Invalid URL. Provide a full http:// or https:// music URL.");let D=Tl(I);if(D)return D;let C=kIA(I);if(!C)throw Error(`Unsupported music URL. Recognized providers: ${kl.map(mG).join(", ")}.`);let H=await(Q?.resolveUrl??LIQ)(I.toString()),Z=_l(H);if(!Z)throw Error(`Could not resolve the ${mG(C)} short link to a valid music URL.`);let U=Tl(Z);if(!U||U.provider!==C)throw Error(`Could not resolve the ${mG(C)} short link to a supported music URL.`);return U}function Tl(A){let Q=TIA.find((B)=>B.matchesUrl(A));if(!Q)return null;return{provider:Q.provider,normalizedUrl:RIQ(A,Q.provider)}}function kIA(A){let Q=A.hostname.toLowerCase();return TIA.find((B)=>B.shortLinkHosts?.includes(Q))?.provider??null}function _l(A){try{let Q=new URL(A.trim());if(Q.protocol!=="http:"&&Q.protocol!=="https:")return null;return Q}catch{return null}}function NIQ(A){let Q=new URL(A.toString());return Q.search="",Q.hash="",Q.toString()}function RIQ(A,Q){if(Q==="apple-music")return swA(A,["i"]);if(Q==="amazon-music")return swA(A,["trackAsin"]);if(Q!=="youtube-music")return NIQ(A);let B=new URL(A.toString()),I=B.searchParams.get("list")?.trim(),D=B.searchParams.get("v")?.trim();if(B.search="",B.hash="",D)B.searchParams.set("v",D);if(I)B.searchParams.set("list",I);return B.toString()}function swA(A,Q){let B=new URL(A.toString()),I=Q.map((D)=>[D,B.searchParams.get(D)?.trim()]).filter((D)=>Boolean(D[1]));B.search="",B.hash="";for(let[D,C]of I)B.searchParams.set(D,C);return B.toString()}async function LIQ(A){let Q=await fetch(A,{headers:{"user-agent":"mdl/0.1"},redirect:"follow"});if(!Q.ok)throw Error(`Short link request failed with status ${Q.status}.`);if(Q.url&&Q.url!==A)return Q.url;let B=await Q.text();return MIQ(B)??Q.url??A}function MIQ(A){return A.match(/https?:\/\/[^\s"'<>]+/i)?.[0]??null}import{access as GDQ,stat as FDQ}from"node:fs/promises";import S_ from"node:path";var vIA=kQ(jIA(),1);import{execFile as xIQ}from"node:child_process";import{mkdtemp as hIQ,rename as mIQ,rm as fIQ,writeFile as uIQ}from"node:fs/promises";import yN from"node:path";import{promisify as cIQ}from"node:util";var lIQ=cIQ(xIQ),dIQ=".mdl-metadata-";async function CNA(A){let{filePath:Q,track:B,signal:I}=A,D=await Vq(),C=await hIQ(yN.join(yN.dirname(Q),dIQ)),G=yN.join(C,yN.basename(Q)),H=B.artworkUrl?yN.join(C,nIQ(B.artworkUrl)):null;try{if(H&&B.artworkUrl)try{await oIQ(B.artworkUrl,H,I)}catch{H=null}let Z=["-y","-i",Q,...H?["-i",H]:[],"-map","0:a",...H?["-map","1:v"]:[],"-c","copy","-id3v2_version","3",...pIQ(B,Boolean(H)),G];await lIQ(D,Z,{maxBuffer:8388608,signal:I}),await mIQ(G,Q)}finally{await fIQ(C,{recursive:!0,force:!0})}}function pIQ(A,Q){let B=["-metadata",`title=${A.title}`,"-metadata",`artist=${A.artists.join(", ")}`];if(A.album)B.push("-metadata",`album=${A.album}`);if(Q)B.push("-metadata:s:v","title=Album cover","-metadata:s:v","comment=Cover (front)","-disposition:v:0","attached_pic");return B}async function oIQ(A,Q,B){let I=await fetch(A,{signal:B});if(!I.ok)throw Error(`Failed to download artwork (${I.status})`);let D=await I.arrayBuffer();await uIQ(Q,Buffer.from(D))}function nIQ(A){return`cover${yN.extname(new URL(A).pathname)||".jpg"}`}var XNA=kQ(jIA(),1);import{execFile as HNA}from"node:child_process";import{mkdir as iIQ}from"node:fs/promises";import rIQ from"node:path";import{Readable as sIQ}from"node:stream";import{pipeline as tIQ}from"node:stream/promises";import{promisify as aIQ}from"node:util";var wjB=aIQ(HNA),eIQ=5,JNA=null;sB.setLevel(sB.Level.ERROR);async function ZNA(A){let Q=`${A.artists.join(", ")} - ${A.title} audio`,I=(await ADQ(Q)).videos.filter((D)=>D.id&&D.url).sort((D,C)=>GNA(A,C)-GNA(A,D));if(I.length===0)throw Error(`No YouTube match found for ${A.artists.join(", ")} - ${A.title}.`);return I}async function KNA(A){let{audioFormat:Q="mp3",audioQuality:B="best",destinationDir:I,index:D,onProgress:C,track:G,youtubeUrl:H,signal:Z}=A,O=`${`${String(D).padStart(2,"0")} - ${XNA.default(`${G.artists.join(", ")} - ${G.title}`)||`track-${D}`}`}.${Q}`,w=rIQ.join(I,O);return await iIQ(I,{recursive:!0}),await BDQ({audioFormat:Q,audioQuality:B,destinationPath:w,onProgress:C,youtubeUrl:H,signal:Z}),{fileName:O,relativePath:O}}async function ADQ(A){return{videos:(await(await UNA()).search(A)).results.map((D)=>QDQ(D)).filter((D)=>D!==null).slice(0,eIQ)}}function QDQ(A){if(A.type!=="Video"||!A.id)return null;let Q=A.title?.toString?.().trim();if(!Q)return null;return{id:A.id,title:Q,author:A.author?.name?.trim(),url:`https://www.youtube.com/watch?v=${A.id}`,seconds:JDQ(A.duration?.text)}}function GNA(A,Q){let B=0,I=`${Q.title} ${Q.author??""}`.toLowerCase();if(I.includes(A.title.toLowerCase()))B+=5;for(let D of A.artists)if(I.includes(D.toLowerCase()))B+=3;if(!I.includes("live"))B+=1;if(!I.includes("cover"))B+=1;if(typeof A.durationMs==="number"&&typeof Q.seconds==="number"){let D=Math.abs(A.durationMs/1000-Q.seconds);B+=Math.max(0,10-D/5)}return B}async function BDQ(A){let Q=await Vq(),B=await IDQ(A.youtubeUrl,A.audioFormat),I=DDQ({audioFormat:A.audioFormat,audioQuality:A.audioQuality,destinationPath:A.destinationPath,inputFormat:B.format}),D=HNA(Q,I,{signal:A.signal,windowsHide:!0}),C=sIQ.fromWeb(B.stream);if(!D.stdin)throw C.destroy(),Error("ffmpeg stdin was not available for audio piping.");let G="",H=EDQ((U)=>{A.onProgress?.({currentSpeed:U.currentSpeed,eta:U.eta,percent:typeof B.contentLength==="number"&&B.contentLength>0?Math.min(100,U.totalSizeBytes/B.contentLength*100):void 0,totalSize:FNA(B.contentLength)||FNA(U.totalSizeBytes)})});D.stderr?.on("data",(U)=>{let O=U.toString();G+=O,H(O)});let Z=new Promise((U,O)=>{D.on("error",O),D.on("close",(w)=>{if(w===0){U();return}O(Error(G.trim()||`ffmpeg exited with code ${w}.`))})});try{await Promise.all([tIQ(C,D.stdin),Z])}catch(U){throw C.destroy(),D.kill("SIGKILL"),U}}async function IDQ(A,Q){let B=CDQ(A),I=await UNA(),D=await I.getStreamingData(B,{client:"ANDROID",type:"audio",format:Q==="opus"?"webm":"mp4"}),C=await I.download(B,{client:"ANDROID",type:"audio",format:Q==="opus"?"webm":"mp4"}),G=String(D.mime_type),H=G.includes("webm")?"webm":"mp4";return{contentLength:typeof D.content_length==="number"?D.content_length:void 0,format:H,mimeType:G,stream:C}}function DDQ(A){let Q=["-y","-v","error","-nostats","-progress","pipe:2","-f",A.inputFormat,"-i","pipe:0","-vn"];if(A.audioQuality!=="best"){if(/^\d+K$/i.test(A.audioQuality))Q.push("-b:a",A.audioQuality);else if(/^\d+$/.test(A.audioQuality)&&A.audioFormat==="mp3")Q.push("-q:a",A.audioQuality)}switch(A.audioFormat){case"m4a":Q.push("-c:a","aac");break;case"opus":Q.push("-c:a","libopus");break;case"flac":Q.push("-c:a","flac");break;case"wav":Q.push("-c:a","pcm_s16le");break;default:Q.push("-c:a","libmp3lame");break}return Q.push(A.destinationPath),Q}function EDQ(A){let Q="",B={totalSizeBytes:0};return(I)=>{Q+=I;while(Q.includes(`
|
|
525
525
|
`)){let D=Q.indexOf(`
|
|
526
526
|
`),C=Q.slice(0,D).trim();if(Q=Q.slice(D+1),!C)continue;let[G,H]=C.split("=");if(!G||H===void 0)continue;if(G==="total_size"){let Z=Number.parseInt(H,10);if(Number.isFinite(Z))B.totalSizeBytes=Z}else if(G==="speed")B.currentSpeed=H==="N/A"?void 0:H;else if(G==="progress")A(B)}}}function CDQ(A){let Q=new URL(A),B=Q.searchParams.get("v")?.trim();if(B)return B;if(Q.hostname==="youtu.be"){let I=Q.pathname.replace(/^\/+/,"").trim();if(I)return I}throw Error(`Invalid YouTube URL: ${A}`)}function JDQ(A){if(!A)return;let Q=A.split(":").map((C)=>Number.parseInt(C,10)).filter((C)=>Number.isFinite(C));if(Q.length<2||Q.length>3)return;let[B,I,D]=Q.length===3?Q:[0,Q[0],Q[1]];return(B*60+I)*60+D}function FNA(A){if(typeof A!=="number"||!Number.isFinite(A)||A<=0)return;let Q=["B","KB","MB","GB"],B=A,I=0;while(B>=1024&&I<Q.length-1)B/=1024,I+=1;return`${Math.round(B*10)/10} ${Q[I]}`}async function UNA(){return JNA??=Q7.create(),JNA}var HDQ=45000,jl=300,gN=2,m8={initializing:[1,5],searching:[5,45],downloading:[45,90],metadata:[90,96],manifest:[96,99]};async function WNA(A){let{audioFormat:Q,audioQuality:B,downloadParallelism:I=5,playlist:D,outputRootDir:C,onProgress:G,signal:H}=A,Z=await KDQ(C,D),U=await Nq(Z),O=U??{version:1,provider:D.provider,playlistId:D.id,playlistTitle:D.title,playlistUrl:D.sourceUrl,generatedAt:new Date().toISOString(),tracks:[]},w=new Map(O.tracks.map((l)=>[l.sourceTrackId,l])),L=[],P=0,k=0,_=Promise.resolve();G?.({current:0,total:D.tracks.length,completed:0,downloaded:P,skipped:k,failed:L.length,workerCount:I,playlistDir:Z,progress:0,stage:"checking-manifest",message:U?`Loaded existing manifest with ${O.tracks.length} tracked files`:`Creating a new manifest in ${wq}. Downloading up to ${I} tracks in parallel`}),await XDQ(D.tracks,I,async(l,GA,o)=>{H?.throwIfAborted();let BA=GA+1,JA=(UA)=>{let OA=UA.progress??ZDQ(UA.stage);G?.({current:BA,total:D.tracks.length,completed:P+k+L.length,downloaded:P,skipped:k,failed:L.length,trackIndex:BA,workerCount:I,workerId:o,playlistDir:Z,progress:OA,track:l,...UA})};JA({progress:gIA(...m8.initializing,0),stage:"initializing",message:"Preparing track"});let XA=w.get(l.id);if(XA&&await VDQ(S_.join(Z,XA.relativePath))){k+=1,JA({progress:100,stage:"skipped",message:"Already downloaded"});return}try{let UA=await VC.runPromise(kT({baseDelayMs:jl,maxRetries:gN,effect:VC.gen(function*(){yield*VC.sync(()=>H?.throwIfAborted());let fA=yield*kT({baseDelayMs:jl,maxRetries:gN,effect:VC.tryPromise({try:()=>$DQ({durationMs:HDQ,endPercent:m8.searching[1],onProgress:(LA)=>{JA({progress:LA,stage:"searching-youtube",message:"Searching YouTube"})},startPercent:m8.searching[0],task:()=>ZNA(l)}),catch:(LA)=>yl(l,"searching-youtube",LA)}),onRetry:(LA,DQ)=>{JA({progress:m8.searching[0],stage:"searching-youtube",message:yIA("Searching YouTube",LA,DQ)})}}),RA=null;for(let LA of fA){yield*VC.sync(()=>H?.throwIfAborted());let DQ="Downloading track";JA({progress:m8.downloading[0],stage:"downloading-audio",downloadPercent:0,youtubeUrl:LA.url,message:DQ});let lQ=yield*VC.either(kT({baseDelayMs:jl,maxRetries:gN,effect:VC.tryPromise({try:()=>KNA({audioFormat:Q,audioQuality:B,destinationDir:Z,index:GA+1,onProgress:(SQ)=>{JA({progress:gIA(...m8.downloading,YDQ(SQ.percent)),downloadPercent:zNA(SQ.percent??0),stage:"downloading-audio",youtubeUrl:LA.url,message:DQ})},track:l,youtubeUrl:LA.url,signal:H}),catch:(SQ)=>yl(l,"downloading-audio",SQ)}),onRetry:(SQ,iA)=>{JA({progress:m8.downloading[0],stage:"downloading-audio",youtubeUrl:LA.url,message:yIA(DQ,SQ,iA)})},shouldRetry:(SQ)=>!YNA(SQ)}));if(lQ._tag==="Right"){let SQ=lQ.right;yield*VC.sync(()=>H?.throwIfAborted()),JA({progress:m8.metadata[0],stage:"writing-metadata",youtubeUrl:LA.url,message:"Embedding metadata"}),yield*kT({baseDelayMs:jl,maxRetries:gN,effect:VC.tryPromise({try:()=>CNA({filePath:S_.join(Z,SQ.relativePath),track:l,signal:H}),catch:(vA)=>yl(l,"writing-metadata",vA)}),onRetry:(vA,zA)=>{JA({progress:m8.metadata[0],stage:"writing-metadata",youtubeUrl:LA.url,message:yIA("Embedding metadata",vA,zA)})}});let iA=ODQ(l,LA,SQ);return JA({progress:m8.manifest[0],stage:"writing-manifest",fileName:SQ.fileName,youtubeUrl:LA.url,message:"Writing manifest"}),_=_.then(async()=>{O=qDQ(O,iA),O={...O,generatedAt:new Date().toISOString()},await ZBA(Z,O)}),yield*VC.tryPromise({try:()=>_,catch:(vA)=>yl(l,"writing-manifest",vA)}),{file:SQ,youtubeMatch:LA}}if(RA=lQ.left,YNA(RA))continue;yield*VC.fail(lQ.left)}return yield*VC.fail(RA??new Oq({reason:"All YouTube candidates failed.",stage:"downloading-audio",trackTitle:qNA(l)}))}),onRetry:(fA,RA)=>{JA({stage:"initializing",message:wDQ(fA,RA)})},shouldRetry:RDQ}));P+=1;let OA=await FDQ(S_.join(Z,UA.file.relativePath));JA({progress:100,stage:"completed",fileName:UA.file.fileName,fileSizeLabel:WDQ(OA.size),youtubeUrl:UA.youtubeMatch.url,message:UA.file.fileName})}catch(UA){if(LDQ(UA))throw UA;let OA=_T(UA);L.push({track:l,reason:OA}),JA({progress:100,stage:"failed",message:OA})}}),O={...O,generatedAt:new Date().toISOString()};let x=await ZBA(Z,O);return{downloaded:P,skipped:k,failed:L,playlistDir:Z,manifestPath:x}}async function XDQ(A,Q,B){let I=Array(A.length),D=0,C=Array.from({length:Math.min(Q,A.length)},async(G,H)=>{while(D<A.length){let Z=D;D+=1,I[Z]=await B(A[Z],Z,H)}});return await Promise.all(C),I}function ZDQ(A){switch(A){case"initializing":return m8.initializing[0];case"searching-youtube":return m8.searching[0];case"downloading-audio":return m8.downloading[0];case"writing-metadata":return m8.metadata[0];case"writing-manifest":return m8.manifest[0];case"completed":case"skipped":case"failed":return 100;case"checking-manifest":return 0;default:return 0}}async function KDQ(A,Q){let B=S_.resolve(A,UDQ(Q)),I=await Nq(B);if($NA(I,Q))return B;let D=S_.resolve(A,vIA.default(Q.title)||Q.id),C=await Nq(D);if($NA(C,Q))return D;return B}function UDQ(A){return vIA.default(A.title)||"playlist"}function $NA(A,Q){if(!A)return!1;return A.playlistId===Q.id&&A.provider===Q.provider&&A.playlistUrl===Q.sourceUrl}async function $DQ(A){let Q=Date.now();A.onProgress(A.startPercent);let B=setInterval(()=>{let I=Math.min((Date.now()-Q)/A.durationMs,1),D=zDQ(I);A.onProgress(gIA(A.startPercent,A.endPercent,D))},250);try{let I=await A.task();return A.onProgress(A.endPercent),I}finally{clearInterval(B)}}function gIA(A,Q,B){return zNA(A+(Q-A)*Math.max(0,Math.min(B,1)))}function YDQ(A){if(typeof A!=="number"||Number.isNaN(A))return 0;return Math.max(0,Math.min(A,100))/100}function zNA(A){return Math.max(0,Math.min(100,A))}function WDQ(A){if(A<1048576)return`${Math.max(1,Math.round(A/102.4)/10)}kb`;return`${Math.round(A/1048576*10)/10}mb`}function zDQ(A){return 1-(1-Math.max(0,Math.min(A,1)))**2}function qDQ(A,Q){let B=A.tracks.findIndex((I)=>I.sourceTrackId===Q.sourceTrackId);if(B>=0)return{...A,tracks:A.tracks.map((I,D)=>D===B?Q:I)};return{...A,tracks:[...A.tracks,Q]}}function ODQ(A,Q,B){return{sourceTrackId:A.id,title:A.title,artists:A.artists,album:A.album,artworkUrl:A.artworkUrl,sourceUrl:A.sourceUrl,youtubeUrl:Q.url,youtubeId:Q.id,fileName:B.fileName,relativePath:B.relativePath,downloadedAt:new Date().toISOString()}}async function VDQ(A){try{return await GDQ(A),!0}catch{return!1}}function YNA(A){let Q=_T(A).toLowerCase();return Q.includes("video is not available")||Q.includes("private video")||Q.includes("sign in to confirm your age")||Q.includes("playback on other websites has been disabled")||Q.includes("members-only")}function yl(A,Q,B){return new Oq({reason:NDQ(B),stage:Q,trackTitle:qNA(A)})}function yIA(A,Q,B){return`${A} retry ${Q}/${gN}: ${_T(B)}`}function wDQ(A,Q){return`Retrying track ${A}/${gN}: ${_T(Q)}`}function NDQ(A){if(A instanceof Error)return A.message;return String(A)}function qNA(A){return`${A.artists.join(", ")} - ${A.title}`}function RDQ(A){if(!(A instanceof Oq))return!1;return A.reason.toLowerCase().includes("fetch failed")}function LDQ(A){return A instanceof Error&&A.name==="AbortError"}var vN=kQ(hD(),1);function ONA(){return vN.jsxDEV(VI,{flexDirection:"column",borderStyle:"round",borderColor:"cyan",paddingX:1,paddingY:0,children:[vN.jsxDEV(VI,{justifyContent:"space-between",flexWrap:"wrap",children:[vN.jsxDEV(UB,{color:"cyanBright",bold:!0,children:"mdl - MusicDownLoader"},void 0,!1,void 0,this),vN.jsxDEV(UB,{color:"gray",children:["v",UqA]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),vN.jsxDEV(UB,{color:"gray",children:"Sync music from major streaming services locally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var gl=kQ(hD(),1);function fG(A){return gl.jsxDEV(VI,{flexDirection:"column",children:[gl.jsxDEV(UB,{color:A.tone,children:A.value},void 0,!1,void 0,this),gl.jsxDEV(UB,{color:A.tone,children:A.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var bIA=kQ(hD(),1);function f8({title:A,titleColor:Q="magentaBright",children:B,...I}){return bIA.jsxDEV(VI,{flexDirection:"column",borderStyle:"round",borderColor:"gray",paddingX:1,paddingY:0,...I,children:[bIA.jsxDEV(UB,{color:Q,bold:!0,children:A},void 0,!1,void 0,this),B]},void 0,!0,void 0,this)}var bN=kQ(pI(),1);var LNA=kQ(RNA(),1);function SDQ({type:A="dots"}){let[Q,B]=bN.useState(0),I=LNA.default[A];return bN.useEffect(()=>{let D=setInterval(()=>{B((C)=>{return C===I.frames.length-1?0:C+1})},I.interval);return()=>{clearInterval(D)}},[I]),bN.default.createElement(UB,null,I.frames[Q])}var bl=SDQ;function MNA(A){switch(A){case"completed":return"green";case"skipped":return"yellow";case"failed":return"red";case"queued":return"magenta";case"writing-metadata":case"writing-manifest":return"magenta";default:return"cyan"}}function PNA(A){switch(A){case"completed":return"+";case"skipped":return"!";case"failed":return"x";case"queued":return"·";default:return"·"}}function SNA(A){switch(A){case"queued":return"Queued";case"initializing":case"searching-youtube":return"Searching";case"downloading-audio":case"writing-metadata":case"writing-manifest":return"Download";case"completed":return"Complete";case"skipped":return"Skipped (already downloaded)";case"failed":return"Error";default:return"Queued"}}var _NA=kQ(hD(),1);function TNA(A){let Q=Math.max(0,Math.min(100,A.percent)),B=Math.round(Q),I=Math.round(Q/100*A.width),D=`[${"=".repeat(I)}${"-".repeat(A.width-I)}]`;return _NA.jsxDEV(UB,{color:A.color,children:[D,!!A.showPercent&&` ${String(B)}%`.padEnd(5," ")]},void 0,!0,void 0,this)}var fX=kQ(hD(),1),xl=30;function hl({slot:A}){let Q=MNA(A.stage),B=A.title.padEnd(xl," "),I=SNA(A.stage),D=A.stage==="failed"?`Error: ${A.message}`:`${I}${A.stage==="completed"&&A.fileSizeLabel?` • ${A.fileSizeLabel}`:""}`;return fX.jsxDEV(VI,{gap:1,children:[A.isActive?fX.jsxDEV(bl,{type:"dots"},void 0,!1,void 0,this):fX.jsxDEV(UB,{color:Q,children:PNA(A.stage)},void 0,!1,void 0,this),fX.jsxDEV(UB,{color:Q,children:[String(A.trackIndex).padStart(2,"0"),"."]},void 0,!0,void 0,this),fX.jsxDEV(UB,{children:B},void 0,!1,void 0,this),fX.jsxDEV(UB,{color:A.stage==="failed"?"red":"gray",children:D},void 0,!1,void 0,this),A.stage==="downloading-audio"?fX.jsxDEV(TNA,{color:Q,percent:A.downloadPercent??0,showPercent:!1,width:24},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var y1=kQ(hD(),1);function kNA(A){let Q=A.progress?.total??A.playlist.tracks.length;return y1.jsxDEV(VI,{flexDirection:"column",children:[y1.jsxDEV(f8,{title:"Finished",borderColor:"green",titleColor:"green",children:[y1.jsxDEV(VI,{children:[y1.jsxDEV(UB,{color:"greenBright",children:A.playlist.title},void 0,!1,void 0,this),!!A.playlist.owner&&y1.jsxDEV(UB,{color:"gray",children:[" ⦁ ",A.playlist.owner]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y1.jsxDEV(VI,{marginTop:1,gap:2,children:[y1.jsxDEV(fG,{label:"Downloaded",tone:"green",value:String(A.summary.downloaded)},void 0,!1,void 0,this),y1.jsxDEV(fG,{label:"Skipped",tone:"yellow",value:String(A.summary.skipped)},void 0,!1,void 0,this),y1.jsxDEV(fG,{label:"Failed",tone:"red",value:String(A.summary.failed.length)},void 0,!1,void 0,this),y1.jsxDEV(fG,{label:"Tracks",tone:"cyan",value:String(Q)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y1.jsxDEV(UB,{color:"gray",italic:!0,underline:!0,children:A.summary.playlistDir},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y1.jsxDEV(f8,{title:"Tracks",borderColor:"green",titleColor:"green",children:A.workerSlots.map((B)=>y1.jsxDEV(hl,{slot:B},B.trackId,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var T_=kQ(hD(),1);function jNA(A){return T_.jsxDEV(VI,{flexDirection:"column",gap:1,children:T_.jsxDEV(f8,{title:"Error",children:[T_.jsxDEV(UB,{color:"redBright",children:A.message},void 0,!1,void 0,this),T_.jsxDEV(UB,{color:"gray",children:"The process will exit shortly."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var ml=kQ(pI(),1);var TDQ=/https?:\/\/[^\s"'<>]+/i;function xIA(A){let Q=A.replace(/\r\n?/g,`
|
|
527
527
|
`),B=Q.match(TDQ)?.[0];if(B)return B.trim();return Q.replace(/\s+/g,"")}var uX=kQ(hD(),1);function yNA(A){let[Q,B]=ml.useState({cursorOffset:A.value.length});ml.useEffect(()=>{B((D)=>({cursorOffset:Math.min(D.cursorOffset,A.value.length)}))},[A.value]),QK((D,C)=>{if(C.upArrow||C.downArrow||C.ctrl&&D==="c"||C.tab||C.shift&&C.tab)return;if(C.return){A.onSubmit(xIA(A.value));return}let G=Q.cursorOffset,H=A.value;if(C.leftArrow)G=Math.max(0,Q.cursorOffset-1);else if(C.rightArrow)G=Math.min(A.value.length,Q.cursorOffset+1);else if(C.backspace||C.delete){if(Q.cursorOffset>0)H=A.value.slice(0,Q.cursorOffset-1)+A.value.slice(Q.cursorOffset),G=Q.cursorOffset-1}else H=A.value.slice(0,Q.cursorOffset)+D+A.value.slice(Q.cursorOffset),G=Q.cursorOffset+D.length;let Z=xIA(H),U=Math.min(G,Z.length);if(B({cursorOffset:U}),Z!==A.value)A.onChange(Z)});let I=_DQ(A.value,Q.cursorOffset);return uX.jsxDEV(UB,{wrap:"truncate-middle",children:I},void 0,!1,void 0,this)}function _DQ(A,Q){if(!A)return uX.jsxDEV(UB,{inverse:!0,children:" "},void 0,!1,void 0,this);let B=A.slice(0,Q),I=A[Q],D=A.slice(Q+1);if(Q===A.length)return[uX.jsxDEV(UB,{children:A},"value",!1,void 0,this),uX.jsxDEV(UB,{inverse:!0,children:" "},"cursor-end",!1,void 0,this)];return[uX.jsxDEV(UB,{children:B},"before-cursor",!1,void 0,this),uX.jsxDEV(UB,{inverse:!0,children:I},"cursor",!1,void 0,this),uX.jsxDEV(UB,{children:D},"after-cursor",!1,void 0,this)]}var uG=kQ(hD(),1);function gNA(A){return uG.jsxDEV(f8,{title:"Music URL",titleColor:"green",borderColor:"green",children:[uG.jsxDEV(UB,{color:"green",children:kl.map(mG).join(", ")},void 0,!1,void 0,this),uG.jsxDEV(UB,{children:"Paste a music URL and press Enter:"},void 0,!1,void 0,this),uG.jsxDEV(yNA,{value:A.url,onChange:A.onChange,onSubmit:A.onSubmit},void 0,!1,void 0,this),A.errorMessage?uG.jsxDEV(UB,{color:"redBright",children:A.errorMessage},void 0,!1,void 0,this):uG.jsxDEV(UB,{children:" "},void 0,!1,void 0,this),uG.jsxDEV(UB,{color:"grey",italic:!0,children:["A folder in ",A.outputDir,"/{",uG.jsxDEV(UB,{bold:!0,italic:!0,children:"playlist"},void 0,!1,void 0,this),"} will be created with music files and a"," ",uG.jsxDEV(UB,{bold:!0,italic:!0,children:wq},void 0,!1,void 0,this)," ","manifest"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var X$=kQ(hD(),1);function vNA(A){let Q=awA(A.url),B=Q==="unknown"?"Checking provider":mG(Q);return X$.jsxDEV(VI,{flexDirection:"column",gap:1,children:X$.jsxDEV(f8,{title:A.title,titleColor:A.titleColor,borderColor:A.borderColor,children:[X$.jsxDEV(bl,{type:"simpleDots"},void 0,!1,void 0,this),X$.jsxDEV(ly,{},void 0,!1,void 0,this),X$.jsxDEV(UB,{color:"cyan",children:A.message},void 0,!1,void 0,this),X$.jsxDEV(UB,{color:"gray",children:`${B} • ${A.url}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var fl=kQ(hD(),1);function bNA({defaultValue:A=!0,description:Q,onSubmit:B,title:I,titleColor:D="yellow",borderColor:C="yellow"}){let G=A?"[Y/n]":"[y/N]";return QK((H,Z)=>{if(Z.return){B(A);return}let U=H.trim().toLowerCase();if(U==="y")B(!0);if(U==="n")B(!1)}),fl.jsxDEV(f8,{title:I,titleColor:D,borderColor:C,children:[!!Q&&fl.jsxDEV(UB,{color:"gray",children:Q},void 0,!1,void 0,this),fl.jsxDEV(UB,{color:"blackBright",bold:!0,children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var u8=kQ(pI(),1),PD=kQ(pI(),1);var K$=kQ(hIA(),1),hNA=kQ(hIA(),1),jDQ=({children:A,onMeasure:Q,index:B,width:I,measureKey:D})=>{let C=PD.useRef(null);return PD.useLayoutEffect(()=>{if(C.current){let{height:G}=oy(C.current);Q(B,G)}},[B,Q,I,D,A]),K$.jsx(VI,{ref:C,flexShrink:0,width:"100%",flexDirection:"column",children:A})};function xNA(A){let[Q,B]=PD.useState(A),I=PD.useRef(A),D=PD.useCallback((G)=>{let H=typeof G==="function"?G(I.current):G;I.current=H,B(H)},[]),C=PD.useCallback(()=>I.current,[]);return[Q,D,C]}var yDQ=PD.forwardRef(({scrollOffset:A,onViewportSizeChange:Q,onContentHeightChange:B,onItemHeightChange:I,debug:D=!1,children:C,...G},H)=>{let[Z,U,O]=xNA({height:0,width:0}),[w,L,P]=xNA(0),[k,_]=PD.useState({}),x=PD.useRef(null),l=PD.useRef(null),GA=PD.useRef(0);PD.useLayoutEffect(()=>{if(w!==GA.current)B?.(w,GA.current),GA.current=w},[w,B]);let o=PD.useRef({}),BA=PD.useRef([]),JA=PD.useRef([]),XA=PD.useRef(0),UA=PD.useCallback((RA,LA)=>{let DQ=BA.current[RA]||RA;if(o.current[DQ]!==LA){let lQ=o.current[DQ]||0;o.current={...o.current,[DQ]:LA};let SQ=0;for(let vA of BA.current)SQ+=o.current[vA]||0;let iA=P();if(SQ!==iA)L(SQ);I?.(RA,LA,lQ),XA.current=Math.min(XA.current,RA+1)}},[I,B,P,L]),OA=PD.useCallback(()=>{if(x.current){let{width:RA,height:LA}=oy(x.current),DQ=O();if(RA!==DQ.width||LA!==DQ.height)Q?.({width:RA,height:LA},DQ),U({width:RA,height:LA})}},[x,Q,O,U]);PD.useLayoutEffect(()=>{OA()});let fA=PD.useRef(null);if(fA.current!==C){fA.current=C;let RA=[],LA={};PD.Children.forEach(C,(SQ,iA)=>{if(!SQ)return;let vA=PD.isValidElement(SQ)?SQ.key:null,zA=vA!==null?vA:iA;RA[iA]=zA;let kA=o.current[zA]||0;LA[zA]=kA}),o.current=LA,BA.current=RA,JA.current=Array(RA.length).fill(0),XA.current=0;let DQ=0;RA.forEach((SQ)=>{DQ+=LA[SQ]||0});let lQ=P();if(DQ!==lQ)L(DQ)}return PD.useImperativeHandle(H,()=>({getContentHeight:P,getViewportHeight:()=>O().height,getBottomOffset:()=>Math.max(0,P()-O().height),getItemHeight:(RA)=>{let LA=BA.current[RA]||RA;return o.current[LA]||0},remeasure:OA,remeasureItem:(RA)=>_((LA)=>({...LA,[RA]:(LA[RA]||0)+1})),getItemPosition:(RA)=>{if(RA<0||RA>=BA.current.length)return null;if(RA>=XA.current){let SQ=0,iA=0;if(XA.current>0){iA=XA.current;let vA=iA-1,zA=BA.current[vA]||vA,kA=o.current[zA]||0;SQ=(JA.current[vA]??0)+kA}for(let vA=iA;vA<=RA;vA++){JA.current[vA]=SQ;let zA=BA.current[vA]||vA,kA=o.current[zA]||0;SQ+=kA}XA.current=RA+1}let LA=JA.current[RA]??0,DQ=BA.current[RA]||RA,lQ=o.current[DQ]||0;return{top:LA,height:lQ}}}),[]),K$.jsx(VI,{...G,children:K$.jsx(VI,{ref:x,width:"100%",children:K$.jsx(VI,{overflow:D?void 0:"hidden",width:"100%",children:K$.jsx(VI,{ref:l,width:"100%",flexDirection:"column",marginTop:-A,children:PD.Children.map(C,(RA,LA)=>{if(!RA)return null;return K$.jsx(jDQ,{index:LA,width:Z.width,onMeasure:UA,measureKey:k[LA],children:RA},PD.isValidElement(RA)?RA.key||LA:LA)})})})})})});function gDQ(A){let[Q,B]=u8.useState(A),I=u8.useRef(A),D=u8.useCallback((G)=>{let H=typeof G==="function"?G(I.current):G;I.current=H,B(H)},[]),C=u8.useCallback(()=>I.current,[]);return[Q,D,C]}var mNA=u8.forwardRef(({onScroll:A,onViewportSizeChange:Q,onContentHeightChange:B,onItemHeightChange:I,debug:D=!1,children:C,...G},H)=>{let[Z,U,O]=gDQ(0),w=u8.useRef(null),L=u8.useRef(0),P=u8.useCallback((_,x)=>{if(L.current=_,B?.(_,x),O()>_)U(_),A?.(_)},[B,A,O,U]),k=u8.useCallback(()=>Math.max(0,L.current-(w.current?.getViewportHeight()||0)),[]);return u8.useImperativeHandle(H,()=>({scrollTo:(_)=>{if(typeof _!=="number"||isNaN(_))return;let x=L.current,l=Math.max(0,Math.min(_,x));if(l!==O())U(l),A?.(l)},scrollBy:(_)=>{if(typeof _!=="number"||isNaN(_))return;let x=L.current,l=Math.max(0,Math.min(O()+_,x));if(l!==O())U(l),A?.(l)},scrollToTop:()=>{if(O()!==0)U(0),A?.(0)},scrollToBottom:()=>{let _=k();if(O()!==_)U(_),A?.(_)},getScrollOffset:O,getContentHeight:()=>L.current,getViewportHeight:()=>w.current?.getViewportHeight()||0,getBottomOffset:k,getItemHeight:(_)=>w.current?.getItemHeight(_)||0,getItemPosition:(_)=>w.current?.getItemPosition(_)||null,remeasure:()=>w.current?.remeasure(),remeasureItem:(_)=>w.current?.remeasureItem(_)}),[A,k,O,U]),hNA.jsx(yDQ,{ref:w,scrollOffset:Z,onViewportSizeChange:Q,onContentHeightChange:P,onItemHeightChange:I,debug:D,children:C,...G})});var U$=kQ(pI(),1);var cl=kQ(hD(),1),vDQ=24,fNA=5;function uNA({borderColor:A,items:Q,minRows:B,renderItem:I,title:D,viewportHeight:C}){let G=U$.useRef(null),{stdout:H}=io(),[Z,U]=U$.useState(0),[O,w]=U$.useState(()=>mIA(H)),L=C??bDQ(O,B),P=Z>L;return U$.useEffect(()=>{let k=mIA(H);w(k);let _=()=>{w(mIA(H)),G.current?.remeasure()};return H?.on("resize",_),()=>{H?.off("resize",_)}},[H]),QK((k,_)=>{if(!G.current)return;if(_.upArrow){ul(G,-1);return}if(_.downArrow){ul(G,1);return}if(_.pageUp){ul(G,-G.current.getViewportHeight());return}if(_.pageDown){ul(G,G.current.getViewportHeight());return}if(_.home){__(G,0);return}if(_.end)__(G,G.current.getBottomOffset())},{isActive:P}),cl.jsxDEV(f8,{title:D,borderColor:A,children:[P?cl.jsxDEV(UB,{color:"gray",children:"Scroll: ↑ ↓ PgUp PgDn Home End"},void 0,!1,void 0,this):null,cl.jsxDEV(mNA,{ref:G,flexDirection:"column",height:L,onContentHeightChange:(k)=>{U(k),__(G,G.current?.getScrollOffset()??0)},onViewportSizeChange:()=>{__(G,G.current?.getScrollOffset()??0)},children:Q.map((k,_)=>I(k,_))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function bDQ(A,Q){return Math.max(fNA,Math.min(A,Math.max(Q,fNA)))}function mIA(A){return A?.rows??process.stdout.rows??vDQ}function ul(A,Q){let B=A.current;if(!B)return;__(A,B.getScrollOffset()+Q)}function __(A,Q){let B=A.current;if(!B)return;let I=xDQ(Q,0,B.getBottomOffset());B.scrollTo(I)}function xDQ(A,Q,B){return Math.min(Math.max(A,Q),B)}var c8=kQ(hD(),1);function cNA(A){let Q=A.progress,B=A.workerSlots.filter((D)=>D.visible),I=Q?.playlistDir??A.outputDir;return c8.jsxDEV(VI,{flexDirection:"column",children:[c8.jsxDEV(f8,{title:"Playlist",titleColor:"magenta",borderColor:"magenta",children:[c8.jsxDEV(VI,{children:[c8.jsxDEV(UB,{color:"greenBright",children:A.playlist.title},void 0,!1,void 0,this),!!A.playlist.owner&&c8.jsxDEV(UB,{color:"gray",children:[" ⦁ ",A.playlist.owner]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),c8.jsxDEV(VI,{marginTop:1,gap:1,children:[c8.jsxDEV(fG,{label:"Done",tone:"green",value:String(Q?.downloaded??0)},void 0,!1,void 0,this),c8.jsxDEV(fG,{label:"Skipped",tone:"yellow",value:String(Q?.skipped??0)},void 0,!1,void 0,this),c8.jsxDEV(fG,{label:"Failed",tone:"red",value:String(Q?.failed??0)},void 0,!1,void 0,this),c8.jsxDEV(fG,{label:"Tracks",tone:"cyan",value:`${Q?.total??A.playlist.tracks.length}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),c8.jsxDEV(VI,{marginTop:1,children:c8.jsxDEV(UB,{color:"gray",italic:!0,underline:!0,children:I},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),c8.jsxDEV(uNA,{title:"Tracks",borderColor:"magenta",minRows:20,items:B,renderItem:(D)=>c8.jsxDEV(hl,{slot:D},D.trackId,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function fIA(A,Q){if(A.length<=Q)return A;return`${A.slice(0,Math.max(Q-3,1))}...`}function ll(A,Q){return A.tracks.map((B,I)=>({downloadPercent:void 0,fileName:void 0,fileSizeLabel:void 0,isActive:!1,message:"Queued",stage:"queued",trackId:B.id,trackIndex:I+1,title:fIA(B.title,xl),visible:!0}))}function lNA(A,Q,B){let I=A.length===Q.tracks.length?[...A]:ll(Q,B.workerCount??0),D=B.track,C=D?.id;if(!C)return I;let G=I.findIndex((Z)=>Z.trackId===C);if(G<0)return I;let H=I[G];return I[G]={...H,downloadPercent:B.downloadPercent,fileName:B.fileName,fileSizeLabel:B.fileSizeLabel,isActive:B.stage!=="completed"&&B.stage!=="failed"&&B.stage!=="skipped",message:B.message,stage:B.stage,trackId:C,trackIndex:B.trackIndex??I[G].trackIndex,title:fIA(D.title,xl),visible:!0},I}function dNA(A){let{initialUrl:Q,manifest:B}=A;return{url:Q??"",phase:Q?{canRetryInput:!1,isResync:!1,kind:"loading-playlist",url:Q,message:"Bootstrapping playlist sync"}:B?{kind:"confirming-resync",manifest:B}:{kind:"collecting-input"}}}function pNA(A,Q){switch(Q.type){case"set-url":return{...A,url:Q.value,phase:A.phase.kind==="collecting-input"?{kind:"collecting-input"}:A.phase};case"submit-url":{let B=Q.value.trim(),I=_IA(B);if(I)return{...A,url:"",phase:{kind:"collecting-input",errorMessage:I}};return{...A,url:B,phase:{canRetryInput:!0,isResync:!1,kind:"loading-playlist",url:B,message:"Starting playlist lookup"}}}case"input-error":return{...A,url:"",phase:{kind:"collecting-input",errorMessage:Q.message}};case"resync-answer":return Q.value&&A.phase.kind==="confirming-resync"?{...A,url:A.phase.manifest.playlistUrl,phase:{canRetryInput:!1,isResync:!0,kind:"loading-playlist",url:A.phase.manifest.playlistUrl,message:"Starting playlist resync"}}:A;case"loading-message":return{...A,phase:{canRetryInput:Q.canRetryInput,isResync:Q.isResync,kind:"loading-playlist",url:Q.url,message:Q.message}};case"syncing-start":return{...A,phase:{isResync:Q.isResync,kind:"syncing",url:Q.url,playlist:Q.playlist,workerSlots:ll(Q.playlist,Q.downloadParallelism)}};case"sync-progress":return{...A,phase:A.phase.kind==="syncing"?{...A.phase,progress:Q.progress,workerSlots:lNA(A.phase.workerSlots,A.phase.playlist,Q.progress)}:A.phase};case"done":return{...A,phase:A.phase.kind==="syncing"?{kind:"done",isResync:Q.isResync,playlist:Q.playlist,progress:A.phase.progress,summary:Q.summary,workerSlots:A.phase.workerSlots}:{kind:"done",isResync:Q.isResync,playlist:Q.playlist,progress:void 0,summary:Q.summary,workerSlots:ll(Q.playlist,0)}};case"error":return{...A,phase:{kind:"error",message:Q.message}};default:return A}}var B7=kQ(hD(),1);function oNA({audioFormat:A,audioQuality:Q,downloadParallelism:B,outputDir:I,initialUrl:D,manifest:C}){let{exit:G}=no(),H=I7.useRef(null),Z=I7.useRef(null),[U,O]=I7.useReducer(pNA,dNA({initialUrl:D,manifest:C})),w=U.phase.kind==="loading-playlist"?U.phase.url:null,L=U.phase.kind==="syncing"?`${U.phase.playlist.id}:${U.phase.url}`:null;return H.current=U.phase.kind==="loading-playlist"?U.phase:null,Z.current=U.phase.kind==="syncing"?U.phase:null,I7.useEffect(()=>{if(!w)return;let P=H.current;if(!P)return;let{url:k}=P,_=!0;return(async()=>{try{O({canRetryInput:P.canRetryInput,url:k,type:"loading-message",isResync:P.isResync,message:"Validating provider support"});let x;try{x=await ewA(k)}catch(GA){if(!_)return;let o=GA instanceof Error?GA.message:"Unknown error";if(P.canRetryInput){O({type:"input-error",message:o});return}O({type:"error",message:o});return}if(!_)return;O({canRetryInput:P.canRetryInput,url:k,type:"loading-message",isResync:P.isResync,message:`Fetching ${mG(x.provider)} collection metadata`});let l=await SIA[x.provider].fetch(x.normalizedUrl,{});if(!_)return;O({url:k,type:"syncing-start",isResync:P.isResync,downloadParallelism:B,playlist:l})}catch(x){if(!_)return;let l=x instanceof Error?x.message:"Unknown error";O({type:"error",message:l})}})(),()=>{_=!1}},[B,w]),I7.useEffect(()=>{if(!L)return;let P=Z.current;if(!P)return;let{playlist:k}=P,_=new AbortController,x=!0;return(async()=>{try{let l=await WNA({audioFormat:A,audioQuality:Q,downloadParallelism:B,playlist:k,outputRootDir:I,signal:_.signal,onProgress:(GA)=>{if(!x)return;O({type:"sync-progress",progress:GA})}});if(!x)return;O({type:"done",isResync:P.isResync,playlist:k,summary:l})}catch(l){if(!x||_.signal.aborted)return;let GA=l instanceof Error?l.message:"Unknown error";O({type:"error",message:GA})}})(),()=>{x=!1,_.abort()}},[A,Q,B,I,L]),I7.useEffect(()=>{if(U.phase.kind!=="done"&&U.phase.kind!=="error")return;let P=setTimeout(()=>{G()},1800);return()=>clearTimeout(P)},[G,U.phase]),B7.jsxDEV(VI,{flexDirection:"column",paddingX:1,children:[B7.jsxDEV(ONA,{},void 0,!1,void 0,this),U.phase.kind==="collecting-input"?B7.jsxDEV(gNA,{errorMessage:U.phase.errorMessage,outputDir:I,url:U.url,onChange:(P)=>{O({type:"set-url",value:P})},onSubmit:(P)=>{O({type:"submit-url",value:P})}},void 0,!1,void 0,this):null,U.phase.kind==="confirming-resync"?B7.jsxDEV(bNA,{title:`Resync playlist ${U.phase.manifest.playlistTitle}?`,description:"We've detected an existing playlist manifest in this directory. Press Enter to resync now, or N to continue with the new playlist.",onSubmit:(P)=>{O({type:"resync-answer",value:P})}},void 0,!1,void 0,this):null,U.phase.kind==="loading-playlist"?B7.jsxDEV(vNA,{title:"Resolving",message:U.phase.message,url:U.phase.url,titleColor:"magenta",borderColor:"magenta"},void 0,!1,void 0,this):null,U.phase.kind==="syncing"?B7.jsxDEV(cNA,{outputDir:I,playlist:U.phase.playlist,progress:U.phase.progress,workerSlots:U.phase.workerSlots},void 0,!1,void 0,this):null,U.phase.kind==="done"?B7.jsxDEV(kNA,{isResync:U.phase.isResync,playlist:U.phase.playlist,progress:U.phase.progress,summary:U.phase.summary,workerSlots:U.phase.workerSlots},void 0,!1,void 0,this):null,U.phase.kind==="error"?B7.jsxDEV(jNA,{message:U.phase.message},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var rNA=kQ(hD(),1);await Vq();var xN=qqA(process.argv.slice(2)),iNA=nNA.resolve(process.env.INIT_CWD??process.env.PWD??process.cwd()),hDQ=!xN.url?await Nq(iNA):null,mDQ=nNA.resolve(xN.outputDir??iNA);lo(rNA.jsxDEV(oNA,{manifest:hDQ,initialUrl:xN.url,outputDir:mDQ,audioFormat:xN.audioFormat,audioQuality:xN.audioQuality,downloadParallelism:xN.downloadParallelism},void 0,!1,void 0,this));
|