@learncard/idx-plugin 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/idx-plugin.cjs.development.js +4 -2
- package/dist/idx-plugin.cjs.development.js.map +2 -2
- package/dist/idx-plugin.cjs.production.min.js +2 -2
- package/dist/idx-plugin.cjs.production.min.js.map +2 -2
- package/dist/idx-plugin.esm.js +4 -2
- package/dist/idx-plugin.esm.js.map +2 -2
- package/package.json +3 -3
|
@@ -21,7 +21,7 @@ if (cid) {
|
|
|
21
21
|
`;var Kg={};wn(Kg,{base36:()=>Qi,base36upper:()=>kO});var Qi=Ka({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),kO=Ka({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var p8={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function DO(e){let t=p8[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(DO,"codeByName");function RO(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(RO,"nameByCode");var eo=class{};i(eo,"StreamType");eo.nameByCode=RO;eo.codeByName=DO;var Iv=Hs(np(),1);function cu(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}i(cu,"asUint8Array");function yf(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?cu(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 cu(r)}i(bf,"concat");var Jg={};wn(Jg,{identity:()=>KO});var KO=au({prefix:"\0",name:"identity",encode:e=>c8(e),decode:e=>s8(e)});var Zg={};wn(Zg,{base2:()=>GO});var GO=Nr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Yg={};wn(Yg,{base8:()=>WO});var WO=Nr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Xg={};wn(Xg,{base10:()=>JO});var JO=Ka({prefix:"9",name:"base10",alphabet:"0123456789"});var Qg={};wn(Qg,{base16:()=>ZO,base16upper:()=>YO});var ZO=Nr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),YO=Nr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ev={};wn(ev,{base64:()=>XO,base64pad:()=>QO,base64url:()=>eN,base64urlpad:()=>tN});var XO=Nr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),QO=Nr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),eN=Nr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),tN=Nr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var tv={};wn(tv,{base256emoji:()=>aN});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}"),rN=S8.reduce((e,t,r)=>(e[r]=t,e),[]),nN=S8.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function iN(e){return e.reduce((t,r)=>(t+=rN[r],t),"")}i(iN,"encode");function oN(e){let t=[];for(let r of e){let n=nN[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}i(oN,"decode");var aN=au({prefix:"\u{1F680}",name:"base256emoji",encode:iN,decode:oN});var iv={};wn(iv,{sha256:()=>nv,sha512:()=>sN});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")}),sN=rv({name:"sha2-512",code:19,encode:T8("SHA-512")});var ov={};wn(ov,{identity:()=>lN});var C8=0,cN="identity",M8=la,uN=i(e=>Vs(C8,M8(e)),"digest"),lN={code:C8,name:cN,encode:M8,digest:uN};var AK=new TextEncoder,SK=new TextDecoder;var av={...Jg,...Zg,...Yg,...Xg,...Qg,...Vg,...Kg,...qg,...ev,...tv},MK={...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}),hN={utf8:I8,"utf-8":I8,hex:av.base16,latin1:sv,ascii:sv,binary:sv,...av},cv=hN;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 oi(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(oi,"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"),mN=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 mN(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={};wn(yp,{code:()=>QN,decode:()=>eB,encode:()=>Ev,name:()=>XN});var vN=["string","number","bigint","symbol"],yN=["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(vN.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(bN(e))return"Buffer";let r=wN(e);return r||"Object"}i(O8,"is");function bN(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}i(bN,"isBuffer");function wN(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(yN.includes(t))return t}i(wN,"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 uu=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",_N=new TextDecoder,EN=new TextEncoder;function sp(e){return uu&&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=uu?(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?_N.decode(e.subarray(t,r)):B8(e,t,r),F8=uu?e=>e.length>64?globalThis.Buffer.from(e):N8(e):e=>e.length>64?EN.encode(e):N8(e),Do=i(e=>Uint8Array.from(e),"fromArray"),lu=uu?(e,t,r)=>sp(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),U8=uu?(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=uu?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 AN(n)}i(B8,"utf8Slice");var P8=4096;function AN(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(AN,"decodeCodePointsArray");var SN=256,fu=class{constructor(t=SN){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=lu(n,0,this.cursor)}else r=U8(this.chunks,this.cursor);return t&&this.reset(),r}};i(fu,"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 fa(e,t,r){if(e.length-t<r)throw new Error(`${Mt} not enough data for type`)}i(fa,"assertEnoughData");var Yr=[24,256,65536,4294967296,BigInt("18446744073709551616")];function ai(e,t,r){fa(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(ai,"readUint8");function si(e,t,r){fa(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(si,"readUint16");function ci(e,t,r){fa(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(ci,"readUint32");function ui(e,t,r){fa(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(ui,"readUint64");function z8(e,t,r,n){return new Qe(Ne.uint,ai(e,t+1,n),2)}i(z8,"decodeUint8");function H8(e,t,r,n){return new Qe(Ne.uint,si(e,t+1,n),3)}i(H8,"decodeUint16");function q8(e,t,r,n){return new Qe(Ne.uint,ci(e,t+1,n),5)}i(q8,"decodeUint32");function V8(e,t,r,n){return new Qe(Ne.uint,ui(e,t+1,n),9)}i(V8,"decodeUint64");function Oi(e,t){return an(e,0,t.value)}i(Oi,"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");Oi.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");Oi.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-ai(e,t+1,n),2)}i(K8,"decodeNegint8");function G8(e,t,r,n){return new Qe(Ne.negint,-1-si(e,t+1,n),3)}i(G8,"decodeNegint16");function W8(e,t,r,n){return new Qe(Ne.negint,-1-ci(e,t+1,n),5)}i(W8,"decodeNegint32");var mv=BigInt(-1),J8=BigInt(1);function Z8(e,t,r,n){let o=ui(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){fa(e,t,r+n);let o=lu(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,ai(e,t+1,n))}i(X8,"decodeBytes8");function Q8(e,t,r,n){return _f(e,t,3,si(e,t+1,n))}i(Q8,"decodeBytes16");function eE(e,t,r,n){return _f(e,t,5,ci(e,t+1,n))}i(eE,"decodeBytes32");function tE(e,t,r,n){let o=ui(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 du(e,t){let r=up(t);an(e,t.type.majorEncoded,r.length),e.push(r)}i(du,"encodeBytes");du.encodedSize=i(function(t){let r=up(t);return an.encodedSize(r.length)+r.length},"encodedSize");du.compareTokens=i(function(t,r){return TN(up(t),up(r))},"compareTokens");function TN(e,t){return e.length<t.length?-1:e.length>t.length?1:j8(e,t)}i(TN,"compareBytes");function Ef(e,t,r,n,o){let s=r+n;fa(e,t,s);let c=new Qe(Ne.string,L8(e,t+r,t+s),s);return o.retainStringBytes===!0&&(c.byteValue=lu(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,ai(e,t+1,n),n)}i(nE,"decodeString8");function iE(e,t,r,n){return Ef(e,t,3,si(e,t+1,n),n)}i(iE,"decodeString16");function oE(e,t,r,n){return Ef(e,t,5,ci(e,t+1,n),n)}i(oE,"decodeString32");function aE(e,t,r,n){let o=ui(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=du;function hu(e,t,r,n){return new Qe(Ne.array,n,r)}i(hu,"toToken");function cE(e,t,r,n){return hu(e,t,1,r)}i(cE,"decodeArrayCompact");function uE(e,t,r,n){return hu(e,t,2,ai(e,t+1,n))}i(uE,"decodeArray8");function lE(e,t,r,n){return hu(e,t,3,si(e,t+1,n))}i(lE,"decodeArray16");function fE(e,t,r,n){return hu(e,t,5,ci(e,t+1,n))}i(fE,"decodeArray32");function dE(e,t,r,n){let o=ui(e,t+1,n);if(typeof o=="bigint")throw new Error(`${Mt} 64-bit integer array lengths not supported`);return hu(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 hu(e,t,1,1/0)}i(hE,"decodeArrayIndefinite");function lp(e,t){an(e,Ne.array.majorEncoded,t.value)}i(lp,"encodeArray");lp.compareTokens=Oi.compareTokens;lp.encodedSize=i(function(t){return an.encodedSize(t.value)},"encodedSize");function pu(e,t,r,n){return new Qe(Ne.map,n,r)}i(pu,"toToken");function pE(e,t,r,n){return pu(e,t,1,r)}i(pE,"decodeMapCompact");function mE(e,t,r,n){return pu(e,t,2,ai(e,t+1,n))}i(mE,"decodeMap8");function gE(e,t,r,n){return pu(e,t,3,si(e,t+1,n))}i(gE,"decodeMap16");function vE(e,t,r,n){return pu(e,t,5,ci(e,t+1,n))}i(vE,"decodeMap32");function yE(e,t,r,n){let o=ui(e,t+1,n);if(typeof o=="bigint")throw new Error(`${Mt} 64-bit integer map lengths not supported`);return pu(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 pu(e,t,1,1/0)}i(bE,"decodeMapIndefinite");function fp(e,t){an(e,Ne.map.majorEncoded,t.value)}i(fp,"encodeMap");fp.compareTokens=Oi.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,ai(e,t+1,n),2)}i(_E,"decodeTag8");function EE(e,t,r,n){return new Qe(Ne.tag,si(e,t+1,n),3)}i(EE,"decodeTag16");function AE(e,t,r,n){return new Qe(Ne.tag,ci(e,t+1,n),5)}i(AE,"decodeTag32");function SE(e,t,r,n){return new Qe(Ne.tag,ui(e,t+1,n),9)}i(SE,"decodeTag64");function dp(e,t){an(e,Ne.tag.majorEncoded,t.value)}i(dp,"encodeTag");dp.compareTokens=Oi.compareTokens;dp.encodedSize=i(function(t){return an.encodedSize(t.value)},"encodedSize");var RN=20,ON=21,NN=22,BN=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|RN]);else if(n===!0)e.push([Ne.float.majorEncoded|ON]);else if(n===null)e.push([Ne.float.majorEncoded|NN]);else if(n===void 0)e.push([Ne.float.majorEncoded|BN]);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||(PN(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),Ni=new DataView(kE,1),to=new Uint8Array(kE,0);function DE(e){if(e===1/0)Ni.setUint16(0,31744,!1);else if(e===-1/0)Ni.setUint16(0,64512,!1);else if(Number.isNaN(e))Ni.setUint16(0,32256,!1);else{Ni.setFloat32(0,e);let t=Ni.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Ni.setUint16(0,31744,!1);else if(r===0)Ni.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let o=r-127;o<-24?Ni.setUint16(0,0):o<-14?Ni.setUint16(0,(t&2147483648)>>16|1<<24+o,!1):Ni.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){Ni.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 PN(e){Ni.setFloat64(0,e,!1)}i(PN,"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=Oi.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 Do([244]);case Ne.true:return Do([245]);case Ne.null:return Do([246]);case Ne.bytes:return e.value.length?void 0:Do([64]);case Ne.string:return e.value===""?Do([96]):void 0;case Ne.array:return e.value===0?Do([128]):void 0;case Ne.map:return e.value===0?Do([160]):void 0;case Ne.uint:return e.value<24?Do([Number(e.value)]):void 0;case Ne.negint:if(e.value>=-24)return Do([31-Number(e.value)])}}i(NE,"quickEncodeToken");var FN={float64:!1,mapSorter:jN,quickEncodeToken:NE};function UN(){let e=[];return e[Ne.uint.major]=Oi,e[Ne.negint.major]=cp,e[Ne.bytes.major]=du,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(UN,"makeCborEncoders");var BE=UN(),bv=new fu,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 $N(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 $N(e,t){t.mapSorter&&e.sort(t.mapSorter)}i($N,"sortMapEntries");function jN(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(jN,"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 zN(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 fu(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(zN,"encodeCustom");function wv(e,t){return t=Object.assign({},FN,t),zN(e,BE,t)}i(wv,"encode");var HN={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 qN(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(qN,"tokenToArray");function VN(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(VN,"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 qN(r,e,t);if(r.type===Ne.map)return VN(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({},HN,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 GN(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(GN,"cidEncoder");function WN(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}i(WN,"undefinedEncoder");function JN(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(JN,"numberEncoder");var ZN={float64:!0,typeEncoders:{Object:GN,undefined:WN,number:JN}};function YN(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ut.decode(e.subarray(1))}i(YN,"cidDecoder");var FE={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};FE.tags[LE]=YN;var XN="dag-cbor",QN=113,Ev=i(e=>wv(e,ZN),"encode"),eB=i(e=>_v(e,FE),"decode");function mu(e){try{return e()}catch(t){return t}}i(mu,"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 tB(e){return e===0||e===1}i(tB,"isCidVersion");function Sv(e){let[t,r]=Ws(e);if(!tB(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 rB=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function gu(e,t="StreamRef"){let r=rB.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(gu,"fromString");function nB(e){try{return typeof e=="string"?Ut.parse(e):Ut.asCID(e)}catch{return null}}i(nB,"parseCID");function xv(e,t=null){if(!t||t==="0")return null;let r=nB(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},Bi=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 iB(e){return mu(()=>jE(e))}i(iB,"fromBytesNoThrow");function zE(e){let t=gu(e,"StreamID");if(t.kind==="stream-id")return new Yt(t.type,t.genesis);throw new wp(e)}i(zE,"fromString");function oB(e){return mu(()=>zE(e))}i(oB,"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=iB;Yt.fromString=zE;Yt.fromStringNoThrow=oB;xf([oi(),Bi("design:type",String),Bi("design:paramtypes",[])],Yt.prototype,"typeName",null);xf([oi(),Bi("design:type",Uint8Array),Bi("design:paramtypes",[])],Yt.prototype,"bytes",null);xf([oi(),Bi("design:type",Yt),Bi("design:paramtypes",[])],Yt.prototype,"baseID",null);xf([oi(),Bi("design:type",Function),Bi("design:paramtypes",[]),Bi("design:returntype",String)],Yt.prototype,"toString",null);xf([oi(),Bi("design:type",Function),Bi("design:paramtypes",[]),Bi("design:returntype",String)],Yt.prototype,"toUrl",null);var yu=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},qn=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},da=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)},vu,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 aB(e){return mu(()=>qE(e))}i(aB,"fromBytesNoThrow");function VE(e){let t=gu(e,"CommitID");if(t.kind==="commit-id")return new hr(t.type,t.genesis,t.commit);throw new Ep(e)}i(VE,"fromString");function sB(e){return mu(()=>VE(e))}i(sB,"fromStringNoThrow");var HE=Symbol.for("@ceramicnetwork/streamid/CommitID");function cB(e,t){return new hr(e.type,e.cid,t)}i(cB,"make");var hr=class{constructor(t,r,n=null){if(this._tag=HE,vu.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,vu,typeof t=="string"?eo.codeByName(t):t,"f"),Mv(this,Zs,typeof r=="string"?Ut.parse(r):r,"f"),Mv(this,Tf,xv(da(this,Zs,"f"),n),"f")}static isInstance(t){return typeof t=="object"&&"_tag"in t&&t._tag===HE}get baseID(){return new Yt(da(this,vu,"f"),da(this,Zs,"f"))}get type(){return da(this,vu,"f")}get typeName(){return eo.nameByCode(da(this,vu,"f"))}get cid(){return da(this,Zs,"f")}get commit(){return da(this,Tf,"f")||da(this,Zs,"f")}get bytes(){let t=Iv.default.encode(206),r=Iv.default.encode(this.type),n=da(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()}`}[(vu=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=aB;hr.fromString=VE;hr.fromStringNoThrow=sB;hr.make=cB;yu([oi(),qn("design:type",Yt),qn("design:paramtypes",[])],hr.prototype,"baseID",null);yu([oi(),qn("design:type",String),qn("design:paramtypes",[])],hr.prototype,"typeName",null);yu([oi(),qn("design:type",Ut),qn("design:paramtypes",[])],hr.prototype,"commit",null);yu([oi(),qn("design:type",Uint8Array),qn("design:paramtypes",[])],hr.prototype,"bytes",null);yu([oi(),qn("design:type",Function),qn("design:paramtypes",[]),qn("design:returntype",String)],hr.prototype,"toString",null);yu([oi(),qn("design:type",Function),qn("design:paramtypes",[]),qn("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=gu(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={};wn(kv,{JsonPatchError:()=>Br,_areEquals:()=>If,applyOperation:()=>Xs,applyPatch:()=>kp,applyReducer:()=>hB,deepClone:()=>fB,getValueByPointer:()=>Mp,validate:()=>WE,validator:()=>Ip});var uB=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)}}(),lB=Object.prototype.hasOwnProperty;function xp(e,t){return lB.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 Ro(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}i(Ro,"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){uB(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,fB=sn,bu={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}}},dB={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:bu.move,copy:bu.copy,test:bu.test,_get:bu._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=dB[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=bu[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 hB(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(hB,"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(bu[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={};wn(Nv,{compare:()=>_B,generate:()=>Dv,observe:()=>wB,unobserve:()=>bB});var Rv=new WeakMap,pB=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror"),e}(),mB=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo"),e}();function gB(e){return Rv.get(e)}i(gB,"getMirror");function vB(e,t){return e.observers.get(t)}i(vB,"getObserverFromMirror");function yB(e,t){e.observers.delete(t.callback)}i(yB,"removeObserverFromMirror");function bB(e,t){t.unobserve()}i(bB,"unobserve");function wB(e,t){var r=[],n,o=gB(e);if(!o)o=new pB(e),Rv.set(e,o);else{var s=vB(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),yB(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 mB(t,n)),n}i(wB,"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+"/"+Ro(m),o):y!==b&&(l=!0,o&&r.push({op:"test",path:n+"/"+Ro(m),value:sn(y)}),r.push({op:"replace",path:n+"/"+Ro(m),value:sn(b)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Ro(m),value:sn(y)}),r.push({op:"remove",path:n+"/"+Ro(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+"/"+Ro(m),value:sn(t[m])})}}}i(Ov,"_generate");function _B(e,t,r){r===void 0&&(r=!1);var n=[];return Ov(e,t,n,"",r),n}i(_B,"compare");var JE=Object.assign({},kv,Nv,{JsonPatchError:Mf,deepClone:sn,escapePathComponent:Ro,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 Su(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(Su,"__read");function xu(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(xu,"__spreadArray");function Pi(e){return typeof e=="function"}i(Pi,"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(Pi(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=xu(xu([],Su(s)),Su(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 oJ=Wp.EMPTY;function Jp(e){return e instanceof Wp||e&&"closed"in e&&Pi(e.remove)&&Pi(e.add)&&Pi(e.unsubscribe)}i(Jp,"isSubscription");function e7(e){Pi(e)?e():e.unsubscribe()}i(e7,"execFinalizer");var no={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Tu={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Tu.delegate;return o?.setTimeout?o.setTimeout.apply(o,xu([e,t],Su(r))):setTimeout.apply(void 0,xu([e,t],Su(r)))},clearTimeout:function(e){var t=Tu.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function t7(e){Tu.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=RL,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 IL=Function.prototype.bind;function uy(e,t){return IL.call(e,t)}i(uy,"bind");var kL=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(Pi(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 kL(c),s}return i(t,"SafeSubscriber"),t}(fy);function Zp(e){no.useDeprecatedSynchronousErrorHandling?a7(e):t7(e)}i(Zp,"handleUnhandledError");function DL(e){throw e}i(DL,"defaultErrorHandler");function ly(e,t){var r=no.onStoppedNotification;r&&Tu.setTimeout(function(){return r(e,t)})}i(ly,"handleStoppedNotification");var RL={closed:!0,next:sy,error:DL,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=NL(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 OL(e){return e&&Pi(e.next)&&Pi(e.error)&&Pi(e.complete)}i(OL,"isObserver");function NL(e){return e&&e instanceof fy||OL(e)&&Jp(e)}i(NL,"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 BL=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},fi,my={anchor:!0,publish:!0,pin:!0,sync:rc.PREFER_CACHE},PL={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=fi=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 fi.makeGenesis(s,r,n);return t.createStreamFromGenesis(fi.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 fi._signDagJWS(t,r):r;return t.createStreamFromGenesis(fi.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 fi.makeGenesis(t,null,r);return t.createStreamFromGenesis(fi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...PL,...n};let o=Ys.from(r);if(o.type!=fi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${fi.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 fi._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 fi._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 fi._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=fi=BL([h7()],Za);var S7=Hs(w7(),1);function KL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(KL,"_checkPrivateRedeclaration");function GL(e,t){return t.get?t.get.call(e):t.value}i(GL,"_classApplyDescriptorGet");function WL(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(WL,"_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 GL(e,r)}i(_y,"_classPrivateFieldGet");function _7(e,t,r){KL(e,t),t.set(e,r)}i(_7,"_classPrivateFieldInit");function E7(e,t,r){var n=A7(e,t,"set");return WL(e,n,r),r}i(E7,"_classPrivateFieldSet");function JL(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(JL,"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 ZL=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(ZL,{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(JL),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 YL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(YL,"_checkPrivateRedeclaration");function XL(e,t){return t.get?t.get.call(e):t.value}i(XL,"_classApplyDescriptorGet");function QL(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(QL,"_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 XL(e,r)}i(oc,"_classPrivateFieldGet");function x7(e,t,r){YL(e,t),t.set(e,r)}i(x7,"_classPrivateFieldInit");function xy(e,t,r){var n=T7(e,t,"set");return QL(e,n,r),r}i(xy,"_classPrivateFieldSet");var Cu=new WeakMap,Mu=new WeakMap,Iu=class{get aliases(){return oc(this,Cu)}get loader(){return oc(this,Mu)}getDefinitionID(t){return oc(this,Cu).definitions[t]??null}getSchemaURL(t){return oc(this,Cu).schemas[t]??null}getTileID(t){return oc(this,Cu).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,Mu).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,Mu).create(r,l,c)}constructor(t){if(x7(this,Cu,{writable:!0,value:void 0}),x7(this,Mu,{writable:!0,value:void 0}),xy(this,Cu,t.aliases),t.loader!=null)xy(this,Mu,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");xy(this,Mu,new ic({ceramic:t.ceramic,cache:t.cache}))}}};i(Iu,"DataModel");function eF(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(eF,"_checkPrivateRedeclaration");function tF(e,t){return t.get?t.get.call(e):t.value}i(tF,"_classApplyDescriptorGet");function rF(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(rF,"_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 Oo(e,t){var r=C7(e,t,"get");return tF(e,r)}i(Oo,"_classPrivateFieldGet");function Qp(e,t,r){eF(e,t),t.set(e,r)}i(Qp,"_classPrivateFieldInit");function e0(e,t,r){var n=C7(e,t,"set");return rF(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");Oo(this,ac).push({reject:n,run:o}),Oo(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 Oo(this,ac).length===0?await Oo(this,t0).call(this):await Oo(this,Ty)}async _start(){try{let t=await Oo(this,t0).call(this);this._next(t)}catch(t){Oo(this,ac).forEach(r=>{r.reject(t)}),e0(this,ac,[]),Oo(this,r0).reject(t),this._createValuePromise()}}_next(t){let r=Oo(this,ac).shift();r==null?this._end(t):r.run(t)}_end(t){Oo(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 nF=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function iF(e){return nF.test(e)}i(iF,"isDIDstring");function oF(e){if(!iF(e))throw new Error(`Invalid DID: ${e}`)}i(oF,"assertDIDstring");function Cy(e){return oF(e),{controllers:[e],family:"IDX"}}i(Cy,"getIDXMetadata");function aF(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(aF,"_checkPrivateRedeclaration");function sF(e,t){return t.get?t.get.call(e):t.value}i(sF,"_classApplyDescriptorGet");function cF(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(cF,"_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 sF(e,r)}i(Ur,"_classPrivateFieldGet");function Bf(e,t,r){aF(e,t),t.set(e,r)}i(Bf,"_classPrivateFieldInit");function n0(e,t,r){var n=M7(e,t,"set");return cF(e,n,r),r}i(n0,"_classPrivateFieldSet");var ma=new WeakMap,i0=new WeakMap,My=new WeakMap,No=new WeakMap,o0=new WeakMap,Pf=class{get authenticated(){return Ur(this,ma).did!=null}get ceramic(){return Ur(this,ma)}get id(){if(Ur(this,i0)!=null)return Ur(this,i0);if(Ur(this,ma).did==null)throw new Error("Ceramic instance is not authenticated");return Ur(this,ma).did.hasParent?Ur(this,ma).did.parent:Ur(this,ma).did.id}get loader(){return Ur(this,No)}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,ma).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,No).load(s);return{done:!1,value:{key:o,id:s,record:c.content}}}}}async _createIDXDoc(t){return await Ur(this,No).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,No).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,No).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,No).update(o,r);return[!1,s.id]}}async _createRecord(t,r,{controller:n,pin:o}){let s=await Ur(this,No).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,ma,{writable:!0,value:void 0}),Bf(this,i0,{writable:!0,value:void 0}),Bf(this,My,{writable:!0,value:{}}),Bf(this,No,{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,ma,n),n0(this,i0,o),n0(this,No,s??new ic({ceramic:n,cache:r})),n0(this,o0,c instanceof Iu?c:new Iu({loader:Ur(this,No),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"]),uF=i(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Li=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(Li,"ZodError");Li.create=e=>new Li(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 lF(e){R7=e}i(lF,"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"),fF=[];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"),En=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 di=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(di,"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 Li(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 Kn({schema:this,typeName:xt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return pi.create(this)}nullable(){return Fo.create(this)}nullish(){return this.optional().nullable()}array(){return Vn.create(this)}promise(){return ya.create(this)}or(t){return rs.create([this,t])}and(t){return ns.create(this,t)}transform(t){return new Kn({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 dF=/^c[^\s-]{8,}$/i,hF=/^([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,pF=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,mF=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"),Fi=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 Fi({...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")pF.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")hF.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")dF.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"?mF(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 Fi({...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(Fi,"ZodString");Fi.create=e=>{var t;return new Fi({checks:[],typeName:xt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};function gF(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(gF,"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"?gF(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 En(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 En(t.data)}};i(Qa,"ZodBoolean");Qa.create=e=>new Qa({typeName:xt.ZodBoolean,coerce:e?.coerce||!1,...Vt(e)});var Bo=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 Bo({...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(Bo,"ZodDate");Bo.create=e=>new Bo({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 En(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 En(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 En(t.data)}};i(ts,"ZodNull");ts.create=e=>new ts({typeName:xt.ZodNull,...Vt(e)});var ga=class extends Bt{constructor(){super(...arguments),this._any=!0}_parse(t){return En(t.data)}};i(ga,"ZodAny");ga.create=e=>new ga({typeName:xt.ZodAny,...Vt(e)});var Po=class extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return En(t.data)}};i(Po,"ZodUnknown");Po.create=e=>new Po({typeName:xt.ZodUnknown,...Vt(e)});var Ui=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(Ui,"ZodNever");Ui.create=e=>new Ui({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 En(t.data)}};i(cc,"ZodVoid");cc.create=e=>new cc({typeName:xt.ZodVoid,...Vt(e)});var Vn=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 di(r,c,r.path,l)))).then(c=>Xr.mergeArray(n,c));let s=r.data.map((c,l)=>o.type._parseSync(new di(r,c,r.path,l)));return Xr.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new Vn({...this._def,minLength:{value:t,message:Wt.toString(r)}})}max(t,r){return new Vn({...this._def,maxLength:{value:t,message:Wt.toString(r)}})}length(t,r){return new Vn({...this._def,exactLength:{value:t,message:Wt.toString(r)}})}nonempty(t){return this.min(1,t)}};i(Vn,"ZodArray");Vn.create=(e,t)=>new Vn({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 ku(e){if(e instanceof wr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=pi.create(ku(n))}return new wr({...e._def,shape:()=>t})}else return e instanceof Vn?Vn.create(ku(e.element)):e instanceof pi?pi.create(ku(e.unwrap())):e instanceof Fo?Fo.create(ku(e.unwrap())):e instanceof hi?hi.create(e.items.map(t=>ku(t))):e}i(ku,"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 Ui&&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 di(o,y,o.path,p)),alwaysSet:p in o.data})}if(this._def.catchall instanceof Ui){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 di(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 ku(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 pi;)s=s._def.innerType;r[n]=s}});else for(let n in this.shape){let s=this.shape[n];for(;s instanceof pi;)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:Ui.create(),typeName:xt.ZodObject,...Vt(t)});wr.strictCreate=(e,t)=>new wr({shape:()=>e,unknownKeys:"strict",catchall:Ui.create(),typeName:xt.ZodObject,...Vt(t)});wr.lazycreate=(e,t)=>new wr({shape:e,unknownKeys:"strip",catchall:Ui.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 Li(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 Li(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 Kn?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 hi=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 di(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 hi({...this._def,rest:t})}};i(hi,"ZodTuple");hi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new hi({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 di(n,l,n.path,l)),value:c._parse(new di(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:Fi.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 di(n,l,n.path,[p,"key"])),value:s._parse(new di(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 Lo=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 di(n,h,n.path,p)));return n.common.async?Promise.all(l).then(h=>c(h)):c(l)}min(t,r){return new Lo({...this._def,minSize:{value:t,message:Wt.toString(r)}})}max(t,r){return new Lo({...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(Lo,"ZodSet");Lo.create=(e,t)=>new Lo({valueType:e,minSize:null,maxSize:null,typeName:xt.ZodSet,...Vt(t)});var va=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 ya?En(async(...l)=>{let h=new Li([]),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})}):En((...l)=>{let h=this._def.args.safeParse(l,s);if(!h.success)throw new Li([n(l,h.error)]);let p=c(...h.data),m=this._def.returns.safeParse(p,s);if(!m.success)throw new Li([o(p,m.error)]);return m.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new va({...this._def,args:hi.create(t).rest(Po.create())})}returns(t){return new va({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new va({args:t||hi.create([]).rest(Po.create()),returns:r||Po.create(),typeName:xt.ZodFunction,...Vt(n)})}};i(va,"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 En(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 En(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 ya=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 En(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(ya,"ZodPromise");ya.create=(e,t)=>new ya({type:e,typeName:xt.ZodPromise,...Vt(t)});var Kn=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(Kn,"ZodEffects");Kn.create=(e,t,r)=>new Kn({schema:e,typeName:xt.ZodEffects,effect:t,...Vt(r)});Kn.createWithPreprocess=(e,t,r)=>new Kn({schema:t,effect:{type:"preprocess",transform:e},typeName:xt.ZodEffects,...Vt(r)});var pi=class extends Bt{_parse(t){return this._getType(t)===tt.undefined?En(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(pi,"ZodOptional");pi.create=(e,t)=>new pi({innerType:e,typeName:xt.ZodOptional,...Vt(t)});var Fo=class extends Bt{_parse(t){return this._getType(t)===tt.null?En(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(Fo,"ZodNullable");Fo.create=(e,t)=>new Fo({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 vF=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?ga.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})}}):ga.create(),"custom"),yF={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 bF=i((e,t={message:`Input not instance of ${e.name}`})=>B7(r=>r instanceof e,t,!0),"instanceOfType"),P7=Fi.create,L7=io.create,wF=dc.create,_F=Xa.create,F7=Qa.create,EF=Bo.create,AF=sc.create,SF=es.create,xF=ts.create,TF=ga.create,CF=Po.create,MF=Ui.create,IF=cc.create,kF=Vn.create,DF=wr.create,RF=wr.strictCreate,OF=rs.create,NF=uc.create,BF=ns.create,PF=hi.create,LF=is.create,FF=lc.create,UF=Lo.create,$F=va.create,jF=os.create,zF=as.create,HF=ss.create,qF=cs.create,VF=ya.create,D7=Kn.create,KF=pi.create,GF=Fo.create,WF=Kn.createWithPreprocess,JF=ls.create,ZF=i(()=>P7().optional(),"ostring"),YF=i(()=>L7().optional(),"onumber"),XF=i(()=>F7().optional(),"oboolean"),QF={string:e=>Fi.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=>Bo.create({...e,coerce:!0})},eU=kt,J=Object.freeze({__proto__:null,defaultErrorMap:Ff,setErrorMap:lF,getErrorMap:s0,makeIssue:c0,EMPTY_PATH:fF,addIssueToContext:vt,ParseStatus:Xr,INVALID:kt,DIRTY:O7,OK:En,isAborted:Iy,isDirty:ky,isValid:u0,isAsync:l0,get util(){return rr},ZodParsedType:tt,getParsedType:Ya,ZodType:Bt,ZodString:Fi,ZodNumber:io,ZodBigInt:Xa,ZodBoolean:Qa,ZodDate:Bo,ZodSymbol:sc,ZodUndefined:es,ZodNull:ts,ZodAny:ga,ZodUnknown:Po,ZodNever:Ui,ZodVoid:cc,ZodArray:Vn,get objectUtil(){return f0},ZodObject:wr,ZodUnion:rs,ZodDiscriminatedUnion:uc,ZodIntersection:ns,ZodTuple:hi,ZodRecord:is,ZodMap:lc,ZodSet:Lo,ZodFunction:va,ZodLazy:os,ZodLiteral:as,ZodEnum:ss,ZodNativeEnum:cs,ZodPromise:ya,ZodEffects:Kn,ZodTransformer:Kn,ZodOptional:pi,ZodNullable:Fo,ZodDefault:us,ZodCatch:fc,ZodNaN:dc,BRAND:vF,ZodBranded:Lf,ZodPipeline:ls,custom:B7,Schema:Bt,ZodSchema:Bt,late:yF,get ZodFirstPartyTypeKind(){return xt},coerce:QF,any:TF,array:kF,bigint:_F,boolean:F7,date:EF,discriminatedUnion:NF,effect:D7,enum:HF,function:$F,instanceof:bF,intersection:BF,lazy:jF,literal:zF,map:FF,nan:wF,nativeEnum:qF,never:MF,null:xF,nullable:GF,number:L7,object:DF,oboolean:XF,onumber:YF,optional:KF,ostring:ZF,pipeline:JF,preprocess:WF,promise:VF,record:LF,set:UF,strictObject:RF,string:P7,symbol:AF,transformer:D7,tuple:PF,undefined:SF,union:OF,unknown:CF,void:IF,NEVER:eU,ZodIssueCode:Ke,quotelessJson:uF,ZodError:Li});var tU=Object.defineProperty,rU=i((e,t)=>tU(e,"name",{value:t,configurable:!0}),"__name"),p0=J.array(J.string().or(J.record(J.any()))),mZ=J.object({type:J.string().optional(),narrative:J.string().optional()}),m0=J.string().or(J.object({id:J.string(),type:J.string(),caption:J.string().optional()})),nU=J.object({type:J.string().min(1).or(J.string().array().nonempty()),latitude:J.number(),longitude:J.number()}),iU=J.object({type:J.string().min(1).or(J.string().array().nonempty()),addressCountry:J.string().optional(),addressCountryCode:J.string().optional(),addressRegion:J.string().optional(),addressLocality:J.string().optional(),streetAddress:J.string().optional(),postOfficeBoxNumber:J.string().optional(),postalCode:J.string().optional(),geo:nU.optional()}),oU=J.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(J.string()),j7=J.object({type:J.string().min(1).or(J.string().array().nonempty()),identifier:J.string(),identifierType:oU}),Uf=J.string().or(J.object({id:J.string().optional(),type:J.string().or(J.string().array().nonempty().optional()),name:J.string().optional(),url:J.string().optional(),phone:J.string().optional(),description:J.string().optional(),endorsement:J.any().array().optional(),image:m0.optional(),email:J.string().email().optional(),address:iU.optional(),otherIdentifier:j7.array().optional(),official:J.string().optional(),parentOrg:J.any().optional(),familyName:J.string().optional(),givenName:J.string().optional(),additionalName:J.string().optional(),patronymicName:J.string().optional(),honorificPrefix:J.string().optional(),honorificSuffix:J.string().optional(),familyNamePrefix:J.string().optional(),dateOfBirth:J.string().optional()}).catchall(J.any())),Ry=J.object({id:J.string().optional()}).catchall(J.any()),aU=J.object({type:J.string(),id:J.string()}).catchall(J.any()),sU=J.object({id:J.string(),type:J.string()}).catchall(J.any()),cU=J.object({id:J.string(),type:J.string()}).catchall(J.any()),d0=J.object({"@context":p0,id:J.string().optional(),type:J.string().array().nonempty(),issuer:Uf,issuanceDate:J.string(),expirationDate:J.string().optional(),credentialSubject:Ry.or(Ry.array()),credentialStatus:aU.optional(),credentialSchema:sU.array().optional(),refreshService:cU.optional()}).catchall(J.any()),Uo=J.object({type:J.string(),created:J.string(),challenge:J.string().optional(),domain:J.string().optional(),nonce:J.string().optional(),proofPurpose:J.string(),verificationMethod:J.string(),jws:J.string().optional()}).catchall(J.any()),h0=d0.extend({proof:Uo.or(Uo.array())}),uU=J.object({"@context":p0,id:J.string().optional(),type:J.string().or(J.string().array().nonempty()),verifiableCredential:h0.or(h0.array()).optional(),holder:J.string().optional()}).catchall(J.any()),gZ=uU.extend({proof:Uo.or(Uo.array())}),z7=J.object({kty:J.string(),crv:J.string(),x:J.string(),y:J.string().optional(),n:J.string().optional(),d:J.string()}),lU=J.object({alg:J.string(),iv:J.string(),tag:J.string(),epk:z7.partial().optional(),kid:J.string().optional(),apv:J.string().optional(),apu:J.string().optional()}),fU=J.object({header:lU,encrypted_key:J.string()}),dU=J.object({protected:J.string(),iv:J.string(),ciphertext:J.string(),tag:J.string(),aad:J.string().optional(),recipients:fU.array().optional()}),hc=J.string().or(J.object({"@context":p0.optional(),id:J.string(),type:J.string(),controller:J.string(),publicKeyJwk:z7.optional(),publicKeyBase58:J.string().optional(),blockChainAccountId:J.string().optional()}).catchall(J.any())),hU=J.object({id:J.string(),type:J.string().or(J.string().array().nonempty()),serviceEndpoint:J.any().or(J.any().array().nonempty())}).catchall(J.any()),bZ=J.object({"@context":p0,id:J.string(),alsoKnownAs:J.string().optional(),controller:J.string().or(J.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:hU.array().optional(),proof:Uo.or(Uo.array()).optional()}).catchall(J.any()),pU=J.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(J.string()),g0=J.object({type:J.string().array().nonempty(),targetCode:J.string().optional(),targetDescription:J.string().optional(),targetName:J.string(),targetFramework:J.string().optional(),targetType:pU.optional(),targetUrl:J.string()}),mU=J.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"]),gU=mU.or(J.string()),vU=J.object({id:J.string().optional(),narrative:J.string().optional()}).catchall(J.any()),yU=J.object({id:J.string(),type:J.string().array().nonempty(),endorsementComment:J.string().optional()}),bU=d0.extend({credentialSubject:yU,proof:Uo.or(Uo.array()).optional()}),wU=J.object({id:J.string(),"@language":J.string().optional(),version:J.string().optional()}),_U=J.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(J.string()),EU=J.object({id:J.string(),type:J.string().array().nonempty(),alignment:g0.array().optional(),description:J.string().optional(),level:J.string().optional(),name:J.string(),points:J.string().optional()}).catchall(J.any()),AU=J.object({id:J.string(),type:J.string().array().nonempty(),alignment:g0.array().optional(),allowedValue:J.string().array().optional(),name:J.string(),requiredLevel:J.string().optional(),requiredValue:J.string().optional(),resultType:_U,rubricCriterionLevel:EU.array().optional(),valueMax:J.string().optional(),valueMin:J.string().optional()}).catchall(J.any()),SU=J.object({id:J.string().optional(),type:J.string().array().nonempty(),alignment:g0.array().optional(),achievementType:gU.optional(),creator:Uf.optional(),creditsAvailable:J.number().optional(),criteria:vU,description:J.string(),endorsement:bU.array().optional(),fieldOfStudy:J.string().optional(),humanCode:J.string().optional(),image:m0.optional(),"@language":J.string().optional(),name:J.string(),otherIdentifier:j7.array().optional(),related:wU.array().optional(),resultDescription:AU.array().optional(),specialization:J.string().optional(),tag:J.string().array().optional(),version:J.string().optional()}).catchall(J.any()),xU=J.object({type:J.string(),hashed:J.boolean(),identityHash:J.string(),identityType:J.string(),salt:J.string().optional()}),TU=J.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),CU=J.object({type:J.string().array().nonempty(),achievedLevel:J.string().optional(),alignment:g0.array().optional(),resultDescription:J.string().optional(),status:TU.optional(),value:J.string().optional()}).catchall(J.any()),U7=J.object({id:J.string().optional(),type:J.string().array().nonempty(),activityEndDate:J.string().optional(),activityStartDate:J.string().optional(),creditsEarned:J.number().optional(),achievement:SU.optional(),identifier:xU.array().optional(),image:m0.optional(),licenseNumber:J.string().optional(),narrative:J.string().optional(),result:CU.array().optional(),role:J.string().optional(),source:Uf.optional(),term:J.string().optional()}).catchall(J.any()),MU=J.object({id:J.string().optional(),type:J.string().array().nonempty(),narrative:J.string().optional(),name:J.string().optional(),description:J.string().optional(),genre:J.string().optional(),audience:J.string().optional()}).catchall(J.any()),IU=d0.extend({name:J.string().optional(),description:J.string().optional(),image:m0.optional(),credentialSubject:U7.or(U7.array()),endorsement:d0.array().optional(),evidence:MU.array().optional()}),_Z=IU.extend({proof:Uo.or(Uo.array())}),AZ=J.object({checks:J.string().array(),warnings:J.string().array(),errors:J.string().array()}),H7=J.enum(["Success","Failed","Error"]),SZ=H7.enum,xZ=J.object({check:J.string(),status:H7,message:J.string().optional(),details:J.string().optional()}),TZ=J.object({title:J.string().optional(),createdAt:J.string().optional(),issuer:Uf.optional(),issuee:Uf.optional(),credentialSubject:Ry.optional()}),pc=J.object({id:J.string(),uri:J.string()}).catchall(J.any()),IZ=J.object({limit:J.number(),cursor:J.string().optional(),sort:J.string().optional()}),ba=J.object({cursor:J.string().optional(),hasMore:J.boolean()}),q7=J.object({encryptedRecord:dU,fields:J.string().array()}).catchall(J.any()),kZ=ba.extend({records:q7.array()}),kU=q7.extend({id:J.string()}),DZ=ba.extend({records:kU.array()}),$7=rU(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),DU=J.instanceof(RegExp).or(J.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}`)}})),$i=J.string().or(J.object({$in:J.string().array()})).or(J.object({$regex:DU})),Du=J.object({profileId:J.string().min(3).max(40),displayName:J.string().default(""),shortBio:J.string().default(""),bio:J.string().default(""),did:J.string(),email:J.string().optional(),image:J.string().optional(),heroImage:J.string().optional(),websiteLink:J.string().optional(),isServiceProfile:J.boolean().default(!1).optional(),type:J.string().optional(),notificationsWebhook:J.string().url().startsWith("http").optional()}),NZ=J.object({profileId:$i,displayName:$i,shortBio:$i,bio:$i,email:$i,websiteLink:$i,isServiceProfile:J.boolean(),type:$i}).partial(),BZ=ba.extend({records:Du.array()}),PZ=J.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),LZ=J.object({uri:J.string(),to:J.string(),from:J.string(),sent:J.string().datetime(),received:J.string().datetime().optional()}),RU=J.object({role:J.string(),canEdit:J.boolean(),canIssue:J.boolean(),canRevoke:J.boolean(),canManagePermissions:J.boolean(),canIssueChildren:J.string(),canCreateChildren:J.string(),canEditChildren:J.string(),canRevokeChildren:J.string(),canManageChildrenPermissions:J.string(),canViewAnalytics:J.boolean()}),Oy=J.enum(["DRAFT","LIVE"]),OU=J.object({uri:J.string(),name:J.string().optional(),type:J.string().optional(),category:J.string().optional(),status:Oy.optional(),autoConnectRecipients:J.boolean().optional(),meta:J.record(J.any()).optional(),claimPermissions:RU.optional()}),FZ=J.object({uri:$i,name:$i,type:$i,category:$i,meta:J.record($i),status:Oy.or(J.object({$in:Oy.array()})),autoConnectRecipients:J.boolean()}).partial(),UZ=ba.extend({records:OU.array()}),NU=J.object({to:Du,from:J.string(),received:J.string().optional()}),$Z=ba.extend({records:NU.array()}),jZ=J.object({endpoint:J.string(),name:J.string(),did:J.string().optional()}),zZ=J.object({ttlSeconds:J.number().optional(),totalUses:J.number().optional()}),BU=J.object({endpoint:J.string()}),HZ=J.object({signingAuthority:BU,relationship:J.object({name:J.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:J.string()})}),PU=J.enum(["live","stale","withdrawn"]),LU=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({categories:J.record(J.object({required:J.boolean()})).default({})}).default({}),personal:J.record(J.object({required:J.boolean()})).default({})}).default({}),write:J.object({credentials:J.object({categories:J.record(J.object({required:J.boolean()})).default({})}).default({}),personal:J.record(J.object({required:J.boolean()})).default({})}).default({})}),V7=J.object({contract:LU,owner:Du,name:J.string(),subtitle:J.string().optional(),description:J.string().optional(),reasonForAccessing:J.string().optional(),image:J.string().optional(),uri:J.string(),createdAt:J.string(),updatedAt:J.string(),expiresAt:J.string().optional()}),qZ=ba.extend({records:V7.omit({owner:!0}).array()}),FU=J.object({credentials:J.object({categories:J.record(J.string().array()).default({})}),personal:J.record(J.string()).default({}),date:J.string()}),VZ=ba.extend({records:FU.array()}),K7=J.object({sharing:J.boolean().optional(),shared:J.string().array().optional(),shareAll:J.boolean().optional(),shareUntil:J.string().optional()}),G7=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({shareAll:J.boolean().optional(),sharing:J.boolean().optional(),categories:J.record(K7).default({})}).default({}),personal:J.record(J.string()).default({})}).default({}),write:J.object({credentials:J.object({categories:J.record(J.boolean()).default({})}).default({}),personal:J.record(J.boolean()).default({})}).default({})}),KZ=ba.extend({records:J.object({expiresAt:J.string().optional(),oneTime:J.boolean().optional(),terms:G7,contract:V7,uri:J.string(),consenter:Du,status:PU}).array()}),GZ=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({categories:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),personal:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),write:J.object({credentials:J.object({categories:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),personal:J.record(J.object({required:J.boolean().optional()})).optional()}).optional()}),WZ=J.object({anonymize:J.boolean().optional(),credentials:J.object({categories:J.record(J.boolean()).optional()}).optional(),personal:J.record(J.boolean()).optional()}),UU=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({shareAll:J.boolean().optional(),sharing:J.boolean().optional(),categories:J.record(K7.optional()).optional()}).optional(),personal:J.record(J.string()).optional()}).optional(),write:J.object({credentials:J.object({categories:J.record(J.boolean()).optional()}).optional(),personal:J.record(J.boolean()).optional()}).optional()}),Ny=J.enum(["consent","update","sync","withdraw"]),JZ=J.object({terms:UU.optional(),action:Ny.or(Ny.array()).optional(),date:J.object({$gt:J.string()}).or(J.object({$lt:J.string()})).or(J.object({$eq:J.string()})).optional(),expiresAt:J.object({$gt:J.string()}).or(J.object({$lt:J.string()})).or(J.object({$eq:J.string()})).optional(),oneTime:J.boolean().optional()}),W7=J.object({expiresAt:J.string().optional(),oneTime:J.boolean().optional(),terms:G7.optional(),id:J.string(),action:Ny,date:J.string()}),ZZ=ba.extend({records:W7.array()}),$U=J.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),jU=J.object({title:J.string().optional(),body:J.string().optional()}),zU=J.object({vcUris:J.array(J.string()).optional(),vpUris:J.array(J.string()).optional(),transaction:W7.optional()}),YZ=J.object({type:$U,to:Du.partial().and(J.object({did:J.string()})),from:Du.partial().and(J.object({did:J.string()})),message:jU.optional(),data:zU.optional(),sent:J.string().datetime().optional()});var HU=Object.create,yd=Object.defineProperty,qU=Object.getOwnPropertyDescriptor,s6=Object.getOwnPropertyNames,VU=Object.getPrototypeOf,KU=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"),dS=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of s6(t))!KU.call(e,o)&&o!==r&&yd(e,o,{get:()=>t[o],enumerable:!(n=qU(t,o))||n.enumerable});return e},"__copyProps"),ir=i((e,t,r)=>(r=e!=null?HU(VU(e)):{},dS(t||!e||!e.__esModule?yd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),By=i(e=>dS(yd({},"__esModule",{value:!0}),e),"__toCommonJS"),GU=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,W=4,$=8,z=16,X=32,Z=64,k=128,q=256,he=512,me=30,we="...",G=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",X],["partialRight",Z],["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]",Y="[object Null]",N="[object Object]",U="[object Promise]",K="[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]/,Sn=/\\(\\)?/g,At=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yt=/\w*$/,fn=/^[-+]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,xn="\\ud800-\\udfff",Ai="\\u0300-\\u036f",Si="\\ufe20-\\ufe2f",xi="\\u20d0-\\u20ff",Bn=Ai+Si+xi,dn="\\u2700-\\u27bf",Xn="a-z\\xdf-\\xf6\\xf8-\\xff",Pn="\\xac\\xb1\\xd7\\xf7",Ti="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ci="\\u2000-\\u206f",Mi=" \\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",Xo="A-Z\\xc0-\\xd6\\xd8-\\xde",Qo="\\ufe0e\\ufe0f",ea=Pn+Ti+Ci+Mi,Ba="['\u2019]",Nd="["+xn+"]",wl="["+ea+"]",ks="["+Bn+"]",_l="\\d+",Bd="["+dn+"]",El="["+Xn+"]",Al="[^"+xn+ea+_l+dn+Xn+Xo+"]",Ds="\\ud83c[\\udffb-\\udfff]",Pd="(?:"+ks+"|"+Ds+")",Sl="[^"+xn+"]",ta="(?:\\ud83c[\\udde6-\\uddff]){2}",Wi="[\\ud800-\\udbff][\\udc00-\\udfff]",ra="["+Xo+"]",yo="\\u200d",xl="(?:"+El+"|"+Al+")",Ld="(?:"+ra+"|"+Al+")",Tl="(?:"+Ba+"(?:d|ll|m|re|s|t|ve))?",Cl="(?:"+Ba+"(?:D|LL|M|RE|S|T|VE))?",Ml=Pd+"?",Il="["+Qo+"]?",kl="(?:"+yo+"(?:"+[Sl,ta,Wi].join("|")+")"+Il+Ml+")*",bo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fd="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",jc=Il+Ml+kl,Ud="(?:"+[Bd,ta,Wi].join("|")+")"+jc,Dl="(?:"+[Sl+ks+"?",ks,ta,Wi,Nd].join("|")+")",Rl=RegExp(Ba,"g"),$d=RegExp(ks,"g"),Ol=RegExp(Ds+"(?="+Ds+")|"+Dl+jc,"g"),Nl=RegExp([ra+"?"+El+"+"+Tl+"(?="+[wl,ra,"$"].join("|")+")",Ld+"+"+Cl+"(?="+[wl,ra+xl,"$"].join("|")+")",ra+"?"+xl+"+"+Tl,ra+"+"+Cl,Fd,bo,_l,Ud].join("|"),"g"),jd=RegExp("["+yo+xn+Bn+Qo+"]"),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"],zc=-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={"&":"&","<":"<",">":">",'"':""","'":"'"},Le={"&":"&","<":"<",">":">",""":'"',"'":"'"},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},qr=parseFloat,on=parseInt,Tn=typeof global=="object"&&global&&global.Object===Object&&global,hn=typeof self=="object"&&self&&self.Object===Object&&self,Lr=Tn||hn||Function("return this")(),wo=typeof e=="object"&&e&&!e.nodeType&&e,_o=wo&&typeof t=="object"&&t&&!t.nodeType&&t,Bl=_o&&_o.exports===wo,Hc=Bl&&Tn.process,pn=function(){try{var Se=_o&&_o.require&&_o.require("util").types;return Se||Hc&&Hc.binding&&Hc.binding("util")}catch{}}(),Os=pn&&pn.isArrayBuffer,j2=pn&&pn.isDate,z2=pn&&pn.isMap,H2=pn&&pn.isRegExp,q2=pn&&pn.isSet,V2=pn&&pn.isTypedArray;function Ln(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(Ln,"apply"),a(Ln,"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 Qn(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft&&Be(Se[ke],ke,Se)!==!1;);return Se}i(Qn,"arrayEach"),a(Qn,"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 na(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(na,"arrayFilter"),a(na,"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 ia(Se,Be){for(var ke=-1,ft=Be.length,It=Se.length;++ke<ft;)Se[It+ke]=Be[ke];return Se}i(ia,"arrayPush"),a(ia,"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 Gk=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 Fn(Se){return function(Be){return Se(Be)}}i(Fn,"baseUnary"),a(Fn,"baseUnary");function Zd(Se,Be){return Tr(Be,function(ke){return Se[ke]})}i(Zd,"baseValues"),a(Zd,"baseValues");function qc(Se,Be){return Se.has(Be)}i(qc,"cacheHas"),a(qc,"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 Wk=Gd(de),Jk=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 oa(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(oa,"replaceHolders"),a(oa,"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):Gk(Se)}i(Ps,"stringSize"),a(Ps,"stringSize");function Ii(Se){return Bs(Se)?u3(Se):J2(Se)}i(Ii,"stringToArray"),a(Ii,"stringToArray");function f1(Se){for(var Be=Se.length;Be--&&sr.test(Se.charAt(Be)););return Be}i(f1,"trimmedEndIndex"),a(f1,"trimmedEndIndex");var Zk=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 Yk=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,Xk=Be.String,ki=Be.TypeError,Xd=ke.prototype,Qk=fr.prototype,Vc=br.prototype,Qd=Be["__core-js_shared__"],eh=Qk.toString,gr=Vc.hasOwnProperty,eD=0,f3=function(){var u=/[^.]+$/.exec(Qd&&Qd.keys&&Qd.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),th=Vc.toString,tD=eh.call(br),rD=Lr._,nD=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=Vc.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{}}(),iD=Be.clearTimeout!==Lr.clearTimeout&&Be.clearTimeout,oD=ft&&ft.now!==Lr.Date.now&&ft.now,aD=Be.setTimeout!==Lr.setTimeout&&Be.setTimeout,sh=Kr.ceil,ch=Kr.floor,h1=br.getOwnPropertySymbols,sD=rh?rh.isBuffer:r,g3=Be.isFinite,cD=Xd.join,uD=l1(br.keys,br),Gr=Kr.max,mn=Kr.min,lD=ft.now,fD=Be.parseInt,v3=Kr.random,dD=Xd.reverse,p1=Ha(Be,"DataView"),$l=Ha(Be,"Map"),m1=Ha(Be,"Promise"),Kc=Ha(Be,"Set"),jl=Ha(Be,"WeakMap"),zl=Ha(br,"create"),uh=jl&&new jl,Gc={},hD=qa(p1),pD=qa($l),mD=qa(m1),gD=qa(Kc),vD=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 ei)return u;if(gr.call(u,"__wrapped__"))return hg(u)}return new ei(u)}i(se,"lodash"),a(se,"lodash");var Wc=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 ei(u,d){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!d,this.__index__=0,this.__values__=r}i(ei,"LodashWrapper"),a(ei,"LodashWrapper"),se.templateSettings={escape:lr,evaluate:lt,interpolate:nt,variable:"",imports:{_:se}},se.prototype=ql.prototype,se.prototype.constructor=se,ei.prototype=Wc(ql.prototype),ei.prototype.constructor=ei;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__=Cn(this.__actions__),u.__dir__=this.__dir__,u.__filtered__=this.__filtered__,u.__iteratees__=Cn(this.__iteratees__),u.__takeCount__=this.__takeCount__,u.__views__=Cn(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=mn(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,jn=Ht.type,bn=Gt(_t);if(jn==g)_t=bn;else if(!bn){if(jn==T)continue e;break e}}St[Ye++]=_t}return St}i(_3,"lazyValue"),a(_3,"lazyValue"),Kt.prototype=Wc(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 Eo(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(Eo,"ListCache"),a(Eo,"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"),Eo.prototype.clear=C3,Eo.prototype.delete=M3,Eo.prototype.get=I3,Eo.prototype.has=k3,Eo.prototype.set=D3;function Ao(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(Ao,"MapCache"),a(Ao,"MapCache");function R3(){this.size=0,this.__data__={hash:new Fa,map:new($l||Eo),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"),Ao.prototype.clear=R3,Ao.prototype.delete=O3,Ao.prototype.get=N3,Ao.prototype.has=B3,Ao.prototype.set=P3;function Ua(u){var d=-1,S=u==null?0:u.length;for(this.__data__=new Ao;++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 Di(u){var d=this.__data__=new Eo(u);this.size=d.size}i(Di,"Stack"),a(Di,"Stack");function U3(){this.__data__=new Eo,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 Eo){var j=S.__data__;if(!$l||j.length<o-1)return j.push([u,d]),this.size=++S.size,this;S=this.__data__=new Ao(j)}return S.set(u,d),this.size=S.size,this}i(H3,"stackSet"),a(H3,"stackSet"),Di.prototype.clear=U3,Di.prototype.delete=$3,Di.prototype.get=j3,Di.prototype.has=z3,Di.prototype.set=H3;function g1(u,d){var S=Ot(u),j=!S&&js(u),te=!S&&!j&&Va(u),ce=!S&&!j&&!te&&nu(u),ye=S||j||te||ce,Ee=ye?Jd(u.length,Xk):[],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")||Co(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(Cn(u),$a(d,0,u.length))}i(q3,"arraySampleSize"),a(q3,"arraySampleSize");function V3(u){return af(Cn(u))}i(V3,"arrayShuffle"),a(V3,"arrayShuffle");function fh(u,d,S){(S!==r&&!Ri(u[d],S)||S===r&&!(d in u))&&So(u,d,S)}i(fh,"assignMergeValue"),a(fh,"assignMergeValue");function Jc(u,d,S){var j=u[d];(!(gr.call(u,d)&&Ri(j,S))||S===r&&!(d in u))&&So(u,d,S)}i(Jc,"assignValue"),a(Jc,"assignValue");function Vl(u,d){for(var S=u.length;S--;)if(Ri(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,In(d),u)}i(G3,"baseAssignIn"),a(G3,"baseAssignIn");function So(u,d,S){d=="__proto__"&&ah?ah(u,d,{configurable:!0,enumerable:!0,value:S,writable:!0}):u[d]=S}i(So,"baseAssignValue"),a(So,"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 ti(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 Cn(u,ye)}else{var je=vn(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 Di);var pt=ce.get(u);if(pt)return pt;ce.set(u,ye),N4(u)?u.forEach(function(_t){ye.add(ti(_t,d,S,_t,u,ce))}):T4(u)&&u.forEach(function(_t,Ht){ye.set(Ht,ti(_t,d,S,Ht,u,ce))});var St=Fe?xe?Dh:kh:xe?In:Wr,Lt=Ue?r:St(u);return Qn(Lt||u,function(_t,Ht){Lt&&(Ht=_t,_t=u[Ht]),Jc(ye,Ht,ti(_t,d,S,Ht,u,ce))}),ye}i(ti,"baseClone"),a(ti,"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 ki(c);return of(function(){u.apply(r,S)},d)}i(w1,"baseDelay"),a(w1,"baseDelay");function Zc(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,Fn(S))),j?(ce=Hd,ye=!1):d.length>=o&&(ce=qc,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(Zc,"baseDifference"),a(Zc,"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&&!$n(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):ia(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 na(d,function(S){return Mo(u[S])})}i(Gl,"baseFunctions"),a(Gl,"baseFunctions");function za(u,d){d=sa(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:ia(j,S(u))}i(A1,"baseGetAllKeys"),a(A1,"baseGetAllKeys");function gn(u){return u==null?u===r?De:Y:Ls&&Ls in br(u)?O5(u):K5(u)}i(gn,"baseGetTag"),a(gn,"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>=mn(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,Fn(d))),xe=mn(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?qc(Ye,St):j(Fe,St,S))){for(ye=ce;--ye;){var Lt=Ee[ye];if(!(Lt?qc(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 Yc(u,d,S){d=sa(d,u),u=ug(u,d);var j=u==null?u:u[Yi(ni(d))];return j==null?r:Ln(j,u,S)}i(Yc,"baseInvoke"),a(Yc,"baseInvoke");function S1(u){return kr(u)&&gn(u)==F}i(S1,"baseIsArguments"),a(S1,"baseIsArguments");function n5(u){return kr(u)&&gn(u)==qe}i(n5,"baseIsArrayBuffer"),a(n5,"baseIsArrayBuffer");function i5(u){return kr(u)&&gn(u)==ae}i(i5,"baseIsDate"),a(i5,"baseIsDate");function Xc(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,Xc,te)}i(Xc,"baseIsEqual"),a(Xc,"baseIsEqual");function o5(u,d,S,j,te,ce){var ye=Ot(u),Ee=Ot(d),xe=ye?ge:vn(u),Fe=Ee?ge:vn(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 Di),ye||nu(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 Di),te(Lt,_t,S,j,ce)}}return Ye?(ce||(ce=new Di),R5(u,d,S,j,te,ce)):!1}i(o5,"baseIsEqualDeep"),a(o5,"baseIsEqualDeep");function a5(u){return kr(u)&&vn(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 Di;if(j)var Ye=j(Fe,Ue,xe,u,d,je);if(!(Ye===r?Xc(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=Mo(u)?nD:tr;return d.test(qa(u))}i(x1,"baseIsNative"),a(x1,"baseIsNative");function s5(u){return kr(u)&&gn(u)==ie}i(s5,"baseIsRegExp"),a(s5,"baseIsRegExp");function c5(u){return kr(u)&&vn(u)==ee}i(c5,"baseIsSet"),a(c5,"baseIsSet");function u5(u){return kr(u)&&ff(u.length)&&!!yr[gn(u)]}i(u5,"baseIsTypedArray"),a(u5,"baseIsTypedArray");function T1(u){return typeof u=="function"?u:u==null?kn:typeof u=="object"?Ot(u)?I1(u[0],u[1]):M1(u):jg(u)}i(T1,"baseIteratee"),a(T1,"baseIteratee");function vh(u){if(!tu(u))return uD(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=tu(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=Mn(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):Xc(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 Di),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)}},In)}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&&nu(xe);Ue=xe,Ye||pt||St?Ot(Ee)?Ue=Ee:Or(Ee)?Ue=Cn(Ee):pt?(je=!1,Ue=U1(xe,!0)):St?(je=!1,Ue=$1(xe,!0)):Ue=[]:ru(xe)||js(xe)?(Ue=Ee,js(Ee)?Ue=Bg(Ee):(!Mr(Ee)||Mo(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,Co(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=[kn];var j=-1;d=Tr(d,Fn(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)&&Qc(ce,sa(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=Cn(d)),S&&(Ee=Tr(u,Fn(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;Co(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,kn),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 Qc(u,d,S,j){if(!Mr(u))return u;d=sa(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:Co(d[te+1])?[]:{})}Jc(Ee,xe,Fe),Ee=Ee[xe]}return u}i(Qc,"baseSet"),a(Qc,"baseSet");var v5=uh?function(u,d){return uh.set(u,d),u}:kn,yD=ah?function(u,d){return ah(u,"toString",{configurable:!0,enumerable:!1,value:Hh(d),writable:!0})}:kn;function y5(u){return af(zs(u))}i(y5,"baseShuffle"),a(y5,"baseShuffle");function ri(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(ri,"baseSlice"),a(ri,"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&&!$n(ye)&&(S?ye<=d:ye<d)?j=ce+1:te=ce}return te}return Eh(u,d,kn,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=$n(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=$n(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 mn(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||!Ri(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:$n(u)?C:+u}i(B1,"baseToNumber"),a(B1,"baseToNumber");function Un(u){if(typeof u=="string")return u;if(Ot(u))return Tr(u,Un)+"";if($n(u))return y3?y3.call(u):"";var d=u+"";return d=="0"&&1/u==-v?"-0":d}i(Un,"baseToString"),a(Un,"baseToString");function aa(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:wD(u);if(Fe)return Fl(Fe);ye=!1,te=qc,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(aa,"baseUniq"),a(aa,"baseUniq");function Ah(u,d){return d=sa(d,u),u=ug(u,d),u==null||delete u[Yi(ni(d))]}i(Ah,"baseUnset"),a(Ah,"baseUnset");function P1(u,d,S,j){return Qc(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?ri(u,j?0:ce,j?ce+1:te):ri(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,ia([j],te.args))},S)}i(L1,"baseWrapperValue"),a(L1,"baseWrapperValue");function Sh(u,d,S){var j=u.length;if(j<2)return j?aa(u[0]):[];for(var te=-1,ce=ke(j);++te<j;)for(var ye=u[te],Ee=-1;++Ee<j;)Ee!=te&&(ce[te]=Zc(ce[te]||ye,u[Ee],d,S));return aa(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:kn}i(Th,"castFunction"),a(Th,"castFunction");function sa(u,d){return Ot(u)?u:Oh(u,d)?[u]:J5(dr(u))}i(sa,"castPath"),a(sa,"castPath");var bD=Ft;function ca(u,d,S){var j=u.length;return S=S===r?j:S,!d&&S>=j?u:ri(u,d,S)}i(ca,"castSlice"),a(ca,"castSlice");var w5=iD||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=$n(u),ye=d!==r,Ee=d===null,xe=d===d,Fe=$n(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 Cn(u,d){var S=-1,j=u.length;for(d||(d=ke(j));++S<j;)d[S]=u[S];return d}i(Cn,"copyArray"),a(Cn,"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?So(S,Ee,xe):Jc(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&&yn(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(!Mn(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=eu(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)?Ii(d):r,j=S?S[0]:d.charAt(0),te=S?ca(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 eu(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=Wc(u.prototype),j=u.apply(S,d);return Mr(j)?j:S}}i(eu,"createCtor"),a(eu,"createCtor");function M5(u,d,S){var j=eu(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?[]:oa(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 Ln(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(!Mn(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 To(function(d){var S=d.length,j=S,te=ei.prototype.thru;for(u&&d.reverse();j--;){var ce=d[j];if(typeof ce!="function")throw new ki(c);if(te&&!ye&&rf(ce)=="wrapper")var ye=new ei([],!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|$|X|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:eu(u);function _t(){for(var Ht=arguments.length,Gt=ke(Ht),jn=Ht;jn--;)Gt[jn]=arguments[jn];if(pt)var bn=$s(_t),zn=e3(Gt,bn);if(j&&(Gt=z1(Gt,j,te,pt)),ce&&(Gt=H1(Gt,ce,ye,pt)),Ht-=zn,pt&&Ht<Fe){var Fr=oa(Gt,bn);return Y1(u,d,Xl,_t.placeholder,S,Gt,Fr,Ee,xe,Fe-Ht)}var Xi=je?S:this,ua=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&&(ua=Lt||eu(ua)),ua.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=Un(S),j=Un(j)):(S=B1(S),j=B1(j)),te=u(S,j)}return te}}i(Ql,"createMathOperation"),a(Ql,"createMathOperation");function Mh(u){return To(function(d){return d=Tr(d,Fn(wt())),Ft(function(S){var j=this;return u(d,function(te){return Ln(te,j,S)})})})}i(Mh,"createOver"),a(Mh,"createOver");function ef(u,d){d=d===r?" ":Un(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)?ca(Ii(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=eu(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 Ln(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"&&yn(d,S,j)&&(S=j=r),d=Io(d),S===r?(S=d,d=0):S=Io(S),j=j===r?d<S?1:-1:Io(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=ii(d),S=ii(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?X:Z,d&=~(Ue?Z:X),d&W||(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=ii(S),j=j==null?0:mn(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 wD=Kc&&1/Fl(new Kc([,-0]))[1]==v?function(u){return new Kc(u)}:Kh;function X1(u){return function(d){var S=vn(d);return S==be?Yd(d):S==ee?o3(d):Q2(d,u(d))}}i(X1,"createToPairs"),a(X1,"createToPairs");function xo(u,d,S,j,te,ce,ye,Ee){var xe=d&B;if(!xe&&typeof u!="function")throw new ki(c);var Fe=j?j.length:0;if(Fe||(d&=~(X|Z),j=te=r),ye=ye===r?ye:Gr(Nt(ye),0),Ee=Ee===r?Ee:Nt(Ee),Fe-=te?te.length:0,d&Z){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==X||d==(O|X))&&!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(xo,"createWrap"),a(xo,"createWrap");function Q1(u,d,S,j){return u===r||Ri(u,Vc[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 ru(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(!qc(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 Ri(+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 jn=ye?j(Gt,Ht,Ye,d,u,ce):j(Ht,Gt,Ye,u,d,ce);if(!(jn===r?Ht===Gt||te(Ht,Gt,S,j,ce):jn)){Lt=!1;break}_t||(_t=Ye=="constructor")}if(Lt&&!_t){var bn=u.constructor,zn=d.constructor;bn!=zn&&"constructor"in u&&"constructor"in d&&!(typeof bn=="function"&&bn instanceof bn&&typeof zn=="function"&&zn instanceof zn)&&(Lt=!1)}return ce.delete(u),ce.delete(d),Lt}i(R5,"equalObjects"),a(R5,"equalObjects");function To(u){return lg(cg(u,r,gg),u+"")}i(To,"flatRest"),a(To,"flatRest");function kh(u){return A1(u,Wr,ng)}i(kh,"getAllKeys"),a(kh,"getAllKeys");function Dh(u){return A1(u,In,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=Gc[d],j=gr.call(Gc,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),na(h1(u),function(d){return p3.call(u,d)}))}:Gh,N5=h1?function(u){for(var d=[];u;)ia(d,ng(u)),u=ih(u);return d}:Gh,vn=gn;(p1&&vn(new p1(new ArrayBuffer(1)))!=ve||$l&&vn(new $l)!=be||m1&&vn(m1.resolve())!=U||Kc&&vn(new Kc)!=ee||jl&&vn(new jl)!=Ie)&&(vn=a(function(u){var d=gn(u),S=d==N?u.constructor:r,j=S?qa(S):"";if(j)switch(j){case hD:return ve;case pD:return be;case mD:return U;case gD:return ee;case vD: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=mn(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=sa(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)&&Co(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"&&!tu(u)?Wc(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(Pi(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=xu(xu([],Su(s)),Su(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 oJ=Wp.EMPTY;function Jp(e){return e instanceof Wp||e&&"closed"in e&&Pi(e.remove)&&Pi(e.add)&&Pi(e.unsubscribe)}i(Jp,"isSubscription");function e7(e){Pi(e)?e():e.unsubscribe()}i(e7,"execFinalizer");var no={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Tu={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=Tu.delegate;return o?.setTimeout?o.setTimeout.apply(o,xu([e,t],Su(r))):setTimeout.apply(void 0,xu([e,t],Su(r)))},clearTimeout:function(e){var t=Tu.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function t7(e){Tu.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=RL,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 IL=Function.prototype.bind;function uy(e,t){return IL.call(e,t)}i(uy,"bind");var kL=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(Pi(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 kL(c),s}return i(t,"SafeSubscriber"),t}(fy);function Zp(e){no.useDeprecatedSynchronousErrorHandling?a7(e):t7(e)}i(Zp,"handleUnhandledError");function DL(e){throw e}i(DL,"defaultErrorHandler");function ly(e,t){var r=no.onStoppedNotification;r&&Tu.setTimeout(function(){return r(e,t)})}i(ly,"handleStoppedNotification");var RL={closed:!0,next:sy,error:DL,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=NL(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 OL(e){return e&&Pi(e.next)&&Pi(e.error)&&Pi(e.complete)}i(OL,"isObserver");function NL(e){return e&&e instanceof fy||OL(e)&&Jp(e)}i(NL,"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 BL=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},fi,my={anchor:!0,publish:!0,pin:!0,sync:rc.PREFER_CACHE},PL={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=fi=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 fi.makeGenesis(s,r,n);return t.createStreamFromGenesis(fi.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 fi._signDagJWS(t,r):r;return t.createStreamFromGenesis(fi.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 fi.makeGenesis(t,null,r);return t.createStreamFromGenesis(fi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...PL,...n};let o=Ys.from(r);if(o.type!=fi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${fi.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 fi._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 fi._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 fi._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=fi=BL([h7()],Za);var S7=Hs(w7(),1);function KL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(KL,"_checkPrivateRedeclaration");function GL(e,t){return t.get?t.get.call(e):t.value}i(GL,"_classApplyDescriptorGet");function WL(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(WL,"_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 GL(e,r)}i(_y,"_classPrivateFieldGet");function _7(e,t,r){KL(e,t),t.set(e,r)}i(_7,"_classPrivateFieldInit");function E7(e,t,r){var n=A7(e,t,"set");return WL(e,n,r),r}i(E7,"_classPrivateFieldSet");function JL(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(JL,"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 ZL=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(ZL,{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(JL),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 YL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(YL,"_checkPrivateRedeclaration");function XL(e,t){return t.get?t.get.call(e):t.value}i(XL,"_classApplyDescriptorGet");function QL(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(QL,"_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 XL(e,r)}i(oc,"_classPrivateFieldGet");function x7(e,t,r){YL(e,t),t.set(e,r)}i(x7,"_classPrivateFieldInit");function xy(e,t,r){var n=T7(e,t,"set");return QL(e,n,r),r}i(xy,"_classPrivateFieldSet");var Cu=new WeakMap,Mu=new WeakMap,Iu=class{get aliases(){return oc(this,Cu)}get loader(){return oc(this,Mu)}getDefinitionID(t){return oc(this,Cu).definitions[t]??null}getSchemaURL(t){return oc(this,Cu).schemas[t]??null}getTileID(t){return oc(this,Cu).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,Mu).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,Mu).create(r,l,c)}constructor(t){if(x7(this,Cu,{writable:!0,value:void 0}),x7(this,Mu,{writable:!0,value:void 0}),xy(this,Cu,t.aliases),t.loader!=null)xy(this,Mu,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");xy(this,Mu,new ic({ceramic:t.ceramic,cache:t.cache}))}}};i(Iu,"DataModel");function eF(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(eF,"_checkPrivateRedeclaration");function tF(e,t){return t.get?t.get.call(e):t.value}i(tF,"_classApplyDescriptorGet");function rF(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(rF,"_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 Oo(e,t){var r=C7(e,t,"get");return tF(e,r)}i(Oo,"_classPrivateFieldGet");function Qp(e,t,r){eF(e,t),t.set(e,r)}i(Qp,"_classPrivateFieldInit");function e0(e,t,r){var n=C7(e,t,"set");return rF(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");Oo(this,ac).push({reject:n,run:o}),Oo(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 Oo(this,ac).length===0?await Oo(this,t0).call(this):await Oo(this,Ty)}async _start(){try{let t=await Oo(this,t0).call(this);this._next(t)}catch(t){Oo(this,ac).forEach(r=>{r.reject(t)}),e0(this,ac,[]),Oo(this,r0).reject(t),this._createValuePromise()}}_next(t){let r=Oo(this,ac).shift();r==null?this._end(t):r.run(t)}_end(t){Oo(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 nF=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function iF(e){return nF.test(e)}i(iF,"isDIDstring");function oF(e){if(!iF(e))throw new Error(`Invalid DID: ${e}`)}i(oF,"assertDIDstring");function Cy(e){return oF(e),{controllers:[e],family:"IDX"}}i(Cy,"getIDXMetadata");function aF(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(aF,"_checkPrivateRedeclaration");function sF(e,t){return t.get?t.get.call(e):t.value}i(sF,"_classApplyDescriptorGet");function cF(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(cF,"_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 sF(e,r)}i(Ur,"_classPrivateFieldGet");function Bf(e,t,r){aF(e,t),t.set(e,r)}i(Bf,"_classPrivateFieldInit");function n0(e,t,r){var n=M7(e,t,"set");return cF(e,n,r),r}i(n0,"_classPrivateFieldSet");var ma=new WeakMap,i0=new WeakMap,My=new WeakMap,No=new WeakMap,o0=new WeakMap,Pf=class{get authenticated(){return Ur(this,ma).did!=null}get ceramic(){return Ur(this,ma)}get id(){if(Ur(this,i0)!=null)return Ur(this,i0);if(Ur(this,ma).did==null)throw new Error("Ceramic instance is not authenticated");return Ur(this,ma).did.hasParent?Ur(this,ma).did.parent:Ur(this,ma).did.id}get loader(){return Ur(this,No)}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,ma).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,No).load(s);return{done:!1,value:{key:o,id:s,record:c.content}}}}}async _createIDXDoc(t){return await Ur(this,No).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,No).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,No).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,No).update(o,r);return[!1,s.id]}}async _createRecord(t,r,{controller:n,pin:o}){let s=await Ur(this,No).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,ma,{writable:!0,value:void 0}),Bf(this,i0,{writable:!0,value:void 0}),Bf(this,My,{writable:!0,value:{}}),Bf(this,No,{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,ma,n),n0(this,i0,o),n0(this,No,s??new ic({ceramic:n,cache:r})),n0(this,o0,c instanceof Iu?c:new Iu({loader:Ur(this,No),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"]),uF=i(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Li=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(Li,"ZodError");Li.create=e=>new Li(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 lF(e){R7=e}i(lF,"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"),fF=[];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"),En=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 di=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(di,"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 Li(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 Kn({schema:this,typeName:xt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return pi.create(this)}nullable(){return Fo.create(this)}nullish(){return this.optional().nullable()}array(){return Vn.create(this)}promise(){return ya.create(this)}or(t){return rs.create([this,t])}and(t){return ns.create(this,t)}transform(t){return new Kn({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 dF=/^c[^\s-]{8,}$/i,hF=/^([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,pF=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,mF=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"),Fi=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 Fi({...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")pF.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")hF.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")dF.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"?mF(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 Fi({...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(Fi,"ZodString");Fi.create=e=>{var t;return new Fi({checks:[],typeName:xt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};function gF(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(gF,"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"?gF(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 En(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 En(t.data)}};i(Qa,"ZodBoolean");Qa.create=e=>new Qa({typeName:xt.ZodBoolean,coerce:e?.coerce||!1,...Vt(e)});var Bo=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 Bo({...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(Bo,"ZodDate");Bo.create=e=>new Bo({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 En(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 En(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 En(t.data)}};i(ts,"ZodNull");ts.create=e=>new ts({typeName:xt.ZodNull,...Vt(e)});var ga=class extends Bt{constructor(){super(...arguments),this._any=!0}_parse(t){return En(t.data)}};i(ga,"ZodAny");ga.create=e=>new ga({typeName:xt.ZodAny,...Vt(e)});var Po=class extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return En(t.data)}};i(Po,"ZodUnknown");Po.create=e=>new Po({typeName:xt.ZodUnknown,...Vt(e)});var Ui=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(Ui,"ZodNever");Ui.create=e=>new Ui({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 En(t.data)}};i(cc,"ZodVoid");cc.create=e=>new cc({typeName:xt.ZodVoid,...Vt(e)});var Vn=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 di(r,c,r.path,l)))).then(c=>Xr.mergeArray(n,c));let s=r.data.map((c,l)=>o.type._parseSync(new di(r,c,r.path,l)));return Xr.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new Vn({...this._def,minLength:{value:t,message:Wt.toString(r)}})}max(t,r){return new Vn({...this._def,maxLength:{value:t,message:Wt.toString(r)}})}length(t,r){return new Vn({...this._def,exactLength:{value:t,message:Wt.toString(r)}})}nonempty(t){return this.min(1,t)}};i(Vn,"ZodArray");Vn.create=(e,t)=>new Vn({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 ku(e){if(e instanceof wr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=pi.create(ku(n))}return new wr({...e._def,shape:()=>t})}else return e instanceof Vn?Vn.create(ku(e.element)):e instanceof pi?pi.create(ku(e.unwrap())):e instanceof Fo?Fo.create(ku(e.unwrap())):e instanceof hi?hi.create(e.items.map(t=>ku(t))):e}i(ku,"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 Ui&&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 di(o,y,o.path,p)),alwaysSet:p in o.data})}if(this._def.catchall instanceof Ui){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 di(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 ku(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 pi;)s=s._def.innerType;r[n]=s}});else for(let n in this.shape){let s=this.shape[n];for(;s instanceof pi;)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:Ui.create(),typeName:xt.ZodObject,...Vt(t)});wr.strictCreate=(e,t)=>new wr({shape:()=>e,unknownKeys:"strict",catchall:Ui.create(),typeName:xt.ZodObject,...Vt(t)});wr.lazycreate=(e,t)=>new wr({shape:e,unknownKeys:"strip",catchall:Ui.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 Li(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 Li(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 Kn?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 hi=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 di(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 hi({...this._def,rest:t})}};i(hi,"ZodTuple");hi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new hi({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 di(n,l,n.path,l)),value:c._parse(new di(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:Fi.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 di(n,l,n.path,[p,"key"])),value:s._parse(new di(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 Lo=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 di(n,h,n.path,p)));return n.common.async?Promise.all(l).then(h=>c(h)):c(l)}min(t,r){return new Lo({...this._def,minSize:{value:t,message:Wt.toString(r)}})}max(t,r){return new Lo({...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(Lo,"ZodSet");Lo.create=(e,t)=>new Lo({valueType:e,minSize:null,maxSize:null,typeName:xt.ZodSet,...Vt(t)});var va=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 ya?En(async(...l)=>{let h=new Li([]),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})}):En((...l)=>{let h=this._def.args.safeParse(l,s);if(!h.success)throw new Li([n(l,h.error)]);let p=c(...h.data),m=this._def.returns.safeParse(p,s);if(!m.success)throw new Li([o(p,m.error)]);return m.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new va({...this._def,args:hi.create(t).rest(Po.create())})}returns(t){return new va({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new va({args:t||hi.create([]).rest(Po.create()),returns:r||Po.create(),typeName:xt.ZodFunction,...Vt(n)})}};i(va,"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 En(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 En(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 ya=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 En(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(ya,"ZodPromise");ya.create=(e,t)=>new ya({type:e,typeName:xt.ZodPromise,...Vt(t)});var Kn=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(Kn,"ZodEffects");Kn.create=(e,t,r)=>new Kn({schema:e,typeName:xt.ZodEffects,effect:t,...Vt(r)});Kn.createWithPreprocess=(e,t,r)=>new Kn({schema:t,effect:{type:"preprocess",transform:e},typeName:xt.ZodEffects,...Vt(r)});var pi=class extends Bt{_parse(t){return this._getType(t)===tt.undefined?En(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(pi,"ZodOptional");pi.create=(e,t)=>new pi({innerType:e,typeName:xt.ZodOptional,...Vt(t)});var Fo=class extends Bt{_parse(t){return this._getType(t)===tt.null?En(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(Fo,"ZodNullable");Fo.create=(e,t)=>new Fo({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 vF=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?ga.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})}}):ga.create(),"custom"),yF={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 bF=i((e,t={message:`Input not instance of ${e.name}`})=>B7(r=>r instanceof e,t,!0),"instanceOfType"),P7=Fi.create,L7=io.create,wF=dc.create,_F=Xa.create,F7=Qa.create,EF=Bo.create,AF=sc.create,SF=es.create,xF=ts.create,TF=ga.create,CF=Po.create,MF=Ui.create,IF=cc.create,kF=Vn.create,DF=wr.create,RF=wr.strictCreate,OF=rs.create,NF=uc.create,BF=ns.create,PF=hi.create,LF=is.create,FF=lc.create,UF=Lo.create,$F=va.create,jF=os.create,zF=as.create,HF=ss.create,qF=cs.create,VF=ya.create,D7=Kn.create,KF=pi.create,GF=Fo.create,WF=Kn.createWithPreprocess,JF=ls.create,ZF=i(()=>P7().optional(),"ostring"),YF=i(()=>L7().optional(),"onumber"),XF=i(()=>F7().optional(),"oboolean"),QF={string:e=>Fi.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=>Bo.create({...e,coerce:!0})},eU=kt,J=Object.freeze({__proto__:null,defaultErrorMap:Ff,setErrorMap:lF,getErrorMap:s0,makeIssue:c0,EMPTY_PATH:fF,addIssueToContext:vt,ParseStatus:Xr,INVALID:kt,DIRTY:O7,OK:En,isAborted:Iy,isDirty:ky,isValid:u0,isAsync:l0,get util(){return rr},ZodParsedType:tt,getParsedType:Ya,ZodType:Bt,ZodString:Fi,ZodNumber:io,ZodBigInt:Xa,ZodBoolean:Qa,ZodDate:Bo,ZodSymbol:sc,ZodUndefined:es,ZodNull:ts,ZodAny:ga,ZodUnknown:Po,ZodNever:Ui,ZodVoid:cc,ZodArray:Vn,get objectUtil(){return f0},ZodObject:wr,ZodUnion:rs,ZodDiscriminatedUnion:uc,ZodIntersection:ns,ZodTuple:hi,ZodRecord:is,ZodMap:lc,ZodSet:Lo,ZodFunction:va,ZodLazy:os,ZodLiteral:as,ZodEnum:ss,ZodNativeEnum:cs,ZodPromise:ya,ZodEffects:Kn,ZodTransformer:Kn,ZodOptional:pi,ZodNullable:Fo,ZodDefault:us,ZodCatch:fc,ZodNaN:dc,BRAND:vF,ZodBranded:Lf,ZodPipeline:ls,custom:B7,Schema:Bt,ZodSchema:Bt,late:yF,get ZodFirstPartyTypeKind(){return xt},coerce:QF,any:TF,array:kF,bigint:_F,boolean:F7,date:EF,discriminatedUnion:NF,effect:D7,enum:HF,function:$F,instanceof:bF,intersection:BF,lazy:jF,literal:zF,map:FF,nan:wF,nativeEnum:qF,never:MF,null:xF,nullable:GF,number:L7,object:DF,oboolean:XF,onumber:YF,optional:KF,ostring:ZF,pipeline:JF,preprocess:WF,promise:VF,record:LF,set:UF,strictObject:RF,string:P7,symbol:AF,transformer:D7,tuple:PF,undefined:SF,union:OF,unknown:CF,void:IF,NEVER:eU,ZodIssueCode:Ke,quotelessJson:uF,ZodError:Li});var tU=Object.defineProperty,rU=i((e,t)=>tU(e,"name",{value:t,configurable:!0}),"__name"),p0=J.array(J.string().or(J.record(J.any()))),mZ=J.object({type:J.string().optional(),narrative:J.string().optional()}),m0=J.string().or(J.object({id:J.string(),type:J.string(),caption:J.string().optional()})),nU=J.object({type:J.string().min(1).or(J.string().array().nonempty()),latitude:J.number(),longitude:J.number()}),iU=J.object({type:J.string().min(1).or(J.string().array().nonempty()),addressCountry:J.string().optional(),addressCountryCode:J.string().optional(),addressRegion:J.string().optional(),addressLocality:J.string().optional(),streetAddress:J.string().optional(),postOfficeBoxNumber:J.string().optional(),postalCode:J.string().optional(),geo:nU.optional()}),oU=J.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(J.string()),j7=J.object({type:J.string().min(1).or(J.string().array().nonempty()),identifier:J.string(),identifierType:oU}),Uf=J.string().or(J.object({id:J.string().optional(),type:J.string().or(J.string().array().nonempty().optional()),name:J.string().optional(),url:J.string().optional(),phone:J.string().optional(),description:J.string().optional(),endorsement:J.any().array().optional(),image:m0.optional(),email:J.string().email().optional(),address:iU.optional(),otherIdentifier:j7.array().optional(),official:J.string().optional(),parentOrg:J.any().optional(),familyName:J.string().optional(),givenName:J.string().optional(),additionalName:J.string().optional(),patronymicName:J.string().optional(),honorificPrefix:J.string().optional(),honorificSuffix:J.string().optional(),familyNamePrefix:J.string().optional(),dateOfBirth:J.string().optional()}).catchall(J.any())),Ry=J.object({id:J.string().optional()}).catchall(J.any()),aU=J.object({type:J.string(),id:J.string()}).catchall(J.any()),sU=J.object({id:J.string(),type:J.string()}).catchall(J.any()),cU=J.object({id:J.string(),type:J.string()}).catchall(J.any()),d0=J.object({"@context":p0,id:J.string().optional(),type:J.string().array().nonempty(),issuer:Uf,issuanceDate:J.string(),expirationDate:J.string().optional(),credentialSubject:Ry.or(Ry.array()),credentialStatus:aU.optional(),credentialSchema:sU.array().optional(),refreshService:cU.optional()}).catchall(J.any()),Uo=J.object({type:J.string(),created:J.string(),challenge:J.string().optional(),domain:J.string().optional(),nonce:J.string().optional(),proofPurpose:J.string(),verificationMethod:J.string(),jws:J.string().optional()}).catchall(J.any()),h0=d0.extend({proof:Uo.or(Uo.array())}),uU=J.object({"@context":p0,id:J.string().optional(),type:J.string().or(J.string().array().nonempty()),verifiableCredential:h0.or(h0.array()).optional(),holder:J.string().optional()}).catchall(J.any()),gZ=uU.extend({proof:Uo.or(Uo.array())}),z7=J.object({kty:J.string(),crv:J.string(),x:J.string(),y:J.string().optional(),n:J.string().optional(),d:J.string()}),lU=J.object({alg:J.string(),iv:J.string(),tag:J.string(),epk:z7.partial().optional(),kid:J.string().optional(),apv:J.string().optional(),apu:J.string().optional()}),fU=J.object({header:lU,encrypted_key:J.string()}),dU=J.object({protected:J.string(),iv:J.string(),ciphertext:J.string(),tag:J.string(),aad:J.string().optional(),recipients:fU.array().optional()}),hc=J.string().or(J.object({"@context":p0.optional(),id:J.string(),type:J.string(),controller:J.string(),publicKeyJwk:z7.optional(),publicKeyBase58:J.string().optional(),blockChainAccountId:J.string().optional()}).catchall(J.any())),hU=J.object({id:J.string(),type:J.string().or(J.string().array().nonempty()),serviceEndpoint:J.any().or(J.any().array().nonempty())}).catchall(J.any()),bZ=J.object({"@context":p0,id:J.string(),alsoKnownAs:J.string().optional(),controller:J.string().or(J.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:hU.array().optional(),proof:Uo.or(Uo.array()).optional()}).catchall(J.any()),pU=J.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(J.string()),g0=J.object({type:J.string().array().nonempty(),targetCode:J.string().optional(),targetDescription:J.string().optional(),targetName:J.string(),targetFramework:J.string().optional(),targetType:pU.optional(),targetUrl:J.string()}),mU=J.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"]),gU=mU.or(J.string()),vU=J.object({id:J.string().optional(),narrative:J.string().optional()}).catchall(J.any()),yU=J.object({id:J.string(),type:J.string().array().nonempty(),endorsementComment:J.string().optional()}),bU=d0.extend({credentialSubject:yU,proof:Uo.or(Uo.array()).optional()}),wU=J.object({id:J.string(),"@language":J.string().optional(),version:J.string().optional()}),_U=J.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(J.string()),EU=J.object({id:J.string(),type:J.string().array().nonempty(),alignment:g0.array().optional(),description:J.string().optional(),level:J.string().optional(),name:J.string(),points:J.string().optional()}).catchall(J.any()),AU=J.object({id:J.string(),type:J.string().array().nonempty(),alignment:g0.array().optional(),allowedValue:J.string().array().optional(),name:J.string(),requiredLevel:J.string().optional(),requiredValue:J.string().optional(),resultType:_U,rubricCriterionLevel:EU.array().optional(),valueMax:J.string().optional(),valueMin:J.string().optional()}).catchall(J.any()),SU=J.object({id:J.string().optional(),type:J.string().array().nonempty(),alignment:g0.array().optional(),achievementType:gU.optional(),creator:Uf.optional(),creditsAvailable:J.number().optional(),criteria:vU,description:J.string(),endorsement:bU.array().optional(),fieldOfStudy:J.string().optional(),humanCode:J.string().optional(),image:m0.optional(),"@language":J.string().optional(),name:J.string(),otherIdentifier:j7.array().optional(),related:wU.array().optional(),resultDescription:AU.array().optional(),specialization:J.string().optional(),tag:J.string().array().optional(),version:J.string().optional()}).catchall(J.any()),xU=J.object({type:J.string(),hashed:J.boolean(),identityHash:J.string(),identityType:J.string(),salt:J.string().optional()}),TU=J.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),CU=J.object({type:J.string().array().nonempty(),achievedLevel:J.string().optional(),alignment:g0.array().optional(),resultDescription:J.string().optional(),status:TU.optional(),value:J.string().optional()}).catchall(J.any()),U7=J.object({id:J.string().optional(),type:J.string().array().nonempty(),activityEndDate:J.string().optional(),activityStartDate:J.string().optional(),creditsEarned:J.number().optional(),achievement:SU.optional(),identifier:xU.array().optional(),image:m0.optional(),licenseNumber:J.string().optional(),narrative:J.string().optional(),result:CU.array().optional(),role:J.string().optional(),source:Uf.optional(),term:J.string().optional()}).catchall(J.any()),MU=J.object({id:J.string().optional(),type:J.string().array().nonempty(),narrative:J.string().optional(),name:J.string().optional(),description:J.string().optional(),genre:J.string().optional(),audience:J.string().optional()}).catchall(J.any()),IU=d0.extend({name:J.string().optional(),description:J.string().optional(),image:m0.optional(),credentialSubject:U7.or(U7.array()),endorsement:d0.array().optional(),evidence:MU.array().optional()}),_Z=IU.extend({proof:Uo.or(Uo.array())}),AZ=J.object({checks:J.string().array(),warnings:J.string().array(),errors:J.string().array()}),H7=J.enum(["Success","Failed","Error"]),SZ=H7.enum,xZ=J.object({check:J.string(),status:H7,message:J.string().optional(),details:J.string().optional()}),TZ=J.object({title:J.string().optional(),createdAt:J.string().optional(),issuer:Uf.optional(),issuee:Uf.optional(),credentialSubject:Ry.optional()}),pc=J.object({id:J.string(),uri:J.string()}).catchall(J.any()),IZ=J.object({limit:J.number(),cursor:J.string().optional(),sort:J.string().optional()}),ba=J.object({cursor:J.string().optional(),hasMore:J.boolean()}),q7=J.object({encryptedRecord:dU,fields:J.string().array()}).catchall(J.any()),kZ=ba.extend({records:q7.array()}),kU=q7.extend({id:J.string()}),DZ=ba.extend({records:kU.array()}),$7=rU(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),DU=J.instanceof(RegExp).or(J.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}`)}})),$i=J.string().or(J.object({$in:J.string().array()})).or(J.object({$regex:DU})),Du=J.object({profileId:J.string().min(3).max(40),displayName:J.string().default(""),shortBio:J.string().default(""),bio:J.string().default(""),did:J.string(),email:J.string().optional(),image:J.string().optional(),heroImage:J.string().optional(),websiteLink:J.string().optional(),isServiceProfile:J.boolean().default(!1).optional(),type:J.string().optional(),notificationsWebhook:J.string().url().startsWith("http").optional()}),NZ=J.object({profileId:$i,displayName:$i,shortBio:$i,bio:$i,email:$i,websiteLink:$i,isServiceProfile:J.boolean(),type:$i}).partial(),BZ=ba.extend({records:Du.array()}),PZ=J.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),LZ=J.object({uri:J.string(),to:J.string(),from:J.string(),sent:J.string().datetime(),received:J.string().datetime().optional()}),RU=J.object({role:J.string(),canEdit:J.boolean(),canIssue:J.boolean(),canRevoke:J.boolean(),canManagePermissions:J.boolean(),canIssueChildren:J.string(),canCreateChildren:J.string(),canEditChildren:J.string(),canRevokeChildren:J.string(),canManageChildrenPermissions:J.string(),canViewAnalytics:J.boolean()}),Oy=J.enum(["DRAFT","LIVE"]),OU=J.object({uri:J.string(),name:J.string().optional(),type:J.string().optional(),category:J.string().optional(),status:Oy.optional(),autoConnectRecipients:J.boolean().optional(),meta:J.record(J.any()).optional(),claimPermissions:RU.optional()}),FZ=J.object({uri:$i,name:$i,type:$i,category:$i,meta:J.record($i),status:Oy.or(J.object({$in:Oy.array()})),autoConnectRecipients:J.boolean()}).partial(),UZ=ba.extend({records:OU.array()}),NU=J.object({to:Du,from:J.string(),received:J.string().optional(),uri:J.string().optional()}),$Z=ba.extend({records:NU.array()}),jZ=J.object({endpoint:J.string(),name:J.string(),did:J.string().optional()}),zZ=J.object({ttlSeconds:J.number().optional(),totalUses:J.number().optional()}),BU=J.object({endpoint:J.string()}),HZ=J.object({signingAuthority:BU,relationship:J.object({name:J.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:J.string()})}),PU=J.enum(["live","stale","withdrawn"]),LU=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({categories:J.record(J.object({required:J.boolean()})).default({})}).default({}),personal:J.record(J.object({required:J.boolean()})).default({})}).default({}),write:J.object({credentials:J.object({categories:J.record(J.object({required:J.boolean()})).default({})}).default({}),personal:J.record(J.object({required:J.boolean()})).default({})}).default({})}),V7=J.object({contract:LU,owner:Du,name:J.string(),subtitle:J.string().optional(),description:J.string().optional(),reasonForAccessing:J.string().optional(),image:J.string().optional(),uri:J.string(),createdAt:J.string(),updatedAt:J.string(),expiresAt:J.string().optional()}),qZ=ba.extend({records:V7.omit({owner:!0}).array()}),FU=J.object({credentials:J.object({categories:J.record(J.string().array()).default({})}),personal:J.record(J.string()).default({}),date:J.string()}),VZ=ba.extend({records:FU.array()}),K7=J.object({sharing:J.boolean().optional(),shared:J.string().array().optional(),shareAll:J.boolean().optional(),shareUntil:J.string().optional()}),G7=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({shareAll:J.boolean().optional(),sharing:J.boolean().optional(),categories:J.record(K7).default({})}).default({}),personal:J.record(J.string()).default({})}).default({}),write:J.object({credentials:J.object({categories:J.record(J.boolean()).default({})}).default({}),personal:J.record(J.boolean()).default({})}).default({})}),KZ=ba.extend({records:J.object({expiresAt:J.string().optional(),oneTime:J.boolean().optional(),terms:G7,contract:V7,uri:J.string(),consenter:Du,status:PU}).array()}),GZ=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({categories:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),personal:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),write:J.object({credentials:J.object({categories:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),personal:J.record(J.object({required:J.boolean().optional()})).optional()}).optional()}),WZ=J.object({anonymize:J.boolean().optional(),credentials:J.object({categories:J.record(J.boolean()).optional()}).optional(),personal:J.record(J.boolean()).optional()}),UU=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({shareAll:J.boolean().optional(),sharing:J.boolean().optional(),categories:J.record(K7.optional()).optional()}).optional(),personal:J.record(J.string()).optional()}).optional(),write:J.object({credentials:J.object({categories:J.record(J.boolean()).optional()}).optional(),personal:J.record(J.boolean()).optional()}).optional()}),Ny=J.enum(["consent","update","sync","withdraw"]),JZ=J.object({terms:UU.optional(),action:Ny.or(Ny.array()).optional(),date:J.object({$gt:J.string()}).or(J.object({$lt:J.string()})).or(J.object({$eq:J.string()})).optional(),expiresAt:J.object({$gt:J.string()}).or(J.object({$lt:J.string()})).or(J.object({$eq:J.string()})).optional(),oneTime:J.boolean().optional()}),W7=J.object({expiresAt:J.string().optional(),oneTime:J.boolean().optional(),terms:G7.optional(),id:J.string(),action:Ny,date:J.string()}),ZZ=ba.extend({records:W7.array()}),$U=J.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),jU=J.object({title:J.string().optional(),body:J.string().optional()}),zU=J.object({vcUris:J.array(J.string()).optional(),vpUris:J.array(J.string()).optional(),transaction:W7.optional()}),YZ=J.object({type:$U,to:Du.partial().and(J.object({did:J.string()})),from:Du.partial().and(J.object({did:J.string()})),message:jU.optional(),data:zU.optional(),sent:J.string().datetime().optional()});var HU=Object.create,yd=Object.defineProperty,qU=Object.getOwnPropertyDescriptor,s6=Object.getOwnPropertyNames,VU=Object.getPrototypeOf,KU=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"),dS=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of s6(t))!KU.call(e,o)&&o!==r&&yd(e,o,{get:()=>t[o],enumerable:!(n=qU(t,o))||n.enumerable});return e},"__copyProps"),ir=i((e,t,r)=>(r=e!=null?HU(VU(e)):{},dS(t||!e||!e.__esModule?yd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),By=i(e=>dS(yd({},"__esModule",{value:!0}),e),"__toCommonJS"),GU=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,W=4,$=8,z=16,X=32,Z=64,k=128,q=256,he=512,me=30,we="...",G=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",X],["partialRight",Z],["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]",Y="[object Null]",N="[object Object]",U="[object Promise]",K="[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]/,Sn=/\\(\\)?/g,At=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yt=/\w*$/,fn=/^[-+]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,xn="\\ud800-\\udfff",Ai="\\u0300-\\u036f",Si="\\ufe20-\\ufe2f",xi="\\u20d0-\\u20ff",Bn=Ai+Si+xi,dn="\\u2700-\\u27bf",Xn="a-z\\xdf-\\xf6\\xf8-\\xff",Pn="\\xac\\xb1\\xd7\\xf7",Ti="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ci="\\u2000-\\u206f",Mi=" \\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",Xo="A-Z\\xc0-\\xd6\\xd8-\\xde",Qo="\\ufe0e\\ufe0f",ea=Pn+Ti+Ci+Mi,Ba="['\u2019]",Nd="["+xn+"]",wl="["+ea+"]",ks="["+Bn+"]",_l="\\d+",Bd="["+dn+"]",El="["+Xn+"]",Al="[^"+xn+ea+_l+dn+Xn+Xo+"]",Ds="\\ud83c[\\udffb-\\udfff]",Pd="(?:"+ks+"|"+Ds+")",Sl="[^"+xn+"]",ta="(?:\\ud83c[\\udde6-\\uddff]){2}",Wi="[\\ud800-\\udbff][\\udc00-\\udfff]",ra="["+Xo+"]",yo="\\u200d",xl="(?:"+El+"|"+Al+")",Ld="(?:"+ra+"|"+Al+")",Tl="(?:"+Ba+"(?:d|ll|m|re|s|t|ve))?",Cl="(?:"+Ba+"(?:D|LL|M|RE|S|T|VE))?",Ml=Pd+"?",Il="["+Qo+"]?",kl="(?:"+yo+"(?:"+[Sl,ta,Wi].join("|")+")"+Il+Ml+")*",bo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fd="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",jc=Il+Ml+kl,Ud="(?:"+[Bd,ta,Wi].join("|")+")"+jc,Dl="(?:"+[Sl+ks+"?",ks,ta,Wi,Nd].join("|")+")",Rl=RegExp(Ba,"g"),$d=RegExp(ks,"g"),Ol=RegExp(Ds+"(?="+Ds+")|"+Dl+jc,"g"),Nl=RegExp([ra+"?"+El+"+"+Tl+"(?="+[wl,ra,"$"].join("|")+")",Ld+"+"+Cl+"(?="+[wl,ra+xl,"$"].join("|")+")",ra+"?"+xl+"+"+Tl,ra+"+"+Cl,Fd,bo,_l,Ud].join("|"),"g"),jd=RegExp("["+yo+xn+Bn+Qo+"]"),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"],zc=-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={"&":"&","<":"<",">":">",'"':""","'":"'"},Le={"&":"&","<":"<",">":">",""":'"',"'":"'"},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},qr=parseFloat,on=parseInt,Tn=typeof global=="object"&&global&&global.Object===Object&&global,hn=typeof self=="object"&&self&&self.Object===Object&&self,Lr=Tn||hn||Function("return this")(),wo=typeof e=="object"&&e&&!e.nodeType&&e,_o=wo&&typeof t=="object"&&t&&!t.nodeType&&t,Bl=_o&&_o.exports===wo,Hc=Bl&&Tn.process,pn=function(){try{var Se=_o&&_o.require&&_o.require("util").types;return Se||Hc&&Hc.binding&&Hc.binding("util")}catch{}}(),Os=pn&&pn.isArrayBuffer,j2=pn&&pn.isDate,z2=pn&&pn.isMap,H2=pn&&pn.isRegExp,q2=pn&&pn.isSet,V2=pn&&pn.isTypedArray;function Ln(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(Ln,"apply"),a(Ln,"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 Qn(Se,Be){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft&&Be(Se[ke],ke,Se)!==!1;);return Se}i(Qn,"arrayEach"),a(Qn,"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 na(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(na,"arrayFilter"),a(na,"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 ia(Se,Be){for(var ke=-1,ft=Be.length,It=Se.length;++ke<ft;)Se[It+ke]=Be[ke];return Se}i(ia,"arrayPush"),a(ia,"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 Gk=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 Fn(Se){return function(Be){return Se(Be)}}i(Fn,"baseUnary"),a(Fn,"baseUnary");function Zd(Se,Be){return Tr(Be,function(ke){return Se[ke]})}i(Zd,"baseValues"),a(Zd,"baseValues");function qc(Se,Be){return Se.has(Be)}i(qc,"cacheHas"),a(qc,"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 Wk=Gd(de),Jk=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 oa(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(oa,"replaceHolders"),a(oa,"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):Gk(Se)}i(Ps,"stringSize"),a(Ps,"stringSize");function Ii(Se){return Bs(Se)?u3(Se):J2(Se)}i(Ii,"stringToArray"),a(Ii,"stringToArray");function f1(Se){for(var Be=Se.length;Be--&&sr.test(Se.charAt(Be)););return Be}i(f1,"trimmedEndIndex"),a(f1,"trimmedEndIndex");var Zk=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 Yk=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,Xk=Be.String,ki=Be.TypeError,Xd=ke.prototype,Qk=fr.prototype,Vc=br.prototype,Qd=Be["__core-js_shared__"],eh=Qk.toString,gr=Vc.hasOwnProperty,eD=0,f3=function(){var u=/[^.]+$/.exec(Qd&&Qd.keys&&Qd.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),th=Vc.toString,tD=eh.call(br),rD=Lr._,nD=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=Vc.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{}}(),iD=Be.clearTimeout!==Lr.clearTimeout&&Be.clearTimeout,oD=ft&&ft.now!==Lr.Date.now&&ft.now,aD=Be.setTimeout!==Lr.setTimeout&&Be.setTimeout,sh=Kr.ceil,ch=Kr.floor,h1=br.getOwnPropertySymbols,sD=rh?rh.isBuffer:r,g3=Be.isFinite,cD=Xd.join,uD=l1(br.keys,br),Gr=Kr.max,mn=Kr.min,lD=ft.now,fD=Be.parseInt,v3=Kr.random,dD=Xd.reverse,p1=Ha(Be,"DataView"),$l=Ha(Be,"Map"),m1=Ha(Be,"Promise"),Kc=Ha(Be,"Set"),jl=Ha(Be,"WeakMap"),zl=Ha(br,"create"),uh=jl&&new jl,Gc={},hD=qa(p1),pD=qa($l),mD=qa(m1),gD=qa(Kc),vD=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 ei)return u;if(gr.call(u,"__wrapped__"))return hg(u)}return new ei(u)}i(se,"lodash"),a(se,"lodash");var Wc=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 ei(u,d){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!d,this.__index__=0,this.__values__=r}i(ei,"LodashWrapper"),a(ei,"LodashWrapper"),se.templateSettings={escape:lr,evaluate:lt,interpolate:nt,variable:"",imports:{_:se}},se.prototype=ql.prototype,se.prototype.constructor=se,ei.prototype=Wc(ql.prototype),ei.prototype.constructor=ei;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__=Cn(this.__actions__),u.__dir__=this.__dir__,u.__filtered__=this.__filtered__,u.__iteratees__=Cn(this.__iteratees__),u.__takeCount__=this.__takeCount__,u.__views__=Cn(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=mn(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,jn=Ht.type,bn=Gt(_t);if(jn==g)_t=bn;else if(!bn){if(jn==T)continue e;break e}}St[Ye++]=_t}return St}i(_3,"lazyValue"),a(_3,"lazyValue"),Kt.prototype=Wc(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 Eo(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(Eo,"ListCache"),a(Eo,"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"),Eo.prototype.clear=C3,Eo.prototype.delete=M3,Eo.prototype.get=I3,Eo.prototype.has=k3,Eo.prototype.set=D3;function Ao(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(Ao,"MapCache"),a(Ao,"MapCache");function R3(){this.size=0,this.__data__={hash:new Fa,map:new($l||Eo),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"),Ao.prototype.clear=R3,Ao.prototype.delete=O3,Ao.prototype.get=N3,Ao.prototype.has=B3,Ao.prototype.set=P3;function Ua(u){var d=-1,S=u==null?0:u.length;for(this.__data__=new Ao;++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 Di(u){var d=this.__data__=new Eo(u);this.size=d.size}i(Di,"Stack"),a(Di,"Stack");function U3(){this.__data__=new Eo,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 Eo){var j=S.__data__;if(!$l||j.length<o-1)return j.push([u,d]),this.size=++S.size,this;S=this.__data__=new Ao(j)}return S.set(u,d),this.size=S.size,this}i(H3,"stackSet"),a(H3,"stackSet"),Di.prototype.clear=U3,Di.prototype.delete=$3,Di.prototype.get=j3,Di.prototype.has=z3,Di.prototype.set=H3;function g1(u,d){var S=Ot(u),j=!S&&js(u),te=!S&&!j&&Va(u),ce=!S&&!j&&!te&&nu(u),ye=S||j||te||ce,Ee=ye?Jd(u.length,Xk):[],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")||Co(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(Cn(u),$a(d,0,u.length))}i(q3,"arraySampleSize"),a(q3,"arraySampleSize");function V3(u){return af(Cn(u))}i(V3,"arrayShuffle"),a(V3,"arrayShuffle");function fh(u,d,S){(S!==r&&!Ri(u[d],S)||S===r&&!(d in u))&&So(u,d,S)}i(fh,"assignMergeValue"),a(fh,"assignMergeValue");function Jc(u,d,S){var j=u[d];(!(gr.call(u,d)&&Ri(j,S))||S===r&&!(d in u))&&So(u,d,S)}i(Jc,"assignValue"),a(Jc,"assignValue");function Vl(u,d){for(var S=u.length;S--;)if(Ri(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,In(d),u)}i(G3,"baseAssignIn"),a(G3,"baseAssignIn");function So(u,d,S){d=="__proto__"&&ah?ah(u,d,{configurable:!0,enumerable:!0,value:S,writable:!0}):u[d]=S}i(So,"baseAssignValue"),a(So,"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 ti(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 Cn(u,ye)}else{var je=vn(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 Di);var pt=ce.get(u);if(pt)return pt;ce.set(u,ye),N4(u)?u.forEach(function(_t){ye.add(ti(_t,d,S,_t,u,ce))}):T4(u)&&u.forEach(function(_t,Ht){ye.set(Ht,ti(_t,d,S,Ht,u,ce))});var St=Fe?xe?Dh:kh:xe?In:Wr,Lt=Ue?r:St(u);return Qn(Lt||u,function(_t,Ht){Lt&&(Ht=_t,_t=u[Ht]),Jc(ye,Ht,ti(_t,d,S,Ht,u,ce))}),ye}i(ti,"baseClone"),a(ti,"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 ki(c);return of(function(){u.apply(r,S)},d)}i(w1,"baseDelay"),a(w1,"baseDelay");function Zc(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,Fn(S))),j?(ce=Hd,ye=!1):d.length>=o&&(ce=qc,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(Zc,"baseDifference"),a(Zc,"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&&!$n(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):ia(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 na(d,function(S){return Mo(u[S])})}i(Gl,"baseFunctions"),a(Gl,"baseFunctions");function za(u,d){d=sa(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:ia(j,S(u))}i(A1,"baseGetAllKeys"),a(A1,"baseGetAllKeys");function gn(u){return u==null?u===r?De:Y:Ls&&Ls in br(u)?O5(u):K5(u)}i(gn,"baseGetTag"),a(gn,"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>=mn(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,Fn(d))),xe=mn(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?qc(Ye,St):j(Fe,St,S))){for(ye=ce;--ye;){var Lt=Ee[ye];if(!(Lt?qc(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 Yc(u,d,S){d=sa(d,u),u=ug(u,d);var j=u==null?u:u[Yi(ni(d))];return j==null?r:Ln(j,u,S)}i(Yc,"baseInvoke"),a(Yc,"baseInvoke");function S1(u){return kr(u)&&gn(u)==F}i(S1,"baseIsArguments"),a(S1,"baseIsArguments");function n5(u){return kr(u)&&gn(u)==qe}i(n5,"baseIsArrayBuffer"),a(n5,"baseIsArrayBuffer");function i5(u){return kr(u)&&gn(u)==ae}i(i5,"baseIsDate"),a(i5,"baseIsDate");function Xc(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,Xc,te)}i(Xc,"baseIsEqual"),a(Xc,"baseIsEqual");function o5(u,d,S,j,te,ce){var ye=Ot(u),Ee=Ot(d),xe=ye?ge:vn(u),Fe=Ee?ge:vn(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 Di),ye||nu(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 Di),te(Lt,_t,S,j,ce)}}return Ye?(ce||(ce=new Di),R5(u,d,S,j,te,ce)):!1}i(o5,"baseIsEqualDeep"),a(o5,"baseIsEqualDeep");function a5(u){return kr(u)&&vn(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 Di;if(j)var Ye=j(Fe,Ue,xe,u,d,je);if(!(Ye===r?Xc(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=Mo(u)?nD:tr;return d.test(qa(u))}i(x1,"baseIsNative"),a(x1,"baseIsNative");function s5(u){return kr(u)&&gn(u)==ie}i(s5,"baseIsRegExp"),a(s5,"baseIsRegExp");function c5(u){return kr(u)&&vn(u)==ee}i(c5,"baseIsSet"),a(c5,"baseIsSet");function u5(u){return kr(u)&&ff(u.length)&&!!yr[gn(u)]}i(u5,"baseIsTypedArray"),a(u5,"baseIsTypedArray");function T1(u){return typeof u=="function"?u:u==null?kn:typeof u=="object"?Ot(u)?I1(u[0],u[1]):M1(u):jg(u)}i(T1,"baseIteratee"),a(T1,"baseIteratee");function vh(u){if(!tu(u))return uD(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=tu(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=Mn(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):Xc(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 Di),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)}},In)}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&&nu(xe);Ue=xe,Ye||pt||St?Ot(Ee)?Ue=Ee:Or(Ee)?Ue=Cn(Ee):pt?(je=!1,Ue=U1(xe,!0)):St?(je=!1,Ue=$1(xe,!0)):Ue=[]:ru(xe)||js(xe)?(Ue=Ee,js(Ee)?Ue=Bg(Ee):(!Mr(Ee)||Mo(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,Co(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=[kn];var j=-1;d=Tr(d,Fn(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)&&Qc(ce,sa(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=Cn(d)),S&&(Ee=Tr(u,Fn(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;Co(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,kn),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 Qc(u,d,S,j){if(!Mr(u))return u;d=sa(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:Co(d[te+1])?[]:{})}Jc(Ee,xe,Fe),Ee=Ee[xe]}return u}i(Qc,"baseSet"),a(Qc,"baseSet");var v5=uh?function(u,d){return uh.set(u,d),u}:kn,yD=ah?function(u,d){return ah(u,"toString",{configurable:!0,enumerable:!1,value:Hh(d),writable:!0})}:kn;function y5(u){return af(zs(u))}i(y5,"baseShuffle"),a(y5,"baseShuffle");function ri(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(ri,"baseSlice"),a(ri,"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&&!$n(ye)&&(S?ye<=d:ye<d)?j=ce+1:te=ce}return te}return Eh(u,d,kn,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=$n(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=$n(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 mn(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||!Ri(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:$n(u)?C:+u}i(B1,"baseToNumber"),a(B1,"baseToNumber");function Un(u){if(typeof u=="string")return u;if(Ot(u))return Tr(u,Un)+"";if($n(u))return y3?y3.call(u):"";var d=u+"";return d=="0"&&1/u==-v?"-0":d}i(Un,"baseToString"),a(Un,"baseToString");function aa(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:wD(u);if(Fe)return Fl(Fe);ye=!1,te=qc,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(aa,"baseUniq"),a(aa,"baseUniq");function Ah(u,d){return d=sa(d,u),u=ug(u,d),u==null||delete u[Yi(ni(d))]}i(Ah,"baseUnset"),a(Ah,"baseUnset");function P1(u,d,S,j){return Qc(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?ri(u,j?0:ce,j?ce+1:te):ri(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,ia([j],te.args))},S)}i(L1,"baseWrapperValue"),a(L1,"baseWrapperValue");function Sh(u,d,S){var j=u.length;if(j<2)return j?aa(u[0]):[];for(var te=-1,ce=ke(j);++te<j;)for(var ye=u[te],Ee=-1;++Ee<j;)Ee!=te&&(ce[te]=Zc(ce[te]||ye,u[Ee],d,S));return aa(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:kn}i(Th,"castFunction"),a(Th,"castFunction");function sa(u,d){return Ot(u)?u:Oh(u,d)?[u]:J5(dr(u))}i(sa,"castPath"),a(sa,"castPath");var bD=Ft;function ca(u,d,S){var j=u.length;return S=S===r?j:S,!d&&S>=j?u:ri(u,d,S)}i(ca,"castSlice"),a(ca,"castSlice");var w5=iD||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=$n(u),ye=d!==r,Ee=d===null,xe=d===d,Fe=$n(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 Cn(u,d){var S=-1,j=u.length;for(d||(d=ke(j));++S<j;)d[S]=u[S];return d}i(Cn,"copyArray"),a(Cn,"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?So(S,Ee,xe):Jc(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&&yn(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(!Mn(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=eu(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)?Ii(d):r,j=S?S[0]:d.charAt(0),te=S?ca(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 eu(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=Wc(u.prototype),j=u.apply(S,d);return Mr(j)?j:S}}i(eu,"createCtor"),a(eu,"createCtor");function M5(u,d,S){var j=eu(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?[]:oa(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 Ln(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(!Mn(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 To(function(d){var S=d.length,j=S,te=ei.prototype.thru;for(u&&d.reverse();j--;){var ce=d[j];if(typeof ce!="function")throw new ki(c);if(te&&!ye&&rf(ce)=="wrapper")var ye=new ei([],!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|$|X|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:eu(u);function _t(){for(var Ht=arguments.length,Gt=ke(Ht),jn=Ht;jn--;)Gt[jn]=arguments[jn];if(pt)var bn=$s(_t),zn=e3(Gt,bn);if(j&&(Gt=z1(Gt,j,te,pt)),ce&&(Gt=H1(Gt,ce,ye,pt)),Ht-=zn,pt&&Ht<Fe){var Fr=oa(Gt,bn);return Y1(u,d,Xl,_t.placeholder,S,Gt,Fr,Ee,xe,Fe-Ht)}var Xi=je?S:this,ua=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&&(ua=Lt||eu(ua)),ua.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=Un(S),j=Un(j)):(S=B1(S),j=B1(j)),te=u(S,j)}return te}}i(Ql,"createMathOperation"),a(Ql,"createMathOperation");function Mh(u){return To(function(d){return d=Tr(d,Fn(wt())),Ft(function(S){var j=this;return u(d,function(te){return Ln(te,j,S)})})})}i(Mh,"createOver"),a(Mh,"createOver");function ef(u,d){d=d===r?" ":Un(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)?ca(Ii(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=eu(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 Ln(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"&&yn(d,S,j)&&(S=j=r),d=Io(d),S===r?(S=d,d=0):S=Io(S),j=j===r?d<S?1:-1:Io(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=ii(d),S=ii(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?X:Z,d&=~(Ue?Z:X),d&W||(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=ii(S),j=j==null?0:mn(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 wD=Kc&&1/Fl(new Kc([,-0]))[1]==v?function(u){return new Kc(u)}:Kh;function X1(u){return function(d){var S=vn(d);return S==be?Yd(d):S==ee?o3(d):Q2(d,u(d))}}i(X1,"createToPairs"),a(X1,"createToPairs");function xo(u,d,S,j,te,ce,ye,Ee){var xe=d&B;if(!xe&&typeof u!="function")throw new ki(c);var Fe=j?j.length:0;if(Fe||(d&=~(X|Z),j=te=r),ye=ye===r?ye:Gr(Nt(ye),0),Ee=Ee===r?Ee:Nt(Ee),Fe-=te?te.length:0,d&Z){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==X||d==(O|X))&&!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(xo,"createWrap"),a(xo,"createWrap");function Q1(u,d,S,j){return u===r||Ri(u,Vc[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 ru(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(!qc(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 Ri(+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 jn=ye?j(Gt,Ht,Ye,d,u,ce):j(Ht,Gt,Ye,u,d,ce);if(!(jn===r?Ht===Gt||te(Ht,Gt,S,j,ce):jn)){Lt=!1;break}_t||(_t=Ye=="constructor")}if(Lt&&!_t){var bn=u.constructor,zn=d.constructor;bn!=zn&&"constructor"in u&&"constructor"in d&&!(typeof bn=="function"&&bn instanceof bn&&typeof zn=="function"&&zn instanceof zn)&&(Lt=!1)}return ce.delete(u),ce.delete(d),Lt}i(R5,"equalObjects"),a(R5,"equalObjects");function To(u){return lg(cg(u,r,gg),u+"")}i(To,"flatRest"),a(To,"flatRest");function kh(u){return A1(u,Wr,ng)}i(kh,"getAllKeys"),a(kh,"getAllKeys");function Dh(u){return A1(u,In,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=Gc[d],j=gr.call(Gc,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),na(h1(u),function(d){return p3.call(u,d)}))}:Gh,N5=h1?function(u){for(var d=[];u;)ia(d,ng(u)),u=ih(u);return d}:Gh,vn=gn;(p1&&vn(new p1(new ArrayBuffer(1)))!=ve||$l&&vn(new $l)!=be||m1&&vn(m1.resolve())!=U||Kc&&vn(new Kc)!=ee||jl&&vn(new jl)!=Ie)&&(vn=a(function(u){var d=gn(u),S=d==N?u.constructor:r,j=S?qa(S):"";if(j)switch(j){case hD:return ve;case pD:return be;case mD:return U;case gD:return ee;case vD: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=mn(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=sa(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)&&Co(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"&&!tu(u)?Wc(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 Co(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(Co,"isIndex"),a(Co,"isIndex");function yn(u,d,S){if(!Mr(S))return!1;var j=typeof d;return(j=="number"?Mn(S)&&Co(d,S.length):j=="string"&&d in S)?Ri(S[d],u):!1}i(yn,"isIterateeCall"),a(yn,"isIterateeCall");function Oh(u,d){if(Ot(u))return!1;var S=typeof u;return S=="number"||S=="symbol"||S=="boolean"||u==null||$n(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 _D=Qd?Mo:Wh;function tu(u){var d=u&&u.constructor,S=typeof d=="function"&&d.prototype||Vc;return u===S}i(tu,"isPrototype"),a(tu,"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:W);var Ee=d[3];if(Ee){var xe=u[3];u[3]=xe?z1(xe,Ee,d[4]):Ee,u[4]=xe?oa(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?oa(u[5],m):d[6]),Ee=d[7],Ee&&(u[7]=Ee),j&k&&(u[8]=u[8]==null?d[8]:mn(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),Ln(u,this,Ee)}}i(cg,"overRest"),a(cg,"overRest");function ug(u,d){return d.length<2?u:za(u,ri(d,0,-1))}i(ug,"parent"),a(ug,"parent");function G5(u,d){for(var S=u.length,j=mn(d.length,S),te=Cn(u);j--;){var ce=d[j];u[j]=Co(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=aD||function(u,d){return Lr.setTimeout(u,d)},lg=dg(yD);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=lD(),te=w-(j-S);if(S=j,te>0){if(++d>=G)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(Sn,"$1"):j||S)}),d});function Yi(u){if(typeof u=="string"||$n(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 Qn(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 ei(u.__wrapped__,u.__chain__);return d.__actions__=Cn(u.__actions__),d.__index__=u.__index__,d.__values__=u.__values__,d}i(hg,"wrapperClone"),a(hg,"wrapperClone");function Y5(u,d,S){(S?yn(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++]=ri(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 ia(Ot(S)?Cn(S):[S],Zr(d,1))}i(Q5,"concat4"),a(Q5,"concat");var ED=Ft(function(u,d){return Or(u)?Zc(u,Zr(d,1,Or,!0)):[]}),AD=Ft(function(u,d){var S=ni(d);return Or(S)&&(S=r),Or(u)?Zc(u,Zr(d,1,Or,!0),wt(S,2)):[]}),SD=Ft(function(u,d){var S=ni(d);return Or(S)&&(S=r),Or(u)?Zc(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),ri(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,ri(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"&&yn(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):mn(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?ri(u,0,-1):[]}i(uw,"initial"),a(uw,"initial");var xD=Ft(function(u){var d=Tr(u,xh);return d.length&&d[0]===u[0]?mh(d):[]}),TD=Ft(function(u){var d=ni(u),S=Tr(u,xh);return d===ni(S)?d=r:S.pop(),S.length&&S[0]===u[0]?mh(S,wt(d,2)):[]}),CD=Ft(function(u){var d=ni(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?"":cD.call(u,d)}i(lw,"join"),a(lw,"join");function ni(u){var d=u==null?0:u.length;return d?u[d-1]:r}i(ni,"last2"),a(ni,"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):mn(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 MD=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 ID=To(function(u,d){var S=u==null?0:u.length,j=dh(u,d);return O1(u,Tr(d,function(te){return Co(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:dD.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"&&yn(u,d,S)?(d=0,S=j):(d=d==null?0:Nt(d),S=S===r?j:Nt(S)),ri(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&&Ri(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(Ri(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?ri(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),ri(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,ri(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 kD=Ft(function(u){return aa(Zr(u,1,Or,!0))}),DD=Ft(function(u){var d=ni(u);return Or(d)&&(d=r),aa(Zr(u,1,Or,!0),wt(d,2))}),RD=Ft(function(u){var d=ni(u);return d=typeof d=="function"?d:r,aa(Zr(u,1,Or,!0),r,d)});function kw(u){return u&&u.length?aa(u):[]}i(kw,"uniq"),a(kw,"uniq");function Dw(u,d){return u&&u.length?aa(u,wt(d,2)):[]}i(Dw,"uniqBy"),a(Dw,"uniqBy");function Rw(u,d){return d=typeof d=="function"?d:r,u&&u.length?aa(u,r,d):[]}i(Rw,"uniqWith"),a(Rw,"uniqWith");function Lh(u){if(!(u&&u.length))return[];var d=0;return u=na(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 Ln(d,r,j)})}i(bg,"unzipWith"),a(bg,"unzipWith");var OD=Ft(function(u,d){return Or(u)?Zc(u,d):[]}),ND=Ft(function(u){return Sh(na(u,Or))}),BD=Ft(function(u){var d=ni(u);return Or(d)&&(d=r),Sh(na(u,Or),wt(d,2))}),PD=Ft(function(u){var d=ni(u);return d=typeof d=="function"?d:r,Sh(na(u,Or),r,d)}),LD=Ft(Lh);function Ow(u,d){return F1(u||[],d||[],Jc)}i(Ow,"zipObject"),a(Ow,"zipObject");function Nw(u,d){return F1(u||[],d||[],Qc)}i(Nw,"zipObjectDeep"),a(Nw,"zipObjectDeep");var FD=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 UD=To(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)||!Co(S)?this.thru(te):(j=j.slice(S,+S+(d?1:0)),j.__actions__.push({func:sf,args:[te],thisArg:r}),new ei(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 ei(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 ei(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 $D=Yl(function(u,d,S){gr.call(u,S)?++u[S]:So(u,S,1)});function Hw(u,d,S){var j=Ot(u)?r1:Z3;return S&&yn(u,d,S)&&(d=r),j(u,wt(d,3))}i(Hw,"every"),a(Hw,"every");function qw(u,d){var S=Ot(u)?na:_1;return S(u,wt(d,3))}i(qw,"filter2"),a(qw,"filter");var jD=G1(pg),zD=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)?Qn: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 HD=Yl(function(u,d,S){gr.call(u,S)?u[S].push(d):So(u,S,[d])});function Ww(u,d,S,j){u=Mn(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 qD=Ft(function(u,d,S){var j=-1,te=typeof d=="function",ce=Mn(u)?ke(u.length):[];return ja(u,function(ye){ce[++j]=te?Ln(d,ye,S):Yc(ye,d,S)}),ce}),VD=Yl(function(u,d,S){So(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 KD=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)?na:_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?yn(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(Mn(u))return df(u)?Ps(u):u.length;var d=vn(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&&yn(u,d,S)&&(d=r),j(u,wt(d,3))}i(n4,"some"),a(n4,"some");var GD=Ft(function(u,d){if(u==null)return[];var S=d.length;return S>1&&yn(u,d[0],d[1])?d=[]:S>2&&yn(d[0],d[1],d[2])&&(d=[d[0]]),D1(u,Zr(d,1),[])}),Fh=oD||function(){return Lr.Date.now()};function i4(u,d){if(typeof d!="function")throw new ki(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,xo(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 ki(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=oa(S,$s(xg));j|=X}return xo(u,j,d,S,te)}),o4=Ft(function(u,d,S){var j=O|B;if(S.length){var te=oa(S,$s(o4));j|=X}return xo(d,j,u,S,te)});function Tg(u,d,S){d=S?r:d;var j=xo(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=xo(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 ki(c);d=ii(d)||0,Mr(S)&&(Ue=!!S.leading,je="maxWait"in S,ce=je?Gr(ii(S.maxWait)||0,d):ce,Ye="trailing"in S?!!S.trailing:Ye);function pt(Fr){var Xi=j,ua=te;return j=te=r,Fe=Fr,ye=u.apply(ua,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,ua=Fr-Fe,t8=d-Xi;return je?mn(t8,ce-ua):t8}i(Lt,"remainingWait"),a(Lt,"remainingWait");function _t(Fr){var Xi=Fr-xe,ua=Fr-Fe;return xe===r||Xi>=d||Xi<0||je&&ua>=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 jn(){Ee!==r&&w5(Ee),Fe=0,j=xe=te=Ee=r}i(jn,"cancel"),a(jn,"cancel");function bn(){return Ee===r?ye:Gt(Fh())}i(bn,"flush"),a(bn,"flush");function zn(){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(zn,"debounced"),a(zn,"debounced"),zn.cancel=jn,zn.flush=bn,zn}i(Mg,"debounce"),a(Mg,"debounce");var WD=Ft(function(u,d){return w1(u,1,d)}),JD=Ft(function(u,d,S){return w1(u,ii(d)||0,S)});function a4(u){return xo(u,he)}i(a4,"flip"),a(a4,"flip");function uf(u,d){if(typeof u!="function"||d!=null&&typeof d!="function")throw new ki(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||Ao),S}i(uf,"memoize"),a(uf,"memoize"),uf.Cache=Ao;function lf(u){if(typeof u!="function")throw new ki(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 ZD=bD(function(u,d){d=d.length==1&&Ot(d[0])?Tr(d[0],Fn(wt())):Tr(Zr(d,1),Fn(wt()));var S=d.length;return Ft(function(j){for(var te=-1,ce=mn(j.length,S);++te<ce;)j[te]=d[te].call(this,j[te]);return Ln(u,this,j)})}),Ig=Ft(function(u,d){var S=oa(d,$s(Ig));return xo(u,X,r,d,S)}),c4=Ft(function(u,d){var S=oa(d,$s(c4));return xo(u,Z,r,d,S)}),YD=To(function(u,d){return xo(u,q,r,r,r,d)});function u4(u,d){if(typeof u!="function")throw new ki(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 ki(c);return d=d==null?0:Gr(Nt(d),0),Ft(function(S){var j=S[d],te=ca(S,0,d);return j&&ia(te,j),Ln(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 ki(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 ti(u,_)}i(m4,"clone"),a(m4,"clone");function g4(u,d){return d=typeof d=="function"?d:r,ti(u,_,d)}i(g4,"cloneWith"),a(g4,"cloneWith");function v4(u){return ti(u,y|_)}i(v4,"cloneDeep6"),a(v4,"cloneDeep");function y4(u,d){return d=typeof d=="function"?d:r,ti(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 Ri(u,d){return u===d||u!==u&&d!==d}i(Ri,"eq4"),a(Ri,"eq");var XD=tf(ph),QD=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,eR=Os?Fn(Os):n5;function Mn(u){return u!=null&&ff(u.length)&&!Mo(u)}i(Mn,"isArrayLike2"),a(Mn,"isArrayLike");function Or(u){return kr(u)&&Mn(u)}i(Or,"isArrayLikeObject"),a(Or,"isArrayLikeObject");function w4(u){return u===!0||u===!1||kr(u)&&gn(u)==ne}i(w4,"isBoolean"),a(w4,"isBoolean");var Va=sD||Wh,tR=j2?Fn(j2):i5;function _4(u){return kr(u)&&u.nodeType===1&&!ru(u)}i(_4,"isElement"),a(_4,"isElement");function E4(u){if(u==null)return!0;if(Mn(u)&&(Ot(u)||typeof u=="string"||typeof u.splice=="function"||Va(u)||nu(u)||js(u)))return!u.length;var d=vn(u);if(d==be||d==ee)return!u.size;if(tu(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 Xc(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?Xc(u,d,r,S):!!j}i(S4,"isEqualWith"),a(S4,"isEqualWith");function Uh(u){if(!kr(u))return!1;var d=gn(u);return d==V||d==M||typeof u.message=="string"&&typeof u.name=="string"&&!ru(u)}i(Uh,"isError"),a(Uh,"isError");function x4(u){return typeof u=="number"&&g3(u)}i(x4,"isFinite2"),a(x4,"isFinite");function Mo(u){if(!Mr(u))return!1;var d=gn(u);return d==oe||d==fe||d==L||d==K}i(Mo,"isFunction2"),a(Mo,"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?Fn(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(_D(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)&&gn(u)==Re}i(Dg,"isNumber"),a(Dg,"isNumber");function ru(u){if(!kr(u)||gn(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)==tD}i(ru,"isPlainObject"),a(ru,"isPlainObject");var Rg=H2?Fn(H2):s5;function O4(u){return kg(u)&&u>=-E&&u<=E}i(O4,"isSafeInteger"),a(O4,"isSafeInteger");var N4=q2?Fn(q2):c5;function df(u){return typeof u=="string"||!Ot(u)&&kr(u)&&gn(u)==ue}i(df,"isString"),a(df,"isString");function $n(u){return typeof u=="symbol"||kr(u)&&gn(u)==Ae}i($n,"isSymbol"),a($n,"isSymbol");var nu=V2?Fn(V2):u5;function B4(u){return u===r}i(B4,"isUndefined"),a(B4,"isUndefined");function P4(u){return kr(u)&&vn(u)==Ie}i(P4,"isWeakMap"),a(P4,"isWeakMap");function L4(u){return kr(u)&&gn(u)==Pe}i(L4,"isWeakSet"),a(L4,"isWeakSet");var rR=tf(yh),nR=tf(function(u,d){return u<=d});function Og(u){if(!u)return[];if(Mn(u))return df(u)?Ii(u):Cn(u);if(Ul&&u[Ul])return i3(u[Ul]());var d=vn(u),S=d==be?Yd:d==ee?Fl:zs;return S(u)}i(Og,"toArray"),a(Og,"toArray");function Io(u){if(!u)return u===0?u:0;if(u=ii(u),u===v||u===-v){var d=u<0?-1:1;return d*R}return u===u?u:0}i(Io,"toFinite"),a(Io,"toFinite");function Nt(u){var d=Io(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 ii(u){if(typeof u=="number")return u;if($n(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):fn.test(u)?C:+u}i(ii,"toNumber"),a(ii,"toNumber");function Bg(u){return Zi(u,In(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?"":Un(u)}i(dr,"toString4"),a(dr,"toString");var iR=Fs(function(u,d){if(tu(d)||Mn(d)){Zi(d,Wr(d),u);return}for(var S in d)gr.call(d,S)&&Jc(u,S,d[S])}),U4=Fs(function(u,d){Zi(d,In(d),u)}),$h=Fs(function(u,d,S,j){Zi(d,In(d),u,j)}),oR=Fs(function(u,d,S,j){Zi(d,Wr(d),u,j)}),aR=To(dh);function $4(u,d){var S=Wc(u);return d==null?S:y1(S,d)}i($4,"create2"),a($4,"create");var sR=Ft(function(u,d){u=br(u);var S=-1,j=d.length,te=j>2?d[2]:r;for(te&&yn(d[0],d[1],te)&&(j=1);++S<j;)for(var ce=d[S],ye=In(ce),Ee=-1,xe=ye.length;++Ee<xe;){var Fe=ye[Ee],Ue=u[Fe];(Ue===r||Ri(Ue,Vc[Fe])&&!gr.call(u,Fe))&&(u[Fe]=ce[Fe])}return u}),cR=Ft(function(u){return u.push(r,eg),Ln(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),In)}i(H4,"forIn"),a(H4,"forIn");function q4(u,d){return u==null?u:X3(u,wt(d,3),In)}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,In(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 uR=J1(function(u,d,S){d!=null&&typeof d.toString!="function"&&(d=th.call(d)),u[d]=S},Hh(kn)),lR=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),fR=Ft(Yc);function Wr(u){return Mn(u)?g1(u):vh(u)}i(Wr,"keys"),a(Wr,"keys");function In(u){return Mn(u)?g1(u,!0):l5(u)}i(In,"keysIn"),a(In,"keysIn");function Z4(u,d){var S={};return d=wt(d,3),Ji(u,function(j,te,ce){So(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){So(S,te,d(j,te,ce))}),S}i(Y4,"mapValues"),a(Y4,"mapValues");var dR=Fs(function(u,d,S){Wl(u,d,S)}),X4=Fs(function(u,d,S,j){Wl(u,d,S,j)}),hR=To(function(u,d){var S={};if(u==null)return S;var j=!1;d=Tr(d,function(ce){return ce=sa(ce,u),j||(j=ce.length>1),ce}),Zi(u,Dh(u),S),j&&(S=ti(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 pR=To(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=sa(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=Mo(ce)?ce.call(u):ce}return u}i(e_,"result"),a(e_,"result");function t_(u,d,S){return u==null?u:Qc(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:Qc(u,d,S,j)}i(r_,"setWith"),a(r_,"setWith");var n_=X1(Wr),i_=X1(In);function o_(u,d,S){var j=Ot(u),te=j||Va(u)||nu(u);if(d=wt(d,4),S==null){var ce=u&&u.constructor;te?S=j?new ce:[]:Mr(u)?S=Mo(ce)?Wc(ih(u)):{}:S={}}return(te?Qn: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,In(u))}i(u_,"valuesIn"),a(u_,"valuesIn");function l_(u,d,S){return S===r&&(S=d,d=r),S!==r&&(S=ii(S),S=S===S?S:0),d!==r&&(d=ii(d),d=d===d?d:0),$a(ii(u),d,S)}i(l_,"clamp"),a(l_,"clamp");function f_(u,d,S){return d=Io(d),S===r?(S=d,d=0):S=Io(S),u=ii(u),t5(u,d,S)}i(f_,"inRange"),a(f_,"inRange");function d_(u,d,S){if(S&&typeof S!="boolean"&&yn(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=Io(u),d===r?(d=u,u=0):d=Io(d)),u>d){var j=u;u=d,d=j}if(S||u%1||d%1){var te=v3();return mn(u+te*(d-u+qr("1e-"+((te+"").length-1))),d)}return wh(u,d)}i(d_,"random"),a(d_,"random");var mR=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,Wk).replace($d,"")}i(Fg,"deburr"),a(Fg,"deburr");function h_(u,d,S){u=dr(u),d=Un(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,Jk):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 gR=Us(function(u,d,S){return u+(S?"-":"")+d.toLowerCase()}),vR=Us(function(u,d,S){return u+(S?" ":"")+d.toLowerCase()}),yR=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),fD(dr(u).replace(et,""),d||0)}i(b_,"parseInt2"),a(b_,"parseInt");function w_(u,d,S){return(S?yn(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 bR=Us(function(u,d,S){return u+(S?"_":"")+d.toLowerCase()});function E_(u,d,S){return S&&typeof S!="number"&&yn(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=Un(d),!d&&Bs(u))?ca(Ii(u),0,S):u.split(d,S)):[]}i(E_,"split"),a(E_,"split");var wR=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=Un(d),u.slice(S,S+d.length)==d}i(A_,"startsWith"),a(A_,"startsWith");function S_(u,d,S){var j=se.templateSettings;S&&yn(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["+ ++zc+"]")+`
|
|
27
27
|
`;u.replace(Ye,function(_t,Ht,Gt,jn,bn,zn){return Gt||(Gt=jn),je+=u.slice(Fe,zn).replace(nn,t3),Ht&&(Ee=!0,je+=`' +
|
|
@@ -841,7 +841,7 @@ HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
|
|
|
841
841
|
`;function XC(e){return typeof e=="string"&&(e=A0(e)),Fm(zC([A0(Iz),A0(String(e.length)),e]))}i(XC,"hashMessage");a(XC,"hashMessage");var Pt=ir(xx()),Ea=ir(wm());function Fc(e,t,r){return r={path:t,exports:{},require:function(n,o){return QC(n,o??r.path)}},e(r,r.exports),r.exports}i(Fc,"createCommonjsModule");a(Fc,"createCommonjsModule");function QC(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}i(QC,"commonjsRequire");a(QC,"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 lo=Fc(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")}),wi=Fc(function(e,t){"use strict";var r=t;r.assert=J6,r.toArray=lo.toArray,r.zero2=lo.zero2,r.toHex=lo.toHex,r.encode=lo.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=wi.getNAF,kz=wi.getJSF,X0=wi.assert;function Ra(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(Ra,"BaseCurve");a(Ra,"BaseCurve");var Uc=Ra;Ra.prototype.point=a(i(function(){throw new Error("Not implemented")},"point"),"point");Ra.prototype.validate=a(i(function(){throw new Error("Not implemented")},"validate"),"validate");Ra.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");Ra.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");Ra.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],W=kz(n[x],n[D]);for(p=Math.max(W[0].length,p),h[x]=new Array(p),h[D]=new Array(p),y=0;y<p;y++){var $=W[0][y]|0,z=W[1][y]|0;h[x][y]=B[($+1)*3+(z+1)],h[D][y]=0,l[x]=O}}var X=this.jpoint(null,null,null),Z=this._wnafT4;for(m=p;m>=0;m--){for(var k=0;m>=0;){var q=!0;for(y=0;y<o;y++)Z[y]=h[y][m]|0,Z[y]!==0&&(q=!1);if(!q)break;k++,m--}if(m>=0&&k++,X=X.dblp(k),m<0)break;for(y=0;y<o;y++){var he=Z[y];he!==0&&(he>0?b=l[y][he-1>>1]:he<0&&(b=l[y][-he-1>>1].neg()),b.type==="affine"?X=X.mixedAdd(b):X=X.add(b))}}for(m=0;m<o;m++)l[m]=null;return s?X:X.toP()},"_wnafMulAdd"),"_wnafMulAdd");function _i(e,t){this.curve=e,this.type=t,this.precomputed=null}i(_i,"BasePoint");a(_i,"BasePoint");Ra.BasePoint=_i;_i.prototype.eq=a(i(function(){throw new Error("Not implemented")},"eq"),"eq");_i.prototype.validate=a(i(function(){return this.curve.validate(this)},"validate2"),"validate");Ra.prototype.decodePoint=a(i(function(t,r){t=wi.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");_i.prototype.encodeCompressed=a(i(function(t){return this.encode(t,!0)},"encodeCompressed"),"encodeCompressed");_i.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");_i.prototype.encode=a(i(function(t,r){return wi.encode(this._encode(r),t)},"encode8"),"encode");_i.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");_i.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");_i.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");_i.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");_i.prototype._getBeta=a(i(function(){return null},"_getBeta"),"_getBeta");_i.prototype.dblp=a(i(function(t){for(var r=this,n=0;n<t;n++)r=r.dbl();return r},"dblp"),"dblp");var Y6=Fc(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")}),Dz=wi.assert;function Ei(e){Uc.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(Ei,"ShortCurve");a(Ei,"ShortCurve");Y6(Ei,Uc);var Rz=Ei;Ei.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],Dz(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");Ei.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");Ei.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,W;n.cmpn(0)!==0;){var $=o.div(n);B=o.sub($.mul(n)),W=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=W;else if(y&&++O===2)break;D=B,o=n,n=B,l=s,s=W,h=c,c=z}_=B.neg(),x=W;var X=y.sqr().add(b.sqr()),Z=_.sqr().add(x.sqr());return Z.cmp(X)>=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");Ei.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");Ei.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");Ei.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");Ei.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){Uc.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,Uc.BasePoint);Ei.prototype.point=a(i(function(t,r,n){return new Jr(this,t,r,n)},"point2"),"point");Ei.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){Uc.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,Uc.BasePoint);Ei.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),W=x.redMul(B);W=W.redIAdd(W).redISub(_);var $=m.redMul(h);r+1<t&&(p=p.redMul(_)),c=O,h=$,m=W}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=Fc(function(e,t){"use strict";var r=t;r.base=Uc,r.short=Rz,r.mont=null,r.edwards=null}),x0=Fc(function(e,t){"use strict";var r=t,n=wi.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:Ea.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:Ea.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:Ea.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:Ea.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:Ea.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:Ea.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:Ea.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:Ea.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function Ta(e){if(!(this instanceof Ta))return new Ta(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=lo.toArray(e.entropy,e.entropyEnc||"hex"),r=lo.toArray(e.nonce,e.nonceEnc||"hex"),n=lo.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(Ta,"HmacDRBG");a(Ta,"HmacDRBG");var eM=Ta;Ta.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");Ta.prototype._hmac=a(i(function(){return new Ea.default.hmac(this.hash,this.K)},"hmac"),"hmac");Ta.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");Ta.prototype.reseed=a(i(function(t,r,n,o){typeof r!="string"&&(o=n,n=r,r=null),t=lo.toArray(t,r),n=lo.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");Ta.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=lo.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++,lo.encode(c,r)},"generate"),"generate");var Rb=wi.assert;function un(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(un,"KeyPair");a(un,"KeyPair");var X6=un;un.fromPublic=a(i(function(t,r,n){return r instanceof un?r:new un(t,{pub:r,pubEnc:n})},"fromPublic"),"fromPublic");un.fromPrivate=a(i(function(t,r,n){return r instanceof un?r:new un(t,{priv:r,privEnc:n})},"fromPrivate"),"fromPrivate");un.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");un.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");un.prototype.getPrivate=a(i(function(t){return t==="hex"?this.priv.toString(16,2):this.priv},"getPrivate"),"getPrivate");un.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");un.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");un.prototype.derive=a(i(function(t){return t.validate()||Rb(t.validate(),"public point not validated"),t.mul(this.priv).getX()},"derive"),"derive");un.prototype.sign=a(i(function(t,r,n){return this.ec.sign(t,this,r,n)},"sign2"),"sign");un.prototype.verify=a(i(function(t,r){return this.ec.verify(t,r,this)},"verify2"),"verify");un.prototype.inspect=a(i(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect3"),"inspect");var Oz=wi.assert;function Md(e,t){if(e instanceof Md)return e;this._importDER(e,t)||(Oz(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 tM(){this.place=0}i(tM,"Position");a(tM,"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=wi.toArray(t,r);var n=new tM;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),wi.encode(c,t)},"toDER"),"toDER");var Nz=a(function(){throw new Error("unsupported")},"rand"),rM=wi.assert;function yi(e){if(!(this instanceof yi))return new yi(e);typeof e=="string"&&(rM(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(yi,"EC");a(yi,"EC");var Bz=yi;yi.prototype.keyPair=a(i(function(t){return new X6(this,t)},"keyPair"),"keyPair");yi.prototype.keyFromPrivate=a(i(function(t,r){return X6.fromPrivate(this,t,r)},"keyFromPrivate"),"keyFromPrivate");yi.prototype.keyFromPublic=a(i(function(t,r){return X6.fromPublic(this,t,r)},"keyFromPublic"),"keyFromPublic");yi.prototype.genKeyPair=a(i(function(t){t||(t={});for(var r=new eM({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Nz(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");yi.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");yi.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 eM({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");yi.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");yi.prototype.recoverPubKey=function(e,t,r,n){rM((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)};yi.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 Pz=Fc(function(e,t){"use strict";var r=t;r.version="6.5.4",r.utils=wi,r.rand=function(){throw new Error("unsupported")},r.curve=S0,r.curves=x0,r.ec=Bz,r.eddsa=null}),Lz=Pz.ec,Fz="signing-key/5.7.0",Nb=new vr(Fz),eb=null;function uo(){return eb||(eb=new Lz("secp256k1")),eb}i(uo,"getCurve");a(uo,"getCurve");var nM=i(class{constructor(e){Nu(this,"curve","secp256k1"),Nu(this,"privateKey",Rn(e)),qC(this.privateKey)!==32&&Nb.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let t=uo().keyFromPrivate(zr(this.privateKey));Nu(this,"publicKey","0x"+t.getPublic(!1,"hex")),Nu(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Nu(this,"_isSigningKey",!0)}_addPoint(e){let t=uo().keyFromPublic(zr(this.publicKey)),r=uo().keyFromPublic(zr(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){let t=uo().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:Ac("0x"+n.r.toString(16),32),s:Ac("0x"+n.s.toString(16),32)})}computeSharedSecret(e){let t=uo().keyFromPrivate(zr(this.privateKey)),r=uo().keyFromPublic(zr(Q6(e)));return Ac("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}},"SigningKey");a(nM,"SigningKey");function iM(e,t){let r=K6(t),n={r:zr(r.r),s:zr(r.s)};return"0x"+uo().recoverPubKey(zr(e),n,r.recoveryParam).encode("hex",!1)}i(iM,"recoverPublicKey");a(iM,"recoverPublicKey");function Q6(e,t){let r=zr(e);if(r.length===32){let n=new nM(r);return t?"0x"+uo().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return t?Rn(r):"0x"+uo().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return t?"0x"+uo().keyFromPublic(r).getPublic(!0,"hex"):Rn(r)}return Nb.throwArgumentError("invalid public or private key","key","[REDACTED]")}i(Q6,"computePublicKey");a(Q6,"computePublicKey");var Uz="transactions/5.7.0",lY=new vr(Uz),FA;(function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"})(FA||(FA={}));function oM(e){let t=Q6(e);return WC(kb(Fm(kb(t,1)),12))}i(oM,"computeAddress");a(oM,"computeAddress");function aM(e,t){return oM(iM(zr(e),t))}i(aM,"recoverAddress");a(aM,"recoverAddress");var $z="wallet/5.7.0",fY=new vr($z);function Bb(e,t){return aM(XC(e),t)}i(Bb,"verifyMessage");a(Bb,"verifyMessage");function sM(){return{eip191:async(e,t)=>{cM(e,t)}}}i(sM,"getEIP191Verifier");a(sM,"getEIP191Verifier");var jz=new Date("2022-09-20").valueOf();function cM(e,t){q6(e),UC(e,t);let n=[Bb(Cb.fromCacao(e).toMessage(),e.s.s).toLowerCase()];if(Date.parse(e.p.iat)<=jz){let s=Bb(LC(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(cM,"verifyEIP191Signature");a(cM,"verifyEIP191Signature");_d();m6();var zz=ir(sl(),1);_d();function uM(){return Cr((0,zz.randomBytes)(16),"base64")}i(uM,"randomString");a(uM,"randomString");var lM="base64pad",fM="base64url";function dM(e){return Cr(e,lM)}i(dM,"encodeBase64");a(dM,"encodeBase64");function hM(e){return Cr(e,fM)}i(hM,"encodeBase64Url");a(hM,"encodeBase64Url");function pM(e){return xr(e,lM)}i(pM,"decodeBase64");a(pM,"decodeBase64");function M0(e){return JSON.parse(Cr(xr(e,fM)))}i(M0,"base64urlToJSON");a(M0,"base64urlToJSON");function mM(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(mM,"fromDagJWS");a(mM,"fromDagJWS");function gM(e,t){if(t){let r=t.toISOString().split(".")[0]+"Z";return`${e}?versionTime=${r}`}else return e}i(gM,"didWithTime");a(gM,"didWithTime");function vM(e){return e?Array.isArray(e)?e:[e]:[]}i(vM,"extractControllers");a(vM,"extractControllers");var Hz={...sM()};function yM(e){return"registry"in e&&"cache"in e}i(yM,"isResolver");a(yM,"isResolver");var bM=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 bM({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=yM(e)?e:new Dx(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=uM(),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 gC(e),o=hM(r.bytes);Object.assign(t,{linkedBlock:dM(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:Hz},t),typeof e!="string"&&(e=mM(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=gM(t.issuer,t.atTime),m=(await this.resolve(h)).didDocument?.controller,y=vM(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||[];Gx(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 jj(t,this._resolver);return $j(e,n,r.protectedHeader,r.aad)}async createDagJWE(e,t,r={}){let n=await wC(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 pM(r)}async decryptDagJWE(e){let t=await this.decryptJWE(e);return _C(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(bM,"DID");function qz(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(qz,"toUint8Array");a(qz,"toUint8Array");var UA=ir(Em(),1);l6();var wM={};Ar(wM,{keyToDidDoc:()=>_M});function _M(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(_M,"keyToDidDoc");a(_M,"keyToDidDoc");var EM={};Ar(EM,{keyToDidDoc:()=>SM});_d();var Vz=ir(v6(),1);function AM(e){let t=new Uint8Array(e.length+2);return t[0]=236,t[1]=1,t.set(e,2),`z${Cr(t,"base58btc")}`}i(AM,"encodeKey");a(AM,"encodeKey");function SM(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,o=(0,Vz.convertPublicKeyToX25519)(e),s=`${r}#${AM(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(SM,"keyToDidDoc2");a(SM,"keyToDidDoc");var xM={};Ar(xM,{keyToDidDoc:()=>UM,pubKeyBytesToXY:()=>n2});var TM={};Ar(TM,{ECPointDecompress:()=>NM});function CM(e){return e>=0?e:-e}i(CM,"n");a(CM,"n");function MM(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(MM,"r");a(MM,"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=MM(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 IM(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(IM,"i");a(IM,"i");function kM(e){return e.map(t=>t[0]**(t[1]-1n)*(t[0]-1n)).reduce((t,r)=>r*t,1n)}i(kM,"a");a(kM,"a");function Hu(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(Hu(e,CM(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=>kM([b])),y=m.map((b,_)=>Hu(s,c%b,p[_]));return IM(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(Hu,"s");a(Hu,"s");var Wn={};Ar(Wn,{pubKeyBytesToHex:()=>DM,publicKeyHexToUint8ArrayPointPair:()=>t2,publicKeyIntToUint8ArrayPointPair:()=>r2,publicKeyIntToXY:()=>OM,publicKeyToXY:()=>RM,testHexString:()=>$m,testUint8Array:()=>vl});f6();function DM(e){if(!vl(e))throw new TypeError("input must be a Uint8Array");return Cr(e,"base16")}i(DM,"pubKeyBytesToHex");a(DM,"pubKeyBytesToHex");function RM(e){if(!$m(e))throw new TypeError("input must be string with characters 0-9,A-F,a-f");let t=t2(e),r=$u.encode(t.xOctet).slice(1),n=$u.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(RM,"publicKeyToXY");a(RM,"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 OM(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=$u.encode(t.xOctet).slice(1),n=$u.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(OM,"publicKeyIntToXY");a(OM,"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 NM(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=Hu(h,o,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(NM,"ECPointDecompress");a(NM,"ECPointDecompress");var BM={};Ar(BM,{ECPointDecompress:()=>PM});function PM(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=Hu(h,o,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(PM,"ECPointDecompress2");a(PM,"ECPointDecompress");var LM={};Ar(LM,{ECPointDecompress:()=>FM});function FM(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=Hu(h,o,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(FM,"ECPointDecompress3");a(FM,"ECPointDecompress");function UM(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(UM,"keyToDidDoc3");a(UM,"keyToDidDoc");function n2(e){if(!Wn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Wn.pubKeyBytesToHex(e),r=t.length/2;if(r==64)return Wn.publicKeyToXY(t);if(r==65&&t.slice(0,2)=="04"){let n=t.slice(2);return Wn.publicKeyToXY(n)}if(r==33&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let n=xr(t,"base16"),o=TM.ECPointDecompress(n);return Wn.publicKeyIntToXY(o)}throw new Error("Unexpected pubKeyBytes")}i(n2,"pubKeyBytesToXY");a(n2,"pubKeyBytesToXY");var $M={};Ar($M,{keyToDidDoc:()=>jM,pubKeyBytesToXY:()=>i2});function jM(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(jM,"keyToDidDoc4");a(jM,"keyToDidDoc");function i2(e){if(!Wn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Wn.pubKeyBytesToHex(e),r=t.length/2;if(r==96)return Wn.publicKeyToXY(t);if(r==97&&t.slice(0,2)=="04"){let n=t.slice(2);return Wn.publicKeyToXY(n)}if(r==49&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let n=xr(t,"base16"),o=BM.ECPointDecompress(n);return Wn.publicKeyIntToXY(o)}throw new Error("Unexpected pubKeyBytes")}i(i2,"pubKeyBytesToXY2");a(i2,"pubKeyBytesToXY");var zM={};Ar(zM,{keyToDidDoc:()=>HM,pubKeyBytesToXY:()=>o2});function HM(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(HM,"keyToDidDoc5");a(HM,"keyToDidDoc");function o2(e){if(!Wn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Wn.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=LM.ECPointDecompress(r);return Wn.publicKeyIntToXY(n)}throw new Error("Unexpected pubKeyBytes")}i(o2,"pubKeyBytesToXY3");a(o2,"pubKeyBytesToXY");var Kz="application/did+ld+json",$A="application/did+json",Gz={231:wM,237:EM,4608:xM,4609:$M,4610:zM};function Wz(){return{key:async(e,t,r,n)=>{let o=n.accept||$A,s={didResolutionMetadata:{contentType:o},didDocument:null,didDocumentMetadata:{}};try{let c=so.decode(t.id),l=UA.default.decode(c),h=c.slice(UA.default.decode.bytes),p=await Gz[l].keyToDidDoc(h,t.id);o===Kz?(p["@context"]="https://w3id.org/did/v1",s.didDocument=p):o===$A?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(Wz,"getResolver");a(Wz,"getResolver");var qM=ir(v6(),1),Jz=ir(sj(),1),Zz="base64pad";function Pb(e){return JSON.parse((0,Jz.default)(e))}i(Pb,"toStableObject");a(Pb,"toStableObject");function VM(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(VM,"encodeDID");a(VM,"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 jA=a(async(e,t,r,n={})=>{let o=`${t}#${t.split(":")[2]}`,s=zx(r),c=Pb(Object.assign(n,{kid:o,alg:"EdDSA"}));return Lj(typeof e=="string"?e:Pb(e),s,c)},"sign"),Yz={did_authenticate:async({did:e,secretKey:t},r)=>{let n=await jA({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 jA(r.payload,e,t,r.protected);return{jws:Lb(o)}},did_decryptJWE:async({secretKey:e},t)=>{let r=tT((0,qM.convertSecretKeyToX25519)(e));try{let n=await Uj(t.jwe,r);return{cleartext:Cr(n,Zz)}}catch(n){throw new bs(-32e3,n.message)}}},Xz=i(class{constructor(e){let{secretKey:t,publicKey:r}=(0,qM.generateKeyPairFromSeed)(e),n=VM(r),o=NC(Yz);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(Xz,"Ed25519Provider");var KM={};Ar(KM,{JsonPatchError:()=>Pr,_areEquals:()=>qu,applyOperation:()=>ps,applyPatch:()=>jm,applyReducer:()=>WM,deepClone:()=>tH,getValueByPointer:()=>od,validate:()=>s2,validator:()=>ad});var Qz=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)}}(),eH=Object.prototype.hasOwnProperty;function Q0(e,t){return eH.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 Jn(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}i(Jn,"_deepClone");a(Jn,"_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 GM=function(e){Qz(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=GM,tH=Jn,Pu={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=Jn(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:Jn(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:qu(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},rH={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:Pu.move,copy:Pu.copy,test:Pu.test,_get:Pu._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=qu(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=Jn(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=rH[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=Pu[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=Jn(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 WM(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(WM,"applyReducer");a(WM,"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(Pu[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(Jn(t),Jn(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 qu(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(!qu(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],!qu(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}i(qu,"_areEquals");a(qu,"_areEquals");var JM={};Ar(JM,{compare:()=>tI,generate:()=>nm,observe:()=>eI,unobserve:()=>QM});var c2=new WeakMap,nH=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror2"),a(e,"Mirror"),e}(),iH=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo2"),a(e,"ObserverInfo"),e}();function ZM(e){return c2.get(e)}i(ZM,"getMirror");a(ZM,"getMirror");function YM(e,t){return e.observers.get(t)}i(YM,"getObserverFromMirror");a(YM,"getObserverFromMirror");function XM(e,t){e.observers.delete(t.callback)}i(XM,"removeObserverFromMirror");a(XM,"removeObserverFromMirror");function QM(e,t){t.unobserve()}i(QM,"unobserve");a(QM,"unobserve");function eI(e,t){var r=[],n,o=ZM(e);if(!o)o=new nH(e),c2.set(e,o);else{var s=YM(o,t);n=s&&s.observer}if(n)return n;if(n={},o.value=Jn(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),XM(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 iH(t,n)),n}i(eI,"observe");a(eI,"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:Jn(y)}),r.push({op:"replace",path:n+"/"+ds(m),value:Jn(b)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+ds(m),value:Jn(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:Jn(t[m])})}}}i(zm,"_generate");a(zm,"_generate");function tI(e,t,r){r===void 0&&(r=!1);var n=[];return zm(e,t,n,"",r),n}i(tI,"compare3");a(tI,"compare");var rI=Object.assign({},KM,JM,{JsonPatchError:GM,deepClone:Jn,escapePathComponent:ds,unescapePathComponent:a2}),oH=ir(Ad(),1),aH=ir(sl(),1),Yn;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC"})(Yn||(Yn={}));var zA=ir(Ad(),1);Ko();wd();var nI={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function iI(e){let t=nI[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(iI,"codeByName");a(iI,"codeByName");function oI(e){let t=Object.entries(nI).find(([,r])=>r===e);if(t)return t[0];throw new Error(`No stream type registered for index ${e}`)}i(oI,"nameByCode");a(oI,"nameByCode");var Ca=i(class{},"StreamType");a(Ca,"StreamType");Ca.nameByCode=oI;Ca.codeByName=iI;var HA=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;Ko();wd();gm();var qA=ir(Em(),1);function Id(e){try{return e()}catch(t){return t}}i(Id,"tryCatch");a(Id,"tryCatch");Ko();var VA=ir(Em(),1);il();function bc(e){let t=VA.default.decode(e),r=VA.default.decode.bytes,n=e.subarray(r);return[t,n,r]}i(bc,"readVarint");a(bc,"readVarint");function aI(e){return e===0||e===1}i(aI,"isCidVersion");a(aI,"isCidVersion");function $b(e){let[t,r]=bc(e);if(!aI(t))throw new Error(`Unknown CID version ${t}`);let[n,o]=bc(r),[,s,c]=bc(o),[l,,h]=bc(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");Ko();wd();function kd(e,t="StreamRef"){let[r,n]=bc(e);if(r!==u2)throw new Error(`Invalid ${t}, does not include streamid codec`);let[o,s]=bc(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 sH=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function Hm(e,t="StreamRef"){let r=sH.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 sI(e){try{return typeof e=="string"?jt.parse(e):jt.asCID(e)}catch{return null}}i(sI,"parseCID");a(sI,"parseCID");function l2(e,t=null){if(!t||t==="0")return null;let r=sI(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"),cI=i(class extends Error{constructor(e){super(`Invalid StreamID bytes ${Ss.encode(e)}: contains commit`)}},"InvalidStreamIDBytesError");a(cI,"InvalidStreamIDBytesError");var uI=i(class extends Error{constructor(e){super(`Invalid StreamID string ${e}: contains commit`)}},"InvalidStreamIDStringError");a(uI,"InvalidStreamIDStringError");function f2(e){let t=kd(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new cI(e)}i(f2,"fromBytes2");a(f2,"fromBytes");function lI(e){return Id(()=>f2(e))}i(lI,"fromBytesNoThrow");a(lI,"fromBytesNoThrow");function d2(e){let t=Hm(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new uI(e)}i(d2,"fromString5");a(d2,"fromString");function fI(e){return Id(()=>d2(e))}i(fI,"fromStringNoThrow");a(fI,"fromStringNoThrow");var KA=Symbol.for("@ceramicnetwork/streamid/StreamID"),Xt=i(class{constructor(e,t){if(this._tag=KA,!(e||e===0))throw new Error("StreamID constructor: type required");if(!t)throw new Error("StreamID constructor: cid required");this._type=typeof e=="string"?Ca.codeByName(e):e,this._cid=typeof t=="string"?jt.parse(t):t}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===KA}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 Ca.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let e=qA.default.encode(u2),t=qA.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=lI;Xt.fromString=d2;Xt.fromStringNoThrow=fI;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"),Zn=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"),_a=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"),Ou,mc,Hf,dI=i(class extends Error{constructor(e){super(`Error while parsing CommitID from bytes ${Ss.encode(e)}: no commit information provided`)}},"InvalidCommitIDBytesError");a(dI,"InvalidCommitIDBytesError");var hI=i(class extends Error{constructor(e){super(`Error while parsing CommitID from string ${e}: no commit information provided`)}},"InvalidCommitIDStringError");a(hI,"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 dI(e)}i(h2,"fromBytes3");a(h2,"fromBytes");function pI(e){return Id(()=>h2(e))}i(pI,"fromBytesNoThrow2");a(pI,"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 hI(e)}i(p2,"fromString6");a(p2,"fromString");function mI(e){return Id(()=>p2(e))}i(mI,"fromStringNoThrow2");a(mI,"fromStringNoThrow");var GA=Symbol.for("@ceramicnetwork/streamid/CommitID");function gI(e,t){return new _r(e.type,e.cid,t)}i(gI,"make");a(gI,"make");var _r=i(class{constructor(e,t,r=null){if(this._tag=GA,Ou.set(this,void 0),mc.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,Ou,typeof e=="string"?Ca.codeByName(e):e,"f"),rb(this,mc,typeof t=="string"?jt.parse(t):t,"f"),rb(this,Hf,l2(_a(this,mc,"f"),r),"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===GA}get baseID(){return new Xt(_a(this,Ou,"f"),_a(this,mc,"f"))}get type(){return _a(this,Ou,"f")}get typeName(){return Ca.nameByCode(_a(this,Ou,"f"))}get cid(){return _a(this,mc,"f")}get commit(){return _a(this,Hf,"f")||_a(this,mc,"f")}get bytes(){let e=HA.default.encode(u2),t=HA.default.encode(this.type),r=_a(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()}`}[(Ou=new WeakMap,mc=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=pI;_r.fromString=p2;_r.fromStringNoThrow=mI;_r.make=gI;yl([Gi(),Zn("design:type",Xt),Zn("design:paramtypes",[])],_r.prototype,"baseID",null);yl([Gi(),Zn("design:type",String),Zn("design:paramtypes",[])],_r.prototype,"typeName",null);yl([Gi(),Zn("design:type",jt),Zn("design:paramtypes",[])],_r.prototype,"commit",null);yl([Gi(),Zn("design:type",Uint8Array),Zn("design:paramtypes",[])],_r.prototype,"bytes",null);yl([Gi(),Zn("design:type",Function),Zn("design:paramtypes",[]),Zn("design:returntype",String)],_r.prototype,"toString",null);yl([Gi(),Zn("design:type",Function),Zn("design:paramtypes",[]),Zn("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 Zo(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(Zo,"__extends2");a(Zo,"__extends");function vI(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(vI,"__awaiter");a(vI,"__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 Tc(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(Tc,"__values");a(Tc,"__values");function Ma(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(Ma,"__read");a(Ma,"__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 Sc(e){return this instanceof Sc?(this.v=e,this):new Sc(e)}i(Sc,"__await");a(Sc,"__await");function yI(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 Sc?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(yI,"__asyncGenerator");a(yI,"__asyncGenerator");function bI(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 Tc=="function"?Tc(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(bI,"__asyncValues");a(bI,"__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=Tc(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=Tc(y),_=b.next();!_.done;_=b.next()){var x=_.value;try{zb(x)}catch(D){s=s??[],D instanceof nb?s=_s(_s([],Ma(s)),Ma(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}(),wI=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 $c={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],Ma(r))):setTimeout.apply(void 0,_s([e,t],Ma(r)))},clearTimeout:function(e){var t=im.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function v2(e){im.setTimeout(function(){var t=$c.onUnhandledError;if(t)t(e);else throw e})}i(v2,"reportUnhandledError");a(v2,"reportUnhandledError");function Hb(){}i(Hb,"noop");a(Hb,"noop");var cH=function(){return Vm("C",void 0,void 0)}();function _I(e){return Vm("E",void 0,e)}i(_I,"errorNotification");a(_I,"errorNotification");function EI(e){return Vm("N",e,void 0)}i(EI,"nextNotification");a(EI,"nextNotification");function Vm(e,t,r){return{kind:e,value:t,error:r}}i(Vm,"createNotification");a(Vm,"createNotification");var wc=null;function Zf(e){if($c.useDeprecatedSynchronousErrorHandling){var t=!wc;if(t&&(wc={errorThrown:!1,error:null}),e(),t){var r=wc,n=r.errorThrown,o=r.error;if(wc=null,n)throw o}}else e()}i(Zf,"errorContext");a(Zf,"errorContext");function AI(e){$c.useDeprecatedSynchronousErrorHandling&&wc&&(wc.errorThrown=!0,wc.error=e)}i(AI,"captureError");a(AI,"captureError");var y2=function(e){Zo(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=fH,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(EI(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?k0(_I(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?k0(cH,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),uH=Function.prototype.bind;function I0(e,t){return uH.call(e,t)}i(I0,"bind");a(I0,"bind");var lH=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){Zo(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&&$c.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 lH(c),s}return i(t,"SafeSubscriber2"),a(t,"SafeSubscriber"),t}(y2);function Gf(e){$c.useDeprecatedSynchronousErrorHandling?AI(e):v2(e)}i(Gf,"handleUnhandledError");a(Gf,"handleUnhandledError");function SI(e){throw e}i(SI,"defaultErrorHandler");a(SI,"defaultErrorHandler");function k0(e,t){var r=$c.onStoppedNotification;r&&im.setTimeout(function(){return r(e,t)})}i(k0,"handleStoppedNotification");a(k0,"handleStoppedNotification");var fH={closed:!0,next:Hb,error:SI,complete:Hb},b2=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Km(e){return e}i(Km,"identity3");a(Km,"identity");function xI(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(xI,"pipeFromArray");a(xI,"pipeFromArray");var ln=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=CI(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 xI(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??$c.Promise)!==null&&t!==void 0?t:Promise}i(Vb,"getPromiseCtor");a(Vb,"getPromiseCtor");function TI(e){return e&&Er(e.next)&&Er(e.error)&&Er(e.complete)}i(TI,"isObserver");a(TI,"isObserver");function CI(e){return e&&e instanceof y2||TI(e)&&g2(e)}i(CI,"isSubscriber");a(CI,"isSubscriber");function MI(e){return Er(e?.lift)}i(MI,"hasLift");a(MI,"hasLift");function Yo(e){return function(t){if(MI(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(Yo,"operate");a(Yo,"operate");function mo(e,t,r,n,o){return new dH(e,t,r,n,o)}i(mo,"createOperatorSubscriber");a(mo,"createOperatorSubscriber");var dH=function(e){Zo(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),hH=qm(function(e){return a(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),II=function(e){Zo(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 WA(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new hH},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=Tc(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?wI:(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 ln;return r.source=this,r},t.create=function(r,n){return new WA(r,n)},t}(ln),WA=function(e){Zo(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:wI},t}(II),pH=function(e){Zo(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}(II),kI={now:function(){return(kI.delegate||Date).now()},delegate:void 0},mH=function(e){Zo(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],Ma(r))):setInterval.apply(void 0,_s([e,t],Ma(r)))},clearInterval:function(e){var t=om.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},gH=function(e){Zo(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}(mH),JA=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=kI.now,e}(),vH=function(e){Zo(t,e);function t(r,n){n===void 0&&(n=JA.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}(JA),yH=new vH(gH),bH=yH,DI=new ln(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 RI(e){return w2(_2(e))?e.pop():void 0}i(RI,"popScheduler");a(RI,"popScheduler");function OI(e,t){return typeof _2(e)=="number"?e.pop():t}i(OI,"popNumber");a(OI,"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 NI(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(NI,"getSymbolIterator");a(NI,"getSymbolIterator");var BI=NI();function C2(e){return Er(e?.[BI])}i(C2,"isIterable");a(C2,"isIterable");function M2(e){return yI(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,Sc(r.read())];case 3:return n=c.sent(),o=n.value,s=n.done,s?[4,Sc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,Sc(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 Oa(e){if(e instanceof ln)return e;if(e!=null){if(S2(e))return PI(e);if(E2(e))return LI(e);if(A2(e))return FI(e);if(x2(e))return k2(e);if(C2(e))return UI(e);if(I2(e))return $I(e)}throw T2(e)}i(Oa,"innerFrom");a(Oa,"innerFrom");function PI(e){return new ln(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(PI,"fromInteropObservable");a(PI,"fromInteropObservable");function LI(e){return new ln(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(LI,"fromArrayLike");a(LI,"fromArrayLike");function FI(e){return new ln(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,v2)})}i(FI,"fromPromise");a(FI,"fromPromise");function UI(e){return new ln(function(t){var r,n;try{for(var o=Tc(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(UI,"fromIterable");a(UI,"fromIterable");function k2(e){return new ln(function(t){jI(e,t).catch(function(r){return t.error(r)})})}i(k2,"fromAsyncIterable");a(k2,"fromAsyncIterable");function $I(e){return k2(M2(e))}i($I,"fromReadableStreamLike");a($I,"fromReadableStreamLike");function jI(e,t){var r,n,o,s;return vI(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=bI(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(jI,"process2");a(jI,"process");function xa(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(xa,"executeSchedule");a(xa,"executeSchedule");function D2(e,t){return t===void 0&&(t=0),Yo(function(r,n){r.subscribe(mo(n,function(o){return xa(n,e,function(){return n.next(o)},t)},function(){return xa(n,e,function(){return n.complete()},t)},function(o){return xa(n,e,function(){return n.error(o)},t)}))})}i(D2,"observeOn");a(D2,"observeOn");function R2(e,t){return t===void 0&&(t=0),Yo(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(R2,"subscribeOn");a(R2,"subscribeOn");function zI(e,t){return Oa(e).pipe(R2(t),D2(t))}i(zI,"scheduleObservable");a(zI,"scheduleObservable");function HI(e,t){return Oa(e).pipe(R2(t),D2(t))}i(HI,"schedulePromise");a(HI,"schedulePromise");function qI(e,t){return new ln(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}i(qI,"scheduleArray");a(qI,"scheduleArray");function VI(e,t){return new ln(function(r){var n;return xa(r,t,function(){n=e[BI](),xa(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(VI,"scheduleIterable");a(VI,"scheduleIterable");function O2(e,t){if(!e)throw new Error("Iterable cannot be null");return new ln(function(r){xa(r,t,function(){var n=e[Symbol.asyncIterator]();xa(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 KI(e,t){return O2(M2(e),t)}i(KI,"scheduleReadableStreamLike");a(KI,"scheduleReadableStreamLike");function GI(e,t){if(e!=null){if(S2(e))return zI(e,t);if(E2(e))return qI(e,t);if(A2(e))return HI(e,t);if(x2(e))return O2(e,t);if(C2(e))return VI(e,t);if(I2(e))return KI(e,t)}throw T2(e)}i(GI,"scheduled");a(GI,"scheduled");function WI(e,t){return t?GI(e,t):Oa(e)}i(WI,"from3");a(WI,"from");var JI=qm(function(e){return a(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function ZI(e){return e instanceof Date&&!isNaN(e)}i(ZI,"isValidDate");a(ZI,"isValidDate");function N2(e,t){return Yo(function(r,n){var o=0;r.subscribe(mo(n,function(s){n.next(e.call(t,s,o++))}))})}i(N2,"map");a(N2,"map");var wH=Array.isArray;function YI(e,t){return wH(t)?e.apply(void 0,_s([],Ma(t))):e(t)}i(YI,"callOrApply");a(YI,"callOrApply");function XI(e){return N2(function(t){return YI(e,t)})}i(XI,"mapOneOrManyArgs");a(XI,"mapOneOrManyArgs");function QI(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;Oa(r(D,m++)).subscribe(mo(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 W=h.shift();c?xa(t,c,function(){return x(W)}):x(W)},"_loop_1");h.length&&p<n;)B();b()}catch(W){t.error(W)}}))},"doInnerSub");return e.subscribe(mo(t,_,function(){y=!0,b()})),function(){l?.()}}i(QI,"mergeInternals");a(QI,"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)})(Oa(e(n,o)))},r):(typeof t=="number"&&(r=t),Yo(function(n,o){return QI(n,o,e,r)}))}i(Gm,"mergeMap");a(Gm,"mergeMap");function ek(e){return e===void 0&&(e=1/0),Gm(Km,e)}i(ek,"mergeAll");a(ek,"mergeAll");var _H=["addListener","removeListener"],EH=["addEventListener","removeEventListener"],AH=["on","off"];function am(e,t,r,n){if(Er(r)&&(n=r,r=void 0),n)return am(e,t,r).pipe(XI(n));var o=Ma(nk(e)?EH.map(function(l){return function(h){return e[l](t,h,r)}}):tk(e)?_H.map(Kb(e,t)):rk(e)?AH.map(Kb(e,t)):[],2),s=o[0],c=o[1];if(!s&&E2(e))return Gm(function(l){return am(l,t,r)})(Oa(e));if(!s)throw new TypeError("Invalid event target");return new ln(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 tk(e){return Er(e.addListener)&&Er(e.removeListener)}i(tk,"isNodeStyleEventEmitter");a(tk,"isNodeStyleEventEmitter");function rk(e){return Er(e.on)&&Er(e.off)}i(rk,"isJQueryStyleEventEmitter");a(rk,"isJQueryStyleEventEmitter");function nk(e){return Er(e.addEventListener)&&Er(e.removeEventListener)}i(nk,"isEventTarget");a(nk,"isEventTarget");function B2(e,t,r){e===void 0&&(e=0),r===void 0&&(r=bH);var n=-1;return t!=null&&(w2(t)?r=t:n=t),new ln(function(o){var s=ZI(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 ik(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=RI(e),n=OI(e,1/0),o=e;return o.length?o.length===1?Oa(o[0]):ek(n)(WI(o,r)):DI}i(ik,"merge");a(ik,"merge");function ok(e,t){return Yo(function(r,n){var o=0;r.subscribe(mo(n,function(s){return e.call(t,s,o++)&&n.next(s)}))})}i(ok,"filter");a(ok,"filter");function ak(e){return Yo(function(t,r){var n=!1;t.subscribe(mo(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}i(ak,"defaultIfEmpty");a(ak,"defaultIfEmpty");function sk(e){return e<=0?function(){return DI}:Yo(function(t,r){var n=0;t.subscribe(mo(r,function(o){++n<=e&&(r.next(o),e<=n&&r.complete())}))})}i(sk,"take");a(sk,"take");function ck(e){return e===void 0&&(e=uk),Yo(function(t,r){var n=!1;t.subscribe(mo(r,function(o){n=!0,r.next(o)},function(){return n?r.complete():r.error(e())}))})}i(ck,"throwIfEmpty");a(ck,"throwIfEmpty");function uk(){return new JI}i(uk,"defaultErrorFactory");a(uk,"defaultErrorFactory");function lk(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?ok(function(o,s){return e(o,s,n)}):Km,sk(1),r?ak(t):ck(function(){return new JI}))}}i(lk,"first");a(lk,"first");function fk(e,t){return Yo(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=Oa(e(B)).subscribe(mo(n,_,x))},"startThrottle"),O=a(function(){if(p){p=!1;var B=m;m=null,n.next(B),!b&&D(B)}},"send");r.subscribe(mo(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(fk,"throttle");a(fk,"throttle");var ZA;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(ZA||(ZA={}));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 ln{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,zA.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,zA.default)(this.state$.value)}async sync(e={}){e={sync:Yn.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 SH=ir(cj(),1);function dk(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):(ik(...e.map(r=>am(r,"abort"))).pipe(lk()).subscribe(()=>{t.abort()}),t.signal)}i(dk,"mergeAbortSignals");a(dk,"mergeAbortSignals");var hk=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(hk,"TimedAbortSignal");async function pk(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(pk,"abortable2");a(pk,"abortable");var xH=60*1e3*3;async function vi(e,t={}){t.body&&Object.assign(t,{body:JSON.stringify(t.body),headers:{...t.headers,"Content-Type":"application/json"}});let r=t.timeout||xH,n=new hk(r),o=t.signal?dk([t.signal,n.signal]):n.signal,s=await pk(o,c=>(0,SH.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(vi,"fetchJson");a(vi,"fetchJson");var b0=ir(Ad(),1);Ko();function Aa(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(Aa,"toCID");a(Aa,"toCID");var YA=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=Aa(t.jws.link),t.linkedBlock=xr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=xr(t.cacaoBlock,"base64")),t):(jr.isSignedCommit(t)&&(t.link=Aa(t.link)),jr.isAnchorCommit(t)&&(t.proof=Aa(t.proof)),t.id&&(t.id=Aa(t.id)),t.prev&&(t.prev=Aa(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!=YA&&(t.metadata.unique=Cr(t.metadata.unique,"base64")),t.doctype=Ca.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,b0.default)(e);return t.doctype&&(t.type=Ca.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:Aa(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=Aa(t.anchorProof.txHash),t.anchorProof.root=Aa(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!=YA&&(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 mk=i(class extends pH{next(e){let t=this.value;jr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");a(mk,"StreamStateSubject");var TH=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"),mi,ib={anchor:!0,publish:!0,pin:!0,sync:Yn.PREFER_CACHE},CH={sync:Yn.PREFER_CACHE},XA={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,aH.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 Ia=mi=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,oH.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 mi.makeGenesis(s,r,n);return t.createStreamFromGenesis(mi.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 mi._signDagJWS(t,r):r;return t.createStreamFromGenesis(mi.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 mi.makeGenesis(t,null,r);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...CH,...n};let o=ws.from(r);if(o.type!=mi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${mi.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async update(t,r,n={}){n={...XA,...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={...XA,...r};let o={header:D0(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await mi._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 mi._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=rI.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 mi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await Wb(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");Ia.STREAM_TYPE_NAME="tile";Ia.STREAM_TYPE_ID=0;Ia=mi=TH([Jm()],Ia);var MH=ir(uj(),1);function gk(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(gk,"_checkPrivateRedeclaration2");a(gk,"_checkPrivateRedeclaration");function vk(e,t){return t.get?t.get.call(e):t.value}i(vk,"_classApplyDescriptorGet2");a(vk,"_classApplyDescriptorGet");function yk(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(yk,"_classApplyDescriptorSet2");a(yk,"_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 vk(e,r)}i(O0,"_classPrivateFieldGet2");a(O0,"_classPrivateFieldGet");function Jb(e,t,r){gk(e,t),t.set(e,r)}i(Jb,"_classPrivateFieldInit2");a(Jb,"_classPrivateFieldInit");function Zb(e,t,r){var n=P2(e,t,"set");return yk(e,n,r),r}i(Zb,"_classPrivateFieldSet2");a(Zb,"_classPrivateFieldSet");function bk(e){return typeof e=="string"||_r.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(bk,"keyToQuery");a(bk,"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 wk(e){let t=await Ia.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(wk,"getDeterministicQuery");a(wk,"getDeterministicQuery");var IH=a(()=>Promise.resolve([]),"tempBatchLoadFn"),w0=new WeakMap,ob=new WeakMap,kH=i(class extends MH.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 Ia.create(O0(this,w0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await wk(e);try{return await super.load(r)}catch{let o=await Ia.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(IH,{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(bk),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(kH,"TileLoader");function Yb(e){return typeof e=="string"?Xt.fromString(e):e}i(Yb,"typeStreamID");a(Yb,"typeStreamID");function _k(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(_k,"serializeObjectToSearchParams");a(_k,"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 ln{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=B2(0,r).pipe(fk(()=>this._syncState(this.id,{sync:Yn.PREFER_CACHE}))).subscribe()),this.state$.subscribe(n).add(()=>{this.state$.observers.length===0&&this.periodicSubscription?.unsubscribe()})}),this.state$=new mk(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 vi(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 vi(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=_k(new URL(`./streams/${e}`,t),r),{state:o}=await vi(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 vi(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 QA=ir(Ad(),1),eS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(eS||(eS={}));var Qb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Qb||(Qb={}));var Ek=i(class extends ln{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,QA.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,QA.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(Ek,"Stream");function Ak(){return e=>{}}i(Ak,"StreamStatic2");a(Ak,"StreamStatic");function Sk(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(Sk,"normalizeAccountId");a(Sk,"normalizeAccountId");var DH="(?:%[0-9a-fA-F]{2})",tS=`(?:[a-zA-Z0-9._-]|${DH})`,RH="([a-z0-9]+)",OH=`((?:${tS}*:)*(${tS}+))`,rS="[a-zA-Z0-9_.:%-]",NH=`;${rS}+=${rS}*`,BH=`((${NH})*)`,PH="(/[^#?]*)?",LH="([?][^#]*)?",FH="(#.*)?",UH=new RegExp(`^did:${RH}:${OH}${BH}${PH}${LH}${FH}$`);function xk(e){if(e===""||!e)return null;let t=e.match(UH);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(xk,"parse2");a(xk,"parse");var $H=ir(Ad(),1),jH=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"),vc,ab=a(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),nS={anchor:!1,publish:!0,sync:cd.PREFER_CACHE},sb={anchor:!0,publish:!0},zH={sync:cd.PREFER_CACHE},Vu=vc=a(i(class extends Ek{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,$H.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...nS,...n};let o=Sk(r),s=vc.makeGenesis(o);return vc.fromGenesis(t,s,n)}static async fromGenesis(t,r,n={}){return n={...nS,...n},t.createStreamFromGenesis(vc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...sb,...n};let o=typeof t=="string"?t.trim():t.id;if(xk(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={...zH,...n};let o=ws.from(r);if(o.type!=vc.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${vc.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");Vu.STREAM_TYPE_NAME="caip10-link";Vu.STREAM_TYPE_ID=1;Vu=vc=jH([Ak()],Vu);Ko();il();var HH=ir(wj(),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},"__decorate5"),$o,VH={sync:Yn.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 Tk(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(Tk,"throwReadOnlyError3");a(Tk,"throwReadOnlyError");var Cc=$o=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:$o.MODEL}}static async create(t,r,n){$o.assertComplete(r);let o={publish:!0,anchor:!0,pin:!0,sync:Yn.NEVER_SYNC,throwOnInvalidCommit:!0},s=await $o._makeGenesis(t,r,n);return await t.createStreamFromGenesis($o.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={...VH,...n};let o=ws.from(r);if(o.type!=$o.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${$o.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 $o._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:$o.MODEL.bytes};return{data:r,header:o}}makeReadOnly(){this.sync=Tk,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await e6(t),t.did.createDagJWS(r)}},"Model2"),"Model");Cc.STREAM_TYPE_NAME="model";Cc.STREAM_TYPE_ID=2;Cc.MODEL=function(){let e=Bm("model-v1"),t=HH.default.encode(e,"identity"),r=ju(V0,t),n=jt.createV1(V0,r);return new Xt("UNLOADABLE",n)}();Cc=$o=qH([Jm()],Cc);var KH=ir(sl(),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},"__decorate6"),oo,WH={anchor:!0,publish:!0,pin:!0,sync:Yn.NEVER_SYNC,syncTimeoutSeconds:0},JH={anchor:!1,publish:!1,pin:!0,sync:Yn.PREFER_CACHE},ZH={sync:Yn.PREFER_CACHE},iS={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 Ku=oo=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={...WH,...o};let s=o.asDID?{did:o.asDID}:t,c=await oo._makeGenesis(s,r,n);return t.createStreamFromGenesis(oo.STREAM_TYPE_ID,c,o)}static async single(t,r,n={}){n={...JH,...n};let o=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let s=await oo._makeGenesis(o,null,r);return t.createStreamFromGenesis(oo.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...ZH,...n};let o=ws.from(r);if(o.type!=oo.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${oo.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async replace(t,r={}){r={...iS,...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={...iS,...r};let n={data:t,prev:this.tip,id:this.id.cid},o=await oo._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 oo._signDagJWS(t,n)}_makeRawCommit(t){return{data:rI.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):oo._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,KH.randomBytes)(12)),{data:r,header:s}}static async _signDagJWS(t,r){return await t6(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");Ku.STREAM_TYPE_NAME="MID";Ku.STREAM_TYPE_ID=3;Ku=oo=GH([Jm()],Ku);var Ck=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 vi(n,{method:"post",body:r})}async rm(e,t){let r=new URL(`./pins/${e}`,this._apiUrl);await vi(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 vi(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(Ck,"RemotePinApi");var Mk=i(class{constructor(e){this._fetchJson=vi,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(Mk,"RemoteIndexApi");var Ik=i(class{constructor(e,t){this._apiUrl=e,this._getDidFn=t,this._fetchJson=vi,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(Ik,"RemoteAdminApi");var YH="/api/v0/",XH="http://localhost:7007",QH={syncInterval:5e3},eq={anchor:!0,publish:!0,sync:Yn.PREFER_CACHE},tq={anchor:!0,publish:!0,sync:Yn.PREFER_CACHE},oS={sync:Yn.PREFER_CACHE},rq=i(class{constructor(e=XH,t={}){this._config={...QH,...t},this._apiUrl=new URL(YH,e),this._streamCache=new Map,this.context={api:this},this.pin=new Ck(this._apiUrl),this.index=new Mk(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new Ik(this._apiUrl,r),this._streamConstructors={[Vu.STREAM_TYPE_ID]:Vu,[Cc.STREAM_TYPE_ID]:Cc,[Ku.STREAM_TYPE_ID]:Ku,[Ia.STREAM_TYPE_ID]:Ia}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...tq,...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={...oS,...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 vi(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={...eq,...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={...oS,...t};let{anchorStatus:r}=await vi(`${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 vi(this._apiUrl+"/node/chains");return this._supportedChains=e,e}async close(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()}},"CeramicClient");a(rq,"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"]),nq=a(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),jo=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(jo,"ZodError");jo.create=e=>new jo(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"),kk=ud;function Dk(e){kk=e}i(Dk,"setErrorMap");a(Dk,"setErrorMap");function ld(){return kk}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"),iq=[];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 Nn=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 Nn.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(Nn,"ParseStatus");var Dt=Object.freeze({status:"aborted"}),Rk=a(e=>({status:"dirty",value:e}),"DIRTY"),An=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 go=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(go,"ParseInputLazyPath");var aS=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 jo(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 Nn,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 aS(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 aS(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 po.create(this)}nullable(){return As.create(this)}nullish(){return this.optional().nullable()}array(){return ho.create(this)}promise(){return Dc.create(this)}or(e){return Yu.create([this,e])}and(e){return Xu.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 rl({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 oq=/^c[^\s-]{8,}$/i,aq=/^([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,sq=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,cq=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"),ka=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 ka({...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 Nn,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&>(n,{code:Ge.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")sq.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")aq.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")oq.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"?cq(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 ka({...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(ka,"ZodString");ka.create=e=>{var t;return new ka({checks:[],typeName:Tt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};function Ok(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(Ok,"floatSafeRemainder");a(Ok,"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 Nn;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"?Ok(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 Gu=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 An(e.data)}},"ZodBigInt");a(Gu,"ZodBigInt");Gu.create=e=>{var t;return new Gu({typeName:Tt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};var Wu=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 An(e.data)}},"ZodBoolean");a(Wu,"ZodBoolean");Wu.create=e=>new Wu({typeName:Tt.ZodBoolean,coerce:e?.coerce||!1,...zt(e)});var Mc=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 Nn,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 Mc({...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(Mc,"ZodDate");Mc.create=e=>new Mc({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 An(e.data)}},"ZodSymbol");a(fd,"ZodSymbol");fd.create=e=>new fd({typeName:Tt.ZodSymbol,...zt(e)});var Ju=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 An(e.data)}},"ZodUndefined");a(Ju,"ZodUndefined");Ju.create=e=>new Ju({typeName:Tt.ZodUndefined,...zt(e)});var Zu=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 An(e.data)}},"ZodNull");a(Zu,"ZodNull");Zu.create=e=>new Zu({typeName:Tt.ZodNull,...zt(e)});var Ic=i(class extends $t{constructor(){super(...arguments),this._any=!0}_parse(e){return An(e.data)}},"ZodAny");a(Ic,"ZodAny");Ic.create=e=>new Ic({typeName:Tt.ZodAny,...zt(e)});var ms=i(class extends $t{constructor(){super(...arguments),this._unknown=!0}_parse(e){return An(e.data)}},"ZodUnknown");a(ms,"ZodUnknown");ms.create=e=>new ms({typeName:Tt.ZodUnknown,...zt(e)});var zo=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(zo,"ZodNever");zo.create=e=>new zo({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 An(e.data)}},"ZodVoid");a(dd,"ZodVoid");dd.create=e=>new dd({typeName:Tt.ZodVoid,...zt(e)});var ho=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 go(t,s,t.path,c)))).then(s=>Nn.mergeArray(r,s));let o=t.data.map((s,c)=>n.type._parseSync(new go(t,s,t.path,c)));return Nn.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new ho({...this._def,minLength:{value:e,message:Jt.toString(t)}})}max(e,t){return new ho({...this._def,maxLength:{value:e,message:Jt.toString(t)}})}length(e,t){return new ho({...this._def,exactLength:{value:e,message:Jt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");a(ho,"ZodArray");ho.create=(e,t)=>new ho({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 sS=a(e=>t=>new Ir({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function yc(e){if(e instanceof Ir){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=po.create(yc(n))}return new Ir({...e._def,shape:()=>t})}else return e instanceof ho?ho.create(yc(e.element)):e instanceof po?po.create(yc(e.unwrap())):e instanceof As?As.create(yc(e.unwrap())):e instanceof Ho?Ho.create(e.items.map(t=>yc(t))):e}i(yc,"deepPartialify");a(yc,"deepPartialify");var Ir=i(class extends $t{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=sS(this._def),this.extend=sS(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 zo&&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 go(n,m,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof zo){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 go(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=>Nn.mergeObjectSync(r,h)):Nn.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 yc(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 po;)o=o._def.innerType;t[r]=o}});else for(let r in this.shape){let o=this.shape[r];for(;o instanceof po;)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:zo.create(),typeName:Tt.ZodObject,...zt(t)});Ir.strictCreate=(e,t)=>new Ir({shape:()=>e,unknownKeys:"strict",catchall:zo.create(),typeName:Tt.ZodObject,...zt(t)});Ir.lazycreate=(e,t)=>new Ir({shape:e,unknownKeys:"strip",catchall:zo.create(),typeName:Tt.ZodObject,...zt(t)});var Yu=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 jo(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 jo(l));return gt(t,{code:Ge.invalid_union,unionErrors:c}),Dt}}get options(){return this._def.options}},"ZodUnion");a(Yu,"ZodUnion");Yu.create=(e,t)=>new Yu({options:e,typeName:Tt.ZodUnion,...zt(t)});var P0=a(e=>e instanceof Qu?P0(e.schema):e instanceof Vi?P0(e.innerType()):e instanceof el?[e.value]:e instanceof bl?e.options:e instanceof tl?Object.keys(e.enum):e instanceof rl?P0(e._def.innerType):e instanceof Ju?[void 0]:e instanceof Zu?[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 Xu=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(Xu,"ZodIntersection");Xu.create=(e,t,r)=>new Xu({left:e,right:t,typeName:Tt.ZodIntersection,...zt(r)});var Ho=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 go(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Nn.mergeArray(t,s)):Nn.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new Ho({...this._def,rest:e})}},"ZodTuple");a(Ho,"ZodTuple");Ho.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ho({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 go(r,c,r.path,c)),value:s._parse(new go(r,r.data[c],r.path,c))});return r.common.async?Nn.mergeObjectAsync(t,n):Nn.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:ka.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 go(r,c,r.path,[h,"key"])),value:o._parse(new go(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 kc=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 go(r,l,r.path,h)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,t){return new kc({...this._def,minSize:{value:e,message:Jt.toString(t)}})}max(e,t){return new kc({...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(kc,"ZodSet");kc.create=(e,t)=>new kc({valueType:e,minSize:null,maxSize:null,typeName:Tt.ZodSet,...zt(t)});var Fu=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 Dc?An(async(...c)=>{let l=new jo([]),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})}):An((...c)=>{let l=this._def.args.safeParse(c,o);if(!l.success)throw new jo([r(c,l.error)]);let h=s(...l.data),p=this._def.returns.safeParse(h,o);if(!p.success)throw new jo([n(h,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Fu({...this._def,args:Ho.create(e).rest(ms.create())})}returns(e){return new Fu({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Fu({args:e||Ho.create([]).rest(ms.create()),returns:t||ms.create(),typeName:Tt.ZodFunction,...zt(r)})}},"ZodFunction");a(Fu,"ZodFunction");var Qu=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(Qu,"ZodLazy");Qu.create=(e,t)=>new Qu({getter:e,typeName:Tt.ZodLazy,...zt(t)});var el=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(el,"ZodLiteral");el.create=(e,t)=>new el({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 An(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 tl=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 An(e.data)}get enum(){return this._def.values}},"ZodNativeEnum");a(tl,"ZodNativeEnum");tl.create=(e,t)=>new tl({values:e,typeName:Tt.ZodNativeEnum,...zt(t)});var Dc=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 An(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}},"ZodPromise");a(Dc,"ZodPromise");Dc.create=(e,t)=>new Dc({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 po=i(class extends $t{_parse(e){return this._getType(e)===rt.undefined?An(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodOptional");a(po,"ZodOptional");po.create=(e,t)=>new po({innerType:e,typeName:Tt.ZodOptional,...zt(t)});var As=i(class extends $t{_parse(e){return this._getType(e)===rt.null?An(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 rl=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(rl,"ZodDefault");rl.create=(e,t)=>new rl({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 uq=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(),Rk(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 Nk=a((e,t={},r)=>e?Ic.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})}}):Ic.create(),"custom"),lq={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 fq=a((e,t={message:`Input not instance of ${e.name}`})=>Nk(r=>r instanceof e,t,!0),"instanceOfType"),Bk=ka.create,Pk=Es.create,dq=gd.create,hq=Gu.create,Lk=Wu.create,pq=Mc.create,mq=fd.create,gq=Ju.create,vq=Zu.create,yq=Ic.create,bq=ms.create,wq=zo.create,_q=dd.create,Eq=ho.create,Aq=Ir.create,Sq=Ir.strictCreate,xq=Yu.create,Tq=Zm.create,Cq=Xu.create,Mq=Ho.create,Iq=hd.create,kq=pd.create,Dq=kc.create,Rq=Fu.create,Oq=Qu.create,Nq=el.create,Bq=bl.create,Pq=tl.create,Lq=Dc.create,cS=Vi.create,Fq=po.create,Uq=As.create,$q=Vi.createWithPreprocess,jq=Od.create,zq=a(()=>Bk().optional(),"ostring"),Hq=a(()=>Pk().optional(),"onumber"),qq=a(()=>Lk().optional(),"oboolean"),Vq={string:e=>ka.create({...e,coerce:!0}),number:e=>Es.create({...e,coerce:!0}),boolean:e=>Wu.create({...e,coerce:!0}),bigint:e=>Gu.create({...e,coerce:!0}),date:e=>Mc.create({...e,coerce:!0})},Kq=Dt,Q=Object.freeze({__proto__:null,defaultErrorMap:ud,setErrorMap:Dk,getErrorMap:ld,makeIssue:cm,EMPTY_PATH:iq,addIssueToContext:gt,ParseStatus:Nn,INVALID:Dt,DIRTY:Rk,OK:An,isAborted:r6,isDirty:n6,isValid:um,isAsync:lm,get util(){return nr},ZodParsedType:rt,getParsedType:hs,ZodType:$t,ZodString:ka,ZodNumber:Es,ZodBigInt:Gu,ZodBoolean:Wu,ZodDate:Mc,ZodSymbol:fd,ZodUndefined:Ju,ZodNull:Zu,ZodAny:Ic,ZodUnknown:ms,ZodNever:zo,ZodVoid:dd,ZodArray:ho,get objectUtil(){return fm},ZodObject:Ir,ZodUnion:Yu,ZodDiscriminatedUnion:Zm,ZodIntersection:Xu,ZodTuple:Ho,ZodRecord:hd,ZodMap:pd,ZodSet:kc,ZodFunction:Fu,ZodLazy:Qu,ZodLiteral:el,ZodEnum:bl,ZodNativeEnum:tl,ZodPromise:Dc,ZodEffects:Vi,ZodTransformer:Vi,ZodOptional:po,ZodNullable:As,ZodDefault:rl,ZodCatch:md,ZodNaN:gd,BRAND:uq,ZodBranded:F2,ZodPipeline:Od,custom:Nk,Schema:$t,ZodSchema:$t,late:lq,get ZodFirstPartyTypeKind(){return Tt},coerce:Vq,any:yq,array:Eq,bigint:hq,boolean:Lk,date:pq,discriminatedUnion:Tq,effect:cS,enum:Bq,function:Rq,instanceof:fq,intersection:Cq,lazy:Oq,literal:Nq,map:kq,nan:dq,nativeEnum:Pq,never:wq,null:vq,nullable:Uq,number:Pk,object:Aq,oboolean:qq,onumber:Hq,optional:Fq,ostring:zq,pipeline:jq,preprocess:$q,promise:Lq,record:Iq,set:Dq,strictObject:Sq,string:Bk,symbol:mq,transformer:cS,tuple:Mq,undefined:gq,union:xq,unknown:bq,void:_q,NEVER:Kq,ZodIssueCode:Ge,quotelessJson:nq,ZodError:jo}),Gq=Object.defineProperty,Wq=a((e,t)=>Gq(e,"name",{value:t,configurable:!0}),"__name"),Ym=Q.array(Q.string().or(Q.record(Q.any()))),gY=Q.object({type:Q.string().optional(),narrative:Q.string().optional()}),Xm=Q.string().or(Q.object({id:Q.string(),type:Q.string(),caption:Q.string().optional()})),Jq=Q.object({type:Q.string().min(1).or(Q.string().array().nonempty()),latitude:Q.number(),longitude:Q.number()}),Zq=Q.object({type:Q.string().min(1).or(Q.string().array().nonempty()),addressCountry:Q.string().optional(),addressCountryCode:Q.string().optional(),addressRegion:Q.string().optional(),addressLocality:Q.string().optional(),streetAddress:Q.string().optional(),postOfficeBoxNumber:Q.string().optional(),postalCode:Q.string().optional(),geo:Jq.optional()}),Yq=Q.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(Q.string()),Fk=Q.object({type:Q.string().min(1).or(Q.string().array().nonempty()),identifier:Q.string(),identifierType:Yq}),vd=Q.string().or(Q.object({id:Q.string().optional(),type:Q.string().or(Q.string().array().nonempty().optional()),name:Q.string().optional(),url:Q.string().optional(),phone:Q.string().optional(),description:Q.string().optional(),endorsement:Q.any().array().optional(),image:Xm.optional(),email:Q.string().email().optional(),address:Zq.optional(),otherIdentifier:Fk.array().optional(),official:Q.string().optional(),parentOrg:Q.any().optional(),familyName:Q.string().optional(),givenName:Q.string().optional(),additionalName:Q.string().optional(),patronymicName:Q.string().optional(),honorificPrefix:Q.string().optional(),honorificSuffix:Q.string().optional(),familyNamePrefix:Q.string().optional(),dateOfBirth:Q.string().optional()}).catchall(Q.any())),i6=Q.object({id:Q.string().optional()}).catchall(Q.any()),Xq=Q.object({type:Q.string(),id:Q.string()}).catchall(Q.any()),Qq=Q.object({id:Q.string(),type:Q.string()}).catchall(Q.any()),eV=Q.object({id:Q.string(),type:Q.string()}).catchall(Q.any()),hm=Q.object({"@context":Ym,id:Q.string().optional(),type:Q.string().array().nonempty(),issuer:vd,issuanceDate:Q.string(),expirationDate:Q.string().optional(),credentialSubject:i6.or(i6.array()),credentialStatus:Xq.optional(),credentialSchema:Qq.array().optional(),refreshService:eV.optional()}).catchall(Q.any()),qo=Q.object({type:Q.string(),created:Q.string(),challenge:Q.string().optional(),domain:Q.string().optional(),nonce:Q.string().optional(),proofPurpose:Q.string(),verificationMethod:Q.string(),jws:Q.string().optional()}).catchall(Q.any()),uS=hm.extend({proof:qo.or(qo.array())}),tV=Q.object({"@context":Ym,id:Q.string().optional(),type:Q.string().or(Q.string().array().nonempty()),verifiableCredential:uS.or(uS.array()).optional(),holder:Q.string().optional()}).catchall(Q.any()),vY=tV.extend({proof:qo.or(qo.array())}),Uk=Q.object({kty:Q.string(),crv:Q.string(),x:Q.string(),y:Q.string().optional(),n:Q.string().optional(),d:Q.string()}),rV=Q.object({alg:Q.string(),iv:Q.string(),tag:Q.string(),epk:Uk.partial().optional(),kid:Q.string().optional(),apv:Q.string().optional(),apu:Q.string().optional()}),nV=Q.object({header:rV,encrypted_key:Q.string()}),iV=Q.object({protected:Q.string(),iv:Q.string(),ciphertext:Q.string(),tag:Q.string(),aad:Q.string().optional(),recipients:nV.array().optional()}),gc=Q.string().or(Q.object({"@context":Ym.optional(),id:Q.string(),type:Q.string(),controller:Q.string(),publicKeyJwk:Uk.optional(),publicKeyBase58:Q.string().optional(),blockChainAccountId:Q.string().optional()}).catchall(Q.any())),oV=Q.object({id:Q.string(),type:Q.string().or(Q.string().array().nonempty()),serviceEndpoint:Q.any().or(Q.any().array().nonempty())}).catchall(Q.any()),yY=Q.object({"@context":Ym,id:Q.string(),alsoKnownAs:Q.string().optional(),controller:Q.string().or(Q.string().array().nonempty()).optional(),verificationMethod:gc.array().optional(),authentication:gc.array().optional(),assertionMethod:gc.array().optional(),keyAgreement:gc.array().optional(),capabilityInvocation:gc.array().optional(),capabilityDelegation:gc.array().optional(),publicKey:gc.array().optional(),service:oV.array().optional(),proof:qo.or(qo.array()).optional()}).catchall(Q.any()),aV=Q.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(Q.string()),Qm=Q.object({type:Q.string().array().nonempty(),targetCode:Q.string().optional(),targetDescription:Q.string().optional(),targetName:Q.string(),targetFramework:Q.string().optional(),targetType:aV.optional(),targetUrl:Q.string()}),sV=Q.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"]),cV=sV.or(Q.string()),uV=Q.object({id:Q.string().optional(),narrative:Q.string().optional()}).catchall(Q.any()),lV=Q.object({id:Q.string(),type:Q.string().array().nonempty(),endorsementComment:Q.string().optional()}),fV=hm.extend({credentialSubject:lV,proof:qo.or(qo.array()).optional()}),dV=Q.object({id:Q.string(),"@language":Q.string().optional(),version:Q.string().optional()}),hV=Q.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(Q.string()),pV=Q.object({id:Q.string(),type:Q.string().array().nonempty(),alignment:Qm.array().optional(),description:Q.string().optional(),level:Q.string().optional(),name:Q.string(),points:Q.string().optional()}).catchall(Q.any()),mV=Q.object({id:Q.string(),type:Q.string().array().nonempty(),alignment:Qm.array().optional(),allowedValue:Q.string().array().optional(),name:Q.string(),requiredLevel:Q.string().optional(),requiredValue:Q.string().optional(),resultType:hV,rubricCriterionLevel:pV.array().optional(),valueMax:Q.string().optional(),valueMin:Q.string().optional()}).catchall(Q.any()),gV=Q.object({id:Q.string().optional(),type:Q.string().array().nonempty(),alignment:Qm.array().optional(),achievementType:cV.optional(),creator:vd.optional(),creditsAvailable:Q.number().optional(),criteria:uV,description:Q.string(),endorsement:fV.array().optional(),fieldOfStudy:Q.string().optional(),humanCode:Q.string().optional(),image:Xm.optional(),"@language":Q.string().optional(),name:Q.string(),otherIdentifier:Fk.array().optional(),related:dV.array().optional(),resultDescription:mV.array().optional(),specialization:Q.string().optional(),tag:Q.string().array().optional(),version:Q.string().optional()}).catchall(Q.any()),vV=Q.object({type:Q.string(),hashed:Q.boolean(),identityHash:Q.string(),identityType:Q.string(),salt:Q.string().optional()}),yV=Q.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),bV=Q.object({type:Q.string().array().nonempty(),achievedLevel:Q.string().optional(),alignment:Qm.array().optional(),resultDescription:Q.string().optional(),status:yV.optional(),value:Q.string().optional()}).catchall(Q.any()),lS=Q.object({id:Q.string().optional(),type:Q.string().array().nonempty(),activityEndDate:Q.string().optional(),activityStartDate:Q.string().optional(),creditsEarned:Q.number().optional(),achievement:gV.optional(),identifier:vV.array().optional(),image:Xm.optional(),licenseNumber:Q.string().optional(),narrative:Q.string().optional(),result:bV.array().optional(),role:Q.string().optional(),source:vd.optional(),term:Q.string().optional()}).catchall(Q.any()),wV=Q.object({id:Q.string().optional(),type:Q.string().array().nonempty(),narrative:Q.string().optional(),name:Q.string().optional(),description:Q.string().optional(),genre:Q.string().optional(),audience:Q.string().optional()}).catchall(Q.any()),_V=hm.extend({name:Q.string().optional(),description:Q.string().optional(),image:Xm.optional(),credentialSubject:lS.or(lS.array()),endorsement:hm.array().optional(),evidence:wV.array().optional()}),bY=_V.extend({proof:qo.or(qo.array())}),wY=Q.object({checks:Q.string().array(),warnings:Q.string().array(),errors:Q.string().array()}),$k=Q.enum(["Success","Failed","Error"]),_Y=$k.enum,EY=Q.object({check:Q.string(),status:$k,message:Q.string().optional(),details:Q.string().optional()}),AY=Q.object({title:Q.string().optional(),createdAt:Q.string().optional(),issuer:vd.optional(),issuee:vd.optional(),credentialSubject:i6.optional()}),SY=Q.object({id:Q.string(),uri:Q.string()}).catchall(Q.any()),xY=Q.object({limit:Q.number(),cursor:Q.string().optional(),sort:Q.string().optional()}),Na=Q.object({cursor:Q.string().optional(),hasMore:Q.boolean()}),jk=Q.object({encryptedRecord:iV,fields:Q.string().array()}).catchall(Q.any()),TY=Na.extend({records:jk.array()}),EV=jk.extend({id:Q.string()}),CY=Na.extend({records:EV.array()}),fS=Wq(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),AV=Q.instanceof(RegExp).or(Q.string().refine(e=>{try{return fS(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=fS(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),zi=Q.string().or(Q.object({$in:Q.string().array()})).or(Q.object({$regex:AV})),nl=Q.object({profileId:Q.string().min(3).max(40),displayName:Q.string().default(""),shortBio:Q.string().default(""),bio:Q.string().default(""),did:Q.string(),email:Q.string().optional(),image:Q.string().optional(),heroImage:Q.string().optional(),websiteLink:Q.string().optional(),isServiceProfile:Q.boolean().default(!1).optional(),type:Q.string().optional(),notificationsWebhook:Q.string().url().startsWith("http").optional()}),MY=Q.object({profileId:zi,displayName:zi,shortBio:zi,bio:zi,email:zi,websiteLink:zi,isServiceProfile:Q.boolean(),type:zi}).partial(),IY=Na.extend({records:nl.array()}),kY=Q.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),DY=Q.object({uri:Q.string(),to:Q.string(),from:Q.string(),sent:Q.string().datetime(),received:Q.string().datetime().optional()}),SV=Q.object({role:Q.string(),canEdit:Q.boolean(),canIssue:Q.boolean(),canRevoke:Q.boolean(),canManagePermissions:Q.boolean(),canIssueChildren:Q.string(),canCreateChildren:Q.string(),canEditChildren:Q.string(),canRevokeChildren:Q.string(),canManageChildrenPermissions:Q.string(),canViewAnalytics:Q.boolean()}),o6=Q.enum(["DRAFT","LIVE"]),xV=Q.object({uri:Q.string(),name:Q.string().optional(),type:Q.string().optional(),category:Q.string().optional(),status:o6.optional(),autoConnectRecipients:Q.boolean().optional(),meta:Q.record(Q.any()).optional(),claimPermissions:SV.optional()}),RY=Q.object({uri:zi,name:zi,type:zi,category:zi,meta:Q.record(zi),status:o6.or(Q.object({$in:o6.array()})),autoConnectRecipients:Q.boolean()}).partial(),OY=Na.extend({records:xV.array()}),TV=Q.object({to:nl,from:Q.string(),received:Q.string().optional()}),NY=Na.extend({records:TV.array()}),BY=Q.object({endpoint:Q.string(),name:Q.string(),did:Q.string().optional()}),PY=Q.object({ttlSeconds:Q.number().optional(),totalUses:Q.number().optional()}),CV=Q.object({endpoint:Q.string()}),LY=Q.object({signingAuthority:CV,relationship:Q.object({name:Q.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:Q.string()})}),MV=Q.enum(["live","stale","withdrawn"]),IV=Q.object({read:Q.object({anonymize:Q.boolean().optional(),credentials:Q.object({categories:Q.record(Q.object({required:Q.boolean()})).default({})}).default({}),personal:Q.record(Q.object({required:Q.boolean()})).default({})}).default({}),write:Q.object({credentials:Q.object({categories:Q.record(Q.object({required:Q.boolean()})).default({})}).default({}),personal:Q.record(Q.object({required:Q.boolean()})).default({})}).default({})}),zk=Q.object({contract:IV,owner:nl,name:Q.string(),subtitle:Q.string().optional(),description:Q.string().optional(),reasonForAccessing:Q.string().optional(),image:Q.string().optional(),uri:Q.string(),createdAt:Q.string(),updatedAt:Q.string(),expiresAt:Q.string().optional()}),FY=Na.extend({records:zk.omit({owner:!0}).array()}),kV=Q.object({credentials:Q.object({categories:Q.record(Q.string().array()).default({})}),personal:Q.record(Q.string()).default({}),date:Q.string()}),UY=Na.extend({records:kV.array()}),Hk=Q.object({sharing:Q.boolean().optional(),shared:Q.string().array().optional(),shareAll:Q.boolean().optional(),shareUntil:Q.string().optional()}),qk=Q.object({read:Q.object({anonymize:Q.boolean().optional(),credentials:Q.object({shareAll:Q.boolean().optional(),sharing:Q.boolean().optional(),categories:Q.record(Hk).default({})}).default({}),personal:Q.record(Q.string()).default({})}).default({}),write:Q.object({credentials:Q.object({categories:Q.record(Q.boolean()).default({})}).default({}),personal:Q.record(Q.boolean()).default({})}).default({})}),$Y=Na.extend({records:Q.object({expiresAt:Q.string().optional(),oneTime:Q.boolean().optional(),terms:qk,contract:zk,uri:Q.string(),consenter:nl,status:MV}).array()}),jY=Q.object({read:Q.object({anonymize:Q.boolean().optional(),credentials:Q.object({categories:Q.record(Q.object({required:Q.boolean().optional()})).optional()}).optional(),personal:Q.record(Q.object({required:Q.boolean().optional()})).optional()}).optional(),write:Q.object({credentials:Q.object({categories:Q.record(Q.object({required:Q.boolean().optional()})).optional()}).optional(),personal:Q.record(Q.object({required:Q.boolean().optional()})).optional()}).optional()}),zY=Q.object({anonymize:Q.boolean().optional(),credentials:Q.object({categories:Q.record(Q.boolean()).optional()}).optional(),personal:Q.record(Q.boolean()).optional()}),DV=Q.object({read:Q.object({anonymize:Q.boolean().optional(),credentials:Q.object({shareAll:Q.boolean().optional(),sharing:Q.boolean().optional(),categories:Q.record(Hk.optional()).optional()}).optional(),personal:Q.record(Q.string()).optional()}).optional(),write:Q.object({credentials:Q.object({categories:Q.record(Q.boolean()).optional()}).optional(),personal:Q.record(Q.boolean()).optional()}).optional()}),a6=Q.enum(["consent","update","sync","withdraw"]),HY=Q.object({terms:DV.optional(),action:a6.or(a6.array()).optional(),date:Q.object({$gt:Q.string()}).or(Q.object({$lt:Q.string()})).or(Q.object({$eq:Q.string()})).optional(),expiresAt:Q.object({$gt:Q.string()}).or(Q.object({$lt:Q.string()})).or(Q.object({$eq:Q.string()})).optional(),oneTime:Q.boolean().optional()}),Vk=Q.object({expiresAt:Q.string().optional(),oneTime:Q.boolean().optional(),terms:qk.optional(),id:Q.string(),action:a6,date:Q.string()}),qY=Na.extend({records:Vk.array()}),RV=Q.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),OV=Q.object({title:Q.string().optional(),body:Q.string().optional()}),NV=Q.object({vcUris:Q.array(Q.string()).optional(),vpUris:Q.array(Q.string()).optional(),transaction:Vk.optional()}),VY=Q.object({type:RV,to:nl.partial().and(Q.object({did:Q.string()})),from:nl.partial().and(Q.object({did:Q.string()})),message:OV.optional(),data:NV.optional(),sent:Q.string().datetime().optional()}),e1=a(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),KY=Q.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=J.object({credentials:pc.array()}).catchall(J.any()),Kk=J.object({id:J.string(),title:J.string(),storageType:J.literal("ceramic").optional()}).catchall(J.any()),$2=J.object({credentials:pc.or(Kk).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:W,id:$,storageType:z,...X}=B;return{...X,id:W,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 pc.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=pc.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=pc.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 BV=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=Tc(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=Tc(y),_=b.next();!_.done;_=b.next()){var x=_.value;try{zb(x)}catch(D){s=s??[],D instanceof nb?s=_s(_s([],Ma(s)),Ma(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}(),wI=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 $c={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],Ma(r))):setTimeout.apply(void 0,_s([e,t],Ma(r)))},clearTimeout:function(e){var t=im.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function v2(e){im.setTimeout(function(){var t=$c.onUnhandledError;if(t)t(e);else throw e})}i(v2,"reportUnhandledError");a(v2,"reportUnhandledError");function Hb(){}i(Hb,"noop");a(Hb,"noop");var cH=function(){return Vm("C",void 0,void 0)}();function _I(e){return Vm("E",void 0,e)}i(_I,"errorNotification");a(_I,"errorNotification");function EI(e){return Vm("N",e,void 0)}i(EI,"nextNotification");a(EI,"nextNotification");function Vm(e,t,r){return{kind:e,value:t,error:r}}i(Vm,"createNotification");a(Vm,"createNotification");var wc=null;function Zf(e){if($c.useDeprecatedSynchronousErrorHandling){var t=!wc;if(t&&(wc={errorThrown:!1,error:null}),e(),t){var r=wc,n=r.errorThrown,o=r.error;if(wc=null,n)throw o}}else e()}i(Zf,"errorContext");a(Zf,"errorContext");function AI(e){$c.useDeprecatedSynchronousErrorHandling&&wc&&(wc.errorThrown=!0,wc.error=e)}i(AI,"captureError");a(AI,"captureError");var y2=function(e){Zo(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=fH,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(EI(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?k0(_I(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?k0(cH,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),uH=Function.prototype.bind;function I0(e,t){return uH.call(e,t)}i(I0,"bind");a(I0,"bind");var lH=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){Zo(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&&$c.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 lH(c),s}return i(t,"SafeSubscriber2"),a(t,"SafeSubscriber"),t}(y2);function Gf(e){$c.useDeprecatedSynchronousErrorHandling?AI(e):v2(e)}i(Gf,"handleUnhandledError");a(Gf,"handleUnhandledError");function SI(e){throw e}i(SI,"defaultErrorHandler");a(SI,"defaultErrorHandler");function k0(e,t){var r=$c.onStoppedNotification;r&&im.setTimeout(function(){return r(e,t)})}i(k0,"handleStoppedNotification");a(k0,"handleStoppedNotification");var fH={closed:!0,next:Hb,error:SI,complete:Hb},b2=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Km(e){return e}i(Km,"identity3");a(Km,"identity");function xI(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(xI,"pipeFromArray");a(xI,"pipeFromArray");var ln=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=CI(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 xI(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??$c.Promise)!==null&&t!==void 0?t:Promise}i(Vb,"getPromiseCtor");a(Vb,"getPromiseCtor");function TI(e){return e&&Er(e.next)&&Er(e.error)&&Er(e.complete)}i(TI,"isObserver");a(TI,"isObserver");function CI(e){return e&&e instanceof y2||TI(e)&&g2(e)}i(CI,"isSubscriber");a(CI,"isSubscriber");function MI(e){return Er(e?.lift)}i(MI,"hasLift");a(MI,"hasLift");function Yo(e){return function(t){if(MI(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(Yo,"operate");a(Yo,"operate");function mo(e,t,r,n,o){return new dH(e,t,r,n,o)}i(mo,"createOperatorSubscriber");a(mo,"createOperatorSubscriber");var dH=function(e){Zo(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),hH=qm(function(e){return a(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),II=function(e){Zo(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 WA(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new hH},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=Tc(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?wI:(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 ln;return r.source=this,r},t.create=function(r,n){return new WA(r,n)},t}(ln),WA=function(e){Zo(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:wI},t}(II),pH=function(e){Zo(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}(II),kI={now:function(){return(kI.delegate||Date).now()},delegate:void 0},mH=function(e){Zo(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],Ma(r))):setInterval.apply(void 0,_s([e,t],Ma(r)))},clearInterval:function(e){var t=om.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},gH=function(e){Zo(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}(mH),JA=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=kI.now,e}(),vH=function(e){Zo(t,e);function t(r,n){n===void 0&&(n=JA.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}(JA),yH=new vH(gH),bH=yH,DI=new ln(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 RI(e){return w2(_2(e))?e.pop():void 0}i(RI,"popScheduler");a(RI,"popScheduler");function OI(e,t){return typeof _2(e)=="number"?e.pop():t}i(OI,"popNumber");a(OI,"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 NI(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(NI,"getSymbolIterator");a(NI,"getSymbolIterator");var BI=NI();function C2(e){return Er(e?.[BI])}i(C2,"isIterable");a(C2,"isIterable");function M2(e){return yI(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,Sc(r.read())];case 3:return n=c.sent(),o=n.value,s=n.done,s?[4,Sc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,Sc(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 Oa(e){if(e instanceof ln)return e;if(e!=null){if(S2(e))return PI(e);if(E2(e))return LI(e);if(A2(e))return FI(e);if(x2(e))return k2(e);if(C2(e))return UI(e);if(I2(e))return $I(e)}throw T2(e)}i(Oa,"innerFrom");a(Oa,"innerFrom");function PI(e){return new ln(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(PI,"fromInteropObservable");a(PI,"fromInteropObservable");function LI(e){return new ln(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(LI,"fromArrayLike");a(LI,"fromArrayLike");function FI(e){return new ln(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,v2)})}i(FI,"fromPromise");a(FI,"fromPromise");function UI(e){return new ln(function(t){var r,n;try{for(var o=Tc(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(UI,"fromIterable");a(UI,"fromIterable");function k2(e){return new ln(function(t){jI(e,t).catch(function(r){return t.error(r)})})}i(k2,"fromAsyncIterable");a(k2,"fromAsyncIterable");function $I(e){return k2(M2(e))}i($I,"fromReadableStreamLike");a($I,"fromReadableStreamLike");function jI(e,t){var r,n,o,s;return vI(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=bI(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(jI,"process2");a(jI,"process");function xa(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(xa,"executeSchedule");a(xa,"executeSchedule");function D2(e,t){return t===void 0&&(t=0),Yo(function(r,n){r.subscribe(mo(n,function(o){return xa(n,e,function(){return n.next(o)},t)},function(){return xa(n,e,function(){return n.complete()},t)},function(o){return xa(n,e,function(){return n.error(o)},t)}))})}i(D2,"observeOn");a(D2,"observeOn");function R2(e,t){return t===void 0&&(t=0),Yo(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(R2,"subscribeOn");a(R2,"subscribeOn");function zI(e,t){return Oa(e).pipe(R2(t),D2(t))}i(zI,"scheduleObservable");a(zI,"scheduleObservable");function HI(e,t){return Oa(e).pipe(R2(t),D2(t))}i(HI,"schedulePromise");a(HI,"schedulePromise");function qI(e,t){return new ln(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}i(qI,"scheduleArray");a(qI,"scheduleArray");function VI(e,t){return new ln(function(r){var n;return xa(r,t,function(){n=e[BI](),xa(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(VI,"scheduleIterable");a(VI,"scheduleIterable");function O2(e,t){if(!e)throw new Error("Iterable cannot be null");return new ln(function(r){xa(r,t,function(){var n=e[Symbol.asyncIterator]();xa(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 KI(e,t){return O2(M2(e),t)}i(KI,"scheduleReadableStreamLike");a(KI,"scheduleReadableStreamLike");function GI(e,t){if(e!=null){if(S2(e))return zI(e,t);if(E2(e))return qI(e,t);if(A2(e))return HI(e,t);if(x2(e))return O2(e,t);if(C2(e))return VI(e,t);if(I2(e))return KI(e,t)}throw T2(e)}i(GI,"scheduled");a(GI,"scheduled");function WI(e,t){return t?GI(e,t):Oa(e)}i(WI,"from3");a(WI,"from");var JI=qm(function(e){return a(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function ZI(e){return e instanceof Date&&!isNaN(e)}i(ZI,"isValidDate");a(ZI,"isValidDate");function N2(e,t){return Yo(function(r,n){var o=0;r.subscribe(mo(n,function(s){n.next(e.call(t,s,o++))}))})}i(N2,"map");a(N2,"map");var wH=Array.isArray;function YI(e,t){return wH(t)?e.apply(void 0,_s([],Ma(t))):e(t)}i(YI,"callOrApply");a(YI,"callOrApply");function XI(e){return N2(function(t){return YI(e,t)})}i(XI,"mapOneOrManyArgs");a(XI,"mapOneOrManyArgs");function QI(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;Oa(r(D,m++)).subscribe(mo(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 W=h.shift();c?xa(t,c,function(){return x(W)}):x(W)},"_loop_1");h.length&&p<n;)B();b()}catch(W){t.error(W)}}))},"doInnerSub");return e.subscribe(mo(t,_,function(){y=!0,b()})),function(){l?.()}}i(QI,"mergeInternals");a(QI,"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)})(Oa(e(n,o)))},r):(typeof t=="number"&&(r=t),Yo(function(n,o){return QI(n,o,e,r)}))}i(Gm,"mergeMap");a(Gm,"mergeMap");function ek(e){return e===void 0&&(e=1/0),Gm(Km,e)}i(ek,"mergeAll");a(ek,"mergeAll");var _H=["addListener","removeListener"],EH=["addEventListener","removeEventListener"],AH=["on","off"];function am(e,t,r,n){if(Er(r)&&(n=r,r=void 0),n)return am(e,t,r).pipe(XI(n));var o=Ma(nk(e)?EH.map(function(l){return function(h){return e[l](t,h,r)}}):tk(e)?_H.map(Kb(e,t)):rk(e)?AH.map(Kb(e,t)):[],2),s=o[0],c=o[1];if(!s&&E2(e))return Gm(function(l){return am(l,t,r)})(Oa(e));if(!s)throw new TypeError("Invalid event target");return new ln(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 tk(e){return Er(e.addListener)&&Er(e.removeListener)}i(tk,"isNodeStyleEventEmitter");a(tk,"isNodeStyleEventEmitter");function rk(e){return Er(e.on)&&Er(e.off)}i(rk,"isJQueryStyleEventEmitter");a(rk,"isJQueryStyleEventEmitter");function nk(e){return Er(e.addEventListener)&&Er(e.removeEventListener)}i(nk,"isEventTarget");a(nk,"isEventTarget");function B2(e,t,r){e===void 0&&(e=0),r===void 0&&(r=bH);var n=-1;return t!=null&&(w2(t)?r=t:n=t),new ln(function(o){var s=ZI(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 ik(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=RI(e),n=OI(e,1/0),o=e;return o.length?o.length===1?Oa(o[0]):ek(n)(WI(o,r)):DI}i(ik,"merge");a(ik,"merge");function ok(e,t){return Yo(function(r,n){var o=0;r.subscribe(mo(n,function(s){return e.call(t,s,o++)&&n.next(s)}))})}i(ok,"filter");a(ok,"filter");function ak(e){return Yo(function(t,r){var n=!1;t.subscribe(mo(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}i(ak,"defaultIfEmpty");a(ak,"defaultIfEmpty");function sk(e){return e<=0?function(){return DI}:Yo(function(t,r){var n=0;t.subscribe(mo(r,function(o){++n<=e&&(r.next(o),e<=n&&r.complete())}))})}i(sk,"take");a(sk,"take");function ck(e){return e===void 0&&(e=uk),Yo(function(t,r){var n=!1;t.subscribe(mo(r,function(o){n=!0,r.next(o)},function(){return n?r.complete():r.error(e())}))})}i(ck,"throwIfEmpty");a(ck,"throwIfEmpty");function uk(){return new JI}i(uk,"defaultErrorFactory");a(uk,"defaultErrorFactory");function lk(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?ok(function(o,s){return e(o,s,n)}):Km,sk(1),r?ak(t):ck(function(){return new JI}))}}i(lk,"first");a(lk,"first");function fk(e,t){return Yo(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=Oa(e(B)).subscribe(mo(n,_,x))},"startThrottle"),O=a(function(){if(p){p=!1;var B=m;m=null,n.next(B),!b&&D(B)}},"send");r.subscribe(mo(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(fk,"throttle");a(fk,"throttle");var ZA;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(ZA||(ZA={}));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 ln{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,zA.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,zA.default)(this.state$.value)}async sync(e={}){e={sync:Yn.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 SH=ir(cj(),1);function dk(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):(ik(...e.map(r=>am(r,"abort"))).pipe(lk()).subscribe(()=>{t.abort()}),t.signal)}i(dk,"mergeAbortSignals");a(dk,"mergeAbortSignals");var hk=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(hk,"TimedAbortSignal");async function pk(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(pk,"abortable2");a(pk,"abortable");var xH=60*1e3*3;async function vi(e,t={}){t.body&&Object.assign(t,{body:JSON.stringify(t.body),headers:{...t.headers,"Content-Type":"application/json"}});let r=t.timeout||xH,n=new hk(r),o=t.signal?dk([t.signal,n.signal]):n.signal,s=await pk(o,c=>(0,SH.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(vi,"fetchJson");a(vi,"fetchJson");var b0=ir(Ad(),1);Ko();function Aa(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(Aa,"toCID");a(Aa,"toCID");var YA=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=Aa(t.jws.link),t.linkedBlock=xr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=xr(t.cacaoBlock,"base64")),t):(jr.isSignedCommit(t)&&(t.link=Aa(t.link)),jr.isAnchorCommit(t)&&(t.proof=Aa(t.proof)),t.id&&(t.id=Aa(t.id)),t.prev&&(t.prev=Aa(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!=YA&&(t.metadata.unique=Cr(t.metadata.unique,"base64")),t.doctype=Ca.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,b0.default)(e);return t.doctype&&(t.type=Ca.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:Aa(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=Aa(t.anchorProof.txHash),t.anchorProof.root=Aa(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!=YA&&(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 mk=i(class extends pH{next(e){let t=this.value;jr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");a(mk,"StreamStateSubject");var TH=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"),mi,ib={anchor:!0,publish:!0,pin:!0,sync:Yn.PREFER_CACHE},CH={sync:Yn.PREFER_CACHE},XA={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,aH.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 Ia=mi=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,oH.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 mi.makeGenesis(s,r,n);return t.createStreamFromGenesis(mi.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 mi._signDagJWS(t,r):r;return t.createStreamFromGenesis(mi.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 mi.makeGenesis(t,null,r);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...CH,...n};let o=ws.from(r);if(o.type!=mi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${mi.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async update(t,r,n={}){n={...XA,...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={...XA,...r};let o={header:D0(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await mi._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 mi._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=rI.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 mi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await Wb(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");Ia.STREAM_TYPE_NAME="tile";Ia.STREAM_TYPE_ID=0;Ia=mi=TH([Jm()],Ia);var MH=ir(uj(),1);function gk(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(gk,"_checkPrivateRedeclaration2");a(gk,"_checkPrivateRedeclaration");function vk(e,t){return t.get?t.get.call(e):t.value}i(vk,"_classApplyDescriptorGet2");a(vk,"_classApplyDescriptorGet");function yk(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(yk,"_classApplyDescriptorSet2");a(yk,"_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 vk(e,r)}i(O0,"_classPrivateFieldGet2");a(O0,"_classPrivateFieldGet");function Jb(e,t,r){gk(e,t),t.set(e,r)}i(Jb,"_classPrivateFieldInit2");a(Jb,"_classPrivateFieldInit");function Zb(e,t,r){var n=P2(e,t,"set");return yk(e,n,r),r}i(Zb,"_classPrivateFieldSet2");a(Zb,"_classPrivateFieldSet");function bk(e){return typeof e=="string"||_r.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(bk,"keyToQuery");a(bk,"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 wk(e){let t=await Ia.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(wk,"getDeterministicQuery");a(wk,"getDeterministicQuery");var IH=a(()=>Promise.resolve([]),"tempBatchLoadFn"),w0=new WeakMap,ob=new WeakMap,kH=i(class extends MH.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 Ia.create(O0(this,w0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await wk(e);try{return await super.load(r)}catch{let o=await Ia.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(IH,{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(bk),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(kH,"TileLoader");function Yb(e){return typeof e=="string"?Xt.fromString(e):e}i(Yb,"typeStreamID");a(Yb,"typeStreamID");function _k(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(_k,"serializeObjectToSearchParams");a(_k,"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 ln{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=B2(0,r).pipe(fk(()=>this._syncState(this.id,{sync:Yn.PREFER_CACHE}))).subscribe()),this.state$.subscribe(n).add(()=>{this.state$.observers.length===0&&this.periodicSubscription?.unsubscribe()})}),this.state$=new mk(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 vi(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 vi(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=_k(new URL(`./streams/${e}`,t),r),{state:o}=await vi(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 vi(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 QA=ir(Ad(),1),eS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(eS||(eS={}));var Qb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Qb||(Qb={}));var Ek=i(class extends ln{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,QA.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,QA.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(Ek,"Stream");function Ak(){return e=>{}}i(Ak,"StreamStatic2");a(Ak,"StreamStatic");function Sk(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(Sk,"normalizeAccountId");a(Sk,"normalizeAccountId");var DH="(?:%[0-9a-fA-F]{2})",tS=`(?:[a-zA-Z0-9._-]|${DH})`,RH="([a-z0-9]+)",OH=`((?:${tS}*:)*(${tS}+))`,rS="[a-zA-Z0-9_.:%-]",NH=`;${rS}+=${rS}*`,BH=`((${NH})*)`,PH="(/[^#?]*)?",LH="([?][^#]*)?",FH="(#.*)?",UH=new RegExp(`^did:${RH}:${OH}${BH}${PH}${LH}${FH}$`);function xk(e){if(e===""||!e)return null;let t=e.match(UH);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(xk,"parse2");a(xk,"parse");var $H=ir(Ad(),1),jH=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"),vc,ab=a(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),nS={anchor:!1,publish:!0,sync:cd.PREFER_CACHE},sb={anchor:!0,publish:!0},zH={sync:cd.PREFER_CACHE},Vu=vc=a(i(class extends Ek{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,$H.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...nS,...n};let o=Sk(r),s=vc.makeGenesis(o);return vc.fromGenesis(t,s,n)}static async fromGenesis(t,r,n={}){return n={...nS,...n},t.createStreamFromGenesis(vc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...sb,...n};let o=typeof t=="string"?t.trim():t.id;if(xk(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={...zH,...n};let o=ws.from(r);if(o.type!=vc.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${vc.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");Vu.STREAM_TYPE_NAME="caip10-link";Vu.STREAM_TYPE_ID=1;Vu=vc=jH([Ak()],Vu);Ko();il();var HH=ir(wj(),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},"__decorate5"),$o,VH={sync:Yn.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 Tk(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(Tk,"throwReadOnlyError3");a(Tk,"throwReadOnlyError");var Cc=$o=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:$o.MODEL}}static async create(t,r,n){$o.assertComplete(r);let o={publish:!0,anchor:!0,pin:!0,sync:Yn.NEVER_SYNC,throwOnInvalidCommit:!0},s=await $o._makeGenesis(t,r,n);return await t.createStreamFromGenesis($o.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={...VH,...n};let o=ws.from(r);if(o.type!=$o.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${$o.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 $o._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:$o.MODEL.bytes};return{data:r,header:o}}makeReadOnly(){this.sync=Tk,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await e6(t),t.did.createDagJWS(r)}},"Model2"),"Model");Cc.STREAM_TYPE_NAME="model";Cc.STREAM_TYPE_ID=2;Cc.MODEL=function(){let e=Bm("model-v1"),t=HH.default.encode(e,"identity"),r=ju(V0,t),n=jt.createV1(V0,r);return new Xt("UNLOADABLE",n)}();Cc=$o=qH([Jm()],Cc);var KH=ir(sl(),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},"__decorate6"),oo,WH={anchor:!0,publish:!0,pin:!0,sync:Yn.NEVER_SYNC,syncTimeoutSeconds:0},JH={anchor:!1,publish:!1,pin:!0,sync:Yn.PREFER_CACHE},ZH={sync:Yn.PREFER_CACHE},iS={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 Ku=oo=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={...WH,...o};let s=o.asDID?{did:o.asDID}:t,c=await oo._makeGenesis(s,r,n);return t.createStreamFromGenesis(oo.STREAM_TYPE_ID,c,o)}static async single(t,r,n={}){n={...JH,...n};let o=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let s=await oo._makeGenesis(o,null,r);return t.createStreamFromGenesis(oo.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...ZH,...n};let o=ws.from(r);if(o.type!=oo.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${oo.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async replace(t,r={}){r={...iS,...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={...iS,...r};let n={data:t,prev:this.tip,id:this.id.cid},o=await oo._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 oo._signDagJWS(t,n)}_makeRawCommit(t){return{data:rI.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):oo._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,KH.randomBytes)(12)),{data:r,header:s}}static async _signDagJWS(t,r){return await t6(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");Ku.STREAM_TYPE_NAME="MID";Ku.STREAM_TYPE_ID=3;Ku=oo=GH([Jm()],Ku);var Ck=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 vi(n,{method:"post",body:r})}async rm(e,t){let r=new URL(`./pins/${e}`,this._apiUrl);await vi(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 vi(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(Ck,"RemotePinApi");var Mk=i(class{constructor(e){this._fetchJson=vi,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(Mk,"RemoteIndexApi");var Ik=i(class{constructor(e,t){this._apiUrl=e,this._getDidFn=t,this._fetchJson=vi,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(Ik,"RemoteAdminApi");var YH="/api/v0/",XH="http://localhost:7007",QH={syncInterval:5e3},eq={anchor:!0,publish:!0,sync:Yn.PREFER_CACHE},tq={anchor:!0,publish:!0,sync:Yn.PREFER_CACHE},oS={sync:Yn.PREFER_CACHE},rq=i(class{constructor(e=XH,t={}){this._config={...QH,...t},this._apiUrl=new URL(YH,e),this._streamCache=new Map,this.context={api:this},this.pin=new Ck(this._apiUrl),this.index=new Mk(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new Ik(this._apiUrl,r),this._streamConstructors={[Vu.STREAM_TYPE_ID]:Vu,[Cc.STREAM_TYPE_ID]:Cc,[Ku.STREAM_TYPE_ID]:Ku,[Ia.STREAM_TYPE_ID]:Ia}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...tq,...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={...oS,...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 vi(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={...eq,...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={...oS,...t};let{anchorStatus:r}=await vi(`${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 vi(this._apiUrl+"/node/chains");return this._supportedChains=e,e}async close(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()}},"CeramicClient");a(rq,"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"]),nq=a(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),jo=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(jo,"ZodError");jo.create=e=>new jo(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"),kk=ud;function Dk(e){kk=e}i(Dk,"setErrorMap");a(Dk,"setErrorMap");function ld(){return kk}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"),iq=[];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 Nn=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 Nn.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(Nn,"ParseStatus");var Dt=Object.freeze({status:"aborted"}),Rk=a(e=>({status:"dirty",value:e}),"DIRTY"),An=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 go=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(go,"ParseInputLazyPath");var aS=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 jo(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 Nn,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 aS(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 aS(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 po.create(this)}nullable(){return As.create(this)}nullish(){return this.optional().nullable()}array(){return ho.create(this)}promise(){return Dc.create(this)}or(e){return Yu.create([this,e])}and(e){return Xu.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 rl({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 oq=/^c[^\s-]{8,}$/i,aq=/^([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,sq=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,cq=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"),ka=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 ka({...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 Nn,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&>(n,{code:Ge.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")sq.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")aq.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")oq.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"?cq(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 ka({...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(ka,"ZodString");ka.create=e=>{var t;return new ka({checks:[],typeName:Tt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};function Ok(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(Ok,"floatSafeRemainder");a(Ok,"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 Nn;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"?Ok(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 Gu=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 An(e.data)}},"ZodBigInt");a(Gu,"ZodBigInt");Gu.create=e=>{var t;return new Gu({typeName:Tt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};var Wu=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 An(e.data)}},"ZodBoolean");a(Wu,"ZodBoolean");Wu.create=e=>new Wu({typeName:Tt.ZodBoolean,coerce:e?.coerce||!1,...zt(e)});var Mc=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 Nn,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 Mc({...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(Mc,"ZodDate");Mc.create=e=>new Mc({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 An(e.data)}},"ZodSymbol");a(fd,"ZodSymbol");fd.create=e=>new fd({typeName:Tt.ZodSymbol,...zt(e)});var Ju=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 An(e.data)}},"ZodUndefined");a(Ju,"ZodUndefined");Ju.create=e=>new Ju({typeName:Tt.ZodUndefined,...zt(e)});var Zu=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 An(e.data)}},"ZodNull");a(Zu,"ZodNull");Zu.create=e=>new Zu({typeName:Tt.ZodNull,...zt(e)});var Ic=i(class extends $t{constructor(){super(...arguments),this._any=!0}_parse(e){return An(e.data)}},"ZodAny");a(Ic,"ZodAny");Ic.create=e=>new Ic({typeName:Tt.ZodAny,...zt(e)});var ms=i(class extends $t{constructor(){super(...arguments),this._unknown=!0}_parse(e){return An(e.data)}},"ZodUnknown");a(ms,"ZodUnknown");ms.create=e=>new ms({typeName:Tt.ZodUnknown,...zt(e)});var zo=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(zo,"ZodNever");zo.create=e=>new zo({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 An(e.data)}},"ZodVoid");a(dd,"ZodVoid");dd.create=e=>new dd({typeName:Tt.ZodVoid,...zt(e)});var ho=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 go(t,s,t.path,c)))).then(s=>Nn.mergeArray(r,s));let o=t.data.map((s,c)=>n.type._parseSync(new go(t,s,t.path,c)));return Nn.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new ho({...this._def,minLength:{value:e,message:Jt.toString(t)}})}max(e,t){return new ho({...this._def,maxLength:{value:e,message:Jt.toString(t)}})}length(e,t){return new ho({...this._def,exactLength:{value:e,message:Jt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");a(ho,"ZodArray");ho.create=(e,t)=>new ho({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 sS=a(e=>t=>new Ir({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function yc(e){if(e instanceof Ir){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=po.create(yc(n))}return new Ir({...e._def,shape:()=>t})}else return e instanceof ho?ho.create(yc(e.element)):e instanceof po?po.create(yc(e.unwrap())):e instanceof As?As.create(yc(e.unwrap())):e instanceof Ho?Ho.create(e.items.map(t=>yc(t))):e}i(yc,"deepPartialify");a(yc,"deepPartialify");var Ir=i(class extends $t{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=sS(this._def),this.extend=sS(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 zo&&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 go(n,m,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof zo){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 go(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=>Nn.mergeObjectSync(r,h)):Nn.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 yc(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 po;)o=o._def.innerType;t[r]=o}});else for(let r in this.shape){let o=this.shape[r];for(;o instanceof po;)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:zo.create(),typeName:Tt.ZodObject,...zt(t)});Ir.strictCreate=(e,t)=>new Ir({shape:()=>e,unknownKeys:"strict",catchall:zo.create(),typeName:Tt.ZodObject,...zt(t)});Ir.lazycreate=(e,t)=>new Ir({shape:e,unknownKeys:"strip",catchall:zo.create(),typeName:Tt.ZodObject,...zt(t)});var Yu=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 jo(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 jo(l));return gt(t,{code:Ge.invalid_union,unionErrors:c}),Dt}}get options(){return this._def.options}},"ZodUnion");a(Yu,"ZodUnion");Yu.create=(e,t)=>new Yu({options:e,typeName:Tt.ZodUnion,...zt(t)});var P0=a(e=>e instanceof Qu?P0(e.schema):e instanceof Vi?P0(e.innerType()):e instanceof el?[e.value]:e instanceof bl?e.options:e instanceof tl?Object.keys(e.enum):e instanceof rl?P0(e._def.innerType):e instanceof Ju?[void 0]:e instanceof Zu?[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 Xu=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(Xu,"ZodIntersection");Xu.create=(e,t,r)=>new Xu({left:e,right:t,typeName:Tt.ZodIntersection,...zt(r)});var Ho=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 go(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Nn.mergeArray(t,s)):Nn.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new Ho({...this._def,rest:e})}},"ZodTuple");a(Ho,"ZodTuple");Ho.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ho({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 go(r,c,r.path,c)),value:s._parse(new go(r,r.data[c],r.path,c))});return r.common.async?Nn.mergeObjectAsync(t,n):Nn.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:ka.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 go(r,c,r.path,[h,"key"])),value:o._parse(new go(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 kc=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 go(r,l,r.path,h)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,t){return new kc({...this._def,minSize:{value:e,message:Jt.toString(t)}})}max(e,t){return new kc({...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(kc,"ZodSet");kc.create=(e,t)=>new kc({valueType:e,minSize:null,maxSize:null,typeName:Tt.ZodSet,...zt(t)});var Fu=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 Dc?An(async(...c)=>{let l=new jo([]),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})}):An((...c)=>{let l=this._def.args.safeParse(c,o);if(!l.success)throw new jo([r(c,l.error)]);let h=s(...l.data),p=this._def.returns.safeParse(h,o);if(!p.success)throw new jo([n(h,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Fu({...this._def,args:Ho.create(e).rest(ms.create())})}returns(e){return new Fu({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Fu({args:e||Ho.create([]).rest(ms.create()),returns:t||ms.create(),typeName:Tt.ZodFunction,...zt(r)})}},"ZodFunction");a(Fu,"ZodFunction");var Qu=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(Qu,"ZodLazy");Qu.create=(e,t)=>new Qu({getter:e,typeName:Tt.ZodLazy,...zt(t)});var el=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(el,"ZodLiteral");el.create=(e,t)=>new el({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 An(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 tl=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 An(e.data)}get enum(){return this._def.values}},"ZodNativeEnum");a(tl,"ZodNativeEnum");tl.create=(e,t)=>new tl({values:e,typeName:Tt.ZodNativeEnum,...zt(t)});var Dc=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 An(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}},"ZodPromise");a(Dc,"ZodPromise");Dc.create=(e,t)=>new Dc({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 po=i(class extends $t{_parse(e){return this._getType(e)===rt.undefined?An(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodOptional");a(po,"ZodOptional");po.create=(e,t)=>new po({innerType:e,typeName:Tt.ZodOptional,...zt(t)});var As=i(class extends $t{_parse(e){return this._getType(e)===rt.null?An(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 rl=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(rl,"ZodDefault");rl.create=(e,t)=>new rl({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 uq=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(),Rk(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 Nk=a((e,t={},r)=>e?Ic.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})}}):Ic.create(),"custom"),lq={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 fq=a((e,t={message:`Input not instance of ${e.name}`})=>Nk(r=>r instanceof e,t,!0),"instanceOfType"),Bk=ka.create,Pk=Es.create,dq=gd.create,hq=Gu.create,Lk=Wu.create,pq=Mc.create,mq=fd.create,gq=Ju.create,vq=Zu.create,yq=Ic.create,bq=ms.create,wq=zo.create,_q=dd.create,Eq=ho.create,Aq=Ir.create,Sq=Ir.strictCreate,xq=Yu.create,Tq=Zm.create,Cq=Xu.create,Mq=Ho.create,Iq=hd.create,kq=pd.create,Dq=kc.create,Rq=Fu.create,Oq=Qu.create,Nq=el.create,Bq=bl.create,Pq=tl.create,Lq=Dc.create,cS=Vi.create,Fq=po.create,Uq=As.create,$q=Vi.createWithPreprocess,jq=Od.create,zq=a(()=>Bk().optional(),"ostring"),Hq=a(()=>Pk().optional(),"onumber"),qq=a(()=>Lk().optional(),"oboolean"),Vq={string:e=>ka.create({...e,coerce:!0}),number:e=>Es.create({...e,coerce:!0}),boolean:e=>Wu.create({...e,coerce:!0}),bigint:e=>Gu.create({...e,coerce:!0}),date:e=>Mc.create({...e,coerce:!0})},Kq=Dt,Q=Object.freeze({__proto__:null,defaultErrorMap:ud,setErrorMap:Dk,getErrorMap:ld,makeIssue:cm,EMPTY_PATH:iq,addIssueToContext:gt,ParseStatus:Nn,INVALID:Dt,DIRTY:Rk,OK:An,isAborted:r6,isDirty:n6,isValid:um,isAsync:lm,get util(){return nr},ZodParsedType:rt,getParsedType:hs,ZodType:$t,ZodString:ka,ZodNumber:Es,ZodBigInt:Gu,ZodBoolean:Wu,ZodDate:Mc,ZodSymbol:fd,ZodUndefined:Ju,ZodNull:Zu,ZodAny:Ic,ZodUnknown:ms,ZodNever:zo,ZodVoid:dd,ZodArray:ho,get objectUtil(){return fm},ZodObject:Ir,ZodUnion:Yu,ZodDiscriminatedUnion:Zm,ZodIntersection:Xu,ZodTuple:Ho,ZodRecord:hd,ZodMap:pd,ZodSet:kc,ZodFunction:Fu,ZodLazy:Qu,ZodLiteral:el,ZodEnum:bl,ZodNativeEnum:tl,ZodPromise:Dc,ZodEffects:Vi,ZodTransformer:Vi,ZodOptional:po,ZodNullable:As,ZodDefault:rl,ZodCatch:md,ZodNaN:gd,BRAND:uq,ZodBranded:F2,ZodPipeline:Od,custom:Nk,Schema:$t,ZodSchema:$t,late:lq,get ZodFirstPartyTypeKind(){return Tt},coerce:Vq,any:yq,array:Eq,bigint:hq,boolean:Lk,date:pq,discriminatedUnion:Tq,effect:cS,enum:Bq,function:Rq,instanceof:fq,intersection:Cq,lazy:Oq,literal:Nq,map:kq,nan:dq,nativeEnum:Pq,never:wq,null:vq,nullable:Uq,number:Pk,object:Aq,oboolean:qq,onumber:Hq,optional:Fq,ostring:zq,pipeline:jq,preprocess:$q,promise:Lq,record:Iq,set:Dq,strictObject:Sq,string:Bk,symbol:mq,transformer:cS,tuple:Mq,undefined:gq,union:xq,unknown:bq,void:_q,NEVER:Kq,ZodIssueCode:Ge,quotelessJson:nq,ZodError:jo}),Gq=Object.defineProperty,Wq=a((e,t)=>Gq(e,"name",{value:t,configurable:!0}),"__name"),Ym=Q.array(Q.string().or(Q.record(Q.any()))),gY=Q.object({type:Q.string().optional(),narrative:Q.string().optional()}),Xm=Q.string().or(Q.object({id:Q.string(),type:Q.string(),caption:Q.string().optional()})),Jq=Q.object({type:Q.string().min(1).or(Q.string().array().nonempty()),latitude:Q.number(),longitude:Q.number()}),Zq=Q.object({type:Q.string().min(1).or(Q.string().array().nonempty()),addressCountry:Q.string().optional(),addressCountryCode:Q.string().optional(),addressRegion:Q.string().optional(),addressLocality:Q.string().optional(),streetAddress:Q.string().optional(),postOfficeBoxNumber:Q.string().optional(),postalCode:Q.string().optional(),geo:Jq.optional()}),Yq=Q.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(Q.string()),Fk=Q.object({type:Q.string().min(1).or(Q.string().array().nonempty()),identifier:Q.string(),identifierType:Yq}),vd=Q.string().or(Q.object({id:Q.string().optional(),type:Q.string().or(Q.string().array().nonempty().optional()),name:Q.string().optional(),url:Q.string().optional(),phone:Q.string().optional(),description:Q.string().optional(),endorsement:Q.any().array().optional(),image:Xm.optional(),email:Q.string().email().optional(),address:Zq.optional(),otherIdentifier:Fk.array().optional(),official:Q.string().optional(),parentOrg:Q.any().optional(),familyName:Q.string().optional(),givenName:Q.string().optional(),additionalName:Q.string().optional(),patronymicName:Q.string().optional(),honorificPrefix:Q.string().optional(),honorificSuffix:Q.string().optional(),familyNamePrefix:Q.string().optional(),dateOfBirth:Q.string().optional()}).catchall(Q.any())),i6=Q.object({id:Q.string().optional()}).catchall(Q.any()),Xq=Q.object({type:Q.string(),id:Q.string()}).catchall(Q.any()),Qq=Q.object({id:Q.string(),type:Q.string()}).catchall(Q.any()),eV=Q.object({id:Q.string(),type:Q.string()}).catchall(Q.any()),hm=Q.object({"@context":Ym,id:Q.string().optional(),type:Q.string().array().nonempty(),issuer:vd,issuanceDate:Q.string(),expirationDate:Q.string().optional(),credentialSubject:i6.or(i6.array()),credentialStatus:Xq.optional(),credentialSchema:Qq.array().optional(),refreshService:eV.optional()}).catchall(Q.any()),qo=Q.object({type:Q.string(),created:Q.string(),challenge:Q.string().optional(),domain:Q.string().optional(),nonce:Q.string().optional(),proofPurpose:Q.string(),verificationMethod:Q.string(),jws:Q.string().optional()}).catchall(Q.any()),uS=hm.extend({proof:qo.or(qo.array())}),tV=Q.object({"@context":Ym,id:Q.string().optional(),type:Q.string().or(Q.string().array().nonempty()),verifiableCredential:uS.or(uS.array()).optional(),holder:Q.string().optional()}).catchall(Q.any()),vY=tV.extend({proof:qo.or(qo.array())}),Uk=Q.object({kty:Q.string(),crv:Q.string(),x:Q.string(),y:Q.string().optional(),n:Q.string().optional(),d:Q.string()}),rV=Q.object({alg:Q.string(),iv:Q.string(),tag:Q.string(),epk:Uk.partial().optional(),kid:Q.string().optional(),apv:Q.string().optional(),apu:Q.string().optional()}),nV=Q.object({header:rV,encrypted_key:Q.string()}),iV=Q.object({protected:Q.string(),iv:Q.string(),ciphertext:Q.string(),tag:Q.string(),aad:Q.string().optional(),recipients:nV.array().optional()}),gc=Q.string().or(Q.object({"@context":Ym.optional(),id:Q.string(),type:Q.string(),controller:Q.string(),publicKeyJwk:Uk.optional(),publicKeyBase58:Q.string().optional(),blockChainAccountId:Q.string().optional()}).catchall(Q.any())),oV=Q.object({id:Q.string(),type:Q.string().or(Q.string().array().nonempty()),serviceEndpoint:Q.any().or(Q.any().array().nonempty())}).catchall(Q.any()),yY=Q.object({"@context":Ym,id:Q.string(),alsoKnownAs:Q.string().optional(),controller:Q.string().or(Q.string().array().nonempty()).optional(),verificationMethod:gc.array().optional(),authentication:gc.array().optional(),assertionMethod:gc.array().optional(),keyAgreement:gc.array().optional(),capabilityInvocation:gc.array().optional(),capabilityDelegation:gc.array().optional(),publicKey:gc.array().optional(),service:oV.array().optional(),proof:qo.or(qo.array()).optional()}).catchall(Q.any()),aV=Q.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(Q.string()),Qm=Q.object({type:Q.string().array().nonempty(),targetCode:Q.string().optional(),targetDescription:Q.string().optional(),targetName:Q.string(),targetFramework:Q.string().optional(),targetType:aV.optional(),targetUrl:Q.string()}),sV=Q.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"]),cV=sV.or(Q.string()),uV=Q.object({id:Q.string().optional(),narrative:Q.string().optional()}).catchall(Q.any()),lV=Q.object({id:Q.string(),type:Q.string().array().nonempty(),endorsementComment:Q.string().optional()}),fV=hm.extend({credentialSubject:lV,proof:qo.or(qo.array()).optional()}),dV=Q.object({id:Q.string(),"@language":Q.string().optional(),version:Q.string().optional()}),hV=Q.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(Q.string()),pV=Q.object({id:Q.string(),type:Q.string().array().nonempty(),alignment:Qm.array().optional(),description:Q.string().optional(),level:Q.string().optional(),name:Q.string(),points:Q.string().optional()}).catchall(Q.any()),mV=Q.object({id:Q.string(),type:Q.string().array().nonempty(),alignment:Qm.array().optional(),allowedValue:Q.string().array().optional(),name:Q.string(),requiredLevel:Q.string().optional(),requiredValue:Q.string().optional(),resultType:hV,rubricCriterionLevel:pV.array().optional(),valueMax:Q.string().optional(),valueMin:Q.string().optional()}).catchall(Q.any()),gV=Q.object({id:Q.string().optional(),type:Q.string().array().nonempty(),alignment:Qm.array().optional(),achievementType:cV.optional(),creator:vd.optional(),creditsAvailable:Q.number().optional(),criteria:uV,description:Q.string(),endorsement:fV.array().optional(),fieldOfStudy:Q.string().optional(),humanCode:Q.string().optional(),image:Xm.optional(),"@language":Q.string().optional(),name:Q.string(),otherIdentifier:Fk.array().optional(),related:dV.array().optional(),resultDescription:mV.array().optional(),specialization:Q.string().optional(),tag:Q.string().array().optional(),version:Q.string().optional()}).catchall(Q.any()),vV=Q.object({type:Q.string(),hashed:Q.boolean(),identityHash:Q.string(),identityType:Q.string(),salt:Q.string().optional()}),yV=Q.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),bV=Q.object({type:Q.string().array().nonempty(),achievedLevel:Q.string().optional(),alignment:Qm.array().optional(),resultDescription:Q.string().optional(),status:yV.optional(),value:Q.string().optional()}).catchall(Q.any()),lS=Q.object({id:Q.string().optional(),type:Q.string().array().nonempty(),activityEndDate:Q.string().optional(),activityStartDate:Q.string().optional(),creditsEarned:Q.number().optional(),achievement:gV.optional(),identifier:vV.array().optional(),image:Xm.optional(),licenseNumber:Q.string().optional(),narrative:Q.string().optional(),result:bV.array().optional(),role:Q.string().optional(),source:vd.optional(),term:Q.string().optional()}).catchall(Q.any()),wV=Q.object({id:Q.string().optional(),type:Q.string().array().nonempty(),narrative:Q.string().optional(),name:Q.string().optional(),description:Q.string().optional(),genre:Q.string().optional(),audience:Q.string().optional()}).catchall(Q.any()),_V=hm.extend({name:Q.string().optional(),description:Q.string().optional(),image:Xm.optional(),credentialSubject:lS.or(lS.array()),endorsement:hm.array().optional(),evidence:wV.array().optional()}),bY=_V.extend({proof:qo.or(qo.array())}),wY=Q.object({checks:Q.string().array(),warnings:Q.string().array(),errors:Q.string().array()}),$k=Q.enum(["Success","Failed","Error"]),_Y=$k.enum,EY=Q.object({check:Q.string(),status:$k,message:Q.string().optional(),details:Q.string().optional()}),AY=Q.object({title:Q.string().optional(),createdAt:Q.string().optional(),issuer:vd.optional(),issuee:vd.optional(),credentialSubject:i6.optional()}),SY=Q.object({id:Q.string(),uri:Q.string()}).catchall(Q.any()),xY=Q.object({limit:Q.number(),cursor:Q.string().optional(),sort:Q.string().optional()}),Na=Q.object({cursor:Q.string().optional(),hasMore:Q.boolean()}),jk=Q.object({encryptedRecord:iV,fields:Q.string().array()}).catchall(Q.any()),TY=Na.extend({records:jk.array()}),EV=jk.extend({id:Q.string()}),CY=Na.extend({records:EV.array()}),fS=Wq(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),AV=Q.instanceof(RegExp).or(Q.string().refine(e=>{try{return fS(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=fS(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),zi=Q.string().or(Q.object({$in:Q.string().array()})).or(Q.object({$regex:AV})),nl=Q.object({profileId:Q.string().min(3).max(40),displayName:Q.string().default(""),shortBio:Q.string().default(""),bio:Q.string().default(""),did:Q.string(),email:Q.string().optional(),image:Q.string().optional(),heroImage:Q.string().optional(),websiteLink:Q.string().optional(),isServiceProfile:Q.boolean().default(!1).optional(),type:Q.string().optional(),notificationsWebhook:Q.string().url().startsWith("http").optional()}),MY=Q.object({profileId:zi,displayName:zi,shortBio:zi,bio:zi,email:zi,websiteLink:zi,isServiceProfile:Q.boolean(),type:zi}).partial(),IY=Na.extend({records:nl.array()}),kY=Q.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),DY=Q.object({uri:Q.string(),to:Q.string(),from:Q.string(),sent:Q.string().datetime(),received:Q.string().datetime().optional()}),SV=Q.object({role:Q.string(),canEdit:Q.boolean(),canIssue:Q.boolean(),canRevoke:Q.boolean(),canManagePermissions:Q.boolean(),canIssueChildren:Q.string(),canCreateChildren:Q.string(),canEditChildren:Q.string(),canRevokeChildren:Q.string(),canManageChildrenPermissions:Q.string(),canViewAnalytics:Q.boolean()}),o6=Q.enum(["DRAFT","LIVE"]),xV=Q.object({uri:Q.string(),name:Q.string().optional(),type:Q.string().optional(),category:Q.string().optional(),status:o6.optional(),autoConnectRecipients:Q.boolean().optional(),meta:Q.record(Q.any()).optional(),claimPermissions:SV.optional()}),RY=Q.object({uri:zi,name:zi,type:zi,category:zi,meta:Q.record(zi),status:o6.or(Q.object({$in:o6.array()})),autoConnectRecipients:Q.boolean()}).partial(),OY=Na.extend({records:xV.array()}),TV=Q.object({to:nl,from:Q.string(),received:Q.string().optional(),uri:Q.string().optional()}),NY=Na.extend({records:TV.array()}),BY=Q.object({endpoint:Q.string(),name:Q.string(),did:Q.string().optional()}),PY=Q.object({ttlSeconds:Q.number().optional(),totalUses:Q.number().optional()}),CV=Q.object({endpoint:Q.string()}),LY=Q.object({signingAuthority:CV,relationship:Q.object({name:Q.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:Q.string()})}),MV=Q.enum(["live","stale","withdrawn"]),IV=Q.object({read:Q.object({anonymize:Q.boolean().optional(),credentials:Q.object({categories:Q.record(Q.object({required:Q.boolean()})).default({})}).default({}),personal:Q.record(Q.object({required:Q.boolean()})).default({})}).default({}),write:Q.object({credentials:Q.object({categories:Q.record(Q.object({required:Q.boolean()})).default({})}).default({}),personal:Q.record(Q.object({required:Q.boolean()})).default({})}).default({})}),zk=Q.object({contract:IV,owner:nl,name:Q.string(),subtitle:Q.string().optional(),description:Q.string().optional(),reasonForAccessing:Q.string().optional(),image:Q.string().optional(),uri:Q.string(),createdAt:Q.string(),updatedAt:Q.string(),expiresAt:Q.string().optional()}),FY=Na.extend({records:zk.omit({owner:!0}).array()}),kV=Q.object({credentials:Q.object({categories:Q.record(Q.string().array()).default({})}),personal:Q.record(Q.string()).default({}),date:Q.string()}),UY=Na.extend({records:kV.array()}),Hk=Q.object({sharing:Q.boolean().optional(),shared:Q.string().array().optional(),shareAll:Q.boolean().optional(),shareUntil:Q.string().optional()}),qk=Q.object({read:Q.object({anonymize:Q.boolean().optional(),credentials:Q.object({shareAll:Q.boolean().optional(),sharing:Q.boolean().optional(),categories:Q.record(Hk).default({})}).default({}),personal:Q.record(Q.string()).default({})}).default({}),write:Q.object({credentials:Q.object({categories:Q.record(Q.boolean()).default({})}).default({}),personal:Q.record(Q.boolean()).default({})}).default({})}),$Y=Na.extend({records:Q.object({expiresAt:Q.string().optional(),oneTime:Q.boolean().optional(),terms:qk,contract:zk,uri:Q.string(),consenter:nl,status:MV}).array()}),jY=Q.object({read:Q.object({anonymize:Q.boolean().optional(),credentials:Q.object({categories:Q.record(Q.object({required:Q.boolean().optional()})).optional()}).optional(),personal:Q.record(Q.object({required:Q.boolean().optional()})).optional()}).optional(),write:Q.object({credentials:Q.object({categories:Q.record(Q.object({required:Q.boolean().optional()})).optional()}).optional(),personal:Q.record(Q.object({required:Q.boolean().optional()})).optional()}).optional()}),zY=Q.object({anonymize:Q.boolean().optional(),credentials:Q.object({categories:Q.record(Q.boolean()).optional()}).optional(),personal:Q.record(Q.boolean()).optional()}),DV=Q.object({read:Q.object({anonymize:Q.boolean().optional(),credentials:Q.object({shareAll:Q.boolean().optional(),sharing:Q.boolean().optional(),categories:Q.record(Hk.optional()).optional()}).optional(),personal:Q.record(Q.string()).optional()}).optional(),write:Q.object({credentials:Q.object({categories:Q.record(Q.boolean()).optional()}).optional(),personal:Q.record(Q.boolean()).optional()}).optional()}),a6=Q.enum(["consent","update","sync","withdraw"]),HY=Q.object({terms:DV.optional(),action:a6.or(a6.array()).optional(),date:Q.object({$gt:Q.string()}).or(Q.object({$lt:Q.string()})).or(Q.object({$eq:Q.string()})).optional(),expiresAt:Q.object({$gt:Q.string()}).or(Q.object({$lt:Q.string()})).or(Q.object({$eq:Q.string()})).optional(),oneTime:Q.boolean().optional()}),Vk=Q.object({expiresAt:Q.string().optional(),oneTime:Q.boolean().optional(),terms:qk.optional(),id:Q.string(),action:a6,date:Q.string()}),qY=Na.extend({records:Vk.array()}),RV=Q.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),OV=Q.object({title:Q.string().optional(),body:Q.string().optional()}),NV=Q.object({vcUris:Q.array(Q.string()).optional(),vpUris:Q.array(Q.string()).optional(),transaction:Vk.optional()}),VY=Q.object({type:RV,to:nl.partial().and(Q.object({did:Q.string()})),from:nl.partial().and(Q.object({did:Q.string()})),message:OV.optional(),data:NV.optional(),sent:Q.string().datetime().optional()}),e1=a(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),KY=Q.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=J.object({credentials:pc.array()}).catchall(J.any()),Kk=J.object({id:J.string(),title:J.string(),storageType:J.literal("ceramic").optional()}).catchall(J.any()),$2=J.object({credentials:pc.or(Kk).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:W,id:$,storageType:z,...X}=B;return{...X,id:W,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 pc.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=pc.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=pc.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 BV=t1;
|
|
845
845
|
/*!
|
|
846
846
|
* The buffer module from node.js, for the browser.
|
|
847
847
|
*
|