@learncard/idx-plugin 1.0.46 → 1.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/idx-plugin.cjs.development.js +16 -6
- package/dist/idx-plugin.cjs.development.js.map +2 -2
- package/dist/idx-plugin.cjs.production.min.js +2 -2
- package/dist/idx-plugin.cjs.production.min.js.map +2 -2
- package/dist/idx-plugin.esm.js +16 -6
- package/dist/idx-plugin.esm.js.map +2 -2
- package/package.json +4 -4
|
@@ -21,7 +21,7 @@ if (cid) {
|
|
|
21
21
|
`;var dv={};En(dv,{base36:()=>ra,base36upper:()=>CN});var ra=Qo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),CN=Qo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var q8={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function MN(e){let t=q8[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(MN,"codeByName");function IN(e){let t=Object.entries(q8).find(([,r])=>r===e);if(t)return t[0];throw new Error(`No stream type registered for index ${e}`)}i(IN,"nameByCode");var na=class{};i(na,"StreamType");na.nameByCode=IN;na.codeByName=MN;var Zv=Ys(Mp(),1);function vu(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}i(vu,"asUint8Array");function Rf(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?vu(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}i(Rf,"allocUnsafe");function Of(e,t){t||(t=e.reduce((a,s)=>a+s.length,0));let r=Rf(t),n=0;for(let a of e)r.set(a,n),n+=a.length;return vu(r)}i(Of,"concat");var mv={};En(mv,{identity:()=>HN});var HN=mu({prefix:"\0",name:"identity",encode:e=>U8(e),decode:e=>L8(e)});var gv={};En(gv,{base2:()=>qN});var qN=Br({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var vv={};En(vv,{base8:()=>VN});var VN=Br({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var yv={};En(yv,{base10:()=>KN});var KN=Qo({prefix:"9",name:"base10",alphabet:"0123456789"});var bv={};En(bv,{base16:()=>GN,base16upper:()=>WN});var GN=Br({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),WN=Br({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var wv={};En(wv,{base64:()=>ZN,base64pad:()=>JN,base64url:()=>YN,base64urlpad:()=>XN});var ZN=Br({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),JN=Br({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),YN=Br({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),XN=Br({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var _v={};En(_v,{base256emoji:()=>nP});var eE=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),QN=eE.reduce((e,t,r)=>(e[r]=t,e),[]),eP=eE.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function tP(e){return e.reduce((t,r)=>(t+=QN[r],t),"")}i(tP,"encode");function rP(e){let t=[];for(let r of e){let n=eP[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}i(rP,"decode");var nP=mu({prefix:"\u{1F680}",name:"base256emoji",encode:tP,decode:rP});var Sv={};En(Sv,{sha256:()=>Av,sha512:()=>iP});var Ev=i(({name:e,code:t,encode:r})=>new Ip(e,t,r),"from"),Ip=class{constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){let r=this.encode(t);return r instanceof Uint8Array?Qs(this.code,r):r.then(n=>Qs(this.code,n))}else throw Error("Unknown type, must be binary type")}};i(Ip,"Hasher");var rE=i(e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),"sha"),Av=Ev({name:"sha2-256",code:18,encode:rE("SHA-256")}),iP=Ev({name:"sha2-512",code:19,encode:rE("SHA-512")});var xv={};En(xv,{identity:()=>sP});var nE=0,aP="identity",iE=mo,oP=i(e=>Qs(nE,iE(e)),"digest"),sP={code:nE,name:aP,encode:iE,digest:oP};var iW=new TextEncoder,aW=new TextDecoder;var Tv={...mv,...gv,...vv,...yv,...bv,...fv,...dv,...lv,...wv,..._v},uW={...Sv,...xv};function oE(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}i(oE,"createCodec");var aE=oE("utf8","u",e=>{let t=new TextDecoder("utf8");return"u"+t.decode(e)},e=>new TextEncoder().encode(e.substring(1))),Cv=oE("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);let t=Rf(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),lP={utf8:aE,"utf-8":aE,hex:Tv.base16,latin1:Cv,ascii:Cv,binary:Cv,...Tv},Mv=lP;function Iv(e,t="utf8"){let r=Mv[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}i(Iv,"toString");function fi(e){let t,r,n;return typeof e=="object"?(t=e.hashFunction,r=e.expiring,n=e.tags):t=e,(a,s,c)=>{if(c.value!=null)c.value=sE(c.value,t,r,n);else if(c.get!=null)c.get=sE(c.get,t,r,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}i(fi,"Memoize");var kv=new Map;function sE(e,t,r=0,n){let a=Symbol("__memoized_map__");return function(...s){let c;this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let l=this[a];if(Array.isArray(n))for(let d of n)kv.has(d)?kv.get(d).push(l):kv.set(d,[l]);if(t||s.length>0||r>0){let d;t===!0?d=s.map(v=>v.toString()).join("!"):t?d=t.apply(this,s):d=s[0];let p=`${d}__timestamp`,g=!1;if(r>0)if(!l.has(p))g=!0;else{let v=l.get(p);g=Date.now()-v>r}l.has(d)&&!g?c=l.get(d):(c=e.apply(this,s),l.set(d,c),r>0&&l.set(p,Date.now()))}else{let d=this;l.has(d)?c=l.get(d):(c=e.apply(this,s),l.set(d,c))}return c}}i(sE,"getNewFunction");var kp=i(({enumerable:e=!0,configurable:t=!1}={})=>({enumerable:e,configurable:t,writable:!1}),"readonly"),Dv=i(function*(e,t){if(e!=null&&!(e instanceof Uint8Array))for(let[r,n]of Object.entries(e)){let a=[...t,r];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let[s,c]of n.entries()){let l=[...a,s],d=qt.asCID(c);d?yield[l.join("/"),d]:typeof c=="object"&&(yield*Dv(c,l))}else{let s=qt.asCID(n);s?yield[a.join("/"),s]:yield*Dv(n,a)}}},"links"),Rv=i(function*(e,t){if(e!=null)for(let[r,n]of Object.entries(e)){let a=[...t,r];if(yield a.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!qt.asCID(n))if(Array.isArray(n))for(let[s,c]of n.entries()){let l=[...a,s];yield l.join("/"),typeof c=="object"&&!qt.asCID(c)&&(yield*Rv(c,l))}else yield*Rv(n,a)}},"tree"),dP=i((e,t)=>{let r=e;for(let[n,a]of t.entries()){if(r=r[a],r==null)throw new Error(`Object has no property at ${t.slice(0,n+1).map(c=>`[${JSON.stringify(c)}]`).join("")}`);let s=qt.asCID(r);if(s)return{value:s,remaining:t.slice(n+1).join("/")}}return{value:r}},"get"),Dp=class{constructor({cid:t,bytes:r,value:n}){if(!t||!r||typeof n>"u")throw new Error("Missing required argument");this.cid=t,this.bytes=r,this.value=n,this.asBlock=this,Object.defineProperties(this,{cid:kp(),bytes:kp(),value:kp(),asBlock:kp()})}links(){return Dv(this.value,[])}tree(){return Rv(this.value,[])}get(t="/"){return dP(this.value,t.split("/").filter(Boolean))}};i(Dp,"Block");var cE=i(async({value:e,codec:t,hasher:r})=>{if(typeof e>"u")throw new Error('Missing required argument "value"');if(!t||!r)throw new Error("Missing required argument: codec or hasher");let n=t.encode(e),a=await r.digest(n),s=qt.create(1,t.code,a);return new Dp({value:e,bytes:n,cid:s})},"encode");var Gv=Ys(Mp(),1);var Hp={};En(Hp,{code:()=>JP,decode:()=>YP,encode:()=>zv,name:()=>ZP});var pP=["string","number","bigint","symbol"],mP=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function uE(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(pP.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(gP(e))return"Buffer";let r=vP(e);return r||"Object"}i(uE,"is");function gP(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}i(gP,"isBuffer");function vP(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(mP.includes(t))return t}i(vP,"getObjectType");var Ne=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};i(Ne,"Type");Ne.uint=new Ne(0,"uint",!0);Ne.negint=new Ne(1,"negint",!0);Ne.bytes=new Ne(2,"bytes",!0);Ne.string=new Ne(3,"string",!0);Ne.array=new Ne(4,"array",!1);Ne.map=new Ne(5,"map",!1);Ne.tag=new Ne(6,"tag",!1);Ne.float=new Ne(7,"float",!0);Ne.false=new Ne(7,"false",!0);Ne.true=new Ne(7,"true",!0);Ne.null=new Ne(7,"null",!0);Ne.undefined=new Ne(7,"undefined",!0);Ne.break=new Ne(7,"break",!0);var tt=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};i(tt,"Token");var yu=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",yP=new TextDecoder,bP=new TextEncoder;function Rp(e){return yu&&globalThis.Buffer.isBuffer(e)}i(Rp,"isBuffer");function Ov(e){return e instanceof Uint8Array?Rp(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}i(Ov,"asU8A");var hE=yu?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):fE(e,t,r):(e,t,r)=>r-t>64?yP.decode(e.subarray(t,r)):fE(e,t,r),pE=yu?e=>e.length>64?globalThis.Buffer.from(e):lE(e):e=>e.length>64?bP.encode(e):lE(e),La=i(e=>Uint8Array.from(e),"fromArray"),bu=yu?(e,t,r)=>Rp(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),mE=yu?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Ov(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let a of e)n+a.length>r.length&&(a=a.subarray(0,r.length-n)),r.set(a,n),n+=a.length;return r},gE=yu?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function vE(e,t){if(Rp(e)&&Rp(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}i(vE,"compare");function lE(e,t=1/0){let r,n=e.length,a=null,s=[];for(let c=0;c<n;++c){if(r=e.charCodeAt(c),r>55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(c+1===n){(t-=3)>-1&&s.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),a=r;continue}r=(a-55296<<10|r-56320)+65536}else a&&(t-=3)>-1&&s.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}i(lE,"utf8ToBytes");function fE(e,t,r){let n=[];for(;t<r;){let a=e[t],s=null,c=a>239?4:a>223?3:a>191?2:1;if(t+c<=r){let l,d,p,g;switch(c){case 1:a<128&&(s=a);break;case 2:l=e[t+1],(l&192)===128&&(g=(a&31)<<6|l&63,g>127&&(s=g));break;case 3:l=e[t+1],d=e[t+2],(l&192)===128&&(d&192)===128&&(g=(a&15)<<12|(l&63)<<6|d&63,g>2047&&(g<55296||g>57343)&&(s=g));break;case 4:l=e[t+1],d=e[t+2],p=e[t+3],(l&192)===128&&(d&192)===128&&(p&192)===128&&(g=(a&15)<<18|(l&63)<<12|(d&63)<<6|p&63,g>65535&&g<1114112&&(s=g))}}s===null?(s=65533,c=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),t+=c}return wP(n)}i(fE,"utf8Slice");var dE=4096;function wP(e){let t=e.length;if(t<=dE)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=dE));return r}i(wP,"decodeCodePointsArray");var _P=256,wu=class{constructor(t=_P){this.chunkSize=t,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let a=r.length-(this.maxCursor-this.cursor)-1;r.set(t,a)}else{if(r){let a=r.length-(this.maxCursor-this.cursor)-1;a<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,a),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=gE(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=bu(n,0,this.cursor)}else r=mE(this.chunks,this.cursor);return t&&this.reset(),r}};i(wu,"Bl");var Ot="CBOR decode error:",Nv="CBOR encode error:",Nf=[];Nf[23]=1;Nf[24]=2;Nf[25]=3;Nf[26]=5;Nf[27]=9;function go(e,t,r){if(e.length-t<r)throw new Error(`${Ot} not enough data for type`)}i(go,"assertEnoughData");var en=[24,256,65536,4294967296,BigInt("18446744073709551616")];function di(e,t,r){go(e,t,1);let n=e[t];if(r.strict===!0&&n<en[0])throw new Error(`${Ot} integer encoded in more bytes than necessary (strict decode)`);return n}i(di,"readUint8");function hi(e,t,r){go(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<en[1])throw new Error(`${Ot} integer encoded in more bytes than necessary (strict decode)`);return n}i(hi,"readUint16");function pi(e,t,r){go(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<en[2])throw new Error(`${Ot} integer encoded in more bytes than necessary (strict decode)`);return n}i(pi,"readUint32");function mi(e,t,r){go(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],a=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],s=(BigInt(n)<<BigInt(32))+BigInt(a);if(r.strict===!0&&s<en[3])throw new Error(`${Ot} integer encoded in more bytes than necessary (strict decode)`);if(s<=Number.MAX_SAFE_INTEGER)return Number(s);if(r.allowBigInt===!0)return s;throw new Error(`${Ot} integers outside of the safe integer range are not supported`)}i(mi,"readUint64");function yE(e,t,r,n){return new tt(Ne.uint,di(e,t+1,n),2)}i(yE,"decodeUint8");function bE(e,t,r,n){return new tt(Ne.uint,hi(e,t+1,n),3)}i(bE,"decodeUint16");function wE(e,t,r,n){return new tt(Ne.uint,pi(e,t+1,n),5)}i(wE,"decodeUint32");function _E(e,t,r,n){return new tt(Ne.uint,mi(e,t+1,n),9)}i(_E,"decodeUint64");function ji(e,t){return cn(e,0,t.value)}i(ji,"encodeUint");function cn(e,t,r){if(r<en[0]){let n=Number(r);e.push([t|n])}else if(r<en[1]){let n=Number(r);e.push([t|24,n])}else if(r<en[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<en[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<en[4]){let a=[t|27,0,0,0,0,0,0,0],s=Number(n&BigInt(4294967295)),c=Number(n>>BigInt(32)&BigInt(4294967295));a[8]=s&255,s=s>>8,a[7]=s&255,s=s>>8,a[6]=s&255,s=s>>8,a[5]=s&255,a[4]=c&255,c=c>>8,a[3]=c&255,c=c>>8,a[2]=c&255,c=c>>8,a[1]=c&255,e.push(a)}else throw new Error(`${Ot} encountered BigInt larger than allowable range`)}}i(cn,"encodeUintValue");ji.encodedSize=i(function(t){return cn.encodedSize(t.value)},"encodedSize");cn.encodedSize=i(function(t){return t<en[0]?1:t<en[1]?2:t<en[2]?3:t<en[3]?5:9},"encodedSize");ji.compareTokens=i(function(t,r){return t.value<r.value?-1:t.value>r.value?1:0},"compareTokens");function EE(e,t,r,n){return new tt(Ne.negint,-1-di(e,t+1,n),2)}i(EE,"decodeNegint8");function AE(e,t,r,n){return new tt(Ne.negint,-1-hi(e,t+1,n),3)}i(AE,"decodeNegint16");function SE(e,t,r,n){return new tt(Ne.negint,-1-pi(e,t+1,n),5)}i(SE,"decodeNegint32");var Pv=BigInt(-1),xE=BigInt(1);function TE(e,t,r,n){let a=mi(e,t+1,n);if(typeof a!="bigint"){let s=-1-a;if(s>=Number.MIN_SAFE_INTEGER)return new tt(Ne.negint,s,9)}if(n.allowBigInt!==!0)throw new Error(`${Ot} integers outside of the safe integer range are not supported`);return new tt(Ne.negint,Pv-BigInt(a),9)}i(TE,"decodeNegint64");function Op(e,t){let r=t.value,n=typeof r=="bigint"?r*Pv-xE:r*-1-1;cn(e,t.type.majorEncoded,n)}i(Op,"encodeNegint");Op.encodedSize=i(function(t){let r=t.value,n=typeof r=="bigint"?r*Pv-xE:r*-1-1;return n<en[0]?1:n<en[1]?2:n<en[2]?3:n<en[3]?5:9},"encodedSize");Op.compareTokens=i(function(t,r){return t.value<r.value?1:t.value>r.value?-1:0},"compareTokens");function Pf(e,t,r,n){go(e,t,r+n);let a=bu(e,t+r,t+r+n);return new tt(Ne.bytes,a,r+n)}i(Pf,"toToken");function CE(e,t,r,n){return Pf(e,t,1,r)}i(CE,"decodeBytesCompact");function ME(e,t,r,n){return Pf(e,t,2,di(e,t+1,n))}i(ME,"decodeBytes8");function IE(e,t,r,n){return Pf(e,t,3,hi(e,t+1,n))}i(IE,"decodeBytes16");function kE(e,t,r,n){return Pf(e,t,5,pi(e,t+1,n))}i(kE,"decodeBytes32");function DE(e,t,r,n){let a=mi(e,t+1,n);if(typeof a=="bigint")throw new Error(`${Ot} 64-bit integer bytes lengths not supported`);return Pf(e,t,9,a)}i(DE,"decodeBytes64");function Np(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Ne.string?pE(e.value):e.value),e.encodedBytes}i(Np,"tokenBytes");function _u(e,t){let r=Np(t);cn(e,t.type.majorEncoded,r.length),e.push(r)}i(_u,"encodeBytes");_u.encodedSize=i(function(t){let r=Np(t);return cn.encodedSize(r.length)+r.length},"encodedSize");_u.compareTokens=i(function(t,r){return AP(Np(t),Np(r))},"compareTokens");function AP(e,t){return e.length<t.length?-1:e.length>t.length?1:vE(e,t)}i(AP,"compareBytes");function Bf(e,t,r,n,a){let s=r+n;go(e,t,s);let c=new tt(Ne.string,hE(e,t+r,t+s),s);return a.retainStringBytes===!0&&(c.byteValue=bu(e,t+r,t+s)),c}i(Bf,"toToken");function RE(e,t,r,n){return Bf(e,t,1,r,n)}i(RE,"decodeStringCompact");function OE(e,t,r,n){return Bf(e,t,2,di(e,t+1,n),n)}i(OE,"decodeString8");function NE(e,t,r,n){return Bf(e,t,3,hi(e,t+1,n),n)}i(NE,"decodeString16");function PE(e,t,r,n){return Bf(e,t,5,pi(e,t+1,n),n)}i(PE,"decodeString32");function BE(e,t,r,n){let a=mi(e,t+1,n);if(typeof a=="bigint")throw new Error(`${Ot} 64-bit integer string lengths not supported`);return Bf(e,t,9,a,n)}i(BE,"decodeString64");var LE=_u;function Eu(e,t,r,n){return new tt(Ne.array,n,r)}i(Eu,"toToken");function UE(e,t,r,n){return Eu(e,t,1,r)}i(UE,"decodeArrayCompact");function FE(e,t,r,n){return Eu(e,t,2,di(e,t+1,n))}i(FE,"decodeArray8");function jE(e,t,r,n){return Eu(e,t,3,hi(e,t+1,n))}i(jE,"decodeArray16");function $E(e,t,r,n){return Eu(e,t,5,pi(e,t+1,n))}i($E,"decodeArray32");function zE(e,t,r,n){let a=mi(e,t+1,n);if(typeof a=="bigint")throw new Error(`${Ot} 64-bit integer array lengths not supported`);return Eu(e,t,9,a)}i(zE,"decodeArray64");function HE(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ot} indefinite length items not allowed`);return Eu(e,t,1,1/0)}i(HE,"decodeArrayIndefinite");function Pp(e,t){cn(e,Ne.array.majorEncoded,t.value)}i(Pp,"encodeArray");Pp.compareTokens=ji.compareTokens;Pp.encodedSize=i(function(t){return cn.encodedSize(t.value)},"encodedSize");function Au(e,t,r,n){return new tt(Ne.map,n,r)}i(Au,"toToken");function qE(e,t,r,n){return Au(e,t,1,r)}i(qE,"decodeMapCompact");function VE(e,t,r,n){return Au(e,t,2,di(e,t+1,n))}i(VE,"decodeMap8");function KE(e,t,r,n){return Au(e,t,3,hi(e,t+1,n))}i(KE,"decodeMap16");function GE(e,t,r,n){return Au(e,t,5,pi(e,t+1,n))}i(GE,"decodeMap32");function WE(e,t,r,n){let a=mi(e,t+1,n);if(typeof a=="bigint")throw new Error(`${Ot} 64-bit integer map lengths not supported`);return Au(e,t,9,a)}i(WE,"decodeMap64");function ZE(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ot} indefinite length items not allowed`);return Au(e,t,1,1/0)}i(ZE,"decodeMapIndefinite");function Bp(e,t){cn(e,Ne.map.majorEncoded,t.value)}i(Bp,"encodeMap");Bp.compareTokens=ji.compareTokens;Bp.encodedSize=i(function(t){return cn.encodedSize(t.value)},"encodedSize");function JE(e,t,r,n){return new tt(Ne.tag,r,1)}i(JE,"decodeTagCompact");function YE(e,t,r,n){return new tt(Ne.tag,di(e,t+1,n),2)}i(YE,"decodeTag8");function XE(e,t,r,n){return new tt(Ne.tag,hi(e,t+1,n),3)}i(XE,"decodeTag16");function QE(e,t,r,n){return new tt(Ne.tag,pi(e,t+1,n),5)}i(QE,"decodeTag32");function e9(e,t,r,n){return new tt(Ne.tag,mi(e,t+1,n),9)}i(e9,"decodeTag64");function Lp(e,t){cn(e,Ne.tag.majorEncoded,t.value)}i(Lp,"encodeTag");Lp.compareTokens=ji.compareTokens;Lp.encodedSize=i(function(t){return cn.encodedSize(t.value)},"encodedSize");var IP=20,kP=21,DP=22,RP=23;function t9(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ot} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new tt(Ne.null,null,1):new tt(Ne.undefined,void 0,1)}i(t9,"decodeUndefined");function r9(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ot} indefinite length items not allowed`);return new tt(Ne.break,void 0,1)}i(r9,"decodeBreak");function Bv(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ot} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ot} Infinity values are not supported`)}return new tt(Ne.float,e,t)}i(Bv,"createToken");function n9(e,t,r,n){return Bv(Lv(e,t+1),3,n)}i(n9,"decodeFloat16");function i9(e,t,r,n){return Bv(Uv(e,t+1),5,n)}i(i9,"decodeFloat32");function a9(e,t,r,n){return Bv(u9(e,t+1),9,n)}i(a9,"decodeFloat64");function Up(e,t,r){let n=t.value;if(n===!1)e.push([Ne.float.majorEncoded|IP]);else if(n===!0)e.push([Ne.float.majorEncoded|kP]);else if(n===null)e.push([Ne.float.majorEncoded|DP]);else if(n===void 0)e.push([Ne.float.majorEncoded|RP]);else{let a,s=!1;(!r||r.float64!==!0)&&(s9(n),a=Lv(ia,1),n===a||Number.isNaN(n)?(ia[0]=249,e.push(ia.slice(0,3)),s=!0):(c9(n),a=Uv(ia,1),n===a&&(ia[0]=250,e.push(ia.slice(0,5)),s=!0))),s||(OP(n),a=u9(ia,1),ia[0]=251,e.push(ia.slice(0,9)))}}i(Up,"encodeFloat");Up.encodedSize=i(function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){s9(n);let a=Lv(ia,1);if(n===a||Number.isNaN(n))return 3;if(c9(n),a=Uv(ia,1),n===a)return 5}return 9},"encodedSize");var o9=new ArrayBuffer(9),$i=new DataView(o9,1),ia=new Uint8Array(o9,0);function s9(e){if(e===1/0)$i.setUint16(0,31744,!1);else if(e===-1/0)$i.setUint16(0,64512,!1);else if(Number.isNaN(e))$i.setUint16(0,32256,!1);else{$i.setFloat32(0,e);let t=$i.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)$i.setUint16(0,31744,!1);else if(r===0)$i.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let a=r-127;a<-24?$i.setUint16(0,0):a<-14?$i.setUint16(0,(t&2147483648)>>16|1<<24+a,!1):$i.setUint16(0,(t&2147483648)>>16|a+15<<10|n>>13,!1)}}}i(s9,"encodeFloat16");function Lv(e,t){if(e.length-t<2)throw new Error(`${Ot} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,a=r&1023,s;return n===0?s=a*2**-24:n!==31?s=(a+1024)*2**(n-25):s=a===0?1/0:NaN,r&32768?-s:s}i(Lv,"readFloat16");function c9(e){$i.setFloat32(0,e,!1)}i(c9,"encodeFloat32");function Uv(e,t){if(e.length-t<4)throw new Error(`${Ot} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}i(Uv,"readFloat32");function OP(e){$i.setFloat64(0,e,!1)}i(OP,"encodeFloat64");function u9(e,t){if(e.length-t<8)throw new Error(`${Ot} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}i(u9,"readFloat64");Up.compareTokens=ji.compareTokens;function ur(e,t,r){throw new Error(`${Ot} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}i(ur,"invalidMinor");function Fp(e){return()=>{throw new Error(`${Ot} ${e}`)}}i(Fp,"errorer");var We=[];for(let e=0;e<=23;e++)We[e]=ur;We[24]=yE;We[25]=bE;We[26]=wE;We[27]=_E;We[28]=ur;We[29]=ur;We[30]=ur;We[31]=ur;for(let e=32;e<=55;e++)We[e]=ur;We[56]=EE;We[57]=AE;We[58]=SE;We[59]=TE;We[60]=ur;We[61]=ur;We[62]=ur;We[63]=ur;for(let e=64;e<=87;e++)We[e]=CE;We[88]=ME;We[89]=IE;We[90]=kE;We[91]=DE;We[92]=ur;We[93]=ur;We[94]=ur;We[95]=Fp("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)We[e]=RE;We[120]=OE;We[121]=NE;We[122]=PE;We[123]=BE;We[124]=ur;We[125]=ur;We[126]=ur;We[127]=Fp("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)We[e]=UE;We[152]=FE;We[153]=jE;We[154]=$E;We[155]=zE;We[156]=ur;We[157]=ur;We[158]=ur;We[159]=HE;for(let e=160;e<=183;e++)We[e]=qE;We[184]=VE;We[185]=KE;We[186]=GE;We[187]=WE;We[188]=ur;We[189]=ur;We[190]=ur;We[191]=ZE;for(let e=192;e<=215;e++)We[e]=JE;We[216]=YE;We[217]=XE;We[218]=QE;We[219]=e9;We[220]=ur;We[221]=ur;We[222]=ur;We[223]=ur;for(let e=224;e<=243;e++)We[e]=Fp("simple values are not supported");We[244]=ur;We[245]=ur;We[246]=ur;We[247]=t9;We[248]=Fp("simple values are not supported");We[249]=n9;We[250]=i9;We[251]=a9;We[252]=ur;We[253]=ur;We[254]=ur;We[255]=r9;var aa=[];for(let e=0;e<24;e++)aa[e]=new tt(Ne.uint,e,1);for(let e=-1;e>=-24;e--)aa[31-e]=new tt(Ne.negint,e,1);aa[64]=new tt(Ne.bytes,new Uint8Array(0),1);aa[96]=new tt(Ne.string,"",1);aa[128]=new tt(Ne.array,0,1);aa[160]=new tt(Ne.map,0,1);aa[244]=new tt(Ne.false,!1,1);aa[245]=new tt(Ne.true,!0,1);aa[246]=new tt(Ne.null,null,1);function l9(e){switch(e.type){case Ne.false:return La([244]);case Ne.true:return La([245]);case Ne.null:return La([246]);case Ne.bytes:return e.value.length?void 0:La([64]);case Ne.string:return e.value===""?La([96]):void 0;case Ne.array:return e.value===0?La([128]):void 0;case Ne.map:return e.value===0?La([160]):void 0;case Ne.uint:return e.value<24?La([Number(e.value)]):void 0;case Ne.negint:if(e.value>=-24)return La([31-Number(e.value)])}}i(l9,"quickEncodeToken");var PP={float64:!1,mapSorter:UP,quickEncodeToken:l9};function BP(){let e=[];return e[Ne.uint.major]=ji,e[Ne.negint.major]=Op,e[Ne.bytes.major]=_u,e[Ne.string.major]=LE,e[Ne.array.major]=Pp,e[Ne.map.major]=Bp,e[Ne.tag.major]=Lp,e[Ne.float.major]=Up,e}i(BP,"makeCborEncoders");var f9=BP(),Fv=new wu,tc=class{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${Nv} object contains circular references`);return new tc(r,t)}};i(tc,"Ref");var es={null:new tt(Ne.null,null),undefined:new tt(Ne.undefined,void 0),true:new tt(Ne.true,!0),false:new tt(Ne.false,!1),emptyArray:new tt(Ne.array,0),emptyMap:new tt(Ne.map,0)},ts={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new tt(Ne.float,e):e>=0?new tt(Ne.uint,e):new tt(Ne.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new tt(Ne.uint,e):new tt(Ne.negint,e)},Uint8Array(e,t,r,n){return new tt(Ne.bytes,e)},string(e,t,r,n){return new tt(Ne.string,e)},boolean(e,t,r,n){return e?es.true:es.false},null(e,t,r,n){return es.null},undefined(e,t,r,n){return es.undefined},ArrayBuffer(e,t,r,n){return new tt(Ne.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new tt(Ne.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[es.emptyArray,new tt(Ne.break)]:es.emptyArray;n=tc.createCheck(n,e);let a=[],s=0;for(let c of e)a[s++]=jp(c,r,n);return r.addBreakTokens?[new tt(Ne.array,e.length),a,new tt(Ne.break)]:[new tt(Ne.array,e.length),a]},Object(e,t,r,n){let a=t!=="Object",s=a?e.keys():Object.keys(e),c=a?e.size:s.length;if(!c)return r.addBreakTokens===!0?[es.emptyMap,new tt(Ne.break)]:es.emptyMap;n=tc.createCheck(n,e);let l=[],d=0;for(let p of s)l[d++]=[jp(p,r,n),jp(a?e.get(p):e[p],r,n)];return LP(l,r),r.addBreakTokens?[new tt(Ne.map,c),l,new tt(Ne.break)]:[new tt(Ne.map,c),l]}};ts.Map=ts.Object;ts.Buffer=ts.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))ts[`${e}Array`]=ts.DataView;function jp(e,t={},r){let n=uE(e),a=t&&t.typeEncoders&&t.typeEncoders[n]||ts[n];if(typeof a=="function"){let c=a(e,n,t,r);if(c!=null)return c}let s=ts[n];if(!s)throw new Error(`${Nv} unsupported type: ${n}`);return s(e,n,t,r)}i(jp,"objectToTokens");function LP(e,t){t.mapSorter&&e.sort(t.mapSorter)}i(LP,"sortMapEntries");function UP(e,t){let r=Array.isArray(e[0])?e[0][0]:e[0],n=Array.isArray(t[0])?t[0][0]:t[0];if(r.type!==n.type)return r.type.compare(n.type);let a=r.type.major,s=f9[a].compareTokens(r,n);return s===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),s}i(UP,"mapSorter");function d9(e,t,r,n){if(Array.isArray(t))for(let a of t)d9(e,a,r,n);else r[t.type.major](e,t,n)}i(d9,"tokensToEncoded");function FP(e,t,r){let n=jp(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let a=r.quickEncodeToken(n);if(a)return a;let s=t[n.type.major];if(s.encodedSize){let c=s.encodedSize(n,r),l=new wu(c);if(s(l,n,r),l.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return Ov(l.chunks[0])}}return Fv.reset(),d9(Fv,n,t,r),Fv.toBytes(!0)}i(FP,"encodeCustom");function jv(e,t){return t=Object.assign({},PP,t),FP(e,f9,t)}i(jv,"encode");var jP={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},$p=class{constructor(t,r={}){this.pos=0,this.data=t,this.options=r}done(){return this.pos>=this.data.length}next(){let t=this.data[this.pos],r=aa[t];if(r===void 0){let n=We[t];if(!n)throw new Error(`${Ot} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let a=t&31;r=n(this.data,this.pos,a,this.options)}return this.pos+=r.encodedLength,r}};i($p,"Tokeniser");var Lf=Symbol.for("DONE"),zp=Symbol.for("BREAK");function $P(e,t,r){let n=[];for(let a=0;a<e.value;a++){let s=Uf(t,r);if(s===zp){if(e.value===1/0)break;throw new Error(`${Ot} got unexpected break to lengthed array`)}if(s===Lf)throw new Error(`${Ot} found array but not enough entries (got ${a}, expected ${e.value})`);n[a]=s}return n}i($P,"tokenToArray");function zP(e,t,r){let n=r.useMaps===!0,a=n?void 0:{},s=n?new Map:void 0;for(let c=0;c<e.value;c++){let l=Uf(t,r);if(l===zp){if(e.value===1/0)break;throw new Error(`${Ot} got unexpected break to lengthed map`)}if(l===Lf)throw new Error(`${Ot} found map but not enough entries (got ${c} [no key], expected ${e.value})`);if(n!==!0&&typeof l!="string")throw new Error(`${Ot} non-string keys not supported (got ${typeof l})`);if(r.rejectDuplicateMapKeys===!0&&(n&&s.has(l)||!n&&l in a))throw new Error(`${Ot} found repeat map key "${l}"`);let d=Uf(t,r);if(d===Lf)throw new Error(`${Ot} found map but not enough entries (got ${c} [no value], expected ${e.value})`);n?s.set(l,d):a[l]=d}return n?s:a}i(zP,"tokenToMap");function Uf(e,t){if(e.done())return Lf;let r=e.next();if(r.type===Ne.break)return zp;if(r.type.terminal)return r.value;if(r.type===Ne.array)return $P(r,e,t);if(r.type===Ne.map)return zP(r,e,t);if(r.type===Ne.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Uf(e,t);return t.tags[r.value](n)}throw new Error(`${Ot} tag not supported (${r.value})`)}throw new Error("unsupported")}i(Uf,"tokensToObject");function $v(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Ot} data to decode must be a Uint8Array`);t=Object.assign({},jP,t);let r=t.tokenizer||new $p(e,t),n=Uf(r,t);if(n===Lf)throw new Error(`${Ot} did not find any content to decode`);if(n===zp)throw new Error(`${Ot} got unexpected break`);if(!r.done())throw new Error(`${Ot} too many terminals, data makes no sense`);return n}i($v,"decode");var h9=42;function qP(e){if(e.asCID!==e)return null;let t=qt.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new tt(Ne.tag,h9),new tt(Ne.bytes,r)]}i(qP,"cidEncoder");function VP(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}i(VP,"undefinedEncoder");function KP(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}i(KP,"numberEncoder");var GP={float64:!0,typeEncoders:{Object:qP,undefined:VP,number:KP}};function WP(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return qt.decode(e.subarray(1))}i(WP,"cidDecoder");var p9={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};p9.tags[h9]=WP;var ZP="dag-cbor",JP=113,zv=i(e=>jv(e,GP),"encode"),YP=i(e=>$v(e,p9),"decode");function Su(e){try{return e()}catch(t){return t}}i(Su,"tryCatch");var Hv=Ys(Mp(),1);function rc(e){let t=Hv.default.decode(e),r=Hv.default.decode.bytes,n=e.subarray(r);return[t,n,r]}i(rc,"readVarint");function XP(e){return e===0||e===1}i(XP,"isCidVersion");function qv(e){let[t,r]=rc(e);if(!XP(t))throw new Error(`Unknown CID version ${t}`);let[n,a]=rc(r),[,s,c]=rc(a),[l,,d]=rc(s),p=a.subarray(0,c+d+l),g=a.subarray(c+d+l);return[qt.create(t,n,_p(p)),g]}i(qv,"readCid");function nc(e,t="StreamRef"){let[r,n]=rc(e);if(r!==206)throw new Error(`Invalid ${t}, does not include streamid codec`);let[a,s]=rc(n),c=qv(s),[l,d]=c;if(d.length===0)return{kind:"stream-id",type:a,genesis:l};if(d.length===1&&d[0]===0)return{kind:"commit-id",type:a,genesis:l,commit:null};{let[p]=qv(d);return{kind:"commit-id",type:a,genesis:l,commit:p}}}i(nc,"fromBytes");var QP=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function xu(e,t="StreamRef"){let r=QP.exec(e)||[],n=r[2];if(!n)throw new Error(`Malformed ${t} string: ${e}`);let a=ra.decode(n),s=nc(a),c=r[4];return c?{kind:"commit-id",type:s.type,genesis:s.genesis,commit:Vv(s.genesis,c)}:s}i(xu,"fromString");function eB(e){try{return typeof e=="string"?qt.parse(e):qt.asCID(e)}catch{return null}}i(eB,"parseCID");function Vv(e,t=null){if(!t||t==="0")return null;let r=eB(t);if(r)return e.equals(r)?null:r;throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)")}i(Vv,"parseCommit");var Ff=function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},zi=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},qp=class extends Error{constructor(t){super(`Invalid StreamID bytes ${ra.encode(t)}: contains commit`)}};i(qp,"InvalidStreamIDBytesError");var Vp=class extends Error{constructor(t){super(`Invalid StreamID string ${t}: contains commit`)}};i(Vp,"InvalidStreamIDStringError");function v9(e){let t=nc(e,"StreamID");if(t.kind==="stream-id")return new Yt(t.type,t.genesis);throw new qp(e)}i(v9,"fromBytes");function tB(e){return Su(()=>v9(e))}i(tB,"fromBytesNoThrow");function y9(e){let t=xu(e,"StreamID");if(t.kind==="stream-id")return new Yt(t.type,t.genesis);throw new Vp(e)}i(y9,"fromString");function rB(e){return Su(()=>y9(e))}i(rB,"fromStringNoThrow");var g9=Symbol.for("@ceramicnetwork/streamid/StreamID"),Yt=class{constructor(t,r){if(this._tag=g9,!(t||t===0))throw new Error("StreamID constructor: type required");if(!r)throw new Error("StreamID constructor: cid required");this._type=typeof t=="string"?na.codeByName(t):t,this._cid=typeof r=="string"?qt.parse(r):r}static isInstance(t){return typeof t=="object"&&"_tag"in t&&t._tag===g9}static async fromGenesis(t,r){let n=await cE({value:r,codec:Hp,hasher:Av});return new Yt(t,n.cid)}get type(){return this._type}get typeName(){return na.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let t=Gv.default.encode(206),r=Gv.default.encode(this.type);return Of([t,r,this.cid.bytes])}get baseID(){return new Yt(this._type,this._cid)}equals(t){return Yt.isInstance(t)?this.type===t.type&&this.cid.equals(t.cid):!1}toString(){return ra.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[Symbol.for("nodejs.util.inspect.custom")](){return`StreamID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};i(Yt,"StreamID");Yt.fromBytes=v9;Yt.fromBytesNoThrow=tB;Yt.fromString=y9;Yt.fromStringNoThrow=rB;Ff([fi(),zi("design:type",String),zi("design:paramtypes",[])],Yt.prototype,"typeName",null);Ff([fi(),zi("design:type",Uint8Array),zi("design:paramtypes",[])],Yt.prototype,"bytes",null);Ff([fi(),zi("design:type",Yt),zi("design:paramtypes",[])],Yt.prototype,"baseID",null);Ff([fi(),zi("design:type",Function),zi("design:paramtypes",[]),zi("design:returntype",String)],Yt.prototype,"toString",null);Ff([fi(),zi("design:type",Function),zi("design:paramtypes",[]),zi("design:returntype",String)],Yt.prototype,"toUrl",null);var Cu=function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},Zn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},Wv=function(e,t,r,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(e,r):a?a.value=r:t.set(e,r),r},vo=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},Tu,ic,jf,Kp=class extends Error{constructor(t){super(`Error while parsing CommitID from bytes ${ra.encode(t)}: no commit information provided`)}};i(Kp,"InvalidCommitIDBytesError");var Gp=class extends Error{constructor(t){super(`Error while parsing CommitID from string ${t}: no commit information provided`)}};i(Gp,"InvalidCommitIDStringError");function w9(e){let t=nc(e,"CommitID");if(t.kind==="commit-id")return new hr(t.type,t.genesis,t.commit);throw new Kp(e)}i(w9,"fromBytes");function nB(e){return Su(()=>w9(e))}i(nB,"fromBytesNoThrow");function _9(e){let t=xu(e,"CommitID");if(t.kind==="commit-id")return new hr(t.type,t.genesis,t.commit);throw new Gp(e)}i(_9,"fromString");function iB(e){return Su(()=>_9(e))}i(iB,"fromStringNoThrow");var b9=Symbol.for("@ceramicnetwork/streamid/CommitID");function aB(e,t){return new hr(e.type,e.cid,t)}i(aB,"make");var hr=class{constructor(t,r,n=null){if(this._tag=b9,Tu.set(this,void 0),ic.set(this,void 0),jf.set(this,void 0),!t&&t!==0)throw new Error("constructor: type required");if(!r)throw new Error("constructor: cid required");Wv(this,Tu,typeof t=="string"?na.codeByName(t):t,"f"),Wv(this,ic,typeof r=="string"?qt.parse(r):r,"f"),Wv(this,jf,Vv(vo(this,ic,"f"),n),"f")}static isInstance(t){return typeof t=="object"&&"_tag"in t&&t._tag===b9}get baseID(){return new Yt(vo(this,Tu,"f"),vo(this,ic,"f"))}get type(){return vo(this,Tu,"f")}get typeName(){return na.nameByCode(vo(this,Tu,"f"))}get cid(){return vo(this,ic,"f")}get commit(){return vo(this,jf,"f")||vo(this,ic,"f")}get bytes(){let t=Zv.default.encode(206),r=Zv.default.encode(this.type),n=vo(this,jf,"f")?.bytes||new Uint8Array([0]);return Of([t,r,this.cid.bytes,n])}equals(t){return this.type===t.type&&this.cid.equals(t.cid)&&this.commit.equals(t.commit)}toString(){return ra.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(Tu=new WeakMap,ic=new WeakMap,jf=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};i(hr,"CommitID");hr.fromBytes=w9;hr.fromBytesNoThrow=nB;hr.fromString=_9;hr.fromStringNoThrow=iB;hr.make=aB;Cu([fi(),Zn("design:type",Yt),Zn("design:paramtypes",[])],hr.prototype,"baseID",null);Cu([fi(),Zn("design:type",String),Zn("design:paramtypes",[])],hr.prototype,"typeName",null);Cu([fi(),Zn("design:type",qt),Zn("design:paramtypes",[])],hr.prototype,"commit",null);Cu([fi(),Zn("design:type",Uint8Array),Zn("design:paramtypes",[])],hr.prototype,"bytes",null);Cu([fi(),Zn("design:type",Function),Zn("design:paramtypes",[]),Zn("design:returntype",String)],hr.prototype,"toString",null);Cu([fi(),Zn("design:type",Function),Zn("design:paramtypes",[]),Zn("design:returntype",String)],hr.prototype,"toUrl",null);var ac;(function(e){function t(a){let s=nc(a);switch(s.kind){case"commit-id":return new hr(s.type,s.genesis,s.commit);case"stream-id":return new Yt(s.type,s.genesis);default:throw new Error(`Malformed StreamRef bytes: ${ra.encode(a)}`)}}i(t,"fromBytes"),e.fromBytes=t;function r(a){let s=xu(a);switch(s.kind){case"commit-id":return new hr(s.type,s.genesis,s.commit);case"stream-id":return new Yt(s.type,s.genesis);default:throw new Error(`Malformed StreamRef string: ${a}`)}}i(r,"fromString"),e.fromString=r;function n(a){if(Yt.isInstance(a)||hr.isInstance(a))return a;if(a instanceof Uint8Array)return t(a);if(typeof a=="string")return r(a);throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(a)}`)}i(n,"from"),e.from=n})(ac||(ac={}));var E9="ceramic://k3y52l7qbv1fry1fp4s0nwdarh0vahusarpposgevy0pemiykymd2ord6swtharcw",Wp="ceramic://k3y52l7qbv1fryjn62sggjh1lpn11c56qfofzmty190d62hwk1cal1c7qc5he54ow";var Jv={};En(Jv,{JsonPatchError:()=>Lr,_areEquals:()=>Hf,applyOperation:()=>oc,applyPatch:()=>t0,applyReducer:()=>lB,deepClone:()=>cB,getValueByPointer:()=>Qp,validate:()=>S9,validator:()=>e0});var oB=function(){var e=i(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},e(t,r)},"extendStatics");return function(t,r){e(t,r);function n(){this.constructor=t}i(n,"__"),t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),sB=Object.prototype.hasOwnProperty;function Jp(e,t){return sB.call(e,t)}i(Jp,"hasOwnProperty");function Yp(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var a in e)Jp(e,a)&&n.push(a);return n}i(Yp,"_objectKeys");function un(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}i(un,"_deepClone");function Xp(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}i(Xp,"isInteger");function Ua(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}i(Ua,"escapePathComponent");function $f(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}i($f,"unescapePathComponent");function Zp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Zp(e[t]))return!0}else if(typeof e=="object"){for(var n=Yp(e),a=n.length,s=0;s<a;s++)if(Zp(e[n[s]]))return!0}}return!1}i(Zp,"hasUndefined");function A9(e,t){var r=[e];for(var n in t){var a=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof a<"u"&&r.push(n+": "+a)}return r.join(`
|
|
22
22
|
`)}i(A9,"patchErrorMessageFormatter");var zf=function(e){oB(t,e);function t(r,n,a,s,c){var l=this.constructor,d=e.call(this,A9(r,{name:n,index:a,operation:s,tree:c}))||this;return d.name=n,d.index=a,d.operation=s,d.tree=c,Object.setPrototypeOf(d,l.prototype),d.message=A9(r,{name:n,index:a,operation:s,tree:c}),d}return i(t,"PatchError"),t}(Error);var Lr=zf,cB=un,Mu={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Qp(r,this.path);n&&(n=un(n));var a=oc(r,{op:"remove",path:this.from}).removed;return oc(r,{op:"add",path:this.path,value:a}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Qp(r,this.from);return oc(r,{op:"add",path:this.path,value:un(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Hf(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},uB={add:function(e,t,r){return Xp(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Mu.move,copy:Mu.copy,test:Mu.test,_get:Mu._get};function Qp(e,t){if(t=="")return e;var r={op:"_get",path:t};return oc(e,r),r.value}i(Qp,"getValueByPointer");function oc(e,t,r,n,a,s){if(r===void 0&&(r=!1),n===void 0&&(n=!0),a===void 0&&(a=!0),s===void 0&&(s=0),r&&(typeof r=="function"?r(t,0,e,t.path):e0(t,0)),t.path===""){var c={newDocument:e};if(t.op==="add")return c.newDocument=t.value,c;if(t.op==="replace")return c.newDocument=t.value,c.removed=e,c;if(t.op==="move"||t.op==="copy")return c.newDocument=Qp(e,t.from),t.op==="move"&&(c.removed=e),c;if(t.op==="test"){if(c.test=Hf(e,t.value),c.test===!1)throw new Lr("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c.newDocument=e,c}else{if(t.op==="remove")return c.removed=e,c.newDocument=null,c;if(t.op==="_get")return t.value=e,c;if(r)throw new Lr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,t,e);return c}}else{n||(e=un(e));var l=t.path||"",d=l.split("/"),p=e,g=1,v=d.length,y=void 0,_=void 0,x=void 0;for(typeof r=="function"?x=r:x=e0;;){if(_=d[g],_&&_.indexOf("~")!=-1&&(_=$f(_)),a&&(_=="__proto__"||_=="prototype"&&g>0&&d[g-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(r&&y===void 0&&(p[_]===void 0?y=d.slice(0,g).join("/"):g==v-1&&(y=t.path),y!==void 0&&x(t,0,e,y)),g++,Array.isArray(p)){if(_==="-")_=p.length;else{if(r&&!Xp(_))throw new Lr("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,t,e);Xp(_)&&(_=~~_)}if(g>=v){if(r&&t.op==="add"&&_>p.length)throw new Lr("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,t,e);var c=uB[t.op].call(t,p,_,e);if(c.test===!1)throw new Lr("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}}else if(g>=v){var c=Mu[t.op].call(t,p,_,e);if(c.test===!1)throw new Lr("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}if(p=p[_],r&&g<v&&(!p||typeof p!="object"))throw new Lr("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,t,e)}}}i(oc,"applyOperation");function t0(e,t,r,n,a){if(n===void 0&&(n=!0),a===void 0&&(a=!0),r&&!Array.isArray(t))throw new Lr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=un(e));for(var s=new Array(t.length),c=0,l=t.length;c<l;c++)s[c]=oc(e,t[c],r,!0,a,c),e=s[c].newDocument;return s.newDocument=e,s}i(t0,"applyPatch");function lB(e,t,r){var n=oc(e,t);if(n.test===!1)throw new Lr("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}i(lB,"applyReducer");function e0(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Lr("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Mu[e.op]){if(typeof e.path!="string")throw new Lr("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Lr('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Lr("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Lr("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Zp(e.value))throw new Lr("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var a=e.path.split("/").length,s=n.split("/").length;if(a!==s+1&&a!==s)throw new Lr("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new Lr("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var c={op:"_get",path:e.from,value:void 0},l=S9([c],r);if(l&&l.name==="OPERATION_PATH_UNRESOLVABLE")throw new Lr("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Lr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}i(e0,"validator");function S9(e,t,r){try{if(!Array.isArray(e))throw new Lr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)t0(un(t),un(e),r||!0);else{r=r||e0;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(a){if(a instanceof Lr)return a;throw a}}i(S9,"validate");function Hf(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),a,s,c;if(r&&n){if(s=e.length,s!=t.length)return!1;for(a=s;a--!==0;)if(!Hf(e[a],t[a]))return!1;return!0}if(r!=n)return!1;var l=Object.keys(e);if(s=l.length,s!==Object.keys(t).length)return!1;for(a=s;a--!==0;)if(!t.hasOwnProperty(l[a]))return!1;for(a=s;a--!==0;)if(c=l[a],!Hf(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}i(Hf,"_areEquals");var ey={};En(ey,{compare:()=>yB,generate:()=>Yv,observe:()=>vB,unobserve:()=>gB});var Xv=new WeakMap,fB=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror"),e}(),dB=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo"),e}();function hB(e){return Xv.get(e)}i(hB,"getMirror");function pB(e,t){return e.observers.get(t)}i(pB,"getObserverFromMirror");function mB(e,t){e.observers.delete(t.callback)}i(mB,"removeObserverFromMirror");function gB(e,t){t.unobserve()}i(gB,"unobserve");function vB(e,t){var r=[],n,a=hB(e);if(!a)a=new fB(e),Xv.set(e,a);else{var s=pB(a,t);n=s&&s.observer}if(n)return n;if(n={},a.value=un(e),t){n.callback=t,n.next=null;var c=i(function(){Yv(n)},"dirtyCheck"),l=i(function(){clearTimeout(n.next),n.next=setTimeout(c)},"fastCheck");typeof window<"u"&&(window.addEventListener("mouseup",l),window.addEventListener("keyup",l),window.addEventListener("mousedown",l),window.addEventListener("keydown",l),window.addEventListener("change",l))}return n.patches=r,n.object=e,n.unobserve=function(){Yv(n),clearTimeout(n.next),mB(a,n),typeof window<"u"&&(window.removeEventListener("mouseup",l),window.removeEventListener("keyup",l),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l),window.removeEventListener("change",l))},a.observers.set(t,new dB(t,n)),n}i(vB,"observe");function Yv(e,t){t===void 0&&(t=!1);var r=Xv.get(e.object);Qv(r.value,e.object,e.patches,"",t),e.patches.length&&t0(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}i(Yv,"generate");function Qv(e,t,r,n,a){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=Yp(t),c=Yp(e),l=!1,d=!1,p=c.length-1;p>=0;p--){var g=c[p],v=e[g];if(Jp(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var y=t[g];typeof v=="object"&&v!=null&&typeof y=="object"&&y!=null&&Array.isArray(v)===Array.isArray(y)?Qv(v,y,r,n+"/"+Ua(g),a):v!==y&&(l=!0,a&&r.push({op:"test",path:n+"/"+Ua(g),value:un(v)}),r.push({op:"replace",path:n+"/"+Ua(g),value:un(y)}))}else Array.isArray(e)===Array.isArray(t)?(a&&r.push({op:"test",path:n+"/"+Ua(g),value:un(v)}),r.push({op:"remove",path:n+"/"+Ua(g)}),d=!0):(a&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),l=!0)}if(!(!d&&s.length==c.length))for(var p=0;p<s.length;p++){var g=s[p];!Jp(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+Ua(g),value:un(t[g])})}}}i(Qv,"_generate");function yB(e,t,r){r===void 0&&(r=!1);var n=[];return Qv(e,t,n,"",r),n}i(yB,"compare");var x9=Object.assign({},Jv,ey,{JsonPatchError:zf,deepClone:un,escapePathComponent:Ua,unescapePathComponent:$f});var KA=Ys(my(),1);var GA=Ys(MA(),1);var lc;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC"})(lc||(lc={}));var Oy=Ys(my(),1);var Ay=i(function(e,t){return Ay=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},Ay(e,t)},"extendStatics");function Sy(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ay(e,t);function r(){this.constructor=e}i(r,"__"),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}i(Sy,"__extends");function xy(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}i(xy,"__values");function Ou(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),a,s=[],c;try{for(;(t===void 0||t-- >0)&&!(a=n.next()).done;)s.push(a.value)}catch(l){c={error:l}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}i(Ou,"__read");function Nu(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,s;n<a;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}i(Nu,"__spreadArray");function Hi(e){return typeof e=="function"}i(Hi,"isFunction");function IA(e){var t=i(function(n){Error.call(n),n.stack=new Error().stack},"_super"),r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}i(IA,"createErrorClass");var y0=IA(function(e){return i(function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
23
23
|
`+r.map(function(n,a){return a+1+") "+n.toString()}).join(`
|
|
24
|
-
`):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function Ty(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(Ty,"arrRemove");var b0=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,a,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=xy(c),d=l.next();!d.done;d=l.next()){var p=d.value;p.remove(this)}}catch(O){t={error:O}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var g=this.initialTeardown;if(Hi(g))try{g()}catch(O){s=O instanceof y0?O.errors:[O]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var y=xy(v),_=y.next();!_.done;_=y.next()){var x=_.value;try{kA(x)}catch(O){s=s??[],O instanceof y0?s=Nu(Nu([],Ou(s)),Ou(O.errors)):s.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(a=y.return)&&a.call(y)}finally{if(n)throw n.error}}}if(s)throw new y0(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)kA(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ty(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ty(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var jJ=b0.EMPTY;function w0(e){return e instanceof b0||e&&"closed"in e&&Hi(e.remove)&&Hi(e.add)&&Hi(e.unsubscribe)}i(w0,"isSubscription");function kA(e){Hi(e)?e():e.unsubscribe()}i(kA,"execFinalizer");var oa={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Pu={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=Pu.delegate;return a?.setTimeout?a.setTimeout.apply(a,Nu([e,t],Ou(r))):setTimeout.apply(void 0,Nu([e,t],Ou(r)))},clearTimeout:function(e){var t=Pu.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function DA(e){Pu.setTimeout(function(){var t=oa.onUnhandledError;if(t)t(e);else throw e})}i(DA,"reportUnhandledError");function Cy(){}i(Cy,"noop");var RA=function(){return My("C",void 0,void 0)}();function OA(e){return My("E",void 0,e)}i(OA,"errorNotification");function NA(e){return My("N",e,void 0)}i(NA,"nextNotification");function My(e,t,r){return{kind:e,value:t,error:r}}i(My,"createNotification");var fc=null;function PA(e){if(oa.useDeprecatedSynchronousErrorHandling){var t=!fc;if(t&&(fc={errorThrown:!1,error:null}),e(),t){var r=fc,n=r.errorThrown,a=r.error;if(fc=null,n)throw a}}else e()}i(PA,"errorContext");function BA(e){oa.useDeprecatedSynchronousErrorHandling&&fc&&(fc.errorThrown=!0,fc.error=e)}i(BA,"captureError");var Dy=function(e){Sy(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,w0(r)&&r.add(n)):n.destination=IU,n}return i(t,"Subscriber"),t.create=function(r,n,a){return new E0(r,n,a)},t.prototype.next=function(r){this.isStopped?ky(NA(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?ky(OA(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?ky(RA,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(b0);var TU=Function.prototype.bind;function Iy(e,t){return TU.call(e,t)}i(Iy,"bind");var CU=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver"),e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){_0(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){_0(n)}else _0(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){_0(r)}},e}(),E0=function(e){Sy(t,e);function t(r,n,a){var s=e.call(this)||this,c;if(Hi(r)||!r)c={next:r??void 0,error:n??void 0,complete:a??void 0};else{var l;s&&oa.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&Iy(r.next,l),error:r.error&&Iy(r.error,l),complete:r.complete&&Iy(r.complete,l)}):c=r}return s.destination=new CU(c),s}return i(t,"SafeSubscriber"),t}(Dy);function _0(e){oa.useDeprecatedSynchronousErrorHandling?BA(e):DA(e)}i(_0,"handleUnhandledError");function MU(e){throw e}i(MU,"defaultErrorHandler");function ky(e,t){var r=oa.onStoppedNotification;r&&Pu.setTimeout(function(){return r(e,t)})}i(ky,"handleStoppedNotification");var IU={closed:!0,next:Cy,error:MU,complete:Cy};var LA=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function UA(e){return e}i(UA,"identity");function FA(e){return e.length===0?UA:e.length===1?e[0]:i(function(r){return e.reduce(function(n,a){return a(n)},r)},"piped")}i(FA,"pipeFromArray");var Ry=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable"),e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var a=this,s=DU(t)?t:new E0(t,r,n);return PA(function(){var c=a,l=c.operator,d=c.source;s.add(l?l.call(s,d):d?a._subscribe(s):a._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=jA(r),new r(function(a,s){var c=new E0({next:function(l){try{t(l)}catch(d){s(d),c.unsubscribe()}},error:s,complete:a});n.subscribe(c)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[LA]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return FA(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=jA(t),new t(function(n,a){var s;r.subscribe(function(c){return s=c},function(c){return a(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function jA(e){var t;return(t=e??oa.Promise)!==null&&t!==void 0?t:Promise}i(jA,"getPromiseCtor");function kU(e){return e&&Hi(e.next)&&Hi(e.error)&&Hi(e.complete)}i(kU,"isObserver");function DU(e){return e&&e instanceof Dy||kU(e)&&w0(e)}i(DU,"isSubscriber");var $A;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})($A||($A={}));var zA;(function(e){e[e.NOT_REQUESTED=0]="NOT_REQUESTED",e[e.PENDING=1]="PENDING",e[e.PROCESSING=2]="PROCESSING",e[e.ANCHORED=3]="ANCHORED",e[e.FAILED=4]="FAILED"})(zA||(zA={}));var Ny;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Ny||(Ny={}));var Gf=class extends Ry{constructor(t,r){super(n=>{t.subscribe(n)}),this.state$=t,this._context=r}get id(){return new Yt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:t,content:r}=this.state$.value;return(0,Oy.default)(t?.content??r)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return hr.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:t})=>hr.make(this.id,t))}get anchorCommitIds(){return this.state$.value.log.filter(({type:t})=>t===Ny.ANCHOR).map(({cid:t})=>hr.make(this.id,t))}get state(){return(0,Oy.default)(this.state$.value)}async sync(t={}){t={sync:lc.PREFER_CACHE,...t};let r=await this.api.loadStream(this.id,t);this.state$.next(r.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}};i(Gf,"Stream");function HA(){return e=>{}}i(HA,"StreamStatic");var RU=function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},vi,Py={anchor:!0,publish:!0,pin:!0,sync:lc.PREFER_CACHE},OU={sync:lc.PREFER_CACHE},qA={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function By(e,t){if(typeof e?.schema=="string")try{hr.fromString(e.schema)}catch{throw new Error("Schema must be a CommitID")}let r={controllers:e?.controllers,family:e?.family,schema:e?.schema?.toString(),tags:e?.tags};if(t)e?.deterministic||(r.unique=Iv((0,GA.randomBytes)(12),"base64")),e?.forbidControllerChange&&(r.forbidControllerChange=!0);else{if(e?.deterministic!==void 0||e?.unique!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if(e?.forbidControllerChange!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(r).forEach(n=>r[n]===void 0&&delete r[n]),r}i(By,"headerFromMetadata");async function VA(e){if(!e.did)throw new Error("No DID provided");return e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`)),e.did}i(VA,"getAuthenticatedDID");async function Ly(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(Ly,"throwReadOnlyError");var ns=vi=i(class extends Gf{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,KA.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,a={}){a={...Py,...a},!n?.deterministic&&a.syncTimeoutSeconds==null&&(a.syncTimeoutSeconds=0);let s=a.asDID?{did:a.asDID}:t,c=await vi.makeGenesis(s,r,n);return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,c,a)}static async createFromGenesis(t,r,n={}){n={...Py,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=r.data?await vi._signDagJWS(t,r):r;return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,a,n)}static async deterministic(t,r,n={}){if(n={...Py,...n},r={...r,deterministic:!0},r.family==null&&r.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=await vi.makeGenesis(t,null,r);return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,a,n)}static async load(t,r,n={}){n={...OU,...n};let a=ac.from(r);if(a.type!=vi.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${vi.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}async update(t,r,n={}){n={...qA,...n};let a=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(a,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...qA,...r};let a={header:By(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await vi._signDagJWS(this.api,a),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=Ly,this.patch=Ly,this.sync=Ly,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let a=await this._makeRawCommit(r,n);return vi._signDagJWS(t,a)}async _makeRawCommit(t,r){r||(r={});let n=By(r,!1);if(t==null&&(t=this.content),n.controllers){if(n.controllers.length!==1)throw new Error("Exactly one controller must be specified");if(!n.controllers[0])throw new Error("Controller cannot be updated to an undefined value.")}let a=x9.compare(this.content,t),s=this.state.log[0];return{header:n,data:a,prev:this.tip,id:s.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await VA(t);n.controllers=[c.hasParent?c.parent:c.id]}else throw new Error("No controllers specified");if(n.controllers?.length!==1)throw new Error("Exactly one controller must be specified");let a=By(n,!0);if(n?.deterministic&&r)throw new Error("Initial content must be null when creating a deterministic Tile document");if(r==null){let c={header:a};return zv(c),c}let s={data:r,header:a};return vi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await VA(t)).createDagJWS(r)}},"TileDocument");ns.STREAM_TYPE_NAME="tile";ns.STREAM_TYPE_ID=0;ns=vi=RU([HA()],ns);var e7=Ys(JA(),1);function HU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(HU,"_checkPrivateRedeclaration");function qU(e,t){return t.get?t.get.call(e):t.value}i(qU,"_classApplyDescriptorGet");function VU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(VU,"_classApplyDescriptorSet");function QA(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(QA,"_classExtractFieldDescriptor");function $y(e,t){var r=QA(e,t,"get");return qU(e,r)}i($y,"_classPrivateFieldGet");function YA(e,t,r){HU(e,t),t.set(e,r)}i(YA,"_classPrivateFieldInit");function XA(e,t,r){var n=QA(e,t,"set");return VU(e,n,r),r}i(XA,"_classPrivateFieldSet");function KU(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(KU,"keyToQuery");function zy(e){return typeof e=="string"?ac.from(e).toString():hr.isInstance(e)||Yt.isInstance(e)?e.toString():e.streamId.toString()}i(zy,"keyToString");async function qy(e){let t=await ns.makeGenesis({},null,{...e,deterministic:!0}),r=await Yt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(qy,"getDeterministicQuery");var GU=i(()=>Promise.resolve([]),"tempBatchLoadFn"),A0=new WeakMap,Hy=new WeakMap,dc=class extends e7.default{cache(t){if(!$y(this,Hy))return!1;let r=t.id.toString();return this.clear(r).prime(r,t),!0}async create(t,r,n){let a=await ns.create($y(this,A0),t,r,n);return this.cache(a),a}async deterministic(t,r){let n=await qy(t);try{return await super.load(n)}catch{let s=await ns.createFromGenesis($y(this,A0),n.genesis,r);return this.cache(s),s}}async load(t){return await super.load(t)}async update(t,r,n,a){let s=zy(t);this.clear(s);let c=await this.load({streamId:s});return await c.update(r,n,a),c}constructor(t){super(GU,{cache:!0,cacheKeyFn:zy,cacheMap:t.cache!=null&&typeof t.cache!="boolean"?t.cache:void 0}),YA(this,A0,{writable:!0,value:void 0}),YA(this,Hy,{writable:!0,value:void 0}),this._batchLoadFn=async r=>{t.cache||this.clearAll();let n=await t.ceramic.multiQuery(r.map(KU),t.multiqueryTimeout);return r.map(a=>{let s=zy(a),c=n[s];return c||new Error(`Failed to load stream: ${s}`)})},XA(this,A0,t.ceramic),XA(this,Hy,!!t.cache)}};i(dc,"TileLoader");function WU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(WU,"_checkPrivateRedeclaration");function ZU(e,t){return t.get?t.get.call(e):t.value}i(ZU,"_classApplyDescriptorGet");function JU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(JU,"_classApplyDescriptorSet");function r7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(r7,"_classExtractFieldDescriptor");function hc(e,t){var r=r7(e,t,"get");return ZU(e,r)}i(hc,"_classPrivateFieldGet");function t7(e,t,r){WU(e,t),t.set(e,r)}i(t7,"_classPrivateFieldInit");function Vy(e,t,r){var n=r7(e,t,"set");return JU(e,n,r),r}i(Vy,"_classPrivateFieldSet");var Bu=new WeakMap,Lu=new WeakMap,Uu=class{get aliases(){return hc(this,Bu)}get loader(){return hc(this,Lu)}getDefinitionID(t){return hc(this,Bu).definitions[t]??null}getSchemaURL(t){return hc(this,Bu).schemas[t]??null}getTileID(t){return hc(this,Bu).tiles[t]??null}async loadTile(t){let r=this.getTileID(t);if(r==null)throw new Error(`Tile alias "${t}" is not defined`);return await hc(this,Lu).load(r)}async createTile(t,r,n={}){let a=this.getSchemaURL(t);if(a==null)throw new Error(`Schema alias "${t}" is not defined`);let{controller:s,...c}=n,l={schema:a};return s!=null&&(l.controllers=[s]),await hc(this,Lu).create(r,l,c)}constructor(t){if(t7(this,Bu,{writable:!0,value:void 0}),t7(this,Lu,{writable:!0,value:void 0}),Vy(this,Bu,t.aliases),t.loader!=null)Vy(this,Lu,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");Vy(this,Lu,new dc({ceramic:t.ceramic,cache:t.cache}))}}};i(Uu,"DataModel");function YU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(YU,"_checkPrivateRedeclaration");function XU(e,t){return t.get?t.get.call(e):t.value}i(XU,"_classApplyDescriptorGet");function QU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(QU,"_classApplyDescriptorSet");function n7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(n7,"_classExtractFieldDescriptor");function Fa(e,t){var r=n7(e,t,"get");return XU(e,r)}i(Fa,"_classPrivateFieldGet");function S0(e,t,r){YU(e,t),t.set(e,r)}i(S0,"_classPrivateFieldInit");function x0(e,t,r){var n=n7(e,t,"set");return QU(e,n,r),r}i(x0,"_classPrivateFieldSet");var T0=new WeakMap,pc=new WeakMap,Ky=new WeakMap,C0=new WeakMap,Wf=class{_createValuePromise(){x0(this,Ky,new Promise((t,r)=>{x0(this,C0,{resolve:t,reject:r})}))}change(t){return new Promise((r,n)=>{let a=i(async s=>{try{let c=await t(s);r(),this._next(c)}catch(c){n(c),this._next(s)}},"run");Fa(this,pc).push({reject:n,run:a}),Fa(this,pc).length===1&&this._start()})}async changeContent(t){let r=i(async n=>(await n.update(t(n.content),n.metadata),n),"mutation");return await this.change(r)}async get(){return Fa(this,pc).length===0?await Fa(this,T0).call(this):await Fa(this,Ky)}async _start(){try{let t=await Fa(this,T0).call(this);this._next(t)}catch(t){Fa(this,pc).forEach(r=>{r.reject(t)}),x0(this,pc,[]),Fa(this,C0).reject(t),this._createValuePromise()}}_next(t){let r=Fa(this,pc).shift();r==null?this._end(t):r.run(t)}_end(t){Fa(this,C0).resolve(t),this._createValuePromise()}constructor(t){S0(this,T0,{writable:!0,value:void 0}),S0(this,pc,{writable:!0,value:[]}),S0(this,Ky,{writable:!0,value:void 0}),S0(this,C0,{writable:!0,value:void 0}),x0(this,T0,t),this._createValuePromise()}};i(Wf,"TileProxy");var eF=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function tF(e){return eF.test(e)}i(tF,"isDIDstring");function rF(e){if(!tF(e))throw new Error(`Invalid DID: ${e}`)}i(rF,"assertDIDstring");function Gy(e){return rF(e),{controllers:[e],family:"IDX"}}i(Gy,"getIDXMetadata");function nF(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(nF,"_checkPrivateRedeclaration");function iF(e,t){return t.get?t.get.call(e):t.value}i(iF,"_classApplyDescriptorGet");function aF(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(aF,"_classApplyDescriptorSet");function i7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(i7,"_classExtractFieldDescriptor");function $r(e,t){var r=i7(e,t,"get");return iF(e,r)}i($r,"_classPrivateFieldGet");function Zf(e,t,r){nF(e,t),t.set(e,r)}i(Zf,"_classPrivateFieldInit");function M0(e,t,r){var n=i7(e,t,"set");return aF(e,n,r),r}i(M0,"_classPrivateFieldSet");var wo=new WeakMap,I0=new WeakMap,Wy=new WeakMap,ja=new WeakMap,k0=new WeakMap,Jf=class{get authenticated(){return $r(this,wo).did!=null}get ceramic(){return $r(this,wo)}get id(){if($r(this,I0)!=null)return $r(this,I0);if($r(this,wo).did==null)throw new Error("Ceramic instance is not authenticated");return $r(this,wo).did.hasParent?$r(this,wo).did.parent:$r(this,wo).did.id}get loader(){return $r(this,ja)}get model(){return $r(this,k0)}async has(t,r){let n=this.getDefinitionID(t);return await this.getRecordID(n,r)!=null}async get(t,r){let n=this.getDefinitionID(t);return await this.getRecord(n,r)}async getMultiple(t,r){let n=this.getDefinitionID(t),a=await Promise.all(r.map(async l=>{let{genesis:d,streamId:p}=await qy(Gy(l));return{genesis:d,streamId:p.toString(),paths:[n]}})),s=await $r(this,wo).multiQuery(a),c=[];for(let l of a){let d=s[l.streamId]?.content?.[n],p=d?s[Yt.fromString(d).toString()]:null;c.push(p?.content??null)}return c}async set(t,r,n={}){let a=this.getDefinitionID(t),[s,c]=await this._setRecordOnly(a,r,n);return s&&await this._setReference(n.controller??this.id,a,c),c}async merge(t,r,n={}){let a=this.getDefinitionID(t),s=await this.getRecord(a),c=s?{...s,...r}:r;return await this.setRecord(a,c,n)}async setAll(t,r={}){let n=Object.entries(t).map(async([c,l])=>{let d=this.getDefinitionID(c),[p,g]=await this._setRecordOnly(d,l,r);return[p,d,g]}),s=(await Promise.all(n)).reduce((c,[l,d,p])=>(l&&(c[d]=p.toUrl()),c),{});return await this._setReferences(r.controller??this.id,s),s}async setDefaults(t,r={}){let n=await this.getIndex()??{},a=Object.entries(t).map(([l,d])=>[this.getDefinitionID(l),d]).filter(l=>n[l[0]]==null).map(async([l,d])=>{let p=await this.getDefinition(l),g=await this._createRecord(p,d,r);return{[l]:g.toUrl()}}),c=(await Promise.all(a)).reduce((l,d)=>Object.assign(l,d),{});return await this._setReferences(r.controller??this.id,c),c}async remove(t,r=this.id){await this._getIndexProxy(r).changeContent(n=>(n!=null&&delete n[this.getDefinitionID(t)],n))}async getIndex(t=this.id){let r=this.authenticated&&t===this.id?await this._getIndexProxy(t).get():await this._getIDXDoc(t);return r?r.content:null}iterator(t){let r,n=0;return{[Symbol.asyncIterator](){return this},next:async()=>{if(r==null){let l=await this.getIndex(t);r=Object.entries(l??{})}if(n===r.length)return{done:!0,value:null};let[a,s]=r[n++],c=await $r(this,ja).load(s);return{done:!1,value:{key:a,id:s,record:c.content}}}}}async _createIDXDoc(t){return await $r(this,ja).deterministic(Gy(t))}async _getIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)return null;if(r.metadata.schema!==Wp)throw new Error("Invalid document: schema is not IdentityIndex");return r}async _getOwnIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)await r.update({},{schema:Wp});else if(r.metadata.schema!==Wp)throw new Error("Invalid document: schema is not IdentityIndex");return r}_getIndexProxy(t){let r=$r(this,Wy)[t];return r==null&&(r=new Wf(async()=>await this._getOwnIDXDoc(t)),$r(this,Wy)[t]=r),r}getDefinitionID(t){return $r(this,k0).getDefinitionID(t)??t}async getDefinition(t){let r=await $r(this,ja).load(t);if(r.metadata.schema!==E9)throw new Error("Invalid document: schema is not Definition");return{...r.content,id:r.id}}async getRecordID(t,r){return(await this.getIndex(r??this.id))?.[t]??null}async getRecordDocument(t,r){let n=await this.getRecordID(t,r);return n?await $r(this,ja).load(n):null}async getRecord(t,r){let n=await this.getRecordDocument(t,r);return n?n.content:null}async setRecord(t,r,n={}){let[a,s]=await this._setRecordOnly(t,r,n);return a&&await this._setReference(n.controller??this.id,t,s),s}async _setRecordOnly(t,r,n){let a=await this.getRecordID(t,n.controller??this.id);if(a==null){let s=await this.getDefinition(t),c=await this._createRecord(s,r,n);return[!0,c]}else{let s=await $r(this,ja).update(a,r);return[!1,s.id]}}async _createRecord(t,r,{controller:n,pin:a}){let s=await $r(this,ja).deterministic({controllers:[n??this.id],family:t.id.toString()},{pin:a});return await s.update(r,{schema:t.schema}),s.id}async _setReference(t,r,n){await this._getIndexProxy(t).changeContent(a=>({...a,[r]:n.toUrl()}))}async _setReferences(t,r){Object.keys(r).length!==0&&await this._getIndexProxy(t).changeContent(n=>({...n,...r}))}constructor(t){Zf(this,wo,{writable:!0,value:void 0}),Zf(this,I0,{writable:!0,value:void 0}),Zf(this,Wy,{writable:!0,value:{}}),Zf(this,ja,{writable:!0,value:void 0}),Zf(this,k0,{writable:!0,value:void 0});let{cache:r,ceramic:n,id:a,loader:s,model:c}=t;M0(this,wo,n),M0(this,I0,a),M0(this,ja,s??new dc({ceramic:n,cache:r})),M0(this,k0,c instanceof Uu?c:new Uu({loader:$r(this,ja),aliases:c}))}};i(Jf,"DIDDataStore");var rr;(function(e){e.assertEqual=a=>a;function t(a){}i(t,"assertIs"),e.assertIs=t;function r(a){throw new Error}i(r,"assertNever"),e.assertNever=r,e.arrayToEnum=a=>{let s={};for(let c of a)s[c]=c;return s},e.getValidEnumValues=a=>{let s=e.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),c={};for(let l of s)c[l]=a[l];return e.objectValues(c)},e.objectValues=a=>e.objectKeys(a).map(function(s){return a[s]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&s.push(c);return s},e.find=(a,s)=>{for(let c of a)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(rr||(rr={}));var Jy;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Jy||(Jy={}));var nt=rr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),is=i(e=>{switch(typeof e){case"undefined":return nt.undefined;case"string":return nt.string;case"number":return isNaN(e)?nt.nan:nt.number;case"boolean":return nt.boolean;case"function":return nt.function;case"bigint":return nt.bigint;case"symbol":return nt.symbol;case"object":return Array.isArray(e)?nt.array:e===null?nt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?nt.promise:typeof Map<"u"&&e instanceof Map?nt.map:typeof Set<"u"&&e instanceof Set?nt.set:typeof Date<"u"&&e instanceof Date?nt.date:nt.object;default:return nt.unknown}},"getParsedType"),qe=rr.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),oF=i(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Sn=class extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){let r=t||function(s){return s.message},n={_errors:[]},a=i(s=>{for(let c of s.issues)if(c.code==="invalid_union")c.unionErrors.map(a);else if(c.code==="invalid_return_type")a(c.returnTypeError);else if(c.code==="invalid_arguments")a(c.argumentsError);else if(c.path.length===0)n._errors.push(r(c));else{let l=n,d=0;for(;d<c.path.length;){let p=c.path[d];d===c.path.length-1?(l[p]=l[p]||{_errors:[]},l[p]._errors.push(r(c))):l[p]=l[p]||{_errors:[]},l=l[p],d++}}},"processError");return a(this),n}static assert(t){if(!(t instanceof Sn))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,rr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};i(Sn,"ZodError");Sn.create=e=>new Sn(e);var zu=i((e,t)=>{let r;switch(e.code){case qe.invalid_type:e.received===nt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case qe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,rr.jsonStringifyReplacer)}`;break;case qe.unrecognized_keys:r=`Unrecognized key(s) in object: ${rr.joinValues(e.keys,", ")}`;break;case qe.invalid_union:r="Invalid input";break;case qe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${rr.joinValues(e.options)}`;break;case qe.invalid_enum_value:r=`Invalid enum value. Expected ${rr.joinValues(e.options)}, received '${e.received}'`;break;case qe.invalid_arguments:r="Invalid function arguments";break;case qe.invalid_return_type:r="Invalid function return type";break;case qe.invalid_date:r="Invalid date";break;case qe.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:rr.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case qe.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case qe.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case qe.custom:r="Invalid input";break;case qe.invalid_intersection_types:r="Intersection results could not be merged";break;case qe.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case qe.not_finite:r="Number must be finite";break;default:r=t.defaultError,rr.assertNever(e)}return{message:r}},"errorMap"),s7=zu;function sF(e){s7=e}i(sF,"setErrorMap");function D0(){return s7}i(D0,"getErrorMap");var R0=i(e=>{let{data:t,path:r,errorMaps:n,issueData:a}=e,s=[...r,...a.path||[]],c={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let l="",d=n.filter(p=>!!p).slice().reverse();for(let p of d)l=p(c,{data:t,defaultError:l}).message;return{...a,path:s,message:l}},"makeIssue"),cF=[];function et(e,t){let r=D0(),n=R0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===zu?void 0:zu].filter(a=>!!a)});e.common.issues.push(n)}i(et,"addIssueToContext");var Yr=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let a of r){if(a.status==="aborted")return It;a.status==="dirty"&&t.dirty(),n.push(a.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let a of r){let s=await a.key,c=await a.value;n.push({key:s,value:c})}return Yr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let a of r){let{key:s,value:c}=a;if(s.status==="aborted"||c.status==="aborted")return It;s.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof c.value<"u"||a.alwaysSet)&&(n[s.value]=c.value)}return{status:t.value,value:n}}};i(Yr,"ParseStatus");var It=Object.freeze({status:"aborted"}),ju=i(e=>({status:"dirty",value:e}),"DIRTY"),On=i(e=>({status:"valid",value:e}),"OK"),Yy=i(e=>e.status==="aborted","isAborted"),Xy=i(e=>e.status==="dirty","isDirty"),Qf=i(e=>e.status==="valid","isValid"),ed=i(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");function O0(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}i(O0,"__classPrivateFieldGet");function c7(e,t,r,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(e,r):a?a.value=r:t.set(e,r),r}i(c7,"__classPrivateFieldSet");var bt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(bt||(bt={}));var Yf,Xf,yi=class{constructor(t,r,n,a){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};i(yi,"ParseInputLazyPath");var a7=i((e,t)=>{if(Qf(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Sn(e.common.issues);return this._error=r,this._error}}},"handleResult");function jt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:i((c,l)=>{var d,p;let{message:g}=e;return c.code==="invalid_enum_value"?{message:g??l.defaultError}:typeof l.data>"u"?{message:(d=g??n)!==null&&d!==void 0?d:l.defaultError}:c.code!=="invalid_type"?{message:l.defaultError}:{message:(p=g??r)!==null&&p!==void 0?p:l.defaultError}},"customMap"),description:a}}i(jt,"processCreateParams");var Lt=class{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return is(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:is(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Yr,ctx:{common:t.parent.common,data:t.data,parsedType:is(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ed(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;let a={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:is(t)},s=this._parseSync({data:t,path:a.path,parent:a});return a7(a,s)}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:is(t)},a=this._parse({data:t,path:n.path,parent:n}),s=await(ed(a)?a:Promise.resolve(a));return a7(n,s)}refine(t,r){let n=i(a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r,"getIssueProperties");return this._refinement((a,s)=>{let c=t(a),l=i(()=>s.addIssue({code:qe.custom,...n(a)}),"setError");return typeof Promise<"u"&&c instanceof Promise?c.then(d=>d?!0:(l(),!1)):c?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,a)=>t(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(t){return new Xn({schema:this,typeName:Ct.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return wi.create(this,this._def)}nullable(){return la.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Yn.create(this,this._def)}promise(){return So.create(this,this._def)}or(t){return cs.create([this,t],this._def)}and(t){return us.create(this,t,this._def)}transform(t){return new Xn({...jt(this._def),schema:this,typeName:Ct.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new ps({...jt(this._def),innerType:this,defaultValue:r,typeName:Ct.ZodDefault})}brand(){return new $u({typeName:Ct.ZodBranded,type:this,...jt(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ms({...jt(this._def),innerType:this,catchValue:r,typeName:Ct.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return gs.create(this,t)}readonly(){return vs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};i(Lt,"ZodType");var uF=/^c[^\s-]{8,}$/i,lF=/^[0-9a-z]+$/,fF=/^[0-9A-HJKMNP-TV-Z]{26}$/,dF=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,hF=/^[a-z0-9_-]{21}$/i,pF=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,mF=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,gF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Zy,vF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,yF=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,bF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,u7="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",wF=new RegExp(`^${u7}$`);function l7(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}i(l7,"timeRegexSource");function _F(e){return new RegExp(`^${l7(e)}$`)}i(_F,"timeRegex");function f7(e){let t=`${u7}T${l7(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}i(f7,"datetimeRegex");function EF(e,t){return!!((t==="v4"||!t)&&vF.test(e)||(t==="v6"||!t)&&yF.test(e))}i(EF,"isValidIP");var Jn=class extends Lt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==nt.string){let s=this._getOrReturnCtx(t);return et(s,{code:qe.invalid_type,expected:nt.string,received:s.parsedType}),It}let n=new Yr,a;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(a=this._getOrReturnCtx(t,a),et(a,{code:qe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")t.data.length>s.value&&(a=this._getOrReturnCtx(t,a),et(a,{code:qe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let c=t.data.length>s.value,l=t.data.length<s.value;(c||l)&&(a=this._getOrReturnCtx(t,a),c?et(a,{code:qe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&et(a,{code:qe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")mF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"email",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Zy||(Zy=new RegExp(gF,"u")),Zy.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"emoji",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")dF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"uuid",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")hF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"nanoid",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")uF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"cuid",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")lF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"cuid2",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")fF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"ulid",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),et(a,{validation:"url",code:qe.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"regex",code:qe.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?f7(s).test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?wF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?_F(s).test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?pF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"duration",code:qe.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?EF(t.data,s.version)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"ip",code:qe.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?bF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"base64",code:qe.invalid_string,message:s.message}),n.dirty()):rr.assertNever(s);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(a=>t.test(a),{validation:r,code:qe.invalid_string,...bt.errToObj(n)})}_addCheck(t){return new Jn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...bt.errToObj(t)})}url(t){return this._addCheck({kind:"url",...bt.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...bt.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...bt.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...bt.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...bt.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...bt.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...bt.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...bt.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...bt.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,local:(n=t?.local)!==null&&n!==void 0?n:!1,...bt.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...bt.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...bt.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...bt.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...bt.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...bt.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...bt.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...bt.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...bt.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...bt.errToObj(r)})}nonempty(t){return this.min(1,bt.errToObj(t))}trim(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};i(Jn,"ZodString");Jn.create=e=>{var t;return new Jn({checks:[],typeName:Ct.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...jt(e)})};function AF(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(e.toFixed(a).replace(".","")),c=parseInt(t.toFixed(a).replace(".",""));return s%c/Math.pow(10,a)}i(AF,"floatSafeRemainder");var sa=class extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==nt.number){let s=this._getOrReturnCtx(t);return et(s,{code:qe.invalid_type,expected:nt.number,received:s.parsedType}),It}let n,a=new Yr;for(let s of this._def.checks)s.kind==="int"?rr.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),et(n,{code:qe.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?AF(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),et(n,{code:qe.not_finite,message:s.message}),a.dirty()):rr.assertNever(s);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,bt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,bt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,bt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,bt.toString(r))}setLimit(t,r,n,a){return new sa({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:bt.toString(a)}]})}_addCheck(t){return new sa({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:bt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:bt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:bt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:bt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:bt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:bt.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:bt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:bt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:bt.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&rr.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};i(sa,"ZodNumber");sa.create=e=>new sa({checks:[],typeName:Ct.ZodNumber,coerce:e?.coerce||!1,...jt(e)});var ca=class extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==nt.bigint){let s=this._getOrReturnCtx(t);return et(s,{code:qe.invalid_type,expected:nt.bigint,received:s.parsedType}),It}let n,a=new Yr;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):rr.assertNever(s);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,bt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,bt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,bt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,bt.toString(r))}setLimit(t,r,n,a){return new ca({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:bt.toString(a)}]})}_addCheck(t){return new ca({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:bt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:bt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:bt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:bt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:bt.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};i(ca,"ZodBigInt");ca.create=e=>{var t;return new ca({checks:[],typeName:Ct.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...jt(e)})};var as=class extends Lt{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==nt.boolean){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.boolean,received:n.parsedType}),It}return On(t.data)}};i(as,"ZodBoolean");as.create=e=>new as({typeName:Ct.ZodBoolean,coerce:e?.coerce||!1,...jt(e)});var $a=class extends Lt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==nt.date){let s=this._getOrReturnCtx(t);return et(s,{code:qe.invalid_type,expected:nt.date,received:s.parsedType}),It}if(isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return et(s,{code:qe.invalid_date}),It}let n=new Yr,a;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(a=this._getOrReturnCtx(t,a),et(a,{code:qe.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(a=this._getOrReturnCtx(t,a),et(a,{code:qe.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):rr.assertNever(s);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new $a({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:bt.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:bt.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};i($a,"ZodDate");$a.create=e=>new $a({checks:[],coerce:e?.coerce||!1,typeName:Ct.ZodDate,...jt(e)});var mc=class extends Lt{_parse(t){if(this._getType(t)!==nt.symbol){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.symbol,received:n.parsedType}),It}return On(t.data)}};i(mc,"ZodSymbol");mc.create=e=>new mc({typeName:Ct.ZodSymbol,...jt(e)});var os=class extends Lt{_parse(t){if(this._getType(t)!==nt.undefined){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.undefined,received:n.parsedType}),It}return On(t.data)}};i(os,"ZodUndefined");os.create=e=>new os({typeName:Ct.ZodUndefined,...jt(e)});var ss=class extends Lt{_parse(t){if(this._getType(t)!==nt.null){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.null,received:n.parsedType}),It}return On(t.data)}};i(ss,"ZodNull");ss.create=e=>new ss({typeName:Ct.ZodNull,...jt(e)});var Eo=class extends Lt{constructor(){super(...arguments),this._any=!0}_parse(t){return On(t.data)}};i(Eo,"ZodAny");Eo.create=e=>new Eo({typeName:Ct.ZodAny,...jt(e)});var za=class extends Lt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return On(t.data)}};i(za,"ZodUnknown");za.create=e=>new za({typeName:Ct.ZodUnknown,...jt(e)});var qi=class extends Lt{_parse(t){let r=this._getOrReturnCtx(t);return et(r,{code:qe.invalid_type,expected:nt.never,received:r.parsedType}),It}};i(qi,"ZodNever");qi.create=e=>new qi({typeName:Ct.ZodNever,...jt(e)});var gc=class extends Lt{_parse(t){if(this._getType(t)!==nt.undefined){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.void,received:n.parsedType}),It}return On(t.data)}};i(gc,"ZodVoid");gc.create=e=>new gc({typeName:Ct.ZodVoid,...jt(e)});var Yn=class extends Lt{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),a=this._def;if(r.parsedType!==nt.array)return et(r,{code:qe.invalid_type,expected:nt.array,received:r.parsedType}),It;if(a.exactLength!==null){let c=r.data.length>a.exactLength.value,l=r.data.length<a.exactLength.value;(c||l)&&(et(r,{code:c?qe.too_big:qe.too_small,minimum:l?a.exactLength.value:void 0,maximum:c?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(et(r,{code:qe.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(et(r,{code:qe.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((c,l)=>a.type._parseAsync(new yi(r,c,r.path,l)))).then(c=>Yr.mergeArray(n,c));let s=[...r.data].map((c,l)=>a.type._parseSync(new yi(r,c,r.path,l)));return Yr.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new Yn({...this._def,minLength:{value:t,message:bt.toString(r)}})}max(t,r){return new Yn({...this._def,maxLength:{value:t,message:bt.toString(r)}})}length(t,r){return new Yn({...this._def,exactLength:{value:t,message:bt.toString(r)}})}nonempty(t){return this.min(1,t)}};i(Yn,"ZodArray");Yn.create=(e,t)=>new Yn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ct.ZodArray,...jt(t)});function Fu(e){if(e instanceof Tr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=wi.create(Fu(n))}return new Tr({...e._def,shape:()=>t})}else return e instanceof Yn?new Yn({...e._def,type:Fu(e.element)}):e instanceof wi?wi.create(Fu(e.unwrap())):e instanceof la?la.create(Fu(e.unwrap())):e instanceof bi?bi.create(e.items.map(t=>Fu(t))):e}i(Fu,"deepPartialify");var Tr=class extends Lt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=rr.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==nt.object){let p=this._getOrReturnCtx(t);return et(p,{code:qe.invalid_type,expected:nt.object,received:p.parsedType}),It}let{status:n,ctx:a}=this._processInputParams(t),{shape:s,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof qi&&this._def.unknownKeys==="strip"))for(let p in a.data)c.includes(p)||l.push(p);let d=[];for(let p of c){let g=s[p],v=a.data[p];d.push({key:{status:"valid",value:p},value:g._parse(new yi(a,v,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof qi){let p=this._def.unknownKeys;if(p==="passthrough")for(let g of l)d.push({key:{status:"valid",value:g},value:{status:"valid",value:a.data[g]}});else if(p==="strict")l.length>0&&(et(a,{code:qe.unrecognized_keys,keys:l}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let g of l){let v=a.data[g];d.push({key:{status:"valid",value:g},value:p._parse(new yi(a,v,a.path,g)),alwaysSet:g in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let g of d){let v=await g.key,y=await g.value;p.push({key:v,value:y,alwaysSet:g.alwaysSet})}return p}).then(p=>Yr.mergeObjectSync(n,p)):Yr.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(t){return bt.errToObj,new Tr({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var a,s,c,l;let d=(c=(s=(a=this._def).errorMap)===null||s===void 0?void 0:s.call(a,r,n).message)!==null&&c!==void 0?c:n.defaultError;return r.code==="unrecognized_keys"?{message:(l=bt.errToObj(t).message)!==null&&l!==void 0?l:d}:{message:d}}}:{}})}strip(){return new Tr({...this._def,unknownKeys:"strip"})}passthrough(){return new Tr({...this._def,unknownKeys:"passthrough"})}extend(t){return new Tr({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Tr({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ct.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Tr({...this._def,catchall:t})}pick(t){let r={};return rr.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Tr({...this._def,shape:()=>r})}omit(t){let r={};return rr.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Tr({...this._def,shape:()=>r})}deepPartial(){return Fu(this)}partial(t){let r={};return rr.objectKeys(this.shape).forEach(n=>{let a=this.shape[n];t&&!t[n]?r[n]=a:r[n]=a.optional()}),new Tr({...this._def,shape:()=>r})}required(t){let r={};return rr.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof wi;)s=s._def.innerType;r[n]=s}}),new Tr({...this._def,shape:()=>r})}keyof(){return d7(rr.objectKeys(this.shape))}};i(Tr,"ZodObject");Tr.create=(e,t)=>new Tr({shape:()=>e,unknownKeys:"strip",catchall:qi.create(),typeName:Ct.ZodObject,...jt(t)});Tr.strictCreate=(e,t)=>new Tr({shape:()=>e,unknownKeys:"strict",catchall:qi.create(),typeName:Ct.ZodObject,...jt(t)});Tr.lazycreate=(e,t)=>new Tr({shape:e,unknownKeys:"strip",catchall:qi.create(),typeName:Ct.ZodObject,...jt(t)});var cs=class extends Lt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function a(s){for(let l of s)if(l.result.status==="valid")return l.result;for(let l of s)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let c=s.map(l=>new Sn(l.ctx.common.issues));return et(r,{code:qe.invalid_union,unionErrors:c}),It}if(i(a,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let c={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:c}),ctx:c}})).then(a);{let s,c=[];for(let d of n){let p={...r,common:{...r.common,issues:[]},parent:null},g=d._parseSync({data:r.data,path:r.path,parent:p});if(g.status==="valid")return g;g.status==="dirty"&&!s&&(s={result:g,ctx:p}),p.common.issues.length&&c.push(p.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let l=c.map(d=>new Sn(d));return et(r,{code:qe.invalid_union,unionErrors:l}),It}}get options(){return this._def.options}};i(cs,"ZodUnion");cs.create=(e,t)=>new cs({options:e,typeName:Ct.ZodUnion,...jt(t)});var _o=i(e=>e instanceof fs?_o(e.schema):e instanceof Xn?_o(e.innerType()):e instanceof ds?[e.value]:e instanceof ua?e.options:e instanceof hs?rr.objectValues(e.enum):e instanceof ps?_o(e._def.innerType):e instanceof os?[void 0]:e instanceof ss?[null]:e instanceof wi?[void 0,..._o(e.unwrap())]:e instanceof la?[null,..._o(e.unwrap())]:e instanceof $u||e instanceof vs?_o(e.unwrap()):e instanceof ms?_o(e._def.innerType):[],"getDiscriminator"),vc=class extends Lt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==nt.object)return et(r,{code:qe.invalid_type,expected:nt.object,received:r.parsedType}),It;let n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(et(r,{code:qe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),It)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let a=new Map;for(let s of r){let c=_o(s.shape[t]);if(!c.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let l of c){if(a.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);a.set(l,s)}}return new vc({typeName:Ct.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:a,...jt(n)})}};i(vc,"ZodDiscriminatedUnion");function Qy(e,t){let r=is(e),n=is(t);if(e===t)return{valid:!0,data:e};if(r===nt.object&&n===nt.object){let a=rr.objectKeys(t),s=rr.objectKeys(e).filter(l=>a.indexOf(l)!==-1),c={...e,...t};for(let l of s){let d=Qy(e[l],t[l]);if(!d.valid)return{valid:!1};c[l]=d.data}return{valid:!0,data:c}}else if(r===nt.array&&n===nt.array){if(e.length!==t.length)return{valid:!1};let a=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],d=Qy(c,l);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return r===nt.date&&n===nt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Qy,"mergeValues");var us=class extends Lt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),a=i((s,c)=>{if(Yy(s)||Yy(c))return It;let l=Qy(s.value,c.value);return l.valid?((Xy(s)||Xy(c))&&r.dirty(),{status:r.value,value:l.data}):(et(n,{code:qe.invalid_intersection_types}),It)},"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,c])=>a(s,c)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};i(us,"ZodIntersection");us.create=(e,t,r)=>new us({left:e,right:t,typeName:Ct.ZodIntersection,...jt(r)});var bi=class extends Lt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==nt.array)return et(n,{code:qe.invalid_type,expected:nt.array,received:n.parsedType}),It;if(n.data.length<this._def.items.length)return et(n,{code:qe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),It;!this._def.rest&&n.data.length>this._def.items.length&&(et(n,{code:qe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((c,l)=>{let d=this._def.items[l]||this._def.rest;return d?d._parse(new yi(n,c,n.path,l)):null}).filter(c=>!!c);return n.common.async?Promise.all(s).then(c=>Yr.mergeArray(r,c)):Yr.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new bi({...this._def,rest:t})}};i(bi,"ZodTuple");bi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new bi({items:e,typeName:Ct.ZodTuple,rest:null,...jt(t)})};var ls=class extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==nt.object)return et(n,{code:qe.invalid_type,expected:nt.object,received:n.parsedType}),It;let a=[],s=this._def.keyType,c=this._def.valueType;for(let l in n.data)a.push({key:s._parse(new yi(n,l,n.path,l)),value:c._parse(new yi(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?Yr.mergeObjectAsync(r,a):Yr.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Lt?new ls({keyType:t,valueType:r,typeName:Ct.ZodRecord,...jt(n)}):new ls({keyType:Jn.create(),valueType:t,typeName:Ct.ZodRecord,...jt(r)})}};i(ls,"ZodRecord");var yc=class extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==nt.map)return et(n,{code:qe.invalid_type,expected:nt.map,received:n.parsedType}),It;let a=this._def.keyType,s=this._def.valueType,c=[...n.data.entries()].map(([l,d],p)=>({key:a._parse(new yi(n,l,n.path,[p,"key"])),value:s._parse(new yi(n,d,n.path,[p,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let d of c){let p=await d.key,g=await d.value;if(p.status==="aborted"||g.status==="aborted")return It;(p.status==="dirty"||g.status==="dirty")&&r.dirty(),l.set(p.value,g.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let d of c){let p=d.key,g=d.value;if(p.status==="aborted"||g.status==="aborted")return It;(p.status==="dirty"||g.status==="dirty")&&r.dirty(),l.set(p.value,g.value)}return{status:r.value,value:l}}}};i(yc,"ZodMap");yc.create=(e,t,r)=>new yc({valueType:t,keyType:e,typeName:Ct.ZodMap,...jt(r)});var Ha=class extends Lt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==nt.set)return et(n,{code:qe.invalid_type,expected:nt.set,received:n.parsedType}),It;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(et(n,{code:qe.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(et(n,{code:qe.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());let s=this._def.valueType;function c(d){let p=new Set;for(let g of d){if(g.status==="aborted")return It;g.status==="dirty"&&r.dirty(),p.add(g.value)}return{status:r.value,value:p}}i(c,"finalizeSet");let l=[...n.data.values()].map((d,p)=>s._parse(new yi(n,d,n.path,p)));return n.common.async?Promise.all(l).then(d=>c(d)):c(l)}min(t,r){return new Ha({...this._def,minSize:{value:t,message:bt.toString(r)}})}max(t,r){return new Ha({...this._def,maxSize:{value:t,message:bt.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};i(Ha,"ZodSet");Ha.create=(e,t)=>new Ha({valueType:e,minSize:null,maxSize:null,typeName:Ct.ZodSet,...jt(t)});var Ao=class extends Lt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==nt.function)return et(r,{code:qe.invalid_type,expected:nt.function,received:r.parsedType}),It;function n(l,d){return R0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,D0(),zu].filter(p=>!!p),issueData:{code:qe.invalid_arguments,argumentsError:d}})}i(n,"makeArgsIssue");function a(l,d){return R0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,D0(),zu].filter(p=>!!p),issueData:{code:qe.invalid_return_type,returnTypeError:d}})}i(a,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},c=r.data;if(this._def.returns instanceof So){let l=this;return On(async function(...d){let p=new Sn([]),g=await l._def.args.parseAsync(d,s).catch(_=>{throw p.addIssue(n(d,_)),p}),v=await Reflect.apply(c,this,g);return await l._def.returns._def.type.parseAsync(v,s).catch(_=>{throw p.addIssue(a(v,_)),p})})}else{let l=this;return On(function(...d){let p=l._def.args.safeParse(d,s);if(!p.success)throw new Sn([n(d,p.error)]);let g=Reflect.apply(c,this,p.data),v=l._def.returns.safeParse(g,s);if(!v.success)throw new Sn([a(g,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Ao({...this._def,args:bi.create(t).rest(za.create())})}returns(t){return new Ao({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new Ao({args:t||bi.create([]).rest(za.create()),returns:r||za.create(),typeName:Ct.ZodFunction,...jt(n)})}};i(Ao,"ZodFunction");var fs=class extends Lt{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};i(fs,"ZodLazy");fs.create=(e,t)=>new fs({getter:e,typeName:Ct.ZodLazy,...jt(t)});var ds=class extends Lt{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return et(r,{received:r.data,code:qe.invalid_literal,expected:this._def.value}),It}return{status:"valid",value:t.data}}get value(){return this._def.value}};i(ds,"ZodLiteral");ds.create=(e,t)=>new ds({value:e,typeName:Ct.ZodLiteral,...jt(t)});function d7(e,t){return new ua({values:e,typeName:Ct.ZodEnum,...jt(t)})}i(d7,"createZodEnum");var ua=class extends Lt{constructor(){super(...arguments),Yf.set(this,void 0)}_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return et(r,{expected:rr.joinValues(n),received:r.parsedType,code:qe.invalid_type}),It}if(O0(this,Yf,"f")||c7(this,Yf,new Set(this._def.values),"f"),!O0(this,Yf,"f").has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return et(r,{received:r.data,code:qe.invalid_enum_value,options:n}),It}return On(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return ua.create(t,{...this._def,...r})}exclude(t,r=this._def){return ua.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};i(ua,"ZodEnum");Yf=new WeakMap;ua.create=d7;var hs=class extends Lt{constructor(){super(...arguments),Xf.set(this,void 0)}_parse(t){let r=rr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==nt.string&&n.parsedType!==nt.number){let a=rr.objectValues(r);return et(n,{expected:rr.joinValues(a),received:n.parsedType,code:qe.invalid_type}),It}if(O0(this,Xf,"f")||c7(this,Xf,new Set(rr.getValidEnumValues(this._def.values)),"f"),!O0(this,Xf,"f").has(t.data)){let a=rr.objectValues(r);return et(n,{received:n.data,code:qe.invalid_enum_value,options:a}),It}return On(t.data)}get enum(){return this._def.values}};i(hs,"ZodNativeEnum");Xf=new WeakMap;hs.create=(e,t)=>new hs({values:e,typeName:Ct.ZodNativeEnum,...jt(t)});var So=class extends Lt{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==nt.promise&&r.common.async===!1)return et(r,{code:qe.invalid_type,expected:nt.promise,received:r.parsedType}),It;let n=r.parsedType===nt.promise?r.data:Promise.resolve(r.data);return On(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(So,"ZodPromise");So.create=(e,t)=>new So({type:e,typeName:Ct.ZodPromise,...jt(t)});var Xn=class extends Lt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ct.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),a=this._def.effect||null,s={addIssue:c=>{et(n,c),c.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let c=a.transform(n.data,s);if(n.common.async)return Promise.resolve(c).then(async l=>{if(r.value==="aborted")return It;let d=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return d.status==="aborted"?It:d.status==="dirty"||r.value==="dirty"?ju(d.value):d});{if(r.value==="aborted")return It;let l=this._def.schema._parseSync({data:c,path:n.path,parent:n});return l.status==="aborted"?It:l.status==="dirty"||r.value==="dirty"?ju(l.value):l}}if(a.type==="refinement"){let c=i(l=>{let d=a.refinement(l,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l},"executeRefinement");if(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?It:(l.status==="dirty"&&r.dirty(),c(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?It:(l.status==="dirty"&&r.dirty(),c(l.value).then(()=>({status:r.value,value:l.value}))))}if(a.type==="transform")if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Qf(c))return c;let l=a.transform(c.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>Qf(c)?Promise.resolve(a.transform(c.value,s)).then(l=>({status:r.value,value:l})):c);rr.assertNever(a)}};i(Xn,"ZodEffects");Xn.create=(e,t,r)=>new Xn({schema:e,typeName:Ct.ZodEffects,effect:t,...jt(r)});Xn.createWithPreprocess=(e,t,r)=>new Xn({schema:t,effect:{type:"preprocess",transform:e},typeName:Ct.ZodEffects,...jt(r)});var wi=class extends Lt{_parse(t){return this._getType(t)===nt.undefined?On(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(wi,"ZodOptional");wi.create=(e,t)=>new wi({innerType:e,typeName:Ct.ZodOptional,...jt(t)});var la=class extends Lt{_parse(t){return this._getType(t)===nt.null?On(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(la,"ZodNullable");la.create=(e,t)=>new la({innerType:e,typeName:Ct.ZodNullable,...jt(t)});var ps=class extends Lt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===nt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};i(ps,"ZodDefault");ps.create=(e,t)=>new ps({innerType:e,typeName:Ct.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...jt(t)});var ms=class extends Lt{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ed(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Sn(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Sn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};i(ms,"ZodCatch");ms.create=(e,t)=>new ms({innerType:e,typeName:Ct.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...jt(t)});var bc=class extends Lt{_parse(t){if(this._getType(t)!==nt.nan){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.nan,received:n.parsedType}),It}return{status:"valid",value:t.data}}};i(bc,"ZodNaN");bc.create=e=>new bc({typeName:Ct.ZodNaN,...jt(e)});var SF=Symbol("zod_brand"),$u=class extends Lt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};i($u,"ZodBranded");var gs=class extends Lt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return i(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?It:s.status==="dirty"?(r.dirty(),ju(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?It:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(t,r){return new gs({in:t,out:r,typeName:Ct.ZodPipeline})}};i(gs,"ZodPipeline");var vs=class extends Lt{_parse(t){let r=this._def.innerType._parse(t),n=i(a=>(Qf(a)&&(a.value=Object.freeze(a.value)),a),"freeze");return ed(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}};i(vs,"ZodReadonly");vs.create=(e,t)=>new vs({innerType:e,typeName:Ct.ZodReadonly,...jt(t)});function h7(e,t={},r){return e?Eo.create().superRefine((n,a)=>{var s,c;if(!e(n)){let l=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,d=(c=(s=l.fatal)!==null&&s!==void 0?s:r)!==null&&c!==void 0?c:!0,p=typeof l=="string"?{message:l}:l;a.addIssue({code:"custom",...p,fatal:d})}}):Eo.create()}i(h7,"custom");var xF={object:Tr.lazycreate},Ct;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ct||(Ct={}));var TF=i((e,t={message:`Input not instance of ${e.name}`})=>h7(r=>r instanceof e,t),"instanceOfType"),p7=Jn.create,m7=sa.create,CF=bc.create,MF=ca.create,g7=as.create,IF=$a.create,kF=mc.create,DF=os.create,RF=ss.create,OF=Eo.create,NF=za.create,PF=qi.create,BF=gc.create,LF=Yn.create,UF=Tr.create,FF=Tr.strictCreate,jF=cs.create,$F=vc.create,zF=us.create,HF=bi.create,qF=ls.create,VF=yc.create,KF=Ha.create,GF=Ao.create,WF=fs.create,ZF=ds.create,JF=ua.create,YF=hs.create,XF=So.create,o7=Xn.create,QF=wi.create,ej=la.create,tj=Xn.createWithPreprocess,rj=gs.create,nj=i(()=>p7().optional(),"ostring"),ij=i(()=>m7().optional(),"onumber"),aj=i(()=>g7().optional(),"oboolean"),oj={string:e=>Jn.create({...e,coerce:!0}),number:e=>sa.create({...e,coerce:!0}),boolean:e=>as.create({...e,coerce:!0}),bigint:e=>ca.create({...e,coerce:!0}),date:e=>$a.create({...e,coerce:!0})},sj=It,P=Object.freeze({__proto__:null,defaultErrorMap:zu,setErrorMap:sF,getErrorMap:D0,makeIssue:R0,EMPTY_PATH:cF,addIssueToContext:et,ParseStatus:Yr,INVALID:It,DIRTY:ju,OK:On,isAborted:Yy,isDirty:Xy,isValid:Qf,isAsync:ed,get util(){return rr},get objectUtil(){return Jy},ZodParsedType:nt,getParsedType:is,ZodType:Lt,datetimeRegex:f7,ZodString:Jn,ZodNumber:sa,ZodBigInt:ca,ZodBoolean:as,ZodDate:$a,ZodSymbol:mc,ZodUndefined:os,ZodNull:ss,ZodAny:Eo,ZodUnknown:za,ZodNever:qi,ZodVoid:gc,ZodArray:Yn,ZodObject:Tr,ZodUnion:cs,ZodDiscriminatedUnion:vc,ZodIntersection:us,ZodTuple:bi,ZodRecord:ls,ZodMap:yc,ZodSet:Ha,ZodFunction:Ao,ZodLazy:fs,ZodLiteral:ds,ZodEnum:ua,ZodNativeEnum:hs,ZodPromise:So,ZodEffects:Xn,ZodTransformer:Xn,ZodOptional:wi,ZodNullable:la,ZodDefault:ps,ZodCatch:ms,ZodNaN:bc,BRAND:SF,ZodBranded:$u,ZodPipeline:gs,ZodReadonly:vs,custom:h7,Schema:Lt,ZodSchema:Lt,late:xF,get ZodFirstPartyTypeKind(){return Ct},coerce:oj,any:OF,array:LF,bigint:MF,boolean:g7,date:IF,discriminatedUnion:$F,effect:o7,enum:JF,function:GF,instanceof:TF,intersection:zF,lazy:WF,literal:ZF,map:VF,nan:CF,nativeEnum:YF,never:PF,null:RF,nullable:ej,number:m7,object:UF,oboolean:aj,onumber:ij,optional:QF,ostring:nj,pipeline:rj,preprocess:tj,promise:XF,record:qF,set:KF,strictObject:FF,string:p7,symbol:kF,transformer:o7,tuple:HF,undefined:DF,union:jF,unknown:NF,void:BF,NEVER:sj,ZodIssueCode:qe,quotelessJson:oF,ZodError:Sn});var Hu=Symbol("current"),wc=Symbol("previous");var td=i((e,{ref:t,refType:r,param:n,header:a,...s}={})=>({...s,...e}),"mergeOpenApi");function v7(e){if(typeof e.ZodType.prototype.openapi<"u")return;e.ZodType.prototype.openapi=function(s){let{zodOpenApi:c,...l}=this._def,d=new this.constructor({...l,zodOpenApi:{openapi:td(s,c?.openapi)}});return d._def.zodOpenApi[Hu]=d,c&&(d._def.zodOpenApi[wc]=this),d};let t=e.ZodType.prototype.describe;e.ZodType.prototype.describe=function(...s){let c=t.apply(this,s),l=c._def;if(l.zodOpenApi){let d={...l.zodOpenApi};d.openapi=td({description:s[0]},d.openapi),d[wc]=this,d[Hu]=c,l.zodOpenApi=d}else l.zodOpenApi={openapi:{description:s[0]},[Hu]:c};return c};let r=e.ZodObject.prototype.extend;e.ZodObject.prototype.extend=function(...s){let c=r.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=td({},d.openapi),d[wc]=this,c._def.zodOpenApi=d}else c._def.zodOpenApi={[wc]:this};return c};let n=e.ZodObject.prototype.omit;e.ZodObject.prototype.omit=function(...s){let c=n.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=td({},d.openapi),delete d[wc],delete d[Hu],c._def.zodOpenApi=d}return c};let a=e.ZodObject.prototype.pick;e.ZodObject.prototype.pick=function(...s){let c=a.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=td({},d.openapi),delete d[wc],delete d[Hu],c._def.zodOpenApi=d}return c}}i(v7,"extendZodWithOpenApi");v7(P);var cj=Object.defineProperty,uj=i((e,t)=>cj(e,"name",{value:t,configurable:!0}),"__name"),P0=P.array(P.string().or(P.record(P.any()))),rX=P.object({type:P.string().optional(),narrative:P.string().optional()}),B0=P.string().or(P.object({id:P.string(),type:P.string(),caption:P.string().optional()})),lj=P.object({type:P.string().min(1).or(P.string().array().nonempty()),latitude:P.number(),longitude:P.number()}),fj=P.object({type:P.string().min(1).or(P.string().array().nonempty()),addressCountry:P.string().optional(),addressCountryCode:P.string().optional(),addressRegion:P.string().optional(),addressLocality:P.string().optional(),streetAddress:P.string().optional(),postOfficeBoxNumber:P.string().optional(),postalCode:P.string().optional(),geo:lj.optional()}),dj=P.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(P.string()),C7=P.object({type:P.string().min(1).or(P.string().array().nonempty()),identifier:P.string(),identifierType:dj}),rd=P.string().or(P.object({id:P.string().optional(),type:P.string().or(P.string().array().nonempty().optional()),name:P.string().optional(),url:P.string().optional(),phone:P.string().optional(),description:P.string().optional(),endorsement:P.any().array().optional(),image:B0.optional(),email:P.string().email().optional(),address:fj.optional(),otherIdentifier:C7.array().optional(),official:P.string().optional(),parentOrg:P.any().optional(),familyName:P.string().optional(),givenName:P.string().optional(),additionalName:P.string().optional(),patronymicName:P.string().optional(),honorificPrefix:P.string().optional(),honorificSuffix:P.string().optional(),familyNamePrefix:P.string().optional(),dateOfBirth:P.string().optional()}).catchall(P.any())),eb=P.object({id:P.string().optional()}).catchall(P.any()),N0=P.object({type:P.string(),id:P.string()}).catchall(P.any()),y7=P.object({id:P.string(),type:P.string()}).catchall(P.any()),b7=P.object({id:P.string().optional(),type:P.string()}).catchall(P.any()),w7=P.object({type:P.string(),id:P.string().optional()}).catchall(P.any()),_7=P.object({type:P.string().or(P.string().array().nonempty()),id:P.string().optional()}).catchall(P.any()),nd=P.object({"@context":P0,id:P.string().optional(),type:P.string().array().nonempty(),issuer:rd,credentialSubject:eb.or(eb.array()),refreshService:b7.or(b7.array()).optional(),credentialSchema:y7.or(y7.array()).optional(),issuanceDate:P.string().optional(),expirationDate:P.string().optional(),credentialStatus:N0.or(N0.array()).optional(),name:P.string().optional(),description:P.string().optional(),validFrom:P.string().optional(),validUntil:P.string().optional(),status:N0.or(N0.array()).optional(),termsOfUse:w7.or(w7.array()).optional(),evidence:_7.or(_7.array()).optional()}).catchall(P.any()),qa=P.object({type:P.string(),created:P.string(),challenge:P.string().optional(),domain:P.string().optional(),nonce:P.string().optional(),proofPurpose:P.string(),verificationMethod:P.string(),jws:P.string().optional()}).catchall(P.any()),id=nd.extend({proof:qa.or(qa.array())}),hj=P.object({"@context":P0,id:P.string().optional(),type:P.string().or(P.string().array().nonempty()),verifiableCredential:id.or(id.array()).optional(),holder:P.string().optional()}).catchall(P.any()),pj=hj.extend({proof:qa.or(qa.array())}),nb=P.object({kty:P.string(),crv:P.string(),x:P.string(),y:P.string().optional(),n:P.string().optional(),d:P.string().optional()}),aX=nb.omit({d:!0}).extend({d:P.string()}),mj=P.object({alg:P.string(),iv:P.string(),tag:P.string(),epk:nb.partial().optional(),kid:P.string().optional(),apv:P.string().optional(),apu:P.string().optional()}),gj=P.object({header:mj,encrypted_key:P.string()}),vj=P.object({protected:P.string(),iv:P.string(),ciphertext:P.string(),tag:P.string(),aad:P.string().optional(),recipients:gj.array().optional()}),_c=P.string().or(P.object({"@context":P0.optional(),id:P.string(),type:P.string(),controller:P.string(),publicKeyJwk:nb.optional(),publicKeyBase58:P.string().optional(),blockChainAccountId:P.string().optional()}).catchall(P.any())),yj=P.object({id:P.string(),type:P.string().or(P.string().array().nonempty()),serviceEndpoint:P.any().or(P.any().array().nonempty())}).catchall(P.any()),oX=P.object({"@context":P0,id:P.string(),alsoKnownAs:P.string().optional(),controller:P.string().or(P.string().array().nonempty()).optional(),verificationMethod:_c.array().optional(),authentication:_c.array().optional(),assertionMethod:_c.array().optional(),keyAgreement:_c.array().optional(),capabilityInvocation:_c.array().optional(),capabilityDelegation:_c.array().optional(),publicKey:_c.array().optional(),service:yj.array().optional(),proof:qa.or(qa.array()).optional()}).catchall(P.any()),bj=P.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(P.string()),L0=P.object({type:P.string().array().nonempty(),targetCode:P.string().optional(),targetDescription:P.string().optional(),targetName:P.string(),targetFramework:P.string().optional(),targetType:bj.optional(),targetUrl:P.string()}),wj=P.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"]),_j=wj.or(P.string()),Ej=P.object({id:P.string().optional(),narrative:P.string().optional()}).catchall(P.any()),Aj=P.object({id:P.string(),type:P.string().array().nonempty(),endorsementComment:P.string().optional()}),Sj=nd.extend({credentialSubject:Aj,proof:qa.or(qa.array()).optional()}),xj=P.object({id:P.string(),"@language":P.string().optional(),version:P.string().optional()}),Tj=P.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(P.string()),Cj=P.object({id:P.string(),type:P.string().array().nonempty(),alignment:L0.array().optional(),description:P.string().optional(),level:P.string().optional(),name:P.string(),points:P.string().optional()}).catchall(P.any()),Mj=P.object({id:P.string(),type:P.string().array().nonempty(),alignment:L0.array().optional(),allowedValue:P.string().array().optional(),name:P.string(),requiredLevel:P.string().optional(),requiredValue:P.string().optional(),resultType:Tj,rubricCriterionLevel:Cj.array().optional(),valueMax:P.string().optional(),valueMin:P.string().optional()}).catchall(P.any()),Ij=P.object({id:P.string().optional(),type:P.string().array().nonempty(),alignment:L0.array().optional(),achievementType:_j.optional(),creator:rd.optional(),creditsAvailable:P.number().optional(),criteria:Ej,description:P.string(),endorsement:Sj.array().optional(),fieldOfStudy:P.string().optional(),humanCode:P.string().optional(),image:B0.optional(),"@language":P.string().optional(),name:P.string(),otherIdentifier:C7.array().optional(),related:xj.array().optional(),resultDescription:Mj.array().optional(),specialization:P.string().optional(),tag:P.string().array().optional(),version:P.string().optional()}).catchall(P.any()),kj=P.object({type:P.string(),hashed:P.boolean(),identityHash:P.string(),identityType:P.string(),salt:P.string().optional()}),Dj=P.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),Rj=P.object({type:P.string().array().nonempty(),achievedLevel:P.string().optional(),alignment:L0.array().optional(),resultDescription:P.string().optional(),status:Dj.optional(),value:P.string().optional()}).catchall(P.any()),E7=P.object({id:P.string().optional(),type:P.string().array().nonempty(),activityEndDate:P.string().optional(),activityStartDate:P.string().optional(),creditsEarned:P.number().optional(),achievement:Ij.optional(),identifier:kj.array().optional(),image:B0.optional(),licenseNumber:P.string().optional(),narrative:P.string().optional(),result:Rj.array().optional(),role:P.string().optional(),source:rd.optional(),term:P.string().optional()}).catchall(P.any()),Oj=P.object({id:P.string().optional(),type:P.string().or(P.string().array().nonempty()),narrative:P.string().optional(),name:P.string().optional(),description:P.string().optional(),genre:P.string().optional(),audience:P.string().optional()}).catchall(P.any()),Nj=nd.extend({name:P.string().optional(),description:P.string().optional(),image:B0.optional(),credentialSubject:E7.or(E7.array()),endorsement:nd.array().optional(),evidence:Oj.array().optional()}),cX=Nj.extend({proof:qa.or(qa.array())}),lX=P.object({checks:P.string().array(),warnings:P.string().array(),errors:P.string().array()}),M7=P.enum(["Success","Failed","Error"]),fX=M7.enum,dX=P.object({check:P.string(),status:M7,message:P.string().optional(),details:P.string().optional()}),hX=P.object({title:P.string().optional(),createdAt:P.string().optional(),issuer:rd.optional(),issuee:rd.optional(),credentialSubject:eb.optional()}),Ec=P.object({id:P.string(),uri:P.string()}).catchall(P.any()),gX=P.object({limit:P.number(),cursor:P.string().optional(),sort:P.string().optional()}),Nn=P.object({cursor:P.string().optional(),hasMore:P.boolean()}),I7=P.object({encryptedRecord:vj,fields:P.string().array()}).catchall(P.any()),vX=Nn.extend({records:I7.array()}),Pj=I7.extend({id:P.string()}),yX=Nn.extend({records:Pj.array()}),A7=uj(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),Bj=P.instanceof(RegExp).or(P.string().refine(e=>{try{return A7(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=A7(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),pr=P.string().or(P.object({$in:P.string().array()})).or(P.object({$regex:Bj})),Lj=P.object({backgroundColor:P.string().optional(),backgroundImage:P.string().optional(),fadeBackgroundImage:P.boolean().optional(),repeatBackgroundImage:P.boolean().optional(),fontColor:P.string().optional(),accentColor:P.string().optional(),accentFontColor:P.string().optional(),idBackgroundImage:P.string().optional(),fadeIdBackgroundImage:P.boolean().optional(),idBackgroundColor:P.string().optional(),repeatIdBackgroundImage:P.boolean().optional()}),xo=P.object({profileId:P.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),displayName:P.string().default("").describe("Human-readable display name for the profile."),shortBio:P.string().default("").describe("Short bio for the profile."),bio:P.string().default("").describe("Longer bio for the profile."),did:P.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),isPrivate:P.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),email:P.string().optional().describe("Contact email address for the profile. (deprecated)"),image:P.string().optional().describe("Profile image URL for the profile."),heroImage:P.string().optional().describe("Hero image URL for the profile."),websiteLink:P.string().optional().describe("Website link for the profile."),isServiceProfile:P.boolean().default(!1).optional().describe("Whether the profile is a service profile or not."),type:P.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),notificationsWebhook:P.string().url().startsWith("http").optional().describe("URL to send notifications to."),display:Lj.optional().describe("Display settings for the profile."),role:P.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),dob:P.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')}),_X=P.object({profileId:pr,displayName:pr,shortBio:pr,bio:pr,email:pr,websiteLink:pr,isServiceProfile:P.boolean(),type:pr}).partial(),EX=Nn.extend({records:xo.array()}),AX=P.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),k7=P.object({id:P.string(),created:P.string(),displayName:P.string().default("").optional(),shortBio:P.string().default("").optional(),bio:P.string().default("").optional(),email:P.string().optional(),image:P.string().optional(),heroImage:P.string().optional()}),SX=Nn.extend({records:k7.extend({did:P.string()}).array()}),xX=P.object({id:pr,displayName:pr,shortBio:pr,bio:pr,email:pr}).partial(),TX=Nn.extend({records:P.object({profile:xo,manager:k7.extend({did:P.string()}).optional()}).array()}),CX=P.object({uri:P.string(),to:P.string(),from:P.string(),sent:P.string().datetime(),received:P.string().datetime().optional()}),D7=P.object({role:P.string(),canEdit:P.boolean(),canIssue:P.boolean(),canRevoke:P.boolean(),canManagePermissions:P.boolean(),canIssueChildren:P.string(),canCreateChildren:P.string(),canEditChildren:P.string(),canRevokeChildren:P.string(),canManageChildrenPermissions:P.string(),canManageChildrenProfiles:P.boolean().default(!1).optional(),canViewAnalytics:P.boolean()}),Uj=P.object({role:pr,canEdit:P.boolean(),canIssue:P.boolean(),canRevoke:P.boolean(),canManagePermissions:P.boolean(),canIssueChildren:pr,canCreateChildren:pr,canEditChildren:pr,canRevokeChildren:pr,canManageChildrenPermissions:pr,canManageChildrenProfiles:P.boolean(),canViewAnalytics:P.boolean()}).partial(),S7=P.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),Fj=P.discriminatedUnion("type",[P.object({type:P.literal(S7.Values.GRANT_PERMISSIONS),data:P.object({claimUri:P.string(),targetUri:P.string(),permissions:D7.partial()})}),P.object({type:P.literal(S7.Values.ADD_ADMIN),data:P.object({claimUri:P.string(),targetUri:P.string()})})]),MX=P.object({type:pr,data:P.object({claimUri:pr,targetUri:pr,permissions:Uj})}).deepPartial(),jj=P.object({id:P.string(),createdAt:P.string(),updatedAt:P.string()}).and(Fj),IX=Nn.extend({records:jj.array()}),tb=P.enum(["DRAFT","LIVE"]),$j=P.object({uri:P.string(),name:P.string().optional(),type:P.string().optional(),category:P.string().optional(),status:tb.optional(),autoConnectRecipients:P.boolean().optional(),meta:P.record(P.any()).optional(),claimPermissions:D7.optional(),allowAnyoneToCreateChildren:P.boolean().optional()}),kX=P.object({uri:pr,name:pr,type:pr,category:pr,meta:P.record(pr),status:tb.or(P.object({$in:tb.array()})),autoConnectRecipients:P.boolean()}).partial(),DX=Nn.extend({records:$j.array()}),zj=P.object({to:xo,from:P.string(),received:P.string().optional(),uri:P.string().optional()}),RX=Nn.extend({records:zj.array()}),Hj=P.object({to:xo,from:P.string(),received:P.string().optional(),boostUris:P.array(P.string()),credentialUris:P.array(P.string()).optional()}),OX=Nn.extend({records:Hj.array()}),NX=P.object({endpoint:P.string(),name:P.string(),did:P.string().optional()}),PX=P.object({ttlSeconds:P.number().optional(),totalUses:P.number().optional()}),qj=P.object({endpoint:P.string()}),BX=P.object({signingAuthority:qj,relationship:P.object({name:P.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:P.string(),isPrimary:P.boolean().optional()})}),LX=P.object({boostUri:P.string(),signingAuthority:P.object({endpoint:P.string(),name:P.string()})}),Vj=P.enum(["live","stale","withdrawn"]),Kj=P.object({read:P.object({anonymize:P.boolean().optional(),credentials:P.object({categories:P.record(P.object({required:P.boolean(),defaultEnabled:P.boolean().optional()})).default({})}).default({}),personal:P.record(P.object({required:P.boolean(),defaultEnabled:P.boolean().optional()})).default({})}).default({}),write:P.object({credentials:P.object({categories:P.record(P.object({required:P.boolean(),defaultEnabled:P.boolean().optional()})).default({})}).default({}),personal:P.record(P.object({required:P.boolean(),defaultEnabled:P.boolean().optional()})).default({})}).default({})}),R7=P.object({contract:Kj,owner:xo,name:P.string(),subtitle:P.string().optional(),description:P.string().optional(),reasonForAccessing:P.string().optional(),image:P.string().optional(),uri:P.string(),needsGuardianConsent:P.boolean().optional(),redirectUrl:P.string().optional(),frontDoorBoostUri:P.string().optional(),createdAt:P.string(),updatedAt:P.string(),expiresAt:P.string().optional(),autoBoosts:P.string().array().optional(),writers:P.array(xo).optional()}),UX=Nn.extend({records:R7.omit({owner:!0}).array()}),Gj=P.object({credentials:P.object({categories:P.record(P.string().array()).default({})}),personal:P.record(P.string()).default({}),date:P.string()}),FX=Nn.extend({records:Gj.array()}),Wj=P.object({credentials:P.object({category:P.string(),uri:P.string()}).array(),personal:P.record(P.string()).default({}),date:P.string(),contractUri:P.string()}),jX=Nn.extend({records:Wj.array()}),O7=P.object({sharing:P.boolean().optional(),shared:P.string().array().optional(),shareAll:P.boolean().optional(),shareUntil:P.string().optional()}),N7=P.object({read:P.object({anonymize:P.boolean().optional(),credentials:P.object({shareAll:P.boolean().optional(),sharing:P.boolean().optional(),categories:P.record(O7).default({})}).default({}),personal:P.record(P.string()).default({})}).default({}),write:P.object({credentials:P.object({categories:P.record(P.boolean()).default({})}).default({}),personal:P.record(P.boolean()).default({})}).default({}),deniedWriters:P.array(P.string()).optional()}),$X=Nn.extend({records:P.object({expiresAt:P.string().optional(),oneTime:P.boolean().optional(),terms:N7,contract:R7,uri:P.string(),consenter:xo,status:Vj}).array()}),zX=P.object({read:P.object({anonymize:P.boolean().optional(),credentials:P.object({categories:P.record(P.object({required:P.boolean().optional()})).optional()}).optional(),personal:P.record(P.object({required:P.boolean().optional()})).optional()}).optional(),write:P.object({credentials:P.object({categories:P.record(P.object({required:P.boolean().optional()})).optional()}).optional(),personal:P.record(P.object({required:P.boolean().optional()})).optional()}).optional()}),HX=P.object({anonymize:P.boolean().optional(),credentials:P.object({categories:P.record(P.boolean()).optional()}).optional(),personal:P.record(P.boolean()).optional()}),qX=P.object({credentials:P.object({categories:P.record(P.boolean()).optional()}).optional(),personal:P.record(P.boolean()).optional(),id:pr.optional()}),Zj=P.object({read:P.object({anonymize:P.boolean().optional(),credentials:P.object({shareAll:P.boolean().optional(),sharing:P.boolean().optional(),categories:P.record(O7.optional()).optional()}).optional(),personal:P.record(P.string()).optional()}).optional(),write:P.object({credentials:P.object({categories:P.record(P.boolean()).optional()}).optional(),personal:P.record(P.boolean()).optional()}).optional()}),rb=P.enum(["consent","update","sync","withdraw","write"]),VX=P.object({terms:Zj.optional(),action:rb.or(rb.array()).optional(),date:P.object({$gt:P.string()}).or(P.object({$lt:P.string()})).or(P.object({$eq:P.string()})).optional(),expiresAt:P.object({$gt:P.string()}).or(P.object({$lt:P.string()})).or(P.object({$eq:P.string()})).optional(),oneTime:P.boolean().optional()}),P7=P.object({expiresAt:P.string().optional(),oneTime:P.boolean().optional(),terms:N7.optional(),id:P.string(),action:rb,date:P.string(),uris:P.string().array().optional()}),KX=Nn.extend({records:P7.array()}),Jj=P.object({credentialUri:P.string(),termsUri:P.string(),contractUri:P.string(),boostUri:P.string(),category:P.string().optional(),date:P.string()}),GX=Nn.extend({records:Jj.array()}),Yj=P.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION","ISSUANCE_CLAIMED","ISSUANCE_DELIVERED"]),Xj=P.object({title:P.string().optional(),body:P.string().optional()}),Qj=P.object({type:P.string(),value:P.string()}),U0=P.enum(["PENDING","DELIVERED","CLAIMED","EXPIRED"]),e$=P.object({issuanceId:P.string(),status:U0,recipient:P.object({contactMethod:Qj.optional(),learnCardId:P.string().optional()}),timestamp:P.string().datetime().optional()}),t$=P.object({vcUris:P.array(P.string()).optional(),vpUris:P.array(P.string()).optional(),transaction:P7.optional(),inbox:e$.optional()}),WX=P.object({type:Yj,to:xo.partial().and(P.object({did:P.string()})),from:xo.partial().and(P.object({did:P.string()})),message:Xj.optional(),data:t$.optional(),sent:P.string().datetime().optional(),webhookUrl:P.string().optional()}),r$="auth-grant:",ZX=P.object({id:P.string(),name:P.string(),description:P.string().optional(),challenge:P.string().startsWith(r$).min(10,{message:"Challenge is too short"}).max(100,{message:"Challenge is too long"}),status:P.enum(["revoked","active"],{required_error:"Status is required",invalid_type_error:"Status must be either active or revoked"}),scope:P.string(),createdAt:P.string().datetime({message:"createdAt must be a valid ISO 8601 datetime string"}),expiresAt:P.string().datetime({message:"expiresAt must be a valid ISO 8601 datetime string"}).nullish().optional()}),JX=P.object({id:P.string()}).catchall(P.any()),n$=P.enum(["active","revoked"]),YX=P.object({id:pr,name:pr,description:pr,status:n$}).partial(),x7=P.object({id:P.string(),isVerified:P.boolean(),verifiedAt:P.string().optional(),isPrimary:P.boolean(),createdAt:P.string()}),XX=P.discriminatedUnion("type",[P.object({type:P.literal("email"),value:P.string().email()}).merge(x7),P.object({type:P.literal("phone"),value:P.string()}).merge(x7)]),T7=P.object({isVerified:P.boolean().optional(),isPrimary:P.boolean().optional()}),QX=P.discriminatedUnion("type",[P.object({type:P.literal("email"),value:P.string().email()}).merge(T7),P.object({type:P.literal("phone"),value:P.string()}).merge(T7)]),B7=P.discriminatedUnion("type",[P.object({type:P.literal("email"),value:P.string().email()}),P.object({type:P.literal("phone"),value:P.string()})]),eQ=P.object({value:P.string(),type:P.enum(["email","phone"])}),tQ=P.object({token:P.string()}),rQ=P.object({contactMethodId:P.string()}),i$=P.object({id:P.string(),credential:P.string(),isSigned:P.boolean(),currentStatus:U0,expiresAt:P.string(),createdAt:P.string(),issuerDid:P.string(),webhookUrl:P.string().optional(),"signingAuthority.endpoint":P.string().optional(),"signingAuthority.name":P.string().optional()}),nQ=P.object({hasMore:P.boolean(),records:P.array(i$),cursor:P.string().optional()}),iQ=P.object({currentStatus:U0,id:P.string(),isSigned:P.boolean(),issuerDid:P.string()}).partial(),a$=P.object({endpoint:P.string().url(),name:P.string()}),aQ=P.object({recipient:B7.describe("The recipient of the credential"),credential:id.passthrough().or(pj.passthrough()).or(nd.passthrough()).describe("The credential to issue. If not signed, the users default signing authority will be used, or the specified signing authority in the configuration."),configuration:P.object({signingAuthority:a$.optional().describe("The signing authority to use for the credential. If not provided, the users default signing authority will be used if the credential is not signed."),webhookUrl:P.string().url().optional().describe("The webhook URL to receive credential issuance events."),expiresInDays:P.number().min(1).max(365).optional().describe("The number of days the credential will be valid for."),delivery:P.object({suppress:P.boolean().optional().default(!1).describe("Whether to suppress delivery of the credential to the recipient. If true, the email/sms will not be sent to the recipient. Useful if you would like to manually send claim link to your users."),template:P.object({id:P.enum(["universal-inbox-claim"]).optional().describe("The template ID to use for the credential delivery. If not provided, the default template will be used."),model:P.object({issuer:P.object({name:P.string().optional().describe('The name of the organization (e.g., "State University").'),logoUrl:P.string().url().optional().describe("The URL of the organization's logo.")}).optional(),credential:P.object({name:P.string().optional().describe('The name of the credential (e.g., "Bachelor of Science").'),type:P.string().optional().describe('The type of the credential (e.g., "degree", "certificate").')}).optional(),recipient:P.object({name:P.string().optional().describe('The name of the recipient (e.g., "John Doe").')}).optional()}).describe("The template model to use for the credential delivery. Injects via template variables into email/sms templates. If not provided, the default template will be used.")}).optional().describe("The template to use for the credential delivery. If not provided, the default template will be used.")}).optional().describe("Configuration for the credential delivery i.e. email or SMS. When credentials are sent to a user who has a verified email or phone associated with their account, delivery is skipped, and the credential will be sent using in-app notifications. If not provided, the default configuration will be used.")}).optional().describe("Configuration for the credential issuance. If not provided, the default configuration will be used.")}),oQ=P.object({issuanceId:P.string(),status:U0,recipient:B7,claimUrl:P.string().url().optional(),recipientDid:P.string().optional()}),sQ=P.object({token:P.string(),contactMethodId:P.string(),createdAt:P.string(),expiresAt:P.string(),used:P.boolean()});var o$=Object.create,Hd=Object.defineProperty,s$=Object.getOwnPropertyDescriptor,O6=Object.getOwnPropertyNames,c$=Object.getPrototypeOf,u$=Object.prototype.hasOwnProperty,o=i((e,t)=>Hd(e,"name",{value:t,configurable:!0}),"__name"),Rb=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')}),gr=i((e,t)=>i(function(){return e&&(t=(0,e[O6(e)[0]])(e=0)),t},"__init"),"__esm"),ze=i((e,t)=>i(function(){return t||(0,e[O6(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require2"),"__commonJS"),Sr=i((e,t)=>{for(var r in t)Hd(e,r,{get:t[r],enumerable:!0})},"__export"),ax=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of O6(t))!u$.call(e,a)&&a!==r&&Hd(e,a,{get:()=>t[a],enumerable:!(n=s$(t,a))||n.enumerable});return e},"__copyProps"),ir=i((e,t,r)=>(r=e!=null?o$(c$(e)):{},ax(t||!e||!e.__esModule?Hd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),ib=i(e=>ax(Hd({},"__esModule",{value:!0}),e),"__toCommonJS"),l$=ze({"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(e,t){(function(){var r,n="4.17.21",a=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",p=500,g="__lodash_placeholder__",v=1,y=2,_=4,x=1,O=2,D=1,L=2,Z=4,z=8,q=16,Q=32,Y=64,k=128,K=256,he=512,me=30,we="...",J=800,w=16,T=1,b=2,f=3,m=1/0,E=9007199254740991,R=17976931348623157e292,C=0/0,A=4294967295,U=A-1,V=A>>>1,I=[["ary",k],["bind",D],["bindKey",L],["curry",z],["curryRight",q],["flip",he],["partial",Q],["partialRight",Y],["rearg",K]],j="[object Arguments]",ge="[object Array]",F="[object AsyncFunction]",ne="[object Boolean]",oe="[object Date]",M="[object DOMException]",G="[object Error]",ae="[object Function]",fe="[object GeneratorFunction]",be="[object Map]",Re="[object Number]",X="[object Null]",N="[object Object]",$="[object Promise]",W="[object Proxy]",ie="[object RegExp]",ee="[object Set]",ue="[object String]",Ae="[object Symbol]",De="[object Undefined]",Ie="[object WeakMap]",Be="[object WeakSet]",Ke="[object ArrayBuffer]",ve="[object DataView]",pe="[object Float32Array]",re="[object Float64Array]",le="[object Int8Array]",_e="[object Int16Array]",Te="[object Int32Array]",Ce="[object Uint8Array]",Oe="[object Uint8ClampedArray]",Dt="[object Uint16Array]",Ge="[object Uint32Array]",He=/\b__p \+= '';/g,Pt=/\b(__p \+=) '' \+/g,pt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,vt=/&(?:amp|lt|gt|quot|#39);/g,Or=/[&<>"']/g,lt=RegExp(vt.source),ft=RegExp(Or.source),lr=/<%-([\s\S]+?)%>/g,dt=/<%([\s\S]+?)%>/g,at=/<%=([\s\S]+?)%>/g,or=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ot=/^\w*$/,Xe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qt=/[\\^$.*+?()[\]{}|]/g,st=RegExp(Qt.source),rt=/^\s+/,sr=/\s/,ct=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Je=/\{\n\/\* \[wrapped with (.+)\] \*/,cr=/,? & /,ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,St=/[()=,{}\[\]\/\s]/,Tn=/\\(\\)?/g,xt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yt=/\w*$/,hn=/^[-+]0x[0-9a-f]+$/i,er=/^0b[01]+$/i,tr=/^\[object .+?Constructor\]$/,nn=/^0o[0-7]+$/i,an=/^(?:0|[1-9]\d*)$/,Nr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vr=/($^)/,on=/['\n\r\u2028\u2029\\]/g,Cn="\\ud800-\\udfff",ki="\\u0300-\\u036f",Di="\\ufe20-\\ufe2f",Ri="\\u20d0-\\u20ff",jn=ki+Di+Ri,pn="\\u2700-\\u27bf",ii="a-z\\xdf-\\xf6\\xf8-\\xff",$n="\\xac\\xb1\\xd7\\xf7",Oi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ni="\\u2000-\\u206f",Pi=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ro="A-Z\\xc0-\\xd6\\xd8-\\xde",no="\\ufe0e\\ufe0f",io=$n+Oi+Ni+Pi,zo="['\u2019]",ah="["+Cn+"]",Nl="["+io+"]",Us="["+jn+"]",Pl="\\d+",oh="["+pn+"]",Bl="["+ii+"]",Ll="[^"+Cn+io+Pl+pn+ii+ro+"]",Fs="\\ud83c[\\udffb-\\udfff]",sh="(?:"+Us+"|"+Fs+")",Ul="[^"+Cn+"]",ao="(?:\\ud83c[\\udde6-\\uddff]){2}",Yi="[\\ud800-\\udbff][\\udc00-\\udfff]",oo="["+ro+"]",Sa="\\u200d",Fl="(?:"+Bl+"|"+Ll+")",ch="(?:"+oo+"|"+Ll+")",jl="(?:"+zo+"(?:d|ll|m|re|s|t|ve))?",$l="(?:"+zo+"(?:D|LL|M|RE|S|T|VE))?",zl=sh+"?",Hl="["+no+"]?",ql="(?:"+Sa+"(?:"+[Ul,ao,Yi].join("|")+")"+Hl+zl+")*",xa="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",uh="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Jc=Hl+zl+ql,lh="(?:"+[oh,ao,Yi].join("|")+")"+Jc,Vl="(?:"+[Ul+Us+"?",Us,ao,Yi,ah].join("|")+")",Kl=RegExp(zo,"g"),fh=RegExp(Us,"g"),Gl=RegExp(Fs+"(?="+Fs+")|"+Vl+Jc,"g"),Wl=RegExp([oo+"?"+Bl+"+"+jl+"(?="+[Nl,oo,"$"].join("|")+")",ch+"+"+$l+"(?="+[Nl,oo+Fl,"$"].join("|")+")",oo+"?"+Fl+"+"+jl,oo+"+"+$l,uh,xa,Pl,lh].join("|"),"g"),dh=RegExp("["+Sa+Cn+jn+no+"]"),js=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,hh=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Yc=-1,wr={};wr[pe]=wr[re]=wr[le]=wr[_e]=wr[Te]=wr[Ce]=wr[Oe]=wr[Dt]=wr[Ge]=!0,wr[j]=wr[ge]=wr[Ke]=wr[ne]=wr[ve]=wr[oe]=wr[G]=wr[ae]=wr[be]=wr[Re]=wr[N]=wr[ie]=wr[ee]=wr[ue]=wr[Ie]=!1;var vr={};vr[j]=vr[ge]=vr[Ke]=vr[ve]=vr[ne]=vr[oe]=vr[pe]=vr[re]=vr[le]=vr[_e]=vr[Te]=vr[be]=vr[Re]=vr[N]=vr[ie]=vr[ee]=vr[ue]=vr[Ae]=vr[Ce]=vr[Oe]=vr[Dt]=vr[Ge]=!0,vr[G]=vr[ae]=vr[Ie]=!1;var de={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Me={"&":"&","<":"<",">":">",'"':""","'":"'"},Le={"&":"&","<":"<",">":">",""":'"',"'":"'"},mt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Kr=parseFloat,sn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,mn=typeof self=="object"&&self&&self.Object===Object&&self,Fr=Mn||mn||Function("return this")(),Ta=typeof e=="object"&&e&&!e.nodeType&&e,Ca=Ta&&typeof t=="object"&&t&&!t.nodeType&&t,Zl=Ca&&Ca.exports===Ta,Xc=Zl&&Mn.process,gn=function(){try{var Se=Ca&&Ca.require&&Ca.require("util").types;return Se||Xc&&Xc.binding&&Xc.binding("util")}catch{}}(),$s=gn&&gn.isArrayBuffer,v2=gn&&gn.isDate,y2=gn&&gn.isMap,b2=gn&&gn.isRegExp,w2=gn&&gn.isSet,_2=gn&&gn.isTypedArray;function zn(Se,Pe,ke){switch(ke.length){case 0:return Se.call(Pe);case 1:return Se.call(Pe,ke[0]);case 2:return Se.call(Pe,ke[0],ke[1]);case 3:return Se.call(Pe,ke[0],ke[1],ke[2])}return Se.apply(Pe,ke)}i(zn,"apply"),o(zn,"apply");function E2(Se,Pe,ke,ht){for(var Nt=-1,fr=Se==null?0:Se.length;++Nt<fr;){var Wr=Se[Nt];Pe(ht,Wr,ke(Wr),Se)}return ht}i(E2,"arrayAggregator"),o(E2,"arrayAggregator");function ai(Se,Pe){for(var ke=-1,ht=Se==null?0:Se.length;++ke<ht&&Pe(Se[ke],ke,Se)!==!1;);return Se}i(ai,"arrayEach"),o(ai,"arrayEach");function A2(Se,Pe){for(var ke=Se==null?0:Se.length;ke--&&Pe(Se[ke],ke,Se)!==!1;);return Se}i(A2,"arrayEachRight"),o(A2,"arrayEachRight");function E1(Se,Pe){for(var ke=-1,ht=Se==null?0:Se.length;++ke<ht;)if(!Pe(Se[ke],ke,Se))return!1;return!0}i(E1,"arrayEvery"),o(E1,"arrayEvery");function so(Se,Pe){for(var ke=-1,ht=Se==null?0:Se.length,Nt=0,fr=[];++ke<ht;){var Wr=Se[ke];Pe(Wr,ke,Se)&&(fr[Nt++]=Wr)}return fr}i(so,"arrayFilter"),o(so,"arrayFilter");function Jl(Se,Pe){var ke=Se==null?0:Se.length;return!!ke&&zs(Se,Pe,0)>-1}i(Jl,"arrayIncludes"),o(Jl,"arrayIncludes");function ph(Se,Pe,ke){for(var ht=-1,Nt=Se==null?0:Se.length;++ht<Nt;)if(ke(Pe,Se[ht]))return!0;return!1}i(ph,"arrayIncludesWith"),o(ph,"arrayIncludesWith");function Mr(Se,Pe){for(var ke=-1,ht=Se==null?0:Se.length,Nt=Array(ht);++ke<ht;)Nt[ke]=Pe(Se[ke],ke,Se);return Nt}i(Mr,"arrayMap"),o(Mr,"arrayMap");function co(Se,Pe){for(var ke=-1,ht=Pe.length,Nt=Se.length;++ke<ht;)Se[Nt+ke]=Pe[ke];return Se}i(co,"arrayPush"),o(co,"arrayPush");function mh(Se,Pe,ke,ht){var Nt=-1,fr=Se==null?0:Se.length;for(ht&&fr&&(ke=Se[++Nt]);++Nt<fr;)ke=Pe(ke,Se[Nt],Nt,Se);return ke}i(mh,"arrayReduce"),o(mh,"arrayReduce");function S2(Se,Pe,ke,ht){var Nt=Se==null?0:Se.length;for(ht&&Nt&&(ke=Se[--Nt]);Nt--;)ke=Pe(ke,Se[Nt],Nt,Se);return ke}i(S2,"arrayReduceRight"),o(S2,"arrayReduceRight");function gh(Se,Pe){for(var ke=-1,ht=Se==null?0:Se.length;++ke<ht;)if(Pe(Se[ke],ke,Se))return!0;return!1}i(gh,"arraySome"),o(gh,"arraySome");var qD=vh("length");function x2(Se){return Se.split("")}i(x2,"asciiToArray"),o(x2,"asciiToArray");function T2(Se){return Se.match(ut)||[]}i(T2,"asciiWords"),o(T2,"asciiWords");function A1(Se,Pe,ke){var ht;return ke(Se,function(Nt,fr,Wr){if(Pe(Nt,fr,Wr))return ht=fr,!1}),ht}i(A1,"baseFindKey"),o(A1,"baseFindKey");function Yl(Se,Pe,ke,ht){for(var Nt=Se.length,fr=ke+(ht?1:-1);ht?fr--:++fr<Nt;)if(Pe(Se[fr],fr,Se))return fr;return-1}i(Yl,"baseFindIndex"),o(Yl,"baseFindIndex");function zs(Se,Pe,ke){return Pe===Pe?B2(Se,Pe,ke):Yl(Se,S1,ke)}i(zs,"baseIndexOf"),o(zs,"baseIndexOf");function C2(Se,Pe,ke,ht){for(var Nt=ke-1,fr=Se.length;++Nt<fr;)if(ht(Se[Nt],Pe))return Nt;return-1}i(C2,"baseIndexOfWith"),o(C2,"baseIndexOfWith");function S1(Se){return Se!==Se}i(S1,"baseIsNaN"),o(S1,"baseIsNaN");function x1(Se,Pe){var ke=Se==null?0:Se.length;return ke?bh(Se,Pe)/ke:C}i(x1,"baseMean"),o(x1,"baseMean");function vh(Se){return function(Pe){return Pe==null?r:Pe[Se]}}i(vh,"baseProperty"),o(vh,"baseProperty");function yh(Se){return function(Pe){return Se==null?r:Se[Pe]}}i(yh,"basePropertyOf"),o(yh,"basePropertyOf");function T1(Se,Pe,ke,ht,Nt){return Nt(Se,function(fr,Wr,_r){ke=ht?(ht=!1,fr):Pe(ke,fr,Wr,_r)}),ke}i(T1,"baseReduce"),o(T1,"baseReduce");function M2(Se,Pe){var ke=Se.length;for(Se.sort(Pe);ke--;)Se[ke]=Se[ke].value;return Se}i(M2,"baseSortBy"),o(M2,"baseSortBy");function bh(Se,Pe){for(var ke,ht=-1,Nt=Se.length;++ht<Nt;){var fr=Pe(Se[ht]);fr!==r&&(ke=ke===r?fr:ke+fr)}return ke}i(bh,"baseSum"),o(bh,"baseSum");function wh(Se,Pe){for(var ke=-1,ht=Array(Se);++ke<Se;)ht[ke]=Pe(ke);return ht}i(wh,"baseTimes"),o(wh,"baseTimes");function I2(Se,Pe){return Mr(Pe,function(ke){return[ke,Se[ke]]})}i(I2,"baseToPairs"),o(I2,"baseToPairs");function C1(Se){return Se&&Se.slice(0,D1(Se)+1).replace(rt,"")}i(C1,"baseTrim"),o(C1,"baseTrim");function Hn(Se){return function(Pe){return Se(Pe)}}i(Hn,"baseUnary"),o(Hn,"baseUnary");function _h(Se,Pe){return Mr(Pe,function(ke){return Se[ke]})}i(_h,"baseValues"),o(_h,"baseValues");function Qc(Se,Pe){return Se.has(Pe)}i(Qc,"cacheHas"),o(Qc,"cacheHas");function M1(Se,Pe){for(var ke=-1,ht=Se.length;++ke<ht&&zs(Pe,Se[ke],0)>-1;);return ke}i(M1,"charsStartIndex"),o(M1,"charsStartIndex");function I1(Se,Pe){for(var ke=Se.length;ke--&&zs(Pe,Se[ke],0)>-1;);return ke}i(I1,"charsEndIndex"),o(I1,"charsEndIndex");function k2(Se,Pe){for(var ke=Se.length,ht=0;ke--;)Se[ke]===Pe&&++ht;return ht}i(k2,"countHolders"),o(k2,"countHolders");var VD=yh(de),KD=yh(Me);function D2(Se){return"\\"+mt[Se]}i(D2,"escapeStringChar"),o(D2,"escapeStringChar");function R2(Se,Pe){return Se==null?r:Se[Pe]}i(R2,"getValue"),o(R2,"getValue");function Hs(Se){return dh.test(Se)}i(Hs,"hasUnicode"),o(Hs,"hasUnicode");function O2(Se){return js.test(Se)}i(O2,"hasUnicodeWord"),o(O2,"hasUnicodeWord");function N2(Se){for(var Pe,ke=[];!(Pe=Se.next()).done;)ke.push(Pe.value);return ke}i(N2,"iteratorToArray"),o(N2,"iteratorToArray");function Eh(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ht,Nt){ke[++Pe]=[Nt,ht]}),ke}i(Eh,"mapToArray"),o(Eh,"mapToArray");function k1(Se,Pe){return function(ke){return Se(Pe(ke))}}i(k1,"overArg"),o(k1,"overArg");function uo(Se,Pe){for(var ke=-1,ht=Se.length,Nt=0,fr=[];++ke<ht;){var Wr=Se[ke];(Wr===Pe||Wr===g)&&(Se[ke]=g,fr[Nt++]=ke)}return fr}i(uo,"replaceHolders"),o(uo,"replaceHolders");function Xl(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ht){ke[++Pe]=ht}),ke}i(Xl,"setToArray"),o(Xl,"setToArray");function P2(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ht){ke[++Pe]=[ht,ht]}),ke}i(P2,"setToPairs"),o(P2,"setToPairs");function B2(Se,Pe,ke){for(var ht=ke-1,Nt=Se.length;++ht<Nt;)if(Se[ht]===Pe)return ht;return-1}i(B2,"strictIndexOf"),o(B2,"strictIndexOf");function L2(Se,Pe,ke){for(var ht=ke+1;ht--;)if(Se[ht]===Pe)return ht;return ht}i(L2,"strictLastIndexOf"),o(L2,"strictLastIndexOf");function qs(Se){return Hs(Se)?U2(Se):qD(Se)}i(qs,"stringSize"),o(qs,"stringSize");function Bi(Se){return Hs(Se)?F2(Se):x2(Se)}i(Bi,"stringToArray"),o(Bi,"stringToArray");function D1(Se){for(var Pe=Se.length;Pe--&&sr.test(Se.charAt(Pe)););return Pe}i(D1,"trimmedEndIndex"),o(D1,"trimmedEndIndex");var GD=yh(Le);function U2(Se){for(var Pe=Gl.lastIndex=0;Gl.test(Se);)++Pe;return Pe}i(U2,"unicodeSize"),o(U2,"unicodeSize");function F2(Se){return Se.match(Gl)||[]}i(F2,"unicodeToArray"),o(F2,"unicodeToArray");function j2(Se){return Se.match(Wl)||[]}i(j2,"unicodeWords"),o(j2,"unicodeWords");var WD=o(i(function Se(Pe){Pe=Pe==null?Fr:Ho.defaults(Fr.Object(),Pe,Ho.pick(Fr,hh));var ke=Pe.Array,ht=Pe.Date,Nt=Pe.Error,fr=Pe.Function,Wr=Pe.Math,_r=Pe.Object,R1=Pe.RegExp,ZD=Pe.String,Li=Pe.TypeError,Ah=ke.prototype,JD=fr.prototype,eu=_r.prototype,Sh=Pe["__core-js_shared__"],xh=JD.toString,yr=eu.hasOwnProperty,YD=0,$2=function(){var u=/[^.]+$/.exec(Sh&&Sh.keys&&Sh.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),Th=eu.toString,XD=xh.call(_r),QD=Fr._,eR=R1("^"+xh.call(yr).replace(Qt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ch=Zl?Pe.Buffer:r,qo=Pe.Symbol,Mh=Pe.Uint8Array,z2=Ch?Ch.allocUnsafe:r,Ih=k1(_r.getPrototypeOf,_r),H2=_r.create,q2=eu.propertyIsEnumerable,kh=Ah.splice,V2=qo?qo.isConcatSpreadable:r,Ql=qo?qo.iterator:r,Vs=qo?qo.toStringTag:r,Dh=function(){try{var u=Jo(_r,"defineProperty");return u({},"",{}),u}catch{}}(),tR=Pe.clearTimeout!==Fr.clearTimeout&&Pe.clearTimeout,rR=ht&&ht.now!==Fr.Date.now&&ht.now,nR=Pe.setTimeout!==Fr.setTimeout&&Pe.setTimeout,Rh=Wr.ceil,Oh=Wr.floor,O1=_r.getOwnPropertySymbols,iR=Ch?Ch.isBuffer:r,K2=Pe.isFinite,aR=Ah.join,oR=k1(_r.keys,_r),Zr=Wr.max,vn=Wr.min,sR=ht.now,cR=Pe.parseInt,G2=Wr.random,uR=Ah.reverse,N1=Jo(Pe,"DataView"),ef=Jo(Pe,"Map"),P1=Jo(Pe,"Promise"),tu=Jo(Pe,"Set"),tf=Jo(Pe,"WeakMap"),rf=Jo(_r,"create"),Nh=tf&&new tf,ru={},lR=Yo(N1),fR=Yo(ef),dR=Yo(P1),hR=Yo(tu),pR=Yo(tf),Ph=qo?qo.prototype:r,nf=Ph?Ph.valueOf:r,W2=Ph?Ph.toString:r;function se(u){if(Dr(u)&&!Bt(u)&&!(u instanceof Wt)){if(u instanceof oi)return u;if(yr.call(u,"__wrapped__"))return Og(u)}return new oi(u)}i(se,"lodash"),o(se,"lodash");var nu=function(){function u(){}return i(u,"object"),o(u,"object"),function(h){if(!kr(h))return{};if(H2)return H2(h);u.prototype=h;var S=new u;return u.prototype=r,S}}();function af(){}i(af,"baseLodash"),o(af,"baseLodash");function oi(u,h){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!h,this.__index__=0,this.__values__=r}i(oi,"LodashWrapper"),o(oi,"LodashWrapper"),se.templateSettings={escape:lr,evaluate:dt,interpolate:at,variable:"",imports:{_:se}},se.prototype=af.prototype,se.prototype.constructor=se,oi.prototype=nu(af.prototype),oi.prototype.constructor=oi;function Wt(u){this.__wrapped__=u,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=A,this.__views__=[]}i(Wt,"LazyWrapper"),o(Wt,"LazyWrapper");function Z2(){var u=new Wt(this.__wrapped__);return u.__actions__=In(this.__actions__),u.__dir__=this.__dir__,u.__filtered__=this.__filtered__,u.__iteratees__=In(this.__iteratees__),u.__takeCount__=this.__takeCount__,u.__views__=In(this.__views__),u}i(Z2,"lazyClone"),o(Z2,"lazyClone");function J2(){if(this.__filtered__){var u=new Wt(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}i(J2,"lazyReverse"),o(J2,"lazyReverse");function Y2(){var u=this.__wrapped__.value(),h=this.__dir__,S=Bt(u),H=h<0,te=S?u.length:0,ce=f5(0,te,this.__views__),ye=ce.start,Ee=ce.end,xe=Ee-ye,Ue=H?Ee:ye-1,Fe=this.__iteratees__,$e=Fe.length,Ye=0,gt=vn(xe,this.__takeCount__);if(!S||!H&&te==xe&>==xe)return ng(u,this.__actions__);var Tt=[];e:for(;xe--&&Ye<gt;){Ue+=h;for(var $t=-1,At=u[Ue];++$t<$e;){var Kt=Fe[$t],Zt=Kt.iteratee,Kn=Kt.type,_n=Zt(At);if(Kn==b)At=_n;else if(!_n){if(Kn==T)continue e;break e}}Tt[Ye++]=At}return Tt}i(Y2,"lazyValue"),o(Y2,"lazyValue"),Wt.prototype=nu(af.prototype),Wt.prototype.constructor=Wt;function Vo(u){var h=-1,S=u==null?0:u.length;for(this.clear();++h<S;){var H=u[h];this.set(H[0],H[1])}}i(Vo,"Hash"),o(Vo,"Hash");function X2(){this.__data__=rf?rf(null):{},this.size=0}i(X2,"hashClear"),o(X2,"hashClear");function Q2(u){var h=this.has(u)&&delete this.__data__[u];return this.size-=h?1:0,h}i(Q2,"hashDelete"),o(Q2,"hashDelete");function ew(u){var h=this.__data__;if(rf){var S=h[u];return S===d?r:S}return yr.call(h,u)?h[u]:r}i(ew,"hashGet"),o(ew,"hashGet");function tw(u){var h=this.__data__;return rf?h[u]!==r:yr.call(h,u)}i(tw,"hashHas"),o(tw,"hashHas");function rw(u,h){var S=this.__data__;return this.size+=this.has(u)?0:1,S[u]=rf&&h===r?d:h,this}i(rw,"hashSet"),o(rw,"hashSet"),Vo.prototype.clear=X2,Vo.prototype.delete=Q2,Vo.prototype.get=ew,Vo.prototype.has=tw,Vo.prototype.set=rw;function Ma(u){var h=-1,S=u==null?0:u.length;for(this.clear();++h<S;){var H=u[h];this.set(H[0],H[1])}}i(Ma,"ListCache"),o(Ma,"ListCache");function nw(){this.__data__=[],this.size=0}i(nw,"listCacheClear"),o(nw,"listCacheClear");function iw(u){var h=this.__data__,S=of(h,u);if(S<0)return!1;var H=h.length-1;return S==H?h.pop():kh.call(h,S,1),--this.size,!0}i(iw,"listCacheDelete"),o(iw,"listCacheDelete");function aw(u){var h=this.__data__,S=of(h,u);return S<0?r:h[S][1]}i(aw,"listCacheGet"),o(aw,"listCacheGet");function ow(u){return of(this.__data__,u)>-1}i(ow,"listCacheHas"),o(ow,"listCacheHas");function sw(u,h){var S=this.__data__,H=of(S,u);return H<0?(++this.size,S.push([u,h])):S[H][1]=h,this}i(sw,"listCacheSet"),o(sw,"listCacheSet"),Ma.prototype.clear=nw,Ma.prototype.delete=iw,Ma.prototype.get=aw,Ma.prototype.has=ow,Ma.prototype.set=sw;function Ia(u){var h=-1,S=u==null?0:u.length;for(this.clear();++h<S;){var H=u[h];this.set(H[0],H[1])}}i(Ia,"MapCache"),o(Ia,"MapCache");function cw(){this.size=0,this.__data__={hash:new Vo,map:new(ef||Ma),string:new Vo}}i(cw,"mapCacheClear"),o(cw,"mapCacheClear");function uw(u){var h=yf(this,u).delete(u);return this.size-=h?1:0,h}i(uw,"mapCacheDelete"),o(uw,"mapCacheDelete");function lw(u){return yf(this,u).get(u)}i(lw,"mapCacheGet"),o(lw,"mapCacheGet");function fw(u){return yf(this,u).has(u)}i(fw,"mapCacheHas"),o(fw,"mapCacheHas");function dw(u,h){var S=yf(this,u),H=S.size;return S.set(u,h),this.size+=S.size==H?0:1,this}i(dw,"mapCacheSet"),o(dw,"mapCacheSet"),Ia.prototype.clear=cw,Ia.prototype.delete=uw,Ia.prototype.get=lw,Ia.prototype.has=fw,Ia.prototype.set=dw;function Ko(u){var h=-1,S=u==null?0:u.length;for(this.__data__=new Ia;++h<S;)this.add(u[h])}i(Ko,"SetCache"),o(Ko,"SetCache");function hw(u){return this.__data__.set(u,d),this}i(hw,"setCacheAdd"),o(hw,"setCacheAdd");function pw(u){return this.__data__.has(u)}i(pw,"setCacheHas"),o(pw,"setCacheHas"),Ko.prototype.add=Ko.prototype.push=hw,Ko.prototype.has=pw;function Ui(u){var h=this.__data__=new Ma(u);this.size=h.size}i(Ui,"Stack"),o(Ui,"Stack");function mw(){this.__data__=new Ma,this.size=0}i(mw,"stackClear"),o(mw,"stackClear");function gw(u){var h=this.__data__,S=h.delete(u);return this.size=h.size,S}i(gw,"stackDelete"),o(gw,"stackDelete");function vw(u){return this.__data__.get(u)}i(vw,"stackGet"),o(vw,"stackGet");function yw(u){return this.__data__.has(u)}i(yw,"stackHas"),o(yw,"stackHas");function bw(u,h){var S=this.__data__;if(S instanceof Ma){var H=S.__data__;if(!ef||H.length<a-1)return H.push([u,h]),this.size=++S.size,this;S=this.__data__=new Ia(H)}return S.set(u,h),this.size=S.size,this}i(bw,"stackSet"),o(bw,"stackSet"),Ui.prototype.clear=mw,Ui.prototype.delete=gw,Ui.prototype.get=vw,Ui.prototype.has=yw,Ui.prototype.set=bw;function B1(u,h){var S=Bt(u),H=!S&&Zs(u),te=!S&&!H&&Xo(u),ce=!S&&!H&&!te&&du(u),ye=S||H||te||ce,Ee=ye?wh(u.length,ZD):[],xe=Ee.length;for(var Ue in u)(h||yr.call(u,Ue))&&!(ye&&(Ue=="length"||te&&(Ue=="offset"||Ue=="parent")||ce&&(Ue=="buffer"||Ue=="byteLength"||Ue=="byteOffset")||Oa(Ue,xe)))&&Ee.push(Ue);return Ee}i(B1,"arrayLikeKeys"),o(B1,"arrayLikeKeys");function L1(u){var h=u.length;return h?u[Vh(0,h-1)]:r}i(L1,"arraySample"),o(L1,"arraySample");function ww(u,h){return wf(In(u),Go(h,0,u.length))}i(ww,"arraySampleSize"),o(ww,"arraySampleSize");function _w(u){return wf(In(u))}i(_w,"arrayShuffle"),o(_w,"arrayShuffle");function Bh(u,h,S){(S!==r&&!Fi(u[h],S)||S===r&&!(h in u))&&ka(u,h,S)}i(Bh,"assignMergeValue"),o(Bh,"assignMergeValue");function iu(u,h,S){var H=u[h];(!(yr.call(u,h)&&Fi(H,S))||S===r&&!(h in u))&&ka(u,h,S)}i(iu,"assignValue"),o(iu,"assignValue");function of(u,h){for(var S=u.length;S--;)if(Fi(u[S][0],h))return S;return-1}i(of,"assocIndexOf"),o(of,"assocIndexOf");function Ew(u,h,S,H){return Wo(u,function(te,ce,ye){h(H,te,S(te),ye)}),H}i(Ew,"baseAggregator"),o(Ew,"baseAggregator");function U1(u,h){return u&&Qi(h,Jr(h),u)}i(U1,"baseAssign"),o(U1,"baseAssign");function Aw(u,h){return u&&Qi(h,Dn(h),u)}i(Aw,"baseAssignIn"),o(Aw,"baseAssignIn");function ka(u,h,S){h=="__proto__"&&Dh?Dh(u,h,{configurable:!0,enumerable:!0,value:S,writable:!0}):u[h]=S}i(ka,"baseAssignValue"),o(ka,"baseAssignValue");function Lh(u,h){for(var S=-1,H=h.length,te=ke(H),ce=u==null;++S<H;)te[S]=ce?r:dp(u,h[S]);return te}i(Lh,"baseAt"),o(Lh,"baseAt");function Go(u,h,S){return u===u&&(S!==r&&(u=u<=S?u:S),h!==r&&(u=u>=h?u:h)),u}i(Go,"baseClamp"),o(Go,"baseClamp");function si(u,h,S,H,te,ce){var ye,Ee=h&v,xe=h&y,Ue=h&_;if(S&&(ye=te?S(u,H,te,ce):S(u)),ye!==r)return ye;if(!kr(u))return u;var Fe=Bt(u);if(Fe){if(ye=h5(u),!Ee)return In(u,ye)}else{var $e=bn(u),Ye=$e==ae||$e==fe;if(Xo(u))return ag(u,Ee);if($e==N||$e==j||Ye&&!te){if(ye=xe||Ye?{}:xg(u),!Ee)return xe?r5(u,Aw(ye,u)):t5(u,U1(ye,u))}else{if(!vr[$e])return te?u:{};ye=p5(u,$e,Ee)}}ce||(ce=new Ui);var gt=ce.get(u);if(gt)return gt;ce.set(u,ye),l_(u)?u.forEach(function(At){ye.add(si(At,h,S,At,u,ce))}):r_(u)&&u.forEach(function(At,Kt){ye.set(Kt,si(At,h,S,Kt,u,ce))});var Tt=Ue?xe?rp:tp:xe?Dn:Jr,$t=Fe?r:Tt(u);return ai($t||u,function(At,Kt){$t&&(Kt=At,At=u[Kt]),iu(ye,Kt,si(At,h,S,Kt,u,ce))}),ye}i(si,"baseClone"),o(si,"baseClone");function Sw(u){var h=Jr(u);return function(S){return F1(S,u,h)}}i(Sw,"baseConforms"),o(Sw,"baseConforms");function F1(u,h,S){var H=S.length;if(u==null)return!H;for(u=_r(u);H--;){var te=S[H],ce=h[te],ye=u[te];if(ye===r&&!(te in u)||!ce(ye))return!1}return!0}i(F1,"baseConformsTo"),o(F1,"baseConformsTo");function j1(u,h,S){if(typeof u!="function")throw new Li(c);return bf(function(){u.apply(r,S)},h)}i(j1,"baseDelay"),o(j1,"baseDelay");function au(u,h,S,H){var te=-1,ce=Jl,ye=!0,Ee=u.length,xe=[],Ue=h.length;if(!Ee)return xe;S&&(h=Mr(h,Hn(S))),H?(ce=ph,ye=!1):h.length>=a&&(ce=Qc,ye=!1,h=new Ko(h));e:for(;++te<Ee;){var Fe=u[te],$e=S==null?Fe:S(Fe);if(Fe=H||Fe!==0?Fe:0,ye&&$e===$e){for(var Ye=Ue;Ye--;)if(h[Ye]===$e)continue e;xe.push(Fe)}else ce(h,$e,H)||xe.push(Fe)}return xe}i(au,"baseDifference"),o(au,"baseDifference");var Wo=lg(Xi),xw=lg(Uh,!0);function Tw(u,h){var S=!0;return Wo(u,function(H,te,ce){return S=!!h(H,te,ce),S}),S}i(Tw,"baseEvery"),o(Tw,"baseEvery");function sf(u,h,S){for(var H=-1,te=u.length;++H<te;){var ce=u[H],ye=h(ce);if(ye!=null&&(Ee===r?ye===ye&&!Vn(ye):S(ye,Ee)))var Ee=ye,xe=ce}return xe}i(sf,"baseExtremum"),o(sf,"baseExtremum");function Cw(u,h,S,H){var te=u.length;for(S=Ft(S),S<0&&(S=-S>te?0:te+S),H=H===r||H>te?te:Ft(H),H<0&&(H+=te),H=S>H?0:ev(H);S<H;)u[S++]=h;return u}i(Cw,"baseFill"),o(Cw,"baseFill");function $1(u,h){var S=[];return Wo(u,function(H,te,ce){h(H,te,ce)&&S.push(H)}),S}i($1,"baseFilter"),o($1,"baseFilter");function Qr(u,h,S,H,te){var ce=-1,ye=u.length;for(S||(S=g5),te||(te=[]);++ce<ye;){var Ee=u[ce];h>0&&S(Ee)?h>1?Qr(Ee,h-1,S,H,te):co(te,Ee):H||(te[te.length]=Ee)}return te}i(Qr,"baseFlatten"),o(Qr,"baseFlatten");var z1=fg(),Mw=fg(!0);function Xi(u,h){return u&&z1(u,h,Jr)}i(Xi,"baseForOwn"),o(Xi,"baseForOwn");function Uh(u,h){return u&&Mw(u,h,Jr)}i(Uh,"baseForOwnRight"),o(Uh,"baseForOwnRight");function cf(u,h){return so(h,function(S){return Na(u[S])})}i(cf,"baseFunctions"),o(cf,"baseFunctions");function Zo(u,h){h=fo(h,u);for(var S=0,H=h.length;u!=null&&S<H;)u=u[ea(h[S++])];return S&&S==H?u:r}i(Zo,"baseGet"),o(Zo,"baseGet");function H1(u,h,S){var H=h(u);return Bt(u)?H:co(H,S(u))}i(H1,"baseGetAllKeys"),o(H1,"baseGetAllKeys");function yn(u){return u==null?u===r?De:X:Vs&&Vs in _r(u)?u5(u):E5(u)}i(yn,"baseGetTag"),o(yn,"baseGetTag");function Fh(u,h){return u>h}i(Fh,"baseGt"),o(Fh,"baseGt");function Iw(u,h){return u!=null&&yr.call(u,h)}i(Iw,"baseHas"),o(Iw,"baseHas");function kw(u,h){return u!=null&&h in _r(u)}i(kw,"baseHasIn"),o(kw,"baseHasIn");function Dw(u,h,S){return u>=vn(h,S)&&u<Zr(h,S)}i(Dw,"baseInRange"),o(Dw,"baseInRange");function jh(u,h,S){for(var H=S?ph:Jl,te=u[0].length,ce=u.length,ye=ce,Ee=ke(ce),xe=1/0,Ue=[];ye--;){var Fe=u[ye];ye&&h&&(Fe=Mr(Fe,Hn(h))),xe=vn(Fe.length,xe),Ee[ye]=!S&&(h||te>=120&&Fe.length>=120)?new Ko(ye&&Fe):r}Fe=u[0];var $e=-1,Ye=Ee[0];e:for(;++$e<te&&Ue.length<xe;){var gt=Fe[$e],Tt=h?h(gt):gt;if(gt=S||gt!==0?gt:0,!(Ye?Qc(Ye,Tt):H(Ue,Tt,S))){for(ye=ce;--ye;){var $t=Ee[ye];if(!($t?Qc($t,Tt):H(u[ye],Tt,S)))continue e}Ye&&Ye.push(Tt),Ue.push(gt)}}return Ue}i(jh,"baseIntersection"),o(jh,"baseIntersection");function Rw(u,h,S,H){return Xi(u,function(te,ce,ye){h(H,S(te),ce,ye)}),H}i(Rw,"baseInverter"),o(Rw,"baseInverter");function ou(u,h,S){h=fo(h,u),u=Ig(u,h);var H=u==null?u:u[ea(ui(h))];return H==null?r:zn(H,u,S)}i(ou,"baseInvoke"),o(ou,"baseInvoke");function q1(u){return Dr(u)&&yn(u)==j}i(q1,"baseIsArguments"),o(q1,"baseIsArguments");function Ow(u){return Dr(u)&&yn(u)==Ke}i(Ow,"baseIsArrayBuffer"),o(Ow,"baseIsArrayBuffer");function Nw(u){return Dr(u)&&yn(u)==oe}i(Nw,"baseIsDate"),o(Nw,"baseIsDate");function su(u,h,S,H,te){return u===h?!0:u==null||h==null||!Dr(u)&&!Dr(h)?u!==u&&h!==h:Pw(u,h,S,H,su,te)}i(su,"baseIsEqual"),o(su,"baseIsEqual");function Pw(u,h,S,H,te,ce){var ye=Bt(u),Ee=Bt(h),xe=ye?ge:bn(u),Ue=Ee?ge:bn(h);xe=xe==j?N:xe,Ue=Ue==j?N:Ue;var Fe=xe==N,$e=Ue==N,Ye=xe==Ue;if(Ye&&Xo(u)){if(!Xo(h))return!1;ye=!0,Fe=!1}if(Ye&&!Fe)return ce||(ce=new Ui),ye||du(u)?_g(u,h,S,H,te,ce):s5(u,h,xe,S,H,te,ce);if(!(S&x)){var gt=Fe&&yr.call(u,"__wrapped__"),Tt=$e&&yr.call(h,"__wrapped__");if(gt||Tt){var $t=gt?u.value():u,At=Tt?h.value():h;return ce||(ce=new Ui),te($t,At,S,H,ce)}}return Ye?(ce||(ce=new Ui),c5(u,h,S,H,te,ce)):!1}i(Pw,"baseIsEqualDeep"),o(Pw,"baseIsEqualDeep");function Bw(u){return Dr(u)&&bn(u)==be}i(Bw,"baseIsMap"),o(Bw,"baseIsMap");function $h(u,h,S,H){var te=S.length,ce=te,ye=!H;if(u==null)return!ce;for(u=_r(u);te--;){var Ee=S[te];if(ye&&Ee[2]?Ee[1]!==u[Ee[0]]:!(Ee[0]in u))return!1}for(;++te<ce;){Ee=S[te];var xe=Ee[0],Ue=u[xe],Fe=Ee[1];if(ye&&Ee[2]){if(Ue===r&&!(xe in u))return!1}else{var $e=new Ui;if(H)var Ye=H(Ue,Fe,xe,u,h,$e);if(!(Ye===r?su(Fe,Ue,x|O,H,$e):Ye))return!1}}return!0}i($h,"baseIsMatch"),o($h,"baseIsMatch");function V1(u){if(!kr(u)||y5(u))return!1;var h=Na(u)?eR:tr;return h.test(Yo(u))}i(V1,"baseIsNative"),o(V1,"baseIsNative");function Lw(u){return Dr(u)&&yn(u)==ie}i(Lw,"baseIsRegExp"),o(Lw,"baseIsRegExp");function Uw(u){return Dr(u)&&bn(u)==ee}i(Uw,"baseIsSet"),o(Uw,"baseIsSet");function Fw(u){return Dr(u)&&xf(u.length)&&!!wr[yn(u)]}i(Fw,"baseIsTypedArray"),o(Fw,"baseIsTypedArray");function K1(u){return typeof u=="function"?u:u==null?Rn:typeof u=="object"?Bt(u)?Z1(u[0],u[1]):W1(u):sv(u)}i(K1,"baseIteratee"),o(K1,"baseIteratee");function zh(u){if(!lu(u))return oR(u);var h=[];for(var S in _r(u))yr.call(u,S)&&S!="constructor"&&h.push(S);return h}i(zh,"baseKeys"),o(zh,"baseKeys");function jw(u){if(!kr(u))return _5(u);var h=lu(u),S=[];for(var H in u)H=="constructor"&&(h||!yr.call(u,H))||S.push(H);return S}i(jw,"baseKeysIn"),o(jw,"baseKeysIn");function Hh(u,h){return u<h}i(Hh,"baseLt"),o(Hh,"baseLt");function G1(u,h){var S=-1,H=kn(u)?ke(u.length):[];return Wo(u,function(te,ce,ye){H[++S]=h(te,ce,ye)}),H}i(G1,"baseMap"),o(G1,"baseMap");function W1(u){var h=np(u);return h.length==1&&h[0][2]?Cg(h[0][0],h[0][1]):function(S){return S===u||$h(S,u,h)}}i(W1,"baseMatches"),o(W1,"baseMatches");function Z1(u,h){return ip(u)&&Tg(h)?Cg(ea(u),h):function(S){var H=dp(S,u);return H===r&&H===h?hp(S,u):su(h,H,x|O)}}i(Z1,"baseMatchesProperty"),o(Z1,"baseMatchesProperty");function uf(u,h,S,H,te){u!==h&&z1(h,function(ce,ye){if(te||(te=new Ui),kr(ce))$w(u,h,ye,S,uf,H,te);else{var Ee=H?H(op(u,ye),ce,ye+"",u,h,te):r;Ee===r&&(Ee=ce),Bh(u,ye,Ee)}},Dn)}i(uf,"baseMerge"),o(uf,"baseMerge");function $w(u,h,S,H,te,ce,ye){var Ee=op(u,S),xe=op(h,S),Ue=ye.get(xe);if(Ue){Bh(u,S,Ue);return}var Fe=ce?ce(Ee,xe,S+"",u,h,ye):r,$e=Fe===r;if($e){var Ye=Bt(xe),gt=!Ye&&Xo(xe),Tt=!Ye&&!gt&&du(xe);Fe=xe,Ye||gt||Tt?Bt(Ee)?Fe=Ee:Pr(Ee)?Fe=In(Ee):gt?($e=!1,Fe=ag(xe,!0)):Tt?($e=!1,Fe=og(xe,!0)):Fe=[]:fu(xe)||Zs(xe)?(Fe=Ee,Zs(Ee)?Fe=tv(Ee):(!kr(Ee)||Na(Ee))&&(Fe=xg(xe))):$e=!1}$e&&(ye.set(xe,Fe),te(Fe,xe,H,ce,ye),ye.delete(xe)),Bh(u,S,Fe)}i($w,"baseMergeDeep"),o($w,"baseMergeDeep");function J1(u,h){var S=u.length;if(!!S)return h+=h<0?S:0,Oa(h,S)?u[h]:r}i(J1,"baseNth"),o(J1,"baseNth");function Y1(u,h,S){h.length?h=Mr(h,function(ce){return Bt(ce)?function(ye){return Zo(ye,ce.length===1?ce[0]:ce)}:ce}):h=[Rn];var H=-1;h=Mr(h,Hn(Et()));var te=G1(u,function(ce,ye,Ee){var xe=Mr(h,function(Ue){return Ue(ce)});return{criteria:xe,index:++H,value:ce}});return M2(te,function(ce,ye){return e5(ce,ye,S)})}i(Y1,"baseOrderBy"),o(Y1,"baseOrderBy");function zw(u,h){return X1(u,h,function(S,H){return hp(u,H)})}i(zw,"basePick"),o(zw,"basePick");function X1(u,h,S){for(var H=-1,te=h.length,ce={};++H<te;){var ye=h[H],Ee=Zo(u,ye);S(Ee,ye)&&cu(ce,fo(ye,u),Ee)}return ce}i(X1,"basePickBy"),o(X1,"basePickBy");function Hw(u){return function(h){return Zo(h,u)}}i(Hw,"basePropertyDeep"),o(Hw,"basePropertyDeep");function qh(u,h,S,H){var te=H?C2:zs,ce=-1,ye=h.length,Ee=u;for(u===h&&(h=In(h)),S&&(Ee=Mr(u,Hn(S)));++ce<ye;)for(var xe=0,Ue=h[ce],Fe=S?S(Ue):Ue;(xe=te(Ee,Fe,xe,H))>-1;)Ee!==u&&kh.call(Ee,xe,1),kh.call(u,xe,1);return u}i(qh,"basePullAll"),o(qh,"basePullAll");function Q1(u,h){for(var S=u?h.length:0,H=S-1;S--;){var te=h[S];if(S==H||te!==ce){var ce=te;Oa(te)?kh.call(u,te,1):Wh(u,te)}}return u}i(Q1,"basePullAt"),o(Q1,"basePullAt");function Vh(u,h){return u+Oh(G2()*(h-u+1))}i(Vh,"baseRandom"),o(Vh,"baseRandom");function qw(u,h,S,H){for(var te=-1,ce=Zr(Rh((h-u)/(S||1)),0),ye=ke(ce);ce--;)ye[H?ce:++te]=u,u+=S;return ye}i(qw,"baseRange"),o(qw,"baseRange");function Kh(u,h){var S="";if(!u||h<1||h>E)return S;do h%2&&(S+=u),h=Oh(h/2),h&&(u+=u);while(h);return S}i(Kh,"baseRepeat"),o(Kh,"baseRepeat");function Ht(u,h){return kg(Mg(u,h,Rn),u+"")}i(Ht,"baseRest"),o(Ht,"baseRest");function Vw(u){return L1(Js(u))}i(Vw,"baseSample"),o(Vw,"baseSample");function Kw(u,h){var S=Js(u);return wf(S,Go(h,0,S.length))}i(Kw,"baseSampleSize"),o(Kw,"baseSampleSize");function cu(u,h,S,H){if(!kr(u))return u;h=fo(h,u);for(var te=-1,ce=h.length,ye=ce-1,Ee=u;Ee!=null&&++te<ce;){var xe=ea(h[te]),Ue=S;if(xe==="__proto__"||xe==="constructor"||xe==="prototype")return u;if(te!=ye){var Fe=Ee[xe];Ue=H?H(Fe,xe,Ee):r,Ue===r&&(Ue=kr(Fe)?Fe:Oa(h[te+1])?[]:{})}iu(Ee,xe,Ue),Ee=Ee[xe]}return u}i(cu,"baseSet"),o(cu,"baseSet");var Gw=Nh?function(u,h){return Nh.set(u,h),u}:Rn,mR=Dh?function(u,h){return Dh(u,"toString",{configurable:!0,enumerable:!1,value:pp(h),writable:!0})}:Rn;function Ww(u){return wf(Js(u))}i(Ww,"baseShuffle"),o(Ww,"baseShuffle");function ci(u,h,S){var H=-1,te=u.length;h<0&&(h=-h>te?0:te+h),S=S>te?te:S,S<0&&(S+=te),te=h>S?0:S-h>>>0,h>>>=0;for(var ce=ke(te);++H<te;)ce[H]=u[H+h];return ce}i(ci,"baseSlice"),o(ci,"baseSlice");function Zw(u,h){var S;return Wo(u,function(H,te,ce){return S=h(H,te,ce),!S}),!!S}i(Zw,"baseSome"),o(Zw,"baseSome");function lf(u,h,S){var H=0,te=u==null?H:u.length;if(typeof h=="number"&&h===h&&te<=V){for(;H<te;){var ce=H+te>>>1,ye=u[ce];ye!==null&&!Vn(ye)&&(S?ye<=h:ye<h)?H=ce+1:te=ce}return te}return Gh(u,h,Rn,S)}i(lf,"baseSortedIndex"),o(lf,"baseSortedIndex");function Gh(u,h,S,H){var te=0,ce=u==null?0:u.length;if(ce===0)return 0;h=S(h);for(var ye=h!==h,Ee=h===null,xe=Vn(h),Ue=h===r;te<ce;){var Fe=Oh((te+ce)/2),$e=S(u[Fe]),Ye=$e!==r,gt=$e===null,Tt=$e===$e,$t=Vn($e);if(ye)var At=H||Tt;else Ue?At=Tt&&(H||Ye):Ee?At=Tt&&Ye&&(H||!gt):xe?At=Tt&&Ye&&!gt&&(H||!$t):gt||$t?At=!1:At=H?$e<=h:$e<h;At?te=Fe+1:ce=Fe}return vn(ce,U)}i(Gh,"baseSortedIndexBy"),o(Gh,"baseSortedIndexBy");function eg(u,h){for(var S=-1,H=u.length,te=0,ce=[];++S<H;){var ye=u[S],Ee=h?h(ye):ye;if(!S||!Fi(Ee,xe)){var xe=Ee;ce[te++]=ye===0?0:ye}}return ce}i(eg,"baseSortedUniq"),o(eg,"baseSortedUniq");function tg(u){return typeof u=="number"?u:Vn(u)?C:+u}i(tg,"baseToNumber"),o(tg,"baseToNumber");function qn(u){if(typeof u=="string")return u;if(Bt(u))return Mr(u,qn)+"";if(Vn(u))return W2?W2.call(u):"";var h=u+"";return h=="0"&&1/u==-m?"-0":h}i(qn,"baseToString"),o(qn,"baseToString");function lo(u,h,S){var H=-1,te=Jl,ce=u.length,ye=!0,Ee=[],xe=Ee;if(S)ye=!1,te=ph;else if(ce>=a){var Ue=h?null:vR(u);if(Ue)return Xl(Ue);ye=!1,te=Qc,xe=new Ko}else xe=h?[]:Ee;e:for(;++H<ce;){var Fe=u[H],$e=h?h(Fe):Fe;if(Fe=S||Fe!==0?Fe:0,ye&&$e===$e){for(var Ye=xe.length;Ye--;)if(xe[Ye]===$e)continue e;h&&xe.push($e),Ee.push(Fe)}else te(xe,$e,S)||(xe!==Ee&&xe.push($e),Ee.push(Fe))}return Ee}i(lo,"baseUniq"),o(lo,"baseUniq");function Wh(u,h){return h=fo(h,u),u=Ig(u,h),u==null||delete u[ea(ui(h))]}i(Wh,"baseUnset"),o(Wh,"baseUnset");function rg(u,h,S,H){return cu(u,h,S(Zo(u,h)),H)}i(rg,"baseUpdate"),o(rg,"baseUpdate");function ff(u,h,S,H){for(var te=u.length,ce=H?te:-1;(H?ce--:++ce<te)&&h(u[ce],ce,u););return S?ci(u,H?0:ce,H?ce+1:te):ci(u,H?ce+1:0,H?te:ce)}i(ff,"baseWhile"),o(ff,"baseWhile");function ng(u,h){var S=u;return S instanceof Wt&&(S=S.value()),mh(h,function(H,te){return te.func.apply(te.thisArg,co([H],te.args))},S)}i(ng,"baseWrapperValue"),o(ng,"baseWrapperValue");function Zh(u,h,S){var H=u.length;if(H<2)return H?lo(u[0]):[];for(var te=-1,ce=ke(H);++te<H;)for(var ye=u[te],Ee=-1;++Ee<H;)Ee!=te&&(ce[te]=au(ce[te]||ye,u[Ee],h,S));return lo(Qr(ce,1),h,S)}i(Zh,"baseXor"),o(Zh,"baseXor");function ig(u,h,S){for(var H=-1,te=u.length,ce=h.length,ye={};++H<te;){var Ee=H<ce?h[H]:r;S(ye,u[H],Ee)}return ye}i(ig,"baseZipObject"),o(ig,"baseZipObject");function Jh(u){return Pr(u)?u:[]}i(Jh,"castArrayLikeObject"),o(Jh,"castArrayLikeObject");function Yh(u){return typeof u=="function"?u:Rn}i(Yh,"castFunction"),o(Yh,"castFunction");function fo(u,h){return Bt(u)?u:ip(u,h)?[u]:x5(dr(u))}i(fo,"castPath"),o(fo,"castPath");var gR=Ht;function ho(u,h,S){var H=u.length;return S=S===r?H:S,!h&&S>=H?u:ci(u,h,S)}i(ho,"castSlice"),o(ho,"castSlice");var Jw=tR||function(u){return Fr.clearTimeout(u)};function ag(u,h){if(h)return u.slice();var S=u.length,H=z2?z2(S):new u.constructor(S);return u.copy(H),H}i(ag,"cloneBuffer"),o(ag,"cloneBuffer");function Xh(u){var h=new u.constructor(u.byteLength);return new Mh(h).set(new Mh(u)),h}i(Xh,"cloneArrayBuffer"),o(Xh,"cloneArrayBuffer");function Yw(u,h){var S=h?Xh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.byteLength)}i(Yw,"cloneDataView"),o(Yw,"cloneDataView");function Xw(u){var h=new u.constructor(u.source,yt.exec(u));return h.lastIndex=u.lastIndex,h}i(Xw,"cloneRegExp"),o(Xw,"cloneRegExp");function Qw(u){return nf?_r(nf.call(u)):{}}i(Qw,"cloneSymbol"),o(Qw,"cloneSymbol");function og(u,h){var S=h?Xh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.length)}i(og,"cloneTypedArray"),o(og,"cloneTypedArray");function sg(u,h){if(u!==h){var S=u!==r,H=u===null,te=u===u,ce=Vn(u),ye=h!==r,Ee=h===null,xe=h===h,Ue=Vn(h);if(!Ee&&!Ue&&!ce&&u>h||ce&&ye&&xe&&!Ee&&!Ue||H&&ye&&xe||!S&&xe||!te)return 1;if(!H&&!ce&&!Ue&&u<h||Ue&&S&&te&&!H&&!ce||Ee&&S&&te||!ye&&te||!xe)return-1}return 0}i(sg,"compareAscending"),o(sg,"compareAscending");function e5(u,h,S){for(var H=-1,te=u.criteria,ce=h.criteria,ye=te.length,Ee=S.length;++H<ye;){var xe=sg(te[H],ce[H]);if(xe){if(H>=Ee)return xe;var Ue=S[H];return xe*(Ue=="desc"?-1:1)}}return u.index-h.index}i(e5,"compareMultiple"),o(e5,"compareMultiple");function cg(u,h,S,H){for(var te=-1,ce=u.length,ye=S.length,Ee=-1,xe=h.length,Ue=Zr(ce-ye,0),Fe=ke(xe+Ue),$e=!H;++Ee<xe;)Fe[Ee]=h[Ee];for(;++te<ye;)($e||te<ce)&&(Fe[S[te]]=u[te]);for(;Ue--;)Fe[Ee++]=u[te++];return Fe}i(cg,"composeArgs"),o(cg,"composeArgs");function ug(u,h,S,H){for(var te=-1,ce=u.length,ye=-1,Ee=S.length,xe=-1,Ue=h.length,Fe=Zr(ce-Ee,0),$e=ke(Fe+Ue),Ye=!H;++te<Fe;)$e[te]=u[te];for(var gt=te;++xe<Ue;)$e[gt+xe]=h[xe];for(;++ye<Ee;)(Ye||te<ce)&&($e[gt+S[ye]]=u[te++]);return $e}i(ug,"composeArgsRight"),o(ug,"composeArgsRight");function In(u,h){var S=-1,H=u.length;for(h||(h=ke(H));++S<H;)h[S]=u[S];return h}i(In,"copyArray"),o(In,"copyArray");function Qi(u,h,S,H){var te=!S;S||(S={});for(var ce=-1,ye=h.length;++ce<ye;){var Ee=h[ce],xe=H?H(S[Ee],u[Ee],Ee,S,u):r;xe===r&&(xe=u[Ee]),te?ka(S,Ee,xe):iu(S,Ee,xe)}return S}i(Qi,"copyObject"),o(Qi,"copyObject");function t5(u,h){return Qi(u,Ag(u),h)}i(t5,"copySymbols"),o(t5,"copySymbols");function r5(u,h){return Qi(u,l5(u),h)}i(r5,"copySymbolsIn"),o(r5,"copySymbolsIn");function df(u,h){return function(S,H){var te=Bt(S)?E2:Ew,ce=h?h():{};return te(S,u,Et(H,2),ce)}}i(df,"createAggregator"),o(df,"createAggregator");function Ks(u){return Ht(function(h,S){var H=-1,te=S.length,ce=te>1?S[te-1]:r,ye=te>2?S[2]:r;for(ce=u.length>3&&typeof ce=="function"?(te--,ce):r,ye&&wn(S[0],S[1],ye)&&(ce=te<3?r:ce,te=1),h=_r(h);++H<te;){var Ee=S[H];Ee&&u(h,Ee,H,ce)}return h})}i(Ks,"createAssigner"),o(Ks,"createAssigner");function lg(u,h){return function(S,H){if(S==null)return S;if(!kn(S))return u(S,H);for(var te=S.length,ce=h?te:-1,ye=_r(S);(h?ce--:++ce<te)&&H(ye[ce],ce,ye)!==!1;);return S}}i(lg,"createBaseEach"),o(lg,"createBaseEach");function fg(u){return function(h,S,H){for(var te=-1,ce=_r(h),ye=H(h),Ee=ye.length;Ee--;){var xe=ye[u?Ee:++te];if(S(ce[xe],xe,ce)===!1)break}return h}}i(fg,"createBaseFor"),o(fg,"createBaseFor");function n5(u,h,S){var H=h&D,te=uu(u);function ce(){var ye=this&&this!==Fr&&this instanceof ce?te:u;return ye.apply(H?S:this,arguments)}return i(ce,"wrapper"),o(ce,"wrapper"),ce}i(n5,"createBind"),o(n5,"createBind");function dg(u){return function(h){h=dr(h);var S=Hs(h)?Bi(h):r,H=S?S[0]:h.charAt(0),te=S?ho(S,1).join(""):h.slice(1);return H[u]()+te}}i(dg,"createCaseFirst"),o(dg,"createCaseFirst");function Gs(u){return function(h){return mh(ov(iv(h).replace(Kl,"")),u,"")}}i(Gs,"createCompounder"),o(Gs,"createCompounder");function uu(u){return function(){var h=arguments;switch(h.length){case 0:return new u;case 1:return new u(h[0]);case 2:return new u(h[0],h[1]);case 3:return new u(h[0],h[1],h[2]);case 4:return new u(h[0],h[1],h[2],h[3]);case 5:return new u(h[0],h[1],h[2],h[3],h[4]);case 6:return new u(h[0],h[1],h[2],h[3],h[4],h[5]);case 7:return new u(h[0],h[1],h[2],h[3],h[4],h[5],h[6])}var S=nu(u.prototype),H=u.apply(S,h);return kr(H)?H:S}}i(uu,"createCtor"),o(uu,"createCtor");function i5(u,h,S){var H=uu(u);function te(){for(var ce=arguments.length,ye=ke(ce),Ee=ce,xe=Ws(te);Ee--;)ye[Ee]=arguments[Ee];var Ue=ce<3&&ye[0]!==xe&&ye[ce-1]!==xe?[]:uo(ye,xe);if(ce-=Ue.length,ce<S)return vg(u,h,hf,te.placeholder,r,ye,Ue,r,r,S-ce);var Fe=this&&this!==Fr&&this instanceof te?H:u;return zn(Fe,this,ye)}return i(te,"wrapper"),o(te,"wrapper"),te}i(i5,"createCurry"),o(i5,"createCurry");function hg(u){return function(h,S,H){var te=_r(h);if(!kn(h)){var ce=Et(S,3);h=Jr(h),S=o(function(Ee){return ce(te[Ee],Ee,te)},"predicate")}var ye=u(h,S,H);return ye>-1?te[ce?h[ye]:ye]:r}}i(hg,"createFind"),o(hg,"createFind");function pg(u){return Ra(function(h){var S=h.length,H=S,te=oi.prototype.thru;for(u&&h.reverse();H--;){var ce=h[H];if(typeof ce!="function")throw new Li(c);if(te&&!ye&&vf(ce)=="wrapper")var ye=new oi([],!0)}for(H=ye?H:S;++H<S;){ce=h[H];var Ee=vf(ce),xe=Ee=="wrapper"?Eg(ce):r;xe&&ap(xe[0])&&xe[1]==(k|z|Q|K)&&!xe[4].length&&xe[9]==1?ye=ye[vf(xe[0])].apply(ye,xe[3]):ye=ce.length==1&&ap(ce)?ye[Ee]():ye.thru(ce)}return function(){var Ue=arguments,Fe=Ue[0];if(ye&&Ue.length==1&&Bt(Fe))return ye.plant(Fe).value();for(var $e=0,Ye=S?h[$e].apply(this,Ue):Fe;++$e<S;)Ye=h[$e].call(this,Ye);return Ye}})}i(pg,"createFlow"),o(pg,"createFlow");function hf(u,h,S,H,te,ce,ye,Ee,xe,Ue){var Fe=h&k,$e=h&D,Ye=h&L,gt=h&(z|q),Tt=h&he,$t=Ye?r:uu(u);function At(){for(var Kt=arguments.length,Zt=ke(Kt),Kn=Kt;Kn--;)Zt[Kn]=arguments[Kn];if(gt)var _n=Ws(At),Gn=k2(Zt,_n);if(H&&(Zt=cg(Zt,H,te,gt)),ce&&(Zt=ug(Zt,ce,ye,gt)),Kt-=Gn,gt&&Kt<Ue){var jr=uo(Zt,_n);return vg(u,h,hf,At.placeholder,S,Zt,jr,Ee,xe,Ue-Kt)}var ta=$e?S:this,po=Ye?ta[u]:u;return Kt=Zt.length,Ee?Zt=A5(Zt,Ee):Tt&&Kt>1&&Zt.reverse(),Fe&&xe<Kt&&(Zt.length=xe),this&&this!==Fr&&this instanceof At&&(po=$t||uu(po)),po.apply(ta,Zt)}return i(At,"wrapper"),o(At,"wrapper"),At}i(hf,"createHybrid"),o(hf,"createHybrid");function mg(u,h){return function(S,H){return Rw(S,u,h(H),{})}}i(mg,"createInverter"),o(mg,"createInverter");function pf(u,h){return function(S,H){var te;if(S===r&&H===r)return h;if(S!==r&&(te=S),H!==r){if(te===r)return H;typeof S=="string"||typeof H=="string"?(S=qn(S),H=qn(H)):(S=tg(S),H=tg(H)),te=u(S,H)}return te}}i(pf,"createMathOperation"),o(pf,"createMathOperation");function Qh(u){return Ra(function(h){return h=Mr(h,Hn(Et())),Ht(function(S){var H=this;return u(h,function(te){return zn(te,H,S)})})})}i(Qh,"createOver"),o(Qh,"createOver");function mf(u,h){h=h===r?" ":qn(h);var S=h.length;if(S<2)return S?Kh(h,u):h;var H=Kh(h,Rh(u/qs(h)));return Hs(h)?ho(Bi(H),0,u).join(""):H.slice(0,u)}i(mf,"createPadding"),o(mf,"createPadding");function a5(u,h,S,H){var te=h&D,ce=uu(u);function ye(){for(var Ee=-1,xe=arguments.length,Ue=-1,Fe=H.length,$e=ke(Fe+xe),Ye=this&&this!==Fr&&this instanceof ye?ce:u;++Ue<Fe;)$e[Ue]=H[Ue];for(;xe--;)$e[Ue++]=arguments[++Ee];return zn(Ye,te?S:this,$e)}return i(ye,"wrapper"),o(ye,"wrapper"),ye}i(a5,"createPartial"),o(a5,"createPartial");function gg(u){return function(h,S,H){return H&&typeof H!="number"&&wn(h,S,H)&&(S=H=r),h=Pa(h),S===r?(S=h,h=0):S=Pa(S),H=H===r?h<S?1:-1:Pa(H),qw(h,S,H,u)}}i(gg,"createRange"),o(gg,"createRange");function gf(u){return function(h,S){return typeof h=="string"&&typeof S=="string"||(h=li(h),S=li(S)),u(h,S)}}i(gf,"createRelationalOperation"),o(gf,"createRelationalOperation");function vg(u,h,S,H,te,ce,ye,Ee,xe,Ue){var Fe=h&z,$e=Fe?ye:r,Ye=Fe?r:ye,gt=Fe?ce:r,Tt=Fe?r:ce;h|=Fe?Q:Y,h&=~(Fe?Y:Q),h&Z||(h&=~(D|L));var $t=[u,h,te,gt,$e,Tt,Ye,Ee,xe,Ue],At=S.apply(r,$t);return ap(u)&&S5(At,$t),At.placeholder=H,Dg(At,u,h)}i(vg,"createRecurry"),o(vg,"createRecurry");function ep(u){var h=Wr[u];return function(S,H){if(S=li(S),H=H==null?0:vn(Ft(H),292),H&&K2(S)){var te=(dr(S)+"e").split("e"),ce=h(te[0]+"e"+(+te[1]+H));return te=(dr(ce)+"e").split("e"),+(te[0]+"e"+(+te[1]-H))}return h(S)}}i(ep,"createRound"),o(ep,"createRound");var vR=tu&&1/Xl(new tu([,-0]))[1]==m?function(u){return new tu(u)}:vp;function yg(u){return function(h){var S=bn(h);return S==be?Eh(h):S==ee?P2(h):I2(h,u(h))}}i(yg,"createToPairs"),o(yg,"createToPairs");function Da(u,h,S,H,te,ce,ye,Ee){var xe=h&L;if(!xe&&typeof u!="function")throw new Li(c);var Ue=H?H.length:0;if(Ue||(h&=~(Q|Y),H=te=r),ye=ye===r?ye:Zr(Ft(ye),0),Ee=Ee===r?Ee:Ft(Ee),Ue-=te?te.length:0,h&Y){var Fe=H,$e=te;H=te=r}var Ye=xe?r:Eg(u),gt=[u,h,S,H,te,Fe,$e,ce,ye,Ee];if(Ye&&w5(gt,Ye),u=gt[0],h=gt[1],S=gt[2],H=gt[3],te=gt[4],Ee=gt[9]=gt[9]===r?xe?0:u.length:Zr(gt[9]-Ue,0),!Ee&&h&(z|q)&&(h&=~(z|q)),!h||h==D)var Tt=n5(u,h,S);else h==z||h==q?Tt=i5(u,h,Ee):(h==Q||h==(D|Q))&&!te.length?Tt=a5(u,h,S,H):Tt=hf.apply(r,gt);var $t=Ye?Gw:S5;return Dg($t(Tt,gt),u,h)}i(Da,"createWrap"),o(Da,"createWrap");function bg(u,h,S,H){return u===r||Fi(u,eu[S])&&!yr.call(H,S)?h:u}i(bg,"customDefaultsAssignIn"),o(bg,"customDefaultsAssignIn");function wg(u,h,S,H,te,ce){return kr(u)&&kr(h)&&(ce.set(h,u),uf(u,h,r,wg,ce),ce.delete(h)),u}i(wg,"customDefaultsMerge"),o(wg,"customDefaultsMerge");function o5(u){return fu(u)?r:u}i(o5,"customOmitClone"),o(o5,"customOmitClone");function _g(u,h,S,H,te,ce){var ye=S&x,Ee=u.length,xe=h.length;if(Ee!=xe&&!(ye&&xe>Ee))return!1;var Ue=ce.get(u),Fe=ce.get(h);if(Ue&&Fe)return Ue==h&&Fe==u;var $e=-1,Ye=!0,gt=S&O?new Ko:r;for(ce.set(u,h),ce.set(h,u);++$e<Ee;){var Tt=u[$e],$t=h[$e];if(H)var At=ye?H($t,Tt,$e,h,u,ce):H(Tt,$t,$e,u,h,ce);if(At!==r){if(At)continue;Ye=!1;break}if(gt){if(!gh(h,function(Kt,Zt){if(!Qc(gt,Zt)&&(Tt===Kt||te(Tt,Kt,S,H,ce)))return gt.push(Zt)})){Ye=!1;break}}else if(!(Tt===$t||te(Tt,$t,S,H,ce))){Ye=!1;break}}return ce.delete(u),ce.delete(h),Ye}i(_g,"equalArrays"),o(_g,"equalArrays");function s5(u,h,S,H,te,ce,ye){switch(S){case ve:if(u.byteLength!=h.byteLength||u.byteOffset!=h.byteOffset)return!1;u=u.buffer,h=h.buffer;case Ke:return!(u.byteLength!=h.byteLength||!ce(new Mh(u),new Mh(h)));case ne:case oe:case Re:return Fi(+u,+h);case G:return u.name==h.name&&u.message==h.message;case ie:case ue:return u==h+"";case be:var Ee=Eh;case ee:var xe=H&x;if(Ee||(Ee=Xl),u.size!=h.size&&!xe)return!1;var Ue=ye.get(u);if(Ue)return Ue==h;H|=O,ye.set(u,h);var Fe=_g(Ee(u),Ee(h),H,te,ce,ye);return ye.delete(u),Fe;case Ae:if(nf)return nf.call(u)==nf.call(h)}return!1}i(s5,"equalByTag"),o(s5,"equalByTag");function c5(u,h,S,H,te,ce){var ye=S&x,Ee=tp(u),xe=Ee.length,Ue=tp(h),Fe=Ue.length;if(xe!=Fe&&!ye)return!1;for(var $e=xe;$e--;){var Ye=Ee[$e];if(!(ye?Ye in h:yr.call(h,Ye)))return!1}var gt=ce.get(u),Tt=ce.get(h);if(gt&&Tt)return gt==h&&Tt==u;var $t=!0;ce.set(u,h),ce.set(h,u);for(var At=ye;++$e<xe;){Ye=Ee[$e];var Kt=u[Ye],Zt=h[Ye];if(H)var Kn=ye?H(Zt,Kt,Ye,h,u,ce):H(Kt,Zt,Ye,u,h,ce);if(!(Kn===r?Kt===Zt||te(Kt,Zt,S,H,ce):Kn)){$t=!1;break}At||(At=Ye=="constructor")}if($t&&!At){var _n=u.constructor,Gn=h.constructor;_n!=Gn&&"constructor"in u&&"constructor"in h&&!(typeof _n=="function"&&_n instanceof _n&&typeof Gn=="function"&&Gn instanceof Gn)&&($t=!1)}return ce.delete(u),ce.delete(h),$t}i(c5,"equalObjects"),o(c5,"equalObjects");function Ra(u){return kg(Mg(u,r,Bg),u+"")}i(Ra,"flatRest"),o(Ra,"flatRest");function tp(u){return H1(u,Jr,Ag)}i(tp,"getAllKeys"),o(tp,"getAllKeys");function rp(u){return H1(u,Dn,l5)}i(rp,"getAllKeysIn"),o(rp,"getAllKeysIn");var Eg=Nh?function(u){return Nh.get(u)}:vp;function vf(u){for(var h=u.name+"",S=ru[h],H=yr.call(ru,h)?S.length:0;H--;){var te=S[H],ce=te.func;if(ce==null||ce==u)return te.name}return h}i(vf,"getFuncName"),o(vf,"getFuncName");function Ws(u){var h=yr.call(se,"placeholder")?se:u;return h.placeholder}i(Ws,"getHolder"),o(Ws,"getHolder");function Et(){var u=se.iteratee||mp;return u=u===mp?K1:u,arguments.length?u(arguments[0],arguments[1]):u}i(Et,"getIteratee"),o(Et,"getIteratee");function yf(u,h){var S=u.__data__;return v5(h)?S[typeof h=="string"?"string":"hash"]:S.map}i(yf,"getMapData"),o(yf,"getMapData");function np(u){for(var h=Jr(u),S=h.length;S--;){var H=h[S],te=u[H];h[S]=[H,te,Tg(te)]}return h}i(np,"getMatchData"),o(np,"getMatchData");function Jo(u,h){var S=R2(u,h);return V1(S)?S:r}i(Jo,"getNative"),o(Jo,"getNative");function u5(u){var h=yr.call(u,Vs),S=u[Vs];try{u[Vs]=r;var H=!0}catch{}var te=Th.call(u);return H&&(h?u[Vs]=S:delete u[Vs]),te}i(u5,"getRawTag"),o(u5,"getRawTag");var Ag=O1?function(u){return u==null?[]:(u=_r(u),so(O1(u),function(h){return q2.call(u,h)}))}:yp,l5=O1?function(u){for(var h=[];u;)co(h,Ag(u)),u=Ih(u);return h}:yp,bn=yn;(N1&&bn(new N1(new ArrayBuffer(1)))!=ve||ef&&bn(new ef)!=be||P1&&bn(P1.resolve())!=$||tu&&bn(new tu)!=ee||tf&&bn(new tf)!=Ie)&&(bn=o(function(u){var h=yn(u),S=h==N?u.constructor:r,H=S?Yo(S):"";if(H)switch(H){case lR:return ve;case fR:return be;case dR:return $;case hR:return ee;case pR:return Ie}return h},"getTag"));function f5(u,h,S){for(var H=-1,te=S.length;++H<te;){var ce=S[H],ye=ce.size;switch(ce.type){case"drop":u+=ye;break;case"dropRight":h-=ye;break;case"take":h=vn(h,u+ye);break;case"takeRight":u=Zr(u,h-ye);break}}return{start:u,end:h}}i(f5,"getView"),o(f5,"getView");function d5(u){var h=u.match(Je);return h?h[1].split(cr):[]}i(d5,"getWrapDetails"),o(d5,"getWrapDetails");function Sg(u,h,S){h=fo(h,u);for(var H=-1,te=h.length,ce=!1;++H<te;){var ye=ea(h[H]);if(!(ce=u!=null&&S(u,ye)))break;u=u[ye]}return ce||++H!=te?ce:(te=u==null?0:u.length,!!te&&xf(te)&&Oa(ye,te)&&(Bt(u)||Zs(u)))}i(Sg,"hasPath"),o(Sg,"hasPath");function h5(u){var h=u.length,S=new u.constructor(h);return h&&typeof u[0]=="string"&&yr.call(u,"index")&&(S.index=u.index,S.input=u.input),S}i(h5,"initCloneArray"),o(h5,"initCloneArray");function xg(u){return typeof u.constructor=="function"&&!lu(u)?nu(Ih(u)):{}}i(xg,"initCloneObject"),o(xg,"initCloneObject");function p5(u,h,S){var H=u.constructor;switch(h){case Ke:return Xh(u);case ne:case oe:return new H(+u);case ve:return Yw(u,S);case pe:case re:case le:case _e:case Te:case Ce:case Oe:case Dt:case Ge:return og(u,S);case be:return new H;case Re:case ue:return new H(u);case ie:return Xw(u);case ee:return new H;case Ae:return Qw(u)}}i(p5,"initCloneByTag"),o(p5,"initCloneByTag");function m5(u,h){var S=h.length;if(!S)return u;var H=S-1;return h[H]=(S>1?"& ":"")+h[H],h=h.join(S>2?", ":" "),u.replace(ct,`{
|
|
24
|
+
`):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function Ty(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(Ty,"arrRemove");var b0=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,a,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=xy(c),d=l.next();!d.done;d=l.next()){var p=d.value;p.remove(this)}}catch(O){t={error:O}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var g=this.initialTeardown;if(Hi(g))try{g()}catch(O){s=O instanceof y0?O.errors:[O]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var y=xy(v),_=y.next();!_.done;_=y.next()){var x=_.value;try{kA(x)}catch(O){s=s??[],O instanceof y0?s=Nu(Nu([],Ou(s)),Ou(O.errors)):s.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(a=y.return)&&a.call(y)}finally{if(n)throw n.error}}}if(s)throw new y0(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)kA(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ty(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ty(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var jJ=b0.EMPTY;function w0(e){return e instanceof b0||e&&"closed"in e&&Hi(e.remove)&&Hi(e.add)&&Hi(e.unsubscribe)}i(w0,"isSubscription");function kA(e){Hi(e)?e():e.unsubscribe()}i(kA,"execFinalizer");var oa={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Pu={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=Pu.delegate;return a?.setTimeout?a.setTimeout.apply(a,Nu([e,t],Ou(r))):setTimeout.apply(void 0,Nu([e,t],Ou(r)))},clearTimeout:function(e){var t=Pu.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function DA(e){Pu.setTimeout(function(){var t=oa.onUnhandledError;if(t)t(e);else throw e})}i(DA,"reportUnhandledError");function Cy(){}i(Cy,"noop");var RA=function(){return My("C",void 0,void 0)}();function OA(e){return My("E",void 0,e)}i(OA,"errorNotification");function NA(e){return My("N",e,void 0)}i(NA,"nextNotification");function My(e,t,r){return{kind:e,value:t,error:r}}i(My,"createNotification");var fc=null;function PA(e){if(oa.useDeprecatedSynchronousErrorHandling){var t=!fc;if(t&&(fc={errorThrown:!1,error:null}),e(),t){var r=fc,n=r.errorThrown,a=r.error;if(fc=null,n)throw a}}else e()}i(PA,"errorContext");function BA(e){oa.useDeprecatedSynchronousErrorHandling&&fc&&(fc.errorThrown=!0,fc.error=e)}i(BA,"captureError");var Dy=function(e){Sy(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,w0(r)&&r.add(n)):n.destination=IU,n}return i(t,"Subscriber"),t.create=function(r,n,a){return new E0(r,n,a)},t.prototype.next=function(r){this.isStopped?ky(NA(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?ky(OA(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?ky(RA,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(b0);var TU=Function.prototype.bind;function Iy(e,t){return TU.call(e,t)}i(Iy,"bind");var CU=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver"),e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){_0(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){_0(n)}else _0(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){_0(r)}},e}(),E0=function(e){Sy(t,e);function t(r,n,a){var s=e.call(this)||this,c;if(Hi(r)||!r)c={next:r??void 0,error:n??void 0,complete:a??void 0};else{var l;s&&oa.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&Iy(r.next,l),error:r.error&&Iy(r.error,l),complete:r.complete&&Iy(r.complete,l)}):c=r}return s.destination=new CU(c),s}return i(t,"SafeSubscriber"),t}(Dy);function _0(e){oa.useDeprecatedSynchronousErrorHandling?BA(e):DA(e)}i(_0,"handleUnhandledError");function MU(e){throw e}i(MU,"defaultErrorHandler");function ky(e,t){var r=oa.onStoppedNotification;r&&Pu.setTimeout(function(){return r(e,t)})}i(ky,"handleStoppedNotification");var IU={closed:!0,next:Cy,error:MU,complete:Cy};var LA=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function UA(e){return e}i(UA,"identity");function FA(e){return e.length===0?UA:e.length===1?e[0]:i(function(r){return e.reduce(function(n,a){return a(n)},r)},"piped")}i(FA,"pipeFromArray");var Ry=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable"),e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var a=this,s=DU(t)?t:new E0(t,r,n);return PA(function(){var c=a,l=c.operator,d=c.source;s.add(l?l.call(s,d):d?a._subscribe(s):a._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=jA(r),new r(function(a,s){var c=new E0({next:function(l){try{t(l)}catch(d){s(d),c.unsubscribe()}},error:s,complete:a});n.subscribe(c)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[LA]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return FA(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=jA(t),new t(function(n,a){var s;r.subscribe(function(c){return s=c},function(c){return a(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function jA(e){var t;return(t=e??oa.Promise)!==null&&t!==void 0?t:Promise}i(jA,"getPromiseCtor");function kU(e){return e&&Hi(e.next)&&Hi(e.error)&&Hi(e.complete)}i(kU,"isObserver");function DU(e){return e&&e instanceof Dy||kU(e)&&w0(e)}i(DU,"isSubscriber");var $A;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})($A||($A={}));var zA;(function(e){e[e.NOT_REQUESTED=0]="NOT_REQUESTED",e[e.PENDING=1]="PENDING",e[e.PROCESSING=2]="PROCESSING",e[e.ANCHORED=3]="ANCHORED",e[e.FAILED=4]="FAILED"})(zA||(zA={}));var Ny;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Ny||(Ny={}));var Gf=class extends Ry{constructor(t,r){super(n=>{t.subscribe(n)}),this.state$=t,this._context=r}get id(){return new Yt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:t,content:r}=this.state$.value;return(0,Oy.default)(t?.content??r)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return hr.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:t})=>hr.make(this.id,t))}get anchorCommitIds(){return this.state$.value.log.filter(({type:t})=>t===Ny.ANCHOR).map(({cid:t})=>hr.make(this.id,t))}get state(){return(0,Oy.default)(this.state$.value)}async sync(t={}){t={sync:lc.PREFER_CACHE,...t};let r=await this.api.loadStream(this.id,t);this.state$.next(r.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}};i(Gf,"Stream");function HA(){return e=>{}}i(HA,"StreamStatic");var RU=function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},vi,Py={anchor:!0,publish:!0,pin:!0,sync:lc.PREFER_CACHE},OU={sync:lc.PREFER_CACHE},qA={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function By(e,t){if(typeof e?.schema=="string")try{hr.fromString(e.schema)}catch{throw new Error("Schema must be a CommitID")}let r={controllers:e?.controllers,family:e?.family,schema:e?.schema?.toString(),tags:e?.tags};if(t)e?.deterministic||(r.unique=Iv((0,GA.randomBytes)(12),"base64")),e?.forbidControllerChange&&(r.forbidControllerChange=!0);else{if(e?.deterministic!==void 0||e?.unique!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if(e?.forbidControllerChange!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(r).forEach(n=>r[n]===void 0&&delete r[n]),r}i(By,"headerFromMetadata");async function VA(e){if(!e.did)throw new Error("No DID provided");return e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`)),e.did}i(VA,"getAuthenticatedDID");async function Ly(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(Ly,"throwReadOnlyError");var ns=vi=i(class extends Gf{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,KA.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,a={}){a={...Py,...a},!n?.deterministic&&a.syncTimeoutSeconds==null&&(a.syncTimeoutSeconds=0);let s=a.asDID?{did:a.asDID}:t,c=await vi.makeGenesis(s,r,n);return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,c,a)}static async createFromGenesis(t,r,n={}){n={...Py,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=r.data?await vi._signDagJWS(t,r):r;return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,a,n)}static async deterministic(t,r,n={}){if(n={...Py,...n},r={...r,deterministic:!0},r.family==null&&r.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=await vi.makeGenesis(t,null,r);return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,a,n)}static async load(t,r,n={}){n={...OU,...n};let a=ac.from(r);if(a.type!=vi.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${vi.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}async update(t,r,n={}){n={...qA,...n};let a=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(a,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...qA,...r};let a={header:By(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await vi._signDagJWS(this.api,a),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=Ly,this.patch=Ly,this.sync=Ly,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let a=await this._makeRawCommit(r,n);return vi._signDagJWS(t,a)}async _makeRawCommit(t,r){r||(r={});let n=By(r,!1);if(t==null&&(t=this.content),n.controllers){if(n.controllers.length!==1)throw new Error("Exactly one controller must be specified");if(!n.controllers[0])throw new Error("Controller cannot be updated to an undefined value.")}let a=x9.compare(this.content,t),s=this.state.log[0];return{header:n,data:a,prev:this.tip,id:s.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await VA(t);n.controllers=[c.hasParent?c.parent:c.id]}else throw new Error("No controllers specified");if(n.controllers?.length!==1)throw new Error("Exactly one controller must be specified");let a=By(n,!0);if(n?.deterministic&&r)throw new Error("Initial content must be null when creating a deterministic Tile document");if(r==null){let c={header:a};return zv(c),c}let s={data:r,header:a};return vi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await VA(t)).createDagJWS(r)}},"TileDocument");ns.STREAM_TYPE_NAME="tile";ns.STREAM_TYPE_ID=0;ns=vi=RU([HA()],ns);var e7=Ys(JA(),1);function HU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(HU,"_checkPrivateRedeclaration");function qU(e,t){return t.get?t.get.call(e):t.value}i(qU,"_classApplyDescriptorGet");function VU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(VU,"_classApplyDescriptorSet");function QA(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(QA,"_classExtractFieldDescriptor");function $y(e,t){var r=QA(e,t,"get");return qU(e,r)}i($y,"_classPrivateFieldGet");function YA(e,t,r){HU(e,t),t.set(e,r)}i(YA,"_classPrivateFieldInit");function XA(e,t,r){var n=QA(e,t,"set");return VU(e,n,r),r}i(XA,"_classPrivateFieldSet");function KU(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(KU,"keyToQuery");function zy(e){return typeof e=="string"?ac.from(e).toString():hr.isInstance(e)||Yt.isInstance(e)?e.toString():e.streamId.toString()}i(zy,"keyToString");async function qy(e){let t=await ns.makeGenesis({},null,{...e,deterministic:!0}),r=await Yt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(qy,"getDeterministicQuery");var GU=i(()=>Promise.resolve([]),"tempBatchLoadFn"),A0=new WeakMap,Hy=new WeakMap,dc=class extends e7.default{cache(t){if(!$y(this,Hy))return!1;let r=t.id.toString();return this.clear(r).prime(r,t),!0}async create(t,r,n){let a=await ns.create($y(this,A0),t,r,n);return this.cache(a),a}async deterministic(t,r){let n=await qy(t);try{return await super.load(n)}catch{let s=await ns.createFromGenesis($y(this,A0),n.genesis,r);return this.cache(s),s}}async load(t){return await super.load(t)}async update(t,r,n,a){let s=zy(t);this.clear(s);let c=await this.load({streamId:s});return await c.update(r,n,a),c}constructor(t){super(GU,{cache:!0,cacheKeyFn:zy,cacheMap:t.cache!=null&&typeof t.cache!="boolean"?t.cache:void 0}),YA(this,A0,{writable:!0,value:void 0}),YA(this,Hy,{writable:!0,value:void 0}),this._batchLoadFn=async r=>{t.cache||this.clearAll();let n=await t.ceramic.multiQuery(r.map(KU),t.multiqueryTimeout);return r.map(a=>{let s=zy(a),c=n[s];return c||new Error(`Failed to load stream: ${s}`)})},XA(this,A0,t.ceramic),XA(this,Hy,!!t.cache)}};i(dc,"TileLoader");function WU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(WU,"_checkPrivateRedeclaration");function ZU(e,t){return t.get?t.get.call(e):t.value}i(ZU,"_classApplyDescriptorGet");function JU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(JU,"_classApplyDescriptorSet");function r7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(r7,"_classExtractFieldDescriptor");function hc(e,t){var r=r7(e,t,"get");return ZU(e,r)}i(hc,"_classPrivateFieldGet");function t7(e,t,r){WU(e,t),t.set(e,r)}i(t7,"_classPrivateFieldInit");function Vy(e,t,r){var n=r7(e,t,"set");return JU(e,n,r),r}i(Vy,"_classPrivateFieldSet");var Bu=new WeakMap,Lu=new WeakMap,Uu=class{get aliases(){return hc(this,Bu)}get loader(){return hc(this,Lu)}getDefinitionID(t){return hc(this,Bu).definitions[t]??null}getSchemaURL(t){return hc(this,Bu).schemas[t]??null}getTileID(t){return hc(this,Bu).tiles[t]??null}async loadTile(t){let r=this.getTileID(t);if(r==null)throw new Error(`Tile alias "${t}" is not defined`);return await hc(this,Lu).load(r)}async createTile(t,r,n={}){let a=this.getSchemaURL(t);if(a==null)throw new Error(`Schema alias "${t}" is not defined`);let{controller:s,...c}=n,l={schema:a};return s!=null&&(l.controllers=[s]),await hc(this,Lu).create(r,l,c)}constructor(t){if(t7(this,Bu,{writable:!0,value:void 0}),t7(this,Lu,{writable:!0,value:void 0}),Vy(this,Bu,t.aliases),t.loader!=null)Vy(this,Lu,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");Vy(this,Lu,new dc({ceramic:t.ceramic,cache:t.cache}))}}};i(Uu,"DataModel");function YU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(YU,"_checkPrivateRedeclaration");function XU(e,t){return t.get?t.get.call(e):t.value}i(XU,"_classApplyDescriptorGet");function QU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(QU,"_classApplyDescriptorSet");function n7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(n7,"_classExtractFieldDescriptor");function Fa(e,t){var r=n7(e,t,"get");return XU(e,r)}i(Fa,"_classPrivateFieldGet");function S0(e,t,r){YU(e,t),t.set(e,r)}i(S0,"_classPrivateFieldInit");function x0(e,t,r){var n=n7(e,t,"set");return QU(e,n,r),r}i(x0,"_classPrivateFieldSet");var T0=new WeakMap,pc=new WeakMap,Ky=new WeakMap,C0=new WeakMap,Wf=class{_createValuePromise(){x0(this,Ky,new Promise((t,r)=>{x0(this,C0,{resolve:t,reject:r})}))}change(t){return new Promise((r,n)=>{let a=i(async s=>{try{let c=await t(s);r(),this._next(c)}catch(c){n(c),this._next(s)}},"run");Fa(this,pc).push({reject:n,run:a}),Fa(this,pc).length===1&&this._start()})}async changeContent(t){let r=i(async n=>(await n.update(t(n.content),n.metadata),n),"mutation");return await this.change(r)}async get(){return Fa(this,pc).length===0?await Fa(this,T0).call(this):await Fa(this,Ky)}async _start(){try{let t=await Fa(this,T0).call(this);this._next(t)}catch(t){Fa(this,pc).forEach(r=>{r.reject(t)}),x0(this,pc,[]),Fa(this,C0).reject(t),this._createValuePromise()}}_next(t){let r=Fa(this,pc).shift();r==null?this._end(t):r.run(t)}_end(t){Fa(this,C0).resolve(t),this._createValuePromise()}constructor(t){S0(this,T0,{writable:!0,value:void 0}),S0(this,pc,{writable:!0,value:[]}),S0(this,Ky,{writable:!0,value:void 0}),S0(this,C0,{writable:!0,value:void 0}),x0(this,T0,t),this._createValuePromise()}};i(Wf,"TileProxy");var eF=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function tF(e){return eF.test(e)}i(tF,"isDIDstring");function rF(e){if(!tF(e))throw new Error(`Invalid DID: ${e}`)}i(rF,"assertDIDstring");function Gy(e){return rF(e),{controllers:[e],family:"IDX"}}i(Gy,"getIDXMetadata");function nF(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(nF,"_checkPrivateRedeclaration");function iF(e,t){return t.get?t.get.call(e):t.value}i(iF,"_classApplyDescriptorGet");function aF(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(aF,"_classApplyDescriptorSet");function i7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(i7,"_classExtractFieldDescriptor");function $r(e,t){var r=i7(e,t,"get");return iF(e,r)}i($r,"_classPrivateFieldGet");function Zf(e,t,r){nF(e,t),t.set(e,r)}i(Zf,"_classPrivateFieldInit");function M0(e,t,r){var n=i7(e,t,"set");return aF(e,n,r),r}i(M0,"_classPrivateFieldSet");var wo=new WeakMap,I0=new WeakMap,Wy=new WeakMap,ja=new WeakMap,k0=new WeakMap,Jf=class{get authenticated(){return $r(this,wo).did!=null}get ceramic(){return $r(this,wo)}get id(){if($r(this,I0)!=null)return $r(this,I0);if($r(this,wo).did==null)throw new Error("Ceramic instance is not authenticated");return $r(this,wo).did.hasParent?$r(this,wo).did.parent:$r(this,wo).did.id}get loader(){return $r(this,ja)}get model(){return $r(this,k0)}async has(t,r){let n=this.getDefinitionID(t);return await this.getRecordID(n,r)!=null}async get(t,r){let n=this.getDefinitionID(t);return await this.getRecord(n,r)}async getMultiple(t,r){let n=this.getDefinitionID(t),a=await Promise.all(r.map(async l=>{let{genesis:d,streamId:p}=await qy(Gy(l));return{genesis:d,streamId:p.toString(),paths:[n]}})),s=await $r(this,wo).multiQuery(a),c=[];for(let l of a){let d=s[l.streamId]?.content?.[n],p=d?s[Yt.fromString(d).toString()]:null;c.push(p?.content??null)}return c}async set(t,r,n={}){let a=this.getDefinitionID(t),[s,c]=await this._setRecordOnly(a,r,n);return s&&await this._setReference(n.controller??this.id,a,c),c}async merge(t,r,n={}){let a=this.getDefinitionID(t),s=await this.getRecord(a),c=s?{...s,...r}:r;return await this.setRecord(a,c,n)}async setAll(t,r={}){let n=Object.entries(t).map(async([c,l])=>{let d=this.getDefinitionID(c),[p,g]=await this._setRecordOnly(d,l,r);return[p,d,g]}),s=(await Promise.all(n)).reduce((c,[l,d,p])=>(l&&(c[d]=p.toUrl()),c),{});return await this._setReferences(r.controller??this.id,s),s}async setDefaults(t,r={}){let n=await this.getIndex()??{},a=Object.entries(t).map(([l,d])=>[this.getDefinitionID(l),d]).filter(l=>n[l[0]]==null).map(async([l,d])=>{let p=await this.getDefinition(l),g=await this._createRecord(p,d,r);return{[l]:g.toUrl()}}),c=(await Promise.all(a)).reduce((l,d)=>Object.assign(l,d),{});return await this._setReferences(r.controller??this.id,c),c}async remove(t,r=this.id){await this._getIndexProxy(r).changeContent(n=>(n!=null&&delete n[this.getDefinitionID(t)],n))}async getIndex(t=this.id){let r=this.authenticated&&t===this.id?await this._getIndexProxy(t).get():await this._getIDXDoc(t);return r?r.content:null}iterator(t){let r,n=0;return{[Symbol.asyncIterator](){return this},next:async()=>{if(r==null){let l=await this.getIndex(t);r=Object.entries(l??{})}if(n===r.length)return{done:!0,value:null};let[a,s]=r[n++],c=await $r(this,ja).load(s);return{done:!1,value:{key:a,id:s,record:c.content}}}}}async _createIDXDoc(t){return await $r(this,ja).deterministic(Gy(t))}async _getIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)return null;if(r.metadata.schema!==Wp)throw new Error("Invalid document: schema is not IdentityIndex");return r}async _getOwnIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)await r.update({},{schema:Wp});else if(r.metadata.schema!==Wp)throw new Error("Invalid document: schema is not IdentityIndex");return r}_getIndexProxy(t){let r=$r(this,Wy)[t];return r==null&&(r=new Wf(async()=>await this._getOwnIDXDoc(t)),$r(this,Wy)[t]=r),r}getDefinitionID(t){return $r(this,k0).getDefinitionID(t)??t}async getDefinition(t){let r=await $r(this,ja).load(t);if(r.metadata.schema!==E9)throw new Error("Invalid document: schema is not Definition");return{...r.content,id:r.id}}async getRecordID(t,r){return(await this.getIndex(r??this.id))?.[t]??null}async getRecordDocument(t,r){let n=await this.getRecordID(t,r);return n?await $r(this,ja).load(n):null}async getRecord(t,r){let n=await this.getRecordDocument(t,r);return n?n.content:null}async setRecord(t,r,n={}){let[a,s]=await this._setRecordOnly(t,r,n);return a&&await this._setReference(n.controller??this.id,t,s),s}async _setRecordOnly(t,r,n){let a=await this.getRecordID(t,n.controller??this.id);if(a==null){let s=await this.getDefinition(t),c=await this._createRecord(s,r,n);return[!0,c]}else{let s=await $r(this,ja).update(a,r);return[!1,s.id]}}async _createRecord(t,r,{controller:n,pin:a}){let s=await $r(this,ja).deterministic({controllers:[n??this.id],family:t.id.toString()},{pin:a});return await s.update(r,{schema:t.schema}),s.id}async _setReference(t,r,n){await this._getIndexProxy(t).changeContent(a=>({...a,[r]:n.toUrl()}))}async _setReferences(t,r){Object.keys(r).length!==0&&await this._getIndexProxy(t).changeContent(n=>({...n,...r}))}constructor(t){Zf(this,wo,{writable:!0,value:void 0}),Zf(this,I0,{writable:!0,value:void 0}),Zf(this,Wy,{writable:!0,value:{}}),Zf(this,ja,{writable:!0,value:void 0}),Zf(this,k0,{writable:!0,value:void 0});let{cache:r,ceramic:n,id:a,loader:s,model:c}=t;M0(this,wo,n),M0(this,I0,a),M0(this,ja,s??new dc({ceramic:n,cache:r})),M0(this,k0,c instanceof Uu?c:new Uu({loader:$r(this,ja),aliases:c}))}};i(Jf,"DIDDataStore");var rr;(function(e){e.assertEqual=a=>a;function t(a){}i(t,"assertIs"),e.assertIs=t;function r(a){throw new Error}i(r,"assertNever"),e.assertNever=r,e.arrayToEnum=a=>{let s={};for(let c of a)s[c]=c;return s},e.getValidEnumValues=a=>{let s=e.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),c={};for(let l of s)c[l]=a[l];return e.objectValues(c)},e.objectValues=a=>e.objectKeys(a).map(function(s){return a[s]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&s.push(c);return s},e.find=(a,s)=>{for(let c of a)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(rr||(rr={}));var Jy;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Jy||(Jy={}));var nt=rr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),is=i(e=>{switch(typeof e){case"undefined":return nt.undefined;case"string":return nt.string;case"number":return isNaN(e)?nt.nan:nt.number;case"boolean":return nt.boolean;case"function":return nt.function;case"bigint":return nt.bigint;case"symbol":return nt.symbol;case"object":return Array.isArray(e)?nt.array:e===null?nt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?nt.promise:typeof Map<"u"&&e instanceof Map?nt.map:typeof Set<"u"&&e instanceof Set?nt.set:typeof Date<"u"&&e instanceof Date?nt.date:nt.object;default:return nt.unknown}},"getParsedType"),qe=rr.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),oF=i(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Sn=class extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){let r=t||function(s){return s.message},n={_errors:[]},a=i(s=>{for(let c of s.issues)if(c.code==="invalid_union")c.unionErrors.map(a);else if(c.code==="invalid_return_type")a(c.returnTypeError);else if(c.code==="invalid_arguments")a(c.argumentsError);else if(c.path.length===0)n._errors.push(r(c));else{let l=n,d=0;for(;d<c.path.length;){let p=c.path[d];d===c.path.length-1?(l[p]=l[p]||{_errors:[]},l[p]._errors.push(r(c))):l[p]=l[p]||{_errors:[]},l=l[p],d++}}},"processError");return a(this),n}static assert(t){if(!(t instanceof Sn))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,rr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};i(Sn,"ZodError");Sn.create=e=>new Sn(e);var zu=i((e,t)=>{let r;switch(e.code){case qe.invalid_type:e.received===nt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case qe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,rr.jsonStringifyReplacer)}`;break;case qe.unrecognized_keys:r=`Unrecognized key(s) in object: ${rr.joinValues(e.keys,", ")}`;break;case qe.invalid_union:r="Invalid input";break;case qe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${rr.joinValues(e.options)}`;break;case qe.invalid_enum_value:r=`Invalid enum value. Expected ${rr.joinValues(e.options)}, received '${e.received}'`;break;case qe.invalid_arguments:r="Invalid function arguments";break;case qe.invalid_return_type:r="Invalid function return type";break;case qe.invalid_date:r="Invalid date";break;case qe.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:rr.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case qe.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case qe.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case qe.custom:r="Invalid input";break;case qe.invalid_intersection_types:r="Intersection results could not be merged";break;case qe.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case qe.not_finite:r="Number must be finite";break;default:r=t.defaultError,rr.assertNever(e)}return{message:r}},"errorMap"),s7=zu;function sF(e){s7=e}i(sF,"setErrorMap");function D0(){return s7}i(D0,"getErrorMap");var R0=i(e=>{let{data:t,path:r,errorMaps:n,issueData:a}=e,s=[...r,...a.path||[]],c={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let l="",d=n.filter(p=>!!p).slice().reverse();for(let p of d)l=p(c,{data:t,defaultError:l}).message;return{...a,path:s,message:l}},"makeIssue"),cF=[];function et(e,t){let r=D0(),n=R0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===zu?void 0:zu].filter(a=>!!a)});e.common.issues.push(n)}i(et,"addIssueToContext");var Yr=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let a of r){if(a.status==="aborted")return It;a.status==="dirty"&&t.dirty(),n.push(a.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let a of r){let s=await a.key,c=await a.value;n.push({key:s,value:c})}return Yr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let a of r){let{key:s,value:c}=a;if(s.status==="aborted"||c.status==="aborted")return It;s.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof c.value<"u"||a.alwaysSet)&&(n[s.value]=c.value)}return{status:t.value,value:n}}};i(Yr,"ParseStatus");var It=Object.freeze({status:"aborted"}),ju=i(e=>({status:"dirty",value:e}),"DIRTY"),On=i(e=>({status:"valid",value:e}),"OK"),Yy=i(e=>e.status==="aborted","isAborted"),Xy=i(e=>e.status==="dirty","isDirty"),Qf=i(e=>e.status==="valid","isValid"),ed=i(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");function O0(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}i(O0,"__classPrivateFieldGet");function c7(e,t,r,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(e,r):a?a.value=r:t.set(e,r),r}i(c7,"__classPrivateFieldSet");var bt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(bt||(bt={}));var Yf,Xf,yi=class{constructor(t,r,n,a){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};i(yi,"ParseInputLazyPath");var a7=i((e,t)=>{if(Qf(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Sn(e.common.issues);return this._error=r,this._error}}},"handleResult");function jt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:i((c,l)=>{var d,p;let{message:g}=e;return c.code==="invalid_enum_value"?{message:g??l.defaultError}:typeof l.data>"u"?{message:(d=g??n)!==null&&d!==void 0?d:l.defaultError}:c.code!=="invalid_type"?{message:l.defaultError}:{message:(p=g??r)!==null&&p!==void 0?p:l.defaultError}},"customMap"),description:a}}i(jt,"processCreateParams");var Lt=class{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return is(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:is(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Yr,ctx:{common:t.parent.common,data:t.data,parsedType:is(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ed(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;let a={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:is(t)},s=this._parseSync({data:t,path:a.path,parent:a});return a7(a,s)}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:is(t)},a=this._parse({data:t,path:n.path,parent:n}),s=await(ed(a)?a:Promise.resolve(a));return a7(n,s)}refine(t,r){let n=i(a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r,"getIssueProperties");return this._refinement((a,s)=>{let c=t(a),l=i(()=>s.addIssue({code:qe.custom,...n(a)}),"setError");return typeof Promise<"u"&&c instanceof Promise?c.then(d=>d?!0:(l(),!1)):c?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,a)=>t(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(t){return new Xn({schema:this,typeName:Ct.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return wi.create(this,this._def)}nullable(){return la.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Yn.create(this,this._def)}promise(){return So.create(this,this._def)}or(t){return cs.create([this,t],this._def)}and(t){return us.create(this,t,this._def)}transform(t){return new Xn({...jt(this._def),schema:this,typeName:Ct.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new ps({...jt(this._def),innerType:this,defaultValue:r,typeName:Ct.ZodDefault})}brand(){return new $u({typeName:Ct.ZodBranded,type:this,...jt(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new ms({...jt(this._def),innerType:this,catchValue:r,typeName:Ct.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return gs.create(this,t)}readonly(){return vs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};i(Lt,"ZodType");var uF=/^c[^\s-]{8,}$/i,lF=/^[0-9a-z]+$/,fF=/^[0-9A-HJKMNP-TV-Z]{26}$/,dF=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,hF=/^[a-z0-9_-]{21}$/i,pF=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,mF=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,gF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Zy,vF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,yF=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,bF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,u7="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",wF=new RegExp(`^${u7}$`);function l7(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}i(l7,"timeRegexSource");function _F(e){return new RegExp(`^${l7(e)}$`)}i(_F,"timeRegex");function f7(e){let t=`${u7}T${l7(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}i(f7,"datetimeRegex");function EF(e,t){return!!((t==="v4"||!t)&&vF.test(e)||(t==="v6"||!t)&&yF.test(e))}i(EF,"isValidIP");var Jn=class extends Lt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==nt.string){let s=this._getOrReturnCtx(t);return et(s,{code:qe.invalid_type,expected:nt.string,received:s.parsedType}),It}let n=new Yr,a;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(a=this._getOrReturnCtx(t,a),et(a,{code:qe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")t.data.length>s.value&&(a=this._getOrReturnCtx(t,a),et(a,{code:qe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let c=t.data.length>s.value,l=t.data.length<s.value;(c||l)&&(a=this._getOrReturnCtx(t,a),c?et(a,{code:qe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&et(a,{code:qe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")mF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"email",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Zy||(Zy=new RegExp(gF,"u")),Zy.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"emoji",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")dF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"uuid",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")hF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"nanoid",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")uF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"cuid",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")lF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"cuid2",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")fF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"ulid",code:qe.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),et(a,{validation:"url",code:qe.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"regex",code:qe.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?f7(s).test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?wF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?_F(s).test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{code:qe.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?pF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"duration",code:qe.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?EF(t.data,s.version)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"ip",code:qe.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?bF.test(t.data)||(a=this._getOrReturnCtx(t,a),et(a,{validation:"base64",code:qe.invalid_string,message:s.message}),n.dirty()):rr.assertNever(s);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(a=>t.test(a),{validation:r,code:qe.invalid_string,...bt.errToObj(n)})}_addCheck(t){return new Jn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...bt.errToObj(t)})}url(t){return this._addCheck({kind:"url",...bt.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...bt.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...bt.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...bt.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...bt.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...bt.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...bt.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...bt.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...bt.errToObj(t)})}datetime(t){var r,n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,local:(n=t?.local)!==null&&n!==void 0?n:!1,...bt.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...bt.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...bt.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...bt.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...bt.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...bt.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...bt.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...bt.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...bt.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...bt.errToObj(r)})}nonempty(t){return this.min(1,bt.errToObj(t))}trim(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Jn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};i(Jn,"ZodString");Jn.create=e=>{var t;return new Jn({checks:[],typeName:Ct.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...jt(e)})};function AF(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(e.toFixed(a).replace(".","")),c=parseInt(t.toFixed(a).replace(".",""));return s%c/Math.pow(10,a)}i(AF,"floatSafeRemainder");var sa=class extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==nt.number){let s=this._getOrReturnCtx(t);return et(s,{code:qe.invalid_type,expected:nt.number,received:s.parsedType}),It}let n,a=new Yr;for(let s of this._def.checks)s.kind==="int"?rr.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),et(n,{code:qe.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?AF(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),et(n,{code:qe.not_finite,message:s.message}),a.dirty()):rr.assertNever(s);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,bt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,bt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,bt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,bt.toString(r))}setLimit(t,r,n,a){return new sa({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:bt.toString(a)}]})}_addCheck(t){return new sa({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:bt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:bt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:bt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:bt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:bt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:bt.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:bt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:bt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:bt.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&rr.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};i(sa,"ZodNumber");sa.create=e=>new sa({checks:[],typeName:Ct.ZodNumber,coerce:e?.coerce||!1,...jt(e)});var ca=class extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==nt.bigint){let s=this._getOrReturnCtx(t);return et(s,{code:qe.invalid_type,expected:nt.bigint,received:s.parsedType}),It}let n,a=new Yr;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),et(n,{code:qe.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):rr.assertNever(s);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,bt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,bt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,bt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,bt.toString(r))}setLimit(t,r,n,a){return new ca({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:bt.toString(a)}]})}_addCheck(t){return new ca({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:bt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:bt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:bt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:bt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:bt.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};i(ca,"ZodBigInt");ca.create=e=>{var t;return new ca({checks:[],typeName:Ct.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...jt(e)})};var as=class extends Lt{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==nt.boolean){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.boolean,received:n.parsedType}),It}return On(t.data)}};i(as,"ZodBoolean");as.create=e=>new as({typeName:Ct.ZodBoolean,coerce:e?.coerce||!1,...jt(e)});var $a=class extends Lt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==nt.date){let s=this._getOrReturnCtx(t);return et(s,{code:qe.invalid_type,expected:nt.date,received:s.parsedType}),It}if(isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return et(s,{code:qe.invalid_date}),It}let n=new Yr,a;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(a=this._getOrReturnCtx(t,a),et(a,{code:qe.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(a=this._getOrReturnCtx(t,a),et(a,{code:qe.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):rr.assertNever(s);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new $a({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:bt.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:bt.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};i($a,"ZodDate");$a.create=e=>new $a({checks:[],coerce:e?.coerce||!1,typeName:Ct.ZodDate,...jt(e)});var mc=class extends Lt{_parse(t){if(this._getType(t)!==nt.symbol){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.symbol,received:n.parsedType}),It}return On(t.data)}};i(mc,"ZodSymbol");mc.create=e=>new mc({typeName:Ct.ZodSymbol,...jt(e)});var os=class extends Lt{_parse(t){if(this._getType(t)!==nt.undefined){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.undefined,received:n.parsedType}),It}return On(t.data)}};i(os,"ZodUndefined");os.create=e=>new os({typeName:Ct.ZodUndefined,...jt(e)});var ss=class extends Lt{_parse(t){if(this._getType(t)!==nt.null){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.null,received:n.parsedType}),It}return On(t.data)}};i(ss,"ZodNull");ss.create=e=>new ss({typeName:Ct.ZodNull,...jt(e)});var Eo=class extends Lt{constructor(){super(...arguments),this._any=!0}_parse(t){return On(t.data)}};i(Eo,"ZodAny");Eo.create=e=>new Eo({typeName:Ct.ZodAny,...jt(e)});var za=class extends Lt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return On(t.data)}};i(za,"ZodUnknown");za.create=e=>new za({typeName:Ct.ZodUnknown,...jt(e)});var qi=class extends Lt{_parse(t){let r=this._getOrReturnCtx(t);return et(r,{code:qe.invalid_type,expected:nt.never,received:r.parsedType}),It}};i(qi,"ZodNever");qi.create=e=>new qi({typeName:Ct.ZodNever,...jt(e)});var gc=class extends Lt{_parse(t){if(this._getType(t)!==nt.undefined){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.void,received:n.parsedType}),It}return On(t.data)}};i(gc,"ZodVoid");gc.create=e=>new gc({typeName:Ct.ZodVoid,...jt(e)});var Yn=class extends Lt{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),a=this._def;if(r.parsedType!==nt.array)return et(r,{code:qe.invalid_type,expected:nt.array,received:r.parsedType}),It;if(a.exactLength!==null){let c=r.data.length>a.exactLength.value,l=r.data.length<a.exactLength.value;(c||l)&&(et(r,{code:c?qe.too_big:qe.too_small,minimum:l?a.exactLength.value:void 0,maximum:c?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(et(r,{code:qe.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(et(r,{code:qe.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((c,l)=>a.type._parseAsync(new yi(r,c,r.path,l)))).then(c=>Yr.mergeArray(n,c));let s=[...r.data].map((c,l)=>a.type._parseSync(new yi(r,c,r.path,l)));return Yr.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new Yn({...this._def,minLength:{value:t,message:bt.toString(r)}})}max(t,r){return new Yn({...this._def,maxLength:{value:t,message:bt.toString(r)}})}length(t,r){return new Yn({...this._def,exactLength:{value:t,message:bt.toString(r)}})}nonempty(t){return this.min(1,t)}};i(Yn,"ZodArray");Yn.create=(e,t)=>new Yn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ct.ZodArray,...jt(t)});function Fu(e){if(e instanceof Tr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=wi.create(Fu(n))}return new Tr({...e._def,shape:()=>t})}else return e instanceof Yn?new Yn({...e._def,type:Fu(e.element)}):e instanceof wi?wi.create(Fu(e.unwrap())):e instanceof la?la.create(Fu(e.unwrap())):e instanceof bi?bi.create(e.items.map(t=>Fu(t))):e}i(Fu,"deepPartialify");var Tr=class extends Lt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=rr.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==nt.object){let p=this._getOrReturnCtx(t);return et(p,{code:qe.invalid_type,expected:nt.object,received:p.parsedType}),It}let{status:n,ctx:a}=this._processInputParams(t),{shape:s,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof qi&&this._def.unknownKeys==="strip"))for(let p in a.data)c.includes(p)||l.push(p);let d=[];for(let p of c){let g=s[p],v=a.data[p];d.push({key:{status:"valid",value:p},value:g._parse(new yi(a,v,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof qi){let p=this._def.unknownKeys;if(p==="passthrough")for(let g of l)d.push({key:{status:"valid",value:g},value:{status:"valid",value:a.data[g]}});else if(p==="strict")l.length>0&&(et(a,{code:qe.unrecognized_keys,keys:l}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let g of l){let v=a.data[g];d.push({key:{status:"valid",value:g},value:p._parse(new yi(a,v,a.path,g)),alwaysSet:g in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let g of d){let v=await g.key,y=await g.value;p.push({key:v,value:y,alwaysSet:g.alwaysSet})}return p}).then(p=>Yr.mergeObjectSync(n,p)):Yr.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(t){return bt.errToObj,new Tr({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var a,s,c,l;let d=(c=(s=(a=this._def).errorMap)===null||s===void 0?void 0:s.call(a,r,n).message)!==null&&c!==void 0?c:n.defaultError;return r.code==="unrecognized_keys"?{message:(l=bt.errToObj(t).message)!==null&&l!==void 0?l:d}:{message:d}}}:{}})}strip(){return new Tr({...this._def,unknownKeys:"strip"})}passthrough(){return new Tr({...this._def,unknownKeys:"passthrough"})}extend(t){return new Tr({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Tr({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ct.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Tr({...this._def,catchall:t})}pick(t){let r={};return rr.objectKeys(t).forEach(n=>{t[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new Tr({...this._def,shape:()=>r})}omit(t){let r={};return rr.objectKeys(this.shape).forEach(n=>{t[n]||(r[n]=this.shape[n])}),new Tr({...this._def,shape:()=>r})}deepPartial(){return Fu(this)}partial(t){let r={};return rr.objectKeys(this.shape).forEach(n=>{let a=this.shape[n];t&&!t[n]?r[n]=a:r[n]=a.optional()}),new Tr({...this._def,shape:()=>r})}required(t){let r={};return rr.objectKeys(this.shape).forEach(n=>{if(t&&!t[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof wi;)s=s._def.innerType;r[n]=s}}),new Tr({...this._def,shape:()=>r})}keyof(){return d7(rr.objectKeys(this.shape))}};i(Tr,"ZodObject");Tr.create=(e,t)=>new Tr({shape:()=>e,unknownKeys:"strip",catchall:qi.create(),typeName:Ct.ZodObject,...jt(t)});Tr.strictCreate=(e,t)=>new Tr({shape:()=>e,unknownKeys:"strict",catchall:qi.create(),typeName:Ct.ZodObject,...jt(t)});Tr.lazycreate=(e,t)=>new Tr({shape:e,unknownKeys:"strip",catchall:qi.create(),typeName:Ct.ZodObject,...jt(t)});var cs=class extends Lt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function a(s){for(let l of s)if(l.result.status==="valid")return l.result;for(let l of s)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let c=s.map(l=>new Sn(l.ctx.common.issues));return et(r,{code:qe.invalid_union,unionErrors:c}),It}if(i(a,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let c={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:c}),ctx:c}})).then(a);{let s,c=[];for(let d of n){let p={...r,common:{...r.common,issues:[]},parent:null},g=d._parseSync({data:r.data,path:r.path,parent:p});if(g.status==="valid")return g;g.status==="dirty"&&!s&&(s={result:g,ctx:p}),p.common.issues.length&&c.push(p.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let l=c.map(d=>new Sn(d));return et(r,{code:qe.invalid_union,unionErrors:l}),It}}get options(){return this._def.options}};i(cs,"ZodUnion");cs.create=(e,t)=>new cs({options:e,typeName:Ct.ZodUnion,...jt(t)});var _o=i(e=>e instanceof fs?_o(e.schema):e instanceof Xn?_o(e.innerType()):e instanceof ds?[e.value]:e instanceof ua?e.options:e instanceof hs?rr.objectValues(e.enum):e instanceof ps?_o(e._def.innerType):e instanceof os?[void 0]:e instanceof ss?[null]:e instanceof wi?[void 0,..._o(e.unwrap())]:e instanceof la?[null,..._o(e.unwrap())]:e instanceof $u||e instanceof vs?_o(e.unwrap()):e instanceof ms?_o(e._def.innerType):[],"getDiscriminator"),vc=class extends Lt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==nt.object)return et(r,{code:qe.invalid_type,expected:nt.object,received:r.parsedType}),It;let n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(et(r,{code:qe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),It)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let a=new Map;for(let s of r){let c=_o(s.shape[t]);if(!c.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let l of c){if(a.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);a.set(l,s)}}return new vc({typeName:Ct.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:a,...jt(n)})}};i(vc,"ZodDiscriminatedUnion");function Qy(e,t){let r=is(e),n=is(t);if(e===t)return{valid:!0,data:e};if(r===nt.object&&n===nt.object){let a=rr.objectKeys(t),s=rr.objectKeys(e).filter(l=>a.indexOf(l)!==-1),c={...e,...t};for(let l of s){let d=Qy(e[l],t[l]);if(!d.valid)return{valid:!1};c[l]=d.data}return{valid:!0,data:c}}else if(r===nt.array&&n===nt.array){if(e.length!==t.length)return{valid:!1};let a=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],d=Qy(c,l);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return r===nt.date&&n===nt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Qy,"mergeValues");var us=class extends Lt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),a=i((s,c)=>{if(Yy(s)||Yy(c))return It;let l=Qy(s.value,c.value);return l.valid?((Xy(s)||Xy(c))&&r.dirty(),{status:r.value,value:l.data}):(et(n,{code:qe.invalid_intersection_types}),It)},"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,c])=>a(s,c)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};i(us,"ZodIntersection");us.create=(e,t,r)=>new us({left:e,right:t,typeName:Ct.ZodIntersection,...jt(r)});var bi=class extends Lt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==nt.array)return et(n,{code:qe.invalid_type,expected:nt.array,received:n.parsedType}),It;if(n.data.length<this._def.items.length)return et(n,{code:qe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),It;!this._def.rest&&n.data.length>this._def.items.length&&(et(n,{code:qe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((c,l)=>{let d=this._def.items[l]||this._def.rest;return d?d._parse(new yi(n,c,n.path,l)):null}).filter(c=>!!c);return n.common.async?Promise.all(s).then(c=>Yr.mergeArray(r,c)):Yr.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new bi({...this._def,rest:t})}};i(bi,"ZodTuple");bi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new bi({items:e,typeName:Ct.ZodTuple,rest:null,...jt(t)})};var ls=class extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==nt.object)return et(n,{code:qe.invalid_type,expected:nt.object,received:n.parsedType}),It;let a=[],s=this._def.keyType,c=this._def.valueType;for(let l in n.data)a.push({key:s._parse(new yi(n,l,n.path,l)),value:c._parse(new yi(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?Yr.mergeObjectAsync(r,a):Yr.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Lt?new ls({keyType:t,valueType:r,typeName:Ct.ZodRecord,...jt(n)}):new ls({keyType:Jn.create(),valueType:t,typeName:Ct.ZodRecord,...jt(r)})}};i(ls,"ZodRecord");var yc=class extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==nt.map)return et(n,{code:qe.invalid_type,expected:nt.map,received:n.parsedType}),It;let a=this._def.keyType,s=this._def.valueType,c=[...n.data.entries()].map(([l,d],p)=>({key:a._parse(new yi(n,l,n.path,[p,"key"])),value:s._parse(new yi(n,d,n.path,[p,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let d of c){let p=await d.key,g=await d.value;if(p.status==="aborted"||g.status==="aborted")return It;(p.status==="dirty"||g.status==="dirty")&&r.dirty(),l.set(p.value,g.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let d of c){let p=d.key,g=d.value;if(p.status==="aborted"||g.status==="aborted")return It;(p.status==="dirty"||g.status==="dirty")&&r.dirty(),l.set(p.value,g.value)}return{status:r.value,value:l}}}};i(yc,"ZodMap");yc.create=(e,t,r)=>new yc({valueType:t,keyType:e,typeName:Ct.ZodMap,...jt(r)});var Ha=class extends Lt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==nt.set)return et(n,{code:qe.invalid_type,expected:nt.set,received:n.parsedType}),It;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(et(n,{code:qe.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(et(n,{code:qe.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());let s=this._def.valueType;function c(d){let p=new Set;for(let g of d){if(g.status==="aborted")return It;g.status==="dirty"&&r.dirty(),p.add(g.value)}return{status:r.value,value:p}}i(c,"finalizeSet");let l=[...n.data.values()].map((d,p)=>s._parse(new yi(n,d,n.path,p)));return n.common.async?Promise.all(l).then(d=>c(d)):c(l)}min(t,r){return new Ha({...this._def,minSize:{value:t,message:bt.toString(r)}})}max(t,r){return new Ha({...this._def,maxSize:{value:t,message:bt.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};i(Ha,"ZodSet");Ha.create=(e,t)=>new Ha({valueType:e,minSize:null,maxSize:null,typeName:Ct.ZodSet,...jt(t)});var Ao=class extends Lt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==nt.function)return et(r,{code:qe.invalid_type,expected:nt.function,received:r.parsedType}),It;function n(l,d){return R0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,D0(),zu].filter(p=>!!p),issueData:{code:qe.invalid_arguments,argumentsError:d}})}i(n,"makeArgsIssue");function a(l,d){return R0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,D0(),zu].filter(p=>!!p),issueData:{code:qe.invalid_return_type,returnTypeError:d}})}i(a,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},c=r.data;if(this._def.returns instanceof So){let l=this;return On(async function(...d){let p=new Sn([]),g=await l._def.args.parseAsync(d,s).catch(_=>{throw p.addIssue(n(d,_)),p}),v=await Reflect.apply(c,this,g);return await l._def.returns._def.type.parseAsync(v,s).catch(_=>{throw p.addIssue(a(v,_)),p})})}else{let l=this;return On(function(...d){let p=l._def.args.safeParse(d,s);if(!p.success)throw new Sn([n(d,p.error)]);let g=Reflect.apply(c,this,p.data),v=l._def.returns.safeParse(g,s);if(!v.success)throw new Sn([a(g,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Ao({...this._def,args:bi.create(t).rest(za.create())})}returns(t){return new Ao({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new Ao({args:t||bi.create([]).rest(za.create()),returns:r||za.create(),typeName:Ct.ZodFunction,...jt(n)})}};i(Ao,"ZodFunction");var fs=class extends Lt{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};i(fs,"ZodLazy");fs.create=(e,t)=>new fs({getter:e,typeName:Ct.ZodLazy,...jt(t)});var ds=class extends Lt{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return et(r,{received:r.data,code:qe.invalid_literal,expected:this._def.value}),It}return{status:"valid",value:t.data}}get value(){return this._def.value}};i(ds,"ZodLiteral");ds.create=(e,t)=>new ds({value:e,typeName:Ct.ZodLiteral,...jt(t)});function d7(e,t){return new ua({values:e,typeName:Ct.ZodEnum,...jt(t)})}i(d7,"createZodEnum");var ua=class extends Lt{constructor(){super(...arguments),Yf.set(this,void 0)}_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return et(r,{expected:rr.joinValues(n),received:r.parsedType,code:qe.invalid_type}),It}if(O0(this,Yf,"f")||c7(this,Yf,new Set(this._def.values),"f"),!O0(this,Yf,"f").has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return et(r,{received:r.data,code:qe.invalid_enum_value,options:n}),It}return On(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return ua.create(t,{...this._def,...r})}exclude(t,r=this._def){return ua.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};i(ua,"ZodEnum");Yf=new WeakMap;ua.create=d7;var hs=class extends Lt{constructor(){super(...arguments),Xf.set(this,void 0)}_parse(t){let r=rr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==nt.string&&n.parsedType!==nt.number){let a=rr.objectValues(r);return et(n,{expected:rr.joinValues(a),received:n.parsedType,code:qe.invalid_type}),It}if(O0(this,Xf,"f")||c7(this,Xf,new Set(rr.getValidEnumValues(this._def.values)),"f"),!O0(this,Xf,"f").has(t.data)){let a=rr.objectValues(r);return et(n,{received:n.data,code:qe.invalid_enum_value,options:a}),It}return On(t.data)}get enum(){return this._def.values}};i(hs,"ZodNativeEnum");Xf=new WeakMap;hs.create=(e,t)=>new hs({values:e,typeName:Ct.ZodNativeEnum,...jt(t)});var So=class extends Lt{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==nt.promise&&r.common.async===!1)return et(r,{code:qe.invalid_type,expected:nt.promise,received:r.parsedType}),It;let n=r.parsedType===nt.promise?r.data:Promise.resolve(r.data);return On(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(So,"ZodPromise");So.create=(e,t)=>new So({type:e,typeName:Ct.ZodPromise,...jt(t)});var Xn=class extends Lt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ct.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),a=this._def.effect||null,s={addIssue:c=>{et(n,c),c.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let c=a.transform(n.data,s);if(n.common.async)return Promise.resolve(c).then(async l=>{if(r.value==="aborted")return It;let d=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return d.status==="aborted"?It:d.status==="dirty"||r.value==="dirty"?ju(d.value):d});{if(r.value==="aborted")return It;let l=this._def.schema._parseSync({data:c,path:n.path,parent:n});return l.status==="aborted"?It:l.status==="dirty"||r.value==="dirty"?ju(l.value):l}}if(a.type==="refinement"){let c=i(l=>{let d=a.refinement(l,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l},"executeRefinement");if(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?It:(l.status==="dirty"&&r.dirty(),c(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?It:(l.status==="dirty"&&r.dirty(),c(l.value).then(()=>({status:r.value,value:l.value}))))}if(a.type==="transform")if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Qf(c))return c;let l=a.transform(c.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>Qf(c)?Promise.resolve(a.transform(c.value,s)).then(l=>({status:r.value,value:l})):c);rr.assertNever(a)}};i(Xn,"ZodEffects");Xn.create=(e,t,r)=>new Xn({schema:e,typeName:Ct.ZodEffects,effect:t,...jt(r)});Xn.createWithPreprocess=(e,t,r)=>new Xn({schema:t,effect:{type:"preprocess",transform:e},typeName:Ct.ZodEffects,...jt(r)});var wi=class extends Lt{_parse(t){return this._getType(t)===nt.undefined?On(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(wi,"ZodOptional");wi.create=(e,t)=>new wi({innerType:e,typeName:Ct.ZodOptional,...jt(t)});var la=class extends Lt{_parse(t){return this._getType(t)===nt.null?On(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(la,"ZodNullable");la.create=(e,t)=>new la({innerType:e,typeName:Ct.ZodNullable,...jt(t)});var ps=class extends Lt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===nt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};i(ps,"ZodDefault");ps.create=(e,t)=>new ps({innerType:e,typeName:Ct.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...jt(t)});var ms=class extends Lt{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ed(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Sn(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Sn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};i(ms,"ZodCatch");ms.create=(e,t)=>new ms({innerType:e,typeName:Ct.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...jt(t)});var bc=class extends Lt{_parse(t){if(this._getType(t)!==nt.nan){let n=this._getOrReturnCtx(t);return et(n,{code:qe.invalid_type,expected:nt.nan,received:n.parsedType}),It}return{status:"valid",value:t.data}}};i(bc,"ZodNaN");bc.create=e=>new bc({typeName:Ct.ZodNaN,...jt(e)});var SF=Symbol("zod_brand"),$u=class extends Lt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};i($u,"ZodBranded");var gs=class extends Lt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return i(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?It:s.status==="dirty"?(r.dirty(),ju(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?It:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(t,r){return new gs({in:t,out:r,typeName:Ct.ZodPipeline})}};i(gs,"ZodPipeline");var vs=class extends Lt{_parse(t){let r=this._def.innerType._parse(t),n=i(a=>(Qf(a)&&(a.value=Object.freeze(a.value)),a),"freeze");return ed(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}};i(vs,"ZodReadonly");vs.create=(e,t)=>new vs({innerType:e,typeName:Ct.ZodReadonly,...jt(t)});function h7(e,t={},r){return e?Eo.create().superRefine((n,a)=>{var s,c;if(!e(n)){let l=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,d=(c=(s=l.fatal)!==null&&s!==void 0?s:r)!==null&&c!==void 0?c:!0,p=typeof l=="string"?{message:l}:l;a.addIssue({code:"custom",...p,fatal:d})}}):Eo.create()}i(h7,"custom");var xF={object:Tr.lazycreate},Ct;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ct||(Ct={}));var TF=i((e,t={message:`Input not instance of ${e.name}`})=>h7(r=>r instanceof e,t),"instanceOfType"),p7=Jn.create,m7=sa.create,CF=bc.create,MF=ca.create,g7=as.create,IF=$a.create,kF=mc.create,DF=os.create,RF=ss.create,OF=Eo.create,NF=za.create,PF=qi.create,BF=gc.create,LF=Yn.create,UF=Tr.create,FF=Tr.strictCreate,jF=cs.create,$F=vc.create,zF=us.create,HF=bi.create,qF=ls.create,VF=yc.create,KF=Ha.create,GF=Ao.create,WF=fs.create,ZF=ds.create,JF=ua.create,YF=hs.create,XF=So.create,o7=Xn.create,QF=wi.create,ej=la.create,tj=Xn.createWithPreprocess,rj=gs.create,nj=i(()=>p7().optional(),"ostring"),ij=i(()=>m7().optional(),"onumber"),aj=i(()=>g7().optional(),"oboolean"),oj={string:e=>Jn.create({...e,coerce:!0}),number:e=>sa.create({...e,coerce:!0}),boolean:e=>as.create({...e,coerce:!0}),bigint:e=>ca.create({...e,coerce:!0}),date:e=>$a.create({...e,coerce:!0})},sj=It,P=Object.freeze({__proto__:null,defaultErrorMap:zu,setErrorMap:sF,getErrorMap:D0,makeIssue:R0,EMPTY_PATH:cF,addIssueToContext:et,ParseStatus:Yr,INVALID:It,DIRTY:ju,OK:On,isAborted:Yy,isDirty:Xy,isValid:Qf,isAsync:ed,get util(){return rr},get objectUtil(){return Jy},ZodParsedType:nt,getParsedType:is,ZodType:Lt,datetimeRegex:f7,ZodString:Jn,ZodNumber:sa,ZodBigInt:ca,ZodBoolean:as,ZodDate:$a,ZodSymbol:mc,ZodUndefined:os,ZodNull:ss,ZodAny:Eo,ZodUnknown:za,ZodNever:qi,ZodVoid:gc,ZodArray:Yn,ZodObject:Tr,ZodUnion:cs,ZodDiscriminatedUnion:vc,ZodIntersection:us,ZodTuple:bi,ZodRecord:ls,ZodMap:yc,ZodSet:Ha,ZodFunction:Ao,ZodLazy:fs,ZodLiteral:ds,ZodEnum:ua,ZodNativeEnum:hs,ZodPromise:So,ZodEffects:Xn,ZodTransformer:Xn,ZodOptional:wi,ZodNullable:la,ZodDefault:ps,ZodCatch:ms,ZodNaN:bc,BRAND:SF,ZodBranded:$u,ZodPipeline:gs,ZodReadonly:vs,custom:h7,Schema:Lt,ZodSchema:Lt,late:xF,get ZodFirstPartyTypeKind(){return Ct},coerce:oj,any:OF,array:LF,bigint:MF,boolean:g7,date:IF,discriminatedUnion:$F,effect:o7,enum:JF,function:GF,instanceof:TF,intersection:zF,lazy:WF,literal:ZF,map:VF,nan:CF,nativeEnum:YF,never:PF,null:RF,nullable:ej,number:m7,object:UF,oboolean:aj,onumber:ij,optional:QF,ostring:nj,pipeline:rj,preprocess:tj,promise:XF,record:qF,set:KF,strictObject:FF,string:p7,symbol:kF,transformer:o7,tuple:HF,undefined:DF,union:jF,unknown:NF,void:BF,NEVER:sj,ZodIssueCode:qe,quotelessJson:oF,ZodError:Sn});var Hu=Symbol("current"),wc=Symbol("previous");var td=i((e,{ref:t,refType:r,param:n,header:a,...s}={})=>({...s,...e}),"mergeOpenApi");function v7(e){if(typeof e.ZodType.prototype.openapi<"u")return;e.ZodType.prototype.openapi=function(s){let{zodOpenApi:c,...l}=this._def,d=new this.constructor({...l,zodOpenApi:{openapi:td(s,c?.openapi)}});return d._def.zodOpenApi[Hu]=d,c&&(d._def.zodOpenApi[wc]=this),d};let t=e.ZodType.prototype.describe;e.ZodType.prototype.describe=function(...s){let c=t.apply(this,s),l=c._def;if(l.zodOpenApi){let d={...l.zodOpenApi};d.openapi=td({description:s[0]},d.openapi),d[wc]=this,d[Hu]=c,l.zodOpenApi=d}else l.zodOpenApi={openapi:{description:s[0]},[Hu]:c};return c};let r=e.ZodObject.prototype.extend;e.ZodObject.prototype.extend=function(...s){let c=r.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=td({},d.openapi),d[wc]=this,c._def.zodOpenApi=d}else c._def.zodOpenApi={[wc]:this};return c};let n=e.ZodObject.prototype.omit;e.ZodObject.prototype.omit=function(...s){let c=n.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=td({},d.openapi),delete d[wc],delete d[Hu],c._def.zodOpenApi=d}return c};let a=e.ZodObject.prototype.pick;e.ZodObject.prototype.pick=function(...s){let c=a.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=td({},d.openapi),delete d[wc],delete d[Hu],c._def.zodOpenApi=d}return c}}i(v7,"extendZodWithOpenApi");v7(P);var cj=Object.defineProperty,uj=i((e,t)=>cj(e,"name",{value:t,configurable:!0}),"__name"),P0=P.array(P.string().or(P.record(P.any()))),rX=P.object({type:P.string().optional(),narrative:P.string().optional()}),B0=P.string().or(P.object({id:P.string(),type:P.string(),caption:P.string().optional()})),lj=P.object({type:P.string().min(1).or(P.string().array().nonempty()),latitude:P.number(),longitude:P.number()}),fj=P.object({type:P.string().min(1).or(P.string().array().nonempty()),addressCountry:P.string().optional(),addressCountryCode:P.string().optional(),addressRegion:P.string().optional(),addressLocality:P.string().optional(),streetAddress:P.string().optional(),postOfficeBoxNumber:P.string().optional(),postalCode:P.string().optional(),geo:lj.optional()}),dj=P.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(P.string()),C7=P.object({type:P.string().min(1).or(P.string().array().nonempty()),identifier:P.string(),identifierType:dj}),rd=P.string().or(P.object({id:P.string().optional(),type:P.string().or(P.string().array().nonempty().optional()),name:P.string().optional(),url:P.string().optional(),phone:P.string().optional(),description:P.string().optional(),endorsement:P.any().array().optional(),image:B0.optional(),email:P.string().email().optional(),address:fj.optional(),otherIdentifier:C7.array().optional(),official:P.string().optional(),parentOrg:P.any().optional(),familyName:P.string().optional(),givenName:P.string().optional(),additionalName:P.string().optional(),patronymicName:P.string().optional(),honorificPrefix:P.string().optional(),honorificSuffix:P.string().optional(),familyNamePrefix:P.string().optional(),dateOfBirth:P.string().optional()}).catchall(P.any())),eb=P.object({id:P.string().optional()}).catchall(P.any()),N0=P.object({type:P.string(),id:P.string()}).catchall(P.any()),y7=P.object({id:P.string(),type:P.string()}).catchall(P.any()),b7=P.object({id:P.string().optional(),type:P.string()}).catchall(P.any()),w7=P.object({type:P.string(),id:P.string().optional()}).catchall(P.any()),_7=P.object({type:P.string().or(P.string().array().nonempty()),id:P.string().optional()}).catchall(P.any()),nd=P.object({"@context":P0,id:P.string().optional(),type:P.string().array().nonempty(),issuer:rd,credentialSubject:eb.or(eb.array()),refreshService:b7.or(b7.array()).optional(),credentialSchema:y7.or(y7.array()).optional(),issuanceDate:P.string().optional(),expirationDate:P.string().optional(),credentialStatus:N0.or(N0.array()).optional(),name:P.string().optional(),description:P.string().optional(),validFrom:P.string().optional(),validUntil:P.string().optional(),status:N0.or(N0.array()).optional(),termsOfUse:w7.or(w7.array()).optional(),evidence:_7.or(_7.array()).optional()}).catchall(P.any()),qa=P.object({type:P.string(),created:P.string(),challenge:P.string().optional(),domain:P.string().optional(),nonce:P.string().optional(),proofPurpose:P.string(),verificationMethod:P.string(),jws:P.string().optional()}).catchall(P.any()),id=nd.extend({proof:qa.or(qa.array())}),hj=P.object({"@context":P0,id:P.string().optional(),type:P.string().or(P.string().array().nonempty()),verifiableCredential:id.or(id.array()).optional(),holder:P.string().optional()}).catchall(P.any()),pj=hj.extend({proof:qa.or(qa.array())}),nb=P.object({kty:P.string(),crv:P.string(),x:P.string(),y:P.string().optional(),n:P.string().optional(),d:P.string().optional()}),aX=nb.omit({d:!0}).extend({d:P.string()}),mj=P.object({alg:P.string(),iv:P.string(),tag:P.string(),epk:nb.partial().optional(),kid:P.string().optional(),apv:P.string().optional(),apu:P.string().optional()}),gj=P.object({header:mj,encrypted_key:P.string()}),vj=P.object({protected:P.string(),iv:P.string(),ciphertext:P.string(),tag:P.string(),aad:P.string().optional(),recipients:gj.array().optional()}),_c=P.string().or(P.object({"@context":P0.optional(),id:P.string(),type:P.string(),controller:P.string(),publicKeyJwk:nb.optional(),publicKeyBase58:P.string().optional(),blockChainAccountId:P.string().optional()}).catchall(P.any())),yj=P.object({id:P.string(),type:P.string().or(P.string().array().nonempty()),serviceEndpoint:P.any().or(P.any().array().nonempty())}).catchall(P.any()),oX=P.object({"@context":P0,id:P.string(),alsoKnownAs:P.string().optional(),controller:P.string().or(P.string().array().nonempty()).optional(),verificationMethod:_c.array().optional(),authentication:_c.array().optional(),assertionMethod:_c.array().optional(),keyAgreement:_c.array().optional(),capabilityInvocation:_c.array().optional(),capabilityDelegation:_c.array().optional(),publicKey:_c.array().optional(),service:yj.array().optional(),proof:qa.or(qa.array()).optional()}).catchall(P.any()),bj=P.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(P.string()),L0=P.object({type:P.string().array().nonempty(),targetCode:P.string().optional(),targetDescription:P.string().optional(),targetName:P.string(),targetFramework:P.string().optional(),targetType:bj.optional(),targetUrl:P.string()}),wj=P.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"]),_j=wj.or(P.string()),Ej=P.object({id:P.string().optional(),narrative:P.string().optional()}).catchall(P.any()),Aj=P.object({id:P.string(),type:P.string().array().nonempty(),endorsementComment:P.string().optional()}),Sj=nd.extend({credentialSubject:Aj,proof:qa.or(qa.array()).optional()}),xj=P.object({id:P.string(),"@language":P.string().optional(),version:P.string().optional()}),Tj=P.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(P.string()),Cj=P.object({id:P.string(),type:P.string().array().nonempty(),alignment:L0.array().optional(),description:P.string().optional(),level:P.string().optional(),name:P.string(),points:P.string().optional()}).catchall(P.any()),Mj=P.object({id:P.string(),type:P.string().array().nonempty(),alignment:L0.array().optional(),allowedValue:P.string().array().optional(),name:P.string(),requiredLevel:P.string().optional(),requiredValue:P.string().optional(),resultType:Tj,rubricCriterionLevel:Cj.array().optional(),valueMax:P.string().optional(),valueMin:P.string().optional()}).catchall(P.any()),Ij=P.object({id:P.string().optional(),type:P.string().array().nonempty(),alignment:L0.array().optional(),achievementType:_j.optional(),creator:rd.optional(),creditsAvailable:P.number().optional(),criteria:Ej,description:P.string(),endorsement:Sj.array().optional(),fieldOfStudy:P.string().optional(),humanCode:P.string().optional(),image:B0.optional(),"@language":P.string().optional(),name:P.string(),otherIdentifier:C7.array().optional(),related:xj.array().optional(),resultDescription:Mj.array().optional(),specialization:P.string().optional(),tag:P.string().array().optional(),version:P.string().optional()}).catchall(P.any()),kj=P.object({type:P.string(),hashed:P.boolean(),identityHash:P.string(),identityType:P.string(),salt:P.string().optional()}),Dj=P.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),Rj=P.object({type:P.string().array().nonempty(),achievedLevel:P.string().optional(),alignment:L0.array().optional(),resultDescription:P.string().optional(),status:Dj.optional(),value:P.string().optional()}).catchall(P.any()),E7=P.object({id:P.string().optional(),type:P.string().array().nonempty(),activityEndDate:P.string().optional(),activityStartDate:P.string().optional(),creditsEarned:P.number().optional(),achievement:Ij.optional(),identifier:kj.array().optional(),image:B0.optional(),licenseNumber:P.string().optional(),narrative:P.string().optional(),result:Rj.array().optional(),role:P.string().optional(),source:rd.optional(),term:P.string().optional()}).catchall(P.any()),Oj=P.object({id:P.string().optional(),type:P.string().or(P.string().array().nonempty()),narrative:P.string().optional(),name:P.string().optional(),description:P.string().optional(),genre:P.string().optional(),audience:P.string().optional()}).catchall(P.any()),Nj=nd.extend({name:P.string().optional(),description:P.string().optional(),image:B0.optional(),credentialSubject:E7.or(E7.array()),endorsement:nd.array().optional(),evidence:Oj.array().optional()}),cX=Nj.extend({proof:qa.or(qa.array())}),lX=P.object({checks:P.string().array(),warnings:P.string().array(),errors:P.string().array()}),M7=P.enum(["Success","Failed","Error"]),fX=M7.enum,dX=P.object({check:P.string(),status:M7,message:P.string().optional(),details:P.string().optional()}),hX=P.object({title:P.string().optional(),createdAt:P.string().optional(),issuer:rd.optional(),issuee:rd.optional(),credentialSubject:eb.optional()}),Ec=P.object({id:P.string(),uri:P.string()}).catchall(P.any()),gX=P.object({limit:P.number(),cursor:P.string().optional(),sort:P.string().optional()}),Nn=P.object({cursor:P.string().optional(),hasMore:P.boolean()}),I7=P.object({encryptedRecord:vj,fields:P.string().array()}).catchall(P.any()),vX=Nn.extend({records:I7.array()}),Pj=I7.extend({id:P.string()}),yX=Nn.extend({records:Pj.array()}),A7=uj(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),Bj=P.instanceof(RegExp).or(P.string().refine(e=>{try{return A7(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=A7(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),pr=P.string().or(P.object({$in:P.string().array()})).or(P.object({$regex:Bj})),Lj=P.object({backgroundColor:P.string().optional(),backgroundImage:P.string().optional(),fadeBackgroundImage:P.boolean().optional(),repeatBackgroundImage:P.boolean().optional(),fontColor:P.string().optional(),accentColor:P.string().optional(),accentFontColor:P.string().optional(),idBackgroundImage:P.string().optional(),fadeIdBackgroundImage:P.boolean().optional(),idBackgroundColor:P.string().optional(),repeatIdBackgroundImage:P.boolean().optional()}),xo=P.object({profileId:P.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),displayName:P.string().default("").describe("Human-readable display name for the profile."),shortBio:P.string().default("").describe("Short bio for the profile."),bio:P.string().default("").describe("Longer bio for the profile."),did:P.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),isPrivate:P.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),email:P.string().optional().describe("Contact email address for the profile. (deprecated)"),image:P.string().optional().describe("Profile image URL for the profile."),heroImage:P.string().optional().describe("Hero image URL for the profile."),websiteLink:P.string().optional().describe("Website link for the profile."),isServiceProfile:P.boolean().default(!1).optional().describe("Whether the profile is a service profile or not."),type:P.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),notificationsWebhook:P.string().url().startsWith("http").optional().describe("URL to send notifications to."),display:Lj.optional().describe("Display settings for the profile."),highlightedCredentials:P.array(P.string()).max(5).optional().describe("Up to 5 unique boost URIs to highlight on the profile."),role:P.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),dob:P.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')}),_X=P.object({profileId:pr,displayName:pr,shortBio:pr,bio:pr,email:pr,websiteLink:pr,isServiceProfile:P.boolean(),type:pr}).partial(),EX=Nn.extend({records:xo.array()}),AX=P.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),k7=P.object({id:P.string(),created:P.string(),displayName:P.string().default("").optional(),shortBio:P.string().default("").optional(),bio:P.string().default("").optional(),email:P.string().optional(),image:P.string().optional(),heroImage:P.string().optional()}),SX=Nn.extend({records:k7.extend({did:P.string()}).array()}),xX=P.object({id:pr,displayName:pr,shortBio:pr,bio:pr,email:pr}).partial(),TX=Nn.extend({records:P.object({profile:xo,manager:k7.extend({did:P.string()}).optional()}).array()}),CX=P.object({uri:P.string(),to:P.string(),from:P.string(),sent:P.string().datetime(),received:P.string().datetime().optional()}),D7=P.object({role:P.string(),canEdit:P.boolean(),canIssue:P.boolean(),canRevoke:P.boolean(),canManagePermissions:P.boolean(),canIssueChildren:P.string(),canCreateChildren:P.string(),canEditChildren:P.string(),canRevokeChildren:P.string(),canManageChildrenPermissions:P.string(),canManageChildrenProfiles:P.boolean().default(!1).optional(),canViewAnalytics:P.boolean()}),Uj=P.object({role:pr,canEdit:P.boolean(),canIssue:P.boolean(),canRevoke:P.boolean(),canManagePermissions:P.boolean(),canIssueChildren:pr,canCreateChildren:pr,canEditChildren:pr,canRevokeChildren:pr,canManageChildrenPermissions:pr,canManageChildrenProfiles:P.boolean(),canViewAnalytics:P.boolean()}).partial(),S7=P.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),Fj=P.discriminatedUnion("type",[P.object({type:P.literal(S7.Values.GRANT_PERMISSIONS),data:P.object({claimUri:P.string(),targetUri:P.string(),permissions:D7.partial()})}),P.object({type:P.literal(S7.Values.ADD_ADMIN),data:P.object({claimUri:P.string(),targetUri:P.string()})})]),MX=P.object({type:pr,data:P.object({claimUri:pr,targetUri:pr,permissions:Uj})}).deepPartial(),jj=P.object({id:P.string(),createdAt:P.string(),updatedAt:P.string()}).and(Fj),IX=Nn.extend({records:jj.array()}),tb=P.enum(["DRAFT","LIVE"]),$j=P.object({uri:P.string(),name:P.string().optional(),type:P.string().optional(),category:P.string().optional(),status:tb.optional(),autoConnectRecipients:P.boolean().optional(),meta:P.record(P.any()).optional(),claimPermissions:D7.optional(),allowAnyoneToCreateChildren:P.boolean().optional()}),kX=P.object({uri:pr,name:pr,type:pr,category:pr,meta:P.record(pr),status:tb.or(P.object({$in:tb.array()})),autoConnectRecipients:P.boolean()}).partial(),DX=Nn.extend({records:$j.array()}),zj=P.object({to:xo,from:P.string(),received:P.string().optional(),uri:P.string().optional()}),RX=Nn.extend({records:zj.array()}),Hj=P.object({to:xo,from:P.string(),received:P.string().optional(),boostUris:P.array(P.string()),credentialUris:P.array(P.string()).optional()}),OX=Nn.extend({records:Hj.array()}),NX=P.object({endpoint:P.string(),name:P.string(),did:P.string().optional()}),PX=P.object({ttlSeconds:P.number().optional(),totalUses:P.number().optional()}),qj=P.object({endpoint:P.string()}),BX=P.object({signingAuthority:qj,relationship:P.object({name:P.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:P.string(),isPrimary:P.boolean().optional()})}),LX=P.object({boostUri:P.string(),signingAuthority:P.object({endpoint:P.string(),name:P.string()})}),Vj=P.enum(["live","stale","withdrawn"]),Kj=P.object({read:P.object({anonymize:P.boolean().optional(),credentials:P.object({categories:P.record(P.object({required:P.boolean(),defaultEnabled:P.boolean().optional()})).default({})}).default({}),personal:P.record(P.object({required:P.boolean(),defaultEnabled:P.boolean().optional()})).default({})}).default({}),write:P.object({credentials:P.object({categories:P.record(P.object({required:P.boolean(),defaultEnabled:P.boolean().optional()})).default({})}).default({}),personal:P.record(P.object({required:P.boolean(),defaultEnabled:P.boolean().optional()})).default({})}).default({})}),R7=P.object({contract:Kj,owner:xo,name:P.string(),subtitle:P.string().optional(),description:P.string().optional(),reasonForAccessing:P.string().optional(),image:P.string().optional(),uri:P.string(),needsGuardianConsent:P.boolean().optional(),redirectUrl:P.string().optional(),frontDoorBoostUri:P.string().optional(),createdAt:P.string(),updatedAt:P.string(),expiresAt:P.string().optional(),autoBoosts:P.string().array().optional(),writers:P.array(xo).optional()}),UX=Nn.extend({records:R7.omit({owner:!0}).array()}),Gj=P.object({credentials:P.object({categories:P.record(P.string().array()).default({})}),personal:P.record(P.string()).default({}),date:P.string()}),FX=Nn.extend({records:Gj.array()}),Wj=P.object({credentials:P.object({category:P.string(),uri:P.string()}).array(),personal:P.record(P.string()).default({}),date:P.string(),contractUri:P.string()}),jX=Nn.extend({records:Wj.array()}),O7=P.object({sharing:P.boolean().optional(),shared:P.string().array().optional(),shareAll:P.boolean().optional(),shareUntil:P.string().optional()}),N7=P.object({read:P.object({anonymize:P.boolean().optional(),credentials:P.object({shareAll:P.boolean().optional(),sharing:P.boolean().optional(),categories:P.record(O7).default({})}).default({}),personal:P.record(P.string()).default({})}).default({}),write:P.object({credentials:P.object({categories:P.record(P.boolean()).default({})}).default({}),personal:P.record(P.boolean()).default({})}).default({}),deniedWriters:P.array(P.string()).optional()}),$X=Nn.extend({records:P.object({expiresAt:P.string().optional(),oneTime:P.boolean().optional(),terms:N7,contract:R7,uri:P.string(),consenter:xo,status:Vj}).array()}),zX=P.object({read:P.object({anonymize:P.boolean().optional(),credentials:P.object({categories:P.record(P.object({required:P.boolean().optional()})).optional()}).optional(),personal:P.record(P.object({required:P.boolean().optional()})).optional()}).optional(),write:P.object({credentials:P.object({categories:P.record(P.object({required:P.boolean().optional()})).optional()}).optional(),personal:P.record(P.object({required:P.boolean().optional()})).optional()}).optional()}),HX=P.object({anonymize:P.boolean().optional(),credentials:P.object({categories:P.record(P.boolean()).optional()}).optional(),personal:P.record(P.boolean()).optional()}),qX=P.object({credentials:P.object({categories:P.record(P.boolean()).optional()}).optional(),personal:P.record(P.boolean()).optional(),id:pr.optional()}),Zj=P.object({read:P.object({anonymize:P.boolean().optional(),credentials:P.object({shareAll:P.boolean().optional(),sharing:P.boolean().optional(),categories:P.record(O7.optional()).optional()}).optional(),personal:P.record(P.string()).optional()}).optional(),write:P.object({credentials:P.object({categories:P.record(P.boolean()).optional()}).optional(),personal:P.record(P.boolean()).optional()}).optional()}),rb=P.enum(["consent","update","sync","withdraw","write"]),VX=P.object({terms:Zj.optional(),action:rb.or(rb.array()).optional(),date:P.object({$gt:P.string()}).or(P.object({$lt:P.string()})).or(P.object({$eq:P.string()})).optional(),expiresAt:P.object({$gt:P.string()}).or(P.object({$lt:P.string()})).or(P.object({$eq:P.string()})).optional(),oneTime:P.boolean().optional()}),P7=P.object({expiresAt:P.string().optional(),oneTime:P.boolean().optional(),terms:N7.optional(),id:P.string(),action:rb,date:P.string(),uris:P.string().array().optional()}),KX=Nn.extend({records:P7.array()}),Jj=P.object({credentialUri:P.string(),termsUri:P.string(),contractUri:P.string(),boostUri:P.string(),category:P.string().optional(),date:P.string()}),GX=Nn.extend({records:Jj.array()}),Yj=P.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION","ISSUANCE_CLAIMED","ISSUANCE_DELIVERED","ISSUANCE_ERROR"]),Xj=P.object({title:P.string().optional(),body:P.string().optional()}),Qj=P.object({type:P.string(),value:P.string()}),U0=P.enum(["PENDING","DELIVERED","CLAIMED","EXPIRED"]),e$=P.object({issuanceId:P.string(),status:U0,recipient:P.object({contactMethod:Qj.optional(),learnCardId:P.string().optional()}),timestamp:P.string().datetime().optional()}),t$=P.object({vcUris:P.array(P.string()).optional(),vpUris:P.array(P.string()).optional(),transaction:P7.optional(),inbox:e$.optional()}),WX=P.object({type:Yj,to:xo.partial().and(P.object({did:P.string()})),from:xo.partial().and(P.object({did:P.string()})),message:Xj.optional(),data:t$.optional(),sent:P.string().datetime().optional(),webhookUrl:P.string().optional()}),r$="auth-grant:",ZX=P.object({id:P.string(),name:P.string(),description:P.string().optional(),challenge:P.string().startsWith(r$).min(10,{message:"Challenge is too short"}).max(100,{message:"Challenge is too long"}),status:P.enum(["revoked","active"],{required_error:"Status is required",invalid_type_error:"Status must be either active or revoked"}),scope:P.string(),createdAt:P.string().datetime({message:"createdAt must be a valid ISO 8601 datetime string"}),expiresAt:P.string().datetime({message:"expiresAt must be a valid ISO 8601 datetime string"}).nullish().optional()}),JX=P.object({id:P.string()}).catchall(P.any()),n$=P.enum(["active","revoked"]),YX=P.object({id:pr,name:pr,description:pr,status:n$}).partial(),x7=P.object({id:P.string(),isVerified:P.boolean(),verifiedAt:P.string().optional(),isPrimary:P.boolean(),createdAt:P.string()}),XX=P.discriminatedUnion("type",[P.object({type:P.literal("email"),value:P.string().email()}).merge(x7),P.object({type:P.literal("phone"),value:P.string()}).merge(x7)]),T7=P.object({isVerified:P.boolean().optional(),isPrimary:P.boolean().optional()}),QX=P.discriminatedUnion("type",[P.object({type:P.literal("email"),value:P.string().email()}).merge(T7),P.object({type:P.literal("phone"),value:P.string()}).merge(T7)]),B7=P.discriminatedUnion("type",[P.object({type:P.literal("email"),value:P.string().email()}),P.object({type:P.literal("phone"),value:P.string()})]),eQ=P.object({value:P.string(),type:P.enum(["email","phone"])}),tQ=P.object({token:P.string()}),rQ=P.object({contactMethodId:P.string()}),i$=P.object({id:P.string(),credential:P.string(),isSigned:P.boolean(),currentStatus:U0,expiresAt:P.string(),createdAt:P.string(),issuerDid:P.string(),webhookUrl:P.string().optional(),signingAuthority:P.object({endpoint:P.string().optional(),name:P.string().optional()}).optional()}),nQ=P.object({hasMore:P.boolean(),records:P.array(i$),cursor:P.string().optional()}),iQ=P.object({currentStatus:U0,id:P.string(),isSigned:P.boolean(),issuerDid:P.string()}).partial(),a$=P.object({endpoint:P.string().url(),name:P.string()}),aQ=P.object({recipient:B7.describe("The recipient of the credential"),credential:id.passthrough().or(pj.passthrough()).or(nd.passthrough()).describe("The credential to issue. If not signed, the users default signing authority will be used, or the specified signing authority in the configuration."),configuration:P.object({signingAuthority:a$.optional().describe("The signing authority to use for the credential. If not provided, the users default signing authority will be used if the credential is not signed."),webhookUrl:P.string().url().optional().describe("The webhook URL to receive credential issuance events."),expiresInDays:P.number().min(1).max(365).optional().describe("The number of days the credential will be valid for."),delivery:P.object({suppress:P.boolean().optional().default(!1).describe("Whether to suppress delivery of the credential to the recipient. If true, the email/sms will not be sent to the recipient. Useful if you would like to manually send claim link to your users."),template:P.object({id:P.enum(["universal-inbox-claim"]).optional().describe("The template ID to use for the credential delivery. If not provided, the default template will be used."),model:P.object({issuer:P.object({name:P.string().optional().describe('The name of the organization (e.g., "State University").'),logoUrl:P.string().url().optional().describe("The URL of the organization's logo.")}).optional(),credential:P.object({name:P.string().optional().describe('The name of the credential (e.g., "Bachelor of Science").'),type:P.string().optional().describe('The type of the credential (e.g., "degree", "certificate").')}).optional(),recipient:P.object({name:P.string().optional().describe('The name of the recipient (e.g., "John Doe").')}).optional()}).describe("The template model to use for the credential delivery. Injects via template variables into email/sms templates. If not provided, the default template will be used.")}).optional().describe("The template to use for the credential delivery. If not provided, the default template will be used.")}).optional().describe("Configuration for the credential delivery i.e. email or SMS. When credentials are sent to a user who has a verified email or phone associated with their account, delivery is skipped, and the credential will be sent using in-app notifications. If not provided, the default configuration will be used.")}).optional().describe("Configuration for the credential issuance. If not provided, the default configuration will be used.")}),oQ=P.object({issuanceId:P.string(),status:U0,recipient:B7,claimUrl:P.string().url().optional(),recipientDid:P.string().optional()}),sQ=P.object({token:P.string(),contactMethodId:P.string(),autoVerifyContactMethod:P.boolean().optional().default(!1),createdAt:P.string(),expiresAt:P.string(),used:P.boolean()});var o$=Object.create,Hd=Object.defineProperty,s$=Object.getOwnPropertyDescriptor,O6=Object.getOwnPropertyNames,c$=Object.getPrototypeOf,u$=Object.prototype.hasOwnProperty,o=i((e,t)=>Hd(e,"name",{value:t,configurable:!0}),"__name"),Rb=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')}),gr=i((e,t)=>i(function(){return e&&(t=(0,e[O6(e)[0]])(e=0)),t},"__init"),"__esm"),ze=i((e,t)=>i(function(){return t||(0,e[O6(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require2"),"__commonJS"),Sr=i((e,t)=>{for(var r in t)Hd(e,r,{get:t[r],enumerable:!0})},"__export"),ax=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of O6(t))!u$.call(e,a)&&a!==r&&Hd(e,a,{get:()=>t[a],enumerable:!(n=s$(t,a))||n.enumerable});return e},"__copyProps"),ir=i((e,t,r)=>(r=e!=null?o$(c$(e)):{},ax(t||!e||!e.__esModule?Hd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),ib=i(e=>ax(Hd({},"__esModule",{value:!0}),e),"__toCommonJS"),l$=ze({"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(e,t){(function(){var r,n="4.17.21",a=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",p=500,g="__lodash_placeholder__",v=1,y=2,_=4,x=1,O=2,D=1,L=2,Z=4,z=8,q=16,Q=32,Y=64,k=128,K=256,he=512,me=30,we="...",J=800,w=16,T=1,b=2,f=3,m=1/0,E=9007199254740991,R=17976931348623157e292,C=0/0,A=4294967295,U=A-1,V=A>>>1,I=[["ary",k],["bind",D],["bindKey",L],["curry",z],["curryRight",q],["flip",he],["partial",Q],["partialRight",Y],["rearg",K]],j="[object Arguments]",ge="[object Array]",F="[object AsyncFunction]",ne="[object Boolean]",oe="[object Date]",M="[object DOMException]",G="[object Error]",ae="[object Function]",fe="[object GeneratorFunction]",be="[object Map]",Re="[object Number]",X="[object Null]",N="[object Object]",$="[object Promise]",W="[object Proxy]",ie="[object RegExp]",ee="[object Set]",ue="[object String]",Ae="[object Symbol]",De="[object Undefined]",Ie="[object WeakMap]",Be="[object WeakSet]",Ke="[object ArrayBuffer]",ve="[object DataView]",pe="[object Float32Array]",re="[object Float64Array]",le="[object Int8Array]",_e="[object Int16Array]",Te="[object Int32Array]",Ce="[object Uint8Array]",Oe="[object Uint8ClampedArray]",Dt="[object Uint16Array]",Ge="[object Uint32Array]",He=/\b__p \+= '';/g,Pt=/\b(__p \+=) '' \+/g,pt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,vt=/&(?:amp|lt|gt|quot|#39);/g,Or=/[&<>"']/g,lt=RegExp(vt.source),ft=RegExp(Or.source),lr=/<%-([\s\S]+?)%>/g,dt=/<%([\s\S]+?)%>/g,at=/<%=([\s\S]+?)%>/g,or=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ot=/^\w*$/,Xe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qt=/[\\^$.*+?()[\]{}|]/g,st=RegExp(Qt.source),rt=/^\s+/,sr=/\s/,ct=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Je=/\{\n\/\* \[wrapped with (.+)\] \*/,cr=/,? & /,ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,St=/[()=,{}\[\]\/\s]/,Tn=/\\(\\)?/g,xt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yt=/\w*$/,hn=/^[-+]0x[0-9a-f]+$/i,er=/^0b[01]+$/i,tr=/^\[object .+?Constructor\]$/,nn=/^0o[0-7]+$/i,an=/^(?:0|[1-9]\d*)$/,Nr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vr=/($^)/,on=/['\n\r\u2028\u2029\\]/g,Cn="\\ud800-\\udfff",ki="\\u0300-\\u036f",Di="\\ufe20-\\ufe2f",Ri="\\u20d0-\\u20ff",jn=ki+Di+Ri,pn="\\u2700-\\u27bf",ii="a-z\\xdf-\\xf6\\xf8-\\xff",$n="\\xac\\xb1\\xd7\\xf7",Oi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ni="\\u2000-\\u206f",Pi=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ro="A-Z\\xc0-\\xd6\\xd8-\\xde",no="\\ufe0e\\ufe0f",io=$n+Oi+Ni+Pi,zo="['\u2019]",ah="["+Cn+"]",Nl="["+io+"]",Us="["+jn+"]",Pl="\\d+",oh="["+pn+"]",Bl="["+ii+"]",Ll="[^"+Cn+io+Pl+pn+ii+ro+"]",Fs="\\ud83c[\\udffb-\\udfff]",sh="(?:"+Us+"|"+Fs+")",Ul="[^"+Cn+"]",ao="(?:\\ud83c[\\udde6-\\uddff]){2}",Yi="[\\ud800-\\udbff][\\udc00-\\udfff]",oo="["+ro+"]",Sa="\\u200d",Fl="(?:"+Bl+"|"+Ll+")",ch="(?:"+oo+"|"+Ll+")",jl="(?:"+zo+"(?:d|ll|m|re|s|t|ve))?",$l="(?:"+zo+"(?:D|LL|M|RE|S|T|VE))?",zl=sh+"?",Hl="["+no+"]?",ql="(?:"+Sa+"(?:"+[Ul,ao,Yi].join("|")+")"+Hl+zl+")*",xa="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",uh="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Jc=Hl+zl+ql,lh="(?:"+[oh,ao,Yi].join("|")+")"+Jc,Vl="(?:"+[Ul+Us+"?",Us,ao,Yi,ah].join("|")+")",Kl=RegExp(zo,"g"),fh=RegExp(Us,"g"),Gl=RegExp(Fs+"(?="+Fs+")|"+Vl+Jc,"g"),Wl=RegExp([oo+"?"+Bl+"+"+jl+"(?="+[Nl,oo,"$"].join("|")+")",ch+"+"+$l+"(?="+[Nl,oo+Fl,"$"].join("|")+")",oo+"?"+Fl+"+"+jl,oo+"+"+$l,uh,xa,Pl,lh].join("|"),"g"),dh=RegExp("["+Sa+Cn+jn+no+"]"),js=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,hh=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Yc=-1,wr={};wr[pe]=wr[re]=wr[le]=wr[_e]=wr[Te]=wr[Ce]=wr[Oe]=wr[Dt]=wr[Ge]=!0,wr[j]=wr[ge]=wr[Ke]=wr[ne]=wr[ve]=wr[oe]=wr[G]=wr[ae]=wr[be]=wr[Re]=wr[N]=wr[ie]=wr[ee]=wr[ue]=wr[Ie]=!1;var vr={};vr[j]=vr[ge]=vr[Ke]=vr[ve]=vr[ne]=vr[oe]=vr[pe]=vr[re]=vr[le]=vr[_e]=vr[Te]=vr[be]=vr[Re]=vr[N]=vr[ie]=vr[ee]=vr[ue]=vr[Ae]=vr[Ce]=vr[Oe]=vr[Dt]=vr[Ge]=!0,vr[G]=vr[ae]=vr[Ie]=!1;var de={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Me={"&":"&","<":"<",">":">",'"':""","'":"'"},Le={"&":"&","<":"<",">":">",""":'"',"'":"'"},mt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Kr=parseFloat,sn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,mn=typeof self=="object"&&self&&self.Object===Object&&self,Fr=Mn||mn||Function("return this")(),Ta=typeof e=="object"&&e&&!e.nodeType&&e,Ca=Ta&&typeof t=="object"&&t&&!t.nodeType&&t,Zl=Ca&&Ca.exports===Ta,Xc=Zl&&Mn.process,gn=function(){try{var Se=Ca&&Ca.require&&Ca.require("util").types;return Se||Xc&&Xc.binding&&Xc.binding("util")}catch{}}(),$s=gn&&gn.isArrayBuffer,v2=gn&&gn.isDate,y2=gn&&gn.isMap,b2=gn&&gn.isRegExp,w2=gn&&gn.isSet,_2=gn&&gn.isTypedArray;function zn(Se,Pe,ke){switch(ke.length){case 0:return Se.call(Pe);case 1:return Se.call(Pe,ke[0]);case 2:return Se.call(Pe,ke[0],ke[1]);case 3:return Se.call(Pe,ke[0],ke[1],ke[2])}return Se.apply(Pe,ke)}i(zn,"apply"),o(zn,"apply");function E2(Se,Pe,ke,ht){for(var Nt=-1,fr=Se==null?0:Se.length;++Nt<fr;){var Wr=Se[Nt];Pe(ht,Wr,ke(Wr),Se)}return ht}i(E2,"arrayAggregator"),o(E2,"arrayAggregator");function ai(Se,Pe){for(var ke=-1,ht=Se==null?0:Se.length;++ke<ht&&Pe(Se[ke],ke,Se)!==!1;);return Se}i(ai,"arrayEach"),o(ai,"arrayEach");function A2(Se,Pe){for(var ke=Se==null?0:Se.length;ke--&&Pe(Se[ke],ke,Se)!==!1;);return Se}i(A2,"arrayEachRight"),o(A2,"arrayEachRight");function E1(Se,Pe){for(var ke=-1,ht=Se==null?0:Se.length;++ke<ht;)if(!Pe(Se[ke],ke,Se))return!1;return!0}i(E1,"arrayEvery"),o(E1,"arrayEvery");function so(Se,Pe){for(var ke=-1,ht=Se==null?0:Se.length,Nt=0,fr=[];++ke<ht;){var Wr=Se[ke];Pe(Wr,ke,Se)&&(fr[Nt++]=Wr)}return fr}i(so,"arrayFilter"),o(so,"arrayFilter");function Jl(Se,Pe){var ke=Se==null?0:Se.length;return!!ke&&zs(Se,Pe,0)>-1}i(Jl,"arrayIncludes"),o(Jl,"arrayIncludes");function ph(Se,Pe,ke){for(var ht=-1,Nt=Se==null?0:Se.length;++ht<Nt;)if(ke(Pe,Se[ht]))return!0;return!1}i(ph,"arrayIncludesWith"),o(ph,"arrayIncludesWith");function Mr(Se,Pe){for(var ke=-1,ht=Se==null?0:Se.length,Nt=Array(ht);++ke<ht;)Nt[ke]=Pe(Se[ke],ke,Se);return Nt}i(Mr,"arrayMap"),o(Mr,"arrayMap");function co(Se,Pe){for(var ke=-1,ht=Pe.length,Nt=Se.length;++ke<ht;)Se[Nt+ke]=Pe[ke];return Se}i(co,"arrayPush"),o(co,"arrayPush");function mh(Se,Pe,ke,ht){var Nt=-1,fr=Se==null?0:Se.length;for(ht&&fr&&(ke=Se[++Nt]);++Nt<fr;)ke=Pe(ke,Se[Nt],Nt,Se);return ke}i(mh,"arrayReduce"),o(mh,"arrayReduce");function S2(Se,Pe,ke,ht){var Nt=Se==null?0:Se.length;for(ht&&Nt&&(ke=Se[--Nt]);Nt--;)ke=Pe(ke,Se[Nt],Nt,Se);return ke}i(S2,"arrayReduceRight"),o(S2,"arrayReduceRight");function gh(Se,Pe){for(var ke=-1,ht=Se==null?0:Se.length;++ke<ht;)if(Pe(Se[ke],ke,Se))return!0;return!1}i(gh,"arraySome"),o(gh,"arraySome");var qD=vh("length");function x2(Se){return Se.split("")}i(x2,"asciiToArray"),o(x2,"asciiToArray");function T2(Se){return Se.match(ut)||[]}i(T2,"asciiWords"),o(T2,"asciiWords");function A1(Se,Pe,ke){var ht;return ke(Se,function(Nt,fr,Wr){if(Pe(Nt,fr,Wr))return ht=fr,!1}),ht}i(A1,"baseFindKey"),o(A1,"baseFindKey");function Yl(Se,Pe,ke,ht){for(var Nt=Se.length,fr=ke+(ht?1:-1);ht?fr--:++fr<Nt;)if(Pe(Se[fr],fr,Se))return fr;return-1}i(Yl,"baseFindIndex"),o(Yl,"baseFindIndex");function zs(Se,Pe,ke){return Pe===Pe?B2(Se,Pe,ke):Yl(Se,S1,ke)}i(zs,"baseIndexOf"),o(zs,"baseIndexOf");function C2(Se,Pe,ke,ht){for(var Nt=ke-1,fr=Se.length;++Nt<fr;)if(ht(Se[Nt],Pe))return Nt;return-1}i(C2,"baseIndexOfWith"),o(C2,"baseIndexOfWith");function S1(Se){return Se!==Se}i(S1,"baseIsNaN"),o(S1,"baseIsNaN");function x1(Se,Pe){var ke=Se==null?0:Se.length;return ke?bh(Se,Pe)/ke:C}i(x1,"baseMean"),o(x1,"baseMean");function vh(Se){return function(Pe){return Pe==null?r:Pe[Se]}}i(vh,"baseProperty"),o(vh,"baseProperty");function yh(Se){return function(Pe){return Se==null?r:Se[Pe]}}i(yh,"basePropertyOf"),o(yh,"basePropertyOf");function T1(Se,Pe,ke,ht,Nt){return Nt(Se,function(fr,Wr,_r){ke=ht?(ht=!1,fr):Pe(ke,fr,Wr,_r)}),ke}i(T1,"baseReduce"),o(T1,"baseReduce");function M2(Se,Pe){var ke=Se.length;for(Se.sort(Pe);ke--;)Se[ke]=Se[ke].value;return Se}i(M2,"baseSortBy"),o(M2,"baseSortBy");function bh(Se,Pe){for(var ke,ht=-1,Nt=Se.length;++ht<Nt;){var fr=Pe(Se[ht]);fr!==r&&(ke=ke===r?fr:ke+fr)}return ke}i(bh,"baseSum"),o(bh,"baseSum");function wh(Se,Pe){for(var ke=-1,ht=Array(Se);++ke<Se;)ht[ke]=Pe(ke);return ht}i(wh,"baseTimes"),o(wh,"baseTimes");function I2(Se,Pe){return Mr(Pe,function(ke){return[ke,Se[ke]]})}i(I2,"baseToPairs"),o(I2,"baseToPairs");function C1(Se){return Se&&Se.slice(0,D1(Se)+1).replace(rt,"")}i(C1,"baseTrim"),o(C1,"baseTrim");function Hn(Se){return function(Pe){return Se(Pe)}}i(Hn,"baseUnary"),o(Hn,"baseUnary");function _h(Se,Pe){return Mr(Pe,function(ke){return Se[ke]})}i(_h,"baseValues"),o(_h,"baseValues");function Qc(Se,Pe){return Se.has(Pe)}i(Qc,"cacheHas"),o(Qc,"cacheHas");function M1(Se,Pe){for(var ke=-1,ht=Se.length;++ke<ht&&zs(Pe,Se[ke],0)>-1;);return ke}i(M1,"charsStartIndex"),o(M1,"charsStartIndex");function I1(Se,Pe){for(var ke=Se.length;ke--&&zs(Pe,Se[ke],0)>-1;);return ke}i(I1,"charsEndIndex"),o(I1,"charsEndIndex");function k2(Se,Pe){for(var ke=Se.length,ht=0;ke--;)Se[ke]===Pe&&++ht;return ht}i(k2,"countHolders"),o(k2,"countHolders");var VD=yh(de),KD=yh(Me);function D2(Se){return"\\"+mt[Se]}i(D2,"escapeStringChar"),o(D2,"escapeStringChar");function R2(Se,Pe){return Se==null?r:Se[Pe]}i(R2,"getValue"),o(R2,"getValue");function Hs(Se){return dh.test(Se)}i(Hs,"hasUnicode"),o(Hs,"hasUnicode");function O2(Se){return js.test(Se)}i(O2,"hasUnicodeWord"),o(O2,"hasUnicodeWord");function N2(Se){for(var Pe,ke=[];!(Pe=Se.next()).done;)ke.push(Pe.value);return ke}i(N2,"iteratorToArray"),o(N2,"iteratorToArray");function Eh(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ht,Nt){ke[++Pe]=[Nt,ht]}),ke}i(Eh,"mapToArray"),o(Eh,"mapToArray");function k1(Se,Pe){return function(ke){return Se(Pe(ke))}}i(k1,"overArg"),o(k1,"overArg");function uo(Se,Pe){for(var ke=-1,ht=Se.length,Nt=0,fr=[];++ke<ht;){var Wr=Se[ke];(Wr===Pe||Wr===g)&&(Se[ke]=g,fr[Nt++]=ke)}return fr}i(uo,"replaceHolders"),o(uo,"replaceHolders");function Xl(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ht){ke[++Pe]=ht}),ke}i(Xl,"setToArray"),o(Xl,"setToArray");function P2(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ht){ke[++Pe]=[ht,ht]}),ke}i(P2,"setToPairs"),o(P2,"setToPairs");function B2(Se,Pe,ke){for(var ht=ke-1,Nt=Se.length;++ht<Nt;)if(Se[ht]===Pe)return ht;return-1}i(B2,"strictIndexOf"),o(B2,"strictIndexOf");function L2(Se,Pe,ke){for(var ht=ke+1;ht--;)if(Se[ht]===Pe)return ht;return ht}i(L2,"strictLastIndexOf"),o(L2,"strictLastIndexOf");function qs(Se){return Hs(Se)?U2(Se):qD(Se)}i(qs,"stringSize"),o(qs,"stringSize");function Bi(Se){return Hs(Se)?F2(Se):x2(Se)}i(Bi,"stringToArray"),o(Bi,"stringToArray");function D1(Se){for(var Pe=Se.length;Pe--&&sr.test(Se.charAt(Pe)););return Pe}i(D1,"trimmedEndIndex"),o(D1,"trimmedEndIndex");var GD=yh(Le);function U2(Se){for(var Pe=Gl.lastIndex=0;Gl.test(Se);)++Pe;return Pe}i(U2,"unicodeSize"),o(U2,"unicodeSize");function F2(Se){return Se.match(Gl)||[]}i(F2,"unicodeToArray"),o(F2,"unicodeToArray");function j2(Se){return Se.match(Wl)||[]}i(j2,"unicodeWords"),o(j2,"unicodeWords");var WD=o(i(function Se(Pe){Pe=Pe==null?Fr:Ho.defaults(Fr.Object(),Pe,Ho.pick(Fr,hh));var ke=Pe.Array,ht=Pe.Date,Nt=Pe.Error,fr=Pe.Function,Wr=Pe.Math,_r=Pe.Object,R1=Pe.RegExp,ZD=Pe.String,Li=Pe.TypeError,Ah=ke.prototype,JD=fr.prototype,eu=_r.prototype,Sh=Pe["__core-js_shared__"],xh=JD.toString,yr=eu.hasOwnProperty,YD=0,$2=function(){var u=/[^.]+$/.exec(Sh&&Sh.keys&&Sh.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),Th=eu.toString,XD=xh.call(_r),QD=Fr._,eR=R1("^"+xh.call(yr).replace(Qt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ch=Zl?Pe.Buffer:r,qo=Pe.Symbol,Mh=Pe.Uint8Array,z2=Ch?Ch.allocUnsafe:r,Ih=k1(_r.getPrototypeOf,_r),H2=_r.create,q2=eu.propertyIsEnumerable,kh=Ah.splice,V2=qo?qo.isConcatSpreadable:r,Ql=qo?qo.iterator:r,Vs=qo?qo.toStringTag:r,Dh=function(){try{var u=Jo(_r,"defineProperty");return u({},"",{}),u}catch{}}(),tR=Pe.clearTimeout!==Fr.clearTimeout&&Pe.clearTimeout,rR=ht&&ht.now!==Fr.Date.now&&ht.now,nR=Pe.setTimeout!==Fr.setTimeout&&Pe.setTimeout,Rh=Wr.ceil,Oh=Wr.floor,O1=_r.getOwnPropertySymbols,iR=Ch?Ch.isBuffer:r,K2=Pe.isFinite,aR=Ah.join,oR=k1(_r.keys,_r),Zr=Wr.max,vn=Wr.min,sR=ht.now,cR=Pe.parseInt,G2=Wr.random,uR=Ah.reverse,N1=Jo(Pe,"DataView"),ef=Jo(Pe,"Map"),P1=Jo(Pe,"Promise"),tu=Jo(Pe,"Set"),tf=Jo(Pe,"WeakMap"),rf=Jo(_r,"create"),Nh=tf&&new tf,ru={},lR=Yo(N1),fR=Yo(ef),dR=Yo(P1),hR=Yo(tu),pR=Yo(tf),Ph=qo?qo.prototype:r,nf=Ph?Ph.valueOf:r,W2=Ph?Ph.toString:r;function se(u){if(Dr(u)&&!Bt(u)&&!(u instanceof Wt)){if(u instanceof oi)return u;if(yr.call(u,"__wrapped__"))return Og(u)}return new oi(u)}i(se,"lodash"),o(se,"lodash");var nu=function(){function u(){}return i(u,"object"),o(u,"object"),function(h){if(!kr(h))return{};if(H2)return H2(h);u.prototype=h;var S=new u;return u.prototype=r,S}}();function af(){}i(af,"baseLodash"),o(af,"baseLodash");function oi(u,h){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!h,this.__index__=0,this.__values__=r}i(oi,"LodashWrapper"),o(oi,"LodashWrapper"),se.templateSettings={escape:lr,evaluate:dt,interpolate:at,variable:"",imports:{_:se}},se.prototype=af.prototype,se.prototype.constructor=se,oi.prototype=nu(af.prototype),oi.prototype.constructor=oi;function Wt(u){this.__wrapped__=u,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=A,this.__views__=[]}i(Wt,"LazyWrapper"),o(Wt,"LazyWrapper");function Z2(){var u=new Wt(this.__wrapped__);return u.__actions__=In(this.__actions__),u.__dir__=this.__dir__,u.__filtered__=this.__filtered__,u.__iteratees__=In(this.__iteratees__),u.__takeCount__=this.__takeCount__,u.__views__=In(this.__views__),u}i(Z2,"lazyClone"),o(Z2,"lazyClone");function J2(){if(this.__filtered__){var u=new Wt(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}i(J2,"lazyReverse"),o(J2,"lazyReverse");function Y2(){var u=this.__wrapped__.value(),h=this.__dir__,S=Bt(u),H=h<0,te=S?u.length:0,ce=f5(0,te,this.__views__),ye=ce.start,Ee=ce.end,xe=Ee-ye,Ue=H?Ee:ye-1,Fe=this.__iteratees__,$e=Fe.length,Ye=0,gt=vn(xe,this.__takeCount__);if(!S||!H&&te==xe&>==xe)return ng(u,this.__actions__);var Tt=[];e:for(;xe--&&Ye<gt;){Ue+=h;for(var $t=-1,At=u[Ue];++$t<$e;){var Kt=Fe[$t],Zt=Kt.iteratee,Kn=Kt.type,_n=Zt(At);if(Kn==b)At=_n;else if(!_n){if(Kn==T)continue e;break e}}Tt[Ye++]=At}return Tt}i(Y2,"lazyValue"),o(Y2,"lazyValue"),Wt.prototype=nu(af.prototype),Wt.prototype.constructor=Wt;function Vo(u){var h=-1,S=u==null?0:u.length;for(this.clear();++h<S;){var H=u[h];this.set(H[0],H[1])}}i(Vo,"Hash"),o(Vo,"Hash");function X2(){this.__data__=rf?rf(null):{},this.size=0}i(X2,"hashClear"),o(X2,"hashClear");function Q2(u){var h=this.has(u)&&delete this.__data__[u];return this.size-=h?1:0,h}i(Q2,"hashDelete"),o(Q2,"hashDelete");function ew(u){var h=this.__data__;if(rf){var S=h[u];return S===d?r:S}return yr.call(h,u)?h[u]:r}i(ew,"hashGet"),o(ew,"hashGet");function tw(u){var h=this.__data__;return rf?h[u]!==r:yr.call(h,u)}i(tw,"hashHas"),o(tw,"hashHas");function rw(u,h){var S=this.__data__;return this.size+=this.has(u)?0:1,S[u]=rf&&h===r?d:h,this}i(rw,"hashSet"),o(rw,"hashSet"),Vo.prototype.clear=X2,Vo.prototype.delete=Q2,Vo.prototype.get=ew,Vo.prototype.has=tw,Vo.prototype.set=rw;function Ma(u){var h=-1,S=u==null?0:u.length;for(this.clear();++h<S;){var H=u[h];this.set(H[0],H[1])}}i(Ma,"ListCache"),o(Ma,"ListCache");function nw(){this.__data__=[],this.size=0}i(nw,"listCacheClear"),o(nw,"listCacheClear");function iw(u){var h=this.__data__,S=of(h,u);if(S<0)return!1;var H=h.length-1;return S==H?h.pop():kh.call(h,S,1),--this.size,!0}i(iw,"listCacheDelete"),o(iw,"listCacheDelete");function aw(u){var h=this.__data__,S=of(h,u);return S<0?r:h[S][1]}i(aw,"listCacheGet"),o(aw,"listCacheGet");function ow(u){return of(this.__data__,u)>-1}i(ow,"listCacheHas"),o(ow,"listCacheHas");function sw(u,h){var S=this.__data__,H=of(S,u);return H<0?(++this.size,S.push([u,h])):S[H][1]=h,this}i(sw,"listCacheSet"),o(sw,"listCacheSet"),Ma.prototype.clear=nw,Ma.prototype.delete=iw,Ma.prototype.get=aw,Ma.prototype.has=ow,Ma.prototype.set=sw;function Ia(u){var h=-1,S=u==null?0:u.length;for(this.clear();++h<S;){var H=u[h];this.set(H[0],H[1])}}i(Ia,"MapCache"),o(Ia,"MapCache");function cw(){this.size=0,this.__data__={hash:new Vo,map:new(ef||Ma),string:new Vo}}i(cw,"mapCacheClear"),o(cw,"mapCacheClear");function uw(u){var h=yf(this,u).delete(u);return this.size-=h?1:0,h}i(uw,"mapCacheDelete"),o(uw,"mapCacheDelete");function lw(u){return yf(this,u).get(u)}i(lw,"mapCacheGet"),o(lw,"mapCacheGet");function fw(u){return yf(this,u).has(u)}i(fw,"mapCacheHas"),o(fw,"mapCacheHas");function dw(u,h){var S=yf(this,u),H=S.size;return S.set(u,h),this.size+=S.size==H?0:1,this}i(dw,"mapCacheSet"),o(dw,"mapCacheSet"),Ia.prototype.clear=cw,Ia.prototype.delete=uw,Ia.prototype.get=lw,Ia.prototype.has=fw,Ia.prototype.set=dw;function Ko(u){var h=-1,S=u==null?0:u.length;for(this.__data__=new Ia;++h<S;)this.add(u[h])}i(Ko,"SetCache"),o(Ko,"SetCache");function hw(u){return this.__data__.set(u,d),this}i(hw,"setCacheAdd"),o(hw,"setCacheAdd");function pw(u){return this.__data__.has(u)}i(pw,"setCacheHas"),o(pw,"setCacheHas"),Ko.prototype.add=Ko.prototype.push=hw,Ko.prototype.has=pw;function Ui(u){var h=this.__data__=new Ma(u);this.size=h.size}i(Ui,"Stack"),o(Ui,"Stack");function mw(){this.__data__=new Ma,this.size=0}i(mw,"stackClear"),o(mw,"stackClear");function gw(u){var h=this.__data__,S=h.delete(u);return this.size=h.size,S}i(gw,"stackDelete"),o(gw,"stackDelete");function vw(u){return this.__data__.get(u)}i(vw,"stackGet"),o(vw,"stackGet");function yw(u){return this.__data__.has(u)}i(yw,"stackHas"),o(yw,"stackHas");function bw(u,h){var S=this.__data__;if(S instanceof Ma){var H=S.__data__;if(!ef||H.length<a-1)return H.push([u,h]),this.size=++S.size,this;S=this.__data__=new Ia(H)}return S.set(u,h),this.size=S.size,this}i(bw,"stackSet"),o(bw,"stackSet"),Ui.prototype.clear=mw,Ui.prototype.delete=gw,Ui.prototype.get=vw,Ui.prototype.has=yw,Ui.prototype.set=bw;function B1(u,h){var S=Bt(u),H=!S&&Zs(u),te=!S&&!H&&Xo(u),ce=!S&&!H&&!te&&du(u),ye=S||H||te||ce,Ee=ye?wh(u.length,ZD):[],xe=Ee.length;for(var Ue in u)(h||yr.call(u,Ue))&&!(ye&&(Ue=="length"||te&&(Ue=="offset"||Ue=="parent")||ce&&(Ue=="buffer"||Ue=="byteLength"||Ue=="byteOffset")||Oa(Ue,xe)))&&Ee.push(Ue);return Ee}i(B1,"arrayLikeKeys"),o(B1,"arrayLikeKeys");function L1(u){var h=u.length;return h?u[Vh(0,h-1)]:r}i(L1,"arraySample"),o(L1,"arraySample");function ww(u,h){return wf(In(u),Go(h,0,u.length))}i(ww,"arraySampleSize"),o(ww,"arraySampleSize");function _w(u){return wf(In(u))}i(_w,"arrayShuffle"),o(_w,"arrayShuffle");function Bh(u,h,S){(S!==r&&!Fi(u[h],S)||S===r&&!(h in u))&&ka(u,h,S)}i(Bh,"assignMergeValue"),o(Bh,"assignMergeValue");function iu(u,h,S){var H=u[h];(!(yr.call(u,h)&&Fi(H,S))||S===r&&!(h in u))&&ka(u,h,S)}i(iu,"assignValue"),o(iu,"assignValue");function of(u,h){for(var S=u.length;S--;)if(Fi(u[S][0],h))return S;return-1}i(of,"assocIndexOf"),o(of,"assocIndexOf");function Ew(u,h,S,H){return Wo(u,function(te,ce,ye){h(H,te,S(te),ye)}),H}i(Ew,"baseAggregator"),o(Ew,"baseAggregator");function U1(u,h){return u&&Qi(h,Jr(h),u)}i(U1,"baseAssign"),o(U1,"baseAssign");function Aw(u,h){return u&&Qi(h,Dn(h),u)}i(Aw,"baseAssignIn"),o(Aw,"baseAssignIn");function ka(u,h,S){h=="__proto__"&&Dh?Dh(u,h,{configurable:!0,enumerable:!0,value:S,writable:!0}):u[h]=S}i(ka,"baseAssignValue"),o(ka,"baseAssignValue");function Lh(u,h){for(var S=-1,H=h.length,te=ke(H),ce=u==null;++S<H;)te[S]=ce?r:dp(u,h[S]);return te}i(Lh,"baseAt"),o(Lh,"baseAt");function Go(u,h,S){return u===u&&(S!==r&&(u=u<=S?u:S),h!==r&&(u=u>=h?u:h)),u}i(Go,"baseClamp"),o(Go,"baseClamp");function si(u,h,S,H,te,ce){var ye,Ee=h&v,xe=h&y,Ue=h&_;if(S&&(ye=te?S(u,H,te,ce):S(u)),ye!==r)return ye;if(!kr(u))return u;var Fe=Bt(u);if(Fe){if(ye=h5(u),!Ee)return In(u,ye)}else{var $e=bn(u),Ye=$e==ae||$e==fe;if(Xo(u))return ag(u,Ee);if($e==N||$e==j||Ye&&!te){if(ye=xe||Ye?{}:xg(u),!Ee)return xe?r5(u,Aw(ye,u)):t5(u,U1(ye,u))}else{if(!vr[$e])return te?u:{};ye=p5(u,$e,Ee)}}ce||(ce=new Ui);var gt=ce.get(u);if(gt)return gt;ce.set(u,ye),l_(u)?u.forEach(function(At){ye.add(si(At,h,S,At,u,ce))}):r_(u)&&u.forEach(function(At,Kt){ye.set(Kt,si(At,h,S,Kt,u,ce))});var Tt=Ue?xe?rp:tp:xe?Dn:Jr,$t=Fe?r:Tt(u);return ai($t||u,function(At,Kt){$t&&(Kt=At,At=u[Kt]),iu(ye,Kt,si(At,h,S,Kt,u,ce))}),ye}i(si,"baseClone"),o(si,"baseClone");function Sw(u){var h=Jr(u);return function(S){return F1(S,u,h)}}i(Sw,"baseConforms"),o(Sw,"baseConforms");function F1(u,h,S){var H=S.length;if(u==null)return!H;for(u=_r(u);H--;){var te=S[H],ce=h[te],ye=u[te];if(ye===r&&!(te in u)||!ce(ye))return!1}return!0}i(F1,"baseConformsTo"),o(F1,"baseConformsTo");function j1(u,h,S){if(typeof u!="function")throw new Li(c);return bf(function(){u.apply(r,S)},h)}i(j1,"baseDelay"),o(j1,"baseDelay");function au(u,h,S,H){var te=-1,ce=Jl,ye=!0,Ee=u.length,xe=[],Ue=h.length;if(!Ee)return xe;S&&(h=Mr(h,Hn(S))),H?(ce=ph,ye=!1):h.length>=a&&(ce=Qc,ye=!1,h=new Ko(h));e:for(;++te<Ee;){var Fe=u[te],$e=S==null?Fe:S(Fe);if(Fe=H||Fe!==0?Fe:0,ye&&$e===$e){for(var Ye=Ue;Ye--;)if(h[Ye]===$e)continue e;xe.push(Fe)}else ce(h,$e,H)||xe.push(Fe)}return xe}i(au,"baseDifference"),o(au,"baseDifference");var Wo=lg(Xi),xw=lg(Uh,!0);function Tw(u,h){var S=!0;return Wo(u,function(H,te,ce){return S=!!h(H,te,ce),S}),S}i(Tw,"baseEvery"),o(Tw,"baseEvery");function sf(u,h,S){for(var H=-1,te=u.length;++H<te;){var ce=u[H],ye=h(ce);if(ye!=null&&(Ee===r?ye===ye&&!Vn(ye):S(ye,Ee)))var Ee=ye,xe=ce}return xe}i(sf,"baseExtremum"),o(sf,"baseExtremum");function Cw(u,h,S,H){var te=u.length;for(S=Ft(S),S<0&&(S=-S>te?0:te+S),H=H===r||H>te?te:Ft(H),H<0&&(H+=te),H=S>H?0:ev(H);S<H;)u[S++]=h;return u}i(Cw,"baseFill"),o(Cw,"baseFill");function $1(u,h){var S=[];return Wo(u,function(H,te,ce){h(H,te,ce)&&S.push(H)}),S}i($1,"baseFilter"),o($1,"baseFilter");function Qr(u,h,S,H,te){var ce=-1,ye=u.length;for(S||(S=g5),te||(te=[]);++ce<ye;){var Ee=u[ce];h>0&&S(Ee)?h>1?Qr(Ee,h-1,S,H,te):co(te,Ee):H||(te[te.length]=Ee)}return te}i(Qr,"baseFlatten"),o(Qr,"baseFlatten");var z1=fg(),Mw=fg(!0);function Xi(u,h){return u&&z1(u,h,Jr)}i(Xi,"baseForOwn"),o(Xi,"baseForOwn");function Uh(u,h){return u&&Mw(u,h,Jr)}i(Uh,"baseForOwnRight"),o(Uh,"baseForOwnRight");function cf(u,h){return so(h,function(S){return Na(u[S])})}i(cf,"baseFunctions"),o(cf,"baseFunctions");function Zo(u,h){h=fo(h,u);for(var S=0,H=h.length;u!=null&&S<H;)u=u[ea(h[S++])];return S&&S==H?u:r}i(Zo,"baseGet"),o(Zo,"baseGet");function H1(u,h,S){var H=h(u);return Bt(u)?H:co(H,S(u))}i(H1,"baseGetAllKeys"),o(H1,"baseGetAllKeys");function yn(u){return u==null?u===r?De:X:Vs&&Vs in _r(u)?u5(u):E5(u)}i(yn,"baseGetTag"),o(yn,"baseGetTag");function Fh(u,h){return u>h}i(Fh,"baseGt"),o(Fh,"baseGt");function Iw(u,h){return u!=null&&yr.call(u,h)}i(Iw,"baseHas"),o(Iw,"baseHas");function kw(u,h){return u!=null&&h in _r(u)}i(kw,"baseHasIn"),o(kw,"baseHasIn");function Dw(u,h,S){return u>=vn(h,S)&&u<Zr(h,S)}i(Dw,"baseInRange"),o(Dw,"baseInRange");function jh(u,h,S){for(var H=S?ph:Jl,te=u[0].length,ce=u.length,ye=ce,Ee=ke(ce),xe=1/0,Ue=[];ye--;){var Fe=u[ye];ye&&h&&(Fe=Mr(Fe,Hn(h))),xe=vn(Fe.length,xe),Ee[ye]=!S&&(h||te>=120&&Fe.length>=120)?new Ko(ye&&Fe):r}Fe=u[0];var $e=-1,Ye=Ee[0];e:for(;++$e<te&&Ue.length<xe;){var gt=Fe[$e],Tt=h?h(gt):gt;if(gt=S||gt!==0?gt:0,!(Ye?Qc(Ye,Tt):H(Ue,Tt,S))){for(ye=ce;--ye;){var $t=Ee[ye];if(!($t?Qc($t,Tt):H(u[ye],Tt,S)))continue e}Ye&&Ye.push(Tt),Ue.push(gt)}}return Ue}i(jh,"baseIntersection"),o(jh,"baseIntersection");function Rw(u,h,S,H){return Xi(u,function(te,ce,ye){h(H,S(te),ce,ye)}),H}i(Rw,"baseInverter"),o(Rw,"baseInverter");function ou(u,h,S){h=fo(h,u),u=Ig(u,h);var H=u==null?u:u[ea(ui(h))];return H==null?r:zn(H,u,S)}i(ou,"baseInvoke"),o(ou,"baseInvoke");function q1(u){return Dr(u)&&yn(u)==j}i(q1,"baseIsArguments"),o(q1,"baseIsArguments");function Ow(u){return Dr(u)&&yn(u)==Ke}i(Ow,"baseIsArrayBuffer"),o(Ow,"baseIsArrayBuffer");function Nw(u){return Dr(u)&&yn(u)==oe}i(Nw,"baseIsDate"),o(Nw,"baseIsDate");function su(u,h,S,H,te){return u===h?!0:u==null||h==null||!Dr(u)&&!Dr(h)?u!==u&&h!==h:Pw(u,h,S,H,su,te)}i(su,"baseIsEqual"),o(su,"baseIsEqual");function Pw(u,h,S,H,te,ce){var ye=Bt(u),Ee=Bt(h),xe=ye?ge:bn(u),Ue=Ee?ge:bn(h);xe=xe==j?N:xe,Ue=Ue==j?N:Ue;var Fe=xe==N,$e=Ue==N,Ye=xe==Ue;if(Ye&&Xo(u)){if(!Xo(h))return!1;ye=!0,Fe=!1}if(Ye&&!Fe)return ce||(ce=new Ui),ye||du(u)?_g(u,h,S,H,te,ce):s5(u,h,xe,S,H,te,ce);if(!(S&x)){var gt=Fe&&yr.call(u,"__wrapped__"),Tt=$e&&yr.call(h,"__wrapped__");if(gt||Tt){var $t=gt?u.value():u,At=Tt?h.value():h;return ce||(ce=new Ui),te($t,At,S,H,ce)}}return Ye?(ce||(ce=new Ui),c5(u,h,S,H,te,ce)):!1}i(Pw,"baseIsEqualDeep"),o(Pw,"baseIsEqualDeep");function Bw(u){return Dr(u)&&bn(u)==be}i(Bw,"baseIsMap"),o(Bw,"baseIsMap");function $h(u,h,S,H){var te=S.length,ce=te,ye=!H;if(u==null)return!ce;for(u=_r(u);te--;){var Ee=S[te];if(ye&&Ee[2]?Ee[1]!==u[Ee[0]]:!(Ee[0]in u))return!1}for(;++te<ce;){Ee=S[te];var xe=Ee[0],Ue=u[xe],Fe=Ee[1];if(ye&&Ee[2]){if(Ue===r&&!(xe in u))return!1}else{var $e=new Ui;if(H)var Ye=H(Ue,Fe,xe,u,h,$e);if(!(Ye===r?su(Fe,Ue,x|O,H,$e):Ye))return!1}}return!0}i($h,"baseIsMatch"),o($h,"baseIsMatch");function V1(u){if(!kr(u)||y5(u))return!1;var h=Na(u)?eR:tr;return h.test(Yo(u))}i(V1,"baseIsNative"),o(V1,"baseIsNative");function Lw(u){return Dr(u)&&yn(u)==ie}i(Lw,"baseIsRegExp"),o(Lw,"baseIsRegExp");function Uw(u){return Dr(u)&&bn(u)==ee}i(Uw,"baseIsSet"),o(Uw,"baseIsSet");function Fw(u){return Dr(u)&&xf(u.length)&&!!wr[yn(u)]}i(Fw,"baseIsTypedArray"),o(Fw,"baseIsTypedArray");function K1(u){return typeof u=="function"?u:u==null?Rn:typeof u=="object"?Bt(u)?Z1(u[0],u[1]):W1(u):sv(u)}i(K1,"baseIteratee"),o(K1,"baseIteratee");function zh(u){if(!lu(u))return oR(u);var h=[];for(var S in _r(u))yr.call(u,S)&&S!="constructor"&&h.push(S);return h}i(zh,"baseKeys"),o(zh,"baseKeys");function jw(u){if(!kr(u))return _5(u);var h=lu(u),S=[];for(var H in u)H=="constructor"&&(h||!yr.call(u,H))||S.push(H);return S}i(jw,"baseKeysIn"),o(jw,"baseKeysIn");function Hh(u,h){return u<h}i(Hh,"baseLt"),o(Hh,"baseLt");function G1(u,h){var S=-1,H=kn(u)?ke(u.length):[];return Wo(u,function(te,ce,ye){H[++S]=h(te,ce,ye)}),H}i(G1,"baseMap"),o(G1,"baseMap");function W1(u){var h=np(u);return h.length==1&&h[0][2]?Cg(h[0][0],h[0][1]):function(S){return S===u||$h(S,u,h)}}i(W1,"baseMatches"),o(W1,"baseMatches");function Z1(u,h){return ip(u)&&Tg(h)?Cg(ea(u),h):function(S){var H=dp(S,u);return H===r&&H===h?hp(S,u):su(h,H,x|O)}}i(Z1,"baseMatchesProperty"),o(Z1,"baseMatchesProperty");function uf(u,h,S,H,te){u!==h&&z1(h,function(ce,ye){if(te||(te=new Ui),kr(ce))$w(u,h,ye,S,uf,H,te);else{var Ee=H?H(op(u,ye),ce,ye+"",u,h,te):r;Ee===r&&(Ee=ce),Bh(u,ye,Ee)}},Dn)}i(uf,"baseMerge"),o(uf,"baseMerge");function $w(u,h,S,H,te,ce,ye){var Ee=op(u,S),xe=op(h,S),Ue=ye.get(xe);if(Ue){Bh(u,S,Ue);return}var Fe=ce?ce(Ee,xe,S+"",u,h,ye):r,$e=Fe===r;if($e){var Ye=Bt(xe),gt=!Ye&&Xo(xe),Tt=!Ye&&!gt&&du(xe);Fe=xe,Ye||gt||Tt?Bt(Ee)?Fe=Ee:Pr(Ee)?Fe=In(Ee):gt?($e=!1,Fe=ag(xe,!0)):Tt?($e=!1,Fe=og(xe,!0)):Fe=[]:fu(xe)||Zs(xe)?(Fe=Ee,Zs(Ee)?Fe=tv(Ee):(!kr(Ee)||Na(Ee))&&(Fe=xg(xe))):$e=!1}$e&&(ye.set(xe,Fe),te(Fe,xe,H,ce,ye),ye.delete(xe)),Bh(u,S,Fe)}i($w,"baseMergeDeep"),o($w,"baseMergeDeep");function J1(u,h){var S=u.length;if(!!S)return h+=h<0?S:0,Oa(h,S)?u[h]:r}i(J1,"baseNth"),o(J1,"baseNth");function Y1(u,h,S){h.length?h=Mr(h,function(ce){return Bt(ce)?function(ye){return Zo(ye,ce.length===1?ce[0]:ce)}:ce}):h=[Rn];var H=-1;h=Mr(h,Hn(Et()));var te=G1(u,function(ce,ye,Ee){var xe=Mr(h,function(Ue){return Ue(ce)});return{criteria:xe,index:++H,value:ce}});return M2(te,function(ce,ye){return e5(ce,ye,S)})}i(Y1,"baseOrderBy"),o(Y1,"baseOrderBy");function zw(u,h){return X1(u,h,function(S,H){return hp(u,H)})}i(zw,"basePick"),o(zw,"basePick");function X1(u,h,S){for(var H=-1,te=h.length,ce={};++H<te;){var ye=h[H],Ee=Zo(u,ye);S(Ee,ye)&&cu(ce,fo(ye,u),Ee)}return ce}i(X1,"basePickBy"),o(X1,"basePickBy");function Hw(u){return function(h){return Zo(h,u)}}i(Hw,"basePropertyDeep"),o(Hw,"basePropertyDeep");function qh(u,h,S,H){var te=H?C2:zs,ce=-1,ye=h.length,Ee=u;for(u===h&&(h=In(h)),S&&(Ee=Mr(u,Hn(S)));++ce<ye;)for(var xe=0,Ue=h[ce],Fe=S?S(Ue):Ue;(xe=te(Ee,Fe,xe,H))>-1;)Ee!==u&&kh.call(Ee,xe,1),kh.call(u,xe,1);return u}i(qh,"basePullAll"),o(qh,"basePullAll");function Q1(u,h){for(var S=u?h.length:0,H=S-1;S--;){var te=h[S];if(S==H||te!==ce){var ce=te;Oa(te)?kh.call(u,te,1):Wh(u,te)}}return u}i(Q1,"basePullAt"),o(Q1,"basePullAt");function Vh(u,h){return u+Oh(G2()*(h-u+1))}i(Vh,"baseRandom"),o(Vh,"baseRandom");function qw(u,h,S,H){for(var te=-1,ce=Zr(Rh((h-u)/(S||1)),0),ye=ke(ce);ce--;)ye[H?ce:++te]=u,u+=S;return ye}i(qw,"baseRange"),o(qw,"baseRange");function Kh(u,h){var S="";if(!u||h<1||h>E)return S;do h%2&&(S+=u),h=Oh(h/2),h&&(u+=u);while(h);return S}i(Kh,"baseRepeat"),o(Kh,"baseRepeat");function Ht(u,h){return kg(Mg(u,h,Rn),u+"")}i(Ht,"baseRest"),o(Ht,"baseRest");function Vw(u){return L1(Js(u))}i(Vw,"baseSample"),o(Vw,"baseSample");function Kw(u,h){var S=Js(u);return wf(S,Go(h,0,S.length))}i(Kw,"baseSampleSize"),o(Kw,"baseSampleSize");function cu(u,h,S,H){if(!kr(u))return u;h=fo(h,u);for(var te=-1,ce=h.length,ye=ce-1,Ee=u;Ee!=null&&++te<ce;){var xe=ea(h[te]),Ue=S;if(xe==="__proto__"||xe==="constructor"||xe==="prototype")return u;if(te!=ye){var Fe=Ee[xe];Ue=H?H(Fe,xe,Ee):r,Ue===r&&(Ue=kr(Fe)?Fe:Oa(h[te+1])?[]:{})}iu(Ee,xe,Ue),Ee=Ee[xe]}return u}i(cu,"baseSet"),o(cu,"baseSet");var Gw=Nh?function(u,h){return Nh.set(u,h),u}:Rn,mR=Dh?function(u,h){return Dh(u,"toString",{configurable:!0,enumerable:!1,value:pp(h),writable:!0})}:Rn;function Ww(u){return wf(Js(u))}i(Ww,"baseShuffle"),o(Ww,"baseShuffle");function ci(u,h,S){var H=-1,te=u.length;h<0&&(h=-h>te?0:te+h),S=S>te?te:S,S<0&&(S+=te),te=h>S?0:S-h>>>0,h>>>=0;for(var ce=ke(te);++H<te;)ce[H]=u[H+h];return ce}i(ci,"baseSlice"),o(ci,"baseSlice");function Zw(u,h){var S;return Wo(u,function(H,te,ce){return S=h(H,te,ce),!S}),!!S}i(Zw,"baseSome"),o(Zw,"baseSome");function lf(u,h,S){var H=0,te=u==null?H:u.length;if(typeof h=="number"&&h===h&&te<=V){for(;H<te;){var ce=H+te>>>1,ye=u[ce];ye!==null&&!Vn(ye)&&(S?ye<=h:ye<h)?H=ce+1:te=ce}return te}return Gh(u,h,Rn,S)}i(lf,"baseSortedIndex"),o(lf,"baseSortedIndex");function Gh(u,h,S,H){var te=0,ce=u==null?0:u.length;if(ce===0)return 0;h=S(h);for(var ye=h!==h,Ee=h===null,xe=Vn(h),Ue=h===r;te<ce;){var Fe=Oh((te+ce)/2),$e=S(u[Fe]),Ye=$e!==r,gt=$e===null,Tt=$e===$e,$t=Vn($e);if(ye)var At=H||Tt;else Ue?At=Tt&&(H||Ye):Ee?At=Tt&&Ye&&(H||!gt):xe?At=Tt&&Ye&&!gt&&(H||!$t):gt||$t?At=!1:At=H?$e<=h:$e<h;At?te=Fe+1:ce=Fe}return vn(ce,U)}i(Gh,"baseSortedIndexBy"),o(Gh,"baseSortedIndexBy");function eg(u,h){for(var S=-1,H=u.length,te=0,ce=[];++S<H;){var ye=u[S],Ee=h?h(ye):ye;if(!S||!Fi(Ee,xe)){var xe=Ee;ce[te++]=ye===0?0:ye}}return ce}i(eg,"baseSortedUniq"),o(eg,"baseSortedUniq");function tg(u){return typeof u=="number"?u:Vn(u)?C:+u}i(tg,"baseToNumber"),o(tg,"baseToNumber");function qn(u){if(typeof u=="string")return u;if(Bt(u))return Mr(u,qn)+"";if(Vn(u))return W2?W2.call(u):"";var h=u+"";return h=="0"&&1/u==-m?"-0":h}i(qn,"baseToString"),o(qn,"baseToString");function lo(u,h,S){var H=-1,te=Jl,ce=u.length,ye=!0,Ee=[],xe=Ee;if(S)ye=!1,te=ph;else if(ce>=a){var Ue=h?null:vR(u);if(Ue)return Xl(Ue);ye=!1,te=Qc,xe=new Ko}else xe=h?[]:Ee;e:for(;++H<ce;){var Fe=u[H],$e=h?h(Fe):Fe;if(Fe=S||Fe!==0?Fe:0,ye&&$e===$e){for(var Ye=xe.length;Ye--;)if(xe[Ye]===$e)continue e;h&&xe.push($e),Ee.push(Fe)}else te(xe,$e,S)||(xe!==Ee&&xe.push($e),Ee.push(Fe))}return Ee}i(lo,"baseUniq"),o(lo,"baseUniq");function Wh(u,h){return h=fo(h,u),u=Ig(u,h),u==null||delete u[ea(ui(h))]}i(Wh,"baseUnset"),o(Wh,"baseUnset");function rg(u,h,S,H){return cu(u,h,S(Zo(u,h)),H)}i(rg,"baseUpdate"),o(rg,"baseUpdate");function ff(u,h,S,H){for(var te=u.length,ce=H?te:-1;(H?ce--:++ce<te)&&h(u[ce],ce,u););return S?ci(u,H?0:ce,H?ce+1:te):ci(u,H?ce+1:0,H?te:ce)}i(ff,"baseWhile"),o(ff,"baseWhile");function ng(u,h){var S=u;return S instanceof Wt&&(S=S.value()),mh(h,function(H,te){return te.func.apply(te.thisArg,co([H],te.args))},S)}i(ng,"baseWrapperValue"),o(ng,"baseWrapperValue");function Zh(u,h,S){var H=u.length;if(H<2)return H?lo(u[0]):[];for(var te=-1,ce=ke(H);++te<H;)for(var ye=u[te],Ee=-1;++Ee<H;)Ee!=te&&(ce[te]=au(ce[te]||ye,u[Ee],h,S));return lo(Qr(ce,1),h,S)}i(Zh,"baseXor"),o(Zh,"baseXor");function ig(u,h,S){for(var H=-1,te=u.length,ce=h.length,ye={};++H<te;){var Ee=H<ce?h[H]:r;S(ye,u[H],Ee)}return ye}i(ig,"baseZipObject"),o(ig,"baseZipObject");function Jh(u){return Pr(u)?u:[]}i(Jh,"castArrayLikeObject"),o(Jh,"castArrayLikeObject");function Yh(u){return typeof u=="function"?u:Rn}i(Yh,"castFunction"),o(Yh,"castFunction");function fo(u,h){return Bt(u)?u:ip(u,h)?[u]:x5(dr(u))}i(fo,"castPath"),o(fo,"castPath");var gR=Ht;function ho(u,h,S){var H=u.length;return S=S===r?H:S,!h&&S>=H?u:ci(u,h,S)}i(ho,"castSlice"),o(ho,"castSlice");var Jw=tR||function(u){return Fr.clearTimeout(u)};function ag(u,h){if(h)return u.slice();var S=u.length,H=z2?z2(S):new u.constructor(S);return u.copy(H),H}i(ag,"cloneBuffer"),o(ag,"cloneBuffer");function Xh(u){var h=new u.constructor(u.byteLength);return new Mh(h).set(new Mh(u)),h}i(Xh,"cloneArrayBuffer"),o(Xh,"cloneArrayBuffer");function Yw(u,h){var S=h?Xh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.byteLength)}i(Yw,"cloneDataView"),o(Yw,"cloneDataView");function Xw(u){var h=new u.constructor(u.source,yt.exec(u));return h.lastIndex=u.lastIndex,h}i(Xw,"cloneRegExp"),o(Xw,"cloneRegExp");function Qw(u){return nf?_r(nf.call(u)):{}}i(Qw,"cloneSymbol"),o(Qw,"cloneSymbol");function og(u,h){var S=h?Xh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.length)}i(og,"cloneTypedArray"),o(og,"cloneTypedArray");function sg(u,h){if(u!==h){var S=u!==r,H=u===null,te=u===u,ce=Vn(u),ye=h!==r,Ee=h===null,xe=h===h,Ue=Vn(h);if(!Ee&&!Ue&&!ce&&u>h||ce&&ye&&xe&&!Ee&&!Ue||H&&ye&&xe||!S&&xe||!te)return 1;if(!H&&!ce&&!Ue&&u<h||Ue&&S&&te&&!H&&!ce||Ee&&S&&te||!ye&&te||!xe)return-1}return 0}i(sg,"compareAscending"),o(sg,"compareAscending");function e5(u,h,S){for(var H=-1,te=u.criteria,ce=h.criteria,ye=te.length,Ee=S.length;++H<ye;){var xe=sg(te[H],ce[H]);if(xe){if(H>=Ee)return xe;var Ue=S[H];return xe*(Ue=="desc"?-1:1)}}return u.index-h.index}i(e5,"compareMultiple"),o(e5,"compareMultiple");function cg(u,h,S,H){for(var te=-1,ce=u.length,ye=S.length,Ee=-1,xe=h.length,Ue=Zr(ce-ye,0),Fe=ke(xe+Ue),$e=!H;++Ee<xe;)Fe[Ee]=h[Ee];for(;++te<ye;)($e||te<ce)&&(Fe[S[te]]=u[te]);for(;Ue--;)Fe[Ee++]=u[te++];return Fe}i(cg,"composeArgs"),o(cg,"composeArgs");function ug(u,h,S,H){for(var te=-1,ce=u.length,ye=-1,Ee=S.length,xe=-1,Ue=h.length,Fe=Zr(ce-Ee,0),$e=ke(Fe+Ue),Ye=!H;++te<Fe;)$e[te]=u[te];for(var gt=te;++xe<Ue;)$e[gt+xe]=h[xe];for(;++ye<Ee;)(Ye||te<ce)&&($e[gt+S[ye]]=u[te++]);return $e}i(ug,"composeArgsRight"),o(ug,"composeArgsRight");function In(u,h){var S=-1,H=u.length;for(h||(h=ke(H));++S<H;)h[S]=u[S];return h}i(In,"copyArray"),o(In,"copyArray");function Qi(u,h,S,H){var te=!S;S||(S={});for(var ce=-1,ye=h.length;++ce<ye;){var Ee=h[ce],xe=H?H(S[Ee],u[Ee],Ee,S,u):r;xe===r&&(xe=u[Ee]),te?ka(S,Ee,xe):iu(S,Ee,xe)}return S}i(Qi,"copyObject"),o(Qi,"copyObject");function t5(u,h){return Qi(u,Ag(u),h)}i(t5,"copySymbols"),o(t5,"copySymbols");function r5(u,h){return Qi(u,l5(u),h)}i(r5,"copySymbolsIn"),o(r5,"copySymbolsIn");function df(u,h){return function(S,H){var te=Bt(S)?E2:Ew,ce=h?h():{};return te(S,u,Et(H,2),ce)}}i(df,"createAggregator"),o(df,"createAggregator");function Ks(u){return Ht(function(h,S){var H=-1,te=S.length,ce=te>1?S[te-1]:r,ye=te>2?S[2]:r;for(ce=u.length>3&&typeof ce=="function"?(te--,ce):r,ye&&wn(S[0],S[1],ye)&&(ce=te<3?r:ce,te=1),h=_r(h);++H<te;){var Ee=S[H];Ee&&u(h,Ee,H,ce)}return h})}i(Ks,"createAssigner"),o(Ks,"createAssigner");function lg(u,h){return function(S,H){if(S==null)return S;if(!kn(S))return u(S,H);for(var te=S.length,ce=h?te:-1,ye=_r(S);(h?ce--:++ce<te)&&H(ye[ce],ce,ye)!==!1;);return S}}i(lg,"createBaseEach"),o(lg,"createBaseEach");function fg(u){return function(h,S,H){for(var te=-1,ce=_r(h),ye=H(h),Ee=ye.length;Ee--;){var xe=ye[u?Ee:++te];if(S(ce[xe],xe,ce)===!1)break}return h}}i(fg,"createBaseFor"),o(fg,"createBaseFor");function n5(u,h,S){var H=h&D,te=uu(u);function ce(){var ye=this&&this!==Fr&&this instanceof ce?te:u;return ye.apply(H?S:this,arguments)}return i(ce,"wrapper"),o(ce,"wrapper"),ce}i(n5,"createBind"),o(n5,"createBind");function dg(u){return function(h){h=dr(h);var S=Hs(h)?Bi(h):r,H=S?S[0]:h.charAt(0),te=S?ho(S,1).join(""):h.slice(1);return H[u]()+te}}i(dg,"createCaseFirst"),o(dg,"createCaseFirst");function Gs(u){return function(h){return mh(ov(iv(h).replace(Kl,"")),u,"")}}i(Gs,"createCompounder"),o(Gs,"createCompounder");function uu(u){return function(){var h=arguments;switch(h.length){case 0:return new u;case 1:return new u(h[0]);case 2:return new u(h[0],h[1]);case 3:return new u(h[0],h[1],h[2]);case 4:return new u(h[0],h[1],h[2],h[3]);case 5:return new u(h[0],h[1],h[2],h[3],h[4]);case 6:return new u(h[0],h[1],h[2],h[3],h[4],h[5]);case 7:return new u(h[0],h[1],h[2],h[3],h[4],h[5],h[6])}var S=nu(u.prototype),H=u.apply(S,h);return kr(H)?H:S}}i(uu,"createCtor"),o(uu,"createCtor");function i5(u,h,S){var H=uu(u);function te(){for(var ce=arguments.length,ye=ke(ce),Ee=ce,xe=Ws(te);Ee--;)ye[Ee]=arguments[Ee];var Ue=ce<3&&ye[0]!==xe&&ye[ce-1]!==xe?[]:uo(ye,xe);if(ce-=Ue.length,ce<S)return vg(u,h,hf,te.placeholder,r,ye,Ue,r,r,S-ce);var Fe=this&&this!==Fr&&this instanceof te?H:u;return zn(Fe,this,ye)}return i(te,"wrapper"),o(te,"wrapper"),te}i(i5,"createCurry"),o(i5,"createCurry");function hg(u){return function(h,S,H){var te=_r(h);if(!kn(h)){var ce=Et(S,3);h=Jr(h),S=o(function(Ee){return ce(te[Ee],Ee,te)},"predicate")}var ye=u(h,S,H);return ye>-1?te[ce?h[ye]:ye]:r}}i(hg,"createFind"),o(hg,"createFind");function pg(u){return Ra(function(h){var S=h.length,H=S,te=oi.prototype.thru;for(u&&h.reverse();H--;){var ce=h[H];if(typeof ce!="function")throw new Li(c);if(te&&!ye&&vf(ce)=="wrapper")var ye=new oi([],!0)}for(H=ye?H:S;++H<S;){ce=h[H];var Ee=vf(ce),xe=Ee=="wrapper"?Eg(ce):r;xe&&ap(xe[0])&&xe[1]==(k|z|Q|K)&&!xe[4].length&&xe[9]==1?ye=ye[vf(xe[0])].apply(ye,xe[3]):ye=ce.length==1&&ap(ce)?ye[Ee]():ye.thru(ce)}return function(){var Ue=arguments,Fe=Ue[0];if(ye&&Ue.length==1&&Bt(Fe))return ye.plant(Fe).value();for(var $e=0,Ye=S?h[$e].apply(this,Ue):Fe;++$e<S;)Ye=h[$e].call(this,Ye);return Ye}})}i(pg,"createFlow"),o(pg,"createFlow");function hf(u,h,S,H,te,ce,ye,Ee,xe,Ue){var Fe=h&k,$e=h&D,Ye=h&L,gt=h&(z|q),Tt=h&he,$t=Ye?r:uu(u);function At(){for(var Kt=arguments.length,Zt=ke(Kt),Kn=Kt;Kn--;)Zt[Kn]=arguments[Kn];if(gt)var _n=Ws(At),Gn=k2(Zt,_n);if(H&&(Zt=cg(Zt,H,te,gt)),ce&&(Zt=ug(Zt,ce,ye,gt)),Kt-=Gn,gt&&Kt<Ue){var jr=uo(Zt,_n);return vg(u,h,hf,At.placeholder,S,Zt,jr,Ee,xe,Ue-Kt)}var ta=$e?S:this,po=Ye?ta[u]:u;return Kt=Zt.length,Ee?Zt=A5(Zt,Ee):Tt&&Kt>1&&Zt.reverse(),Fe&&xe<Kt&&(Zt.length=xe),this&&this!==Fr&&this instanceof At&&(po=$t||uu(po)),po.apply(ta,Zt)}return i(At,"wrapper"),o(At,"wrapper"),At}i(hf,"createHybrid"),o(hf,"createHybrid");function mg(u,h){return function(S,H){return Rw(S,u,h(H),{})}}i(mg,"createInverter"),o(mg,"createInverter");function pf(u,h){return function(S,H){var te;if(S===r&&H===r)return h;if(S!==r&&(te=S),H!==r){if(te===r)return H;typeof S=="string"||typeof H=="string"?(S=qn(S),H=qn(H)):(S=tg(S),H=tg(H)),te=u(S,H)}return te}}i(pf,"createMathOperation"),o(pf,"createMathOperation");function Qh(u){return Ra(function(h){return h=Mr(h,Hn(Et())),Ht(function(S){var H=this;return u(h,function(te){return zn(te,H,S)})})})}i(Qh,"createOver"),o(Qh,"createOver");function mf(u,h){h=h===r?" ":qn(h);var S=h.length;if(S<2)return S?Kh(h,u):h;var H=Kh(h,Rh(u/qs(h)));return Hs(h)?ho(Bi(H),0,u).join(""):H.slice(0,u)}i(mf,"createPadding"),o(mf,"createPadding");function a5(u,h,S,H){var te=h&D,ce=uu(u);function ye(){for(var Ee=-1,xe=arguments.length,Ue=-1,Fe=H.length,$e=ke(Fe+xe),Ye=this&&this!==Fr&&this instanceof ye?ce:u;++Ue<Fe;)$e[Ue]=H[Ue];for(;xe--;)$e[Ue++]=arguments[++Ee];return zn(Ye,te?S:this,$e)}return i(ye,"wrapper"),o(ye,"wrapper"),ye}i(a5,"createPartial"),o(a5,"createPartial");function gg(u){return function(h,S,H){return H&&typeof H!="number"&&wn(h,S,H)&&(S=H=r),h=Pa(h),S===r?(S=h,h=0):S=Pa(S),H=H===r?h<S?1:-1:Pa(H),qw(h,S,H,u)}}i(gg,"createRange"),o(gg,"createRange");function gf(u){return function(h,S){return typeof h=="string"&&typeof S=="string"||(h=li(h),S=li(S)),u(h,S)}}i(gf,"createRelationalOperation"),o(gf,"createRelationalOperation");function vg(u,h,S,H,te,ce,ye,Ee,xe,Ue){var Fe=h&z,$e=Fe?ye:r,Ye=Fe?r:ye,gt=Fe?ce:r,Tt=Fe?r:ce;h|=Fe?Q:Y,h&=~(Fe?Y:Q),h&Z||(h&=~(D|L));var $t=[u,h,te,gt,$e,Tt,Ye,Ee,xe,Ue],At=S.apply(r,$t);return ap(u)&&S5(At,$t),At.placeholder=H,Dg(At,u,h)}i(vg,"createRecurry"),o(vg,"createRecurry");function ep(u){var h=Wr[u];return function(S,H){if(S=li(S),H=H==null?0:vn(Ft(H),292),H&&K2(S)){var te=(dr(S)+"e").split("e"),ce=h(te[0]+"e"+(+te[1]+H));return te=(dr(ce)+"e").split("e"),+(te[0]+"e"+(+te[1]-H))}return h(S)}}i(ep,"createRound"),o(ep,"createRound");var vR=tu&&1/Xl(new tu([,-0]))[1]==m?function(u){return new tu(u)}:vp;function yg(u){return function(h){var S=bn(h);return S==be?Eh(h):S==ee?P2(h):I2(h,u(h))}}i(yg,"createToPairs"),o(yg,"createToPairs");function Da(u,h,S,H,te,ce,ye,Ee){var xe=h&L;if(!xe&&typeof u!="function")throw new Li(c);var Ue=H?H.length:0;if(Ue||(h&=~(Q|Y),H=te=r),ye=ye===r?ye:Zr(Ft(ye),0),Ee=Ee===r?Ee:Ft(Ee),Ue-=te?te.length:0,h&Y){var Fe=H,$e=te;H=te=r}var Ye=xe?r:Eg(u),gt=[u,h,S,H,te,Fe,$e,ce,ye,Ee];if(Ye&&w5(gt,Ye),u=gt[0],h=gt[1],S=gt[2],H=gt[3],te=gt[4],Ee=gt[9]=gt[9]===r?xe?0:u.length:Zr(gt[9]-Ue,0),!Ee&&h&(z|q)&&(h&=~(z|q)),!h||h==D)var Tt=n5(u,h,S);else h==z||h==q?Tt=i5(u,h,Ee):(h==Q||h==(D|Q))&&!te.length?Tt=a5(u,h,S,H):Tt=hf.apply(r,gt);var $t=Ye?Gw:S5;return Dg($t(Tt,gt),u,h)}i(Da,"createWrap"),o(Da,"createWrap");function bg(u,h,S,H){return u===r||Fi(u,eu[S])&&!yr.call(H,S)?h:u}i(bg,"customDefaultsAssignIn"),o(bg,"customDefaultsAssignIn");function wg(u,h,S,H,te,ce){return kr(u)&&kr(h)&&(ce.set(h,u),uf(u,h,r,wg,ce),ce.delete(h)),u}i(wg,"customDefaultsMerge"),o(wg,"customDefaultsMerge");function o5(u){return fu(u)?r:u}i(o5,"customOmitClone"),o(o5,"customOmitClone");function _g(u,h,S,H,te,ce){var ye=S&x,Ee=u.length,xe=h.length;if(Ee!=xe&&!(ye&&xe>Ee))return!1;var Ue=ce.get(u),Fe=ce.get(h);if(Ue&&Fe)return Ue==h&&Fe==u;var $e=-1,Ye=!0,gt=S&O?new Ko:r;for(ce.set(u,h),ce.set(h,u);++$e<Ee;){var Tt=u[$e],$t=h[$e];if(H)var At=ye?H($t,Tt,$e,h,u,ce):H(Tt,$t,$e,u,h,ce);if(At!==r){if(At)continue;Ye=!1;break}if(gt){if(!gh(h,function(Kt,Zt){if(!Qc(gt,Zt)&&(Tt===Kt||te(Tt,Kt,S,H,ce)))return gt.push(Zt)})){Ye=!1;break}}else if(!(Tt===$t||te(Tt,$t,S,H,ce))){Ye=!1;break}}return ce.delete(u),ce.delete(h),Ye}i(_g,"equalArrays"),o(_g,"equalArrays");function s5(u,h,S,H,te,ce,ye){switch(S){case ve:if(u.byteLength!=h.byteLength||u.byteOffset!=h.byteOffset)return!1;u=u.buffer,h=h.buffer;case Ke:return!(u.byteLength!=h.byteLength||!ce(new Mh(u),new Mh(h)));case ne:case oe:case Re:return Fi(+u,+h);case G:return u.name==h.name&&u.message==h.message;case ie:case ue:return u==h+"";case be:var Ee=Eh;case ee:var xe=H&x;if(Ee||(Ee=Xl),u.size!=h.size&&!xe)return!1;var Ue=ye.get(u);if(Ue)return Ue==h;H|=O,ye.set(u,h);var Fe=_g(Ee(u),Ee(h),H,te,ce,ye);return ye.delete(u),Fe;case Ae:if(nf)return nf.call(u)==nf.call(h)}return!1}i(s5,"equalByTag"),o(s5,"equalByTag");function c5(u,h,S,H,te,ce){var ye=S&x,Ee=tp(u),xe=Ee.length,Ue=tp(h),Fe=Ue.length;if(xe!=Fe&&!ye)return!1;for(var $e=xe;$e--;){var Ye=Ee[$e];if(!(ye?Ye in h:yr.call(h,Ye)))return!1}var gt=ce.get(u),Tt=ce.get(h);if(gt&&Tt)return gt==h&&Tt==u;var $t=!0;ce.set(u,h),ce.set(h,u);for(var At=ye;++$e<xe;){Ye=Ee[$e];var Kt=u[Ye],Zt=h[Ye];if(H)var Kn=ye?H(Zt,Kt,Ye,h,u,ce):H(Kt,Zt,Ye,u,h,ce);if(!(Kn===r?Kt===Zt||te(Kt,Zt,S,H,ce):Kn)){$t=!1;break}At||(At=Ye=="constructor")}if($t&&!At){var _n=u.constructor,Gn=h.constructor;_n!=Gn&&"constructor"in u&&"constructor"in h&&!(typeof _n=="function"&&_n instanceof _n&&typeof Gn=="function"&&Gn instanceof Gn)&&($t=!1)}return ce.delete(u),ce.delete(h),$t}i(c5,"equalObjects"),o(c5,"equalObjects");function Ra(u){return kg(Mg(u,r,Bg),u+"")}i(Ra,"flatRest"),o(Ra,"flatRest");function tp(u){return H1(u,Jr,Ag)}i(tp,"getAllKeys"),o(tp,"getAllKeys");function rp(u){return H1(u,Dn,l5)}i(rp,"getAllKeysIn"),o(rp,"getAllKeysIn");var Eg=Nh?function(u){return Nh.get(u)}:vp;function vf(u){for(var h=u.name+"",S=ru[h],H=yr.call(ru,h)?S.length:0;H--;){var te=S[H],ce=te.func;if(ce==null||ce==u)return te.name}return h}i(vf,"getFuncName"),o(vf,"getFuncName");function Ws(u){var h=yr.call(se,"placeholder")?se:u;return h.placeholder}i(Ws,"getHolder"),o(Ws,"getHolder");function Et(){var u=se.iteratee||mp;return u=u===mp?K1:u,arguments.length?u(arguments[0],arguments[1]):u}i(Et,"getIteratee"),o(Et,"getIteratee");function yf(u,h){var S=u.__data__;return v5(h)?S[typeof h=="string"?"string":"hash"]:S.map}i(yf,"getMapData"),o(yf,"getMapData");function np(u){for(var h=Jr(u),S=h.length;S--;){var H=h[S],te=u[H];h[S]=[H,te,Tg(te)]}return h}i(np,"getMatchData"),o(np,"getMatchData");function Jo(u,h){var S=R2(u,h);return V1(S)?S:r}i(Jo,"getNative"),o(Jo,"getNative");function u5(u){var h=yr.call(u,Vs),S=u[Vs];try{u[Vs]=r;var H=!0}catch{}var te=Th.call(u);return H&&(h?u[Vs]=S:delete u[Vs]),te}i(u5,"getRawTag"),o(u5,"getRawTag");var Ag=O1?function(u){return u==null?[]:(u=_r(u),so(O1(u),function(h){return q2.call(u,h)}))}:yp,l5=O1?function(u){for(var h=[];u;)co(h,Ag(u)),u=Ih(u);return h}:yp,bn=yn;(N1&&bn(new N1(new ArrayBuffer(1)))!=ve||ef&&bn(new ef)!=be||P1&&bn(P1.resolve())!=$||tu&&bn(new tu)!=ee||tf&&bn(new tf)!=Ie)&&(bn=o(function(u){var h=yn(u),S=h==N?u.constructor:r,H=S?Yo(S):"";if(H)switch(H){case lR:return ve;case fR:return be;case dR:return $;case hR:return ee;case pR:return Ie}return h},"getTag"));function f5(u,h,S){for(var H=-1,te=S.length;++H<te;){var ce=S[H],ye=ce.size;switch(ce.type){case"drop":u+=ye;break;case"dropRight":h-=ye;break;case"take":h=vn(h,u+ye);break;case"takeRight":u=Zr(u,h-ye);break}}return{start:u,end:h}}i(f5,"getView"),o(f5,"getView");function d5(u){var h=u.match(Je);return h?h[1].split(cr):[]}i(d5,"getWrapDetails"),o(d5,"getWrapDetails");function Sg(u,h,S){h=fo(h,u);for(var H=-1,te=h.length,ce=!1;++H<te;){var ye=ea(h[H]);if(!(ce=u!=null&&S(u,ye)))break;u=u[ye]}return ce||++H!=te?ce:(te=u==null?0:u.length,!!te&&xf(te)&&Oa(ye,te)&&(Bt(u)||Zs(u)))}i(Sg,"hasPath"),o(Sg,"hasPath");function h5(u){var h=u.length,S=new u.constructor(h);return h&&typeof u[0]=="string"&&yr.call(u,"index")&&(S.index=u.index,S.input=u.input),S}i(h5,"initCloneArray"),o(h5,"initCloneArray");function xg(u){return typeof u.constructor=="function"&&!lu(u)?nu(Ih(u)):{}}i(xg,"initCloneObject"),o(xg,"initCloneObject");function p5(u,h,S){var H=u.constructor;switch(h){case Ke:return Xh(u);case ne:case oe:return new H(+u);case ve:return Yw(u,S);case pe:case re:case le:case _e:case Te:case Ce:case Oe:case Dt:case Ge:return og(u,S);case be:return new H;case Re:case ue:return new H(u);case ie:return Xw(u);case ee:return new H;case Ae:return Qw(u)}}i(p5,"initCloneByTag"),o(p5,"initCloneByTag");function m5(u,h){var S=h.length;if(!S)return u;var H=S-1;return h[H]=(S>1?"& ":"")+h[H],h=h.join(S>2?", ":" "),u.replace(ct,`{
|
|
25
25
|
/* [wrapped with `+h+`] */
|
|
26
26
|
`)}i(m5,"insertWrapDetails"),o(m5,"insertWrapDetails");function g5(u){return Bt(u)||Zs(u)||!!(V2&&u&&u[V2])}i(g5,"isFlattenable"),o(g5,"isFlattenable");function Oa(u,h){var S=typeof u;return h=h??E,!!h&&(S=="number"||S!="symbol"&&an.test(u))&&u>-1&&u%1==0&&u<h}i(Oa,"isIndex"),o(Oa,"isIndex");function wn(u,h,S){if(!kr(S))return!1;var H=typeof h;return(H=="number"?kn(S)&&Oa(h,S.length):H=="string"&&h in S)?Fi(S[h],u):!1}i(wn,"isIterateeCall"),o(wn,"isIterateeCall");function ip(u,h){if(Bt(u))return!1;var S=typeof u;return S=="number"||S=="symbol"||S=="boolean"||u==null||Vn(u)?!0:ot.test(u)||!or.test(u)||h!=null&&u in _r(h)}i(ip,"isKey"),o(ip,"isKey");function v5(u){var h=typeof u;return h=="string"||h=="number"||h=="symbol"||h=="boolean"?u!=="__proto__":u===null}i(v5,"isKeyable"),o(v5,"isKeyable");function ap(u){var h=vf(u),S=se[h];if(typeof S!="function"||!(h in Wt.prototype))return!1;if(u===S)return!0;var H=Eg(S);return!!H&&u===H[0]}i(ap,"isLaziable"),o(ap,"isLaziable");function y5(u){return!!$2&&$2 in u}i(y5,"isMasked"),o(y5,"isMasked");var yR=Sh?Na:bp;function lu(u){var h=u&&u.constructor,S=typeof h=="function"&&h.prototype||eu;return u===S}i(lu,"isPrototype"),o(lu,"isPrototype");function Tg(u){return u===u&&!kr(u)}i(Tg,"isStrictComparable"),o(Tg,"isStrictComparable");function Cg(u,h){return function(S){return S==null?!1:S[u]===h&&(h!==r||u in _r(S))}}i(Cg,"matchesStrictComparable"),o(Cg,"matchesStrictComparable");function b5(u){var h=Af(u,function(H){return S.size===p&&S.clear(),H}),S=h.cache;return h}i(b5,"memoizeCapped"),o(b5,"memoizeCapped");function w5(u,h){var S=u[1],H=h[1],te=S|H,ce=te<(D|L|k),ye=H==k&&S==z||H==k&&S==K&&u[7].length<=h[8]||H==(k|K)&&h[7].length<=h[8]&&S==z;if(!(ce||ye))return u;H&D&&(u[2]=h[2],te|=S&D?0:Z);var Ee=h[3];if(Ee){var xe=u[3];u[3]=xe?cg(xe,Ee,h[4]):Ee,u[4]=xe?uo(u[3],g):h[4]}return Ee=h[5],Ee&&(xe=u[5],u[5]=xe?ug(xe,Ee,h[6]):Ee,u[6]=xe?uo(u[5],g):h[6]),Ee=h[7],Ee&&(u[7]=Ee),H&k&&(u[8]=u[8]==null?h[8]:vn(u[8],h[8])),u[9]==null&&(u[9]=h[9]),u[0]=h[0],u[1]=te,u}i(w5,"mergeData"),o(w5,"mergeData");function _5(u){var h=[];if(u!=null)for(var S in _r(u))h.push(S);return h}i(_5,"nativeKeysIn"),o(_5,"nativeKeysIn");function E5(u){return Th.call(u)}i(E5,"objectToString"),o(E5,"objectToString");function Mg(u,h,S){return h=Zr(h===r?u.length-1:h,0),function(){for(var H=arguments,te=-1,ce=Zr(H.length-h,0),ye=ke(ce);++te<ce;)ye[te]=H[h+te];te=-1;for(var Ee=ke(h+1);++te<h;)Ee[te]=H[te];return Ee[h]=S(ye),zn(u,this,Ee)}}i(Mg,"overRest"),o(Mg,"overRest");function Ig(u,h){return h.length<2?u:Zo(u,ci(h,0,-1))}i(Ig,"parent"),o(Ig,"parent");function A5(u,h){for(var S=u.length,H=vn(h.length,S),te=In(u);H--;){var ce=h[H];u[H]=Oa(ce,S)?te[ce]:r}return u}i(A5,"reorder"),o(A5,"reorder");function op(u,h){if(!(h==="constructor"&&typeof u[h]=="function")&&h!="__proto__")return u[h]}i(op,"safeGet"),o(op,"safeGet");var S5=Rg(Gw),bf=nR||function(u,h){return Fr.setTimeout(u,h)},kg=Rg(mR);function Dg(u,h,S){var H=h+"";return kg(u,m5(H,T5(d5(H),S)))}i(Dg,"setWrapToString"),o(Dg,"setWrapToString");function Rg(u){var h=0,S=0;return function(){var H=sR(),te=w-(H-S);if(S=H,te>0){if(++h>=J)return arguments[0]}else h=0;return u.apply(r,arguments)}}i(Rg,"shortOut"),o(Rg,"shortOut");function wf(u,h){var S=-1,H=u.length,te=H-1;for(h=h===r?H:h;++S<h;){var ce=Vh(S,te),ye=u[ce];u[ce]=u[S],u[S]=ye}return u.length=h,u}i(wf,"shuffleSelf"),o(wf,"shuffleSelf");var x5=b5(function(u){var h=[];return u.charCodeAt(0)===46&&h.push(""),u.replace(Xe,function(S,H,te,ce){h.push(te?ce.replace(Tn,"$1"):H||S)}),h});function ea(u){if(typeof u=="string"||Vn(u))return u;var h=u+"";return h=="0"&&1/u==-m?"-0":h}i(ea,"toKey"),o(ea,"toKey");function Yo(u){if(u!=null){try{return xh.call(u)}catch{}try{return u+""}catch{}}return""}i(Yo,"toSource"),o(Yo,"toSource");function T5(u,h){return ai(I,function(S){var H="_."+S[0];h&S[1]&&!Jl(u,H)&&u.push(H)}),u.sort()}i(T5,"updateWrapDetails"),o(T5,"updateWrapDetails");function Og(u){if(u instanceof Wt)return u.clone();var h=new oi(u.__wrapped__,u.__chain__);return h.__actions__=In(u.__actions__),h.__index__=u.__index__,h.__values__=u.__values__,h}i(Og,"wrapperClone"),o(Og,"wrapperClone");function C5(u,h,S){(S?wn(u,h,S):h===r)?h=1:h=Zr(Ft(h),0);var H=u==null?0:u.length;if(!H||h<1)return[];for(var te=0,ce=0,ye=ke(Rh(H/h));te<H;)ye[ce++]=ci(u,te,te+=h);return ye}i(C5,"chunk"),o(C5,"chunk");function M5(u){for(var h=-1,S=u==null?0:u.length,H=0,te=[];++h<S;){var ce=u[h];ce&&(te[H++]=ce)}return te}i(M5,"compact"),o(M5,"compact");function I5(){var u=arguments.length;if(!u)return[];for(var h=ke(u-1),S=arguments[0],H=u;H--;)h[H-1]=arguments[H];return co(Bt(S)?In(S):[S],Qr(h,1))}i(I5,"concat4"),o(I5,"concat");var bR=Ht(function(u,h){return Pr(u)?au(u,Qr(h,1,Pr,!0)):[]}),wR=Ht(function(u,h){var S=ui(h);return Pr(S)&&(S=r),Pr(u)?au(u,Qr(h,1,Pr,!0),Et(S,2)):[]}),_R=Ht(function(u,h){var S=ui(h);return Pr(S)&&(S=r),Pr(u)?au(u,Qr(h,1,Pr,!0),r,S):[]});function k5(u,h,S){var H=u==null?0:u.length;return H?(h=S||h===r?1:Ft(h),ci(u,h<0?0:h,H)):[]}i(k5,"drop"),o(k5,"drop");function D5(u,h,S){var H=u==null?0:u.length;return H?(h=S||h===r?1:Ft(h),h=H-h,ci(u,0,h<0?0:h)):[]}i(D5,"dropRight"),o(D5,"dropRight");function R5(u,h){return u&&u.length?ff(u,Et(h,3),!0,!0):[]}i(R5,"dropRightWhile"),o(R5,"dropRightWhile");function O5(u,h){return u&&u.length?ff(u,Et(h,3),!0):[]}i(O5,"dropWhile"),o(O5,"dropWhile");function N5(u,h,S,H){var te=u==null?0:u.length;return te?(S&&typeof S!="number"&&wn(u,h,S)&&(S=0,H=te),Cw(u,h,S,H)):[]}i(N5,"fill"),o(N5,"fill");function Ng(u,h,S){var H=u==null?0:u.length;if(!H)return-1;var te=S==null?0:Ft(S);return te<0&&(te=Zr(H+te,0)),Yl(u,Et(h,3),te)}i(Ng,"findIndex"),o(Ng,"findIndex");function Pg(u,h,S){var H=u==null?0:u.length;if(!H)return-1;var te=H-1;return S!==r&&(te=Ft(S),te=S<0?Zr(H+te,0):vn(te,H-1)),Yl(u,Et(h,3),te,!0)}i(Pg,"findLastIndex"),o(Pg,"findLastIndex");function Bg(u){var h=u==null?0:u.length;return h?Qr(u,1):[]}i(Bg,"flatten"),o(Bg,"flatten");function P5(u){var h=u==null?0:u.length;return h?Qr(u,m):[]}i(P5,"flattenDeep"),o(P5,"flattenDeep");function B5(u,h){var S=u==null?0:u.length;return S?(h=h===r?1:Ft(h),Qr(u,h)):[]}i(B5,"flattenDepth"),o(B5,"flattenDepth");function L5(u){for(var h=-1,S=u==null?0:u.length,H={};++h<S;){var te=u[h];H[te[0]]=te[1]}return H}i(L5,"fromPairs"),o(L5,"fromPairs");function Lg(u){return u&&u.length?u[0]:r}i(Lg,"head"),o(Lg,"head");function U5(u,h,S){var H=u==null?0:u.length;if(!H)return-1;var te=S==null?0:Ft(S);return te<0&&(te=Zr(H+te,0)),zs(u,h,te)}i(U5,"indexOf"),o(U5,"indexOf");function F5(u){var h=u==null?0:u.length;return h?ci(u,0,-1):[]}i(F5,"initial"),o(F5,"initial");var ER=Ht(function(u){var h=Mr(u,Jh);return h.length&&h[0]===u[0]?jh(h):[]}),AR=Ht(function(u){var h=ui(u),S=Mr(u,Jh);return h===ui(S)?h=r:S.pop(),S.length&&S[0]===u[0]?jh(S,Et(h,2)):[]}),SR=Ht(function(u){var h=ui(u),S=Mr(u,Jh);return h=typeof h=="function"?h:r,h&&S.pop(),S.length&&S[0]===u[0]?jh(S,r,h):[]});function j5(u,h){return u==null?"":aR.call(u,h)}i(j5,"join"),o(j5,"join");function ui(u){var h=u==null?0:u.length;return h?u[h-1]:r}i(ui,"last2"),o(ui,"last");function $5(u,h,S){var H=u==null?0:u.length;if(!H)return-1;var te=H;return S!==r&&(te=Ft(S),te=te<0?Zr(H+te,0):vn(te,H-1)),h===h?L2(u,h,te):Yl(u,S1,te,!0)}i($5,"lastIndexOf"),o($5,"lastIndexOf");function z5(u,h){return u&&u.length?J1(u,Ft(h)):r}i(z5,"nth"),o(z5,"nth");var xR=Ht(Ug);function Ug(u,h){return u&&u.length&&h&&h.length?qh(u,h):u}i(Ug,"pullAll"),o(Ug,"pullAll");function H5(u,h,S){return u&&u.length&&h&&h.length?qh(u,h,Et(S,2)):u}i(H5,"pullAllBy"),o(H5,"pullAllBy");function q5(u,h,S){return u&&u.length&&h&&h.length?qh(u,h,r,S):u}i(q5,"pullAllWith"),o(q5,"pullAllWith");var TR=Ra(function(u,h){var S=u==null?0:u.length,H=Lh(u,h);return Q1(u,Mr(h,function(te){return Oa(te,S)?+te:te}).sort(sg)),H});function V5(u,h){var S=[];if(!(u&&u.length))return S;var H=-1,te=[],ce=u.length;for(h=Et(h,3);++H<ce;){var ye=u[H];h(ye,H,u)&&(S.push(ye),te.push(H))}return Q1(u,te),S}i(V5,"remove"),o(V5,"remove");function sp(u){return u==null?u:uR.call(u)}i(sp,"reverse"),o(sp,"reverse");function K5(u,h,S){var H=u==null?0:u.length;return H?(S&&typeof S!="number"&&wn(u,h,S)?(h=0,S=H):(h=h==null?0:Ft(h),S=S===r?H:Ft(S)),ci(u,h,S)):[]}i(K5,"slice2"),o(K5,"slice");function G5(u,h){return lf(u,h)}i(G5,"sortedIndex"),o(G5,"sortedIndex");function W5(u,h,S){return Gh(u,h,Et(S,2))}i(W5,"sortedIndexBy"),o(W5,"sortedIndexBy");function Z5(u,h){var S=u==null?0:u.length;if(S){var H=lf(u,h);if(H<S&&Fi(u[H],h))return H}return-1}i(Z5,"sortedIndexOf"),o(Z5,"sortedIndexOf");function J5(u,h){return lf(u,h,!0)}i(J5,"sortedLastIndex"),o(J5,"sortedLastIndex");function Y5(u,h,S){return Gh(u,h,Et(S,2),!0)}i(Y5,"sortedLastIndexBy"),o(Y5,"sortedLastIndexBy");function X5(u,h){var S=u==null?0:u.length;if(S){var H=lf(u,h,!0)-1;if(Fi(u[H],h))return H}return-1}i(X5,"sortedLastIndexOf"),o(X5,"sortedLastIndexOf");function Q5(u){return u&&u.length?eg(u):[]}i(Q5,"sortedUniq"),o(Q5,"sortedUniq");function e4(u,h){return u&&u.length?eg(u,Et(h,2)):[]}i(e4,"sortedUniqBy"),o(e4,"sortedUniqBy");function t4(u){var h=u==null?0:u.length;return h?ci(u,1,h):[]}i(t4,"tail"),o(t4,"tail");function r4(u,h,S){return u&&u.length?(h=S||h===r?1:Ft(h),ci(u,0,h<0?0:h)):[]}i(r4,"take2"),o(r4,"take");function n4(u,h,S){var H=u==null?0:u.length;return H?(h=S||h===r?1:Ft(h),h=H-h,ci(u,h<0?0:h,H)):[]}i(n4,"takeRight"),o(n4,"takeRight");function i4(u,h){return u&&u.length?ff(u,Et(h,3),!1,!0):[]}i(i4,"takeRightWhile"),o(i4,"takeRightWhile");function a4(u,h){return u&&u.length?ff(u,Et(h,3)):[]}i(a4,"takeWhile"),o(a4,"takeWhile");var CR=Ht(function(u){return lo(Qr(u,1,Pr,!0))}),MR=Ht(function(u){var h=ui(u);return Pr(h)&&(h=r),lo(Qr(u,1,Pr,!0),Et(h,2))}),IR=Ht(function(u){var h=ui(u);return h=typeof h=="function"?h:r,lo(Qr(u,1,Pr,!0),r,h)});function o4(u){return u&&u.length?lo(u):[]}i(o4,"uniq"),o(o4,"uniq");function s4(u,h){return u&&u.length?lo(u,Et(h,2)):[]}i(s4,"uniqBy"),o(s4,"uniqBy");function c4(u,h){return h=typeof h=="function"?h:r,u&&u.length?lo(u,r,h):[]}i(c4,"uniqWith"),o(c4,"uniqWith");function cp(u){if(!(u&&u.length))return[];var h=0;return u=so(u,function(S){if(Pr(S))return h=Zr(S.length,h),!0}),wh(h,function(S){return Mr(u,vh(S))})}i(cp,"unzip"),o(cp,"unzip");function Fg(u,h){if(!(u&&u.length))return[];var S=cp(u);return h==null?S:Mr(S,function(H){return zn(h,r,H)})}i(Fg,"unzipWith"),o(Fg,"unzipWith");var kR=Ht(function(u,h){return Pr(u)?au(u,h):[]}),DR=Ht(function(u){return Zh(so(u,Pr))}),RR=Ht(function(u){var h=ui(u);return Pr(h)&&(h=r),Zh(so(u,Pr),Et(h,2))}),OR=Ht(function(u){var h=ui(u);return h=typeof h=="function"?h:r,Zh(so(u,Pr),r,h)}),NR=Ht(cp);function u4(u,h){return ig(u||[],h||[],iu)}i(u4,"zipObject"),o(u4,"zipObject");function l4(u,h){return ig(u||[],h||[],cu)}i(l4,"zipObjectDeep"),o(l4,"zipObjectDeep");var PR=Ht(function(u){var h=u.length,S=h>1?u[h-1]:r;return S=typeof S=="function"?(u.pop(),S):r,Fg(u,S)});function jg(u){var h=se(u);return h.__chain__=!0,h}i(jg,"chain"),o(jg,"chain");function f4(u,h){return h(u),u}i(f4,"tap"),o(f4,"tap");function _f(u,h){return h(u)}i(_f,"thru"),o(_f,"thru");var BR=Ra(function(u){var h=u.length,S=h?u[0]:0,H=this.__wrapped__,te=o(function(ce){return Lh(ce,u)},"interceptor");return h>1||this.__actions__.length||!(H instanceof Wt)||!Oa(S)?this.thru(te):(H=H.slice(S,+S+(h?1:0)),H.__actions__.push({func:_f,args:[te],thisArg:r}),new oi(H,this.__chain__).thru(function(ce){return h&&!ce.length&&ce.push(r),ce}))});function d4(){return jg(this)}i(d4,"wrapperChain"),o(d4,"wrapperChain");function h4(){return new oi(this.value(),this.__chain__)}i(h4,"wrapperCommit"),o(h4,"wrapperCommit");function p4(){this.__values__===r&&(this.__values__=Qg(this.value()));var u=this.__index__>=this.__values__.length,h=u?r:this.__values__[this.__index__++];return{done:u,value:h}}i(p4,"wrapperNext"),o(p4,"wrapperNext");function m4(){return this}i(m4,"wrapperToIterator"),o(m4,"wrapperToIterator");function g4(u){for(var h,S=this;S instanceof af;){var H=Og(S);H.__index__=0,H.__values__=r,h?te.__wrapped__=H:h=H;var te=H;S=S.__wrapped__}return te.__wrapped__=u,h}i(g4,"wrapperPlant"),o(g4,"wrapperPlant");function v4(){var u=this.__wrapped__;if(u instanceof Wt){var h=u;return this.__actions__.length&&(h=new Wt(this)),h=h.reverse(),h.__actions__.push({func:_f,args:[sp],thisArg:r}),new oi(h,this.__chain__)}return this.thru(sp)}i(v4,"wrapperReverse"),o(v4,"wrapperReverse");function y4(){return ng(this.__wrapped__,this.__actions__)}i(y4,"wrapperValue"),o(y4,"wrapperValue");var LR=df(function(u,h,S){yr.call(u,S)?++u[S]:ka(u,S,1)});function b4(u,h,S){var H=Bt(u)?E1:Tw;return S&&wn(u,h,S)&&(h=r),H(u,Et(h,3))}i(b4,"every"),o(b4,"every");function w4(u,h){var S=Bt(u)?so:$1;return S(u,Et(h,3))}i(w4,"filter2"),o(w4,"filter");var UR=hg(Ng),FR=hg(Pg);function _4(u,h){return Qr(Ef(u,h),1)}i(_4,"flatMap"),o(_4,"flatMap");function E4(u,h){return Qr(Ef(u,h),m)}i(E4,"flatMapDeep"),o(E4,"flatMapDeep");function A4(u,h,S){return S=S===r?1:Ft(S),Qr(Ef(u,h),S)}i(A4,"flatMapDepth"),o(A4,"flatMapDepth");function $g(u,h){var S=Bt(u)?ai:Wo;return S(u,Et(h,3))}i($g,"forEach"),o($g,"forEach");function zg(u,h){var S=Bt(u)?A2:xw;return S(u,Et(h,3))}i(zg,"forEachRight"),o(zg,"forEachRight");var jR=df(function(u,h,S){yr.call(u,S)?u[S].push(h):ka(u,S,[h])});function S4(u,h,S,H){u=kn(u)?u:Js(u),S=S&&!H?Ft(S):0;var te=u.length;return S<0&&(S=Zr(te+S,0)),Tf(u)?S<=te&&u.indexOf(h,S)>-1:!!te&&zs(u,h,S)>-1}i(S4,"includes"),o(S4,"includes");var $R=Ht(function(u,h,S){var H=-1,te=typeof h=="function",ce=kn(u)?ke(u.length):[];return Wo(u,function(ye){ce[++H]=te?zn(h,ye,S):ou(ye,h,S)}),ce}),zR=df(function(u,h,S){ka(u,S,h)});function Ef(u,h){var S=Bt(u)?Mr:G1;return S(u,Et(h,3))}i(Ef,"map2"),o(Ef,"map");function x4(u,h,S,H){return u==null?[]:(Bt(h)||(h=h==null?[]:[h]),S=H?r:S,Bt(S)||(S=S==null?[]:[S]),Y1(u,h,S))}i(x4,"orderBy"),o(x4,"orderBy");var HR=df(function(u,h,S){u[S?0:1].push(h)},function(){return[[],[]]});function T4(u,h,S){var H=Bt(u)?mh:T1,te=arguments.length<3;return H(u,Et(h,4),S,te,Wo)}i(T4,"reduce"),o(T4,"reduce");function C4(u,h,S){var H=Bt(u)?S2:T1,te=arguments.length<3;return H(u,Et(h,4),S,te,xw)}i(C4,"reduceRight"),o(C4,"reduceRight");function M4(u,h){var S=Bt(u)?so:$1;return S(u,Sf(Et(h,3)))}i(M4,"reject"),o(M4,"reject");function I4(u){var h=Bt(u)?L1:Vw;return h(u)}i(I4,"sample"),o(I4,"sample");function k4(u,h,S){(S?wn(u,h,S):h===r)?h=1:h=Ft(h);var H=Bt(u)?ww:Kw;return H(u,h)}i(k4,"sampleSize"),o(k4,"sampleSize");function D4(u){var h=Bt(u)?_w:Ww;return h(u)}i(D4,"shuffle"),o(D4,"shuffle");function R4(u){if(u==null)return 0;if(kn(u))return Tf(u)?qs(u):u.length;var h=bn(u);return h==be||h==ee?u.size:zh(u).length}i(R4,"size"),o(R4,"size");function O4(u,h,S){var H=Bt(u)?gh:Zw;return S&&wn(u,h,S)&&(h=r),H(u,Et(h,3))}i(O4,"some"),o(O4,"some");var qR=Ht(function(u,h){if(u==null)return[];var S=h.length;return S>1&&wn(u,h[0],h[1])?h=[]:S>2&&wn(h[0],h[1],h[2])&&(h=[h[0]]),Y1(u,Qr(h,1),[])}),up=rR||function(){return Fr.Date.now()};function N4(u,h){if(typeof h!="function")throw new Li(c);return u=Ft(u),function(){if(--u<1)return h.apply(this,arguments)}}i(N4,"after"),o(N4,"after");function Hg(u,h,S){return h=S?r:h,h=u&&h==null?u.length:h,Da(u,k,r,r,r,r,h)}i(Hg,"ary"),o(Hg,"ary");function qg(u,h){var S;if(typeof h!="function")throw new Li(c);return u=Ft(u),function(){return--u>0&&(S=h.apply(this,arguments)),u<=1&&(h=r),S}}i(qg,"before"),o(qg,"before");var Vg=Ht(function(u,h,S){var H=D;if(S.length){var te=uo(S,Ws(Vg));H|=Q}return Da(u,H,h,S,te)}),P4=Ht(function(u,h,S){var H=D|L;if(S.length){var te=uo(S,Ws(P4));H|=Q}return Da(h,H,u,S,te)});function Kg(u,h,S){h=S?r:h;var H=Da(u,z,r,r,r,r,r,h);return H.placeholder=Kg.placeholder,H}i(Kg,"curry"),o(Kg,"curry");function Gg(u,h,S){h=S?r:h;var H=Da(u,q,r,r,r,r,r,h);return H.placeholder=Gg.placeholder,H}i(Gg,"curryRight"),o(Gg,"curryRight");function Wg(u,h,S){var H,te,ce,ye,Ee,xe,Ue=0,Fe=!1,$e=!1,Ye=!0;if(typeof u!="function")throw new Li(c);h=li(h)||0,kr(S)&&(Fe=!!S.leading,$e="maxWait"in S,ce=$e?Zr(li(S.maxWait)||0,h):ce,Ye="trailing"in S?!!S.trailing:Ye);function gt(jr){var ta=H,po=te;return H=te=r,Ue=jr,ye=u.apply(po,ta),ye}i(gt,"invokeFunc"),o(gt,"invokeFunc");function Tt(jr){return Ue=jr,Ee=bf(Kt,h),Fe?gt(jr):ye}i(Tt,"leadingEdge"),o(Tt,"leadingEdge");function $t(jr){var ta=jr-xe,po=jr-Ue,D8=h-ta;return $e?vn(D8,ce-po):D8}i($t,"remainingWait"),o($t,"remainingWait");function At(jr){var ta=jr-xe,po=jr-Ue;return xe===r||ta>=h||ta<0||$e&&po>=ce}i(At,"shouldInvoke"),o(At,"shouldInvoke");function Kt(){var jr=up();if(At(jr))return Zt(jr);Ee=bf(Kt,$t(jr))}i(Kt,"timerExpired"),o(Kt,"timerExpired");function Zt(jr){return Ee=r,Ye&&H?gt(jr):(H=te=r,ye)}i(Zt,"trailingEdge"),o(Zt,"trailingEdge");function Kn(){Ee!==r&&Jw(Ee),Ue=0,H=xe=te=Ee=r}i(Kn,"cancel"),o(Kn,"cancel");function _n(){return Ee===r?ye:Zt(up())}i(_n,"flush"),o(_n,"flush");function Gn(){var jr=up(),ta=At(jr);if(H=arguments,te=this,xe=jr,ta){if(Ee===r)return Tt(xe);if($e)return Jw(Ee),Ee=bf(Kt,h),gt(xe)}return Ee===r&&(Ee=bf(Kt,h)),ye}return i(Gn,"debounced"),o(Gn,"debounced"),Gn.cancel=Kn,Gn.flush=_n,Gn}i(Wg,"debounce"),o(Wg,"debounce");var VR=Ht(function(u,h){return j1(u,1,h)}),KR=Ht(function(u,h,S){return j1(u,li(h)||0,S)});function B4(u){return Da(u,he)}i(B4,"flip"),o(B4,"flip");function Af(u,h){if(typeof u!="function"||h!=null&&typeof h!="function")throw new Li(c);var S=o(function(){var H=arguments,te=h?h.apply(this,H):H[0],ce=S.cache;if(ce.has(te))return ce.get(te);var ye=u.apply(this,H);return S.cache=ce.set(te,ye)||ce,ye},"memoized");return S.cache=new(Af.Cache||Ia),S}i(Af,"memoize"),o(Af,"memoize"),Af.Cache=Ia;function Sf(u){if(typeof u!="function")throw new Li(c);return function(){var h=arguments;switch(h.length){case 0:return!u.call(this);case 1:return!u.call(this,h[0]);case 2:return!u.call(this,h[0],h[1]);case 3:return!u.call(this,h[0],h[1],h[2])}return!u.apply(this,h)}}i(Sf,"negate"),o(Sf,"negate");function L4(u){return qg(2,u)}i(L4,"once"),o(L4,"once");var GR=gR(function(u,h){h=h.length==1&&Bt(h[0])?Mr(h[0],Hn(Et())):Mr(Qr(h,1),Hn(Et()));var S=h.length;return Ht(function(H){for(var te=-1,ce=vn(H.length,S);++te<ce;)H[te]=h[te].call(this,H[te]);return zn(u,this,H)})}),Zg=Ht(function(u,h){var S=uo(h,Ws(Zg));return Da(u,Q,r,h,S)}),U4=Ht(function(u,h){var S=uo(h,Ws(U4));return Da(u,Y,r,h,S)}),WR=Ra(function(u,h){return Da(u,K,r,r,r,h)});function F4(u,h){if(typeof u!="function")throw new Li(c);return h=h===r?h:Ft(h),Ht(u,h)}i(F4,"rest"),o(F4,"rest");function j4(u,h){if(typeof u!="function")throw new Li(c);return h=h==null?0:Zr(Ft(h),0),Ht(function(S){var H=S[h],te=ho(S,0,h);return H&&co(te,H),zn(u,this,te)})}i(j4,"spread"),o(j4,"spread");function $4(u,h,S){var H=!0,te=!0;if(typeof u!="function")throw new Li(c);return kr(S)&&(H="leading"in S?!!S.leading:H,te="trailing"in S?!!S.trailing:te),Wg(u,h,{leading:H,maxWait:h,trailing:te})}i($4,"throttle2"),o($4,"throttle");function z4(u){return Hg(u,1)}i(z4,"unary"),o(z4,"unary");function H4(u,h){return Zg(Yh(h),u)}i(H4,"wrap"),o(H4,"wrap");function q4(){if(!arguments.length)return[];var u=arguments[0];return Bt(u)?u:[u]}i(q4,"castArray"),o(q4,"castArray");function V4(u){return si(u,_)}i(V4,"clone"),o(V4,"clone");function K4(u,h){return h=typeof h=="function"?h:r,si(u,_,h)}i(K4,"cloneWith"),o(K4,"cloneWith");function G4(u){return si(u,v|_)}i(G4,"cloneDeep6"),o(G4,"cloneDeep");function W4(u,h){return h=typeof h=="function"?h:r,si(u,v|_,h)}i(W4,"cloneDeepWith"),o(W4,"cloneDeepWith");function Z4(u,h){return h==null||F1(u,h,Jr(h))}i(Z4,"conformsTo"),o(Z4,"conformsTo");function Fi(u,h){return u===h||u!==u&&h!==h}i(Fi,"eq4"),o(Fi,"eq");var ZR=gf(Fh),JR=gf(function(u,h){return u>=h}),Zs=q1(function(){return arguments}())?q1:function(u){return Dr(u)&&yr.call(u,"callee")&&!q2.call(u,"callee")},Bt=ke.isArray,YR=$s?Hn($s):Ow;function kn(u){return u!=null&&xf(u.length)&&!Na(u)}i(kn,"isArrayLike2"),o(kn,"isArrayLike");function Pr(u){return Dr(u)&&kn(u)}i(Pr,"isArrayLikeObject"),o(Pr,"isArrayLikeObject");function J4(u){return u===!0||u===!1||Dr(u)&&yn(u)==ne}i(J4,"isBoolean"),o(J4,"isBoolean");var Xo=iR||bp,XR=v2?Hn(v2):Nw;function Y4(u){return Dr(u)&&u.nodeType===1&&!fu(u)}i(Y4,"isElement"),o(Y4,"isElement");function X4(u){if(u==null)return!0;if(kn(u)&&(Bt(u)||typeof u=="string"||typeof u.splice=="function"||Xo(u)||du(u)||Zs(u)))return!u.length;var h=bn(u);if(h==be||h==ee)return!u.size;if(lu(u))return!zh(u).length;for(var S in u)if(yr.call(u,S))return!1;return!0}i(X4,"isEmpty"),o(X4,"isEmpty");function Q4(u,h){return su(u,h)}i(Q4,"isEqual"),o(Q4,"isEqual");function e_(u,h,S){S=typeof S=="function"?S:r;var H=S?S(u,h):r;return H===r?su(u,h,r,S):!!H}i(e_,"isEqualWith"),o(e_,"isEqualWith");function lp(u){if(!Dr(u))return!1;var h=yn(u);return h==G||h==M||typeof u.message=="string"&&typeof u.name=="string"&&!fu(u)}i(lp,"isError"),o(lp,"isError");function t_(u){return typeof u=="number"&&K2(u)}i(t_,"isFinite2"),o(t_,"isFinite");function Na(u){if(!kr(u))return!1;var h=yn(u);return h==ae||h==fe||h==F||h==W}i(Na,"isFunction2"),o(Na,"isFunction");function Jg(u){return typeof u=="number"&&u==Ft(u)}i(Jg,"isInteger3"),o(Jg,"isInteger");function xf(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=E}i(xf,"isLength"),o(xf,"isLength");function kr(u){var h=typeof u;return u!=null&&(h=="object"||h=="function")}i(kr,"isObject"),o(kr,"isObject");function Dr(u){return u!=null&&typeof u=="object"}i(Dr,"isObjectLike"),o(Dr,"isObjectLike");var r_=y2?Hn(y2):Bw;function n_(u,h){return u===h||$h(u,h,np(h))}i(n_,"isMatch"),o(n_,"isMatch");function i_(u,h,S){return S=typeof S=="function"?S:r,$h(u,h,np(h),S)}i(i_,"isMatchWith"),o(i_,"isMatchWith");function a_(u){return Yg(u)&&u!=+u}i(a_,"isNaN2"),o(a_,"isNaN");function o_(u){if(yR(u))throw new Nt(s);return V1(u)}i(o_,"isNative"),o(o_,"isNative");function s_(u){return u===null}i(s_,"isNull"),o(s_,"isNull");function c_(u){return u==null}i(c_,"isNil"),o(c_,"isNil");function Yg(u){return typeof u=="number"||Dr(u)&&yn(u)==Re}i(Yg,"isNumber"),o(Yg,"isNumber");function fu(u){if(!Dr(u)||yn(u)!=N)return!1;var h=Ih(u);if(h===null)return!0;var S=yr.call(h,"constructor")&&h.constructor;return typeof S=="function"&&S instanceof S&&xh.call(S)==XD}i(fu,"isPlainObject"),o(fu,"isPlainObject");var Xg=b2?Hn(b2):Lw;function u_(u){return Jg(u)&&u>=-E&&u<=E}i(u_,"isSafeInteger"),o(u_,"isSafeInteger");var l_=w2?Hn(w2):Uw;function Tf(u){return typeof u=="string"||!Bt(u)&&Dr(u)&&yn(u)==ue}i(Tf,"isString"),o(Tf,"isString");function Vn(u){return typeof u=="symbol"||Dr(u)&&yn(u)==Ae}i(Vn,"isSymbol"),o(Vn,"isSymbol");var du=_2?Hn(_2):Fw;function f_(u){return u===r}i(f_,"isUndefined"),o(f_,"isUndefined");function d_(u){return Dr(u)&&bn(u)==Ie}i(d_,"isWeakMap"),o(d_,"isWeakMap");function h_(u){return Dr(u)&&yn(u)==Be}i(h_,"isWeakSet"),o(h_,"isWeakSet");var QR=gf(Hh),eO=gf(function(u,h){return u<=h});function Qg(u){if(!u)return[];if(kn(u))return Tf(u)?Bi(u):In(u);if(Ql&&u[Ql])return N2(u[Ql]());var h=bn(u),S=h==be?Eh:h==ee?Xl:Js;return S(u)}i(Qg,"toArray"),o(Qg,"toArray");function Pa(u){if(!u)return u===0?u:0;if(u=li(u),u===m||u===-m){var h=u<0?-1:1;return h*R}return u===u?u:0}i(Pa,"toFinite"),o(Pa,"toFinite");function Ft(u){var h=Pa(u),S=h%1;return h===h?S?h-S:h:0}i(Ft,"toInteger"),o(Ft,"toInteger");function ev(u){return u?Go(Ft(u),0,A):0}i(ev,"toLength"),o(ev,"toLength");function li(u){if(typeof u=="number")return u;if(Vn(u))return C;if(kr(u)){var h=typeof u.valueOf=="function"?u.valueOf():u;u=kr(h)?h+"":h}if(typeof u!="string")return u===0?u:+u;u=C1(u);var S=er.test(u);return S||nn.test(u)?sn(u.slice(2),S?2:8):hn.test(u)?C:+u}i(li,"toNumber"),o(li,"toNumber");function tv(u){return Qi(u,Dn(u))}i(tv,"toPlainObject"),o(tv,"toPlainObject");function p_(u){return u?Go(Ft(u),-E,E):u===0?u:0}i(p_,"toSafeInteger"),o(p_,"toSafeInteger");function dr(u){return u==null?"":qn(u)}i(dr,"toString4"),o(dr,"toString");var tO=Ks(function(u,h){if(lu(h)||kn(h)){Qi(h,Jr(h),u);return}for(var S in h)yr.call(h,S)&&iu(u,S,h[S])}),m_=Ks(function(u,h){Qi(h,Dn(h),u)}),fp=Ks(function(u,h,S,H){Qi(h,Dn(h),u,H)}),rO=Ks(function(u,h,S,H){Qi(h,Jr(h),u,H)}),nO=Ra(Lh);function g_(u,h){var S=nu(u);return h==null?S:U1(S,h)}i(g_,"create2"),o(g_,"create");var iO=Ht(function(u,h){u=_r(u);var S=-1,H=h.length,te=H>2?h[2]:r;for(te&&wn(h[0],h[1],te)&&(H=1);++S<H;)for(var ce=h[S],ye=Dn(ce),Ee=-1,xe=ye.length;++Ee<xe;){var Ue=ye[Ee],Fe=u[Ue];(Fe===r||Fi(Fe,eu[Ue])&&!yr.call(u,Ue))&&(u[Ue]=ce[Ue])}return u}),aO=Ht(function(u){return u.push(r,wg),zn(M_,r,u)});function v_(u,h){return A1(u,Et(h,3),Xi)}i(v_,"findKey"),o(v_,"findKey");function y_(u,h){return A1(u,Et(h,3),Uh)}i(y_,"findLastKey"),o(y_,"findLastKey");function b_(u,h){return u==null?u:z1(u,Et(h,3),Dn)}i(b_,"forIn"),o(b_,"forIn");function w_(u,h){return u==null?u:Mw(u,Et(h,3),Dn)}i(w_,"forInRight"),o(w_,"forInRight");function __(u,h){return u&&Xi(u,Et(h,3))}i(__,"forOwn"),o(__,"forOwn");function E_(u,h){return u&&Uh(u,Et(h,3))}i(E_,"forOwnRight"),o(E_,"forOwnRight");function A_(u){return u==null?[]:cf(u,Jr(u))}i(A_,"functions"),o(A_,"functions");function S_(u){return u==null?[]:cf(u,Dn(u))}i(S_,"functionsIn"),o(S_,"functionsIn");function dp(u,h,S){var H=u==null?r:Zo(u,h);return H===r?S:H}i(dp,"get2"),o(dp,"get");function x_(u,h){return u!=null&&Sg(u,h,Iw)}i(x_,"has"),o(x_,"has");function hp(u,h){return u!=null&&Sg(u,h,kw)}i(hp,"hasIn"),o(hp,"hasIn");var oO=mg(function(u,h,S){h!=null&&typeof h.toString!="function"&&(h=Th.call(h)),u[h]=S},pp(Rn)),sO=mg(function(u,h,S){h!=null&&typeof h.toString!="function"&&(h=Th.call(h)),yr.call(u,h)?u[h].push(S):u[h]=[S]},Et),cO=Ht(ou);function Jr(u){return kn(u)?B1(u):zh(u)}i(Jr,"keys"),o(Jr,"keys");function Dn(u){return kn(u)?B1(u,!0):jw(u)}i(Dn,"keysIn"),o(Dn,"keysIn");function T_(u,h){var S={};return h=Et(h,3),Xi(u,function(H,te,ce){ka(S,h(H,te,ce),H)}),S}i(T_,"mapKeys"),o(T_,"mapKeys");function C_(u,h){var S={};return h=Et(h,3),Xi(u,function(H,te,ce){ka(S,te,h(H,te,ce))}),S}i(C_,"mapValues"),o(C_,"mapValues");var uO=Ks(function(u,h,S){uf(u,h,S)}),M_=Ks(function(u,h,S,H){uf(u,h,S,H)}),lO=Ra(function(u,h){var S={};if(u==null)return S;var H=!1;h=Mr(h,function(ce){return ce=fo(ce,u),H||(H=ce.length>1),ce}),Qi(u,rp(u),S),H&&(S=si(S,v|y|_,o5));for(var te=h.length;te--;)Wh(S,h[te]);return S});function I_(u,h){return rv(u,Sf(Et(h)))}i(I_,"omitBy"),o(I_,"omitBy");var fO=Ra(function(u,h){return u==null?{}:zw(u,h)});function rv(u,h){if(u==null)return{};var S=Mr(rp(u),function(H){return[H]});return h=Et(h),X1(u,S,function(H,te){return h(H,te[0])})}i(rv,"pickBy"),o(rv,"pickBy");function k_(u,h,S){h=fo(h,u);var H=-1,te=h.length;for(te||(te=1,u=r);++H<te;){var ce=u==null?r:u[ea(h[H])];ce===r&&(H=te,ce=S),u=Na(ce)?ce.call(u):ce}return u}i(k_,"result"),o(k_,"result");function D_(u,h,S){return u==null?u:cu(u,h,S)}i(D_,"set"),o(D_,"set");function R_(u,h,S,H){return H=typeof H=="function"?H:r,u==null?u:cu(u,h,S,H)}i(R_,"setWith"),o(R_,"setWith");var O_=yg(Jr),N_=yg(Dn);function P_(u,h,S){var H=Bt(u),te=H||Xo(u)||du(u);if(h=Et(h,4),S==null){var ce=u&&u.constructor;te?S=H?new ce:[]:kr(u)?S=Na(ce)?nu(Ih(u)):{}:S={}}return(te?ai:Xi)(u,function(ye,Ee,xe){return h(S,ye,Ee,xe)}),S}i(P_,"transform"),o(P_,"transform");function B_(u,h){return u==null?!0:Wh(u,h)}i(B_,"unset"),o(B_,"unset");function L_(u,h,S){return u==null?u:rg(u,h,Yh(S))}i(L_,"update2"),o(L_,"update");function U_(u,h,S,H){return H=typeof H=="function"?H:r,u==null?u:rg(u,h,Yh(S),H)}i(U_,"updateWith"),o(U_,"updateWith");function Js(u){return u==null?[]:_h(u,Jr(u))}i(Js,"values"),o(Js,"values");function F_(u){return u==null?[]:_h(u,Dn(u))}i(F_,"valuesIn"),o(F_,"valuesIn");function j_(u,h,S){return S===r&&(S=h,h=r),S!==r&&(S=li(S),S=S===S?S:0),h!==r&&(h=li(h),h=h===h?h:0),Go(li(u),h,S)}i(j_,"clamp"),o(j_,"clamp");function $_(u,h,S){return h=Pa(h),S===r?(S=h,h=0):S=Pa(S),u=li(u),Dw(u,h,S)}i($_,"inRange"),o($_,"inRange");function z_(u,h,S){if(S&&typeof S!="boolean"&&wn(u,h,S)&&(h=S=r),S===r&&(typeof h=="boolean"?(S=h,h=r):typeof u=="boolean"&&(S=u,u=r)),u===r&&h===r?(u=0,h=1):(u=Pa(u),h===r?(h=u,u=0):h=Pa(h)),u>h){var H=u;u=h,h=H}if(S||u%1||h%1){var te=G2();return vn(u+te*(h-u+Kr("1e-"+((te+"").length-1))),h)}return Vh(u,h)}i(z_,"random"),o(z_,"random");var dO=Gs(function(u,h,S){return h=h.toLowerCase(),u+(S?nv(h):h)});function nv(u){return av(dr(u).toLowerCase())}i(nv,"capitalize"),o(nv,"capitalize");function iv(u){return u=dr(u),u&&u.replace(Nr,VD).replace(fh,"")}i(iv,"deburr"),o(iv,"deburr");function H_(u,h,S){u=dr(u),h=qn(h);var H=u.length;S=S===r?H:Go(Ft(S),0,H);var te=S;return S-=h.length,S>=0&&u.slice(S,te)==h}i(H_,"endsWith"),o(H_,"endsWith");function q_(u){return u=dr(u),u&&ft.test(u)?u.replace(Or,KD):u}i(q_,"escape"),o(q_,"escape");function V_(u){return u=dr(u),u&&st.test(u)?u.replace(Qt,"\\$&"):u}i(V_,"escapeRegExp"),o(V_,"escapeRegExp");var hO=Gs(function(u,h,S){return u+(S?"-":"")+h.toLowerCase()}),pO=Gs(function(u,h,S){return u+(S?" ":"")+h.toLowerCase()}),mO=dg("toLowerCase");function K_(u,h,S){u=dr(u),h=Ft(h);var H=h?qs(u):0;if(!h||H>=h)return u;var te=(h-H)/2;return mf(Oh(te),S)+u+mf(Rh(te),S)}i(K_,"pad2"),o(K_,"pad");function G_(u,h,S){u=dr(u),h=Ft(h);var H=h?qs(u):0;return h&&H<h?u+mf(h-H,S):u}i(G_,"padEnd"),o(G_,"padEnd");function W_(u,h,S){u=dr(u),h=Ft(h);var H=h?qs(u):0;return h&&H<h?mf(h-H,S)+u:u}i(W_,"padStart"),o(W_,"padStart");function Z_(u,h,S){return S||h==null?h=0:h&&(h=+h),cR(dr(u).replace(rt,""),h||0)}i(Z_,"parseInt2"),o(Z_,"parseInt");function J_(u,h,S){return(S?wn(u,h,S):h===r)?h=1:h=Ft(h),Kh(dr(u),h)}i(J_,"repeat"),o(J_,"repeat");function Y_(){var u=arguments,h=dr(u[0]);return u.length<3?h:h.replace(u[1],u[2])}i(Y_,"replace"),o(Y_,"replace");var gO=Gs(function(u,h,S){return u+(S?"_":"")+h.toLowerCase()});function X_(u,h,S){return S&&typeof S!="number"&&wn(u,h,S)&&(h=S=r),S=S===r?A:S>>>0,S?(u=dr(u),u&&(typeof h=="string"||h!=null&&!Xg(h))&&(h=qn(h),!h&&Hs(u))?ho(Bi(u),0,S):u.split(h,S)):[]}i(X_,"split"),o(X_,"split");var vO=Gs(function(u,h,S){return u+(S?" ":"")+av(h)});function Q_(u,h,S){return u=dr(u),S=S==null?0:Go(Ft(S),0,u.length),h=qn(h),u.slice(S,S+h.length)==h}i(Q_,"startsWith"),o(Q_,"startsWith");function e8(u,h,S){var H=se.templateSettings;S&&wn(u,h,S)&&(h=r),u=dr(u),h=fp({},h,H,bg);var te=fp({},h.imports,H.imports,bg),ce=Jr(te),ye=_h(te,ce),Ee,xe,Ue=0,Fe=h.interpolate||Vr,$e="__p += '",Ye=R1((h.escape||Vr).source+"|"+Fe.source+"|"+(Fe===at?xt:Vr).source+"|"+(h.evaluate||Vr).source+"|$","g"),gt="//# sourceURL="+(yr.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Yc+"]")+`
|
|
27
27
|
`;u.replace(Ye,function(At,Kt,Zt,Kn,_n,Gn){return Zt||(Zt=Kn),$e+=u.slice(Ue,Gn).replace(on,D2),Kt&&(Ee=!0,$e+=`' +
|
|
@@ -842,7 +842,7 @@ HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
|
|
|
842
842
|
`;function VM(e){return typeof e=="string"&&(e=K0(e)),r1(PM([K0(KH),K0(String(e.length)),e]))}i(VM,"hashMessage");o(VM,"hashMessage");var Rt=ir(yT()),Mo=ir(Um());function Gc(e,t,r){return r={path:t,exports:{},require:function(n,a){return KM(n,a??r.path)}},e(r,r.exports),r.exports}i(Gc,"createCommonjsModule");o(Gc,"createCommonjsModule");function KM(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}i(KM,"commonjsRequire");o(KM,"commonjsRequire");var _3=E3;function E3(e,t){if(!e)throw new Error(t||"Assertion failed")}i(E3,"assert");o(E3,"assert");E3.equal=o(i(function(t,r,n){if(t!=r)throw new Error(n||"Assertion failed: "+t+" != "+r)},"assertEqual"),"assertEqual");var ga=Gc(function(e,t){"use strict";var r=t;function n(c,l){if(Array.isArray(c))return c.slice();if(!c)return[];var d=[];if(typeof c!="string"){for(var p=0;p<c.length;p++)d[p]=c[p]|0;return d}if(l==="hex"){c=c.replace(/[^a-z0-9]+/ig,""),c.length%2!==0&&(c="0"+c);for(var p=0;p<c.length;p+=2)d.push(parseInt(c[p]+c[p+1],16))}else for(var p=0;p<c.length;p++){var g=c.charCodeAt(p),v=g>>8,y=g&255;v?d.push(v,y):d.push(y)}return d}i(n,"toArray"),o(n,"toArray"),r.toArray=n;function a(c){return c.length===1?"0"+c:c}i(a,"zero2"),o(a,"zero2"),r.zero2=a;function s(c){for(var l="",d=0;d<c.length;d++)l+=a(c[d].toString(16));return l}i(s,"toHex"),o(s,"toHex"),r.toHex=s,r.encode=o(i(function(l,d){return d==="hex"?s(l):l},"encode9"),"encode")}),Ci=Gc(function(e,t){"use strict";var r=t;r.assert=_3,r.toArray=ga.toArray,r.zero2=ga.zero2,r.toHex=ga.toHex,r.encode=ga.encode;function n(d,p,g){var v=new Array(Math.max(d.bitLength(),g)+1),y;for(y=0;y<v.length;y+=1)v[y]=0;var _=1<<p+1,x=d.clone();for(y=0;y<v.length;y++){var O,D=x.andln(_-1);x.isOdd()?(D>(_>>1)-1?O=(_>>1)-D:O=D,x.isubn(O)):O=0,v[y]=O,x.iushrn(1)}return v}i(n,"getNAF2"),o(n,"getNAF"),r.getNAF=n;function a(d,p){var g=[[],[]];d=d.clone(),p=p.clone();for(var v=0,y=0,_;d.cmpn(-v)>0||p.cmpn(-y)>0;){var x=d.andln(3)+v&3,O=p.andln(3)+y&3;x===3&&(x=-1),O===3&&(O=-1);var D;(x&1)===0?D=0:(_=d.andln(7)+v&7,(_===3||_===5)&&O===2?D=-x:D=x),g[0].push(D);var L;(O&1)===0?L=0:(_=p.andln(7)+y&7,(_===3||_===5)&&x===2?L=-O:L=O),g[1].push(L),2*v===D+1&&(v=1-v),2*y===L+1&&(y=1-y),d.iushrn(1),p.iushrn(1)}return g}i(a,"getJSF2"),o(a,"getJSF"),r.getJSF=a;function s(d,p,g){var v="_"+p;d.prototype[p]=o(i(function(){return this[v]!==void 0?this[v]:this[v]=g.call(this)},"cachedProperty2"),"cachedProperty")}i(s,"cachedProperty"),o(s,"cachedProperty"),r.cachedProperty=s;function c(d){return typeof d=="string"?r.toArray(d,"hex"):d}i(c,"parseBytes"),o(c,"parseBytes"),r.parseBytes=c;function l(d){return new Rt.default(d,"hex","le")}i(l,"intFromLE"),o(l,"intFromLE"),r.intFromLE=l}),bm=Ci.getNAF,GH=Ci.getJSF,wm=Ci.assert;function jo(e,t){this.type=e,this.p=new Rt.default(t.p,16),this.red=t.prime?Rt.default.red(t.prime):Rt.default.mont(this.p),this.zero=new Rt.default(0).toRed(this.red),this.one=new Rt.default(1).toRed(this.red),this.two=new Rt.default(2).toRed(this.red),this.n=t.n&&new Rt.default(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}i(jo,"BaseCurve");o(jo,"BaseCurve");var Wc=jo;jo.prototype.point=o(i(function(){throw new Error("Not implemented")},"point"),"point");jo.prototype.validate=o(i(function(){throw new Error("Not implemented")},"validate"),"validate");jo.prototype._fixedNafMul=o(i(function(t,r){wm(t.precomputed);var n=t._getDoubles(),a=bm(r,1,this._bitLength),s=(1<<n.step+1)-(n.step%2===0?2:1);s/=3;var c=[],l,d;for(l=0;l<a.length;l+=n.step){d=0;for(var p=l+n.step-1;p>=l;p--)d=(d<<1)+a[p];c.push(d)}for(var g=this.jpoint(null,null,null),v=this.jpoint(null,null,null),y=s;y>0;y--){for(l=0;l<c.length;l++)d=c[l],d===y?v=v.mixedAdd(n.points[l]):d===-y&&(v=v.mixedAdd(n.points[l].neg()));g=g.add(v)}return g.toP()},"_fixedNafMul"),"_fixedNafMul");jo.prototype._wnafMul=o(i(function(t,r){var n=4,a=t._getNAFPoints(n);n=a.wnd;for(var s=a.points,c=bm(r,n,this._bitLength),l=this.jpoint(null,null,null),d=c.length-1;d>=0;d--){for(var p=0;d>=0&&c[d]===0;d--)p++;if(d>=0&&p++,l=l.dblp(p),d<0)break;var g=c[d];wm(g!==0),t.type==="affine"?g>0?l=l.mixedAdd(s[g-1>>1]):l=l.mixedAdd(s[-g-1>>1].neg()):g>0?l=l.add(s[g-1>>1]):l=l.add(s[-g-1>>1].neg())}return t.type==="affine"?l.toP():l},"_wnafMul"),"_wnafMul");jo.prototype._wnafMulAdd=o(i(function(t,r,n,a,s){var c=this._wnafT1,l=this._wnafT2,d=this._wnafT3,p=0,g,v,y;for(g=0;g<a;g++){y=r[g];var _=y._getNAFPoints(t);c[g]=_.wnd,l[g]=_.points}for(g=a-1;g>=1;g-=2){var x=g-1,O=g;if(c[x]!==1||c[O]!==1){d[x]=bm(n[x],c[x],this._bitLength),d[O]=bm(n[O],c[O],this._bitLength),p=Math.max(d[x].length,p),p=Math.max(d[O].length,p);continue}var D=[r[x],null,null,r[O]];r[x].y.cmp(r[O].y)===0?(D[1]=r[x].add(r[O]),D[2]=r[x].toJ().mixedAdd(r[O].neg())):r[x].y.cmp(r[O].y.redNeg())===0?(D[1]=r[x].toJ().mixedAdd(r[O]),D[2]=r[x].add(r[O].neg())):(D[1]=r[x].toJ().mixedAdd(r[O]),D[2]=r[x].toJ().mixedAdd(r[O].neg()));var L=[-3,-1,-5,-7,0,7,5,1,3],Z=GH(n[x],n[O]);for(p=Math.max(Z[0].length,p),d[x]=new Array(p),d[O]=new Array(p),v=0;v<p;v++){var z=Z[0][v]|0,q=Z[1][v]|0;d[x][v]=L[(z+1)*3+(q+1)],d[O][v]=0,l[x]=D}}var Q=this.jpoint(null,null,null),Y=this._wnafT4;for(g=p;g>=0;g--){for(var k=0;g>=0;){var K=!0;for(v=0;v<a;v++)Y[v]=d[v][g]|0,Y[v]!==0&&(K=!1);if(!K)break;k++,g--}if(g>=0&&k++,Q=Q.dblp(k),g<0)break;for(v=0;v<a;v++){var he=Y[v];he!==0&&(he>0?y=l[v][he-1>>1]:he<0&&(y=l[v][-he-1>>1].neg()),y.type==="affine"?Q=Q.mixedAdd(y):Q=Q.add(y))}}for(g=0;g<a;g++)l[g]=null;return s?Q:Q.toP()},"_wnafMulAdd"),"_wnafMulAdd");function Mi(e,t){this.curve=e,this.type=t,this.precomputed=null}i(Mi,"BasePoint");o(Mi,"BasePoint");jo.BasePoint=Mi;Mi.prototype.eq=o(i(function(){throw new Error("Not implemented")},"eq"),"eq");Mi.prototype.validate=o(i(function(){return this.curve.validate(this)},"validate2"),"validate");jo.prototype.decodePoint=o(i(function(t,r){t=Ci.toArray(t,r);var n=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*n){t[0]===6?wm(t[t.length-1]%2===0):t[0]===7&&wm(t[t.length-1]%2===1);var a=this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));return a}else if((t[0]===2||t[0]===3)&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),t[0]===3);throw new Error("Unknown point format")},"decodePoint"),"decodePoint");Mi.prototype.encodeCompressed=o(i(function(t){return this.encode(t,!0)},"encodeCompressed"),"encodeCompressed");Mi.prototype._encode=o(i(function(t){var r=this.curve.p.byteLength(),n=this.getX().toArray("be",r);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",r))},"_encode"),"_encode");Mi.prototype.encode=o(i(function(t,r){return Ci.encode(this._encode(r),t)},"encode8"),"encode");Mi.prototype.precompute=o(i(function(t){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,t),r.beta=this._getBeta(),this.precomputed=r,this},"precompute"),"precompute");Mi.prototype._hasDoubles=o(i(function(t){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((t.bitLength()+1)/r.step):!1},"_hasDoubles"),"_hasDoubles");Mi.prototype._getDoubles=o(i(function(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],a=this,s=0;s<r;s+=t){for(var c=0;c<t;c++)a=a.dbl();n.push(a)}return{step:t,points:n}},"_getDoubles"),"_getDoubles");Mi.prototype._getNAFPoints=o(i(function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],n=(1<<t)-1,a=n===1?null:this.dbl(),s=1;s<n;s++)r[s]=r[s-1].add(a);return{wnd:t,points:r}},"_getNAFPoints"),"_getNAFPoints");Mi.prototype._getBeta=o(i(function(){return null},"_getBeta"),"_getBeta");Mi.prototype.dblp=o(i(function(t){for(var r=this,n=0;n<t;n++)r=r.dbl();return r},"dblp"),"dblp");var A3=Gc(function(e){typeof Object.create=="function"?e.exports=o(i(function(r,n){n&&(r.super_=n,r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"),"inherits"):e.exports=o(i(function(r,n){if(n){r.super_=n;var a=o(function(){},"TempCtor");a.prototype=n.prototype,r.prototype=new a,r.prototype.constructor=r}},"inherits"),"inherits")}),WH=Ci.assert;function Ii(e){Wc.call(this,"short",e),this.a=new Rt.default(e.a,16).toRed(this.red),this.b=new Rt.default(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}i(Ii,"ShortCurve");o(Ii,"ShortCurve");A3(Ii,Wc);var ZH=Ii;Ii.prototype._getEndomorphism=o(i(function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(t.beta)r=new Rt.default(t.beta,16).toRed(this.red);else{var a=this._getEndoRoots(this.p);r=a[0].cmp(a[1])<0?a[0]:a[1],r=r.toRed(this.red)}if(t.lambda)n=new Rt.default(t.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?n=s[0]:(n=s[1],WH(this.g.mul(n).x.cmp(this.g.x.redMul(r))===0))}var c;return t.basis?c=t.basis.map(function(l){return{a:new Rt.default(l.a,16),b:new Rt.default(l.b,16)}}):c=this._getEndoBasis(n),{beta:r,lambda:n,basis:c}}},"_getEndomorphism"),"_getEndomorphism");Ii.prototype._getEndoRoots=o(i(function(t){var r=t===this.p?this.red:Rt.default.mont(t),n=new Rt.default(2).toRed(r).redInvm(),a=n.redNeg(),s=new Rt.default(3).toRed(r).redNeg().redSqrt().redMul(n),c=a.redAdd(s).fromRed(),l=a.redSub(s).fromRed();return[c,l]},"_getEndoRoots"),"_getEndoRoots");Ii.prototype._getEndoBasis=o(i(function(t){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=t,a=this.n.clone(),s=new Rt.default(1),c=new Rt.default(0),l=new Rt.default(0),d=new Rt.default(1),p,g,v,y,_,x,O,D=0,L,Z;n.cmpn(0)!==0;){var z=a.div(n);L=a.sub(z.mul(n)),Z=l.sub(z.mul(s));var q=d.sub(z.mul(c));if(!v&&L.cmp(r)<0)p=O.neg(),g=s,v=L.neg(),y=Z;else if(v&&++D===2)break;O=L,a=n,n=L,l=s,s=Z,d=c,c=q}_=L.neg(),x=Z;var Q=v.sqr().add(y.sqr()),Y=_.sqr().add(x.sqr());return Y.cmp(Q)>=0&&(_=p,x=g),v.negative&&(v=v.neg(),y=y.neg()),_.negative&&(_=_.neg(),x=x.neg()),[{a:v,b:y},{a:_,b:x}]},"_getEndoBasis"),"_getEndoBasis");Ii.prototype._endoSplit=o(i(function(t){var r=this.endo.basis,n=r[0],a=r[1],s=a.b.mul(t).divRound(this.n),c=n.b.neg().mul(t).divRound(this.n),l=s.mul(n.a),d=c.mul(a.a),p=s.mul(n.b),g=c.mul(a.b),v=t.sub(l).sub(d),y=p.add(g).neg();return{k1:v,k2:y}},"_endoSplit"),"_endoSplit");Ii.prototype.pointFromX=o(i(function(t,r){t=new Rt.default(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),a=n.redSqrt();if(a.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=a.fromRed().isOdd();return(r&&!s||!r&&s)&&(a=a.redNeg()),this.point(t,a)},"pointFromX"),"pointFromX");Ii.prototype.validate=o(i(function(t){if(t.inf)return!0;var r=t.x,n=t.y,a=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(a).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},"validate3"),"validate");Ii.prototype._endoWnafMulAdd=o(i(function(t,r,n){for(var a=this._endoWnafT1,s=this._endoWnafT2,c=0;c<t.length;c++){var l=this._endoSplit(r[c]),d=t[c],p=d._getBeta();l.k1.negative&&(l.k1.ineg(),d=d.neg(!0)),l.k2.negative&&(l.k2.ineg(),p=p.neg(!0)),a[c*2]=d,a[c*2+1]=p,s[c*2]=l.k1,s[c*2+1]=l.k2}for(var g=this._wnafMulAdd(1,a,s,c*2,n),v=0;v<c*2;v++)a[v]=null,s[v]=null;return g},"_endoWnafMulAdd"),"_endoWnafMulAdd");function Xr(e,t,r,n){Wc.BasePoint.call(this,e,"affine"),t===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Rt.default(t,16),this.y=new Rt.default(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}i(Xr,"Point");o(Xr,"Point");A3(Xr,Wc.BasePoint);Ii.prototype.point=o(i(function(t,r,n){return new Xr(this,t,r,n)},"point2"),"point");Ii.prototype.pointFromJSON=o(i(function(t,r){return Xr.fromJSON(this,t,r)},"pointFromJSON"),"pointFromJSON");Xr.prototype._getBeta=o(i(function(){if(!!this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,a=o(function(s){return n.point(s.x.redMul(n.endo.beta),s.y)},"endoMul");t.beta=r,r.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(a)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(a)}}}return r}},"_getBeta2"),"_getBeta");Xr.prototype.toJSON=o(i(function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},"toJSON"),"toJSON");Xr.fromJSON=o(i(function(t,r,n){typeof r=="string"&&(r=JSON.parse(r));var a=t.point(r[0],r[1],n);if(!r[2])return a;function s(l){return t.point(l[0],l[1],n)}i(s,"obj2point"),o(s,"obj2point");var c=r[2];return a.precomputed={beta:null,doubles:c.doubles&&{step:c.doubles.step,points:[a].concat(c.doubles.points.map(s))},naf:c.naf&&{wnd:c.naf.wnd,points:[a].concat(c.naf.points.map(s))}},a},"fromJSON"),"fromJSON");Xr.prototype.inspect=o(i(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},"inspect"),"inspect");Xr.prototype.isInfinity=o(i(function(){return this.inf},"isInfinity"),"isInfinity");Xr.prototype.add=o(i(function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var r=this.y.redSub(t.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(t.x),a=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,a)},"add"),"add");Xr.prototype.dbl=o(i(function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),a=t.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(a),c=s.redSqr().redISub(this.x.redAdd(this.x)),l=s.redMul(this.x.redSub(c)).redISub(this.y);return this.curve.point(c,l)},"dbl"),"dbl");Xr.prototype.getX=o(i(function(){return this.x.fromRed()},"getX"),"getX");Xr.prototype.getY=o(i(function(){return this.y.fromRed()},"getY"),"getY");Xr.prototype.mul=o(i(function(t){return t=new Rt.default(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},"mul"),"mul");Xr.prototype.mulAdd=o(i(function(t,r,n){var a=[this,r],s=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(a,s):this.curve._wnafMulAdd(1,a,s,2)},"mulAdd"),"mulAdd");Xr.prototype.jmulAdd=o(i(function(t,r,n){var a=[this,r],s=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(a,s,!0):this.curve._wnafMulAdd(1,a,s,2,!0)},"jmulAdd"),"jmulAdd");Xr.prototype.eq=o(i(function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},"eq2"),"eq");Xr.prototype.neg=o(i(function(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,a=o(function(s){return s.neg()},"negate");r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(a)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(a)}}}return r},"neg"),"neg");Xr.prototype.toJ=o(i(function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t},"toJ"),"toJ");function rn(e,t,r,n){Wc.BasePoint.call(this,e,"jacobian"),t===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Rt.default(0)):(this.x=new Rt.default(t,16),this.y=new Rt.default(r,16),this.z=new Rt.default(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}i(rn,"JPoint");o(rn,"JPoint");A3(rn,Wc.BasePoint);Ii.prototype.jpoint=o(i(function(t,r,n){return new rn(this,t,r,n)},"jpoint"),"jpoint");rn.prototype.toP=o(i(function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),a=this.y.redMul(r).redMul(t);return this.curve.point(n,a)},"toP"),"toP");rn.prototype.neg=o(i(function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},"neg2"),"neg");rn.prototype.add=o(i(function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),a=this.x.redMul(r),s=t.x.redMul(n),c=this.y.redMul(r.redMul(t.z)),l=t.y.redMul(n.redMul(this.z)),d=a.redSub(s),p=c.redSub(l);if(d.cmpn(0)===0)return p.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=d.redSqr(),v=g.redMul(d),y=a.redMul(g),_=p.redSqr().redIAdd(v).redISub(y).redISub(y),x=p.redMul(y.redISub(_)).redISub(c.redMul(v)),O=this.z.redMul(t.z).redMul(d);return this.curve.jpoint(_,x,O)},"add2"),"add");rn.prototype.mixedAdd=o(i(function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,a=t.x.redMul(r),s=this.y,c=t.y.redMul(r).redMul(this.z),l=n.redSub(a),d=s.redSub(c);if(l.cmpn(0)===0)return d.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=l.redSqr(),g=p.redMul(l),v=n.redMul(p),y=d.redSqr().redIAdd(g).redISub(v).redISub(v),_=d.redMul(v.redISub(y)).redISub(s.redMul(g)),x=this.z.redMul(l);return this.curve.jpoint(y,_,x)},"mixedAdd"),"mixedAdd");rn.prototype.dblp=o(i(function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r<t;r++)n=n.dbl();return n}var a=this.curve.a,s=this.curve.tinv,c=this.x,l=this.y,d=this.z,p=d.redSqr().redSqr(),g=l.redAdd(l);for(r=0;r<t;r++){var v=c.redSqr(),y=g.redSqr(),_=y.redSqr(),x=v.redAdd(v).redIAdd(v).redIAdd(a.redMul(p)),O=c.redMul(y),D=x.redSqr().redISub(O.redAdd(O)),L=O.redISub(D),Z=x.redMul(L);Z=Z.redIAdd(Z).redISub(_);var z=g.redMul(d);r+1<t&&(p=p.redMul(_)),c=D,d=z,g=Z}return this.curve.jpoint(c,g.redMul(s),d)},"dblp2"),"dblp");rn.prototype.dbl=o(i(function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},"dbl2"),"dbl");rn.prototype._zeroDbl=o(i(function(){var t,r,n;if(this.zOne){var a=this.x.redSqr(),s=this.y.redSqr(),c=s.redSqr(),l=this.x.redAdd(s).redSqr().redISub(a).redISub(c);l=l.redIAdd(l);var d=a.redAdd(a).redIAdd(a),p=d.redSqr().redISub(l).redISub(l),g=c.redIAdd(c);g=g.redIAdd(g),g=g.redIAdd(g),t=p,r=d.redMul(l.redISub(p)).redISub(g),n=this.y.redAdd(this.y)}else{var v=this.x.redSqr(),y=this.y.redSqr(),_=y.redSqr(),x=this.x.redAdd(y).redSqr().redISub(v).redISub(_);x=x.redIAdd(x);var O=v.redAdd(v).redIAdd(v),D=O.redSqr(),L=_.redIAdd(_);L=L.redIAdd(L),L=L.redIAdd(L),t=D.redISub(x).redISub(x),r=O.redMul(x.redISub(t)).redISub(L),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(t,r,n)},"_zeroDbl"),"_zeroDbl");rn.prototype._threeDbl=o(i(function(){var t,r,n;if(this.zOne){var a=this.x.redSqr(),s=this.y.redSqr(),c=s.redSqr(),l=this.x.redAdd(s).redSqr().redISub(a).redISub(c);l=l.redIAdd(l);var d=a.redAdd(a).redIAdd(a).redIAdd(this.curve.a),p=d.redSqr().redISub(l).redISub(l);t=p;var g=c.redIAdd(c);g=g.redIAdd(g),g=g.redIAdd(g),r=d.redMul(l.redISub(p)).redISub(g),n=this.y.redAdd(this.y)}else{var v=this.z.redSqr(),y=this.y.redSqr(),_=this.x.redMul(y),x=this.x.redSub(v).redMul(this.x.redAdd(v));x=x.redAdd(x).redIAdd(x);var O=_.redIAdd(_);O=O.redIAdd(O);var D=O.redAdd(O);t=x.redSqr().redISub(D),n=this.y.redAdd(this.z).redSqr().redISub(y).redISub(v);var L=y.redSqr();L=L.redIAdd(L),L=L.redIAdd(L),L=L.redIAdd(L),r=x.redMul(O.redISub(t)).redISub(L)}return this.curve.jpoint(t,r,n)},"_threeDbl"),"_threeDbl");rn.prototype._dbl=o(i(function(){var t=this.curve.a,r=this.x,n=this.y,a=this.z,s=a.redSqr().redSqr(),c=r.redSqr(),l=n.redSqr(),d=c.redAdd(c).redIAdd(c).redIAdd(t.redMul(s)),p=r.redAdd(r);p=p.redIAdd(p);var g=p.redMul(l),v=d.redSqr().redISub(g.redAdd(g)),y=g.redISub(v),_=l.redSqr();_=_.redIAdd(_),_=_.redIAdd(_),_=_.redIAdd(_);var x=d.redMul(y).redISub(_),O=n.redAdd(n).redMul(a);return this.curve.jpoint(v,x,O)},"_dbl"),"_dbl");rn.prototype.trpl=o(i(function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr(),a=r.redSqr(),s=t.redAdd(t).redIAdd(t),c=s.redSqr(),l=this.x.redAdd(r).redSqr().redISub(t).redISub(a);l=l.redIAdd(l),l=l.redAdd(l).redIAdd(l),l=l.redISub(c);var d=l.redSqr(),p=a.redIAdd(a);p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var g=s.redIAdd(l).redSqr().redISub(c).redISub(d).redISub(p),v=r.redMul(g);v=v.redIAdd(v),v=v.redIAdd(v);var y=this.x.redMul(d).redISub(v);y=y.redIAdd(y),y=y.redIAdd(y);var _=this.y.redMul(g.redMul(p.redISub(g)).redISub(l.redMul(d)));_=_.redIAdd(_),_=_.redIAdd(_),_=_.redIAdd(_);var x=this.z.redAdd(l).redSqr().redISub(n).redISub(d);return this.curve.jpoint(y,_,x)},"trpl"),"trpl");rn.prototype.mul=o(i(function(t,r){return t=new Rt.default(t,r),this.curve._wnafMul(this,t)},"mul2"),"mul");rn.prototype.eq=o(i(function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var r=this.z.redSqr(),n=t.z.redSqr();if(this.x.redMul(n).redISub(t.x.redMul(r)).cmpn(0)!==0)return!1;var a=r.redMul(this.z),s=n.redMul(t.z);return this.y.redMul(s).redISub(t.y.redMul(a)).cmpn(0)===0},"eq3"),"eq");rn.prototype.eqXToP=o(i(function(t){var r=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(r);if(this.x.cmp(n)===0)return!0;for(var a=t.clone(),s=this.curve.redN.redMul(r);;){if(a.iadd(this.curve.n),a.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},"eqXToP"),"eqXToP");rn.prototype.inspect=o(i(function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},"inspect2"),"inspect");rn.prototype.isInfinity=o(i(function(){return this.z.cmpn(0)===0},"isInfinity2"),"isInfinity");var G0=Gc(function(e,t){"use strict";var r=t;r.base=Wc,r.short=ZH,r.mont=null,r.edwards=null}),W0=Gc(function(e,t){"use strict";var r=t,n=Ci.assert;function a(l){l.type==="short"?this.curve=new G0.short(l):l.type==="edwards"?this.curve=new G0.edwards(l):this.curve=new G0.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}i(a,"PresetCurve"),o(a,"PresetCurve"),r.PresetCurve=a;function s(l,d){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var p=new a(d);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:p}),p}})}i(s,"defineCurve"),o(s,"defineCurve"),s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Mo.default.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Mo.default.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Mo.default.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Mo.default.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Mo.default.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Mo.default.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Mo.default.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=null.crash()}catch{c=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Mo.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function Oo(e){if(!(this instanceof Oo))return new Oo(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=ga.toArray(e.entropy,e.entropyEnc||"hex"),r=ga.toArray(e.nonce,e.nonceEnc||"hex"),n=ga.toArray(e.pers,e.persEnc||"hex");_3(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}i(Oo,"HmacDRBG");o(Oo,"HmacDRBG");var GM=Oo;Oo.prototype._init=o(i(function(t,r,n){var a=t.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(a),this._reseed=1,this.reseedInterval=281474976710656},"init"),"init");Oo.prototype._hmac=o(i(function(){return new Mo.default.hmac(this.hash,this.K)},"hmac"),"hmac");Oo.prototype._update=o(i(function(t){var r=this._hmac().update(this.V).update([0]);t&&(r=r.update(t)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},"update"),"update");Oo.prototype.reseed=o(i(function(t,r,n,a){typeof r!="string"&&(a=n,n=r,r=null),t=ga.toArray(t,r),n=ga.toArray(n,a),_3(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},"reseed"),"reseed");Oo.prototype.generate=o(i(function(t,r,n,a){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(a=n,n=r,r=null),n&&(n=ga.toArray(n,a||"hex"),this._update(n));for(var s=[];s.length<t;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var c=s.slice(0,t);return this._update(n),this._reseed++,ga.encode(c,r)},"generate"),"generate");var r6=Ci.assert;function fn(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}i(fn,"KeyPair");o(fn,"KeyPair");var S3=fn;fn.fromPublic=o(i(function(t,r,n){return r instanceof fn?r:new fn(t,{pub:r,pubEnc:n})},"fromPublic"),"fromPublic");fn.fromPrivate=o(i(function(t,r,n){return r instanceof fn?r:new fn(t,{priv:r,privEnc:n})},"fromPrivate"),"fromPrivate");fn.prototype.validate=o(i(function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},"validate4"),"validate");fn.prototype.getPublic=o(i(function(t,r){return typeof t=="string"&&(r=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,t):this.pub},"getPublic"),"getPublic");fn.prototype.getPrivate=o(i(function(t){return t==="hex"?this.priv.toString(16,2):this.priv},"getPrivate"),"getPrivate");fn.prototype._importPrivate=o(i(function(t,r){this.priv=new Rt.default(t,r||16),this.priv=this.priv.umod(this.ec.curve.n)},"_importPrivate"),"_importPrivate");fn.prototype._importPublic=o(i(function(t,r){if(t.x||t.y){this.ec.curve.type==="mont"?r6(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&r6(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,r)},"_importPublic"),"_importPublic");fn.prototype.derive=o(i(function(t){return t.validate()||r6(t.validate(),"public point not validated"),t.mul(this.priv).getX()},"derive"),"derive");fn.prototype.sign=o(i(function(t,r,n){return this.ec.sign(t,this,r,n)},"sign2"),"sign");fn.prototype.verify=o(i(function(t,r,n){return this.ec.verify(t,r,this,void 0,n)},"verify2"),"verify");fn.prototype.inspect=o(i(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect3"),"inspect");var JH=Ci.assert;function Qd(e,t){if(e instanceof Qd)return e;this._importDER(e,t)||(JH(e.r&&e.s,"Signature without r or s"),this.r=new Rt.default(e.r,16),this.s=new Rt.default(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}i(Qd,"Signature");o(Qd,"Signature");var n1=Qd;function WM(){this.place=0}i(WM,"Position");o(WM,"Position");function Z0(e,t){var r=e[t.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||e[t.place]===0)return!1;for(var a=0,s=0,c=t.place;s<n;s++,c++)a<<=8,a|=e[c],a>>>=0;return a<=127?!1:(t.place=c,a)}i(Z0,"getLength");o(Z0,"getLength");function n6(e){for(var t=0,r=e.length-1;!e[t]&&!(e[t+1]&128)&&t<r;)t++;return t===0?e:e.slice(t)}i(n6,"rmPadding");o(n6,"rmPadding");Qd.prototype._importDER=o(i(function(t,r){t=Ci.toArray(t,r);var n=new WM;if(t[n.place++]!==48)return!1;var a=Z0(t,n);if(a===!1||a+n.place!==t.length||t[n.place++]!==2)return!1;var s=Z0(t,n);if(s===!1||(t[n.place]&128)!==0)return!1;var c=t.slice(n.place,s+n.place);if(n.place+=s,t[n.place++]!==2)return!1;var l=Z0(t,n);if(l===!1||t.length!==l+n.place||(t[n.place]&128)!==0)return!1;var d=t.slice(n.place,l+n.place);if(c[0]===0)if(c[1]&128)c=c.slice(1);else return!1;if(d[0]===0)if(d[1]&128)d=d.slice(1);else return!1;return this.r=new Rt.default(c),this.s=new Rt.default(d),this.recoveryParam=null,!0},"_importDER"),"_importDER");function J0(e,t){if(t<128){e.push(t);return}var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(r|128);--r;)e.push(t>>>(r<<3)&255);e.push(t)}i(J0,"constructLength");o(J0,"constructLength");Qd.prototype.toDER=o(i(function(t){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=n6(r),n=n6(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var a=[2];J0(a,r.length),a=a.concat(r),a.push(2),J0(a,n.length);var s=a.concat(n),c=[48];return J0(c,s.length),c=c.concat(s),Ci.encode(c,t)},"toDER"),"toDER");var YH=o(function(){throw new Error("unsupported")},"rand"),Tc=Ci.assert;function xi(e){if(!(this instanceof xi))return new xi(e);typeof e=="string"&&(Tc(Object.prototype.hasOwnProperty.call(W0,e),"Unknown curve "+e),e=W0[e]),e instanceof W0.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}i(xi,"EC");o(xi,"EC");var XH=xi;xi.prototype.keyPair=o(i(function(t){return new S3(this,t)},"keyPair"),"keyPair");xi.prototype.keyFromPrivate=o(i(function(t,r){return S3.fromPrivate(this,t,r)},"keyFromPrivate"),"keyFromPrivate");xi.prototype.keyFromPublic=o(i(function(t,r){return S3.fromPublic(this,t,r)},"keyFromPublic"),"keyFromPublic");xi.prototype.genKeyPair=o(i(function(t){t||(t={});for(var r=new GM({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||YH(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),a=this.n.sub(new Rt.default(2));;){var s=new Rt.default(r.generate(n));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},"genKeyPair"),"genKeyPair");xi.prototype._truncateToN=o(i(function(t,r,n){var a;if(Rt.default.isBN(t)||typeof t=="number")t=new Rt.default(t,16),a=t.byteLength();else if(typeof t=="object")a=t.length,t=new Rt.default(t,16);else{var s=t.toString();a=s.length+1>>>1,t=new Rt.default(s,16)}typeof n!="number"&&(n=a*8);var c=n-this.n.bitLength();return c>0&&(t=t.ushrn(c)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},"_truncateToN"),"_truncateToN");xi.prototype.sign=o(i(function(t,r,n,a){if(typeof n=="object"&&(a=n,n=null),a||(a={}),typeof t!="string"&&typeof t!="number"&&!Rt.default.isBN(t)){Tc(typeof t=="object"&&t&&typeof t.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),Tc(t.length>>>0===t.length);for(var s=0;s<t.length;s++)Tc((t[s]&255)===t[s])}r=this.keyFromPrivate(r,n),t=this._truncateToN(t,!1,a.msgBitLength),Tc(!t.isNeg(),"Can not sign a negative message");var c=this.n.byteLength(),l=r.getPrivate().toArray("be",c),d=t.toArray("be",c);Tc(new Rt.default(d).eq(t),"Can not sign message");for(var p=new GM({hash:this.hash,entropy:l,nonce:d,pers:a.pers,persEnc:a.persEnc||"utf8"}),g=this.n.sub(new Rt.default(1)),v=0;;v++){var y=a.k?a.k(v):new Rt.default(p.generate(this.n.byteLength()));if(y=this._truncateToN(y,!0),!(y.cmpn(1)<=0||y.cmp(g)>=0)){var _=this.g.mul(y);if(!_.isInfinity()){var x=_.getX(),O=x.umod(this.n);if(O.cmpn(0)!==0){var D=y.invm(this.n).mul(O.mul(r.getPrivate()).iadd(t));if(D=D.umod(this.n),D.cmpn(0)!==0){var L=(_.getY().isOdd()?1:0)|(x.cmp(O)!==0?2:0);return a.canonical&&D.cmp(this.nh)>0&&(D=this.n.sub(D),L^=1),new n1({r:O,s:D,recoveryParam:L})}}}}}},"sign3"),"sign");xi.prototype.verify=o(i(function(t,r,n,a,s){s||(s={}),t=this._truncateToN(t,!1,s.msgBitLength),n=this.keyFromPublic(n,a),r=new n1(r,"hex");var c=r.r,l=r.s;if(c.cmpn(1)<0||c.cmp(this.n)>=0||l.cmpn(1)<0||l.cmp(this.n)>=0)return!1;var d=l.invm(this.n),p=d.mul(t).umod(this.n),g=d.mul(c).umod(this.n),v;return this.curve._maxwellTrick?(v=this.g.jmulAdd(p,n.getPublic(),g),v.isInfinity()?!1:v.eqXToP(c)):(v=this.g.mulAdd(p,n.getPublic(),g),v.isInfinity()?!1:v.getX().umod(this.n).cmp(c)===0)},"verify3"),"verify");xi.prototype.recoverPubKey=function(e,t,r,n){Tc((3&r)===r,"The recovery param is more than two bits"),t=new n1(t,n);var a=this.n,s=new Rt.default(e),c=t.r,l=t.s,d=r&1,p=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&p)throw new Error("Unable to find sencond key candinate");p?c=this.curve.pointFromX(c.add(this.curve.n),d):c=this.curve.pointFromX(c,d);var g=t.r.invm(a),v=a.sub(s).mul(g).umod(a),y=l.mul(g).umod(a);return this.g.mulAdd(v,c,y)};xi.prototype.getKeyRecoveryParam=function(e,t,r,n){if(t=new n1(t,n),t.recoveryParam!==null)return t.recoveryParam;for(var a=0;a<4;a++){var s;try{s=this.recoverPubKey(e,t,a)}catch{continue}if(s.eq(r))return a}throw new Error("Unable to find valid recovery factor")};var QH=Gc(function(e,t){"use strict";var r=t;r.version="6.6.1",r.utils=Ci,r.rand=function(){throw new Error("unsupported")},r.curve=G0,r.curves=W0,r.ec=XH,r.eddsa=null}),eq=QH.ec,tq="signing-key/5.8.0",i6=new br(tq),Ab=null;function ma(){return Ab||(Ab=new eq("secp256k1")),Ab}i(ma,"getCurve");o(ma,"getCurve");var ZM=i(class{constructor(e){Gu(this,"curve","secp256k1"),Gu(this,"privateKey",Bn(e)),LM(this.privateKey)!==32&&i6.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let t=ma().keyFromPrivate(qr(this.privateKey));Gu(this,"publicKey","0x"+t.getPublic(!1,"hex")),Gu(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Gu(this,"_isSigningKey",!0)}_addPoint(e){let t=ma().keyFromPublic(qr(this.publicKey)),r=ma().keyFromPublic(qr(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){let t=ma().keyFromPrivate(qr(this.privateKey)),r=qr(e);r.length!==32&&i6.throwArgumentError("bad digest length","digest",e);let n=t.sign(r,{canonical:!0});return y3({recoveryParam:n.recoveryParam,r:Rc("0x"+n.r.toString(16),32),s:Rc("0x"+n.s.toString(16),32)})}computeSharedSecret(e){let t=ma().keyFromPrivate(qr(this.privateKey)),r=ma().keyFromPublic(qr(x3(e)));return Rc("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}},"SigningKey");o(ZM,"SigningKey");function JM(e,t){let r=y3(t),n={r:qr(r.r),s:qr(r.s)};return"0x"+ma().recoverPubKey(qr(e),n,r.recoveryParam).encode("hex",!1)}i(JM,"recoverPublicKey");o(JM,"recoverPublicKey");function x3(e,t){let r=qr(e);if(r.length===32){let n=new ZM(r);return t?"0x"+ma().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return t?Bn(r):"0x"+ma().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return t?"0x"+ma().keyFromPublic(r).getPublic(!0,"hex"):Bn(r)}return i6.throwArgumentError("invalid public or private key","key","[REDACTED]")}i(x3,"computePublicKey");o(x3,"computePublicKey");var rq="transactions/5.8.0",wQ=new br(rq),TS;(function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"})(TS||(TS={}));function YM(e){let t=x3(e);return $M(e6(r1(e6(t,1)),12))}i(YM,"computeAddress");o(YM,"computeAddress");function XM(e,t){return YM(JM(qr(e),t))}i(XM,"recoverAddress");o(XM,"recoverAddress");var nq="wallet/5.8.0",_Q=new br(nq);function a6(e,t){return XM(VM(e),t)}i(a6,"verifyMessage");o(a6,"verifyMessage");function QM(){return{eip191:async(e,t)=>{eI(e,t)}}}i(QM,"getEIP191Verifier");o(QM,"getEIP191Verifier");var iq=new Date("2022-09-20").valueOf();function eI(e,t){g3(e),RM(e,t);let n=[a6(Yb.fromCacao(e).toMessage(),e.s.s).toLowerCase()];if(Date.parse(e.p.iat)<=iq){let s=a6(kM(Yb.fromCacao(e),"Ethereum"),e.s.s).toLowerCase();n.push(s)}let a=Td.parse(e.p.iss.replace("did:pkh:","")).address.toLowerCase();if(!n.includes(a))throw new Error("Signature does not belong to issuer")}i(eI,"verifyEIP191Signature");o(eI,"verifyEIP191Signature");Kd();$6();var aq=ir(El(),1);Kd();function tI(){return Ir((0,aq.randomBytes)(16),"base64")}i(tI,"randomString");o(tI,"randomString");var rI="base64pad",nI="base64url";function iI(e){return Ir(e,rI)}i(iI,"encodeBase64");o(iI,"encodeBase64");function aI(e){return Ir(e,nI)}i(aI,"encodeBase64Url");o(aI,"encodeBase64Url");function oI(e){return Cr(e,rI)}i(oI,"decodeBase64");o(oI,"decodeBase64");function Y0(e){return JSON.parse(Ir(Cr(e,nI)))}i(Y0,"base64urlToJSON");o(Y0,"base64urlToJSON");function sI(e){if(e.signatures.length>1)throw new Error("Cant convert to compact jws");return`${e.signatures[0].protected}.${e.payload}.${e.signatures[0].signature}`}i(sI,"fromDagJWS");o(sI,"fromDagJWS");function cI(e,t){if(t){let r=t.toISOString().split(".")[0]+"Z";return`${e}?versionTime=${r}`}else return e}i(cI,"didWithTime");o(cI,"didWithTime");function uI(e){return e?Array.isArray(e)?e:[e]:[]}i(uI,"extractControllers");o(uI,"extractControllers");var oq={...QM()};function lI(e){return"registry"in e&&"cache"in e}i(lI,"isResolver");o(lI,"isResolver");var fI=i(class{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){return new fI({provider:this._client?.connection,resolver:this._resolver,capability:e,parent:this._parentId})}setProvider(e){if(this._client==null)this._client=new Zb(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=lI(e)?e:new ST(e,t)}async authenticate({provider:e,paths:t=[],aud:r}={}){if(e!=null&&this.setProvider(e),this._client==null)throw new Error("No provider available");let n=tI(),a=await this._client.request("did_authenticate",{nonce:n,aud:r,paths:t}),{kid:s}=await this.verifyJWS(a),c=Y0(a.payload);if(!s.includes(c.did))throw new Error("Invalid authencation response, kid mismatch");if(c.nonce!==n)throw new Error("Invalid authencation response, wrong nonce");if(c.aud!==r)throw new Error("Invalid authencation response, wrong aud");if(c.exp<Date.now()/1e3)throw new Error("Invalid authencation response, expired");return this._id=c.did,this._id}async createJWS(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 n=this._capability.p.exp;if(n&&Date.parse(n)<Date.now())throw new Error("Capability is expired, cannot create a valid signature");let a=await vm.fromCacao(this._capability),s=Vt.asCID(a.cid);if(!s)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://${s?.toString()}`}let{jws:r}=await this._client.request("did_createJWS",{did:this._id,...t,payload:e});return r}async createDagJWS(e,t={}){let{cid:r,linkedBlock:n}=await uM(e),a=aI(r.bytes);Object.assign(t,{linkedBlock:iI(n)});let s=await this.createJWS(a,t),c=Vt.asCID(r);if(!c)throw new Error("CID of the JWS cannot be set to the encoded payload cid as they are incompatible");if(s.link=c,this._capability){let l=await vm.fromCacao(this._capability);return{jws:s,linkedBlock:n,cacaoBlock:l.bytes}}return{jws:s,linkedBlock:n}}async verifyJWS(e,t={}){t=Object.assign({verifiers:oq},t),typeof e!="string"&&(e=sI(e));let r=Y0(e.split(".")[0]).kid;if(!r)throw new Error('No "kid" found in jws');let n=await this.resolve(r);if(!t.disableTimecheck){let d=n.didDocumentMetadata?.nextUpdate;if(d){let g=t.revocationPhaseOutSecs?t.revocationPhaseOutSecs*1e3:0,v=new Date(d).valueOf()+g;if(!(t.atTime&&t.atTime.getTime()<v))throw new Error(`invalid_jws: signature authored with a revoked DID version: ${r}`)}let p=n.didDocumentMetadata?.updated;if(p&&t.atTime&&t.atTime.getTime()<new Date(p).valueOf())throw new Error(`invalid_jws: signature authored before creation of DID version: ${r}`)}let s=n.didDocument?.id;if(t.issuer&&t.issuer===t.capability?.p.iss&&s===t.capability.p.aud){if(!t.verifiers)throw new Error("Registered verifiers needed for CACAO");await gm.verify(t.capability,{disableExpirationCheck:t.disableTimecheck,atTime:t.atTime?t.atTime:void 0,revocationPhaseOutSecs:t.revocationPhaseOutSecs,verifiers:t.verifiers??{}})}else if(t.issuer&&t.issuer!==s){let d=cI(t.issuer,t.atTime),g=(await this.resolve(d)).didDocument?.controller,v=uI(g);if(t.capability?.s&&t.capability.p.aud===s&&v.includes(t.capability.p.iss))await gm.verify(t.capability,{atTime:t.atTime?t.atTime:void 0,revocationPhaseOutSecs:t.revocationPhaseOutSecs,verifiers:t.verifiers??{}});else if(!(s?v.includes(s):!1))throw new Error(`invalid_jws: not a valid verificationMethod for issuer: ${r}`)}let c=n.didDocument?.verificationMethod||[];jT(e,c);let l;try{l=Y0(e.split(".")[1])}catch{}return{kid:r,payload:l,didResolutionResult:n}}async createJWE(e,t,r={}){let n=await iH(t,this._resolver);return nH(e,n,r.protectedHeader,r.aad)}async createDagJWE(e,t,r={}){let n=await hM(e);return this.createJWE(n,t,r)}async decryptJWE(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:r}=await this._client.request("did_decryptJWE",{did:this._id,...t,jwe:e});return oI(r)}async decryptDagJWE(e){let t=await this.decryptJWE(e);return pM(t)}async resolve(e){let t=await this._resolver.resolve(e);if(t.didResolutionMetadata.error){let{error:r,message:n}=t.didResolutionMetadata,a=n?`, ${n}`:"";throw new Error(`Failed to resolve ${e}: ${r}${a}`)}return t}constructor({provider:e,resolver:t={},resolverOptions:r,capability:n,parent:a}={}){if(e!=null&&(this._client=new Zb(e)),n){if(this._capability=n,this._parentId=this._capability.p.iss,a&&this._parentId!==a)throw new Error("Capability issuer and parent not equal")}else a&&(this._parentId=a);this.setResolver(t,r)}},"DID");o(fI,"DID");function sq(e){var t=0,r=e.length,n=[];if(r%2)throw new Error("invalid hex:"+e);for(;t<r;t+=2)n.push(parseInt(e.substr(t,2),16));return new Uint8Array(n)}i(sq,"toUint8Array");o(sq,"toUint8Array");var CS=ir(jm(),1);B6();var dI={};Sr(dI,{keyToDidDoc:()=>hI});function hI(e,t){let r=`did:key:${t}`,n=`${r}#${t}`;return{id:r,verificationMethod:[{id:n,type:"Secp256k1VerificationKey2018",controller:r,publicKeyBase58:Ir(e,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(hI,"keyToDidDoc");o(hI,"keyToDidDoc");var pI={};Sr(pI,{keyToDidDoc:()=>gI});Kd();var cq=ir(H6(),1);function mI(e){let t=new Uint8Array(e.length+2);return t[0]=236,t[1]=1,t.set(e,2),`z${Ir(t,"base58btc")}`}i(mI,"encodeKey");o(mI,"encodeKey");function gI(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,a=(0,cq.convertPublicKeyToX25519)(e),s=`${r}#${mI(a)}`;return{id:r,verificationMethod:[{id:n,type:"Ed25519VerificationKey2018",controller:r,publicKeyBase58:Ir(e,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n],keyAgreement:[{id:s,type:"X25519KeyAgreementKey2019",controller:r,publicKeyBase58:Ir(a,"base58btc")}]}}i(gI,"keyToDidDoc2");o(gI,"keyToDidDoc");var vI={};Sr(vI,{keyToDidDoc:()=>DI,pubKeyBytesToXY:()=>I3});var yI={};Sr(yI,{ECPointDecompress:()=>TI});function bI(e){return e>=0?e:-e}i(bI,"n");o(bI,"n");function wI(e,t){if(typeof e=="number"&&(e=BigInt(e)),typeof t=="number"&&(t=BigInt(t)),e<=0n||t<=0n)throw new RangeError("a and b MUST be > 0");let r=0n,n=1n,a=1n,s=0n;for(;e!==0n;){let c=t/e,l=t%e,d=r-a*c,p=n-s*c;t=e,e=l,r=a,n=s,a=d,s=p}return{g:t,x:r,y:n}}i(wI,"r");o(wI,"r");function Cd(e,t){if(typeof e=="number"&&(e=BigInt(e)),typeof t=="number"&&(t=BigInt(t)),t<=0n)throw new RangeError("n must be > 0");let r=e%t;return r<0n?r+t:r}i(Cd,"e");o(Cd,"e");function T3(e,t){let r=wI(Cd(e,t),t);if(r.g!==1n)throw new RangeError(`${e.toString()} does not have inverse modulo ${t.toString()}`);return Cd(r.x,t)}i(T3,"o");o(T3,"o");function _I(e,t,r){if(e.length!==t.length)throw new RangeError("The remainders and modulos arrays should have the same length");let n=r??t.reduce((a,s)=>a*s,1n);return t.reduce((a,s,c)=>{let l=n/s;return Cd(a+l*T3(l,s)%n*e[c]%n,n)},0n)}i(_I,"i");o(_I,"i");function EI(e){return e.map(t=>t[0]**(t[1]-1n)*(t[0]-1n)).reduce((t,r)=>r*t,1n)}i(EI,"a");o(EI,"a");function nl(e,t,r,n){if(typeof e=="number"&&(e=BigInt(e)),typeof t=="number"&&(t=BigInt(t)),typeof r=="number"&&(r=BigInt(r)),r<=0n)throw new RangeError("n must be > 0");if(r===1n)return 0n;if(e=Cd(e,r),t<0n)return T3(nl(e,bI(t),r,n),r);if(n!==void 0)return function(s,c,l,d){let p=d.map(y=>y[0]**y[1]),g=d.map(y=>EI([y])),v=g.map((y,_)=>nl(s,c%y,p[_]));return _I(v,p,l)}(e,t,r,function(s){let c={};return s.forEach(l=>{if(typeof l=="bigint"||typeof l=="number"){let d=String(l);c[d]===void 0?c[d]={p:BigInt(l),k:1n}:c[d].k+=1n}else{let d=String(l[0]);c[d]===void 0?c[d]={p:BigInt(l[0]),k:BigInt(l[1])}:c[d].k+=BigInt(l[1])}}),Object.values(c).map(l=>[l.p,l.k])}(n));let a=1n;for(;t>0;)t%2n===1n&&(a=a*e%r),t/=2n,e=e**2n%r;return a}i(nl,"s");o(nl,"s");var ei={};Sr(ei,{pubKeyBytesToHex:()=>AI,publicKeyHexToUint8ArrayPointPair:()=>C3,publicKeyIntToUint8ArrayPointPair:()=>M3,publicKeyIntToXY:()=>xI,publicKeyToXY:()=>SI,testHexString:()=>i1,testUint8Array:()=>Rl});L6();function AI(e){if(!Rl(e))throw new TypeError("input must be a Uint8Array");return Ir(e,"base16")}i(AI,"pubKeyBytesToHex");o(AI,"pubKeyBytesToHex");function SI(e){if(!i1(e))throw new TypeError("input must be string with characters 0-9,A-F,a-f");let t=C3(e),r=el.encode(t.xOctet).slice(1),n=el.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(SI,"publicKeyToXY");o(SI,"publicKeyToXY");function C3(e){if(!i1(e))throw new TypeError("input must be string with characters 0-9,A-F,a-f");let t=e.slice(0,e.length/2),r=e.slice(e.length/2,e.length),n=Cr(t,"base16"),a=Cr(r,"base16");return{xOctet:n,yOctet:a}}i(C3,"publicKeyHexToUint8ArrayPointPair");o(C3,"publicKeyHexToUint8ArrayPointPair");function i1(e){let t=/^[A-Fa-f0-9]+$/i;return!!(t.exec(e)!==null&&t.test(e)&&typeof e=="string")}i(i1,"testHexString");o(i1,"testHexString");function Rl(e){return e==null?!1:e.constructor===Uint8Array}i(Rl,"testUint8Array");o(Rl,"testUint8Array");function xI(e){if(e==null)throw new TypeError("input cannot be null or undefined.");if(typeof e!="object")throw new TypeError("Input must be an object with properties x and y");if(!Object.prototype.hasOwnProperty.call(e,"x")||!Object.prototype.hasOwnProperty.call(e,"y"))throw new Error("Input must have properties x and y");if(typeof e.x!="bigint"&&typeof e.y!="bigint")throw new Error("Input coordinates must be BigInt");let t=M3(e),r=el.encode(t.xOctet).slice(1),n=el.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(xI,"publicKeyIntToXY");o(xI,"publicKeyIntToXY");function M3(e){if(e==null)throw new TypeError("input cannot be null or undefined.");if(typeof e!="object")throw new TypeError("Input must be an object with properties x and y");if(!Object.prototype.hasOwnProperty.call(e,"x")||!Object.prototype.hasOwnProperty.call(e,"y"))throw new Error("Input must have properties x and y");if(typeof e.x!="bigint"&&typeof e.y!="bigint")throw new Error("Input coordinates must be BigInt");let t=e.x.toString(),r=e.y.toString(),n=Cr(t,"base10"),a=Cr(r,"base10");return{xOctet:n,yOctet:a}}i(M3,"publicKeyIntToUint8ArrayPointPair");o(M3,"publicKeyIntToUint8ArrayPointPair");function TI(e){if(!Rl(e))throw new TypeError("input must be a Uint8Array");let t=BigInt(2),r=t**256n-t**224n+t**192n+t**96n-1n,n=41058363725152142129326129780047268409114441015993725554835256314039467401291n,a=(r+1n)/4n,s=BigInt(e[0]-2),c=e.subarray(1),l=BigInt(Ir(c,"base10")),d=l**3n-l*3n+n,p=nl(d,a,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(TI,"ECPointDecompress");o(TI,"ECPointDecompress");var CI={};Sr(CI,{ECPointDecompress:()=>MI});function MI(e){if(!Rl(e))throw new TypeError("input must be a Uint8Array");let t=BigInt(2),r=t**384n-t**128n-t**96n+t**32n-1n,n=27580193559959705877849011840389048093056905856361568521428707301988689241309860865136260764883745107765439761230575n,a=(r+1n)/4n,s=BigInt(e[0]-2),c=e.subarray(1),l=BigInt(Ir(c,"base10")),d=l**3n-l*3n+n,p=nl(d,a,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(MI,"ECPointDecompress2");o(MI,"ECPointDecompress");var II={};Sr(II,{ECPointDecompress:()=>kI});function kI(e){if(!Rl(e))throw new TypeError("input must be a Uint8Array");let r=BigInt(2)**521n-1n,n=1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984n,a=(r+1n)/4n,s=BigInt(e[0]-2),c=e.subarray(1),l=BigInt(Ir(c,"base10")),d=l**3n-l*3n+n,p=nl(d,a,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(kI,"ECPointDecompress3");o(kI,"ECPointDecompress");function DI(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,a=I3(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-256",x:a.xm,y:a.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(DI,"keyToDidDoc3");o(DI,"keyToDidDoc");function I3(e){if(!ei.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=ei.pubKeyBytesToHex(e),r=t.length/2;if(r==64)return ei.publicKeyToXY(t);if(r==65&&t.slice(0,2)=="04"){let n=t.slice(2);return ei.publicKeyToXY(n)}if(r==33&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let n=Cr(t,"base16"),a=yI.ECPointDecompress(n);return ei.publicKeyIntToXY(a)}throw new Error("Unexpected pubKeyBytes")}i(I3,"pubKeyBytesToXY");o(I3,"pubKeyBytesToXY");var RI={};Sr(RI,{keyToDidDoc:()=>OI,pubKeyBytesToXY:()=>k3});function OI(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,a=k3(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-384",x:a.xm,y:a.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(OI,"keyToDidDoc4");o(OI,"keyToDidDoc");function k3(e){if(!ei.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=ei.pubKeyBytesToHex(e),r=t.length/2;if(r==96)return ei.publicKeyToXY(t);if(r==97&&t.slice(0,2)=="04"){let n=t.slice(2);return ei.publicKeyToXY(n)}if(r==49&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let n=Cr(t,"base16"),a=CI.ECPointDecompress(n);return ei.publicKeyIntToXY(a)}throw new Error("Unexpected pubKeyBytes")}i(k3,"pubKeyBytesToXY2");o(k3,"pubKeyBytesToXY");var NI={};Sr(NI,{keyToDidDoc:()=>PI,pubKeyBytesToXY:()=>D3});function PI(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,a=D3(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-521",x:a.xm,y:a.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(PI,"keyToDidDoc5");o(PI,"keyToDidDoc");function D3(e){if(!ei.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=ei.pubKeyBytesToHex(e);if(132<=t.length&&t.length<=134&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let r=Cr(t,"base16"),n=II.ECPointDecompress(r);return ei.publicKeyIntToXY(n)}throw new Error("Unexpected pubKeyBytes")}i(D3,"pubKeyBytesToXY3");o(D3,"pubKeyBytesToXY");var uq="application/did+ld+json",MS="application/did+json",lq={231:dI,237:pI,4608:vI,4609:RI,4610:NI};function fq(){return{key:async(e,t,r,n)=>{let a=n.accept||MS,s={didResolutionMetadata:{contentType:a},didDocument:null,didDocumentMetadata:{}};try{let c=ha.decode(t.id),l=CS.default.decode(c),d=c.slice(CS.default.decode.bytes),p=await lq[l].keyToDidDoc(d,t.id);a===uq?(p["@context"]="https://w3id.org/did/v1",s.didDocument=p):a===MS?s.didDocument=p:(delete s.didResolutionMetadata.contentType,s.didResolutionMetadata.error="representationNotSupported")}catch(c){s.didResolutionMetadata.error="invalidDid",s.didResolutionMetadata.message=c.toString()}return s}}}i(fq,"getResolver");o(fq,"getResolver");var BI=ir(H6(),1),dq=ir(Sz(),1),hq="base64pad";function o6(e){return JSON.parse((0,dq.default)(e))}i(o6,"toStableObject");o(o6,"toStableObject");function LI(e){let t=new Uint8Array(e.length+2);return t[0]=237,t[1]=1,t.set(e,2),`did:key:z${Ir(t,"base58btc")}`}i(LI,"encodeDID");o(LI,"encodeDID");function s6(e){let[t,r,n]=e.split(".");return{payload:r,signatures:[{protected:t,signature:n}]}}i(s6,"toGeneralJWS");o(s6,"toGeneralJWS");var IS=o(async(e,t,r,n={})=>{let a=`${t}#${t.split(":")[2]}`,s=PT(r),c=o6(Object.assign(n,{kid:a,alg:"EdDSA"}));return eH(typeof e=="string"?e:o6(e),s,c)},"sign"),pq={did_authenticate:async({did:e,secretKey:t},r)=>{let n=await IS({did:e,aud:r.aud,nonce:r.nonce,paths:r.paths,exp:Math.floor(Date.now()/1e3)+600},e,t);return s6(n)},did_createJWS:async({did:e,secretKey:t},r)=>{if(r.did.split("#")[0]!==e)throw new Ts(4100,`Unknown DID: ${e}`);let a=await IS(r.payload,e,t,r.protected);return{jws:s6(a)}},did_decryptJWE:async({secretKey:e},t)=>{let r=WT((0,BI.convertSecretKeyToX25519)(e));try{let n=await rH(t.jwe,r);return{cleartext:Ir(n,hq)}}catch(n){throw new Ts(-32e3,n.message)}}},mq=i(class{constructor(e){let{secretKey:t,publicKey:r}=(0,BI.generateKeyPairFromSeed)(e),n=LI(r),a=CM(pq);this._handle=async s=>await a({did:n,secretKey:t},s)}get isDidProvider(){return!0}async send(e){return await this._handle(e)}},"Ed25519Provider");o(mq,"Ed25519Provider");var UI={};Sr(UI,{JsonPatchError:()=>Ur,_areEquals:()=>il,applyOperation:()=>_s,applyPatch:()=>a1,applyReducer:()=>jI,deepClone:()=>yq,getValueByPointer:()=>Md,validate:()=>O3,validator:()=>Id});var gq=function(){var e=o(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},e(t,r)},"extendStatics");return function(t,r){e(t,r);function n(){this.constructor=t}i(n,"__"),o(n,"__"),t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),vq=Object.prototype.hasOwnProperty;function _m(e,t){return vq.call(e,t)}i(_m,"hasOwnProperty");o(_m,"hasOwnProperty");function Em(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var a in e)_m(e,a)&&n.push(a);return n}i(Em,"_objectKeys");o(Em,"_objectKeys");function ti(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}i(ti,"_deepClone");o(ti,"_deepClone");function Am(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}i(Am,"isInteger2");o(Am,"isInteger");function bs(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}i(bs,"escapePathComponent");o(bs,"escapePathComponent");function R3(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}i(R3,"unescapePathComponent");o(R3,"unescapePathComponent");function Sm(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Sm(e[t]))return!0}else if(typeof e=="object"){for(var n=Em(e),a=n.length,s=0;s<a;s++)if(Sm(e[n[s]]))return!0}}return!1}i(Sm,"hasUndefined");o(Sm,"hasUndefined");function c6(e,t){var r=[e];for(var n in t){var a=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof a<"u"&&r.push(n+": "+a)}return r.join(`
|
|
843
843
|
`)}i(c6,"patchErrorMessageFormatter");o(c6,"patchErrorMessageFormatter");var FI=function(e){gq(t,e);function t(r,n,a,s,c){var l=this.constructor,d=e.call(this,c6(r,{name:n,index:a,operation:s,tree:c}))||this;return d.name=n,d.index=a,d.operation=s,d.tree=c,Object.setPrototypeOf(d,l.prototype),d.message=c6(r,{name:n,index:a,operation:s,tree:c}),d}return i(t,"PatchError2"),o(t,"PatchError"),t}(Error),Ur=FI,yq=ti,Zu={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Md(r,this.path);n&&(n=ti(n));var a=_s(r,{op:"remove",path:this.from}).removed;return _s(r,{op:"add",path:this.path,value:a}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Md(r,this.from);return _s(r,{op:"add",path:this.path,value:ti(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:il(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},bq={add:function(e,t,r){return Am(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Zu.move,copy:Zu.copy,test:Zu.test,_get:Zu._get};function Md(e,t){if(t=="")return e;var r={op:"_get",path:t};return _s(e,r),r.value}i(Md,"getValueByPointer");o(Md,"getValueByPointer");function _s(e,t,r,n,a,s){if(r===void 0&&(r=!1),n===void 0&&(n=!0),a===void 0&&(a=!0),s===void 0&&(s=0),r&&(typeof r=="function"?r(t,0,e,t.path):Id(t,0)),t.path===""){var c={newDocument:e};if(t.op==="add")return c.newDocument=t.value,c;if(t.op==="replace")return c.newDocument=t.value,c.removed=e,c;if(t.op==="move"||t.op==="copy")return c.newDocument=Md(e,t.from),t.op==="move"&&(c.removed=e),c;if(t.op==="test"){if(c.test=il(e,t.value),c.test===!1)throw new Ur("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c.newDocument=e,c}else{if(t.op==="remove")return c.removed=e,c.newDocument=null,c;if(t.op==="_get")return t.value=e,c;if(r)throw new Ur("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,t,e);return c}}else{n||(e=ti(e));var l=t.path||"",d=l.split("/"),p=e,g=1,v=d.length,y=void 0,_=void 0,x=void 0;for(typeof r=="function"?x=r:x=Id;;){if(_=d[g],_&&_.indexOf("~")!=-1&&(_=R3(_)),a&&(_=="__proto__"||_=="prototype"&&g>0&&d[g-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(r&&y===void 0&&(p[_]===void 0?y=d.slice(0,g).join("/"):g==v-1&&(y=t.path),y!==void 0&&x(t,0,e,y)),g++,Array.isArray(p)){if(_==="-")_=p.length;else{if(r&&!Am(_))throw new Ur("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,t,e);Am(_)&&(_=~~_)}if(g>=v){if(r&&t.op==="add"&&_>p.length)throw new Ur("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,t,e);var c=bq[t.op].call(t,p,_,e);if(c.test===!1)throw new Ur("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}}else if(g>=v){var c=Zu[t.op].call(t,p,_,e);if(c.test===!1)throw new Ur("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}if(p=p[_],r&&g<v&&(!p||typeof p!="object"))throw new Ur("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,t,e)}}}i(_s,"applyOperation");o(_s,"applyOperation");function a1(e,t,r,n,a){if(n===void 0&&(n=!0),a===void 0&&(a=!0),r&&!Array.isArray(t))throw new Ur("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=ti(e));for(var s=new Array(t.length),c=0,l=t.length;c<l;c++)s[c]=_s(e,t[c],r,!0,a,c),e=s[c].newDocument;return s.newDocument=e,s}i(a1,"applyPatch");o(a1,"applyPatch");function jI(e,t,r){var n=_s(e,t);if(n.test===!1)throw new Ur("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}i(jI,"applyReducer");o(jI,"applyReducer");function Id(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Ur("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Zu[e.op]){if(typeof e.path!="string")throw new Ur("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Ur('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Ur("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Ur("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Sm(e.value))throw new Ur("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var a=e.path.split("/").length,s=n.split("/").length;if(a!==s+1&&a!==s)throw new Ur("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new Ur("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var c={op:"_get",path:e.from,value:void 0},l=O3([c],r);if(l&&l.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ur("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Ur("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}i(Id,"validator");o(Id,"validator");function O3(e,t,r){try{if(!Array.isArray(e))throw new Ur("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)a1(ti(t),ti(e),r||!0);else{r=r||Id;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(a){if(a instanceof Ur)return a;throw a}}i(O3,"validate5");o(O3,"validate");function il(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),a,s,c;if(r&&n){if(s=e.length,s!=t.length)return!1;for(a=s;a--!==0;)if(!il(e[a],t[a]))return!1;return!0}if(r!=n)return!1;var l=Object.keys(e);if(s=l.length,s!==Object.keys(t).length)return!1;for(a=s;a--!==0;)if(!t.hasOwnProperty(l[a]))return!1;for(a=s;a--!==0;)if(c=l[a],!il(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}i(il,"_areEquals");o(il,"_areEquals");var $I={};Sr($I,{compare:()=>GI,generate:()=>xm,observe:()=>KI,unobserve:()=>VI});var N3=new WeakMap,wq=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror2"),o(e,"Mirror"),e}(),_q=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo2"),o(e,"ObserverInfo"),e}();function zI(e){return N3.get(e)}i(zI,"getMirror");o(zI,"getMirror");function HI(e,t){return e.observers.get(t)}i(HI,"getObserverFromMirror");o(HI,"getObserverFromMirror");function qI(e,t){e.observers.delete(t.callback)}i(qI,"removeObserverFromMirror");o(qI,"removeObserverFromMirror");function VI(e,t){t.unobserve()}i(VI,"unobserve");o(VI,"unobserve");function KI(e,t){var r=[],n,a=zI(e);if(!a)a=new wq(e),N3.set(e,a);else{var s=HI(a,t);n=s&&s.observer}if(n)return n;if(n={},a.value=ti(e),t){n.callback=t,n.next=null;var c=o(function(){xm(n)},"dirtyCheck"),l=o(function(){clearTimeout(n.next),n.next=setTimeout(c)},"fastCheck");typeof window<"u"&&(window.addEventListener("mouseup",l),window.addEventListener("keyup",l),window.addEventListener("mousedown",l),window.addEventListener("keydown",l),window.addEventListener("change",l))}return n.patches=r,n.object=e,n.unobserve=function(){xm(n),clearTimeout(n.next),qI(a,n),typeof window<"u"&&(window.removeEventListener("mouseup",l),window.removeEventListener("keyup",l),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l),window.removeEventListener("change",l))},a.observers.set(t,new _q(t,n)),n}i(KI,"observe");o(KI,"observe");function xm(e,t){t===void 0&&(t=!1);var r=N3.get(e.object);o1(r.value,e.object,e.patches,"",t),e.patches.length&&a1(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}i(xm,"generate2");o(xm,"generate");function o1(e,t,r,n,a){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=Em(t),c=Em(e),l=!1,d=!1,p=c.length-1;p>=0;p--){var g=c[p],v=e[g];if(_m(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var y=t[g];typeof v=="object"&&v!=null&&typeof y=="object"&&y!=null&&Array.isArray(v)===Array.isArray(y)?o1(v,y,r,n+"/"+bs(g),a):v!==y&&(l=!0,a&&r.push({op:"test",path:n+"/"+bs(g),value:ti(v)}),r.push({op:"replace",path:n+"/"+bs(g),value:ti(y)}))}else Array.isArray(e)===Array.isArray(t)?(a&&r.push({op:"test",path:n+"/"+bs(g),value:ti(v)}),r.push({op:"remove",path:n+"/"+bs(g)}),d=!0):(a&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),l=!0)}if(!(!d&&s.length==c.length))for(var p=0;p<s.length;p++){var g=s[p];!_m(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+bs(g),value:ti(t[g])})}}}i(o1,"_generate");o(o1,"_generate");function GI(e,t,r){r===void 0&&(r=!1);var n=[];return o1(e,t,n,"",r),n}i(GI,"compare3");o(GI,"compare");var WI=Object.assign({},UI,$I,{JsonPatchError:FI,deepClone:ti,escapePathComponent:bs,unescapePathComponent:R3}),Eq=ir(Wd(),1),Aq=ir(El(),1),ni;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC"})(ni||(ni={}));var kS=ir(Wd(),1);Ja();Vd();var ZI={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function JI(e){let t=ZI[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(JI,"codeByName");o(JI,"codeByName");function YI(e){let t=Object.entries(ZI).find(([,r])=>r===e);if(t)return t[0];throw new Error(`No stream type registered for index ${e}`)}i(YI,"nameByCode");o(YI,"nameByCode");var No=i(class{},"StreamType");o(No,"StreamType");No.nameByCode=YI;No.codeByName=JI;var DS=ir(jm(),1);function Ji(e){let t,r,n;return typeof e=="object"?(t=e.hashFunction,r=e.expiring,n=e.tags):t=e,(a,s,c)=>{if(c.value!=null)c.value=u6(c.value,t,r,n);else if(c.get!=null)c.get=u6(c.get,t,r,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}i(Ji,"Memoize");o(Ji,"Memoize");var Sb=new Map;function u6(e,t,r=0,n){let a=Symbol("__memoized_map__");return function(...s){let c;this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let l=this[a];if(Array.isArray(n))for(let d of n)Sb.has(d)?Sb.get(d).push(l):Sb.set(d,[l]);if(t||s.length>0||r>0){let d;t===!0?d=s.map(v=>v.toString()).join("!"):t?d=t.apply(this,s):d=s[0];let p=`${d}__timestamp`,g=!1;if(r>0)if(!l.has(p))g=!0;else{let v=l.get(p);g=Date.now()-v>r}l.has(d)&&!g?c=l.get(d):(c=e.apply(this,s),l.set(d,c),r>0&&l.set(p,Date.now()))}else{let d=this;l.has(d)?c=l.get(d):(c=e.apply(this,s),l.set(d,c))}return c}}i(u6,"getNewFunction");o(u6,"getNewFunction");var P3=206;Ja();Vd();Nm();var RS=ir(jm(),1);function eh(e){try{return e()}catch(t){return t}}i(eh,"tryCatch");o(eh,"tryCatch");Ja();var OS=ir(jm(),1);bl();function Mc(e){let t=OS.default.decode(e),r=OS.default.decode.bytes,n=e.subarray(r);return[t,n,r]}i(Mc,"readVarint");o(Mc,"readVarint");function XI(e){return e===0||e===1}i(XI,"isCidVersion");o(XI,"isCidVersion");function l6(e){let[t,r]=Mc(e);if(!XI(t))throw new Error(`Unknown CID version ${t}`);let[n,a]=Mc(r),[,s,c]=Mc(a),[l,,d]=Mc(s),p=a.subarray(0,c+d+l),g=a.subarray(c+d+l);return[Vt.create(t,n,F6(p)),g]}i(l6,"readCid");o(l6,"readCid");Ja();Vd();function th(e,t="StreamRef"){let[r,n]=Mc(e);if(r!==P3)throw new Error(`Invalid ${t}, does not include streamid codec`);let[a,s]=Mc(n),c=l6(s),[l,d]=c;if(d.length===0)return{kind:"stream-id",type:a,genesis:l};if(d.length===1&&d[0]===0)return{kind:"commit-id",type:a,genesis:l,commit:null};{let[p]=l6(d);return{kind:"commit-id",type:a,genesis:l,commit:p}}}i(th,"fromBytes");o(th,"fromBytes");var Sq=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function s1(e,t="StreamRef"){let r=Sq.exec(e)||[],n=r[2];if(!n)throw new Error(`Malformed ${t} string: ${e}`);let a=Rs.decode(n),s=th(a),c=r[4];return c?{kind:"commit-id",type:s.type,genesis:s.genesis,commit:B3(s.genesis,c)}:s}i(s1,"fromString4");o(s1,"fromString");function QI(e){try{return typeof e=="string"?Vt.parse(e):Vt.asCID(e)}catch{return null}}i(QI,"parseCID");o(QI,"parseCID");function B3(e,t=null){if(!t||t==="0")return null;let r=QI(t);if(r)return e.equals(r)?null:r;throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)")}i(B3,"parseCommit");o(B3,"parseCommit");var rh=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate"),Gi=i(function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},"__metadata"),ek=i(class extends Error{constructor(e){super(`Invalid StreamID bytes ${Rs.encode(e)}: contains commit`)}},"InvalidStreamIDBytesError");o(ek,"InvalidStreamIDBytesError");var tk=i(class extends Error{constructor(e){super(`Invalid StreamID string ${e}: contains commit`)}},"InvalidStreamIDStringError");o(tk,"InvalidStreamIDStringError");function L3(e){let t=th(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new ek(e)}i(L3,"fromBytes2");o(L3,"fromBytes");function rk(e){return eh(()=>L3(e))}i(rk,"fromBytesNoThrow");o(rk,"fromBytesNoThrow");function U3(e){let t=s1(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new tk(e)}i(U3,"fromString5");o(U3,"fromString");function nk(e){return eh(()=>U3(e))}i(nk,"fromStringNoThrow");o(nk,"fromStringNoThrow");var NS=Symbol.for("@ceramicnetwork/streamid/StreamID"),Xt=i(class{constructor(e,t){if(this._tag=NS,!(e||e===0))throw new Error("StreamID constructor: type required");if(!t)throw new Error("StreamID constructor: cid required");this._type=typeof e=="string"?No.codeByName(e):e,this._cid=typeof t=="string"?Vt.parse(t):t}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===NS}static async fromGenesis(e,t){let r=await Hm({value:t,codec:xl,hasher:wl});return new Xt(e,r.cid)}get type(){return this._type}get typeName(){return No.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let e=RS.default.encode(P3),t=RS.default.encode(this.type);return As([e,t,this.cid.bytes])}get baseID(){return new Xt(this._type,this._cid)}equals(e){return Xt.isInstance(e)?this.type===e.type&&this.cid.equals(e.cid):!1}toString(){return Rs.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[Symbol.for("nodejs.util.inspect.custom")](){return`StreamID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}},"StreamID");o(Xt,"StreamID");Xt.fromBytes=L3;Xt.fromBytesNoThrow=rk;Xt.fromString=U3;Xt.fromStringNoThrow=nk;rh([Ji(),Gi("design:type",String),Gi("design:paramtypes",[])],Xt.prototype,"typeName",null);rh([Ji(),Gi("design:type",Uint8Array),Gi("design:paramtypes",[])],Xt.prototype,"bytes",null);rh([Ji(),Gi("design:type",Xt),Gi("design:paramtypes",[])],Xt.prototype,"baseID",null);rh([Ji(),Gi("design:type",Function),Gi("design:paramtypes",[]),Gi("design:returntype",String)],Xt.prototype,"toString",null);rh([Ji(),Gi("design:type",Function),Gi("design:paramtypes",[]),Gi("design:returntype",String)],Xt.prototype,"toUrl",null);var Ol=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate2"),ri=i(function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},"__metadata2"),xb=i(function(e,t,r,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(e,r):a?a.value=r:t.set(e,r),r},"__classPrivateFieldSet"),Co=i(function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},"__classPrivateFieldGet"),Vu,Ac,cd,ik=i(class extends Error{constructor(e){super(`Error while parsing CommitID from bytes ${Rs.encode(e)}: no commit information provided`)}},"InvalidCommitIDBytesError");o(ik,"InvalidCommitIDBytesError");var ak=i(class extends Error{constructor(e){super(`Error while parsing CommitID from string ${e}: no commit information provided`)}},"InvalidCommitIDStringError");o(ak,"InvalidCommitIDStringError");function F3(e){let t=th(e,"CommitID");if(t.kind==="commit-id")return new Er(t.type,t.genesis,t.commit);throw new ik(e)}i(F3,"fromBytes3");o(F3,"fromBytes");function ok(e){return eh(()=>F3(e))}i(ok,"fromBytesNoThrow2");o(ok,"fromBytesNoThrow");function j3(e){let t=s1(e,"CommitID");if(t.kind==="commit-id")return new Er(t.type,t.genesis,t.commit);throw new ak(e)}i(j3,"fromString6");o(j3,"fromString");function sk(e){return eh(()=>j3(e))}i(sk,"fromStringNoThrow2");o(sk,"fromStringNoThrow");var PS=Symbol.for("@ceramicnetwork/streamid/CommitID");function ck(e,t){return new Er(e.type,e.cid,t)}i(ck,"make");o(ck,"make");var Er=i(class{constructor(e,t,r=null){if(this._tag=PS,Vu.set(this,void 0),Ac.set(this,void 0),cd.set(this,void 0),!e&&e!==0)throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");xb(this,Vu,typeof e=="string"?No.codeByName(e):e,"f"),xb(this,Ac,typeof t=="string"?Vt.parse(t):t,"f"),xb(this,cd,B3(Co(this,Ac,"f"),r),"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===PS}get baseID(){return new Xt(Co(this,Vu,"f"),Co(this,Ac,"f"))}get type(){return Co(this,Vu,"f")}get typeName(){return No.nameByCode(Co(this,Vu,"f"))}get cid(){return Co(this,Ac,"f")}get commit(){return Co(this,cd,"f")||Co(this,Ac,"f")}get bytes(){let e=DS.default.encode(P3),t=DS.default.encode(this.type),r=Co(this,cd,"f")?.bytes||new Uint8Array([0]);return As([e,t,this.cid.bytes,r])}equals(e){return this.type===e.type&&this.cid.equals(e.cid)&&this.commit.equals(e.commit)}toString(){return Rs.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(Vu=new WeakMap,Ac=new WeakMap,cd=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}},"CommitID");o(Er,"CommitID");Er.fromBytes=F3;Er.fromBytesNoThrow=ok;Er.fromString=j3;Er.fromStringNoThrow=sk;Er.make=ck;Ol([Ji(),ri("design:type",Xt),ri("design:paramtypes",[])],Er.prototype,"baseID",null);Ol([Ji(),ri("design:type",String),ri("design:paramtypes",[])],Er.prototype,"typeName",null);Ol([Ji(),ri("design:type",Vt),ri("design:paramtypes",[])],Er.prototype,"commit",null);Ol([Ji(),ri("design:type",Uint8Array),ri("design:paramtypes",[])],Er.prototype,"bytes",null);Ol([Ji(),ri("design:type",Function),ri("design:paramtypes",[]),ri("design:returntype",String)],Er.prototype,"toString",null);Ol([Ji(),ri("design:type",Function),ri("design:paramtypes",[]),ri("design:returntype",String)],Er.prototype,"toUrl",null);Vd();var Cs;(function(e){function t(a){let s=th(a);switch(s.kind){case"commit-id":return new Er(s.type,s.genesis,s.commit);case"stream-id":return new Xt(s.type,s.genesis);default:throw new Error(`Malformed StreamRef bytes: ${Rs.encode(a)}`)}}i(t,"fromBytes4"),o(t,"fromBytes"),e.fromBytes=t;function r(a){let s=s1(a);switch(s.kind){case"commit-id":return new Er(s.type,s.genesis,s.commit);case"stream-id":return new Xt(s.type,s.genesis);default:throw new Error(`Malformed StreamRef string: ${a}`)}}i(r,"fromString7"),o(r,"fromString"),e.fromString=r;function n(a){if(Xt.isInstance(a)||Er.isInstance(a))return a;if(a instanceof Uint8Array)return t(a);if(typeof a=="string")return r(a);throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(a)}`)}i(n,"from4"),o(n,"from"),e.from=n})(Cs||(Cs={}));var f6=o(function(e,t){return f6=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},f6(e,t)},"extendStatics");function eo(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");f6(e,t);function r(){this.constructor=e}i(r,"__"),o(r,"__"),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}i(eo,"__extends2");o(eo,"__extends");function uk(e,t,r,n){function a(s){return s instanceof r?s:new r(function(c){c(s)})}return i(a,"adopt"),o(a,"adopt"),new(r||(r=Promise))(function(s,c){function l(g){try{p(n.next(g))}catch(v){c(v)}}i(l,"fulfilled"),o(l,"fulfilled");function d(g){try{p(n.throw(g))}catch(v){c(v)}}i(d,"rejected"),o(d,"rejected");function p(g){g.done?s(g.value):a(g.value).then(l,d)}i(p,"step"),o(p,"step"),p((n=n.apply(e,t||[])).next())})}i(uk,"__awaiter");o(uk,"__awaiter");function $3(e,t){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,a,s,c=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return c.next=l(0),c.throw=l(1),c.return=l(2),typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(p){return function(g){return d([p,g])}}function d(p){if(n)throw new TypeError("Generator is already executing.");for(;c&&(c=0,p[0]&&(r=0)),r;)try{if(n=1,a&&(s=p[0]&2?a.return:p[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,p[1])).done)return s;switch(a=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return r.label++,{value:p[1],done:!1};case 5:r.label++,a=p[1],p=[0];continue;case 7:p=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]<s[3])){r.label=p[1];break}if(p[0]===6&&r.label<s[1]){r.label=s[1],s=p;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(p);break}s[2]&&r.ops.pop(),r.trys.pop();continue}p=t.call(e,r)}catch(g){p=[6,g],a=0}finally{n=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}i($3,"__generator");o($3,"__generator");function Pc(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}i(Pc,"__values");o(Pc,"__values");function Po(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),a,s=[],c;try{for(;(t===void 0||t-- >0)&&!(a=n.next()).done;)s.push(a.value)}catch(l){c={error:l}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}i(Po,"__read");o(Po,"__read");function Ms(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,s;n<a;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}i(Ms,"__spreadArray");o(Ms,"__spreadArray");function Oc(e){return this instanceof Oc?(this.v=e,this):new Oc(e)}i(Oc,"__await");o(Oc,"__await");function lk(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),a,s=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",c),a[Symbol.asyncIterator]=function(){return this},a;function c(_){return function(x){return Promise.resolve(x).then(_,v)}}function l(_,x){n[_]&&(a[_]=function(O){return new Promise(function(D,L){s.push([_,O,D,L])>1||d(_,O)})},x&&(a[_]=x(a[_])))}function d(_,x){try{p(n[_](x))}catch(O){y(s[0][3],O)}}function p(_){_.value instanceof Oc?Promise.resolve(_.value.v).then(g,v):y(s[0][2],_)}function g(_){d("next",_)}function v(_){d("throw",_)}function y(_,x){_(x),s.shift(),s.length&&d(s[0][0],s[0][1])}}i(lk,"__asyncGenerator");o(lk,"__asyncGenerator");function fk(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Pc=="function"?Pc(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=e[s]&&function(c){return new Promise(function(l,d){c=e[s](c),a(l,d,c.done,c.value)})}}function a(s,c,l,d){Promise.resolve(d).then(function(p){s({value:p,done:l})},c)}}i(fk,"__asyncValues");o(fk,"__asyncValues");function Ar(e){return typeof e=="function"}i(Ar,"isFunction");o(Ar,"isFunction");function c1(e){var t=o(function(n){Error.call(n),n.stack=new Error().stack},"_super"),r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}i(c1,"createErrorClass");o(c1,"createErrorClass");var Tb=c1(function(e){return o(i(function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
844
844
|
`+r.map(function(n,a){return a+1+") "+n.toString()}).join(`
|
|
845
|
-
`):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl"),"UnsubscriptionErrorImpl")});function kd(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(kd,"arrRemove");o(kd,"arrRemove");var nh=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription2"),o(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,a,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=Pc(c),d=l.next();!d.done;d=l.next()){var p=d.value;p.remove(this)}}catch(O){t={error:O}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var g=this.initialTeardown;if(Ar(g))try{g()}catch(O){s=O instanceof Tb?O.errors:[O]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var y=Pc(v),_=y.next();!_.done;_=y.next()){var x=_.value;try{d6(x)}catch(O){s=s??[],O instanceof Tb?s=Ms(Ms([],Po(s)),Po(O.errors)):s.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(a=y.return)&&a.call(y)}finally{if(n)throw n.error}}}if(s)throw new Tb(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)d6(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&kd(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&kd(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),dk=nh.EMPTY;function z3(e){return e instanceof nh||e&&"closed"in e&&Ar(e.remove)&&Ar(e.add)&&Ar(e.unsubscribe)}i(z3,"isSubscription");o(z3,"isSubscription");function d6(e){Ar(e)?e():e.unsubscribe()}i(d6,"execFinalizer");o(d6,"execFinalizer");var Zc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Tm={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=Tm.delegate;return a?.setTimeout?a.setTimeout.apply(a,Ms([e,t],Po(r))):setTimeout.apply(void 0,Ms([e,t],Po(r)))},clearTimeout:function(e){var t=Tm.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function H3(e){Tm.setTimeout(function(){var t=Zc.onUnhandledError;if(t)t(e);else throw e})}i(H3,"reportUnhandledError");o(H3,"reportUnhandledError");function h6(){}i(h6,"noop");o(h6,"noop");var xq=function(){return u1("C",void 0,void 0)}();function hk(e){return u1("E",void 0,e)}i(hk,"errorNotification");o(hk,"errorNotification");function pk(e){return u1("N",e,void 0)}i(pk,"nextNotification");o(pk,"nextNotification");function u1(e,t,r){return{kind:e,value:t,error:r}}i(u1,"createNotification");o(u1,"createNotification");var Ic=null;function bd(e){if(Zc.useDeprecatedSynchronousErrorHandling){var t=!Ic;if(t&&(Ic={errorThrown:!1,error:null}),e(),t){var r=Ic,n=r.errorThrown,a=r.error;if(Ic=null,n)throw a}}else e()}i(bd,"errorContext");o(bd,"errorContext");function mk(e){Zc.useDeprecatedSynchronousErrorHandling&&Ic&&(Ic.errorThrown=!0,Ic.error=e)}i(mk,"captureError");o(mk,"captureError");var q3=function(e){eo(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,z3(r)&&r.add(n)):n.destination=Mq,n}return i(t,"Subscriber2"),o(t,"Subscriber"),t.create=function(r,n,a){return new p6(r,n,a)},t.prototype.next=function(r){this.isStopped?Q0(pk(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Q0(hk(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Q0(xq,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(nh),Tq=Function.prototype.bind;function X0(e,t){return Tq.call(e,t)}i(X0,"bind");o(X0,"bind");var Cq=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver2"),o(e,"ConsumerObserver"),e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){pd(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){pd(n)}else pd(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){pd(r)}},e}(),p6=function(e){eo(t,e);function t(r,n,a){var s=e.call(this)||this,c;if(Ar(r)||!r)c={next:r??void 0,error:n??void 0,complete:a??void 0};else{var l;s&&Zc.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&X0(r.next,l),error:r.error&&X0(r.error,l),complete:r.complete&&X0(r.complete,l)}):c=r}return s.destination=new Cq(c),s}return i(t,"SafeSubscriber2"),o(t,"SafeSubscriber"),t}(q3);function pd(e){Zc.useDeprecatedSynchronousErrorHandling?mk(e):H3(e)}i(pd,"handleUnhandledError");o(pd,"handleUnhandledError");function gk(e){throw e}i(gk,"defaultErrorHandler");o(gk,"defaultErrorHandler");function Q0(e,t){var r=Zc.onStoppedNotification;r&&Tm.setTimeout(function(){return r(e,t)})}i(Q0,"handleStoppedNotification");o(Q0,"handleStoppedNotification");var Mq={closed:!0,next:h6,error:gk,complete:h6},V3=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function l1(e){return e}i(l1,"identity3");o(l1,"identity");function vk(e){return e.length===0?l1:e.length===1?e[0]:o(i(function(r){return e.reduce(function(n,a){return a(n)},r)},"piped"),"piped")}i(vk,"pipeFromArray");o(vk,"pipeFromArray");var dn=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable2"),o(e,"Observable"),e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var a=this,s=bk(t)?t:new p6(t,r,n);return bd(function(){var c=a,l=c.operator,d=c.source;s.add(l?l.call(s,d):d?a._subscribe(s):a._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=m6(r),new r(function(a,s){var c=new p6({next:function(l){try{t(l)}catch(d){s(d),c.unsubscribe()}},error:s,complete:a});n.subscribe(c)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[V3]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vk(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=m6(t),new t(function(n,a){var s;r.subscribe(function(c){return s=c},function(c){return a(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function m6(e){var t;return(t=e??Zc.Promise)!==null&&t!==void 0?t:Promise}i(m6,"getPromiseCtor");o(m6,"getPromiseCtor");function yk(e){return e&&Ar(e.next)&&Ar(e.error)&&Ar(e.complete)}i(yk,"isObserver");o(yk,"isObserver");function bk(e){return e&&e instanceof q3||yk(e)&&z3(e)}i(bk,"isSubscriber");o(bk,"isSubscriber");function wk(e){return Ar(e?.lift)}i(wk,"hasLift");o(wk,"hasLift");function to(e){return function(t){if(wk(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}i(to,"operate");o(to,"operate");function _a(e,t,r,n,a){return new Iq(e,t,r,n,a)}i(_a,"createOperatorSubscriber");o(_a,"createOperatorSubscriber");var Iq=function(e){eo(t,e);function t(r,n,a,s,c,l){var d=e.call(this,r)||this;return d.onFinalize=c,d.shouldUnsubscribe=l,d._next=n?function(p){try{n(p)}catch(g){r.error(g)}}:e.prototype._next,d._error=s?function(p){try{s(p)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,d._complete=a?function(){try{a()}catch(p){r.error(p)}finally{this.unsubscribe()}}:e.prototype._complete,d}return i(t,"OperatorSubscriber2"),o(t,"OperatorSubscriber"),t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(q3),kq=c1(function(e){return o(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),_k=function(e){eo(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return i(t,"Subject2"),o(t,"Subject"),t.prototype.lift=function(r){var n=new BS(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new kq},t.prototype.next=function(r){var n=this;bd(function(){var a,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var c=Pc(n.currentObservers),l=c.next();!l.done;l=c.next()){var d=l.value;d.next(r)}}catch(p){a={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(a)throw a.error}}}})},t.prototype.error=function(r){var n=this;bd(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var a=n.observers;a.length;)a.shift().error(r)}})},t.prototype.complete=function(){var r=this;bd(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,a=this,s=a.hasError,c=a.isStopped,l=a.observers;return s||c?dk:(this.currentObservers=null,l.push(r),new nh(function(){n.currentObservers=null,kd(l,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,a=n.hasError,s=n.thrownError,c=n.isStopped;a?r.error(s):c&&r.complete()},t.prototype.asObservable=function(){var r=new dn;return r.source=this,r},t.create=function(r,n){return new BS(r,n)},t}(dn),BS=function(e){eo(t,e);function t(r,n){var a=e.call(this)||this;return a.destination=r,a.source=n,a}return i(t,"AnonymousSubject2"),o(t,"AnonymousSubject"),t.prototype.next=function(r){var n,a;(a=(n=this.destination)===null||n===void 0?void 0:n.next)===null||a===void 0||a.call(n,r)},t.prototype.error=function(r){var n,a;(a=(n=this.destination)===null||n===void 0?void 0:n.error)===null||a===void 0||a.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,a;return(a=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&a!==void 0?a:dk},t}(_k),Dq=function(e){eo(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return i(t,"BehaviorSubject2"),o(t,"BehaviorSubject"),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(r){var n=e.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},t.prototype.getValue=function(){var r=this,n=r.hasError,a=r.thrownError,s=r._value;if(n)throw a;return this._throwIfClosed(),s},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(_k),Ek={now:function(){return(Ek.delegate||Date).now()},delegate:void 0},Rq=function(e){eo(t,e);function t(r,n){return e.call(this)||this}return i(t,"Action2"),o(t,"Action"),t.prototype.schedule=function(r,n){return n===void 0&&(n=0),this},t}(nh),Cm={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=Cm.delegate;return a?.setInterval?a.setInterval.apply(a,Ms([e,t],Po(r))):setInterval.apply(void 0,Ms([e,t],Po(r)))},clearInterval:function(e){var t=Cm.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},Oq=function(e){eo(t,e);function t(r,n){var a=e.call(this,r,n)||this;return a.scheduler=r,a.work=n,a.pending=!1,a}return i(t,"AsyncAction2"),o(t,"AsyncAction"),t.prototype.schedule=function(r,n){var a;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var s=this.id,c=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(c,s,n)),this.pending=!0,this.delay=n,this.id=(a=this.id)!==null&&a!==void 0?a:this.requestAsyncId(c,this.id,n),this},t.prototype.requestAsyncId=function(r,n,a){return a===void 0&&(a=0),Cm.setInterval(r.flush.bind(r,this),a)},t.prototype.recycleAsyncId=function(r,n,a){if(a===void 0&&(a=0),a!=null&&this.delay===a&&this.pending===!1)return n;n!=null&&Cm.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var a=this._execute(r,n);if(a)return a;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var a=!1,s;try{this.work(r)}catch(c){a=!0,s=c||new Error("Scheduled action threw falsy error")}if(a)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,a=r.scheduler,s=a.actions;this.work=this.state=this.scheduler=null,this.pending=!1,kd(s,this),n!=null&&(this.id=this.recycleAsyncId(a,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Rq),LS=function(){function e(t,r){r===void 0&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return i(e,"Scheduler2"),o(e,"Scheduler"),e.prototype.schedule=function(t,r,n){return r===void 0&&(r=0),new this.schedulerActionCtor(this,t).schedule(n,r)},e.now=Ek.now,e}(),Nq=function(e){eo(t,e);function t(r,n){n===void 0&&(n=LS.now);var a=e.call(this,r,n)||this;return a.actions=[],a._active=!1,a}return i(t,"AsyncScheduler2"),o(t,"AsyncScheduler"),t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var a;this._active=!0;do if(a=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,a){for(;r=n.shift();)r.unsubscribe();throw a}},t}(LS),Pq=new Nq(Oq),Bq=Pq,Ak=new dn(function(e){return e.complete()});function K3(e){return e&&Ar(e.schedule)}i(K3,"isScheduler");o(K3,"isScheduler");function G3(e){return e[e.length-1]}i(G3,"last");o(G3,"last");function Sk(e){return K3(G3(e))?e.pop():void 0}i(Sk,"popScheduler");o(Sk,"popScheduler");function xk(e,t){return typeof G3(e)=="number"?e.pop():t}i(xk,"popNumber");o(xk,"popNumber");var W3=o(function(e){return e&&typeof e.length=="number"&&typeof e!="function"},"isArrayLike");function Z3(e){return Ar(e?.then)}i(Z3,"isPromise");o(Z3,"isPromise");function J3(e){return Ar(e[V3])}i(J3,"isInteropObservable");o(J3,"isInteropObservable");function Y3(e){return Symbol.asyncIterator&&Ar(e?.[Symbol.asyncIterator])}i(Y3,"isAsyncIterable");o(Y3,"isAsyncIterable");function X3(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}i(X3,"createInvalidObservableTypeError");o(X3,"createInvalidObservableTypeError");function Tk(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(Tk,"getSymbolIterator");o(Tk,"getSymbolIterator");var Ck=Tk();function Q3(e){return Ar(e?.[Ck])}i(Q3,"isIterable");o(Q3,"isIterable");function e2(e){return lk(this,arguments,o(i(function(){var r,n,a,s;return $3(this,function(c){switch(c.label){case 0:r=e.getReader(),c.label=1;case 1:c.trys.push([1,,9,10]),c.label=2;case 2:return[4,Oc(r.read())];case 3:return n=c.sent(),a=n.value,s=n.done,s?[4,Oc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,Oc(a)];case 6:return[4,c.sent()];case 7:return c.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"),"readableStreamLikeToAsyncGenerator_1"))}i(e2,"readableStreamLikeToAsyncGenerator");o(e2,"readableStreamLikeToAsyncGenerator");function t2(e){return Ar(e?.getReader)}i(t2,"isReadableStreamLike");o(t2,"isReadableStreamLike");function $o(e){if(e instanceof dn)return e;if(e!=null){if(J3(e))return Mk(e);if(W3(e))return Ik(e);if(Z3(e))return kk(e);if(Y3(e))return r2(e);if(Q3(e))return Dk(e);if(t2(e))return Rk(e)}throw X3(e)}i($o,"innerFrom");o($o,"innerFrom");function Mk(e){return new dn(function(t){var r=e[V3]();if(Ar(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(Mk,"fromInteropObservable");o(Mk,"fromInteropObservable");function Ik(e){return new dn(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(Ik,"fromArrayLike");o(Ik,"fromArrayLike");function kk(e){return new dn(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,H3)})}i(kk,"fromPromise");o(kk,"fromPromise");function Dk(e){return new dn(function(t){var r,n;try{for(var a=Pc(e),s=a.next();!s.done;s=a.next()){var c=s.value;if(t.next(c),t.closed)return}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}t.complete()})}i(Dk,"fromIterable");o(Dk,"fromIterable");function r2(e){return new dn(function(t){Ok(e,t).catch(function(r){return t.error(r)})})}i(r2,"fromAsyncIterable");o(r2,"fromAsyncIterable");function Rk(e){return r2(e2(e))}i(Rk,"fromReadableStreamLike");o(Rk,"fromReadableStreamLike");function Ok(e,t){var r,n,a,s;return uk(this,void 0,void 0,function(){var c,l;return $3(this,function(d){switch(d.label){case 0:d.trys.push([0,5,6,11]),r=fk(e),d.label=1;case 1:return[4,r.next()];case 2:if(n=d.sent(),!!n.done)return[3,4];if(c=n.value,t.next(c),t.closed)return[2];d.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=d.sent(),a={error:l},[3,11];case 6:return d.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:d.sent(),d.label=8;case 8:return[3,10];case 9:if(a)throw a.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}i(Ok,"process2");o(Ok,"process");function Ro(e,t,r,n,a){n===void 0&&(n=0),a===void 0&&(a=!1);var s=t.schedule(function(){r(),a?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!a)return s}i(Ro,"executeSchedule");o(Ro,"executeSchedule");function n2(e,t){return t===void 0&&(t=0),to(function(r,n){r.subscribe(_a(n,function(a){return Ro(n,e,function(){return n.next(a)},t)},function(){return Ro(n,e,function(){return n.complete()},t)},function(a){return Ro(n,e,function(){return n.error(a)},t)}))})}i(n2,"observeOn");o(n2,"observeOn");function i2(e,t){return t===void 0&&(t=0),to(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(i2,"subscribeOn");o(i2,"subscribeOn");function Nk(e,t){return $o(e).pipe(i2(t),n2(t))}i(Nk,"scheduleObservable");o(Nk,"scheduleObservable");function Pk(e,t){return $o(e).pipe(i2(t),n2(t))}i(Pk,"schedulePromise");o(Pk,"schedulePromise");function Bk(e,t){return new dn(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}i(Bk,"scheduleArray");o(Bk,"scheduleArray");function Lk(e,t){return new dn(function(r){var n;return Ro(r,t,function(){n=e[Ck](),Ro(r,t,function(){var a,s,c;try{a=n.next(),s=a.value,c=a.done}catch(l){r.error(l);return}c?r.complete():r.next(s)},0,!0)}),function(){return Ar(n?.return)&&n.return()}})}i(Lk,"scheduleIterable");o(Lk,"scheduleIterable");function a2(e,t){if(!e)throw new Error("Iterable cannot be null");return new dn(function(r){Ro(r,t,function(){var n=e[Symbol.asyncIterator]();Ro(r,t,function(){n.next().then(function(a){a.done?r.complete():r.next(a.value)})},0,!0)})})}i(a2,"scheduleAsyncIterable");o(a2,"scheduleAsyncIterable");function Uk(e,t){return a2(e2(e),t)}i(Uk,"scheduleReadableStreamLike");o(Uk,"scheduleReadableStreamLike");function Fk(e,t){if(e!=null){if(J3(e))return Nk(e,t);if(W3(e))return Bk(e,t);if(Z3(e))return Pk(e,t);if(Y3(e))return a2(e,t);if(Q3(e))return Lk(e,t);if(t2(e))return Uk(e,t)}throw X3(e)}i(Fk,"scheduled");o(Fk,"scheduled");function jk(e,t){return t?Fk(e,t):$o(e)}i(jk,"from3");o(jk,"from");var $k=c1(function(e){return o(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function zk(e){return e instanceof Date&&!isNaN(e)}i(zk,"isValidDate");o(zk,"isValidDate");function o2(e,t){return to(function(r,n){var a=0;r.subscribe(_a(n,function(s){n.next(e.call(t,s,a++))}))})}i(o2,"map");o(o2,"map");var Lq=Array.isArray;function Hk(e,t){return Lq(t)?e.apply(void 0,Ms([],Po(t))):e(t)}i(Hk,"callOrApply");o(Hk,"callOrApply");function qk(e){return o2(function(t){return Hk(e,t)})}i(qk,"mapOneOrManyArgs");o(qk,"mapOneOrManyArgs");function Vk(e,t,r,n,a,s,c,l){var d=[],p=0,g=0,v=!1,y=o(function(){v&&!d.length&&!p&&t.complete()},"checkComplete"),_=o(function(O){return p<n?x(O):d.push(O)},"outerNext"),x=o(function(O){s&&t.next(O),p++;var D=!1;$o(r(O,g++)).subscribe(_a(t,function(L){a?.(L),s?_(L):t.next(L)},function(){D=!0},void 0,function(){if(D)try{p--;for(var L=o(function(){var Z=d.shift();c?Ro(t,c,function(){return x(Z)}):x(Z)},"_loop_1");d.length&&p<n;)L();y()}catch(Z){t.error(Z)}}))},"doInnerSub");return e.subscribe(_a(t,_,function(){v=!0,y()})),function(){l?.()}}i(Vk,"mergeInternals");o(Vk,"mergeInternals");function f1(e,t,r){return r===void 0&&(r=1/0),Ar(t)?f1(function(n,a){return o2(function(s,c){return t(n,s,a,c)})($o(e(n,a)))},r):(typeof t=="number"&&(r=t),to(function(n,a){return Vk(n,a,e,r)}))}i(f1,"mergeMap");o(f1,"mergeMap");function Kk(e){return e===void 0&&(e=1/0),f1(l1,e)}i(Kk,"mergeAll");o(Kk,"mergeAll");var Uq=["addListener","removeListener"],Fq=["addEventListener","removeEventListener"],jq=["on","off"];function Mm(e,t,r,n){if(Ar(r)&&(n=r,r=void 0),n)return Mm(e,t,r).pipe(qk(n));var a=Po(Zk(e)?Fq.map(function(l){return function(d){return e[l](t,d,r)}}):Gk(e)?Uq.map(g6(e,t)):Wk(e)?jq.map(g6(e,t)):[],2),s=a[0],c=a[1];if(!s&&W3(e))return f1(function(l){return Mm(l,t,r)})($o(e));if(!s)throw new TypeError("Invalid event target");return new dn(function(l){var d=o(function(){for(var p=[],g=0;g<arguments.length;g++)p[g]=arguments[g];return l.next(1<p.length?p:p[0])},"handler");return s(d),function(){return c(d)}})}i(Mm,"fromEvent");o(Mm,"fromEvent");function g6(e,t){return function(r){return function(n){return e[r](t,n)}}}i(g6,"toCommonHandlerRegistry");o(g6,"toCommonHandlerRegistry");function Gk(e){return Ar(e.addListener)&&Ar(e.removeListener)}i(Gk,"isNodeStyleEventEmitter");o(Gk,"isNodeStyleEventEmitter");function Wk(e){return Ar(e.on)&&Ar(e.off)}i(Wk,"isJQueryStyleEventEmitter");o(Wk,"isJQueryStyleEventEmitter");function Zk(e){return Ar(e.addEventListener)&&Ar(e.removeEventListener)}i(Zk,"isEventTarget");o(Zk,"isEventTarget");function s2(e,t,r){e===void 0&&(e=0),r===void 0&&(r=Bq);var n=-1;return t!=null&&(K3(t)?r=t:n=t),new dn(function(a){var s=zk(e)?+e-r.now():e;s<0&&(s=0);var c=0;return r.schedule(function(){a.closed||(a.next(c++),0<=n?this.schedule(void 0,n):a.complete())},s)})}i(s2,"timer");o(s2,"timer");function Jk(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Sk(e),n=xk(e,1/0),a=e;return a.length?a.length===1?$o(a[0]):Kk(n)(jk(a,r)):Ak}i(Jk,"merge");o(Jk,"merge");function Yk(e,t){return to(function(r,n){var a=0;r.subscribe(_a(n,function(s){return e.call(t,s,a++)&&n.next(s)}))})}i(Yk,"filter");o(Yk,"filter");function Xk(e){return to(function(t,r){var n=!1;t.subscribe(_a(r,function(a){n=!0,r.next(a)},function(){n||r.next(e),r.complete()}))})}i(Xk,"defaultIfEmpty");o(Xk,"defaultIfEmpty");function Qk(e){return e<=0?function(){return Ak}:to(function(t,r){var n=0;t.subscribe(_a(r,function(a){++n<=e&&(r.next(a),e<=n&&r.complete())}))})}i(Qk,"take");o(Qk,"take");function eD(e){return e===void 0&&(e=tD),to(function(t,r){var n=!1;t.subscribe(_a(r,function(a){n=!0,r.next(a)},function(){return n?r.complete():r.error(e())}))})}i(eD,"throwIfEmpty");o(eD,"throwIfEmpty");function tD(){return new $k}i(tD,"defaultErrorFactory");o(tD,"defaultErrorFactory");function rD(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?Yk(function(a,s){return e(a,s,n)}):l1,Qk(1),r?Xk(t):eD(function(){return new $k}))}}i(rD,"first");o(rD,"first");function nD(e,t){return to(function(r,n){var a=t??{},s=a.leading,c=s===void 0?!0:s,l=a.trailing,d=l===void 0?!1:l,p=!1,g=null,v=null,y=!1,_=o(function(){v?.unsubscribe(),v=null,d&&(D(),y&&n.complete())},"endThrottling"),x=o(function(){v=null,y&&n.complete()},"cleanupThrottling"),O=o(function(L){return v=$o(e(L)).subscribe(_a(n,_,x))},"startThrottle"),D=o(function(){if(p){p=!1;var L=g;g=null,n.next(L),!y&&O(L)}},"send");r.subscribe(_a(n,function(L){p=!0,g=L,!(v&&!v.closed)&&(c?D():O(L))},function(){y=!0,!(d&&p&&v&&!v.closed)&&n.complete()}))})}i(nD,"throttle");o(nD,"throttle");var US;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(US||(US={}));var Im;(function(e){e[e.NOT_REQUESTED=0]="NOT_REQUESTED",e[e.PENDING=1]="PENDING",e[e.PROCESSING=2]="PROCESSING",e[e.ANCHORED=3]="ANCHORED",e[e.FAILED=4]="FAILED"})(Im||(Im={}));var v6;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(v6||(v6={}));var d1=i(class extends dn{constructor(e,t){super(r=>{e.subscribe(r)}),this.state$=e,this._context=t}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:e,content:t}=this.state$.value;return(0,kS.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Er.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Er.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===v6.ANCHOR).map(({cid:e})=>Er.make(this.id,e))}get state(){return(0,kS.default)(this.state$.value)}async sync(e={}){e={sync:ni.PREFER_CACHE,...e};let t=await this.api.loadStream(this.id,e);this.state$.next(t.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}},"Stream");o(d1,"Stream");function h1(){return e=>{}}i(h1,"StreamStatic");o(h1,"StreamStatic");var $q=ir(xz(),1);function iD(e){let t=new AbortController;if(e.length===0)throw Error("Need abort signals to create a merged abort signal");return e.some(r=>r.aborted)?(t.abort(),t.signal):(Jk(...e.map(r=>Mm(r,"abort"))).pipe(rD()).subscribe(()=>{t.abort()}),t.signal)}i(iD,"mergeAbortSignals");o(iD,"mergeAbortSignals");var aD=i(class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=s2(e).subscribe(()=>{t.abort()})}clear(){this._subscription?.unsubscribe()}},"TimedAbortSignal");o(aD,"TimedAbortSignal");async function oD(e,t){let r=new AbortController,n=o(()=>{r.abort()},"onAbort");return e.addEventListener("abort",n),e.aborted&&r.abort(),t(r.signal).finally(()=>{e.removeEventListener("abort",n)})}i(oD,"abortable2");o(oD,"abortable");var zq=60*1e3*3;async function Ai(e,t={}){t.body&&Object.assign(t,{body:JSON.stringify(t.body),headers:{...t.headers,"Content-Type":"application/json"}});let r=t.timeout||zq,n=new aD(r),a=t.signal?iD([t.signal,n.signal]):n.signal,s=await oD(a,c=>(0,$q.default)(String(e),{...t,signal:c})).finally(()=>n.clear());if(!s.ok){let c=await s.text();throw new Error(`HTTP request to '${e}' failed with status '${s.statusText}': ${c}`)}return s.json()}i(Ai,"fetchJson");o(Ai,"fetchJson");var $0=ir(Wd(),1);Ja();function Io(e){let t=Vt.asCID(e);if(t)return t;if(typeof e=="string")return Vt.parse(e);if(e instanceof Uint8Array)return Vt.decode(e);throw new Error(`${e} cannot be converted to a CID`)}i(Io,"toCID");o(Io,"toCID");var FS=0,Hr=i(class{static streamIdFromState(e){return new Xt(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,$0.default)(e);return Hr.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=Ir(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Ir(t.cacaoBlock,"base64")),t):(Hr.isSignedCommit(e)&&(t.link=t.link.toString()),Hr.isAnchorCommit(e)&&(t.proof=t.proof.toString()),t.id&&(t.id=t.id.toString()),t.prev&&(t.prev=t.prev.toString()),e.header?.model&&(t.header.model=Ir(e.header.model,"base64")),t)}static deserializeCommit(e){let t=(0,$0.default)(e);return Hr.isSignedCommitContainer(t)?(t.jws.link=Io(t.jws.link),t.linkedBlock=Cr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Cr(t.cacaoBlock,"base64")),t):(Hr.isSignedCommit(t)&&(t.link=Io(t.link)),Hr.isAnchorCommit(t)&&(t.proof=Io(t.proof)),t.id&&(t.id=Io(t.id)),t.prev&&(t.prev=Io(t.prev)),t.header?.model&&(t.header.model=Cr(t.header.model,"base64")),t)}static serializeState(e){let t=(0,$0.default)(e);return t.log=t.log.map(r=>({...r,cid:r.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=Im[t.anchorStatus]),t.anchorProof!=null&&(t.anchorProof.txHash=t.anchorProof.txHash.toString(),t.anchorProof.root=t.anchorProof.root.toString()),e.metadata?.model&&(t.metadata.model=e.metadata.model.toString()),e.next?.metadata?.model&&(t.next.metadata.model=e.next.metadata.model.toString()),e.metadata?.unique&&e.type!=FS&&(t.metadata.unique=Ir(t.metadata.unique,"base64")),t.doctype=No.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,$0.default)(e);return t.doctype&&(t.type=No.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:Io(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=Io(t.anchorProof.txHash),t.anchorProof.root=Io(t.anchorProof.root)),t.anchorStatus&&(t.anchorStatus=Im[t.anchorStatus]),e.metadata?.model&&(t.metadata.model=Xt.fromString(e.metadata.model)),e.next?.metadata?.model&&(t.next.metadata.model=Xt.fromString(e.next.metadata.model)),e.metadata?.unique&&e.type!=FS&&(t.metadata.unique=Cr(e.metadata.unique,"base64")),t}static statesEqual(e,t){return JSON.stringify(Hr.serializeState(e))===JSON.stringify(Hr.serializeState(t))}static isStateSupersetOf(e,t){if(e.log.length<t.log.length)return!1;for(let r in t.log)if(!e.log[r].cid.equals(t.log[r].cid))return!1;return!(e.log.length===t.log.length&&e.anchorStatus!=t.anchorStatus)}static assertCommitLinksToState(e,t){let r=this.streamIdFromState(e);if(t.id&&!t.id.equals(e.log[0].cid))throw new Error(`Invalid genesis CID in commit for StreamID ${r.toString()}. Found: ${t.id}, expected ${e.log[0].cid}`);let n=e.log[e.log.length-1].cid;if(!t.prev.equals(n))throw new Error(`Commit doesn't properly point to previous commit in log. Expected ${n}, found 'prev' ${t.prev}`)}static async convertCommitToSignedCommitContainer(e,t){if(Hr.isSignedCommit(e)){let r=await t.block.get(e.link);return{jws:e,linkedBlock:r}}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}},"StreamUtils");o(Hr,"StreamUtils");var sD=i(class extends Dq{next(e){let t=this.value;Hr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");o(sD,"StreamStateSubject");var Hq=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate3"),_i,Cb={anchor:!0,publish:!0,pin:!0,sync:ni.PREFER_CACHE},qq={sync:ni.PREFER_CACHE},jS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function em(e,t){if(typeof e?.schema=="string")try{Er.fromString(e.schema)}catch{throw new Error("Schema must be a CommitID")}let r={controllers:e?.controllers,family:e?.family,schema:e?.schema?.toString(),tags:e?.tags};if(t)e?.deterministic||(r.unique=Ir((0,Aq.randomBytes)(12),"base64")),e?.forbidControllerChange&&(r.forbidControllerChange=!0);else{if(e?.deterministic!==void 0||e?.unique!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if(e?.forbidControllerChange!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(r).forEach(n=>r[n]===void 0&&delete r[n]),r}i(em,"headerFromMetadata");o(em,"headerFromMetadata");async function y6(e){if(!e.did)throw new Error("No DID provided");return e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`)),e.did}i(y6,"getAuthenticatedDID");o(y6,"getAuthenticatedDID");async function tm(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(tm,"throwReadOnlyError");o(tm,"throwReadOnlyError");var Bo=_i=o(i(class extends d1{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,Eq.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,a={}){a={...Cb,...a},!n?.deterministic&&a.syncTimeoutSeconds==null&&(a.syncTimeoutSeconds=0);let s=a.asDID?{did:a.asDID}:t,c=await _i.makeGenesis(s,r,n);return t.createStreamFromGenesis(_i.STREAM_TYPE_ID,c,a)}static async createFromGenesis(t,r,n={}){n={...Cb,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=r.data?await _i._signDagJWS(t,r):r;return t.createStreamFromGenesis(_i.STREAM_TYPE_ID,a,n)}static async deterministic(t,r,n={}){if(n={...Cb,...n},r={...r,deterministic:!0},r.family==null&&r.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=await _i.makeGenesis(t,null,r);return t.createStreamFromGenesis(_i.STREAM_TYPE_ID,a,n)}static async load(t,r,n={}){n={...qq,...n};let a=Cs.from(r);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 t.loadStream(a,n)}async update(t,r,n={}){n={...jS,...n};let a=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(a,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...jS,...r};let a={header:em(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await _i._signDagJWS(this.api,a),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=tm,this.patch=tm,this.sync=tm,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let a=await this._makeRawCommit(r,n);return _i._signDagJWS(t,a)}async _makeRawCommit(t,r){r||(r={});let n=em(r,!1);if(t==null&&(t=this.content),n.controllers){if(n.controllers.length!==1)throw new Error("Exactly one controller must be specified");if(!n.controllers[0])throw new Error("Controller cannot be updated to an undefined value.")}let a=WI.compare(this.content,t),s=this.state.log[0];return{header:n,data:a,prev:this.tip,id:s.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await y6(t);n.controllers=[c.hasParent?c.parent:c.id]}else throw new Error("No controllers specified");if(n.controllers?.length!==1)throw new Error("Exactly one controller must be specified");let a=em(n,!0);if(n?.deterministic&&r)throw new Error("Initial content must be null when creating a deterministic Tile document");if(r==null){let c={header:a};return Qm(c),c}let s={data:r,header:a};return _i._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await y6(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");Bo.STREAM_TYPE_NAME="tile";Bo.STREAM_TYPE_ID=0;Bo=_i=Hq([h1()],Bo);var Vq=ir(Tz(),1);function cD(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(cD,"_checkPrivateRedeclaration2");o(cD,"_checkPrivateRedeclaration");function uD(e,t){return t.get?t.get.call(e):t.value}i(uD,"_classApplyDescriptorGet2");o(uD,"_classApplyDescriptorGet");function lD(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(lD,"_classApplyDescriptorSet2");o(lD,"_classApplyDescriptorSet");function c2(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(c2,"_classExtractFieldDescriptor2");o(c2,"_classExtractFieldDescriptor");function rm(e,t){var r=c2(e,t,"get");return uD(e,r)}i(rm,"_classPrivateFieldGet2");o(rm,"_classPrivateFieldGet");function b6(e,t,r){cD(e,t),t.set(e,r)}i(b6,"_classPrivateFieldInit2");o(b6,"_classPrivateFieldInit");function w6(e,t,r){var n=c2(e,t,"set");return lD(e,n,r),r}i(w6,"_classPrivateFieldSet2");o(w6,"_classPrivateFieldSet");function fD(e){return typeof e=="string"||Er.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(fD,"keyToQuery");o(fD,"keyToQuery");function nm(e){return typeof e=="string"?Cs.from(e).toString():Er.isInstance(e)||Xt.isInstance(e)?e.toString():e.streamId.toString()}i(nm,"keyToString");o(nm,"keyToString");async function dD(e){let t=await Bo.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(dD,"getDeterministicQuery");o(dD,"getDeterministicQuery");var Kq=o(()=>Promise.resolve([]),"tempBatchLoadFn"),z0=new WeakMap,Mb=new WeakMap,Gq=i(class extends Vq.default{cache(e){if(!rm(this,Mb))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}async create(e,t,r){let n=await Bo.create(rm(this,z0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await dD(e);try{return await super.load(r)}catch{let a=await Bo.createFromGenesis(rm(this,z0),r.genesis,t);return this.cache(a),a}}async load(e){return await super.load(e)}async update(e,t,r,n){let a=nm(e);this.clear(a);let s=await this.load({streamId:a});return await s.update(t,r,n),s}constructor(e){super(Kq,{cache:!0,cacheKeyFn:nm,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),b6(this,z0,{writable:!0,value:void 0}),b6(this,Mb,{writable:!0,value:void 0}),this._batchLoadFn=async t=>{e.cache||this.clearAll();let r=await e.ceramic.multiQuery(t.map(fD),e.multiqueryTimeout);return t.map(n=>{let a=nm(n),s=r[a];return s||new Error(`Failed to load stream: ${a}`)})},w6(this,z0,e.ceramic),w6(this,Mb,!!e.cache)}},"TileLoader");o(Gq,"TileLoader");function _6(e){return typeof e=="string"?Xt.fromString(e):e}i(_6,"typeStreamID");o(_6,"typeStreamID");function hD(e,t){let r=new URL(e);for(let[n,a]of Object.entries(t))Xt.isInstance(a)?r.searchParams.set(n,a.toString()):typeof a=="object"?r.searchParams.set(n,JSON.stringify(a)):r.searchParams.set(n,a);return r}i(hD,"serializeObjectToSearchParams");o(hD,"serializeObjectToSearchParams");function E6(e){let t={};for(let[r,n]of Object.entries(e))Xt.isInstance(n)?t[r]=n.toString():t[r]=n;return t}i(E6,"serializeObjectForHttpPost");o(E6,"serializeObjectForHttpPost");var Ki=i(class extends dn{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=s2(0,r).pipe(nD(()=>this._syncState(this.id,{sync:ni.PREFER_CACHE}))).subscribe()),this.state$.subscribe(n).add(()=>{this.state$.observers.length===0&&this.periodicSubscription?.unsubscribe()})}),this.state$=new sD(e),this._apiUrl=new URL(t)}get value(){return this.state$.value}get state(){return this.state$.value}next(e){this.state$.next(e)}async _syncState(e,t){let r=await Ki._load(e,this._apiUrl,t);this.state$.next(Hr.deserializeState(r))}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}static async createFromGenesis(e,t,r,n,a){let s=new URL("./streams",e),{state:c}=await Ai(s,{method:"post",body:{type:t,genesis:Hr.serializeCommit(r),opts:n}});return new Ki(Hr.deserializeState(c),e,a)}static async applyCommit(e,t,r,n,a){let s=new URL("./commits",e),{state:c}=await Ai(s,{method:"post",body:{streamId:t.toString(),commit:Hr.serializeCommit(r),opts:n}});return new Ki(Hr.deserializeState(c),e,a)}static async _load(e,t,r){let n=hD(new URL(`./streams/${e}`,t),r),{state:a}=await Ai(n);return a}static async load(e,t,r,n){let a=await Ki._load(e,t,n);return new Ki(Hr.deserializeState(a),t,r)}static async loadStreamCommits(e,t){let r=new URL(`./commits/${e}`,t),{commits:n}=await Ai(r);return n.map(a=>({cid:a.cid,value:Hr.deserializeCommit(a.value)}))}complete(){this.state$.complete()}},"Document");o(Ki,"Document");var Dd;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC",e[e.SYNC_ON_ERROR=3]="SYNC_ON_ERROR"})(Dd||(Dd={}));var $S=ir(Wd(),1),zS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(zS||(zS={}));var A6;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(A6||(A6={}));var pD=i(class extends dn{constructor(e,t){super(r=>{e.subscribe(r)}),this.state$=e,this._context=t}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:e,content:t}=this.state$.value;return(0,$S.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Er.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Er.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===A6.ANCHOR).map(({cid:e})=>Er.make(this.id,e))}get state(){return(0,$S.default)(this.state$.value)}async sync(e={}){e={sync:Dd.PREFER_CACHE,...e};let t=await this.api.loadStream(this.id,e);this.state$.next(t.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}},"Stream2");o(pD,"Stream");function mD(){return e=>{}}i(mD,"StreamStatic2");o(mD,"StreamStatic");function gD(e){if(typeof e=="string"&&e.includes("@")){let[t,r]=e.split("@");if(!t||!r)throw new Error("Invalid accountId provided");return new Td({address:t,chainId:r})}return new Td(e)}i(gD,"normalizeAccountId");o(gD,"normalizeAccountId");var Wq="(?:%[0-9a-fA-F]{2})",HS=`(?:[a-zA-Z0-9._-]|${Wq})`,Zq="([a-z0-9]+)",Jq=`((?:${HS}*:)*(${HS}+))`,qS="[a-zA-Z0-9_.:%-]",Yq=`;${qS}+=${qS}*`,Xq=`((${Yq})*)`,Qq="(/[^#?]*)?",eV="([?][^#]*)?",tV="(#.*)?",rV=new RegExp(`^did:${Zq}:${Jq}${Xq}${Qq}${eV}${tV}$`);function vD(e){if(e===""||!e)return null;let t=e.match(rV);if(t){let r={did:`did:${t[1]}:${t[2]}`,method:t[1],id:t[2],didUrl:e};if(t[4]){let n=t[4].slice(1).split(";");r.params={};for(let a of n){let s=a.split("=");r.params[s[0]]=s[1]}}return t[6]&&(r.path=t[6]),t[7]&&(r.query=t[7].slice(1)),t[8]&&(r.fragment=t[8].slice(1)),r}return null}i(vD,"parse2");o(vD,"parse");var nV=ir(Wd(),1),iV=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate4"),xc,Ib=o(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),VS={anchor:!1,publish:!0,sync:Dd.PREFER_CACHE},kb={anchor:!0,publish:!0},aV={sync:Dd.PREFER_CACHE},al=xc=o(i(class extends pD{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,nV.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...VS,...n};let a=gD(r),s=xc.makeGenesis(a);return xc.fromGenesis(t,s,n)}static async fromGenesis(t,r,n={}){return n={...VS,...n},t.createStreamFromGenesis(xc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...kb,...n};let a=typeof t=="string"?t.trim():t.id;if(vD(a)?.did!==a)throw new Error(`DID is not valid: '${a}'`);let c=await r.createLink(a);return this.setDidProof(c,n)}async setDidProof(t,r={}){r={...kb,...r};let n=this.makeCommit(t),a=await this.api.applyCommit(this.id,n,r);this.state$.next(a.state)}async clearDid(t,r={}){r={...kb,...r};let n=await t.createLink("");return this.setDidProof(n,r)}static async load(t,r,n={}){n={...aV,...n};let a=Cs.from(r);if(a.type!=xc.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${xc.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}static makeGenesis(t){return t.chainId.namespace==="eip155"&&(t.address=t.address.toLowerCase()),{header:{controllers:[`${t.address}@${t.chainId.toString()}`],family:`caip10-${t.chainId.toString()}`}}}makeCommit(t){return{data:t,prev:this.tip,id:this.id.cid}}makeReadOnly(){this.setDidProof=Ib,this.setDid=Ib,this.sync=Ib,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link2"),"Caip10Link");al.STREAM_TYPE_NAME="caip10-link";al.STREAM_TYPE_ID=1;al=xc=iV([mD()],al);Ja();bl();var oV=ir(Lz(),1),sV=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate5"),Va,cV={sync:ni.PREFER_CACHE};async function S6(e){if(e.did==null)throw new Error("No DID provided");e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`))}i(S6,"_ensureAuthenticated");o(S6,"_ensureAuthenticated");async function yD(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(yD,"throwReadOnlyError3");o(yD,"throwReadOnlyError");var Bc=Va=o(i(class extends d1{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:Va.MODEL}}static async create(t,r,n){Va.assertComplete(r);let a={publish:!0,anchor:!0,pin:!0,sync:ni.NEVER_SYNC,throwOnInvalidCommit:!0},s=await Va._makeGenesis(t,r,n);return await t.createStreamFromGenesis(Va.STREAM_TYPE_ID,s,a)}static assertComplete(t,r){if(!t.name)throw r?new Error(`Model with StreamID ${r.toString()} is missing a 'name' field`):new Error("Model is missing a 'name' field");if(!t.schema)throw r?new Error(`Model ${t.name} (${r.toString()}) is missing a 'schema' field`):new Error(`Model ${t.name} is missing a 'schema' field`);if(!t.accountRelation)throw r?new Error(`Model ${t.name} (${r.toString()}) is missing a 'accountRelation' field`):new Error(`Model ${t.name} is missing a 'accountRelation' field`)}static async load(t,r,n={}){n={...cV,...n};let a=Cs.from(r);if(a.type!=Va.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${Va.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return await t.loadStream(a,n)}static async _makeGenesis(t,r,n){let a=await this._makeRawGenesis(t,r,n);return Va._signDagJWS(t,a)}static async _makeRawGenesis(t,r,n){if(r==null)throw new Error("Genesis content cannot be null");if(!n||!n.controller)if(t.did)await S6(t),n={controller:t.did.hasParent?t.did.parent:t.did.id};else throw new Error("No controller specified");let a={controllers:[n.controller],model:Va.MODEL.bytes};return{data:r,header:a}}makeReadOnly(){this.sync=yD,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await S6(t),t.did.createDagJWS(r)}},"Model2"),"Model");Bc.STREAM_TYPE_NAME="model";Bc.STREAM_TYPE_ID=2;Bc.MODEL=function(){let e=Qm("model-v1"),t=oV.default.encode(e,"identity"),r=tl(hm,t),n=Vt.createV1(hm,r);return new Xt("UNLOADABLE",n)}();Bc=Va=sV([h1()],Bc);var uV=ir(El(),1),lV=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate6"),fa,fV={anchor:!0,publish:!0,pin:!0,sync:ni.NEVER_SYNC,syncTimeoutSeconds:0},dV={anchor:!1,publish:!1,pin:!0,sync:ni.PREFER_CACHE},hV={sync:ni.PREFER_CACHE},KS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};async function x6(e){if(e.did==null)throw new Error("No DID provided");e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`))}i(x6,"_ensureAuthenticated2");o(x6,"_ensureAuthenticated");async function im(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(im,"throwReadOnlyError4");o(im,"throwReadOnlyError");var ol=fa=o(i(class extends d1{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let t=this.state$.value.metadata;return{controller:t.controllers[0],model:t.model}}static async create(t,r,n,a={}){a={...fV,...a};let s=a.asDID?{did:a.asDID}:t,c=await fa._makeGenesis(s,r,n);return t.createStreamFromGenesis(fa.STREAM_TYPE_ID,c,a)}static async single(t,r,n={}){n={...dV,...n};let a=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let s=await fa._makeGenesis(a,null,r);return t.createStreamFromGenesis(fa.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...hV,...n};let a=Cs.from(r);if(a.type!=fa.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${fa.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}async replace(t,r={}){r={...KS,...r};let n=r.asDID?{did:r.asDID}:this.api,a=await this._makeCommit(n,t),s=await this.api.applyCommit(this.id,a,r);this.state$.next(s.state)}async patch(t,r={}){r={...KS,...r};let n={data:t,prev:this.tip,id:this.id.cid},a=await fa._signDagJWS(this.api,n),s=await this.api.applyCommit(this.id,a,r);this.state$.next(s.state)}makeReadOnly(){this.replace=im,this.patch=im,this.sync=im,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(t,r){let n=this._makeRawCommit(r);return fa._signDagJWS(t,n)}_makeRawCommit(t){return{data:WI.compare(this.content,t||{}),prev:this.tip,id:this.state.log[0].cid}}static async _makeGenesis(t,r,n){let a=await this._makeRawGenesis(t,r,n);return n.deterministic?(Qm(a),a):fa._signDagJWS(t,a)}static async _makeRawGenesis(t,r,n){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");let a=n.controller;if(!a)if(t.did)await x6(t),a=t.did.hasParent?t.did.parent:t.did.id;else throw new Error("No controller specified");let s={controllers:[a],model:n.model.bytes};return n.deterministic||(s.unique=(0,uV.randomBytes)(12)),{data:r,header:s}}static async _signDagJWS(t,r){return await x6(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");ol.STREAM_TYPE_NAME="MID";ol.STREAM_TYPE_ID=3;ol=fa=lV([h1()],ol);var bD=i(class{constructor(e){this._apiUrl=e}async add(e,t){let r={};t&&(r.force=!0);let n=new URL(`./pins/${e}`,this._apiUrl);await Ai(n,{method:"post",body:r})}async rm(e,t){let r=new URL(`./pins/${e}`,this._apiUrl);await Ai(r,{method:"delete",body:{opts:t}})}async ls(e){let t=new URL("./pins",this._apiUrl);e&&(t=new URL(`./pins/${e.toString()}`,this._apiUrl));let r=await Ai(t),{pinnedStreamIds:n}=r;return{[Symbol.asyncIterator](){let a=0;return{next(){return a===n.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:n[a++],done:!1})}}}}}},"RemotePinApi");o(bD,"RemotePinApi");var wD=i(class{constructor(e){this._fetchJson=Ai,this._collectionURL=new URL("./collection",e),this._countURL=new URL("./collection/count",e)}async count(e){return(await this._fetchJson(this._countURL,{method:"POST",body:E6(e)})).count}async query(e){let t=await this._fetchJson(this._collectionURL,{method:"POST",body:E6(e)});return{edges:t.edges.map(n=>({cursor:n.cursor,node:Hr.deserializeState(n.node)})),pageInfo:t.pageInfo}}},"RemoteIndexApi");o(wD,"RemoteIndexApi");var _D=i(class{constructor(e,t){this._apiUrl=e,this._getDidFn=t,this._fetchJson=Ai,this.modelsPath="./admin/models",this.getCodePath="./admin/getCode"}getCodeUrl(){return new URL(this.getCodePath,this._apiUrl)}getModelsUrl(){return new URL(this.modelsPath,this._apiUrl)}async buildJWS(e,t,r){let n=r?{models:r.map(s=>s.toString())}:void 0,a=await e.createJWS({code:t,requestPath:this.getModelsUrl().pathname,requestBody:n});return`${a.signatures[0].protected}.${a.payload}.${a.signatures[0].signature}`}async generateCode(){return(await this._fetchJson(this.getCodeUrl())).code}async startIndexingModels(e){let t=await this.generateCode();await this._fetchJson(this.getModelsUrl(),{method:"post",body:{jws:await this.buildJWS(this._getDidFn(),t,e)}})}async getIndexedModels(){let e=await this.generateCode();return(await this._fetchJson(this.getModelsUrl(),{headers:{Authorization:`Basic ${await this.buildJWS(this._getDidFn(),e)}`}})).models.map(r=>Xt.fromString(r))}async stopIndexingModels(e){let t=await this.generateCode();await this._fetchJson(this.getModelsUrl(),{method:"delete",body:{jws:await this.buildJWS(this._getDidFn(),t,e)}})}},"RemoteAdminApi");o(_D,"RemoteAdminApi");var pV="/api/v0/",mV="http://localhost:7007",gV={syncInterval:5e3},vV={anchor:!0,publish:!0,sync:ni.PREFER_CACHE},yV={anchor:!0,publish:!0,sync:ni.PREFER_CACHE},GS={sync:ni.PREFER_CACHE},bV=i(class{constructor(e=mV,t={}){this._config={...gV,...t},this._apiUrl=new URL(pV,e),this._streamCache=new Map,this.context={api:this},this.pin=new bD(this._apiUrl),this.index=new wD(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new _D(this._apiUrl,r),this._streamConstructors={[al.STREAM_TYPE_ID]:al,[Bc.STREAM_TYPE_ID]:Bc,[ol.STREAM_TYPE_ID]:ol,[Bo.STREAM_TYPE_ID]:Bo}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...yV,...r};let n=await Ki.createFromGenesis(this._apiUrl,e,t,r,this._config.syncInterval),a=this._streamCache.get(n.id.toString());return a?(Hr.statesEqual(n.state,a.state)||a.next(n.state),this.buildStreamFromDocument(a)):(this._streamCache.set(n.id.toString(),n),this.buildStreamFromDocument(n))}async loadStream(e,t={}){t={...GS,...t};let r=Cs.from(e),n=this._streamCache.get(r.baseID.toString());return n?await n._syncState(r,t):(n=await Ki.load(r,this._apiUrl,this._config.syncInterval,t),this._streamCache.set(n.id.toString(),n)),this.buildStreamFromDocument(n)}async multiQuery(e,t){let r=e.map(s=>({...s,streamId:typeof s.streamId=="string"?s.streamId:s.streamId.toString()})),n=new URL("./multiqueries",this._apiUrl),a=await Ai(n,{method:"post",body:{queries:r,timeout:t}});return Object.entries(a).reduce((s,c)=>{let[l,d]=c,p=Hr.deserializeState(d),g=new Ki(p,this._apiUrl,this._config.syncInterval);return s[l]=this.buildStreamFromDocument(g),s},{})}loadStreamCommits(e){let t=_6(e);return Ki.loadStreamCommits(t,this._apiUrl)}async applyCommit(e,t,r={}){r={...vV,...r};let n=_6(e),a=await Ki.applyCommit(this._apiUrl,n,t,r,this._config.syncInterval),s=this._streamCache.get(n.toString());return s?(s.next(a.state),this.buildStreamFromDocument(a)):(this._streamCache.set(n.toString(),a),this.buildStreamFromDocument(a))}async requestAnchor(e,t={}){t={...GS,...t};let{anchorStatus:r}=await Ai(`${this._apiUrl}/streams/${e.toString()}/anchor`,{method:"post",body:{opts:t}});return r}addStreamHandler(e){this._streamConstructors[e.name]=e.stream_constructor}buildStreamFromState(e){let t=new Ki(e,this._apiUrl,this._config.syncInterval);return this.buildStreamFromDocument(t)}buildStreamFromDocument(e){let t=e.state.type,r=this._streamConstructors[t];if(!r)throw new Error(`Failed to find constructor for stream ${t}`);return new r(e,this.context)}async setDID(e){this.context.did=e}async getSupportedChains(){if(this._supportedChains)return this._supportedChains;let{supportedChains:e}=await Ai(this._apiUrl+"/node/chains");return this._supportedChains=e,e}async close(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()}},"CeramicClient");o(bV,"CeramicClient");var nr;(function(e){e.assertEqual=a=>a;function t(a){}i(t,"assertIs"),o(t,"assertIs"),e.assertIs=t;function r(a){throw new Error}i(r,"assertNever"),o(r,"assertNever"),e.assertNever=r,e.arrayToEnum=a=>{let s={};for(let c of a)s[c]=c;return s},e.getValidEnumValues=a=>{let s=e.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),c={};for(let l of s)c[l]=a[l];return e.objectValues(c)},e.objectValues=a=>e.objectKeys(a).map(function(s){return a[s]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&s.push(c);return s},e.find=(a,s)=>{for(let c of a)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),o(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(nr||(nr={}));var T6;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(T6||(T6={}));var it=nr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ws=o(e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:e===null?it.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?it.promise:typeof Map<"u"&&e instanceof Map?it.map:typeof Set<"u"&&e instanceof Set?it.set:typeof Date<"u"&&e instanceof Date?it.date:it.object;default:return it.unknown}},"getParsedType"),Ve=nr.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),wV=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Si=i(class extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},r={_errors:[]},n=o(a=>{for(let s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let c=r,l=0;for(;l<s.path.length;){let d=s.path[l];l===s.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(s))):c[d]=c[d]||{_errors:[]},c=c[d],l++}}},"processError");return n(this),r}static assert(e){if(!(e instanceof Si))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,nr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}},"ZodError");o(Si,"ZodError");Si.create=e=>new Si(e);var sl=o((e,t)=>{let r;switch(e.code){case Ve.invalid_type:e.received===it.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ve.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,nr.jsonStringifyReplacer)}`;break;case Ve.unrecognized_keys:r=`Unrecognized key(s) in object: ${nr.joinValues(e.keys,", ")}`;break;case Ve.invalid_union:r="Invalid input";break;case Ve.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${nr.joinValues(e.options)}`;break;case Ve.invalid_enum_value:r=`Invalid enum value. Expected ${nr.joinValues(e.options)}, received '${e.received}'`;break;case Ve.invalid_arguments:r="Invalid function arguments";break;case Ve.invalid_return_type:r="Invalid function return type";break;case Ve.invalid_date:r="Invalid date";break;case Ve.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:nr.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Ve.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Ve.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Ve.custom:r="Invalid input";break;case Ve.invalid_intersection_types:r="Intersection results could not be merged";break;case Ve.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ve.not_finite:r="Number must be finite";break;default:r=t.defaultError,nr.assertNever(e)}return{message:r}},"errorMap"),ED=sl;function AD(e){ED=e}i(AD,"setErrorMap");o(AD,"setErrorMap");function Rd(){return ED}i(Rd,"getErrorMap");o(Rd,"getErrorMap");var km=o(e=>{let{data:t,path:r,errorMaps:n,issueData:a}=e,s=[...r,...a.path||[]],c={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let l="",d=n.filter(p=>!!p).slice().reverse();for(let p of d)l=p(c,{data:t,defaultError:l}).message;return{...a,path:s,message:l}},"makeIssue"),_V=[];function Qe(e,t){let r=Rd(),n=km({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===sl?void 0:sl].filter(a=>!!a)});e.common.issues.push(n)}i(Qe,"addIssueToContext");o(Qe,"addIssueToContext");var xn=i(class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return kt;n.status==="dirty"&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let a=await n.key,s=await n.value;r.push({key:a,value:s})}return xn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:a,value:s}=n;if(a.status==="aborted"||s.status==="aborted")return kt;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(r[a.value]=s.value)}return{status:e.value,value:r}}},"ParseStatus");o(xn,"ParseStatus");var kt=Object.freeze({status:"aborted"}),Ju=o(e=>({status:"dirty",value:e}),"DIRTY"),Un=o(e=>({status:"valid",value:e}),"OK"),C6=o(e=>e.status==="aborted","isAborted"),M6=o(e=>e.status==="dirty","isDirty"),Od=o(e=>e.status==="valid","isValid"),Nd=o(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");function Pd(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}i(Pd,"__classPrivateFieldGet2");o(Pd,"__classPrivateFieldGet");function u2(e,t,r,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(e,r):a?a.value=r:t.set(e,r),r}i(u2,"__classPrivateFieldSet2");o(u2,"__classPrivateFieldSet");var wt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(wt||(wt={}));var md,gd,Ea=i(class{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},"ParseInputLazyPath");o(Ea,"ParseInputLazyPath");var WS=o((e,t)=>{if(Od(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Si(e.common.issues);return this._error=r,this._error}}},"handleResult");function Ut(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:o((c,l)=>{var d,p;let{message:g}=e;return c.code==="invalid_enum_value"?{message:g??l.defaultError}:typeof l.data>"u"?{message:(d=g??n)!==null&&d!==void 0?d:l.defaultError}:c.code!=="invalid_type"?{message:l.defaultError}:{message:(p=g??r)!==null&&p!==void 0?p:l.defaultError}},"customMap"),description:a}}i(Ut,"processCreateParams");o(Ut,"processCreateParams");var zt=i(class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return ws(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ws(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xn,ctx:{common:e.parent.common,data:e.data,parsedType:ws(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Nd(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:(r=t?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ws(e)},a=this._parseSync({data:e,path:n.path,parent:n});return WS(n,a)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ws(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(Nd(n)?n:Promise.resolve(n));return WS(r,a)}refine(e,t){let r=o(n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t,"getIssueProperties");return this._refinement((n,a)=>{let s=e(n),c=o(()=>a.addIssue({code:Ve.custom,...r(n)}),"setError");return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(c(),!1)):s?!0:(c(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new Wi({schema:this,typeName:Mt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return wa.create(this,this._def)}nullable(){return Lo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ba.create(this,this._def)}promise(){return jc.create(this,this._def)}or(e){return fl.create([this,e],this._def)}and(e){return dl.create(this,e,this._def)}transform(e){return new Wi({...Ut(this._def),schema:this,typeName:Mt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new gl({...Ut(this._def),innerType:this,defaultValue:t,typeName:Mt.ZodDefault})}brand(){return new m1({typeName:Mt.ZodBranded,type:this,...Ut(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new vl({...Ut(this._def),innerType:this,catchValue:t,typeName:Mt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ih.create(this,e)}readonly(){return yl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},"ZodType");o(zt,"ZodType");var EV=/^c[^\s-]{8,}$/i,AV=/^[0-9a-z]+$/,SV=/^[0-9A-HJKMNP-TV-Z]{26}$/,xV=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,TV=/^[a-z0-9_-]{21}$/i,CV=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,MV=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,IV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Db,kV=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,DV=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,RV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,SD="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",OV=new RegExp(`^${SD}$`);function l2(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}i(l2,"timeRegexSource");o(l2,"timeRegexSource");function xD(e){return new RegExp(`^${l2(e)}$`)}i(xD,"timeRegex");o(xD,"timeRegex");function f2(e){let t=`${SD}T${l2(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}i(f2,"datetimeRegex");o(f2,"datetimeRegex");function TD(e,t){return!!((t==="v4"||!t)&&kV.test(e)||(t==="v6"||!t)&&DV.test(e))}i(TD,"isValidIP");o(TD,"isValidIP");var va=i(class extends zt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==it.string){let a=this._getOrReturnCtx(e);return Qe(a,{code:Ve.invalid_type,expected:it.string,received:a.parsedType}),kt}let r=new xn,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let s=e.data.length>a.value,c=e.data.length<a.value;(s||c)&&(n=this._getOrReturnCtx(e,n),s?Qe(n,{code:Ve.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&Qe(n,{code:Ve.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")MV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"email",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Db||(Db=new RegExp(IV,"u")),Db.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"emoji",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")xV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"uuid",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")TV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"nanoid",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")EV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"cuid",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")AV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"cuid2",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")SV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"ulid",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),Qe(n,{validation:"url",code:Ve.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"regex",code:Ve.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?f2(a).test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?OV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?xD(a).test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?CV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"duration",code:Ve.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?TD(e.data,a.version)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"ip",code:Ve.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?RV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"base64",code:Ve.invalid_string,message:a.message}),r.dirty()):nr.assertNever(a);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(n=>e.test(n),{validation:t,code:Ve.invalid_string,...wt.errToObj(r)})}_addCheck(e){return new va({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...wt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...wt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...wt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...wt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...wt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...wt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...wt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...wt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...wt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...wt.errToObj(e)})}datetime(e){var t,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(r=e?.local)!==null&&r!==void 0?r:!1,...wt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...wt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...wt.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...wt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...wt.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...wt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...wt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...wt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...wt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...wt.errToObj(t)})}nonempty(e){return this.min(1,wt.errToObj(e))}trim(){return new va({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new va({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new va({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}},"ZodString");o(va,"ZodString");va.create=e=>{var t;return new va({checks:[],typeName:Mt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Ut(e)})};function CD(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(e.toFixed(a).replace(".","")),c=parseInt(t.toFixed(a).replace(".",""));return s%c/Math.pow(10,a)}i(CD,"floatSafeRemainder");o(CD,"floatSafeRemainder");var Is=i(class extends zt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==it.number){let a=this._getOrReturnCtx(e);return Qe(a,{code:Ve.invalid_type,expected:it.number,received:a.parsedType}),kt}let r,n=new xn;for(let a of this._def.checks)a.kind==="int"?nr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?CD(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.not_finite,message:a.message}),n.dirty()):nr.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,wt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,wt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,wt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,wt.toString(t))}setLimit(e,t,r,n){return new Is({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:wt.toString(n)}]})}_addCheck(e){return new Is({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:wt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:wt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:wt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:wt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:wt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:wt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:wt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:wt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:wt.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&nr.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}},"ZodNumber");o(Is,"ZodNumber");Is.create=e=>new Is({checks:[],typeName:Mt.ZodNumber,coerce:e?.coerce||!1,...Ut(e)});var ks=i(class extends zt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==it.bigint){let a=this._getOrReturnCtx(e);return Qe(a,{code:Ve.invalid_type,expected:it.bigint,received:a.parsedType}),kt}let r,n=new xn;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):nr.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,wt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,wt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,wt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,wt.toString(t))}setLimit(e,t,r,n){return new ks({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:wt.toString(n)}]})}_addCheck(e){return new ks({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:wt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:wt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:wt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:wt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:wt.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}},"ZodBigInt");o(ks,"ZodBigInt");ks.create=e=>{var t;return new ks({checks:[],typeName:Mt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Ut(e)})};var cl=i(class extends zt{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==it.boolean){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.boolean,received:r.parsedType}),kt}return Un(e.data)}},"ZodBoolean");o(cl,"ZodBoolean");cl.create=e=>new cl({typeName:Mt.ZodBoolean,coerce:e?.coerce||!1,...Ut(e)});var Lc=i(class extends zt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==it.date){let a=this._getOrReturnCtx(e);return Qe(a,{code:Ve.invalid_type,expected:it.date,received:a.parsedType}),kt}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return Qe(a,{code:Ve.invalid_date}),kt}let r=new xn,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):nr.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Lc({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:wt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:wt.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}},"ZodDate");o(Lc,"ZodDate");Lc.create=e=>new Lc({checks:[],coerce:e?.coerce||!1,typeName:Mt.ZodDate,...Ut(e)});var Bd=i(class extends zt{_parse(e){if(this._getType(e)!==it.symbol){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.symbol,received:r.parsedType}),kt}return Un(e.data)}},"ZodSymbol");o(Bd,"ZodSymbol");Bd.create=e=>new Bd({typeName:Mt.ZodSymbol,...Ut(e)});var ul=i(class extends zt{_parse(e){if(this._getType(e)!==it.undefined){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.undefined,received:r.parsedType}),kt}return Un(e.data)}},"ZodUndefined");o(ul,"ZodUndefined");ul.create=e=>new ul({typeName:Mt.ZodUndefined,...Ut(e)});var ll=i(class extends zt{_parse(e){if(this._getType(e)!==it.null){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.null,received:r.parsedType}),kt}return Un(e.data)}},"ZodNull");o(ll,"ZodNull");ll.create=e=>new ll({typeName:Mt.ZodNull,...Ut(e)});var Uc=i(class extends zt{constructor(){super(...arguments),this._any=!0}_parse(e){return Un(e.data)}},"ZodAny");o(Uc,"ZodAny");Uc.create=e=>new Uc({typeName:Mt.ZodAny,...Ut(e)});var Es=i(class extends zt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Un(e.data)}},"ZodUnknown");o(Es,"ZodUnknown");Es.create=e=>new Es({typeName:Mt.ZodUnknown,...Ut(e)});var Ka=i(class extends zt{_parse(e){let t=this._getOrReturnCtx(e);return Qe(t,{code:Ve.invalid_type,expected:it.never,received:t.parsedType}),kt}},"ZodNever");o(Ka,"ZodNever");Ka.create=e=>new Ka({typeName:Mt.ZodNever,...Ut(e)});var Ld=i(class extends zt{_parse(e){if(this._getType(e)!==it.undefined){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.void,received:r.parsedType}),kt}return Un(e.data)}},"ZodVoid");o(Ld,"ZodVoid");Ld.create=e=>new Ld({typeName:Mt.ZodVoid,...Ut(e)});var ba=i(class extends zt{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==it.array)return Qe(t,{code:Ve.invalid_type,expected:it.array,received:t.parsedType}),kt;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,c=t.data.length<n.exactLength.value;(s||c)&&(Qe(t,{code:s?Ve.too_big:Ve.too_small,minimum:c?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(Qe(t,{code:Ve.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(Qe(t,{code:Ve.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((s,c)=>n.type._parseAsync(new Ea(t,s,t.path,c)))).then(s=>xn.mergeArray(r,s));let a=[...t.data].map((s,c)=>n.type._parseSync(new Ea(t,s,t.path,c)));return xn.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new ba({...this._def,minLength:{value:e,message:wt.toString(t)}})}max(e,t){return new ba({...this._def,maxLength:{value:e,message:wt.toString(t)}})}length(e,t){return new ba({...this._def,exactLength:{value:e,message:wt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");o(ba,"ZodArray");ba.create=(e,t)=>new ba({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Mt.ZodArray,...Ut(t)});function Cc(e){if(e instanceof Rr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=wa.create(Cc(n))}return new Rr({...e._def,shape:()=>t})}else return e instanceof ba?new ba({...e._def,type:Cc(e.element)}):e instanceof wa?wa.create(Cc(e.unwrap())):e instanceof Lo?Lo.create(Cc(e.unwrap())):e instanceof Ga?Ga.create(e.items.map(t=>Cc(t))):e}i(Cc,"deepPartialify");o(Cc,"deepPartialify");var Rr=i(class extends zt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=nr.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){let d=this._getOrReturnCtx(e);return Qe(d,{code:Ve.invalid_type,expected:it.object,received:d.parsedType}),kt}let{status:r,ctx:n}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof Ka&&this._def.unknownKeys==="strip"))for(let d in n.data)s.includes(d)||c.push(d);let l=[];for(let d of s){let p=a[d],g=n.data[d];l.push({key:{status:"valid",value:d},value:p._parse(new Ea(n,g,n.path,d)),alwaysSet:d in n.data})}if(this._def.catchall instanceof Ka){let d=this._def.unknownKeys;if(d==="passthrough")for(let p of c)l.push({key:{status:"valid",value:p},value:{status:"valid",value:n.data[p]}});else if(d==="strict")c.length>0&&(Qe(n,{code:Ve.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let p of c){let g=n.data[p];l.push({key:{status:"valid",value:p},value:d._parse(new Ea(n,g,n.path,p)),alwaysSet:p in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let d=[];for(let p of l){let g=await p.key,v=await p.value;d.push({key:g,value:v,alwaysSet:p.alwaysSet})}return d}).then(d=>xn.mergeObjectSync(r,d)):xn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return wt.errToObj,new Rr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,a,s,c;let l=(s=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,r).message)!==null&&s!==void 0?s:r.defaultError;return t.code==="unrecognized_keys"?{message:(c=wt.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Rr({...this._def,unknownKeys:"strip"})}passthrough(){return new Rr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Rr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Rr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Mt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Rr({...this._def,catchall:e})}pick(e){let t={};return nr.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new Rr({...this._def,shape:()=>t})}omit(e){let t={};return nr.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new Rr({...this._def,shape:()=>t})}deepPartial(){return Cc(this)}partial(e){let t={};return nr.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}),new Rr({...this._def,shape:()=>t})}required(e){let t={};return nr.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof wa;)a=a._def.innerType;t[r]=a}}),new Rr({...this._def,shape:()=>t})}keyof(){return d2(nr.objectKeys(this.shape))}},"ZodObject");o(Rr,"ZodObject");Rr.create=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strip",catchall:Ka.create(),typeName:Mt.ZodObject,...Ut(t)});Rr.strictCreate=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strict",catchall:Ka.create(),typeName:Mt.ZodObject,...Ut(t)});Rr.lazycreate=(e,t)=>new Rr({shape:e,unknownKeys:"strip",catchall:Ka.create(),typeName:Mt.ZodObject,...Ut(t)});var fl=i(class extends zt{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(a){for(let c of a)if(c.result.status==="valid")return c.result;for(let c of a)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let s=a.map(c=>new Si(c.ctx.common.issues));return Qe(t,{code:Ve.invalid_union,unionErrors:s}),kt}if(i(n,"handleResults"),o(n,"handleResults"),t.common.async)return Promise.all(r.map(async a=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);{let a,s=[];for(let l of r){let d={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let c=s.map(l=>new Si(l));return Qe(t,{code:Ve.invalid_union,unionErrors:c}),kt}}get options(){return this._def.options}},"ZodUnion");o(fl,"ZodUnion");fl.create=(e,t)=>new fl({options:e,typeName:Mt.ZodUnion,...Ut(t)});var ko=o(e=>e instanceof hl?ko(e.schema):e instanceof Wi?ko(e.innerType()):e instanceof pl?[e.value]:e instanceof Ds?e.options:e instanceof ml?nr.objectValues(e.enum):e instanceof gl?ko(e._def.innerType):e instanceof ul?[void 0]:e instanceof ll?[null]:e instanceof wa?[void 0,...ko(e.unwrap())]:e instanceof Lo?[null,...ko(e.unwrap())]:e instanceof m1||e instanceof yl?ko(e.unwrap()):e instanceof vl?ko(e._def.innerType):[],"getDiscriminator"),p1=i(class extends zt{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return Qe(t,{code:Ve.invalid_type,expected:it.object,received:t.parsedType}),kt;let r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(Qe(t,{code:Ve.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),kt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let a of t){let s=ko(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of s){if(n.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);n.set(c,a)}}return new p1({typeName:Mt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...Ut(r)})}},"ZodDiscriminatedUnion");o(p1,"ZodDiscriminatedUnion");function Dm(e,t){let r=ws(e),n=ws(t);if(e===t)return{valid:!0,data:e};if(r===it.object&&n===it.object){let a=nr.objectKeys(t),s=nr.objectKeys(e).filter(l=>a.indexOf(l)!==-1),c={...e,...t};for(let l of s){let d=Dm(e[l],t[l]);if(!d.valid)return{valid:!1};c[l]=d.data}return{valid:!0,data:c}}else if(r===it.array&&n===it.array){if(e.length!==t.length)return{valid:!1};let a=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],d=Dm(c,l);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return r===it.date&&n===it.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Dm,"mergeValues");o(Dm,"mergeValues");var dl=i(class extends zt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=o((a,s)=>{if(C6(a)||C6(s))return kt;let c=Dm(a.value,s.value);return c.valid?((M6(a)||M6(s))&&t.dirty(),{status:t.value,value:c.data}):(Qe(r,{code:Ve.invalid_intersection_types}),kt)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,s])=>n(a,s)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}},"ZodIntersection");o(dl,"ZodIntersection");dl.create=(e,t,r)=>new dl({left:e,right:t,typeName:Mt.ZodIntersection,...Ut(r)});var Ga=i(class extends zt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==it.array)return Qe(r,{code:Ve.invalid_type,expected:it.array,received:r.parsedType}),kt;if(r.data.length<this._def.items.length)return Qe(r,{code:Ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),kt;!this._def.rest&&r.data.length>this._def.items.length&&(Qe(r,{code:Ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((s,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new Ea(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(a).then(s=>xn.mergeArray(t,s)):xn.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Ga({...this._def,rest:e})}},"ZodTuple");o(Ga,"ZodTuple");Ga.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ga({items:e,typeName:Mt.ZodTuple,rest:null,...Ut(t)})};var Ud=i(class extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==it.object)return Qe(r,{code:Ve.invalid_type,expected:it.object,received:r.parsedType}),kt;let n=[],a=this._def.keyType,s=this._def.valueType;for(let c in r.data)n.push({key:a._parse(new Ea(r,c,r.path,c)),value:s._parse(new Ea(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?xn.mergeObjectAsync(t,n):xn.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof zt?new Ud({keyType:e,valueType:t,typeName:Mt.ZodRecord,...Ut(r)}):new Ud({keyType:va.create(),valueType:e,typeName:Mt.ZodRecord,...Ut(t)})}},"ZodRecord");o(Ud,"ZodRecord");var Fd=i(class extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==it.map)return Qe(r,{code:Ve.invalid_type,expected:it.map,received:r.parsedType}),kt;let n=this._def.keyType,a=this._def.valueType,s=[...r.data.entries()].map(([c,l],d)=>({key:n._parse(new Ea(r,c,r.path,[d,"key"])),value:a._parse(new Ea(r,l,r.path,[d,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of s){let d=await l.key,p=await l.value;if(d.status==="aborted"||p.status==="aborted")return kt;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(d.value,p.value)}return{status:t.value,value:c}})}else{let c=new Map;for(let l of s){let d=l.key,p=l.value;if(d.status==="aborted"||p.status==="aborted")return kt;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(d.value,p.value)}return{status:t.value,value:c}}}},"ZodMap");o(Fd,"ZodMap");Fd.create=(e,t,r)=>new Fd({valueType:t,keyType:e,typeName:Mt.ZodMap,...Ut(r)});var Fc=i(class extends zt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==it.set)return Qe(r,{code:Ve.invalid_type,expected:it.set,received:r.parsedType}),kt;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(Qe(r,{code:Ve.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&(Qe(r,{code:Ve.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function s(l){let d=new Set;for(let p of l){if(p.status==="aborted")return kt;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}i(s,"finalizeSet"),o(s,"finalizeSet");let c=[...r.data.values()].map((l,d)=>a._parse(new Ea(r,l,r.path,d)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,t){return new Fc({...this._def,minSize:{value:e,message:wt.toString(t)}})}max(e,t){return new Fc({...this._def,maxSize:{value:e,message:wt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}},"ZodSet");o(Fc,"ZodSet");Fc.create=(e,t)=>new Fc({valueType:e,minSize:null,maxSize:null,typeName:Mt.ZodSet,...Ut(t)});var Xu=i(class extends zt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return Qe(t,{code:Ve.invalid_type,expected:it.function,received:t.parsedType}),kt;function r(c,l){return km({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rd(),sl].filter(d=>!!d),issueData:{code:Ve.invalid_arguments,argumentsError:l}})}i(r,"makeArgsIssue"),o(r,"makeArgsIssue");function n(c,l){return km({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rd(),sl].filter(d=>!!d),issueData:{code:Ve.invalid_return_type,returnTypeError:l}})}i(n,"makeReturnsIssue"),o(n,"makeReturnsIssue");let a={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof jc){let c=this;return Un(async function(...l){let d=new Si([]),p=await c._def.args.parseAsync(l,a).catch(y=>{throw d.addIssue(r(l,y)),d}),g=await Reflect.apply(s,this,p);return await c._def.returns._def.type.parseAsync(g,a).catch(y=>{throw d.addIssue(n(g,y)),d})})}else{let c=this;return Un(function(...l){let d=c._def.args.safeParse(l,a);if(!d.success)throw new Si([r(l,d.error)]);let p=Reflect.apply(s,this,d.data),g=c._def.returns.safeParse(p,a);if(!g.success)throw new Si([n(p,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Xu({...this._def,args:Ga.create(e).rest(Es.create())})}returns(e){return new Xu({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Xu({args:e||Ga.create([]).rest(Es.create()),returns:t||Es.create(),typeName:Mt.ZodFunction,...Ut(r)})}},"ZodFunction");o(Xu,"ZodFunction");var hl=i(class extends zt{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})}},"ZodLazy");o(hl,"ZodLazy");hl.create=(e,t)=>new hl({getter:e,typeName:Mt.ZodLazy,...Ut(t)});var pl=i(class extends zt{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Qe(t,{received:t.data,code:Ve.invalid_literal,expected:this._def.value}),kt}return{status:"valid",value:e.data}}get value(){return this._def.value}},"ZodLiteral");o(pl,"ZodLiteral");pl.create=(e,t)=>new pl({value:e,typeName:Mt.ZodLiteral,...Ut(t)});function d2(e,t){return new Ds({values:e,typeName:Mt.ZodEnum,...Ut(t)})}i(d2,"createZodEnum");o(d2,"createZodEnum");var Ds=i(class extends zt{constructor(){super(...arguments),md.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return Qe(t,{expected:nr.joinValues(r),received:t.parsedType,code:Ve.invalid_type}),kt}if(Pd(this,md,"f")||u2(this,md,new Set(this._def.values),"f"),!Pd(this,md,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return Qe(t,{received:t.data,code:Ve.invalid_enum_value,options:r}),kt}return Un(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ds.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ds.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}},"ZodEnum");o(Ds,"ZodEnum");md=new WeakMap;Ds.create=d2;var ml=i(class extends zt{constructor(){super(...arguments),gd.set(this,void 0)}_parse(e){let t=nr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==it.string&&r.parsedType!==it.number){let n=nr.objectValues(t);return Qe(r,{expected:nr.joinValues(n),received:r.parsedType,code:Ve.invalid_type}),kt}if(Pd(this,gd,"f")||u2(this,gd,new Set(nr.getValidEnumValues(this._def.values)),"f"),!Pd(this,gd,"f").has(e.data)){let n=nr.objectValues(t);return Qe(r,{received:r.data,code:Ve.invalid_enum_value,options:n}),kt}return Un(e.data)}get enum(){return this._def.values}},"ZodNativeEnum");o(ml,"ZodNativeEnum");gd=new WeakMap;ml.create=(e,t)=>new ml({values:e,typeName:Mt.ZodNativeEnum,...Ut(t)});var jc=i(class extends zt{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&t.common.async===!1)return Qe(t,{code:Ve.invalid_type,expected:it.promise,received:t.parsedType}),kt;let r=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return Un(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}},"ZodPromise");o(jc,"ZodPromise");jc.create=(e,t)=>new jc({type:e,typeName:Mt.ZodPromise,...Ut(t)});var Wi=i(class extends zt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Mt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:s=>{Qe(r,s),s.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let s=n.transform(r.data,a);if(r.common.async)return Promise.resolve(s).then(async c=>{if(t.value==="aborted")return kt;let l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?kt:l.status==="dirty"||t.value==="dirty"?Ju(l.value):l});{if(t.value==="aborted")return kt;let c=this._def.schema._parseSync({data:s,path:r.path,parent:r});return c.status==="aborted"?kt:c.status==="dirty"||t.value==="dirty"?Ju(c.value):c}}if(n.type==="refinement"){let s=o(c=>{let l=n.refinement(c,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c},"executeRefinement");if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?kt:(c.status==="dirty"&&t.dirty(),s(c.value),{status:t.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?kt:(c.status==="dirty"&&t.dirty(),s(c.value).then(()=>({status:t.value,value:c.value}))))}if(n.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Od(s))return s;let c=n.transform(s.value,a);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Od(s)?Promise.resolve(n.transform(s.value,a)).then(c=>({status:t.value,value:c})):s);nr.assertNever(n)}},"ZodEffects");o(Wi,"ZodEffects");Wi.create=(e,t,r)=>new Wi({schema:e,typeName:Mt.ZodEffects,effect:t,...Ut(r)});Wi.createWithPreprocess=(e,t,r)=>new Wi({schema:t,effect:{type:"preprocess",transform:e},typeName:Mt.ZodEffects,...Ut(r)});var wa=i(class extends zt{_parse(e){return this._getType(e)===it.undefined?Un(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodOptional");o(wa,"ZodOptional");wa.create=(e,t)=>new wa({innerType:e,typeName:Mt.ZodOptional,...Ut(t)});var Lo=i(class extends zt{_parse(e){return this._getType(e)===it.null?Un(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodNullable");o(Lo,"ZodNullable");Lo.create=(e,t)=>new Lo({innerType:e,typeName:Mt.ZodNullable,...Ut(t)});var gl=i(class extends zt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===it.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}},"ZodDefault");o(gl,"ZodDefault");gl.create=(e,t)=>new gl({innerType:e,typeName:Mt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ut(t)});var vl=i(class extends zt{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Nd(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Si(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Si(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}},"ZodCatch");o(vl,"ZodCatch");vl.create=(e,t)=>new vl({innerType:e,typeName:Mt.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ut(t)});var jd=i(class extends zt{_parse(e){if(this._getType(e)!==it.nan){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.nan,received:r.parsedType}),kt}return{status:"valid",value:e.data}}},"ZodNaN");o(jd,"ZodNaN");jd.create=e=>new jd({typeName:Mt.ZodNaN,...Ut(e)});var NV=Symbol("zod_brand"),m1=i(class extends zt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},"ZodBranded");o(m1,"ZodBranded");var ih=i(class extends zt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return o(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?kt:a.status==="dirty"?(t.dirty(),Ju(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})},"handleAsync")();{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?kt:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new ih({in:e,out:t,typeName:Mt.ZodPipeline})}},"ZodPipeline");o(ih,"ZodPipeline");var yl=i(class extends zt{_parse(e){let t=this._def.innerType._parse(e),r=o(n=>(Od(n)&&(n.value=Object.freeze(n.value)),n),"freeze");return Nd(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}},"ZodReadonly");o(yl,"ZodReadonly");yl.create=(e,t)=>new yl({innerType:e,typeName:Mt.ZodReadonly,...Ut(t)});function h2(e,t={},r){return e?Uc.create().superRefine((n,a)=>{var s,c;if(!e(n)){let l=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,d=(c=(s=l.fatal)!==null&&s!==void 0?s:r)!==null&&c!==void 0?c:!0,p=typeof l=="string"?{message:l}:l;a.addIssue({code:"custom",...p,fatal:d})}}):Uc.create()}i(h2,"custom");o(h2,"custom");var PV={object:Rr.lazycreate},Mt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Mt||(Mt={}));var BV=o((e,t={message:`Input not instance of ${e.name}`})=>h2(r=>r instanceof e,t),"instanceOfType"),MD=va.create,ID=Is.create,LV=jd.create,UV=ks.create,kD=cl.create,FV=Lc.create,jV=Bd.create,$V=ul.create,zV=ll.create,HV=Uc.create,qV=Es.create,VV=Ka.create,KV=Ld.create,GV=ba.create,WV=Rr.create,ZV=Rr.strictCreate,JV=fl.create,YV=p1.create,XV=dl.create,QV=Ga.create,eK=Ud.create,tK=Fd.create,rK=Fc.create,nK=Xu.create,iK=hl.create,aK=pl.create,oK=Ds.create,sK=ml.create,cK=jc.create,ZS=Wi.create,uK=wa.create,lK=Lo.create,fK=Wi.createWithPreprocess,dK=ih.create,hK=o(()=>MD().optional(),"ostring"),pK=o(()=>ID().optional(),"onumber"),mK=o(()=>kD().optional(),"oboolean"),gK={string:e=>va.create({...e,coerce:!0}),number:e=>Is.create({...e,coerce:!0}),boolean:e=>cl.create({...e,coerce:!0}),bigint:e=>ks.create({...e,coerce:!0}),date:e=>Lc.create({...e,coerce:!0})},vK=kt,B=Object.freeze({__proto__:null,defaultErrorMap:sl,setErrorMap:AD,getErrorMap:Rd,makeIssue:km,EMPTY_PATH:_V,addIssueToContext:Qe,ParseStatus:xn,INVALID:kt,DIRTY:Ju,OK:Un,isAborted:C6,isDirty:M6,isValid:Od,isAsync:Nd,get util(){return nr},get objectUtil(){return T6},ZodParsedType:it,getParsedType:ws,ZodType:zt,datetimeRegex:f2,ZodString:va,ZodNumber:Is,ZodBigInt:ks,ZodBoolean:cl,ZodDate:Lc,ZodSymbol:Bd,ZodUndefined:ul,ZodNull:ll,ZodAny:Uc,ZodUnknown:Es,ZodNever:Ka,ZodVoid:Ld,ZodArray:ba,ZodObject:Rr,ZodUnion:fl,ZodDiscriminatedUnion:p1,ZodIntersection:dl,ZodTuple:Ga,ZodRecord:Ud,ZodMap:Fd,ZodSet:Fc,ZodFunction:Xu,ZodLazy:hl,ZodLiteral:pl,ZodEnum:Ds,ZodNativeEnum:ml,ZodPromise:jc,ZodEffects:Wi,ZodTransformer:Wi,ZodOptional:wa,ZodNullable:Lo,ZodDefault:gl,ZodCatch:vl,ZodNaN:jd,BRAND:NV,ZodBranded:m1,ZodPipeline:ih,ZodReadonly:yl,custom:h2,Schema:zt,ZodSchema:zt,late:PV,get ZodFirstPartyTypeKind(){return Mt},coerce:gK,any:HV,array:GV,bigint:UV,boolean:kD,date:FV,discriminatedUnion:YV,effect:ZS,enum:oK,function:nK,instanceof:BV,intersection:XV,lazy:iK,literal:aK,map:tK,nan:LV,nativeEnum:sK,never:VV,null:zV,nullable:lK,number:ID,object:WV,oboolean:mK,onumber:pK,optional:uK,ostring:hK,pipeline:dK,preprocess:fK,promise:cK,record:eK,set:rK,strictObject:ZV,string:MD,symbol:jV,transformer:ZS,tuple:QV,undefined:$V,union:JV,unknown:qV,void:KV,NEVER:vK,ZodIssueCode:Ve,quotelessJson:wV,ZodError:Si}),ud=Symbol("current"),Ku=Symbol("previous"),ld=o((e,{ref:t,refType:r,param:n,header:a,...s}={})=>({...s,...e}),"mergeOpenApi");function DD(e){if(typeof e.ZodType.prototype.openapi<"u")return;e.ZodType.prototype.openapi=function(s){let{zodOpenApi:c,...l}=this._def,d=new this.constructor({...l,zodOpenApi:{openapi:ld(s,c?.openapi)}});return d._def.zodOpenApi[ud]=d,c&&(d._def.zodOpenApi[Ku]=this),d};let t=e.ZodType.prototype.describe;e.ZodType.prototype.describe=function(...s){let c=t.apply(this,s),l=c._def;if(l.zodOpenApi){let d={...l.zodOpenApi};d.openapi=ld({description:s[0]},d.openapi),d[Ku]=this,d[ud]=c,l.zodOpenApi=d}else l.zodOpenApi={openapi:{description:s[0]},[ud]:c};return c};let r=e.ZodObject.prototype.extend;e.ZodObject.prototype.extend=function(...s){let c=r.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=ld({},d.openapi),d[Ku]=this,c._def.zodOpenApi=d}else c._def.zodOpenApi={[Ku]:this};return c};let n=e.ZodObject.prototype.omit;e.ZodObject.prototype.omit=function(...s){let c=n.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=ld({},d.openapi),delete d[Ku],delete d[ud],c._def.zodOpenApi=d}return c};let a=e.ZodObject.prototype.pick;e.ZodObject.prototype.pick=function(...s){let c=a.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=ld({},d.openapi),delete d[Ku],delete d[ud],c._def.zodOpenApi=d}return c}}i(DD,"extendZodWithOpenApi");o(DD,"extendZodWithOpenApi");DD(B);var yK=Object.defineProperty,bK=o((e,t)=>yK(e,"name",{value:t,configurable:!0}),"__name"),g1=B.array(B.string().or(B.record(B.any()))),TQ=B.object({type:B.string().optional(),narrative:B.string().optional()}),v1=B.string().or(B.object({id:B.string(),type:B.string(),caption:B.string().optional()})),wK=B.object({type:B.string().min(1).or(B.string().array().nonempty()),latitude:B.number(),longitude:B.number()}),_K=B.object({type:B.string().min(1).or(B.string().array().nonempty()),addressCountry:B.string().optional(),addressCountryCode:B.string().optional(),addressRegion:B.string().optional(),addressLocality:B.string().optional(),streetAddress:B.string().optional(),postOfficeBoxNumber:B.string().optional(),postalCode:B.string().optional(),geo:wK.optional()}),EK=B.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(B.string()),RD=B.object({type:B.string().min(1).or(B.string().array().nonempty()),identifier:B.string(),identifierType:EK}),$d=B.string().or(B.object({id:B.string().optional(),type:B.string().or(B.string().array().nonempty().optional()),name:B.string().optional(),url:B.string().optional(),phone:B.string().optional(),description:B.string().optional(),endorsement:B.any().array().optional(),image:v1.optional(),email:B.string().email().optional(),address:_K.optional(),otherIdentifier:RD.array().optional(),official:B.string().optional(),parentOrg:B.any().optional(),familyName:B.string().optional(),givenName:B.string().optional(),additionalName:B.string().optional(),patronymicName:B.string().optional(),honorificPrefix:B.string().optional(),honorificSuffix:B.string().optional(),familyNamePrefix:B.string().optional(),dateOfBirth:B.string().optional()}).catchall(B.any())),I6=B.object({id:B.string().optional()}).catchall(B.any()),H0=B.object({type:B.string(),id:B.string()}).catchall(B.any()),JS=B.object({id:B.string(),type:B.string()}).catchall(B.any()),YS=B.object({id:B.string().optional(),type:B.string()}).catchall(B.any()),XS=B.object({type:B.string(),id:B.string().optional()}).catchall(B.any()),QS=B.object({type:B.string().or(B.string().array().nonempty()),id:B.string().optional()}).catchall(B.any()),zd=B.object({"@context":g1,id:B.string().optional(),type:B.string().array().nonempty(),issuer:$d,credentialSubject:I6.or(I6.array()),refreshService:YS.or(YS.array()).optional(),credentialSchema:JS.or(JS.array()).optional(),issuanceDate:B.string().optional(),expirationDate:B.string().optional(),credentialStatus:H0.or(H0.array()).optional(),name:B.string().optional(),description:B.string().optional(),validFrom:B.string().optional(),validUntil:B.string().optional(),status:H0.or(H0.array()).optional(),termsOfUse:XS.or(XS.array()).optional(),evidence:QS.or(QS.array()).optional()}).catchall(B.any()),Wa=B.object({type:B.string(),created:B.string(),challenge:B.string().optional(),domain:B.string().optional(),nonce:B.string().optional(),proofPurpose:B.string(),verificationMethod:B.string(),jws:B.string().optional()}).catchall(B.any()),k6=zd.extend({proof:Wa.or(Wa.array())}),AK=B.object({"@context":g1,id:B.string().optional(),type:B.string().or(B.string().array().nonempty()),verifiableCredential:k6.or(k6.array()).optional(),holder:B.string().optional()}).catchall(B.any()),SK=AK.extend({proof:Wa.or(Wa.array())}),p2=B.object({kty:B.string(),crv:B.string(),x:B.string(),y:B.string().optional(),n:B.string().optional(),d:B.string().optional()}),CQ=p2.omit({d:!0}).extend({d:B.string()}),xK=B.object({alg:B.string(),iv:B.string(),tag:B.string(),epk:p2.partial().optional(),kid:B.string().optional(),apv:B.string().optional(),apu:B.string().optional()}),TK=B.object({header:xK,encrypted_key:B.string()}),CK=B.object({protected:B.string(),iv:B.string(),ciphertext:B.string(),tag:B.string(),aad:B.string().optional(),recipients:TK.array().optional()}),Sc=B.string().or(B.object({"@context":g1.optional(),id:B.string(),type:B.string(),controller:B.string(),publicKeyJwk:p2.optional(),publicKeyBase58:B.string().optional(),blockChainAccountId:B.string().optional()}).catchall(B.any())),MK=B.object({id:B.string(),type:B.string().or(B.string().array().nonempty()),serviceEndpoint:B.any().or(B.any().array().nonempty())}).catchall(B.any()),MQ=B.object({"@context":g1,id:B.string(),alsoKnownAs:B.string().optional(),controller:B.string().or(B.string().array().nonempty()).optional(),verificationMethod:Sc.array().optional(),authentication:Sc.array().optional(),assertionMethod:Sc.array().optional(),keyAgreement:Sc.array().optional(),capabilityInvocation:Sc.array().optional(),capabilityDelegation:Sc.array().optional(),publicKey:Sc.array().optional(),service:MK.array().optional(),proof:Wa.or(Wa.array()).optional()}).catchall(B.any()),IK=B.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(B.string()),y1=B.object({type:B.string().array().nonempty(),targetCode:B.string().optional(),targetDescription:B.string().optional(),targetName:B.string(),targetFramework:B.string().optional(),targetType:IK.optional(),targetUrl:B.string()}),kK=B.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"]),DK=kK.or(B.string()),RK=B.object({id:B.string().optional(),narrative:B.string().optional()}).catchall(B.any()),OK=B.object({id:B.string(),type:B.string().array().nonempty(),endorsementComment:B.string().optional()}),NK=zd.extend({credentialSubject:OK,proof:Wa.or(Wa.array()).optional()}),PK=B.object({id:B.string(),"@language":B.string().optional(),version:B.string().optional()}),BK=B.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(B.string()),LK=B.object({id:B.string(),type:B.string().array().nonempty(),alignment:y1.array().optional(),description:B.string().optional(),level:B.string().optional(),name:B.string(),points:B.string().optional()}).catchall(B.any()),UK=B.object({id:B.string(),type:B.string().array().nonempty(),alignment:y1.array().optional(),allowedValue:B.string().array().optional(),name:B.string(),requiredLevel:B.string().optional(),requiredValue:B.string().optional(),resultType:BK,rubricCriterionLevel:LK.array().optional(),valueMax:B.string().optional(),valueMin:B.string().optional()}).catchall(B.any()),FK=B.object({id:B.string().optional(),type:B.string().array().nonempty(),alignment:y1.array().optional(),achievementType:DK.optional(),creator:$d.optional(),creditsAvailable:B.number().optional(),criteria:RK,description:B.string(),endorsement:NK.array().optional(),fieldOfStudy:B.string().optional(),humanCode:B.string().optional(),image:v1.optional(),"@language":B.string().optional(),name:B.string(),otherIdentifier:RD.array().optional(),related:PK.array().optional(),resultDescription:UK.array().optional(),specialization:B.string().optional(),tag:B.string().array().optional(),version:B.string().optional()}).catchall(B.any()),jK=B.object({type:B.string(),hashed:B.boolean(),identityHash:B.string(),identityType:B.string(),salt:B.string().optional()}),$K=B.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),zK=B.object({type:B.string().array().nonempty(),achievedLevel:B.string().optional(),alignment:y1.array().optional(),resultDescription:B.string().optional(),status:$K.optional(),value:B.string().optional()}).catchall(B.any()),ex=B.object({id:B.string().optional(),type:B.string().array().nonempty(),activityEndDate:B.string().optional(),activityStartDate:B.string().optional(),creditsEarned:B.number().optional(),achievement:FK.optional(),identifier:jK.array().optional(),image:v1.optional(),licenseNumber:B.string().optional(),narrative:B.string().optional(),result:zK.array().optional(),role:B.string().optional(),source:$d.optional(),term:B.string().optional()}).catchall(B.any()),HK=B.object({id:B.string().optional(),type:B.string().or(B.string().array().nonempty()),narrative:B.string().optional(),name:B.string().optional(),description:B.string().optional(),genre:B.string().optional(),audience:B.string().optional()}).catchall(B.any()),qK=zd.extend({name:B.string().optional(),description:B.string().optional(),image:v1.optional(),credentialSubject:ex.or(ex.array()),endorsement:zd.array().optional(),evidence:HK.array().optional()}),IQ=qK.extend({proof:Wa.or(Wa.array())}),kQ=B.object({checks:B.string().array(),warnings:B.string().array(),errors:B.string().array()}),OD=B.enum(["Success","Failed","Error"]),DQ=OD.enum,RQ=B.object({check:B.string(),status:OD,message:B.string().optional(),details:B.string().optional()}),OQ=B.object({title:B.string().optional(),createdAt:B.string().optional(),issuer:$d.optional(),issuee:$d.optional(),credentialSubject:I6.optional()}),NQ=B.object({id:B.string(),uri:B.string()}).catchall(B.any()),PQ=B.object({limit:B.number(),cursor:B.string().optional(),sort:B.string().optional()}),Fn=B.object({cursor:B.string().optional(),hasMore:B.boolean()}),ND=B.object({encryptedRecord:CK,fields:B.string().array()}).catchall(B.any()),BQ=Fn.extend({records:ND.array()}),VK=ND.extend({id:B.string()}),LQ=Fn.extend({records:VK.array()}),tx=bK(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),KK=B.instanceof(RegExp).or(B.string().refine(e=>{try{return tx(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=tx(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),mr=B.string().or(B.object({$in:B.string().array()})).or(B.object({$regex:KK})),GK=B.object({backgroundColor:B.string().optional(),backgroundImage:B.string().optional(),fadeBackgroundImage:B.boolean().optional(),repeatBackgroundImage:B.boolean().optional(),fontColor:B.string().optional(),accentColor:B.string().optional(),accentFontColor:B.string().optional(),idBackgroundImage:B.string().optional(),fadeIdBackgroundImage:B.boolean().optional(),idBackgroundColor:B.string().optional(),repeatIdBackgroundImage:B.boolean().optional()}),Uo=B.object({profileId:B.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),displayName:B.string().default("").describe("Human-readable display name for the profile."),shortBio:B.string().default("").describe("Short bio for the profile."),bio:B.string().default("").describe("Longer bio for the profile."),did:B.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),isPrivate:B.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),email:B.string().optional().describe("Contact email address for the profile. (deprecated)"),image:B.string().optional().describe("Profile image URL for the profile."),heroImage:B.string().optional().describe("Hero image URL for the profile."),websiteLink:B.string().optional().describe("Website link for the profile."),isServiceProfile:B.boolean().default(!1).optional().describe("Whether the profile is a service profile or not."),type:B.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),notificationsWebhook:B.string().url().startsWith("http").optional().describe("URL to send notifications to."),display:GK.optional().describe("Display settings for the profile."),role:B.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),dob:B.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')}),UQ=B.object({profileId:mr,displayName:mr,shortBio:mr,bio:mr,email:mr,websiteLink:mr,isServiceProfile:B.boolean(),type:mr}).partial(),FQ=Fn.extend({records:Uo.array()}),jQ=B.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),PD=B.object({id:B.string(),created:B.string(),displayName:B.string().default("").optional(),shortBio:B.string().default("").optional(),bio:B.string().default("").optional(),email:B.string().optional(),image:B.string().optional(),heroImage:B.string().optional()}),$Q=Fn.extend({records:PD.extend({did:B.string()}).array()}),zQ=B.object({id:mr,displayName:mr,shortBio:mr,bio:mr,email:mr}).partial(),HQ=Fn.extend({records:B.object({profile:Uo,manager:PD.extend({did:B.string()}).optional()}).array()}),qQ=B.object({uri:B.string(),to:B.string(),from:B.string(),sent:B.string().datetime(),received:B.string().datetime().optional()}),BD=B.object({role:B.string(),canEdit:B.boolean(),canIssue:B.boolean(),canRevoke:B.boolean(),canManagePermissions:B.boolean(),canIssueChildren:B.string(),canCreateChildren:B.string(),canEditChildren:B.string(),canRevokeChildren:B.string(),canManageChildrenPermissions:B.string(),canManageChildrenProfiles:B.boolean().default(!1).optional(),canViewAnalytics:B.boolean()}),WK=B.object({role:mr,canEdit:B.boolean(),canIssue:B.boolean(),canRevoke:B.boolean(),canManagePermissions:B.boolean(),canIssueChildren:mr,canCreateChildren:mr,canEditChildren:mr,canRevokeChildren:mr,canManageChildrenPermissions:mr,canManageChildrenProfiles:B.boolean(),canViewAnalytics:B.boolean()}).partial(),rx=B.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),ZK=B.discriminatedUnion("type",[B.object({type:B.literal(rx.Values.GRANT_PERMISSIONS),data:B.object({claimUri:B.string(),targetUri:B.string(),permissions:BD.partial()})}),B.object({type:B.literal(rx.Values.ADD_ADMIN),data:B.object({claimUri:B.string(),targetUri:B.string()})})]),VQ=B.object({type:mr,data:B.object({claimUri:mr,targetUri:mr,permissions:WK})}).deepPartial(),JK=B.object({id:B.string(),createdAt:B.string(),updatedAt:B.string()}).and(ZK),KQ=Fn.extend({records:JK.array()}),D6=B.enum(["DRAFT","LIVE"]),YK=B.object({uri:B.string(),name:B.string().optional(),type:B.string().optional(),category:B.string().optional(),status:D6.optional(),autoConnectRecipients:B.boolean().optional(),meta:B.record(B.any()).optional(),claimPermissions:BD.optional(),allowAnyoneToCreateChildren:B.boolean().optional()}),GQ=B.object({uri:mr,name:mr,type:mr,category:mr,meta:B.record(mr),status:D6.or(B.object({$in:D6.array()})),autoConnectRecipients:B.boolean()}).partial(),WQ=Fn.extend({records:YK.array()}),XK=B.object({to:Uo,from:B.string(),received:B.string().optional(),uri:B.string().optional()}),ZQ=Fn.extend({records:XK.array()}),QK=B.object({to:Uo,from:B.string(),received:B.string().optional(),boostUris:B.array(B.string()),credentialUris:B.array(B.string()).optional()}),JQ=Fn.extend({records:QK.array()}),YQ=B.object({endpoint:B.string(),name:B.string(),did:B.string().optional()}),XQ=B.object({ttlSeconds:B.number().optional(),totalUses:B.number().optional()}),eG=B.object({endpoint:B.string()}),QQ=B.object({signingAuthority:eG,relationship:B.object({name:B.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:B.string(),isPrimary:B.boolean().optional()})}),eee=B.object({boostUri:B.string(),signingAuthority:B.object({endpoint:B.string(),name:B.string()})}),tG=B.enum(["live","stale","withdrawn"]),rG=B.object({read:B.object({anonymize:B.boolean().optional(),credentials:B.object({categories:B.record(B.object({required:B.boolean(),defaultEnabled:B.boolean().optional()})).default({})}).default({}),personal:B.record(B.object({required:B.boolean(),defaultEnabled:B.boolean().optional()})).default({})}).default({}),write:B.object({credentials:B.object({categories:B.record(B.object({required:B.boolean(),defaultEnabled:B.boolean().optional()})).default({})}).default({}),personal:B.record(B.object({required:B.boolean(),defaultEnabled:B.boolean().optional()})).default({})}).default({})}),LD=B.object({contract:rG,owner:Uo,name:B.string(),subtitle:B.string().optional(),description:B.string().optional(),reasonForAccessing:B.string().optional(),image:B.string().optional(),uri:B.string(),needsGuardianConsent:B.boolean().optional(),redirectUrl:B.string().optional(),frontDoorBoostUri:B.string().optional(),createdAt:B.string(),updatedAt:B.string(),expiresAt:B.string().optional(),autoBoosts:B.string().array().optional(),writers:B.array(Uo).optional()}),tee=Fn.extend({records:LD.omit({owner:!0}).array()}),nG=B.object({credentials:B.object({categories:B.record(B.string().array()).default({})}),personal:B.record(B.string()).default({}),date:B.string()}),ree=Fn.extend({records:nG.array()}),iG=B.object({credentials:B.object({category:B.string(),uri:B.string()}).array(),personal:B.record(B.string()).default({}),date:B.string(),contractUri:B.string()}),nee=Fn.extend({records:iG.array()}),UD=B.object({sharing:B.boolean().optional(),shared:B.string().array().optional(),shareAll:B.boolean().optional(),shareUntil:B.string().optional()}),FD=B.object({read:B.object({anonymize:B.boolean().optional(),credentials:B.object({shareAll:B.boolean().optional(),sharing:B.boolean().optional(),categories:B.record(UD).default({})}).default({}),personal:B.record(B.string()).default({})}).default({}),write:B.object({credentials:B.object({categories:B.record(B.boolean()).default({})}).default({}),personal:B.record(B.boolean()).default({})}).default({}),deniedWriters:B.array(B.string()).optional()}),iee=Fn.extend({records:B.object({expiresAt:B.string().optional(),oneTime:B.boolean().optional(),terms:FD,contract:LD,uri:B.string(),consenter:Uo,status:tG}).array()}),aee=B.object({read:B.object({anonymize:B.boolean().optional(),credentials:B.object({categories:B.record(B.object({required:B.boolean().optional()})).optional()}).optional(),personal:B.record(B.object({required:B.boolean().optional()})).optional()}).optional(),write:B.object({credentials:B.object({categories:B.record(B.object({required:B.boolean().optional()})).optional()}).optional(),personal:B.record(B.object({required:B.boolean().optional()})).optional()}).optional()}),oee=B.object({anonymize:B.boolean().optional(),credentials:B.object({categories:B.record(B.boolean()).optional()}).optional(),personal:B.record(B.boolean()).optional()}),see=B.object({credentials:B.object({categories:B.record(B.boolean()).optional()}).optional(),personal:B.record(B.boolean()).optional(),id:mr.optional()}),aG=B.object({read:B.object({anonymize:B.boolean().optional(),credentials:B.object({shareAll:B.boolean().optional(),sharing:B.boolean().optional(),categories:B.record(UD.optional()).optional()}).optional(),personal:B.record(B.string()).optional()}).optional(),write:B.object({credentials:B.object({categories:B.record(B.boolean()).optional()}).optional(),personal:B.record(B.boolean()).optional()}).optional()}),R6=B.enum(["consent","update","sync","withdraw","write"]),cee=B.object({terms:aG.optional(),action:R6.or(R6.array()).optional(),date:B.object({$gt:B.string()}).or(B.object({$lt:B.string()})).or(B.object({$eq:B.string()})).optional(),expiresAt:B.object({$gt:B.string()}).or(B.object({$lt:B.string()})).or(B.object({$eq:B.string()})).optional(),oneTime:B.boolean().optional()}),jD=B.object({expiresAt:B.string().optional(),oneTime:B.boolean().optional(),terms:FD.optional(),id:B.string(),action:R6,date:B.string(),uris:B.string().array().optional()}),uee=Fn.extend({records:jD.array()}),oG=B.object({credentialUri:B.string(),termsUri:B.string(),contractUri:B.string(),boostUri:B.string(),category:B.string().optional(),date:B.string()}),lee=Fn.extend({records:oG.array()}),sG=B.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION","ISSUANCE_CLAIMED","ISSUANCE_DELIVERED"]),cG=B.object({title:B.string().optional(),body:B.string().optional()}),uG=B.object({type:B.string(),value:B.string()}),b1=B.enum(["PENDING","DELIVERED","CLAIMED","EXPIRED"]),lG=B.object({issuanceId:B.string(),status:b1,recipient:B.object({contactMethod:uG.optional(),learnCardId:B.string().optional()}),timestamp:B.string().datetime().optional()}),fG=B.object({vcUris:B.array(B.string()).optional(),vpUris:B.array(B.string()).optional(),transaction:jD.optional(),inbox:lG.optional()}),fee=B.object({type:sG,to:Uo.partial().and(B.object({did:B.string()})),from:Uo.partial().and(B.object({did:B.string()})),message:cG.optional(),data:fG.optional(),sent:B.string().datetime().optional(),webhookUrl:B.string().optional()}),dG="auth-grant:",dee=B.object({id:B.string(),name:B.string(),description:B.string().optional(),challenge:B.string().startsWith(dG).min(10,{message:"Challenge is too short"}).max(100,{message:"Challenge is too long"}),status:B.enum(["revoked","active"],{required_error:"Status is required",invalid_type_error:"Status must be either active or revoked"}),scope:B.string(),createdAt:B.string().datetime({message:"createdAt must be a valid ISO 8601 datetime string"}),expiresAt:B.string().datetime({message:"expiresAt must be a valid ISO 8601 datetime string"}).nullish().optional()}),hee=B.object({id:B.string()}).catchall(B.any()),hG=B.enum(["active","revoked"]),pee=B.object({id:mr,name:mr,description:mr,status:hG}).partial(),nx=B.object({id:B.string(),isVerified:B.boolean(),verifiedAt:B.string().optional(),isPrimary:B.boolean(),createdAt:B.string()}),mee=B.discriminatedUnion("type",[B.object({type:B.literal("email"),value:B.string().email()}).merge(nx),B.object({type:B.literal("phone"),value:B.string()}).merge(nx)]),ix=B.object({isVerified:B.boolean().optional(),isPrimary:B.boolean().optional()}),gee=B.discriminatedUnion("type",[B.object({type:B.literal("email"),value:B.string().email()}).merge(ix),B.object({type:B.literal("phone"),value:B.string()}).merge(ix)]),$D=B.discriminatedUnion("type",[B.object({type:B.literal("email"),value:B.string().email()}),B.object({type:B.literal("phone"),value:B.string()})]),vee=B.object({value:B.string(),type:B.enum(["email","phone"])}),yee=B.object({token:B.string()}),bee=B.object({contactMethodId:B.string()}),pG=B.object({id:B.string(),credential:B.string(),isSigned:B.boolean(),currentStatus:b1,expiresAt:B.string(),createdAt:B.string(),issuerDid:B.string(),webhookUrl:B.string().optional(),"signingAuthority.endpoint":B.string().optional(),"signingAuthority.name":B.string().optional()}),wee=B.object({hasMore:B.boolean(),records:B.array(pG),cursor:B.string().optional()}),_ee=B.object({currentStatus:b1,id:B.string(),isSigned:B.boolean(),issuerDid:B.string()}).partial(),mG=B.object({endpoint:B.string().url(),name:B.string()}),Eee=B.object({recipient:$D.describe("The recipient of the credential"),credential:k6.passthrough().or(SK.passthrough()).or(zd.passthrough()).describe("The credential to issue. If not signed, the users default signing authority will be used, or the specified signing authority in the configuration."),configuration:B.object({signingAuthority:mG.optional().describe("The signing authority to use for the credential. If not provided, the users default signing authority will be used if the credential is not signed."),webhookUrl:B.string().url().optional().describe("The webhook URL to receive credential issuance events."),expiresInDays:B.number().min(1).max(365).optional().describe("The number of days the credential will be valid for."),delivery:B.object({suppress:B.boolean().optional().default(!1).describe("Whether to suppress delivery of the credential to the recipient. If true, the email/sms will not be sent to the recipient. Useful if you would like to manually send claim link to your users."),template:B.object({id:B.enum(["universal-inbox-claim"]).optional().describe("The template ID to use for the credential delivery. If not provided, the default template will be used."),model:B.object({issuer:B.object({name:B.string().optional().describe('The name of the organization (e.g., "State University").'),logoUrl:B.string().url().optional().describe("The URL of the organization's logo.")}).optional(),credential:B.object({name:B.string().optional().describe('The name of the credential (e.g., "Bachelor of Science").'),type:B.string().optional().describe('The type of the credential (e.g., "degree", "certificate").')}).optional(),recipient:B.object({name:B.string().optional().describe('The name of the recipient (e.g., "John Doe").')}).optional()}).describe("The template model to use for the credential delivery. Injects via template variables into email/sms templates. If not provided, the default template will be used.")}).optional().describe("The template to use for the credential delivery. If not provided, the default template will be used.")}).optional().describe("Configuration for the credential delivery i.e. email or SMS. When credentials are sent to a user who has a verified email or phone associated with their account, delivery is skipped, and the credential will be sent using in-app notifications. If not provided, the default configuration will be used.")}).optional().describe("Configuration for the credential issuance. If not provided, the default configuration will be used.")}),Aee=B.object({issuanceId:B.string(),status:b1,recipient:$D,claimUrl:B.string().url().optional(),recipientDid:B.string().optional()}),See=B.object({token:B.string(),contactMethodId:B.string(),createdAt:B.string(),expiresAt:B.string(),used:B.boolean()}),w1=o(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),xee=B.string().refine(e=>e.split(":").length===3&&e.split(":")[0]==="lc","URI must be of the form lc:${storage}:${url}").refine(e=>e.split(":")[1]==="ceramic","URI must use storage type ceramic (i.e. must be lc:ceramic:${streamID})");var m2=P.object({credentials:Ec.array()}).catchall(P.any()),zD=P.object({id:P.string(),title:P.string(),storageType:P.literal("ceramic").optional()}).catchall(P.any()),g2=P.object({credentials:Ec.or(zD).array()}).strict();var HD={modelData:{definitions:{MyVerifiableCredentials:"kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"},schemas:{AchievementVerifiableCredential:"ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",VerifiableCredentialsList:"ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"},tiles:{}},credentialAlias:"MyVerifiableCredentials"};var _1=i(async(e,{modelData:t,credentialAlias:r}=HD)=>{let n=e.invoke.getCeramicClient(),a=new Jf({ceramic:n,model:t}),s=i(async(g=r)=>{let v=await a.get(g);if(!v)return{credentials:[]};let y=await m2.spa(v);if(y.success)return y.data;let _=await g2.spa(v);if(_.success){let D={credentials:_.data.credentials.map(L=>{if("uri"in L)return L;let{title:Z,id:z,storageType:q,...Q}=L;return{...Q,id:Z,uri:`lc:ceramic:${z.replace("ceramic://","")}`}})};return await a.set(r,D),D}throw console.error(y.error),new Error("Invalid credentials list stored in IDX")},"getCredentialsListFromIdx"),c=i(async(g,v)=>{if(!g)throw new Error("Must provide id to remove");v||(v=r);let y=await s(v);return y.credentials=y.credentials.filter(_=>_.id!==g),a.set(v,y)},"removeCredentialFromIdx"),l=i(async g=>(g||(g=r),a.set(g,{credentials:[]})),"removeAllCredentialsFromIdx"),d=i(async g=>{let v=await Ec.parseAsync(g);if(!v)throw new Error("record is required");if(!v.uri)throw Error("No URI provided");await e.read.get(v.uri);let y=await s(r),_=y.credentials.findIndex(x=>x.id===v.id);return _>-1?y.credentials[_]=v:y.credentials.push(v),w1(await a.set(r,y))},"addCredentialInIdx"),p=i(async g=>{let v=Ec.array().parse(g),y=await s(r);return await Promise.all(v.map(async _=>{await e.read.get(_.uri);let x=y.credentials.findIndex(O=>O.id===_.id);x>-1?y.credentials[x]=_:y.credentials.push(_)})),w1(await a.set(r,y))},"addCredentialsInIdx");return{name:"IDX",displayName:"IDX",description:"Stores a bespoke index of credentials for an individual based on their did",index:{get:async g=>(g.debug?.("learnCard.index.IDX.get"),(await s()).credentials),add:async(g,v)=>{g.debug?.("learnCard.index.IDX.add");try{return await d(v),!0}catch(y){return console.error("Error adding credential with IDX:",y),!1}},addMany:async(g,v)=>{g.debug?.("learnCard.index.IDX.add");try{return await p(v),!0}catch(y){return console.error("Error adding credential with IDX:",y),!1}},update:async g=>(g.debug?.("learnCard.index.IDX.update"),!1),remove:async(g,v)=>{g.debug?.("learnCard.index.IDX.remove");try{return await c(v),!0}catch(y){return console.error("Error removing credential from IDX:",y),!1}},removeAll:async g=>{g.debug?.("learnCard.index.IDX.removeAll");try{return await l(),!0}catch(v){return console.error("Error removing credentials from IDX:",v),!1}}},methods:{getCredentialsListFromIdx:async(g,v=r)=>(await s(v)).credentials,getVerifiableCredentialFromIdx:async(g,v)=>{let _=(await s())?.credentials?.find(D=>D?.id===v),x=g.read.get(_?.uri),O=await id.safeParseAsync(x);return O.success?O.data:void 0},getVerifiableCredentialsFromIdx:async g=>{let y=(await s())?.credentials?.map(_=>_?.uri)??[];return(await Promise.all(y.map(async _=>g.read.get(_)))).filter(_=>!!_)},addVerifiableCredentialInIdx:async(g,v)=>{let y=Ec.parse(v);if(!y)throw new Error("record is required");if(!y.uri)throw Error("No URI provided");await g.read.get(y.uri);let _=await s(r),x=_.credentials.findIndex(O=>O.id===y.id);return x>-1?_.credentials[x]=y:_.credentials.push(y),w1(await a.set(r,_))},removeVerifiableCredentialInIdx:async(g,v)=>c(v),removeAllVerifiableCredentialsInIdx:async()=>l(),getIDXIndex:async()=>a.get(r),setIDXIndex:async(g,v)=>a.set(r,v)}}},"getIDXPlugin");var gG=_1;
|
|
845
|
+
`):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl"),"UnsubscriptionErrorImpl")});function kd(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(kd,"arrRemove");o(kd,"arrRemove");var nh=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription2"),o(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,a,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=Pc(c),d=l.next();!d.done;d=l.next()){var p=d.value;p.remove(this)}}catch(O){t={error:O}}finally{try{d&&!d.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var g=this.initialTeardown;if(Ar(g))try{g()}catch(O){s=O instanceof Tb?O.errors:[O]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var y=Pc(v),_=y.next();!_.done;_=y.next()){var x=_.value;try{d6(x)}catch(O){s=s??[],O instanceof Tb?s=Ms(Ms([],Po(s)),Po(O.errors)):s.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(a=y.return)&&a.call(y)}finally{if(n)throw n.error}}}if(s)throw new Tb(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)d6(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&kd(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&kd(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),dk=nh.EMPTY;function z3(e){return e instanceof nh||e&&"closed"in e&&Ar(e.remove)&&Ar(e.add)&&Ar(e.unsubscribe)}i(z3,"isSubscription");o(z3,"isSubscription");function d6(e){Ar(e)?e():e.unsubscribe()}i(d6,"execFinalizer");o(d6,"execFinalizer");var Zc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Tm={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=Tm.delegate;return a?.setTimeout?a.setTimeout.apply(a,Ms([e,t],Po(r))):setTimeout.apply(void 0,Ms([e,t],Po(r)))},clearTimeout:function(e){var t=Tm.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function H3(e){Tm.setTimeout(function(){var t=Zc.onUnhandledError;if(t)t(e);else throw e})}i(H3,"reportUnhandledError");o(H3,"reportUnhandledError");function h6(){}i(h6,"noop");o(h6,"noop");var xq=function(){return u1("C",void 0,void 0)}();function hk(e){return u1("E",void 0,e)}i(hk,"errorNotification");o(hk,"errorNotification");function pk(e){return u1("N",e,void 0)}i(pk,"nextNotification");o(pk,"nextNotification");function u1(e,t,r){return{kind:e,value:t,error:r}}i(u1,"createNotification");o(u1,"createNotification");var Ic=null;function bd(e){if(Zc.useDeprecatedSynchronousErrorHandling){var t=!Ic;if(t&&(Ic={errorThrown:!1,error:null}),e(),t){var r=Ic,n=r.errorThrown,a=r.error;if(Ic=null,n)throw a}}else e()}i(bd,"errorContext");o(bd,"errorContext");function mk(e){Zc.useDeprecatedSynchronousErrorHandling&&Ic&&(Ic.errorThrown=!0,Ic.error=e)}i(mk,"captureError");o(mk,"captureError");var q3=function(e){eo(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,z3(r)&&r.add(n)):n.destination=Mq,n}return i(t,"Subscriber2"),o(t,"Subscriber"),t.create=function(r,n,a){return new p6(r,n,a)},t.prototype.next=function(r){this.isStopped?Q0(pk(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?Q0(hk(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?Q0(xq,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(nh),Tq=Function.prototype.bind;function X0(e,t){return Tq.call(e,t)}i(X0,"bind");o(X0,"bind");var Cq=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver2"),o(e,"ConsumerObserver"),e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){pd(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){pd(n)}else pd(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){pd(r)}},e}(),p6=function(e){eo(t,e);function t(r,n,a){var s=e.call(this)||this,c;if(Ar(r)||!r)c={next:r??void 0,error:n??void 0,complete:a??void 0};else{var l;s&&Zc.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&X0(r.next,l),error:r.error&&X0(r.error,l),complete:r.complete&&X0(r.complete,l)}):c=r}return s.destination=new Cq(c),s}return i(t,"SafeSubscriber2"),o(t,"SafeSubscriber"),t}(q3);function pd(e){Zc.useDeprecatedSynchronousErrorHandling?mk(e):H3(e)}i(pd,"handleUnhandledError");o(pd,"handleUnhandledError");function gk(e){throw e}i(gk,"defaultErrorHandler");o(gk,"defaultErrorHandler");function Q0(e,t){var r=Zc.onStoppedNotification;r&&Tm.setTimeout(function(){return r(e,t)})}i(Q0,"handleStoppedNotification");o(Q0,"handleStoppedNotification");var Mq={closed:!0,next:h6,error:gk,complete:h6},V3=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function l1(e){return e}i(l1,"identity3");o(l1,"identity");function vk(e){return e.length===0?l1:e.length===1?e[0]:o(i(function(r){return e.reduce(function(n,a){return a(n)},r)},"piped"),"piped")}i(vk,"pipeFromArray");o(vk,"pipeFromArray");var dn=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable2"),o(e,"Observable"),e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var a=this,s=bk(t)?t:new p6(t,r,n);return bd(function(){var c=a,l=c.operator,d=c.source;s.add(l?l.call(s,d):d?a._subscribe(s):a._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=m6(r),new r(function(a,s){var c=new p6({next:function(l){try{t(l)}catch(d){s(d),c.unsubscribe()}},error:s,complete:a});n.subscribe(c)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[V3]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return vk(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=m6(t),new t(function(n,a){var s;r.subscribe(function(c){return s=c},function(c){return a(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function m6(e){var t;return(t=e??Zc.Promise)!==null&&t!==void 0?t:Promise}i(m6,"getPromiseCtor");o(m6,"getPromiseCtor");function yk(e){return e&&Ar(e.next)&&Ar(e.error)&&Ar(e.complete)}i(yk,"isObserver");o(yk,"isObserver");function bk(e){return e&&e instanceof q3||yk(e)&&z3(e)}i(bk,"isSubscriber");o(bk,"isSubscriber");function wk(e){return Ar(e?.lift)}i(wk,"hasLift");o(wk,"hasLift");function to(e){return function(t){if(wk(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}i(to,"operate");o(to,"operate");function _a(e,t,r,n,a){return new Iq(e,t,r,n,a)}i(_a,"createOperatorSubscriber");o(_a,"createOperatorSubscriber");var Iq=function(e){eo(t,e);function t(r,n,a,s,c,l){var d=e.call(this,r)||this;return d.onFinalize=c,d.shouldUnsubscribe=l,d._next=n?function(p){try{n(p)}catch(g){r.error(g)}}:e.prototype._next,d._error=s?function(p){try{s(p)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,d._complete=a?function(){try{a()}catch(p){r.error(p)}finally{this.unsubscribe()}}:e.prototype._complete,d}return i(t,"OperatorSubscriber2"),o(t,"OperatorSubscriber"),t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(q3),kq=c1(function(e){return o(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),_k=function(e){eo(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return i(t,"Subject2"),o(t,"Subject"),t.prototype.lift=function(r){var n=new BS(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new kq},t.prototype.next=function(r){var n=this;bd(function(){var a,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var c=Pc(n.currentObservers),l=c.next();!l.done;l=c.next()){var d=l.value;d.next(r)}}catch(p){a={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(a)throw a.error}}}})},t.prototype.error=function(r){var n=this;bd(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var a=n.observers;a.length;)a.shift().error(r)}})},t.prototype.complete=function(){var r=this;bd(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,a=this,s=a.hasError,c=a.isStopped,l=a.observers;return s||c?dk:(this.currentObservers=null,l.push(r),new nh(function(){n.currentObservers=null,kd(l,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,a=n.hasError,s=n.thrownError,c=n.isStopped;a?r.error(s):c&&r.complete()},t.prototype.asObservable=function(){var r=new dn;return r.source=this,r},t.create=function(r,n){return new BS(r,n)},t}(dn),BS=function(e){eo(t,e);function t(r,n){var a=e.call(this)||this;return a.destination=r,a.source=n,a}return i(t,"AnonymousSubject2"),o(t,"AnonymousSubject"),t.prototype.next=function(r){var n,a;(a=(n=this.destination)===null||n===void 0?void 0:n.next)===null||a===void 0||a.call(n,r)},t.prototype.error=function(r){var n,a;(a=(n=this.destination)===null||n===void 0?void 0:n.error)===null||a===void 0||a.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,a;return(a=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&a!==void 0?a:dk},t}(_k),Dq=function(e){eo(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return i(t,"BehaviorSubject2"),o(t,"BehaviorSubject"),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(r){var n=e.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},t.prototype.getValue=function(){var r=this,n=r.hasError,a=r.thrownError,s=r._value;if(n)throw a;return this._throwIfClosed(),s},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(_k),Ek={now:function(){return(Ek.delegate||Date).now()},delegate:void 0},Rq=function(e){eo(t,e);function t(r,n){return e.call(this)||this}return i(t,"Action2"),o(t,"Action"),t.prototype.schedule=function(r,n){return n===void 0&&(n=0),this},t}(nh),Cm={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=Cm.delegate;return a?.setInterval?a.setInterval.apply(a,Ms([e,t],Po(r))):setInterval.apply(void 0,Ms([e,t],Po(r)))},clearInterval:function(e){var t=Cm.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},Oq=function(e){eo(t,e);function t(r,n){var a=e.call(this,r,n)||this;return a.scheduler=r,a.work=n,a.pending=!1,a}return i(t,"AsyncAction2"),o(t,"AsyncAction"),t.prototype.schedule=function(r,n){var a;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var s=this.id,c=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(c,s,n)),this.pending=!0,this.delay=n,this.id=(a=this.id)!==null&&a!==void 0?a:this.requestAsyncId(c,this.id,n),this},t.prototype.requestAsyncId=function(r,n,a){return a===void 0&&(a=0),Cm.setInterval(r.flush.bind(r,this),a)},t.prototype.recycleAsyncId=function(r,n,a){if(a===void 0&&(a=0),a!=null&&this.delay===a&&this.pending===!1)return n;n!=null&&Cm.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var a=this._execute(r,n);if(a)return a;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var a=!1,s;try{this.work(r)}catch(c){a=!0,s=c||new Error("Scheduled action threw falsy error")}if(a)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,a=r.scheduler,s=a.actions;this.work=this.state=this.scheduler=null,this.pending=!1,kd(s,this),n!=null&&(this.id=this.recycleAsyncId(a,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Rq),LS=function(){function e(t,r){r===void 0&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return i(e,"Scheduler2"),o(e,"Scheduler"),e.prototype.schedule=function(t,r,n){return r===void 0&&(r=0),new this.schedulerActionCtor(this,t).schedule(n,r)},e.now=Ek.now,e}(),Nq=function(e){eo(t,e);function t(r,n){n===void 0&&(n=LS.now);var a=e.call(this,r,n)||this;return a.actions=[],a._active=!1,a}return i(t,"AsyncScheduler2"),o(t,"AsyncScheduler"),t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var a;this._active=!0;do if(a=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,a){for(;r=n.shift();)r.unsubscribe();throw a}},t}(LS),Pq=new Nq(Oq),Bq=Pq,Ak=new dn(function(e){return e.complete()});function K3(e){return e&&Ar(e.schedule)}i(K3,"isScheduler");o(K3,"isScheduler");function G3(e){return e[e.length-1]}i(G3,"last");o(G3,"last");function Sk(e){return K3(G3(e))?e.pop():void 0}i(Sk,"popScheduler");o(Sk,"popScheduler");function xk(e,t){return typeof G3(e)=="number"?e.pop():t}i(xk,"popNumber");o(xk,"popNumber");var W3=o(function(e){return e&&typeof e.length=="number"&&typeof e!="function"},"isArrayLike");function Z3(e){return Ar(e?.then)}i(Z3,"isPromise");o(Z3,"isPromise");function J3(e){return Ar(e[V3])}i(J3,"isInteropObservable");o(J3,"isInteropObservable");function Y3(e){return Symbol.asyncIterator&&Ar(e?.[Symbol.asyncIterator])}i(Y3,"isAsyncIterable");o(Y3,"isAsyncIterable");function X3(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}i(X3,"createInvalidObservableTypeError");o(X3,"createInvalidObservableTypeError");function Tk(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(Tk,"getSymbolIterator");o(Tk,"getSymbolIterator");var Ck=Tk();function Q3(e){return Ar(e?.[Ck])}i(Q3,"isIterable");o(Q3,"isIterable");function e2(e){return lk(this,arguments,o(i(function(){var r,n,a,s;return $3(this,function(c){switch(c.label){case 0:r=e.getReader(),c.label=1;case 1:c.trys.push([1,,9,10]),c.label=2;case 2:return[4,Oc(r.read())];case 3:return n=c.sent(),a=n.value,s=n.done,s?[4,Oc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,Oc(a)];case 6:return[4,c.sent()];case 7:return c.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"),"readableStreamLikeToAsyncGenerator_1"))}i(e2,"readableStreamLikeToAsyncGenerator");o(e2,"readableStreamLikeToAsyncGenerator");function t2(e){return Ar(e?.getReader)}i(t2,"isReadableStreamLike");o(t2,"isReadableStreamLike");function $o(e){if(e instanceof dn)return e;if(e!=null){if(J3(e))return Mk(e);if(W3(e))return Ik(e);if(Z3(e))return kk(e);if(Y3(e))return r2(e);if(Q3(e))return Dk(e);if(t2(e))return Rk(e)}throw X3(e)}i($o,"innerFrom");o($o,"innerFrom");function Mk(e){return new dn(function(t){var r=e[V3]();if(Ar(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(Mk,"fromInteropObservable");o(Mk,"fromInteropObservable");function Ik(e){return new dn(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(Ik,"fromArrayLike");o(Ik,"fromArrayLike");function kk(e){return new dn(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,H3)})}i(kk,"fromPromise");o(kk,"fromPromise");function Dk(e){return new dn(function(t){var r,n;try{for(var a=Pc(e),s=a.next();!s.done;s=a.next()){var c=s.value;if(t.next(c),t.closed)return}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}t.complete()})}i(Dk,"fromIterable");o(Dk,"fromIterable");function r2(e){return new dn(function(t){Ok(e,t).catch(function(r){return t.error(r)})})}i(r2,"fromAsyncIterable");o(r2,"fromAsyncIterable");function Rk(e){return r2(e2(e))}i(Rk,"fromReadableStreamLike");o(Rk,"fromReadableStreamLike");function Ok(e,t){var r,n,a,s;return uk(this,void 0,void 0,function(){var c,l;return $3(this,function(d){switch(d.label){case 0:d.trys.push([0,5,6,11]),r=fk(e),d.label=1;case 1:return[4,r.next()];case 2:if(n=d.sent(),!!n.done)return[3,4];if(c=n.value,t.next(c),t.closed)return[2];d.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=d.sent(),a={error:l},[3,11];case 6:return d.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:d.sent(),d.label=8;case 8:return[3,10];case 9:if(a)throw a.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}i(Ok,"process2");o(Ok,"process");function Ro(e,t,r,n,a){n===void 0&&(n=0),a===void 0&&(a=!1);var s=t.schedule(function(){r(),a?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!a)return s}i(Ro,"executeSchedule");o(Ro,"executeSchedule");function n2(e,t){return t===void 0&&(t=0),to(function(r,n){r.subscribe(_a(n,function(a){return Ro(n,e,function(){return n.next(a)},t)},function(){return Ro(n,e,function(){return n.complete()},t)},function(a){return Ro(n,e,function(){return n.error(a)},t)}))})}i(n2,"observeOn");o(n2,"observeOn");function i2(e,t){return t===void 0&&(t=0),to(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(i2,"subscribeOn");o(i2,"subscribeOn");function Nk(e,t){return $o(e).pipe(i2(t),n2(t))}i(Nk,"scheduleObservable");o(Nk,"scheduleObservable");function Pk(e,t){return $o(e).pipe(i2(t),n2(t))}i(Pk,"schedulePromise");o(Pk,"schedulePromise");function Bk(e,t){return new dn(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}i(Bk,"scheduleArray");o(Bk,"scheduleArray");function Lk(e,t){return new dn(function(r){var n;return Ro(r,t,function(){n=e[Ck](),Ro(r,t,function(){var a,s,c;try{a=n.next(),s=a.value,c=a.done}catch(l){r.error(l);return}c?r.complete():r.next(s)},0,!0)}),function(){return Ar(n?.return)&&n.return()}})}i(Lk,"scheduleIterable");o(Lk,"scheduleIterable");function a2(e,t){if(!e)throw new Error("Iterable cannot be null");return new dn(function(r){Ro(r,t,function(){var n=e[Symbol.asyncIterator]();Ro(r,t,function(){n.next().then(function(a){a.done?r.complete():r.next(a.value)})},0,!0)})})}i(a2,"scheduleAsyncIterable");o(a2,"scheduleAsyncIterable");function Uk(e,t){return a2(e2(e),t)}i(Uk,"scheduleReadableStreamLike");o(Uk,"scheduleReadableStreamLike");function Fk(e,t){if(e!=null){if(J3(e))return Nk(e,t);if(W3(e))return Bk(e,t);if(Z3(e))return Pk(e,t);if(Y3(e))return a2(e,t);if(Q3(e))return Lk(e,t);if(t2(e))return Uk(e,t)}throw X3(e)}i(Fk,"scheduled");o(Fk,"scheduled");function jk(e,t){return t?Fk(e,t):$o(e)}i(jk,"from3");o(jk,"from");var $k=c1(function(e){return o(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function zk(e){return e instanceof Date&&!isNaN(e)}i(zk,"isValidDate");o(zk,"isValidDate");function o2(e,t){return to(function(r,n){var a=0;r.subscribe(_a(n,function(s){n.next(e.call(t,s,a++))}))})}i(o2,"map");o(o2,"map");var Lq=Array.isArray;function Hk(e,t){return Lq(t)?e.apply(void 0,Ms([],Po(t))):e(t)}i(Hk,"callOrApply");o(Hk,"callOrApply");function qk(e){return o2(function(t){return Hk(e,t)})}i(qk,"mapOneOrManyArgs");o(qk,"mapOneOrManyArgs");function Vk(e,t,r,n,a,s,c,l){var d=[],p=0,g=0,v=!1,y=o(function(){v&&!d.length&&!p&&t.complete()},"checkComplete"),_=o(function(O){return p<n?x(O):d.push(O)},"outerNext"),x=o(function(O){s&&t.next(O),p++;var D=!1;$o(r(O,g++)).subscribe(_a(t,function(L){a?.(L),s?_(L):t.next(L)},function(){D=!0},void 0,function(){if(D)try{p--;for(var L=o(function(){var Z=d.shift();c?Ro(t,c,function(){return x(Z)}):x(Z)},"_loop_1");d.length&&p<n;)L();y()}catch(Z){t.error(Z)}}))},"doInnerSub");return e.subscribe(_a(t,_,function(){v=!0,y()})),function(){l?.()}}i(Vk,"mergeInternals");o(Vk,"mergeInternals");function f1(e,t,r){return r===void 0&&(r=1/0),Ar(t)?f1(function(n,a){return o2(function(s,c){return t(n,s,a,c)})($o(e(n,a)))},r):(typeof t=="number"&&(r=t),to(function(n,a){return Vk(n,a,e,r)}))}i(f1,"mergeMap");o(f1,"mergeMap");function Kk(e){return e===void 0&&(e=1/0),f1(l1,e)}i(Kk,"mergeAll");o(Kk,"mergeAll");var Uq=["addListener","removeListener"],Fq=["addEventListener","removeEventListener"],jq=["on","off"];function Mm(e,t,r,n){if(Ar(r)&&(n=r,r=void 0),n)return Mm(e,t,r).pipe(qk(n));var a=Po(Zk(e)?Fq.map(function(l){return function(d){return e[l](t,d,r)}}):Gk(e)?Uq.map(g6(e,t)):Wk(e)?jq.map(g6(e,t)):[],2),s=a[0],c=a[1];if(!s&&W3(e))return f1(function(l){return Mm(l,t,r)})($o(e));if(!s)throw new TypeError("Invalid event target");return new dn(function(l){var d=o(function(){for(var p=[],g=0;g<arguments.length;g++)p[g]=arguments[g];return l.next(1<p.length?p:p[0])},"handler");return s(d),function(){return c(d)}})}i(Mm,"fromEvent");o(Mm,"fromEvent");function g6(e,t){return function(r){return function(n){return e[r](t,n)}}}i(g6,"toCommonHandlerRegistry");o(g6,"toCommonHandlerRegistry");function Gk(e){return Ar(e.addListener)&&Ar(e.removeListener)}i(Gk,"isNodeStyleEventEmitter");o(Gk,"isNodeStyleEventEmitter");function Wk(e){return Ar(e.on)&&Ar(e.off)}i(Wk,"isJQueryStyleEventEmitter");o(Wk,"isJQueryStyleEventEmitter");function Zk(e){return Ar(e.addEventListener)&&Ar(e.removeEventListener)}i(Zk,"isEventTarget");o(Zk,"isEventTarget");function s2(e,t,r){e===void 0&&(e=0),r===void 0&&(r=Bq);var n=-1;return t!=null&&(K3(t)?r=t:n=t),new dn(function(a){var s=zk(e)?+e-r.now():e;s<0&&(s=0);var c=0;return r.schedule(function(){a.closed||(a.next(c++),0<=n?this.schedule(void 0,n):a.complete())},s)})}i(s2,"timer");o(s2,"timer");function Jk(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Sk(e),n=xk(e,1/0),a=e;return a.length?a.length===1?$o(a[0]):Kk(n)(jk(a,r)):Ak}i(Jk,"merge");o(Jk,"merge");function Yk(e,t){return to(function(r,n){var a=0;r.subscribe(_a(n,function(s){return e.call(t,s,a++)&&n.next(s)}))})}i(Yk,"filter");o(Yk,"filter");function Xk(e){return to(function(t,r){var n=!1;t.subscribe(_a(r,function(a){n=!0,r.next(a)},function(){n||r.next(e),r.complete()}))})}i(Xk,"defaultIfEmpty");o(Xk,"defaultIfEmpty");function Qk(e){return e<=0?function(){return Ak}:to(function(t,r){var n=0;t.subscribe(_a(r,function(a){++n<=e&&(r.next(a),e<=n&&r.complete())}))})}i(Qk,"take");o(Qk,"take");function eD(e){return e===void 0&&(e=tD),to(function(t,r){var n=!1;t.subscribe(_a(r,function(a){n=!0,r.next(a)},function(){return n?r.complete():r.error(e())}))})}i(eD,"throwIfEmpty");o(eD,"throwIfEmpty");function tD(){return new $k}i(tD,"defaultErrorFactory");o(tD,"defaultErrorFactory");function rD(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?Yk(function(a,s){return e(a,s,n)}):l1,Qk(1),r?Xk(t):eD(function(){return new $k}))}}i(rD,"first");o(rD,"first");function nD(e,t){return to(function(r,n){var a=t??{},s=a.leading,c=s===void 0?!0:s,l=a.trailing,d=l===void 0?!1:l,p=!1,g=null,v=null,y=!1,_=o(function(){v?.unsubscribe(),v=null,d&&(D(),y&&n.complete())},"endThrottling"),x=o(function(){v=null,y&&n.complete()},"cleanupThrottling"),O=o(function(L){return v=$o(e(L)).subscribe(_a(n,_,x))},"startThrottle"),D=o(function(){if(p){p=!1;var L=g;g=null,n.next(L),!y&&O(L)}},"send");r.subscribe(_a(n,function(L){p=!0,g=L,!(v&&!v.closed)&&(c?D():O(L))},function(){y=!0,!(d&&p&&v&&!v.closed)&&n.complete()}))})}i(nD,"throttle");o(nD,"throttle");var US;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(US||(US={}));var Im;(function(e){e[e.NOT_REQUESTED=0]="NOT_REQUESTED",e[e.PENDING=1]="PENDING",e[e.PROCESSING=2]="PROCESSING",e[e.ANCHORED=3]="ANCHORED",e[e.FAILED=4]="FAILED"})(Im||(Im={}));var v6;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(v6||(v6={}));var d1=i(class extends dn{constructor(e,t){super(r=>{e.subscribe(r)}),this.state$=e,this._context=t}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:e,content:t}=this.state$.value;return(0,kS.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Er.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Er.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===v6.ANCHOR).map(({cid:e})=>Er.make(this.id,e))}get state(){return(0,kS.default)(this.state$.value)}async sync(e={}){e={sync:ni.PREFER_CACHE,...e};let t=await this.api.loadStream(this.id,e);this.state$.next(t.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}},"Stream");o(d1,"Stream");function h1(){return e=>{}}i(h1,"StreamStatic");o(h1,"StreamStatic");var $q=ir(xz(),1);function iD(e){let t=new AbortController;if(e.length===0)throw Error("Need abort signals to create a merged abort signal");return e.some(r=>r.aborted)?(t.abort(),t.signal):(Jk(...e.map(r=>Mm(r,"abort"))).pipe(rD()).subscribe(()=>{t.abort()}),t.signal)}i(iD,"mergeAbortSignals");o(iD,"mergeAbortSignals");var aD=i(class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=s2(e).subscribe(()=>{t.abort()})}clear(){this._subscription?.unsubscribe()}},"TimedAbortSignal");o(aD,"TimedAbortSignal");async function oD(e,t){let r=new AbortController,n=o(()=>{r.abort()},"onAbort");return e.addEventListener("abort",n),e.aborted&&r.abort(),t(r.signal).finally(()=>{e.removeEventListener("abort",n)})}i(oD,"abortable2");o(oD,"abortable");var zq=60*1e3*3;async function Ai(e,t={}){t.body&&Object.assign(t,{body:JSON.stringify(t.body),headers:{...t.headers,"Content-Type":"application/json"}});let r=t.timeout||zq,n=new aD(r),a=t.signal?iD([t.signal,n.signal]):n.signal,s=await oD(a,c=>(0,$q.default)(String(e),{...t,signal:c})).finally(()=>n.clear());if(!s.ok){let c=await s.text();throw new Error(`HTTP request to '${e}' failed with status '${s.statusText}': ${c}`)}return s.json()}i(Ai,"fetchJson");o(Ai,"fetchJson");var $0=ir(Wd(),1);Ja();function Io(e){let t=Vt.asCID(e);if(t)return t;if(typeof e=="string")return Vt.parse(e);if(e instanceof Uint8Array)return Vt.decode(e);throw new Error(`${e} cannot be converted to a CID`)}i(Io,"toCID");o(Io,"toCID");var FS=0,Hr=i(class{static streamIdFromState(e){return new Xt(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,$0.default)(e);return Hr.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=Ir(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Ir(t.cacaoBlock,"base64")),t):(Hr.isSignedCommit(e)&&(t.link=t.link.toString()),Hr.isAnchorCommit(e)&&(t.proof=t.proof.toString()),t.id&&(t.id=t.id.toString()),t.prev&&(t.prev=t.prev.toString()),e.header?.model&&(t.header.model=Ir(e.header.model,"base64")),t)}static deserializeCommit(e){let t=(0,$0.default)(e);return Hr.isSignedCommitContainer(t)?(t.jws.link=Io(t.jws.link),t.linkedBlock=Cr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Cr(t.cacaoBlock,"base64")),t):(Hr.isSignedCommit(t)&&(t.link=Io(t.link)),Hr.isAnchorCommit(t)&&(t.proof=Io(t.proof)),t.id&&(t.id=Io(t.id)),t.prev&&(t.prev=Io(t.prev)),t.header?.model&&(t.header.model=Cr(t.header.model,"base64")),t)}static serializeState(e){let t=(0,$0.default)(e);return t.log=t.log.map(r=>({...r,cid:r.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=Im[t.anchorStatus]),t.anchorProof!=null&&(t.anchorProof.txHash=t.anchorProof.txHash.toString(),t.anchorProof.root=t.anchorProof.root.toString()),e.metadata?.model&&(t.metadata.model=e.metadata.model.toString()),e.next?.metadata?.model&&(t.next.metadata.model=e.next.metadata.model.toString()),e.metadata?.unique&&e.type!=FS&&(t.metadata.unique=Ir(t.metadata.unique,"base64")),t.doctype=No.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,$0.default)(e);return t.doctype&&(t.type=No.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:Io(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=Io(t.anchorProof.txHash),t.anchorProof.root=Io(t.anchorProof.root)),t.anchorStatus&&(t.anchorStatus=Im[t.anchorStatus]),e.metadata?.model&&(t.metadata.model=Xt.fromString(e.metadata.model)),e.next?.metadata?.model&&(t.next.metadata.model=Xt.fromString(e.next.metadata.model)),e.metadata?.unique&&e.type!=FS&&(t.metadata.unique=Cr(e.metadata.unique,"base64")),t}static statesEqual(e,t){return JSON.stringify(Hr.serializeState(e))===JSON.stringify(Hr.serializeState(t))}static isStateSupersetOf(e,t){if(e.log.length<t.log.length)return!1;for(let r in t.log)if(!e.log[r].cid.equals(t.log[r].cid))return!1;return!(e.log.length===t.log.length&&e.anchorStatus!=t.anchorStatus)}static assertCommitLinksToState(e,t){let r=this.streamIdFromState(e);if(t.id&&!t.id.equals(e.log[0].cid))throw new Error(`Invalid genesis CID in commit for StreamID ${r.toString()}. Found: ${t.id}, expected ${e.log[0].cid}`);let n=e.log[e.log.length-1].cid;if(!t.prev.equals(n))throw new Error(`Commit doesn't properly point to previous commit in log. Expected ${n}, found 'prev' ${t.prev}`)}static async convertCommitToSignedCommitContainer(e,t){if(Hr.isSignedCommit(e)){let r=await t.block.get(e.link);return{jws:e,linkedBlock:r}}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}},"StreamUtils");o(Hr,"StreamUtils");var sD=i(class extends Dq{next(e){let t=this.value;Hr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");o(sD,"StreamStateSubject");var Hq=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate3"),_i,Cb={anchor:!0,publish:!0,pin:!0,sync:ni.PREFER_CACHE},qq={sync:ni.PREFER_CACHE},jS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function em(e,t){if(typeof e?.schema=="string")try{Er.fromString(e.schema)}catch{throw new Error("Schema must be a CommitID")}let r={controllers:e?.controllers,family:e?.family,schema:e?.schema?.toString(),tags:e?.tags};if(t)e?.deterministic||(r.unique=Ir((0,Aq.randomBytes)(12),"base64")),e?.forbidControllerChange&&(r.forbidControllerChange=!0);else{if(e?.deterministic!==void 0||e?.unique!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if(e?.forbidControllerChange!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(r).forEach(n=>r[n]===void 0&&delete r[n]),r}i(em,"headerFromMetadata");o(em,"headerFromMetadata");async function y6(e){if(!e.did)throw new Error("No DID provided");return e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`)),e.did}i(y6,"getAuthenticatedDID");o(y6,"getAuthenticatedDID");async function tm(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(tm,"throwReadOnlyError");o(tm,"throwReadOnlyError");var Bo=_i=o(i(class extends d1{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,Eq.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,a={}){a={...Cb,...a},!n?.deterministic&&a.syncTimeoutSeconds==null&&(a.syncTimeoutSeconds=0);let s=a.asDID?{did:a.asDID}:t,c=await _i.makeGenesis(s,r,n);return t.createStreamFromGenesis(_i.STREAM_TYPE_ID,c,a)}static async createFromGenesis(t,r,n={}){n={...Cb,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=r.data?await _i._signDagJWS(t,r):r;return t.createStreamFromGenesis(_i.STREAM_TYPE_ID,a,n)}static async deterministic(t,r,n={}){if(n={...Cb,...n},r={...r,deterministic:!0},r.family==null&&r.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=await _i.makeGenesis(t,null,r);return t.createStreamFromGenesis(_i.STREAM_TYPE_ID,a,n)}static async load(t,r,n={}){n={...qq,...n};let a=Cs.from(r);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 t.loadStream(a,n)}async update(t,r,n={}){n={...jS,...n};let a=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(a,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...jS,...r};let a={header:em(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await _i._signDagJWS(this.api,a),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=tm,this.patch=tm,this.sync=tm,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let a=await this._makeRawCommit(r,n);return _i._signDagJWS(t,a)}async _makeRawCommit(t,r){r||(r={});let n=em(r,!1);if(t==null&&(t=this.content),n.controllers){if(n.controllers.length!==1)throw new Error("Exactly one controller must be specified");if(!n.controllers[0])throw new Error("Controller cannot be updated to an undefined value.")}let a=WI.compare(this.content,t),s=this.state.log[0];return{header:n,data:a,prev:this.tip,id:s.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await y6(t);n.controllers=[c.hasParent?c.parent:c.id]}else throw new Error("No controllers specified");if(n.controllers?.length!==1)throw new Error("Exactly one controller must be specified");let a=em(n,!0);if(n?.deterministic&&r)throw new Error("Initial content must be null when creating a deterministic Tile document");if(r==null){let c={header:a};return Qm(c),c}let s={data:r,header:a};return _i._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await y6(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");Bo.STREAM_TYPE_NAME="tile";Bo.STREAM_TYPE_ID=0;Bo=_i=Hq([h1()],Bo);var Vq=ir(Tz(),1);function cD(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(cD,"_checkPrivateRedeclaration2");o(cD,"_checkPrivateRedeclaration");function uD(e,t){return t.get?t.get.call(e):t.value}i(uD,"_classApplyDescriptorGet2");o(uD,"_classApplyDescriptorGet");function lD(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(lD,"_classApplyDescriptorSet2");o(lD,"_classApplyDescriptorSet");function c2(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(c2,"_classExtractFieldDescriptor2");o(c2,"_classExtractFieldDescriptor");function rm(e,t){var r=c2(e,t,"get");return uD(e,r)}i(rm,"_classPrivateFieldGet2");o(rm,"_classPrivateFieldGet");function b6(e,t,r){cD(e,t),t.set(e,r)}i(b6,"_classPrivateFieldInit2");o(b6,"_classPrivateFieldInit");function w6(e,t,r){var n=c2(e,t,"set");return lD(e,n,r),r}i(w6,"_classPrivateFieldSet2");o(w6,"_classPrivateFieldSet");function fD(e){return typeof e=="string"||Er.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(fD,"keyToQuery");o(fD,"keyToQuery");function nm(e){return typeof e=="string"?Cs.from(e).toString():Er.isInstance(e)||Xt.isInstance(e)?e.toString():e.streamId.toString()}i(nm,"keyToString");o(nm,"keyToString");async function dD(e){let t=await Bo.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(dD,"getDeterministicQuery");o(dD,"getDeterministicQuery");var Kq=o(()=>Promise.resolve([]),"tempBatchLoadFn"),z0=new WeakMap,Mb=new WeakMap,Gq=i(class extends Vq.default{cache(e){if(!rm(this,Mb))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}async create(e,t,r){let n=await Bo.create(rm(this,z0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await dD(e);try{return await super.load(r)}catch{let a=await Bo.createFromGenesis(rm(this,z0),r.genesis,t);return this.cache(a),a}}async load(e){return await super.load(e)}async update(e,t,r,n){let a=nm(e);this.clear(a);let s=await this.load({streamId:a});return await s.update(t,r,n),s}constructor(e){super(Kq,{cache:!0,cacheKeyFn:nm,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),b6(this,z0,{writable:!0,value:void 0}),b6(this,Mb,{writable:!0,value:void 0}),this._batchLoadFn=async t=>{e.cache||this.clearAll();let r=await e.ceramic.multiQuery(t.map(fD),e.multiqueryTimeout);return t.map(n=>{let a=nm(n),s=r[a];return s||new Error(`Failed to load stream: ${a}`)})},w6(this,z0,e.ceramic),w6(this,Mb,!!e.cache)}},"TileLoader");o(Gq,"TileLoader");function _6(e){return typeof e=="string"?Xt.fromString(e):e}i(_6,"typeStreamID");o(_6,"typeStreamID");function hD(e,t){let r=new URL(e);for(let[n,a]of Object.entries(t))Xt.isInstance(a)?r.searchParams.set(n,a.toString()):typeof a=="object"?r.searchParams.set(n,JSON.stringify(a)):r.searchParams.set(n,a);return r}i(hD,"serializeObjectToSearchParams");o(hD,"serializeObjectToSearchParams");function E6(e){let t={};for(let[r,n]of Object.entries(e))Xt.isInstance(n)?t[r]=n.toString():t[r]=n;return t}i(E6,"serializeObjectForHttpPost");o(E6,"serializeObjectForHttpPost");var Ki=i(class extends dn{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=s2(0,r).pipe(nD(()=>this._syncState(this.id,{sync:ni.PREFER_CACHE}))).subscribe()),this.state$.subscribe(n).add(()=>{this.state$.observers.length===0&&this.periodicSubscription?.unsubscribe()})}),this.state$=new sD(e),this._apiUrl=new URL(t)}get value(){return this.state$.value}get state(){return this.state$.value}next(e){this.state$.next(e)}async _syncState(e,t){let r=await Ki._load(e,this._apiUrl,t);this.state$.next(Hr.deserializeState(r))}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}static async createFromGenesis(e,t,r,n,a){let s=new URL("./streams",e),{state:c}=await Ai(s,{method:"post",body:{type:t,genesis:Hr.serializeCommit(r),opts:n}});return new Ki(Hr.deserializeState(c),e,a)}static async applyCommit(e,t,r,n,a){let s=new URL("./commits",e),{state:c}=await Ai(s,{method:"post",body:{streamId:t.toString(),commit:Hr.serializeCommit(r),opts:n}});return new Ki(Hr.deserializeState(c),e,a)}static async _load(e,t,r){let n=hD(new URL(`./streams/${e}`,t),r),{state:a}=await Ai(n);return a}static async load(e,t,r,n){let a=await Ki._load(e,t,n);return new Ki(Hr.deserializeState(a),t,r)}static async loadStreamCommits(e,t){let r=new URL(`./commits/${e}`,t),{commits:n}=await Ai(r);return n.map(a=>({cid:a.cid,value:Hr.deserializeCommit(a.value)}))}complete(){this.state$.complete()}},"Document");o(Ki,"Document");var Dd;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC",e[e.SYNC_ON_ERROR=3]="SYNC_ON_ERROR"})(Dd||(Dd={}));var $S=ir(Wd(),1),zS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(zS||(zS={}));var A6;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(A6||(A6={}));var pD=i(class extends dn{constructor(e,t){super(r=>{e.subscribe(r)}),this.state$=e,this._context=t}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:e,content:t}=this.state$.value;return(0,$S.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Er.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Er.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===A6.ANCHOR).map(({cid:e})=>Er.make(this.id,e))}get state(){return(0,$S.default)(this.state$.value)}async sync(e={}){e={sync:Dd.PREFER_CACHE,...e};let t=await this.api.loadStream(this.id,e);this.state$.next(t.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}},"Stream2");o(pD,"Stream");function mD(){return e=>{}}i(mD,"StreamStatic2");o(mD,"StreamStatic");function gD(e){if(typeof e=="string"&&e.includes("@")){let[t,r]=e.split("@");if(!t||!r)throw new Error("Invalid accountId provided");return new Td({address:t,chainId:r})}return new Td(e)}i(gD,"normalizeAccountId");o(gD,"normalizeAccountId");var Wq="(?:%[0-9a-fA-F]{2})",HS=`(?:[a-zA-Z0-9._-]|${Wq})`,Zq="([a-z0-9]+)",Jq=`((?:${HS}*:)*(${HS}+))`,qS="[a-zA-Z0-9_.:%-]",Yq=`;${qS}+=${qS}*`,Xq=`((${Yq})*)`,Qq="(/[^#?]*)?",eV="([?][^#]*)?",tV="(#.*)?",rV=new RegExp(`^did:${Zq}:${Jq}${Xq}${Qq}${eV}${tV}$`);function vD(e){if(e===""||!e)return null;let t=e.match(rV);if(t){let r={did:`did:${t[1]}:${t[2]}`,method:t[1],id:t[2],didUrl:e};if(t[4]){let n=t[4].slice(1).split(";");r.params={};for(let a of n){let s=a.split("=");r.params[s[0]]=s[1]}}return t[6]&&(r.path=t[6]),t[7]&&(r.query=t[7].slice(1)),t[8]&&(r.fragment=t[8].slice(1)),r}return null}i(vD,"parse2");o(vD,"parse");var nV=ir(Wd(),1),iV=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate4"),xc,Ib=o(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),VS={anchor:!1,publish:!0,sync:Dd.PREFER_CACHE},kb={anchor:!0,publish:!0},aV={sync:Dd.PREFER_CACHE},al=xc=o(i(class extends pD{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,nV.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...VS,...n};let a=gD(r),s=xc.makeGenesis(a);return xc.fromGenesis(t,s,n)}static async fromGenesis(t,r,n={}){return n={...VS,...n},t.createStreamFromGenesis(xc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...kb,...n};let a=typeof t=="string"?t.trim():t.id;if(vD(a)?.did!==a)throw new Error(`DID is not valid: '${a}'`);let c=await r.createLink(a);return this.setDidProof(c,n)}async setDidProof(t,r={}){r={...kb,...r};let n=this.makeCommit(t),a=await this.api.applyCommit(this.id,n,r);this.state$.next(a.state)}async clearDid(t,r={}){r={...kb,...r};let n=await t.createLink("");return this.setDidProof(n,r)}static async load(t,r,n={}){n={...aV,...n};let a=Cs.from(r);if(a.type!=xc.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${xc.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}static makeGenesis(t){return t.chainId.namespace==="eip155"&&(t.address=t.address.toLowerCase()),{header:{controllers:[`${t.address}@${t.chainId.toString()}`],family:`caip10-${t.chainId.toString()}`}}}makeCommit(t){return{data:t,prev:this.tip,id:this.id.cid}}makeReadOnly(){this.setDidProof=Ib,this.setDid=Ib,this.sync=Ib,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link2"),"Caip10Link");al.STREAM_TYPE_NAME="caip10-link";al.STREAM_TYPE_ID=1;al=xc=iV([mD()],al);Ja();bl();var oV=ir(Lz(),1),sV=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate5"),Va,cV={sync:ni.PREFER_CACHE};async function S6(e){if(e.did==null)throw new Error("No DID provided");e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`))}i(S6,"_ensureAuthenticated");o(S6,"_ensureAuthenticated");async function yD(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(yD,"throwReadOnlyError3");o(yD,"throwReadOnlyError");var Bc=Va=o(i(class extends d1{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:Va.MODEL}}static async create(t,r,n){Va.assertComplete(r);let a={publish:!0,anchor:!0,pin:!0,sync:ni.NEVER_SYNC,throwOnInvalidCommit:!0},s=await Va._makeGenesis(t,r,n);return await t.createStreamFromGenesis(Va.STREAM_TYPE_ID,s,a)}static assertComplete(t,r){if(!t.name)throw r?new Error(`Model with StreamID ${r.toString()} is missing a 'name' field`):new Error("Model is missing a 'name' field");if(!t.schema)throw r?new Error(`Model ${t.name} (${r.toString()}) is missing a 'schema' field`):new Error(`Model ${t.name} is missing a 'schema' field`);if(!t.accountRelation)throw r?new Error(`Model ${t.name} (${r.toString()}) is missing a 'accountRelation' field`):new Error(`Model ${t.name} is missing a 'accountRelation' field`)}static async load(t,r,n={}){n={...cV,...n};let a=Cs.from(r);if(a.type!=Va.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${Va.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return await t.loadStream(a,n)}static async _makeGenesis(t,r,n){let a=await this._makeRawGenesis(t,r,n);return Va._signDagJWS(t,a)}static async _makeRawGenesis(t,r,n){if(r==null)throw new Error("Genesis content cannot be null");if(!n||!n.controller)if(t.did)await S6(t),n={controller:t.did.hasParent?t.did.parent:t.did.id};else throw new Error("No controller specified");let a={controllers:[n.controller],model:Va.MODEL.bytes};return{data:r,header:a}}makeReadOnly(){this.sync=yD,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await S6(t),t.did.createDagJWS(r)}},"Model2"),"Model");Bc.STREAM_TYPE_NAME="model";Bc.STREAM_TYPE_ID=2;Bc.MODEL=function(){let e=Qm("model-v1"),t=oV.default.encode(e,"identity"),r=tl(hm,t),n=Vt.createV1(hm,r);return new Xt("UNLOADABLE",n)}();Bc=Va=sV([h1()],Bc);var uV=ir(El(),1),lV=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate6"),fa,fV={anchor:!0,publish:!0,pin:!0,sync:ni.NEVER_SYNC,syncTimeoutSeconds:0},dV={anchor:!1,publish:!1,pin:!0,sync:ni.PREFER_CACHE},hV={sync:ni.PREFER_CACHE},KS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};async function x6(e){if(e.did==null)throw new Error("No DID provided");e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`))}i(x6,"_ensureAuthenticated2");o(x6,"_ensureAuthenticated");async function im(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(im,"throwReadOnlyError4");o(im,"throwReadOnlyError");var ol=fa=o(i(class extends d1{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let t=this.state$.value.metadata;return{controller:t.controllers[0],model:t.model}}static async create(t,r,n,a={}){a={...fV,...a};let s=a.asDID?{did:a.asDID}:t,c=await fa._makeGenesis(s,r,n);return t.createStreamFromGenesis(fa.STREAM_TYPE_ID,c,a)}static async single(t,r,n={}){n={...dV,...n};let a=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let s=await fa._makeGenesis(a,null,r);return t.createStreamFromGenesis(fa.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...hV,...n};let a=Cs.from(r);if(a.type!=fa.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${fa.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}async replace(t,r={}){r={...KS,...r};let n=r.asDID?{did:r.asDID}:this.api,a=await this._makeCommit(n,t),s=await this.api.applyCommit(this.id,a,r);this.state$.next(s.state)}async patch(t,r={}){r={...KS,...r};let n={data:t,prev:this.tip,id:this.id.cid},a=await fa._signDagJWS(this.api,n),s=await this.api.applyCommit(this.id,a,r);this.state$.next(s.state)}makeReadOnly(){this.replace=im,this.patch=im,this.sync=im,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(t,r){let n=this._makeRawCommit(r);return fa._signDagJWS(t,n)}_makeRawCommit(t){return{data:WI.compare(this.content,t||{}),prev:this.tip,id:this.state.log[0].cid}}static async _makeGenesis(t,r,n){let a=await this._makeRawGenesis(t,r,n);return n.deterministic?(Qm(a),a):fa._signDagJWS(t,a)}static async _makeRawGenesis(t,r,n){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");let a=n.controller;if(!a)if(t.did)await x6(t),a=t.did.hasParent?t.did.parent:t.did.id;else throw new Error("No controller specified");let s={controllers:[a],model:n.model.bytes};return n.deterministic||(s.unique=(0,uV.randomBytes)(12)),{data:r,header:s}}static async _signDagJWS(t,r){return await x6(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");ol.STREAM_TYPE_NAME="MID";ol.STREAM_TYPE_ID=3;ol=fa=lV([h1()],ol);var bD=i(class{constructor(e){this._apiUrl=e}async add(e,t){let r={};t&&(r.force=!0);let n=new URL(`./pins/${e}`,this._apiUrl);await Ai(n,{method:"post",body:r})}async rm(e,t){let r=new URL(`./pins/${e}`,this._apiUrl);await Ai(r,{method:"delete",body:{opts:t}})}async ls(e){let t=new URL("./pins",this._apiUrl);e&&(t=new URL(`./pins/${e.toString()}`,this._apiUrl));let r=await Ai(t),{pinnedStreamIds:n}=r;return{[Symbol.asyncIterator](){let a=0;return{next(){return a===n.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:n[a++],done:!1})}}}}}},"RemotePinApi");o(bD,"RemotePinApi");var wD=i(class{constructor(e){this._fetchJson=Ai,this._collectionURL=new URL("./collection",e),this._countURL=new URL("./collection/count",e)}async count(e){return(await this._fetchJson(this._countURL,{method:"POST",body:E6(e)})).count}async query(e){let t=await this._fetchJson(this._collectionURL,{method:"POST",body:E6(e)});return{edges:t.edges.map(n=>({cursor:n.cursor,node:Hr.deserializeState(n.node)})),pageInfo:t.pageInfo}}},"RemoteIndexApi");o(wD,"RemoteIndexApi");var _D=i(class{constructor(e,t){this._apiUrl=e,this._getDidFn=t,this._fetchJson=Ai,this.modelsPath="./admin/models",this.getCodePath="./admin/getCode"}getCodeUrl(){return new URL(this.getCodePath,this._apiUrl)}getModelsUrl(){return new URL(this.modelsPath,this._apiUrl)}async buildJWS(e,t,r){let n=r?{models:r.map(s=>s.toString())}:void 0,a=await e.createJWS({code:t,requestPath:this.getModelsUrl().pathname,requestBody:n});return`${a.signatures[0].protected}.${a.payload}.${a.signatures[0].signature}`}async generateCode(){return(await this._fetchJson(this.getCodeUrl())).code}async startIndexingModels(e){let t=await this.generateCode();await this._fetchJson(this.getModelsUrl(),{method:"post",body:{jws:await this.buildJWS(this._getDidFn(),t,e)}})}async getIndexedModels(){let e=await this.generateCode();return(await this._fetchJson(this.getModelsUrl(),{headers:{Authorization:`Basic ${await this.buildJWS(this._getDidFn(),e)}`}})).models.map(r=>Xt.fromString(r))}async stopIndexingModels(e){let t=await this.generateCode();await this._fetchJson(this.getModelsUrl(),{method:"delete",body:{jws:await this.buildJWS(this._getDidFn(),t,e)}})}},"RemoteAdminApi");o(_D,"RemoteAdminApi");var pV="/api/v0/",mV="http://localhost:7007",gV={syncInterval:5e3},vV={anchor:!0,publish:!0,sync:ni.PREFER_CACHE},yV={anchor:!0,publish:!0,sync:ni.PREFER_CACHE},GS={sync:ni.PREFER_CACHE},bV=i(class{constructor(e=mV,t={}){this._config={...gV,...t},this._apiUrl=new URL(pV,e),this._streamCache=new Map,this.context={api:this},this.pin=new bD(this._apiUrl),this.index=new wD(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new _D(this._apiUrl,r),this._streamConstructors={[al.STREAM_TYPE_ID]:al,[Bc.STREAM_TYPE_ID]:Bc,[ol.STREAM_TYPE_ID]:ol,[Bo.STREAM_TYPE_ID]:Bo}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...yV,...r};let n=await Ki.createFromGenesis(this._apiUrl,e,t,r,this._config.syncInterval),a=this._streamCache.get(n.id.toString());return a?(Hr.statesEqual(n.state,a.state)||a.next(n.state),this.buildStreamFromDocument(a)):(this._streamCache.set(n.id.toString(),n),this.buildStreamFromDocument(n))}async loadStream(e,t={}){t={...GS,...t};let r=Cs.from(e),n=this._streamCache.get(r.baseID.toString());return n?await n._syncState(r,t):(n=await Ki.load(r,this._apiUrl,this._config.syncInterval,t),this._streamCache.set(n.id.toString(),n)),this.buildStreamFromDocument(n)}async multiQuery(e,t){let r=e.map(s=>({...s,streamId:typeof s.streamId=="string"?s.streamId:s.streamId.toString()})),n=new URL("./multiqueries",this._apiUrl),a=await Ai(n,{method:"post",body:{queries:r,timeout:t}});return Object.entries(a).reduce((s,c)=>{let[l,d]=c,p=Hr.deserializeState(d),g=new Ki(p,this._apiUrl,this._config.syncInterval);return s[l]=this.buildStreamFromDocument(g),s},{})}loadStreamCommits(e){let t=_6(e);return Ki.loadStreamCommits(t,this._apiUrl)}async applyCommit(e,t,r={}){r={...vV,...r};let n=_6(e),a=await Ki.applyCommit(this._apiUrl,n,t,r,this._config.syncInterval),s=this._streamCache.get(n.toString());return s?(s.next(a.state),this.buildStreamFromDocument(a)):(this._streamCache.set(n.toString(),a),this.buildStreamFromDocument(a))}async requestAnchor(e,t={}){t={...GS,...t};let{anchorStatus:r}=await Ai(`${this._apiUrl}/streams/${e.toString()}/anchor`,{method:"post",body:{opts:t}});return r}addStreamHandler(e){this._streamConstructors[e.name]=e.stream_constructor}buildStreamFromState(e){let t=new Ki(e,this._apiUrl,this._config.syncInterval);return this.buildStreamFromDocument(t)}buildStreamFromDocument(e){let t=e.state.type,r=this._streamConstructors[t];if(!r)throw new Error(`Failed to find constructor for stream ${t}`);return new r(e,this.context)}async setDID(e){this.context.did=e}async getSupportedChains(){if(this._supportedChains)return this._supportedChains;let{supportedChains:e}=await Ai(this._apiUrl+"/node/chains");return this._supportedChains=e,e}async close(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()}},"CeramicClient");o(bV,"CeramicClient");var nr;(function(e){e.assertEqual=a=>a;function t(a){}i(t,"assertIs"),o(t,"assertIs"),e.assertIs=t;function r(a){throw new Error}i(r,"assertNever"),o(r,"assertNever"),e.assertNever=r,e.arrayToEnum=a=>{let s={};for(let c of a)s[c]=c;return s},e.getValidEnumValues=a=>{let s=e.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),c={};for(let l of s)c[l]=a[l];return e.objectValues(c)},e.objectValues=a=>e.objectKeys(a).map(function(s){return a[s]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&s.push(c);return s},e.find=(a,s)=>{for(let c of a)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),o(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(nr||(nr={}));var T6;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(T6||(T6={}));var it=nr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ws=o(e=>{switch(typeof e){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(e)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(e)?it.array:e===null?it.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?it.promise:typeof Map<"u"&&e instanceof Map?it.map:typeof Set<"u"&&e instanceof Set?it.set:typeof Date<"u"&&e instanceof Date?it.date:it.object;default:return it.unknown}},"getParsedType"),Ve=nr.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),wV=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Si=i(class extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},r={_errors:[]},n=o(a=>{for(let s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let c=r,l=0;for(;l<s.path.length;){let d=s.path[l];l===s.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(s))):c[d]=c[d]||{_errors:[]},c=c[d],l++}}},"processError");return n(this),r}static assert(e){if(!(e instanceof Si))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,nr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}},"ZodError");o(Si,"ZodError");Si.create=e=>new Si(e);var sl=o((e,t)=>{let r;switch(e.code){case Ve.invalid_type:e.received===it.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ve.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,nr.jsonStringifyReplacer)}`;break;case Ve.unrecognized_keys:r=`Unrecognized key(s) in object: ${nr.joinValues(e.keys,", ")}`;break;case Ve.invalid_union:r="Invalid input";break;case Ve.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${nr.joinValues(e.options)}`;break;case Ve.invalid_enum_value:r=`Invalid enum value. Expected ${nr.joinValues(e.options)}, received '${e.received}'`;break;case Ve.invalid_arguments:r="Invalid function arguments";break;case Ve.invalid_return_type:r="Invalid function return type";break;case Ve.invalid_date:r="Invalid date";break;case Ve.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:nr.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Ve.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Ve.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Ve.custom:r="Invalid input";break;case Ve.invalid_intersection_types:r="Intersection results could not be merged";break;case Ve.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ve.not_finite:r="Number must be finite";break;default:r=t.defaultError,nr.assertNever(e)}return{message:r}},"errorMap"),ED=sl;function AD(e){ED=e}i(AD,"setErrorMap");o(AD,"setErrorMap");function Rd(){return ED}i(Rd,"getErrorMap");o(Rd,"getErrorMap");var km=o(e=>{let{data:t,path:r,errorMaps:n,issueData:a}=e,s=[...r,...a.path||[]],c={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let l="",d=n.filter(p=>!!p).slice().reverse();for(let p of d)l=p(c,{data:t,defaultError:l}).message;return{...a,path:s,message:l}},"makeIssue"),_V=[];function Qe(e,t){let r=Rd(),n=km({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===sl?void 0:sl].filter(a=>!!a)});e.common.issues.push(n)}i(Qe,"addIssueToContext");o(Qe,"addIssueToContext");var xn=i(class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return kt;n.status==="dirty"&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let a=await n.key,s=await n.value;r.push({key:a,value:s})}return xn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:a,value:s}=n;if(a.status==="aborted"||s.status==="aborted")return kt;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(r[a.value]=s.value)}return{status:e.value,value:r}}},"ParseStatus");o(xn,"ParseStatus");var kt=Object.freeze({status:"aborted"}),Ju=o(e=>({status:"dirty",value:e}),"DIRTY"),Un=o(e=>({status:"valid",value:e}),"OK"),C6=o(e=>e.status==="aborted","isAborted"),M6=o(e=>e.status==="dirty","isDirty"),Od=o(e=>e.status==="valid","isValid"),Nd=o(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");function Pd(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)}i(Pd,"__classPrivateFieldGet2");o(Pd,"__classPrivateFieldGet");function u2(e,t,r,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(e,r):a?a.value=r:t.set(e,r),r}i(u2,"__classPrivateFieldSet2");o(u2,"__classPrivateFieldSet");var wt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(wt||(wt={}));var md,gd,Ea=i(class{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},"ParseInputLazyPath");o(Ea,"ParseInputLazyPath");var WS=o((e,t)=>{if(Od(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Si(e.common.issues);return this._error=r,this._error}}},"handleResult");function Ut(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:o((c,l)=>{var d,p;let{message:g}=e;return c.code==="invalid_enum_value"?{message:g??l.defaultError}:typeof l.data>"u"?{message:(d=g??n)!==null&&d!==void 0?d:l.defaultError}:c.code!=="invalid_type"?{message:l.defaultError}:{message:(p=g??r)!==null&&p!==void 0?p:l.defaultError}},"customMap"),description:a}}i(Ut,"processCreateParams");o(Ut,"processCreateParams");var zt=i(class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return ws(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ws(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xn,ctx:{common:e.parent.common,data:e.data,parsedType:ws(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Nd(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:(r=t?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ws(e)},a=this._parseSync({data:e,path:n.path,parent:n});return WS(n,a)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ws(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(Nd(n)?n:Promise.resolve(n));return WS(r,a)}refine(e,t){let r=o(n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t,"getIssueProperties");return this._refinement((n,a)=>{let s=e(n),c=o(()=>a.addIssue({code:Ve.custom,...r(n)}),"setError");return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(c(),!1)):s?!0:(c(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new Wi({schema:this,typeName:Mt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return wa.create(this,this._def)}nullable(){return Lo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ba.create(this,this._def)}promise(){return jc.create(this,this._def)}or(e){return fl.create([this,e],this._def)}and(e){return dl.create(this,e,this._def)}transform(e){return new Wi({...Ut(this._def),schema:this,typeName:Mt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new gl({...Ut(this._def),innerType:this,defaultValue:t,typeName:Mt.ZodDefault})}brand(){return new m1({typeName:Mt.ZodBranded,type:this,...Ut(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new vl({...Ut(this._def),innerType:this,catchValue:t,typeName:Mt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ih.create(this,e)}readonly(){return yl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},"ZodType");o(zt,"ZodType");var EV=/^c[^\s-]{8,}$/i,AV=/^[0-9a-z]+$/,SV=/^[0-9A-HJKMNP-TV-Z]{26}$/,xV=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,TV=/^[a-z0-9_-]{21}$/i,CV=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,MV=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,IV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Db,kV=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,DV=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,RV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,SD="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",OV=new RegExp(`^${SD}$`);function l2(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}i(l2,"timeRegexSource");o(l2,"timeRegexSource");function xD(e){return new RegExp(`^${l2(e)}$`)}i(xD,"timeRegex");o(xD,"timeRegex");function f2(e){let t=`${SD}T${l2(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}i(f2,"datetimeRegex");o(f2,"datetimeRegex");function TD(e,t){return!!((t==="v4"||!t)&&kV.test(e)||(t==="v6"||!t)&&DV.test(e))}i(TD,"isValidIP");o(TD,"isValidIP");var va=i(class extends zt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==it.string){let a=this._getOrReturnCtx(e);return Qe(a,{code:Ve.invalid_type,expected:it.string,received:a.parsedType}),kt}let r=new xn,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let s=e.data.length>a.value,c=e.data.length<a.value;(s||c)&&(n=this._getOrReturnCtx(e,n),s?Qe(n,{code:Ve.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&Qe(n,{code:Ve.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")MV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"email",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Db||(Db=new RegExp(IV,"u")),Db.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"emoji",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")xV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"uuid",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")TV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"nanoid",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")EV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"cuid",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")AV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"cuid2",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")SV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"ulid",code:Ve.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),Qe(n,{validation:"url",code:Ve.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"regex",code:Ve.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?f2(a).test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?OV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?xD(a).test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?CV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"duration",code:Ve.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?TD(e.data,a.version)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"ip",code:Ve.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?RV.test(e.data)||(n=this._getOrReturnCtx(e,n),Qe(n,{validation:"base64",code:Ve.invalid_string,message:a.message}),r.dirty()):nr.assertNever(a);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(n=>e.test(n),{validation:t,code:Ve.invalid_string,...wt.errToObj(r)})}_addCheck(e){return new va({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...wt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...wt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...wt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...wt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...wt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...wt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...wt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...wt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...wt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...wt.errToObj(e)})}datetime(e){var t,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(r=e?.local)!==null&&r!==void 0?r:!1,...wt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...wt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...wt.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...wt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...wt.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...wt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...wt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...wt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...wt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...wt.errToObj(t)})}nonempty(e){return this.min(1,wt.errToObj(e))}trim(){return new va({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new va({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new va({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}},"ZodString");o(va,"ZodString");va.create=e=>{var t;return new va({checks:[],typeName:Mt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Ut(e)})};function CD(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(e.toFixed(a).replace(".","")),c=parseInt(t.toFixed(a).replace(".",""));return s%c/Math.pow(10,a)}i(CD,"floatSafeRemainder");o(CD,"floatSafeRemainder");var Is=i(class extends zt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==it.number){let a=this._getOrReturnCtx(e);return Qe(a,{code:Ve.invalid_type,expected:it.number,received:a.parsedType}),kt}let r,n=new xn;for(let a of this._def.checks)a.kind==="int"?nr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?CD(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.not_finite,message:a.message}),n.dirty()):nr.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,wt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,wt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,wt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,wt.toString(t))}setLimit(e,t,r,n){return new Is({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:wt.toString(n)}]})}_addCheck(e){return new Is({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:wt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:wt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:wt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:wt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:wt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:wt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:wt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:wt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:wt.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&nr.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}},"ZodNumber");o(Is,"ZodNumber");Is.create=e=>new Is({checks:[],typeName:Mt.ZodNumber,coerce:e?.coerce||!1,...Ut(e)});var ks=i(class extends zt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==it.bigint){let a=this._getOrReturnCtx(e);return Qe(a,{code:Ve.invalid_type,expected:it.bigint,received:a.parsedType}),kt}let r,n=new xn;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Qe(r,{code:Ve.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):nr.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,wt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,wt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,wt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,wt.toString(t))}setLimit(e,t,r,n){return new ks({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:wt.toString(n)}]})}_addCheck(e){return new ks({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:wt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:wt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:wt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:wt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:wt.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}},"ZodBigInt");o(ks,"ZodBigInt");ks.create=e=>{var t;return new ks({checks:[],typeName:Mt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Ut(e)})};var cl=i(class extends zt{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==it.boolean){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.boolean,received:r.parsedType}),kt}return Un(e.data)}},"ZodBoolean");o(cl,"ZodBoolean");cl.create=e=>new cl({typeName:Mt.ZodBoolean,coerce:e?.coerce||!1,...Ut(e)});var Lc=i(class extends zt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==it.date){let a=this._getOrReturnCtx(e);return Qe(a,{code:Ve.invalid_type,expected:it.date,received:a.parsedType}),kt}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return Qe(a,{code:Ve.invalid_date}),kt}let r=new xn,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),Qe(n,{code:Ve.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):nr.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Lc({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:wt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:wt.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}},"ZodDate");o(Lc,"ZodDate");Lc.create=e=>new Lc({checks:[],coerce:e?.coerce||!1,typeName:Mt.ZodDate,...Ut(e)});var Bd=i(class extends zt{_parse(e){if(this._getType(e)!==it.symbol){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.symbol,received:r.parsedType}),kt}return Un(e.data)}},"ZodSymbol");o(Bd,"ZodSymbol");Bd.create=e=>new Bd({typeName:Mt.ZodSymbol,...Ut(e)});var ul=i(class extends zt{_parse(e){if(this._getType(e)!==it.undefined){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.undefined,received:r.parsedType}),kt}return Un(e.data)}},"ZodUndefined");o(ul,"ZodUndefined");ul.create=e=>new ul({typeName:Mt.ZodUndefined,...Ut(e)});var ll=i(class extends zt{_parse(e){if(this._getType(e)!==it.null){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.null,received:r.parsedType}),kt}return Un(e.data)}},"ZodNull");o(ll,"ZodNull");ll.create=e=>new ll({typeName:Mt.ZodNull,...Ut(e)});var Uc=i(class extends zt{constructor(){super(...arguments),this._any=!0}_parse(e){return Un(e.data)}},"ZodAny");o(Uc,"ZodAny");Uc.create=e=>new Uc({typeName:Mt.ZodAny,...Ut(e)});var Es=i(class extends zt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Un(e.data)}},"ZodUnknown");o(Es,"ZodUnknown");Es.create=e=>new Es({typeName:Mt.ZodUnknown,...Ut(e)});var Ka=i(class extends zt{_parse(e){let t=this._getOrReturnCtx(e);return Qe(t,{code:Ve.invalid_type,expected:it.never,received:t.parsedType}),kt}},"ZodNever");o(Ka,"ZodNever");Ka.create=e=>new Ka({typeName:Mt.ZodNever,...Ut(e)});var Ld=i(class extends zt{_parse(e){if(this._getType(e)!==it.undefined){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.void,received:r.parsedType}),kt}return Un(e.data)}},"ZodVoid");o(Ld,"ZodVoid");Ld.create=e=>new Ld({typeName:Mt.ZodVoid,...Ut(e)});var ba=i(class extends zt{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==it.array)return Qe(t,{code:Ve.invalid_type,expected:it.array,received:t.parsedType}),kt;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,c=t.data.length<n.exactLength.value;(s||c)&&(Qe(t,{code:s?Ve.too_big:Ve.too_small,minimum:c?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(Qe(t,{code:Ve.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(Qe(t,{code:Ve.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((s,c)=>n.type._parseAsync(new Ea(t,s,t.path,c)))).then(s=>xn.mergeArray(r,s));let a=[...t.data].map((s,c)=>n.type._parseSync(new Ea(t,s,t.path,c)));return xn.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new ba({...this._def,minLength:{value:e,message:wt.toString(t)}})}max(e,t){return new ba({...this._def,maxLength:{value:e,message:wt.toString(t)}})}length(e,t){return new ba({...this._def,exactLength:{value:e,message:wt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");o(ba,"ZodArray");ba.create=(e,t)=>new ba({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Mt.ZodArray,...Ut(t)});function Cc(e){if(e instanceof Rr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=wa.create(Cc(n))}return new Rr({...e._def,shape:()=>t})}else return e instanceof ba?new ba({...e._def,type:Cc(e.element)}):e instanceof wa?wa.create(Cc(e.unwrap())):e instanceof Lo?Lo.create(Cc(e.unwrap())):e instanceof Ga?Ga.create(e.items.map(t=>Cc(t))):e}i(Cc,"deepPartialify");o(Cc,"deepPartialify");var Rr=i(class extends zt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=nr.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==it.object){let d=this._getOrReturnCtx(e);return Qe(d,{code:Ve.invalid_type,expected:it.object,received:d.parsedType}),kt}let{status:r,ctx:n}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof Ka&&this._def.unknownKeys==="strip"))for(let d in n.data)s.includes(d)||c.push(d);let l=[];for(let d of s){let p=a[d],g=n.data[d];l.push({key:{status:"valid",value:d},value:p._parse(new Ea(n,g,n.path,d)),alwaysSet:d in n.data})}if(this._def.catchall instanceof Ka){let d=this._def.unknownKeys;if(d==="passthrough")for(let p of c)l.push({key:{status:"valid",value:p},value:{status:"valid",value:n.data[p]}});else if(d==="strict")c.length>0&&(Qe(n,{code:Ve.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let p of c){let g=n.data[p];l.push({key:{status:"valid",value:p},value:d._parse(new Ea(n,g,n.path,p)),alwaysSet:p in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let d=[];for(let p of l){let g=await p.key,v=await p.value;d.push({key:g,value:v,alwaysSet:p.alwaysSet})}return d}).then(d=>xn.mergeObjectSync(r,d)):xn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return wt.errToObj,new Rr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,a,s,c;let l=(s=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,r).message)!==null&&s!==void 0?s:r.defaultError;return t.code==="unrecognized_keys"?{message:(c=wt.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Rr({...this._def,unknownKeys:"strip"})}passthrough(){return new Rr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Rr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Rr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Mt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Rr({...this._def,catchall:e})}pick(e){let t={};return nr.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new Rr({...this._def,shape:()=>t})}omit(e){let t={};return nr.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new Rr({...this._def,shape:()=>t})}deepPartial(){return Cc(this)}partial(e){let t={};return nr.objectKeys(this.shape).forEach(r=>{let n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()}),new Rr({...this._def,shape:()=>t})}required(e){let t={};return nr.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof wa;)a=a._def.innerType;t[r]=a}}),new Rr({...this._def,shape:()=>t})}keyof(){return d2(nr.objectKeys(this.shape))}},"ZodObject");o(Rr,"ZodObject");Rr.create=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strip",catchall:Ka.create(),typeName:Mt.ZodObject,...Ut(t)});Rr.strictCreate=(e,t)=>new Rr({shape:()=>e,unknownKeys:"strict",catchall:Ka.create(),typeName:Mt.ZodObject,...Ut(t)});Rr.lazycreate=(e,t)=>new Rr({shape:e,unknownKeys:"strip",catchall:Ka.create(),typeName:Mt.ZodObject,...Ut(t)});var fl=i(class extends zt{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(a){for(let c of a)if(c.result.status==="valid")return c.result;for(let c of a)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let s=a.map(c=>new Si(c.ctx.common.issues));return Qe(t,{code:Ve.invalid_union,unionErrors:s}),kt}if(i(n,"handleResults"),o(n,"handleResults"),t.common.async)return Promise.all(r.map(async a=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);{let a,s=[];for(let l of r){let d={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let c=s.map(l=>new Si(l));return Qe(t,{code:Ve.invalid_union,unionErrors:c}),kt}}get options(){return this._def.options}},"ZodUnion");o(fl,"ZodUnion");fl.create=(e,t)=>new fl({options:e,typeName:Mt.ZodUnion,...Ut(t)});var ko=o(e=>e instanceof hl?ko(e.schema):e instanceof Wi?ko(e.innerType()):e instanceof pl?[e.value]:e instanceof Ds?e.options:e instanceof ml?nr.objectValues(e.enum):e instanceof gl?ko(e._def.innerType):e instanceof ul?[void 0]:e instanceof ll?[null]:e instanceof wa?[void 0,...ko(e.unwrap())]:e instanceof Lo?[null,...ko(e.unwrap())]:e instanceof m1||e instanceof yl?ko(e.unwrap()):e instanceof vl?ko(e._def.innerType):[],"getDiscriminator"),p1=i(class extends zt{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.object)return Qe(t,{code:Ve.invalid_type,expected:it.object,received:t.parsedType}),kt;let r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(Qe(t,{code:Ve.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),kt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let a of t){let s=ko(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of s){if(n.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);n.set(c,a)}}return new p1({typeName:Mt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...Ut(r)})}},"ZodDiscriminatedUnion");o(p1,"ZodDiscriminatedUnion");function Dm(e,t){let r=ws(e),n=ws(t);if(e===t)return{valid:!0,data:e};if(r===it.object&&n===it.object){let a=nr.objectKeys(t),s=nr.objectKeys(e).filter(l=>a.indexOf(l)!==-1),c={...e,...t};for(let l of s){let d=Dm(e[l],t[l]);if(!d.valid)return{valid:!1};c[l]=d.data}return{valid:!0,data:c}}else if(r===it.array&&n===it.array){if(e.length!==t.length)return{valid:!1};let a=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],d=Dm(c,l);if(!d.valid)return{valid:!1};a.push(d.data)}return{valid:!0,data:a}}else return r===it.date&&n===it.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Dm,"mergeValues");o(Dm,"mergeValues");var dl=i(class extends zt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=o((a,s)=>{if(C6(a)||C6(s))return kt;let c=Dm(a.value,s.value);return c.valid?((M6(a)||M6(s))&&t.dirty(),{status:t.value,value:c.data}):(Qe(r,{code:Ve.invalid_intersection_types}),kt)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,s])=>n(a,s)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}},"ZodIntersection");o(dl,"ZodIntersection");dl.create=(e,t,r)=>new dl({left:e,right:t,typeName:Mt.ZodIntersection,...Ut(r)});var Ga=i(class extends zt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==it.array)return Qe(r,{code:Ve.invalid_type,expected:it.array,received:r.parsedType}),kt;if(r.data.length<this._def.items.length)return Qe(r,{code:Ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),kt;!this._def.rest&&r.data.length>this._def.items.length&&(Qe(r,{code:Ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((s,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new Ea(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(a).then(s=>xn.mergeArray(t,s)):xn.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Ga({...this._def,rest:e})}},"ZodTuple");o(Ga,"ZodTuple");Ga.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ga({items:e,typeName:Mt.ZodTuple,rest:null,...Ut(t)})};var Ud=i(class extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==it.object)return Qe(r,{code:Ve.invalid_type,expected:it.object,received:r.parsedType}),kt;let n=[],a=this._def.keyType,s=this._def.valueType;for(let c in r.data)n.push({key:a._parse(new Ea(r,c,r.path,c)),value:s._parse(new Ea(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?xn.mergeObjectAsync(t,n):xn.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof zt?new Ud({keyType:e,valueType:t,typeName:Mt.ZodRecord,...Ut(r)}):new Ud({keyType:va.create(),valueType:e,typeName:Mt.ZodRecord,...Ut(t)})}},"ZodRecord");o(Ud,"ZodRecord");var Fd=i(class extends zt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==it.map)return Qe(r,{code:Ve.invalid_type,expected:it.map,received:r.parsedType}),kt;let n=this._def.keyType,a=this._def.valueType,s=[...r.data.entries()].map(([c,l],d)=>({key:n._parse(new Ea(r,c,r.path,[d,"key"])),value:a._parse(new Ea(r,l,r.path,[d,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of s){let d=await l.key,p=await l.value;if(d.status==="aborted"||p.status==="aborted")return kt;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(d.value,p.value)}return{status:t.value,value:c}})}else{let c=new Map;for(let l of s){let d=l.key,p=l.value;if(d.status==="aborted"||p.status==="aborted")return kt;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(d.value,p.value)}return{status:t.value,value:c}}}},"ZodMap");o(Fd,"ZodMap");Fd.create=(e,t,r)=>new Fd({valueType:t,keyType:e,typeName:Mt.ZodMap,...Ut(r)});var Fc=i(class extends zt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==it.set)return Qe(r,{code:Ve.invalid_type,expected:it.set,received:r.parsedType}),kt;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(Qe(r,{code:Ve.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&(Qe(r,{code:Ve.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function s(l){let d=new Set;for(let p of l){if(p.status==="aborted")return kt;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}i(s,"finalizeSet"),o(s,"finalizeSet");let c=[...r.data.values()].map((l,d)=>a._parse(new Ea(r,l,r.path,d)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,t){return new Fc({...this._def,minSize:{value:e,message:wt.toString(t)}})}max(e,t){return new Fc({...this._def,maxSize:{value:e,message:wt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}},"ZodSet");o(Fc,"ZodSet");Fc.create=(e,t)=>new Fc({valueType:e,minSize:null,maxSize:null,typeName:Mt.ZodSet,...Ut(t)});var Xu=i(class extends zt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.function)return Qe(t,{code:Ve.invalid_type,expected:it.function,received:t.parsedType}),kt;function r(c,l){return km({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rd(),sl].filter(d=>!!d),issueData:{code:Ve.invalid_arguments,argumentsError:l}})}i(r,"makeArgsIssue"),o(r,"makeArgsIssue");function n(c,l){return km({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rd(),sl].filter(d=>!!d),issueData:{code:Ve.invalid_return_type,returnTypeError:l}})}i(n,"makeReturnsIssue"),o(n,"makeReturnsIssue");let a={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof jc){let c=this;return Un(async function(...l){let d=new Si([]),p=await c._def.args.parseAsync(l,a).catch(y=>{throw d.addIssue(r(l,y)),d}),g=await Reflect.apply(s,this,p);return await c._def.returns._def.type.parseAsync(g,a).catch(y=>{throw d.addIssue(n(g,y)),d})})}else{let c=this;return Un(function(...l){let d=c._def.args.safeParse(l,a);if(!d.success)throw new Si([r(l,d.error)]);let p=Reflect.apply(s,this,d.data),g=c._def.returns.safeParse(p,a);if(!g.success)throw new Si([n(p,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Xu({...this._def,args:Ga.create(e).rest(Es.create())})}returns(e){return new Xu({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Xu({args:e||Ga.create([]).rest(Es.create()),returns:t||Es.create(),typeName:Mt.ZodFunction,...Ut(r)})}},"ZodFunction");o(Xu,"ZodFunction");var hl=i(class extends zt{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})}},"ZodLazy");o(hl,"ZodLazy");hl.create=(e,t)=>new hl({getter:e,typeName:Mt.ZodLazy,...Ut(t)});var pl=i(class extends zt{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Qe(t,{received:t.data,code:Ve.invalid_literal,expected:this._def.value}),kt}return{status:"valid",value:e.data}}get value(){return this._def.value}},"ZodLiteral");o(pl,"ZodLiteral");pl.create=(e,t)=>new pl({value:e,typeName:Mt.ZodLiteral,...Ut(t)});function d2(e,t){return new Ds({values:e,typeName:Mt.ZodEnum,...Ut(t)})}i(d2,"createZodEnum");o(d2,"createZodEnum");var Ds=i(class extends zt{constructor(){super(...arguments),md.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return Qe(t,{expected:nr.joinValues(r),received:t.parsedType,code:Ve.invalid_type}),kt}if(Pd(this,md,"f")||u2(this,md,new Set(this._def.values),"f"),!Pd(this,md,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return Qe(t,{received:t.data,code:Ve.invalid_enum_value,options:r}),kt}return Un(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ds.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ds.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}},"ZodEnum");o(Ds,"ZodEnum");md=new WeakMap;Ds.create=d2;var ml=i(class extends zt{constructor(){super(...arguments),gd.set(this,void 0)}_parse(e){let t=nr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==it.string&&r.parsedType!==it.number){let n=nr.objectValues(t);return Qe(r,{expected:nr.joinValues(n),received:r.parsedType,code:Ve.invalid_type}),kt}if(Pd(this,gd,"f")||u2(this,gd,new Set(nr.getValidEnumValues(this._def.values)),"f"),!Pd(this,gd,"f").has(e.data)){let n=nr.objectValues(t);return Qe(r,{received:r.data,code:Ve.invalid_enum_value,options:n}),kt}return Un(e.data)}get enum(){return this._def.values}},"ZodNativeEnum");o(ml,"ZodNativeEnum");gd=new WeakMap;ml.create=(e,t)=>new ml({values:e,typeName:Mt.ZodNativeEnum,...Ut(t)});var jc=i(class extends zt{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==it.promise&&t.common.async===!1)return Qe(t,{code:Ve.invalid_type,expected:it.promise,received:t.parsedType}),kt;let r=t.parsedType===it.promise?t.data:Promise.resolve(t.data);return Un(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}},"ZodPromise");o(jc,"ZodPromise");jc.create=(e,t)=>new jc({type:e,typeName:Mt.ZodPromise,...Ut(t)});var Wi=i(class extends zt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Mt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:s=>{Qe(r,s),s.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let s=n.transform(r.data,a);if(r.common.async)return Promise.resolve(s).then(async c=>{if(t.value==="aborted")return kt;let l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?kt:l.status==="dirty"||t.value==="dirty"?Ju(l.value):l});{if(t.value==="aborted")return kt;let c=this._def.schema._parseSync({data:s,path:r.path,parent:r});return c.status==="aborted"?kt:c.status==="dirty"||t.value==="dirty"?Ju(c.value):c}}if(n.type==="refinement"){let s=o(c=>{let l=n.refinement(c,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c},"executeRefinement");if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?kt:(c.status==="dirty"&&t.dirty(),s(c.value),{status:t.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?kt:(c.status==="dirty"&&t.dirty(),s(c.value).then(()=>({status:t.value,value:c.value}))))}if(n.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Od(s))return s;let c=n.transform(s.value,a);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>Od(s)?Promise.resolve(n.transform(s.value,a)).then(c=>({status:t.value,value:c})):s);nr.assertNever(n)}},"ZodEffects");o(Wi,"ZodEffects");Wi.create=(e,t,r)=>new Wi({schema:e,typeName:Mt.ZodEffects,effect:t,...Ut(r)});Wi.createWithPreprocess=(e,t,r)=>new Wi({schema:t,effect:{type:"preprocess",transform:e},typeName:Mt.ZodEffects,...Ut(r)});var wa=i(class extends zt{_parse(e){return this._getType(e)===it.undefined?Un(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodOptional");o(wa,"ZodOptional");wa.create=(e,t)=>new wa({innerType:e,typeName:Mt.ZodOptional,...Ut(t)});var Lo=i(class extends zt{_parse(e){return this._getType(e)===it.null?Un(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodNullable");o(Lo,"ZodNullable");Lo.create=(e,t)=>new Lo({innerType:e,typeName:Mt.ZodNullable,...Ut(t)});var gl=i(class extends zt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===it.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}},"ZodDefault");o(gl,"ZodDefault");gl.create=(e,t)=>new gl({innerType:e,typeName:Mt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ut(t)});var vl=i(class extends zt{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Nd(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Si(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Si(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}},"ZodCatch");o(vl,"ZodCatch");vl.create=(e,t)=>new vl({innerType:e,typeName:Mt.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ut(t)});var jd=i(class extends zt{_parse(e){if(this._getType(e)!==it.nan){let r=this._getOrReturnCtx(e);return Qe(r,{code:Ve.invalid_type,expected:it.nan,received:r.parsedType}),kt}return{status:"valid",value:e.data}}},"ZodNaN");o(jd,"ZodNaN");jd.create=e=>new jd({typeName:Mt.ZodNaN,...Ut(e)});var NV=Symbol("zod_brand"),m1=i(class extends zt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},"ZodBranded");o(m1,"ZodBranded");var ih=i(class extends zt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return o(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?kt:a.status==="dirty"?(t.dirty(),Ju(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})},"handleAsync")();{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?kt:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new ih({in:e,out:t,typeName:Mt.ZodPipeline})}},"ZodPipeline");o(ih,"ZodPipeline");var yl=i(class extends zt{_parse(e){let t=this._def.innerType._parse(e),r=o(n=>(Od(n)&&(n.value=Object.freeze(n.value)),n),"freeze");return Nd(t)?t.then(n=>r(n)):r(t)}unwrap(){return this._def.innerType}},"ZodReadonly");o(yl,"ZodReadonly");yl.create=(e,t)=>new yl({innerType:e,typeName:Mt.ZodReadonly,...Ut(t)});function h2(e,t={},r){return e?Uc.create().superRefine((n,a)=>{var s,c;if(!e(n)){let l=typeof t=="function"?t(n):typeof t=="string"?{message:t}:t,d=(c=(s=l.fatal)!==null&&s!==void 0?s:r)!==null&&c!==void 0?c:!0,p=typeof l=="string"?{message:l}:l;a.addIssue({code:"custom",...p,fatal:d})}}):Uc.create()}i(h2,"custom");o(h2,"custom");var PV={object:Rr.lazycreate},Mt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Mt||(Mt={}));var BV=o((e,t={message:`Input not instance of ${e.name}`})=>h2(r=>r instanceof e,t),"instanceOfType"),MD=va.create,ID=Is.create,LV=jd.create,UV=ks.create,kD=cl.create,FV=Lc.create,jV=Bd.create,$V=ul.create,zV=ll.create,HV=Uc.create,qV=Es.create,VV=Ka.create,KV=Ld.create,GV=ba.create,WV=Rr.create,ZV=Rr.strictCreate,JV=fl.create,YV=p1.create,XV=dl.create,QV=Ga.create,eK=Ud.create,tK=Fd.create,rK=Fc.create,nK=Xu.create,iK=hl.create,aK=pl.create,oK=Ds.create,sK=ml.create,cK=jc.create,ZS=Wi.create,uK=wa.create,lK=Lo.create,fK=Wi.createWithPreprocess,dK=ih.create,hK=o(()=>MD().optional(),"ostring"),pK=o(()=>ID().optional(),"onumber"),mK=o(()=>kD().optional(),"oboolean"),gK={string:e=>va.create({...e,coerce:!0}),number:e=>Is.create({...e,coerce:!0}),boolean:e=>cl.create({...e,coerce:!0}),bigint:e=>ks.create({...e,coerce:!0}),date:e=>Lc.create({...e,coerce:!0})},vK=kt,B=Object.freeze({__proto__:null,defaultErrorMap:sl,setErrorMap:AD,getErrorMap:Rd,makeIssue:km,EMPTY_PATH:_V,addIssueToContext:Qe,ParseStatus:xn,INVALID:kt,DIRTY:Ju,OK:Un,isAborted:C6,isDirty:M6,isValid:Od,isAsync:Nd,get util(){return nr},get objectUtil(){return T6},ZodParsedType:it,getParsedType:ws,ZodType:zt,datetimeRegex:f2,ZodString:va,ZodNumber:Is,ZodBigInt:ks,ZodBoolean:cl,ZodDate:Lc,ZodSymbol:Bd,ZodUndefined:ul,ZodNull:ll,ZodAny:Uc,ZodUnknown:Es,ZodNever:Ka,ZodVoid:Ld,ZodArray:ba,ZodObject:Rr,ZodUnion:fl,ZodDiscriminatedUnion:p1,ZodIntersection:dl,ZodTuple:Ga,ZodRecord:Ud,ZodMap:Fd,ZodSet:Fc,ZodFunction:Xu,ZodLazy:hl,ZodLiteral:pl,ZodEnum:Ds,ZodNativeEnum:ml,ZodPromise:jc,ZodEffects:Wi,ZodTransformer:Wi,ZodOptional:wa,ZodNullable:Lo,ZodDefault:gl,ZodCatch:vl,ZodNaN:jd,BRAND:NV,ZodBranded:m1,ZodPipeline:ih,ZodReadonly:yl,custom:h2,Schema:zt,ZodSchema:zt,late:PV,get ZodFirstPartyTypeKind(){return Mt},coerce:gK,any:HV,array:GV,bigint:UV,boolean:kD,date:FV,discriminatedUnion:YV,effect:ZS,enum:oK,function:nK,instanceof:BV,intersection:XV,lazy:iK,literal:aK,map:tK,nan:LV,nativeEnum:sK,never:VV,null:zV,nullable:lK,number:ID,object:WV,oboolean:mK,onumber:pK,optional:uK,ostring:hK,pipeline:dK,preprocess:fK,promise:cK,record:eK,set:rK,strictObject:ZV,string:MD,symbol:jV,transformer:ZS,tuple:QV,undefined:$V,union:JV,unknown:qV,void:KV,NEVER:vK,ZodIssueCode:Ve,quotelessJson:wV,ZodError:Si}),ud=Symbol("current"),Ku=Symbol("previous"),ld=o((e,{ref:t,refType:r,param:n,header:a,...s}={})=>({...s,...e}),"mergeOpenApi");function DD(e){if(typeof e.ZodType.prototype.openapi<"u")return;e.ZodType.prototype.openapi=function(s){let{zodOpenApi:c,...l}=this._def,d=new this.constructor({...l,zodOpenApi:{openapi:ld(s,c?.openapi)}});return d._def.zodOpenApi[ud]=d,c&&(d._def.zodOpenApi[Ku]=this),d};let t=e.ZodType.prototype.describe;e.ZodType.prototype.describe=function(...s){let c=t.apply(this,s),l=c._def;if(l.zodOpenApi){let d={...l.zodOpenApi};d.openapi=ld({description:s[0]},d.openapi),d[Ku]=this,d[ud]=c,l.zodOpenApi=d}else l.zodOpenApi={openapi:{description:s[0]},[ud]:c};return c};let r=e.ZodObject.prototype.extend;e.ZodObject.prototype.extend=function(...s){let c=r.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=ld({},d.openapi),d[Ku]=this,c._def.zodOpenApi=d}else c._def.zodOpenApi={[Ku]:this};return c};let n=e.ZodObject.prototype.omit;e.ZodObject.prototype.omit=function(...s){let c=n.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=ld({},d.openapi),delete d[Ku],delete d[ud],c._def.zodOpenApi=d}return c};let a=e.ZodObject.prototype.pick;e.ZodObject.prototype.pick=function(...s){let c=a.apply(this,s),l=c._def.zodOpenApi;if(l){let d={...l};d.openapi=ld({},d.openapi),delete d[Ku],delete d[ud],c._def.zodOpenApi=d}return c}}i(DD,"extendZodWithOpenApi");o(DD,"extendZodWithOpenApi");DD(B);var yK=Object.defineProperty,bK=o((e,t)=>yK(e,"name",{value:t,configurable:!0}),"__name"),g1=B.array(B.string().or(B.record(B.any()))),TQ=B.object({type:B.string().optional(),narrative:B.string().optional()}),v1=B.string().or(B.object({id:B.string(),type:B.string(),caption:B.string().optional()})),wK=B.object({type:B.string().min(1).or(B.string().array().nonempty()),latitude:B.number(),longitude:B.number()}),_K=B.object({type:B.string().min(1).or(B.string().array().nonempty()),addressCountry:B.string().optional(),addressCountryCode:B.string().optional(),addressRegion:B.string().optional(),addressLocality:B.string().optional(),streetAddress:B.string().optional(),postOfficeBoxNumber:B.string().optional(),postalCode:B.string().optional(),geo:wK.optional()}),EK=B.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(B.string()),RD=B.object({type:B.string().min(1).or(B.string().array().nonempty()),identifier:B.string(),identifierType:EK}),$d=B.string().or(B.object({id:B.string().optional(),type:B.string().or(B.string().array().nonempty().optional()),name:B.string().optional(),url:B.string().optional(),phone:B.string().optional(),description:B.string().optional(),endorsement:B.any().array().optional(),image:v1.optional(),email:B.string().email().optional(),address:_K.optional(),otherIdentifier:RD.array().optional(),official:B.string().optional(),parentOrg:B.any().optional(),familyName:B.string().optional(),givenName:B.string().optional(),additionalName:B.string().optional(),patronymicName:B.string().optional(),honorificPrefix:B.string().optional(),honorificSuffix:B.string().optional(),familyNamePrefix:B.string().optional(),dateOfBirth:B.string().optional()}).catchall(B.any())),I6=B.object({id:B.string().optional()}).catchall(B.any()),H0=B.object({type:B.string(),id:B.string()}).catchall(B.any()),JS=B.object({id:B.string(),type:B.string()}).catchall(B.any()),YS=B.object({id:B.string().optional(),type:B.string()}).catchall(B.any()),XS=B.object({type:B.string(),id:B.string().optional()}).catchall(B.any()),QS=B.object({type:B.string().or(B.string().array().nonempty()),id:B.string().optional()}).catchall(B.any()),zd=B.object({"@context":g1,id:B.string().optional(),type:B.string().array().nonempty(),issuer:$d,credentialSubject:I6.or(I6.array()),refreshService:YS.or(YS.array()).optional(),credentialSchema:JS.or(JS.array()).optional(),issuanceDate:B.string().optional(),expirationDate:B.string().optional(),credentialStatus:H0.or(H0.array()).optional(),name:B.string().optional(),description:B.string().optional(),validFrom:B.string().optional(),validUntil:B.string().optional(),status:H0.or(H0.array()).optional(),termsOfUse:XS.or(XS.array()).optional(),evidence:QS.or(QS.array()).optional()}).catchall(B.any()),Wa=B.object({type:B.string(),created:B.string(),challenge:B.string().optional(),domain:B.string().optional(),nonce:B.string().optional(),proofPurpose:B.string(),verificationMethod:B.string(),jws:B.string().optional()}).catchall(B.any()),k6=zd.extend({proof:Wa.or(Wa.array())}),AK=B.object({"@context":g1,id:B.string().optional(),type:B.string().or(B.string().array().nonempty()),verifiableCredential:k6.or(k6.array()).optional(),holder:B.string().optional()}).catchall(B.any()),SK=AK.extend({proof:Wa.or(Wa.array())}),p2=B.object({kty:B.string(),crv:B.string(),x:B.string(),y:B.string().optional(),n:B.string().optional(),d:B.string().optional()}),CQ=p2.omit({d:!0}).extend({d:B.string()}),xK=B.object({alg:B.string(),iv:B.string(),tag:B.string(),epk:p2.partial().optional(),kid:B.string().optional(),apv:B.string().optional(),apu:B.string().optional()}),TK=B.object({header:xK,encrypted_key:B.string()}),CK=B.object({protected:B.string(),iv:B.string(),ciphertext:B.string(),tag:B.string(),aad:B.string().optional(),recipients:TK.array().optional()}),Sc=B.string().or(B.object({"@context":g1.optional(),id:B.string(),type:B.string(),controller:B.string(),publicKeyJwk:p2.optional(),publicKeyBase58:B.string().optional(),blockChainAccountId:B.string().optional()}).catchall(B.any())),MK=B.object({id:B.string(),type:B.string().or(B.string().array().nonempty()),serviceEndpoint:B.any().or(B.any().array().nonempty())}).catchall(B.any()),MQ=B.object({"@context":g1,id:B.string(),alsoKnownAs:B.string().optional(),controller:B.string().or(B.string().array().nonempty()).optional(),verificationMethod:Sc.array().optional(),authentication:Sc.array().optional(),assertionMethod:Sc.array().optional(),keyAgreement:Sc.array().optional(),capabilityInvocation:Sc.array().optional(),capabilityDelegation:Sc.array().optional(),publicKey:Sc.array().optional(),service:MK.array().optional(),proof:Wa.or(Wa.array()).optional()}).catchall(B.any()),IK=B.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(B.string()),y1=B.object({type:B.string().array().nonempty(),targetCode:B.string().optional(),targetDescription:B.string().optional(),targetName:B.string(),targetFramework:B.string().optional(),targetType:IK.optional(),targetUrl:B.string()}),kK=B.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"]),DK=kK.or(B.string()),RK=B.object({id:B.string().optional(),narrative:B.string().optional()}).catchall(B.any()),OK=B.object({id:B.string(),type:B.string().array().nonempty(),endorsementComment:B.string().optional()}),NK=zd.extend({credentialSubject:OK,proof:Wa.or(Wa.array()).optional()}),PK=B.object({id:B.string(),"@language":B.string().optional(),version:B.string().optional()}),BK=B.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(B.string()),LK=B.object({id:B.string(),type:B.string().array().nonempty(),alignment:y1.array().optional(),description:B.string().optional(),level:B.string().optional(),name:B.string(),points:B.string().optional()}).catchall(B.any()),UK=B.object({id:B.string(),type:B.string().array().nonempty(),alignment:y1.array().optional(),allowedValue:B.string().array().optional(),name:B.string(),requiredLevel:B.string().optional(),requiredValue:B.string().optional(),resultType:BK,rubricCriterionLevel:LK.array().optional(),valueMax:B.string().optional(),valueMin:B.string().optional()}).catchall(B.any()),FK=B.object({id:B.string().optional(),type:B.string().array().nonempty(),alignment:y1.array().optional(),achievementType:DK.optional(),creator:$d.optional(),creditsAvailable:B.number().optional(),criteria:RK,description:B.string(),endorsement:NK.array().optional(),fieldOfStudy:B.string().optional(),humanCode:B.string().optional(),image:v1.optional(),"@language":B.string().optional(),name:B.string(),otherIdentifier:RD.array().optional(),related:PK.array().optional(),resultDescription:UK.array().optional(),specialization:B.string().optional(),tag:B.string().array().optional(),version:B.string().optional()}).catchall(B.any()),jK=B.object({type:B.string(),hashed:B.boolean(),identityHash:B.string(),identityType:B.string(),salt:B.string().optional()}),$K=B.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),zK=B.object({type:B.string().array().nonempty(),achievedLevel:B.string().optional(),alignment:y1.array().optional(),resultDescription:B.string().optional(),status:$K.optional(),value:B.string().optional()}).catchall(B.any()),ex=B.object({id:B.string().optional(),type:B.string().array().nonempty(),activityEndDate:B.string().optional(),activityStartDate:B.string().optional(),creditsEarned:B.number().optional(),achievement:FK.optional(),identifier:jK.array().optional(),image:v1.optional(),licenseNumber:B.string().optional(),narrative:B.string().optional(),result:zK.array().optional(),role:B.string().optional(),source:$d.optional(),term:B.string().optional()}).catchall(B.any()),HK=B.object({id:B.string().optional(),type:B.string().or(B.string().array().nonempty()),narrative:B.string().optional(),name:B.string().optional(),description:B.string().optional(),genre:B.string().optional(),audience:B.string().optional()}).catchall(B.any()),qK=zd.extend({name:B.string().optional(),description:B.string().optional(),image:v1.optional(),credentialSubject:ex.or(ex.array()),endorsement:zd.array().optional(),evidence:HK.array().optional()}),IQ=qK.extend({proof:Wa.or(Wa.array())}),kQ=B.object({checks:B.string().array(),warnings:B.string().array(),errors:B.string().array()}),OD=B.enum(["Success","Failed","Error"]),DQ=OD.enum,RQ=B.object({check:B.string(),status:OD,message:B.string().optional(),details:B.string().optional()}),OQ=B.object({title:B.string().optional(),createdAt:B.string().optional(),issuer:$d.optional(),issuee:$d.optional(),credentialSubject:I6.optional()}),NQ=B.object({id:B.string(),uri:B.string()}).catchall(B.any()),PQ=B.object({limit:B.number(),cursor:B.string().optional(),sort:B.string().optional()}),Fn=B.object({cursor:B.string().optional(),hasMore:B.boolean()}),ND=B.object({encryptedRecord:CK,fields:B.string().array()}).catchall(B.any()),BQ=Fn.extend({records:ND.array()}),VK=ND.extend({id:B.string()}),LQ=Fn.extend({records:VK.array()}),tx=bK(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),KK=B.instanceof(RegExp).or(B.string().refine(e=>{try{return tx(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=tx(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),mr=B.string().or(B.object({$in:B.string().array()})).or(B.object({$regex:KK})),GK=B.object({backgroundColor:B.string().optional(),backgroundImage:B.string().optional(),fadeBackgroundImage:B.boolean().optional(),repeatBackgroundImage:B.boolean().optional(),fontColor:B.string().optional(),accentColor:B.string().optional(),accentFontColor:B.string().optional(),idBackgroundImage:B.string().optional(),fadeIdBackgroundImage:B.boolean().optional(),idBackgroundColor:B.string().optional(),repeatIdBackgroundImage:B.boolean().optional()}),Uo=B.object({profileId:B.string().min(3).max(40).describe("Unique, URL-safe identifier for the profile."),displayName:B.string().default("").describe("Human-readable display name for the profile."),shortBio:B.string().default("").describe("Short bio for the profile."),bio:B.string().default("").describe("Longer bio for the profile."),did:B.string().describe("Decentralized Identifier for the profile. (auto-assigned)"),isPrivate:B.boolean().optional().describe("Whether the profile is private or not and shows up in search results."),email:B.string().optional().describe("Contact email address for the profile. (deprecated)"),image:B.string().optional().describe("Profile image URL for the profile."),heroImage:B.string().optional().describe("Hero image URL for the profile."),websiteLink:B.string().optional().describe("Website link for the profile."),isServiceProfile:B.boolean().default(!1).optional().describe("Whether the profile is a service profile or not."),type:B.string().optional().describe('Profile type: e.g. "person", "organization", "service".'),notificationsWebhook:B.string().url().startsWith("http").optional().describe("URL to send notifications to."),display:GK.optional().describe("Display settings for the profile."),highlightedCredentials:B.array(B.string()).max(5).optional().describe("Up to 5 unique boost URIs to highlight on the profile."),role:B.string().default("").optional().describe('Role of the profile: e.g. "teacher", "student".'),dob:B.string().default("").optional().describe('Date of birth of the profile: e.g. "1990-01-01".')}),UQ=B.object({profileId:mr,displayName:mr,shortBio:mr,bio:mr,email:mr,websiteLink:mr,isServiceProfile:B.boolean(),type:mr}).partial(),FQ=Fn.extend({records:Uo.array()}),jQ=B.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),PD=B.object({id:B.string(),created:B.string(),displayName:B.string().default("").optional(),shortBio:B.string().default("").optional(),bio:B.string().default("").optional(),email:B.string().optional(),image:B.string().optional(),heroImage:B.string().optional()}),$Q=Fn.extend({records:PD.extend({did:B.string()}).array()}),zQ=B.object({id:mr,displayName:mr,shortBio:mr,bio:mr,email:mr}).partial(),HQ=Fn.extend({records:B.object({profile:Uo,manager:PD.extend({did:B.string()}).optional()}).array()}),qQ=B.object({uri:B.string(),to:B.string(),from:B.string(),sent:B.string().datetime(),received:B.string().datetime().optional()}),BD=B.object({role:B.string(),canEdit:B.boolean(),canIssue:B.boolean(),canRevoke:B.boolean(),canManagePermissions:B.boolean(),canIssueChildren:B.string(),canCreateChildren:B.string(),canEditChildren:B.string(),canRevokeChildren:B.string(),canManageChildrenPermissions:B.string(),canManageChildrenProfiles:B.boolean().default(!1).optional(),canViewAnalytics:B.boolean()}),WK=B.object({role:mr,canEdit:B.boolean(),canIssue:B.boolean(),canRevoke:B.boolean(),canManagePermissions:B.boolean(),canIssueChildren:mr,canCreateChildren:mr,canEditChildren:mr,canRevokeChildren:mr,canManageChildrenPermissions:mr,canManageChildrenProfiles:B.boolean(),canViewAnalytics:B.boolean()}).partial(),rx=B.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),ZK=B.discriminatedUnion("type",[B.object({type:B.literal(rx.Values.GRANT_PERMISSIONS),data:B.object({claimUri:B.string(),targetUri:B.string(),permissions:BD.partial()})}),B.object({type:B.literal(rx.Values.ADD_ADMIN),data:B.object({claimUri:B.string(),targetUri:B.string()})})]),VQ=B.object({type:mr,data:B.object({claimUri:mr,targetUri:mr,permissions:WK})}).deepPartial(),JK=B.object({id:B.string(),createdAt:B.string(),updatedAt:B.string()}).and(ZK),KQ=Fn.extend({records:JK.array()}),D6=B.enum(["DRAFT","LIVE"]),YK=B.object({uri:B.string(),name:B.string().optional(),type:B.string().optional(),category:B.string().optional(),status:D6.optional(),autoConnectRecipients:B.boolean().optional(),meta:B.record(B.any()).optional(),claimPermissions:BD.optional(),allowAnyoneToCreateChildren:B.boolean().optional()}),GQ=B.object({uri:mr,name:mr,type:mr,category:mr,meta:B.record(mr),status:D6.or(B.object({$in:D6.array()})),autoConnectRecipients:B.boolean()}).partial(),WQ=Fn.extend({records:YK.array()}),XK=B.object({to:Uo,from:B.string(),received:B.string().optional(),uri:B.string().optional()}),ZQ=Fn.extend({records:XK.array()}),QK=B.object({to:Uo,from:B.string(),received:B.string().optional(),boostUris:B.array(B.string()),credentialUris:B.array(B.string()).optional()}),JQ=Fn.extend({records:QK.array()}),YQ=B.object({endpoint:B.string(),name:B.string(),did:B.string().optional()}),XQ=B.object({ttlSeconds:B.number().optional(),totalUses:B.number().optional()}),eG=B.object({endpoint:B.string()}),QQ=B.object({signingAuthority:eG,relationship:B.object({name:B.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:B.string(),isPrimary:B.boolean().optional()})}),eee=B.object({boostUri:B.string(),signingAuthority:B.object({endpoint:B.string(),name:B.string()})}),tG=B.enum(["live","stale","withdrawn"]),rG=B.object({read:B.object({anonymize:B.boolean().optional(),credentials:B.object({categories:B.record(B.object({required:B.boolean(),defaultEnabled:B.boolean().optional()})).default({})}).default({}),personal:B.record(B.object({required:B.boolean(),defaultEnabled:B.boolean().optional()})).default({})}).default({}),write:B.object({credentials:B.object({categories:B.record(B.object({required:B.boolean(),defaultEnabled:B.boolean().optional()})).default({})}).default({}),personal:B.record(B.object({required:B.boolean(),defaultEnabled:B.boolean().optional()})).default({})}).default({})}),LD=B.object({contract:rG,owner:Uo,name:B.string(),subtitle:B.string().optional(),description:B.string().optional(),reasonForAccessing:B.string().optional(),image:B.string().optional(),uri:B.string(),needsGuardianConsent:B.boolean().optional(),redirectUrl:B.string().optional(),frontDoorBoostUri:B.string().optional(),createdAt:B.string(),updatedAt:B.string(),expiresAt:B.string().optional(),autoBoosts:B.string().array().optional(),writers:B.array(Uo).optional()}),tee=Fn.extend({records:LD.omit({owner:!0}).array()}),nG=B.object({credentials:B.object({categories:B.record(B.string().array()).default({})}),personal:B.record(B.string()).default({}),date:B.string()}),ree=Fn.extend({records:nG.array()}),iG=B.object({credentials:B.object({category:B.string(),uri:B.string()}).array(),personal:B.record(B.string()).default({}),date:B.string(),contractUri:B.string()}),nee=Fn.extend({records:iG.array()}),UD=B.object({sharing:B.boolean().optional(),shared:B.string().array().optional(),shareAll:B.boolean().optional(),shareUntil:B.string().optional()}),FD=B.object({read:B.object({anonymize:B.boolean().optional(),credentials:B.object({shareAll:B.boolean().optional(),sharing:B.boolean().optional(),categories:B.record(UD).default({})}).default({}),personal:B.record(B.string()).default({})}).default({}),write:B.object({credentials:B.object({categories:B.record(B.boolean()).default({})}).default({}),personal:B.record(B.boolean()).default({})}).default({}),deniedWriters:B.array(B.string()).optional()}),iee=Fn.extend({records:B.object({expiresAt:B.string().optional(),oneTime:B.boolean().optional(),terms:FD,contract:LD,uri:B.string(),consenter:Uo,status:tG}).array()}),aee=B.object({read:B.object({anonymize:B.boolean().optional(),credentials:B.object({categories:B.record(B.object({required:B.boolean().optional()})).optional()}).optional(),personal:B.record(B.object({required:B.boolean().optional()})).optional()}).optional(),write:B.object({credentials:B.object({categories:B.record(B.object({required:B.boolean().optional()})).optional()}).optional(),personal:B.record(B.object({required:B.boolean().optional()})).optional()}).optional()}),oee=B.object({anonymize:B.boolean().optional(),credentials:B.object({categories:B.record(B.boolean()).optional()}).optional(),personal:B.record(B.boolean()).optional()}),see=B.object({credentials:B.object({categories:B.record(B.boolean()).optional()}).optional(),personal:B.record(B.boolean()).optional(),id:mr.optional()}),aG=B.object({read:B.object({anonymize:B.boolean().optional(),credentials:B.object({shareAll:B.boolean().optional(),sharing:B.boolean().optional(),categories:B.record(UD.optional()).optional()}).optional(),personal:B.record(B.string()).optional()}).optional(),write:B.object({credentials:B.object({categories:B.record(B.boolean()).optional()}).optional(),personal:B.record(B.boolean()).optional()}).optional()}),R6=B.enum(["consent","update","sync","withdraw","write"]),cee=B.object({terms:aG.optional(),action:R6.or(R6.array()).optional(),date:B.object({$gt:B.string()}).or(B.object({$lt:B.string()})).or(B.object({$eq:B.string()})).optional(),expiresAt:B.object({$gt:B.string()}).or(B.object({$lt:B.string()})).or(B.object({$eq:B.string()})).optional(),oneTime:B.boolean().optional()}),jD=B.object({expiresAt:B.string().optional(),oneTime:B.boolean().optional(),terms:FD.optional(),id:B.string(),action:R6,date:B.string(),uris:B.string().array().optional()}),uee=Fn.extend({records:jD.array()}),oG=B.object({credentialUri:B.string(),termsUri:B.string(),contractUri:B.string(),boostUri:B.string(),category:B.string().optional(),date:B.string()}),lee=Fn.extend({records:oG.array()}),sG=B.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION","ISSUANCE_CLAIMED","ISSUANCE_DELIVERED","ISSUANCE_ERROR"]),cG=B.object({title:B.string().optional(),body:B.string().optional()}),uG=B.object({type:B.string(),value:B.string()}),b1=B.enum(["PENDING","DELIVERED","CLAIMED","EXPIRED"]),lG=B.object({issuanceId:B.string(),status:b1,recipient:B.object({contactMethod:uG.optional(),learnCardId:B.string().optional()}),timestamp:B.string().datetime().optional()}),fG=B.object({vcUris:B.array(B.string()).optional(),vpUris:B.array(B.string()).optional(),transaction:jD.optional(),inbox:lG.optional()}),fee=B.object({type:sG,to:Uo.partial().and(B.object({did:B.string()})),from:Uo.partial().and(B.object({did:B.string()})),message:cG.optional(),data:fG.optional(),sent:B.string().datetime().optional(),webhookUrl:B.string().optional()}),dG="auth-grant:",dee=B.object({id:B.string(),name:B.string(),description:B.string().optional(),challenge:B.string().startsWith(dG).min(10,{message:"Challenge is too short"}).max(100,{message:"Challenge is too long"}),status:B.enum(["revoked","active"],{required_error:"Status is required",invalid_type_error:"Status must be either active or revoked"}),scope:B.string(),createdAt:B.string().datetime({message:"createdAt must be a valid ISO 8601 datetime string"}),expiresAt:B.string().datetime({message:"expiresAt must be a valid ISO 8601 datetime string"}).nullish().optional()}),hee=B.object({id:B.string()}).catchall(B.any()),hG=B.enum(["active","revoked"]),pee=B.object({id:mr,name:mr,description:mr,status:hG}).partial(),nx=B.object({id:B.string(),isVerified:B.boolean(),verifiedAt:B.string().optional(),isPrimary:B.boolean(),createdAt:B.string()}),mee=B.discriminatedUnion("type",[B.object({type:B.literal("email"),value:B.string().email()}).merge(nx),B.object({type:B.literal("phone"),value:B.string()}).merge(nx)]),ix=B.object({isVerified:B.boolean().optional(),isPrimary:B.boolean().optional()}),gee=B.discriminatedUnion("type",[B.object({type:B.literal("email"),value:B.string().email()}).merge(ix),B.object({type:B.literal("phone"),value:B.string()}).merge(ix)]),$D=B.discriminatedUnion("type",[B.object({type:B.literal("email"),value:B.string().email()}),B.object({type:B.literal("phone"),value:B.string()})]),vee=B.object({value:B.string(),type:B.enum(["email","phone"])}),yee=B.object({token:B.string()}),bee=B.object({contactMethodId:B.string()}),pG=B.object({id:B.string(),credential:B.string(),isSigned:B.boolean(),currentStatus:b1,expiresAt:B.string(),createdAt:B.string(),issuerDid:B.string(),webhookUrl:B.string().optional(),signingAuthority:B.object({endpoint:B.string().optional(),name:B.string().optional()}).optional()}),wee=B.object({hasMore:B.boolean(),records:B.array(pG),cursor:B.string().optional()}),_ee=B.object({currentStatus:b1,id:B.string(),isSigned:B.boolean(),issuerDid:B.string()}).partial(),mG=B.object({endpoint:B.string().url(),name:B.string()}),Eee=B.object({recipient:$D.describe("The recipient of the credential"),credential:k6.passthrough().or(SK.passthrough()).or(zd.passthrough()).describe("The credential to issue. If not signed, the users default signing authority will be used, or the specified signing authority in the configuration."),configuration:B.object({signingAuthority:mG.optional().describe("The signing authority to use for the credential. If not provided, the users default signing authority will be used if the credential is not signed."),webhookUrl:B.string().url().optional().describe("The webhook URL to receive credential issuance events."),expiresInDays:B.number().min(1).max(365).optional().describe("The number of days the credential will be valid for."),delivery:B.object({suppress:B.boolean().optional().default(!1).describe("Whether to suppress delivery of the credential to the recipient. If true, the email/sms will not be sent to the recipient. Useful if you would like to manually send claim link to your users."),template:B.object({id:B.enum(["universal-inbox-claim"]).optional().describe("The template ID to use for the credential delivery. If not provided, the default template will be used."),model:B.object({issuer:B.object({name:B.string().optional().describe('The name of the organization (e.g., "State University").'),logoUrl:B.string().url().optional().describe("The URL of the organization's logo.")}).optional(),credential:B.object({name:B.string().optional().describe('The name of the credential (e.g., "Bachelor of Science").'),type:B.string().optional().describe('The type of the credential (e.g., "degree", "certificate").')}).optional(),recipient:B.object({name:B.string().optional().describe('The name of the recipient (e.g., "John Doe").')}).optional()}).describe("The template model to use for the credential delivery. Injects via template variables into email/sms templates. If not provided, the default template will be used.")}).optional().describe("The template to use for the credential delivery. If not provided, the default template will be used.")}).optional().describe("Configuration for the credential delivery i.e. email or SMS. When credentials are sent to a user who has a verified email or phone associated with their account, delivery is skipped, and the credential will be sent using in-app notifications. If not provided, the default configuration will be used.")}).optional().describe("Configuration for the credential issuance. If not provided, the default configuration will be used.")}),Aee=B.object({issuanceId:B.string(),status:b1,recipient:$D,claimUrl:B.string().url().optional(),recipientDid:B.string().optional()}),See=B.object({token:B.string(),contactMethodId:B.string(),autoVerifyContactMethod:B.boolean().optional().default(!1),createdAt:B.string(),expiresAt:B.string(),used:B.boolean()}),w1=o(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),xee=B.string().refine(e=>e.split(":").length===3&&e.split(":")[0]==="lc","URI must be of the form lc:${storage}:${url}").refine(e=>e.split(":")[1]==="ceramic","URI must use storage type ceramic (i.e. must be lc:ceramic:${streamID})");var m2=P.object({credentials:Ec.array()}).catchall(P.any()),zD=P.object({id:P.string(),title:P.string(),storageType:P.literal("ceramic").optional()}).catchall(P.any()),g2=P.object({credentials:Ec.or(zD).array()}).strict();var HD={modelData:{definitions:{MyVerifiableCredentials:"kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"},schemas:{AchievementVerifiableCredential:"ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",VerifiableCredentialsList:"ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"},tiles:{}},credentialAlias:"MyVerifiableCredentials"};var _1=i(async(e,{modelData:t,credentialAlias:r}=HD)=>{let n=e.invoke.getCeramicClient(),a=new Jf({ceramic:n,model:t}),s=i(async(g=r)=>{let v=await a.get(g);if(!v)return{credentials:[]};let y=await m2.spa(v);if(y.success)return y.data;let _=await g2.spa(v);if(_.success){let D={credentials:_.data.credentials.map(L=>{if("uri"in L)return L;let{title:Z,id:z,storageType:q,...Q}=L;return{...Q,id:Z,uri:`lc:ceramic:${z.replace("ceramic://","")}`}})};return await a.set(r,D),D}throw console.error(y.error),new Error("Invalid credentials list stored in IDX")},"getCredentialsListFromIdx"),c=i(async(g,v)=>{if(!g)throw new Error("Must provide id to remove");v||(v=r);let y=await s(v);return y.credentials=y.credentials.filter(_=>_.id!==g),a.set(v,y)},"removeCredentialFromIdx"),l=i(async g=>(g||(g=r),a.set(g,{credentials:[]})),"removeAllCredentialsFromIdx"),d=i(async g=>{let v=await Ec.parseAsync(g);if(!v)throw new Error("record is required");if(!v.uri)throw Error("No URI provided");await e.read.get(v.uri);let y=await s(r),_=y.credentials.findIndex(x=>x.id===v.id);return _>-1?y.credentials[_]=v:y.credentials.push(v),w1(await a.set(r,y))},"addCredentialInIdx"),p=i(async g=>{let v=Ec.array().parse(g),y=await s(r);return await Promise.all(v.map(async _=>{await e.read.get(_.uri);let x=y.credentials.findIndex(O=>O.id===_.id);x>-1?y.credentials[x]=_:y.credentials.push(_)})),w1(await a.set(r,y))},"addCredentialsInIdx");return{name:"IDX",displayName:"IDX",description:"Stores a bespoke index of credentials for an individual based on their did",index:{get:async g=>(g.debug?.("learnCard.index.IDX.get"),(await s()).credentials),add:async(g,v)=>{g.debug?.("learnCard.index.IDX.add");try{return await d(v),!0}catch(y){return console.error("Error adding credential with IDX:",y),!1}},addMany:async(g,v)=>{g.debug?.("learnCard.index.IDX.add");try{return await p(v),!0}catch(y){return console.error("Error adding credential with IDX:",y),!1}},update:async g=>(g.debug?.("learnCard.index.IDX.update"),!1),remove:async(g,v)=>{g.debug?.("learnCard.index.IDX.remove");try{return await c(v),!0}catch(y){return console.error("Error removing credential from IDX:",y),!1}},removeAll:async g=>{g.debug?.("learnCard.index.IDX.removeAll");try{return await l(),!0}catch(v){return console.error("Error removing credentials from IDX:",v),!1}}},methods:{getCredentialsListFromIdx:async(g,v=r)=>(await s(v)).credentials,getVerifiableCredentialFromIdx:async(g,v)=>{let _=(await s())?.credentials?.find(D=>D?.id===v),x=g.read.get(_?.uri),O=await id.safeParseAsync(x);return O.success?O.data:void 0},getVerifiableCredentialsFromIdx:async g=>{let y=(await s())?.credentials?.map(_=>_?.uri)??[];return(await Promise.all(y.map(async _=>g.read.get(_)))).filter(_=>!!_)},addVerifiableCredentialInIdx:async(g,v)=>{let y=Ec.parse(v);if(!y)throw new Error("record is required");if(!y.uri)throw Error("No URI provided");await g.read.get(y.uri);let _=await s(r),x=_.credentials.findIndex(O=>O.id===y.id);return x>-1?_.credentials[x]=y:_.credentials.push(y),w1(await a.set(r,_))},removeVerifiableCredentialInIdx:async(g,v)=>c(v),removeAllVerifiableCredentialsInIdx:async()=>l(),getIDXIndex:async()=>a.get(r),setIDXIndex:async(g,v)=>a.set(r,v)}}},"getIDXPlugin");var gG=_1;
|
|
846
846
|
/*!
|
|
847
847
|
* The buffer module from node.js, for the browser.
|
|
848
848
|
*
|