@learncard/simple-signing-plugin 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- "use strict";var Se=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var xt=Object.getOwnPropertyNames;var wt=Object.prototype.hasOwnProperty;var c=(r,e)=>Se(r,"name",{value:e,configurable:!0});var Tt=(r,e)=>{for(var t in e)Se(r,t,{get:e[t],enumerable:!0})},kt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of xt(e))!wt.call(r,s)&&s!==t&&Se(r,s,{get:()=>e[s],enumerable:!(n=bt(e,s))||n.enumerable});return r};var St=r=>kt(Se({},"__esModule",{value:!0}),r);var Hr={};Tt(Hr,{SigningAuthorityValidator:()=>_r,getSimpleSigningPlugin:()=>Zr});module.exports=St(Hr);var b;(function(r){r.assertEqual=s=>s;function e(s){}c(e,"assertIs"),r.assertIs=e;function t(s){throw new Error}c(t,"assertNever"),r.assertNever=t,r.arrayToEnum=s=>{let a={};for(let i of s)a[i]=i;return a},r.getValidEnumValues=s=>{let a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(let o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(let i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}c(n,"joinValues"),r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(b||(b={}));var f=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),J=c(r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}},"getParsedType"),d=b.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Et=c(r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),I=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},n={_errors:[]},s=c(a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,u=0;for(;u<i.path.length;){let l=i.path[u];u===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(i))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}},"processError");return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};c(I,"ZodError");I.create=r=>new I(r);var be=c((r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,b.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(r.options)}, received '${r.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:b.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(r.minimum)}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(r.maximum)}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(r)}return{message:t}},"errorMap"),nt=be;function Rt(r){nt=r}c(Rt,"setErrorMap");function Re(){return nt}c(Re,"getErrorMap");var Oe=c(r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a},o="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)o=l(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},"makeIssue"),Ot=[];function p(r,e){let t=Oe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Re(),be].filter(n=>!!n)});r.common.issues.push(t)}c(p,"addIssueToContext");var E=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t)n.push({key:await s.key,value:await s.value});return E.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}};c(E,"ParseStatus");var y=Object.freeze({status:"aborted"}),st=c(r=>({status:"dirty",value:r}),"DIRTY"),O=c(r=>({status:"valid",value:r}),"OK"),ze=c(r=>r.status==="aborted","isAborted"),Ue=c(r=>r.status==="dirty","isDirty"),Ce=c(r=>r.status==="valid","isValid"),Ne=c(r=>typeof Promise!==void 0&&r instanceof Promise,"isAsync"),v;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(v||(v={}));var P=class{constructor(e,t,n,s){this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._path.concat(this._key)}};c(P,"ParseInputLazyPath");var et=c((r,e)=>{if(Ce(e))return{success:!0,data:e.value};{if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");let t=new I(r.common.issues);return{success:!1,error:t}}},"handleResult");function _(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:c((i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:t??o.defaultError},"customMap"),description:s}}c(_,"processCreateParams");var g=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return J(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:J(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E,ctx:{common:e.parent.common,data:e.data,parsedType:J(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ne(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:J(e)},a=this._parseSync({data:e,path:s.path,parent:s});return et(s,a)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:J(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Ne(s)?s:Promise.resolve(s));return et(n,a)}refine(e,t){let n=c(s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t,"getIssueProperties");return this._refinement((s,a)=>{let i=e(s),o=c(()=>a.addIssue({code:d.custom,...n(s)}),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new N({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return j.create(this)}nullable(){return B.create(this)}nullish(){return this.optional().nullable()}array(){return C.create(this)}promise(){return W.create(this)}or(e){return G.create([this,e])}and(e){return X.create(this,e)}transform(e){return new N({schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ae({innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new ve({typeName:m.ZodBranded,type:this,..._(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new pe({innerType:this,defaultValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ie.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c(g,"ZodType");var Ct=/^c[^\s-]{8,}$/i,Nt=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Pt=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,At=c(r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex"),D=class extends g{constructor(){super(...arguments),this._regex=(e,t,n)=>this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...v.errToObj(n)}),this.nonempty=e=>this.min(1,v.errToObj(e)),this.trim=()=>new D({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return p(a,{code:d.invalid_type,expected:f.string,received:a.parsedType}),y}let n=new E,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?p(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&p(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Pt.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Nt.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Ct.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),p(s,{validation:"url",code:d.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{validation:"regex",code:d.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),p(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),p(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?At(a).test(e.data)||(s=this._getOrReturnCtx(e,s),p(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...v.errToObj(e)})}url(e){return this._addCheck({kind:"url",...v.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...v.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...v.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...v.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...v.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...v.errToObj(t)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};c(D,"ZodString");D.create=r=>{var e;return new D({checks:[],typeName:m.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function jt(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}c(jt,"floatSafeRemainder");var L=class extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let a=this._getOrReturnCtx(e);return p(a,{code:d.invalid_type,expected:f.number,received:a.parsedType}),y}let n,s=new E;for(let a of this._def.checks)a.kind==="int"?b.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?jt(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:d.not_finite,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,v.toString(t))}gt(e,t){return this.setLimit("min",e,!1,v.toString(t))}lte(e,t){return this.setLimit("max",e,!0,v.toString(t))}lt(e,t){return this.setLimit("max",e,!1,v.toString(t))}setLimit(e,t,n,s){return new L({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:v.toString(s)}]})}_addCheck(e){return new L({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:v.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:v.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}};c(L,"ZodNumber");L.create=r=>new L({checks:[],typeName:m.ZodNumber,coerce:r?.coerce||!1,..._(r)});var Y=class extends g{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==f.bigint){let n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:f.bigint,received:n.parsedType}),y}return O(e.data)}};c(Y,"ZodBigInt");Y.create=r=>{var e;return new Y({typeName:m.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};var F=class extends g{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==f.boolean){let n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:f.boolean,received:n.parsedType}),y}return O(e.data)}};c(F,"ZodBoolean");F.create=r=>new F({typeName:m.ZodBoolean,coerce:r?.coerce||!1,..._(r)});var z=class extends g{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return p(a,{code:d.invalid_type,expected:f.date,received:a.parsedType}),y}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return p(a,{code:d.invalid_date}),y}let n=new E,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),p(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):b.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new z({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:v.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};c(z,"ZodDate");z.create=r=>new z({checks:[],coerce:r?.coerce||!1,typeName:m.ZodDate,..._(r)});var ue=class extends g{_parse(e){if(this._getType(e)!==f.symbol){let n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:f.symbol,received:n.parsedType}),y}return O(e.data)}};c(ue,"ZodSymbol");ue.create=r=>new ue({typeName:m.ZodSymbol,..._(r)});var K=class extends g{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:f.undefined,received:n.parsedType}),y}return O(e.data)}};c(K,"ZodUndefined");K.create=r=>new K({typeName:m.ZodUndefined,..._(r)});var Q=class extends g{_parse(e){if(this._getType(e)!==f.null){let n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:f.null,received:n.parsedType}),y}return O(e.data)}};c(Q,"ZodNull");Q.create=r=>new Q({typeName:m.ZodNull,..._(r)});var Z=class extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}};c(Z,"ZodAny");Z.create=r=>new Z({typeName:m.ZodAny,..._(r)});var U=class extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}};c(U,"ZodUnknown");U.create=r=>new U({typeName:m.ZodUnknown,..._(r)});var M=class extends g{_parse(e){let t=this._getOrReturnCtx(e);return p(t,{code:d.invalid_type,expected:f.never,received:t.parsedType}),y}};c(M,"ZodNever");M.create=r=>new M({typeName:m.ZodNever,..._(r)});var le=class extends g{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:f.void,received:n.parsedType}),y}return O(e.data)}};c(le,"ZodVoid");le.create=r=>new le({typeName:m.ZodVoid,..._(r)});var C=class extends g{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return p(t,{code:d.invalid_type,expected:f.array,received:t.parsedType}),y;if(s.exactLength!==null){let i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(p(t,{code:i?d.too_big:d.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(p(t,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(p(t,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all(t.data.map((i,o)=>s.type._parseAsync(new P(t,i,t.path,o)))).then(i=>E.mergeArray(n,i));let a=t.data.map((i,o)=>s.type._parseSync(new P(t,i,t.path,o)));return E.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new C({...this._def,minLength:{value:e,message:v.toString(t)}})}max(e,t){return new C({...this._def,maxLength:{value:e,message:v.toString(t)}})}length(e,t){return new C({...this._def,exactLength:{value:e,message:v.toString(t)}})}nonempty(e){return this.min(1,e)}};c(C,"ZodArray");C.create=(r,e)=>new C({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,..._(e)});var Pe;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Pe||(Pe={}));var tt=c(r=>e=>new x({...r,shape:()=>({...r.shape(),...e})}),"AugmentFactory");function ye(r){if(r instanceof x){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=j.create(ye(n))}return new x({...r._def,shape:()=>e})}else return r instanceof C?C.create(ye(r.element)):r instanceof j?j.create(ye(r.unwrap())):r instanceof B?B.create(ye(r.unwrap())):r instanceof A?A.create(r.items.map(e=>ye(e))):r}c(ye,"deepPartialify");var x=class extends g{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=tt(this._def),this.extend=tt(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){let l=this._getOrReturnCtx(e);return p(l,{code:d.invalid_type,expected:f.object,received:l.parsedType}),y}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof M&&this._def.unknownKeys==="strip"))for(let l in s.data)i.includes(l)||o.push(l);let u=[];for(let l of i){let h=a[l],w=s.data[l];u.push({key:{status:"valid",value:l},value:h._parse(new P(s,w,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof M){let l=this._def.unknownKeys;if(l==="passthrough")for(let h of o)u.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(l==="strict")o.length>0&&(p(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let h of o){let w=s.data[h];u.push({key:{status:"valid",value:h},value:l._parse(new P(s,w,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let h of u){let w=await h.key;l.push({key:w,value:await h.value,alwaysSet:h.alwaysSet})}return l}).then(l=>E.mergeObjectSync(n,l)):E.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return v.errToObj,new x({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;let u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=v.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new x({...this._def,unknownKeys:"strip"})}passthrough(){return new x({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new x({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>Pe.mergeShapes(this._def.shape(),e._def.shape()),typeName:m.ZodObject})}catchall(e){return new x({...this._def,catchall:e})}pick(e){let t={};return b.objectKeys(e).map(n=>{this.shape[n]&&(t[n]=this.shape[n])}),new x({...this._def,shape:()=>t})}omit(e){let t={};return b.objectKeys(this.shape).map(n=>{b.objectKeys(e).indexOf(n)===-1&&(t[n]=this.shape[n])}),new x({...this._def,shape:()=>t})}deepPartial(){return ye(this)}partial(e){let t={};if(e)return b.objectKeys(this.shape).map(n=>{b.objectKeys(e).indexOf(n)===-1?t[n]=this.shape[n]:t[n]=this.shape[n].optional()}),new x({...this._def,shape:()=>t});for(let n in this.shape){let s=this.shape[n];t[n]=s.optional()}return new x({...this._def,shape:()=>t})}required(e){let t={};if(e)b.objectKeys(this.shape).map(n=>{if(b.objectKeys(e).indexOf(n)===-1)t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof j;)a=a._def.innerType;t[n]=a}});else for(let n in this.shape){let a=this.shape[n];for(;a instanceof j;)a=a._def.innerType;t[n]=a}return new x({...this._def,shape:()=>t})}keyof(){return at(b.objectKeys(this.shape))}};c(x,"ZodObject");x.create=(r,e)=>new x({shape:()=>r,unknownKeys:"strip",catchall:M.create(),typeName:m.ZodObject,..._(e)});x.strictCreate=(r,e)=>new x({shape:()=>r,unknownKeys:"strict",catchall:M.create(),typeName:m.ZodObject,..._(e)});x.lazycreate=(r,e)=>new x({shape:r,unknownKeys:"strip",catchall:M.create(),typeName:m.ZodObject,..._(e)});var G=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new I(o.ctx.common.issues));return p(t,{code:d.invalid_union,unionErrors:i}),y}if(c(s,"handleResults"),t.common.async)return Promise.all(n.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a,i=[];for(let u of n){let l={...t,common:{...t.common,issues:[]},parent:null},h=u._parseSync({data:t.data,path:t.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(u=>new I(u));return p(t,{code:d.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}};c(G,"ZodUnion");G.create=(r,e)=>new G({options:r,typeName:m.ZodUnion,..._(e)});var Ee=c(r=>r instanceof te?Ee(r.schema):r instanceof N?Ee(r.innerType()):r instanceof re?[r.value]:r instanceof ne?r.options:r instanceof se?Object.keys(r.enum):r instanceof ae?Ee(r._def.innerType):r instanceof K?[void 0]:r instanceof Q?[null]:null,"getDiscriminator"),de=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return p(t,{code:d.invalid_type,expected:f.object,received:t.parsedType}),y;let n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(p(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let a of t){let i=Ee(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new de({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}};c(de,"ZodDiscriminatedUnion");function qe(r,e){let t=J(r),n=J(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&n===f.object){let s=b.objectKeys(e),a=b.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(let o of a){let u=qe(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===f.array&&n===f.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],u=qe(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===f.date&&n===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}c(qe,"mergeValues");var X=class extends g{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=c((a,i)=>{if(ze(a)||ze(i))return y;let o=qe(a.value,i.value);return o.valid?((Ue(a)||Ue(i))&&t.dirty(),{status:t.value,value:o.data}):(p(n,{code:d.invalid_intersection_types}),y)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};c(X,"ZodIntersection");X.create=(r,e,t)=>new X({left:r,right:e,typeName:m.ZodIntersection,..._(t)});var A=class extends g{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return p(n,{code:d.invalid_type,expected:f.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return p(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(p(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=n.data.map((i,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new P(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>E.mergeArray(t,i)):E.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new A({...this._def,rest:e})}};c(A,"ZodTuple");A.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new A({items:r,typeName:m.ZodTuple,rest:null,..._(e)})};var ee=class extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return p(n,{code:d.invalid_type,expected:f.object,received:n.parsedType}),y;let s=[],a=this._def.keyType,i=this._def.valueType;for(let o in n.data)s.push({key:a._parse(new P(n,o,n.path,o)),value:i._parse(new P(n,n.data[o],n.path,o))});return n.common.async?E.mergeObjectAsync(t,s):E.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof g?new ee({keyType:e,valueType:t,typeName:m.ZodRecord,..._(n)}):new ee({keyType:D.create(),valueType:e,typeName:m.ZodRecord,..._(t)})}};c(ee,"ZodRecord");var fe=class extends g{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return p(n,{code:d.invalid_type,expected:f.map,received:n.parsedType}),y;let s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],l)=>({key:s._parse(new P(n,o,n.path,[l,"key"])),value:a._parse(new P(n,u,n.path,[l,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of i){let l=await u.key,h=await u.value;if(l.status==="aborted"||h.status==="aborted")return y;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(l.value,h.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let u of i){let l=u.key,h=u.value;if(l.status==="aborted"||h.status==="aborted")return y;(l.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(l.value,h.value)}return{status:t.value,value:o}}}};c(fe,"ZodMap");fe.create=(r,e,t)=>new fe({valueType:e,keyType:r,typeName:m.ZodMap,..._(t)});var q=class extends g{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return p(n,{code:d.invalid_type,expected:f.set,received:n.parsedType}),y;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(p(n,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(p(n,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let a=this._def.valueType;function i(u){let l=new Set;for(let h of u){if(h.status==="aborted")return y;h.status==="dirty"&&t.dirty(),l.add(h.value)}return{status:t.value,value:l}}c(i,"finalizeSet");let o=[...n.data.values()].map((u,l)=>a._parse(new P(n,u,n.path,l)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new q({...this._def,minSize:{value:e,message:v.toString(t)}})}max(e,t){return new q({...this._def,maxSize:{value:e,message:v.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};c(q,"ZodSet");q.create=(r,e)=>new q({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,..._(e)});var H=class extends g{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return p(t,{code:d.invalid_type,expected:f.function,received:t.parsedType}),y;function n(o,u){return Oe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Re(),be].filter(l=>!!l),issueData:{code:d.invalid_arguments,argumentsError:u}})}c(n,"makeArgsIssue");function s(o,u){return Oe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Re(),be].filter(l=>!!l),issueData:{code:d.invalid_return_type,returnTypeError:u}})}c(s,"makeReturnsIssue");let a={errorMap:t.common.contextualErrorMap},i=t.data;return this._def.returns instanceof W?O(async(...o)=>{let u=new I([]),l=await this._def.args.parseAsync(o,a).catch(T=>{throw u.addIssue(n(o,T)),u}),h=await i(...l);return await this._def.returns._def.type.parseAsync(h,a).catch(T=>{throw u.addIssue(s(h,T)),u})}):O((...o)=>{let u=this._def.args.safeParse(o,a);if(!u.success)throw new I([n(o,u.error)]);let l=i(...u.data),h=this._def.returns.safeParse(l,a);if(!h.success)throw new I([s(l,h.error)]);return h.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new H({...this._def,args:A.create(e).rest(U.create())})}returns(e){return new H({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new H({args:e||A.create([]).rest(U.create()),returns:t||U.create(),typeName:m.ZodFunction,..._(n)})}};c(H,"ZodFunction");var te=class extends g{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};c(te,"ZodLazy");te.create=(r,e)=>new te({getter:r,typeName:m.ZodLazy,..._(e)});var re=class extends g{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return p(t,{code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}};c(re,"ZodLiteral");re.create=(r,e)=>new re({value:r,typeName:m.ZodLiteral,..._(e)});function at(r,e){return new ne({values:r,typeName:m.ZodEnum,..._(e)})}c(at,"createZodEnum");var ne=class extends g{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{expected:b.joinValues(n),received:t.parsedType,code:d.invalid_type}),y}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{received:t.data,code:d.invalid_enum_value,options:n}),y}return O(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}};c(ne,"ZodEnum");ne.create=at;var se=class extends g{_parse(e){let t=b.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){let s=b.objectValues(t);return p(n,{expected:b.joinValues(s),received:n.parsedType,code:d.invalid_type}),y}if(t.indexOf(e.data)===-1){let s=b.objectValues(t);return p(n,{received:n.data,code:d.invalid_enum_value,options:s}),y}return O(e.data)}get enum(){return this._def.values}};c(se,"ZodNativeEnum");se.create=(r,e)=>new se({values:r,typeName:m.ZodNativeEnum,..._(e)});var W=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return p(t,{code:d.invalid_type,expected:f.promise,received:t.parsedType}),y;let n=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return O(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};c(W,"ZodPromise");W.create=(r,e)=>new W({type:r,typeName:m.ZodPromise,..._(e)});var N=class extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null;if(s.type==="preprocess"){let i=s.transform(n.data);return n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}let a={addIssue:i=>{p(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="refinement"){let i=c(o=>{let u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o},"executeRefinement");if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ce(i))return i;let o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Ce(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);b.assertNever(s)}};c(N,"ZodEffects");N.create=(r,e,t)=>new N({schema:r,typeName:m.ZodEffects,effect:e,..._(t)});N.createWithPreprocess=(r,e,t)=>new N({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,..._(t)});var j=class extends g{_parse(e){return this._getType(e)===f.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c(j,"ZodOptional");j.create=(r,e)=>new j({innerType:r,typeName:m.ZodOptional,..._(e)});var B=class extends g{_parse(e){return this._getType(e)===f.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c(B,"ZodNullable");B.create=(r,e)=>new B({innerType:r,typeName:m.ZodNullable,..._(e)});var ae=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};c(ae,"ZodDefault");ae.create=(r,e)=>new ae({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var pe=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return Ne(n)?n.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.defaultValue()})):{status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};c(pe,"ZodCatch");pe.create=(r,e)=>new pe({innerType:r,typeName:m.ZodCatch,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var he=class extends g{_parse(e){if(this._getType(e)!==f.nan){let n=this._getOrReturnCtx(e);return p(n,{code:d.invalid_type,expected:f.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}};c(he,"ZodNaN");he.create=r=>new he({typeName:m.ZodNaN,..._(r)});var It=Symbol("zod_brand"),ve=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};c(ve,"ZodBranded");var ie=class extends g{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return c(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),st(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})},"handleAsync")();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new ie({in:e,out:t,typeName:m.ZodPipeline})}};c(ie,"ZodPipeline");var it=c((r,e={},t)=>r?Z.create().superRefine((n,s)=>{if(!r(n)){let a=typeof e=="function"?e(n):e,i=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...i,fatal:t})}}):Z.create(),"custom"),Dt={object:x.lazycreate},m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline"})(m||(m={}));var Mt=c((r,e={message:`Input not instance of ${r.name}`})=>it(t=>t instanceof r,e,!0),"instanceOfType"),ot=D.create,ct=L.create,Lt=he.create,$t=Y.create,ut=F.create,Vt=z.create,zt=ue.create,Ut=K.create,qt=Q.create,Bt=Z.create,Zt=U.create,Ht=M.create,Wt=le.create,Jt=C.create,Yt=x.create,Ft=x.strictCreate,Kt=G.create,Qt=de.create,Gt=X.create,Xt=A.create,er=ee.create,tr=fe.create,rr=q.create,nr=H.create,sr=te.create,ar=re.create,ir=ne.create,or=se.create,cr=W.create,rt=N.create,ur=j.create,lr=B.create,dr=N.createWithPreprocess,fr=ie.create,pr=c(()=>ot().optional(),"ostring"),hr=c(()=>ct().optional(),"onumber"),mr=c(()=>ut().optional(),"oboolean"),yr={string:r=>D.create({...r,coerce:!0}),number:r=>L.create({...r,coerce:!0}),boolean:r=>F.create({...r,coerce:!0}),bigint:r=>Y.create({...r,coerce:!0}),date:r=>z.create({...r,coerce:!0})},gr=y,me=Object.freeze({__proto__:null,defaultErrorMap:be,setErrorMap:Rt,getErrorMap:Re,makeIssue:Oe,EMPTY_PATH:Ot,addIssueToContext:p,ParseStatus:E,INVALID:y,DIRTY:st,OK:O,isAborted:ze,isDirty:Ue,isValid:Ce,isAsync:Ne,get util(){return b},ZodParsedType:f,getParsedType:J,ZodType:g,ZodString:D,ZodNumber:L,ZodBigInt:Y,ZodBoolean:F,ZodDate:z,ZodSymbol:ue,ZodUndefined:K,ZodNull:Q,ZodAny:Z,ZodUnknown:U,ZodNever:M,ZodVoid:le,ZodArray:C,get objectUtil(){return Pe},ZodObject:x,ZodUnion:G,ZodDiscriminatedUnion:de,ZodIntersection:X,ZodTuple:A,ZodRecord:ee,ZodMap:fe,ZodSet:q,ZodFunction:H,ZodLazy:te,ZodLiteral:re,ZodEnum:ne,ZodNativeEnum:se,ZodPromise:W,ZodEffects:N,ZodTransformer:N,ZodOptional:j,ZodNullable:B,ZodDefault:ae,ZodCatch:pe,ZodNaN:he,BRAND:It,ZodBranded:ve,ZodPipeline:ie,custom:it,Schema:g,ZodSchema:g,late:Dt,get ZodFirstPartyTypeKind(){return m},coerce:yr,any:Bt,array:Jt,bigint:$t,boolean:ut,date:Vt,discriminatedUnion:Qt,effect:rt,enum:ir,function:nr,instanceof:Mt,intersection:Gt,lazy:sr,literal:ar,map:tr,nan:Lt,nativeEnum:or,never:Ht,null:qt,nullable:lr,number:ct,object:Yt,oboolean:mr,onumber:hr,optional:ur,ostring:pr,pipeline:fr,preprocess:dr,promise:cr,record:er,set:rr,strictObject:Ft,string:ot,symbol:zt,transformer:rt,tuple:Xt,undefined:Ut,union:Kt,unknown:Zt,void:Wt,NEVER:gr,ZodIssueCode:d,quotelessJson:Et,ZodError:I});var _r=me.object({_id:me.string().optional(),ownerDid:me.string(),name:me.string(),did:me.string().optional(),endpoint:me.string().optional()});function vr(r){return r}c(vr,"identity");function br(r){return r.length===0?vr:r.length===1?r[0]:c(function(t){return r.reduce((n,s)=>s(n),t)},"piped")}c(br,"pipeFromArray");function $(r){let e={subscribe(t){let n=null,s=!1,a=!1,i=!1;function o(){if(n===null){i=!0;return}a||(a=!0,typeof n=="function"?n():n&&n.unsubscribe())}return c(o,"unsubscribe"),n=r({next(u){s||t.next?.(u)},error(u){s||(s=!0,t.error?.(u),o())},complete(){s||(s=!0,t.complete?.(),o())}}),i&&o(),{unsubscribe:o}},pipe(...t){return br(t)(e)}};return e}c($,"observable");function lt(r){return e=>{let t=0,n=null,s=[];function a(){n||(n=e.subscribe({next(o){for(let u of s)u.next?.(o)},error(o){for(let u of s)u.error?.(o)},complete(){for(let o of s)o.complete?.()}}))}c(a,"startIfNeeded");function i(){if(t===0&&n){let o=n;n=null,o.unsubscribe()}}return c(i,"resetIfNeeded"),{subscribe(o){return t++,s.push(o),a(),{unsubscribe(){t--,i();let u=s.findIndex(l=>l===o);u>-1&&s.splice(u,1)}}}}}}c(lt,"share");var ge=class extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,ge.prototype)}};c(ge,"ObservableAbortError");function dt(r){let e;return{promise:new Promise((n,s)=>{let a=!1;function i(){a||(a=!0,s(new ge("This operation was aborted.")),o.unsubscribe())}c(i,"onDone");let o=r.subscribe({next(u){a=!0,n(u),i()},error(u){a=!0,s(u),i()},complete(){a=!0,i()}});e=i}),abort:e}}c(dt,"observableToPromise");function ft(r){return $(e=>{function t(s=0,a=r.op){let i=r.links[s];if(!i)throw new Error("No more links to execute - did you forget to add an ending link?");return i({op:a,next(u){return t(s+1,u)}})}return c(t,"execute"),t().subscribe(e)})}c(ft,"createChain");function Be(r){let e=Object.create(null);for(let t in r){let n=r[t];e[n]=t}return e}c(Be,"invert");var Ae={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099},rn=Be(Ae);var an=Be(Ae);var pt=c(()=>{},"noop");function ht(r,e){return new Proxy(pt,{get(n,s){if(!(typeof s!="string"||s==="then"))return ht(r,[...e,s])},apply(n,s,a){let i=e[e.length-1]==="apply";return r({args:i?a.length>=2?a[1]:[]:a,path:i?e.slice(0,-1):e})}})}c(ht,"createInnerProxy");var Ze=c(r=>ht(r,[]),"createRecursiveProxy"),He=c(r=>new Proxy(pt,{get(e,t){if(!(typeof t!="string"||t==="then"))return r(t)}}),"createFlatProxy");function xr(r){return!!r&&!Array.isArray(r)&&typeof r=="object"}c(xr,"isObject");var je=class extends Error{};c(je,"UnknownCauseError");function We(r){if(r instanceof Error)return r;let e=typeof r;if(!(e==="undefined"||e==="function"||r===null)){if(e!=="object")return new Error(String(r));if(xr(r)){let t=new je;for(let n in r)t[n]=r[n];return t}}}c(We,"getCauseFromUnknown");function xe(r){return!!r&&!Array.isArray(r)&&typeof r=="object"}c(xe,"isObject");function wr(r,e){if("error"in r){let n=e.transformer.deserialize(r.error);return{ok:!1,error:{...r,error:n}}}let t={...r.result,...(!r.result.type||r.result.type==="data")&&{type:"data",data:e.transformer.deserialize(r.result.data)}};return{ok:!0,result:t}}c(wr,"transformResultInner");var _e=class extends Error{constructor(){super("Unable to transform response from server")}};c(_e,"TransformResultError");function we(r,e){let t;try{t=wr(r,e)}catch{throw new _e}if(!t.ok&&(!xe(t.error.error)||typeof t.error.error.code!="number"))throw new _e;if(t.ok&&!xe(t.result))throw new _e;return t}c(we,"transformResult");function Tr(r){return r instanceof k||r instanceof Error&&r.name==="TRPCClientError"}c(Tr,"isTRPCClientError");function kr(r){return xe(r)&&xe(r.error)&&typeof r.error.code=="number"&&typeof r.error.message=="string"}c(kr,"isTRPCErrorResponse");var k=class extends Error{static from(e,t={}){let n=e;return Tr(n)?(t.meta&&(n.meta={...n.meta,...t.meta}),n):kr(n)?new k(n.error.message,{...t,result:n}):n instanceof Error?new k(n.message,{...t,cause:We(n)}):new k("Unknown error",{...t,cause:n})}constructor(e,t){let n=t?.cause;super(e,{cause:n}),this.meta=t?.meta,this.cause=n,this.shape=t?.result?.error,this.data=t?.result?.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,k.prototype)}};c(k,"TRPCClientError");var mt=c(r=>typeof r=="function","isFunction");function yt(r){if(r)return r;if(typeof window<"u"&&mt(window.fetch))return window.fetch;if(typeof globalThis<"u"&&mt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}c(yt,"getFetch");function Sr(r){return r||(typeof window<"u"&&window.AbortController?window.AbortController:typeof globalThis<"u"&&globalThis.AbortController?globalThis.AbortController:null)}c(Sr,"getAbortController");function Ie(r){return{url:r.url.toString().replace(/\/$/,""),fetch:r.fetch,AbortController:Sr(r.AbortController)}}c(Ie,"resolveHTTPLinkOptions");function Er(r){let e={};for(let t=0;t<r.length;t++){let n=r[t];e[t]=n}return e}c(Er,"arrayToDict");var Rr={query:"GET",mutation:"POST"};function gt(r){return"input"in r?r.runtime.transformer.serialize(r.input):Er(r.inputs.map(e=>r.runtime.transformer.serialize(e)))}c(gt,"getInput");var Te=c(r=>{let e=r.url+"/"+r.path,t=[];if("inputs"in r&&t.push("batch=1"),r.type==="query"){let n=gt(r);n!==void 0&&t.push(`input=${encodeURIComponent(JSON.stringify(n))}`)}return t.length&&(e+="?"+t.join("&")),e},"getUrl"),Je=c(r=>{if(r.type==="query")return;let e=gt(r);return e!==void 0?JSON.stringify(e):void 0},"getBody"),De=c(r=>Fe({...r,contentTypeHeader:"application/json",getUrl:Te,getBody:Je}),"jsonHttpRequester");async function Ye(r,e){let t=r.getUrl(r),n=r.getBody(r),{type:s}=r,a=await r.headers();if(s==="subscription")throw new Error("Subscriptions should use wsLink");let i={...r.contentTypeHeader?{"content-type":r.contentTypeHeader}:{},...r.batchModeHeader?{"trpc-batch-mode":r.batchModeHeader}:{},...a};return yt(r.fetch)(t,{method:Rr[s],signal:e?.signal,body:n,headers:i})}c(Ye,"fetchHTTPResponse");function Fe(r){let e=r.AbortController?new r.AbortController:null,t={},n=!1;return{promise:new Promise((i,o)=>{Ye(r,e).then(u=>(t.response=u,n=!0,u.json())).then(u=>{t.responseJSON=u,i({json:u,meta:t})}).catch(u=>{n=!0,o(k.from(u,{meta:t}))})}),cancel:c(()=>{n||e?.abort()},"cancel")}}c(Fe,"httpRequest");var Ke=c(()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")},"throwFatalError");function Qe(r){let e=null,t=null,n=c(()=>{clearTimeout(t),t=null,e=null},"destroyTimerAndPendingItems");function s(o){let u=[[]],l=0;for(;;){let h=o[l];if(!h)break;let w=u[u.length-1];if(h.aborted){h.reject?.(new Error("Aborted")),l++;continue}if(r.validate(w.concat(h).map(S=>S.key))){w.push(h),l++;continue}if(w.length===0){h.reject?.(new Error("Input is too big for a single dispatch")),l++;continue}u.push([])}return u}c(s,"groupItems");function a(){let o=s(e);n();for(let u of o){if(!u.length)continue;let l={items:u,cancel:Ke};for(let S of u)S.batch=l;let h=c((S,R)=>{let V=l.items[S];V.resolve?.(R),V.batch=null,V.reject=null,V.resolve=null},"unitResolver"),{promise:w,cancel:T}=r.fetch(l.items.map(S=>S.key),h);l.cancel=T,w.then(S=>{for(let R=0;R<S.length;R++){let V=S[R];h(R,V)}for(let R of l.items)R.reject?.(new Error("Missing result")),R.batch=null}).catch(S=>{for(let R of l.items)R.reject?.(S),R.batch=null})}}c(a,"dispatch");function i(o){let u={aborted:!1,key:o,batch:null,resolve:Ke,reject:Ke},l=new Promise((w,T)=>{u.reject=T,u.resolve=w,e||(e=[]),e.push(u)});return t||(t=setTimeout(a)),{promise:l,cancel:c(()=>{u.aborted=!0,u.batch?.items.every(w=>w.aborted)&&(u.batch.cancel(),u.batch=null)},"cancel")}}return c(i,"load"),{load:i}}c(Qe,"dataLoader");function Ge(r){return c(function(t){let n=Ie(t),s=t.maxURLLength??1/0;return a=>{let i=c(w=>{let T=c(R=>{if(s===1/0)return!0;let V=R.map(ce=>ce.path).join(","),ke=R.map(ce=>ce.input);return Te({...n,runtime:a,type:w,path:V,inputs:ke}).length<=s},"validate"),S=r({...n,runtime:a,type:w,opts:t});return{validate:T,fetch:S}},"batchLoader"),o=Qe(i("query")),u=Qe(i("mutation")),l=Qe(i("subscription")),h={query:o,subscription:l,mutation:u};return({op:w})=>$(T=>{let S=h[w.type],{promise:R,cancel:V}=S.load(w),ke;return R.then(oe=>{ke=oe;let ce=we(oe.json,a);if(!ce.ok){T.error(k.from(ce.error,{meta:oe.meta}));return}T.next({context:oe.meta,result:ce.result}),T.complete()}).catch(oe=>{T.error(k.from(oe,{meta:ke?.meta}))}),()=>{V()}})}},"httpBatchLink")}c(Ge,"createHTTPBatchLink");var Or=c(r=>e=>{let t=e.map(i=>i.path).join(","),n=e.map(i=>i.input),{promise:s,cancel:a}=De({...r,path:t,inputs:n,headers(){return r.opts.headers?typeof r.opts.headers=="function"?r.opts.headers({opList:e}):r.opts.headers:{}}});return{promise:s.then(i=>(Array.isArray(i.json)?i.json:e.map(()=>i.json)).map(l=>({meta:i.meta,json:l}))),cancel:a}},"batchRequester"),Me=Ge(Or);function Le(r){return e=>{let t=Ie(e);return n=>({op:s})=>$(a=>{let{path:i,input:o,type:u}=s,{promise:l,cancel:h}=r.requester({...t,runtime:n,type:u,path:i,input:o,headers(){return e.headers?typeof e.headers=="function"?e.headers({op:s}):e.headers:{}}}),w;return l.then(T=>{w=T.meta;let S=we(T.json,n);if(!S.ok){a.error(k.from(S.error,{meta:w}));return}a.next({context:T.meta,result:S.result}),a.complete()}).catch(T=>{a.error(k.from(T,{meta:w}))}),()=>{h()}})}}c(Le,"httpLinkFactory");var Cr=Le({requester:De});var $e=class{$request({type:e,input:t,path:n,context:s={}}){return ft({links:this.links,op:{id:++this.requestId,type:e,path:n,input:t,context:s}}).pipe(lt())}requestAsPromise(e){let t=this.$request(e),{promise:n,abort:s}=dt(t);return new Promise((i,o)=>{e.signal?.addEventListener("abort",s),n.then(u=>{i(u.result.data)}).catch(u=>{o(k.from(u))})})}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n?.context}).subscribe({next(a){a.result.type==="started"?n.onStarted?.():a.result.type==="stopped"?n.onStopped?.():n.onData?.(a.result.data)},error(a){n.onError?.(a)},complete(){n.onComplete?.()}})}constructor(e){this.requestId=0;let t=(()=>{let n=e.transformer;return n?"input"in n?e.transformer:{input:n,output:n}:{input:{serialize:s=>s,deserialize:s=>s},output:{serialize:s=>s,deserialize:s=>s}}})();this.runtime={transformer:{serialize:n=>t.input.serialize(n),deserialize:n=>t.output.deserialize(n)},combinedTransformer:t},this.links=e.links.map(n=>n(this.runtime))}};c($e,"TRPCUntypedClient");var Nr={query:"query",mutate:"mutation",subscribe:"subscription"},Pr=c(r=>Nr[r],"clientCallTypeToProcedureType");function Ar(r){return He(e=>r.hasOwnProperty(e)?r[e]:e==="__untypedClient"?r:Ze(({path:t,args:n})=>{let s=[e,...t],a=Pr(s.pop()),i=s.join(".");return r[a](i,...n)}))}c(Ar,"createTRPCClientProxy");function Xe(r){let e=new $e(r);return Ar(e)}c(Xe,"createTRPCProxyClient");function jr(r){if(r)return r;if(typeof window<"u"&&window.TextDecoder)return new window.TextDecoder;if(typeof globalThis<"u"&&globalThis.TextDecoder)return new globalThis.TextDecoder;throw new Error("No TextDecoder implementation found")}c(jr,"getTextDecoder");async function Ir(r){let e=r.parse??JSON.parse,t=c(n=>{if(r.signal?.aborted||!n||n==="}")return;let s=n.indexOf(":"),a=n.substring(2,s-1),i=n.substring(s+1);r.onSingle(Number(a),e(i))},"onLine");await Dr(r.readableStream,t,r.textDecoder)}c(Ir,"parseJSONStream");async function Dr(r,e,t){let n="",s=c(a=>{let o=t.decode(a).split(`
2
- `);if(o.length===1)n+=o[0];else if(o.length>1){e(n+o[0]);for(let u=1;u<o.length-1;u++)e(o[u]);n=o[o.length-1]}},"onChunk");"getReader"in r?await Lr(r,s):await Mr(r,s),e(n)}c(Dr,"readLines");function Mr(r,e){return new Promise(t=>{r.on("data",e),r.on("end",t)})}c(Mr,"readNodeChunks");async function Lr(r,e){let t=r.getReader(),n=await t.read();for(;!n.done;)e(n.value),n=await t.read()}c(Lr,"readStandardChunks");var $r=c((r,e)=>{let t=r.AbortController?new r.AbortController:null,n=Ye({...r,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:Te,getBody:Je},t),s=c(()=>t?.abort(),"cancel"),a=n.then(async i=>{if(!i.body)throw new Error("Received response without body");let o={response:i};return Ir({readableStream:i.body,onSingle:e,parse:u=>({json:JSON.parse(u),meta:o}),signal:t?.signal,textDecoder:r.textDecoder})});return{cancel:s,promise:a}},"streamingJsonHttpRequester"),Vr=c(r=>{let e=jr(r.opts.textDecoder);return(t,n)=>{let s=t.map(u=>u.path).join(","),a=t.map(u=>u.input),{cancel:i,promise:o}=$r({...r,textDecoder:e,path:s,inputs:a,headers(){return r.opts.headers?typeof r.opts.headers=="function"?r.opts.headers({opList:t}):r.opts.headers:{}}},(u,l)=>{n(u,l)});return{promise:o.then(()=>[]),cancel:i}}},"streamRequester"),ns=Ge(Vr),zr=c(r=>{if("input"in r){if(!(r.input instanceof FormData))throw new Error("Input is not FormData");return r.input}},"getBody"),Ur=c(r=>{if(r.type!=="mutation")throw new Error("We only handle mutations with formdata");return Fe({...r,getUrl(){return`${r.url}/${r.path}`},getBody:zr})},"formDataRequester"),ss=Le({requester:Ur});var qr=Object.defineProperty,Ve=c((r,e)=>qr(r,"name",{value:e,configurable:!0}),"__name"),Br=Ve(r=>()=>({next:e,op:t})=>$(n=>{let s=null,a=0,i=!1,o=Ve(()=>{a+=1,s?.unsubscribe(),s=e(t).subscribe({error:async u=>{if(a>5||u.data?.httpStatus!==401)return n.error(u);await r(),o()},next:u=>n.next(u),complete:()=>{i&&n.complete()}})},"attempt");return o(),()=>{i=!0,s?.unsubscribe()}}),"callbackLink"),_t=Ve(async(r,e)=>{let t=[],n=Xe({links:[Me({url:r,headers:{Authorization:`Bearer ${await e()}`}})]}),s=Ve(async(i=95+Math.round((Math.random()-.5)*5))=>n.utilities.getChallenges.query({amount:i}),"getChallenges");return s().then(i=>t=i),Xe({links:[Br(async()=>{t=await s()}),Me({url:r,headers:async()=>(t.length===0&&t.push(...await s()),{Authorization:`Bearer ${await e(t.pop())}`})})]})},"getClient");var vt=c(async(r,e)=>_t(r,async t=>{let n=await e.invoke.getDidAuthVp({proofFormat:"jwt",challenge:t});if(typeof n!="string")throw new Error("Error getting DID-Auth-JWT!");return n}),"getNewClient"),Zr=c(async(r,e)=>{let t=r,n=t.id.did(),s=await vt(e,t),a=c(async o=>{let u=o.id.did();n!==u&&(s=await vt(e,o),n=u),t=o},"updateLearnCard"),i=t.invoke.getProfile().then(async o=>{o&&await a(t)});return{name:"Simple Signing Authority",displayName:"Simple Signing Authority Plugin",description:"Lets you create and use Signing Authorities",methods:{createSigningAuthority:async(o,u)=>(await i,await a(o),s.signingAuthority.createSigningAuthority.mutate({name:u})),getSigningAuthorities:async o=>(await i,await a(o),s.signingAuthority.signingAuthorities.query()),authorizeSigningAuthority:async(o,u,l)=>(await i,await a(o),s.signingAuthority.authorizeSigningAuthority.mutate({name:u,authorization:l}))}}},"getSimpleSigningPlugin");
1
+ "use strict";var Pe=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var Ot=Object.getOwnPropertyNames;var Nt=Object.prototype.hasOwnProperty;var c=(r,e)=>Pe(r,"name",{value:e,configurable:!0});var At=(r,e)=>{for(var t in e)Pe(r,t,{get:e[t],enumerable:!0})},Pt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ot(e))!Nt.call(r,s)&&s!==t&&Pe(r,s,{get:()=>e[s],enumerable:!(n=Ct(e,s))||n.enumerable});return r};var jt=r=>Pt(Pe({},"__esModule",{value:!0}),r);var ln={};At(ln,{SigningAuthorityValidator:()=>Mr,getSimpleSigningPlugin:()=>un});module.exports=jt(ln);var b;(function(r){r.assertEqual=s=>s;function e(s){}c(e,"assertIs"),r.assertIs=e;function t(s){throw new Error}c(t,"assertNever"),r.assertNever=t,r.arrayToEnum=s=>{let a={};for(let i of s)a[i]=i;return a},r.getValidEnumValues=s=>{let a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(let o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(let i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}c(n,"joinValues"),r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(b||(b={}));var He;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(He||(He={}));var h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),G=c(r=>{switch(typeof r){case"undefined":return h.undefined;case"string":return h.string;case"number":return isNaN(r)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(r)?h.array:r===null?h.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?h.promise:typeof Map<"u"&&r instanceof Map?h.map:typeof Set<"u"&&r instanceof Set?h.set:typeof Date<"u"&&r instanceof Date?h.date:h.object;default:return h.unknown}},"getParsedType"),d=b.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),It=c(r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),C=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},n={_errors:[]},s=c(a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,u=0;for(;u<i.path.length;){let l=i.path[u];u===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(i))):o[l]=o[l]||{_errors:[]},o=o[l],u++}}},"processError");return s(this),n}static assert(e){if(!(e instanceof C))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};c(C,"ZodError");C.create=r=>new C(r);var xe=c((r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===h.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,b.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(r.options)}, received '${r.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:b.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case d.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(r)}return{message:t}},"errorMap"),ct=xe;function Dt(r){ct=r}c(Dt,"setErrorMap");function je(){return ct}c(je,"getErrorMap");var Ie=c(r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)o=l(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},"makeIssue"),Mt=[];function f(r,e){let t=je(),n=Ie({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===xe?void 0:xe].filter(s=>!!s)});r.common.issues.push(n)}c(f,"addIssueToContext");var E=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t){let a=await s.key,i=await s.value;n.push({key:a,value:i})}return E.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return y;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}};c(E,"ParseStatus");var y=Object.freeze({status:"aborted"}),ve=c(r=>({status:"dirty",value:r}),"DIRTY"),O=c(r=>({status:"valid",value:r}),"OK"),We=c(r=>r.status==="aborted","isAborted"),Fe=c(r=>r.status==="dirty","isDirty"),Ee=c(r=>r.status==="valid","isValid"),Re=c(r=>typeof Promise<"u"&&r instanceof Promise,"isAsync");function De(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}c(De,"__classPrivateFieldGet");function ut(r,e,t,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(r,t):s?s.value=t:e.set(r,t),t}c(ut,"__classPrivateFieldSet");var m;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));var Te,Se,j=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};c(j,"ParseInputLazyPath");var it=c((r,e)=>{if(Ee(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new C(r.common.issues);return this._error=t,this._error}}},"handleResult");function v(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:c((i,o)=>{var u,l;let{message:p}=r;return i.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:(u=p??n)!==null&&u!==void 0?u:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(l=p??t)!==null&&l!==void 0?l:o.defaultError}},"customMap"),description:s}}c(v,"processCreateParams");var _=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return G(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:G(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E,ctx:{common:e.parent.common,data:e.data,parsedType:G(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Re(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:G(e)},a=this._parseSync({data:e,path:s.path,parent:s});return it(s,a)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:G(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Re(s)?s:Promise.resolve(s));return it(n,a)}refine(e,t){let n=c(s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t,"getIssueProperties");return this._refinement((s,a)=>{let i=e(s),o=c(()=>a.addIssue({code:d.custom,...n(s)}),"setError");return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new P({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return D.create(this,this._def)}nullable(){return z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return A.create(this,this._def)}promise(){return Y.create(this,this._def)}or(e){return ee.create([this,e],this._def)}and(e){return te.create(this,e,this._def)}transform(e){return new P({...v(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ie({...v(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new be({typeName:g.ZodBranded,type:this,...v(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new oe({...v(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ce.create(this,e)}readonly(){return ue.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};c(_,"ZodType");var Lt=/^c[^\s-]{8,}$/i,$t=/^[0-9a-z]+$/,Vt=/^[0-9A-HJKMNP-TV-Z]{26}$/,zt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ut=/^[a-z0-9_-]{21}$/i,qt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Bt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ze,Ht=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Wt=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Jt=new RegExp(`^${lt}$`);function dt(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}c(dt,"timeRegexSource");function Yt(r){return new RegExp(`^${dt(r)}$`)}c(Yt,"timeRegex");function ft(r){let e=`${lt}T${dt(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}c(ft,"datetimeRegex");function Gt(r,e){return!!((e==="v4"||!e)&&Ht.test(r)||(e==="v6"||!e)&&Wt.test(r))}c(Gt,"isValidIP");var N=class extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.string,received:a.parsedType}),y}let n=new E,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Bt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ze||(Ze=new RegExp(Zt,"u")),Ze.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"emoji",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")zt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Ut.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Lt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")$t.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Vt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ulid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),f(s,{validation:"url",code:d.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"regex",code:d.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?ft(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Jt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Yt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?qt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"duration",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Gt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ip",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Ft.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64",code:d.invalid_string,message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...m.errToObj(n)})}_addCheck(e){return new N({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...m.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new N({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};c(N,"ZodString");N.create=r=>{var e;return new N({checks:[],typeName:g.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...v(r)})};function Qt(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}c(Qt,"floatSafeRemainder");var L=class extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.number){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.number,received:a.parsedType}),y}let n,s=new E;for(let a of this._def.checks)a.kind==="int"?b.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Qt(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_finite,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,s){return new L({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(s)}]})}_addCheck(e){return new L({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};c(L,"ZodNumber");L.create=r=>new L({checks:[],typeName:g.ZodNumber,coerce:r?.coerce||!1,...v(r)});var $=class extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==h.bigint){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.bigint,received:a.parsedType}),y}let n,s=new E;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,s){return new $({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(s)}]})}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};c($,"ZodBigInt");$.create=r=>{var e;return new $({checks:[],typeName:g.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...v(r)})};var Q=class extends _{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==h.boolean){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:h.boolean,received:n.parsedType}),y}return O(e.data)}};c(Q,"ZodBoolean");Q.create=r=>new Q({typeName:g.ZodBoolean,coerce:r?.coerce||!1,...v(r)});var B=class extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.date,received:a.parsedType}),y}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_date}),y}let n=new E,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):b.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};c(B,"ZodDate");B.create=r=>new B({checks:[],coerce:r?.coerce||!1,typeName:g.ZodDate,...v(r)});var fe=class extends _{_parse(e){if(this._getType(e)!==h.symbol){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:h.symbol,received:n.parsedType}),y}return O(e.data)}};c(fe,"ZodSymbol");fe.create=r=>new fe({typeName:g.ZodSymbol,...v(r)});var K=class extends _{_parse(e){if(this._getType(e)!==h.undefined){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:h.undefined,received:n.parsedType}),y}return O(e.data)}};c(K,"ZodUndefined");K.create=r=>new K({typeName:g.ZodUndefined,...v(r)});var X=class extends _{_parse(e){if(this._getType(e)!==h.null){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:h.null,received:n.parsedType}),y}return O(e.data)}};c(X,"ZodNull");X.create=r=>new X({typeName:g.ZodNull,...v(r)});var F=class extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}};c(F,"ZodAny");F.create=r=>new F({typeName:g.ZodAny,...v(r)});var Z=class extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}};c(Z,"ZodUnknown");Z.create=r=>new Z({typeName:g.ZodUnknown,...v(r)});var M=class extends _{_parse(e){let t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),y}};c(M,"ZodNever");M.create=r=>new M({typeName:g.ZodNever,...v(r)});var he=class extends _{_parse(e){if(this._getType(e)!==h.undefined){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:h.void,received:n.parsedType}),y}return O(e.data)}};c(he,"ZodVoid");he.create=r=>new he({typeName:g.ZodVoid,...v(r)});var A=class extends _{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==h.array)return f(t,{code:d.invalid_type,expected:h.array,received:t.parsedType}),y;if(s.exactLength!==null){let i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(f(t,{code:i?d.too_big:d.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(f(t,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(f(t,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new j(t,i,t.path,o)))).then(i=>E.mergeArray(n,i));let a=[...t.data].map((i,o)=>s.type._parseSync(new j(t,i,t.path,o)));return E.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new A({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new A({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new A({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}};c(A,"ZodArray");A.create=(r,e)=>new A({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...v(e)});function _e(r){if(r instanceof w){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=D.create(_e(n))}return new w({...r._def,shape:()=>e})}else return r instanceof A?new A({...r._def,type:_e(r.element)}):r instanceof D?D.create(_e(r.unwrap())):r instanceof z?z.create(_e(r.unwrap())):r instanceof I?I.create(r.items.map(e=>_e(e))):r}c(_e,"deepPartialify");var w=class extends _{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==h.object){let l=this._getOrReturnCtx(e);return f(l,{code:d.invalid_type,expected:h.object,received:l.parsedType}),y}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof M&&this._def.unknownKeys==="strip"))for(let l in s.data)i.includes(l)||o.push(l);let u=[];for(let l of i){let p=a[l],x=s.data[l];u.push({key:{status:"valid",value:l},value:p._parse(new j(s,x,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof M){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of o)u.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(l==="strict")o.length>0&&(f(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of o){let x=s.data[p];u.push({key:{status:"valid",value:p},value:l._parse(new j(s,x,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of u){let x=await p.key,S=await p.value;l.push({key:x,value:S,alwaysSet:p.alwaysSet})}return l}).then(l=>E.mergeObjectSync(n,l)):E.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new w({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;let u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=m.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new w({...this._def,unknownKeys:"strip"})}passthrough(){return new w({...this._def,unknownKeys:"passthrough"})}extend(e){return new w({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new w({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new w({...this._def,catchall:e})}pick(e){let t={};return b.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new w({...this._def,shape:()=>t})}omit(e){let t={};return b.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new w({...this._def,shape:()=>t})}deepPartial(){return _e(this)}partial(e){let t={};return b.objectKeys(this.shape).forEach(n=>{let s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new w({...this._def,shape:()=>t})}required(e){let t={};return b.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof D;)a=a._def.innerType;t[n]=a}}),new w({...this._def,shape:()=>t})}keyof(){return ht(b.objectKeys(this.shape))}};c(w,"ZodObject");w.create=(r,e)=>new w({shape:()=>r,unknownKeys:"strip",catchall:M.create(),typeName:g.ZodObject,...v(e)});w.strictCreate=(r,e)=>new w({shape:()=>r,unknownKeys:"strict",catchall:M.create(),typeName:g.ZodObject,...v(e)});w.lazycreate=(r,e)=>new w({shape:r,unknownKeys:"strip",catchall:M.create(),typeName:g.ZodObject,...v(e)});var ee=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new C(o.ctx.common.issues));return f(t,{code:d.invalid_union,unionErrors:i}),y}if(c(s,"handleResults"),t.common.async)return Promise.all(n.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a,i=[];for(let u of n){let l={...t,common:{...t.common,issues:[]},parent:null},p=u._parseSync({data:t.data,path:t.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(u=>new C(u));return f(t,{code:d.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}};c(ee,"ZodUnion");ee.create=(r,e)=>new ee({options:r,typeName:g.ZodUnion,...v(e)});var W=c(r=>r instanceof ne?W(r.schema):r instanceof P?W(r.innerType()):r instanceof se?[r.value]:r instanceof V?r.options:r instanceof ae?b.objectValues(r.enum):r instanceof ie?W(r._def.innerType):r instanceof K?[void 0]:r instanceof X?[null]:r instanceof D?[void 0,...W(r.unwrap())]:r instanceof z?[null,...W(r.unwrap())]:r instanceof be||r instanceof ue?W(r.unwrap()):r instanceof oe?W(r._def.innerType):[],"getDiscriminator"),pe=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return f(t,{code:d.invalid_type,expected:h.object,received:t.parsedType}),y;let n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(f(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let a of t){let i=W(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new pe({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...v(n)})}};c(pe,"ZodDiscriminatedUnion");function Je(r,e){let t=G(r),n=G(e);if(r===e)return{valid:!0,data:r};if(t===h.object&&n===h.object){let s=b.objectKeys(e),a=b.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(let o of a){let u=Je(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===h.array&&n===h.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],u=Je(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===h.date&&n===h.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}c(Je,"mergeValues");var te=class extends _{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=c((a,i)=>{if(We(a)||We(i))return y;let o=Je(a.value,i.value);return o.valid?((Fe(a)||Fe(i))&&t.dirty(),{status:t.value,value:o.data}):(f(n,{code:d.invalid_intersection_types}),y)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};c(te,"ZodIntersection");te.create=(r,e,t)=>new te({left:r,right:e,typeName:g.ZodIntersection,...v(t)});var I=class extends _{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.array)return f(n,{code:d.invalid_type,expected:h.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return f(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(f(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...n.data].map((i,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new j(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>E.mergeArray(t,i)):E.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new I({...this._def,rest:e})}};c(I,"ZodTuple");I.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new I({items:r,typeName:g.ZodTuple,rest:null,...v(e)})};var re=class extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.object)return f(n,{code:d.invalid_type,expected:h.object,received:n.parsedType}),y;let s=[],a=this._def.keyType,i=this._def.valueType;for(let o in n.data)s.push({key:a._parse(new j(n,o,n.path,o)),value:i._parse(new j(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?E.mergeObjectAsync(t,s):E.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof _?new re({keyType:e,valueType:t,typeName:g.ZodRecord,...v(n)}):new re({keyType:N.create(),valueType:e,typeName:g.ZodRecord,...v(t)})}};c(re,"ZodRecord");var me=class extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.map)return f(n,{code:d.invalid_type,expected:h.map,received:n.parsedType}),y;let s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],l)=>({key:s._parse(new j(n,o,n.path,[l,"key"])),value:a._parse(new j(n,u,n.path,[l,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of i){let l=await u.key,p=await u.value;if(l.status==="aborted"||p.status==="aborted")return y;(l.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(l.value,p.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let u of i){let l=u.key,p=u.value;if(l.status==="aborted"||p.status==="aborted")return y;(l.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(l.value,p.value)}return{status:t.value,value:o}}}};c(me,"ZodMap");me.create=(r,e,t)=>new me({valueType:e,keyType:r,typeName:g.ZodMap,...v(t)});var H=class extends _{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.set)return f(n,{code:d.invalid_type,expected:h.set,received:n.parsedType}),y;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(f(n,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(f(n,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let a=this._def.valueType;function i(u){let l=new Set;for(let p of u){if(p.status==="aborted")return y;p.status==="dirty"&&t.dirty(),l.add(p.value)}return{status:t.value,value:l}}c(i,"finalizeSet");let o=[...n.data.values()].map((u,l)=>a._parse(new j(n,u,n.path,l)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new H({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new H({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};c(H,"ZodSet");H.create=(r,e)=>new H({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet,...v(e)});var J=class extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return f(t,{code:d.invalid_type,expected:h.function,received:t.parsedType}),y;function n(o,u){return Ie({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,je(),xe].filter(l=>!!l),issueData:{code:d.invalid_arguments,argumentsError:u}})}c(n,"makeArgsIssue");function s(o,u){return Ie({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,je(),xe].filter(l=>!!l),issueData:{code:d.invalid_return_type,returnTypeError:u}})}c(s,"makeReturnsIssue");let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Y){let o=this;return O(async function(...u){let l=new C([]),p=await o._def.args.parseAsync(u,a).catch(k=>{throw l.addIssue(n(u,k)),l}),x=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(x,a).catch(k=>{throw l.addIssue(s(x,k)),l})})}else{let o=this;return O(function(...u){let l=o._def.args.safeParse(u,a);if(!l.success)throw new C([n(u,l.error)]);let p=Reflect.apply(i,this,l.data),x=o._def.returns.safeParse(p,a);if(!x.success)throw new C([s(p,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new J({...this._def,args:I.create(e).rest(Z.create())})}returns(e){return new J({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new J({args:e||I.create([]).rest(Z.create()),returns:t||Z.create(),typeName:g.ZodFunction,...v(n)})}};c(J,"ZodFunction");var ne=class extends _{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};c(ne,"ZodLazy");ne.create=(r,e)=>new ne({getter:r,typeName:g.ZodLazy,...v(e)});var se=class extends _{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}};c(se,"ZodLiteral");se.create=(r,e)=>new se({value:r,typeName:g.ZodLiteral,...v(e)});function ht(r,e){return new V({values:r,typeName:g.ZodEnum,...v(e)})}c(ht,"createZodEnum");var V=class extends _{constructor(){super(...arguments),Te.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{expected:b.joinValues(n),received:t.parsedType,code:d.invalid_type}),y}if(De(this,Te,"f")||ut(this,Te,new Set(this._def.values),"f"),!De(this,Te,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{received:t.data,code:d.invalid_enum_value,options:n}),y}return O(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return V.create(e,{...this._def,...t})}exclude(e,t=this._def){return V.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};c(V,"ZodEnum");Te=new WeakMap;V.create=ht;var ae=class extends _{constructor(){super(...arguments),Se.set(this,void 0)}_parse(e){let t=b.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.string&&n.parsedType!==h.number){let s=b.objectValues(t);return f(n,{expected:b.joinValues(s),received:n.parsedType,code:d.invalid_type}),y}if(De(this,Se,"f")||ut(this,Se,new Set(b.getValidEnumValues(this._def.values)),"f"),!De(this,Se,"f").has(e.data)){let s=b.objectValues(t);return f(n,{received:n.data,code:d.invalid_enum_value,options:s}),y}return O(e.data)}get enum(){return this._def.values}};c(ae,"ZodNativeEnum");Se=new WeakMap;ae.create=(r,e)=>new ae({values:r,typeName:g.ZodNativeEnum,...v(e)});var Y=class extends _{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return f(t,{code:d.invalid_type,expected:h.promise,received:t.parsedType}),y;let n=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return O(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};c(Y,"ZodPromise");Y.create=(r,e)=>new Y({type:r,typeName:g.ZodPromise,...v(e)});var P=class extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{f(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;let u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?y:u.status==="dirty"||t.value==="dirty"?ve(u.value):u});{if(t.value==="aborted")return y;let o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?ve(o.value):o}}if(s.type==="refinement"){let i=c(o=>{let u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o},"executeRefinement");if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?y:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ee(i))return i;let o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Ee(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);b.assertNever(s)}};c(P,"ZodEffects");P.create=(r,e,t)=>new P({schema:r,typeName:g.ZodEffects,effect:e,...v(t)});P.createWithPreprocess=(r,e,t)=>new P({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects,...v(t)});var D=class extends _{_parse(e){return this._getType(e)===h.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c(D,"ZodOptional");D.create=(r,e)=>new D({innerType:r,typeName:g.ZodOptional,...v(e)});var z=class extends _{_parse(e){return this._getType(e)===h.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};c(z,"ZodNullable");z.create=(r,e)=>new z({innerType:r,typeName:g.ZodNullable,...v(e)});var ie=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===h.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};c(ie,"ZodDefault");ie.create=(r,e)=>new ie({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});var oe=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Re(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new C(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new C(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};c(oe,"ZodCatch");oe.create=(r,e)=>new oe({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});var ge=class extends _{_parse(e){if(this._getType(e)!==h.nan){let n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:h.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}};c(ge,"ZodNaN");ge.create=r=>new ge({typeName:g.ZodNaN,...v(r)});var Kt=Symbol("zod_brand"),be=class extends _{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};c(be,"ZodBranded");var ce=class extends _{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return c(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?y:a.status==="dirty"?(t.dirty(),ve(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})},"handleAsync")();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?y:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new ce({in:e,out:t,typeName:g.ZodPipeline})}};c(ce,"ZodPipeline");var ue=class extends _{_parse(e){let t=this._def.innerType._parse(e),n=c(s=>(Ee(s)&&(s.value=Object.freeze(s.value)),s),"freeze");return Re(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}};c(ue,"ZodReadonly");ue.create=(r,e)=>new ue({innerType:r,typeName:g.ZodReadonly,...v(e)});function pt(r,e={},t){return r?F.create().superRefine((n,s)=>{var a,i;if(!r(n)){let o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,l=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...l,fatal:u})}}):F.create()}c(pt,"custom");var Xt={object:w.lazycreate},g;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(g||(g={}));var er=c((r,e={message:`Input not instance of ${r.name}`})=>pt(t=>t instanceof r,e),"instanceOfType"),mt=N.create,gt=L.create,tr=ge.create,rr=$.create,yt=Q.create,nr=B.create,sr=fe.create,ar=K.create,ir=X.create,or=F.create,cr=Z.create,ur=M.create,lr=he.create,dr=A.create,fr=w.create,hr=w.strictCreate,pr=ee.create,mr=pe.create,gr=te.create,yr=I.create,_r=re.create,vr=me.create,br=H.create,xr=J.create,wr=ne.create,kr=se.create,Tr=V.create,Sr=ae.create,Er=Y.create,ot=P.create,Rr=D.create,Cr=z.create,Or=P.createWithPreprocess,Nr=ce.create,Ar=c(()=>mt().optional(),"ostring"),Pr=c(()=>gt().optional(),"onumber"),jr=c(()=>yt().optional(),"oboolean"),Ir={string:r=>N.create({...r,coerce:!0}),number:r=>L.create({...r,coerce:!0}),boolean:r=>Q.create({...r,coerce:!0}),bigint:r=>$.create({...r,coerce:!0}),date:r=>B.create({...r,coerce:!0})},Dr=y,ye=Object.freeze({__proto__:null,defaultErrorMap:xe,setErrorMap:Dt,getErrorMap:je,makeIssue:Ie,EMPTY_PATH:Mt,addIssueToContext:f,ParseStatus:E,INVALID:y,DIRTY:ve,OK:O,isAborted:We,isDirty:Fe,isValid:Ee,isAsync:Re,get util(){return b},get objectUtil(){return He},ZodParsedType:h,getParsedType:G,ZodType:_,datetimeRegex:ft,ZodString:N,ZodNumber:L,ZodBigInt:$,ZodBoolean:Q,ZodDate:B,ZodSymbol:fe,ZodUndefined:K,ZodNull:X,ZodAny:F,ZodUnknown:Z,ZodNever:M,ZodVoid:he,ZodArray:A,ZodObject:w,ZodUnion:ee,ZodDiscriminatedUnion:pe,ZodIntersection:te,ZodTuple:I,ZodRecord:re,ZodMap:me,ZodSet:H,ZodFunction:J,ZodLazy:ne,ZodLiteral:se,ZodEnum:V,ZodNativeEnum:ae,ZodPromise:Y,ZodEffects:P,ZodTransformer:P,ZodOptional:D,ZodNullable:z,ZodDefault:ie,ZodCatch:oe,ZodNaN:ge,BRAND:Kt,ZodBranded:be,ZodPipeline:ce,ZodReadonly:ue,custom:pt,Schema:_,ZodSchema:_,late:Xt,get ZodFirstPartyTypeKind(){return g},coerce:Ir,any:or,array:dr,bigint:rr,boolean:yt,date:nr,discriminatedUnion:mr,effect:ot,enum:Tr,function:xr,instanceof:er,intersection:gr,lazy:wr,literal:kr,map:vr,nan:tr,nativeEnum:Sr,never:ur,null:ir,nullable:Cr,number:gt,object:fr,oboolean:jr,onumber:Pr,optional:Rr,ostring:Ar,pipeline:Nr,preprocess:Or,promise:Er,record:_r,set:br,strictObject:hr,string:mt,symbol:sr,transformer:ot,tuple:yr,undefined:ar,union:pr,unknown:cr,void:lr,NEVER:Dr,ZodIssueCode:d,quotelessJson:It,ZodError:C});var Mr=ye.object({_id:ye.string().optional(),ownerDid:ye.string(),name:ye.string(),did:ye.string().optional(),endpoint:ye.string().optional()});function Lr(r){return r}c(Lr,"identity");function $r(r){return r.length===0?Lr:r.length===1?r[0]:c(function(t){return r.reduce((n,s)=>s(n),t)},"piped")}c($r,"pipeFromArray");function U(r){let e={subscribe(t){let n=null,s=!1,a=!1,i=!1;function o(){if(n===null){i=!0;return}a||(a=!0,typeof n=="function"?n():n&&n.unsubscribe())}return c(o,"unsubscribe"),n=r({next(u){s||t.next?.(u)},error(u){s||(s=!0,t.error?.(u),o())},complete(){s||(s=!0,t.complete?.(),o())}}),i&&o(),{unsubscribe:o}},pipe(...t){return $r(t)(e)}};return e}c(U,"observable");function _t(r){return e=>{let t=0,n=null,s=[];function a(){n||(n=e.subscribe({next(o){for(let u of s)u.next?.(o)},error(o){for(let u of s)u.error?.(o)},complete(){for(let o of s)o.complete?.()}}))}c(a,"startIfNeeded");function i(){if(t===0&&n){let o=n;n=null,o.unsubscribe()}}return c(i,"resetIfNeeded"),{subscribe(o){return t++,s.push(o),a(),{unsubscribe(){t--,i();let u=s.findIndex(l=>l===o);u>-1&&s.splice(u,1)}}}}}}c(_t,"share");var we=class extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,we.prototype)}};c(we,"ObservableAbortError");function vt(r){let e;return{promise:new Promise((n,s)=>{let a=!1;function i(){a||(a=!0,s(new we("This operation was aborted.")),o.unsubscribe())}c(i,"onDone");let o=r.subscribe({next(u){a=!0,n(u),i()},error(u){a=!0,s(u),i()},complete(){a=!0,i()}});e=i}),abort:e}}c(vt,"observableToPromise");function bt(r){return U(e=>{function t(s=0,a=r.op){let i=r.links[s];if(!i)throw new Error("No more links to execute - did you forget to add an ending link?");return i({op:a,next(u){return t(s+1,u)}})}return c(t,"execute"),t().subscribe(e)})}c(bt,"createChain");function Ye(r){let e=Object.create(null);for(let t in r){let n=r[t];e[n]=t}return e}c(Ye,"invert");var Me={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099},xn=Ye(Me);var Tn=Ye(Me);var xt=c(()=>{},"noop");function wt(r,e){return new Proxy(xt,{get(n,s){if(!(typeof s!="string"||s==="then"))return wt(r,[...e,s])},apply(n,s,a){let i=e[e.length-1]==="apply";return r({args:i?a.length>=2?a[1]:[]:a,path:i?e.slice(0,-1):e})}})}c(wt,"createInnerProxy");var Ge=c(r=>wt(r,[]),"createRecursiveProxy"),Qe=c(r=>new Proxy(xt,{get(e,t){if(!(typeof t!="string"||t==="then"))return r(t)}}),"createFlatProxy");function Vr(r){return!!r&&!Array.isArray(r)&&typeof r=="object"}c(Vr,"isObject");var Le=class extends Error{};c(Le,"UnknownCauseError");function Ke(r){if(r instanceof Error)return r;let e=typeof r;if(!(e==="undefined"||e==="function"||r===null)){if(e!=="object")return new Error(String(r));if(Vr(r)){let t=new Le;for(let n in r)t[n]=r[n];return t}}}c(Ke,"getCauseFromUnknown");function Ce(r){return!!r&&!Array.isArray(r)&&typeof r=="object"}c(Ce,"isObject");function zr(r,e){if("error"in r){let n=e.transformer.deserialize(r.error);return{ok:!1,error:{...r,error:n}}}let t={...r.result,...(!r.result.type||r.result.type==="data")&&{type:"data",data:e.transformer.deserialize(r.result.data)}};return{ok:!0,result:t}}c(zr,"transformResultInner");var ke=class extends Error{constructor(){super("Unable to transform response from server")}};c(ke,"TransformResultError");function Oe(r,e){let t;try{t=zr(r,e)}catch{throw new ke}if(!t.ok&&(!Ce(t.error.error)||typeof t.error.error.code!="number"))throw new ke;if(t.ok&&!Ce(t.result))throw new ke;return t}c(Oe,"transformResult");function Ur(r){return r instanceof T||r instanceof Error&&r.name==="TRPCClientError"}c(Ur,"isTRPCClientError");function qr(r){return Ce(r)&&Ce(r.error)&&typeof r.error.code=="number"&&typeof r.error.message=="string"}c(qr,"isTRPCErrorResponse");var T=class extends Error{static from(e,t={}){let n=e;return Ur(n)?(t.meta&&(n.meta={...n.meta,...t.meta}),n):qr(n)?new T(n.error.message,{...t,result:n}):n instanceof Error?new T(n.message,{...t,cause:Ke(n)}):new T("Unknown error",{...t,cause:n})}constructor(e,t){let n=t?.cause;super(e,{cause:n}),this.meta=t?.meta,this.cause=n,this.shape=t?.result?.error,this.data=t?.result?.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,T.prototype)}};c(T,"TRPCClientError");var kt=c(r=>typeof r=="function","isFunction");function Tt(r){if(r)return r;if(typeof window<"u"&&kt(window.fetch))return window.fetch;if(typeof globalThis<"u"&&kt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}c(Tt,"getFetch");function Br(r){return r||(typeof window<"u"&&window.AbortController?window.AbortController:typeof globalThis<"u"&&globalThis.AbortController?globalThis.AbortController:null)}c(Br,"getAbortController");function $e(r){return{url:r.url.toString().replace(/\/$/,""),fetch:r.fetch,AbortController:Br(r.AbortController)}}c($e,"resolveHTTPLinkOptions");function Zr(r){let e={};for(let t=0;t<r.length;t++){let n=r[t];e[t]=n}return e}c(Zr,"arrayToDict");var Hr={query:"GET",mutation:"POST"};function St(r){return"input"in r?r.runtime.transformer.serialize(r.input):Zr(r.inputs.map(e=>r.runtime.transformer.serialize(e)))}c(St,"getInput");var Ne=c(r=>{let e=r.url+"/"+r.path,t=[];if("inputs"in r&&t.push("batch=1"),r.type==="query"){let n=St(r);n!==void 0&&t.push(`input=${encodeURIComponent(JSON.stringify(n))}`)}return t.length&&(e+="?"+t.join("&")),e},"getUrl"),Xe=c(r=>{if(r.type==="query")return;let e=St(r);return e!==void 0?JSON.stringify(e):void 0},"getBody"),Ve=c(r=>tt({...r,contentTypeHeader:"application/json",getUrl:Ne,getBody:Xe}),"jsonHttpRequester");async function et(r,e){let t=r.getUrl(r),n=r.getBody(r),{type:s}=r,a=await r.headers();if(s==="subscription")throw new Error("Subscriptions should use wsLink");let i={...r.contentTypeHeader?{"content-type":r.contentTypeHeader}:{},...r.batchModeHeader?{"trpc-batch-mode":r.batchModeHeader}:{},...a};return Tt(r.fetch)(t,{method:Hr[s],signal:e?.signal,body:n,headers:i})}c(et,"fetchHTTPResponse");function tt(r){let e=r.AbortController?new r.AbortController:null,t={},n=!1;return{promise:new Promise((i,o)=>{et(r,e).then(u=>(t.response=u,n=!0,u.json())).then(u=>{t.responseJSON=u,i({json:u,meta:t})}).catch(u=>{n=!0,o(T.from(u,{meta:t}))})}),cancel:c(()=>{n||e?.abort()},"cancel")}}c(tt,"httpRequest");var rt=c(()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")},"throwFatalError");function nt(r){let e=null,t=null,n=c(()=>{clearTimeout(t),t=null,e=null},"destroyTimerAndPendingItems");function s(o){let u=[[]],l=0;for(;;){let p=o[l];if(!p)break;let x=u[u.length-1];if(p.aborted){p.reject?.(new Error("Aborted")),l++;continue}if(r.validate(x.concat(p).map(k=>k.key))){x.push(p),l++;continue}if(x.length===0){p.reject?.(new Error("Input is too big for a single dispatch")),l++;continue}u.push([])}return u}c(s,"groupItems");function a(){let o=s(e);n();for(let u of o){if(!u.length)continue;let l={items:u,cancel:rt};for(let k of u)k.batch=l;let p=c((k,R)=>{let q=l.items[k];q.resolve?.(R),q.batch=null,q.reject=null,q.resolve=null},"unitResolver"),{promise:x,cancel:S}=r.fetch(l.items.map(k=>k.key),p);l.cancel=S,x.then(k=>{for(let R=0;R<k.length;R++){let q=k[R];p(R,q)}for(let R of l.items)R.reject?.(new Error("Missing result")),R.batch=null}).catch(k=>{for(let R of l.items)R.reject?.(k),R.batch=null})}}c(a,"dispatch");function i(o){let u={aborted:!1,key:o,batch:null,resolve:rt,reject:rt},l=new Promise((x,S)=>{u.reject=S,u.resolve=x,e||(e=[]),e.push(u)});return t||(t=setTimeout(a)),{promise:l,cancel:c(()=>{u.aborted=!0,u.batch?.items.every(x=>x.aborted)&&(u.batch.cancel(),u.batch=null)},"cancel")}}return c(i,"load"),{load:i}}c(nt,"dataLoader");function st(r){return c(function(t){let n=$e(t),s=t.maxURLLength??1/0;return a=>{let i=c(x=>{let S=c(R=>{if(s===1/0)return!0;let q=R.map(de=>de.path).join(","),Ae=R.map(de=>de.input);return Ne({...n,runtime:a,type:x,path:q,inputs:Ae}).length<=s},"validate"),k=r({...n,runtime:a,type:x,opts:t});return{validate:S,fetch:k}},"batchLoader"),o=nt(i("query")),u=nt(i("mutation")),l=nt(i("subscription")),p={query:o,subscription:l,mutation:u};return({op:x})=>U(S=>{let k=p[x.type],{promise:R,cancel:q}=k.load(x),Ae;return R.then(le=>{Ae=le;let de=Oe(le.json,a);if(!de.ok){S.error(T.from(de.error,{meta:le.meta}));return}S.next({context:le.meta,result:de.result}),S.complete()}).catch(le=>{S.error(T.from(le,{meta:Ae?.meta}))}),()=>{q()}})}},"httpBatchLink")}c(st,"createHTTPBatchLink");var Wr=c(r=>e=>{let t=e.map(i=>i.path).join(","),n=e.map(i=>i.input),{promise:s,cancel:a}=Ve({...r,path:t,inputs:n,headers(){return r.opts.headers?typeof r.opts.headers=="function"?r.opts.headers({opList:e}):r.opts.headers:{}}});return{promise:s.then(i=>(Array.isArray(i.json)?i.json:e.map(()=>i.json)).map(l=>({meta:i.meta,json:l}))),cancel:a}},"batchRequester"),ze=st(Wr);function Ue(r){return e=>{let t=$e(e);return n=>({op:s})=>U(a=>{let{path:i,input:o,type:u}=s,{promise:l,cancel:p}=r.requester({...t,runtime:n,type:u,path:i,input:o,headers(){return e.headers?typeof e.headers=="function"?e.headers({op:s}):e.headers:{}}}),x;return l.then(S=>{x=S.meta;let k=Oe(S.json,n);if(!k.ok){a.error(T.from(k.error,{meta:x}));return}a.next({context:S.meta,result:k.result}),a.complete()}).catch(S=>{a.error(T.from(S,{meta:x}))}),()=>{p()}})}}c(Ue,"httpLinkFactory");var Fr=Ue({requester:Ve});var qe=class{$request({type:e,input:t,path:n,context:s={}}){return bt({links:this.links,op:{id:++this.requestId,type:e,path:n,input:t,context:s}}).pipe(_t())}requestAsPromise(e){let t=this.$request(e),{promise:n,abort:s}=vt(t);return new Promise((i,o)=>{e.signal?.addEventListener("abort",s),n.then(u=>{i(u.result.data)}).catch(u=>{o(T.from(u))})})}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n?.context}).subscribe({next(a){a.result.type==="started"?n.onStarted?.():a.result.type==="stopped"?n.onStopped?.():n.onData?.(a.result.data)},error(a){n.onError?.(a)},complete(){n.onComplete?.()}})}constructor(e){this.requestId=0;let t=(()=>{let n=e.transformer;return n?"input"in n?e.transformer:{input:n,output:n}:{input:{serialize:s=>s,deserialize:s=>s},output:{serialize:s=>s,deserialize:s=>s}}})();this.runtime={transformer:{serialize:n=>t.input.serialize(n),deserialize:n=>t.output.deserialize(n)},combinedTransformer:t},this.links=e.links.map(n=>n(this.runtime))}};c(qe,"TRPCUntypedClient");var Jr={query:"query",mutate:"mutation",subscribe:"subscription"},Yr=c(r=>Jr[r],"clientCallTypeToProcedureType");function Gr(r){return Qe(e=>r.hasOwnProperty(e)?r[e]:e==="__untypedClient"?r:Ge(({path:t,args:n})=>{let s=[e,...t],a=Yr(s.pop()),i=s.join(".");return r[a](i,...n)}))}c(Gr,"createTRPCClientProxy");function at(r){let e=new qe(r);return Gr(e)}c(at,"createTRPCProxyClient");function Qr(r){if(r)return r;if(typeof window<"u"&&window.TextDecoder)return new window.TextDecoder;if(typeof globalThis<"u"&&globalThis.TextDecoder)return new globalThis.TextDecoder;throw new Error("No TextDecoder implementation found")}c(Qr,"getTextDecoder");async function Kr(r){let e=r.parse??JSON.parse,t=c(n=>{if(r.signal?.aborted||!n||n==="}")return;let s=n.indexOf(":"),a=n.substring(2,s-1),i=n.substring(s+1);r.onSingle(Number(a),e(i))},"onLine");await Xr(r.readableStream,t,r.textDecoder)}c(Kr,"parseJSONStream");async function Xr(r,e,t){let n="",s=c(a=>{let o=t.decode(a).split(`
2
+ `);if(o.length===1)n+=o[0];else if(o.length>1){e(n+o[0]);for(let u=1;u<o.length-1;u++)e(o[u]);n=o[o.length-1]}},"onChunk");"getReader"in r?await tn(r,s):await en(r,s),e(n)}c(Xr,"readLines");function en(r,e){return new Promise(t=>{r.on("data",e),r.on("end",t)})}c(en,"readNodeChunks");async function tn(r,e){let t=r.getReader(),n=await t.read();for(;!n.done;)e(n.value),n=await t.read()}c(tn,"readStandardChunks");var rn=c((r,e)=>{let t=r.AbortController?new r.AbortController:null,n=et({...r,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:Ne,getBody:Xe},t),s=c(()=>t?.abort(),"cancel"),a=n.then(async i=>{if(!i.body)throw new Error("Received response without body");let o={response:i};return Kr({readableStream:i.body,onSingle:e,parse:u=>({json:JSON.parse(u),meta:o}),signal:t?.signal,textDecoder:r.textDecoder})});return{cancel:s,promise:a}},"streamingJsonHttpRequester"),nn=c(r=>{let e=Qr(r.opts.textDecoder);return(t,n)=>{let s=t.map(u=>u.path).join(","),a=t.map(u=>u.input),{cancel:i,promise:o}=rn({...r,textDecoder:e,path:s,inputs:a,headers(){return r.opts.headers?typeof r.opts.headers=="function"?r.opts.headers({opList:t}):r.opts.headers:{}}},(u,l)=>{n(u,l)});return{promise:o.then(()=>[]),cancel:i}}},"streamRequester"),xs=st(nn),sn=c(r=>{if("input"in r){if(!(r.input instanceof FormData))throw new Error("Input is not FormData");return r.input}},"getBody"),an=c(r=>{if(r.type!=="mutation")throw new Error("We only handle mutations with formdata");return tt({...r,getUrl(){return`${r.url}/${r.path}`},getBody:sn})},"formDataRequester"),ws=Ue({requester:an});var on=Object.defineProperty,Be=c((r,e)=>on(r,"name",{value:e,configurable:!0}),"__name"),cn=Be(r=>()=>({next:e,op:t})=>U(n=>{let s=null,a=0,i=!1,o=Be(()=>{a+=1,s?.unsubscribe(),s=e(t).subscribe({error:async u=>{if(a>5||u.data?.httpStatus!==401)return n.error(u);await r(),o()},next:u=>n.next(u),complete:()=>{i&&n.complete()}})},"attempt");return o(),()=>{i=!0,s?.unsubscribe()}}),"callbackLink"),Et=Be(async(r,e)=>{let t=[],n=at({links:[ze({url:r,headers:{Authorization:`Bearer ${await e()}`}})]}),s=Be(async(i=95+Math.round((Math.random()-.5)*5))=>n.utilities.getChallenges.query({amount:i}),"getChallenges");return s().then(i=>t=i),at({links:[cn(async()=>{t=await s()}),ze({url:r,headers:async()=>(t.length===0&&t.push(...await s()),{Authorization:`Bearer ${await e(t.pop())}`})})]})},"getClient");var Rt=c(async(r,e)=>Et(r,async t=>{let n=await e.invoke.getDidAuthVp({proofFormat:"jwt",challenge:t});if(typeof n!="string")throw new Error("Error getting DID-Auth-JWT!");return n}),"getNewClient"),un=c(async(r,e)=>{let t=r,n=t.id.did(),s=await Rt(e,t),a=c(async o=>{let u=o.id.did();n!==u&&(s=await Rt(e,o),n=u),t=o},"updateLearnCard"),i=t.invoke.getProfile().then(async o=>{o&&await a(t)});return{name:"Simple Signing Authority",displayName:"Simple Signing Authority Plugin",description:"Lets you create and use Signing Authorities",methods:{createSigningAuthority:async(o,u)=>(await i,await a(o),s.signingAuthority.createSigningAuthority.mutate({name:u})),getSigningAuthorities:async o=>(await i,await a(o),s.signingAuthority.signingAuthorities.query()),authorizeSigningAuthority:async(o,u,l)=>(await i,await a(o),s.signingAuthority.authorizeSigningAuthority.mutate({name:u,authorization:l}))}}},"getSimpleSigningPlugin");
3
3
  /* istanbul ignore if -- @preserve */
4
4
  /* istanbul ignore next -- @preserve */
5
5
  //# sourceMappingURL=simple-signing-plugin.cjs.production.min.cjs.map