@learncard/idx-plugin 1.0.22 → 1.0.23

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.
@@ -21,7 +21,7 @@ if (cid) {
21
21
  `;var Kg={};En(Kg,{base36:()=>Qi,base36upper:()=>RO});var Qi=Ka({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),RO=Ka({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var p8={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function OO(e){let t=p8[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(OO,"codeByName");function NO(e){let t=Object.entries(p8).find(([,r])=>r===e);if(t)return t[0];throw new Error(`No stream type registered for index ${e}`)}i(NO,"nameByCode");var eo=class{};i(eo,"StreamType");eo.nameByCode=NO;eo.codeByName=OO;var Iv=Hs(np(),1);function lu(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}i(lu,"asUint8Array");function yf(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?lu(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}i(yf,"allocUnsafe");function bf(e,t){t||(t=e.reduce((o,s)=>o+s.length,0));let r=yf(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return lu(r)}i(bf,"concat");var Jg={};En(Jg,{identity:()=>WO});var WO=cu({prefix:"\0",name:"identity",encode:e=>c8(e),decode:e=>s8(e)});var Zg={};En(Zg,{base2:()=>JO});var JO=Nr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Yg={};En(Yg,{base8:()=>ZO});var ZO=Nr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Xg={};En(Xg,{base10:()=>YO});var YO=Ka({prefix:"9",name:"base10",alphabet:"0123456789"});var Qg={};En(Qg,{base16:()=>XO,base16upper:()=>QO});var XO=Nr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),QO=Nr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ev={};En(ev,{base64:()=>eN,base64pad:()=>tN,base64url:()=>rN,base64urlpad:()=>nN});var eN=Nr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),tN=Nr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),rN=Nr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),nN=Nr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var tv={};En(tv,{base256emoji:()=>cN});var S8=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}"),iN=S8.reduce((e,t,r)=>(e[r]=t,e),[]),oN=S8.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function aN(e){return e.reduce((t,r)=>(t+=iN[r],t),"")}i(aN,"encode");function sN(e){let t=[];for(let r of e){let n=oN[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}i(sN,"decode");var cN=cu({prefix:"\u{1F680}",name:"base256emoji",encode:aN,decode:sN});var iv={};En(iv,{sha256:()=>nv,sha512:()=>uN});var rv=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?Vs(this.code,r):r.then(n=>Vs(this.code,n))}else throw Error("Unknown type, must be binary type")}};i(ip,"Hasher");var T8=i(e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),"sha"),nv=rv({name:"sha2-256",code:18,encode:T8("SHA-256")}),uN=rv({name:"sha2-512",code:19,encode:T8("SHA-512")});var ov={};En(ov,{identity:()=>dN});var C8=0,lN="identity",M8=da,fN=i(e=>Vs(C8,M8(e)),"digest"),dN={code:C8,name:lN,encode:M8,digest:fN};var CK=new TextEncoder,MK=new TextDecoder;var av={...Jg,...Zg,...Yg,...Xg,...Qg,...Vg,...Kg,...qg,...ev,...tv},RK={...iv,...ov};function k8(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}i(k8,"createCodec");var I8=k8("utf8","u",e=>{let t=new TextDecoder("utf8");return"u"+t.decode(e)},e=>new TextEncoder().encode(e.substring(1))),sv=k8("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=yf(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),mN={utf8:I8,"utf-8":I8,hex:av.base16,latin1:sv,ascii:sv,binary:sv,...av},cv=mN;function uv(e,t="utf8"){let r=cv[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(uv,"toString");function si(e){let t,r,n;return typeof e=="object"?(t=e.hashFunction,r=e.expiring,n=e.tags):t=e,(o,s,c)=>{if(c.value!=null)c.value=D8(c.value,t,r,n);else if(c.get!=null)c.get=D8(c.get,t,r,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}i(si,"Memoize");var lv=new Map;function D8(e,t,r=0,n){let o=Symbol("__memoized_map__");return function(...s){let c;this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let l=this[o];if(Array.isArray(n))for(let h of n)lv.has(h)?lv.get(h).push(l):lv.set(h,[l]);if(t||s.length>0||r>0){let h;t===!0?h=s.map(y=>y.toString()).join("!"):t?h=t.apply(this,s):h=s[0];let p=`${h}__timestamp`,m=!1;if(r>0)if(!l.has(p))m=!0;else{let y=l.get(p);m=Date.now()-y>r}l.has(h)&&!m?c=l.get(h):(c=e.apply(this,s),l.set(h,c),r>0&&l.set(p,Date.now()))}else{let h=this;l.has(h)?c=l.get(h):(c=e.apply(this,s),l.set(h,c))}return c}}i(D8,"getNewFunction");var op=i(({enumerable:e=!0,configurable:t=!1}={})=>({enumerable:e,configurable:t,writable:!1}),"readonly"),fv=i(function*(e,t){if(e!=null&&!(e instanceof Uint8Array))for(let[r,n]of Object.entries(e)){let o=[...t,r];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let[s,c]of n.entries()){let l=[...o,s],h=Ut.asCID(c);h?yield[l.join("/"),h]:typeof c=="object"&&(yield*fv(c,l))}else{let s=Ut.asCID(n);s?yield[o.join("/"),s]:yield*fv(n,o)}}},"links"),dv=i(function*(e,t){if(e!=null)for(let[r,n]of Object.entries(e)){let o=[...t,r];if(yield o.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!Ut.asCID(n))if(Array.isArray(n))for(let[s,c]of n.entries()){let l=[...o,s];yield l.join("/"),typeof c=="object"&&!Ut.asCID(c)&&(yield*dv(c,l))}else yield*dv(n,o)}},"tree"),vN=i((e,t)=>{let r=e;for(let[n,o]of t.entries()){if(r=r[o],r==null)throw new Error(`Object has no property at ${t.slice(0,n+1).map(c=>`[${JSON.stringify(c)}]`).join("")}`);let s=Ut.asCID(r);if(s)return{value:s,remaining:t.slice(n+1).join("/")}}return{value:r}},"get"),ap=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:op(),bytes:op(),value:op(),asBlock:op()})}links(){return fv(this.value,[])}tree(){return dv(this.value,[])}get(t="/"){return vN(this.value,t.split("/").filter(Boolean))}};i(ap,"Block");var R8=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),o=await r.digest(n),s=Ut.create(1,t.code,o);return new ap({value:e,bytes:n,cid:s})},"encode");var Cv=Hs(np(),1);var yp={};En(yp,{code:()=>tB,decode:()=>rB,encode:()=>Ev,name:()=>eB});var bN=["string","number","bigint","symbol"],wN=["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 O8(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(bN.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(_N(e))return"Buffer";let r=EN(e);return r||"Object"}i(O8,"is");function _N(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}i(_N,"isBuffer");function EN(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(wN.includes(t))return t}i(EN,"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 Qe=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(Qe,"Token");var fu=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",AN=new TextDecoder,SN=new TextEncoder;function sp(e){return fu&&globalThis.Buffer.isBuffer(e)}i(sp,"isBuffer");function hv(e){return e instanceof Uint8Array?sp(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}i(hv,"asU8A");var L8=fu?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):B8(e,t,r):(e,t,r)=>r-t>64?AN.decode(e.subarray(t,r)):B8(e,t,r),F8=fu?e=>e.length>64?globalThis.Buffer.from(e):N8(e):e=>e.length>64?SN.encode(e):N8(e),Oo=i(e=>Uint8Array.from(e),"fromArray"),du=fu?(e,t,r)=>sp(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),U8=fu?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),hv(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let o of e)n+o.length>r.length&&(o=o.subarray(0,r.length-n)),r.set(o,n),n+=o.length;return r},$8=fu?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function j8(e,t){if(sp(e)&&sp(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(j8,"compare");function N8(e,t=1/0){let r,n=e.length,o=null,s=[];for(let c=0;c<n;++c){if(r=e.charCodeAt(c),r>55295&&r<57344){if(!o){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}o=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&s.push(239,191,189);if(o=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(N8,"utf8ToBytes");function B8(e,t,r){let n=[];for(;t<r;){let o=e[t],s=null,c=o>239?4:o>223?3:o>191?2:1;if(t+c<=r){let l,h,p,m;switch(c){case 1:o<128&&(s=o);break;case 2:l=e[t+1],(l&192)===128&&(m=(o&31)<<6|l&63,m>127&&(s=m));break;case 3:l=e[t+1],h=e[t+2],(l&192)===128&&(h&192)===128&&(m=(o&15)<<12|(l&63)<<6|h&63,m>2047&&(m<55296||m>57343)&&(s=m));break;case 4:l=e[t+1],h=e[t+2],p=e[t+3],(l&192)===128&&(h&192)===128&&(p&192)===128&&(m=(o&15)<<18|(l&63)<<12|(h&63)<<6|p&63,m>65535&&m<1114112&&(s=m))}}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 xN(n)}i(B8,"utf8Slice");var P8=4096;function xN(e){let t=e.length;if(t<=P8)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=P8));return r}i(xN,"decodeCodePointsArray");var TN=256,hu=class{constructor(t=TN){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 o=r.length-(this.maxCursor-this.cursor)-1;r.set(t,o)}else{if(r){let o=r.length-(this.maxCursor-this.cursor)-1;o<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,o),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=$8(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=du(n,0,this.cursor)}else r=U8(this.chunks,this.cursor);return t&&this.reset(),r}};i(hu,"Bl");var Mt="CBOR decode error:",pv="CBOR encode error:",wf=[];wf[23]=1;wf[24]=2;wf[25]=3;wf[26]=5;wf[27]=9;function ha(e,t,r){if(e.length-t<r)throw new Error(`${Mt} not enough data for type`)}i(ha,"assertEnoughData");var Yr=[24,256,65536,4294967296,BigInt("18446744073709551616")];function ci(e,t,r){ha(e,t,1);let n=e[t];if(r.strict===!0&&n<Yr[0])throw new Error(`${Mt} integer encoded in more bytes than necessary (strict decode)`);return n}i(ci,"readUint8");function ui(e,t,r){ha(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Yr[1])throw new Error(`${Mt} integer encoded in more bytes than necessary (strict decode)`);return n}i(ui,"readUint16");function li(e,t,r){ha(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Yr[2])throw new Error(`${Mt} integer encoded in more bytes than necessary (strict decode)`);return n}i(li,"readUint32");function fi(e,t,r){ha(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],s=(BigInt(n)<<BigInt(32))+BigInt(o);if(r.strict===!0&&s<Yr[3])throw new Error(`${Mt} 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(`${Mt} integers outside of the safe integer range are not supported`)}i(fi,"readUint64");function z8(e,t,r,n){return new Qe(Ne.uint,ci(e,t+1,n),2)}i(z8,"decodeUint8");function H8(e,t,r,n){return new Qe(Ne.uint,ui(e,t+1,n),3)}i(H8,"decodeUint16");function q8(e,t,r,n){return new Qe(Ne.uint,li(e,t+1,n),5)}i(q8,"decodeUint32");function V8(e,t,r,n){return new Qe(Ne.uint,fi(e,t+1,n),9)}i(V8,"decodeUint64");function Bi(e,t){return an(e,0,t.value)}i(Bi,"encodeUint");function an(e,t,r){if(r<Yr[0]){let n=Number(r);e.push([t|n])}else if(r<Yr[1]){let n=Number(r);e.push([t|24,n])}else if(r<Yr[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Yr[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<Yr[4]){let o=[t|27,0,0,0,0,0,0,0],s=Number(n&BigInt(4294967295)),c=Number(n>>BigInt(32)&BigInt(4294967295));o[8]=s&255,s=s>>8,o[7]=s&255,s=s>>8,o[6]=s&255,s=s>>8,o[5]=s&255,o[4]=c&255,c=c>>8,o[3]=c&255,c=c>>8,o[2]=c&255,c=c>>8,o[1]=c&255,e.push(o)}else throw new Error(`${Mt} encountered BigInt larger than allowable range`)}}i(an,"encodeUintValue");Bi.encodedSize=i(function(t){return an.encodedSize(t.value)},"encodedSize");an.encodedSize=i(function(t){return t<Yr[0]?1:t<Yr[1]?2:t<Yr[2]?3:t<Yr[3]?5:9},"encodedSize");Bi.compareTokens=i(function(t,r){return t.value<r.value?-1:t.value>r.value?1:0},"compareTokens");function K8(e,t,r,n){return new Qe(Ne.negint,-1-ci(e,t+1,n),2)}i(K8,"decodeNegint8");function G8(e,t,r,n){return new Qe(Ne.negint,-1-ui(e,t+1,n),3)}i(G8,"decodeNegint16");function W8(e,t,r,n){return new Qe(Ne.negint,-1-li(e,t+1,n),5)}i(W8,"decodeNegint32");var mv=BigInt(-1),J8=BigInt(1);function Z8(e,t,r,n){let o=fi(e,t+1,n);if(typeof o!="bigint"){let s=-1-o;if(s>=Number.MIN_SAFE_INTEGER)return new Qe(Ne.negint,s,9)}if(n.allowBigInt!==!0)throw new Error(`${Mt} integers outside of the safe integer range are not supported`);return new Qe(Ne.negint,mv-BigInt(o),9)}i(Z8,"decodeNegint64");function cp(e,t){let r=t.value,n=typeof r=="bigint"?r*mv-J8:r*-1-1;an(e,t.type.majorEncoded,n)}i(cp,"encodeNegint");cp.encodedSize=i(function(t){let r=t.value,n=typeof r=="bigint"?r*mv-J8:r*-1-1;return n<Yr[0]?1:n<Yr[1]?2:n<Yr[2]?3:n<Yr[3]?5:9},"encodedSize");cp.compareTokens=i(function(t,r){return t.value<r.value?1:t.value>r.value?-1:0},"compareTokens");function _f(e,t,r,n){ha(e,t,r+n);let o=du(e,t+r,t+r+n);return new Qe(Ne.bytes,o,r+n)}i(_f,"toToken");function Y8(e,t,r,n){return _f(e,t,1,r)}i(Y8,"decodeBytesCompact");function X8(e,t,r,n){return _f(e,t,2,ci(e,t+1,n))}i(X8,"decodeBytes8");function Q8(e,t,r,n){return _f(e,t,3,ui(e,t+1,n))}i(Q8,"decodeBytes16");function eE(e,t,r,n){return _f(e,t,5,li(e,t+1,n))}i(eE,"decodeBytes32");function tE(e,t,r,n){let o=fi(e,t+1,n);if(typeof o=="bigint")throw new Error(`${Mt} 64-bit integer bytes lengths not supported`);return _f(e,t,9,o)}i(tE,"decodeBytes64");function up(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Ne.string?F8(e.value):e.value),e.encodedBytes}i(up,"tokenBytes");function pu(e,t){let r=up(t);an(e,t.type.majorEncoded,r.length),e.push(r)}i(pu,"encodeBytes");pu.encodedSize=i(function(t){let r=up(t);return an.encodedSize(r.length)+r.length},"encodedSize");pu.compareTokens=i(function(t,r){return MN(up(t),up(r))},"compareTokens");function MN(e,t){return e.length<t.length?-1:e.length>t.length?1:j8(e,t)}i(MN,"compareBytes");function Ef(e,t,r,n,o){let s=r+n;ha(e,t,s);let c=new Qe(Ne.string,L8(e,t+r,t+s),s);return o.retainStringBytes===!0&&(c.byteValue=du(e,t+r,t+s)),c}i(Ef,"toToken");function rE(e,t,r,n){return Ef(e,t,1,r,n)}i(rE,"decodeStringCompact");function nE(e,t,r,n){return Ef(e,t,2,ci(e,t+1,n),n)}i(nE,"decodeString8");function iE(e,t,r,n){return Ef(e,t,3,ui(e,t+1,n),n)}i(iE,"decodeString16");function oE(e,t,r,n){return Ef(e,t,5,li(e,t+1,n),n)}i(oE,"decodeString32");function aE(e,t,r,n){let o=fi(e,t+1,n);if(typeof o=="bigint")throw new Error(`${Mt} 64-bit integer string lengths not supported`);return Ef(e,t,9,o,n)}i(aE,"decodeString64");var sE=pu;function mu(e,t,r,n){return new Qe(Ne.array,n,r)}i(mu,"toToken");function cE(e,t,r,n){return mu(e,t,1,r)}i(cE,"decodeArrayCompact");function uE(e,t,r,n){return mu(e,t,2,ci(e,t+1,n))}i(uE,"decodeArray8");function lE(e,t,r,n){return mu(e,t,3,ui(e,t+1,n))}i(lE,"decodeArray16");function fE(e,t,r,n){return mu(e,t,5,li(e,t+1,n))}i(fE,"decodeArray32");function dE(e,t,r,n){let o=fi(e,t+1,n);if(typeof o=="bigint")throw new Error(`${Mt} 64-bit integer array lengths not supported`);return mu(e,t,9,o)}i(dE,"decodeArray64");function hE(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Mt} indefinite length items not allowed`);return mu(e,t,1,1/0)}i(hE,"decodeArrayIndefinite");function lp(e,t){an(e,Ne.array.majorEncoded,t.value)}i(lp,"encodeArray");lp.compareTokens=Bi.compareTokens;lp.encodedSize=i(function(t){return an.encodedSize(t.value)},"encodedSize");function gu(e,t,r,n){return new Qe(Ne.map,n,r)}i(gu,"toToken");function pE(e,t,r,n){return gu(e,t,1,r)}i(pE,"decodeMapCompact");function mE(e,t,r,n){return gu(e,t,2,ci(e,t+1,n))}i(mE,"decodeMap8");function gE(e,t,r,n){return gu(e,t,3,ui(e,t+1,n))}i(gE,"decodeMap16");function vE(e,t,r,n){return gu(e,t,5,li(e,t+1,n))}i(vE,"decodeMap32");function yE(e,t,r,n){let o=fi(e,t+1,n);if(typeof o=="bigint")throw new Error(`${Mt} 64-bit integer map lengths not supported`);return gu(e,t,9,o)}i(yE,"decodeMap64");function bE(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Mt} indefinite length items not allowed`);return gu(e,t,1,1/0)}i(bE,"decodeMapIndefinite");function fp(e,t){an(e,Ne.map.majorEncoded,t.value)}i(fp,"encodeMap");fp.compareTokens=Bi.compareTokens;fp.encodedSize=i(function(t){return an.encodedSize(t.value)},"encodedSize");function wE(e,t,r,n){return new Qe(Ne.tag,r,1)}i(wE,"decodeTagCompact");function _E(e,t,r,n){return new Qe(Ne.tag,ci(e,t+1,n),2)}i(_E,"decodeTag8");function EE(e,t,r,n){return new Qe(Ne.tag,ui(e,t+1,n),3)}i(EE,"decodeTag16");function AE(e,t,r,n){return new Qe(Ne.tag,li(e,t+1,n),5)}i(AE,"decodeTag32");function SE(e,t,r,n){return new Qe(Ne.tag,fi(e,t+1,n),9)}i(SE,"decodeTag64");function dp(e,t){an(e,Ne.tag.majorEncoded,t.value)}i(dp,"encodeTag");dp.compareTokens=Bi.compareTokens;dp.encodedSize=i(function(t){return an.encodedSize(t.value)},"encodedSize");var NN=20,BN=21,PN=22,LN=23;function xE(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Mt} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new Qe(Ne.null,null,1):new Qe(Ne.undefined,void 0,1)}i(xE,"decodeUndefined");function TE(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Mt} indefinite length items not allowed`);return new Qe(Ne.break,void 0,1)}i(TE,"decodeBreak");function gv(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Mt} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Mt} Infinity values are not supported`)}return new Qe(Ne.float,e,t)}i(gv,"createToken");function CE(e,t,r,n){return gv(vv(e,t+1),3,n)}i(CE,"decodeFloat16");function ME(e,t,r,n){return gv(yv(e,t+1),5,n)}i(ME,"decodeFloat32");function IE(e,t,r,n){return gv(OE(e,t+1),9,n)}i(IE,"decodeFloat64");function hp(e,t,r){let n=t.value;if(n===!1)e.push([Ne.float.majorEncoded|NN]);else if(n===!0)e.push([Ne.float.majorEncoded|BN]);else if(n===null)e.push([Ne.float.majorEncoded|PN]);else if(n===void 0)e.push([Ne.float.majorEncoded|LN]);else{let o,s=!1;(!r||r.float64!==!0)&&(DE(n),o=vv(to,1),n===o||Number.isNaN(n)?(to[0]=249,e.push(to.slice(0,3)),s=!0):(RE(n),o=yv(to,1),n===o&&(to[0]=250,e.push(to.slice(0,5)),s=!0))),s||(FN(n),o=OE(to,1),to[0]=251,e.push(to.slice(0,9)))}}i(hp,"encodeFloat");hp.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){DE(n);let o=vv(to,1);if(n===o||Number.isNaN(n))return 3;if(RE(n),o=yv(to,1),n===o)return 5}return 9},"encodedSize");var kE=new ArrayBuffer(9),Pi=new DataView(kE,1),to=new Uint8Array(kE,0);function DE(e){if(e===1/0)Pi.setUint16(0,31744,!1);else if(e===-1/0)Pi.setUint16(0,64512,!1);else if(Number.isNaN(e))Pi.setUint16(0,32256,!1);else{Pi.setFloat32(0,e);let t=Pi.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Pi.setUint16(0,31744,!1);else if(r===0)Pi.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let o=r-127;o<-24?Pi.setUint16(0,0):o<-14?Pi.setUint16(0,(t&2147483648)>>16|1<<24+o,!1):Pi.setUint16(0,(t&2147483648)>>16|o+15<<10|n>>13,!1)}}}i(DE,"encodeFloat16");function vv(e,t){if(e.length-t<2)throw new Error(`${Mt} 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,o=r&1023,s;return n===0?s=o*2**-24:n!==31?s=(o+1024)*2**(n-25):s=o===0?1/0:NaN,r&32768?-s:s}i(vv,"readFloat16");function RE(e){Pi.setFloat32(0,e,!1)}i(RE,"encodeFloat32");function yv(e,t){if(e.length-t<4)throw new Error(`${Mt} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}i(yv,"readFloat32");function FN(e){Pi.setFloat64(0,e,!1)}i(FN,"encodeFloat64");function OE(e,t){if(e.length-t<8)throw new Error(`${Mt} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}i(OE,"readFloat64");hp.compareTokens=Bi.compareTokens;function ur(e,t,r){throw new Error(`${Mt} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}i(ur,"invalidMinor");function pp(e){return()=>{throw new Error(`${Mt} ${e}`)}}i(pp,"errorer");var We=[];for(let e=0;e<=23;e++)We[e]=ur;We[24]=z8;We[25]=H8;We[26]=q8;We[27]=V8;We[28]=ur;We[29]=ur;We[30]=ur;We[31]=ur;for(let e=32;e<=55;e++)We[e]=ur;We[56]=K8;We[57]=G8;We[58]=W8;We[59]=Z8;We[60]=ur;We[61]=ur;We[62]=ur;We[63]=ur;for(let e=64;e<=87;e++)We[e]=Y8;We[88]=X8;We[89]=Q8;We[90]=eE;We[91]=tE;We[92]=ur;We[93]=ur;We[94]=ur;We[95]=pp("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)We[e]=rE;We[120]=nE;We[121]=iE;We[122]=oE;We[123]=aE;We[124]=ur;We[125]=ur;We[126]=ur;We[127]=pp("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)We[e]=cE;We[152]=uE;We[153]=lE;We[154]=fE;We[155]=dE;We[156]=ur;We[157]=ur;We[158]=ur;We[159]=hE;for(let e=160;e<=183;e++)We[e]=pE;We[184]=mE;We[185]=gE;We[186]=vE;We[187]=yE;We[188]=ur;We[189]=ur;We[190]=ur;We[191]=bE;for(let e=192;e<=215;e++)We[e]=wE;We[216]=_E;We[217]=EE;We[218]=AE;We[219]=SE;We[220]=ur;We[221]=ur;We[222]=ur;We[223]=ur;for(let e=224;e<=243;e++)We[e]=pp("simple values are not supported");We[244]=ur;We[245]=ur;We[246]=ur;We[247]=xE;We[248]=pp("simple values are not supported");We[249]=CE;We[250]=ME;We[251]=IE;We[252]=ur;We[253]=ur;We[254]=ur;We[255]=TE;var ro=[];for(let e=0;e<24;e++)ro[e]=new Qe(Ne.uint,e,1);for(let e=-1;e>=-24;e--)ro[31-e]=new Qe(Ne.negint,e,1);ro[64]=new Qe(Ne.bytes,new Uint8Array(0),1);ro[96]=new Qe(Ne.string,"",1);ro[128]=new Qe(Ne.array,0,1);ro[160]=new Qe(Ne.map,0,1);ro[244]=new Qe(Ne.false,!1,1);ro[245]=new Qe(Ne.true,!0,1);ro[246]=new Qe(Ne.null,null,1);function NE(e){switch(e.type){case Ne.false:return Oo([244]);case Ne.true:return Oo([245]);case Ne.null:return Oo([246]);case Ne.bytes:return e.value.length?void 0:Oo([64]);case Ne.string:return e.value===""?Oo([96]):void 0;case Ne.array:return e.value===0?Oo([128]):void 0;case Ne.map:return e.value===0?Oo([160]):void 0;case Ne.uint:return e.value<24?Oo([Number(e.value)]):void 0;case Ne.negint:if(e.value>=-24)return Oo([31-Number(e.value)])}}i(NE,"quickEncodeToken");var $N={float64:!1,mapSorter:HN,quickEncodeToken:NE};function jN(){let e=[];return e[Ne.uint.major]=Bi,e[Ne.negint.major]=cp,e[Ne.bytes.major]=pu,e[Ne.string.major]=sE,e[Ne.array.major]=lp,e[Ne.map.major]=fp,e[Ne.tag.major]=dp,e[Ne.float.major]=hp,e}i(jN,"makeCborEncoders");var BE=jN(),bv=new hu,Gs=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(`${pv} object contains circular references`);return new Gs(r,t)}};i(Gs,"Ref");var Ga={null:new Qe(Ne.null,null),undefined:new Qe(Ne.undefined,void 0),true:new Qe(Ne.true,!0),false:new Qe(Ne.false,!1),emptyArray:new Qe(Ne.array,0),emptyMap:new Qe(Ne.map,0)},Wa={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new Qe(Ne.float,e):e>=0?new Qe(Ne.uint,e):new Qe(Ne.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new Qe(Ne.uint,e):new Qe(Ne.negint,e)},Uint8Array(e,t,r,n){return new Qe(Ne.bytes,e)},string(e,t,r,n){return new Qe(Ne.string,e)},boolean(e,t,r,n){return e?Ga.true:Ga.false},null(e,t,r,n){return Ga.null},undefined(e,t,r,n){return Ga.undefined},ArrayBuffer(e,t,r,n){return new Qe(Ne.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new Qe(Ne.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Ga.emptyArray,new Qe(Ne.break)]:Ga.emptyArray;n=Gs.createCheck(n,e);let o=[],s=0;for(let c of e)o[s++]=mp(c,r,n);return r.addBreakTokens?[new Qe(Ne.array,e.length),o,new Qe(Ne.break)]:[new Qe(Ne.array,e.length),o]},Object(e,t,r,n){let o=t!=="Object",s=o?e.keys():Object.keys(e),c=o?e.size:s.length;if(!c)return r.addBreakTokens===!0?[Ga.emptyMap,new Qe(Ne.break)]:Ga.emptyMap;n=Gs.createCheck(n,e);let l=[],h=0;for(let p of s)l[h++]=[mp(p,r,n),mp(o?e.get(p):e[p],r,n)];return zN(l,r),r.addBreakTokens?[new Qe(Ne.map,c),l,new Qe(Ne.break)]:[new Qe(Ne.map,c),l]}};Wa.Map=Wa.Object;Wa.Buffer=Wa.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Wa[`${e}Array`]=Wa.DataView;function mp(e,t={},r){let n=O8(e),o=t&&t.typeEncoders&&t.typeEncoders[n]||Wa[n];if(typeof o=="function"){let c=o(e,n,t,r);if(c!=null)return c}let s=Wa[n];if(!s)throw new Error(`${pv} unsupported type: ${n}`);return s(e,n,t,r)}i(mp,"objectToTokens");function zN(e,t){t.mapSorter&&e.sort(t.mapSorter)}i(zN,"sortMapEntries");function HN(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 o=r.type.major,s=BE[o].compareTokens(r,n);return s===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),s}i(HN,"mapSorter");function PE(e,t,r,n){if(Array.isArray(t))for(let o of t)PE(e,o,r,n);else r[t.type.major](e,t,n)}i(PE,"tokensToEncoded");function qN(e,t,r){let n=mp(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let o=r.quickEncodeToken(n);if(o)return o;let s=t[n.type.major];if(s.encodedSize){let c=s.encodedSize(n,r),l=new hu(c);if(s(l,n,r),l.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return hv(l.chunks[0])}}return bv.reset(),PE(bv,n,t,r),bv.toBytes(!0)}i(qN,"encodeCustom");function wv(e,t){return t=Object.assign({},$N,t),qN(e,BE,t)}i(wv,"encode");var VN={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},gp=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=ro[t];if(r===void 0){let n=We[t];if(!n)throw new Error(`${Mt} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let o=t&31;r=n(this.data,this.pos,o,this.options)}return this.pos+=r.encodedLength,r}};i(gp,"Tokeniser");var Af=Symbol.for("DONE"),vp=Symbol.for("BREAK");function KN(e,t,r){let n=[];for(let o=0;o<e.value;o++){let s=Sf(t,r);if(s===vp){if(e.value===1/0)break;throw new Error(`${Mt} got unexpected break to lengthed array`)}if(s===Af)throw new Error(`${Mt} found array but not enough entries (got ${o}, expected ${e.value})`);n[o]=s}return n}i(KN,"tokenToArray");function GN(e,t,r){let n=r.useMaps===!0,o=n?void 0:{},s=n?new Map:void 0;for(let c=0;c<e.value;c++){let l=Sf(t,r);if(l===vp){if(e.value===1/0)break;throw new Error(`${Mt} got unexpected break to lengthed map`)}if(l===Af)throw new Error(`${Mt} found map but not enough entries (got ${c} [no key], expected ${e.value})`);if(n!==!0&&typeof l!="string")throw new Error(`${Mt} non-string keys not supported (got ${typeof l})`);if(r.rejectDuplicateMapKeys===!0&&(n&&s.has(l)||!n&&l in o))throw new Error(`${Mt} found repeat map key "${l}"`);let h=Sf(t,r);if(h===Af)throw new Error(`${Mt} found map but not enough entries (got ${c} [no value], expected ${e.value})`);n?s.set(l,h):o[l]=h}return n?s:o}i(GN,"tokenToMap");function Sf(e,t){if(e.done())return Af;let r=e.next();if(r.type===Ne.break)return vp;if(r.type.terminal)return r.value;if(r.type===Ne.array)return KN(r,e,t);if(r.type===Ne.map)return GN(r,e,t);if(r.type===Ne.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Sf(e,t);return t.tags[r.value](n)}throw new Error(`${Mt} tag not supported (${r.value})`)}throw new Error("unsupported")}i(Sf,"tokensToObject");function _v(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Mt} data to decode must be a Uint8Array`);t=Object.assign({},VN,t);let r=t.tokenizer||new gp(e,t),n=Sf(r,t);if(n===Af)throw new Error(`${Mt} did not find any content to decode`);if(n===vp)throw new Error(`${Mt} got unexpected break`);if(!r.done())throw new Error(`${Mt} too many terminals, data makes no sense`);return n}i(_v,"decode");var LE=42;function JN(e){if(e.asCID!==e)return null;let t=Ut.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new Qe(Ne.tag,LE),new Qe(Ne.bytes,r)]}i(JN,"cidEncoder");function ZN(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}i(ZN,"undefinedEncoder");function YN(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(YN,"numberEncoder");var XN={float64:!0,typeEncoders:{Object:JN,undefined:ZN,number:YN}};function QN(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ut.decode(e.subarray(1))}i(QN,"cidDecoder");var FE={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};FE.tags[LE]=QN;var eB="dag-cbor",tB=113,Ev=i(e=>wv(e,XN),"encode"),rB=i(e=>_v(e,FE),"decode");function vu(e){try{return e()}catch(t){return t}}i(vu,"tryCatch");var Av=Hs(np(),1);function Ws(e){let t=Av.default.decode(e),r=Av.default.decode.bytes,n=e.subarray(r);return[t,n,r]}i(Ws,"readVarint");function nB(e){return e===0||e===1}i(nB,"isCidVersion");function Sv(e){let[t,r]=Ws(e);if(!nB(t))throw new Error(`Unknown CID version ${t}`);let[n,o]=Ws(r),[,s,c]=Ws(o),[l,,h]=Ws(s),p=o.subarray(0,c+h+l),m=o.subarray(c+h+l);return[Ut.create(t,n,Zh(p)),m]}i(Sv,"readCid");function Js(e,t="StreamRef"){let[r,n]=Ws(e);if(r!==206)throw new Error(`Invalid ${t}, does not include streamid codec`);let[o,s]=Ws(n),c=Sv(s),[l,h]=c;if(h.length===0)return{kind:"stream-id",type:o,genesis:l};if(h.length===1&&h[0]===0)return{kind:"commit-id",type:o,genesis:l,commit:null};{let[p]=Sv(h);return{kind:"commit-id",type:o,genesis:l,commit:p}}}i(Js,"fromBytes");var iB=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function yu(e,t="StreamRef"){let r=iB.exec(e)||[],n=r[2];if(!n)throw new Error(`Malformed ${t} string: ${e}`);let o=Qi.decode(n),s=Js(o),c=r[4];return c?{kind:"commit-id",type:s.type,genesis:s.genesis,commit:xv(s.genesis,c)}:s}i(yu,"fromString");function oB(e){try{return typeof e=="string"?Ut.parse(e):Ut.asCID(e)}catch{return null}}i(oB,"parseCID");function xv(e,t=null){if(!t||t==="0")return null;let r=oB(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(xv,"parseCommit");var xf=function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Li=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},bp=class extends Error{constructor(t){super(`Invalid StreamID bytes ${Qi.encode(t)}: contains commit`)}};i(bp,"InvalidStreamIDBytesError");var wp=class extends Error{constructor(t){super(`Invalid StreamID string ${t}: contains commit`)}};i(wp,"InvalidStreamIDStringError");function jE(e){let t=Js(e,"StreamID");if(t.kind==="stream-id")return new Yt(t.type,t.genesis);throw new bp(e)}i(jE,"fromBytes");function aB(e){return vu(()=>jE(e))}i(aB,"fromBytesNoThrow");function zE(e){let t=yu(e,"StreamID");if(t.kind==="stream-id")return new Yt(t.type,t.genesis);throw new wp(e)}i(zE,"fromString");function sB(e){return vu(()=>zE(e))}i(sB,"fromStringNoThrow");var $E=Symbol.for("@ceramicnetwork/streamid/StreamID"),Yt=class{constructor(t,r){if(this._tag=$E,!(t||t===0))throw new Error("StreamID constructor: type required");if(!r)throw new Error("StreamID constructor: cid required");this._type=typeof t=="string"?eo.codeByName(t):t,this._cid=typeof r=="string"?Ut.parse(r):r}static isInstance(t){return typeof t=="object"&&"_tag"in t&&t._tag===$E}static async fromGenesis(t,r){let n=await R8({value:r,codec:yp,hasher:nv});return new Yt(t,n.cid)}get type(){return this._type}get typeName(){return eo.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let t=Cv.default.encode(206),r=Cv.default.encode(this.type);return bf([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 Qi.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=jE;Yt.fromBytesNoThrow=aB;Yt.fromString=zE;Yt.fromStringNoThrow=sB;xf([si(),Li("design:type",String),Li("design:paramtypes",[])],Yt.prototype,"typeName",null);xf([si(),Li("design:type",Uint8Array),Li("design:paramtypes",[])],Yt.prototype,"bytes",null);xf([si(),Li("design:type",Yt),Li("design:paramtypes",[])],Yt.prototype,"baseID",null);xf([si(),Li("design:type",Function),Li("design:paramtypes",[]),Li("design:returntype",String)],Yt.prototype,"toString",null);xf([si(),Li("design:type",Function),Li("design:paramtypes",[]),Li("design:returntype",String)],Yt.prototype,"toUrl",null);var wu=function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},Kn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},Mv=function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},pa=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)},bu,Zs,Tf,_p=class extends Error{constructor(t){super(`Error while parsing CommitID from bytes ${Qi.encode(t)}: no commit information provided`)}};i(_p,"InvalidCommitIDBytesError");var Ep=class extends Error{constructor(t){super(`Error while parsing CommitID from string ${t}: no commit information provided`)}};i(Ep,"InvalidCommitIDStringError");function qE(e){let t=Js(e,"CommitID");if(t.kind==="commit-id")return new hr(t.type,t.genesis,t.commit);throw new _p(e)}i(qE,"fromBytes");function cB(e){return vu(()=>qE(e))}i(cB,"fromBytesNoThrow");function VE(e){let t=yu(e,"CommitID");if(t.kind==="commit-id")return new hr(t.type,t.genesis,t.commit);throw new Ep(e)}i(VE,"fromString");function uB(e){return vu(()=>VE(e))}i(uB,"fromStringNoThrow");var HE=Symbol.for("@ceramicnetwork/streamid/CommitID");function lB(e,t){return new hr(e.type,e.cid,t)}i(lB,"make");var hr=class{constructor(t,r,n=null){if(this._tag=HE,bu.set(this,void 0),Zs.set(this,void 0),Tf.set(this,void 0),!t&&t!==0)throw new Error("constructor: type required");if(!r)throw new Error("constructor: cid required");Mv(this,bu,typeof t=="string"?eo.codeByName(t):t,"f"),Mv(this,Zs,typeof r=="string"?Ut.parse(r):r,"f"),Mv(this,Tf,xv(pa(this,Zs,"f"),n),"f")}static isInstance(t){return typeof t=="object"&&"_tag"in t&&t._tag===HE}get baseID(){return new Yt(pa(this,bu,"f"),pa(this,Zs,"f"))}get type(){return pa(this,bu,"f")}get typeName(){return eo.nameByCode(pa(this,bu,"f"))}get cid(){return pa(this,Zs,"f")}get commit(){return pa(this,Tf,"f")||pa(this,Zs,"f")}get bytes(){let t=Iv.default.encode(206),r=Iv.default.encode(this.type),n=pa(this,Tf,"f")?.bytes||new Uint8Array([0]);return bf([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 Qi.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(bu=new WeakMap,Zs=new WeakMap,Tf=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};i(hr,"CommitID");hr.fromBytes=qE;hr.fromBytesNoThrow=cB;hr.fromString=VE;hr.fromStringNoThrow=uB;hr.make=lB;wu([si(),Kn("design:type",Yt),Kn("design:paramtypes",[])],hr.prototype,"baseID",null);wu([si(),Kn("design:type",String),Kn("design:paramtypes",[])],hr.prototype,"typeName",null);wu([si(),Kn("design:type",Ut),Kn("design:paramtypes",[])],hr.prototype,"commit",null);wu([si(),Kn("design:type",Uint8Array),Kn("design:paramtypes",[])],hr.prototype,"bytes",null);wu([si(),Kn("design:type",Function),Kn("design:paramtypes",[]),Kn("design:returntype",String)],hr.prototype,"toString",null);wu([si(),Kn("design:type",Function),Kn("design:paramtypes",[]),Kn("design:returntype",String)],hr.prototype,"toUrl",null);var Ys;(function(e){function t(o){let s=Js(o);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: ${Qi.encode(o)}`)}}i(t,"fromBytes"),e.fromBytes=t;function r(o){let s=yu(o);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: ${o}`)}}i(r,"fromString"),e.fromString=r;function n(o){if(Yt.isInstance(o)||hr.isInstance(o))return o;if(o instanceof Uint8Array)return t(o);if(typeof o=="string")return r(o);throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(o)}`)}i(n,"from"),e.from=n})(Ys||(Ys={}));var KE="ceramic://k3y52l7qbv1fry1fp4s0nwdarh0vahusarpposgevy0pemiykymd2ord6swtharcw",Ap="ceramic://k3y52l7qbv1fryjn62sggjh1lpn11c56qfofzmty190d62hwk1cal1c7qc5he54ow";var kv={};En(kv,{JsonPatchError:()=>Br,_areEquals:()=>If,applyOperation:()=>Xs,applyPatch:()=>kp,applyReducer:()=>mB,deepClone:()=>hB,getValueByPointer:()=>Mp,validate:()=>WE,validator:()=>Ip});var fB=function(){var e=i(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[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)}}(),dB=Object.prototype.hasOwnProperty;function xp(e,t){return dB.call(e,t)}i(xp,"hasOwnProperty");function Tp(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 o in e)xp(e,o)&&n.push(o);return n}i(Tp,"_objectKeys");function sn(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}i(sn,"_deepClone");function Cp(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(Cp,"isInteger");function No(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}i(No,"escapePathComponent");function Cf(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}i(Cf,"unescapePathComponent");function Sp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Sp(e[t]))return!0}else if(typeof e=="object"){for(var n=Tp(e),o=n.length,s=0;s<o;s++)if(Sp(e[n[s]]))return!0}}return!1}i(Sp,"hasUndefined");function GE(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
22
22
  `)}i(GE,"patchErrorMessageFormatter");var Mf=function(e){fB(t,e);function t(r,n,o,s,c){var l=this.constructor,h=e.call(this,GE(r,{name:n,index:o,operation:s,tree:c}))||this;return h.name=n,h.index=o,h.operation=s,h.tree=c,Object.setPrototypeOf(h,l.prototype),h.message=GE(r,{name:n,index:o,operation:s,tree:c}),h}return i(t,"PatchError"),t}(Error);var Br=Mf,hB=sn,_u={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=Mp(r,this.path);n&&(n=sn(n));var o=Xs(r,{op:"remove",path:this.from}).removed;return Xs(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Mp(r,this.from);return Xs(r,{op:"add",path:this.path,value:sn(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:If(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},pB={add:function(e,t,r){return Cp(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:_u.move,copy:_u.copy,test:_u.test,_get:_u._get};function Mp(e,t){if(t=="")return e;var r={op:"_get",path:t};return Xs(e,r),r.value}i(Mp,"getValueByPointer");function Xs(e,t,r,n,o,s){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),s===void 0&&(s=0),r&&(typeof r=="function"?r(t,0,e,t.path):Ip(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=Mp(e,t.from),t.op==="move"&&(c.removed=e),c;if(t.op==="test"){if(c.test=If(e,t.value),c.test===!1)throw new Br("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 Br("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,t,e);return c}}else{n||(e=sn(e));var l=t.path||"",h=l.split("/"),p=e,m=1,y=h.length,b=void 0,_=void 0,x=void 0;for(typeof r=="function"?x=r:x=Ip;;){if(_=h[m],_&&_.indexOf("~")!=-1&&(_=Cf(_)),o&&(_=="__proto__"||_=="prototype"&&m>0&&h[m-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&&b===void 0&&(p[_]===void 0?b=h.slice(0,m).join("/"):m==y-1&&(b=t.path),b!==void 0&&x(t,0,e,b)),m++,Array.isArray(p)){if(_==="-")_=p.length;else{if(r&&!Cp(_))throw new Br("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);Cp(_)&&(_=~~_)}if(m>=y){if(r&&t.op==="add"&&_>p.length)throw new Br("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=pB[t.op].call(t,p,_,e);if(c.test===!1)throw new Br("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}}else if(m>=y){var c=_u[t.op].call(t,p,_,e);if(c.test===!1)throw new Br("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}if(p=p[_],r&&m<y&&(!p||typeof p!="object"))throw new Br("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,t,e)}}}i(Xs,"applyOperation");function kp(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new Br("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=sn(e));for(var s=new Array(t.length),c=0,l=t.length;c<l;c++)s[c]=Xs(e,t[c],r,!0,o,c),e=s[c].newDocument;return s.newDocument=e,s}i(kp,"applyPatch");function mB(e,t,r){var n=Xs(e,t);if(n.test===!1)throw new Br("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}i(mB,"applyReducer");function Ip(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Br("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(_u[e.op]){if(typeof e.path!="string")throw new Br("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Br('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 Br("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 Br("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")&&Sp(e.value))throw new Br("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 o=e.path.split("/").length,s=n.split("/").length;if(o!==s+1&&o!==s)throw new Br("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 Br("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=WE([c],r);if(l&&l.name==="OPERATION_PATH_UNRESOLVABLE")throw new Br("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Br("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}i(Ip,"validator");function WE(e,t,r){try{if(!Array.isArray(e))throw new Br("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)kp(sn(t),sn(e),r||!0);else{r=r||Ip;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof Br)return o;throw o}}i(WE,"validate");function If(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),o,s,c;if(r&&n){if(s=e.length,s!=t.length)return!1;for(o=s;o--!==0;)if(!If(e[o],t[o]))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(o=s;o--!==0;)if(!t.hasOwnProperty(l[o]))return!1;for(o=s;o--!==0;)if(c=l[o],!If(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}i(If,"_areEquals");var Nv={};En(Nv,{compare:()=>AB,generate:()=>Dv,observe:()=>EB,unobserve:()=>_B});var Rv=new WeakMap,gB=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror"),e}(),vB=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo"),e}();function yB(e){return Rv.get(e)}i(yB,"getMirror");function bB(e,t){return e.observers.get(t)}i(bB,"getObserverFromMirror");function wB(e,t){e.observers.delete(t.callback)}i(wB,"removeObserverFromMirror");function _B(e,t){t.unobserve()}i(_B,"unobserve");function EB(e,t){var r=[],n,o=yB(e);if(!o)o=new gB(e),Rv.set(e,o);else{var s=bB(o,t);n=s&&s.observer}if(n)return n;if(n={},o.value=sn(e),t){n.callback=t,n.next=null;var c=i(function(){Dv(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(){Dv(n),clearTimeout(n.next),wB(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",l),window.removeEventListener("keyup",l),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l),window.removeEventListener("change",l))},o.observers.set(t,new vB(t,n)),n}i(EB,"observe");function Dv(e,t){t===void 0&&(t=!1);var r=Rv.get(e.object);Ov(r.value,e.object,e.patches,"",t),e.patches.length&&kp(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}i(Dv,"generate");function Ov(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=Tp(t),c=Tp(e),l=!1,h=!1,p=c.length-1;p>=0;p--){var m=c[p],y=e[m];if(xp(t,m)&&!(t[m]===void 0&&y!==void 0&&Array.isArray(t)===!1)){var b=t[m];typeof y=="object"&&y!=null&&typeof b=="object"&&b!=null&&Array.isArray(y)===Array.isArray(b)?Ov(y,b,r,n+"/"+No(m),o):y!==b&&(l=!0,o&&r.push({op:"test",path:n+"/"+No(m),value:sn(y)}),r.push({op:"replace",path:n+"/"+No(m),value:sn(b)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+No(m),value:sn(y)}),r.push({op:"remove",path:n+"/"+No(m)}),h=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),l=!0)}if(!(!h&&s.length==c.length))for(var p=0;p<s.length;p++){var m=s[p];!xp(e,m)&&t[m]!==void 0&&r.push({op:"add",path:n+"/"+No(m),value:sn(t[m])})}}}i(Ov,"_generate");function AB(e,t,r){r===void 0&&(r=!1);var n=[];return Ov(e,t,n,"",r),n}i(AB,"compare");var JE=Object.assign({},kv,Nv,{JsonPatchError:Mf,deepClone:sn,escapePathComponent:No,unescapePathComponent:Cf});var g7=Hs(Jv(),1);var v7=Hs(X9(),1);var rc;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC"})(rc||(rc={}));var hy=Hs(Jv(),1);var ny=i(function(e,t){return ny=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},ny(e,t)},"extendStatics");function iy(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ny(e,t);function r(){this.constructor=e}i(r,"__"),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}i(iy,"__extends");function oy(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(oy,"__values");function Tu(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,s=[],c;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(l){c={error:l}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}i(Tu,"__read");function Cu(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,s;n<o;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(Cu,"__spreadArray");function Fi(e){return typeof e=="function"}i(Fi,"isFunction");function Q9(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(Q9,"createErrorClass");var Gp=Q9(function(e){return i(function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
23
23
  `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
24
- `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function ay(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(ay,"arrRemove");var Wp=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,o,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=oy(c),h=l.next();!h.done;h=l.next()){var p=h.value;p.remove(this)}}catch(D){t={error:D}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var m=this.initialTeardown;if(Fi(m))try{m()}catch(D){s=D instanceof Gp?D.errors:[D]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var b=oy(y),_=b.next();!_.done;_=b.next()){var x=_.value;try{e7(x)}catch(D){s=s??[],D instanceof Gp?s=Cu(Cu([],Tu(s)),Tu(D.errors)):s.push(D)}}}catch(D){n={error:D}}finally{try{_&&!_.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(s)throw new Gp(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)e7(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)&&ay(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&ay(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var uJ=Wp.EMPTY;function Jp(e){return e instanceof Wp||e&&"closed"in e&&Fi(e.remove)&&Fi(e.add)&&Fi(e.unsubscribe)}i(Jp,"isSubscription");function e7(e){Fi(e)?e():e.unsubscribe()}i(e7,"execFinalizer");var no={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Mu={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Mu.delegate;return o?.setTimeout?o.setTimeout.apply(o,Cu([e,t],Tu(r))):setTimeout.apply(void 0,Cu([e,t],Tu(r)))},clearTimeout:function(e){var t=Mu.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function t7(e){Mu.setTimeout(function(){var t=no.onUnhandledError;if(t)t(e);else throw e})}i(t7,"reportUnhandledError");function sy(){}i(sy,"noop");var r7=function(){return cy("C",void 0,void 0)}();function n7(e){return cy("E",void 0,e)}i(n7,"errorNotification");function i7(e){return cy("N",e,void 0)}i(i7,"nextNotification");function cy(e,t,r){return{kind:e,value:t,error:r}}i(cy,"createNotification");var nc=null;function o7(e){if(no.useDeprecatedSynchronousErrorHandling){var t=!nc;if(t&&(nc={errorThrown:!1,error:null}),e(),t){var r=nc,n=r.errorThrown,o=r.error;if(nc=null,n)throw o}}else e()}i(o7,"errorContext");function a7(e){no.useDeprecatedSynchronousErrorHandling&&nc&&(nc.errorThrown=!0,nc.error=e)}i(a7,"captureError");var fy=function(e){iy(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Jp(r)&&r.add(n)):n.destination=NL,n}return i(t,"Subscriber"),t.create=function(r,n,o){return new Yp(r,n,o)},t.prototype.next=function(r){this.isStopped?ly(i7(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?ly(n7(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?ly(r7,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}(Wp);var DL=Function.prototype.bind;function uy(e,t){return DL.call(e,t)}i(uy,"bind");var RL=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){Zp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Zp(n)}else Zp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Zp(r)}},e}(),Yp=function(e){iy(t,e);function t(r,n,o){var s=e.call(this)||this,c;if(Fi(r)||!r)c={next:r??void 0,error:n??void 0,complete:o??void 0};else{var l;s&&no.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&uy(r.next,l),error:r.error&&uy(r.error,l),complete:r.complete&&uy(r.complete,l)}):c=r}return s.destination=new RL(c),s}return i(t,"SafeSubscriber"),t}(fy);function Zp(e){no.useDeprecatedSynchronousErrorHandling?a7(e):t7(e)}i(Zp,"handleUnhandledError");function OL(e){throw e}i(OL,"defaultErrorHandler");function ly(e,t){var r=no.onStoppedNotification;r&&Mu.setTimeout(function(){return r(e,t)})}i(ly,"handleStoppedNotification");var NL={closed:!0,next:sy,error:OL,complete:sy};var s7=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function c7(e){return e}i(c7,"identity");function u7(e){return e.length===0?c7:e.length===1?e[0]:i(function(r){return e.reduce(function(n,o){return o(n)},r)},"piped")}i(u7,"pipeFromArray");var dy=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 o=this,s=PL(t)?t:new Yp(t,r,n);return o7(function(){var c=o,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?o._subscribe(s):o._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=l7(r),new r(function(o,s){var c=new Yp({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:o});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[s7]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return u7(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=l7(t),new t(function(n,o){var s;r.subscribe(function(c){return s=c},function(c){return o(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function l7(e){var t;return(t=e??no.Promise)!==null&&t!==void 0?t:Promise}i(l7,"getPromiseCtor");function BL(e){return e&&Fi(e.next)&&Fi(e.error)&&Fi(e.complete)}i(BL,"isObserver");function PL(e){return e&&e instanceof fy||BL(e)&&Jp(e)}i(PL,"isSubscriber");var f7;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(f7||(f7={}));var d7;(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"})(d7||(d7={}));var py;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(py||(py={}));var Of=class extends dy{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,hy.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===py.ANCHOR).map(({cid:t})=>hr.make(this.id,t))}get state(){return(0,hy.default)(this.state$.value)}async sync(t={}){t={sync:rc.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(Of,"Stream");function h7(){return e=>{}}i(h7,"StreamStatic");var LL=function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},hi,my={anchor:!0,publish:!0,pin:!0,sync:rc.PREFER_CACHE},FL={sync:rc.PREFER_CACHE},p7={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function gy(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=uv((0,v7.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(gy,"headerFromMetadata");async function m7(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(m7,"getAuthenticatedDID");async function vy(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(vy,"throwReadOnlyError");var Za=hi=i(class extends Of{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,g7.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,o={}){o={...my,...o},!n?.deterministic&&o.syncTimeoutSeconds==null&&(o.syncTimeoutSeconds=0);let s=o.asDID?{did:o.asDID}:t,c=await hi.makeGenesis(s,r,n);return t.createStreamFromGenesis(hi.STREAM_TYPE_ID,c,o)}static async createFromGenesis(t,r,n={}){n={...my,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let o=r.data?await hi._signDagJWS(t,r):r;return t.createStreamFromGenesis(hi.STREAM_TYPE_ID,o,n)}static async deterministic(t,r,n={}){if(n={...my,...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 o=await hi.makeGenesis(t,null,r);return t.createStreamFromGenesis(hi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...FL,...n};let o=Ys.from(r);if(o.type!=hi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${hi.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async update(t,r,n={}){n={...p7,...n};let o=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(o,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...p7,...r};let o={header:gy(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await hi._signDagJWS(this.api,o),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=vy,this.patch=vy,this.sync=vy,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let o=await this._makeRawCommit(r,n);return hi._signDagJWS(t,o)}async _makeRawCommit(t,r){r||(r={});let n=gy(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 o=JE.compare(this.content,t),s=this.state.log[0];return{header:n,data:o,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 m7(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 o=gy(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:o};return Ev(c),c}let s={data:r,header:o};return hi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await m7(t)).createDagJWS(r)}},"TileDocument");Za.STREAM_TYPE_NAME="tile";Za.STREAM_TYPE_ID=0;Za=hi=LL([h7()],Za);var S7=Hs(w7(),1);function WL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(WL,"_checkPrivateRedeclaration");function JL(e,t){return t.get?t.get.call(e):t.value}i(JL,"_classApplyDescriptorGet");function ZL(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(ZL,"_classApplyDescriptorSet");function A7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(A7,"_classExtractFieldDescriptor");function _y(e,t){var r=A7(e,t,"get");return JL(e,r)}i(_y,"_classPrivateFieldGet");function _7(e,t,r){WL(e,t),t.set(e,r)}i(_7,"_classPrivateFieldInit");function E7(e,t,r){var n=A7(e,t,"set");return ZL(e,n,r),r}i(E7,"_classPrivateFieldSet");function YL(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(YL,"keyToQuery");function Ey(e){return typeof e=="string"?Ys.from(e).toString():hr.isInstance(e)||Yt.isInstance(e)?e.toString():e.streamId.toString()}i(Ey,"keyToString");async function Sy(e){let t=await Za.makeGenesis({},null,{...e,deterministic:!0}),r=await Yt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(Sy,"getDeterministicQuery");var XL=i(()=>Promise.resolve([]),"tempBatchLoadFn"),Xp=new WeakMap,Ay=new WeakMap,ic=class extends S7.default{cache(t){if(!_y(this,Ay))return!1;let r=t.id.toString();return this.clear(r).prime(r,t),!0}async create(t,r,n){let o=await Za.create(_y(this,Xp),t,r,n);return this.cache(o),o}async deterministic(t,r){let n=await Sy(t);try{return await super.load(n)}catch{let s=await Za.createFromGenesis(_y(this,Xp),n.genesis,r);return this.cache(s),s}}async load(t){return await super.load(t)}async update(t,r,n,o){let s=Ey(t);this.clear(s);let c=await this.load({streamId:s});return await c.update(r,n,o),c}constructor(t){super(XL,{cache:!0,cacheKeyFn:Ey,cacheMap:t.cache!=null&&typeof t.cache!="boolean"?t.cache:void 0}),_7(this,Xp,{writable:!0,value:void 0}),_7(this,Ay,{writable:!0,value:void 0}),this._batchLoadFn=async r=>{t.cache||this.clearAll();let n=await t.ceramic.multiQuery(r.map(YL),t.multiqueryTimeout);return r.map(o=>{let s=Ey(o),c=n[s];return c||new Error(`Failed to load stream: ${s}`)})},E7(this,Xp,t.ceramic),E7(this,Ay,!!t.cache)}};i(ic,"TileLoader");function QL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(QL,"_checkPrivateRedeclaration");function eF(e,t){return t.get?t.get.call(e):t.value}i(eF,"_classApplyDescriptorGet");function tF(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(tF,"_classApplyDescriptorSet");function T7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(T7,"_classExtractFieldDescriptor");function oc(e,t){var r=T7(e,t,"get");return eF(e,r)}i(oc,"_classPrivateFieldGet");function x7(e,t,r){QL(e,t),t.set(e,r)}i(x7,"_classPrivateFieldInit");function xy(e,t,r){var n=T7(e,t,"set");return tF(e,n,r),r}i(xy,"_classPrivateFieldSet");var Iu=new WeakMap,ku=new WeakMap,Du=class{get aliases(){return oc(this,Iu)}get loader(){return oc(this,ku)}getDefinitionID(t){return oc(this,Iu).definitions[t]??null}getSchemaURL(t){return oc(this,Iu).schemas[t]??null}getTileID(t){return oc(this,Iu).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 oc(this,ku).load(r)}async createTile(t,r,n={}){let o=this.getSchemaURL(t);if(o==null)throw new Error(`Schema alias "${t}" is not defined`);let{controller:s,...c}=n,l={schema:o};return s!=null&&(l.controllers=[s]),await oc(this,ku).create(r,l,c)}constructor(t){if(x7(this,Iu,{writable:!0,value:void 0}),x7(this,ku,{writable:!0,value:void 0}),xy(this,Iu,t.aliases),t.loader!=null)xy(this,ku,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");xy(this,ku,new ic({ceramic:t.ceramic,cache:t.cache}))}}};i(Du,"DataModel");function rF(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(rF,"_checkPrivateRedeclaration");function nF(e,t){return t.get?t.get.call(e):t.value}i(nF,"_classApplyDescriptorGet");function iF(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(iF,"_classApplyDescriptorSet");function C7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(C7,"_classExtractFieldDescriptor");function Bo(e,t){var r=C7(e,t,"get");return nF(e,r)}i(Bo,"_classPrivateFieldGet");function Qp(e,t,r){rF(e,t),t.set(e,r)}i(Qp,"_classPrivateFieldInit");function e0(e,t,r){var n=C7(e,t,"set");return iF(e,n,r),r}i(e0,"_classPrivateFieldSet");var t0=new WeakMap,ac=new WeakMap,Ty=new WeakMap,r0=new WeakMap,Nf=class{_createValuePromise(){e0(this,Ty,new Promise((t,r)=>{e0(this,r0,{resolve:t,reject:r})}))}change(t){return new Promise((r,n)=>{let o=i(async s=>{try{let c=await t(s);r(),this._next(c)}catch(c){n(c),this._next(s)}},"run");Bo(this,ac).push({reject:n,run:o}),Bo(this,ac).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 Bo(this,ac).length===0?await Bo(this,t0).call(this):await Bo(this,Ty)}async _start(){try{let t=await Bo(this,t0).call(this);this._next(t)}catch(t){Bo(this,ac).forEach(r=>{r.reject(t)}),e0(this,ac,[]),Bo(this,r0).reject(t),this._createValuePromise()}}_next(t){let r=Bo(this,ac).shift();r==null?this._end(t):r.run(t)}_end(t){Bo(this,r0).resolve(t),this._createValuePromise()}constructor(t){Qp(this,t0,{writable:!0,value:void 0}),Qp(this,ac,{writable:!0,value:[]}),Qp(this,Ty,{writable:!0,value:void 0}),Qp(this,r0,{writable:!0,value:void 0}),e0(this,t0,t),this._createValuePromise()}};i(Nf,"TileProxy");var oF=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function aF(e){return oF.test(e)}i(aF,"isDIDstring");function sF(e){if(!aF(e))throw new Error(`Invalid DID: ${e}`)}i(sF,"assertDIDstring");function Cy(e){return sF(e),{controllers:[e],family:"IDX"}}i(Cy,"getIDXMetadata");function cF(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(cF,"_checkPrivateRedeclaration");function uF(e,t){return t.get?t.get.call(e):t.value}i(uF,"_classApplyDescriptorGet");function lF(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(lF,"_classApplyDescriptorSet");function M7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(M7,"_classExtractFieldDescriptor");function Ur(e,t){var r=M7(e,t,"get");return uF(e,r)}i(Ur,"_classPrivateFieldGet");function Bf(e,t,r){cF(e,t),t.set(e,r)}i(Bf,"_classPrivateFieldInit");function n0(e,t,r){var n=M7(e,t,"set");return lF(e,n,r),r}i(n0,"_classPrivateFieldSet");var va=new WeakMap,i0=new WeakMap,My=new WeakMap,Po=new WeakMap,o0=new WeakMap,Pf=class{get authenticated(){return Ur(this,va).did!=null}get ceramic(){return Ur(this,va)}get id(){if(Ur(this,i0)!=null)return Ur(this,i0);if(Ur(this,va).did==null)throw new Error("Ceramic instance is not authenticated");return Ur(this,va).did.hasParent?Ur(this,va).did.parent:Ur(this,va).did.id}get loader(){return Ur(this,Po)}get model(){return Ur(this,o0)}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),o=await Promise.all(r.map(async l=>{let{genesis:h,streamId:p}=await Sy(Cy(l));return{genesis:h,streamId:p.toString(),paths:[n]}})),s=await Ur(this,va).multiQuery(o),c=[];for(let l of o){let h=s[l.streamId]?.content?.[n],p=h?s[Yt.fromString(h).toString()]:null;c.push(p?.content??null)}return c}async set(t,r,n={}){let o=this.getDefinitionID(t),[s,c]=await this._setRecordOnly(o,r,n);return s&&await this._setReference(n.controller??this.id,o,c),c}async merge(t,r,n={}){let o=this.getDefinitionID(t),s=await this.getRecord(o),c=s?{...s,...r}:r;return await this.setRecord(o,c,n)}async setAll(t,r={}){let n=Object.entries(t).map(async([c,l])=>{let h=this.getDefinitionID(c),[p,m]=await this._setRecordOnly(h,l,r);return[p,h,m]}),s=(await Promise.all(n)).reduce((c,[l,h,p])=>(l&&(c[h]=p.toUrl()),c),{});return await this._setReferences(r.controller??this.id,s),s}async setDefaults(t,r={}){let n=await this.getIndex()??{},o=Object.entries(t).map(([l,h])=>[this.getDefinitionID(l),h]).filter(l=>n[l[0]]==null).map(async([l,h])=>{let p=await this.getDefinition(l),m=await this._createRecord(p,h,r);return{[l]:m.toUrl()}}),c=(await Promise.all(o)).reduce((l,h)=>Object.assign(l,h),{});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[o,s]=r[n++],c=await Ur(this,Po).load(s);return{done:!1,value:{key:o,id:s,record:c.content}}}}}async _createIDXDoc(t){return await Ur(this,Po).deterministic(Cy(t))}async _getIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)return null;if(r.metadata.schema!==Ap)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:Ap});else if(r.metadata.schema!==Ap)throw new Error("Invalid document: schema is not IdentityIndex");return r}_getIndexProxy(t){let r=Ur(this,My)[t];return r==null&&(r=new Nf(async()=>await this._getOwnIDXDoc(t)),Ur(this,My)[t]=r),r}getDefinitionID(t){return Ur(this,o0).getDefinitionID(t)??t}async getDefinition(t){let r=await Ur(this,Po).load(t);if(r.metadata.schema!==KE)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 Ur(this,Po).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[o,s]=await this._setRecordOnly(t,r,n);return o&&await this._setReference(n.controller??this.id,t,s),s}async _setRecordOnly(t,r,n){let o=await this.getRecordID(t,n.controller??this.id);if(o==null){let s=await this.getDefinition(t),c=await this._createRecord(s,r,n);return[!0,c]}else{let s=await Ur(this,Po).update(o,r);return[!1,s.id]}}async _createRecord(t,r,{controller:n,pin:o}){let s=await Ur(this,Po).deterministic({controllers:[n??this.id],family:t.id.toString()},{pin:o});return await s.update(r,{schema:t.schema}),s.id}async _setReference(t,r,n){await this._getIndexProxy(t).changeContent(o=>({...o,[r]:n.toUrl()}))}async _setReferences(t,r){Object.keys(r).length!==0&&await this._getIndexProxy(t).changeContent(n=>({...n,...r}))}constructor(t){Bf(this,va,{writable:!0,value:void 0}),Bf(this,i0,{writable:!0,value:void 0}),Bf(this,My,{writable:!0,value:{}}),Bf(this,Po,{writable:!0,value:void 0}),Bf(this,o0,{writable:!0,value:void 0});let{cache:r,ceramic:n,id:o,loader:s,model:c}=t;n0(this,va,n),n0(this,i0,o),n0(this,Po,s??new ic({ceramic:n,cache:r})),n0(this,o0,c instanceof Du?c:new Du({loader:Ur(this,Po),aliases:c}))}};i(Pf,"DIDDataStore");var rr;(function(e){e.assertEqual=o=>o;function t(o){}i(t,"assertIs"),e.assertIs=t;function r(o){throw new Error}i(r,"assertNever"),e.assertNever=r,e.arrayToEnum=o=>{let s={};for(let c of o)s[c]=c;return s},e.getValidEnumValues=o=>{let s=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),c={};for(let l of s)c[l]=o[l];return e.objectValues(c)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let c in o)Object.prototype.hasOwnProperty.call(o,c)&&s.push(c);return s},e.find=(o,s)=>{for(let c of o)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(rr||(rr={}));var tt=rr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ya=i(e=>{switch(typeof e){case"undefined":return tt.undefined;case"string":return tt.string;case"number":return isNaN(e)?tt.nan:tt.number;case"boolean":return tt.boolean;case"function":return tt.function;case"bigint":return tt.bigint;case"symbol":return tt.symbol;case"object":return Array.isArray(e)?tt.array:e===null?tt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?tt.promise:typeof Map<"u"&&e instanceof Map?tt.map:typeof Set<"u"&&e instanceof Set?tt.set:typeof Date<"u"&&e instanceof Date?tt.date:tt.object;default:return tt.unknown}},"getParsedType"),Ke=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"]),fF=i(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ui=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:[]},o=i(s=>{for(let c of s.issues)if(c.code==="invalid_union")c.unionErrors.map(o);else if(c.code==="invalid_return_type")o(c.returnTypeError);else if(c.code==="invalid_arguments")o(c.argumentsError);else if(c.path.length===0)n._errors.push(r(c));else{let l=n,h=0;for(;h<c.path.length;){let p=c.path[h];h===c.path.length-1?(l[p]=l[p]||{_errors:[]},l[p]._errors.push(r(c))):l[p]=l[p]||{_errors:[]},l=l[p],h++}}},"processError");return o(this),n}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 o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};i(Ui,"ZodError");Ui.create=e=>new Ui(e);var Ff=i((e,t)=>{let r;switch(e.code){case Ke.invalid_type:e.received===tt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ke.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,rr.jsonStringifyReplacer)}`;break;case Ke.unrecognized_keys:r=`Unrecognized key(s) in object: ${rr.joinValues(e.keys,", ")}`;break;case Ke.invalid_union:r="Invalid input";break;case Ke.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${rr.joinValues(e.options)}`;break;case Ke.invalid_enum_value:r=`Invalid enum value. Expected ${rr.joinValues(e.options)}, received '${e.received}'`;break;case Ke.invalid_arguments:r="Invalid function arguments";break;case Ke.invalid_return_type:r="Invalid function return type";break;case Ke.invalid_date:r="Invalid date";break;case Ke.invalid_string:typeof e.validation=="object"?"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 Ke.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(e.minimum)}`:r="Invalid input";break;case Ke.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==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(e.maximum)}`:r="Invalid input";break;case Ke.custom:r="Invalid input";break;case Ke.invalid_intersection_types:r="Intersection results could not be merged";break;case Ke.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ke.not_finite:r="Number must be finite";break;default:r=t.defaultError,rr.assertNever(e)}return{message:r}},"errorMap"),R7=Ff;function dF(e){R7=e}i(dF,"setErrorMap");function s0(){return R7}i(s0,"getErrorMap");var c0=i(e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],c={...o,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...o,path:s,message:o.message||l}},"makeIssue"),hF=[];function vt(e,t){let r=c0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s0(),Ff].filter(n=>!!n)});e.common.issues.push(r)}i(vt,"addIssueToContext");var Xr=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 o of r){if(o.status==="aborted")return kt;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r)n.push({key:await o.key,value:await o.value});return Xr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:s,value:c}=o;if(s.status==="aborted"||c.status==="aborted")return kt;s.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),(typeof c.value<"u"||o.alwaysSet)&&(n[s.value]=c.value)}return{status:t.value,value:n}}};i(Xr,"ParseStatus");var kt=Object.freeze({status:"aborted"}),O7=i(e=>({status:"dirty",value:e}),"DIRTY"),Sn=i(e=>({status:"valid",value:e}),"OK"),Iy=i(e=>e.status==="aborted","isAborted"),ky=i(e=>e.status==="dirty","isDirty"),u0=i(e=>e.status==="valid","isValid"),l0=i(e=>typeof Promise!==void 0&&e instanceof Promise,"isAsync"),Wt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Wt||(Wt={}));var pi=class{constructor(t,r,n,o){this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._path.concat(this._key)}};i(pi,"ParseInputLazyPath");var I7=i((e,t)=>{if(u0(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Ui(e.common.issues);return{success:!1,error:r}}},"handleResult");function Vt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:i((c,l)=>c.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:n??l.defaultError}:{message:r??l.defaultError},"customMap"),description:o}}i(Vt,"processCreateParams");var Bt=class{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Ya(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Ya(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Xr,ctx:{common:t.parent.common,data:t.data,parsedType:Ya(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(l0(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 o={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:Ya(t)},s=this._parseSync({data:t,path:o.path,parent:o});return I7(o,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:Ya(t)},o=this._parse({data:t,path:n.path,parent:n}),s=await(l0(o)?o:Promise.resolve(o));return I7(n,s)}refine(t,r){let n=i(o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r,"getIssueProperties");return this._refinement((o,s)=>{let c=t(o),l=i(()=>s.addIssue({code:Ke.custom,...n(o)}),"setError");return typeof Promise<"u"&&c instanceof Promise?c.then(h=>h?!0:(l(),!1)):c?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Wn({schema:this,typeName:xt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return gi.create(this)}nullable(){return $o.create(this)}nullish(){return this.optional().nullable()}array(){return Gn.create(this)}promise(){return wa.create(this)}or(t){return rs.create([this,t])}and(t){return ns.create(this,t)}transform(t){return new Wn({schema:this,typeName:xt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new us({innerType:this,defaultValue:r,typeName:xt.ZodDefault})}brand(){return new Lf({typeName:xt.ZodBranded,type:this,...Vt(void 0)})}catch(t){let r=typeof t=="function"?t:()=>t;return new fc({innerType:this,defaultValue:r,typeName:xt.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ls.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};i(Bt,"ZodType");var pF=/^c[^\s-]{8,}$/i,mF=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,gF=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,vF=i(e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex"),$i=class extends Bt{constructor(){super(...arguments),this._regex=(t,r,n)=>this.refinement(o=>t.test(o),{validation:r,code:Ke.invalid_string,...Wt.errToObj(n)}),this.nonempty=t=>this.min(1,Wt.errToObj(t)),this.trim=()=>new $i({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==tt.string){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.string,received:s.parsedType}),kt}let n=new Xr,o;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.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&&(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.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)&&(o=this._getOrReturnCtx(t,o),c?vt(o,{code:Ke.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&vt(o,{code:Ke.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")gF.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"email",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")mF.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"uuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")pF.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"cuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),vt(o,{validation:"url",code:Ke.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"regex",code:Ke.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?vF(s).test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.invalid_string,validation:"datetime",message:s.message}),n.dirty()):rr.assertNever(s);return{status:n.value,value:t.data}}_addCheck(t){return new $i({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Wt.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Wt.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Wt.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Wt.errToObj(t)})}datetime(t){var r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,...Wt.errToObj(t?.message)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Wt.errToObj(r)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Wt.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Wt.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Wt.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Wt.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Wt.errToObj(r)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get 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($i,"ZodString");$i.create=e=>{var t;return new $i({checks:[],typeName:xt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};function yF(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=parseInt(e.toFixed(o).replace(".","")),c=parseInt(t.toFixed(o).replace(".",""));return s%c/Math.pow(10,o)}i(yF,"floatSafeRemainder");var io=class extends Bt{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)!==tt.number){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.number,received:s.parsedType}),kt}let n,o=new Xr;for(let s of this._def.checks)s.kind==="int"?rr.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?yF(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_finite,message:s.message}),o.dirty()):rr.assertNever(s);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Wt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Wt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Wt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Wt.toString(r))}setLimit(t,r,n,o){return new io({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Wt.toString(o)}]})}_addCheck(t){return new io({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Wt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Wt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Wt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Wt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Wt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Wt.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Wt.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")}};i(io,"ZodNumber");io.create=e=>new io({checks:[],typeName:xt.ZodNumber,coerce:e?.coerce||!1,...Vt(e)});var Xa=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==tt.bigint){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.bigint,received:n.parsedType}),kt}return Sn(t.data)}};i(Xa,"ZodBigInt");Xa.create=e=>{var t;return new Xa({typeName:xt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};var Qa=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==tt.boolean){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.boolean,received:n.parsedType}),kt}return Sn(t.data)}};i(Qa,"ZodBoolean");Qa.create=e=>new Qa({typeName:xt.ZodBoolean,coerce:e?.coerce||!1,...Vt(e)});var Lo=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==tt.date){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.date,received:s.parsedType}),kt}if(isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_date}),kt}let n=new Xr,o;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.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 Lo({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Wt.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Wt.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(Lo,"ZodDate");Lo.create=e=>new Lo({checks:[],coerce:e?.coerce||!1,typeName:xt.ZodDate,...Vt(e)});var sc=class extends Bt{_parse(t){if(this._getType(t)!==tt.symbol){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.symbol,received:n.parsedType}),kt}return Sn(t.data)}};i(sc,"ZodSymbol");sc.create=e=>new sc({typeName:xt.ZodSymbol,...Vt(e)});var es=class extends Bt{_parse(t){if(this._getType(t)!==tt.undefined){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.undefined,received:n.parsedType}),kt}return Sn(t.data)}};i(es,"ZodUndefined");es.create=e=>new es({typeName:xt.ZodUndefined,...Vt(e)});var ts=class extends Bt{_parse(t){if(this._getType(t)!==tt.null){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.null,received:n.parsedType}),kt}return Sn(t.data)}};i(ts,"ZodNull");ts.create=e=>new ts({typeName:xt.ZodNull,...Vt(e)});var ya=class extends Bt{constructor(){super(...arguments),this._any=!0}_parse(t){return Sn(t.data)}};i(ya,"ZodAny");ya.create=e=>new ya({typeName:xt.ZodAny,...Vt(e)});var Fo=class extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Sn(t.data)}};i(Fo,"ZodUnknown");Fo.create=e=>new Fo({typeName:xt.ZodUnknown,...Vt(e)});var ji=class extends Bt{_parse(t){let r=this._getOrReturnCtx(t);return vt(r,{code:Ke.invalid_type,expected:tt.never,received:r.parsedType}),kt}};i(ji,"ZodNever");ji.create=e=>new ji({typeName:xt.ZodNever,...Vt(e)});var cc=class extends Bt{_parse(t){if(this._getType(t)!==tt.undefined){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.void,received:n.parsedType}),kt}return Sn(t.data)}};i(cc,"ZodVoid");cc.create=e=>new cc({typeName:xt.ZodVoid,...Vt(e)});var Gn=class extends Bt{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==tt.array)return vt(r,{code:Ke.invalid_type,expected:tt.array,received:r.parsedType}),kt;if(o.exactLength!==null){let c=r.data.length>o.exactLength.value,l=r.data.length<o.exactLength.value;(c||l)&&(vt(r,{code:c?Ke.too_big:Ke.too_small,minimum:l?o.exactLength.value:void 0,maximum:c?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(vt(r,{code:Ke.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(vt(r,{code:Ke.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all(r.data.map((c,l)=>o.type._parseAsync(new pi(r,c,r.path,l)))).then(c=>Xr.mergeArray(n,c));let s=r.data.map((c,l)=>o.type._parseSync(new pi(r,c,r.path,l)));return Xr.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new Gn({...this._def,minLength:{value:t,message:Wt.toString(r)}})}max(t,r){return new Gn({...this._def,maxLength:{value:t,message:Wt.toString(r)}})}length(t,r){return new Gn({...this._def,exactLength:{value:t,message:Wt.toString(r)}})}nonempty(t){return this.min(1,t)}};i(Gn,"ZodArray");Gn.create=(e,t)=>new Gn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xt.ZodArray,...Vt(t)});var f0;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(f0||(f0={}));var k7=i(e=>t=>new wr({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function Ru(e){if(e instanceof wr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=gi.create(Ru(n))}return new wr({...e._def,shape:()=>t})}else return e instanceof Gn?Gn.create(Ru(e.element)):e instanceof gi?gi.create(Ru(e.unwrap())):e instanceof $o?$o.create(Ru(e.unwrap())):e instanceof mi?mi.create(e.items.map(t=>Ru(t))):e}i(Ru,"deepPartialify");var wr=class extends Bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=k7(this._def),this.extend=k7(this._def)}_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)!==tt.object){let p=this._getOrReturnCtx(t);return vt(p,{code:Ke.invalid_type,expected:tt.object,received:p.parsedType}),kt}let{status:n,ctx:o}=this._processInputParams(t),{shape:s,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof ji&&this._def.unknownKeys==="strip"))for(let p in o.data)c.includes(p)||l.push(p);let h=[];for(let p of c){let m=s[p],y=o.data[p];h.push({key:{status:"valid",value:p},value:m._parse(new pi(o,y,o.path,p)),alwaysSet:p in o.data})}if(this._def.catchall instanceof ji){let p=this._def.unknownKeys;if(p==="passthrough")for(let m of l)h.push({key:{status:"valid",value:m},value:{status:"valid",value:o.data[m]}});else if(p==="strict")l.length>0&&(vt(o,{code:Ke.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 m of l){let y=o.data[m];h.push({key:{status:"valid",value:m},value:p._parse(new pi(o,y,o.path,m)),alwaysSet:m in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let p=[];for(let m of h){let y=await m.key;p.push({key:y,value:await m.value,alwaysSet:m.alwaysSet})}return p}).then(p=>Xr.mergeObjectSync(n,p)):Xr.mergeObjectSync(n,h)}get shape(){return this._def.shape()}strict(t){return Wt.errToObj,new wr({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var o,s,c,l;let h=(c=(s=(o=this._def).errorMap)===null||s===void 0?void 0:s.call(o,r,n).message)!==null&&c!==void 0?c:n.defaultError;return r.code==="unrecognized_keys"?{message:(l=Wt.errToObj(t).message)!==null&&l!==void 0?l:h}:{message:h}}}:{}})}strip(){return new wr({...this._def,unknownKeys:"strip"})}passthrough(){return new wr({...this._def,unknownKeys:"passthrough"})}setKey(t,r){return this.augment({[t]:r})}merge(t){return new wr({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>f0.mergeShapes(this._def.shape(),t._def.shape()),typeName:xt.ZodObject})}catchall(t){return new wr({...this._def,catchall:t})}pick(t){let r={};return rr.objectKeys(t).map(n=>{this.shape[n]&&(r[n]=this.shape[n])}),new wr({...this._def,shape:()=>r})}omit(t){let r={};return rr.objectKeys(this.shape).map(n=>{rr.objectKeys(t).indexOf(n)===-1&&(r[n]=this.shape[n])}),new wr({...this._def,shape:()=>r})}deepPartial(){return Ru(this)}partial(t){let r={};if(t)return rr.objectKeys(this.shape).map(n=>{rr.objectKeys(t).indexOf(n)===-1?r[n]=this.shape[n]:r[n]=this.shape[n].optional()}),new wr({...this._def,shape:()=>r});for(let n in this.shape){let o=this.shape[n];r[n]=o.optional()}return new wr({...this._def,shape:()=>r})}required(t){let r={};if(t)rr.objectKeys(this.shape).map(n=>{if(rr.objectKeys(t).indexOf(n)===-1)r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof gi;)s=s._def.innerType;r[n]=s}});else for(let n in this.shape){let s=this.shape[n];for(;s instanceof gi;)s=s._def.innerType;r[n]=s}return new wr({...this._def,shape:()=>r})}keyof(){return N7(rr.objectKeys(this.shape))}};i(wr,"ZodObject");wr.create=(e,t)=>new wr({shape:()=>e,unknownKeys:"strip",catchall:ji.create(),typeName:xt.ZodObject,...Vt(t)});wr.strictCreate=(e,t)=>new wr({shape:()=>e,unknownKeys:"strict",catchall:ji.create(),typeName:xt.ZodObject,...Vt(t)});wr.lazycreate=(e,t)=>new wr({shape:e,unknownKeys:"strip",catchall:ji.create(),typeName:xt.ZodObject,...Vt(t)});var rs=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(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 Ui(l.ctx.common.issues));return vt(r,{code:Ke.invalid_union,unionErrors:c}),kt}if(i(o,"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(o);{let s,c=[];for(let h of n){let p={...r,common:{...r.common,issues:[]},parent:null},m=h._parseSync({data:r.data,path:r.path,parent:p});if(m.status==="valid")return m;m.status==="dirty"&&!s&&(s={result:m,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(h=>new Ui(h));return vt(r,{code:Ke.invalid_union,unionErrors:l}),kt}}get options(){return this._def.options}};i(rs,"ZodUnion");rs.create=(e,t)=>new rs({options:e,typeName:xt.ZodUnion,...Vt(t)});var a0=i(e=>e instanceof os?a0(e.schema):e instanceof Wn?a0(e.innerType()):e instanceof as?[e.value]:e instanceof ss?e.options:e instanceof cs?Object.keys(e.enum):e instanceof us?a0(e._def.innerType):e instanceof es?[void 0]:e instanceof ts?[null]:null,"getDiscriminator"),uc=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.object)return vt(r,{code:Ke.invalid_type,expected:tt.object,received:r.parsedType}),kt;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);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}):(vt(r,{code:Ke.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),kt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let s of r){let c=a0(s.shape[t]);if(!c)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let l of c){if(o.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);o.set(l,s)}}return new uc({typeName:xt.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Vt(n)})}};i(uc,"ZodDiscriminatedUnion");function Dy(e,t){let r=Ya(e),n=Ya(t);if(e===t)return{valid:!0,data:e};if(r===tt.object&&n===tt.object){let o=rr.objectKeys(t),s=rr.objectKeys(e).filter(l=>o.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=Dy(e[l],t[l]);if(!h.valid)return{valid:!1};c[l]=h.data}return{valid:!0,data:c}}else if(r===tt.array&&n===tt.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=Dy(c,l);if(!h.valid)return{valid:!1};o.push(h.data)}return{valid:!0,data:o}}else return r===tt.date&&n===tt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Dy,"mergeValues");var ns=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=i((s,c)=>{if(Iy(s)||Iy(c))return kt;let l=Dy(s.value,c.value);return l.valid?((ky(s)||ky(c))&&r.dirty(),{status:r.value,value:l.data}):(vt(n,{code:Ke.invalid_intersection_types}),kt)},"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])=>o(s,c)):o(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(ns,"ZodIntersection");ns.create=(e,t,r)=>new ns({left:e,right:t,typeName:xt.ZodIntersection,...Vt(r)});var mi=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.array)return vt(n,{code:Ke.invalid_type,expected:tt.array,received:n.parsedType}),kt;if(n.data.length<this._def.items.length)return vt(n,{code:Ke.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),kt;!this._def.rest&&n.data.length>this._def.items.length&&(vt(n,{code:Ke.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=n.data.map((c,l)=>{let h=this._def.items[l]||this._def.rest;return h?h._parse(new pi(n,c,n.path,l)):null}).filter(c=>!!c);return n.common.async?Promise.all(s).then(c=>Xr.mergeArray(r,c)):Xr.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new mi({...this._def,rest:t})}};i(mi,"ZodTuple");mi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mi({items:e,typeName:xt.ZodTuple,rest:null,...Vt(t)})};var is=class extends Bt{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!==tt.object)return vt(n,{code:Ke.invalid_type,expected:tt.object,received:n.parsedType}),kt;let o=[],s=this._def.keyType,c=this._def.valueType;for(let l in n.data)o.push({key:s._parse(new pi(n,l,n.path,l)),value:c._parse(new pi(n,n.data[l],n.path,l))});return n.common.async?Xr.mergeObjectAsync(r,o):Xr.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Bt?new is({keyType:t,valueType:r,typeName:xt.ZodRecord,...Vt(n)}):new is({keyType:$i.create(),valueType:t,typeName:xt.ZodRecord,...Vt(r)})}};i(is,"ZodRecord");var lc=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.map)return vt(n,{code:Ke.invalid_type,expected:tt.map,received:n.parsedType}),kt;let o=this._def.keyType,s=this._def.valueType,c=[...n.data.entries()].map(([l,h],p)=>({key:o._parse(new pi(n,l,n.path,[p,"key"])),value:s._parse(new pi(n,h,n.path,[p,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let h of c){let p=await h.key,m=await h.value;if(p.status==="aborted"||m.status==="aborted")return kt;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),l.set(p.value,m.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let h of c){let p=h.key,m=h.value;if(p.status==="aborted"||m.status==="aborted")return kt;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),l.set(p.value,m.value)}return{status:r.value,value:l}}}};i(lc,"ZodMap");lc.create=(e,t,r)=>new lc({valueType:t,keyType:e,typeName:xt.ZodMap,...Vt(r)});var Uo=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.set)return vt(n,{code:Ke.invalid_type,expected:tt.set,received:n.parsedType}),kt;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(vt(n,{code:Ke.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(vt(n,{code:Ke.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function c(h){let p=new Set;for(let m of h){if(m.status==="aborted")return kt;m.status==="dirty"&&r.dirty(),p.add(m.value)}return{status:r.value,value:p}}i(c,"finalizeSet");let l=[...n.data.values()].map((h,p)=>s._parse(new pi(n,h,n.path,p)));return n.common.async?Promise.all(l).then(h=>c(h)):c(l)}min(t,r){return new Uo({...this._def,minSize:{value:t,message:Wt.toString(r)}})}max(t,r){return new Uo({...this._def,maxSize:{value:t,message:Wt.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};i(Uo,"ZodSet");Uo.create=(e,t)=>new Uo({valueType:e,minSize:null,maxSize:null,typeName:xt.ZodSet,...Vt(t)});var ba=class extends Bt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.function)return vt(r,{code:Ke.invalid_type,expected:tt.function,received:r.parsedType}),kt;function n(l,h){return c0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,s0(),Ff].filter(p=>!!p),issueData:{code:Ke.invalid_arguments,argumentsError:h}})}i(n,"makeArgsIssue");function o(l,h){return c0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,s0(),Ff].filter(p=>!!p),issueData:{code:Ke.invalid_return_type,returnTypeError:h}})}i(o,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},c=r.data;return this._def.returns instanceof wa?Sn(async(...l)=>{let h=new Ui([]),p=await this._def.args.parseAsync(l,s).catch(b=>{throw h.addIssue(n(l,b)),h}),m=await c(...p);return await this._def.returns._def.type.parseAsync(m,s).catch(b=>{throw h.addIssue(o(m,b)),h})}):Sn((...l)=>{let h=this._def.args.safeParse(l,s);if(!h.success)throw new Ui([n(l,h.error)]);let p=c(...h.data),m=this._def.returns.safeParse(p,s);if(!m.success)throw new Ui([o(p,m.error)]);return m.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new ba({...this._def,args:mi.create(t).rest(Fo.create())})}returns(t){return new ba({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new ba({args:t||mi.create([]).rest(Fo.create()),returns:r||Fo.create(),typeName:xt.ZodFunction,...Vt(n)})}};i(ba,"ZodFunction");var os=class extends Bt{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(os,"ZodLazy");os.create=(e,t)=>new os({getter:e,typeName:xt.ZodLazy,...Vt(t)});var as=class extends Bt{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return vt(r,{code:Ke.invalid_literal,expected:this._def.value}),kt}return{status:"valid",value:t.data}}get value(){return this._def.value}};i(as,"ZodLiteral");as.create=(e,t)=>new as({value:e,typeName:xt.ZodLiteral,...Vt(t)});function N7(e,t){return new ss({values:e,typeName:xt.ZodEnum,...Vt(t)})}i(N7,"createZodEnum");var ss=class extends Bt{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return vt(r,{expected:rr.joinValues(n),received:r.parsedType,code:Ke.invalid_type}),kt}if(this._def.values.indexOf(t.data)===-1){let r=this._getOrReturnCtx(t),n=this._def.values;return vt(r,{received:r.data,code:Ke.invalid_enum_value,options:n}),kt}return Sn(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}};i(ss,"ZodEnum");ss.create=N7;var cs=class extends Bt{_parse(t){let r=rr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==tt.string&&n.parsedType!==tt.number){let o=rr.objectValues(r);return vt(n,{expected:rr.joinValues(o),received:n.parsedType,code:Ke.invalid_type}),kt}if(r.indexOf(t.data)===-1){let o=rr.objectValues(r);return vt(n,{received:n.data,code:Ke.invalid_enum_value,options:o}),kt}return Sn(t.data)}get enum(){return this._def.values}};i(cs,"ZodNativeEnum");cs.create=(e,t)=>new cs({values:e,typeName:xt.ZodNativeEnum,...Vt(t)});var wa=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.promise&&r.common.async===!1)return vt(r,{code:Ke.invalid_type,expected:tt.promise,received:r.parsedType}),kt;let n=r.parsedType===tt.promise?r.data:Promise.resolve(r.data);return Sn(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(wa,"ZodPromise");wa.create=(e,t)=>new wa({type:e,typeName:xt.ZodPromise,...Vt(t)});var Wn=class extends Bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null;if(o.type==="preprocess"){let c=o.transform(n.data);return n.common.async?Promise.resolve(c).then(l=>this._def.schema._parseAsync({data:l,path:n.path,parent:n})):this._def.schema._parseSync({data:c,path:n.path,parent:n})}let s={addIssue:c=>{vt(n,c),c.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="refinement"){let c=i(l=>{let h=o.refinement(l,s);if(n.common.async)return Promise.resolve(h);if(h 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"?kt:(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"?kt:(l.status==="dirty"&&r.dirty(),c(l.value).then(()=>({status:r.value,value:l.value}))))}if(o.type==="transform")if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!u0(c))return c;let l=o.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=>u0(c)?Promise.resolve(o.transform(c.value,s)).then(l=>({status:r.value,value:l})):c);rr.assertNever(o)}};i(Wn,"ZodEffects");Wn.create=(e,t,r)=>new Wn({schema:e,typeName:xt.ZodEffects,effect:t,...Vt(r)});Wn.createWithPreprocess=(e,t,r)=>new Wn({schema:t,effect:{type:"preprocess",transform:e},typeName:xt.ZodEffects,...Vt(r)});var gi=class extends Bt{_parse(t){return this._getType(t)===tt.undefined?Sn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(gi,"ZodOptional");gi.create=(e,t)=>new gi({innerType:e,typeName:xt.ZodOptional,...Vt(t)});var $o=class extends Bt{_parse(t){return this._getType(t)===tt.null?Sn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i($o,"ZodNullable");$o.create=(e,t)=>new $o({innerType:e,typeName:xt.ZodNullable,...Vt(t)});var us=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===tt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};i(us,"ZodDefault");us.create=(e,t)=>new us({innerType:e,typeName:xt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Vt(t)});var fc=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.innerType._parse({data:r.data,path:r.path,parent:r});return l0(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.defaultValue()})):{status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};i(fc,"ZodCatch");fc.create=(e,t)=>new fc({innerType:e,typeName:xt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Vt(t)});var dc=class extends Bt{_parse(t){if(this._getType(t)!==tt.nan){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.nan,received:n.parsedType}),kt}return{status:"valid",value:t.data}}};i(dc,"ZodNaN");dc.create=e=>new dc({typeName:xt.ZodNaN,...Vt(e)});var bF=Symbol("zod_brand"),Lf=class extends Bt{_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(Lf,"ZodBranded");var ls=class extends Bt{_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"?kt:s.status==="dirty"?(r.dirty(),O7(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?kt:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new ls({in:t,out:r,typeName:xt.ZodPipeline})}};i(ls,"ZodPipeline");var B7=i((e,t={},r)=>e?ya.create().superRefine((n,o)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...c,fatal:r})}}):ya.create(),"custom"),wF={object:wr.lazycreate},xt;(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"})(xt||(xt={}));var _F=i((e,t={message:`Input not instance of ${e.name}`})=>B7(r=>r instanceof e,t,!0),"instanceOfType"),P7=$i.create,L7=io.create,EF=dc.create,AF=Xa.create,F7=Qa.create,SF=Lo.create,xF=sc.create,TF=es.create,CF=ts.create,MF=ya.create,IF=Fo.create,kF=ji.create,DF=cc.create,RF=Gn.create,OF=wr.create,NF=wr.strictCreate,BF=rs.create,PF=uc.create,LF=ns.create,FF=mi.create,UF=is.create,$F=lc.create,jF=Uo.create,zF=ba.create,HF=os.create,qF=as.create,VF=ss.create,KF=cs.create,GF=wa.create,D7=Wn.create,WF=gi.create,JF=$o.create,ZF=Wn.createWithPreprocess,YF=ls.create,XF=i(()=>P7().optional(),"ostring"),QF=i(()=>L7().optional(),"onumber"),eU=i(()=>F7().optional(),"oboolean"),tU={string:e=>$i.create({...e,coerce:!0}),number:e=>io.create({...e,coerce:!0}),boolean:e=>Qa.create({...e,coerce:!0}),bigint:e=>Xa.create({...e,coerce:!0}),date:e=>Lo.create({...e,coerce:!0})},rU=kt,K=Object.freeze({__proto__:null,defaultErrorMap:Ff,setErrorMap:dF,getErrorMap:s0,makeIssue:c0,EMPTY_PATH:hF,addIssueToContext:vt,ParseStatus:Xr,INVALID:kt,DIRTY:O7,OK:Sn,isAborted:Iy,isDirty:ky,isValid:u0,isAsync:l0,get util(){return rr},ZodParsedType:tt,getParsedType:Ya,ZodType:Bt,ZodString:$i,ZodNumber:io,ZodBigInt:Xa,ZodBoolean:Qa,ZodDate:Lo,ZodSymbol:sc,ZodUndefined:es,ZodNull:ts,ZodAny:ya,ZodUnknown:Fo,ZodNever:ji,ZodVoid:cc,ZodArray:Gn,get objectUtil(){return f0},ZodObject:wr,ZodUnion:rs,ZodDiscriminatedUnion:uc,ZodIntersection:ns,ZodTuple:mi,ZodRecord:is,ZodMap:lc,ZodSet:Uo,ZodFunction:ba,ZodLazy:os,ZodLiteral:as,ZodEnum:ss,ZodNativeEnum:cs,ZodPromise:wa,ZodEffects:Wn,ZodTransformer:Wn,ZodOptional:gi,ZodNullable:$o,ZodDefault:us,ZodCatch:fc,ZodNaN:dc,BRAND:bF,ZodBranded:Lf,ZodPipeline:ls,custom:B7,Schema:Bt,ZodSchema:Bt,late:wF,get ZodFirstPartyTypeKind(){return xt},coerce:tU,any:MF,array:RF,bigint:AF,boolean:F7,date:SF,discriminatedUnion:PF,effect:D7,enum:VF,function:zF,instanceof:_F,intersection:LF,lazy:HF,literal:qF,map:$F,nan:EF,nativeEnum:KF,never:kF,null:CF,nullable:JF,number:L7,object:OF,oboolean:eU,onumber:QF,optional:WF,ostring:XF,pipeline:YF,preprocess:ZF,promise:GF,record:UF,set:jF,strictObject:NF,string:P7,symbol:xF,transformer:D7,tuple:FF,undefined:TF,union:BF,unknown:IF,void:DF,NEVER:rU,ZodIssueCode:Ke,quotelessJson:fF,ZodError:Ui});var nU=Object.defineProperty,iU=i((e,t)=>nU(e,"name",{value:t,configurable:!0}),"__name"),p0=K.array(K.string().or(K.record(K.any()))),bZ=K.object({type:K.string().optional(),narrative:K.string().optional()}),m0=K.string().or(K.object({id:K.string(),type:K.string(),caption:K.string().optional()})),oU=K.object({type:K.string().min(1).or(K.string().array().nonempty()),latitude:K.number(),longitude:K.number()}),aU=K.object({type:K.string().min(1).or(K.string().array().nonempty()),addressCountry:K.string().optional(),addressCountryCode:K.string().optional(),addressRegion:K.string().optional(),addressLocality:K.string().optional(),streetAddress:K.string().optional(),postOfficeBoxNumber:K.string().optional(),postalCode:K.string().optional(),geo:oU.optional()}),sU=K.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(K.string()),j7=K.object({type:K.string().min(1).or(K.string().array().nonempty()),identifier:K.string(),identifierType:sU}),Uf=K.string().or(K.object({id:K.string().optional(),type:K.string().or(K.string().array().nonempty().optional()),name:K.string().optional(),url:K.string().optional(),phone:K.string().optional(),description:K.string().optional(),endorsement:K.any().array().optional(),image:m0.optional(),email:K.string().email().optional(),address:aU.optional(),otherIdentifier:j7.array().optional(),official:K.string().optional(),parentOrg:K.any().optional(),familyName:K.string().optional(),givenName:K.string().optional(),additionalName:K.string().optional(),patronymicName:K.string().optional(),honorificPrefix:K.string().optional(),honorificSuffix:K.string().optional(),familyNamePrefix:K.string().optional(),dateOfBirth:K.string().optional()}).catchall(K.any())),Ry=K.object({id:K.string().optional()}).catchall(K.any()),cU=K.object({type:K.string(),id:K.string()}).catchall(K.any()),uU=K.object({id:K.string(),type:K.string()}).catchall(K.any()),lU=K.object({id:K.string(),type:K.string()}).catchall(K.any()),d0=K.object({"@context":p0,id:K.string().optional(),type:K.string().array().nonempty(),issuer:Uf,issuanceDate:K.string(),expirationDate:K.string().optional(),credentialSubject:Ry.or(Ry.array()),credentialStatus:cU.optional(),credentialSchema:uU.array().optional(),refreshService:lU.optional()}).catchall(K.any()),jo=K.object({type:K.string(),created:K.string(),challenge:K.string().optional(),domain:K.string().optional(),nonce:K.string().optional(),proofPurpose:K.string(),verificationMethod:K.string(),jws:K.string().optional()}).catchall(K.any()),h0=d0.extend({proof:jo.or(jo.array())}),fU=K.object({"@context":p0,id:K.string().optional(),type:K.string().or(K.string().array().nonempty()),verifiableCredential:h0.or(h0.array()).optional(),holder:K.string().optional()}).catchall(K.any()),wZ=fU.extend({proof:jo.or(jo.array())}),z7=K.object({kty:K.string(),crv:K.string(),x:K.string(),y:K.string().optional(),n:K.string().optional(),d:K.string()}),dU=K.object({alg:K.string(),iv:K.string(),tag:K.string(),epk:z7.partial().optional(),kid:K.string().optional(),apv:K.string().optional(),apu:K.string().optional()}),hU=K.object({header:dU,encrypted_key:K.string()}),pU=K.object({protected:K.string(),iv:K.string(),ciphertext:K.string(),tag:K.string(),aad:K.string().optional(),recipients:hU.array().optional()}),hc=K.string().or(K.object({"@context":p0.optional(),id:K.string(),type:K.string(),controller:K.string(),publicKeyJwk:z7.optional(),publicKeyBase58:K.string().optional(),blockChainAccountId:K.string().optional()}).catchall(K.any())),mU=K.object({id:K.string(),type:K.string().or(K.string().array().nonempty()),serviceEndpoint:K.any().or(K.any().array().nonempty())}).catchall(K.any()),AZ=K.object({"@context":p0,id:K.string(),alsoKnownAs:K.string().optional(),controller:K.string().or(K.string().array().nonempty()).optional(),verificationMethod:hc.array().optional(),authentication:hc.array().optional(),assertionMethod:hc.array().optional(),keyAgreement:hc.array().optional(),capabilityInvocation:hc.array().optional(),capabilityDelegation:hc.array().optional(),publicKey:hc.array().optional(),service:mU.array().optional(),proof:jo.or(jo.array()).optional()}).catchall(K.any()),gU=K.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(K.string()),g0=K.object({type:K.string().array().nonempty(),targetCode:K.string().optional(),targetDescription:K.string().optional(),targetName:K.string(),targetFramework:K.string().optional(),targetType:gU.optional(),targetUrl:K.string()}),vU=K.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"]),yU=vU.or(K.string()),bU=K.object({id:K.string().optional(),narrative:K.string().optional()}).catchall(K.any()),wU=K.object({id:K.string(),type:K.string().array().nonempty(),endorsementComment:K.string().optional()}),_U=d0.extend({credentialSubject:wU,proof:jo.or(jo.array()).optional()}),EU=K.object({id:K.string(),"@language":K.string().optional(),version:K.string().optional()}),AU=K.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(K.string()),SU=K.object({id:K.string(),type:K.string().array().nonempty(),alignment:g0.array().optional(),description:K.string().optional(),level:K.string().optional(),name:K.string(),points:K.string().optional()}).catchall(K.any()),xU=K.object({id:K.string(),type:K.string().array().nonempty(),alignment:g0.array().optional(),allowedValue:K.string().array().optional(),name:K.string(),requiredLevel:K.string().optional(),requiredValue:K.string().optional(),resultType:AU,rubricCriterionLevel:SU.array().optional(),valueMax:K.string().optional(),valueMin:K.string().optional()}).catchall(K.any()),TU=K.object({id:K.string().optional(),type:K.string().array().nonempty(),alignment:g0.array().optional(),achievementType:yU.optional(),creator:Uf.optional(),creditsAvailable:K.number().optional(),criteria:bU,description:K.string(),endorsement:_U.array().optional(),fieldOfStudy:K.string().optional(),humanCode:K.string().optional(),image:m0.optional(),"@language":K.string().optional(),name:K.string(),otherIdentifier:j7.array().optional(),related:EU.array().optional(),resultDescription:xU.array().optional(),specialization:K.string().optional(),tag:K.string().array().optional(),version:K.string().optional()}).catchall(K.any()),CU=K.object({type:K.string(),hashed:K.boolean(),identityHash:K.string(),identityType:K.string(),salt:K.string().optional()}),MU=K.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),IU=K.object({type:K.string().array().nonempty(),achievedLevel:K.string().optional(),alignment:g0.array().optional(),resultDescription:K.string().optional(),status:MU.optional(),value:K.string().optional()}).catchall(K.any()),U7=K.object({id:K.string().optional(),type:K.string().array().nonempty(),activityEndDate:K.string().optional(),activityStartDate:K.string().optional(),creditsEarned:K.number().optional(),achievement:TU.optional(),identifier:CU.array().optional(),image:m0.optional(),licenseNumber:K.string().optional(),narrative:K.string().optional(),result:IU.array().optional(),role:K.string().optional(),source:Uf.optional(),term:K.string().optional()}).catchall(K.any()),kU=K.object({id:K.string().optional(),type:K.string().array().nonempty(),narrative:K.string().optional(),name:K.string().optional(),description:K.string().optional(),genre:K.string().optional(),audience:K.string().optional()}).catchall(K.any()),DU=d0.extend({name:K.string().optional(),description:K.string().optional(),image:m0.optional(),credentialSubject:U7.or(U7.array()),endorsement:d0.array().optional(),evidence:kU.array().optional()}),xZ=DU.extend({proof:jo.or(jo.array())}),CZ=K.object({checks:K.string().array(),warnings:K.string().array(),errors:K.string().array()}),H7=K.enum(["Success","Failed","Error"]),MZ=H7.enum,IZ=K.object({check:K.string(),status:H7,message:K.string().optional(),details:K.string().optional()}),kZ=K.object({title:K.string().optional(),createdAt:K.string().optional(),issuer:Uf.optional(),issuee:Uf.optional(),credentialSubject:Ry.optional()}),mc=K.object({id:K.string(),uri:K.string()}).catchall(K.any()),OZ=K.object({limit:K.number(),cursor:K.string().optional(),sort:K.string().optional()}),oo=K.object({cursor:K.string().optional(),hasMore:K.boolean()}),q7=K.object({encryptedRecord:pU,fields:K.string().array()}).catchall(K.any()),NZ=oo.extend({records:q7.array()}),RU=q7.extend({id:K.string()}),BZ=oo.extend({records:RU.array()}),$7=iU(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),OU=K.instanceof(RegExp).or(K.string().refine(e=>{try{return $7(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=$7(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),cn=K.string().or(K.object({$in:K.string().array()})).or(K.object({$regex:OU})),NU=K.object({backgroundColor:K.string().optional(),backgroundImage:K.string().optional(),fadeBackgroundImage:K.boolean().optional(),repeatBackgroundImage:K.boolean().optional(),fontColor:K.string().optional(),accentColor:K.string().optional(),accentFontColor:K.string().optional(),idBackgroundImage:K.string().optional(),fadeIdBackgroundImage:K.boolean().optional(),idBackgroundColor:K.string().optional(),repeatIdBackgroundImage:K.boolean().optional()}),pc=K.object({profileId:K.string().min(3).max(40),displayName:K.string().default(""),shortBio:K.string().default(""),bio:K.string().default(""),did:K.string(),email:K.string().optional(),image:K.string().optional(),heroImage:K.string().optional(),websiteLink:K.string().optional(),isServiceProfile:K.boolean().default(!1).optional(),type:K.string().optional(),notificationsWebhook:K.string().url().startsWith("http").optional(),display:NU.optional()}),FZ=K.object({profileId:cn,displayName:cn,shortBio:cn,bio:cn,email:cn,websiteLink:cn,isServiceProfile:K.boolean(),type:cn}).partial(),UZ=oo.extend({records:pc.array()}),$Z=K.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),V7=K.object({id:K.string(),created:K.string(),displayName:K.string().default("").optional(),shortBio:K.string().default("").optional(),bio:K.string().default("").optional(),email:K.string().optional(),image:K.string().optional(),heroImage:K.string().optional()}),jZ=oo.extend({records:V7.extend({did:K.string()}).array()}),zZ=K.object({id:cn,displayName:cn,shortBio:cn,bio:cn,email:cn}).partial(),HZ=oo.extend({records:K.object({profile:pc,manager:V7.extend({did:K.string()}).optional()}).array()}),qZ=K.object({uri:K.string(),to:K.string(),from:K.string(),sent:K.string().datetime(),received:K.string().datetime().optional()}),BU=K.object({role:K.string(),canEdit:K.boolean(),canIssue:K.boolean(),canRevoke:K.boolean(),canManagePermissions:K.boolean(),canIssueChildren:K.string(),canCreateChildren:K.string(),canEditChildren:K.string(),canRevokeChildren:K.string(),canManageChildrenPermissions:K.string(),canManageChildrenProfiles:K.boolean().default(!1).optional(),canViewAnalytics:K.boolean()}),Oy=K.enum(["DRAFT","LIVE"]),PU=K.object({uri:K.string(),name:K.string().optional(),type:K.string().optional(),category:K.string().optional(),status:Oy.optional(),autoConnectRecipients:K.boolean().optional(),meta:K.record(K.any()).optional(),claimPermissions:BU.optional()}),VZ=K.object({uri:cn,name:cn,type:cn,category:cn,meta:K.record(cn),status:Oy.or(K.object({$in:Oy.array()})),autoConnectRecipients:K.boolean()}).partial(),KZ=oo.extend({records:PU.array()}),LU=K.object({to:pc,from:K.string(),received:K.string().optional(),uri:K.string().optional()}),GZ=oo.extend({records:LU.array()}),WZ=K.object({endpoint:K.string(),name:K.string(),did:K.string().optional()}),JZ=K.object({ttlSeconds:K.number().optional(),totalUses:K.number().optional()}),FU=K.object({endpoint:K.string()}),ZZ=K.object({signingAuthority:FU,relationship:K.object({name:K.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:K.string()})}),UU=K.enum(["live","stale","withdrawn"]),$U=K.object({read:K.object({anonymize:K.boolean().optional(),credentials:K.object({categories:K.record(K.object({required:K.boolean()})).default({})}).default({}),personal:K.record(K.object({required:K.boolean()})).default({})}).default({}),write:K.object({credentials:K.object({categories:K.record(K.object({required:K.boolean()})).default({})}).default({}),personal:K.record(K.object({required:K.boolean()})).default({})}).default({})}),K7=K.object({contract:$U,owner:pc,name:K.string(),subtitle:K.string().optional(),description:K.string().optional(),reasonForAccessing:K.string().optional(),image:K.string().optional(),uri:K.string(),createdAt:K.string(),updatedAt:K.string(),expiresAt:K.string().optional()}),YZ=oo.extend({records:K7.omit({owner:!0}).array()}),jU=K.object({credentials:K.object({categories:K.record(K.string().array()).default({})}),personal:K.record(K.string()).default({}),date:K.string()}),XZ=oo.extend({records:jU.array()}),G7=K.object({sharing:K.boolean().optional(),shared:K.string().array().optional(),shareAll:K.boolean().optional(),shareUntil:K.string().optional()}),W7=K.object({read:K.object({anonymize:K.boolean().optional(),credentials:K.object({shareAll:K.boolean().optional(),sharing:K.boolean().optional(),categories:K.record(G7).default({})}).default({}),personal:K.record(K.string()).default({})}).default({}),write:K.object({credentials:K.object({categories:K.record(K.boolean()).default({})}).default({}),personal:K.record(K.boolean()).default({})}).default({})}),QZ=oo.extend({records:K.object({expiresAt:K.string().optional(),oneTime:K.boolean().optional(),terms:W7,contract:K7,uri:K.string(),consenter:pc,status:UU}).array()}),eY=K.object({read:K.object({anonymize:K.boolean().optional(),credentials:K.object({categories:K.record(K.object({required:K.boolean().optional()})).optional()}).optional(),personal:K.record(K.object({required:K.boolean().optional()})).optional()}).optional(),write:K.object({credentials:K.object({categories:K.record(K.object({required:K.boolean().optional()})).optional()}).optional(),personal:K.record(K.object({required:K.boolean().optional()})).optional()}).optional()}),tY=K.object({anonymize:K.boolean().optional(),credentials:K.object({categories:K.record(K.boolean()).optional()}).optional(),personal:K.record(K.boolean()).optional()}),zU=K.object({read:K.object({anonymize:K.boolean().optional(),credentials:K.object({shareAll:K.boolean().optional(),sharing:K.boolean().optional(),categories:K.record(G7.optional()).optional()}).optional(),personal:K.record(K.string()).optional()}).optional(),write:K.object({credentials:K.object({categories:K.record(K.boolean()).optional()}).optional(),personal:K.record(K.boolean()).optional()}).optional()}),Ny=K.enum(["consent","update","sync","withdraw"]),rY=K.object({terms:zU.optional(),action:Ny.or(Ny.array()).optional(),date:K.object({$gt:K.string()}).or(K.object({$lt:K.string()})).or(K.object({$eq:K.string()})).optional(),expiresAt:K.object({$gt:K.string()}).or(K.object({$lt:K.string()})).or(K.object({$eq:K.string()})).optional(),oneTime:K.boolean().optional()}),J7=K.object({expiresAt:K.string().optional(),oneTime:K.boolean().optional(),terms:W7.optional(),id:K.string(),action:Ny,date:K.string()}),nY=oo.extend({records:J7.array()}),HU=K.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),qU=K.object({title:K.string().optional(),body:K.string().optional()}),VU=K.object({vcUris:K.array(K.string()).optional(),vpUris:K.array(K.string()).optional(),transaction:J7.optional()}),iY=K.object({type:HU,to:pc.partial().and(K.object({did:K.string()})),from:pc.partial().and(K.object({did:K.string()})),message:qU.optional(),data:VU.optional(),sent:K.string().datetime().optional()});var KU=Object.create,yd=Object.defineProperty,GU=Object.getOwnPropertyDescriptor,s6=Object.getOwnPropertyNames,WU=Object.getPrototypeOf,JU=Object.prototype.hasOwnProperty,a=i((e,t)=>yd(e,"name",{value:t,configurable:!0}),"__name"),cb=(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')}),pr=i((e,t)=>i(function(){return e&&(t=(0,e[s6(e)[0]])(e=0)),t},"__init"),"__esm"),ze=i((e,t)=>i(function(){return t||(0,e[s6(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require2"),"__commonJS"),Ar=i((e,t)=>{for(var r in t)yd(e,r,{get:t[r],enumerable:!0})},"__export"),hS=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of s6(t))!JU.call(e,o)&&o!==r&&yd(e,o,{get:()=>t[o],enumerable:!(n=GU(t,o))||n.enumerable});return e},"__copyProps"),ir=i((e,t,r)=>(r=e!=null?KU(WU(e)):{},hS(t||!e||!e.__esModule?yd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),By=i(e=>hS(yd({},"__esModule",{value:!0}),e),"__toCommonJS"),ZU=ze({"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(e,t){(function(){var r,n="4.17.21",o=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",p=500,m="__lodash_placeholder__",y=1,b=2,_=4,x=1,D=2,O=1,B=2,Z=4,$=8,z=16,Q=32,Y=64,k=128,q=256,he=512,me=30,we="...",J=800,w=16,T=1,g=2,f=3,v=1/0,E=9007199254740991,R=17976931348623157e292,C=0/0,A=4294967295,P=A-1,H=A>>>1,I=[["ary",k],["bind",O],["bindKey",B],["curry",$],["curryRight",z],["flip",he],["partial",Q],["partialRight",Y],["rearg",q]],F="[object Arguments]",ge="[object Array]",L="[object AsyncFunction]",ne="[object Boolean]",ae="[object Date]",M="[object DOMException]",V="[object Error]",oe="[object Function]",fe="[object GeneratorFunction]",be="[object Map]",Re="[object Number]",X="[object Null]",N="[object Object]",U="[object Promise]",W="[object Proxy]",ie="[object RegExp]",ee="[object Set]",ue="[object String]",Ae="[object Symbol]",De="[object Undefined]",Ie="[object WeakMap]",Pe="[object WeakSet]",qe="[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]",Ct="[object Uint16Array]",Ve="[object Uint32Array]",He=/\b__p \+= '';/g,Rt=/\b(__p \+=) '' \+/g,dt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,Dr=/[&<>"']/g,ct=RegExp(mt.source),ut=RegExp(Dr.source),lr=/<%-([\s\S]+?)%>/g,lt=/<%([\s\S]+?)%>/g,nt=/<%=([\s\S]+?)%>/g,ar=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,it=/^\w*$/,Xe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qt=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(Qt.source),et=/^\s+/,sr=/\s/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ze=/\{\n\/\* \[wrapped with (.+)\] \*/,cr=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Et=/[()=,{}\[\]\/\s]/,Tn=/\\(\\)?/g,At=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yt=/\w*$/,hn=/^[-+]0x[0-9a-f]+$/i,er=/^0b[01]+$/i,tr=/^\[object .+?Constructor\]$/,tn=/^0o[0-7]+$/i,rn=/^(?:0|[1-9]\d*)$/,Rr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Hr=/($^)/,nn=/['\n\r\u2028\u2029\\]/g,Cn="\\ud800-\\udfff",xi="\\u0300-\\u036f",Ti="\\ufe20-\\ufe2f",Ci="\\u20d0-\\u20ff",Ln=xi+Ti+Ci,pn="\\u2700-\\u27bf",ei="a-z\\xdf-\\xf6\\xf8-\\xff",Fn="\\xac\\xb1\\xd7\\xf7",Mi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ii="\\u2000-\\u206f",ki=" \\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",ea="A-Z\\xc0-\\xd6\\xd8-\\xde",ta="\\ufe0e\\ufe0f",ra=Fn+Mi+Ii+ki,Ba="['\u2019]",Nd="["+Cn+"]",wl="["+ra+"]",ks="["+Ln+"]",_l="\\d+",Bd="["+pn+"]",El="["+ei+"]",Al="[^"+Cn+ra+_l+pn+ei+ea+"]",Ds="\\ud83c[\\udffb-\\udfff]",Pd="(?:"+ks+"|"+Ds+")",Sl="[^"+Cn+"]",na="(?:\\ud83c[\\udde6-\\uddff]){2}",Wi="[\\ud800-\\udbff][\\udc00-\\udfff]",ia="["+ea+"]",wo="\\u200d",xl="(?:"+El+"|"+Al+")",Ld="(?:"+ia+"|"+Al+")",Tl="(?:"+Ba+"(?:d|ll|m|re|s|t|ve))?",Cl="(?:"+Ba+"(?:D|LL|M|RE|S|T|VE))?",Ml=Pd+"?",Il="["+ta+"]?",kl="(?:"+wo+"(?:"+[Sl,na,Wi].join("|")+")"+Il+Ml+")*",_o="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fd="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Hc=Il+Ml+kl,Ud="(?:"+[Bd,na,Wi].join("|")+")"+Hc,Dl="(?:"+[Sl+ks+"?",ks,na,Wi,Nd].join("|")+")",Rl=RegExp(Ba,"g"),$d=RegExp(ks,"g"),Ol=RegExp(Ds+"(?="+Ds+")|"+Dl+Hc,"g"),Nl=RegExp([ia+"?"+El+"+"+Tl+"(?="+[wl,ia,"$"].join("|")+")",Ld+"+"+Cl+"(?="+[wl,ia+xl,"$"].join("|")+")",ia+"?"+xl+"+"+Tl,ia+"+"+Cl,Fd,_o,_l,Ud].join("|"),"g"),jd=RegExp("["+wo+Cn+Ln+ta+"]"),Rs=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,zd=["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"],qc=-1,yr={};yr[pe]=yr[re]=yr[le]=yr[_e]=yr[Te]=yr[Ce]=yr[Oe]=yr[Ct]=yr[Ve]=!0,yr[F]=yr[ge]=yr[qe]=yr[ne]=yr[ve]=yr[ae]=yr[V]=yr[oe]=yr[be]=yr[Re]=yr[N]=yr[ie]=yr[ee]=yr[ue]=yr[Ie]=!1;var mr={};mr[F]=mr[ge]=mr[qe]=mr[ve]=mr[ne]=mr[ae]=mr[pe]=mr[re]=mr[le]=mr[_e]=mr[Te]=mr[be]=mr[Re]=mr[N]=mr[ie]=mr[ee]=mr[ue]=mr[Ae]=mr[Ce]=mr[Oe]=mr[Ct]=mr[Ve]=!0,mr[V]=mr[oe]=mr[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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Le={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},qr=parseFloat,on=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,mn=typeof self=="object"&&self&&self.Object===Object&&self,Lr=Mn||mn||Function("return this")(),Eo=typeof e=="object"&&e&&!e.nodeType&&e,Ao=Eo&&typeof t=="object"&&t&&!t.nodeType&&t,Bl=Ao&&Ao.exports===Eo,Vc=Bl&&Mn.process,gn=function(){try{var Se=Ao&&Ao.require&&Ao.require("util").types;return Se||Vc&&Vc.binding&&Vc.binding("util")}catch{}}(),Os=gn&&gn.isArrayBuffer,j2=gn&&gn.isDate,z2=gn&&gn.isMap,H2=gn&&gn.isRegExp,q2=gn&&gn.isSet,V2=gn&&gn.isTypedArray;function Un(Se,Be,ke){switch(ke.length){case 0:return Se.call(Be);case 1:return Se.call(Be,ke[0]);case 2:return Se.call(Be,ke[0],ke[1]);case 3:return Se.call(Be,ke[0],ke[1],ke[2])}return Se.apply(Be,ke)}i(Un,"apply"),a(Un,"apply");function K2(Se,Be,ke,ft){for(var It=-1,fr=Se==null?0:Se.length;++It<fr;){var Kr=Se[It];Be(ft,Kr,ke(Kr),Se)}return ft}i(K2,"arrayAggregator"),a(K2,"arrayAggregator");function ti(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft&&Be(Se[ke],ke,Se)!==!1;);return Se}i(ti,"arrayEach"),a(ti,"arrayEach");function G2(Se,Be){for(var ke=Se==null?0:Se.length;ke--&&Be(Se[ke],ke,Se)!==!1;);return Se}i(G2,"arrayEachRight"),a(G2,"arrayEachRight");function r1(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft;)if(!Be(Se[ke],ke,Se))return!1;return!0}i(r1,"arrayEvery"),a(r1,"arrayEvery");function oa(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length,It=0,fr=[];++ke<ft;){var Kr=Se[ke];Be(Kr,ke,Se)&&(fr[It++]=Kr)}return fr}i(oa,"arrayFilter"),a(oa,"arrayFilter");function Pl(Se,Be){var ke=Se==null?0:Se.length;return!!ke&&Ns(Se,Be,0)>-1}i(Pl,"arrayIncludes"),a(Pl,"arrayIncludes");function Hd(Se,Be,ke){for(var ft=-1,It=Se==null?0:Se.length;++ft<It;)if(ke(Be,Se[ft]))return!0;return!1}i(Hd,"arrayIncludesWith"),a(Hd,"arrayIncludesWith");function Tr(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length,It=Array(ft);++ke<ft;)It[ke]=Be(Se[ke],ke,Se);return It}i(Tr,"arrayMap"),a(Tr,"arrayMap");function aa(Se,Be){for(var ke=-1,ft=Be.length,It=Se.length;++ke<ft;)Se[It+ke]=Be[ke];return Se}i(aa,"arrayPush"),a(aa,"arrayPush");function qd(Se,Be,ke,ft){var It=-1,fr=Se==null?0:Se.length;for(ft&&fr&&(ke=Se[++It]);++It<fr;)ke=Be(ke,Se[It],It,Se);return ke}i(qd,"arrayReduce"),a(qd,"arrayReduce");function W2(Se,Be,ke,ft){var It=Se==null?0:Se.length;for(ft&&It&&(ke=Se[--It]);It--;)ke=Be(ke,Se[It],It,Se);return ke}i(W2,"arrayReduceRight"),a(W2,"arrayReduceRight");function Vd(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft;)if(Be(Se[ke],ke,Se))return!0;return!1}i(Vd,"arraySome"),a(Vd,"arraySome");var Jk=Kd("length");function J2(Se){return Se.split("")}i(J2,"asciiToArray"),a(J2,"asciiToArray");function Z2(Se){return Se.match(st)||[]}i(Z2,"asciiWords"),a(Z2,"asciiWords");function n1(Se,Be,ke){var ft;return ke(Se,function(It,fr,Kr){if(Be(It,fr,Kr))return ft=fr,!1}),ft}i(n1,"baseFindKey"),a(n1,"baseFindKey");function Ll(Se,Be,ke,ft){for(var It=Se.length,fr=ke+(ft?1:-1);ft?fr--:++fr<It;)if(Be(Se[fr],fr,Se))return fr;return-1}i(Ll,"baseFindIndex"),a(Ll,"baseFindIndex");function Ns(Se,Be,ke){return Be===Be?a3(Se,Be,ke):Ll(Se,i1,ke)}i(Ns,"baseIndexOf"),a(Ns,"baseIndexOf");function Y2(Se,Be,ke,ft){for(var It=ke-1,fr=Se.length;++It<fr;)if(ft(Se[It],Be))return It;return-1}i(Y2,"baseIndexOfWith"),a(Y2,"baseIndexOfWith");function i1(Se){return Se!==Se}i(i1,"baseIsNaN"),a(i1,"baseIsNaN");function o1(Se,Be){var ke=Se==null?0:Se.length;return ke?Wd(Se,Be)/ke:C}i(o1,"baseMean"),a(o1,"baseMean");function Kd(Se){return function(Be){return Be==null?r:Be[Se]}}i(Kd,"baseProperty"),a(Kd,"baseProperty");function Gd(Se){return function(Be){return Se==null?r:Se[Be]}}i(Gd,"basePropertyOf"),a(Gd,"basePropertyOf");function a1(Se,Be,ke,ft,It){return It(Se,function(fr,Kr,br){ke=ft?(ft=!1,fr):Be(ke,fr,Kr,br)}),ke}i(a1,"baseReduce"),a(a1,"baseReduce");function X2(Se,Be){var ke=Se.length;for(Se.sort(Be);ke--;)Se[ke]=Se[ke].value;return Se}i(X2,"baseSortBy"),a(X2,"baseSortBy");function Wd(Se,Be){for(var ke,ft=-1,It=Se.length;++ft<It;){var fr=Be(Se[ft]);fr!==r&&(ke=ke===r?fr:ke+fr)}return ke}i(Wd,"baseSum"),a(Wd,"baseSum");function Jd(Se,Be){for(var ke=-1,ft=Array(Se);++ke<Se;)ft[ke]=Be(ke);return ft}i(Jd,"baseTimes"),a(Jd,"baseTimes");function Q2(Se,Be){return Tr(Be,function(ke){return[ke,Se[ke]]})}i(Q2,"baseToPairs"),a(Q2,"baseToPairs");function s1(Se){return Se&&Se.slice(0,f1(Se)+1).replace(et,"")}i(s1,"baseTrim"),a(s1,"baseTrim");function $n(Se){return function(Be){return Se(Be)}}i($n,"baseUnary"),a($n,"baseUnary");function Zd(Se,Be){return Tr(Be,function(ke){return Se[ke]})}i(Zd,"baseValues"),a(Zd,"baseValues");function Kc(Se,Be){return Se.has(Be)}i(Kc,"cacheHas"),a(Kc,"cacheHas");function c1(Se,Be){for(var ke=-1,ft=Se.length;++ke<ft&&Ns(Be,Se[ke],0)>-1;);return ke}i(c1,"charsStartIndex"),a(c1,"charsStartIndex");function u1(Se,Be){for(var ke=Se.length;ke--&&Ns(Be,Se[ke],0)>-1;);return ke}i(u1,"charsEndIndex"),a(u1,"charsEndIndex");function e3(Se,Be){for(var ke=Se.length,ft=0;ke--;)Se[ke]===Be&&++ft;return ft}i(e3,"countHolders"),a(e3,"countHolders");var Zk=Gd(de),Yk=Gd(Me);function t3(Se){return"\\"+ht[Se]}i(t3,"escapeStringChar"),a(t3,"escapeStringChar");function r3(Se,Be){return Se==null?r:Se[Be]}i(r3,"getValue"),a(r3,"getValue");function Bs(Se){return jd.test(Se)}i(Bs,"hasUnicode"),a(Bs,"hasUnicode");function n3(Se){return Rs.test(Se)}i(n3,"hasUnicodeWord"),a(n3,"hasUnicodeWord");function i3(Se){for(var Be,ke=[];!(Be=Se.next()).done;)ke.push(Be.value);return ke}i(i3,"iteratorToArray"),a(i3,"iteratorToArray");function Yd(Se){var Be=-1,ke=Array(Se.size);return Se.forEach(function(ft,It){ke[++Be]=[It,ft]}),ke}i(Yd,"mapToArray"),a(Yd,"mapToArray");function l1(Se,Be){return function(ke){return Se(Be(ke))}}i(l1,"overArg"),a(l1,"overArg");function sa(Se,Be){for(var ke=-1,ft=Se.length,It=0,fr=[];++ke<ft;){var Kr=Se[ke];(Kr===Be||Kr===m)&&(Se[ke]=m,fr[It++]=ke)}return fr}i(sa,"replaceHolders"),a(sa,"replaceHolders");function Fl(Se){var Be=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Be]=ft}),ke}i(Fl,"setToArray"),a(Fl,"setToArray");function o3(Se){var Be=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Be]=[ft,ft]}),ke}i(o3,"setToPairs"),a(o3,"setToPairs");function a3(Se,Be,ke){for(var ft=ke-1,It=Se.length;++ft<It;)if(Se[ft]===Be)return ft;return-1}i(a3,"strictIndexOf"),a(a3,"strictIndexOf");function s3(Se,Be,ke){for(var ft=ke+1;ft--;)if(Se[ft]===Be)return ft;return ft}i(s3,"strictLastIndexOf"),a(s3,"strictLastIndexOf");function Ps(Se){return Bs(Se)?c3(Se):Jk(Se)}i(Ps,"stringSize"),a(Ps,"stringSize");function Di(Se){return Bs(Se)?u3(Se):J2(Se)}i(Di,"stringToArray"),a(Di,"stringToArray");function f1(Se){for(var Be=Se.length;Be--&&sr.test(Se.charAt(Be)););return Be}i(f1,"trimmedEndIndex"),a(f1,"trimmedEndIndex");var Xk=Gd(Le);function c3(Se){for(var Be=Ol.lastIndex=0;Ol.test(Se);)++Be;return Be}i(c3,"unicodeSize"),a(c3,"unicodeSize");function u3(Se){return Se.match(Ol)||[]}i(u3,"unicodeToArray"),a(u3,"unicodeToArray");function l3(Se){return Se.match(Nl)||[]}i(l3,"unicodeWords"),a(l3,"unicodeWords");var Qk=a(i(function Se(Be){Be=Be==null?Lr:Pa.defaults(Lr.Object(),Be,Pa.pick(Lr,zd));var ke=Be.Array,ft=Be.Date,It=Be.Error,fr=Be.Function,Kr=Be.Math,br=Be.Object,d1=Be.RegExp,eD=Be.String,Ri=Be.TypeError,Xd=ke.prototype,tD=fr.prototype,Gc=br.prototype,Qd=Be["__core-js_shared__"],eh=tD.toString,gr=Gc.hasOwnProperty,rD=0,f3=function(){var u=/[^.]+$/.exec(Qd&&Qd.keys&&Qd.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),th=Gc.toString,nD=eh.call(br),iD=Lr._,oD=d1("^"+eh.call(gr).replace(Qt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rh=Bl?Be.Buffer:r,La=Be.Symbol,nh=Be.Uint8Array,d3=rh?rh.allocUnsafe:r,ih=l1(br.getPrototypeOf,br),h3=br.create,p3=Gc.propertyIsEnumerable,oh=Xd.splice,m3=La?La.isConcatSpreadable:r,Ul=La?La.iterator:r,Ls=La?La.toStringTag:r,ah=function(){try{var u=Ha(br,"defineProperty");return u({},"",{}),u}catch{}}(),aD=Be.clearTimeout!==Lr.clearTimeout&&Be.clearTimeout,sD=ft&&ft.now!==Lr.Date.now&&ft.now,cD=Be.setTimeout!==Lr.setTimeout&&Be.setTimeout,sh=Kr.ceil,ch=Kr.floor,h1=br.getOwnPropertySymbols,uD=rh?rh.isBuffer:r,g3=Be.isFinite,lD=Xd.join,fD=l1(br.keys,br),Gr=Kr.max,vn=Kr.min,dD=ft.now,hD=Be.parseInt,v3=Kr.random,pD=Xd.reverse,p1=Ha(Be,"DataView"),$l=Ha(Be,"Map"),m1=Ha(Be,"Promise"),Wc=Ha(Be,"Set"),jl=Ha(Be,"WeakMap"),zl=Ha(br,"create"),uh=jl&&new jl,Jc={},mD=qa(p1),gD=qa($l),vD=qa(m1),yD=qa(Wc),bD=qa(jl),lh=La?La.prototype:r,Hl=lh?lh.valueOf:r,y3=lh?lh.toString:r;function se(u){if(kr(u)&&!Ot(u)&&!(u instanceof Kt)){if(u instanceof ri)return u;if(gr.call(u,"__wrapped__"))return hg(u)}return new ri(u)}i(se,"lodash"),a(se,"lodash");var Zc=function(){function u(){}return i(u,"object"),a(u,"object"),function(d){if(!Mr(d))return{};if(h3)return h3(d);u.prototype=d;var S=new u;return u.prototype=r,S}}();function ql(){}i(ql,"baseLodash"),a(ql,"baseLodash");function ri(u,d){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!d,this.__index__=0,this.__values__=r}i(ri,"LodashWrapper"),a(ri,"LodashWrapper"),se.templateSettings={escape:lr,evaluate:lt,interpolate:nt,variable:"",imports:{_:se}},se.prototype=ql.prototype,se.prototype.constructor=se,ri.prototype=Zc(ql.prototype),ri.prototype.constructor=ri;function Kt(u){this.__wrapped__=u,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=A,this.__views__=[]}i(Kt,"LazyWrapper"),a(Kt,"LazyWrapper");function b3(){var u=new Kt(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(b3,"lazyClone"),a(b3,"lazyClone");function w3(){if(this.__filtered__){var u=new Kt(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}i(w3,"lazyReverse"),a(w3,"lazyReverse");function _3(){var u=this.__wrapped__.value(),d=this.__dir__,S=Ot(u),j=d<0,te=S?u.length:0,ce=B5(0,te,this.__views__),ye=ce.start,Ee=ce.end,xe=Ee-ye,Fe=j?Ee:ye-1,Ue=this.__iteratees__,je=Ue.length,Ye=0,pt=vn(xe,this.__takeCount__);if(!S||!j&&te==xe&&pt==xe)return L1(u,this.__actions__);var St=[];e:for(;xe--&&Ye<pt;){Fe+=d;for(var Lt=-1,_t=u[Fe];++Lt<je;){var Ht=Ue[Lt],Gt=Ht.iteratee,Hn=Ht.type,_n=Gt(_t);if(Hn==g)_t=_n;else if(!_n){if(Hn==T)continue e;break e}}St[Ye++]=_t}return St}i(_3,"lazyValue"),a(_3,"lazyValue"),Kt.prototype=Zc(ql.prototype),Kt.prototype.constructor=Kt;function Fa(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var j=u[d];this.set(j[0],j[1])}}i(Fa,"Hash"),a(Fa,"Hash");function E3(){this.__data__=zl?zl(null):{},this.size=0}i(E3,"hashClear"),a(E3,"hashClear");function A3(u){var d=this.has(u)&&delete this.__data__[u];return this.size-=d?1:0,d}i(A3,"hashDelete"),a(A3,"hashDelete");function S3(u){var d=this.__data__;if(zl){var S=d[u];return S===h?r:S}return gr.call(d,u)?d[u]:r}i(S3,"hashGet"),a(S3,"hashGet");function x3(u){var d=this.__data__;return zl?d[u]!==r:gr.call(d,u)}i(x3,"hashHas"),a(x3,"hashHas");function T3(u,d){var S=this.__data__;return this.size+=this.has(u)?0:1,S[u]=zl&&d===r?h:d,this}i(T3,"hashSet"),a(T3,"hashSet"),Fa.prototype.clear=E3,Fa.prototype.delete=A3,Fa.prototype.get=S3,Fa.prototype.has=x3,Fa.prototype.set=T3;function So(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var j=u[d];this.set(j[0],j[1])}}i(So,"ListCache"),a(So,"ListCache");function C3(){this.__data__=[],this.size=0}i(C3,"listCacheClear"),a(C3,"listCacheClear");function M3(u){var d=this.__data__,S=Vl(d,u);if(S<0)return!1;var j=d.length-1;return S==j?d.pop():oh.call(d,S,1),--this.size,!0}i(M3,"listCacheDelete"),a(M3,"listCacheDelete");function I3(u){var d=this.__data__,S=Vl(d,u);return S<0?r:d[S][1]}i(I3,"listCacheGet"),a(I3,"listCacheGet");function k3(u){return Vl(this.__data__,u)>-1}i(k3,"listCacheHas"),a(k3,"listCacheHas");function D3(u,d){var S=this.__data__,j=Vl(S,u);return j<0?(++this.size,S.push([u,d])):S[j][1]=d,this}i(D3,"listCacheSet"),a(D3,"listCacheSet"),So.prototype.clear=C3,So.prototype.delete=M3,So.prototype.get=I3,So.prototype.has=k3,So.prototype.set=D3;function xo(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var j=u[d];this.set(j[0],j[1])}}i(xo,"MapCache"),a(xo,"MapCache");function R3(){this.size=0,this.__data__={hash:new Fa,map:new($l||So),string:new Fa}}i(R3,"mapCacheClear"),a(R3,"mapCacheClear");function O3(u){var d=nf(this,u).delete(u);return this.size-=d?1:0,d}i(O3,"mapCacheDelete"),a(O3,"mapCacheDelete");function N3(u){return nf(this,u).get(u)}i(N3,"mapCacheGet"),a(N3,"mapCacheGet");function B3(u){return nf(this,u).has(u)}i(B3,"mapCacheHas"),a(B3,"mapCacheHas");function P3(u,d){var S=nf(this,u),j=S.size;return S.set(u,d),this.size+=S.size==j?0:1,this}i(P3,"mapCacheSet"),a(P3,"mapCacheSet"),xo.prototype.clear=R3,xo.prototype.delete=O3,xo.prototype.get=N3,xo.prototype.has=B3,xo.prototype.set=P3;function Ua(u){var d=-1,S=u==null?0:u.length;for(this.__data__=new xo;++d<S;)this.add(u[d])}i(Ua,"SetCache"),a(Ua,"SetCache");function L3(u){return this.__data__.set(u,h),this}i(L3,"setCacheAdd"),a(L3,"setCacheAdd");function F3(u){return this.__data__.has(u)}i(F3,"setCacheHas"),a(F3,"setCacheHas"),Ua.prototype.add=Ua.prototype.push=L3,Ua.prototype.has=F3;function Oi(u){var d=this.__data__=new So(u);this.size=d.size}i(Oi,"Stack"),a(Oi,"Stack");function U3(){this.__data__=new So,this.size=0}i(U3,"stackClear"),a(U3,"stackClear");function $3(u){var d=this.__data__,S=d.delete(u);return this.size=d.size,S}i($3,"stackDelete"),a($3,"stackDelete");function j3(u){return this.__data__.get(u)}i(j3,"stackGet"),a(j3,"stackGet");function z3(u){return this.__data__.has(u)}i(z3,"stackHas"),a(z3,"stackHas");function H3(u,d){var S=this.__data__;if(S instanceof So){var j=S.__data__;if(!$l||j.length<o-1)return j.push([u,d]),this.size=++S.size,this;S=this.__data__=new xo(j)}return S.set(u,d),this.size=S.size,this}i(H3,"stackSet"),a(H3,"stackSet"),Oi.prototype.clear=U3,Oi.prototype.delete=$3,Oi.prototype.get=j3,Oi.prototype.has=z3,Oi.prototype.set=H3;function g1(u,d){var S=Ot(u),j=!S&&js(u),te=!S&&!j&&Va(u),ce=!S&&!j&&!te&&ou(u),ye=S||j||te||ce,Ee=ye?Jd(u.length,eD):[],xe=Ee.length;for(var Fe in u)(d||gr.call(u,Fe))&&!(ye&&(Fe=="length"||te&&(Fe=="offset"||Fe=="parent")||ce&&(Fe=="buffer"||Fe=="byteLength"||Fe=="byteOffset")||Io(Fe,xe)))&&Ee.push(Fe);return Ee}i(g1,"arrayLikeKeys"),a(g1,"arrayLikeKeys");function v1(u){var d=u.length;return d?u[wh(0,d-1)]:r}i(v1,"arraySample"),a(v1,"arraySample");function q3(u,d){return af(In(u),$a(d,0,u.length))}i(q3,"arraySampleSize"),a(q3,"arraySampleSize");function V3(u){return af(In(u))}i(V3,"arrayShuffle"),a(V3,"arrayShuffle");function fh(u,d,S){(S!==r&&!Ni(u[d],S)||S===r&&!(d in u))&&To(u,d,S)}i(fh,"assignMergeValue"),a(fh,"assignMergeValue");function Yc(u,d,S){var j=u[d];(!(gr.call(u,d)&&Ni(j,S))||S===r&&!(d in u))&&To(u,d,S)}i(Yc,"assignValue"),a(Yc,"assignValue");function Vl(u,d){for(var S=u.length;S--;)if(Ni(u[S][0],d))return S;return-1}i(Vl,"assocIndexOf"),a(Vl,"assocIndexOf");function K3(u,d,S,j){return ja(u,function(te,ce,ye){d(j,te,S(te),ye)}),j}i(K3,"baseAggregator"),a(K3,"baseAggregator");function y1(u,d){return u&&Zi(d,Wr(d),u)}i(y1,"baseAssign"),a(y1,"baseAssign");function G3(u,d){return u&&Zi(d,Dn(d),u)}i(G3,"baseAssignIn"),a(G3,"baseAssignIn");function To(u,d,S){d=="__proto__"&&ah?ah(u,d,{configurable:!0,enumerable:!0,value:S,writable:!0}):u[d]=S}i(To,"baseAssignValue"),a(To,"baseAssignValue");function dh(u,d){for(var S=-1,j=d.length,te=ke(j),ce=u==null;++S<j;)te[S]=ce?r:jh(u,d[S]);return te}i(dh,"baseAt"),a(dh,"baseAt");function $a(u,d,S){return u===u&&(S!==r&&(u=u<=S?u:S),d!==r&&(u=u>=d?u:d)),u}i($a,"baseClamp"),a($a,"baseClamp");function ni(u,d,S,j,te,ce){var ye,Ee=d&y,xe=d&b,Fe=d&_;if(S&&(ye=te?S(u,j,te,ce):S(u)),ye!==r)return ye;if(!Mr(u))return u;var Ue=Ot(u);if(Ue){if(ye=L5(u),!Ee)return In(u,ye)}else{var je=bn(u),Ye=je==oe||je==fe;if(Va(u))return U1(u,Ee);if(je==N||je==F||Ye&&!te){if(ye=xe||Ye?{}:og(u),!Ee)return xe?T5(u,G3(ye,u)):x5(u,y1(ye,u))}else{if(!mr[je])return te?u:{};ye=F5(u,je,Ee)}}ce||(ce=new Oi);var pt=ce.get(u);if(pt)return pt;ce.set(u,ye),N4(u)?u.forEach(function(_t){ye.add(ni(_t,d,S,_t,u,ce))}):T4(u)&&u.forEach(function(_t,Ht){ye.set(Ht,ni(_t,d,S,Ht,u,ce))});var St=Fe?xe?Dh:kh:xe?Dn:Wr,Lt=Ue?r:St(u);return ti(Lt||u,function(_t,Ht){Lt&&(Ht=_t,_t=u[Ht]),Yc(ye,Ht,ni(_t,d,S,Ht,u,ce))}),ye}i(ni,"baseClone"),a(ni,"baseClone");function W3(u){var d=Wr(u);return function(S){return b1(S,u,d)}}i(W3,"baseConforms"),a(W3,"baseConforms");function b1(u,d,S){var j=S.length;if(u==null)return!j;for(u=br(u);j--;){var te=S[j],ce=d[te],ye=u[te];if(ye===r&&!(te in u)||!ce(ye))return!1}return!0}i(b1,"baseConformsTo"),a(b1,"baseConformsTo");function w1(u,d,S){if(typeof u!="function")throw new Ri(c);return of(function(){u.apply(r,S)},d)}i(w1,"baseDelay"),a(w1,"baseDelay");function Xc(u,d,S,j){var te=-1,ce=Pl,ye=!0,Ee=u.length,xe=[],Fe=d.length;if(!Ee)return xe;S&&(d=Tr(d,$n(S))),j?(ce=Hd,ye=!1):d.length>=o&&(ce=Kc,ye=!1,d=new Ua(d));e:for(;++te<Ee;){var Ue=u[te],je=S==null?Ue:S(Ue);if(Ue=j||Ue!==0?Ue:0,ye&&je===je){for(var Ye=Fe;Ye--;)if(d[Ye]===je)continue e;xe.push(Ue)}else ce(d,je,j)||xe.push(Ue)}return xe}i(Xc,"baseDifference"),a(Xc,"baseDifference");var ja=q1(Ji),J3=q1(hh,!0);function Z3(u,d){var S=!0;return ja(u,function(j,te,ce){return S=!!d(j,te,ce),S}),S}i(Z3,"baseEvery"),a(Z3,"baseEvery");function Kl(u,d,S){for(var j=-1,te=u.length;++j<te;){var ce=u[j],ye=d(ce);if(ye!=null&&(Ee===r?ye===ye&&!zn(ye):S(ye,Ee)))var Ee=ye,xe=ce}return xe}i(Kl,"baseExtremum"),a(Kl,"baseExtremum");function Y3(u,d,S,j){var te=u.length;for(S=Nt(S),S<0&&(S=-S>te?0:te+S),j=j===r||j>te?te:Nt(j),j<0&&(j+=te),j=S>j?0:Ng(j);S<j;)u[S++]=d;return u}i(Y3,"baseFill"),a(Y3,"baseFill");function _1(u,d){var S=[];return ja(u,function(j,te,ce){d(j,te,ce)&&S.push(j)}),S}i(_1,"baseFilter"),a(_1,"baseFilter");function Zr(u,d,S,j,te){var ce=-1,ye=u.length;for(S||(S=$5),te||(te=[]);++ce<ye;){var Ee=u[ce];d>0&&S(Ee)?d>1?Zr(Ee,d-1,S,j,te):aa(te,Ee):j||(te[te.length]=Ee)}return te}i(Zr,"baseFlatten"),a(Zr,"baseFlatten");var E1=V1(),X3=V1(!0);function Ji(u,d){return u&&E1(u,d,Wr)}i(Ji,"baseForOwn"),a(Ji,"baseForOwn");function hh(u,d){return u&&X3(u,d,Wr)}i(hh,"baseForOwnRight"),a(hh,"baseForOwnRight");function Gl(u,d){return oa(d,function(S){return ko(u[S])})}i(Gl,"baseFunctions"),a(Gl,"baseFunctions");function za(u,d){d=ua(d,u);for(var S=0,j=d.length;u!=null&&S<j;)u=u[Yi(d[S++])];return S&&S==j?u:r}i(za,"baseGet"),a(za,"baseGet");function A1(u,d,S){var j=d(u);return Ot(u)?j:aa(j,S(u))}i(A1,"baseGetAllKeys"),a(A1,"baseGetAllKeys");function yn(u){return u==null?u===r?De:X:Ls&&Ls in br(u)?O5(u):K5(u)}i(yn,"baseGetTag"),a(yn,"baseGetTag");function ph(u,d){return u>d}i(ph,"baseGt"),a(ph,"baseGt");function Q3(u,d){return u!=null&&gr.call(u,d)}i(Q3,"baseHas"),a(Q3,"baseHas");function e5(u,d){return u!=null&&d in br(u)}i(e5,"baseHasIn"),a(e5,"baseHasIn");function t5(u,d,S){return u>=vn(d,S)&&u<Gr(d,S)}i(t5,"baseInRange"),a(t5,"baseInRange");function mh(u,d,S){for(var j=S?Hd:Pl,te=u[0].length,ce=u.length,ye=ce,Ee=ke(ce),xe=1/0,Fe=[];ye--;){var Ue=u[ye];ye&&d&&(Ue=Tr(Ue,$n(d))),xe=vn(Ue.length,xe),Ee[ye]=!S&&(d||te>=120&&Ue.length>=120)?new Ua(ye&&Ue):r}Ue=u[0];var je=-1,Ye=Ee[0];e:for(;++je<te&&Fe.length<xe;){var pt=Ue[je],St=d?d(pt):pt;if(pt=S||pt!==0?pt:0,!(Ye?Kc(Ye,St):j(Fe,St,S))){for(ye=ce;--ye;){var Lt=Ee[ye];if(!(Lt?Kc(Lt,St):j(u[ye],St,S)))continue e}Ye&&Ye.push(St),Fe.push(pt)}}return Fe}i(mh,"baseIntersection"),a(mh,"baseIntersection");function r5(u,d,S,j){return Ji(u,function(te,ce,ye){d(j,S(te),ce,ye)}),j}i(r5,"baseInverter"),a(r5,"baseInverter");function Qc(u,d,S){d=ua(d,u),u=ug(u,d);var j=u==null?u:u[Yi(oi(d))];return j==null?r:Un(j,u,S)}i(Qc,"baseInvoke"),a(Qc,"baseInvoke");function S1(u){return kr(u)&&yn(u)==F}i(S1,"baseIsArguments"),a(S1,"baseIsArguments");function n5(u){return kr(u)&&yn(u)==qe}i(n5,"baseIsArrayBuffer"),a(n5,"baseIsArrayBuffer");function i5(u){return kr(u)&&yn(u)==ae}i(i5,"baseIsDate"),a(i5,"baseIsDate");function eu(u,d,S,j,te){return u===d?!0:u==null||d==null||!kr(u)&&!kr(d)?u!==u&&d!==d:o5(u,d,S,j,eu,te)}i(eu,"baseIsEqual"),a(eu,"baseIsEqual");function o5(u,d,S,j,te,ce){var ye=Ot(u),Ee=Ot(d),xe=ye?ge:bn(u),Fe=Ee?ge:bn(d);xe=xe==F?N:xe,Fe=Fe==F?N:Fe;var Ue=xe==N,je=Fe==N,Ye=xe==Fe;if(Ye&&Va(u)){if(!Va(d))return!1;ye=!0,Ue=!1}if(Ye&&!Ue)return ce||(ce=new Oi),ye||ou(u)?tg(u,d,S,j,te,ce):D5(u,d,xe,S,j,te,ce);if(!(S&x)){var pt=Ue&&gr.call(u,"__wrapped__"),St=je&&gr.call(d,"__wrapped__");if(pt||St){var Lt=pt?u.value():u,_t=St?d.value():d;return ce||(ce=new Oi),te(Lt,_t,S,j,ce)}}return Ye?(ce||(ce=new Oi),R5(u,d,S,j,te,ce)):!1}i(o5,"baseIsEqualDeep"),a(o5,"baseIsEqualDeep");function a5(u){return kr(u)&&bn(u)==be}i(a5,"baseIsMap"),a(a5,"baseIsMap");function gh(u,d,S,j){var te=S.length,ce=te,ye=!j;if(u==null)return!ce;for(u=br(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],Fe=u[xe],Ue=Ee[1];if(ye&&Ee[2]){if(Fe===r&&!(xe in u))return!1}else{var je=new Oi;if(j)var Ye=j(Fe,Ue,xe,u,d,je);if(!(Ye===r?eu(Ue,Fe,x|D,j,je):Ye))return!1}}return!0}i(gh,"baseIsMatch"),a(gh,"baseIsMatch");function x1(u){if(!Mr(u)||z5(u))return!1;var d=ko(u)?oD:tr;return d.test(qa(u))}i(x1,"baseIsNative"),a(x1,"baseIsNative");function s5(u){return kr(u)&&yn(u)==ie}i(s5,"baseIsRegExp"),a(s5,"baseIsRegExp");function c5(u){return kr(u)&&bn(u)==ee}i(c5,"baseIsSet"),a(c5,"baseIsSet");function u5(u){return kr(u)&&ff(u.length)&&!!yr[yn(u)]}i(u5,"baseIsTypedArray"),a(u5,"baseIsTypedArray");function T1(u){return typeof u=="function"?u:u==null?Rn:typeof u=="object"?Ot(u)?I1(u[0],u[1]):M1(u):jg(u)}i(T1,"baseIteratee"),a(T1,"baseIteratee");function vh(u){if(!nu(u))return fD(u);var d=[];for(var S in br(u))gr.call(u,S)&&S!="constructor"&&d.push(S);return d}i(vh,"baseKeys"),a(vh,"baseKeys");function l5(u){if(!Mr(u))return V5(u);var d=nu(u),S=[];for(var j in u)j=="constructor"&&(d||!gr.call(u,j))||S.push(j);return S}i(l5,"baseKeysIn"),a(l5,"baseKeysIn");function yh(u,d){return u<d}i(yh,"baseLt"),a(yh,"baseLt");function C1(u,d){var S=-1,j=kn(u)?ke(u.length):[];return ja(u,function(te,ce,ye){j[++S]=d(te,ce,ye)}),j}i(C1,"baseMap"),a(C1,"baseMap");function M1(u){var d=Rh(u);return d.length==1&&d[0][2]?sg(d[0][0],d[0][1]):function(S){return S===u||gh(S,u,d)}}i(M1,"baseMatches"),a(M1,"baseMatches");function I1(u,d){return Oh(u)&&ag(d)?sg(Yi(u),d):function(S){var j=jh(S,u);return j===r&&j===d?zh(S,u):eu(d,j,x|D)}}i(I1,"baseMatchesProperty"),a(I1,"baseMatchesProperty");function Wl(u,d,S,j,te){u!==d&&E1(d,function(ce,ye){if(te||(te=new Oi),Mr(ce))f5(u,d,ye,S,Wl,j,te);else{var Ee=j?j(Bh(u,ye),ce,ye+"",u,d,te):r;Ee===r&&(Ee=ce),fh(u,ye,Ee)}},Dn)}i(Wl,"baseMerge"),a(Wl,"baseMerge");function f5(u,d,S,j,te,ce,ye){var Ee=Bh(u,S),xe=Bh(d,S),Fe=ye.get(xe);if(Fe){fh(u,S,Fe);return}var Ue=ce?ce(Ee,xe,S+"",u,d,ye):r,je=Ue===r;if(je){var Ye=Ot(xe),pt=!Ye&&Va(xe),St=!Ye&&!pt&&ou(xe);Ue=xe,Ye||pt||St?Ot(Ee)?Ue=Ee:Or(Ee)?Ue=In(Ee):pt?(je=!1,Ue=U1(xe,!0)):St?(je=!1,Ue=$1(xe,!0)):Ue=[]:iu(xe)||js(xe)?(Ue=Ee,js(Ee)?Ue=Bg(Ee):(!Mr(Ee)||ko(Ee))&&(Ue=og(xe))):je=!1}je&&(ye.set(xe,Ue),te(Ue,xe,j,ce,ye),ye.delete(xe)),fh(u,S,Ue)}i(f5,"baseMergeDeep"),a(f5,"baseMergeDeep");function k1(u,d){var S=u.length;if(!!S)return d+=d<0?S:0,Io(d,S)?u[d]:r}i(k1,"baseNth"),a(k1,"baseNth");function D1(u,d,S){d.length?d=Tr(d,function(ce){return Ot(ce)?function(ye){return za(ye,ce.length===1?ce[0]:ce)}:ce}):d=[Rn];var j=-1;d=Tr(d,$n(wt()));var te=C1(u,function(ce,ye,Ee){var xe=Tr(d,function(Fe){return Fe(ce)});return{criteria:xe,index:++j,value:ce}});return X2(te,function(ce,ye){return S5(ce,ye,S)})}i(D1,"baseOrderBy"),a(D1,"baseOrderBy");function d5(u,d){return R1(u,d,function(S,j){return zh(u,j)})}i(d5,"basePick"),a(d5,"basePick");function R1(u,d,S){for(var j=-1,te=d.length,ce={};++j<te;){var ye=d[j],Ee=za(u,ye);S(Ee,ye)&&tu(ce,ua(ye,u),Ee)}return ce}i(R1,"basePickBy"),a(R1,"basePickBy");function h5(u){return function(d){return za(d,u)}}i(h5,"basePropertyDeep"),a(h5,"basePropertyDeep");function bh(u,d,S,j){var te=j?Y2:Ns,ce=-1,ye=d.length,Ee=u;for(u===d&&(d=In(d)),S&&(Ee=Tr(u,$n(S)));++ce<ye;)for(var xe=0,Fe=d[ce],Ue=S?S(Fe):Fe;(xe=te(Ee,Ue,xe,j))>-1;)Ee!==u&&oh.call(Ee,xe,1),oh.call(u,xe,1);return u}i(bh,"basePullAll"),a(bh,"basePullAll");function O1(u,d){for(var S=u?d.length:0,j=S-1;S--;){var te=d[S];if(S==j||te!==ce){var ce=te;Io(te)?oh.call(u,te,1):Ah(u,te)}}return u}i(O1,"basePullAt"),a(O1,"basePullAt");function wh(u,d){return u+ch(v3()*(d-u+1))}i(wh,"baseRandom"),a(wh,"baseRandom");function p5(u,d,S,j){for(var te=-1,ce=Gr(sh((d-u)/(S||1)),0),ye=ke(ce);ce--;)ye[j?ce:++te]=u,u+=S;return ye}i(p5,"baseRange"),a(p5,"baseRange");function _h(u,d){var S="";if(!u||d<1||d>E)return S;do d%2&&(S+=u),d=ch(d/2),d&&(u+=u);while(d);return S}i(_h,"baseRepeat"),a(_h,"baseRepeat");function Ft(u,d){return lg(cg(u,d,Rn),u+"")}i(Ft,"baseRest"),a(Ft,"baseRest");function m5(u){return v1(zs(u))}i(m5,"baseSample"),a(m5,"baseSample");function g5(u,d){var S=zs(u);return af(S,$a(d,0,S.length))}i(g5,"baseSampleSize"),a(g5,"baseSampleSize");function tu(u,d,S,j){if(!Mr(u))return u;d=ua(d,u);for(var te=-1,ce=d.length,ye=ce-1,Ee=u;Ee!=null&&++te<ce;){var xe=Yi(d[te]),Fe=S;if(xe==="__proto__"||xe==="constructor"||xe==="prototype")return u;if(te!=ye){var Ue=Ee[xe];Fe=j?j(Ue,xe,Ee):r,Fe===r&&(Fe=Mr(Ue)?Ue:Io(d[te+1])?[]:{})}Yc(Ee,xe,Fe),Ee=Ee[xe]}return u}i(tu,"baseSet"),a(tu,"baseSet");var v5=uh?function(u,d){return uh.set(u,d),u}:Rn,wD=ah?function(u,d){return ah(u,"toString",{configurable:!0,enumerable:!1,value:Hh(d),writable:!0})}:Rn;function y5(u){return af(zs(u))}i(y5,"baseShuffle"),a(y5,"baseShuffle");function ii(u,d,S){var j=-1,te=u.length;d<0&&(d=-d>te?0:te+d),S=S>te?te:S,S<0&&(S+=te),te=d>S?0:S-d>>>0,d>>>=0;for(var ce=ke(te);++j<te;)ce[j]=u[j+d];return ce}i(ii,"baseSlice"),a(ii,"baseSlice");function b5(u,d){var S;return ja(u,function(j,te,ce){return S=d(j,te,ce),!S}),!!S}i(b5,"baseSome"),a(b5,"baseSome");function Jl(u,d,S){var j=0,te=u==null?j:u.length;if(typeof d=="number"&&d===d&&te<=H){for(;j<te;){var ce=j+te>>>1,ye=u[ce];ye!==null&&!zn(ye)&&(S?ye<=d:ye<d)?j=ce+1:te=ce}return te}return Eh(u,d,Rn,S)}i(Jl,"baseSortedIndex"),a(Jl,"baseSortedIndex");function Eh(u,d,S,j){var te=0,ce=u==null?0:u.length;if(ce===0)return 0;d=S(d);for(var ye=d!==d,Ee=d===null,xe=zn(d),Fe=d===r;te<ce;){var Ue=ch((te+ce)/2),je=S(u[Ue]),Ye=je!==r,pt=je===null,St=je===je,Lt=zn(je);if(ye)var _t=j||St;else Fe?_t=St&&(j||Ye):Ee?_t=St&&Ye&&(j||!pt):xe?_t=St&&Ye&&!pt&&(j||!Lt):pt||Lt?_t=!1:_t=j?je<=d:je<d;_t?te=Ue+1:ce=Ue}return vn(ce,P)}i(Eh,"baseSortedIndexBy"),a(Eh,"baseSortedIndexBy");function N1(u,d){for(var S=-1,j=u.length,te=0,ce=[];++S<j;){var ye=u[S],Ee=d?d(ye):ye;if(!S||!Ni(Ee,xe)){var xe=Ee;ce[te++]=ye===0?0:ye}}return ce}i(N1,"baseSortedUniq"),a(N1,"baseSortedUniq");function B1(u){return typeof u=="number"?u:zn(u)?C:+u}i(B1,"baseToNumber"),a(B1,"baseToNumber");function jn(u){if(typeof u=="string")return u;if(Ot(u))return Tr(u,jn)+"";if(zn(u))return y3?y3.call(u):"";var d=u+"";return d=="0"&&1/u==-v?"-0":d}i(jn,"baseToString"),a(jn,"baseToString");function ca(u,d,S){var j=-1,te=Pl,ce=u.length,ye=!0,Ee=[],xe=Ee;if(S)ye=!1,te=Hd;else if(ce>=o){var Fe=d?null:ED(u);if(Fe)return Fl(Fe);ye=!1,te=Kc,xe=new Ua}else xe=d?[]:Ee;e:for(;++j<ce;){var Ue=u[j],je=d?d(Ue):Ue;if(Ue=S||Ue!==0?Ue:0,ye&&je===je){for(var Ye=xe.length;Ye--;)if(xe[Ye]===je)continue e;d&&xe.push(je),Ee.push(Ue)}else te(xe,je,S)||(xe!==Ee&&xe.push(je),Ee.push(Ue))}return Ee}i(ca,"baseUniq"),a(ca,"baseUniq");function Ah(u,d){return d=ua(d,u),u=ug(u,d),u==null||delete u[Yi(oi(d))]}i(Ah,"baseUnset"),a(Ah,"baseUnset");function P1(u,d,S,j){return tu(u,d,S(za(u,d)),j)}i(P1,"baseUpdate"),a(P1,"baseUpdate");function Zl(u,d,S,j){for(var te=u.length,ce=j?te:-1;(j?ce--:++ce<te)&&d(u[ce],ce,u););return S?ii(u,j?0:ce,j?ce+1:te):ii(u,j?ce+1:0,j?te:ce)}i(Zl,"baseWhile"),a(Zl,"baseWhile");function L1(u,d){var S=u;return S instanceof Kt&&(S=S.value()),qd(d,function(j,te){return te.func.apply(te.thisArg,aa([j],te.args))},S)}i(L1,"baseWrapperValue"),a(L1,"baseWrapperValue");function Sh(u,d,S){var j=u.length;if(j<2)return j?ca(u[0]):[];for(var te=-1,ce=ke(j);++te<j;)for(var ye=u[te],Ee=-1;++Ee<j;)Ee!=te&&(ce[te]=Xc(ce[te]||ye,u[Ee],d,S));return ca(Zr(ce,1),d,S)}i(Sh,"baseXor"),a(Sh,"baseXor");function F1(u,d,S){for(var j=-1,te=u.length,ce=d.length,ye={};++j<te;){var Ee=j<ce?d[j]:r;S(ye,u[j],Ee)}return ye}i(F1,"baseZipObject"),a(F1,"baseZipObject");function xh(u){return Or(u)?u:[]}i(xh,"castArrayLikeObject"),a(xh,"castArrayLikeObject");function Th(u){return typeof u=="function"?u:Rn}i(Th,"castFunction"),a(Th,"castFunction");function ua(u,d){return Ot(u)?u:Oh(u,d)?[u]:J5(dr(u))}i(ua,"castPath"),a(ua,"castPath");var _D=Ft;function la(u,d,S){var j=u.length;return S=S===r?j:S,!d&&S>=j?u:ii(u,d,S)}i(la,"castSlice"),a(la,"castSlice");var w5=aD||function(u){return Lr.clearTimeout(u)};function U1(u,d){if(d)return u.slice();var S=u.length,j=d3?d3(S):new u.constructor(S);return u.copy(j),j}i(U1,"cloneBuffer"),a(U1,"cloneBuffer");function Ch(u){var d=new u.constructor(u.byteLength);return new nh(d).set(new nh(u)),d}i(Ch,"cloneArrayBuffer"),a(Ch,"cloneArrayBuffer");function _5(u,d){var S=d?Ch(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.byteLength)}i(_5,"cloneDataView"),a(_5,"cloneDataView");function E5(u){var d=new u.constructor(u.source,yt.exec(u));return d.lastIndex=u.lastIndex,d}i(E5,"cloneRegExp"),a(E5,"cloneRegExp");function A5(u){return Hl?br(Hl.call(u)):{}}i(A5,"cloneSymbol"),a(A5,"cloneSymbol");function $1(u,d){var S=d?Ch(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.length)}i($1,"cloneTypedArray"),a($1,"cloneTypedArray");function j1(u,d){if(u!==d){var S=u!==r,j=u===null,te=u===u,ce=zn(u),ye=d!==r,Ee=d===null,xe=d===d,Fe=zn(d);if(!Ee&&!Fe&&!ce&&u>d||ce&&ye&&xe&&!Ee&&!Fe||j&&ye&&xe||!S&&xe||!te)return 1;if(!j&&!ce&&!Fe&&u<d||Fe&&S&&te&&!j&&!ce||Ee&&S&&te||!ye&&te||!xe)return-1}return 0}i(j1,"compareAscending"),a(j1,"compareAscending");function S5(u,d,S){for(var j=-1,te=u.criteria,ce=d.criteria,ye=te.length,Ee=S.length;++j<ye;){var xe=j1(te[j],ce[j]);if(xe){if(j>=Ee)return xe;var Fe=S[j];return xe*(Fe=="desc"?-1:1)}}return u.index-d.index}i(S5,"compareMultiple"),a(S5,"compareMultiple");function z1(u,d,S,j){for(var te=-1,ce=u.length,ye=S.length,Ee=-1,xe=d.length,Fe=Gr(ce-ye,0),Ue=ke(xe+Fe),je=!j;++Ee<xe;)Ue[Ee]=d[Ee];for(;++te<ye;)(je||te<ce)&&(Ue[S[te]]=u[te]);for(;Fe--;)Ue[Ee++]=u[te++];return Ue}i(z1,"composeArgs"),a(z1,"composeArgs");function H1(u,d,S,j){for(var te=-1,ce=u.length,ye=-1,Ee=S.length,xe=-1,Fe=d.length,Ue=Gr(ce-Ee,0),je=ke(Ue+Fe),Ye=!j;++te<Ue;)je[te]=u[te];for(var pt=te;++xe<Fe;)je[pt+xe]=d[xe];for(;++ye<Ee;)(Ye||te<ce)&&(je[pt+S[ye]]=u[te++]);return je}i(H1,"composeArgsRight"),a(H1,"composeArgsRight");function In(u,d){var S=-1,j=u.length;for(d||(d=ke(j));++S<j;)d[S]=u[S];return d}i(In,"copyArray"),a(In,"copyArray");function Zi(u,d,S,j){var te=!S;S||(S={});for(var ce=-1,ye=d.length;++ce<ye;){var Ee=d[ce],xe=j?j(S[Ee],u[Ee],Ee,S,u):r;xe===r&&(xe=u[Ee]),te?To(S,Ee,xe):Yc(S,Ee,xe)}return S}i(Zi,"copyObject"),a(Zi,"copyObject");function x5(u,d){return Zi(u,ng(u),d)}i(x5,"copySymbols"),a(x5,"copySymbols");function T5(u,d){return Zi(u,N5(u),d)}i(T5,"copySymbolsIn"),a(T5,"copySymbolsIn");function Yl(u,d){return function(S,j){var te=Ot(S)?K2:K3,ce=d?d():{};return te(S,u,wt(j,2),ce)}}i(Yl,"createAggregator"),a(Yl,"createAggregator");function Fs(u){return Ft(function(d,S){var j=-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),d=br(d);++j<te;){var Ee=S[j];Ee&&u(d,Ee,j,ce)}return d})}i(Fs,"createAssigner"),a(Fs,"createAssigner");function q1(u,d){return function(S,j){if(S==null)return S;if(!kn(S))return u(S,j);for(var te=S.length,ce=d?te:-1,ye=br(S);(d?ce--:++ce<te)&&j(ye[ce],ce,ye)!==!1;);return S}}i(q1,"createBaseEach"),a(q1,"createBaseEach");function V1(u){return function(d,S,j){for(var te=-1,ce=br(d),ye=j(d),Ee=ye.length;Ee--;){var xe=ye[u?Ee:++te];if(S(ce[xe],xe,ce)===!1)break}return d}}i(V1,"createBaseFor"),a(V1,"createBaseFor");function C5(u,d,S){var j=d&O,te=ru(u);function ce(){var ye=this&&this!==Lr&&this instanceof ce?te:u;return ye.apply(j?S:this,arguments)}return i(ce,"wrapper"),a(ce,"wrapper"),ce}i(C5,"createBind"),a(C5,"createBind");function K1(u){return function(d){d=dr(d);var S=Bs(d)?Di(d):r,j=S?S[0]:d.charAt(0),te=S?la(S,1).join(""):d.slice(1);return j[u]()+te}}i(K1,"createCaseFirst"),a(K1,"createCaseFirst");function Us(u){return function(d){return qd($g(Fg(d).replace(Rl,"")),u,"")}}i(Us,"createCompounder"),a(Us,"createCompounder");function ru(u){return function(){var d=arguments;switch(d.length){case 0:return new u;case 1:return new u(d[0]);case 2:return new u(d[0],d[1]);case 3:return new u(d[0],d[1],d[2]);case 4:return new u(d[0],d[1],d[2],d[3]);case 5:return new u(d[0],d[1],d[2],d[3],d[4]);case 6:return new u(d[0],d[1],d[2],d[3],d[4],d[5]);case 7:return new u(d[0],d[1],d[2],d[3],d[4],d[5],d[6])}var S=Zc(u.prototype),j=u.apply(S,d);return Mr(j)?j:S}}i(ru,"createCtor"),a(ru,"createCtor");function M5(u,d,S){var j=ru(u);function te(){for(var ce=arguments.length,ye=ke(ce),Ee=ce,xe=$s(te);Ee--;)ye[Ee]=arguments[Ee];var Fe=ce<3&&ye[0]!==xe&&ye[ce-1]!==xe?[]:sa(ye,xe);if(ce-=Fe.length,ce<S)return Y1(u,d,Xl,te.placeholder,r,ye,Fe,r,r,S-ce);var Ue=this&&this!==Lr&&this instanceof te?j:u;return Un(Ue,this,ye)}return i(te,"wrapper"),a(te,"wrapper"),te}i(M5,"createCurry"),a(M5,"createCurry");function G1(u){return function(d,S,j){var te=br(d);if(!kn(d)){var ce=wt(S,3);d=Wr(d),S=a(function(Ee){return ce(te[Ee],Ee,te)},"predicate")}var ye=u(d,S,j);return ye>-1?te[ce?d[ye]:ye]:r}}i(G1,"createFind"),a(G1,"createFind");function W1(u){return Mo(function(d){var S=d.length,j=S,te=ri.prototype.thru;for(u&&d.reverse();j--;){var ce=d[j];if(typeof ce!="function")throw new Ri(c);if(te&&!ye&&rf(ce)=="wrapper")var ye=new ri([],!0)}for(j=ye?j:S;++j<S;){ce=d[j];var Ee=rf(ce),xe=Ee=="wrapper"?rg(ce):r;xe&&Nh(xe[0])&&xe[1]==(k|$|Q|q)&&!xe[4].length&&xe[9]==1?ye=ye[rf(xe[0])].apply(ye,xe[3]):ye=ce.length==1&&Nh(ce)?ye[Ee]():ye.thru(ce)}return function(){var Fe=arguments,Ue=Fe[0];if(ye&&Fe.length==1&&Ot(Ue))return ye.plant(Ue).value();for(var je=0,Ye=S?d[je].apply(this,Fe):Ue;++je<S;)Ye=d[je].call(this,Ye);return Ye}})}i(W1,"createFlow"),a(W1,"createFlow");function Xl(u,d,S,j,te,ce,ye,Ee,xe,Fe){var Ue=d&k,je=d&O,Ye=d&B,pt=d&($|z),St=d&he,Lt=Ye?r:ru(u);function _t(){for(var Ht=arguments.length,Gt=ke(Ht),Hn=Ht;Hn--;)Gt[Hn]=arguments[Hn];if(pt)var _n=$s(_t),qn=e3(Gt,_n);if(j&&(Gt=z1(Gt,j,te,pt)),ce&&(Gt=H1(Gt,ce,ye,pt)),Ht-=qn,pt&&Ht<Fe){var Fr=sa(Gt,_n);return Y1(u,d,Xl,_t.placeholder,S,Gt,Fr,Ee,xe,Fe-Ht)}var Xi=je?S:this,fa=Ye?Xi[u]:u;return Ht=Gt.length,Ee?Gt=G5(Gt,Ee):St&&Ht>1&&Gt.reverse(),Ue&&xe<Ht&&(Gt.length=xe),this&&this!==Lr&&this instanceof _t&&(fa=Lt||ru(fa)),fa.apply(Xi,Gt)}return i(_t,"wrapper"),a(_t,"wrapper"),_t}i(Xl,"createHybrid"),a(Xl,"createHybrid");function J1(u,d){return function(S,j){return r5(S,u,d(j),{})}}i(J1,"createInverter"),a(J1,"createInverter");function Ql(u,d){return function(S,j){var te;if(S===r&&j===r)return d;if(S!==r&&(te=S),j!==r){if(te===r)return j;typeof S=="string"||typeof j=="string"?(S=jn(S),j=jn(j)):(S=B1(S),j=B1(j)),te=u(S,j)}return te}}i(Ql,"createMathOperation"),a(Ql,"createMathOperation");function Mh(u){return Mo(function(d){return d=Tr(d,$n(wt())),Ft(function(S){var j=this;return u(d,function(te){return Un(te,j,S)})})})}i(Mh,"createOver"),a(Mh,"createOver");function ef(u,d){d=d===r?" ":jn(d);var S=d.length;if(S<2)return S?_h(d,u):d;var j=_h(d,sh(u/Ps(d)));return Bs(d)?la(Di(j),0,u).join(""):j.slice(0,u)}i(ef,"createPadding"),a(ef,"createPadding");function I5(u,d,S,j){var te=d&O,ce=ru(u);function ye(){for(var Ee=-1,xe=arguments.length,Fe=-1,Ue=j.length,je=ke(Ue+xe),Ye=this&&this!==Lr&&this instanceof ye?ce:u;++Fe<Ue;)je[Fe]=j[Fe];for(;xe--;)je[Fe++]=arguments[++Ee];return Un(Ye,te?S:this,je)}return i(ye,"wrapper"),a(ye,"wrapper"),ye}i(I5,"createPartial"),a(I5,"createPartial");function Z1(u){return function(d,S,j){return j&&typeof j!="number"&&wn(d,S,j)&&(S=j=r),d=Do(d),S===r?(S=d,d=0):S=Do(S),j=j===r?d<S?1:-1:Do(j),p5(d,S,j,u)}}i(Z1,"createRange"),a(Z1,"createRange");function tf(u){return function(d,S){return typeof d=="string"&&typeof S=="string"||(d=ai(d),S=ai(S)),u(d,S)}}i(tf,"createRelationalOperation"),a(tf,"createRelationalOperation");function Y1(u,d,S,j,te,ce,ye,Ee,xe,Fe){var Ue=d&$,je=Ue?ye:r,Ye=Ue?r:ye,pt=Ue?ce:r,St=Ue?r:ce;d|=Ue?Q:Y,d&=~(Ue?Y:Q),d&Z||(d&=~(O|B));var Lt=[u,d,te,pt,je,St,Ye,Ee,xe,Fe],_t=S.apply(r,Lt);return Nh(u)&&W5(_t,Lt),_t.placeholder=j,fg(_t,u,d)}i(Y1,"createRecurry"),a(Y1,"createRecurry");function Ih(u){var d=Kr[u];return function(S,j){if(S=ai(S),j=j==null?0:vn(Nt(j),292),j&&g3(S)){var te=(dr(S)+"e").split("e"),ce=d(te[0]+"e"+(+te[1]+j));return te=(dr(ce)+"e").split("e"),+(te[0]+"e"+(+te[1]-j))}return d(S)}}i(Ih,"createRound"),a(Ih,"createRound");var ED=Wc&&1/Fl(new Wc([,-0]))[1]==v?function(u){return new Wc(u)}:Kh;function X1(u){return function(d){var S=bn(d);return S==be?Yd(d):S==ee?o3(d):Q2(d,u(d))}}i(X1,"createToPairs"),a(X1,"createToPairs");function Co(u,d,S,j,te,ce,ye,Ee){var xe=d&B;if(!xe&&typeof u!="function")throw new Ri(c);var Fe=j?j.length:0;if(Fe||(d&=~(Q|Y),j=te=r),ye=ye===r?ye:Gr(Nt(ye),0),Ee=Ee===r?Ee:Nt(Ee),Fe-=te?te.length:0,d&Y){var Ue=j,je=te;j=te=r}var Ye=xe?r:rg(u),pt=[u,d,S,j,te,Ue,je,ce,ye,Ee];if(Ye&&q5(pt,Ye),u=pt[0],d=pt[1],S=pt[2],j=pt[3],te=pt[4],Ee=pt[9]=pt[9]===r?xe?0:u.length:Gr(pt[9]-Fe,0),!Ee&&d&($|z)&&(d&=~($|z)),!d||d==O)var St=C5(u,d,S);else d==$||d==z?St=M5(u,d,Ee):(d==Q||d==(O|Q))&&!te.length?St=I5(u,d,S,j):St=Xl.apply(r,pt);var Lt=Ye?v5:W5;return fg(Lt(St,pt),u,d)}i(Co,"createWrap"),a(Co,"createWrap");function Q1(u,d,S,j){return u===r||Ni(u,Gc[S])&&!gr.call(j,S)?d:u}i(Q1,"customDefaultsAssignIn"),a(Q1,"customDefaultsAssignIn");function eg(u,d,S,j,te,ce){return Mr(u)&&Mr(d)&&(ce.set(d,u),Wl(u,d,r,eg,ce),ce.delete(d)),u}i(eg,"customDefaultsMerge"),a(eg,"customDefaultsMerge");function k5(u){return iu(u)?r:u}i(k5,"customOmitClone"),a(k5,"customOmitClone");function tg(u,d,S,j,te,ce){var ye=S&x,Ee=u.length,xe=d.length;if(Ee!=xe&&!(ye&&xe>Ee))return!1;var Fe=ce.get(u),Ue=ce.get(d);if(Fe&&Ue)return Fe==d&&Ue==u;var je=-1,Ye=!0,pt=S&D?new Ua:r;for(ce.set(u,d),ce.set(d,u);++je<Ee;){var St=u[je],Lt=d[je];if(j)var _t=ye?j(Lt,St,je,d,u,ce):j(St,Lt,je,u,d,ce);if(_t!==r){if(_t)continue;Ye=!1;break}if(pt){if(!Vd(d,function(Ht,Gt){if(!Kc(pt,Gt)&&(St===Ht||te(St,Ht,S,j,ce)))return pt.push(Gt)})){Ye=!1;break}}else if(!(St===Lt||te(St,Lt,S,j,ce))){Ye=!1;break}}return ce.delete(u),ce.delete(d),Ye}i(tg,"equalArrays"),a(tg,"equalArrays");function D5(u,d,S,j,te,ce,ye){switch(S){case ve:if(u.byteLength!=d.byteLength||u.byteOffset!=d.byteOffset)return!1;u=u.buffer,d=d.buffer;case qe:return!(u.byteLength!=d.byteLength||!ce(new nh(u),new nh(d)));case ne:case ae:case Re:return Ni(+u,+d);case V:return u.name==d.name&&u.message==d.message;case ie:case ue:return u==d+"";case be:var Ee=Yd;case ee:var xe=j&x;if(Ee||(Ee=Fl),u.size!=d.size&&!xe)return!1;var Fe=ye.get(u);if(Fe)return Fe==d;j|=D,ye.set(u,d);var Ue=tg(Ee(u),Ee(d),j,te,ce,ye);return ye.delete(u),Ue;case Ae:if(Hl)return Hl.call(u)==Hl.call(d)}return!1}i(D5,"equalByTag"),a(D5,"equalByTag");function R5(u,d,S,j,te,ce){var ye=S&x,Ee=kh(u),xe=Ee.length,Fe=kh(d),Ue=Fe.length;if(xe!=Ue&&!ye)return!1;for(var je=xe;je--;){var Ye=Ee[je];if(!(ye?Ye in d:gr.call(d,Ye)))return!1}var pt=ce.get(u),St=ce.get(d);if(pt&&St)return pt==d&&St==u;var Lt=!0;ce.set(u,d),ce.set(d,u);for(var _t=ye;++je<xe;){Ye=Ee[je];var Ht=u[Ye],Gt=d[Ye];if(j)var Hn=ye?j(Gt,Ht,Ye,d,u,ce):j(Ht,Gt,Ye,u,d,ce);if(!(Hn===r?Ht===Gt||te(Ht,Gt,S,j,ce):Hn)){Lt=!1;break}_t||(_t=Ye=="constructor")}if(Lt&&!_t){var _n=u.constructor,qn=d.constructor;_n!=qn&&"constructor"in u&&"constructor"in d&&!(typeof _n=="function"&&_n instanceof _n&&typeof qn=="function"&&qn instanceof qn)&&(Lt=!1)}return ce.delete(u),ce.delete(d),Lt}i(R5,"equalObjects"),a(R5,"equalObjects");function Mo(u){return lg(cg(u,r,gg),u+"")}i(Mo,"flatRest"),a(Mo,"flatRest");function kh(u){return A1(u,Wr,ng)}i(kh,"getAllKeys"),a(kh,"getAllKeys");function Dh(u){return A1(u,Dn,N5)}i(Dh,"getAllKeysIn"),a(Dh,"getAllKeysIn");var rg=uh?function(u){return uh.get(u)}:Kh;function rf(u){for(var d=u.name+"",S=Jc[d],j=gr.call(Jc,d)?S.length:0;j--;){var te=S[j],ce=te.func;if(ce==null||ce==u)return te.name}return d}i(rf,"getFuncName"),a(rf,"getFuncName");function $s(u){var d=gr.call(se,"placeholder")?se:u;return d.placeholder}i($s,"getHolder"),a($s,"getHolder");function wt(){var u=se.iteratee||qh;return u=u===qh?T1:u,arguments.length?u(arguments[0],arguments[1]):u}i(wt,"getIteratee"),a(wt,"getIteratee");function nf(u,d){var S=u.__data__;return j5(d)?S[typeof d=="string"?"string":"hash"]:S.map}i(nf,"getMapData"),a(nf,"getMapData");function Rh(u){for(var d=Wr(u),S=d.length;S--;){var j=d[S],te=u[j];d[S]=[j,te,ag(te)]}return d}i(Rh,"getMatchData"),a(Rh,"getMatchData");function Ha(u,d){var S=r3(u,d);return x1(S)?S:r}i(Ha,"getNative"),a(Ha,"getNative");function O5(u){var d=gr.call(u,Ls),S=u[Ls];try{u[Ls]=r;var j=!0}catch{}var te=th.call(u);return j&&(d?u[Ls]=S:delete u[Ls]),te}i(O5,"getRawTag"),a(O5,"getRawTag");var ng=h1?function(u){return u==null?[]:(u=br(u),oa(h1(u),function(d){return p3.call(u,d)}))}:Gh,N5=h1?function(u){for(var d=[];u;)aa(d,ng(u)),u=ih(u);return d}:Gh,bn=yn;(p1&&bn(new p1(new ArrayBuffer(1)))!=ve||$l&&bn(new $l)!=be||m1&&bn(m1.resolve())!=U||Wc&&bn(new Wc)!=ee||jl&&bn(new jl)!=Ie)&&(bn=a(function(u){var d=yn(u),S=d==N?u.constructor:r,j=S?qa(S):"";if(j)switch(j){case mD:return ve;case gD:return be;case vD:return U;case yD:return ee;case bD:return Ie}return d},"getTag"));function B5(u,d,S){for(var j=-1,te=S.length;++j<te;){var ce=S[j],ye=ce.size;switch(ce.type){case"drop":u+=ye;break;case"dropRight":d-=ye;break;case"take":d=vn(d,u+ye);break;case"takeRight":u=Gr(u,d-ye);break}}return{start:u,end:d}}i(B5,"getView"),a(B5,"getView");function P5(u){var d=u.match(Ze);return d?d[1].split(cr):[]}i(P5,"getWrapDetails"),a(P5,"getWrapDetails");function ig(u,d,S){d=ua(d,u);for(var j=-1,te=d.length,ce=!1;++j<te;){var ye=Yi(d[j]);if(!(ce=u!=null&&S(u,ye)))break;u=u[ye]}return ce||++j!=te?ce:(te=u==null?0:u.length,!!te&&ff(te)&&Io(ye,te)&&(Ot(u)||js(u)))}i(ig,"hasPath"),a(ig,"hasPath");function L5(u){var d=u.length,S=new u.constructor(d);return d&&typeof u[0]=="string"&&gr.call(u,"index")&&(S.index=u.index,S.input=u.input),S}i(L5,"initCloneArray"),a(L5,"initCloneArray");function og(u){return typeof u.constructor=="function"&&!nu(u)?Zc(ih(u)):{}}i(og,"initCloneObject"),a(og,"initCloneObject");function F5(u,d,S){var j=u.constructor;switch(d){case qe:return Ch(u);case ne:case ae:return new j(+u);case ve:return _5(u,S);case pe:case re:case le:case _e:case Te:case Ce:case Oe:case Ct:case Ve:return $1(u,S);case be:return new j;case Re:case ue:return new j(u);case ie:return E5(u);case ee:return new j;case Ae:return A5(u)}}i(F5,"initCloneByTag"),a(F5,"initCloneByTag");function U5(u,d){var S=d.length;if(!S)return u;var j=S-1;return d[j]=(S>1?"& ":"")+d[j],d=d.join(S>2?", ":" "),u.replace(at,`{
24
+ `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function ay(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(ay,"arrRemove");var Wp=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,o,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=oy(c),h=l.next();!h.done;h=l.next()){var p=h.value;p.remove(this)}}catch(D){t={error:D}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var m=this.initialTeardown;if(Fi(m))try{m()}catch(D){s=D instanceof Gp?D.errors:[D]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var b=oy(y),_=b.next();!_.done;_=b.next()){var x=_.value;try{e7(x)}catch(D){s=s??[],D instanceof Gp?s=Cu(Cu([],Tu(s)),Tu(D.errors)):s.push(D)}}}catch(D){n={error:D}}finally{try{_&&!_.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(s)throw new Gp(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)e7(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)&&ay(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&ay(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var uJ=Wp.EMPTY;function Jp(e){return e instanceof Wp||e&&"closed"in e&&Fi(e.remove)&&Fi(e.add)&&Fi(e.unsubscribe)}i(Jp,"isSubscription");function e7(e){Fi(e)?e():e.unsubscribe()}i(e7,"execFinalizer");var no={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Mu={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Mu.delegate;return o?.setTimeout?o.setTimeout.apply(o,Cu([e,t],Tu(r))):setTimeout.apply(void 0,Cu([e,t],Tu(r)))},clearTimeout:function(e){var t=Mu.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function t7(e){Mu.setTimeout(function(){var t=no.onUnhandledError;if(t)t(e);else throw e})}i(t7,"reportUnhandledError");function sy(){}i(sy,"noop");var r7=function(){return cy("C",void 0,void 0)}();function n7(e){return cy("E",void 0,e)}i(n7,"errorNotification");function i7(e){return cy("N",e,void 0)}i(i7,"nextNotification");function cy(e,t,r){return{kind:e,value:t,error:r}}i(cy,"createNotification");var nc=null;function o7(e){if(no.useDeprecatedSynchronousErrorHandling){var t=!nc;if(t&&(nc={errorThrown:!1,error:null}),e(),t){var r=nc,n=r.errorThrown,o=r.error;if(nc=null,n)throw o}}else e()}i(o7,"errorContext");function a7(e){no.useDeprecatedSynchronousErrorHandling&&nc&&(nc.errorThrown=!0,nc.error=e)}i(a7,"captureError");var fy=function(e){iy(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Jp(r)&&r.add(n)):n.destination=NL,n}return i(t,"Subscriber"),t.create=function(r,n,o){return new Yp(r,n,o)},t.prototype.next=function(r){this.isStopped?ly(i7(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?ly(n7(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?ly(r7,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}(Wp);var DL=Function.prototype.bind;function uy(e,t){return DL.call(e,t)}i(uy,"bind");var RL=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){Zp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Zp(n)}else Zp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Zp(r)}},e}(),Yp=function(e){iy(t,e);function t(r,n,o){var s=e.call(this)||this,c;if(Fi(r)||!r)c={next:r??void 0,error:n??void 0,complete:o??void 0};else{var l;s&&no.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&uy(r.next,l),error:r.error&&uy(r.error,l),complete:r.complete&&uy(r.complete,l)}):c=r}return s.destination=new RL(c),s}return i(t,"SafeSubscriber"),t}(fy);function Zp(e){no.useDeprecatedSynchronousErrorHandling?a7(e):t7(e)}i(Zp,"handleUnhandledError");function OL(e){throw e}i(OL,"defaultErrorHandler");function ly(e,t){var r=no.onStoppedNotification;r&&Mu.setTimeout(function(){return r(e,t)})}i(ly,"handleStoppedNotification");var NL={closed:!0,next:sy,error:OL,complete:sy};var s7=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function c7(e){return e}i(c7,"identity");function u7(e){return e.length===0?c7:e.length===1?e[0]:i(function(r){return e.reduce(function(n,o){return o(n)},r)},"piped")}i(u7,"pipeFromArray");var dy=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 o=this,s=PL(t)?t:new Yp(t,r,n);return o7(function(){var c=o,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?o._subscribe(s):o._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=l7(r),new r(function(o,s){var c=new Yp({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:o});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[s7]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return u7(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=l7(t),new t(function(n,o){var s;r.subscribe(function(c){return s=c},function(c){return o(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function l7(e){var t;return(t=e??no.Promise)!==null&&t!==void 0?t:Promise}i(l7,"getPromiseCtor");function BL(e){return e&&Fi(e.next)&&Fi(e.error)&&Fi(e.complete)}i(BL,"isObserver");function PL(e){return e&&e instanceof fy||BL(e)&&Jp(e)}i(PL,"isSubscriber");var f7;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(f7||(f7={}));var d7;(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"})(d7||(d7={}));var py;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(py||(py={}));var Of=class extends dy{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,hy.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===py.ANCHOR).map(({cid:t})=>hr.make(this.id,t))}get state(){return(0,hy.default)(this.state$.value)}async sync(t={}){t={sync:rc.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(Of,"Stream");function h7(){return e=>{}}i(h7,"StreamStatic");var LL=function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},hi,my={anchor:!0,publish:!0,pin:!0,sync:rc.PREFER_CACHE},FL={sync:rc.PREFER_CACHE},p7={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function gy(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=uv((0,v7.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(gy,"headerFromMetadata");async function m7(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(m7,"getAuthenticatedDID");async function vy(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(vy,"throwReadOnlyError");var Za=hi=i(class extends Of{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,g7.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,o={}){o={...my,...o},!n?.deterministic&&o.syncTimeoutSeconds==null&&(o.syncTimeoutSeconds=0);let s=o.asDID?{did:o.asDID}:t,c=await hi.makeGenesis(s,r,n);return t.createStreamFromGenesis(hi.STREAM_TYPE_ID,c,o)}static async createFromGenesis(t,r,n={}){n={...my,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let o=r.data?await hi._signDagJWS(t,r):r;return t.createStreamFromGenesis(hi.STREAM_TYPE_ID,o,n)}static async deterministic(t,r,n={}){if(n={...my,...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 o=await hi.makeGenesis(t,null,r);return t.createStreamFromGenesis(hi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...FL,...n};let o=Ys.from(r);if(o.type!=hi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${hi.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async update(t,r,n={}){n={...p7,...n};let o=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(o,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...p7,...r};let o={header:gy(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await hi._signDagJWS(this.api,o),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=vy,this.patch=vy,this.sync=vy,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let o=await this._makeRawCommit(r,n);return hi._signDagJWS(t,o)}async _makeRawCommit(t,r){r||(r={});let n=gy(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 o=JE.compare(this.content,t),s=this.state.log[0];return{header:n,data:o,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 m7(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 o=gy(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:o};return Ev(c),c}let s={data:r,header:o};return hi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await m7(t)).createDagJWS(r)}},"TileDocument");Za.STREAM_TYPE_NAME="tile";Za.STREAM_TYPE_ID=0;Za=hi=LL([h7()],Za);var S7=Hs(w7(),1);function WL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(WL,"_checkPrivateRedeclaration");function JL(e,t){return t.get?t.get.call(e):t.value}i(JL,"_classApplyDescriptorGet");function ZL(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(ZL,"_classApplyDescriptorSet");function A7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(A7,"_classExtractFieldDescriptor");function _y(e,t){var r=A7(e,t,"get");return JL(e,r)}i(_y,"_classPrivateFieldGet");function _7(e,t,r){WL(e,t),t.set(e,r)}i(_7,"_classPrivateFieldInit");function E7(e,t,r){var n=A7(e,t,"set");return ZL(e,n,r),r}i(E7,"_classPrivateFieldSet");function YL(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(YL,"keyToQuery");function Ey(e){return typeof e=="string"?Ys.from(e).toString():hr.isInstance(e)||Yt.isInstance(e)?e.toString():e.streamId.toString()}i(Ey,"keyToString");async function Sy(e){let t=await Za.makeGenesis({},null,{...e,deterministic:!0}),r=await Yt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(Sy,"getDeterministicQuery");var XL=i(()=>Promise.resolve([]),"tempBatchLoadFn"),Xp=new WeakMap,Ay=new WeakMap,ic=class extends S7.default{cache(t){if(!_y(this,Ay))return!1;let r=t.id.toString();return this.clear(r).prime(r,t),!0}async create(t,r,n){let o=await Za.create(_y(this,Xp),t,r,n);return this.cache(o),o}async deterministic(t,r){let n=await Sy(t);try{return await super.load(n)}catch{let s=await Za.createFromGenesis(_y(this,Xp),n.genesis,r);return this.cache(s),s}}async load(t){return await super.load(t)}async update(t,r,n,o){let s=Ey(t);this.clear(s);let c=await this.load({streamId:s});return await c.update(r,n,o),c}constructor(t){super(XL,{cache:!0,cacheKeyFn:Ey,cacheMap:t.cache!=null&&typeof t.cache!="boolean"?t.cache:void 0}),_7(this,Xp,{writable:!0,value:void 0}),_7(this,Ay,{writable:!0,value:void 0}),this._batchLoadFn=async r=>{t.cache||this.clearAll();let n=await t.ceramic.multiQuery(r.map(YL),t.multiqueryTimeout);return r.map(o=>{let s=Ey(o),c=n[s];return c||new Error(`Failed to load stream: ${s}`)})},E7(this,Xp,t.ceramic),E7(this,Ay,!!t.cache)}};i(ic,"TileLoader");function QL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(QL,"_checkPrivateRedeclaration");function eF(e,t){return t.get?t.get.call(e):t.value}i(eF,"_classApplyDescriptorGet");function tF(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(tF,"_classApplyDescriptorSet");function T7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(T7,"_classExtractFieldDescriptor");function oc(e,t){var r=T7(e,t,"get");return eF(e,r)}i(oc,"_classPrivateFieldGet");function x7(e,t,r){QL(e,t),t.set(e,r)}i(x7,"_classPrivateFieldInit");function xy(e,t,r){var n=T7(e,t,"set");return tF(e,n,r),r}i(xy,"_classPrivateFieldSet");var Iu=new WeakMap,ku=new WeakMap,Du=class{get aliases(){return oc(this,Iu)}get loader(){return oc(this,ku)}getDefinitionID(t){return oc(this,Iu).definitions[t]??null}getSchemaURL(t){return oc(this,Iu).schemas[t]??null}getTileID(t){return oc(this,Iu).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 oc(this,ku).load(r)}async createTile(t,r,n={}){let o=this.getSchemaURL(t);if(o==null)throw new Error(`Schema alias "${t}" is not defined`);let{controller:s,...c}=n,l={schema:o};return s!=null&&(l.controllers=[s]),await oc(this,ku).create(r,l,c)}constructor(t){if(x7(this,Iu,{writable:!0,value:void 0}),x7(this,ku,{writable:!0,value:void 0}),xy(this,Iu,t.aliases),t.loader!=null)xy(this,ku,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");xy(this,ku,new ic({ceramic:t.ceramic,cache:t.cache}))}}};i(Du,"DataModel");function rF(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(rF,"_checkPrivateRedeclaration");function nF(e,t){return t.get?t.get.call(e):t.value}i(nF,"_classApplyDescriptorGet");function iF(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(iF,"_classApplyDescriptorSet");function C7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(C7,"_classExtractFieldDescriptor");function Bo(e,t){var r=C7(e,t,"get");return nF(e,r)}i(Bo,"_classPrivateFieldGet");function Qp(e,t,r){rF(e,t),t.set(e,r)}i(Qp,"_classPrivateFieldInit");function e0(e,t,r){var n=C7(e,t,"set");return iF(e,n,r),r}i(e0,"_classPrivateFieldSet");var t0=new WeakMap,ac=new WeakMap,Ty=new WeakMap,r0=new WeakMap,Nf=class{_createValuePromise(){e0(this,Ty,new Promise((t,r)=>{e0(this,r0,{resolve:t,reject:r})}))}change(t){return new Promise((r,n)=>{let o=i(async s=>{try{let c=await t(s);r(),this._next(c)}catch(c){n(c),this._next(s)}},"run");Bo(this,ac).push({reject:n,run:o}),Bo(this,ac).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 Bo(this,ac).length===0?await Bo(this,t0).call(this):await Bo(this,Ty)}async _start(){try{let t=await Bo(this,t0).call(this);this._next(t)}catch(t){Bo(this,ac).forEach(r=>{r.reject(t)}),e0(this,ac,[]),Bo(this,r0).reject(t),this._createValuePromise()}}_next(t){let r=Bo(this,ac).shift();r==null?this._end(t):r.run(t)}_end(t){Bo(this,r0).resolve(t),this._createValuePromise()}constructor(t){Qp(this,t0,{writable:!0,value:void 0}),Qp(this,ac,{writable:!0,value:[]}),Qp(this,Ty,{writable:!0,value:void 0}),Qp(this,r0,{writable:!0,value:void 0}),e0(this,t0,t),this._createValuePromise()}};i(Nf,"TileProxy");var oF=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function aF(e){return oF.test(e)}i(aF,"isDIDstring");function sF(e){if(!aF(e))throw new Error(`Invalid DID: ${e}`)}i(sF,"assertDIDstring");function Cy(e){return sF(e),{controllers:[e],family:"IDX"}}i(Cy,"getIDXMetadata");function cF(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(cF,"_checkPrivateRedeclaration");function uF(e,t){return t.get?t.get.call(e):t.value}i(uF,"_classApplyDescriptorGet");function lF(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(lF,"_classApplyDescriptorSet");function M7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(M7,"_classExtractFieldDescriptor");function Ur(e,t){var r=M7(e,t,"get");return uF(e,r)}i(Ur,"_classPrivateFieldGet");function Bf(e,t,r){cF(e,t),t.set(e,r)}i(Bf,"_classPrivateFieldInit");function n0(e,t,r){var n=M7(e,t,"set");return lF(e,n,r),r}i(n0,"_classPrivateFieldSet");var va=new WeakMap,i0=new WeakMap,My=new WeakMap,Po=new WeakMap,o0=new WeakMap,Pf=class{get authenticated(){return Ur(this,va).did!=null}get ceramic(){return Ur(this,va)}get id(){if(Ur(this,i0)!=null)return Ur(this,i0);if(Ur(this,va).did==null)throw new Error("Ceramic instance is not authenticated");return Ur(this,va).did.hasParent?Ur(this,va).did.parent:Ur(this,va).did.id}get loader(){return Ur(this,Po)}get model(){return Ur(this,o0)}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),o=await Promise.all(r.map(async l=>{let{genesis:h,streamId:p}=await Sy(Cy(l));return{genesis:h,streamId:p.toString(),paths:[n]}})),s=await Ur(this,va).multiQuery(o),c=[];for(let l of o){let h=s[l.streamId]?.content?.[n],p=h?s[Yt.fromString(h).toString()]:null;c.push(p?.content??null)}return c}async set(t,r,n={}){let o=this.getDefinitionID(t),[s,c]=await this._setRecordOnly(o,r,n);return s&&await this._setReference(n.controller??this.id,o,c),c}async merge(t,r,n={}){let o=this.getDefinitionID(t),s=await this.getRecord(o),c=s?{...s,...r}:r;return await this.setRecord(o,c,n)}async setAll(t,r={}){let n=Object.entries(t).map(async([c,l])=>{let h=this.getDefinitionID(c),[p,m]=await this._setRecordOnly(h,l,r);return[p,h,m]}),s=(await Promise.all(n)).reduce((c,[l,h,p])=>(l&&(c[h]=p.toUrl()),c),{});return await this._setReferences(r.controller??this.id,s),s}async setDefaults(t,r={}){let n=await this.getIndex()??{},o=Object.entries(t).map(([l,h])=>[this.getDefinitionID(l),h]).filter(l=>n[l[0]]==null).map(async([l,h])=>{let p=await this.getDefinition(l),m=await this._createRecord(p,h,r);return{[l]:m.toUrl()}}),c=(await Promise.all(o)).reduce((l,h)=>Object.assign(l,h),{});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[o,s]=r[n++],c=await Ur(this,Po).load(s);return{done:!1,value:{key:o,id:s,record:c.content}}}}}async _createIDXDoc(t){return await Ur(this,Po).deterministic(Cy(t))}async _getIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)return null;if(r.metadata.schema!==Ap)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:Ap});else if(r.metadata.schema!==Ap)throw new Error("Invalid document: schema is not IdentityIndex");return r}_getIndexProxy(t){let r=Ur(this,My)[t];return r==null&&(r=new Nf(async()=>await this._getOwnIDXDoc(t)),Ur(this,My)[t]=r),r}getDefinitionID(t){return Ur(this,o0).getDefinitionID(t)??t}async getDefinition(t){let r=await Ur(this,Po).load(t);if(r.metadata.schema!==KE)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 Ur(this,Po).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[o,s]=await this._setRecordOnly(t,r,n);return o&&await this._setReference(n.controller??this.id,t,s),s}async _setRecordOnly(t,r,n){let o=await this.getRecordID(t,n.controller??this.id);if(o==null){let s=await this.getDefinition(t),c=await this._createRecord(s,r,n);return[!0,c]}else{let s=await Ur(this,Po).update(o,r);return[!1,s.id]}}async _createRecord(t,r,{controller:n,pin:o}){let s=await Ur(this,Po).deterministic({controllers:[n??this.id],family:t.id.toString()},{pin:o});return await s.update(r,{schema:t.schema}),s.id}async _setReference(t,r,n){await this._getIndexProxy(t).changeContent(o=>({...o,[r]:n.toUrl()}))}async _setReferences(t,r){Object.keys(r).length!==0&&await this._getIndexProxy(t).changeContent(n=>({...n,...r}))}constructor(t){Bf(this,va,{writable:!0,value:void 0}),Bf(this,i0,{writable:!0,value:void 0}),Bf(this,My,{writable:!0,value:{}}),Bf(this,Po,{writable:!0,value:void 0}),Bf(this,o0,{writable:!0,value:void 0});let{cache:r,ceramic:n,id:o,loader:s,model:c}=t;n0(this,va,n),n0(this,i0,o),n0(this,Po,s??new ic({ceramic:n,cache:r})),n0(this,o0,c instanceof Du?c:new Du({loader:Ur(this,Po),aliases:c}))}};i(Pf,"DIDDataStore");var rr;(function(e){e.assertEqual=o=>o;function t(o){}i(t,"assertIs"),e.assertIs=t;function r(o){throw new Error}i(r,"assertNever"),e.assertNever=r,e.arrayToEnum=o=>{let s={};for(let c of o)s[c]=c;return s},e.getValidEnumValues=o=>{let s=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),c={};for(let l of s)c[l]=o[l];return e.objectValues(c)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let c in o)Object.prototype.hasOwnProperty.call(o,c)&&s.push(c);return s},e.find=(o,s)=>{for(let c of o)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(rr||(rr={}));var tt=rr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ya=i(e=>{switch(typeof e){case"undefined":return tt.undefined;case"string":return tt.string;case"number":return isNaN(e)?tt.nan:tt.number;case"boolean":return tt.boolean;case"function":return tt.function;case"bigint":return tt.bigint;case"symbol":return tt.symbol;case"object":return Array.isArray(e)?tt.array:e===null?tt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?tt.promise:typeof Map<"u"&&e instanceof Map?tt.map:typeof Set<"u"&&e instanceof Set?tt.set:typeof Date<"u"&&e instanceof Date?tt.date:tt.object;default:return tt.unknown}},"getParsedType"),Ke=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"]),fF=i(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ui=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:[]},o=i(s=>{for(let c of s.issues)if(c.code==="invalid_union")c.unionErrors.map(o);else if(c.code==="invalid_return_type")o(c.returnTypeError);else if(c.code==="invalid_arguments")o(c.argumentsError);else if(c.path.length===0)n._errors.push(r(c));else{let l=n,h=0;for(;h<c.path.length;){let p=c.path[h];h===c.path.length-1?(l[p]=l[p]||{_errors:[]},l[p]._errors.push(r(c))):l[p]=l[p]||{_errors:[]},l=l[p],h++}}},"processError");return o(this),n}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 o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};i(Ui,"ZodError");Ui.create=e=>new Ui(e);var Ff=i((e,t)=>{let r;switch(e.code){case Ke.invalid_type:e.received===tt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ke.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,rr.jsonStringifyReplacer)}`;break;case Ke.unrecognized_keys:r=`Unrecognized key(s) in object: ${rr.joinValues(e.keys,", ")}`;break;case Ke.invalid_union:r="Invalid input";break;case Ke.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${rr.joinValues(e.options)}`;break;case Ke.invalid_enum_value:r=`Invalid enum value. Expected ${rr.joinValues(e.options)}, received '${e.received}'`;break;case Ke.invalid_arguments:r="Invalid function arguments";break;case Ke.invalid_return_type:r="Invalid function return type";break;case Ke.invalid_date:r="Invalid date";break;case Ke.invalid_string:typeof e.validation=="object"?"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 Ke.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(e.minimum)}`:r="Invalid input";break;case Ke.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==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(e.maximum)}`:r="Invalid input";break;case Ke.custom:r="Invalid input";break;case Ke.invalid_intersection_types:r="Intersection results could not be merged";break;case Ke.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ke.not_finite:r="Number must be finite";break;default:r=t.defaultError,rr.assertNever(e)}return{message:r}},"errorMap"),R7=Ff;function dF(e){R7=e}i(dF,"setErrorMap");function s0(){return R7}i(s0,"getErrorMap");var c0=i(e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],c={...o,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...o,path:s,message:o.message||l}},"makeIssue"),hF=[];function vt(e,t){let r=c0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s0(),Ff].filter(n=>!!n)});e.common.issues.push(r)}i(vt,"addIssueToContext");var Xr=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 o of r){if(o.status==="aborted")return kt;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r)n.push({key:await o.key,value:await o.value});return Xr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:s,value:c}=o;if(s.status==="aborted"||c.status==="aborted")return kt;s.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),(typeof c.value<"u"||o.alwaysSet)&&(n[s.value]=c.value)}return{status:t.value,value:n}}};i(Xr,"ParseStatus");var kt=Object.freeze({status:"aborted"}),O7=i(e=>({status:"dirty",value:e}),"DIRTY"),Sn=i(e=>({status:"valid",value:e}),"OK"),Iy=i(e=>e.status==="aborted","isAborted"),ky=i(e=>e.status==="dirty","isDirty"),u0=i(e=>e.status==="valid","isValid"),l0=i(e=>typeof Promise!==void 0&&e instanceof Promise,"isAsync"),Wt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Wt||(Wt={}));var pi=class{constructor(t,r,n,o){this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._path.concat(this._key)}};i(pi,"ParseInputLazyPath");var I7=i((e,t)=>{if(u0(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Ui(e.common.issues);return{success:!1,error:r}}},"handleResult");function Vt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:i((c,l)=>c.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:n??l.defaultError}:{message:r??l.defaultError},"customMap"),description:o}}i(Vt,"processCreateParams");var Bt=class{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Ya(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Ya(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Xr,ctx:{common:t.parent.common,data:t.data,parsedType:Ya(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(l0(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 o={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:Ya(t)},s=this._parseSync({data:t,path:o.path,parent:o});return I7(o,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:Ya(t)},o=this._parse({data:t,path:n.path,parent:n}),s=await(l0(o)?o:Promise.resolve(o));return I7(n,s)}refine(t,r){let n=i(o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r,"getIssueProperties");return this._refinement((o,s)=>{let c=t(o),l=i(()=>s.addIssue({code:Ke.custom,...n(o)}),"setError");return typeof Promise<"u"&&c instanceof Promise?c.then(h=>h?!0:(l(),!1)):c?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Wn({schema:this,typeName:xt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return gi.create(this)}nullable(){return $o.create(this)}nullish(){return this.optional().nullable()}array(){return Gn.create(this)}promise(){return wa.create(this)}or(t){return rs.create([this,t])}and(t){return ns.create(this,t)}transform(t){return new Wn({schema:this,typeName:xt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new us({innerType:this,defaultValue:r,typeName:xt.ZodDefault})}brand(){return new Lf({typeName:xt.ZodBranded,type:this,...Vt(void 0)})}catch(t){let r=typeof t=="function"?t:()=>t;return new fc({innerType:this,defaultValue:r,typeName:xt.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ls.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};i(Bt,"ZodType");var pF=/^c[^\s-]{8,}$/i,mF=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,gF=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,vF=i(e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex"),$i=class extends Bt{constructor(){super(...arguments),this._regex=(t,r,n)=>this.refinement(o=>t.test(o),{validation:r,code:Ke.invalid_string,...Wt.errToObj(n)}),this.nonempty=t=>this.min(1,Wt.errToObj(t)),this.trim=()=>new $i({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==tt.string){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.string,received:s.parsedType}),kt}let n=new Xr,o;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.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&&(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.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)&&(o=this._getOrReturnCtx(t,o),c?vt(o,{code:Ke.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&vt(o,{code:Ke.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")gF.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"email",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")mF.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"uuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")pF.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"cuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),vt(o,{validation:"url",code:Ke.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"regex",code:Ke.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?vF(s).test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.invalid_string,validation:"datetime",message:s.message}),n.dirty()):rr.assertNever(s);return{status:n.value,value:t.data}}_addCheck(t){return new $i({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Wt.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Wt.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Wt.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Wt.errToObj(t)})}datetime(t){var r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,...Wt.errToObj(t?.message)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Wt.errToObj(r)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Wt.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Wt.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Wt.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Wt.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Wt.errToObj(r)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get 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($i,"ZodString");$i.create=e=>{var t;return new $i({checks:[],typeName:xt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};function yF(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=parseInt(e.toFixed(o).replace(".","")),c=parseInt(t.toFixed(o).replace(".",""));return s%c/Math.pow(10,o)}i(yF,"floatSafeRemainder");var io=class extends Bt{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)!==tt.number){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.number,received:s.parsedType}),kt}let n,o=new Xr;for(let s of this._def.checks)s.kind==="int"?rr.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?yF(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_finite,message:s.message}),o.dirty()):rr.assertNever(s);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Wt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Wt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Wt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Wt.toString(r))}setLimit(t,r,n,o){return new io({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Wt.toString(o)}]})}_addCheck(t){return new io({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Wt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Wt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Wt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Wt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Wt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Wt.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Wt.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")}};i(io,"ZodNumber");io.create=e=>new io({checks:[],typeName:xt.ZodNumber,coerce:e?.coerce||!1,...Vt(e)});var Xa=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==tt.bigint){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.bigint,received:n.parsedType}),kt}return Sn(t.data)}};i(Xa,"ZodBigInt");Xa.create=e=>{var t;return new Xa({typeName:xt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};var Qa=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==tt.boolean){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.boolean,received:n.parsedType}),kt}return Sn(t.data)}};i(Qa,"ZodBoolean");Qa.create=e=>new Qa({typeName:xt.ZodBoolean,coerce:e?.coerce||!1,...Vt(e)});var Lo=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==tt.date){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.date,received:s.parsedType}),kt}if(isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_date}),kt}let n=new Xr,o;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.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 Lo({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Wt.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Wt.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(Lo,"ZodDate");Lo.create=e=>new Lo({checks:[],coerce:e?.coerce||!1,typeName:xt.ZodDate,...Vt(e)});var sc=class extends Bt{_parse(t){if(this._getType(t)!==tt.symbol){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.symbol,received:n.parsedType}),kt}return Sn(t.data)}};i(sc,"ZodSymbol");sc.create=e=>new sc({typeName:xt.ZodSymbol,...Vt(e)});var es=class extends Bt{_parse(t){if(this._getType(t)!==tt.undefined){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.undefined,received:n.parsedType}),kt}return Sn(t.data)}};i(es,"ZodUndefined");es.create=e=>new es({typeName:xt.ZodUndefined,...Vt(e)});var ts=class extends Bt{_parse(t){if(this._getType(t)!==tt.null){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.null,received:n.parsedType}),kt}return Sn(t.data)}};i(ts,"ZodNull");ts.create=e=>new ts({typeName:xt.ZodNull,...Vt(e)});var ya=class extends Bt{constructor(){super(...arguments),this._any=!0}_parse(t){return Sn(t.data)}};i(ya,"ZodAny");ya.create=e=>new ya({typeName:xt.ZodAny,...Vt(e)});var Fo=class extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Sn(t.data)}};i(Fo,"ZodUnknown");Fo.create=e=>new Fo({typeName:xt.ZodUnknown,...Vt(e)});var ji=class extends Bt{_parse(t){let r=this._getOrReturnCtx(t);return vt(r,{code:Ke.invalid_type,expected:tt.never,received:r.parsedType}),kt}};i(ji,"ZodNever");ji.create=e=>new ji({typeName:xt.ZodNever,...Vt(e)});var cc=class extends Bt{_parse(t){if(this._getType(t)!==tt.undefined){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.void,received:n.parsedType}),kt}return Sn(t.data)}};i(cc,"ZodVoid");cc.create=e=>new cc({typeName:xt.ZodVoid,...Vt(e)});var Gn=class extends Bt{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==tt.array)return vt(r,{code:Ke.invalid_type,expected:tt.array,received:r.parsedType}),kt;if(o.exactLength!==null){let c=r.data.length>o.exactLength.value,l=r.data.length<o.exactLength.value;(c||l)&&(vt(r,{code:c?Ke.too_big:Ke.too_small,minimum:l?o.exactLength.value:void 0,maximum:c?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(vt(r,{code:Ke.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(vt(r,{code:Ke.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all(r.data.map((c,l)=>o.type._parseAsync(new pi(r,c,r.path,l)))).then(c=>Xr.mergeArray(n,c));let s=r.data.map((c,l)=>o.type._parseSync(new pi(r,c,r.path,l)));return Xr.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new Gn({...this._def,minLength:{value:t,message:Wt.toString(r)}})}max(t,r){return new Gn({...this._def,maxLength:{value:t,message:Wt.toString(r)}})}length(t,r){return new Gn({...this._def,exactLength:{value:t,message:Wt.toString(r)}})}nonempty(t){return this.min(1,t)}};i(Gn,"ZodArray");Gn.create=(e,t)=>new Gn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xt.ZodArray,...Vt(t)});var f0;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(f0||(f0={}));var k7=i(e=>t=>new wr({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function Ru(e){if(e instanceof wr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=gi.create(Ru(n))}return new wr({...e._def,shape:()=>t})}else return e instanceof Gn?Gn.create(Ru(e.element)):e instanceof gi?gi.create(Ru(e.unwrap())):e instanceof $o?$o.create(Ru(e.unwrap())):e instanceof mi?mi.create(e.items.map(t=>Ru(t))):e}i(Ru,"deepPartialify");var wr=class extends Bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=k7(this._def),this.extend=k7(this._def)}_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)!==tt.object){let p=this._getOrReturnCtx(t);return vt(p,{code:Ke.invalid_type,expected:tt.object,received:p.parsedType}),kt}let{status:n,ctx:o}=this._processInputParams(t),{shape:s,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof ji&&this._def.unknownKeys==="strip"))for(let p in o.data)c.includes(p)||l.push(p);let h=[];for(let p of c){let m=s[p],y=o.data[p];h.push({key:{status:"valid",value:p},value:m._parse(new pi(o,y,o.path,p)),alwaysSet:p in o.data})}if(this._def.catchall instanceof ji){let p=this._def.unknownKeys;if(p==="passthrough")for(let m of l)h.push({key:{status:"valid",value:m},value:{status:"valid",value:o.data[m]}});else if(p==="strict")l.length>0&&(vt(o,{code:Ke.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 m of l){let y=o.data[m];h.push({key:{status:"valid",value:m},value:p._parse(new pi(o,y,o.path,m)),alwaysSet:m in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let p=[];for(let m of h){let y=await m.key;p.push({key:y,value:await m.value,alwaysSet:m.alwaysSet})}return p}).then(p=>Xr.mergeObjectSync(n,p)):Xr.mergeObjectSync(n,h)}get shape(){return this._def.shape()}strict(t){return Wt.errToObj,new wr({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var o,s,c,l;let h=(c=(s=(o=this._def).errorMap)===null||s===void 0?void 0:s.call(o,r,n).message)!==null&&c!==void 0?c:n.defaultError;return r.code==="unrecognized_keys"?{message:(l=Wt.errToObj(t).message)!==null&&l!==void 0?l:h}:{message:h}}}:{}})}strip(){return new wr({...this._def,unknownKeys:"strip"})}passthrough(){return new wr({...this._def,unknownKeys:"passthrough"})}setKey(t,r){return this.augment({[t]:r})}merge(t){return new wr({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>f0.mergeShapes(this._def.shape(),t._def.shape()),typeName:xt.ZodObject})}catchall(t){return new wr({...this._def,catchall:t})}pick(t){let r={};return rr.objectKeys(t).map(n=>{this.shape[n]&&(r[n]=this.shape[n])}),new wr({...this._def,shape:()=>r})}omit(t){let r={};return rr.objectKeys(this.shape).map(n=>{rr.objectKeys(t).indexOf(n)===-1&&(r[n]=this.shape[n])}),new wr({...this._def,shape:()=>r})}deepPartial(){return Ru(this)}partial(t){let r={};if(t)return rr.objectKeys(this.shape).map(n=>{rr.objectKeys(t).indexOf(n)===-1?r[n]=this.shape[n]:r[n]=this.shape[n].optional()}),new wr({...this._def,shape:()=>r});for(let n in this.shape){let o=this.shape[n];r[n]=o.optional()}return new wr({...this._def,shape:()=>r})}required(t){let r={};if(t)rr.objectKeys(this.shape).map(n=>{if(rr.objectKeys(t).indexOf(n)===-1)r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof gi;)s=s._def.innerType;r[n]=s}});else for(let n in this.shape){let s=this.shape[n];for(;s instanceof gi;)s=s._def.innerType;r[n]=s}return new wr({...this._def,shape:()=>r})}keyof(){return N7(rr.objectKeys(this.shape))}};i(wr,"ZodObject");wr.create=(e,t)=>new wr({shape:()=>e,unknownKeys:"strip",catchall:ji.create(),typeName:xt.ZodObject,...Vt(t)});wr.strictCreate=(e,t)=>new wr({shape:()=>e,unknownKeys:"strict",catchall:ji.create(),typeName:xt.ZodObject,...Vt(t)});wr.lazycreate=(e,t)=>new wr({shape:e,unknownKeys:"strip",catchall:ji.create(),typeName:xt.ZodObject,...Vt(t)});var rs=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(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 Ui(l.ctx.common.issues));return vt(r,{code:Ke.invalid_union,unionErrors:c}),kt}if(i(o,"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(o);{let s,c=[];for(let h of n){let p={...r,common:{...r.common,issues:[]},parent:null},m=h._parseSync({data:r.data,path:r.path,parent:p});if(m.status==="valid")return m;m.status==="dirty"&&!s&&(s={result:m,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(h=>new Ui(h));return vt(r,{code:Ke.invalid_union,unionErrors:l}),kt}}get options(){return this._def.options}};i(rs,"ZodUnion");rs.create=(e,t)=>new rs({options:e,typeName:xt.ZodUnion,...Vt(t)});var a0=i(e=>e instanceof os?a0(e.schema):e instanceof Wn?a0(e.innerType()):e instanceof as?[e.value]:e instanceof ss?e.options:e instanceof cs?Object.keys(e.enum):e instanceof us?a0(e._def.innerType):e instanceof es?[void 0]:e instanceof ts?[null]:null,"getDiscriminator"),uc=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.object)return vt(r,{code:Ke.invalid_type,expected:tt.object,received:r.parsedType}),kt;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);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}):(vt(r,{code:Ke.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),kt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let s of r){let c=a0(s.shape[t]);if(!c)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let l of c){if(o.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);o.set(l,s)}}return new uc({typeName:xt.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Vt(n)})}};i(uc,"ZodDiscriminatedUnion");function Dy(e,t){let r=Ya(e),n=Ya(t);if(e===t)return{valid:!0,data:e};if(r===tt.object&&n===tt.object){let o=rr.objectKeys(t),s=rr.objectKeys(e).filter(l=>o.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=Dy(e[l],t[l]);if(!h.valid)return{valid:!1};c[l]=h.data}return{valid:!0,data:c}}else if(r===tt.array&&n===tt.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=Dy(c,l);if(!h.valid)return{valid:!1};o.push(h.data)}return{valid:!0,data:o}}else return r===tt.date&&n===tt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Dy,"mergeValues");var ns=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=i((s,c)=>{if(Iy(s)||Iy(c))return kt;let l=Dy(s.value,c.value);return l.valid?((ky(s)||ky(c))&&r.dirty(),{status:r.value,value:l.data}):(vt(n,{code:Ke.invalid_intersection_types}),kt)},"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])=>o(s,c)):o(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(ns,"ZodIntersection");ns.create=(e,t,r)=>new ns({left:e,right:t,typeName:xt.ZodIntersection,...Vt(r)});var mi=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.array)return vt(n,{code:Ke.invalid_type,expected:tt.array,received:n.parsedType}),kt;if(n.data.length<this._def.items.length)return vt(n,{code:Ke.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),kt;!this._def.rest&&n.data.length>this._def.items.length&&(vt(n,{code:Ke.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=n.data.map((c,l)=>{let h=this._def.items[l]||this._def.rest;return h?h._parse(new pi(n,c,n.path,l)):null}).filter(c=>!!c);return n.common.async?Promise.all(s).then(c=>Xr.mergeArray(r,c)):Xr.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new mi({...this._def,rest:t})}};i(mi,"ZodTuple");mi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mi({items:e,typeName:xt.ZodTuple,rest:null,...Vt(t)})};var is=class extends Bt{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!==tt.object)return vt(n,{code:Ke.invalid_type,expected:tt.object,received:n.parsedType}),kt;let o=[],s=this._def.keyType,c=this._def.valueType;for(let l in n.data)o.push({key:s._parse(new pi(n,l,n.path,l)),value:c._parse(new pi(n,n.data[l],n.path,l))});return n.common.async?Xr.mergeObjectAsync(r,o):Xr.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Bt?new is({keyType:t,valueType:r,typeName:xt.ZodRecord,...Vt(n)}):new is({keyType:$i.create(),valueType:t,typeName:xt.ZodRecord,...Vt(r)})}};i(is,"ZodRecord");var lc=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.map)return vt(n,{code:Ke.invalid_type,expected:tt.map,received:n.parsedType}),kt;let o=this._def.keyType,s=this._def.valueType,c=[...n.data.entries()].map(([l,h],p)=>({key:o._parse(new pi(n,l,n.path,[p,"key"])),value:s._parse(new pi(n,h,n.path,[p,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let h of c){let p=await h.key,m=await h.value;if(p.status==="aborted"||m.status==="aborted")return kt;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),l.set(p.value,m.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let h of c){let p=h.key,m=h.value;if(p.status==="aborted"||m.status==="aborted")return kt;(p.status==="dirty"||m.status==="dirty")&&r.dirty(),l.set(p.value,m.value)}return{status:r.value,value:l}}}};i(lc,"ZodMap");lc.create=(e,t,r)=>new lc({valueType:t,keyType:e,typeName:xt.ZodMap,...Vt(r)});var Uo=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.set)return vt(n,{code:Ke.invalid_type,expected:tt.set,received:n.parsedType}),kt;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(vt(n,{code:Ke.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(vt(n,{code:Ke.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function c(h){let p=new Set;for(let m of h){if(m.status==="aborted")return kt;m.status==="dirty"&&r.dirty(),p.add(m.value)}return{status:r.value,value:p}}i(c,"finalizeSet");let l=[...n.data.values()].map((h,p)=>s._parse(new pi(n,h,n.path,p)));return n.common.async?Promise.all(l).then(h=>c(h)):c(l)}min(t,r){return new Uo({...this._def,minSize:{value:t,message:Wt.toString(r)}})}max(t,r){return new Uo({...this._def,maxSize:{value:t,message:Wt.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};i(Uo,"ZodSet");Uo.create=(e,t)=>new Uo({valueType:e,minSize:null,maxSize:null,typeName:xt.ZodSet,...Vt(t)});var ba=class extends Bt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.function)return vt(r,{code:Ke.invalid_type,expected:tt.function,received:r.parsedType}),kt;function n(l,h){return c0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,s0(),Ff].filter(p=>!!p),issueData:{code:Ke.invalid_arguments,argumentsError:h}})}i(n,"makeArgsIssue");function o(l,h){return c0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,s0(),Ff].filter(p=>!!p),issueData:{code:Ke.invalid_return_type,returnTypeError:h}})}i(o,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},c=r.data;return this._def.returns instanceof wa?Sn(async(...l)=>{let h=new Ui([]),p=await this._def.args.parseAsync(l,s).catch(b=>{throw h.addIssue(n(l,b)),h}),m=await c(...p);return await this._def.returns._def.type.parseAsync(m,s).catch(b=>{throw h.addIssue(o(m,b)),h})}):Sn((...l)=>{let h=this._def.args.safeParse(l,s);if(!h.success)throw new Ui([n(l,h.error)]);let p=c(...h.data),m=this._def.returns.safeParse(p,s);if(!m.success)throw new Ui([o(p,m.error)]);return m.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new ba({...this._def,args:mi.create(t).rest(Fo.create())})}returns(t){return new ba({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new ba({args:t||mi.create([]).rest(Fo.create()),returns:r||Fo.create(),typeName:xt.ZodFunction,...Vt(n)})}};i(ba,"ZodFunction");var os=class extends Bt{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(os,"ZodLazy");os.create=(e,t)=>new os({getter:e,typeName:xt.ZodLazy,...Vt(t)});var as=class extends Bt{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return vt(r,{code:Ke.invalid_literal,expected:this._def.value}),kt}return{status:"valid",value:t.data}}get value(){return this._def.value}};i(as,"ZodLiteral");as.create=(e,t)=>new as({value:e,typeName:xt.ZodLiteral,...Vt(t)});function N7(e,t){return new ss({values:e,typeName:xt.ZodEnum,...Vt(t)})}i(N7,"createZodEnum");var ss=class extends Bt{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return vt(r,{expected:rr.joinValues(n),received:r.parsedType,code:Ke.invalid_type}),kt}if(this._def.values.indexOf(t.data)===-1){let r=this._getOrReturnCtx(t),n=this._def.values;return vt(r,{received:r.data,code:Ke.invalid_enum_value,options:n}),kt}return Sn(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}};i(ss,"ZodEnum");ss.create=N7;var cs=class extends Bt{_parse(t){let r=rr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==tt.string&&n.parsedType!==tt.number){let o=rr.objectValues(r);return vt(n,{expected:rr.joinValues(o),received:n.parsedType,code:Ke.invalid_type}),kt}if(r.indexOf(t.data)===-1){let o=rr.objectValues(r);return vt(n,{received:n.data,code:Ke.invalid_enum_value,options:o}),kt}return Sn(t.data)}get enum(){return this._def.values}};i(cs,"ZodNativeEnum");cs.create=(e,t)=>new cs({values:e,typeName:xt.ZodNativeEnum,...Vt(t)});var wa=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.promise&&r.common.async===!1)return vt(r,{code:Ke.invalid_type,expected:tt.promise,received:r.parsedType}),kt;let n=r.parsedType===tt.promise?r.data:Promise.resolve(r.data);return Sn(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(wa,"ZodPromise");wa.create=(e,t)=>new wa({type:e,typeName:xt.ZodPromise,...Vt(t)});var Wn=class extends Bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null;if(o.type==="preprocess"){let c=o.transform(n.data);return n.common.async?Promise.resolve(c).then(l=>this._def.schema._parseAsync({data:l,path:n.path,parent:n})):this._def.schema._parseSync({data:c,path:n.path,parent:n})}let s={addIssue:c=>{vt(n,c),c.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="refinement"){let c=i(l=>{let h=o.refinement(l,s);if(n.common.async)return Promise.resolve(h);if(h 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"?kt:(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"?kt:(l.status==="dirty"&&r.dirty(),c(l.value).then(()=>({status:r.value,value:l.value}))))}if(o.type==="transform")if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!u0(c))return c;let l=o.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=>u0(c)?Promise.resolve(o.transform(c.value,s)).then(l=>({status:r.value,value:l})):c);rr.assertNever(o)}};i(Wn,"ZodEffects");Wn.create=(e,t,r)=>new Wn({schema:e,typeName:xt.ZodEffects,effect:t,...Vt(r)});Wn.createWithPreprocess=(e,t,r)=>new Wn({schema:t,effect:{type:"preprocess",transform:e},typeName:xt.ZodEffects,...Vt(r)});var gi=class extends Bt{_parse(t){return this._getType(t)===tt.undefined?Sn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(gi,"ZodOptional");gi.create=(e,t)=>new gi({innerType:e,typeName:xt.ZodOptional,...Vt(t)});var $o=class extends Bt{_parse(t){return this._getType(t)===tt.null?Sn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i($o,"ZodNullable");$o.create=(e,t)=>new $o({innerType:e,typeName:xt.ZodNullable,...Vt(t)});var us=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===tt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};i(us,"ZodDefault");us.create=(e,t)=>new us({innerType:e,typeName:xt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Vt(t)});var fc=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.innerType._parse({data:r.data,path:r.path,parent:r});return l0(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.defaultValue()})):{status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};i(fc,"ZodCatch");fc.create=(e,t)=>new fc({innerType:e,typeName:xt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Vt(t)});var dc=class extends Bt{_parse(t){if(this._getType(t)!==tt.nan){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.nan,received:n.parsedType}),kt}return{status:"valid",value:t.data}}};i(dc,"ZodNaN");dc.create=e=>new dc({typeName:xt.ZodNaN,...Vt(e)});var bF=Symbol("zod_brand"),Lf=class extends Bt{_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(Lf,"ZodBranded");var ls=class extends Bt{_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"?kt:s.status==="dirty"?(r.dirty(),O7(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?kt:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new ls({in:t,out:r,typeName:xt.ZodPipeline})}};i(ls,"ZodPipeline");var B7=i((e,t={},r)=>e?ya.create().superRefine((n,o)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...c,fatal:r})}}):ya.create(),"custom"),wF={object:wr.lazycreate},xt;(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"})(xt||(xt={}));var _F=i((e,t={message:`Input not instance of ${e.name}`})=>B7(r=>r instanceof e,t,!0),"instanceOfType"),P7=$i.create,L7=io.create,EF=dc.create,AF=Xa.create,F7=Qa.create,SF=Lo.create,xF=sc.create,TF=es.create,CF=ts.create,MF=ya.create,IF=Fo.create,kF=ji.create,DF=cc.create,RF=Gn.create,OF=wr.create,NF=wr.strictCreate,BF=rs.create,PF=uc.create,LF=ns.create,FF=mi.create,UF=is.create,$F=lc.create,jF=Uo.create,zF=ba.create,HF=os.create,qF=as.create,VF=ss.create,KF=cs.create,GF=wa.create,D7=Wn.create,WF=gi.create,JF=$o.create,ZF=Wn.createWithPreprocess,YF=ls.create,XF=i(()=>P7().optional(),"ostring"),QF=i(()=>L7().optional(),"onumber"),eU=i(()=>F7().optional(),"oboolean"),tU={string:e=>$i.create({...e,coerce:!0}),number:e=>io.create({...e,coerce:!0}),boolean:e=>Qa.create({...e,coerce:!0}),bigint:e=>Xa.create({...e,coerce:!0}),date:e=>Lo.create({...e,coerce:!0})},rU=kt,K=Object.freeze({__proto__:null,defaultErrorMap:Ff,setErrorMap:dF,getErrorMap:s0,makeIssue:c0,EMPTY_PATH:hF,addIssueToContext:vt,ParseStatus:Xr,INVALID:kt,DIRTY:O7,OK:Sn,isAborted:Iy,isDirty:ky,isValid:u0,isAsync:l0,get util(){return rr},ZodParsedType:tt,getParsedType:Ya,ZodType:Bt,ZodString:$i,ZodNumber:io,ZodBigInt:Xa,ZodBoolean:Qa,ZodDate:Lo,ZodSymbol:sc,ZodUndefined:es,ZodNull:ts,ZodAny:ya,ZodUnknown:Fo,ZodNever:ji,ZodVoid:cc,ZodArray:Gn,get objectUtil(){return f0},ZodObject:wr,ZodUnion:rs,ZodDiscriminatedUnion:uc,ZodIntersection:ns,ZodTuple:mi,ZodRecord:is,ZodMap:lc,ZodSet:Uo,ZodFunction:ba,ZodLazy:os,ZodLiteral:as,ZodEnum:ss,ZodNativeEnum:cs,ZodPromise:wa,ZodEffects:Wn,ZodTransformer:Wn,ZodOptional:gi,ZodNullable:$o,ZodDefault:us,ZodCatch:fc,ZodNaN:dc,BRAND:bF,ZodBranded:Lf,ZodPipeline:ls,custom:B7,Schema:Bt,ZodSchema:Bt,late:wF,get ZodFirstPartyTypeKind(){return xt},coerce:tU,any:MF,array:RF,bigint:AF,boolean:F7,date:SF,discriminatedUnion:PF,effect:D7,enum:VF,function:zF,instanceof:_F,intersection:LF,lazy:HF,literal:qF,map:$F,nan:EF,nativeEnum:KF,never:kF,null:CF,nullable:JF,number:L7,object:OF,oboolean:eU,onumber:QF,optional:WF,ostring:XF,pipeline:YF,preprocess:ZF,promise:GF,record:UF,set:jF,strictObject:NF,string:P7,symbol:xF,transformer:D7,tuple:FF,undefined:TF,union:BF,unknown:IF,void:DF,NEVER:rU,ZodIssueCode:Ke,quotelessJson:fF,ZodError:Ui});var nU=Object.defineProperty,iU=i((e,t)=>nU(e,"name",{value:t,configurable:!0}),"__name"),p0=K.array(K.string().or(K.record(K.any()))),bZ=K.object({type:K.string().optional(),narrative:K.string().optional()}),m0=K.string().or(K.object({id:K.string(),type:K.string(),caption:K.string().optional()})),oU=K.object({type:K.string().min(1).or(K.string().array().nonempty()),latitude:K.number(),longitude:K.number()}),aU=K.object({type:K.string().min(1).or(K.string().array().nonempty()),addressCountry:K.string().optional(),addressCountryCode:K.string().optional(),addressRegion:K.string().optional(),addressLocality:K.string().optional(),streetAddress:K.string().optional(),postOfficeBoxNumber:K.string().optional(),postalCode:K.string().optional(),geo:oU.optional()}),sU=K.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(K.string()),j7=K.object({type:K.string().min(1).or(K.string().array().nonempty()),identifier:K.string(),identifierType:sU}),Uf=K.string().or(K.object({id:K.string().optional(),type:K.string().or(K.string().array().nonempty().optional()),name:K.string().optional(),url:K.string().optional(),phone:K.string().optional(),description:K.string().optional(),endorsement:K.any().array().optional(),image:m0.optional(),email:K.string().email().optional(),address:aU.optional(),otherIdentifier:j7.array().optional(),official:K.string().optional(),parentOrg:K.any().optional(),familyName:K.string().optional(),givenName:K.string().optional(),additionalName:K.string().optional(),patronymicName:K.string().optional(),honorificPrefix:K.string().optional(),honorificSuffix:K.string().optional(),familyNamePrefix:K.string().optional(),dateOfBirth:K.string().optional()}).catchall(K.any())),Ry=K.object({id:K.string().optional()}).catchall(K.any()),cU=K.object({type:K.string(),id:K.string()}).catchall(K.any()),uU=K.object({id:K.string(),type:K.string()}).catchall(K.any()),lU=K.object({id:K.string(),type:K.string()}).catchall(K.any()),d0=K.object({"@context":p0,id:K.string().optional(),type:K.string().array().nonempty(),issuer:Uf,issuanceDate:K.string(),expirationDate:K.string().optional(),credentialSubject:Ry.or(Ry.array()),credentialStatus:cU.optional(),credentialSchema:uU.array().optional(),refreshService:lU.optional()}).catchall(K.any()),jo=K.object({type:K.string(),created:K.string(),challenge:K.string().optional(),domain:K.string().optional(),nonce:K.string().optional(),proofPurpose:K.string(),verificationMethod:K.string(),jws:K.string().optional()}).catchall(K.any()),h0=d0.extend({proof:jo.or(jo.array())}),fU=K.object({"@context":p0,id:K.string().optional(),type:K.string().or(K.string().array().nonempty()),verifiableCredential:h0.or(h0.array()).optional(),holder:K.string().optional()}).catchall(K.any()),wZ=fU.extend({proof:jo.or(jo.array())}),z7=K.object({kty:K.string(),crv:K.string(),x:K.string(),y:K.string().optional(),n:K.string().optional(),d:K.string()}),dU=K.object({alg:K.string(),iv:K.string(),tag:K.string(),epk:z7.partial().optional(),kid:K.string().optional(),apv:K.string().optional(),apu:K.string().optional()}),hU=K.object({header:dU,encrypted_key:K.string()}),pU=K.object({protected:K.string(),iv:K.string(),ciphertext:K.string(),tag:K.string(),aad:K.string().optional(),recipients:hU.array().optional()}),hc=K.string().or(K.object({"@context":p0.optional(),id:K.string(),type:K.string(),controller:K.string(),publicKeyJwk:z7.optional(),publicKeyBase58:K.string().optional(),blockChainAccountId:K.string().optional()}).catchall(K.any())),mU=K.object({id:K.string(),type:K.string().or(K.string().array().nonempty()),serviceEndpoint:K.any().or(K.any().array().nonempty())}).catchall(K.any()),AZ=K.object({"@context":p0,id:K.string(),alsoKnownAs:K.string().optional(),controller:K.string().or(K.string().array().nonempty()).optional(),verificationMethod:hc.array().optional(),authentication:hc.array().optional(),assertionMethod:hc.array().optional(),keyAgreement:hc.array().optional(),capabilityInvocation:hc.array().optional(),capabilityDelegation:hc.array().optional(),publicKey:hc.array().optional(),service:mU.array().optional(),proof:jo.or(jo.array()).optional()}).catchall(K.any()),gU=K.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(K.string()),g0=K.object({type:K.string().array().nonempty(),targetCode:K.string().optional(),targetDescription:K.string().optional(),targetName:K.string(),targetFramework:K.string().optional(),targetType:gU.optional(),targetUrl:K.string()}),vU=K.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"]),yU=vU.or(K.string()),bU=K.object({id:K.string().optional(),narrative:K.string().optional()}).catchall(K.any()),wU=K.object({id:K.string(),type:K.string().array().nonempty(),endorsementComment:K.string().optional()}),_U=d0.extend({credentialSubject:wU,proof:jo.or(jo.array()).optional()}),EU=K.object({id:K.string(),"@language":K.string().optional(),version:K.string().optional()}),AU=K.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(K.string()),SU=K.object({id:K.string(),type:K.string().array().nonempty(),alignment:g0.array().optional(),description:K.string().optional(),level:K.string().optional(),name:K.string(),points:K.string().optional()}).catchall(K.any()),xU=K.object({id:K.string(),type:K.string().array().nonempty(),alignment:g0.array().optional(),allowedValue:K.string().array().optional(),name:K.string(),requiredLevel:K.string().optional(),requiredValue:K.string().optional(),resultType:AU,rubricCriterionLevel:SU.array().optional(),valueMax:K.string().optional(),valueMin:K.string().optional()}).catchall(K.any()),TU=K.object({id:K.string().optional(),type:K.string().array().nonempty(),alignment:g0.array().optional(),achievementType:yU.optional(),creator:Uf.optional(),creditsAvailable:K.number().optional(),criteria:bU,description:K.string(),endorsement:_U.array().optional(),fieldOfStudy:K.string().optional(),humanCode:K.string().optional(),image:m0.optional(),"@language":K.string().optional(),name:K.string(),otherIdentifier:j7.array().optional(),related:EU.array().optional(),resultDescription:xU.array().optional(),specialization:K.string().optional(),tag:K.string().array().optional(),version:K.string().optional()}).catchall(K.any()),CU=K.object({type:K.string(),hashed:K.boolean(),identityHash:K.string(),identityType:K.string(),salt:K.string().optional()}),MU=K.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),IU=K.object({type:K.string().array().nonempty(),achievedLevel:K.string().optional(),alignment:g0.array().optional(),resultDescription:K.string().optional(),status:MU.optional(),value:K.string().optional()}).catchall(K.any()),U7=K.object({id:K.string().optional(),type:K.string().array().nonempty(),activityEndDate:K.string().optional(),activityStartDate:K.string().optional(),creditsEarned:K.number().optional(),achievement:TU.optional(),identifier:CU.array().optional(),image:m0.optional(),licenseNumber:K.string().optional(),narrative:K.string().optional(),result:IU.array().optional(),role:K.string().optional(),source:Uf.optional(),term:K.string().optional()}).catchall(K.any()),kU=K.object({id:K.string().optional(),type:K.string().array().nonempty(),narrative:K.string().optional(),name:K.string().optional(),description:K.string().optional(),genre:K.string().optional(),audience:K.string().optional()}).catchall(K.any()),DU=d0.extend({name:K.string().optional(),description:K.string().optional(),image:m0.optional(),credentialSubject:U7.or(U7.array()),endorsement:d0.array().optional(),evidence:kU.array().optional()}),xZ=DU.extend({proof:jo.or(jo.array())}),CZ=K.object({checks:K.string().array(),warnings:K.string().array(),errors:K.string().array()}),H7=K.enum(["Success","Failed","Error"]),MZ=H7.enum,IZ=K.object({check:K.string(),status:H7,message:K.string().optional(),details:K.string().optional()}),kZ=K.object({title:K.string().optional(),createdAt:K.string().optional(),issuer:Uf.optional(),issuee:Uf.optional(),credentialSubject:Ry.optional()}),mc=K.object({id:K.string(),uri:K.string()}).catchall(K.any()),OZ=K.object({limit:K.number(),cursor:K.string().optional(),sort:K.string().optional()}),oo=K.object({cursor:K.string().optional(),hasMore:K.boolean()}),q7=K.object({encryptedRecord:pU,fields:K.string().array()}).catchall(K.any()),NZ=oo.extend({records:q7.array()}),RU=q7.extend({id:K.string()}),BZ=oo.extend({records:RU.array()}),$7=iU(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),OU=K.instanceof(RegExp).or(K.string().refine(e=>{try{return $7(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=$7(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),cn=K.string().or(K.object({$in:K.string().array()})).or(K.object({$regex:OU})),NU=K.object({backgroundColor:K.string().optional(),backgroundImage:K.string().optional(),fadeBackgroundImage:K.boolean().optional(),repeatBackgroundImage:K.boolean().optional(),fontColor:K.string().optional(),accentColor:K.string().optional(),accentFontColor:K.string().optional(),idBackgroundImage:K.string().optional(),fadeIdBackgroundImage:K.boolean().optional(),idBackgroundColor:K.string().optional(),repeatIdBackgroundImage:K.boolean().optional()}),pc=K.object({profileId:K.string().min(3).max(40),displayName:K.string().default(""),shortBio:K.string().default(""),bio:K.string().default(""),did:K.string(),email:K.string().optional(),image:K.string().optional(),heroImage:K.string().optional(),websiteLink:K.string().optional(),isServiceProfile:K.boolean().default(!1).optional(),type:K.string().optional(),notificationsWebhook:K.string().url().startsWith("http").optional(),display:NU.optional()}),FZ=K.object({profileId:cn,displayName:cn,shortBio:cn,bio:cn,email:cn,websiteLink:cn,isServiceProfile:K.boolean(),type:cn}).partial(),UZ=oo.extend({records:pc.array()}),$Z=K.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),V7=K.object({id:K.string(),created:K.string(),displayName:K.string().default("").optional(),shortBio:K.string().default("").optional(),bio:K.string().default("").optional(),email:K.string().optional(),image:K.string().optional(),heroImage:K.string().optional()}),jZ=oo.extend({records:V7.extend({did:K.string()}).array()}),zZ=K.object({id:cn,displayName:cn,shortBio:cn,bio:cn,email:cn}).partial(),HZ=oo.extend({records:K.object({profile:pc,manager:V7.extend({did:K.string()}).optional()}).array()}),qZ=K.object({uri:K.string(),to:K.string(),from:K.string(),sent:K.string().datetime(),received:K.string().datetime().optional()}),BU=K.object({role:K.string(),canEdit:K.boolean(),canIssue:K.boolean(),canRevoke:K.boolean(),canManagePermissions:K.boolean(),canIssueChildren:K.string(),canCreateChildren:K.string(),canEditChildren:K.string(),canRevokeChildren:K.string(),canManageChildrenPermissions:K.string(),canManageChildrenProfiles:K.boolean().default(!1).optional(),canViewAnalytics:K.boolean()}),Oy=K.enum(["DRAFT","LIVE"]),PU=K.object({uri:K.string(),name:K.string().optional(),type:K.string().optional(),category:K.string().optional(),status:Oy.optional(),autoConnectRecipients:K.boolean().optional(),meta:K.record(K.any()).optional(),claimPermissions:BU.optional()}),VZ=K.object({uri:cn,name:cn,type:cn,category:cn,meta:K.record(cn),status:Oy.or(K.object({$in:Oy.array()})),autoConnectRecipients:K.boolean()}).partial(),KZ=oo.extend({records:PU.array()}),LU=K.object({to:pc,from:K.string(),received:K.string().optional(),uri:K.string().optional()}),GZ=oo.extend({records:LU.array()}),WZ=K.object({endpoint:K.string(),name:K.string(),did:K.string().optional()}),JZ=K.object({ttlSeconds:K.number().optional(),totalUses:K.number().optional()}),FU=K.object({endpoint:K.string()}),ZZ=K.object({signingAuthority:FU,relationship:K.object({name:K.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:K.string()})}),UU=K.enum(["live","stale","withdrawn"]),$U=K.object({read:K.object({anonymize:K.boolean().optional(),credentials:K.object({categories:K.record(K.object({required:K.boolean()})).default({})}).default({}),personal:K.record(K.object({required:K.boolean()})).default({})}).default({}),write:K.object({credentials:K.object({categories:K.record(K.object({required:K.boolean()})).default({})}).default({}),personal:K.record(K.object({required:K.boolean()})).default({})}).default({})}),K7=K.object({contract:$U,owner:pc,name:K.string(),subtitle:K.string().optional(),description:K.string().optional(),reasonForAccessing:K.string().optional(),image:K.string().optional(),uri:K.string(),needsGuardianConsent:K.boolean().optional(),createdAt:K.string(),updatedAt:K.string(),expiresAt:K.string().optional()}),YZ=oo.extend({records:K7.omit({owner:!0}).array()}),jU=K.object({credentials:K.object({categories:K.record(K.string().array()).default({})}),personal:K.record(K.string()).default({}),date:K.string()}),XZ=oo.extend({records:jU.array()}),G7=K.object({sharing:K.boolean().optional(),shared:K.string().array().optional(),shareAll:K.boolean().optional(),shareUntil:K.string().optional()}),W7=K.object({read:K.object({anonymize:K.boolean().optional(),credentials:K.object({shareAll:K.boolean().optional(),sharing:K.boolean().optional(),categories:K.record(G7).default({})}).default({}),personal:K.record(K.string()).default({})}).default({}),write:K.object({credentials:K.object({categories:K.record(K.boolean()).default({})}).default({}),personal:K.record(K.boolean()).default({})}).default({})}),QZ=oo.extend({records:K.object({expiresAt:K.string().optional(),oneTime:K.boolean().optional(),terms:W7,contract:K7,uri:K.string(),consenter:pc,status:UU}).array()}),eY=K.object({read:K.object({anonymize:K.boolean().optional(),credentials:K.object({categories:K.record(K.object({required:K.boolean().optional()})).optional()}).optional(),personal:K.record(K.object({required:K.boolean().optional()})).optional()}).optional(),write:K.object({credentials:K.object({categories:K.record(K.object({required:K.boolean().optional()})).optional()}).optional(),personal:K.record(K.object({required:K.boolean().optional()})).optional()}).optional()}),tY=K.object({anonymize:K.boolean().optional(),credentials:K.object({categories:K.record(K.boolean()).optional()}).optional(),personal:K.record(K.boolean()).optional()}),zU=K.object({read:K.object({anonymize:K.boolean().optional(),credentials:K.object({shareAll:K.boolean().optional(),sharing:K.boolean().optional(),categories:K.record(G7.optional()).optional()}).optional(),personal:K.record(K.string()).optional()}).optional(),write:K.object({credentials:K.object({categories:K.record(K.boolean()).optional()}).optional(),personal:K.record(K.boolean()).optional()}).optional()}),Ny=K.enum(["consent","update","sync","withdraw"]),rY=K.object({terms:zU.optional(),action:Ny.or(Ny.array()).optional(),date:K.object({$gt:K.string()}).or(K.object({$lt:K.string()})).or(K.object({$eq:K.string()})).optional(),expiresAt:K.object({$gt:K.string()}).or(K.object({$lt:K.string()})).or(K.object({$eq:K.string()})).optional(),oneTime:K.boolean().optional()}),J7=K.object({expiresAt:K.string().optional(),oneTime:K.boolean().optional(),terms:W7.optional(),id:K.string(),action:Ny,date:K.string()}),nY=oo.extend({records:J7.array()}),HU=K.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),qU=K.object({title:K.string().optional(),body:K.string().optional()}),VU=K.object({vcUris:K.array(K.string()).optional(),vpUris:K.array(K.string()).optional(),transaction:J7.optional()}),iY=K.object({type:HU,to:pc.partial().and(K.object({did:K.string()})),from:pc.partial().and(K.object({did:K.string()})),message:qU.optional(),data:VU.optional(),sent:K.string().datetime().optional()});var KU=Object.create,yd=Object.defineProperty,GU=Object.getOwnPropertyDescriptor,s6=Object.getOwnPropertyNames,WU=Object.getPrototypeOf,JU=Object.prototype.hasOwnProperty,a=i((e,t)=>yd(e,"name",{value:t,configurable:!0}),"__name"),cb=(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')}),pr=i((e,t)=>i(function(){return e&&(t=(0,e[s6(e)[0]])(e=0)),t},"__init"),"__esm"),ze=i((e,t)=>i(function(){return t||(0,e[s6(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require2"),"__commonJS"),Ar=i((e,t)=>{for(var r in t)yd(e,r,{get:t[r],enumerable:!0})},"__export"),hS=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of s6(t))!JU.call(e,o)&&o!==r&&yd(e,o,{get:()=>t[o],enumerable:!(n=GU(t,o))||n.enumerable});return e},"__copyProps"),ir=i((e,t,r)=>(r=e!=null?KU(WU(e)):{},hS(t||!e||!e.__esModule?yd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),By=i(e=>hS(yd({},"__esModule",{value:!0}),e),"__toCommonJS"),ZU=ze({"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(e,t){(function(){var r,n="4.17.21",o=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",p=500,m="__lodash_placeholder__",y=1,b=2,_=4,x=1,D=2,O=1,B=2,Z=4,$=8,z=16,Q=32,Y=64,k=128,q=256,he=512,me=30,we="...",J=800,w=16,T=1,g=2,f=3,v=1/0,E=9007199254740991,R=17976931348623157e292,C=0/0,A=4294967295,P=A-1,H=A>>>1,I=[["ary",k],["bind",O],["bindKey",B],["curry",$],["curryRight",z],["flip",he],["partial",Q],["partialRight",Y],["rearg",q]],F="[object Arguments]",ge="[object Array]",L="[object AsyncFunction]",ne="[object Boolean]",ae="[object Date]",M="[object DOMException]",V="[object Error]",oe="[object Function]",fe="[object GeneratorFunction]",be="[object Map]",Re="[object Number]",X="[object Null]",N="[object Object]",U="[object Promise]",W="[object Proxy]",ie="[object RegExp]",ee="[object Set]",ue="[object String]",Ae="[object Symbol]",De="[object Undefined]",Ie="[object WeakMap]",Pe="[object WeakSet]",qe="[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]",Ct="[object Uint16Array]",Ve="[object Uint32Array]",He=/\b__p \+= '';/g,Rt=/\b(__p \+=) '' \+/g,dt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,Dr=/[&<>"']/g,ct=RegExp(mt.source),ut=RegExp(Dr.source),lr=/<%-([\s\S]+?)%>/g,lt=/<%([\s\S]+?)%>/g,nt=/<%=([\s\S]+?)%>/g,ar=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,it=/^\w*$/,Xe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qt=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(Qt.source),et=/^\s+/,sr=/\s/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ze=/\{\n\/\* \[wrapped with (.+)\] \*/,cr=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Et=/[()=,{}\[\]\/\s]/,Tn=/\\(\\)?/g,At=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yt=/\w*$/,hn=/^[-+]0x[0-9a-f]+$/i,er=/^0b[01]+$/i,tr=/^\[object .+?Constructor\]$/,tn=/^0o[0-7]+$/i,rn=/^(?:0|[1-9]\d*)$/,Rr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Hr=/($^)/,nn=/['\n\r\u2028\u2029\\]/g,Cn="\\ud800-\\udfff",xi="\\u0300-\\u036f",Ti="\\ufe20-\\ufe2f",Ci="\\u20d0-\\u20ff",Ln=xi+Ti+Ci,pn="\\u2700-\\u27bf",ei="a-z\\xdf-\\xf6\\xf8-\\xff",Fn="\\xac\\xb1\\xd7\\xf7",Mi="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ii="\\u2000-\\u206f",ki=" \\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",ea="A-Z\\xc0-\\xd6\\xd8-\\xde",ta="\\ufe0e\\ufe0f",ra=Fn+Mi+Ii+ki,Ba="['\u2019]",Nd="["+Cn+"]",wl="["+ra+"]",ks="["+Ln+"]",_l="\\d+",Bd="["+pn+"]",El="["+ei+"]",Al="[^"+Cn+ra+_l+pn+ei+ea+"]",Ds="\\ud83c[\\udffb-\\udfff]",Pd="(?:"+ks+"|"+Ds+")",Sl="[^"+Cn+"]",na="(?:\\ud83c[\\udde6-\\uddff]){2}",Wi="[\\ud800-\\udbff][\\udc00-\\udfff]",ia="["+ea+"]",wo="\\u200d",xl="(?:"+El+"|"+Al+")",Ld="(?:"+ia+"|"+Al+")",Tl="(?:"+Ba+"(?:d|ll|m|re|s|t|ve))?",Cl="(?:"+Ba+"(?:D|LL|M|RE|S|T|VE))?",Ml=Pd+"?",Il="["+ta+"]?",kl="(?:"+wo+"(?:"+[Sl,na,Wi].join("|")+")"+Il+Ml+")*",_o="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fd="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Hc=Il+Ml+kl,Ud="(?:"+[Bd,na,Wi].join("|")+")"+Hc,Dl="(?:"+[Sl+ks+"?",ks,na,Wi,Nd].join("|")+")",Rl=RegExp(Ba,"g"),$d=RegExp(ks,"g"),Ol=RegExp(Ds+"(?="+Ds+")|"+Dl+Hc,"g"),Nl=RegExp([ia+"?"+El+"+"+Tl+"(?="+[wl,ia,"$"].join("|")+")",Ld+"+"+Cl+"(?="+[wl,ia+xl,"$"].join("|")+")",ia+"?"+xl+"+"+Tl,ia+"+"+Cl,Fd,_o,_l,Ud].join("|"),"g"),jd=RegExp("["+wo+Cn+Ln+ta+"]"),Rs=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,zd=["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"],qc=-1,yr={};yr[pe]=yr[re]=yr[le]=yr[_e]=yr[Te]=yr[Ce]=yr[Oe]=yr[Ct]=yr[Ve]=!0,yr[F]=yr[ge]=yr[qe]=yr[ne]=yr[ve]=yr[ae]=yr[V]=yr[oe]=yr[be]=yr[Re]=yr[N]=yr[ie]=yr[ee]=yr[ue]=yr[Ie]=!1;var mr={};mr[F]=mr[ge]=mr[qe]=mr[ve]=mr[ne]=mr[ae]=mr[pe]=mr[re]=mr[le]=mr[_e]=mr[Te]=mr[be]=mr[Re]=mr[N]=mr[ie]=mr[ee]=mr[ue]=mr[Ae]=mr[Ce]=mr[Oe]=mr[Ct]=mr[Ve]=!0,mr[V]=mr[oe]=mr[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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Le={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},qr=parseFloat,on=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,mn=typeof self=="object"&&self&&self.Object===Object&&self,Lr=Mn||mn||Function("return this")(),Eo=typeof e=="object"&&e&&!e.nodeType&&e,Ao=Eo&&typeof t=="object"&&t&&!t.nodeType&&t,Bl=Ao&&Ao.exports===Eo,Vc=Bl&&Mn.process,gn=function(){try{var Se=Ao&&Ao.require&&Ao.require("util").types;return Se||Vc&&Vc.binding&&Vc.binding("util")}catch{}}(),Os=gn&&gn.isArrayBuffer,j2=gn&&gn.isDate,z2=gn&&gn.isMap,H2=gn&&gn.isRegExp,q2=gn&&gn.isSet,V2=gn&&gn.isTypedArray;function Un(Se,Be,ke){switch(ke.length){case 0:return Se.call(Be);case 1:return Se.call(Be,ke[0]);case 2:return Se.call(Be,ke[0],ke[1]);case 3:return Se.call(Be,ke[0],ke[1],ke[2])}return Se.apply(Be,ke)}i(Un,"apply"),a(Un,"apply");function K2(Se,Be,ke,ft){for(var It=-1,fr=Se==null?0:Se.length;++It<fr;){var Kr=Se[It];Be(ft,Kr,ke(Kr),Se)}return ft}i(K2,"arrayAggregator"),a(K2,"arrayAggregator");function ti(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft&&Be(Se[ke],ke,Se)!==!1;);return Se}i(ti,"arrayEach"),a(ti,"arrayEach");function G2(Se,Be){for(var ke=Se==null?0:Se.length;ke--&&Be(Se[ke],ke,Se)!==!1;);return Se}i(G2,"arrayEachRight"),a(G2,"arrayEachRight");function r1(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft;)if(!Be(Se[ke],ke,Se))return!1;return!0}i(r1,"arrayEvery"),a(r1,"arrayEvery");function oa(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length,It=0,fr=[];++ke<ft;){var Kr=Se[ke];Be(Kr,ke,Se)&&(fr[It++]=Kr)}return fr}i(oa,"arrayFilter"),a(oa,"arrayFilter");function Pl(Se,Be){var ke=Se==null?0:Se.length;return!!ke&&Ns(Se,Be,0)>-1}i(Pl,"arrayIncludes"),a(Pl,"arrayIncludes");function Hd(Se,Be,ke){for(var ft=-1,It=Se==null?0:Se.length;++ft<It;)if(ke(Be,Se[ft]))return!0;return!1}i(Hd,"arrayIncludesWith"),a(Hd,"arrayIncludesWith");function Tr(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length,It=Array(ft);++ke<ft;)It[ke]=Be(Se[ke],ke,Se);return It}i(Tr,"arrayMap"),a(Tr,"arrayMap");function aa(Se,Be){for(var ke=-1,ft=Be.length,It=Se.length;++ke<ft;)Se[It+ke]=Be[ke];return Se}i(aa,"arrayPush"),a(aa,"arrayPush");function qd(Se,Be,ke,ft){var It=-1,fr=Se==null?0:Se.length;for(ft&&fr&&(ke=Se[++It]);++It<fr;)ke=Be(ke,Se[It],It,Se);return ke}i(qd,"arrayReduce"),a(qd,"arrayReduce");function W2(Se,Be,ke,ft){var It=Se==null?0:Se.length;for(ft&&It&&(ke=Se[--It]);It--;)ke=Be(ke,Se[It],It,Se);return ke}i(W2,"arrayReduceRight"),a(W2,"arrayReduceRight");function Vd(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft;)if(Be(Se[ke],ke,Se))return!0;return!1}i(Vd,"arraySome"),a(Vd,"arraySome");var Jk=Kd("length");function J2(Se){return Se.split("")}i(J2,"asciiToArray"),a(J2,"asciiToArray");function Z2(Se){return Se.match(st)||[]}i(Z2,"asciiWords"),a(Z2,"asciiWords");function n1(Se,Be,ke){var ft;return ke(Se,function(It,fr,Kr){if(Be(It,fr,Kr))return ft=fr,!1}),ft}i(n1,"baseFindKey"),a(n1,"baseFindKey");function Ll(Se,Be,ke,ft){for(var It=Se.length,fr=ke+(ft?1:-1);ft?fr--:++fr<It;)if(Be(Se[fr],fr,Se))return fr;return-1}i(Ll,"baseFindIndex"),a(Ll,"baseFindIndex");function Ns(Se,Be,ke){return Be===Be?a3(Se,Be,ke):Ll(Se,i1,ke)}i(Ns,"baseIndexOf"),a(Ns,"baseIndexOf");function Y2(Se,Be,ke,ft){for(var It=ke-1,fr=Se.length;++It<fr;)if(ft(Se[It],Be))return It;return-1}i(Y2,"baseIndexOfWith"),a(Y2,"baseIndexOfWith");function i1(Se){return Se!==Se}i(i1,"baseIsNaN"),a(i1,"baseIsNaN");function o1(Se,Be){var ke=Se==null?0:Se.length;return ke?Wd(Se,Be)/ke:C}i(o1,"baseMean"),a(o1,"baseMean");function Kd(Se){return function(Be){return Be==null?r:Be[Se]}}i(Kd,"baseProperty"),a(Kd,"baseProperty");function Gd(Se){return function(Be){return Se==null?r:Se[Be]}}i(Gd,"basePropertyOf"),a(Gd,"basePropertyOf");function a1(Se,Be,ke,ft,It){return It(Se,function(fr,Kr,br){ke=ft?(ft=!1,fr):Be(ke,fr,Kr,br)}),ke}i(a1,"baseReduce"),a(a1,"baseReduce");function X2(Se,Be){var ke=Se.length;for(Se.sort(Be);ke--;)Se[ke]=Se[ke].value;return Se}i(X2,"baseSortBy"),a(X2,"baseSortBy");function Wd(Se,Be){for(var ke,ft=-1,It=Se.length;++ft<It;){var fr=Be(Se[ft]);fr!==r&&(ke=ke===r?fr:ke+fr)}return ke}i(Wd,"baseSum"),a(Wd,"baseSum");function Jd(Se,Be){for(var ke=-1,ft=Array(Se);++ke<Se;)ft[ke]=Be(ke);return ft}i(Jd,"baseTimes"),a(Jd,"baseTimes");function Q2(Se,Be){return Tr(Be,function(ke){return[ke,Se[ke]]})}i(Q2,"baseToPairs"),a(Q2,"baseToPairs");function s1(Se){return Se&&Se.slice(0,f1(Se)+1).replace(et,"")}i(s1,"baseTrim"),a(s1,"baseTrim");function $n(Se){return function(Be){return Se(Be)}}i($n,"baseUnary"),a($n,"baseUnary");function Zd(Se,Be){return Tr(Be,function(ke){return Se[ke]})}i(Zd,"baseValues"),a(Zd,"baseValues");function Kc(Se,Be){return Se.has(Be)}i(Kc,"cacheHas"),a(Kc,"cacheHas");function c1(Se,Be){for(var ke=-1,ft=Se.length;++ke<ft&&Ns(Be,Se[ke],0)>-1;);return ke}i(c1,"charsStartIndex"),a(c1,"charsStartIndex");function u1(Se,Be){for(var ke=Se.length;ke--&&Ns(Be,Se[ke],0)>-1;);return ke}i(u1,"charsEndIndex"),a(u1,"charsEndIndex");function e3(Se,Be){for(var ke=Se.length,ft=0;ke--;)Se[ke]===Be&&++ft;return ft}i(e3,"countHolders"),a(e3,"countHolders");var Zk=Gd(de),Yk=Gd(Me);function t3(Se){return"\\"+ht[Se]}i(t3,"escapeStringChar"),a(t3,"escapeStringChar");function r3(Se,Be){return Se==null?r:Se[Be]}i(r3,"getValue"),a(r3,"getValue");function Bs(Se){return jd.test(Se)}i(Bs,"hasUnicode"),a(Bs,"hasUnicode");function n3(Se){return Rs.test(Se)}i(n3,"hasUnicodeWord"),a(n3,"hasUnicodeWord");function i3(Se){for(var Be,ke=[];!(Be=Se.next()).done;)ke.push(Be.value);return ke}i(i3,"iteratorToArray"),a(i3,"iteratorToArray");function Yd(Se){var Be=-1,ke=Array(Se.size);return Se.forEach(function(ft,It){ke[++Be]=[It,ft]}),ke}i(Yd,"mapToArray"),a(Yd,"mapToArray");function l1(Se,Be){return function(ke){return Se(Be(ke))}}i(l1,"overArg"),a(l1,"overArg");function sa(Se,Be){for(var ke=-1,ft=Se.length,It=0,fr=[];++ke<ft;){var Kr=Se[ke];(Kr===Be||Kr===m)&&(Se[ke]=m,fr[It++]=ke)}return fr}i(sa,"replaceHolders"),a(sa,"replaceHolders");function Fl(Se){var Be=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Be]=ft}),ke}i(Fl,"setToArray"),a(Fl,"setToArray");function o3(Se){var Be=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Be]=[ft,ft]}),ke}i(o3,"setToPairs"),a(o3,"setToPairs");function a3(Se,Be,ke){for(var ft=ke-1,It=Se.length;++ft<It;)if(Se[ft]===Be)return ft;return-1}i(a3,"strictIndexOf"),a(a3,"strictIndexOf");function s3(Se,Be,ke){for(var ft=ke+1;ft--;)if(Se[ft]===Be)return ft;return ft}i(s3,"strictLastIndexOf"),a(s3,"strictLastIndexOf");function Ps(Se){return Bs(Se)?c3(Se):Jk(Se)}i(Ps,"stringSize"),a(Ps,"stringSize");function Di(Se){return Bs(Se)?u3(Se):J2(Se)}i(Di,"stringToArray"),a(Di,"stringToArray");function f1(Se){for(var Be=Se.length;Be--&&sr.test(Se.charAt(Be)););return Be}i(f1,"trimmedEndIndex"),a(f1,"trimmedEndIndex");var Xk=Gd(Le);function c3(Se){for(var Be=Ol.lastIndex=0;Ol.test(Se);)++Be;return Be}i(c3,"unicodeSize"),a(c3,"unicodeSize");function u3(Se){return Se.match(Ol)||[]}i(u3,"unicodeToArray"),a(u3,"unicodeToArray");function l3(Se){return Se.match(Nl)||[]}i(l3,"unicodeWords"),a(l3,"unicodeWords");var Qk=a(i(function Se(Be){Be=Be==null?Lr:Pa.defaults(Lr.Object(),Be,Pa.pick(Lr,zd));var ke=Be.Array,ft=Be.Date,It=Be.Error,fr=Be.Function,Kr=Be.Math,br=Be.Object,d1=Be.RegExp,eD=Be.String,Ri=Be.TypeError,Xd=ke.prototype,tD=fr.prototype,Gc=br.prototype,Qd=Be["__core-js_shared__"],eh=tD.toString,gr=Gc.hasOwnProperty,rD=0,f3=function(){var u=/[^.]+$/.exec(Qd&&Qd.keys&&Qd.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),th=Gc.toString,nD=eh.call(br),iD=Lr._,oD=d1("^"+eh.call(gr).replace(Qt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rh=Bl?Be.Buffer:r,La=Be.Symbol,nh=Be.Uint8Array,d3=rh?rh.allocUnsafe:r,ih=l1(br.getPrototypeOf,br),h3=br.create,p3=Gc.propertyIsEnumerable,oh=Xd.splice,m3=La?La.isConcatSpreadable:r,Ul=La?La.iterator:r,Ls=La?La.toStringTag:r,ah=function(){try{var u=Ha(br,"defineProperty");return u({},"",{}),u}catch{}}(),aD=Be.clearTimeout!==Lr.clearTimeout&&Be.clearTimeout,sD=ft&&ft.now!==Lr.Date.now&&ft.now,cD=Be.setTimeout!==Lr.setTimeout&&Be.setTimeout,sh=Kr.ceil,ch=Kr.floor,h1=br.getOwnPropertySymbols,uD=rh?rh.isBuffer:r,g3=Be.isFinite,lD=Xd.join,fD=l1(br.keys,br),Gr=Kr.max,vn=Kr.min,dD=ft.now,hD=Be.parseInt,v3=Kr.random,pD=Xd.reverse,p1=Ha(Be,"DataView"),$l=Ha(Be,"Map"),m1=Ha(Be,"Promise"),Wc=Ha(Be,"Set"),jl=Ha(Be,"WeakMap"),zl=Ha(br,"create"),uh=jl&&new jl,Jc={},mD=qa(p1),gD=qa($l),vD=qa(m1),yD=qa(Wc),bD=qa(jl),lh=La?La.prototype:r,Hl=lh?lh.valueOf:r,y3=lh?lh.toString:r;function se(u){if(kr(u)&&!Ot(u)&&!(u instanceof Kt)){if(u instanceof ri)return u;if(gr.call(u,"__wrapped__"))return hg(u)}return new ri(u)}i(se,"lodash"),a(se,"lodash");var Zc=function(){function u(){}return i(u,"object"),a(u,"object"),function(d){if(!Mr(d))return{};if(h3)return h3(d);u.prototype=d;var S=new u;return u.prototype=r,S}}();function ql(){}i(ql,"baseLodash"),a(ql,"baseLodash");function ri(u,d){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!d,this.__index__=0,this.__values__=r}i(ri,"LodashWrapper"),a(ri,"LodashWrapper"),se.templateSettings={escape:lr,evaluate:lt,interpolate:nt,variable:"",imports:{_:se}},se.prototype=ql.prototype,se.prototype.constructor=se,ri.prototype=Zc(ql.prototype),ri.prototype.constructor=ri;function Kt(u){this.__wrapped__=u,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=A,this.__views__=[]}i(Kt,"LazyWrapper"),a(Kt,"LazyWrapper");function b3(){var u=new Kt(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(b3,"lazyClone"),a(b3,"lazyClone");function w3(){if(this.__filtered__){var u=new Kt(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}i(w3,"lazyReverse"),a(w3,"lazyReverse");function _3(){var u=this.__wrapped__.value(),d=this.__dir__,S=Ot(u),j=d<0,te=S?u.length:0,ce=B5(0,te,this.__views__),ye=ce.start,Ee=ce.end,xe=Ee-ye,Fe=j?Ee:ye-1,Ue=this.__iteratees__,je=Ue.length,Ye=0,pt=vn(xe,this.__takeCount__);if(!S||!j&&te==xe&&pt==xe)return L1(u,this.__actions__);var St=[];e:for(;xe--&&Ye<pt;){Fe+=d;for(var Lt=-1,_t=u[Fe];++Lt<je;){var Ht=Ue[Lt],Gt=Ht.iteratee,Hn=Ht.type,_n=Gt(_t);if(Hn==g)_t=_n;else if(!_n){if(Hn==T)continue e;break e}}St[Ye++]=_t}return St}i(_3,"lazyValue"),a(_3,"lazyValue"),Kt.prototype=Zc(ql.prototype),Kt.prototype.constructor=Kt;function Fa(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var j=u[d];this.set(j[0],j[1])}}i(Fa,"Hash"),a(Fa,"Hash");function E3(){this.__data__=zl?zl(null):{},this.size=0}i(E3,"hashClear"),a(E3,"hashClear");function A3(u){var d=this.has(u)&&delete this.__data__[u];return this.size-=d?1:0,d}i(A3,"hashDelete"),a(A3,"hashDelete");function S3(u){var d=this.__data__;if(zl){var S=d[u];return S===h?r:S}return gr.call(d,u)?d[u]:r}i(S3,"hashGet"),a(S3,"hashGet");function x3(u){var d=this.__data__;return zl?d[u]!==r:gr.call(d,u)}i(x3,"hashHas"),a(x3,"hashHas");function T3(u,d){var S=this.__data__;return this.size+=this.has(u)?0:1,S[u]=zl&&d===r?h:d,this}i(T3,"hashSet"),a(T3,"hashSet"),Fa.prototype.clear=E3,Fa.prototype.delete=A3,Fa.prototype.get=S3,Fa.prototype.has=x3,Fa.prototype.set=T3;function So(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var j=u[d];this.set(j[0],j[1])}}i(So,"ListCache"),a(So,"ListCache");function C3(){this.__data__=[],this.size=0}i(C3,"listCacheClear"),a(C3,"listCacheClear");function M3(u){var d=this.__data__,S=Vl(d,u);if(S<0)return!1;var j=d.length-1;return S==j?d.pop():oh.call(d,S,1),--this.size,!0}i(M3,"listCacheDelete"),a(M3,"listCacheDelete");function I3(u){var d=this.__data__,S=Vl(d,u);return S<0?r:d[S][1]}i(I3,"listCacheGet"),a(I3,"listCacheGet");function k3(u){return Vl(this.__data__,u)>-1}i(k3,"listCacheHas"),a(k3,"listCacheHas");function D3(u,d){var S=this.__data__,j=Vl(S,u);return j<0?(++this.size,S.push([u,d])):S[j][1]=d,this}i(D3,"listCacheSet"),a(D3,"listCacheSet"),So.prototype.clear=C3,So.prototype.delete=M3,So.prototype.get=I3,So.prototype.has=k3,So.prototype.set=D3;function xo(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var j=u[d];this.set(j[0],j[1])}}i(xo,"MapCache"),a(xo,"MapCache");function R3(){this.size=0,this.__data__={hash:new Fa,map:new($l||So),string:new Fa}}i(R3,"mapCacheClear"),a(R3,"mapCacheClear");function O3(u){var d=nf(this,u).delete(u);return this.size-=d?1:0,d}i(O3,"mapCacheDelete"),a(O3,"mapCacheDelete");function N3(u){return nf(this,u).get(u)}i(N3,"mapCacheGet"),a(N3,"mapCacheGet");function B3(u){return nf(this,u).has(u)}i(B3,"mapCacheHas"),a(B3,"mapCacheHas");function P3(u,d){var S=nf(this,u),j=S.size;return S.set(u,d),this.size+=S.size==j?0:1,this}i(P3,"mapCacheSet"),a(P3,"mapCacheSet"),xo.prototype.clear=R3,xo.prototype.delete=O3,xo.prototype.get=N3,xo.prototype.has=B3,xo.prototype.set=P3;function Ua(u){var d=-1,S=u==null?0:u.length;for(this.__data__=new xo;++d<S;)this.add(u[d])}i(Ua,"SetCache"),a(Ua,"SetCache");function L3(u){return this.__data__.set(u,h),this}i(L3,"setCacheAdd"),a(L3,"setCacheAdd");function F3(u){return this.__data__.has(u)}i(F3,"setCacheHas"),a(F3,"setCacheHas"),Ua.prototype.add=Ua.prototype.push=L3,Ua.prototype.has=F3;function Oi(u){var d=this.__data__=new So(u);this.size=d.size}i(Oi,"Stack"),a(Oi,"Stack");function U3(){this.__data__=new So,this.size=0}i(U3,"stackClear"),a(U3,"stackClear");function $3(u){var d=this.__data__,S=d.delete(u);return this.size=d.size,S}i($3,"stackDelete"),a($3,"stackDelete");function j3(u){return this.__data__.get(u)}i(j3,"stackGet"),a(j3,"stackGet");function z3(u){return this.__data__.has(u)}i(z3,"stackHas"),a(z3,"stackHas");function H3(u,d){var S=this.__data__;if(S instanceof So){var j=S.__data__;if(!$l||j.length<o-1)return j.push([u,d]),this.size=++S.size,this;S=this.__data__=new xo(j)}return S.set(u,d),this.size=S.size,this}i(H3,"stackSet"),a(H3,"stackSet"),Oi.prototype.clear=U3,Oi.prototype.delete=$3,Oi.prototype.get=j3,Oi.prototype.has=z3,Oi.prototype.set=H3;function g1(u,d){var S=Ot(u),j=!S&&js(u),te=!S&&!j&&Va(u),ce=!S&&!j&&!te&&ou(u),ye=S||j||te||ce,Ee=ye?Jd(u.length,eD):[],xe=Ee.length;for(var Fe in u)(d||gr.call(u,Fe))&&!(ye&&(Fe=="length"||te&&(Fe=="offset"||Fe=="parent")||ce&&(Fe=="buffer"||Fe=="byteLength"||Fe=="byteOffset")||Io(Fe,xe)))&&Ee.push(Fe);return Ee}i(g1,"arrayLikeKeys"),a(g1,"arrayLikeKeys");function v1(u){var d=u.length;return d?u[wh(0,d-1)]:r}i(v1,"arraySample"),a(v1,"arraySample");function q3(u,d){return af(In(u),$a(d,0,u.length))}i(q3,"arraySampleSize"),a(q3,"arraySampleSize");function V3(u){return af(In(u))}i(V3,"arrayShuffle"),a(V3,"arrayShuffle");function fh(u,d,S){(S!==r&&!Ni(u[d],S)||S===r&&!(d in u))&&To(u,d,S)}i(fh,"assignMergeValue"),a(fh,"assignMergeValue");function Yc(u,d,S){var j=u[d];(!(gr.call(u,d)&&Ni(j,S))||S===r&&!(d in u))&&To(u,d,S)}i(Yc,"assignValue"),a(Yc,"assignValue");function Vl(u,d){for(var S=u.length;S--;)if(Ni(u[S][0],d))return S;return-1}i(Vl,"assocIndexOf"),a(Vl,"assocIndexOf");function K3(u,d,S,j){return ja(u,function(te,ce,ye){d(j,te,S(te),ye)}),j}i(K3,"baseAggregator"),a(K3,"baseAggregator");function y1(u,d){return u&&Zi(d,Wr(d),u)}i(y1,"baseAssign"),a(y1,"baseAssign");function G3(u,d){return u&&Zi(d,Dn(d),u)}i(G3,"baseAssignIn"),a(G3,"baseAssignIn");function To(u,d,S){d=="__proto__"&&ah?ah(u,d,{configurable:!0,enumerable:!0,value:S,writable:!0}):u[d]=S}i(To,"baseAssignValue"),a(To,"baseAssignValue");function dh(u,d){for(var S=-1,j=d.length,te=ke(j),ce=u==null;++S<j;)te[S]=ce?r:jh(u,d[S]);return te}i(dh,"baseAt"),a(dh,"baseAt");function $a(u,d,S){return u===u&&(S!==r&&(u=u<=S?u:S),d!==r&&(u=u>=d?u:d)),u}i($a,"baseClamp"),a($a,"baseClamp");function ni(u,d,S,j,te,ce){var ye,Ee=d&y,xe=d&b,Fe=d&_;if(S&&(ye=te?S(u,j,te,ce):S(u)),ye!==r)return ye;if(!Mr(u))return u;var Ue=Ot(u);if(Ue){if(ye=L5(u),!Ee)return In(u,ye)}else{var je=bn(u),Ye=je==oe||je==fe;if(Va(u))return U1(u,Ee);if(je==N||je==F||Ye&&!te){if(ye=xe||Ye?{}:og(u),!Ee)return xe?T5(u,G3(ye,u)):x5(u,y1(ye,u))}else{if(!mr[je])return te?u:{};ye=F5(u,je,Ee)}}ce||(ce=new Oi);var pt=ce.get(u);if(pt)return pt;ce.set(u,ye),N4(u)?u.forEach(function(_t){ye.add(ni(_t,d,S,_t,u,ce))}):T4(u)&&u.forEach(function(_t,Ht){ye.set(Ht,ni(_t,d,S,Ht,u,ce))});var St=Fe?xe?Dh:kh:xe?Dn:Wr,Lt=Ue?r:St(u);return ti(Lt||u,function(_t,Ht){Lt&&(Ht=_t,_t=u[Ht]),Yc(ye,Ht,ni(_t,d,S,Ht,u,ce))}),ye}i(ni,"baseClone"),a(ni,"baseClone");function W3(u){var d=Wr(u);return function(S){return b1(S,u,d)}}i(W3,"baseConforms"),a(W3,"baseConforms");function b1(u,d,S){var j=S.length;if(u==null)return!j;for(u=br(u);j--;){var te=S[j],ce=d[te],ye=u[te];if(ye===r&&!(te in u)||!ce(ye))return!1}return!0}i(b1,"baseConformsTo"),a(b1,"baseConformsTo");function w1(u,d,S){if(typeof u!="function")throw new Ri(c);return of(function(){u.apply(r,S)},d)}i(w1,"baseDelay"),a(w1,"baseDelay");function Xc(u,d,S,j){var te=-1,ce=Pl,ye=!0,Ee=u.length,xe=[],Fe=d.length;if(!Ee)return xe;S&&(d=Tr(d,$n(S))),j?(ce=Hd,ye=!1):d.length>=o&&(ce=Kc,ye=!1,d=new Ua(d));e:for(;++te<Ee;){var Ue=u[te],je=S==null?Ue:S(Ue);if(Ue=j||Ue!==0?Ue:0,ye&&je===je){for(var Ye=Fe;Ye--;)if(d[Ye]===je)continue e;xe.push(Ue)}else ce(d,je,j)||xe.push(Ue)}return xe}i(Xc,"baseDifference"),a(Xc,"baseDifference");var ja=q1(Ji),J3=q1(hh,!0);function Z3(u,d){var S=!0;return ja(u,function(j,te,ce){return S=!!d(j,te,ce),S}),S}i(Z3,"baseEvery"),a(Z3,"baseEvery");function Kl(u,d,S){for(var j=-1,te=u.length;++j<te;){var ce=u[j],ye=d(ce);if(ye!=null&&(Ee===r?ye===ye&&!zn(ye):S(ye,Ee)))var Ee=ye,xe=ce}return xe}i(Kl,"baseExtremum"),a(Kl,"baseExtremum");function Y3(u,d,S,j){var te=u.length;for(S=Nt(S),S<0&&(S=-S>te?0:te+S),j=j===r||j>te?te:Nt(j),j<0&&(j+=te),j=S>j?0:Ng(j);S<j;)u[S++]=d;return u}i(Y3,"baseFill"),a(Y3,"baseFill");function _1(u,d){var S=[];return ja(u,function(j,te,ce){d(j,te,ce)&&S.push(j)}),S}i(_1,"baseFilter"),a(_1,"baseFilter");function Zr(u,d,S,j,te){var ce=-1,ye=u.length;for(S||(S=$5),te||(te=[]);++ce<ye;){var Ee=u[ce];d>0&&S(Ee)?d>1?Zr(Ee,d-1,S,j,te):aa(te,Ee):j||(te[te.length]=Ee)}return te}i(Zr,"baseFlatten"),a(Zr,"baseFlatten");var E1=V1(),X3=V1(!0);function Ji(u,d){return u&&E1(u,d,Wr)}i(Ji,"baseForOwn"),a(Ji,"baseForOwn");function hh(u,d){return u&&X3(u,d,Wr)}i(hh,"baseForOwnRight"),a(hh,"baseForOwnRight");function Gl(u,d){return oa(d,function(S){return ko(u[S])})}i(Gl,"baseFunctions"),a(Gl,"baseFunctions");function za(u,d){d=ua(d,u);for(var S=0,j=d.length;u!=null&&S<j;)u=u[Yi(d[S++])];return S&&S==j?u:r}i(za,"baseGet"),a(za,"baseGet");function A1(u,d,S){var j=d(u);return Ot(u)?j:aa(j,S(u))}i(A1,"baseGetAllKeys"),a(A1,"baseGetAllKeys");function yn(u){return u==null?u===r?De:X:Ls&&Ls in br(u)?O5(u):K5(u)}i(yn,"baseGetTag"),a(yn,"baseGetTag");function ph(u,d){return u>d}i(ph,"baseGt"),a(ph,"baseGt");function Q3(u,d){return u!=null&&gr.call(u,d)}i(Q3,"baseHas"),a(Q3,"baseHas");function e5(u,d){return u!=null&&d in br(u)}i(e5,"baseHasIn"),a(e5,"baseHasIn");function t5(u,d,S){return u>=vn(d,S)&&u<Gr(d,S)}i(t5,"baseInRange"),a(t5,"baseInRange");function mh(u,d,S){for(var j=S?Hd:Pl,te=u[0].length,ce=u.length,ye=ce,Ee=ke(ce),xe=1/0,Fe=[];ye--;){var Ue=u[ye];ye&&d&&(Ue=Tr(Ue,$n(d))),xe=vn(Ue.length,xe),Ee[ye]=!S&&(d||te>=120&&Ue.length>=120)?new Ua(ye&&Ue):r}Ue=u[0];var je=-1,Ye=Ee[0];e:for(;++je<te&&Fe.length<xe;){var pt=Ue[je],St=d?d(pt):pt;if(pt=S||pt!==0?pt:0,!(Ye?Kc(Ye,St):j(Fe,St,S))){for(ye=ce;--ye;){var Lt=Ee[ye];if(!(Lt?Kc(Lt,St):j(u[ye],St,S)))continue e}Ye&&Ye.push(St),Fe.push(pt)}}return Fe}i(mh,"baseIntersection"),a(mh,"baseIntersection");function r5(u,d,S,j){return Ji(u,function(te,ce,ye){d(j,S(te),ce,ye)}),j}i(r5,"baseInverter"),a(r5,"baseInverter");function Qc(u,d,S){d=ua(d,u),u=ug(u,d);var j=u==null?u:u[Yi(oi(d))];return j==null?r:Un(j,u,S)}i(Qc,"baseInvoke"),a(Qc,"baseInvoke");function S1(u){return kr(u)&&yn(u)==F}i(S1,"baseIsArguments"),a(S1,"baseIsArguments");function n5(u){return kr(u)&&yn(u)==qe}i(n5,"baseIsArrayBuffer"),a(n5,"baseIsArrayBuffer");function i5(u){return kr(u)&&yn(u)==ae}i(i5,"baseIsDate"),a(i5,"baseIsDate");function eu(u,d,S,j,te){return u===d?!0:u==null||d==null||!kr(u)&&!kr(d)?u!==u&&d!==d:o5(u,d,S,j,eu,te)}i(eu,"baseIsEqual"),a(eu,"baseIsEqual");function o5(u,d,S,j,te,ce){var ye=Ot(u),Ee=Ot(d),xe=ye?ge:bn(u),Fe=Ee?ge:bn(d);xe=xe==F?N:xe,Fe=Fe==F?N:Fe;var Ue=xe==N,je=Fe==N,Ye=xe==Fe;if(Ye&&Va(u)){if(!Va(d))return!1;ye=!0,Ue=!1}if(Ye&&!Ue)return ce||(ce=new Oi),ye||ou(u)?tg(u,d,S,j,te,ce):D5(u,d,xe,S,j,te,ce);if(!(S&x)){var pt=Ue&&gr.call(u,"__wrapped__"),St=je&&gr.call(d,"__wrapped__");if(pt||St){var Lt=pt?u.value():u,_t=St?d.value():d;return ce||(ce=new Oi),te(Lt,_t,S,j,ce)}}return Ye?(ce||(ce=new Oi),R5(u,d,S,j,te,ce)):!1}i(o5,"baseIsEqualDeep"),a(o5,"baseIsEqualDeep");function a5(u){return kr(u)&&bn(u)==be}i(a5,"baseIsMap"),a(a5,"baseIsMap");function gh(u,d,S,j){var te=S.length,ce=te,ye=!j;if(u==null)return!ce;for(u=br(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],Fe=u[xe],Ue=Ee[1];if(ye&&Ee[2]){if(Fe===r&&!(xe in u))return!1}else{var je=new Oi;if(j)var Ye=j(Fe,Ue,xe,u,d,je);if(!(Ye===r?eu(Ue,Fe,x|D,j,je):Ye))return!1}}return!0}i(gh,"baseIsMatch"),a(gh,"baseIsMatch");function x1(u){if(!Mr(u)||z5(u))return!1;var d=ko(u)?oD:tr;return d.test(qa(u))}i(x1,"baseIsNative"),a(x1,"baseIsNative");function s5(u){return kr(u)&&yn(u)==ie}i(s5,"baseIsRegExp"),a(s5,"baseIsRegExp");function c5(u){return kr(u)&&bn(u)==ee}i(c5,"baseIsSet"),a(c5,"baseIsSet");function u5(u){return kr(u)&&ff(u.length)&&!!yr[yn(u)]}i(u5,"baseIsTypedArray"),a(u5,"baseIsTypedArray");function T1(u){return typeof u=="function"?u:u==null?Rn:typeof u=="object"?Ot(u)?I1(u[0],u[1]):M1(u):jg(u)}i(T1,"baseIteratee"),a(T1,"baseIteratee");function vh(u){if(!nu(u))return fD(u);var d=[];for(var S in br(u))gr.call(u,S)&&S!="constructor"&&d.push(S);return d}i(vh,"baseKeys"),a(vh,"baseKeys");function l5(u){if(!Mr(u))return V5(u);var d=nu(u),S=[];for(var j in u)j=="constructor"&&(d||!gr.call(u,j))||S.push(j);return S}i(l5,"baseKeysIn"),a(l5,"baseKeysIn");function yh(u,d){return u<d}i(yh,"baseLt"),a(yh,"baseLt");function C1(u,d){var S=-1,j=kn(u)?ke(u.length):[];return ja(u,function(te,ce,ye){j[++S]=d(te,ce,ye)}),j}i(C1,"baseMap"),a(C1,"baseMap");function M1(u){var d=Rh(u);return d.length==1&&d[0][2]?sg(d[0][0],d[0][1]):function(S){return S===u||gh(S,u,d)}}i(M1,"baseMatches"),a(M1,"baseMatches");function I1(u,d){return Oh(u)&&ag(d)?sg(Yi(u),d):function(S){var j=jh(S,u);return j===r&&j===d?zh(S,u):eu(d,j,x|D)}}i(I1,"baseMatchesProperty"),a(I1,"baseMatchesProperty");function Wl(u,d,S,j,te){u!==d&&E1(d,function(ce,ye){if(te||(te=new Oi),Mr(ce))f5(u,d,ye,S,Wl,j,te);else{var Ee=j?j(Bh(u,ye),ce,ye+"",u,d,te):r;Ee===r&&(Ee=ce),fh(u,ye,Ee)}},Dn)}i(Wl,"baseMerge"),a(Wl,"baseMerge");function f5(u,d,S,j,te,ce,ye){var Ee=Bh(u,S),xe=Bh(d,S),Fe=ye.get(xe);if(Fe){fh(u,S,Fe);return}var Ue=ce?ce(Ee,xe,S+"",u,d,ye):r,je=Ue===r;if(je){var Ye=Ot(xe),pt=!Ye&&Va(xe),St=!Ye&&!pt&&ou(xe);Ue=xe,Ye||pt||St?Ot(Ee)?Ue=Ee:Or(Ee)?Ue=In(Ee):pt?(je=!1,Ue=U1(xe,!0)):St?(je=!1,Ue=$1(xe,!0)):Ue=[]:iu(xe)||js(xe)?(Ue=Ee,js(Ee)?Ue=Bg(Ee):(!Mr(Ee)||ko(Ee))&&(Ue=og(xe))):je=!1}je&&(ye.set(xe,Ue),te(Ue,xe,j,ce,ye),ye.delete(xe)),fh(u,S,Ue)}i(f5,"baseMergeDeep"),a(f5,"baseMergeDeep");function k1(u,d){var S=u.length;if(!!S)return d+=d<0?S:0,Io(d,S)?u[d]:r}i(k1,"baseNth"),a(k1,"baseNth");function D1(u,d,S){d.length?d=Tr(d,function(ce){return Ot(ce)?function(ye){return za(ye,ce.length===1?ce[0]:ce)}:ce}):d=[Rn];var j=-1;d=Tr(d,$n(wt()));var te=C1(u,function(ce,ye,Ee){var xe=Tr(d,function(Fe){return Fe(ce)});return{criteria:xe,index:++j,value:ce}});return X2(te,function(ce,ye){return S5(ce,ye,S)})}i(D1,"baseOrderBy"),a(D1,"baseOrderBy");function d5(u,d){return R1(u,d,function(S,j){return zh(u,j)})}i(d5,"basePick"),a(d5,"basePick");function R1(u,d,S){for(var j=-1,te=d.length,ce={};++j<te;){var ye=d[j],Ee=za(u,ye);S(Ee,ye)&&tu(ce,ua(ye,u),Ee)}return ce}i(R1,"basePickBy"),a(R1,"basePickBy");function h5(u){return function(d){return za(d,u)}}i(h5,"basePropertyDeep"),a(h5,"basePropertyDeep");function bh(u,d,S,j){var te=j?Y2:Ns,ce=-1,ye=d.length,Ee=u;for(u===d&&(d=In(d)),S&&(Ee=Tr(u,$n(S)));++ce<ye;)for(var xe=0,Fe=d[ce],Ue=S?S(Fe):Fe;(xe=te(Ee,Ue,xe,j))>-1;)Ee!==u&&oh.call(Ee,xe,1),oh.call(u,xe,1);return u}i(bh,"basePullAll"),a(bh,"basePullAll");function O1(u,d){for(var S=u?d.length:0,j=S-1;S--;){var te=d[S];if(S==j||te!==ce){var ce=te;Io(te)?oh.call(u,te,1):Ah(u,te)}}return u}i(O1,"basePullAt"),a(O1,"basePullAt");function wh(u,d){return u+ch(v3()*(d-u+1))}i(wh,"baseRandom"),a(wh,"baseRandom");function p5(u,d,S,j){for(var te=-1,ce=Gr(sh((d-u)/(S||1)),0),ye=ke(ce);ce--;)ye[j?ce:++te]=u,u+=S;return ye}i(p5,"baseRange"),a(p5,"baseRange");function _h(u,d){var S="";if(!u||d<1||d>E)return S;do d%2&&(S+=u),d=ch(d/2),d&&(u+=u);while(d);return S}i(_h,"baseRepeat"),a(_h,"baseRepeat");function Ft(u,d){return lg(cg(u,d,Rn),u+"")}i(Ft,"baseRest"),a(Ft,"baseRest");function m5(u){return v1(zs(u))}i(m5,"baseSample"),a(m5,"baseSample");function g5(u,d){var S=zs(u);return af(S,$a(d,0,S.length))}i(g5,"baseSampleSize"),a(g5,"baseSampleSize");function tu(u,d,S,j){if(!Mr(u))return u;d=ua(d,u);for(var te=-1,ce=d.length,ye=ce-1,Ee=u;Ee!=null&&++te<ce;){var xe=Yi(d[te]),Fe=S;if(xe==="__proto__"||xe==="constructor"||xe==="prototype")return u;if(te!=ye){var Ue=Ee[xe];Fe=j?j(Ue,xe,Ee):r,Fe===r&&(Fe=Mr(Ue)?Ue:Io(d[te+1])?[]:{})}Yc(Ee,xe,Fe),Ee=Ee[xe]}return u}i(tu,"baseSet"),a(tu,"baseSet");var v5=uh?function(u,d){return uh.set(u,d),u}:Rn,wD=ah?function(u,d){return ah(u,"toString",{configurable:!0,enumerable:!1,value:Hh(d),writable:!0})}:Rn;function y5(u){return af(zs(u))}i(y5,"baseShuffle"),a(y5,"baseShuffle");function ii(u,d,S){var j=-1,te=u.length;d<0&&(d=-d>te?0:te+d),S=S>te?te:S,S<0&&(S+=te),te=d>S?0:S-d>>>0,d>>>=0;for(var ce=ke(te);++j<te;)ce[j]=u[j+d];return ce}i(ii,"baseSlice"),a(ii,"baseSlice");function b5(u,d){var S;return ja(u,function(j,te,ce){return S=d(j,te,ce),!S}),!!S}i(b5,"baseSome"),a(b5,"baseSome");function Jl(u,d,S){var j=0,te=u==null?j:u.length;if(typeof d=="number"&&d===d&&te<=H){for(;j<te;){var ce=j+te>>>1,ye=u[ce];ye!==null&&!zn(ye)&&(S?ye<=d:ye<d)?j=ce+1:te=ce}return te}return Eh(u,d,Rn,S)}i(Jl,"baseSortedIndex"),a(Jl,"baseSortedIndex");function Eh(u,d,S,j){var te=0,ce=u==null?0:u.length;if(ce===0)return 0;d=S(d);for(var ye=d!==d,Ee=d===null,xe=zn(d),Fe=d===r;te<ce;){var Ue=ch((te+ce)/2),je=S(u[Ue]),Ye=je!==r,pt=je===null,St=je===je,Lt=zn(je);if(ye)var _t=j||St;else Fe?_t=St&&(j||Ye):Ee?_t=St&&Ye&&(j||!pt):xe?_t=St&&Ye&&!pt&&(j||!Lt):pt||Lt?_t=!1:_t=j?je<=d:je<d;_t?te=Ue+1:ce=Ue}return vn(ce,P)}i(Eh,"baseSortedIndexBy"),a(Eh,"baseSortedIndexBy");function N1(u,d){for(var S=-1,j=u.length,te=0,ce=[];++S<j;){var ye=u[S],Ee=d?d(ye):ye;if(!S||!Ni(Ee,xe)){var xe=Ee;ce[te++]=ye===0?0:ye}}return ce}i(N1,"baseSortedUniq"),a(N1,"baseSortedUniq");function B1(u){return typeof u=="number"?u:zn(u)?C:+u}i(B1,"baseToNumber"),a(B1,"baseToNumber");function jn(u){if(typeof u=="string")return u;if(Ot(u))return Tr(u,jn)+"";if(zn(u))return y3?y3.call(u):"";var d=u+"";return d=="0"&&1/u==-v?"-0":d}i(jn,"baseToString"),a(jn,"baseToString");function ca(u,d,S){var j=-1,te=Pl,ce=u.length,ye=!0,Ee=[],xe=Ee;if(S)ye=!1,te=Hd;else if(ce>=o){var Fe=d?null:ED(u);if(Fe)return Fl(Fe);ye=!1,te=Kc,xe=new Ua}else xe=d?[]:Ee;e:for(;++j<ce;){var Ue=u[j],je=d?d(Ue):Ue;if(Ue=S||Ue!==0?Ue:0,ye&&je===je){for(var Ye=xe.length;Ye--;)if(xe[Ye]===je)continue e;d&&xe.push(je),Ee.push(Ue)}else te(xe,je,S)||(xe!==Ee&&xe.push(je),Ee.push(Ue))}return Ee}i(ca,"baseUniq"),a(ca,"baseUniq");function Ah(u,d){return d=ua(d,u),u=ug(u,d),u==null||delete u[Yi(oi(d))]}i(Ah,"baseUnset"),a(Ah,"baseUnset");function P1(u,d,S,j){return tu(u,d,S(za(u,d)),j)}i(P1,"baseUpdate"),a(P1,"baseUpdate");function Zl(u,d,S,j){for(var te=u.length,ce=j?te:-1;(j?ce--:++ce<te)&&d(u[ce],ce,u););return S?ii(u,j?0:ce,j?ce+1:te):ii(u,j?ce+1:0,j?te:ce)}i(Zl,"baseWhile"),a(Zl,"baseWhile");function L1(u,d){var S=u;return S instanceof Kt&&(S=S.value()),qd(d,function(j,te){return te.func.apply(te.thisArg,aa([j],te.args))},S)}i(L1,"baseWrapperValue"),a(L1,"baseWrapperValue");function Sh(u,d,S){var j=u.length;if(j<2)return j?ca(u[0]):[];for(var te=-1,ce=ke(j);++te<j;)for(var ye=u[te],Ee=-1;++Ee<j;)Ee!=te&&(ce[te]=Xc(ce[te]||ye,u[Ee],d,S));return ca(Zr(ce,1),d,S)}i(Sh,"baseXor"),a(Sh,"baseXor");function F1(u,d,S){for(var j=-1,te=u.length,ce=d.length,ye={};++j<te;){var Ee=j<ce?d[j]:r;S(ye,u[j],Ee)}return ye}i(F1,"baseZipObject"),a(F1,"baseZipObject");function xh(u){return Or(u)?u:[]}i(xh,"castArrayLikeObject"),a(xh,"castArrayLikeObject");function Th(u){return typeof u=="function"?u:Rn}i(Th,"castFunction"),a(Th,"castFunction");function ua(u,d){return Ot(u)?u:Oh(u,d)?[u]:J5(dr(u))}i(ua,"castPath"),a(ua,"castPath");var _D=Ft;function la(u,d,S){var j=u.length;return S=S===r?j:S,!d&&S>=j?u:ii(u,d,S)}i(la,"castSlice"),a(la,"castSlice");var w5=aD||function(u){return Lr.clearTimeout(u)};function U1(u,d){if(d)return u.slice();var S=u.length,j=d3?d3(S):new u.constructor(S);return u.copy(j),j}i(U1,"cloneBuffer"),a(U1,"cloneBuffer");function Ch(u){var d=new u.constructor(u.byteLength);return new nh(d).set(new nh(u)),d}i(Ch,"cloneArrayBuffer"),a(Ch,"cloneArrayBuffer");function _5(u,d){var S=d?Ch(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.byteLength)}i(_5,"cloneDataView"),a(_5,"cloneDataView");function E5(u){var d=new u.constructor(u.source,yt.exec(u));return d.lastIndex=u.lastIndex,d}i(E5,"cloneRegExp"),a(E5,"cloneRegExp");function A5(u){return Hl?br(Hl.call(u)):{}}i(A5,"cloneSymbol"),a(A5,"cloneSymbol");function $1(u,d){var S=d?Ch(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.length)}i($1,"cloneTypedArray"),a($1,"cloneTypedArray");function j1(u,d){if(u!==d){var S=u!==r,j=u===null,te=u===u,ce=zn(u),ye=d!==r,Ee=d===null,xe=d===d,Fe=zn(d);if(!Ee&&!Fe&&!ce&&u>d||ce&&ye&&xe&&!Ee&&!Fe||j&&ye&&xe||!S&&xe||!te)return 1;if(!j&&!ce&&!Fe&&u<d||Fe&&S&&te&&!j&&!ce||Ee&&S&&te||!ye&&te||!xe)return-1}return 0}i(j1,"compareAscending"),a(j1,"compareAscending");function S5(u,d,S){for(var j=-1,te=u.criteria,ce=d.criteria,ye=te.length,Ee=S.length;++j<ye;){var xe=j1(te[j],ce[j]);if(xe){if(j>=Ee)return xe;var Fe=S[j];return xe*(Fe=="desc"?-1:1)}}return u.index-d.index}i(S5,"compareMultiple"),a(S5,"compareMultiple");function z1(u,d,S,j){for(var te=-1,ce=u.length,ye=S.length,Ee=-1,xe=d.length,Fe=Gr(ce-ye,0),Ue=ke(xe+Fe),je=!j;++Ee<xe;)Ue[Ee]=d[Ee];for(;++te<ye;)(je||te<ce)&&(Ue[S[te]]=u[te]);for(;Fe--;)Ue[Ee++]=u[te++];return Ue}i(z1,"composeArgs"),a(z1,"composeArgs");function H1(u,d,S,j){for(var te=-1,ce=u.length,ye=-1,Ee=S.length,xe=-1,Fe=d.length,Ue=Gr(ce-Ee,0),je=ke(Ue+Fe),Ye=!j;++te<Ue;)je[te]=u[te];for(var pt=te;++xe<Fe;)je[pt+xe]=d[xe];for(;++ye<Ee;)(Ye||te<ce)&&(je[pt+S[ye]]=u[te++]);return je}i(H1,"composeArgsRight"),a(H1,"composeArgsRight");function In(u,d){var S=-1,j=u.length;for(d||(d=ke(j));++S<j;)d[S]=u[S];return d}i(In,"copyArray"),a(In,"copyArray");function Zi(u,d,S,j){var te=!S;S||(S={});for(var ce=-1,ye=d.length;++ce<ye;){var Ee=d[ce],xe=j?j(S[Ee],u[Ee],Ee,S,u):r;xe===r&&(xe=u[Ee]),te?To(S,Ee,xe):Yc(S,Ee,xe)}return S}i(Zi,"copyObject"),a(Zi,"copyObject");function x5(u,d){return Zi(u,ng(u),d)}i(x5,"copySymbols"),a(x5,"copySymbols");function T5(u,d){return Zi(u,N5(u),d)}i(T5,"copySymbolsIn"),a(T5,"copySymbolsIn");function Yl(u,d){return function(S,j){var te=Ot(S)?K2:K3,ce=d?d():{};return te(S,u,wt(j,2),ce)}}i(Yl,"createAggregator"),a(Yl,"createAggregator");function Fs(u){return Ft(function(d,S){var j=-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),d=br(d);++j<te;){var Ee=S[j];Ee&&u(d,Ee,j,ce)}return d})}i(Fs,"createAssigner"),a(Fs,"createAssigner");function q1(u,d){return function(S,j){if(S==null)return S;if(!kn(S))return u(S,j);for(var te=S.length,ce=d?te:-1,ye=br(S);(d?ce--:++ce<te)&&j(ye[ce],ce,ye)!==!1;);return S}}i(q1,"createBaseEach"),a(q1,"createBaseEach");function V1(u){return function(d,S,j){for(var te=-1,ce=br(d),ye=j(d),Ee=ye.length;Ee--;){var xe=ye[u?Ee:++te];if(S(ce[xe],xe,ce)===!1)break}return d}}i(V1,"createBaseFor"),a(V1,"createBaseFor");function C5(u,d,S){var j=d&O,te=ru(u);function ce(){var ye=this&&this!==Lr&&this instanceof ce?te:u;return ye.apply(j?S:this,arguments)}return i(ce,"wrapper"),a(ce,"wrapper"),ce}i(C5,"createBind"),a(C5,"createBind");function K1(u){return function(d){d=dr(d);var S=Bs(d)?Di(d):r,j=S?S[0]:d.charAt(0),te=S?la(S,1).join(""):d.slice(1);return j[u]()+te}}i(K1,"createCaseFirst"),a(K1,"createCaseFirst");function Us(u){return function(d){return qd($g(Fg(d).replace(Rl,"")),u,"")}}i(Us,"createCompounder"),a(Us,"createCompounder");function ru(u){return function(){var d=arguments;switch(d.length){case 0:return new u;case 1:return new u(d[0]);case 2:return new u(d[0],d[1]);case 3:return new u(d[0],d[1],d[2]);case 4:return new u(d[0],d[1],d[2],d[3]);case 5:return new u(d[0],d[1],d[2],d[3],d[4]);case 6:return new u(d[0],d[1],d[2],d[3],d[4],d[5]);case 7:return new u(d[0],d[1],d[2],d[3],d[4],d[5],d[6])}var S=Zc(u.prototype),j=u.apply(S,d);return Mr(j)?j:S}}i(ru,"createCtor"),a(ru,"createCtor");function M5(u,d,S){var j=ru(u);function te(){for(var ce=arguments.length,ye=ke(ce),Ee=ce,xe=$s(te);Ee--;)ye[Ee]=arguments[Ee];var Fe=ce<3&&ye[0]!==xe&&ye[ce-1]!==xe?[]:sa(ye,xe);if(ce-=Fe.length,ce<S)return Y1(u,d,Xl,te.placeholder,r,ye,Fe,r,r,S-ce);var Ue=this&&this!==Lr&&this instanceof te?j:u;return Un(Ue,this,ye)}return i(te,"wrapper"),a(te,"wrapper"),te}i(M5,"createCurry"),a(M5,"createCurry");function G1(u){return function(d,S,j){var te=br(d);if(!kn(d)){var ce=wt(S,3);d=Wr(d),S=a(function(Ee){return ce(te[Ee],Ee,te)},"predicate")}var ye=u(d,S,j);return ye>-1?te[ce?d[ye]:ye]:r}}i(G1,"createFind"),a(G1,"createFind");function W1(u){return Mo(function(d){var S=d.length,j=S,te=ri.prototype.thru;for(u&&d.reverse();j--;){var ce=d[j];if(typeof ce!="function")throw new Ri(c);if(te&&!ye&&rf(ce)=="wrapper")var ye=new ri([],!0)}for(j=ye?j:S;++j<S;){ce=d[j];var Ee=rf(ce),xe=Ee=="wrapper"?rg(ce):r;xe&&Nh(xe[0])&&xe[1]==(k|$|Q|q)&&!xe[4].length&&xe[9]==1?ye=ye[rf(xe[0])].apply(ye,xe[3]):ye=ce.length==1&&Nh(ce)?ye[Ee]():ye.thru(ce)}return function(){var Fe=arguments,Ue=Fe[0];if(ye&&Fe.length==1&&Ot(Ue))return ye.plant(Ue).value();for(var je=0,Ye=S?d[je].apply(this,Fe):Ue;++je<S;)Ye=d[je].call(this,Ye);return Ye}})}i(W1,"createFlow"),a(W1,"createFlow");function Xl(u,d,S,j,te,ce,ye,Ee,xe,Fe){var Ue=d&k,je=d&O,Ye=d&B,pt=d&($|z),St=d&he,Lt=Ye?r:ru(u);function _t(){for(var Ht=arguments.length,Gt=ke(Ht),Hn=Ht;Hn--;)Gt[Hn]=arguments[Hn];if(pt)var _n=$s(_t),qn=e3(Gt,_n);if(j&&(Gt=z1(Gt,j,te,pt)),ce&&(Gt=H1(Gt,ce,ye,pt)),Ht-=qn,pt&&Ht<Fe){var Fr=sa(Gt,_n);return Y1(u,d,Xl,_t.placeholder,S,Gt,Fr,Ee,xe,Fe-Ht)}var Xi=je?S:this,fa=Ye?Xi[u]:u;return Ht=Gt.length,Ee?Gt=G5(Gt,Ee):St&&Ht>1&&Gt.reverse(),Ue&&xe<Ht&&(Gt.length=xe),this&&this!==Lr&&this instanceof _t&&(fa=Lt||ru(fa)),fa.apply(Xi,Gt)}return i(_t,"wrapper"),a(_t,"wrapper"),_t}i(Xl,"createHybrid"),a(Xl,"createHybrid");function J1(u,d){return function(S,j){return r5(S,u,d(j),{})}}i(J1,"createInverter"),a(J1,"createInverter");function Ql(u,d){return function(S,j){var te;if(S===r&&j===r)return d;if(S!==r&&(te=S),j!==r){if(te===r)return j;typeof S=="string"||typeof j=="string"?(S=jn(S),j=jn(j)):(S=B1(S),j=B1(j)),te=u(S,j)}return te}}i(Ql,"createMathOperation"),a(Ql,"createMathOperation");function Mh(u){return Mo(function(d){return d=Tr(d,$n(wt())),Ft(function(S){var j=this;return u(d,function(te){return Un(te,j,S)})})})}i(Mh,"createOver"),a(Mh,"createOver");function ef(u,d){d=d===r?" ":jn(d);var S=d.length;if(S<2)return S?_h(d,u):d;var j=_h(d,sh(u/Ps(d)));return Bs(d)?la(Di(j),0,u).join(""):j.slice(0,u)}i(ef,"createPadding"),a(ef,"createPadding");function I5(u,d,S,j){var te=d&O,ce=ru(u);function ye(){for(var Ee=-1,xe=arguments.length,Fe=-1,Ue=j.length,je=ke(Ue+xe),Ye=this&&this!==Lr&&this instanceof ye?ce:u;++Fe<Ue;)je[Fe]=j[Fe];for(;xe--;)je[Fe++]=arguments[++Ee];return Un(Ye,te?S:this,je)}return i(ye,"wrapper"),a(ye,"wrapper"),ye}i(I5,"createPartial"),a(I5,"createPartial");function Z1(u){return function(d,S,j){return j&&typeof j!="number"&&wn(d,S,j)&&(S=j=r),d=Do(d),S===r?(S=d,d=0):S=Do(S),j=j===r?d<S?1:-1:Do(j),p5(d,S,j,u)}}i(Z1,"createRange"),a(Z1,"createRange");function tf(u){return function(d,S){return typeof d=="string"&&typeof S=="string"||(d=ai(d),S=ai(S)),u(d,S)}}i(tf,"createRelationalOperation"),a(tf,"createRelationalOperation");function Y1(u,d,S,j,te,ce,ye,Ee,xe,Fe){var Ue=d&$,je=Ue?ye:r,Ye=Ue?r:ye,pt=Ue?ce:r,St=Ue?r:ce;d|=Ue?Q:Y,d&=~(Ue?Y:Q),d&Z||(d&=~(O|B));var Lt=[u,d,te,pt,je,St,Ye,Ee,xe,Fe],_t=S.apply(r,Lt);return Nh(u)&&W5(_t,Lt),_t.placeholder=j,fg(_t,u,d)}i(Y1,"createRecurry"),a(Y1,"createRecurry");function Ih(u){var d=Kr[u];return function(S,j){if(S=ai(S),j=j==null?0:vn(Nt(j),292),j&&g3(S)){var te=(dr(S)+"e").split("e"),ce=d(te[0]+"e"+(+te[1]+j));return te=(dr(ce)+"e").split("e"),+(te[0]+"e"+(+te[1]-j))}return d(S)}}i(Ih,"createRound"),a(Ih,"createRound");var ED=Wc&&1/Fl(new Wc([,-0]))[1]==v?function(u){return new Wc(u)}:Kh;function X1(u){return function(d){var S=bn(d);return S==be?Yd(d):S==ee?o3(d):Q2(d,u(d))}}i(X1,"createToPairs"),a(X1,"createToPairs");function Co(u,d,S,j,te,ce,ye,Ee){var xe=d&B;if(!xe&&typeof u!="function")throw new Ri(c);var Fe=j?j.length:0;if(Fe||(d&=~(Q|Y),j=te=r),ye=ye===r?ye:Gr(Nt(ye),0),Ee=Ee===r?Ee:Nt(Ee),Fe-=te?te.length:0,d&Y){var Ue=j,je=te;j=te=r}var Ye=xe?r:rg(u),pt=[u,d,S,j,te,Ue,je,ce,ye,Ee];if(Ye&&q5(pt,Ye),u=pt[0],d=pt[1],S=pt[2],j=pt[3],te=pt[4],Ee=pt[9]=pt[9]===r?xe?0:u.length:Gr(pt[9]-Fe,0),!Ee&&d&($|z)&&(d&=~($|z)),!d||d==O)var St=C5(u,d,S);else d==$||d==z?St=M5(u,d,Ee):(d==Q||d==(O|Q))&&!te.length?St=I5(u,d,S,j):St=Xl.apply(r,pt);var Lt=Ye?v5:W5;return fg(Lt(St,pt),u,d)}i(Co,"createWrap"),a(Co,"createWrap");function Q1(u,d,S,j){return u===r||Ni(u,Gc[S])&&!gr.call(j,S)?d:u}i(Q1,"customDefaultsAssignIn"),a(Q1,"customDefaultsAssignIn");function eg(u,d,S,j,te,ce){return Mr(u)&&Mr(d)&&(ce.set(d,u),Wl(u,d,r,eg,ce),ce.delete(d)),u}i(eg,"customDefaultsMerge"),a(eg,"customDefaultsMerge");function k5(u){return iu(u)?r:u}i(k5,"customOmitClone"),a(k5,"customOmitClone");function tg(u,d,S,j,te,ce){var ye=S&x,Ee=u.length,xe=d.length;if(Ee!=xe&&!(ye&&xe>Ee))return!1;var Fe=ce.get(u),Ue=ce.get(d);if(Fe&&Ue)return Fe==d&&Ue==u;var je=-1,Ye=!0,pt=S&D?new Ua:r;for(ce.set(u,d),ce.set(d,u);++je<Ee;){var St=u[je],Lt=d[je];if(j)var _t=ye?j(Lt,St,je,d,u,ce):j(St,Lt,je,u,d,ce);if(_t!==r){if(_t)continue;Ye=!1;break}if(pt){if(!Vd(d,function(Ht,Gt){if(!Kc(pt,Gt)&&(St===Ht||te(St,Ht,S,j,ce)))return pt.push(Gt)})){Ye=!1;break}}else if(!(St===Lt||te(St,Lt,S,j,ce))){Ye=!1;break}}return ce.delete(u),ce.delete(d),Ye}i(tg,"equalArrays"),a(tg,"equalArrays");function D5(u,d,S,j,te,ce,ye){switch(S){case ve:if(u.byteLength!=d.byteLength||u.byteOffset!=d.byteOffset)return!1;u=u.buffer,d=d.buffer;case qe:return!(u.byteLength!=d.byteLength||!ce(new nh(u),new nh(d)));case ne:case ae:case Re:return Ni(+u,+d);case V:return u.name==d.name&&u.message==d.message;case ie:case ue:return u==d+"";case be:var Ee=Yd;case ee:var xe=j&x;if(Ee||(Ee=Fl),u.size!=d.size&&!xe)return!1;var Fe=ye.get(u);if(Fe)return Fe==d;j|=D,ye.set(u,d);var Ue=tg(Ee(u),Ee(d),j,te,ce,ye);return ye.delete(u),Ue;case Ae:if(Hl)return Hl.call(u)==Hl.call(d)}return!1}i(D5,"equalByTag"),a(D5,"equalByTag");function R5(u,d,S,j,te,ce){var ye=S&x,Ee=kh(u),xe=Ee.length,Fe=kh(d),Ue=Fe.length;if(xe!=Ue&&!ye)return!1;for(var je=xe;je--;){var Ye=Ee[je];if(!(ye?Ye in d:gr.call(d,Ye)))return!1}var pt=ce.get(u),St=ce.get(d);if(pt&&St)return pt==d&&St==u;var Lt=!0;ce.set(u,d),ce.set(d,u);for(var _t=ye;++je<xe;){Ye=Ee[je];var Ht=u[Ye],Gt=d[Ye];if(j)var Hn=ye?j(Gt,Ht,Ye,d,u,ce):j(Ht,Gt,Ye,u,d,ce);if(!(Hn===r?Ht===Gt||te(Ht,Gt,S,j,ce):Hn)){Lt=!1;break}_t||(_t=Ye=="constructor")}if(Lt&&!_t){var _n=u.constructor,qn=d.constructor;_n!=qn&&"constructor"in u&&"constructor"in d&&!(typeof _n=="function"&&_n instanceof _n&&typeof qn=="function"&&qn instanceof qn)&&(Lt=!1)}return ce.delete(u),ce.delete(d),Lt}i(R5,"equalObjects"),a(R5,"equalObjects");function Mo(u){return lg(cg(u,r,gg),u+"")}i(Mo,"flatRest"),a(Mo,"flatRest");function kh(u){return A1(u,Wr,ng)}i(kh,"getAllKeys"),a(kh,"getAllKeys");function Dh(u){return A1(u,Dn,N5)}i(Dh,"getAllKeysIn"),a(Dh,"getAllKeysIn");var rg=uh?function(u){return uh.get(u)}:Kh;function rf(u){for(var d=u.name+"",S=Jc[d],j=gr.call(Jc,d)?S.length:0;j--;){var te=S[j],ce=te.func;if(ce==null||ce==u)return te.name}return d}i(rf,"getFuncName"),a(rf,"getFuncName");function $s(u){var d=gr.call(se,"placeholder")?se:u;return d.placeholder}i($s,"getHolder"),a($s,"getHolder");function wt(){var u=se.iteratee||qh;return u=u===qh?T1:u,arguments.length?u(arguments[0],arguments[1]):u}i(wt,"getIteratee"),a(wt,"getIteratee");function nf(u,d){var S=u.__data__;return j5(d)?S[typeof d=="string"?"string":"hash"]:S.map}i(nf,"getMapData"),a(nf,"getMapData");function Rh(u){for(var d=Wr(u),S=d.length;S--;){var j=d[S],te=u[j];d[S]=[j,te,ag(te)]}return d}i(Rh,"getMatchData"),a(Rh,"getMatchData");function Ha(u,d){var S=r3(u,d);return x1(S)?S:r}i(Ha,"getNative"),a(Ha,"getNative");function O5(u){var d=gr.call(u,Ls),S=u[Ls];try{u[Ls]=r;var j=!0}catch{}var te=th.call(u);return j&&(d?u[Ls]=S:delete u[Ls]),te}i(O5,"getRawTag"),a(O5,"getRawTag");var ng=h1?function(u){return u==null?[]:(u=br(u),oa(h1(u),function(d){return p3.call(u,d)}))}:Gh,N5=h1?function(u){for(var d=[];u;)aa(d,ng(u)),u=ih(u);return d}:Gh,bn=yn;(p1&&bn(new p1(new ArrayBuffer(1)))!=ve||$l&&bn(new $l)!=be||m1&&bn(m1.resolve())!=U||Wc&&bn(new Wc)!=ee||jl&&bn(new jl)!=Ie)&&(bn=a(function(u){var d=yn(u),S=d==N?u.constructor:r,j=S?qa(S):"";if(j)switch(j){case mD:return ve;case gD:return be;case vD:return U;case yD:return ee;case bD:return Ie}return d},"getTag"));function B5(u,d,S){for(var j=-1,te=S.length;++j<te;){var ce=S[j],ye=ce.size;switch(ce.type){case"drop":u+=ye;break;case"dropRight":d-=ye;break;case"take":d=vn(d,u+ye);break;case"takeRight":u=Gr(u,d-ye);break}}return{start:u,end:d}}i(B5,"getView"),a(B5,"getView");function P5(u){var d=u.match(Ze);return d?d[1].split(cr):[]}i(P5,"getWrapDetails"),a(P5,"getWrapDetails");function ig(u,d,S){d=ua(d,u);for(var j=-1,te=d.length,ce=!1;++j<te;){var ye=Yi(d[j]);if(!(ce=u!=null&&S(u,ye)))break;u=u[ye]}return ce||++j!=te?ce:(te=u==null?0:u.length,!!te&&ff(te)&&Io(ye,te)&&(Ot(u)||js(u)))}i(ig,"hasPath"),a(ig,"hasPath");function L5(u){var d=u.length,S=new u.constructor(d);return d&&typeof u[0]=="string"&&gr.call(u,"index")&&(S.index=u.index,S.input=u.input),S}i(L5,"initCloneArray"),a(L5,"initCloneArray");function og(u){return typeof u.constructor=="function"&&!nu(u)?Zc(ih(u)):{}}i(og,"initCloneObject"),a(og,"initCloneObject");function F5(u,d,S){var j=u.constructor;switch(d){case qe:return Ch(u);case ne:case ae:return new j(+u);case ve:return _5(u,S);case pe:case re:case le:case _e:case Te:case Ce:case Oe:case Ct:case Ve:return $1(u,S);case be:return new j;case Re:case ue:return new j(u);case ie:return E5(u);case ee:return new j;case Ae:return A5(u)}}i(F5,"initCloneByTag"),a(F5,"initCloneByTag");function U5(u,d){var S=d.length;if(!S)return u;var j=S-1;return d[j]=(S>1?"& ":"")+d[j],d=d.join(S>2?", ":" "),u.replace(at,`{
25
25
  /* [wrapped with `+d+`] */
26
26
  `)}i(U5,"insertWrapDetails"),a(U5,"insertWrapDetails");function $5(u){return Ot(u)||js(u)||!!(m3&&u&&u[m3])}i($5,"isFlattenable"),a($5,"isFlattenable");function Io(u,d){var S=typeof u;return d=d??E,!!d&&(S=="number"||S!="symbol"&&rn.test(u))&&u>-1&&u%1==0&&u<d}i(Io,"isIndex"),a(Io,"isIndex");function wn(u,d,S){if(!Mr(S))return!1;var j=typeof d;return(j=="number"?kn(S)&&Io(d,S.length):j=="string"&&d in S)?Ni(S[d],u):!1}i(wn,"isIterateeCall"),a(wn,"isIterateeCall");function Oh(u,d){if(Ot(u))return!1;var S=typeof u;return S=="number"||S=="symbol"||S=="boolean"||u==null||zn(u)?!0:it.test(u)||!ar.test(u)||d!=null&&u in br(d)}i(Oh,"isKey"),a(Oh,"isKey");function j5(u){var d=typeof u;return d=="string"||d=="number"||d=="symbol"||d=="boolean"?u!=="__proto__":u===null}i(j5,"isKeyable"),a(j5,"isKeyable");function Nh(u){var d=rf(u),S=se[d];if(typeof S!="function"||!(d in Kt.prototype))return!1;if(u===S)return!0;var j=rg(S);return!!j&&u===j[0]}i(Nh,"isLaziable"),a(Nh,"isLaziable");function z5(u){return!!f3&&f3 in u}i(z5,"isMasked"),a(z5,"isMasked");var AD=Qd?ko:Wh;function nu(u){var d=u&&u.constructor,S=typeof d=="function"&&d.prototype||Gc;return u===S}i(nu,"isPrototype"),a(nu,"isPrototype");function ag(u){return u===u&&!Mr(u)}i(ag,"isStrictComparable"),a(ag,"isStrictComparable");function sg(u,d){return function(S){return S==null?!1:S[u]===d&&(d!==r||u in br(S))}}i(sg,"matchesStrictComparable"),a(sg,"matchesStrictComparable");function H5(u){var d=uf(u,function(j){return S.size===p&&S.clear(),j}),S=d.cache;return d}i(H5,"memoizeCapped"),a(H5,"memoizeCapped");function q5(u,d){var S=u[1],j=d[1],te=S|j,ce=te<(O|B|k),ye=j==k&&S==$||j==k&&S==q&&u[7].length<=d[8]||j==(k|q)&&d[7].length<=d[8]&&S==$;if(!(ce||ye))return u;j&O&&(u[2]=d[2],te|=S&O?0:Z);var Ee=d[3];if(Ee){var xe=u[3];u[3]=xe?z1(xe,Ee,d[4]):Ee,u[4]=xe?sa(u[3],m):d[4]}return Ee=d[5],Ee&&(xe=u[5],u[5]=xe?H1(xe,Ee,d[6]):Ee,u[6]=xe?sa(u[5],m):d[6]),Ee=d[7],Ee&&(u[7]=Ee),j&k&&(u[8]=u[8]==null?d[8]:vn(u[8],d[8])),u[9]==null&&(u[9]=d[9]),u[0]=d[0],u[1]=te,u}i(q5,"mergeData"),a(q5,"mergeData");function V5(u){var d=[];if(u!=null)for(var S in br(u))d.push(S);return d}i(V5,"nativeKeysIn"),a(V5,"nativeKeysIn");function K5(u){return th.call(u)}i(K5,"objectToString"),a(K5,"objectToString");function cg(u,d,S){return d=Gr(d===r?u.length-1:d,0),function(){for(var j=arguments,te=-1,ce=Gr(j.length-d,0),ye=ke(ce);++te<ce;)ye[te]=j[d+te];te=-1;for(var Ee=ke(d+1);++te<d;)Ee[te]=j[te];return Ee[d]=S(ye),Un(u,this,Ee)}}i(cg,"overRest"),a(cg,"overRest");function ug(u,d){return d.length<2?u:za(u,ii(d,0,-1))}i(ug,"parent"),a(ug,"parent");function G5(u,d){for(var S=u.length,j=vn(d.length,S),te=In(u);j--;){var ce=d[j];u[j]=Io(ce,S)?te[ce]:r}return u}i(G5,"reorder"),a(G5,"reorder");function Bh(u,d){if(!(d==="constructor"&&typeof u[d]=="function")&&d!="__proto__")return u[d]}i(Bh,"safeGet"),a(Bh,"safeGet");var W5=dg(v5),of=cD||function(u,d){return Lr.setTimeout(u,d)},lg=dg(wD);function fg(u,d,S){var j=d+"";return lg(u,U5(j,Z5(P5(j),S)))}i(fg,"setWrapToString"),a(fg,"setWrapToString");function dg(u){var d=0,S=0;return function(){var j=dD(),te=w-(j-S);if(S=j,te>0){if(++d>=J)return arguments[0]}else d=0;return u.apply(r,arguments)}}i(dg,"shortOut"),a(dg,"shortOut");function af(u,d){var S=-1,j=u.length,te=j-1;for(d=d===r?j:d;++S<d;){var ce=wh(S,te),ye=u[ce];u[ce]=u[S],u[S]=ye}return u.length=d,u}i(af,"shuffleSelf"),a(af,"shuffleSelf");var J5=H5(function(u){var d=[];return u.charCodeAt(0)===46&&d.push(""),u.replace(Xe,function(S,j,te,ce){d.push(te?ce.replace(Tn,"$1"):j||S)}),d});function Yi(u){if(typeof u=="string"||zn(u))return u;var d=u+"";return d=="0"&&1/u==-v?"-0":d}i(Yi,"toKey"),a(Yi,"toKey");function qa(u){if(u!=null){try{return eh.call(u)}catch{}try{return u+""}catch{}}return""}i(qa,"toSource"),a(qa,"toSource");function Z5(u,d){return ti(I,function(S){var j="_."+S[0];d&S[1]&&!Pl(u,j)&&u.push(j)}),u.sort()}i(Z5,"updateWrapDetails"),a(Z5,"updateWrapDetails");function hg(u){if(u instanceof Kt)return u.clone();var d=new ri(u.__wrapped__,u.__chain__);return d.__actions__=In(u.__actions__),d.__index__=u.__index__,d.__values__=u.__values__,d}i(hg,"wrapperClone"),a(hg,"wrapperClone");function Y5(u,d,S){(S?wn(u,d,S):d===r)?d=1:d=Gr(Nt(d),0);var j=u==null?0:u.length;if(!j||d<1)return[];for(var te=0,ce=0,ye=ke(sh(j/d));te<j;)ye[ce++]=ii(u,te,te+=d);return ye}i(Y5,"chunk"),a(Y5,"chunk");function X5(u){for(var d=-1,S=u==null?0:u.length,j=0,te=[];++d<S;){var ce=u[d];ce&&(te[j++]=ce)}return te}i(X5,"compact"),a(X5,"compact");function Q5(){var u=arguments.length;if(!u)return[];for(var d=ke(u-1),S=arguments[0],j=u;j--;)d[j-1]=arguments[j];return aa(Ot(S)?In(S):[S],Zr(d,1))}i(Q5,"concat4"),a(Q5,"concat");var SD=Ft(function(u,d){return Or(u)?Xc(u,Zr(d,1,Or,!0)):[]}),xD=Ft(function(u,d){var S=oi(d);return Or(S)&&(S=r),Or(u)?Xc(u,Zr(d,1,Or,!0),wt(S,2)):[]}),TD=Ft(function(u,d){var S=oi(d);return Or(S)&&(S=r),Or(u)?Xc(u,Zr(d,1,Or,!0),r,S):[]});function ew(u,d,S){var j=u==null?0:u.length;return j?(d=S||d===r?1:Nt(d),ii(u,d<0?0:d,j)):[]}i(ew,"drop"),a(ew,"drop");function tw(u,d,S){var j=u==null?0:u.length;return j?(d=S||d===r?1:Nt(d),d=j-d,ii(u,0,d<0?0:d)):[]}i(tw,"dropRight"),a(tw,"dropRight");function rw(u,d){return u&&u.length?Zl(u,wt(d,3),!0,!0):[]}i(rw,"dropRightWhile"),a(rw,"dropRightWhile");function nw(u,d){return u&&u.length?Zl(u,wt(d,3),!0):[]}i(nw,"dropWhile"),a(nw,"dropWhile");function iw(u,d,S,j){var te=u==null?0:u.length;return te?(S&&typeof S!="number"&&wn(u,d,S)&&(S=0,j=te),Y3(u,d,S,j)):[]}i(iw,"fill"),a(iw,"fill");function pg(u,d,S){var j=u==null?0:u.length;if(!j)return-1;var te=S==null?0:Nt(S);return te<0&&(te=Gr(j+te,0)),Ll(u,wt(d,3),te)}i(pg,"findIndex"),a(pg,"findIndex");function mg(u,d,S){var j=u==null?0:u.length;if(!j)return-1;var te=j-1;return S!==r&&(te=Nt(S),te=S<0?Gr(j+te,0):vn(te,j-1)),Ll(u,wt(d,3),te,!0)}i(mg,"findLastIndex"),a(mg,"findLastIndex");function gg(u){var d=u==null?0:u.length;return d?Zr(u,1):[]}i(gg,"flatten"),a(gg,"flatten");function ow(u){var d=u==null?0:u.length;return d?Zr(u,v):[]}i(ow,"flattenDeep"),a(ow,"flattenDeep");function aw(u,d){var S=u==null?0:u.length;return S?(d=d===r?1:Nt(d),Zr(u,d)):[]}i(aw,"flattenDepth"),a(aw,"flattenDepth");function sw(u){for(var d=-1,S=u==null?0:u.length,j={};++d<S;){var te=u[d];j[te[0]]=te[1]}return j}i(sw,"fromPairs"),a(sw,"fromPairs");function vg(u){return u&&u.length?u[0]:r}i(vg,"head"),a(vg,"head");function cw(u,d,S){var j=u==null?0:u.length;if(!j)return-1;var te=S==null?0:Nt(S);return te<0&&(te=Gr(j+te,0)),Ns(u,d,te)}i(cw,"indexOf"),a(cw,"indexOf");function uw(u){var d=u==null?0:u.length;return d?ii(u,0,-1):[]}i(uw,"initial"),a(uw,"initial");var CD=Ft(function(u){var d=Tr(u,xh);return d.length&&d[0]===u[0]?mh(d):[]}),MD=Ft(function(u){var d=oi(u),S=Tr(u,xh);return d===oi(S)?d=r:S.pop(),S.length&&S[0]===u[0]?mh(S,wt(d,2)):[]}),ID=Ft(function(u){var d=oi(u),S=Tr(u,xh);return d=typeof d=="function"?d:r,d&&S.pop(),S.length&&S[0]===u[0]?mh(S,r,d):[]});function lw(u,d){return u==null?"":lD.call(u,d)}i(lw,"join"),a(lw,"join");function oi(u){var d=u==null?0:u.length;return d?u[d-1]:r}i(oi,"last2"),a(oi,"last");function fw(u,d,S){var j=u==null?0:u.length;if(!j)return-1;var te=j;return S!==r&&(te=Nt(S),te=te<0?Gr(j+te,0):vn(te,j-1)),d===d?s3(u,d,te):Ll(u,i1,te,!0)}i(fw,"lastIndexOf"),a(fw,"lastIndexOf");function dw(u,d){return u&&u.length?k1(u,Nt(d)):r}i(dw,"nth"),a(dw,"nth");var kD=Ft(yg);function yg(u,d){return u&&u.length&&d&&d.length?bh(u,d):u}i(yg,"pullAll"),a(yg,"pullAll");function hw(u,d,S){return u&&u.length&&d&&d.length?bh(u,d,wt(S,2)):u}i(hw,"pullAllBy"),a(hw,"pullAllBy");function pw(u,d,S){return u&&u.length&&d&&d.length?bh(u,d,r,S):u}i(pw,"pullAllWith"),a(pw,"pullAllWith");var DD=Mo(function(u,d){var S=u==null?0:u.length,j=dh(u,d);return O1(u,Tr(d,function(te){return Io(te,S)?+te:te}).sort(j1)),j});function mw(u,d){var S=[];if(!(u&&u.length))return S;var j=-1,te=[],ce=u.length;for(d=wt(d,3);++j<ce;){var ye=u[j];d(ye,j,u)&&(S.push(ye),te.push(j))}return O1(u,te),S}i(mw,"remove"),a(mw,"remove");function Ph(u){return u==null?u:pD.call(u)}i(Ph,"reverse"),a(Ph,"reverse");function gw(u,d,S){var j=u==null?0:u.length;return j?(S&&typeof S!="number"&&wn(u,d,S)?(d=0,S=j):(d=d==null?0:Nt(d),S=S===r?j:Nt(S)),ii(u,d,S)):[]}i(gw,"slice2"),a(gw,"slice");function vw(u,d){return Jl(u,d)}i(vw,"sortedIndex"),a(vw,"sortedIndex");function yw(u,d,S){return Eh(u,d,wt(S,2))}i(yw,"sortedIndexBy"),a(yw,"sortedIndexBy");function bw(u,d){var S=u==null?0:u.length;if(S){var j=Jl(u,d);if(j<S&&Ni(u[j],d))return j}return-1}i(bw,"sortedIndexOf"),a(bw,"sortedIndexOf");function ww(u,d){return Jl(u,d,!0)}i(ww,"sortedLastIndex"),a(ww,"sortedLastIndex");function _w(u,d,S){return Eh(u,d,wt(S,2),!0)}i(_w,"sortedLastIndexBy"),a(_w,"sortedLastIndexBy");function Ew(u,d){var S=u==null?0:u.length;if(S){var j=Jl(u,d,!0)-1;if(Ni(u[j],d))return j}return-1}i(Ew,"sortedLastIndexOf"),a(Ew,"sortedLastIndexOf");function Aw(u){return u&&u.length?N1(u):[]}i(Aw,"sortedUniq"),a(Aw,"sortedUniq");function Sw(u,d){return u&&u.length?N1(u,wt(d,2)):[]}i(Sw,"sortedUniqBy"),a(Sw,"sortedUniqBy");function xw(u){var d=u==null?0:u.length;return d?ii(u,1,d):[]}i(xw,"tail"),a(xw,"tail");function Tw(u,d,S){return u&&u.length?(d=S||d===r?1:Nt(d),ii(u,0,d<0?0:d)):[]}i(Tw,"take2"),a(Tw,"take");function Cw(u,d,S){var j=u==null?0:u.length;return j?(d=S||d===r?1:Nt(d),d=j-d,ii(u,d<0?0:d,j)):[]}i(Cw,"takeRight"),a(Cw,"takeRight");function Mw(u,d){return u&&u.length?Zl(u,wt(d,3),!1,!0):[]}i(Mw,"takeRightWhile"),a(Mw,"takeRightWhile");function Iw(u,d){return u&&u.length?Zl(u,wt(d,3)):[]}i(Iw,"takeWhile"),a(Iw,"takeWhile");var RD=Ft(function(u){return ca(Zr(u,1,Or,!0))}),OD=Ft(function(u){var d=oi(u);return Or(d)&&(d=r),ca(Zr(u,1,Or,!0),wt(d,2))}),ND=Ft(function(u){var d=oi(u);return d=typeof d=="function"?d:r,ca(Zr(u,1,Or,!0),r,d)});function kw(u){return u&&u.length?ca(u):[]}i(kw,"uniq"),a(kw,"uniq");function Dw(u,d){return u&&u.length?ca(u,wt(d,2)):[]}i(Dw,"uniqBy"),a(Dw,"uniqBy");function Rw(u,d){return d=typeof d=="function"?d:r,u&&u.length?ca(u,r,d):[]}i(Rw,"uniqWith"),a(Rw,"uniqWith");function Lh(u){if(!(u&&u.length))return[];var d=0;return u=oa(u,function(S){if(Or(S))return d=Gr(S.length,d),!0}),Jd(d,function(S){return Tr(u,Kd(S))})}i(Lh,"unzip"),a(Lh,"unzip");function bg(u,d){if(!(u&&u.length))return[];var S=Lh(u);return d==null?S:Tr(S,function(j){return Un(d,r,j)})}i(bg,"unzipWith"),a(bg,"unzipWith");var BD=Ft(function(u,d){return Or(u)?Xc(u,d):[]}),PD=Ft(function(u){return Sh(oa(u,Or))}),LD=Ft(function(u){var d=oi(u);return Or(d)&&(d=r),Sh(oa(u,Or),wt(d,2))}),FD=Ft(function(u){var d=oi(u);return d=typeof d=="function"?d:r,Sh(oa(u,Or),r,d)}),UD=Ft(Lh);function Ow(u,d){return F1(u||[],d||[],Yc)}i(Ow,"zipObject"),a(Ow,"zipObject");function Nw(u,d){return F1(u||[],d||[],tu)}i(Nw,"zipObjectDeep"),a(Nw,"zipObjectDeep");var $D=Ft(function(u){var d=u.length,S=d>1?u[d-1]:r;return S=typeof S=="function"?(u.pop(),S):r,bg(u,S)});function wg(u){var d=se(u);return d.__chain__=!0,d}i(wg,"chain"),a(wg,"chain");function Bw(u,d){return d(u),u}i(Bw,"tap"),a(Bw,"tap");function sf(u,d){return d(u)}i(sf,"thru"),a(sf,"thru");var jD=Mo(function(u){var d=u.length,S=d?u[0]:0,j=this.__wrapped__,te=a(function(ce){return dh(ce,u)},"interceptor");return d>1||this.__actions__.length||!(j instanceof Kt)||!Io(S)?this.thru(te):(j=j.slice(S,+S+(d?1:0)),j.__actions__.push({func:sf,args:[te],thisArg:r}),new ri(j,this.__chain__).thru(function(ce){return d&&!ce.length&&ce.push(r),ce}))});function Pw(){return wg(this)}i(Pw,"wrapperChain"),a(Pw,"wrapperChain");function Lw(){return new ri(this.value(),this.__chain__)}i(Lw,"wrapperCommit"),a(Lw,"wrapperCommit");function Fw(){this.__values__===r&&(this.__values__=Og(this.value()));var u=this.__index__>=this.__values__.length,d=u?r:this.__values__[this.__index__++];return{done:u,value:d}}i(Fw,"wrapperNext"),a(Fw,"wrapperNext");function Uw(){return this}i(Uw,"wrapperToIterator"),a(Uw,"wrapperToIterator");function $w(u){for(var d,S=this;S instanceof ql;){var j=hg(S);j.__index__=0,j.__values__=r,d?te.__wrapped__=j:d=j;var te=j;S=S.__wrapped__}return te.__wrapped__=u,d}i($w,"wrapperPlant"),a($w,"wrapperPlant");function jw(){var u=this.__wrapped__;if(u instanceof Kt){var d=u;return this.__actions__.length&&(d=new Kt(this)),d=d.reverse(),d.__actions__.push({func:sf,args:[Ph],thisArg:r}),new ri(d,this.__chain__)}return this.thru(Ph)}i(jw,"wrapperReverse"),a(jw,"wrapperReverse");function zw(){return L1(this.__wrapped__,this.__actions__)}i(zw,"wrapperValue"),a(zw,"wrapperValue");var zD=Yl(function(u,d,S){gr.call(u,S)?++u[S]:To(u,S,1)});function Hw(u,d,S){var j=Ot(u)?r1:Z3;return S&&wn(u,d,S)&&(d=r),j(u,wt(d,3))}i(Hw,"every"),a(Hw,"every");function qw(u,d){var S=Ot(u)?oa:_1;return S(u,wt(d,3))}i(qw,"filter2"),a(qw,"filter");var HD=G1(pg),qD=G1(mg);function Vw(u,d){return Zr(cf(u,d),1)}i(Vw,"flatMap"),a(Vw,"flatMap");function Kw(u,d){return Zr(cf(u,d),v)}i(Kw,"flatMapDeep"),a(Kw,"flatMapDeep");function Gw(u,d,S){return S=S===r?1:Nt(S),Zr(cf(u,d),S)}i(Gw,"flatMapDepth"),a(Gw,"flatMapDepth");function _g(u,d){var S=Ot(u)?ti:ja;return S(u,wt(d,3))}i(_g,"forEach"),a(_g,"forEach");function Eg(u,d){var S=Ot(u)?G2:J3;return S(u,wt(d,3))}i(Eg,"forEachRight"),a(Eg,"forEachRight");var VD=Yl(function(u,d,S){gr.call(u,S)?u[S].push(d):To(u,S,[d])});function Ww(u,d,S,j){u=kn(u)?u:zs(u),S=S&&!j?Nt(S):0;var te=u.length;return S<0&&(S=Gr(te+S,0)),df(u)?S<=te&&u.indexOf(d,S)>-1:!!te&&Ns(u,d,S)>-1}i(Ww,"includes"),a(Ww,"includes");var KD=Ft(function(u,d,S){var j=-1,te=typeof d=="function",ce=kn(u)?ke(u.length):[];return ja(u,function(ye){ce[++j]=te?Un(d,ye,S):Qc(ye,d,S)}),ce}),GD=Yl(function(u,d,S){To(u,S,d)});function cf(u,d){var S=Ot(u)?Tr:C1;return S(u,wt(d,3))}i(cf,"map2"),a(cf,"map");function Jw(u,d,S,j){return u==null?[]:(Ot(d)||(d=d==null?[]:[d]),S=j?r:S,Ot(S)||(S=S==null?[]:[S]),D1(u,d,S))}i(Jw,"orderBy"),a(Jw,"orderBy");var WD=Yl(function(u,d,S){u[S?0:1].push(d)},function(){return[[],[]]});function Zw(u,d,S){var j=Ot(u)?qd:a1,te=arguments.length<3;return j(u,wt(d,4),S,te,ja)}i(Zw,"reduce"),a(Zw,"reduce");function Yw(u,d,S){var j=Ot(u)?W2:a1,te=arguments.length<3;return j(u,wt(d,4),S,te,J3)}i(Yw,"reduceRight"),a(Yw,"reduceRight");function Xw(u,d){var S=Ot(u)?oa:_1;return S(u,lf(wt(d,3)))}i(Xw,"reject"),a(Xw,"reject");function Qw(u){var d=Ot(u)?v1:m5;return d(u)}i(Qw,"sample"),a(Qw,"sample");function e4(u,d,S){(S?wn(u,d,S):d===r)?d=1:d=Nt(d);var j=Ot(u)?q3:g5;return j(u,d)}i(e4,"sampleSize"),a(e4,"sampleSize");function t4(u){var d=Ot(u)?V3:y5;return d(u)}i(t4,"shuffle"),a(t4,"shuffle");function r4(u){if(u==null)return 0;if(kn(u))return df(u)?Ps(u):u.length;var d=bn(u);return d==be||d==ee?u.size:vh(u).length}i(r4,"size"),a(r4,"size");function n4(u,d,S){var j=Ot(u)?Vd:b5;return S&&wn(u,d,S)&&(d=r),j(u,wt(d,3))}i(n4,"some"),a(n4,"some");var JD=Ft(function(u,d){if(u==null)return[];var S=d.length;return S>1&&wn(u,d[0],d[1])?d=[]:S>2&&wn(d[0],d[1],d[2])&&(d=[d[0]]),D1(u,Zr(d,1),[])}),Fh=sD||function(){return Lr.Date.now()};function i4(u,d){if(typeof d!="function")throw new Ri(c);return u=Nt(u),function(){if(--u<1)return d.apply(this,arguments)}}i(i4,"after"),a(i4,"after");function Ag(u,d,S){return d=S?r:d,d=u&&d==null?u.length:d,Co(u,k,r,r,r,r,d)}i(Ag,"ary"),a(Ag,"ary");function Sg(u,d){var S;if(typeof d!="function")throw new Ri(c);return u=Nt(u),function(){return--u>0&&(S=d.apply(this,arguments)),u<=1&&(d=r),S}}i(Sg,"before"),a(Sg,"before");var xg=Ft(function(u,d,S){var j=O;if(S.length){var te=sa(S,$s(xg));j|=Q}return Co(u,j,d,S,te)}),o4=Ft(function(u,d,S){var j=O|B;if(S.length){var te=sa(S,$s(o4));j|=Q}return Co(d,j,u,S,te)});function Tg(u,d,S){d=S?r:d;var j=Co(u,$,r,r,r,r,r,d);return j.placeholder=Tg.placeholder,j}i(Tg,"curry"),a(Tg,"curry");function Cg(u,d,S){d=S?r:d;var j=Co(u,z,r,r,r,r,r,d);return j.placeholder=Cg.placeholder,j}i(Cg,"curryRight"),a(Cg,"curryRight");function Mg(u,d,S){var j,te,ce,ye,Ee,xe,Fe=0,Ue=!1,je=!1,Ye=!0;if(typeof u!="function")throw new Ri(c);d=ai(d)||0,Mr(S)&&(Ue=!!S.leading,je="maxWait"in S,ce=je?Gr(ai(S.maxWait)||0,d):ce,Ye="trailing"in S?!!S.trailing:Ye);function pt(Fr){var Xi=j,fa=te;return j=te=r,Fe=Fr,ye=u.apply(fa,Xi),ye}i(pt,"invokeFunc"),a(pt,"invokeFunc");function St(Fr){return Fe=Fr,Ee=of(Ht,d),Ue?pt(Fr):ye}i(St,"leadingEdge"),a(St,"leadingEdge");function Lt(Fr){var Xi=Fr-xe,fa=Fr-Fe,t8=d-Xi;return je?vn(t8,ce-fa):t8}i(Lt,"remainingWait"),a(Lt,"remainingWait");function _t(Fr){var Xi=Fr-xe,fa=Fr-Fe;return xe===r||Xi>=d||Xi<0||je&&fa>=ce}i(_t,"shouldInvoke"),a(_t,"shouldInvoke");function Ht(){var Fr=Fh();if(_t(Fr))return Gt(Fr);Ee=of(Ht,Lt(Fr))}i(Ht,"timerExpired"),a(Ht,"timerExpired");function Gt(Fr){return Ee=r,Ye&&j?pt(Fr):(j=te=r,ye)}i(Gt,"trailingEdge"),a(Gt,"trailingEdge");function Hn(){Ee!==r&&w5(Ee),Fe=0,j=xe=te=Ee=r}i(Hn,"cancel"),a(Hn,"cancel");function _n(){return Ee===r?ye:Gt(Fh())}i(_n,"flush"),a(_n,"flush");function qn(){var Fr=Fh(),Xi=_t(Fr);if(j=arguments,te=this,xe=Fr,Xi){if(Ee===r)return St(xe);if(je)return w5(Ee),Ee=of(Ht,d),pt(xe)}return Ee===r&&(Ee=of(Ht,d)),ye}return i(qn,"debounced"),a(qn,"debounced"),qn.cancel=Hn,qn.flush=_n,qn}i(Mg,"debounce"),a(Mg,"debounce");var ZD=Ft(function(u,d){return w1(u,1,d)}),YD=Ft(function(u,d,S){return w1(u,ai(d)||0,S)});function a4(u){return Co(u,he)}i(a4,"flip"),a(a4,"flip");function uf(u,d){if(typeof u!="function"||d!=null&&typeof d!="function")throw new Ri(c);var S=a(function(){var j=arguments,te=d?d.apply(this,j):j[0],ce=S.cache;if(ce.has(te))return ce.get(te);var ye=u.apply(this,j);return S.cache=ce.set(te,ye)||ce,ye},"memoized");return S.cache=new(uf.Cache||xo),S}i(uf,"memoize"),a(uf,"memoize"),uf.Cache=xo;function lf(u){if(typeof u!="function")throw new Ri(c);return function(){var d=arguments;switch(d.length){case 0:return!u.call(this);case 1:return!u.call(this,d[0]);case 2:return!u.call(this,d[0],d[1]);case 3:return!u.call(this,d[0],d[1],d[2])}return!u.apply(this,d)}}i(lf,"negate"),a(lf,"negate");function s4(u){return Sg(2,u)}i(s4,"once"),a(s4,"once");var XD=_D(function(u,d){d=d.length==1&&Ot(d[0])?Tr(d[0],$n(wt())):Tr(Zr(d,1),$n(wt()));var S=d.length;return Ft(function(j){for(var te=-1,ce=vn(j.length,S);++te<ce;)j[te]=d[te].call(this,j[te]);return Un(u,this,j)})}),Ig=Ft(function(u,d){var S=sa(d,$s(Ig));return Co(u,Q,r,d,S)}),c4=Ft(function(u,d){var S=sa(d,$s(c4));return Co(u,Y,r,d,S)}),QD=Mo(function(u,d){return Co(u,q,r,r,r,d)});function u4(u,d){if(typeof u!="function")throw new Ri(c);return d=d===r?d:Nt(d),Ft(u,d)}i(u4,"rest"),a(u4,"rest");function l4(u,d){if(typeof u!="function")throw new Ri(c);return d=d==null?0:Gr(Nt(d),0),Ft(function(S){var j=S[d],te=la(S,0,d);return j&&aa(te,j),Un(u,this,te)})}i(l4,"spread"),a(l4,"spread");function f4(u,d,S){var j=!0,te=!0;if(typeof u!="function")throw new Ri(c);return Mr(S)&&(j="leading"in S?!!S.leading:j,te="trailing"in S?!!S.trailing:te),Mg(u,d,{leading:j,maxWait:d,trailing:te})}i(f4,"throttle2"),a(f4,"throttle");function d4(u){return Ag(u,1)}i(d4,"unary"),a(d4,"unary");function h4(u,d){return Ig(Th(d),u)}i(h4,"wrap"),a(h4,"wrap");function p4(){if(!arguments.length)return[];var u=arguments[0];return Ot(u)?u:[u]}i(p4,"castArray"),a(p4,"castArray");function m4(u){return ni(u,_)}i(m4,"clone"),a(m4,"clone");function g4(u,d){return d=typeof d=="function"?d:r,ni(u,_,d)}i(g4,"cloneWith"),a(g4,"cloneWith");function v4(u){return ni(u,y|_)}i(v4,"cloneDeep6"),a(v4,"cloneDeep");function y4(u,d){return d=typeof d=="function"?d:r,ni(u,y|_,d)}i(y4,"cloneDeepWith"),a(y4,"cloneDeepWith");function b4(u,d){return d==null||b1(u,d,Wr(d))}i(b4,"conformsTo"),a(b4,"conformsTo");function Ni(u,d){return u===d||u!==u&&d!==d}i(Ni,"eq4"),a(Ni,"eq");var eR=tf(ph),tR=tf(function(u,d){return u>=d}),js=S1(function(){return arguments}())?S1:function(u){return kr(u)&&gr.call(u,"callee")&&!p3.call(u,"callee")},Ot=ke.isArray,rR=Os?$n(Os):n5;function kn(u){return u!=null&&ff(u.length)&&!ko(u)}i(kn,"isArrayLike2"),a(kn,"isArrayLike");function Or(u){return kr(u)&&kn(u)}i(Or,"isArrayLikeObject"),a(Or,"isArrayLikeObject");function w4(u){return u===!0||u===!1||kr(u)&&yn(u)==ne}i(w4,"isBoolean"),a(w4,"isBoolean");var Va=uD||Wh,nR=j2?$n(j2):i5;function _4(u){return kr(u)&&u.nodeType===1&&!iu(u)}i(_4,"isElement"),a(_4,"isElement");function E4(u){if(u==null)return!0;if(kn(u)&&(Ot(u)||typeof u=="string"||typeof u.splice=="function"||Va(u)||ou(u)||js(u)))return!u.length;var d=bn(u);if(d==be||d==ee)return!u.size;if(nu(u))return!vh(u).length;for(var S in u)if(gr.call(u,S))return!1;return!0}i(E4,"isEmpty"),a(E4,"isEmpty");function A4(u,d){return eu(u,d)}i(A4,"isEqual"),a(A4,"isEqual");function S4(u,d,S){S=typeof S=="function"?S:r;var j=S?S(u,d):r;return j===r?eu(u,d,r,S):!!j}i(S4,"isEqualWith"),a(S4,"isEqualWith");function Uh(u){if(!kr(u))return!1;var d=yn(u);return d==V||d==M||typeof u.message=="string"&&typeof u.name=="string"&&!iu(u)}i(Uh,"isError"),a(Uh,"isError");function x4(u){return typeof u=="number"&&g3(u)}i(x4,"isFinite2"),a(x4,"isFinite");function ko(u){if(!Mr(u))return!1;var d=yn(u);return d==oe||d==fe||d==L||d==W}i(ko,"isFunction2"),a(ko,"isFunction");function kg(u){return typeof u=="number"&&u==Nt(u)}i(kg,"isInteger3"),a(kg,"isInteger");function ff(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=E}i(ff,"isLength"),a(ff,"isLength");function Mr(u){var d=typeof u;return u!=null&&(d=="object"||d=="function")}i(Mr,"isObject"),a(Mr,"isObject");function kr(u){return u!=null&&typeof u=="object"}i(kr,"isObjectLike"),a(kr,"isObjectLike");var T4=z2?$n(z2):a5;function C4(u,d){return u===d||gh(u,d,Rh(d))}i(C4,"isMatch"),a(C4,"isMatch");function M4(u,d,S){return S=typeof S=="function"?S:r,gh(u,d,Rh(d),S)}i(M4,"isMatchWith"),a(M4,"isMatchWith");function I4(u){return Dg(u)&&u!=+u}i(I4,"isNaN2"),a(I4,"isNaN");function k4(u){if(AD(u))throw new It(s);return x1(u)}i(k4,"isNative"),a(k4,"isNative");function D4(u){return u===null}i(D4,"isNull"),a(D4,"isNull");function R4(u){return u==null}i(R4,"isNil"),a(R4,"isNil");function Dg(u){return typeof u=="number"||kr(u)&&yn(u)==Re}i(Dg,"isNumber"),a(Dg,"isNumber");function iu(u){if(!kr(u)||yn(u)!=N)return!1;var d=ih(u);if(d===null)return!0;var S=gr.call(d,"constructor")&&d.constructor;return typeof S=="function"&&S instanceof S&&eh.call(S)==nD}i(iu,"isPlainObject"),a(iu,"isPlainObject");var Rg=H2?$n(H2):s5;function O4(u){return kg(u)&&u>=-E&&u<=E}i(O4,"isSafeInteger"),a(O4,"isSafeInteger");var N4=q2?$n(q2):c5;function df(u){return typeof u=="string"||!Ot(u)&&kr(u)&&yn(u)==ue}i(df,"isString"),a(df,"isString");function zn(u){return typeof u=="symbol"||kr(u)&&yn(u)==Ae}i(zn,"isSymbol"),a(zn,"isSymbol");var ou=V2?$n(V2):u5;function B4(u){return u===r}i(B4,"isUndefined"),a(B4,"isUndefined");function P4(u){return kr(u)&&bn(u)==Ie}i(P4,"isWeakMap"),a(P4,"isWeakMap");function L4(u){return kr(u)&&yn(u)==Pe}i(L4,"isWeakSet"),a(L4,"isWeakSet");var iR=tf(yh),oR=tf(function(u,d){return u<=d});function Og(u){if(!u)return[];if(kn(u))return df(u)?Di(u):In(u);if(Ul&&u[Ul])return i3(u[Ul]());var d=bn(u),S=d==be?Yd:d==ee?Fl:zs;return S(u)}i(Og,"toArray"),a(Og,"toArray");function Do(u){if(!u)return u===0?u:0;if(u=ai(u),u===v||u===-v){var d=u<0?-1:1;return d*R}return u===u?u:0}i(Do,"toFinite"),a(Do,"toFinite");function Nt(u){var d=Do(u),S=d%1;return d===d?S?d-S:d:0}i(Nt,"toInteger"),a(Nt,"toInteger");function Ng(u){return u?$a(Nt(u),0,A):0}i(Ng,"toLength"),a(Ng,"toLength");function ai(u){if(typeof u=="number")return u;if(zn(u))return C;if(Mr(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=Mr(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=s1(u);var S=er.test(u);return S||tn.test(u)?on(u.slice(2),S?2:8):hn.test(u)?C:+u}i(ai,"toNumber"),a(ai,"toNumber");function Bg(u){return Zi(u,Dn(u))}i(Bg,"toPlainObject"),a(Bg,"toPlainObject");function F4(u){return u?$a(Nt(u),-E,E):u===0?u:0}i(F4,"toSafeInteger"),a(F4,"toSafeInteger");function dr(u){return u==null?"":jn(u)}i(dr,"toString4"),a(dr,"toString");var aR=Fs(function(u,d){if(nu(d)||kn(d)){Zi(d,Wr(d),u);return}for(var S in d)gr.call(d,S)&&Yc(u,S,d[S])}),U4=Fs(function(u,d){Zi(d,Dn(d),u)}),$h=Fs(function(u,d,S,j){Zi(d,Dn(d),u,j)}),sR=Fs(function(u,d,S,j){Zi(d,Wr(d),u,j)}),cR=Mo(dh);function $4(u,d){var S=Zc(u);return d==null?S:y1(S,d)}i($4,"create2"),a($4,"create");var uR=Ft(function(u,d){u=br(u);var S=-1,j=d.length,te=j>2?d[2]:r;for(te&&wn(d[0],d[1],te)&&(j=1);++S<j;)for(var ce=d[S],ye=Dn(ce),Ee=-1,xe=ye.length;++Ee<xe;){var Fe=ye[Ee],Ue=u[Fe];(Ue===r||Ni(Ue,Gc[Fe])&&!gr.call(u,Fe))&&(u[Fe]=ce[Fe])}return u}),lR=Ft(function(u){return u.push(r,eg),Un(X4,r,u)});function j4(u,d){return n1(u,wt(d,3),Ji)}i(j4,"findKey"),a(j4,"findKey");function z4(u,d){return n1(u,wt(d,3),hh)}i(z4,"findLastKey"),a(z4,"findLastKey");function H4(u,d){return u==null?u:E1(u,wt(d,3),Dn)}i(H4,"forIn"),a(H4,"forIn");function q4(u,d){return u==null?u:X3(u,wt(d,3),Dn)}i(q4,"forInRight"),a(q4,"forInRight");function V4(u,d){return u&&Ji(u,wt(d,3))}i(V4,"forOwn"),a(V4,"forOwn");function K4(u,d){return u&&hh(u,wt(d,3))}i(K4,"forOwnRight"),a(K4,"forOwnRight");function G4(u){return u==null?[]:Gl(u,Wr(u))}i(G4,"functions"),a(G4,"functions");function W4(u){return u==null?[]:Gl(u,Dn(u))}i(W4,"functionsIn"),a(W4,"functionsIn");function jh(u,d,S){var j=u==null?r:za(u,d);return j===r?S:j}i(jh,"get2"),a(jh,"get");function J4(u,d){return u!=null&&ig(u,d,Q3)}i(J4,"has"),a(J4,"has");function zh(u,d){return u!=null&&ig(u,d,e5)}i(zh,"hasIn"),a(zh,"hasIn");var fR=J1(function(u,d,S){d!=null&&typeof d.toString!="function"&&(d=th.call(d)),u[d]=S},Hh(Rn)),dR=J1(function(u,d,S){d!=null&&typeof d.toString!="function"&&(d=th.call(d)),gr.call(u,d)?u[d].push(S):u[d]=[S]},wt),hR=Ft(Qc);function Wr(u){return kn(u)?g1(u):vh(u)}i(Wr,"keys"),a(Wr,"keys");function Dn(u){return kn(u)?g1(u,!0):l5(u)}i(Dn,"keysIn"),a(Dn,"keysIn");function Z4(u,d){var S={};return d=wt(d,3),Ji(u,function(j,te,ce){To(S,d(j,te,ce),j)}),S}i(Z4,"mapKeys"),a(Z4,"mapKeys");function Y4(u,d){var S={};return d=wt(d,3),Ji(u,function(j,te,ce){To(S,te,d(j,te,ce))}),S}i(Y4,"mapValues"),a(Y4,"mapValues");var pR=Fs(function(u,d,S){Wl(u,d,S)}),X4=Fs(function(u,d,S,j){Wl(u,d,S,j)}),mR=Mo(function(u,d){var S={};if(u==null)return S;var j=!1;d=Tr(d,function(ce){return ce=ua(ce,u),j||(j=ce.length>1),ce}),Zi(u,Dh(u),S),j&&(S=ni(S,y|b|_,k5));for(var te=d.length;te--;)Ah(S,d[te]);return S});function Q4(u,d){return Pg(u,lf(wt(d)))}i(Q4,"omitBy"),a(Q4,"omitBy");var gR=Mo(function(u,d){return u==null?{}:d5(u,d)});function Pg(u,d){if(u==null)return{};var S=Tr(Dh(u),function(j){return[j]});return d=wt(d),R1(u,S,function(j,te){return d(j,te[0])})}i(Pg,"pickBy"),a(Pg,"pickBy");function e_(u,d,S){d=ua(d,u);var j=-1,te=d.length;for(te||(te=1,u=r);++j<te;){var ce=u==null?r:u[Yi(d[j])];ce===r&&(j=te,ce=S),u=ko(ce)?ce.call(u):ce}return u}i(e_,"result"),a(e_,"result");function t_(u,d,S){return u==null?u:tu(u,d,S)}i(t_,"set"),a(t_,"set");function r_(u,d,S,j){return j=typeof j=="function"?j:r,u==null?u:tu(u,d,S,j)}i(r_,"setWith"),a(r_,"setWith");var n_=X1(Wr),i_=X1(Dn);function o_(u,d,S){var j=Ot(u),te=j||Va(u)||ou(u);if(d=wt(d,4),S==null){var ce=u&&u.constructor;te?S=j?new ce:[]:Mr(u)?S=ko(ce)?Zc(ih(u)):{}:S={}}return(te?ti:Ji)(u,function(ye,Ee,xe){return d(S,ye,Ee,xe)}),S}i(o_,"transform"),a(o_,"transform");function a_(u,d){return u==null?!0:Ah(u,d)}i(a_,"unset"),a(a_,"unset");function s_(u,d,S){return u==null?u:P1(u,d,Th(S))}i(s_,"update2"),a(s_,"update");function c_(u,d,S,j){return j=typeof j=="function"?j:r,u==null?u:P1(u,d,Th(S),j)}i(c_,"updateWith"),a(c_,"updateWith");function zs(u){return u==null?[]:Zd(u,Wr(u))}i(zs,"values"),a(zs,"values");function u_(u){return u==null?[]:Zd(u,Dn(u))}i(u_,"valuesIn"),a(u_,"valuesIn");function l_(u,d,S){return S===r&&(S=d,d=r),S!==r&&(S=ai(S),S=S===S?S:0),d!==r&&(d=ai(d),d=d===d?d:0),$a(ai(u),d,S)}i(l_,"clamp"),a(l_,"clamp");function f_(u,d,S){return d=Do(d),S===r?(S=d,d=0):S=Do(S),u=ai(u),t5(u,d,S)}i(f_,"inRange"),a(f_,"inRange");function d_(u,d,S){if(S&&typeof S!="boolean"&&wn(u,d,S)&&(d=S=r),S===r&&(typeof d=="boolean"?(S=d,d=r):typeof u=="boolean"&&(S=u,u=r)),u===r&&d===r?(u=0,d=1):(u=Do(u),d===r?(d=u,u=0):d=Do(d)),u>d){var j=u;u=d,d=j}if(S||u%1||d%1){var te=v3();return vn(u+te*(d-u+qr("1e-"+((te+"").length-1))),d)}return wh(u,d)}i(d_,"random"),a(d_,"random");var vR=Us(function(u,d,S){return d=d.toLowerCase(),u+(S?Lg(d):d)});function Lg(u){return Ug(dr(u).toLowerCase())}i(Lg,"capitalize"),a(Lg,"capitalize");function Fg(u){return u=dr(u),u&&u.replace(Rr,Zk).replace($d,"")}i(Fg,"deburr"),a(Fg,"deburr");function h_(u,d,S){u=dr(u),d=jn(d);var j=u.length;S=S===r?j:$a(Nt(S),0,j);var te=S;return S-=d.length,S>=0&&u.slice(S,te)==d}i(h_,"endsWith"),a(h_,"endsWith");function p_(u){return u=dr(u),u&&ut.test(u)?u.replace(Dr,Yk):u}i(p_,"escape"),a(p_,"escape");function m_(u){return u=dr(u),u&&ot.test(u)?u.replace(Qt,"\\$&"):u}i(m_,"escapeRegExp"),a(m_,"escapeRegExp");var yR=Us(function(u,d,S){return u+(S?"-":"")+d.toLowerCase()}),bR=Us(function(u,d,S){return u+(S?" ":"")+d.toLowerCase()}),wR=K1("toLowerCase");function g_(u,d,S){u=dr(u),d=Nt(d);var j=d?Ps(u):0;if(!d||j>=d)return u;var te=(d-j)/2;return ef(ch(te),S)+u+ef(sh(te),S)}i(g_,"pad2"),a(g_,"pad");function v_(u,d,S){u=dr(u),d=Nt(d);var j=d?Ps(u):0;return d&&j<d?u+ef(d-j,S):u}i(v_,"padEnd"),a(v_,"padEnd");function y_(u,d,S){u=dr(u),d=Nt(d);var j=d?Ps(u):0;return d&&j<d?ef(d-j,S)+u:u}i(y_,"padStart"),a(y_,"padStart");function b_(u,d,S){return S||d==null?d=0:d&&(d=+d),hD(dr(u).replace(et,""),d||0)}i(b_,"parseInt2"),a(b_,"parseInt");function w_(u,d,S){return(S?wn(u,d,S):d===r)?d=1:d=Nt(d),_h(dr(u),d)}i(w_,"repeat"),a(w_,"repeat");function __(){var u=arguments,d=dr(u[0]);return u.length<3?d:d.replace(u[1],u[2])}i(__,"replace"),a(__,"replace");var _R=Us(function(u,d,S){return u+(S?"_":"")+d.toLowerCase()});function E_(u,d,S){return S&&typeof S!="number"&&wn(u,d,S)&&(d=S=r),S=S===r?A:S>>>0,S?(u=dr(u),u&&(typeof d=="string"||d!=null&&!Rg(d))&&(d=jn(d),!d&&Bs(u))?la(Di(u),0,S):u.split(d,S)):[]}i(E_,"split"),a(E_,"split");var ER=Us(function(u,d,S){return u+(S?" ":"")+Ug(d)});function A_(u,d,S){return u=dr(u),S=S==null?0:$a(Nt(S),0,u.length),d=jn(d),u.slice(S,S+d.length)==d}i(A_,"startsWith"),a(A_,"startsWith");function S_(u,d,S){var j=se.templateSettings;S&&wn(u,d,S)&&(d=r),u=dr(u),d=$h({},d,j,Q1);var te=$h({},d.imports,j.imports,Q1),ce=Wr(te),ye=Zd(te,ce),Ee,xe,Fe=0,Ue=d.interpolate||Hr,je="__p += '",Ye=d1((d.escape||Hr).source+"|"+Ue.source+"|"+(Ue===nt?At:Hr).source+"|"+(d.evaluate||Hr).source+"|$","g"),pt="//# sourceURL="+(gr.call(d,"sourceURL")?(d.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++qc+"]")+`
27
27
  `;u.replace(Ye,function(_t,Ht,Gt,Hn,_n,qn){return Gt||(Gt=Hn),je+=u.slice(Fe,qn).replace(nn,t3),Ht&&(Ee=!0,je+=`' +
@@ -841,7 +841,7 @@ HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
841
841
  `;function QC(e){return typeof e=="string"&&(e=A0(e)),Fm(HC([A0(Rz),A0(String(e.length)),e]))}i(QC,"hashMessage");a(QC,"hashMessage");var Pt=ir(Tx()),Aa=ir(wm());function $c(e,t,r){return r={path:t,exports:{},require:function(n,o){return eM(n,o??r.path)}},e(r,r.exports),r.exports}i($c,"createCommonjsModule");a($c,"createCommonjsModule");function eM(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}i(eM,"commonjsRequire");a(eM,"commonjsRequire");var J6=Z6;function Z6(e,t){if(!e)throw new Error(t||"Assertion failed")}i(Z6,"assert");a(Z6,"assert");Z6.equal=a(i(function(t,r,n){if(t!=r)throw new Error(n||"Assertion failed: "+t+" != "+r)},"assertEqual"),"assertEqual");var fo=$c(function(e,t){"use strict";var r=t;function n(c,l){if(Array.isArray(c))return c.slice();if(!c)return[];var h=[];if(typeof c!="string"){for(var p=0;p<c.length;p++)h[p]=c[p]|0;return h}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)h.push(parseInt(c[p]+c[p+1],16))}else for(var p=0;p<c.length;p++){var m=c.charCodeAt(p),y=m>>8,b=m&255;y?h.push(y,b):h.push(b)}return h}i(n,"toArray"),a(n,"toArray"),r.toArray=n;function o(c){return c.length===1?"0"+c:c}i(o,"zero2"),a(o,"zero2"),r.zero2=o;function s(c){for(var l="",h=0;h<c.length;h++)l+=o(c[h].toString(16));return l}i(s,"toHex"),a(s,"toHex"),r.toHex=s,r.encode=a(i(function(l,h){return h==="hex"?s(l):l},"encode9"),"encode")}),Ei=$c(function(e,t){"use strict";var r=t;r.assert=J6,r.toArray=fo.toArray,r.zero2=fo.zero2,r.toHex=fo.toHex,r.encode=fo.encode;function n(h,p,m){var y=new Array(Math.max(h.bitLength(),m)+1);y.fill(0);for(var b=1<<p+1,_=h.clone(),x=0;x<y.length;x++){var D,O=_.andln(b-1);_.isOdd()?(O>(b>>1)-1?D=(b>>1)-O:D=O,_.isubn(D)):D=0,y[x]=D,_.iushrn(1)}return y}i(n,"getNAF2"),a(n,"getNAF"),r.getNAF=n;function o(h,p){var m=[[],[]];h=h.clone(),p=p.clone();for(var y=0,b=0,_;h.cmpn(-y)>0||p.cmpn(-b)>0;){var x=h.andln(3)+y&3,D=p.andln(3)+b&3;x===3&&(x=-1),D===3&&(D=-1);var O;(x&1)===0?O=0:(_=h.andln(7)+y&7,(_===3||_===5)&&D===2?O=-x:O=x),m[0].push(O);var B;(D&1)===0?B=0:(_=p.andln(7)+b&7,(_===3||_===5)&&x===2?B=-D:B=D),m[1].push(B),2*y===O+1&&(y=1-y),2*b===B+1&&(b=1-b),h.iushrn(1),p.iushrn(1)}return m}i(o,"getJSF2"),a(o,"getJSF"),r.getJSF=o;function s(h,p,m){var y="_"+p;h.prototype[p]=a(i(function(){return this[y]!==void 0?this[y]:this[y]=m.call(this)},"cachedProperty2"),"cachedProperty")}i(s,"cachedProperty"),a(s,"cachedProperty"),r.cachedProperty=s;function c(h){return typeof h=="string"?r.toArray(h,"hex"):h}i(c,"parseBytes"),a(c,"parseBytes"),r.parseBytes=c;function l(h){return new Pt.default(h,"hex","le")}i(l,"intFromLE"),a(l,"intFromLE"),r.intFromLE=l}),Y0=Ei.getNAF,Oz=Ei.getJSF,X0=Ei.assert;function Oa(e,t){this.type=e,this.p=new Pt.default(t.p,16),this.red=t.prime?Pt.default.red(t.prime):Pt.default.mont(this.p),this.zero=new Pt.default(0).toRed(this.red),this.one=new Pt.default(1).toRed(this.red),this.two=new Pt.default(2).toRed(this.red),this.n=t.n&&new Pt.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(Oa,"BaseCurve");a(Oa,"BaseCurve");var jc=Oa;Oa.prototype.point=a(i(function(){throw new Error("Not implemented")},"point"),"point");Oa.prototype.validate=a(i(function(){throw new Error("Not implemented")},"validate"),"validate");Oa.prototype._fixedNafMul=a(i(function(t,r){X0(t.precomputed);var n=t._getDoubles(),o=Y0(r,1,this._bitLength),s=(1<<n.step+1)-(n.step%2===0?2:1);s/=3;var c=[],l,h;for(l=0;l<o.length;l+=n.step){h=0;for(var p=l+n.step-1;p>=l;p--)h=(h<<1)+o[p];c.push(h)}for(var m=this.jpoint(null,null,null),y=this.jpoint(null,null,null),b=s;b>0;b--){for(l=0;l<c.length;l++)h=c[l],h===b?y=y.mixedAdd(n.points[l]):h===-b&&(y=y.mixedAdd(n.points[l].neg()));m=m.add(y)}return m.toP()},"_fixedNafMul"),"_fixedNafMul");Oa.prototype._wnafMul=a(i(function(t,r){var n=4,o=t._getNAFPoints(n);n=o.wnd;for(var s=o.points,c=Y0(r,n,this._bitLength),l=this.jpoint(null,null,null),h=c.length-1;h>=0;h--){for(var p=0;h>=0&&c[h]===0;h--)p++;if(h>=0&&p++,l=l.dblp(p),h<0)break;var m=c[h];X0(m!==0),t.type==="affine"?m>0?l=l.mixedAdd(s[m-1>>1]):l=l.mixedAdd(s[-m-1>>1].neg()):m>0?l=l.add(s[m-1>>1]):l=l.add(s[-m-1>>1].neg())}return t.type==="affine"?l.toP():l},"_wnafMul"),"_wnafMul");Oa.prototype._wnafMulAdd=a(i(function(t,r,n,o,s){var c=this._wnafT1,l=this._wnafT2,h=this._wnafT3,p=0,m,y,b;for(m=0;m<o;m++){b=r[m];var _=b._getNAFPoints(t);c[m]=_.wnd,l[m]=_.points}for(m=o-1;m>=1;m-=2){var x=m-1,D=m;if(c[x]!==1||c[D]!==1){h[x]=Y0(n[x],c[x],this._bitLength),h[D]=Y0(n[D],c[D],this._bitLength),p=Math.max(h[x].length,p),p=Math.max(h[D].length,p);continue}var O=[r[x],null,null,r[D]];r[x].y.cmp(r[D].y)===0?(O[1]=r[x].add(r[D]),O[2]=r[x].toJ().mixedAdd(r[D].neg())):r[x].y.cmp(r[D].y.redNeg())===0?(O[1]=r[x].toJ().mixedAdd(r[D]),O[2]=r[x].add(r[D].neg())):(O[1]=r[x].toJ().mixedAdd(r[D]),O[2]=r[x].toJ().mixedAdd(r[D].neg()));var B=[-3,-1,-5,-7,0,7,5,1,3],Z=Oz(n[x],n[D]);for(p=Math.max(Z[0].length,p),h[x]=new Array(p),h[D]=new Array(p),y=0;y<p;y++){var $=Z[0][y]|0,z=Z[1][y]|0;h[x][y]=B[($+1)*3+(z+1)],h[D][y]=0,l[x]=O}}var Q=this.jpoint(null,null,null),Y=this._wnafT4;for(m=p;m>=0;m--){for(var k=0;m>=0;){var q=!0;for(y=0;y<o;y++)Y[y]=h[y][m]|0,Y[y]!==0&&(q=!1);if(!q)break;k++,m--}if(m>=0&&k++,Q=Q.dblp(k),m<0)break;for(y=0;y<o;y++){var he=Y[y];he!==0&&(he>0?b=l[y][he-1>>1]:he<0&&(b=l[y][-he-1>>1].neg()),b.type==="affine"?Q=Q.mixedAdd(b):Q=Q.add(b))}}for(m=0;m<o;m++)l[m]=null;return s?Q:Q.toP()},"_wnafMulAdd"),"_wnafMulAdd");function Ai(e,t){this.curve=e,this.type=t,this.precomputed=null}i(Ai,"BasePoint");a(Ai,"BasePoint");Oa.BasePoint=Ai;Ai.prototype.eq=a(i(function(){throw new Error("Not implemented")},"eq"),"eq");Ai.prototype.validate=a(i(function(){return this.curve.validate(this)},"validate2"),"validate");Oa.prototype.decodePoint=a(i(function(t,r){t=Ei.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?X0(t[t.length-1]%2===0):t[0]===7&&X0(t[t.length-1]%2===1);var o=this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));return o}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");Ai.prototype.encodeCompressed=a(i(function(t){return this.encode(t,!0)},"encodeCompressed"),"encodeCompressed");Ai.prototype._encode=a(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");Ai.prototype.encode=a(i(function(t,r){return Ei.encode(this._encode(r),t)},"encode8"),"encode");Ai.prototype.precompute=a(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");Ai.prototype._hasDoubles=a(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");Ai.prototype._getDoubles=a(i(function(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],o=this,s=0;s<r;s+=t){for(var c=0;c<t;c++)o=o.dbl();n.push(o)}return{step:t,points:n}},"_getDoubles"),"_getDoubles");Ai.prototype._getNAFPoints=a(i(function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],n=(1<<t)-1,o=n===1?null:this.dbl(),s=1;s<n;s++)r[s]=r[s-1].add(o);return{wnd:t,points:r}},"_getNAFPoints"),"_getNAFPoints");Ai.prototype._getBeta=a(i(function(){return null},"_getBeta"),"_getBeta");Ai.prototype.dblp=a(i(function(t){for(var r=this,n=0;n<t;n++)r=r.dbl();return r},"dblp"),"dblp");var Y6=$c(function(e){typeof Object.create=="function"?e.exports=a(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=a(i(function(r,n){if(n){r.super_=n;var o=a(function(){},"TempCtor");o.prototype=n.prototype,r.prototype=new o,r.prototype.constructor=r}},"inherits"),"inherits")}),Nz=Ei.assert;function Si(e){jc.call(this,"short",e),this.a=new Pt.default(e.a,16).toRed(this.red),this.b=new Pt.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(Si,"ShortCurve");a(Si,"ShortCurve");Y6(Si,jc);var Bz=Si;Si.prototype._getEndomorphism=a(i(function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(t.beta)r=new Pt.default(t.beta,16).toRed(this.red);else{var o=this._getEndoRoots(this.p);r=o[0].cmp(o[1])<0?o[0]:o[1],r=r.toRed(this.red)}if(t.lambda)n=new Pt.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],Nz(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 Pt.default(l.a,16),b:new Pt.default(l.b,16)}}):c=this._getEndoBasis(n),{beta:r,lambda:n,basis:c}}},"_getEndomorphism"),"_getEndomorphism");Si.prototype._getEndoRoots=a(i(function(t){var r=t===this.p?this.red:Pt.default.mont(t),n=new Pt.default(2).toRed(r).redInvm(),o=n.redNeg(),s=new Pt.default(3).toRed(r).redNeg().redSqrt().redMul(n),c=o.redAdd(s).fromRed(),l=o.redSub(s).fromRed();return[c,l]},"_getEndoRoots"),"_getEndoRoots");Si.prototype._getEndoBasis=a(i(function(t){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=t,o=this.n.clone(),s=new Pt.default(1),c=new Pt.default(0),l=new Pt.default(0),h=new Pt.default(1),p,m,y,b,_,x,D,O=0,B,Z;n.cmpn(0)!==0;){var $=o.div(n);B=o.sub($.mul(n)),Z=l.sub($.mul(s));var z=h.sub($.mul(c));if(!y&&B.cmp(r)<0)p=D.neg(),m=s,y=B.neg(),b=Z;else if(y&&++O===2)break;D=B,o=n,n=B,l=s,s=Z,h=c,c=z}_=B.neg(),x=Z;var Q=y.sqr().add(b.sqr()),Y=_.sqr().add(x.sqr());return Y.cmp(Q)>=0&&(_=p,x=m),y.negative&&(y=y.neg(),b=b.neg()),_.negative&&(_=_.neg(),x=x.neg()),[{a:y,b},{a:_,b:x}]},"_getEndoBasis"),"_getEndoBasis");Si.prototype._endoSplit=a(i(function(t){var r=this.endo.basis,n=r[0],o=r[1],s=o.b.mul(t).divRound(this.n),c=n.b.neg().mul(t).divRound(this.n),l=s.mul(n.a),h=c.mul(o.a),p=s.mul(n.b),m=c.mul(o.b),y=t.sub(l).sub(h),b=p.add(m).neg();return{k1:y,k2:b}},"_endoSplit"),"_endoSplit");Si.prototype.pointFromX=a(i(function(t,r){t=new Pt.default(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),o=n.redSqrt();if(o.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=o.fromRed().isOdd();return(r&&!s||!r&&s)&&(o=o.redNeg()),this.point(t,o)},"pointFromX"),"pointFromX");Si.prototype.validate=a(i(function(t){if(t.inf)return!0;var r=t.x,n=t.y,o=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(o).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},"validate3"),"validate");Si.prototype._endoWnafMulAdd=a(i(function(t,r,n){for(var o=this._endoWnafT1,s=this._endoWnafT2,c=0;c<t.length;c++){var l=this._endoSplit(r[c]),h=t[c],p=h._getBeta();l.k1.negative&&(l.k1.ineg(),h=h.neg(!0)),l.k2.negative&&(l.k2.ineg(),p=p.neg(!0)),o[c*2]=h,o[c*2+1]=p,s[c*2]=l.k1,s[c*2+1]=l.k2}for(var m=this._wnafMulAdd(1,o,s,c*2,n),y=0;y<c*2;y++)o[y]=null,s[y]=null;return m},"_endoWnafMulAdd"),"_endoWnafMulAdd");function Jr(e,t,r,n){jc.BasePoint.call(this,e,"affine"),t===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Pt.default(t,16),this.y=new Pt.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(Jr,"Point");a(Jr,"Point");Y6(Jr,jc.BasePoint);Si.prototype.point=a(i(function(t,r,n){return new Jr(this,t,r,n)},"point2"),"point");Si.prototype.pointFromJSON=a(i(function(t,r){return Jr.fromJSON(this,t,r)},"pointFromJSON"),"pointFromJSON");Jr.prototype._getBeta=a(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,o=a(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(o)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(o)}}}return r}},"_getBeta2"),"_getBeta");Jr.prototype.toJSON=a(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");Jr.fromJSON=a(i(function(t,r,n){typeof r=="string"&&(r=JSON.parse(r));var o=t.point(r[0],r[1],n);if(!r[2])return o;function s(l){return t.point(l[0],l[1],n)}i(s,"obj2point"),a(s,"obj2point");var c=r[2];return o.precomputed={beta:null,doubles:c.doubles&&{step:c.doubles.step,points:[o].concat(c.doubles.points.map(s))},naf:c.naf&&{wnd:c.naf.wnd,points:[o].concat(c.naf.points.map(s))}},o},"fromJSON"),"fromJSON");Jr.prototype.inspect=a(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");Jr.prototype.isInfinity=a(i(function(){return this.inf},"isInfinity"),"isInfinity");Jr.prototype.add=a(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),o=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,o)},"add"),"add");Jr.prototype.dbl=a(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(),o=t.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(o),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");Jr.prototype.getX=a(i(function(){return this.x.fromRed()},"getX"),"getX");Jr.prototype.getY=a(i(function(){return this.y.fromRed()},"getY"),"getY");Jr.prototype.mul=a(i(function(t){return t=new Pt.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");Jr.prototype.mulAdd=a(i(function(t,r,n){var o=[this,r],s=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(o,s):this.curve._wnafMulAdd(1,o,s,2)},"mulAdd"),"mulAdd");Jr.prototype.jmulAdd=a(i(function(t,r,n){var o=[this,r],s=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(o,s,!0):this.curve._wnafMulAdd(1,o,s,2,!0)},"jmulAdd"),"jmulAdd");Jr.prototype.eq=a(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");Jr.prototype.neg=a(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,o=a(function(s){return s.neg()},"negate");r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(o)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(o)}}}return r},"neg"),"neg");Jr.prototype.toJ=a(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 en(e,t,r,n){jc.BasePoint.call(this,e,"jacobian"),t===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Pt.default(0)):(this.x=new Pt.default(t,16),this.y=new Pt.default(r,16),this.z=new Pt.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(en,"JPoint");a(en,"JPoint");Y6(en,jc.BasePoint);Si.prototype.jpoint=a(i(function(t,r,n){return new en(this,t,r,n)},"jpoint"),"jpoint");en.prototype.toP=a(i(function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),o=this.y.redMul(r).redMul(t);return this.curve.point(n,o)},"toP"),"toP");en.prototype.neg=a(i(function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},"neg2"),"neg");en.prototype.add=a(i(function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),o=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)),h=o.redSub(s),p=c.redSub(l);if(h.cmpn(0)===0)return p.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var m=h.redSqr(),y=m.redMul(h),b=o.redMul(m),_=p.redSqr().redIAdd(y).redISub(b).redISub(b),x=p.redMul(b.redISub(_)).redISub(c.redMul(y)),D=this.z.redMul(t.z).redMul(h);return this.curve.jpoint(_,x,D)},"add2"),"add");en.prototype.mixedAdd=a(i(function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,o=t.x.redMul(r),s=this.y,c=t.y.redMul(r).redMul(this.z),l=n.redSub(o),h=s.redSub(c);if(l.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=l.redSqr(),m=p.redMul(l),y=n.redMul(p),b=h.redSqr().redIAdd(m).redISub(y).redISub(y),_=h.redMul(y.redISub(b)).redISub(s.redMul(m)),x=this.z.redMul(l);return this.curve.jpoint(b,_,x)},"mixedAdd"),"mixedAdd");en.prototype.dblp=a(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 o=this.curve.a,s=this.curve.tinv,c=this.x,l=this.y,h=this.z,p=h.redSqr().redSqr(),m=l.redAdd(l);for(r=0;r<t;r++){var y=c.redSqr(),b=m.redSqr(),_=b.redSqr(),x=y.redAdd(y).redIAdd(y).redIAdd(o.redMul(p)),D=c.redMul(b),O=x.redSqr().redISub(D.redAdd(D)),B=D.redISub(O),Z=x.redMul(B);Z=Z.redIAdd(Z).redISub(_);var $=m.redMul(h);r+1<t&&(p=p.redMul(_)),c=O,h=$,m=Z}return this.curve.jpoint(c,m.redMul(s),h)},"dblp2"),"dblp");en.prototype.dbl=a(i(function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},"dbl2"),"dbl");en.prototype._zeroDbl=a(i(function(){var t,r,n;if(this.zOne){var o=this.x.redSqr(),s=this.y.redSqr(),c=s.redSqr(),l=this.x.redAdd(s).redSqr().redISub(o).redISub(c);l=l.redIAdd(l);var h=o.redAdd(o).redIAdd(o),p=h.redSqr().redISub(l).redISub(l),m=c.redIAdd(c);m=m.redIAdd(m),m=m.redIAdd(m),t=p,r=h.redMul(l.redISub(p)).redISub(m),n=this.y.redAdd(this.y)}else{var y=this.x.redSqr(),b=this.y.redSqr(),_=b.redSqr(),x=this.x.redAdd(b).redSqr().redISub(y).redISub(_);x=x.redIAdd(x);var D=y.redAdd(y).redIAdd(y),O=D.redSqr(),B=_.redIAdd(_);B=B.redIAdd(B),B=B.redIAdd(B),t=O.redISub(x).redISub(x),r=D.redMul(x.redISub(t)).redISub(B),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(t,r,n)},"_zeroDbl"),"_zeroDbl");en.prototype._threeDbl=a(i(function(){var t,r,n;if(this.zOne){var o=this.x.redSqr(),s=this.y.redSqr(),c=s.redSqr(),l=this.x.redAdd(s).redSqr().redISub(o).redISub(c);l=l.redIAdd(l);var h=o.redAdd(o).redIAdd(o).redIAdd(this.curve.a),p=h.redSqr().redISub(l).redISub(l);t=p;var m=c.redIAdd(c);m=m.redIAdd(m),m=m.redIAdd(m),r=h.redMul(l.redISub(p)).redISub(m),n=this.y.redAdd(this.y)}else{var y=this.z.redSqr(),b=this.y.redSqr(),_=this.x.redMul(b),x=this.x.redSub(y).redMul(this.x.redAdd(y));x=x.redAdd(x).redIAdd(x);var D=_.redIAdd(_);D=D.redIAdd(D);var O=D.redAdd(D);t=x.redSqr().redISub(O),n=this.y.redAdd(this.z).redSqr().redISub(b).redISub(y);var B=b.redSqr();B=B.redIAdd(B),B=B.redIAdd(B),B=B.redIAdd(B),r=x.redMul(D.redISub(t)).redISub(B)}return this.curve.jpoint(t,r,n)},"_threeDbl"),"_threeDbl");en.prototype._dbl=a(i(function(){var t=this.curve.a,r=this.x,n=this.y,o=this.z,s=o.redSqr().redSqr(),c=r.redSqr(),l=n.redSqr(),h=c.redAdd(c).redIAdd(c).redIAdd(t.redMul(s)),p=r.redAdd(r);p=p.redIAdd(p);var m=p.redMul(l),y=h.redSqr().redISub(m.redAdd(m)),b=m.redISub(y),_=l.redSqr();_=_.redIAdd(_),_=_.redIAdd(_),_=_.redIAdd(_);var x=h.redMul(b).redISub(_),D=n.redAdd(n).redMul(o);return this.curve.jpoint(y,x,D)},"_dbl"),"_dbl");en.prototype.trpl=a(i(function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr(),o=r.redSqr(),s=t.redAdd(t).redIAdd(t),c=s.redSqr(),l=this.x.redAdd(r).redSqr().redISub(t).redISub(o);l=l.redIAdd(l),l=l.redAdd(l).redIAdd(l),l=l.redISub(c);var h=l.redSqr(),p=o.redIAdd(o);p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var m=s.redIAdd(l).redSqr().redISub(c).redISub(h).redISub(p),y=r.redMul(m);y=y.redIAdd(y),y=y.redIAdd(y);var b=this.x.redMul(h).redISub(y);b=b.redIAdd(b),b=b.redIAdd(b);var _=this.y.redMul(m.redMul(p.redISub(m)).redISub(l.redMul(h)));_=_.redIAdd(_),_=_.redIAdd(_),_=_.redIAdd(_);var x=this.z.redAdd(l).redSqr().redISub(n).redISub(h);return this.curve.jpoint(b,_,x)},"trpl"),"trpl");en.prototype.mul=a(i(function(t,r){return t=new Pt.default(t,r),this.curve._wnafMul(this,t)},"mul2"),"mul");en.prototype.eq=a(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 o=r.redMul(this.z),s=n.redMul(t.z);return this.y.redMul(s).redISub(t.y.redMul(o)).cmpn(0)===0},"eq3"),"eq");en.prototype.eqXToP=a(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 o=t.clone(),s=this.curve.redN.redMul(r);;){if(o.iadd(this.curve.n),o.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},"eqXToP"),"eqXToP");en.prototype.inspect=a(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");en.prototype.isInfinity=a(i(function(){return this.z.cmpn(0)===0},"isInfinity2"),"isInfinity");var S0=$c(function(e,t){"use strict";var r=t;r.base=jc,r.short=Bz,r.mont=null,r.edwards=null}),x0=$c(function(e,t){"use strict";var r=t,n=Ei.assert;function o(l){l.type==="short"?this.curve=new S0.short(l):l.type==="edwards"?this.curve=new S0.edwards(l):this.curve=new S0.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(o,"PresetCurve"),a(o,"PresetCurve"),r.PresetCurve=o;function s(l,h){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(h);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:p}),p}})}i(s,"defineCurve"),a(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:Aa.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:Aa.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:Aa.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:Aa.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:Aa.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:Aa.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:Aa.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:Aa.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function Ca(e){if(!(this instanceof Ca))return new Ca(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=fo.toArray(e.entropy,e.entropyEnc||"hex"),r=fo.toArray(e.nonce,e.nonceEnc||"hex"),n=fo.toArray(e.pers,e.persEnc||"hex");J6(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}i(Ca,"HmacDRBG");a(Ca,"HmacDRBG");var tM=Ca;Ca.prototype._init=a(i(function(t,r,n){var o=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(o),this._reseed=1,this.reseedInterval=281474976710656},"init"),"init");Ca.prototype._hmac=a(i(function(){return new Aa.default.hmac(this.hash,this.K)},"hmac"),"hmac");Ca.prototype._update=a(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");Ca.prototype.reseed=a(i(function(t,r,n,o){typeof r!="string"&&(o=n,n=r,r=null),t=fo.toArray(t,r),n=fo.toArray(n,o),J6(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},"reseed"),"reseed");Ca.prototype.generate=a(i(function(t,r,n,o){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(o=n,n=r,r=null),n&&(n=fo.toArray(n,o||"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++,fo.encode(c,r)},"generate"),"generate");var Rb=Ei.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");a(fn,"KeyPair");var X6=fn;fn.fromPublic=a(i(function(t,r,n){return r instanceof fn?r:new fn(t,{pub:r,pubEnc:n})},"fromPublic"),"fromPublic");fn.fromPrivate=a(i(function(t,r,n){return r instanceof fn?r:new fn(t,{priv:r,privEnc:n})},"fromPrivate"),"fromPrivate");fn.prototype.validate=a(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=a(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=a(i(function(t){return t==="hex"?this.priv.toString(16,2):this.priv},"getPrivate"),"getPrivate");fn.prototype._importPrivate=a(i(function(t,r){this.priv=new Pt.default(t,r||16),this.priv=this.priv.umod(this.ec.curve.n)},"_importPrivate"),"_importPrivate");fn.prototype._importPublic=a(i(function(t,r){if(t.x||t.y){this.ec.curve.type==="mont"?Rb(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Rb(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=a(i(function(t){return t.validate()||Rb(t.validate(),"public point not validated"),t.mul(this.priv).getX()},"derive"),"derive");fn.prototype.sign=a(i(function(t,r,n){return this.ec.sign(t,this,r,n)},"sign2"),"sign");fn.prototype.verify=a(i(function(t,r){return this.ec.verify(t,r,this)},"verify2"),"verify");fn.prototype.inspect=a(i(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect3"),"inspect");var Pz=Ei.assert;function Md(e,t){if(e instanceof Md)return e;this._importDER(e,t)||(Pz(e.r&&e.s,"Signature without r or s"),this.r=new Pt.default(e.r,16),this.s=new Pt.default(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}i(Md,"Signature");a(Md,"Signature");var Um=Md;function rM(){this.place=0}i(rM,"Position");a(rM,"Position");function T0(e,t){var r=e[t.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var o=0,s=0,c=t.place;s<n;s++,c++)o<<=8,o|=e[c],o>>>=0;return o<=127?!1:(t.place=c,o)}i(T0,"getLength");a(T0,"getLength");function Ob(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(Ob,"rmPadding");a(Ob,"rmPadding");Md.prototype._importDER=a(i(function(t,r){t=Ei.toArray(t,r);var n=new rM;if(t[n.place++]!==48)return!1;var o=T0(t,n);if(o===!1||o+n.place!==t.length||t[n.place++]!==2)return!1;var s=T0(t,n);if(s===!1)return!1;var c=t.slice(n.place,s+n.place);if(n.place+=s,t[n.place++]!==2)return!1;var l=T0(t,n);if(l===!1||t.length!==l+n.place)return!1;var h=t.slice(n.place,l+n.place);if(c[0]===0)if(c[1]&128)c=c.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new Pt.default(c),this.s=new Pt.default(h),this.recoveryParam=null,!0},"_importDER"),"_importDER");function C0(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(C0,"constructLength");a(C0,"constructLength");Md.prototype.toDER=a(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=Ob(r),n=Ob(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var o=[2];C0(o,r.length),o=o.concat(r),o.push(2),C0(o,n.length);var s=o.concat(n),c=[48];return C0(c,s.length),c=c.concat(s),Ei.encode(c,t)},"toDER"),"toDER");var Lz=a(function(){throw new Error("unsupported")},"rand"),nM=Ei.assert;function wi(e){if(!(this instanceof wi))return new wi(e);typeof e=="string"&&(nM(Object.prototype.hasOwnProperty.call(x0,e),"Unknown curve "+e),e=x0[e]),e instanceof x0.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(wi,"EC");a(wi,"EC");var Fz=wi;wi.prototype.keyPair=a(i(function(t){return new X6(this,t)},"keyPair"),"keyPair");wi.prototype.keyFromPrivate=a(i(function(t,r){return X6.fromPrivate(this,t,r)},"keyFromPrivate"),"keyFromPrivate");wi.prototype.keyFromPublic=a(i(function(t,r){return X6.fromPublic(this,t,r)},"keyFromPublic"),"keyFromPublic");wi.prototype.genKeyPair=a(i(function(t){t||(t={});for(var r=new tM({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Lz(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new Pt.default(2));;){var s=new Pt.default(r.generate(n));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},"genKeyPair"),"genKeyPair");wi.prototype._truncateToN=a(i(function(t,r){var n=t.byteLength()*8-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},"_truncateToN"),"_truncateToN");wi.prototype.sign=a(i(function(t,r,n,o){typeof n=="object"&&(o=n,n=null),o||(o={}),r=this.keyFromPrivate(r,n),t=this._truncateToN(new Pt.default(t,16));for(var s=this.n.byteLength(),c=r.getPrivate().toArray("be",s),l=t.toArray("be",s),h=new tM({hash:this.hash,entropy:c,nonce:l,pers:o.pers,persEnc:o.persEnc||"utf8"}),p=this.n.sub(new Pt.default(1)),m=0;;m++){var y=o.k?o.k(m):new Pt.default(h.generate(this.n.byteLength()));if(y=this._truncateToN(y,!0),!(y.cmpn(1)<=0||y.cmp(p)>=0)){var b=this.g.mul(y);if(!b.isInfinity()){var _=b.getX(),x=_.umod(this.n);if(x.cmpn(0)!==0){var D=y.invm(this.n).mul(x.mul(r.getPrivate()).iadd(t));if(D=D.umod(this.n),D.cmpn(0)!==0){var O=(b.getY().isOdd()?1:0)|(_.cmp(x)!==0?2:0);return o.canonical&&D.cmp(this.nh)>0&&(D=this.n.sub(D),O^=1),new Um({r:x,s:D,recoveryParam:O})}}}}}},"sign3"),"sign");wi.prototype.verify=a(i(function(t,r,n,o){t=this._truncateToN(new Pt.default(t,16)),n=this.keyFromPublic(n,o),r=new Um(r,"hex");var s=r.r,c=r.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||c.cmpn(1)<0||c.cmp(this.n)>=0)return!1;var l=c.invm(this.n),h=l.mul(t).umod(this.n),p=l.mul(s).umod(this.n),m;return this.curve._maxwellTrick?(m=this.g.jmulAdd(h,n.getPublic(),p),m.isInfinity()?!1:m.eqXToP(s)):(m=this.g.mulAdd(h,n.getPublic(),p),m.isInfinity()?!1:m.getX().umod(this.n).cmp(s)===0)},"verify3"),"verify");wi.prototype.recoverPubKey=function(e,t,r,n){nM((3&r)===r,"The recovery param is more than two bits"),t=new Um(t,n);var o=this.n,s=new Pt.default(e),c=t.r,l=t.s,h=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),h):c=this.curve.pointFromX(c,h);var m=t.r.invm(o),y=o.sub(s).mul(m).umod(o),b=l.mul(m).umod(o);return this.g.mulAdd(y,c,b)};wi.prototype.getKeyRecoveryParam=function(e,t,r,n){if(t=new Um(t,n),t.recoveryParam!==null)return t.recoveryParam;for(var o=0;o<4;o++){var s;try{s=this.recoverPubKey(e,t,o)}catch{continue}if(s.eq(r))return o}throw new Error("Unable to find valid recovery factor")};var Uz=$c(function(e,t){"use strict";var r=t;r.version="6.5.4",r.utils=Ei,r.rand=function(){throw new Error("unsupported")},r.curve=S0,r.curves=x0,r.ec=Fz,r.eddsa=null}),$z=Uz.ec,jz="signing-key/5.7.0",Nb=new vr(jz),eb=null;function lo(){return eb||(eb=new $z("secp256k1")),eb}i(lo,"getCurve");a(lo,"getCurve");var iM=i(class{constructor(e){Bu(this,"curve","secp256k1"),Bu(this,"privateKey",Nn(e)),VC(this.privateKey)!==32&&Nb.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let t=lo().keyFromPrivate(zr(this.privateKey));Bu(this,"publicKey","0x"+t.getPublic(!1,"hex")),Bu(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Bu(this,"_isSigningKey",!0)}_addPoint(e){let t=lo().keyFromPublic(zr(this.publicKey)),r=lo().keyFromPublic(zr(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){let t=lo().keyFromPrivate(zr(this.privateKey)),r=zr(e);r.length!==32&&Nb.throwArgumentError("bad digest length","digest",e);let n=t.sign(r,{canonical:!0});return K6({recoveryParam:n.recoveryParam,r:Sc("0x"+n.r.toString(16),32),s:Sc("0x"+n.s.toString(16),32)})}computeSharedSecret(e){let t=lo().keyFromPrivate(zr(this.privateKey)),r=lo().keyFromPublic(zr(Q6(e)));return Sc("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}},"SigningKey");a(iM,"SigningKey");function oM(e,t){let r=K6(t),n={r:zr(r.r),s:zr(r.s)};return"0x"+lo().recoverPubKey(zr(e),n,r.recoveryParam).encode("hex",!1)}i(oM,"recoverPublicKey");a(oM,"recoverPublicKey");function Q6(e,t){let r=zr(e);if(r.length===32){let n=new iM(r);return t?"0x"+lo().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return t?Nn(r):"0x"+lo().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return t?"0x"+lo().keyFromPublic(r).getPublic(!0,"hex"):Nn(r)}return Nb.throwArgumentError("invalid public or private key","key","[REDACTED]")}i(Q6,"computePublicKey");a(Q6,"computePublicKey");var zz="transactions/5.7.0",vY=new vr(zz),UA;(function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"})(UA||(UA={}));function aM(e){let t=Q6(e);return JC(kb(Fm(kb(t,1)),12))}i(aM,"computeAddress");a(aM,"computeAddress");function sM(e,t){return aM(oM(zr(e),t))}i(sM,"recoverAddress");a(sM,"recoverAddress");var Hz="wallet/5.7.0",yY=new vr(Hz);function Bb(e,t){return sM(QC(e),t)}i(Bb,"verifyMessage");a(Bb,"verifyMessage");function cM(){return{eip191:async(e,t)=>{uM(e,t)}}}i(cM,"getEIP191Verifier");a(cM,"getEIP191Verifier");var qz=new Date("2022-09-20").valueOf();function uM(e,t){q6(e),$C(e,t);let n=[Bb(Cb.fromCacao(e).toMessage(),e.s.s).toLowerCase()];if(Date.parse(e.p.iat)<=qz){let s=Bb(FC(Cb.fromCacao(e),"Ethereum"),e.s.s).toLowerCase();n.push(s)}let o=nd.parse(e.p.iss.replace("did:pkh:","")).address.toLowerCase();if(!n.includes(o))throw new Error("Signature does not belong to issuer")}i(uM,"verifyEIP191Signature");a(uM,"verifyEIP191Signature");_d();m6();var Vz=ir(sl(),1);_d();function lM(){return Cr((0,Vz.randomBytes)(16),"base64")}i(lM,"randomString");a(lM,"randomString");var fM="base64pad",dM="base64url";function hM(e){return Cr(e,fM)}i(hM,"encodeBase64");a(hM,"encodeBase64");function pM(e){return Cr(e,dM)}i(pM,"encodeBase64Url");a(pM,"encodeBase64Url");function mM(e){return xr(e,fM)}i(mM,"decodeBase64");a(mM,"decodeBase64");function M0(e){return JSON.parse(Cr(xr(e,dM)))}i(M0,"base64urlToJSON");a(M0,"base64urlToJSON");function gM(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(gM,"fromDagJWS");a(gM,"fromDagJWS");function vM(e,t){if(t){let r=t.toISOString().split(".")[0]+"Z";return`${e}?versionTime=${r}`}else return e}i(vM,"didWithTime");a(vM,"didWithTime");function yM(e){return e?Array.isArray(e)?e:[e]:[]}i(yM,"extractControllers");a(yM,"extractControllers");var Kz={...cM()};function bM(e){return"registry"in e&&"cache"in e}i(bM,"isResolver");a(bM,"isResolver");var wM=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 wM({provider:this._client?.connection,resolver:this._resolver,capability:e,parent:this._parentId})}setProvider(e){if(this._client==null)this._client=new xb(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=bM(e)?e:new Rx(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=lM(),o=await this._client.request("did_authenticate",{nonce:n,aud:r,paths:t}),{kid:s}=await this.verifyJWS(o),c=M0(o.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 o=await J0.fromCacao(this._capability),s=jt.asCID(o.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 vC(e),o=pM(r.bytes);Object.assign(t,{linkedBlock:hM(n)});let s=await this.createJWS(o,t),c=jt.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 J0.fromCacao(this._capability);return{jws:s,linkedBlock:n,cacaoBlock:l.bytes}}return{jws:s,linkedBlock:n}}async verifyJWS(e,t={}){t=Object.assign({verifiers:Kz},t),typeof e!="string"&&(e=gM(e));let r=M0(e.split(".")[0]).kid;if(!r)throw new Error('No "kid" found in jws');let n=await this.resolve(r);if(!t.disableTimecheck){let h=n.didDocumentMetadata?.nextUpdate;if(h){let m=t.revocationPhaseOutSecs?t.revocationPhaseOutSecs*1e3:0,y=new Date(h).valueOf()+m;if(!(t.atTime&&t.atTime.getTime()<y))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 W0.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 h=vM(t.issuer,t.atTime),m=(await this.resolve(h)).didDocument?.controller,y=yM(m);if(t.capability?.s&&t.capability.p.aud===s&&y.includes(t.capability.p.iss))await W0.verify(t.capability,{atTime:t.atTime?t.atTime:void 0,revocationPhaseOutSecs:t.revocationPhaseOutSecs,verifiers:t.verifiers??{}});else if(!(s?y.includes(s):!1))throw new Error(`invalid_jws: not a valid verificationMethod for issuer: ${r}`)}let c=n.didDocument?.verificationMethod||[];Wx(e,c);let l;try{l=M0(e.split(".")[1])}catch{}return{kid:r,payload:l,didResolutionResult:n}}async createJWE(e,t,r={}){let n=await qj(t,this._resolver);return Hj(e,n,r.protectedHeader,r.aad)}async createDagJWE(e,t,r={}){let n=await _C(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 mM(r)}async decryptDagJWE(e){let t=await this.decryptJWE(e);return EC(t)}async resolve(e){let t=await this._resolver.resolve(e);if(t.didResolutionMetadata.error){let{error:r,message:n}=t.didResolutionMetadata,o=n?`, ${n}`:"";throw new Error(`Failed to resolve ${e}: ${r}${o}`)}return t}constructor({provider:e,resolver:t={},resolverOptions:r,capability:n,parent:o}={}){if(e!=null&&(this._client=new xb(e)),n){if(this._capability=n,this._parentId=this._capability.p.iss,o&&this._parentId!==o)throw new Error("Capability issuer and parent not equal")}else o&&(this._parentId=o);this.setResolver(t,r)}},"DID");a(wM,"DID");function Gz(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(Gz,"toUint8Array");a(Gz,"toUint8Array");var $A=ir(Em(),1);l6();var _M={};Ar(_M,{keyToDidDoc:()=>EM});function EM(e,t){let r=`did:key:${t}`,n=`${r}#${t}`;return{id:r,verificationMethod:[{id:n,type:"Secp256k1VerificationKey2018",controller:r,publicKeyBase58:Cr(e,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(EM,"keyToDidDoc");a(EM,"keyToDidDoc");var AM={};Ar(AM,{keyToDidDoc:()=>xM});_d();var Wz=ir(v6(),1);function SM(e){let t=new Uint8Array(e.length+2);return t[0]=236,t[1]=1,t.set(e,2),`z${Cr(t,"base58btc")}`}i(SM,"encodeKey");a(SM,"encodeKey");function xM(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,o=(0,Wz.convertPublicKeyToX25519)(e),s=`${r}#${SM(o)}`;return{id:r,verificationMethod:[{id:n,type:"Ed25519VerificationKey2018",controller:r,publicKeyBase58:Cr(e,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n],keyAgreement:[{id:s,type:"X25519KeyAgreementKey2019",controller:r,publicKeyBase58:Cr(o,"base58btc")}]}}i(xM,"keyToDidDoc2");a(xM,"keyToDidDoc");var TM={};Ar(TM,{keyToDidDoc:()=>$M,pubKeyBytesToXY:()=>n2});var CM={};Ar(CM,{ECPointDecompress:()=>BM});function MM(e){return e>=0?e:-e}i(MM,"n");a(MM,"n");function IM(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,o=1n,s=0n;for(;e!==0n;){let c=t/e,l=t%e,h=r-o*c,p=n-s*c;t=e,e=l,r=o,n=s,o=h,s=p}return{g:t,x:r,y:n}}i(IM,"r");a(IM,"r");function id(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(id,"e");a(id,"e");function e2(e,t){let r=IM(id(e,t),t);if(r.g!==1n)throw new RangeError(`${e.toString()} does not have inverse modulo ${t.toString()}`);return id(r.x,t)}i(e2,"o");a(e2,"o");function kM(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((o,s)=>o*s,1n);return t.reduce((o,s,c)=>{let l=n/s;return id(o+l*e2(l,s)%n*e[c]%n,n)},0n)}i(kM,"i");a(kM,"i");function DM(e){return e.map(t=>t[0]**(t[1]-1n)*(t[0]-1n)).reduce((t,r)=>r*t,1n)}i(DM,"a");a(DM,"a");function qu(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=id(e,r),t<0n)return e2(qu(e,MM(t),r,n),r);if(n!==void 0)return function(s,c,l,h){let p=h.map(b=>b[0]**b[1]),m=h.map(b=>DM([b])),y=m.map((b,_)=>qu(s,c%b,p[_]));return kM(y,p,l)}(e,t,r,function(s){let c={};return s.forEach(l=>{if(typeof l=="bigint"||typeof l=="number"){let h=String(l);c[h]===void 0?c[h]={p:BigInt(l),k:1n}:c[h].k+=1n}else{let h=String(l[0]);c[h]===void 0?c[h]={p:BigInt(l[0]),k:BigInt(l[1])}:c[h].k+=BigInt(l[1])}}),Object.values(c).map(l=>[l.p,l.k])}(n));let o=1n;for(;t>0;)t%2n===1n&&(o=o*e%r),t/=2n,e=e**2n%r;return o}i(qu,"s");a(qu,"s");var Zn={};Ar(Zn,{pubKeyBytesToHex:()=>RM,publicKeyHexToUint8ArrayPointPair:()=>t2,publicKeyIntToUint8ArrayPointPair:()=>r2,publicKeyIntToXY:()=>NM,publicKeyToXY:()=>OM,testHexString:()=>$m,testUint8Array:()=>vl});f6();function RM(e){if(!vl(e))throw new TypeError("input must be a Uint8Array");return Cr(e,"base16")}i(RM,"pubKeyBytesToHex");a(RM,"pubKeyBytesToHex");function OM(e){if(!$m(e))throw new TypeError("input must be string with characters 0-9,A-F,a-f");let t=t2(e),r=ju.encode(t.xOctet).slice(1),n=ju.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(OM,"publicKeyToXY");a(OM,"publicKeyToXY");function t2(e){if(!$m(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=xr(t,"base16"),o=xr(r,"base16");return{xOctet:n,yOctet:o}}i(t2,"publicKeyHexToUint8ArrayPointPair");a(t2,"publicKeyHexToUint8ArrayPointPair");function $m(e){let t=/^[A-Fa-f0-9]+$/i;return!!(t.exec(e)!==null&&t.test(e)&&typeof e=="string")}i($m,"testHexString");a($m,"testHexString");function vl(e){return e==null?!1:e.constructor===Uint8Array}i(vl,"testUint8Array");a(vl,"testUint8Array");function NM(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=r2(e),r=ju.encode(t.xOctet).slice(1),n=ju.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(NM,"publicKeyIntToXY");a(NM,"publicKeyIntToXY");function r2(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=xr(t,"base10"),o=xr(r,"base10");return{xOctet:n,yOctet:o}}i(r2,"publicKeyIntToUint8ArrayPointPair");a(r2,"publicKeyIntToUint8ArrayPointPair");function BM(e){if(!vl(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,o=(r+1n)/4n,s=BigInt(e[0]-2),c=e.subarray(1),l=BigInt(Cr(c,"base10")),h=l**3n-l*3n+n,p=qu(h,o,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(BM,"ECPointDecompress");a(BM,"ECPointDecompress");var PM={};Ar(PM,{ECPointDecompress:()=>LM});function LM(e){if(!vl(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,o=(r+1n)/4n,s=BigInt(e[0]-2),c=e.subarray(1),l=BigInt(Cr(c,"base10")),h=l**3n-l*3n+n,p=qu(h,o,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(LM,"ECPointDecompress2");a(LM,"ECPointDecompress");var FM={};Ar(FM,{ECPointDecompress:()=>UM});function UM(e){if(!vl(e))throw new TypeError("input must be a Uint8Array");let r=BigInt(2)**521n-1n,n=1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984n,o=(r+1n)/4n,s=BigInt(e[0]-2),c=e.subarray(1),l=BigInt(Cr(c,"base10")),h=l**3n-l*3n+n,p=qu(h,o,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(UM,"ECPointDecompress3");a(UM,"ECPointDecompress");function $M(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,o=n2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-256",x:o.xm,y:o.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i($M,"keyToDidDoc3");a($M,"keyToDidDoc");function n2(e){if(!Zn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Zn.pubKeyBytesToHex(e),r=t.length/2;if(r==64)return Zn.publicKeyToXY(t);if(r==65&&t.slice(0,2)=="04"){let n=t.slice(2);return Zn.publicKeyToXY(n)}if(r==33&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let n=xr(t,"base16"),o=CM.ECPointDecompress(n);return Zn.publicKeyIntToXY(o)}throw new Error("Unexpected pubKeyBytes")}i(n2,"pubKeyBytesToXY");a(n2,"pubKeyBytesToXY");var jM={};Ar(jM,{keyToDidDoc:()=>zM,pubKeyBytesToXY:()=>i2});function zM(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,o=i2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-384",x:o.xm,y:o.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(zM,"keyToDidDoc4");a(zM,"keyToDidDoc");function i2(e){if(!Zn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Zn.pubKeyBytesToHex(e),r=t.length/2;if(r==96)return Zn.publicKeyToXY(t);if(r==97&&t.slice(0,2)=="04"){let n=t.slice(2);return Zn.publicKeyToXY(n)}if(r==49&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let n=xr(t,"base16"),o=PM.ECPointDecompress(n);return Zn.publicKeyIntToXY(o)}throw new Error("Unexpected pubKeyBytes")}i(i2,"pubKeyBytesToXY2");a(i2,"pubKeyBytesToXY");var HM={};Ar(HM,{keyToDidDoc:()=>qM,pubKeyBytesToXY:()=>o2});function qM(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,o=o2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-521",x:o.xm,y:o.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(qM,"keyToDidDoc5");a(qM,"keyToDidDoc");function o2(e){if(!Zn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Zn.pubKeyBytesToHex(e);if(132<=t.length&&t.length<=134&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let r=xr(t,"base16"),n=FM.ECPointDecompress(r);return Zn.publicKeyIntToXY(n)}throw new Error("Unexpected pubKeyBytes")}i(o2,"pubKeyBytesToXY3");a(o2,"pubKeyBytesToXY");var Jz="application/did+ld+json",jA="application/did+json",Zz={231:_M,237:AM,4608:TM,4609:jM,4610:HM};function Yz(){return{key:async(e,t,r,n)=>{let o=n.accept||jA,s={didResolutionMetadata:{contentType:o},didDocument:null,didDocumentMetadata:{}};try{let c=co.decode(t.id),l=$A.default.decode(c),h=c.slice($A.default.decode.bytes),p=await Zz[l].keyToDidDoc(h,t.id);o===Jz?(p["@context"]="https://w3id.org/did/v1",s.didDocument=p):o===jA?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(Yz,"getResolver");a(Yz,"getResolver");var VM=ir(v6(),1),Xz=ir(lj(),1),Qz="base64pad";function Pb(e){return JSON.parse((0,Xz.default)(e))}i(Pb,"toStableObject");a(Pb,"toStableObject");function KM(e){let t=new Uint8Array(e.length+2);return t[0]=237,t[1]=1,t.set(e,2),`did:key:z${Cr(t,"base58btc")}`}i(KM,"encodeDID");a(KM,"encodeDID");function Lb(e){let[t,r,n]=e.split(".");return{payload:r,signatures:[{protected:t,signature:n}]}}i(Lb,"toGeneralJWS");a(Lb,"toGeneralJWS");var zA=a(async(e,t,r,n={})=>{let o=`${t}#${t.split(":")[2]}`,s=Hx(r),c=Pb(Object.assign(n,{kid:o,alg:"EdDSA"}));return $j(typeof e=="string"?e:Pb(e),s,c)},"sign"),eH={did_authenticate:async({did:e,secretKey:t},r)=>{let n=await zA({did:e,aud:r.aud,nonce:r.nonce,paths:r.paths,exp:Math.floor(Date.now()/1e3)+600},e,t);return Lb(n)},did_createJWS:async({did:e,secretKey:t},r)=>{if(r.did.split("#")[0]!==e)throw new bs(4100,`Unknown DID: ${e}`);let o=await zA(r.payload,e,t,r.protected);return{jws:Lb(o)}},did_decryptJWE:async({secretKey:e},t)=>{let r=rT((0,VM.convertSecretKeyToX25519)(e));try{let n=await zj(t.jwe,r);return{cleartext:Cr(n,Qz)}}catch(n){throw new bs(-32e3,n.message)}}},tH=i(class{constructor(e){let{secretKey:t,publicKey:r}=(0,VM.generateKeyPairFromSeed)(e),n=KM(r),o=BC(eH);this._handle=async s=>await o({did:n,secretKey:t},s)}get isDidProvider(){return!0}async send(e){return await this._handle(e)}},"Ed25519Provider");a(tH,"Ed25519Provider");var GM={};Ar(GM,{JsonPatchError:()=>Pr,_areEquals:()=>Vu,applyOperation:()=>ps,applyPatch:()=>jm,applyReducer:()=>JM,deepClone:()=>iH,getValueByPointer:()=>od,validate:()=>s2,validator:()=>ad});var rH=function(){var e=a(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[s])},e(t,r)},"extendStatics");return function(t,r){e(t,r);function n(){this.constructor=t}i(n,"__"),a(n,"__"),t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),nH=Object.prototype.hasOwnProperty;function Q0(e,t){return nH.call(e,t)}i(Q0,"hasOwnProperty");a(Q0,"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 o in e)Q0(e,o)&&n.push(o);return n}i(em,"_objectKeys");a(em,"_objectKeys");function Yn(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}i(Yn,"_deepClone");a(Yn,"_deepClone");function tm(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(tm,"isInteger2");a(tm,"isInteger");function ds(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}i(ds,"escapePathComponent");a(ds,"escapePathComponent");function a2(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}i(a2,"unescapePathComponent");a(a2,"unescapePathComponent");function rm(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(rm(e[t]))return!0}else if(typeof e=="object"){for(var n=em(e),o=n.length,s=0;s<o;s++)if(rm(e[n[s]]))return!0}}return!1}i(rm,"hasUndefined");a(rm,"hasUndefined");function Fb(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
842
842
  `)}i(Fb,"patchErrorMessageFormatter");a(Fb,"patchErrorMessageFormatter");var WM=function(e){rH(t,e);function t(r,n,o,s,c){var l=this.constructor,h=e.call(this,Fb(r,{name:n,index:o,operation:s,tree:c}))||this;return h.name=n,h.index=o,h.operation=s,h.tree=c,Object.setPrototypeOf(h,l.prototype),h.message=Fb(r,{name:n,index:o,operation:s,tree:c}),h}return i(t,"PatchError2"),a(t,"PatchError"),t}(Error),Pr=WM,iH=Yn,Lu={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=od(r,this.path);n&&(n=Yn(n));var o=ps(r,{op:"remove",path:this.from}).removed;return ps(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=od(r,this.from);return ps(r,{op:"add",path:this.path,value:Yn(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Vu(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},oH={add:function(e,t,r){return tm(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:Lu.move,copy:Lu.copy,test:Lu.test,_get:Lu._get};function od(e,t){if(t=="")return e;var r={op:"_get",path:t};return ps(e,r),r.value}i(od,"getValueByPointer");a(od,"getValueByPointer");function ps(e,t,r,n,o,s){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),s===void 0&&(s=0),r&&(typeof r=="function"?r(t,0,e,t.path):ad(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=od(e,t.from),t.op==="move"&&(c.removed=e),c;if(t.op==="test"){if(c.test=Vu(e,t.value),c.test===!1)throw new Pr("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 Pr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,t,e);return c}}else{n||(e=Yn(e));var l=t.path||"",h=l.split("/"),p=e,m=1,y=h.length,b=void 0,_=void 0,x=void 0;for(typeof r=="function"?x=r:x=ad;;){if(_=h[m],_&&_.indexOf("~")!=-1&&(_=a2(_)),o&&(_=="__proto__"||_=="prototype"&&m>0&&h[m-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&&b===void 0&&(p[_]===void 0?b=h.slice(0,m).join("/"):m==y-1&&(b=t.path),b!==void 0&&x(t,0,e,b)),m++,Array.isArray(p)){if(_==="-")_=p.length;else{if(r&&!tm(_))throw new Pr("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);tm(_)&&(_=~~_)}if(m>=y){if(r&&t.op==="add"&&_>p.length)throw new Pr("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=oH[t.op].call(t,p,_,e);if(c.test===!1)throw new Pr("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}}else if(m>=y){var c=Lu[t.op].call(t,p,_,e);if(c.test===!1)throw new Pr("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}if(p=p[_],r&&m<y&&(!p||typeof p!="object"))throw new Pr("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,t,e)}}}i(ps,"applyOperation");a(ps,"applyOperation");function jm(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new Pr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Yn(e));for(var s=new Array(t.length),c=0,l=t.length;c<l;c++)s[c]=ps(e,t[c],r,!0,o,c),e=s[c].newDocument;return s.newDocument=e,s}i(jm,"applyPatch");a(jm,"applyPatch");function JM(e,t,r){var n=ps(e,t);if(n.test===!1)throw new Pr("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}i(JM,"applyReducer");a(JM,"applyReducer");function ad(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Pr("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Lu[e.op]){if(typeof e.path!="string")throw new Pr("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Pr('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 Pr("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 Pr("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")&&rm(e.value))throw new Pr("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 o=e.path.split("/").length,s=n.split("/").length;if(o!==s+1&&o!==s)throw new Pr("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 Pr("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=s2([c],r);if(l&&l.name==="OPERATION_PATH_UNRESOLVABLE")throw new Pr("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Pr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}i(ad,"validator");a(ad,"validator");function s2(e,t,r){try{if(!Array.isArray(e))throw new Pr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)jm(Yn(t),Yn(e),r||!0);else{r=r||ad;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof Pr)return o;throw o}}i(s2,"validate5");a(s2,"validate");function Vu(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),o,s,c;if(r&&n){if(s=e.length,s!=t.length)return!1;for(o=s;o--!==0;)if(!Vu(e[o],t[o]))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(o=s;o--!==0;)if(!t.hasOwnProperty(l[o]))return!1;for(o=s;o--!==0;)if(c=l[o],!Vu(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}i(Vu,"_areEquals");a(Vu,"_areEquals");var ZM={};Ar(ZM,{compare:()=>rI,generate:()=>nm,observe:()=>tI,unobserve:()=>eI});var c2=new WeakMap,aH=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror2"),a(e,"Mirror"),e}(),sH=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo2"),a(e,"ObserverInfo"),e}();function YM(e){return c2.get(e)}i(YM,"getMirror");a(YM,"getMirror");function XM(e,t){return e.observers.get(t)}i(XM,"getObserverFromMirror");a(XM,"getObserverFromMirror");function QM(e,t){e.observers.delete(t.callback)}i(QM,"removeObserverFromMirror");a(QM,"removeObserverFromMirror");function eI(e,t){t.unobserve()}i(eI,"unobserve");a(eI,"unobserve");function tI(e,t){var r=[],n,o=YM(e);if(!o)o=new aH(e),c2.set(e,o);else{var s=XM(o,t);n=s&&s.observer}if(n)return n;if(n={},o.value=Yn(e),t){n.callback=t,n.next=null;var c=a(function(){nm(n)},"dirtyCheck"),l=a(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(){nm(n),clearTimeout(n.next),QM(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",l),window.removeEventListener("keyup",l),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l),window.removeEventListener("change",l))},o.observers.set(t,new sH(t,n)),n}i(tI,"observe");a(tI,"observe");function nm(e,t){t===void 0&&(t=!1);var r=c2.get(e.object);zm(r.value,e.object,e.patches,"",t),e.patches.length&&jm(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}i(nm,"generate2");a(nm,"generate");function zm(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=em(t),c=em(e),l=!1,h=!1,p=c.length-1;p>=0;p--){var m=c[p],y=e[m];if(Q0(t,m)&&!(t[m]===void 0&&y!==void 0&&Array.isArray(t)===!1)){var b=t[m];typeof y=="object"&&y!=null&&typeof b=="object"&&b!=null&&Array.isArray(y)===Array.isArray(b)?zm(y,b,r,n+"/"+ds(m),o):y!==b&&(l=!0,o&&r.push({op:"test",path:n+"/"+ds(m),value:Yn(y)}),r.push({op:"replace",path:n+"/"+ds(m),value:Yn(b)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+ds(m),value:Yn(y)}),r.push({op:"remove",path:n+"/"+ds(m)}),h=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),l=!0)}if(!(!h&&s.length==c.length))for(var p=0;p<s.length;p++){var m=s[p];!Q0(e,m)&&t[m]!==void 0&&r.push({op:"add",path:n+"/"+ds(m),value:Yn(t[m])})}}}i(zm,"_generate");a(zm,"_generate");function rI(e,t,r){r===void 0&&(r=!1);var n=[];return zm(e,t,n,"",r),n}i(rI,"compare3");a(rI,"compare");var nI=Object.assign({},GM,ZM,{JsonPatchError:WM,deepClone:Yn,escapePathComponent:ds,unescapePathComponent:a2}),cH=ir(Ad(),1),uH=ir(sl(),1),Qn;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC"})(Qn||(Qn={}));var HA=ir(Ad(),1);Wo();wd();var iI={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function oI(e){let t=iI[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(oI,"codeByName");a(oI,"codeByName");function aI(e){let t=Object.entries(iI).find(([,r])=>r===e);if(t)return t[0];throw new Error(`No stream type registered for index ${e}`)}i(aI,"nameByCode");a(aI,"nameByCode");var Ma=i(class{},"StreamType");a(Ma,"StreamType");Ma.nameByCode=aI;Ma.codeByName=oI;var qA=ir(Em(),1);function Gi(e){let t,r,n;return typeof e=="object"?(t=e.hashFunction,r=e.expiring,n=e.tags):t=e,(o,s,c)=>{if(c.value!=null)c.value=Ub(c.value,t,r,n);else if(c.get!=null)c.get=Ub(c.get,t,r,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}i(Gi,"Memoize");a(Gi,"Memoize");var tb=new Map;function Ub(e,t,r=0,n){let o=Symbol("__memoized_map__");return function(...s){let c;this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let l=this[o];if(Array.isArray(n))for(let h of n)tb.has(h)?tb.get(h).push(l):tb.set(h,[l]);if(t||s.length>0||r>0){let h;t===!0?h=s.map(y=>y.toString()).join("!"):t?h=t.apply(this,s):h=s[0];let p=`${h}__timestamp`,m=!1;if(r>0)if(!l.has(p))m=!0;else{let y=l.get(p);m=Date.now()-y>r}l.has(h)&&!m?c=l.get(h):(c=e.apply(this,s),l.set(h,c),r>0&&l.set(p,Date.now()))}else{let h=this;l.has(h)?c=l.get(h):(c=e.apply(this,s),l.set(h,c))}return c}}i(Ub,"getNewFunction");a(Ub,"getNewFunction");var u2=206;Wo();wd();gm();var VA=ir(Em(),1);function Id(e){try{return e()}catch(t){return t}}i(Id,"tryCatch");a(Id,"tryCatch");Wo();var KA=ir(Em(),1);il();function wc(e){let t=KA.default.decode(e),r=KA.default.decode.bytes,n=e.subarray(r);return[t,n,r]}i(wc,"readVarint");a(wc,"readVarint");function sI(e){return e===0||e===1}i(sI,"isCidVersion");a(sI,"isCidVersion");function $b(e){let[t,r]=wc(e);if(!sI(t))throw new Error(`Unknown CID version ${t}`);let[n,o]=wc(r),[,s,c]=wc(o),[l,,h]=wc(s),p=o.subarray(0,c+h+l),m=o.subarray(c+h+l);return[jt.create(t,n,h6(p)),m]}i($b,"readCid");a($b,"readCid");Wo();wd();function kd(e,t="StreamRef"){let[r,n]=wc(e);if(r!==u2)throw new Error(`Invalid ${t}, does not include streamid codec`);let[o,s]=wc(n),c=$b(s),[l,h]=c;if(h.length===0)return{kind:"stream-id",type:o,genesis:l};if(h.length===1&&h[0]===0)return{kind:"commit-id",type:o,genesis:l,commit:null};{let[p]=$b(h);return{kind:"commit-id",type:o,genesis:l,commit:p}}}i(kd,"fromBytes");a(kd,"fromBytes");var lH=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function Hm(e,t="StreamRef"){let r=lH.exec(e)||[],n=r[2];if(!n)throw new Error(`Malformed ${t} string: ${e}`);let o=Ss.decode(n),s=kd(o),c=r[4];return c?{kind:"commit-id",type:s.type,genesis:s.genesis,commit:l2(s.genesis,c)}:s}i(Hm,"fromString4");a(Hm,"fromString");function cI(e){try{return typeof e=="string"?jt.parse(e):jt.asCID(e)}catch{return null}}i(cI,"parseCID");a(cI,"parseCID");function l2(e,t=null){if(!t||t==="0")return null;let r=cI(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(l2,"parseCommit");a(l2,"parseCommit");var Dd=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate"),qi=i(function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},"__metadata"),uI=i(class extends Error{constructor(e){super(`Invalid StreamID bytes ${Ss.encode(e)}: contains commit`)}},"InvalidStreamIDBytesError");a(uI,"InvalidStreamIDBytesError");var lI=i(class extends Error{constructor(e){super(`Invalid StreamID string ${e}: contains commit`)}},"InvalidStreamIDStringError");a(lI,"InvalidStreamIDStringError");function f2(e){let t=kd(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new uI(e)}i(f2,"fromBytes2");a(f2,"fromBytes");function fI(e){return Id(()=>f2(e))}i(fI,"fromBytesNoThrow");a(fI,"fromBytesNoThrow");function d2(e){let t=Hm(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new lI(e)}i(d2,"fromString5");a(d2,"fromString");function dI(e){return Id(()=>d2(e))}i(dI,"fromStringNoThrow");a(dI,"fromStringNoThrow");var GA=Symbol.for("@ceramicnetwork/streamid/StreamID"),Xt=i(class{constructor(e,t){if(this._tag=GA,!(e||e===0))throw new Error("StreamID constructor: type required");if(!t)throw new Error("StreamID constructor: cid required");this._type=typeof e=="string"?Ma.codeByName(e):e,this._cid=typeof t=="string"?jt.parse(t):t}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===GA}static async fromGenesis(e,t){let r=await xm({value:t,codec:ll,hasher:ol});return new Xt(e,r.cid)}get type(){return this._type}get typeName(){return Ma.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let e=VA.default.encode(u2),t=VA.default.encode(this.type);return gs([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 Ss.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[Symbol.for("nodejs.util.inspect.custom")](){return`StreamID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}},"StreamID");a(Xt,"StreamID");Xt.fromBytes=f2;Xt.fromBytesNoThrow=fI;Xt.fromString=d2;Xt.fromStringNoThrow=dI;Dd([Gi(),qi("design:type",String),qi("design:paramtypes",[])],Xt.prototype,"typeName",null);Dd([Gi(),qi("design:type",Uint8Array),qi("design:paramtypes",[])],Xt.prototype,"bytes",null);Dd([Gi(),qi("design:type",Xt),qi("design:paramtypes",[])],Xt.prototype,"baseID",null);Dd([Gi(),qi("design:type",Function),qi("design:paramtypes",[]),qi("design:returntype",String)],Xt.prototype,"toString",null);Dd([Gi(),qi("design:type",Function),qi("design:paramtypes",[]),qi("design:returntype",String)],Xt.prototype,"toUrl",null);var yl=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate2"),Xn=i(function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},"__metadata2"),rb=i(function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},"__classPrivateFieldSet"),Ea=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"),Nu,gc,Hf,hI=i(class extends Error{constructor(e){super(`Error while parsing CommitID from bytes ${Ss.encode(e)}: no commit information provided`)}},"InvalidCommitIDBytesError");a(hI,"InvalidCommitIDBytesError");var pI=i(class extends Error{constructor(e){super(`Error while parsing CommitID from string ${e}: no commit information provided`)}},"InvalidCommitIDStringError");a(pI,"InvalidCommitIDStringError");function h2(e){let t=kd(e,"CommitID");if(t.kind==="commit-id")return new _r(t.type,t.genesis,t.commit);throw new hI(e)}i(h2,"fromBytes3");a(h2,"fromBytes");function mI(e){return Id(()=>h2(e))}i(mI,"fromBytesNoThrow2");a(mI,"fromBytesNoThrow");function p2(e){let t=Hm(e,"CommitID");if(t.kind==="commit-id")return new _r(t.type,t.genesis,t.commit);throw new pI(e)}i(p2,"fromString6");a(p2,"fromString");function gI(e){return Id(()=>p2(e))}i(gI,"fromStringNoThrow2");a(gI,"fromStringNoThrow");var WA=Symbol.for("@ceramicnetwork/streamid/CommitID");function vI(e,t){return new _r(e.type,e.cid,t)}i(vI,"make");a(vI,"make");var _r=i(class{constructor(e,t,r=null){if(this._tag=WA,Nu.set(this,void 0),gc.set(this,void 0),Hf.set(this,void 0),!e&&e!==0)throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");rb(this,Nu,typeof e=="string"?Ma.codeByName(e):e,"f"),rb(this,gc,typeof t=="string"?jt.parse(t):t,"f"),rb(this,Hf,l2(Ea(this,gc,"f"),r),"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===WA}get baseID(){return new Xt(Ea(this,Nu,"f"),Ea(this,gc,"f"))}get type(){return Ea(this,Nu,"f")}get typeName(){return Ma.nameByCode(Ea(this,Nu,"f"))}get cid(){return Ea(this,gc,"f")}get commit(){return Ea(this,Hf,"f")||Ea(this,gc,"f")}get bytes(){let e=qA.default.encode(u2),t=qA.default.encode(this.type),r=Ea(this,Hf,"f")?.bytes||new Uint8Array([0]);return gs([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 Ss.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(Nu=new WeakMap,gc=new WeakMap,Hf=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}},"CommitID");a(_r,"CommitID");_r.fromBytes=h2;_r.fromBytesNoThrow=mI;_r.fromString=p2;_r.fromStringNoThrow=gI;_r.make=vI;yl([Gi(),Xn("design:type",Xt),Xn("design:paramtypes",[])],_r.prototype,"baseID",null);yl([Gi(),Xn("design:type",String),Xn("design:paramtypes",[])],_r.prototype,"typeName",null);yl([Gi(),Xn("design:type",jt),Xn("design:paramtypes",[])],_r.prototype,"commit",null);yl([Gi(),Xn("design:type",Uint8Array),Xn("design:paramtypes",[])],_r.prototype,"bytes",null);yl([Gi(),Xn("design:type",Function),Xn("design:paramtypes",[]),Xn("design:returntype",String)],_r.prototype,"toString",null);yl([Gi(),Xn("design:type",Function),Xn("design:paramtypes",[]),Xn("design:returntype",String)],_r.prototype,"toUrl",null);wd();var ws;(function(e){function t(o){let s=kd(o);switch(s.kind){case"commit-id":return new _r(s.type,s.genesis,s.commit);case"stream-id":return new Xt(s.type,s.genesis);default:throw new Error(`Malformed StreamRef bytes: ${Ss.encode(o)}`)}}i(t,"fromBytes4"),a(t,"fromBytes"),e.fromBytes=t;function r(o){let s=Hm(o);switch(s.kind){case"commit-id":return new _r(s.type,s.genesis,s.commit);case"stream-id":return new Xt(s.type,s.genesis);default:throw new Error(`Malformed StreamRef string: ${o}`)}}i(r,"fromString7"),a(r,"fromString"),e.fromString=r;function n(o){if(Xt.isInstance(o)||_r.isInstance(o))return o;if(o instanceof Uint8Array)return t(o);if(typeof o=="string")return r(o);throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(o)}`)}i(n,"from4"),a(n,"from"),e.from=n})(ws||(ws={}));var jb=a(function(e,t){return jb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},jb(e,t)},"extendStatics");function Xo(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");jb(e,t);function r(){this.constructor=e}i(r,"__"),a(r,"__"),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}i(Xo,"__extends2");a(Xo,"__extends");function yI(e,t,r,n){function o(s){return s instanceof r?s:new r(function(c){c(s)})}return i(o,"adopt"),a(o,"adopt"),new(r||(r=Promise))(function(s,c){function l(m){try{p(n.next(m))}catch(y){c(y)}}i(l,"fulfilled"),a(l,"fulfilled");function h(m){try{p(n.throw(m))}catch(y){c(y)}}i(h,"rejected"),a(h,"rejected");function p(m){m.done?s(m.value):o(m.value).then(l,h)}i(p,"step"),a(p,"step"),p((n=n.apply(e,t||[])).next())})}i(yI,"__awaiter");a(yI,"__awaiter");function m2(e,t){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,o,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(m){return h([p,m])}}function h(p){if(n)throw new TypeError("Generator is already executing.");for(;c&&(c=0,p[0]&&(r=0)),r;)try{if(n=1,o&&(s=p[0]&2?o.return:p[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,p[1])).done)return s;switch(o=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++,o=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(m){p=[6,m],o=0}finally{n=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}i(m2,"__generator");a(m2,"__generator");function Cc(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(Cc,"__values");a(Cc,"__values");function Ia(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,s=[],c;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(l){c={error:l}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}i(Ia,"__read");a(Ia,"__read");function _s(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,s;n<o;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(_s,"__spreadArray");a(_s,"__spreadArray");function xc(e){return this instanceof xc?(this.v=e,this):new xc(e)}i(xc,"__await");a(xc,"__await");function bI(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",c),o[Symbol.asyncIterator]=function(){return this},o;function c(_){return function(x){return Promise.resolve(x).then(_,y)}}function l(_,x){n[_]&&(o[_]=function(D){return new Promise(function(O,B){s.push([_,D,O,B])>1||h(_,D)})},x&&(o[_]=x(o[_])))}function h(_,x){try{p(n[_](x))}catch(D){b(s[0][3],D)}}function p(_){_.value instanceof xc?Promise.resolve(_.value.v).then(m,y):b(s[0][2],_)}function m(_){h("next",_)}function y(_){h("throw",_)}function b(_,x){_(x),s.shift(),s.length&&h(s[0][0],s[0][1])}}i(bI,"__asyncGenerator");a(bI,"__asyncGenerator");function wI(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 Cc=="function"?Cc(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,h){c=e[s](c),o(l,h,c.done,c.value)})}}function o(s,c,l,h){Promise.resolve(h).then(function(p){s({value:p,done:l})},c)}}i(wI,"__asyncValues");a(wI,"__asyncValues");function Er(e){return typeof e=="function"}i(Er,"isFunction");a(Er,"isFunction");function qm(e){var t=a(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(qm,"createErrorClass");a(qm,"createErrorClass");var nb=qm(function(e){return a(i(function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
843
843
  `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
844
- `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl"),"UnsubscriptionErrorImpl")});function sd(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(sd,"arrRemove");a(sd,"arrRemove");var Rd=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription2"),a(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,o,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=Cc(c),h=l.next();!h.done;h=l.next()){var p=h.value;p.remove(this)}}catch(D){t={error:D}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var m=this.initialTeardown;if(Er(m))try{m()}catch(D){s=D instanceof nb?D.errors:[D]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var b=Cc(y),_=b.next();!_.done;_=b.next()){var x=_.value;try{zb(x)}catch(D){s=s??[],D instanceof nb?s=_s(_s([],Ia(s)),Ia(D.errors)):s.push(D)}}}catch(D){n={error:D}}finally{try{_&&!_.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(s)throw new nb(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)zb(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)&&sd(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&sd(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),_I=Rd.EMPTY;function g2(e){return e instanceof Rd||e&&"closed"in e&&Er(e.remove)&&Er(e.add)&&Er(e.unsubscribe)}i(g2,"isSubscription");a(g2,"isSubscription");function zb(e){Er(e)?e():e.unsubscribe()}i(zb,"execFinalizer");a(zb,"execFinalizer");var zc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},im={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=im.delegate;return o?.setTimeout?o.setTimeout.apply(o,_s([e,t],Ia(r))):setTimeout.apply(void 0,_s([e,t],Ia(r)))},clearTimeout:function(e){var t=im.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function v2(e){im.setTimeout(function(){var t=zc.onUnhandledError;if(t)t(e);else throw e})}i(v2,"reportUnhandledError");a(v2,"reportUnhandledError");function Hb(){}i(Hb,"noop");a(Hb,"noop");var fH=function(){return Vm("C",void 0,void 0)}();function EI(e){return Vm("E",void 0,e)}i(EI,"errorNotification");a(EI,"errorNotification");function AI(e){return Vm("N",e,void 0)}i(AI,"nextNotification");a(AI,"nextNotification");function Vm(e,t,r){return{kind:e,value:t,error:r}}i(Vm,"createNotification");a(Vm,"createNotification");var _c=null;function Zf(e){if(zc.useDeprecatedSynchronousErrorHandling){var t=!_c;if(t&&(_c={errorThrown:!1,error:null}),e(),t){var r=_c,n=r.errorThrown,o=r.error;if(_c=null,n)throw o}}else e()}i(Zf,"errorContext");a(Zf,"errorContext");function SI(e){zc.useDeprecatedSynchronousErrorHandling&&_c&&(_c.errorThrown=!0,_c.error=e)}i(SI,"captureError");a(SI,"captureError");var y2=function(e){Xo(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,g2(r)&&r.add(n)):n.destination=pH,n}return i(t,"Subscriber2"),a(t,"Subscriber"),t.create=function(r,n,o){return new qb(r,n,o)},t.prototype.next=function(r){this.isStopped?k0(AI(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?k0(EI(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?k0(fH,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}(Rd),dH=Function.prototype.bind;function I0(e,t){return dH.call(e,t)}i(I0,"bind");a(I0,"bind");var hH=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver2"),a(e,"ConsumerObserver"),e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Gf(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Gf(n)}else Gf(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Gf(r)}},e}(),qb=function(e){Xo(t,e);function t(r,n,o){var s=e.call(this)||this,c;if(Er(r)||!r)c={next:r??void 0,error:n??void 0,complete:o??void 0};else{var l;s&&zc.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&I0(r.next,l),error:r.error&&I0(r.error,l),complete:r.complete&&I0(r.complete,l)}):c=r}return s.destination=new hH(c),s}return i(t,"SafeSubscriber2"),a(t,"SafeSubscriber"),t}(y2);function Gf(e){zc.useDeprecatedSynchronousErrorHandling?SI(e):v2(e)}i(Gf,"handleUnhandledError");a(Gf,"handleUnhandledError");function xI(e){throw e}i(xI,"defaultErrorHandler");a(xI,"defaultErrorHandler");function k0(e,t){var r=zc.onStoppedNotification;r&&im.setTimeout(function(){return r(e,t)})}i(k0,"handleStoppedNotification");a(k0,"handleStoppedNotification");var pH={closed:!0,next:Hb,error:xI,complete:Hb},b2=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Km(e){return e}i(Km,"identity3");a(Km,"identity");function TI(e){return e.length===0?Km:e.length===1?e[0]:a(i(function(r){return e.reduce(function(n,o){return o(n)},r)},"piped"),"piped")}i(TI,"pipeFromArray");a(TI,"pipeFromArray");var dn=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable2"),a(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 o=this,s=MI(t)?t:new qb(t,r,n);return Zf(function(){var c=o,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?o._subscribe(s):o._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=Vb(r),new r(function(o,s){var c=new qb({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:o});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[b2]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return TI(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Vb(t),new t(function(n,o){var s;r.subscribe(function(c){return s=c},function(c){return o(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function Vb(e){var t;return(t=e??zc.Promise)!==null&&t!==void 0?t:Promise}i(Vb,"getPromiseCtor");a(Vb,"getPromiseCtor");function CI(e){return e&&Er(e.next)&&Er(e.error)&&Er(e.complete)}i(CI,"isObserver");a(CI,"isObserver");function MI(e){return e&&e instanceof y2||CI(e)&&g2(e)}i(MI,"isSubscriber");a(MI,"isSubscriber");function II(e){return Er(e?.lift)}i(II,"hasLift");a(II,"hasLift");function Qo(e){return function(t){if(II(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(Qo,"operate");a(Qo,"operate");function go(e,t,r,n,o){return new mH(e,t,r,n,o)}i(go,"createOperatorSubscriber");a(go,"createOperatorSubscriber");var mH=function(e){Xo(t,e);function t(r,n,o,s,c,l){var h=e.call(this,r)||this;return h.onFinalize=c,h.shouldUnsubscribe=l,h._next=n?function(p){try{n(p)}catch(m){r.error(m)}}:e.prototype._next,h._error=s?function(p){try{s(p)}catch(m){r.error(m)}finally{this.unsubscribe()}}:e.prototype._error,h._complete=o?function(){try{o()}catch(p){r.error(p)}finally{this.unsubscribe()}}:e.prototype._complete,h}return i(t,"OperatorSubscriber2"),a(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}(y2),gH=qm(function(e){return a(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),kI=function(e){Xo(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"),a(t,"Subject"),t.prototype.lift=function(r){var n=new JA(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new gH},t.prototype.next=function(r){var n=this;Zf(function(){var o,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var c=Cc(n.currentObservers),l=c.next();!l.done;l=c.next()){var h=l.value;h.next(r)}}catch(p){o={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;Zf(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;Zf(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,o=this,s=o.hasError,c=o.isStopped,l=o.observers;return s||c?_I:(this.currentObservers=null,l.push(r),new Rd(function(){n.currentObservers=null,sd(l,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,s=n.thrownError,c=n.isStopped;o?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 JA(r,n)},t}(dn),JA=function(e){Xo(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return i(t,"AnonymousSubject2"),a(t,"AnonymousSubject"),t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.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,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:_I},t}(kI),vH=function(e){Xo(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return i(t,"BehaviorSubject2"),a(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,o=r.thrownError,s=r._value;if(n)throw o;return this._throwIfClosed(),s},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(kI),DI={now:function(){return(DI.delegate||Date).now()},delegate:void 0},yH=function(e){Xo(t,e);function t(r,n){return e.call(this)||this}return i(t,"Action2"),a(t,"Action"),t.prototype.schedule=function(r,n){return n===void 0&&(n=0),this},t}(Rd),om={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=om.delegate;return o?.setInterval?o.setInterval.apply(o,_s([e,t],Ia(r))):setInterval.apply(void 0,_s([e,t],Ia(r)))},clearInterval:function(e){var t=om.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},bH=function(e){Xo(t,e);function t(r,n){var o=e.call(this,r,n)||this;return o.scheduler=r,o.work=n,o.pending=!1,o}return i(t,"AsyncAction2"),a(t,"AsyncAction"),t.prototype.schedule=function(r,n){var o;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=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(c,this.id,n),this},t.prototype.requestAsyncId=function(r,n,o){return o===void 0&&(o=0),om.setInterval(r.flush.bind(r,this),o)},t.prototype.recycleAsyncId=function(r,n,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return n;n!=null&&om.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(r,n);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var o=!1,s;try{this.work(r)}catch(c){o=!0,s=c||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,o=r.scheduler,s=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,sd(s,this),n!=null&&(this.id=this.recycleAsyncId(o,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(yH),ZA=function(){function e(t,r){r===void 0&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return i(e,"Scheduler2"),a(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=DI.now,e}(),wH=function(e){Xo(t,e);function t(r,n){n===void 0&&(n=ZA.now);var o=e.call(this,r,n)||this;return o.actions=[],o._active=!1,o}return i(t,"AsyncScheduler2"),a(t,"AsyncScheduler"),t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var o;this._active=!0;do if(o=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,o){for(;r=n.shift();)r.unsubscribe();throw o}},t}(ZA),_H=new wH(bH),EH=_H,RI=new dn(function(e){return e.complete()});function w2(e){return e&&Er(e.schedule)}i(w2,"isScheduler");a(w2,"isScheduler");function _2(e){return e[e.length-1]}i(_2,"last");a(_2,"last");function OI(e){return w2(_2(e))?e.pop():void 0}i(OI,"popScheduler");a(OI,"popScheduler");function NI(e,t){return typeof _2(e)=="number"?e.pop():t}i(NI,"popNumber");a(NI,"popNumber");var E2=a(function(e){return e&&typeof e.length=="number"&&typeof e!="function"},"isArrayLike");function A2(e){return Er(e?.then)}i(A2,"isPromise");a(A2,"isPromise");function S2(e){return Er(e[b2])}i(S2,"isInteropObservable");a(S2,"isInteropObservable");function x2(e){return Symbol.asyncIterator&&Er(e?.[Symbol.asyncIterator])}i(x2,"isAsyncIterable");a(x2,"isAsyncIterable");function T2(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(T2,"createInvalidObservableTypeError");a(T2,"createInvalidObservableTypeError");function BI(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(BI,"getSymbolIterator");a(BI,"getSymbolIterator");var PI=BI();function C2(e){return Er(e?.[PI])}i(C2,"isIterable");a(C2,"isIterable");function M2(e){return bI(this,arguments,a(i(function(){var r,n,o,s;return m2(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,xc(r.read())];case 3:return n=c.sent(),o=n.value,s=n.done,s?[4,xc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,xc(o)];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(M2,"readableStreamLikeToAsyncGenerator");a(M2,"readableStreamLikeToAsyncGenerator");function I2(e){return Er(e?.getReader)}i(I2,"isReadableStreamLike");a(I2,"isReadableStreamLike");function Na(e){if(e instanceof dn)return e;if(e!=null){if(S2(e))return LI(e);if(E2(e))return FI(e);if(A2(e))return UI(e);if(x2(e))return k2(e);if(C2(e))return $I(e);if(I2(e))return jI(e)}throw T2(e)}i(Na,"innerFrom");a(Na,"innerFrom");function LI(e){return new dn(function(t){var r=e[b2]();if(Er(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(LI,"fromInteropObservable");a(LI,"fromInteropObservable");function FI(e){return new dn(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(FI,"fromArrayLike");a(FI,"fromArrayLike");function UI(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,v2)})}i(UI,"fromPromise");a(UI,"fromPromise");function $I(e){return new dn(function(t){var r,n;try{for(var o=Cc(e),s=o.next();!s.done;s=o.next()){var c=s.value;if(t.next(c),t.closed)return}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}i($I,"fromIterable");a($I,"fromIterable");function k2(e){return new dn(function(t){zI(e,t).catch(function(r){return t.error(r)})})}i(k2,"fromAsyncIterable");a(k2,"fromAsyncIterable");function jI(e){return k2(M2(e))}i(jI,"fromReadableStreamLike");a(jI,"fromReadableStreamLike");function zI(e,t){var r,n,o,s;return yI(this,void 0,void 0,function(){var c,l;return m2(this,function(h){switch(h.label){case 0:h.trys.push([0,5,6,11]),r=wI(e),h.label=1;case 1:return[4,r.next()];case 2:if(n=h.sent(),!!n.done)return[3,4];if(c=n.value,t.next(c),t.closed)return[2];h.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=h.sent(),o={error:l},[3,11];case 6:return h.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:h.sent(),h.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}i(zI,"process2");a(zI,"process");function Ta(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var s=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!o)return s}i(Ta,"executeSchedule");a(Ta,"executeSchedule");function D2(e,t){return t===void 0&&(t=0),Qo(function(r,n){r.subscribe(go(n,function(o){return Ta(n,e,function(){return n.next(o)},t)},function(){return Ta(n,e,function(){return n.complete()},t)},function(o){return Ta(n,e,function(){return n.error(o)},t)}))})}i(D2,"observeOn");a(D2,"observeOn");function R2(e,t){return t===void 0&&(t=0),Qo(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(R2,"subscribeOn");a(R2,"subscribeOn");function HI(e,t){return Na(e).pipe(R2(t),D2(t))}i(HI,"scheduleObservable");a(HI,"scheduleObservable");function qI(e,t){return Na(e).pipe(R2(t),D2(t))}i(qI,"schedulePromise");a(qI,"schedulePromise");function VI(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(VI,"scheduleArray");a(VI,"scheduleArray");function KI(e,t){return new dn(function(r){var n;return Ta(r,t,function(){n=e[PI](),Ta(r,t,function(){var o,s,c;try{o=n.next(),s=o.value,c=o.done}catch(l){r.error(l);return}c?r.complete():r.next(s)},0,!0)}),function(){return Er(n?.return)&&n.return()}})}i(KI,"scheduleIterable");a(KI,"scheduleIterable");function O2(e,t){if(!e)throw new Error("Iterable cannot be null");return new dn(function(r){Ta(r,t,function(){var n=e[Symbol.asyncIterator]();Ta(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}i(O2,"scheduleAsyncIterable");a(O2,"scheduleAsyncIterable");function GI(e,t){return O2(M2(e),t)}i(GI,"scheduleReadableStreamLike");a(GI,"scheduleReadableStreamLike");function WI(e,t){if(e!=null){if(S2(e))return HI(e,t);if(E2(e))return VI(e,t);if(A2(e))return qI(e,t);if(x2(e))return O2(e,t);if(C2(e))return KI(e,t);if(I2(e))return GI(e,t)}throw T2(e)}i(WI,"scheduled");a(WI,"scheduled");function JI(e,t){return t?WI(e,t):Na(e)}i(JI,"from3");a(JI,"from");var ZI=qm(function(e){return a(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function YI(e){return e instanceof Date&&!isNaN(e)}i(YI,"isValidDate");a(YI,"isValidDate");function N2(e,t){return Qo(function(r,n){var o=0;r.subscribe(go(n,function(s){n.next(e.call(t,s,o++))}))})}i(N2,"map");a(N2,"map");var AH=Array.isArray;function XI(e,t){return AH(t)?e.apply(void 0,_s([],Ia(t))):e(t)}i(XI,"callOrApply");a(XI,"callOrApply");function QI(e){return N2(function(t){return XI(e,t)})}i(QI,"mapOneOrManyArgs");a(QI,"mapOneOrManyArgs");function ek(e,t,r,n,o,s,c,l){var h=[],p=0,m=0,y=!1,b=a(function(){y&&!h.length&&!p&&t.complete()},"checkComplete"),_=a(function(D){return p<n?x(D):h.push(D)},"outerNext"),x=a(function(D){s&&t.next(D),p++;var O=!1;Na(r(D,m++)).subscribe(go(t,function(B){o?.(B),s?_(B):t.next(B)},function(){O=!0},void 0,function(){if(O)try{p--;for(var B=a(function(){var Z=h.shift();c?Ta(t,c,function(){return x(Z)}):x(Z)},"_loop_1");h.length&&p<n;)B();b()}catch(Z){t.error(Z)}}))},"doInnerSub");return e.subscribe(go(t,_,function(){y=!0,b()})),function(){l?.()}}i(ek,"mergeInternals");a(ek,"mergeInternals");function Gm(e,t,r){return r===void 0&&(r=1/0),Er(t)?Gm(function(n,o){return N2(function(s,c){return t(n,s,o,c)})(Na(e(n,o)))},r):(typeof t=="number"&&(r=t),Qo(function(n,o){return ek(n,o,e,r)}))}i(Gm,"mergeMap");a(Gm,"mergeMap");function tk(e){return e===void 0&&(e=1/0),Gm(Km,e)}i(tk,"mergeAll");a(tk,"mergeAll");var SH=["addListener","removeListener"],xH=["addEventListener","removeEventListener"],TH=["on","off"];function am(e,t,r,n){if(Er(r)&&(n=r,r=void 0),n)return am(e,t,r).pipe(QI(n));var o=Ia(ik(e)?xH.map(function(l){return function(h){return e[l](t,h,r)}}):rk(e)?SH.map(Kb(e,t)):nk(e)?TH.map(Kb(e,t)):[],2),s=o[0],c=o[1];if(!s&&E2(e))return Gm(function(l){return am(l,t,r)})(Na(e));if(!s)throw new TypeError("Invalid event target");return new dn(function(l){var h=a(function(){for(var p=[],m=0;m<arguments.length;m++)p[m]=arguments[m];return l.next(1<p.length?p:p[0])},"handler");return s(h),function(){return c(h)}})}i(am,"fromEvent");a(am,"fromEvent");function Kb(e,t){return function(r){return function(n){return e[r](t,n)}}}i(Kb,"toCommonHandlerRegistry");a(Kb,"toCommonHandlerRegistry");function rk(e){return Er(e.addListener)&&Er(e.removeListener)}i(rk,"isNodeStyleEventEmitter");a(rk,"isNodeStyleEventEmitter");function nk(e){return Er(e.on)&&Er(e.off)}i(nk,"isJQueryStyleEventEmitter");a(nk,"isJQueryStyleEventEmitter");function ik(e){return Er(e.addEventListener)&&Er(e.removeEventListener)}i(ik,"isEventTarget");a(ik,"isEventTarget");function B2(e,t,r){e===void 0&&(e=0),r===void 0&&(r=EH);var n=-1;return t!=null&&(w2(t)?r=t:n=t),new dn(function(o){var s=YI(e)?+e-r.now():e;s<0&&(s=0);var c=0;return r.schedule(function(){o.closed||(o.next(c++),0<=n?this.schedule(void 0,n):o.complete())},s)})}i(B2,"timer");a(B2,"timer");function ok(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=OI(e),n=NI(e,1/0),o=e;return o.length?o.length===1?Na(o[0]):tk(n)(JI(o,r)):RI}i(ok,"merge");a(ok,"merge");function ak(e,t){return Qo(function(r,n){var o=0;r.subscribe(go(n,function(s){return e.call(t,s,o++)&&n.next(s)}))})}i(ak,"filter");a(ak,"filter");function sk(e){return Qo(function(t,r){var n=!1;t.subscribe(go(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}i(sk,"defaultIfEmpty");a(sk,"defaultIfEmpty");function ck(e){return e<=0?function(){return RI}:Qo(function(t,r){var n=0;t.subscribe(go(r,function(o){++n<=e&&(r.next(o),e<=n&&r.complete())}))})}i(ck,"take");a(ck,"take");function uk(e){return e===void 0&&(e=lk),Qo(function(t,r){var n=!1;t.subscribe(go(r,function(o){n=!0,r.next(o)},function(){return n?r.complete():r.error(e())}))})}i(uk,"throwIfEmpty");a(uk,"throwIfEmpty");function lk(){return new ZI}i(lk,"defaultErrorFactory");a(lk,"defaultErrorFactory");function fk(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?ak(function(o,s){return e(o,s,n)}):Km,ck(1),r?sk(t):uk(function(){return new ZI}))}}i(fk,"first");a(fk,"first");function dk(e,t){return Qo(function(r,n){var o=t??{},s=o.leading,c=s===void 0?!0:s,l=o.trailing,h=l===void 0?!1:l,p=!1,m=null,y=null,b=!1,_=a(function(){y?.unsubscribe(),y=null,h&&(O(),b&&n.complete())},"endThrottling"),x=a(function(){y=null,b&&n.complete()},"cleanupThrottling"),D=a(function(B){return y=Na(e(B)).subscribe(go(n,_,x))},"startThrottle"),O=a(function(){if(p){p=!1;var B=m;m=null,n.next(B),!b&&D(B)}},"send");r.subscribe(go(n,function(B){p=!0,m=B,!(y&&!y.closed)&&(c?O():D(B))},function(){b=!0,!(h&&p&&y&&!y.closed)&&n.complete()}))})}i(dk,"throttle");a(dk,"throttle");var YA;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(YA||(YA={}));var sm;(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"})(sm||(sm={}));var Gb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Gb||(Gb={}));var Wm=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,HA.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return _r.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>_r.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===Gb.ANCHOR).map(({cid:e})=>_r.make(this.id,e))}get state(){return(0,HA.default)(this.state$.value)}async sync(e={}){e={sync:Qn.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");a(Wm,"Stream");function Jm(){return e=>{}}i(Jm,"StreamStatic");a(Jm,"StreamStatic");var CH=ir(fj(),1);function hk(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):(ok(...e.map(r=>am(r,"abort"))).pipe(fk()).subscribe(()=>{t.abort()}),t.signal)}i(hk,"mergeAbortSignals");a(hk,"mergeAbortSignals");var pk=i(class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=B2(e).subscribe(()=>{t.abort()})}clear(){this._subscription?.unsubscribe()}},"TimedAbortSignal");a(pk,"TimedAbortSignal");async function mk(e,t){let r=new AbortController,n=a(()=>{r.abort()},"onAbort");return e.addEventListener("abort",n),e.aborted&&r.abort(),t(r.signal).finally(()=>{e.removeEventListener("abort",n)})}i(mk,"abortable2");a(mk,"abortable");var MH=60*1e3*3;async function bi(e,t={}){t.body&&Object.assign(t,{body:JSON.stringify(t.body),headers:{...t.headers,"Content-Type":"application/json"}});let r=t.timeout||MH,n=new pk(r),o=t.signal?hk([t.signal,n.signal]):n.signal,s=await mk(o,c=>(0,CH.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(bi,"fetchJson");a(bi,"fetchJson");var b0=ir(Ad(),1);Wo();function Sa(e){let t=jt.asCID(e);if(t)return t;if(typeof e=="string")return jt.parse(e);if(e instanceof Uint8Array)return jt.decode(e);throw new Error(`${e} cannot be converted to a CID`)}i(Sa,"toCID");a(Sa,"toCID");var XA=0,jr=i(class{static streamIdFromState(e){return new Xt(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,b0.default)(e);return jr.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=Cr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Cr(t.cacaoBlock,"base64")),t):(jr.isSignedCommit(e)&&(t.link=t.link.toString()),jr.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=Cr(e.header.model,"base64")),t)}static deserializeCommit(e){let t=(0,b0.default)(e);return jr.isSignedCommitContainer(t)?(t.jws.link=Sa(t.jws.link),t.linkedBlock=xr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=xr(t.cacaoBlock,"base64")),t):(jr.isSignedCommit(t)&&(t.link=Sa(t.link)),jr.isAnchorCommit(t)&&(t.proof=Sa(t.proof)),t.id&&(t.id=Sa(t.id)),t.prev&&(t.prev=Sa(t.prev)),t.header?.model&&(t.header.model=xr(t.header.model,"base64")),t)}static serializeState(e){let t=(0,b0.default)(e);return t.log=t.log.map(r=>({...r,cid:r.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=sm[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!=XA&&(t.metadata.unique=Cr(t.metadata.unique,"base64")),t.doctype=Ma.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,b0.default)(e);return t.doctype&&(t.type=Ma.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:Sa(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=Sa(t.anchorProof.txHash),t.anchorProof.root=Sa(t.anchorProof.root)),t.anchorStatus&&(t.anchorStatus=sm[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!=XA&&(t.metadata.unique=xr(e.metadata.unique,"base64")),t}static statesEqual(e,t){return JSON.stringify(jr.serializeState(e))===JSON.stringify(jr.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(jr.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");a(jr,"StreamUtils");var gk=i(class extends vH{next(e){let t=this.value;jr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");a(gk,"StreamStateSubject");var IH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate3"),vi,ib={anchor:!0,publish:!0,pin:!0,sync:Qn.PREFER_CACHE},kH={sync:Qn.PREFER_CACHE},QA={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function D0(e,t){if(typeof e?.schema=="string")try{_r.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=Cr((0,uH.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(D0,"headerFromMetadata");a(D0,"headerFromMetadata");async function Wb(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(Wb,"getAuthenticatedDID");a(Wb,"getAuthenticatedDID");async function R0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(R0,"throwReadOnlyError");a(R0,"throwReadOnlyError");var ka=vi=a(i(class extends Wm{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,cH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,o={}){o={...ib,...o},!n?.deterministic&&o.syncTimeoutSeconds==null&&(o.syncTimeoutSeconds=0);let s=o.asDID?{did:o.asDID}:t,c=await vi.makeGenesis(s,r,n);return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,c,o)}static async createFromGenesis(t,r,n={}){n={...ib,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let o=r.data?await vi._signDagJWS(t,r):r;return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,o,n)}static async deterministic(t,r,n={}){if(n={...ib,...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 o=await vi.makeGenesis(t,null,r);return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...kH,...n};let o=ws.from(r);if(o.type!=vi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${vi.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async update(t,r,n={}){n={...QA,...n};let o=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(o,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...QA,...r};let o={header:D0(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await vi._signDagJWS(this.api,o),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=R0,this.patch=R0,this.sync=R0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let o=await this._makeRawCommit(r,n);return vi._signDagJWS(t,o)}async _makeRawCommit(t,r){r||(r={});let n=D0(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 o=nI.compare(this.content,t),s=this.state.log[0];return{header:n,data:o,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 Wb(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 o=D0(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:o};return Bm(c),c}let s={data:r,header:o};return vi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await Wb(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");ka.STREAM_TYPE_NAME="tile";ka.STREAM_TYPE_ID=0;ka=vi=IH([Jm()],ka);var DH=ir(dj(),1);function vk(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(vk,"_checkPrivateRedeclaration2");a(vk,"_checkPrivateRedeclaration");function yk(e,t){return t.get?t.get.call(e):t.value}i(yk,"_classApplyDescriptorGet2");a(yk,"_classApplyDescriptorGet");function bk(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(bk,"_classApplyDescriptorSet2");a(bk,"_classApplyDescriptorSet");function P2(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(P2,"_classExtractFieldDescriptor2");a(P2,"_classExtractFieldDescriptor");function O0(e,t){var r=P2(e,t,"get");return yk(e,r)}i(O0,"_classPrivateFieldGet2");a(O0,"_classPrivateFieldGet");function Jb(e,t,r){vk(e,t),t.set(e,r)}i(Jb,"_classPrivateFieldInit2");a(Jb,"_classPrivateFieldInit");function Zb(e,t,r){var n=P2(e,t,"set");return bk(e,n,r),r}i(Zb,"_classPrivateFieldSet2");a(Zb,"_classPrivateFieldSet");function wk(e){return typeof e=="string"||_r.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(wk,"keyToQuery");a(wk,"keyToQuery");function N0(e){return typeof e=="string"?ws.from(e).toString():_r.isInstance(e)||Xt.isInstance(e)?e.toString():e.streamId.toString()}i(N0,"keyToString");a(N0,"keyToString");async function _k(e){let t=await ka.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(_k,"getDeterministicQuery");a(_k,"getDeterministicQuery");var RH=a(()=>Promise.resolve([]),"tempBatchLoadFn"),w0=new WeakMap,ob=new WeakMap,OH=i(class extends DH.default{cache(e){if(!O0(this,ob))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}async create(e,t,r){let n=await ka.create(O0(this,w0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await _k(e);try{return await super.load(r)}catch{let o=await ka.createFromGenesis(O0(this,w0),r.genesis,t);return this.cache(o),o}}async load(e){return await super.load(e)}async update(e,t,r,n){let o=N0(e);this.clear(o);let s=await this.load({streamId:o});return await s.update(t,r,n),s}constructor(e){super(RH,{cache:!0,cacheKeyFn:N0,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),Jb(this,w0,{writable:!0,value:void 0}),Jb(this,ob,{writable:!0,value:void 0}),this._batchLoadFn=async t=>{e.cache||this.clearAll();let r=await e.ceramic.multiQuery(t.map(wk),e.multiqueryTimeout);return t.map(n=>{let o=N0(n),s=r[o];return s||new Error(`Failed to load stream: ${o}`)})},Zb(this,w0,e.ceramic),Zb(this,ob,!!e.cache)}},"TileLoader");a(OH,"TileLoader");function Yb(e){return typeof e=="string"?Xt.fromString(e):e}i(Yb,"typeStreamID");a(Yb,"typeStreamID");function Ek(e,t){let r=new URL(e);for(let[n,o]of Object.entries(t))Xt.isInstance(o)?r.searchParams.set(n,o.toString()):typeof o=="object"?r.searchParams.set(n,JSON.stringify(o)):r.searchParams.set(n,o);return r}i(Ek,"serializeObjectToSearchParams");a(Ek,"serializeObjectToSearchParams");function Xb(e){let t={};for(let[r,n]of Object.entries(e))Xt.isInstance(n)?t[r]=n.toString():t[r]=n;return t}i(Xb,"serializeObjectForHttpPost");a(Xb,"serializeObjectForHttpPost");var Hi=i(class extends dn{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=B2(0,r).pipe(dk(()=>this._syncState(this.id,{sync:Qn.PREFER_CACHE}))).subscribe()),this.state$.subscribe(n).add(()=>{this.state$.observers.length===0&&this.periodicSubscription?.unsubscribe()})}),this.state$=new gk(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 Hi._load(e,this._apiUrl,t);this.state$.next(jr.deserializeState(r))}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}static async createFromGenesis(e,t,r,n,o){let s=new URL("./streams",e),{state:c}=await bi(s,{method:"post",body:{type:t,genesis:jr.serializeCommit(r),opts:n}});return new Hi(jr.deserializeState(c),e,o)}static async applyCommit(e,t,r,n,o){let s=new URL("./commits",e),{state:c}=await bi(s,{method:"post",body:{streamId:t.toString(),commit:jr.serializeCommit(r),opts:n}});return new Hi(jr.deserializeState(c),e,o)}static async _load(e,t,r){let n=Ek(new URL(`./streams/${e}`,t),r),{state:o}=await bi(n);return o}static async load(e,t,r,n){let o=await Hi._load(e,t,n);return new Hi(jr.deserializeState(o),t,r)}static async loadStreamCommits(e,t){let r=new URL(`./commits/${e}`,t),{commits:n}=await bi(r);return n.map(o=>({cid:o.cid,value:jr.deserializeCommit(o.value)}))}complete(){this.state$.complete()}},"Document");a(Hi,"Document");var cd;(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"})(cd||(cd={}));var eS=ir(Ad(),1),tS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(tS||(tS={}));var Qb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Qb||(Qb={}));var Ak=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,eS.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return _r.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>_r.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===Qb.ANCHOR).map(({cid:e})=>_r.make(this.id,e))}get state(){return(0,eS.default)(this.state$.value)}async sync(e={}){e={sync:cd.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");a(Ak,"Stream");function Sk(){return e=>{}}i(Sk,"StreamStatic2");a(Sk,"StreamStatic");function xk(e){if(typeof e=="string"&&e.includes("@")){let[t,r]=e.split("@");if(!t||!r)throw new Error("Invalid accountId provided");return new nd({address:t,chainId:r})}return new nd(e)}i(xk,"normalizeAccountId");a(xk,"normalizeAccountId");var NH="(?:%[0-9a-fA-F]{2})",rS=`(?:[a-zA-Z0-9._-]|${NH})`,BH="([a-z0-9]+)",PH=`((?:${rS}*:)*(${rS}+))`,nS="[a-zA-Z0-9_.:%-]",LH=`;${nS}+=${nS}*`,FH=`((${LH})*)`,UH="(/[^#?]*)?",$H="([?][^#]*)?",jH="(#.*)?",zH=new RegExp(`^did:${BH}:${PH}${FH}${UH}${$H}${jH}$`);function Tk(e){if(e===""||!e)return null;let t=e.match(zH);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 o of n){let s=o.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(Tk,"parse2");a(Tk,"parse");var HH=ir(Ad(),1),qH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate4"),yc,ab=a(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),iS={anchor:!1,publish:!0,sync:cd.PREFER_CACHE},sb={anchor:!0,publish:!0},VH={sync:cd.PREFER_CACHE},Ku=yc=a(i(class extends Ak{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,HH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...iS,...n};let o=xk(r),s=yc.makeGenesis(o);return yc.fromGenesis(t,s,n)}static async fromGenesis(t,r,n={}){return n={...iS,...n},t.createStreamFromGenesis(yc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...sb,...n};let o=typeof t=="string"?t.trim():t.id;if(Tk(o)?.did!==o)throw new Error(`DID is not valid: '${o}'`);let c=await r.createLink(o);return this.setDidProof(c,n)}async setDidProof(t,r={}){r={...sb,...r};let n=this.makeCommit(t),o=await this.api.applyCommit(this.id,n,r);this.state$.next(o.state)}async clearDid(t,r={}){r={...sb,...r};let n=await t.createLink("");return this.setDidProof(n,r)}static async load(t,r,n={}){n={...VH,...n};let o=ws.from(r);if(o.type!=yc.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${yc.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,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=ab,this.setDid=ab,this.sync=ab,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link2"),"Caip10Link");Ku.STREAM_TYPE_NAME="caip10-link";Ku.STREAM_TYPE_ID=1;Ku=yc=qH([Sk()],Ku);Wo();il();var KH=ir(Aj(),1),GH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate5"),zo,WH={sync:Qn.PREFER_CACHE};async function e6(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(e6,"_ensureAuthenticated");a(e6,"_ensureAuthenticated");async function Ck(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(Ck,"throwReadOnlyError3");a(Ck,"throwReadOnlyError");var Mc=zo=a(i(class extends Wm{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:zo.MODEL}}static async create(t,r,n){zo.assertComplete(r);let o={publish:!0,anchor:!0,pin:!0,sync:Qn.NEVER_SYNC,throwOnInvalidCommit:!0},s=await zo._makeGenesis(t,r,n);return await t.createStreamFromGenesis(zo.STREAM_TYPE_ID,s,o)}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={...WH,...n};let o=ws.from(r);if(o.type!=zo.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${zo.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return await t.loadStream(o,n)}static async _makeGenesis(t,r,n){let o=await this._makeRawGenesis(t,r,n);return zo._signDagJWS(t,o)}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 e6(t),n={controller:t.did.hasParent?t.did.parent:t.did.id};else throw new Error("No controller specified");let o={controllers:[n.controller],model:zo.MODEL.bytes};return{data:r,header:o}}makeReadOnly(){this.sync=Ck,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await e6(t),t.did.createDagJWS(r)}},"Model2"),"Model");Mc.STREAM_TYPE_NAME="model";Mc.STREAM_TYPE_ID=2;Mc.MODEL=function(){let e=Bm("model-v1"),t=KH.default.encode(e,"identity"),r=zu(V0,t),n=jt.createV1(V0,r);return new Xt("UNLOADABLE",n)}();Mc=zo=GH([Jm()],Mc);var JH=ir(sl(),1),ZH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate6"),ao,YH={anchor:!0,publish:!0,pin:!0,sync:Qn.NEVER_SYNC,syncTimeoutSeconds:0},XH={anchor:!1,publish:!1,pin:!0,sync:Qn.PREFER_CACHE},QH={sync:Qn.PREFER_CACHE},oS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};async function t6(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(t6,"_ensureAuthenticated2");a(t6,"_ensureAuthenticated");async function B0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(B0,"throwReadOnlyError4");a(B0,"throwReadOnlyError");var Gu=ao=a(i(class extends Wm{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,o={}){o={...YH,...o};let s=o.asDID?{did:o.asDID}:t,c=await ao._makeGenesis(s,r,n);return t.createStreamFromGenesis(ao.STREAM_TYPE_ID,c,o)}static async single(t,r,n={}){n={...XH,...n};let o=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let s=await ao._makeGenesis(o,null,r);return t.createStreamFromGenesis(ao.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...QH,...n};let o=ws.from(r);if(o.type!=ao.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${ao.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async replace(t,r={}){r={...oS,...r};let n=r.asDID?{did:r.asDID}:this.api,o=await this._makeCommit(n,t),s=await this.api.applyCommit(this.id,o,r);this.state$.next(s.state)}async patch(t,r={}){r={...oS,...r};let n={data:t,prev:this.tip,id:this.id.cid},o=await ao._signDagJWS(this.api,n),s=await this.api.applyCommit(this.id,o,r);this.state$.next(s.state)}makeReadOnly(){this.replace=B0,this.patch=B0,this.sync=B0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(t,r){let n=this._makeRawCommit(r);return ao._signDagJWS(t,n)}_makeRawCommit(t){return{data:nI.compare(this.content,t||{}),prev:this.tip,id:this.state.log[0].cid}}static async _makeGenesis(t,r,n){let o=await this._makeRawGenesis(t,r,n);return n.deterministic?(Bm(o),o):ao._signDagJWS(t,o)}static async _makeRawGenesis(t,r,n){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");let o=n.controller;if(!o)if(t.did)await t6(t),o=t.did.hasParent?t.did.parent:t.did.id;else throw new Error("No controller specified");let s={controllers:[o],model:n.model.bytes};return n.deterministic||(s.unique=(0,JH.randomBytes)(12)),{data:r,header:s}}static async _signDagJWS(t,r){return await t6(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");Gu.STREAM_TYPE_NAME="MID";Gu.STREAM_TYPE_ID=3;Gu=ao=ZH([Jm()],Gu);var Mk=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 bi(n,{method:"post",body:r})}async rm(e,t){let r=new URL(`./pins/${e}`,this._apiUrl);await bi(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 bi(t),{pinnedStreamIds:n}=r;return{[Symbol.asyncIterator](){let o=0;return{next(){return o===n.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:n[o++],done:!1})}}}}}},"RemotePinApi");a(Mk,"RemotePinApi");var Ik=i(class{constructor(e){this._fetchJson=bi,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:Xb(e)})).count}async query(e){let t=await this._fetchJson(this._collectionURL,{method:"POST",body:Xb(e)});return{edges:t.edges.map(n=>({cursor:n.cursor,node:jr.deserializeState(n.node)})),pageInfo:t.pageInfo}}},"RemoteIndexApi");a(Ik,"RemoteIndexApi");var kk=i(class{constructor(e,t){this._apiUrl=e,this._getDidFn=t,this._fetchJson=bi,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,o=await e.createJWS({code:t,requestPath:this.getModelsUrl().pathname,requestBody:n});return`${o.signatures[0].protected}.${o.payload}.${o.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");a(kk,"RemoteAdminApi");var eq="/api/v0/",tq="http://localhost:7007",rq={syncInterval:5e3},nq={anchor:!0,publish:!0,sync:Qn.PREFER_CACHE},iq={anchor:!0,publish:!0,sync:Qn.PREFER_CACHE},aS={sync:Qn.PREFER_CACHE},oq=i(class{constructor(e=tq,t={}){this._config={...rq,...t},this._apiUrl=new URL(eq,e),this._streamCache=new Map,this.context={api:this},this.pin=new Mk(this._apiUrl),this.index=new Ik(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new kk(this._apiUrl,r),this._streamConstructors={[Ku.STREAM_TYPE_ID]:Ku,[Mc.STREAM_TYPE_ID]:Mc,[Gu.STREAM_TYPE_ID]:Gu,[ka.STREAM_TYPE_ID]:ka}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...iq,...r};let n=await Hi.createFromGenesis(this._apiUrl,e,t,r,this._config.syncInterval),o=this._streamCache.get(n.id.toString());return o?(jr.statesEqual(n.state,o.state)||o.next(n.state),this.buildStreamFromDocument(o)):(this._streamCache.set(n.id.toString(),n),this.buildStreamFromDocument(n))}async loadStream(e,t={}){t={...aS,...t};let r=ws.from(e),n=this._streamCache.get(r.baseID.toString());return n?await n._syncState(r,t):(n=await Hi.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),o=await bi(n,{method:"post",body:{queries:r,timeout:t}});return Object.entries(o).reduce((s,c)=>{let[l,h]=c,p=jr.deserializeState(h),m=new Hi(p,this._apiUrl,this._config.syncInterval);return s[l]=this.buildStreamFromDocument(m),s},{})}loadStreamCommits(e){let t=Yb(e);return Hi.loadStreamCommits(t,this._apiUrl)}async applyCommit(e,t,r={}){r={...nq,...r};let n=Yb(e),o=await Hi.applyCommit(this._apiUrl,n,t,r,this._config.syncInterval),s=this._streamCache.get(n.toString());return s?(s.next(o.state),this.buildStreamFromDocument(o)):(this._streamCache.set(n.toString(),o),this.buildStreamFromDocument(o))}async requestAnchor(e,t={}){t={...aS,...t};let{anchorStatus:r}=await bi(`${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 Hi(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 bi(this._apiUrl+"/node/chains");return this._supportedChains=e,e}async close(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()}},"CeramicClient");a(oq,"CeramicClient");var nr;(function(e){e.assertEqual=o=>o;function t(o){}i(t,"assertIs"),a(t,"assertIs"),e.assertIs=t;function r(o){throw new Error}i(r,"assertNever"),a(r,"assertNever"),e.assertNever=r,e.arrayToEnum=o=>{let s={};for(let c of o)s[c]=c;return s},e.getValidEnumValues=o=>{let s=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),c={};for(let l of s)c[l]=o[l];return e.objectValues(c)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let c in o)Object.prototype.hasOwnProperty.call(o,c)&&s.push(c);return s},e.find=(o,s)=>{for(let c of o)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),a(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(nr||(nr={}));var rt=nr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),hs=a(e=>{switch(typeof e){case"undefined":return rt.undefined;case"string":return rt.string;case"number":return isNaN(e)?rt.nan:rt.number;case"boolean":return rt.boolean;case"function":return rt.function;case"bigint":return rt.bigint;case"symbol":return rt.symbol;case"object":return Array.isArray(e)?rt.array:e===null?rt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?rt.promise:typeof Map<"u"&&e instanceof Map?rt.map:typeof Set<"u"&&e instanceof Set?rt.set:typeof Date<"u"&&e instanceof Date?rt.date:rt.object;default:return rt.unknown}},"getParsedType"),Ge=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"]),aq=a(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ho=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(o){return o.message},r={_errors:[]},n=a(o=>{for(let s of o.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 h=s.path[l];l===s.path.length-1?(c[h]=c[h]||{_errors:[]},c[h]._errors.push(t(s))):c[h]=c[h]||{_errors:[]},c=c[h],l++}}},"processError");return n(this),r}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");a(Ho,"ZodError");Ho.create=e=>new Ho(e);var ud=a((e,t)=>{let r;switch(e.code){case Ge.invalid_type:e.received===rt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ge.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,nr.jsonStringifyReplacer)}`;break;case Ge.unrecognized_keys:r=`Unrecognized key(s) in object: ${nr.joinValues(e.keys,", ")}`;break;case Ge.invalid_union:r="Invalid input";break;case Ge.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${nr.joinValues(e.options)}`;break;case Ge.invalid_enum_value:r=`Invalid enum value. Expected ${nr.joinValues(e.options)}, received '${e.received}'`;break;case Ge.invalid_arguments:r="Invalid function arguments";break;case Ge.invalid_return_type:r="Invalid function return type";break;case Ge.invalid_date:r="Invalid date";break;case Ge.invalid_string:typeof e.validation=="object"?"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 Ge.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(e.minimum)}`:r="Invalid input";break;case Ge.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==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(e.maximum)}`:r="Invalid input";break;case Ge.custom:r="Invalid input";break;case Ge.invalid_intersection_types:r="Intersection results could not be merged";break;case Ge.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ge.not_finite:r="Number must be finite";break;default:r=t.defaultError,nr.assertNever(e)}return{message:r}},"errorMap"),Dk=ud;function Rk(e){Dk=e}i(Rk,"setErrorMap");a(Rk,"setErrorMap");function ld(){return Dk}i(ld,"getErrorMap");a(ld,"getErrorMap");var cm=a(e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],c={...o,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...o,path:s,message:o.message||l}},"makeIssue"),sq=[];function gt(e,t){let r=cm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,ld(),ud].filter(n=>!!n)});e.common.issues.push(r)}i(gt,"addIssueToContext");a(gt,"addIssueToContext");var Pn=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 Dt;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)r.push({key:await n.key,value:await n.value});return Pn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return Dt;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),(typeof s.value<"u"||n.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}},"ParseStatus");a(Pn,"ParseStatus");var Dt=Object.freeze({status:"aborted"}),Ok=a(e=>({status:"dirty",value:e}),"DIRTY"),xn=a(e=>({status:"valid",value:e}),"OK"),r6=a(e=>e.status==="aborted","isAborted"),n6=a(e=>e.status==="dirty","isDirty"),um=a(e=>e.status==="valid","isValid"),lm=a(e=>typeof Promise!==void 0&&e instanceof Promise,"isAsync"),Jt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Jt||(Jt={}));var vo=i(class{constructor(e,t,r,n){this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._path.concat(this._key)}},"ParseInputLazyPath");a(vo,"ParseInputLazyPath");var sS=a((e,t)=>{if(um(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Ho(e.common.issues);return{success:!1,error:r}}},"handleResult");function zt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:a((c,l)=>c.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:n??l.defaultError}:{message:r??l.defaultError},"customMap"),description:o}}i(zt,"processCreateParams");a(zt,"processCreateParams");var $t=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.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return hs(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pn,ctx:{common:e.parent.common,data:e.data,parsedType:hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(lm(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:hs(e)},o=this._parseSync({data:e,path:n.path,parent:n});return sS(n,o)}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:hs(e)},n=this._parse({data:e,path:r.path,parent:r}),o=await(lm(n)?n:Promise.resolve(n));return sS(r,o)}refine(e,t){let r=a(n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t,"getIssueProperties");return this._refinement((n,o)=>{let s=e(n),c=a(()=>o.addIssue({code:Ge.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 Vi({schema:this,typeName:Tt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return mo.create(this)}nullable(){return As.create(this)}nullish(){return this.optional().nullable()}array(){return po.create(this)}promise(){return Rc.create(this)}or(e){return Xu.create([this,e])}and(e){return Qu.create(this,e)}transform(e){return new Vi({schema:this,typeName:Tt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new nl({innerType:this,defaultValue:t,typeName:Tt.ZodDefault})}brand(){return new F2({typeName:Tt.ZodBranded,type:this,...zt(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new md({innerType:this,defaultValue:t,typeName:Tt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Od.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},"ZodType");a($t,"ZodType");var cq=/^c[^\s-]{8,}$/i,uq=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,lq=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,fq=a(e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex"),Da=i(class extends $t{constructor(){super(...arguments),this._regex=(e,t,r)=>this.refinement(n=>e.test(n),{validation:t,code:Ge.invalid_string,...Jt.errToObj(r)}),this.nonempty=e=>this.min(1,Jt.errToObj(e)),this.trim=()=>new Da({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==rt.string){let o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.string,received:o.parsedType}),Dt}let r=new Pn,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,c=e.data.length<o.value;(s||c)&&(n=this._getOrReturnCtx(e,n),s?gt(n,{code:Ge.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):c&&gt(n,{code:Ge.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")lq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"email",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")uq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"uuid",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")cq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"cuid",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),gt(n,{validation:"url",code:Ge.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"regex",code:Ge.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?fq(o).test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:"datetime",message:o.message}),r.dirty()):nr.assertNever(o);return{status:r.value,value:e.data}}_addCheck(e){return new Da({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Jt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Jt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Jt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Jt.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...Jt.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Jt.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Jt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Jt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Jt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Jt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Jt.errToObj(t)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}},"ZodString");a(Da,"ZodString");Da.create=e=>{var t;return new Da({checks:[],typeName:Tt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};function Nk(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=parseInt(e.toFixed(o).replace(".","")),c=parseInt(t.toFixed(o).replace(".",""));return s%c/Math.pow(10,o)}i(Nk,"floatSafeRemainder");a(Nk,"floatSafeRemainder");var Es=i(class extends $t{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)!==rt.number){let o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.number,received:o.parsedType}),Dt}let r,n=new Pn;for(let o of this._def.checks)o.kind==="int"?nr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?Nk(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_finite,message:o.message}),n.dirty()):nr.assertNever(o);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Jt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Jt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Jt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Jt.toString(t))}setLimit(e,t,r,n){return new Es({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Jt.toString(n)}]})}_addCheck(e){return new Es({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Jt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Jt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Jt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Jt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Jt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Jt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Jt.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")}},"ZodNumber");a(Es,"ZodNumber");Es.create=e=>new Es({checks:[],typeName:Tt.ZodNumber,coerce:e?.coerce||!1,...zt(e)});var Wu=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==rt.bigint){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.bigint,received:r.parsedType}),Dt}return xn(e.data)}},"ZodBigInt");a(Wu,"ZodBigInt");Wu.create=e=>{var t;return new Wu({typeName:Tt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};var Ju=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==rt.boolean){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.boolean,received:r.parsedType}),Dt}return xn(e.data)}},"ZodBoolean");a(Ju,"ZodBoolean");Ju.create=e=>new Ju({typeName:Tt.ZodBoolean,coerce:e?.coerce||!1,...zt(e)});var Ic=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==rt.date){let o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.date,received:o.parsedType}),Dt}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_date}),Dt}let r=new Pn,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):nr.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ic({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Jt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Jt.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");a(Ic,"ZodDate");Ic.create=e=>new Ic({checks:[],coerce:e?.coerce||!1,typeName:Tt.ZodDate,...zt(e)});var fd=i(class extends $t{_parse(e){if(this._getType(e)!==rt.symbol){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.symbol,received:r.parsedType}),Dt}return xn(e.data)}},"ZodSymbol");a(fd,"ZodSymbol");fd.create=e=>new fd({typeName:Tt.ZodSymbol,...zt(e)});var Zu=i(class extends $t{_parse(e){if(this._getType(e)!==rt.undefined){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.undefined,received:r.parsedType}),Dt}return xn(e.data)}},"ZodUndefined");a(Zu,"ZodUndefined");Zu.create=e=>new Zu({typeName:Tt.ZodUndefined,...zt(e)});var Yu=i(class extends $t{_parse(e){if(this._getType(e)!==rt.null){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.null,received:r.parsedType}),Dt}return xn(e.data)}},"ZodNull");a(Yu,"ZodNull");Yu.create=e=>new Yu({typeName:Tt.ZodNull,...zt(e)});var kc=i(class extends $t{constructor(){super(...arguments),this._any=!0}_parse(e){return xn(e.data)}},"ZodAny");a(kc,"ZodAny");kc.create=e=>new kc({typeName:Tt.ZodAny,...zt(e)});var ms=i(class extends $t{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xn(e.data)}},"ZodUnknown");a(ms,"ZodUnknown");ms.create=e=>new ms({typeName:Tt.ZodUnknown,...zt(e)});var qo=i(class extends $t{_parse(e){let t=this._getOrReturnCtx(e);return gt(t,{code:Ge.invalid_type,expected:rt.never,received:t.parsedType}),Dt}},"ZodNever");a(qo,"ZodNever");qo.create=e=>new qo({typeName:Tt.ZodNever,...zt(e)});var dd=i(class extends $t{_parse(e){if(this._getType(e)!==rt.undefined){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.void,received:r.parsedType}),Dt}return xn(e.data)}},"ZodVoid");a(dd,"ZodVoid");dd.create=e=>new dd({typeName:Tt.ZodVoid,...zt(e)});var po=i(class extends $t{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==rt.array)return gt(t,{code:Ge.invalid_type,expected:rt.array,received:t.parsedType}),Dt;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,c=t.data.length<n.exactLength.value;(s||c)&&(gt(t,{code:s?Ge.too_big:Ge.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&&(gt(t,{code:Ge.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&&(gt(t,{code:Ge.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 vo(t,s,t.path,c)))).then(s=>Pn.mergeArray(r,s));let o=t.data.map((s,c)=>n.type._parseSync(new vo(t,s,t.path,c)));return Pn.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new po({...this._def,minLength:{value:e,message:Jt.toString(t)}})}max(e,t){return new po({...this._def,maxLength:{value:e,message:Jt.toString(t)}})}length(e,t){return new po({...this._def,exactLength:{value:e,message:Jt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");a(po,"ZodArray");po.create=(e,t)=>new po({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Tt.ZodArray,...zt(t)});var fm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(fm||(fm={}));var cS=a(e=>t=>new Ir({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function bc(e){if(e instanceof Ir){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=mo.create(bc(n))}return new Ir({...e._def,shape:()=>t})}else return e instanceof po?po.create(bc(e.element)):e instanceof mo?mo.create(bc(e.unwrap())):e instanceof As?As.create(bc(e.unwrap())):e instanceof Vo?Vo.create(e.items.map(t=>bc(t))):e}i(bc,"deepPartialify");a(bc,"deepPartialify");var Ir=i(class extends $t{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=cS(this._def),this.extend=cS(this._def)}_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)!==rt.object){let h=this._getOrReturnCtx(e);return gt(h,{code:Ge.invalid_type,expected:rt.object,received:h.parsedType}),Dt}let{status:r,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof qo&&this._def.unknownKeys==="strip"))for(let h in n.data)s.includes(h)||c.push(h);let l=[];for(let h of s){let p=o[h],m=n.data[h];l.push({key:{status:"valid",value:h},value:p._parse(new vo(n,m,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof qo){let h=this._def.unknownKeys;if(h==="passthrough")for(let p of c)l.push({key:{status:"valid",value:p},value:{status:"valid",value:n.data[p]}});else if(h==="strict")c.length>0&&(gt(n,{code:Ge.unrecognized_keys,keys:c}),r.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let h=this._def.catchall;for(let p of c){let m=n.data[p];l.push({key:{status:"valid",value:p},value:h._parse(new vo(n,m,n.path,p)),alwaysSet:p in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let h=[];for(let p of l){let m=await p.key;h.push({key:m,value:await p.value,alwaysSet:p.alwaysSet})}return h}).then(h=>Pn.mergeObjectSync(r,h)):Pn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return Jt.errToObj,new Ir({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,o,s,c;let l=(s=(o=(n=this._def).errorMap)===null||o===void 0?void 0:o.call(n,t,r).message)!==null&&s!==void 0?s:r.defaultError;return t.code==="unrecognized_keys"?{message:(c=Jt.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Ir({...this._def,unknownKeys:"strip"})}passthrough(){return new Ir({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new Ir({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>fm.mergeShapes(this._def.shape(),e._def.shape()),typeName:Tt.ZodObject})}catchall(e){return new Ir({...this._def,catchall:e})}pick(e){let t={};return nr.objectKeys(e).map(r=>{this.shape[r]&&(t[r]=this.shape[r])}),new Ir({...this._def,shape:()=>t})}omit(e){let t={};return nr.objectKeys(this.shape).map(r=>{nr.objectKeys(e).indexOf(r)===-1&&(t[r]=this.shape[r])}),new Ir({...this._def,shape:()=>t})}deepPartial(){return bc(this)}partial(e){let t={};if(e)return nr.objectKeys(this.shape).map(r=>{nr.objectKeys(e).indexOf(r)===-1?t[r]=this.shape[r]:t[r]=this.shape[r].optional()}),new Ir({...this._def,shape:()=>t});for(let r in this.shape){let n=this.shape[r];t[r]=n.optional()}return new Ir({...this._def,shape:()=>t})}required(e){let t={};if(e)nr.objectKeys(this.shape).map(r=>{if(nr.objectKeys(e).indexOf(r)===-1)t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof mo;)o=o._def.innerType;t[r]=o}});else for(let r in this.shape){let o=this.shape[r];for(;o instanceof mo;)o=o._def.innerType;t[r]=o}return new Ir({...this._def,shape:()=>t})}keyof(){return L2(nr.objectKeys(this.shape))}},"ZodObject");a(Ir,"ZodObject");Ir.create=(e,t)=>new Ir({shape:()=>e,unknownKeys:"strip",catchall:qo.create(),typeName:Tt.ZodObject,...zt(t)});Ir.strictCreate=(e,t)=>new Ir({shape:()=>e,unknownKeys:"strict",catchall:qo.create(),typeName:Tt.ZodObject,...zt(t)});Ir.lazycreate=(e,t)=>new Ir({shape:e,unknownKeys:"strip",catchall:qo.create(),typeName:Tt.ZodObject,...zt(t)});var Xu=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(o){for(let c of o)if(c.result.status==="valid")return c.result;for(let c of o)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let s=o.map(c=>new Ho(c.ctx.common.issues));return gt(t,{code:Ge.invalid_union,unionErrors:s}),Dt}if(i(n,"handleResults"),a(n,"handleResults"),t.common.async)return Promise.all(r.map(async o=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);{let o,s=[];for(let l of r){let h={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:h});if(p.status==="valid")return p;p.status==="dirty"&&!o&&(o={result:p,ctx:h}),h.common.issues.length&&s.push(h.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let c=s.map(l=>new Ho(l));return gt(t,{code:Ge.invalid_union,unionErrors:c}),Dt}}get options(){return this._def.options}},"ZodUnion");a(Xu,"ZodUnion");Xu.create=(e,t)=>new Xu({options:e,typeName:Tt.ZodUnion,...zt(t)});var P0=a(e=>e instanceof el?P0(e.schema):e instanceof Vi?P0(e.innerType()):e instanceof tl?[e.value]:e instanceof bl?e.options:e instanceof rl?Object.keys(e.enum):e instanceof nl?P0(e._def.innerType):e instanceof Zu?[void 0]:e instanceof Yu?[null]:null,"getDiscriminator"),Zm=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.object)return gt(t,{code:Ge.invalid_type,expected:rt.object,received:t.parsedType}),Dt;let r=this.discriminator,n=t.data[r],o=this.optionsMap.get(n);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(gt(t,{code:Ge.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Dt)}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 o of t){let s=P0(o.shape[e]);if(!s)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,o)}}return new Zm({typeName:Tt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...zt(r)})}},"ZodDiscriminatedUnion");a(Zm,"ZodDiscriminatedUnion");function dm(e,t){let r=hs(e),n=hs(t);if(e===t)return{valid:!0,data:e};if(r===rt.object&&n===rt.object){let o=nr.objectKeys(t),s=nr.objectKeys(e).filter(l=>o.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=dm(e[l],t[l]);if(!h.valid)return{valid:!1};c[l]=h.data}return{valid:!0,data:c}}else if(r===rt.array&&n===rt.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=dm(c,l);if(!h.valid)return{valid:!1};o.push(h.data)}return{valid:!0,data:o}}else return r===rt.date&&n===rt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(dm,"mergeValues");a(dm,"mergeValues");var Qu=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=a((o,s)=>{if(r6(o)||r6(s))return Dt;let c=dm(o.value,s.value);return c.valid?((n6(o)||n6(s))&&t.dirty(),{status:t.value,value:c.data}):(gt(r,{code:Ge.invalid_intersection_types}),Dt)},"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(([o,s])=>n(o,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");a(Qu,"ZodIntersection");Qu.create=(e,t,r)=>new Qu({left:e,right:t,typeName:Tt.ZodIntersection,...zt(r)});var Vo=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.array)return gt(r,{code:Ge.invalid_type,expected:rt.array,received:r.parsedType}),Dt;if(r.data.length<this._def.items.length)return gt(r,{code:Ge.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Dt;!this._def.rest&&r.data.length>this._def.items.length&&(gt(r,{code:Ge.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=r.data.map((s,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new vo(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Pn.mergeArray(t,s)):Pn.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new Vo({...this._def,rest:e})}},"ZodTuple");a(Vo,"ZodTuple");Vo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vo({items:e,typeName:Tt.ZodTuple,rest:null,...zt(t)})};var hd=i(class extends $t{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!==rt.object)return gt(r,{code:Ge.invalid_type,expected:rt.object,received:r.parsedType}),Dt;let n=[],o=this._def.keyType,s=this._def.valueType;for(let c in r.data)n.push({key:o._parse(new vo(r,c,r.path,c)),value:s._parse(new vo(r,r.data[c],r.path,c))});return r.common.async?Pn.mergeObjectAsync(t,n):Pn.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof $t?new hd({keyType:e,valueType:t,typeName:Tt.ZodRecord,...zt(r)}):new hd({keyType:Da.create(),valueType:e,typeName:Tt.ZodRecord,...zt(t)})}},"ZodRecord");a(hd,"ZodRecord");var pd=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.map)return gt(r,{code:Ge.invalid_type,expected:rt.map,received:r.parsedType}),Dt;let n=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([c,l],h)=>({key:n._parse(new vo(r,c,r.path,[h,"key"])),value:o._parse(new vo(r,l,r.path,[h,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of s){let h=await l.key,p=await l.value;if(h.status==="aborted"||p.status==="aborted")return Dt;(h.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(h.value,p.value)}return{status:t.value,value:c}})}else{let c=new Map;for(let l of s){let h=l.key,p=l.value;if(h.status==="aborted"||p.status==="aborted")return Dt;(h.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(h.value,p.value)}return{status:t.value,value:c}}}},"ZodMap");a(pd,"ZodMap");pd.create=(e,t,r)=>new pd({valueType:t,keyType:e,typeName:Tt.ZodMap,...zt(r)});var Dc=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.set)return gt(r,{code:Ge.invalid_type,expected:rt.set,received:r.parsedType}),Dt;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(gt(r,{code:Ge.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&&(gt(r,{code:Ge.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let o=this._def.valueType;function s(l){let h=new Set;for(let p of l){if(p.status==="aborted")return Dt;p.status==="dirty"&&t.dirty(),h.add(p.value)}return{status:t.value,value:h}}i(s,"finalizeSet"),a(s,"finalizeSet");let c=[...r.data.values()].map((l,h)=>o._parse(new vo(r,l,r.path,h)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,t){return new Dc({...this._def,minSize:{value:e,message:Jt.toString(t)}})}max(e,t){return new Dc({...this._def,maxSize:{value:e,message:Jt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}},"ZodSet");a(Dc,"ZodSet");Dc.create=(e,t)=>new Dc({valueType:e,minSize:null,maxSize:null,typeName:Tt.ZodSet,...zt(t)});var Uu=i(class extends $t{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.function)return gt(t,{code:Ge.invalid_type,expected:rt.function,received:t.parsedType}),Dt;function r(c,l){return cm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ld(),ud].filter(h=>!!h),issueData:{code:Ge.invalid_arguments,argumentsError:l}})}i(r,"makeArgsIssue"),a(r,"makeArgsIssue");function n(c,l){return cm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ld(),ud].filter(h=>!!h),issueData:{code:Ge.invalid_return_type,returnTypeError:l}})}i(n,"makeReturnsIssue"),a(n,"makeReturnsIssue");let o={errorMap:t.common.contextualErrorMap},s=t.data;return this._def.returns instanceof Rc?xn(async(...c)=>{let l=new Ho([]),h=await this._def.args.parseAsync(c,o).catch(y=>{throw l.addIssue(r(c,y)),l}),p=await s(...h);return await this._def.returns._def.type.parseAsync(p,o).catch(y=>{throw l.addIssue(n(p,y)),l})}):xn((...c)=>{let l=this._def.args.safeParse(c,o);if(!l.success)throw new Ho([r(c,l.error)]);let h=s(...l.data),p=this._def.returns.safeParse(h,o);if(!p.success)throw new Ho([n(h,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Uu({...this._def,args:Vo.create(e).rest(ms.create())})}returns(e){return new Uu({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Uu({args:e||Vo.create([]).rest(ms.create()),returns:t||ms.create(),typeName:Tt.ZodFunction,...zt(r)})}},"ZodFunction");a(Uu,"ZodFunction");var el=i(class extends $t{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");a(el,"ZodLazy");el.create=(e,t)=>new el({getter:e,typeName:Tt.ZodLazy,...zt(t)});var tl=i(class extends $t{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return gt(t,{code:Ge.invalid_literal,expected:this._def.value}),Dt}return{status:"valid",value:e.data}}get value(){return this._def.value}},"ZodLiteral");a(tl,"ZodLiteral");tl.create=(e,t)=>new tl({value:e,typeName:Tt.ZodLiteral,...zt(t)});function L2(e,t){return new bl({values:e,typeName:Tt.ZodEnum,...zt(t)})}i(L2,"createZodEnum");a(L2,"createZodEnum");var bl=i(class extends $t{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return gt(t,{expected:nr.joinValues(r),received:t.parsedType,code:Ge.invalid_type}),Dt}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),r=this._def.values;return gt(t,{received:t.data,code:Ge.invalid_enum_value,options:r}),Dt}return xn(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}},"ZodEnum");a(bl,"ZodEnum");bl.create=L2;var rl=i(class extends $t{_parse(e){let t=nr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==rt.string&&r.parsedType!==rt.number){let n=nr.objectValues(t);return gt(r,{expected:nr.joinValues(n),received:r.parsedType,code:Ge.invalid_type}),Dt}if(t.indexOf(e.data)===-1){let n=nr.objectValues(t);return gt(r,{received:r.data,code:Ge.invalid_enum_value,options:n}),Dt}return xn(e.data)}get enum(){return this._def.values}},"ZodNativeEnum");a(rl,"ZodNativeEnum");rl.create=(e,t)=>new rl({values:e,typeName:Tt.ZodNativeEnum,...zt(t)});var Rc=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.promise&&t.common.async===!1)return gt(t,{code:Ge.invalid_type,expected:rt.promise,received:t.parsedType}),Dt;let r=t.parsedType===rt.promise?t.data:Promise.resolve(t.data);return xn(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}},"ZodPromise");a(Rc,"ZodPromise");Rc.create=(e,t)=>new Rc({type:e,typeName:Tt.ZodPromise,...zt(t)});var Vi=i(class extends $t{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Tt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null;if(n.type==="preprocess"){let s=n.transform(r.data);return r.common.async?Promise.resolve(s).then(c=>this._def.schema._parseAsync({data:c,path:r.path,parent:r})):this._def.schema._parseSync({data:s,path:r.path,parent:r})}let o={addIssue:s=>{gt(r,s),s.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="refinement"){let s=a(c=>{let l=n.refinement(c,o);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"?Dt:(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"?Dt:(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(!um(s))return s;let c=n.transform(s.value,o);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=>um(s)?Promise.resolve(n.transform(s.value,o)).then(c=>({status:t.value,value:c})):s);nr.assertNever(n)}},"ZodEffects");a(Vi,"ZodEffects");Vi.create=(e,t,r)=>new Vi({schema:e,typeName:Tt.ZodEffects,effect:t,...zt(r)});Vi.createWithPreprocess=(e,t,r)=>new Vi({schema:t,effect:{type:"preprocess",transform:e},typeName:Tt.ZodEffects,...zt(r)});var mo=i(class extends $t{_parse(e){return this._getType(e)===rt.undefined?xn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodOptional");a(mo,"ZodOptional");mo.create=(e,t)=>new mo({innerType:e,typeName:Tt.ZodOptional,...zt(t)});var As=i(class extends $t{_parse(e){return this._getType(e)===rt.null?xn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodNullable");a(As,"ZodNullable");As.create=(e,t)=>new As({innerType:e,typeName:Tt.ZodNullable,...zt(t)});var nl=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===rt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}},"ZodDefault");a(nl,"ZodDefault");nl.create=(e,t)=>new nl({innerType:e,typeName:Tt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var md=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return lm(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()})):{status:"valid",value:r.status==="valid"?r.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}},"ZodCatch");a(md,"ZodCatch");md.create=(e,t)=>new md({innerType:e,typeName:Tt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var gd=i(class extends $t{_parse(e){if(this._getType(e)!==rt.nan){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.nan,received:r.parsedType}),Dt}return{status:"valid",value:e.data}}},"ZodNaN");a(gd,"ZodNaN");gd.create=e=>new gd({typeName:Tt.ZodNaN,...zt(e)});var dq=Symbol("zod_brand"),F2=i(class extends $t{_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");a(F2,"ZodBranded");var Od=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return a(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Dt:o.status==="dirty"?(t.dirty(),Ok(o.value)):this._def.out._parseAsync({data:o.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"?Dt: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 Od({in:e,out:t,typeName:Tt.ZodPipeline})}},"ZodPipeline");a(Od,"ZodPipeline");var Bk=a((e,t={},r)=>e?kc.create().superRefine((n,o)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...c,fatal:r})}}):kc.create(),"custom"),hq={object:Ir.lazycreate},Tt;(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"})(Tt||(Tt={}));var pq=a((e,t={message:`Input not instance of ${e.name}`})=>Bk(r=>r instanceof e,t,!0),"instanceOfType"),Pk=Da.create,Lk=Es.create,mq=gd.create,gq=Wu.create,Fk=Ju.create,vq=Ic.create,yq=fd.create,bq=Zu.create,wq=Yu.create,_q=kc.create,Eq=ms.create,Aq=qo.create,Sq=dd.create,xq=po.create,Tq=Ir.create,Cq=Ir.strictCreate,Mq=Xu.create,Iq=Zm.create,kq=Qu.create,Dq=Vo.create,Rq=hd.create,Oq=pd.create,Nq=Dc.create,Bq=Uu.create,Pq=el.create,Lq=tl.create,Fq=bl.create,Uq=rl.create,$q=Rc.create,uS=Vi.create,jq=mo.create,zq=As.create,Hq=Vi.createWithPreprocess,qq=Od.create,Vq=a(()=>Pk().optional(),"ostring"),Kq=a(()=>Lk().optional(),"onumber"),Gq=a(()=>Fk().optional(),"oboolean"),Wq={string:e=>Da.create({...e,coerce:!0}),number:e=>Es.create({...e,coerce:!0}),boolean:e=>Ju.create({...e,coerce:!0}),bigint:e=>Wu.create({...e,coerce:!0}),date:e=>Ic.create({...e,coerce:!0})},Jq=Dt,G=Object.freeze({__proto__:null,defaultErrorMap:ud,setErrorMap:Rk,getErrorMap:ld,makeIssue:cm,EMPTY_PATH:sq,addIssueToContext:gt,ParseStatus:Pn,INVALID:Dt,DIRTY:Ok,OK:xn,isAborted:r6,isDirty:n6,isValid:um,isAsync:lm,get util(){return nr},ZodParsedType:rt,getParsedType:hs,ZodType:$t,ZodString:Da,ZodNumber:Es,ZodBigInt:Wu,ZodBoolean:Ju,ZodDate:Ic,ZodSymbol:fd,ZodUndefined:Zu,ZodNull:Yu,ZodAny:kc,ZodUnknown:ms,ZodNever:qo,ZodVoid:dd,ZodArray:po,get objectUtil(){return fm},ZodObject:Ir,ZodUnion:Xu,ZodDiscriminatedUnion:Zm,ZodIntersection:Qu,ZodTuple:Vo,ZodRecord:hd,ZodMap:pd,ZodSet:Dc,ZodFunction:Uu,ZodLazy:el,ZodLiteral:tl,ZodEnum:bl,ZodNativeEnum:rl,ZodPromise:Rc,ZodEffects:Vi,ZodTransformer:Vi,ZodOptional:mo,ZodNullable:As,ZodDefault:nl,ZodCatch:md,ZodNaN:gd,BRAND:dq,ZodBranded:F2,ZodPipeline:Od,custom:Bk,Schema:$t,ZodSchema:$t,late:hq,get ZodFirstPartyTypeKind(){return Tt},coerce:Wq,any:_q,array:xq,bigint:gq,boolean:Fk,date:vq,discriminatedUnion:Iq,effect:uS,enum:Fq,function:Bq,instanceof:pq,intersection:kq,lazy:Pq,literal:Lq,map:Oq,nan:mq,nativeEnum:Uq,never:Aq,null:wq,nullable:zq,number:Lk,object:Tq,oboolean:Gq,onumber:Kq,optional:jq,ostring:Vq,pipeline:qq,preprocess:Hq,promise:$q,record:Rq,set:Nq,strictObject:Cq,string:Pk,symbol:yq,transformer:uS,tuple:Dq,undefined:bq,union:Mq,unknown:Eq,void:Sq,NEVER:Jq,ZodIssueCode:Ge,quotelessJson:aq,ZodError:Ho}),Zq=Object.defineProperty,Yq=a((e,t)=>Zq(e,"name",{value:t,configurable:!0}),"__name"),Ym=G.array(G.string().or(G.record(G.any()))),AY=G.object({type:G.string().optional(),narrative:G.string().optional()}),Xm=G.string().or(G.object({id:G.string(),type:G.string(),caption:G.string().optional()})),Xq=G.object({type:G.string().min(1).or(G.string().array().nonempty()),latitude:G.number(),longitude:G.number()}),Qq=G.object({type:G.string().min(1).or(G.string().array().nonempty()),addressCountry:G.string().optional(),addressCountryCode:G.string().optional(),addressRegion:G.string().optional(),addressLocality:G.string().optional(),streetAddress:G.string().optional(),postOfficeBoxNumber:G.string().optional(),postalCode:G.string().optional(),geo:Xq.optional()}),eV=G.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(G.string()),Uk=G.object({type:G.string().min(1).or(G.string().array().nonempty()),identifier:G.string(),identifierType:eV}),vd=G.string().or(G.object({id:G.string().optional(),type:G.string().or(G.string().array().nonempty().optional()),name:G.string().optional(),url:G.string().optional(),phone:G.string().optional(),description:G.string().optional(),endorsement:G.any().array().optional(),image:Xm.optional(),email:G.string().email().optional(),address:Qq.optional(),otherIdentifier:Uk.array().optional(),official:G.string().optional(),parentOrg:G.any().optional(),familyName:G.string().optional(),givenName:G.string().optional(),additionalName:G.string().optional(),patronymicName:G.string().optional(),honorificPrefix:G.string().optional(),honorificSuffix:G.string().optional(),familyNamePrefix:G.string().optional(),dateOfBirth:G.string().optional()}).catchall(G.any())),i6=G.object({id:G.string().optional()}).catchall(G.any()),tV=G.object({type:G.string(),id:G.string()}).catchall(G.any()),rV=G.object({id:G.string(),type:G.string()}).catchall(G.any()),nV=G.object({id:G.string(),type:G.string()}).catchall(G.any()),hm=G.object({"@context":Ym,id:G.string().optional(),type:G.string().array().nonempty(),issuer:vd,issuanceDate:G.string(),expirationDate:G.string().optional(),credentialSubject:i6.or(i6.array()),credentialStatus:tV.optional(),credentialSchema:rV.array().optional(),refreshService:nV.optional()}).catchall(G.any()),Ko=G.object({type:G.string(),created:G.string(),challenge:G.string().optional(),domain:G.string().optional(),nonce:G.string().optional(),proofPurpose:G.string(),verificationMethod:G.string(),jws:G.string().optional()}).catchall(G.any()),lS=hm.extend({proof:Ko.or(Ko.array())}),iV=G.object({"@context":Ym,id:G.string().optional(),type:G.string().or(G.string().array().nonempty()),verifiableCredential:lS.or(lS.array()).optional(),holder:G.string().optional()}).catchall(G.any()),SY=iV.extend({proof:Ko.or(Ko.array())}),$k=G.object({kty:G.string(),crv:G.string(),x:G.string(),y:G.string().optional(),n:G.string().optional(),d:G.string()}),oV=G.object({alg:G.string(),iv:G.string(),tag:G.string(),epk:$k.partial().optional(),kid:G.string().optional(),apv:G.string().optional(),apu:G.string().optional()}),aV=G.object({header:oV,encrypted_key:G.string()}),sV=G.object({protected:G.string(),iv:G.string(),ciphertext:G.string(),tag:G.string(),aad:G.string().optional(),recipients:aV.array().optional()}),vc=G.string().or(G.object({"@context":Ym.optional(),id:G.string(),type:G.string(),controller:G.string(),publicKeyJwk:$k.optional(),publicKeyBase58:G.string().optional(),blockChainAccountId:G.string().optional()}).catchall(G.any())),cV=G.object({id:G.string(),type:G.string().or(G.string().array().nonempty()),serviceEndpoint:G.any().or(G.any().array().nonempty())}).catchall(G.any()),xY=G.object({"@context":Ym,id:G.string(),alsoKnownAs:G.string().optional(),controller:G.string().or(G.string().array().nonempty()).optional(),verificationMethod:vc.array().optional(),authentication:vc.array().optional(),assertionMethod:vc.array().optional(),keyAgreement:vc.array().optional(),capabilityInvocation:vc.array().optional(),capabilityDelegation:vc.array().optional(),publicKey:vc.array().optional(),service:cV.array().optional(),proof:Ko.or(Ko.array()).optional()}).catchall(G.any()),uV=G.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(G.string()),Qm=G.object({type:G.string().array().nonempty(),targetCode:G.string().optional(),targetDescription:G.string().optional(),targetName:G.string(),targetFramework:G.string().optional(),targetType:uV.optional(),targetUrl:G.string()}),lV=G.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"]),fV=lV.or(G.string()),dV=G.object({id:G.string().optional(),narrative:G.string().optional()}).catchall(G.any()),hV=G.object({id:G.string(),type:G.string().array().nonempty(),endorsementComment:G.string().optional()}),pV=hm.extend({credentialSubject:hV,proof:Ko.or(Ko.array()).optional()}),mV=G.object({id:G.string(),"@language":G.string().optional(),version:G.string().optional()}),gV=G.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(G.string()),vV=G.object({id:G.string(),type:G.string().array().nonempty(),alignment:Qm.array().optional(),description:G.string().optional(),level:G.string().optional(),name:G.string(),points:G.string().optional()}).catchall(G.any()),yV=G.object({id:G.string(),type:G.string().array().nonempty(),alignment:Qm.array().optional(),allowedValue:G.string().array().optional(),name:G.string(),requiredLevel:G.string().optional(),requiredValue:G.string().optional(),resultType:gV,rubricCriterionLevel:vV.array().optional(),valueMax:G.string().optional(),valueMin:G.string().optional()}).catchall(G.any()),bV=G.object({id:G.string().optional(),type:G.string().array().nonempty(),alignment:Qm.array().optional(),achievementType:fV.optional(),creator:vd.optional(),creditsAvailable:G.number().optional(),criteria:dV,description:G.string(),endorsement:pV.array().optional(),fieldOfStudy:G.string().optional(),humanCode:G.string().optional(),image:Xm.optional(),"@language":G.string().optional(),name:G.string(),otherIdentifier:Uk.array().optional(),related:mV.array().optional(),resultDescription:yV.array().optional(),specialization:G.string().optional(),tag:G.string().array().optional(),version:G.string().optional()}).catchall(G.any()),wV=G.object({type:G.string(),hashed:G.boolean(),identityHash:G.string(),identityType:G.string(),salt:G.string().optional()}),_V=G.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),EV=G.object({type:G.string().array().nonempty(),achievedLevel:G.string().optional(),alignment:Qm.array().optional(),resultDescription:G.string().optional(),status:_V.optional(),value:G.string().optional()}).catchall(G.any()),fS=G.object({id:G.string().optional(),type:G.string().array().nonempty(),activityEndDate:G.string().optional(),activityStartDate:G.string().optional(),creditsEarned:G.number().optional(),achievement:bV.optional(),identifier:wV.array().optional(),image:Xm.optional(),licenseNumber:G.string().optional(),narrative:G.string().optional(),result:EV.array().optional(),role:G.string().optional(),source:vd.optional(),term:G.string().optional()}).catchall(G.any()),AV=G.object({id:G.string().optional(),type:G.string().array().nonempty(),narrative:G.string().optional(),name:G.string().optional(),description:G.string().optional(),genre:G.string().optional(),audience:G.string().optional()}).catchall(G.any()),SV=hm.extend({name:G.string().optional(),description:G.string().optional(),image:Xm.optional(),credentialSubject:fS.or(fS.array()),endorsement:hm.array().optional(),evidence:AV.array().optional()}),TY=SV.extend({proof:Ko.or(Ko.array())}),CY=G.object({checks:G.string().array(),warnings:G.string().array(),errors:G.string().array()}),jk=G.enum(["Success","Failed","Error"]),MY=jk.enum,IY=G.object({check:G.string(),status:jk,message:G.string().optional(),details:G.string().optional()}),kY=G.object({title:G.string().optional(),createdAt:G.string().optional(),issuer:vd.optional(),issuee:vd.optional(),credentialSubject:i6.optional()}),DY=G.object({id:G.string(),uri:G.string()}).catchall(G.any()),RY=G.object({limit:G.number(),cursor:G.string().optional(),sort:G.string().optional()}),bo=G.object({cursor:G.string().optional(),hasMore:G.boolean()}),zk=G.object({encryptedRecord:sV,fields:G.string().array()}).catchall(G.any()),OY=bo.extend({records:zk.array()}),xV=zk.extend({id:G.string()}),NY=bo.extend({records:xV.array()}),dS=Yq(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),TV=G.instanceof(RegExp).or(G.string().refine(e=>{try{return dS(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=dS(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),un=G.string().or(G.object({$in:G.string().array()})).or(G.object({$regex:TV})),CV=G.object({backgroundColor:G.string().optional(),backgroundImage:G.string().optional(),fadeBackgroundImage:G.boolean().optional(),repeatBackgroundImage:G.boolean().optional(),fontColor:G.string().optional(),accentColor:G.string().optional(),accentFontColor:G.string().optional(),idBackgroundImage:G.string().optional(),fadeIdBackgroundImage:G.boolean().optional(),idBackgroundColor:G.string().optional(),repeatIdBackgroundImage:G.boolean().optional()}),Oc=G.object({profileId:G.string().min(3).max(40),displayName:G.string().default(""),shortBio:G.string().default(""),bio:G.string().default(""),did:G.string(),email:G.string().optional(),image:G.string().optional(),heroImage:G.string().optional(),websiteLink:G.string().optional(),isServiceProfile:G.boolean().default(!1).optional(),type:G.string().optional(),notificationsWebhook:G.string().url().startsWith("http").optional(),display:CV.optional()}),BY=G.object({profileId:un,displayName:un,shortBio:un,bio:un,email:un,websiteLink:un,isServiceProfile:G.boolean(),type:un}).partial(),PY=bo.extend({records:Oc.array()}),LY=G.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),Hk=G.object({id:G.string(),created:G.string(),displayName:G.string().default("").optional(),shortBio:G.string().default("").optional(),bio:G.string().default("").optional(),email:G.string().optional(),image:G.string().optional(),heroImage:G.string().optional()}),FY=bo.extend({records:Hk.extend({did:G.string()}).array()}),UY=G.object({id:un,displayName:un,shortBio:un,bio:un,email:un}).partial(),$Y=bo.extend({records:G.object({profile:Oc,manager:Hk.extend({did:G.string()}).optional()}).array()}),jY=G.object({uri:G.string(),to:G.string(),from:G.string(),sent:G.string().datetime(),received:G.string().datetime().optional()}),MV=G.object({role:G.string(),canEdit:G.boolean(),canIssue:G.boolean(),canRevoke:G.boolean(),canManagePermissions:G.boolean(),canIssueChildren:G.string(),canCreateChildren:G.string(),canEditChildren:G.string(),canRevokeChildren:G.string(),canManageChildrenPermissions:G.string(),canManageChildrenProfiles:G.boolean().default(!1).optional(),canViewAnalytics:G.boolean()}),o6=G.enum(["DRAFT","LIVE"]),IV=G.object({uri:G.string(),name:G.string().optional(),type:G.string().optional(),category:G.string().optional(),status:o6.optional(),autoConnectRecipients:G.boolean().optional(),meta:G.record(G.any()).optional(),claimPermissions:MV.optional()}),zY=G.object({uri:un,name:un,type:un,category:un,meta:G.record(un),status:o6.or(G.object({$in:o6.array()})),autoConnectRecipients:G.boolean()}).partial(),HY=bo.extend({records:IV.array()}),kV=G.object({to:Oc,from:G.string(),received:G.string().optional(),uri:G.string().optional()}),qY=bo.extend({records:kV.array()}),VY=G.object({endpoint:G.string(),name:G.string(),did:G.string().optional()}),KY=G.object({ttlSeconds:G.number().optional(),totalUses:G.number().optional()}),DV=G.object({endpoint:G.string()}),GY=G.object({signingAuthority:DV,relationship:G.object({name:G.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:G.string()})}),RV=G.enum(["live","stale","withdrawn"]),OV=G.object({read:G.object({anonymize:G.boolean().optional(),credentials:G.object({categories:G.record(G.object({required:G.boolean()})).default({})}).default({}),personal:G.record(G.object({required:G.boolean()})).default({})}).default({}),write:G.object({credentials:G.object({categories:G.record(G.object({required:G.boolean()})).default({})}).default({}),personal:G.record(G.object({required:G.boolean()})).default({})}).default({})}),qk=G.object({contract:OV,owner:Oc,name:G.string(),subtitle:G.string().optional(),description:G.string().optional(),reasonForAccessing:G.string().optional(),image:G.string().optional(),uri:G.string(),createdAt:G.string(),updatedAt:G.string(),expiresAt:G.string().optional()}),WY=bo.extend({records:qk.omit({owner:!0}).array()}),NV=G.object({credentials:G.object({categories:G.record(G.string().array()).default({})}),personal:G.record(G.string()).default({}),date:G.string()}),JY=bo.extend({records:NV.array()}),Vk=G.object({sharing:G.boolean().optional(),shared:G.string().array().optional(),shareAll:G.boolean().optional(),shareUntil:G.string().optional()}),Kk=G.object({read:G.object({anonymize:G.boolean().optional(),credentials:G.object({shareAll:G.boolean().optional(),sharing:G.boolean().optional(),categories:G.record(Vk).default({})}).default({}),personal:G.record(G.string()).default({})}).default({}),write:G.object({credentials:G.object({categories:G.record(G.boolean()).default({})}).default({}),personal:G.record(G.boolean()).default({})}).default({})}),ZY=bo.extend({records:G.object({expiresAt:G.string().optional(),oneTime:G.boolean().optional(),terms:Kk,contract:qk,uri:G.string(),consenter:Oc,status:RV}).array()}),YY=G.object({read:G.object({anonymize:G.boolean().optional(),credentials:G.object({categories:G.record(G.object({required:G.boolean().optional()})).optional()}).optional(),personal:G.record(G.object({required:G.boolean().optional()})).optional()}).optional(),write:G.object({credentials:G.object({categories:G.record(G.object({required:G.boolean().optional()})).optional()}).optional(),personal:G.record(G.object({required:G.boolean().optional()})).optional()}).optional()}),XY=G.object({anonymize:G.boolean().optional(),credentials:G.object({categories:G.record(G.boolean()).optional()}).optional(),personal:G.record(G.boolean()).optional()}),BV=G.object({read:G.object({anonymize:G.boolean().optional(),credentials:G.object({shareAll:G.boolean().optional(),sharing:G.boolean().optional(),categories:G.record(Vk.optional()).optional()}).optional(),personal:G.record(G.string()).optional()}).optional(),write:G.object({credentials:G.object({categories:G.record(G.boolean()).optional()}).optional(),personal:G.record(G.boolean()).optional()}).optional()}),a6=G.enum(["consent","update","sync","withdraw"]),QY=G.object({terms:BV.optional(),action:a6.or(a6.array()).optional(),date:G.object({$gt:G.string()}).or(G.object({$lt:G.string()})).or(G.object({$eq:G.string()})).optional(),expiresAt:G.object({$gt:G.string()}).or(G.object({$lt:G.string()})).or(G.object({$eq:G.string()})).optional(),oneTime:G.boolean().optional()}),Gk=G.object({expiresAt:G.string().optional(),oneTime:G.boolean().optional(),terms:Kk.optional(),id:G.string(),action:a6,date:G.string()}),eX=bo.extend({records:Gk.array()}),PV=G.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),LV=G.object({title:G.string().optional(),body:G.string().optional()}),FV=G.object({vcUris:G.array(G.string()).optional(),vpUris:G.array(G.string()).optional(),transaction:Gk.optional()}),tX=G.object({type:PV,to:Oc.partial().and(G.object({did:G.string()})),from:Oc.partial().and(G.object({did:G.string()})),message:LV.optional(),data:FV.optional(),sent:G.string().datetime().optional()}),e1=a(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),rX=G.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 U2=K.object({credentials:mc.array()}).catchall(K.any()),Wk=K.object({id:K.string(),title:K.string(),storageType:K.literal("ceramic").optional()}).catchall(K.any()),$2=K.object({credentials:mc.or(Wk).array()}).strict();var t1=i(async(e,{modelData:t,credentialAlias:r})=>{let n=e.invoke.getCeramicClient(),o=new Pf({ceramic:n,model:t}),s=i(async(m=r)=>{let y=await o.get(m);if(!y)return{credentials:[]};let b=await U2.spa(y);if(b.success)return b.data;let _=await $2.spa(y);if(_.success){let O={credentials:_.data.credentials.map(B=>{if("uri"in B)return B;let{title:Z,id:$,storageType:z,...Q}=B;return{...Q,id:Z,uri:`lc:ceramic:${$.replace("ceramic://","")}`}})};return await o.set(r,O),O}throw console.error(b.error),new Error("Invalid credentials list stored in IDX")},"getCredentialsListFromIdx"),c=i(async(m,y)=>{if(!m)throw new Error("Must provide id to remove");y||(y=r);let b=await s(y);return b.credentials=b.credentials.filter(_=>_.id!==m),o.set(y,b)},"removeCredentialFromIdx"),l=i(async m=>(m||(m=r),o.set(m,{credentials:[]})),"removeAllCredentialsFromIdx"),h=i(async m=>{let y=await mc.parseAsync(m);if(!y)throw new Error("record is required");if(!y.uri)throw Error("No URI provided");await e.read.get(y.uri);let b=await s(r),_=b.credentials.findIndex(x=>x.id===y.id);return _>-1?b.credentials[_]=y:b.credentials.push(y),e1(await o.set(r,b))},"addCredentialInIdx"),p=i(async m=>{let y=mc.array().parse(m),b=await s(r);return await Promise.all(y.map(async _=>{await e.read.get(_.uri);let x=b.credentials.findIndex(D=>D.id===_.id);x>-1?b.credentials[x]=_:b.credentials.push(_)})),e1(await o.set(r,b))},"addCredentialsInIdx");return{name:"IDX",displayName:"IDX",description:"Stores a bespoke index of credentials for an individual based on their did",index:{get:async m=>(m.debug?.("learnCard.index.IDX.get"),(await s()).credentials),add:async(m,y)=>{m.debug?.("learnCard.index.IDX.add");try{return await h(y),!0}catch(b){return console.error("Error adding credential with IDX:",b),!1}},addMany:async(m,y)=>{m.debug?.("learnCard.index.IDX.add");try{return await p(y),!0}catch(b){return console.error("Error adding credential with IDX:",b),!1}},update:async m=>(m.debug?.("learnCard.index.IDX.update"),!1),remove:async(m,y)=>{m.debug?.("learnCard.index.IDX.remove");try{return await c(y),!0}catch(b){return console.error("Error removing credential from IDX:",b),!1}},removeAll:async m=>{m.debug?.("learnCard.index.IDX.removeAll");try{return await l(),!0}catch(y){return console.error("Error removing credentials from IDX:",y),!1}}},methods:{getCredentialsListFromIdx:async(m,y=r)=>(await s(y)).credentials,getVerifiableCredentialFromIdx:async(m,y)=>{let _=(await s())?.credentials?.find(O=>O?.id===y),x=m.read.get(_?.uri),D=await h0.safeParseAsync(x);return D.success?D.data:void 0},getVerifiableCredentialsFromIdx:async m=>{let b=(await s())?.credentials?.map(_=>_?.uri)??[];return(await Promise.all(b.map(async _=>m.read.get(_)))).filter(_=>!!_)},addVerifiableCredentialInIdx:async(m,y)=>{let b=mc.parse(y);if(!b)throw new Error("record is required");if(!b.uri)throw Error("No URI provided");await m.read.get(b.uri);let _=await s(r),x=_.credentials.findIndex(D=>D.id===b.id);return x>-1?_.credentials[x]=b:_.credentials.push(b),e1(await o.set(r,_))},removeVerifiableCredentialInIdx:async(m,y)=>c(y),removeAllVerifiableCredentialsInIdx:async()=>l(),getIDXIndex:async()=>o.get(r),setIDXIndex:async(m,y)=>o.set(r,y)}}},"getIDXPlugin");var UV=t1;
844
+ `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl"),"UnsubscriptionErrorImpl")});function sd(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(sd,"arrRemove");a(sd,"arrRemove");var Rd=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription2"),a(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,o,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=Cc(c),h=l.next();!h.done;h=l.next()){var p=h.value;p.remove(this)}}catch(D){t={error:D}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var m=this.initialTeardown;if(Er(m))try{m()}catch(D){s=D instanceof nb?D.errors:[D]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var b=Cc(y),_=b.next();!_.done;_=b.next()){var x=_.value;try{zb(x)}catch(D){s=s??[],D instanceof nb?s=_s(_s([],Ia(s)),Ia(D.errors)):s.push(D)}}}catch(D){n={error:D}}finally{try{_&&!_.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}if(s)throw new nb(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)zb(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)&&sd(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&sd(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),_I=Rd.EMPTY;function g2(e){return e instanceof Rd||e&&"closed"in e&&Er(e.remove)&&Er(e.add)&&Er(e.unsubscribe)}i(g2,"isSubscription");a(g2,"isSubscription");function zb(e){Er(e)?e():e.unsubscribe()}i(zb,"execFinalizer");a(zb,"execFinalizer");var zc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},im={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=im.delegate;return o?.setTimeout?o.setTimeout.apply(o,_s([e,t],Ia(r))):setTimeout.apply(void 0,_s([e,t],Ia(r)))},clearTimeout:function(e){var t=im.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function v2(e){im.setTimeout(function(){var t=zc.onUnhandledError;if(t)t(e);else throw e})}i(v2,"reportUnhandledError");a(v2,"reportUnhandledError");function Hb(){}i(Hb,"noop");a(Hb,"noop");var fH=function(){return Vm("C",void 0,void 0)}();function EI(e){return Vm("E",void 0,e)}i(EI,"errorNotification");a(EI,"errorNotification");function AI(e){return Vm("N",e,void 0)}i(AI,"nextNotification");a(AI,"nextNotification");function Vm(e,t,r){return{kind:e,value:t,error:r}}i(Vm,"createNotification");a(Vm,"createNotification");var _c=null;function Zf(e){if(zc.useDeprecatedSynchronousErrorHandling){var t=!_c;if(t&&(_c={errorThrown:!1,error:null}),e(),t){var r=_c,n=r.errorThrown,o=r.error;if(_c=null,n)throw o}}else e()}i(Zf,"errorContext");a(Zf,"errorContext");function SI(e){zc.useDeprecatedSynchronousErrorHandling&&_c&&(_c.errorThrown=!0,_c.error=e)}i(SI,"captureError");a(SI,"captureError");var y2=function(e){Xo(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,g2(r)&&r.add(n)):n.destination=pH,n}return i(t,"Subscriber2"),a(t,"Subscriber"),t.create=function(r,n,o){return new qb(r,n,o)},t.prototype.next=function(r){this.isStopped?k0(AI(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?k0(EI(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?k0(fH,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}(Rd),dH=Function.prototype.bind;function I0(e,t){return dH.call(e,t)}i(I0,"bind");a(I0,"bind");var hH=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver2"),a(e,"ConsumerObserver"),e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Gf(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Gf(n)}else Gf(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Gf(r)}},e}(),qb=function(e){Xo(t,e);function t(r,n,o){var s=e.call(this)||this,c;if(Er(r)||!r)c={next:r??void 0,error:n??void 0,complete:o??void 0};else{var l;s&&zc.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&I0(r.next,l),error:r.error&&I0(r.error,l),complete:r.complete&&I0(r.complete,l)}):c=r}return s.destination=new hH(c),s}return i(t,"SafeSubscriber2"),a(t,"SafeSubscriber"),t}(y2);function Gf(e){zc.useDeprecatedSynchronousErrorHandling?SI(e):v2(e)}i(Gf,"handleUnhandledError");a(Gf,"handleUnhandledError");function xI(e){throw e}i(xI,"defaultErrorHandler");a(xI,"defaultErrorHandler");function k0(e,t){var r=zc.onStoppedNotification;r&&im.setTimeout(function(){return r(e,t)})}i(k0,"handleStoppedNotification");a(k0,"handleStoppedNotification");var pH={closed:!0,next:Hb,error:xI,complete:Hb},b2=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Km(e){return e}i(Km,"identity3");a(Km,"identity");function TI(e){return e.length===0?Km:e.length===1?e[0]:a(i(function(r){return e.reduce(function(n,o){return o(n)},r)},"piped"),"piped")}i(TI,"pipeFromArray");a(TI,"pipeFromArray");var dn=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable2"),a(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 o=this,s=MI(t)?t:new qb(t,r,n);return Zf(function(){var c=o,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?o._subscribe(s):o._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=Vb(r),new r(function(o,s){var c=new qb({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:o});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[b2]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return TI(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Vb(t),new t(function(n,o){var s;r.subscribe(function(c){return s=c},function(c){return o(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function Vb(e){var t;return(t=e??zc.Promise)!==null&&t!==void 0?t:Promise}i(Vb,"getPromiseCtor");a(Vb,"getPromiseCtor");function CI(e){return e&&Er(e.next)&&Er(e.error)&&Er(e.complete)}i(CI,"isObserver");a(CI,"isObserver");function MI(e){return e&&e instanceof y2||CI(e)&&g2(e)}i(MI,"isSubscriber");a(MI,"isSubscriber");function II(e){return Er(e?.lift)}i(II,"hasLift");a(II,"hasLift");function Qo(e){return function(t){if(II(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(Qo,"operate");a(Qo,"operate");function go(e,t,r,n,o){return new mH(e,t,r,n,o)}i(go,"createOperatorSubscriber");a(go,"createOperatorSubscriber");var mH=function(e){Xo(t,e);function t(r,n,o,s,c,l){var h=e.call(this,r)||this;return h.onFinalize=c,h.shouldUnsubscribe=l,h._next=n?function(p){try{n(p)}catch(m){r.error(m)}}:e.prototype._next,h._error=s?function(p){try{s(p)}catch(m){r.error(m)}finally{this.unsubscribe()}}:e.prototype._error,h._complete=o?function(){try{o()}catch(p){r.error(p)}finally{this.unsubscribe()}}:e.prototype._complete,h}return i(t,"OperatorSubscriber2"),a(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}(y2),gH=qm(function(e){return a(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),kI=function(e){Xo(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"),a(t,"Subject"),t.prototype.lift=function(r){var n=new JA(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new gH},t.prototype.next=function(r){var n=this;Zf(function(){var o,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var c=Cc(n.currentObservers),l=c.next();!l.done;l=c.next()){var h=l.value;h.next(r)}}catch(p){o={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(o)throw o.error}}}})},t.prototype.error=function(r){var n=this;Zf(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},t.prototype.complete=function(){var r=this;Zf(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,o=this,s=o.hasError,c=o.isStopped,l=o.observers;return s||c?_I:(this.currentObservers=null,l.push(r),new Rd(function(){n.currentObservers=null,sd(l,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,s=n.thrownError,c=n.isStopped;o?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 JA(r,n)},t}(dn),JA=function(e){Xo(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return i(t,"AnonymousSubject2"),a(t,"AnonymousSubject"),t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.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,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:_I},t}(kI),vH=function(e){Xo(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return i(t,"BehaviorSubject2"),a(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,o=r.thrownError,s=r._value;if(n)throw o;return this._throwIfClosed(),s},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(kI),DI={now:function(){return(DI.delegate||Date).now()},delegate:void 0},yH=function(e){Xo(t,e);function t(r,n){return e.call(this)||this}return i(t,"Action2"),a(t,"Action"),t.prototype.schedule=function(r,n){return n===void 0&&(n=0),this},t}(Rd),om={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=om.delegate;return o?.setInterval?o.setInterval.apply(o,_s([e,t],Ia(r))):setInterval.apply(void 0,_s([e,t],Ia(r)))},clearInterval:function(e){var t=om.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},bH=function(e){Xo(t,e);function t(r,n){var o=e.call(this,r,n)||this;return o.scheduler=r,o.work=n,o.pending=!1,o}return i(t,"AsyncAction2"),a(t,"AsyncAction"),t.prototype.schedule=function(r,n){var o;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=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(c,this.id,n),this},t.prototype.requestAsyncId=function(r,n,o){return o===void 0&&(o=0),om.setInterval(r.flush.bind(r,this),o)},t.prototype.recycleAsyncId=function(r,n,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return n;n!=null&&om.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(r,n);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var o=!1,s;try{this.work(r)}catch(c){o=!0,s=c||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,o=r.scheduler,s=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,sd(s,this),n!=null&&(this.id=this.recycleAsyncId(o,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(yH),ZA=function(){function e(t,r){r===void 0&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return i(e,"Scheduler2"),a(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=DI.now,e}(),wH=function(e){Xo(t,e);function t(r,n){n===void 0&&(n=ZA.now);var o=e.call(this,r,n)||this;return o.actions=[],o._active=!1,o}return i(t,"AsyncScheduler2"),a(t,"AsyncScheduler"),t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var o;this._active=!0;do if(o=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,o){for(;r=n.shift();)r.unsubscribe();throw o}},t}(ZA),_H=new wH(bH),EH=_H,RI=new dn(function(e){return e.complete()});function w2(e){return e&&Er(e.schedule)}i(w2,"isScheduler");a(w2,"isScheduler");function _2(e){return e[e.length-1]}i(_2,"last");a(_2,"last");function OI(e){return w2(_2(e))?e.pop():void 0}i(OI,"popScheduler");a(OI,"popScheduler");function NI(e,t){return typeof _2(e)=="number"?e.pop():t}i(NI,"popNumber");a(NI,"popNumber");var E2=a(function(e){return e&&typeof e.length=="number"&&typeof e!="function"},"isArrayLike");function A2(e){return Er(e?.then)}i(A2,"isPromise");a(A2,"isPromise");function S2(e){return Er(e[b2])}i(S2,"isInteropObservable");a(S2,"isInteropObservable");function x2(e){return Symbol.asyncIterator&&Er(e?.[Symbol.asyncIterator])}i(x2,"isAsyncIterable");a(x2,"isAsyncIterable");function T2(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(T2,"createInvalidObservableTypeError");a(T2,"createInvalidObservableTypeError");function BI(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(BI,"getSymbolIterator");a(BI,"getSymbolIterator");var PI=BI();function C2(e){return Er(e?.[PI])}i(C2,"isIterable");a(C2,"isIterable");function M2(e){return bI(this,arguments,a(i(function(){var r,n,o,s;return m2(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,xc(r.read())];case 3:return n=c.sent(),o=n.value,s=n.done,s?[4,xc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,xc(o)];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(M2,"readableStreamLikeToAsyncGenerator");a(M2,"readableStreamLikeToAsyncGenerator");function I2(e){return Er(e?.getReader)}i(I2,"isReadableStreamLike");a(I2,"isReadableStreamLike");function Na(e){if(e instanceof dn)return e;if(e!=null){if(S2(e))return LI(e);if(E2(e))return FI(e);if(A2(e))return UI(e);if(x2(e))return k2(e);if(C2(e))return $I(e);if(I2(e))return jI(e)}throw T2(e)}i(Na,"innerFrom");a(Na,"innerFrom");function LI(e){return new dn(function(t){var r=e[b2]();if(Er(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(LI,"fromInteropObservable");a(LI,"fromInteropObservable");function FI(e){return new dn(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(FI,"fromArrayLike");a(FI,"fromArrayLike");function UI(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,v2)})}i(UI,"fromPromise");a(UI,"fromPromise");function $I(e){return new dn(function(t){var r,n;try{for(var o=Cc(e),s=o.next();!s.done;s=o.next()){var c=s.value;if(t.next(c),t.closed)return}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}i($I,"fromIterable");a($I,"fromIterable");function k2(e){return new dn(function(t){zI(e,t).catch(function(r){return t.error(r)})})}i(k2,"fromAsyncIterable");a(k2,"fromAsyncIterable");function jI(e){return k2(M2(e))}i(jI,"fromReadableStreamLike");a(jI,"fromReadableStreamLike");function zI(e,t){var r,n,o,s;return yI(this,void 0,void 0,function(){var c,l;return m2(this,function(h){switch(h.label){case 0:h.trys.push([0,5,6,11]),r=wI(e),h.label=1;case 1:return[4,r.next()];case 2:if(n=h.sent(),!!n.done)return[3,4];if(c=n.value,t.next(c),t.closed)return[2];h.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=h.sent(),o={error:l},[3,11];case 6:return h.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:h.sent(),h.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}i(zI,"process2");a(zI,"process");function Ta(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var s=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!o)return s}i(Ta,"executeSchedule");a(Ta,"executeSchedule");function D2(e,t){return t===void 0&&(t=0),Qo(function(r,n){r.subscribe(go(n,function(o){return Ta(n,e,function(){return n.next(o)},t)},function(){return Ta(n,e,function(){return n.complete()},t)},function(o){return Ta(n,e,function(){return n.error(o)},t)}))})}i(D2,"observeOn");a(D2,"observeOn");function R2(e,t){return t===void 0&&(t=0),Qo(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(R2,"subscribeOn");a(R2,"subscribeOn");function HI(e,t){return Na(e).pipe(R2(t),D2(t))}i(HI,"scheduleObservable");a(HI,"scheduleObservable");function qI(e,t){return Na(e).pipe(R2(t),D2(t))}i(qI,"schedulePromise");a(qI,"schedulePromise");function VI(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(VI,"scheduleArray");a(VI,"scheduleArray");function KI(e,t){return new dn(function(r){var n;return Ta(r,t,function(){n=e[PI](),Ta(r,t,function(){var o,s,c;try{o=n.next(),s=o.value,c=o.done}catch(l){r.error(l);return}c?r.complete():r.next(s)},0,!0)}),function(){return Er(n?.return)&&n.return()}})}i(KI,"scheduleIterable");a(KI,"scheduleIterable");function O2(e,t){if(!e)throw new Error("Iterable cannot be null");return new dn(function(r){Ta(r,t,function(){var n=e[Symbol.asyncIterator]();Ta(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}i(O2,"scheduleAsyncIterable");a(O2,"scheduleAsyncIterable");function GI(e,t){return O2(M2(e),t)}i(GI,"scheduleReadableStreamLike");a(GI,"scheduleReadableStreamLike");function WI(e,t){if(e!=null){if(S2(e))return HI(e,t);if(E2(e))return VI(e,t);if(A2(e))return qI(e,t);if(x2(e))return O2(e,t);if(C2(e))return KI(e,t);if(I2(e))return GI(e,t)}throw T2(e)}i(WI,"scheduled");a(WI,"scheduled");function JI(e,t){return t?WI(e,t):Na(e)}i(JI,"from3");a(JI,"from");var ZI=qm(function(e){return a(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function YI(e){return e instanceof Date&&!isNaN(e)}i(YI,"isValidDate");a(YI,"isValidDate");function N2(e,t){return Qo(function(r,n){var o=0;r.subscribe(go(n,function(s){n.next(e.call(t,s,o++))}))})}i(N2,"map");a(N2,"map");var AH=Array.isArray;function XI(e,t){return AH(t)?e.apply(void 0,_s([],Ia(t))):e(t)}i(XI,"callOrApply");a(XI,"callOrApply");function QI(e){return N2(function(t){return XI(e,t)})}i(QI,"mapOneOrManyArgs");a(QI,"mapOneOrManyArgs");function ek(e,t,r,n,o,s,c,l){var h=[],p=0,m=0,y=!1,b=a(function(){y&&!h.length&&!p&&t.complete()},"checkComplete"),_=a(function(D){return p<n?x(D):h.push(D)},"outerNext"),x=a(function(D){s&&t.next(D),p++;var O=!1;Na(r(D,m++)).subscribe(go(t,function(B){o?.(B),s?_(B):t.next(B)},function(){O=!0},void 0,function(){if(O)try{p--;for(var B=a(function(){var Z=h.shift();c?Ta(t,c,function(){return x(Z)}):x(Z)},"_loop_1");h.length&&p<n;)B();b()}catch(Z){t.error(Z)}}))},"doInnerSub");return e.subscribe(go(t,_,function(){y=!0,b()})),function(){l?.()}}i(ek,"mergeInternals");a(ek,"mergeInternals");function Gm(e,t,r){return r===void 0&&(r=1/0),Er(t)?Gm(function(n,o){return N2(function(s,c){return t(n,s,o,c)})(Na(e(n,o)))},r):(typeof t=="number"&&(r=t),Qo(function(n,o){return ek(n,o,e,r)}))}i(Gm,"mergeMap");a(Gm,"mergeMap");function tk(e){return e===void 0&&(e=1/0),Gm(Km,e)}i(tk,"mergeAll");a(tk,"mergeAll");var SH=["addListener","removeListener"],xH=["addEventListener","removeEventListener"],TH=["on","off"];function am(e,t,r,n){if(Er(r)&&(n=r,r=void 0),n)return am(e,t,r).pipe(QI(n));var o=Ia(ik(e)?xH.map(function(l){return function(h){return e[l](t,h,r)}}):rk(e)?SH.map(Kb(e,t)):nk(e)?TH.map(Kb(e,t)):[],2),s=o[0],c=o[1];if(!s&&E2(e))return Gm(function(l){return am(l,t,r)})(Na(e));if(!s)throw new TypeError("Invalid event target");return new dn(function(l){var h=a(function(){for(var p=[],m=0;m<arguments.length;m++)p[m]=arguments[m];return l.next(1<p.length?p:p[0])},"handler");return s(h),function(){return c(h)}})}i(am,"fromEvent");a(am,"fromEvent");function Kb(e,t){return function(r){return function(n){return e[r](t,n)}}}i(Kb,"toCommonHandlerRegistry");a(Kb,"toCommonHandlerRegistry");function rk(e){return Er(e.addListener)&&Er(e.removeListener)}i(rk,"isNodeStyleEventEmitter");a(rk,"isNodeStyleEventEmitter");function nk(e){return Er(e.on)&&Er(e.off)}i(nk,"isJQueryStyleEventEmitter");a(nk,"isJQueryStyleEventEmitter");function ik(e){return Er(e.addEventListener)&&Er(e.removeEventListener)}i(ik,"isEventTarget");a(ik,"isEventTarget");function B2(e,t,r){e===void 0&&(e=0),r===void 0&&(r=EH);var n=-1;return t!=null&&(w2(t)?r=t:n=t),new dn(function(o){var s=YI(e)?+e-r.now():e;s<0&&(s=0);var c=0;return r.schedule(function(){o.closed||(o.next(c++),0<=n?this.schedule(void 0,n):o.complete())},s)})}i(B2,"timer");a(B2,"timer");function ok(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=OI(e),n=NI(e,1/0),o=e;return o.length?o.length===1?Na(o[0]):tk(n)(JI(o,r)):RI}i(ok,"merge");a(ok,"merge");function ak(e,t){return Qo(function(r,n){var o=0;r.subscribe(go(n,function(s){return e.call(t,s,o++)&&n.next(s)}))})}i(ak,"filter");a(ak,"filter");function sk(e){return Qo(function(t,r){var n=!1;t.subscribe(go(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}i(sk,"defaultIfEmpty");a(sk,"defaultIfEmpty");function ck(e){return e<=0?function(){return RI}:Qo(function(t,r){var n=0;t.subscribe(go(r,function(o){++n<=e&&(r.next(o),e<=n&&r.complete())}))})}i(ck,"take");a(ck,"take");function uk(e){return e===void 0&&(e=lk),Qo(function(t,r){var n=!1;t.subscribe(go(r,function(o){n=!0,r.next(o)},function(){return n?r.complete():r.error(e())}))})}i(uk,"throwIfEmpty");a(uk,"throwIfEmpty");function lk(){return new ZI}i(lk,"defaultErrorFactory");a(lk,"defaultErrorFactory");function fk(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?ak(function(o,s){return e(o,s,n)}):Km,ck(1),r?sk(t):uk(function(){return new ZI}))}}i(fk,"first");a(fk,"first");function dk(e,t){return Qo(function(r,n){var o=t??{},s=o.leading,c=s===void 0?!0:s,l=o.trailing,h=l===void 0?!1:l,p=!1,m=null,y=null,b=!1,_=a(function(){y?.unsubscribe(),y=null,h&&(O(),b&&n.complete())},"endThrottling"),x=a(function(){y=null,b&&n.complete()},"cleanupThrottling"),D=a(function(B){return y=Na(e(B)).subscribe(go(n,_,x))},"startThrottle"),O=a(function(){if(p){p=!1;var B=m;m=null,n.next(B),!b&&D(B)}},"send");r.subscribe(go(n,function(B){p=!0,m=B,!(y&&!y.closed)&&(c?O():D(B))},function(){b=!0,!(h&&p&&y&&!y.closed)&&n.complete()}))})}i(dk,"throttle");a(dk,"throttle");var YA;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(YA||(YA={}));var sm;(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"})(sm||(sm={}));var Gb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Gb||(Gb={}));var Wm=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,HA.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return _r.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>_r.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===Gb.ANCHOR).map(({cid:e})=>_r.make(this.id,e))}get state(){return(0,HA.default)(this.state$.value)}async sync(e={}){e={sync:Qn.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");a(Wm,"Stream");function Jm(){return e=>{}}i(Jm,"StreamStatic");a(Jm,"StreamStatic");var CH=ir(fj(),1);function hk(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):(ok(...e.map(r=>am(r,"abort"))).pipe(fk()).subscribe(()=>{t.abort()}),t.signal)}i(hk,"mergeAbortSignals");a(hk,"mergeAbortSignals");var pk=i(class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=B2(e).subscribe(()=>{t.abort()})}clear(){this._subscription?.unsubscribe()}},"TimedAbortSignal");a(pk,"TimedAbortSignal");async function mk(e,t){let r=new AbortController,n=a(()=>{r.abort()},"onAbort");return e.addEventListener("abort",n),e.aborted&&r.abort(),t(r.signal).finally(()=>{e.removeEventListener("abort",n)})}i(mk,"abortable2");a(mk,"abortable");var MH=60*1e3*3;async function bi(e,t={}){t.body&&Object.assign(t,{body:JSON.stringify(t.body),headers:{...t.headers,"Content-Type":"application/json"}});let r=t.timeout||MH,n=new pk(r),o=t.signal?hk([t.signal,n.signal]):n.signal,s=await mk(o,c=>(0,CH.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(bi,"fetchJson");a(bi,"fetchJson");var b0=ir(Ad(),1);Wo();function Sa(e){let t=jt.asCID(e);if(t)return t;if(typeof e=="string")return jt.parse(e);if(e instanceof Uint8Array)return jt.decode(e);throw new Error(`${e} cannot be converted to a CID`)}i(Sa,"toCID");a(Sa,"toCID");var XA=0,jr=i(class{static streamIdFromState(e){return new Xt(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,b0.default)(e);return jr.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=Cr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Cr(t.cacaoBlock,"base64")),t):(jr.isSignedCommit(e)&&(t.link=t.link.toString()),jr.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=Cr(e.header.model,"base64")),t)}static deserializeCommit(e){let t=(0,b0.default)(e);return jr.isSignedCommitContainer(t)?(t.jws.link=Sa(t.jws.link),t.linkedBlock=xr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=xr(t.cacaoBlock,"base64")),t):(jr.isSignedCommit(t)&&(t.link=Sa(t.link)),jr.isAnchorCommit(t)&&(t.proof=Sa(t.proof)),t.id&&(t.id=Sa(t.id)),t.prev&&(t.prev=Sa(t.prev)),t.header?.model&&(t.header.model=xr(t.header.model,"base64")),t)}static serializeState(e){let t=(0,b0.default)(e);return t.log=t.log.map(r=>({...r,cid:r.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=sm[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!=XA&&(t.metadata.unique=Cr(t.metadata.unique,"base64")),t.doctype=Ma.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,b0.default)(e);return t.doctype&&(t.type=Ma.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:Sa(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=Sa(t.anchorProof.txHash),t.anchorProof.root=Sa(t.anchorProof.root)),t.anchorStatus&&(t.anchorStatus=sm[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!=XA&&(t.metadata.unique=xr(e.metadata.unique,"base64")),t}static statesEqual(e,t){return JSON.stringify(jr.serializeState(e))===JSON.stringify(jr.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(jr.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");a(jr,"StreamUtils");var gk=i(class extends vH{next(e){let t=this.value;jr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");a(gk,"StreamStateSubject");var IH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate3"),vi,ib={anchor:!0,publish:!0,pin:!0,sync:Qn.PREFER_CACHE},kH={sync:Qn.PREFER_CACHE},QA={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function D0(e,t){if(typeof e?.schema=="string")try{_r.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=Cr((0,uH.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(D0,"headerFromMetadata");a(D0,"headerFromMetadata");async function Wb(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(Wb,"getAuthenticatedDID");a(Wb,"getAuthenticatedDID");async function R0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(R0,"throwReadOnlyError");a(R0,"throwReadOnlyError");var ka=vi=a(i(class extends Wm{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,cH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,o={}){o={...ib,...o},!n?.deterministic&&o.syncTimeoutSeconds==null&&(o.syncTimeoutSeconds=0);let s=o.asDID?{did:o.asDID}:t,c=await vi.makeGenesis(s,r,n);return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,c,o)}static async createFromGenesis(t,r,n={}){n={...ib,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let o=r.data?await vi._signDagJWS(t,r):r;return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,o,n)}static async deterministic(t,r,n={}){if(n={...ib,...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 o=await vi.makeGenesis(t,null,r);return t.createStreamFromGenesis(vi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...kH,...n};let o=ws.from(r);if(o.type!=vi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${vi.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async update(t,r,n={}){n={...QA,...n};let o=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(o,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...QA,...r};let o={header:D0(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await vi._signDagJWS(this.api,o),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=R0,this.patch=R0,this.sync=R0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let o=await this._makeRawCommit(r,n);return vi._signDagJWS(t,o)}async _makeRawCommit(t,r){r||(r={});let n=D0(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 o=nI.compare(this.content,t),s=this.state.log[0];return{header:n,data:o,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 Wb(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 o=D0(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:o};return Bm(c),c}let s={data:r,header:o};return vi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await Wb(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");ka.STREAM_TYPE_NAME="tile";ka.STREAM_TYPE_ID=0;ka=vi=IH([Jm()],ka);var DH=ir(dj(),1);function vk(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(vk,"_checkPrivateRedeclaration2");a(vk,"_checkPrivateRedeclaration");function yk(e,t){return t.get?t.get.call(e):t.value}i(yk,"_classApplyDescriptorGet2");a(yk,"_classApplyDescriptorGet");function bk(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(bk,"_classApplyDescriptorSet2");a(bk,"_classApplyDescriptorSet");function P2(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(P2,"_classExtractFieldDescriptor2");a(P2,"_classExtractFieldDescriptor");function O0(e,t){var r=P2(e,t,"get");return yk(e,r)}i(O0,"_classPrivateFieldGet2");a(O0,"_classPrivateFieldGet");function Jb(e,t,r){vk(e,t),t.set(e,r)}i(Jb,"_classPrivateFieldInit2");a(Jb,"_classPrivateFieldInit");function Zb(e,t,r){var n=P2(e,t,"set");return bk(e,n,r),r}i(Zb,"_classPrivateFieldSet2");a(Zb,"_classPrivateFieldSet");function wk(e){return typeof e=="string"||_r.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(wk,"keyToQuery");a(wk,"keyToQuery");function N0(e){return typeof e=="string"?ws.from(e).toString():_r.isInstance(e)||Xt.isInstance(e)?e.toString():e.streamId.toString()}i(N0,"keyToString");a(N0,"keyToString");async function _k(e){let t=await ka.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(_k,"getDeterministicQuery");a(_k,"getDeterministicQuery");var RH=a(()=>Promise.resolve([]),"tempBatchLoadFn"),w0=new WeakMap,ob=new WeakMap,OH=i(class extends DH.default{cache(e){if(!O0(this,ob))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}async create(e,t,r){let n=await ka.create(O0(this,w0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await _k(e);try{return await super.load(r)}catch{let o=await ka.createFromGenesis(O0(this,w0),r.genesis,t);return this.cache(o),o}}async load(e){return await super.load(e)}async update(e,t,r,n){let o=N0(e);this.clear(o);let s=await this.load({streamId:o});return await s.update(t,r,n),s}constructor(e){super(RH,{cache:!0,cacheKeyFn:N0,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),Jb(this,w0,{writable:!0,value:void 0}),Jb(this,ob,{writable:!0,value:void 0}),this._batchLoadFn=async t=>{e.cache||this.clearAll();let r=await e.ceramic.multiQuery(t.map(wk),e.multiqueryTimeout);return t.map(n=>{let o=N0(n),s=r[o];return s||new Error(`Failed to load stream: ${o}`)})},Zb(this,w0,e.ceramic),Zb(this,ob,!!e.cache)}},"TileLoader");a(OH,"TileLoader");function Yb(e){return typeof e=="string"?Xt.fromString(e):e}i(Yb,"typeStreamID");a(Yb,"typeStreamID");function Ek(e,t){let r=new URL(e);for(let[n,o]of Object.entries(t))Xt.isInstance(o)?r.searchParams.set(n,o.toString()):typeof o=="object"?r.searchParams.set(n,JSON.stringify(o)):r.searchParams.set(n,o);return r}i(Ek,"serializeObjectToSearchParams");a(Ek,"serializeObjectToSearchParams");function Xb(e){let t={};for(let[r,n]of Object.entries(e))Xt.isInstance(n)?t[r]=n.toString():t[r]=n;return t}i(Xb,"serializeObjectForHttpPost");a(Xb,"serializeObjectForHttpPost");var Hi=i(class extends dn{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=B2(0,r).pipe(dk(()=>this._syncState(this.id,{sync:Qn.PREFER_CACHE}))).subscribe()),this.state$.subscribe(n).add(()=>{this.state$.observers.length===0&&this.periodicSubscription?.unsubscribe()})}),this.state$=new gk(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 Hi._load(e,this._apiUrl,t);this.state$.next(jr.deserializeState(r))}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}static async createFromGenesis(e,t,r,n,o){let s=new URL("./streams",e),{state:c}=await bi(s,{method:"post",body:{type:t,genesis:jr.serializeCommit(r),opts:n}});return new Hi(jr.deserializeState(c),e,o)}static async applyCommit(e,t,r,n,o){let s=new URL("./commits",e),{state:c}=await bi(s,{method:"post",body:{streamId:t.toString(),commit:jr.serializeCommit(r),opts:n}});return new Hi(jr.deserializeState(c),e,o)}static async _load(e,t,r){let n=Ek(new URL(`./streams/${e}`,t),r),{state:o}=await bi(n);return o}static async load(e,t,r,n){let o=await Hi._load(e,t,n);return new Hi(jr.deserializeState(o),t,r)}static async loadStreamCommits(e,t){let r=new URL(`./commits/${e}`,t),{commits:n}=await bi(r);return n.map(o=>({cid:o.cid,value:jr.deserializeCommit(o.value)}))}complete(){this.state$.complete()}},"Document");a(Hi,"Document");var cd;(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"})(cd||(cd={}));var eS=ir(Ad(),1),tS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(tS||(tS={}));var Qb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Qb||(Qb={}));var Ak=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,eS.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return _r.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>_r.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===Qb.ANCHOR).map(({cid:e})=>_r.make(this.id,e))}get state(){return(0,eS.default)(this.state$.value)}async sync(e={}){e={sync:cd.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");a(Ak,"Stream");function Sk(){return e=>{}}i(Sk,"StreamStatic2");a(Sk,"StreamStatic");function xk(e){if(typeof e=="string"&&e.includes("@")){let[t,r]=e.split("@");if(!t||!r)throw new Error("Invalid accountId provided");return new nd({address:t,chainId:r})}return new nd(e)}i(xk,"normalizeAccountId");a(xk,"normalizeAccountId");var NH="(?:%[0-9a-fA-F]{2})",rS=`(?:[a-zA-Z0-9._-]|${NH})`,BH="([a-z0-9]+)",PH=`((?:${rS}*:)*(${rS}+))`,nS="[a-zA-Z0-9_.:%-]",LH=`;${nS}+=${nS}*`,FH=`((${LH})*)`,UH="(/[^#?]*)?",$H="([?][^#]*)?",jH="(#.*)?",zH=new RegExp(`^did:${BH}:${PH}${FH}${UH}${$H}${jH}$`);function Tk(e){if(e===""||!e)return null;let t=e.match(zH);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 o of n){let s=o.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(Tk,"parse2");a(Tk,"parse");var HH=ir(Ad(),1),qH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate4"),yc,ab=a(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),iS={anchor:!1,publish:!0,sync:cd.PREFER_CACHE},sb={anchor:!0,publish:!0},VH={sync:cd.PREFER_CACHE},Ku=yc=a(i(class extends Ak{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,HH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...iS,...n};let o=xk(r),s=yc.makeGenesis(o);return yc.fromGenesis(t,s,n)}static async fromGenesis(t,r,n={}){return n={...iS,...n},t.createStreamFromGenesis(yc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...sb,...n};let o=typeof t=="string"?t.trim():t.id;if(Tk(o)?.did!==o)throw new Error(`DID is not valid: '${o}'`);let c=await r.createLink(o);return this.setDidProof(c,n)}async setDidProof(t,r={}){r={...sb,...r};let n=this.makeCommit(t),o=await this.api.applyCommit(this.id,n,r);this.state$.next(o.state)}async clearDid(t,r={}){r={...sb,...r};let n=await t.createLink("");return this.setDidProof(n,r)}static async load(t,r,n={}){n={...VH,...n};let o=ws.from(r);if(o.type!=yc.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${yc.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,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=ab,this.setDid=ab,this.sync=ab,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link2"),"Caip10Link");Ku.STREAM_TYPE_NAME="caip10-link";Ku.STREAM_TYPE_ID=1;Ku=yc=qH([Sk()],Ku);Wo();il();var KH=ir(Aj(),1),GH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate5"),zo,WH={sync:Qn.PREFER_CACHE};async function e6(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(e6,"_ensureAuthenticated");a(e6,"_ensureAuthenticated");async function Ck(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(Ck,"throwReadOnlyError3");a(Ck,"throwReadOnlyError");var Mc=zo=a(i(class extends Wm{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:zo.MODEL}}static async create(t,r,n){zo.assertComplete(r);let o={publish:!0,anchor:!0,pin:!0,sync:Qn.NEVER_SYNC,throwOnInvalidCommit:!0},s=await zo._makeGenesis(t,r,n);return await t.createStreamFromGenesis(zo.STREAM_TYPE_ID,s,o)}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={...WH,...n};let o=ws.from(r);if(o.type!=zo.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${zo.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return await t.loadStream(o,n)}static async _makeGenesis(t,r,n){let o=await this._makeRawGenesis(t,r,n);return zo._signDagJWS(t,o)}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 e6(t),n={controller:t.did.hasParent?t.did.parent:t.did.id};else throw new Error("No controller specified");let o={controllers:[n.controller],model:zo.MODEL.bytes};return{data:r,header:o}}makeReadOnly(){this.sync=Ck,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await e6(t),t.did.createDagJWS(r)}},"Model2"),"Model");Mc.STREAM_TYPE_NAME="model";Mc.STREAM_TYPE_ID=2;Mc.MODEL=function(){let e=Bm("model-v1"),t=KH.default.encode(e,"identity"),r=zu(V0,t),n=jt.createV1(V0,r);return new Xt("UNLOADABLE",n)}();Mc=zo=GH([Jm()],Mc);var JH=ir(sl(),1),ZH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate6"),ao,YH={anchor:!0,publish:!0,pin:!0,sync:Qn.NEVER_SYNC,syncTimeoutSeconds:0},XH={anchor:!1,publish:!1,pin:!0,sync:Qn.PREFER_CACHE},QH={sync:Qn.PREFER_CACHE},oS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};async function t6(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(t6,"_ensureAuthenticated2");a(t6,"_ensureAuthenticated");async function B0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(B0,"throwReadOnlyError4");a(B0,"throwReadOnlyError");var Gu=ao=a(i(class extends Wm{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,o={}){o={...YH,...o};let s=o.asDID?{did:o.asDID}:t,c=await ao._makeGenesis(s,r,n);return t.createStreamFromGenesis(ao.STREAM_TYPE_ID,c,o)}static async single(t,r,n={}){n={...XH,...n};let o=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let s=await ao._makeGenesis(o,null,r);return t.createStreamFromGenesis(ao.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...QH,...n};let o=ws.from(r);if(o.type!=ao.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${ao.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async replace(t,r={}){r={...oS,...r};let n=r.asDID?{did:r.asDID}:this.api,o=await this._makeCommit(n,t),s=await this.api.applyCommit(this.id,o,r);this.state$.next(s.state)}async patch(t,r={}){r={...oS,...r};let n={data:t,prev:this.tip,id:this.id.cid},o=await ao._signDagJWS(this.api,n),s=await this.api.applyCommit(this.id,o,r);this.state$.next(s.state)}makeReadOnly(){this.replace=B0,this.patch=B0,this.sync=B0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(t,r){let n=this._makeRawCommit(r);return ao._signDagJWS(t,n)}_makeRawCommit(t){return{data:nI.compare(this.content,t||{}),prev:this.tip,id:this.state.log[0].cid}}static async _makeGenesis(t,r,n){let o=await this._makeRawGenesis(t,r,n);return n.deterministic?(Bm(o),o):ao._signDagJWS(t,o)}static async _makeRawGenesis(t,r,n){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");let o=n.controller;if(!o)if(t.did)await t6(t),o=t.did.hasParent?t.did.parent:t.did.id;else throw new Error("No controller specified");let s={controllers:[o],model:n.model.bytes};return n.deterministic||(s.unique=(0,JH.randomBytes)(12)),{data:r,header:s}}static async _signDagJWS(t,r){return await t6(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");Gu.STREAM_TYPE_NAME="MID";Gu.STREAM_TYPE_ID=3;Gu=ao=ZH([Jm()],Gu);var Mk=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 bi(n,{method:"post",body:r})}async rm(e,t){let r=new URL(`./pins/${e}`,this._apiUrl);await bi(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 bi(t),{pinnedStreamIds:n}=r;return{[Symbol.asyncIterator](){let o=0;return{next(){return o===n.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:n[o++],done:!1})}}}}}},"RemotePinApi");a(Mk,"RemotePinApi");var Ik=i(class{constructor(e){this._fetchJson=bi,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:Xb(e)})).count}async query(e){let t=await this._fetchJson(this._collectionURL,{method:"POST",body:Xb(e)});return{edges:t.edges.map(n=>({cursor:n.cursor,node:jr.deserializeState(n.node)})),pageInfo:t.pageInfo}}},"RemoteIndexApi");a(Ik,"RemoteIndexApi");var kk=i(class{constructor(e,t){this._apiUrl=e,this._getDidFn=t,this._fetchJson=bi,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,o=await e.createJWS({code:t,requestPath:this.getModelsUrl().pathname,requestBody:n});return`${o.signatures[0].protected}.${o.payload}.${o.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");a(kk,"RemoteAdminApi");var eq="/api/v0/",tq="http://localhost:7007",rq={syncInterval:5e3},nq={anchor:!0,publish:!0,sync:Qn.PREFER_CACHE},iq={anchor:!0,publish:!0,sync:Qn.PREFER_CACHE},aS={sync:Qn.PREFER_CACHE},oq=i(class{constructor(e=tq,t={}){this._config={...rq,...t},this._apiUrl=new URL(eq,e),this._streamCache=new Map,this.context={api:this},this.pin=new Mk(this._apiUrl),this.index=new Ik(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new kk(this._apiUrl,r),this._streamConstructors={[Ku.STREAM_TYPE_ID]:Ku,[Mc.STREAM_TYPE_ID]:Mc,[Gu.STREAM_TYPE_ID]:Gu,[ka.STREAM_TYPE_ID]:ka}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...iq,...r};let n=await Hi.createFromGenesis(this._apiUrl,e,t,r,this._config.syncInterval),o=this._streamCache.get(n.id.toString());return o?(jr.statesEqual(n.state,o.state)||o.next(n.state),this.buildStreamFromDocument(o)):(this._streamCache.set(n.id.toString(),n),this.buildStreamFromDocument(n))}async loadStream(e,t={}){t={...aS,...t};let r=ws.from(e),n=this._streamCache.get(r.baseID.toString());return n?await n._syncState(r,t):(n=await Hi.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),o=await bi(n,{method:"post",body:{queries:r,timeout:t}});return Object.entries(o).reduce((s,c)=>{let[l,h]=c,p=jr.deserializeState(h),m=new Hi(p,this._apiUrl,this._config.syncInterval);return s[l]=this.buildStreamFromDocument(m),s},{})}loadStreamCommits(e){let t=Yb(e);return Hi.loadStreamCommits(t,this._apiUrl)}async applyCommit(e,t,r={}){r={...nq,...r};let n=Yb(e),o=await Hi.applyCommit(this._apiUrl,n,t,r,this._config.syncInterval),s=this._streamCache.get(n.toString());return s?(s.next(o.state),this.buildStreamFromDocument(o)):(this._streamCache.set(n.toString(),o),this.buildStreamFromDocument(o))}async requestAnchor(e,t={}){t={...aS,...t};let{anchorStatus:r}=await bi(`${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 Hi(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 bi(this._apiUrl+"/node/chains");return this._supportedChains=e,e}async close(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()}},"CeramicClient");a(oq,"CeramicClient");var nr;(function(e){e.assertEqual=o=>o;function t(o){}i(t,"assertIs"),a(t,"assertIs"),e.assertIs=t;function r(o){throw new Error}i(r,"assertNever"),a(r,"assertNever"),e.assertNever=r,e.arrayToEnum=o=>{let s={};for(let c of o)s[c]=c;return s},e.getValidEnumValues=o=>{let s=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),c={};for(let l of s)c[l]=o[l];return e.objectValues(c)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let c in o)Object.prototype.hasOwnProperty.call(o,c)&&s.push(c);return s},e.find=(o,s)=>{for(let c of o)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),a(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(nr||(nr={}));var rt=nr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),hs=a(e=>{switch(typeof e){case"undefined":return rt.undefined;case"string":return rt.string;case"number":return isNaN(e)?rt.nan:rt.number;case"boolean":return rt.boolean;case"function":return rt.function;case"bigint":return rt.bigint;case"symbol":return rt.symbol;case"object":return Array.isArray(e)?rt.array:e===null?rt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?rt.promise:typeof Map<"u"&&e instanceof Map?rt.map:typeof Set<"u"&&e instanceof Set?rt.set:typeof Date<"u"&&e instanceof Date?rt.date:rt.object;default:return rt.unknown}},"getParsedType"),Ge=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"]),aq=a(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ho=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(o){return o.message},r={_errors:[]},n=a(o=>{for(let s of o.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 h=s.path[l];l===s.path.length-1?(c[h]=c[h]||{_errors:[]},c[h]._errors.push(t(s))):c[h]=c[h]||{_errors:[]},c=c[h],l++}}},"processError");return n(this),r}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");a(Ho,"ZodError");Ho.create=e=>new Ho(e);var ud=a((e,t)=>{let r;switch(e.code){case Ge.invalid_type:e.received===rt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ge.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,nr.jsonStringifyReplacer)}`;break;case Ge.unrecognized_keys:r=`Unrecognized key(s) in object: ${nr.joinValues(e.keys,", ")}`;break;case Ge.invalid_union:r="Invalid input";break;case Ge.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${nr.joinValues(e.options)}`;break;case Ge.invalid_enum_value:r=`Invalid enum value. Expected ${nr.joinValues(e.options)}, received '${e.received}'`;break;case Ge.invalid_arguments:r="Invalid function arguments";break;case Ge.invalid_return_type:r="Invalid function return type";break;case Ge.invalid_date:r="Invalid date";break;case Ge.invalid_string:typeof e.validation=="object"?"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 Ge.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(e.minimum)}`:r="Invalid input";break;case Ge.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==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(e.maximum)}`:r="Invalid input";break;case Ge.custom:r="Invalid input";break;case Ge.invalid_intersection_types:r="Intersection results could not be merged";break;case Ge.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ge.not_finite:r="Number must be finite";break;default:r=t.defaultError,nr.assertNever(e)}return{message:r}},"errorMap"),Dk=ud;function Rk(e){Dk=e}i(Rk,"setErrorMap");a(Rk,"setErrorMap");function ld(){return Dk}i(ld,"getErrorMap");a(ld,"getErrorMap");var cm=a(e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],c={...o,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...o,path:s,message:o.message||l}},"makeIssue"),sq=[];function gt(e,t){let r=cm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,ld(),ud].filter(n=>!!n)});e.common.issues.push(r)}i(gt,"addIssueToContext");a(gt,"addIssueToContext");var Pn=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 Dt;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)r.push({key:await n.key,value:await n.value});return Pn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return Dt;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),(typeof s.value<"u"||n.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}},"ParseStatus");a(Pn,"ParseStatus");var Dt=Object.freeze({status:"aborted"}),Ok=a(e=>({status:"dirty",value:e}),"DIRTY"),xn=a(e=>({status:"valid",value:e}),"OK"),r6=a(e=>e.status==="aborted","isAborted"),n6=a(e=>e.status==="dirty","isDirty"),um=a(e=>e.status==="valid","isValid"),lm=a(e=>typeof Promise!==void 0&&e instanceof Promise,"isAsync"),Jt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Jt||(Jt={}));var vo=i(class{constructor(e,t,r,n){this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._path.concat(this._key)}},"ParseInputLazyPath");a(vo,"ParseInputLazyPath");var sS=a((e,t)=>{if(um(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Ho(e.common.issues);return{success:!1,error:r}}},"handleResult");function zt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=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:o}:{errorMap:a((c,l)=>c.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:n??l.defaultError}:{message:r??l.defaultError},"customMap"),description:o}}i(zt,"processCreateParams");a(zt,"processCreateParams");var $t=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.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return hs(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pn,ctx:{common:e.parent.common,data:e.data,parsedType:hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(lm(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:hs(e)},o=this._parseSync({data:e,path:n.path,parent:n});return sS(n,o)}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:hs(e)},n=this._parse({data:e,path:r.path,parent:r}),o=await(lm(n)?n:Promise.resolve(n));return sS(r,o)}refine(e,t){let r=a(n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t,"getIssueProperties");return this._refinement((n,o)=>{let s=e(n),c=a(()=>o.addIssue({code:Ge.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 Vi({schema:this,typeName:Tt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return mo.create(this)}nullable(){return As.create(this)}nullish(){return this.optional().nullable()}array(){return po.create(this)}promise(){return Rc.create(this)}or(e){return Xu.create([this,e])}and(e){return Qu.create(this,e)}transform(e){return new Vi({schema:this,typeName:Tt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new nl({innerType:this,defaultValue:t,typeName:Tt.ZodDefault})}brand(){return new F2({typeName:Tt.ZodBranded,type:this,...zt(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new md({innerType:this,defaultValue:t,typeName:Tt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Od.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},"ZodType");a($t,"ZodType");var cq=/^c[^\s-]{8,}$/i,uq=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,lq=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,fq=a(e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex"),Da=i(class extends $t{constructor(){super(...arguments),this._regex=(e,t,r)=>this.refinement(n=>e.test(n),{validation:t,code:Ge.invalid_string,...Jt.errToObj(r)}),this.nonempty=e=>this.min(1,Jt.errToObj(e)),this.trim=()=>new Da({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==rt.string){let o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.string,received:o.parsedType}),Dt}let r=new Pn,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,c=e.data.length<o.value;(s||c)&&(n=this._getOrReturnCtx(e,n),s?gt(n,{code:Ge.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):c&&gt(n,{code:Ge.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")lq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"email",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")uq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"uuid",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")cq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"cuid",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),gt(n,{validation:"url",code:Ge.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"regex",code:Ge.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?fq(o).test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:"datetime",message:o.message}),r.dirty()):nr.assertNever(o);return{status:r.value,value:e.data}}_addCheck(e){return new Da({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Jt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Jt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Jt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Jt.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...Jt.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Jt.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Jt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Jt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Jt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Jt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Jt.errToObj(t)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}},"ZodString");a(Da,"ZodString");Da.create=e=>{var t;return new Da({checks:[],typeName:Tt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};function Nk(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=parseInt(e.toFixed(o).replace(".","")),c=parseInt(t.toFixed(o).replace(".",""));return s%c/Math.pow(10,o)}i(Nk,"floatSafeRemainder");a(Nk,"floatSafeRemainder");var Es=i(class extends $t{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)!==rt.number){let o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.number,received:o.parsedType}),Dt}let r,n=new Pn;for(let o of this._def.checks)o.kind==="int"?nr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?Nk(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_finite,message:o.message}),n.dirty()):nr.assertNever(o);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Jt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Jt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Jt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Jt.toString(t))}setLimit(e,t,r,n){return new Es({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Jt.toString(n)}]})}_addCheck(e){return new Es({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Jt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Jt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Jt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Jt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Jt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Jt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Jt.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")}},"ZodNumber");a(Es,"ZodNumber");Es.create=e=>new Es({checks:[],typeName:Tt.ZodNumber,coerce:e?.coerce||!1,...zt(e)});var Wu=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==rt.bigint){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.bigint,received:r.parsedType}),Dt}return xn(e.data)}},"ZodBigInt");a(Wu,"ZodBigInt");Wu.create=e=>{var t;return new Wu({typeName:Tt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};var Ju=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==rt.boolean){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.boolean,received:r.parsedType}),Dt}return xn(e.data)}},"ZodBoolean");a(Ju,"ZodBoolean");Ju.create=e=>new Ju({typeName:Tt.ZodBoolean,coerce:e?.coerce||!1,...zt(e)});var Ic=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==rt.date){let o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.date,received:o.parsedType}),Dt}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_date}),Dt}let r=new Pn,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):nr.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ic({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Jt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Jt.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");a(Ic,"ZodDate");Ic.create=e=>new Ic({checks:[],coerce:e?.coerce||!1,typeName:Tt.ZodDate,...zt(e)});var fd=i(class extends $t{_parse(e){if(this._getType(e)!==rt.symbol){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.symbol,received:r.parsedType}),Dt}return xn(e.data)}},"ZodSymbol");a(fd,"ZodSymbol");fd.create=e=>new fd({typeName:Tt.ZodSymbol,...zt(e)});var Zu=i(class extends $t{_parse(e){if(this._getType(e)!==rt.undefined){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.undefined,received:r.parsedType}),Dt}return xn(e.data)}},"ZodUndefined");a(Zu,"ZodUndefined");Zu.create=e=>new Zu({typeName:Tt.ZodUndefined,...zt(e)});var Yu=i(class extends $t{_parse(e){if(this._getType(e)!==rt.null){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.null,received:r.parsedType}),Dt}return xn(e.data)}},"ZodNull");a(Yu,"ZodNull");Yu.create=e=>new Yu({typeName:Tt.ZodNull,...zt(e)});var kc=i(class extends $t{constructor(){super(...arguments),this._any=!0}_parse(e){return xn(e.data)}},"ZodAny");a(kc,"ZodAny");kc.create=e=>new kc({typeName:Tt.ZodAny,...zt(e)});var ms=i(class extends $t{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xn(e.data)}},"ZodUnknown");a(ms,"ZodUnknown");ms.create=e=>new ms({typeName:Tt.ZodUnknown,...zt(e)});var qo=i(class extends $t{_parse(e){let t=this._getOrReturnCtx(e);return gt(t,{code:Ge.invalid_type,expected:rt.never,received:t.parsedType}),Dt}},"ZodNever");a(qo,"ZodNever");qo.create=e=>new qo({typeName:Tt.ZodNever,...zt(e)});var dd=i(class extends $t{_parse(e){if(this._getType(e)!==rt.undefined){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.void,received:r.parsedType}),Dt}return xn(e.data)}},"ZodVoid");a(dd,"ZodVoid");dd.create=e=>new dd({typeName:Tt.ZodVoid,...zt(e)});var po=i(class extends $t{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==rt.array)return gt(t,{code:Ge.invalid_type,expected:rt.array,received:t.parsedType}),Dt;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,c=t.data.length<n.exactLength.value;(s||c)&&(gt(t,{code:s?Ge.too_big:Ge.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&&(gt(t,{code:Ge.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&&(gt(t,{code:Ge.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 vo(t,s,t.path,c)))).then(s=>Pn.mergeArray(r,s));let o=t.data.map((s,c)=>n.type._parseSync(new vo(t,s,t.path,c)));return Pn.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new po({...this._def,minLength:{value:e,message:Jt.toString(t)}})}max(e,t){return new po({...this._def,maxLength:{value:e,message:Jt.toString(t)}})}length(e,t){return new po({...this._def,exactLength:{value:e,message:Jt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");a(po,"ZodArray");po.create=(e,t)=>new po({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Tt.ZodArray,...zt(t)});var fm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(fm||(fm={}));var cS=a(e=>t=>new Ir({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function bc(e){if(e instanceof Ir){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=mo.create(bc(n))}return new Ir({...e._def,shape:()=>t})}else return e instanceof po?po.create(bc(e.element)):e instanceof mo?mo.create(bc(e.unwrap())):e instanceof As?As.create(bc(e.unwrap())):e instanceof Vo?Vo.create(e.items.map(t=>bc(t))):e}i(bc,"deepPartialify");a(bc,"deepPartialify");var Ir=i(class extends $t{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=cS(this._def),this.extend=cS(this._def)}_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)!==rt.object){let h=this._getOrReturnCtx(e);return gt(h,{code:Ge.invalid_type,expected:rt.object,received:h.parsedType}),Dt}let{status:r,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof qo&&this._def.unknownKeys==="strip"))for(let h in n.data)s.includes(h)||c.push(h);let l=[];for(let h of s){let p=o[h],m=n.data[h];l.push({key:{status:"valid",value:h},value:p._parse(new vo(n,m,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof qo){let h=this._def.unknownKeys;if(h==="passthrough")for(let p of c)l.push({key:{status:"valid",value:p},value:{status:"valid",value:n.data[p]}});else if(h==="strict")c.length>0&&(gt(n,{code:Ge.unrecognized_keys,keys:c}),r.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let h=this._def.catchall;for(let p of c){let m=n.data[p];l.push({key:{status:"valid",value:p},value:h._parse(new vo(n,m,n.path,p)),alwaysSet:p in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let h=[];for(let p of l){let m=await p.key;h.push({key:m,value:await p.value,alwaysSet:p.alwaysSet})}return h}).then(h=>Pn.mergeObjectSync(r,h)):Pn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return Jt.errToObj,new Ir({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,o,s,c;let l=(s=(o=(n=this._def).errorMap)===null||o===void 0?void 0:o.call(n,t,r).message)!==null&&s!==void 0?s:r.defaultError;return t.code==="unrecognized_keys"?{message:(c=Jt.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Ir({...this._def,unknownKeys:"strip"})}passthrough(){return new Ir({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new Ir({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>fm.mergeShapes(this._def.shape(),e._def.shape()),typeName:Tt.ZodObject})}catchall(e){return new Ir({...this._def,catchall:e})}pick(e){let t={};return nr.objectKeys(e).map(r=>{this.shape[r]&&(t[r]=this.shape[r])}),new Ir({...this._def,shape:()=>t})}omit(e){let t={};return nr.objectKeys(this.shape).map(r=>{nr.objectKeys(e).indexOf(r)===-1&&(t[r]=this.shape[r])}),new Ir({...this._def,shape:()=>t})}deepPartial(){return bc(this)}partial(e){let t={};if(e)return nr.objectKeys(this.shape).map(r=>{nr.objectKeys(e).indexOf(r)===-1?t[r]=this.shape[r]:t[r]=this.shape[r].optional()}),new Ir({...this._def,shape:()=>t});for(let r in this.shape){let n=this.shape[r];t[r]=n.optional()}return new Ir({...this._def,shape:()=>t})}required(e){let t={};if(e)nr.objectKeys(this.shape).map(r=>{if(nr.objectKeys(e).indexOf(r)===-1)t[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof mo;)o=o._def.innerType;t[r]=o}});else for(let r in this.shape){let o=this.shape[r];for(;o instanceof mo;)o=o._def.innerType;t[r]=o}return new Ir({...this._def,shape:()=>t})}keyof(){return L2(nr.objectKeys(this.shape))}},"ZodObject");a(Ir,"ZodObject");Ir.create=(e,t)=>new Ir({shape:()=>e,unknownKeys:"strip",catchall:qo.create(),typeName:Tt.ZodObject,...zt(t)});Ir.strictCreate=(e,t)=>new Ir({shape:()=>e,unknownKeys:"strict",catchall:qo.create(),typeName:Tt.ZodObject,...zt(t)});Ir.lazycreate=(e,t)=>new Ir({shape:e,unknownKeys:"strip",catchall:qo.create(),typeName:Tt.ZodObject,...zt(t)});var Xu=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(o){for(let c of o)if(c.result.status==="valid")return c.result;for(let c of o)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let s=o.map(c=>new Ho(c.ctx.common.issues));return gt(t,{code:Ge.invalid_union,unionErrors:s}),Dt}if(i(n,"handleResults"),a(n,"handleResults"),t.common.async)return Promise.all(r.map(async o=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);{let o,s=[];for(let l of r){let h={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:h});if(p.status==="valid")return p;p.status==="dirty"&&!o&&(o={result:p,ctx:h}),h.common.issues.length&&s.push(h.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let c=s.map(l=>new Ho(l));return gt(t,{code:Ge.invalid_union,unionErrors:c}),Dt}}get options(){return this._def.options}},"ZodUnion");a(Xu,"ZodUnion");Xu.create=(e,t)=>new Xu({options:e,typeName:Tt.ZodUnion,...zt(t)});var P0=a(e=>e instanceof el?P0(e.schema):e instanceof Vi?P0(e.innerType()):e instanceof tl?[e.value]:e instanceof bl?e.options:e instanceof rl?Object.keys(e.enum):e instanceof nl?P0(e._def.innerType):e instanceof Zu?[void 0]:e instanceof Yu?[null]:null,"getDiscriminator"),Zm=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.object)return gt(t,{code:Ge.invalid_type,expected:rt.object,received:t.parsedType}),Dt;let r=this.discriminator,n=t.data[r],o=this.optionsMap.get(n);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(gt(t,{code:Ge.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Dt)}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 o of t){let s=P0(o.shape[e]);if(!s)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,o)}}return new Zm({typeName:Tt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...zt(r)})}},"ZodDiscriminatedUnion");a(Zm,"ZodDiscriminatedUnion");function dm(e,t){let r=hs(e),n=hs(t);if(e===t)return{valid:!0,data:e};if(r===rt.object&&n===rt.object){let o=nr.objectKeys(t),s=nr.objectKeys(e).filter(l=>o.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=dm(e[l],t[l]);if(!h.valid)return{valid:!1};c[l]=h.data}return{valid:!0,data:c}}else if(r===rt.array&&n===rt.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=dm(c,l);if(!h.valid)return{valid:!1};o.push(h.data)}return{valid:!0,data:o}}else return r===rt.date&&n===rt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(dm,"mergeValues");a(dm,"mergeValues");var Qu=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=a((o,s)=>{if(r6(o)||r6(s))return Dt;let c=dm(o.value,s.value);return c.valid?((n6(o)||n6(s))&&t.dirty(),{status:t.value,value:c.data}):(gt(r,{code:Ge.invalid_intersection_types}),Dt)},"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(([o,s])=>n(o,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");a(Qu,"ZodIntersection");Qu.create=(e,t,r)=>new Qu({left:e,right:t,typeName:Tt.ZodIntersection,...zt(r)});var Vo=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.array)return gt(r,{code:Ge.invalid_type,expected:rt.array,received:r.parsedType}),Dt;if(r.data.length<this._def.items.length)return gt(r,{code:Ge.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Dt;!this._def.rest&&r.data.length>this._def.items.length&&(gt(r,{code:Ge.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let o=r.data.map((s,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new vo(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Pn.mergeArray(t,s)):Pn.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new Vo({...this._def,rest:e})}},"ZodTuple");a(Vo,"ZodTuple");Vo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vo({items:e,typeName:Tt.ZodTuple,rest:null,...zt(t)})};var hd=i(class extends $t{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!==rt.object)return gt(r,{code:Ge.invalid_type,expected:rt.object,received:r.parsedType}),Dt;let n=[],o=this._def.keyType,s=this._def.valueType;for(let c in r.data)n.push({key:o._parse(new vo(r,c,r.path,c)),value:s._parse(new vo(r,r.data[c],r.path,c))});return r.common.async?Pn.mergeObjectAsync(t,n):Pn.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof $t?new hd({keyType:e,valueType:t,typeName:Tt.ZodRecord,...zt(r)}):new hd({keyType:Da.create(),valueType:e,typeName:Tt.ZodRecord,...zt(t)})}},"ZodRecord");a(hd,"ZodRecord");var pd=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.map)return gt(r,{code:Ge.invalid_type,expected:rt.map,received:r.parsedType}),Dt;let n=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([c,l],h)=>({key:n._parse(new vo(r,c,r.path,[h,"key"])),value:o._parse(new vo(r,l,r.path,[h,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of s){let h=await l.key,p=await l.value;if(h.status==="aborted"||p.status==="aborted")return Dt;(h.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(h.value,p.value)}return{status:t.value,value:c}})}else{let c=new Map;for(let l of s){let h=l.key,p=l.value;if(h.status==="aborted"||p.status==="aborted")return Dt;(h.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(h.value,p.value)}return{status:t.value,value:c}}}},"ZodMap");a(pd,"ZodMap");pd.create=(e,t,r)=>new pd({valueType:t,keyType:e,typeName:Tt.ZodMap,...zt(r)});var Dc=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.set)return gt(r,{code:Ge.invalid_type,expected:rt.set,received:r.parsedType}),Dt;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(gt(r,{code:Ge.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&&(gt(r,{code:Ge.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let o=this._def.valueType;function s(l){let h=new Set;for(let p of l){if(p.status==="aborted")return Dt;p.status==="dirty"&&t.dirty(),h.add(p.value)}return{status:t.value,value:h}}i(s,"finalizeSet"),a(s,"finalizeSet");let c=[...r.data.values()].map((l,h)=>o._parse(new vo(r,l,r.path,h)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,t){return new Dc({...this._def,minSize:{value:e,message:Jt.toString(t)}})}max(e,t){return new Dc({...this._def,maxSize:{value:e,message:Jt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}},"ZodSet");a(Dc,"ZodSet");Dc.create=(e,t)=>new Dc({valueType:e,minSize:null,maxSize:null,typeName:Tt.ZodSet,...zt(t)});var Uu=i(class extends $t{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.function)return gt(t,{code:Ge.invalid_type,expected:rt.function,received:t.parsedType}),Dt;function r(c,l){return cm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ld(),ud].filter(h=>!!h),issueData:{code:Ge.invalid_arguments,argumentsError:l}})}i(r,"makeArgsIssue"),a(r,"makeArgsIssue");function n(c,l){return cm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ld(),ud].filter(h=>!!h),issueData:{code:Ge.invalid_return_type,returnTypeError:l}})}i(n,"makeReturnsIssue"),a(n,"makeReturnsIssue");let o={errorMap:t.common.contextualErrorMap},s=t.data;return this._def.returns instanceof Rc?xn(async(...c)=>{let l=new Ho([]),h=await this._def.args.parseAsync(c,o).catch(y=>{throw l.addIssue(r(c,y)),l}),p=await s(...h);return await this._def.returns._def.type.parseAsync(p,o).catch(y=>{throw l.addIssue(n(p,y)),l})}):xn((...c)=>{let l=this._def.args.safeParse(c,o);if(!l.success)throw new Ho([r(c,l.error)]);let h=s(...l.data),p=this._def.returns.safeParse(h,o);if(!p.success)throw new Ho([n(h,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Uu({...this._def,args:Vo.create(e).rest(ms.create())})}returns(e){return new Uu({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Uu({args:e||Vo.create([]).rest(ms.create()),returns:t||ms.create(),typeName:Tt.ZodFunction,...zt(r)})}},"ZodFunction");a(Uu,"ZodFunction");var el=i(class extends $t{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");a(el,"ZodLazy");el.create=(e,t)=>new el({getter:e,typeName:Tt.ZodLazy,...zt(t)});var tl=i(class extends $t{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return gt(t,{code:Ge.invalid_literal,expected:this._def.value}),Dt}return{status:"valid",value:e.data}}get value(){return this._def.value}},"ZodLiteral");a(tl,"ZodLiteral");tl.create=(e,t)=>new tl({value:e,typeName:Tt.ZodLiteral,...zt(t)});function L2(e,t){return new bl({values:e,typeName:Tt.ZodEnum,...zt(t)})}i(L2,"createZodEnum");a(L2,"createZodEnum");var bl=i(class extends $t{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return gt(t,{expected:nr.joinValues(r),received:t.parsedType,code:Ge.invalid_type}),Dt}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),r=this._def.values;return gt(t,{received:t.data,code:Ge.invalid_enum_value,options:r}),Dt}return xn(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}},"ZodEnum");a(bl,"ZodEnum");bl.create=L2;var rl=i(class extends $t{_parse(e){let t=nr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==rt.string&&r.parsedType!==rt.number){let n=nr.objectValues(t);return gt(r,{expected:nr.joinValues(n),received:r.parsedType,code:Ge.invalid_type}),Dt}if(t.indexOf(e.data)===-1){let n=nr.objectValues(t);return gt(r,{received:r.data,code:Ge.invalid_enum_value,options:n}),Dt}return xn(e.data)}get enum(){return this._def.values}},"ZodNativeEnum");a(rl,"ZodNativeEnum");rl.create=(e,t)=>new rl({values:e,typeName:Tt.ZodNativeEnum,...zt(t)});var Rc=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.promise&&t.common.async===!1)return gt(t,{code:Ge.invalid_type,expected:rt.promise,received:t.parsedType}),Dt;let r=t.parsedType===rt.promise?t.data:Promise.resolve(t.data);return xn(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}},"ZodPromise");a(Rc,"ZodPromise");Rc.create=(e,t)=>new Rc({type:e,typeName:Tt.ZodPromise,...zt(t)});var Vi=i(class extends $t{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Tt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null;if(n.type==="preprocess"){let s=n.transform(r.data);return r.common.async?Promise.resolve(s).then(c=>this._def.schema._parseAsync({data:c,path:r.path,parent:r})):this._def.schema._parseSync({data:s,path:r.path,parent:r})}let o={addIssue:s=>{gt(r,s),s.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="refinement"){let s=a(c=>{let l=n.refinement(c,o);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"?Dt:(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"?Dt:(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(!um(s))return s;let c=n.transform(s.value,o);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=>um(s)?Promise.resolve(n.transform(s.value,o)).then(c=>({status:t.value,value:c})):s);nr.assertNever(n)}},"ZodEffects");a(Vi,"ZodEffects");Vi.create=(e,t,r)=>new Vi({schema:e,typeName:Tt.ZodEffects,effect:t,...zt(r)});Vi.createWithPreprocess=(e,t,r)=>new Vi({schema:t,effect:{type:"preprocess",transform:e},typeName:Tt.ZodEffects,...zt(r)});var mo=i(class extends $t{_parse(e){return this._getType(e)===rt.undefined?xn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodOptional");a(mo,"ZodOptional");mo.create=(e,t)=>new mo({innerType:e,typeName:Tt.ZodOptional,...zt(t)});var As=i(class extends $t{_parse(e){return this._getType(e)===rt.null?xn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodNullable");a(As,"ZodNullable");As.create=(e,t)=>new As({innerType:e,typeName:Tt.ZodNullable,...zt(t)});var nl=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===rt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}},"ZodDefault");a(nl,"ZodDefault");nl.create=(e,t)=>new nl({innerType:e,typeName:Tt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var md=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return lm(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()})):{status:"valid",value:r.status==="valid"?r.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}},"ZodCatch");a(md,"ZodCatch");md.create=(e,t)=>new md({innerType:e,typeName:Tt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var gd=i(class extends $t{_parse(e){if(this._getType(e)!==rt.nan){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.nan,received:r.parsedType}),Dt}return{status:"valid",value:e.data}}},"ZodNaN");a(gd,"ZodNaN");gd.create=e=>new gd({typeName:Tt.ZodNaN,...zt(e)});var dq=Symbol("zod_brand"),F2=i(class extends $t{_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");a(F2,"ZodBranded");var Od=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return a(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Dt:o.status==="dirty"?(t.dirty(),Ok(o.value)):this._def.out._parseAsync({data:o.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"?Dt: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 Od({in:e,out:t,typeName:Tt.ZodPipeline})}},"ZodPipeline");a(Od,"ZodPipeline");var Bk=a((e,t={},r)=>e?kc.create().superRefine((n,o)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...c,fatal:r})}}):kc.create(),"custom"),hq={object:Ir.lazycreate},Tt;(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"})(Tt||(Tt={}));var pq=a((e,t={message:`Input not instance of ${e.name}`})=>Bk(r=>r instanceof e,t,!0),"instanceOfType"),Pk=Da.create,Lk=Es.create,mq=gd.create,gq=Wu.create,Fk=Ju.create,vq=Ic.create,yq=fd.create,bq=Zu.create,wq=Yu.create,_q=kc.create,Eq=ms.create,Aq=qo.create,Sq=dd.create,xq=po.create,Tq=Ir.create,Cq=Ir.strictCreate,Mq=Xu.create,Iq=Zm.create,kq=Qu.create,Dq=Vo.create,Rq=hd.create,Oq=pd.create,Nq=Dc.create,Bq=Uu.create,Pq=el.create,Lq=tl.create,Fq=bl.create,Uq=rl.create,$q=Rc.create,uS=Vi.create,jq=mo.create,zq=As.create,Hq=Vi.createWithPreprocess,qq=Od.create,Vq=a(()=>Pk().optional(),"ostring"),Kq=a(()=>Lk().optional(),"onumber"),Gq=a(()=>Fk().optional(),"oboolean"),Wq={string:e=>Da.create({...e,coerce:!0}),number:e=>Es.create({...e,coerce:!0}),boolean:e=>Ju.create({...e,coerce:!0}),bigint:e=>Wu.create({...e,coerce:!0}),date:e=>Ic.create({...e,coerce:!0})},Jq=Dt,G=Object.freeze({__proto__:null,defaultErrorMap:ud,setErrorMap:Rk,getErrorMap:ld,makeIssue:cm,EMPTY_PATH:sq,addIssueToContext:gt,ParseStatus:Pn,INVALID:Dt,DIRTY:Ok,OK:xn,isAborted:r6,isDirty:n6,isValid:um,isAsync:lm,get util(){return nr},ZodParsedType:rt,getParsedType:hs,ZodType:$t,ZodString:Da,ZodNumber:Es,ZodBigInt:Wu,ZodBoolean:Ju,ZodDate:Ic,ZodSymbol:fd,ZodUndefined:Zu,ZodNull:Yu,ZodAny:kc,ZodUnknown:ms,ZodNever:qo,ZodVoid:dd,ZodArray:po,get objectUtil(){return fm},ZodObject:Ir,ZodUnion:Xu,ZodDiscriminatedUnion:Zm,ZodIntersection:Qu,ZodTuple:Vo,ZodRecord:hd,ZodMap:pd,ZodSet:Dc,ZodFunction:Uu,ZodLazy:el,ZodLiteral:tl,ZodEnum:bl,ZodNativeEnum:rl,ZodPromise:Rc,ZodEffects:Vi,ZodTransformer:Vi,ZodOptional:mo,ZodNullable:As,ZodDefault:nl,ZodCatch:md,ZodNaN:gd,BRAND:dq,ZodBranded:F2,ZodPipeline:Od,custom:Bk,Schema:$t,ZodSchema:$t,late:hq,get ZodFirstPartyTypeKind(){return Tt},coerce:Wq,any:_q,array:xq,bigint:gq,boolean:Fk,date:vq,discriminatedUnion:Iq,effect:uS,enum:Fq,function:Bq,instanceof:pq,intersection:kq,lazy:Pq,literal:Lq,map:Oq,nan:mq,nativeEnum:Uq,never:Aq,null:wq,nullable:zq,number:Lk,object:Tq,oboolean:Gq,onumber:Kq,optional:jq,ostring:Vq,pipeline:qq,preprocess:Hq,promise:$q,record:Rq,set:Nq,strictObject:Cq,string:Pk,symbol:yq,transformer:uS,tuple:Dq,undefined:bq,union:Mq,unknown:Eq,void:Sq,NEVER:Jq,ZodIssueCode:Ge,quotelessJson:aq,ZodError:Ho}),Zq=Object.defineProperty,Yq=a((e,t)=>Zq(e,"name",{value:t,configurable:!0}),"__name"),Ym=G.array(G.string().or(G.record(G.any()))),AY=G.object({type:G.string().optional(),narrative:G.string().optional()}),Xm=G.string().or(G.object({id:G.string(),type:G.string(),caption:G.string().optional()})),Xq=G.object({type:G.string().min(1).or(G.string().array().nonempty()),latitude:G.number(),longitude:G.number()}),Qq=G.object({type:G.string().min(1).or(G.string().array().nonempty()),addressCountry:G.string().optional(),addressCountryCode:G.string().optional(),addressRegion:G.string().optional(),addressLocality:G.string().optional(),streetAddress:G.string().optional(),postOfficeBoxNumber:G.string().optional(),postalCode:G.string().optional(),geo:Xq.optional()}),eV=G.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(G.string()),Uk=G.object({type:G.string().min(1).or(G.string().array().nonempty()),identifier:G.string(),identifierType:eV}),vd=G.string().or(G.object({id:G.string().optional(),type:G.string().or(G.string().array().nonempty().optional()),name:G.string().optional(),url:G.string().optional(),phone:G.string().optional(),description:G.string().optional(),endorsement:G.any().array().optional(),image:Xm.optional(),email:G.string().email().optional(),address:Qq.optional(),otherIdentifier:Uk.array().optional(),official:G.string().optional(),parentOrg:G.any().optional(),familyName:G.string().optional(),givenName:G.string().optional(),additionalName:G.string().optional(),patronymicName:G.string().optional(),honorificPrefix:G.string().optional(),honorificSuffix:G.string().optional(),familyNamePrefix:G.string().optional(),dateOfBirth:G.string().optional()}).catchall(G.any())),i6=G.object({id:G.string().optional()}).catchall(G.any()),tV=G.object({type:G.string(),id:G.string()}).catchall(G.any()),rV=G.object({id:G.string(),type:G.string()}).catchall(G.any()),nV=G.object({id:G.string(),type:G.string()}).catchall(G.any()),hm=G.object({"@context":Ym,id:G.string().optional(),type:G.string().array().nonempty(),issuer:vd,issuanceDate:G.string(),expirationDate:G.string().optional(),credentialSubject:i6.or(i6.array()),credentialStatus:tV.optional(),credentialSchema:rV.array().optional(),refreshService:nV.optional()}).catchall(G.any()),Ko=G.object({type:G.string(),created:G.string(),challenge:G.string().optional(),domain:G.string().optional(),nonce:G.string().optional(),proofPurpose:G.string(),verificationMethod:G.string(),jws:G.string().optional()}).catchall(G.any()),lS=hm.extend({proof:Ko.or(Ko.array())}),iV=G.object({"@context":Ym,id:G.string().optional(),type:G.string().or(G.string().array().nonempty()),verifiableCredential:lS.or(lS.array()).optional(),holder:G.string().optional()}).catchall(G.any()),SY=iV.extend({proof:Ko.or(Ko.array())}),$k=G.object({kty:G.string(),crv:G.string(),x:G.string(),y:G.string().optional(),n:G.string().optional(),d:G.string()}),oV=G.object({alg:G.string(),iv:G.string(),tag:G.string(),epk:$k.partial().optional(),kid:G.string().optional(),apv:G.string().optional(),apu:G.string().optional()}),aV=G.object({header:oV,encrypted_key:G.string()}),sV=G.object({protected:G.string(),iv:G.string(),ciphertext:G.string(),tag:G.string(),aad:G.string().optional(),recipients:aV.array().optional()}),vc=G.string().or(G.object({"@context":Ym.optional(),id:G.string(),type:G.string(),controller:G.string(),publicKeyJwk:$k.optional(),publicKeyBase58:G.string().optional(),blockChainAccountId:G.string().optional()}).catchall(G.any())),cV=G.object({id:G.string(),type:G.string().or(G.string().array().nonempty()),serviceEndpoint:G.any().or(G.any().array().nonempty())}).catchall(G.any()),xY=G.object({"@context":Ym,id:G.string(),alsoKnownAs:G.string().optional(),controller:G.string().or(G.string().array().nonempty()).optional(),verificationMethod:vc.array().optional(),authentication:vc.array().optional(),assertionMethod:vc.array().optional(),keyAgreement:vc.array().optional(),capabilityInvocation:vc.array().optional(),capabilityDelegation:vc.array().optional(),publicKey:vc.array().optional(),service:cV.array().optional(),proof:Ko.or(Ko.array()).optional()}).catchall(G.any()),uV=G.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(G.string()),Qm=G.object({type:G.string().array().nonempty(),targetCode:G.string().optional(),targetDescription:G.string().optional(),targetName:G.string(),targetFramework:G.string().optional(),targetType:uV.optional(),targetUrl:G.string()}),lV=G.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"]),fV=lV.or(G.string()),dV=G.object({id:G.string().optional(),narrative:G.string().optional()}).catchall(G.any()),hV=G.object({id:G.string(),type:G.string().array().nonempty(),endorsementComment:G.string().optional()}),pV=hm.extend({credentialSubject:hV,proof:Ko.or(Ko.array()).optional()}),mV=G.object({id:G.string(),"@language":G.string().optional(),version:G.string().optional()}),gV=G.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(G.string()),vV=G.object({id:G.string(),type:G.string().array().nonempty(),alignment:Qm.array().optional(),description:G.string().optional(),level:G.string().optional(),name:G.string(),points:G.string().optional()}).catchall(G.any()),yV=G.object({id:G.string(),type:G.string().array().nonempty(),alignment:Qm.array().optional(),allowedValue:G.string().array().optional(),name:G.string(),requiredLevel:G.string().optional(),requiredValue:G.string().optional(),resultType:gV,rubricCriterionLevel:vV.array().optional(),valueMax:G.string().optional(),valueMin:G.string().optional()}).catchall(G.any()),bV=G.object({id:G.string().optional(),type:G.string().array().nonempty(),alignment:Qm.array().optional(),achievementType:fV.optional(),creator:vd.optional(),creditsAvailable:G.number().optional(),criteria:dV,description:G.string(),endorsement:pV.array().optional(),fieldOfStudy:G.string().optional(),humanCode:G.string().optional(),image:Xm.optional(),"@language":G.string().optional(),name:G.string(),otherIdentifier:Uk.array().optional(),related:mV.array().optional(),resultDescription:yV.array().optional(),specialization:G.string().optional(),tag:G.string().array().optional(),version:G.string().optional()}).catchall(G.any()),wV=G.object({type:G.string(),hashed:G.boolean(),identityHash:G.string(),identityType:G.string(),salt:G.string().optional()}),_V=G.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),EV=G.object({type:G.string().array().nonempty(),achievedLevel:G.string().optional(),alignment:Qm.array().optional(),resultDescription:G.string().optional(),status:_V.optional(),value:G.string().optional()}).catchall(G.any()),fS=G.object({id:G.string().optional(),type:G.string().array().nonempty(),activityEndDate:G.string().optional(),activityStartDate:G.string().optional(),creditsEarned:G.number().optional(),achievement:bV.optional(),identifier:wV.array().optional(),image:Xm.optional(),licenseNumber:G.string().optional(),narrative:G.string().optional(),result:EV.array().optional(),role:G.string().optional(),source:vd.optional(),term:G.string().optional()}).catchall(G.any()),AV=G.object({id:G.string().optional(),type:G.string().array().nonempty(),narrative:G.string().optional(),name:G.string().optional(),description:G.string().optional(),genre:G.string().optional(),audience:G.string().optional()}).catchall(G.any()),SV=hm.extend({name:G.string().optional(),description:G.string().optional(),image:Xm.optional(),credentialSubject:fS.or(fS.array()),endorsement:hm.array().optional(),evidence:AV.array().optional()}),TY=SV.extend({proof:Ko.or(Ko.array())}),CY=G.object({checks:G.string().array(),warnings:G.string().array(),errors:G.string().array()}),jk=G.enum(["Success","Failed","Error"]),MY=jk.enum,IY=G.object({check:G.string(),status:jk,message:G.string().optional(),details:G.string().optional()}),kY=G.object({title:G.string().optional(),createdAt:G.string().optional(),issuer:vd.optional(),issuee:vd.optional(),credentialSubject:i6.optional()}),DY=G.object({id:G.string(),uri:G.string()}).catchall(G.any()),RY=G.object({limit:G.number(),cursor:G.string().optional(),sort:G.string().optional()}),bo=G.object({cursor:G.string().optional(),hasMore:G.boolean()}),zk=G.object({encryptedRecord:sV,fields:G.string().array()}).catchall(G.any()),OY=bo.extend({records:zk.array()}),xV=zk.extend({id:G.string()}),NY=bo.extend({records:xV.array()}),dS=Yq(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),TV=G.instanceof(RegExp).or(G.string().refine(e=>{try{return dS(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=dS(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),un=G.string().or(G.object({$in:G.string().array()})).or(G.object({$regex:TV})),CV=G.object({backgroundColor:G.string().optional(),backgroundImage:G.string().optional(),fadeBackgroundImage:G.boolean().optional(),repeatBackgroundImage:G.boolean().optional(),fontColor:G.string().optional(),accentColor:G.string().optional(),accentFontColor:G.string().optional(),idBackgroundImage:G.string().optional(),fadeIdBackgroundImage:G.boolean().optional(),idBackgroundColor:G.string().optional(),repeatIdBackgroundImage:G.boolean().optional()}),Oc=G.object({profileId:G.string().min(3).max(40),displayName:G.string().default(""),shortBio:G.string().default(""),bio:G.string().default(""),did:G.string(),email:G.string().optional(),image:G.string().optional(),heroImage:G.string().optional(),websiteLink:G.string().optional(),isServiceProfile:G.boolean().default(!1).optional(),type:G.string().optional(),notificationsWebhook:G.string().url().startsWith("http").optional(),display:CV.optional()}),BY=G.object({profileId:un,displayName:un,shortBio:un,bio:un,email:un,websiteLink:un,isServiceProfile:G.boolean(),type:un}).partial(),PY=bo.extend({records:Oc.array()}),LY=G.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),Hk=G.object({id:G.string(),created:G.string(),displayName:G.string().default("").optional(),shortBio:G.string().default("").optional(),bio:G.string().default("").optional(),email:G.string().optional(),image:G.string().optional(),heroImage:G.string().optional()}),FY=bo.extend({records:Hk.extend({did:G.string()}).array()}),UY=G.object({id:un,displayName:un,shortBio:un,bio:un,email:un}).partial(),$Y=bo.extend({records:G.object({profile:Oc,manager:Hk.extend({did:G.string()}).optional()}).array()}),jY=G.object({uri:G.string(),to:G.string(),from:G.string(),sent:G.string().datetime(),received:G.string().datetime().optional()}),MV=G.object({role:G.string(),canEdit:G.boolean(),canIssue:G.boolean(),canRevoke:G.boolean(),canManagePermissions:G.boolean(),canIssueChildren:G.string(),canCreateChildren:G.string(),canEditChildren:G.string(),canRevokeChildren:G.string(),canManageChildrenPermissions:G.string(),canManageChildrenProfiles:G.boolean().default(!1).optional(),canViewAnalytics:G.boolean()}),o6=G.enum(["DRAFT","LIVE"]),IV=G.object({uri:G.string(),name:G.string().optional(),type:G.string().optional(),category:G.string().optional(),status:o6.optional(),autoConnectRecipients:G.boolean().optional(),meta:G.record(G.any()).optional(),claimPermissions:MV.optional()}),zY=G.object({uri:un,name:un,type:un,category:un,meta:G.record(un),status:o6.or(G.object({$in:o6.array()})),autoConnectRecipients:G.boolean()}).partial(),HY=bo.extend({records:IV.array()}),kV=G.object({to:Oc,from:G.string(),received:G.string().optional(),uri:G.string().optional()}),qY=bo.extend({records:kV.array()}),VY=G.object({endpoint:G.string(),name:G.string(),did:G.string().optional()}),KY=G.object({ttlSeconds:G.number().optional(),totalUses:G.number().optional()}),DV=G.object({endpoint:G.string()}),GY=G.object({signingAuthority:DV,relationship:G.object({name:G.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:G.string()})}),RV=G.enum(["live","stale","withdrawn"]),OV=G.object({read:G.object({anonymize:G.boolean().optional(),credentials:G.object({categories:G.record(G.object({required:G.boolean()})).default({})}).default({}),personal:G.record(G.object({required:G.boolean()})).default({})}).default({}),write:G.object({credentials:G.object({categories:G.record(G.object({required:G.boolean()})).default({})}).default({}),personal:G.record(G.object({required:G.boolean()})).default({})}).default({})}),qk=G.object({contract:OV,owner:Oc,name:G.string(),subtitle:G.string().optional(),description:G.string().optional(),reasonForAccessing:G.string().optional(),image:G.string().optional(),uri:G.string(),needsGuardianConsent:G.boolean().optional(),createdAt:G.string(),updatedAt:G.string(),expiresAt:G.string().optional()}),WY=bo.extend({records:qk.omit({owner:!0}).array()}),NV=G.object({credentials:G.object({categories:G.record(G.string().array()).default({})}),personal:G.record(G.string()).default({}),date:G.string()}),JY=bo.extend({records:NV.array()}),Vk=G.object({sharing:G.boolean().optional(),shared:G.string().array().optional(),shareAll:G.boolean().optional(),shareUntil:G.string().optional()}),Kk=G.object({read:G.object({anonymize:G.boolean().optional(),credentials:G.object({shareAll:G.boolean().optional(),sharing:G.boolean().optional(),categories:G.record(Vk).default({})}).default({}),personal:G.record(G.string()).default({})}).default({}),write:G.object({credentials:G.object({categories:G.record(G.boolean()).default({})}).default({}),personal:G.record(G.boolean()).default({})}).default({})}),ZY=bo.extend({records:G.object({expiresAt:G.string().optional(),oneTime:G.boolean().optional(),terms:Kk,contract:qk,uri:G.string(),consenter:Oc,status:RV}).array()}),YY=G.object({read:G.object({anonymize:G.boolean().optional(),credentials:G.object({categories:G.record(G.object({required:G.boolean().optional()})).optional()}).optional(),personal:G.record(G.object({required:G.boolean().optional()})).optional()}).optional(),write:G.object({credentials:G.object({categories:G.record(G.object({required:G.boolean().optional()})).optional()}).optional(),personal:G.record(G.object({required:G.boolean().optional()})).optional()}).optional()}),XY=G.object({anonymize:G.boolean().optional(),credentials:G.object({categories:G.record(G.boolean()).optional()}).optional(),personal:G.record(G.boolean()).optional()}),BV=G.object({read:G.object({anonymize:G.boolean().optional(),credentials:G.object({shareAll:G.boolean().optional(),sharing:G.boolean().optional(),categories:G.record(Vk.optional()).optional()}).optional(),personal:G.record(G.string()).optional()}).optional(),write:G.object({credentials:G.object({categories:G.record(G.boolean()).optional()}).optional(),personal:G.record(G.boolean()).optional()}).optional()}),a6=G.enum(["consent","update","sync","withdraw"]),QY=G.object({terms:BV.optional(),action:a6.or(a6.array()).optional(),date:G.object({$gt:G.string()}).or(G.object({$lt:G.string()})).or(G.object({$eq:G.string()})).optional(),expiresAt:G.object({$gt:G.string()}).or(G.object({$lt:G.string()})).or(G.object({$eq:G.string()})).optional(),oneTime:G.boolean().optional()}),Gk=G.object({expiresAt:G.string().optional(),oneTime:G.boolean().optional(),terms:Kk.optional(),id:G.string(),action:a6,date:G.string()}),eX=bo.extend({records:Gk.array()}),PV=G.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),LV=G.object({title:G.string().optional(),body:G.string().optional()}),FV=G.object({vcUris:G.array(G.string()).optional(),vpUris:G.array(G.string()).optional(),transaction:Gk.optional()}),tX=G.object({type:PV,to:Oc.partial().and(G.object({did:G.string()})),from:Oc.partial().and(G.object({did:G.string()})),message:LV.optional(),data:FV.optional(),sent:G.string().datetime().optional()}),e1=a(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),rX=G.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 U2=K.object({credentials:mc.array()}).catchall(K.any()),Wk=K.object({id:K.string(),title:K.string(),storageType:K.literal("ceramic").optional()}).catchall(K.any()),$2=K.object({credentials:mc.or(Wk).array()}).strict();var t1=i(async(e,{modelData:t,credentialAlias:r})=>{let n=e.invoke.getCeramicClient(),o=new Pf({ceramic:n,model:t}),s=i(async(m=r)=>{let y=await o.get(m);if(!y)return{credentials:[]};let b=await U2.spa(y);if(b.success)return b.data;let _=await $2.spa(y);if(_.success){let O={credentials:_.data.credentials.map(B=>{if("uri"in B)return B;let{title:Z,id:$,storageType:z,...Q}=B;return{...Q,id:Z,uri:`lc:ceramic:${$.replace("ceramic://","")}`}})};return await o.set(r,O),O}throw console.error(b.error),new Error("Invalid credentials list stored in IDX")},"getCredentialsListFromIdx"),c=i(async(m,y)=>{if(!m)throw new Error("Must provide id to remove");y||(y=r);let b=await s(y);return b.credentials=b.credentials.filter(_=>_.id!==m),o.set(y,b)},"removeCredentialFromIdx"),l=i(async m=>(m||(m=r),o.set(m,{credentials:[]})),"removeAllCredentialsFromIdx"),h=i(async m=>{let y=await mc.parseAsync(m);if(!y)throw new Error("record is required");if(!y.uri)throw Error("No URI provided");await e.read.get(y.uri);let b=await s(r),_=b.credentials.findIndex(x=>x.id===y.id);return _>-1?b.credentials[_]=y:b.credentials.push(y),e1(await o.set(r,b))},"addCredentialInIdx"),p=i(async m=>{let y=mc.array().parse(m),b=await s(r);return await Promise.all(y.map(async _=>{await e.read.get(_.uri);let x=b.credentials.findIndex(D=>D.id===_.id);x>-1?b.credentials[x]=_:b.credentials.push(_)})),e1(await o.set(r,b))},"addCredentialsInIdx");return{name:"IDX",displayName:"IDX",description:"Stores a bespoke index of credentials for an individual based on their did",index:{get:async m=>(m.debug?.("learnCard.index.IDX.get"),(await s()).credentials),add:async(m,y)=>{m.debug?.("learnCard.index.IDX.add");try{return await h(y),!0}catch(b){return console.error("Error adding credential with IDX:",b),!1}},addMany:async(m,y)=>{m.debug?.("learnCard.index.IDX.add");try{return await p(y),!0}catch(b){return console.error("Error adding credential with IDX:",b),!1}},update:async m=>(m.debug?.("learnCard.index.IDX.update"),!1),remove:async(m,y)=>{m.debug?.("learnCard.index.IDX.remove");try{return await c(y),!0}catch(b){return console.error("Error removing credential from IDX:",b),!1}},removeAll:async m=>{m.debug?.("learnCard.index.IDX.removeAll");try{return await l(),!0}catch(y){return console.error("Error removing credentials from IDX:",y),!1}}},methods:{getCredentialsListFromIdx:async(m,y=r)=>(await s(y)).credentials,getVerifiableCredentialFromIdx:async(m,y)=>{let _=(await s())?.credentials?.find(O=>O?.id===y),x=m.read.get(_?.uri),D=await h0.safeParseAsync(x);return D.success?D.data:void 0},getVerifiableCredentialsFromIdx:async m=>{let b=(await s())?.credentials?.map(_=>_?.uri)??[];return(await Promise.all(b.map(async _=>m.read.get(_)))).filter(_=>!!_)},addVerifiableCredentialInIdx:async(m,y)=>{let b=mc.parse(y);if(!b)throw new Error("record is required");if(!b.uri)throw Error("No URI provided");await m.read.get(b.uri);let _=await s(r),x=_.credentials.findIndex(D=>D.id===b.id);return x>-1?_.credentials[x]=b:_.credentials.push(b),e1(await o.set(r,_))},removeVerifiableCredentialInIdx:async(m,y)=>c(y),removeAllVerifiableCredentialsInIdx:async()=>l(),getIDXIndex:async()=>o.get(r),setIDXIndex:async(m,y)=>o.set(r,y)}}},"getIDXPlugin");var UV=t1;
845
845
  /*!
846
846
  * The buffer module from node.js, for the browser.
847
847
  *