@learncard/network-plugin 1.7.3 → 1.7.4

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,4 +1,4 @@
1
- var Ee=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Rt=Object.prototype.hasOwnProperty;var u=(r,e)=>Ee(r,"name",{value:e,configurable:!0});var Ot=(r,e)=>{for(var t in e)Ee(r,t,{get:e[t],enumerable:!0})},It=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Vt(e))!Rt.call(r,s)&&s!==t&&Ee(r,s,{get:()=>e[s],enumerable:!(n=Nt(e,s))||n.enumerable});return r};var At=r=>It(Ee({},"__esModule",{value:!0}),r);var kn={};Ot(kn,{getLearnCardNetworkPlugin:()=>xn,getVerifyBoostPlugin:()=>Cn});module.exports=At(kn);function Dt(r){return r}u(Dt,"identity");function Lt(r){return r.length===0?Dt:r.length===1?r[0]:u(function(t){return r.reduce((n,s)=>s(n),t)},"piped")}u(Lt,"pipeFromArray");function $(r){let e={subscribe(t){let n=null,s=!1,o=!1,c=!1;function i(){if(n===null){c=!0;return}o||(o=!0,typeof n=="function"?n():n&&n.unsubscribe())}return u(i,"unsubscribe"),n=r({next(l){s||t.next?.(l)},error(l){s||(s=!0,t.error?.(l),i())},complete(){s||(s=!0,t.complete?.(),i())}}),c&&i(),{unsubscribe:i}},pipe(...t){return Lt(t)(e)}};return e}u($,"observable");function nt(r){return e=>{let t=0,n=null,s=[];function o(){n||(n=e.subscribe({next(i){for(let l of s)l.next?.(i)},error(i){for(let l of s)l.error?.(i)},complete(){for(let i of s)i.complete?.()}}))}u(o,"startIfNeeded");function c(){if(t===0&&n){let i=n;n=null,i.unsubscribe()}}return u(c,"resetIfNeeded"),{subscribe(i){return t++,s.push(i),o(),{unsubscribe(){t--,c();let l=s.findIndex(d=>d===i);l>-1&&s.splice(l,1)}}}}}}u(nt,"share");var be=class extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,be.prototype)}};u(be,"ObservableAbortError");function at(r){let e;return{promise:new Promise((n,s)=>{let o=!1;function c(){o||(o=!0,s(new be("This operation was aborted.")),i.unsubscribe())}u(c,"onDone");let i=r.subscribe({next(l){o=!0,n(l),c()},error(l){o=!0,s(l),c()},complete(){o=!0,c()}});e=c}),abort:e}}u(at,"observableToPromise");var E=class extends Error{static from(e,t={}){return e instanceof Error?e.name==="TRPCClientError"?e:new E(e.message,{...t,cause:e,result:null}):new E(e.error.message??"",{...t,cause:void 0,result:e})}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,E.prototype)}};u(E,"TRPCClientError");function qt(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}}u(qt,"transformResultInner");function st(r){return!!r&&!Array.isArray(r)&&typeof r=="object"}u(st,"isObject");function je(r,e){let t;try{t=qt(r,e)}catch{throw new E("Unable to transform response from server")}if(!t.ok&&(!st(t.error.error)||typeof t.error.error.code!="number"))throw new E("Badly formatted response from server");if(t.ok&&!st(t.result))throw new E("Badly formatted response from server");return t}u(je,"transformResult");function it(r){return $(e=>{function t(s=0,o=r.op){let c=r.links[s];if(!c)throw new Error("No more links to execute - did you forget to add an ending link?");return c({op:o,next(l){return t(s+1,l)}})}return u(t,"execute"),t().subscribe(e)})}u(it,"createChain");var ot=u(()=>{},"noop");function ct(r,e){return new Proxy(ot,{get(n,s){if(!(typeof s!="string"||s==="then"))return ct(r,[...e,s])},apply(n,s,o){return r({args:o,path:e})}})}u(ct,"createInnerProxy");var Be=u(r=>ct(r,[]),"createRecursiveProxy"),$e=u(r=>new Proxy(ot,{get(e,t){if(!(typeof t!="string"||t==="then"))return r(t)}}),"createFlatProxy");var ze=u(r=>typeof r=="function","isFunction");function lt(r,e){return ze(r.bind)?r.bind(e):r}u(lt,"_bind");function ut(r){if(r)return r;if(typeof window<"u"&&ze(window.fetch))return lt(window.fetch,window);if(typeof globalThis<"u"&&ze(globalThis.fetch))return lt(globalThis.fetch,globalThis);throw new Error("No fetch implementation found")}u(ut,"getFetch");function Mt(r){return r||(typeof window<"u"&&window.AbortController?window.AbortController:typeof globalThis<"u"&&globalThis.AbortController?globalThis.AbortController:null)}u(Mt,"getAbortController");function We(r){let e=r.headers||(()=>({}));return{url:r.url,fetch:ut(r.fetch),AbortController:Mt(r.AbortController),headers:typeof e=="function"?e:()=>e}}u(We,"resolveHTTPLinkOptions");function Bt(r){let e={};for(let t=0;t<r.length;t++){let n=r[t];e[t]=n}return e}u(Bt,"arrayToDict");var $t={query:"GET",mutation:"POST"};function dt(r){return"input"in r?r.runtime.transformer.serialize(r.input):Bt(r.inputs.map(e=>r.runtime.transformer.serialize(e)))}u(dt,"getInput");function Ue(r){let e=r.url+"/"+r.path,t=[];if("inputs"in r&&t.push("batch=1"),r.type==="query"){let n=dt(r);n!==void 0&&t.push(`input=${encodeURIComponent(JSON.stringify(n))}`)}return t.length&&(e+="?"+t.join("&")),e}u(Ue,"getUrl");function zt(r){if(r.type==="query")return;let e=dt(r);return e!==void 0?JSON.stringify(e):void 0}u(zt,"getBody");function Ze(r){let{type:e}=r,t=r.AbortController?new r.AbortController:null;return{promise:new Promise((o,c)=>{let i=Ue(r),l=zt(r),d={};Promise.resolve(r.headers()).then(p=>{if(e==="subscription")throw new Error("Subscriptions should use wsLink");return r.fetch(i,{method:$t[e],signal:t?.signal,body:l,headers:{"content-type":"application/json",...p}})}).then(p=>(d.response=p,p.json())).then(p=>{o({json:p,meta:d})}).catch(c)}),cancel:u(()=>{t?.abort()},"cancel")}}u(Ze,"httpRequest");var Fe=u(()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")},"throwFatalError");function Je(r){let e=null,t=null,n=u(()=>{clearTimeout(t),t=null,e=null},"destroyTimerAndPendingItems");function s(i){let l=[[]],d=0;for(;;){let p=i[d];if(!p)break;let b=l[l.length-1];if(p.aborted){p.reject(new Error("Aborted")),d++;continue}if(r.validate(b.concat(p).map(T=>T.key))){b.push(p),d++;continue}if(b.length===0){p.reject(new Error("Input is too big for a single dispatch")),d++;continue}l.push([])}return l}u(s,"groupItems");function o(){let i=s(e);n();for(let l of i){if(!l.length)continue;let d={items:l,cancel:Fe};for(let C of l)C.batch=d;let{promise:p,cancel:b}=r.fetch(d.items.map(C=>C.key));d.cancel=b,p.then(C=>{for(let T=0;T<C.length;T++){let S=C[T],q=d.items[T];q.resolve(S),q.batch=null}}).catch(C=>{for(let T of d.items)T.reject(C),T.batch=null})}}u(o,"dispatch");function c(i){let l={aborted:!1,key:i,batch:null,resolve:Fe,reject:Fe},d=new Promise((b,C)=>{l.reject=C,l.resolve=b,e||(e=[]),e.push(l)});return t||(t=setTimeout(o)),{promise:d,cancel:u(()=>{l.aborted=!0,l.batch?.items.every(b=>b.aborted)&&(l.batch.cancel(),l.batch=null)},"cancel")}}return u(c,"load"),{load:c}}u(Je,"dataLoader");function Pe(r){let e=We(r);return t=>{let n=r.maxURLLength||1/0,s=u(d=>({validate:u(C=>{if(n===1/0)return!0;let T=C.map(ue=>ue.path).join(","),S=C.map(ue=>ue.input);return Ue({...e,runtime:t,type:d,path:T,inputs:S}).length<=n},"validate"),fetch:u(C=>{let T=C.map(B=>B.path).join(","),S=C.map(B=>B.input),{promise:q,cancel:ue}=Ze({...e,runtime:t,type:d,path:T,inputs:S});return{promise:q.then(B=>(Array.isArray(B.json)?B.json:C.map(()=>B.json)).map(St=>({meta:B.meta,json:St}))),cancel:ue}},"fetch")}),"batchLoader"),o=Je(s("query")),c=Je(s("mutation")),i=Je(s("subscription")),l={query:o,subscription:i,mutation:c};return({op:d})=>$(p=>{let b=l[d.type],{promise:C,cancel:T}=b.load(d);return C.then(S=>{let q=je(S.json,t);if(!q.ok){p.error(E.from(q.error,{meta:S.meta}));return}p.next({context:S.meta,result:q.result}),p.complete()}).catch(S=>p.error(E.from(S))),()=>{T()}})}}u(Pe,"httpBatchLink");var Se=class{$request({type:e,input:t,path:n,context:s={}}){return it({links:this.links,op:{id:++this.requestId,type:e,path:n,input:t,context:s}}).pipe(nt())}requestAsPromise(e){let t=this.$request(e),{promise:n,abort:s}=at(t);return new Promise((c,i)=>{e.signal?.addEventListener("abort",s),n.then(l=>{c(l.result.data)}).catch(l=>{i(E.from(l))})})}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(o){o.result.type==="started"?n.onStarted?.():o.result.type==="stopped"?n.onStopped?.():n.onData?.(o.result.data)},error(o){n.onError?.(o)},complete(){n.onComplete?.()}})}constructor(e){this.requestId=0;function t(){let n=e.transformer;return n?"input"in n?{serialize:n.input.serialize,deserialize:n.output.deserialize}:n:{serialize:s=>s,deserialize:s=>s}}u(t,"getTransformer"),this.runtime={transformer:t()},this.links=e.links.map(n=>n(this.runtime))}};u(Se,"TRPCUntypedClient");var Wt={query:"query",mutate:"mutation",subscribe:"subscription"};function Ut(r){return $e(e=>r.hasOwnProperty(e)?r[e]:Be(({path:t,args:n})=>{let s=[e,...t],o=s.pop(),c=Wt[o],i=s.join(".");return r[c](i,...n)}))}u(Ut,"createTRPCClientProxy");function He(r){let e=new Se(r);return Ut(e)}u(He,"createTRPCProxyClient");var Zt=Object.defineProperty,Ne=u((r,e)=>Zt(r,"name",{value:e,configurable:!0}),"__name"),Ft=Ne(r=>()=>({next:e,op:t})=>$(n=>{let s=null,o=0,c=!1,i=Ne(()=>{o+=1,s?.unsubscribe(),s=e(t).subscribe({error:async l=>{if(o>5||l.data?.httpStatus!==401)return n.error(l);await r(),i()},next:l=>n.next(l),complete:()=>{c&&n.complete()}})},"attempt");return i(),()=>{c=!0,s?.unsubscribe()}}),"callbackLink"),pt=Ne(async(r,e)=>{let t=[],n=He({links:[Pe({url:r,headers:{Authorization:`Bearer ${await e()}`}})]}),s=Ne(async(c=95+Math.round((Math.random()-.5)*5))=>n.utilities.getChallenges.query({amount:c}),"getChallenges");return t=await s(),He({links:[Ft(async()=>{t=await s()}),Pe({url:r,headers:async()=>(t.length===0&&t.push(...await s()),{Authorization:`Bearer ${await e(t.pop())}`})})]})},"getClient");var x;(function(r){r.assertEqual=s=>s;function e(s){}u(e,"assertIs"),r.assertIs=e;function t(s){throw new Error}u(t,"assertNever"),r.assertNever=t,r.arrayToEnum=s=>{let o={};for(let c of s)o[c]=c;return o},r.getValidEnumValues=s=>{let o=r.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),c={};for(let i of o)c[i]=s[i];return r.objectValues(c)},r.objectValues=s=>r.objectKeys(s).map(function(o){return s[o]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let c in s)Object.prototype.hasOwnProperty.call(s,c)&&o.push(c);return o},r.find=(s,o)=>{for(let c of s)if(o(c))return c},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}u(n,"joinValues"),r.joinValues=n,r.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(x||(x={}));var m=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),G=u(r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(r)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},"getParsedType"),f=x.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"]),Jt=u(r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),A=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(o){return o.message},n={_errors:[]},s=u(o=>{for(let c of o.issues)if(c.code==="invalid_union")c.unionErrors.map(s);else if(c.code==="invalid_return_type")s(c.returnTypeError);else if(c.code==="invalid_arguments")s(c.argumentsError);else if(c.path.length===0)n._errors.push(t(c));else{let i=n,l=0;for(;l<c.path.length;){let d=c.path[l];l===c.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(t(c))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}},"processError");return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.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()}};u(A,"ZodError");A.create=r=>new A(r);var Ce=u((r,e)=>{let t;switch(r.code){case f.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.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}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case f.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 f.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 f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}},"errorMap"),yt=Ce;function Ht(r){yt=r}u(Ht,"setErrorMap");function Re(){return yt}u(Re,"getErrorMap");var Oe=u(r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,o=[...t,...s.path||[]],c={...s,path:o},i="",l=n.filter(d=>!!d).slice().reverse();for(let d of l)i=d(c,{data:e,defaultError:i}).message;return{...s,path:o,message:s.message||i}},"makeIssue"),Gt=[];function h(r,e){let t=Oe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Re(),Ce].filter(n=>!!n)});r.common.issues.push(t)}u(h,"addIssueToContext");var j=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 g;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 j.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:o,value:c}=s;if(o.status==="aborted"||c.status==="aborted")return g;o.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),(typeof c.value<"u"||s.alwaysSet)&&(n[o.value]=c.value)}return{status:e.value,value:n}}};u(j,"ParseStatus");var g=Object.freeze({status:"aborted"}),gt=u(r=>({status:"dirty",value:r}),"DIRTY"),P=u(r=>({status:"valid",value:r}),"OK"),Ge=u(r=>r.status==="aborted","isAborted"),Qe=u(r=>r.status==="dirty","isDirty"),Ie=u(r=>r.status==="valid","isValid"),Ae=u(r=>typeof Promise!==void 0&&r instanceof Promise,"isAsync"),w;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(w||(w={}));var R=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)}};u(R,"ParseInputLazyPath");var ft=u((r,e)=>{if(Ie(e))return{success:!0,data:e.value};{if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");let t=new A(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:u((c,i)=>c.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.defaultError},"customMap"),description:s}}u(_,"processCreateParams");var v=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 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 j,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(Ae(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)},o=this._parseSync({data:e,path:s.path,parent:s});return ft(s,o)}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}),o=await(Ae(s)?s:Promise.resolve(s));return ft(n,o)}refine(e,t){let n=u(s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t,"getIssueProperties");return this._refinement((s,o)=>{let c=e(s),i=u(()=>o.addIssue({code:f.custom,...n(s)}),"setError");return typeof Promise<"u"&&c instanceof Promise?c.then(l=>l?!0:(i(),!1)):c?!0:(i(),!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 V({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return I.create(this)}nullable(){return Z.create(this)}nullish(){return this.optional().nullable()}array(){return N.create(this)}promise(){return H.create(this)}or(e){return ee.create([this,e])}and(e){return te.create(this,e)}transform(e){return new V({schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new oe({innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new xe({typeName:y.ZodBranded,type:this,..._(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new he({innerType:this,defaultValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ce.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};u(v,"ZodType");var Qt=/^c[^\s-]{8,}$/i,Yt=/^([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,Kt=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,Xt=u(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 v{constructor(){super(...arguments),this._regex=(e,t,n)=>this.refinement(s=>e.test(s),{validation:t,code:f.invalid_string,...w.errToObj(n)}),this.nonempty=e=>this.min(1,w.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)!==m.string){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.string,received:o.parsedType}),g}let n=new j,s;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let c=e.data.length>o.value,i=e.data.length<o.value;(c||i)&&(s=this._getOrReturnCtx(e,s),c?h(s,{code:f.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):i&&h(s,{code:f.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")Kt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"email",code:f.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")Yt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"uuid",code:f.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Qt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid",code:f.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),h(s,{validation:"url",code:f.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"regex",code:f.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="startsWith"?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?Xt(o).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:"datetime",message:o.message}),n.dirty()):x.assertNever(o);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",...w.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.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,...w.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...w.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...w.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...w.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...w.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}};u(D,"ZodString");D.create=r=>{var e;return new D({checks:[],typeName:y.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function er(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,o=parseInt(r.toFixed(s).replace(".","")),c=parseInt(e.toFixed(s).replace(".",""));return o%c/Math.pow(10,s)}u(er,"floatSafeRemainder");var M=class extends v{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)!==m.number){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.number,received:o.parsedType}),g}let n,s=new j;for(let o of this._def.checks)o.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?er(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_finite,message:o.message}),s.dirty()):x.assertNever(o);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,n,s){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:w.toString(s)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:w.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")}};u(M,"ZodNumber");M.create=r=>new M({checks:[],typeName:y.ZodNumber,coerce:r?.coerce||!1,..._(r)});var Q=class extends v{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==m.bigint){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.bigint,received:n.parsedType}),g}return P(e.data)}};u(Q,"ZodBigInt");Q.create=r=>{var e;return new Q({typeName:y.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};var Y=class extends v{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==m.boolean){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.boolean,received:n.parsedType}),g}return P(e.data)}};u(Y,"ZodBoolean");Y.create=r=>new Y({typeName:y.ZodBoolean,coerce:r?.coerce||!1,..._(r)});var z=class extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.date,received:o.parsedType}),g}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_date}),g}let n=new j,s;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):x.assertNever(o);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:w.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:w.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}};u(z,"ZodDate");z.create=r=>new z({checks:[],coerce:r?.coerce||!1,typeName:y.ZodDate,..._(r)});var de=class extends v{_parse(e){if(this._getType(e)!==m.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.symbol,received:n.parsedType}),g}return P(e.data)}};u(de,"ZodSymbol");de.create=r=>new de({typeName:y.ZodSymbol,..._(r)});var K=class extends v{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.undefined,received:n.parsedType}),g}return P(e.data)}};u(K,"ZodUndefined");K.create=r=>new K({typeName:y.ZodUndefined,..._(r)});var X=class extends v{_parse(e){if(this._getType(e)!==m.null){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.null,received:n.parsedType}),g}return P(e.data)}};u(X,"ZodNull");X.create=r=>new X({typeName:y.ZodNull,..._(r)});var F=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return P(e.data)}};u(F,"ZodAny");F.create=r=>new F({typeName:y.ZodAny,..._(r)});var W=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return P(e.data)}};u(W,"ZodUnknown");W.create=r=>new W({typeName:y.ZodUnknown,..._(r)});var L=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_type,expected:m.never,received:t.parsedType}),g}};u(L,"ZodNever");L.create=r=>new L({typeName:y.ZodNever,..._(r)});var pe=class extends v{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.void,received:n.parsedType}),g}return P(e.data)}};u(pe,"ZodVoid");pe.create=r=>new pe({typeName:y.ZodVoid,..._(r)});var N=class extends v{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return h(t,{code:f.invalid_type,expected:m.array,received:t.parsedType}),g;if(s.exactLength!==null){let c=t.data.length>s.exactLength.value,i=t.data.length<s.exactLength.value;(c||i)&&(h(t,{code:c?f.too_big:f.too_small,minimum:i?s.exactLength.value:void 0,maximum:c?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&&(h(t,{code:f.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&&(h(t,{code:f.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((c,i)=>s.type._parseAsync(new R(t,c,t.path,i)))).then(c=>j.mergeArray(n,c));let o=t.data.map((c,i)=>s.type._parseSync(new R(t,c,t.path,i)));return j.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new N({...this._def,minLength:{value:e,message:w.toString(t)}})}max(e,t){return new N({...this._def,maxLength:{value:e,message:w.toString(t)}})}length(e,t){return new N({...this._def,exactLength:{value:e,message:w.toString(t)}})}nonempty(e){return this.min(1,e)}};u(N,"ZodArray");N.create=(r,e)=>new N({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});var De;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(De||(De={}));var mt=u(r=>e=>new k({...r,shape:()=>({...r.shape(),...e})}),"AugmentFactory");function _e(r){if(r instanceof k){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=I.create(_e(n))}return new k({...r._def,shape:()=>e})}else return r instanceof N?N.create(_e(r.element)):r instanceof I?I.create(_e(r.unwrap())):r instanceof Z?Z.create(_e(r.unwrap())):r instanceof O?O.create(r.items.map(e=>_e(e))):r}u(_e,"deepPartialify");var k=class extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=mt(this._def),this.extend=mt(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.object){let d=this._getOrReturnCtx(e);return h(d,{code:f.invalid_type,expected:m.object,received:d.parsedType}),g}let{status:n,ctx:s}=this._processInputParams(e),{shape:o,keys:c}=this._getCached(),i=[];if(!(this._def.catchall instanceof L&&this._def.unknownKeys==="strip"))for(let d in s.data)c.includes(d)||i.push(d);let l=[];for(let d of c){let p=o[d],b=s.data[d];l.push({key:{status:"valid",value:d},value:p._parse(new R(s,b,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof L){let d=this._def.unknownKeys;if(d==="passthrough")for(let p of i)l.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(d==="strict")i.length>0&&(h(s,{code:f.unrecognized_keys,keys:i}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let p of i){let b=s.data[p];l.push({key:{status:"valid",value:p},value:d._parse(new R(s,b,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let p of l){let b=await p.key;d.push({key:b,value:await p.value,alwaysSet:p.alwaysSet})}return d}).then(d=>j.mergeObjectSync(n,d)):j.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,o,c,i;let l=(c=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,t,n).message)!==null&&c!==void 0?c:n.defaultError;return t.code==="unrecognized_keys"?{message:(i=w.errToObj(e).message)!==null&&i!==void 0?i:l}:{message:l}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>De.mergeShapes(this._def.shape(),e._def.shape()),typeName:y.ZodObject})}catchall(e){return new k({...this._def,catchall:e})}pick(e){let t={};return x.objectKeys(e).map(n=>{this.shape[n]&&(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}omit(e){let t={};return x.objectKeys(this.shape).map(n=>{x.objectKeys(e).indexOf(n)===-1&&(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}deepPartial(){return _e(this)}partial(e){let t={};if(e)return x.objectKeys(this.shape).map(n=>{x.objectKeys(e).indexOf(n)===-1?t[n]=this.shape[n]:t[n]=this.shape[n].optional()}),new k({...this._def,shape:()=>t});for(let n in this.shape){let s=this.shape[n];t[n]=s.optional()}return new k({...this._def,shape:()=>t})}required(e){let t={};if(e)x.objectKeys(this.shape).map(n=>{if(x.objectKeys(e).indexOf(n)===-1)t[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof I;)o=o._def.innerType;t[n]=o}});else for(let n in this.shape){let o=this.shape[n];for(;o instanceof I;)o=o._def.innerType;t[n]=o}return new k({...this._def,shape:()=>t})}keyof(){return vt(x.objectKeys(this.shape))}};u(k,"ZodObject");k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,..._(e)});k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:L.create(),typeName:y.ZodObject,..._(e)});k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,..._(e)});var ee=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let c=o.map(i=>new A(i.ctx.common.issues));return h(t,{code:f.invalid_union,unionErrors:c}),g}if(u(s,"handleResults"),t.common.async)return Promise.all(n.map(async o=>{let c={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:c}),ctx:c}})).then(s);{let o,c=[];for(let l of n){let d={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!o&&(o={result:p,ctx:d}),d.common.issues.length&&c.push(d.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let i=c.map(l=>new A(l));return h(t,{code:f.invalid_union,unionErrors:i}),g}}get options(){return this._def.options}};u(ee,"ZodUnion");ee.create=(r,e)=>new ee({options:r,typeName:y.ZodUnion,..._(e)});var Ve=u(r=>r instanceof ne?Ve(r.schema):r instanceof V?Ve(r.innerType()):r instanceof ae?[r.value]:r instanceof se?r.options:r instanceof ie?Object.keys(r.enum):r instanceof oe?Ve(r._def.innerType):r instanceof K?[void 0]:r instanceof X?[null]:null,"getDiscriminator"),fe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return h(t,{code:f.invalid_type,expected:m.object,received:t.parsedType}),g;let n=this.discriminator,s=t.data[n],o=this.optionsMap.get(s);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),g)}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 o of t){let c=Ve(o.shape[e]);if(!c)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of c){if(s.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,o)}}return new fe({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}};u(fe,"ZodDiscriminatedUnion");function Ye(r,e){let t=G(r),n=G(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&n===m.object){let s=x.objectKeys(e),o=x.objectKeys(r).filter(i=>s.indexOf(i)!==-1),c={...r,...e};for(let i of o){let l=Ye(r[i],e[i]);if(!l.valid)return{valid:!1};c[i]=l.data}return{valid:!0,data:c}}else if(t===m.array&&n===m.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let o=0;o<r.length;o++){let c=r[o],i=e[o],l=Ye(c,i);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===m.date&&n===m.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}u(Ye,"mergeValues");var te=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=u((o,c)=>{if(Ge(o)||Ge(c))return g;let i=Ye(o.value,c.value);return i.valid?((Qe(o)||Qe(c))&&t.dirty(),{status:t.value,value:i.data}):(h(n,{code:f.invalid_intersection_types}),g)},"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(([o,c])=>s(o,c)):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}))}};u(te,"ZodIntersection");te.create=(r,e,t)=>new te({left:r,right:e,typeName:y.ZodIntersection,..._(t)});var O=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return h(n,{code:f.invalid_type,expected:m.array,received:n.parsedType}),g;if(n.data.length<this._def.items.length)return h(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=n.data.map((c,i)=>{let l=this._def.items[i]||this._def.rest;return l?l._parse(new R(n,c,n.path,i)):null}).filter(c=>!!c);return n.common.async?Promise.all(o).then(c=>j.mergeArray(t,c)):j.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new O({...this._def,rest:e})}};u(O,"ZodTuple");O.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new O({items:r,typeName:y.ZodTuple,rest:null,..._(e)})};var re=class extends v{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!==m.object)return h(n,{code:f.invalid_type,expected:m.object,received:n.parsedType}),g;let s=[],o=this._def.keyType,c=this._def.valueType;for(let i in n.data)s.push({key:o._parse(new R(n,i,n.path,i)),value:c._parse(new R(n,n.data[i],n.path,i))});return n.common.async?j.mergeObjectAsync(t,s):j.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof v?new re({keyType:e,valueType:t,typeName:y.ZodRecord,..._(n)}):new re({keyType:D.create(),valueType:e,typeName:y.ZodRecord,..._(t)})}};u(re,"ZodRecord");var me=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return h(n,{code:f.invalid_type,expected:m.map,received:n.parsedType}),g;let s=this._def.keyType,o=this._def.valueType,c=[...n.data.entries()].map(([i,l],d)=>({key:s._parse(new R(n,i,n.path,[d,"key"])),value:o._parse(new R(n,l,n.path,[d,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let l of c){let d=await l.key,p=await l.value;if(d.status==="aborted"||p.status==="aborted")return g;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(d.value,p.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let l of c){let d=l.key,p=l.value;if(d.status==="aborted"||p.status==="aborted")return g;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(d.value,p.value)}return{status:t.value,value:i}}}};u(me,"ZodMap");me.create=(r,e,t)=>new me({valueType:e,keyType:r,typeName:y.ZodMap,..._(t)});var U=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return h(n,{code:f.invalid_type,expected:m.set,received:n.parsedType}),g;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(h(n,{code:f.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&&(h(n,{code:f.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let o=this._def.valueType;function c(l){let d=new Set;for(let p of l){if(p.status==="aborted")return g;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}u(c,"finalizeSet");let i=[...n.data.values()].map((l,d)=>o._parse(new R(n,l,n.path,d)));return n.common.async?Promise.all(i).then(l=>c(l)):c(i)}min(e,t){return new U({...this._def,minSize:{value:e,message:w.toString(t)}})}max(e,t){return new U({...this._def,maxSize:{value:e,message:w.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};u(U,"ZodSet");U.create=(r,e)=>new U({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});var J=class extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return h(t,{code:f.invalid_type,expected:m.function,received:t.parsedType}),g;function n(i,l){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Re(),Ce].filter(d=>!!d),issueData:{code:f.invalid_arguments,argumentsError:l}})}u(n,"makeArgsIssue");function s(i,l){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Re(),Ce].filter(d=>!!d),issueData:{code:f.invalid_return_type,returnTypeError:l}})}u(s,"makeReturnsIssue");let o={errorMap:t.common.contextualErrorMap},c=t.data;return this._def.returns instanceof H?P(async(...i)=>{let l=new A([]),d=await this._def.args.parseAsync(i,o).catch(C=>{throw l.addIssue(n(i,C)),l}),p=await c(...d);return await this._def.returns._def.type.parseAsync(p,o).catch(C=>{throw l.addIssue(s(p,C)),l})}):P((...i)=>{let l=this._def.args.safeParse(i,o);if(!l.success)throw new A([n(i,l.error)]);let d=c(...l.data),p=this._def.returns.safeParse(d,o);if(!p.success)throw new A([s(d,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new J({...this._def,args:O.create(e).rest(W.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||O.create([]).rest(W.create()),returns:t||W.create(),typeName:y.ZodFunction,..._(n)})}};u(J,"ZodFunction");var ne=class extends v{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})}};u(ne,"ZodLazy");ne.create=(r,e)=>new ne({getter:r,typeName:y.ZodLazy,..._(e)});var ae=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}};u(ae,"ZodLiteral");ae.create=(r,e)=>new ae({value:r,typeName:y.ZodLiteral,..._(e)});function vt(r,e){return new se({values:r,typeName:y.ZodEnum,..._(e)})}u(vt,"createZodEnum");var se=class extends v{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:x.joinValues(n),received:t.parsedType,code:f.invalid_type}),g}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:f.invalid_enum_value,options:n}),g}return P(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}};u(se,"ZodEnum");se.create=vt;var ie=class extends v{_parse(e){let t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){let s=x.objectValues(t);return h(n,{expected:x.joinValues(s),received:n.parsedType,code:f.invalid_type}),g}if(t.indexOf(e.data)===-1){let s=x.objectValues(t);return h(n,{received:n.data,code:f.invalid_enum_value,options:s}),g}return P(e.data)}get enum(){return this._def.values}};u(ie,"ZodNativeEnum");ie.create=(r,e)=>new ie({values:r,typeName:y.ZodNativeEnum,..._(e)});var H=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return h(t,{code:f.invalid_type,expected:m.promise,received:t.parsedType}),g;let n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return P(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};u(H,"ZodPromise");H.create=(r,e)=>new H({type:r,typeName:y.ZodPromise,..._(e)});var V=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.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 c=s.transform(n.data);return n.common.async?Promise.resolve(c).then(i=>this._def.schema._parseAsync({data:i,path:n.path,parent:n})):this._def.schema._parseSync({data:c,path:n.path,parent:n})}let o={addIssue:c=>{h(n,c),c.fatal?t.abort():t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="refinement"){let c=u(i=>{let l=s.refinement(i,o);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i},"executeRefinement");if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?g:(i.status==="dirty"&&t.dirty(),c(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?g:(i.status==="dirty"&&t.dirty(),c(i.value).then(()=>({status:t.value,value:i.value}))))}if(s.type==="transform")if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ie(c))return c;let i=s.transform(c.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>Ie(c)?Promise.resolve(s.transform(c.value,o)).then(i=>({status:t.value,value:i})):c);x.assertNever(s)}};u(V,"ZodEffects");V.create=(r,e,t)=>new V({schema:r,typeName:y.ZodEffects,effect:e,..._(t)});V.createWithPreprocess=(r,e,t)=>new V({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,..._(t)});var I=class extends v{_parse(e){return this._getType(e)===m.undefined?P(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u(I,"ZodOptional");I.create=(r,e)=>new I({innerType:r,typeName:y.ZodOptional,..._(e)});var Z=class extends v{_parse(e){return this._getType(e)===m.null?P(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u(Z,"ZodNullable");Z.create=(r,e)=>new Z({innerType:r,typeName:y.ZodNullable,..._(e)});var oe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};u(oe,"ZodDefault");oe.create=(r,e)=>new oe({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var he=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return Ae(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}};u(he,"ZodCatch");he.create=(r,e)=>new he({innerType:r,typeName:y.ZodCatch,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ye=class extends v{_parse(e){if(this._getType(e)!==m.nan){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.nan,received:n.parsedType}),g}return{status:"valid",value:e.data}}};u(ye,"ZodNaN");ye.create=r=>new ye({typeName:y.ZodNaN,..._(r)});var tr=Symbol("zod_brand"),xe=class extends v{_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}};u(xe,"ZodBranded");var ce=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return u(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?g:o.status==="dirty"?(t.dirty(),gt(o.value)):this._def.out._parseAsync({data:o.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"?g: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:y.ZodPipeline})}};u(ce,"ZodPipeline");var bt=u((r,e={},t)=>r?F.create().superRefine((n,s)=>{if(!r(n)){let o=typeof e=="function"?e(n):e,c=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...c,fatal:t})}}):F.create(),"custom"),rr={object:k.lazycreate},y;(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"})(y||(y={}));var nr=u((r,e={message:`Input not instance of ${r.name}`})=>bt(t=>t instanceof r,e,!0),"instanceOfType"),_t=D.create,wt=M.create,ar=ye.create,sr=Q.create,xt=Y.create,ir=z.create,or=de.create,cr=K.create,lr=X.create,ur=F.create,dr=W.create,pr=L.create,fr=pe.create,mr=N.create,hr=k.create,yr=k.strictCreate,gr=ee.create,vr=fe.create,br=te.create,_r=O.create,wr=re.create,xr=me.create,Cr=U.create,kr=J.create,Tr=ne.create,Er=ae.create,jr=se.create,Pr=ie.create,Sr=H.create,ht=V.create,Nr=I.create,Vr=Z.create,Rr=V.createWithPreprocess,Or=ce.create,Ir=u(()=>_t().optional(),"ostring"),Ar=u(()=>wt().optional(),"onumber"),Dr=u(()=>xt().optional(),"oboolean"),Lr={string:r=>D.create({...r,coerce:!0}),number:r=>M.create({...r,coerce:!0}),boolean:r=>Y.create({...r,coerce:!0}),bigint:r=>Q.create({...r,coerce:!0}),date:r=>z.create({...r,coerce:!0})},qr=g,a=Object.freeze({__proto__:null,defaultErrorMap:Ce,setErrorMap:Ht,getErrorMap:Re,makeIssue:Oe,EMPTY_PATH:Gt,addIssueToContext:h,ParseStatus:j,INVALID:g,DIRTY:gt,OK:P,isAborted:Ge,isDirty:Qe,isValid:Ie,isAsync:Ae,get util(){return x},ZodParsedType:m,getParsedType:G,ZodType:v,ZodString:D,ZodNumber:M,ZodBigInt:Q,ZodBoolean:Y,ZodDate:z,ZodSymbol:de,ZodUndefined:K,ZodNull:X,ZodAny:F,ZodUnknown:W,ZodNever:L,ZodVoid:pe,ZodArray:N,get objectUtil(){return De},ZodObject:k,ZodUnion:ee,ZodDiscriminatedUnion:fe,ZodIntersection:te,ZodTuple:O,ZodRecord:re,ZodMap:me,ZodSet:U,ZodFunction:J,ZodLazy:ne,ZodLiteral:ae,ZodEnum:se,ZodNativeEnum:ie,ZodPromise:H,ZodEffects:V,ZodTransformer:V,ZodOptional:I,ZodNullable:Z,ZodDefault:oe,ZodCatch:he,ZodNaN:ye,BRAND:tr,ZodBranded:xe,ZodPipeline:ce,custom:bt,Schema:v,ZodSchema:v,late:rr,get ZodFirstPartyTypeKind(){return y},coerce:Lr,any:ur,array:mr,bigint:sr,boolean:xt,date:ir,discriminatedUnion:vr,effect:ht,enum:jr,function:kr,instanceof:nr,intersection:br,lazy:Tr,literal:Er,map:xr,nan:ar,nativeEnum:Pr,never:pr,null:lr,nullable:Vr,number:wt,object:hr,oboolean:Dr,onumber:Ar,optional:Nr,ostring:Ir,pipeline:Or,preprocess:Rr,promise:Sr,record:wr,set:Cr,strictObject:yr,string:_t,symbol:or,transformer:ht,tuple:_r,undefined:cr,union:gr,unknown:dr,void:fr,NEVER:qr,ZodIssueCode:f,quotelessJson:Jt,ZodError:A});var kt=a.array(a.string().or(a.record(a.any()))),wa=a.object({type:a.string().optional(),narrative:a.string().optional()}),Le=a.string().or(a.object({id:a.string(),type:a.string(),caption:a.string().optional()})),Mr=a.object({type:a.string().min(1).or(a.string().array().nonempty()),latitude:a.number(),longitude:a.number()}),Br=a.object({type:a.string().min(1).or(a.string().array().nonempty()),addressCountry:a.string().optional(),addressCountryCode:a.string().optional(),addressRegion:a.string().optional(),addressLocality:a.string().optional(),streetAddress:a.string().optional(),postOfficeBoxNumber:a.string().optional(),postalCode:a.string().optional(),geo:Mr.optional()}),$r=a.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(a.string()),Tt=a.object({type:a.string().min(1).or(a.string().array().nonempty()),identifier:a.string(),identifierType:$r}),ke=a.string().or(a.object({id:a.string().optional(),type:a.string().or(a.string().array().nonempty().optional()),name:a.string().optional(),url:a.string().optional(),phone:a.string().optional(),description:a.string().optional(),endorsement:a.any().array().optional(),image:Le.optional(),email:a.string().email().optional(),address:Br.optional(),otherIdentifier:Tt.array().optional(),official:a.string().optional(),parentOrg:a.any().optional(),familyName:a.string().optional(),givenName:a.string().optional(),additionalName:a.string().optional(),patronymicName:a.string().optional(),honorificPrefix:a.string().optional(),honorificSuffix:a.string().optional(),familyNamePrefix:a.string().optional(),dateOfBirth:a.string().optional()}).catchall(a.any())),Ke=a.object({id:a.string().optional()}).catchall(a.any()),zr=a.object({type:a.string(),id:a.string()}).catchall(a.any()),Wr=a.object({id:a.string(),type:a.string()}).catchall(a.any()),Ur=a.object({id:a.string(),type:a.string()}).catchall(a.any()),ge=a.object({"@context":kt,id:a.string().optional(),type:a.string().array().nonempty(),issuer:ke,issuanceDate:a.string(),expirationDate:a.string().optional(),credentialSubject:Ke.or(Ke.array()),credentialStatus:zr.optional(),credentialSchema:Wr.array().optional(),refreshService:Ur.optional()}).catchall(a.any()),le=a.object({type:a.string(),created:a.string(),challenge:a.string().optional(),domain:a.string().optional(),nonce:a.string().optional(),proofPurpose:a.string(),verificationMethod:a.string(),jws:a.string().optional()}).catchall(a.any()),Te=ge.extend({proof:le.or(le.array())}),Zr=a.object({"@context":kt,id:a.string().optional(),type:a.string().or(a.string().array().nonempty()),verifiableCredential:Te.or(Te.array()).optional(),holder:a.string().optional()}).catchall(a.any()),et=Zr.extend({proof:le.or(le.array())}),Fr=a.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(a.string()),qe=a.object({type:a.string().array().nonempty(),targetCode:a.string().optional(),targetDescription:a.string().optional(),targetName:a.string(),targetFramework:a.string().optional(),targetType:Fr.optional(),targetUrl:a.string()}),Jr=a.enum(["Achievement","ApprenticeshipCertificate","Assessment","Assignment","AssociateDegree","Award","Badge","BachelorDegree","Certificate","CertificateOfCompletion","Certification","CommunityService","Competency","Course","CoCurricular","Degree","Diploma","DoctoralDegree","Fieldwork","GeneralEducationDevelopment","JourneymanCertificate","LearningProgram","License","Membership","ProfessionalDoctorate","QualityAssuranceCredential","MasterCertificate","MasterDegree","MicroCredential","ResearchDoctorate","SecondarySchoolDiploma"]),Hr=Jr.or(a.string()),Gr=a.object({id:a.string().optional(),narrative:a.string().optional()}).catchall(a.any()),Qr=a.object({id:a.string(),type:a.string().array().nonempty(),endorsementComment:a.string().optional()}),Yr=ge.extend({credentialSubject:Qr,proof:le.or(le.array()).optional()}),Kr=a.object({id:a.string(),"@language":a.string().optional(),version:a.string().optional()}),Xr=a.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(a.string()),en=a.object({id:a.string(),type:a.string().array().nonempty(),alignment:qe.array().optional(),description:a.string().optional(),level:a.string().optional(),name:a.string(),points:a.string().optional()}).catchall(a.any()),tn=a.object({id:a.string(),type:a.string().array().nonempty(),alignment:qe.array().optional(),allowedValue:a.string().array().optional(),name:a.string(),requiredLevel:a.string().optional(),requiredValue:a.string().optional(),resultType:Xr,rubricCriterionLevel:en.array().optional(),valueMax:a.string().optional(),valueMin:a.string().optional()}).catchall(a.any()),rn=a.object({id:a.string().optional(),type:a.string().array().nonempty(),alignment:qe.array().optional(),achievementType:Hr.optional(),creator:ke.optional(),creditsAvailable:a.number().optional(),criteria:Gr,description:a.string(),endorsement:Yr.array().optional(),fieldOfStudy:a.string().optional(),humanCode:a.string().optional(),image:Le.optional(),"@language":a.string().optional(),name:a.string(),otherIdentifier:Tt.array().optional(),related:Kr.array().optional(),resultDescription:tn.array().optional(),specialization:a.string().optional(),tag:a.string().array().optional(),version:a.string().optional()}).catchall(a.any()),nn=a.object({type:a.string(),hashed:a.boolean(),identityHash:a.string(),identityType:a.string(),salt:a.string().optional()}),an=a.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),sn=a.object({type:a.string().array().nonempty(),achievedLevel:a.string().optional(),alignment:qe.array().optional(),resultDescription:a.string().optional(),status:an.optional(),value:a.string().optional()}).catchall(a.any()),Ct=a.object({id:a.string().optional(),type:a.string().array().nonempty(),activityEndDate:a.string().optional(),activityStartDate:a.string().optional(),creditsEarned:a.number().optional(),achievement:rn.optional(),identifier:nn.array().optional(),image:Le.optional(),licenseNumber:a.string().optional(),narrative:a.string().optional(),result:sn.array().optional(),role:a.string().optional(),source:ke.optional(),term:a.string().optional()}).catchall(a.any()),on=a.object({id:a.string().optional(),type:a.string().array().nonempty(),narrative:a.string().optional(),name:a.string().optional(),description:a.string().optional(),genre:a.string().optional(),audience:a.string().optional()}).catchall(a.any()),cn=ge.extend({name:a.string().optional(),description:a.string().optional(),image:Le.optional(),credentialSubject:Ct.or(Ct.array()),endorsement:ge.array().optional(),evidence:on.array().optional()}),Ca=cn.extend({proof:le.or(le.array())}),Ta=a.object({checks:a.string().array(),warnings:a.string().array(),errors:a.string().array()}),Et=a.enum(["Success","Failed","Error"]),Ea=Et.enum,ja=a.object({check:a.string(),status:Et,message:a.string().optional(),details:a.string().optional()}),Pa=a.object({title:a.string().optional(),createdAt:a.string().optional(),issuer:ke.optional(),issuee:ke.optional(),credentialSubject:Ke.optional()}),Sa=a.object({id:a.string(),uri:a.string()}).catchall(a.any()),Ra=a.object({limit:a.number(),cursor:a.string().optional()}),ve=a.object({cursor:a.string().optional(),hasMore:a.boolean()}),ln=a.object({kty:a.string(),crv:a.string(),x:a.string(),y:a.string().optional(),n:a.string().optional(),d:a.string()}),un=a.object({alg:a.string(),iv:a.string(),tag:a.string(),epk:ln.partial().optional(),kid:a.string().optional(),apv:a.string().optional(),apu:a.string().optional()}),dn=a.object({header:un,encrypted_key:a.string()}),tt=a.object({protected:a.string(),iv:a.string(),ciphertext:a.string(),tag:a.string(),aad:a.string().optional(),recipients:dn.array().optional()}),jt=a.object({encryptedRecord:tt,fields:a.string().array()}).catchall(a.any()),Ia=ve.extend({records:jt.array()}),pn=jt.extend({id:a.string()}),Aa=ve.extend({records:pn.array()}),we=a.object({profileId:a.string().min(3).max(40),displayName:a.string().default(""),bio:a.string().default(""),did:a.string(),email:a.string().optional(),image:a.string().optional(),isServiceProfile:a.boolean().default(!1).optional(),notificationsWebhook:a.string().url().startsWith("https://").optional()}),La=ve.extend({records:we.array()}),qa=a.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),Ma=a.object({uri:a.string(),to:a.string(),from:a.string(),sent:a.string().datetime(),received:a.string().datetime().optional()}),fn=a.enum(["DRAFT","LIVE"]),Ba=a.object({uri:a.string(),name:a.string().optional(),type:a.string().optional(),category:a.string().optional(),status:fn.optional(),autoConnectRecipients:a.boolean().optional()}),$a=a.object({to:we,from:a.string(),received:a.string().optional()}),mn=a.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED"]),hn=a.object({title:a.string().optional(),body:a.string().optional()}),yn=a.object({vcUris:a.array(a.string()).optional(),vpUris:a.array(a.string()).optional()}),za=a.object({type:mn,to:we.partial().and(a.object({did:a.string()})),from:we.partial().and(a.object({did:a.string()})),message:hn.optional(),data:yn.optional(),sent:a.string().datetime().optional()}),Wa=a.object({endpoint:a.string(),name:a.string(),did:a.string().optional()}),Ua=a.object({ttlSeconds:a.number().optional(),totalUses:a.number().optional()}),gn=a.object({endpoint:a.string()}),Za=a.object({signingAuthority:gn,relationship:a.object({name:a.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:a.string()})}),vn=a.enum(["live","stale","withdrawn"]),rt=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({categories:a.record(a.object({required:a.boolean()})).default({})}).default({}),personal:a.record(a.object({required:a.boolean()})).default({})}).default({}),write:a.object({credentials:a.object({categories:a.record(a.object({required:a.boolean()})).default({})}).default({}),personal:a.record(a.object({required:a.boolean()})).default({})}).default({})}),Pt=a.object({contract:rt,owner:we,name:a.string(),subtitle:a.string().optional(),description:a.string().optional(),reasonForAccessing:a.string().optional(),image:a.string().optional(),uri:a.string(),createdAt:a.string(),updatedAt:a.string(),expiresAt:a.string().optional()}),Fa=ve.extend({records:Pt.omit({owner:!0}).array()}),bn=a.object({credentials:a.object({categories:a.record(a.string().array()).default({})}),personal:a.record(a.string()).default({}),date:a.string()}),Ja=ve.extend({records:bn.array()}),Me=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({shareAll:a.boolean().optional(),sharing:a.boolean().optional(),categories:a.record(a.object({sharing:a.boolean().optional(),shared:a.string().array().optional(),shareAll:a.boolean().optional()})).default({})}).default({}),personal:a.record(a.string()).default({})}).default({}),write:a.object({credentials:a.object({categories:a.record(a.boolean()).default({})}).default({}),personal:a.record(a.boolean()).default({})}).default({})}),Ha=ve.extend({records:a.object({expiresAt:a.string().optional(),oneTime:a.boolean().optional(),terms:Me,contract:Pt,uri:a.string(),consenter:we,status:vn}).array()}),Ga=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({categories:a.record(a.object({required:a.boolean().optional()})).optional()}).optional(),personal:a.record(a.object({required:a.boolean().optional()})).optional()}).optional(),write:a.object({credentials:a.object({categories:a.record(a.object({required:a.boolean().optional()})).optional()}).optional(),personal:a.record(a.object({required:a.boolean().optional()})).optional()}).optional()}),_n=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({shareAll:a.boolean().optional(),sharing:a.boolean().optional(),categories:a.record(a.object({sharing:a.boolean().optional(),shared:a.string().array().optional(),shareAll:a.boolean().optional()}).optional()).optional()}).optional(),personal:a.record(a.string()).optional()}).optional(),write:a.object({credentials:a.object({categories:a.record(a.boolean()).optional()}).optional(),personal:a.record(a.boolean()).optional()}).optional()}),Xe=a.enum(["consent","update","sync","withdraw"]),Qa=a.object({terms:_n.optional(),action:Xe.or(Xe.array()).optional(),date:a.object({$gt:a.string()}).or(a.object({$lt:a.string()})).or(a.object({$eq:a.string()})).optional(),expiresAt:a.object({$gt:a.string()}).or(a.object({$lt:a.string()})).or(a.object({$eq:a.string()})).optional(),oneTime:a.boolean().optional()}),wn=a.object({expiresAt:a.string().optional(),oneTime:a.boolean().optional(),terms:Me.optional(),id:a.string(),action:Xe,date:a.string()}),Ya=ve.extend({records:wn.array()});var xn=u(async(r,e)=>{let t=r.id.did();r?.debug?.("Adding LearnCardNetwork Plugin");let n=await pt(e,async c=>{let i=await r.invoke.getDidAuthVp({proofFormat:"jwt",challenge:c});if(typeof i!="string")throw new Error("Error getting DID-Auth-JWT!");return i}),s;try{s=await n.profile.getProfile.query()}catch(c){r.debug?.("No profile!",c)}let o=s?.did||t;return{name:"LearnCard Network",displayName:"LearnCard Network",description:"LearnCard Network Integration",id:{did:(c,i)=>!i||i==="web"?o:r.id.did(i),keypair:(c,i)=>r.id.keypair(i)},read:{get:async(c,i)=>{if(c.debug?.("learnCard.read['LearnCard Network'].get"),!i)return;let l=i.split(":");if(l.length!==5)return;let[d,p]=l;if(!(d!=="lc"||p!=="network"))try{let b=await n.storage.resolve.query({uri:i});return"ciphertext"in b&&(b=await c.invoke.getDIDObject().decryptDagJWE(b)),await Te.or(et).parseAsync(b)}catch(b){c.debug?.(b);return}}},store:{upload:async(c,i)=>(c.debug?.("learnCard.store['LearnCard Network'].upload"),n.storage.store.mutate({item:i})),uploadEncrypted:async(c,i,{recipients:l=[]}={recipients:[]})=>{c.debug?.("learnCard.store['LearnCard Network'].upload");let d=await c.invoke.getDIDObject().createDagJWE(i,[c.id.did(),...l]);return n.storage.store.mutate({item:d})}},methods:{createProfile:async(c,i)=>{if(s)throw new Error("Account already exists!");let l=await n.profile.createProfile.mutate(i);return s=await n.profile.getProfile.query(),o=l,l},createServiceProfile:async(c,i)=>{if(s)throw new Error("Account already exists!");let l=await n.profile.createServiceProfile.mutate(i);return s=await n.profile.getProfile.query(),o=l,l},updateProfile:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return await n.profile.updateProfile.mutate(i)?(s=await n.profile.getProfile.query(),!0):!1},deleteProfile:async()=>{if(!s)throw new Error("Account does not exist!");return await n.profile.deleteProfile.mutate()?(s=void 0,!0):!1},getProfile:async(c,i)=>i?n.profile.getOtherProfile.query({profileId:i}):n.profile.getProfile.query(),searchProfiles:async(c,i="",{limit:l=25,includeSelf:d=!1,includeConnectionStatus:p=!1,includeServiceProfiles:b=!1}={})=>n.profile.searchProfiles.query({input:i,limit:l,includeSelf:d,includeConnectionStatus:p,includeServiceProfiles:b}),connectWith:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectWith.mutate({profileId:i})},cancelConnectionRequest:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.cancelConnectionRequest.mutate({profileId:i})},connectWithInvite:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectWithInvite.mutate({profileId:i,challenge:l})},disconnectWith:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.disconnectWith.mutate({profileId:i})},acceptConnectionRequest:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.acceptConnectionRequest.mutate({profileId:i})},getConnections:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.connections.query()},getPendingConnections:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.pendingConnections.query()},getConnectionRequests:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectionRequests.query()},generateInvite:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.generateInvite.mutate({challenge:i,expiration:l})},blockProfile:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.blockProfile.mutate({profileId:i})},unblockProfile:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.unblockProfile.mutate({profileId:i})},getBlockedProfiles:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.blocked.query()},sendCredential:async(c,i,l,d=!0)=>{if(!s)throw new Error("Please make an account first!");if(!d)return n.credential.sendCredential.mutate({profileId:i,credential:l});let p=await c.invoke.getProfile(i);if(!p)throw new Error("Could not find target account");let b=await c.invoke.getDIDObject().createDagJWE(l,[s.did,p.did]);return n.credential.sendCredential.mutate({profileId:i,credential:b})},acceptCredential:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.acceptCredential.mutate({uri:i})},getReceivedCredentials:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.receivedCredentials.query({from:i})},getSentCredentials:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.sentCredentials.query({to:i})},getIncomingCredentials:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.incomingCredentials.query({from:i})},deleteCredential:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.deleteCredential.mutate({uri:i})},sendPresentation:async(c,i,l,d=!0)=>{if(!s)throw new Error("Please make an account first!");if(!d)return n.presentation.sendPresentation.mutate({profileId:i,presentation:l});let p=await c.invoke.getProfile(i);if(!p)throw new Error("Could not find target account");let b=await c.invoke.getDIDObject().createDagJWE(l,[s.did,p.did]);return n.presentation.sendPresentation.mutate({profileId:i,presentation:b})},acceptPresentation:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.acceptPresentation.mutate({uri:i})},getReceivedPresentations:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.receivedPresentations.query({from:i})},getSentPresentations:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.sentPresentations.query({to:i})},getIncomingPresentations:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.incomingPresentations.query({from:i})},deletePresentation:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.deletePresentation.mutate({uri:i})},createBoost:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.createBoost.mutate({credential:i,...l})},getBoost:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoost.query({uri:i})},getBoosts:async()=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoosts.query()},getBoostRecipients:async(c,i,l=25,d=void 0,p=!0)=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoostRecipients.query({uri:i,limit:l,skip:d,includeUnacceptedBoosts:p})},updateBoost:async(c,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.boost.updateBoost.mutate({uri:i,updates:{credential:d,...l}})},getBoostAdmins:async(c,i,l={})=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoostAdmins.query({uri:i,...l})},addBoostAdmin:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.addBoostAdmin.mutate({uri:i,profileId:l})},removeBoostAdmin:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.removeBoostAdmin.mutate({uri:i,profileId:l})},deleteBoost:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.boost.deleteBoost.mutate({uri:i})},sendBoost:async(c,i,l,d=!0)=>{if(!s)throw new Error("Please make an account first!");let p=await c.invoke.resolveFromLCN(l),b=await ge.spa(p);if(!b.success)throw new Error("Did not get a valid boost from URI");let C=await c.invoke.getProfile(i);if(!C)throw new Error("Target profile not found");let T=b.data;T.issuanceDate=new Date().toISOString(),T.issuer=c.id.did(),Array.isArray(T.credentialSubject)?T.credentialSubject=T.credentialSubject.map(B=>({...B,id:C.did})):T.credentialSubject.id=C.did,T?.type?.includes("BoostCredential")&&(T.boostId=l);let S=await c.invoke.issueCredential(T);if(!d)return n.boost.sendBoost.mutate({profileId:i,uri:l,credential:S});let q=await n.utilities.getDid.query(),ue=await c.invoke.getDIDObject().createDagJWE(S,[s.did,C.did,q]);return n.boost.sendBoost.mutate({profileId:i,uri:l,credential:ue})},registerSigningAuthority:async(c,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.profile.registerSigningAuthority.mutate({endpoint:i,name:l,did:d})},getRegisteredSigningAuthorities:async(c,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.profile.signingAuthorities.query()},getRegisteredSigningAuthority:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.signingAuthority.query({endpoint:i,name:l})},generateClaimLink:async(c,i,l,d,p)=>{if(!s)throw new Error("Please make an account first!");return n.boost.generateClaimLink.mutate({boostUri:i,claimLinkSA:l,options:d,challenge:p})},claimBoostWithLink:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.claimBoostWithLink.mutate({boostUri:i,challenge:l})},createContract:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.createConsentFlowContract.mutate(i)},getContract:async(c,i)=>n.contracts.getConsentFlowContract.query({uri:i}),getContracts:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentFlowContracts.query(i)},deleteContract:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.deleteConsentFlowContract.mutate({uri:i})},getConsentFlowData:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentedDataForContract.query({uri:i,...l})},consentToContract:async(c,i,{terms:l,expiresAt:d,oneTime:p})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.consentToContract.mutate({contractUri:i,terms:l,expiresAt:d,oneTime:p})},getConsentedContracts:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentedContracts.query(i)},updateContractTerms:async(c,i,{terms:l,expiresAt:d,oneTime:p})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.updateConsentedContractTerms.mutate({uri:i,terms:l,expiresAt:d,oneTime:p})},withdrawConsent:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.withdrawConsent.mutate({uri:i})},getConsentFlowTransactions:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getTermsTransactionHistory.query({uri:i,...l})},verifyConsent:async(c,i,l)=>n.contracts.verifyConsent.query({uri:i,profileId:l}),resolveFromLCN:async(c,i)=>{let l=await n.storage.resolve.query({uri:i});return ge.or(Te).or(et).or(tt).or(rt).or(Me).parseAsync(l)}}}},"getLearnCardNetworkPlugin"),Cn=u(async(r,e)=>{let t=[{id:"LearnCard Network",url:"https://network.learncard.com",did:"did:web:network.learncard.com"}],n;if(e){let c=await fetch(e);c.status===200?n=JSON.parse(await c.text()):n=t}else n=t;let s=u(c=>{if(!!c)return typeof c=="string"?c:"id"in c&&typeof c.id=="string"?c.id:void 0},"getIssuerDID"),o=u(c=>{let i=s(c);if(!!i)return n.find(l=>l.did===i)},"getTrustedBoostVerifier");return{name:"VerifyBoost",displayName:"Verify Boost Extension",description:"Adds a check for validating Boost Credentials.",methods:{verifyCredential:async(c,i,l)=>{let d=await r.invoke.verifyCredential(i,l),p=i?.boostCredential;try{if(p){let b=await r.invoke.verifyCredential(p);if(!p?.boostId&&!i?.boostId&&d.warnings.push("Boost Authenticity could not be verified: Boost ID metadata is missing."),b.errors?.length>0)d.errors=[...b.errors||[],...d.errors||[],"Boost Credential could not be verified."];else if(p?.boostId!==i?.boostId)d.errors.push("Boost Authenticity could not be verified: Boost ID metadata is mismatched.");else{let C=o(i?.issuer);C?d.checks.push(`Boost is Authentic. Verified by ${C.id}.`):d.warnings.push(`Boost Authenticity could not be verified. Issuer is outside of trust network: ${s(i?.issuer)}`)}}}catch{d.errors.push("Boost authenticity could not be verified.")}return d}}}},"getVerifyBoostPlugin");
1
+ var Ee=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Rt=Object.prototype.hasOwnProperty;var u=(r,e)=>Ee(r,"name",{value:e,configurable:!0});var Ot=(r,e)=>{for(var t in e)Ee(r,t,{get:e[t],enumerable:!0})},It=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Vt(e))!Rt.call(r,s)&&s!==t&&Ee(r,s,{get:()=>e[s],enumerable:!(n=Nt(e,s))||n.enumerable});return r};var At=r=>It(Ee({},"__esModule",{value:!0}),r);var kn={};Ot(kn,{getLearnCardNetworkPlugin:()=>xn,getVerifyBoostPlugin:()=>Cn});module.exports=At(kn);function Dt(r){return r}u(Dt,"identity");function Lt(r){return r.length===0?Dt:r.length===1?r[0]:u(function(t){return r.reduce((n,s)=>s(n),t)},"piped")}u(Lt,"pipeFromArray");function $(r){let e={subscribe(t){let n=null,s=!1,o=!1,c=!1;function i(){if(n===null){c=!0;return}o||(o=!0,typeof n=="function"?n():n&&n.unsubscribe())}return u(i,"unsubscribe"),n=r({next(l){s||t.next?.(l)},error(l){s||(s=!0,t.error?.(l),i())},complete(){s||(s=!0,t.complete?.(),i())}}),c&&i(),{unsubscribe:i}},pipe(...t){return Lt(t)(e)}};return e}u($,"observable");function nt(r){return e=>{let t=0,n=null,s=[];function o(){n||(n=e.subscribe({next(i){for(let l of s)l.next?.(i)},error(i){for(let l of s)l.error?.(i)},complete(){for(let i of s)i.complete?.()}}))}u(o,"startIfNeeded");function c(){if(t===0&&n){let i=n;n=null,i.unsubscribe()}}return u(c,"resetIfNeeded"),{subscribe(i){return t++,s.push(i),o(),{unsubscribe(){t--,c();let l=s.findIndex(d=>d===i);l>-1&&s.splice(l,1)}}}}}}u(nt,"share");var be=class extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,be.prototype)}};u(be,"ObservableAbortError");function at(r){let e;return{promise:new Promise((n,s)=>{let o=!1;function c(){o||(o=!0,s(new be("This operation was aborted.")),i.unsubscribe())}u(c,"onDone");let i=r.subscribe({next(l){o=!0,n(l),c()},error(l){o=!0,s(l),c()},complete(){o=!0,c()}});e=c}),abort:e}}u(at,"observableToPromise");var E=class extends Error{static from(e,t={}){return e instanceof Error?e.name==="TRPCClientError"?e:new E(e.message,{...t,cause:e,result:null}):new E(e.error.message??"",{...t,cause:void 0,result:e})}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,E.prototype)}};u(E,"TRPCClientError");function qt(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}}u(qt,"transformResultInner");function st(r){return!!r&&!Array.isArray(r)&&typeof r=="object"}u(st,"isObject");function je(r,e){let t;try{t=qt(r,e)}catch{throw new E("Unable to transform response from server")}if(!t.ok&&(!st(t.error.error)||typeof t.error.error.code!="number"))throw new E("Badly formatted response from server");if(t.ok&&!st(t.result))throw new E("Badly formatted response from server");return t}u(je,"transformResult");function it(r){return $(e=>{function t(s=0,o=r.op){let c=r.links[s];if(!c)throw new Error("No more links to execute - did you forget to add an ending link?");return c({op:o,next(l){return t(s+1,l)}})}return u(t,"execute"),t().subscribe(e)})}u(it,"createChain");var ot=u(()=>{},"noop");function ct(r,e){return new Proxy(ot,{get(n,s){if(!(typeof s!="string"||s==="then"))return ct(r,[...e,s])},apply(n,s,o){return r({args:o,path:e})}})}u(ct,"createInnerProxy");var Be=u(r=>ct(r,[]),"createRecursiveProxy"),$e=u(r=>new Proxy(ot,{get(e,t){if(!(typeof t!="string"||t==="then"))return r(t)}}),"createFlatProxy");var ze=u(r=>typeof r=="function","isFunction");function lt(r,e){return ze(r.bind)?r.bind(e):r}u(lt,"_bind");function ut(r){if(r)return r;if(typeof window<"u"&&ze(window.fetch))return lt(window.fetch,window);if(typeof globalThis<"u"&&ze(globalThis.fetch))return lt(globalThis.fetch,globalThis);throw new Error("No fetch implementation found")}u(ut,"getFetch");function Mt(r){return r||(typeof window<"u"&&window.AbortController?window.AbortController:typeof globalThis<"u"&&globalThis.AbortController?globalThis.AbortController:null)}u(Mt,"getAbortController");function We(r){let e=r.headers||(()=>({}));return{url:r.url,fetch:ut(r.fetch),AbortController:Mt(r.AbortController),headers:typeof e=="function"?e:()=>e}}u(We,"resolveHTTPLinkOptions");function Bt(r){let e={};for(let t=0;t<r.length;t++){let n=r[t];e[t]=n}return e}u(Bt,"arrayToDict");var $t={query:"GET",mutation:"POST"};function dt(r){return"input"in r?r.runtime.transformer.serialize(r.input):Bt(r.inputs.map(e=>r.runtime.transformer.serialize(e)))}u(dt,"getInput");function Ue(r){let e=r.url+"/"+r.path,t=[];if("inputs"in r&&t.push("batch=1"),r.type==="query"){let n=dt(r);n!==void 0&&t.push(`input=${encodeURIComponent(JSON.stringify(n))}`)}return t.length&&(e+="?"+t.join("&")),e}u(Ue,"getUrl");function zt(r){if(r.type==="query")return;let e=dt(r);return e!==void 0?JSON.stringify(e):void 0}u(zt,"getBody");function Ze(r){let{type:e}=r,t=r.AbortController?new r.AbortController:null;return{promise:new Promise((o,c)=>{let i=Ue(r),l=zt(r),d={};Promise.resolve(r.headers()).then(p=>{if(e==="subscription")throw new Error("Subscriptions should use wsLink");return r.fetch(i,{method:$t[e],signal:t?.signal,body:l,headers:{"content-type":"application/json",...p}})}).then(p=>(d.response=p,p.json())).then(p=>{o({json:p,meta:d})}).catch(c)}),cancel:u(()=>{t?.abort()},"cancel")}}u(Ze,"httpRequest");var Fe=u(()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")},"throwFatalError");function Je(r){let e=null,t=null,n=u(()=>{clearTimeout(t),t=null,e=null},"destroyTimerAndPendingItems");function s(i){let l=[[]],d=0;for(;;){let p=i[d];if(!p)break;let b=l[l.length-1];if(p.aborted){p.reject(new Error("Aborted")),d++;continue}if(r.validate(b.concat(p).map(T=>T.key))){b.push(p),d++;continue}if(b.length===0){p.reject(new Error("Input is too big for a single dispatch")),d++;continue}l.push([])}return l}u(s,"groupItems");function o(){let i=s(e);n();for(let l of i){if(!l.length)continue;let d={items:l,cancel:Fe};for(let C of l)C.batch=d;let{promise:p,cancel:b}=r.fetch(d.items.map(C=>C.key));d.cancel=b,p.then(C=>{for(let T=0;T<C.length;T++){let S=C[T],q=d.items[T];q.resolve(S),q.batch=null}}).catch(C=>{for(let T of d.items)T.reject(C),T.batch=null})}}u(o,"dispatch");function c(i){let l={aborted:!1,key:i,batch:null,resolve:Fe,reject:Fe},d=new Promise((b,C)=>{l.reject=C,l.resolve=b,e||(e=[]),e.push(l)});return t||(t=setTimeout(o)),{promise:d,cancel:u(()=>{l.aborted=!0,l.batch?.items.every(b=>b.aborted)&&(l.batch.cancel(),l.batch=null)},"cancel")}}return u(c,"load"),{load:c}}u(Je,"dataLoader");function Pe(r){let e=We(r);return t=>{let n=r.maxURLLength||1/0,s=u(d=>({validate:u(C=>{if(n===1/0)return!0;let T=C.map(ue=>ue.path).join(","),S=C.map(ue=>ue.input);return Ue({...e,runtime:t,type:d,path:T,inputs:S}).length<=n},"validate"),fetch:u(C=>{let T=C.map(B=>B.path).join(","),S=C.map(B=>B.input),{promise:q,cancel:ue}=Ze({...e,runtime:t,type:d,path:T,inputs:S});return{promise:q.then(B=>(Array.isArray(B.json)?B.json:C.map(()=>B.json)).map(St=>({meta:B.meta,json:St}))),cancel:ue}},"fetch")}),"batchLoader"),o=Je(s("query")),c=Je(s("mutation")),i=Je(s("subscription")),l={query:o,subscription:i,mutation:c};return({op:d})=>$(p=>{let b=l[d.type],{promise:C,cancel:T}=b.load(d);return C.then(S=>{let q=je(S.json,t);if(!q.ok){p.error(E.from(q.error,{meta:S.meta}));return}p.next({context:S.meta,result:q.result}),p.complete()}).catch(S=>p.error(E.from(S))),()=>{T()}})}}u(Pe,"httpBatchLink");var Se=class{$request({type:e,input:t,path:n,context:s={}}){return it({links:this.links,op:{id:++this.requestId,type:e,path:n,input:t,context:s}}).pipe(nt())}requestAsPromise(e){let t=this.$request(e),{promise:n,abort:s}=at(t);return new Promise((c,i)=>{e.signal?.addEventListener("abort",s),n.then(l=>{c(l.result.data)}).catch(l=>{i(E.from(l))})})}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(o){o.result.type==="started"?n.onStarted?.():o.result.type==="stopped"?n.onStopped?.():n.onData?.(o.result.data)},error(o){n.onError?.(o)},complete(){n.onComplete?.()}})}constructor(e){this.requestId=0;function t(){let n=e.transformer;return n?"input"in n?{serialize:n.input.serialize,deserialize:n.output.deserialize}:n:{serialize:s=>s,deserialize:s=>s}}u(t,"getTransformer"),this.runtime={transformer:t()},this.links=e.links.map(n=>n(this.runtime))}};u(Se,"TRPCUntypedClient");var Wt={query:"query",mutate:"mutation",subscribe:"subscription"};function Ut(r){return $e(e=>r.hasOwnProperty(e)?r[e]:Be(({path:t,args:n})=>{let s=[e,...t],o=s.pop(),c=Wt[o],i=s.join(".");return r[c](i,...n)}))}u(Ut,"createTRPCClientProxy");function He(r){let e=new Se(r);return Ut(e)}u(He,"createTRPCProxyClient");var Zt=Object.defineProperty,Ne=u((r,e)=>Zt(r,"name",{value:e,configurable:!0}),"__name"),Ft=Ne(r=>()=>({next:e,op:t})=>$(n=>{let s=null,o=0,c=!1,i=Ne(()=>{o+=1,s?.unsubscribe(),s=e(t).subscribe({error:async l=>{if(o>5||l.data?.httpStatus!==401)return n.error(l);await r(),i()},next:l=>n.next(l),complete:()=>{c&&n.complete()}})},"attempt");return i(),()=>{c=!0,s?.unsubscribe()}}),"callbackLink"),pt=Ne(async(r,e)=>{let t=[],n=He({links:[Pe({url:r,headers:{Authorization:`Bearer ${await e()}`}})]}),s=Ne(async(c=95+Math.round((Math.random()-.5)*5))=>n.utilities.getChallenges.query({amount:c}),"getChallenges");return t=await s(),He({links:[Ft(async()=>{t=await s()}),Pe({url:r,headers:async()=>(t.length===0&&t.push(...await s()),{Authorization:`Bearer ${await e(t.pop())}`})})]})},"getClient");var x;(function(r){r.assertEqual=s=>s;function e(s){}u(e,"assertIs"),r.assertIs=e;function t(s){throw new Error}u(t,"assertNever"),r.assertNever=t,r.arrayToEnum=s=>{let o={};for(let c of s)o[c]=c;return o},r.getValidEnumValues=s=>{let o=r.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),c={};for(let i of o)c[i]=s[i];return r.objectValues(c)},r.objectValues=s=>r.objectKeys(s).map(function(o){return s[o]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let c in s)Object.prototype.hasOwnProperty.call(s,c)&&o.push(c);return o},r.find=(s,o)=>{for(let c of s)if(o(c))return c},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}u(n,"joinValues"),r.joinValues=n,r.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(x||(x={}));var m=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),G=u(r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(r)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},"getParsedType"),f=x.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"]),Jt=u(r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),A=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(o){return o.message},n={_errors:[]},s=u(o=>{for(let c of o.issues)if(c.code==="invalid_union")c.unionErrors.map(s);else if(c.code==="invalid_return_type")s(c.returnTypeError);else if(c.code==="invalid_arguments")s(c.argumentsError);else if(c.path.length===0)n._errors.push(t(c));else{let i=n,l=0;for(;l<c.path.length;){let d=c.path[l];l===c.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(t(c))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}},"processError");return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.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()}};u(A,"ZodError");A.create=r=>new A(r);var Ce=u((r,e)=>{let t;switch(r.code){case f.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.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}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case f.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 f.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 f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}},"errorMap"),yt=Ce;function Ht(r){yt=r}u(Ht,"setErrorMap");function Re(){return yt}u(Re,"getErrorMap");var Oe=u(r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,o=[...t,...s.path||[]],c={...s,path:o},i="",l=n.filter(d=>!!d).slice().reverse();for(let d of l)i=d(c,{data:e,defaultError:i}).message;return{...s,path:o,message:s.message||i}},"makeIssue"),Gt=[];function h(r,e){let t=Oe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Re(),Ce].filter(n=>!!n)});r.common.issues.push(t)}u(h,"addIssueToContext");var j=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 g;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 j.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:o,value:c}=s;if(o.status==="aborted"||c.status==="aborted")return g;o.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),(typeof c.value<"u"||s.alwaysSet)&&(n[o.value]=c.value)}return{status:e.value,value:n}}};u(j,"ParseStatus");var g=Object.freeze({status:"aborted"}),gt=u(r=>({status:"dirty",value:r}),"DIRTY"),P=u(r=>({status:"valid",value:r}),"OK"),Ge=u(r=>r.status==="aborted","isAborted"),Qe=u(r=>r.status==="dirty","isDirty"),Ie=u(r=>r.status==="valid","isValid"),Ae=u(r=>typeof Promise!==void 0&&r instanceof Promise,"isAsync"),w;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(w||(w={}));var R=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)}};u(R,"ParseInputLazyPath");var ft=u((r,e)=>{if(Ie(e))return{success:!0,data:e.value};{if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");let t=new A(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:u((c,i)=>c.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.defaultError},"customMap"),description:s}}u(_,"processCreateParams");var v=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 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 j,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(Ae(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)},o=this._parseSync({data:e,path:s.path,parent:s});return ft(s,o)}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}),o=await(Ae(s)?s:Promise.resolve(s));return ft(n,o)}refine(e,t){let n=u(s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t,"getIssueProperties");return this._refinement((s,o)=>{let c=e(s),i=u(()=>o.addIssue({code:f.custom,...n(s)}),"setError");return typeof Promise<"u"&&c instanceof Promise?c.then(l=>l?!0:(i(),!1)):c?!0:(i(),!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 V({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return I.create(this)}nullable(){return Z.create(this)}nullish(){return this.optional().nullable()}array(){return N.create(this)}promise(){return H.create(this)}or(e){return ee.create([this,e])}and(e){return te.create(this,e)}transform(e){return new V({schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new oe({innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new xe({typeName:y.ZodBranded,type:this,..._(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new he({innerType:this,defaultValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ce.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};u(v,"ZodType");var Qt=/^c[^\s-]{8,}$/i,Yt=/^([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,Kt=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,Xt=u(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 v{constructor(){super(...arguments),this._regex=(e,t,n)=>this.refinement(s=>e.test(s),{validation:t,code:f.invalid_string,...w.errToObj(n)}),this.nonempty=e=>this.min(1,w.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)!==m.string){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.string,received:o.parsedType}),g}let n=new j,s;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let c=e.data.length>o.value,i=e.data.length<o.value;(c||i)&&(s=this._getOrReturnCtx(e,s),c?h(s,{code:f.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):i&&h(s,{code:f.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")Kt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"email",code:f.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")Yt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"uuid",code:f.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Qt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid",code:f.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),h(s,{validation:"url",code:f.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"regex",code:f.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="startsWith"?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?Xt(o).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:f.invalid_string,validation:"datetime",message:o.message}),n.dirty()):x.assertNever(o);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",...w.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.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,...w.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...w.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...w.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...w.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...w.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}};u(D,"ZodString");D.create=r=>{var e;return new D({checks:[],typeName:y.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function er(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,o=parseInt(r.toFixed(s).replace(".","")),c=parseInt(e.toFixed(s).replace(".",""));return o%c/Math.pow(10,s)}u(er,"floatSafeRemainder");var M=class extends v{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)!==m.number){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.number,received:o.parsedType}),g}let n,s=new j;for(let o of this._def.checks)o.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?er(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:f.not_finite,message:o.message}),s.dirty()):x.assertNever(o);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,n,s){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:w.toString(s)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:w.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")}};u(M,"ZodNumber");M.create=r=>new M({checks:[],typeName:y.ZodNumber,coerce:r?.coerce||!1,..._(r)});var Q=class extends v{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==m.bigint){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.bigint,received:n.parsedType}),g}return P(e.data)}};u(Q,"ZodBigInt");Q.create=r=>{var e;return new Q({typeName:y.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};var Y=class extends v{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==m.boolean){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.boolean,received:n.parsedType}),g}return P(e.data)}};u(Y,"ZodBoolean");Y.create=r=>new Y({typeName:y.ZodBoolean,coerce:r?.coerce||!1,..._(r)});var z=class extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_type,expected:m.date,received:o.parsedType}),g}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return h(o,{code:f.invalid_date}),g}let n=new j,s;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:f.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):x.assertNever(o);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:w.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:w.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}};u(z,"ZodDate");z.create=r=>new z({checks:[],coerce:r?.coerce||!1,typeName:y.ZodDate,..._(r)});var de=class extends v{_parse(e){if(this._getType(e)!==m.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.symbol,received:n.parsedType}),g}return P(e.data)}};u(de,"ZodSymbol");de.create=r=>new de({typeName:y.ZodSymbol,..._(r)});var K=class extends v{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.undefined,received:n.parsedType}),g}return P(e.data)}};u(K,"ZodUndefined");K.create=r=>new K({typeName:y.ZodUndefined,..._(r)});var X=class extends v{_parse(e){if(this._getType(e)!==m.null){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.null,received:n.parsedType}),g}return P(e.data)}};u(X,"ZodNull");X.create=r=>new X({typeName:y.ZodNull,..._(r)});var F=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return P(e.data)}};u(F,"ZodAny");F.create=r=>new F({typeName:y.ZodAny,..._(r)});var W=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return P(e.data)}};u(W,"ZodUnknown");W.create=r=>new W({typeName:y.ZodUnknown,..._(r)});var L=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_type,expected:m.never,received:t.parsedType}),g}};u(L,"ZodNever");L.create=r=>new L({typeName:y.ZodNever,..._(r)});var pe=class extends v{_parse(e){if(this._getType(e)!==m.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.void,received:n.parsedType}),g}return P(e.data)}};u(pe,"ZodVoid");pe.create=r=>new pe({typeName:y.ZodVoid,..._(r)});var N=class extends v{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return h(t,{code:f.invalid_type,expected:m.array,received:t.parsedType}),g;if(s.exactLength!==null){let c=t.data.length>s.exactLength.value,i=t.data.length<s.exactLength.value;(c||i)&&(h(t,{code:c?f.too_big:f.too_small,minimum:i?s.exactLength.value:void 0,maximum:c?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&&(h(t,{code:f.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&&(h(t,{code:f.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((c,i)=>s.type._parseAsync(new R(t,c,t.path,i)))).then(c=>j.mergeArray(n,c));let o=t.data.map((c,i)=>s.type._parseSync(new R(t,c,t.path,i)));return j.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new N({...this._def,minLength:{value:e,message:w.toString(t)}})}max(e,t){return new N({...this._def,maxLength:{value:e,message:w.toString(t)}})}length(e,t){return new N({...this._def,exactLength:{value:e,message:w.toString(t)}})}nonempty(e){return this.min(1,e)}};u(N,"ZodArray");N.create=(r,e)=>new N({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});var De;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(De||(De={}));var mt=u(r=>e=>new k({...r,shape:()=>({...r.shape(),...e})}),"AugmentFactory");function _e(r){if(r instanceof k){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=I.create(_e(n))}return new k({...r._def,shape:()=>e})}else return r instanceof N?N.create(_e(r.element)):r instanceof I?I.create(_e(r.unwrap())):r instanceof Z?Z.create(_e(r.unwrap())):r instanceof O?O.create(r.items.map(e=>_e(e))):r}u(_e,"deepPartialify");var k=class extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=mt(this._def),this.extend=mt(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.object){let d=this._getOrReturnCtx(e);return h(d,{code:f.invalid_type,expected:m.object,received:d.parsedType}),g}let{status:n,ctx:s}=this._processInputParams(e),{shape:o,keys:c}=this._getCached(),i=[];if(!(this._def.catchall instanceof L&&this._def.unknownKeys==="strip"))for(let d in s.data)c.includes(d)||i.push(d);let l=[];for(let d of c){let p=o[d],b=s.data[d];l.push({key:{status:"valid",value:d},value:p._parse(new R(s,b,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof L){let d=this._def.unknownKeys;if(d==="passthrough")for(let p of i)l.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(d==="strict")i.length>0&&(h(s,{code:f.unrecognized_keys,keys:i}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let p of i){let b=s.data[p];l.push({key:{status:"valid",value:p},value:d._parse(new R(s,b,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let p of l){let b=await p.key;d.push({key:b,value:await p.value,alwaysSet:p.alwaysSet})}return d}).then(d=>j.mergeObjectSync(n,d)):j.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new k({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,o,c,i;let l=(c=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,t,n).message)!==null&&c!==void 0?c:n.defaultError;return t.code==="unrecognized_keys"?{message:(i=w.errToObj(e).message)!==null&&i!==void 0?i:l}:{message:l}}}:{}})}strip(){return new k({...this._def,unknownKeys:"strip"})}passthrough(){return new k({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new k({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>De.mergeShapes(this._def.shape(),e._def.shape()),typeName:y.ZodObject})}catchall(e){return new k({...this._def,catchall:e})}pick(e){let t={};return x.objectKeys(e).map(n=>{this.shape[n]&&(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}omit(e){let t={};return x.objectKeys(this.shape).map(n=>{x.objectKeys(e).indexOf(n)===-1&&(t[n]=this.shape[n])}),new k({...this._def,shape:()=>t})}deepPartial(){return _e(this)}partial(e){let t={};if(e)return x.objectKeys(this.shape).map(n=>{x.objectKeys(e).indexOf(n)===-1?t[n]=this.shape[n]:t[n]=this.shape[n].optional()}),new k({...this._def,shape:()=>t});for(let n in this.shape){let s=this.shape[n];t[n]=s.optional()}return new k({...this._def,shape:()=>t})}required(e){let t={};if(e)x.objectKeys(this.shape).map(n=>{if(x.objectKeys(e).indexOf(n)===-1)t[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof I;)o=o._def.innerType;t[n]=o}});else for(let n in this.shape){let o=this.shape[n];for(;o instanceof I;)o=o._def.innerType;t[n]=o}return new k({...this._def,shape:()=>t})}keyof(){return vt(x.objectKeys(this.shape))}};u(k,"ZodObject");k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,..._(e)});k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:L.create(),typeName:y.ZodObject,..._(e)});k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,..._(e)});var ee=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let c=o.map(i=>new A(i.ctx.common.issues));return h(t,{code:f.invalid_union,unionErrors:c}),g}if(u(s,"handleResults"),t.common.async)return Promise.all(n.map(async o=>{let c={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:c}),ctx:c}})).then(s);{let o,c=[];for(let l of n){let d={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!o&&(o={result:p,ctx:d}),d.common.issues.length&&c.push(d.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let i=c.map(l=>new A(l));return h(t,{code:f.invalid_union,unionErrors:i}),g}}get options(){return this._def.options}};u(ee,"ZodUnion");ee.create=(r,e)=>new ee({options:r,typeName:y.ZodUnion,..._(e)});var Ve=u(r=>r instanceof ne?Ve(r.schema):r instanceof V?Ve(r.innerType()):r instanceof ae?[r.value]:r instanceof se?r.options:r instanceof ie?Object.keys(r.enum):r instanceof oe?Ve(r._def.innerType):r instanceof K?[void 0]:r instanceof X?[null]:null,"getDiscriminator"),fe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return h(t,{code:f.invalid_type,expected:m.object,received:t.parsedType}),g;let n=this.discriminator,s=t.data[n],o=this.optionsMap.get(s);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),g)}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 o of t){let c=Ve(o.shape[e]);if(!c)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of c){if(s.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,o)}}return new fe({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}};u(fe,"ZodDiscriminatedUnion");function Ye(r,e){let t=G(r),n=G(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&n===m.object){let s=x.objectKeys(e),o=x.objectKeys(r).filter(i=>s.indexOf(i)!==-1),c={...r,...e};for(let i of o){let l=Ye(r[i],e[i]);if(!l.valid)return{valid:!1};c[i]=l.data}return{valid:!0,data:c}}else if(t===m.array&&n===m.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let o=0;o<r.length;o++){let c=r[o],i=e[o],l=Ye(c,i);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return t===m.date&&n===m.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}u(Ye,"mergeValues");var te=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=u((o,c)=>{if(Ge(o)||Ge(c))return g;let i=Ye(o.value,c.value);return i.valid?((Qe(o)||Qe(c))&&t.dirty(),{status:t.value,value:i.data}):(h(n,{code:f.invalid_intersection_types}),g)},"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(([o,c])=>s(o,c)):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}))}};u(te,"ZodIntersection");te.create=(r,e,t)=>new te({left:r,right:e,typeName:y.ZodIntersection,..._(t)});var O=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return h(n,{code:f.invalid_type,expected:m.array,received:n.parsedType}),g;if(n.data.length<this._def.items.length)return h(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=n.data.map((c,i)=>{let l=this._def.items[i]||this._def.rest;return l?l._parse(new R(n,c,n.path,i)):null}).filter(c=>!!c);return n.common.async?Promise.all(o).then(c=>j.mergeArray(t,c)):j.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new O({...this._def,rest:e})}};u(O,"ZodTuple");O.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new O({items:r,typeName:y.ZodTuple,rest:null,..._(e)})};var re=class extends v{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!==m.object)return h(n,{code:f.invalid_type,expected:m.object,received:n.parsedType}),g;let s=[],o=this._def.keyType,c=this._def.valueType;for(let i in n.data)s.push({key:o._parse(new R(n,i,n.path,i)),value:c._parse(new R(n,n.data[i],n.path,i))});return n.common.async?j.mergeObjectAsync(t,s):j.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof v?new re({keyType:e,valueType:t,typeName:y.ZodRecord,..._(n)}):new re({keyType:D.create(),valueType:e,typeName:y.ZodRecord,..._(t)})}};u(re,"ZodRecord");var me=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return h(n,{code:f.invalid_type,expected:m.map,received:n.parsedType}),g;let s=this._def.keyType,o=this._def.valueType,c=[...n.data.entries()].map(([i,l],d)=>({key:s._parse(new R(n,i,n.path,[d,"key"])),value:o._parse(new R(n,l,n.path,[d,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let l of c){let d=await l.key,p=await l.value;if(d.status==="aborted"||p.status==="aborted")return g;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(d.value,p.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let l of c){let d=l.key,p=l.value;if(d.status==="aborted"||p.status==="aborted")return g;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(d.value,p.value)}return{status:t.value,value:i}}}};u(me,"ZodMap");me.create=(r,e,t)=>new me({valueType:e,keyType:r,typeName:y.ZodMap,..._(t)});var U=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return h(n,{code:f.invalid_type,expected:m.set,received:n.parsedType}),g;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(h(n,{code:f.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&&(h(n,{code:f.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let o=this._def.valueType;function c(l){let d=new Set;for(let p of l){if(p.status==="aborted")return g;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}u(c,"finalizeSet");let i=[...n.data.values()].map((l,d)=>o._parse(new R(n,l,n.path,d)));return n.common.async?Promise.all(i).then(l=>c(l)):c(i)}min(e,t){return new U({...this._def,minSize:{value:e,message:w.toString(t)}})}max(e,t){return new U({...this._def,maxSize:{value:e,message:w.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};u(U,"ZodSet");U.create=(r,e)=>new U({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});var J=class extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return h(t,{code:f.invalid_type,expected:m.function,received:t.parsedType}),g;function n(i,l){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Re(),Ce].filter(d=>!!d),issueData:{code:f.invalid_arguments,argumentsError:l}})}u(n,"makeArgsIssue");function s(i,l){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Re(),Ce].filter(d=>!!d),issueData:{code:f.invalid_return_type,returnTypeError:l}})}u(s,"makeReturnsIssue");let o={errorMap:t.common.contextualErrorMap},c=t.data;return this._def.returns instanceof H?P(async(...i)=>{let l=new A([]),d=await this._def.args.parseAsync(i,o).catch(C=>{throw l.addIssue(n(i,C)),l}),p=await c(...d);return await this._def.returns._def.type.parseAsync(p,o).catch(C=>{throw l.addIssue(s(p,C)),l})}):P((...i)=>{let l=this._def.args.safeParse(i,o);if(!l.success)throw new A([n(i,l.error)]);let d=c(...l.data),p=this._def.returns.safeParse(d,o);if(!p.success)throw new A([s(d,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new J({...this._def,args:O.create(e).rest(W.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||O.create([]).rest(W.create()),returns:t||W.create(),typeName:y.ZodFunction,..._(n)})}};u(J,"ZodFunction");var ne=class extends v{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})}};u(ne,"ZodLazy");ne.create=(r,e)=>new ne({getter:r,typeName:y.ZodLazy,..._(e)});var ae=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h(t,{code:f.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}};u(ae,"ZodLiteral");ae.create=(r,e)=>new ae({value:r,typeName:y.ZodLiteral,..._(e)});function vt(r,e){return new se({values:r,typeName:y.ZodEnum,..._(e)})}u(vt,"createZodEnum");var se=class extends v{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:x.joinValues(n),received:t.parsedType,code:f.invalid_type}),g}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:f.invalid_enum_value,options:n}),g}return P(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}};u(se,"ZodEnum");se.create=vt;var ie=class extends v{_parse(e){let t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){let s=x.objectValues(t);return h(n,{expected:x.joinValues(s),received:n.parsedType,code:f.invalid_type}),g}if(t.indexOf(e.data)===-1){let s=x.objectValues(t);return h(n,{received:n.data,code:f.invalid_enum_value,options:s}),g}return P(e.data)}get enum(){return this._def.values}};u(ie,"ZodNativeEnum");ie.create=(r,e)=>new ie({values:r,typeName:y.ZodNativeEnum,..._(e)});var H=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return h(t,{code:f.invalid_type,expected:m.promise,received:t.parsedType}),g;let n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return P(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};u(H,"ZodPromise");H.create=(r,e)=>new H({type:r,typeName:y.ZodPromise,..._(e)});var V=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.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 c=s.transform(n.data);return n.common.async?Promise.resolve(c).then(i=>this._def.schema._parseAsync({data:i,path:n.path,parent:n})):this._def.schema._parseSync({data:c,path:n.path,parent:n})}let o={addIssue:c=>{h(n,c),c.fatal?t.abort():t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="refinement"){let c=u(i=>{let l=s.refinement(i,o);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i},"executeRefinement");if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?g:(i.status==="dirty"&&t.dirty(),c(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?g:(i.status==="dirty"&&t.dirty(),c(i.value).then(()=>({status:t.value,value:i.value}))))}if(s.type==="transform")if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Ie(c))return c;let i=s.transform(c.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>Ie(c)?Promise.resolve(s.transform(c.value,o)).then(i=>({status:t.value,value:i})):c);x.assertNever(s)}};u(V,"ZodEffects");V.create=(r,e,t)=>new V({schema:r,typeName:y.ZodEffects,effect:e,..._(t)});V.createWithPreprocess=(r,e,t)=>new V({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,..._(t)});var I=class extends v{_parse(e){return this._getType(e)===m.undefined?P(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u(I,"ZodOptional");I.create=(r,e)=>new I({innerType:r,typeName:y.ZodOptional,..._(e)});var Z=class extends v{_parse(e){return this._getType(e)===m.null?P(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};u(Z,"ZodNullable");Z.create=(r,e)=>new Z({innerType:r,typeName:y.ZodNullable,..._(e)});var oe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};u(oe,"ZodDefault");oe.create=(r,e)=>new oe({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var he=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return Ae(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}};u(he,"ZodCatch");he.create=(r,e)=>new he({innerType:r,typeName:y.ZodCatch,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ye=class extends v{_parse(e){if(this._getType(e)!==m.nan){let n=this._getOrReturnCtx(e);return h(n,{code:f.invalid_type,expected:m.nan,received:n.parsedType}),g}return{status:"valid",value:e.data}}};u(ye,"ZodNaN");ye.create=r=>new ye({typeName:y.ZodNaN,..._(r)});var tr=Symbol("zod_brand"),xe=class extends v{_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}};u(xe,"ZodBranded");var ce=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return u(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?g:o.status==="dirty"?(t.dirty(),gt(o.value)):this._def.out._parseAsync({data:o.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"?g: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:y.ZodPipeline})}};u(ce,"ZodPipeline");var bt=u((r,e={},t)=>r?F.create().superRefine((n,s)=>{if(!r(n)){let o=typeof e=="function"?e(n):e,c=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...c,fatal:t})}}):F.create(),"custom"),rr={object:k.lazycreate},y;(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"})(y||(y={}));var nr=u((r,e={message:`Input not instance of ${r.name}`})=>bt(t=>t instanceof r,e,!0),"instanceOfType"),_t=D.create,wt=M.create,ar=ye.create,sr=Q.create,xt=Y.create,ir=z.create,or=de.create,cr=K.create,lr=X.create,ur=F.create,dr=W.create,pr=L.create,fr=pe.create,mr=N.create,hr=k.create,yr=k.strictCreate,gr=ee.create,vr=fe.create,br=te.create,_r=O.create,wr=re.create,xr=me.create,Cr=U.create,kr=J.create,Tr=ne.create,Er=ae.create,jr=se.create,Pr=ie.create,Sr=H.create,ht=V.create,Nr=I.create,Vr=Z.create,Rr=V.createWithPreprocess,Or=ce.create,Ir=u(()=>_t().optional(),"ostring"),Ar=u(()=>wt().optional(),"onumber"),Dr=u(()=>xt().optional(),"oboolean"),Lr={string:r=>D.create({...r,coerce:!0}),number:r=>M.create({...r,coerce:!0}),boolean:r=>Y.create({...r,coerce:!0}),bigint:r=>Q.create({...r,coerce:!0}),date:r=>z.create({...r,coerce:!0})},qr=g,a=Object.freeze({__proto__:null,defaultErrorMap:Ce,setErrorMap:Ht,getErrorMap:Re,makeIssue:Oe,EMPTY_PATH:Gt,addIssueToContext:h,ParseStatus:j,INVALID:g,DIRTY:gt,OK:P,isAborted:Ge,isDirty:Qe,isValid:Ie,isAsync:Ae,get util(){return x},ZodParsedType:m,getParsedType:G,ZodType:v,ZodString:D,ZodNumber:M,ZodBigInt:Q,ZodBoolean:Y,ZodDate:z,ZodSymbol:de,ZodUndefined:K,ZodNull:X,ZodAny:F,ZodUnknown:W,ZodNever:L,ZodVoid:pe,ZodArray:N,get objectUtil(){return De},ZodObject:k,ZodUnion:ee,ZodDiscriminatedUnion:fe,ZodIntersection:te,ZodTuple:O,ZodRecord:re,ZodMap:me,ZodSet:U,ZodFunction:J,ZodLazy:ne,ZodLiteral:ae,ZodEnum:se,ZodNativeEnum:ie,ZodPromise:H,ZodEffects:V,ZodTransformer:V,ZodOptional:I,ZodNullable:Z,ZodDefault:oe,ZodCatch:he,ZodNaN:ye,BRAND:tr,ZodBranded:xe,ZodPipeline:ce,custom:bt,Schema:v,ZodSchema:v,late:rr,get ZodFirstPartyTypeKind(){return y},coerce:Lr,any:ur,array:mr,bigint:sr,boolean:xt,date:ir,discriminatedUnion:vr,effect:ht,enum:jr,function:kr,instanceof:nr,intersection:br,lazy:Tr,literal:Er,map:xr,nan:ar,nativeEnum:Pr,never:pr,null:lr,nullable:Vr,number:wt,object:hr,oboolean:Dr,onumber:Ar,optional:Nr,ostring:Ir,pipeline:Or,preprocess:Rr,promise:Sr,record:wr,set:Cr,strictObject:yr,string:_t,symbol:or,transformer:ht,tuple:_r,undefined:cr,union:gr,unknown:dr,void:fr,NEVER:qr,ZodIssueCode:f,quotelessJson:Jt,ZodError:A});var kt=a.array(a.string().or(a.record(a.any()))),wa=a.object({type:a.string().optional(),narrative:a.string().optional()}),Le=a.string().or(a.object({id:a.string(),type:a.string(),caption:a.string().optional()})),Mr=a.object({type:a.string().min(1).or(a.string().array().nonempty()),latitude:a.number(),longitude:a.number()}),Br=a.object({type:a.string().min(1).or(a.string().array().nonempty()),addressCountry:a.string().optional(),addressCountryCode:a.string().optional(),addressRegion:a.string().optional(),addressLocality:a.string().optional(),streetAddress:a.string().optional(),postOfficeBoxNumber:a.string().optional(),postalCode:a.string().optional(),geo:Mr.optional()}),$r=a.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(a.string()),Tt=a.object({type:a.string().min(1).or(a.string().array().nonempty()),identifier:a.string(),identifierType:$r}),ke=a.string().or(a.object({id:a.string().optional(),type:a.string().or(a.string().array().nonempty().optional()),name:a.string().optional(),url:a.string().optional(),phone:a.string().optional(),description:a.string().optional(),endorsement:a.any().array().optional(),image:Le.optional(),email:a.string().email().optional(),address:Br.optional(),otherIdentifier:Tt.array().optional(),official:a.string().optional(),parentOrg:a.any().optional(),familyName:a.string().optional(),givenName:a.string().optional(),additionalName:a.string().optional(),patronymicName:a.string().optional(),honorificPrefix:a.string().optional(),honorificSuffix:a.string().optional(),familyNamePrefix:a.string().optional(),dateOfBirth:a.string().optional()}).catchall(a.any())),Ke=a.object({id:a.string().optional()}).catchall(a.any()),zr=a.object({type:a.string(),id:a.string()}).catchall(a.any()),Wr=a.object({id:a.string(),type:a.string()}).catchall(a.any()),Ur=a.object({id:a.string(),type:a.string()}).catchall(a.any()),ge=a.object({"@context":kt,id:a.string().optional(),type:a.string().array().nonempty(),issuer:ke,issuanceDate:a.string(),expirationDate:a.string().optional(),credentialSubject:Ke.or(Ke.array()),credentialStatus:zr.optional(),credentialSchema:Wr.array().optional(),refreshService:Ur.optional()}).catchall(a.any()),le=a.object({type:a.string(),created:a.string(),challenge:a.string().optional(),domain:a.string().optional(),nonce:a.string().optional(),proofPurpose:a.string(),verificationMethod:a.string(),jws:a.string().optional()}).catchall(a.any()),Te=ge.extend({proof:le.or(le.array())}),Zr=a.object({"@context":kt,id:a.string().optional(),type:a.string().or(a.string().array().nonempty()),verifiableCredential:Te.or(Te.array()).optional(),holder:a.string().optional()}).catchall(a.any()),et=Zr.extend({proof:le.or(le.array())}),Fr=a.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(a.string()),qe=a.object({type:a.string().array().nonempty(),targetCode:a.string().optional(),targetDescription:a.string().optional(),targetName:a.string(),targetFramework:a.string().optional(),targetType:Fr.optional(),targetUrl:a.string()}),Jr=a.enum(["Achievement","ApprenticeshipCertificate","Assessment","Assignment","AssociateDegree","Award","Badge","BachelorDegree","Certificate","CertificateOfCompletion","Certification","CommunityService","Competency","Course","CoCurricular","Degree","Diploma","DoctoralDegree","Fieldwork","GeneralEducationDevelopment","JourneymanCertificate","LearningProgram","License","Membership","ProfessionalDoctorate","QualityAssuranceCredential","MasterCertificate","MasterDegree","MicroCredential","ResearchDoctorate","SecondarySchoolDiploma"]),Hr=Jr.or(a.string()),Gr=a.object({id:a.string().optional(),narrative:a.string().optional()}).catchall(a.any()),Qr=a.object({id:a.string(),type:a.string().array().nonempty(),endorsementComment:a.string().optional()}),Yr=ge.extend({credentialSubject:Qr,proof:le.or(le.array()).optional()}),Kr=a.object({id:a.string(),"@language":a.string().optional(),version:a.string().optional()}),Xr=a.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(a.string()),en=a.object({id:a.string(),type:a.string().array().nonempty(),alignment:qe.array().optional(),description:a.string().optional(),level:a.string().optional(),name:a.string(),points:a.string().optional()}).catchall(a.any()),tn=a.object({id:a.string(),type:a.string().array().nonempty(),alignment:qe.array().optional(),allowedValue:a.string().array().optional(),name:a.string(),requiredLevel:a.string().optional(),requiredValue:a.string().optional(),resultType:Xr,rubricCriterionLevel:en.array().optional(),valueMax:a.string().optional(),valueMin:a.string().optional()}).catchall(a.any()),rn=a.object({id:a.string().optional(),type:a.string().array().nonempty(),alignment:qe.array().optional(),achievementType:Hr.optional(),creator:ke.optional(),creditsAvailable:a.number().optional(),criteria:Gr,description:a.string(),endorsement:Yr.array().optional(),fieldOfStudy:a.string().optional(),humanCode:a.string().optional(),image:Le.optional(),"@language":a.string().optional(),name:a.string(),otherIdentifier:Tt.array().optional(),related:Kr.array().optional(),resultDescription:tn.array().optional(),specialization:a.string().optional(),tag:a.string().array().optional(),version:a.string().optional()}).catchall(a.any()),nn=a.object({type:a.string(),hashed:a.boolean(),identityHash:a.string(),identityType:a.string(),salt:a.string().optional()}),an=a.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),sn=a.object({type:a.string().array().nonempty(),achievedLevel:a.string().optional(),alignment:qe.array().optional(),resultDescription:a.string().optional(),status:an.optional(),value:a.string().optional()}).catchall(a.any()),Ct=a.object({id:a.string().optional(),type:a.string().array().nonempty(),activityEndDate:a.string().optional(),activityStartDate:a.string().optional(),creditsEarned:a.number().optional(),achievement:rn.optional(),identifier:nn.array().optional(),image:Le.optional(),licenseNumber:a.string().optional(),narrative:a.string().optional(),result:sn.array().optional(),role:a.string().optional(),source:ke.optional(),term:a.string().optional()}).catchall(a.any()),on=a.object({id:a.string().optional(),type:a.string().array().nonempty(),narrative:a.string().optional(),name:a.string().optional(),description:a.string().optional(),genre:a.string().optional(),audience:a.string().optional()}).catchall(a.any()),cn=ge.extend({name:a.string().optional(),description:a.string().optional(),image:Le.optional(),credentialSubject:Ct.or(Ct.array()),endorsement:ge.array().optional(),evidence:on.array().optional()}),Ca=cn.extend({proof:le.or(le.array())}),Ta=a.object({checks:a.string().array(),warnings:a.string().array(),errors:a.string().array()}),Et=a.enum(["Success","Failed","Error"]),Ea=Et.enum,ja=a.object({check:a.string(),status:Et,message:a.string().optional(),details:a.string().optional()}),Pa=a.object({title:a.string().optional(),createdAt:a.string().optional(),issuer:ke.optional(),issuee:ke.optional(),credentialSubject:Ke.optional()}),Sa=a.object({id:a.string(),uri:a.string()}).catchall(a.any()),Ra=a.object({limit:a.number(),cursor:a.string().optional(),sort:a.string().optional()}),ve=a.object({cursor:a.string().optional(),hasMore:a.boolean()}),ln=a.object({kty:a.string(),crv:a.string(),x:a.string(),y:a.string().optional(),n:a.string().optional(),d:a.string()}),un=a.object({alg:a.string(),iv:a.string(),tag:a.string(),epk:ln.partial().optional(),kid:a.string().optional(),apv:a.string().optional(),apu:a.string().optional()}),dn=a.object({header:un,encrypted_key:a.string()}),tt=a.object({protected:a.string(),iv:a.string(),ciphertext:a.string(),tag:a.string(),aad:a.string().optional(),recipients:dn.array().optional()}),jt=a.object({encryptedRecord:tt,fields:a.string().array()}).catchall(a.any()),Ia=ve.extend({records:jt.array()}),pn=jt.extend({id:a.string()}),Aa=ve.extend({records:pn.array()}),we=a.object({profileId:a.string().min(3).max(40),displayName:a.string().default(""),bio:a.string().default(""),did:a.string(),email:a.string().optional(),image:a.string().optional(),isServiceProfile:a.boolean().default(!1).optional(),notificationsWebhook:a.string().url().startsWith("https://").optional()}),La=ve.extend({records:we.array()}),qa=a.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),Ma=a.object({uri:a.string(),to:a.string(),from:a.string(),sent:a.string().datetime(),received:a.string().datetime().optional()}),fn=a.enum(["DRAFT","LIVE"]),Ba=a.object({uri:a.string(),name:a.string().optional(),type:a.string().optional(),category:a.string().optional(),status:fn.optional(),autoConnectRecipients:a.boolean().optional()}),$a=a.object({to:we,from:a.string(),received:a.string().optional()}),mn=a.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED"]),hn=a.object({title:a.string().optional(),body:a.string().optional()}),yn=a.object({vcUris:a.array(a.string()).optional(),vpUris:a.array(a.string()).optional()}),za=a.object({type:mn,to:we.partial().and(a.object({did:a.string()})),from:we.partial().and(a.object({did:a.string()})),message:hn.optional(),data:yn.optional(),sent:a.string().datetime().optional()}),Wa=a.object({endpoint:a.string(),name:a.string(),did:a.string().optional()}),Ua=a.object({ttlSeconds:a.number().optional(),totalUses:a.number().optional()}),gn=a.object({endpoint:a.string()}),Za=a.object({signingAuthority:gn,relationship:a.object({name:a.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:a.string()})}),vn=a.enum(["live","stale","withdrawn"]),rt=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({categories:a.record(a.object({required:a.boolean()})).default({})}).default({}),personal:a.record(a.object({required:a.boolean()})).default({})}).default({}),write:a.object({credentials:a.object({categories:a.record(a.object({required:a.boolean()})).default({})}).default({}),personal:a.record(a.object({required:a.boolean()})).default({})}).default({})}),Pt=a.object({contract:rt,owner:we,name:a.string(),subtitle:a.string().optional(),description:a.string().optional(),reasonForAccessing:a.string().optional(),image:a.string().optional(),uri:a.string(),createdAt:a.string(),updatedAt:a.string(),expiresAt:a.string().optional()}),Fa=ve.extend({records:Pt.omit({owner:!0}).array()}),bn=a.object({credentials:a.object({categories:a.record(a.string().array()).default({})}),personal:a.record(a.string()).default({}),date:a.string()}),Ja=ve.extend({records:bn.array()}),Me=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({shareAll:a.boolean().optional(),sharing:a.boolean().optional(),categories:a.record(a.object({sharing:a.boolean().optional(),shared:a.string().array().optional(),shareAll:a.boolean().optional()})).default({})}).default({}),personal:a.record(a.string()).default({})}).default({}),write:a.object({credentials:a.object({categories:a.record(a.boolean()).default({})}).default({}),personal:a.record(a.boolean()).default({})}).default({})}),Ha=ve.extend({records:a.object({expiresAt:a.string().optional(),oneTime:a.boolean().optional(),terms:Me,contract:Pt,uri:a.string(),consenter:we,status:vn}).array()}),Ga=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({categories:a.record(a.object({required:a.boolean().optional()})).optional()}).optional(),personal:a.record(a.object({required:a.boolean().optional()})).optional()}).optional(),write:a.object({credentials:a.object({categories:a.record(a.object({required:a.boolean().optional()})).optional()}).optional(),personal:a.record(a.object({required:a.boolean().optional()})).optional()}).optional()}),_n=a.object({read:a.object({anonymize:a.boolean().optional(),credentials:a.object({shareAll:a.boolean().optional(),sharing:a.boolean().optional(),categories:a.record(a.object({sharing:a.boolean().optional(),shared:a.string().array().optional(),shareAll:a.boolean().optional()}).optional()).optional()}).optional(),personal:a.record(a.string()).optional()}).optional(),write:a.object({credentials:a.object({categories:a.record(a.boolean()).optional()}).optional(),personal:a.record(a.boolean()).optional()}).optional()}),Xe=a.enum(["consent","update","sync","withdraw"]),Qa=a.object({terms:_n.optional(),action:Xe.or(Xe.array()).optional(),date:a.object({$gt:a.string()}).or(a.object({$lt:a.string()})).or(a.object({$eq:a.string()})).optional(),expiresAt:a.object({$gt:a.string()}).or(a.object({$lt:a.string()})).or(a.object({$eq:a.string()})).optional(),oneTime:a.boolean().optional()}),wn=a.object({expiresAt:a.string().optional(),oneTime:a.boolean().optional(),terms:Me.optional(),id:a.string(),action:Xe,date:a.string()}),Ya=ve.extend({records:wn.array()});var xn=u(async(r,e)=>{let t=r.id.did();r?.debug?.("Adding LearnCardNetwork Plugin");let n=await pt(e,async c=>{let i=await r.invoke.getDidAuthVp({proofFormat:"jwt",challenge:c});if(typeof i!="string")throw new Error("Error getting DID-Auth-JWT!");return i}),s;try{s=await n.profile.getProfile.query()}catch(c){r.debug?.("No profile!",c)}let o=s?.did||t;return{name:"LearnCard Network",displayName:"LearnCard Network",description:"LearnCard Network Integration",id:{did:(c,i)=>!i||i==="web"?o:r.id.did(i),keypair:(c,i)=>r.id.keypair(i)},read:{get:async(c,i)=>{if(c.debug?.("learnCard.read['LearnCard Network'].get"),!i)return;let l=i.split(":");if(l.length!==5)return;let[d,p]=l;if(!(d!=="lc"||p!=="network"))try{let b=await n.storage.resolve.query({uri:i});return"ciphertext"in b&&(b=await c.invoke.getDIDObject().decryptDagJWE(b)),await Te.or(et).parseAsync(b)}catch(b){c.debug?.(b);return}}},store:{upload:async(c,i)=>(c.debug?.("learnCard.store['LearnCard Network'].upload"),n.storage.store.mutate({item:i})),uploadEncrypted:async(c,i,{recipients:l=[]}={recipients:[]})=>{c.debug?.("learnCard.store['LearnCard Network'].upload");let d=await c.invoke.getDIDObject().createDagJWE(i,[c.id.did(),...l]);return n.storage.store.mutate({item:d})}},methods:{createProfile:async(c,i)=>{if(s)throw new Error("Account already exists!");let l=await n.profile.createProfile.mutate(i);return s=await n.profile.getProfile.query(),o=l,l},createServiceProfile:async(c,i)=>{if(s)throw new Error("Account already exists!");let l=await n.profile.createServiceProfile.mutate(i);return s=await n.profile.getProfile.query(),o=l,l},updateProfile:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return await n.profile.updateProfile.mutate(i)?(s=await n.profile.getProfile.query(),!0):!1},deleteProfile:async()=>{if(!s)throw new Error("Account does not exist!");return await n.profile.deleteProfile.mutate()?(s=void 0,!0):!1},getProfile:async(c,i)=>i?n.profile.getOtherProfile.query({profileId:i}):n.profile.getProfile.query(),searchProfiles:async(c,i="",{limit:l=25,includeSelf:d=!1,includeConnectionStatus:p=!1,includeServiceProfiles:b=!1}={})=>n.profile.searchProfiles.query({input:i,limit:l,includeSelf:d,includeConnectionStatus:p,includeServiceProfiles:b}),connectWith:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectWith.mutate({profileId:i})},cancelConnectionRequest:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.cancelConnectionRequest.mutate({profileId:i})},connectWithInvite:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectWithInvite.mutate({profileId:i,challenge:l})},disconnectWith:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.disconnectWith.mutate({profileId:i})},acceptConnectionRequest:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.acceptConnectionRequest.mutate({profileId:i})},getConnections:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.connections.query()},getPendingConnections:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.pendingConnections.query()},getConnectionRequests:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.connectionRequests.query()},generateInvite:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.generateInvite.mutate({challenge:i,expiration:l})},blockProfile:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.blockProfile.mutate({profileId:i})},unblockProfile:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.profile.unblockProfile.mutate({profileId:i})},getBlockedProfiles:async()=>{if(!s)throw new Error("Please make an account first!");return n.profile.blocked.query()},sendCredential:async(c,i,l,d=!0)=>{if(!s)throw new Error("Please make an account first!");if(!d)return n.credential.sendCredential.mutate({profileId:i,credential:l});let p=await c.invoke.getProfile(i);if(!p)throw new Error("Could not find target account");let b=await c.invoke.getDIDObject().createDagJWE(l,[s.did,p.did]);return n.credential.sendCredential.mutate({profileId:i,credential:b})},acceptCredential:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.acceptCredential.mutate({uri:i})},getReceivedCredentials:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.receivedCredentials.query({from:i})},getSentCredentials:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.sentCredentials.query({to:i})},getIncomingCredentials:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.incomingCredentials.query({from:i})},deleteCredential:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.credential.deleteCredential.mutate({uri:i})},sendPresentation:async(c,i,l,d=!0)=>{if(!s)throw new Error("Please make an account first!");if(!d)return n.presentation.sendPresentation.mutate({profileId:i,presentation:l});let p=await c.invoke.getProfile(i);if(!p)throw new Error("Could not find target account");let b=await c.invoke.getDIDObject().createDagJWE(l,[s.did,p.did]);return n.presentation.sendPresentation.mutate({profileId:i,presentation:b})},acceptPresentation:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.acceptPresentation.mutate({uri:i})},getReceivedPresentations:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.receivedPresentations.query({from:i})},getSentPresentations:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.sentPresentations.query({to:i})},getIncomingPresentations:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.incomingPresentations.query({from:i})},deletePresentation:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.presentation.deletePresentation.mutate({uri:i})},createBoost:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.createBoost.mutate({credential:i,...l})},getBoost:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoost.query({uri:i})},getBoosts:async()=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoosts.query()},getBoostRecipients:async(c,i,l=25,d=void 0,p=!0)=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoostRecipients.query({uri:i,limit:l,skip:d,includeUnacceptedBoosts:p})},updateBoost:async(c,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.boost.updateBoost.mutate({uri:i,updates:{credential:d,...l}})},getBoostAdmins:async(c,i,l={})=>{if(!s)throw new Error("Please make an account first!");return n.boost.getBoostAdmins.query({uri:i,...l})},addBoostAdmin:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.addBoostAdmin.mutate({uri:i,profileId:l})},removeBoostAdmin:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.removeBoostAdmin.mutate({uri:i,profileId:l})},deleteBoost:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.boost.deleteBoost.mutate({uri:i})},sendBoost:async(c,i,l,d=!0)=>{if(!s)throw new Error("Please make an account first!");let p=await c.invoke.resolveFromLCN(l),b=await ge.spa(p);if(!b.success)throw new Error("Did not get a valid boost from URI");let C=await c.invoke.getProfile(i);if(!C)throw new Error("Target profile not found");let T=b.data;T.issuanceDate=new Date().toISOString(),T.issuer=c.id.did(),Array.isArray(T.credentialSubject)?T.credentialSubject=T.credentialSubject.map(B=>({...B,id:C.did})):T.credentialSubject.id=C.did,T?.type?.includes("BoostCredential")&&(T.boostId=l);let S=await c.invoke.issueCredential(T);if(!d)return n.boost.sendBoost.mutate({profileId:i,uri:l,credential:S});let q=await n.utilities.getDid.query(),ue=await c.invoke.getDIDObject().createDagJWE(S,[s.did,C.did,q]);return n.boost.sendBoost.mutate({profileId:i,uri:l,credential:ue})},registerSigningAuthority:async(c,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.profile.registerSigningAuthority.mutate({endpoint:i,name:l,did:d})},getRegisteredSigningAuthorities:async(c,i,l,d)=>{if(!s)throw new Error("Please make an account first!");return n.profile.signingAuthorities.query()},getRegisteredSigningAuthority:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.profile.signingAuthority.query({endpoint:i,name:l})},generateClaimLink:async(c,i,l,d,p)=>{if(!s)throw new Error("Please make an account first!");return n.boost.generateClaimLink.mutate({boostUri:i,claimLinkSA:l,options:d,challenge:p})},claimBoostWithLink:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.boost.claimBoostWithLink.mutate({boostUri:i,challenge:l})},createContract:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.createConsentFlowContract.mutate(i)},getContract:async(c,i)=>n.contracts.getConsentFlowContract.query({uri:i}),getContracts:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentFlowContracts.query(i)},deleteContract:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.deleteConsentFlowContract.mutate({uri:i})},getConsentFlowData:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentedDataForContract.query({uri:i,...l})},consentToContract:async(c,i,{terms:l,expiresAt:d,oneTime:p})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.consentToContract.mutate({contractUri:i,terms:l,expiresAt:d,oneTime:p})},getConsentedContracts:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getConsentedContracts.query(i)},updateContractTerms:async(c,i,{terms:l,expiresAt:d,oneTime:p})=>{if(!s)throw new Error("Please make an account first!");return n.contracts.updateConsentedContractTerms.mutate({uri:i,terms:l,expiresAt:d,oneTime:p})},withdrawConsent:async(c,i)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.withdrawConsent.mutate({uri:i})},getConsentFlowTransactions:async(c,i,l)=>{if(!s)throw new Error("Please make an account first!");return n.contracts.getTermsTransactionHistory.query({uri:i,...l})},verifyConsent:async(c,i,l)=>n.contracts.verifyConsent.query({uri:i,profileId:l}),resolveFromLCN:async(c,i)=>{let l=await n.storage.resolve.query({uri:i});return ge.or(Te).or(et).or(tt).or(rt).or(Me).parseAsync(l)}}}},"getLearnCardNetworkPlugin"),Cn=u(async(r,e)=>{let t=[{id:"LearnCard Network",url:"https://network.learncard.com",did:"did:web:network.learncard.com"}],n;if(e){let c=await fetch(e);c.status===200?n=JSON.parse(await c.text()):n=t}else n=t;let s=u(c=>{if(!!c)return typeof c=="string"?c:"id"in c&&typeof c.id=="string"?c.id:void 0},"getIssuerDID"),o=u(c=>{let i=s(c);if(!!i)return n.find(l=>l.did===i)},"getTrustedBoostVerifier");return{name:"VerifyBoost",displayName:"Verify Boost Extension",description:"Adds a check for validating Boost Credentials.",methods:{verifyCredential:async(c,i,l)=>{let d=await r.invoke.verifyCredential(i,l),p=i?.boostCredential;try{if(p){let b=await r.invoke.verifyCredential(p);if(!p?.boostId&&!i?.boostId&&d.warnings.push("Boost Authenticity could not be verified: Boost ID metadata is missing."),b.errors?.length>0)d.errors=[...b.errors||[],...d.errors||[],"Boost Credential could not be verified."];else if(p?.boostId!==i?.boostId)d.errors.push("Boost Authenticity could not be verified: Boost ID metadata is mismatched.");else{let C=o(i?.issuer);C?d.checks.push(`Boost is Authentic. Verified by ${C.id}.`):d.warnings.push(`Boost Authenticity could not be verified. Issuer is outside of trust network: ${s(i?.issuer)}`)}}}catch{d.errors.push("Boost authenticity could not be verified.")}return d}}}},"getVerifyBoostPlugin");
2
2
  /* istanbul ignore if -- @preserve */
3
3
  /* istanbul ignore next -- @preserve */
4
4
  //# sourceMappingURL=lcn-plugin.cjs.production.min.js.map