@learncard/core 2.1.0 → 3.0.0

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.
@@ -788,8 +788,8 @@ HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
788
788
  `)}signMessage(){let e;switch(this.type){case Xu.PERSONAL_SIGNATURE:{e=this.toMessage();break}default:{e=this.toMessage();break}}return e}};o(Ta,"SiweMessage");var kM=5*60,jf;(function(r){function e(i){let s={h:{t:"eip4361"},p:{domain:i.domain,iat:i.issuedAt,iss:`did:pkh:eip155:${i.chainId}:${i.address}`,aud:i.uri,version:i.version,nonce:i.nonce}};return i.signature&&(s.s={t:"eip191",s:i.signature}),i.notBefore&&(s.p.nbf=i.notBefore),i.expirationTime&&(s.p.exp=i.expirationTime),i.statement&&(s.p.statement=i.statement),i.requestId&&(s.p.requestId=i.requestId),i.resources&&(s.p.resources=i.resources),s}o(e,"fromSiweMessage"),r.fromSiweMessage=e;function t(i,s={}){var a;if(i.h.t==="eip4361"&&((a=i.s)==null?void 0:a.t)==="eip191")return n(i,s);throw new Error("Unsupported CACAO signature type")}o(t,"verify"),r.verify=t;function n(i,s){var O;if(!i.s)throw new Error("CACAO does not have a signature");let a=s.atTime?s.atTime.getTime():Date.now(),f=((O=s.clockSkewSecs)!=null?O:kM)*1e3;if(Date.parse(i.p.iat)>a+f||Date.parse(i.p.nbf)>a+f)throw new Error("CACAO is not valid yet");let u=s.revocationPhaseOutSecs?s.revocationPhaseOutSecs*1e3:0;if(Date.parse(i.p.exp)+u+f<a)throw new Error("CACAO has expired");let p=Ta.fromCacao(i),b=i.s.s,x=Wy(p.toMessage(),b),A=fs.parse(i.p.iss.replace("did:pkh:","")).address;if(x.toLowerCase()!==A.toLowerCase())throw new Error("Signature does not belong to issuer")}o(n,"verifyEIP191Signature"),r.verifyEIP191Signature=n})(jf||(jf={}));var Kf;(function(r){let e=o(function(t){try{return Promise.resolve(rs({value:t,codec:Ci,hasher:zo}))}catch(n){return Promise.reject(n)}},"fromCacao");r.fromCacao=e})(Kf||(Kf={}));uf();Hc();var Jy=at(ro(),1);uf();function Xy(){return It((0,Jy.randomBytes)(16),"base64")}o(Xy,"randomString");var Zy="base64pad",Qy="base64url";function e3(r){return It(r,Zy)}o(e3,"encodeBase64");function t3(r){return It(r,Qy)}o(t3,"encodeBase64Url");function r3(r){return Lt(r,Zy)}o(r3,"decodeBase64");function Zu(r){return JSON.parse(It(Lt(r,Qy)))}o(Zu,"base64urlToJSON");function n3(r){if(r.signatures.length>1)throw new Error("Cant convert to compact jws");return`${r.signatures[0].protected}.${r.payload}.${r.signatures[0].signature}`}o(n3,"fromDagJWS");function i3(r,e){if(e){let t=e.toISOString().split(".")[0]+"Z";return`${r}?versionTime=${t}`}else return r}o(i3,"didWithTime");function o3(r){return r?Array.isArray(r)?r:[r]:[]}o(o3,"extractControllers");function CM(r){return"registry"in r&&"cache"in r}o(CM,"isResolver");var ls=class{constructor({provider:e,resolver:t={},resolverOptions:n,capability:i,parent:s}={}){if(e!=null&&(this._client=new ga(e)),i){if(this._capability=i,this._parentId=this._capability.p.iss,s&&this._parentId!==s)throw new Error("Capability issuer and parent not equal")}else s&&(this._parentId=s);this.setResolver(t,n)}get capability(){if(!this._capability)throw new Error("DID has no capability attached");return this._capability}get hasCapability(){return this._capability!=null}get parent(){if(!this._parentId)throw new Error("DID has no parent DID");return this._parentId}get hasParent(){return this._parentId!=null}get id(){if(this._id==null)throw new Error("DID is not authenticated");return this._id}get authenticated(){return this._id!=null}withCapability(e){var t;return new ls({provider:(t=this._client)==null?void 0:t.connection,resolver:this._resolver,capability:e,parent:this._parentId})}setProvider(e){if(this._client==null)this._client=new ga(e);else if(this._client.connection!==e)throw new Error("A different provider is already set, create a new DID instance to use another provider")}setResolver(e,t){this._resolver=CM(e)?e:new rf(e,t)}authenticate(){return Z(this,arguments,function*({provider:e,paths:t=[],aud:n}={}){if(e!=null&&this.setProvider(e),this._client==null)throw new Error("No provider available");let i=Xy(),s=yield this._client.request("did_authenticate",{nonce:i,aud:n,paths:t}),{kid:a}=yield this.verifyJWS(s),f=Zu(s.payload);if(!a.includes(f.did))throw new Error("Invalid authencation response, kid mismatch");if(f.nonce!==i)throw new Error("Invalid authencation response, wrong nonce");if(f.aud!==n)throw new Error("Invalid authencation response, wrong aud");if(f.exp<Date.now()/1e3)throw new Error("Invalid authencation response, expired");return this._id=f.did,this._id})}createJWS(n){return Z(this,arguments,function*(e,t={}){if(this._client==null)throw new Error("No provider available");if(this._id==null)throw new Error("DID is not authenticated");if(this._capability){let s=yield Kf.fromCacao(this._capability),a=Pe.asCID(s.cid);if(!a)throw new Error("Capability CID of the JWS cannot be set to the capability payload cid as they are incompatible");t.protected=t.protected||{},t.protected.cap=`ipfs://${a==null?void 0:a.toString()}`}let{jws:i}=yield this._client.request("did_createJWS",Te(re({did:this._id},t),{payload:e}));return i})}createDagJWS(n){return Z(this,arguments,function*(e,t={}){let{cid:i,linkedBlock:s}=yield u2(e),a=t3(i.bytes);Object.assign(t,{linkedBlock:e3(s)});let f=yield this.createJWS(a,t),u=Pe.asCID(i);if(!u)throw new Error("CID of the JWS cannot be set to the encoded payload cid as they are incompatible");if(f.link=u,this._capability){let p=yield Kf.fromCacao(this._capability);return{jws:f,linkedBlock:s,cacaoBlock:p.bytes}}return{jws:f,linkedBlock:s}})}verifyJWS(n){return Z(this,arguments,function*(e,t={}){var b,x,A,O,T,k,$;typeof e!="string"&&(e=n3(e));let i=Zu(e.split(".")[0]).kid;if(!i)throw new Error('No "kid" found in jws');let s=yield this.resolve(i);if(!t.disableTimecheck){let C=(b=s.didDocumentMetadata)==null?void 0:b.nextUpdate;if(C){let z=t.revocationPhaseOutSecs?t.revocationPhaseOutSecs*1e3:0,H=new Date(C).valueOf()+z;if(!(t.atTime&&t.atTime.getTime()<H))throw new Error(`invalid_jws: signature authored with a revoked DID version: ${i}`)}let B=(x=s.didDocumentMetadata)==null?void 0:x.updated;if(B&&t.atTime&&t.atTime.getTime()<new Date(B).valueOf())throw new Error(`invalid_jws: signature authored before creation of DID version: ${i}`)}let f=(A=s.didDocument)==null?void 0:A.id;if(t.issuer&&t.issuer===((O=t.capability)==null?void 0:O.p.iss)&&f===t.capability.p.aud)jf.verify(t.capability,{atTime:t.atTime?t.atTime:void 0,revocationPhaseOutSecs:t.revocationPhaseOutSecs});else if(t.issuer&&t.issuer!==f){let C=i3(t.issuer,t.atTime),z=(T=(yield this.resolve(C)).didDocument)==null?void 0:T.controller,H=o3(z);if(((k=t.capability)==null?void 0:k.s)&&t.capability.p.aud===f&&H.includes(t.capability.p.iss))jf.verify(t.capability,{atTime:t.atTime?t.atTime:void 0,revocationPhaseOutSecs:t.revocationPhaseOutSecs});else if(!(f?H.includes(f):!1))throw new Error(`invalid_jws: not a valid verificationMethod for issuer: ${i}`)}let u=(($=s.didDocument)==null?void 0:$.verificationMethod)||[];Zg(e,u);let p;try{p=Zu(e.split(".")[1])}catch(C){}return{kid:i,payload:p,didResolutionResult:s}})}createJWE(i,s){return Z(this,arguments,function*(e,t,n={}){let a=yield tv(t,this._resolver);return ev(e,a,n.protectedHeader,n.aad)})}createDagJWE(i,s){return Z(this,arguments,function*(e,t,n={}){let a=yield l2(e);return this.createJWE(a,t,n)})}decryptJWE(n){return Z(this,arguments,function*(e,t={}){if(this._client==null)throw new Error("No provider available");if(this._id==null)throw new Error("DID is not authenticated");let{cleartext:i}=yield this._client.request("did_decryptJWE",Te(re({did:this._id},t),{jwe:e}));return r3(i)})}decryptDagJWE(e){return Z(this,null,function*(){let t=yield this.decryptJWE(e);return d2(t)})}resolve(e){return Z(this,null,function*(){let t=yield this._resolver.resolve(e);if(t.didResolutionMetadata.error){let{error:n,message:i}=t.didResolutionMetadata,s=i?`, ${i}`:"";throw new Error(`Failed to resolve ${e}: ${n}${s}`)}return t})}};o(ls,"DID");function Qu(r){var e=0,t=r.length,n=[];if(t%2)throw new Error("invalid hex:"+r);for(;e<t;e+=2)n.push(parseInt(r.substr(e,2),16));return new Uint8Array(n)}o(Qu,"toUint8Array");var s4=at(Z3());var nl=at(uu(),1);var i6=at(e6(),1);var VA="base64pad";function t6(r){return JSON.parse((0,i6.default)(r))}o(t6,"toStableObject");function WA(r){let e=new Uint8Array(r.length+2);return e[0]=237,e[1]=1,e.set(r,2),`did:key:z${It(e,"base58btc")}`}o(WA,"encodeDID");function r6(r){let[e,t,n]=r.split(".");return{payload:t,signatures:[{protected:e,signature:n}]}}o(r6,"toGeneralJWS");var n6=o((i,s,a,...f)=>Z(void 0,[i,s,a,...f],function*(r,e,t,n={}){let u=`${e}#${e.split(":")[2]}`,p=Wg(t),b=t6(Object.assign(n,{kid:u,alg:"EdDSA"}));return Xg(typeof r=="string"?r:t6(r),p,b)}),"sign"),GA={did_authenticate:(n,i)=>Z(void 0,[n,i],function*({did:r,secretKey:e},t){let s=yield n6({did:r,aud:t.aud,nonce:t.nonce,paths:t.paths,exp:Math.floor(Date.now()/1e3)+600},r,e);return r6(s)}),did_createJWS:(n,i)=>Z(void 0,[n,i],function*({did:r,secretKey:e},t){if(t.did.split("#")[0]!==r)throw new Tr(4100,`Unknown DID: ${r}`);let a=yield n6(t.payload,r,e,t.protected);return{jws:r6(a)}}),did_decryptJWE:(t,n)=>Z(void 0,[t,n],function*({secretKey:r},e){let i=nv((0,nl.convertSecretKeyToX25519)(r));try{let s=yield Qg(e.jwe,i);return{cleartext:It(s,VA)}}catch(s){throw new Tr(-32e3,s.message)}})},Gf=class{constructor(e){let{secretKey:t,publicKey:n}=(0,nl.generateKeyPairFromSeed)(e),i=WA(n),s=y2(GA);this._handle=a=>Z(this,null,function*(){return yield s({did:i,secretKey:t},a)})}get isDidProvider(){return!0}send(e){return Z(this,null,function*(){return yield this._handle(e)})}};o(Gf,"Ed25519Provider");Vn();Pc();var o6={tile:0,"caip10-link":1,model:2,MID:3};function YA(r){let e=o6[r];if(typeof e!="undefined")return e;throw new Error(`No stream type registered for name ${r}`)}o(YA,"codeByName");function JA(r){let e=Object.entries(o6).find(([,t])=>t===r);if(e)return e[0];throw new Error(`No stream type registered for index ${r}`)}o(JA,"nameByCode");var Cr=class{};o(Cr,"StreamType");Cr.nameByCode=JA;Cr.codeByName=YA;var op=at(Vf(),1);function $r(r){let e,t,n;return typeof r=="object"?(e=r.hashFunction,t=r.expiring,n=r.tags):e=r,(i,s,a)=>{if(a.value!=null)a.value=s6(a.value,e,t,n);else if(a.get!=null)a.get=s6(a.get,e,t,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}o($r,"Memoize");var X0=new Map;function s6(r,e,t=0,n){let i=Symbol("__memoized_map__");return function(...s){let a;this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let f=this[i];if(Array.isArray(n))for(let u of n)X0.has(u)?X0.get(u).push(f):X0.set(u,[f]);if(e||s.length>0||t>0){let u;e===!0?u=s.map(x=>x.toString()).join("!"):e?u=e.apply(this,s):u=s[0];let p=`${u}__timestamp`,b=!1;if(t>0)if(!f.has(p))b=!0;else{let x=f.get(p);b=Date.now()-x>t}f.has(u)&&!b?a=f.get(u):(a=r.apply(this,s),f.set(u,a),t>0&&f.set(p,Date.now()))}else{let u=this;f.has(u)?a=f.get(u):(a=r.apply(this,s),f.set(u,a))}return a}}o(s6,"getNewFunction");Vn();var Z0=at(Vf(),1);Ho();function ci(r){let e=Z0.default.decode(r),t=Z0.default.decode.bytes,n=r.slice(t);return[e,n,t]}o(ci,"readVarint");function XA(r){return r===0||r===1}o(XA,"isCidVersion");function Q0(r){let e=ep(r);if(e instanceof Error)throw e;return e}o(Q0,"readCid");function ep(r){let[e,t]=ci(r);if(!XA(e))return new Error(`Unknown CID version ${e}`);let[n,i]=ci(t),[,s,a]=ci(i),[f,,u]=ci(s),p=i.slice(0,a+u+f),b=i.slice(a+u+f);return[Pe.create(e,n,sf(p)),b]}o(ep,"readCidNoThrow");Vn();Pc();ff();var tp=at(Vf(),1);var Yf=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},hn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)};function ZA(r){let e=np(r);if(e instanceof Error)throw e;return e}o(ZA,"fromBytes");function np(r){let[e,t]=ci(r);if(e!==206)return new Error("fromBytes: invalid streamid, does not include streamid codec");let[n,i]=ci(t),s=ep(i);if(s instanceof Error)return s;let[a,f]=s;return f.length>0?new Error("Invalid StreamID: contains commit"):new Je(n,a)}o(np,"fromBytesNoThrow");function QA(r){let e=f6(r);if(e instanceof Error)throw e;return e}o(QA,"fromString");function f6(r){let e=r.replace("ceramic://","").replace("/ceramic/",""),t=e.includes("commit")?e.split("?")[0]:e,n=Uo.decode(t);return np(n)}o(f6,"fromStringNoThrow");var a6=Symbol.for("@ceramicnetwork/streamid/StreamID"),Je=class{constructor(e,t){if(this._tag=a6,!(e||e===0))throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");this._type=typeof e=="string"?Cr.codeByName(e):e,this._cid=typeof t=="string"?Pe.parse(t):t}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===a6}static fromGenesis(e,t){return Z(this,null,function*(){let n=yield rs({value:t,codec:Ci,hasher:zo});return new Je(e,n.cid)})}get type(){return this._type}get typeName(){return Cr.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let e=tp.default.encode(206),t=tp.default.encode(this.type);return vn([e,t,this.cid.bytes])}get baseID(){return new Je(this._type,this._cid)}equals(e){return Je.isInstance(e)?this.type===e.type&&this.cid.equals(e.cid):!1}toString(){return Uo.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[Symbol.for("nodejs.util.inspect.custom")](){return`StreamID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};o(Je,"StreamID");Je.fromBytes=ZA;Je.fromBytesNoThrow=np;Je.fromString=QA;Je.fromStringNoThrow=f6;Yf([$r(),hn("design:type",String),hn("design:paramtypes",[])],Je.prototype,"typeName",null);Yf([$r(),hn("design:type",Uint8Array),hn("design:paramtypes",[])],Je.prototype,"bytes",null);Yf([$r(),hn("design:type",Je),hn("design:paramtypes",[])],Je.prototype,"baseID",null);Yf([$r(),hn("design:type",Function),hn("design:paramtypes",[]),hn("design:returntype",String)],Je.prototype,"toString",null);Yf([$r(),hn("design:type",Function),hn("design:paramtypes",[]),hn("design:returntype",String)],Je.prototype,"toUrl",null);var Da=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Dr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ip=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ri=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ca,hs,Jf;function eT(r){let e=sp(r);if(e instanceof Error)throw e;return e}o(eT,"fromBytes");function sp(r){let[e,t]=ci(r);if(e!==206)return new Error("fromBytes: invalid streamid, does not include streamid codec");let[n,i]=ci(t),s=Q0(i);if(s instanceof Error)return s;let[a,f]=s;if(f.length===0)return new Error("No commit information provided");if(f.length===1)return new ht(n,a,f[0]);{let[u]=Q0(f);return new ht(n,a,u)}}o(sp,"fromBytesNoThrow");function tT(r){try{return typeof r=="string"?Pe.parse(r):Pe.asCID(r)}catch(e){return}}o(tT,"parseCID");function rT(r,e=null){if(!e)return null;let t=tT(e);if(t)return r.equals(t)?null:t;if(String(e)==="0")return null;throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)")}o(rT,"parseCommit");function nT(r){let e=u6(r);if(e instanceof Error)throw e;return e}o(nT,"fromString");function u6(r){let e=r.replace("ceramic://","").replace("/ceramic/","");if(e.includes("commit")){let t=e.split("?")[1].split("=")[1],n=e.split("?")[0];return l6(Je.fromString(n),t)}else return sp(Uo.decode(e))}o(u6,"fromStringNoThrow");var c6=Symbol.for("@ceramicnetwork/streamid/CommitID");function l6(r,e){return new ht(r.type,r.cid,e)}o(l6,"make");var ht=class{constructor(e,t,n=null){if(this._tag=c6,Ca.set(this,void 0),hs.set(this,void 0),Jf.set(this,void 0),!e&&e!==0)throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");ip(this,Ca,typeof e=="string"?Cr.codeByName(e):e,"f"),ip(this,hs,typeof t=="string"?Pe.parse(t):t,"f"),ip(this,Jf,rT(Ri(this,hs,"f"),n),"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===c6}get baseID(){return new Je(Ri(this,Ca,"f"),Ri(this,hs,"f"))}get type(){return Ri(this,Ca,"f")}get typeName(){return Cr.nameByCode(Ri(this,Ca,"f"))}get cid(){return Ri(this,hs,"f")}get commit(){return Ri(this,Jf,"f")||Ri(this,hs,"f")}get bytes(){var i;let e=op.default.encode(206),t=op.default.encode(this.type),n=((i=Ri(this,Jf,"f"))==null?void 0:i.bytes)||new Uint8Array([0]);return vn([e,t,this.cid.bytes,n])}equals(e){return this.type===e.type&&this.cid.equals(e.cid)&&this.commit.equals(e.commit)}toString(){return Uo.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(Ca=new WeakMap,hs=new WeakMap,Jf=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};o(ht,"CommitID");ht.fromBytes=eT;ht.fromBytesNoThrow=sp;ht.fromString=nT;ht.fromStringNoThrow=u6;ht.make=l6;Da([$r(),Dr("design:type",Je),Dr("design:paramtypes",[])],ht.prototype,"baseID",null);Da([$r(),Dr("design:type",String),Dr("design:paramtypes",[])],ht.prototype,"typeName",null);Da([$r(),Dr("design:type",Pe),Dr("design:paramtypes",[])],ht.prototype,"commit",null);Da([$r(),Dr("design:type",Uint8Array),Dr("design:paramtypes",[])],ht.prototype,"bytes",null);Da([$r(),Dr("design:type",Function),Dr("design:paramtypes",[]),Dr("design:returntype",String)],ht.prototype,"toString",null);Da([$r(),Dr("design:type",Function),Dr("design:paramtypes",[]),Dr("design:returntype",String)],ht.prototype,"toUrl",null);var xr;(function(r){function e(t){if(Je.isInstance(t))return t;if(ht.isInstance(t))return t;if(t instanceof Uint8Array){let n=ht.fromBytesNoThrow(t);return n instanceof Error?Je.fromBytes(t):n}else if(typeof t=="string"){let n=ht.fromStringNoThrow(t);return n instanceof Error?Je.fromString(t):n}else throw new Error("Can not build CommitID or StreamID")}o(e,"from"),r.from=e})(xr||(xr={}));var d6="ceramic://k3y52l7qbv1fry1fp4s0nwdarh0vahusarpposgevy0pemiykymd2ord6swtharcw",il="ceramic://k3y52l7qbv1fryjn62sggjh1lpn11c56qfofzmty190d62hwk1cal1c7qc5he54ow";var ap={};St(ap,{JsonPatchError:()=>Nt,_areEquals:()=>Qf,applyOperation:()=>ps,applyPatch:()=>ll,applyReducer:()=>fT,deepClone:()=>sT,getValueByPointer:()=>cl,validate:()=>p6,validator:()=>ul});var iT=function(){var r=o(function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},r(e,t)},"extendStatics");return function(e,t){r(e,t);function n(){this.constructor=e}o(n,"__"),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),oT=Object.prototype.hasOwnProperty;function sl(r,e){return oT.call(r,e)}o(sl,"hasOwnProperty");function al(r){if(Array.isArray(r)){for(var e=new Array(r.length),t=0;t<e.length;t++)e[t]=""+t;return e}if(Object.keys)return Object.keys(r);var n=[];for(var i in r)sl(r,i)&&n.push(i);return n}o(al,"_objectKeys");function ir(r){switch(typeof r){case"object":return JSON.parse(JSON.stringify(r));case"undefined":return null;default:return r}}o(ir,"_deepClone");function fl(r){for(var e=0,t=r.length,n;e<t;){if(n=r.charCodeAt(e),n>=48&&n<=57){e++;continue}return!1}return!0}o(fl,"isInteger");function ui(r){return r.indexOf("/")===-1&&r.indexOf("~")===-1?r:r.replace(/~/g,"~0").replace(/\//g,"~1")}o(ui,"escapePathComponent");function Xf(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}o(Xf,"unescapePathComponent");function ol(r){if(r===void 0)return!0;if(r){if(Array.isArray(r)){for(var e=0,t=r.length;e<t;e++)if(ol(r[e]))return!0}else if(typeof r=="object"){for(var n=al(r),i=n.length,s=0;s<i;s++)if(ol(r[n[s]]))return!0}}return!1}o(ol,"hasUndefined");function h6(r,e){var t=[r];for(var n in e){var i=typeof e[n]=="object"?JSON.stringify(e[n],null,2):e[n];typeof i!="undefined"&&t.push(n+": "+i)}return t.join(`
789
789
  `)}o(h6,"patchErrorMessageFormatter");var Zf=function(r){iT(e,r);function e(t,n,i,s,a){var f=this.constructor,u=r.call(this,h6(t,{name:n,index:i,operation:s,tree:a}))||this;return u.name=n,u.index=i,u.operation=s,u.tree=a,Object.setPrototypeOf(u,f.prototype),u.message=h6(t,{name:n,index:i,operation:s,tree:a}),u}return o(e,"PatchError"),e}(Error);var Nt=Zf,sT=ir,Ia={add:function(r,e,t){return r[e]=this.value,{newDocument:t}},remove:function(r,e,t){var n=r[e];return delete r[e],{newDocument:t,removed:n}},replace:function(r,e,t){var n=r[e];return r[e]=this.value,{newDocument:t,removed:n}},move:function(r,e,t){var n=cl(t,this.path);n&&(n=ir(n));var i=ps(t,{op:"remove",path:this.from}).removed;return ps(t,{op:"add",path:this.path,value:i}),{newDocument:t,removed:n}},copy:function(r,e,t){var n=cl(t,this.from);return ps(t,{op:"add",path:this.path,value:ir(n)}),{newDocument:t}},test:function(r,e,t){return{newDocument:t,test:Qf(r[e],this.value)}},_get:function(r,e,t){return this.value=r[e],{newDocument:t}}},aT={add:function(r,e,t){return fl(e)?r.splice(e,0,this.value):r[e]=this.value,{newDocument:t,index:e}},remove:function(r,e,t){var n=r.splice(e,1);return{newDocument:t,removed:n[0]}},replace:function(r,e,t){var n=r[e];return r[e]=this.value,{newDocument:t,removed:n}},move:Ia.move,copy:Ia.copy,test:Ia.test,_get:Ia._get};function cl(r,e){if(e=="")return r;var t={op:"_get",path:e};return ps(r,t),t.value}o(cl,"getValueByPointer");function ps(r,e,t,n,i,s){if(t===void 0&&(t=!1),n===void 0&&(n=!0),i===void 0&&(i=!0),s===void 0&&(s=0),t&&(typeof t=="function"?t(e,0,r,e.path):ul(e,0)),e.path===""){var a={newDocument:r};if(e.op==="add")return a.newDocument=e.value,a;if(e.op==="replace")return a.newDocument=e.value,a.removed=r,a;if(e.op==="move"||e.op==="copy")return a.newDocument=cl(r,e.from),e.op==="move"&&(a.removed=r),a;if(e.op==="test"){if(a.test=Qf(r,e.value),a.test===!1)throw new Nt("Test operation failed","TEST_OPERATION_FAILED",s,e,r);return a.newDocument=r,a}else{if(e.op==="remove")return a.removed=r,a.newDocument=null,a;if(e.op==="_get")return e.value=r,a;if(t)throw new Nt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,e,r);return a}}else{n||(r=ir(r));var f=e.path||"",u=f.split("/"),p=r,b=1,x=u.length,A=void 0,O=void 0,T=void 0;for(typeof t=="function"?T=t:T=ul;;){if(O=u[b],O&&O.indexOf("~")!=-1&&(O=Xf(O)),i&&(O=="__proto__"||O=="prototype"&&b>0&&u[b-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(t&&A===void 0&&(p[O]===void 0?A=u.slice(0,b).join("/"):b==x-1&&(A=e.path),A!==void 0&&T(e,0,r,A)),b++,Array.isArray(p)){if(O==="-")O=p.length;else{if(t&&!fl(O))throw new Nt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,e,r);fl(O)&&(O=~~O)}if(b>=x){if(t&&e.op==="add"&&O>p.length)throw new Nt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,e,r);var a=aT[e.op].call(e,p,O,r);if(a.test===!1)throw new Nt("Test operation failed","TEST_OPERATION_FAILED",s,e,r);return a}}else if(b>=x){var a=Ia[e.op].call(e,p,O,r);if(a.test===!1)throw new Nt("Test operation failed","TEST_OPERATION_FAILED",s,e,r);return a}if(p=p[O],t&&b<x&&(!p||typeof p!="object"))throw new Nt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,e,r)}}}o(ps,"applyOperation");function ll(r,e,t,n,i){if(n===void 0&&(n=!0),i===void 0&&(i=!0),t&&!Array.isArray(e))throw new Nt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(r=ir(r));for(var s=new Array(e.length),a=0,f=e.length;a<f;a++)s[a]=ps(r,e[a],t,!0,i,a),r=s[a].newDocument;return s.newDocument=r,s}o(ll,"applyPatch");function fT(r,e,t){var n=ps(r,e);if(n.test===!1)throw new Nt("Test operation failed","TEST_OPERATION_FAILED",t,e,r);return n.newDocument}o(fT,"applyReducer");function ul(r,e,t,n){if(typeof r!="object"||r===null||Array.isArray(r))throw new Nt("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,r,t);if(Ia[r.op]){if(typeof r.path!="string")throw new Nt("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,r,t);if(r.path.indexOf("/")!==0&&r.path.length>0)throw new Nt('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,r,t);if((r.op==="move"||r.op==="copy")&&typeof r.from!="string")throw new Nt("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,r,t);if((r.op==="add"||r.op==="replace"||r.op==="test")&&r.value===void 0)throw new Nt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,r,t);if((r.op==="add"||r.op==="replace"||r.op==="test")&&ol(r.value))throw new Nt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,r,t);if(t){if(r.op=="add"){var i=r.path.split("/").length,s=n.split("/").length;if(i!==s+1&&i!==s)throw new Nt("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,r,t)}else if(r.op==="replace"||r.op==="remove"||r.op==="_get"){if(r.path!==n)throw new Nt("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,r,t)}else if(r.op==="move"||r.op==="copy"){var a={op:"_get",path:r.from,value:void 0},f=p6([a],t);if(f&&f.name==="OPERATION_PATH_UNRESOLVABLE")throw new Nt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,r,t)}}}else throw new Nt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,r,t)}o(ul,"validator");function p6(r,e,t){try{if(!Array.isArray(r))throw new Nt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)ll(ir(e),ir(r),t||!0);else{t=t||ul;for(var n=0;n<r.length;n++)t(r[n],n,e,void 0)}}catch(i){if(i instanceof Nt)return i;throw i}}o(p6,"validate");function Qf(r,e){if(r===e)return!0;if(r&&e&&typeof r=="object"&&typeof e=="object"){var t=Array.isArray(r),n=Array.isArray(e),i,s,a;if(t&&n){if(s=r.length,s!=e.length)return!1;for(i=s;i--!==0;)if(!Qf(r[i],e[i]))return!1;return!0}if(t!=n)return!1;var f=Object.keys(r);if(s=f.length,s!==Object.keys(e).length)return!1;for(i=s;i--!==0;)if(!e.hasOwnProperty(f[i]))return!1;for(i=s;i--!==0;)if(a=f[i],!Qf(r[a],e[a]))return!1;return!0}return r!==r&&e!==e}o(Qf,"_areEquals");var lp={};St(lp,{compare:()=>bT,generate:()=>fp,observe:()=>mT,unobserve:()=>pT});var cp=new WeakMap,cT=function(){function r(e){this.observers=new Map,this.obj=e}return o(r,"Mirror"),r}(),uT=function(){function r(e,t){this.callback=e,this.observer=t}return o(r,"ObserverInfo"),r}();function lT(r){return cp.get(r)}o(lT,"getMirror");function dT(r,e){return r.observers.get(e)}o(dT,"getObserverFromMirror");function hT(r,e){r.observers.delete(e.callback)}o(hT,"removeObserverFromMirror");function pT(r,e){e.unobserve()}o(pT,"unobserve");function mT(r,e){var t=[],n,i=lT(r);if(!i)i=new cT(r),cp.set(r,i);else{var s=dT(i,e);n=s&&s.observer}if(n)return n;if(n={},i.value=ir(r),e){n.callback=e,n.next=null;var a=o(function(){fp(n)},"dirtyCheck"),f=o(function(){clearTimeout(n.next),n.next=setTimeout(a)},"fastCheck");typeof window!="undefined"&&(window.addEventListener("mouseup",f),window.addEventListener("keyup",f),window.addEventListener("mousedown",f),window.addEventListener("keydown",f),window.addEventListener("change",f))}return n.patches=t,n.object=r,n.unobserve=function(){fp(n),clearTimeout(n.next),hT(i,n),typeof window!="undefined"&&(window.removeEventListener("mouseup",f),window.removeEventListener("keyup",f),window.removeEventListener("mousedown",f),window.removeEventListener("keydown",f),window.removeEventListener("change",f))},i.observers.set(e,new uT(e,n)),n}o(mT,"observe");function fp(r,e){e===void 0&&(e=!1);var t=cp.get(r.object);up(t.value,r.object,r.patches,"",e),r.patches.length&&ll(t.value,r.patches);var n=r.patches;return n.length>0&&(r.patches=[],r.callback&&r.callback(n)),n}o(fp,"generate");function up(r,e,t,n,i){if(e!==r){typeof e.toJSON=="function"&&(e=e.toJSON());for(var s=al(e),a=al(r),f=!1,u=!1,p=a.length-1;p>=0;p--){var b=a[p],x=r[b];if(sl(e,b)&&!(e[b]===void 0&&x!==void 0&&Array.isArray(e)===!1)){var A=e[b];typeof x=="object"&&x!=null&&typeof A=="object"&&A!=null&&Array.isArray(x)===Array.isArray(A)?up(x,A,t,n+"/"+ui(b),i):x!==A&&(f=!0,i&&t.push({op:"test",path:n+"/"+ui(b),value:ir(x)}),t.push({op:"replace",path:n+"/"+ui(b),value:ir(A)}))}else Array.isArray(r)===Array.isArray(e)?(i&&t.push({op:"test",path:n+"/"+ui(b),value:ir(x)}),t.push({op:"remove",path:n+"/"+ui(b)}),u=!0):(i&&t.push({op:"test",path:n,value:r}),t.push({op:"replace",path:n,value:e}),f=!0)}if(!(!u&&s.length==a.length))for(var p=0;p<s.length;p++){var b=s[p];!sl(r,b)&&e[b]!==void 0&&t.push({op:"add",path:n+"/"+ui(b),value:ir(e[b])})}}}o(up,"_generate");function bT(r,e,t){t===void 0&&(t=!1);var n=[];return up(r,e,n,"",t),n}o(bT,"compare");var Oa=Object.assign({},ap,lp,{JsonPatchError:Zf,deepClone:ir,escapePathComponent:ui,unescapePathComponent:Xf});var mw=at(nc(),1);var bw=at(ro(),1);var Ct;(function(r){r[r.PREFER_CACHE=0]="PREFER_CACHE",r[r.SYNC_ALWAYS=1]="SYNC_ALWAYS",r[r.NEVER_SYNC=2]="NEVER_SYNC"})(Ct||(Ct={}));var Fp=at(nc(),1);var Sx=at(Ex(),1),{__extends:hr,__assign:$F,__rest:qF,__decorate:HF,__param:zF,__metadata:jF,__awaiter:Mx,__generator:El,__exportStar:KF,__createBinding:VF,__values:vs,__read:qr,__spread:WF,__spreadArrays:GF,__spreadArray:In,__await:Sl,__asyncGenerator:Ax,__asyncDelegator:YF,__asyncValues:Tx,__makeTemplateObject:JF,__importStar:XF,__importDefault:ZF,__classPrivateFieldGet:QF,__classPrivateFieldSet:e$,__classPrivateFieldIn:t$}=Sx.default;function rt(r){return typeof r=="function"}o(rt,"isFunction");function Ua(r){var e=o(function(n){Error.call(n),n.stack=new Error().stack},"_super"),t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}o(Ua,"createErrorClass");var Ml=Ua(function(r){return o(function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
790
790
  `+t.map(function(n,i){return i+1+") "+n.toString()}).join(`
791
- `):"",this.name="UnsubscriptionError",this.errors=t},"UnsubscriptionErrorImpl")});function ys(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}o(ys,"arrRemove");var go=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return o(r,"Subscription"),r.prototype.unsubscribe=function(){var e,t,n,i,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var f=vs(a),u=f.next();!u.done;u=f.next()){var p=u.value;p.remove(this)}}catch(k){e={error:k}}finally{try{u&&!u.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}else a.remove(this);var b=this.initialTeardown;if(rt(b))try{b()}catch(k){s=k instanceof Ml?k.errors:[k]}var x=this._finalizers;if(x){this._finalizers=null;try{for(var A=vs(x),O=A.next();!O.done;O=A.next()){var T=O.value;try{kx(T)}catch(k){s=s!=null?s:[],k instanceof Ml?s=In(In([],qr(s)),qr(k.errors)):s.push(k)}}}catch(k){n={error:k}}finally{try{O&&!O.done&&(i=A.return)&&i.call(A)}finally{if(n)throw n.error}}}if(s)throw new Ml(s)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)kx(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&ys(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&ys(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}();var Tp=go.EMPTY;function Al(r){return r instanceof go||r&&"closed"in r&&rt(r.remove)&&rt(r.add)&&rt(r.unsubscribe)}o(Al,"isSubscription");function kx(r){rt(r)?r():r.unsubscribe()}o(kx,"execFinalizer");var On={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Fa={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=Fa.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,In([r,e],qr(t))):setTimeout.apply(void 0,In([r,e],qr(t)))},clearTimeout:function(r){var e=Fa.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(r)},delegate:void 0};function Tl(r){Fa.setTimeout(function(){var e=On.onUnhandledError;if(e)e(r);else throw r})}o(Tl,"reportUnhandledError");function kp(){}o(kp,"noop");var Cx=function(){return Cp("C",void 0,void 0)}();function Dx(r){return Cp("E",void 0,r)}o(Dx,"errorNotification");function Ix(r){return Cp("N",r,void 0)}o(Ix,"nextNotification");function Cp(r,e,t){return{kind:r,value:e,error:t}}o(Cp,"createNotification");var xs=null;function $a(r){if(On.useDeprecatedSynchronousErrorHandling){var e=!xs;if(e&&(xs={errorThrown:!1,error:null}),r(),e){var t=xs,n=t.errorThrown,i=t.error;if(xs=null,n)throw i}}else r()}o($a,"errorContext");function Ox(r){On.useDeprecatedSynchronousErrorHandling&&xs&&(xs.errorThrown=!0,xs.error=r)}o(Ox,"captureError");var ic=function(r){hr(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Al(t)&&t.add(n)):n.destination=Wk,n}return o(e,"Subscriber"),e.create=function(t,n,i){return new Cl(t,n,i)},e.prototype.next=function(t){this.isStopped?Ip(Ix(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?Ip(Dx(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?Ip(Cx,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(go);var jk=Function.prototype.bind;function Dp(r,e){return jk.call(r,e)}o(Dp,"bind");var Kk=function(){function r(e){this.partialObserver=e}return o(r,"ConsumerObserver"),r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){kl(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){kl(n)}else kl(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){kl(t)}},r}(),Cl=function(r){hr(e,r);function e(t,n,i){var s=r.call(this)||this,a;if(rt(t)||!t)a={next:t!=null?t:void 0,error:n!=null?n:void 0,complete:i!=null?i:void 0};else{var f;s&&On.useDeprecatedNextContext?(f=Object.create(t),f.unsubscribe=function(){return s.unsubscribe()},a={next:t.next&&Dp(t.next,f),error:t.error&&Dp(t.error,f),complete:t.complete&&Dp(t.complete,f)}):a=t}return s.destination=new Kk(a),s}return o(e,"SafeSubscriber"),e}(ic);function kl(r){On.useDeprecatedSynchronousErrorHandling?Ox(r):Tl(r)}o(kl,"handleUnhandledError");function Vk(r){throw r}o(Vk,"defaultErrorHandler");function Ip(r,e){var t=On.onStoppedNotification;t&&Fa.setTimeout(function(){return t(r,e)})}o(Ip,"handleStoppedNotification");var Wk={closed:!0,next:kp,error:Vk,complete:kp};var qa=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Ha(r){return r}o(Ha,"identity");function Px(r){return r.length===0?Ha:r.length===1?r[0]:o(function(t){return r.reduce(function(n,i){return i(n)},t)},"piped")}o(Px,"pipeFromArray");var _t=function(){function r(e){e&&(this._subscribe=e)}return o(r,"Observable"),r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var i=this,s=Yk(e)?e:new Cl(e,t,n);return $a(function(){var a=i,f=a.operator,u=a.source;s.add(f?f.call(s,u):u?i._subscribe(s):i._trySubscribe(s))}),s},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=Nx(t),new t(function(i,s){var a=new Cl({next:function(f){try{e(f)}catch(u){s(u),a.unsubscribe()}},error:s,complete:i});n.subscribe(a)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[qa]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Px(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=Nx(e),new e(function(n,i){var s;t.subscribe(function(a){return s=a},function(a){return i(a)},function(){return n(s)})})},r.create=function(e){return new r(e)},r}();function Nx(r){var e;return(e=r!=null?r:On.Promise)!==null&&e!==void 0?e:Promise}o(Nx,"getPromiseCtor");function Gk(r){return r&&rt(r.next)&&rt(r.error)&&rt(r.complete)}o(Gk,"isObserver");function Yk(r){return r&&r instanceof ic||Gk(r)&&Al(r)}o(Yk,"isSubscriber");function Jk(r){return rt(r==null?void 0:r.lift)}o(Jk,"hasLift");function Yt(r){return function(e){if(Jk(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}o(Yt,"operate");function Jt(r,e,t,n,i){return new Xk(r,e,t,n,i)}o(Jt,"createOperatorSubscriber");var Xk=function(r){hr(e,r);function e(t,n,i,s,a,f){var u=r.call(this,t)||this;return u.onFinalize=a,u.shouldUnsubscribe=f,u._next=n?function(p){try{n(p)}catch(b){t.error(b)}}:r.prototype._next,u._error=s?function(p){try{s(p)}catch(b){t.error(b)}finally{this.unsubscribe()}}:r.prototype._error,u._complete=i?function(){try{i()}catch(p){t.error(p)}finally{this.unsubscribe()}}:r.prototype._complete,u}return o(e,"OperatorSubscriber"),e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(ic);var Rx=Ua(function(r){return o(function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl")});var Op=function(r){hr(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return o(e,"Subject"),e.prototype.lift=function(t){var n=new Lx(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Rx},e.prototype.next=function(t){var n=this;$a(function(){var i,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=vs(n.currentObservers),f=a.next();!f.done;f=a.next()){var u=f.value;u.next(t)}}catch(p){i={error:p}}finally{try{f&&!f.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var n=this;$a(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var i=n.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;$a(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,s=i.hasError,a=i.isStopped,f=i.observers;return s||a?Tp:(this.currentObservers=null,f.push(t),new go(function(){n.currentObservers=null,ys(f,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,s=n.thrownError,a=n.isStopped;i?t.error(s):a&&t.complete()},e.prototype.asObservable=function(){var t=new _t;return t.source=this,t},e.create=function(t,n){return new Lx(t,n)},e}(_t);var Lx=function(r){hr(e,r);function e(t,n){var i=r.call(this)||this;return i.destination=t,i.source=n,i}return o(e,"AnonymousSubject"),e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:Tp},e}(Op);var Pp=function(r){hr(e,r);function e(t){var n=r.call(this)||this;return n._value=t,n}return o(e,"BehaviorSubject"),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=r.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,s=t._value;if(n)throw i;return this._throwIfClosed(),s},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t)},e}(Op);var Np={now:function(){return(Np.delegate||Date).now()},delegate:void 0};var Bx=function(r){hr(e,r);function e(t,n){return r.call(this)||this}return o(e,"Action"),e.prototype.schedule=function(t,n){return n===void 0&&(n=0),this},e}(go);var oc={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=oc.delegate;return i!=null&&i.setInterval?i.setInterval.apply(i,In([r,e],qr(t))):setInterval.apply(void 0,In([r,e],qr(t)))},clearInterval:function(r){var e=oc.delegate;return((e==null?void 0:e.clearInterval)||clearInterval)(r)},delegate:void 0};var Ux=function(r){hr(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.pending=!1,i}return o(e,"AsyncAction"),e.prototype.schedule=function(t,n){if(n===void 0&&(n=0),this.closed)return this;this.state=t;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,n)),this.pending=!0,this.delay=n,this.id=this.id||this.requestAsyncId(s,this.id,n),this},e.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),oc.setInterval(t.flush.bind(t,this),i)},e.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return n;oc.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(t,n);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var i=!1,s;try{this.work(t)}catch(a){i=!0,s=a||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,i=t.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,ys(s,this),n!=null&&(this.id=this.recycleAsyncId(i,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e}(Bx);var Rp=function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return o(r,"Scheduler"),r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=Np.now,r}();var Fx=function(r){hr(e,r);function e(t,n){n===void 0&&(n=Rp.now);var i=r.call(this,t,n)||this;return i.actions=[],i._active=!1,i._scheduled=void 0,i}return o(e,"AsyncScheduler"),e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var i;this._active=!0;do if(i=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,i){for(;t=n.shift();)t.unsubscribe();throw i}},e}(Rp);var Zk=new Fx(Ux),$x=Zk;var Dl=new _t(function(r){return r.complete()});function Il(r){return r&&rt(r.schedule)}o(Il,"isScheduler");function qx(r){return r[r.length-1]}o(qx,"last");function Hx(r){return Il(qx(r))?r.pop():void 0}o(Hx,"popScheduler");function zx(r,e){return typeof qx(r)=="number"?r.pop():e}o(zx,"popNumber");var za=o(function(r){return r&&typeof r.length=="number"&&typeof r!="function"},"isArrayLike");function Ol(r){return rt(r==null?void 0:r.then)}o(Ol,"isPromise");function Pl(r){return rt(r[qa])}o(Pl,"isInteropObservable");function Nl(r){return Symbol.asyncIterator&&rt(r==null?void 0:r[Symbol.asyncIterator])}o(Nl,"isAsyncIterable");function Rl(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}o(Rl,"createInvalidObservableTypeError");function Qk(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}o(Qk,"getSymbolIterator");var Ll=Qk();function Bl(r){return rt(r==null?void 0:r[Ll])}o(Bl,"isIterable");function Ul(r){return Ax(this,arguments,o(function(){var t,n,i,s;return El(this,function(a){switch(a.label){case 0:t=r.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Sl(t.read())];case 3:return n=a.sent(),i=n.value,s=n.done,s?[4,Sl(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Sl(i)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"))}o(Ul,"readableStreamLikeToAsyncGenerator");function Fl(r){return rt(r==null?void 0:r.getReader)}o(Fl,"isReadableStreamLike");function pr(r){if(r instanceof _t)return r;if(r!=null){if(Pl(r))return eC(r);if(za(r))return tC(r);if(Ol(r))return rC(r);if(Nl(r))return jx(r);if(Bl(r))return nC(r);if(Fl(r))return iC(r)}throw Rl(r)}o(pr,"innerFrom");function eC(r){return new _t(function(e){var t=r[qa]();if(rt(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}o(eC,"fromInteropObservable");function tC(r){return new _t(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}o(tC,"fromArrayLike");function rC(r){return new _t(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Tl)})}o(rC,"fromPromise");function nC(r){return new _t(function(e){var t,n;try{for(var i=vs(r),s=i.next();!s.done;s=i.next()){var a=s.value;if(e.next(a),e.closed)return}}catch(f){t={error:f}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}o(nC,"fromIterable");function jx(r){return new _t(function(e){oC(r,e).catch(function(t){return e.error(t)})})}o(jx,"fromAsyncIterable");function iC(r){return jx(Ul(r))}o(iC,"fromReadableStreamLike");function oC(r,e){var t,n,i,s;return Mx(this,void 0,void 0,function(){var a,f;return El(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),t=Tx(r),u.label=1;case 1:return[4,t.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(a=n.value,e.next(a),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return f=u.sent(),i={error:f},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(s=t.return)?[4,s.call(t)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}o(oC,"process");function pn(r,e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var s=e.schedule(function(){t(),i?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(s),!i)return s}o(pn,"executeSchedule");function $l(r,e){return e===void 0&&(e=0),Yt(function(t,n){t.subscribe(Jt(n,function(i){return pn(n,r,function(){return n.next(i)},e)},function(){return pn(n,r,function(){return n.complete()},e)},function(i){return pn(n,r,function(){return n.error(i)},e)}))})}o($l,"observeOn");function ql(r,e){return e===void 0&&(e=0),Yt(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}o(ql,"subscribeOn");function Kx(r,e){return pr(r).pipe(ql(e),$l(e))}o(Kx,"scheduleObservable");function Vx(r,e){return pr(r).pipe(ql(e),$l(e))}o(Vx,"schedulePromise");function Wx(r,e){return new _t(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}o(Wx,"scheduleArray");function Gx(r,e){return new _t(function(t){var n;return pn(t,e,function(){n=r[Ll](),pn(t,e,function(){var i,s,a;try{i=n.next(),s=i.value,a=i.done}catch(f){t.error(f);return}a?t.complete():t.next(s)},0,!0)}),function(){return rt(n==null?void 0:n.return)&&n.return()}})}o(Gx,"scheduleIterable");function Hl(r,e){if(!r)throw new Error("Iterable cannot be null");return new _t(function(t){pn(t,e,function(){var n=r[Symbol.asyncIterator]();pn(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}o(Hl,"scheduleAsyncIterable");function Yx(r,e){return Hl(Ul(r),e)}o(Yx,"scheduleReadableStreamLike");function Jx(r,e){if(r!=null){if(Pl(r))return Kx(r,e);if(za(r))return Wx(r,e);if(Ol(r))return Vx(r,e);if(Nl(r))return Hl(r,e);if(Bl(r))return Gx(r,e);if(Fl(r))return Yx(r,e)}throw Rl(r)}o(Jx,"scheduled");function Xx(r,e){return e?Jx(r,e):pr(r)}o(Xx,"from");var zl=Ua(function(r){return o(function(){r(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl")});function Zx(r){return r instanceof Date&&!isNaN(r)}o(Zx,"isValidDate");function jl(r,e){return Yt(function(t,n){var i=0;t.subscribe(Jt(n,function(s){n.next(r.call(e,s,i++))}))})}o(jl,"map");var sC=Array.isArray;function aC(r,e){return sC(e)?r.apply(void 0,In([],qr(e))):r(e)}o(aC,"callOrApply");function Qx(r){return jl(function(e){return aC(r,e)})}o(Qx,"mapOneOrManyArgs");function ew(r,e,t,n,i,s,a,f){var u=[],p=0,b=0,x=!1,A=o(function(){x&&!u.length&&!p&&e.complete()},"checkComplete"),O=o(function(k){return p<n?T(k):u.push(k)},"outerNext"),T=o(function(k){s&&e.next(k),p++;var $=!1;pr(t(k,b++)).subscribe(Jt(e,function(C){i==null||i(C),s?O(C):e.next(C)},function(){$=!0},void 0,function(){if($)try{p--;for(var C=o(function(){var B=u.shift();a?pn(e,a,function(){return T(B)}):T(B)},"_loop_1");u.length&&p<n;)C();A()}catch(B){e.error(B)}}))},"doInnerSub");return r.subscribe(Jt(e,O,function(){x=!0,A()})),function(){f==null||f()}}o(ew,"mergeInternals");function sc(r,e,t){return t===void 0&&(t=1/0),rt(e)?sc(function(n,i){return jl(function(s,a){return e(n,s,i,a)})(pr(r(n,i)))},t):(typeof e=="number"&&(t=e),Yt(function(n,i){return ew(n,i,r,t)}))}o(sc,"mergeMap");function tw(r){return r===void 0&&(r=1/0),sc(Ha,r)}o(tw,"mergeAll");var fC=["addListener","removeListener"],cC=["addEventListener","removeEventListener"],uC=["on","off"];function ac(r,e,t,n){if(rt(t)&&(n=t,t=void 0),n)return ac(r,e,t).pipe(Qx(n));var i=qr(hC(r)?cC.map(function(f){return function(u){return r[f](e,u,t)}}):lC(r)?fC.map(rw(r,e)):dC(r)?uC.map(rw(r,e)):[],2),s=i[0],a=i[1];if(!s&&za(r))return sc(function(f){return ac(f,e,t)})(pr(r));if(!s)throw new TypeError("Invalid event target");return new _t(function(f){var u=o(function(){for(var p=[],b=0;b<arguments.length;b++)p[b]=arguments[b];return f.next(1<p.length?p:p[0])},"handler");return s(u),function(){return a(u)}})}o(ac,"fromEvent");function rw(r,e){return function(t){return function(n){return r[t](e,n)}}}o(rw,"toCommonHandlerRegistry");function lC(r){return rt(r.addListener)&&rt(r.removeListener)}o(lC,"isNodeStyleEventEmitter");function dC(r){return rt(r.on)&&rt(r.off)}o(dC,"isJQueryStyleEventEmitter");function hC(r){return rt(r.addEventListener)&&rt(r.removeEventListener)}o(hC,"isEventTarget");function fc(r,e,t){r===void 0&&(r=0),t===void 0&&(t=$x);var n=-1;return e!=null&&(Il(e)?t=e:n=e),new _t(function(i){var s=Zx(r)?+r-t.now():r;s<0&&(s=0);var a=0;return t.schedule(function(){i.closed||(i.next(a++),0<=n?this.schedule(void 0,n):i.complete())},s)})}o(fc,"timer");function Lp(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Hx(r),n=zx(r,1/0),i=r;return i.length?i.length===1?pr(i[0]):tw(n)(Xx(i,t)):Dl}o(Lp,"merge");function nw(r,e){return Yt(function(t,n){var i=0;t.subscribe(Jt(n,function(s){return r.call(e,s,i++)&&n.next(s)}))})}o(nw,"filter");function iw(r){return Yt(function(e,t){var n=!1;e.subscribe(Jt(t,function(i){n=!0,t.next(i)},function(){n||t.next(r),t.complete()}))})}o(iw,"defaultIfEmpty");function ow(r){return r<=0?function(){return Dl}:Yt(function(e,t){var n=0;e.subscribe(Jt(t,function(i){++n<=r&&(t.next(i),r<=n&&t.complete())}))})}o(ow,"take");function sw(r){return r===void 0&&(r=pC),Yt(function(e,t){var n=!1;e.subscribe(Jt(t,function(i){n=!0,t.next(i)},function(){return n?t.complete():t.error(r())}))})}o(sw,"throwIfEmpty");function pC(){return new zl}o(pC,"defaultErrorFactory");function Bp(r,e){var t=arguments.length>=2;return function(n){return n.pipe(r?nw(function(i,s){return r(i,s,n)}):Ha,ow(1),t?iw(e):sw(function(){return new zl}))}}o(Bp,"first");var mC={leading:!0,trailing:!1};function Up(r,e){return e===void 0&&(e=mC),Yt(function(t,n){var i=e.leading,s=e.trailing,a=!1,f=null,u=null,p=!1,b=o(function(){u==null||u.unsubscribe(),u=null,s&&(O(),p&&n.complete())},"endThrottling"),x=o(function(){u=null,p&&n.complete()},"cleanupThrottling"),A=o(function(T){return u=pr(r(T)).subscribe(Jt(n,b,x))},"startThrottle"),O=o(function(){if(a){a=!1;var T=f;f=null,n.next(T),!p&&A(T)}},"send");t.subscribe(Jt(n,function(T){a=!0,f=T,!(u&&!u.closed)&&(i?O():A(T))},function(){p=!0,!(s&&a&&u&&!u.closed)&&n.complete()}))})}o(Up,"throttle");var aw;(function(r){r[r.GENESIS=0]="GENESIS",r[r.PARTIAL=1]="PARTIAL",r[r.SIGNED=2]="SIGNED"})(aw||(aw={}));var ws;(function(r){r[r.NOT_REQUESTED=0]="NOT_REQUESTED",r[r.PENDING=1]="PENDING",r[r.PROCESSING=2]="PROCESSING",r[r.ANCHORED=3]="ANCHORED",r[r.FAILED=4]="FAILED"})(ws||(ws={}));var $p;(function(r){r[r.GENESIS=0]="GENESIS",r[r.SIGNED=1]="SIGNED",r[r.ANCHOR=2]="ANCHOR"})($p||($p={}));var Pn=class extends _t{constructor(e,t){super(n=>{e.subscribe(n)}),this.state$=e,this._context=t}get id(){return new Je(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){var n;let{next:e,content:t}=this.state$.value;return(0,Fp.default)((n=e==null?void 0:e.content)!=null?n:t)}get controllers(){return this.metadata.controllers}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return ht.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>ht.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===$p.ANCHOR).map(({cid:e})=>ht.make(this.id,e))}get state(){return(0,Fp.default)(this.state$.value)}sync(){return Z(this,arguments,function*(e={}){e=re({sync:Ct.PREFER_CACHE},e);let t=yield this.api.loadStream(this.id,e);this.state$.next(t.state)})}requestAnchor(){return Z(this,null,function*(){return this.api.requestAnchor(this.id)})}};o(Pn,"Stream");function vo(){return r=>{}}o(vo,"StreamStatic");var uw=at(require("cross-fetch"),1);function fw(r){let e=new AbortController;if(r.length===0)throw Error("Need abort signals to create a merged abort signal");return r.some(t=>t.aborted)?(e.abort(),e.signal):(Lp(...r.map(t=>ac(t,"abort"))).pipe(Bp()).subscribe(()=>{e.abort()}),e.signal)}o(fw,"mergeAbortSignals");var cc=class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=fc(e).subscribe(()=>{t.abort()})}clear(){var e;(e=this._subscription)==null||e.unsubscribe()}};o(cc,"TimedAbortSignal");function cw(r,e){return Z(this,null,function*(){let t=new AbortController,n=o(()=>{t.abort()},"onAbort");return r.addEventListener("abort",n),r.aborted&&t.abort(),e(t.signal).finally(()=>{r.removeEventListener("abort",n)})})}o(cw,"abortable");var bC=60*1e3*3;function wr(t){return Z(this,arguments,function*(r,e={}){e.body&&Object.assign(e,{body:JSON.stringify(e.body),headers:{"Content-Type":"application/json"}});let n=e.timeout||bC,i=new cc(n),s=e.signal?fw([e.signal,i.signal]):i.signal,a=yield cw(s,f=>(0,uw.default)(String(r),Te(re({},e),{signal:f}))).finally(()=>i.clear());if(!a.ok){let f=yield a.text();throw new Error(`HTTP request to '${r}' failed with status '${a.statusText}': ${f}`)}return a.json()})}o(wr,"fetchJson");var uc=at(nc(),1);Vn();function Ui(r){let e=Pe.asCID(r);if(e)return e;if(typeof r=="string")return Pe.parse(r);if(r instanceof Uint8Array)return Pe.decode(r);throw new Error(`${r} cannot be converted to a CID`)}o(Ui,"toCID");var lw=0,yt=class{static streamIdFromState(e){return new Je(e.type,e.log[0].cid)}static serializeCommit(e){var n;let t=(0,uc.default)(e);return yt.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=It(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=It(t.cacaoBlock,"base64")),t):(yt.isSignedCommit(e)&&(t.link=t.link.toString()),yt.isAnchorCommit(e)&&(t.proof=t.proof.toString()),t.id&&(t.id=t.id.toString()),t.prev&&(t.prev=t.prev.toString()),(n=e.header)!=null&&n.model&&(t.header.model=e.header.model.toString()),t)}static deserializeCommit(e){var n;let t=(0,uc.default)(e);return yt.isSignedCommitContainer(t)?(t.jws.link=Ui(t.jws.link),t.linkedBlock=Lt(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Lt(t.cacaoBlock,"base64")),t):(yt.isSignedCommit(t)&&(t.link=Ui(t.link)),yt.isAnchorCommit(t)&&(t.proof=Ui(t.proof)),t.id&&(t.id=Ui(t.id)),t.prev&&(t.prev=Ui(t.prev)),(n=t.header)!=null&&n.model&&(t.header.model=Je.fromString(t.header.model)),t)}static serializeState(e){var n,i,s,a;let t=(0,uc.default)(e);return t.log=t.log.map(f=>Te(re({},f),{cid:f.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=ws[t.anchorStatus]),t.anchorScheduledFor!=null&&(t.anchorScheduledFor=new Date(t.anchorScheduledFor).toISOString()),t.anchorProof!=null&&(t.anchorProof.txHash=t.anchorProof.txHash.toString(),t.anchorProof.root=t.anchorProof.root.toString()),(n=e.metadata)!=null&&n.model&&(t.metadata.model=e.metadata.model.toString()),(s=(i=e.next)==null?void 0:i.metadata)!=null&&s.model&&(t.next.metadata.model=e.next.metadata.model.toString()),((a=e.metadata)==null?void 0:a.unique)&&e.type!=lw&&(t.metadata.unique=It(t.metadata.unique,"base64")),t.doctype=Cr.nameByCode(t.type),t}static deserializeState(e){var i,s,a,f;let t=(0,uc.default)(e);t.doctype&&(t.type=Cr.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(u=>Te(re({},u),{cid:Ui(u.cid)})),t.anchorProof&&(t.anchorProof.txHash=Ui(t.anchorProof.txHash),t.anchorProof.root=Ui(t.anchorProof.root));let n=!0;return t.anchorStatus&&(t.anchorStatus=ws[t.anchorStatus],n=t.anchorStatus!==ws.FAILED&&t.anchorStatus!==ws.ANCHORED),t.anchorScheduledFor&&(n?t.anchorScheduledFor=Date.parse(t.anchorScheduledFor):delete t.anchorScheduledFor),(i=e.metadata)!=null&&i.model&&(t.metadata.model=Je.fromString(e.metadata.model)),(a=(s=e.next)==null?void 0:s.metadata)!=null&&a.model&&(t.next.metadata.model=Je.fromString(e.next.metadata.model)),((f=e.metadata)==null?void 0:f.unique)&&e.type!=lw&&(t.metadata.unique=Lt(e.metadata.unique,"base64")),t}static statesEqual(e,t){return JSON.stringify(yt.serializeState(e))===JSON.stringify(yt.serializeState(t))}static isStateSupersetOf(e,t){if(e.log.length<t.log.length)return!1;for(let n in t.log)if(!e.log[n].cid.equals(t.log[n].cid))return!1;return e.anchorStatus==t.anchorStatus}static assertCommitLinksToState(e,t){let n=this.streamIdFromState(e);if(t.id&&!t.id.equals(e.log[0].cid))throw new Error(`Invalid genesis CID in commit for StreamID ${n.toString()}. Found: ${t.id}, expected ${e.log[0].cid}`);let i=e.log[e.log.length-1].cid;if(!t.prev.equals(i))throw new Error(`Commit doesn't properly point to previous commit in log. Expected ${i}, found 'prev' ${t.prev}`)}static convertCommitToSignedCommitContainer(e,t){return Z(this,null,function*(){if(yt.isSignedCommit(e)){let n=yield t.block.get(e.link);return{jws:e,linkedBlock:n}}return e})}static isSignedCommitContainer(e){return e&&e.jws!==void 0}static isSignedCommit(e){return e&&e.link!==void 0}static isAnchorCommit(e){return e&&e.proof!==void 0}static isSignedCommitData(e){return e&&e.envelope!==void 0}static isAnchorCommitData(e){return e&&e.proof!==void 0}};o(yt,"StreamUtils");function dw(r){if(typeof r=="string"&&r.includes("@")){let[e,t]=r.split("@");if(!e||!t)throw new Error("Invalid accountId provided");return new fs({address:e,chainId:t})}return new fs(r)}o(dw,"normalizeAccountId");var lc=class extends Pp{next(e){let t=this.value;yt.statesEqual(t,e)||super.next(e)}};o(lc,"StreamStateSubject");var gC=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Hr,qp={anchor:!0,publish:!0,pin:!0,sync:Ct.PREFER_CACHE},vC={sync:Ct.PREFER_CACHE},hw={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function Hp(r,e){var n;if(typeof(r==null?void 0:r.schema)=="string")try{ht.fromString(r.schema)}catch(i){throw new Error("Schema must be a CommitID")}let t={controllers:r==null?void 0:r.controllers,family:r==null?void 0:r.family,schema:(n=r==null?void 0:r.schema)==null?void 0:n.toString(),tags:r==null?void 0:r.tags};if(e)r!=null&&r.deterministic||(t.unique=It((0,bw.randomBytes)(12),"base64")),r!=null&&r.forbidControllerChange&&(t.forbidControllerChange=!0);else{if((r==null?void 0:r.deterministic)!==void 0||(r==null?void 0:r.unique)!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if((r==null?void 0:r.forbidControllerChange)!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(t).forEach(i=>t[i]===void 0&&delete t[i]),t}o(Hp,"headerFromMetadata");function pw(r){return Z(this,null,function*(){if(r.did==null)throw new Error("No DID provided");r.did.authenticated||(yield r.did.authenticate(),r.loggerProvider&&r.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${r.did.id}`))})}o(pw,"_ensureAuthenticated");function zp(){return Z(this,null,function*(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")})}o(zp,"throwReadOnlyError");var zr=Hr=o(class extends Pn{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){var n;let{next:e,metadata:t}=this.state$.value;return(0,mw.default)((n=e==null?void 0:e.metadata)!=null?n:t)}static create(s,a,f){return Z(this,arguments,function*(e,t,n,i={}){i=re(re({},qp),i),!(n!=null&&n.deterministic)&&i.syncTimeoutSeconds==null&&(i.syncTimeoutSeconds=0);let u=i.asDID?{did:i.asDID}:e,p=yield Hr.makeGenesis(u,t,n);return e.createStreamFromGenesis(Hr.STREAM_TYPE_ID,p,i)})}static createFromGenesis(i,s){return Z(this,arguments,function*(e,t,n={}){var f;n=re(re({},qp),n),((f=t.header)==null?void 0:f.unique)&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=t.data?yield Hr._signDagJWS(e,t):t;return e.createStreamFromGenesis(Hr.STREAM_TYPE_ID,a,n)})}static deterministic(i,s){return Z(this,arguments,function*(e,t,n={}){if(n=re(re({},qp),n),t=Te(re({},t),{deterministic:!0}),t.family==null&&t.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=yield Hr.makeGenesis(e,null,t);return e.createStreamFromGenesis(Hr.STREAM_TYPE_ID,a,n)})}static load(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},vC),n);let a=xr.from(t);if(a.type!=Hr.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${Hr.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}update(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},hw),n);let a=n.asDID?{did:n.asDID}:this.api,f=yield this.makeCommit(a,e,t),u=yield this.api.applyCommit(this.id,f,n);this.state$.next(u.state)})}patch(n){return Z(this,arguments,function*(e,t={}){t=re(re({},hw),t);let s={header:Hp(this.metadata,!1),data:e,prev:this.tip,id:this.id.cid},a=yield Hr._signDagJWS(this.api,s),f=yield this.api.applyCommit(this.id,a,t);this.state$.next(f.state)})}makeReadOnly(){this.update=zp,this.patch=zp,this.sync=zp,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}makeCommit(e,t,n){return Z(this,null,function*(){let i=yield this._makeRawCommit(e,t,n);return Hr._signDagJWS(e,i)})}_makeRawCommit(e,t,n){return Z(this,null,function*(){let i=Hp(n,!1);if(t==null&&(t=this.content),i.controllers){if(i.controllers.length!==1)throw new Error("Exactly one controller must be specified");if(!i.controllers[0])throw new Error("Controller cannot be updated to an undefined value.")}let s=Oa.compare(this.content,t);return{header:i,data:s,prev:this.tip,id:this.state.log[0].cid}})}static makeGenesis(e,t,n){return Z(this,null,function*(){var a;if(n||(n={}),!n.controllers||n.controllers.length===0)if(e.did)yield pw(e),n.controllers=[e.did.hasParent?e.did.parent:e.did.id];else throw new Error("No controllers specified");if(((a=n.controllers)==null?void 0:a.length)!==1)throw new Error("Exactly one controller must be specified");let i=Hp(n,!0);if((n==null?void 0:n.deterministic)&&t)throw new Error("Initial content must be null when creating a deterministic Tile document");if(t==null){let f={header:i};return If(f),f}let s={data:t,header:i};return Hr._signDagJWS(e,s)})}static _signDagJWS(e,t){return Z(this,null,function*(){return yield pw(e),e.did.createDagJWS(t)})}},"TileDocument");zr.STREAM_TYPE_NAME="tile";zr.STREAM_TYPE_ID=0;zr=Hr=gC([vo()],zr);var Sw=at(xw(),1);function TC(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(TC,"_checkPrivateRedeclaration");function kC(r,e){return e.get?e.get.call(r):e.value}o(kC,"_classApplyDescriptorGet");function CC(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(CC,"_classApplyDescriptorSet");function Ew(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(Ew,"_classExtractFieldDescriptor");function Vp(r,e){var t=Ew(r,e,"get");return kC(r,t)}o(Vp,"_classPrivateFieldGet");function ww(r,e,t){TC(r,e),e.set(r,t)}o(ww,"_classPrivateFieldInit");function _w(r,e,t){var n=Ew(r,e,"set");return CC(r,n,t),t}o(_w,"_classPrivateFieldSet");function DC(r){return typeof r=="string"||ht.isInstance(r)||Je.isInstance(r)?{streamId:r}:{streamId:r.streamId,genesis:r.genesis}}o(DC,"keyToQuery");function Wp(r){return typeof r=="string"?xr.from(r).toString():ht.isInstance(r)||Je.isInstance(r)?r.toString():r.streamId.toString()}o(Wp,"keyToString");function Yp(r){return Z(this,null,function*(){let e=yield zr.makeGenesis({},null,Te(re({},r),{deterministic:!0})),t=yield Je.fromGenesis("tile",e);return{genesis:e,streamId:t}})}o(Yp,"getDeterministicQuery");var IC=o(()=>Promise.resolve([]),"tempBatchLoadFn"),Kl=new WeakMap,Gp=new WeakMap,mn=class extends Sw.default{cache(e){if(!Vp(this,Gp))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}create(e,t,n){return Z(this,null,function*(){let i=yield zr.create(Vp(this,Kl),e,t,n);return this.cache(i),i})}deterministic(e,t){return Z(this,null,function*(){let n=yield Yp(e);try{return yield md(mn.prototype,this,"load").call(this,n)}catch(i){let s=yield zr.createFromGenesis(Vp(this,Kl),n.genesis,t);return this.cache(s),s}})}load(e){return Z(this,null,function*(){return yield md(mn.prototype,this,"load").call(this,e)})}update(e,t,n,i){return Z(this,null,function*(){let s=Wp(e);this.clear(s);let a=yield this.load({streamId:s});return yield a.update(t,n,i),a})}constructor(e){super(IC,{cache:!0,cacheKeyFn:Wp,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),ww(this,Kl,{writable:!0,value:void 0}),ww(this,Gp,{writable:!0,value:void 0}),this._batchLoadFn=t=>Z(this,null,function*(){e.cache||this.clearAll();let n=yield e.ceramic.multiQuery(t.map(DC),e.multiqueryTimeout);return t.map(i=>{let s=Wp(i),a=n[s];return a||new Error(`Failed to load stream: ${s}`)})}),_w(this,Kl,e.ceramic),_w(this,Gp,!!e.cache)}};o(mn,"TileLoader");function OC(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(OC,"_checkPrivateRedeclaration");function PC(r,e){return e.get?e.get.call(r):e.value}o(PC,"_classApplyDescriptorGet");function NC(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(NC,"_classApplyDescriptorSet");function Aw(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(Aw,"_classExtractFieldDescriptor");function _s(r,e){var t=Aw(r,e,"get");return PC(r,t)}o(_s,"_classPrivateFieldGet");function Mw(r,e,t){OC(r,e),e.set(r,t)}o(Mw,"_classPrivateFieldInit");function Jp(r,e,t){var n=Aw(r,e,"set");return NC(r,n,t),t}o(Jp,"_classPrivateFieldSet");var ja=new WeakMap,Ka=new WeakMap,Va=class{get aliases(){return _s(this,ja)}get loader(){return _s(this,Ka)}getDefinitionID(e){var t;return(t=_s(this,ja).definitions[e])!=null?t:null}getSchemaURL(e){var t;return(t=_s(this,ja).schemas[e])!=null?t:null}getTileID(e){var t;return(t=_s(this,ja).tiles[e])!=null?t:null}loadTile(e){return Z(this,null,function*(){let t=this.getTileID(e);if(t==null)throw new Error(`Tile alias "${e}" is not defined`);return yield _s(this,Ka).load(t)})}createTile(i,s){return Z(this,arguments,function*(e,t,n={}){let a=this.getSchemaURL(e);if(a==null)throw new Error(`Schema alias "${e}" is not defined`);let b=n,{controller:f}=b,u=Cm(b,["controller"]),p={schema:a};return f!=null&&(p.controllers=[f]),yield _s(this,Ka).create(t,p,u)})}constructor(e){if(Mw(this,ja,{writable:!0,value:void 0}),Mw(this,Ka,{writable:!0,value:void 0}),Jp(this,ja,e.aliases),e.loader!=null)Jp(this,Ka,e.loader);else{if(e.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");Jp(this,Ka,new mn({ceramic:e.ceramic,cache:e.cache}))}}};o(Va,"DataModel");function RC(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(RC,"_checkPrivateRedeclaration");function LC(r,e){return e.get?e.get.call(r):e.value}o(LC,"_classApplyDescriptorGet");function BC(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(BC,"_classApplyDescriptorSet");function Tw(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(Tw,"_classExtractFieldDescriptor");function li(r,e){var t=Tw(r,e,"get");return LC(r,t)}o(li,"_classPrivateFieldGet");function Vl(r,e,t){RC(r,e),e.set(r,t)}o(Vl,"_classPrivateFieldInit");function Wl(r,e,t){var n=Tw(r,e,"set");return BC(r,n,t),t}o(Wl,"_classPrivateFieldSet");var Gl=new WeakMap,Es=new WeakMap,Xp=new WeakMap,Yl=new WeakMap,dc=class{_createValuePromise(){Wl(this,Xp,new Promise((e,t)=>{Wl(this,Yl,{resolve:e,reject:t})}))}change(e){return new Promise((t,n)=>{let i=o(s=>Z(this,null,function*(){try{let a=yield e(s);t(),this._next(a)}catch(a){n(a),this._next(s)}}),"run");li(this,Es).push({reject:n,run:i}),li(this,Es).length===1&&this._start()})}changeContent(e){return Z(this,null,function*(){let t=o(n=>Z(this,null,function*(){return yield n.update(e(n.content),n.metadata),n}),"mutation");return yield this.change(t)})}get(){return Z(this,null,function*(){return li(this,Es).length===0?yield li(this,Gl).call(this):yield li(this,Xp)})}_start(){return Z(this,null,function*(){try{let e=yield li(this,Gl).call(this);this._next(e)}catch(e){li(this,Es).forEach(t=>{t.reject(e)}),Wl(this,Es,[]),li(this,Yl).reject(e),this._createValuePromise()}})}_next(e){let t=li(this,Es).shift();t==null?this._end(e):t.run(e)}_end(e){li(this,Yl).resolve(e),this._createValuePromise()}constructor(e){Vl(this,Gl,{writable:!0,value:void 0}),Vl(this,Es,{writable:!0,value:[]}),Vl(this,Xp,{writable:!0,value:void 0}),Vl(this,Yl,{writable:!0,value:void 0}),Wl(this,Gl,e),this._createValuePromise()}};o(dc,"TileProxy");var UC=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function FC(r){return UC.test(r)}o(FC,"isDIDstring");function $C(r){if(!FC(r))throw new Error(`Invalid DID: ${r}`)}o($C,"assertDIDstring");function Zp(r){return $C(r),{controllers:[r],family:"IDX"}}o(Zp,"getIDXMetadata");function qC(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(qC,"_checkPrivateRedeclaration");function HC(r,e){return e.get?e.get.call(r):e.value}o(HC,"_classApplyDescriptorGet");function zC(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(zC,"_classApplyDescriptorSet");function kw(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(kw,"_classExtractFieldDescriptor");function Ut(r,e){var t=kw(r,e,"get");return HC(r,t)}o(Ut,"_classPrivateFieldGet");function hc(r,e,t){qC(r,e),e.set(r,t)}o(hc,"_classPrivateFieldInit");function Jl(r,e,t){var n=kw(r,e,"set");return zC(r,n,t),t}o(Jl,"_classPrivateFieldSet");var Fi=new WeakMap,Xl=new WeakMap,Qp=new WeakMap,di=new WeakMap,Zl=new WeakMap,pc=class{get authenticated(){return Ut(this,Fi).did!=null}get ceramic(){return Ut(this,Fi)}get id(){if(Ut(this,Xl)!=null)return Ut(this,Xl);if(Ut(this,Fi).did==null)throw new Error("Ceramic instance is not authenticated");return Ut(this,Fi).did.hasParent?Ut(this,Fi).did.parent:Ut(this,Fi).did.id}get loader(){return Ut(this,di)}get model(){return Ut(this,Zl)}has(e,t){return Z(this,null,function*(){let n=this.getDefinitionID(e);return(yield this.getRecordID(n,t))!=null})}get(e,t){return Z(this,null,function*(){let n=this.getDefinitionID(e);return yield this.getRecord(n,t)})}getMultiple(e,t){return Z(this,null,function*(){var f,u,p;let n=this.getDefinitionID(e),i=yield Promise.all(t.map(b=>Z(this,null,function*(){let{genesis:x,streamId:A}=yield Yp(Zp(b));return{genesis:x,streamId:A.toString(),paths:[n]}}))),s=yield Ut(this,Fi).multiQuery(i),a=[];for(let b of i){let x=(u=(f=s[b.streamId])==null?void 0:f.content)==null?void 0:u[n],A=x?s[Je.fromString(x).toString()]:null;a.push((p=A==null?void 0:A.content)!=null?p:null)}return a})}set(i,s){return Z(this,arguments,function*(e,t,n={}){var p;let a=this.getDefinitionID(e),[f,u]=yield this._setRecordOnly(a,t,n);return f&&(yield this._setReference((p=n.controller)!=null?p:this.id,a,u)),u})}merge(i,s){return Z(this,arguments,function*(e,t,n={}){let a=this.getDefinitionID(e),f=yield this.getRecord(a),u=f?re(re({},f),t):t;return yield this.setRecord(a,u,n)})}setAll(n){return Z(this,arguments,function*(e,t={}){var f;let i=Object.entries(e).map(b=>Z(this,[b],function*([u,p]){let x=this.getDefinitionID(u),[A,O]=yield this._setRecordOnly(x,p,t);return[A,x,O]})),a=(yield Promise.all(i)).reduce((u,[p,b,x])=>(p&&(u[b]=x.toUrl()),u),{});return yield this._setReferences((f=t.controller)!=null?f:this.id,a),a})}setDefaults(n){return Z(this,arguments,function*(e,t={}){var u,p;let i=(u=yield this.getIndex())!=null?u:{},s=Object.entries(e).map(([b,x])=>[this.getDefinitionID(b),x]).filter(b=>i[b[0]]==null).map(A=>Z(this,[A],function*([b,x]){let O=yield this.getDefinition(b),T=yield this._createRecord(O,x,t);return{[b]:T.toUrl()}})),f=(yield Promise.all(s)).reduce((b,x)=>Object.assign(b,x),{});return yield this._setReferences((p=t.controller)!=null?p:this.id,f),f})}remove(n){return Z(this,arguments,function*(e,t=this.id){yield this._getIndexProxy(t).changeContent(i=>(i!=null&&delete i[this.getDefinitionID(e)],i))})}getIndex(){return Z(this,arguments,function*(e=this.id){let t=this.authenticated&&e===this.id?yield this._getIndexProxy(e).get():yield this._getIDXDoc(e);return t?t.content:null})}iterator(e){let t,n=0;return{[Symbol.asyncIterator](){return this},next:()=>Z(this,null,function*(){if(t==null){let f=yield this.getIndex(e);t=Object.entries(f!=null?f:{})}if(n===t.length)return{done:!0,value:null};let[i,s]=t[n++],a=yield Ut(this,di).load(s);return{done:!1,value:{key:i,id:s,record:a.content}}})}}_createIDXDoc(e){return Z(this,null,function*(){return yield Ut(this,di).deterministic(Zp(e))})}_getIDXDoc(e){return Z(this,null,function*(){let t=yield this._createIDXDoc(e);if(t.content==null||t.metadata.schema==null)return null;if(t.metadata.schema!==il)throw new Error("Invalid document: schema is not IdentityIndex");return t})}_getOwnIDXDoc(e){return Z(this,null,function*(){let t=yield this._createIDXDoc(e);if(t.content==null||t.metadata.schema==null)yield t.update({},{schema:il});else if(t.metadata.schema!==il)throw new Error("Invalid document: schema is not IdentityIndex");return t})}_getIndexProxy(e){let t=Ut(this,Qp)[e];return t==null&&(t=new dc(()=>Z(this,null,function*(){return yield this._getOwnIDXDoc(e)})),Ut(this,Qp)[e]=t),t}getDefinitionID(e){var t;return(t=Ut(this,Zl).getDefinitionID(e))!=null?t:e}getDefinition(e){return Z(this,null,function*(){let t=yield Ut(this,di).load(e);if(t.metadata.schema!==d6)throw new Error("Invalid document: schema is not Definition");return Te(re({},t.content),{id:t.id})})}getRecordID(e,t){return Z(this,null,function*(){var i;let n=yield this.getIndex(t!=null?t:this.id);return(i=n==null?void 0:n[e])!=null?i:null})}getRecordDocument(e,t){return Z(this,null,function*(){let n=yield this.getRecordID(e,t);return n?yield Ut(this,di).load(n):null})}getRecord(e,t){return Z(this,null,function*(){let n=yield this.getRecordDocument(e,t);return n?n.content:null})}setRecord(i,s){return Z(this,arguments,function*(e,t,n={}){var u;let[a,f]=yield this._setRecordOnly(e,t,n);return a&&(yield this._setReference((u=n.controller)!=null?u:this.id,e,f)),f})}_setRecordOnly(e,t,n){return Z(this,null,function*(){var s;let i=yield this.getRecordID(e,(s=n.controller)!=null?s:this.id);if(i==null){let a=yield this.getDefinition(e),f=yield this._createRecord(a,t,n);return[!0,f]}else{let a=yield Ut(this,di).update(i,t);return[!1,a.id]}})}_createRecord(s,a,f){return Z(this,arguments,function*(e,t,{controller:n,pin:i}){let u=yield Ut(this,di).deterministic({controllers:[n!=null?n:this.id],family:e.id.toString()},{pin:i});return yield u.update(t,{schema:e.schema}),u.id})}_setReference(e,t,n){return Z(this,null,function*(){yield this._getIndexProxy(e).changeContent(i=>Te(re({},i),{[t]:n.toUrl()}))})}_setReferences(e,t){return Z(this,null,function*(){Object.keys(t).length!==0&&(yield this._getIndexProxy(e).changeContent(n=>re(re({},n),t)))})}constructor(e){hc(this,Fi,{writable:!0,value:void 0}),hc(this,Xl,{writable:!0,value:void 0}),hc(this,Qp,{writable:!0,value:{}}),hc(this,di,{writable:!0,value:void 0}),hc(this,Zl,{writable:!0,value:void 0});let{cache:t,ceramic:n,id:i,loader:s,model:a}=e;Jl(this,Fi,n),Jl(this,Xl,i),Jl(this,di,s!=null?s:new mn({ceramic:n,cache:t})),Jl(this,Zl,a instanceof Va?a:new Va({loader:Ut(this,di),aliases:a}))}};o(pc,"DIDDataStore");function em(r){return typeof r=="string"?Je.fromString(r):r}o(em,"typeStreamID");var mr=class extends _t{constructor(e,t,n){super(i=>{this.state$.observers.length===0&&(this.periodicSubscription=fc(0,n).pipe(Up(()=>this._syncState(this.id,{sync:Ct.PREFER_CACHE}))).subscribe()),this.state$.subscribe(i).add(()=>{var f;this.state$.observers.length===0&&((f=this.periodicSubscription)==null||f.unsubscribe())})}),this.state$=new lc(e),this._apiUrl=new URL(t)}get value(){return this.state$.value}get state(){return this.state$.value}next(e){this.state$.next(e)}_syncState(e,t){return Z(this,null,function*(){let n=yield mr._load(e,this._apiUrl,t);this.state$.next(yt.deserializeState(n))})}get id(){return new Je(this.state$.value.type,this.state$.value.log[0].cid)}static createFromGenesis(e,t,n,i,s){return Z(this,null,function*(){let a=new URL("./streams",e),{state:f}=yield wr(a,{method:"post",body:{type:t,genesis:yt.serializeCommit(n),opts:i}});return new mr(yt.deserializeState(f),e,s)})}static applyCommit(e,t,n,i,s){return Z(this,null,function*(){let a=new URL("./commits",e),{state:f}=yield wr(a,{method:"post",body:{streamId:t.toString(),commit:yt.serializeCommit(n),opts:i}});return new mr(yt.deserializeState(f),e,s)})}static _load(e,t,n){return Z(this,null,function*(){let i=new URL(`./streams/${e}`,t);for(let a in n)i.searchParams.set(a,n[a]);let{state:s}=yield wr(i);return s})}static load(e,t,n,i){return Z(this,null,function*(){let s=yield mr._load(e,t,i);return new mr(yt.deserializeState(s),t,n)})}static loadStreamCommits(e,t){return Z(this,null,function*(){let n=new URL(`./commits/${e}`,t),{commits:i}=yield wr(n);return i.map(s=>({cid:s.cid,value:yt.deserializeCommit(s.value)}))})}complete(){this.state$.complete()}};o(mr,"Document");var Dw=at(nc(),1),jC=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Ss,tm=o(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),Cw={anchor:!1,publish:!0,pin:!0,sync:Ct.PREFER_CACHE},rm={anchor:!0,publish:!0,throwOnInvalidCommit:!0},KC={sync:Ct.PREFER_CACHE},Ms=Ss=o(class extends Pn{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){var n;let{next:e,metadata:t}=this.state$.value;return(0,Dw.default)((n=e==null?void 0:e.metadata)!=null?n:t)}static fromAccount(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},Cw),n);let a=dw(t),f=Ss.makeGenesis(a);return Ss.fromGenesis(e,f,n)})}static fromGenesis(i,s){return Z(this,arguments,function*(e,t,n={}){return n=re(re({},Cw),n),e.createStreamFromGenesis(Ss.STREAM_TYPE_ID,t,n)})}setDid(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},rm),n);let a=typeof e=="string"?e.trim():e.id,f=bd(a);if((f==null?void 0:f.did)!==a)throw new Error(`DID is not valid: '${a}'`);let u=yield t.createLink(a);return this.setDidProof(u,n)})}setDidProof(n){return Z(this,arguments,function*(e,t={}){t=re(re({},rm),t);let i=this.makeCommit(e),s=yield this.api.applyCommit(this.id,i,t);this.state$.next(s.state)})}clearDid(n){return Z(this,arguments,function*(e,t={}){t=re(re({},rm),t);let i=yield e.createLink("");return this.setDidProof(i,t)})}static load(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},KC),n);let a=xr.from(t);if(a.type!=Ss.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${Ss.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}static makeGenesis(e){return e.chainId.namespace==="eip155"&&(e.address=e.address.toLowerCase()),{header:{controllers:[`${e.address}@${e.chainId.toString()}`],family:`caip10-${e.chainId.toString()}`}}}makeCommit(e){return{data:e,prev:this.tip,id:this.id.cid}}makeReadOnly(){this.setDidProof=tm,this.setDid=tm,this.sync=tm,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link");Ms.STREAM_TYPE_NAME="caip10-link";Ms.STREAM_TYPE_ID=1;Ms=Ss=jC([vo()],Ms);var e4=at(ro(),1);Vn();Ho();var t4=at(Jw(),1),pD=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},br,mD={sync:Ct.PREFER_CACHE};function Xw(r){return Z(this,null,function*(){if(r.did==null)throw new Error("No DID provided");r.did.authenticated||(yield r.did.authenticate(),r.loggerProvider&&r.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${r.did.id}`))})}o(Xw,"_ensureAuthenticated");function Zw(){return Z(this,null,function*(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")})}o(Zw,"throwReadOnlyError");var Qw;(function(r){r.LIST="list",r.SINGLE="single"})(Qw||(Qw={}));var yo=br=o(class extends Pn{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:br.MODEL}}static create(e,t,n){return Z(this,null,function*(){br.assertComplete(t);let i={publish:!0,anchor:!0,pin:!0,sync:Ct.NEVER_SYNC,throwOnInvalidCommit:!0},s=yield br._makeGenesis(e,t,n);return yield e.createStreamFromGenesis(br.STREAM_TYPE_ID,s,i)})}static createPlaceholder(e,t,n){return Z(this,null,function*(){let i={publish:!1,anchor:!1,pin:!1,sync:Ct.NEVER_SYNC,throwOnInvalidCommit:!0},s=yield br._makeGenesis(e,t,n);return e.createStreamFromGenesis(br.STREAM_TYPE_ID,s,i)})}replacePlaceholder(e){return Z(this,null,function*(){br.assertComplete(e,this.id);let t={publish:!0,anchor:!0,pin:!0,throwOnInvalidCommit:!0},n=yield this._makeCommit(this.api,e),i=yield this.api.applyCommit(this.id,n,t);this.state$.next(i.state)})}static assertComplete(e,t){if(!e.name)throw t?new Error(`Model with StreamID ${t.toString()} is missing a 'name' field`):new Error("Model is missing a 'name' field");if(!e.schema)throw t?new Error(`Model ${e.name} (${t.toString()}) is missing a 'schema' field`):new Error(`Model ${e.name} is missing a 'schema' field`);if(!e.accountRelation)throw t?new Error(`Model ${e.name} (${t.toString()}) is missing a 'accountRelation' field`):new Error(`Model ${e.name} is missing a 'accountRelation' field`)}static load(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},mD),n);let a=xr.from(t);if(a.type!=br.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${br.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);let f=yield e.loadStream(a,n);try{br.assertComplete(f.content,t)}catch(u){throw new Error(`Incomplete placeholder Models cannot be loaded: ${u.message}`)}return f})}_makeCommit(e,t){return Z(this,null,function*(){let n=this._makeRawCommit(t);return br._signDagJWS(e,n)})}_makeRawCommit(e){if(e==null)throw new Error("Cannot set Model content to null");return{data:Oa.compare(this.content,e),prev:this.tip,id:this.state.log[0].cid}}static _makeGenesis(e,t,n){return Z(this,null,function*(){let i=yield this._makeRawGenesis(e,t,n);return br._signDagJWS(e,i)})}static _makeRawGenesis(e,t,n){return Z(this,null,function*(){if(t==null)throw new Error("Genesis content cannot be null");if(!n||!n.controller)if(e.did)yield Xw(e),n={controller:e.did.hasParent?e.did.parent:e.did.id};else throw new Error("No controller specified");let i={controllers:[n.controller],unique:(0,e4.randomBytes)(12),model:br.MODEL.bytes};return{data:t,header:i}})}makeReadOnly(){this.replacePlaceholder=Zw,this.sync=Zw,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static _signDagJWS(e,t){return Z(this,null,function*(){return yield Xw(e),e.did.createDagJWS(t)})}},"Model");yo.STREAM_TYPE_NAME="model";yo.STREAM_TYPE_ID=2;yo.MODEL=function(){let r=If("model-v1"),e=t4.default.encode(r,"identity"),t=Kn(ba,e),n=Pe.createV1(ba,t);return new Je(br.STREAM_TYPE_ID,n)}();yo=br=pD([vo()],yo);var i4=at(ro(),1);var bD=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},$i,gD={anchor:!0,publish:!0,pin:!0,sync:Ct.NEVER_SYNC,syncTimeoutSeconds:0},vD={sync:Ct.PREFER_CACHE},r4={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function n4(r){return Z(this,null,function*(){if(r.did==null)throw new Error("No DID provided");r.did.authenticated||(yield r.did.authenticate(),r.loggerProvider&&r.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${r.did.id}`))})}o(n4,"_ensureAuthenticated");function om(){return Z(this,null,function*(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")})}o(om,"throwReadOnlyError");var As=$i=o(class extends Pn{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let e=this.state$.value.metadata;return{controller:e.controllers[0],model:e.model}}static create(s,a,f){return Z(this,arguments,function*(e,t,n,i={}){i=re(re({},gD),i);let u=i.asDID?{did:i.asDID}:e,p=yield $i._makeGenesis(u,t,n);return e.createStreamFromGenesis($i.STREAM_TYPE_ID,p,i)})}static load(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},vD),n);let a=xr.from(t);if(a.type!=$i.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${$i.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}replace(n){return Z(this,arguments,function*(e,t={}){t=re(re({},r4),t);let i=t.asDID?{did:t.asDID}:this.api,s=yield this._makeCommit(i,e),a=yield this.api.applyCommit(this.id,s,t);this.state$.next(a.state)})}patch(n){return Z(this,arguments,function*(e,t={}){t=re(re({},r4),t);let i={data:e,prev:this.tip,id:this.id.cid},s=yield $i._signDagJWS(this.api,i),a=yield this.api.applyCommit(this.id,s,t);this.state$.next(a.state)})}makeReadOnly(){this.replace=om,this.patch=om,this.sync=om,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(e,t){let n=this._makeRawCommit(t);return $i._signDagJWS(e,n)}_makeRawCommit(e){return{data:Oa.compare(this.content,e||{}),prev:this.tip,id:this.state.log[0].cid}}static _makeGenesis(e,t,n){return Z(this,null,function*(){let i=yield this._makeRawGenesis(e,t,n);return $i._signDagJWS(e,i)})}static _makeRawGenesis(e,t,n){return Z(this,null,function*(){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");if(!n.controller)if(e.did)yield n4(e),n.controller=e.did.hasParent?e.did.parent:e.did.id;else throw new Error("No controller specified");let i={controllers:[n.controller],unique:(0,i4.randomBytes)(12),model:n.model.bytes};return{data:t,header:i}})}static _signDagJWS(e,t){return Z(this,null,function*(){return yield n4(e),e.did.createDagJWS(t)})}},"ModelInstanceDocument");As.STREAM_TYPE_NAME="MID";As.STREAM_TYPE_ID=3;As=$i=bD([vo()],As);var bc=class{constructor(e){this._apiUrl=e}add(e,t){return Z(this,null,function*(){let n={};t&&(n.force=!0);let i=new URL(`./pins/${e}`,this._apiUrl);yield wr(i,{method:"post",body:n})})}rm(e,t){return Z(this,null,function*(){let n=new URL(`./pins/${e}`,this._apiUrl);yield wr(n,{method:"delete",body:{opts:t}})})}ls(e){return Z(this,null,function*(){let t=new URL("./pins",this._apiUrl);e&&(t=new URL(`./pins/${e.toString()}`,this._apiUrl));let n=yield wr(t),{pinnedStreamIds:i}=n;return{[Symbol.asyncIterator](){let s=0;return{next(){return s===i.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:i[s++],done:!1})}}}}})}};o(bc,"RemotePinApi");var gc=class{constructor(e){this._fetchJson=wr,this._collectionURL=new URL("./collection",e)}queryIndex(e){return Z(this,null,function*(){let t=new URL(this._collectionURL);for(let s in e)t.searchParams.set(s,e[s]);let n=yield this._fetchJson(t);return{edges:n.edges.map(s=>({cursor:s.cursor,node:yt.deserializeState(s.node)})),pageInfo:n.pageInfo}})}};o(gc,"RemoteIndexApi");var yD="/api/v0/",xD="http://localhost:7007",wD={syncInterval:5e3},_D={anchor:!0,publish:!0,sync:Ct.PREFER_CACHE},ED={anchor:!0,publish:!0,sync:Ct.PREFER_CACHE},o4={sync:Ct.PREFER_CACHE},vc=class{constructor(e=xD,t={}){this._config=re(re({},wD),t),this._apiUrl=new URL(yD,e),this._streamCache=new Map,this.context={api:this},this.pin=new bc(this._apiUrl),this.index=new gc(this._apiUrl),this._streamConstructors={[Ms.STREAM_TYPE_ID]:Ms,[yo.STREAM_TYPE_ID]:yo,[As.STREAM_TYPE_ID]:As,[zr.STREAM_TYPE_ID]:zr}}get did(){return this.context.did}set did(e){this.context.did=e}createStreamFromGenesis(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},ED),n);let a=yield mr.createFromGenesis(this._apiUrl,e,t,n,this._config.syncInterval),f=this._streamCache.get(a.id.toString());return f?(yt.statesEqual(a.state,f.state)||f.next(a.state),this.buildStreamFromDocument(f)):(this._streamCache.set(a.id.toString(),a),this.buildStreamFromDocument(a))})}loadStream(n){return Z(this,arguments,function*(e,t={}){t=re(re({},o4),t);let i=xr.from(e),s=this._streamCache.get(i.baseID.toString());return s?yield s._syncState(i,t):(s=yield mr.load(i,this._apiUrl,this._config.syncInterval,t),this._streamCache.set(s.id.toString(),s)),this.buildStreamFromDocument(s)})}multiQuery(e,t){return Z(this,null,function*(){let n=e.map(a=>Te(re({},a),{streamId:typeof a.streamId=="string"?a.streamId:a.streamId.toString()})),i=new URL("./multiqueries",this._apiUrl),s=yield wr(i,{method:"post",body:{queries:n,timeout:t}});return Object.entries(s).reduce((a,f)=>{let[u,p]=f,b=yt.deserializeState(p),x=new mr(b,this._apiUrl,this._config.syncInterval);return a[u]=this.buildStreamFromDocument(x),a},{})})}loadStreamCommits(e){let t=em(e);return mr.loadStreamCommits(t,this._apiUrl)}applyCommit(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},_D),n);let a=em(e),f=yield mr.applyCommit(this._apiUrl,a,t,n,this._config.syncInterval),u=this._streamCache.get(a.toString());return u?(u.next(f.state),this.buildStreamFromDocument(f)):(this._streamCache.set(a.toString(),f),this.buildStreamFromDocument(f))})}requestAnchor(n){return Z(this,arguments,function*(e,t={}){t=re(re({},o4),t);let{anchorStatus:i}=yield wr(`${this._apiUrl}/streams/${e.toString()}/anchor`,{method:"post",body:{opts:t}});return i})}addStreamHandler(e){this._streamConstructors[e.name]=e.stream_constructor}buildStreamFromState(e){let t=new mr(e,this._apiUrl,this._config.syncInterval);return this.buildStreamFromDocument(t)}buildStreamFromDocument(e){let t=e.state.type,n=this._streamConstructors[t];if(!n)throw new Error(`Failed to find constructor for stream ${t}`);return new n(e,this.context)}setDID(e){return Z(this,null,function*(){this.context.did=e})}getSupportedChains(){return Z(this,null,function*(){if(this._supportedChains)return this._supportedChains;let{supportedChains:e}=yield wr(this._apiUrl+"/node/chains");return this._supportedChains=e,e})}close(){return Z(this,null,function*(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()})}};o(vc,"CeramicClient");var SD=o((r,e)=>Z(void 0,null,function*(){let t=new vc(e),n=re({},s4.default.getResolver()),i=new ls({resolver:n});t.did=i;let s=r.pluginMethods.getKey(),a=new Gf(Qu(s));return t.did.setProvider(a),yield t.did.authenticate(),t}),"getCeramicClientFromWalletSuite"),ed=o((s,a)=>Z(void 0,[s,a],function*(r,{modelData:e,credentialAlias:t,ceramicEndpoint:n,defaultContentFamily:i}){let f=yield SD(r,n),u=new mn({ceramic:f}),p=new pc({ceramic:f,model:e}),b=o((...$)=>Z(void 0,[...$],function*(k=t){return(yield p.get(k))||{credentials:[]}}),"getCredentialsListFromIdx"),x=o((k,$)=>Z(void 0,null,function*(){if(!k)throw new Error("record is required");if(!k.id)throw Error("No streamId provided");k.id.indexOf("ceramic://")===-1&&(k.id="ceramic://"+k.id),$||($=t);let C=yield b($),B=C.credentials.findIndex(z=>z.title===k.title);return B>-1?C.credentials[B]=re({storageType:"ceramic"},k):C.credentials.push(re({storageType:"ceramic"},k)),p.set($,C)}),"addCredentialStreamIdToIdx"),A=o((k,$)=>Z(void 0,null,function*(){if(!k)throw new Error("record is required");$||($=t);let C=yield b($);return C.credentials=C.credentials.filter(B=>B.title!==k),p.set($,C)}),"removeCredentialFromIdx"),O=o((B,...z)=>Z(void 0,[B,...z],function*(k,$={},C={}){if(!k)throw new Error("content is required");return $.controllers||($.controllers=[f.did.id]),$.family||($.family=i),"pin"in C||(C.pin=!0),(yield zr.create(f,k,$,C)).id.toString()}),"publishContentToCeramic"),T=o(k=>Z(void 0,null,function*(){var $;return($=yield u.load(k))==null?void 0:$.content}),"readContentFromCeramic");return{pluginMethods:{getCredentialsListFromIdx:(C,...B)=>Z(void 0,[C,...B],function*(k,$=t){return b($)}),publishContentToCeramic:(k,$)=>Z(void 0,null,function*(){return O($)}),readContentFromCeramic:(k,$)=>Z(void 0,null,function*(){return T($)}),getVerifiableCredentialFromIdx:(k,$)=>Z(void 0,null,function*(){var z;let C=yield b(),B=(z=C==null?void 0:C.credentials)==null?void 0:z.find(H=>(H==null?void 0:H.title)===$);return B&&(yield T(B.id))}),getVerifiableCredentialsFromIdx:()=>Z(void 0,null,function*(){var C,B;let k=yield b(),$=(B=(C=k==null?void 0:k.credentials)==null?void 0:C.map(z=>z==null?void 0:z.id))!=null?B:[];return Promise.all($.map(z=>Z(void 0,null,function*(){return T(z)})))}),addVerifiableCredentialInIdx:(B,z)=>Z(void 0,[B,z],function*(k,{title:$,id:C}){return x({title:$,id:C})}),removeVerifiableCredentialInIdx:(k,$)=>Z(void 0,null,function*(){return A($)})}}}),"getIDXPlugin");var MD=["key","tz","pkh:tz","pkh:tezos","pkh:sol","pkh:solana"],AD=["key","tz","ethr","pkh:tz","pkh:tezos","pkh:eth","pkh:celo","pkh:poly","pkh:btc","pkh:doge","pkh:eip155","pkh:bip122"],a4=o(r=>/^[0-9a-f]+$/i.test(r),"isHex"),f4=o(r=>{if(MD.includes(r))return"ed25519";if(AD.includes(r)||r.startsWith("pkh:eip155:")||r.startsWith("pkh:bip122:"))return"secp256k1";throw new Error("Unspported Did Method")},"getAlgorithmForDidMethod");var c4=o((r,e)=>Z(void 0,null,function*(){if(e.length===0)throw new Error("Please don't use an empty string for a key!");if(!a4(e))throw new Error("Key must be a hexadecimal string!");if(e.length>64)throw new Error("Key must be less than 64 characters");let t=e.padStart(64,"0"),n=Qu(t),i={},s={ed25519:r.pluginMethods.generateEd25519KeyFromBytes(n),secp256k1:r.pluginMethods.generateSecp256k1KeyFromBytes(n)};return{pluginMethods:{getSubjectDid:(a,f)=>{if(!i[f]){let u=f4(f);i[f]=r.pluginMethods.keyToDid(f,s[u])}return i[f]},getSubjectKeypair:(a,f="ed25519")=>{if(!s[f])throw new Error("Unsupported algorithm");return s[f]},getKey:()=>t}}}),"getDidKeyPlugin");var u4=o(r=>({pluginMethods:{verifyCredential:(e,t)=>Z(void 0,null,function*(){let n=yield r.pluginMethods.verifyCredential(t);return t.expirationDate&&new Date>new Date(t.expirationDate)?n.errors.push("expiration error: Credential is expired"):n.checks.push("expiration"),n})}}),"ExpirationPlugin");var l4=o(r=>({}),"recycleDependents");var d4=o(r=>(e,t)=>Z(void 0,null,function*(){let n=e.pluginMethods.getSubjectKeypair();if(!n)throw new Error("Cannot issue credential: Could not get subject keypair");let i={verificationMethod:yield r.pluginMethods.keyToVerificationMethod("key",n),proofPurpose:"assertionMethod"};return r.pluginMethods.issueCredential(t,i,n)}),"issueCredential");var h4=o(r=>(e,t)=>Z(void 0,null,function*(){return r.pluginMethods.verifyCredential(t)}),"verifyCredential");var p4=o(r=>(e,t)=>Z(void 0,null,function*(){let n=e.pluginMethods.getSubjectDid("key");if(!n)throw new Error("Cannot create presentation: No holder key found");let i=n,s=e.pluginMethods.getSubjectKeypair();if(!s)throw new Error("Cannot issue credential: Could not get subject keypair");let a={verificationMethod:yield r.pluginMethods.keyToVerificationMethod("key",s),proofPurpose:"assertionMethod"},f={"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],holder:i,verifiableCredential:t};return r.pluginMethods.issuePresentation(f,a,s)}),"issuePresentation");var m4=o(r=>(e,t)=>Z(void 0,null,function*(){return r.pluginMethods.verifyPresentation(t)}),"verifyPresentation");var sm=o(r=>Z(void 0,null,function*(){return{pluginMethods:Te(re({},l4(r.pluginMethods)),{issueCredential:d4(r),verifyCredential:h4(r),issuePresentation:p4(r),verifyPresentation:m4(r),getTestVc:(e,t="did:example:d23dd687a7dc6787646f2eb98d0")=>{let n=e.pluginMethods.getSubjectDid("key");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:t}}}})}}),"getVCPlugin");var Ya=require("ethers"),g4=o((r,e)=>{let{address:t,infuraProjectId:n,network:i="mainnet"}=e,s;n?s=new Ya.ethers.providers.InfuraProvider(i,n):s=Ya.ethers.getDefaultProvider(i);let a=o(f=>Z(void 0,null,function*(){if(!t)throw new Error("Can't check balance: No address provided.");let u=b4(),b=yield new Ya.ethers.Contract(f,u,s).balanceOf(t);return Ya.ethers.utils.formatUnits(b)}),"checkErc20TokenBalance");return{pluginMethods:{checkMyEth:()=>Z(void 0,null,function*(){if(!t)throw new Error("Can't check ETH: No ethereum address provided.");let f=yield s.getBalance(t);return Ya.ethers.utils.formatEther(f)}),checkMyDai:()=>Z(void 0,null,function*(){return yield a("0x6B175474E89094C44Da98b954EedeAC495271d0F")}),checkMyUsdc:()=>Z(void 0,null,function*(){return yield a("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48")})}}},"getEthereumPlugin");var kt;(function(r){function e(n){throw new Error}o(e,"assertNever"),r.assertNever=e,r.arrayToEnum=n=>{let i={};for(let s of n)i[s]=s;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),s={};for(let a of i)s[a]=n[a];return r.objectValues(s)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(s);return i},r.find=(n,i)=>{for(let s of n)if(i(s))return s},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function t(n,i=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}o(t,"joinValues"),r.joinValues=t})(kt||(kt={}));var Me=kt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xo=o(r=>{switch(typeof r){case"undefined":return Me.undefined;case"string":return Me.string;case"number":return isNaN(r)?Me.nan:Me.number;case"boolean":return Me.boolean;case"function":return Me.function;case"bigint":return Me.bigint;case"object":return Array.isArray(r)?Me.array:r===null?Me.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?Me.promise:typeof Map!="undefined"&&r instanceof Map?Me.map:typeof Set!="undefined"&&r instanceof Set?Me.set:typeof Date!="undefined"&&r instanceof Date?Me.date:Me.object;default:return Me.unknown}},"getParsedType"),Se=kt.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"]),kD=o(r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),bn=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(s){return s.message},n={_errors:[]},i=o(s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let f=n,u=0;for(;u<a.path.length;){let p=a.path[u];u===a.path.length-1?(f[p]=f[p]||{_errors:[]},f[p]._errors.push(t(a))):f[p]=f[p]||{_errors:[]},f=f[p],u++}}},"processError");return i(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,null,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};o(bn,"ZodError");bn.create=r=>new bn(r);var yc=o((r,e)=>{let t;switch(r.code){case Se.invalid_type:r.received===Me.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case Se.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected)}`;break;case Se.unrecognized_keys:t=`Unrecognized key(s) in object: ${kt.joinValues(r.keys,", ")}`;break;case Se.invalid_union:t="Invalid input";break;case Se.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${kt.joinValues(r.options)}`;break;case Se.invalid_enum_value:t=`Invalid enum value. Expected ${kt.joinValues(r.options)}, received '${r.received}'`;break;case Se.invalid_arguments:t="Invalid function arguments";break;case Se.invalid_return_type:t="Invalid function return type";break;case Se.invalid_date:t="Invalid date";break;case Se.invalid_string:r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case Se.too_small:r.type==="array"?t=`Array must contain ${r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be greater than ${r.inclusive?"or equal to ":""}${r.minimum}`:t="Invalid input";break;case Se.too_big:r.type==="array"?t=`Array must contain ${r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be less than ${r.inclusive?"or equal to ":""}${r.maximum}`:t="Invalid input";break;case Se.custom:t="Invalid input";break;case Se.invalid_intersection_types:t="Intersection results could not be merged";break;case Se.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;default:t=e.defaultError,kt.assertNever(r)}return{message:t}},"defaultErrorMap"),xc=yc,CD=o(r=>{xc=r},"setErrorMap"),td=o(r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,s=[...t,...i.path||[]],a=Te(re({},i),{path:s}),f="",u=n.filter(p=>!!p).slice().reverse();for(let p of u)f=p(a,{data:e,defaultError:f}).message;return Te(re({},i),{path:s,message:i.message||f})},"makeIssue"),DD=[];function Re(r,e){let t=td({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xc,yc].filter(n=>!!n)});r.common.issues.push(t)}o(Re,"addIssueToContext");var or=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return nt;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static mergeObjectAsync(e,t){return Z(this,null,function*(){let n=[];for(let i of t)n.push({key:yield i.key,value:yield i.value});return or.mergeObjectSync(e,n)})}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return nt;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value!="undefined"||i.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}};o(or,"ParseStatus");var nt=Object.freeze({status:"aborted"}),ID=o(r=>({status:"dirty",value:r}),"DIRTY"),_r=o(r=>({status:"valid",value:r}),"OK"),am=o(r=>r.status==="aborted","isAborted"),fm=o(r=>r.status==="dirty","isDirty"),rd=o(r=>r.status==="valid","isValid"),cm=o(r=>typeof Promise!==void 0&&r instanceof Promise,"isAsync"),xt;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(xt||(xt={}));var jr=class{constructor(e,t,n,i){this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._path.concat(this._key)}};o(jr,"ParseInputLazyPath");var v4=o((r,e)=>{if(rd(e))return{success:!0,data:e.value};{if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");let t=new bn(r.common.issues);return{success:!1,error:t}}},"handleResult");function st(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid" or "required" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:o((a,f)=>a.code!=="invalid_type"?{message:f.defaultError}:typeof f.data=="undefined"&&n?{message:n}:r.invalid_type_error?{message:r.invalid_type_error}:{message:f.defaultError},"customMap"),description:i}}o(st,"processCreateParams");var ot=class{constructor(e){this.spa=this.safeParseAsync,this.superRefine=this._refinement,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.default=this.default.bind(this),this.describe=this.describe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return xo(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new or,ctx:{common:e.parent.common,data:e.data,parsedType:xo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(cm(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let i={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xo(e)},s=this._parseSync({data:e,path:i.path,parent:i});return v4(i,s)}parseAsync(e,t){return Z(this,null,function*(){let n=yield this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error})}safeParseAsync(e,t){return Z(this,null,function*(){let n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xo(e)},i=this._parse({data:e,path:[],parent:n}),s=yield cm(i)?i:Promise.resolve(i);return v4(n,s)})}refine(e,t){let n=o(i=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(i):t,"getIssueProperties");return this._refinement((i,s)=>{let a=e(i),f=o(()=>s.addIssue(re({code:Se.custom},n(i))),"setError");return typeof Promise!="undefined"&&a instanceof Promise?a.then(u=>u?!0:(f(),!1)):a?!0:(f(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new Wr({schema:this,typeName:et.ZodEffects,effect:{type:"refinement",refinement:e}})}optional(){return Gr.create(this)}nullable(){return bi.create(this)}nullish(){return this.optional().nullable()}array(){return Kr.create(this)}promise(){return Hi.create(this)}or(e){return wo.create([this,e])}and(e){return _o.create(this,e)}transform(e){return new Wr({schema:this,typeName:et.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Xa({innerType:this,defaultValue:t,typeName:et.ZodDefault})}describe(e){let t=this.constructor;return new t(Te(re({},this._def),{description:e}))}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};o(ot,"ZodType");var OD=/^c[^\s-]{8,}$/i,PD=/^([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,ND=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,Nn=class extends ot{constructor(){super(...arguments),this._regex=(e,t,n)=>this.refinement(i=>e.test(i),re({validation:t,code:Se.invalid_string},xt.errToObj(n))),this.nonempty=e=>this.min(1,xt.errToObj(e)),this.trim=()=>new Nn(Te(re({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}_parse(e){if(this._getType(e)!==Me.string){let s=this._getOrReturnCtx(e);return Re(s,{code:Se.invalid_type,expected:Me.string,received:s.parsedType}),nt}let n=new or,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),Re(i,{code:Se.too_small,minimum:s.value,type:"string",inclusive:!0,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),Re(i,{code:Se.too_big,maximum:s.value,type:"string",inclusive:!0,message:s.message}),n.dirty());else if(s.kind==="email")ND.test(e.data)||(i=this._getOrReturnCtx(e,i),Re(i,{validation:"email",code:Se.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")PD.test(e.data)||(i=this._getOrReturnCtx(e,i),Re(i,{validation:"uuid",code:Se.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")OD.test(e.data)||(i=this._getOrReturnCtx(e,i),Re(i,{validation:"cuid",code:Se.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch(a){i=this._getOrReturnCtx(e,i),Re(i,{validation:"url",code:Se.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Re(i,{validation:"regex",code:Se.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():kt.assertNever(s);return{status:n.value,value:e.data}}_addCheck(e){return new Nn(Te(re({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(re({kind:"email"},xt.errToObj(e)))}url(e){return this._addCheck(re({kind:"url"},xt.errToObj(e)))}uuid(e){return this._addCheck(re({kind:"uuid"},xt.errToObj(e)))}cuid(e){return this._addCheck(re({kind:"cuid"},xt.errToObj(e)))}regex(e,t){return this._addCheck(re({kind:"regex",regex:e},xt.errToObj(t)))}min(e,t){return this._addCheck(re({kind:"min",value:e},xt.errToObj(t)))}max(e,t){return this._addCheck(re({kind:"max",value:e},xt.errToObj(t)))}length(e,t){return this.min(e,t).max(e,t)}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=-1/0;return this._def.checks.map(t=>{t.kind==="min"&&(e===null||t.value>e)&&(e=t.value)}),e}get maxLength(){let e=null;return this._def.checks.map(t=>{t.kind==="max"&&(e===null||t.value<e)&&(e=t.value)}),e}};o(Nn,"ZodString");Nn.create=r=>new Nn(re({checks:[],typeName:et.ZodString},st(r)));function RD(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,s=parseInt(r.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}o(RD,"floatSafeRemainder");var hi=class extends ot{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._getType(e)!==Me.number){let s=this._getOrReturnCtx(e);return Re(s,{code:Se.invalid_type,expected:Me.number,received:s.parsedType}),nt}let n,i=new or;for(let s of this._def.checks)s.kind==="int"?kt.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Re(n,{code:Se.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Se.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Se.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?RD(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Se.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):kt.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,xt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,xt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,xt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,xt.toString(t))}setLimit(e,t,n,i){return new hi(Te(re({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:xt.toString(i)}]}))}_addCheck(e){return new hi(Te(re({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:xt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:xt.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}};o(hi,"ZodNumber");hi.create=r=>new hi(re({checks:[],typeName:et.ZodNumber},st(r)));var Ts=class extends ot{_parse(e){if(this._getType(e)!==Me.bigint){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.bigint,received:n.parsedType}),nt}return _r(e.data)}};o(Ts,"ZodBigInt");Ts.create=r=>new Ts(re({typeName:et.ZodBigInt},st(r)));var ks=class extends ot{_parse(e){if(this._getType(e)!==Me.boolean){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.boolean,received:n.parsedType}),nt}return _r(e.data)}};o(ks,"ZodBoolean");ks.create=r=>new ks(re({typeName:et.ZodBoolean},st(r)));var Cs=class extends ot{_parse(e){if(this._getType(e)!==Me.date){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.date,received:n.parsedType}),nt}if(isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_date}),nt}return{status:"valid",value:new Date(e.data.getTime())}}};o(Cs,"ZodDate");Cs.create=r=>new Cs(re({typeName:et.ZodDate},st(r)));var Ds=class extends ot{_parse(e){if(this._getType(e)!==Me.undefined){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.undefined,received:n.parsedType}),nt}return _r(e.data)}};o(Ds,"ZodUndefined");Ds.create=r=>new Ds(re({typeName:et.ZodUndefined},st(r)));var Is=class extends ot{_parse(e){if(this._getType(e)!==Me.null){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.null,received:n.parsedType}),nt}return _r(e.data)}};o(Is,"ZodNull");Is.create=r=>new Is(re({typeName:et.ZodNull},st(r)));var qi=class extends ot{constructor(){super(...arguments),this._any=!0}_parse(e){return _r(e.data)}};o(qi,"ZodAny");qi.create=r=>new qi(re({typeName:et.ZodAny},st(r)));var Rn=class extends ot{constructor(){super(...arguments),this._unknown=!0}_parse(e){return _r(e.data)}};o(Rn,"ZodUnknown");Rn.create=r=>new Rn(re({typeName:et.ZodUnknown},st(r)));var Ln=class extends ot{_parse(e){let t=this._getOrReturnCtx(e);return Re(t,{code:Se.invalid_type,expected:Me.never,received:t.parsedType}),nt}};o(Ln,"ZodNever");Ln.create=r=>new Ln(re({typeName:et.ZodNever},st(r)));var Os=class extends ot{_parse(e){if(this._getType(e)!==Me.undefined){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.void,received:n.parsedType}),nt}return _r(e.data)}};o(Os,"ZodVoid");Os.create=r=>new Os(re({typeName:et.ZodVoid},st(r)));var Kr=class extends ot{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==Me.array)return Re(t,{code:Se.invalid_type,expected:Me.array,received:t.parsedType}),nt;if(i.minLength!==null&&t.data.length<i.minLength.value&&(Re(t,{code:Se.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(Re(t,{code:Se.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all(t.data.map((a,f)=>i.type._parseAsync(new jr(t,a,t.path,f)))).then(a=>or.mergeArray(n,a));let s=t.data.map((a,f)=>i.type._parseSync(new jr(t,a,t.path,f)));return or.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new Kr(Te(re({},this._def),{minLength:{value:e,message:xt.toString(t)}}))}max(e,t){return new Kr(Te(re({},this._def),{maxLength:{value:e,message:xt.toString(t)}}))}length(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};o(Kr,"ZodArray");Kr.create=(r,e)=>new Kr(re({type:r,minLength:null,maxLength:null,typeName:et.ZodArray},st(e)));var nd;(function(r){r.mergeShapes=(e,t)=>re(re({},e),t)})(nd||(nd={}));var y4=o(r=>e=>new Et(Te(re({},r),{shape:()=>re(re({},r.shape()),e)})),"AugmentFactory");function Ja(r){if(r instanceof Et){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=Gr.create(Ja(n))}return new Et(Te(re({},r._def),{shape:()=>e}))}else return r instanceof Kr?Kr.create(Ja(r.element)):r instanceof Gr?Gr.create(Ja(r.unwrap())):r instanceof bi?bi.create(Ja(r.unwrap())):r instanceof Vr?Vr.create(r.items.map(e=>Ja(e))):r}o(Ja,"deepPartialify");var Et=class extends ot{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=y4(this._def),this.extend=y4(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=kt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Me.object){let p=this._getOrReturnCtx(e);return Re(p,{code:Se.invalid_type,expected:Me.object,received:p.parsedType}),nt}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),f=[];for(let p in i.data)a.includes(p)||f.push(p);let u=[];for(let p of a){let b=s[p],x=i.data[p];u.push({key:{status:"valid",value:p},value:b._parse(new jr(i,x,i.path,p)),alwaysSet:p in i.data})}if(this._def.catchall instanceof Ln){let p=this._def.unknownKeys;if(p==="passthrough")for(let b of f)u.push({key:{status:"valid",value:b},value:{status:"valid",value:i.data[b]}});else if(p==="strict")f.length>0&&(Re(i,{code:Se.unrecognized_keys,keys:f}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let b of f){let x=i.data[b];u.push({key:{status:"valid",value:b},value:p._parse(new jr(i,x,i.path,b)),alwaysSet:b in i.data})}}return i.common.async?Promise.resolve().then(()=>Z(this,null,function*(){let p=[];for(let b of u){let x=yield b.key;p.push({key:x,value:yield b.value,alwaysSet:b.alwaysSet})}return p})).then(p=>or.mergeObjectSync(n,p)):or.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return xt.errToObj,new Et(re(Te(re({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(t,n)=>{var i,s,a,f;let u=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,t,n).message)!==null&&a!==void 0?a:n.defaultError;return t.code==="unrecognized_keys"?{message:(f=xt.errToObj(e).message)!==null&&f!==void 0?f:u}:{message:u}}}:{}))}strip(){return new Et(Te(re({},this._def),{unknownKeys:"strip"}))}passthrough(){return new Et(Te(re({},this._def),{unknownKeys:"passthrough"}))}setKey(e,t){return this.augment({[e]:t})}merge(e){return new Et({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>nd.mergeShapes(this._def.shape(),e._def.shape()),typeName:et.ZodObject})}catchall(e){return new Et(Te(re({},this._def),{catchall:e}))}pick(e){let t={};return kt.objectKeys(e).map(n=>{this.shape[n]&&(t[n]=this.shape[n])}),new Et(Te(re({},this._def),{shape:()=>t}))}omit(e){let t={};return kt.objectKeys(this.shape).map(n=>{kt.objectKeys(e).indexOf(n)===-1&&(t[n]=this.shape[n])}),new Et(Te(re({},this._def),{shape:()=>t}))}deepPartial(){return Ja(this)}partial(e){let t={};if(e)return kt.objectKeys(this.shape).map(n=>{kt.objectKeys(e).indexOf(n)===-1?t[n]=this.shape[n]:t[n]=this.shape[n].optional()}),new Et(Te(re({},this._def),{shape:()=>t}));for(let n in this.shape){let i=this.shape[n];t[n]=i.optional()}return new Et(Te(re({},this._def),{shape:()=>t}))}required(){let e={};for(let t in this.shape){let i=this.shape[t];for(;i instanceof Gr;)i=i._def.innerType;e[t]=i}return new Et(Te(re({},this._def),{shape:()=>e}))}};o(Et,"ZodObject");Et.create=(r,e)=>new Et(re({shape:()=>r,unknownKeys:"strip",catchall:Ln.create(),typeName:et.ZodObject},st(e)));Et.strictCreate=(r,e)=>new Et(re({shape:()=>r,unknownKeys:"strict",catchall:Ln.create(),typeName:et.ZodObject},st(e)));Et.lazycreate=(r,e)=>new Et(re({shape:r,unknownKeys:"strip",catchall:Ln.create(),typeName:et.ZodObject},st(e)));var wo=class extends ot{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function i(s){for(let f of s)if(f.result.status==="valid")return f.result;for(let f of s)if(f.result.status==="dirty")return t.common.issues.push(...f.ctx.common.issues),f.result;let a=s.map(f=>new bn(f.ctx.common.issues));return Re(t,{code:Se.invalid_union,unionErrors:a}),nt}if(o(i,"handleResults"),t.common.async)return Promise.all(n.map(s=>Z(this,null,function*(){let a=Te(re({},t),{common:Te(re({},t.common),{issues:[]}),parent:null});return{result:yield s._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}}))).then(i);{let s,a=[];for(let u of n){let p=Te(re({},t),{common:Te(re({},t.common),{issues:[]}),parent:null}),b=u._parseSync({data:t.data,path:t.path,parent:p});if(b.status==="valid")return b;b.status==="dirty"&&!s&&(s={result:b,ctx:p}),p.common.issues.length&&a.push(p.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let f=a.map(u=>new bn(u));return Re(t,{code:Se.invalid_union,unionErrors:f}),nt}}get options(){return this._def.options}};o(wo,"ZodUnion");wo.create=(r,e)=>new wo(re({options:r,typeName:et.ZodUnion},st(e)));var Ps=class extends ot{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Me.object)return Re(t,{code:Se.invalid_type,expected:Me.object,received:t.parsedType}),nt;let n=this.discriminator,i=t.data[n],s=this.options.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(Re(t,{code:Se.invalid_union_discriminator,options:this.validDiscriminatorValues,path:[n]}),nt)}get discriminator(){return this._def.discriminator}get validDiscriminatorValues(){return Array.from(this.options.keys())}get options(){return this._def.options}static create(e,t,n){let i=new Map;try{t.forEach(s=>{let a=s.shape[e].value;i.set(a,s)})}catch(s){throw new Error("The discriminator value could not be extracted from all the provided schemas")}if(i.size!==t.length)throw new Error("Some of the discriminator values are not unique");return new Ps(re({typeName:et.ZodDiscriminatedUnion,discriminator:e,options:i},st(n)))}};o(Ps,"ZodDiscriminatedUnion");function um(r,e){let t=xo(r),n=xo(e);if(r===e)return{valid:!0,data:r};if(t===Me.object&&n===Me.object){let i=kt.objectKeys(e),s=kt.objectKeys(r).filter(f=>i.indexOf(f)!==-1),a=re(re({},r),e);for(let f of s){let u=um(r[f],e[f]);if(!u.valid)return{valid:!1};a[f]=u.data}return{valid:!0,data:a}}else if(t===Me.array&&n===Me.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<r.length;s++){let a=r[s],f=e[s],u=um(a,f);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return t===Me.date&&n===Me.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}o(um,"mergeValues");var _o=class extends ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=o((s,a)=>{if(am(s)||am(a))return nt;let f=um(s.value,a.value);return f.valid?((fm(s)||fm(a))&&t.dirty(),{status:t.value,value:f.data}):(Re(n,{code:Se.invalid_intersection_types}),nt)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};o(_o,"ZodIntersection");_o.create=(r,e,t)=>new _o(re({left:r,right:e,typeName:et.ZodIntersection},st(t)));var Vr=class extends ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.array)return Re(n,{code:Se.invalid_type,expected:Me.array,received:n.parsedType}),nt;if(n.data.length<this._def.items.length)return Re(n,{code:Se.too_small,minimum:this._def.items.length,inclusive:!0,type:"array"}),nt;!this._def.rest&&n.data.length>this._def.items.length&&(Re(n,{code:Se.too_big,maximum:this._def.items.length,inclusive:!0,type:"array"}),t.dirty());let s=n.data.map((a,f)=>{let u=this._def.items[f]||this._def.rest;return u?u._parse(new jr(n,a,n.path,f)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>or.mergeArray(t,a)):or.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Vr(Te(re({},this._def),{rest:e}))}};o(Vr,"ZodTuple");Vr.create=(r,e)=>new Vr(re({items:r,typeName:et.ZodTuple,rest:null},st(e)));var Eo=class extends ot{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.object)return Re(n,{code:Se.invalid_type,expected:Me.object,received:n.parsedType}),nt;let i=[],s=this._def.keyType,a=this._def.valueType;for(let f in n.data)i.push({key:s._parse(new jr(n,f,n.path,f)),value:a._parse(new jr(n,n.data[f],n.path,f))});return n.common.async?or.mergeObjectAsync(t,i):or.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof ot?new Eo(re({keyType:e,valueType:t,typeName:et.ZodRecord},st(n))):new Eo(re({keyType:Nn.create(),valueType:e,typeName:et.ZodRecord},st(t)))}};o(Eo,"ZodRecord");var Ns=class extends ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.map)return Re(n,{code:Se.invalid_type,expected:Me.map,received:n.parsedType}),nt;let i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([f,u],p)=>({key:i._parse(new jr(n,f,n.path,[p,"key"])),value:s._parse(new jr(n,u,n.path,[p,"value"]))}));if(n.common.async){let f=new Map;return Promise.resolve().then(()=>Z(this,null,function*(){for(let u of a){let p=yield u.key,b=yield u.value;if(p.status==="aborted"||b.status==="aborted")return nt;(p.status==="dirty"||b.status==="dirty")&&t.dirty(),f.set(p.value,b.value)}return{status:t.value,value:f}}))}else{let f=new Map;for(let u of a){let p=u.key,b=u.value;if(p.status==="aborted"||b.status==="aborted")return nt;(p.status==="dirty"||b.status==="dirty")&&t.dirty(),f.set(p.value,b.value)}return{status:t.value,value:f}}}};o(Ns,"ZodMap");Ns.create=(r,e,t)=>new Ns(re({valueType:e,keyType:r,typeName:et.ZodMap},st(t)));var pi=class extends ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.set)return Re(n,{code:Se.invalid_type,expected:Me.set,received:n.parsedType}),nt;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Re(n,{code:Se.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Re(n,{code:Se.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,message:i.maxSize.message}),t.dirty());let s=this._def.valueType;function a(u){let p=new Set;for(let b of u){if(b.status==="aborted")return nt;b.status==="dirty"&&t.dirty(),p.add(b.value)}return{status:t.value,value:p}}o(a,"finalizeSet");let f=[...n.data.values()].map((u,p)=>s._parse(new jr(n,u,n.path,p)));return n.common.async?Promise.all(f).then(u=>a(u)):a(f)}min(e,t){return new pi(Te(re({},this._def),{minSize:{value:e,message:xt.toString(t)}}))}max(e,t){return new pi(Te(re({},this._def),{maxSize:{value:e,message:xt.toString(t)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};o(pi,"ZodSet");pi.create=(r,e)=>new pi(re({valueType:r,minSize:null,maxSize:null,typeName:et.ZodSet},st(e)));var mi=class extends ot{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Me.function)return Re(t,{code:Se.invalid_type,expected:Me.function,received:t.parsedType}),nt;function n(f,u){return td({data:f,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xc,yc].filter(p=>!!p),issueData:{code:Se.invalid_arguments,argumentsError:u}})}o(n,"makeArgsIssue");function i(f,u){return td({data:f,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xc,yc].filter(p=>!!p),issueData:{code:Se.invalid_return_type,returnTypeError:u}})}o(i,"makeReturnsIssue");let s={errorMap:t.common.contextualErrorMap},a=t.data;return this._def.returns instanceof Hi?_r((...f)=>Z(this,null,function*(){let u=new bn([]),p=yield this._def.args.parseAsync(f,s).catch(A=>{throw u.addIssue(n(f,A)),u}),b=yield a(...p);return yield this._def.returns._def.type.parseAsync(b,s).catch(A=>{throw u.addIssue(i(b,A)),u})})):_r((...f)=>{let u=this._def.args.safeParse(f,s);if(!u.success)throw new bn([n(f,u.error)]);let p=a(...u.data),b=this._def.returns.safeParse(p,s);if(!b.success)throw new bn([i(p,b.error)]);return b.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new mi(Te(re({},this._def),{args:Vr.create(e).rest(Rn.create())}))}returns(e){return new mi(Te(re({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}};o(mi,"ZodFunction");mi.create=(r,e,t)=>new mi(re({args:r?r.rest(Rn.create()):Vr.create([]).rest(Rn.create()),returns:e||Rn.create(),typeName:et.ZodFunction},st(t)));var Rs=class extends ot{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};o(Rs,"ZodLazy");Rs.create=(r,e)=>new Rs(re({getter:r,typeName:et.ZodLazy},st(e)));var Ls=class extends ot{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Re(t,{code:Se.invalid_literal,expected:this._def.value}),nt}return{status:"valid",value:e.data}}get value(){return this._def.value}};o(Ls,"ZodLiteral");Ls.create=(r,e)=>new Ls(re({value:r,typeName:et.ZodLiteral},st(e)));function LD(r,e){return new Bs(re({values:r,typeName:et.ZodEnum},st(e)))}o(LD,"createZodEnum");var Bs=class extends ot{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return Re(t,{expected:kt.joinValues(n),received:t.parsedType,code:Se.invalid_type}),nt}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return Re(t,{received:t.data,code:Se.invalid_enum_value,options:n}),nt}return _r(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}};o(Bs,"ZodEnum");Bs.create=LD;var Us=class extends ot{_parse(e){let t=kt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Me.string&&n.parsedType!==Me.number){let i=kt.objectValues(t);return Re(n,{expected:kt.joinValues(i),received:n.parsedType,code:Se.invalid_type}),nt}if(t.indexOf(e.data)===-1){let i=kt.objectValues(t);return Re(n,{received:n.data,code:Se.invalid_enum_value,options:i}),nt}return _r(e.data)}get enum(){return this._def.values}};o(Us,"ZodNativeEnum");Us.create=(r,e)=>new Us(re({values:r,typeName:et.ZodNativeEnum},st(e)));var Hi=class extends ot{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Me.promise&&t.common.async===!1)return Re(t,{code:Se.invalid_type,expected:Me.promise,received:t.parsedType}),nt;let n=t.parsedType===Me.promise?t.data:Promise.resolve(t.data);return _r(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};o(Hi,"ZodPromise");Hi.create=(r,e)=>new Hi(re({type:r,typeName:et.ZodPromise},st(e)));var Wr=class extends ot{innerType(){return this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null;if(i.type==="preprocess"){let a=i.transform(n.data);return n.common.async?Promise.resolve(a).then(f=>this._def.schema._parseAsync({data:f,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}let s={addIssue:a=>{Re(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="refinement"){let a=o(f=>{let u=i.refinement(f,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return f},"executeRefinement");if(n.common.async===!1){let f=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return f.status==="aborted"?nt:(f.status==="dirty"&&t.dirty(),a(f.value),{status:t.value,value:f.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(f=>f.status==="aborted"?nt:(f.status==="dirty"&&t.dirty(),a(f.value).then(()=>({status:t.value,value:f.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!rd(a))return a;let f=i.transform(a.value,s);if(f instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:f}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>rd(a)?Promise.resolve(i.transform(a.value,s)).then(f=>({status:t.value,value:f})):a);kt.assertNever(i)}};o(Wr,"ZodEffects");Wr.create=(r,e,t)=>new Wr(re({schema:r,typeName:et.ZodEffects,effect:e},st(t)));Wr.createWithPreprocess=(r,e,t)=>new Wr(re({schema:e,effect:{type:"preprocess",transform:r},typeName:et.ZodEffects},st(t)));var Gr=class extends ot{_parse(e){return this._getType(e)===Me.undefined?_r(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};o(Gr,"ZodOptional");Gr.create=(r,e)=>new Gr(re({innerType:r,typeName:et.ZodOptional},st(e)));var bi=class extends ot{_parse(e){return this._getType(e)===Me.null?_r(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};o(bi,"ZodNullable");bi.create=(r,e)=>new bi(re({innerType:r,typeName:et.ZodNullable},st(e)));var Xa=class extends ot{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Me.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};o(Xa,"ZodDefault");Xa.create=(r,e)=>new Gr(re({innerType:r,typeName:et.ZodOptional},st(e)));var Fs=class extends ot{_parse(e){if(this._getType(e)!==Me.nan){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.nan,received:n.parsedType}),nt}return{status:"valid",value:e.data}}};o(Fs,"ZodNaN");Fs.create=r=>new Fs(re({typeName:et.ZodNaN},st(r)));var w4=o((r,e={},t)=>r?qi.create().superRefine((n,i)=>{if(!r(n)){let s=typeof e=="function"?e(n):e,a=typeof s=="string"?{message:s}:s;i.addIssue(Te(re({code:"custom"},a),{fatal:t}))}}):qi.create(),"custom"),BD={object:Et.lazycreate},et;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodPromise="ZodPromise"})(et||(et={}));var UD=o((r,e={message:`Input not instance of ${r.name}`})=>w4(t=>t instanceof r,e,!0),"instanceOfType"),_4=Nn.create,E4=hi.create,FD=Fs.create,$D=Ts.create,S4=ks.create,qD=Cs.create,HD=Ds.create,zD=Is.create,jD=qi.create,KD=Rn.create,VD=Ln.create,WD=Os.create,GD=Kr.create,YD=Et.create,JD=Et.strictCreate,XD=wo.create,ZD=Ps.create,QD=_o.create,eI=Vr.create,tI=Eo.create,rI=Ns.create,nI=pi.create,iI=mi.create,oI=Rs.create,sI=Ls.create,aI=Bs.create,fI=Us.create,cI=Hi.create,x4=Wr.create,uI=Gr.create,lI=bi.create,dI=Wr.createWithPreprocess,hI=o(()=>_4().optional(),"ostring"),pI=o(()=>E4().optional(),"onumber"),mI=o(()=>S4().optional(),"oboolean"),oe=Object.freeze({__proto__:null,getParsedType:xo,ZodParsedType:Me,makeIssue:td,EMPTY_PATH:DD,addIssueToContext:Re,ParseStatus:or,INVALID:nt,DIRTY:ID,OK:_r,isAborted:am,isDirty:fm,isValid:rd,isAsync:cm,ZodType:ot,ZodString:Nn,ZodNumber:hi,ZodBigInt:Ts,ZodBoolean:ks,ZodDate:Cs,ZodUndefined:Ds,ZodNull:Is,ZodAny:qi,ZodUnknown:Rn,ZodNever:Ln,ZodVoid:Os,ZodArray:Kr,get objectUtil(){return nd},ZodObject:Et,ZodUnion:wo,ZodDiscriminatedUnion:Ps,ZodIntersection:_o,ZodTuple:Vr,ZodRecord:Eo,ZodMap:Ns,ZodSet:pi,ZodFunction:mi,ZodLazy:Rs,ZodLiteral:Ls,ZodEnum:Bs,ZodNativeEnum:Us,ZodPromise:Hi,ZodEffects:Wr,ZodTransformer:Wr,ZodOptional:Gr,ZodNullable:bi,ZodDefault:Xa,ZodNaN:Fs,custom:w4,Schema:ot,ZodSchema:ot,late:BD,get ZodFirstPartyTypeKind(){return et},any:jD,array:GD,bigint:$D,boolean:S4,date:qD,discriminatedUnion:ZD,effect:x4,enum:aI,function:iI,instanceof:UD,intersection:QD,lazy:oI,literal:sI,map:rI,nan:FD,nativeEnum:fI,never:VD,null:zD,nullable:lI,number:E4,object:YD,oboolean:mI,onumber:pI,optional:uI,ostring:hI,preprocess:dI,promise:cI,record:tI,set:nI,strictObject:JD,string:_4,transformer:x4,tuple:eI,undefined:HD,union:XD,unknown:KD,void:WD,ZodIssueCode:Se,quotelessJson:kD,ZodError:bn,defaultErrorMap:yc,get overrideErrorMap(){return xc},setErrorMap:CD});var T4=oe.string().array(),zV=oe.object({type:oe.string().optional(),narrative:oe.string().optional()}),dm=oe.string().or(oe.object({id:oe.string(),type:oe.string(),caption:oe.string().optional()})),bI=oe.object({type:oe.string().array().nonempty(),latitude:oe.number(),longitude:oe.number()}),gI=oe.object({type:oe.string().array().nonempty(),addressCountry:oe.string().optional(),addressCountryCode:oe.string().optional(),addressRegion:oe.string().optional(),addressLocality:oe.string().optional(),streetAddress:oe.string().optional(),postOfficeBoxNumber:oe.string().optional(),postalCode:oe.string().optional(),geo:bI.optional()}),vI=oe.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(oe.string()),k4=oe.object({type:oe.string().array().nonempty(),identifier:oe.string(),identifierType:vI}),wc=oe.string().or(oe.object({id:oe.string().optional(),type:oe.string().array().nonempty().optional(),name:oe.string().optional(),url:oe.string().optional(),phone:oe.string().optional(),description:oe.string().optional(),endorsement:oe.any().array().optional(),image:dm.optional(),email:oe.string().email().optional(),address:gI.optional(),otherIdentifier:k4.array().optional(),official:oe.string().optional(),parentOrg:oe.any().optional(),familyName:oe.string().optional(),givenName:oe.string().optional(),additionalName:oe.string().optional(),patronymicName:oe.string().optional(),honorificPrefix:oe.string().optional(),honorificSuffix:oe.string().optional(),familyNamePrefix:oe.string().optional(),dateOfBirth:oe.string().optional()}).catchall(oe.any())),lm=oe.object({id:oe.string().optional()}).catchall(oe.any()),yI=oe.object({type:oe.string(),id:oe.string()}),xI=oe.object({id:oe.string(),type:oe.string()}),wI=oe.object({id:oe.string(),type:oe.string()}).catchall(oe.any()),id=oe.object({"@context":T4,id:oe.string().optional(),type:oe.string().array().nonempty(),issuer:wc,issuanceDate:oe.string(),expirationDate:oe.string().optional(),credentialSubject:lm.or(lm.array()),credentialStatus:yI.optional(),credentialSchema:xI.array().optional(),refreshService:wI.optional()}).catchall(oe.any()),So=oe.object({type:oe.string(),created:oe.string(),challenge:oe.string().optional(),domain:oe.string().optional(),nonce:oe.string().optional(),proofPurpose:oe.string(),verificationMethod:oe.string(),jws:oe.string().optional()}).catchall(oe.any()),M4=id.extend({proof:So.or(So.array())}),_I=oe.object({"@context":T4,id:oe.string().optional(),type:oe.string().array().nonempty(),verifiableCredential:M4.or(M4.array()),holder:oe.string().optional()}).catchall(oe.any()),jV=_I.extend({proof:So.or(So.array())}),EI=oe.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(oe.string()),od=oe.object({type:oe.string().array().nonempty(),targetCode:oe.string().optional(),targetDescription:oe.string().optional(),targetName:oe.string(),targetFramework:oe.string().optional(),targetType:EI.optional(),targetUrl:oe.string()}),SI=oe.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"]).or(oe.string()),MI=oe.object({id:oe.string().optional(),narrative:oe.string().optional()}).catchall(oe.any()),AI=oe.object({id:oe.string(),type:oe.string().array().nonempty(),endorsementComment:oe.string().optional()}),TI=id.extend({credentialSubject:AI,proof:So.or(So.array()).optional()}),kI=oe.object({id:oe.string(),"@language":oe.string().optional(),version:oe.string().optional()}),CI=oe.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(oe.string()),DI=oe.object({id:oe.string(),type:oe.string().array().nonempty(),alignment:od.array().optional(),description:oe.string().optional(),level:oe.string().optional(),name:oe.string(),points:oe.string().optional()}).catchall(oe.any()),II=oe.object({id:oe.string(),type:oe.string().array().nonempty(),alignment:od.array().optional(),allowedValue:oe.string().array().optional(),name:oe.string(),requiredLevel:oe.string().optional(),requiredValue:oe.string().optional(),resultType:CI,rubricCriterionLevel:DI.array().optional(),valueMax:oe.string().optional(),valueMin:oe.string().optional()}).catchall(oe.any()),OI=oe.object({id:oe.string().optional(),type:oe.string().array().nonempty(),alignment:od.array().optional(),achievementType:SI.optional(),creator:wc.optional(),creditsAvailable:oe.number().optional(),criteria:MI,description:oe.string(),endorsement:TI.array().optional(),fieldOfStudy:oe.string().optional(),humanCode:oe.string().optional(),image:dm.optional(),"@language":oe.string().optional(),name:oe.string(),otherIdentifier:k4.array().optional(),related:kI.array().optional(),resultDescription:II.array().optional(),specialization:oe.string().optional(),tag:oe.string().array().optional(),version:oe.string().optional()}).catchall(oe.any()),PI=oe.object({type:oe.string(),hashed:oe.boolean(),identityHash:oe.string(),identityType:oe.string(),salt:oe.string().optional()}),NI=oe.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),RI=oe.object({type:oe.string().array().nonempty(),achievedLevel:oe.string().optional(),alignment:od.array().optional(),resultDescription:oe.string().optional(),status:NI.optional(),value:oe.string().optional()}).catchall(oe.any()),A4=oe.object({id:oe.string().optional(),type:oe.string().array().nonempty(),activityEndDate:oe.string().optional(),activityStartDate:oe.string().optional(),creditsEarned:oe.number().optional(),achievement:OI.optional(),identifier:PI.optional(),image:dm.optional(),licenseNumber:oe.string().optional(),narrative:oe.string().optional(),result:RI.array().optional(),role:oe.string().optional(),source:wc.optional(),term:oe.string().optional()}).catchall(oe.any()),LI=oe.object({id:oe.string().optional(),type:oe.string().array().nonempty(),narrative:oe.string().optional(),name:oe.string().optional(),description:oe.string().optional(),genre:oe.string().optional(),audience:oe.string().optional()}).catchall(oe.any()),BI=id.extend({name:oe.string().optional(),description:oe.string().optional(),image:oe.string().optional(),credentialSubject:A4.or(A4.array()),endorsement:id.array().optional(),evidence:LI.array().optional()}),VV=BI.extend({proof:So.or(So.array())}),GV=oe.object({checks:oe.string().array(),warnings:oe.string().array(),errors:oe.string().array()}),C4=oe.enum(["Success","Failed","Error"]),sd=C4.enum,YV=oe.object({check:oe.string(),status:C4,message:oe.string().optional(),details:oe.string().optional()}),JV=oe.object({title:oe.string().optional(),createdAt:oe.string().optional(),issuer:wc.optional(),issuee:wc.optional(),credentialSubject:lm.optional()});function Ht(r){if(r===null||r===!0||r===!1)return NaN;var e=Number(r);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}o(Ht,"toInteger");function pt(r,e){if(e.length<r)throw new TypeError(r+" argument"+(r>1?"s":"")+" required, but only "+e.length+" present")}o(pt,"requiredArgs");function Ft(r){pt(1,arguments);var e=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&e==="[object Date]"?new Date(r.getTime()):typeof r=="number"||e==="[object Number]"?new Date(r):((typeof r=="string"||e==="[object String]")&&typeof console!="undefined"&&(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://git.io/fjule"),console.warn(new Error().stack)),new Date(NaN))}o(Ft,"toDate");function hm(r,e){pt(2,arguments);var t=Ft(r).getTime(),n=Ht(e);return new Date(t+n)}o(hm,"addMilliseconds");function pm(r){var e=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return e.setUTCFullYear(r.getFullYear()),r.getTime()-e.getTime()}o(pm,"getTimezoneOffsetInMilliseconds");function mm(r){return pt(1,arguments),r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}o(mm,"isDate");function bm(r){if(pt(1,arguments),!mm(r)&&typeof r!="number")return!1;var e=Ft(r);return!isNaN(Number(e))}o(bm,"isValid");var UI={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"}},FI=o(function(r,e,t){var n,i=UI[r];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n},"formatDistance"),D4=FI;function _c(r){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.width?String(e.width):r.defaultWidth,n=r.formats[t]||r.formats[r.defaultWidth];return n}}o(_c,"buildFormatLongFn");var $I={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},qI={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},HI={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},zI={date:_c({formats:$I,defaultWidth:"full"}),time:_c({formats:qI,defaultWidth:"full"}),dateTime:_c({formats:HI,defaultWidth:"full"})},I4=zI;var jI={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},KI=o(function(r,e,t,n){return jI[r]},"formatRelative"),O4=KI;function $s(r){return function(e,t){var n=t||{},i=n.context?String(n.context):"standalone",s;if(i==="formatting"&&r.formattingValues){var a=r.defaultFormattingWidth||r.defaultWidth,f=n.width?String(n.width):a;s=r.formattingValues[f]||r.formattingValues[a]}else{var u=r.defaultWidth,p=n.width?String(n.width):r.defaultWidth;s=r.values[p]||r.values[u]}var b=r.argumentCallback?r.argumentCallback(e):e;return s[b]}}o($s,"buildLocalizeFn");var VI={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},WI={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},GI={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"]},YI={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"]},JI={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"}},XI={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"}},ZI=o(function(r,e){var t=Number(r),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},"ordinalNumber"),QI={ordinalNumber:ZI,era:$s({values:VI,defaultWidth:"wide"}),quarter:$s({values:WI,defaultWidth:"wide",argumentCallback:function(r){return r-1}}),month:$s({values:GI,defaultWidth:"wide"}),day:$s({values:YI,defaultWidth:"wide"}),dayPeriod:$s({values:JI,defaultWidth:"wide",formattingValues:XI,defaultFormattingWidth:"wide"})},P4=QI;function qs(r){return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.width,i=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],s=e.match(i);if(!s)return null;var a=s[0],f=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],u=Array.isArray(f)?tO(f,function(x){return x.test(a)}):eO(f,function(x){return x.test(a)}),p;p=r.valueCallback?r.valueCallback(u):u,p=t.valueCallback?t.valueCallback(p):p;var b=e.slice(a.length);return{value:p,rest:b}}}o(qs,"buildMatchFn");function eO(r,e){for(var t in r)if(r.hasOwnProperty(t)&&e(r[t]))return t}o(eO,"findKey");function tO(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return t}o(tO,"findIndex");function gm(r){return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.match(r.matchPattern);if(!n)return null;var i=n[0],s=e.match(r.parsePattern);if(!s)return null;var a=r.valueCallback?r.valueCallback(s[0]):s[0];a=t.valueCallback?t.valueCallback(a):a;var f=e.slice(i.length);return{value:a,rest:f}}}o(gm,"buildMatchPatternFn");var rO=/^(\d+)(th|st|nd|rd)?/i,nO=/\d+/i,iO={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},oO={any:[/^b/i,/^(a|c)/i]},sO={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},aO={any:[/1/i,/2/i,/3/i,/4/i]},fO={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},cO={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]},uO={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},lO={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]},dO={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},hO={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}},pO={ordinalNumber:gm({matchPattern:rO,parsePattern:nO,valueCallback:function(r){return parseInt(r,10)}}),era:qs({matchPatterns:iO,defaultMatchWidth:"wide",parsePatterns:oO,defaultParseWidth:"any"}),quarter:qs({matchPatterns:sO,defaultMatchWidth:"wide",parsePatterns:aO,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:qs({matchPatterns:fO,defaultMatchWidth:"wide",parsePatterns:cO,defaultParseWidth:"any"}),day:qs({matchPatterns:uO,defaultMatchWidth:"wide",parsePatterns:lO,defaultParseWidth:"any"}),dayPeriod:qs({matchPatterns:dO,defaultMatchWidth:"any",parsePatterns:hO,defaultParseWidth:"any"})},N4=pO;var mO={code:"en-US",formatDistance:D4,formatLong:I4,formatRelative:O4,localize:P4,match:N4,options:{weekStartsOn:0,firstWeekContainsDate:1}},R4=mO;function vm(r,e){pt(2,arguments);var t=Ht(e);return hm(r,-t)}o(vm,"subMilliseconds");var bO=864e5;function ym(r){pt(1,arguments);var e=Ft(r),t=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var n=e.getTime(),i=t-n;return Math.floor(i/bO)+1}o(ym,"getUTCDayOfYear");function Mo(r){pt(1,arguments);var e=1,t=Ft(r),n=t.getUTCDay(),i=(n<e?7:0)+n-e;return t.setUTCDate(t.getUTCDate()-i),t.setUTCHours(0,0,0,0),t}o(Mo,"startOfUTCISOWeek");function Ec(r){pt(1,arguments);var e=Ft(r),t=e.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(t+1,0,4),n.setUTCHours(0,0,0,0);var i=Mo(n),s=new Date(0);s.setUTCFullYear(t,0,4),s.setUTCHours(0,0,0,0);var a=Mo(s);return e.getTime()>=i.getTime()?t+1:e.getTime()>=a.getTime()?t:t-1}o(Ec,"getUTCISOWeekYear");function xm(r){pt(1,arguments);var e=Ec(r),t=new Date(0);t.setUTCFullYear(e,0,4),t.setUTCHours(0,0,0,0);var n=Mo(t);return n}o(xm,"startOfUTCISOWeekYear");var gO=6048e5;function wm(r){pt(1,arguments);var e=Ft(r),t=Mo(e).getTime()-xm(e).getTime();return Math.round(t/gO)+1}o(wm,"getUTCISOWeek");function Ao(r,e){pt(1,arguments);var t=e||{},n=t.locale,i=n&&n.options&&n.options.weekStartsOn,s=i==null?0:Ht(i),a=t.weekStartsOn==null?s:Ht(t.weekStartsOn);if(!(a>=0&&a<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=Ft(r),u=f.getUTCDay(),p=(u<a?7:0)+u-a;return f.setUTCDate(f.getUTCDate()-p),f.setUTCHours(0,0,0,0),f}o(Ao,"startOfUTCWeek");function Sc(r,e){pt(1,arguments);var t=Ft(r),n=t.getUTCFullYear(),i=e||{},s=i.locale,a=s&&s.options&&s.options.firstWeekContainsDate,f=a==null?1:Ht(a),u=i.firstWeekContainsDate==null?f:Ht(i.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setUTCFullYear(n+1,0,u),p.setUTCHours(0,0,0,0);var b=Ao(p,e),x=new Date(0);x.setUTCFullYear(n,0,u),x.setUTCHours(0,0,0,0);var A=Ao(x,e);return t.getTime()>=b.getTime()?n+1:t.getTime()>=A.getTime()?n:n-1}o(Sc,"getUTCWeekYear");function _m(r,e){pt(1,arguments);var t=e||{},n=t.locale,i=n&&n.options&&n.options.firstWeekContainsDate,s=i==null?1:Ht(i),a=t.firstWeekContainsDate==null?s:Ht(t.firstWeekContainsDate),f=Sc(r,e),u=new Date(0);u.setUTCFullYear(f,0,a),u.setUTCHours(0,0,0,0);var p=Ao(u,e);return p}o(_m,"startOfUTCWeekYear");var vO=6048e5;function Em(r,e){pt(1,arguments);var t=Ft(r),n=Ao(t,e).getTime()-_m(t,e).getTime();return Math.round(n/vO)+1}o(Em,"getUTCWeek");function ut(r,e){for(var t=r<0?"-":"",n=Math.abs(r).toString();n.length<e;)n="0"+n;return t+n}o(ut,"addLeadingZeros");var yO={y:function(r,e){var t=r.getUTCFullYear(),n=t>0?t:1-t;return ut(e==="yy"?n%100:n,e.length)},M:function(r,e){var t=r.getUTCMonth();return e==="M"?String(t+1):ut(t+1,2)},d:function(r,e){return ut(r.getUTCDate(),e.length)},a:function(r,e){var t=r.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h:function(r,e){return ut(r.getUTCHours()%12||12,e.length)},H:function(r,e){return ut(r.getUTCHours(),e.length)},m:function(r,e){return ut(r.getUTCMinutes(),e.length)},s:function(r,e){return ut(r.getUTCSeconds(),e.length)},S:function(r,e){var t=e.length,n=r.getUTCMilliseconds(),i=Math.floor(n*Math.pow(10,t-3));return ut(i,e.length)}},zi=yO;var Za={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},xO={G:function(r,e,t){var n=r.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){var n=r.getUTCFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return zi.y(r,e)},Y:function(r,e,t,n){var i=Sc(r,n),s=i>0?i:1-i;if(e==="YY"){var a=s%100;return ut(a,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):ut(s,e.length)},R:function(r,e){var t=Ec(r);return ut(t,e.length)},u:function(r,e){var t=r.getUTCFullYear();return ut(t,e.length)},Q:function(r,e,t){var n=Math.ceil((r.getUTCMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return ut(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){var n=Math.ceil((r.getUTCMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return ut(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){var n=r.getUTCMonth();switch(e){case"M":case"MM":return zi.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){var n=r.getUTCMonth();switch(e){case"L":return String(n+1);case"LL":return ut(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){var i=Em(r,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):ut(i,e.length)},I:function(r,e,t){var n=wm(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):ut(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getUTCDate(),{unit:"date"}):zi.d(r,e)},D:function(r,e,t){var n=ym(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):ut(n,e.length)},E:function(r,e,t){var n=r.getUTCDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){var i=r.getUTCDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return ut(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){var i=r.getUTCDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return ut(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(r,e,t){var n=r.getUTCDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return ut(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){var n=r.getUTCHours(),i=n/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(r,e,t){var n=r.getUTCHours(),i;switch(n===12?i=Za.noon:n===0?i=Za.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(r,e,t){var n=r.getUTCHours(),i;switch(n>=17?i=Za.evening:n>=12?i=Za.afternoon:n>=4?i=Za.morning:i=Za.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){var n=r.getUTCHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return zi.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getUTCHours(),{unit:"hour"}):zi.H(r,e)},K:function(r,e,t){var n=r.getUTCHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):ut(n,e.length)},k:function(r,e,t){var n=r.getUTCHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):ut(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getUTCMinutes(),{unit:"minute"}):zi.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getUTCSeconds(),{unit:"second"}):zi.s(r,e)},S:function(r,e){return zi.S(r,e)},X:function(r,e,t,n){var i=n._originalDate||r,s=i.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return B4(s);case"XXXX":case"XX":return Hs(s);case"XXXXX":case"XXX":default:return Hs(s,":")}},x:function(r,e,t,n){var i=n._originalDate||r,s=i.getTimezoneOffset();switch(e){case"x":return B4(s);case"xxxx":case"xx":return Hs(s);case"xxxxx":case"xxx":default:return Hs(s,":")}},O:function(r,e,t,n){var i=n._originalDate||r,s=i.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+L4(s,":");case"OOOO":default:return"GMT"+Hs(s,":")}},z:function(r,e,t,n){var i=n._originalDate||r,s=i.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+L4(s,":");case"zzzz":default:return"GMT"+Hs(s,":")}},t:function(r,e,t,n){var i=n._originalDate||r,s=Math.floor(i.getTime()/1e3);return ut(s,e.length)},T:function(r,e,t,n){var i=n._originalDate||r,s=i.getTime();return ut(s,e.length)}};function L4(r,e){var t=r>0?"-":"+",n=Math.abs(r),i=Math.floor(n/60),s=n%60;if(s===0)return t+String(i);var a=e||"";return t+String(i)+a+ut(s,2)}o(L4,"formatTimezoneShort");function B4(r,e){if(r%60===0){var t=r>0?"-":"+";return t+ut(Math.abs(r)/60,2)}return Hs(r,e)}o(B4,"formatTimezoneWithOptionalMinutes");function Hs(r,e){var t=e||"",n=r>0?"-":"+",i=Math.abs(r),s=ut(Math.floor(i/60),2),a=ut(i%60,2);return n+s+t+a}o(Hs,"formatTimezone");var U4=xO;function F4(r,e){switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}}o(F4,"dateLongFormatter");function $4(r,e){switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}}o($4,"timeLongFormatter");function wO(r,e){var t=r.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return F4(r,e);var s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",F4(n,e)).replace("{{time}}",$4(i,e))}o(wO,"dateTimeLongFormatter");var _O={p:$4,P:wO},q4=_O;var EO=["D","DD"],SO=["YY","YYYY"];function H4(r){return EO.indexOf(r)!==-1}o(H4,"isProtectedDayOfYearToken");function z4(r){return SO.indexOf(r)!==-1}o(z4,"isProtectedWeekYearToken");function Sm(r,e,t){if(r==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(r==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(r==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(r==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(t,"`; see: https://git.io/fxCyr"))}o(Sm,"throwProtectedError");var MO=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,AO=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,TO=/^'([^]*?)'?$/,kO=/''/g,CO=/[a-zA-Z]/;function Mc(r,e,t){pt(2,arguments);var n=String(e),i=t||{},s=i.locale||R4,a=s.options&&s.options.firstWeekContainsDate,f=a==null?1:Ht(a),u=i.firstWeekContainsDate==null?f:Ht(i.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=s.options&&s.options.weekStartsOn,b=p==null?0:Ht(p),x=i.weekStartsOn==null?b:Ht(i.weekStartsOn);if(!(x>=0&&x<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!s.localize)throw new RangeError("locale must contain localize property");if(!s.formatLong)throw new RangeError("locale must contain formatLong property");var A=Ft(r);if(!bm(A))throw new RangeError("Invalid time value");var O=pm(A),T=vm(A,O),k={firstWeekContainsDate:u,weekStartsOn:x,locale:s,_originalDate:A},$=n.match(AO).map(function(C){var B=C[0];if(B==="p"||B==="P"){var z=q4[B];return z(C,s.formatLong,k)}return C}).join("").match(MO).map(function(C){if(C==="''")return"'";var B=C[0];if(B==="'")return DO(C);var z=U4[B];if(z)return!i.useAdditionalWeekYearTokens&&z4(C)&&Sm(C,e,r),!i.useAdditionalDayOfYearTokens&&H4(C)&&Sm(C,e,r),z(T,C,s.localize,k);if(B.match(CO))throw new RangeError("Format string contains an unescaped latin alphabet character `"+B+"`");return C}).join("");return $}o(Mc,"format");function DO(r){return r.match(TO)[1].replace(kO,"'")}o(DO,"cleanEscapedString");var IO=o((r,e)=>r.split(" error")[0]||r,"transformErrorCheck"),OO=o((r,e)=>r.startsWith("expiration")?e.expirationDate?`Invalid \u2022 Expired ${Mc(new Date(e.expirationDate),"dd MMM yyyy").toUpperCase()}`:"Invalid \u2022 Expired":r,"transformErrorMessage"),PO=o((r,e)=>({proof:"Valid",expiration:e.expirationDate?`Valid \u2022 Expires ${Mc(new Date(e.expirationDate),"dd MMM yyyy").toUpperCase()}`:"Valid \u2022 Does Not Expire"})[r]||r,"transformCheckMessage"),j4=o(r=>e=>Z(void 0,null,function*(){let t=yield r.pluginMethods.verifyCredential(e),n=[];return t.errors.forEach(i=>{n.push({status:sd.Failed,check:IO(i,e),details:OO(i,e)})}),t.warnings.forEach(i=>{n.push({status:sd.Error,check:"hmm",message:i})}),t.checks.forEach(i=>{n.push({status:sd.Success,check:i,message:PO(i,e)})}),n}),"verifyCredential");var K4={modelData:{definitions:{MyVerifiableCredentials:"kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"},schemas:{AchievementVerifiableCredential:"ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",VerifiableCredentialsList:"ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"},tiles:{}},credentialAlias:"MyVerifiableCredentials",ceramicEndpoint:"https://ceramic-node.welibrary.io:7007",defaultContentFamily:"SuperSkills"},V4={address:"",infuraProjectId:"",network:"mainnet"};var Ae,W4=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});W4.decode();var ad=null;function Qa(){return(ad===null||ad.buffer!==Ae.memory.buffer)&&(ad=new Uint8Array(Ae.memory.buffer)),ad}o(Qa,"getUint8Memory0");function gi(r,e){return W4.decode(Qa().subarray(r,r+e))}o(gi,"getStringFromWasm0");var ji=new Array(32).fill(void 0);ji.push(void 0,null,!0,!1);var Ac=ji.length;function Ze(r){Ac===ji.length&&ji.push(ji.length+1);let e=Ac;return Ac=ji[e],ji[e]=r,e}o(Ze,"addHeapObject");function Ie(r){return ji[r]}o(Ie,"getObject");function NO(r){r<36||(ji[r]=Ac,Ac=r)}o(NO,"dropObject");function vi(r){let e=Ie(r);return NO(r),e}o(vi,"takeObject");var Rt=0,cd=new TextEncoder("utf-8"),RO=typeof cd.encodeInto=="function"?function(r,e){return cd.encodeInto(r,e)}:function(r,e){let t=cd.encode(r);return e.set(t),{read:r.length,written:t.length}};function sr(r,e,t){if(t===void 0){let f=cd.encode(r),u=e(f.length);return Qa().subarray(u,u+f.length).set(f),Rt=f.length,u}let n=r.length,i=e(n),s=Qa(),a=0;for(;a<n;a++){let f=r.charCodeAt(a);if(f>127)break;s[i+a]=f}if(a!==n){a!==0&&(r=r.slice(a)),i=t(i,n,n=a+r.length*3);let f=Qa().subarray(i+a,i+n);a+=RO(r,f).written}return Rt=a,i}o(sr,"passStringToWasm0");function LO(r){return r==null}o(LO,"isLikeNone");var fd=null;function Xt(){return(fd===null||fd.buffer!==Ae.memory.buffer)&&(fd=new Int32Array(Ae.memory.buffer)),fd}o(Xt,"getInt32Memory0");function Mm(r){let e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){let i=r.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){let i=r.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(r)){let i=r.length,s="[";i>0&&(s+=Mm(r[0]));for(let a=1;a<i;a++)s+=", "+Mm(r[a]);return s+="]",s}let t=/\[object ([^\]]+)\]/.exec(toString.call(r)),n;if(t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch(i){return"Object"}return r instanceof Error?`${r.name}: ${r.message}
792
- ${r.stack}`:n}o(Mm,"debugString");function BO(r,e,t,n){let i={a:r,b:e,cnt:1,dtor:t},s=o((...a)=>{i.cnt++;let f=i.a;i.a=0;try{return n(f,i.b,...a)}finally{--i.cnt===0?Ae.__wbindgen_export_2.get(i.dtor)(f,i.b):i.a=f}},"real");return s.original=i,s}o(BO,"makeMutClosure");function UO(r,e,t){Ae._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(r,e,Ze(t))}o(UO,"__wbg_adapter_24");function G4(r,e){let t=e(r.length*1);return Qa().set(r,t/1),Rt=r.length,t}o(G4,"passArray8ToWasm0");function Y4(r){try{let f=Ae.__wbindgen_add_to_stack_pointer(-16),u=G4(r,Ae.__wbindgen_malloc),p=Rt;Ae.generateEd25519KeyFromBytes(f,u,p);var e=Xt()[f/4+0],t=Xt()[f/4+1],n=Xt()[f/4+2],i=Xt()[f/4+3],s=e,a=t;if(i)throw s=0,a=0,vi(n);return gi(s,a)}finally{Ae.__wbindgen_add_to_stack_pointer(16),Ae.__wbindgen_free(s,a)}}o(Y4,"generateEd25519KeyFromBytes");function J4(r){try{let f=Ae.__wbindgen_add_to_stack_pointer(-16),u=G4(r,Ae.__wbindgen_malloc),p=Rt;Ae.generateSecp256k1KeyFromBytes(f,u,p);var e=Xt()[f/4+0],t=Xt()[f/4+1],n=Xt()[f/4+2],i=Xt()[f/4+3],s=e,a=t;if(i)throw s=0,a=0,vi(n);return gi(s,a)}finally{Ae.__wbindgen_add_to_stack_pointer(16),Ae.__wbindgen_free(s,a)}}o(J4,"generateSecp256k1KeyFromBytes");function X4(r,e){try{let u=Ae.__wbindgen_add_to_stack_pointer(-16),p=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),b=Rt,x=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),A=Rt;Ae.keyToDID(u,p,b,x,A);var t=Xt()[u/4+0],n=Xt()[u/4+1],i=Xt()[u/4+2],s=Xt()[u/4+3],a=t,f=n;if(s)throw a=0,f=0,vi(i);return gi(a,f)}finally{Ae.__wbindgen_add_to_stack_pointer(16),Ae.__wbindgen_free(a,f)}}o(X4,"keyToDID");function Z4(r,e){let t=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),n=Rt,i=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),s=Rt,a=Ae.keyToVerificationMethod(t,n,i,s);return vi(a)}o(Z4,"keyToVerificationMethod");function Q4(r,e,t){let n=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),i=Rt,s=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),a=Rt,f=sr(t,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),u=Rt,p=Ae.issueCredential(n,i,s,a,f,u);return vi(p)}o(Q4,"issueCredential");function e5(r,e){let t=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),n=Rt,i=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),s=Rt,a=Ae.verifyCredential(t,n,i,s);return vi(a)}o(e5,"verifyCredential");function t5(r,e,t){let n=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),i=Rt,s=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),a=Rt,f=sr(t,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),u=Rt,p=Ae.issuePresentation(n,i,s,a,f,u);return vi(p)}o(t5,"issuePresentation");function r5(r,e){let t=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),n=Rt,i=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),s=Rt,a=Ae.verifyPresentation(t,n,i,s);return vi(a)}o(r5,"verifyPresentation");function gr(r,e){try{return r.apply(this,e)}catch(t){Ae.__wbindgen_exn_store(Ze(t))}}o(gr,"handleError");function FO(r,e){return Qa().subarray(r/1,r/1+e)}o(FO,"getArrayU8FromWasm0");function $O(r,e,t,n){Ae.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(r,e,Ze(t),Ze(n))}o($O,"__wbg_adapter_110");function qO(r,e){return Z(this,null,function*(){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return yield WebAssembly.instantiateStreaming(r,e)}catch(n){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let t=yield r.arrayBuffer();return yield WebAssembly.instantiate(t,e)}else{let t=yield WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}})}o(qO,"load");function n5(r){return Z(this,null,function*(){let e={};e.wbg={},e.wbg.__wbindgen_string_new=function(i,s){let a=gi(i,s);return Ze(a)},e.wbg.__wbindgen_object_drop_ref=function(i){vi(i)},e.wbg.__wbindgen_cb_drop=function(i){let s=vi(i).original;return s.cnt--==1?(s.a=0,!0):!1},e.wbg.__wbindgen_object_clone_ref=function(i){let s=Ie(i);return Ze(s)},e.wbg.__wbg_fetch_811d43d6bdcad5b1=function(i){let s=fetch(Ie(i));return Ze(s)},e.wbg.__wbg_fetch_bf56e2a9f0644e3f=function(i,s){let a=Ie(i).fetch(Ie(s));return Ze(a)},e.wbg.__wbg_new_89d7f088c1c45353=function(){return gr(function(){let i=new Headers;return Ze(i)},arguments)},e.wbg.__wbg_append_f4f93bc73c45ee3e=function(){return gr(function(i,s,a,f,u){Ie(i).append(gi(s,a),gi(f,u))},arguments)},e.wbg.__wbindgen_string_get=function(i,s){let a=Ie(s),f=typeof a=="string"?a:void 0;var u=LO(f)?0:sr(f,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),p=Rt;Xt()[i/4+1]=p,Xt()[i/4+0]=u},e.wbg.__wbg_instanceof_Response_ccfeb62399355bcd=function(i){return Ie(i)instanceof Response},e.wbg.__wbg_url_06c0f822d68d195c=function(i,s){let a=Ie(s).url,f=sr(a,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),u=Rt;Xt()[i/4+1]=u,Xt()[i/4+0]=f},e.wbg.__wbg_status_600fd8b881393898=function(i){return Ie(i).status},e.wbg.__wbg_headers_9e7f2c05a9b962ea=function(i){let s=Ie(i).headers;return Ze(s)},e.wbg.__wbg_arrayBuffer_5a99283a3954c850=function(){return gr(function(i){let s=Ie(i).arrayBuffer();return Ze(s)},arguments)},e.wbg.__wbg_newwithstrandinit_fd99688f189f053e=function(){return gr(function(i,s,a){let f=new Request(gi(i,s),Ie(a));return Ze(f)},arguments)},e.wbg.__wbindgen_is_object=function(i){let s=Ie(i);return typeof s=="object"&&s!==null},e.wbg.__wbg_self_86b4b13392c7af56=function(){return gr(function(){let i=self.self;return Ze(i)},arguments)},e.wbg.__wbg_crypto_b8c92eaac23d0d80=function(i){let s=Ie(i).crypto;return Ze(s)},e.wbg.__wbg_msCrypto_9ad6677321a08dd8=function(i){let s=Ie(i).msCrypto;return Ze(s)},e.wbg.__wbindgen_is_undefined=function(i){return Ie(i)===void 0},e.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81=function(){return Ze(n)},e.wbg.__wbg_require_f5521a5b85ad2542=function(i,s,a){let f=Ie(i).require(gi(s,a));return Ze(f)},e.wbg.__wbg_getRandomValues_dd27e6b0652b3236=function(i){let s=Ie(i).getRandomValues;return Ze(s)},e.wbg.__wbg_getRandomValues_e57c9b75ddead065=function(i,s){Ie(i).getRandomValues(Ie(s))},e.wbg.__wbg_randomFillSync_d2ba53160aec6aba=function(i,s,a){Ie(i).randomFillSync(FO(s,a))},e.wbg.__wbindgen_is_function=function(i){return typeof Ie(i)=="function"},e.wbg.__wbg_newnoargs_e23b458e372830de=function(i,s){let a=new Function(gi(i,s));return Ze(a)},e.wbg.__wbg_next_cabb70b365520721=function(i){let s=Ie(i).next;return Ze(s)},e.wbg.__wbg_next_bf3d83fc18df496e=function(){return gr(function(i){let s=Ie(i).next();return Ze(s)},arguments)},e.wbg.__wbg_done_040f966faa9a72b3=function(i){return Ie(i).done},e.wbg.__wbg_value_419afbd9b9574c4c=function(i){let s=Ie(i).value;return Ze(s)},e.wbg.__wbg_iterator_4832ef1f15b0382b=function(){return Ze(Symbol.iterator)},e.wbg.__wbg_get_a9cab131e3152c49=function(){return gr(function(i,s){let a=Reflect.get(Ie(i),Ie(s));return Ze(a)},arguments)},e.wbg.__wbg_call_ae78342adc33730a=function(){return gr(function(i,s){let a=Ie(i).call(Ie(s));return Ze(a)},arguments)},e.wbg.__wbg_new_36359baae5a47e27=function(){let i=new Object;return Ze(i)},e.wbg.__wbg_call_3ed288a247f13ea5=function(){return gr(function(i,s,a){let f=Ie(i).call(Ie(s),Ie(a));return Ze(f)},arguments)},e.wbg.__wbg_getTime_bffb1c09df09618b=function(i){return Ie(i).getTime()},e.wbg.__wbg_new0_0ff7eb5c1486f3ec=function(){let i=new Date;return Ze(i)},e.wbg.__wbg_new_37705eed627d5ed9=function(i,s){try{var a={a:i,b:s},f=o((p,b)=>{let x=a.a;a.a=0;try{return $O(x,a.b,p,b)}finally{a.a=x}},"cb0");let u=new Promise(f);return Ze(u)}finally{a.a=a.b=0}},e.wbg.__wbg_resolve_a9a87bdd64e9e62c=function(i){let s=Promise.resolve(Ie(i));return Ze(s)},e.wbg.__wbg_then_ce526c837d07b68f=function(i,s){let a=Ie(i).then(Ie(s));return Ze(a)},e.wbg.__wbg_then_842e65b843962f56=function(i,s,a){let f=Ie(i).then(Ie(s),Ie(a));return Ze(f)},e.wbg.__wbg_self_99737b4dcdf6f0d8=function(){return gr(function(){let i=self.self;return Ze(i)},arguments)},e.wbg.__wbg_window_9b61fbbf3564c4fb=function(){return gr(function(){let i=window.window;return Ze(i)},arguments)},e.wbg.__wbg_globalThis_8e275ef40caea3a3=function(){return gr(function(){let i=globalThis.globalThis;return Ze(i)},arguments)},e.wbg.__wbg_global_5de1e0f82bddcd27=function(){return gr(function(){let i=global.global;return Ze(i)},arguments)},e.wbg.__wbg_buffer_7af23f65f6c64548=function(i){let s=Ie(i).buffer;return Ze(s)},e.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974=function(i,s,a){let f=new Uint8Array(Ie(i),s>>>0,a>>>0);return Ze(f)},e.wbg.__wbg_new_cc9018bd6f283b6f=function(i){let s=new Uint8Array(Ie(i));return Ze(s)},e.wbg.__wbg_set_f25e869e4565d2a2=function(i,s,a){Ie(i).set(Ie(s),a>>>0)},e.wbg.__wbg_length_0acb1cf9bbaf8519=function(i){return Ie(i).length},e.wbg.__wbg_newwithlength_8f0657faca9f1422=function(i){let s=new Uint8Array(i>>>0);return Ze(s)},e.wbg.__wbg_subarray_da527dbd24eafb6b=function(i,s,a){let f=Ie(i).subarray(s>>>0,a>>>0);return Ze(f)},e.wbg.__wbg_has_ce995ec88636803d=function(){return gr(function(i,s){return Reflect.has(Ie(i),Ie(s))},arguments)},e.wbg.__wbg_set_93b1c87ee2af852e=function(){return gr(function(i,s,a){return Reflect.set(Ie(i),Ie(s),Ie(a))},arguments)},e.wbg.__wbg_stringify_c760003feffcc1f2=function(){return gr(function(i){let s=JSON.stringify(Ie(i));return Ze(s)},arguments)},e.wbg.__wbindgen_debug_string=function(i,s){let a=Mm(Ie(s)),f=sr(a,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),u=Rt;Xt()[i/4+1]=u,Xt()[i/4+0]=f},e.wbg.__wbindgen_throw=function(i,s){throw new Error(gi(i,s))},e.wbg.__wbindgen_memory=function(){let i=Ae.memory;return Ze(i)},e.wbg.__wbindgen_closure_wrapper10913=function(i,s,a){let f=BO(i,s,3725,UO);return Ze(f)},(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));let{instance:t,module:n}=yield qO(yield r,e);return Ae=t.exports,n5.__wbindgen_wasm_module=n,Ae})}o(n5,"init");var i5=n5;var o5=!1,HO=o((r="https://cdn.filestackcontent.com/dlXanMvQCGDR76JXcBkA")=>Z(void 0,null,function*(){if(!o5)return o5=!0,i5(r)}),"init"),s5=HO;var a5=o(r=>Z(void 0,null,function*(){yield s5(r);let e={};return{pluginMethods:{generateEd25519KeyFromBytes:(t,n)=>JSON.parse(Y4(n)),generateSecp256k1KeyFromBytes:(t,n)=>JSON.parse(J4(n)),keyToDid:(t,n,i)=>{let s=e[n];if(!s){let a=X4(n,JSON.stringify(i));return e[n]=a,a}return s},keyToVerificationMethod:(t,n,i)=>Z(void 0,null,function*(){return Z4(n,JSON.stringify(i))}),issueCredential:(t,n,i,s)=>Z(void 0,null,function*(){return JSON.parse(yield Q4(JSON.stringify(n),JSON.stringify(i),JSON.stringify(s)))}),verifyCredential:(t,n)=>Z(void 0,null,function*(){return JSON.parse(yield e5(JSON.stringify(n),"{}"))}),issuePresentation:(t,n,i,s)=>Z(void 0,null,function*(){return JSON.parse(yield t5(JSON.stringify(n),JSON.stringify(i),JSON.stringify(s)))}),verifyPresentation:(t,n)=>Z(void 0,null,function*(){return JSON.parse(yield r5(JSON.stringify(n),"{}"))})}}}),"getDidKitPlugin");var f5=o((s,...a)=>Z(void 0,[s,...a],function*(r,{ceramicIdx:e=K4,didkit:t,defaultContents:n=[],ethereumConfig:i=V4}={}){let f=yield(yield tf(n)).addPlugin(yield a5(t)),u=yield f.addPlugin(yield c4(f,r)),p=yield u.addPlugin(yield sm(u)),b=yield p.addPlugin(yield ed(p,e)),x=yield b.addPlugin(u4(b)),A=yield x.addPlugin(g4(x,i));return{_wallet:A,did:(O="key")=>A.pluginMethods.getSubjectDid(O),keypair:(O="ed25519")=>A.pluginMethods.getSubjectKeypair(O),issueCredential:A.pluginMethods.issueCredential,verifyCredential:j4(A),issuePresentation:A.pluginMethods.issuePresentation,verifyPresentation:A.pluginMethods.verifyPresentation,getCredential:A.pluginMethods.getVerifiableCredentialFromIdx,getCredentials:A.pluginMethods.getVerifiableCredentialsFromIdx,getCredentialsList:()=>Z(void 0,null,function*(){return(yield A.pluginMethods.getCredentialsListFromIdx()).credentials}),publishCredential:A.pluginMethods.publishContentToCeramic,addCredential:O=>Z(void 0,null,function*(){yield A.pluginMethods.addVerifiableCredentialInIdx(O)}),removeCredential:O=>Z(void 0,null,function*(){yield A.pluginMethods.removeVerifiableCredentialInIdx(O)}),readFromCeramic:A.pluginMethods.readContentFromCeramic,getTestVc:A.pluginMethods.getTestVc,checkMyEth:A.pluginMethods.checkMyEth,checkMyDai:A.pluginMethods.checkMyDai,checkMyUsdc:A.pluginMethods.checkMyUsdc}}),"walletFromKey");
791
+ `):"",this.name="UnsubscriptionError",this.errors=t},"UnsubscriptionErrorImpl")});function ys(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}o(ys,"arrRemove");var go=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return o(r,"Subscription"),r.prototype.unsubscribe=function(){var e,t,n,i,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var f=vs(a),u=f.next();!u.done;u=f.next()){var p=u.value;p.remove(this)}}catch(k){e={error:k}}finally{try{u&&!u.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}else a.remove(this);var b=this.initialTeardown;if(rt(b))try{b()}catch(k){s=k instanceof Ml?k.errors:[k]}var x=this._finalizers;if(x){this._finalizers=null;try{for(var A=vs(x),O=A.next();!O.done;O=A.next()){var T=O.value;try{kx(T)}catch(k){s=s!=null?s:[],k instanceof Ml?s=In(In([],qr(s)),qr(k.errors)):s.push(k)}}}catch(k){n={error:k}}finally{try{O&&!O.done&&(i=A.return)&&i.call(A)}finally{if(n)throw n.error}}}if(s)throw new Ml(s)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)kx(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&ys(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&ys(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}();var Tp=go.EMPTY;function Al(r){return r instanceof go||r&&"closed"in r&&rt(r.remove)&&rt(r.add)&&rt(r.unsubscribe)}o(Al,"isSubscription");function kx(r){rt(r)?r():r.unsubscribe()}o(kx,"execFinalizer");var On={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Fa={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=Fa.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,In([r,e],qr(t))):setTimeout.apply(void 0,In([r,e],qr(t)))},clearTimeout:function(r){var e=Fa.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(r)},delegate:void 0};function Tl(r){Fa.setTimeout(function(){var e=On.onUnhandledError;if(e)e(r);else throw r})}o(Tl,"reportUnhandledError");function kp(){}o(kp,"noop");var Cx=function(){return Cp("C",void 0,void 0)}();function Dx(r){return Cp("E",void 0,r)}o(Dx,"errorNotification");function Ix(r){return Cp("N",r,void 0)}o(Ix,"nextNotification");function Cp(r,e,t){return{kind:r,value:e,error:t}}o(Cp,"createNotification");var xs=null;function $a(r){if(On.useDeprecatedSynchronousErrorHandling){var e=!xs;if(e&&(xs={errorThrown:!1,error:null}),r(),e){var t=xs,n=t.errorThrown,i=t.error;if(xs=null,n)throw i}}else r()}o($a,"errorContext");function Ox(r){On.useDeprecatedSynchronousErrorHandling&&xs&&(xs.errorThrown=!0,xs.error=r)}o(Ox,"captureError");var ic=function(r){hr(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Al(t)&&t.add(n)):n.destination=Wk,n}return o(e,"Subscriber"),e.create=function(t,n,i){return new Cl(t,n,i)},e.prototype.next=function(t){this.isStopped?Ip(Ix(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?Ip(Dx(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?Ip(Cx,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(go);var jk=Function.prototype.bind;function Dp(r,e){return jk.call(r,e)}o(Dp,"bind");var Kk=function(){function r(e){this.partialObserver=e}return o(r,"ConsumerObserver"),r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){kl(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){kl(n)}else kl(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){kl(t)}},r}(),Cl=function(r){hr(e,r);function e(t,n,i){var s=r.call(this)||this,a;if(rt(t)||!t)a={next:t!=null?t:void 0,error:n!=null?n:void 0,complete:i!=null?i:void 0};else{var f;s&&On.useDeprecatedNextContext?(f=Object.create(t),f.unsubscribe=function(){return s.unsubscribe()},a={next:t.next&&Dp(t.next,f),error:t.error&&Dp(t.error,f),complete:t.complete&&Dp(t.complete,f)}):a=t}return s.destination=new Kk(a),s}return o(e,"SafeSubscriber"),e}(ic);function kl(r){On.useDeprecatedSynchronousErrorHandling?Ox(r):Tl(r)}o(kl,"handleUnhandledError");function Vk(r){throw r}o(Vk,"defaultErrorHandler");function Ip(r,e){var t=On.onStoppedNotification;t&&Fa.setTimeout(function(){return t(r,e)})}o(Ip,"handleStoppedNotification");var Wk={closed:!0,next:kp,error:Vk,complete:kp};var qa=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Ha(r){return r}o(Ha,"identity");function Px(r){return r.length===0?Ha:r.length===1?r[0]:o(function(t){return r.reduce(function(n,i){return i(n)},t)},"piped")}o(Px,"pipeFromArray");var _t=function(){function r(e){e&&(this._subscribe=e)}return o(r,"Observable"),r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var i=this,s=Yk(e)?e:new Cl(e,t,n);return $a(function(){var a=i,f=a.operator,u=a.source;s.add(f?f.call(s,u):u?i._subscribe(s):i._trySubscribe(s))}),s},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=Nx(t),new t(function(i,s){var a=new Cl({next:function(f){try{e(f)}catch(u){s(u),a.unsubscribe()}},error:s,complete:i});n.subscribe(a)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[qa]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Px(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=Nx(e),new e(function(n,i){var s;t.subscribe(function(a){return s=a},function(a){return i(a)},function(){return n(s)})})},r.create=function(e){return new r(e)},r}();function Nx(r){var e;return(e=r!=null?r:On.Promise)!==null&&e!==void 0?e:Promise}o(Nx,"getPromiseCtor");function Gk(r){return r&&rt(r.next)&&rt(r.error)&&rt(r.complete)}o(Gk,"isObserver");function Yk(r){return r&&r instanceof ic||Gk(r)&&Al(r)}o(Yk,"isSubscriber");function Jk(r){return rt(r==null?void 0:r.lift)}o(Jk,"hasLift");function Yt(r){return function(e){if(Jk(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}o(Yt,"operate");function Jt(r,e,t,n,i){return new Xk(r,e,t,n,i)}o(Jt,"createOperatorSubscriber");var Xk=function(r){hr(e,r);function e(t,n,i,s,a,f){var u=r.call(this,t)||this;return u.onFinalize=a,u.shouldUnsubscribe=f,u._next=n?function(p){try{n(p)}catch(b){t.error(b)}}:r.prototype._next,u._error=s?function(p){try{s(p)}catch(b){t.error(b)}finally{this.unsubscribe()}}:r.prototype._error,u._complete=i?function(){try{i()}catch(p){t.error(p)}finally{this.unsubscribe()}}:r.prototype._complete,u}return o(e,"OperatorSubscriber"),e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(ic);var Rx=Ua(function(r){return o(function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl")});var Op=function(r){hr(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return o(e,"Subject"),e.prototype.lift=function(t){var n=new Lx(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Rx},e.prototype.next=function(t){var n=this;$a(function(){var i,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=vs(n.currentObservers),f=a.next();!f.done;f=a.next()){var u=f.value;u.next(t)}}catch(p){i={error:p}}finally{try{f&&!f.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var n=this;$a(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var i=n.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;$a(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,s=i.hasError,a=i.isStopped,f=i.observers;return s||a?Tp:(this.currentObservers=null,f.push(t),new go(function(){n.currentObservers=null,ys(f,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,s=n.thrownError,a=n.isStopped;i?t.error(s):a&&t.complete()},e.prototype.asObservable=function(){var t=new _t;return t.source=this,t},e.create=function(t,n){return new Lx(t,n)},e}(_t);var Lx=function(r){hr(e,r);function e(t,n){var i=r.call(this)||this;return i.destination=t,i.source=n,i}return o(e,"AnonymousSubject"),e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:Tp},e}(Op);var Pp=function(r){hr(e,r);function e(t){var n=r.call(this)||this;return n._value=t,n}return o(e,"BehaviorSubject"),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=r.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,s=t._value;if(n)throw i;return this._throwIfClosed(),s},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t)},e}(Op);var Np={now:function(){return(Np.delegate||Date).now()},delegate:void 0};var Bx=function(r){hr(e,r);function e(t,n){return r.call(this)||this}return o(e,"Action"),e.prototype.schedule=function(t,n){return n===void 0&&(n=0),this},e}(go);var oc={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=oc.delegate;return i!=null&&i.setInterval?i.setInterval.apply(i,In([r,e],qr(t))):setInterval.apply(void 0,In([r,e],qr(t)))},clearInterval:function(r){var e=oc.delegate;return((e==null?void 0:e.clearInterval)||clearInterval)(r)},delegate:void 0};var Ux=function(r){hr(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.pending=!1,i}return o(e,"AsyncAction"),e.prototype.schedule=function(t,n){if(n===void 0&&(n=0),this.closed)return this;this.state=t;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,n)),this.pending=!0,this.delay=n,this.id=this.id||this.requestAsyncId(s,this.id,n),this},e.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),oc.setInterval(t.flush.bind(t,this),i)},e.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return n;oc.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(t,n);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var i=!1,s;try{this.work(t)}catch(a){i=!0,s=a||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,i=t.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,ys(s,this),n!=null&&(this.id=this.recycleAsyncId(i,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e}(Bx);var Rp=function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return o(r,"Scheduler"),r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=Np.now,r}();var Fx=function(r){hr(e,r);function e(t,n){n===void 0&&(n=Rp.now);var i=r.call(this,t,n)||this;return i.actions=[],i._active=!1,i._scheduled=void 0,i}return o(e,"AsyncScheduler"),e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var i;this._active=!0;do if(i=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,i){for(;t=n.shift();)t.unsubscribe();throw i}},e}(Rp);var Zk=new Fx(Ux),$x=Zk;var Dl=new _t(function(r){return r.complete()});function Il(r){return r&&rt(r.schedule)}o(Il,"isScheduler");function qx(r){return r[r.length-1]}o(qx,"last");function Hx(r){return Il(qx(r))?r.pop():void 0}o(Hx,"popScheduler");function zx(r,e){return typeof qx(r)=="number"?r.pop():e}o(zx,"popNumber");var za=o(function(r){return r&&typeof r.length=="number"&&typeof r!="function"},"isArrayLike");function Ol(r){return rt(r==null?void 0:r.then)}o(Ol,"isPromise");function Pl(r){return rt(r[qa])}o(Pl,"isInteropObservable");function Nl(r){return Symbol.asyncIterator&&rt(r==null?void 0:r[Symbol.asyncIterator])}o(Nl,"isAsyncIterable");function Rl(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}o(Rl,"createInvalidObservableTypeError");function Qk(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}o(Qk,"getSymbolIterator");var Ll=Qk();function Bl(r){return rt(r==null?void 0:r[Ll])}o(Bl,"isIterable");function Ul(r){return Ax(this,arguments,o(function(){var t,n,i,s;return El(this,function(a){switch(a.label){case 0:t=r.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Sl(t.read())];case 3:return n=a.sent(),i=n.value,s=n.done,s?[4,Sl(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Sl(i)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"))}o(Ul,"readableStreamLikeToAsyncGenerator");function Fl(r){return rt(r==null?void 0:r.getReader)}o(Fl,"isReadableStreamLike");function pr(r){if(r instanceof _t)return r;if(r!=null){if(Pl(r))return eC(r);if(za(r))return tC(r);if(Ol(r))return rC(r);if(Nl(r))return jx(r);if(Bl(r))return nC(r);if(Fl(r))return iC(r)}throw Rl(r)}o(pr,"innerFrom");function eC(r){return new _t(function(e){var t=r[qa]();if(rt(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}o(eC,"fromInteropObservable");function tC(r){return new _t(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}o(tC,"fromArrayLike");function rC(r){return new _t(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Tl)})}o(rC,"fromPromise");function nC(r){return new _t(function(e){var t,n;try{for(var i=vs(r),s=i.next();!s.done;s=i.next()){var a=s.value;if(e.next(a),e.closed)return}}catch(f){t={error:f}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}o(nC,"fromIterable");function jx(r){return new _t(function(e){oC(r,e).catch(function(t){return e.error(t)})})}o(jx,"fromAsyncIterable");function iC(r){return jx(Ul(r))}o(iC,"fromReadableStreamLike");function oC(r,e){var t,n,i,s;return Mx(this,void 0,void 0,function(){var a,f;return El(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),t=Tx(r),u.label=1;case 1:return[4,t.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(a=n.value,e.next(a),e.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return f=u.sent(),i={error:f},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(s=t.return)?[4,s.call(t)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}o(oC,"process");function pn(r,e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var s=e.schedule(function(){t(),i?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(s),!i)return s}o(pn,"executeSchedule");function $l(r,e){return e===void 0&&(e=0),Yt(function(t,n){t.subscribe(Jt(n,function(i){return pn(n,r,function(){return n.next(i)},e)},function(){return pn(n,r,function(){return n.complete()},e)},function(i){return pn(n,r,function(){return n.error(i)},e)}))})}o($l,"observeOn");function ql(r,e){return e===void 0&&(e=0),Yt(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}o(ql,"subscribeOn");function Kx(r,e){return pr(r).pipe(ql(e),$l(e))}o(Kx,"scheduleObservable");function Vx(r,e){return pr(r).pipe(ql(e),$l(e))}o(Vx,"schedulePromise");function Wx(r,e){return new _t(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}o(Wx,"scheduleArray");function Gx(r,e){return new _t(function(t){var n;return pn(t,e,function(){n=r[Ll](),pn(t,e,function(){var i,s,a;try{i=n.next(),s=i.value,a=i.done}catch(f){t.error(f);return}a?t.complete():t.next(s)},0,!0)}),function(){return rt(n==null?void 0:n.return)&&n.return()}})}o(Gx,"scheduleIterable");function Hl(r,e){if(!r)throw new Error("Iterable cannot be null");return new _t(function(t){pn(t,e,function(){var n=r[Symbol.asyncIterator]();pn(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}o(Hl,"scheduleAsyncIterable");function Yx(r,e){return Hl(Ul(r),e)}o(Yx,"scheduleReadableStreamLike");function Jx(r,e){if(r!=null){if(Pl(r))return Kx(r,e);if(za(r))return Wx(r,e);if(Ol(r))return Vx(r,e);if(Nl(r))return Hl(r,e);if(Bl(r))return Gx(r,e);if(Fl(r))return Yx(r,e)}throw Rl(r)}o(Jx,"scheduled");function Xx(r,e){return e?Jx(r,e):pr(r)}o(Xx,"from");var zl=Ua(function(r){return o(function(){r(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl")});function Zx(r){return r instanceof Date&&!isNaN(r)}o(Zx,"isValidDate");function jl(r,e){return Yt(function(t,n){var i=0;t.subscribe(Jt(n,function(s){n.next(r.call(e,s,i++))}))})}o(jl,"map");var sC=Array.isArray;function aC(r,e){return sC(e)?r.apply(void 0,In([],qr(e))):r(e)}o(aC,"callOrApply");function Qx(r){return jl(function(e){return aC(r,e)})}o(Qx,"mapOneOrManyArgs");function ew(r,e,t,n,i,s,a,f){var u=[],p=0,b=0,x=!1,A=o(function(){x&&!u.length&&!p&&e.complete()},"checkComplete"),O=o(function(k){return p<n?T(k):u.push(k)},"outerNext"),T=o(function(k){s&&e.next(k),p++;var $=!1;pr(t(k,b++)).subscribe(Jt(e,function(C){i==null||i(C),s?O(C):e.next(C)},function(){$=!0},void 0,function(){if($)try{p--;for(var C=o(function(){var B=u.shift();a?pn(e,a,function(){return T(B)}):T(B)},"_loop_1");u.length&&p<n;)C();A()}catch(B){e.error(B)}}))},"doInnerSub");return r.subscribe(Jt(e,O,function(){x=!0,A()})),function(){f==null||f()}}o(ew,"mergeInternals");function sc(r,e,t){return t===void 0&&(t=1/0),rt(e)?sc(function(n,i){return jl(function(s,a){return e(n,s,i,a)})(pr(r(n,i)))},t):(typeof e=="number"&&(t=e),Yt(function(n,i){return ew(n,i,r,t)}))}o(sc,"mergeMap");function tw(r){return r===void 0&&(r=1/0),sc(Ha,r)}o(tw,"mergeAll");var fC=["addListener","removeListener"],cC=["addEventListener","removeEventListener"],uC=["on","off"];function ac(r,e,t,n){if(rt(t)&&(n=t,t=void 0),n)return ac(r,e,t).pipe(Qx(n));var i=qr(hC(r)?cC.map(function(f){return function(u){return r[f](e,u,t)}}):lC(r)?fC.map(rw(r,e)):dC(r)?uC.map(rw(r,e)):[],2),s=i[0],a=i[1];if(!s&&za(r))return sc(function(f){return ac(f,e,t)})(pr(r));if(!s)throw new TypeError("Invalid event target");return new _t(function(f){var u=o(function(){for(var p=[],b=0;b<arguments.length;b++)p[b]=arguments[b];return f.next(1<p.length?p:p[0])},"handler");return s(u),function(){return a(u)}})}o(ac,"fromEvent");function rw(r,e){return function(t){return function(n){return r[t](e,n)}}}o(rw,"toCommonHandlerRegistry");function lC(r){return rt(r.addListener)&&rt(r.removeListener)}o(lC,"isNodeStyleEventEmitter");function dC(r){return rt(r.on)&&rt(r.off)}o(dC,"isJQueryStyleEventEmitter");function hC(r){return rt(r.addEventListener)&&rt(r.removeEventListener)}o(hC,"isEventTarget");function fc(r,e,t){r===void 0&&(r=0),t===void 0&&(t=$x);var n=-1;return e!=null&&(Il(e)?t=e:n=e),new _t(function(i){var s=Zx(r)?+r-t.now():r;s<0&&(s=0);var a=0;return t.schedule(function(){i.closed||(i.next(a++),0<=n?this.schedule(void 0,n):i.complete())},s)})}o(fc,"timer");function Lp(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Hx(r),n=zx(r,1/0),i=r;return i.length?i.length===1?pr(i[0]):tw(n)(Xx(i,t)):Dl}o(Lp,"merge");function nw(r,e){return Yt(function(t,n){var i=0;t.subscribe(Jt(n,function(s){return r.call(e,s,i++)&&n.next(s)}))})}o(nw,"filter");function iw(r){return Yt(function(e,t){var n=!1;e.subscribe(Jt(t,function(i){n=!0,t.next(i)},function(){n||t.next(r),t.complete()}))})}o(iw,"defaultIfEmpty");function ow(r){return r<=0?function(){return Dl}:Yt(function(e,t){var n=0;e.subscribe(Jt(t,function(i){++n<=r&&(t.next(i),r<=n&&t.complete())}))})}o(ow,"take");function sw(r){return r===void 0&&(r=pC),Yt(function(e,t){var n=!1;e.subscribe(Jt(t,function(i){n=!0,t.next(i)},function(){return n?t.complete():t.error(r())}))})}o(sw,"throwIfEmpty");function pC(){return new zl}o(pC,"defaultErrorFactory");function Bp(r,e){var t=arguments.length>=2;return function(n){return n.pipe(r?nw(function(i,s){return r(i,s,n)}):Ha,ow(1),t?iw(e):sw(function(){return new zl}))}}o(Bp,"first");var mC={leading:!0,trailing:!1};function Up(r,e){return e===void 0&&(e=mC),Yt(function(t,n){var i=e.leading,s=e.trailing,a=!1,f=null,u=null,p=!1,b=o(function(){u==null||u.unsubscribe(),u=null,s&&(O(),p&&n.complete())},"endThrottling"),x=o(function(){u=null,p&&n.complete()},"cleanupThrottling"),A=o(function(T){return u=pr(r(T)).subscribe(Jt(n,b,x))},"startThrottle"),O=o(function(){if(a){a=!1;var T=f;f=null,n.next(T),!p&&A(T)}},"send");t.subscribe(Jt(n,function(T){a=!0,f=T,!(u&&!u.closed)&&(i?O():A(T))},function(){p=!0,!(s&&a&&u&&!u.closed)&&n.complete()}))})}o(Up,"throttle");var aw;(function(r){r[r.GENESIS=0]="GENESIS",r[r.PARTIAL=1]="PARTIAL",r[r.SIGNED=2]="SIGNED"})(aw||(aw={}));var ws;(function(r){r[r.NOT_REQUESTED=0]="NOT_REQUESTED",r[r.PENDING=1]="PENDING",r[r.PROCESSING=2]="PROCESSING",r[r.ANCHORED=3]="ANCHORED",r[r.FAILED=4]="FAILED"})(ws||(ws={}));var $p;(function(r){r[r.GENESIS=0]="GENESIS",r[r.SIGNED=1]="SIGNED",r[r.ANCHOR=2]="ANCHOR"})($p||($p={}));var Pn=class extends _t{constructor(e,t){super(n=>{e.subscribe(n)}),this.state$=e,this._context=t}get id(){return new Je(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){var n;let{next:e,content:t}=this.state$.value;return(0,Fp.default)((n=e==null?void 0:e.content)!=null?n:t)}get controllers(){return this.metadata.controllers}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return ht.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>ht.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===$p.ANCHOR).map(({cid:e})=>ht.make(this.id,e))}get state(){return(0,Fp.default)(this.state$.value)}sync(){return Z(this,arguments,function*(e={}){e=re({sync:Ct.PREFER_CACHE},e);let t=yield this.api.loadStream(this.id,e);this.state$.next(t.state)})}requestAnchor(){return Z(this,null,function*(){return this.api.requestAnchor(this.id)})}};o(Pn,"Stream");function vo(){return r=>{}}o(vo,"StreamStatic");var uw=at(require("cross-fetch"),1);function fw(r){let e=new AbortController;if(r.length===0)throw Error("Need abort signals to create a merged abort signal");return r.some(t=>t.aborted)?(e.abort(),e.signal):(Lp(...r.map(t=>ac(t,"abort"))).pipe(Bp()).subscribe(()=>{e.abort()}),e.signal)}o(fw,"mergeAbortSignals");var cc=class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=fc(e).subscribe(()=>{t.abort()})}clear(){var e;(e=this._subscription)==null||e.unsubscribe()}};o(cc,"TimedAbortSignal");function cw(r,e){return Z(this,null,function*(){let t=new AbortController,n=o(()=>{t.abort()},"onAbort");return r.addEventListener("abort",n),r.aborted&&t.abort(),e(t.signal).finally(()=>{r.removeEventListener("abort",n)})})}o(cw,"abortable");var bC=60*1e3*3;function wr(t){return Z(this,arguments,function*(r,e={}){e.body&&Object.assign(e,{body:JSON.stringify(e.body),headers:{"Content-Type":"application/json"}});let n=e.timeout||bC,i=new cc(n),s=e.signal?fw([e.signal,i.signal]):i.signal,a=yield cw(s,f=>(0,uw.default)(String(r),Te(re({},e),{signal:f}))).finally(()=>i.clear());if(!a.ok){let f=yield a.text();throw new Error(`HTTP request to '${r}' failed with status '${a.statusText}': ${f}`)}return a.json()})}o(wr,"fetchJson");var uc=at(nc(),1);Vn();function Ui(r){let e=Pe.asCID(r);if(e)return e;if(typeof r=="string")return Pe.parse(r);if(r instanceof Uint8Array)return Pe.decode(r);throw new Error(`${r} cannot be converted to a CID`)}o(Ui,"toCID");var lw=0,yt=class{static streamIdFromState(e){return new Je(e.type,e.log[0].cid)}static serializeCommit(e){var n;let t=(0,uc.default)(e);return yt.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=It(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=It(t.cacaoBlock,"base64")),t):(yt.isSignedCommit(e)&&(t.link=t.link.toString()),yt.isAnchorCommit(e)&&(t.proof=t.proof.toString()),t.id&&(t.id=t.id.toString()),t.prev&&(t.prev=t.prev.toString()),(n=e.header)!=null&&n.model&&(t.header.model=e.header.model.toString()),t)}static deserializeCommit(e){var n;let t=(0,uc.default)(e);return yt.isSignedCommitContainer(t)?(t.jws.link=Ui(t.jws.link),t.linkedBlock=Lt(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Lt(t.cacaoBlock,"base64")),t):(yt.isSignedCommit(t)&&(t.link=Ui(t.link)),yt.isAnchorCommit(t)&&(t.proof=Ui(t.proof)),t.id&&(t.id=Ui(t.id)),t.prev&&(t.prev=Ui(t.prev)),(n=t.header)!=null&&n.model&&(t.header.model=Je.fromString(t.header.model)),t)}static serializeState(e){var n,i,s,a;let t=(0,uc.default)(e);return t.log=t.log.map(f=>Te(re({},f),{cid:f.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=ws[t.anchorStatus]),t.anchorScheduledFor!=null&&(t.anchorScheduledFor=new Date(t.anchorScheduledFor).toISOString()),t.anchorProof!=null&&(t.anchorProof.txHash=t.anchorProof.txHash.toString(),t.anchorProof.root=t.anchorProof.root.toString()),(n=e.metadata)!=null&&n.model&&(t.metadata.model=e.metadata.model.toString()),(s=(i=e.next)==null?void 0:i.metadata)!=null&&s.model&&(t.next.metadata.model=e.next.metadata.model.toString()),((a=e.metadata)==null?void 0:a.unique)&&e.type!=lw&&(t.metadata.unique=It(t.metadata.unique,"base64")),t.doctype=Cr.nameByCode(t.type),t}static deserializeState(e){var i,s,a,f;let t=(0,uc.default)(e);t.doctype&&(t.type=Cr.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(u=>Te(re({},u),{cid:Ui(u.cid)})),t.anchorProof&&(t.anchorProof.txHash=Ui(t.anchorProof.txHash),t.anchorProof.root=Ui(t.anchorProof.root));let n=!0;return t.anchorStatus&&(t.anchorStatus=ws[t.anchorStatus],n=t.anchorStatus!==ws.FAILED&&t.anchorStatus!==ws.ANCHORED),t.anchorScheduledFor&&(n?t.anchorScheduledFor=Date.parse(t.anchorScheduledFor):delete t.anchorScheduledFor),(i=e.metadata)!=null&&i.model&&(t.metadata.model=Je.fromString(e.metadata.model)),(a=(s=e.next)==null?void 0:s.metadata)!=null&&a.model&&(t.next.metadata.model=Je.fromString(e.next.metadata.model)),((f=e.metadata)==null?void 0:f.unique)&&e.type!=lw&&(t.metadata.unique=Lt(e.metadata.unique,"base64")),t}static statesEqual(e,t){return JSON.stringify(yt.serializeState(e))===JSON.stringify(yt.serializeState(t))}static isStateSupersetOf(e,t){if(e.log.length<t.log.length)return!1;for(let n in t.log)if(!e.log[n].cid.equals(t.log[n].cid))return!1;return e.anchorStatus==t.anchorStatus}static assertCommitLinksToState(e,t){let n=this.streamIdFromState(e);if(t.id&&!t.id.equals(e.log[0].cid))throw new Error(`Invalid genesis CID in commit for StreamID ${n.toString()}. Found: ${t.id}, expected ${e.log[0].cid}`);let i=e.log[e.log.length-1].cid;if(!t.prev.equals(i))throw new Error(`Commit doesn't properly point to previous commit in log. Expected ${i}, found 'prev' ${t.prev}`)}static convertCommitToSignedCommitContainer(e,t){return Z(this,null,function*(){if(yt.isSignedCommit(e)){let n=yield t.block.get(e.link);return{jws:e,linkedBlock:n}}return e})}static isSignedCommitContainer(e){return e&&e.jws!==void 0}static isSignedCommit(e){return e&&e.link!==void 0}static isAnchorCommit(e){return e&&e.proof!==void 0}static isSignedCommitData(e){return e&&e.envelope!==void 0}static isAnchorCommitData(e){return e&&e.proof!==void 0}};o(yt,"StreamUtils");function dw(r){if(typeof r=="string"&&r.includes("@")){let[e,t]=r.split("@");if(!e||!t)throw new Error("Invalid accountId provided");return new fs({address:e,chainId:t})}return new fs(r)}o(dw,"normalizeAccountId");var lc=class extends Pp{next(e){let t=this.value;yt.statesEqual(t,e)||super.next(e)}};o(lc,"StreamStateSubject");var gC=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Hr,qp={anchor:!0,publish:!0,pin:!0,sync:Ct.PREFER_CACHE},vC={sync:Ct.PREFER_CACHE},hw={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function Hp(r,e){var n;if(typeof(r==null?void 0:r.schema)=="string")try{ht.fromString(r.schema)}catch(i){throw new Error("Schema must be a CommitID")}let t={controllers:r==null?void 0:r.controllers,family:r==null?void 0:r.family,schema:(n=r==null?void 0:r.schema)==null?void 0:n.toString(),tags:r==null?void 0:r.tags};if(e)r!=null&&r.deterministic||(t.unique=It((0,bw.randomBytes)(12),"base64")),r!=null&&r.forbidControllerChange&&(t.forbidControllerChange=!0);else{if((r==null?void 0:r.deterministic)!==void 0||(r==null?void 0:r.unique)!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if((r==null?void 0:r.forbidControllerChange)!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(t).forEach(i=>t[i]===void 0&&delete t[i]),t}o(Hp,"headerFromMetadata");function pw(r){return Z(this,null,function*(){if(r.did==null)throw new Error("No DID provided");r.did.authenticated||(yield r.did.authenticate(),r.loggerProvider&&r.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${r.did.id}`))})}o(pw,"_ensureAuthenticated");function zp(){return Z(this,null,function*(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")})}o(zp,"throwReadOnlyError");var zr=Hr=o(class extends Pn{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){var n;let{next:e,metadata:t}=this.state$.value;return(0,mw.default)((n=e==null?void 0:e.metadata)!=null?n:t)}static create(s,a,f){return Z(this,arguments,function*(e,t,n,i={}){i=re(re({},qp),i),!(n!=null&&n.deterministic)&&i.syncTimeoutSeconds==null&&(i.syncTimeoutSeconds=0);let u=i.asDID?{did:i.asDID}:e,p=yield Hr.makeGenesis(u,t,n);return e.createStreamFromGenesis(Hr.STREAM_TYPE_ID,p,i)})}static createFromGenesis(i,s){return Z(this,arguments,function*(e,t,n={}){var f;n=re(re({},qp),n),((f=t.header)==null?void 0:f.unique)&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=t.data?yield Hr._signDagJWS(e,t):t;return e.createStreamFromGenesis(Hr.STREAM_TYPE_ID,a,n)})}static deterministic(i,s){return Z(this,arguments,function*(e,t,n={}){if(n=re(re({},qp),n),t=Te(re({},t),{deterministic:!0}),t.family==null&&t.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=yield Hr.makeGenesis(e,null,t);return e.createStreamFromGenesis(Hr.STREAM_TYPE_ID,a,n)})}static load(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},vC),n);let a=xr.from(t);if(a.type!=Hr.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${Hr.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}update(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},hw),n);let a=n.asDID?{did:n.asDID}:this.api,f=yield this.makeCommit(a,e,t),u=yield this.api.applyCommit(this.id,f,n);this.state$.next(u.state)})}patch(n){return Z(this,arguments,function*(e,t={}){t=re(re({},hw),t);let s={header:Hp(this.metadata,!1),data:e,prev:this.tip,id:this.id.cid},a=yield Hr._signDagJWS(this.api,s),f=yield this.api.applyCommit(this.id,a,t);this.state$.next(f.state)})}makeReadOnly(){this.update=zp,this.patch=zp,this.sync=zp,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}makeCommit(e,t,n){return Z(this,null,function*(){let i=yield this._makeRawCommit(e,t,n);return Hr._signDagJWS(e,i)})}_makeRawCommit(e,t,n){return Z(this,null,function*(){let i=Hp(n,!1);if(t==null&&(t=this.content),i.controllers){if(i.controllers.length!==1)throw new Error("Exactly one controller must be specified");if(!i.controllers[0])throw new Error("Controller cannot be updated to an undefined value.")}let s=Oa.compare(this.content,t);return{header:i,data:s,prev:this.tip,id:this.state.log[0].cid}})}static makeGenesis(e,t,n){return Z(this,null,function*(){var a;if(n||(n={}),!n.controllers||n.controllers.length===0)if(e.did)yield pw(e),n.controllers=[e.did.hasParent?e.did.parent:e.did.id];else throw new Error("No controllers specified");if(((a=n.controllers)==null?void 0:a.length)!==1)throw new Error("Exactly one controller must be specified");let i=Hp(n,!0);if((n==null?void 0:n.deterministic)&&t)throw new Error("Initial content must be null when creating a deterministic Tile document");if(t==null){let f={header:i};return If(f),f}let s={data:t,header:i};return Hr._signDagJWS(e,s)})}static _signDagJWS(e,t){return Z(this,null,function*(){return yield pw(e),e.did.createDagJWS(t)})}},"TileDocument");zr.STREAM_TYPE_NAME="tile";zr.STREAM_TYPE_ID=0;zr=Hr=gC([vo()],zr);var Sw=at(xw(),1);function TC(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(TC,"_checkPrivateRedeclaration");function kC(r,e){return e.get?e.get.call(r):e.value}o(kC,"_classApplyDescriptorGet");function CC(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(CC,"_classApplyDescriptorSet");function Ew(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(Ew,"_classExtractFieldDescriptor");function Vp(r,e){var t=Ew(r,e,"get");return kC(r,t)}o(Vp,"_classPrivateFieldGet");function ww(r,e,t){TC(r,e),e.set(r,t)}o(ww,"_classPrivateFieldInit");function _w(r,e,t){var n=Ew(r,e,"set");return CC(r,n,t),t}o(_w,"_classPrivateFieldSet");function DC(r){return typeof r=="string"||ht.isInstance(r)||Je.isInstance(r)?{streamId:r}:{streamId:r.streamId,genesis:r.genesis}}o(DC,"keyToQuery");function Wp(r){return typeof r=="string"?xr.from(r).toString():ht.isInstance(r)||Je.isInstance(r)?r.toString():r.streamId.toString()}o(Wp,"keyToString");function Yp(r){return Z(this,null,function*(){let e=yield zr.makeGenesis({},null,Te(re({},r),{deterministic:!0})),t=yield Je.fromGenesis("tile",e);return{genesis:e,streamId:t}})}o(Yp,"getDeterministicQuery");var IC=o(()=>Promise.resolve([]),"tempBatchLoadFn"),Kl=new WeakMap,Gp=new WeakMap,mn=class extends Sw.default{cache(e){if(!Vp(this,Gp))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}create(e,t,n){return Z(this,null,function*(){let i=yield zr.create(Vp(this,Kl),e,t,n);return this.cache(i),i})}deterministic(e,t){return Z(this,null,function*(){let n=yield Yp(e);try{return yield md(mn.prototype,this,"load").call(this,n)}catch(i){let s=yield zr.createFromGenesis(Vp(this,Kl),n.genesis,t);return this.cache(s),s}})}load(e){return Z(this,null,function*(){return yield md(mn.prototype,this,"load").call(this,e)})}update(e,t,n,i){return Z(this,null,function*(){let s=Wp(e);this.clear(s);let a=yield this.load({streamId:s});return yield a.update(t,n,i),a})}constructor(e){super(IC,{cache:!0,cacheKeyFn:Wp,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),ww(this,Kl,{writable:!0,value:void 0}),ww(this,Gp,{writable:!0,value:void 0}),this._batchLoadFn=t=>Z(this,null,function*(){e.cache||this.clearAll();let n=yield e.ceramic.multiQuery(t.map(DC),e.multiqueryTimeout);return t.map(i=>{let s=Wp(i),a=n[s];return a||new Error(`Failed to load stream: ${s}`)})}),_w(this,Kl,e.ceramic),_w(this,Gp,!!e.cache)}};o(mn,"TileLoader");function OC(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(OC,"_checkPrivateRedeclaration");function PC(r,e){return e.get?e.get.call(r):e.value}o(PC,"_classApplyDescriptorGet");function NC(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(NC,"_classApplyDescriptorSet");function Aw(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(Aw,"_classExtractFieldDescriptor");function _s(r,e){var t=Aw(r,e,"get");return PC(r,t)}o(_s,"_classPrivateFieldGet");function Mw(r,e,t){OC(r,e),e.set(r,t)}o(Mw,"_classPrivateFieldInit");function Jp(r,e,t){var n=Aw(r,e,"set");return NC(r,n,t),t}o(Jp,"_classPrivateFieldSet");var ja=new WeakMap,Ka=new WeakMap,Va=class{get aliases(){return _s(this,ja)}get loader(){return _s(this,Ka)}getDefinitionID(e){var t;return(t=_s(this,ja).definitions[e])!=null?t:null}getSchemaURL(e){var t;return(t=_s(this,ja).schemas[e])!=null?t:null}getTileID(e){var t;return(t=_s(this,ja).tiles[e])!=null?t:null}loadTile(e){return Z(this,null,function*(){let t=this.getTileID(e);if(t==null)throw new Error(`Tile alias "${e}" is not defined`);return yield _s(this,Ka).load(t)})}createTile(i,s){return Z(this,arguments,function*(e,t,n={}){let a=this.getSchemaURL(e);if(a==null)throw new Error(`Schema alias "${e}" is not defined`);let b=n,{controller:f}=b,u=Cm(b,["controller"]),p={schema:a};return f!=null&&(p.controllers=[f]),yield _s(this,Ka).create(t,p,u)})}constructor(e){if(Mw(this,ja,{writable:!0,value:void 0}),Mw(this,Ka,{writable:!0,value:void 0}),Jp(this,ja,e.aliases),e.loader!=null)Jp(this,Ka,e.loader);else{if(e.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");Jp(this,Ka,new mn({ceramic:e.ceramic,cache:e.cache}))}}};o(Va,"DataModel");function RC(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(RC,"_checkPrivateRedeclaration");function LC(r,e){return e.get?e.get.call(r):e.value}o(LC,"_classApplyDescriptorGet");function BC(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(BC,"_classApplyDescriptorSet");function Tw(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(Tw,"_classExtractFieldDescriptor");function li(r,e){var t=Tw(r,e,"get");return LC(r,t)}o(li,"_classPrivateFieldGet");function Vl(r,e,t){RC(r,e),e.set(r,t)}o(Vl,"_classPrivateFieldInit");function Wl(r,e,t){var n=Tw(r,e,"set");return BC(r,n,t),t}o(Wl,"_classPrivateFieldSet");var Gl=new WeakMap,Es=new WeakMap,Xp=new WeakMap,Yl=new WeakMap,dc=class{_createValuePromise(){Wl(this,Xp,new Promise((e,t)=>{Wl(this,Yl,{resolve:e,reject:t})}))}change(e){return new Promise((t,n)=>{let i=o(s=>Z(this,null,function*(){try{let a=yield e(s);t(),this._next(a)}catch(a){n(a),this._next(s)}}),"run");li(this,Es).push({reject:n,run:i}),li(this,Es).length===1&&this._start()})}changeContent(e){return Z(this,null,function*(){let t=o(n=>Z(this,null,function*(){return yield n.update(e(n.content),n.metadata),n}),"mutation");return yield this.change(t)})}get(){return Z(this,null,function*(){return li(this,Es).length===0?yield li(this,Gl).call(this):yield li(this,Xp)})}_start(){return Z(this,null,function*(){try{let e=yield li(this,Gl).call(this);this._next(e)}catch(e){li(this,Es).forEach(t=>{t.reject(e)}),Wl(this,Es,[]),li(this,Yl).reject(e),this._createValuePromise()}})}_next(e){let t=li(this,Es).shift();t==null?this._end(e):t.run(e)}_end(e){li(this,Yl).resolve(e),this._createValuePromise()}constructor(e){Vl(this,Gl,{writable:!0,value:void 0}),Vl(this,Es,{writable:!0,value:[]}),Vl(this,Xp,{writable:!0,value:void 0}),Vl(this,Yl,{writable:!0,value:void 0}),Wl(this,Gl,e),this._createValuePromise()}};o(dc,"TileProxy");var UC=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function FC(r){return UC.test(r)}o(FC,"isDIDstring");function $C(r){if(!FC(r))throw new Error(`Invalid DID: ${r}`)}o($C,"assertDIDstring");function Zp(r){return $C(r),{controllers:[r],family:"IDX"}}o(Zp,"getIDXMetadata");function qC(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(qC,"_checkPrivateRedeclaration");function HC(r,e){return e.get?e.get.call(r):e.value}o(HC,"_classApplyDescriptorGet");function zC(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(zC,"_classApplyDescriptorSet");function kw(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(kw,"_classExtractFieldDescriptor");function Ut(r,e){var t=kw(r,e,"get");return HC(r,t)}o(Ut,"_classPrivateFieldGet");function hc(r,e,t){qC(r,e),e.set(r,t)}o(hc,"_classPrivateFieldInit");function Jl(r,e,t){var n=kw(r,e,"set");return zC(r,n,t),t}o(Jl,"_classPrivateFieldSet");var Fi=new WeakMap,Xl=new WeakMap,Qp=new WeakMap,di=new WeakMap,Zl=new WeakMap,pc=class{get authenticated(){return Ut(this,Fi).did!=null}get ceramic(){return Ut(this,Fi)}get id(){if(Ut(this,Xl)!=null)return Ut(this,Xl);if(Ut(this,Fi).did==null)throw new Error("Ceramic instance is not authenticated");return Ut(this,Fi).did.hasParent?Ut(this,Fi).did.parent:Ut(this,Fi).did.id}get loader(){return Ut(this,di)}get model(){return Ut(this,Zl)}has(e,t){return Z(this,null,function*(){let n=this.getDefinitionID(e);return(yield this.getRecordID(n,t))!=null})}get(e,t){return Z(this,null,function*(){let n=this.getDefinitionID(e);return yield this.getRecord(n,t)})}getMultiple(e,t){return Z(this,null,function*(){var f,u,p;let n=this.getDefinitionID(e),i=yield Promise.all(t.map(b=>Z(this,null,function*(){let{genesis:x,streamId:A}=yield Yp(Zp(b));return{genesis:x,streamId:A.toString(),paths:[n]}}))),s=yield Ut(this,Fi).multiQuery(i),a=[];for(let b of i){let x=(u=(f=s[b.streamId])==null?void 0:f.content)==null?void 0:u[n],A=x?s[Je.fromString(x).toString()]:null;a.push((p=A==null?void 0:A.content)!=null?p:null)}return a})}set(i,s){return Z(this,arguments,function*(e,t,n={}){var p;let a=this.getDefinitionID(e),[f,u]=yield this._setRecordOnly(a,t,n);return f&&(yield this._setReference((p=n.controller)!=null?p:this.id,a,u)),u})}merge(i,s){return Z(this,arguments,function*(e,t,n={}){let a=this.getDefinitionID(e),f=yield this.getRecord(a),u=f?re(re({},f),t):t;return yield this.setRecord(a,u,n)})}setAll(n){return Z(this,arguments,function*(e,t={}){var f;let i=Object.entries(e).map(b=>Z(this,[b],function*([u,p]){let x=this.getDefinitionID(u),[A,O]=yield this._setRecordOnly(x,p,t);return[A,x,O]})),a=(yield Promise.all(i)).reduce((u,[p,b,x])=>(p&&(u[b]=x.toUrl()),u),{});return yield this._setReferences((f=t.controller)!=null?f:this.id,a),a})}setDefaults(n){return Z(this,arguments,function*(e,t={}){var u,p;let i=(u=yield this.getIndex())!=null?u:{},s=Object.entries(e).map(([b,x])=>[this.getDefinitionID(b),x]).filter(b=>i[b[0]]==null).map(A=>Z(this,[A],function*([b,x]){let O=yield this.getDefinition(b),T=yield this._createRecord(O,x,t);return{[b]:T.toUrl()}})),f=(yield Promise.all(s)).reduce((b,x)=>Object.assign(b,x),{});return yield this._setReferences((p=t.controller)!=null?p:this.id,f),f})}remove(n){return Z(this,arguments,function*(e,t=this.id){yield this._getIndexProxy(t).changeContent(i=>(i!=null&&delete i[this.getDefinitionID(e)],i))})}getIndex(){return Z(this,arguments,function*(e=this.id){let t=this.authenticated&&e===this.id?yield this._getIndexProxy(e).get():yield this._getIDXDoc(e);return t?t.content:null})}iterator(e){let t,n=0;return{[Symbol.asyncIterator](){return this},next:()=>Z(this,null,function*(){if(t==null){let f=yield this.getIndex(e);t=Object.entries(f!=null?f:{})}if(n===t.length)return{done:!0,value:null};let[i,s]=t[n++],a=yield Ut(this,di).load(s);return{done:!1,value:{key:i,id:s,record:a.content}}})}}_createIDXDoc(e){return Z(this,null,function*(){return yield Ut(this,di).deterministic(Zp(e))})}_getIDXDoc(e){return Z(this,null,function*(){let t=yield this._createIDXDoc(e);if(t.content==null||t.metadata.schema==null)return null;if(t.metadata.schema!==il)throw new Error("Invalid document: schema is not IdentityIndex");return t})}_getOwnIDXDoc(e){return Z(this,null,function*(){let t=yield this._createIDXDoc(e);if(t.content==null||t.metadata.schema==null)yield t.update({},{schema:il});else if(t.metadata.schema!==il)throw new Error("Invalid document: schema is not IdentityIndex");return t})}_getIndexProxy(e){let t=Ut(this,Qp)[e];return t==null&&(t=new dc(()=>Z(this,null,function*(){return yield this._getOwnIDXDoc(e)})),Ut(this,Qp)[e]=t),t}getDefinitionID(e){var t;return(t=Ut(this,Zl).getDefinitionID(e))!=null?t:e}getDefinition(e){return Z(this,null,function*(){let t=yield Ut(this,di).load(e);if(t.metadata.schema!==d6)throw new Error("Invalid document: schema is not Definition");return Te(re({},t.content),{id:t.id})})}getRecordID(e,t){return Z(this,null,function*(){var i;let n=yield this.getIndex(t!=null?t:this.id);return(i=n==null?void 0:n[e])!=null?i:null})}getRecordDocument(e,t){return Z(this,null,function*(){let n=yield this.getRecordID(e,t);return n?yield Ut(this,di).load(n):null})}getRecord(e,t){return Z(this,null,function*(){let n=yield this.getRecordDocument(e,t);return n?n.content:null})}setRecord(i,s){return Z(this,arguments,function*(e,t,n={}){var u;let[a,f]=yield this._setRecordOnly(e,t,n);return a&&(yield this._setReference((u=n.controller)!=null?u:this.id,e,f)),f})}_setRecordOnly(e,t,n){return Z(this,null,function*(){var s;let i=yield this.getRecordID(e,(s=n.controller)!=null?s:this.id);if(i==null){let a=yield this.getDefinition(e),f=yield this._createRecord(a,t,n);return[!0,f]}else{let a=yield Ut(this,di).update(i,t);return[!1,a.id]}})}_createRecord(s,a,f){return Z(this,arguments,function*(e,t,{controller:n,pin:i}){let u=yield Ut(this,di).deterministic({controllers:[n!=null?n:this.id],family:e.id.toString()},{pin:i});return yield u.update(t,{schema:e.schema}),u.id})}_setReference(e,t,n){return Z(this,null,function*(){yield this._getIndexProxy(e).changeContent(i=>Te(re({},i),{[t]:n.toUrl()}))})}_setReferences(e,t){return Z(this,null,function*(){Object.keys(t).length!==0&&(yield this._getIndexProxy(e).changeContent(n=>re(re({},n),t)))})}constructor(e){hc(this,Fi,{writable:!0,value:void 0}),hc(this,Xl,{writable:!0,value:void 0}),hc(this,Qp,{writable:!0,value:{}}),hc(this,di,{writable:!0,value:void 0}),hc(this,Zl,{writable:!0,value:void 0});let{cache:t,ceramic:n,id:i,loader:s,model:a}=e;Jl(this,Fi,n),Jl(this,Xl,i),Jl(this,di,s!=null?s:new mn({ceramic:n,cache:t})),Jl(this,Zl,a instanceof Va?a:new Va({loader:Ut(this,di),aliases:a}))}};o(pc,"DIDDataStore");function em(r){return typeof r=="string"?Je.fromString(r):r}o(em,"typeStreamID");var mr=class extends _t{constructor(e,t,n){super(i=>{this.state$.observers.length===0&&(this.periodicSubscription=fc(0,n).pipe(Up(()=>this._syncState(this.id,{sync:Ct.PREFER_CACHE}))).subscribe()),this.state$.subscribe(i).add(()=>{var f;this.state$.observers.length===0&&((f=this.periodicSubscription)==null||f.unsubscribe())})}),this.state$=new lc(e),this._apiUrl=new URL(t)}get value(){return this.state$.value}get state(){return this.state$.value}next(e){this.state$.next(e)}_syncState(e,t){return Z(this,null,function*(){let n=yield mr._load(e,this._apiUrl,t);this.state$.next(yt.deserializeState(n))})}get id(){return new Je(this.state$.value.type,this.state$.value.log[0].cid)}static createFromGenesis(e,t,n,i,s){return Z(this,null,function*(){let a=new URL("./streams",e),{state:f}=yield wr(a,{method:"post",body:{type:t,genesis:yt.serializeCommit(n),opts:i}});return new mr(yt.deserializeState(f),e,s)})}static applyCommit(e,t,n,i,s){return Z(this,null,function*(){let a=new URL("./commits",e),{state:f}=yield wr(a,{method:"post",body:{streamId:t.toString(),commit:yt.serializeCommit(n),opts:i}});return new mr(yt.deserializeState(f),e,s)})}static _load(e,t,n){return Z(this,null,function*(){let i=new URL(`./streams/${e}`,t);for(let a in n)i.searchParams.set(a,n[a]);let{state:s}=yield wr(i);return s})}static load(e,t,n,i){return Z(this,null,function*(){let s=yield mr._load(e,t,i);return new mr(yt.deserializeState(s),t,n)})}static loadStreamCommits(e,t){return Z(this,null,function*(){let n=new URL(`./commits/${e}`,t),{commits:i}=yield wr(n);return i.map(s=>({cid:s.cid,value:yt.deserializeCommit(s.value)}))})}complete(){this.state$.complete()}};o(mr,"Document");var Dw=at(nc(),1),jC=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Ss,tm=o(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),Cw={anchor:!1,publish:!0,pin:!0,sync:Ct.PREFER_CACHE},rm={anchor:!0,publish:!0,throwOnInvalidCommit:!0},KC={sync:Ct.PREFER_CACHE},Ms=Ss=o(class extends Pn{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){var n;let{next:e,metadata:t}=this.state$.value;return(0,Dw.default)((n=e==null?void 0:e.metadata)!=null?n:t)}static fromAccount(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},Cw),n);let a=dw(t),f=Ss.makeGenesis(a);return Ss.fromGenesis(e,f,n)})}static fromGenesis(i,s){return Z(this,arguments,function*(e,t,n={}){return n=re(re({},Cw),n),e.createStreamFromGenesis(Ss.STREAM_TYPE_ID,t,n)})}setDid(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},rm),n);let a=typeof e=="string"?e.trim():e.id,f=bd(a);if((f==null?void 0:f.did)!==a)throw new Error(`DID is not valid: '${a}'`);let u=yield t.createLink(a);return this.setDidProof(u,n)})}setDidProof(n){return Z(this,arguments,function*(e,t={}){t=re(re({},rm),t);let i=this.makeCommit(e),s=yield this.api.applyCommit(this.id,i,t);this.state$.next(s.state)})}clearDid(n){return Z(this,arguments,function*(e,t={}){t=re(re({},rm),t);let i=yield e.createLink("");return this.setDidProof(i,t)})}static load(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},KC),n);let a=xr.from(t);if(a.type!=Ss.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${Ss.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}static makeGenesis(e){return e.chainId.namespace==="eip155"&&(e.address=e.address.toLowerCase()),{header:{controllers:[`${e.address}@${e.chainId.toString()}`],family:`caip10-${e.chainId.toString()}`}}}makeCommit(e){return{data:e,prev:this.tip,id:this.id.cid}}makeReadOnly(){this.setDidProof=tm,this.setDid=tm,this.sync=tm,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link");Ms.STREAM_TYPE_NAME="caip10-link";Ms.STREAM_TYPE_ID=1;Ms=Ss=jC([vo()],Ms);var e4=at(ro(),1);Vn();Ho();var t4=at(Jw(),1),pD=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},br,mD={sync:Ct.PREFER_CACHE};function Xw(r){return Z(this,null,function*(){if(r.did==null)throw new Error("No DID provided");r.did.authenticated||(yield r.did.authenticate(),r.loggerProvider&&r.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${r.did.id}`))})}o(Xw,"_ensureAuthenticated");function Zw(){return Z(this,null,function*(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")})}o(Zw,"throwReadOnlyError");var Qw;(function(r){r.LIST="list",r.SINGLE="single"})(Qw||(Qw={}));var yo=br=o(class extends Pn{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:br.MODEL}}static create(e,t,n){return Z(this,null,function*(){br.assertComplete(t);let i={publish:!0,anchor:!0,pin:!0,sync:Ct.NEVER_SYNC,throwOnInvalidCommit:!0},s=yield br._makeGenesis(e,t,n);return yield e.createStreamFromGenesis(br.STREAM_TYPE_ID,s,i)})}static createPlaceholder(e,t,n){return Z(this,null,function*(){let i={publish:!1,anchor:!1,pin:!1,sync:Ct.NEVER_SYNC,throwOnInvalidCommit:!0},s=yield br._makeGenesis(e,t,n);return e.createStreamFromGenesis(br.STREAM_TYPE_ID,s,i)})}replacePlaceholder(e){return Z(this,null,function*(){br.assertComplete(e,this.id);let t={publish:!0,anchor:!0,pin:!0,throwOnInvalidCommit:!0},n=yield this._makeCommit(this.api,e),i=yield this.api.applyCommit(this.id,n,t);this.state$.next(i.state)})}static assertComplete(e,t){if(!e.name)throw t?new Error(`Model with StreamID ${t.toString()} is missing a 'name' field`):new Error("Model is missing a 'name' field");if(!e.schema)throw t?new Error(`Model ${e.name} (${t.toString()}) is missing a 'schema' field`):new Error(`Model ${e.name} is missing a 'schema' field`);if(!e.accountRelation)throw t?new Error(`Model ${e.name} (${t.toString()}) is missing a 'accountRelation' field`):new Error(`Model ${e.name} is missing a 'accountRelation' field`)}static load(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},mD),n);let a=xr.from(t);if(a.type!=br.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${br.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);let f=yield e.loadStream(a,n);try{br.assertComplete(f.content,t)}catch(u){throw new Error(`Incomplete placeholder Models cannot be loaded: ${u.message}`)}return f})}_makeCommit(e,t){return Z(this,null,function*(){let n=this._makeRawCommit(t);return br._signDagJWS(e,n)})}_makeRawCommit(e){if(e==null)throw new Error("Cannot set Model content to null");return{data:Oa.compare(this.content,e),prev:this.tip,id:this.state.log[0].cid}}static _makeGenesis(e,t,n){return Z(this,null,function*(){let i=yield this._makeRawGenesis(e,t,n);return br._signDagJWS(e,i)})}static _makeRawGenesis(e,t,n){return Z(this,null,function*(){if(t==null)throw new Error("Genesis content cannot be null");if(!n||!n.controller)if(e.did)yield Xw(e),n={controller:e.did.hasParent?e.did.parent:e.did.id};else throw new Error("No controller specified");let i={controllers:[n.controller],unique:(0,e4.randomBytes)(12),model:br.MODEL.bytes};return{data:t,header:i}})}makeReadOnly(){this.replacePlaceholder=Zw,this.sync=Zw,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static _signDagJWS(e,t){return Z(this,null,function*(){return yield Xw(e),e.did.createDagJWS(t)})}},"Model");yo.STREAM_TYPE_NAME="model";yo.STREAM_TYPE_ID=2;yo.MODEL=function(){let r=If("model-v1"),e=t4.default.encode(r,"identity"),t=Kn(ba,e),n=Pe.createV1(ba,t);return new Je(br.STREAM_TYPE_ID,n)}();yo=br=pD([vo()],yo);var i4=at(ro(),1);var bD=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},$i,gD={anchor:!0,publish:!0,pin:!0,sync:Ct.NEVER_SYNC,syncTimeoutSeconds:0},vD={sync:Ct.PREFER_CACHE},r4={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function n4(r){return Z(this,null,function*(){if(r.did==null)throw new Error("No DID provided");r.did.authenticated||(yield r.did.authenticate(),r.loggerProvider&&r.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${r.did.id}`))})}o(n4,"_ensureAuthenticated");function om(){return Z(this,null,function*(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")})}o(om,"throwReadOnlyError");var As=$i=o(class extends Pn{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let e=this.state$.value.metadata;return{controller:e.controllers[0],model:e.model}}static create(s,a,f){return Z(this,arguments,function*(e,t,n,i={}){i=re(re({},gD),i);let u=i.asDID?{did:i.asDID}:e,p=yield $i._makeGenesis(u,t,n);return e.createStreamFromGenesis($i.STREAM_TYPE_ID,p,i)})}static load(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},vD),n);let a=xr.from(t);if(a.type!=$i.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${$i.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}replace(n){return Z(this,arguments,function*(e,t={}){t=re(re({},r4),t);let i=t.asDID?{did:t.asDID}:this.api,s=yield this._makeCommit(i,e),a=yield this.api.applyCommit(this.id,s,t);this.state$.next(a.state)})}patch(n){return Z(this,arguments,function*(e,t={}){t=re(re({},r4),t);let i={data:e,prev:this.tip,id:this.id.cid},s=yield $i._signDagJWS(this.api,i),a=yield this.api.applyCommit(this.id,s,t);this.state$.next(a.state)})}makeReadOnly(){this.replace=om,this.patch=om,this.sync=om,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(e,t){let n=this._makeRawCommit(t);return $i._signDagJWS(e,n)}_makeRawCommit(e){return{data:Oa.compare(this.content,e||{}),prev:this.tip,id:this.state.log[0].cid}}static _makeGenesis(e,t,n){return Z(this,null,function*(){let i=yield this._makeRawGenesis(e,t,n);return $i._signDagJWS(e,i)})}static _makeRawGenesis(e,t,n){return Z(this,null,function*(){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");if(!n.controller)if(e.did)yield n4(e),n.controller=e.did.hasParent?e.did.parent:e.did.id;else throw new Error("No controller specified");let i={controllers:[n.controller],unique:(0,i4.randomBytes)(12),model:n.model.bytes};return{data:t,header:i}})}static _signDagJWS(e,t){return Z(this,null,function*(){return yield n4(e),e.did.createDagJWS(t)})}},"ModelInstanceDocument");As.STREAM_TYPE_NAME="MID";As.STREAM_TYPE_ID=3;As=$i=bD([vo()],As);var bc=class{constructor(e){this._apiUrl=e}add(e,t){return Z(this,null,function*(){let n={};t&&(n.force=!0);let i=new URL(`./pins/${e}`,this._apiUrl);yield wr(i,{method:"post",body:n})})}rm(e,t){return Z(this,null,function*(){let n=new URL(`./pins/${e}`,this._apiUrl);yield wr(n,{method:"delete",body:{opts:t}})})}ls(e){return Z(this,null,function*(){let t=new URL("./pins",this._apiUrl);e&&(t=new URL(`./pins/${e.toString()}`,this._apiUrl));let n=yield wr(t),{pinnedStreamIds:i}=n;return{[Symbol.asyncIterator](){let s=0;return{next(){return s===i.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:i[s++],done:!1})}}}}})}};o(bc,"RemotePinApi");var gc=class{constructor(e){this._fetchJson=wr,this._collectionURL=new URL("./collection",e)}queryIndex(e){return Z(this,null,function*(){let t=new URL(this._collectionURL);for(let s in e)t.searchParams.set(s,e[s]);let n=yield this._fetchJson(t);return{edges:n.edges.map(s=>({cursor:s.cursor,node:yt.deserializeState(s.node)})),pageInfo:n.pageInfo}})}};o(gc,"RemoteIndexApi");var yD="/api/v0/",xD="http://localhost:7007",wD={syncInterval:5e3},_D={anchor:!0,publish:!0,sync:Ct.PREFER_CACHE},ED={anchor:!0,publish:!0,sync:Ct.PREFER_CACHE},o4={sync:Ct.PREFER_CACHE},vc=class{constructor(e=xD,t={}){this._config=re(re({},wD),t),this._apiUrl=new URL(yD,e),this._streamCache=new Map,this.context={api:this},this.pin=new bc(this._apiUrl),this.index=new gc(this._apiUrl),this._streamConstructors={[Ms.STREAM_TYPE_ID]:Ms,[yo.STREAM_TYPE_ID]:yo,[As.STREAM_TYPE_ID]:As,[zr.STREAM_TYPE_ID]:zr}}get did(){return this.context.did}set did(e){this.context.did=e}createStreamFromGenesis(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},ED),n);let a=yield mr.createFromGenesis(this._apiUrl,e,t,n,this._config.syncInterval),f=this._streamCache.get(a.id.toString());return f?(yt.statesEqual(a.state,f.state)||f.next(a.state),this.buildStreamFromDocument(f)):(this._streamCache.set(a.id.toString(),a),this.buildStreamFromDocument(a))})}loadStream(n){return Z(this,arguments,function*(e,t={}){t=re(re({},o4),t);let i=xr.from(e),s=this._streamCache.get(i.baseID.toString());return s?yield s._syncState(i,t):(s=yield mr.load(i,this._apiUrl,this._config.syncInterval,t),this._streamCache.set(s.id.toString(),s)),this.buildStreamFromDocument(s)})}multiQuery(e,t){return Z(this,null,function*(){let n=e.map(a=>Te(re({},a),{streamId:typeof a.streamId=="string"?a.streamId:a.streamId.toString()})),i=new URL("./multiqueries",this._apiUrl),s=yield wr(i,{method:"post",body:{queries:n,timeout:t}});return Object.entries(s).reduce((a,f)=>{let[u,p]=f,b=yt.deserializeState(p),x=new mr(b,this._apiUrl,this._config.syncInterval);return a[u]=this.buildStreamFromDocument(x),a},{})})}loadStreamCommits(e){let t=em(e);return mr.loadStreamCommits(t,this._apiUrl)}applyCommit(i,s){return Z(this,arguments,function*(e,t,n={}){n=re(re({},_D),n);let a=em(e),f=yield mr.applyCommit(this._apiUrl,a,t,n,this._config.syncInterval),u=this._streamCache.get(a.toString());return u?(u.next(f.state),this.buildStreamFromDocument(f)):(this._streamCache.set(a.toString(),f),this.buildStreamFromDocument(f))})}requestAnchor(n){return Z(this,arguments,function*(e,t={}){t=re(re({},o4),t);let{anchorStatus:i}=yield wr(`${this._apiUrl}/streams/${e.toString()}/anchor`,{method:"post",body:{opts:t}});return i})}addStreamHandler(e){this._streamConstructors[e.name]=e.stream_constructor}buildStreamFromState(e){let t=new mr(e,this._apiUrl,this._config.syncInterval);return this.buildStreamFromDocument(t)}buildStreamFromDocument(e){let t=e.state.type,n=this._streamConstructors[t];if(!n)throw new Error(`Failed to find constructor for stream ${t}`);return new n(e,this.context)}setDID(e){return Z(this,null,function*(){this.context.did=e})}getSupportedChains(){return Z(this,null,function*(){if(this._supportedChains)return this._supportedChains;let{supportedChains:e}=yield wr(this._apiUrl+"/node/chains");return this._supportedChains=e,e})}close(){return Z(this,null,function*(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()})}};o(vc,"CeramicClient");var SD=o((r,e)=>Z(void 0,null,function*(){let t=new vc(e),n=re({},s4.default.getResolver()),i=new ls({resolver:n});t.did=i;let s=r.pluginMethods.getKey(),a=new Gf(Qu(s));return t.did.setProvider(a),yield t.did.authenticate(),t}),"getCeramicClientFromWalletSuite"),ed=o((s,a)=>Z(void 0,[s,a],function*(r,{modelData:e,credentialAlias:t,ceramicEndpoint:n,defaultContentFamily:i}){let f=yield SD(r,n),u=new mn({ceramic:f}),p=new pc({ceramic:f,model:e}),b=o((...$)=>Z(void 0,[...$],function*(k=t){return(yield p.get(k))||{credentials:[]}}),"getCredentialsListFromIdx"),x=o((k,$)=>Z(void 0,null,function*(){if(!k)throw new Error("record is required");if(!k.id)throw Error("No streamId provided");k.id.indexOf("ceramic://")===-1&&(k.id="ceramic://"+k.id),$||($=t);let C=yield b($),B=C.credentials.findIndex(z=>z.title===k.title);return B>-1?C.credentials[B]=re({storageType:"ceramic"},k):C.credentials.push(re({storageType:"ceramic"},k)),p.set($,C)}),"addCredentialStreamIdToIdx"),A=o((k,$)=>Z(void 0,null,function*(){if(!k)throw new Error("record is required");$||($=t);let C=yield b($);return C.credentials=C.credentials.filter(B=>B.title!==k),p.set($,C)}),"removeCredentialFromIdx"),O=o((B,...z)=>Z(void 0,[B,...z],function*(k,$={},C={}){if(!k)throw new Error("content is required");return $.controllers||($.controllers=[f.did.id]),$.family||($.family=i),"pin"in C||(C.pin=!0),(yield zr.create(f,k,$,C)).id.toString()}),"publishContentToCeramic"),T=o(k=>Z(void 0,null,function*(){var $;return($=yield u.load(k))==null?void 0:$.content}),"readContentFromCeramic");return{pluginMethods:{getCredentialsListFromIdx:(C,...B)=>Z(void 0,[C,...B],function*(k,$=t){return b($)}),publishContentToCeramic:(k,$)=>Z(void 0,null,function*(){return O($)}),readContentFromCeramic:(k,$)=>Z(void 0,null,function*(){return T($)}),getVerifiableCredentialFromIdx:(k,$)=>Z(void 0,null,function*(){var z;let C=yield b(),B=(z=C==null?void 0:C.credentials)==null?void 0:z.find(H=>(H==null?void 0:H.title)===$);return B&&(yield T(B.id))}),getVerifiableCredentialsFromIdx:()=>Z(void 0,null,function*(){var C,B;let k=yield b(),$=(B=(C=k==null?void 0:k.credentials)==null?void 0:C.map(z=>z==null?void 0:z.id))!=null?B:[];return Promise.all($.map(z=>Z(void 0,null,function*(){return T(z)})))}),addVerifiableCredentialInIdx:(B,z)=>Z(void 0,[B,z],function*(k,{title:$,id:C}){return x({title:$,id:C})}),removeVerifiableCredentialInIdx:(k,$)=>Z(void 0,null,function*(){return A($)})}}}),"getIDXPlugin");var MD=["key","tz","pkh:tz","pkh:tezos","pkh:sol","pkh:solana"],AD=["key","tz","ethr","pkh:tz","pkh:tezos","pkh:eth","pkh:celo","pkh:poly","pkh:btc","pkh:doge","pkh:eip155","pkh:bip122"],a4=o(r=>/^[0-9a-f]+$/i.test(r),"isHex"),f4=o(r=>{if(MD.includes(r))return"ed25519";if(AD.includes(r)||r.startsWith("pkh:eip155:")||r.startsWith("pkh:bip122:"))return"secp256k1";throw new Error("Unspported Did Method")},"getAlgorithmForDidMethod");var c4=o((r,e)=>Z(void 0,null,function*(){if(e.length===0)throw new Error("Please don't use an empty string for a key!");if(!a4(e))throw new Error("Key must be a hexadecimal string!");if(e.length>64)throw new Error("Key must be less than 64 characters");let t=e.padStart(64,"0"),n=Qu(t),i={},s={ed25519:r.pluginMethods.generateEd25519KeyFromBytes(n),secp256k1:r.pluginMethods.generateSecp256k1KeyFromBytes(n)};return{pluginMethods:{getSubjectDid:(a,f)=>{if(!i[f]){let u=f4(f);i[f]=r.pluginMethods.keyToDid(f,s[u])}return i[f]},getSubjectKeypair:(a,f="ed25519")=>{if(!s[f])throw new Error("Unsupported algorithm");return s[f]},getKey:()=>t}}}),"getDidKeyPlugin");var u4=o(r=>({pluginMethods:{verifyCredential:(e,t)=>Z(void 0,null,function*(){let n=yield r.pluginMethods.verifyCredential(t);return t.expirationDate&&new Date>new Date(t.expirationDate)?n.errors.push("expiration error: Credential is expired"):n.checks.push("expiration"),n})}}),"ExpirationPlugin");var l4=o(r=>({}),"recycleDependents");var d4=o(r=>(e,t)=>Z(void 0,null,function*(){let n=e.pluginMethods.getSubjectKeypair();if(!n)throw new Error("Cannot issue credential: Could not get subject keypair");let i={verificationMethod:yield r.pluginMethods.keyToVerificationMethod("key",n),proofPurpose:"assertionMethod"};return r.pluginMethods.issueCredential(t,i,n)}),"issueCredential");var h4=o(r=>(e,t)=>Z(void 0,null,function*(){return r.pluginMethods.verifyCredential(t)}),"verifyCredential");var p4=o(r=>(e,t)=>Z(void 0,null,function*(){let n=e.pluginMethods.getSubjectKeypair();if(!n)throw new Error("Cannot issue credential: Could not get subject keypair");let i={verificationMethod:yield r.pluginMethods.keyToVerificationMethod("key",n),proofPurpose:"assertionMethod"};return r.pluginMethods.issuePresentation(t,i,n)}),"issuePresentation");var m4=o(r=>(e,t)=>Z(void 0,null,function*(){return r.pluginMethods.verifyPresentation(t)}),"verifyPresentation");var sm=o(r=>Z(void 0,null,function*(){return{pluginMethods:Te(re({},l4(r.pluginMethods)),{issueCredential:d4(r),verifyCredential:h4(r),issuePresentation:p4(r),verifyPresentation:m4(r),getTestVc:(e,t="did:example:d23dd687a7dc6787646f2eb98d0")=>{let n=e.pluginMethods.getSubjectDid("key");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:t}}},getTestVp:(e,t)=>Z(void 0,null,function*(){let n=t||(yield e.pluginMethods.issueCredential(e.pluginMethods.getTestVc())),i=e.pluginMethods.getSubjectDid("key");return{"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],holder:i,verifiableCredential:n}})})}}),"getVCPlugin");var Ya=require("ethers"),g4=o((r,e)=>{let{address:t,infuraProjectId:n,network:i="mainnet"}=e,s;n?s=new Ya.ethers.providers.InfuraProvider(i,n):s=Ya.ethers.getDefaultProvider(i);let a=o(f=>Z(void 0,null,function*(){if(!t)throw new Error("Can't check balance: No address provided.");let u=b4(),b=yield new Ya.ethers.Contract(f,u,s).balanceOf(t);return Ya.ethers.utils.formatUnits(b)}),"checkErc20TokenBalance");return{pluginMethods:{checkMyEth:()=>Z(void 0,null,function*(){if(!t)throw new Error("Can't check ETH: No ethereum address provided.");let f=yield s.getBalance(t);return Ya.ethers.utils.formatEther(f)}),checkMyDai:()=>Z(void 0,null,function*(){return yield a("0x6B175474E89094C44Da98b954EedeAC495271d0F")}),checkMyUsdc:()=>Z(void 0,null,function*(){return yield a("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48")})}}},"getEthereumPlugin");var kt;(function(r){function e(n){throw new Error}o(e,"assertNever"),r.assertNever=e,r.arrayToEnum=n=>{let i={};for(let s of n)i[s]=s;return i},r.getValidEnumValues=n=>{let i=r.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),s={};for(let a of i)s[a]=n[a];return r.objectValues(s)},r.objectValues=n=>r.objectKeys(n).map(function(i){return n[i]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(s);return i},r.find=(n,i)=>{for(let s of n)if(i(s))return s},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function t(n,i=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}o(t,"joinValues"),r.joinValues=t})(kt||(kt={}));var Me=kt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xo=o(r=>{switch(typeof r){case"undefined":return Me.undefined;case"string":return Me.string;case"number":return isNaN(r)?Me.nan:Me.number;case"boolean":return Me.boolean;case"function":return Me.function;case"bigint":return Me.bigint;case"object":return Array.isArray(r)?Me.array:r===null?Me.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?Me.promise:typeof Map!="undefined"&&r instanceof Map?Me.map:typeof Set!="undefined"&&r instanceof Set?Me.set:typeof Date!="undefined"&&r instanceof Date?Me.date:Me.object;default:return Me.unknown}},"getParsedType"),Se=kt.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"]),kD=o(r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),bn=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(s){return s.message},n={_errors:[]},i=o(s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let f=n,u=0;for(;u<a.path.length;){let p=a.path[u];u===a.path.length-1?(f[p]=f[p]||{_errors:[]},f[p]._errors.push(t(a))):f[p]=f[p]||{_errors:[]},f=f[p],u++}}},"processError");return i(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,null,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};o(bn,"ZodError");bn.create=r=>new bn(r);var yc=o((r,e)=>{let t;switch(r.code){case Se.invalid_type:r.received===Me.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case Se.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected)}`;break;case Se.unrecognized_keys:t=`Unrecognized key(s) in object: ${kt.joinValues(r.keys,", ")}`;break;case Se.invalid_union:t="Invalid input";break;case Se.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${kt.joinValues(r.options)}`;break;case Se.invalid_enum_value:t=`Invalid enum value. Expected ${kt.joinValues(r.options)}, received '${r.received}'`;break;case Se.invalid_arguments:t="Invalid function arguments";break;case Se.invalid_return_type:t="Invalid function return type";break;case Se.invalid_date:t="Invalid date";break;case Se.invalid_string:r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case Se.too_small:r.type==="array"?t=`Array must contain ${r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be greater than ${r.inclusive?"or equal to ":""}${r.minimum}`:t="Invalid input";break;case Se.too_big:r.type==="array"?t=`Array must contain ${r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be less than ${r.inclusive?"or equal to ":""}${r.maximum}`:t="Invalid input";break;case Se.custom:t="Invalid input";break;case Se.invalid_intersection_types:t="Intersection results could not be merged";break;case Se.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;default:t=e.defaultError,kt.assertNever(r)}return{message:t}},"defaultErrorMap"),xc=yc,CD=o(r=>{xc=r},"setErrorMap"),td=o(r=>{let{data:e,path:t,errorMaps:n,issueData:i}=r,s=[...t,...i.path||[]],a=Te(re({},i),{path:s}),f="",u=n.filter(p=>!!p).slice().reverse();for(let p of u)f=p(a,{data:e,defaultError:f}).message;return Te(re({},i),{path:s,message:i.message||f})},"makeIssue"),DD=[];function Re(r,e){let t=td({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xc,yc].filter(n=>!!n)});r.common.issues.push(t)}o(Re,"addIssueToContext");var or=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return nt;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static mergeObjectAsync(e,t){return Z(this,null,function*(){let n=[];for(let i of t)n.push({key:yield i.key,value:yield i.value});return or.mergeObjectSync(e,n)})}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return nt;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),(typeof a.value!="undefined"||i.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}};o(or,"ParseStatus");var nt=Object.freeze({status:"aborted"}),ID=o(r=>({status:"dirty",value:r}),"DIRTY"),_r=o(r=>({status:"valid",value:r}),"OK"),am=o(r=>r.status==="aborted","isAborted"),fm=o(r=>r.status==="dirty","isDirty"),rd=o(r=>r.status==="valid","isValid"),cm=o(r=>typeof Promise!==void 0&&r instanceof Promise,"isAsync"),xt;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(xt||(xt={}));var jr=class{constructor(e,t,n,i){this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._path.concat(this._key)}};o(jr,"ParseInputLazyPath");var v4=o((r,e)=>{if(rd(e))return{success:!0,data:e.value};{if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");let t=new bn(r.common.issues);return{success:!1,error:t}}},"handleResult");function st(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid" or "required" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:o((a,f)=>a.code!=="invalid_type"?{message:f.defaultError}:typeof f.data=="undefined"&&n?{message:n}:r.invalid_type_error?{message:r.invalid_type_error}:{message:f.defaultError},"customMap"),description:i}}o(st,"processCreateParams");var ot=class{constructor(e){this.spa=this.safeParseAsync,this.superRefine=this._refinement,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.default=this.default.bind(this),this.describe=this.describe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return xo(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new or,ctx:{common:e.parent.common,data:e.data,parsedType:xo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(cm(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let i={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xo(e)},s=this._parseSync({data:e,path:i.path,parent:i});return v4(i,s)}parseAsync(e,t){return Z(this,null,function*(){let n=yield this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error})}safeParseAsync(e,t){return Z(this,null,function*(){let n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xo(e)},i=this._parse({data:e,path:[],parent:n}),s=yield cm(i)?i:Promise.resolve(i);return v4(n,s)})}refine(e,t){let n=o(i=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(i):t,"getIssueProperties");return this._refinement((i,s)=>{let a=e(i),f=o(()=>s.addIssue(re({code:Se.custom},n(i))),"setError");return typeof Promise!="undefined"&&a instanceof Promise?a.then(u=>u?!0:(f(),!1)):a?!0:(f(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new Wr({schema:this,typeName:et.ZodEffects,effect:{type:"refinement",refinement:e}})}optional(){return Gr.create(this)}nullable(){return bi.create(this)}nullish(){return this.optional().nullable()}array(){return Kr.create(this)}promise(){return Hi.create(this)}or(e){return wo.create([this,e])}and(e){return _o.create(this,e)}transform(e){return new Wr({schema:this,typeName:et.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Xa({innerType:this,defaultValue:t,typeName:et.ZodDefault})}describe(e){let t=this.constructor;return new t(Te(re({},this._def),{description:e}))}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};o(ot,"ZodType");var OD=/^c[^\s-]{8,}$/i,PD=/^([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,ND=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,Nn=class extends ot{constructor(){super(...arguments),this._regex=(e,t,n)=>this.refinement(i=>e.test(i),re({validation:t,code:Se.invalid_string},xt.errToObj(n))),this.nonempty=e=>this.min(1,xt.errToObj(e)),this.trim=()=>new Nn(Te(re({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}_parse(e){if(this._getType(e)!==Me.string){let s=this._getOrReturnCtx(e);return Re(s,{code:Se.invalid_type,expected:Me.string,received:s.parsedType}),nt}let n=new or,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),Re(i,{code:Se.too_small,minimum:s.value,type:"string",inclusive:!0,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),Re(i,{code:Se.too_big,maximum:s.value,type:"string",inclusive:!0,message:s.message}),n.dirty());else if(s.kind==="email")ND.test(e.data)||(i=this._getOrReturnCtx(e,i),Re(i,{validation:"email",code:Se.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")PD.test(e.data)||(i=this._getOrReturnCtx(e,i),Re(i,{validation:"uuid",code:Se.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")OD.test(e.data)||(i=this._getOrReturnCtx(e,i),Re(i,{validation:"cuid",code:Se.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch(a){i=this._getOrReturnCtx(e,i),Re(i,{validation:"url",code:Se.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Re(i,{validation:"regex",code:Se.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():kt.assertNever(s);return{status:n.value,value:e.data}}_addCheck(e){return new Nn(Te(re({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(re({kind:"email"},xt.errToObj(e)))}url(e){return this._addCheck(re({kind:"url"},xt.errToObj(e)))}uuid(e){return this._addCheck(re({kind:"uuid"},xt.errToObj(e)))}cuid(e){return this._addCheck(re({kind:"cuid"},xt.errToObj(e)))}regex(e,t){return this._addCheck(re({kind:"regex",regex:e},xt.errToObj(t)))}min(e,t){return this._addCheck(re({kind:"min",value:e},xt.errToObj(t)))}max(e,t){return this._addCheck(re({kind:"max",value:e},xt.errToObj(t)))}length(e,t){return this.min(e,t).max(e,t)}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=-1/0;return this._def.checks.map(t=>{t.kind==="min"&&(e===null||t.value>e)&&(e=t.value)}),e}get maxLength(){let e=null;return this._def.checks.map(t=>{t.kind==="max"&&(e===null||t.value<e)&&(e=t.value)}),e}};o(Nn,"ZodString");Nn.create=r=>new Nn(re({checks:[],typeName:et.ZodString},st(r)));function RD(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,s=parseInt(r.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}o(RD,"floatSafeRemainder");var hi=class extends ot{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._getType(e)!==Me.number){let s=this._getOrReturnCtx(e);return Re(s,{code:Se.invalid_type,expected:Me.number,received:s.parsedType}),nt}let n,i=new or;for(let s of this._def.checks)s.kind==="int"?kt.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Re(n,{code:Se.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Se.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Se.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?RD(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),Re(n,{code:Se.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):kt.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,xt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,xt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,xt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,xt.toString(t))}setLimit(e,t,n,i){return new hi(Te(re({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:xt.toString(i)}]}))}_addCheck(e){return new hi(Te(re({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:xt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:xt.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}};o(hi,"ZodNumber");hi.create=r=>new hi(re({checks:[],typeName:et.ZodNumber},st(r)));var Ts=class extends ot{_parse(e){if(this._getType(e)!==Me.bigint){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.bigint,received:n.parsedType}),nt}return _r(e.data)}};o(Ts,"ZodBigInt");Ts.create=r=>new Ts(re({typeName:et.ZodBigInt},st(r)));var ks=class extends ot{_parse(e){if(this._getType(e)!==Me.boolean){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.boolean,received:n.parsedType}),nt}return _r(e.data)}};o(ks,"ZodBoolean");ks.create=r=>new ks(re({typeName:et.ZodBoolean},st(r)));var Cs=class extends ot{_parse(e){if(this._getType(e)!==Me.date){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.date,received:n.parsedType}),nt}if(isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_date}),nt}return{status:"valid",value:new Date(e.data.getTime())}}};o(Cs,"ZodDate");Cs.create=r=>new Cs(re({typeName:et.ZodDate},st(r)));var Ds=class extends ot{_parse(e){if(this._getType(e)!==Me.undefined){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.undefined,received:n.parsedType}),nt}return _r(e.data)}};o(Ds,"ZodUndefined");Ds.create=r=>new Ds(re({typeName:et.ZodUndefined},st(r)));var Is=class extends ot{_parse(e){if(this._getType(e)!==Me.null){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.null,received:n.parsedType}),nt}return _r(e.data)}};o(Is,"ZodNull");Is.create=r=>new Is(re({typeName:et.ZodNull},st(r)));var qi=class extends ot{constructor(){super(...arguments),this._any=!0}_parse(e){return _r(e.data)}};o(qi,"ZodAny");qi.create=r=>new qi(re({typeName:et.ZodAny},st(r)));var Rn=class extends ot{constructor(){super(...arguments),this._unknown=!0}_parse(e){return _r(e.data)}};o(Rn,"ZodUnknown");Rn.create=r=>new Rn(re({typeName:et.ZodUnknown},st(r)));var Ln=class extends ot{_parse(e){let t=this._getOrReturnCtx(e);return Re(t,{code:Se.invalid_type,expected:Me.never,received:t.parsedType}),nt}};o(Ln,"ZodNever");Ln.create=r=>new Ln(re({typeName:et.ZodNever},st(r)));var Os=class extends ot{_parse(e){if(this._getType(e)!==Me.undefined){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.void,received:n.parsedType}),nt}return _r(e.data)}};o(Os,"ZodVoid");Os.create=r=>new Os(re({typeName:et.ZodVoid},st(r)));var Kr=class extends ot{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==Me.array)return Re(t,{code:Se.invalid_type,expected:Me.array,received:t.parsedType}),nt;if(i.minLength!==null&&t.data.length<i.minLength.value&&(Re(t,{code:Se.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(Re(t,{code:Se.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all(t.data.map((a,f)=>i.type._parseAsync(new jr(t,a,t.path,f)))).then(a=>or.mergeArray(n,a));let s=t.data.map((a,f)=>i.type._parseSync(new jr(t,a,t.path,f)));return or.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new Kr(Te(re({},this._def),{minLength:{value:e,message:xt.toString(t)}}))}max(e,t){return new Kr(Te(re({},this._def),{maxLength:{value:e,message:xt.toString(t)}}))}length(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};o(Kr,"ZodArray");Kr.create=(r,e)=>new Kr(re({type:r,minLength:null,maxLength:null,typeName:et.ZodArray},st(e)));var nd;(function(r){r.mergeShapes=(e,t)=>re(re({},e),t)})(nd||(nd={}));var y4=o(r=>e=>new Et(Te(re({},r),{shape:()=>re(re({},r.shape()),e)})),"AugmentFactory");function Ja(r){if(r instanceof Et){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=Gr.create(Ja(n))}return new Et(Te(re({},r._def),{shape:()=>e}))}else return r instanceof Kr?Kr.create(Ja(r.element)):r instanceof Gr?Gr.create(Ja(r.unwrap())):r instanceof bi?bi.create(Ja(r.unwrap())):r instanceof Vr?Vr.create(r.items.map(e=>Ja(e))):r}o(Ja,"deepPartialify");var Et=class extends ot{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=y4(this._def),this.extend=y4(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=kt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Me.object){let p=this._getOrReturnCtx(e);return Re(p,{code:Se.invalid_type,expected:Me.object,received:p.parsedType}),nt}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),f=[];for(let p in i.data)a.includes(p)||f.push(p);let u=[];for(let p of a){let b=s[p],x=i.data[p];u.push({key:{status:"valid",value:p},value:b._parse(new jr(i,x,i.path,p)),alwaysSet:p in i.data})}if(this._def.catchall instanceof Ln){let p=this._def.unknownKeys;if(p==="passthrough")for(let b of f)u.push({key:{status:"valid",value:b},value:{status:"valid",value:i.data[b]}});else if(p==="strict")f.length>0&&(Re(i,{code:Se.unrecognized_keys,keys:f}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let b of f){let x=i.data[b];u.push({key:{status:"valid",value:b},value:p._parse(new jr(i,x,i.path,b)),alwaysSet:b in i.data})}}return i.common.async?Promise.resolve().then(()=>Z(this,null,function*(){let p=[];for(let b of u){let x=yield b.key;p.push({key:x,value:yield b.value,alwaysSet:b.alwaysSet})}return p})).then(p=>or.mergeObjectSync(n,p)):or.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return xt.errToObj,new Et(re(Te(re({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(t,n)=>{var i,s,a,f;let u=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,t,n).message)!==null&&a!==void 0?a:n.defaultError;return t.code==="unrecognized_keys"?{message:(f=xt.errToObj(e).message)!==null&&f!==void 0?f:u}:{message:u}}}:{}))}strip(){return new Et(Te(re({},this._def),{unknownKeys:"strip"}))}passthrough(){return new Et(Te(re({},this._def),{unknownKeys:"passthrough"}))}setKey(e,t){return this.augment({[e]:t})}merge(e){return new Et({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>nd.mergeShapes(this._def.shape(),e._def.shape()),typeName:et.ZodObject})}catchall(e){return new Et(Te(re({},this._def),{catchall:e}))}pick(e){let t={};return kt.objectKeys(e).map(n=>{this.shape[n]&&(t[n]=this.shape[n])}),new Et(Te(re({},this._def),{shape:()=>t}))}omit(e){let t={};return kt.objectKeys(this.shape).map(n=>{kt.objectKeys(e).indexOf(n)===-1&&(t[n]=this.shape[n])}),new Et(Te(re({},this._def),{shape:()=>t}))}deepPartial(){return Ja(this)}partial(e){let t={};if(e)return kt.objectKeys(this.shape).map(n=>{kt.objectKeys(e).indexOf(n)===-1?t[n]=this.shape[n]:t[n]=this.shape[n].optional()}),new Et(Te(re({},this._def),{shape:()=>t}));for(let n in this.shape){let i=this.shape[n];t[n]=i.optional()}return new Et(Te(re({},this._def),{shape:()=>t}))}required(){let e={};for(let t in this.shape){let i=this.shape[t];for(;i instanceof Gr;)i=i._def.innerType;e[t]=i}return new Et(Te(re({},this._def),{shape:()=>e}))}};o(Et,"ZodObject");Et.create=(r,e)=>new Et(re({shape:()=>r,unknownKeys:"strip",catchall:Ln.create(),typeName:et.ZodObject},st(e)));Et.strictCreate=(r,e)=>new Et(re({shape:()=>r,unknownKeys:"strict",catchall:Ln.create(),typeName:et.ZodObject},st(e)));Et.lazycreate=(r,e)=>new Et(re({shape:r,unknownKeys:"strip",catchall:Ln.create(),typeName:et.ZodObject},st(e)));var wo=class extends ot{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function i(s){for(let f of s)if(f.result.status==="valid")return f.result;for(let f of s)if(f.result.status==="dirty")return t.common.issues.push(...f.ctx.common.issues),f.result;let a=s.map(f=>new bn(f.ctx.common.issues));return Re(t,{code:Se.invalid_union,unionErrors:a}),nt}if(o(i,"handleResults"),t.common.async)return Promise.all(n.map(s=>Z(this,null,function*(){let a=Te(re({},t),{common:Te(re({},t.common),{issues:[]}),parent:null});return{result:yield s._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}}))).then(i);{let s,a=[];for(let u of n){let p=Te(re({},t),{common:Te(re({},t.common),{issues:[]}),parent:null}),b=u._parseSync({data:t.data,path:t.path,parent:p});if(b.status==="valid")return b;b.status==="dirty"&&!s&&(s={result:b,ctx:p}),p.common.issues.length&&a.push(p.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let f=a.map(u=>new bn(u));return Re(t,{code:Se.invalid_union,unionErrors:f}),nt}}get options(){return this._def.options}};o(wo,"ZodUnion");wo.create=(r,e)=>new wo(re({options:r,typeName:et.ZodUnion},st(e)));var Ps=class extends ot{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Me.object)return Re(t,{code:Se.invalid_type,expected:Me.object,received:t.parsedType}),nt;let n=this.discriminator,i=t.data[n],s=this.options.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(Re(t,{code:Se.invalid_union_discriminator,options:this.validDiscriminatorValues,path:[n]}),nt)}get discriminator(){return this._def.discriminator}get validDiscriminatorValues(){return Array.from(this.options.keys())}get options(){return this._def.options}static create(e,t,n){let i=new Map;try{t.forEach(s=>{let a=s.shape[e].value;i.set(a,s)})}catch(s){throw new Error("The discriminator value could not be extracted from all the provided schemas")}if(i.size!==t.length)throw new Error("Some of the discriminator values are not unique");return new Ps(re({typeName:et.ZodDiscriminatedUnion,discriminator:e,options:i},st(n)))}};o(Ps,"ZodDiscriminatedUnion");function um(r,e){let t=xo(r),n=xo(e);if(r===e)return{valid:!0,data:r};if(t===Me.object&&n===Me.object){let i=kt.objectKeys(e),s=kt.objectKeys(r).filter(f=>i.indexOf(f)!==-1),a=re(re({},r),e);for(let f of s){let u=um(r[f],e[f]);if(!u.valid)return{valid:!1};a[f]=u.data}return{valid:!0,data:a}}else if(t===Me.array&&n===Me.array){if(r.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<r.length;s++){let a=r[s],f=e[s],u=um(a,f);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return t===Me.date&&n===Me.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}o(um,"mergeValues");var _o=class extends ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=o((s,a)=>{if(am(s)||am(a))return nt;let f=um(s.value,a.value);return f.valid?((fm(s)||fm(a))&&t.dirty(),{status:t.value,value:f.data}):(Re(n,{code:Se.invalid_intersection_types}),nt)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};o(_o,"ZodIntersection");_o.create=(r,e,t)=>new _o(re({left:r,right:e,typeName:et.ZodIntersection},st(t)));var Vr=class extends ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.array)return Re(n,{code:Se.invalid_type,expected:Me.array,received:n.parsedType}),nt;if(n.data.length<this._def.items.length)return Re(n,{code:Se.too_small,minimum:this._def.items.length,inclusive:!0,type:"array"}),nt;!this._def.rest&&n.data.length>this._def.items.length&&(Re(n,{code:Se.too_big,maximum:this._def.items.length,inclusive:!0,type:"array"}),t.dirty());let s=n.data.map((a,f)=>{let u=this._def.items[f]||this._def.rest;return u?u._parse(new jr(n,a,n.path,f)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>or.mergeArray(t,a)):or.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Vr(Te(re({},this._def),{rest:e}))}};o(Vr,"ZodTuple");Vr.create=(r,e)=>new Vr(re({items:r,typeName:et.ZodTuple,rest:null},st(e)));var Eo=class extends ot{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.object)return Re(n,{code:Se.invalid_type,expected:Me.object,received:n.parsedType}),nt;let i=[],s=this._def.keyType,a=this._def.valueType;for(let f in n.data)i.push({key:s._parse(new jr(n,f,n.path,f)),value:a._parse(new jr(n,n.data[f],n.path,f))});return n.common.async?or.mergeObjectAsync(t,i):or.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof ot?new Eo(re({keyType:e,valueType:t,typeName:et.ZodRecord},st(n))):new Eo(re({keyType:Nn.create(),valueType:e,typeName:et.ZodRecord},st(t)))}};o(Eo,"ZodRecord");var Ns=class extends ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.map)return Re(n,{code:Se.invalid_type,expected:Me.map,received:n.parsedType}),nt;let i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([f,u],p)=>({key:i._parse(new jr(n,f,n.path,[p,"key"])),value:s._parse(new jr(n,u,n.path,[p,"value"]))}));if(n.common.async){let f=new Map;return Promise.resolve().then(()=>Z(this,null,function*(){for(let u of a){let p=yield u.key,b=yield u.value;if(p.status==="aborted"||b.status==="aborted")return nt;(p.status==="dirty"||b.status==="dirty")&&t.dirty(),f.set(p.value,b.value)}return{status:t.value,value:f}}))}else{let f=new Map;for(let u of a){let p=u.key,b=u.value;if(p.status==="aborted"||b.status==="aborted")return nt;(p.status==="dirty"||b.status==="dirty")&&t.dirty(),f.set(p.value,b.value)}return{status:t.value,value:f}}}};o(Ns,"ZodMap");Ns.create=(r,e,t)=>new Ns(re({valueType:e,keyType:r,typeName:et.ZodMap},st(t)));var pi=class extends ot{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.set)return Re(n,{code:Se.invalid_type,expected:Me.set,received:n.parsedType}),nt;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Re(n,{code:Se.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Re(n,{code:Se.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,message:i.maxSize.message}),t.dirty());let s=this._def.valueType;function a(u){let p=new Set;for(let b of u){if(b.status==="aborted")return nt;b.status==="dirty"&&t.dirty(),p.add(b.value)}return{status:t.value,value:p}}o(a,"finalizeSet");let f=[...n.data.values()].map((u,p)=>s._parse(new jr(n,u,n.path,p)));return n.common.async?Promise.all(f).then(u=>a(u)):a(f)}min(e,t){return new pi(Te(re({},this._def),{minSize:{value:e,message:xt.toString(t)}}))}max(e,t){return new pi(Te(re({},this._def),{maxSize:{value:e,message:xt.toString(t)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};o(pi,"ZodSet");pi.create=(r,e)=>new pi(re({valueType:r,minSize:null,maxSize:null,typeName:et.ZodSet},st(e)));var mi=class extends ot{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Me.function)return Re(t,{code:Se.invalid_type,expected:Me.function,received:t.parsedType}),nt;function n(f,u){return td({data:f,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xc,yc].filter(p=>!!p),issueData:{code:Se.invalid_arguments,argumentsError:u}})}o(n,"makeArgsIssue");function i(f,u){return td({data:f,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,xc,yc].filter(p=>!!p),issueData:{code:Se.invalid_return_type,returnTypeError:u}})}o(i,"makeReturnsIssue");let s={errorMap:t.common.contextualErrorMap},a=t.data;return this._def.returns instanceof Hi?_r((...f)=>Z(this,null,function*(){let u=new bn([]),p=yield this._def.args.parseAsync(f,s).catch(A=>{throw u.addIssue(n(f,A)),u}),b=yield a(...p);return yield this._def.returns._def.type.parseAsync(b,s).catch(A=>{throw u.addIssue(i(b,A)),u})})):_r((...f)=>{let u=this._def.args.safeParse(f,s);if(!u.success)throw new bn([n(f,u.error)]);let p=a(...u.data),b=this._def.returns.safeParse(p,s);if(!b.success)throw new bn([i(p,b.error)]);return b.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new mi(Te(re({},this._def),{args:Vr.create(e).rest(Rn.create())}))}returns(e){return new mi(Te(re({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}};o(mi,"ZodFunction");mi.create=(r,e,t)=>new mi(re({args:r?r.rest(Rn.create()):Vr.create([]).rest(Rn.create()),returns:e||Rn.create(),typeName:et.ZodFunction},st(t)));var Rs=class extends ot{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};o(Rs,"ZodLazy");Rs.create=(r,e)=>new Rs(re({getter:r,typeName:et.ZodLazy},st(e)));var Ls=class extends ot{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Re(t,{code:Se.invalid_literal,expected:this._def.value}),nt}return{status:"valid",value:e.data}}get value(){return this._def.value}};o(Ls,"ZodLiteral");Ls.create=(r,e)=>new Ls(re({value:r,typeName:et.ZodLiteral},st(e)));function LD(r,e){return new Bs(re({values:r,typeName:et.ZodEnum},st(e)))}o(LD,"createZodEnum");var Bs=class extends ot{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return Re(t,{expected:kt.joinValues(n),received:t.parsedType,code:Se.invalid_type}),nt}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return Re(t,{received:t.data,code:Se.invalid_enum_value,options:n}),nt}return _r(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}};o(Bs,"ZodEnum");Bs.create=LD;var Us=class extends ot{_parse(e){let t=kt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Me.string&&n.parsedType!==Me.number){let i=kt.objectValues(t);return Re(n,{expected:kt.joinValues(i),received:n.parsedType,code:Se.invalid_type}),nt}if(t.indexOf(e.data)===-1){let i=kt.objectValues(t);return Re(n,{received:n.data,code:Se.invalid_enum_value,options:i}),nt}return _r(e.data)}get enum(){return this._def.values}};o(Us,"ZodNativeEnum");Us.create=(r,e)=>new Us(re({values:r,typeName:et.ZodNativeEnum},st(e)));var Hi=class extends ot{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Me.promise&&t.common.async===!1)return Re(t,{code:Se.invalid_type,expected:Me.promise,received:t.parsedType}),nt;let n=t.parsedType===Me.promise?t.data:Promise.resolve(t.data);return _r(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};o(Hi,"ZodPromise");Hi.create=(r,e)=>new Hi(re({type:r,typeName:et.ZodPromise},st(e)));var Wr=class extends ot{innerType(){return this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null;if(i.type==="preprocess"){let a=i.transform(n.data);return n.common.async?Promise.resolve(a).then(f=>this._def.schema._parseAsync({data:f,path:n.path,parent:n})):this._def.schema._parseSync({data:a,path:n.path,parent:n})}let s={addIssue:a=>{Re(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="refinement"){let a=o(f=>{let u=i.refinement(f,s);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return f},"executeRefinement");if(n.common.async===!1){let f=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return f.status==="aborted"?nt:(f.status==="dirty"&&t.dirty(),a(f.value),{status:t.value,value:f.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(f=>f.status==="aborted"?nt:(f.status==="dirty"&&t.dirty(),a(f.value).then(()=>({status:t.value,value:f.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!rd(a))return a;let f=i.transform(a.value,s);if(f instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:f}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>rd(a)?Promise.resolve(i.transform(a.value,s)).then(f=>({status:t.value,value:f})):a);kt.assertNever(i)}};o(Wr,"ZodEffects");Wr.create=(r,e,t)=>new Wr(re({schema:r,typeName:et.ZodEffects,effect:e},st(t)));Wr.createWithPreprocess=(r,e,t)=>new Wr(re({schema:e,effect:{type:"preprocess",transform:r},typeName:et.ZodEffects},st(t)));var Gr=class extends ot{_parse(e){return this._getType(e)===Me.undefined?_r(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};o(Gr,"ZodOptional");Gr.create=(r,e)=>new Gr(re({innerType:r,typeName:et.ZodOptional},st(e)));var bi=class extends ot{_parse(e){return this._getType(e)===Me.null?_r(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};o(bi,"ZodNullable");bi.create=(r,e)=>new bi(re({innerType:r,typeName:et.ZodNullable},st(e)));var Xa=class extends ot{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===Me.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};o(Xa,"ZodDefault");Xa.create=(r,e)=>new Gr(re({innerType:r,typeName:et.ZodOptional},st(e)));var Fs=class extends ot{_parse(e){if(this._getType(e)!==Me.nan){let n=this._getOrReturnCtx(e);return Re(n,{code:Se.invalid_type,expected:Me.nan,received:n.parsedType}),nt}return{status:"valid",value:e.data}}};o(Fs,"ZodNaN");Fs.create=r=>new Fs(re({typeName:et.ZodNaN},st(r)));var w4=o((r,e={},t)=>r?qi.create().superRefine((n,i)=>{if(!r(n)){let s=typeof e=="function"?e(n):e,a=typeof s=="string"?{message:s}:s;i.addIssue(Te(re({code:"custom"},a),{fatal:t}))}}):qi.create(),"custom"),BD={object:Et.lazycreate},et;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodPromise="ZodPromise"})(et||(et={}));var UD=o((r,e={message:`Input not instance of ${r.name}`})=>w4(t=>t instanceof r,e,!0),"instanceOfType"),_4=Nn.create,E4=hi.create,FD=Fs.create,$D=Ts.create,S4=ks.create,qD=Cs.create,HD=Ds.create,zD=Is.create,jD=qi.create,KD=Rn.create,VD=Ln.create,WD=Os.create,GD=Kr.create,YD=Et.create,JD=Et.strictCreate,XD=wo.create,ZD=Ps.create,QD=_o.create,eI=Vr.create,tI=Eo.create,rI=Ns.create,nI=pi.create,iI=mi.create,oI=Rs.create,sI=Ls.create,aI=Bs.create,fI=Us.create,cI=Hi.create,x4=Wr.create,uI=Gr.create,lI=bi.create,dI=Wr.createWithPreprocess,hI=o(()=>_4().optional(),"ostring"),pI=o(()=>E4().optional(),"onumber"),mI=o(()=>S4().optional(),"oboolean"),oe=Object.freeze({__proto__:null,getParsedType:xo,ZodParsedType:Me,makeIssue:td,EMPTY_PATH:DD,addIssueToContext:Re,ParseStatus:or,INVALID:nt,DIRTY:ID,OK:_r,isAborted:am,isDirty:fm,isValid:rd,isAsync:cm,ZodType:ot,ZodString:Nn,ZodNumber:hi,ZodBigInt:Ts,ZodBoolean:ks,ZodDate:Cs,ZodUndefined:Ds,ZodNull:Is,ZodAny:qi,ZodUnknown:Rn,ZodNever:Ln,ZodVoid:Os,ZodArray:Kr,get objectUtil(){return nd},ZodObject:Et,ZodUnion:wo,ZodDiscriminatedUnion:Ps,ZodIntersection:_o,ZodTuple:Vr,ZodRecord:Eo,ZodMap:Ns,ZodSet:pi,ZodFunction:mi,ZodLazy:Rs,ZodLiteral:Ls,ZodEnum:Bs,ZodNativeEnum:Us,ZodPromise:Hi,ZodEffects:Wr,ZodTransformer:Wr,ZodOptional:Gr,ZodNullable:bi,ZodDefault:Xa,ZodNaN:Fs,custom:w4,Schema:ot,ZodSchema:ot,late:BD,get ZodFirstPartyTypeKind(){return et},any:jD,array:GD,bigint:$D,boolean:S4,date:qD,discriminatedUnion:ZD,effect:x4,enum:aI,function:iI,instanceof:UD,intersection:QD,lazy:oI,literal:sI,map:rI,nan:FD,nativeEnum:fI,never:VD,null:zD,nullable:lI,number:E4,object:YD,oboolean:mI,onumber:pI,optional:uI,ostring:hI,preprocess:dI,promise:cI,record:tI,set:nI,strictObject:JD,string:_4,transformer:x4,tuple:eI,undefined:HD,union:XD,unknown:KD,void:WD,ZodIssueCode:Se,quotelessJson:kD,ZodError:bn,defaultErrorMap:yc,get overrideErrorMap(){return xc},setErrorMap:CD});var T4=oe.string().array(),zV=oe.object({type:oe.string().optional(),narrative:oe.string().optional()}),dm=oe.string().or(oe.object({id:oe.string(),type:oe.string(),caption:oe.string().optional()})),bI=oe.object({type:oe.string().array().nonempty(),latitude:oe.number(),longitude:oe.number()}),gI=oe.object({type:oe.string().array().nonempty(),addressCountry:oe.string().optional(),addressCountryCode:oe.string().optional(),addressRegion:oe.string().optional(),addressLocality:oe.string().optional(),streetAddress:oe.string().optional(),postOfficeBoxNumber:oe.string().optional(),postalCode:oe.string().optional(),geo:bI.optional()}),vI=oe.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(oe.string()),k4=oe.object({type:oe.string().array().nonempty(),identifier:oe.string(),identifierType:vI}),wc=oe.string().or(oe.object({id:oe.string().optional(),type:oe.string().array().nonempty().optional(),name:oe.string().optional(),url:oe.string().optional(),phone:oe.string().optional(),description:oe.string().optional(),endorsement:oe.any().array().optional(),image:dm.optional(),email:oe.string().email().optional(),address:gI.optional(),otherIdentifier:k4.array().optional(),official:oe.string().optional(),parentOrg:oe.any().optional(),familyName:oe.string().optional(),givenName:oe.string().optional(),additionalName:oe.string().optional(),patronymicName:oe.string().optional(),honorificPrefix:oe.string().optional(),honorificSuffix:oe.string().optional(),familyNamePrefix:oe.string().optional(),dateOfBirth:oe.string().optional()}).catchall(oe.any())),lm=oe.object({id:oe.string().optional()}).catchall(oe.any()),yI=oe.object({type:oe.string(),id:oe.string()}),xI=oe.object({id:oe.string(),type:oe.string()}),wI=oe.object({id:oe.string(),type:oe.string()}).catchall(oe.any()),id=oe.object({"@context":T4,id:oe.string().optional(),type:oe.string().array().nonempty(),issuer:wc,issuanceDate:oe.string(),expirationDate:oe.string().optional(),credentialSubject:lm.or(lm.array()),credentialStatus:yI.optional(),credentialSchema:xI.array().optional(),refreshService:wI.optional()}).catchall(oe.any()),So=oe.object({type:oe.string(),created:oe.string(),challenge:oe.string().optional(),domain:oe.string().optional(),nonce:oe.string().optional(),proofPurpose:oe.string(),verificationMethod:oe.string(),jws:oe.string().optional()}).catchall(oe.any()),M4=id.extend({proof:So.or(So.array())}),_I=oe.object({"@context":T4,id:oe.string().optional(),type:oe.string().array().nonempty(),verifiableCredential:M4.or(M4.array()),holder:oe.string().optional()}).catchall(oe.any()),jV=_I.extend({proof:So.or(So.array())}),EI=oe.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(oe.string()),od=oe.object({type:oe.string().array().nonempty(),targetCode:oe.string().optional(),targetDescription:oe.string().optional(),targetName:oe.string(),targetFramework:oe.string().optional(),targetType:EI.optional(),targetUrl:oe.string()}),SI=oe.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"]).or(oe.string()),MI=oe.object({id:oe.string().optional(),narrative:oe.string().optional()}).catchall(oe.any()),AI=oe.object({id:oe.string(),type:oe.string().array().nonempty(),endorsementComment:oe.string().optional()}),TI=id.extend({credentialSubject:AI,proof:So.or(So.array()).optional()}),kI=oe.object({id:oe.string(),"@language":oe.string().optional(),version:oe.string().optional()}),CI=oe.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(oe.string()),DI=oe.object({id:oe.string(),type:oe.string().array().nonempty(),alignment:od.array().optional(),description:oe.string().optional(),level:oe.string().optional(),name:oe.string(),points:oe.string().optional()}).catchall(oe.any()),II=oe.object({id:oe.string(),type:oe.string().array().nonempty(),alignment:od.array().optional(),allowedValue:oe.string().array().optional(),name:oe.string(),requiredLevel:oe.string().optional(),requiredValue:oe.string().optional(),resultType:CI,rubricCriterionLevel:DI.array().optional(),valueMax:oe.string().optional(),valueMin:oe.string().optional()}).catchall(oe.any()),OI=oe.object({id:oe.string().optional(),type:oe.string().array().nonempty(),alignment:od.array().optional(),achievementType:SI.optional(),creator:wc.optional(),creditsAvailable:oe.number().optional(),criteria:MI,description:oe.string(),endorsement:TI.array().optional(),fieldOfStudy:oe.string().optional(),humanCode:oe.string().optional(),image:dm.optional(),"@language":oe.string().optional(),name:oe.string(),otherIdentifier:k4.array().optional(),related:kI.array().optional(),resultDescription:II.array().optional(),specialization:oe.string().optional(),tag:oe.string().array().optional(),version:oe.string().optional()}).catchall(oe.any()),PI=oe.object({type:oe.string(),hashed:oe.boolean(),identityHash:oe.string(),identityType:oe.string(),salt:oe.string().optional()}),NI=oe.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),RI=oe.object({type:oe.string().array().nonempty(),achievedLevel:oe.string().optional(),alignment:od.array().optional(),resultDescription:oe.string().optional(),status:NI.optional(),value:oe.string().optional()}).catchall(oe.any()),A4=oe.object({id:oe.string().optional(),type:oe.string().array().nonempty(),activityEndDate:oe.string().optional(),activityStartDate:oe.string().optional(),creditsEarned:oe.number().optional(),achievement:OI.optional(),identifier:PI.optional(),image:dm.optional(),licenseNumber:oe.string().optional(),narrative:oe.string().optional(),result:RI.array().optional(),role:oe.string().optional(),source:wc.optional(),term:oe.string().optional()}).catchall(oe.any()),LI=oe.object({id:oe.string().optional(),type:oe.string().array().nonempty(),narrative:oe.string().optional(),name:oe.string().optional(),description:oe.string().optional(),genre:oe.string().optional(),audience:oe.string().optional()}).catchall(oe.any()),BI=id.extend({name:oe.string().optional(),description:oe.string().optional(),image:oe.string().optional(),credentialSubject:A4.or(A4.array()),endorsement:id.array().optional(),evidence:LI.array().optional()}),VV=BI.extend({proof:So.or(So.array())}),GV=oe.object({checks:oe.string().array(),warnings:oe.string().array(),errors:oe.string().array()}),C4=oe.enum(["Success","Failed","Error"]),sd=C4.enum,YV=oe.object({check:oe.string(),status:C4,message:oe.string().optional(),details:oe.string().optional()}),JV=oe.object({title:oe.string().optional(),createdAt:oe.string().optional(),issuer:wc.optional(),issuee:wc.optional(),credentialSubject:lm.optional()});function Ht(r){if(r===null||r===!0||r===!1)return NaN;var e=Number(r);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}o(Ht,"toInteger");function pt(r,e){if(e.length<r)throw new TypeError(r+" argument"+(r>1?"s":"")+" required, but only "+e.length+" present")}o(pt,"requiredArgs");function Ft(r){pt(1,arguments);var e=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&e==="[object Date]"?new Date(r.getTime()):typeof r=="number"||e==="[object Number]"?new Date(r):((typeof r=="string"||e==="[object String]")&&typeof console!="undefined"&&(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://git.io/fjule"),console.warn(new Error().stack)),new Date(NaN))}o(Ft,"toDate");function hm(r,e){pt(2,arguments);var t=Ft(r).getTime(),n=Ht(e);return new Date(t+n)}o(hm,"addMilliseconds");function pm(r){var e=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return e.setUTCFullYear(r.getFullYear()),r.getTime()-e.getTime()}o(pm,"getTimezoneOffsetInMilliseconds");function mm(r){return pt(1,arguments),r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}o(mm,"isDate");function bm(r){if(pt(1,arguments),!mm(r)&&typeof r!="number")return!1;var e=Ft(r);return!isNaN(Number(e))}o(bm,"isValid");var UI={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"}},FI=o(function(r,e,t){var n,i=UI[r];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n},"formatDistance"),D4=FI;function _c(r){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.width?String(e.width):r.defaultWidth,n=r.formats[t]||r.formats[r.defaultWidth];return n}}o(_c,"buildFormatLongFn");var $I={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},qI={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},HI={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},zI={date:_c({formats:$I,defaultWidth:"full"}),time:_c({formats:qI,defaultWidth:"full"}),dateTime:_c({formats:HI,defaultWidth:"full"})},I4=zI;var jI={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},KI=o(function(r,e,t,n){return jI[r]},"formatRelative"),O4=KI;function $s(r){return function(e,t){var n=t||{},i=n.context?String(n.context):"standalone",s;if(i==="formatting"&&r.formattingValues){var a=r.defaultFormattingWidth||r.defaultWidth,f=n.width?String(n.width):a;s=r.formattingValues[f]||r.formattingValues[a]}else{var u=r.defaultWidth,p=n.width?String(n.width):r.defaultWidth;s=r.values[p]||r.values[u]}var b=r.argumentCallback?r.argumentCallback(e):e;return s[b]}}o($s,"buildLocalizeFn");var VI={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},WI={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},GI={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"]},YI={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"]},JI={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"}},XI={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"}},ZI=o(function(r,e){var t=Number(r),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},"ordinalNumber"),QI={ordinalNumber:ZI,era:$s({values:VI,defaultWidth:"wide"}),quarter:$s({values:WI,defaultWidth:"wide",argumentCallback:function(r){return r-1}}),month:$s({values:GI,defaultWidth:"wide"}),day:$s({values:YI,defaultWidth:"wide"}),dayPeriod:$s({values:JI,defaultWidth:"wide",formattingValues:XI,defaultFormattingWidth:"wide"})},P4=QI;function qs(r){return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.width,i=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],s=e.match(i);if(!s)return null;var a=s[0],f=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],u=Array.isArray(f)?tO(f,function(x){return x.test(a)}):eO(f,function(x){return x.test(a)}),p;p=r.valueCallback?r.valueCallback(u):u,p=t.valueCallback?t.valueCallback(p):p;var b=e.slice(a.length);return{value:p,rest:b}}}o(qs,"buildMatchFn");function eO(r,e){for(var t in r)if(r.hasOwnProperty(t)&&e(r[t]))return t}o(eO,"findKey");function tO(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return t}o(tO,"findIndex");function gm(r){return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.match(r.matchPattern);if(!n)return null;var i=n[0],s=e.match(r.parsePattern);if(!s)return null;var a=r.valueCallback?r.valueCallback(s[0]):s[0];a=t.valueCallback?t.valueCallback(a):a;var f=e.slice(i.length);return{value:a,rest:f}}}o(gm,"buildMatchPatternFn");var rO=/^(\d+)(th|st|nd|rd)?/i,nO=/\d+/i,iO={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},oO={any:[/^b/i,/^(a|c)/i]},sO={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},aO={any:[/1/i,/2/i,/3/i,/4/i]},fO={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},cO={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]},uO={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},lO={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]},dO={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},hO={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}},pO={ordinalNumber:gm({matchPattern:rO,parsePattern:nO,valueCallback:function(r){return parseInt(r,10)}}),era:qs({matchPatterns:iO,defaultMatchWidth:"wide",parsePatterns:oO,defaultParseWidth:"any"}),quarter:qs({matchPatterns:sO,defaultMatchWidth:"wide",parsePatterns:aO,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:qs({matchPatterns:fO,defaultMatchWidth:"wide",parsePatterns:cO,defaultParseWidth:"any"}),day:qs({matchPatterns:uO,defaultMatchWidth:"wide",parsePatterns:lO,defaultParseWidth:"any"}),dayPeriod:qs({matchPatterns:dO,defaultMatchWidth:"any",parsePatterns:hO,defaultParseWidth:"any"})},N4=pO;var mO={code:"en-US",formatDistance:D4,formatLong:I4,formatRelative:O4,localize:P4,match:N4,options:{weekStartsOn:0,firstWeekContainsDate:1}},R4=mO;function vm(r,e){pt(2,arguments);var t=Ht(e);return hm(r,-t)}o(vm,"subMilliseconds");var bO=864e5;function ym(r){pt(1,arguments);var e=Ft(r),t=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var n=e.getTime(),i=t-n;return Math.floor(i/bO)+1}o(ym,"getUTCDayOfYear");function Mo(r){pt(1,arguments);var e=1,t=Ft(r),n=t.getUTCDay(),i=(n<e?7:0)+n-e;return t.setUTCDate(t.getUTCDate()-i),t.setUTCHours(0,0,0,0),t}o(Mo,"startOfUTCISOWeek");function Ec(r){pt(1,arguments);var e=Ft(r),t=e.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(t+1,0,4),n.setUTCHours(0,0,0,0);var i=Mo(n),s=new Date(0);s.setUTCFullYear(t,0,4),s.setUTCHours(0,0,0,0);var a=Mo(s);return e.getTime()>=i.getTime()?t+1:e.getTime()>=a.getTime()?t:t-1}o(Ec,"getUTCISOWeekYear");function xm(r){pt(1,arguments);var e=Ec(r),t=new Date(0);t.setUTCFullYear(e,0,4),t.setUTCHours(0,0,0,0);var n=Mo(t);return n}o(xm,"startOfUTCISOWeekYear");var gO=6048e5;function wm(r){pt(1,arguments);var e=Ft(r),t=Mo(e).getTime()-xm(e).getTime();return Math.round(t/gO)+1}o(wm,"getUTCISOWeek");function Ao(r,e){pt(1,arguments);var t=e||{},n=t.locale,i=n&&n.options&&n.options.weekStartsOn,s=i==null?0:Ht(i),a=t.weekStartsOn==null?s:Ht(t.weekStartsOn);if(!(a>=0&&a<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=Ft(r),u=f.getUTCDay(),p=(u<a?7:0)+u-a;return f.setUTCDate(f.getUTCDate()-p),f.setUTCHours(0,0,0,0),f}o(Ao,"startOfUTCWeek");function Sc(r,e){pt(1,arguments);var t=Ft(r),n=t.getUTCFullYear(),i=e||{},s=i.locale,a=s&&s.options&&s.options.firstWeekContainsDate,f=a==null?1:Ht(a),u=i.firstWeekContainsDate==null?f:Ht(i.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setUTCFullYear(n+1,0,u),p.setUTCHours(0,0,0,0);var b=Ao(p,e),x=new Date(0);x.setUTCFullYear(n,0,u),x.setUTCHours(0,0,0,0);var A=Ao(x,e);return t.getTime()>=b.getTime()?n+1:t.getTime()>=A.getTime()?n:n-1}o(Sc,"getUTCWeekYear");function _m(r,e){pt(1,arguments);var t=e||{},n=t.locale,i=n&&n.options&&n.options.firstWeekContainsDate,s=i==null?1:Ht(i),a=t.firstWeekContainsDate==null?s:Ht(t.firstWeekContainsDate),f=Sc(r,e),u=new Date(0);u.setUTCFullYear(f,0,a),u.setUTCHours(0,0,0,0);var p=Ao(u,e);return p}o(_m,"startOfUTCWeekYear");var vO=6048e5;function Em(r,e){pt(1,arguments);var t=Ft(r),n=Ao(t,e).getTime()-_m(t,e).getTime();return Math.round(n/vO)+1}o(Em,"getUTCWeek");function ut(r,e){for(var t=r<0?"-":"",n=Math.abs(r).toString();n.length<e;)n="0"+n;return t+n}o(ut,"addLeadingZeros");var yO={y:function(r,e){var t=r.getUTCFullYear(),n=t>0?t:1-t;return ut(e==="yy"?n%100:n,e.length)},M:function(r,e){var t=r.getUTCMonth();return e==="M"?String(t+1):ut(t+1,2)},d:function(r,e){return ut(r.getUTCDate(),e.length)},a:function(r,e){var t=r.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h:function(r,e){return ut(r.getUTCHours()%12||12,e.length)},H:function(r,e){return ut(r.getUTCHours(),e.length)},m:function(r,e){return ut(r.getUTCMinutes(),e.length)},s:function(r,e){return ut(r.getUTCSeconds(),e.length)},S:function(r,e){var t=e.length,n=r.getUTCMilliseconds(),i=Math.floor(n*Math.pow(10,t-3));return ut(i,e.length)}},zi=yO;var Za={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},xO={G:function(r,e,t){var n=r.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){var n=r.getUTCFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return zi.y(r,e)},Y:function(r,e,t,n){var i=Sc(r,n),s=i>0?i:1-i;if(e==="YY"){var a=s%100;return ut(a,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):ut(s,e.length)},R:function(r,e){var t=Ec(r);return ut(t,e.length)},u:function(r,e){var t=r.getUTCFullYear();return ut(t,e.length)},Q:function(r,e,t){var n=Math.ceil((r.getUTCMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return ut(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){var n=Math.ceil((r.getUTCMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return ut(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){var n=r.getUTCMonth();switch(e){case"M":case"MM":return zi.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){var n=r.getUTCMonth();switch(e){case"L":return String(n+1);case"LL":return ut(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){var i=Em(r,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):ut(i,e.length)},I:function(r,e,t){var n=wm(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):ut(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getUTCDate(),{unit:"date"}):zi.d(r,e)},D:function(r,e,t){var n=ym(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):ut(n,e.length)},E:function(r,e,t){var n=r.getUTCDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){var i=r.getUTCDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return ut(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){var i=r.getUTCDay(),s=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return ut(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(r,e,t){var n=r.getUTCDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return ut(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){var n=r.getUTCHours(),i=n/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(r,e,t){var n=r.getUTCHours(),i;switch(n===12?i=Za.noon:n===0?i=Za.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(r,e,t){var n=r.getUTCHours(),i;switch(n>=17?i=Za.evening:n>=12?i=Za.afternoon:n>=4?i=Za.morning:i=Za.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){var n=r.getUTCHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return zi.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getUTCHours(),{unit:"hour"}):zi.H(r,e)},K:function(r,e,t){var n=r.getUTCHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):ut(n,e.length)},k:function(r,e,t){var n=r.getUTCHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):ut(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getUTCMinutes(),{unit:"minute"}):zi.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getUTCSeconds(),{unit:"second"}):zi.s(r,e)},S:function(r,e){return zi.S(r,e)},X:function(r,e,t,n){var i=n._originalDate||r,s=i.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return B4(s);case"XXXX":case"XX":return Hs(s);case"XXXXX":case"XXX":default:return Hs(s,":")}},x:function(r,e,t,n){var i=n._originalDate||r,s=i.getTimezoneOffset();switch(e){case"x":return B4(s);case"xxxx":case"xx":return Hs(s);case"xxxxx":case"xxx":default:return Hs(s,":")}},O:function(r,e,t,n){var i=n._originalDate||r,s=i.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+L4(s,":");case"OOOO":default:return"GMT"+Hs(s,":")}},z:function(r,e,t,n){var i=n._originalDate||r,s=i.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+L4(s,":");case"zzzz":default:return"GMT"+Hs(s,":")}},t:function(r,e,t,n){var i=n._originalDate||r,s=Math.floor(i.getTime()/1e3);return ut(s,e.length)},T:function(r,e,t,n){var i=n._originalDate||r,s=i.getTime();return ut(s,e.length)}};function L4(r,e){var t=r>0?"-":"+",n=Math.abs(r),i=Math.floor(n/60),s=n%60;if(s===0)return t+String(i);var a=e||"";return t+String(i)+a+ut(s,2)}o(L4,"formatTimezoneShort");function B4(r,e){if(r%60===0){var t=r>0?"-":"+";return t+ut(Math.abs(r)/60,2)}return Hs(r,e)}o(B4,"formatTimezoneWithOptionalMinutes");function Hs(r,e){var t=e||"",n=r>0?"-":"+",i=Math.abs(r),s=ut(Math.floor(i/60),2),a=ut(i%60,2);return n+s+t+a}o(Hs,"formatTimezone");var U4=xO;function F4(r,e){switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}}o(F4,"dateLongFormatter");function $4(r,e){switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}}o($4,"timeLongFormatter");function wO(r,e){var t=r.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return F4(r,e);var s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",F4(n,e)).replace("{{time}}",$4(i,e))}o(wO,"dateTimeLongFormatter");var _O={p:$4,P:wO},q4=_O;var EO=["D","DD"],SO=["YY","YYYY"];function H4(r){return EO.indexOf(r)!==-1}o(H4,"isProtectedDayOfYearToken");function z4(r){return SO.indexOf(r)!==-1}o(z4,"isProtectedWeekYearToken");function Sm(r,e,t){if(r==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(r==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(r==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(r==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(t,"`; see: https://git.io/fxCyr"))}o(Sm,"throwProtectedError");var MO=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,AO=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,TO=/^'([^]*?)'?$/,kO=/''/g,CO=/[a-zA-Z]/;function Mc(r,e,t){pt(2,arguments);var n=String(e),i=t||{},s=i.locale||R4,a=s.options&&s.options.firstWeekContainsDate,f=a==null?1:Ht(a),u=i.firstWeekContainsDate==null?f:Ht(i.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=s.options&&s.options.weekStartsOn,b=p==null?0:Ht(p),x=i.weekStartsOn==null?b:Ht(i.weekStartsOn);if(!(x>=0&&x<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!s.localize)throw new RangeError("locale must contain localize property");if(!s.formatLong)throw new RangeError("locale must contain formatLong property");var A=Ft(r);if(!bm(A))throw new RangeError("Invalid time value");var O=pm(A),T=vm(A,O),k={firstWeekContainsDate:u,weekStartsOn:x,locale:s,_originalDate:A},$=n.match(AO).map(function(C){var B=C[0];if(B==="p"||B==="P"){var z=q4[B];return z(C,s.formatLong,k)}return C}).join("").match(MO).map(function(C){if(C==="''")return"'";var B=C[0];if(B==="'")return DO(C);var z=U4[B];if(z)return!i.useAdditionalWeekYearTokens&&z4(C)&&Sm(C,e,r),!i.useAdditionalDayOfYearTokens&&H4(C)&&Sm(C,e,r),z(T,C,s.localize,k);if(B.match(CO))throw new RangeError("Format string contains an unescaped latin alphabet character `"+B+"`");return C}).join("");return $}o(Mc,"format");function DO(r){return r.match(TO)[1].replace(kO,"'")}o(DO,"cleanEscapedString");var IO=o((r,e)=>r.split(" error")[0]||r,"transformErrorCheck"),OO=o((r,e)=>r.startsWith("expiration")?e.expirationDate?`Invalid \u2022 Expired ${Mc(new Date(e.expirationDate),"dd MMM yyyy").toUpperCase()}`:"Invalid \u2022 Expired":r,"transformErrorMessage"),PO=o((r,e)=>({proof:"Valid",expiration:e.expirationDate?`Valid \u2022 Expires ${Mc(new Date(e.expirationDate),"dd MMM yyyy").toUpperCase()}`:"Valid \u2022 Does Not Expire"})[r]||r,"transformCheckMessage"),j4=o(r=>e=>Z(void 0,null,function*(){let t=yield r.pluginMethods.verifyCredential(e),n=[];return t.errors.forEach(i=>{n.push({status:sd.Failed,check:IO(i,e),details:OO(i,e)})}),t.warnings.forEach(i=>{n.push({status:sd.Error,check:"hmm",message:i})}),t.checks.forEach(i=>{n.push({status:sd.Success,check:i,message:PO(i,e)})}),n}),"verifyCredential");var K4={modelData:{definitions:{MyVerifiableCredentials:"kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"},schemas:{AchievementVerifiableCredential:"ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",VerifiableCredentialsList:"ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"},tiles:{}},credentialAlias:"MyVerifiableCredentials",ceramicEndpoint:"https://ceramic-node.welibrary.io:7007",defaultContentFamily:"SuperSkills"},V4={address:"",infuraProjectId:"",network:"mainnet"};var Ae,W4=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});W4.decode();var ad=null;function Qa(){return(ad===null||ad.buffer!==Ae.memory.buffer)&&(ad=new Uint8Array(Ae.memory.buffer)),ad}o(Qa,"getUint8Memory0");function gi(r,e){return W4.decode(Qa().subarray(r,r+e))}o(gi,"getStringFromWasm0");var ji=new Array(32).fill(void 0);ji.push(void 0,null,!0,!1);var Ac=ji.length;function Ze(r){Ac===ji.length&&ji.push(ji.length+1);let e=Ac;return Ac=ji[e],ji[e]=r,e}o(Ze,"addHeapObject");function Ie(r){return ji[r]}o(Ie,"getObject");function NO(r){r<36||(ji[r]=Ac,Ac=r)}o(NO,"dropObject");function vi(r){let e=Ie(r);return NO(r),e}o(vi,"takeObject");var Rt=0,cd=new TextEncoder("utf-8"),RO=typeof cd.encodeInto=="function"?function(r,e){return cd.encodeInto(r,e)}:function(r,e){let t=cd.encode(r);return e.set(t),{read:r.length,written:t.length}};function sr(r,e,t){if(t===void 0){let f=cd.encode(r),u=e(f.length);return Qa().subarray(u,u+f.length).set(f),Rt=f.length,u}let n=r.length,i=e(n),s=Qa(),a=0;for(;a<n;a++){let f=r.charCodeAt(a);if(f>127)break;s[i+a]=f}if(a!==n){a!==0&&(r=r.slice(a)),i=t(i,n,n=a+r.length*3);let f=Qa().subarray(i+a,i+n);a+=RO(r,f).written}return Rt=a,i}o(sr,"passStringToWasm0");function LO(r){return r==null}o(LO,"isLikeNone");var fd=null;function Xt(){return(fd===null||fd.buffer!==Ae.memory.buffer)&&(fd=new Int32Array(Ae.memory.buffer)),fd}o(Xt,"getInt32Memory0");function Mm(r){let e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){let i=r.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){let i=r.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(r)){let i=r.length,s="[";i>0&&(s+=Mm(r[0]));for(let a=1;a<i;a++)s+=", "+Mm(r[a]);return s+="]",s}let t=/\[object ([^\]]+)\]/.exec(toString.call(r)),n;if(t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch(i){return"Object"}return r instanceof Error?`${r.name}: ${r.message}
792
+ ${r.stack}`:n}o(Mm,"debugString");function BO(r,e,t,n){let i={a:r,b:e,cnt:1,dtor:t},s=o((...a)=>{i.cnt++;let f=i.a;i.a=0;try{return n(f,i.b,...a)}finally{--i.cnt===0?Ae.__wbindgen_export_2.get(i.dtor)(f,i.b):i.a=f}},"real");return s.original=i,s}o(BO,"makeMutClosure");function UO(r,e,t){Ae._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(r,e,Ze(t))}o(UO,"__wbg_adapter_24");function G4(r,e){let t=e(r.length*1);return Qa().set(r,t/1),Rt=r.length,t}o(G4,"passArray8ToWasm0");function Y4(r){try{let f=Ae.__wbindgen_add_to_stack_pointer(-16),u=G4(r,Ae.__wbindgen_malloc),p=Rt;Ae.generateEd25519KeyFromBytes(f,u,p);var e=Xt()[f/4+0],t=Xt()[f/4+1],n=Xt()[f/4+2],i=Xt()[f/4+3],s=e,a=t;if(i)throw s=0,a=0,vi(n);return gi(s,a)}finally{Ae.__wbindgen_add_to_stack_pointer(16),Ae.__wbindgen_free(s,a)}}o(Y4,"generateEd25519KeyFromBytes");function J4(r){try{let f=Ae.__wbindgen_add_to_stack_pointer(-16),u=G4(r,Ae.__wbindgen_malloc),p=Rt;Ae.generateSecp256k1KeyFromBytes(f,u,p);var e=Xt()[f/4+0],t=Xt()[f/4+1],n=Xt()[f/4+2],i=Xt()[f/4+3],s=e,a=t;if(i)throw s=0,a=0,vi(n);return gi(s,a)}finally{Ae.__wbindgen_add_to_stack_pointer(16),Ae.__wbindgen_free(s,a)}}o(J4,"generateSecp256k1KeyFromBytes");function X4(r,e){try{let u=Ae.__wbindgen_add_to_stack_pointer(-16),p=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),b=Rt,x=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),A=Rt;Ae.keyToDID(u,p,b,x,A);var t=Xt()[u/4+0],n=Xt()[u/4+1],i=Xt()[u/4+2],s=Xt()[u/4+3],a=t,f=n;if(s)throw a=0,f=0,vi(i);return gi(a,f)}finally{Ae.__wbindgen_add_to_stack_pointer(16),Ae.__wbindgen_free(a,f)}}o(X4,"keyToDID");function Z4(r,e){let t=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),n=Rt,i=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),s=Rt,a=Ae.keyToVerificationMethod(t,n,i,s);return vi(a)}o(Z4,"keyToVerificationMethod");function Q4(r,e,t){let n=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),i=Rt,s=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),a=Rt,f=sr(t,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),u=Rt,p=Ae.issueCredential(n,i,s,a,f,u);return vi(p)}o(Q4,"issueCredential");function e5(r,e){let t=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),n=Rt,i=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),s=Rt,a=Ae.verifyCredential(t,n,i,s);return vi(a)}o(e5,"verifyCredential");function t5(r,e,t){let n=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),i=Rt,s=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),a=Rt,f=sr(t,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),u=Rt,p=Ae.issuePresentation(n,i,s,a,f,u);return vi(p)}o(t5,"issuePresentation");function r5(r,e){let t=sr(r,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),n=Rt,i=sr(e,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),s=Rt,a=Ae.verifyPresentation(t,n,i,s);return vi(a)}o(r5,"verifyPresentation");function gr(r,e){try{return r.apply(this,e)}catch(t){Ae.__wbindgen_exn_store(Ze(t))}}o(gr,"handleError");function FO(r,e){return Qa().subarray(r/1,r/1+e)}o(FO,"getArrayU8FromWasm0");function $O(r,e,t,n){Ae.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(r,e,Ze(t),Ze(n))}o($O,"__wbg_adapter_110");function qO(r,e){return Z(this,null,function*(){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return yield WebAssembly.instantiateStreaming(r,e)}catch(n){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let t=yield r.arrayBuffer();return yield WebAssembly.instantiate(t,e)}else{let t=yield WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}})}o(qO,"load");function n5(r){return Z(this,null,function*(){let e={};e.wbg={},e.wbg.__wbindgen_string_new=function(i,s){let a=gi(i,s);return Ze(a)},e.wbg.__wbindgen_object_drop_ref=function(i){vi(i)},e.wbg.__wbindgen_cb_drop=function(i){let s=vi(i).original;return s.cnt--==1?(s.a=0,!0):!1},e.wbg.__wbindgen_object_clone_ref=function(i){let s=Ie(i);return Ze(s)},e.wbg.__wbg_fetch_811d43d6bdcad5b1=function(i){let s=fetch(Ie(i));return Ze(s)},e.wbg.__wbg_fetch_bf56e2a9f0644e3f=function(i,s){let a=Ie(i).fetch(Ie(s));return Ze(a)},e.wbg.__wbg_new_89d7f088c1c45353=function(){return gr(function(){let i=new Headers;return Ze(i)},arguments)},e.wbg.__wbg_append_f4f93bc73c45ee3e=function(){return gr(function(i,s,a,f,u){Ie(i).append(gi(s,a),gi(f,u))},arguments)},e.wbg.__wbindgen_string_get=function(i,s){let a=Ie(s),f=typeof a=="string"?a:void 0;var u=LO(f)?0:sr(f,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),p=Rt;Xt()[i/4+1]=p,Xt()[i/4+0]=u},e.wbg.__wbg_instanceof_Response_ccfeb62399355bcd=function(i){return Ie(i)instanceof Response},e.wbg.__wbg_url_06c0f822d68d195c=function(i,s){let a=Ie(s).url,f=sr(a,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),u=Rt;Xt()[i/4+1]=u,Xt()[i/4+0]=f},e.wbg.__wbg_status_600fd8b881393898=function(i){return Ie(i).status},e.wbg.__wbg_headers_9e7f2c05a9b962ea=function(i){let s=Ie(i).headers;return Ze(s)},e.wbg.__wbg_arrayBuffer_5a99283a3954c850=function(){return gr(function(i){let s=Ie(i).arrayBuffer();return Ze(s)},arguments)},e.wbg.__wbg_newwithstrandinit_fd99688f189f053e=function(){return gr(function(i,s,a){let f=new Request(gi(i,s),Ie(a));return Ze(f)},arguments)},e.wbg.__wbindgen_is_object=function(i){let s=Ie(i);return typeof s=="object"&&s!==null},e.wbg.__wbg_self_86b4b13392c7af56=function(){return gr(function(){let i=self.self;return Ze(i)},arguments)},e.wbg.__wbg_crypto_b8c92eaac23d0d80=function(i){let s=Ie(i).crypto;return Ze(s)},e.wbg.__wbg_msCrypto_9ad6677321a08dd8=function(i){let s=Ie(i).msCrypto;return Ze(s)},e.wbg.__wbindgen_is_undefined=function(i){return Ie(i)===void 0},e.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81=function(){return Ze(n)},e.wbg.__wbg_require_f5521a5b85ad2542=function(i,s,a){let f=Ie(i).require(gi(s,a));return Ze(f)},e.wbg.__wbg_getRandomValues_dd27e6b0652b3236=function(i){let s=Ie(i).getRandomValues;return Ze(s)},e.wbg.__wbg_getRandomValues_e57c9b75ddead065=function(i,s){Ie(i).getRandomValues(Ie(s))},e.wbg.__wbg_randomFillSync_d2ba53160aec6aba=function(i,s,a){Ie(i).randomFillSync(FO(s,a))},e.wbg.__wbindgen_is_function=function(i){return typeof Ie(i)=="function"},e.wbg.__wbg_newnoargs_e23b458e372830de=function(i,s){let a=new Function(gi(i,s));return Ze(a)},e.wbg.__wbg_next_cabb70b365520721=function(i){let s=Ie(i).next;return Ze(s)},e.wbg.__wbg_next_bf3d83fc18df496e=function(){return gr(function(i){let s=Ie(i).next();return Ze(s)},arguments)},e.wbg.__wbg_done_040f966faa9a72b3=function(i){return Ie(i).done},e.wbg.__wbg_value_419afbd9b9574c4c=function(i){let s=Ie(i).value;return Ze(s)},e.wbg.__wbg_iterator_4832ef1f15b0382b=function(){return Ze(Symbol.iterator)},e.wbg.__wbg_get_a9cab131e3152c49=function(){return gr(function(i,s){let a=Reflect.get(Ie(i),Ie(s));return Ze(a)},arguments)},e.wbg.__wbg_call_ae78342adc33730a=function(){return gr(function(i,s){let a=Ie(i).call(Ie(s));return Ze(a)},arguments)},e.wbg.__wbg_new_36359baae5a47e27=function(){let i=new Object;return Ze(i)},e.wbg.__wbg_call_3ed288a247f13ea5=function(){return gr(function(i,s,a){let f=Ie(i).call(Ie(s),Ie(a));return Ze(f)},arguments)},e.wbg.__wbg_getTime_bffb1c09df09618b=function(i){return Ie(i).getTime()},e.wbg.__wbg_new0_0ff7eb5c1486f3ec=function(){let i=new Date;return Ze(i)},e.wbg.__wbg_new_37705eed627d5ed9=function(i,s){try{var a={a:i,b:s},f=o((p,b)=>{let x=a.a;a.a=0;try{return $O(x,a.b,p,b)}finally{a.a=x}},"cb0");let u=new Promise(f);return Ze(u)}finally{a.a=a.b=0}},e.wbg.__wbg_resolve_a9a87bdd64e9e62c=function(i){let s=Promise.resolve(Ie(i));return Ze(s)},e.wbg.__wbg_then_ce526c837d07b68f=function(i,s){let a=Ie(i).then(Ie(s));return Ze(a)},e.wbg.__wbg_then_842e65b843962f56=function(i,s,a){let f=Ie(i).then(Ie(s),Ie(a));return Ze(f)},e.wbg.__wbg_self_99737b4dcdf6f0d8=function(){return gr(function(){let i=self.self;return Ze(i)},arguments)},e.wbg.__wbg_window_9b61fbbf3564c4fb=function(){return gr(function(){let i=window.window;return Ze(i)},arguments)},e.wbg.__wbg_globalThis_8e275ef40caea3a3=function(){return gr(function(){let i=globalThis.globalThis;return Ze(i)},arguments)},e.wbg.__wbg_global_5de1e0f82bddcd27=function(){return gr(function(){let i=global.global;return Ze(i)},arguments)},e.wbg.__wbg_buffer_7af23f65f6c64548=function(i){let s=Ie(i).buffer;return Ze(s)},e.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974=function(i,s,a){let f=new Uint8Array(Ie(i),s>>>0,a>>>0);return Ze(f)},e.wbg.__wbg_new_cc9018bd6f283b6f=function(i){let s=new Uint8Array(Ie(i));return Ze(s)},e.wbg.__wbg_set_f25e869e4565d2a2=function(i,s,a){Ie(i).set(Ie(s),a>>>0)},e.wbg.__wbg_length_0acb1cf9bbaf8519=function(i){return Ie(i).length},e.wbg.__wbg_newwithlength_8f0657faca9f1422=function(i){let s=new Uint8Array(i>>>0);return Ze(s)},e.wbg.__wbg_subarray_da527dbd24eafb6b=function(i,s,a){let f=Ie(i).subarray(s>>>0,a>>>0);return Ze(f)},e.wbg.__wbg_has_ce995ec88636803d=function(){return gr(function(i,s){return Reflect.has(Ie(i),Ie(s))},arguments)},e.wbg.__wbg_set_93b1c87ee2af852e=function(){return gr(function(i,s,a){return Reflect.set(Ie(i),Ie(s),Ie(a))},arguments)},e.wbg.__wbg_stringify_c760003feffcc1f2=function(){return gr(function(i){let s=JSON.stringify(Ie(i));return Ze(s)},arguments)},e.wbg.__wbindgen_debug_string=function(i,s){let a=Mm(Ie(s)),f=sr(a,Ae.__wbindgen_malloc,Ae.__wbindgen_realloc),u=Rt;Xt()[i/4+1]=u,Xt()[i/4+0]=f},e.wbg.__wbindgen_throw=function(i,s){throw new Error(gi(i,s))},e.wbg.__wbindgen_memory=function(){let i=Ae.memory;return Ze(i)},e.wbg.__wbindgen_closure_wrapper10913=function(i,s,a){let f=BO(i,s,3725,UO);return Ze(f)},(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));let{instance:t,module:n}=yield qO(yield r,e);return Ae=t.exports,n5.__wbindgen_wasm_module=n,Ae})}o(n5,"init");var i5=n5;var o5=!1,HO=o((r="https://cdn.filestackcontent.com/dlXanMvQCGDR76JXcBkA")=>Z(void 0,null,function*(){if(!o5)return o5=!0,i5(r)}),"init"),s5=HO;var a5=o(r=>Z(void 0,null,function*(){yield s5(r);let e={};return{pluginMethods:{generateEd25519KeyFromBytes:(t,n)=>JSON.parse(Y4(n)),generateSecp256k1KeyFromBytes:(t,n)=>JSON.parse(J4(n)),keyToDid:(t,n,i)=>{let s=e[n];if(!s){let a=X4(n,JSON.stringify(i));return e[n]=a,a}return s},keyToVerificationMethod:(t,n,i)=>Z(void 0,null,function*(){return Z4(n,JSON.stringify(i))}),issueCredential:(t,n,i,s)=>Z(void 0,null,function*(){return JSON.parse(yield Q4(JSON.stringify(n),JSON.stringify(i),JSON.stringify(s)))}),verifyCredential:(t,n)=>Z(void 0,null,function*(){return JSON.parse(yield e5(JSON.stringify(n),"{}"))}),issuePresentation:(t,n,i,s)=>Z(void 0,null,function*(){return JSON.parse(yield t5(JSON.stringify(n),JSON.stringify(i),JSON.stringify(s)))}),verifyPresentation:(t,n)=>Z(void 0,null,function*(){return JSON.parse(yield r5(JSON.stringify(n),"{}"))})}}}),"getDidKitPlugin");var f5=o((s,...a)=>Z(void 0,[s,...a],function*(r,{ceramicIdx:e=K4,didkit:t,defaultContents:n=[],ethereumConfig:i=V4}={}){let f=yield(yield tf(n)).addPlugin(yield a5(t)),u=yield f.addPlugin(yield c4(f,r)),p=yield u.addPlugin(yield sm(u)),b=yield p.addPlugin(yield ed(p,e)),x=yield b.addPlugin(u4(b)),A=yield x.addPlugin(g4(x,i));return{_wallet:A,did:(O="key")=>A.pluginMethods.getSubjectDid(O),keypair:(O="ed25519")=>A.pluginMethods.getSubjectKeypair(O),issueCredential:A.pluginMethods.issueCredential,verifyCredential:j4(A),issuePresentation:A.pluginMethods.issuePresentation,verifyPresentation:A.pluginMethods.verifyPresentation,getCredential:A.pluginMethods.getVerifiableCredentialFromIdx,getCredentials:A.pluginMethods.getVerifiableCredentialsFromIdx,getCredentialsList:()=>Z(void 0,null,function*(){return(yield A.pluginMethods.getCredentialsListFromIdx()).credentials}),publishCredential:A.pluginMethods.publishContentToCeramic,addCredential:O=>Z(void 0,null,function*(){yield A.pluginMethods.addVerifiableCredentialInIdx(O)}),removeCredential:O=>Z(void 0,null,function*(){yield A.pluginMethods.removeVerifiableCredentialInIdx(O)}),readFromCeramic:A.pluginMethods.readContentFromCeramic,getTestVc:A.pluginMethods.getTestVc,getTestVp:A.pluginMethods.getTestVp,checkMyEth:A.pluginMethods.checkMyEth,checkMyDai:A.pluginMethods.checkMyDai,checkMyUsdc:A.pluginMethods.checkMyUsdc}}),"walletFromKey");
793
793
  /*!
794
794
  * https://github.com/Starcounter-Jack/JSON-Patch
795
795
  * (c) 2017-2021 Joachim Wester