@learncard/did-web-plugin 1.0.0 → 1.0.1

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.
@@ -656,7 +656,7 @@ ${t.stack}`:n}s(Gb,"debugString");c(Gb,"debugString");function uR(t,e,r,n){let i
656
656
  background-color: transparent;
657
657
  }`)),this.container=document.createElement("div"),wb(this.container,{position:"relative",width:"100%",height:"100%",margin:0,padding:0,display:"flex","flex-direction":"column"}),this.container.className="web-app-window-backdrop",this.iframe=document.createElement("iframe"),this.iframe.src=t,this.iframe.scrolling="auto",wb(this.iframe,{position:"fixed",top:0,left:0,width:"100%",height:"100%",border:"none",background:"transparent",overflow:"hidden",margin:0,padding:0,"flex-grow":1,"user-select":"none"}),this.dialog.appendChild(n),this.container.appendChild(this.iframe),this.dialog.appendChild(this.container),this.dialog.addEventListener("cancel",i=>{i.preventDefault(),this.hide()}),document.body.appendChild(this.dialog),this.handle=this.iframe.contentWindow}show(){this.dialog.style.display="block",this.dialog.showModal&&this.dialog.showModal();try{this.dialog.style.pointerEvents="none"}catch{}setTimeout(()=>{try{this.dialog.style.pointerEvents=""}catch{}},32)}close(){if(this.dialog.style.display="none",this.dialog.close)try{this.dialog.close()}catch(t){console.error(t)}super.close()}destroy(){this.dialog.parentNode.removeChild(this.dialog),super.destroy()}},"WebAppWindowInlineDialog");c(jR,"WebAppWindowInlineDialog");function wb(t,e){for(let r in e)t.style[r]=e[r]}s(wb,"applyStyle");c(wb,"applyStyle");var qR=s(class extends Ry{constructor({url:t,handle:e,bounds:r={width:500,height:400}}){super(),this.url=t,this.handle=e,this._locationChanging=!1,e||this._openWindow({url:t,name:"web-app-window",bounds:r}),this.destroyed=!1,this._removeListeners=()=>{}}show(){}close(){this.destroy()}destroy(){this.handle&&!this.destroyed&&(this.handle.close(),super.close(),this.handle=null,this.destroyed=!0,this._removeListeners(),super.destroy())}isClosed(){return!this.handle||this.handle.closed}_openWindow({url:t,name:e,bounds:r}){let{x:n,y:i}=r,{width:o=500,height:a=400}=r;o=Math.min(o,window.innerWidth),a=Math.min(a,window.innerHeight);let f=Math.floor(n!==void 0?n:window.screenX+(window.innerWidth-o)/2),l=Math.floor(i!==void 0?i:window.screenY+(window.innerHeight-a)/2),d=`popup=yes,menubar=no,location=no,resizable=no,scrollbars=no,status=no,width=${o},height=${a},left=${f},top=${l}`;this._locationChanging=!0,this.handle=window.open(t,e,d),this._addListeners()}setLocation(t){this.url=t,this._locationChanging=!0,this.handle.location.replace(t)}_addListeners(){let t=c(()=>this.destroy(),"destroyDialog"),e=c(()=>{this._locationChanging=!1},"loadDialog"),r=c(()=>{this._locationChanging||this.destroy()},"unloadDialog");this.handle.addEventListener("unload",r),this.handle.addEventListener("load",e),window.addEventListener("beforeUnload",t,{once:!0});let n=setInterval(()=>{this.isClosed()&&(this.destroy(),clearInterval(n))},250);this._removeListeners=()=>{clearInterval(n),this.handle.removeListener("unload",r),this.handle.removeListener("load",e),window.removeEventListener("beforeUnload",t)}}},"WebAppWindowPopupDialog");c(qR,"WebAppWindowPopupDialog");var iW=6e4,Qg=s(class{constructor(t,{timeout:e=iW,dialog:r=null,handle:n,popup:i=!1,className:o=null,customize:a=null,bounds:f}={}){if(this.visible=!1,this.dialog=r,this.handle=null,this.popup=i,this.windowControl=null,this._destroyed=!1,this._ready=!1,this._private={},this._timeoutId=null,n&&n._dialog&&(this.dialog=r=n._dialog),this._private._readyPromise=new Promise((l,d)=>{this._timeoutId=setTimeout(()=>d(new DOMException("Loading Web application window timed out.","TimeoutError")),e),this._private._resolveReady=p=>{clearTimeout(this.timeoutId),this._timeoutId=null,l(p)},this._private._rejectReady=p=>{clearTimeout(this.timeoutId),this._timeoutId=null,d(p)}}),this._private.isReady=async()=>this._private._readyPromise,this._private.destroy=()=>{this._timeoutId&&this._private._rejectReady(new DOMException("Web application window closed before ready.","AbortError")),this._destroyed||(this.dialog.destroy(),this.dialog=null,this._destroyed=!0)},a&&!typeof a==="function")throw new TypeError("`options.customize` must be a function.");if(this.dialog||(this.popup?this.dialog=new qR({url:t,handle:n,bounds:f}):this.dialog=new jR({url:t,handle:n,className:o})),this.popup&&f){let{x:l,y:d,width:p=500,height:g=400}=f;p=Math.min(p,window.innerWidth),g=Math.min(g+30,window.innerHeight),l=Math.floor(l!==void 0?l:window.screenX+(window.innerWidth-p)/2),d=Math.floor(d!==void 0?d:window.screenY+(window.innerHeight-g)/2+15),this.dialog.handle.resizeTo(p,g),this.dialog.handle.moveTo(l,d)}if(this.handle=this.dialog.handle,a)try{a({dialog:this.dialog.dialog,container:this.dialog.container,iframe:this.dialog.iframe,webAppWindow:this})}catch(l){console.error(l)}}ready(){this._ready=!0,this._private._resolveReady(!0)}show(){if(!this.visible){this.visible=!0;let t=document.querySelector("body");this._bodyOverflowStyle=t.style.overflow,t.style.overflow="hidden",this._destroyed?this.windowControl.show&&this.windowControl.show():this.dialog.show()}}hide(){if(this.visible){this.visible=!1;let t=document.querySelector("body");this._bodyOverflowStyle?t.style.overflow=this._bodyOverflowStyle:t.style.overflow="",this._destroyed?this.windowControl.hide&&this.windowControl.hide():this.dialog.close()}}},"WebAppWindow");c(Qg,"WebAppWindow");var sW=1e4,By=s(class{constructor(){this.client=new ky,this.server=new Ty,this.injector=null,this.control=null,this.loaded=!1,this.closed=!1}async createWindow(t,{timeout:e=sW,iframe:r,dialog:n=null,popup:i=!1,handle:o,windowControl:a,className:f,customize:l,bounds:d}={}){if(this.loaded)throw new Error("AppContext already loaded.");this.loaded=!0,this.control=new Qg(t,{timeout:e,dialog:n,iframe:r,popup:i,handle:o,windowControl:a,className:f,customize:l,bounds:d}),window.addEventListener("pagehide",()=>this.close(),{once:!0}),this.server.define("core.control",this.control);let p=E1(t).origin;return this.server.listen(p,{handle:this.control.handle,ignoreUnknownApi:!0}),await this.control._private.isReady(),this.injector=await this.client.connect(p,{handle:this.control.handle}),this.injector}close(){this.closed||(this.closed=!0,this.control._private.destroy(),this.server.close(),this.client.close())}},"WebAppContext");c(By,"WebAppContext");var HR=s(class{constructor({credentialHandler:t,credentialRequestOrigin:e,credentialRequestOptions:r,hintKey:n}){this.type="credentialrequest",this._credentialHandler=t,this.credentialRequestOrigin=e,this.credentialRequestOptions=r,this.hintKey=n}async openWindow(t){await this._credentialHandler.show();let e=new Qg(t,{className:"credential-handler"});return e.ready(),e.show(),e.handle._dialog=e.dialog,e.handle}respondWith(t){this._promise=t}},"CredentialRequestEvent");c(HR,"CredentialRequestEvent");var zR=s(class{constructor({credentialHandler:t,credentialRequestOrigin:e,credential:r,hintKey:n}){this.type="credentialstore",this._credentialHandler=t,this.credentialRequestOrigin=e,this.credential=r,this.hintKey=n}async openWindow(t){await this._credentialHandler.show();let e=new Qg(t);return e.ready(),e.show(),e.handle._dialog=e.dialog,e.handle}respondWith(t){this._promise=t}},"CredentialStoreEvent");c(zR,"CredentialStoreEvent");var $R=s(class{constructor(t){this._credentialHandler=t}async request(t){return await this._credentialHandler._emitter.emit(new HR(Object.assign({credentialHandler:this._credentialHandler},t)))}async store(t){return await this._credentialHandler._emitter.emit(new zR(Object.assign({credentialHandler:this._credentialHandler},t)))}},"CredentialHandlerService");c($R,"CredentialHandlerService");var xk=["credentialrequest","credentialstore"],GR=s(class extends My{constructor(t,e=!1){if(typeof t!="string")throw new TypeError('"mediatorOrigin" must be a string.');super(t,e),this._emitter=new UR({async waitUntil(r){return r._promise||Promise.reject(new DOMException('No "credentialrequest" event handler found.',"NotFoundError"))}})}async connect(){let t=await super.connect();return this.server.define("credentialHandler",new $R(this)),await this.ready(),t}addEventListener(t,e){if(!xk.includes(t))throw new DOMException(`Unsupported event type "${t}"`,"NotSupportedError");return this._emitter.addEventListener(t,e)}removeEventListener(t,e){if(!xk.includes(t))throw new DOMException(`Unsupported event type "${t}"`,"NotSupportedError");return this._emitter.removeEventListener(t,e)}},"CredentialHandler");c(GR,"CredentialHandler");var KR=s(class{constructor(t,e){let r=e.get("credentialHints",{functions:["delete","get","keys","has","set","clear"]});for(let n in r)if(n!=="set"){let i=r[n].bind(this,t);this[n]=function(...o){return this._deprecateNotice(),i(...o)}}this._remoteSet=r.set.bind(this,t)}async set(t,e){this._deprecateNotice(),e.icons=e.icons||[];let r=e.icons.map(n=>VR(n.src).then(i=>{n.fetchedImage=i}));return await Promise.all(r),this._remoteSet(t,e)}_deprecateNotice(){console.warn("Credential hints are deprecated and no longer used.")}},"CredentialHints");c(KR,"CredentialHints");function VR(t){return new Promise(e=>{let r=new Image;r.crossOrigin="Anonymous",r.onload=()=>{let n=document.createElement("canvas"),i=n.getContext("2d");n.height=r.height,n.width=r.width,i.drawImage(r,0,0);let o=n.toDataURL();e(o),n=null},r.onerror=()=>e(null),r.src=t})}s(VR,"imageToDataUrl");c(VR,"imageToDataUrl");var Kb=s(class{constructor(t,e){if(!(t&&typeof t=="string"))throw new TypeError('"url" must be a non-empty string.');this.hints=new KR(t,e)}static async requestPermission(){return(await navigator.credentialsPolyfill.permissions.request({name:"credentialhandler"})).state}},"CredentialManager");c(Kb,"CredentialManager");var U4=s(class{constructor(t,e){if(!(t&&typeof t=="string"))throw new TypeError('"url" must be a non-empty string.');this.credentialManager=new Kb(t,e)}},"CredentialHandlerRegistration");c(U4,"CredentialHandlerRegistration");var WR=s(class{constructor(t){this._init=(async()=>{this._injector=await t,this._remote=this._injector.get("credentialHandlers",{functions:["register","unregister","getRegistration","hasRegistration"]})})()}async register(t){return this._deprecateNotice(),await this._init,t=await this._remote.register("credential",t),new U4(t,this._injector)}async unregister(t){return this._deprecateNotice(),await this._init,this._remote.unregister("credential",t)}async getRegistration(t){return this._deprecateNotice(),await this._init,t=await this._remote.getRegistration("credential",t),t?new U4(t,this._injector):null}async hasRegistration(t){return this._deprecateNotice(),await this._init,await this._remote.hasRegistration("credential",t)}_deprecateNotice(){console.warn('Credential handler registration APIs are deprecated. The credential handler specified in "manifest.json" is now automatically registered when a user grants permission to install a credential handler via "CredentialManager.requestPermission()".')}},"CredentialHandlers");c(WR,"CredentialHandlers");var qu=s(class{constructor(t,e,{recommendedHandlerOrigins:r=[]}={}){if(typeof t!="string")throw new TypeError('"dataType" must be a string.');this.type="web",this.dataType=t,this.data=e,this.options={recommendedHandlerOrigins:r}}},"WebCredential2");c(qu,"WebCredential");var oW=0,aW=0,JR=s(class{constructor(t){this._nativeCredentialsContainer={get:navigator.credentials&&navigator.credentials.get&&navigator.credentials.get.bind(navigator.credentials),store:navigator.credentials&&navigator.credentials.store&&navigator.credentials.store.bind(navigator.credentials)},this._init=(async()=>{this._remote=(await t).get("credentialsContainer",{functions:[{name:"get",options:{timeout:oW}},{name:"store",options:{timeout:aW}}]})})()}async get(t={}){if(t.web){await this._init;let e=await this._remote.get(t);return e?new qu(e.dataType,e.data):null}if(this._nativeCredentialsContainer.get)return this._nativeCredentialsContainer.get(t);throw new DOMException("Not implemented.","NotSupportedError")}async store(t){if(t instanceof qu){await this._init;let e=await this._remote.store(t);return e?new qu(e.dataType,e.data):null}if(this._nativeCredentialsContainer.store)return this._nativeCredentialsContainer.store(t);throw new DOMException("Not implemented.","NotSupportedError")}},"CredentialsContainer");c(JR,"CredentialsContainer");var cW=0,YR=s(class{constructor(t){this._init=(async()=>{this._remote=(await t).get("permissionManager",{functions:["query",{name:"request",options:{timeout:cW}},"revoke"]})})()}async query(t){return await this._init,await this._remote.query(t)}async request(t){return await this._init,await this._remote.request(t)}async revoke(t){return await this._init,await this._remote.revoke(t)}},"PermissionManager");c(YR,"PermissionManager");var fW="https://authn.io",d4;async function XR(t){return d4||(d4=!0,ZR(t))}s(XR,"loadOnce");c(XR,"loadOnce");async function ZR(t={mediatorOrigin:fW}){QR();let e;if(typeof t=="string")e=t;else if(t&&typeof t=="object"&&typeof t.mediatorOrigin=="string")e=`${t.mediatorOrigin}/mediator`;else throw new Error('"options.mediatorOrigin" must be a string expressing the origin of the mediator.');let n=new By().createWindow(e,{className:"credential-mediator",timeout:3e4}),i=document.createElement("style");i.appendChild(document.createTextNode(`dialog.web-app-window.credential-mediator > .web-app-window-backdrop {
658
658
  background-color: rgba(0, 0, 0, 0.25);
659
- }`)),document.body.appendChild(i);let o={};return o.permissions=new YR(n),o.CredentialHandlers=new WR(n),o.CredentialHandler=GR,o.CredentialManager=Kb,o.credentials=new JR(n),o.WebCredential=qu,navigator.credentialsPolyfill=o,"credentials"in navigator?(navigator.credentials.get=o.credentials.get.bind(o.credentials),navigator.credentials.store=o.credentials.store.bind(o.credentials)):navigator.credentials=o.credentials,window.CredentialManager=Kb,window.WebCredential=qu,o}s(ZR,"load2");c(ZR,"load");function QR(){if(!window.isSecureContext)throw new DOMException("SecurityError","The operation is insecure.")}s(QR,"_assertSecureContext");c(QR,"_assertSecureContext");var lW=6e4,eB=s(class extends My{constructor(){super(window.location.origin)}async receive(){let t=this;return await t.connect(),new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("Timed out waiting to receive event."))},lW);t.server.define("credentialEventProxy",{async send(i){return e(i),clearTimeout(n),new Promise((o,a)=>{i.respondWith=f=>{try{o(f)}catch(l){a(l)}}})}}),t.ready()})}},"CredentialEventProxy");c(eB,"CredentialEventProxy");var uW="https://authn.io";async function tB(){if(await navigator.credentialsPolyfill.CredentialManager.requestPermission()!=="granted")throw new Error("Permission denied.")}s(tB,"installHandler");c(tB,"installHandler");async function rB({mediatorOrigin:t=uW,get:e,store:r}){if(!(e||r))throw new Error('"get" or "store" function(s) must be specified.');let n=navigator.credentialsPolyfill.CredentialHandler,i=new n(t);if(e){if(typeof e!="function")throw new TypeError('"get" must be a function.');i.addEventListener("credentialrequest",o=>j4({event:o,get:e}))}if(r){if(typeof r!="function")throw new TypeError('"store" must be a function.');i.addEventListener("credentialstore",o=>j4({event:o,store:r}))}await i.connect()}s(rB,"activateHandler");c(rB,"activateHandler");async function nB(){return new eB().receive()}s(nB,"receiveCredentialEvent");c(nB,"receiveCredentialEvent");function j4({event:t,get:e,store:r}){t.respondWith(iB({event:t,get:e,store:r}))}s(j4,"listener");c(j4,"listener");async function iB({event:t,get:e,store:r}){let n=await(e||r)({event:t});if(!(n&&typeof n=="object"))throw new TypeError('Return value of "get" or "store" hook must be an object.');if(n.type==="response")return{dataType:n.dataType,data:n.data};if(n.type==="redirect"){let i=new By,o=await t.openWindow(n.url);return(await i.createWindow(n.url,{handle:o,popup:!1,timeout:6e5})).get("credentialEventProxy",{functions:[{name:"send",options:{timeout:0}}]}).send({type:t.type,credentialRequestOptions:t.credentialRequestOptions,credentialRequestOrigin:t.credentialRequestOrigin,credential:t.credential,hintKey:t.hintKey})}throw new Error('Return value of "get" or "store" must have a type of "response" or "redirect".')}s(iB,"createResponse");c(iB,"createResponse");var Dy=c(async()=>typeof window>"u"?{name:"CHAPI",methods:{installChapiHandler:async()=>{throw new Error("CHAPI is only available inside of a browser!")},activateChapiHandler:async()=>{throw new Error("CHAPI is only available inside of a browser!")},receiveChapiEvent:async()=>{throw new Error("CHAPI is only available inside of a browser!")},storeCredentialViaChapiDidAuth:async()=>{throw new Error("CHAPI is only available inside of a browser!")},storePresentationViaChapi:async()=>{throw new Error("CHAPI is only available inside of a browser!")}}}:(await XR(),{name:"CHAPI",displayName:"CHAPI",description:"Credential Handler API. Allows sending/retrieving credentials across wallets and issuers",methods:{installChapiHandler:async()=>tB(),activateChapiHandler:async(t,{mediatorOrigin:e=`https://authn.io/mediator?${encodeURIComponent(window.location.origin)}`,get:r,store:n})=>rB({mediatorOrigin:e,get:r,store:n}),receiveChapiEvent:async()=>nB(),storeCredentialViaChapiDidAuth:async(t,e)=>{let r=crypto.randomUUID(),n=window.location.origin,i={web:{VerifiablePresentation:{query:{type:"DIDAuthentication"},challenge:r,domain:n}}},o=await navigator.credentials.get(i);if(!o)return{success:!1,reason:"did not auth"};let a=await t.invoke.verifyPresentation(o.data,{challenge:r,domain:n,proofPurpose:"authentication"});if(a.warnings.length>0||a.errors.length>0)return{success:!1,reason:"auth failed verification"};let f=o.data?.proof?.verificationMethod?.split("#")[0];Array.isArray(e.credentialSubject)||(e.credentialSubject.id=f);let l=await t.invoke.getTestVp(await t.invoke.issueCredential(e));return await t.invoke.storePresentationViaChapi(l)?{success:!0}:{success:!1,reason:"did not store"}},storePresentationViaChapi:async(t,e)=>{let r=new WebCredential("VerifiablePresentation",e);return window.navigator.credentials.store(r)}}}),"getCHAPIPlugin"),wr;(function(t){t.assertEqual=i=>i;function e(i){}s(e,"assertIs"),c(e,"assertIs"),t.assertIs=e;function r(i){throw new Error}s(r,"assertNever"),c(r,"assertNever"),t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let a of i)o[a]=a;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(f=>typeof i[i[f]]!="number"),a={};for(let f of o)a[f]=i[f];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},t.find=(i,o)=>{for(let a of i)if(o(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}s(n,"joinValues"),c(n,"joinValues"),t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(wr||(wr={}));var vt=wr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$c=c(t=>{switch(typeof t){case"undefined":return vt.undefined;case"string":return vt.string;case"number":return isNaN(t)?vt.nan:vt.number;case"boolean":return vt.boolean;case"function":return vt.function;case"bigint":return vt.bigint;case"symbol":return vt.symbol;case"object":return Array.isArray(t)?vt.array:t===null?vt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?vt.promise:typeof Map<"u"&&t instanceof Map?vt.map:typeof Set<"u"&&t instanceof Set?vt.set:typeof Date<"u"&&t instanceof Date?vt.date:vt.object;default:return vt.unknown}},"getParsedType"),rt=wr.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"]),dW=c(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),oa=s(class extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){let e=t||function(i){return i.message},r={_errors:[]},n=c(i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)r._errors.push(e(o));else{let a=r,f=0;for(;f<o.path.length;){let l=o.path[f];f===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(e(o))):a[l]=a[l]||{_errors:[]},a=a[l],f++}}},"processError");return n(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,wr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=e=>e.message){let e={},r=[];for(let n of this.issues)n.path.length>0?(e[n.path[0]]=e[n.path[0]]||[],e[n.path[0]].push(t(n))):r.push(t(n));return{formErrors:r,fieldErrors:e}}get formErrors(){return this.flatten()}},"ZodError");c(oa,"ZodError");oa.create=t=>new oa(t);var H0=c((t,e)=>{let r;switch(t.code){case rt.invalid_type:t.received===vt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case rt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,wr.jsonStringifyReplacer)}`;break;case rt.unrecognized_keys:r=`Unrecognized key(s) in object: ${wr.joinValues(t.keys,", ")}`;break;case rt.invalid_union:r="Invalid input";break;case rt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${wr.joinValues(t.options)}`;break;case rt.invalid_enum_value:r=`Invalid enum value. Expected ${wr.joinValues(t.options)}, received '${t.received}'`;break;case rt.invalid_arguments:r="Invalid function arguments";break;case rt.invalid_return_type:r="Invalid function return type";break;case rt.invalid_date:r="Invalid date";break;case rt.invalid_string:typeof t.validation=="object"?"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:wr.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case rt.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(t.minimum)}`:r="Invalid input";break;case rt.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(t.maximum)}`:r="Invalid input";break;case rt.custom:r="Invalid input";break;case rt.invalid_intersection_types:r="Intersection results could not be merged";break;case rt.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case rt.not_finite:r="Number must be finite";break;default:r=e.defaultError,wr.assertNever(t)}return{message:r}},"errorMap"),sB=H0;function oB(t){sB=t}s(oB,"setErrorMap");c(oB,"setErrorMap");function z0(){return sB}s(z0,"getErrorMap");c(z0,"getErrorMap");var Vb=c(t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],a={...i,path:o},f="",l=n.filter(d=>!!d).slice().reverse();for(let d of l)f=d(a,{data:e,defaultError:f}).message;return{...i,path:o,message:i.message||f}},"makeIssue"),hW=[];function At(t,e){let r=Vb({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,z0(),H0].filter(n=>!!n)});t.common.issues.push(r)}s(At,"addIssueToContext");c(At,"addIssueToContext");var Oi=s(class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,e){let r=[];for(let n of e){if(n.status==="aborted")return Ut;n.status==="dirty"&&t.dirty(),r.push(n.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,e){let r=[];for(let n of e)r.push({key:await n.key,value:await n.value});return Oi.mergeObjectSync(t,r)}static mergeObjectSync(t,e){let r={};for(let n of e){let{key:i,value:o}=n;if(i.status==="aborted"||o.status==="aborted")return Ut;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),(typeof o.value<"u"||n.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}},"ParseStatus");c(Oi,"ParseStatus");var Ut=Object.freeze({status:"aborted"}),aB=c(t=>({status:"dirty",value:t}),"DIRTY"),gi=c(t=>({status:"valid",value:t}),"OK"),q4=c(t=>t.status==="aborted","isAborted"),H4=c(t=>t.status==="dirty","isDirty"),Wb=c(t=>t.status==="valid","isValid"),Jb=c(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),or;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(or||(or={}));var _o=s(class{constructor(t,e,r,n){this.parent=t,this.data=e,this._path=r,this._key=n}get path(){return this._path.concat(this._key)}},"ParseInputLazyPath");c(_o,"ParseInputLazyPath");var wk=c((t,e)=>{if(Wb(e))return{success:!0,data:e.value};{if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new oa(t.common.issues);return{success:!1,error:r}}},"handleResult");function Vt(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:c((a,f)=>a.code!=="invalid_type"?{message:f.defaultError}:typeof f.data>"u"?{message:n??f.defaultError}:{message:r??f.defaultError},"customMap"),description:i}}s(Vt,"processCreateParams");c(Vt,"processCreateParams");var er=s(class{constructor(t){this.spa=this.safeParseAsync,this._def=t,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(t){return $c(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:$c(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Oi,ctx:{common:t.parent.common,data:t.data,parsedType:$c(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(Jb(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let r=this.safeParse(t,e);if(r.success)return r.data;throw r.error}safeParse(t,e){var r;let n={common:{issues:[],async:(r=e?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$c(t)},i=this._parseSync({data:t,path:n.path,parent:n});return wk(n,i)}async parseAsync(t,e){let r=await this.safeParseAsync(t,e);if(r.success)return r.data;throw r.error}async safeParseAsync(t,e){let r={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$c(t)},n=this._parse({data:t,path:r.path,parent:r}),i=await(Jb(n)?n:Promise.resolve(n));return wk(r,i)}refine(t,e){let r=c(n=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(n):e,"getIssueProperties");return this._refinement((n,i)=>{let o=t(n),a=c(()=>i.addIssue({code:rt.custom,...r(n)}),"setError");return typeof Promise<"u"&&o instanceof Promise?o.then(f=>f?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,e){return this._refinement((r,n)=>t(r)?!0:(n.addIssue(typeof e=="function"?e(r,n):e),!1))}_refinement(t){return new Ks({schema:this,typeName:Ot.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return aa.create(this,this._def)}nullable(){return Xc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xo.create(this,this._def)}promise(){return il.create(this,this._def)}or(t){return Qu.create([this,t],this._def)}and(t){return ed.create(this,t,this._def)}transform(t){return new Ks({...Vt(this._def),schema:this,typeName:Ot.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t=="function"?t:()=>t;return new id({...Vt(this._def),innerType:this,defaultValue:e,typeName:Ot.ZodDefault})}brand(){return new Fy({typeName:Ot.ZodBranded,type:this,...Vt(this._def)})}catch(t){let e=typeof t=="function"?t:()=>t;return new W0({...Vt(this._def),innerType:this,catchValue:e,typeName:Ot.ZodCatch})}describe(t){let e=this.constructor;return new e({...this._def,description:t})}pipe(t){return S1.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},"ZodType");c(er,"ZodType");var pW=/^c[^\s-]{8,}$/i,mW=/^[a-z][a-z0-9]*$/,bW=/^([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,gW=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|([^-]([a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}))$/,vW=c(t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.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$"):t.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"),oc=s(class extends er{constructor(){super(...arguments),this._regex=(t,e,r)=>this.refinement(n=>t.test(n),{validation:e,code:rt.invalid_string,...or.errToObj(r)}),this.nonempty=t=>this.min(1,or.errToObj(t)),this.trim=()=>new oc({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==vt.string){let i=this._getOrReturnCtx(t);return At(i,{code:rt.invalid_type,expected:vt.string,received:i.parsedType}),Ut}let r=new Oi,n;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(n=this._getOrReturnCtx(t,n),At(n,{code:rt.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(n=this._getOrReturnCtx(t,n),At(n,{code:rt.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let o=t.data.length>i.value,a=t.data.length<i.value;(o||a)&&(n=this._getOrReturnCtx(t,n),o?At(n,{code:rt.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&At(n,{code:rt.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")gW.test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{validation:"email",code:rt.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")bW.test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{validation:"uuid",code:rt.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")pW.test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{validation:"cuid",code:rt.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")mW.test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{validation:"cuid2",code:rt.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),At(n,{validation:"url",code:rt.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{validation:"regex",code:rt.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="startsWith"?t.data.startsWith(i.value)||(n=this._getOrReturnCtx(t,n),At(n,{code:rt.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(n=this._getOrReturnCtx(t,n),At(n,{code:rt.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?vW(i).test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{code:rt.invalid_string,validation:"datetime",message:i.message}),r.dirty()):wr.assertNever(i);return{status:r.value,value:t.data}}_addCheck(t){return new oc({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...or.errToObj(t)})}url(t){return this._addCheck({kind:"url",...or.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...or.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...or.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...or.errToObj(t)})}datetime(t){var e;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(e=t?.offset)!==null&&e!==void 0?e:!1,...or.errToObj(t?.message)})}regex(t,e){return this._addCheck({kind:"regex",regex:t,...or.errToObj(e)})}startsWith(t,e){return this._addCheck({kind:"startsWith",value:t,...or.errToObj(e)})}endsWith(t,e){return this._addCheck({kind:"endsWith",value:t,...or.errToObj(e)})}min(t,e){return this._addCheck({kind:"min",value:t,...or.errToObj(e)})}max(t,e){return this._addCheck({kind:"max",value:t,...or.errToObj(e)})}length(t,e){return this._addCheck({kind:"length",value:t,...or.errToObj(e)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get minLength(){let t=null;for(let e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t}get maxLength(){let t=null;for(let e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t}},"ZodString");c(oc,"ZodString");oc.create=t=>{var e;return new oc({checks:[],typeName:Ot.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Vt(t)})};function cB(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=parseInt(t.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}s(cB,"floatSafeRemainder");c(cB,"floatSafeRemainder");var Jc=s(class extends er{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==vt.number){let i=this._getOrReturnCtx(t);return At(i,{code:rt.invalid_type,expected:vt.number,received:i.parsedType}),Ut}let r,n=new Oi;for(let i of this._def.checks)i.kind==="int"?wr.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),At(r,{code:rt.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),At(r,{code:rt.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),At(r,{code:rt.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?cB(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),At(r,{code:rt.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),At(r,{code:rt.not_finite,message:i.message}),n.dirty()):wr.assertNever(i);return{status:n.value,value:t.data}}gte(t,e){return this.setLimit("min",t,!0,or.toString(e))}gt(t,e){return this.setLimit("min",t,!1,or.toString(e))}lte(t,e){return this.setLimit("max",t,!0,or.toString(e))}lt(t,e){return this.setLimit("max",t,!1,or.toString(e))}setLimit(t,e,r,n){return new Jc({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:or.toString(n)}]})}_addCheck(t){return new Jc({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:or.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:or.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:or.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:or.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:or.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:or.toString(e)})}finite(t){return this._addCheck({kind:"finite",message:or.toString(t)})}get minValue(){let t=null;for(let e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t}get maxValue(){let t=null;for(let e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&wr.isInteger(t.value))}get isFinite(){let t=null,e=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(e===null||r.value>e)&&(e=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(e)&&Number.isFinite(t)}},"ZodNumber");c(Jc,"ZodNumber");Jc.create=t=>new Jc({checks:[],typeName:Ot.ZodNumber,coerce:t?.coerce||!1,...Vt(t)});var Ju=s(class extends er{_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==vt.bigint){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.bigint,received:r.parsedType}),Ut}return gi(t.data)}},"ZodBigInt");c(Ju,"ZodBigInt");Ju.create=t=>{var e;return new Ju({typeName:Ot.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Vt(t)})};var Yu=s(class extends er{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==vt.boolean){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.boolean,received:r.parsedType}),Ut}return gi(t.data)}},"ZodBoolean");c(Yu,"ZodBoolean");Yu.create=t=>new Yu({typeName:Ot.ZodBoolean,coerce:t?.coerce||!1,...Vt(t)});var tl=s(class extends er{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==vt.date){let i=this._getOrReturnCtx(t);return At(i,{code:rt.invalid_type,expected:vt.date,received:i.parsedType}),Ut}if(isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return At(i,{code:rt.invalid_date}),Ut}let r=new Oi,n;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(n=this._getOrReturnCtx(t,n),At(n,{code:rt.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(n=this._getOrReturnCtx(t,n),At(n,{code:rt.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):wr.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new tl({...this._def,checks:[...this._def.checks,t]})}min(t,e){return this._addCheck({kind:"min",value:t.getTime(),message:or.toString(e)})}max(t,e){return this._addCheck({kind:"max",value:t.getTime(),message:or.toString(e)})}get minDate(){let t=null;for(let e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t!=null?new Date(t):null}},"ZodDate");c(tl,"ZodDate");tl.create=t=>new tl({checks:[],coerce:t?.coerce||!1,typeName:Ot.ZodDate,...Vt(t)});var $0=s(class extends er{_parse(t){if(this._getType(t)!==vt.symbol){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.symbol,received:r.parsedType}),Ut}return gi(t.data)}},"ZodSymbol");c($0,"ZodSymbol");$0.create=t=>new $0({typeName:Ot.ZodSymbol,...Vt(t)});var Xu=s(class extends er{_parse(t){if(this._getType(t)!==vt.undefined){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.undefined,received:r.parsedType}),Ut}return gi(t.data)}},"ZodUndefined");c(Xu,"ZodUndefined");Xu.create=t=>new Xu({typeName:Ot.ZodUndefined,...Vt(t)});var Zu=s(class extends er{_parse(t){if(this._getType(t)!==vt.null){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.null,received:r.parsedType}),Ut}return gi(t.data)}},"ZodNull");c(Zu,"ZodNull");Zu.create=t=>new Zu({typeName:Ot.ZodNull,...Vt(t)});var rl=s(class extends er{constructor(){super(...arguments),this._any=!0}_parse(t){return gi(t.data)}},"ZodAny");c(rl,"ZodAny");rl.create=t=>new rl({typeName:Ot.ZodAny,...Vt(t)});var Gc=s(class extends er{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gi(t.data)}},"ZodUnknown");c(Gc,"ZodUnknown");Gc.create=t=>new Gc({typeName:Ot.ZodUnknown,...Vt(t)});var ca=s(class extends er{_parse(t){let e=this._getOrReturnCtx(t);return At(e,{code:rt.invalid_type,expected:vt.never,received:e.parsedType}),Ut}},"ZodNever");c(ca,"ZodNever");ca.create=t=>new ca({typeName:Ot.ZodNever,...Vt(t)});var G0=s(class extends er{_parse(t){if(this._getType(t)!==vt.undefined){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.void,received:r.parsedType}),Ut}return gi(t.data)}},"ZodVoid");c(G0,"ZodVoid");G0.create=t=>new G0({typeName:Ot.ZodVoid,...Vt(t)});var xo=s(class extends er{_parse(t){let{ctx:e,status:r}=this._processInputParams(t),n=this._def;if(e.parsedType!==vt.array)return At(e,{code:rt.invalid_type,expected:vt.array,received:e.parsedType}),Ut;if(n.exactLength!==null){let o=e.data.length>n.exactLength.value,a=e.data.length<n.exactLength.value;(o||a)&&(At(e,{code:o?rt.too_big:rt.too_small,minimum:a?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&e.data.length<n.minLength.value&&(At(e,{code:rt.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&e.data.length>n.maxLength.value&&(At(e,{code:rt.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),e.common.async)return Promise.all([...e.data].map((o,a)=>n.type._parseAsync(new _o(e,o,e.path,a)))).then(o=>Oi.mergeArray(r,o));let i=[...e.data].map((o,a)=>n.type._parseSync(new _o(e,o,e.path,a)));return Oi.mergeArray(r,i)}get element(){return this._def.type}min(t,e){return new xo({...this._def,minLength:{value:t,message:or.toString(e)}})}max(t,e){return new xo({...this._def,maxLength:{value:t,message:or.toString(e)}})}length(t,e){return new xo({...this._def,exactLength:{value:t,message:or.toString(e)}})}nonempty(t){return this.min(1,t)}},"ZodArray");c(xo,"ZodArray");xo.create=(t,e)=>new xo({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ot.ZodArray,...Vt(e)});var Yb;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Yb||(Yb={}));function Vf(t){if(t instanceof rn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=aa.create(Vf(n))}return new rn({...t._def,shape:()=>e})}else return t instanceof xo?xo.create(Vf(t.element)):t instanceof aa?aa.create(Vf(t.unwrap())):t instanceof Xc?Xc.create(Vf(t.unwrap())):t instanceof fa?fa.create(t.items.map(e=>Vf(e))):t}s(Vf,"deepPartialify");c(Vf,"deepPartialify");var rn=s(class extends er{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),e=wr.objectKeys(t);return this._cached={shape:t,keys:e}}_parse(t){if(this._getType(t)!==vt.object){let l=this._getOrReturnCtx(t);return At(l,{code:rt.invalid_type,expected:vt.object,received:l.parsedType}),Ut}let{status:r,ctx:n}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof ca&&this._def.unknownKeys==="strip"))for(let l in n.data)o.includes(l)||a.push(l);let f=[];for(let l of o){let d=i[l],p=n.data[l];f.push({key:{status:"valid",value:l},value:d._parse(new _o(n,p,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof ca){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of a)f.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(l==="strict")a.length>0&&(At(n,{code:rt.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of a){let p=n.data[d];f.push({key:{status:"valid",value:d},value:l._parse(new _o(n,p,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of f){let p=await d.key;l.push({key:p,value:await d.value,alwaysSet:d.alwaysSet})}return l}).then(l=>Oi.mergeObjectSync(r,l)):Oi.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(t){return or.errToObj,new rn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(e,r)=>{var n,i,o,a;let f=(o=(i=(n=this._def).errorMap)===null||i===void 0?void 0:i.call(n,e,r).message)!==null&&o!==void 0?o:r.defaultError;return e.code==="unrecognized_keys"?{message:(a=or.errToObj(t).message)!==null&&a!==void 0?a:f}:{message:f}}}:{}})}strip(){return new rn({...this._def,unknownKeys:"strip"})}passthrough(){return new rn({...this._def,unknownKeys:"passthrough"})}extend(t){return new rn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new rn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>Yb.mergeShapes(this._def.shape(),t._def.shape()),typeName:Ot.ZodObject})}setKey(t,e){return this.augment({[t]:e})}catchall(t){return new rn({...this._def,catchall:t})}pick(t){let e={};return wr.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(e[r]=this.shape[r])}),new rn({...this._def,shape:()=>e})}omit(t){let e={};return wr.objectKeys(this.shape).forEach(r=>{t[r]||(e[r]=this.shape[r])}),new rn({...this._def,shape:()=>e})}deepPartial(){return Vf(this)}partial(t){let e={};return wr.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];t&&!t[r]?e[r]=n:e[r]=n.optional()}),new rn({...this._def,shape:()=>e})}required(t){let e={};return wr.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])e[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof aa;)i=i._def.innerType;e[r]=i}}),new rn({...this._def,shape:()=>e})}keyof(){return Py(wr.objectKeys(this.shape))}},"ZodObject");c(rn,"ZodObject");rn.create=(t,e)=>new rn({shape:()=>t,unknownKeys:"strip",catchall:ca.create(),typeName:Ot.ZodObject,...Vt(e)});rn.strictCreate=(t,e)=>new rn({shape:()=>t,unknownKeys:"strict",catchall:ca.create(),typeName:Ot.ZodObject,...Vt(e)});rn.lazycreate=(t,e)=>new rn({shape:t,unknownKeys:"strip",catchall:ca.create(),typeName:Ot.ZodObject,...Vt(e)});var Qu=s(class extends er{_parse(t){let{ctx:e}=this._processInputParams(t),r=this._def.options;function n(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return e.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new oa(a.ctx.common.issues));return At(e,{code:rt.invalid_union,unionErrors:o}),Ut}if(s(n,"handleResults"),c(n,"handleResults"),e.common.async)return Promise.all(r.map(async i=>{let o={...e,common:{...e.common,issues:[]},parent:null};return{result:await i._parseAsync({data:e.data,path:e.path,parent:o}),ctx:o}})).then(n);{let i,o=[];for(let f of r){let l={...e,common:{...e.common,issues:[]},parent:null},d=f._parseSync({data:e.data,path:e.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(i)return e.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(f=>new oa(f));return At(e,{code:rt.invalid_union,unionErrors:a}),Ut}}get options(){return this._def.options}},"ZodUnion");c(Qu,"ZodUnion");Qu.create=(t,e)=>new Qu({options:t,typeName:Ot.ZodUnion,...Vt(e)});var _b=c(t=>t instanceof td?_b(t.schema):t instanceof Ks?_b(t.innerType()):t instanceof rd?[t.value]:t instanceof Yc?t.options:t instanceof nd?Object.keys(t.enum):t instanceof id?_b(t._def.innerType):t instanceof Xu?[void 0]:t instanceof Zu?[null]:null,"getDiscriminator"),e2=s(class extends er{_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==vt.object)return At(e,{code:rt.invalid_type,expected:vt.object,received:e.parsedType}),Ut;let r=this.discriminator,n=e.data[r],i=this.optionsMap.get(n);return i?e.common.async?i._parseAsync({data:e.data,path:e.path,parent:e}):i._parseSync({data:e.data,path:e.path,parent:e}):(At(e,{code:rt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ut)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,e,r){let n=new Map;for(let i of e){let o=_b(i.shape[t]);if(!o)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of o){if(n.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);n.set(a,i)}}return new e2({typeName:Ot.ZodDiscriminatedUnion,discriminator:t,options:e,optionsMap:n,...Vt(r)})}},"ZodDiscriminatedUnion");c(e2,"ZodDiscriminatedUnion");function Xb(t,e){let r=$c(t),n=$c(e);if(t===e)return{valid:!0,data:t};if(r===vt.object&&n===vt.object){let i=wr.objectKeys(e),o=wr.objectKeys(t).filter(f=>i.indexOf(f)!==-1),a={...t,...e};for(let f of o){let l=Xb(t[f],e[f]);if(!l.valid)return{valid:!1};a[f]=l.data}return{valid:!0,data:a}}else if(r===vt.array&&n===vt.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let a=t[o],f=e[o],l=Xb(a,f);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===vt.date&&n===vt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}s(Xb,"mergeValues");c(Xb,"mergeValues");var ed=s(class extends er{_parse(t){let{status:e,ctx:r}=this._processInputParams(t),n=c((i,o)=>{if(q4(i)||q4(o))return Ut;let a=Xb(i.value,o.value);return a.valid?((H4(i)||H4(o))&&e.dirty(),{status:e.value,value:a.data}):(At(r,{code:rt.invalid_intersection_types}),Ut)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>n(i,o)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}},"ZodIntersection");c(ed,"ZodIntersection");ed.create=(t,e,r)=>new ed({left:t,right:e,typeName:Ot.ZodIntersection,...Vt(r)});var fa=s(class extends er{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==vt.array)return At(r,{code:rt.invalid_type,expected:vt.array,received:r.parsedType}),Ut;if(r.data.length<this._def.items.length)return At(r,{code:rt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ut;!this._def.rest&&r.data.length>this._def.items.length&&(At(r,{code:rt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),e.dirty());let i=[...r.data].map((o,a)=>{let f=this._def.items[a]||this._def.rest;return f?f._parse(new _o(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Oi.mergeArray(e,o)):Oi.mergeArray(e,i)}get items(){return this._def.items}rest(t){return new fa({...this._def,rest:t})}},"ZodTuple");c(fa,"ZodTuple");fa.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fa({items:t,typeName:Ot.ZodTuple,rest:null,...Vt(e)})};var K0=s(class extends er{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==vt.object)return At(r,{code:rt.invalid_type,expected:vt.object,received:r.parsedType}),Ut;let n=[],i=this._def.keyType,o=this._def.valueType;for(let a in r.data)n.push({key:i._parse(new _o(r,a,r.path,a)),value:o._parse(new _o(r,r.data[a],r.path,a))});return r.common.async?Oi.mergeObjectAsync(e,n):Oi.mergeObjectSync(e,n)}get element(){return this._def.valueType}static create(t,e,r){return e instanceof er?new K0({keyType:t,valueType:e,typeName:Ot.ZodRecord,...Vt(r)}):new K0({keyType:oc.create(),valueType:t,typeName:Ot.ZodRecord,...Vt(e)})}},"ZodRecord");c(K0,"ZodRecord");var V0=s(class extends er{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==vt.map)return At(r,{code:rt.invalid_type,expected:vt.map,received:r.parsedType}),Ut;let n=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,f],l)=>({key:n._parse(new _o(r,a,r.path,[l,"key"])),value:i._parse(new _o(r,f,r.path,[l,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let f of o){let l=await f.key,d=await f.value;if(l.status==="aborted"||d.status==="aborted")return Ut;(l.status==="dirty"||d.status==="dirty")&&e.dirty(),a.set(l.value,d.value)}return{status:e.value,value:a}})}else{let a=new Map;for(let f of o){let l=f.key,d=f.value;if(l.status==="aborted"||d.status==="aborted")return Ut;(l.status==="dirty"||d.status==="dirty")&&e.dirty(),a.set(l.value,d.value)}return{status:e.value,value:a}}}},"ZodMap");c(V0,"ZodMap");V0.create=(t,e,r)=>new V0({valueType:e,keyType:t,typeName:Ot.ZodMap,...Vt(r)});var nl=s(class extends er{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==vt.set)return At(r,{code:rt.invalid_type,expected:vt.set,received:r.parsedType}),Ut;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(At(r,{code:rt.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),e.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&(At(r,{code:rt.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),e.dirty());let i=this._def.valueType;function o(f){let l=new Set;for(let d of f){if(d.status==="aborted")return Ut;d.status==="dirty"&&e.dirty(),l.add(d.value)}return{status:e.value,value:l}}s(o,"finalizeSet"),c(o,"finalizeSet");let a=[...r.data.values()].map((f,l)=>i._parse(new _o(r,f,r.path,l)));return r.common.async?Promise.all(a).then(f=>o(f)):o(a)}min(t,e){return new nl({...this._def,minSize:{value:t,message:or.toString(e)}})}max(t,e){return new nl({...this._def,maxSize:{value:t,message:or.toString(e)}})}size(t,e){return this.min(t,e).max(t,e)}nonempty(t){return this.min(1,t)}},"ZodSet");c(nl,"ZodSet");nl.create=(t,e)=>new nl({valueType:t,minSize:null,maxSize:null,typeName:Ot.ZodSet,...Vt(e)});var Hu=s(class extends er{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==vt.function)return At(e,{code:rt.invalid_type,expected:vt.function,received:e.parsedType}),Ut;function r(a,f){return Vb({data:a,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,z0(),H0].filter(l=>!!l),issueData:{code:rt.invalid_arguments,argumentsError:f}})}s(r,"makeArgsIssue"),c(r,"makeArgsIssue");function n(a,f){return Vb({data:a,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,z0(),H0].filter(l=>!!l),issueData:{code:rt.invalid_return_type,returnTypeError:f}})}s(n,"makeReturnsIssue"),c(n,"makeReturnsIssue");let i={errorMap:e.common.contextualErrorMap},o=e.data;return this._def.returns instanceof il?gi(async(...a)=>{let f=new oa([]),l=await this._def.args.parseAsync(a,i).catch(g=>{throw f.addIssue(r(a,g)),f}),d=await o(...l);return await this._def.returns._def.type.parseAsync(d,i).catch(g=>{throw f.addIssue(n(d,g)),f})}):gi((...a)=>{let f=this._def.args.safeParse(a,i);if(!f.success)throw new oa([r(a,f.error)]);let l=o(...f.data),d=this._def.returns.safeParse(l,i);if(!d.success)throw new oa([n(l,d.error)]);return d.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Hu({...this._def,args:fa.create(t).rest(Gc.create())})}returns(t){return new Hu({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,e,r){return new Hu({args:t||fa.create([]).rest(Gc.create()),returns:e||Gc.create(),typeName:Ot.ZodFunction,...Vt(r)})}},"ZodFunction");c(Hu,"ZodFunction");var td=s(class extends er{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}},"ZodLazy");c(td,"ZodLazy");td.create=(t,e)=>new td({getter:t,typeName:Ot.ZodLazy,...Vt(e)});var rd=s(class extends er{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return At(e,{received:e.data,code:rt.invalid_literal,expected:this._def.value}),Ut}return{status:"valid",value:t.data}}get value(){return this._def.value}},"ZodLiteral");c(rd,"ZodLiteral");rd.create=(t,e)=>new rd({value:t,typeName:Ot.ZodLiteral,...Vt(e)});function Py(t,e){return new Yc({values:t,typeName:Ot.ZodEnum,...Vt(e)})}s(Py,"createZodEnum");c(Py,"createZodEnum");var Yc=s(class extends er{_parse(t){if(typeof t.data!="string"){let e=this._getOrReturnCtx(t),r=this._def.values;return At(e,{expected:wr.joinValues(r),received:e.parsedType,code:rt.invalid_type}),Ut}if(this._def.values.indexOf(t.data)===-1){let e=this._getOrReturnCtx(t),r=this._def.values;return At(e,{received:e.data,code:rt.invalid_enum_value,options:r}),Ut}return gi(t.data)}get options(){return this._def.values}get enum(){let t={};for(let e of this._def.values)t[e]=e;return t}get Values(){let t={};for(let e of this._def.values)t[e]=e;return t}get Enum(){let t={};for(let e of this._def.values)t[e]=e;return t}extract(t){return Yc.create(t)}exclude(t){return Yc.create(this.options.filter(e=>!t.includes(e)))}},"ZodEnum");c(Yc,"ZodEnum");Yc.create=Py;var nd=s(class extends er{_parse(t){let e=wr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==vt.string&&r.parsedType!==vt.number){let n=wr.objectValues(e);return At(r,{expected:wr.joinValues(n),received:r.parsedType,code:rt.invalid_type}),Ut}if(e.indexOf(t.data)===-1){let n=wr.objectValues(e);return At(r,{received:r.data,code:rt.invalid_enum_value,options:n}),Ut}return gi(t.data)}get enum(){return this._def.values}},"ZodNativeEnum");c(nd,"ZodNativeEnum");nd.create=(t,e)=>new nd({values:t,typeName:Ot.ZodNativeEnum,...Vt(e)});var il=s(class extends er{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==vt.promise&&e.common.async===!1)return At(e,{code:rt.invalid_type,expected:vt.promise,received:e.parsedType}),Ut;let r=e.parsedType===vt.promise?e.data:Promise.resolve(e.data);return gi(r.then(n=>this._def.type.parseAsync(n,{path:e.path,errorMap:e.common.contextualErrorMap})))}},"ZodPromise");c(il,"ZodPromise");il.create=(t,e)=>new il({type:t,typeName:Ot.ZodPromise,...Vt(e)});var Ks=s(class extends er{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ot.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:e,ctx:r}=this._processInputParams(t),n=this._def.effect||null;if(n.type==="preprocess"){let o=n.transform(r.data);return r.common.async?Promise.resolve(o).then(a=>this._def.schema._parseAsync({data:a,path:r.path,parent:r})):this._def.schema._parseSync({data:o,path:r.path,parent:r})}let i={addIssue:o=>{At(r,o),o.fatal?e.abort():e.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="refinement"){let o=c(a=>{let f=n.refinement(a,i);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a},"executeRefinement");if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ut:(a.status==="dirty"&&e.dirty(),o(a.value),{status:e.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ut:(a.status==="dirty"&&e.dirty(),o(a.value).then(()=>({status:e.value,value:a.value}))))}if(n.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Wb(o))return o;let a=n.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Wb(o)?Promise.resolve(n.transform(o.value,i)).then(a=>({status:e.value,value:a})):o);wr.assertNever(n)}},"ZodEffects");c(Ks,"ZodEffects");Ks.create=(t,e,r)=>new Ks({schema:t,typeName:Ot.ZodEffects,effect:e,...Vt(r)});Ks.createWithPreprocess=(t,e,r)=>new Ks({schema:e,effect:{type:"preprocess",transform:t},typeName:Ot.ZodEffects,...Vt(r)});var aa=s(class extends er{_parse(t){return this._getType(t)===vt.undefined?gi(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}},"ZodOptional");c(aa,"ZodOptional");aa.create=(t,e)=>new aa({innerType:t,typeName:Ot.ZodOptional,...Vt(e)});var Xc=s(class extends er{_parse(t){return this._getType(t)===vt.null?gi(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}},"ZodNullable");c(Xc,"ZodNullable");Xc.create=(t,e)=>new Xc({innerType:t,typeName:Ot.ZodNullable,...Vt(e)});var id=s(class extends er{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return e.parsedType===vt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:e.path,parent:e})}removeDefault(){return this._def.innerType}},"ZodDefault");c(id,"ZodDefault");id.create=(t,e)=>new id({innerType:t,typeName:Ot.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Vt(e)});var W0=s(class extends er{_parse(t){let{ctx:e}=this._processInputParams(t),r=this._def.innerType._parse({data:e.data,path:e.path,parent:{...e,common:{...e.common,issues:[]}}});return Jb(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue()})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue()}}removeCatch(){return this._def.innerType}},"ZodCatch");c(W0,"ZodCatch");W0.create=(t,e)=>new W0({innerType:t,typeName:Ot.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Vt(e)});var J0=s(class extends er{_parse(t){if(this._getType(t)!==vt.nan){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.nan,received:r.parsedType}),Ut}return{status:"valid",value:t.data}}},"ZodNaN");c(J0,"ZodNaN");J0.create=t=>new J0({typeName:Ot.ZodNaN,...Vt(t)});var yW=Symbol("zod_brand"),Fy=s(class extends er{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return this._def.type._parse({data:r,path:e.path,parent:e})}unwrap(){return this._def.type}},"ZodBranded");c(Fy,"ZodBranded");var S1=s(class extends er{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.common.async)return c(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ut:i.status==="dirty"?(e.dirty(),aB(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})},"handleAsync")();{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?Ut:n.status==="dirty"?(e.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(t,e){return new S1({in:t,out:e,typeName:Ot.ZodPipeline})}},"ZodPipeline");c(S1,"ZodPipeline");var fB=c((t,e={},r)=>t?rl.create().superRefine((n,i)=>{if(!t(n)){let o=typeof e=="function"?e(n):e,a=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...a,fatal:r})}}):rl.create(),"custom"),xW={object:rn.lazycreate},Ot;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline"})(Ot||(Ot={}));var wW=c((t,e={message:`Input not instance of ${t.name}`})=>fB(r=>r instanceof t,e,!0),"instanceOfType"),lB=oc.create,uB=Jc.create,_W=J0.create,AW=Ju.create,dB=Yu.create,EW=tl.create,CW=$0.create,SW=Xu.create,IW=Zu.create,kW=rl.create,TW=Gc.create,MW=ca.create,RW=G0.create,BW=xo.create,DW=rn.create,PW=rn.strictCreate,FW=Qu.create,OW=e2.create,NW=ed.create,LW=fa.create,UW=K0.create,jW=V0.create,qW=nl.create,HW=Hu.create,zW=td.create,$W=rd.create,GW=Yc.create,KW=nd.create,VW=il.create,_k=Ks.create,WW=aa.create,JW=Xc.create,YW=Ks.createWithPreprocess,XW=S1.create,ZW=c(()=>lB().optional(),"ostring"),QW=c(()=>uB().optional(),"onumber"),eJ=c(()=>dB().optional(),"oboolean"),tJ={string:t=>oc.create({...t,coerce:!0}),number:t=>Jc.create({...t,coerce:!0}),boolean:t=>Yu.create({...t,coerce:!0}),bigint:t=>Ju.create({...t,coerce:!0}),date:t=>tl.create({...t,coerce:!0})},rJ=Ut,xe=Object.freeze({__proto__:null,defaultErrorMap:H0,setErrorMap:oB,getErrorMap:z0,makeIssue:Vb,EMPTY_PATH:hW,addIssueToContext:At,ParseStatus:Oi,INVALID:Ut,DIRTY:aB,OK:gi,isAborted:q4,isDirty:H4,isValid:Wb,isAsync:Jb,get util(){return wr},ZodParsedType:vt,getParsedType:$c,ZodType:er,ZodString:oc,ZodNumber:Jc,ZodBigInt:Ju,ZodBoolean:Yu,ZodDate:tl,ZodSymbol:$0,ZodUndefined:Xu,ZodNull:Zu,ZodAny:rl,ZodUnknown:Gc,ZodNever:ca,ZodVoid:G0,ZodArray:xo,get objectUtil(){return Yb},ZodObject:rn,ZodUnion:Qu,ZodDiscriminatedUnion:e2,ZodIntersection:ed,ZodTuple:fa,ZodRecord:K0,ZodMap:V0,ZodSet:nl,ZodFunction:Hu,ZodLazy:td,ZodLiteral:rd,ZodEnum:Yc,ZodNativeEnum:nd,ZodPromise:il,ZodEffects:Ks,ZodTransformer:Ks,ZodOptional:aa,ZodNullable:Xc,ZodDefault:id,ZodCatch:W0,ZodNaN:J0,BRAND:yW,ZodBranded:Fy,ZodPipeline:S1,custom:fB,Schema:er,ZodSchema:er,late:xW,get ZodFirstPartyTypeKind(){return Ot},coerce:tJ,any:kW,array:BW,bigint:AW,boolean:dB,date:EW,discriminatedUnion:OW,effect:_k,enum:GW,function:HW,instanceof:wW,intersection:NW,lazy:zW,literal:$W,map:jW,nan:_W,nativeEnum:KW,never:MW,null:IW,nullable:JW,number:uB,object:DW,oboolean:eJ,onumber:QW,optional:WW,ostring:ZW,pipeline:XW,preprocess:YW,promise:VW,record:UW,set:qW,strictObject:PW,string:lB,symbol:CW,transformer:_k,tuple:LW,undefined:SW,union:FW,unknown:TW,void:RW,NEVER:rJ,ZodIssueCode:rt,quotelessJson:dW,ZodError:oa}),hB=xe.array(xe.string().or(xe.record(xe.any()))),Fle=xe.object({type:xe.string().optional(),narrative:xe.string().optional()}),t2=xe.string().or(xe.object({id:xe.string(),type:xe.string(),caption:xe.string().optional()})),nJ=xe.object({type:xe.string().min(1).or(xe.string().array().nonempty()),latitude:xe.number(),longitude:xe.number()}),iJ=xe.object({type:xe.string().min(1).or(xe.string().array().nonempty()),addressCountry:xe.string().optional(),addressCountryCode:xe.string().optional(),addressRegion:xe.string().optional(),addressLocality:xe.string().optional(),streetAddress:xe.string().optional(),postOfficeBoxNumber:xe.string().optional(),postalCode:xe.string().optional(),geo:nJ.optional()}),sJ=xe.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(xe.string()),pB=xe.object({type:xe.string().min(1).or(xe.string().array().nonempty()),identifier:xe.string(),identifierType:sJ}),Y0=xe.string().or(xe.object({id:xe.string().optional(),type:xe.string().or(xe.string().array().nonempty().optional()),name:xe.string().optional(),url:xe.string().optional(),phone:xe.string().optional(),description:xe.string().optional(),endorsement:xe.any().array().optional(),image:t2.optional(),email:xe.string().email().optional(),address:iJ.optional(),otherIdentifier:pB.array().optional(),official:xe.string().optional(),parentOrg:xe.any().optional(),familyName:xe.string().optional(),givenName:xe.string().optional(),additionalName:xe.string().optional(),patronymicName:xe.string().optional(),honorificPrefix:xe.string().optional(),honorificSuffix:xe.string().optional(),familyNamePrefix:xe.string().optional(),dateOfBirth:xe.string().optional()}).catchall(xe.any())),z4=xe.object({id:xe.string().optional()}).catchall(xe.any()),oJ=xe.object({type:xe.string(),id:xe.string()}),aJ=xe.object({id:xe.string(),type:xe.string()}),cJ=xe.object({id:xe.string(),type:xe.string()}).catchall(xe.any()),X0=xe.object({"@context":hB,id:xe.string().optional(),type:xe.string().array().nonempty(),issuer:Y0,issuanceDate:xe.string(),expirationDate:xe.string().optional(),credentialSubject:z4.or(z4.array()),credentialStatus:oJ.optional(),credentialSchema:aJ.array().optional(),refreshService:cJ.optional()}).catchall(xe.any()),Zc=xe.object({type:xe.string(),created:xe.string(),challenge:xe.string().optional(),domain:xe.string().optional(),nonce:xe.string().optional(),proofPurpose:xe.string(),verificationMethod:xe.string(),jws:xe.string().optional()}).catchall(xe.any()),ic=X0.extend({proof:Zc.or(Zc.array())}),mB=xe.object({"@context":hB,id:xe.string().optional(),type:xe.string().array().nonempty(),verifiableCredential:ic.or(ic.array()).optional(),holder:xe.string().optional()}).catchall(xe.any()),Zb=mB.extend({proof:Zc.or(Zc.array())}),fJ=xe.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(xe.string()),r2=xe.object({type:xe.string().array().nonempty(),targetCode:xe.string().optional(),targetDescription:xe.string().optional(),targetName:xe.string(),targetFramework:xe.string().optional(),targetType:fJ.optional(),targetUrl:xe.string()}),lJ=xe.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"]),uJ=lJ.or(xe.string()),dJ=xe.object({id:xe.string().optional(),narrative:xe.string().optional()}).catchall(xe.any()),hJ=xe.object({id:xe.string(),type:xe.string().array().nonempty(),endorsementComment:xe.string().optional()}),pJ=X0.extend({credentialSubject:hJ,proof:Zc.or(Zc.array()).optional()}),mJ=xe.object({id:xe.string(),"@language":xe.string().optional(),version:xe.string().optional()}),bJ=xe.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(xe.string()),gJ=xe.object({id:xe.string(),type:xe.string().array().nonempty(),alignment:r2.array().optional(),description:xe.string().optional(),level:xe.string().optional(),name:xe.string(),points:xe.string().optional()}).catchall(xe.any()),vJ=xe.object({id:xe.string(),type:xe.string().array().nonempty(),alignment:r2.array().optional(),allowedValue:xe.string().array().optional(),name:xe.string(),requiredLevel:xe.string().optional(),requiredValue:xe.string().optional(),resultType:bJ,rubricCriterionLevel:gJ.array().optional(),valueMax:xe.string().optional(),valueMin:xe.string().optional()}).catchall(xe.any()),yJ=xe.object({id:xe.string().optional(),type:xe.string().array().nonempty(),alignment:r2.array().optional(),achievementType:uJ.optional(),creator:Y0.optional(),creditsAvailable:xe.number().optional(),criteria:dJ,description:xe.string(),endorsement:pJ.array().optional(),fieldOfStudy:xe.string().optional(),humanCode:xe.string().optional(),image:t2.optional(),"@language":xe.string().optional(),name:xe.string(),otherIdentifier:pB.array().optional(),related:mJ.array().optional(),resultDescription:vJ.array().optional(),specialization:xe.string().optional(),tag:xe.string().array().optional(),version:xe.string().optional()}).catchall(xe.any()),xJ=xe.object({type:xe.string(),hashed:xe.boolean(),identityHash:xe.string(),identityType:xe.string(),salt:xe.string().optional()}),wJ=xe.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),_J=xe.object({type:xe.string().array().nonempty(),achievedLevel:xe.string().optional(),alignment:r2.array().optional(),resultDescription:xe.string().optional(),status:wJ.optional(),value:xe.string().optional()}).catchall(xe.any()),Ak=xe.object({id:xe.string().optional(),type:xe.string().array().nonempty(),activityEndDate:xe.string().optional(),activityStartDate:xe.string().optional(),creditsEarned:xe.number().optional(),achievement:yJ.optional(),identifier:xJ.array().optional(),image:t2.optional(),licenseNumber:xe.string().optional(),narrative:xe.string().optional(),result:_J.array().optional(),role:xe.string().optional(),source:Y0.optional(),term:xe.string().optional()}).catchall(xe.any()),AJ=xe.object({id:xe.string().optional(),type:xe.string().array().nonempty(),narrative:xe.string().optional(),name:xe.string().optional(),description:xe.string().optional(),genre:xe.string().optional(),audience:xe.string().optional()}).catchall(xe.any()),EJ=X0.extend({name:xe.string().optional(),description:xe.string().optional(),image:t2.optional(),credentialSubject:Ak.or(Ak.array()),endorsement:X0.array().optional(),evidence:AJ.array().optional()}),Ole=EJ.extend({proof:Zc.or(Zc.array())}),Ek=xe.object({checks:xe.string().array(),warnings:xe.string().array(),errors:xe.string().array()}),bB=xe.enum(["Success","Failed","Error"]),h4=bB.enum,Nle=xe.object({check:xe.string(),status:bB,message:xe.string().optional(),details:xe.string().optional()}),Lle=xe.object({title:xe.string().optional(),createdAt:xe.string().optional(),issuer:Y0.optional(),issuee:Y0.optional(),credentialSubject:z4.optional()}),P0=xe.object({id:xe.string(),uri:xe.string()}).catchall(xe.any()),$4=xe.object({profileId:xe.string().min(3).max(40),displayName:xe.string().default(""),did:xe.string(),email:xe.string().optional(),image:xe.string().optional(),isServiceProfile:xe.boolean().default(!1).optional(),notificationsWebhook:xe.string().url()}),Ule=xe.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),jle=xe.object({uri:xe.string(),to:xe.string(),from:xe.string(),sent:xe.string().datetime(),received:xe.string().datetime().optional()}),qle=xe.object({uri:xe.string(),name:xe.string().optional(),type:xe.string().optional(),category:xe.string().optional()}),Hle=xe.object({to:$4,from:xe.string(),received:xe.string()}),CJ=xe.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED"]),SJ=xe.object({title:xe.string().optional(),body:xe.string().optional()}),IJ=xe.object({vcUris:xe.array(xe.string()).optional(),vpUris:xe.array(xe.string()).optional()}),zle=xe.object({type:CJ,to:xe.string().or($4),from:xe.string().or($4),message:SJ.optional(),data:IJ.optional(),sent:xe.string().datetime().optional()}),kJ=xe.object({kty:xe.string(),crv:xe.string(),x:xe.string(),y:xe.string().optional(),n:xe.string().optional(),d:xe.string()}),TJ=xe.object({alg:xe.string(),iv:xe.string(),tag:xe.string(),epk:kJ.partial().optional(),kid:xe.string().optional(),apv:xe.string().optional(),apu:xe.string().optional()}),MJ=xe.object({header:TJ,encrypted_key:xe.string()}),$le=xe.object({protected:xe.string(),iv:xe.string(),ciphertext:xe.string(),tag:xe.string(),aad:xe.string().optional(),recipients:MJ.array().optional()});function Qc(t){if(t===null||t===!0||t===!1)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}s(Qc,"toInteger");c(Qc,"toInteger");function yi(t,e){if(e.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+e.length+" present")}s(yi,"requiredArgs");c(yi,"requiredArgs");function F0(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?F0=c(s(function(r){return typeof r},"_typeof3"),"_typeof"):F0=c(s(function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},"_typeof3"),"_typeof"),F0(t)}s(F0,"_typeof");c(F0,"_typeof");function So(t){yi(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||F0(t)==="object"&&e==="[object Date]"?new Date(t.getTime()):typeof t=="number"||e==="[object Number]"?new Date(t):((typeof t=="string"||e==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}s(So,"toDate");c(So,"toDate");function gB(t,e){yi(2,arguments);var r=So(t).getTime(),n=Qc(e);return new Date(r+n)}s(gB,"addMilliseconds");c(gB,"addMilliseconds");var RJ={};function I1(){return RJ}s(I1,"getDefaultOptions");c(I1,"getDefaultOptions");function vB(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}s(vB,"getTimezoneOffsetInMilliseconds");c(vB,"getTimezoneOffsetInMilliseconds");function O0(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O0=c(s(function(r){return typeof r},"_typeof3"),"_typeof"):O0=c(s(function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},"_typeof3"),"_typeof"),O0(t)}s(O0,"_typeof2");c(O0,"_typeof");function yB(t){return yi(1,arguments),t instanceof Date||O0(t)==="object"&&Object.prototype.toString.call(t)==="[object Date]"}s(yB,"isDate");c(yB,"isDate");function xB(t){if(yi(1,arguments),!yB(t)&&typeof t!="number")return!1;var e=So(t);return!isNaN(Number(e))}s(xB,"isValid2");c(xB,"isValid");function wB(t,e){yi(2,arguments);var r=Qc(e);return gB(t,-r)}s(wB,"subMilliseconds");c(wB,"subMilliseconds");var BJ=864e5;function _B(t){yi(1,arguments);var e=So(t),r=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var n=e.getTime(),i=r-n;return Math.floor(i/BJ)+1}s(_B,"getUTCDayOfYear");c(_B,"getUTCDayOfYear");function Z0(t){yi(1,arguments);var e=1,r=So(t),n=r.getUTCDay(),i=(n<e?7:0)+n-e;return r.setUTCDate(r.getUTCDate()-i),r.setUTCHours(0,0,0,0),r}s(Z0,"startOfUTCISOWeek");c(Z0,"startOfUTCISOWeek");function Oy(t){yi(1,arguments);var e=So(t),r=e.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(r+1,0,4),n.setUTCHours(0,0,0,0);var i=Z0(n),o=new Date(0);o.setUTCFullYear(r,0,4),o.setUTCHours(0,0,0,0);var a=Z0(o);return e.getTime()>=i.getTime()?r+1:e.getTime()>=a.getTime()?r:r-1}s(Oy,"getUTCISOWeekYear");c(Oy,"getUTCISOWeekYear");function AB(t){yi(1,arguments);var e=Oy(t),r=new Date(0);r.setUTCFullYear(e,0,4),r.setUTCHours(0,0,0,0);var n=Z0(r);return n}s(AB,"startOfUTCISOWeekYear");c(AB,"startOfUTCISOWeekYear");var DJ=6048e5;function EB(t){yi(1,arguments);var e=So(t),r=Z0(e).getTime()-AB(e).getTime();return Math.round(r/DJ)+1}s(EB,"getUTCISOWeek");c(EB,"getUTCISOWeek");function Q0(t,e){var r,n,i,o,a,f,l,d;yi(1,arguments);var p=I1(),g=Qc((r=(n=(i=(o=e?.weekStartsOn)!==null&&o!==void 0?o:e==null||(a=e.locale)===null||a===void 0||(f=a.options)===null||f===void 0?void 0:f.weekStartsOn)!==null&&i!==void 0?i:p.weekStartsOn)!==null&&n!==void 0?n:(l=p.locale)===null||l===void 0||(d=l.options)===null||d===void 0?void 0:d.weekStartsOn)!==null&&r!==void 0?r:0);if(!(g>=0&&g<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var x=So(t),A=x.getUTCDay(),C=(A<g?7:0)+A-g;return x.setUTCDate(x.getUTCDate()-C),x.setUTCHours(0,0,0,0),x}s(Q0,"startOfUTCWeek");c(Q0,"startOfUTCWeek");function Ny(t,e){var r,n,i,o,a,f,l,d;yi(1,arguments);var p=So(t),g=p.getUTCFullYear(),x=I1(),A=Qc((r=(n=(i=(o=e?.firstWeekContainsDate)!==null&&o!==void 0?o:e==null||(a=e.locale)===null||a===void 0||(f=a.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&i!==void 0?i:x.firstWeekContainsDate)!==null&&n!==void 0?n:(l=x.locale)===null||l===void 0||(d=l.options)===null||d===void 0?void 0:d.firstWeekContainsDate)!==null&&r!==void 0?r:1);if(!(A>=1&&A<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var C=new Date(0);C.setUTCFullYear(g+1,0,A),C.setUTCHours(0,0,0,0);var T=Q0(C,e),B=new Date(0);B.setUTCFullYear(g,0,A),B.setUTCHours(0,0,0,0);var O=Q0(B,e);return p.getTime()>=T.getTime()?g+1:p.getTime()>=O.getTime()?g:g-1}s(Ny,"getUTCWeekYear");c(Ny,"getUTCWeekYear");function CB(t,e){var r,n,i,o,a,f,l,d;yi(1,arguments);var p=I1(),g=Qc((r=(n=(i=(o=e?.firstWeekContainsDate)!==null&&o!==void 0?o:e==null||(a=e.locale)===null||a===void 0||(f=a.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&i!==void 0?i:p.firstWeekContainsDate)!==null&&n!==void 0?n:(l=p.locale)===null||l===void 0||(d=l.options)===null||d===void 0?void 0:d.firstWeekContainsDate)!==null&&r!==void 0?r:1),x=Ny(t,e),A=new Date(0);A.setUTCFullYear(x,0,g),A.setUTCHours(0,0,0,0);var C=Q0(A,e);return C}s(CB,"startOfUTCWeekYear");c(CB,"startOfUTCWeekYear");var PJ=6048e5;function SB(t,e){yi(1,arguments);var r=So(t),n=Q0(r,e).getTime()-CB(r,e).getTime();return Math.round(n/PJ)+1}s(SB,"getUTCWeek");c(SB,"getUTCWeek");function _r(t,e){for(var r=t<0?"-":"",n=Math.abs(t).toString();n.length<e;)n="0"+n;return r+n}s(_r,"addLeadingZeros");c(_r,"addLeadingZeros");var FJ={y:c(s(function(e,r){var n=e.getUTCFullYear(),i=n>0?n:1-n;return _r(r==="yy"?i%100:i,r.length)},"y"),"y"),M:c(s(function(e,r){var n=e.getUTCMonth();return r==="M"?String(n+1):_r(n+1,2)},"M"),"M"),d:c(s(function(e,r){return _r(e.getUTCDate(),r.length)},"d"),"d"),a:c(s(function(e,r){var n=e.getUTCHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},"a"),"a"),h:c(s(function(e,r){return _r(e.getUTCHours()%12||12,r.length)},"h"),"h"),H:c(s(function(e,r){return _r(e.getUTCHours(),r.length)},"H"),"H"),m:c(s(function(e,r){return _r(e.getUTCMinutes(),r.length)},"m"),"m"),s:c(s(function(e,r){return _r(e.getUTCSeconds(),r.length)},"s"),"s"),S:c(s(function(e,r){var n=r.length,i=e.getUTCMilliseconds(),o=Math.floor(i*Math.pow(10,n-3));return _r(o,r.length)},"S"),"S")},Uc=FJ,Mu={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},OJ={G:c(s(function(e,r,n){var i=e.getUTCFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return n.era(i,{width:"abbreviated"});case"GGGGG":return n.era(i,{width:"narrow"});case"GGGG":default:return n.era(i,{width:"wide"})}},"G"),"G"),y:c(s(function(e,r,n){if(r==="yo"){var i=e.getUTCFullYear(),o=i>0?i:1-i;return n.ordinalNumber(o,{unit:"year"})}return Uc.y(e,r)},"y2"),"y"),Y:c(s(function(e,r,n,i){var o=Ny(e,i),a=o>0?o:1-o;if(r==="YY"){var f=a%100;return _r(f,2)}return r==="Yo"?n.ordinalNumber(a,{unit:"year"}):_r(a,r.length)},"Y"),"Y"),R:c(s(function(e,r){var n=Oy(e);return _r(n,r.length)},"R"),"R"),u:c(s(function(e,r){var n=e.getUTCFullYear();return _r(n,r.length)},"u"),"u"),Q:c(s(function(e,r,n){var i=Math.ceil((e.getUTCMonth()+1)/3);switch(r){case"Q":return String(i);case"QQ":return _r(i,2);case"Qo":return n.ordinalNumber(i,{unit:"quarter"});case"QQQ":return n.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(i,{width:"wide",context:"formatting"})}},"Q"),"Q"),q:c(s(function(e,r,n){var i=Math.ceil((e.getUTCMonth()+1)/3);switch(r){case"q":return String(i);case"qq":return _r(i,2);case"qo":return n.ordinalNumber(i,{unit:"quarter"});case"qqq":return n.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(i,{width:"wide",context:"standalone"})}},"q"),"q"),M:c(s(function(e,r,n){var i=e.getUTCMonth();switch(r){case"M":case"MM":return Uc.M(e,r);case"Mo":return n.ordinalNumber(i+1,{unit:"month"});case"MMM":return n.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(i,{width:"wide",context:"formatting"})}},"M2"),"M"),L:c(s(function(e,r,n){var i=e.getUTCMonth();switch(r){case"L":return String(i+1);case"LL":return _r(i+1,2);case"Lo":return n.ordinalNumber(i+1,{unit:"month"});case"LLL":return n.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(i,{width:"wide",context:"standalone"})}},"L"),"L"),w:c(s(function(e,r,n,i){var o=SB(e,i);return r==="wo"?n.ordinalNumber(o,{unit:"week"}):_r(o,r.length)},"w"),"w"),I:c(s(function(e,r,n){var i=EB(e);return r==="Io"?n.ordinalNumber(i,{unit:"week"}):_r(i,r.length)},"I"),"I"),d:c(s(function(e,r,n){return r==="do"?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):Uc.d(e,r)},"d2"),"d"),D:c(s(function(e,r,n){var i=_B(e);return r==="Do"?n.ordinalNumber(i,{unit:"dayOfYear"}):_r(i,r.length)},"D"),"D"),E:c(s(function(e,r,n){var i=e.getUTCDay();switch(r){case"E":case"EE":case"EEE":return n.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(i,{width:"short",context:"formatting"});case"EEEE":default:return n.day(i,{width:"wide",context:"formatting"})}},"E"),"E"),e:c(s(function(e,r,n,i){var o=e.getUTCDay(),a=(o-i.weekStartsOn+8)%7||7;switch(r){case"e":return String(a);case"ee":return _r(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});case"eeee":default:return n.day(o,{width:"wide",context:"formatting"})}},"e"),"e"),c:c(s(function(e,r,n,i){var o=e.getUTCDay(),a=(o-i.weekStartsOn+8)%7||7;switch(r){case"c":return String(a);case"cc":return _r(a,r.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});case"cccc":default:return n.day(o,{width:"wide",context:"standalone"})}},"c"),"c"),i:c(s(function(e,r,n){var i=e.getUTCDay(),o=i===0?7:i;switch(r){case"i":return String(o);case"ii":return _r(o,r.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(i,{width:"short",context:"formatting"});case"iiii":default:return n.day(i,{width:"wide",context:"formatting"})}},"i"),"i"),a:c(s(function(e,r,n){var i=e.getUTCHours(),o=i/12>=1?"pm":"am";switch(r){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},"a2"),"a"),b:c(s(function(e,r,n){var i=e.getUTCHours(),o;switch(i===12?o=Mu.noon:i===0?o=Mu.midnight:o=i/12>=1?"pm":"am",r){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},"b"),"b"),B:c(s(function(e,r,n){var i=e.getUTCHours(),o;switch(i>=17?o=Mu.evening:i>=12?o=Mu.afternoon:i>=4?o=Mu.morning:o=Mu.night,r){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},"B"),"B"),h:c(s(function(e,r,n){if(r==="ho"){var i=e.getUTCHours()%12;return i===0&&(i=12),n.ordinalNumber(i,{unit:"hour"})}return Uc.h(e,r)},"h2"),"h"),H:c(s(function(e,r,n){return r==="Ho"?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):Uc.H(e,r)},"H2"),"H"),K:c(s(function(e,r,n){var i=e.getUTCHours()%12;return r==="Ko"?n.ordinalNumber(i,{unit:"hour"}):_r(i,r.length)},"K"),"K"),k:c(s(function(e,r,n){var i=e.getUTCHours();return i===0&&(i=24),r==="ko"?n.ordinalNumber(i,{unit:"hour"}):_r(i,r.length)},"k"),"k"),m:c(s(function(e,r,n){return r==="mo"?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):Uc.m(e,r)},"m2"),"m"),s:c(s(function(e,r,n){return r==="so"?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):Uc.s(e,r)},"s2"),"s"),S:c(s(function(e,r){return Uc.S(e,r)},"S2"),"S"),X:c(s(function(e,r,n,i){var o=i._originalDate||e,a=o.getTimezoneOffset();if(a===0)return"Z";switch(r){case"X":return K4(a);case"XXXX":case"XX":return Hc(a);case"XXXXX":case"XXX":default:return Hc(a,":")}},"X"),"X"),x:c(s(function(e,r,n,i){var o=i._originalDate||e,a=o.getTimezoneOffset();switch(r){case"x":return K4(a);case"xxxx":case"xx":return Hc(a);case"xxxxx":case"xxx":default:return Hc(a,":")}},"x"),"x"),O:c(s(function(e,r,n,i){var o=i._originalDate||e,a=o.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+G4(a,":");case"OOOO":default:return"GMT"+Hc(a,":")}},"O"),"O"),z:c(s(function(e,r,n,i){var o=i._originalDate||e,a=o.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+G4(a,":");case"zzzz":default:return"GMT"+Hc(a,":")}},"z"),"z"),t:c(s(function(e,r,n,i){var o=i._originalDate||e,a=Math.floor(o.getTime()/1e3);return _r(a,r.length)},"t"),"t"),T:c(s(function(e,r,n,i){var o=i._originalDate||e,a=o.getTime();return _r(a,r.length)},"T"),"T")};function G4(t,e){var r=t>0?"-":"+",n=Math.abs(t),i=Math.floor(n/60),o=n%60;if(o===0)return r+String(i);var a=e||"";return r+String(i)+a+_r(o,2)}s(G4,"formatTimezoneShort");c(G4,"formatTimezoneShort");function K4(t,e){if(t%60===0){var r=t>0?"-":"+";return r+_r(Math.abs(t)/60,2)}return Hc(t,e)}s(K4,"formatTimezoneWithOptionalMinutes");c(K4,"formatTimezoneWithOptionalMinutes");function Hc(t,e){var r=e||"",n=t>0?"-":"+",i=Math.abs(t),o=_r(Math.floor(i/60),2),a=_r(i%60,2);return n+o+r+a}s(Hc,"formatTimezone");c(Hc,"formatTimezone");var NJ=OJ,Ck=c(s(function(e,r){switch(e){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},"dateLongFormatter2"),"dateLongFormatter"),IB=c(s(function(e,r){switch(e){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},"timeLongFormatter2"),"timeLongFormatter"),LJ=c(s(function(e,r){var n=e.match(/(P+)(p+)?/)||[],i=n[1],o=n[2];if(!o)return Ck(e,r);var a;switch(i){case"P":a=r.dateTime({width:"short"});break;case"PP":a=r.dateTime({width:"medium"});break;case"PPP":a=r.dateTime({width:"long"});break;case"PPPP":default:a=r.dateTime({width:"full"});break}return a.replace("{{date}}",Ck(i,r)).replace("{{time}}",IB(o,r))},"dateTimeLongFormatter2"),"dateTimeLongFormatter"),UJ={p:IB,P:LJ},jJ=UJ,qJ=["D","DD"],HJ=["YY","YYYY"];function kB(t){return qJ.indexOf(t)!==-1}s(kB,"isProtectedDayOfYearToken");c(kB,"isProtectedDayOfYearToken");function TB(t){return HJ.indexOf(t)!==-1}s(TB,"isProtectedWeekYearToken");c(TB,"isProtectedWeekYearToken");function V4(t,e,r){if(t==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}s(V4,"throwProtectedError");c(V4,"throwProtectedError");var zJ={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},$J=c(s(function(e,r,n){var i,o=zJ[e];return typeof o=="string"?i=o:r===1?i=o.one:i=o.other.replace("{{count}}",r.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i},"formatDistance2"),"formatDistance"),GJ=$J;function Ab(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.width?String(e.width):t.defaultWidth,n=t.formats[r]||t.formats[t.defaultWidth];return n}}s(Ab,"buildFormatLongFn");c(Ab,"buildFormatLongFn");var KJ={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},VJ={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},WJ={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},JJ={date:Ab({formats:KJ,defaultWidth:"full"}),time:Ab({formats:VJ,defaultWidth:"full"}),dateTime:Ab({formats:WJ,defaultWidth:"full"})},YJ=JJ,XJ={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ZJ=c(s(function(e,r,n,i){return XJ[e]},"formatRelative2"),"formatRelative"),QJ=ZJ;function Pu(t){return function(e,r){var n=r!=null&&r.context?String(r.context):"standalone",i;if(n==="formatting"&&t.formattingValues){var o=t.defaultFormattingWidth||t.defaultWidth,a=r!=null&&r.width?String(r.width):o;i=t.formattingValues[a]||t.formattingValues[o]}else{var f=t.defaultWidth,l=r!=null&&r.width?String(r.width):t.defaultWidth;i=t.values[l]||t.values[f]}var d=t.argumentCallback?t.argumentCallback(e):e;return i[d]}}s(Pu,"buildLocalizeFn");c(Pu,"buildLocalizeFn");var eY={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},tY={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},rY={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},nY={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},iY={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},sY={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},oY=c(s(function(e,r){var n=Number(e),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},"ordinalNumber2"),"ordinalNumber"),aY={ordinalNumber:oY,era:Pu({values:eY,defaultWidth:"wide"}),quarter:Pu({values:tY,defaultWidth:"wide",argumentCallback:c(s(function(e){return e-1},"argumentCallback"),"argumentCallback")}),month:Pu({values:rY,defaultWidth:"wide"}),day:Pu({values:nY,defaultWidth:"wide"}),dayPeriod:Pu({values:iY,defaultWidth:"wide",formattingValues:sY,defaultFormattingWidth:"wide"})},cY=aY;function Fu(t){return function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.width,i=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],o=e.match(i);if(!o)return null;var a=o[0],f=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(f)?RB(f,function(g){return g.test(a)}):MB(f,function(g){return g.test(a)}),d;d=t.valueCallback?t.valueCallback(l):l,d=r.valueCallback?r.valueCallback(d):d;var p=e.slice(a.length);return{value:d,rest:p}}}s(Fu,"buildMatchFn");c(Fu,"buildMatchFn");function MB(t,e){for(var r in t)if(t.hasOwnProperty(r)&&e(t[r]))return r}s(MB,"findKey");c(MB,"findKey");function RB(t,e){for(var r=0;r<t.length;r++)if(e(t[r]))return r}s(RB,"findIndex");c(RB,"findIndex");function BB(t){return function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.match(t.matchPattern);if(!n)return null;var i=n[0],o=e.match(t.parsePattern);if(!o)return null;var a=t.valueCallback?t.valueCallback(o[0]):o[0];a=r.valueCallback?r.valueCallback(a):a;var f=e.slice(i.length);return{value:a,rest:f}}}s(BB,"buildMatchPatternFn");c(BB,"buildMatchPatternFn");var fY=/^(\d+)(th|st|nd|rd)?/i,lY=/\d+/i,uY={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},dY={any:[/^b/i,/^(a|c)/i]},hY={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},pY={any:[/1/i,/2/i,/3/i,/4/i]},mY={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},bY={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},gY={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},vY={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},yY={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},xY={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},wY={ordinalNumber:BB({matchPattern:fY,parsePattern:lY,valueCallback:c(s(function(e){return parseInt(e,10)},"valueCallback"),"valueCallback")}),era:Fu({matchPatterns:uY,defaultMatchWidth:"wide",parsePatterns:dY,defaultParseWidth:"any"}),quarter:Fu({matchPatterns:hY,defaultMatchWidth:"wide",parsePatterns:pY,defaultParseWidth:"any",valueCallback:c(s(function(e){return e+1},"valueCallback2"),"valueCallback")}),month:Fu({matchPatterns:mY,defaultMatchWidth:"wide",parsePatterns:bY,defaultParseWidth:"any"}),day:Fu({matchPatterns:gY,defaultMatchWidth:"wide",parsePatterns:vY,defaultParseWidth:"any"}),dayPeriod:Fu({matchPatterns:yY,defaultMatchWidth:"any",parsePatterns:xY,defaultParseWidth:"any"})},_Y=wY,AY={code:"en-US",formatDistance:GJ,formatLong:YJ,formatRelative:QJ,localize:cY,match:_Y,options:{weekStartsOn:0,firstWeekContainsDate:1}},EY=AY,CY=EY,SY=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,IY=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,kY=/^'([^]*?)'?$/,TY=/''/g,MY=/[a-zA-Z]/;function Ly(t,e,r){var n,i,o,a,f,l,d,p,g,x,A,C,T,B,O,H,U,q;yi(2,arguments);var K=String(e),W=I1(),N=(n=(i=r?.locale)!==null&&i!==void 0?i:W.locale)!==null&&n!==void 0?n:CY,G=Qc((o=(a=(f=(l=r?.firstWeekContainsDate)!==null&&l!==void 0?l:r==null||(d=r.locale)===null||d===void 0||(p=d.options)===null||p===void 0?void 0:p.firstWeekContainsDate)!==null&&f!==void 0?f:W.firstWeekContainsDate)!==null&&a!==void 0?a:(g=W.locale)===null||g===void 0||(x=g.options)===null||x===void 0?void 0:x.firstWeekContainsDate)!==null&&o!==void 0?o:1);if(!(G>=1&&G<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var ce=Qc((A=(C=(T=(B=r?.weekStartsOn)!==null&&B!==void 0?B:r==null||(O=r.locale)===null||O===void 0||(H=O.options)===null||H===void 0?void 0:H.weekStartsOn)!==null&&T!==void 0?T:W.weekStartsOn)!==null&&C!==void 0?C:(U=W.locale)===null||U===void 0||(q=U.options)===null||q===void 0?void 0:q.weekStartsOn)!==null&&A!==void 0?A:0);if(!(ce>=0&&ce<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!N.localize)throw new RangeError("locale must contain localize property");if(!N.formatLong)throw new RangeError("locale must contain formatLong property");var re=So(t);if(!xB(re))throw new RangeError("Invalid time value");var ae=vB(re),J=wB(re,ae),S={firstWeekContainsDate:G,weekStartsOn:ce,locale:N,_originalDate:re},m=K.match(IY).map(function(b){var h=b[0];if(h==="p"||h==="P"){var v=jJ[h];return v(b,N.formatLong)}return b}).join("").match(SY).map(function(b){if(b==="''")return"'";var h=b[0];if(h==="'")return DB(b);var v=NJ[h];if(v)return!(r!=null&&r.useAdditionalWeekYearTokens)&&TB(b)&&V4(b,e,String(t)),!(r!=null&&r.useAdditionalDayOfYearTokens)&&kB(b)&&V4(b,e,String(t)),v(J,b,N.localize,S);if(h.match(MY))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return b}).join("");return m}s(Ly,"format");c(Ly,"format");function DB(t){var e=t.match(kY);return e?e[1].replace(TY,"'"):t}s(DB,"cleanEscapedString");c(DB,"cleanEscapedString");var RY=c((t,e)=>t.split(" error")[0]||t,"transformErrorCheck"),BY=c((t,e)=>t.startsWith("expiration")?e.expirationDate?`Invalid \u2022 Expired ${Ly(new Date(e.expirationDate),"dd MMM yyyy").toUpperCase()}`:"Invalid \u2022 Expired":t,"transformErrorMessage"),DY=c((t,e)=>({proof:"Valid",expiration:e.expirationDate?`Valid \u2022 Expires ${Ly(new Date(e.expirationDate),"dd MMM yyyy").toUpperCase()}`:"Valid \u2022 Does Not Expire"})[t]||t,"transformCheckMessage"),PY=c(t=>async(e,r,n,i=!1)=>{let o=await t.invoke.verifyCredential(r,n);if(!i)return o;let a=[];return o.errors.forEach(f=>{a.push({status:h4.Failed,check:RY(f,r),details:BY(f,r)})}),o.warnings.forEach(f=>{a.push({status:h4.Error,check:"hmm",message:f})}),o.checks.forEach(f=>{a.push({status:h4.Success,check:f,message:DY(f,r)})}),a},"verifyCredential"),Uy=c(t=>({name:"LearnCard",displayName:"LearnCard",description:"Adds opinionated logic to a LearnCard",methods:{verifyCredential:PY(t)}}),"getLearnCardPlugin"),FY=c(async({didkit:t,debug:e}={})=>{let r=await(await A1({debug:e})).addPlugin(await TR(t)),o=await(await(await r.addPlugin(Ey(r))).addPlugin(Cy())).addPlugin(await Dy());return o.addPlugin(Uy(o))},"emptyLearnCard");function jy(t){var e=0,r=t.length,n=[];if(r%2)throw new Error("invalid hex:"+t);for(;e<r;e+=2)n.push(parseInt(t.substr(e,2),16));return new Uint8Array(n)}s(jy,"toUint8Array");c(jy,"toUint8Array");var OY=Object.defineProperty,NY=c((t,e)=>OY(t,"name",{value:e,configurable:!0}),"__name"),LY=NY(t=>/^[0-9a-f]+$/i.test(t),"isHex"),UY=["key","tz","pkh:tz","pkh:tezos","pkh:sol","pkh:solana"],jY=["key","tz","ethr","pkh:tz","pkh:tezos","pkh:eth","pkh:celo","pkh:poly","pkh:btc","pkh:doge","pkh:eip155","pkh:bip122"],qY=c(t=>{if(UY.includes(t))return"ed25519";if(jY.includes(t)||t.startsWith("pkh:eip155:")||t.startsWith("pkh:bip122:"))return"secp256k1";throw new Error("Unspported Did Method")},"getAlgorithmForDidMethod"),HY=c(async(t,e,r)=>{if(e.length===0)throw new Error("Please don't use an empty string for a key!");if(!LY(e))throw new Error("Key must be a hexadecimal string!");if(e.length>64)throw new Error("Key must be less than 64 characters");e.length<64&&(console.warn("Warning: A LearnCard has been initialized with a seed that is less than 32 bytes, and will be padded with zeroes"),console.warn("Please instantiate LearnCards using 32 bytes that have been randomly generated in a cryptographically secure fashion!"),console.warn("See https://app.gitbook.com/o/6uDv1QDlxaaZC7i8EaGb/s/FXvEJ9j3Vf3FW5Nc557n/learn-card-packages/learncard-core/instantiation#key-generation for details"));let n=e.padStart(64,"0"),i=jy(n),o={},a={ed25519:t.invoke.generateEd25519KeyFromBytes(i),secp256k1:t.invoke.generateSecp256k1KeyFromBytes(i)},f=c((d=r)=>{if(!o[d]){let p=qY(d);o[d]=t.invoke.keyToDid(d,a[p])}return o[d]},"did"),l=c((d="ed25519")=>{if(!a[d])throw new Error("Unsupported algorithm");return a[d]},"keypair");return{name:"DID Key",displayName:"DID Key",description:"Generates dids and JWKs using 32 Secure Random Bytes of Entropy",id:{did:(d,p)=>f(p),keypair:(d,p)=>l(p)},methods:{getSubjectDid:(d,p=r)=>f(p),getSubjectKeypair:(d,p="ed25519")=>l(p),getKey:()=>n}}},"getDidKeyPlugin"),zY=c(t=>async(e,r,n={})=>{let i=e.id.keypair();if(!i)throw new Error("Cannot issue credential: Could not get subject keypair");let a={verificationMethod:await e.invoke.didToVerificationMethod(typeof r.issuer=="string"?r.issuer:r.issuer.id),proofPurpose:"assertionMethod",type:"Ed25519Signature2020",...n};return t.invoke.issueCredential(r,a,i)},"issueCredential"),$Y=c(t=>async(e,r,n={})=>t.invoke.verifyCredential(r,n),"verifyCredential"),GY=c(t=>async(e,r,n={})=>{let i=e.id.keypair();if(!i)throw new Error("Cannot issue credential: Could not get subject keypair");let a={verificationMethod:await e.invoke.didToVerificationMethod(e.id.did()),...n.proofFormat==="jwt"?{}:{proofPurpose:"assertionMethod"},...n.proofFormat==="jwt"?{}:{type:"Ed25519Signature2020"},...n};return t.invoke.issuePresentation(r,a,i)},"issuePresentation"),KY=c(t=>async(e,r,n={})=>t.invoke.verifyPresentation(r,n),"verifyPresentation"),VY=c(t=>({name:"VC",displayName:"VC",description:"Handles the infrastructure needed to issue and verify credentials and presentations",methods:{issueCredential:zY(t),verifyCredential:$Y(t),issuePresentation:GY(t),verifyPresentation:KY(t),getTestVc:(e,r="did:example:d23dd687a7dc6787646f2eb98d0")=>{let n=e.id.did();return{"@context":["https://www.w3.org/2018/credentials/v1"],id:"http://example.org/credentials/3731",type:["VerifiableCredential"],issuer:n,issuanceDate:"2020-08-19T21:41:50Z",credentialSubject:{id:r}}},getTestVp:async(e,r)=>{let n=r||await e.invoke.issueCredential(e.invoke.getTestVc()),i=e.id.did();return{"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],holder:i,verifiableCredential:n}},getDidAuthVp:async(e,r={})=>{let n=e.id.did(),i={"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],holder:n};return e.invoke.issuePresentation(i,{proofPurpose:"authentication",...r})}}}),"getVCPlugin"),WY={name:"VC Resolution",displayName:"VC Resolution",description:"[Deprecated] Allows for a fallback mechanism of resolving credentials",methods:{resolveCredential:async(t,e)=>{throw new Error(`No Credential Resolution Plugins found that can resolve ${e}`)}}},JY=dr(cK());function PB(t,e){try{var r=t()}catch(n){return e(n)}return r&&r.then?r.then(void 0,e):r}s(PB,"_catch");c(PB,"_catch");function FB(){let t=new Map;return function(e,r){try{let n=s(function(a){if(i)return a;let f=t.get(e.didUrl);return f!==void 0?f:Promise.resolve(r()).then(function(l){var d;return((d=l.didResolutionMetadata)==null?void 0:d.error)!=="notFound"&&t.set(e.didUrl,l),l})},"_temp2");c(n,"_temp2");let i,o=function(){if(e.params&&e.params["no-cache"]==="true")return Promise.resolve(r()).then(function(a){return i=1,a})}();return Promise.resolve(o&&o.then?o.then(n):n(o))}catch(n){return Promise.reject(n)}}}s(FB,"inMemoryCache");c(FB,"inMemoryCache");function OB(t,e){return e()}s(OB,"noCache");c(OB,"noCache");var YY="(?:%[0-9a-fA-F]{2})",Sk=`(?:[a-zA-Z0-9._-]|${YY})`,XY="([a-z0-9]+)",ZY=`((?:${Sk}*:)*(${Sk}+))`,Ik="[a-zA-Z0-9_.:%-]",QY=`;${Ik}+=${Ik}*`,eX=`((${QY})*)`,tX="(/[^#?]*)?",rX="([?][^#]*)?",nX="(#.*)?",iX=new RegExp(`^did:${XY}:${ZY}${eX}${tX}${rX}${nX}$`);function qy(t){if(t===""||!t)return null;let e=t.match(iX);if(e){let r={did:`did:${e[1]}:${e[2]}`,method:e[1],id:e[2],didUrl:t};if(e[4]){let n=e[4].slice(1).split(";");r.params={};for(let i of n){let o=i.split("=");r.params[o[0]]=o[1]}}return e[6]&&(r.path=e[6]),e[7]&&(r.query=e[7].slice(1)),e[8]&&(r.fragment=e[8].slice(1)),r}return null}s(qy,"parse");c(qy,"parse");var Qb={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function NB(t){return function(e,r,n){try{return Promise.resolve(PB(function(){return Promise.resolve(t(e,r,n)).then(function(i){return{...Qb,didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:i}})},function(i){return{...Qb,didResolutionMetadata:{error:"notFound",message:i.toString()}}}))}catch(i){return Promise.reject(i)}}}s(NB,"wrapLegacyResolver");c(NB,"wrapLegacyResolver");var LB=s(class{constructor(t={},e={}){this.registry=void 0,this.cache=void 0,this.registry=t,this.cache=e.cache===!0?FB():e.cache||OB,e.legacyResolvers&&Object.keys(e.legacyResolvers).map(r=>{this.registry[r]||(this.registry[r]=NB(e.legacyResolvers[r]))})}resolve(t,e={}){try{let r=this,n=qy(t);if(n===null)return Promise.resolve({...Qb,didResolutionMetadata:{error:"invalidDid"}});let i=r.registry[n.method];return i?Promise.resolve(r.cache(n,()=>i(n.did,n,r,e))):Promise.resolve({...Qb,didResolutionMetadata:{error:"unsupportedDidMethod"}})}catch(r){return Promise.reject(r)}}},"Resolver");c(LB,"Resolver");JT();gy();y1();uy();$g();zM();var UB=dr(EK()),sX=dr(VM()),jB=dr(zK()),qB=dr(yy()),oX=dr(WK()),W4=dr(JK()),HB=dr(QK()),zB=dr(hd());function vs(t){return zr(t,"base64url")}s(vs,"bytesToBase64url");c(vs,"bytesToBase64url");function Pi(t){let e=t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");return jr(e,"base64url")}s(Pi,"base64ToBytes");c(Pi,"base64ToBytes");function n2(t){return jr(t,"base58btc")}s(n2,"base58ToBytes");c(n2,"base58ToBytes");function eg(t){let e=t.startsWith("0x")?t.substring(2):t;return jr(e.toLowerCase(),"base16")}s(eg,"hexToBytes");c(eg,"hexToBytes");function tg(t){return vs(jr(t))}s(tg,"encodeBase64url");c(tg,"encodeBase64url");function Hy(t){return zr(Pi(t))}s(Hy,"decodeBase64url");c(Hy,"decodeBase64url");function ef(t){return zr(t,"base16")}s(ef,"bytesToHex");c(ef,"bytesToHex");function zy(t){return jr(t)}s(zy,"stringToBytes");c(zy,"stringToBytes");function $B({r:t,s:e,recoveryParam:r},n){let i=new Uint8Array(n?65:64);if(i.set(jr(t,"base16"),0),i.set(jr(e,"base16"),32),n){if(typeof r>"u")throw new Error("Signer did not return a recoveryParam");i[64]=r}return vs(i)}s($B,"toJose");c($B,"toJose");function GB(t){let e=Pi(t);if(e.length<64||e.length>65)throw new TypeError(`Wrong size for signature. Expected 64 or 65 bytes, but got ${e.length}`);let r=ef(e.slice(0,32)),n=ef(e.slice(32,64)),i=e.length===65?e[64]:void 0;return{r,s:n,recoveryParam:i}}s(GB,"fromJose");c(GB,"fromJose");function $y(t,e){return Wc([Pi(t),Pi(e)])}s($y,"toSealed");c($y,"toSealed");var aX=/^(0x)?([a-fA-F0-9]{64}|[a-fA-F0-9]{128})$/,cX=/^([1-9A-HJ-NP-Za-km-z]{44}|[1-9A-HJ-NP-Za-km-z]{88})$/,fX=/^([0-9a-zA-Z=\-_+/]{43}|[0-9a-zA-Z=\-_+/]{86})(={0,2})$/;function KB(t){if(typeof t=="string"){if(aX.test(t))return eg(t);if(cX.test(t))return n2(t);if(fX.test(t))return Pi(t);throw TypeError("bad_key: Invalid private key format")}else{if(t instanceof Uint8Array)return t;throw TypeError("bad_key: Invalid private key format")}}s(KB,"parseKey");c(KB,"parseKey");function Gy(t){let e=typeof t=="string"?jr(t):t;return(0,UB.hash)(e)}s(Gy,"sha2562");c(Gy,"sha256");function VB(t){return new Uint8Array(sX.keccak_256.arrayBuffer(t))}s(VB,"keccak");c(VB,"keccak");function WB(t){let e=jr(t.slice(2),"base16");return`0x${zr(VB(e).slice(-20),"base16")}`}s(WB,"toEthereumAddress");c(WB,"toEthereumAddress");function rg(t,e=new Uint8Array(4)){let r=jr(t.toString(),"base10");return e.set(r,4-r.length),e}s(rg,"writeUint32BE");c(rg,"writeUint32BE");var p4=c(t=>Wc([rg(t.length),t]),"lengthAndInput");function Ky(t,e,r,n,i){if(e!==256)throw new Error(`Unsupported key length: ${e}`);let o=Wc([p4(jr(r)),p4(typeof n>"u"?new Uint8Array(0):n),p4(typeof i>"u"?new Uint8Array(0):i),rg(e)]),a=1;return(0,UB.hash)(Wc([rg(a),t,o]))}s(Ky,"concatKDF");c(Ky,"concatKDF");var Gle=new jB.ec("secp256k1");function JB(t){let e=KB(t);if(e.length!==64)throw new Error(`bad_key: Invalid private key format. Expecting 64 bytes, but got ${e.length}`);return function(r){try{let n=typeof r=="string"?zy(r):r,i=(0,qB.sign)(e,n);return Promise.resolve(vs(i))}catch(n){return Promise.reject(n)}}}s(JB,"EdDSASigner");c(JB,"EdDSASigner");function Vy(t){return typeof t=="object"&&"r"in t&&"s"in t}s(Vy,"instanceOfEcdsaSignature");c(Vy,"instanceOfEcdsaSignature");function J4(t){return c(s(function(r,n){try{return Promise.resolve(n(r)).then(function(i){if(Vy(i))return $B(i,t);if(t&&typeof GB(i).recoveryParam>"u")throw new Error("not_supported: ES256K-R not supported when signer doesn't provide a recovery param");return i})}catch(i){return Promise.reject(i)}},"sign5"),"sign")}s(J4,"ES256KSignerAlg");c(J4,"ES256KSignerAlg");function Y4(){return c(s(function(e,r){try{return Promise.resolve(r(e)).then(function(n){if(Vy(n))throw new Error("invalid_config: expected a signer function that returns a string instead of signature object");return n})}catch(n){return Promise.reject(n)}},"sign5"),"sign")}s(Y4,"Ed25519SignerAlg");c(Y4,"Ed25519SignerAlg");var lX={ES256K:J4(),"ES256K-R":J4(!0),Ed25519:Y4(),EdDSA:Y4()};function YB(t){let e=lX[t];if(!e)throw new Error(`not_supported: Unsupported algorithm ${t}`);return e}s(YB,"SignerAlg");c(YB,"SignerAlg");var Wy=new jB.ec("secp256k1");function e1(t,e=!1){let r=Pi(t);if(r.length!==(e?65:64))throw new Error("wrong signature length");let n=ef(r.slice(0,32)),i=ef(r.slice(32,64)),o={r:n,s:i};return e&&(o.recoveryParam=r[64]),o}s(e1,"toSignatureObject");c(e1,"toSignatureObject");function i2(t){if(t.publicKeyBase58)return n2(t.publicKeyBase58);if(t.publicKeyBase64)return Pi(t.publicKeyBase64);if(t.publicKeyHex)return eg(t.publicKeyHex);if(t.publicKeyJwk&&t.publicKeyJwk.crv==="secp256k1"&&t.publicKeyJwk.x&&t.publicKeyJwk.y)return eg(Wy.keyFromPublic({x:ef(Pi(t.publicKeyJwk.x)),y:ef(Pi(t.publicKeyJwk.y))}).getPublic("hex"));if(t.publicKeyMultibase){let{base16:e,base58btc:r,base64:n,base64url:i}=$b;return e.decoder.or(r.decoder.or(n.decoder.or(i.decoder))).decode(t.publicKeyMultibase)}return new Uint8Array}s(i2,"extractPublicKeyBytes");c(i2,"extractPublicKeyBytes");function XB(t,e,r){let n=Gy(t),i=e1(e),o=r.filter(({ethereumAddress:l,blockchainAccountId:d})=>typeof l>"u"&&typeof d>"u"),a=r.filter(({ethereumAddress:l,blockchainAccountId:d})=>typeof l<"u"||typeof d!==void 0),f=o.find(l=>{try{let d=i2(l);return Wy.keyFromPublic(d).verify(n,i)}catch{return!1}});if(!f&&a.length>0&&(f=Jy(t,e,a)),!f)throw new Error("invalid_signature: Signature invalid for JWT");return f}s(XB,"verifyES256K");c(XB,"verifyES256K");function Jy(t,e,r){let n;if(e.length>86)n=[e1(e,!0)];else{let a=e1(e,!1);n=[{...a,recoveryParam:0},{...a,recoveryParam:1}]}let i=c(a=>{let f=Gy(t),l=Wy.recoverPubKey(f,a,a.recoveryParam),d=l.encode("hex"),p=l.encode("hex",!0),g=WB(d);return r.find(A=>{var C,T,B;let O=ef(i2(A));return O===d||O===p||((C=A.ethereumAddress)==null?void 0:C.toLowerCase())===g||((T=A.blockchainAccountId)==null||(B=T.split("@eip155"))==null?void 0:B[0].toLowerCase())===g})},"checkSignatureAgainstSigner"),o=n.map(i).filter(a=>typeof a<"u");if(o.length===0)throw new Error("invalid_signature: Signature invalid for JWT");return o[0]}s(Jy,"verifyRecoverableES256K");c(Jy,"verifyRecoverableES256K");function X4(t,e,r){let n=zy(t),i=Pi(e),o=r.find(a=>(0,qB.verify)(i2(a),n,i));if(!o)throw new Error("invalid_signature: Signature invalid for JWT");return o}s(X4,"verifyEd25519");c(X4,"verifyEd25519");var uX={ES256K:XB,"ES256K-R":Jy,Ed25519:X4,EdDSA:X4};function Yy(t){let e=uX[t];if(!e)throw new Error(`not_supported: Unsupported algorithm ${t}`);return e}s(Yy,"VerifierAlgorithm");c(Yy,"VerifierAlgorithm");Yy.toSignatureObject=e1;var dX=c(function(t,e,r={},n={}){try{r.alg||(r.alg=hX);let i=typeof t=="string"?t:Z4(t,n.canonicalize),o=[Z4(r,n.canonicalize),i].join("."),a=YB(r.alg);return Promise.resolve(a(o,e)).then(function(f){return[o,f].join(".")})}catch(i){return Promise.reject(i)}},"createJWS"),hX="ES256K";function Z4(t,e=!1){return tg(e?(0,oX.default)(t):JSON.stringify(t))}s(Z4,"encodeSection");c(Z4,"encodeSection");function ZB(t){let e=t.match(/^([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)$/);if(e)return{header:JSON.parse(Hy(e[1])),payload:e[2],signature:e[3],data:`${e[1]}.${e[2]}`};throw new Error("invalid_argument: Incorrect format JWS")}s(ZB,"decodeJWS");c(ZB,"decodeJWS");function QB({header:t,data:e,signature:r},n){return Array.isArray(n)||(n=[n]),Yy(t.alg)(e,r,n)}s(QB,"verifyJWSDecoded");c(QB,"verifyJWSDecoded");function eD(t,e){let r=ZB(t);return QB(r,e)}s(eD,"verifyJWS");c(eD,"verifyJWS");function tD(t,e,r){for(var n;;){var i=t();if(rc(i)&&(i=i.v),!i)return o;if(i.then){n=0;break}var o=r();if(o&&o.then)if(rc(o))o=o.s;else{n=1;break}if(e){var a=e();if(a&&a.then&&!rc(a)){n=2;break}}}var f=new sl,l=_n.bind(null,f,2);return(n===0?i.then(p):n===1?o.then(d):a.then(g)).then(void 0,l),f;function d(x){o=x;do{if(e&&(a=e(),a&&a.then&&!rc(a))){a.then(g).then(void 0,l);return}if(i=t(),!i||rc(i)&&!i.v){_n(f,1,o);return}if(i.then){i.then(p).then(void 0,l);return}o=r(),rc(o)&&(o=o.v)}while(!o||!o.then);o.then(d).then(void 0,l)}s(d,"_resumeAfterBody"),c(d,"_resumeAfterBody");function p(x){x?(o=r(),o&&o.then?o.then(d).then(void 0,l):d(o)):_n(f,1,o)}s(p,"_resumeAfterTest"),c(p,"_resumeAfterTest");function g(){(i=t())?i.then?i.then(p).then(void 0,l):p(i):_n(f,1,o)}s(g,"_resumeAfterUpdate"),c(g,"_resumeAfterUpdate")}s(tD,"_for");c(tD,"_for");var pX=c(function(t,e){try{let r=s(function(d){if(f===null)throw new Error("failure: Failed to decrypt");return f},"_temp5");c(r,"_temp5");let n;iD(t);let i=JSON.parse(Hy(t.protected));if(i.enc!==e.enc)throw new Error(`not_supported: Decrypter does not supported: '${i.enc}'`);let o=$y(t.ciphertext,t.tag),a=new Uint8Array(Buffer.from(t.aad?`${t.protected}.${t.aad}`:t.protected)),f=null,l=function(){return i.alg==="dir"&&e.alg==="dir"?Promise.resolve(e.decrypt(o,Pi(t.iv),a)).then(function(d){f=d}):function(){if(!t.recipients||t.recipients.length===0)throw new Error("bad_jwe: missing recipients");{let d=0;return tD(function(){return!f&&d<t.recipients.length},function(){return d++},function(){let p=t.recipients[d];Object.assign(p.header,i);let g=function(){if(p.header.alg===e.alg)return Promise.resolve(e.decrypt(o,Pi(t.iv),a,p)).then(function(x){f=x})}();if(g&&g.then)return g.then(function(){})})}}()}();return Promise.resolve(l&&l.then?l.then(r):r(l))}catch(r){return Promise.reject(r)}},"decryptJWE"),kk=typeof Symbol<"u"?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function _n(t,e,r){if(!t.s){if(r instanceof sl)if(r.s)e&1&&(e=r.s),r=r.v;else{r.o=_n.bind(null,t,e);return}if(r&&r.then){r.then(_n.bind(null,t,e),_n.bind(null,t,2));return}t.s=e,t.v=r;let n=t.o;n&&n(t)}}s(_n,"_settle");c(_n,"_settle");var sl=function(){function t(){}return s(t,"_Pact2"),c(t,"_Pact"),t.prototype.then=function(e,r){let n=new t,i=this.s;if(i){let o=i&1?e:r;if(o){try{_n(n,1,o(this.v))}catch(a){_n(n,2,a)}return n}else return this}return this.o=function(o){try{let a=o.v;o.s&1?_n(n,1,e?e(a):a):r?_n(n,1,r(a)):_n(n,2,a)}catch(a){_n(n,2,a)}},n},t}();function rc(t){return t instanceof sl&&t.s&1}s(rc,"_isSettledPact");c(rc,"_isSettledPact");function rD(t,e,r){var n=-1,i,o;function a(f){try{for(;++n<t.length&&(!r||!r());)if(f=e(n),f&&f.then)if(rc(f))f=f.v;else{f.then(a,o||(o=_n.bind(null,i=new sl,2)));return}i?_n(i,1,f):i=f}catch(l){_n(i||(i=new sl),2,l)}}return s(a,"_cycle"),c(a,"_cycle"),a(),i}s(rD,"_forTo");c(rD,"_forTo");function nD(t,e,r){if(typeof t[kk]=="function"){let p=s(function(g){try{for(;!(i=n.next()).done&&(!r||!r());)if(g=e(i.value),g&&g.then)if(rc(g))g=g.v;else{g.then(p,a||(a=_n.bind(null,o=new sl,2)));return}o?_n(o,1,g):o=g}catch(x){_n(o||(o=new sl),2,x)}},"_cycle");c(p,"_cycle");var n=t[kk](),i,o,a;if(p(),n.return){var f=c(function(g){try{i.done||n.return()}catch{}return g},"_fixup");if(o&&o.then)return o.then(f,function(g){throw f(g)});f()}return o}if(!("length"in t))throw new TypeError("Object is not iterable");for(var l=[],d=0;d<t.length;d++)l.push(t[d]);return rD(l,function(p){return e(l[p])},r)}s(nD,"_forOf");c(nD,"_forOf");function iD(t){if(!(t.protected&&t.iv&&t.ciphertext&&t.tag))throw new Error("bad_jwe: missing properties");t.recipients&&t.recipients.map(e=>{if(!(e.header&&e.encrypted_key))throw new Error("bad_jwe: malformed recipients")})}s(iD,"validateJWE");c(iD,"validateJWE");function Q4({ciphertext:t,tag:e,iv:r,protectedHeader:n,recipient:i},o){let a={protected:n,iv:vs(r),ciphertext:vs(t),tag:vs(e)};return o&&(a.aad=vs(o)),i&&(a.recipients=[i]),a}s(Q4,"encodeJWE");c(Q4,"encodeJWE");var mX=c(function(t,e,r={},n){try{if(e[0].alg==="dir"){if(e.length>1)throw new Error('not_supported: Can only do "dir" encryption to one key.');return Promise.resolve(e[0].encrypt(t,r,n)).then(function(i){return Q4(i,n)})}else{let i=e[0].enc;if(!e.reduce((l,d)=>l&&d.enc===i,!0))throw new Error("invalid_argument: Incompatible encrypters passed");let o,a,f=nD(e,function(l){let d=function(){return o?Promise.resolve(l.encryptCek==null?void 0:l.encryptCek(o)).then(function(p){if(p){var g,x;(g=a)==null||(x=g.recipients)==null||x.push(p)}}):Promise.resolve(l.encrypt(t,r,n)).then(function(p){o=p.cek,a=Q4(p,n)})}();if(d&&d.then)return d.then(function(){})});return Promise.resolve(f&&f.then?f.then(function(){return a}):a)}}catch(i){return Promise.reject(i)}},"createJWE"),bX=c(function(t,e){try{let r=c(function(i){try{return Promise.resolve(e.resolve(i)).then(function({didResolutionMetadata:o,didDocument:a}){var f;if(o!=null&&o.error||a==null)throw new Error(`resolver_error: Could not resolve ${i}: ${o.error}, ${o.message}`);if(!a.keyAgreement)throw new Error(`no_suitable_keys: Could not find x25519 key for ${i}`);let d=((f=a.keyAgreement)==null?void 0:f.map(p=>typeof p=="string"?[...a.publicKey||[],...a.verificationMethod||[]].find(g=>g.id===p):p).filter(p=>typeof p<"u")).filter(p=>p.type==="X25519KeyAgreementKey2019"&&Boolean(p.publicKeyBase58));if(!d.length)throw new Error(`no_suitable_keys: Could not find x25519 key for ${i}`);return d.map(p=>oD(n2(p.publicKeyBase58),p.id))})}catch(o){return Promise.reject(o)}},"encryptersForDID"),n=t.map(i=>r(i));return Promise.resolve(Promise.all(n)).then(function(i){return[].concat(...i)})}catch(r){return Promise.reject(r)}},"resolveX25519Encrypters");function Xy(t){let e=new HB.XChaCha20Poly1305(t);return(r,n)=>{let i=(0,zB.randomBytes)(e.nonceLength),o=e.seal(i,r,n);return{ciphertext:o.subarray(0,o.length-e.tagLength),tag:o.subarray(o.length-e.tagLength),iv:i}}}s(Xy,"xc20pEncrypter");c(Xy,"xc20pEncrypter");function sD(t){let e=c(function(o,a={},f){try{let l=tg(JSON.stringify(Object.assign({alg:i},a,{enc:n}))),d=new Uint8Array(Buffer.from(f?`${l}.${vs(f)}`:l));return Promise.resolve({...r(o,d),protectedHeader:l})}catch(l){return Promise.reject(l)}},"encrypt"),r=Xy(t),n="XC20P",i="dir";return{alg:i,enc:n,encrypt:e}}s(sD,"xc20pDirEncrypter");c(sD,"xc20pDirEncrypter");function e5(t){let e=c(function(n,i,o){try{return Promise.resolve(r.open(i,n,o))}catch(a){return Promise.reject(a)}},"decrypt"),r=new HB.XChaCha20Poly1305(t);return{alg:"dir",enc:"XC20P",decrypt:e}}s(e5,"xc20pDirDecrypter");c(e5,"xc20pDirDecrypter");function oD(t,e){let r=c(function(f,l={},d){try{Object.assign(l,{alg:void 0});let p=(0,zB.randomBytes)(32);return Promise.resolve(sD(p).encrypt(f,l,d)).then(function(g){return Promise.resolve(n(p)).then(function(x){return{...g,recipient:x,cek:p}})})}catch(p){return Promise.reject(p)}},"encrypt"),n=c(function(f){try{let l=(0,W4.generateKeyPair)(),d=(0,W4.sharedKey)(l.secretKey,t),p=Ky(d,o,i),g=Xy(p)(f),x={encrypted_key:vs(g.ciphertext),header:{alg:i,iv:vs(g.iv),tag:vs(g.tag),epk:{kty:"OKP",crv:a,x:vs(l.publicKey)}}};return e&&(x.header.kid=e),Promise.resolve(x)}catch(l){return Promise.reject(l)}},"encryptCek"),i="ECDH-ES+XC20PKW",o=256,a="X25519";return{alg:i,enc:"XC20P",encrypt:r,encryptCek:n}}s(oD,"x25519Encrypter");c(oD,"x25519Encrypter");function aD(t){if(!(t&&t.epk&&t.iv&&t.tag))throw new Error("bad_jwe: malformed header")}s(aD,"validateHeader");c(aD,"validateHeader");function cD(t){let e=c(function(o,a,f,l){try{let g=s(function(){let T=Ky(A,n,r),B=$y(l.encrypted_key,l.header.tag);return Promise.resolve(e5(T).decrypt(B,Pi(l.header.iv))).then(function(O){return O===null?null:e5(O).decrypt(o,a,f)})},"_temp4");c(g,"_temp4");var d,p;if(aD((d=l)==null?void 0:d.header),l=l,((p=l.header.epk)==null?void 0:p.crv)!==i||typeof l.header.epk.x>"u")return Promise.resolve(null);let x=Pi(l.header.epk.x),A,C=function(){if(t instanceof Uint8Array)A=(0,W4.sharedKey)(t,x);else return Promise.resolve(t(x)).then(function(T){A=T})}();return Promise.resolve(C&&C.then?C.then(g):g(C))}catch(g){return Promise.reject(g)}},"decrypt"),r="ECDH-ES+XC20PKW",n=256,i="X25519";return{alg:r,enc:"XC20P",decrypt:e}}s(cD,"x25519Decrypter");c(cD,"x25519Decrypter");HM();var cb=c(({enumerable:t=!0,configurable:e=!1}={})=>({enumerable:t,configurable:e,writable:!1}),"readonly"),t5=c(function*(t,e){if(t!=null&&!(t instanceof Uint8Array))for(let[r,n]of Object.entries(t)){let i=[...e,r];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let[o,a]of n.entries()){let f=[...i,o],l=tr.asCID(a);l?yield[f.join("/"),l]:typeof a=="object"&&(yield*t5(a,f))}else{let o=tr.asCID(n);o?yield[i.join("/"),o]:yield*t5(n,i)}}},"links"),r5=c(function*(t,e){if(t!=null)for(let[r,n]of Object.entries(t)){let i=[...e,r];if(yield i.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!tr.asCID(n))if(Array.isArray(n))for(let[o,a]of n.entries()){let f=[...i,o];yield f.join("/"),typeof a=="object"&&!tr.asCID(a)&&(yield*r5(a,f))}else yield*r5(n,i)}},"tree"),gX=c((t,e)=>{let r=t;for(let[n,i]of e.entries()){if(r=r[i],r==null)throw new Error(`Object has no property at ${e.slice(0,n+1).map(a=>`[${JSON.stringify(a)}]`).join("")}`);let o=tr.asCID(r);if(o)return{value:o,remaining:e.slice(n+1).join("/")}}return{value:r}},"get"),Zy=s(class{constructor({cid:t,bytes:e,value:r}){if(!t||!e||typeof r>"u")throw new Error("Missing required argument");this.cid=t,this.bytes=e,this.value=r,this.asBlock=this,Object.defineProperties(this,{cid:cb(),bytes:cb(),value:cb(),asBlock:cb()})}links(){return t5(this.value,[])}tree(){return r5(this.value,[])}get(t="/"){return gX(this.value,t.split("/").filter(Boolean))}},"Block");c(Zy,"Block");var s2=c(async({value:t,codec:e,hasher:r})=>{if(typeof t>"u")throw new Error('Missing required argument "value"');if(!e||!r)throw new Error("Missing required argument: codec or hasher");let n=e.encode(t),i=await r.digest(n),o=tr.create(1,e.code,i);return new Zy({value:t,bytes:n,cid:o})},"encode"),vX=c(async({bytes:t,codec:e,hasher:r})=>{if(!t)throw new Error('Missing required argument "bytes"');if(!e||!r)throw new Error("Missing required argument: codec or hasher");let n=e.decode(t),i=await r.digest(t),o=tr.create(1,e.code,i);return new Zy({value:n,bytes:t,cid:o})},"decode");ba();Gg();qM();hy();var bd={};Or(bd,{code:()=>ig,decode:()=>xP,encode:()=>g2,name:()=>OX});var yX=["string","number","bigint","symbol"],xX=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function fD(t){if(t===null)return"null";if(t===void 0)return"undefined";if(t===!0||t===!1)return"boolean";let e=typeof t;if(yX.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(t))return"Array";if(lD(t))return"Buffer";let r=uD(t);return r||"Object"}s(fD,"is");c(fD,"is");function lD(t){return t&&t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer.call(null,t)}s(lD,"isBuffer");c(lD,"isBuffer");function uD(t){let e=Object.prototype.toString.call(t).slice(8,-1);if(xX.includes(e))return e}s(uD,"getObjectType");c(uD,"getObjectType");var Le=s(class{constructor(t,e,r){this.major=t,this.majorEncoded=t<<5,this.name=e,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}},"Type");c(Le,"Type");Le.uint=new Le(0,"uint",!0);Le.negint=new Le(1,"negint",!0);Le.bytes=new Le(2,"bytes",!0);Le.string=new Le(3,"string",!0);Le.array=new Le(4,"array",!1);Le.map=new Le(5,"map",!1);Le.tag=new Le(6,"tag",!1);Le.float=new Le(7,"float",!0);Le.false=new Le(7,"false",!0);Le.true=new Le(7,"true",!0);Le.null=new Le(7,"null",!0);Le.undefined=new Le(7,"undefined",!0);Le.break=new Le(7,"break",!0);var nt=s(class{constructor(t,e,r){this.type=t,this.value=e,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},"Token");c(nt,"Token");var gd=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",wX=new TextDecoder,_X=new TextEncoder;function t1(t){return gd&&globalThis.Buffer.isBuffer(t)}s(t1,"isBuffer2");c(t1,"isBuffer");function Qy(t){return t instanceof Uint8Array?t1(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t:Uint8Array.from(t)}s(Qy,"asU8A");c(Qy,"asU8A");var AX=gd?(t,e,r)=>r-e>64?globalThis.Buffer.from(t.subarray(e,r)).toString("utf8"):i5(t,e,r):(t,e,r)=>r-e>64?wX.decode(t.subarray(e,r)):i5(t,e,r),EX=gd?t=>t.length>64?globalThis.Buffer.from(t):n5(t):t=>t.length>64?_X.encode(t):n5(t),Xa=c(t=>Uint8Array.from(t),"fromArray"),e8=gd?(t,e,r)=>t1(t)?new Uint8Array(t.subarray(e,r)):t.slice(e,r):(t,e,r)=>t.slice(e,r),CX=gd?(t,e)=>(t=t.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Qy(globalThis.Buffer.concat(t,e))):(t,e)=>{let r=new Uint8Array(e),n=0;for(let i of t)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},SX=gd?t=>globalThis.Buffer.allocUnsafe(t):t=>new Uint8Array(t);function dD(t,e){if(t1(t)&&t1(e))return t.compare(e);for(let r=0;r<t.length;r++)if(t[r]!==e[r])return t[r]<e[r]?-1:1;return 0}s(dD,"compare2");c(dD,"compare");function n5(t,e=1/0){let r,n=t.length,i=null,o=[];for(let a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}s(n5,"utf8ToBytes");c(n5,"utf8ToBytes");function i5(t,e,r){let n=[];for(;e<r;){let i=t[e],o=null,a=i>239?4:i>223?3:i>191?2:1;if(e+a<=r){let f,l,d,p;switch(a){case 1:i<128&&(o=i);break;case 2:f=t[e+1],(f&192)===128&&(p=(i&31)<<6|f&63,p>127&&(o=p));break;case 3:f=t[e+1],l=t[e+2],(f&192)===128&&(l&192)===128&&(p=(i&15)<<12|(f&63)<<6|l&63,p>2047&&(p<55296||p>57343)&&(o=p));break;case 4:f=t[e+1],l=t[e+2],d=t[e+3],(f&192)===128&&(l&192)===128&&(d&192)===128&&(p=(i&15)<<18|(f&63)<<12|(l&63)<<6|d&63,p>65535&&p<1114112&&(o=p))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),e+=a}return hD(n)}s(i5,"utf8Slice");c(i5,"utf8Slice");var Tk=4096;function hD(t){let e=t.length;if(e<=Tk)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Tk));return r}s(hD,"decodeCodePointsArray");c(hD,"decodeCodePointsArray");var IX=256,t8=s(class{constructor(t=IX){this.chunkSize=t,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(t){let e=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let n=e.length-(this.maxCursor-this.cursor)-1;e.set(t,n)}else{if(e){let n=e.length-(this.maxCursor-this.cursor)-1;n<e.length&&(this.chunks[this.chunks.length-1]=e.subarray(0,n),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(e=SX(this.chunkSize),this.chunks.push(e),this.maxCursor+=e.length,this._initReuseChunk===null&&(this._initReuseChunk=e),e.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let e;if(this.chunks.length===1){let r=this.chunks[0];t&&this.cursor>r.length/2?(e=this.cursor===r.length?r:r.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):e=e8(r,0,this.cursor)}else e=CX(this.chunks,this.cursor);return t&&this.reset(),e}},"Bl");c(t8,"Bl");var lr="CBOR decode error:",pD="CBOR encode error:",k1=[];k1[23]=1;k1[24]=2;k1[25]=3;k1[26]=5;k1[27]=9;function pl(t,e,r){if(t.length-e<r)throw new Error(`${lr} not enough data for type`)}s(pl,"assertEnoughData");c(pl,"assertEnoughData");var Wn=[24,256,65536,4294967296,BigInt("18446744073709551616")];function cf(t,e,r){pl(t,e,1);let n=t[e];if(r.strict===!0&&n<Wn[0])throw new Error(`${lr} integer encoded in more bytes than necessary (strict decode)`);return n}s(cf,"readUint8");c(cf,"readUint8");function ff(t,e,r){pl(t,e,2);let n=t[e]<<8|t[e+1];if(r.strict===!0&&n<Wn[1])throw new Error(`${lr} integer encoded in more bytes than necessary (strict decode)`);return n}s(ff,"readUint16");c(ff,"readUint16");function lf(t,e,r){pl(t,e,4);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3];if(r.strict===!0&&n<Wn[2])throw new Error(`${lr} integer encoded in more bytes than necessary (strict decode)`);return n}s(lf,"readUint32");c(lf,"readUint32");function uf(t,e,r){pl(t,e,8);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3],i=t[e+4]*16777216+(t[e+5]<<16)+(t[e+6]<<8)+t[e+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<Wn[3])throw new Error(`${lr} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${lr} integers outside of the safe integer range are not supported`)}s(uf,"readUint64");c(uf,"readUint64");function mD(t,e,r,n){return new nt(Le.uint,cf(t,e+1,n),2)}s(mD,"decodeUint8");c(mD,"decodeUint8");function bD(t,e,r,n){return new nt(Le.uint,ff(t,e+1,n),3)}s(bD,"decodeUint16");c(bD,"decodeUint16");function gD(t,e,r,n){return new nt(Le.uint,lf(t,e+1,n),5)}s(gD,"decodeUint32");c(gD,"decodeUint32");function vD(t,e,r,n){return new nt(Le.uint,uf(t,e+1,n),9)}s(vD,"decodeUint64");c(vD,"decodeUint64");function df(t,e){return _s(t,0,e.value)}s(df,"encodeUint");c(df,"encodeUint");function _s(t,e,r){if(r<Wn[0]){let n=Number(r);t.push([e|n])}else if(r<Wn[1]){let n=Number(r);t.push([e|24,n])}else if(r<Wn[2]){let n=Number(r);t.push([e|25,n>>>8,n&255])}else if(r<Wn[3]){let n=Number(r);t.push([e|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<Wn[4]){let i=[e|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,t.push(i)}else throw new Error(`${lr} encountered BigInt larger than allowable range`)}}s(_s,"encodeUintValue");c(_s,"encodeUintValue");df.encodedSize=c(s(function(e){return _s.encodedSize(e.value)},"encodedSize"),"encodedSize");_s.encodedSize=c(s(function(e){return e<Wn[0]?1:e<Wn[1]?2:e<Wn[2]?3:e<Wn[3]?5:9},"encodedSize2"),"encodedSize");df.compareTokens=c(s(function(e,r){return e.value<r.value?-1:e.value>r.value?1:0},"compareTokens"),"compareTokens");function yD(t,e,r,n){return new nt(Le.negint,-1-cf(t,e+1,n),2)}s(yD,"decodeNegint8");c(yD,"decodeNegint8");function xD(t,e,r,n){return new nt(Le.negint,-1-ff(t,e+1,n),3)}s(xD,"decodeNegint16");c(xD,"decodeNegint16");function wD(t,e,r,n){return new nt(Le.negint,-1-lf(t,e+1,n),5)}s(wD,"decodeNegint32");c(wD,"decodeNegint32");var r8=BigInt(-1),_D=BigInt(1);function AD(t,e,r,n){let i=uf(t,e+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new nt(Le.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${lr} integers outside of the safe integer range are not supported`);return new nt(Le.negint,r8-BigInt(i),9)}s(AD,"decodeNegint64");c(AD,"decodeNegint64");function o2(t,e){let r=e.value,n=typeof r=="bigint"?r*r8-_D:r*-1-1;_s(t,e.type.majorEncoded,n)}s(o2,"encodeNegint");c(o2,"encodeNegint");o2.encodedSize=c(s(function(e){let r=e.value,n=typeof r=="bigint"?r*r8-_D:r*-1-1;return n<Wn[0]?1:n<Wn[1]?2:n<Wn[2]?3:n<Wn[3]?5:9},"encodedSize3"),"encodedSize");o2.compareTokens=c(s(function(e,r){return e.value<r.value?1:e.value>r.value?-1:0},"compareTokens2"),"compareTokens");function vd(t,e,r,n){pl(t,e,r+n);let i=e8(t,e+r,e+r+n);return new nt(Le.bytes,i,r+n)}s(vd,"toToken");c(vd,"toToken");function ED(t,e,r,n){return vd(t,e,1,r)}s(ED,"decodeBytesCompact");c(ED,"decodeBytesCompact");function CD(t,e,r,n){return vd(t,e,2,cf(t,e+1,n))}s(CD,"decodeBytes8");c(CD,"decodeBytes8");function SD(t,e,r,n){return vd(t,e,3,ff(t,e+1,n))}s(SD,"decodeBytes16");c(SD,"decodeBytes16");function ID(t,e,r,n){return vd(t,e,5,lf(t,e+1,n))}s(ID,"decodeBytes32");c(ID,"decodeBytes32");function kD(t,e,r,n){let i=uf(t,e+1,n);if(typeof i=="bigint")throw new Error(`${lr} 64-bit integer bytes lengths not supported`);return vd(t,e,9,i)}s(kD,"decodeBytes64");c(kD,"decodeBytes64");function r1(t){return t.encodedBytes===void 0&&(t.encodedBytes=t.type===Le.string?EX(t.value):t.value),t.encodedBytes}s(r1,"tokenBytes");c(r1,"tokenBytes");function T1(t,e){let r=r1(e);_s(t,e.type.majorEncoded,r.length),t.push(r)}s(T1,"encodeBytes");c(T1,"encodeBytes");T1.encodedSize=c(s(function(e){let r=r1(e);return _s.encodedSize(r.length)+r.length},"encodedSize4"),"encodedSize");T1.compareTokens=c(s(function(e,r){return TD(r1(e),r1(r))},"compareTokens3"),"compareTokens");function TD(t,e){return t.length<e.length?-1:t.length>e.length?1:dD(t,e)}s(TD,"compareBytes");c(TD,"compareBytes");function yd(t,e,r,n,i){let o=r+n;pl(t,e,o);let a=new nt(Le.string,AX(t,e+r,e+o),o);return i.retainStringBytes===!0&&(a.byteValue=e8(t,e+r,e+o)),a}s(yd,"toToken2");c(yd,"toToken");function MD(t,e,r,n){return yd(t,e,1,r,n)}s(MD,"decodeStringCompact");c(MD,"decodeStringCompact");function RD(t,e,r,n){return yd(t,e,2,cf(t,e+1,n),n)}s(RD,"decodeString8");c(RD,"decodeString8");function BD(t,e,r,n){return yd(t,e,3,ff(t,e+1,n),n)}s(BD,"decodeString16");c(BD,"decodeString16");function DD(t,e,r,n){return yd(t,e,5,lf(t,e+1,n),n)}s(DD,"decodeString32");c(DD,"decodeString32");function PD(t,e,r,n){let i=uf(t,e+1,n);if(typeof i=="bigint")throw new Error(`${lr} 64-bit integer string lengths not supported`);return yd(t,e,9,i,n)}s(PD,"decodeString64");c(PD,"decodeString64");var kX=T1;function ml(t,e,r,n){return new nt(Le.array,n,r)}s(ml,"toToken3");c(ml,"toToken");function FD(t,e,r,n){return ml(t,e,1,r)}s(FD,"decodeArrayCompact");c(FD,"decodeArrayCompact");function OD(t,e,r,n){return ml(t,e,2,cf(t,e+1,n))}s(OD,"decodeArray8");c(OD,"decodeArray8");function ND(t,e,r,n){return ml(t,e,3,ff(t,e+1,n))}s(ND,"decodeArray16");c(ND,"decodeArray16");function LD(t,e,r,n){return ml(t,e,5,lf(t,e+1,n))}s(LD,"decodeArray32");c(LD,"decodeArray32");function UD(t,e,r,n){let i=uf(t,e+1,n);if(typeof i=="bigint")throw new Error(`${lr} 64-bit integer array lengths not supported`);return ml(t,e,9,i)}s(UD,"decodeArray64");c(UD,"decodeArray64");function jD(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${lr} indefinite length items not allowed`);return ml(t,e,1,1/0)}s(jD,"decodeArrayIndefinite");c(jD,"decodeArrayIndefinite");function a2(t,e){_s(t,Le.array.majorEncoded,e.value)}s(a2,"encodeArray");c(a2,"encodeArray");a2.compareTokens=df.compareTokens;a2.encodedSize=c(s(function(e){return _s.encodedSize(e.value)},"encodedSize5"),"encodedSize");function bl(t,e,r,n){return new nt(Le.map,n,r)}s(bl,"toToken4");c(bl,"toToken");function qD(t,e,r,n){return bl(t,e,1,r)}s(qD,"decodeMapCompact");c(qD,"decodeMapCompact");function HD(t,e,r,n){return bl(t,e,2,cf(t,e+1,n))}s(HD,"decodeMap8");c(HD,"decodeMap8");function zD(t,e,r,n){return bl(t,e,3,ff(t,e+1,n))}s(zD,"decodeMap16");c(zD,"decodeMap16");function $D(t,e,r,n){return bl(t,e,5,lf(t,e+1,n))}s($D,"decodeMap32");c($D,"decodeMap32");function GD(t,e,r,n){let i=uf(t,e+1,n);if(typeof i=="bigint")throw new Error(`${lr} 64-bit integer map lengths not supported`);return bl(t,e,9,i)}s(GD,"decodeMap64");c(GD,"decodeMap64");function KD(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${lr} indefinite length items not allowed`);return bl(t,e,1,1/0)}s(KD,"decodeMapIndefinite");c(KD,"decodeMapIndefinite");function c2(t,e){_s(t,Le.map.majorEncoded,e.value)}s(c2,"encodeMap");c(c2,"encodeMap");c2.compareTokens=df.compareTokens;c2.encodedSize=c(s(function(e){return _s.encodedSize(e.value)},"encodedSize6"),"encodedSize");function VD(t,e,r,n){return new nt(Le.tag,r,1)}s(VD,"decodeTagCompact");c(VD,"decodeTagCompact");function WD(t,e,r,n){return new nt(Le.tag,cf(t,e+1,n),2)}s(WD,"decodeTag8");c(WD,"decodeTag8");function JD(t,e,r,n){return new nt(Le.tag,ff(t,e+1,n),3)}s(JD,"decodeTag16");c(JD,"decodeTag16");function YD(t,e,r,n){return new nt(Le.tag,lf(t,e+1,n),5)}s(YD,"decodeTag32");c(YD,"decodeTag32");function XD(t,e,r,n){return new nt(Le.tag,uf(t,e+1,n),9)}s(XD,"decodeTag64");c(XD,"decodeTag64");function f2(t,e){_s(t,Le.tag.majorEncoded,e.value)}s(f2,"encodeTag");c(f2,"encodeTag");f2.compareTokens=df.compareTokens;f2.encodedSize=c(s(function(e){return _s.encodedSize(e.value)},"encodedSize7"),"encodedSize");var TX=20,MX=21,RX=22,BX=23;function ZD(t,e,r,n){if(n.allowUndefined===!1)throw new Error(`${lr} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new nt(Le.null,null,1):new nt(Le.undefined,void 0,1)}s(ZD,"decodeUndefined");c(ZD,"decodeUndefined");function QD(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${lr} indefinite length items not allowed`);return new nt(Le.break,void 0,1)}s(QD,"decodeBreak");c(QD,"decodeBreak");function l2(t,e,r){if(r){if(r.allowNaN===!1&&Number.isNaN(t))throw new Error(`${lr} NaN values are not supported`);if(r.allowInfinity===!1&&(t===1/0||t===-1/0))throw new Error(`${lr} Infinity values are not supported`)}return new nt(Le.float,t,e)}s(l2,"createToken");c(l2,"createToken");function eP(t,e,r,n){return l2(d2(t,e+1),3,n)}s(eP,"decodeFloat16");c(eP,"decodeFloat16");function tP(t,e,r,n){return l2(h2(t,e+1),5,n)}s(tP,"decodeFloat32");c(tP,"decodeFloat32");function rP(t,e,r,n){return l2(s8(t,e+1),9,n)}s(rP,"decodeFloat64");c(rP,"decodeFloat64");function u2(t,e,r){let n=e.value;if(n===!1)t.push([Le.float.majorEncoded|TX]);else if(n===!0)t.push([Le.float.majorEncoded|MX]);else if(n===null)t.push([Le.float.majorEncoded|RX]);else if(n===void 0)t.push([Le.float.majorEncoded|BX]);else{let i,o=!1;(!r||r.float64!==!0)&&(n8(n),i=d2(po,1),n===i||Number.isNaN(n)?(po[0]=249,t.push(po.slice(0,3)),o=!0):(i8(n),i=h2(po,1),n===i&&(po[0]=250,t.push(po.slice(0,5)),o=!0))),o||(iP(n),i=s8(po,1),po[0]=251,t.push(po.slice(0,9)))}}s(u2,"encodeFloat");c(u2,"encodeFloat");u2.encodedSize=c(s(function(e,r){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){n8(n);let i=d2(po,1);if(n===i||Number.isNaN(n))return 3;if(i8(n),i=h2(po,1),n===i)return 5}return 9},"encodedSize8"),"encodedSize");var nP=new ArrayBuffer(9),qs=new DataView(nP,1),po=new Uint8Array(nP,0);function n8(t){if(t===1/0)qs.setUint16(0,31744,!1);else if(t===-1/0)qs.setUint16(0,64512,!1);else if(Number.isNaN(t))qs.setUint16(0,32256,!1);else{qs.setFloat32(0,t);let e=qs.getUint32(0),r=(e&2139095040)>>23,n=e&8388607;if(r===255)qs.setUint16(0,31744,!1);else if(r===0)qs.setUint16(0,(t&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?qs.setUint16(0,0):i<-14?qs.setUint16(0,(e&2147483648)>>16|1<<24+i,!1):qs.setUint16(0,(e&2147483648)>>16|i+15<<10|n>>13,!1)}}}s(n8,"encodeFloat16");c(n8,"encodeFloat16");function d2(t,e){if(t.length-e<2)throw new Error(`${lr} not enough data for float16`);let r=(t[e]<<8)+t[e+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}s(d2,"readFloat16");c(d2,"readFloat16");function i8(t){qs.setFloat32(0,t,!1)}s(i8,"encodeFloat32");c(i8,"encodeFloat32");function h2(t,e){if(t.length-e<4)throw new Error(`${lr} not enough data for float32`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,4).getFloat32(0,!1)}s(h2,"readFloat32");c(h2,"readFloat32");function iP(t){qs.setFloat64(0,t,!1)}s(iP,"encodeFloat64");c(iP,"encodeFloat64");function s8(t,e){if(t.length-e<8)throw new Error(`${lr} not enough data for float64`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,8).getFloat64(0,!1)}s(s8,"readFloat64");c(s8,"readFloat64");u2.compareTokens=df.compareTokens;function br(t,e,r){throw new Error(`${lr} encountered invalid minor (${r}) for major ${t[e]>>>5}`)}s(br,"invalidMinor");c(br,"invalidMinor");function M1(t){return()=>{throw new Error(`${lr} ${t}`)}}s(M1,"errorer");c(M1,"errorer");var ot=[];for(let t=0;t<=23;t++)ot[t]=br;ot[24]=mD;ot[25]=bD;ot[26]=gD;ot[27]=vD;ot[28]=br;ot[29]=br;ot[30]=br;ot[31]=br;for(let t=32;t<=55;t++)ot[t]=br;ot[56]=yD;ot[57]=xD;ot[58]=wD;ot[59]=AD;ot[60]=br;ot[61]=br;ot[62]=br;ot[63]=br;for(let t=64;t<=87;t++)ot[t]=ED;ot[88]=CD;ot[89]=SD;ot[90]=ID;ot[91]=kD;ot[92]=br;ot[93]=br;ot[94]=br;ot[95]=M1("indefinite length bytes/strings are not supported");for(let t=96;t<=119;t++)ot[t]=MD;ot[120]=RD;ot[121]=BD;ot[122]=DD;ot[123]=PD;ot[124]=br;ot[125]=br;ot[126]=br;ot[127]=M1("indefinite length bytes/strings are not supported");for(let t=128;t<=151;t++)ot[t]=FD;ot[152]=OD;ot[153]=ND;ot[154]=LD;ot[155]=UD;ot[156]=br;ot[157]=br;ot[158]=br;ot[159]=jD;for(let t=160;t<=183;t++)ot[t]=qD;ot[184]=HD;ot[185]=zD;ot[186]=$D;ot[187]=GD;ot[188]=br;ot[189]=br;ot[190]=br;ot[191]=KD;for(let t=192;t<=215;t++)ot[t]=VD;ot[216]=WD;ot[217]=JD;ot[218]=YD;ot[219]=XD;ot[220]=br;ot[221]=br;ot[222]=br;ot[223]=br;for(let t=224;t<=243;t++)ot[t]=M1("simple values are not supported");ot[244]=br;ot[245]=br;ot[246]=br;ot[247]=ZD;ot[248]=M1("simple values are not supported");ot[249]=eP;ot[250]=tP;ot[251]=rP;ot[252]=br;ot[253]=br;ot[254]=br;ot[255]=QD;var ya=[];for(let t=0;t<24;t++)ya[t]=new nt(Le.uint,t,1);for(let t=-1;t>=-24;t--)ya[31-t]=new nt(Le.negint,t,1);ya[64]=new nt(Le.bytes,new Uint8Array(0),1);ya[96]=new nt(Le.string,"",1);ya[128]=new nt(Le.array,0,1);ya[160]=new nt(Le.map,0,1);ya[244]=new nt(Le.false,!1,1);ya[245]=new nt(Le.true,!0,1);ya[246]=new nt(Le.null,null,1);function sP(t){switch(t.type){case Le.false:return Xa([244]);case Le.true:return Xa([245]);case Le.null:return Xa([246]);case Le.bytes:return t.value.length?void 0:Xa([64]);case Le.string:return t.value===""?Xa([96]):void 0;case Le.array:return t.value===0?Xa([128]):void 0;case Le.map:return t.value===0?Xa([160]):void 0;case Le.uint:return t.value<24?Xa([Number(t.value)]):void 0;case Le.negint:if(t.value>=-24)return Xa([31-Number(t.value)])}}s(sP,"quickEncodeToken");c(sP,"quickEncodeToken");var DX={float64:!1,mapSorter:fP,quickEncodeToken:sP};function oP(){let t=[];return t[Le.uint.major]=df,t[Le.negint.major]=o2,t[Le.bytes.major]=T1,t[Le.string.major]=kX,t[Le.array.major]=a2,t[Le.map.major]=c2,t[Le.tag.major]=f2,t[Le.float.major]=u2,t}s(oP,"makeCborEncoders");c(oP,"makeCborEncoders");var aP=oP(),m4=new t8,ng=s(class{constructor(t,e){this.obj=t,this.parent=e}includes(t){let e=this;do if(e.obj===t)return!0;while(e=e.parent);return!1}static createCheck(t,e){if(t&&t.includes(e))throw new Error(`${pD} object contains circular references`);return new ng(e,t)}},"Ref");c(ng,"Ref");var jc={null:new nt(Le.null,null),undefined:new nt(Le.undefined,void 0),true:new nt(Le.true,!0),false:new nt(Le.false,!1),emptyArray:new nt(Le.array,0),emptyMap:new nt(Le.map,0)},tf={number(t,e,r,n){return!Number.isInteger(t)||!Number.isSafeInteger(t)?new nt(Le.float,t):t>=0?new nt(Le.uint,t):new nt(Le.negint,t)},bigint(t,e,r,n){return t>=BigInt(0)?new nt(Le.uint,t):new nt(Le.negint,t)},Uint8Array(t,e,r,n){return new nt(Le.bytes,t)},string(t,e,r,n){return new nt(Le.string,t)},boolean(t,e,r,n){return t?jc.true:jc.false},null(t,e,r,n){return jc.null},undefined(t,e,r,n){return jc.undefined},ArrayBuffer(t,e,r,n){return new nt(Le.bytes,new Uint8Array(t))},DataView(t,e,r,n){return new nt(Le.bytes,new Uint8Array(t.buffer,t.byteOffset,t.byteLength))},Array(t,e,r,n){if(!t.length)return r.addBreakTokens===!0?[jc.emptyArray,new nt(Le.break)]:jc.emptyArray;n=ng.createCheck(n,t);let i=[],o=0;for(let a of t)i[o++]=N0(a,r,n);return r.addBreakTokens?[new nt(Le.array,t.length),i,new nt(Le.break)]:[new nt(Le.array,t.length),i]},Object(t,e,r,n){let i=e!=="Object",o=i?t.keys():Object.keys(t),a=i?t.size:o.length;if(!a)return r.addBreakTokens===!0?[jc.emptyMap,new nt(Le.break)]:jc.emptyMap;n=ng.createCheck(n,t);let f=[],l=0;for(let d of o)f[l++]=[N0(d,r,n),N0(i?t.get(d):t[d],r,n)];return cP(f,r),r.addBreakTokens?[new nt(Le.map,a),f,new nt(Le.break)]:[new nt(Le.map,a),f]}};tf.Map=tf.Object;tf.Buffer=tf.Uint8Array;for(let t of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))tf[`${t}Array`]=tf.DataView;function N0(t,e={},r){let n=fD(t),i=e&&e.typeEncoders&&e.typeEncoders[n]||tf[n];if(typeof i=="function"){let a=i(t,n,e,r);if(a!=null)return a}let o=tf[n];if(!o)throw new Error(`${pD} unsupported type: ${n}`);return o(t,n,e,r)}s(N0,"objectToTokens");c(N0,"objectToTokens");function cP(t,e){e.mapSorter&&t.sort(e.mapSorter)}s(cP,"sortMapEntries");c(cP,"sortMapEntries");function fP(t,e){let r=Array.isArray(t[0])?t[0][0]:t[0],n=Array.isArray(e[0])?e[0][0]:e[0];if(r.type!==n.type)return r.type.compare(n.type);let i=r.type.major,o=aP[i].compareTokens(r,n);return o===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),o}s(fP,"mapSorter");c(fP,"mapSorter");function o8(t,e,r,n){if(Array.isArray(e))for(let i of e)o8(t,i,r,n);else r[e.type.major](t,e,n)}s(o8,"tokensToEncoded");c(o8,"tokensToEncoded");function lP(t,e,r){let n=N0(t,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let o=e[n.type.major];if(o.encodedSize){let a=o.encodedSize(n,r),f=new t8(a);if(o(f,n,r),f.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return Qy(f.chunks[0])}}return m4.reset(),o8(m4,n,e,r),m4.toBytes(!0)}s(lP,"encodeCustom");c(lP,"encodeCustom");function p2(t,e){return e=Object.assign({},DX,e),lP(t,aP,e)}s(p2,"encode6");c(p2,"encode");var PX={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},uP=s(class{constructor(t,e={}){this.pos=0,this.data=t,this.options=e}done(){return this.pos>=this.data.length}next(){let t=this.data[this.pos],e=ya[t];if(e===void 0){let r=ot[t];if(!r)throw new Error(`${lr} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let n=t&31;e=r(this.data,this.pos,n,this.options)}return this.pos+=e.encodedLength,e}},"Tokeniser");c(uP,"Tokeniser");var n1=Symbol.for("DONE"),m2=Symbol.for("BREAK");function dP(t,e,r){let n=[];for(let i=0;i<t.value;i++){let o=sd(e,r);if(o===m2){if(t.value===1/0)break;throw new Error(`${lr} got unexpected break to lengthed array`)}if(o===n1)throw new Error(`${lr} found array but not enough entries (got ${i}, expected ${t.value})`);n[i]=o}return n}s(dP,"tokenToArray");c(dP,"tokenToArray");function hP(t,e,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<t.value;a++){let f=sd(e,r);if(f===m2){if(t.value===1/0)break;throw new Error(`${lr} got unexpected break to lengthed map`)}if(f===n1)throw new Error(`${lr} found map but not enough entries (got ${a} [no key], expected ${t.value})`);if(n!==!0&&typeof f!="string")throw new Error(`${lr} non-string keys not supported (got ${typeof f})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(f)||!n&&f in i))throw new Error(`${lr} found repeat map key "${f}"`);let l=sd(e,r);if(l===n1)throw new Error(`${lr} found map but not enough entries (got ${a} [no value], expected ${t.value})`);n?o.set(f,l):i[f]=l}return n?o:i}s(hP,"tokenToMap");c(hP,"tokenToMap");function sd(t,e){if(t.done())return n1;let r=t.next();if(r.type===Le.break)return m2;if(r.type.terminal)return r.value;if(r.type===Le.array)return dP(r,t,e);if(r.type===Le.map)return hP(r,t,e);if(r.type===Le.tag){if(e.tags&&typeof e.tags[r.value]=="function"){let n=sd(t,e);return e.tags[r.value](n)}throw new Error(`${lr} tag not supported (${r.value})`)}throw new Error("unsupported")}s(sd,"tokensToObject");c(sd,"tokensToObject");function b2(t,e){if(!(t instanceof Uint8Array))throw new Error(`${lr} data to decode must be a Uint8Array`);e=Object.assign({},PX,e);let r=e.tokenizer||new uP(t,e),n=sd(r,e);if(n===n1)throw new Error(`${lr} did not find any content to decode`);if(n===m2)throw new Error(`${lr} got unexpected break`);if(!r.done())throw new Error(`${lr} too many terminals, data makes no sense`);return n}s(b2,"decode7");c(b2,"decode");ba();var pP=42;function mP(t){if(t.asCID!==t)return null;let e=tr.asCID(t);if(!e)return null;let r=new Uint8Array(e.bytes.byteLength+1);return r.set(e.bytes,1),[new nt(Le.tag,pP),new nt(Le.bytes,r)]}s(mP,"cidEncoder");c(mP,"cidEncoder");function bP(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}s(bP,"undefinedEncoder");c(bP,"undefinedEncoder");function gP(t){if(Number.isNaN(t))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(t===1/0||t===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}s(gP,"numberEncoder");c(gP,"numberEncoder");var FX={float64:!0,typeEncoders:{Object:mP,undefined:bP,number:gP}};function vP(t){if(t[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return tr.decode(t.subarray(1))}s(vP,"cidDecoder");c(vP,"cidDecoder");var yP={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};yP.tags[pP]=vP;var OX="dag-cbor",ig=113,g2=c(t=>p2(t,FX),"encode"),xP=c(t=>b2(t,yP),"decode"),NX=24;async function wP(t){let e=await s2({value:t,codec:bd,hasher:ud});return{cid:e.cid,linkedBlock:e.bytes}}s(wP,"encodePayload");c(wP,"encodePayload");function _P(t,e=NX){let r=(e-t.length%e)%e,n=new Uint8Array(t.length+r);return n.set(t,0),n}s(_P,"pad");c(_P,"pad");async function AP(t){return(await s2({value:t,codec:bd,hasher:Kg})).cid}s(AP,"encodeIdentityCID");c(AP,"encodeIdentityCID");function EP(t){if(t=tr.asCID(t),t.code!==ig)throw new Error("CID codec must be dag-cbor");if(t.multihash.code!==Kg.code)throw new Error("CID must use identity multihash");return xP(t.multihash.digest)}s(EP,"decodeIdentityCID");c(EP,"decodeIdentityCID");async function CP(t,e){return _P((await AP(t)).bytes,e)}s(CP,"prepareCleartext");c(CP,"prepareCleartext");function SP(t){return EP(tr.decodeFirst(t)[0])}s(SP,"decodeCleartext");c(SP,"decodeCleartext");var LX=Symbol("abortable"),s5=Symbol("aborted");function IP(t,e){if(e.aborted)return Promise.reject(s5);let r,n=new Promise((i,o)=>{r=o});return e.addEventListener("abort",()=>{r(s5)}),Promise.race([t,n])}s(IP,"abortable");c(IP,"abortable");var UX=c((t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),""),"nanoid"),kP="utils_abort_request",Xi;(function(t){t[t.PARSE_ERROR=-32700]="PARSE_ERROR",t[t.INVALID_REQUEST=-32600]="INVALID_REQUEST",t[t.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",t[t.INVALID_PARAMS=-32602]="INVALID_PARAMS",t[t.INTERNAL_ERROR=-32603]="INTERNAL_ERROR"})(Xi||(Xi={}));var TP={[Xi.PARSE_ERROR]:"Parse error",[Xi.INVALID_REQUEST]:"Invalid request",[Xi.METHOD_NOT_FOUND]:"Method not found",[Xi.INVALID_PARAMS]:"Invalid params",[Xi.INTERNAL_ERROR]:"Internal error"};function MP(t){return-32e3>=t&&t>=-32099}s(MP,"isServerError");c(MP,"isServerError");function v2(t){return TP[t.toString()]??(MP(t)?"Server error":"Application error")}s(v2,"getErrorMessage");c(v2,"getErrorMessage");var rf=s(class extends Error{static fromObject(t){return new rf(t.code,t.message,t.data)}toObject(){return{code:this.code,data:this.data,message:this.message}}constructor(t,e,r){super(),Object.setPrototypeOf(this,rf.prototype),this.code=t,this.data=r,this.message=e??v2(t)}},"RPCError");c(rf,"RPCError");function xd(t){let e=TP[t];return c(s(function(n){return new rf(t,e,n)},"createError"),"createError")}s(xd,"createErrorFactory");c(xd,"createErrorFactory");var Kle=xd(Xi.PARSE_ERROR),Vle=xd(Xi.INVALID_REQUEST),Wle=xd(Xi.METHOD_NOT_FOUND),Jle=xd(Xi.INVALID_PARAMS),Yle=xd(Xi.INTERNAL_ERROR);function RP(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}s(RP,"_checkPrivateRedeclaration");c(RP,"_checkPrivateRedeclaration");function BP(t,e){return e.get?e.get.call(t):e.value}s(BP,"_classApplyDescriptorGet");c(BP,"_classApplyDescriptorGet");function DP(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}s(DP,"_classApplyDescriptorSet");c(DP,"_classApplyDescriptorSet");function a8(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}s(a8,"_classExtractFieldDescriptor");c(a8,"_classExtractFieldDescriptor");function Eb(t,e){var r=a8(t,e,"get");return BP(t,r)}s(Eb,"_classPrivateFieldGet");c(Eb,"_classPrivateFieldGet");function PP(t,e,r){RP(t,e),e.set(t,r)}s(PP,"_classPrivateFieldInit");c(PP,"_classPrivateFieldInit");function FP(t,e,r){var n=a8(t,e,"set");return DP(t,n,r),r}s(FP,"_classPrivateFieldSet");c(FP,"_classPrivateFieldSet");var w0=new WeakMap,o5=s(class{get connection(){return Eb(this,w0)}createID(){return UX()}request(t,e=void 0,r={}){let{signal:n}=r;if(n?.aborted)return Promise.reject(s5);let i=this.createID(),o=Eb(this,w0).send({jsonrpc:"2.0",id:i,method:t,params:e}).then(a=>{if(a==null)throw new Error("Missing response");if(a.error!=null)throw rf.fromObject(a.error);return a.result});return n==null?o:(n.addEventListener("abort",()=>{this.notify(kP,{id:i})}),IP(o,n))}async notify(t,e=void 0){await Eb(this,w0).send({jsonrpc:"2.0",method:t,params:e})}constructor(t){PP(this,w0,{writable:!0,value:void 0}),FP(this,w0,t)}},"RPCClient");c(o5,"RPCClient");function a5(t,e){return{jsonrpc:"2.0",id:t,error:{code:e,message:v2(e)}}}s(a5,"createErrorResponse");c(a5,"createErrorResponse");function OP(t,e,r){console.warn("Unhandled handler error",e,r)}s(OP,"fallbackOnHandlerError");c(OP,"fallbackOnHandlerError");function NP(t,e){console.warn("Unhandled invalid message",e)}s(NP,"fallbackOnInvalidMessage");c(NP,"fallbackOnInvalidMessage");function LP(t,e){console.warn("Unhandled notification",e)}s(LP,"fallbackOnNotification");c(LP,"fallbackOnNotification");function UP(t,e={}){let r=e.onHandlerError??OP,n=e.onInvalidMessage??NP,i=e.onNotification??LP,o={};function a(f,l){if(l.method===kP){let d=l.params?.id;d!=null&&o[d]?.abort()}else i(f,l)}return s(a,"handleNotification"),c(a,"handleNotification"),c(s(async function(l,d){let p=d.id;if(d.jsonrpc!=="2.0"||d.method==null)return p==null?(n(l,d),null):a5(p,Xi.INVALID_REQUEST);let g=t[d.method];if(g==null)return p==null?(a(l,d),null):a5(p,Xi.METHOD_NOT_FOUND);try{let x;if(p!=null&&g[LX]){let C=new AbortController;o[p]=C,x=g(l,d.params,{signal:C.signal})}else x=g(l,d.params,{});let A=x==null?x:typeof x.then=="function"?await x:x;return p==null||o[p]?.signal.aborted?null:{jsonrpc:"2.0",id:p,result:A}}catch(x){if(p==null||o[p]?.signal.aborted)return r(l,d,x),null;let A;if(x instanceof rf)A=x.toObject();else{r(l,d,x);let C=x.code??-32e3;A={code:C,message:x.message||v2(C)}}return{jsonrpc:"2.0",id:p,error:A}}finally{p!=null&&delete o[p]}},"handleRequest"),"handleRequest")}s(UP,"createHandler");c(UP,"createHandler");ba();var jX=dr(bV(),1),Ri=dr(md(),1),qX=`
659
+ }`)),document.body.appendChild(i);let o={};return o.permissions=new YR(n),o.CredentialHandlers=new WR(n),o.CredentialHandler=GR,o.CredentialManager=Kb,o.credentials=new JR(n),o.WebCredential=qu,navigator.credentialsPolyfill=o,"credentials"in navigator?(navigator.credentials.get=o.credentials.get.bind(o.credentials),navigator.credentials.store=o.credentials.store.bind(o.credentials)):navigator.credentials=o.credentials,window.CredentialManager=Kb,window.WebCredential=qu,o}s(ZR,"load2");c(ZR,"load");function QR(){if(!window.isSecureContext)throw new DOMException("SecurityError","The operation is insecure.")}s(QR,"_assertSecureContext");c(QR,"_assertSecureContext");var lW=6e4,eB=s(class extends My{constructor(){super(window.location.origin)}async receive(){let t=this;return await t.connect(),new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("Timed out waiting to receive event."))},lW);t.server.define("credentialEventProxy",{async send(i){return e(i),clearTimeout(n),new Promise((o,a)=>{i.respondWith=f=>{try{o(f)}catch(l){a(l)}}})}}),t.ready()})}},"CredentialEventProxy");c(eB,"CredentialEventProxy");var uW="https://authn.io";async function tB(){if(await navigator.credentialsPolyfill.CredentialManager.requestPermission()!=="granted")throw new Error("Permission denied.")}s(tB,"installHandler");c(tB,"installHandler");async function rB({mediatorOrigin:t=uW,get:e,store:r}){if(!(e||r))throw new Error('"get" or "store" function(s) must be specified.');let n=navigator.credentialsPolyfill.CredentialHandler,i=new n(t);if(e){if(typeof e!="function")throw new TypeError('"get" must be a function.');i.addEventListener("credentialrequest",o=>j4({event:o,get:e}))}if(r){if(typeof r!="function")throw new TypeError('"store" must be a function.');i.addEventListener("credentialstore",o=>j4({event:o,store:r}))}await i.connect()}s(rB,"activateHandler");c(rB,"activateHandler");async function nB(){return new eB().receive()}s(nB,"receiveCredentialEvent");c(nB,"receiveCredentialEvent");function j4({event:t,get:e,store:r}){t.respondWith(iB({event:t,get:e,store:r}))}s(j4,"listener");c(j4,"listener");async function iB({event:t,get:e,store:r}){let n=await(e||r)({event:t});if(!(n&&typeof n=="object"))throw new TypeError('Return value of "get" or "store" hook must be an object.');if(n.type==="response")return{dataType:n.dataType,data:n.data};if(n.type==="redirect"){let i=new By,o=await t.openWindow(n.url);return(await i.createWindow(n.url,{handle:o,popup:!1,timeout:6e5})).get("credentialEventProxy",{functions:[{name:"send",options:{timeout:0}}]}).send({type:t.type,credentialRequestOptions:t.credentialRequestOptions,credentialRequestOrigin:t.credentialRequestOrigin,credential:t.credential,hintKey:t.hintKey})}throw new Error('Return value of "get" or "store" must have a type of "response" or "redirect".')}s(iB,"createResponse");c(iB,"createResponse");var Dy=c(async()=>typeof window>"u"?{name:"CHAPI",methods:{installChapiHandler:async()=>{throw new Error("CHAPI is only available inside of a browser!")},activateChapiHandler:async()=>{throw new Error("CHAPI is only available inside of a browser!")},receiveChapiEvent:async()=>{throw new Error("CHAPI is only available inside of a browser!")},storeCredentialViaChapiDidAuth:async()=>{throw new Error("CHAPI is only available inside of a browser!")},storePresentationViaChapi:async()=>{throw new Error("CHAPI is only available inside of a browser!")}}}:(await XR(),{name:"CHAPI",displayName:"CHAPI",description:"Credential Handler API. Allows sending/retrieving credentials across wallets and issuers",methods:{installChapiHandler:async()=>tB(),activateChapiHandler:async(t,{mediatorOrigin:e=`https://authn.io/mediator?${encodeURIComponent(window.location.origin)}`,get:r,store:n})=>rB({mediatorOrigin:e,get:r,store:n}),receiveChapiEvent:async()=>nB(),storeCredentialViaChapiDidAuth:async(t,e)=>{let r=crypto.randomUUID(),n=window.location.origin,i={web:{VerifiablePresentation:{query:{type:"DIDAuthentication"},challenge:r,domain:n}}},o=await navigator.credentials.get(i);if(!o)return{success:!1,reason:"did not auth"};let a=await t.invoke.verifyPresentation(o.data,{challenge:r,domain:n,proofPurpose:"authentication"});if(a.warnings.length>0||a.errors.length>0)return{success:!1,reason:"auth failed verification"};let f=o.data?.proof?.verificationMethod?.split("#")[0];Array.isArray(e.credentialSubject)||(e.credentialSubject.id=f);let l=await t.invoke.getTestVp(await t.invoke.issueCredential(e));return await t.invoke.storePresentationViaChapi(l)?{success:!0}:{success:!1,reason:"did not store"}},storePresentationViaChapi:async(t,e)=>{let r=new WebCredential("VerifiablePresentation",e);return window.navigator.credentials.store(r)}}}),"getCHAPIPlugin"),wr;(function(t){t.assertEqual=i=>i;function e(i){}s(e,"assertIs"),c(e,"assertIs"),t.assertIs=e;function r(i){throw new Error}s(r,"assertNever"),c(r,"assertNever"),t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let a of i)o[a]=a;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(f=>typeof i[i[f]]!="number"),a={};for(let f of o)a[f]=i[f];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},t.find=(i,o)=>{for(let a of i)if(o(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}s(n,"joinValues"),c(n,"joinValues"),t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(wr||(wr={}));var vt=wr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$c=c(t=>{switch(typeof t){case"undefined":return vt.undefined;case"string":return vt.string;case"number":return isNaN(t)?vt.nan:vt.number;case"boolean":return vt.boolean;case"function":return vt.function;case"bigint":return vt.bigint;case"symbol":return vt.symbol;case"object":return Array.isArray(t)?vt.array:t===null?vt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?vt.promise:typeof Map<"u"&&t instanceof Map?vt.map:typeof Set<"u"&&t instanceof Set?vt.set:typeof Date<"u"&&t instanceof Date?vt.date:vt.object;default:return vt.unknown}},"getParsedType"),rt=wr.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"]),dW=c(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),oa=s(class extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){let e=t||function(i){return i.message},r={_errors:[]},n=c(i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)r._errors.push(e(o));else{let a=r,f=0;for(;f<o.path.length;){let l=o.path[f];f===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(e(o))):a[l]=a[l]||{_errors:[]},a=a[l],f++}}},"processError");return n(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,wr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=e=>e.message){let e={},r=[];for(let n of this.issues)n.path.length>0?(e[n.path[0]]=e[n.path[0]]||[],e[n.path[0]].push(t(n))):r.push(t(n));return{formErrors:r,fieldErrors:e}}get formErrors(){return this.flatten()}},"ZodError");c(oa,"ZodError");oa.create=t=>new oa(t);var H0=c((t,e)=>{let r;switch(t.code){case rt.invalid_type:t.received===vt.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case rt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,wr.jsonStringifyReplacer)}`;break;case rt.unrecognized_keys:r=`Unrecognized key(s) in object: ${wr.joinValues(t.keys,", ")}`;break;case rt.invalid_union:r="Invalid input";break;case rt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${wr.joinValues(t.options)}`;break;case rt.invalid_enum_value:r=`Invalid enum value. Expected ${wr.joinValues(t.options)}, received '${t.received}'`;break;case rt.invalid_arguments:r="Invalid function arguments";break;case rt.invalid_return_type:r="Invalid function return type";break;case rt.invalid_date:r="Invalid date";break;case rt.invalid_string:typeof t.validation=="object"?"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:wr.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case rt.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(t.minimum)}`:r="Invalid input";break;case rt.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(t.maximum)}`:r="Invalid input";break;case rt.custom:r="Invalid input";break;case rt.invalid_intersection_types:r="Intersection results could not be merged";break;case rt.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case rt.not_finite:r="Number must be finite";break;default:r=e.defaultError,wr.assertNever(t)}return{message:r}},"errorMap"),sB=H0;function oB(t){sB=t}s(oB,"setErrorMap");c(oB,"setErrorMap");function z0(){return sB}s(z0,"getErrorMap");c(z0,"getErrorMap");var Vb=c(t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],a={...i,path:o},f="",l=n.filter(d=>!!d).slice().reverse();for(let d of l)f=d(a,{data:e,defaultError:f}).message;return{...i,path:o,message:i.message||f}},"makeIssue"),hW=[];function At(t,e){let r=Vb({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,z0(),H0].filter(n=>!!n)});t.common.issues.push(r)}s(At,"addIssueToContext");c(At,"addIssueToContext");var Oi=s(class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,e){let r=[];for(let n of e){if(n.status==="aborted")return Ut;n.status==="dirty"&&t.dirty(),r.push(n.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,e){let r=[];for(let n of e)r.push({key:await n.key,value:await n.value});return Oi.mergeObjectSync(t,r)}static mergeObjectSync(t,e){let r={};for(let n of e){let{key:i,value:o}=n;if(i.status==="aborted"||o.status==="aborted")return Ut;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),(typeof o.value<"u"||n.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}},"ParseStatus");c(Oi,"ParseStatus");var Ut=Object.freeze({status:"aborted"}),aB=c(t=>({status:"dirty",value:t}),"DIRTY"),gi=c(t=>({status:"valid",value:t}),"OK"),q4=c(t=>t.status==="aborted","isAborted"),H4=c(t=>t.status==="dirty","isDirty"),Wb=c(t=>t.status==="valid","isValid"),Jb=c(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync"),or;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(or||(or={}));var _o=s(class{constructor(t,e,r,n){this.parent=t,this.data=e,this._path=r,this._key=n}get path(){return this._path.concat(this._key)}},"ParseInputLazyPath");c(_o,"ParseInputLazyPath");var wk=c((t,e)=>{if(Wb(e))return{success:!0,data:e.value};{if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new oa(t.common.issues);return{success:!1,error:r}}},"handleResult");function Vt(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:c((a,f)=>a.code!=="invalid_type"?{message:f.defaultError}:typeof f.data>"u"?{message:n??f.defaultError}:{message:r??f.defaultError},"customMap"),description:i}}s(Vt,"processCreateParams");c(Vt,"processCreateParams");var er=s(class{constructor(t){this.spa=this.safeParseAsync,this._def=t,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(t){return $c(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:$c(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Oi,ctx:{common:t.parent.common,data:t.data,parsedType:$c(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(Jb(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let r=this.safeParse(t,e);if(r.success)return r.data;throw r.error}safeParse(t,e){var r;let n={common:{issues:[],async:(r=e?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$c(t)},i=this._parseSync({data:t,path:n.path,parent:n});return wk(n,i)}async parseAsync(t,e){let r=await this.safeParseAsync(t,e);if(r.success)return r.data;throw r.error}async safeParseAsync(t,e){let r={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:$c(t)},n=this._parse({data:t,path:r.path,parent:r}),i=await(Jb(n)?n:Promise.resolve(n));return wk(r,i)}refine(t,e){let r=c(n=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(n):e,"getIssueProperties");return this._refinement((n,i)=>{let o=t(n),a=c(()=>i.addIssue({code:rt.custom,...r(n)}),"setError");return typeof Promise<"u"&&o instanceof Promise?o.then(f=>f?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,e){return this._refinement((r,n)=>t(r)?!0:(n.addIssue(typeof e=="function"?e(r,n):e),!1))}_refinement(t){return new Ks({schema:this,typeName:Ot.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return aa.create(this,this._def)}nullable(){return Xc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xo.create(this,this._def)}promise(){return il.create(this,this._def)}or(t){return Qu.create([this,t],this._def)}and(t){return ed.create(this,t,this._def)}transform(t){return new Ks({...Vt(this._def),schema:this,typeName:Ot.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t=="function"?t:()=>t;return new id({...Vt(this._def),innerType:this,defaultValue:e,typeName:Ot.ZodDefault})}brand(){return new Fy({typeName:Ot.ZodBranded,type:this,...Vt(this._def)})}catch(t){let e=typeof t=="function"?t:()=>t;return new W0({...Vt(this._def),innerType:this,catchValue:e,typeName:Ot.ZodCatch})}describe(t){let e=this.constructor;return new e({...this._def,description:t})}pipe(t){return S1.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},"ZodType");c(er,"ZodType");var pW=/^c[^\s-]{8,}$/i,mW=/^[a-z][a-z0-9]*$/,bW=/^([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,gW=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|([^-]([a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}))$/,vW=c(t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.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$"):t.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"),oc=s(class extends er{constructor(){super(...arguments),this._regex=(t,e,r)=>this.refinement(n=>t.test(n),{validation:e,code:rt.invalid_string,...or.errToObj(r)}),this.nonempty=t=>this.min(1,or.errToObj(t)),this.trim=()=>new oc({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==vt.string){let i=this._getOrReturnCtx(t);return At(i,{code:rt.invalid_type,expected:vt.string,received:i.parsedType}),Ut}let r=new Oi,n;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(n=this._getOrReturnCtx(t,n),At(n,{code:rt.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(n=this._getOrReturnCtx(t,n),At(n,{code:rt.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let o=t.data.length>i.value,a=t.data.length<i.value;(o||a)&&(n=this._getOrReturnCtx(t,n),o?At(n,{code:rt.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&At(n,{code:rt.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")gW.test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{validation:"email",code:rt.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")bW.test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{validation:"uuid",code:rt.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")pW.test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{validation:"cuid",code:rt.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")mW.test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{validation:"cuid2",code:rt.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),At(n,{validation:"url",code:rt.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{validation:"regex",code:rt.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="startsWith"?t.data.startsWith(i.value)||(n=this._getOrReturnCtx(t,n),At(n,{code:rt.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(n=this._getOrReturnCtx(t,n),At(n,{code:rt.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?vW(i).test(t.data)||(n=this._getOrReturnCtx(t,n),At(n,{code:rt.invalid_string,validation:"datetime",message:i.message}),r.dirty()):wr.assertNever(i);return{status:r.value,value:t.data}}_addCheck(t){return new oc({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...or.errToObj(t)})}url(t){return this._addCheck({kind:"url",...or.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...or.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...or.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...or.errToObj(t)})}datetime(t){var e;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(e=t?.offset)!==null&&e!==void 0?e:!1,...or.errToObj(t?.message)})}regex(t,e){return this._addCheck({kind:"regex",regex:t,...or.errToObj(e)})}startsWith(t,e){return this._addCheck({kind:"startsWith",value:t,...or.errToObj(e)})}endsWith(t,e){return this._addCheck({kind:"endsWith",value:t,...or.errToObj(e)})}min(t,e){return this._addCheck({kind:"min",value:t,...or.errToObj(e)})}max(t,e){return this._addCheck({kind:"max",value:t,...or.errToObj(e)})}length(t,e){return this._addCheck({kind:"length",value:t,...or.errToObj(e)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get minLength(){let t=null;for(let e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t}get maxLength(){let t=null;for(let e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t}},"ZodString");c(oc,"ZodString");oc.create=t=>{var e;return new oc({checks:[],typeName:Ot.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Vt(t)})};function cB(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=parseInt(t.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}s(cB,"floatSafeRemainder");c(cB,"floatSafeRemainder");var Jc=s(class extends er{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==vt.number){let i=this._getOrReturnCtx(t);return At(i,{code:rt.invalid_type,expected:vt.number,received:i.parsedType}),Ut}let r,n=new Oi;for(let i of this._def.checks)i.kind==="int"?wr.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),At(r,{code:rt.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),At(r,{code:rt.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),At(r,{code:rt.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?cB(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),At(r,{code:rt.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),At(r,{code:rt.not_finite,message:i.message}),n.dirty()):wr.assertNever(i);return{status:n.value,value:t.data}}gte(t,e){return this.setLimit("min",t,!0,or.toString(e))}gt(t,e){return this.setLimit("min",t,!1,or.toString(e))}lte(t,e){return this.setLimit("max",t,!0,or.toString(e))}lt(t,e){return this.setLimit("max",t,!1,or.toString(e))}setLimit(t,e,r,n){return new Jc({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:or.toString(n)}]})}_addCheck(t){return new Jc({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:or.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:or.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:or.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:or.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:or.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:or.toString(e)})}finite(t){return this._addCheck({kind:"finite",message:or.toString(t)})}get minValue(){let t=null;for(let e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t}get maxValue(){let t=null;for(let e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&wr.isInteger(t.value))}get isFinite(){let t=null,e=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(e===null||r.value>e)&&(e=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(e)&&Number.isFinite(t)}},"ZodNumber");c(Jc,"ZodNumber");Jc.create=t=>new Jc({checks:[],typeName:Ot.ZodNumber,coerce:t?.coerce||!1,...Vt(t)});var Ju=s(class extends er{_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==vt.bigint){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.bigint,received:r.parsedType}),Ut}return gi(t.data)}},"ZodBigInt");c(Ju,"ZodBigInt");Ju.create=t=>{var e;return new Ju({typeName:Ot.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...Vt(t)})};var Yu=s(class extends er{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==vt.boolean){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.boolean,received:r.parsedType}),Ut}return gi(t.data)}},"ZodBoolean");c(Yu,"ZodBoolean");Yu.create=t=>new Yu({typeName:Ot.ZodBoolean,coerce:t?.coerce||!1,...Vt(t)});var tl=s(class extends er{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==vt.date){let i=this._getOrReturnCtx(t);return At(i,{code:rt.invalid_type,expected:vt.date,received:i.parsedType}),Ut}if(isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return At(i,{code:rt.invalid_date}),Ut}let r=new Oi,n;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(n=this._getOrReturnCtx(t,n),At(n,{code:rt.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(n=this._getOrReturnCtx(t,n),At(n,{code:rt.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):wr.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new tl({...this._def,checks:[...this._def.checks,t]})}min(t,e){return this._addCheck({kind:"min",value:t.getTime(),message:or.toString(e)})}max(t,e){return this._addCheck({kind:"max",value:t.getTime(),message:or.toString(e)})}get minDate(){let t=null;for(let e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t!=null?new Date(t):null}},"ZodDate");c(tl,"ZodDate");tl.create=t=>new tl({checks:[],coerce:t?.coerce||!1,typeName:Ot.ZodDate,...Vt(t)});var $0=s(class extends er{_parse(t){if(this._getType(t)!==vt.symbol){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.symbol,received:r.parsedType}),Ut}return gi(t.data)}},"ZodSymbol");c($0,"ZodSymbol");$0.create=t=>new $0({typeName:Ot.ZodSymbol,...Vt(t)});var Xu=s(class extends er{_parse(t){if(this._getType(t)!==vt.undefined){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.undefined,received:r.parsedType}),Ut}return gi(t.data)}},"ZodUndefined");c(Xu,"ZodUndefined");Xu.create=t=>new Xu({typeName:Ot.ZodUndefined,...Vt(t)});var Zu=s(class extends er{_parse(t){if(this._getType(t)!==vt.null){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.null,received:r.parsedType}),Ut}return gi(t.data)}},"ZodNull");c(Zu,"ZodNull");Zu.create=t=>new Zu({typeName:Ot.ZodNull,...Vt(t)});var rl=s(class extends er{constructor(){super(...arguments),this._any=!0}_parse(t){return gi(t.data)}},"ZodAny");c(rl,"ZodAny");rl.create=t=>new rl({typeName:Ot.ZodAny,...Vt(t)});var Gc=s(class extends er{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gi(t.data)}},"ZodUnknown");c(Gc,"ZodUnknown");Gc.create=t=>new Gc({typeName:Ot.ZodUnknown,...Vt(t)});var ca=s(class extends er{_parse(t){let e=this._getOrReturnCtx(t);return At(e,{code:rt.invalid_type,expected:vt.never,received:e.parsedType}),Ut}},"ZodNever");c(ca,"ZodNever");ca.create=t=>new ca({typeName:Ot.ZodNever,...Vt(t)});var G0=s(class extends er{_parse(t){if(this._getType(t)!==vt.undefined){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.void,received:r.parsedType}),Ut}return gi(t.data)}},"ZodVoid");c(G0,"ZodVoid");G0.create=t=>new G0({typeName:Ot.ZodVoid,...Vt(t)});var xo=s(class extends er{_parse(t){let{ctx:e,status:r}=this._processInputParams(t),n=this._def;if(e.parsedType!==vt.array)return At(e,{code:rt.invalid_type,expected:vt.array,received:e.parsedType}),Ut;if(n.exactLength!==null){let o=e.data.length>n.exactLength.value,a=e.data.length<n.exactLength.value;(o||a)&&(At(e,{code:o?rt.too_big:rt.too_small,minimum:a?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&e.data.length<n.minLength.value&&(At(e,{code:rt.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&e.data.length>n.maxLength.value&&(At(e,{code:rt.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),e.common.async)return Promise.all([...e.data].map((o,a)=>n.type._parseAsync(new _o(e,o,e.path,a)))).then(o=>Oi.mergeArray(r,o));let i=[...e.data].map((o,a)=>n.type._parseSync(new _o(e,o,e.path,a)));return Oi.mergeArray(r,i)}get element(){return this._def.type}min(t,e){return new xo({...this._def,minLength:{value:t,message:or.toString(e)}})}max(t,e){return new xo({...this._def,maxLength:{value:t,message:or.toString(e)}})}length(t,e){return new xo({...this._def,exactLength:{value:t,message:or.toString(e)}})}nonempty(t){return this.min(1,t)}},"ZodArray");c(xo,"ZodArray");xo.create=(t,e)=>new xo({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ot.ZodArray,...Vt(e)});var Yb;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Yb||(Yb={}));function Vf(t){if(t instanceof rn){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=aa.create(Vf(n))}return new rn({...t._def,shape:()=>e})}else return t instanceof xo?xo.create(Vf(t.element)):t instanceof aa?aa.create(Vf(t.unwrap())):t instanceof Xc?Xc.create(Vf(t.unwrap())):t instanceof fa?fa.create(t.items.map(e=>Vf(e))):t}s(Vf,"deepPartialify");c(Vf,"deepPartialify");var rn=s(class extends er{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),e=wr.objectKeys(t);return this._cached={shape:t,keys:e}}_parse(t){if(this._getType(t)!==vt.object){let l=this._getOrReturnCtx(t);return At(l,{code:rt.invalid_type,expected:vt.object,received:l.parsedType}),Ut}let{status:r,ctx:n}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof ca&&this._def.unknownKeys==="strip"))for(let l in n.data)o.includes(l)||a.push(l);let f=[];for(let l of o){let d=i[l],p=n.data[l];f.push({key:{status:"valid",value:l},value:d._parse(new _o(n,p,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof ca){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of a)f.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(l==="strict")a.length>0&&(At(n,{code:rt.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of a){let p=n.data[d];f.push({key:{status:"valid",value:d},value:l._parse(new _o(n,p,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of f){let p=await d.key;l.push({key:p,value:await d.value,alwaysSet:d.alwaysSet})}return l}).then(l=>Oi.mergeObjectSync(r,l)):Oi.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(t){return or.errToObj,new rn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(e,r)=>{var n,i,o,a;let f=(o=(i=(n=this._def).errorMap)===null||i===void 0?void 0:i.call(n,e,r).message)!==null&&o!==void 0?o:r.defaultError;return e.code==="unrecognized_keys"?{message:(a=or.errToObj(t).message)!==null&&a!==void 0?a:f}:{message:f}}}:{}})}strip(){return new rn({...this._def,unknownKeys:"strip"})}passthrough(){return new rn({...this._def,unknownKeys:"passthrough"})}extend(t){return new rn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new rn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>Yb.mergeShapes(this._def.shape(),t._def.shape()),typeName:Ot.ZodObject})}setKey(t,e){return this.augment({[t]:e})}catchall(t){return new rn({...this._def,catchall:t})}pick(t){let e={};return wr.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(e[r]=this.shape[r])}),new rn({...this._def,shape:()=>e})}omit(t){let e={};return wr.objectKeys(this.shape).forEach(r=>{t[r]||(e[r]=this.shape[r])}),new rn({...this._def,shape:()=>e})}deepPartial(){return Vf(this)}partial(t){let e={};return wr.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];t&&!t[r]?e[r]=n:e[r]=n.optional()}),new rn({...this._def,shape:()=>e})}required(t){let e={};return wr.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])e[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof aa;)i=i._def.innerType;e[r]=i}}),new rn({...this._def,shape:()=>e})}keyof(){return Py(wr.objectKeys(this.shape))}},"ZodObject");c(rn,"ZodObject");rn.create=(t,e)=>new rn({shape:()=>t,unknownKeys:"strip",catchall:ca.create(),typeName:Ot.ZodObject,...Vt(e)});rn.strictCreate=(t,e)=>new rn({shape:()=>t,unknownKeys:"strict",catchall:ca.create(),typeName:Ot.ZodObject,...Vt(e)});rn.lazycreate=(t,e)=>new rn({shape:t,unknownKeys:"strip",catchall:ca.create(),typeName:Ot.ZodObject,...Vt(e)});var Qu=s(class extends er{_parse(t){let{ctx:e}=this._processInputParams(t),r=this._def.options;function n(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return e.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new oa(a.ctx.common.issues));return At(e,{code:rt.invalid_union,unionErrors:o}),Ut}if(s(n,"handleResults"),c(n,"handleResults"),e.common.async)return Promise.all(r.map(async i=>{let o={...e,common:{...e.common,issues:[]},parent:null};return{result:await i._parseAsync({data:e.data,path:e.path,parent:o}),ctx:o}})).then(n);{let i,o=[];for(let f of r){let l={...e,common:{...e.common,issues:[]},parent:null},d=f._parseSync({data:e.data,path:e.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(i)return e.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(f=>new oa(f));return At(e,{code:rt.invalid_union,unionErrors:a}),Ut}}get options(){return this._def.options}},"ZodUnion");c(Qu,"ZodUnion");Qu.create=(t,e)=>new Qu({options:t,typeName:Ot.ZodUnion,...Vt(e)});var _b=c(t=>t instanceof td?_b(t.schema):t instanceof Ks?_b(t.innerType()):t instanceof rd?[t.value]:t instanceof Yc?t.options:t instanceof nd?Object.keys(t.enum):t instanceof id?_b(t._def.innerType):t instanceof Xu?[void 0]:t instanceof Zu?[null]:null,"getDiscriminator"),e2=s(class extends er{_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==vt.object)return At(e,{code:rt.invalid_type,expected:vt.object,received:e.parsedType}),Ut;let r=this.discriminator,n=e.data[r],i=this.optionsMap.get(n);return i?e.common.async?i._parseAsync({data:e.data,path:e.path,parent:e}):i._parseSync({data:e.data,path:e.path,parent:e}):(At(e,{code:rt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ut)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,e,r){let n=new Map;for(let i of e){let o=_b(i.shape[t]);if(!o)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of o){if(n.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);n.set(a,i)}}return new e2({typeName:Ot.ZodDiscriminatedUnion,discriminator:t,options:e,optionsMap:n,...Vt(r)})}},"ZodDiscriminatedUnion");c(e2,"ZodDiscriminatedUnion");function Xb(t,e){let r=$c(t),n=$c(e);if(t===e)return{valid:!0,data:t};if(r===vt.object&&n===vt.object){let i=wr.objectKeys(e),o=wr.objectKeys(t).filter(f=>i.indexOf(f)!==-1),a={...t,...e};for(let f of o){let l=Xb(t[f],e[f]);if(!l.valid)return{valid:!1};a[f]=l.data}return{valid:!0,data:a}}else if(r===vt.array&&n===vt.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let a=t[o],f=e[o],l=Xb(a,f);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===vt.date&&n===vt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}s(Xb,"mergeValues");c(Xb,"mergeValues");var ed=s(class extends er{_parse(t){let{status:e,ctx:r}=this._processInputParams(t),n=c((i,o)=>{if(q4(i)||q4(o))return Ut;let a=Xb(i.value,o.value);return a.valid?((H4(i)||H4(o))&&e.dirty(),{status:e.value,value:a.data}):(At(r,{code:rt.invalid_intersection_types}),Ut)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>n(i,o)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}},"ZodIntersection");c(ed,"ZodIntersection");ed.create=(t,e,r)=>new ed({left:t,right:e,typeName:Ot.ZodIntersection,...Vt(r)});var fa=s(class extends er{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==vt.array)return At(r,{code:rt.invalid_type,expected:vt.array,received:r.parsedType}),Ut;if(r.data.length<this._def.items.length)return At(r,{code:rt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ut;!this._def.rest&&r.data.length>this._def.items.length&&(At(r,{code:rt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),e.dirty());let i=[...r.data].map((o,a)=>{let f=this._def.items[a]||this._def.rest;return f?f._parse(new _o(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Oi.mergeArray(e,o)):Oi.mergeArray(e,i)}get items(){return this._def.items}rest(t){return new fa({...this._def,rest:t})}},"ZodTuple");c(fa,"ZodTuple");fa.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fa({items:t,typeName:Ot.ZodTuple,rest:null,...Vt(e)})};var K0=s(class extends er{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==vt.object)return At(r,{code:rt.invalid_type,expected:vt.object,received:r.parsedType}),Ut;let n=[],i=this._def.keyType,o=this._def.valueType;for(let a in r.data)n.push({key:i._parse(new _o(r,a,r.path,a)),value:o._parse(new _o(r,r.data[a],r.path,a))});return r.common.async?Oi.mergeObjectAsync(e,n):Oi.mergeObjectSync(e,n)}get element(){return this._def.valueType}static create(t,e,r){return e instanceof er?new K0({keyType:t,valueType:e,typeName:Ot.ZodRecord,...Vt(r)}):new K0({keyType:oc.create(),valueType:t,typeName:Ot.ZodRecord,...Vt(e)})}},"ZodRecord");c(K0,"ZodRecord");var V0=s(class extends er{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==vt.map)return At(r,{code:rt.invalid_type,expected:vt.map,received:r.parsedType}),Ut;let n=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,f],l)=>({key:n._parse(new _o(r,a,r.path,[l,"key"])),value:i._parse(new _o(r,f,r.path,[l,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let f of o){let l=await f.key,d=await f.value;if(l.status==="aborted"||d.status==="aborted")return Ut;(l.status==="dirty"||d.status==="dirty")&&e.dirty(),a.set(l.value,d.value)}return{status:e.value,value:a}})}else{let a=new Map;for(let f of o){let l=f.key,d=f.value;if(l.status==="aborted"||d.status==="aborted")return Ut;(l.status==="dirty"||d.status==="dirty")&&e.dirty(),a.set(l.value,d.value)}return{status:e.value,value:a}}}},"ZodMap");c(V0,"ZodMap");V0.create=(t,e,r)=>new V0({valueType:e,keyType:t,typeName:Ot.ZodMap,...Vt(r)});var nl=s(class extends er{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==vt.set)return At(r,{code:rt.invalid_type,expected:vt.set,received:r.parsedType}),Ut;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(At(r,{code:rt.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),e.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&(At(r,{code:rt.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),e.dirty());let i=this._def.valueType;function o(f){let l=new Set;for(let d of f){if(d.status==="aborted")return Ut;d.status==="dirty"&&e.dirty(),l.add(d.value)}return{status:e.value,value:l}}s(o,"finalizeSet"),c(o,"finalizeSet");let a=[...r.data.values()].map((f,l)=>i._parse(new _o(r,f,r.path,l)));return r.common.async?Promise.all(a).then(f=>o(f)):o(a)}min(t,e){return new nl({...this._def,minSize:{value:t,message:or.toString(e)}})}max(t,e){return new nl({...this._def,maxSize:{value:t,message:or.toString(e)}})}size(t,e){return this.min(t,e).max(t,e)}nonempty(t){return this.min(1,t)}},"ZodSet");c(nl,"ZodSet");nl.create=(t,e)=>new nl({valueType:t,minSize:null,maxSize:null,typeName:Ot.ZodSet,...Vt(e)});var Hu=s(class extends er{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==vt.function)return At(e,{code:rt.invalid_type,expected:vt.function,received:e.parsedType}),Ut;function r(a,f){return Vb({data:a,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,z0(),H0].filter(l=>!!l),issueData:{code:rt.invalid_arguments,argumentsError:f}})}s(r,"makeArgsIssue"),c(r,"makeArgsIssue");function n(a,f){return Vb({data:a,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,z0(),H0].filter(l=>!!l),issueData:{code:rt.invalid_return_type,returnTypeError:f}})}s(n,"makeReturnsIssue"),c(n,"makeReturnsIssue");let i={errorMap:e.common.contextualErrorMap},o=e.data;return this._def.returns instanceof il?gi(async(...a)=>{let f=new oa([]),l=await this._def.args.parseAsync(a,i).catch(g=>{throw f.addIssue(r(a,g)),f}),d=await o(...l);return await this._def.returns._def.type.parseAsync(d,i).catch(g=>{throw f.addIssue(n(d,g)),f})}):gi((...a)=>{let f=this._def.args.safeParse(a,i);if(!f.success)throw new oa([r(a,f.error)]);let l=o(...f.data),d=this._def.returns.safeParse(l,i);if(!d.success)throw new oa([n(l,d.error)]);return d.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Hu({...this._def,args:fa.create(t).rest(Gc.create())})}returns(t){return new Hu({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,e,r){return new Hu({args:t||fa.create([]).rest(Gc.create()),returns:e||Gc.create(),typeName:Ot.ZodFunction,...Vt(r)})}},"ZodFunction");c(Hu,"ZodFunction");var td=s(class extends er{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}},"ZodLazy");c(td,"ZodLazy");td.create=(t,e)=>new td({getter:t,typeName:Ot.ZodLazy,...Vt(e)});var rd=s(class extends er{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return At(e,{received:e.data,code:rt.invalid_literal,expected:this._def.value}),Ut}return{status:"valid",value:t.data}}get value(){return this._def.value}},"ZodLiteral");c(rd,"ZodLiteral");rd.create=(t,e)=>new rd({value:t,typeName:Ot.ZodLiteral,...Vt(e)});function Py(t,e){return new Yc({values:t,typeName:Ot.ZodEnum,...Vt(e)})}s(Py,"createZodEnum");c(Py,"createZodEnum");var Yc=s(class extends er{_parse(t){if(typeof t.data!="string"){let e=this._getOrReturnCtx(t),r=this._def.values;return At(e,{expected:wr.joinValues(r),received:e.parsedType,code:rt.invalid_type}),Ut}if(this._def.values.indexOf(t.data)===-1){let e=this._getOrReturnCtx(t),r=this._def.values;return At(e,{received:e.data,code:rt.invalid_enum_value,options:r}),Ut}return gi(t.data)}get options(){return this._def.values}get enum(){let t={};for(let e of this._def.values)t[e]=e;return t}get Values(){let t={};for(let e of this._def.values)t[e]=e;return t}get Enum(){let t={};for(let e of this._def.values)t[e]=e;return t}extract(t){return Yc.create(t)}exclude(t){return Yc.create(this.options.filter(e=>!t.includes(e)))}},"ZodEnum");c(Yc,"ZodEnum");Yc.create=Py;var nd=s(class extends er{_parse(t){let e=wr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==vt.string&&r.parsedType!==vt.number){let n=wr.objectValues(e);return At(r,{expected:wr.joinValues(n),received:r.parsedType,code:rt.invalid_type}),Ut}if(e.indexOf(t.data)===-1){let n=wr.objectValues(e);return At(r,{received:r.data,code:rt.invalid_enum_value,options:n}),Ut}return gi(t.data)}get enum(){return this._def.values}},"ZodNativeEnum");c(nd,"ZodNativeEnum");nd.create=(t,e)=>new nd({values:t,typeName:Ot.ZodNativeEnum,...Vt(e)});var il=s(class extends er{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==vt.promise&&e.common.async===!1)return At(e,{code:rt.invalid_type,expected:vt.promise,received:e.parsedType}),Ut;let r=e.parsedType===vt.promise?e.data:Promise.resolve(e.data);return gi(r.then(n=>this._def.type.parseAsync(n,{path:e.path,errorMap:e.common.contextualErrorMap})))}},"ZodPromise");c(il,"ZodPromise");il.create=(t,e)=>new il({type:t,typeName:Ot.ZodPromise,...Vt(e)});var Ks=s(class extends er{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ot.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:e,ctx:r}=this._processInputParams(t),n=this._def.effect||null;if(n.type==="preprocess"){let o=n.transform(r.data);return r.common.async?Promise.resolve(o).then(a=>this._def.schema._parseAsync({data:a,path:r.path,parent:r})):this._def.schema._parseSync({data:o,path:r.path,parent:r})}let i={addIssue:o=>{At(r,o),o.fatal?e.abort():e.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="refinement"){let o=c(a=>{let f=n.refinement(a,i);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a},"executeRefinement");if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ut:(a.status==="dirty"&&e.dirty(),o(a.value),{status:e.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Ut:(a.status==="dirty"&&e.dirty(),o(a.value).then(()=>({status:e.value,value:a.value}))))}if(n.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Wb(o))return o;let a=n.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Wb(o)?Promise.resolve(n.transform(o.value,i)).then(a=>({status:e.value,value:a})):o);wr.assertNever(n)}},"ZodEffects");c(Ks,"ZodEffects");Ks.create=(t,e,r)=>new Ks({schema:t,typeName:Ot.ZodEffects,effect:e,...Vt(r)});Ks.createWithPreprocess=(t,e,r)=>new Ks({schema:e,effect:{type:"preprocess",transform:t},typeName:Ot.ZodEffects,...Vt(r)});var aa=s(class extends er{_parse(t){return this._getType(t)===vt.undefined?gi(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}},"ZodOptional");c(aa,"ZodOptional");aa.create=(t,e)=>new aa({innerType:t,typeName:Ot.ZodOptional,...Vt(e)});var Xc=s(class extends er{_parse(t){return this._getType(t)===vt.null?gi(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}},"ZodNullable");c(Xc,"ZodNullable");Xc.create=(t,e)=>new Xc({innerType:t,typeName:Ot.ZodNullable,...Vt(e)});var id=s(class extends er{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return e.parsedType===vt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:e.path,parent:e})}removeDefault(){return this._def.innerType}},"ZodDefault");c(id,"ZodDefault");id.create=(t,e)=>new id({innerType:t,typeName:Ot.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Vt(e)});var W0=s(class extends er{_parse(t){let{ctx:e}=this._processInputParams(t),r=this._def.innerType._parse({data:e.data,path:e.path,parent:{...e,common:{...e.common,issues:[]}}});return Jb(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue()})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue()}}removeCatch(){return this._def.innerType}},"ZodCatch");c(W0,"ZodCatch");W0.create=(t,e)=>new W0({innerType:t,typeName:Ot.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Vt(e)});var J0=s(class extends er{_parse(t){if(this._getType(t)!==vt.nan){let r=this._getOrReturnCtx(t);return At(r,{code:rt.invalid_type,expected:vt.nan,received:r.parsedType}),Ut}return{status:"valid",value:t.data}}},"ZodNaN");c(J0,"ZodNaN");J0.create=t=>new J0({typeName:Ot.ZodNaN,...Vt(t)});var yW=Symbol("zod_brand"),Fy=s(class extends er{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return this._def.type._parse({data:r,path:e.path,parent:e})}unwrap(){return this._def.type}},"ZodBranded");c(Fy,"ZodBranded");var S1=s(class extends er{_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.common.async)return c(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ut:i.status==="dirty"?(e.dirty(),aB(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})},"handleAsync")();{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?Ut:n.status==="dirty"?(e.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(t,e){return new S1({in:t,out:e,typeName:Ot.ZodPipeline})}},"ZodPipeline");c(S1,"ZodPipeline");var fB=c((t,e={},r)=>t?rl.create().superRefine((n,i)=>{if(!t(n)){let o=typeof e=="function"?e(n):e,a=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...a,fatal:r})}}):rl.create(),"custom"),xW={object:rn.lazycreate},Ot;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline"})(Ot||(Ot={}));var wW=c((t,e={message:`Input not instance of ${t.name}`})=>fB(r=>r instanceof t,e,!0),"instanceOfType"),lB=oc.create,uB=Jc.create,_W=J0.create,AW=Ju.create,dB=Yu.create,EW=tl.create,CW=$0.create,SW=Xu.create,IW=Zu.create,kW=rl.create,TW=Gc.create,MW=ca.create,RW=G0.create,BW=xo.create,DW=rn.create,PW=rn.strictCreate,FW=Qu.create,OW=e2.create,NW=ed.create,LW=fa.create,UW=K0.create,jW=V0.create,qW=nl.create,HW=Hu.create,zW=td.create,$W=rd.create,GW=Yc.create,KW=nd.create,VW=il.create,_k=Ks.create,WW=aa.create,JW=Xc.create,YW=Ks.createWithPreprocess,XW=S1.create,ZW=c(()=>lB().optional(),"ostring"),QW=c(()=>uB().optional(),"onumber"),eJ=c(()=>dB().optional(),"oboolean"),tJ={string:t=>oc.create({...t,coerce:!0}),number:t=>Jc.create({...t,coerce:!0}),boolean:t=>Yu.create({...t,coerce:!0}),bigint:t=>Ju.create({...t,coerce:!0}),date:t=>tl.create({...t,coerce:!0})},rJ=Ut,xe=Object.freeze({__proto__:null,defaultErrorMap:H0,setErrorMap:oB,getErrorMap:z0,makeIssue:Vb,EMPTY_PATH:hW,addIssueToContext:At,ParseStatus:Oi,INVALID:Ut,DIRTY:aB,OK:gi,isAborted:q4,isDirty:H4,isValid:Wb,isAsync:Jb,get util(){return wr},ZodParsedType:vt,getParsedType:$c,ZodType:er,ZodString:oc,ZodNumber:Jc,ZodBigInt:Ju,ZodBoolean:Yu,ZodDate:tl,ZodSymbol:$0,ZodUndefined:Xu,ZodNull:Zu,ZodAny:rl,ZodUnknown:Gc,ZodNever:ca,ZodVoid:G0,ZodArray:xo,get objectUtil(){return Yb},ZodObject:rn,ZodUnion:Qu,ZodDiscriminatedUnion:e2,ZodIntersection:ed,ZodTuple:fa,ZodRecord:K0,ZodMap:V0,ZodSet:nl,ZodFunction:Hu,ZodLazy:td,ZodLiteral:rd,ZodEnum:Yc,ZodNativeEnum:nd,ZodPromise:il,ZodEffects:Ks,ZodTransformer:Ks,ZodOptional:aa,ZodNullable:Xc,ZodDefault:id,ZodCatch:W0,ZodNaN:J0,BRAND:yW,ZodBranded:Fy,ZodPipeline:S1,custom:fB,Schema:er,ZodSchema:er,late:xW,get ZodFirstPartyTypeKind(){return Ot},coerce:tJ,any:kW,array:BW,bigint:AW,boolean:dB,date:EW,discriminatedUnion:OW,effect:_k,enum:GW,function:HW,instanceof:wW,intersection:NW,lazy:zW,literal:$W,map:jW,nan:_W,nativeEnum:KW,never:MW,null:IW,nullable:JW,number:uB,object:DW,oboolean:eJ,onumber:QW,optional:WW,ostring:ZW,pipeline:XW,preprocess:YW,promise:VW,record:UW,set:qW,strictObject:PW,string:lB,symbol:CW,transformer:_k,tuple:LW,undefined:SW,union:FW,unknown:TW,void:RW,NEVER:rJ,ZodIssueCode:rt,quotelessJson:dW,ZodError:oa}),hB=xe.array(xe.string().or(xe.record(xe.any()))),Fle=xe.object({type:xe.string().optional(),narrative:xe.string().optional()}),t2=xe.string().or(xe.object({id:xe.string(),type:xe.string(),caption:xe.string().optional()})),nJ=xe.object({type:xe.string().min(1).or(xe.string().array().nonempty()),latitude:xe.number(),longitude:xe.number()}),iJ=xe.object({type:xe.string().min(1).or(xe.string().array().nonempty()),addressCountry:xe.string().optional(),addressCountryCode:xe.string().optional(),addressRegion:xe.string().optional(),addressLocality:xe.string().optional(),streetAddress:xe.string().optional(),postOfficeBoxNumber:xe.string().optional(),postalCode:xe.string().optional(),geo:nJ.optional()}),sJ=xe.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(xe.string()),pB=xe.object({type:xe.string().min(1).or(xe.string().array().nonempty()),identifier:xe.string(),identifierType:sJ}),Y0=xe.string().or(xe.object({id:xe.string().optional(),type:xe.string().or(xe.string().array().nonempty().optional()),name:xe.string().optional(),url:xe.string().optional(),phone:xe.string().optional(),description:xe.string().optional(),endorsement:xe.any().array().optional(),image:t2.optional(),email:xe.string().email().optional(),address:iJ.optional(),otherIdentifier:pB.array().optional(),official:xe.string().optional(),parentOrg:xe.any().optional(),familyName:xe.string().optional(),givenName:xe.string().optional(),additionalName:xe.string().optional(),patronymicName:xe.string().optional(),honorificPrefix:xe.string().optional(),honorificSuffix:xe.string().optional(),familyNamePrefix:xe.string().optional(),dateOfBirth:xe.string().optional()}).catchall(xe.any())),z4=xe.object({id:xe.string().optional()}).catchall(xe.any()),oJ=xe.object({type:xe.string(),id:xe.string()}),aJ=xe.object({id:xe.string(),type:xe.string()}),cJ=xe.object({id:xe.string(),type:xe.string()}).catchall(xe.any()),X0=xe.object({"@context":hB,id:xe.string().optional(),type:xe.string().array().nonempty(),issuer:Y0,issuanceDate:xe.string(),expirationDate:xe.string().optional(),credentialSubject:z4.or(z4.array()),credentialStatus:oJ.optional(),credentialSchema:aJ.array().optional(),refreshService:cJ.optional()}).catchall(xe.any()),Zc=xe.object({type:xe.string(),created:xe.string(),challenge:xe.string().optional(),domain:xe.string().optional(),nonce:xe.string().optional(),proofPurpose:xe.string(),verificationMethod:xe.string(),jws:xe.string().optional()}).catchall(xe.any()),ic=X0.extend({proof:Zc.or(Zc.array())}),mB=xe.object({"@context":hB,id:xe.string().optional(),type:xe.string().array().nonempty(),verifiableCredential:ic.or(ic.array()).optional(),holder:xe.string().optional()}).catchall(xe.any()),Zb=mB.extend({proof:Zc.or(Zc.array())}),fJ=xe.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(xe.string()),r2=xe.object({type:xe.string().array().nonempty(),targetCode:xe.string().optional(),targetDescription:xe.string().optional(),targetName:xe.string(),targetFramework:xe.string().optional(),targetType:fJ.optional(),targetUrl:xe.string()}),lJ=xe.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"]),uJ=lJ.or(xe.string()),dJ=xe.object({id:xe.string().optional(),narrative:xe.string().optional()}).catchall(xe.any()),hJ=xe.object({id:xe.string(),type:xe.string().array().nonempty(),endorsementComment:xe.string().optional()}),pJ=X0.extend({credentialSubject:hJ,proof:Zc.or(Zc.array()).optional()}),mJ=xe.object({id:xe.string(),"@language":xe.string().optional(),version:xe.string().optional()}),bJ=xe.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(xe.string()),gJ=xe.object({id:xe.string(),type:xe.string().array().nonempty(),alignment:r2.array().optional(),description:xe.string().optional(),level:xe.string().optional(),name:xe.string(),points:xe.string().optional()}).catchall(xe.any()),vJ=xe.object({id:xe.string(),type:xe.string().array().nonempty(),alignment:r2.array().optional(),allowedValue:xe.string().array().optional(),name:xe.string(),requiredLevel:xe.string().optional(),requiredValue:xe.string().optional(),resultType:bJ,rubricCriterionLevel:gJ.array().optional(),valueMax:xe.string().optional(),valueMin:xe.string().optional()}).catchall(xe.any()),yJ=xe.object({id:xe.string().optional(),type:xe.string().array().nonempty(),alignment:r2.array().optional(),achievementType:uJ.optional(),creator:Y0.optional(),creditsAvailable:xe.number().optional(),criteria:dJ,description:xe.string(),endorsement:pJ.array().optional(),fieldOfStudy:xe.string().optional(),humanCode:xe.string().optional(),image:t2.optional(),"@language":xe.string().optional(),name:xe.string(),otherIdentifier:pB.array().optional(),related:mJ.array().optional(),resultDescription:vJ.array().optional(),specialization:xe.string().optional(),tag:xe.string().array().optional(),version:xe.string().optional()}).catchall(xe.any()),xJ=xe.object({type:xe.string(),hashed:xe.boolean(),identityHash:xe.string(),identityType:xe.string(),salt:xe.string().optional()}),wJ=xe.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),_J=xe.object({type:xe.string().array().nonempty(),achievedLevel:xe.string().optional(),alignment:r2.array().optional(),resultDescription:xe.string().optional(),status:wJ.optional(),value:xe.string().optional()}).catchall(xe.any()),Ak=xe.object({id:xe.string().optional(),type:xe.string().array().nonempty(),activityEndDate:xe.string().optional(),activityStartDate:xe.string().optional(),creditsEarned:xe.number().optional(),achievement:yJ.optional(),identifier:xJ.array().optional(),image:t2.optional(),licenseNumber:xe.string().optional(),narrative:xe.string().optional(),result:_J.array().optional(),role:xe.string().optional(),source:Y0.optional(),term:xe.string().optional()}).catchall(xe.any()),AJ=xe.object({id:xe.string().optional(),type:xe.string().array().nonempty(),narrative:xe.string().optional(),name:xe.string().optional(),description:xe.string().optional(),genre:xe.string().optional(),audience:xe.string().optional()}).catchall(xe.any()),EJ=X0.extend({name:xe.string().optional(),description:xe.string().optional(),image:t2.optional(),credentialSubject:Ak.or(Ak.array()),endorsement:X0.array().optional(),evidence:AJ.array().optional()}),Ole=EJ.extend({proof:Zc.or(Zc.array())}),Ek=xe.object({checks:xe.string().array(),warnings:xe.string().array(),errors:xe.string().array()}),bB=xe.enum(["Success","Failed","Error"]),h4=bB.enum,Nle=xe.object({check:xe.string(),status:bB,message:xe.string().optional(),details:xe.string().optional()}),Lle=xe.object({title:xe.string().optional(),createdAt:xe.string().optional(),issuer:Y0.optional(),issuee:Y0.optional(),credentialSubject:z4.optional()}),P0=xe.object({id:xe.string(),uri:xe.string()}).catchall(xe.any()),$4=xe.object({profileId:xe.string().min(3).max(40),displayName:xe.string().default(""),did:xe.string(),email:xe.string().optional(),image:xe.string().optional(),isServiceProfile:xe.boolean().default(!1).optional(),notificationsWebhook:xe.string().url().startsWith("https://").optional()}),Ule=xe.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),jle=xe.object({uri:xe.string(),to:xe.string(),from:xe.string(),sent:xe.string().datetime(),received:xe.string().datetime().optional()}),qle=xe.object({uri:xe.string(),name:xe.string().optional(),type:xe.string().optional(),category:xe.string().optional()}),Hle=xe.object({to:$4,from:xe.string(),received:xe.string()}),CJ=xe.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED"]),SJ=xe.object({title:xe.string().optional(),body:xe.string().optional()}),IJ=xe.object({vcUris:xe.array(xe.string()).optional(),vpUris:xe.array(xe.string()).optional()}),zle=xe.object({type:CJ,to:xe.string().or($4),from:xe.string().or($4),message:SJ.optional(),data:IJ.optional(),sent:xe.string().datetime().optional()}),kJ=xe.object({kty:xe.string(),crv:xe.string(),x:xe.string(),y:xe.string().optional(),n:xe.string().optional(),d:xe.string()}),TJ=xe.object({alg:xe.string(),iv:xe.string(),tag:xe.string(),epk:kJ.partial().optional(),kid:xe.string().optional(),apv:xe.string().optional(),apu:xe.string().optional()}),MJ=xe.object({header:TJ,encrypted_key:xe.string()}),$le=xe.object({protected:xe.string(),iv:xe.string(),ciphertext:xe.string(),tag:xe.string(),aad:xe.string().optional(),recipients:MJ.array().optional()});function Qc(t){if(t===null||t===!0||t===!1)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}s(Qc,"toInteger");c(Qc,"toInteger");function yi(t,e){if(e.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+e.length+" present")}s(yi,"requiredArgs");c(yi,"requiredArgs");function F0(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?F0=c(s(function(r){return typeof r},"_typeof3"),"_typeof"):F0=c(s(function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},"_typeof3"),"_typeof"),F0(t)}s(F0,"_typeof");c(F0,"_typeof");function So(t){yi(1,arguments);var e=Object.prototype.toString.call(t);return t instanceof Date||F0(t)==="object"&&e==="[object Date]"?new Date(t.getTime()):typeof t=="number"||e==="[object Number]"?new Date(t):((typeof t=="string"||e==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}s(So,"toDate");c(So,"toDate");function gB(t,e){yi(2,arguments);var r=So(t).getTime(),n=Qc(e);return new Date(r+n)}s(gB,"addMilliseconds");c(gB,"addMilliseconds");var RJ={};function I1(){return RJ}s(I1,"getDefaultOptions");c(I1,"getDefaultOptions");function vB(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}s(vB,"getTimezoneOffsetInMilliseconds");c(vB,"getTimezoneOffsetInMilliseconds");function O0(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O0=c(s(function(r){return typeof r},"_typeof3"),"_typeof"):O0=c(s(function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},"_typeof3"),"_typeof"),O0(t)}s(O0,"_typeof2");c(O0,"_typeof");function yB(t){return yi(1,arguments),t instanceof Date||O0(t)==="object"&&Object.prototype.toString.call(t)==="[object Date]"}s(yB,"isDate");c(yB,"isDate");function xB(t){if(yi(1,arguments),!yB(t)&&typeof t!="number")return!1;var e=So(t);return!isNaN(Number(e))}s(xB,"isValid2");c(xB,"isValid");function wB(t,e){yi(2,arguments);var r=Qc(e);return gB(t,-r)}s(wB,"subMilliseconds");c(wB,"subMilliseconds");var BJ=864e5;function _B(t){yi(1,arguments);var e=So(t),r=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var n=e.getTime(),i=r-n;return Math.floor(i/BJ)+1}s(_B,"getUTCDayOfYear");c(_B,"getUTCDayOfYear");function Z0(t){yi(1,arguments);var e=1,r=So(t),n=r.getUTCDay(),i=(n<e?7:0)+n-e;return r.setUTCDate(r.getUTCDate()-i),r.setUTCHours(0,0,0,0),r}s(Z0,"startOfUTCISOWeek");c(Z0,"startOfUTCISOWeek");function Oy(t){yi(1,arguments);var e=So(t),r=e.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(r+1,0,4),n.setUTCHours(0,0,0,0);var i=Z0(n),o=new Date(0);o.setUTCFullYear(r,0,4),o.setUTCHours(0,0,0,0);var a=Z0(o);return e.getTime()>=i.getTime()?r+1:e.getTime()>=a.getTime()?r:r-1}s(Oy,"getUTCISOWeekYear");c(Oy,"getUTCISOWeekYear");function AB(t){yi(1,arguments);var e=Oy(t),r=new Date(0);r.setUTCFullYear(e,0,4),r.setUTCHours(0,0,0,0);var n=Z0(r);return n}s(AB,"startOfUTCISOWeekYear");c(AB,"startOfUTCISOWeekYear");var DJ=6048e5;function EB(t){yi(1,arguments);var e=So(t),r=Z0(e).getTime()-AB(e).getTime();return Math.round(r/DJ)+1}s(EB,"getUTCISOWeek");c(EB,"getUTCISOWeek");function Q0(t,e){var r,n,i,o,a,f,l,d;yi(1,arguments);var p=I1(),g=Qc((r=(n=(i=(o=e?.weekStartsOn)!==null&&o!==void 0?o:e==null||(a=e.locale)===null||a===void 0||(f=a.options)===null||f===void 0?void 0:f.weekStartsOn)!==null&&i!==void 0?i:p.weekStartsOn)!==null&&n!==void 0?n:(l=p.locale)===null||l===void 0||(d=l.options)===null||d===void 0?void 0:d.weekStartsOn)!==null&&r!==void 0?r:0);if(!(g>=0&&g<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var x=So(t),A=x.getUTCDay(),C=(A<g?7:0)+A-g;return x.setUTCDate(x.getUTCDate()-C),x.setUTCHours(0,0,0,0),x}s(Q0,"startOfUTCWeek");c(Q0,"startOfUTCWeek");function Ny(t,e){var r,n,i,o,a,f,l,d;yi(1,arguments);var p=So(t),g=p.getUTCFullYear(),x=I1(),A=Qc((r=(n=(i=(o=e?.firstWeekContainsDate)!==null&&o!==void 0?o:e==null||(a=e.locale)===null||a===void 0||(f=a.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&i!==void 0?i:x.firstWeekContainsDate)!==null&&n!==void 0?n:(l=x.locale)===null||l===void 0||(d=l.options)===null||d===void 0?void 0:d.firstWeekContainsDate)!==null&&r!==void 0?r:1);if(!(A>=1&&A<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var C=new Date(0);C.setUTCFullYear(g+1,0,A),C.setUTCHours(0,0,0,0);var T=Q0(C,e),B=new Date(0);B.setUTCFullYear(g,0,A),B.setUTCHours(0,0,0,0);var O=Q0(B,e);return p.getTime()>=T.getTime()?g+1:p.getTime()>=O.getTime()?g:g-1}s(Ny,"getUTCWeekYear");c(Ny,"getUTCWeekYear");function CB(t,e){var r,n,i,o,a,f,l,d;yi(1,arguments);var p=I1(),g=Qc((r=(n=(i=(o=e?.firstWeekContainsDate)!==null&&o!==void 0?o:e==null||(a=e.locale)===null||a===void 0||(f=a.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&i!==void 0?i:p.firstWeekContainsDate)!==null&&n!==void 0?n:(l=p.locale)===null||l===void 0||(d=l.options)===null||d===void 0?void 0:d.firstWeekContainsDate)!==null&&r!==void 0?r:1),x=Ny(t,e),A=new Date(0);A.setUTCFullYear(x,0,g),A.setUTCHours(0,0,0,0);var C=Q0(A,e);return C}s(CB,"startOfUTCWeekYear");c(CB,"startOfUTCWeekYear");var PJ=6048e5;function SB(t,e){yi(1,arguments);var r=So(t),n=Q0(r,e).getTime()-CB(r,e).getTime();return Math.round(n/PJ)+1}s(SB,"getUTCWeek");c(SB,"getUTCWeek");function _r(t,e){for(var r=t<0?"-":"",n=Math.abs(t).toString();n.length<e;)n="0"+n;return r+n}s(_r,"addLeadingZeros");c(_r,"addLeadingZeros");var FJ={y:c(s(function(e,r){var n=e.getUTCFullYear(),i=n>0?n:1-n;return _r(r==="yy"?i%100:i,r.length)},"y"),"y"),M:c(s(function(e,r){var n=e.getUTCMonth();return r==="M"?String(n+1):_r(n+1,2)},"M"),"M"),d:c(s(function(e,r){return _r(e.getUTCDate(),r.length)},"d"),"d"),a:c(s(function(e,r){var n=e.getUTCHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},"a"),"a"),h:c(s(function(e,r){return _r(e.getUTCHours()%12||12,r.length)},"h"),"h"),H:c(s(function(e,r){return _r(e.getUTCHours(),r.length)},"H"),"H"),m:c(s(function(e,r){return _r(e.getUTCMinutes(),r.length)},"m"),"m"),s:c(s(function(e,r){return _r(e.getUTCSeconds(),r.length)},"s"),"s"),S:c(s(function(e,r){var n=r.length,i=e.getUTCMilliseconds(),o=Math.floor(i*Math.pow(10,n-3));return _r(o,r.length)},"S"),"S")},Uc=FJ,Mu={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},OJ={G:c(s(function(e,r,n){var i=e.getUTCFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return n.era(i,{width:"abbreviated"});case"GGGGG":return n.era(i,{width:"narrow"});case"GGGG":default:return n.era(i,{width:"wide"})}},"G"),"G"),y:c(s(function(e,r,n){if(r==="yo"){var i=e.getUTCFullYear(),o=i>0?i:1-i;return n.ordinalNumber(o,{unit:"year"})}return Uc.y(e,r)},"y2"),"y"),Y:c(s(function(e,r,n,i){var o=Ny(e,i),a=o>0?o:1-o;if(r==="YY"){var f=a%100;return _r(f,2)}return r==="Yo"?n.ordinalNumber(a,{unit:"year"}):_r(a,r.length)},"Y"),"Y"),R:c(s(function(e,r){var n=Oy(e);return _r(n,r.length)},"R"),"R"),u:c(s(function(e,r){var n=e.getUTCFullYear();return _r(n,r.length)},"u"),"u"),Q:c(s(function(e,r,n){var i=Math.ceil((e.getUTCMonth()+1)/3);switch(r){case"Q":return String(i);case"QQ":return _r(i,2);case"Qo":return n.ordinalNumber(i,{unit:"quarter"});case"QQQ":return n.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(i,{width:"wide",context:"formatting"})}},"Q"),"Q"),q:c(s(function(e,r,n){var i=Math.ceil((e.getUTCMonth()+1)/3);switch(r){case"q":return String(i);case"qq":return _r(i,2);case"qo":return n.ordinalNumber(i,{unit:"quarter"});case"qqq":return n.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(i,{width:"wide",context:"standalone"})}},"q"),"q"),M:c(s(function(e,r,n){var i=e.getUTCMonth();switch(r){case"M":case"MM":return Uc.M(e,r);case"Mo":return n.ordinalNumber(i+1,{unit:"month"});case"MMM":return n.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(i,{width:"wide",context:"formatting"})}},"M2"),"M"),L:c(s(function(e,r,n){var i=e.getUTCMonth();switch(r){case"L":return String(i+1);case"LL":return _r(i+1,2);case"Lo":return n.ordinalNumber(i+1,{unit:"month"});case"LLL":return n.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(i,{width:"wide",context:"standalone"})}},"L"),"L"),w:c(s(function(e,r,n,i){var o=SB(e,i);return r==="wo"?n.ordinalNumber(o,{unit:"week"}):_r(o,r.length)},"w"),"w"),I:c(s(function(e,r,n){var i=EB(e);return r==="Io"?n.ordinalNumber(i,{unit:"week"}):_r(i,r.length)},"I"),"I"),d:c(s(function(e,r,n){return r==="do"?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):Uc.d(e,r)},"d2"),"d"),D:c(s(function(e,r,n){var i=_B(e);return r==="Do"?n.ordinalNumber(i,{unit:"dayOfYear"}):_r(i,r.length)},"D"),"D"),E:c(s(function(e,r,n){var i=e.getUTCDay();switch(r){case"E":case"EE":case"EEE":return n.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(i,{width:"short",context:"formatting"});case"EEEE":default:return n.day(i,{width:"wide",context:"formatting"})}},"E"),"E"),e:c(s(function(e,r,n,i){var o=e.getUTCDay(),a=(o-i.weekStartsOn+8)%7||7;switch(r){case"e":return String(a);case"ee":return _r(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});case"eeee":default:return n.day(o,{width:"wide",context:"formatting"})}},"e"),"e"),c:c(s(function(e,r,n,i){var o=e.getUTCDay(),a=(o-i.weekStartsOn+8)%7||7;switch(r){case"c":return String(a);case"cc":return _r(a,r.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});case"cccc":default:return n.day(o,{width:"wide",context:"standalone"})}},"c"),"c"),i:c(s(function(e,r,n){var i=e.getUTCDay(),o=i===0?7:i;switch(r){case"i":return String(o);case"ii":return _r(o,r.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(i,{width:"short",context:"formatting"});case"iiii":default:return n.day(i,{width:"wide",context:"formatting"})}},"i"),"i"),a:c(s(function(e,r,n){var i=e.getUTCHours(),o=i/12>=1?"pm":"am";switch(r){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},"a2"),"a"),b:c(s(function(e,r,n){var i=e.getUTCHours(),o;switch(i===12?o=Mu.noon:i===0?o=Mu.midnight:o=i/12>=1?"pm":"am",r){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},"b"),"b"),B:c(s(function(e,r,n){var i=e.getUTCHours(),o;switch(i>=17?o=Mu.evening:i>=12?o=Mu.afternoon:i>=4?o=Mu.morning:o=Mu.night,r){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},"B"),"B"),h:c(s(function(e,r,n){if(r==="ho"){var i=e.getUTCHours()%12;return i===0&&(i=12),n.ordinalNumber(i,{unit:"hour"})}return Uc.h(e,r)},"h2"),"h"),H:c(s(function(e,r,n){return r==="Ho"?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):Uc.H(e,r)},"H2"),"H"),K:c(s(function(e,r,n){var i=e.getUTCHours()%12;return r==="Ko"?n.ordinalNumber(i,{unit:"hour"}):_r(i,r.length)},"K"),"K"),k:c(s(function(e,r,n){var i=e.getUTCHours();return i===0&&(i=24),r==="ko"?n.ordinalNumber(i,{unit:"hour"}):_r(i,r.length)},"k"),"k"),m:c(s(function(e,r,n){return r==="mo"?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):Uc.m(e,r)},"m2"),"m"),s:c(s(function(e,r,n){return r==="so"?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):Uc.s(e,r)},"s2"),"s"),S:c(s(function(e,r){return Uc.S(e,r)},"S2"),"S"),X:c(s(function(e,r,n,i){var o=i._originalDate||e,a=o.getTimezoneOffset();if(a===0)return"Z";switch(r){case"X":return K4(a);case"XXXX":case"XX":return Hc(a);case"XXXXX":case"XXX":default:return Hc(a,":")}},"X"),"X"),x:c(s(function(e,r,n,i){var o=i._originalDate||e,a=o.getTimezoneOffset();switch(r){case"x":return K4(a);case"xxxx":case"xx":return Hc(a);case"xxxxx":case"xxx":default:return Hc(a,":")}},"x"),"x"),O:c(s(function(e,r,n,i){var o=i._originalDate||e,a=o.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+G4(a,":");case"OOOO":default:return"GMT"+Hc(a,":")}},"O"),"O"),z:c(s(function(e,r,n,i){var o=i._originalDate||e,a=o.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+G4(a,":");case"zzzz":default:return"GMT"+Hc(a,":")}},"z"),"z"),t:c(s(function(e,r,n,i){var o=i._originalDate||e,a=Math.floor(o.getTime()/1e3);return _r(a,r.length)},"t"),"t"),T:c(s(function(e,r,n,i){var o=i._originalDate||e,a=o.getTime();return _r(a,r.length)},"T"),"T")};function G4(t,e){var r=t>0?"-":"+",n=Math.abs(t),i=Math.floor(n/60),o=n%60;if(o===0)return r+String(i);var a=e||"";return r+String(i)+a+_r(o,2)}s(G4,"formatTimezoneShort");c(G4,"formatTimezoneShort");function K4(t,e){if(t%60===0){var r=t>0?"-":"+";return r+_r(Math.abs(t)/60,2)}return Hc(t,e)}s(K4,"formatTimezoneWithOptionalMinutes");c(K4,"formatTimezoneWithOptionalMinutes");function Hc(t,e){var r=e||"",n=t>0?"-":"+",i=Math.abs(t),o=_r(Math.floor(i/60),2),a=_r(i%60,2);return n+o+r+a}s(Hc,"formatTimezone");c(Hc,"formatTimezone");var NJ=OJ,Ck=c(s(function(e,r){switch(e){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},"dateLongFormatter2"),"dateLongFormatter"),IB=c(s(function(e,r){switch(e){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},"timeLongFormatter2"),"timeLongFormatter"),LJ=c(s(function(e,r){var n=e.match(/(P+)(p+)?/)||[],i=n[1],o=n[2];if(!o)return Ck(e,r);var a;switch(i){case"P":a=r.dateTime({width:"short"});break;case"PP":a=r.dateTime({width:"medium"});break;case"PPP":a=r.dateTime({width:"long"});break;case"PPPP":default:a=r.dateTime({width:"full"});break}return a.replace("{{date}}",Ck(i,r)).replace("{{time}}",IB(o,r))},"dateTimeLongFormatter2"),"dateTimeLongFormatter"),UJ={p:IB,P:LJ},jJ=UJ,qJ=["D","DD"],HJ=["YY","YYYY"];function kB(t){return qJ.indexOf(t)!==-1}s(kB,"isProtectedDayOfYearToken");c(kB,"isProtectedDayOfYearToken");function TB(t){return HJ.indexOf(t)!==-1}s(TB,"isProtectedWeekYearToken");c(TB,"isProtectedWeekYearToken");function V4(t,e,r){if(t==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(t==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(r,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}s(V4,"throwProtectedError");c(V4,"throwProtectedError");var zJ={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},$J=c(s(function(e,r,n){var i,o=zJ[e];return typeof o=="string"?i=o:r===1?i=o.one:i=o.other.replace("{{count}}",r.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+i:i+" ago":i},"formatDistance2"),"formatDistance"),GJ=$J;function Ab(t){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.width?String(e.width):t.defaultWidth,n=t.formats[r]||t.formats[t.defaultWidth];return n}}s(Ab,"buildFormatLongFn");c(Ab,"buildFormatLongFn");var KJ={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},VJ={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},WJ={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},JJ={date:Ab({formats:KJ,defaultWidth:"full"}),time:Ab({formats:VJ,defaultWidth:"full"}),dateTime:Ab({formats:WJ,defaultWidth:"full"})},YJ=JJ,XJ={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ZJ=c(s(function(e,r,n,i){return XJ[e]},"formatRelative2"),"formatRelative"),QJ=ZJ;function Pu(t){return function(e,r){var n=r!=null&&r.context?String(r.context):"standalone",i;if(n==="formatting"&&t.formattingValues){var o=t.defaultFormattingWidth||t.defaultWidth,a=r!=null&&r.width?String(r.width):o;i=t.formattingValues[a]||t.formattingValues[o]}else{var f=t.defaultWidth,l=r!=null&&r.width?String(r.width):t.defaultWidth;i=t.values[l]||t.values[f]}var d=t.argumentCallback?t.argumentCallback(e):e;return i[d]}}s(Pu,"buildLocalizeFn");c(Pu,"buildLocalizeFn");var eY={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},tY={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},rY={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},nY={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},iY={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},sY={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},oY=c(s(function(e,r){var n=Number(e),i=n%100;if(i>20||i<10)switch(i%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},"ordinalNumber2"),"ordinalNumber"),aY={ordinalNumber:oY,era:Pu({values:eY,defaultWidth:"wide"}),quarter:Pu({values:tY,defaultWidth:"wide",argumentCallback:c(s(function(e){return e-1},"argumentCallback"),"argumentCallback")}),month:Pu({values:rY,defaultWidth:"wide"}),day:Pu({values:nY,defaultWidth:"wide"}),dayPeriod:Pu({values:iY,defaultWidth:"wide",formattingValues:sY,defaultFormattingWidth:"wide"})},cY=aY;function Fu(t){return function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.width,i=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],o=e.match(i);if(!o)return null;var a=o[0],f=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(f)?RB(f,function(g){return g.test(a)}):MB(f,function(g){return g.test(a)}),d;d=t.valueCallback?t.valueCallback(l):l,d=r.valueCallback?r.valueCallback(d):d;var p=e.slice(a.length);return{value:d,rest:p}}}s(Fu,"buildMatchFn");c(Fu,"buildMatchFn");function MB(t,e){for(var r in t)if(t.hasOwnProperty(r)&&e(t[r]))return r}s(MB,"findKey");c(MB,"findKey");function RB(t,e){for(var r=0;r<t.length;r++)if(e(t[r]))return r}s(RB,"findIndex");c(RB,"findIndex");function BB(t){return function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.match(t.matchPattern);if(!n)return null;var i=n[0],o=e.match(t.parsePattern);if(!o)return null;var a=t.valueCallback?t.valueCallback(o[0]):o[0];a=r.valueCallback?r.valueCallback(a):a;var f=e.slice(i.length);return{value:a,rest:f}}}s(BB,"buildMatchPatternFn");c(BB,"buildMatchPatternFn");var fY=/^(\d+)(th|st|nd|rd)?/i,lY=/\d+/i,uY={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},dY={any:[/^b/i,/^(a|c)/i]},hY={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},pY={any:[/1/i,/2/i,/3/i,/4/i]},mY={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},bY={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},gY={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},vY={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},yY={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},xY={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},wY={ordinalNumber:BB({matchPattern:fY,parsePattern:lY,valueCallback:c(s(function(e){return parseInt(e,10)},"valueCallback"),"valueCallback")}),era:Fu({matchPatterns:uY,defaultMatchWidth:"wide",parsePatterns:dY,defaultParseWidth:"any"}),quarter:Fu({matchPatterns:hY,defaultMatchWidth:"wide",parsePatterns:pY,defaultParseWidth:"any",valueCallback:c(s(function(e){return e+1},"valueCallback2"),"valueCallback")}),month:Fu({matchPatterns:mY,defaultMatchWidth:"wide",parsePatterns:bY,defaultParseWidth:"any"}),day:Fu({matchPatterns:gY,defaultMatchWidth:"wide",parsePatterns:vY,defaultParseWidth:"any"}),dayPeriod:Fu({matchPatterns:yY,defaultMatchWidth:"any",parsePatterns:xY,defaultParseWidth:"any"})},_Y=wY,AY={code:"en-US",formatDistance:GJ,formatLong:YJ,formatRelative:QJ,localize:cY,match:_Y,options:{weekStartsOn:0,firstWeekContainsDate:1}},EY=AY,CY=EY,SY=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,IY=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,kY=/^'([^]*?)'?$/,TY=/''/g,MY=/[a-zA-Z]/;function Ly(t,e,r){var n,i,o,a,f,l,d,p,g,x,A,C,T,B,O,H,U,q;yi(2,arguments);var K=String(e),W=I1(),N=(n=(i=r?.locale)!==null&&i!==void 0?i:W.locale)!==null&&n!==void 0?n:CY,G=Qc((o=(a=(f=(l=r?.firstWeekContainsDate)!==null&&l!==void 0?l:r==null||(d=r.locale)===null||d===void 0||(p=d.options)===null||p===void 0?void 0:p.firstWeekContainsDate)!==null&&f!==void 0?f:W.firstWeekContainsDate)!==null&&a!==void 0?a:(g=W.locale)===null||g===void 0||(x=g.options)===null||x===void 0?void 0:x.firstWeekContainsDate)!==null&&o!==void 0?o:1);if(!(G>=1&&G<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var ce=Qc((A=(C=(T=(B=r?.weekStartsOn)!==null&&B!==void 0?B:r==null||(O=r.locale)===null||O===void 0||(H=O.options)===null||H===void 0?void 0:H.weekStartsOn)!==null&&T!==void 0?T:W.weekStartsOn)!==null&&C!==void 0?C:(U=W.locale)===null||U===void 0||(q=U.options)===null||q===void 0?void 0:q.weekStartsOn)!==null&&A!==void 0?A:0);if(!(ce>=0&&ce<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!N.localize)throw new RangeError("locale must contain localize property");if(!N.formatLong)throw new RangeError("locale must contain formatLong property");var re=So(t);if(!xB(re))throw new RangeError("Invalid time value");var ae=vB(re),J=wB(re,ae),S={firstWeekContainsDate:G,weekStartsOn:ce,locale:N,_originalDate:re},m=K.match(IY).map(function(b){var h=b[0];if(h==="p"||h==="P"){var v=jJ[h];return v(b,N.formatLong)}return b}).join("").match(SY).map(function(b){if(b==="''")return"'";var h=b[0];if(h==="'")return DB(b);var v=NJ[h];if(v)return!(r!=null&&r.useAdditionalWeekYearTokens)&&TB(b)&&V4(b,e,String(t)),!(r!=null&&r.useAdditionalDayOfYearTokens)&&kB(b)&&V4(b,e,String(t)),v(J,b,N.localize,S);if(h.match(MY))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return b}).join("");return m}s(Ly,"format");c(Ly,"format");function DB(t){var e=t.match(kY);return e?e[1].replace(TY,"'"):t}s(DB,"cleanEscapedString");c(DB,"cleanEscapedString");var RY=c((t,e)=>t.split(" error")[0]||t,"transformErrorCheck"),BY=c((t,e)=>t.startsWith("expiration")?e.expirationDate?`Invalid \u2022 Expired ${Ly(new Date(e.expirationDate),"dd MMM yyyy").toUpperCase()}`:"Invalid \u2022 Expired":t,"transformErrorMessage"),DY=c((t,e)=>({proof:"Valid",expiration:e.expirationDate?`Valid \u2022 Expires ${Ly(new Date(e.expirationDate),"dd MMM yyyy").toUpperCase()}`:"Valid \u2022 Does Not Expire"})[t]||t,"transformCheckMessage"),PY=c(t=>async(e,r,n,i=!1)=>{let o=await t.invoke.verifyCredential(r,n);if(!i)return o;let a=[];return o.errors.forEach(f=>{a.push({status:h4.Failed,check:RY(f,r),details:BY(f,r)})}),o.warnings.forEach(f=>{a.push({status:h4.Error,check:"hmm",message:f})}),o.checks.forEach(f=>{a.push({status:h4.Success,check:f,message:DY(f,r)})}),a},"verifyCredential"),Uy=c(t=>({name:"LearnCard",displayName:"LearnCard",description:"Adds opinionated logic to a LearnCard",methods:{verifyCredential:PY(t)}}),"getLearnCardPlugin"),FY=c(async({didkit:t,debug:e}={})=>{let r=await(await A1({debug:e})).addPlugin(await TR(t)),o=await(await(await r.addPlugin(Ey(r))).addPlugin(Cy())).addPlugin(await Dy());return o.addPlugin(Uy(o))},"emptyLearnCard");function jy(t){var e=0,r=t.length,n=[];if(r%2)throw new Error("invalid hex:"+t);for(;e<r;e+=2)n.push(parseInt(t.substr(e,2),16));return new Uint8Array(n)}s(jy,"toUint8Array");c(jy,"toUint8Array");var OY=Object.defineProperty,NY=c((t,e)=>OY(t,"name",{value:e,configurable:!0}),"__name"),LY=NY(t=>/^[0-9a-f]+$/i.test(t),"isHex"),UY=["key","tz","pkh:tz","pkh:tezos","pkh:sol","pkh:solana"],jY=["key","tz","ethr","pkh:tz","pkh:tezos","pkh:eth","pkh:celo","pkh:poly","pkh:btc","pkh:doge","pkh:eip155","pkh:bip122"],qY=c(t=>{if(UY.includes(t))return"ed25519";if(jY.includes(t)||t.startsWith("pkh:eip155:")||t.startsWith("pkh:bip122:"))return"secp256k1";throw new Error("Unspported Did Method")},"getAlgorithmForDidMethod"),HY=c(async(t,e,r)=>{if(e.length===0)throw new Error("Please don't use an empty string for a key!");if(!LY(e))throw new Error("Key must be a hexadecimal string!");if(e.length>64)throw new Error("Key must be less than 64 characters");e.length<64&&(console.warn("Warning: A LearnCard has been initialized with a seed that is less than 32 bytes, and will be padded with zeroes"),console.warn("Please instantiate LearnCards using 32 bytes that have been randomly generated in a cryptographically secure fashion!"),console.warn("See https://app.gitbook.com/o/6uDv1QDlxaaZC7i8EaGb/s/FXvEJ9j3Vf3FW5Nc557n/learn-card-packages/learncard-core/instantiation#key-generation for details"));let n=e.padStart(64,"0"),i=jy(n),o={},a={ed25519:t.invoke.generateEd25519KeyFromBytes(i),secp256k1:t.invoke.generateSecp256k1KeyFromBytes(i)},f=c((d=r)=>{if(!o[d]){let p=qY(d);o[d]=t.invoke.keyToDid(d,a[p])}return o[d]},"did"),l=c((d="ed25519")=>{if(!a[d])throw new Error("Unsupported algorithm");return a[d]},"keypair");return{name:"DID Key",displayName:"DID Key",description:"Generates dids and JWKs using 32 Secure Random Bytes of Entropy",id:{did:(d,p)=>f(p),keypair:(d,p)=>l(p)},methods:{getSubjectDid:(d,p=r)=>f(p),getSubjectKeypair:(d,p="ed25519")=>l(p),getKey:()=>n}}},"getDidKeyPlugin"),zY=c(t=>async(e,r,n={})=>{let i=e.id.keypair();if(!i)throw new Error("Cannot issue credential: Could not get subject keypair");let a={verificationMethod:await e.invoke.didToVerificationMethod(typeof r.issuer=="string"?r.issuer:r.issuer.id),proofPurpose:"assertionMethod",type:"Ed25519Signature2020",...n};return t.invoke.issueCredential(r,a,i)},"issueCredential"),$Y=c(t=>async(e,r,n={})=>t.invoke.verifyCredential(r,n),"verifyCredential"),GY=c(t=>async(e,r,n={})=>{let i=e.id.keypair();if(!i)throw new Error("Cannot issue credential: Could not get subject keypair");let a={verificationMethod:await e.invoke.didToVerificationMethod(e.id.did()),...n.proofFormat==="jwt"?{}:{proofPurpose:"assertionMethod"},...n.proofFormat==="jwt"?{}:{type:"Ed25519Signature2020"},...n};return t.invoke.issuePresentation(r,a,i)},"issuePresentation"),KY=c(t=>async(e,r,n={})=>t.invoke.verifyPresentation(r,n),"verifyPresentation"),VY=c(t=>({name:"VC",displayName:"VC",description:"Handles the infrastructure needed to issue and verify credentials and presentations",methods:{issueCredential:zY(t),verifyCredential:$Y(t),issuePresentation:GY(t),verifyPresentation:KY(t),getTestVc:(e,r="did:example:d23dd687a7dc6787646f2eb98d0")=>{let n=e.id.did();return{"@context":["https://www.w3.org/2018/credentials/v1"],id:"http://example.org/credentials/3731",type:["VerifiableCredential"],issuer:n,issuanceDate:"2020-08-19T21:41:50Z",credentialSubject:{id:r}}},getTestVp:async(e,r)=>{let n=r||await e.invoke.issueCredential(e.invoke.getTestVc()),i=e.id.did();return{"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],holder:i,verifiableCredential:n}},getDidAuthVp:async(e,r={})=>{let n=e.id.did(),i={"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],holder:n};return e.invoke.issuePresentation(i,{proofPurpose:"authentication",...r})}}}),"getVCPlugin"),WY={name:"VC Resolution",displayName:"VC Resolution",description:"[Deprecated] Allows for a fallback mechanism of resolving credentials",methods:{resolveCredential:async(t,e)=>{throw new Error(`No Credential Resolution Plugins found that can resolve ${e}`)}}},JY=dr(cK());function PB(t,e){try{var r=t()}catch(n){return e(n)}return r&&r.then?r.then(void 0,e):r}s(PB,"_catch");c(PB,"_catch");function FB(){let t=new Map;return function(e,r){try{let n=s(function(a){if(i)return a;let f=t.get(e.didUrl);return f!==void 0?f:Promise.resolve(r()).then(function(l){var d;return((d=l.didResolutionMetadata)==null?void 0:d.error)!=="notFound"&&t.set(e.didUrl,l),l})},"_temp2");c(n,"_temp2");let i,o=function(){if(e.params&&e.params["no-cache"]==="true")return Promise.resolve(r()).then(function(a){return i=1,a})}();return Promise.resolve(o&&o.then?o.then(n):n(o))}catch(n){return Promise.reject(n)}}}s(FB,"inMemoryCache");c(FB,"inMemoryCache");function OB(t,e){return e()}s(OB,"noCache");c(OB,"noCache");var YY="(?:%[0-9a-fA-F]{2})",Sk=`(?:[a-zA-Z0-9._-]|${YY})`,XY="([a-z0-9]+)",ZY=`((?:${Sk}*:)*(${Sk}+))`,Ik="[a-zA-Z0-9_.:%-]",QY=`;${Ik}+=${Ik}*`,eX=`((${QY})*)`,tX="(/[^#?]*)?",rX="([?][^#]*)?",nX="(#.*)?",iX=new RegExp(`^did:${XY}:${ZY}${eX}${tX}${rX}${nX}$`);function qy(t){if(t===""||!t)return null;let e=t.match(iX);if(e){let r={did:`did:${e[1]}:${e[2]}`,method:e[1],id:e[2],didUrl:t};if(e[4]){let n=e[4].slice(1).split(";");r.params={};for(let i of n){let o=i.split("=");r.params[o[0]]=o[1]}}return e[6]&&(r.path=e[6]),e[7]&&(r.query=e[7].slice(1)),e[8]&&(r.fragment=e[8].slice(1)),r}return null}s(qy,"parse");c(qy,"parse");var Qb={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function NB(t){return function(e,r,n){try{return Promise.resolve(PB(function(){return Promise.resolve(t(e,r,n)).then(function(i){return{...Qb,didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:i}})},function(i){return{...Qb,didResolutionMetadata:{error:"notFound",message:i.toString()}}}))}catch(i){return Promise.reject(i)}}}s(NB,"wrapLegacyResolver");c(NB,"wrapLegacyResolver");var LB=s(class{constructor(t={},e={}){this.registry=void 0,this.cache=void 0,this.registry=t,this.cache=e.cache===!0?FB():e.cache||OB,e.legacyResolvers&&Object.keys(e.legacyResolvers).map(r=>{this.registry[r]||(this.registry[r]=NB(e.legacyResolvers[r]))})}resolve(t,e={}){try{let r=this,n=qy(t);if(n===null)return Promise.resolve({...Qb,didResolutionMetadata:{error:"invalidDid"}});let i=r.registry[n.method];return i?Promise.resolve(r.cache(n,()=>i(n.did,n,r,e))):Promise.resolve({...Qb,didResolutionMetadata:{error:"unsupportedDidMethod"}})}catch(r){return Promise.reject(r)}}},"Resolver");c(LB,"Resolver");JT();gy();y1();uy();$g();zM();var UB=dr(EK()),sX=dr(VM()),jB=dr(zK()),qB=dr(yy()),oX=dr(WK()),W4=dr(JK()),HB=dr(QK()),zB=dr(hd());function vs(t){return zr(t,"base64url")}s(vs,"bytesToBase64url");c(vs,"bytesToBase64url");function Pi(t){let e=t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");return jr(e,"base64url")}s(Pi,"base64ToBytes");c(Pi,"base64ToBytes");function n2(t){return jr(t,"base58btc")}s(n2,"base58ToBytes");c(n2,"base58ToBytes");function eg(t){let e=t.startsWith("0x")?t.substring(2):t;return jr(e.toLowerCase(),"base16")}s(eg,"hexToBytes");c(eg,"hexToBytes");function tg(t){return vs(jr(t))}s(tg,"encodeBase64url");c(tg,"encodeBase64url");function Hy(t){return zr(Pi(t))}s(Hy,"decodeBase64url");c(Hy,"decodeBase64url");function ef(t){return zr(t,"base16")}s(ef,"bytesToHex");c(ef,"bytesToHex");function zy(t){return jr(t)}s(zy,"stringToBytes");c(zy,"stringToBytes");function $B({r:t,s:e,recoveryParam:r},n){let i=new Uint8Array(n?65:64);if(i.set(jr(t,"base16"),0),i.set(jr(e,"base16"),32),n){if(typeof r>"u")throw new Error("Signer did not return a recoveryParam");i[64]=r}return vs(i)}s($B,"toJose");c($B,"toJose");function GB(t){let e=Pi(t);if(e.length<64||e.length>65)throw new TypeError(`Wrong size for signature. Expected 64 or 65 bytes, but got ${e.length}`);let r=ef(e.slice(0,32)),n=ef(e.slice(32,64)),i=e.length===65?e[64]:void 0;return{r,s:n,recoveryParam:i}}s(GB,"fromJose");c(GB,"fromJose");function $y(t,e){return Wc([Pi(t),Pi(e)])}s($y,"toSealed");c($y,"toSealed");var aX=/^(0x)?([a-fA-F0-9]{64}|[a-fA-F0-9]{128})$/,cX=/^([1-9A-HJ-NP-Za-km-z]{44}|[1-9A-HJ-NP-Za-km-z]{88})$/,fX=/^([0-9a-zA-Z=\-_+/]{43}|[0-9a-zA-Z=\-_+/]{86})(={0,2})$/;function KB(t){if(typeof t=="string"){if(aX.test(t))return eg(t);if(cX.test(t))return n2(t);if(fX.test(t))return Pi(t);throw TypeError("bad_key: Invalid private key format")}else{if(t instanceof Uint8Array)return t;throw TypeError("bad_key: Invalid private key format")}}s(KB,"parseKey");c(KB,"parseKey");function Gy(t){let e=typeof t=="string"?jr(t):t;return(0,UB.hash)(e)}s(Gy,"sha2562");c(Gy,"sha256");function VB(t){return new Uint8Array(sX.keccak_256.arrayBuffer(t))}s(VB,"keccak");c(VB,"keccak");function WB(t){let e=jr(t.slice(2),"base16");return`0x${zr(VB(e).slice(-20),"base16")}`}s(WB,"toEthereumAddress");c(WB,"toEthereumAddress");function rg(t,e=new Uint8Array(4)){let r=jr(t.toString(),"base10");return e.set(r,4-r.length),e}s(rg,"writeUint32BE");c(rg,"writeUint32BE");var p4=c(t=>Wc([rg(t.length),t]),"lengthAndInput");function Ky(t,e,r,n,i){if(e!==256)throw new Error(`Unsupported key length: ${e}`);let o=Wc([p4(jr(r)),p4(typeof n>"u"?new Uint8Array(0):n),p4(typeof i>"u"?new Uint8Array(0):i),rg(e)]),a=1;return(0,UB.hash)(Wc([rg(a),t,o]))}s(Ky,"concatKDF");c(Ky,"concatKDF");var Gle=new jB.ec("secp256k1");function JB(t){let e=KB(t);if(e.length!==64)throw new Error(`bad_key: Invalid private key format. Expecting 64 bytes, but got ${e.length}`);return function(r){try{let n=typeof r=="string"?zy(r):r,i=(0,qB.sign)(e,n);return Promise.resolve(vs(i))}catch(n){return Promise.reject(n)}}}s(JB,"EdDSASigner");c(JB,"EdDSASigner");function Vy(t){return typeof t=="object"&&"r"in t&&"s"in t}s(Vy,"instanceOfEcdsaSignature");c(Vy,"instanceOfEcdsaSignature");function J4(t){return c(s(function(r,n){try{return Promise.resolve(n(r)).then(function(i){if(Vy(i))return $B(i,t);if(t&&typeof GB(i).recoveryParam>"u")throw new Error("not_supported: ES256K-R not supported when signer doesn't provide a recovery param");return i})}catch(i){return Promise.reject(i)}},"sign5"),"sign")}s(J4,"ES256KSignerAlg");c(J4,"ES256KSignerAlg");function Y4(){return c(s(function(e,r){try{return Promise.resolve(r(e)).then(function(n){if(Vy(n))throw new Error("invalid_config: expected a signer function that returns a string instead of signature object");return n})}catch(n){return Promise.reject(n)}},"sign5"),"sign")}s(Y4,"Ed25519SignerAlg");c(Y4,"Ed25519SignerAlg");var lX={ES256K:J4(),"ES256K-R":J4(!0),Ed25519:Y4(),EdDSA:Y4()};function YB(t){let e=lX[t];if(!e)throw new Error(`not_supported: Unsupported algorithm ${t}`);return e}s(YB,"SignerAlg");c(YB,"SignerAlg");var Wy=new jB.ec("secp256k1");function e1(t,e=!1){let r=Pi(t);if(r.length!==(e?65:64))throw new Error("wrong signature length");let n=ef(r.slice(0,32)),i=ef(r.slice(32,64)),o={r:n,s:i};return e&&(o.recoveryParam=r[64]),o}s(e1,"toSignatureObject");c(e1,"toSignatureObject");function i2(t){if(t.publicKeyBase58)return n2(t.publicKeyBase58);if(t.publicKeyBase64)return Pi(t.publicKeyBase64);if(t.publicKeyHex)return eg(t.publicKeyHex);if(t.publicKeyJwk&&t.publicKeyJwk.crv==="secp256k1"&&t.publicKeyJwk.x&&t.publicKeyJwk.y)return eg(Wy.keyFromPublic({x:ef(Pi(t.publicKeyJwk.x)),y:ef(Pi(t.publicKeyJwk.y))}).getPublic("hex"));if(t.publicKeyMultibase){let{base16:e,base58btc:r,base64:n,base64url:i}=$b;return e.decoder.or(r.decoder.or(n.decoder.or(i.decoder))).decode(t.publicKeyMultibase)}return new Uint8Array}s(i2,"extractPublicKeyBytes");c(i2,"extractPublicKeyBytes");function XB(t,e,r){let n=Gy(t),i=e1(e),o=r.filter(({ethereumAddress:l,blockchainAccountId:d})=>typeof l>"u"&&typeof d>"u"),a=r.filter(({ethereumAddress:l,blockchainAccountId:d})=>typeof l<"u"||typeof d!==void 0),f=o.find(l=>{try{let d=i2(l);return Wy.keyFromPublic(d).verify(n,i)}catch{return!1}});if(!f&&a.length>0&&(f=Jy(t,e,a)),!f)throw new Error("invalid_signature: Signature invalid for JWT");return f}s(XB,"verifyES256K");c(XB,"verifyES256K");function Jy(t,e,r){let n;if(e.length>86)n=[e1(e,!0)];else{let a=e1(e,!1);n=[{...a,recoveryParam:0},{...a,recoveryParam:1}]}let i=c(a=>{let f=Gy(t),l=Wy.recoverPubKey(f,a,a.recoveryParam),d=l.encode("hex"),p=l.encode("hex",!0),g=WB(d);return r.find(A=>{var C,T,B;let O=ef(i2(A));return O===d||O===p||((C=A.ethereumAddress)==null?void 0:C.toLowerCase())===g||((T=A.blockchainAccountId)==null||(B=T.split("@eip155"))==null?void 0:B[0].toLowerCase())===g})},"checkSignatureAgainstSigner"),o=n.map(i).filter(a=>typeof a<"u");if(o.length===0)throw new Error("invalid_signature: Signature invalid for JWT");return o[0]}s(Jy,"verifyRecoverableES256K");c(Jy,"verifyRecoverableES256K");function X4(t,e,r){let n=zy(t),i=Pi(e),o=r.find(a=>(0,qB.verify)(i2(a),n,i));if(!o)throw new Error("invalid_signature: Signature invalid for JWT");return o}s(X4,"verifyEd25519");c(X4,"verifyEd25519");var uX={ES256K:XB,"ES256K-R":Jy,Ed25519:X4,EdDSA:X4};function Yy(t){let e=uX[t];if(!e)throw new Error(`not_supported: Unsupported algorithm ${t}`);return e}s(Yy,"VerifierAlgorithm");c(Yy,"VerifierAlgorithm");Yy.toSignatureObject=e1;var dX=c(function(t,e,r={},n={}){try{r.alg||(r.alg=hX);let i=typeof t=="string"?t:Z4(t,n.canonicalize),o=[Z4(r,n.canonicalize),i].join("."),a=YB(r.alg);return Promise.resolve(a(o,e)).then(function(f){return[o,f].join(".")})}catch(i){return Promise.reject(i)}},"createJWS"),hX="ES256K";function Z4(t,e=!1){return tg(e?(0,oX.default)(t):JSON.stringify(t))}s(Z4,"encodeSection");c(Z4,"encodeSection");function ZB(t){let e=t.match(/^([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)$/);if(e)return{header:JSON.parse(Hy(e[1])),payload:e[2],signature:e[3],data:`${e[1]}.${e[2]}`};throw new Error("invalid_argument: Incorrect format JWS")}s(ZB,"decodeJWS");c(ZB,"decodeJWS");function QB({header:t,data:e,signature:r},n){return Array.isArray(n)||(n=[n]),Yy(t.alg)(e,r,n)}s(QB,"verifyJWSDecoded");c(QB,"verifyJWSDecoded");function eD(t,e){let r=ZB(t);return QB(r,e)}s(eD,"verifyJWS");c(eD,"verifyJWS");function tD(t,e,r){for(var n;;){var i=t();if(rc(i)&&(i=i.v),!i)return o;if(i.then){n=0;break}var o=r();if(o&&o.then)if(rc(o))o=o.s;else{n=1;break}if(e){var a=e();if(a&&a.then&&!rc(a)){n=2;break}}}var f=new sl,l=_n.bind(null,f,2);return(n===0?i.then(p):n===1?o.then(d):a.then(g)).then(void 0,l),f;function d(x){o=x;do{if(e&&(a=e(),a&&a.then&&!rc(a))){a.then(g).then(void 0,l);return}if(i=t(),!i||rc(i)&&!i.v){_n(f,1,o);return}if(i.then){i.then(p).then(void 0,l);return}o=r(),rc(o)&&(o=o.v)}while(!o||!o.then);o.then(d).then(void 0,l)}s(d,"_resumeAfterBody"),c(d,"_resumeAfterBody");function p(x){x?(o=r(),o&&o.then?o.then(d).then(void 0,l):d(o)):_n(f,1,o)}s(p,"_resumeAfterTest"),c(p,"_resumeAfterTest");function g(){(i=t())?i.then?i.then(p).then(void 0,l):p(i):_n(f,1,o)}s(g,"_resumeAfterUpdate"),c(g,"_resumeAfterUpdate")}s(tD,"_for");c(tD,"_for");var pX=c(function(t,e){try{let r=s(function(d){if(f===null)throw new Error("failure: Failed to decrypt");return f},"_temp5");c(r,"_temp5");let n;iD(t);let i=JSON.parse(Hy(t.protected));if(i.enc!==e.enc)throw new Error(`not_supported: Decrypter does not supported: '${i.enc}'`);let o=$y(t.ciphertext,t.tag),a=new Uint8Array(Buffer.from(t.aad?`${t.protected}.${t.aad}`:t.protected)),f=null,l=function(){return i.alg==="dir"&&e.alg==="dir"?Promise.resolve(e.decrypt(o,Pi(t.iv),a)).then(function(d){f=d}):function(){if(!t.recipients||t.recipients.length===0)throw new Error("bad_jwe: missing recipients");{let d=0;return tD(function(){return!f&&d<t.recipients.length},function(){return d++},function(){let p=t.recipients[d];Object.assign(p.header,i);let g=function(){if(p.header.alg===e.alg)return Promise.resolve(e.decrypt(o,Pi(t.iv),a,p)).then(function(x){f=x})}();if(g&&g.then)return g.then(function(){})})}}()}();return Promise.resolve(l&&l.then?l.then(r):r(l))}catch(r){return Promise.reject(r)}},"decryptJWE"),kk=typeof Symbol<"u"?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function _n(t,e,r){if(!t.s){if(r instanceof sl)if(r.s)e&1&&(e=r.s),r=r.v;else{r.o=_n.bind(null,t,e);return}if(r&&r.then){r.then(_n.bind(null,t,e),_n.bind(null,t,2));return}t.s=e,t.v=r;let n=t.o;n&&n(t)}}s(_n,"_settle");c(_n,"_settle");var sl=function(){function t(){}return s(t,"_Pact2"),c(t,"_Pact"),t.prototype.then=function(e,r){let n=new t,i=this.s;if(i){let o=i&1?e:r;if(o){try{_n(n,1,o(this.v))}catch(a){_n(n,2,a)}return n}else return this}return this.o=function(o){try{let a=o.v;o.s&1?_n(n,1,e?e(a):a):r?_n(n,1,r(a)):_n(n,2,a)}catch(a){_n(n,2,a)}},n},t}();function rc(t){return t instanceof sl&&t.s&1}s(rc,"_isSettledPact");c(rc,"_isSettledPact");function rD(t,e,r){var n=-1,i,o;function a(f){try{for(;++n<t.length&&(!r||!r());)if(f=e(n),f&&f.then)if(rc(f))f=f.v;else{f.then(a,o||(o=_n.bind(null,i=new sl,2)));return}i?_n(i,1,f):i=f}catch(l){_n(i||(i=new sl),2,l)}}return s(a,"_cycle"),c(a,"_cycle"),a(),i}s(rD,"_forTo");c(rD,"_forTo");function nD(t,e,r){if(typeof t[kk]=="function"){let p=s(function(g){try{for(;!(i=n.next()).done&&(!r||!r());)if(g=e(i.value),g&&g.then)if(rc(g))g=g.v;else{g.then(p,a||(a=_n.bind(null,o=new sl,2)));return}o?_n(o,1,g):o=g}catch(x){_n(o||(o=new sl),2,x)}},"_cycle");c(p,"_cycle");var n=t[kk](),i,o,a;if(p(),n.return){var f=c(function(g){try{i.done||n.return()}catch{}return g},"_fixup");if(o&&o.then)return o.then(f,function(g){throw f(g)});f()}return o}if(!("length"in t))throw new TypeError("Object is not iterable");for(var l=[],d=0;d<t.length;d++)l.push(t[d]);return rD(l,function(p){return e(l[p])},r)}s(nD,"_forOf");c(nD,"_forOf");function iD(t){if(!(t.protected&&t.iv&&t.ciphertext&&t.tag))throw new Error("bad_jwe: missing properties");t.recipients&&t.recipients.map(e=>{if(!(e.header&&e.encrypted_key))throw new Error("bad_jwe: malformed recipients")})}s(iD,"validateJWE");c(iD,"validateJWE");function Q4({ciphertext:t,tag:e,iv:r,protectedHeader:n,recipient:i},o){let a={protected:n,iv:vs(r),ciphertext:vs(t),tag:vs(e)};return o&&(a.aad=vs(o)),i&&(a.recipients=[i]),a}s(Q4,"encodeJWE");c(Q4,"encodeJWE");var mX=c(function(t,e,r={},n){try{if(e[0].alg==="dir"){if(e.length>1)throw new Error('not_supported: Can only do "dir" encryption to one key.');return Promise.resolve(e[0].encrypt(t,r,n)).then(function(i){return Q4(i,n)})}else{let i=e[0].enc;if(!e.reduce((l,d)=>l&&d.enc===i,!0))throw new Error("invalid_argument: Incompatible encrypters passed");let o,a,f=nD(e,function(l){let d=function(){return o?Promise.resolve(l.encryptCek==null?void 0:l.encryptCek(o)).then(function(p){if(p){var g,x;(g=a)==null||(x=g.recipients)==null||x.push(p)}}):Promise.resolve(l.encrypt(t,r,n)).then(function(p){o=p.cek,a=Q4(p,n)})}();if(d&&d.then)return d.then(function(){})});return Promise.resolve(f&&f.then?f.then(function(){return a}):a)}}catch(i){return Promise.reject(i)}},"createJWE"),bX=c(function(t,e){try{let r=c(function(i){try{return Promise.resolve(e.resolve(i)).then(function({didResolutionMetadata:o,didDocument:a}){var f;if(o!=null&&o.error||a==null)throw new Error(`resolver_error: Could not resolve ${i}: ${o.error}, ${o.message}`);if(!a.keyAgreement)throw new Error(`no_suitable_keys: Could not find x25519 key for ${i}`);let d=((f=a.keyAgreement)==null?void 0:f.map(p=>typeof p=="string"?[...a.publicKey||[],...a.verificationMethod||[]].find(g=>g.id===p):p).filter(p=>typeof p<"u")).filter(p=>p.type==="X25519KeyAgreementKey2019"&&Boolean(p.publicKeyBase58));if(!d.length)throw new Error(`no_suitable_keys: Could not find x25519 key for ${i}`);return d.map(p=>oD(n2(p.publicKeyBase58),p.id))})}catch(o){return Promise.reject(o)}},"encryptersForDID"),n=t.map(i=>r(i));return Promise.resolve(Promise.all(n)).then(function(i){return[].concat(...i)})}catch(r){return Promise.reject(r)}},"resolveX25519Encrypters");function Xy(t){let e=new HB.XChaCha20Poly1305(t);return(r,n)=>{let i=(0,zB.randomBytes)(e.nonceLength),o=e.seal(i,r,n);return{ciphertext:o.subarray(0,o.length-e.tagLength),tag:o.subarray(o.length-e.tagLength),iv:i}}}s(Xy,"xc20pEncrypter");c(Xy,"xc20pEncrypter");function sD(t){let e=c(function(o,a={},f){try{let l=tg(JSON.stringify(Object.assign({alg:i},a,{enc:n}))),d=new Uint8Array(Buffer.from(f?`${l}.${vs(f)}`:l));return Promise.resolve({...r(o,d),protectedHeader:l})}catch(l){return Promise.reject(l)}},"encrypt"),r=Xy(t),n="XC20P",i="dir";return{alg:i,enc:n,encrypt:e}}s(sD,"xc20pDirEncrypter");c(sD,"xc20pDirEncrypter");function e5(t){let e=c(function(n,i,o){try{return Promise.resolve(r.open(i,n,o))}catch(a){return Promise.reject(a)}},"decrypt"),r=new HB.XChaCha20Poly1305(t);return{alg:"dir",enc:"XC20P",decrypt:e}}s(e5,"xc20pDirDecrypter");c(e5,"xc20pDirDecrypter");function oD(t,e){let r=c(function(f,l={},d){try{Object.assign(l,{alg:void 0});let p=(0,zB.randomBytes)(32);return Promise.resolve(sD(p).encrypt(f,l,d)).then(function(g){return Promise.resolve(n(p)).then(function(x){return{...g,recipient:x,cek:p}})})}catch(p){return Promise.reject(p)}},"encrypt"),n=c(function(f){try{let l=(0,W4.generateKeyPair)(),d=(0,W4.sharedKey)(l.secretKey,t),p=Ky(d,o,i),g=Xy(p)(f),x={encrypted_key:vs(g.ciphertext),header:{alg:i,iv:vs(g.iv),tag:vs(g.tag),epk:{kty:"OKP",crv:a,x:vs(l.publicKey)}}};return e&&(x.header.kid=e),Promise.resolve(x)}catch(l){return Promise.reject(l)}},"encryptCek"),i="ECDH-ES+XC20PKW",o=256,a="X25519";return{alg:i,enc:"XC20P",encrypt:r,encryptCek:n}}s(oD,"x25519Encrypter");c(oD,"x25519Encrypter");function aD(t){if(!(t&&t.epk&&t.iv&&t.tag))throw new Error("bad_jwe: malformed header")}s(aD,"validateHeader");c(aD,"validateHeader");function cD(t){let e=c(function(o,a,f,l){try{let g=s(function(){let T=Ky(A,n,r),B=$y(l.encrypted_key,l.header.tag);return Promise.resolve(e5(T).decrypt(B,Pi(l.header.iv))).then(function(O){return O===null?null:e5(O).decrypt(o,a,f)})},"_temp4");c(g,"_temp4");var d,p;if(aD((d=l)==null?void 0:d.header),l=l,((p=l.header.epk)==null?void 0:p.crv)!==i||typeof l.header.epk.x>"u")return Promise.resolve(null);let x=Pi(l.header.epk.x),A,C=function(){if(t instanceof Uint8Array)A=(0,W4.sharedKey)(t,x);else return Promise.resolve(t(x)).then(function(T){A=T})}();return Promise.resolve(C&&C.then?C.then(g):g(C))}catch(g){return Promise.reject(g)}},"decrypt"),r="ECDH-ES+XC20PKW",n=256,i="X25519";return{alg:r,enc:"XC20P",decrypt:e}}s(cD,"x25519Decrypter");c(cD,"x25519Decrypter");HM();var cb=c(({enumerable:t=!0,configurable:e=!1}={})=>({enumerable:t,configurable:e,writable:!1}),"readonly"),t5=c(function*(t,e){if(t!=null&&!(t instanceof Uint8Array))for(let[r,n]of Object.entries(t)){let i=[...e,r];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let[o,a]of n.entries()){let f=[...i,o],l=tr.asCID(a);l?yield[f.join("/"),l]:typeof a=="object"&&(yield*t5(a,f))}else{let o=tr.asCID(n);o?yield[i.join("/"),o]:yield*t5(n,i)}}},"links"),r5=c(function*(t,e){if(t!=null)for(let[r,n]of Object.entries(t)){let i=[...e,r];if(yield i.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!tr.asCID(n))if(Array.isArray(n))for(let[o,a]of n.entries()){let f=[...i,o];yield f.join("/"),typeof a=="object"&&!tr.asCID(a)&&(yield*r5(a,f))}else yield*r5(n,i)}},"tree"),gX=c((t,e)=>{let r=t;for(let[n,i]of e.entries()){if(r=r[i],r==null)throw new Error(`Object has no property at ${e.slice(0,n+1).map(a=>`[${JSON.stringify(a)}]`).join("")}`);let o=tr.asCID(r);if(o)return{value:o,remaining:e.slice(n+1).join("/")}}return{value:r}},"get"),Zy=s(class{constructor({cid:t,bytes:e,value:r}){if(!t||!e||typeof r>"u")throw new Error("Missing required argument");this.cid=t,this.bytes=e,this.value=r,this.asBlock=this,Object.defineProperties(this,{cid:cb(),bytes:cb(),value:cb(),asBlock:cb()})}links(){return t5(this.value,[])}tree(){return r5(this.value,[])}get(t="/"){return gX(this.value,t.split("/").filter(Boolean))}},"Block");c(Zy,"Block");var s2=c(async({value:t,codec:e,hasher:r})=>{if(typeof t>"u")throw new Error('Missing required argument "value"');if(!e||!r)throw new Error("Missing required argument: codec or hasher");let n=e.encode(t),i=await r.digest(n),o=tr.create(1,e.code,i);return new Zy({value:t,bytes:n,cid:o})},"encode"),vX=c(async({bytes:t,codec:e,hasher:r})=>{if(!t)throw new Error('Missing required argument "bytes"');if(!e||!r)throw new Error("Missing required argument: codec or hasher");let n=e.decode(t),i=await r.digest(t),o=tr.create(1,e.code,i);return new Zy({value:n,bytes:t,cid:o})},"decode");ba();Gg();qM();hy();var bd={};Or(bd,{code:()=>ig,decode:()=>xP,encode:()=>g2,name:()=>OX});var yX=["string","number","bigint","symbol"],xX=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function fD(t){if(t===null)return"null";if(t===void 0)return"undefined";if(t===!0||t===!1)return"boolean";let e=typeof t;if(yX.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(t))return"Array";if(lD(t))return"Buffer";let r=uD(t);return r||"Object"}s(fD,"is");c(fD,"is");function lD(t){return t&&t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer.call(null,t)}s(lD,"isBuffer");c(lD,"isBuffer");function uD(t){let e=Object.prototype.toString.call(t).slice(8,-1);if(xX.includes(e))return e}s(uD,"getObjectType");c(uD,"getObjectType");var Le=s(class{constructor(t,e,r){this.major=t,this.majorEncoded=t<<5,this.name=e,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}},"Type");c(Le,"Type");Le.uint=new Le(0,"uint",!0);Le.negint=new Le(1,"negint",!0);Le.bytes=new Le(2,"bytes",!0);Le.string=new Le(3,"string",!0);Le.array=new Le(4,"array",!1);Le.map=new Le(5,"map",!1);Le.tag=new Le(6,"tag",!1);Le.float=new Le(7,"float",!0);Le.false=new Le(7,"false",!0);Le.true=new Le(7,"true",!0);Le.null=new Le(7,"null",!0);Le.undefined=new Le(7,"undefined",!0);Le.break=new Le(7,"break",!0);var nt=s(class{constructor(t,e,r){this.type=t,this.value=e,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},"Token");c(nt,"Token");var gd=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",wX=new TextDecoder,_X=new TextEncoder;function t1(t){return gd&&globalThis.Buffer.isBuffer(t)}s(t1,"isBuffer2");c(t1,"isBuffer");function Qy(t){return t instanceof Uint8Array?t1(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t:Uint8Array.from(t)}s(Qy,"asU8A");c(Qy,"asU8A");var AX=gd?(t,e,r)=>r-e>64?globalThis.Buffer.from(t.subarray(e,r)).toString("utf8"):i5(t,e,r):(t,e,r)=>r-e>64?wX.decode(t.subarray(e,r)):i5(t,e,r),EX=gd?t=>t.length>64?globalThis.Buffer.from(t):n5(t):t=>t.length>64?_X.encode(t):n5(t),Xa=c(t=>Uint8Array.from(t),"fromArray"),e8=gd?(t,e,r)=>t1(t)?new Uint8Array(t.subarray(e,r)):t.slice(e,r):(t,e,r)=>t.slice(e,r),CX=gd?(t,e)=>(t=t.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Qy(globalThis.Buffer.concat(t,e))):(t,e)=>{let r=new Uint8Array(e),n=0;for(let i of t)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},SX=gd?t=>globalThis.Buffer.allocUnsafe(t):t=>new Uint8Array(t);function dD(t,e){if(t1(t)&&t1(e))return t.compare(e);for(let r=0;r<t.length;r++)if(t[r]!==e[r])return t[r]<e[r]?-1:1;return 0}s(dD,"compare2");c(dD,"compare");function n5(t,e=1/0){let r,n=t.length,i=null,o=[];for(let a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}s(n5,"utf8ToBytes");c(n5,"utf8ToBytes");function i5(t,e,r){let n=[];for(;e<r;){let i=t[e],o=null,a=i>239?4:i>223?3:i>191?2:1;if(e+a<=r){let f,l,d,p;switch(a){case 1:i<128&&(o=i);break;case 2:f=t[e+1],(f&192)===128&&(p=(i&31)<<6|f&63,p>127&&(o=p));break;case 3:f=t[e+1],l=t[e+2],(f&192)===128&&(l&192)===128&&(p=(i&15)<<12|(f&63)<<6|l&63,p>2047&&(p<55296||p>57343)&&(o=p));break;case 4:f=t[e+1],l=t[e+2],d=t[e+3],(f&192)===128&&(l&192)===128&&(d&192)===128&&(p=(i&15)<<18|(f&63)<<12|(l&63)<<6|d&63,p>65535&&p<1114112&&(o=p))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),e+=a}return hD(n)}s(i5,"utf8Slice");c(i5,"utf8Slice");var Tk=4096;function hD(t){let e=t.length;if(e<=Tk)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Tk));return r}s(hD,"decodeCodePointsArray");c(hD,"decodeCodePointsArray");var IX=256,t8=s(class{constructor(t=IX){this.chunkSize=t,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(t){let e=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let n=e.length-(this.maxCursor-this.cursor)-1;e.set(t,n)}else{if(e){let n=e.length-(this.maxCursor-this.cursor)-1;n<e.length&&(this.chunks[this.chunks.length-1]=e.subarray(0,n),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(e=SX(this.chunkSize),this.chunks.push(e),this.maxCursor+=e.length,this._initReuseChunk===null&&(this._initReuseChunk=e),e.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let e;if(this.chunks.length===1){let r=this.chunks[0];t&&this.cursor>r.length/2?(e=this.cursor===r.length?r:r.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):e=e8(r,0,this.cursor)}else e=CX(this.chunks,this.cursor);return t&&this.reset(),e}},"Bl");c(t8,"Bl");var lr="CBOR decode error:",pD="CBOR encode error:",k1=[];k1[23]=1;k1[24]=2;k1[25]=3;k1[26]=5;k1[27]=9;function pl(t,e,r){if(t.length-e<r)throw new Error(`${lr} not enough data for type`)}s(pl,"assertEnoughData");c(pl,"assertEnoughData");var Wn=[24,256,65536,4294967296,BigInt("18446744073709551616")];function cf(t,e,r){pl(t,e,1);let n=t[e];if(r.strict===!0&&n<Wn[0])throw new Error(`${lr} integer encoded in more bytes than necessary (strict decode)`);return n}s(cf,"readUint8");c(cf,"readUint8");function ff(t,e,r){pl(t,e,2);let n=t[e]<<8|t[e+1];if(r.strict===!0&&n<Wn[1])throw new Error(`${lr} integer encoded in more bytes than necessary (strict decode)`);return n}s(ff,"readUint16");c(ff,"readUint16");function lf(t,e,r){pl(t,e,4);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3];if(r.strict===!0&&n<Wn[2])throw new Error(`${lr} integer encoded in more bytes than necessary (strict decode)`);return n}s(lf,"readUint32");c(lf,"readUint32");function uf(t,e,r){pl(t,e,8);let n=t[e]*16777216+(t[e+1]<<16)+(t[e+2]<<8)+t[e+3],i=t[e+4]*16777216+(t[e+5]<<16)+(t[e+6]<<8)+t[e+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<Wn[3])throw new Error(`${lr} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${lr} integers outside of the safe integer range are not supported`)}s(uf,"readUint64");c(uf,"readUint64");function mD(t,e,r,n){return new nt(Le.uint,cf(t,e+1,n),2)}s(mD,"decodeUint8");c(mD,"decodeUint8");function bD(t,e,r,n){return new nt(Le.uint,ff(t,e+1,n),3)}s(bD,"decodeUint16");c(bD,"decodeUint16");function gD(t,e,r,n){return new nt(Le.uint,lf(t,e+1,n),5)}s(gD,"decodeUint32");c(gD,"decodeUint32");function vD(t,e,r,n){return new nt(Le.uint,uf(t,e+1,n),9)}s(vD,"decodeUint64");c(vD,"decodeUint64");function df(t,e){return _s(t,0,e.value)}s(df,"encodeUint");c(df,"encodeUint");function _s(t,e,r){if(r<Wn[0]){let n=Number(r);t.push([e|n])}else if(r<Wn[1]){let n=Number(r);t.push([e|24,n])}else if(r<Wn[2]){let n=Number(r);t.push([e|25,n>>>8,n&255])}else if(r<Wn[3]){let n=Number(r);t.push([e|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<Wn[4]){let i=[e|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,t.push(i)}else throw new Error(`${lr} encountered BigInt larger than allowable range`)}}s(_s,"encodeUintValue");c(_s,"encodeUintValue");df.encodedSize=c(s(function(e){return _s.encodedSize(e.value)},"encodedSize"),"encodedSize");_s.encodedSize=c(s(function(e){return e<Wn[0]?1:e<Wn[1]?2:e<Wn[2]?3:e<Wn[3]?5:9},"encodedSize2"),"encodedSize");df.compareTokens=c(s(function(e,r){return e.value<r.value?-1:e.value>r.value?1:0},"compareTokens"),"compareTokens");function yD(t,e,r,n){return new nt(Le.negint,-1-cf(t,e+1,n),2)}s(yD,"decodeNegint8");c(yD,"decodeNegint8");function xD(t,e,r,n){return new nt(Le.negint,-1-ff(t,e+1,n),3)}s(xD,"decodeNegint16");c(xD,"decodeNegint16");function wD(t,e,r,n){return new nt(Le.negint,-1-lf(t,e+1,n),5)}s(wD,"decodeNegint32");c(wD,"decodeNegint32");var r8=BigInt(-1),_D=BigInt(1);function AD(t,e,r,n){let i=uf(t,e+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new nt(Le.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${lr} integers outside of the safe integer range are not supported`);return new nt(Le.negint,r8-BigInt(i),9)}s(AD,"decodeNegint64");c(AD,"decodeNegint64");function o2(t,e){let r=e.value,n=typeof r=="bigint"?r*r8-_D:r*-1-1;_s(t,e.type.majorEncoded,n)}s(o2,"encodeNegint");c(o2,"encodeNegint");o2.encodedSize=c(s(function(e){let r=e.value,n=typeof r=="bigint"?r*r8-_D:r*-1-1;return n<Wn[0]?1:n<Wn[1]?2:n<Wn[2]?3:n<Wn[3]?5:9},"encodedSize3"),"encodedSize");o2.compareTokens=c(s(function(e,r){return e.value<r.value?1:e.value>r.value?-1:0},"compareTokens2"),"compareTokens");function vd(t,e,r,n){pl(t,e,r+n);let i=e8(t,e+r,e+r+n);return new nt(Le.bytes,i,r+n)}s(vd,"toToken");c(vd,"toToken");function ED(t,e,r,n){return vd(t,e,1,r)}s(ED,"decodeBytesCompact");c(ED,"decodeBytesCompact");function CD(t,e,r,n){return vd(t,e,2,cf(t,e+1,n))}s(CD,"decodeBytes8");c(CD,"decodeBytes8");function SD(t,e,r,n){return vd(t,e,3,ff(t,e+1,n))}s(SD,"decodeBytes16");c(SD,"decodeBytes16");function ID(t,e,r,n){return vd(t,e,5,lf(t,e+1,n))}s(ID,"decodeBytes32");c(ID,"decodeBytes32");function kD(t,e,r,n){let i=uf(t,e+1,n);if(typeof i=="bigint")throw new Error(`${lr} 64-bit integer bytes lengths not supported`);return vd(t,e,9,i)}s(kD,"decodeBytes64");c(kD,"decodeBytes64");function r1(t){return t.encodedBytes===void 0&&(t.encodedBytes=t.type===Le.string?EX(t.value):t.value),t.encodedBytes}s(r1,"tokenBytes");c(r1,"tokenBytes");function T1(t,e){let r=r1(e);_s(t,e.type.majorEncoded,r.length),t.push(r)}s(T1,"encodeBytes");c(T1,"encodeBytes");T1.encodedSize=c(s(function(e){let r=r1(e);return _s.encodedSize(r.length)+r.length},"encodedSize4"),"encodedSize");T1.compareTokens=c(s(function(e,r){return TD(r1(e),r1(r))},"compareTokens3"),"compareTokens");function TD(t,e){return t.length<e.length?-1:t.length>e.length?1:dD(t,e)}s(TD,"compareBytes");c(TD,"compareBytes");function yd(t,e,r,n,i){let o=r+n;pl(t,e,o);let a=new nt(Le.string,AX(t,e+r,e+o),o);return i.retainStringBytes===!0&&(a.byteValue=e8(t,e+r,e+o)),a}s(yd,"toToken2");c(yd,"toToken");function MD(t,e,r,n){return yd(t,e,1,r,n)}s(MD,"decodeStringCompact");c(MD,"decodeStringCompact");function RD(t,e,r,n){return yd(t,e,2,cf(t,e+1,n),n)}s(RD,"decodeString8");c(RD,"decodeString8");function BD(t,e,r,n){return yd(t,e,3,ff(t,e+1,n),n)}s(BD,"decodeString16");c(BD,"decodeString16");function DD(t,e,r,n){return yd(t,e,5,lf(t,e+1,n),n)}s(DD,"decodeString32");c(DD,"decodeString32");function PD(t,e,r,n){let i=uf(t,e+1,n);if(typeof i=="bigint")throw new Error(`${lr} 64-bit integer string lengths not supported`);return yd(t,e,9,i,n)}s(PD,"decodeString64");c(PD,"decodeString64");var kX=T1;function ml(t,e,r,n){return new nt(Le.array,n,r)}s(ml,"toToken3");c(ml,"toToken");function FD(t,e,r,n){return ml(t,e,1,r)}s(FD,"decodeArrayCompact");c(FD,"decodeArrayCompact");function OD(t,e,r,n){return ml(t,e,2,cf(t,e+1,n))}s(OD,"decodeArray8");c(OD,"decodeArray8");function ND(t,e,r,n){return ml(t,e,3,ff(t,e+1,n))}s(ND,"decodeArray16");c(ND,"decodeArray16");function LD(t,e,r,n){return ml(t,e,5,lf(t,e+1,n))}s(LD,"decodeArray32");c(LD,"decodeArray32");function UD(t,e,r,n){let i=uf(t,e+1,n);if(typeof i=="bigint")throw new Error(`${lr} 64-bit integer array lengths not supported`);return ml(t,e,9,i)}s(UD,"decodeArray64");c(UD,"decodeArray64");function jD(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${lr} indefinite length items not allowed`);return ml(t,e,1,1/0)}s(jD,"decodeArrayIndefinite");c(jD,"decodeArrayIndefinite");function a2(t,e){_s(t,Le.array.majorEncoded,e.value)}s(a2,"encodeArray");c(a2,"encodeArray");a2.compareTokens=df.compareTokens;a2.encodedSize=c(s(function(e){return _s.encodedSize(e.value)},"encodedSize5"),"encodedSize");function bl(t,e,r,n){return new nt(Le.map,n,r)}s(bl,"toToken4");c(bl,"toToken");function qD(t,e,r,n){return bl(t,e,1,r)}s(qD,"decodeMapCompact");c(qD,"decodeMapCompact");function HD(t,e,r,n){return bl(t,e,2,cf(t,e+1,n))}s(HD,"decodeMap8");c(HD,"decodeMap8");function zD(t,e,r,n){return bl(t,e,3,ff(t,e+1,n))}s(zD,"decodeMap16");c(zD,"decodeMap16");function $D(t,e,r,n){return bl(t,e,5,lf(t,e+1,n))}s($D,"decodeMap32");c($D,"decodeMap32");function GD(t,e,r,n){let i=uf(t,e+1,n);if(typeof i=="bigint")throw new Error(`${lr} 64-bit integer map lengths not supported`);return bl(t,e,9,i)}s(GD,"decodeMap64");c(GD,"decodeMap64");function KD(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${lr} indefinite length items not allowed`);return bl(t,e,1,1/0)}s(KD,"decodeMapIndefinite");c(KD,"decodeMapIndefinite");function c2(t,e){_s(t,Le.map.majorEncoded,e.value)}s(c2,"encodeMap");c(c2,"encodeMap");c2.compareTokens=df.compareTokens;c2.encodedSize=c(s(function(e){return _s.encodedSize(e.value)},"encodedSize6"),"encodedSize");function VD(t,e,r,n){return new nt(Le.tag,r,1)}s(VD,"decodeTagCompact");c(VD,"decodeTagCompact");function WD(t,e,r,n){return new nt(Le.tag,cf(t,e+1,n),2)}s(WD,"decodeTag8");c(WD,"decodeTag8");function JD(t,e,r,n){return new nt(Le.tag,ff(t,e+1,n),3)}s(JD,"decodeTag16");c(JD,"decodeTag16");function YD(t,e,r,n){return new nt(Le.tag,lf(t,e+1,n),5)}s(YD,"decodeTag32");c(YD,"decodeTag32");function XD(t,e,r,n){return new nt(Le.tag,uf(t,e+1,n),9)}s(XD,"decodeTag64");c(XD,"decodeTag64");function f2(t,e){_s(t,Le.tag.majorEncoded,e.value)}s(f2,"encodeTag");c(f2,"encodeTag");f2.compareTokens=df.compareTokens;f2.encodedSize=c(s(function(e){return _s.encodedSize(e.value)},"encodedSize7"),"encodedSize");var TX=20,MX=21,RX=22,BX=23;function ZD(t,e,r,n){if(n.allowUndefined===!1)throw new Error(`${lr} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new nt(Le.null,null,1):new nt(Le.undefined,void 0,1)}s(ZD,"decodeUndefined");c(ZD,"decodeUndefined");function QD(t,e,r,n){if(n.allowIndefinite===!1)throw new Error(`${lr} indefinite length items not allowed`);return new nt(Le.break,void 0,1)}s(QD,"decodeBreak");c(QD,"decodeBreak");function l2(t,e,r){if(r){if(r.allowNaN===!1&&Number.isNaN(t))throw new Error(`${lr} NaN values are not supported`);if(r.allowInfinity===!1&&(t===1/0||t===-1/0))throw new Error(`${lr} Infinity values are not supported`)}return new nt(Le.float,t,e)}s(l2,"createToken");c(l2,"createToken");function eP(t,e,r,n){return l2(d2(t,e+1),3,n)}s(eP,"decodeFloat16");c(eP,"decodeFloat16");function tP(t,e,r,n){return l2(h2(t,e+1),5,n)}s(tP,"decodeFloat32");c(tP,"decodeFloat32");function rP(t,e,r,n){return l2(s8(t,e+1),9,n)}s(rP,"decodeFloat64");c(rP,"decodeFloat64");function u2(t,e,r){let n=e.value;if(n===!1)t.push([Le.float.majorEncoded|TX]);else if(n===!0)t.push([Le.float.majorEncoded|MX]);else if(n===null)t.push([Le.float.majorEncoded|RX]);else if(n===void 0)t.push([Le.float.majorEncoded|BX]);else{let i,o=!1;(!r||r.float64!==!0)&&(n8(n),i=d2(po,1),n===i||Number.isNaN(n)?(po[0]=249,t.push(po.slice(0,3)),o=!0):(i8(n),i=h2(po,1),n===i&&(po[0]=250,t.push(po.slice(0,5)),o=!0))),o||(iP(n),i=s8(po,1),po[0]=251,t.push(po.slice(0,9)))}}s(u2,"encodeFloat");c(u2,"encodeFloat");u2.encodedSize=c(s(function(e,r){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){n8(n);let i=d2(po,1);if(n===i||Number.isNaN(n))return 3;if(i8(n),i=h2(po,1),n===i)return 5}return 9},"encodedSize8"),"encodedSize");var nP=new ArrayBuffer(9),qs=new DataView(nP,1),po=new Uint8Array(nP,0);function n8(t){if(t===1/0)qs.setUint16(0,31744,!1);else if(t===-1/0)qs.setUint16(0,64512,!1);else if(Number.isNaN(t))qs.setUint16(0,32256,!1);else{qs.setFloat32(0,t);let e=qs.getUint32(0),r=(e&2139095040)>>23,n=e&8388607;if(r===255)qs.setUint16(0,31744,!1);else if(r===0)qs.setUint16(0,(t&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?qs.setUint16(0,0):i<-14?qs.setUint16(0,(e&2147483648)>>16|1<<24+i,!1):qs.setUint16(0,(e&2147483648)>>16|i+15<<10|n>>13,!1)}}}s(n8,"encodeFloat16");c(n8,"encodeFloat16");function d2(t,e){if(t.length-e<2)throw new Error(`${lr} not enough data for float16`);let r=(t[e]<<8)+t[e+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}s(d2,"readFloat16");c(d2,"readFloat16");function i8(t){qs.setFloat32(0,t,!1)}s(i8,"encodeFloat32");c(i8,"encodeFloat32");function h2(t,e){if(t.length-e<4)throw new Error(`${lr} not enough data for float32`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,4).getFloat32(0,!1)}s(h2,"readFloat32");c(h2,"readFloat32");function iP(t){qs.setFloat64(0,t,!1)}s(iP,"encodeFloat64");c(iP,"encodeFloat64");function s8(t,e){if(t.length-e<8)throw new Error(`${lr} not enough data for float64`);let r=(t.byteOffset||0)+e;return new DataView(t.buffer,r,8).getFloat64(0,!1)}s(s8,"readFloat64");c(s8,"readFloat64");u2.compareTokens=df.compareTokens;function br(t,e,r){throw new Error(`${lr} encountered invalid minor (${r}) for major ${t[e]>>>5}`)}s(br,"invalidMinor");c(br,"invalidMinor");function M1(t){return()=>{throw new Error(`${lr} ${t}`)}}s(M1,"errorer");c(M1,"errorer");var ot=[];for(let t=0;t<=23;t++)ot[t]=br;ot[24]=mD;ot[25]=bD;ot[26]=gD;ot[27]=vD;ot[28]=br;ot[29]=br;ot[30]=br;ot[31]=br;for(let t=32;t<=55;t++)ot[t]=br;ot[56]=yD;ot[57]=xD;ot[58]=wD;ot[59]=AD;ot[60]=br;ot[61]=br;ot[62]=br;ot[63]=br;for(let t=64;t<=87;t++)ot[t]=ED;ot[88]=CD;ot[89]=SD;ot[90]=ID;ot[91]=kD;ot[92]=br;ot[93]=br;ot[94]=br;ot[95]=M1("indefinite length bytes/strings are not supported");for(let t=96;t<=119;t++)ot[t]=MD;ot[120]=RD;ot[121]=BD;ot[122]=DD;ot[123]=PD;ot[124]=br;ot[125]=br;ot[126]=br;ot[127]=M1("indefinite length bytes/strings are not supported");for(let t=128;t<=151;t++)ot[t]=FD;ot[152]=OD;ot[153]=ND;ot[154]=LD;ot[155]=UD;ot[156]=br;ot[157]=br;ot[158]=br;ot[159]=jD;for(let t=160;t<=183;t++)ot[t]=qD;ot[184]=HD;ot[185]=zD;ot[186]=$D;ot[187]=GD;ot[188]=br;ot[189]=br;ot[190]=br;ot[191]=KD;for(let t=192;t<=215;t++)ot[t]=VD;ot[216]=WD;ot[217]=JD;ot[218]=YD;ot[219]=XD;ot[220]=br;ot[221]=br;ot[222]=br;ot[223]=br;for(let t=224;t<=243;t++)ot[t]=M1("simple values are not supported");ot[244]=br;ot[245]=br;ot[246]=br;ot[247]=ZD;ot[248]=M1("simple values are not supported");ot[249]=eP;ot[250]=tP;ot[251]=rP;ot[252]=br;ot[253]=br;ot[254]=br;ot[255]=QD;var ya=[];for(let t=0;t<24;t++)ya[t]=new nt(Le.uint,t,1);for(let t=-1;t>=-24;t--)ya[31-t]=new nt(Le.negint,t,1);ya[64]=new nt(Le.bytes,new Uint8Array(0),1);ya[96]=new nt(Le.string,"",1);ya[128]=new nt(Le.array,0,1);ya[160]=new nt(Le.map,0,1);ya[244]=new nt(Le.false,!1,1);ya[245]=new nt(Le.true,!0,1);ya[246]=new nt(Le.null,null,1);function sP(t){switch(t.type){case Le.false:return Xa([244]);case Le.true:return Xa([245]);case Le.null:return Xa([246]);case Le.bytes:return t.value.length?void 0:Xa([64]);case Le.string:return t.value===""?Xa([96]):void 0;case Le.array:return t.value===0?Xa([128]):void 0;case Le.map:return t.value===0?Xa([160]):void 0;case Le.uint:return t.value<24?Xa([Number(t.value)]):void 0;case Le.negint:if(t.value>=-24)return Xa([31-Number(t.value)])}}s(sP,"quickEncodeToken");c(sP,"quickEncodeToken");var DX={float64:!1,mapSorter:fP,quickEncodeToken:sP};function oP(){let t=[];return t[Le.uint.major]=df,t[Le.negint.major]=o2,t[Le.bytes.major]=T1,t[Le.string.major]=kX,t[Le.array.major]=a2,t[Le.map.major]=c2,t[Le.tag.major]=f2,t[Le.float.major]=u2,t}s(oP,"makeCborEncoders");c(oP,"makeCborEncoders");var aP=oP(),m4=new t8,ng=s(class{constructor(t,e){this.obj=t,this.parent=e}includes(t){let e=this;do if(e.obj===t)return!0;while(e=e.parent);return!1}static createCheck(t,e){if(t&&t.includes(e))throw new Error(`${pD} object contains circular references`);return new ng(e,t)}},"Ref");c(ng,"Ref");var jc={null:new nt(Le.null,null),undefined:new nt(Le.undefined,void 0),true:new nt(Le.true,!0),false:new nt(Le.false,!1),emptyArray:new nt(Le.array,0),emptyMap:new nt(Le.map,0)},tf={number(t,e,r,n){return!Number.isInteger(t)||!Number.isSafeInteger(t)?new nt(Le.float,t):t>=0?new nt(Le.uint,t):new nt(Le.negint,t)},bigint(t,e,r,n){return t>=BigInt(0)?new nt(Le.uint,t):new nt(Le.negint,t)},Uint8Array(t,e,r,n){return new nt(Le.bytes,t)},string(t,e,r,n){return new nt(Le.string,t)},boolean(t,e,r,n){return t?jc.true:jc.false},null(t,e,r,n){return jc.null},undefined(t,e,r,n){return jc.undefined},ArrayBuffer(t,e,r,n){return new nt(Le.bytes,new Uint8Array(t))},DataView(t,e,r,n){return new nt(Le.bytes,new Uint8Array(t.buffer,t.byteOffset,t.byteLength))},Array(t,e,r,n){if(!t.length)return r.addBreakTokens===!0?[jc.emptyArray,new nt(Le.break)]:jc.emptyArray;n=ng.createCheck(n,t);let i=[],o=0;for(let a of t)i[o++]=N0(a,r,n);return r.addBreakTokens?[new nt(Le.array,t.length),i,new nt(Le.break)]:[new nt(Le.array,t.length),i]},Object(t,e,r,n){let i=e!=="Object",o=i?t.keys():Object.keys(t),a=i?t.size:o.length;if(!a)return r.addBreakTokens===!0?[jc.emptyMap,new nt(Le.break)]:jc.emptyMap;n=ng.createCheck(n,t);let f=[],l=0;for(let d of o)f[l++]=[N0(d,r,n),N0(i?t.get(d):t[d],r,n)];return cP(f,r),r.addBreakTokens?[new nt(Le.map,a),f,new nt(Le.break)]:[new nt(Le.map,a),f]}};tf.Map=tf.Object;tf.Buffer=tf.Uint8Array;for(let t of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))tf[`${t}Array`]=tf.DataView;function N0(t,e={},r){let n=fD(t),i=e&&e.typeEncoders&&e.typeEncoders[n]||tf[n];if(typeof i=="function"){let a=i(t,n,e,r);if(a!=null)return a}let o=tf[n];if(!o)throw new Error(`${pD} unsupported type: ${n}`);return o(t,n,e,r)}s(N0,"objectToTokens");c(N0,"objectToTokens");function cP(t,e){e.mapSorter&&t.sort(e.mapSorter)}s(cP,"sortMapEntries");c(cP,"sortMapEntries");function fP(t,e){let r=Array.isArray(t[0])?t[0][0]:t[0],n=Array.isArray(e[0])?e[0][0]:e[0];if(r.type!==n.type)return r.type.compare(n.type);let i=r.type.major,o=aP[i].compareTokens(r,n);return o===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),o}s(fP,"mapSorter");c(fP,"mapSorter");function o8(t,e,r,n){if(Array.isArray(e))for(let i of e)o8(t,i,r,n);else r[e.type.major](t,e,n)}s(o8,"tokensToEncoded");c(o8,"tokensToEncoded");function lP(t,e,r){let n=N0(t,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let o=e[n.type.major];if(o.encodedSize){let a=o.encodedSize(n,r),f=new t8(a);if(o(f,n,r),f.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return Qy(f.chunks[0])}}return m4.reset(),o8(m4,n,e,r),m4.toBytes(!0)}s(lP,"encodeCustom");c(lP,"encodeCustom");function p2(t,e){return e=Object.assign({},DX,e),lP(t,aP,e)}s(p2,"encode6");c(p2,"encode");var PX={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},uP=s(class{constructor(t,e={}){this.pos=0,this.data=t,this.options=e}done(){return this.pos>=this.data.length}next(){let t=this.data[this.pos],e=ya[t];if(e===void 0){let r=ot[t];if(!r)throw new Error(`${lr} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let n=t&31;e=r(this.data,this.pos,n,this.options)}return this.pos+=e.encodedLength,e}},"Tokeniser");c(uP,"Tokeniser");var n1=Symbol.for("DONE"),m2=Symbol.for("BREAK");function dP(t,e,r){let n=[];for(let i=0;i<t.value;i++){let o=sd(e,r);if(o===m2){if(t.value===1/0)break;throw new Error(`${lr} got unexpected break to lengthed array`)}if(o===n1)throw new Error(`${lr} found array but not enough entries (got ${i}, expected ${t.value})`);n[i]=o}return n}s(dP,"tokenToArray");c(dP,"tokenToArray");function hP(t,e,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<t.value;a++){let f=sd(e,r);if(f===m2){if(t.value===1/0)break;throw new Error(`${lr} got unexpected break to lengthed map`)}if(f===n1)throw new Error(`${lr} found map but not enough entries (got ${a} [no key], expected ${t.value})`);if(n!==!0&&typeof f!="string")throw new Error(`${lr} non-string keys not supported (got ${typeof f})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(f)||!n&&f in i))throw new Error(`${lr} found repeat map key "${f}"`);let l=sd(e,r);if(l===n1)throw new Error(`${lr} found map but not enough entries (got ${a} [no value], expected ${t.value})`);n?o.set(f,l):i[f]=l}return n?o:i}s(hP,"tokenToMap");c(hP,"tokenToMap");function sd(t,e){if(t.done())return n1;let r=t.next();if(r.type===Le.break)return m2;if(r.type.terminal)return r.value;if(r.type===Le.array)return dP(r,t,e);if(r.type===Le.map)return hP(r,t,e);if(r.type===Le.tag){if(e.tags&&typeof e.tags[r.value]=="function"){let n=sd(t,e);return e.tags[r.value](n)}throw new Error(`${lr} tag not supported (${r.value})`)}throw new Error("unsupported")}s(sd,"tokensToObject");c(sd,"tokensToObject");function b2(t,e){if(!(t instanceof Uint8Array))throw new Error(`${lr} data to decode must be a Uint8Array`);e=Object.assign({},PX,e);let r=e.tokenizer||new uP(t,e),n=sd(r,e);if(n===n1)throw new Error(`${lr} did not find any content to decode`);if(n===m2)throw new Error(`${lr} got unexpected break`);if(!r.done())throw new Error(`${lr} too many terminals, data makes no sense`);return n}s(b2,"decode7");c(b2,"decode");ba();var pP=42;function mP(t){if(t.asCID!==t)return null;let e=tr.asCID(t);if(!e)return null;let r=new Uint8Array(e.bytes.byteLength+1);return r.set(e.bytes,1),[new nt(Le.tag,pP),new nt(Le.bytes,r)]}s(mP,"cidEncoder");c(mP,"cidEncoder");function bP(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}s(bP,"undefinedEncoder");c(bP,"undefinedEncoder");function gP(t){if(Number.isNaN(t))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(t===1/0||t===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}s(gP,"numberEncoder");c(gP,"numberEncoder");var FX={float64:!0,typeEncoders:{Object:mP,undefined:bP,number:gP}};function vP(t){if(t[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return tr.decode(t.subarray(1))}s(vP,"cidDecoder");c(vP,"cidDecoder");var yP={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};yP.tags[pP]=vP;var OX="dag-cbor",ig=113,g2=c(t=>p2(t,FX),"encode"),xP=c(t=>b2(t,yP),"decode"),NX=24;async function wP(t){let e=await s2({value:t,codec:bd,hasher:ud});return{cid:e.cid,linkedBlock:e.bytes}}s(wP,"encodePayload");c(wP,"encodePayload");function _P(t,e=NX){let r=(e-t.length%e)%e,n=new Uint8Array(t.length+r);return n.set(t,0),n}s(_P,"pad");c(_P,"pad");async function AP(t){return(await s2({value:t,codec:bd,hasher:Kg})).cid}s(AP,"encodeIdentityCID");c(AP,"encodeIdentityCID");function EP(t){if(t=tr.asCID(t),t.code!==ig)throw new Error("CID codec must be dag-cbor");if(t.multihash.code!==Kg.code)throw new Error("CID must use identity multihash");return xP(t.multihash.digest)}s(EP,"decodeIdentityCID");c(EP,"decodeIdentityCID");async function CP(t,e){return _P((await AP(t)).bytes,e)}s(CP,"prepareCleartext");c(CP,"prepareCleartext");function SP(t){return EP(tr.decodeFirst(t)[0])}s(SP,"decodeCleartext");c(SP,"decodeCleartext");var LX=Symbol("abortable"),s5=Symbol("aborted");function IP(t,e){if(e.aborted)return Promise.reject(s5);let r,n=new Promise((i,o)=>{r=o});return e.addEventListener("abort",()=>{r(s5)}),Promise.race([t,n])}s(IP,"abortable");c(IP,"abortable");var UX=c((t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),""),"nanoid"),kP="utils_abort_request",Xi;(function(t){t[t.PARSE_ERROR=-32700]="PARSE_ERROR",t[t.INVALID_REQUEST=-32600]="INVALID_REQUEST",t[t.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",t[t.INVALID_PARAMS=-32602]="INVALID_PARAMS",t[t.INTERNAL_ERROR=-32603]="INTERNAL_ERROR"})(Xi||(Xi={}));var TP={[Xi.PARSE_ERROR]:"Parse error",[Xi.INVALID_REQUEST]:"Invalid request",[Xi.METHOD_NOT_FOUND]:"Method not found",[Xi.INVALID_PARAMS]:"Invalid params",[Xi.INTERNAL_ERROR]:"Internal error"};function MP(t){return-32e3>=t&&t>=-32099}s(MP,"isServerError");c(MP,"isServerError");function v2(t){return TP[t.toString()]??(MP(t)?"Server error":"Application error")}s(v2,"getErrorMessage");c(v2,"getErrorMessage");var rf=s(class extends Error{static fromObject(t){return new rf(t.code,t.message,t.data)}toObject(){return{code:this.code,data:this.data,message:this.message}}constructor(t,e,r){super(),Object.setPrototypeOf(this,rf.prototype),this.code=t,this.data=r,this.message=e??v2(t)}},"RPCError");c(rf,"RPCError");function xd(t){let e=TP[t];return c(s(function(n){return new rf(t,e,n)},"createError"),"createError")}s(xd,"createErrorFactory");c(xd,"createErrorFactory");var Kle=xd(Xi.PARSE_ERROR),Vle=xd(Xi.INVALID_REQUEST),Wle=xd(Xi.METHOD_NOT_FOUND),Jle=xd(Xi.INVALID_PARAMS),Yle=xd(Xi.INTERNAL_ERROR);function RP(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}s(RP,"_checkPrivateRedeclaration");c(RP,"_checkPrivateRedeclaration");function BP(t,e){return e.get?e.get.call(t):e.value}s(BP,"_classApplyDescriptorGet");c(BP,"_classApplyDescriptorGet");function DP(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}s(DP,"_classApplyDescriptorSet");c(DP,"_classApplyDescriptorSet");function a8(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}s(a8,"_classExtractFieldDescriptor");c(a8,"_classExtractFieldDescriptor");function Eb(t,e){var r=a8(t,e,"get");return BP(t,r)}s(Eb,"_classPrivateFieldGet");c(Eb,"_classPrivateFieldGet");function PP(t,e,r){RP(t,e),e.set(t,r)}s(PP,"_classPrivateFieldInit");c(PP,"_classPrivateFieldInit");function FP(t,e,r){var n=a8(t,e,"set");return DP(t,n,r),r}s(FP,"_classPrivateFieldSet");c(FP,"_classPrivateFieldSet");var w0=new WeakMap,o5=s(class{get connection(){return Eb(this,w0)}createID(){return UX()}request(t,e=void 0,r={}){let{signal:n}=r;if(n?.aborted)return Promise.reject(s5);let i=this.createID(),o=Eb(this,w0).send({jsonrpc:"2.0",id:i,method:t,params:e}).then(a=>{if(a==null)throw new Error("Missing response");if(a.error!=null)throw rf.fromObject(a.error);return a.result});return n==null?o:(n.addEventListener("abort",()=>{this.notify(kP,{id:i})}),IP(o,n))}async notify(t,e=void 0){await Eb(this,w0).send({jsonrpc:"2.0",method:t,params:e})}constructor(t){PP(this,w0,{writable:!0,value:void 0}),FP(this,w0,t)}},"RPCClient");c(o5,"RPCClient");function a5(t,e){return{jsonrpc:"2.0",id:t,error:{code:e,message:v2(e)}}}s(a5,"createErrorResponse");c(a5,"createErrorResponse");function OP(t,e,r){console.warn("Unhandled handler error",e,r)}s(OP,"fallbackOnHandlerError");c(OP,"fallbackOnHandlerError");function NP(t,e){console.warn("Unhandled invalid message",e)}s(NP,"fallbackOnInvalidMessage");c(NP,"fallbackOnInvalidMessage");function LP(t,e){console.warn("Unhandled notification",e)}s(LP,"fallbackOnNotification");c(LP,"fallbackOnNotification");function UP(t,e={}){let r=e.onHandlerError??OP,n=e.onInvalidMessage??NP,i=e.onNotification??LP,o={};function a(f,l){if(l.method===kP){let d=l.params?.id;d!=null&&o[d]?.abort()}else i(f,l)}return s(a,"handleNotification"),c(a,"handleNotification"),c(s(async function(l,d){let p=d.id;if(d.jsonrpc!=="2.0"||d.method==null)return p==null?(n(l,d),null):a5(p,Xi.INVALID_REQUEST);let g=t[d.method];if(g==null)return p==null?(a(l,d),null):a5(p,Xi.METHOD_NOT_FOUND);try{let x;if(p!=null&&g[LX]){let C=new AbortController;o[p]=C,x=g(l,d.params,{signal:C.signal})}else x=g(l,d.params,{});let A=x==null?x:typeof x.then=="function"?await x:x;return p==null||o[p]?.signal.aborted?null:{jsonrpc:"2.0",id:p,result:A}}catch(x){if(p==null||o[p]?.signal.aborted)return r(l,d,x),null;let A;if(x instanceof rf)A=x.toObject();else{r(l,d,x);let C=x.code??-32e3;A={code:C,message:x.message||v2(C)}}return{jsonrpc:"2.0",id:p,error:A}}finally{p!=null&&delete o[p]}},"handleRequest"),"handleRequest")}s(UP,"createHandler");c(UP,"createHandler");ba();var jX=dr(bV(),1),Ri=dr(md(),1),qX=`
660
660
  sign-in-with-ethereum =
661
661
  domain %s" wants you to sign in with your Ethereum account:" LF
662
662
  address LF