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