@blockcerts/blockcerts-verifier 1.54.0 → 1.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ie11.js +2 -2
- package/dist/main.js +2 -2
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -527,7 +527,7 @@ read:function(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<<s)-1,u=l>>1,A=-7,c=n?i-1:0,h=n?
|
|
|
527
527
|
/*!
|
|
528
528
|
* Copyright (c) 2019-2020 Digital Bazaar, Inc. All rights reserved.
|
|
529
529
|
*/(e,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")}(new TextDecoder("utf-8").decode(e.slice(1)))}}class Tl{hl;hashlinkTable={};constructor(){this.hl=new ts,this.hl.use(new Fl),this.hl.use(new Ul),this.hl.use(new Pl)}async decode(e,t){const n=await this.hl.decode({hashlink:e});if(!n.meta&&!n.meta.url?.length)throw new Error("unparseable document, no url provided as meta data");return this.hashlinkTable[e]=n,t?.(n.meta.url[0]),n}async verifyHashlinkTable(){const e=Object.keys(this.hashlinkTable);for(let t=0;t<e.length;t++)await this.verify(e[t]).catch((e=>console.log("caught an hashlink exception",e)));return!0}async verify(e){const t=await this.getSourceUrlFromHashlink(e);let n;await fetch(t).then((async e=>await e.text())).then((e=>{n=e}));const r=new TextEncoder,i=await this.hl.verify({data:r.encode(n),hashlink:e});if(!i)throw new Error(`Hashlink ${e} does not match data from url ${t}`);return console.log(`hashlink ${e} bound to ${t} was successfully verified`),i}hasHashlinksToVerify(){return Object.keys(this.hashlinkTable).length>0}async getSourceUrlFromHashlink(e){let t;return t=this.hashlinkTable[e]?this.hashlinkTable[e]:await this.decode(e),this.getMetaUrl(t)}getMetaUrl(e){return e.meta.url[0]}}function Ll(e,t){return"string"!=typeof e?(console.warn("Trying to test a non string variable"),!1):0===e.indexOf(t)}function Ml(e){return"string"==typeof e}!function(e){e.blockcypher="blockcypher",e.blockstream="blockstream",e.etherscan="etherscan"}(kl||(kl={})),function(e){e.V1_1="1.1",e.V1_2="1.2",e.V2_0="2.0",e.V3_0_alpha="3.0-alpha",e.V3_0_beta="3.0-beta",e.V3_0="3.0"}(_l||(_l={}));var Rl,Ol,Hl,Kl=_l;!function(e){e.blockcypher="blockcypher",e.blockstream="blockstream",e.etherscan="etherscan"}(Rl||(Rl={})),function(e){e.Bitcoin="bitcoin",e.Ethmain="ethmain",e.Ethropst="ethropst",e.Ethrinkeby="ethrinkeby",e.Ethgoerli="ethgoerli",e.Ethsepolia="ethsepolia",e.Mocknet="mocknet",e.Regtest="regtest",e.Testnet="testnet"}(Ol||(Ol={})),function(e){e.btc="btc",e.eth="eth",e.mocknet="mocknet"}(Hl||(Hl={}));const jl={[Ol.Bitcoin]:{code:Ol.Bitcoin,blinkCode:Hl.btc,name:"Bitcoin",prefixes:["6a20","OP_RETURN "],signatureValue:"bitcoinMainnet",transactionTemplates:{full:"https://blockchain.info/tx/{transaction_id}",raw:"https://blockchain.info/rawtx/{transaction_id}"}},[Ol.Ethmain]:{code:Ol.Ethmain,blinkCode:Hl.eth,name:"Ethereum",prefixes:["0x"],signatureValue:"ethereumMainnet",transactionTemplates:{full:"https://etherscan.io/tx/{transaction_id}",raw:"https://etherscan.io/tx/{transaction_id}"}},[Ol.Ethropst]:{code:Ol.Ethropst,blinkCode:Hl.eth,name:"Ethereum Testnet",signatureValue:"ethereumRopsten",transactionTemplates:{full:"https://ropsten.etherscan.io/tx/{transaction_id}",raw:"https://ropsten.etherscan.io/getRawTx?tx={transaction_id}"}},[Ol.Ethrinkeby]:{code:Ol.Ethrinkeby,blinkCode:Hl.eth,name:"Ethereum Testnet",signatureValue:"ethereumRinkeby",transactionTemplates:{full:"https://rinkeby.etherscan.io/tx/{transaction_id}",raw:"https://rinkeby.etherscan.io/getRawTx?tx={transaction_id}"}},[Ol.Ethgoerli]:{code:Ol.Ethgoerli,blinkCode:Hl.eth,name:"Ethereum Testnet",signatureValue:"ethereumGoerli",transactionTemplates:{full:"https://goerli.etherscan.io/tx/{transaction_id}",raw:"https://goerli.etherscan.io/getRawTx?tx={transaction_id}"}},[Ol.Ethsepolia]:{code:Ol.Ethsepolia,blinkCode:Hl.eth,name:"Ethereum Testnet",signatureValue:"ethereumSepolia",transactionTemplates:{full:"https://sepolia.etherscan.io/tx/{transaction_id}",raw:"https://sepolia.etherscan.io/getRawTx?tx={transaction_id}"}},[Ol.Mocknet]:{code:Ol.Mocknet,blinkCode:Hl.mocknet,name:"Mocknet",test:!0,signatureValue:"mockchain",transactionTemplates:{full:"",raw:""}},[Ol.Regtest]:{code:Ol.Regtest,blinkCode:Hl.mocknet,name:"Mocknet",test:!0,signatureValue:"bitcoinRegtest",transactionTemplates:{full:"",raw:""}},[Ol.Testnet]:{code:Ol.Testnet,blinkCode:Hl.btc,name:"Bitcoin Testnet",signatureValue:"bitcoinTestnet",transactionTemplates:{full:"https://testnet.blockchain.info/tx/{transaction_id}",raw:"https://testnet.blockchain.info/rawtx/{transaction_id}"}}};function Gl(e,t,n=[]){return function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){if((e=Array.from(e)).length<t)throw new Error("Could not retrieve tx data");const r=e.map(((e,t)=>e.then((()=>t)).catch((e=>{throw t}))));return Promise.race(r).then((r=>(e.splice(r,1)[0].then((e=>n.push(e))),1===t?n:Gl(e,t-1,n)))).catch((r=>(e.splice(r,1),Gl(e,t,n))))}))}function ql({explorerAPI:e,transactionIdPlaceholder:t="{transaction_id}",transactionId:n="",chain:r}){const{serviceURL:i}=e;let o;if("string"==typeof i)o=i;else if("object"==typeof i){o=!!r&&function(e){return e!==jl.bitcoin.code&&e!==jl.ethmain.code}(r)?i.test:i.main}else{if("function"!=typeof i)throw new Error(`serviceURL is an unexpected type for explorerAPI ${e.serviceName}`);o=i(r)}return o=o.replace(t,n),o=function(e,t){if(!t.key)return e;if(t.key&&!t.keyPropertyName)throw new Error(`No keyPropertyName defined for explorerAPI ${t.serviceName}`);return function(e,t,n){const r=e.includes("?")?"&":"?";return`${e}${r}${t}=${n}`}(e,t.keyPropertyName,t.key)}(o,e),o}function Vl(){throw new Error("setTimeout has not been defined")}function zl(){throw new Error("clearTimeout has not been defined")}var Jl=Vl,Yl=zl;function Xl(e){if(Jl===setTimeout)return setTimeout(e,0);if((Jl===Vl||!Jl)&&setTimeout)return Jl=setTimeout,setTimeout(e,0);try{return Jl(e,0)}catch(t){try{return Jl.call(null,e,0)}catch(t){return Jl.call(this,e,0)}}}"function"==typeof qi.setTimeout&&(Jl=setTimeout),"function"==typeof qi.clearTimeout&&(Yl=clearTimeout);var Wl,Zl=[],$l=!1,eu=-1;function tu(){$l&&Wl&&($l=!1,Wl.length?Zl=Wl.concat(Zl):eu=-1,Zl.length&&nu())}function nu(){if(!$l){var e=Xl(tu);$l=!0;for(var t=Zl.length;t;){for(Wl=Zl,Zl=[];++eu<t;)Wl&&Wl[eu].run();eu=-1,t=Zl.length}Wl=null,$l=!1,function(e){if(Yl===clearTimeout)return clearTimeout(e);if((Yl===zl||!Yl)&&clearTimeout)return Yl=clearTimeout,clearTimeout(e);try{Yl(e)}catch(t){try{return Yl.call(null,e)}catch(t){return Yl.call(this,e)}}}(e)}}function ru(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Zl.push(new iu(e,t)),1!==Zl.length||$l||Xl(nu)}function iu(e,t){this.fun=e,this.array=t}function ou(){}iu.prototype.run=function(){this.fun.apply(null,this.array)};var au=ou,su=ou,lu=ou,uu=ou,Au=ou,cu=ou,hu=ou,du=qi.performance||{},fu=du.now||du.mozNow||du.msNow||du.oNow||du.webkitNow||function(){return(new Date).getTime()},pu=new Date,gu={nextTick:ru,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:au,addListener:su,once:lu,off:uu,removeListener:Au,removeAllListeners:cu,emit:hu,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*fu.call(du),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-pu)/1e3}},yu=/[^\x20-\x7E]/,mu=/[\x2E\u3002\uFF0E\uFF61]/g,vu={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},wu=Math.floor,Iu=String.fromCharCode;
|
|
530
|
-
/*! https://mths.be/punycode v1.4.1 by @mathias */function bu(e){throw new RangeError(vu[e])}function Bu(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function Eu(e,t,n){var r=0;for(e=n?wu(e/700):e>>1,e+=wu(e/t);e>455;r+=36)e=wu(e/35);return wu(r+36*e/(e+38))}function Cu(e){return function(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]);var i=function(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}((e=e.replace(mu,".")).split("."),(function(e){return yu.test(e)?"xn--"+function(e){var t,n,r,i,o,a,s,l,u,A,c,h,d,f,p,g=[];for(e=function(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}(e),h=e.length,t=128,n=0,o=72,a=0;a<h;++a)(c=e[a])<128&&g.push(Iu(c));for(r=i=g.length,i&&g.push("-");r<h;){for(s=2147483647,a=0;a<h;++a)(c=e[a])>=t&&c<s&&(s=c);for(s-t>wu((2147483647-n)/(d=r+1))&&bu("overflow"),n+=(s-t)*d,t=s,a=0;a<h;++a)if((c=e[a])<t&&++n>2147483647&&bu("overflow"),c==t){for(l=n,u=36;!(l<(A=u<=o?1:u>=o+26?26:u-o));u+=36)p=l-A,f=36-A,g.push(Iu(Bu(A+p%f,0))),l=wu(p/f);g.push(Iu(Bu(l,0))),o=Eu(n,d,r==i),n=0,++r}++n,++t}return g.join("")}(e):e})).join(".");return r+i}(e)}var xu="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},Su=/%[sdj%]/g;function Qu(e){if(!Gu(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(Fu(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(Su,(function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n<i;a=r[++n])Hu(a)||!Ju(a)?o+=" "+a:o+=" "+Fu(a);return o}function ku(e,t){if(Vu(qi.process))return function(){return ku(e,t).apply(this,arguments)};if(!0===gu.noDeprecation)return e;var n=!1;return function(){if(!n){if(gu.throwDeprecation)throw new Error(t);gu.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var _u,Nu={};function Du(e){return Vu(_u)&&(_u=gu.env.NODE_DEBUG||""),e=e.toUpperCase(),Nu[e]||(new RegExp("\\b"+e+"\\b","i").test(_u)?Nu[e]=function(){var t=Qu.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:Nu[e]=function(){}),Nu[e]}function Fu(e,t){var n={seen:[],stylize:Pu};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Ou(t)?n.showHidden=t:t&&oA(n,t),Vu(n.showHidden)&&(n.showHidden=!1),Vu(n.depth)&&(n.depth=2),Vu(n.colors)&&(n.colors=!1),Vu(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Uu),Tu(n,e,n.depth)}function Uu(e,t){var n=Fu.styles[t];return n?"["+Fu.colors[n][0]+"m"+e+"["+Fu.colors[n][1]+"m":e}function Pu(e,t){return e}function Tu(e,t,n){if(e.customInspect&&t&&Wu(t.inspect)&&t.inspect!==Fu&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return Gu(r)||(r=Tu(e,r,n)),r}var i=function(e,t){if(Vu(t))return e.stylize("undefined","undefined");if(Gu(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return ju(t)?e.stylize(""+t,"number"):Ou(t)?e.stylize(""+t,"boolean"):Hu(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),Xu(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Lu(t);if(0===o.length){if(Wu(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(zu(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Yu(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Xu(t))return Lu(t)}var l,u="",A=!1,c=["{","}"];return Ru(t)&&(A=!0,c=["[","]"]),Wu(t)&&(u=" [Function"+(t.name?": "+t.name:"")+"]"),zu(t)&&(u=" "+RegExp.prototype.toString.call(t)),Yu(t)&&(u=" "+Date.prototype.toUTCString.call(t)),Xu(t)&&(u=" "+Lu(t)),0!==o.length||A&&0!=t.length?n<0?zu(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=A?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)aA(t,String(a))?o.push(Mu(e,t,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(Mu(e,t,n,r,i,!0))})),o}(e,t,n,a,o):o.map((function(r){return Mu(e,t,n,a,r,A)})),e.seen.pop(),function(e,t,n){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(l,u,c)):c[0]+u+c[1]}function Lu(e){return"["+Error.prototype.toString.call(e)+"]"}function Mu(e,t,n,r,i,o){var a,s,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),aA(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(l.value)<0?(s=Hu(n)?Tu(e,l.value,null):Tu(e,l.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),Vu(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function Ru(e){return Array.isArray(e)}function Ou(e){return"boolean"==typeof e}function Hu(e){return null===e}function Ku(e){return null==e}function ju(e){return"number"==typeof e}function Gu(e){return"string"==typeof e}function qu(e){return"symbol"==typeof e}function Vu(e){return void 0===e}function zu(e){return Ju(e)&&"[object RegExp]"===eA(e)}function Ju(e){return"object"==typeof e&&null!==e}function Yu(e){return Ju(e)&&"[object Date]"===eA(e)}function Xu(e){return Ju(e)&&("[object Error]"===eA(e)||e instanceof Error)}function Wu(e){return"function"==typeof e}function Zu(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function $u(e){return jo(e)}function eA(e){return Object.prototype.toString.call(e)}function tA(e){return e<10?"0"+e.toString(10):e.toString(10)}Fu.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Fu.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var nA=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function rA(){var e=new Date,t=[tA(e.getHours()),tA(e.getMinutes()),tA(e.getSeconds())].join(":");return[e.getDate(),nA[e.getMonth()],t].join(" ")}function iA(){console.log("%s - %s",rA(),Qu.apply(null,arguments))}function oA(e,t){if(!t||!Ju(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function aA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var sA={inherits:xu,_extend:oA,log:iA,isBuffer:$u,isPrimitive:Zu,isFunction:Wu,isError:Xu,isDate:Yu,isObject:Ju,isRegExp:zu,isUndefined:Vu,isSymbol:qu,isString:Gu,isNumber:ju,isNullOrUndefined:Ku,isNull:Hu,isBoolean:Ou,isArray:Ru,inspect:Fu,deprecate:ku,format:Qu,debuglog:Du},lA=Object.freeze({__proto__:null,format:Qu,deprecate:ku,debuglog:Du,inspect:Fu,isArray:Ru,isBoolean:Ou,isNull:Hu,isNullOrUndefined:Ku,isNumber:ju,isString:Gu,isSymbol:qu,isUndefined:Vu,isRegExp:zu,isObject:Ju,isDate:Yu,isError:Xu,isFunction:Wu,isPrimitive:Zu,isBuffer:$u,log:iA,inherits:xu,_extend:oA,default:sA});function uA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var AA=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function cA(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function hA(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var dA=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t};function fA(e,t,n,r){t=t||"&",n=n||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;r&&"number"==typeof r.maxKeys&&(a=r.maxKeys);var s=e.length;a>0&&s>a&&(s=a);for(var l=0;l<s;++l){var u,A,c,h,d=e[l].replace(o,"%20"),f=d.indexOf(n);f>=0?(u=d.substr(0,f),A=d.substr(f+1)):(u=d,A=""),c=decodeURIComponent(u),h=decodeURIComponent(A),uA(i,c)?AA(i[c])?i[c].push(h):i[c]=[i[c],h]:i[c]=h}return i}var pA={parse:kA,resolve:FA,resolveObject:UA,format:NA,Url:gA};function gA(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var yA=/^([a-z0-9.+-]+:)/i,mA=/:[0-9]*$/,vA=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,wA=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),IA=["'"].concat(wA),bA=["%","/","?",";","#"].concat(IA),BA=["/","?","#"],EA=/^[+a-z0-9A-Z_-]{0,63}$/,CA=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,xA={javascript:!0,"javascript:":!0},SA={javascript:!0,"javascript:":!0},QA={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function kA(e,t,n){if(e&&Ju(e)&&e instanceof gA)return e;var r=new gA;return r.parse(e,t,n),r}function _A(e,t,n,r){if(!Gu(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),o=-1!==i&&i<t.indexOf("#")?"?":"#",a=t.split(o);a[0]=a[0].replace(/\\/g,"/");var s=t=a.join(o);if(s=s.trim(),!r&&1===t.split("#").length){var l=vA.exec(s);if(l)return e.path=s,e.href=s,e.pathname=l[1],l[2]?(e.search=l[2],e.query=n?fA(e.search.substr(1)):e.search.substr(1)):n&&(e.search="",e.query={}),e}var u,A,c,h,d=yA.exec(s);if(d){var f=(d=d[0]).toLowerCase();e.protocol=f,s=s.substr(d.length)}if(r||d||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var p="//"===s.substr(0,2);!p||d&&SA[d]||(s=s.substr(2),e.slashes=!0)}if(!SA[d]&&(p||d&&!QA[d])){var g,y,m=-1;for(u=0;u<BA.length;u++)-1!==(A=s.indexOf(BA[u]))&&(-1===m||A<m)&&(m=A);for(-1!==(y=-1===m?s.lastIndexOf("@"):s.lastIndexOf("@",m))&&(g=s.slice(0,y),s=s.slice(y+1),e.auth=decodeURIComponent(g)),m=-1,u=0;u<bA.length;u++)-1!==(A=s.indexOf(bA[u]))&&(-1===m||A<m)&&(m=A);-1===m&&(m=s.length),e.host=s.slice(0,m),s=s.slice(m),PA(e),e.hostname=e.hostname||"";var v="["===e.hostname[0]&&"]"===e.hostname[e.hostname.length-1];if(!v){var w=e.hostname.split(/\./);for(u=0,c=w.length;u<c;u++){var I=w[u];if(I&&!I.match(EA)){for(var b="",B=0,E=I.length;B<E;B++)I.charCodeAt(B)>127?b+="x":b+=I[B];if(!b.match(EA)){var C=w.slice(0,u),x=w.slice(u+1),S=I.match(CA);S&&(C.push(S[1]),x.unshift(S[2])),x.length&&(s="/"+x.join(".")+s),e.hostname=C.join(".");break}}}}e.hostname.length>255?e.hostname="":e.hostname=e.hostname.toLowerCase(),v||(e.hostname=Cu(e.hostname)),h=e.port?":"+e.port:"";var Q=e.hostname||"";e.host=Q+h,e.href+=e.host,v&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!xA[f])for(u=0,c=IA.length;u<c;u++){var k=IA[u];if(-1!==s.indexOf(k)){var _=encodeURIComponent(k);_===k&&(_=escape(k)),s=s.split(k).join(_)}}var N=s.indexOf("#");-1!==N&&(e.hash=s.substr(N),s=s.slice(0,N));var D=s.indexOf("?");if(-1!==D?(e.search=s.substr(D),e.query=s.substr(D+1),n&&(e.query=fA(e.query)),s=s.slice(0,D)):n&&(e.search="",e.query={}),s&&(e.pathname=s),QA[f]&&e.hostname&&!e.pathname&&(e.pathname="/"),e.pathname||e.search){h=e.pathname||"";var F=e.search||"";e.path=h+F}return e.href=DA(e),e}function NA(e){return Gu(e)&&(e=_A({},e)),DA(e)}function DA(e){var t=e.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var n=e.protocol||"",r=e.pathname||"",i=e.hash||"",o=!1,a="";e.host?o=t+e.host:e.hostname&&(o=t+(-1===e.hostname.indexOf(":")?e.hostname:"["+this.hostname+"]"),e.port&&(o+=":"+e.port)),e.query&&Ju(e.query)&&Object.keys(e.query).length&&(a=function(e,t,n,r){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?hA(dA(e),(function(r){var i=encodeURIComponent(cA(r))+n;return AA(e[r])?hA(e[r],(function(e){return i+encodeURIComponent(cA(e))})).join(t):i+encodeURIComponent(cA(e[r]))})).join(t):""}(e.query));var s=e.search||a&&"?"+a||"";return n&&":"!==n.substr(-1)&&(n+=":"),e.slashes||(!n||QA[n])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),n+o+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(s=s.replace("#","%23"))+i}function FA(e,t){return kA(e,!1,!0).resolve(t)}function UA(e,t){return e?kA(e,!1,!0).resolveObject(t):t}function PA(e){var t=e.host,n=mA.exec(t);n&&(":"!==(n=n[0])&&(e.port=n.substr(1)),t=t.substr(0,t.length-n.length)),t&&(e.hostname=t)}gA.prototype.parse=function(e,t,n){return _A(this,e,t,n)},gA.prototype.format=function(){return DA(this)},gA.prototype.resolve=function(e){return this.resolveObject(kA(e,!1,!0)).format()},gA.prototype.resolveObject=function(e){if(Gu(e)){var t=new gA;t.parse(e,!1,!0),e=t}for(var n,r=new gA,i=Object.keys(this),o=0;o<i.length;o++){var a=i[o];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),l=0;l<s.length;l++){var u=s[l];"protocol"!==u&&(r[u]=e[u])}return QA[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!QA[e.protocol]){for(var A=Object.keys(e),c=0;c<A.length;c++){var h=A[c];r[h]=e[h]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||SA[e.protocol])r.pathname=e.pathname;else{for(n=(e.pathname||"").split("/");n.length&&!(e.host=n.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==n[0]&&n.unshift(""),n.length<2&&n.unshift(""),r.pathname=n.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var d=r.pathname||"",f=r.search||"";r.path=d+f}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var p,g=r.pathname&&"/"===r.pathname.charAt(0),y=e.host||e.pathname&&"/"===e.pathname.charAt(0),m=y||g||r.host&&e.pathname,v=m,w=r.pathname&&r.pathname.split("/")||[],I=r.protocol&&!QA[r.protocol];if(n=e.pathname&&e.pathname.split("/")||[],I&&(r.hostname="",r.port=null,r.host&&(""===w[0]?w[0]=r.host:w.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===n[0]?n[0]=e.host:n.unshift(e.host)),e.host=null),m=m&&(""===n[0]||""===w[0])),y)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,w=n;else if(n.length)w||(w=[]),w.pop(),w=w.concat(n),r.search=e.search,r.query=e.query;else if(!Ku(e.search))return I&&(r.hostname=r.host=w.shift(),(p=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=p.shift(),r.host=r.hostname=p.shift())),r.search=e.search,r.query=e.query,Hu(r.pathname)&&Hu(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var b=w.slice(-1)[0],B=(r.host||e.host||w.length>1)&&("."===b||".."===b)||""===b,E=0,C=w.length;C>=0;C--)"."===(b=w[C])?w.splice(C,1):".."===b?(w.splice(C,1),E++):E&&(w.splice(C,1),E--);if(!m&&!v)for(;E--;E)w.unshift("..");!m||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),B&&"/"!==w.join("/").substr(-1)&&w.push("");var x=""===w[0]||w[0]&&"/"===w[0].charAt(0);return I&&(r.hostname=r.host=x?"":w.length?w.shift():"",(p=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=p.shift(),r.host=r.hostname=p.shift())),(m=m||r.host&&w.length)&&!x&&w.unshift(""),w.length?r.pathname=w.join("/"):(r.pathname=null,r.path=null),Hu(r.pathname)&&Hu(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},gA.prototype.parseHost=function(){return PA(this)};var TA,LA,MA=ji(Object.freeze({__proto__:null,parse:kA,resolve:FA,resolveObject:UA,format:NA,default:pA,Url:gA})),RA=JA(qi.fetch)&&JA(qi.ReadableStream);function OA(e){LA||(LA=new qi.XMLHttpRequest).open("GET",qi.location.host?"/":"https://example.com");try{return LA.responseType=e,LA.responseType===e}catch(e){return!1}}var HA=void 0!==qi.ArrayBuffer,KA=HA&&JA(qi.ArrayBuffer.prototype.slice),jA=HA&&OA("arraybuffer"),GA=!RA&&KA&&OA("ms-stream"),qA=!RA&&HA&&OA("moz-chunked-arraybuffer"),VA=JA(LA.overrideMimeType),zA=JA(qi.VBArray);function JA(e){return"function"==typeof e}function YA(){}function XA(){XA.init.call(this)}function WA(e){return void 0===e._maxListeners?XA.defaultMaxListeners:e._maxListeners}function ZA(e,t,n){if(t)e.call(n);else for(var r=e.length,i=ac(e,r),o=0;o<r;++o)i[o].call(n)}function $A(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=ac(e,i),a=0;a<i;++a)o[a].call(n,r)}function ec(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,a=ac(e,o),s=0;s<o;++s)a[s].call(n,r,i)}function tc(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var a=e.length,s=ac(e,a),l=0;l<a;++l)s[l].call(n,r,i,o)}function nc(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=ac(e,i),a=0;a<i;++a)o[a].apply(n,r)}function rc(e,t,n,r){var i,o,a,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]):(o=e._events=new YA,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=WA(e))&&i>0&&a.length>i){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function ic(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function oc(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function ac(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}LA=null,YA.prototype=Object.create(null),XA.EventEmitter=XA,XA.usingDomains=!1,XA.prototype.domain=void 0,XA.prototype._events=void 0,XA.prototype._maxListeners=void 0,XA.defaultMaxListeners=10,XA.init=function(){this.domain=null,XA.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new YA,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},XA.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},XA.prototype.getMaxListeners=function(){return WA(this)},XA.prototype.emit=function(e){var t,n,r,i,o,a,s,l="error"===e;if(a=this._events)l=l&&null==a.error;else if(!l)return!1;if(s=this.domain,l){if(t=arguments[1],!s){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var A="function"==typeof n;switch(r=arguments.length){case 1:ZA(n,A,this);break;case 2:$A(n,A,this,arguments[1]);break;case 3:ec(n,A,this,arguments[1],arguments[2]);break;case 4:tc(n,A,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];nc(n,A,this,i)}return!0},XA.prototype.addListener=function(e,t){return rc(this,e,t,!1)},XA.prototype.on=XA.prototype.addListener,XA.prototype.prependListener=function(e,t){return rc(this,e,t,!0)},XA.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,ic(this,e,t)),this},XA.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,ic(this,e,t)),this},XA.prototype.removeListener=function(e,t){var n,r,i,o,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new YA:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new YA,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,a||t)}return this},XA.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new YA,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new YA:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new YA,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},XA.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},XA.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):oc.call(e,t)},XA.prototype.listenerCount=oc,XA.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var sc=Object.freeze({__proto__:null,default:XA,EventEmitter:XA});function lc(){this.head=null,this.tail=null,this.length=0}lc.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},lc.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},lc.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},lc.prototype.clear=function(){this.head=this.tail=null,this.length=0},lc.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},lc.prototype.concat=function(e){if(0===this.length)return ao.alloc(0);if(1===this.length)return this.head.data;for(var t=ao.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var uc=ao.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Ac(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!uc(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=hc;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=dc;break;default:return void(this.write=cc)}this.charBuffer=new ao(6),this.charReceived=0,this.charLength=0}function cc(e){return e.toString(this.encoding)}function hc(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function dc(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}Ac.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((r=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(r=t.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},Ac.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},Ac.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var fc=Object.freeze({__proto__:null,StringDecoder:Ac});yc.ReadableState=gc;var pc=Du("stream");function gc(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Gc&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new lc,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new Ac(e.encoding),this.encoding=e.encoding)}function yc(e){if(!(this instanceof yc))return new yc(e);this._readableState=new gc(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),XA.call(this)}function mc(e,t,n,r,i){var o=function(e,t){var n=null;return jo(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,wc(e)}}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var l;!t.decoder||i||r||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),i||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&wc(e))),function(e,t){t.readingMore||(t.readingMore=!0,ru(bc,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}function vc(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function wc(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(pc("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?ru(Ic,e):Ic(e))}function Ic(e){pc("emit readable"),e.emit("readable"),Cc(e)}function bc(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(pc("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function Bc(e){pc("readable nexttick read 0"),e.read(0)}function Ec(e,t){t.reading||(pc("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),Cc(e),t.flowing&&!t.reading&&e.read(0)}function Cc(e){var t=e._readableState;for(pc("flow",t.flowing);t.flowing&&null!==e.read(););}function xc(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0==(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=ao.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0==(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function Sc(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,ru(Qc,t,e))}function Qc(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function kc(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function _c(){}function Nc(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function Dc(e,t){Object.defineProperty(this,"buffer",{get:ku((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof Gc&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?ru(i,r):i(r),e._writableState.errorEmitted=!0,e.emit("error",r)}(e,n,r,t,i);else{var o=Lc(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||Tc(e,n),r?ru(Pc,e,n,o,i):Pc(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Oc(this)}function Fc(e){if(!(this instanceof Fc||this instanceof Gc))return new Fc(e);this._writableState=new Dc(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),XA.call(this)}function Uc(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function Pc(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),Rc(e,t)}function Tc(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0;n;)i[a]=n,n=n.next,a+=1;Uc(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new Oc(t)}else{for(;n;){var s=n.chunk,l=n.encoding,u=n.callback;if(Uc(e,t,!1,t.objectMode?1:s.length,s,l,u),n=n.next,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=n,t.bufferProcessing=!1}function Lc(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function Mc(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function Rc(e,t){var n=Lc(t);return n&&(0===t.pendingcb?(Mc(e,t),t.finished=!0,e.emit("finish")):Mc(e,t)),n}function Oc(e){var t=this;this.next=null,this.entry=null,this.finish=function(n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}xu(yc,XA),yc.prototype.push=function(e,t){var n=this._readableState;return n.objectMode||"string"!=typeof e||(t=t||n.defaultEncoding)!==n.encoding&&(e=ao.from(e,t),t=""),mc(this,n,e,t,!1)},yc.prototype.unshift=function(e){return mc(this,this._readableState,e,"",!0)},yc.prototype.isPaused=function(){return!1===this._readableState.flowing},yc.prototype.setEncoding=function(e){return this._readableState.decoder=new Ac(e),this._readableState.encoding=e,this},yc.prototype.read=function(e){pc("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return pc("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Sc(this):wc(this),null;if(0===(e=vc(e,t))&&t.ended)return 0===t.length&&Sc(this),null;var r,i=t.needReadable;return pc("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&pc("length less than watermark",i=!0),t.ended||t.reading?pc("reading or ended",i=!1):i&&(pc("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=vc(n,t))),null===(r=e>0?xc(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Sc(this)),null!==r&&this.emit("data",r),r},yc.prototype._read=function(e){this.emit("error",new Error("not implemented"))},yc.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,pc("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end?u:a;function o(e){pc("onunpipe"),e===n&&u()}function a(){pc("onend"),e.end()}r.endEmitted?ru(i):n.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;pc("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,Cc(e))}}(n);e.on("drain",s);var l=!1;function u(){pc("cleanup"),e.removeListener("close",d),e.removeListener("finish",f),e.removeListener("drain",s),e.removeListener("error",h),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",u),n.removeListener("data",c),l=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var A=!1;function c(t){pc("ondata"),A=!1,!1!==e.write(t)||A||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==kc(r.pipes,e))&&!l&&(pc("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,A=!0),n.pause())}function h(t){pc("onerror",t),p(),e.removeListener("error",h),0===function(e,t){return e.listeners("error").length}(e)&&e.emit("error",t)}function d(){e.removeListener("finish",f),p()}function f(){pc("onfinish"),e.removeListener("close",d),p()}function p(){pc("unpipe"),n.unpipe(e)}return n.on("data",c),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",d),e.once("finish",f),e.emit("pipe",n),r.flowing||(pc("pipe resume"),n.resume()),e},yc.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var o=kc(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},yc.prototype.on=function(e,t){var n=XA.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&wc(this):ru(Bc,this))}return n},yc.prototype.addListener=yc.prototype.on,yc.prototype.resume=function(){var e=this._readableState;return e.flowing||(pc("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,ru(Ec,e,t))}(this,e)),this},yc.prototype.pause=function(){return pc("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(pc("pause"),this._readableState.flowing=!1,this.emit("pause")),this},yc.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;for(var i in e.on("end",(function(){if(pc("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)})),e.on("data",(function(i){pc("wrapped data"),t.decoder&&(i=t.decoder.write(i)),t.objectMode&&null==i||(t.objectMode||i&&i.length)&&(r.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));return function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n])}(["error","close","destroy","pause","resume"],(function(t){e.on(t,r.emit.bind(r,t))})),r._read=function(t){pc("wrapped _read",t),n&&(n=!1,e.resume())},r},yc._fromList=xc,Fc.WritableState=Dc,xu(Fc,XA),Dc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},Fc.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Fc.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),ao.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=_c),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),ru(t,n)}(this,n):function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):ao.isBuffer(n)||"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),ru(r,o),i=!1),i}(this,r,e,n)&&(r.pendingcb++,i=function(e,t,n,r,i){n=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=ao.from(t,n)),t}(t,n,r),ao.isBuffer(n)&&(r="buffer");var o=t.objectMode?1:n.length;t.length+=o;var a=t.length<t.highWaterMark;if(a||(t.needDrain=!0),t.writing||t.corked){var s=t.lastBufferedRequest;t.lastBufferedRequest=new Nc(n,r,i),s?s.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Uc(e,t,!1,o,n,r,i);return a}(this,r,e,t,n)),i},Fc.prototype.cork=function(){this._writableState.corked++},Fc.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||Tc(this,e))},Fc.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Fc.prototype._write=function(e,t,n){n(new Error("not implemented"))},Fc.prototype._writev=null,Fc.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,Rc(e,t),n&&(t.finished?ru(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n)},xu(Gc,yc);for(var Hc=Object.keys(Fc.prototype),Kc=0;Kc<Hc.length;Kc++){var jc=Hc[Kc];Gc.prototype[jc]||(Gc.prototype[jc]=Fc.prototype[jc])}function Gc(e){if(!(this instanceof Gc))return new Gc(e);yc.call(this,e),Fc.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",qc)}function qc(){this.allowHalfOpen||this._writableState.ended||ru(Vc,this)}function Vc(e){e.end()}function zc(e){this.afterTransform=function(t,n){return function(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&e.push(n),i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Jc(e){if(!(this instanceof Jc))return new Jc(e);Gc.call(this,e),this._transformState=new zc(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(e){Yc(t,e)})):Yc(t)}))}function Yc(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=e._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(r.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}function Xc(e){if(!(this instanceof Xc))return new Xc(e);Jc.call(this,e)}function Wc(){XA.call(this)}xu(Jc,Gc),Jc.prototype.push=function(e,t){return this._transformState.needTransform=!1,Gc.prototype.push.call(this,e,t)},Jc.prototype._transform=function(e,t,n){throw new Error("Not implemented")},Jc.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Jc.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},xu(Xc,Jc),Xc.prototype._transform=function(e,t,n){n(null,e)},xu(Wc,XA),Wc.Readable=yc,Wc.Writable=Fc,Wc.Duplex=Gc,Wc.Transform=Jc,Wc.PassThrough=Xc,Wc.Stream=Wc,Wc.prototype.pipe=function(e,t){var n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",s));var o=!1;function a(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(u(),0===XA.listenerCount(this,"error"))throw e}function u(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",a),n.removeListener("close",s),n.removeListener("error",l),e.removeListener("error",l),n.removeListener("end",u),n.removeListener("close",u),e.removeListener("close",u)}return n.on("error",l),e.on("error",l),n.on("end",u),n.on("close",u),e.on("close",u),e.emit("pipe",n),e};var Zc=Object.freeze({__proto__:null,default:Wc,Readable:yc,Writable:Fc,Duplex:Gc,Transform:Jc,PassThrough:Xc,Stream:Wc});function $c(e,t,n){var r,i=this;if(yc.call(i),i._mode=n,i.headers={},i.rawHeaders=[],i.trailers={},i.rawTrailers=[],i.on("end",(function(){ru((function(){i.emit("close")}))})),"fetch"===n){i._fetchResponse=t,i.url=t.url,i.statusCode=t.status,i.statusMessage=t.statusText;for(var o,a,s=t.headers[Symbol.iterator]();o=(a=s.next()).value,!a.done;)i.headers[o[0].toLowerCase()]=o[1],i.rawHeaders.push(o[0],o[1]);var l=t.body.getReader();(r=function(){l.read().then((function(e){i._destroyed||(e.done?i.push(null):(i.push(new ao(e.value)),r()))}))})()}else if(i._xhr=e,i._pos=0,i.url=e.responseURL,i.statusCode=e.status,i.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===i.headers[n]&&(i.headers[n]=[]),i.headers[n].push(t[2])):void 0!==i.headers[n]?i.headers[n]+=", "+t[2]:i.headers[n]=t[2],i.rawHeaders.push(t[1],t[2])}})),i._charset="x-user-defined",!VA){var u=i.rawHeaders["mime-type"];if(u){var A=u.match(/;\s*charset=([^;])(;|$)/);A&&(i._charset=A[1].toLowerCase())}i._charset||(i._charset="utf-8")}}function eh(e){var t,n=this;Fc.call(n),n._opts=e,n._body=[],n._headers={},e.auth&&n.setHeader("Authorization","Basic "+new ao(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(t){n.setHeader(t,e.headers[t])}));var r=!0;if("disable-fetch"===e.mode)r=!1,t=!0;else if("prefer-streaming"===e.mode)t=!1;else if("allow-wrong-content-type"===e.mode)t=!VA;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");t=!0}n._mode=function(e,t){return RA&&t?"fetch":qA?"moz-chunked-arraybuffer":GA?"ms-stream":jA&&e?"arraybuffer":zA&&e?"text:vbarray":"text"}(t,r),n.on("finish",(function(){n._onFinish()}))}xu($c,yc),$c.prototype._read=function(){},$c.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text:vbarray":if(4!==t.readyState)break;try{n=new qi.VBArray(t.responseBody).toArray()}catch(e){}if(null!==n){e.push(new ao(n));break}case"text":try{n=t.responseText}catch(t){e._mode="text:vbarray";break}if(n.length>e._pos){var r=n.substr(e._pos);if("x-user-defined"===e._charset){for(var i=new ao(r.length),o=0;o<r.length;o++)i[o]=255&r.charCodeAt(o);e.push(i)}else e.push(r,e._charset);e._pos=n.length}break;case"arraybuffer":if(4!==t.readyState||!t.response)break;n=t.response,e.push(new ao(new Uint8Array(n)));break;case"moz-chunked-arraybuffer":if(n=t.response,3!==t.readyState||!n)break;e.push(new ao(new Uint8Array(n)));break;case"ms-stream":if(n=t.response,3!==t.readyState)break;var a=new qi.MSStreamReader;a.onprogress=function(){a.result.byteLength>e._pos&&(e.push(new ao(new Uint8Array(a.result.slice(e._pos)))),e._pos=a.result.byteLength)},a.onload=function(){e.push(null)},a.readAsArrayBuffer(n)}4===e._xhr.readyState&&"ms-stream"!==e._mode&&e.push(null)},xu(eh,Fc);var th=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];function nh(e,t){"string"==typeof e&&(e=kA(e));var n=-1===qi.location.protocol.search(/^https?:$/)?"http:":"",r=e.protocol||n,i=e.hostname||e.host,o=e.port,a=e.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),e.url=(i?r+"//"+i:"")+(o?":"+o:"")+a,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var s=new eh(e);return t&&s.on("response",t),s}function rh(e,t){var n=nh(e,t);return n.end(),n}function ih(){}eh.prototype.setHeader=function(e,t){var n=e.toLowerCase();-1===th.indexOf(n)&&(this._headers[n]={name:e,value:t})},eh.prototype.getHeader=function(e){return this._headers[e.toLowerCase()].value},eh.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},eh.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t,n=e._opts,r=e._headers;if("POST"!==n.method&&"PUT"!==n.method&&"PATCH"!==n.method||(t=function(){if(void 0!==TA)return TA;try{new qi.Blob([new ArrayBuffer(1)]),TA=!0}catch(e){TA=!1}return TA}()?new qi.Blob(e._body.map((function(e){return function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(jo(e)){for(var t=new Uint8Array(e.length),n=e.length,r=0;r<n;r++)t[r]=e[r];return t.buffer}throw new Error("Argument must be a Buffer")}(e)})),{type:(r["content-type"]||{}).value||""}):ao.concat(e._body).toString()),"fetch"===e._mode){var i=Object.keys(r).map((function(e){return[r[e].name,r[e].value]}));qi.fetch(e._opts.url,{method:e._opts.method,headers:i,body:t,mode:"cors",credentials:n.withCredentials?"include":"same-origin"}).then((function(t){e._fetchResponse=t,e._connect()}),(function(t){e.emit("error",t)}))}else{var o=e._xhr=new qi.XMLHttpRequest;try{o.open(e._opts.method,e._opts.url,!0)}catch(t){return void ru((function(){e.emit("error",t)}))}"responseType"in o&&(o.responseType=e._mode.split(":")[0]),"withCredentials"in o&&(o.withCredentials=!!n.withCredentials),"text"===e._mode&&"overrideMimeType"in o&&o.overrideMimeType("text/plain; charset=x-user-defined"),Object.keys(r).forEach((function(e){o.setRequestHeader(r[e].name,r[e].value)})),e._response=null,o.onreadystatechange=function(){switch(o.readyState){case 3:case 4:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(o.onprogress=function(){e._onXHRProgress()}),o.onerror=function(){e._destroyed||e.emit("error",new Error("XHR error"))};try{o.send(t)}catch(t){return void ru((function(){e.emit("error",t)}))}}}},eh.prototype._onXHRProgress=function(){var e=this;(function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}})(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress())},eh.prototype._connect=function(){var e=this;e._destroyed||(e._response=new $c(e._xhr,e._fetchResponse,e._mode),e.emit("response",e._response))},eh.prototype._write=function(e,t,n){this._body.push(e),n()},eh.prototype.abort=eh.prototype.destroy=function(){var e=this;e._destroyed=!0,e._response&&(e._response._destroyed=!0),e._xhr&&e._xhr.abort()},eh.prototype.end=function(e,t,n){"function"==typeof e&&(n=e,e=void 0),Fc.prototype.end.call(this,e,t,n)},eh.prototype.flushHeaders=function(){},eh.prototype.setTimeout=function(){},eh.prototype.setNoDelay=function(){},eh.prototype.setSocketKeepAlive=function(){},ih.defaultMaxSockets=4;var oh=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],ah={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},sh={request:nh,get:rh,Agent:ih,METHODS:oh,STATUS_CODES:ah},lh=ji(Object.freeze({__proto__:null,request:nh,get:rh,Agent:ih,METHODS:oh,STATUS_CODES:ah,default:sh})),uh=MA,Ah=Ls.spawn,ch=Ls,hh=function(){var e,t,n=this,r=lh,i=lh,o={},a=!1,s={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},l={},u={},A=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],c=["TRACE","TRACK","CONNECT"],h=!1,d=!1,f={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.status=null,this.statusText=null,this.withCredentials=!1,this.open=function(e,t,n,r,i){if(this.abort(),d=!1,!function(e){return e&&-1===c.indexOf(e)}(e))throw new Error("SecurityError: Request method not allowed");o={method:e,url:t.toString(),async:"boolean"!=typeof n||n,user:r||null,password:i||null},p(this.OPENED)},this.setDisableHeaderCheck=function(e){a=e},this.setRequestHeader=function(e,t){if(this.readyState!==this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(function(e){return a||e&&-1===A.indexOf(e.toLowerCase())}(e)){if(h)throw new Error("INVALID_STATE_ERR: send flag is true");e=u[e.toLowerCase()]||e,u[e.toLowerCase()]=e,l[e]=l[e]?l[e]+", "+t:t}else console.warn('Refused to set unsafe header "'+e+'"')},this.getResponseHeader=function(e){return"string"==typeof e&&this.readyState>this.OPENED&&t&&t.headers&&t.headers[e.toLowerCase()]&&!d?t.headers[e.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||d)return"";var e="";for(var n in t.headers)"set-cookie"!==n&&"set-cookie2"!==n&&(e+=n+": "+t.headers[n]+"\r\n");return e.substr(0,e.length-2)},this.getRequestHeader=function(e){return"string"==typeof e&&u[e.toLowerCase()]?l[u[e.toLowerCase()]]:""},this.send=function(a){if(this.readyState!==this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(h)throw new Error("INVALID_STATE_ERR: send has already been called");var A,c=!1,f=!1,g=uh.parse(o.url);switch(g.protocol){case"https:":c=!0;case"http:":A=g.hostname;break;case"file:":f=!0;break;case void 0:case null:case"":A="localhost";break;default:throw new Error("Protocol not supported.")}if(f){if("GET"!==o.method)throw new Error("XMLHttpRequest: Only GET method is supported");if(o.async)ch.readFile(g.pathname,"utf8",(function(e,t){e?n.handleError(e):(n.status=200,n.responseText=t,p(n.DONE))}));else try{this.responseText=ch.readFileSync(g.pathname,"utf8"),this.status=200,p(n.DONE)}catch(e){this.handleError(e)}}else{var y=g.port||(c?443:80),m=g.pathname+(g.search?g.search:"");for(var v in s)u[v.toLowerCase()]||(l[v]=s[v]);if(l.Host=A,c&&443===y||80===y||(l.Host+=":"+g.port),o.user){void 0===o.password&&(o.password="");var w=new ao(o.user+":"+o.password);l.Authorization="Basic "+w.toString("base64")}"GET"===o.method||"HEAD"===o.method?a=null:a?(l["Content-Length"]=jo(a)?a.length:ao.byteLength(a),l["Content-Type"]||(l["Content-Type"]="text/plain;charset=UTF-8")):"POST"===o.method&&(l["Content-Length"]=0);var I={host:A,port:y,path:m,method:o.method,headers:l,agent:!1,withCredentials:n.withCredentials};if(d=!1,o.async){var b=c?i.request:r.request;h=!0,n.dispatchEvent("readystatechange");var B=function(e){n.handleError(e)};e=b(I,(function r(i){if(301!==(t=i).statusCode&&302!==t.statusCode&&303!==t.statusCode&&307!==t.statusCode)t.setEncoding("utf8"),p(n.HEADERS_RECEIVED),n.status=t.statusCode,t.on("data",(function(e){e&&(n.responseText+=e),h&&p(n.LOADING)})),t.on("end",(function(){h&&(p(n.DONE),h=!1)})),t.on("error",(function(e){n.handleError(e)}));else{o.url=t.headers.location;var a=uh.parse(o.url);A=a.hostname;var s={hostname:a.hostname,port:a.port,path:a.path,method:303===t.statusCode?"GET":o.method,headers:l,withCredentials:n.withCredentials};(e=b(s,r).on("error",B)).end()}})).on("error",B),a&&e.write(a),e.end(),n.dispatchEvent("loadstart")}else{var E=".node-xmlhttprequest-content-"+gu.pid,C=".node-xmlhttprequest-sync-"+gu.pid;ch.writeFileSync(C,"","utf8");for(var x="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(c?"s":"")+".request;var options = "+JSON.stringify(I)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+E+"', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText}}), 'utf8');fs.unlinkSync('"+C+"');});response.on('error', function(error) {fs.writeFileSync('"+E+"', JSON.stringify({err: error}), 'utf8');fs.unlinkSync('"+C+"');});}).on('error', function(error) {fs.writeFileSync('"+E+"', JSON.stringify({err: error}), 'utf8');fs.unlinkSync('"+C+"');});"+(a?"req.write('"+JSON.stringify(a).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",S=Ah(gu.argv[0],["-e",x]);ch.existsSync(C););var Q=JSON.parse(ch.readFileSync(E,"utf8"));S.stdin.end(),ch.unlinkSync(E),Q.err?n.handleError(Q.err):(t=Q.data,n.status=Q.data.statusCode,n.responseText=Q.data.text,p(n.DONE))}}},this.handleError=function(e){this.status=0,this.statusText=e,this.responseText=e.stack,d=!0,p(this.DONE),this.dispatchEvent("error")},this.abort=function(){e&&(e.abort(),e=null),l=s,this.status=0,this.responseText="",this.responseXML="",d=!0,this.readyState===this.UNSENT||this.readyState===this.OPENED&&!h||this.readyState===this.DONE||(h=!1,p(this.DONE)),this.readyState=this.UNSENT,this.dispatchEvent("abort")},this.addEventListener=function(e,t){e in f||(f[e]=[]),f[e].push(t)},this.removeEventListener=function(e,t){e in f&&(f[e]=f[e].filter((function(e){return e!==t})))},this.dispatchEvent=function(e){if("function"==typeof n["on"+e]&&n["on"+e](),e in f)for(var t=0,r=f[e].length;t<r;t++)f[e][t].call(n)};var p=function(e){e!=n.LOADING&&n.readyState===e||(n.readyState=e,(o.async||n.readyState<n.OPENED||n.readyState===n.DONE)&&n.dispatchEvent("readystatechange"),n.readyState!==n.DONE||d||(n.dispatchEvent("load"),n.dispatchEvent("loadend")))}};function dh(e){return function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){return yield new Promise(((t,n)=>{let{url:r}=e;r||n(new Error("URL is missing")),"http://"!==r.substr(0,7)||e.forceHttp||(console.warn(`Upgrading requested url ${r} to https protocol.`),r=r.replace("http://","https://"));const i=new("undefined"==typeof XMLHttpRequest?hh:XMLHttpRequest);i.onload=()=>{if(i.status>=200&&i.status<300)t(i.responseText);else{console.log(i.responseText);const e=`Error fetching url:${r}; status code:${i.status}`;n(new Error(e))}},i.ontimeout=e=>{console.log("ontimeout",e)},i.onreadystatechange=()=>{404===i.status&&n(new Error(`Error fetching url:${r}; status code:${i.status}`))},i.onerror=()=>{console.error(`Request failed with error ${i.responseText}`),n(new Error(i.responseText))},i.open(e.method||"GET",r),e["bearer-token"]&&i.setRequestHeader("Authorization",`Bearer ${e["bearer-token"]}`),e["allow-cache"]||i.setRequestHeader("Cache-Control","no-cache, no-store, max-age=0"),e.body?i.send(JSON.stringify(e.body)):i.send()}))}))}function fh(e,t){return"string"!=typeof e?(console.warn("Trying to test a non string variable"),!1):0===e.indexOf(t)}function ph(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(fh(e,r))return e.slice(r.length)}return e}var gh=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};function yh(e){const t={[Ol.Ethropst]:"ropsten",[Ol.Ethrinkeby]:"rinkeby",[Ol.Ethgoerli]:"goerli",[Ol.Ethsepolia]:"sepolia"};return t[e]?`https://api-${t[e]}.etherscan.io/api?module=proxy`:"https://api.etherscan.io/api?module=proxy"}const mh={serviceURL:function(e){return`${yh(e)}&action=eth_getTransactionByHash&txhash={transaction_id}`},serviceName:Rl.etherscan,parsingFunction:function({jsonResponse:e,chain:t,key:n,keyPropertyName:r}){return gh(this,void 0,void 0,(function*(){const i=yh(t),o={serviceURL:{main:`${i}&action=eth_getBlockByNumber&boolean=true&tag={transaction_id}`,test:`${i}&action=eth_getBlockByNumber&boolean=true&tag={transaction_id}`}},a={serviceURL:{main:`${i}&action=eth_blockNumber`,test:`${i}&action=eth_blockNumber`}},s=yield function(e,t){return gh(this,void 0,void 0,(function*(){const i=e.result.blockNumber,s=ql({explorerAPI:Object.assign(Object.assign({},o),{key:n,keyPropertyName:r}),transactionId:i,chain:t});try{const e=yield dh({url:s}),o=JSON.parse(e).result;return yield function(e,t){return gh(this,void 0,void 0,(function*(){const i=ql({explorerAPI:Object.assign(Object.assign({},a),{key:n,keyPropertyName:r}),chain:e});let o;try{o=yield dh({url:i})}catch(e){throw new Error("Unable to get remote hash")}const s=JSON.parse(o).result;if(s-t<1)throw new Error("Not enough");return s}))}(t,i),o}catch(e){throw new Error("Unable to get remote hash")}}))}(e,t);return function(e,t){const n=e.result,r=new Date(1e3*parseInt(t.timestamp,16)),i=n.from;return{remoteHash:ph(n.input,jl.ethmain.prefixes),issuingAddress:i,time:r,revokedAddresses:[]}}(e,s)}))},priority:-1};function vh(e){return""===e?"":function(e){const t=Date.parse(e);if(t)return new Date(t);const n=function(e){let t=e.slice(0,-5).split(/\D/).map((function(e){return parseInt(e,10)||0}));t[1]-=1,t=new Date(Date.UTC.apply(Date,t));const n=e.slice(-5);let r=parseInt(n,10)/100;return"+"===n.slice(0,1)&&(r*=-1),t.setHours(t.getHours()+r),t.getTime()}(e);return n||function(e){let t,n;const r=/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*)?)([zZ]|([+\-])(\d\d):?(\d\d))?$/.exec(e)||[];return r[1]?(t=r[1].split(/\D/).map((function(e){return parseInt(e,10)||0})),t[1]-=1,t=new Date(Date.UTC.apply(Date,t)),t.getDate()?(r[5]&&(n=parseInt(r[5],10)/100*60,r[6]&&(n+=parseInt(r[6],10)),"+"===r[4]&&(n*=-1),n&&t.setUTCMinutes(t.getUTCMinutes()+n)),t):null):null}(e)}(`${e}`)}function wh(e){return new Date(1e3*e)}const Ih={serviceURL:{main:"https://api.blockcypher.com/v1/eth/main/txs/{transaction_id}?limit=500",test:"https://api.blockcypher.com/v1/beth/test/txs/{transaction_id}?limit=500"},serviceName:Rl.blockcypher,parsingFunction:function({jsonResponse:e}){if(e.confirmations<1)throw new Error("Not enough");const t=vh(e.received),n=e.outputs,r=n[n.length-1];let i=e.inputs[0].addresses[0];const o=ph(r.script,jl.ethmain.prefixes);return i=function(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(!fh(e,r))return`${r}${e}`}return e}(i,jl.ethmain.prefixes),{remoteHash:o,issuingAddress:i,time:t,revokedAddresses:n.filter((e=>!!e.spent_by)).map((e=>e.addresses[0]))}},priority:-1},bh={serviceURL:{main:"https://blockstream.info/api/tx/{transaction_id}",test:"https://blockstream.info/testnet/api/tx/{transaction_id}"},serviceName:Rl.blockstream,parsingFunction:function({jsonResponse:e}){if(!e.status.confirmed)throw new Error("Number of transaction confirmations were less than the minimum required, according to Blockstream API");const t=wh(e.status.block_time),n=e.vout,r=n[n.length-1],i=e.vin[0].prevout.scriptpubkey_address;return{remoteHash:ph(r.scriptpubkey,jl.bitcoin.prefixes),issuingAddress:i,time:t,revokedAddresses:n.filter((e=>!!e.scriptpubkey_address)).map((e=>e.scriptpubkey_address))}},priority:-1},Bh={serviceURL:{main:"https://api.blockcypher.com/v1/btc/main/txs/{transaction_id}?limit=500",test:"https://api.blockcypher.com/v1/btc/test3/txs/{transaction_id}?limit=500"},serviceName:Rl.blockcypher,parsingFunction:function({jsonResponse:e}){if(e.confirmations<1)throw new Error("Number of transaction confirmations were less than the minimum required, according to Blockcypher API");const t=vh(e.received),n=e.outputs,r=n[n.length-1],i=e.inputs[0].addresses[0];return{remoteHash:ph(r.script,jl.bitcoin.prefixes),issuingAddress:i,time:t,revokedAddresses:n.filter((e=>!!e.spent_by)).map((e=>e.addresses[0]))}},priority:-1};var Eh=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};function Ch(e){return e.map((e=>({getTxData:(t,n)=>Eh(this,void 0,void 0,(function*(){return yield function(e,t,n){return Eh(this,void 0,void 0,(function*(){const r=ql({explorerAPI:e,transactionId:t,chain:n});try{const t=yield dh({url:r});return yield e.parsingFunction(Object.assign({jsonResponse:JSON.parse(t),chain:n},e))}catch(e){throw new Error("Unable to get remote hash")}}))}(e,t,n)})),priority:e.priority})))}const xh=[Bh,bh],Sh=[mh,Ih];function Qh({serviceUrl:e,transactionId:t}){return function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){const n={method:"eth_getTransactionByHash",jsonrpc:"2.0",id:"getbyhash",params:["0x"+t]},r=yield dh({url:e,body:n,method:"POST"}),i=JSON.parse(r),o={method:"eth_getBlockByNumber",jsonrpc:"2.0",id:"blockbynumber",params:[i.result.blockNumber,!0]},a=yield dh({url:e,body:o,method:"POST"}),s=JSON.parse(a),l=i.result,u=s.result,A=new Date(1e3*parseInt(u.timestamp,16)),c=l.from;return{remoteHash:ph(l.input,["0x"]),issuingAddress:c,time:A,revokedAddresses:[]}}))}function kh({serviceUrl:e,transactionId:t}){return function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){const n={method:"getrawtransaction",jsonrpc:"2.0",id:"rpctest",params:[t,!0]},r=yield dh({url:e,body:n,method:"POST"}),i=JSON.parse(r).result;return{issuingAddress:i.vout[0].scriptPubKey.addresses[0],remoteHash:ph(i.vout[1].scriptPubKey.asm,["6a20","OP_RETURN "]),time:wh(i.blocktime),revokedAddresses:i.vout.filter((e=>!!e.scriptPubKey.addresses)).map((e=>e.scriptPubKey.addresses)).flat()}}))}const _h=[];function Nh(e=[],t=[],n=!1){const r=e.map((e=>e.serviceName)).filter((e=>!!e)).filter((e=>!!Rl[e]));return r.length?t.reduce(((t,i)=>{if(r.includes(i.serviceName)){const n=Object.assign({},i),r=e.find((e=>e.serviceName===i.serviceName));if(function(e){if(e.key&&!e.keyPropertyName)throw new Error(`Property keyPropertyName is not set for ${e.serviceName}. Cannot pass the key property to the service.`);return!0}(r)){const i=Object.assign(n,r);t.push(i);const o=e.findIndex((e=>e.serviceName===i.serviceName));_h.includes(o)||_h.push(o)}}else t.push(i);return n&&function(e,t){t.forEach((t=>e.splice(t,1)))}(e,_h),t}),[]):t}function Dh(e){return e.map((e=>(e.parsingFunction||(e.parsingFunction="btc"===e.chainType?kh:Qh),e))).map((e=>({getTxData:t=>function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){return yield e.parsingFunction(Object.assign(Object.assign({},e),{transactionId:t}))})),priority:e.priority})))}var Fh,Uh=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};function Ph(e,t){var n;switch(e){case jl[Ol.Bitcoin].code:case jl[Ol.Regtest].code:case jl[Ol.Testnet].code:case jl[Ol.Mocknet].code:return t.bitcoin;case jl[Ol.Ethmain].code:case jl[Ol.Ethropst].code:case jl[Ol.Ethrinkeby].code:case jl[Ol.Ethgoerli].code:case jl[Ol.Ethsepolia].code:return t.ethereum;default:if(!(null===(n=t.custom)||void 0===n?void 0:n.length))throw new Error("Chain is not natively supported. Use custom explorers to retrieve tx data.");return t.custom}}function Th(e,t,n,r){return Uh(this,void 0,void 0,(function*(){try{const i=function(e,t,n){if(1>e.length)throw new Error("Invalid application configuration; check the CONFIG.MinimumBlockchainExplorers configuration value");const r=[],i=e.length;for(let o=0;o<i;o++)r.push(e[o].getTxData(t,n));return r}(e[t],n,r);return yield function(e){return Uh(this,void 0,void 0,(function*(){let t;try{t=yield Gl(e,1)}catch(e){throw new Error(`Transaction lookup error: ${e.message}`)}if(!t||0===t.length)throw new Error("Could not confirm transaction data.");const n=t[0];for(let e=1;e<t.length;e++){const r=t[e];if(n.issuingAddress!==r.issuingAddress)throw new Error("Issuing addresses do not match consistently");if(n.remoteHash!==r.remoteHash)throw new Error("Remote hashes do not match consistently")}return n}))}(i)}catch(i){if(t<e.length-1)return t++,yield Th(e,t,n,r);throw i}}))}function Lh({transactionId:e,chain:t,explorerAPIs:n=[]}){return Uh(this,void 0,void 0,(function*(){const r=function(e){const{bitcoin:t,ethereum:n}={bitcoin:Ch(Nh(r=e,xh)),ethereum:Ch(Nh(r,Sh))};var r;const{custom:i}=function(e){return{custom:Dh(e)}}(e.filter((e=>"rpc"===e.apiType)));return{bitcoin:t,ethereum:n,custom:[...i,...Ch(e.filter((e=>"rpc"!==e.apiType)))]}}(n),i=function({defaultAPIs:e,customAPIs:t}){const n=[e];if(null==t?void 0:t.length){const e=t[0].priority;n.splice(e,0,t)}if(1>e.concat(t).length)throw new Error("Invalid application configuration; check the CONFIG.MinimumBlockchainExplorers configuration value");return n}({defaultAPIs:Ph(t,r),customAPIs:r.custom});return yield Th(i,0,e,t)}))}!function(e){e.mainnet="mainnet",e.testnet="testnet"}(Fh||(Fh={}));var Mh={"@context":{id:"@id",type:"@type",extensions:"https://w3id.org/openbadges/extensions#",obi:"https://w3id.org/openbadges#",validation:"obi:validation",cred:"https://w3id.org/credentials#",dc:"http://purl.org/dc/terms/",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",AlignmentObject:"schema:AlignmentObject",CryptographicKey:"sec:Key",Endorsement:"cred:Credential",Assertion:"obi:Assertion",BadgeClass:"obi:BadgeClass",Criteria:"obi:Criteria",Evidence:"obi:Evidence",Extension:"obi:Extension",FrameValidation:"obi:FrameValidation",IdentityObject:"obi:IdentityObject",Image:"obi:Image",HostedBadge:"obi:HostedBadge",hosted:"obi:HostedBadge",Issuer:"obi:Issuer",Profile:"obi:Profile",RevocationList:"obi:RevocationList",SignedBadge:"obi:SignedBadge",signed:"obi:SignedBadge",TypeValidation:"obi:TypeValidation",VerificationObject:"obi:VerificationObject",author:{"@id":"schema:author","@type":"@id"},caption:{"@id":"schema:caption"},claim:{"@id":"cred:claim","@type":"@id"},created:{"@id":"dc:created","@type":"xsd:dateTime"},creator:{"@id":"dc:creator","@type":"@id"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},endorsement:{"@id":"cred:credential","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},genre:{"@id":"schema:genre"},image:{"@id":"schema:image","@type":"@id"},name:{"@id":"schema:name"},owner:{"@id":"sec:owner","@type":"@id"},publicKey:{"@id":"sec:publicKey","@type":"@id"},publicKeyPem:{"@id":"sec:publicKeyPem"},related:{"@id":"dc:relation","@type":"@id"},startsWith:{"@id":"http://purl.org/dqm-vocabulary/v1/dqm#startsWith"},tags:{"@id":"schema:keywords"},targetDescription:{"@id":"schema:targetDescription"},targetFramework:{"@id":"schema:targetFramework"},targetName:{"@id":"schema:targetName"},targetUrl:{"@id":"schema:targetUrl"},telephone:{"@id":"schema:telephone"},url:{"@id":"schema:url","@type":"@id"},version:{"@id":"schema:version"},alignment:{"@id":"obi:alignment","@type":"@id"},allowedOrigins:{"@id":"obi:allowedOrigins"},audience:{"@id":"obi:audience"},badge:{"@id":"obi:badge","@type":"@id"},criteria:{"@id":"obi:criteria","@type":"@id"},endorsementComment:{"@id":"obi:endorsementComment"},evidence:{"@id":"obi:evidence","@type":"@id"},hashed:{"@id":"obi:hashed","@type":"xsd:boolean"},identity:{"@id":"obi:identityHash"},issuedOn:{"@id":"obi:issueDate","@type":"xsd:dateTime"},issuer:{"@id":"obi:issuer","@type":"@id"},narrative:{"@id":"obi:narrative"},recipient:{"@id":"obi:recipient","@type":"@id"},revocationList:{"@id":"obi:revocationList","@type":"@id"},revocationReason:{"@id":"obi:revocationReason"},revoked:{"@id":"obi:revoked","@type":"xsd:boolean"},revokedAssertions:{"@id":"obi:revoked"},salt:{"@id":"obi:salt"},targetCode:{"@id":"obi:targetCode"},uid:{"@id":"obi:uid"},validatesType:"obi:validatesType",validationFrame:"obi:validationFrame",validationSchema:"obi:validationSchema",verification:{"@id":"obi:verify","@type":"@id"},verificationProperty:{"@id":"obi:verificationProperty"},verify:"verification"}},Rh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"obi:revoked","@type":"xsd:boolean"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:{"@id":"obi:verify","@type":"@id"},publicKey:{"@id":"sec:publicKey","@type":"@id"},BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0/merkleProof2017Schema.json"}]},Oh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"obi:revoked","@type":"xsd:boolean"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:{"@id":"obi:verify","@type":"@id"},publicKey:{"@id":"sec:publicKey","@type":"@id"},BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.1/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.1/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.1/merkleProof2017Schema.json"}]},Hh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType"},contentEncoding:{"@id":"bc:contentEncoding"},content:{"@id":"bc:content"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey"},url:{"@id":"schema:url"},image:{"@id":"schema:image"},criteria:{"@id":"schema:criteria"},claim:{"@id":"schema:claim"}}},Kh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType"},contentEncoding:{"@id":"bc:contentEncoding"},content:{"@id":"bc:content"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey"},url:{"@id":"schema:url"},image:{"@id":"schema:image"},criteria:{"@id":"schema:criteria"},claim:{"@id":"schema:claim"}}};const jh={};jh["https://w3id.org/openbadges/v2"]=Mh,jh["https://openbadgespec.org/v2/context.json"]=Mh,jh["https://www.w3.org/2018/credentials/v1"]={"@context":{"@version":1.1,id:"@id",type:"@type",VerifiableCredential:{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@version":1.1,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",credentialSchema:{"@id":"cred:credentialSchema","@type":"@id","@context":{"@version":1.1,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",JsonSchemaValidator2018:"cred:JsonSchemaValidator2018"}},credentialStatus:{"@id":"cred:credentialStatus","@type":"@id"},credentialSubject:{"@id":"cred:credentialSubject","@type":"@id"},evidence:{"@id":"cred:evidence","@type":"@id"},expirationDate:{"@id":"cred:expirationDate","@type":"xsd:dateTime"},holder:{"@id":"cred:holder","@type":"@id"},issued:{"@id":"cred:issued","@type":"xsd:dateTime"},issuer:{"@id":"cred:issuer","@type":"@id"},issuanceDate:{"@id":"cred:issuanceDate","@type":"xsd:dateTime"},proof:{"@id":"sec:proof","@type":"@id","@container":"@graph"},refreshService:{"@id":"cred:refreshService","@type":"@id","@context":{"@version":1.1,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",ManualRefreshService2018:"cred:ManualRefreshService2018"}},termsOfUse:{"@id":"cred:termsOfUse","@type":"@id"},validFrom:{"@id":"cred:validFrom","@type":"xsd:dateTime"},validUntil:{"@id":"cred:validUntil","@type":"xsd:dateTime"}}},VerifiablePresentation:{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@version":1.1,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",sec:"https://w3id.org/security#",holder:{"@id":"cred:holder","@type":"@id"},proof:{"@id":"sec:proof","@type":"@id","@container":"@graph"},verifiableCredential:{"@id":"cred:verifiableCredential","@type":"@id","@container":"@graph"}}},EcdsaSecp256k1Signature2019:{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},EcdsaSecp256r1Signature2019:{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},Ed25519Signature2018:{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},RsaSignature2018:{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@version":1.1,challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"}}},jh["https://w3id.org/blockcerts/schema/2.0/context.json"]=Rh,jh["https://www.blockcerts.org/schema/2.0/context.json"]=Rh,jh["https://w3id.org/blockcerts/v2"]=Rh,jh["https://w3id.org/blockcerts/schema/2.1/context.json"]=Oh,jh["https://www.blockcerts.org/schema/2.1/context.json"]=Oh,jh["https://w3id.org/blockcerts/v2.1"]=Oh,jh["https://w3id.org/blockcerts/schema/3.0/context.json"]=Hh,jh["https://www.blockcerts.org/schema/3.0/context.json"]=Hh,jh["https://w3id.org/blockcerts/v3"]=Hh,jh["https://w3id.org/blockcerts/schema/3.1/context.json"]=Kh,jh["https://www.blockcerts.org/schema/3.1/context.json"]=Kh,jh["https://w3id.org/blockcerts/v3.1"]=Kh,jh["https://w3id.org/security/suites/merkle-2019/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},MerkleProof2019:{"@id":"https://w3id.org/security#MerkleProof2019","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}},jh["https://w3id.org/security/suites/chained-2021/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},ChainedProof2021:{"@id":"https://w3id.org/security#ChainedProof2021","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"},chainedProofType:{"@id":"https://w3id.org/security#chainedProofType","@type":"@id"},previousProof:{"@id":"https://w3id.org/security#previousProof","@type":"@id"}}}}},jh["https://w3id.org/vc/status-list/2021/v1"]={"@context":{"@protected":!0,StatusList2021Credential:{"@id":"https://w3id.org/vc/status-list#StatusList2021Credential","@context":{"@protected":!0,id:"@id",type:"@type",description:"http://schema.org/description",name:"http://schema.org/name"}},StatusList2021:{"@id":"https://w3id.org/vc/status-list#StatusList2021","@context":{"@protected":!0,id:"@id",type:"@type",statusPurpose:"https://w3id.org/vc/status-list#statusPurpose",encodedList:"https://w3id.org/vc/status-list#encodedList"}},StatusList2021Entry:{"@id":"https://w3id.org/vc/status-list#StatusList2021Entry","@context":{"@protected":!0,id:"@id",type:"@type",statusPurpose:"https://w3id.org/vc/status-list#statusPurpose",statusListIndex:"https://w3id.org/vc/status-list#statusListIndex",statusListCredential:{"@id":"https://w3id.org/vc/status-list#statusListCredential","@type":"@id"}}}}};var Gh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",creator:{"@id":"dc:creator","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"sec:expiration","@type":"xsd:dateTime"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:"bc:verification",publicKeys:"bc:publicKeys",ChainpointSHA256v2:"cp:ChainpointSHA256v2",BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/merkleProof2017Schema.json"}]},qh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"bc:created","@type":"xsd:dateTime"},name:{"@id":"schema:name"}}},Vh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType","@type":"@id"},contentEncoding:{"@id":"bc:contentEncoding","@type":"@id"},content:{"@id":"bc:content","@type":"@id"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey","@type":"@id"},url:{"@id":"schema:url","@type":"@id"},image:{"@id":"schema:image","@type":"@id"}}};jh["https://w3id.org/blockcerts/schema/2.0-alpha/context.json"]=Gh,jh["https://www.blockcerts.org/schema/2.0-alpha/context.json"]=Gh,jh["https://www.blockcerts.org/schema/3.0-alpha/context.json"]=qh,jh["https://w3id.org/blockcerts/schema/3.0-alpha/context.json"]=qh,jh["https://w3id.org/blockcerts/v3.0-alpha"]=qh,jh["https://www.blockcerts.org/schema/3.0-beta/context.json"]=Vh,jh["https://w3id.org/blockcerts/schema/3.0-beta/context.json"]=Vh,jh["https://w3id.org/blockcerts/v3.0-beta"]=Vh,jh["https://w3id.org/security/suites/ed25519-2020/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},Ed25519VerificationKey2020:{"@id":"https://w3id.org/security#Ed25519VerificationKey2020","@context":{"@protected":!0,id:"@id",type:"@type",controller:{"@id":"https://w3id.org/security#controller","@type":"@id"},revoked:{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},Ed25519Signature2020:{"@id":"https://w3id.org/security#Ed25519Signature2020","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};const zh={locale:"en-US"};var Jh=Object.freeze({__proto__:null,isMainnet:function(e){return Ll(e,"1")||Ll(e,"ecdsa-koblitz-pubkey:1")}}),Yh={locale:"en-US"},Xh={"en-US":{steps:{formatValidationLabel:"Format validation",formatValidationLabelPending:"Validating format",signatureVerificationLabel:"Proof Verification",signatureVerificationLabelPending:"Verifying Proof",identityVerificationLabel:"Identity verification",identityVerificationLabelPending:"Verifying identity",statusCheckLabel:"Status check",statusCheckLabelPending:"Checking record status"},subSteps:{getTransactionIdLabel:"Get transaction ID",getTransactionIdLabelPending:"Getting transaction ID",computeLocalHashLabel:"Compute local hash",computeLocalHashLabelPending:"Computing local hash",fetchRemoteHashLabel:"Fetch remote hash",fetchRemoteHashLabelPending:"Fetching remote hash",getIssuerProfileLabel:"Get issuer profile",getIssuerProfileLabelPending:"Getting issuer profile",parseIssuerKeysLabel:"Parse issuer keys",parseIssuerKeysLabelPending:"Parsing issuer keys",compareHashesLabel:"Compare hashes",compareHashesLabelPending:"Comparing hashes",checkDocumentSignatureLabel:"Check document signature",checkDocumentSignatureLabelPending:"Checking document signature",checkMerkleRootLabel:"Check Merkle Root",checkMerkleRootLabelPending:"Checking Merkle Root",checkReceiptLabel:"Check Receipt",checkReceiptLabelPending:"Checking Receipt",checkAuthenticityLabel:"Check Authenticity",checkAuthenticityLabelPending:"Checking Authenticity",checkRevokedStatusLabel:"Check Revoked Status",checkRevokedStatusLabelPending:"Checking Revoked Status",checkExpiresDateLabel:"Check Expiration Date",checkExpiresDateLabelPending:"Checking Expiration Date",controlVerificationMethodLabel:"Control Verification Method",controlVerificationMethodLabelPending:"Controlling Verification Method",retrieveVerificationMethodPublicKeyLabel:"Extract Public Key from DID Document",retrieveVerificationMethodPublicKeyLabelPending:"Extracting Public Key from DID Document",deriveIssuingAddressFromPublicKeyLabel:"Derive Issuing Address from Public Key",deriveIssuingAddressFromPublicKeyLabelPending:"Deriving Issuing Address from Public Key",compareIssuingAddressLabel:"Compare addresses",compareIssuingAddressLabelPending:"Comparing addresses",checkImagesIntegrityLabel:"Verify Images Integrity",checkImagesIntegrityLabelPending:"Verifying Images Integrity"},revocation:{preReason:"Reason given:",reason:"This certificate has been revoked by the issuer."},success:{mocknet:{label:"This Mocknet credential passed all checks",description:"Mocknet credentials are used for test purposes only. They are not recorded on a blockchain, and they should not be considered verified Blockcerts."},blockchain:{label:"Verified",description:"This is a valid ${chain} certificate.",linkText:"View transaction link"},generic:{label:"Verified",description:"The ${SIGNATURE_TYPE} signature of this document has been successfully verified."},multisign:{label:"Verified",description:"All the signatures of this certificate have successfully verified."}},errors:{certificateNotValid:"This is not a valid certificate",couldNotConfirmTx:"Could not confirm the transaction",ensureHashesEqual:"Computed hash does not match remote hash",ensureMerkleRootEqual:"Merkle root does not match remote hash.",ensureNotExpired:"This certificate has expired.",ensureValidReceipt:"The receipt is malformed. There was a problem navigating the merkle tree in the receipt.",failedJsonLdNormalization:"Failed JSON-LD normalization",foundUnmappedFields:"Found unmapped fields during JSON-LD normalization",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",controlVerificationMethod:"The identity document provided by the issuer does not match the verification method",retrieveVerificationMethodPublicKey:"The identity document provided by the issuer does not reference the verification method",compareIssuingAddress:"The provided verification method does not match the issuer identity",invalidIssuingAddressCreationTime:"The specified issuing address was created after the transaction occurred.",invalidIssuingAddressRevoked:"The specified issuing address was revoked by the issuer before the transaction occurred.",invalidIssuingAddressExpired:"The specified issuing address expired before the transaction occurred.",invalidIssuingAddressUnknown:"The address used to issue this Blockcerts does not belong to the claimed issuer.",getChain:"Didn't recognize chain value",getIssuerProfile:"Unable to get issuer profile",getRevokedAssertions:"Unable to get revocation assertions",getTransactionId:"Cannot verify this certificate without a transaction ID to compare against.",invalidMerkleReceipt:"Invalid Merkle Receipt. Proof hash did not match Merkle root",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"Cannot verify this certificate without a transaction ID to compare against.",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",parseIssuerKeys:"Unable to parse JSON out of issuer identification data.",checkImagesIntegrity:"Image integrity verification proved that the content was modified after issuance."}},fr:{steps:{formatValidationLabel:"Validation du format",formatValidationLabelPending:"Validation du format",signatureVerificationLabel:"Vérification de la preuve",signatureVerificationLabelPending:"Vérification de la preuve",identityVerificationLabel:"Vérification de l'identité",identityVerificationLabelPending:"Vérification de l'identité",statusCheckLabel:"Vérification du status",statusCheckLabelPending:"Vérification du status"},subSteps:{getTransactionIdLabel:"Obtention de l'identifiant de transaction",getTransactionIdLabelPending:"Obtention de l'identifiant de transaction",computeLocalHashLabel:"Calcul du hash local",computeLocalHashLabelPending:"Calcul du hash local",fetchRemoteHashLabel:"Récupération du hash distant",fetchRemoteHashLabelPending:"Récupération du hash distant",getIssuerProfileLabel:"Obtention du profil de l'émetteur",getIssuerProfileLabelPending:"Obtention du profil de l'émetteur",parseIssuerKeysLabel:"Traitement des clés de l'émetteur",parseIssuerKeysLabelPending:"Traitement des clés de l'émetteur",compareHashesLabel:"Comparaison des hash",compareHashesLabelPending:"Comparaison des hashs",checkDocumentSignatureLabel:"Vérification de la signature du document",checkDocumentSignatureLabelPending:"Vérification de la signature du document",checkMerkleRootLabel:"Vérification du Merkle Root",checkMerkleRootLabelPending:"Vérification du Merkle Root",checkReceiptLabel:"Vérification du reçu",checkReceiptLabelPending:"Vérification du reçu",checkAuthenticityLabel:"Vérification de l'authenticité",checkAuthenticityLabelPending:"Vérification de l'authenticité",checkRevokedStatusLabel:"Vérification du status de révocation",checkRevokedStatusLabelPending:"Vérification du status de révocation",checkExpiresDateLabel:"Vérification de la date d'expiration",checkExpiresDateLabelPending:"Vérification de la date d'expiration",controlVerificationMethodLabel:"Contrôle de la Méthode de Vérification",controlVerificationMethodLabelPending:"Contrôle de la Méthode de Vérification",retrieveVerificationMethodPublicKeyLabel:"Extraction de la clé publique depuis le document DID",retrieveVerificationMethodPublicKeyLabelPending:"Extraction de la clé publique depuis le document DID",deriveIssuingAddressFromPublicKeyLabel:"Dérivation de l'adresse d'émission depuis la clé publique",deriveIssuingAddressFromPublicKeyLabelPending:"Dérivation de l'adresse d'émission depuis la clé publique",compareIssuingAddressLabel:"Comparaison des adresses",compareIssuingAddressLabelPending:"Comparaison des adresses",checkImagesIntegrityLabel:"Vérification de l'Intégrité des Images",checkImagesIntegrityLabelPending:"Vérification de l'Intégrité des Images"},revocation:{preReason:"Raison :",reason:"Ce certificat a été révoqué par l'émetteur."},success:{mocknet:{label:"Cet enregistrement Mocknet a été vérifié",description:"Le mode Mocknet est utilisé à des fins de tests uniquement. Ce Blockcert n'a pas été enregistré sur une blockchain, et en tant que tel ne peut pas être considéré un Blockcert valide."},blockchain:{label:"Vérifié",description:"Ceci est un certificat ${chain} valide.",linkText:"Voir la transaction"},generic:{label:"Verified",description:"La signature ${SIGNATURE_TYPE} de ce certificat a été vérifiée avec succès."},multisign:{label:"Vérifié",description:"Toutes les signatures numériques de ce certificat ont été vérifiées avec succès."}},errors:{certificateNotValid:"Certificat invalide",couldNotConfirmTx:"Impossible de confirmer la transaction",ensureHashesEqual:"Calcul du hash local différent du hash distant",ensureMerkleRootEqual:"Le Merkle root ne correspond pas au hash distant",ensureNotExpired:"Certificat expiré",ensureValidReceipt:"Erreur d'écriture du reçu. Un problème est survenu lors de la navigation de l'arbre Merkle du reçu.",failedJsonLdNormalization:"Erreur de normalisation JSON-LD",foundUnmappedFields:"Champs non liés découverts durant la normalisation JSON-LD",identityErrorBaseMessage:"Identité de l'émetteur invalide",deriveIssuingAddressFromPublicKey:"Cette blockchain n'est pas supportée pour la vérification de l'identité décentralisée.",controlVerificationMethod:"Le document d'identité de l'émetteur ne correspond pas à la méthode de vérification.",retrieveVerificationMethodPublicKey:"Le document d'identité de l'émetteur ne fait pas mention de la méthode de vérification.",compareIssuingAddress:"La méthode de vérification n'a pas permis d'établir l'identité de l'émetteur.",invalidIssuingAddressCreationTime:"L'adresse d'émission utilisée a été créée après la transaction d'enregistrement.",invalidIssuingAddressRevoked:"L'adresse d'émission utilisée a été décommissionnée par l'émetteur avant la transaction d'enregistrement.",invalidIssuingAddressExpired:"L'adresse d'émission utilisée a expiré avant la transaction.",invalidIssuingAddressUnknown:"L'adresse utilisée pour émettre ce Blockcerts n'appartient à l'émetteur déclaré.",getChain:"Valeur de chaine non reconnue",getIssuerProfile:"Profil de l'émetteur indisponible",getRevokedAssertions:"Impossible d'obtenir les raisons de revocation",getTransactionId:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",invalidMerkleReceipt:"Reçu Merkle invalide. Hash de preuve différent du Merkle root",invalidMerkleVersion:"La version du Merkle utilisé est incompatible avec la version Blockcerts.",isTransactionIdValid:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",issuerProfileNotSet:"l'URL de l'émetteur n'est pas définie",issuerProfileInvalid:"le document distant ne semble pas être un profil d'émetteur valide",parseIssuerKeys:"Impossible de lire le JSON d'identification de l'émetteur",checkImagesIntegrity:"La vérification des images a prouvé que le contenu a été modifié après l'émission."}},es:{steps:{formatValidationLabel:"Validación de formato",formatValidationLabelPending:"Validando el formato",signatureVerificationLabel:"Verificar prueba",signatureVerificationLabelPending:"Verificando prueba",identityVerificationLabel:"Verificar identitad",identityVerificationLabelPending:"Verificando identitad",statusCheckLabel:"Estado de Verificación",statusCheckLabelPending:"Verificando Estado de Grabación"},subSteps:{getTransactionIdLabel:"Obtener Identificación de Transacción",getTransactionIdLabelPending:"Obteniendo Identificación de Transacción",computeLocalHashLabel:"Calcular cadena binaria local",computeLocalHashLabelPending:"Calculando cadena binaria local",fetchRemoteHashLabel:"Obtener cadena binaria remota",fetchRemoteHashLabelPending:"Obeniendo cadena binaria remota",getIssuerProfileLabel:"Obtener perfil de emisor",getIssuerProfileLabelPending:"Obteniendo perfil de emisor",parseIssuerKeysLabel:"Analizar claves del emisor",parseIssuerKeysLabelPending:"Analizando claves del emisor",compareHashesLabel:"Comparar cadenas binarias",compareHashesLabelPending:"Comparando cadenas binarias",checkDocumentSignatureLabel:"Controlar firma del documento",checkDocumentSignatureLabelPending:"Controlando firma del documento",checkMerkleRootLabel:"Verificar Merkle Root",checkMerkleRootLabelPending:"Verificando Merkle Root",checkReceiptLabel:"Verificar Recibo",checkReceiptLabelPending:"Verificando Recibo",checkAuthenticityLabel:"Verificar Autenticidad",checkAuthenticityLabelPending:"Verificando Autenticidad",checkRevokedStatusLabel:"Verificar Estado de Revocación",checkRevokedStatusLabelPending:"Verificando Estado de Revocación",checkExpiresDateLabel:"Verificar Fechas de Expiración",checkExpiresDateLabelPending:"Verificando Fechas de Expiración",controlVerificationMethodLabel:"Controlar Metodo de Verificación",controlVerificationMethodLabelPending:"Controlando Metodo de Verificación",retrieveVerificationMethodPublicKeyLabel:"Extraer la llave pública desde el documento DID",retrieveVerificationMethodPublicKeyLabelPending:"Extraendo la llave pública desde el documento DID",deriveIssuingAddressFromPublicKeyLabel:"Derivar la dirección del emisor desde la llave pública",deriveIssuingAddressFromPublicKeyLabelPending:"Derivando la dirección del emisor desde la llave pública",compareIssuingAddressLabel:"Comparar direcciones",compareIssuingAddressLabelPending:"Comparando direcciones",checkImagesIntegrityLabel:"Comprobar Integridad de las Imagens",checkImagesIntegrityLabelPending:"Comprobando Integridad de las Imagens"},revocation:{preReason:"Razón dada:",reason:"Este certificado ha sido revocado por el emisor"},success:{mocknet:{label:"Esta credencial de Mocknet pasó todas las comprobaciones",description:"Las credenciales de Mocknet se usan solo con fines de prueba. No se graban en una cadena de bloques, y no se deben considerar Blockcerts Verificados."},blockchain:{label:"Verificado",description:"Este es un certificado válido de ${chain}.",linkText:"Ver enlace de transacción"},generic:{label:"Verified",description:"La firma ${SIGNATURE_TYPE} de este certificado ha verificado con éxito."},multisign:{label:"Verificado",description:"Todas las firmas digitales de este certificado han verificado con éxito."}},errors:{certificateNotValid:"Este no es un certificado válido",couldNotConfirmTx:"No se ha podido confirmar la transacción",ensureHashesEqual:"La cadena binaria calculada no corresponde con la cadena binaria remota",ensureMerkleRootEqual:"La raíz Merkle no corresponde con la cadena binaria remota",ensureNotExpired:"Este certificado ha expirado",ensureValidReceipt:"El recibo está malformado. Hubo un problema navegando el árbol Merkle en el recibo",failedJsonLdNormalization:"La normalización del JSON-LD ha fallado",foundUnmappedFields:"Se han encontrado campos no mapeados durante la normalización de JSON-LD",identityErrorBaseMessage:"Identitad del emisor inválida",deriveIssuingAddressFromPublicKey:"No se puede validar la identitad decentalisada con esta cadena binaria.",controlVerificationMethod:"El documento de identitad del emisor no corresponde al metodo de verificación.",retrieveVerificationMethodPublicKey:"El documento de identitad del emisor no hace constar al metodo de verificación.",compareIssuingAddress:"El metodo de verificación no corresponde a la identitad del emisor.",invalidIssuingAddressCreationTime:"El emisor creó el metodo de verificación después de la emisión del certificado.",invalidIssuingAddressRevoked:"El emisor revocó el metodo de verificación antes de la emisión del certificado.",invalidIssuingAddressExpired:"El metodo de verificación expiró antes de la emisión del certificado.",invalidIssuingAddressUnknown:"El metodo de verificación no pertenece a la identitad del emisor.",getChain:"Valor de cadena no reconocido",getIssuerProfile:"No se ha podido obtener el perfil del emisor",getRevokedAssertions:"No se ha podido obtener aseveraciones de revocación",getTransactionId:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",invalidMerkleReceipt:"Recibo Merkle inválido. La cadena binaria de prueba no corresponde con la raíz Merkle",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",issuerProfileNotSet:"URL del emisor no definido",issuerProfileInvalid:"el documento recogido no parece ser un perfil de emisor valido",parseIssuerKeys:"No se ha podido analizar el JSON de la información de identificación del emisor",checkImagesIntegrity:"La verificación de la integridad de los imagens provó alteración del contenido después de la emisión."}},mt:{steps:{formatValidationLabel:"Validazzjoni tal-format",formatValidationLabelPending:"Il-format qed jiġi vvalidat",signatureVerificationLabel:"Proof Verification",signatureVerificationLabelPending:"Verifying Proof",identityVerificationLabel:"Identity verification",identityVerificationLabelPending:"Verifying identity",statusCheckLabel:"Status check",statusCheckLabelPending:"Ir-record status qed jiġi ċċekkjat"},subSteps:{getTransactionIdLabel:"Ikseb l-ID ta' tranżazzjoni",getTransactionIdLabelPending:"L-ID ta' tranżazzjoni qed tiġi mniżżla",computeLocalHashLabel:"Ikkalkula l-hash lokali",computeLocalHashLabelPending:"Il-hash lokali qed jiġi kkalkulat",fetchRemoteHashLabel:"Fittex ir-remote hash",fetchRemoteHashLabelPending:"Ir-remote hash qed jiġi mfittex",getIssuerProfileLabel:"Ikseb il-profil tal-emittent",getIssuerProfileLabelPending:"Il-profil tal-emittent qed jiġi mniżżel",parseIssuerKeysLabel:"Estratta ċ-ċwievet tal-emittent",parseIssuerKeysLabelPending:"Iċ-ċwievet tal-emittent qed jiġu estratti",compareHashesLabel:"Ikkumpara l-hashes",compareHashesLabelPending:"Il-hashes qed jiġu kkomparati",checkDocumentSignatureLabel:"Check document signature",checkDocumentSignatureLabelPending:"Checking document signature",checkMerkleRootLabel:"Iċċekkja l-Merkle Root",checkMerkleRootLabelPending:"Il-Merkle Root Qed Tiġi Ċċekkjata",checkReceiptLabel:"Iċċekkja l-Irċevuta",checkReceiptLabelPending:"L-Irċevuta Qed Tiġi Ċċekkjata",checkAuthenticityLabel:"Iċċekkja l-Awtentiċità",checkAuthenticityLabelPending:"L-Awtentiċità Qed Tiġi Ċċekkjata",checkRevokedStatusLabel:"Iċċekkja l-Istatus Revokat",checkRevokedStatusLabelPending:"L-Istatus Revokat Qed Jiġi Ċċekkjat",checkExpiresDateLabel:"Iċċekkja d-Data ta' Skadenza",checkExpiresDateLabelPending:"Id-Data ta' Skadenza Qed Tiġi Ċċekkjata",controlVerificationMethodLabel:"Control Verification Method",controlVerificationMethodLabelPending:"Controlling Verification Method",retrieveVerificationMethodPublicKeyLabel:"Extract Public Key from DID Document",retrieveVerificationMethodPublicKeyLabelPending:"Extracting Public Key from DID Document",deriveIssuingAddressFromPublicKeyLabel:"Derive Issuing Address from Public Key",deriveIssuingAddressFromPublicKeyLabelPending:"Deriving Issuing Address from Public Key",compareIssuingAddressLabel:"Compare addresses",compareIssuingAddressLabelPending:"Comparing addresses",checkImagesIntegrityLabel:"Verify Images Integrity",checkImagesIntegrityLabelPending:"Verifying Images Integrity"},revocation:{preReason:"Raġuni mogħtija:",reason:"Dan iċ-ċertifikat ġie revokat mill-emittent."},success:{mocknet:{label:"Din il-kredenzjali tal-Mocknet għaddiet il-kontrolli kollha",description:"Il-kredenzjali tal-Mocknet jintużaw biss għal skopijiet ta 'ttestjar. Dawn mhumiex irreġistrati fuq blockchain, u ma għandhomx jiġu kkunsidrati bħala blockcerts verifikati."},blockchain:{label:"Ivverifikat",description:"Dan huwa ċertifikat ${chain} huwa validu.",linkText:"Ara l-link tat-transazzjoni"},generic:{label:"Ivverifikat",description:"The ${SIGNATURE_TYPE} signature of this document has been successfully verified."},multisign:{label:"Ivverifikat",description:"All the signatures of this certificate have successfully verified."}},errors:{certificateNotValid:"Dan mhux ċertifikat validu",couldNotConfirmTx:"Ma setgħetx tiġi kkonfermata t-tranżazzjoni",ensureHashesEqual:"Il-hash ikkalkulat ma jikkorrispondix mar-remote hash",ensureMerkleRootEqual:"Merkle root ma taqbilx mar-remote hash",ensureNotExpired:"Dan iċ-ċertifikat skada",ensureValidReceipt:"L-irċevuta hija malformata. Kien hemm problema fin-navigazzjoni tal-merkle tree fl-irċevuta",failedJsonLdNormalization:"In-normalizzazzjoni ta' JSON-LD ma rnexxietx",foundUnmappedFields:"Instabu unmapped fields matul in-normalizzazzjoni JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",controlVerificationMethod:"The identity document provided by the issuer does not match the verification method",retrieveVerificationMethodPublicKey:"The identity document provided by the issuer does not reference the verification method",compareIssuingAddress:"The provided verification method does not match the issuer identity",invalidIssuingAddressCreationTime:"L-indirizz elettroniku tal-ħruġ speċifikat inħoloq wara li seħħet it-tranżazzjoni.",invalidIssuingAddressRevoked:"L-indirizz elettroniku tal-ħruġ speċifikat ġie revokat mill-emittent qabel ma seħħet it-tranżazzjoni.",invalidIssuingAddressExpired:"L-indirizz elettroniku tal-ħruġ speċifikat skada qabel ma seħħet it-tranżazzjoni.",invalidIssuingAddressUnknown:"L-indirizz elettroniku użat biex jinħarġu dawn il-Blockcerts ma jappartjenix għall-emittent mitlub.",getChain:"Iċ-chain value ma ntgħarafx",getIssuerProfile:"Mhux possibbli jinkiseb il-profil tal-emittent",getRevokedAssertions:"Mhux possibbli jinkisbu dikjarazzjonijiet revokati",getTransactionId:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",invalidMerkleReceipt:"Irċevuta Merkle invalida. Il-proof hash ma kienx jaqbel mal-Merkle root",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",parseIssuerKeys:"Ma jistax jiġi estratt JSON mid-data tal-identifikazzjoni tal-emittent",checkImagesIntegrity:"Image integrity verification proved that the content was modified after issuance."}},"it-IT":{steps:{formatValidationLabel:"Convalidare formato",formatValidationLabelPending:"Convalida formato",signatureVerificationLabel:"Proof Verification",signatureVerificationLabelPending:"Verifying Proof",identityVerificationLabel:"Identity verification",identityVerificationLabelPending:"Verifying identity",statusCheckLabel:"Verificare stato",statusCheckLabelPending:"Verifica stato del record"},subSteps:{getTransactionIdLabel:"Ottenere ID transazione",getTransactionIdLabelPending:"Ottieni ID transazione",computeLocalHashLabel:"Calcolare hash locale",computeLocalHashLabelPending:"Calcola hash locale",fetchRemoteHashLabel:"Recuperare hash remoto",fetchRemoteHashLabelPending:"Recupera hash remoto",getIssuerProfileLabel:"Ottenere profilo issuer",getIssuerProfileLabelPending:"Ottieni profilo issuer",parseIssuerKeysLabel:"Analizzare chiavi issuer",parseIssuerKeysLabelPending:"Analizza chiavi issuer",compareHashesLabel:"Confrontare gli hash",compareHashesLabelPending:"Confronto hash",checkDocumentSignatureLabel:"Check document signature",checkDocumentSignatureLabelPending:"Checking document signature",checkMerkleRootLabel:"Controllare radice di Merkle",checkMerkleRootLabelPending:"Controllo radice di Merkle",checkReceiptLabel:"Verificare ricevuta",checkReceiptLabelPending:"Verifica ricevuta",checkAuthenticityLabel:"Verificare autenticità",checkAuthenticityLabelPending:"Verifica autenticità",checkRevokedStatusLabel:"Verificare stato revocato",checkRevokedStatusLabelPending:"Verifica stato revocato",checkExpiresDateLabel:"Verificare data di scadenza",checkExpiresDateLabelPending:"Verifica data di scadenza",controlVerificationMethodLabel:"Control Verification Method",controlVerificationMethodLabelPending:"Controlling Verification Method",retrieveVerificationMethodPublicKeyLabel:"Extract Public Key from DID Document",retrieveVerificationMethodPublicKeyLabelPending:"Extracting Public Key from DID Document",deriveIssuingAddressFromPublicKeyLabel:"Derive Issuing Address from Public Key",deriveIssuingAddressFromPublicKeyLabelPending:"Deriving Issuing Address from Public Key",compareIssuingAddressLabel:"Compare addresses",compareIssuingAddressLabelPending:"Comparing addresses",checkImagesIntegrityLabel:"Verify Images Integrity",checkImagesIntegrityLabelPending:"Verifying Images Integrity"},revocation:{preReason:"Motivo indicato:",reason:"Questo certificato è stato revocato dall'emittente."},success:{mocknet:{label:"Questo Blockcert simulato ha superato tutti i controlli.",description:"La modalità Mocknet è utilizzata solo dagli emittenti per testare il loro flusso di lavoro localmente. Questo Blockcert non è stato registrato su una blockchain e non dovrebbe essere considerato un Blockcert verificato."},blockchain:{label:"Verificato",description:"Questo è un certificato ${chain} valido.",linkText:"Vedi la transazione"},generic:{label:"Verificato",description:"The ${SIGNATURE_TYPE} signature of this document has been successfully verified."},multisign:{label:"Verificato",description:"All the signatures of this certificate have successfully verified."}},errors:{certificateNotValid:"Questo non è un certificato valido",couldNotConfirmTx:"Impossibile confermare la transazione",ensureHashesEqual:"L'hash calcolato non corrisponde all'hash remoto",ensureMerkleRootEqual:"La radice di Merkle non corrisponde all'hash remoto.",ensureNotExpired:"Questo certificato è scaduto.",ensureValidReceipt:"La ricevuta è malformata. C'è stato un problema nella navigazione dell'albero di Merkle nella ricevuta.",failedJsonLdNormalization:"Normalizzazione JSON-LD fallita",foundUnmappedFields:"Campi non mappati trovati durante la normalizzazione JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",controlVerificationMethod:"The identity document provided by the issuer does not match the verification method",retrieveVerificationMethodPublicKey:"The identity document provided by the issuer does not reference the verification method",compareIssuingAddress:"The provided verification method does not match the issuer identity",invalidIssuingAddressCreationTime:"The specified issuing address was created after the transaction occurred.",invalidIssuingAddressRevoked:"The specified issuing address was revoked by the issuer before the transaction occurred.",invalidIssuingAddressExpired:"The specified issuing address expired before the transaction occurred.",invalidIssuingAddressUnknown:"The address used to issue this Blockcerts does not belong to the claimed issuer.",getChain:"Il valore della catena non è stato riconosciuto",getIssuerProfile:"Impossibile ottenere il profilo dell'emittente",getRevokedAssertions:"Impossibile ottenere le asserzioni di revoca",getTransactionId:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",invalidMerkleReceipt:"Ricevuta Merkle non valida. L'hash di prova non corrisponde alla radice di Merkle",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",parseIssuerKeys:"Impossibile analizzare JSON dai dati di identificazione dell'emittente.",checkImagesIntegrity:"Image integrity verification proved that the content was modified after issuance."}},ja:{steps:{formatValidationLabel:"フォーマットの検証",formatValidationLabelPending:"フォーマットを検証しています",signatureVerificationLabel:"Proof Verification",signatureVerificationLabelPending:"Verifying Proof",identityVerificationLabel:"Identity verification",identityVerificationLabelPending:"Verifying identity",statusCheckLabel:"ステータスの確認",statusCheckLabelPending:"ステータスを確認しています"},subSteps:{getTransactionIdLabel:"取引IDの取得",getTransactionIdLabelPending:"取引IDを取得しています",computeLocalHashLabel:"ローカルハッシュの算出",computeLocalHashLabelPending:"ローカルハッシュを算出しています",fetchRemoteHashLabel:"リモートハッシュのフェッチ",fetchRemoteHashLabelPending:"リモートハッシュをフェッチしています",getIssuerProfileLabel:"発行者プロフィールの取得",getIssuerProfileLabelPending:"発行者プロフィールを取得しています",parseIssuerKeysLabel:"発行者の鍵のパース",parseIssuerKeysLabelPending:"発行者の鍵をパースしています",compareHashesLabel:"ハッシュの照合",compareHashesLabelPending:"ハッシュを照合しています",checkDocumentSignatureLabel:"Check document signature",checkDocumentSignatureLabelPending:"Checking document signature",checkMerkleRootLabel:"Merkle Rootの確認",checkMerkleRootLabelPending:"Merkle Rootを確認しています",checkReceiptLabel:"レシートの確認",checkReceiptLabelPending:"レシートを確認しています",checkAuthenticityLabel:"真正性の確認",checkAuthenticityLabelPending:"真正性を確認しています",checkRevokedStatusLabel:"取消ステータスの確認",checkRevokedStatusLabelPending:"取消ステータスを確認しています",checkExpiresDateLabel:"有効期限の確認",checkExpiresDateLabelPending:"有効期限を確認しています",controlVerificationMethodLabel:"Control Verification Method",controlVerificationMethodLabelPending:"Controlling Verification Method",retrieveVerificationMethodPublicKeyLabel:"Extract Public Key from DID Document",retrieveVerificationMethodPublicKeyLabelPending:"Extracting Public Key from DID Document",deriveIssuingAddressFromPublicKeyLabel:"Derive Issuing Address from Public Key",deriveIssuingAddressFromPublicKeyLabelPending:"Deriving Issuing Address from Public Key",compareIssuingAddressLabel:"Compare addresses",compareIssuingAddressLabelPending:"Comparing addresses",checkImagesIntegrityLabel:"Verify Images Integrity",checkImagesIntegrityLabelPending:"Verifying Images Integrity"},revocation:{preReason:"理由:",reason:"この証明書は発行者によって取り消されました。"},success:{mocknet:{label:"このMocknetの証明書は全てのチェックを通過しました。",description:"Mocknetの証明書はテスト用のものです。ブロックチェーンに記録されませんし、認証済みのBlockcertとして扱われません。"},blockchain:{label:"認証されました",description:"この証明書は有効な${chain}証明書です。",linkText:"取引を確認する"},generic:{label:"認証されました",description:"The ${SIGNATURE_TYPE} signature of this document has been successfully verified."},multisign:{label:"認証されました",description:"All the signatures of this certificate have successfully verified."}},errors:{certificateNotValid:"この証明書は有効ではありません",couldNotConfirmTx:"取引を確認できませんでした",ensureHashesEqual:"算出されたハッシュがリモートハッシュと一致しませんでした",ensureMerkleRootEqual:"Merkle rootがリモートハッシュと一致しませんでした",ensureNotExpired:"この証明書の有効期限が切れています",ensureValidReceipt:"レシートが異常です。レシート内のMerkle treeを辿る際に問題が発生しました。",failedJsonLdNormalization:"JSON-LDの正規化に失敗しました",foundUnmappedFields:"JSON-LDの正規化時にマップされていないフィールドを検出しました",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",controlVerificationMethod:"The identity document provided by the issuer does not match the verification method",retrieveVerificationMethodPublicKey:"The identity document provided by the issuer does not reference the verification method",compareIssuingAddress:"The provided verification method does not match the issuer identity",invalidIssuingAddressCreationTime:"The specified issuing address was created after the transaction occurred.",invalidIssuingAddressRevoked:"The specified issuing address was revoked by the issuer before the transaction occurred.",invalidIssuingAddressExpired:"The specified issuing address expired before the transaction occurred.",invalidIssuingAddressUnknown:"The address used to issue this Blockcerts does not belong to the claimed issuer.",getChain:"チェーンの値を認識できませんでした",getIssuerProfile:"発行者プロフィールを取得できません",getRevokedAssertions:"取消assertionsを取得できません",getTransactionId:"照合のための取引IDがないため、この証明書を認証できません。",invalidMerkleReceipt:"Merkleレシートが無効です。証明ハッシュがMerkle rootと一致しませんでした。",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"照合するための取引IDがないため、この証明書を認証できません。",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",parseIssuerKeys:"発行者識別データからJSONをパースできません",checkImagesIntegrity:"Image integrity verification proved that the content was modified after issuance."}}};function Wh(e,t){return e&&t?Xh[Yh.locale]?Xh[Yh.locale][e]?Xh[Yh.locale][e][t]?Xh[Yh.locale][e][t]||"":"[missing locale item data]":"[missing locale group data]":"[missing locale data]":""}var Zh=Object.freeze({__proto__:null,detectLocale:function(){return navigator.language||zh.locale},ensureIsSupported:function(e){let t;const n=zC.i18n.getSupportedLanguages().map((e=>e.toLowerCase()));if(t=n.includes(e.toLowerCase()),!t){const r=e.substr(0,2).toLowerCase(),i=n.map((e=>e.split("-")[0])).indexOf(r);t=i>-1,t&&(e=n[i])}return t||(e=zh.locale),function(e){const t=e.split("-");return t.length>1?`${t[0].toLowerCase()}-${t[1].toUpperCase()}`:t[0].toLowerCase()}(e)},getComposedText:function(e,t){return Wh(e,t)},getText:Wh,getSupportedLanguages:function(){return Object.keys(Xh)}});class $h{publicKey;created;revoked;expires;constructor(e,t,n,r){this.publicKey=e,this.created=t,this.revoked=n,this.expires=r}}class ed{image;jobTitle;name;constructor(e,t,n){this.image=e,this.jobTitle=t,this.name=n}}class td extends Error{stepCode;constructor(e,t){super(t),this.stepCode=e}}const nd=Xh[Yh.locale];var rd,id;function od(){return{[rd.formatValidation]:{code:rd.formatValidation,label:nd.steps.formatValidationLabel,labelPending:nd.steps.formatValidationLabelPending,subSteps:[]},[rd.proofVerification]:{code:rd.proofVerification,label:nd.steps.signatureVerificationLabel,labelPending:nd.steps.signatureVerificationLabelPending,subSteps:[]},[rd.identityVerification]:{code:rd.identityVerification,label:nd.steps.identityVerificationLabel,labelPending:nd.steps.identityVerificationLabelPending,subSteps:[]},[rd.statusCheck]:{code:rd.statusCheck,label:nd.steps.statusCheckLabel,labelPending:nd.steps.statusCheckLabelPending,subSteps:[]}}}function ad(e,t){const n=e.findIndex((e=>e===t));n>-1&&e.splice(n,1)}!function(e){e.formatValidation="formatValidation",e.proofVerification="proofVerification",e.identityVerification="identityVerification",e.statusCheck="statusCheck",e.final="final"}(rd||(rd={})),function(e){e.checkImagesIntegrity="checkImagesIntegrity",e.checkRevokedStatus="checkRevokedStatus",e.checkExpiresDate="checkExpiresDate",e.controlVerificationMethod="controlVerificationMethod"}(id||(id={})),Object.freeze({__proto__:null,final:"final",get VerificationSteps(){return rd},get SUB_STEPS(){return id},default:od});const sd={[rd.formatValidation]:[id.checkImagesIntegrity],[rd.proofVerification]:[],[rd.identityVerification]:[id.controlVerificationMethod],[rd.statusCheck]:[id.checkRevokedStatus,id.checkExpiresDate]};function ld(e,t){return sd[e].filter((e=>t.includes(e))).map((t=>zC.verifier.convertToVerificationSubsteps(e,t)))}function ud(e){const t=od();return Object.keys(t).map((n=>({...t[n],subSteps:ld(n,e)})))}var Ad=Object.freeze({__proto__:null,getChain:function(e,t){const n=t||null;if(n?.anchors){const e=n.anchors[0];if(e.chain)return function(e){const t=Object.keys(jl).map((e=>jl[e])).find((t=>t.signatureValue===e));if(void 0===t)throw new Error(Wh("errors","getChain"));return t}(e.chain)}return function(e=""){return Jh.isMainnet(e)?jl.bitcoin:jl.testnet}(e)},generateRevocationReason:function(e){return e=(e=e.trim()).length>0?` ${Wh("revocation","preReason")} ${e}${"."!==e.slice(-1)?".":""}`:"",`${Wh("revocation","reason")}${e}`},getTransactionId:function(e={}){try{const{anchors:t}=e,n=t[0];if(n.sourceId)return n.sourceId;if("string"==typeof n)return n.split(":").pop()}catch(e){throw new td("",Wh("errors","getTransactionId"))}},getTransactionLink:function(e,t){return e&&t?{rawTransactionLink:t.transactionTemplates.raw.replace("{transaction_id}",e),transactionLink:t.transactionTemplates.full.replace("{transaction_id}",e)}:null},getVerificationMap:function(e=!1,t=!1){const n=function(e,t){const n=Object.values(id);return e||ad(n,id.controlVerificationMethod),t||ad(n,id.checkImagesIntegrity),n}(e,t);return{verificationProcess:n,verificationMap:ud(n)}}}),cd=Object.freeze({__proto__:null,isMockChain:function(e){if(e){const t="string"==typeof e?e:e.code;return!!Object.keys(jl).some((e=>e===t))&&!!jl[t].test}return!1}});const hd={value:"https://dev.uniresolver.io/1.0/identifiers",set url(e){this.value=e},get url(){return this.value}};function dd(e){return e.startsWith("did:",0)}function fd(e){return e.startsWith("did:key:",0)}var pd={},gd={},yd={};function md(e){const t=[];for(const n of e)t.indexOf(n)<0&&t.push(n);return t}Object.defineProperty(yd,"__esModule",{value:!0}),yd.uniq=yd.recursivePartialOverride=void 0,yd.recursivePartialOverride=function e(t,n){if(null==n)return t;const r=Object.getPrototypeOf({});if(Object.getPrototypeOf(n)!=r)return n;let i=Object.assign({},t),o=Object.keys(n);const a=md(Object.keys(i).concat(o));for(const t of a)if(o.indexOf(t)>=0){const r=n[t];if(null!=r&&"object"==typeof r){const n=i[t];i[t]=e(n,r)}else i[t]=r}return i},yd.uniq=md;var vd={},wd=Object.prototype.toString,Id=function(e){if(void 0===e)return"undefined";if(null===e)return"null";var t=typeof e;if("boolean"===t)return"boolean";if("string"===t)return"string";if("number"===t)return"number";if("symbol"===t)return"symbol";if("function"===t)return function(e,t){return"GeneratorFunction"===bd(e)}(e)?"generatorfunction":"function";if(function(e){return Array.isArray?Array.isArray(e):e instanceof Array}(e))return"array";if(function(e){return!(!e.constructor||"function"!=typeof e.constructor.isBuffer)&&e.constructor.isBuffer(e)}(e))return"buffer";if(function(e){try{if("number"==typeof e.length&&"function"==typeof e.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(e))return"arguments";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";if(function(e){return e instanceof RegExp||"string"==typeof e.flags&&"boolean"==typeof e.ignoreCase&&"boolean"==typeof e.multiline&&"boolean"==typeof e.global}(e))return"regexp";switch(bd(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(e){return"function"==typeof e.throw&&"function"==typeof e.return&&"function"==typeof e.next}(e))return"generator";switch(t=wd.call(e)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")};function bd(e){return"function"==typeof e.constructor?e.constructor.name:null}const Bd=Symbol.prototype.valueOf,Ed=Id;
|
|
530
|
+
/*! https://mths.be/punycode v1.4.1 by @mathias */function bu(e){throw new RangeError(vu[e])}function Bu(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function Eu(e,t,n){var r=0;for(e=n?wu(e/700):e>>1,e+=wu(e/t);e>455;r+=36)e=wu(e/35);return wu(r+36*e/(e+38))}function Cu(e){return function(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]);var i=function(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}((e=e.replace(mu,".")).split("."),(function(e){return yu.test(e)?"xn--"+function(e){var t,n,r,i,o,a,s,l,u,A,c,h,d,f,p,g=[];for(e=function(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}(e),h=e.length,t=128,n=0,o=72,a=0;a<h;++a)(c=e[a])<128&&g.push(Iu(c));for(r=i=g.length,i&&g.push("-");r<h;){for(s=2147483647,a=0;a<h;++a)(c=e[a])>=t&&c<s&&(s=c);for(s-t>wu((2147483647-n)/(d=r+1))&&bu("overflow"),n+=(s-t)*d,t=s,a=0;a<h;++a)if((c=e[a])<t&&++n>2147483647&&bu("overflow"),c==t){for(l=n,u=36;!(l<(A=u<=o?1:u>=o+26?26:u-o));u+=36)p=l-A,f=36-A,g.push(Iu(Bu(A+p%f,0))),l=wu(p/f);g.push(Iu(Bu(l,0))),o=Eu(n,d,r==i),n=0,++r}++n,++t}return g.join("")}(e):e})).join(".");return r+i}(e)}var xu="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},Su=/%[sdj%]/g;function Qu(e){if(!Gu(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(Fu(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(Su,(function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n<i;a=r[++n])Hu(a)||!Ju(a)?o+=" "+a:o+=" "+Fu(a);return o}function ku(e,t){if(Vu(qi.process))return function(){return ku(e,t).apply(this,arguments)};if(!0===gu.noDeprecation)return e;var n=!1;return function(){if(!n){if(gu.throwDeprecation)throw new Error(t);gu.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var _u,Nu={};function Du(e){return Vu(_u)&&(_u=gu.env.NODE_DEBUG||""),e=e.toUpperCase(),Nu[e]||(new RegExp("\\b"+e+"\\b","i").test(_u)?Nu[e]=function(){var t=Qu.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:Nu[e]=function(){}),Nu[e]}function Fu(e,t){var n={seen:[],stylize:Pu};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Ou(t)?n.showHidden=t:t&&oA(n,t),Vu(n.showHidden)&&(n.showHidden=!1),Vu(n.depth)&&(n.depth=2),Vu(n.colors)&&(n.colors=!1),Vu(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=Uu),Tu(n,e,n.depth)}function Uu(e,t){var n=Fu.styles[t];return n?"["+Fu.colors[n][0]+"m"+e+"["+Fu.colors[n][1]+"m":e}function Pu(e,t){return e}function Tu(e,t,n){if(e.customInspect&&t&&Wu(t.inspect)&&t.inspect!==Fu&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return Gu(r)||(r=Tu(e,r,n)),r}var i=function(e,t){if(Vu(t))return e.stylize("undefined","undefined");if(Gu(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return ju(t)?e.stylize(""+t,"number"):Ou(t)?e.stylize(""+t,"boolean"):Hu(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),Xu(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Lu(t);if(0===o.length){if(Wu(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(zu(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Yu(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Xu(t))return Lu(t)}var l,u="",A=!1,c=["{","}"];return Ru(t)&&(A=!0,c=["[","]"]),Wu(t)&&(u=" [Function"+(t.name?": "+t.name:"")+"]"),zu(t)&&(u=" "+RegExp.prototype.toString.call(t)),Yu(t)&&(u=" "+Date.prototype.toUTCString.call(t)),Xu(t)&&(u=" "+Lu(t)),0!==o.length||A&&0!=t.length?n<0?zu(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=A?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)aA(t,String(a))?o.push(Mu(e,t,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(Mu(e,t,n,r,i,!0))})),o}(e,t,n,a,o):o.map((function(r){return Mu(e,t,n,a,r,A)})),e.seen.pop(),function(e,t,n){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(l,u,c)):c[0]+u+c[1]}function Lu(e){return"["+Error.prototype.toString.call(e)+"]"}function Mu(e,t,n,r,i,o){var a,s,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),aA(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(l.value)<0?(s=Hu(n)?Tu(e,l.value,null):Tu(e,l.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),Vu(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function Ru(e){return Array.isArray(e)}function Ou(e){return"boolean"==typeof e}function Hu(e){return null===e}function Ku(e){return null==e}function ju(e){return"number"==typeof e}function Gu(e){return"string"==typeof e}function qu(e){return"symbol"==typeof e}function Vu(e){return void 0===e}function zu(e){return Ju(e)&&"[object RegExp]"===eA(e)}function Ju(e){return"object"==typeof e&&null!==e}function Yu(e){return Ju(e)&&"[object Date]"===eA(e)}function Xu(e){return Ju(e)&&("[object Error]"===eA(e)||e instanceof Error)}function Wu(e){return"function"==typeof e}function Zu(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function $u(e){return jo(e)}function eA(e){return Object.prototype.toString.call(e)}function tA(e){return e<10?"0"+e.toString(10):e.toString(10)}Fu.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Fu.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var nA=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function rA(){var e=new Date,t=[tA(e.getHours()),tA(e.getMinutes()),tA(e.getSeconds())].join(":");return[e.getDate(),nA[e.getMonth()],t].join(" ")}function iA(){console.log("%s - %s",rA(),Qu.apply(null,arguments))}function oA(e,t){if(!t||!Ju(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function aA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var sA={inherits:xu,_extend:oA,log:iA,isBuffer:$u,isPrimitive:Zu,isFunction:Wu,isError:Xu,isDate:Yu,isObject:Ju,isRegExp:zu,isUndefined:Vu,isSymbol:qu,isString:Gu,isNumber:ju,isNullOrUndefined:Ku,isNull:Hu,isBoolean:Ou,isArray:Ru,inspect:Fu,deprecate:ku,format:Qu,debuglog:Du},lA=Object.freeze({__proto__:null,format:Qu,deprecate:ku,debuglog:Du,inspect:Fu,isArray:Ru,isBoolean:Ou,isNull:Hu,isNullOrUndefined:Ku,isNumber:ju,isString:Gu,isSymbol:qu,isUndefined:Vu,isRegExp:zu,isObject:Ju,isDate:Yu,isError:Xu,isFunction:Wu,isPrimitive:Zu,isBuffer:$u,log:iA,inherits:xu,_extend:oA,default:sA});function uA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var AA=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function cA(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function hA(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var dA=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t};function fA(e,t,n,r){t=t||"&",n=n||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;r&&"number"==typeof r.maxKeys&&(a=r.maxKeys);var s=e.length;a>0&&s>a&&(s=a);for(var l=0;l<s;++l){var u,A,c,h,d=e[l].replace(o,"%20"),f=d.indexOf(n);f>=0?(u=d.substr(0,f),A=d.substr(f+1)):(u=d,A=""),c=decodeURIComponent(u),h=decodeURIComponent(A),uA(i,c)?AA(i[c])?i[c].push(h):i[c]=[i[c],h]:i[c]=h}return i}var pA={parse:kA,resolve:FA,resolveObject:UA,format:NA,Url:gA};function gA(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var yA=/^([a-z0-9.+-]+:)/i,mA=/:[0-9]*$/,vA=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,wA=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),IA=["'"].concat(wA),bA=["%","/","?",";","#"].concat(IA),BA=["/","?","#"],EA=/^[+a-z0-9A-Z_-]{0,63}$/,CA=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,xA={javascript:!0,"javascript:":!0},SA={javascript:!0,"javascript:":!0},QA={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function kA(e,t,n){if(e&&Ju(e)&&e instanceof gA)return e;var r=new gA;return r.parse(e,t,n),r}function _A(e,t,n,r){if(!Gu(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),o=-1!==i&&i<t.indexOf("#")?"?":"#",a=t.split(o);a[0]=a[0].replace(/\\/g,"/");var s=t=a.join(o);if(s=s.trim(),!r&&1===t.split("#").length){var l=vA.exec(s);if(l)return e.path=s,e.href=s,e.pathname=l[1],l[2]?(e.search=l[2],e.query=n?fA(e.search.substr(1)):e.search.substr(1)):n&&(e.search="",e.query={}),e}var u,A,c,h,d=yA.exec(s);if(d){var f=(d=d[0]).toLowerCase();e.protocol=f,s=s.substr(d.length)}if(r||d||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var p="//"===s.substr(0,2);!p||d&&SA[d]||(s=s.substr(2),e.slashes=!0)}if(!SA[d]&&(p||d&&!QA[d])){var g,y,m=-1;for(u=0;u<BA.length;u++)-1!==(A=s.indexOf(BA[u]))&&(-1===m||A<m)&&(m=A);for(-1!==(y=-1===m?s.lastIndexOf("@"):s.lastIndexOf("@",m))&&(g=s.slice(0,y),s=s.slice(y+1),e.auth=decodeURIComponent(g)),m=-1,u=0;u<bA.length;u++)-1!==(A=s.indexOf(bA[u]))&&(-1===m||A<m)&&(m=A);-1===m&&(m=s.length),e.host=s.slice(0,m),s=s.slice(m),PA(e),e.hostname=e.hostname||"";var v="["===e.hostname[0]&&"]"===e.hostname[e.hostname.length-1];if(!v){var w=e.hostname.split(/\./);for(u=0,c=w.length;u<c;u++){var I=w[u];if(I&&!I.match(EA)){for(var b="",B=0,E=I.length;B<E;B++)I.charCodeAt(B)>127?b+="x":b+=I[B];if(!b.match(EA)){var C=w.slice(0,u),x=w.slice(u+1),S=I.match(CA);S&&(C.push(S[1]),x.unshift(S[2])),x.length&&(s="/"+x.join(".")+s),e.hostname=C.join(".");break}}}}e.hostname.length>255?e.hostname="":e.hostname=e.hostname.toLowerCase(),v||(e.hostname=Cu(e.hostname)),h=e.port?":"+e.port:"";var Q=e.hostname||"";e.host=Q+h,e.href+=e.host,v&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!xA[f])for(u=0,c=IA.length;u<c;u++){var k=IA[u];if(-1!==s.indexOf(k)){var _=encodeURIComponent(k);_===k&&(_=escape(k)),s=s.split(k).join(_)}}var N=s.indexOf("#");-1!==N&&(e.hash=s.substr(N),s=s.slice(0,N));var D=s.indexOf("?");if(-1!==D?(e.search=s.substr(D),e.query=s.substr(D+1),n&&(e.query=fA(e.query)),s=s.slice(0,D)):n&&(e.search="",e.query={}),s&&(e.pathname=s),QA[f]&&e.hostname&&!e.pathname&&(e.pathname="/"),e.pathname||e.search){h=e.pathname||"";var F=e.search||"";e.path=h+F}return e.href=DA(e),e}function NA(e){return Gu(e)&&(e=_A({},e)),DA(e)}function DA(e){var t=e.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var n=e.protocol||"",r=e.pathname||"",i=e.hash||"",o=!1,a="";e.host?o=t+e.host:e.hostname&&(o=t+(-1===e.hostname.indexOf(":")?e.hostname:"["+this.hostname+"]"),e.port&&(o+=":"+e.port)),e.query&&Ju(e.query)&&Object.keys(e.query).length&&(a=function(e,t,n,r){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?hA(dA(e),(function(r){var i=encodeURIComponent(cA(r))+n;return AA(e[r])?hA(e[r],(function(e){return i+encodeURIComponent(cA(e))})).join(t):i+encodeURIComponent(cA(e[r]))})).join(t):""}(e.query));var s=e.search||a&&"?"+a||"";return n&&":"!==n.substr(-1)&&(n+=":"),e.slashes||(!n||QA[n])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),n+o+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(s=s.replace("#","%23"))+i}function FA(e,t){return kA(e,!1,!0).resolve(t)}function UA(e,t){return e?kA(e,!1,!0).resolveObject(t):t}function PA(e){var t=e.host,n=mA.exec(t);n&&(":"!==(n=n[0])&&(e.port=n.substr(1)),t=t.substr(0,t.length-n.length)),t&&(e.hostname=t)}gA.prototype.parse=function(e,t,n){return _A(this,e,t,n)},gA.prototype.format=function(){return DA(this)},gA.prototype.resolve=function(e){return this.resolveObject(kA(e,!1,!0)).format()},gA.prototype.resolveObject=function(e){if(Gu(e)){var t=new gA;t.parse(e,!1,!0),e=t}for(var n,r=new gA,i=Object.keys(this),o=0;o<i.length;o++){var a=i[o];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),l=0;l<s.length;l++){var u=s[l];"protocol"!==u&&(r[u]=e[u])}return QA[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!QA[e.protocol]){for(var A=Object.keys(e),c=0;c<A.length;c++){var h=A[c];r[h]=e[h]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||SA[e.protocol])r.pathname=e.pathname;else{for(n=(e.pathname||"").split("/");n.length&&!(e.host=n.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==n[0]&&n.unshift(""),n.length<2&&n.unshift(""),r.pathname=n.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var d=r.pathname||"",f=r.search||"";r.path=d+f}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var p,g=r.pathname&&"/"===r.pathname.charAt(0),y=e.host||e.pathname&&"/"===e.pathname.charAt(0),m=y||g||r.host&&e.pathname,v=m,w=r.pathname&&r.pathname.split("/")||[],I=r.protocol&&!QA[r.protocol];if(n=e.pathname&&e.pathname.split("/")||[],I&&(r.hostname="",r.port=null,r.host&&(""===w[0]?w[0]=r.host:w.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===n[0]?n[0]=e.host:n.unshift(e.host)),e.host=null),m=m&&(""===n[0]||""===w[0])),y)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,w=n;else if(n.length)w||(w=[]),w.pop(),w=w.concat(n),r.search=e.search,r.query=e.query;else if(!Ku(e.search))return I&&(r.hostname=r.host=w.shift(),(p=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=p.shift(),r.host=r.hostname=p.shift())),r.search=e.search,r.query=e.query,Hu(r.pathname)&&Hu(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var b=w.slice(-1)[0],B=(r.host||e.host||w.length>1)&&("."===b||".."===b)||""===b,E=0,C=w.length;C>=0;C--)"."===(b=w[C])?w.splice(C,1):".."===b?(w.splice(C,1),E++):E&&(w.splice(C,1),E--);if(!m&&!v)for(;E--;E)w.unshift("..");!m||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),B&&"/"!==w.join("/").substr(-1)&&w.push("");var x=""===w[0]||w[0]&&"/"===w[0].charAt(0);return I&&(r.hostname=r.host=x?"":w.length?w.shift():"",(p=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=p.shift(),r.host=r.hostname=p.shift())),(m=m||r.host&&w.length)&&!x&&w.unshift(""),w.length?r.pathname=w.join("/"):(r.pathname=null,r.path=null),Hu(r.pathname)&&Hu(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},gA.prototype.parseHost=function(){return PA(this)};var TA,LA,MA=ji(Object.freeze({__proto__:null,parse:kA,resolve:FA,resolveObject:UA,format:NA,default:pA,Url:gA})),RA=JA(qi.fetch)&&JA(qi.ReadableStream);function OA(e){LA||(LA=new qi.XMLHttpRequest).open("GET",qi.location.host?"/":"https://example.com");try{return LA.responseType=e,LA.responseType===e}catch(e){return!1}}var HA=void 0!==qi.ArrayBuffer,KA=HA&&JA(qi.ArrayBuffer.prototype.slice),jA=HA&&OA("arraybuffer"),GA=!RA&&KA&&OA("ms-stream"),qA=!RA&&HA&&OA("moz-chunked-arraybuffer"),VA=JA(LA.overrideMimeType),zA=JA(qi.VBArray);function JA(e){return"function"==typeof e}function YA(){}function XA(){XA.init.call(this)}function WA(e){return void 0===e._maxListeners?XA.defaultMaxListeners:e._maxListeners}function ZA(e,t,n){if(t)e.call(n);else for(var r=e.length,i=ac(e,r),o=0;o<r;++o)i[o].call(n)}function $A(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=ac(e,i),a=0;a<i;++a)o[a].call(n,r)}function ec(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,a=ac(e,o),s=0;s<o;++s)a[s].call(n,r,i)}function tc(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var a=e.length,s=ac(e,a),l=0;l<a;++l)s[l].call(n,r,i,o)}function nc(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=ac(e,i),a=0;a<i;++a)o[a].apply(n,r)}function rc(e,t,n,r){var i,o,a,s;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]):(o=e._events=new YA,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=WA(e))&&i>0&&a.length>i){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function ic(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function oc(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function ac(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}LA=null,YA.prototype=Object.create(null),XA.EventEmitter=XA,XA.usingDomains=!1,XA.prototype.domain=void 0,XA.prototype._events=void 0,XA.prototype._maxListeners=void 0,XA.defaultMaxListeners=10,XA.init=function(){this.domain=null,XA.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new YA,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},XA.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},XA.prototype.getMaxListeners=function(){return WA(this)},XA.prototype.emit=function(e){var t,n,r,i,o,a,s,l="error"===e;if(a=this._events)l=l&&null==a.error;else if(!l)return!1;if(s=this.domain,l){if(t=arguments[1],!s){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var A="function"==typeof n;switch(r=arguments.length){case 1:ZA(n,A,this);break;case 2:$A(n,A,this,arguments[1]);break;case 3:ec(n,A,this,arguments[1],arguments[2]);break;case 4:tc(n,A,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];nc(n,A,this,i)}return!0},XA.prototype.addListener=function(e,t){return rc(this,e,t,!1)},XA.prototype.on=XA.prototype.addListener,XA.prototype.prependListener=function(e,t){return rc(this,e,t,!0)},XA.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,ic(this,e,t)),this},XA.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,ic(this,e,t)),this},XA.prototype.removeListener=function(e,t){var n,r,i,o,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new YA:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new YA,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,a||t)}return this},XA.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new YA,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new YA:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new YA,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},XA.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},XA.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):oc.call(e,t)},XA.prototype.listenerCount=oc,XA.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var sc=Object.freeze({__proto__:null,default:XA,EventEmitter:XA});function lc(){this.head=null,this.tail=null,this.length=0}lc.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},lc.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},lc.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},lc.prototype.clear=function(){this.head=this.tail=null,this.length=0},lc.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},lc.prototype.concat=function(e){if(0===this.length)return ao.alloc(0);if(1===this.length)return this.head.data;for(var t=ao.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var uc=ao.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Ac(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!uc(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=hc;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=dc;break;default:return void(this.write=cc)}this.charBuffer=new ao(6),this.charReceived=0,this.charLength=0}function cc(e){return e.toString(this.encoding)}function hc(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function dc(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}Ac.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((r=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(r=t.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},Ac.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},Ac.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var fc=Object.freeze({__proto__:null,StringDecoder:Ac});yc.ReadableState=gc;var pc=Du("stream");function gc(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Gc&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new lc,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new Ac(e.encoding),this.encoding=e.encoding)}function yc(e){if(!(this instanceof yc))return new yc(e);this._readableState=new gc(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),XA.call(this)}function mc(e,t,n,r,i){var o=function(e,t){var n=null;return jo(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(t,n);if(o)e.emit("error",o);else if(null===n)t.reading=!1,function(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,wc(e)}}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var l;!t.decoder||i||r||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),i||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&wc(e))),function(e,t){t.readingMore||(t.readingMore=!0,ru(bc,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}function vc(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function wc(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(pc("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?ru(Ic,e):Ic(e))}function Ic(e){pc("emit readable"),e.emit("readable"),Cc(e)}function bc(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(pc("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function Bc(e){pc("readable nexttick read 0"),e.read(0)}function Ec(e,t){t.reading||(pc("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),Cc(e),t.flowing&&!t.reading&&e.read(0)}function Cc(e){var t=e._readableState;for(pc("flow",t.flowing);t.flowing&&null!==e.read(););}function xc(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,i=n.data;for(e-=i.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0==(e-=a)){a===o.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=ao.allocUnsafe(e),r=t.head,i=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var o=r.data,a=e>o.length?o.length:e;if(o.copy(n,n.length-e,0,a),0==(e-=a)){a===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++i}return t.length-=i,n}(e,t),r}(e,t.buffer,t.decoder),n);var n}function Sc(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,ru(Qc,t,e))}function Qc(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function kc(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function _c(){}function Nc(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function Dc(e,t){Object.defineProperty(this,"buffer",{get:ku((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof Gc&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?ru(i,r):i(r),e._writableState.errorEmitted=!0,e.emit("error",r)}(e,n,r,t,i);else{var o=Lc(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||Tc(e,n),r?ru(Pc,e,n,o,i):Pc(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Oc(this)}function Fc(e){if(!(this instanceof Fc||this instanceof Gc))return new Fc(e);this._writableState=new Dc(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),XA.call(this)}function Uc(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function Pc(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),Rc(e,t)}function Tc(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0;n;)i[a]=n,n=n.next,a+=1;Uc(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new Oc(t)}else{for(;n;){var s=n.chunk,l=n.encoding,u=n.callback;if(Uc(e,t,!1,t.objectMode?1:s.length,s,l,u),n=n.next,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=n,t.bufferProcessing=!1}function Lc(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function Mc(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function Rc(e,t){var n=Lc(t);return n&&(0===t.pendingcb?(Mc(e,t),t.finished=!0,e.emit("finish")):Mc(e,t)),n}function Oc(e){var t=this;this.next=null,this.entry=null,this.finish=function(n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}xu(yc,XA),yc.prototype.push=function(e,t){var n=this._readableState;return n.objectMode||"string"!=typeof e||(t=t||n.defaultEncoding)!==n.encoding&&(e=ao.from(e,t),t=""),mc(this,n,e,t,!1)},yc.prototype.unshift=function(e){return mc(this,this._readableState,e,"",!0)},yc.prototype.isPaused=function(){return!1===this._readableState.flowing},yc.prototype.setEncoding=function(e){return this._readableState.decoder=new Ac(e),this._readableState.encoding=e,this},yc.prototype.read=function(e){pc("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return pc("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?Sc(this):wc(this),null;if(0===(e=vc(e,t))&&t.ended)return 0===t.length&&Sc(this),null;var r,i=t.needReadable;return pc("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&pc("length less than watermark",i=!0),t.ended||t.reading?pc("reading or ended",i=!1):i&&(pc("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=vc(n,t))),null===(r=e>0?xc(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Sc(this)),null!==r&&this.emit("data",r),r},yc.prototype._read=function(e){this.emit("error",new Error("not implemented"))},yc.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,pc("pipe count=%d opts=%j",r.pipesCount,t);var i=t&&!1===t.end?u:a;function o(e){pc("onunpipe"),e===n&&u()}function a(){pc("onend"),e.end()}r.endEmitted?ru(i):n.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;pc("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,Cc(e))}}(n);e.on("drain",s);var l=!1;function u(){pc("cleanup"),e.removeListener("close",d),e.removeListener("finish",f),e.removeListener("drain",s),e.removeListener("error",h),e.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",u),n.removeListener("data",c),l=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var A=!1;function c(t){pc("ondata"),A=!1,!1!==e.write(t)||A||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==kc(r.pipes,e))&&!l&&(pc("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,A=!0),n.pause())}function h(t){pc("onerror",t),p(),e.removeListener("error",h),0===function(e,t){return e.listeners("error").length}(e)&&e.emit("error",t)}function d(){e.removeListener("finish",f),p()}function f(){pc("onfinish"),e.removeListener("close",d),p()}function p(){pc("unpipe"),n.unpipe(e)}return n.on("data",c),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",d),e.once("finish",f),e.emit("pipe",n),r.flowing||(pc("pipe resume"),n.resume()),e},yc.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var o=kc(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},yc.prototype.on=function(e,t){var n=XA.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&wc(this):ru(Bc,this))}return n},yc.prototype.addListener=yc.prototype.on,yc.prototype.resume=function(){var e=this._readableState;return e.flowing||(pc("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,ru(Ec,e,t))}(this,e)),this},yc.prototype.pause=function(){return pc("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(pc("pause"),this._readableState.flowing=!1,this.emit("pause")),this},yc.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;for(var i in e.on("end",(function(){if(pc("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)})),e.on("data",(function(i){pc("wrapped data"),t.decoder&&(i=t.decoder.write(i)),t.objectMode&&null==i||(t.objectMode||i&&i.length)&&(r.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));return function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n])}(["error","close","destroy","pause","resume"],(function(t){e.on(t,r.emit.bind(r,t))})),r._read=function(t){pc("wrapped _read",t),n&&(n=!1,e.resume())},r},yc._fromList=xc,Fc.WritableState=Dc,xu(Fc,XA),Dc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},Fc.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Fc.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return"function"==typeof t&&(n=t,t=null),ao.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=_c),r.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),ru(t,n)}(this,n):function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):ao.isBuffer(n)||"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),ru(r,o),i=!1),i}(this,r,e,n)&&(r.pendingcb++,i=function(e,t,n,r,i){n=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=ao.from(t,n)),t}(t,n,r),ao.isBuffer(n)&&(r="buffer");var o=t.objectMode?1:n.length;t.length+=o;var a=t.length<t.highWaterMark;if(a||(t.needDrain=!0),t.writing||t.corked){var s=t.lastBufferedRequest;t.lastBufferedRequest=new Nc(n,r,i),s?s.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Uc(e,t,!1,o,n,r,i);return a}(this,r,e,t,n)),i},Fc.prototype.cork=function(){this._writableState.corked++},Fc.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||Tc(this,e))},Fc.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Fc.prototype._write=function(e,t,n){n(new Error("not implemented"))},Fc.prototype._writev=null,Fc.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,Rc(e,t),n&&(t.finished?ru(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n)},xu(Gc,yc);for(var Hc=Object.keys(Fc.prototype),Kc=0;Kc<Hc.length;Kc++){var jc=Hc[Kc];Gc.prototype[jc]||(Gc.prototype[jc]=Fc.prototype[jc])}function Gc(e){if(!(this instanceof Gc))return new Gc(e);yc.call(this,e),Fc.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",qc)}function qc(){this.allowHalfOpen||this._writableState.ended||ru(Vc,this)}function Vc(e){e.end()}function zc(e){this.afterTransform=function(t,n){return function(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&e.push(n),i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}(e,t,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Jc(e){if(!(this instanceof Jc))return new Jc(e);Gc.call(this,e),this._transformState=new zc(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(e){Yc(t,e)})):Yc(t)}))}function Yc(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=e._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(r.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}function Xc(e){if(!(this instanceof Xc))return new Xc(e);Jc.call(this,e)}function Wc(){XA.call(this)}xu(Jc,Gc),Jc.prototype.push=function(e,t){return this._transformState.needTransform=!1,Gc.prototype.push.call(this,e,t)},Jc.prototype._transform=function(e,t,n){throw new Error("Not implemented")},Jc.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Jc.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},xu(Xc,Jc),Xc.prototype._transform=function(e,t,n){n(null,e)},xu(Wc,XA),Wc.Readable=yc,Wc.Writable=Fc,Wc.Duplex=Gc,Wc.Transform=Jc,Wc.PassThrough=Xc,Wc.Stream=Wc,Wc.prototype.pipe=function(e,t){var n=this;function r(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),e.on("drain",i),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",s));var o=!1;function a(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(u(),0===XA.listenerCount(this,"error"))throw e}function u(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",a),n.removeListener("close",s),n.removeListener("error",l),e.removeListener("error",l),n.removeListener("end",u),n.removeListener("close",u),e.removeListener("close",u)}return n.on("error",l),e.on("error",l),n.on("end",u),n.on("close",u),e.on("close",u),e.emit("pipe",n),e};var Zc=Object.freeze({__proto__:null,default:Wc,Readable:yc,Writable:Fc,Duplex:Gc,Transform:Jc,PassThrough:Xc,Stream:Wc});function $c(e,t,n){var r,i=this;if(yc.call(i),i._mode=n,i.headers={},i.rawHeaders=[],i.trailers={},i.rawTrailers=[],i.on("end",(function(){ru((function(){i.emit("close")}))})),"fetch"===n){i._fetchResponse=t,i.url=t.url,i.statusCode=t.status,i.statusMessage=t.statusText;for(var o,a,s=t.headers[Symbol.iterator]();o=(a=s.next()).value,!a.done;)i.headers[o[0].toLowerCase()]=o[1],i.rawHeaders.push(o[0],o[1]);var l=t.body.getReader();(r=function(){l.read().then((function(e){i._destroyed||(e.done?i.push(null):(i.push(new ao(e.value)),r()))}))})()}else if(i._xhr=e,i._pos=0,i.url=e.responseURL,i.statusCode=e.status,i.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach((function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var n=t[1].toLowerCase();"set-cookie"===n?(void 0===i.headers[n]&&(i.headers[n]=[]),i.headers[n].push(t[2])):void 0!==i.headers[n]?i.headers[n]+=", "+t[2]:i.headers[n]=t[2],i.rawHeaders.push(t[1],t[2])}})),i._charset="x-user-defined",!VA){var u=i.rawHeaders["mime-type"];if(u){var A=u.match(/;\s*charset=([^;])(;|$)/);A&&(i._charset=A[1].toLowerCase())}i._charset||(i._charset="utf-8")}}function eh(e){var t,n=this;Fc.call(n),n._opts=e,n._body=[],n._headers={},e.auth&&n.setHeader("Authorization","Basic "+new ao(e.auth).toString("base64")),Object.keys(e.headers).forEach((function(t){n.setHeader(t,e.headers[t])}));var r=!0;if("disable-fetch"===e.mode)r=!1,t=!0;else if("prefer-streaming"===e.mode)t=!1;else if("allow-wrong-content-type"===e.mode)t=!VA;else{if(e.mode&&"default"!==e.mode&&"prefer-fast"!==e.mode)throw new Error("Invalid value for opts.mode");t=!0}n._mode=function(e,t){return RA&&t?"fetch":qA?"moz-chunked-arraybuffer":GA?"ms-stream":jA&&e?"arraybuffer":zA&&e?"text:vbarray":"text"}(t,r),n.on("finish",(function(){n._onFinish()}))}xu($c,yc),$c.prototype._read=function(){},$c.prototype._onXHRProgress=function(){var e=this,t=e._xhr,n=null;switch(e._mode){case"text:vbarray":if(4!==t.readyState)break;try{n=new qi.VBArray(t.responseBody).toArray()}catch(e){}if(null!==n){e.push(new ao(n));break}case"text":try{n=t.responseText}catch(t){e._mode="text:vbarray";break}if(n.length>e._pos){var r=n.substr(e._pos);if("x-user-defined"===e._charset){for(var i=new ao(r.length),o=0;o<r.length;o++)i[o]=255&r.charCodeAt(o);e.push(i)}else e.push(r,e._charset);e._pos=n.length}break;case"arraybuffer":if(4!==t.readyState||!t.response)break;n=t.response,e.push(new ao(new Uint8Array(n)));break;case"moz-chunked-arraybuffer":if(n=t.response,3!==t.readyState||!n)break;e.push(new ao(new Uint8Array(n)));break;case"ms-stream":if(n=t.response,3!==t.readyState)break;var a=new qi.MSStreamReader;a.onprogress=function(){a.result.byteLength>e._pos&&(e.push(new ao(new Uint8Array(a.result.slice(e._pos)))),e._pos=a.result.byteLength)},a.onload=function(){e.push(null)},a.readAsArrayBuffer(n)}4===e._xhr.readyState&&"ms-stream"!==e._mode&&e.push(null)},xu(eh,Fc);var th=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];function nh(e,t){"string"==typeof e&&(e=kA(e));var n=-1===qi.location.protocol.search(/^https?:$/)?"http:":"",r=e.protocol||n,i=e.hostname||e.host,o=e.port,a=e.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),e.url=(i?r+"//"+i:"")+(o?":"+o:"")+a,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var s=new eh(e);return t&&s.on("response",t),s}function rh(e,t){var n=nh(e,t);return n.end(),n}function ih(){}eh.prototype.setHeader=function(e,t){var n=e.toLowerCase();-1===th.indexOf(n)&&(this._headers[n]={name:e,value:t})},eh.prototype.getHeader=function(e){return this._headers[e.toLowerCase()].value},eh.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},eh.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t,n=e._opts,r=e._headers;if("POST"!==n.method&&"PUT"!==n.method&&"PATCH"!==n.method||(t=function(){if(void 0!==TA)return TA;try{new qi.Blob([new ArrayBuffer(1)]),TA=!0}catch(e){TA=!1}return TA}()?new qi.Blob(e._body.map((function(e){return function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(jo(e)){for(var t=new Uint8Array(e.length),n=e.length,r=0;r<n;r++)t[r]=e[r];return t.buffer}throw new Error("Argument must be a Buffer")}(e)})),{type:(r["content-type"]||{}).value||""}):ao.concat(e._body).toString()),"fetch"===e._mode){var i=Object.keys(r).map((function(e){return[r[e].name,r[e].value]}));qi.fetch(e._opts.url,{method:e._opts.method,headers:i,body:t,mode:"cors",credentials:n.withCredentials?"include":"same-origin"}).then((function(t){e._fetchResponse=t,e._connect()}),(function(t){e.emit("error",t)}))}else{var o=e._xhr=new qi.XMLHttpRequest;try{o.open(e._opts.method,e._opts.url,!0)}catch(t){return void ru((function(){e.emit("error",t)}))}"responseType"in o&&(o.responseType=e._mode.split(":")[0]),"withCredentials"in o&&(o.withCredentials=!!n.withCredentials),"text"===e._mode&&"overrideMimeType"in o&&o.overrideMimeType("text/plain; charset=x-user-defined"),Object.keys(r).forEach((function(e){o.setRequestHeader(r[e].name,r[e].value)})),e._response=null,o.onreadystatechange=function(){switch(o.readyState){case 3:case 4:e._onXHRProgress()}},"moz-chunked-arraybuffer"===e._mode&&(o.onprogress=function(){e._onXHRProgress()}),o.onerror=function(){e._destroyed||e.emit("error",new Error("XHR error"))};try{o.send(t)}catch(t){return void ru((function(){e.emit("error",t)}))}}}},eh.prototype._onXHRProgress=function(){var e=this;(function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}})(e._xhr)&&!e._destroyed&&(e._response||e._connect(),e._response._onXHRProgress())},eh.prototype._connect=function(){var e=this;e._destroyed||(e._response=new $c(e._xhr,e._fetchResponse,e._mode),e.emit("response",e._response))},eh.prototype._write=function(e,t,n){this._body.push(e),n()},eh.prototype.abort=eh.prototype.destroy=function(){var e=this;e._destroyed=!0,e._response&&(e._response._destroyed=!0),e._xhr&&e._xhr.abort()},eh.prototype.end=function(e,t,n){"function"==typeof e&&(n=e,e=void 0),Fc.prototype.end.call(this,e,t,n)},eh.prototype.flushHeaders=function(){},eh.prototype.setTimeout=function(){},eh.prototype.setNoDelay=function(){},eh.prototype.setSocketKeepAlive=function(){},ih.defaultMaxSockets=4;var oh=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],ah={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},sh={request:nh,get:rh,Agent:ih,METHODS:oh,STATUS_CODES:ah},lh=ji(Object.freeze({__proto__:null,request:nh,get:rh,Agent:ih,METHODS:oh,STATUS_CODES:ah,default:sh})),uh=MA,Ah=Ls.spawn,ch=Ls,hh=function(){var e,t,n=this,r=lh,i=lh,o={},a=!1,s={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},l={},u={},A=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],c=["TRACE","TRACK","CONNECT"],h=!1,d=!1,f={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.status=null,this.statusText=null,this.withCredentials=!1,this.open=function(e,t,n,r,i){if(this.abort(),d=!1,!function(e){return e&&-1===c.indexOf(e)}(e))throw new Error("SecurityError: Request method not allowed");o={method:e,url:t.toString(),async:"boolean"!=typeof n||n,user:r||null,password:i||null},p(this.OPENED)},this.setDisableHeaderCheck=function(e){a=e},this.setRequestHeader=function(e,t){if(this.readyState!==this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(function(e){return a||e&&-1===A.indexOf(e.toLowerCase())}(e)){if(h)throw new Error("INVALID_STATE_ERR: send flag is true");e=u[e.toLowerCase()]||e,u[e.toLowerCase()]=e,l[e]=l[e]?l[e]+", "+t:t}else console.warn('Refused to set unsafe header "'+e+'"')},this.getResponseHeader=function(e){return"string"==typeof e&&this.readyState>this.OPENED&&t&&t.headers&&t.headers[e.toLowerCase()]&&!d?t.headers[e.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||d)return"";var e="";for(var n in t.headers)"set-cookie"!==n&&"set-cookie2"!==n&&(e+=n+": "+t.headers[n]+"\r\n");return e.substr(0,e.length-2)},this.getRequestHeader=function(e){return"string"==typeof e&&u[e.toLowerCase()]?l[u[e.toLowerCase()]]:""},this.send=function(a){if(this.readyState!==this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(h)throw new Error("INVALID_STATE_ERR: send has already been called");var A,c=!1,f=!1,g=uh.parse(o.url);switch(g.protocol){case"https:":c=!0;case"http:":A=g.hostname;break;case"file:":f=!0;break;case void 0:case null:case"":A="localhost";break;default:throw new Error("Protocol not supported.")}if(f){if("GET"!==o.method)throw new Error("XMLHttpRequest: Only GET method is supported");if(o.async)ch.readFile(g.pathname,"utf8",(function(e,t){e?n.handleError(e):(n.status=200,n.responseText=t,p(n.DONE))}));else try{this.responseText=ch.readFileSync(g.pathname,"utf8"),this.status=200,p(n.DONE)}catch(e){this.handleError(e)}}else{var y=g.port||(c?443:80),m=g.pathname+(g.search?g.search:"");for(var v in s)u[v.toLowerCase()]||(l[v]=s[v]);if(l.Host=A,c&&443===y||80===y||(l.Host+=":"+g.port),o.user){void 0===o.password&&(o.password="");var w=new ao(o.user+":"+o.password);l.Authorization="Basic "+w.toString("base64")}"GET"===o.method||"HEAD"===o.method?a=null:a?(l["Content-Length"]=jo(a)?a.length:ao.byteLength(a),l["Content-Type"]||(l["Content-Type"]="text/plain;charset=UTF-8")):"POST"===o.method&&(l["Content-Length"]=0);var I={host:A,port:y,path:m,method:o.method,headers:l,agent:!1,withCredentials:n.withCredentials};if(d=!1,o.async){var b=c?i.request:r.request;h=!0,n.dispatchEvent("readystatechange");var B=function(e){n.handleError(e)};e=b(I,(function r(i){if(301!==(t=i).statusCode&&302!==t.statusCode&&303!==t.statusCode&&307!==t.statusCode)t.setEncoding("utf8"),p(n.HEADERS_RECEIVED),n.status=t.statusCode,t.on("data",(function(e){e&&(n.responseText+=e),h&&p(n.LOADING)})),t.on("end",(function(){h&&(p(n.DONE),h=!1)})),t.on("error",(function(e){n.handleError(e)}));else{o.url=t.headers.location;var a=uh.parse(o.url);A=a.hostname;var s={hostname:a.hostname,port:a.port,path:a.path,method:303===t.statusCode?"GET":o.method,headers:l,withCredentials:n.withCredentials};(e=b(s,r).on("error",B)).end()}})).on("error",B),a&&e.write(a),e.end(),n.dispatchEvent("loadstart")}else{var E=".node-xmlhttprequest-content-"+gu.pid,C=".node-xmlhttprequest-sync-"+gu.pid;ch.writeFileSync(C,"","utf8");for(var x="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(c?"s":"")+".request;var options = "+JSON.stringify(I)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+E+"', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText}}), 'utf8');fs.unlinkSync('"+C+"');});response.on('error', function(error) {fs.writeFileSync('"+E+"', JSON.stringify({err: error}), 'utf8');fs.unlinkSync('"+C+"');});}).on('error', function(error) {fs.writeFileSync('"+E+"', JSON.stringify({err: error}), 'utf8');fs.unlinkSync('"+C+"');});"+(a?"req.write('"+JSON.stringify(a).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",S=Ah(gu.argv[0],["-e",x]);ch.existsSync(C););var Q=JSON.parse(ch.readFileSync(E,"utf8"));S.stdin.end(),ch.unlinkSync(E),Q.err?n.handleError(Q.err):(t=Q.data,n.status=Q.data.statusCode,n.responseText=Q.data.text,p(n.DONE))}}},this.handleError=function(e){this.status=0,this.statusText=e,this.responseText=e.stack,d=!0,p(this.DONE),this.dispatchEvent("error")},this.abort=function(){e&&(e.abort(),e=null),l=s,this.status=0,this.responseText="",this.responseXML="",d=!0,this.readyState===this.UNSENT||this.readyState===this.OPENED&&!h||this.readyState===this.DONE||(h=!1,p(this.DONE)),this.readyState=this.UNSENT,this.dispatchEvent("abort")},this.addEventListener=function(e,t){e in f||(f[e]=[]),f[e].push(t)},this.removeEventListener=function(e,t){e in f&&(f[e]=f[e].filter((function(e){return e!==t})))},this.dispatchEvent=function(e){if("function"==typeof n["on"+e]&&n["on"+e](),e in f)for(var t=0,r=f[e].length;t<r;t++)f[e][t].call(n)};var p=function(e){e!=n.LOADING&&n.readyState===e||(n.readyState=e,(o.async||n.readyState<n.OPENED||n.readyState===n.DONE)&&n.dispatchEvent("readystatechange"),n.readyState!==n.DONE||d||(n.dispatchEvent("load"),n.dispatchEvent("loadend")))}};function dh(e){return function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){return yield new Promise(((t,n)=>{let{url:r}=e;r||n(new Error("URL is missing")),"http://"!==r.substr(0,7)||e.forceHttp||(console.warn(`Upgrading requested url ${r} to https protocol.`),r=r.replace("http://","https://"));const i=new("undefined"==typeof XMLHttpRequest?hh:XMLHttpRequest);e["bearer-token"]&&i.setRequestHeader("Authorization",`Bearer ${e["bearer-token"]}`),i.onload=()=>{if(i.status>=200&&i.status<300)t(i.responseText);else{console.log(i.responseText);const e=`Error fetching url:${r}; status code:${i.status}`;n(new Error(e))}},i.ontimeout=e=>{console.log("ontimeout",e)},i.onreadystatechange=()=>{404===i.status&&n(new Error(`Error fetching url:${r}; status code:${i.status}`))},i.onerror=()=>{console.error(`Request failed with error ${i.responseText}`),n(new Error(i.responseText))},i.open(e.method||"GET",r),e.body?i.send(JSON.stringify(e.body)):i.send()}))}))}function fh(e,t){return"string"!=typeof e?(console.warn("Trying to test a non string variable"),!1):0===e.indexOf(t)}function ph(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(fh(e,r))return e.slice(r.length)}return e}var gh=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};function yh(e){const t={[Ol.Ethropst]:"ropsten",[Ol.Ethrinkeby]:"rinkeby",[Ol.Ethgoerli]:"goerli",[Ol.Ethsepolia]:"sepolia"};return t[e]?`https://api-${t[e]}.etherscan.io/api?module=proxy`:"https://api.etherscan.io/api?module=proxy"}const mh={serviceURL:function(e){return`${yh(e)}&action=eth_getTransactionByHash&txhash={transaction_id}`},serviceName:Rl.etherscan,parsingFunction:function({jsonResponse:e,chain:t,key:n,keyPropertyName:r}){return gh(this,void 0,void 0,(function*(){const i=yh(t),o={serviceURL:{main:`${i}&action=eth_getBlockByNumber&boolean=true&tag={transaction_id}`,test:`${i}&action=eth_getBlockByNumber&boolean=true&tag={transaction_id}`}},a={serviceURL:{main:`${i}&action=eth_blockNumber`,test:`${i}&action=eth_blockNumber`}},s=yield function(e,t){return gh(this,void 0,void 0,(function*(){const i=e.result.blockNumber,s=ql({explorerAPI:Object.assign(Object.assign({},o),{key:n,keyPropertyName:r}),transactionId:i,chain:t});try{const e=yield dh({url:s}),o=JSON.parse(e).result;return yield function(e,t){return gh(this,void 0,void 0,(function*(){const i=ql({explorerAPI:Object.assign(Object.assign({},a),{key:n,keyPropertyName:r}),chain:e});let o;try{o=yield dh({url:i})}catch(e){throw new Error("Unable to get remote hash")}const s=JSON.parse(o).result;if(s-t<1)throw new Error("Not enough");return s}))}(t,i),o}catch(e){throw new Error("Unable to get remote hash")}}))}(e,t);return function(e,t){const n=e.result,r=new Date(1e3*parseInt(t.timestamp,16)),i=n.from;return{remoteHash:ph(n.input,jl.ethmain.prefixes),issuingAddress:i,time:r,revokedAddresses:[]}}(e,s)}))},priority:-1};function vh(e){return""===e?"":function(e){const t=Date.parse(e);if(t)return new Date(t);const n=function(e){let t=e.slice(0,-5).split(/\D/).map((function(e){return parseInt(e,10)||0}));t[1]-=1,t=new Date(Date.UTC.apply(Date,t));const n=e.slice(-5);let r=parseInt(n,10)/100;return"+"===n.slice(0,1)&&(r*=-1),t.setHours(t.getHours()+r),t.getTime()}(e);return n||function(e){let t,n;const r=/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*)?)([zZ]|([+\-])(\d\d):?(\d\d))?$/.exec(e)||[];return r[1]?(t=r[1].split(/\D/).map((function(e){return parseInt(e,10)||0})),t[1]-=1,t=new Date(Date.UTC.apply(Date,t)),t.getDate()?(r[5]&&(n=parseInt(r[5],10)/100*60,r[6]&&(n+=parseInt(r[6],10)),"+"===r[4]&&(n*=-1),n&&t.setUTCMinutes(t.getUTCMinutes()+n)),t):null):null}(e)}(`${e}`)}function wh(e){return new Date(1e3*e)}const Ih={serviceURL:{main:"https://api.blockcypher.com/v1/eth/main/txs/{transaction_id}?limit=500",test:"https://api.blockcypher.com/v1/beth/test/txs/{transaction_id}?limit=500"},serviceName:Rl.blockcypher,parsingFunction:function({jsonResponse:e}){if(e.confirmations<1)throw new Error("Not enough");const t=vh(e.received),n=e.outputs,r=n[n.length-1];let i=e.inputs[0].addresses[0];const o=ph(r.script,jl.ethmain.prefixes);return i=function(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(!fh(e,r))return`${r}${e}`}return e}(i,jl.ethmain.prefixes),{remoteHash:o,issuingAddress:i,time:t,revokedAddresses:n.filter((e=>!!e.spent_by)).map((e=>e.addresses[0]))}},priority:-1},bh={serviceURL:{main:"https://blockstream.info/api/tx/{transaction_id}",test:"https://blockstream.info/testnet/api/tx/{transaction_id}"},serviceName:Rl.blockstream,parsingFunction:function({jsonResponse:e}){if(!e.status.confirmed)throw new Error("Number of transaction confirmations were less than the minimum required, according to Blockstream API");const t=wh(e.status.block_time),n=e.vout,r=n[n.length-1],i=e.vin[0].prevout.scriptpubkey_address;return{remoteHash:ph(r.scriptpubkey,jl.bitcoin.prefixes),issuingAddress:i,time:t,revokedAddresses:n.filter((e=>!!e.scriptpubkey_address)).map((e=>e.scriptpubkey_address))}},priority:-1},Bh={serviceURL:{main:"https://api.blockcypher.com/v1/btc/main/txs/{transaction_id}?limit=500",test:"https://api.blockcypher.com/v1/btc/test3/txs/{transaction_id}?limit=500"},serviceName:Rl.blockcypher,parsingFunction:function({jsonResponse:e}){if(e.confirmations<1)throw new Error("Number of transaction confirmations were less than the minimum required, according to Blockcypher API");const t=vh(e.received),n=e.outputs,r=n[n.length-1],i=e.inputs[0].addresses[0];return{remoteHash:ph(r.script,jl.bitcoin.prefixes),issuingAddress:i,time:t,revokedAddresses:n.filter((e=>!!e.spent_by)).map((e=>e.addresses[0]))}},priority:-1};var Eh=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};function Ch(e){return e.map((e=>({getTxData:(t,n)=>Eh(this,void 0,void 0,(function*(){return yield function(e,t,n){return Eh(this,void 0,void 0,(function*(){const r=ql({explorerAPI:e,transactionId:t,chain:n});try{const t=yield dh({url:r});return yield e.parsingFunction(Object.assign({jsonResponse:JSON.parse(t),chain:n},e))}catch(e){throw new Error("Unable to get remote hash")}}))}(e,t,n)})),priority:e.priority})))}const xh=[Bh,bh],Sh=[mh,Ih];function Qh({serviceUrl:e,transactionId:t}){return function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){const n={method:"eth_getTransactionByHash",jsonrpc:"2.0",id:"getbyhash",params:["0x"+t]},r=yield dh({url:e,body:n,method:"POST"}),i=JSON.parse(r),o={method:"eth_getBlockByNumber",jsonrpc:"2.0",id:"blockbynumber",params:[i.result.blockNumber,!0]},a=yield dh({url:e,body:o,method:"POST"}),s=JSON.parse(a),l=i.result,u=s.result,A=new Date(1e3*parseInt(u.timestamp,16)),c=l.from;return{remoteHash:ph(l.input,["0x"]),issuingAddress:c,time:A,revokedAddresses:[]}}))}function kh({serviceUrl:e,transactionId:t}){return function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){const n={method:"getrawtransaction",jsonrpc:"2.0",id:"rpctest",params:[t,!0]},r=yield dh({url:e,body:n,method:"POST"}),i=JSON.parse(r).result;return{issuingAddress:i.vout[0].scriptPubKey.addresses[0],remoteHash:ph(i.vout[1].scriptPubKey.asm,["6a20","OP_RETURN "]),time:wh(i.blocktime),revokedAddresses:i.vout.filter((e=>!!e.scriptPubKey.addresses)).map((e=>e.scriptPubKey.addresses)).flat()}}))}const _h=[];function Nh(e=[],t=[],n=!1){const r=e.map((e=>e.serviceName)).filter((e=>!!e)).filter((e=>!!Rl[e]));return r.length?t.reduce(((t,i)=>{if(r.includes(i.serviceName)){const n=Object.assign({},i),r=e.find((e=>e.serviceName===i.serviceName));if(function(e){if(e.key&&!e.keyPropertyName)throw new Error(`Property keyPropertyName is not set for ${e.serviceName}. Cannot pass the key property to the service.`);return!0}(r)){const i=Object.assign(n,r);t.push(i);const o=e.findIndex((e=>e.serviceName===i.serviceName));_h.includes(o)||_h.push(o)}}else t.push(i);return n&&function(e,t){t.forEach((t=>e.splice(t,1)))}(e,_h),t}),[]):t}function Dh(e){return e.map((e=>(e.parsingFunction||(e.parsingFunction="btc"===e.chainType?kh:Qh),e))).map((e=>({getTxData:t=>function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){return yield e.parsingFunction(Object.assign(Object.assign({},e),{transactionId:t}))})),priority:e.priority})))}var Fh,Uh=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};function Ph(e,t){var n;switch(e){case jl[Ol.Bitcoin].code:case jl[Ol.Regtest].code:case jl[Ol.Testnet].code:case jl[Ol.Mocknet].code:return t.bitcoin;case jl[Ol.Ethmain].code:case jl[Ol.Ethropst].code:case jl[Ol.Ethrinkeby].code:case jl[Ol.Ethgoerli].code:case jl[Ol.Ethsepolia].code:return t.ethereum;default:if(!(null===(n=t.custom)||void 0===n?void 0:n.length))throw new Error("Chain is not natively supported. Use custom explorers to retrieve tx data.");return t.custom}}function Th(e,t,n,r){return Uh(this,void 0,void 0,(function*(){try{const i=function(e,t,n){if(1>e.length)throw new Error("Invalid application configuration; check the CONFIG.MinimumBlockchainExplorers configuration value");const r=[],i=e.length;for(let o=0;o<i;o++)r.push(e[o].getTxData(t,n));return r}(e[t],n,r);return yield function(e){return Uh(this,void 0,void 0,(function*(){let t;try{t=yield Gl(e,1)}catch(e){throw new Error(`Transaction lookup error: ${e.message}`)}if(!t||0===t.length)throw new Error("Could not confirm transaction data.");const n=t[0];for(let e=1;e<t.length;e++){const r=t[e];if(n.issuingAddress!==r.issuingAddress)throw new Error("Issuing addresses do not match consistently");if(n.remoteHash!==r.remoteHash)throw new Error("Remote hashes do not match consistently")}return n}))}(i)}catch(i){if(t<e.length-1)return t++,yield Th(e,t,n,r);throw i}}))}function Lh({transactionId:e,chain:t,explorerAPIs:n=[]}){return Uh(this,void 0,void 0,(function*(){const r=function(e){const{bitcoin:t,ethereum:n}={bitcoin:Ch(Nh(r=e,xh)),ethereum:Ch(Nh(r,Sh))};var r;const{custom:i}=function(e){return{custom:Dh(e)}}(e.filter((e=>"rpc"===e.apiType)));return{bitcoin:t,ethereum:n,custom:[...i,...Ch(e.filter((e=>"rpc"!==e.apiType)))]}}(n),i=function({defaultAPIs:e,customAPIs:t}){const n=[e];if(null==t?void 0:t.length){const e=t[0].priority;n.splice(e,0,t)}if(1>e.concat(t).length)throw new Error("Invalid application configuration; check the CONFIG.MinimumBlockchainExplorers configuration value");return n}({defaultAPIs:Ph(t,r),customAPIs:r.custom});return yield Th(i,0,e,t)}))}!function(e){e.mainnet="mainnet",e.testnet="testnet"}(Fh||(Fh={}));var Mh={"@context":{id:"@id",type:"@type",extensions:"https://w3id.org/openbadges/extensions#",obi:"https://w3id.org/openbadges#",validation:"obi:validation",cred:"https://w3id.org/credentials#",dc:"http://purl.org/dc/terms/",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",AlignmentObject:"schema:AlignmentObject",CryptographicKey:"sec:Key",Endorsement:"cred:Credential",Assertion:"obi:Assertion",BadgeClass:"obi:BadgeClass",Criteria:"obi:Criteria",Evidence:"obi:Evidence",Extension:"obi:Extension",FrameValidation:"obi:FrameValidation",IdentityObject:"obi:IdentityObject",Image:"obi:Image",HostedBadge:"obi:HostedBadge",hosted:"obi:HostedBadge",Issuer:"obi:Issuer",Profile:"obi:Profile",RevocationList:"obi:RevocationList",SignedBadge:"obi:SignedBadge",signed:"obi:SignedBadge",TypeValidation:"obi:TypeValidation",VerificationObject:"obi:VerificationObject",author:{"@id":"schema:author","@type":"@id"},caption:{"@id":"schema:caption"},claim:{"@id":"cred:claim","@type":"@id"},created:{"@id":"dc:created","@type":"xsd:dateTime"},creator:{"@id":"dc:creator","@type":"@id"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},endorsement:{"@id":"cred:credential","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},genre:{"@id":"schema:genre"},image:{"@id":"schema:image","@type":"@id"},name:{"@id":"schema:name"},owner:{"@id":"sec:owner","@type":"@id"},publicKey:{"@id":"sec:publicKey","@type":"@id"},publicKeyPem:{"@id":"sec:publicKeyPem"},related:{"@id":"dc:relation","@type":"@id"},startsWith:{"@id":"http://purl.org/dqm-vocabulary/v1/dqm#startsWith"},tags:{"@id":"schema:keywords"},targetDescription:{"@id":"schema:targetDescription"},targetFramework:{"@id":"schema:targetFramework"},targetName:{"@id":"schema:targetName"},targetUrl:{"@id":"schema:targetUrl"},telephone:{"@id":"schema:telephone"},url:{"@id":"schema:url","@type":"@id"},version:{"@id":"schema:version"},alignment:{"@id":"obi:alignment","@type":"@id"},allowedOrigins:{"@id":"obi:allowedOrigins"},audience:{"@id":"obi:audience"},badge:{"@id":"obi:badge","@type":"@id"},criteria:{"@id":"obi:criteria","@type":"@id"},endorsementComment:{"@id":"obi:endorsementComment"},evidence:{"@id":"obi:evidence","@type":"@id"},hashed:{"@id":"obi:hashed","@type":"xsd:boolean"},identity:{"@id":"obi:identityHash"},issuedOn:{"@id":"obi:issueDate","@type":"xsd:dateTime"},issuer:{"@id":"obi:issuer","@type":"@id"},narrative:{"@id":"obi:narrative"},recipient:{"@id":"obi:recipient","@type":"@id"},revocationList:{"@id":"obi:revocationList","@type":"@id"},revocationReason:{"@id":"obi:revocationReason"},revoked:{"@id":"obi:revoked","@type":"xsd:boolean"},revokedAssertions:{"@id":"obi:revoked"},salt:{"@id":"obi:salt"},targetCode:{"@id":"obi:targetCode"},uid:{"@id":"obi:uid"},validatesType:"obi:validatesType",validationFrame:"obi:validationFrame",validationSchema:"obi:validationSchema",verification:{"@id":"obi:verify","@type":"@id"},verificationProperty:{"@id":"obi:verificationProperty"},verify:"verification"}},Rh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"obi:revoked","@type":"xsd:boolean"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:{"@id":"obi:verify","@type":"@id"},publicKey:{"@id":"sec:publicKey","@type":"@id"},BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0/merkleProof2017Schema.json"}]},Oh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"obi:revoked","@type":"xsd:boolean"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:{"@id":"obi:verify","@type":"@id"},publicKey:{"@id":"sec:publicKey","@type":"@id"},BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.1/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.1/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.1/merkleProof2017Schema.json"}]},Hh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType"},contentEncoding:{"@id":"bc:contentEncoding"},content:{"@id":"bc:content"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey"},url:{"@id":"schema:url"},image:{"@id":"schema:image"},criteria:{"@id":"schema:criteria"},claim:{"@id":"schema:claim"}}},Kh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType"},contentEncoding:{"@id":"bc:contentEncoding"},content:{"@id":"bc:content"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey"},url:{"@id":"schema:url"},image:{"@id":"schema:image"},criteria:{"@id":"schema:criteria"},claim:{"@id":"schema:claim"}}};const jh={};jh["https://w3id.org/openbadges/v2"]=Mh,jh["https://openbadgespec.org/v2/context.json"]=Mh,jh["https://www.w3.org/2018/credentials/v1"]={"@context":{"@version":1.1,id:"@id",type:"@type",VerifiableCredential:{"@id":"https://www.w3.org/2018/credentials#VerifiableCredential","@context":{"@version":1.1,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",credentialSchema:{"@id":"cred:credentialSchema","@type":"@id","@context":{"@version":1.1,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",JsonSchemaValidator2018:"cred:JsonSchemaValidator2018"}},credentialStatus:{"@id":"cred:credentialStatus","@type":"@id"},credentialSubject:{"@id":"cred:credentialSubject","@type":"@id"},evidence:{"@id":"cred:evidence","@type":"@id"},expirationDate:{"@id":"cred:expirationDate","@type":"xsd:dateTime"},holder:{"@id":"cred:holder","@type":"@id"},issued:{"@id":"cred:issued","@type":"xsd:dateTime"},issuer:{"@id":"cred:issuer","@type":"@id"},issuanceDate:{"@id":"cred:issuanceDate","@type":"xsd:dateTime"},proof:{"@id":"sec:proof","@type":"@id","@container":"@graph"},refreshService:{"@id":"cred:refreshService","@type":"@id","@context":{"@version":1.1,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",ManualRefreshService2018:"cred:ManualRefreshService2018"}},termsOfUse:{"@id":"cred:termsOfUse","@type":"@id"},validFrom:{"@id":"cred:validFrom","@type":"xsd:dateTime"},validUntil:{"@id":"cred:validUntil","@type":"xsd:dateTime"}}},VerifiablePresentation:{"@id":"https://www.w3.org/2018/credentials#VerifiablePresentation","@context":{"@version":1.1,id:"@id",type:"@type",cred:"https://www.w3.org/2018/credentials#",sec:"https://w3id.org/security#",holder:{"@id":"cred:holder","@type":"@id"},proof:{"@id":"sec:proof","@type":"@id","@container":"@graph"},verifiableCredential:{"@id":"cred:verifiableCredential","@type":"@id","@container":"@graph"}}},EcdsaSecp256k1Signature2019:{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},EcdsaSecp256r1Signature2019:{"@id":"https://w3id.org/security#EcdsaSecp256r1Signature2019","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},Ed25519Signature2018:{"@id":"https://w3id.org/security#Ed25519Signature2018","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},RsaSignature2018:{"@id":"https://w3id.org/security#RsaSignature2018","@context":{"@version":1.1,challenge:"sec:challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"xsd:dateTime"},domain:"sec:domain",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},jws:"sec:jws",nonce:"sec:nonce",proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab","@context":{"@version":1.1,id:"@id",type:"@type",sec:"https://w3id.org/security#",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"}}},proofValue:"sec:proofValue",verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"}}},proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"}}},jh["https://w3id.org/blockcerts/schema/2.0/context.json"]=Rh,jh["https://www.blockcerts.org/schema/2.0/context.json"]=Rh,jh["https://w3id.org/blockcerts/v2"]=Rh,jh["https://w3id.org/blockcerts/schema/2.1/context.json"]=Oh,jh["https://www.blockcerts.org/schema/2.1/context.json"]=Oh,jh["https://w3id.org/blockcerts/v2.1"]=Oh,jh["https://w3id.org/blockcerts/schema/3.0/context.json"]=Hh,jh["https://www.blockcerts.org/schema/3.0/context.json"]=Hh,jh["https://w3id.org/blockcerts/v3"]=Hh,jh["https://w3id.org/blockcerts/schema/3.1/context.json"]=Kh,jh["https://www.blockcerts.org/schema/3.1/context.json"]=Kh,jh["https://w3id.org/blockcerts/v3.1"]=Kh,jh["https://w3id.org/security/suites/merkle-2019/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},MerkleProof2019:{"@id":"https://w3id.org/security#MerkleProof2019","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}},jh["https://w3id.org/security/suites/chained-2021/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},ChainedProof2021:{"@id":"https://w3id.org/security#ChainedProof2021","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"},chainedProofType:{"@id":"https://w3id.org/security#chainedProofType","@type":"@id"},previousProof:{"@id":"https://w3id.org/security#previousProof","@type":"@id"}}}}},jh["https://w3id.org/vc/status-list/2021/v1"]={"@context":{"@protected":!0,StatusList2021Credential:{"@id":"https://w3id.org/vc/status-list#StatusList2021Credential","@context":{"@protected":!0,id:"@id",type:"@type",description:"http://schema.org/description",name:"http://schema.org/name"}},StatusList2021:{"@id":"https://w3id.org/vc/status-list#StatusList2021","@context":{"@protected":!0,id:"@id",type:"@type",statusPurpose:"https://w3id.org/vc/status-list#statusPurpose",encodedList:"https://w3id.org/vc/status-list#encodedList"}},StatusList2021Entry:{"@id":"https://w3id.org/vc/status-list#StatusList2021Entry","@context":{"@protected":!0,id:"@id",type:"@type",statusPurpose:"https://w3id.org/vc/status-list#statusPurpose",statusListIndex:"https://w3id.org/vc/status-list#statusListIndex",statusListCredential:{"@id":"https://w3id.org/vc/status-list#statusListCredential","@type":"@id"}}}}};var Gh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",creator:{"@id":"dc:creator","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"sec:expiration","@type":"xsd:dateTime"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:"bc:verification",publicKeys:"bc:publicKeys",ChainpointSHA256v2:"cp:ChainpointSHA256v2",BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/merkleProof2017Schema.json"}]},qh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"bc:created","@type":"xsd:dateTime"},name:{"@id":"schema:name"}}},Vh={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType","@type":"@id"},contentEncoding:{"@id":"bc:contentEncoding","@type":"@id"},content:{"@id":"bc:content","@type":"@id"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey","@type":"@id"},url:{"@id":"schema:url","@type":"@id"},image:{"@id":"schema:image","@type":"@id"}}};jh["https://w3id.org/blockcerts/schema/2.0-alpha/context.json"]=Gh,jh["https://www.blockcerts.org/schema/2.0-alpha/context.json"]=Gh,jh["https://www.blockcerts.org/schema/3.0-alpha/context.json"]=qh,jh["https://w3id.org/blockcerts/schema/3.0-alpha/context.json"]=qh,jh["https://w3id.org/blockcerts/v3.0-alpha"]=qh,jh["https://www.blockcerts.org/schema/3.0-beta/context.json"]=Vh,jh["https://w3id.org/blockcerts/schema/3.0-beta/context.json"]=Vh,jh["https://w3id.org/blockcerts/v3.0-beta"]=Vh,jh["https://w3id.org/security/suites/ed25519-2020/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},Ed25519VerificationKey2020:{"@id":"https://w3id.org/security#Ed25519VerificationKey2020","@context":{"@protected":!0,id:"@id",type:"@type",controller:{"@id":"https://w3id.org/security#controller","@type":"@id"},revoked:{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},Ed25519Signature2020:{"@id":"https://w3id.org/security#Ed25519Signature2020","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};const zh={locale:"en-US"};var Jh=Object.freeze({__proto__:null,isMainnet:function(e){return Ll(e,"1")||Ll(e,"ecdsa-koblitz-pubkey:1")}}),Yh={locale:"en-US"},Xh={"en-US":{steps:{formatValidationLabel:"Format validation",formatValidationLabelPending:"Validating format",signatureVerificationLabel:"Proof Verification",signatureVerificationLabelPending:"Verifying Proof",identityVerificationLabel:"Identity verification",identityVerificationLabelPending:"Verifying identity",statusCheckLabel:"Status check",statusCheckLabelPending:"Checking record status"},subSteps:{getTransactionIdLabel:"Get transaction ID",getTransactionIdLabelPending:"Getting transaction ID",computeLocalHashLabel:"Compute local hash",computeLocalHashLabelPending:"Computing local hash",fetchRemoteHashLabel:"Fetch remote hash",fetchRemoteHashLabelPending:"Fetching remote hash",getIssuerProfileLabel:"Get issuer profile",getIssuerProfileLabelPending:"Getting issuer profile",parseIssuerKeysLabel:"Parse issuer keys",parseIssuerKeysLabelPending:"Parsing issuer keys",compareHashesLabel:"Compare hashes",compareHashesLabelPending:"Comparing hashes",checkDocumentSignatureLabel:"Check document signature",checkDocumentSignatureLabelPending:"Checking document signature",checkMerkleRootLabel:"Check Merkle Root",checkMerkleRootLabelPending:"Checking Merkle Root",checkReceiptLabel:"Check Receipt",checkReceiptLabelPending:"Checking Receipt",checkAuthenticityLabel:"Check Authenticity",checkAuthenticityLabelPending:"Checking Authenticity",checkRevokedStatusLabel:"Check Revoked Status",checkRevokedStatusLabelPending:"Checking Revoked Status",checkExpiresDateLabel:"Check Expiration Date",checkExpiresDateLabelPending:"Checking Expiration Date",controlVerificationMethodLabel:"Control Verification Method",controlVerificationMethodLabelPending:"Controlling Verification Method",retrieveVerificationMethodPublicKeyLabel:"Extract Public Key from DID Document",retrieveVerificationMethodPublicKeyLabelPending:"Extracting Public Key from DID Document",deriveIssuingAddressFromPublicKeyLabel:"Derive Issuing Address from Public Key",deriveIssuingAddressFromPublicKeyLabelPending:"Deriving Issuing Address from Public Key",compareIssuingAddressLabel:"Compare addresses",compareIssuingAddressLabelPending:"Comparing addresses",checkImagesIntegrityLabel:"Verify Images Integrity",checkImagesIntegrityLabelPending:"Verifying Images Integrity"},revocation:{preReason:"Reason given:",reason:"This certificate has been revoked by the issuer."},success:{mocknet:{label:"This Mocknet credential passed all checks",description:"Mocknet credentials are used for test purposes only. They are not recorded on a blockchain, and they should not be considered verified Blockcerts."},blockchain:{label:"Verified",description:"This is a valid ${chain} certificate.",linkText:"View transaction link"},generic:{label:"Verified",description:"The ${SIGNATURE_TYPE} signature of this document has been successfully verified."},multisign:{label:"Verified",description:"All the signatures of this certificate have successfully verified."}},errors:{certificateNotValid:"This is not a valid certificate",couldNotConfirmTx:"Could not confirm the transaction",ensureHashesEqual:"Computed hash does not match remote hash",ensureMerkleRootEqual:"Merkle root does not match remote hash.",ensureNotExpired:"This certificate has expired.",ensureValidReceipt:"The receipt is malformed. There was a problem navigating the merkle tree in the receipt.",failedJsonLdNormalization:"Failed JSON-LD normalization",foundUnmappedFields:"Found unmapped fields during JSON-LD normalization",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",controlVerificationMethod:"The identity document provided by the issuer does not match the verification method",retrieveVerificationMethodPublicKey:"The identity document provided by the issuer does not reference the verification method",compareIssuingAddress:"The provided verification method does not match the issuer identity",invalidIssuingAddressCreationTime:"The specified issuing address was created after the transaction occurred.",invalidIssuingAddressRevoked:"The specified issuing address was revoked by the issuer before the transaction occurred.",invalidIssuingAddressExpired:"The specified issuing address expired before the transaction occurred.",invalidIssuingAddressUnknown:"The address used to issue this Blockcerts does not belong to the claimed issuer.",getChain:"Didn't recognize chain value",getIssuerProfile:"Unable to get issuer profile",getRevokedAssertions:"Unable to get revocation assertions",getTransactionId:"Cannot verify this certificate without a transaction ID to compare against.",invalidMerkleReceipt:"Invalid Merkle Receipt. Proof hash did not match Merkle root",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"Cannot verify this certificate without a transaction ID to compare against.",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",parseIssuerKeys:"Unable to parse JSON out of issuer identification data.",checkImagesIntegrity:"Image integrity verification proved that the content was modified after issuance."}},fr:{steps:{formatValidationLabel:"Validation du format",formatValidationLabelPending:"Validation du format",signatureVerificationLabel:"Vérification de la preuve",signatureVerificationLabelPending:"Vérification de la preuve",identityVerificationLabel:"Vérification de l'identité",identityVerificationLabelPending:"Vérification de l'identité",statusCheckLabel:"Vérification du status",statusCheckLabelPending:"Vérification du status"},subSteps:{getTransactionIdLabel:"Obtention de l'identifiant de transaction",getTransactionIdLabelPending:"Obtention de l'identifiant de transaction",computeLocalHashLabel:"Calcul du hash local",computeLocalHashLabelPending:"Calcul du hash local",fetchRemoteHashLabel:"Récupération du hash distant",fetchRemoteHashLabelPending:"Récupération du hash distant",getIssuerProfileLabel:"Obtention du profil de l'émetteur",getIssuerProfileLabelPending:"Obtention du profil de l'émetteur",parseIssuerKeysLabel:"Traitement des clés de l'émetteur",parseIssuerKeysLabelPending:"Traitement des clés de l'émetteur",compareHashesLabel:"Comparaison des hash",compareHashesLabelPending:"Comparaison des hashs",checkDocumentSignatureLabel:"Vérification de la signature du document",checkDocumentSignatureLabelPending:"Vérification de la signature du document",checkMerkleRootLabel:"Vérification du Merkle Root",checkMerkleRootLabelPending:"Vérification du Merkle Root",checkReceiptLabel:"Vérification du reçu",checkReceiptLabelPending:"Vérification du reçu",checkAuthenticityLabel:"Vérification de l'authenticité",checkAuthenticityLabelPending:"Vérification de l'authenticité",checkRevokedStatusLabel:"Vérification du status de révocation",checkRevokedStatusLabelPending:"Vérification du status de révocation",checkExpiresDateLabel:"Vérification de la date d'expiration",checkExpiresDateLabelPending:"Vérification de la date d'expiration",controlVerificationMethodLabel:"Contrôle de la Méthode de Vérification",controlVerificationMethodLabelPending:"Contrôle de la Méthode de Vérification",retrieveVerificationMethodPublicKeyLabel:"Extraction de la clé publique depuis le document DID",retrieveVerificationMethodPublicKeyLabelPending:"Extraction de la clé publique depuis le document DID",deriveIssuingAddressFromPublicKeyLabel:"Dérivation de l'adresse d'émission depuis la clé publique",deriveIssuingAddressFromPublicKeyLabelPending:"Dérivation de l'adresse d'émission depuis la clé publique",compareIssuingAddressLabel:"Comparaison des adresses",compareIssuingAddressLabelPending:"Comparaison des adresses",checkImagesIntegrityLabel:"Vérification de l'Intégrité des Images",checkImagesIntegrityLabelPending:"Vérification de l'Intégrité des Images"},revocation:{preReason:"Raison :",reason:"Ce certificat a été révoqué par l'émetteur."},success:{mocknet:{label:"Cet enregistrement Mocknet a été vérifié",description:"Le mode Mocknet est utilisé à des fins de tests uniquement. Ce Blockcert n'a pas été enregistré sur une blockchain, et en tant que tel ne peut pas être considéré un Blockcert valide."},blockchain:{label:"Vérifié",description:"Ceci est un certificat ${chain} valide.",linkText:"Voir la transaction"},generic:{label:"Verified",description:"La signature ${SIGNATURE_TYPE} de ce certificat a été vérifiée avec succès."},multisign:{label:"Vérifié",description:"Toutes les signatures numériques de ce certificat ont été vérifiées avec succès."}},errors:{certificateNotValid:"Certificat invalide",couldNotConfirmTx:"Impossible de confirmer la transaction",ensureHashesEqual:"Calcul du hash local différent du hash distant",ensureMerkleRootEqual:"Le Merkle root ne correspond pas au hash distant",ensureNotExpired:"Certificat expiré",ensureValidReceipt:"Erreur d'écriture du reçu. Un problème est survenu lors de la navigation de l'arbre Merkle du reçu.",failedJsonLdNormalization:"Erreur de normalisation JSON-LD",foundUnmappedFields:"Champs non liés découverts durant la normalisation JSON-LD",identityErrorBaseMessage:"Identité de l'émetteur invalide",deriveIssuingAddressFromPublicKey:"Cette blockchain n'est pas supportée pour la vérification de l'identité décentralisée.",controlVerificationMethod:"Le document d'identité de l'émetteur ne correspond pas à la méthode de vérification.",retrieveVerificationMethodPublicKey:"Le document d'identité de l'émetteur ne fait pas mention de la méthode de vérification.",compareIssuingAddress:"La méthode de vérification n'a pas permis d'établir l'identité de l'émetteur.",invalidIssuingAddressCreationTime:"L'adresse d'émission utilisée a été créée après la transaction d'enregistrement.",invalidIssuingAddressRevoked:"L'adresse d'émission utilisée a été décommissionnée par l'émetteur avant la transaction d'enregistrement.",invalidIssuingAddressExpired:"L'adresse d'émission utilisée a expiré avant la transaction.",invalidIssuingAddressUnknown:"L'adresse utilisée pour émettre ce Blockcerts n'appartient à l'émetteur déclaré.",getChain:"Valeur de chaine non reconnue",getIssuerProfile:"Profil de l'émetteur indisponible",getRevokedAssertions:"Impossible d'obtenir les raisons de revocation",getTransactionId:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",invalidMerkleReceipt:"Reçu Merkle invalide. Hash de preuve différent du Merkle root",invalidMerkleVersion:"La version du Merkle utilisé est incompatible avec la version Blockcerts.",isTransactionIdValid:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",issuerProfileNotSet:"l'URL de l'émetteur n'est pas définie",issuerProfileInvalid:"le document distant ne semble pas être un profil d'émetteur valide",parseIssuerKeys:"Impossible de lire le JSON d'identification de l'émetteur",checkImagesIntegrity:"La vérification des images a prouvé que le contenu a été modifié après l'émission."}},es:{steps:{formatValidationLabel:"Validación de formato",formatValidationLabelPending:"Validando el formato",signatureVerificationLabel:"Verificar prueba",signatureVerificationLabelPending:"Verificando prueba",identityVerificationLabel:"Verificar identitad",identityVerificationLabelPending:"Verificando identitad",statusCheckLabel:"Estado de Verificación",statusCheckLabelPending:"Verificando Estado de Grabación"},subSteps:{getTransactionIdLabel:"Obtener Identificación de Transacción",getTransactionIdLabelPending:"Obteniendo Identificación de Transacción",computeLocalHashLabel:"Calcular cadena binaria local",computeLocalHashLabelPending:"Calculando cadena binaria local",fetchRemoteHashLabel:"Obtener cadena binaria remota",fetchRemoteHashLabelPending:"Obeniendo cadena binaria remota",getIssuerProfileLabel:"Obtener perfil de emisor",getIssuerProfileLabelPending:"Obteniendo perfil de emisor",parseIssuerKeysLabel:"Analizar claves del emisor",parseIssuerKeysLabelPending:"Analizando claves del emisor",compareHashesLabel:"Comparar cadenas binarias",compareHashesLabelPending:"Comparando cadenas binarias",checkDocumentSignatureLabel:"Controlar firma del documento",checkDocumentSignatureLabelPending:"Controlando firma del documento",checkMerkleRootLabel:"Verificar Merkle Root",checkMerkleRootLabelPending:"Verificando Merkle Root",checkReceiptLabel:"Verificar Recibo",checkReceiptLabelPending:"Verificando Recibo",checkAuthenticityLabel:"Verificar Autenticidad",checkAuthenticityLabelPending:"Verificando Autenticidad",checkRevokedStatusLabel:"Verificar Estado de Revocación",checkRevokedStatusLabelPending:"Verificando Estado de Revocación",checkExpiresDateLabel:"Verificar Fechas de Expiración",checkExpiresDateLabelPending:"Verificando Fechas de Expiración",controlVerificationMethodLabel:"Controlar Metodo de Verificación",controlVerificationMethodLabelPending:"Controlando Metodo de Verificación",retrieveVerificationMethodPublicKeyLabel:"Extraer la llave pública desde el documento DID",retrieveVerificationMethodPublicKeyLabelPending:"Extraendo la llave pública desde el documento DID",deriveIssuingAddressFromPublicKeyLabel:"Derivar la dirección del emisor desde la llave pública",deriveIssuingAddressFromPublicKeyLabelPending:"Derivando la dirección del emisor desde la llave pública",compareIssuingAddressLabel:"Comparar direcciones",compareIssuingAddressLabelPending:"Comparando direcciones",checkImagesIntegrityLabel:"Comprobar Integridad de las Imagens",checkImagesIntegrityLabelPending:"Comprobando Integridad de las Imagens"},revocation:{preReason:"Razón dada:",reason:"Este certificado ha sido revocado por el emisor"},success:{mocknet:{label:"Esta credencial de Mocknet pasó todas las comprobaciones",description:"Las credenciales de Mocknet se usan solo con fines de prueba. No se graban en una cadena de bloques, y no se deben considerar Blockcerts Verificados."},blockchain:{label:"Verificado",description:"Este es un certificado válido de ${chain}.",linkText:"Ver enlace de transacción"},generic:{label:"Verified",description:"La firma ${SIGNATURE_TYPE} de este certificado ha verificado con éxito."},multisign:{label:"Verificado",description:"Todas las firmas digitales de este certificado han verificado con éxito."}},errors:{certificateNotValid:"Este no es un certificado válido",couldNotConfirmTx:"No se ha podido confirmar la transacción",ensureHashesEqual:"La cadena binaria calculada no corresponde con la cadena binaria remota",ensureMerkleRootEqual:"La raíz Merkle no corresponde con la cadena binaria remota",ensureNotExpired:"Este certificado ha expirado",ensureValidReceipt:"El recibo está malformado. Hubo un problema navegando el árbol Merkle en el recibo",failedJsonLdNormalization:"La normalización del JSON-LD ha fallado",foundUnmappedFields:"Se han encontrado campos no mapeados durante la normalización de JSON-LD",identityErrorBaseMessage:"Identitad del emisor inválida",deriveIssuingAddressFromPublicKey:"No se puede validar la identitad decentalisada con esta cadena binaria.",controlVerificationMethod:"El documento de identitad del emisor no corresponde al metodo de verificación.",retrieveVerificationMethodPublicKey:"El documento de identitad del emisor no hace constar al metodo de verificación.",compareIssuingAddress:"El metodo de verificación no corresponde a la identitad del emisor.",invalidIssuingAddressCreationTime:"El emisor creó el metodo de verificación después de la emisión del certificado.",invalidIssuingAddressRevoked:"El emisor revocó el metodo de verificación antes de la emisión del certificado.",invalidIssuingAddressExpired:"El metodo de verificación expiró antes de la emisión del certificado.",invalidIssuingAddressUnknown:"El metodo de verificación no pertenece a la identitad del emisor.",getChain:"Valor de cadena no reconocido",getIssuerProfile:"No se ha podido obtener el perfil del emisor",getRevokedAssertions:"No se ha podido obtener aseveraciones de revocación",getTransactionId:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",invalidMerkleReceipt:"Recibo Merkle inválido. La cadena binaria de prueba no corresponde con la raíz Merkle",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",issuerProfileNotSet:"URL del emisor no definido",issuerProfileInvalid:"el documento recogido no parece ser un perfil de emisor valido",parseIssuerKeys:"No se ha podido analizar el JSON de la información de identificación del emisor",checkImagesIntegrity:"La verificación de la integridad de los imagens provó alteración del contenido después de la emisión."}},mt:{steps:{formatValidationLabel:"Validazzjoni tal-format",formatValidationLabelPending:"Il-format qed jiġi vvalidat",signatureVerificationLabel:"Proof Verification",signatureVerificationLabelPending:"Verifying Proof",identityVerificationLabel:"Identity verification",identityVerificationLabelPending:"Verifying identity",statusCheckLabel:"Status check",statusCheckLabelPending:"Ir-record status qed jiġi ċċekkjat"},subSteps:{getTransactionIdLabel:"Ikseb l-ID ta' tranżazzjoni",getTransactionIdLabelPending:"L-ID ta' tranżazzjoni qed tiġi mniżżla",computeLocalHashLabel:"Ikkalkula l-hash lokali",computeLocalHashLabelPending:"Il-hash lokali qed jiġi kkalkulat",fetchRemoteHashLabel:"Fittex ir-remote hash",fetchRemoteHashLabelPending:"Ir-remote hash qed jiġi mfittex",getIssuerProfileLabel:"Ikseb il-profil tal-emittent",getIssuerProfileLabelPending:"Il-profil tal-emittent qed jiġi mniżżel",parseIssuerKeysLabel:"Estratta ċ-ċwievet tal-emittent",parseIssuerKeysLabelPending:"Iċ-ċwievet tal-emittent qed jiġu estratti",compareHashesLabel:"Ikkumpara l-hashes",compareHashesLabelPending:"Il-hashes qed jiġu kkomparati",checkDocumentSignatureLabel:"Check document signature",checkDocumentSignatureLabelPending:"Checking document signature",checkMerkleRootLabel:"Iċċekkja l-Merkle Root",checkMerkleRootLabelPending:"Il-Merkle Root Qed Tiġi Ċċekkjata",checkReceiptLabel:"Iċċekkja l-Irċevuta",checkReceiptLabelPending:"L-Irċevuta Qed Tiġi Ċċekkjata",checkAuthenticityLabel:"Iċċekkja l-Awtentiċità",checkAuthenticityLabelPending:"L-Awtentiċità Qed Tiġi Ċċekkjata",checkRevokedStatusLabel:"Iċċekkja l-Istatus Revokat",checkRevokedStatusLabelPending:"L-Istatus Revokat Qed Jiġi Ċċekkjat",checkExpiresDateLabel:"Iċċekkja d-Data ta' Skadenza",checkExpiresDateLabelPending:"Id-Data ta' Skadenza Qed Tiġi Ċċekkjata",controlVerificationMethodLabel:"Control Verification Method",controlVerificationMethodLabelPending:"Controlling Verification Method",retrieveVerificationMethodPublicKeyLabel:"Extract Public Key from DID Document",retrieveVerificationMethodPublicKeyLabelPending:"Extracting Public Key from DID Document",deriveIssuingAddressFromPublicKeyLabel:"Derive Issuing Address from Public Key",deriveIssuingAddressFromPublicKeyLabelPending:"Deriving Issuing Address from Public Key",compareIssuingAddressLabel:"Compare addresses",compareIssuingAddressLabelPending:"Comparing addresses",checkImagesIntegrityLabel:"Verify Images Integrity",checkImagesIntegrityLabelPending:"Verifying Images Integrity"},revocation:{preReason:"Raġuni mogħtija:",reason:"Dan iċ-ċertifikat ġie revokat mill-emittent."},success:{mocknet:{label:"Din il-kredenzjali tal-Mocknet għaddiet il-kontrolli kollha",description:"Il-kredenzjali tal-Mocknet jintużaw biss għal skopijiet ta 'ttestjar. Dawn mhumiex irreġistrati fuq blockchain, u ma għandhomx jiġu kkunsidrati bħala blockcerts verifikati."},blockchain:{label:"Ivverifikat",description:"Dan huwa ċertifikat ${chain} huwa validu.",linkText:"Ara l-link tat-transazzjoni"},generic:{label:"Ivverifikat",description:"The ${SIGNATURE_TYPE} signature of this document has been successfully verified."},multisign:{label:"Ivverifikat",description:"All the signatures of this certificate have successfully verified."}},errors:{certificateNotValid:"Dan mhux ċertifikat validu",couldNotConfirmTx:"Ma setgħetx tiġi kkonfermata t-tranżazzjoni",ensureHashesEqual:"Il-hash ikkalkulat ma jikkorrispondix mar-remote hash",ensureMerkleRootEqual:"Merkle root ma taqbilx mar-remote hash",ensureNotExpired:"Dan iċ-ċertifikat skada",ensureValidReceipt:"L-irċevuta hija malformata. Kien hemm problema fin-navigazzjoni tal-merkle tree fl-irċevuta",failedJsonLdNormalization:"In-normalizzazzjoni ta' JSON-LD ma rnexxietx",foundUnmappedFields:"Instabu unmapped fields matul in-normalizzazzjoni JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",controlVerificationMethod:"The identity document provided by the issuer does not match the verification method",retrieveVerificationMethodPublicKey:"The identity document provided by the issuer does not reference the verification method",compareIssuingAddress:"The provided verification method does not match the issuer identity",invalidIssuingAddressCreationTime:"L-indirizz elettroniku tal-ħruġ speċifikat inħoloq wara li seħħet it-tranżazzjoni.",invalidIssuingAddressRevoked:"L-indirizz elettroniku tal-ħruġ speċifikat ġie revokat mill-emittent qabel ma seħħet it-tranżazzjoni.",invalidIssuingAddressExpired:"L-indirizz elettroniku tal-ħruġ speċifikat skada qabel ma seħħet it-tranżazzjoni.",invalidIssuingAddressUnknown:"L-indirizz elettroniku użat biex jinħarġu dawn il-Blockcerts ma jappartjenix għall-emittent mitlub.",getChain:"Iċ-chain value ma ntgħarafx",getIssuerProfile:"Mhux possibbli jinkiseb il-profil tal-emittent",getRevokedAssertions:"Mhux possibbli jinkisbu dikjarazzjonijiet revokati",getTransactionId:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",invalidMerkleReceipt:"Irċevuta Merkle invalida. Il-proof hash ma kienx jaqbel mal-Merkle root",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",parseIssuerKeys:"Ma jistax jiġi estratt JSON mid-data tal-identifikazzjoni tal-emittent",checkImagesIntegrity:"Image integrity verification proved that the content was modified after issuance."}},"it-IT":{steps:{formatValidationLabel:"Convalidare formato",formatValidationLabelPending:"Convalida formato",signatureVerificationLabel:"Proof Verification",signatureVerificationLabelPending:"Verifying Proof",identityVerificationLabel:"Identity verification",identityVerificationLabelPending:"Verifying identity",statusCheckLabel:"Verificare stato",statusCheckLabelPending:"Verifica stato del record"},subSteps:{getTransactionIdLabel:"Ottenere ID transazione",getTransactionIdLabelPending:"Ottieni ID transazione",computeLocalHashLabel:"Calcolare hash locale",computeLocalHashLabelPending:"Calcola hash locale",fetchRemoteHashLabel:"Recuperare hash remoto",fetchRemoteHashLabelPending:"Recupera hash remoto",getIssuerProfileLabel:"Ottenere profilo issuer",getIssuerProfileLabelPending:"Ottieni profilo issuer",parseIssuerKeysLabel:"Analizzare chiavi issuer",parseIssuerKeysLabelPending:"Analizza chiavi issuer",compareHashesLabel:"Confrontare gli hash",compareHashesLabelPending:"Confronto hash",checkDocumentSignatureLabel:"Check document signature",checkDocumentSignatureLabelPending:"Checking document signature",checkMerkleRootLabel:"Controllare radice di Merkle",checkMerkleRootLabelPending:"Controllo radice di Merkle",checkReceiptLabel:"Verificare ricevuta",checkReceiptLabelPending:"Verifica ricevuta",checkAuthenticityLabel:"Verificare autenticità",checkAuthenticityLabelPending:"Verifica autenticità",checkRevokedStatusLabel:"Verificare stato revocato",checkRevokedStatusLabelPending:"Verifica stato revocato",checkExpiresDateLabel:"Verificare data di scadenza",checkExpiresDateLabelPending:"Verifica data di scadenza",controlVerificationMethodLabel:"Control Verification Method",controlVerificationMethodLabelPending:"Controlling Verification Method",retrieveVerificationMethodPublicKeyLabel:"Extract Public Key from DID Document",retrieveVerificationMethodPublicKeyLabelPending:"Extracting Public Key from DID Document",deriveIssuingAddressFromPublicKeyLabel:"Derive Issuing Address from Public Key",deriveIssuingAddressFromPublicKeyLabelPending:"Deriving Issuing Address from Public Key",compareIssuingAddressLabel:"Compare addresses",compareIssuingAddressLabelPending:"Comparing addresses",checkImagesIntegrityLabel:"Verify Images Integrity",checkImagesIntegrityLabelPending:"Verifying Images Integrity"},revocation:{preReason:"Motivo indicato:",reason:"Questo certificato è stato revocato dall'emittente."},success:{mocknet:{label:"Questo Blockcert simulato ha superato tutti i controlli.",description:"La modalità Mocknet è utilizzata solo dagli emittenti per testare il loro flusso di lavoro localmente. Questo Blockcert non è stato registrato su una blockchain e non dovrebbe essere considerato un Blockcert verificato."},blockchain:{label:"Verificato",description:"Questo è un certificato ${chain} valido.",linkText:"Vedi la transazione"},generic:{label:"Verificato",description:"The ${SIGNATURE_TYPE} signature of this document has been successfully verified."},multisign:{label:"Verificato",description:"All the signatures of this certificate have successfully verified."}},errors:{certificateNotValid:"Questo non è un certificato valido",couldNotConfirmTx:"Impossibile confermare la transazione",ensureHashesEqual:"L'hash calcolato non corrisponde all'hash remoto",ensureMerkleRootEqual:"La radice di Merkle non corrisponde all'hash remoto.",ensureNotExpired:"Questo certificato è scaduto.",ensureValidReceipt:"La ricevuta è malformata. C'è stato un problema nella navigazione dell'albero di Merkle nella ricevuta.",failedJsonLdNormalization:"Normalizzazione JSON-LD fallita",foundUnmappedFields:"Campi non mappati trovati durante la normalizzazione JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",controlVerificationMethod:"The identity document provided by the issuer does not match the verification method",retrieveVerificationMethodPublicKey:"The identity document provided by the issuer does not reference the verification method",compareIssuingAddress:"The provided verification method does not match the issuer identity",invalidIssuingAddressCreationTime:"The specified issuing address was created after the transaction occurred.",invalidIssuingAddressRevoked:"The specified issuing address was revoked by the issuer before the transaction occurred.",invalidIssuingAddressExpired:"The specified issuing address expired before the transaction occurred.",invalidIssuingAddressUnknown:"The address used to issue this Blockcerts does not belong to the claimed issuer.",getChain:"Il valore della catena non è stato riconosciuto",getIssuerProfile:"Impossibile ottenere il profilo dell'emittente",getRevokedAssertions:"Impossibile ottenere le asserzioni di revoca",getTransactionId:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",invalidMerkleReceipt:"Ricevuta Merkle non valida. L'hash di prova non corrisponde alla radice di Merkle",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",parseIssuerKeys:"Impossibile analizzare JSON dai dati di identificazione dell'emittente.",checkImagesIntegrity:"Image integrity verification proved that the content was modified after issuance."}},ja:{steps:{formatValidationLabel:"フォーマットの検証",formatValidationLabelPending:"フォーマットを検証しています",signatureVerificationLabel:"Proof Verification",signatureVerificationLabelPending:"Verifying Proof",identityVerificationLabel:"Identity verification",identityVerificationLabelPending:"Verifying identity",statusCheckLabel:"ステータスの確認",statusCheckLabelPending:"ステータスを確認しています"},subSteps:{getTransactionIdLabel:"取引IDの取得",getTransactionIdLabelPending:"取引IDを取得しています",computeLocalHashLabel:"ローカルハッシュの算出",computeLocalHashLabelPending:"ローカルハッシュを算出しています",fetchRemoteHashLabel:"リモートハッシュのフェッチ",fetchRemoteHashLabelPending:"リモートハッシュをフェッチしています",getIssuerProfileLabel:"発行者プロフィールの取得",getIssuerProfileLabelPending:"発行者プロフィールを取得しています",parseIssuerKeysLabel:"発行者の鍵のパース",parseIssuerKeysLabelPending:"発行者の鍵をパースしています",compareHashesLabel:"ハッシュの照合",compareHashesLabelPending:"ハッシュを照合しています",checkDocumentSignatureLabel:"Check document signature",checkDocumentSignatureLabelPending:"Checking document signature",checkMerkleRootLabel:"Merkle Rootの確認",checkMerkleRootLabelPending:"Merkle Rootを確認しています",checkReceiptLabel:"レシートの確認",checkReceiptLabelPending:"レシートを確認しています",checkAuthenticityLabel:"真正性の確認",checkAuthenticityLabelPending:"真正性を確認しています",checkRevokedStatusLabel:"取消ステータスの確認",checkRevokedStatusLabelPending:"取消ステータスを確認しています",checkExpiresDateLabel:"有効期限の確認",checkExpiresDateLabelPending:"有効期限を確認しています",controlVerificationMethodLabel:"Control Verification Method",controlVerificationMethodLabelPending:"Controlling Verification Method",retrieveVerificationMethodPublicKeyLabel:"Extract Public Key from DID Document",retrieveVerificationMethodPublicKeyLabelPending:"Extracting Public Key from DID Document",deriveIssuingAddressFromPublicKeyLabel:"Derive Issuing Address from Public Key",deriveIssuingAddressFromPublicKeyLabelPending:"Deriving Issuing Address from Public Key",compareIssuingAddressLabel:"Compare addresses",compareIssuingAddressLabelPending:"Comparing addresses",checkImagesIntegrityLabel:"Verify Images Integrity",checkImagesIntegrityLabelPending:"Verifying Images Integrity"},revocation:{preReason:"理由:",reason:"この証明書は発行者によって取り消されました。"},success:{mocknet:{label:"このMocknetの証明書は全てのチェックを通過しました。",description:"Mocknetの証明書はテスト用のものです。ブロックチェーンに記録されませんし、認証済みのBlockcertとして扱われません。"},blockchain:{label:"認証されました",description:"この証明書は有効な${chain}証明書です。",linkText:"取引を確認する"},generic:{label:"認証されました",description:"The ${SIGNATURE_TYPE} signature of this document has been successfully verified."},multisign:{label:"認証されました",description:"All the signatures of this certificate have successfully verified."}},errors:{certificateNotValid:"この証明書は有効ではありません",couldNotConfirmTx:"取引を確認できませんでした",ensureHashesEqual:"算出されたハッシュがリモートハッシュと一致しませんでした",ensureMerkleRootEqual:"Merkle rootがリモートハッシュと一致しませんでした",ensureNotExpired:"この証明書の有効期限が切れています",ensureValidReceipt:"レシートが異常です。レシート内のMerkle treeを辿る際に問題が発生しました。",failedJsonLdNormalization:"JSON-LDの正規化に失敗しました",foundUnmappedFields:"JSON-LDの正規化時にマップされていないフィールドを検出しました",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",controlVerificationMethod:"The identity document provided by the issuer does not match the verification method",retrieveVerificationMethodPublicKey:"The identity document provided by the issuer does not reference the verification method",compareIssuingAddress:"The provided verification method does not match the issuer identity",invalidIssuingAddressCreationTime:"The specified issuing address was created after the transaction occurred.",invalidIssuingAddressRevoked:"The specified issuing address was revoked by the issuer before the transaction occurred.",invalidIssuingAddressExpired:"The specified issuing address expired before the transaction occurred.",invalidIssuingAddressUnknown:"The address used to issue this Blockcerts does not belong to the claimed issuer.",getChain:"チェーンの値を認識できませんでした",getIssuerProfile:"発行者プロフィールを取得できません",getRevokedAssertions:"取消assertionsを取得できません",getTransactionId:"照合のための取引IDがないため、この証明書を認証できません。",invalidMerkleReceipt:"Merkleレシートが無効です。証明ハッシュがMerkle rootと一致しませんでした。",invalidMerkleVersion:"Merkle version used for signature is incompatible with Blockcerts version.",isTransactionIdValid:"照合するための取引IDがないため、この証明書を認証できません。",issuerProfileNotSet:"no issuer address given",issuerProfileInvalid:"retrieved file does not seem to be a valid profile",parseIssuerKeys:"発行者識別データからJSONをパースできません",checkImagesIntegrity:"Image integrity verification proved that the content was modified after issuance."}}};function Wh(e,t){return e&&t?Xh[Yh.locale]?Xh[Yh.locale][e]?Xh[Yh.locale][e][t]?Xh[Yh.locale][e][t]||"":"[missing locale item data]":"[missing locale group data]":"[missing locale data]":""}var Zh=Object.freeze({__proto__:null,detectLocale:function(){return navigator.language||zh.locale},ensureIsSupported:function(e){let t;const n=zC.i18n.getSupportedLanguages().map((e=>e.toLowerCase()));if(t=n.includes(e.toLowerCase()),!t){const r=e.substr(0,2).toLowerCase(),i=n.map((e=>e.split("-")[0])).indexOf(r);t=i>-1,t&&(e=n[i])}return t||(e=zh.locale),function(e){const t=e.split("-");return t.length>1?`${t[0].toLowerCase()}-${t[1].toUpperCase()}`:t[0].toLowerCase()}(e)},getComposedText:function(e,t){return Wh(e,t)},getText:Wh,getSupportedLanguages:function(){return Object.keys(Xh)}});class $h{publicKey;created;revoked;expires;constructor(e,t,n,r){this.publicKey=e,this.created=t,this.revoked=n,this.expires=r}}class ed{image;jobTitle;name;constructor(e,t,n){this.image=e,this.jobTitle=t,this.name=n}}class td extends Error{stepCode;constructor(e,t){super(t),this.stepCode=e}}const nd=Xh[Yh.locale];var rd,id;function od(){return{[rd.formatValidation]:{code:rd.formatValidation,label:nd.steps.formatValidationLabel,labelPending:nd.steps.formatValidationLabelPending,subSteps:[]},[rd.proofVerification]:{code:rd.proofVerification,label:nd.steps.signatureVerificationLabel,labelPending:nd.steps.signatureVerificationLabelPending,subSteps:[]},[rd.identityVerification]:{code:rd.identityVerification,label:nd.steps.identityVerificationLabel,labelPending:nd.steps.identityVerificationLabelPending,subSteps:[]},[rd.statusCheck]:{code:rd.statusCheck,label:nd.steps.statusCheckLabel,labelPending:nd.steps.statusCheckLabelPending,subSteps:[]}}}function ad(e,t){const n=e.findIndex((e=>e===t));n>-1&&e.splice(n,1)}!function(e){e.formatValidation="formatValidation",e.proofVerification="proofVerification",e.identityVerification="identityVerification",e.statusCheck="statusCheck",e.final="final"}(rd||(rd={})),function(e){e.checkImagesIntegrity="checkImagesIntegrity",e.checkRevokedStatus="checkRevokedStatus",e.checkExpiresDate="checkExpiresDate",e.controlVerificationMethod="controlVerificationMethod"}(id||(id={})),Object.freeze({__proto__:null,final:"final",get VerificationSteps(){return rd},get SUB_STEPS(){return id},default:od});const sd={[rd.formatValidation]:[id.checkImagesIntegrity],[rd.proofVerification]:[],[rd.identityVerification]:[id.controlVerificationMethod],[rd.statusCheck]:[id.checkRevokedStatus,id.checkExpiresDate]};function ld(e,t){return sd[e].filter((e=>t.includes(e))).map((t=>zC.verifier.convertToVerificationSubsteps(e,t)))}function ud(e){const t=od();return Object.keys(t).map((n=>({...t[n],subSteps:ld(n,e)})))}var Ad=Object.freeze({__proto__:null,getChain:function(e,t){const n=t||null;if(n?.anchors){const e=n.anchors[0];if(e.chain)return function(e){const t=Object.keys(jl).map((e=>jl[e])).find((t=>t.signatureValue===e));if(void 0===t)throw new Error(Wh("errors","getChain"));return t}(e.chain)}return function(e=""){return Jh.isMainnet(e)?jl.bitcoin:jl.testnet}(e)},generateRevocationReason:function(e){return e=(e=e.trim()).length>0?` ${Wh("revocation","preReason")} ${e}${"."!==e.slice(-1)?".":""}`:"",`${Wh("revocation","reason")}${e}`},getTransactionId:function(e={}){try{const{anchors:t}=e,n=t[0];if(n.sourceId)return n.sourceId;if("string"==typeof n)return n.split(":").pop()}catch(e){throw new td("",Wh("errors","getTransactionId"))}},getTransactionLink:function(e,t){return e&&t?{rawTransactionLink:t.transactionTemplates.raw.replace("{transaction_id}",e),transactionLink:t.transactionTemplates.full.replace("{transaction_id}",e)}:null},getVerificationMap:function(e=!1,t=!1){const n=function(e,t){const n=Object.values(id);return e||ad(n,id.controlVerificationMethod),t||ad(n,id.checkImagesIntegrity),n}(e,t);return{verificationProcess:n,verificationMap:ud(n)}}}),cd=Object.freeze({__proto__:null,isMockChain:function(e){if(e){const t="string"==typeof e?e:e.code;return!!Object.keys(jl).some((e=>e===t))&&!!jl[t].test}return!1}});const hd={value:"https://dev.uniresolver.io/1.0/identifiers",set url(e){this.value=e},get url(){return this.value}};function dd(e){return e.startsWith("did:",0)}function fd(e){return e.startsWith("did:key:",0)}var pd={},gd={},yd={};function md(e){const t=[];for(const n of e)t.indexOf(n)<0&&t.push(n);return t}Object.defineProperty(yd,"__esModule",{value:!0}),yd.uniq=yd.recursivePartialOverride=void 0,yd.recursivePartialOverride=function e(t,n){if(null==n)return t;const r=Object.getPrototypeOf({});if(Object.getPrototypeOf(n)!=r)return n;let i=Object.assign({},t),o=Object.keys(n);const a=md(Object.keys(i).concat(o));for(const t of a)if(o.indexOf(t)>=0){const r=n[t];if(null!=r&&"object"==typeof r){const n=i[t];i[t]=e(n,r)}else i[t]=r}return i},yd.uniq=md;var vd={},wd=Object.prototype.toString,Id=function(e){if(void 0===e)return"undefined";if(null===e)return"null";var t=typeof e;if("boolean"===t)return"boolean";if("string"===t)return"string";if("number"===t)return"number";if("symbol"===t)return"symbol";if("function"===t)return function(e,t){return"GeneratorFunction"===bd(e)}(e)?"generatorfunction":"function";if(function(e){return Array.isArray?Array.isArray(e):e instanceof Array}(e))return"array";if(function(e){return!(!e.constructor||"function"!=typeof e.constructor.isBuffer)&&e.constructor.isBuffer(e)}(e))return"buffer";if(function(e){try{if("number"==typeof e.length&&"function"==typeof e.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(e))return"arguments";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";if(function(e){return e instanceof RegExp||"string"==typeof e.flags&&"boolean"==typeof e.ignoreCase&&"boolean"==typeof e.multiline&&"boolean"==typeof e.global}(e))return"regexp";switch(bd(e)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(e){return"function"==typeof e.throw&&"function"==typeof e.return&&"function"==typeof e.next}(e))return"generator";switch(t=wd.call(e)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")};function bd(e){return"function"==typeof e.constructor?e.constructor.name:null}const Bd=Symbol.prototype.valueOf,Ed=Id;
|
|
531
531
|
/*!
|
|
532
532
|
* isobject <https://github.com/jonschlinkert/isobject>
|
|
533
533
|
*
|
|
@@ -707,7 +707,7 @@ const{suites:{LinkedDataSignature:_N}}=m_,NN=SN.constants.CONTEXT_URL,DN=kN.cons
|
|
|
707
707
|
* Released under MIT license <https://lodash.com/license>
|
|
708
708
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
709
709
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
710
|
-
*/!function(e,t){(function(){var n,r="Expected a function",i="__lodash_hash_undefined__",o="__lodash_placeholder__",a=32,s=128,l=1/0,u=9007199254740991,A=NaN,c=4294967295,h=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",a],["partialRight",64],["rearg",256]],d="[object Arguments]",f="[object Array]",p="[object Boolean]",g="[object Date]",y="[object Error]",m="[object Function]",v="[object GeneratorFunction]",w="[object Map]",I="[object Number]",b="[object Object]",B="[object Promise]",E="[object RegExp]",C="[object Set]",x="[object String]",S="[object Symbol]",Q="[object WeakMap]",k="[object ArrayBuffer]",_="[object DataView]",N="[object Float32Array]",D="[object Float64Array]",F="[object Int8Array]",U="[object Int16Array]",P="[object Int32Array]",T="[object Uint8Array]",L="[object Uint8ClampedArray]",M="[object Uint16Array]",R="[object Uint32Array]",O=/\b__p \+= '';/g,H=/\b(__p \+=) '' \+/g,K=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,q=RegExp(j.source),V=RegExp(G.source),z=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,Z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$=/[\\^$.*+?()[\]{}|]/g,ee=RegExp($.source),te=/^\s+/,ne=/\s/,re=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ie=/\{\n\/\* \[wrapped with (.+)\] \*/,oe=/,? & /,ae=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ae=/\w*$/,ce=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,fe=/^0o[0-7]+$/i,pe=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ye=/($^)/,me=/['\n\r\u2028\u2029\\]/g,ve="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",we="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",be="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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",Be="["+be+"]",Ee="["+ve+"]",Ce="\\d+",xe="["+we+"]",Se="[^\\ud800-\\udfff"+be+Ce+"\\u2700-\\u27bf"+we+Ie+"]",Qe="\\ud83c[\\udffb-\\udfff]",ke="[^\\ud800-\\udfff]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",Ne="[\\ud800-\\udbff][\\udc00-\\udfff]",De="["+Ie+"]",Fe="(?:"+xe+"|"+Se+")",Ue="(?:"+De+"|"+Se+")",Pe="(?:['’](?:d|ll|m|re|s|t|ve))?",Te="(?:['’](?:D|LL|M|RE|S|T|VE))?",Le="(?:"+Ee+"|"+Qe+")?",Me="[\\ufe0e\\ufe0f]?",Re=Me+Le+"(?:\\u200d(?:"+[ke,_e,Ne].join("|")+")"+Me+Le+")*",Oe="(?:"+["[\\u2700-\\u27bf]",_e,Ne].join("|")+")"+Re,He="(?:"+[ke+Ee+"?",Ee,_e,Ne,"[\\ud800-\\udfff]"].join("|")+")",Ke=RegExp("['’]","g"),je=RegExp(Ee,"g"),Ge=RegExp(Qe+"(?="+Qe+")|"+He+Re,"g"),qe=RegExp([De+"?"+xe+"+"+Pe+"(?="+[Be,De,"$"].join("|")+")",Ue+"+"+Te+"(?="+[Be,De+Fe,"$"].join("|")+")",De+"?"+Fe+"+"+Pe,De+"+"+Te,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ce,Oe].join("|"),"g"),Ve=RegExp("[\\u200d\\ud800-\\udfff"+ve+"\\ufe0e\\ufe0f]"),ze=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Je=["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"],Ye=-1,Xe={};Xe[N]=Xe[D]=Xe[F]=Xe[U]=Xe[P]=Xe[T]=Xe[L]=Xe[M]=Xe[R]=!0,Xe[d]=Xe[f]=Xe[k]=Xe[p]=Xe[_]=Xe[g]=Xe[y]=Xe[m]=Xe[w]=Xe[I]=Xe[b]=Xe[E]=Xe[C]=Xe[x]=Xe[Q]=!1;var We={};We[d]=We[f]=We[k]=We[_]=We[p]=We[g]=We[N]=We[D]=We[F]=We[U]=We[P]=We[w]=We[I]=We[b]=We[E]=We[C]=We[x]=We[S]=We[T]=We[L]=We[M]=We[R]=!0,We[y]=We[m]=We[Q]=!1;var Ze={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$e=parseFloat,et=parseInt,tt="object"==typeof Ki&&Ki&&Ki.Object===Object&&Ki,nt="object"==typeof self&&self&&self.Object===Object&&self,rt=tt||nt||Function("return this")(),it=t&&!t.nodeType&&t,ot=it&&e&&!e.nodeType&&e,at=ot&&ot.exports===it,st=at&&tt.process,lt=function(){try{return ot&&ot.require&&ot.require("util").types||st&&st.binding&&st.binding("util")}catch(e){}}(),ut=lt&<.isArrayBuffer,At=lt&<.isDate,ct=lt&<.isMap,ht=lt&<.isRegExp,dt=lt&<.isSet,ft=lt&<.isTypedArray;function pt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function gt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(r,a,n(a),e)}return r}function yt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function mt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function vt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function wt(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function It(e,t){return!(null==e||!e.length)&&Nt(e,t,0)>-1}function bt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function Bt(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Et(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Ct(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function xt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function St(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Qt=Pt("length");function kt(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function _t(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function Nt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):_t(e,Ft,n)}function Dt(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function Ft(e){return e!=e}function Ut(e,t){var n=null==e?0:e.length;return n?Mt(e,t)/n:A}function Pt(e){return function(t){return null==t?n:t[e]}}function Tt(e){return function(t){return null==e?n:e[t]}}function Lt(e,t,n,r,i){return i(e,(function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)})),n}function Mt(e,t){for(var r,i=-1,o=e.length;++i<o;){var a=t(e[i]);a!==n&&(r=r===n?a:r+a)}return r}function Rt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Ot(e){return e?e.slice(0,rn(e)+1).replace(te,""):e}function Ht(e){return function(t){return e(t)}}function Kt(e,t){return Bt(t,(function(t){return e[t]}))}function jt(e,t){return e.has(t)}function Gt(e,t){for(var n=-1,r=e.length;++n<r&&Nt(t,e[n],0)>-1;);return n}function qt(e,t){for(var n=e.length;n--&&Nt(t,e[n],0)>-1;);return n}function Vt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var zt=Tt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Jt=Tt({"&":"&","<":"<",">":">",'"':""","'":"'"});function Yt(e){return"\\"+Ze[e]}function Xt(e){return Ve.test(e)}function Wt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Zt(e,t){return function(n){return e(t(n))}}function $t(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var s=e[n];s!==t&&s!==o||(e[n]=o,a[i++]=n)}return a}function en(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function tn(e){return Xt(e)?function(e){for(var t=Ge.lastIndex=0;Ge.test(e);)++t;return t}(e):Qt(e)}function nn(e){return Xt(e)?function(e){return e.match(Ge)||[]}(e):function(e){return e.split("")}(e)}function rn(e){for(var t=e.length;t--&&ne.test(e.charAt(t)););return t}var on=Tt({"&":"&","<":"<",">":">",""":'"',"'":"'"}),an=function e(t){var ne,ve=(t=null==t?rt:an.defaults(rt.Object(),t,an.pick(rt,Je))).Array,we=t.Date,Ie=t.Error,be=t.Function,Be=t.Math,Ee=t.Object,Ce=t.RegExp,xe=t.String,Se=t.TypeError,Qe=ve.prototype,ke=be.prototype,_e=Ee.prototype,Ne=t["__core-js_shared__"],De=ke.toString,Fe=_e.hasOwnProperty,Ue=0,Pe=(ne=/[^.]+$/.exec(Ne&&Ne.keys&&Ne.keys.IE_PROTO||""))?"Symbol(src)_1."+ne:"",Te=_e.toString,Le=De.call(Ee),Me=rt._,Re=Ce("^"+De.call(Fe).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Oe=at?t.Buffer:n,He=t.Symbol,Ge=t.Uint8Array,Ve=Oe?Oe.allocUnsafe:n,Ze=Zt(Ee.getPrototypeOf,Ee),tt=Ee.create,nt=_e.propertyIsEnumerable,it=Qe.splice,ot=He?He.isConcatSpreadable:n,st=He?He.iterator:n,lt=He?He.toStringTag:n,Qt=function(){try{var e=lo(Ee,"defineProperty");return e({},"",{}),e}catch(e){}}(),Tt=t.clearTimeout!==rt.clearTimeout&&t.clearTimeout,sn=we&&we.now!==rt.Date.now&&we.now,ln=t.setTimeout!==rt.setTimeout&&t.setTimeout,un=Be.ceil,An=Be.floor,cn=Ee.getOwnPropertySymbols,hn=Oe?Oe.isBuffer:n,dn=t.isFinite,fn=Qe.join,pn=Zt(Ee.keys,Ee),gn=Be.max,yn=Be.min,mn=we.now,vn=t.parseInt,wn=Be.random,In=Qe.reverse,bn=lo(t,"DataView"),Bn=lo(t,"Map"),En=lo(t,"Promise"),Cn=lo(t,"Set"),xn=lo(t,"WeakMap"),Sn=lo(Ee,"create"),Qn=xn&&new xn,kn={},_n=To(bn),Nn=To(Bn),Dn=To(En),Fn=To(Cn),Un=To(xn),Pn=He?He.prototype:n,Tn=Pn?Pn.valueOf:n,Ln=Pn?Pn.toString:n;function Mn(e){if($a(e)&&!Ka(e)&&!(e instanceof Kn)){if(e instanceof Hn)return e;if(Fe.call(e,"__wrapped__"))return Lo(e)}return new Hn(e)}var Rn=function(){function e(){}return function(t){if(!Za(t))return{};if(tt)return tt(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function On(){}function Hn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function Kn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=c,this.__views__=[]}function jn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Vn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new qn;++t<n;)this.add(e[t])}function zn(e){var t=this.__data__=new Gn(e);this.size=t.size}function Jn(e,t){var n=Ka(e),r=!n&&Ha(e),i=!n&&!r&&Va(e),o=!n&&!r&&!i&&ss(e),a=n||r||i||o,s=a?Rt(e.length,xe):[],l=s.length;for(var u in e)!t&&!Fe.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||go(u,l))||s.push(u);return s}function Yn(e){var t=e.length;return t?e[qr(0,t-1)]:n}function Xn(e,t){return Fo(xi(e),or(t,0,e.length))}function Wn(e){return Fo(xi(e))}function Zn(e,t,r){(r!==n&&!Ma(e[t],r)||r===n&&!(t in e))&&rr(e,t,r)}function $n(e,t,r){var i=e[t];Fe.call(e,t)&&Ma(i,r)&&(r!==n||t in e)||rr(e,t,r)}function er(e,t){for(var n=e.length;n--;)if(Ma(e[n][0],t))return n;return-1}function tr(e,t,n,r){return Ar(e,(function(e,i,o){t(r,e,n(e),o)})),r}function nr(e,t){return e&&Si(t,ks(t),e)}function rr(e,t,n){"__proto__"==t&&Qt?Qt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ir(e,t){for(var r=-1,i=t.length,o=ve(i),a=null==e;++r<i;)o[r]=a?n:Es(e,t[r]);return o}function or(e,t,r){return e==e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function ar(e,t,r,i,o,a){var s,l=1&t,u=2&t,A=4&t;if(r&&(s=o?r(e,i,o,a):r(e)),s!==n)return s;if(!Za(e))return e;var c=Ka(e);if(c){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Fe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return xi(e,s)}else{var h=co(e),f=h==m||h==v;if(Va(e))return wi(e,l);if(h==b||h==d||f&&!o){if(s=u||f?{}:fo(e),!l)return u?function(e,t){return Si(e,Ao(e),t)}(e,function(e,t){return e&&Si(t,_s(t),e)}(s,e)):function(e,t){return Si(e,uo(e),t)}(e,nr(s,e))}else{if(!We[h])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case k:return Ii(e);case p:case g:return new i(+e);case _:return function(e,t){var n=t?Ii(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case D:case F:case U:case P:case T:case L:case M:case R:return bi(e,n);case w:return new i;case I:case x:return new i(e);case E:return function(e){var t=new e.constructor(e.source,Ae.exec(e));return t.lastIndex=e.lastIndex,t}(e);case C:return new i;case S:return r=e,Tn?Ee(Tn.call(r)):{}}}(e,h,l)}}a||(a=new zn);var y=a.get(e);if(y)return y;a.set(e,s),is(e)?e.forEach((function(n){s.add(ar(n,t,r,n,e,a))})):es(e)&&e.forEach((function(n,i){s.set(i,ar(n,t,r,i,e,a))}));var B=c?n:(A?u?to:eo:u?_s:ks)(e);return yt(B||e,(function(n,i){B&&(n=e[i=n]),$n(s,i,ar(n,t,r,i,e,a))})),s}function sr(e,t,r){var i=r.length;if(null==e)return!i;for(e=Ee(e);i--;){var o=r[i],a=t[o],s=e[o];if(s===n&&!(o in e)||!a(s))return!1}return!0}function lr(e,t,i){if("function"!=typeof e)throw new Se(r);return ko((function(){e.apply(n,i)}),t)}function ur(e,t,n,r){var i=-1,o=It,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=Bt(t,Ht(n))),r?(o=bt,a=!1):t.length>=200&&(o=jt,a=!1,t=new Vn(t));e:for(;++i<s;){var A=e[i],c=null==n?A:n(A);if(A=r||0!==A?A:0,a&&c==c){for(var h=u;h--;)if(t[h]===c)continue e;l.push(A)}else o(t,c,r)||l.push(A)}return l}Mn.templateSettings={escape:z,evaluate:J,interpolate:Y,variable:"",imports:{_:Mn}},Mn.prototype=On.prototype,Mn.prototype.constructor=Mn,Hn.prototype=Rn(On.prototype),Hn.prototype.constructor=Hn,Kn.prototype=Rn(On.prototype),Kn.prototype.constructor=Kn,jn.prototype.clear=function(){this.__data__=Sn?Sn(null):{},this.size=0},jn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},jn.prototype.get=function(e){var t=this.__data__;if(Sn){var r=t[e];return r===i?n:r}return Fe.call(t,e)?t[e]:n},jn.prototype.has=function(e){var t=this.__data__;return Sn?t[e]!==n:Fe.call(t,e)},jn.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Sn&&t===n?i:t,this},Gn.prototype.clear=function(){this.__data__=[],this.size=0},Gn.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():it.call(t,n,1),--this.size,0))},Gn.prototype.get=function(e){var t=this.__data__,r=er(t,e);return r<0?n:t[r][1]},Gn.prototype.has=function(e){return er(this.__data__,e)>-1},Gn.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new jn,map:new(Bn||Gn),string:new jn}},qn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},qn.prototype.get=function(e){return ao(this,e).get(e)},qn.prototype.has=function(e){return ao(this,e).has(e)},qn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Vn.prototype.add=Vn.prototype.push=function(e){return this.__data__.set(e,i),this},Vn.prototype.has=function(e){return this.__data__.has(e)},zn.prototype.clear=function(){this.__data__=new Gn,this.size=0},zn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},zn.prototype.get=function(e){return this.__data__.get(e)},zn.prototype.has=function(e){return this.__data__.has(e)},zn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Gn){var r=n.__data__;if(!Bn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(e,t),this.size=n.size,this};var Ar=_i(mr),cr=_i(vr,!0);function hr(e,t){var n=!0;return Ar(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function dr(e,t,r){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=t(a);if(null!=s&&(l===n?s==s&&!as(s):r(s,l)))var l=s,u=a}return u}function fr(e,t){var n=[];return Ar(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function pr(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=po),i||(i=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?pr(s,t-1,n,r,i):Et(i,s):r||(i[i.length]=s)}return i}var gr=Ni(),yr=Ni(!0);function mr(e,t){return e&&gr(e,t,ks)}function vr(e,t){return e&&yr(e,t,ks)}function wr(e,t){return wt(t,(function(t){return Ya(e[t])}))}function Ir(e,t){for(var r=0,i=(t=gi(t,e)).length;null!=e&&r<i;)e=e[Po(t[r++])];return r&&r==i?e:n}function br(e,t,n){var r=t(e);return Ka(e)?r:Et(r,n(e))}function Br(e){return null==e?e===n?"[object Undefined]":"[object Null]":lt&< in Ee(e)?function(e){var t=Fe.call(e,lt),r=e[lt];try{e[lt]=n;var i=!0}catch(e){}var o=Te.call(e);return i&&(t?e[lt]=r:delete e[lt]),o}(e):function(e){return Te.call(e)}(e)}function Er(e,t){return e>t}function Cr(e,t){return null!=e&&Fe.call(e,t)}function xr(e,t){return null!=e&&t in Ee(e)}function Sr(e,t,r){for(var i=r?bt:It,o=e[0].length,a=e.length,s=a,l=ve(a),u=1/0,A=[];s--;){var c=e[s];s&&t&&(c=Bt(c,Ht(t))),u=yn(c.length,u),l[s]=!r&&(t||o>=120&&c.length>=120)?new Vn(s&&c):n}c=e[0];var h=-1,d=l[0];e:for(;++h<o&&A.length<u;){var f=c[h],p=t?t(f):f;if(f=r||0!==f?f:0,!(d?jt(d,p):i(A,p,r))){for(s=a;--s;){var g=l[s];if(!(g?jt(g,p):i(e[s],p,r)))continue e}d&&d.push(p),A.push(f)}}return A}function Qr(e,t,r){var i=null==(e=Co(e,t=gi(t,e)))?e:e[Po(Jo(t))];return null==i?n:pt(i,e,r)}function kr(e){return $a(e)&&Br(e)==d}function _r(e,t,r,i,o){return e===t||(null==e||null==t||!$a(e)&&!$a(t)?e!=e&&t!=t:function(e,t,r,i,o,a){var s=Ka(e),l=Ka(t),u=s?f:co(e),A=l?f:co(t),c=(u=u==d?b:u)==b,h=(A=A==d?b:A)==b,m=u==A;if(m&&Va(e)){if(!Va(t))return!1;s=!0,c=!1}if(m&&!c)return a||(a=new zn),s||ss(e)?Zi(e,t,r,i,o,a):function(e,t,n,r,i,o,a){switch(n){case _:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case k:return!(e.byteLength!=t.byteLength||!o(new Ge(e),new Ge(t)));case p:case g:case I:return Ma(+e,+t);case y:return e.name==t.name&&e.message==t.message;case E:case x:return e==t+"";case w:var s=Wt;case C:var l=1&r;if(s||(s=en),e.size!=t.size&&!l)return!1;var u=a.get(e);if(u)return u==t;r|=2,a.set(e,t);var A=Zi(s(e),s(t),r,i,o,a);return a.delete(e),A;case S:if(Tn)return Tn.call(e)==Tn.call(t)}return!1}(e,t,u,r,i,o,a);if(!(1&r)){var v=c&&Fe.call(e,"__wrapped__"),B=h&&Fe.call(t,"__wrapped__");if(v||B){var Q=v?e.value():e,N=B?t.value():t;return a||(a=new zn),o(Q,N,r,i,a)}}return!!m&&(a||(a=new zn),function(e,t,r,i,o,a){var s=1&r,l=eo(e),u=l.length;if(u!=eo(t).length&&!s)return!1;for(var A=u;A--;){var c=l[A];if(!(s?c in t:Fe.call(t,c)))return!1}var h=a.get(e),d=a.get(t);if(h&&d)return h==t&&d==e;var f=!0;a.set(e,t),a.set(t,e);for(var p=s;++A<u;){var g=e[c=l[A]],y=t[c];if(i)var m=s?i(y,g,c,t,e,a):i(g,y,c,e,t,a);if(!(m===n?g===y||o(g,y,r,i,a):m)){f=!1;break}p||(p="constructor"==c)}if(f&&!p){var v=e.constructor,w=t.constructor;v==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof w&&w instanceof w||(f=!1)}return a.delete(e),a.delete(t),f}(e,t,r,i,o,a))}(e,t,r,i,_r,o))}function Nr(e,t,r,i){var o=r.length,a=o,s=!i;if(null==e)return!a;for(e=Ee(e);o--;){var l=r[o];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++o<a;){var u=(l=r[o])[0],A=e[u],c=l[1];if(s&&l[2]){if(A===n&&!(u in e))return!1}else{var h=new zn;if(i)var d=i(A,c,u,e,t,h);if(!(d===n?_r(c,A,3,i,h):d))return!1}}return!0}function Dr(e){return!(!Za(e)||(t=e,Pe&&Pe in t))&&(Ya(e)?Re:de).test(To(e));var t}function Fr(e){return"function"==typeof e?e:null==e?tl:"object"==typeof e?Ka(e)?Mr(e[0],e[1]):Lr(e):Al(e)}function Ur(e){if(!Io(e))return pn(e);var t=[];for(var n in Ee(e))Fe.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Pr(e,t){return e<t}function Tr(e,t){var n=-1,r=Ga(e)?ve(e.length):[];return Ar(e,(function(e,i,o){r[++n]=t(e,i,o)})),r}function Lr(e){var t=so(e);return 1==t.length&&t[0][2]?Bo(t[0][0],t[0][1]):function(n){return n===e||Nr(n,e,t)}}function Mr(e,t){return mo(e)&&bo(t)?Bo(Po(e),t):function(r){var i=Es(r,e);return i===n&&i===t?Cs(r,e):_r(t,i,3)}}function Rr(e,t,r,i,o){e!==t&&gr(t,(function(a,s){if(o||(o=new zn),Za(a))!function(e,t,r,i,o,a,s){var l=So(e,r),u=So(t,r),A=s.get(u);if(A)Zn(e,r,A);else{var c=a?a(l,u,r+"",e,t,s):n,h=c===n;if(h){var d=Ka(u),f=!d&&Va(u),p=!d&&!f&&ss(u);c=u,d||f||p?Ka(l)?c=l:qa(l)?c=xi(l):f?(h=!1,c=wi(u,!0)):p?(h=!1,c=bi(u,!0)):c=[]:ns(u)||Ha(u)?(c=l,Ha(l)?c=ps(l):Za(l)&&!Ya(l)||(c=fo(u))):h=!1}h&&(s.set(u,c),o(c,u,i,a,s),s.delete(u)),Zn(e,r,c)}}(e,t,s,r,Rr,i,o);else{var l=i?i(So(e,s),a,s+"",e,t,o):n;l===n&&(l=a),Zn(e,s,l)}}),_s)}function Or(e,t){var r=e.length;if(r)return go(t+=t<0?r:0,r)?e[t]:n}function Hr(e,t,n){t=t.length?Bt(t,(function(e){return Ka(e)?function(t){return Ir(t,1===e.length?e[0]:e)}:e})):[tl];var r=-1;t=Bt(t,Ht(oo()));var i=Tr(e,(function(e,n,i){var o=Bt(t,(function(t){return t(e)}));return{criteria:o,index:++r,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(i,(function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r<a;){var l=Bi(i[r],o[r]);if(l)return r>=s?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Kr(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=Ir(e,a);n(s,a)&&Xr(o,gi(a,e),s)}return o}function jr(e,t,n,r){var i=r?Dt:Nt,o=-1,a=t.length,s=e;for(e===t&&(t=xi(t)),n&&(s=Bt(e,Ht(n)));++o<a;)for(var l=0,u=t[o],A=n?n(u):u;(l=i(s,A,l,r))>-1;)s!==e&&it.call(s,l,1),it.call(e,l,1);return e}function Gr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;go(i)?it.call(e,i,1):li(e,i)}}return e}function qr(e,t){return e+An(wn()*(t-e+1))}function Vr(e,t){var n="";if(!e||t<1||t>u)return n;do{t%2&&(n+=e),(t=An(t/2))&&(e+=e)}while(t);return n}function zr(e,t){return _o(Eo(e,t,tl),e+"")}function Jr(e){return Yn(Ms(e))}function Yr(e,t){var n=Ms(e);return Fo(n,or(t,0,n.length))}function Xr(e,t,r,i){if(!Za(e))return e;for(var o=-1,a=(t=gi(t,e)).length,s=a-1,l=e;null!=l&&++o<a;){var u=Po(t[o]),A=r;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(o!=s){var c=l[u];(A=i?i(c,u,l):n)===n&&(A=Za(c)?c:go(t[o+1])?[]:{})}$n(l,u,A),l=l[u]}return e}var Wr=Qn?function(e,t){return Qn.set(e,t),e}:tl,Zr=Qt?function(e,t){return Qt(e,"toString",{configurable:!0,enumerable:!1,value:Zs(t),writable:!0})}:tl;function $r(e){return Fo(Ms(e))}function ei(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=ve(i);++r<i;)o[r]=e[r+t];return o}function ti(e,t){var n;return Ar(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function ni(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=e[o];null!==a&&!as(a)&&(n?a<=t:a<t)?r=o+1:i=o}return i}return ri(e,t,tl,n)}function ri(e,t,r,i){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=r(t))!=t,l=null===t,u=as(t),A=t===n;o<a;){var c=An((o+a)/2),h=r(e[c]),d=h!==n,f=null===h,p=h==h,g=as(h);if(s)var y=i||p;else y=A?p&&(i||d):l?p&&d&&(i||!f):u?p&&d&&!f&&(i||!g):!f&&!g&&(i?h<=t:h<t);y?o=c+1:a=c}return yn(a,4294967294)}function ii(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!Ma(s,l)){var l=s;o[i++]=0===a?0:a}}return o}function oi(e){return"number"==typeof e?e:as(e)?A:+e}function ai(e){if("string"==typeof e)return e;if(Ka(e))return Bt(e,ai)+"";if(as(e))return Ln?Ln.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function si(e,t,n){var r=-1,i=It,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=bt;else if(o>=200){var u=t?null:Vi(e);if(u)return en(u);a=!1,i=jt,l=new Vn}else l=t?[]:s;e:for(;++r<o;){var A=e[r],c=t?t(A):A;if(A=n||0!==A?A:0,a&&c==c){for(var h=l.length;h--;)if(l[h]===c)continue e;t&&l.push(c),s.push(A)}else i(l,c,n)||(l!==s&&l.push(c),s.push(A))}return s}function li(e,t){return null==(e=Co(e,t=gi(t,e)))||delete e[Po(Jo(t))]}function ui(e,t,n,r){return Xr(e,t,n(Ir(e,t)),r)}function Ai(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?ei(e,r?0:o,r?o+1:i):ei(e,r?o+1:0,r?i:o)}function ci(e,t){var n=e;return n instanceof Kn&&(n=n.value()),Ct(t,(function(e,t){return t.func.apply(t.thisArg,Et([e],t.args))}),n)}function hi(e,t,n){var r=e.length;if(r<2)return r?si(e[0]):[];for(var i=-1,o=ve(r);++i<r;)for(var a=e[i],s=-1;++s<r;)s!=i&&(o[i]=ur(o[i]||a,e[s],t,n));return si(pr(o,1),t,n)}function di(e,t,r){for(var i=-1,o=e.length,a=t.length,s={};++i<o;){var l=i<a?t[i]:n;r(s,e[i],l)}return s}function fi(e){return qa(e)?e:[]}function pi(e){return"function"==typeof e?e:tl}function gi(e,t){return Ka(e)?e:mo(e,t)?[e]:Uo(gs(e))}var yi=zr;function mi(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:ei(e,t,r)}var vi=Tt||function(e){return rt.clearTimeout(e)};function wi(e,t){if(t)return e.slice();var n=e.length,r=Ve?Ve(n):new e.constructor(n);return e.copy(r),r}function Ii(e){var t=new e.constructor(e.byteLength);return new Ge(t).set(new Ge(e)),t}function bi(e,t){var n=t?Ii(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Bi(e,t){if(e!==t){var r=e!==n,i=null===e,o=e==e,a=as(e),s=t!==n,l=null===t,u=t==t,A=as(t);if(!l&&!A&&!a&&e>t||a&&s&&u&&!l&&!A||i&&s&&u||!r&&u||!o)return 1;if(!i&&!a&&!A&&e<t||A&&r&&o&&!i&&!a||l&&r&&o||!s&&o||!u)return-1}return 0}function Ei(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,l=t.length,u=gn(o-a,0),A=ve(l+u),c=!r;++s<l;)A[s]=t[s];for(;++i<a;)(c||i<o)&&(A[n[i]]=e[i]);for(;u--;)A[s++]=e[i++];return A}function Ci(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,l=-1,u=t.length,A=gn(o-s,0),c=ve(A+u),h=!r;++i<A;)c[i]=e[i];for(var d=i;++l<u;)c[d+l]=t[l];for(;++a<s;)(h||i<o)&&(c[d+n[a]]=e[i++]);return c}function xi(e,t){var n=-1,r=e.length;for(t||(t=ve(r));++n<r;)t[n]=e[n];return t}function Si(e,t,r,i){var o=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var l=t[a],u=i?i(r[l],e[l],l,r,e):n;u===n&&(u=e[l]),o?rr(r,l,u):$n(r,l,u)}return r}function Qi(e,t){return function(n,r){var i=Ka(n)?gt:tr,o=t?t():{};return i(n,e,oo(r,2),o)}}function ki(e){return zr((function(t,r){var i=-1,o=r.length,a=o>1?r[o-1]:n,s=o>2?r[2]:n;for(a=e.length>3&&"function"==typeof a?(o--,a):n,s&&yo(r[0],r[1],s)&&(a=o<3?n:a,o=1),t=Ee(t);++i<o;){var l=r[i];l&&e(t,l,i,a)}return t}))}function _i(e,t){return function(n,r){if(null==n)return n;if(!Ga(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Ee(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Ni(e){return function(t,n,r){for(var i=-1,o=Ee(t),a=r(t),s=a.length;s--;){var l=a[e?s:++i];if(!1===n(o[l],l,o))break}return t}}function Di(e){return function(t){var r=Xt(t=gs(t))?nn(t):n,i=r?r[0]:t.charAt(0),o=r?mi(r,1).join(""):t.slice(1);return i[e]()+o}}function Fi(e){return function(t){return Ct(Ys(Hs(t).replace(Ke,"")),e,"")}}function Ui(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Rn(e.prototype),r=e.apply(n,t);return Za(r)?r:n}}function Pi(e){return function(t,r,i){var o=Ee(t);if(!Ga(t)){var a=oo(r,3);t=ks(t),r=function(e){return a(o[e],e,o)}}var s=e(t,r,i);return s>-1?o[a?t[s]:s]:n}}function Ti(e){return $i((function(t){var i=t.length,o=i,a=Hn.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Se(r);if(a&&!l&&"wrapper"==ro(s))var l=new Hn([],!0)}for(o=l?o:i;++o<i;){var u=ro(s=t[o]),A="wrapper"==u?no(s):n;l=A&&vo(A[0])&&424==A[1]&&!A[4].length&&1==A[9]?l[ro(A[0])].apply(l,A[3]):1==s.length&&vo(s)?l[u]():l.thru(s)}return function(){var e=arguments,n=e[0];if(l&&1==e.length&&Ka(n))return l.plant(n).value();for(var r=0,o=i?t[r].apply(this,e):n;++r<i;)o=t[r].call(this,o);return o}}))}function Li(e,t,r,i,o,a,l,u,A,c){var h=t&s,d=1&t,f=2&t,p=24&t,g=512&t,y=f?n:Ui(e);return function n(){for(var s=arguments.length,m=ve(s),v=s;v--;)m[v]=arguments[v];if(p)var w=io(n),I=Vt(m,w);if(i&&(m=Ei(m,i,o,p)),a&&(m=Ci(m,a,l,p)),s-=I,p&&s<c){var b=$t(m,w);return Gi(e,t,Li,n.placeholder,r,m,b,u,A,c-s)}var B=d?r:this,E=f?B[e]:e;return s=m.length,u?m=xo(m,u):g&&s>1&&m.reverse(),h&&A<s&&(m.length=A),this&&this!==rt&&this instanceof n&&(E=y||Ui(E)),E.apply(B,m)}}function Mi(e,t){return function(n,r){return function(e,t,n,r){return mr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function Ri(e,t){return function(r,i){var o;if(r===n&&i===n)return t;if(r!==n&&(o=r),i!==n){if(o===n)return i;"string"==typeof r||"string"==typeof i?(r=ai(r),i=ai(i)):(r=oi(r),i=oi(i)),o=e(r,i)}return o}}function Oi(e){return $i((function(t){return t=Bt(t,Ht(oo())),zr((function(n){var r=this;return e(t,(function(e){return pt(e,r,n)}))}))}))}function Hi(e,t){var r=(t=t===n?" ":ai(t)).length;if(r<2)return r?Vr(t,e):t;var i=Vr(t,un(e/tn(t)));return Xt(t)?mi(nn(i),0,e).join(""):i.slice(0,e)}function Ki(e){return function(t,r,i){return i&&"number"!=typeof i&&yo(t,r,i)&&(r=i=n),t=cs(t),r===n?(r=t,t=0):r=cs(r),function(e,t,n,r){for(var i=-1,o=gn(un((t-e)/(n||1)),0),a=ve(o);o--;)a[r?o:++i]=e,e+=n;return a}(t,r,i=i===n?t<r?1:-1:cs(i),e)}}function ji(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=fs(t),n=fs(n)),e(t,n)}}function Gi(e,t,r,i,o,s,l,u,A,c){var h=8&t;t|=h?a:64,4&(t&=~(h?64:a))||(t&=-4);var d=[e,t,o,h?s:n,h?l:n,h?n:s,h?n:l,u,A,c],f=r.apply(n,d);return vo(e)&&Qo(f,d),f.placeholder=i,No(f,e,t)}function qi(e){var t=Be[e];return function(e,n){if(e=fs(e),(n=null==n?0:yn(hs(n),292))&&dn(e)){var r=(gs(e)+"e").split("e");return+((r=(gs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Vi=Cn&&1/en(new Cn([,-0]))[1]==l?function(e){return new Cn(e)}:al;function zi(e){return function(t){var n=co(t);return n==w?Wt(t):n==C?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return Bt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Ji(e,t,i,l,u,A,c,h){var d=2&t;if(!d&&"function"!=typeof e)throw new Se(r);var f=l?l.length:0;if(f||(t&=-97,l=u=n),c=c===n?c:gn(hs(c),0),h=h===n?h:hs(h),f-=u?u.length:0,64&t){var p=l,g=u;l=u=n}var y=d?n:no(e),m=[e,t,i,l,u,p,g,A,c,h];if(y&&function(e,t){var n=e[1],r=t[1],i=n|r,a=i<131,l=r==s&&8==n||r==s&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!a&&!l)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var A=e[3];e[3]=A?Ei(A,u,t[4]):u,e[4]=A?$t(e[3],o):t[4]}(u=t[5])&&(A=e[5],e[5]=A?Ci(A,u,t[6]):u,e[6]=A?$t(e[5],o):t[6]),(u=t[7])&&(e[7]=u),r&s&&(e[8]=null==e[8]?t[8]:yn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(m,y),e=m[0],t=m[1],i=m[2],l=m[3],u=m[4],!(h=m[9]=m[9]===n?d?0:e.length:gn(m[9]-f,0))&&24&t&&(t&=-25),t&&1!=t)v=8==t||16==t?function(e,t,r){var i=Ui(e);return function o(){for(var a=arguments.length,s=ve(a),l=a,u=io(o);l--;)s[l]=arguments[l];var A=a<3&&s[0]!==u&&s[a-1]!==u?[]:$t(s,u);return(a-=A.length)<r?Gi(e,t,Li,o.placeholder,n,s,A,n,n,r-a):pt(this&&this!==rt&&this instanceof o?i:e,this,s)}}(e,t,h):t!=a&&33!=t||u.length?Li.apply(n,m):function(e,t,n,r){var i=1&t,o=Ui(e);return function t(){for(var a=-1,s=arguments.length,l=-1,u=r.length,A=ve(u+s),c=this&&this!==rt&&this instanceof t?o:e;++l<u;)A[l]=r[l];for(;s--;)A[l++]=arguments[++a];return pt(c,i?n:this,A)}}(e,t,i,l);else var v=function(e,t,n){var r=1&t,i=Ui(e);return function t(){return(this&&this!==rt&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,i);return No((y?Wr:Qo)(v,m),e,t)}function Yi(e,t,r,i){return e===n||Ma(e,_e[r])&&!Fe.call(i,r)?t:e}function Xi(e,t,r,i,o,a){return Za(e)&&Za(t)&&(a.set(t,e),Rr(e,t,n,Xi,a),a.delete(t)),e}function Wi(e){return ns(e)?n:e}function Zi(e,t,r,i,o,a){var s=1&r,l=e.length,u=t.length;if(l!=u&&!(s&&u>l))return!1;var A=a.get(e),c=a.get(t);if(A&&c)return A==t&&c==e;var h=-1,d=!0,f=2&r?new Vn:n;for(a.set(e,t),a.set(t,e);++h<l;){var p=e[h],g=t[h];if(i)var y=s?i(g,p,h,t,e,a):i(p,g,h,e,t,a);if(y!==n){if(y)continue;d=!1;break}if(f){if(!St(t,(function(e,t){if(!jt(f,t)&&(p===e||o(p,e,r,i,a)))return f.push(t)}))){d=!1;break}}else if(p!==g&&!o(p,g,r,i,a)){d=!1;break}}return a.delete(e),a.delete(t),d}function $i(e){return _o(Eo(e,n,jo),e+"")}function eo(e){return br(e,ks,uo)}function to(e){return br(e,_s,Ao)}var no=Qn?function(e){return Qn.get(e)}:al;function ro(e){for(var t=e.name+"",n=kn[t],r=Fe.call(kn,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function io(e){return(Fe.call(Mn,"placeholder")?Mn:e).placeholder}function oo(){var e=Mn.iteratee||nl;return e=e===nl?Fr:e,arguments.length?e(arguments[0],arguments[1]):e}function ao(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function so(e){for(var t=ks(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,bo(i)]}return t}function lo(e,t){var r=function(e,t){return null==e?n:e[t]}(e,t);return Dr(r)?r:n}var uo=cn?function(e){return null==e?[]:(e=Ee(e),wt(cn(e),(function(t){return nt.call(e,t)})))}:dl,Ao=cn?function(e){for(var t=[];e;)Et(t,uo(e)),e=Ze(e);return t}:dl,co=Br;function ho(e,t,n){for(var r=-1,i=(t=gi(t,e)).length,o=!1;++r<i;){var a=Po(t[r]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Wa(i)&&go(a,i)&&(Ka(e)||Ha(e))}function fo(e){return"function"!=typeof e.constructor||Io(e)?{}:Rn(Ze(e))}function po(e){return Ka(e)||Ha(e)||!!(ot&&e&&e[ot])}function go(e,t){var n=typeof e;return!!(t=null==t?u:t)&&("number"==n||"symbol"!=n&&pe.test(e))&&e>-1&&e%1==0&&e<t}function yo(e,t,n){if(!Za(n))return!1;var r=typeof t;return!!("number"==r?Ga(n)&&go(t,n.length):"string"==r&&t in n)&&Ma(n[t],e)}function mo(e,t){if(Ka(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!as(e))||W.test(e)||!X.test(e)||null!=t&&e in Ee(t)}function vo(e){var t=ro(e),n=Mn[t];if("function"!=typeof n||!(t in Kn.prototype))return!1;if(e===n)return!0;var r=no(n);return!!r&&e===r[0]}(bn&&co(new bn(new ArrayBuffer(1)))!=_||Bn&&co(new Bn)!=w||En&&co(En.resolve())!=B||Cn&&co(new Cn)!=C||xn&&co(new xn)!=Q)&&(co=function(e){var t=Br(e),r=t==b?e.constructor:n,i=r?To(r):"";if(i)switch(i){case _n:return _;case Nn:return w;case Dn:return B;case Fn:return C;case Un:return Q}return t});var wo=Ne?Ya:fl;function Io(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function bo(e){return e==e&&!Za(e)}function Bo(e,t){return function(r){return null!=r&&r[e]===t&&(t!==n||e in Ee(r))}}function Eo(e,t,r){return t=gn(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=gn(n.length-t,0),a=ve(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=ve(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),pt(e,this,s)}}function Co(e,t){return t.length<2?e:Ir(e,ei(t,0,-1))}function xo(e,t){for(var r=e.length,i=yn(t.length,r),o=xi(e);i--;){var a=t[i];e[i]=go(a,r)?o[a]:n}return e}function So(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Qo=Do(Wr),ko=ln||function(e,t){return rt.setTimeout(e,t)},_o=Do(Zr);function No(e,t,n){var r=t+"";return _o(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(re,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return yt(h,(function(n){var r="_."+n[0];t&n[1]&&!It(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ie);return t?t[1].split(oe):[]}(r),n)))}function Do(e){var t=0,r=0;return function(){var i=mn(),o=16-(i-r);if(r=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Fo(e,t){var r=-1,i=e.length,o=i-1;for(t=t===n?i:t;++r<t;){var a=qr(r,o),s=e[a];e[a]=e[r],e[r]=s}return e.length=t,e}var Uo=function(e){var t=Da((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Z,(function(e,n,r,i){t.push(r?i.replace(le,"$1"):n||e)})),t}),(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}();function Po(e){if("string"==typeof e||as(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function To(e){if(null!=e){try{return De.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Lo(e){if(e instanceof Kn)return e.clone();var t=new Hn(e.__wrapped__,e.__chain__);return t.__actions__=xi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Mo=zr((function(e,t){return qa(e)?ur(e,pr(t,1,qa,!0)):[]})),Ro=zr((function(e,t){var r=Jo(t);return qa(r)&&(r=n),qa(e)?ur(e,pr(t,1,qa,!0),oo(r,2)):[]})),Oo=zr((function(e,t){var r=Jo(t);return qa(r)&&(r=n),qa(e)?ur(e,pr(t,1,qa,!0),n,r):[]}));function Ho(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=gn(r+i,0)),_t(e,oo(t,3),i)}function Ko(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return r!==n&&(o=hs(r),o=r<0?gn(i+o,0):yn(o,i-1)),_t(e,oo(t,3),o,!0)}function jo(e){return null!=e&&e.length?pr(e,1):[]}function Go(e){return e&&e.length?e[0]:n}var qo=zr((function(e){var t=Bt(e,fi);return t.length&&t[0]===e[0]?Sr(t):[]})),Vo=zr((function(e){var t=Jo(e),r=Bt(e,fi);return t===Jo(r)?t=n:r.pop(),r.length&&r[0]===e[0]?Sr(r,oo(t,2)):[]})),zo=zr((function(e){var t=Jo(e),r=Bt(e,fi);return(t="function"==typeof t?t:n)&&r.pop(),r.length&&r[0]===e[0]?Sr(r,n,t):[]}));function Jo(e){var t=null==e?0:e.length;return t?e[t-1]:n}var Yo=zr(Xo);function Xo(e,t){return e&&e.length&&t&&t.length?jr(e,t):e}var Wo=$i((function(e,t){var n=null==e?0:e.length,r=ir(e,t);return Gr(e,Bt(t,(function(e){return go(e,n)?+e:e})).sort(Bi)),r}));function Zo(e){return null==e?e:In.call(e)}var $o=zr((function(e){return si(pr(e,1,qa,!0))})),ea=zr((function(e){var t=Jo(e);return qa(t)&&(t=n),si(pr(e,1,qa,!0),oo(t,2))})),ta=zr((function(e){var t=Jo(e);return t="function"==typeof t?t:n,si(pr(e,1,qa,!0),n,t)}));function na(e){if(!e||!e.length)return[];var t=0;return e=wt(e,(function(e){if(qa(e))return t=gn(e.length,t),!0})),Rt(t,(function(t){return Bt(e,Pt(t))}))}function ra(e,t){if(!e||!e.length)return[];var r=na(e);return null==t?r:Bt(r,(function(e){return pt(t,n,e)}))}var ia=zr((function(e,t){return qa(e)?ur(e,t):[]})),oa=zr((function(e){return hi(wt(e,qa))})),aa=zr((function(e){var t=Jo(e);return qa(t)&&(t=n),hi(wt(e,qa),oo(t,2))})),sa=zr((function(e){var t=Jo(e);return t="function"==typeof t?t:n,hi(wt(e,qa),n,t)})),la=zr(na),ua=zr((function(e){var t=e.length,r=t>1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,ra(e,r)}));function Aa(e){var t=Mn(e);return t.__chain__=!0,t}function ca(e,t){return t(e)}var ha=$i((function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Kn&&go(r)?((i=i.slice(r,+r+(t?1:0))).__actions__.push({func:ca,args:[o],thisArg:n}),new Hn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(n),e}))):this.thru(o)})),da=Qi((function(e,t,n){Fe.call(e,n)?++e[n]:rr(e,n,1)})),fa=Pi(Ho),pa=Pi(Ko);function ga(e,t){return(Ka(e)?yt:Ar)(e,oo(t,3))}function ya(e,t){return(Ka(e)?mt:cr)(e,oo(t,3))}var ma=Qi((function(e,t,n){Fe.call(e,n)?e[n].push(t):rr(e,n,[t])})),va=zr((function(e,t,n){var r=-1,i="function"==typeof t,o=Ga(e)?ve(e.length):[];return Ar(e,(function(e){o[++r]=i?pt(t,e,n):Qr(e,t,n)})),o})),wa=Qi((function(e,t,n){rr(e,n,t)}));function Ia(e,t){return(Ka(e)?Bt:Tr)(e,oo(t,3))}var ba=Qi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Ba=zr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Hr(e,pr(t,1),[])})),Ea=sn||function(){return rt.Date.now()};function Ca(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,Ji(e,s,n,n,n,n,t)}function xa(e,t){var i;if("function"!=typeof t)throw new Se(r);return e=hs(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=n),i}}var Sa=zr((function(e,t,n){var r=1;if(n.length){var i=$t(n,io(Sa));r|=a}return Ji(e,r,t,n,i)})),Qa=zr((function(e,t,n){var r=3;if(n.length){var i=$t(n,io(Qa));r|=a}return Ji(t,r,e,n,i)}));function ka(e,t,i){var o,a,s,l,u,A,c=0,h=!1,d=!1,f=!0;if("function"!=typeof e)throw new Se(r);function p(t){var r=o,i=a;return o=a=n,c=t,l=e.apply(i,r)}function g(e){return c=e,u=ko(m,t),h?p(e):l}function y(e){var r=e-A;return A===n||r>=t||r<0||d&&e-c>=s}function m(){var e=Ea();if(y(e))return v(e);u=ko(m,function(e){var n=t-(e-A);return d?yn(n,s-(e-c)):n}(e))}function v(e){return u=n,f&&o?p(e):(o=a=n,l)}function w(){var e=Ea(),r=y(e);if(o=arguments,a=this,A=e,r){if(u===n)return g(A);if(d)return vi(u),u=ko(m,t),p(A)}return u===n&&(u=ko(m,t)),l}return t=fs(t)||0,Za(i)&&(h=!!i.leading,s=(d="maxWait"in i)?gn(fs(i.maxWait)||0,t):s,f="trailing"in i?!!i.trailing:f),w.cancel=function(){u!==n&&vi(u),c=0,o=A=a=u=n},w.flush=function(){return u===n?l:v(Ea())},w}var _a=zr((function(e,t){return lr(e,1,t)})),Na=zr((function(e,t,n){return lr(e,fs(t)||0,n)}));function Da(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Se(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Da.Cache||qn),n}function Fa(e){if("function"!=typeof e)throw new Se(r);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Da.Cache=qn;var Ua=yi((function(e,t){var n=(t=1==t.length&&Ka(t[0])?Bt(t[0],Ht(oo())):Bt(pr(t,1),Ht(oo()))).length;return zr((function(r){for(var i=-1,o=yn(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return pt(e,this,r)}))})),Pa=zr((function(e,t){var r=$t(t,io(Pa));return Ji(e,a,n,t,r)})),Ta=zr((function(e,t){var r=$t(t,io(Ta));return Ji(e,64,n,t,r)})),La=$i((function(e,t){return Ji(e,256,n,n,n,t)}));function Ma(e,t){return e===t||e!=e&&t!=t}var Ra=ji(Er),Oa=ji((function(e,t){return e>=t})),Ha=kr(function(){return arguments}())?kr:function(e){return $a(e)&&Fe.call(e,"callee")&&!nt.call(e,"callee")},Ka=ve.isArray,ja=ut?Ht(ut):function(e){return $a(e)&&Br(e)==k};function Ga(e){return null!=e&&Wa(e.length)&&!Ya(e)}function qa(e){return $a(e)&&Ga(e)}var Va=hn||fl,za=At?Ht(At):function(e){return $a(e)&&Br(e)==g};function Ja(e){if(!$a(e))return!1;var t=Br(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ns(e)}function Ya(e){if(!Za(e))return!1;var t=Br(e);return t==m||t==v||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xa(e){return"number"==typeof e&&e==hs(e)}function Wa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function Za(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function $a(e){return null!=e&&"object"==typeof e}var es=ct?Ht(ct):function(e){return $a(e)&&co(e)==w};function ts(e){return"number"==typeof e||$a(e)&&Br(e)==I}function ns(e){if(!$a(e)||Br(e)!=b)return!1;var t=Ze(e);if(null===t)return!0;var n=Fe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&De.call(n)==Le}var rs=ht?Ht(ht):function(e){return $a(e)&&Br(e)==E},is=dt?Ht(dt):function(e){return $a(e)&&co(e)==C};function os(e){return"string"==typeof e||!Ka(e)&&$a(e)&&Br(e)==x}function as(e){return"symbol"==typeof e||$a(e)&&Br(e)==S}var ss=ft?Ht(ft):function(e){return $a(e)&&Wa(e.length)&&!!Xe[Br(e)]},ls=ji(Pr),us=ji((function(e,t){return e<=t}));function As(e){if(!e)return[];if(Ga(e))return os(e)?nn(e):xi(e);if(st&&e[st])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[st]());var t=co(e);return(t==w?Wt:t==C?en:Ms)(e)}function cs(e){return e?(e=fs(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hs(e){var t=cs(e),n=t%1;return t==t?n?t-n:t:0}function ds(e){return e?or(hs(e),0,c):0}function fs(e){if("number"==typeof e)return e;if(as(e))return A;if(Za(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Za(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ot(e);var n=he.test(e);return n||fe.test(e)?et(e.slice(2),n?2:8):ce.test(e)?A:+e}function ps(e){return Si(e,_s(e))}function gs(e){return null==e?"":ai(e)}var ys=ki((function(e,t){if(Io(t)||Ga(t))Si(t,ks(t),e);else for(var n in t)Fe.call(t,n)&&$n(e,n,t[n])})),ms=ki((function(e,t){Si(t,_s(t),e)})),vs=ki((function(e,t,n,r){Si(t,_s(t),e,r)})),ws=ki((function(e,t,n,r){Si(t,ks(t),e,r)})),Is=$i(ir),bs=zr((function(e,t){e=Ee(e);var r=-1,i=t.length,o=i>2?t[2]:n;for(o&&yo(t[0],t[1],o)&&(i=1);++r<i;)for(var a=t[r],s=_s(a),l=-1,u=s.length;++l<u;){var A=s[l],c=e[A];(c===n||Ma(c,_e[A])&&!Fe.call(e,A))&&(e[A]=a[A])}return e})),Bs=zr((function(e){return e.push(n,Xi),pt(Ds,n,e)}));function Es(e,t,r){var i=null==e?n:Ir(e,t);return i===n?r:i}function Cs(e,t){return null!=e&&ho(e,t,xr)}var xs=Mi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),e[t]=n}),Zs(tl)),Ss=Mi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),Fe.call(e,t)?e[t].push(n):e[t]=[n]}),oo),Qs=zr(Qr);function ks(e){return Ga(e)?Jn(e):Ur(e)}function _s(e){return Ga(e)?Jn(e,!0):function(e){if(!Za(e))return function(e){var t=[];if(null!=e)for(var n in Ee(e))t.push(n);return t}(e);var t=Io(e),n=[];for(var r in e)("constructor"!=r||!t&&Fe.call(e,r))&&n.push(r);return n}(e)}var Ns=ki((function(e,t,n){Rr(e,t,n)})),Ds=ki((function(e,t,n,r){Rr(e,t,n,r)})),Fs=$i((function(e,t){var n={};if(null==e)return n;var r=!1;t=Bt(t,(function(t){return t=gi(t,e),r||(r=t.length>1),t})),Si(e,to(e),n),r&&(n=ar(n,7,Wi));for(var i=t.length;i--;)li(n,t[i]);return n})),Us=$i((function(e,t){return null==e?{}:function(e,t){return Kr(e,t,(function(t,n){return Cs(e,n)}))}(e,t)}));function Ps(e,t){if(null==e)return{};var n=Bt(to(e),(function(e){return[e]}));return t=oo(t),Kr(e,n,(function(e,n){return t(e,n[0])}))}var Ts=zi(ks),Ls=zi(_s);function Ms(e){return null==e?[]:Kt(e,ks(e))}var Rs=Fi((function(e,t,n){return t=t.toLowerCase(),e+(n?Os(t):t)}));function Os(e){return Js(gs(e).toLowerCase())}function Hs(e){return(e=gs(e))&&e.replace(ge,zt).replace(je,"")}var Ks=Fi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),js=Fi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Gs=Di("toLowerCase"),qs=Fi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Vs=Fi((function(e,t,n){return e+(n?" ":"")+Js(t)})),zs=Fi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Js=Di("toUpperCase");function Ys(e,t,r){return e=gs(e),(t=r?n:t)===n?function(e){return ze.test(e)}(e)?function(e){return e.match(qe)||[]}(e):function(e){return e.match(ae)||[]}(e):e.match(t)||[]}var Xs=zr((function(e,t){try{return pt(e,n,t)}catch(e){return Ja(e)?e:new Ie(e)}})),Ws=$i((function(e,t){return yt(t,(function(t){t=Po(t),rr(e,t,Sa(e[t],e))})),e}));function Zs(e){return function(){return e}}var $s=Ti(),el=Ti(!0);function tl(e){return e}function nl(e){return Fr("function"==typeof e?e:ar(e,1))}var rl=zr((function(e,t){return function(n){return Qr(n,e,t)}})),il=zr((function(e,t){return function(n){return Qr(e,n,t)}}));function ol(e,t,n){var r=ks(t),i=wr(t,r);null!=n||Za(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=wr(t,ks(t)));var o=!(Za(n)&&"chain"in n&&!n.chain),a=Ya(e);return yt(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=xi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Et([this.value()],arguments))})})),e}function al(){}var sl=Oi(Bt),ll=Oi(vt),ul=Oi(St);function Al(e){return mo(e)?Pt(Po(e)):function(e){return function(t){return Ir(t,e)}}(e)}var cl=Ki(),hl=Ki(!0);function dl(){return[]}function fl(){return!1}var pl,gl=Ri((function(e,t){return e+t}),0),yl=qi("ceil"),ml=Ri((function(e,t){return e/t}),1),vl=qi("floor"),wl=Ri((function(e,t){return e*t}),1),Il=qi("round"),bl=Ri((function(e,t){return e-t}),0);return Mn.after=function(e,t){if("function"!=typeof t)throw new Se(r);return e=hs(e),function(){if(--e<1)return t.apply(this,arguments)}},Mn.ary=Ca,Mn.assign=ys,Mn.assignIn=ms,Mn.assignInWith=vs,Mn.assignWith=ws,Mn.at=Is,Mn.before=xa,Mn.bind=Sa,Mn.bindAll=Ws,Mn.bindKey=Qa,Mn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ka(e)?e:[e]},Mn.chain=Aa,Mn.chunk=function(e,t,r){t=(r?yo(e,t,r):t===n)?1:gn(hs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=ve(un(i/t));o<i;)s[a++]=ei(e,o,o+=t);return s},Mn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i},Mn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=ve(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Et(Ka(n)?xi(n):[n],pr(t,1))},Mn.cond=function(e){var t=null==e?0:e.length,n=oo();return e=t?Bt(e,(function(e){if("function"!=typeof e[1])throw new Se(r);return[n(e[0]),e[1]]})):[],zr((function(n){for(var r=-1;++r<t;){var i=e[r];if(pt(i[0],this,n))return pt(i[1],this,n)}}))},Mn.conforms=function(e){return function(e){var t=ks(e);return function(n){return sr(n,e,t)}}(ar(e,1))},Mn.constant=Zs,Mn.countBy=da,Mn.create=function(e,t){var n=Rn(e);return null==t?n:nr(n,t)},Mn.curry=function e(t,r,i){var o=Ji(t,8,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},Mn.curryRight=function e(t,r,i){var o=Ji(t,16,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},Mn.debounce=ka,Mn.defaults=bs,Mn.defaultsDeep=Bs,Mn.defer=_a,Mn.delay=Na,Mn.difference=Mo,Mn.differenceBy=Ro,Mn.differenceWith=Oo,Mn.drop=function(e,t,r){var i=null==e?0:e.length;return i?ei(e,(t=r||t===n?1:hs(t))<0?0:t,i):[]},Mn.dropRight=function(e,t,r){var i=null==e?0:e.length;return i?ei(e,0,(t=i-(t=r||t===n?1:hs(t)))<0?0:t):[]},Mn.dropRightWhile=function(e,t){return e&&e.length?Ai(e,oo(t,3),!0,!0):[]},Mn.dropWhile=function(e,t){return e&&e.length?Ai(e,oo(t,3),!0):[]},Mn.fill=function(e,t,r,i){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&yo(e,t,r)&&(r=0,i=o),function(e,t,r,i){var o=e.length;for((r=hs(r))<0&&(r=-r>o?0:o+r),(i=i===n||i>o?o:hs(i))<0&&(i+=o),i=r>i?0:ds(i);r<i;)e[r++]=t;return e}(e,t,r,i)):[]},Mn.filter=function(e,t){return(Ka(e)?wt:fr)(e,oo(t,3))},Mn.flatMap=function(e,t){return pr(Ia(e,t),1)},Mn.flatMapDeep=function(e,t){return pr(Ia(e,t),l)},Mn.flatMapDepth=function(e,t,r){return r=r===n?1:hs(r),pr(Ia(e,t),r)},Mn.flatten=jo,Mn.flattenDeep=function(e){return null!=e&&e.length?pr(e,l):[]},Mn.flattenDepth=function(e,t){return null!=e&&e.length?pr(e,t=t===n?1:hs(t)):[]},Mn.flip=function(e){return Ji(e,512)},Mn.flow=$s,Mn.flowRight=el,Mn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Mn.functions=function(e){return null==e?[]:wr(e,ks(e))},Mn.functionsIn=function(e){return null==e?[]:wr(e,_s(e))},Mn.groupBy=ma,Mn.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Mn.intersection=qo,Mn.intersectionBy=Vo,Mn.intersectionWith=zo,Mn.invert=xs,Mn.invertBy=Ss,Mn.invokeMap=va,Mn.iteratee=nl,Mn.keyBy=wa,Mn.keys=ks,Mn.keysIn=_s,Mn.map=Ia,Mn.mapKeys=function(e,t){var n={};return t=oo(t,3),mr(e,(function(e,r,i){rr(n,t(e,r,i),e)})),n},Mn.mapValues=function(e,t){var n={};return t=oo(t,3),mr(e,(function(e,r,i){rr(n,r,t(e,r,i))})),n},Mn.matches=function(e){return Lr(ar(e,1))},Mn.matchesProperty=function(e,t){return Mr(e,ar(t,1))},Mn.memoize=Da,Mn.merge=Ns,Mn.mergeWith=Ds,Mn.method=rl,Mn.methodOf=il,Mn.mixin=ol,Mn.negate=Fa,Mn.nthArg=function(e){return e=hs(e),zr((function(t){return Or(t,e)}))},Mn.omit=Fs,Mn.omitBy=function(e,t){return Ps(e,Fa(oo(t)))},Mn.once=function(e){return xa(2,e)},Mn.orderBy=function(e,t,r,i){return null==e?[]:(Ka(t)||(t=null==t?[]:[t]),Ka(r=i?n:r)||(r=null==r?[]:[r]),Hr(e,t,r))},Mn.over=sl,Mn.overArgs=Ua,Mn.overEvery=ll,Mn.overSome=ul,Mn.partial=Pa,Mn.partialRight=Ta,Mn.partition=ba,Mn.pick=Us,Mn.pickBy=Ps,Mn.property=Al,Mn.propertyOf=function(e){return function(t){return null==e?n:Ir(e,t)}},Mn.pull=Yo,Mn.pullAll=Xo,Mn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?jr(e,t,oo(n,2)):e},Mn.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?jr(e,t,n,r):e},Mn.pullAt=Wo,Mn.range=cl,Mn.rangeRight=hl,Mn.rearg=La,Mn.reject=function(e,t){return(Ka(e)?wt:fr)(e,Fa(oo(t,3)))},Mn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=oo(t,3);++r<o;){var a=e[r];t(a,r,e)&&(n.push(a),i.push(r))}return Gr(e,i),n},Mn.rest=function(e,t){if("function"!=typeof e)throw new Se(r);return zr(e,t=t===n?t:hs(t))},Mn.reverse=Zo,Mn.sampleSize=function(e,t,r){return t=(r?yo(e,t,r):t===n)?1:hs(t),(Ka(e)?Xn:Yr)(e,t)},Mn.set=function(e,t,n){return null==e?e:Xr(e,t,n)},Mn.setWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Xr(e,t,r,i)},Mn.shuffle=function(e){return(Ka(e)?Wn:$r)(e)},Mn.slice=function(e,t,r){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&yo(e,t,r)?(t=0,r=i):(t=null==t?0:hs(t),r=r===n?i:hs(r)),ei(e,t,r)):[]},Mn.sortBy=Ba,Mn.sortedUniq=function(e){return e&&e.length?ii(e):[]},Mn.sortedUniqBy=function(e,t){return e&&e.length?ii(e,oo(t,2)):[]},Mn.split=function(e,t,r){return r&&"number"!=typeof r&&yo(e,t,r)&&(t=r=n),(r=r===n?c:r>>>0)?(e=gs(e))&&("string"==typeof t||null!=t&&!rs(t))&&!(t=ai(t))&&Xt(e)?mi(nn(e),0,r):e.split(t,r):[]},Mn.spread=function(e,t){if("function"!=typeof e)throw new Se(r);return t=null==t?0:gn(hs(t),0),zr((function(n){var r=n[t],i=mi(n,0,t);return r&&Et(i,r),pt(e,this,i)}))},Mn.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Mn.take=function(e,t,r){return e&&e.length?ei(e,0,(t=r||t===n?1:hs(t))<0?0:t):[]},Mn.takeRight=function(e,t,r){var i=null==e?0:e.length;return i?ei(e,(t=i-(t=r||t===n?1:hs(t)))<0?0:t,i):[]},Mn.takeRightWhile=function(e,t){return e&&e.length?Ai(e,oo(t,3),!1,!0):[]},Mn.takeWhile=function(e,t){return e&&e.length?Ai(e,oo(t,3)):[]},Mn.tap=function(e,t){return t(e),e},Mn.throttle=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new Se(r);return Za(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),ka(e,t,{leading:i,maxWait:t,trailing:o})},Mn.thru=ca,Mn.toArray=As,Mn.toPairs=Ts,Mn.toPairsIn=Ls,Mn.toPath=function(e){return Ka(e)?Bt(e,Po):as(e)?[e]:xi(Uo(gs(e)))},Mn.toPlainObject=ps,Mn.transform=function(e,t,n){var r=Ka(e),i=r||Va(e)||ss(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Za(e)&&Ya(o)?Rn(Ze(e)):{}}return(i?yt:mr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Mn.unary=function(e){return Ca(e,1)},Mn.union=$o,Mn.unionBy=ea,Mn.unionWith=ta,Mn.uniq=function(e){return e&&e.length?si(e):[]},Mn.uniqBy=function(e,t){return e&&e.length?si(e,oo(t,2)):[]},Mn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?si(e,n,t):[]},Mn.unset=function(e,t){return null==e||li(e,t)},Mn.unzip=na,Mn.unzipWith=ra,Mn.update=function(e,t,n){return null==e?e:ui(e,t,pi(n))},Mn.updateWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:ui(e,t,pi(r),i)},Mn.values=Ms,Mn.valuesIn=function(e){return null==e?[]:Kt(e,_s(e))},Mn.without=ia,Mn.words=Ys,Mn.wrap=function(e,t){return Pa(pi(t),e)},Mn.xor=oa,Mn.xorBy=aa,Mn.xorWith=sa,Mn.zip=la,Mn.zipObject=function(e,t){return di(e||[],t||[],$n)},Mn.zipObjectDeep=function(e,t){return di(e||[],t||[],Xr)},Mn.zipWith=ua,Mn.entries=Ts,Mn.entriesIn=Ls,Mn.extend=ms,Mn.extendWith=vs,ol(Mn,Mn),Mn.add=gl,Mn.attempt=Xs,Mn.camelCase=Rs,Mn.capitalize=Os,Mn.ceil=yl,Mn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=fs(r))==r?r:0),t!==n&&(t=(t=fs(t))==t?t:0),or(fs(e),t,r)},Mn.clone=function(e){return ar(e,4)},Mn.cloneDeep=function(e){return ar(e,5)},Mn.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:n)},Mn.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:n)},Mn.conformsTo=function(e,t){return null==t||sr(e,t,ks(t))},Mn.deburr=Hs,Mn.defaultTo=function(e,t){return null==e||e!=e?t:e},Mn.divide=ml,Mn.endsWith=function(e,t,r){e=gs(e),t=ai(t);var i=e.length,o=r=r===n?i:or(hs(r),0,i);return(r-=t.length)>=0&&e.slice(r,o)==t},Mn.eq=Ma,Mn.escape=function(e){return(e=gs(e))&&V.test(e)?e.replace(G,Jt):e},Mn.escapeRegExp=function(e){return(e=gs(e))&&ee.test(e)?e.replace($,"\\$&"):e},Mn.every=function(e,t,r){var i=Ka(e)?vt:hr;return r&&yo(e,t,r)&&(t=n),i(e,oo(t,3))},Mn.find=fa,Mn.findIndex=Ho,Mn.findKey=function(e,t){return kt(e,oo(t,3),mr)},Mn.findLast=pa,Mn.findLastIndex=Ko,Mn.findLastKey=function(e,t){return kt(e,oo(t,3),vr)},Mn.floor=vl,Mn.forEach=ga,Mn.forEachRight=ya,Mn.forIn=function(e,t){return null==e?e:gr(e,oo(t,3),_s)},Mn.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),_s)},Mn.forOwn=function(e,t){return e&&mr(e,oo(t,3))},Mn.forOwnRight=function(e,t){return e&&vr(e,oo(t,3))},Mn.get=Es,Mn.gt=Ra,Mn.gte=Oa,Mn.has=function(e,t){return null!=e&&ho(e,t,Cr)},Mn.hasIn=Cs,Mn.head=Go,Mn.identity=tl,Mn.includes=function(e,t,n,r){e=Ga(e)?e:Ms(e),n=n&&!r?hs(n):0;var i=e.length;return n<0&&(n=gn(i+n,0)),os(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Nt(e,t,n)>-1},Mn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=gn(r+i,0)),Nt(e,t,i)},Mn.inRange=function(e,t,r){return t=cs(t),r===n?(r=t,t=0):r=cs(r),function(e,t,n){return e>=yn(t,n)&&e<gn(t,n)}(e=fs(e),t,r)},Mn.invoke=Qs,Mn.isArguments=Ha,Mn.isArray=Ka,Mn.isArrayBuffer=ja,Mn.isArrayLike=Ga,Mn.isArrayLikeObject=qa,Mn.isBoolean=function(e){return!0===e||!1===e||$a(e)&&Br(e)==p},Mn.isBuffer=Va,Mn.isDate=za,Mn.isElement=function(e){return $a(e)&&1===e.nodeType&&!ns(e)},Mn.isEmpty=function(e){if(null==e)return!0;if(Ga(e)&&(Ka(e)||"string"==typeof e||"function"==typeof e.splice||Va(e)||ss(e)||Ha(e)))return!e.length;var t=co(e);if(t==w||t==C)return!e.size;if(Io(e))return!Ur(e).length;for(var n in e)if(Fe.call(e,n))return!1;return!0},Mn.isEqual=function(e,t){return _r(e,t)},Mn.isEqualWith=function(e,t,r){var i=(r="function"==typeof r?r:n)?r(e,t):n;return i===n?_r(e,t,n,r):!!i},Mn.isError=Ja,Mn.isFinite=function(e){return"number"==typeof e&&dn(e)},Mn.isFunction=Ya,Mn.isInteger=Xa,Mn.isLength=Wa,Mn.isMap=es,Mn.isMatch=function(e,t){return e===t||Nr(e,t,so(t))},Mn.isMatchWith=function(e,t,r){return r="function"==typeof r?r:n,Nr(e,t,so(t),r)},Mn.isNaN=function(e){return ts(e)&&e!=+e},Mn.isNative=function(e){if(wo(e))throw new Ie("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Dr(e)},Mn.isNil=function(e){return null==e},Mn.isNull=function(e){return null===e},Mn.isNumber=ts,Mn.isObject=Za,Mn.isObjectLike=$a,Mn.isPlainObject=ns,Mn.isRegExp=rs,Mn.isSafeInteger=function(e){return Xa(e)&&e>=-9007199254740991&&e<=u},Mn.isSet=is,Mn.isString=os,Mn.isSymbol=as,Mn.isTypedArray=ss,Mn.isUndefined=function(e){return e===n},Mn.isWeakMap=function(e){return $a(e)&&co(e)==Q},Mn.isWeakSet=function(e){return $a(e)&&"[object WeakSet]"==Br(e)},Mn.join=function(e,t){return null==e?"":fn.call(e,t)},Mn.kebabCase=Ks,Mn.last=Jo,Mn.lastIndexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i;return r!==n&&(o=(o=hs(r))<0?gn(i+o,0):yn(o,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):_t(e,Ft,o,!0)},Mn.lowerCase=js,Mn.lowerFirst=Gs,Mn.lt=ls,Mn.lte=us,Mn.max=function(e){return e&&e.length?dr(e,tl,Er):n},Mn.maxBy=function(e,t){return e&&e.length?dr(e,oo(t,2),Er):n},Mn.mean=function(e){return Ut(e,tl)},Mn.meanBy=function(e,t){return Ut(e,oo(t,2))},Mn.min=function(e){return e&&e.length?dr(e,tl,Pr):n},Mn.minBy=function(e,t){return e&&e.length?dr(e,oo(t,2),Pr):n},Mn.stubArray=dl,Mn.stubFalse=fl,Mn.stubObject=function(){return{}},Mn.stubString=function(){return""},Mn.stubTrue=function(){return!0},Mn.multiply=wl,Mn.nth=function(e,t){return e&&e.length?Or(e,hs(t)):n},Mn.noConflict=function(){return rt._===this&&(rt._=Me),this},Mn.noop=al,Mn.now=Ea,Mn.pad=function(e,t,n){e=gs(e);var r=(t=hs(t))?tn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Hi(An(i),n)+e+Hi(un(i),n)},Mn.padEnd=function(e,t,n){e=gs(e);var r=(t=hs(t))?tn(e):0;return t&&r<t?e+Hi(t-r,n):e},Mn.padStart=function(e,t,n){e=gs(e);var r=(t=hs(t))?tn(e):0;return t&&r<t?Hi(t-r,n)+e:e},Mn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),vn(gs(e).replace(te,""),t||0)},Mn.random=function(e,t,r){if(r&&"boolean"!=typeof r&&yo(e,t,r)&&(t=r=n),r===n&&("boolean"==typeof t?(r=t,t=n):"boolean"==typeof e&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=cs(e),t===n?(t=e,e=0):t=cs(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var o=wn();return yn(e+o*(t-e+$e("1e-"+((o+"").length-1))),t)}return qr(e,t)},Mn.reduce=function(e,t,n){var r=Ka(e)?Ct:Lt,i=arguments.length<3;return r(e,oo(t,4),n,i,Ar)},Mn.reduceRight=function(e,t,n){var r=Ka(e)?xt:Lt,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Mn.repeat=function(e,t,r){return t=(r?yo(e,t,r):t===n)?1:hs(t),Vr(gs(e),t)},Mn.replace=function(){var e=arguments,t=gs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Mn.result=function(e,t,r){var i=-1,o=(t=gi(t,e)).length;for(o||(o=1,e=n);++i<o;){var a=null==e?n:e[Po(t[i])];a===n&&(i=o,a=r),e=Ya(a)?a.call(e):a}return e},Mn.round=Il,Mn.runInContext=e,Mn.sample=function(e){return(Ka(e)?Yn:Jr)(e)},Mn.size=function(e){if(null==e)return 0;if(Ga(e))return os(e)?tn(e):e.length;var t=co(e);return t==w||t==C?e.size:Ur(e).length},Mn.snakeCase=qs,Mn.some=function(e,t,r){var i=Ka(e)?St:ti;return r&&yo(e,t,r)&&(t=n),i(e,oo(t,3))},Mn.sortedIndex=function(e,t){return ni(e,t)},Mn.sortedIndexBy=function(e,t,n){return ri(e,t,oo(n,2))},Mn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ni(e,t);if(r<n&&Ma(e[r],t))return r}return-1},Mn.sortedLastIndex=function(e,t){return ni(e,t,!0)},Mn.sortedLastIndexBy=function(e,t,n){return ri(e,t,oo(n,2),!0)},Mn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ni(e,t,!0)-1;if(Ma(e[n],t))return n}return-1},Mn.startCase=Vs,Mn.startsWith=function(e,t,n){return e=gs(e),n=null==n?0:or(hs(n),0,e.length),t=ai(t),e.slice(n,n+t.length)==t},Mn.subtract=bl,Mn.sum=function(e){return e&&e.length?Mt(e,tl):0},Mn.sumBy=function(e,t){return e&&e.length?Mt(e,oo(t,2)):0},Mn.template=function(e,t,r){var i=Mn.templateSettings;r&&yo(e,t,r)&&(t=n),e=gs(e),t=vs({},t,i,Yi);var o,a,s=vs({},t.imports,i.imports,Yi),l=ks(s),u=Kt(s,l),A=0,c=t.interpolate||ye,h="__p += '",d=Ce((t.escape||ye).source+"|"+c.source+"|"+(c===Y?ue:ye).source+"|"+(t.evaluate||ye).source+"|$","g"),f="//# sourceURL="+(Fe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ye+"]")+"\n";e.replace(d,(function(t,n,r,i,s,l){return r||(r=i),h+=e.slice(A,l).replace(me,Yt),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),A=l+t.length,t})),h+="';\n";var p=Fe.call(t,"variable")&&t.variable;if(p){if(se.test(p))throw new Ie("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(a?h.replace(O,""):h).replace(H,"$1").replace(K,"$1;"),h="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=Xs((function(){return be(l,f+"return "+h).apply(n,u)}));if(g.source=h,Ja(g))throw g;return g},Mn.times=function(e,t){if((e=hs(e))<1||e>u)return[];var n=c,r=yn(e,c);t=oo(t),e-=c;for(var i=Rt(r,t);++n<e;)t(n);return i},Mn.toFinite=cs,Mn.toInteger=hs,Mn.toLength=ds,Mn.toLower=function(e){return gs(e).toLowerCase()},Mn.toNumber=fs,Mn.toSafeInteger=function(e){return e?or(hs(e),-9007199254740991,u):0===e?e:0},Mn.toString=gs,Mn.toUpper=function(e){return gs(e).toUpperCase()},Mn.trim=function(e,t,r){if((e=gs(e))&&(r||t===n))return Ot(e);if(!e||!(t=ai(t)))return e;var i=nn(e),o=nn(t);return mi(i,Gt(i,o),qt(i,o)+1).join("")},Mn.trimEnd=function(e,t,r){if((e=gs(e))&&(r||t===n))return e.slice(0,rn(e)+1);if(!e||!(t=ai(t)))return e;var i=nn(e);return mi(i,0,qt(i,nn(t))+1).join("")},Mn.trimStart=function(e,t,r){if((e=gs(e))&&(r||t===n))return e.replace(te,"");if(!e||!(t=ai(t)))return e;var i=nn(e);return mi(i,Gt(i,nn(t))).join("")},Mn.truncate=function(e,t){var r=30,i="...";if(Za(t)){var o="separator"in t?t.separator:o;r="length"in t?hs(t.length):r,i="omission"in t?ai(t.omission):i}var a=(e=gs(e)).length;if(Xt(e)){var s=nn(e);a=s.length}if(r>=a)return e;var l=r-tn(i);if(l<1)return i;var u=s?mi(s,0,l).join(""):e.slice(0,l);if(o===n)return u+i;if(s&&(l+=u.length-l),rs(o)){if(e.slice(l).search(o)){var A,c=u;for(o.global||(o=Ce(o.source,gs(Ae.exec(o))+"g")),o.lastIndex=0;A=o.exec(c);)var h=A.index;u=u.slice(0,h===n?l:h)}}else if(e.indexOf(ai(o),l)!=l){var d=u.lastIndexOf(o);d>-1&&(u=u.slice(0,d))}return u+i},Mn.unescape=function(e){return(e=gs(e))&&q.test(e)?e.replace(j,on):e},Mn.uniqueId=function(e){var t=++Ue;return gs(e)+t},Mn.upperCase=zs,Mn.upperFirst=Js,Mn.each=ga,Mn.eachRight=ya,Mn.first=Go,ol(Mn,(pl={},mr(Mn,(function(e,t){Fe.call(Mn.prototype,t)||(pl[t]=e)})),pl),{chain:!1}),Mn.VERSION="4.17.21",yt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Mn[e].placeholder=Mn})),yt(["drop","take"],(function(e,t){Kn.prototype[e]=function(r){r=r===n?1:gn(hs(r),0);var i=this.__filtered__&&!t?new Kn(this):this.clone();return i.__filtered__?i.__takeCount__=yn(r,i.__takeCount__):i.__views__.push({size:yn(r,c),type:e+(i.__dir__<0?"Right":"")}),i},Kn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),yt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Kn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),yt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Kn.prototype[e]=function(){return this[n](1).value()[0]}})),yt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Kn.prototype[e]=function(){return this.__filtered__?new Kn(this):this[n](1)}})),Kn.prototype.compact=function(){return this.filter(tl)},Kn.prototype.find=function(e){return this.filter(e).head()},Kn.prototype.findLast=function(e){return this.reverse().find(e)},Kn.prototype.invokeMap=zr((function(e,t){return"function"==typeof e?new Kn(this):this.map((function(n){return Qr(n,e,t)}))})),Kn.prototype.reject=function(e){return this.filter(Fa(oo(e)))},Kn.prototype.slice=function(e,t){e=hs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Kn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=hs(t))<0?r.dropRight(-t):r.take(t-e)),r)},Kn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Kn.prototype.toArray=function(){return this.take(c)},mr(Kn.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Mn[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Mn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,l=t instanceof Kn,u=s[0],A=l||Ka(t),c=function(e){var t=o.apply(Mn,Et([e],s));return i&&h?t[0]:t};A&&r&&"function"==typeof u&&1!=u.length&&(l=A=!1);var h=this.__chain__,d=!!this.__actions__.length,f=a&&!h,p=l&&!d;if(!a&&A){t=p?t:new Kn(this);var g=e.apply(t,s);return g.__actions__.push({func:ca,args:[c],thisArg:n}),new Hn(g,h)}return f&&p?e.apply(this,s):(g=this.thru(c),f?i?g.value()[0]:g.value():g)})})),yt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Qe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Mn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ka(i)?i:[],e)}return this[n]((function(n){return t.apply(Ka(n)?n:[],e)}))}})),mr(Kn.prototype,(function(e,t){var n=Mn[t];if(n){var r=n.name+"";Fe.call(kn,r)||(kn[r]=[]),kn[r].push({name:t,func:n})}})),kn[Li(n,2).name]=[{name:"wrapper",func:n}],Kn.prototype.clone=function(){var e=new Kn(this.__wrapped__);return e.__actions__=xi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=xi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=xi(this.__views__),e},Kn.prototype.reverse=function(){if(this.__filtered__){var e=new Kn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Kn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ka(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=yn(t,e+a);break;case"takeRight":e=gn(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,l=s-a,u=r?s:a-1,A=this.__iteratees__,c=A.length,h=0,d=yn(l,this.__takeCount__);if(!n||!r&&i==l&&d==l)return ci(e,this.__actions__);var f=[];e:for(;l--&&h<d;){for(var p=-1,g=e[u+=t];++p<c;){var y=A[p],m=y.iteratee,v=y.type,w=m(g);if(2==v)g=w;else if(!w){if(1==v)continue e;break e}}f[h++]=g}return f},Mn.prototype.at=ha,Mn.prototype.chain=function(){return Aa(this)},Mn.prototype.commit=function(){return new Hn(this.value(),this.__chain__)},Mn.prototype.next=function(){this.__values__===n&&(this.__values__=As(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},Mn.prototype.plant=function(e){for(var t,r=this;r instanceof On;){var i=Lo(r);i.__index__=0,i.__values__=n,t?o.__wrapped__=i:t=i;var o=i;r=r.__wrapped__}return o.__wrapped__=e,t},Mn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Kn){var t=e;return this.__actions__.length&&(t=new Kn(this)),(t=t.reverse()).__actions__.push({func:ca,args:[Zo],thisArg:n}),new Hn(t,this.__chain__)}return this.thru(Zo)},Mn.prototype.toJSON=Mn.prototype.valueOf=Mn.prototype.value=function(){return ci(this.__wrapped__,this.__actions__)},Mn.prototype.first=Mn.prototype.head,st&&(Mn.prototype[st]=function(){return this}),Mn}();ot?((ot.exports=an)._=an,it._=an):rt._=an}).call(Ki)}(cG,cG.exports);const{validate:hG}=iK;const dG=oK,fG=aK,pG=tG.exports,gG=cG.exports;var yG=class{constructor(e){if(!pG.isEncoded(e))throw new Error("Base58 string is invalid. Cannot construct Decoder.");this.base58=e}constructRootJSON(e){const t=gG.invert(dG.root);return e.reduce(((e,n)=>{const r=t[n[0]];let i=n[1];return i instanceof Array&&("anchors"===r&&(i=this.constructAnchorsJSON(i)),"path"===r&&(i=this.constructPathJSON(i))),i instanceof ao&&(i=fG.decode(i).toString("hex")),e[r]=i,e}),{})}constructAnchorsJSON(e){const t=gG.invertBy(dG.chain,(e=>e.id));return e.map((e=>e.reduce(((e,n)=>{if(0===n[0])return`${e}:${t[n[1]]}`;if(1===n[0]){const t=e.split(":").pop();return`${e}:${gG.invert(dG.chain[t].networks)[n[1]]}`}return`${e}:${fG.decode(n[1]).toString("hex")}`}),"blink")))}constructPathJSON(e){const t=gG.invert(dG.path);return e.map((e=>({[t[e[0]]]:fG.decode(e[1]).toString("hex")})))}decode(){const e=pG.decode(this.base58),t=fG.decode(e);return this.constructRootJSON(t)}};function mG(e){const t=Object.keys(jl).map((e=>jl[e])).find((t=>t.signatureValue===e));return t}function vG(e,t){const n=e.findIndex((e=>e===t));n>-1&&e.splice(n,1)}var wG={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",creator:{"@id":"dc:creator","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"sec:expiration","@type":"xsd:dateTime"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:"bc:verification",publicKeys:"bc:publicKeys",ChainpointSHA256v2:"cp:ChainpointSHA256v2",BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/merkleProof2017Schema.json"}]},IG={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"bc:created","@type":"xsd:dateTime"},name:{"@id":"schema:name"}}},bG={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType","@type":"@id"},contentEncoding:{"@id":"bc:contentEncoding","@type":"@id"},content:{"@id":"bc:content","@type":"@id"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey","@type":"@id"},url:{"@id":"schema:url","@type":"@id"},image:{"@id":"schema:image","@type":"@id"}}};function BG(e){e=e.trim();const t=[];for(let n=0;n<e.length;n+=2)t.push(parseInt(e.substring(n,n+2),16));return t}jh["https://w3id.org/blockcerts/schema/2.0-alpha/context.json"]=wG,jh["https://www.blockcerts.org/schema/2.0-alpha/context.json"]=wG,jh["https://www.blockcerts.org/schema/3.0-alpha/context.json"]=IG,jh["https://w3id.org/blockcerts/schema/3.0-alpha/context.json"]=IG,jh["https://w3id.org/blockcerts/v3.0-alpha"]=IG,jh["https://www.blockcerts.org/schema/3.0-beta/context.json"]=bG,jh["https://w3id.org/blockcerts/schema/3.0-beta/context.json"]=bG,jh["https://w3id.org/blockcerts/v3.0-beta"]=bG,jh["https://w3id.org/security/suites/ed25519-2020/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},Ed25519VerificationKey2020:{"@id":"https://w3id.org/security#Ed25519VerificationKey2020","@context":{"@protected":!0,id:"@id",type:"@type",controller:{"@id":"https://w3id.org/security#controller","@type":"@id"},revoked:{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},Ed25519Signature2020:{"@id":"https://w3id.org/security#Ed25519Signature2020","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};class EG extends Error{constructor(e,t){super(t),this.stepCode=e}}var CG="en-US",xG={"en-US":{errors:{ensureHashesEqual:"Computed hash does not match remote hash",ensureMerkleRootEqual:"Merkle root does not match remote hash.",ensureValidReceipt:"The receipt is malformed. There was a problem navigating the merkle tree in the receipt.",failedJsonLdNormalization:"Failed JSON-LD normalization",foundUnmappedFields:"Found unmapped fields during JSON-LD normalization",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Cannot verify this certificate without a transaction ID to compare against.",invalidMerkleReceipt:"Invalid Merkle Receipt. Proof hash did not match Merkle root",isTransactionIdValid:"Cannot verify this certificate without a transaction ID to compare against.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},fr:{errors:{ensureHashesEqual:"Calcul du hash local différent du hash distant",ensureMerkleRootEqual:"Le Merkle root ne correspond pas au hash distant",ensureValidReceipt:"Erreur d'écriture du reçu. Un problème est survenu lors de la navigation de l'arbre Merkle du reçu.",failedJsonLdNormalization:"Erreur de normalisation JSON-LD",foundUnmappedFields:"Champs non liés découverts durant la normalisation JSON-LD",identityErrorBaseMessage:"Identité de l'émetteur invalide",deriveIssuingAddressFromPublicKey:"Cette blockchain n'est pas supportée pour la vérification de l'identité décentralisée.",compareIssuingAddress:"La méthode de vérification n'a pas permis d'établir l'identité de l'émetteur.",getTransactionId:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",invalidMerkleReceipt:"Reçu Merkle invalide. Hash de preuve différent du Merkle root",isTransactionIdValid:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",noProofSpecified:"La propriété 'proof' du document est un tableau mais aucune preuve n'a été passée pour savoir ce qu'il faut vérifier"}},es:{errors:{ensureHashesEqual:"La cadena binaria calculada no corresponde con la cadena binaria remota",ensureMerkleRootEqual:"La raíz Merkle no corresponde con la cadena binaria remota",ensureValidReceipt:"El recibo está malformado. Hubo un problema navegando el árbol Merkle en el recibo",failedJsonLdNormalization:"La normalización del JSON-LD ha fallado",foundUnmappedFields:"Se han encontrado campos no mapeados durante la normalización de JSON-LD",identityErrorBaseMessage:"Identitad del emisor inválida",deriveIssuingAddressFromPublicKey:"No se puede validar la identitad decentalisada con esta cadena binaria.",compareIssuingAddress:"El metodo de verificación no corresponde a la identitad del emisor.",getTransactionId:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",invalidMerkleReceipt:"Recibo Merkle inválido. La cadena binaria de prueba no corresponde con la raíz Merkle",isTransactionIdValid:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",noProofSpecified:"La propiedad 'proof' del documento es una lista, pero no prueba especifica ha sido declarada para conocer el punto de verificación"}},mt:{errors:{ensureHashesEqual:"Il-hash ikkalkulat ma jikkorrispondix mar-remote hash",ensureMerkleRootEqual:"Merkle root ma taqbilx mar-remote hash",ensureValidReceipt:"L-irċevuta hija malformata. Kien hemm problema fin-navigazzjoni tal-merkle tree fl-irċevuta",failedJsonLdNormalization:"In-normalizzazzjoni ta' JSON-LD ma rnexxietx",foundUnmappedFields:"Instabu unmapped fields matul in-normalizzazzjoni JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",invalidMerkleReceipt:"Irċevuta Merkle invalida. Il-proof hash ma kienx jaqbel mal-Merkle root",isTransactionIdValid:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},"it-IT":{errors:{ensureHashesEqual:"L'hash calcolato non corrisponde all'hash remoto",ensureMerkleRootEqual:"La radice di Merkle non corrisponde all'hash remoto.",ensureValidReceipt:"La ricevuta è malformata. C'è stato un problema nella navigazione dell'albero di Merkle nella ricevuta.",failedJsonLdNormalization:"Normalizzazione JSON-LD fallita",foundUnmappedFields:"Campi non mappati trovati durante la normalizzazione JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",invalidMerkleReceipt:"Ricevuta Merkle non valida. L'hash di prova non corrisponde alla radice di Merkle",isTransactionIdValid:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},ja:{errors:{ensureHashesEqual:"算出されたハッシュがリモートハッシュと一致しませんでした",ensureMerkleRootEqual:"Merkle rootがリモートハッシュと一致しませんでした",ensureValidReceipt:"レシートが異常です。レシート内のMerkle treeを辿る際に問題が発生しました。",failedJsonLdNormalization:"JSON-LDの正規化に失敗しました",foundUnmappedFields:"JSON-LDの正規化時にマップされていないフィールドを検出しました",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"照合のための取引IDがないため、この証明書を認証できません。",invalidMerkleReceipt:"Merkleレシートが無効です。証明ハッシュがMerkle rootと一致しませんでした。",isTransactionIdValid:"照合するための取引IDがないため、この証明書を認証できません。",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}}};function SG(e,t){return e&&t?xG[CG]?xG[CG][e]?xG[CG][e][t]?xG[CG][e][t]||"":"[missing locale item data]":"[missing locale group data]":"[missing locale data]":""}var QG=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const kG=ao;var _G={},NG={},DG={};Object.defineProperty(DG,"__esModule",{value:!0}),DG.testnet=DG.regtest=DG.bitcoin=void 0,DG.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},DG.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},DG.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var FG={},UG={},PG={},TG={};Object.defineProperty(TG,"__esModule",{value:!0}),TG.encode=TG.decode=TG.check=void 0,TG.check=function(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;const t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;const n=e[5+t];return!(0===n||6+t+n!==e.length||128&e[4]||t>1&&0===e[4]&&!(128&e[5])||128&e[t+6]||n>1&&0===e[t+6]&&!(128&e[t+7]))},TG.decode=function(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");const t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");const n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}},TG.encode=function(e,t){const n=e.length,r=t.length;if(0===n)throw new Error("R length is zero");if(0===r)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(r>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");const i=ao.allocUnsafe(6+n+r);return i[0]=48,i[1]=i.length-2,i[2]=2,i[3]=e.length,e.copy(i,4),i[4+n]=2,i[5+n]=t.length,t.copy(i,6+n),i};var LG={};Object.defineProperty(LG,"__esModule",{value:!0}),LG.REVERSE_OPS=LG.OPS=void 0;const MG={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};LG.OPS=MG;const RG={};LG.REVERSE_OPS=RG;for(const e of Object.keys(MG))RG[MG[e]]=e;var OG={};Object.defineProperty(OG,"__esModule",{value:!0}),OG.decode=OG.encode=OG.encodingLength=void 0;const HG=LG;function KG(e){return e<HG.OPS.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}OG.encodingLength=KG,OG.encode=function(e,t,n){const r=KG(t);return 1===r?e.writeUInt8(t,n):2===r?(e.writeUInt8(HG.OPS.OP_PUSHDATA1,n),e.writeUInt8(t,n+1)):3===r?(e.writeUInt8(HG.OPS.OP_PUSHDATA2,n),e.writeUInt16LE(t,n+1)):(e.writeUInt8(HG.OPS.OP_PUSHDATA4,n),e.writeUInt32LE(t,n+1)),r},OG.decode=function(e,t){const n=e.readUInt8(t);let r,i;if(n<HG.OPS.OP_PUSHDATA1)r=n,i=1;else if(n===HG.OPS.OP_PUSHDATA1){if(t+2>e.length)return null;r=e.readUInt8(t+1),i=2}else if(n===HG.OPS.OP_PUSHDATA2){if(t+3>e.length)return null;r=e.readUInt16LE(t+1),i=3}else{if(t+5>e.length)return null;if(n!==HG.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=e.readUInt32LE(t+1),i=5}return{opcode:n,number:r,size:i}};var jG={};Object.defineProperty(jG,"__esModule",{value:!0}),jG.encode=jG.decode=void 0,jG.decode=function(e,t,n){t=t||4,n=void 0===n||n;const r=e.length;if(0===r)return 0;if(r>t)throw new TypeError("Script number overflow");if(n&&0==(127&e[r-1])&&(r<=1||0==(128&e[r-2])))throw new Error("Non-minimally encoded script number");if(5===r){const t=e.readUInt32LE(0),n=e.readUInt8(4);return 128&n?-(4294967296*(-129&n)+t):4294967296*n+t}let i=0;for(let t=0;t<r;++t)i|=e[t]<<8*t;return 128&e[r-1]?-(i&~(128<<8*(r-1))):i},jG.encode=function(e){let t=Math.abs(e);const n=(r=t)>2147483647?5:r>8388607?4:r>32767?3:r>127?2:r>0?1:0;var r;const i=ao.allocUnsafe(n),o=e<0;for(let e=0;e<n;++e)i.writeUInt8(255&t,e),t>>=8;return 128&i[n-1]?i.writeUInt8(o?128:0,n-1):o&&(i[n-1]|=128),i};var GG={},qG={},VG={Array:function(e){return null!=e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return null==e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var zG in VG.Null=VG.Nil,VG)VG[zG].toJSON=function(e){return e}.bind(null,zG);var JG=VG,YG=JG;function XG(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function WG(e){return YG.Nil(e)?"":XG(e.constructor)}function ZG(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function $G(e){return YG.Function(e)?e.toJSON?e.toJSON():XG(e):YG.Array(e)?"Array":e&&YG.Object(e)?"Object":void 0!==e?e:""}function eq(e,t,n){var r=function(e){return YG.Function(e)?"":YG.String(e)?JSON.stringify(e):e&&YG.Object(e)?"":e}(t);return"Expected "+$G(e)+", got"+(""!==n?" "+n:"")+(""!==r?" "+r:"")}function tq(e,t,n){n=n||WG(t),this.message=eq(e,t,n),ZG(this,tq),this.__type=e,this.__value=t,this.__valueTypeName=n}function nq(e,t,n,r,i){e?(i=i||WG(r),this.message=function(e,t,n,r,i){var o='" of type ';return"key"===t&&(o='" with key type '),eq('property "'+$G(n)+o+$G(e),r,i)}(e,n,t,r,i)):this.message='Unexpected property "'+t+'"',ZG(this,tq),this.__label=n,this.__property=t,this.__type=e,this.__value=r,this.__valueTypeName=i}tq.prototype=Object.create(Error.prototype),tq.prototype.constructor=tq,nq.prototype=Object.create(Error.prototype),nq.prototype.constructor=tq;var rq={TfTypeError:tq,TfPropertyTypeError:nq,tfCustomError:function(e,t){return new tq(e,{},t)},tfSubError:function(e,t,n){return e instanceof nq?(t=t+"."+e.__property,e=new nq(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof tq&&(e=new nq(e.__type,t,n,e.__value,e.__valueTypeName)),ZG(e),e},tfJSON:$G,getValueTypeName:WG},iq=JG,oq=rq;function aq(e){return jo(e)}function sq(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function lq(e,t){var n=e.toJSON();function r(r){if(!e(r))return!1;if(r.length===t)return!0;throw oq.tfCustomError(n+"(Length: "+t+")",n+"(Length: "+r.length+")")}return r.toJSON=function(){return n},r}var uq=lq.bind(null,iq.Array),Aq=lq.bind(null,aq),cq=lq.bind(null,sq),hq=lq.bind(null,iq.String),dq=Math.pow(2,53)-1,fq={ArrayN:uq,Buffer:aq,BufferN:Aq,Finite:function(e){return"number"==typeof e&&isFinite(e)},Hex:sq,HexN:cq,Int8:function(e){return e<<24>>24===e},Int16:function(e){return e<<16>>16===e},Int32:function(e){return(0|e)===e},Int53:function(e){return"number"==typeof e&&e>=-dq&&e<=dq&&Math.floor(e)===e},Range:function(e,t,n){function r(r,i){return n(r,i)&&r>e&&r<t}return n=n||iq.Number,r.toJSON=function(){return`${n.toJSON()} between [${e}, ${t}]`},r},StringN:hq,UInt8:function(e){return(255&e)===e},UInt16:function(e){return(65535&e)===e},UInt32:function(e){return e>>>0===e},UInt53:function(e){return"number"==typeof e&&e>=0&&e<=dq&&Math.floor(e)===e}};for(var pq in fq)fq[pq].toJSON=function(e){return e}.bind(null,pq);var gq=fq,yq=JG,mq=rq.tfJSON,vq=rq.TfTypeError,wq=rq.TfPropertyTypeError,Iq=rq.tfSubError,bq=rq.getValueTypeName,Bq={arrayOf:function(e,t){function n(n,r){return!!yq.Array(n)&&!yq.Nil(n)&&!(void 0!==t.minLength&&n.length<t.minLength)&&!(void 0!==t.maxLength&&n.length>t.maxLength)&&(void 0===t.length||n.length===t.length)&&n.every((function(t,n){try{return Cq(e,t,r)}catch(e){throw Iq(e,n)}}))}return e=Eq(e),t=t||{},n.toJSON=function(){var n="["+mq(e)+"]";return void 0!==t.length?n+="{"+t.length+"}":void 0===t.minLength&&void 0===t.maxLength||(n+="{"+(void 0===t.minLength?0:t.minLength)+","+(void 0===t.maxLength?1/0:t.maxLength)+"}"),n},n},maybe:function e(t){function n(n,r){return yq.Nil(n)||t(n,r,e)}return t=Eq(t),n.toJSON=function(){return"?"+mq(t)},n},map:function(e,t){function n(n,r){if(!yq.Object(n))return!1;if(yq.Nil(n))return!1;for(var i in n){try{t&&Cq(t,i,r)}catch(e){throw Iq(e,i,"key")}try{var o=n[i];Cq(e,o,r)}catch(e){throw Iq(e,i)}}return!0}return e=Eq(e),t&&(t=Eq(t)),n.toJSON=t?function(){return"{"+mq(t)+": "+mq(e)+"}"}:function(){return"{"+mq(e)+"}"},n},object:function(e){var t={};for(var n in e)t[n]=Eq(e[n]);function r(e,n){if(!yq.Object(e))return!1;if(yq.Nil(e))return!1;var r;try{for(r in t)Cq(t[r],e[r],n)}catch(e){throw Iq(e,r)}if(n)for(r in e)if(!t[r])throw new wq(void 0,r);return!0}return r.toJSON=function(){return mq(t)},r},anyOf:function(){var e=[].slice.call(arguments).map(Eq);function t(t,n){return e.some((function(e){try{return Cq(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(mq).join("|")},t},allOf:function(){var e=[].slice.call(arguments).map(Eq);function t(t,n){return e.every((function(e){try{return Cq(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(mq).join(" & ")},t},quacksLike:function(e){function t(t){return e===bq(t)}return t.toJSON=function(){return e},t},tuple:function(){var e=[].slice.call(arguments).map(Eq);function t(t,n){return!yq.Nil(t)&&!yq.Nil(t.length)&&(!n||t.length===e.length)&&e.every((function(e,r){try{return Cq(e,t[r],n)}catch(e){throw Iq(e,r)}}))}return t.toJSON=function(){return"("+e.map(mq).join(", ")+")"},t},value:function(e){function t(t){return t===e}return t.toJSON=function(){return e},t}};function Eq(e){if(yq.String(e))return"?"===e[0]?Bq.maybe(e.slice(1)):yq[e]||Bq.quacksLike(e);if(e&&yq.Object(e)){if(yq.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return Bq.arrayOf(e[0])}return Bq.object(e)}return yq.Function(e)?e:Bq.value(e)}function Cq(e,t,n,r){if(yq.Function(e)){if(e(t,n))return!0;throw new vq(r||e,t)}return Cq(Eq(e),t,n)}for(var xq in Bq.oneOf=Bq.anyOf,yq)Cq[xq]=yq[xq];for(xq in Bq)Cq[xq]=Bq[xq];var Sq=gq;for(xq in Sq)Cq[xq]=Sq[xq];Cq.compile=Eq,Cq.TfTypeError=vq,Cq.TfPropertyTypeError=wq;var Qq=Cq;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.oneOf=e.Null=e.BufferN=e.Function=e.UInt32=e.UInt8=e.tuple=e.maybe=e.Hex=e.Buffer=e.String=e.Boolean=e.Array=e.Number=e.Hash256bit=e.Hash160bit=e.Buffer256bit=e.Network=e.ECPoint=e.Satoshi=e.Signer=e.BIP32Path=e.UInt31=e.isPoint=e.typeforce=void 0;const t=qo;e.typeforce=Qq;const n=t.Buffer.alloc(32,0),r=t.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");e.isPoint=function(e){if(!t.Buffer.isBuffer(e))return!1;if(e.length<33)return!1;const i=e[0],o=e.slice(1,33);if(0===o.compare(n))return!1;if(o.compare(r)>=0)return!1;if((2===i||3===i)&&33===e.length)return!0;const a=e.slice(33);return 0!==a.compare(n)&&!(a.compare(r)>=0)&&4===i&&65===e.length};const i=Math.pow(2,31)-1;function o(t){return e.typeforce.String(t)&&!!t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.UInt31=function(t){return e.typeforce.UInt32(t)&&t<=i},e.BIP32Path=o,o.toJSON=()=>"BIP32 derivation path",e.Signer=function(t){return(e.typeforce.Buffer(t.publicKey)||"function"==typeof t.getPublicKey)&&"function"==typeof t.sign},e.Satoshi=function(t){return e.typeforce.UInt53(t)&&t<=21e14},e.ECPoint=e.typeforce.quacksLike("Point"),e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.Buffer256bit=e.typeforce.BufferN(32),e.Hash160bit=e.typeforce.BufferN(20),e.Hash256bit=e.typeforce.BufferN(32),e.Number=e.typeforce.Number,e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.String=e.typeforce.String,e.Buffer=e.typeforce.Buffer,e.Hex=e.typeforce.Hex,e.maybe=e.typeforce.maybe,e.tuple=e.typeforce.tuple,e.UInt8=e.typeforce.UInt8,e.UInt32=e.typeforce.UInt32,e.Function=e.typeforce.Function,e.BufferN=e.typeforce.BufferN,e.Null=e.typeforce.Null,e.oneOf=e.typeforce.oneOf}(qG),Object.defineProperty(GG,"__esModule",{value:!0}),GG.encode=GG.decode=void 0;const kq=TG,_q=qG,{typeforce:Nq}=_q,Dq=ao.alloc(1,0);function Fq(e){let t=0;for(;0===e[t];)++t;return t===e.length?Dq:128&(e=e.slice(t))[0]?ao.concat([Dq,e],1+e.length):e}function Uq(e){0===e[0]&&(e=e.slice(1));const t=ao.alloc(32,0),n=Math.max(0,32-e.length);return e.copy(t,n),t}GG.decode=function(e){const t=e.readUInt8(e.length-1),n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);const r=kq.decode(e.slice(0,-1)),i=Uq(r.r),o=Uq(r.s);return{signature:ao.concat([i,o],64),hashType:t}},GG.encode=function(e,t){Nq({signature:_q.BufferN(64),hashType:_q.UInt8},{signature:e,hashType:t});const n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);const r=ao.allocUnsafe(1);r.writeUInt8(t,0);const i=Fq(e.slice(0,32)),o=Fq(e.slice(32,64));return ao.concat([kq.encode(i,o),r])},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.signature=e.number=e.isCanonicalScriptSignature=e.isDefinedHashType=e.isCanonicalPubKey=e.toStack=e.fromASM=e.toASM=e.decompile=e.compile=e.isPushOnly=e.OPS=void 0;const t=TG,n=LG;Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return n.OPS}});const r=OG,i=jG,o=GG,a=qG,{typeforce:s}=a,l=n.OPS.OP_RESERVED;function u(e){return a.Buffer(e)||function(e){return a.Number(e)&&(e===n.OPS.OP_0||e>=n.OPS.OP_1&&e<=n.OPS.OP_16||e===n.OPS.OP_1NEGATE)}(e)}function A(e){return a.Array(e)&&e.every(u)}function c(e){return 0===e.length?n.OPS.OP_0:1===e.length?e[0]>=1&&e[0]<=16?l+e[0]:129===e[0]?n.OPS.OP_1NEGATE:void 0:void 0}function h(e){return jo(e)}function d(e){return jo(e)}function f(e){if(h(e))return e;s(a.Array,e);const t=e.reduce(((e,t)=>d(t)?1===t.length&&void 0!==c(t)?e+1:e+r.encodingLength(t.length)+t.length:e+1),0),n=ao.allocUnsafe(t);let i=0;if(e.forEach((e=>{if(d(e)){const t=c(e);if(void 0!==t)return n.writeUInt8(t,i),void(i+=1);i+=r.encode(n,e.length,i),e.copy(n,i),i+=e.length}else n.writeUInt8(e,i),i+=1})),i!==n.length)throw new Error("Could not decode chunks");return n}function p(e){if(t=e,a.Array(t))return e;var t;s(a.Buffer,e);const i=[];let o=0;for(;o<e.length;){const t=e[o];if(t>n.OPS.OP_0&&t<=n.OPS.OP_PUSHDATA4){const t=r.decode(e,o);if(null===t)return null;if(o+=t.size,o+t.number>e.length)return null;const n=e.slice(o,o+t.number);o+=t.number;const a=c(n);void 0!==a?i.push(a):i.push(n)}else i.push(t),o+=1}return i}function g(e){const t=-129&e;return t>0&&t<4}e.isPushOnly=A,e.compile=f,e.decompile=p,e.toASM=function(e){return h(e)&&(e=p(e)),e.map((e=>{if(d(e)){const t=c(e);if(void 0===t)return e.toString("hex");e=t}return n.REVERSE_OPS[e]})).join(" ")},e.fromASM=function(e){return s(a.String,e),f(e.split(" ").map((e=>void 0!==n.OPS[e]?n.OPS[e]:(s(a.Hex,e),ao.from(e,"hex")))))},e.toStack=function(e){return e=p(e),s(A,e),e.map((e=>d(e)?e:e===n.OPS.OP_0?ao.allocUnsafe(0):i.encode(e-l)))},e.isCanonicalPubKey=function(e){return a.isPoint(e)},e.isDefinedHashType=g,e.isCanonicalScriptSignature=function(e){return!!jo(e)&&!!g(e[e.length-1])&&t.check(e.slice(0,-1))},e.number=i,e.signature=o}(PG);var Pq={};Object.defineProperty(Pq,"__esModule",{value:!0}),Pq.value=Pq.prop=void 0,Pq.prop=function(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=n.call(this);return this[t]=e,e},set(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})},Pq.value=function(e){let t;return()=>(void 0!==t||(t=e()),t)},Object.defineProperty(UG,"__esModule",{value:!0}),UG.p2data=void 0;const Tq=DG,Lq=PG,Mq=qG,Rq=Pq,Oq=Lq.OPS;UG.p2data=function(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,Mq.typeforce)({network:Mq.typeforce.maybe(Mq.typeforce.Object),output:Mq.typeforce.maybe(Mq.typeforce.Buffer),data:Mq.typeforce.maybe(Mq.typeforce.arrayOf(Mq.typeforce.Buffer))},e);const n={name:"embed",network:e.network||Tq.bitcoin};if(Rq.prop(n,"output",(()=>{if(e.data)return Lq.compile([Oq.OP_RETURN].concat(e.data))})),Rq.prop(n,"data",(()=>{if(e.output)return Lq.decompile(e.output).slice(1)})),t.validate&&e.output){const t=Lq.decompile(e.output);if(t[0]!==Oq.OP_RETURN)throw new TypeError("Output is invalid");if(!t.slice(1).every(Mq.typeforce.Buffer))throw new TypeError("Output is invalid");if(e.data&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.data,n.data))throw new TypeError("Data mismatch")}return Object.assign(n,e)};var Hq={};Object.defineProperty(Hq,"__esModule",{value:!0}),Hq.p2ms=void 0;const Kq=DG,jq=PG,Gq=qG,qq=Pq,Vq=jq.OPS,zq=Vq.OP_RESERVED;function Jq(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}Hq.p2ms=function(e,t){if(!(e.input||e.output||e.pubkeys&&void 0!==e.m||e.signatures))throw new TypeError("Not enough data");function n(e){return jq.isCanonicalScriptSignature(e)||void 0!==(t.allowIncomplete&&e===Vq.OP_0)}t=Object.assign({validate:!0},t||{}),(0,Gq.typeforce)({network:Gq.typeforce.maybe(Gq.typeforce.Object),m:Gq.typeforce.maybe(Gq.typeforce.Number),n:Gq.typeforce.maybe(Gq.typeforce.Number),output:Gq.typeforce.maybe(Gq.typeforce.Buffer),pubkeys:Gq.typeforce.maybe(Gq.typeforce.arrayOf(Gq.isPoint)),signatures:Gq.typeforce.maybe(Gq.typeforce.arrayOf(n)),input:Gq.typeforce.maybe(Gq.typeforce.Buffer)},e);const r={network:e.network||Kq.bitcoin};let i=[],o=!1;function a(e){o||(o=!0,i=jq.decompile(e),r.m=i[0]-zq,r.n=i[i.length-2]-zq,r.pubkeys=i.slice(1,-2))}if(qq.prop(r,"output",(()=>{if(e.m&&r.n&&e.pubkeys)return jq.compile([].concat(zq+e.m,e.pubkeys,zq+r.n,Vq.OP_CHECKMULTISIG))})),qq.prop(r,"m",(()=>{if(r.output)return a(r.output),r.m})),qq.prop(r,"n",(()=>{if(r.pubkeys)return r.pubkeys.length})),qq.prop(r,"pubkeys",(()=>{if(e.output)return a(e.output),r.pubkeys})),qq.prop(r,"signatures",(()=>{if(e.input)return jq.decompile(e.input).slice(1)})),qq.prop(r,"input",(()=>{if(e.signatures)return jq.compile([Vq.OP_0].concat(e.signatures))})),qq.prop(r,"witness",(()=>{if(r.input)return[]})),qq.prop(r,"name",(()=>{if(r.m&&r.n)return`p2ms(${r.m} of ${r.n})`})),t.validate){if(e.output){if(a(e.output),!Gq.typeforce.Number(i[0]))throw new TypeError("Output is invalid");if(!Gq.typeforce.Number(i[i.length-2]))throw new TypeError("Output is invalid");if(i[i.length-1]!==Vq.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(r.m<=0||r.n>16||r.m>r.n||r.n!==i.length-3)throw new TypeError("Output is invalid");if(!r.pubkeys.every((e=>(0,Gq.isPoint)(e))))throw new TypeError("Output is invalid");if(void 0!==e.m&&e.m!==r.m)throw new TypeError("m mismatch");if(void 0!==e.n&&e.n!==r.n)throw new TypeError("n mismatch");if(e.pubkeys&&!Jq(e.pubkeys,r.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(r.n=e.pubkeys.length,r.n<r.m)throw new TypeError("Pubkey count cannot be less than m")}if(e.signatures){if(e.signatures.length<r.m)throw new TypeError("Not enough signatures provided");if(e.signatures.length>r.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==Vq.OP_0)throw new TypeError("Input is invalid");if(0===r.signatures.length||!r.signatures.every(n))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!Jq(e.signatures,r.signatures))throw new TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(r,e)};var Yq={};Object.defineProperty(Yq,"__esModule",{value:!0}),Yq.p2pk=void 0;const Xq=DG,Wq=PG,Zq=qG,$q=Pq,eV=Wq.OPS;Yq.p2pk=function(e,t){if(!(e.input||e.output||e.pubkey||e.input||e.signature))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,Zq.typeforce)({network:Zq.typeforce.maybe(Zq.typeforce.Object),output:Zq.typeforce.maybe(Zq.typeforce.Buffer),pubkey:Zq.typeforce.maybe(Zq.isPoint),signature:Zq.typeforce.maybe(Wq.isCanonicalScriptSignature),input:Zq.typeforce.maybe(Zq.typeforce.Buffer)},e);const n=$q.value((()=>Wq.decompile(e.input))),r={name:"p2pk",network:e.network||Xq.bitcoin};if($q.prop(r,"output",(()=>{if(e.pubkey)return Wq.compile([e.pubkey,eV.OP_CHECKSIG])})),$q.prop(r,"pubkey",(()=>{if(e.output)return e.output.slice(1,-1)})),$q.prop(r,"signature",(()=>{if(e.input)return n()[0]})),$q.prop(r,"input",(()=>{if(e.signature)return Wq.compile([e.signature])})),$q.prop(r,"witness",(()=>{if(r.input)return[]})),t.validate){if(e.output){if(e.output[e.output.length-1]!==eV.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,Zq.isPoint)(r.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(r.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(r.input))throw new TypeError("Signature mismatch");if(e.input){if(1!==n().length)throw new TypeError("Input is invalid");if(!Wq.isCanonicalScriptSignature(r.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(r,e)};var tV={},nV={};Object.defineProperty(nV,"__esModule",{value:!0}),nV.taggedHash=nV.hash256=nV.hash160=nV.sha256=nV.sha1=nV.ripemd160=void 0;const rV=yL,iV=GP;function oV(e){try{return rV("rmd160").update(e).digest()}catch(t){try{return rV("ripemd160").update(e).digest()}catch(t){return(new iV).update(e).digest()}}}function aV(e){return rV("sha256").update(e).digest()}nV.ripemd160=oV,nV.sha1=function(e){return rV("sha1").update(e).digest()},nV.sha256=aV,nV.hash160=function(e){return oV(aV(e))},nV.hash256=function(e){return aV(aV(e))};const sV=Object.fromEntries(["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"].map((e=>{const t=aV(ao.from(e));return[e,ao.concat([t,t])]})));nV.taggedHash=function(e,t){return aV(ao.concat([sV[e],t]))};var lV=ER,uV=ED.exports.Buffer,AV=yL,cV=function(e){function t(t){var n=t.slice(0,-4),r=t.slice(-4),i=e(n);if(!(r[0]^i[0]|r[1]^i[1]|r[2]^i[2]|r[3]^i[3]))return n}return{encode:function(t){var n=e(t);return lV.encode(uV.concat([t,n],t.length+4))},decode:function(e){var n=t(lV.decode(e));if(!n)throw new Error("Invalid checksum");return n},decodeUnsafe:function(e){var n=lV.decodeUnsafe(e);if(n)return t(n)}}}((function(e){var t=AV("sha256").update(e).digest();return AV("sha256").update(t).digest()}));Object.defineProperty(tV,"__esModule",{value:!0}),tV.p2pkh=void 0;const hV=nV,dV=DG,fV=PG,pV=qG,gV=Pq,yV=cV,mV=fV.OPS;tV.p2pkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,pV.typeforce)({network:pV.typeforce.maybe(pV.typeforce.Object),address:pV.typeforce.maybe(pV.typeforce.String),hash:pV.typeforce.maybe(pV.typeforce.BufferN(20)),output:pV.typeforce.maybe(pV.typeforce.BufferN(25)),pubkey:pV.typeforce.maybe(pV.isPoint),signature:pV.typeforce.maybe(fV.isCanonicalScriptSignature),input:pV.typeforce.maybe(pV.typeforce.Buffer)},e);const n=gV.value((()=>{const t=yV.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),r=gV.value((()=>fV.decompile(e.input))),i=e.network||dV.bitcoin,o={name:"p2pkh",network:i};if(gV.prop(o,"address",(()=>{if(!o.hash)return;const e=ao.allocUnsafe(21);return e.writeUInt8(i.pubKeyHash,0),o.hash.copy(e,1),yV.encode(e)})),gV.prop(o,"hash",(()=>e.output?e.output.slice(3,23):e.address?n().hash:e.pubkey||o.pubkey?hV.hash160(e.pubkey||o.pubkey):void 0)),gV.prop(o,"output",(()=>{if(o.hash)return fV.compile([mV.OP_DUP,mV.OP_HASH160,o.hash,mV.OP_EQUALVERIFY,mV.OP_CHECKSIG])})),gV.prop(o,"pubkey",(()=>{if(e.input)return r()[1]})),gV.prop(o,"signature",(()=>{if(e.input)return r()[0]})),gV.prop(o,"input",(()=>{if(e.pubkey&&e.signature)return fV.compile([e.signature,e.pubkey])})),gV.prop(o,"witness",(()=>{if(o.input)return[]})),t.validate){let t=ao.from([]);if(e.address){if(n().version!==i.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==n().hash.length)throw new TypeError("Invalid address");t=n().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==mV.OP_DUP||e.output[1]!==mV.OP_HASH160||20!==e.output[2]||e.output[23]!==mV.OP_EQUALVERIFY||e.output[24]!==mV.OP_CHECKSIG)throw new TypeError("Output is invalid");const n=e.output.slice(3,23);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.pubkey){const n=hV.hash160(e.pubkey);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.input){const n=r();if(2!==n.length)throw new TypeError("Input is invalid");if(!fV.isCanonicalScriptSignature(n[0]))throw new TypeError("Input has invalid signature");if(!(0,pV.isPoint)(n[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(n[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(n[1]))throw new TypeError("Pubkey mismatch");const i=hV.hash160(n[1]);if(t.length>0&&!t.equals(i))throw new TypeError("Hash mismatch")}}return Object.assign(o,e)};var vV={};Object.defineProperty(vV,"__esModule",{value:!0}),vV.p2sh=void 0;const wV=nV,IV=DG,bV=PG,BV=qG,EV=Pq,CV=cV,xV=bV.OPS;vV.p2sh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,BV.typeforce)({network:BV.typeforce.maybe(BV.typeforce.Object),address:BV.typeforce.maybe(BV.typeforce.String),hash:BV.typeforce.maybe(BV.typeforce.BufferN(20)),output:BV.typeforce.maybe(BV.typeforce.BufferN(23)),redeem:BV.typeforce.maybe({network:BV.typeforce.maybe(BV.typeforce.Object),output:BV.typeforce.maybe(BV.typeforce.Buffer),input:BV.typeforce.maybe(BV.typeforce.Buffer),witness:BV.typeforce.maybe(BV.typeforce.arrayOf(BV.typeforce.Buffer))}),input:BV.typeforce.maybe(BV.typeforce.Buffer),witness:BV.typeforce.maybe(BV.typeforce.arrayOf(BV.typeforce.Buffer))},e);let n=e.network;n||(n=e.redeem&&e.redeem.network||IV.bitcoin);const r={network:n},i=EV.value((()=>{const t=CV.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),o=EV.value((()=>bV.decompile(e.input))),a=EV.value((()=>{const t=o(),r=t[t.length-1];return{network:n,output:r===xV.OP_FALSE?ao.from([]):r,input:bV.compile(t.slice(0,-1)),witness:e.witness||[]}}));if(EV.prop(r,"address",(()=>{if(!r.hash)return;const e=ao.allocUnsafe(21);return e.writeUInt8(r.network.scriptHash,0),r.hash.copy(e,1),CV.encode(e)})),EV.prop(r,"hash",(()=>e.output?e.output.slice(2,22):e.address?i().hash:r.redeem&&r.redeem.output?wV.hash160(r.redeem.output):void 0)),EV.prop(r,"output",(()=>{if(r.hash)return bV.compile([xV.OP_HASH160,r.hash,xV.OP_EQUAL])})),EV.prop(r,"redeem",(()=>{if(e.input)return a()})),EV.prop(r,"input",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.output)return bV.compile([].concat(bV.decompile(e.redeem.input),e.redeem.output))})),EV.prop(r,"witness",(()=>r.redeem&&r.redeem.witness?r.redeem.witness:r.input?[]:void 0)),EV.prop(r,"name",(()=>{const e=["p2sh"];return void 0!==r.redeem&&void 0!==r.redeem.name&&e.push(r.redeem.name),e.join("-")})),t.validate){let t=ao.from([]);if(e.address){if(i().version!==n.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==i().hash.length)throw new TypeError("Invalid address");t=i().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(23!==e.output.length||e.output[0]!==xV.OP_HASH160||20!==e.output[1]||e.output[22]!==xV.OP_EQUAL)throw new TypeError("Output is invalid");const n=e.output.slice(2,22);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}const r=e=>{if(e.output){const n=bV.decompile(e.output);if(!n||n.length<1)throw new TypeError("Redeem.output too short");const r=wV.hash160(e.output);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.input){const t=e.input.length>0,n=e.witness&&e.witness.length>0;if(!t&&!n)throw new TypeError("Empty input");if(t&&n)throw new TypeError("Input and witness provided");if(t){const t=bV.decompile(e.input);if(!bV.isPushOnly(t))throw new TypeError("Non push-only scriptSig")}}};if(e.input){const e=o();if(!e||e.length<1)throw new TypeError("Input too short");if(!jo(a().output))throw new TypeError("Input is invalid");r(a())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==n)throw new TypeError("Network mismatch");if(e.input){const t=a();if(e.redeem.output&&!e.redeem.output.equals(t.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(t.input))throw new TypeError("Redeem.input mismatch")}r(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(r,e)};var SV={},QV={};Object.defineProperty(QV,"__esModule",{value:!0}),QV.bech32m=QV.bech32=void 0;const kV="qpzry9x8gf2tvdw0s3jn54khce6mua7l",_V={};for(let e=0;e<kV.length;e++){const t=kV.charAt(e);_V[t]=e}function NV(e){const t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function DV(e){let t=1;for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=NV(t)^r>>5}t=NV(t);for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);t=NV(t)^31&r}return t}function FV(e,t,n,r){let i=0,o=0;const a=(1<<n)-1,s=[];for(let r=0;r<e.length;++r)for(i=i<<t|e[r],o+=t;o>=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<<n-o&a);else{if(o>=t)return"Excess padding";if(i<<n-o&a)return"Non-zero padding"}return s}function UV(e){return FV(e,8,5,!0)}function PV(e){const t=FV(e,5,8,!1);if(Array.isArray(t))return t}function TV(e){const t=FV(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function LV(e){let t;function n(e,n){if(n=n||90,e.length<8)return e+" too short";if(e.length>n)return"Exceeds length limit";const r=e.toLowerCase(),i=e.toUpperCase();if(e!==r&&e!==i)return"Mixed-case string "+e;const o=(e=r).lastIndexOf("1");if(-1===o)return"No separator character for "+e;if(0===o)return"Missing prefix for "+e;const a=e.slice(0,o),s=e.slice(o+1);if(s.length<6)return"Data too short";let l=DV(a);if("string"==typeof l)return l;const u=[];for(let e=0;e<s.length;++e){const t=s.charAt(e),n=_V[t];if(void 0===n)return"Unknown character "+t;l=NV(l)^n,e+6>=s.length||u.push(n)}return l!==t?"Invalid checksum for "+e:{prefix:a,words:u}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const r=n(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=n(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(e,n,r){if(r=r||90,e.length+7+n.length>r)throw new TypeError("Exceeds length limit");let i=DV(e=e.toLowerCase());if("string"==typeof i)throw new Error(i);let o=e+"1";for(let e=0;e<n.length;++e){const t=n[e];if(t>>5!=0)throw new Error("Non 5-bit word");i=NV(i)^t,o+=kV.charAt(t)}for(let e=0;e<6;++e)i=NV(i);i^=t;for(let e=0;e<6;++e)o+=kV.charAt(i>>5*(5-e)&31);return o},toWords:UV,fromWordsUnsafe:PV,fromWords:TV}}QV.bech32=LV("bech32"),QV.bech32m=LV("bech32m"),Object.defineProperty(SV,"__esModule",{value:!0}),SV.p2wpkh=void 0;const MV=nV,RV=DG,OV=PG,HV=qG,KV=Pq,jV=QV,GV=OV.OPS,qV=ao.alloc(0);SV.p2wpkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,HV.typeforce)({address:HV.typeforce.maybe(HV.typeforce.String),hash:HV.typeforce.maybe(HV.typeforce.BufferN(20)),input:HV.typeforce.maybe(HV.typeforce.BufferN(0)),network:HV.typeforce.maybe(HV.typeforce.Object),output:HV.typeforce.maybe(HV.typeforce.BufferN(22)),pubkey:HV.typeforce.maybe(HV.isPoint),signature:HV.typeforce.maybe(OV.isCanonicalScriptSignature),witness:HV.typeforce.maybe(HV.typeforce.arrayOf(HV.typeforce.Buffer))},e);const n=KV.value((()=>{const t=jV.bech32.decode(e.address),n=t.words.shift(),r=jV.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:ao.from(r)}})),r=e.network||RV.bitcoin,i={name:"p2wpkh",network:r};if(KV.prop(i,"address",(()=>{if(!i.hash)return;const e=jV.bech32.toWords(i.hash);return e.unshift(0),jV.bech32.encode(r.bech32,e)})),KV.prop(i,"hash",(()=>e.output?e.output.slice(2,22):e.address?n().data:e.pubkey||i.pubkey?MV.hash160(e.pubkey||i.pubkey):void 0)),KV.prop(i,"output",(()=>{if(i.hash)return OV.compile([GV.OP_0,i.hash])})),KV.prop(i,"pubkey",(()=>e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0)),KV.prop(i,"signature",(()=>{if(e.witness)return e.witness[0]})),KV.prop(i,"input",(()=>{if(i.witness)return qV})),KV.prop(i,"witness",(()=>{if(e.pubkey&&e.signature)return[e.signature,e.pubkey]})),t.validate){let t=ao.from([]);if(e.address){if(r&&r.bech32!==n().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(20!==n().data.length)throw new TypeError("Invalid address data");t=n().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(22!==e.output.length||e.output[0]!==GV.OP_0||20!==e.output[1])throw new TypeError("Output is invalid");if(t.length>0&&!t.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");t=e.output.slice(2)}if(e.pubkey){const n=MV.hash160(e.pubkey);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");if(t=n,!(0,HV.isPoint)(e.pubkey)||33!==e.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(2!==e.witness.length)throw new TypeError("Witness is invalid");if(!OV.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,HV.isPoint)(e.witness[1])||33!==e.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");const n=MV.hash160(e.witness[1]);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(i,e)};var VV={};Object.defineProperty(VV,"__esModule",{value:!0}),VV.p2wsh=void 0;const zV=nV,JV=DG,YV=PG,XV=qG,WV=Pq,ZV=QV,$V=YV.OPS,ez=ao.alloc(0);function tz(e){return!(!jo(e)||65!==e.length||4!==e[0]||!(0,XV.isPoint)(e))}VV.p2wsh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,XV.typeforce)({network:XV.typeforce.maybe(XV.typeforce.Object),address:XV.typeforce.maybe(XV.typeforce.String),hash:XV.typeforce.maybe(XV.typeforce.BufferN(32)),output:XV.typeforce.maybe(XV.typeforce.BufferN(34)),redeem:XV.typeforce.maybe({input:XV.typeforce.maybe(XV.typeforce.Buffer),network:XV.typeforce.maybe(XV.typeforce.Object),output:XV.typeforce.maybe(XV.typeforce.Buffer),witness:XV.typeforce.maybe(XV.typeforce.arrayOf(XV.typeforce.Buffer))}),input:XV.typeforce.maybe(XV.typeforce.BufferN(0)),witness:XV.typeforce.maybe(XV.typeforce.arrayOf(XV.typeforce.Buffer))},e);const n=WV.value((()=>{const t=ZV.bech32.decode(e.address),n=t.words.shift(),r=ZV.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:ao.from(r)}})),r=WV.value((()=>YV.decompile(e.redeem.input)));let i=e.network;i||(i=e.redeem&&e.redeem.network||JV.bitcoin);const o={network:i};if(WV.prop(o,"address",(()=>{if(!o.hash)return;const e=ZV.bech32.toWords(o.hash);return e.unshift(0),ZV.bech32.encode(i.bech32,e)})),WV.prop(o,"hash",(()=>e.output?e.output.slice(2):e.address?n().data:o.redeem&&o.redeem.output?zV.sha256(o.redeem.output):void 0)),WV.prop(o,"output",(()=>{if(o.hash)return YV.compile([$V.OP_0,o.hash])})),WV.prop(o,"redeem",(()=>{if(e.witness)return{output:e.witness[e.witness.length-1],input:ez,witness:e.witness.slice(0,-1)}})),WV.prop(o,"input",(()=>{if(o.witness)return ez})),WV.prop(o,"witness",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){const t=YV.toStack(r());return o.redeem=Object.assign({witness:t},e.redeem),o.redeem.input=ez,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)})),WV.prop(o,"name",(()=>{const e=["p2wsh"];return void 0!==o.redeem&&void 0!==o.redeem.name&&e.push(o.redeem.name),e.join("-")})),t.validate){let t=ao.from([]);if(e.address){if(n().prefix!==i.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(32!==n().data.length)throw new TypeError("Invalid address data");t=n().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(34!==e.output.length||e.output[0]!==$V.OP_0||32!==e.output[1])throw new TypeError("Output is invalid");const n=e.output.slice(2);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.redeem){if(e.redeem.network&&e.redeem.network!==i)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){if(0===YV.decompile(e.redeem.output).length)throw new TypeError("Redeem.output is invalid");const n=zV.sha256(e.redeem.output);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.redeem.input&&!YV.isPushOnly(r()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&r().some(tz)||e.redeem.output&&(YV.decompile(e.redeem.output)||[]).some(tz))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){const t=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&!e.redeem.output.equals(t))throw new TypeError("Witness and redeem.output mismatch");if(e.witness.some(tz)||(YV.decompile(t)||[]).some(tz))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(o,e)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.p2wsh=e.p2wpkh=e.p2sh=e.p2pkh=e.p2pk=e.p2ms=e.embed=void 0;const t=UG;Object.defineProperty(e,"embed",{enumerable:!0,get:function(){return t.p2data}});const n=Hq;Object.defineProperty(e,"p2ms",{enumerable:!0,get:function(){return n.p2ms}});const r=Yq;Object.defineProperty(e,"p2pk",{enumerable:!0,get:function(){return r.p2pk}});const i=tV;Object.defineProperty(e,"p2pkh",{enumerable:!0,get:function(){return i.p2pkh}});const o=vV;Object.defineProperty(e,"p2sh",{enumerable:!0,get:function(){return o.p2sh}});const a=SV;Object.defineProperty(e,"p2wpkh",{enumerable:!0,get:function(){return a.p2wpkh}});const s=VV;Object.defineProperty(e,"p2wsh",{enumerable:!0,get:function(){return s.p2wsh}})}(FG),Object.defineProperty(NG,"__esModule",{value:!0}),NG.toOutputScript=NG.fromOutputScript=NG.toBech32=NG.toBase58Check=NG.fromBech32=NG.fromBase58Check=void 0;const nz=DG,rz=FG,iz=PG,oz=qG,az=QV,sz=cV,{typeforce:lz}=oz,uz="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";function Az(e){const t=sz.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");return{version:t.readUInt8(0),hash:t.slice(1)}}function cz(e){let t,n;try{t=az.bech32.decode(e)}catch(e){}if(t){if(n=t.words[0],0!==n)throw new TypeError(e+" uses wrong encoding")}else if(t=az.bech32m.decode(e),n=t.words[0],0===n)throw new TypeError(e+" uses wrong encoding");const r=az.bech32.fromWords(t.words.slice(1));return{version:n,prefix:t.prefix,data:ao.from(r)}}function hz(e,t,n){const r=az.bech32.toWords(e);return r.unshift(t),0===t?az.bech32.encode(n,r):az.bech32m.encode(n,r)}NG.fromBase58Check=Az,NG.fromBech32=cz,NG.toBase58Check=function(e,t){lz(oz.tuple(oz.Hash160bit,oz.UInt8),arguments);const n=ao.allocUnsafe(21);return n.writeUInt8(t,0),e.copy(n,1),sz.encode(n)},NG.toBech32=hz,NG.fromOutputScript=function(e,t){t=t||nz.bitcoin;try{return rz.p2pkh({output:e,network:t}).address}catch(e){}try{return rz.p2sh({output:e,network:t}).address}catch(e){}try{return rz.p2wpkh({output:e,network:t}).address}catch(e){}try{return rz.p2wsh({output:e,network:t}).address}catch(e){}try{return function(e,t){const n=e.slice(2);if(n.length<2||n.length>40)throw new TypeError("Invalid program length for segwit address");const r=e[0]-80;if(r<1||r>16)throw new TypeError("Invalid version for segwit address");if(e[1]!==n.length)throw new TypeError("Invalid script for segwit address");return console.warn(uz),hz(n,r,t.bech32)}(e,t)}catch(e){}throw new Error(iz.toASM(e)+" has no matching Address")},NG.toOutputScript=function(e,t){let n,r;t=t||nz.bitcoin;try{n=Az(e)}catch(e){}if(n){if(n.version===t.pubKeyHash)return rz.p2pkh({hash:n.hash}).output;if(n.version===t.scriptHash)return rz.p2sh({hash:n.hash}).output}else{try{r=cz(e)}catch(e){}if(r){if(r.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===r.version){if(20===r.data.length)return rz.p2wpkh({hash:r.data}).output;if(32===r.data.length)return rz.p2wsh({hash:r.data}).output}else if(r.version>=1&&r.version<=16&&r.data.length>=2&&r.data.length<=40)return console.warn(uz),iz.compile([r.version+80,r.data])}}throw new Error(e+" has no matching Script")};var dz={},fz={},pz=ED.exports.Buffer;function gz(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function yz(e){return gz(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var mz={encode:function e(t,n,r){if(gz(t),n||(n=pz.allocUnsafe(yz(t))),!pz.isBuffer(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),e.bytes=1):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),e.bytes=3):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),e.bytes=5):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),e.bytes=9),n},decode:function e(t,n){if(!pz.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);var r=t.readUInt8(n);if(r<253)return e.bytes=1,r;if(253===r)return e.bytes=3,t.readUInt16LE(n+1);if(254===r)return e.bytes=5,t.readUInt32LE(n+1);e.bytes=9;var i=t.readUInt32LE(n+1),o=4294967296*t.readUInt32LE(n+5)+i;return gz(o),o},encodingLength:yz};Object.defineProperty(fz,"__esModule",{value:!0}),fz.BufferReader=fz.BufferWriter=fz.cloneBuffer=fz.reverseBuffer=fz.writeUInt64LE=fz.readUInt64LE=fz.varuint=void 0;const vz=qG,{typeforce:wz}=vz,Iz=mz;function bz(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function Bz(e,t){const n=e.readUInt32LE(t);let r=e.readUInt32LE(t+4);return r*=4294967296,bz(r+n,9007199254740991),r+n}function Ez(e,t,n){return bz(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8}fz.varuint=Iz,fz.readUInt64LE=Bz,fz.writeUInt64LE=Ez,fz.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,n=0;for(let r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},fz.cloneBuffer=function(e){const t=ao.allocUnsafe(e.length);return e.copy(t),t};class Cz{constructor(e,t=0){this.buffer=e,this.offset=t,wz(vz.tuple(vz.Buffer,vz.UInt32),[e,t])}static withCapacity(e){return new Cz(ao.alloc(e))}writeUInt8(e){this.offset=this.buffer.writeUInt8(e,this.offset)}writeInt32(e){this.offset=this.buffer.writeInt32LE(e,this.offset)}writeUInt32(e){this.offset=this.buffer.writeUInt32LE(e,this.offset)}writeUInt64(e){this.offset=Ez(this.buffer,e,this.offset)}writeVarInt(e){Iz.encode(e,this.buffer,this.offset),this.offset+=Iz.encode.bytes}writeSlice(e){if(this.buffer.length<this.offset+e.length)throw new Error("Cannot write slice out of bounds");this.offset+=e.copy(this.buffer,this.offset)}writeVarSlice(e){this.writeVarInt(e.length),this.writeSlice(e)}writeVector(e){this.writeVarInt(e.length),e.forEach((e=>this.writeVarSlice(e)))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}fz.BufferWriter=Cz,fz.BufferReader=class{constructor(e,t=0){this.buffer=e,this.offset=t,wz(vz.tuple(vz.Buffer,vz.UInt32),[e,t])}readUInt8(){const e=this.buffer.readUInt8(this.offset);return this.offset++,e}readInt32(){const e=this.buffer.readInt32LE(this.offset);return this.offset+=4,e}readUInt32(){const e=this.buffer.readUInt32LE(this.offset);return this.offset+=4,e}readUInt64(){const e=Bz(this.buffer,this.offset);return this.offset+=8,e}readVarInt(){const e=Iz.decode(this.buffer,this.offset);return this.offset+=Iz.decode.bytes,e}readSlice(e){if(this.buffer.length<this.offset+e)throw new Error("Cannot read slice out of bounds");const t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const e=this.readVarInt(),t=[];for(let n=0;n<e;n++)t.push(this.readVarSlice());return t}};var xz={};Object.defineProperty(xz,"__esModule",{value:!0}),xz.fastMerkleRoot=void 0,xz.fastMerkleRoot=function(e,t){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof t)throw TypeError("Expected digest Function");let n=e.length;const r=e.concat();for(;n>1;){let e=0;for(let i=0;i<n;i+=2,++e){const o=r[i],a=i+1===n?o:r[i+1],s=ao.concat([o,a]);r[e]=t(s)}n=e}return r[0]};var Sz={};Object.defineProperty(Sz,"__esModule",{value:!0}),Sz.Transaction=void 0;const Qz=fz,kz=nV,_z=PG,Nz=PG,Dz=qG,{typeforce:Fz}=Dz;function Uz(e){const t=e.length;return Qz.varuint.encodingLength(t)+t}const Pz=ao.allocUnsafe(0),Tz=[],Lz=ao.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),Mz=ao.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),Rz=ao.from("ffffffffffffffff","hex"),Oz={script:Pz,valueBuffer:Rz};class Hz{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(e,t){const n=new Qz.BufferReader(e),r=new Hz;r.version=n.readInt32();const i=n.readUInt8(),o=n.readUInt8();let a=!1;i===Hz.ADVANCED_TRANSACTION_MARKER&&o===Hz.ADVANCED_TRANSACTION_FLAG?a=!0:n.offset-=2;const s=n.readVarInt();for(let e=0;e<s;++e)r.ins.push({hash:n.readSlice(32),index:n.readUInt32(),script:n.readVarSlice(),sequence:n.readUInt32(),witness:Tz});const l=n.readVarInt();for(let e=0;e<l;++e)r.outs.push({value:n.readUInt64(),script:n.readVarSlice()});if(a){for(let e=0;e<s;++e)r.ins[e].witness=n.readVector();if(!r.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(r.locktime=n.readUInt32(),t)return r;if(n.offset!==e.length)throw new Error("Transaction has unexpected data");return r}static fromHex(e){return Hz.fromBuffer(ao.from(e,"hex"),!1)}static isCoinbaseHash(e){Fz(Dz.Hash256bit,e);for(let t=0;t<32;++t)if(0!==e[t])return!1;return!0}isCoinbase(){return 1===this.ins.length&&Hz.isCoinbaseHash(this.ins[0].hash)}addInput(e,t,n,r){return Fz(Dz.tuple(Dz.Hash256bit,Dz.UInt32,Dz.maybe(Dz.UInt32),Dz.maybe(Dz.Buffer)),arguments),Dz.Null(n)&&(n=Hz.DEFAULT_SEQUENCE),this.ins.push({hash:e,index:t,script:r||Pz,sequence:n,witness:Tz})-1}addOutput(e,t){return Fz(Dz.tuple(Dz.Buffer,Dz.Satoshi),arguments),this.outs.push({script:e,value:t})-1}hasWitnesses(){return this.ins.some((e=>0!==e.witness.length))}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(e=!0){const t=e&&this.hasWitnesses();return(t?10:8)+Qz.varuint.encodingLength(this.ins.length)+Qz.varuint.encodingLength(this.outs.length)+this.ins.reduce(((e,t)=>e+40+Uz(t.script)),0)+this.outs.reduce(((e,t)=>e+8+Uz(t.script)),0)+(t?this.ins.reduce(((e,t)=>e+function(e){const t=e.length;return Qz.varuint.encodingLength(t)+e.reduce(((e,t)=>e+Uz(t)),0)}(t.witness)),0):0)}clone(){const e=new Hz;return e.version=this.version,e.locktime=this.locktime,e.ins=this.ins.map((e=>({hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness}))),e.outs=this.outs.map((e=>({script:e.script,value:e.value}))),e}hashForSignature(e,t,n){if(Fz(Dz.tuple(Dz.UInt32,Dz.Buffer,Dz.Number),arguments),e>=this.ins.length)return Mz;const r=_z.compile(_z.decompile(t).filter((e=>e!==Nz.OPS.OP_CODESEPARATOR))),i=this.clone();if((31&n)===Hz.SIGHASH_NONE)i.outs=[],i.ins.forEach(((t,n)=>{n!==e&&(t.sequence=0)}));else if((31&n)===Hz.SIGHASH_SINGLE){if(e>=this.outs.length)return Mz;i.outs.length=e+1;for(let t=0;t<e;t++)i.outs[t]=Oz;i.ins.forEach(((t,n)=>{n!==e&&(t.sequence=0)}))}n&Hz.SIGHASH_ANYONECANPAY?(i.ins=[i.ins[e]],i.ins[0].script=r):(i.ins.forEach((e=>{e.script=Pz})),i.ins[e].script=r);const o=ao.allocUnsafe(i.byteLength(!1)+4);return o.writeInt32LE(n,o.length-4),i.__toBuffer(o,0,!1),kz.hash256(o)}hashForWitnessV1(e,t,n,r,i,o){if(Fz(Dz.tuple(Dz.UInt32,Fz.arrayOf(Dz.Buffer),Fz.arrayOf(Dz.Satoshi),Dz.UInt32),arguments),n.length!==this.ins.length||t.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const a=r===Hz.SIGHASH_DEFAULT?Hz.SIGHASH_ALL:r&Hz.SIGHASH_OUTPUT_MASK,s=(r&Hz.SIGHASH_INPUT_MASK)===Hz.SIGHASH_ANYONECANPAY,l=a===Hz.SIGHASH_NONE,u=a===Hz.SIGHASH_SINGLE;let A=Pz,c=Pz,h=Pz,d=Pz,f=Pz;if(!s){let e=Qz.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach((t=>{e.writeSlice(t.hash),e.writeUInt32(t.index)})),A=kz.sha256(e.end()),e=Qz.BufferWriter.withCapacity(8*this.ins.length),n.forEach((t=>e.writeUInt64(t))),c=kz.sha256(e.end()),e=Qz.BufferWriter.withCapacity(t.map(Uz).reduce(((e,t)=>e+t))),t.forEach((t=>e.writeVarSlice(t))),h=kz.sha256(e.end()),e=Qz.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach((t=>e.writeUInt32(t.sequence))),d=kz.sha256(e.end())}if(l||u){if(u&&e<this.outs.length){const t=this.outs[e],n=Qz.BufferWriter.withCapacity(8+Uz(t.script));n.writeUInt64(t.value),n.writeVarSlice(t.script),f=kz.sha256(n.end())}}else{const e=this.outs.map((e=>8+Uz(e.script))).reduce(((e,t)=>e+t)),t=Qz.BufferWriter.withCapacity(e);this.outs.forEach((e=>{t.writeUInt64(e.value),t.writeVarSlice(e.script)})),f=kz.sha256(t.end())}const p=(i?2:0)+(o?1:0),g=174-(s?49:0)-(l?32:0)+(o?32:0)+(i?37:0),y=Qz.BufferWriter.withCapacity(g);if(y.writeUInt8(r),y.writeInt32(this.version),y.writeUInt32(this.locktime),y.writeSlice(A),y.writeSlice(c),y.writeSlice(h),y.writeSlice(d),l||u||y.writeSlice(f),y.writeUInt8(p),s){const r=this.ins[e];y.writeSlice(r.hash),y.writeUInt32(r.index),y.writeUInt64(n[e]),y.writeVarSlice(t[e]),y.writeUInt32(r.sequence)}else y.writeUInt32(e);if(o){const e=Qz.BufferWriter.withCapacity(Uz(o));e.writeVarSlice(o),y.writeSlice(kz.sha256(e.end()))}return u&&y.writeSlice(f),i&&(y.writeSlice(i),y.writeUInt8(0),y.writeUInt32(4294967295)),kz.taggedHash("TapSighash",ao.concat([ao.of(0),y.end()]))}hashForWitnessV0(e,t,n,r){Fz(Dz.tuple(Dz.UInt32,Dz.Buffer,Dz.Satoshi,Dz.UInt32),arguments);let i,o=ao.from([]),a=Lz,s=Lz,l=Lz;if(r&Hz.SIGHASH_ANYONECANPAY||(o=ao.allocUnsafe(36*this.ins.length),i=new Qz.BufferWriter(o,0),this.ins.forEach((e=>{i.writeSlice(e.hash),i.writeUInt32(e.index)})),s=kz.hash256(o)),r&Hz.SIGHASH_ANYONECANPAY||(31&r)===Hz.SIGHASH_SINGLE||(31&r)===Hz.SIGHASH_NONE||(o=ao.allocUnsafe(4*this.ins.length),i=new Qz.BufferWriter(o,0),this.ins.forEach((e=>{i.writeUInt32(e.sequence)})),l=kz.hash256(o)),(31&r)!==Hz.SIGHASH_SINGLE&&(31&r)!==Hz.SIGHASH_NONE){const e=this.outs.reduce(((e,t)=>e+8+Uz(t.script)),0);o=ao.allocUnsafe(e),i=new Qz.BufferWriter(o,0),this.outs.forEach((e=>{i.writeUInt64(e.value),i.writeVarSlice(e.script)})),a=kz.hash256(o)}else if((31&r)===Hz.SIGHASH_SINGLE&&e<this.outs.length){const t=this.outs[e];o=ao.allocUnsafe(8+Uz(t.script)),i=new Qz.BufferWriter(o,0),i.writeUInt64(t.value),i.writeVarSlice(t.script),a=kz.hash256(o)}o=ao.allocUnsafe(156+Uz(t)),i=new Qz.BufferWriter(o,0);const u=this.ins[e];return i.writeInt32(this.version),i.writeSlice(s),i.writeSlice(l),i.writeSlice(u.hash),i.writeUInt32(u.index),i.writeVarSlice(t),i.writeUInt64(n),i.writeUInt32(u.sequence),i.writeSlice(a),i.writeUInt32(this.locktime),i.writeUInt32(r),kz.hash256(o)}getHash(e){return e&&this.isCoinbase()?ao.alloc(32,0):kz.hash256(this.__toBuffer(void 0,void 0,e))}getId(){return(0,Qz.reverseBuffer)(this.getHash(!1)).toString("hex")}toBuffer(e,t){return this.__toBuffer(e,t,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(e,t){Fz(Dz.tuple(Dz.Number,Dz.Buffer),arguments),this.ins[e].script=t}setWitness(e,t){Fz(Dz.tuple(Dz.Number,[Dz.Buffer]),arguments),this.ins[e].witness=t}__toBuffer(e,t,n=!1){e||(e=ao.allocUnsafe(this.byteLength(n)));const r=new Qz.BufferWriter(e,t||0);r.writeInt32(this.version);const i=n&&this.hasWitnesses();return i&&(r.writeUInt8(Hz.ADVANCED_TRANSACTION_MARKER),r.writeUInt8(Hz.ADVANCED_TRANSACTION_FLAG)),r.writeVarInt(this.ins.length),this.ins.forEach((e=>{r.writeSlice(e.hash),r.writeUInt32(e.index),r.writeVarSlice(e.script),r.writeUInt32(e.sequence)})),r.writeVarInt(this.outs.length),this.outs.forEach((e=>{void 0!==e.value?r.writeUInt64(e.value):r.writeSlice(e.valueBuffer),r.writeVarSlice(e.script)})),i&&this.ins.forEach((e=>{r.writeVector(e.witness)})),r.writeUInt32(this.locktime),void 0!==t?e.slice(t,r.offset):e}}Sz.Transaction=Hz,Hz.DEFAULT_SEQUENCE=4294967295,Hz.SIGHASH_DEFAULT=0,Hz.SIGHASH_ALL=1,Hz.SIGHASH_NONE=2,Hz.SIGHASH_SINGLE=3,Hz.SIGHASH_ANYONECANPAY=128,Hz.SIGHASH_OUTPUT_MASK=3,Hz.SIGHASH_INPUT_MASK=128,Hz.ADVANCED_TRANSACTION_MARKER=0,Hz.ADVANCED_TRANSACTION_FLAG=1,Object.defineProperty(dz,"__esModule",{value:!0}),dz.Block=void 0;const Kz=fz,jz=nV,Gz=xz,qz=Sz,Vz=qG,{typeforce:zz}=Vz,Jz=new TypeError("Cannot compute merkle root for zero transactions"),Yz=new TypeError("Cannot compute witness commit for non-segwit block");class Xz{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(e){if(e.length<80)throw new Error("Buffer too small (< 80 bytes)");const t=new Kz.BufferReader(e),n=new Xz;if(n.version=t.readInt32(),n.prevHash=t.readSlice(32),n.merkleRoot=t.readSlice(32),n.timestamp=t.readUInt32(),n.bits=t.readUInt32(),n.nonce=t.readUInt32(),80===e.length)return n;const r=()=>{const e=qz.Transaction.fromBuffer(t.buffer.slice(t.offset),!0);return t.offset+=e.byteLength(),e},i=t.readVarInt();n.transactions=[];for(let e=0;e<i;++e){const e=r();n.transactions.push(e)}const o=n.getWitnessCommit();return o&&(n.witnessCommit=o),n}static fromHex(e){return Xz.fromBuffer(ao.from(e,"hex"))}static calculateTarget(e){const t=((4278190080&e)>>24)-3,n=8388607&e,r=ao.alloc(32,0);return r.writeUIntBE(n,29-t,3),r}static calculateMerkleRoot(e,t){if(zz([{getHash:Vz.Function}],e),0===e.length)throw Jz;if(t&&!Wz(e))throw Yz;const n=e.map((e=>e.getHash(t))),r=(0,Gz.fastMerkleRoot)(n,jz.hash256);return t?jz.hash256(ao.concat([r,e[0].ins[0].witness[0]])):r}getWitnessCommit(){if(!Wz(this.transactions))return null;const e=this.transactions[0].outs.filter((e=>e.script.slice(0,6).equals(ao.from("6a24aa21a9ed","hex")))).map((e=>e.script.slice(6,38)));if(0===e.length)return null;const t=e[e.length-1];return t instanceof ao&&32===t.length?t:null}hasWitnessCommit(){return this.witnessCommit instanceof ao&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(e=this.transactions)instanceof Array&&e.some((e=>"object"==typeof e&&e.ins instanceof Array&&e.ins.some((e=>"object"==typeof e&&e.witness instanceof Array&&e.witness.length>0))));var e}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(e,t=!0){return e||!this.transactions?80:80+Kz.varuint.encodingLength(this.transactions.length)+this.transactions.reduce(((e,n)=>e+n.byteLength(t)),0)}getHash(){return jz.hash256(this.toBuffer(!0))}getId(){return(0,Kz.reverseBuffer)(this.getHash()).toString("hex")}getUTCDate(){const e=new Date(0);return e.setUTCSeconds(this.timestamp),e}toBuffer(e){const t=ao.allocUnsafe(this.byteLength(e)),n=new Kz.BufferWriter(t);return n.writeInt32(this.version),n.writeSlice(this.prevHash),n.writeSlice(this.merkleRoot),n.writeUInt32(this.timestamp),n.writeUInt32(this.bits),n.writeUInt32(this.nonce),e||!this.transactions||(Kz.varuint.encode(this.transactions.length,t,n.offset),n.offset+=Kz.varuint.encode.bytes,this.transactions.forEach((e=>{const r=e.byteLength();e.toBuffer(t,n.offset),n.offset+=r}))),t}toHex(e){return this.toBuffer(e).toString("hex")}checkTxRoots(){const e=this.hasWitnessCommit();return!(!e&&this.hasWitness())&&this.__checkMerkleRoot()&&(!e||this.__checkWitnessCommit())}checkProofOfWork(){const e=(0,Kz.reverseBuffer)(this.getHash()),t=Xz.calculateTarget(this.bits);return e.compare(t)<=0}__checkMerkleRoot(){if(!this.transactions)throw Jz;const e=Xz.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(e)}__checkWitnessCommit(){if(!this.transactions)throw Jz;if(!this.hasWitnessCommit())throw Yz;const e=Xz.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(e)}}function Wz(e){return e instanceof Array&&e[0]&&e[0].ins&&e[0].ins instanceof Array&&e[0].ins[0]&&e[0].ins[0].witness&&e[0].ins[0].witness instanceof Array&&e[0].ins[0].witness.length>0}dz.Block=Xz;var Zz={},$z={},eJ={},tJ={},nJ={},rJ={},iJ={};!function(e){var t,n,r;Object.defineProperty(e,"__esModule",{value:!0}),(t=e.GlobalTypes||(e.GlobalTypes={}))[t.UNSIGNED_TX=0]="UNSIGNED_TX",t[t.GLOBAL_XPUB=1]="GLOBAL_XPUB",e.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],(n=e.InputTypes||(e.InputTypes={}))[n.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",n[n.WITNESS_UTXO=1]="WITNESS_UTXO",n[n.PARTIAL_SIG=2]="PARTIAL_SIG",n[n.SIGHASH_TYPE=3]="SIGHASH_TYPE",n[n.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",n[n.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",n[n.BIP32_DERIVATION=6]="BIP32_DERIVATION",n[n.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",n[n.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",n[n.POR_COMMITMENT=9]="POR_COMMITMENT",n[n.TAP_KEY_SIG=19]="TAP_KEY_SIG",n[n.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",n[n.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",n[n.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",n[n.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",n[n.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT",e.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],(r=e.OutputTypes||(e.OutputTypes={}))[r.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",r[r.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",r[r.BIP32_DERIVATION=2]="BIP32_DERIVATION",r[r.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",r[r.TAP_TREE=6]="TAP_TREE",r[r.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION",e.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]}(iJ);var oJ={};Object.defineProperty(oJ,"__esModule",{value:!0});const aJ=iJ;oJ.decode=function(e){if(e.key[0]!==aJ.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+e.key.toString("hex"));if(79!==e.key.length||![2,3].includes(e.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const t=e.key.slice(1),n={masterFingerprint:e.value.slice(0,4),extendedPubkey:t,path:"m"};for(const t of(r=e.value.length/4-1,[...Array(r).keys()])){const r=e.value.readUInt32LE(4*t+4),i=!!(2147483648&r),o=2147483647&r;n.path+="/"+o.toString(10)+(i?"'":"")}var r;return n},oJ.encode=function(e){const t=ao.from([aJ.GlobalTypes.GLOBAL_XPUB]),n=ao.concat([t,e.extendedPubkey]),r=e.path.split("/"),i=ao.allocUnsafe(4*r.length);e.masterFingerprint.copy(i,0);let o=4;return r.slice(1).forEach((e=>{const t="'"===e.slice(-1);let n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),i.writeUInt32LE(n,o),o+=4})),{key:n,value:i}},oJ.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",oJ.check=function(e){const t=e.extendedPubkey,n=e.masterFingerprint,r=e.path;return jo(t)&&78===t.length&&[2,3].indexOf(t[45])>-1&&jo(n)&&4===n.length&&"string"==typeof r&&!!r.match(/^m(\/\d+'?)*$/)},oJ.canAddToArray=function(e,t,n){const r=t.extendedPubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.extendedPubkey.equals(t.extendedPubkey))).length)};var sJ={};Object.defineProperty(sJ,"__esModule",{value:!0});const lJ=iJ;sJ.encode=function(e){return{key:ao.from([lJ.GlobalTypes.UNSIGNED_TX]),value:e.toBuffer()}};var uJ={};Object.defineProperty(uJ,"__esModule",{value:!0});const AJ=iJ;uJ.decode=function(e){if(e.key[0]!==AJ.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+e.key.toString("hex"));return e.value},uJ.encode=function(e){return{key:ao.from([AJ.InputTypes.FINAL_SCRIPTSIG]),value:e}},uJ.expected="Buffer",uJ.check=function(e){return jo(e)},uJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptSig};var cJ={};Object.defineProperty(cJ,"__esModule",{value:!0});const hJ=iJ;cJ.decode=function(e){if(e.key[0]!==hJ.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+e.key.toString("hex"));return e.value},cJ.encode=function(e){return{key:ao.from([hJ.InputTypes.FINAL_SCRIPTWITNESS]),value:e}},cJ.expected="Buffer",cJ.check=function(e){return jo(e)},cJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptWitness};var dJ={};Object.defineProperty(dJ,"__esModule",{value:!0});const fJ=iJ;dJ.decode=function(e){if(e.key[0]!==fJ.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+e.key.toString("hex"));return e.value},dJ.encode=function(e){return{key:ao.from([fJ.InputTypes.NON_WITNESS_UTXO]),value:e}},dJ.expected="Buffer",dJ.check=function(e){return jo(e)},dJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.nonWitnessUtxo};var pJ={};Object.defineProperty(pJ,"__esModule",{value:!0});const gJ=iJ;pJ.decode=function(e){if(e.key[0]!==gJ.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+e.key.toString("hex"));if(34!==e.key.length&&66!==e.key.length||![2,3,4].includes(e.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1),signature:e.value}},pJ.encode=function(e){const t=ao.from([gJ.InputTypes.PARTIAL_SIG]);return{key:ao.concat([t,e.pubkey]),value:e.signature}},pJ.expected="{ pubkey: Buffer; signature: Buffer; }",pJ.check=function(e){return jo(e.pubkey)&&jo(e.signature)&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&function(e){if(!jo(e)||e.length<9)return!1;if(48!==e[0])return!1;if(e.length!==e[1]+3)return!1;if(2!==e[2])return!1;const t=e[3];if(t>33||t<1)return!1;if(2!==e[3+t+1])return!1;const n=e[3+t+2];return!(n>33||n<1)&&e.length===3+t+2+n+2}(e.signature)},pJ.canAddToArray=function(e,t,n){const r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)};var yJ={};Object.defineProperty(yJ,"__esModule",{value:!0});const mJ=iJ;yJ.decode=function(e){if(e.key[0]!==mJ.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+e.key.toString("hex"));return e.value.toString("utf8")},yJ.encode=function(e){return{key:ao.from([mJ.InputTypes.POR_COMMITMENT]),value:ao.from(e,"utf8")}},yJ.expected="string",yJ.check=function(e){return"string"==typeof e},yJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.porCommitment};var vJ={};Object.defineProperty(vJ,"__esModule",{value:!0});const wJ=iJ;vJ.decode=function(e){if(e.key[0]!==wJ.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+e.key.toString("hex"));return e.value.readUInt32LE(0)},vJ.encode=function(e){const t=ao.from([wJ.InputTypes.SIGHASH_TYPE]),n=ao.allocUnsafe(4);return n.writeUInt32LE(e,0),{key:t,value:n}},vJ.expected="number",vJ.check=function(e){return"number"==typeof e},vJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.sighashType};var IJ={};Object.defineProperty(IJ,"__esModule",{value:!0});const bJ=iJ;function BJ(e){return jo(e)&&(64===e.length||65===e.length)}IJ.decode=function(e){if(e.key[0]!==bJ.InputTypes.TAP_KEY_SIG||1!==e.key.length)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+e.key.toString("hex"));if(!BJ(e.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return e.value},IJ.encode=function(e){return{key:ao.from([bJ.InputTypes.TAP_KEY_SIG]),value:e}},IJ.expected="Buffer",IJ.check=BJ,IJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapKeySig};var EJ={};Object.defineProperty(EJ,"__esModule",{value:!0});const CJ=iJ;EJ.decode=function(e){if(e.key[0]!==CJ.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+e.key.toString("hex"));if((e.key.length-2)%32!=0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+e.key.toString("hex"));const t=e.value[e.value.length-1];if((254&e.key[1])!==t)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+e.key.toString("hex"));const n=e.value.slice(0,-1);return{controlBlock:e.key.slice(1),script:n,leafVersion:t}},EJ.encode=function(e){const t=ao.from([CJ.InputTypes.TAP_LEAF_SCRIPT]),n=ao.from([e.leafVersion]);return{key:ao.concat([t,e.controlBlock]),value:ao.concat([e.script,n])}},EJ.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }",EJ.check=function(e){return jo(e.controlBlock)&&(e.controlBlock.length-1)%32==0&&(254&e.controlBlock[0])===e.leafVersion&&jo(e.script)},EJ.canAddToArray=function(e,t,n){const r=t.controlBlock.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.controlBlock.equals(t.controlBlock))).length)};var xJ={};Object.defineProperty(xJ,"__esModule",{value:!0});const SJ=iJ;function QJ(e){return jo(e)&&32===e.length}xJ.decode=function(e){if(e.key[0]!==SJ.InputTypes.TAP_MERKLE_ROOT||1!==e.key.length)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+e.key.toString("hex"));if(!QJ(e.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return e.value},xJ.encode=function(e){return{key:ao.from([SJ.InputTypes.TAP_MERKLE_ROOT]),value:e}},xJ.expected="Buffer",xJ.check=QJ,xJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapMerkleRoot};var kJ={};Object.defineProperty(kJ,"__esModule",{value:!0});const _J=iJ;kJ.decode=function(e){if(e.key[0]!==_J.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+e.key.toString("hex"));if(65!==e.key.length)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+e.key.toString("hex"));if(64!==e.value.length&&65!==e.value.length)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1,33),leafHash:e.key.slice(33),signature:e.value}},kJ.encode=function(e){const t=ao.from([_J.InputTypes.TAP_SCRIPT_SIG]);return{key:ao.concat([t,e.pubkey,e.leafHash]),value:e.signature}},kJ.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }",kJ.check=function(e){return jo(e.pubkey)&&jo(e.leafHash)&&jo(e.signature)&&32===e.pubkey.length&&32===e.leafHash.length&&(64===e.signature.length||65===e.signature.length)},kJ.canAddToArray=function(e,t,n){const r=t.pubkey.toString("hex")+t.leafHash.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey)&&e.leafHash.equals(t.leafHash))).length)};var NJ={},DJ={},FJ={};function UJ(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function PJ(e){return UJ(e),e<253?1:e<=65535?3:e<=4294967295?5:9}Object.defineProperty(FJ,"__esModule",{value:!0}),FJ.encode=function e(t,n,r){if(UJ(t),n||(n=ao.allocUnsafe(PJ(t))),!jo(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),Object.assign(e,{bytes:1})):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),Object.assign(e,{bytes:3})):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),Object.assign(e,{bytes:5})):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),Object.assign(e,{bytes:9})),n},FJ.decode=function e(t,n){if(!jo(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);const r=t.readUInt8(n);if(r<253)return Object.assign(e,{bytes:1}),r;if(253===r)return Object.assign(e,{bytes:3}),t.readUInt16LE(n+1);if(254===r)return Object.assign(e,{bytes:5}),t.readUInt32LE(n+1);{Object.assign(e,{bytes:9});const r=t.readUInt32LE(n+1),i=4294967296*t.readUInt32LE(n+5)+r;return UJ(i),i}},FJ.encodingLength=PJ,Object.defineProperty(DJ,"__esModule",{value:!0});const TJ=FJ;function LJ(e){const t=e.key.length,n=e.value.length,r=TJ.encodingLength(t),i=TJ.encodingLength(n),o=ao.allocUnsafe(r+t+i+n);return TJ.encode(t,o,0),e.key.copy(o,r),TJ.encode(n,o,r+t),e.value.copy(o,r+t+i),o}function MJ(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}DJ.range=e=>[...Array(e).keys()],DJ.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,n=0;for(let r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},DJ.keyValsToBuffer=function(e){const t=e.map(LJ);return t.push(ao.from([0])),ao.concat(t)},DJ.keyValToBuffer=LJ,DJ.readUInt64LE=function(e,t){const n=e.readUInt32LE(t);let r=e.readUInt32LE(t+4);return r*=4294967296,MJ(r+n,9007199254740991),r+n},DJ.writeUInt64LE=function(e,t,n){return MJ(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8},Object.defineProperty(NJ,"__esModule",{value:!0});const RJ=iJ,OJ=DJ,HJ=FJ;NJ.decode=function(e){if(e.key[0]!==RJ.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+e.key.toString("hex"));const t=OJ.readUInt64LE(e.value,0);let n=8;const r=HJ.decode(e.value,n);n+=HJ.encodingLength(r);const i=e.value.slice(n);if(i.length!==r)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:i,value:t}},NJ.encode=function(e){const{script:t,value:n}=e,r=HJ.encodingLength(t.length),i=ao.allocUnsafe(8+r+t.length);return OJ.writeUInt64LE(i,n,0),HJ.encode(t.length,i,8),t.copy(i,8+r),{key:ao.from([RJ.InputTypes.WITNESS_UTXO]),value:i}},NJ.expected="{ script: Buffer; value: number; }",NJ.check=function(e){return jo(e.script)&&"number"==typeof e.value},NJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.witnessUtxo};var KJ={};Object.defineProperty(KJ,"__esModule",{value:!0});const jJ=iJ,GJ=FJ;KJ.decode=function(e){if(e.key[0]!==jJ.OutputTypes.TAP_TREE||1!==e.key.length)throw new Error("Decode Error: could not decode tapTree with key 0x"+e.key.toString("hex"));let t=0;const n=[];for(;t<e.value.length;){const r=e.value[t++],i=e.value[t++],o=GJ.decode(e.value,t);t+=GJ.encodingLength(o),n.push({depth:r,leafVersion:i,script:e.value.slice(t,t+o)}),t+=o}return{leaves:n}},KJ.encode=function(e){const t=ao.from([jJ.OutputTypes.TAP_TREE]),n=[].concat(...e.leaves.map((e=>[ao.of(e.depth,e.leafVersion),GJ.encode(e.script.length),e.script])));return{key:t,value:ao.concat(n)}},KJ.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }",KJ.check=function(e){return Array.isArray(e.leaves)&&e.leaves.every((e=>e.depth>=0&&e.depth<=128&&(254&e.leafVersion)===e.leafVersion&&jo(e.script)))},KJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapTree};var qJ={};Object.defineProperty(qJ,"__esModule",{value:!0});const VJ=e=>33===e.length&&[2,3].includes(e[0])||65===e.length&&4===e[0];qJ.makeConverter=function(e,t=VJ){return{decode:function(n){if(n.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+n.key.toString("hex"));const r=n.key.slice(1);if(!t(r))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+n.key.toString("hex"));if(n.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const i={masterFingerprint:n.value.slice(0,4),pubkey:r,path:"m"};for(const e of(o=n.value.length/4-1,[...Array(o).keys()])){const t=n.value.readUInt32LE(4*e+4),r=!!(2147483648&t),o=2147483647&t;i.path+="/"+o.toString(10)+(r?"'":"")}var o;return i},encode:function(t){const n=ao.from([e]),r=ao.concat([n,t.pubkey]),i=t.path.split("/"),o=ao.allocUnsafe(4*i.length);t.masterFingerprint.copy(o,0);let a=4;return i.slice(1).forEach((e=>{const t="'"===e.slice(-1);let n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),o.writeUInt32LE(n,a),a+=4})),{key:r,value:o}},check:function(e){return jo(e.pubkey)&&jo(e.masterFingerprint)&&"string"==typeof e.path&&t(e.pubkey)&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(e,t,n){const r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)}}};var zJ={};Object.defineProperty(zJ,"__esModule",{value:!0}),zJ.makeChecker=function(e){return function(t){let n;if(e.includes(t.key[0])&&(n=t.key.slice(1),33!==n.length&&65!==n.length||![2,3,4].includes(n[0])))throw new Error("Format Error: invalid pubkey in key 0x"+t.key.toString("hex"));return n}};var JJ={};Object.defineProperty(JJ,"__esModule",{value:!0}),JJ.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.redeemScript}}};var YJ={};Object.defineProperty(YJ,"__esModule",{value:!0});const XJ=FJ,WJ=qJ,ZJ=e=>32===e.length;YJ.makeConverter=function(e){const t=WJ.makeConverter(e,ZJ);return{decode:function(e){const n=XJ.decode(e.value),r=XJ.encodingLength(n),i=t.decode({key:e.key,value:e.value.slice(r+32*n)}),o=new Array(n);for(let t=0,i=r;t<n;t++,i+=32)o[t]=e.value.slice(i,i+32);return Object.assign({},i,{leafHashes:o})},encode:function(e){const n=t.encode(e),r=XJ.encodingLength(e.leafHashes.length),i=ao.allocUnsafe(r);XJ.encode(e.leafHashes.length,i);const o=ao.concat([i,...e.leafHashes,n.value]);return Object.assign({},n,{value:o})},check:function(e){return Array.isArray(e.leafHashes)&&e.leafHashes.every((e=>jo(e)&&32===e.length))&&t.check(e)},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; leafHashes: Buffer[]; }",canAddToArray:t.canAddToArray}};var $J={};Object.defineProperty($J,"__esModule",{value:!0}),$J.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e||1!==t.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+t.key.toString("hex"));if(32!==t.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)&&32===e.length},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.tapInternalKey}}};var eY={};Object.defineProperty(eY,"__esModule",{value:!0}),eY.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.witnessScript}}},Object.defineProperty(rJ,"__esModule",{value:!0});const tY=iJ,nY=uJ,rY=cJ,iY=dJ,oY=pJ,aY=yJ,sY=vJ,lY=IJ,uY=EJ,AY=xJ,cY=kJ,hY=NJ,dY=KJ,fY=qJ,pY=zJ,gY=JJ,yY=YJ,mY=$J,vY=eY,wY={unsignedTx:sJ,globalXpub:oJ,checkPubkey:pY.makeChecker([])};rJ.globals=wY;const IY={nonWitnessUtxo:iY,partialSig:oY,sighashType:sY,finalScriptSig:nY,finalScriptWitness:rY,porCommitment:aY,witnessUtxo:hY,bip32Derivation:fY.makeConverter(tY.InputTypes.BIP32_DERIVATION),redeemScript:gY.makeConverter(tY.InputTypes.REDEEM_SCRIPT),witnessScript:vY.makeConverter(tY.InputTypes.WITNESS_SCRIPT),checkPubkey:pY.makeChecker([tY.InputTypes.PARTIAL_SIG,tY.InputTypes.BIP32_DERIVATION]),tapKeySig:lY,tapScriptSig:cY,tapLeafScript:uY,tapBip32Derivation:yY.makeConverter(tY.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:mY.makeConverter(tY.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot:AY};rJ.inputs=IY;const bY={bip32Derivation:fY.makeConverter(tY.OutputTypes.BIP32_DERIVATION),redeemScript:gY.makeConverter(tY.OutputTypes.REDEEM_SCRIPT),witnessScript:vY.makeConverter(tY.OutputTypes.WITNESS_SCRIPT),checkPubkey:pY.makeChecker([tY.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:yY.makeConverter(tY.OutputTypes.TAP_BIP32_DERIVATION),tapTree:dY,tapInternalKey:mY.makeConverter(tY.OutputTypes.TAP_INTERNAL_KEY)};rJ.outputs=bY,Object.defineProperty(nJ,"__esModule",{value:!0});const BY=rJ,EY=DJ,CY=FJ,xY=iJ;function SY(e,t,n){if(!t.equals(ao.from([n])))throw new Error(`Format Error: Invalid ${e} key: ${t.toString("hex")}`)}function QY(e,{globalMapKeyVals:t,inputKeyVals:n,outputKeyVals:r}){const i={unsignedTx:e};let o=0;for(const e of t)switch(e.key[0]){case xY.GlobalTypes.UNSIGNED_TX:if(SY("global",e.key,xY.GlobalTypes.UNSIGNED_TX),o>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");o++;break;case xY.GlobalTypes.GLOBAL_XPUB:void 0===i.globalXpub&&(i.globalXpub=[]),i.globalXpub.push(BY.globals.globalXpub.decode(e));break;default:i.unknownKeyVals||(i.unknownKeyVals=[]),i.unknownKeyVals.push(e)}const a=n.length,s=r.length,l=[],u=[];for(const e of EY.range(a)){const t={};for(const r of n[e])switch(BY.inputs.checkPubkey(r),r.key[0]){case xY.InputTypes.NON_WITNESS_UTXO:if(SY("input",r.key,xY.InputTypes.NON_WITNESS_UTXO),void 0!==t.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");t.nonWitnessUtxo=BY.inputs.nonWitnessUtxo.decode(r);break;case xY.InputTypes.WITNESS_UTXO:if(SY("input",r.key,xY.InputTypes.WITNESS_UTXO),void 0!==t.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");t.witnessUtxo=BY.inputs.witnessUtxo.decode(r);break;case xY.InputTypes.PARTIAL_SIG:void 0===t.partialSig&&(t.partialSig=[]),t.partialSig.push(BY.inputs.partialSig.decode(r));break;case xY.InputTypes.SIGHASH_TYPE:if(SY("input",r.key,xY.InputTypes.SIGHASH_TYPE),void 0!==t.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");t.sighashType=BY.inputs.sighashType.decode(r);break;case xY.InputTypes.REDEEM_SCRIPT:if(SY("input",r.key,xY.InputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");t.redeemScript=BY.inputs.redeemScript.decode(r);break;case xY.InputTypes.WITNESS_SCRIPT:if(SY("input",r.key,xY.InputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");t.witnessScript=BY.inputs.witnessScript.decode(r);break;case xY.InputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(BY.inputs.bip32Derivation.decode(r));break;case xY.InputTypes.FINAL_SCRIPTSIG:SY("input",r.key,xY.InputTypes.FINAL_SCRIPTSIG),t.finalScriptSig=BY.inputs.finalScriptSig.decode(r);break;case xY.InputTypes.FINAL_SCRIPTWITNESS:SY("input",r.key,xY.InputTypes.FINAL_SCRIPTWITNESS),t.finalScriptWitness=BY.inputs.finalScriptWitness.decode(r);break;case xY.InputTypes.POR_COMMITMENT:SY("input",r.key,xY.InputTypes.POR_COMMITMENT),t.porCommitment=BY.inputs.porCommitment.decode(r);break;case xY.InputTypes.TAP_KEY_SIG:SY("input",r.key,xY.InputTypes.TAP_KEY_SIG),t.tapKeySig=BY.inputs.tapKeySig.decode(r);break;case xY.InputTypes.TAP_SCRIPT_SIG:void 0===t.tapScriptSig&&(t.tapScriptSig=[]),t.tapScriptSig.push(BY.inputs.tapScriptSig.decode(r));break;case xY.InputTypes.TAP_LEAF_SCRIPT:void 0===t.tapLeafScript&&(t.tapLeafScript=[]),t.tapLeafScript.push(BY.inputs.tapLeafScript.decode(r));break;case xY.InputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(BY.inputs.tapBip32Derivation.decode(r));break;case xY.InputTypes.TAP_INTERNAL_KEY:SY("input",r.key,xY.InputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=BY.inputs.tapInternalKey.decode(r);break;case xY.InputTypes.TAP_MERKLE_ROOT:SY("input",r.key,xY.InputTypes.TAP_MERKLE_ROOT),t.tapMerkleRoot=BY.inputs.tapMerkleRoot.decode(r);break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(r)}l.push(t)}for(const e of EY.range(s)){const t={};for(const n of r[e])switch(BY.outputs.checkPubkey(n),n.key[0]){case xY.OutputTypes.REDEEM_SCRIPT:if(SY("output",n.key,xY.OutputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");t.redeemScript=BY.outputs.redeemScript.decode(n);break;case xY.OutputTypes.WITNESS_SCRIPT:if(SY("output",n.key,xY.OutputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");t.witnessScript=BY.outputs.witnessScript.decode(n);break;case xY.OutputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(BY.outputs.bip32Derivation.decode(n));break;case xY.OutputTypes.TAP_INTERNAL_KEY:SY("output",n.key,xY.OutputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=BY.outputs.tapInternalKey.decode(n);break;case xY.OutputTypes.TAP_TREE:SY("output",n.key,xY.OutputTypes.TAP_TREE),t.tapTree=BY.outputs.tapTree.decode(n);break;case xY.OutputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(BY.outputs.tapBip32Derivation.decode(n));break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(n)}u.push(t)}return{globalMap:i,inputs:l,outputs:u}}nJ.psbtFromBuffer=function(e,t){let n=0;function r(){const t=CY.decode(e,n);n+=CY.encodingLength(t);const r=e.slice(n,n+t);return n+=t,r}function i(){return{key:r(),value:r()}}function o(){if(n>=e.length)throw new Error("Format Error: Unexpected End of PSBT");const t=0===e.readUInt8(n);return t&&n++,t}if(1886610036!==function(){const t=e.readUInt32BE(n);return n+=4,t}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const t=e.readUInt8(n);return n+=1,t}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const a=[],s={};for(;!o();){const e=i(),t=e.key.toString("hex");if(s[t])throw new Error("Format Error: Keys must be unique for global keymap: key "+t);s[t]=1,a.push(e)}const l=a.filter((e=>e.key[0]===xY.GlobalTypes.UNSIGNED_TX));if(1!==l.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const u=t(l[0].value),{inputCount:A,outputCount:c}=u.getInputOutputCounts(),h=[],d=[];for(const e of EY.range(A)){const t={},n=[];for(;!o();){const r=i(),o=r.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each input: input index "+e+" key "+o);t[o]=1,n.push(r)}h.push(n)}for(const e of EY.range(c)){const t={},n=[];for(;!o();){const r=i(),o=r.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each output: output index "+e+" key "+o);t[o]=1,n.push(r)}d.push(n)}return QY(u,{globalMapKeyVals:a,inputKeyVals:h,outputKeyVals:d})},nJ.checkKeyBuffer=SY,nJ.psbtFromKeyVals=QY;var kY={};Object.defineProperty(kY,"__esModule",{value:!0});const _Y=rJ,NY=DJ;kY.psbtToBuffer=function({globalMap:e,inputs:t,outputs:n}){const{globalKeyVals:r,inputKeyVals:i,outputKeyVals:o}=UY({globalMap:e,inputs:t,outputs:n}),a=NY.keyValsToBuffer(r),s=e=>0===e.length?[ao.from([0])]:e.map(NY.keyValsToBuffer),l=s(i),u=s(o),A=ao.allocUnsafe(5);return A.writeUIntBE(482972169471,0,5),ao.concat([A,a].concat(l,u))};const DY=(e,t)=>e.key.compare(t.key);function FY(e,t){const n=new Set,r=Object.entries(e).reduce(((e,[r,i])=>{if("unknownKeyVals"===r)return e;const o=t[r];if(void 0===o)return e;const a=(Array.isArray(i)?i:[i]).map(o.encode);return a.map((e=>e.key.toString("hex"))).forEach((e=>{if(n.has(e))throw new Error("Serialize Error: Duplicate key: "+e);n.add(e)})),e.concat(a)}),[]),i=e.unknownKeyVals?e.unknownKeyVals.filter((e=>!n.has(e.key.toString("hex")))):[];return r.concat(i).sort(DY)}function UY({globalMap:e,inputs:t,outputs:n}){return{globalKeyVals:FY(e,_Y.globals),inputKeyVals:t.map((e=>FY(e,_Y.inputs))),outputKeyVals:n.map((e=>FY(e,_Y.outputs)))}}kY.psbtToKeyVals=UY,function(e){function t(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),t(nJ),t(kY)}(tJ),Object.defineProperty(eJ,"__esModule",{value:!0});const PY=tJ;function TY(e,t,n){return r=>{if(e.has(r))return;const i=n.filter((e=>e.key.toString("hex")===r))[0];t.push(i),e.add(r)}}function LY(e){return e.globalMap.unsignedTx}function MY(e){const t=new Set;return e.forEach((e=>{const n=e.key.toString("hex");if(t.has(n))throw new Error("Combine: KeyValue Map keys should be unique");t.add(n)})),t}eJ.combine=function(e){const t=e[0],n=PY.psbtToKeyVals(t),r=e.slice(1);if(0===r.length)throw new Error("Combine: Nothing to combine");const i=LY(t);if(void 0===i)throw new Error("Combine: Self missing transaction");const o=MY(n.globalKeyVals),a=n.inputKeyVals.map(MY),s=n.outputKeyVals.map(MY);for(const e of r){const t=LY(e);if(void 0===t||!t.toBuffer().equals(i.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const r=PY.psbtToKeyVals(e);MY(r.globalKeyVals).forEach(TY(o,n.globalKeyVals,r.globalKeyVals)),r.inputKeyVals.map(MY).forEach(((e,t)=>e.forEach(TY(a[t],n.inputKeyVals[t],r.inputKeyVals[t])))),r.outputKeyVals.map(MY).forEach(((e,t)=>e.forEach(TY(s[t],n.outputKeyVals[t],r.outputKeyVals[t]))))}return PY.psbtFromKeyVals(i,{globalMapKeyVals:n.globalKeyVals,inputKeyVals:n.inputKeyVals,outputKeyVals:n.outputKeyVals})};var RY={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=rJ;function n(e,t){const n=e[t];if(void 0===n)throw new Error(`No input #${t}`);return n}function r(e,t){const n=e[t];if(void 0===n)throw new Error(`No output #${t}`);return n}function i(e,t,n,r){throw new Error(`Data for ${e} key ${t} is incorrect: Expected ${n} and got ${JSON.stringify(r)}`)}function o(e){return(n,r)=>{for(const o of Object.keys(n)){const a=n[o],{canAdd:s,canAddToArray:l,check:u,expected:A}=t[e+"s"][o]||{},c=!!l;if(u)if(c){if(!Array.isArray(a)||r[o]&&!Array.isArray(r[o]))throw new Error(`Key type ${o} must be an array`);a.every(u)||i(e,o,A,a);const t=r[o]||[],n=new Set;if(!a.every((e=>l(t,e,n))))throw new Error("Can not add duplicate data to array");r[o]=t.concat(a)}else{if(u(a)||i(e,o,A,a),!s(r,a))throw new Error(`Can not add duplicate data to ${e}`);r[o]=a}}}}e.checkForInput=n,e.checkForOutput=r,e.checkHasKey=function(e,t,n){if(e.key[0]<n)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(t&&0!==t.filter((t=>t.key.equals(e.key))).length)throw new Error(`Duplicate Key: ${e.key.toString("hex")}`)},e.getEnumLength=function(e){let t=0;return Object.keys(e).forEach((e=>{Number(isNaN(Number(e)))&&t++})),t},e.inputCheckUncleanFinalized=function(e,t){let n=!1;if(t.nonWitnessUtxo||t.witnessUtxo){const e=!!t.redeemScript,r=!!t.witnessScript,i=!e||!!t.finalScriptSig,o=!r||!!t.finalScriptWitness,a=!!t.finalScriptSig||!!t.finalScriptWitness;n=i&&o&&a}if(!1===n)throw new Error(`Input #${e} has too much or too little data to clean`)},e.updateGlobal=o("global"),e.updateInput=o("input"),e.updateOutput=o("output"),e.addInputAttributes=function(t,r){const i=n(t,t.length-1);e.updateInput(r,i)},e.addOutputAttributes=function(t,n){const i=r(t,t.length-1);e.updateOutput(n,i)},e.defaultVersionSetter=function(e,t){if(!jo(t)||t.length<4)throw new Error("Set Version: Invalid Transaction");return t.writeUInt32LE(e,0),t},e.defaultLocktimeSetter=function(e,t){if(!jo(t)||t.length<4)throw new Error("Set Locktime: Invalid Transaction");return t.writeUInt32LE(e,t.length-4),t}}(RY),Object.defineProperty($z,"__esModule",{value:!0});const OY=eJ,HY=tJ,KY=iJ,jY=RY;$z.Psbt=class{constructor(e){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:e}}static fromBase64(e,t){const n=ao.from(e,"base64");return this.fromBuffer(n,t)}static fromHex(e,t){const n=ao.from(e,"hex");return this.fromBuffer(n,t)}static fromBuffer(e,t){const n=HY.psbtFromBuffer(e,t),r=new this(n.globalMap.unsignedTx);return Object.assign(r,n),r}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return HY.psbtToBuffer(this)}updateGlobal(e){return jY.updateGlobal(e,this.globalMap),this}updateInput(e,t){const n=jY.checkForInput(this.inputs,e);return jY.updateInput(t,n),this}updateOutput(e,t){const n=jY.checkForOutput(this.outputs,e);return jY.updateOutput(t,n),this}addUnknownKeyValToGlobal(e){return jY.checkHasKey(e,this.globalMap.unknownKeyVals,jY.getEnumLength(KY.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(e),this}addUnknownKeyValToInput(e,t){const n=jY.checkForInput(this.inputs,e);return jY.checkHasKey(t,n.unknownKeyVals,jY.getEnumLength(KY.InputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}addUnknownKeyValToOutput(e,t){const n=jY.checkForOutput(this.outputs,e);return jY.checkHasKey(t,n.unknownKeyVals,jY.getEnumLength(KY.OutputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}addInput(e){this.globalMap.unsignedTx.addInput(e),this.inputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],n=this.inputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(n,e))),jY.addInputAttributes(this.inputs,e),this}addOutput(e){this.globalMap.unsignedTx.addOutput(e),this.outputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],n=this.outputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(n,e))),jY.addOutputAttributes(this.outputs,e),this}clearFinalizedInput(e){const t=jY.checkForInput(this.inputs,e);jY.inputCheckUncleanFinalized(e,t);for(const e of Object.keys(t))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(e)||delete t[e];return this}combine(...e){const t=OY.combine([this].concat(e));return Object.assign(this,t),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}},Object.defineProperty(Zz,"__esModule",{value:!0}),Zz.Psbt=void 0;const GY=$z,qY=FJ,VY=RY,zY=NG,JY=fz,YY=nV,XY=FG,WY=PG,ZY=Sz,$Y={network:DG.bitcoin,maximumFeeRate:5e3};class eX{constructor(e={},t=new GY.Psbt(new nX)){this.data=t,this.opts=Object.assign({},$Y,e),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const n=(e,t,n,r)=>Object.defineProperty(e,t,{enumerable:n,writable:r});n(this,"__CACHE",!1,!0),n(this,"opts",!1,!0)}static fromBase64(e,t={}){const n=ao.from(e,"base64");return this.fromBuffer(n,t)}static fromHex(e,t={}){const n=ao.from(e,"hex");return this.fromBuffer(n,t)}static fromBuffer(e,t={}){const n=GY.Psbt.fromBuffer(e,tX),r=new eX(t,n);return function(e,t){e.ins.forEach((e=>{gX(t,e)}))}(r.__CACHE.__TX,r.__CACHE),r}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(e){this.setVersion(e)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(e){this.setLocktime(e)}get txInputs(){return this.__CACHE.__TX.ins.map((e=>({hash:(0,JY.cloneBuffer)(e.hash),index:e.index,sequence:e.sequence})))}get txOutputs(){return this.__CACHE.__TX.outs.map((e=>{let t;try{t=(0,zY.fromOutputScript)(e.script,this.opts.network)}catch(e){}return{script:(0,JY.cloneBuffer)(e.script),value:e.value,address:t}}))}combine(...e){return this.data.combine(...e.map((e=>e.data))),this}clone(){const e=eX.fromBuffer(this.data.toBuffer());return e.opts=JSON.parse(JSON.stringify(this.opts)),e}setMaximumFeeRate(e){dX(e),this.opts.maximumFeeRate=e}setVersion(e){dX(e),fX(this.data.inputs,"setVersion");const t=this.__CACHE;return t.__TX.version=e,t.__EXTRACTED_TX=void 0,this}setLocktime(e){dX(e),fX(this.data.inputs,"setLocktime");const t=this.__CACHE;return t.__TX.locktime=e,t.__EXTRACTED_TX=void 0,this}setInputSequence(e,t){dX(t),fX(this.data.inputs,"setInputSequence");const n=this.__CACHE;if(n.__TX.ins.length<=e)throw new Error("Input index too high");return n.__TX.ins[e].sequence=t,n.__EXTRACTED_TX=void 0,this}addInputs(e){return e.forEach((e=>this.addInput(e))),this}addInput(e){if(arguments.length>1||!e||void 0===e.hash||void 0===e.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");fX(this.data.inputs,"addInput"),e.witnessScript&&DX(e.witnessScript);const t=this.__CACHE;this.data.addInput(e),gX(t,t.__TX.ins[t.__TX.ins.length-1]);const n=this.data.inputs.length-1,r=this.data.inputs[n];return r.nonWitnessUtxo&&xX(this.__CACHE,r,n),t.__FEE=void 0,t.__FEE_RATE=void 0,t.__EXTRACTED_TX=void 0,this}addOutputs(e){return e.forEach((e=>this.addOutput(e))),this}addOutput(e){if(arguments.length>1||!e||void 0===e.value||void 0===e.address&&void 0===e.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");fX(this.data.inputs,"addOutput");const{address:t}=e;if("string"==typeof t){const{network:n}=this.opts,r=(0,zY.toOutputScript)(t,n);e=Object.assign(e,{script:r})}const n=this.__CACHE;return this.data.addOutput(e),n.__FEE=void 0,n.__FEE_RATE=void 0,n.__EXTRACTED_TX=void 0,this}extractTransaction(e){if(!this.data.inputs.every(iX))throw new Error("Not finalized");const t=this.__CACHE;if(e||function(e,t,n){const r=t.__FEE_RATE||e.getFeeRate(),i=t.__EXTRACTED_TX.virtualSize(),o=r*i;if(r>=n.maximumFeeRate)throw new Error(`Warning: You are paying around ${(o/1e8).toFixed(8)} in fees, which is ${r} satoshi per byte for a transaction with a VSize of ${i} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}(this,t,this.opts),t.__EXTRACTED_TX)return t.__EXTRACTED_TX;const n=t.__TX.clone();return SX(this.data.inputs,n,t,!0),n}getFeeRate(){return wX("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return wX("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return(0,VY.checkForInput)(this.data.inputs,0),PX(this.data.inputs.length).forEach((e=>this.finalizeInput(e))),this}finalizeInput(e,t=IX){const n=(0,VY.checkForInput)(this.data.inputs,e),{script:r,isP2SH:i,isP2WSH:o,isSegwit:a}=function(e,t,n){const r=n.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!t.redeemScript,i.isP2WSH=!!t.witnessScript,t.witnessScript)i.script=t.witnessScript;else if(t.redeemScript)i.script=t.redeemScript;else if(t.nonWitnessUtxo){const o=QX(n,t,e),a=r.ins[e].index;i.script=o.outs[a].script}else t.witnessUtxo&&(i.script=t.witnessUtxo.script);return(t.witnessScript||uX(i.script))&&(i.isSegwit=!0),i}(e,n,this.__CACHE);if(!r)throw new Error(`No script found for input #${e}`);!function(e){if(!e.sighashType||!e.partialSig)return;const{partialSig:t,sighashType:n}=e;t.forEach((e=>{const{hashType:t}=WY.signature.decode(e.signature);if(n!==t)throw new Error("Signature sighash does not match input sighash type")}))}(n);const{finalScriptSig:s,finalScriptWitness:l}=t(e,n,r,a,i,o);if(s&&this.data.updateInput(e,{finalScriptSig:s}),l&&this.data.updateInput(e,{finalScriptWitness:l}),!s&&!l)throw new Error(`Unknown error finalizing input #${e}`);return this.data.clearFinalizedInput(e),this}getInputType(e){const t=(0,VY.checkForInput)(this.data.inputs,e),n=NX(kX(e,t,this.__CACHE),e,"input",t.redeemScript||function(e){if(!e)return;const t=WY.decompile(e);if(!t)return;const n=t[t.length-1];var r;if(jo(n)&&!_X(n)&&(r=n,!WY.isCanonicalScriptSignature(r))&&WY.decompile(n))return n}(t.finalScriptSig),t.witnessScript||function(e){if(!e)return;const t=CX(e),n=t[t.length-1];return!_X(n)&&WY.decompile(n)?n:void 0}(t.finalScriptWitness));return("raw"===n.type?"":n.type+"-")+UX(n.meaningfulScript)}inputHasPubkey(e,t){return function(e,t,n,r){const i=kX(n,t,r),{meaningfulScript:o}=NX(i,n,"input",t.redeemScript,t.witnessScript);return FX(e,o)}(t,(0,VY.checkForInput)(this.data.inputs,e),e,this.__CACHE)}inputHasHDKey(e,t){const n=(0,VY.checkForInput)(this.data.inputs,e),r=hX(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}outputHasPubkey(e,t){return function(e,t,n,r){const i=r.__TX.outs[n].script,{meaningfulScript:o}=NX(i,n,"output",t.redeemScript,t.witnessScript);return FX(e,o)}(t,(0,VY.checkForOutput)(this.data.outputs,e),e,this.__CACHE)}outputHasHDKey(e,t){const n=(0,VY.checkForOutput)(this.data.outputs,e),r=hX(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}validateSignaturesOfAllInputs(e){return(0,VY.checkForInput)(this.data.inputs,0),PX(this.data.inputs.length).map((t=>this.validateSignaturesOfInput(t,e))).reduce(((e,t)=>!0===t&&e),!0)}validateSignaturesOfInput(e,t,n){const r=this.data.inputs[e],i=(r||{}).partialSig;if(!r||!i||i.length<1)throw new Error("No signatures to validate");if("function"!=typeof t)throw new Error("Need validator function to validate signatures");const o=n?i.filter((e=>e.pubkey.equals(n))):i;if(o.length<1)throw new Error("No signatures for this pubkey");const a=[];let s,l,u;for(const n of o){const i=WY.signature.decode(n.signature),{hash:o,script:A}=u!==i.hashType?BX(e,Object.assign({},r,{sighashType:i.hashType}),this.__CACHE,!0):{hash:s,script:l};u=i.hashType,s=o,l=A,pX(n.pubkey,A,"verify"),a.push(t(n.pubkey,o,i.signature))}return a.every((e=>!0===e))}signAllInputsHD(e,t=[ZY.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");const n=[];for(const r of PX(this.data.inputs.length))try{this.signInputHD(r,e,t),n.push(!0)}catch(e){n.push(!1)}if(n.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(e,t=[ZY.Transaction.SIGHASH_ALL]){return new Promise(((n,r)=>{if(!e||!e.publicKey||!e.fingerprint)return r(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const n of PX(this.data.inputs.length))o.push(this.signInputHDAsync(n,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return r(new Error("No inputs were signed"));n()}))}))}signInputHD(e,t,n=[ZY.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");return EX(e,this.data.inputs,t).forEach((t=>this.signInput(e,t,n))),this}signInputHDAsync(e,t,n=[ZY.Transaction.SIGHASH_ALL]){return new Promise(((r,i)=>{if(!t||!t.publicKey||!t.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=EX(e,this.data.inputs,t).map((t=>this.signInputAsync(e,t,n)));return Promise.all(o).then((()=>{r()})).catch(i)}))}signAllInputs(e,t=[ZY.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const n=[];for(const r of PX(this.data.inputs.length))try{this.signInput(r,e,t),n.push(!0)}catch(e){n.push(!1)}if(n.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsAsync(e,t=[ZY.Transaction.SIGHASH_ALL]){return new Promise(((n,r)=>{if(!e||!e.publicKey)return r(new Error("Need Signer to sign input"));const i=[],o=[];for(const[n]of this.data.inputs.entries())o.push(this.signInputAsync(n,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return r(new Error("No inputs were signed"));n()}))}))}signInput(e,t,n=[ZY.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const{hash:r,sighashType:i}=bX(this.data.inputs,e,t.publicKey,this.__CACHE,n),o=[{pubkey:t.publicKey,signature:WY.signature.encode(t.sign(r),i)}];return this.data.updateInput(e,{partialSig:o}),this}signInputAsync(e,t,n=[ZY.Transaction.SIGHASH_ALL]){return Promise.resolve().then((()=>{if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const{hash:r,sighashType:i}=bX(this.data.inputs,e,t.publicKey,this.__CACHE,n);return Promise.resolve(t.sign(r)).then((n=>{const r=[{pubkey:t.publicKey,signature:WY.signature.encode(n,i)}];this.data.updateInput(e,{partialSig:r})}))}))}toBuffer(){return rX(this.__CACHE),this.data.toBuffer()}toHex(){return rX(this.__CACHE),this.data.toHex()}toBase64(){return rX(this.__CACHE),this.data.toBase64()}updateGlobal(e){return this.data.updateGlobal(e),this}updateInput(e,t){return t.witnessScript&&DX(t.witnessScript),this.data.updateInput(e,t),t.nonWitnessUtxo&&xX(this.__CACHE,this.data.inputs[e],e),this}updateOutput(e,t){return this.data.updateOutput(e,t),this}addUnknownKeyValToGlobal(e){return this.data.addUnknownKeyValToGlobal(e),this}addUnknownKeyValToInput(e,t){return this.data.addUnknownKeyValToInput(e,t),this}addUnknownKeyValToOutput(e,t){return this.data.addUnknownKeyValToOutput(e,t),this}clearFinalizedInput(e){return this.data.clearFinalizedInput(e),this}}Zz.Psbt=eX;const tX=e=>new nX(e);class nX{constructor(e=ao.from([2,0,0,0,0,0,0,0,0,0])){this.tx=ZY.Transaction.fromBuffer(e),function(e){if(!e.ins.every((e=>e.script&&0===e.script.length&&e.witness&&0===e.witness.length)))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(e){if(void 0===e.hash||void 0===e.index||!jo(e.hash)&&"string"!=typeof e.hash||"number"!=typeof e.index)throw new Error("Error adding input.");const t="string"==typeof e.hash?(0,JY.reverseBuffer)(ao.from(e.hash,"hex")):e.hash;this.tx.addInput(t,e.index,e.sequence)}addOutput(e){if(void 0===e.script||void 0===e.value||!jo(e.script)||"number"!=typeof e.value)throw new Error("Error adding output.");this.tx.addOutput(e.script,e.value)}toBuffer(){return this.tx.toBuffer()}}function rX(e){if(!1!==e.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function iX(e){return!!e.finalScriptSig||!!e.finalScriptWitness}function oX(e){return t=>{try{return e({output:t}),!0}catch(e){return!1}}}const aX=oX(XY.p2ms),sX=oX(XY.p2pk),lX=oX(XY.p2pkh),uX=oX(XY.p2wpkh),AX=oX(XY.p2wsh),cX=oX(XY.p2sh);function hX(e){return t=>!!t.masterFingerprint.equals(e.fingerprint)&&!!e.derivePath(t.path).publicKey.equals(t.pubkey)}function dX(e){if("number"!=typeof e||e!==Math.floor(e)||e>4294967295||e<0)throw new Error("Invalid 32 bit integer")}function fX(e,t){e.forEach((e=>{let n=!1,r=[];if(0===(e.partialSig||[]).length){if(!e.finalScriptSig&&!e.finalScriptWitness)return;r=function(e){const t=e.finalScriptSig&&WY.decompile(e.finalScriptSig)||[],n=e.finalScriptWitness&&WY.decompile(e.finalScriptWitness)||[];return t.concat(n).filter((e=>jo(e)&&WY.isCanonicalScriptSignature(e))).map((e=>({signature:e})))}(e)}else r=e.partialSig;if(r.forEach((e=>{const{hashType:r}=WY.signature.decode(e.signature),i=[];switch(r&ZY.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&r){case ZY.Transaction.SIGHASH_ALL:break;case ZY.Transaction.SIGHASH_SINGLE:case ZY.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}-1===i.indexOf(t)&&(n=!0)})),n)throw new Error("Can not modify transaction, signatures exist.")}))}function pX(e,t,n){if(!FX(e,t))throw new Error(`Can not ${n} for this input with the key ${e.toString("hex")}`)}function gX(e,t){const n=(0,JY.reverseBuffer)(ao.from(t.hash)).toString("hex")+":"+t.index;if(e.__TX_IN_CACHE[n])throw new Error("Duplicate input detected.");e.__TX_IN_CACHE[n]=1}function yX(e,t){return(n,r,i,o)=>{const a=e({redeem:{output:i}}).output;if(!r.equals(a))throw new Error(`${t} for ${o} #${n} doesn't match the scriptPubKey in the prevout`)}}const mX=yX(XY.p2sh,"Redeem script"),vX=yX(XY.p2wsh,"Witness script");function wX(e,t,n,r){if(!n.every(iX))throw new Error(`PSBT must be finalized to calculate ${t}`);if("__FEE_RATE"===e&&r.__FEE_RATE)return r.__FEE_RATE;if("__FEE"===e&&r.__FEE)return r.__FEE;let i,o=!0;return r.__EXTRACTED_TX?(i=r.__EXTRACTED_TX,o=!1):i=r.__TX.clone(),SX(n,i,r,o),"__FEE_RATE"===e?r.__FEE_RATE:"__FEE"===e?r.__FEE:void 0}function IX(e,t,n,r,i,o){UX(n);throw new Error(`Can not finalize input #${e}`)}function bX(e,t,n,r,i){const o=(0,VY.checkForInput)(e,t),{hash:a,sighashType:s,script:l}=BX(t,o,r,!1,i);return pX(n,l,"sign"),{hash:a,sighashType:s}}function BX(e,t,n,r,i){const o=n.__TX,a=t.sighashType||ZY.Transaction.SIGHASH_ALL;if(i&&i.indexOf(a)<0){const e=function(e){let t=e&ZY.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&e){case ZY.Transaction.SIGHASH_ALL:t+="SIGHASH_ALL";break;case ZY.Transaction.SIGHASH_SINGLE:t+="SIGHASH_SINGLE";break;case ZY.Transaction.SIGHASH_NONE:t+="SIGHASH_NONE"}return t}(a);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${e}`)}let s,l;if(t.nonWitnessUtxo){const r=QX(n,t,e),i=o.ins[e].hash,a=r.getHash();if(!i.equals(a))throw new Error(`Non-witness UTXO hash for input #${e} doesn't match the hash specified in the prevout`);const s=o.ins[e].index;l=r.outs[s]}else{if(!t.witnessUtxo)throw new Error("Need a Utxo input item for signing");l=t.witnessUtxo}const{meaningfulScript:u,type:A}=NX(l.script,e,"input",t.redeemScript,t.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(A)>=0)s=o.hashForWitnessV0(e,u,l.value,a);else if(uX(u)){const t=XY.p2pkh({hash:u.slice(2)}).output;s=o.hashForWitnessV0(e,t,l.value,a)}else{if(void 0===t.nonWitnessUtxo&&!1===n.__UNSAFE_SIGN_NONSEGWIT)throw new Error(`Input #${e} has witnessUtxo but non-segwit script: ${u.toString("hex")}`);r||!1===n.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as Psbt's predecesor (TransactionBuilder - now removed) when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),s=o.hashForSignature(e,u,a)}return{script:u,sighashType:a,hash:s}}function EX(e,t,n){const r=(0,VY.checkForInput)(t,e);if(!r.bip32Derivation||0===r.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=r.bip32Derivation.map((e=>e.masterFingerprint.equals(n.fingerprint)?e:void 0)).filter((e=>!!e));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");const o=i.map((e=>{const t=n.derivePath(e.path);if(!e.pubkey.equals(t.publicKey))throw new Error("pubkey did not match bip32Derivation");return t}));return o}function CX(e){let t=0;function n(){const n=qY.decode(e,t);return t+=qY.decode.bytes,n}function r(){return r=n(),t+=r,e.slice(t-r,t);var r}return function(){const e=n(),t=[];for(let n=0;n<e;n++)t.push(r());return t}()}function xX(e,t,n){e.__NON_WITNESS_UTXO_BUF_CACHE[n]=t.nonWitnessUtxo;const r=ZY.Transaction.fromBuffer(t.nonWitnessUtxo);e.__NON_WITNESS_UTXO_TX_CACHE[n]=r;const i=e,o=n;delete t.nonWitnessUtxo,Object.defineProperty(t,"nonWitnessUtxo",{enumerable:!0,get(){const e=i.__NON_WITNESS_UTXO_BUF_CACHE[o],t=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==e)return e;{const e=t.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e,e}},set(e){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e}})}function SX(e,t,n,r){let i=0;e.forEach(((e,o)=>{if(r&&e.finalScriptSig&&(t.ins[o].script=e.finalScriptSig),r&&e.finalScriptWitness&&(t.ins[o].witness=CX(e.finalScriptWitness)),e.witnessUtxo)i+=e.witnessUtxo.value;else if(e.nonWitnessUtxo){const r=QX(n,e,o),a=t.ins[o].index,s=r.outs[a];i+=s.value}}));const o=t.outs.reduce(((e,t)=>e+t.value),0),a=i-o;if(a<0)throw new Error("Outputs are spending more than Inputs");const s=t.virtualSize();n.__FEE=a,n.__EXTRACTED_TX=t,n.__FEE_RATE=Math.floor(a/s)}function QX(e,t,n){const r=e.__NON_WITNESS_UTXO_TX_CACHE;return r[n]||xX(e,t,n),r[n]}function kX(e,t,n){if(void 0!==t.witnessUtxo)return t.witnessUtxo.script;if(void 0!==t.nonWitnessUtxo)return QX(n,t,e).outs[n.__TX.ins[e].index].script;throw new Error("Can't find pubkey in input without Utxo data")}function _X(e){return 33===e.length&&WY.isCanonicalPubKey(e)}function NX(e,t,n,r,i){const o=cX(e),a=o&&r&&AX(r),s=AX(e);if(o&&void 0===r)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((s||a)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let l;return a?(l=i,mX(t,e,r,n),vX(t,r,i,n),DX(l)):s?(l=i,vX(t,e,i,n),DX(l)):o?(l=r,mX(t,e,r,n)):l=e,{meaningfulScript:l,type:a?"p2sh-p2wsh":o?"p2sh":s?"p2wsh":"raw"}}function DX(e){if(uX(e)||cX(e))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function FX(e,t){const n=(0,YY.hash160)(e),r=WY.decompile(t);if(null===r)throw new Error("Unknown script error");return r.some((t=>"number"!=typeof t&&(t.equals(e)||t.equals(n))))}function UX(e){return uX(e)?"witnesspubkeyhash":lX(e)?"pubkeyhash":aX(e)?"multisig":sX(e)?"pubkey":"nonstandard"}function PX(e){return[...Array(e).keys()]}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Transaction=e.opcodes=e.Psbt=e.Block=e.script=e.payments=e.networks=e.crypto=e.address=void 0;const t=NG;e.address=t;const n=nV;e.crypto=n;const r=DG;e.networks=r;const i=FG;e.payments=i;const o=PG;e.script=o;var a=dz;Object.defineProperty(e,"Block",{enumerable:!0,get:function(){return a.Block}});var s=Zz;Object.defineProperty(e,"Psbt",{enumerable:!0,get:function(){return s.Psbt}});var l=LG;Object.defineProperty(e,"opcodes",{enumerable:!0,get:function(){return l.OPS}});var u=Sz;Object.defineProperty(e,"Transaction",{enumerable:!0,get:function(){return u.Transaction}})}(_G);var TX={exports:{}};function LX(e,t){const n=(e=>{const t=(e=>{const t=fR.from(Object.assign(Object.assign({},e),{crv:"K-256"}),"jwk").toString("blk","public"),n=AC.publicKeyConvert(kG.from(t,"hex"),!0);return kG.from(n).toString("hex")})(e);let n=kG.from(t,"hex"),r=32-n.length;for(;r>0;)n=kG.concat([kG.from("00","hex"),n]),r--;return n})(e.publicKeyJwk),r=SG("errors","identityErrorBaseMessage");let i="";switch(t.code){case Ol.Bitcoin:case Ol.Mocknet:case Ol.Testnet:i=function(e,t){return _G.payments.p2pkh({pubkey:e,network:_G.networks[t.code]}).address}(n,t);break;case Ol.Ethmain:case Ol.Ethropst:case Ol.Ethrinkeby:case Ol.Ethgoerli:case Ol.Ethsepolia:i=function(e,t){const n=e.toString("hex"),r=new II.ec("secp256k1").keyFromPublic(n,"hex").getPublic().encode("hex").slice(2),i=ao;return`0x${TX.exports.keccak256(i.from(r,"hex")).slice(24).toString()}`}(n);break;default:throw new EG("deriveIssuingAddressFromPublicKey",`${r} - ${SG("errors","deriveIssuingAddressFromPublicKey")}`)}return i}function MX(e){if(e){const t="string"==typeof e?e:e.code;return!!Object.keys(jl).some((e=>e===t))&&!!jl[t].test}return!1}!function(e){!function(){var t="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof gu&&gu.versions&&gu.versions.node?r=Ki:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&e.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),l=[4,1024,262144,67108864],u=[0,8,16,24],A=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],c=[224,256,384,512],h=[128,256],d=["hex","buffer","arrayBuffer","array","digest"],f={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var p=function(e,t,n){return function(r){return new _(e,t,e).update(r)[n]()}},g=function(e,t,n){return function(r,i){return new _(e,t,i).update(r)[n]()}},y=function(e,t,n){return function(t,r,i,o){return b["cshake"+e].update(t,r,i,o)[n]()}},m=function(e,t,n){return function(t,r,i,o){return b["kmac"+e].update(t,r,i,o)[n]()}},v=function(e,t,n,r){for(var i=0;i<d.length;++i){var o=d[i];e[o]=t(n,r,o)}return e},w=function(e,t){var n=p(e,t,"hex");return n.create=function(){return new _(e,t,e)},n.update=function(e){return n.create().update(e)},v(n,p,e,t)},I=[{name:"keccak",padding:[1,256,65536,16777216],bits:c,createMethod:w},{name:"sha3",padding:[6,1536,393216,100663296],bits:c,createMethod:w},{name:"shake",padding:[31,7936,2031616,520093696],bits:h,createMethod:function(e,t){var n=g(e,t,"hex");return n.create=function(n){return new _(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},v(n,g,e,t)}},{name:"cshake",padding:l,bits:h,createMethod:function(e,t){var n=f[e],r=y(e,0,"hex");return r.create=function(r,i,o){return i||o?new _(e,t,r).bytepad([i,o],n):b["shake"+e].create(r)},r.update=function(e,t,n,i){return r.create(t,n,i).update(e)},v(r,y,e,t)}},{name:"kmac",padding:l,bits:h,createMethod:function(e,t){var n=f[e],r=m(e,0,"hex");return r.create=function(r,i,o){return new N(e,t,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(e,t,n,i){return r.create(e,n,i).update(t)},v(r,m,e,t)}}],b={},B=[],E=0;E<I.length;++E)for(var C=I[E],x=C.bits,S=0;S<x.length;++S){var Q=C.name+"_"+x[S];if(B.push(Q),b[Q]=C.createMethod(x[S],C.padding),"sha3"!==C.name){var k=C.name+x[S];B.push(k),b[k]=b[Q]}}function _(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function N(e,t,n){_.call(this,e,t,n)}_.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var i,o,s=this.blocks,l=this.byteCount,A=e.length,c=this.blockCount,h=0,d=this.s;h<A;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<c+1;++i)s[i]=0;if(n)for(i=this.start;h<A&&i<l;++h)s[i>>2]|=e[h]<<u[3&i++];else for(i=this.start;h<A&&i<l;++h)(o=e.charCodeAt(h))<128?s[i>>2]|=o<<u[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<u[3&i++],s[i>>2]|=(128|o>>6&63)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++h)),s[i>>2]|=(240|o>>18)<<u[3&i++],s[i>>2]|=(128|o>>12&63)<<u[3&i++],s[i>>2]|=(128|o>>6&63)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]);if(this.lastByteIndex=i,i>=l){for(this.start=i-l,this.block=s[c],i=0;i<c;++i)d[i]^=s[i];D(d),this.reset=!0}else this.start=i}return this},_.prototype.encode=function(e,t){var n=255&e,r=1,i=[n];for(n=255&(e>>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},_.prototype.encodeString=function(e){var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}var i=0,o=e.length;if(n)i=o;else for(var s=0;s<e.length;++s){var l=e.charCodeAt(s);l<128?i+=1:l<2048?i+=2:l<55296||l>=57344?i+=3:(l=65536+((1023&l)<<10|1023&e.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(e),i},_.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var i=t-n%t,o=[];return o.length=i,this.update(o),this},_.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];D(r)}},_.prototype.toString=_.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,l="";a<r;){for(o=0;o<t&&a<r;++o,++a)e=n[o],l+=s[e>>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t==0&&(D(n),o=0)}return i&&(e=n[o],l+=s[e>>4&15]+s[15&e],i>1&&(l+=s[e>>12&15]+s[e>>8&15]),i>2&&(l+=s[e>>20&15]+s[e>>16&15])),l},_.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var l=new Uint32Array(e);a<r;){for(o=0;o<t&&a<r;++o,++a)l[a]=n[o];a%t==0&&D(n)}return i&&(l[o]=n[o],e=e.slice(0,s)),e},_.prototype.buffer=_.prototype.arrayBuffer,_.prototype.digest=_.prototype.array=function(){this.finalize();for(var e,t,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,l=[];s<i;){for(a=0;a<n&&s<i;++a,++s)e=s<<2,t=r[a],l[e]=255&t,l[e+1]=t>>8&255,l[e+2]=t>>16&255,l[e+3]=t>>24&255;s%n==0&&D(r)}return o&&(e=s<<2,t=r[a],l[e]=255&t,o>1&&(l[e+1]=t>>8&255),o>2&&(l[e+2]=t>>16&255)),l},N.prototype=new _,N.prototype.finalize=function(){return this.encode(this.outputBits,!0),_.prototype.finalize.call(this)};var D=function(e){var t,n,r,i,o,a,s,l,u,c,h,d,f,p,g,y,m,v,w,I,b,B,E,C,x,S,Q,k,_,N,D,F,U,P,T,L,M,R,O,H,K,j,G,q,V,z,J,Y,X,W,Z,$,ee,te,ne,re,ie,oe,ae,se,le,ue,Ae;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],l=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(l<<1|u>>>31),n=o^(u<<1|l>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(c<<1|h>>>31),n=s^(h<<1|c>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=l^(d<<1|f>>>31),n=u^(f<<1|d>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=c^(i<<1|o>>>31),n=h^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,p=e[0],g=e[1],z=e[11]<<4|e[10]>>>28,J=e[10]<<4|e[11]>>>28,k=e[20]<<3|e[21]>>>29,_=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,le=e[30]<<9|e[31]>>>23,j=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,P=e[2]<<1|e[3]>>>31,T=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,D=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,Ae=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,M=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,W=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,F=e[45]<<29|e[44]>>>3,U=e[44]<<29|e[45]>>>3,C=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,R=e[26]<<25|e[27]>>>7,O=e[27]<<25|e[26]>>>7,I=e[36]<<21|e[37]>>>11,b=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,S=e[18]<<20|e[19]>>>12,Q=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,H=e[38]<<8|e[39]>>>24,K=e[39]<<8|e[38]>>>24,B=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=g^~m&w,e[10]=C^~S&k,e[11]=x^~Q&_,e[20]=P^~L&R,e[21]=T^~M&O,e[30]=q^~z&Y,e[31]=V^~J&X,e[40]=te^~re&oe,e[41]=ne^~ie&ae,e[2]=y^~v&I,e[3]=m^~w&b,e[12]=S^~k&N,e[13]=Q^~_&D,e[22]=L^~R&H,e[23]=M^~O&K,e[32]=z^~Y&W,e[33]=J^~X&Z,e[42]=re^~oe&se,e[43]=ie^~ae&le,e[4]=v^~I&B,e[5]=w^~b&E,e[14]=k^~N&F,e[15]=_^~D&U,e[24]=R^~H&j,e[25]=O^~K&G,e[34]=Y^~W&$,e[35]=X^~Z&ee,e[44]=oe^~se&ue,e[45]=ae^~le&Ae,e[6]=I^~B&p,e[7]=b^~E&g,e[16]=N^~F&C,e[17]=D^~U&x,e[26]=H^~j&P,e[27]=K^~G&T,e[36]=W^~$&q,e[37]=Z^~ee&V,e[46]=se^~ue&te,e[47]=le^~Ae&ne,e[8]=B^~p&y,e[9]=E^~g&m,e[18]=F^~C&S,e[19]=U^~x&Q,e[28]=j^~P&L,e[29]=G^~T&M,e[38]=$^~q&z,e[39]=ee^~V&J,e[48]=ue^~te&re,e[49]=Ae^~ne&ie,e[0]^=A[r],e[1]^=A[r+1]};if(o)e.exports=b;else for(E=0;E<B.length;++E)r[B[E]]=b[B[E]]}()}(TX);var RX=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const{LinkedDataProof:OX}=m_.suites;class HX extends OX{constructor({issuer:e=null,verificationMethod:t=null,document:n=null,proof:r=null,options:i={}}){if(super({type:"MerkleProof2019"}),this.type="MerkleProof2019",this.issuer=null,this.verificationMethod=null,this.proof=null,this.proofValue=null,this.document=null,this.explorerAPIs=[],this.documentLoader=null,this.proofVerificationProcess=["getTransactionId","computeLocalHash","fetchRemoteHash","compareHashes","checkMerkleRoot","checkReceipt"],this.identityVerificationProcess=["deriveIssuingAddressFromPublicKey","compareIssuingAddress"],this.transactionId="",!n)throw new Error("A document signed by MerkleProof2019 is required for the verification process.");this.issuer=e,this.verificationMethod=t,this.document=n,this.setProof(r),this.setOptions(i),this.getChain(),MX(this.chain)&&(this.adaptProofVerificationProcessToMocknet(),this.adaptIdentityVerificationProcessToMocknet())}static decodeMerkleProof2019(e){return new yG(e.proofValue).decode()}setProof(e=null){const t=null!=e?e:this.document.proof;if(!t)throw new Error("The passed document is not signed.");this.proof=t,this.proofValue=HX.decodeMerkleProof2019(this.proof)}verifyProof({documentLoader:e,verifyIdentity:t}={documentLoader:e=>{},verifyIdentity:!0}){return RX(this,void 0,void 0,(function*(){let n;this.documentLoader=e;let r="";try{yield this.verifyProcess(this.proofVerificationProcess),t&&(yield this.verifyIdentity()),n=!0}catch(e){console.error(e),n=!1,r=e.message}return{verificationMethod:this.verificationMethod,verified:n,error:r}}))}verifyIdentity(){return RX(this,void 0,void 0,(function*(){if(null!=this.verificationMethod)try{yield this.verifyProcess(this.identityVerificationProcess)}catch(e){throw new Error(e)}}))}getProofVerificationProcess(){return this.proofVerificationProcess}getIdentityVerificationProcess(){return this.identityVerificationProcess}getIssuerPublicKey(){var e,t;return MX(this.chain)?"This mock chain does not support issuing addresses":null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.issuingAddress)&&void 0!==t?t:""}getIssuanceTime(){var e,t;return null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.time)&&void 0!==t?t:""}getChain(){return this.chain||(this.chain=function(e=null){if(null==e?void 0:e.anchors){const{anchors:t}=e,n=t[0];if("string"==typeof n)return function(e){const t=e.split(":");let n;switch(t[1]){case jl.mocknet.blinkCode:return mG(jl.mocknet.signatureValue);case jl.bitcoin.blinkCode:n=jl.bitcoin.name;break;case jl.ethmain.blinkCode:n=jl.ethmain.name;break;default:throw new Error("Could not retrieve chain.")}const r=t[2],i=n.toLowerCase()+function(e){const t=e.substr(0,1),n=e.substr(1,e.length-1);return t.toUpperCase()+n.toLowerCase()}(r);return mG(i)}(n)}return null}(this.proofValue)),this.chain}getTxData(){return this.txData?this.txData:(console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?"),null)}adaptProofVerificationProcessToMocknet(){vG(this.proofVerificationProcess,"getTransactionId"),vG(this.proofVerificationProcess,"fetchRemoteHash"),vG(this.proofVerificationProcess,"checkMerkleRoot")}adaptIdentityVerificationProcessToMocknet(){this.identityVerificationProcess=[]}setOptions(e){var t;this.explorerAPIs=null!==(t=e.explorerAPIs)&&void 0!==t?t:[],e.executeStepMethod&&"function"==typeof e.executeStepMethod&&(this.executeStep=e.executeStepMethod)}executeStep(e,t,n=""){return RX(this,void 0,void 0,(function*(){return yield t()}))}verifyProcess(e){return RX(this,void 0,void 0,(function*(){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");yield this[t]()}}))}checkMerkleRoot(){return RX(this,void 0,void 0,(function*(){yield this.executeStep("checkMerkleRoot",(()=>function(e,t){if(e!==t)throw new EG("checkMerkleRoot",SG("errors","ensureMerkleRootEqual"));return!0}(this.proofValue.merkleRoot,this.txData.remoteHash)),this.type)}))}compareHashes(){return RX(this,void 0,void 0,(function*(){yield this.executeStep("compareHashes",(()=>function(e,t){if(e!==t)throw new EG("compareHashes",SG("errors","ensureHashesEqual"));return!0}(this.localDocumentHash,this.proofValue.targetHash)),this.type)}))}computeLocalHash(){return RX(this,void 0,void 0,(function*(){this.localDocumentHash=yield this.executeStep("computeLocalHash",(()=>RX(this,void 0,void 0,(function*(){return yield function(e,t=null,n=(e=>{})){return QG(this,void 0,void 0,(function*(){e["@context"].find((e=>{return(t=e)===Object(t)&&"@vocab"in e;var t}))||e["@context"].push({"@vocab":"http://fallback.org/"});const r=JSON.parse(JSON.stringify(e));if(Array.isArray(r.proof)){if(!t)throw new EG("computeLocalHash",SG("errors","noProofSpecified"));const e=r.proof.findIndex((e=>e.proofValue===t.proofValue));r.proof=r.proof.slice(0,e)}else delete r.proof;const i={algorithm:"URDNA2015",format:"application/nquads",documentLoader:function(e){return QG(this,void 0,void 0,(function*(){return null!=n&&(yield n(e)),e in jh?{contextUrl:null,document:jh[e],documentUrl:e}:ov.documentLoader(e)}))}};let o;try{o=yield ov.normalize(r,i)}catch(e){throw console.error(e),new EG("computeLocalHash",SG("errors","failedJsonLdNormalization"))}const a=function(e){const t=e.split("\n"),n=/<http:\/\/fallback\.org\/(.*)>/,r=t.map((e=>n.exec(e))).filter((e=>null!=e));if(r.length>0){const e=r.map((e=>e[1])).sort();return Array.from(new Set(e))}return null}(o);if(a)throw new EG("computeLocalHash",`${SG("errors","foundUnmappedFields")}: ${a.join(", ")}`);return PR(function(e){const t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}(o))}))}(this.document,this.proof,this.documentLoader)}))),this.type)}))}checkReceipt(){return RX(this,void 0,void 0,(function*(){yield this.executeStep("checkReceipt",(()=>function(e){let t=e.targetHash;const n=e.merkleRoot;try{const n=e.path;if(n&&t)for(const e in n){const r=n[e];let i;if(void 0!==r.left)i=BG(`${r.left}${t}`),t=PR(i);else{if(void 0===r.right)throw new EG("checkReceipt","Trigger catch error.");i=BG(`${t}${r.right}`),t=PR(i)}}}catch(e){throw new EG("checkReceipt",SG("errors","ensureValidReceipt"))}if(t!==n)throw new EG("checkReceipt",SG("errors","invalidMerkleReceipt"))}(this.proofValue)),this.type)}))}getTransactionId(){return RX(this,void 0,void 0,(function*(){return this.transactionId=function(e=null){if(!e)throw new Error("DecodedProof is not set");const{anchors:t}=e,n=t[0];if("string"==typeof n)return n.split(":").pop();throw new Error("Could not retrieve transaction id as was provided an unexpected format")}(this.proofValue),yield this.executeStep("getTransactionId",(()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new EG("getTransactionId",SG("errors","isTransactionIdValid"))}(this.transactionId)),this.type)}))}fetchRemoteHash(){return RX(this,void 0,void 0,(function*(){this.txData=yield this.executeStep("fetchRemoteHash",(()=>RX(this,void 0,void 0,(function*(){var e;return yield Lh({transactionId:this.transactionId,chain:null===(e=this.chain)||void 0===e?void 0:e.code,explorerAPIs:this.explorerAPIs})}))),this.type)}))}deriveIssuingAddressFromPublicKey(){return RX(this,void 0,void 0,(function*(){this.derivedIssuingAddress=yield this.executeStep("deriveIssuingAddressFromPublicKey",(()=>LX(this.verificationMethod,this.chain)),this.type)}))}compareIssuingAddress(){return RX(this,void 0,void 0,(function*(){yield this.executeStep("compareIssuingAddress",(()=>function(e,t){const n=SG("errors","identityErrorBaseMessage");if(e!==t)throw new EG("compareIssuingAddress",`${n} - ${SG("errors","compareIssuingAddress")}`)}(this.getIssuerPublicKey(),this.derivedIssuingAddress)),this.type)}))}}function KX(e){return Array.isArray(e)?e.find((e=>"ChainedProof2021"!==e.type)).verificationMethod:e.verificationMethod}var jX,GX;!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkImagesIntegrity="checkImagesIntegrity",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.deriveIssuingAddressFromPublicKey="deriveIssuingAddressFromPublicKey",e.compareIssuingAddress="compareIssuingAddress",e.checkAuthenticity="checkAuthenticity"}(jX||(jX={}));class qX extends lD{proofVerificationProcess=[jX.parseIssuerKeys,jX.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;verificationMethodPublicKey;derivedIssuingAddress;hasDid;proof;type="MerkleProof2019";suite;constructor(e){var t;super(e),this.executeStep=e.executeStep,this.documentToVerify=e.document,this.explorerAPIs=e.explorerAPIs,this.proof=e.proof,this.issuer=e.issuer,this.validateProofType(),this.receipt=(t=this.proof,HX.decodeMerkleProof2019(t)),this.transactionId=zC.certificates.getTransactionId(this.receipt),this.setHasDid()}async init(){await this.setVerificationSuite(),this.chain=this.suite.getChain(),this.adaptVerificationProcessToChain()}async verifyProof(){await this.suite.verifyProof({verifyIdentity:!1}),await this.verifyProcess(this.proofVerificationProcess)}async verifyIdentity(){await this.suite.verifyIdentity()}getProofVerificationSteps(e){return[...this.suite.getProofVerificationProcess(),...this.proofVerificationProcess].map((t=>zC.verifier.convertToVerificationSubsteps(e,t)))}getIdentityVerificationSteps(e){return this.hasDid?this.suite.getIdentityVerificationProcess().map((t=>zC.verifier.convertToVerificationSubsteps(e,t))):[]}getIssuerPublicKey(){return this.suite.getIssuerPublicKey()}getIssuanceTime(){return this.suite.getIssuanceTime()}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){return new URL(this.getIssuerProfileUrl())?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.proof.created}getChain(){return this.suite.getChain()}getReceipt(){return this.receipt}getTransactionIdString(){return zC.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}async executeStep(e,t,n){throw new Error("executeStep method needs to be overwritten by injecting from Verifier")}async setVerificationSuite(){await this.setIssuerFromProofVerificationMethod(),this.verificationMethodPublicKey=OR(this.getTargetVerificationMethodContainer(),KX(this.proof)),this.suite=new HX({document:this.documentToVerify,proof:this.proof,verificationMethod:this.verificationMethodPublicKey,options:{explorerAPIs:this.explorerAPIs,executeStepMethod:this.executeStep}})}adaptVerificationProcessToChain(){zC.chains.isMockChain(this.chain)&&(ad(this.proofVerificationProcess,jX.parseIssuerKeys),ad(this.proofVerificationProcess,jX.checkAuthenticity))}getTargetVerificationMethodContainer(){return this.issuer.didDocument??this.issuer}isProofChain(){return"ChainedProof2021"===this.proof.type}async setIssuerFromProofVerificationMethod(){if(this.isProofChain()){const e=this.proof.verificationMethod.split("#")[0];this.issuer=await zC.verifier.getIssuerProfile(e)}}setHasDid(){if(this.isProofChain()){const e=this.proof.verificationMethod.split("#")[0];this.hasDid=dd(e)}else this.hasDid=!!this.issuer.didDocument}validateProofType(){const e=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}async verifyProcess(e){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");await this[t]()}}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(jX.parseIssuerKeys,(()=>zC.verifier.parseIssuerKeys(this.issuer)),this.type)}async checkAuthenticity(){await this.executeStep(jX.checkAuthenticity,(()=>MR(this.issuerPublicKeyList,this.getIssuerPublicKey(),this.getIssuanceTime())),this.type)}}!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.checkAuthenticity="checkAuthenticity"}(GX||(GX={}));class VX extends lD{verificationProcess=[GX.getTransactionId,GX.computeLocalHash,GX.fetchRemoteHash,GX.compareHashes,GX.checkMerkleRoot,GX.checkReceipt,GX.parseIssuerKeys,GX.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;proof;type="MerkleProof2017";constructor(e){super(e),e.executeStep&&(this.executeStep=e.executeStep),this.documentToVerify=e.document,this.explorerAPIs=e.explorerAPIs,this.issuer=e.issuer,this.proof=e.proof,this.validateProofType(),this.receipt=this.documentToVerify.signature,this.chain=zC.certificates.getChain("",this.receipt),this.transactionId=zC.certificates.getTransactionId(this.receipt),this.adaptVerificationProcessToChain()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(e){return this.verificationProcess.map((t=>zC.verifier.convertToVerificationSubsteps(e,t)))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return zC.chains.isMockChain(this.chain)?"This mock chain does not support issuing addresses":this.txData?this.txData.issuingAddress:void console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?")}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){return new URL(this.getIssuerProfileUrl())?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.documentToVerify.issuedOn}getChain(){return this.chain}getReceipt(){return this.receipt}getTransactionIdString(){return zC.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}validateProofType(){if(this.proof.type[0]!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${this.proof.type[0]}`)}adaptVerificationProcessToChain(){zC.chains.isMockChain(this.chain)&&(ad(this.verificationProcess,GX.getTransactionId),ad(this.verificationProcess,GX.fetchRemoteHash),ad(this.verificationProcess,GX.parseIssuerKeys),ad(this.verificationProcess,GX.checkMerkleRoot),ad(this.verificationProcess,GX.checkAuthenticity))}async executeStep(e,t,n){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}async getTransactionId(){await this.executeStep(GX.getTransactionId,(()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new td("getTransactionId",Wh("errors","isTransactionIdValid"))}(this.transactionId)),this.type)}async computeLocalHash(){this.localHash=await this.executeStep(GX.computeLocalHash,(async()=>await LR(this.documentToVerify)),this.type)}async fetchRemoteHash(){this.txData=await this.executeStep(GX.fetchRemoteHash,(async()=>await zC.verifier.lookForTx({transactionId:this.transactionId,chain:this.chain.code,explorerAPIs:this.explorerAPIs})),this.type)}async compareHashes(){await this.executeStep(GX.compareHashes,(()=>function(e,t){if(e!==t)throw new td("compareHashes",Wh("errors","ensureHashesEqual"));return!0}(this.localHash,this.receipt.targetHash)),this.type)}async checkMerkleRoot(){await this.executeStep(GX.checkMerkleRoot,(()=>function(e,t){if(e!==t)throw new td("checkMerkleRoot",Wh("errors","ensureMerkleRootEqual"));return!0}(this.receipt.merkleRoot,this.txData.remoteHash)),this.type)}async checkReceipt(){await this.executeStep(GX.checkReceipt,(()=>function(e){let t=e.targetHash;const n=e.merkleRoot;try{const n=e.proof||e.path;if(n)for(const e in n){const r=n[e];let i;if(void 0!==r.left)i=TR(`${r.left}${t}`),t=PR(i);else{if(void 0===r.right)throw new td("checkReceipt","Trigger catch error.");i=TR(`${t}${r.right}`),t=PR(i)}}}catch(e){throw new td("checkReceipt",Wh("errors","ensureValidReceipt"))}if(t!==n)throw new td("checkReceipt",Wh("errors","invalidMerkleReceipt"))}(this.receipt)),this.type)}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(GX.parseIssuerKeys,(()=>zC.verifier.parseIssuerKeys(this.issuer)),this.type)}async checkAuthenticity(){await this.executeStep(GX.checkAuthenticity,(()=>MR(this.issuerPublicKeyList,this.txData.issuingAddress,this.txData.time)),this.type)}}const zX=ix("Verifier");class JX{expires;id;issuer;revocationKey;documentToVerify;explorerAPIs;txData;_stepsStatuses=[];hashlinkVerifier;verificationSteps;supportedVerificationSuites;proofVerifiers=[];verificationProcess;proofMap;constructor({certificateJson:e,expires:t,hashlinkVerifier:n,id:r,issuer:i,revocationKey:o,explorerAPIs:a}){this.expires=t,this.id=r,this.issuer=i,this.hashlinkVerifier=n,this.revocationKey=o,this.explorerAPIs=a,this.documentToVerify=Object.assign({},e)}getVerificationSteps(){return this.verificationSteps}getSignersData(){return this.proofVerifiers.map((e=>({signingDate:e.getSigningDate(),signatureSuiteType:e.type,issuerPublicKey:e.getIssuerPublicKey(),issuerName:e.getIssuerName(),issuerProfileDomain:e.getIssuerProfileDomain(),issuerProfileUrl:e.getIssuerProfileUrl(),chain:e.getChain?.(),transactionId:e.getTransactionIdString?.(),transactionLink:e.getTransactionLink?.(),rawTransactionLink:e.getRawTransactionLink?.()})))}async init(){this.instantiateProofVerifiers();for(const e of this.proofVerifiers)await e.init();this.prepareVerificationProcess()}async verify(e=(()=>{})){this._stepCallback=e,this._stepsStatuses=[];for(let e=0;e<this.proofVerifiers.length;e++)await this.proofVerifiers[e].verifyProof();for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}for(let e=0;e<this.proofVerifiers.length;e++)await this.proofVerifiers[e].verifyIdentity();const t=this._stepsStatuses.find((e=>e.status===HC.FAILURE));return t?this._failed(t):this._succeed()}getRevocationListUrl(){return this.issuer.revocationList}getProofTypes(){const e=[];return this.proofMap.forEach((t=>{let{type:n}=t;"ChainedProof2021"===n&&(n=t.chainedProofType),Array.isArray(n)&&(n=n[0]),e.push(n)})),e}getProofMap(e){const t=new Map;return"proof"in e?Array.isArray(e.proof)?e.proof.forEach(((e,n)=>t.set(n,e))):t.set(0,e.proof):"signature"in e&&t.set(0,e.signature),t}instantiateProofVerifiers(){this.supportedVerificationSuites={MerkleProof2017:VX,MerkleProof2019:qX,Ed25519Signature2020:fD,EcdsaSecp256k1Signature2019:QR},this.proofMap=this.getProofMap(this.documentToVerify);const e=this.getProofTypes(),t=function(e=[],t=[]){return t.filter((t=>!e.includes(t)))}(Object.keys(this.supportedVerificationSuites),e);if(t.length)throw new Error(`No support for proof verification of type: ${t.join(", ")}`);this.proofMap.forEach(((t,n)=>{const r={executeStep:this.executeStep.bind(this),document:this.documentToVerify,proof:t,explorerAPIs:this.explorerAPIs,issuer:this.issuer};this.proofVerifiers.push(new this.supportedVerificationSuites[e[n]](r))}))}prepareVerificationProcess(){const e=zC.certificates.getVerificationMap(!!this.issuer.didDocument,this.hashlinkVerifier.hasHashlinksToVerify());this.verificationSteps=e.verificationMap,this.verificationProcess=e.verificationProcess,this.registerSignatureVerificationSteps(),this.registerIdentityVerificationSteps(),this.verificationSteps=this.verificationSteps.filter((e=>e.subSteps?.length>0||e.suites?.some((e=>e.subSteps.length>0))))}registerSignatureVerificationSteps(){const e=rd.proofVerification;this.verificationSteps.find((t=>t.code===e)).suites=this.getSuiteSubsteps(e)}getSuiteSubsteps(e){const t={[rd.proofVerification]:"getProofVerificationSteps",[rd.identityVerification]:"getIdentityVerificationSteps"};return this.proofVerifiers.map((n=>({proofType:n.type,subSteps:n[t[e]](e)})))}registerIdentityVerificationSteps(){const e=rd.identityVerification;this.verificationSteps.find((t=>t.code===e)).suites=this.getSuiteSubsteps(e)}async executeStep(e,t,n){if(this._isFailing())return;let r;e&&(r=zC.i18n.getText("subSteps",`${e}LabelPending`),zX(r),this._updateStatusCallback(e,HC.STARTING,n));try{const r=await t();return e&&(this._updateStatusCallback(e,HC.SUCCESS,n),this._stepsStatuses.push({code:e,status:HC.SUCCESS})),r}catch(t){console.error(t),e&&(this._updateStatusCallback(e,HC.FAILURE,n,t.message),this._stepsStatuses.push({code:e,message:t.message,status:HC.FAILURE}))}}_stepCallback(e){}async checkImagesIntegrity(){await this.executeStep(id.checkImagesIntegrity,(async()=>{await this.hashlinkVerifier.verifyHashlinkTable().catch((e=>{throw console.error("hashlink verification error",e),new td(id.checkImagesIntegrity,Wh("errors","checkImagesIntegrity"))}))}))}async checkRevokedStatus(){if(this.documentToVerify.credentialStatus)return void await this.executeStep(id.checkRevokedStatus,(async()=>{await async function(e){Array.isArray(e)||(e=[e]);for(const t of e){const e=parseInt(t.statusListIndex,10),n=await kR(t.statusListCredential);if(!n)throw new td(id.checkRevokedStatus,`No status list could be found at the specified URL for 'statusListCredential': ${t.statusListCredential}.`);await NR(n);const{encodedList:r}=n.credentialSubject;if((await Ik({encodedList:r})).isRevoked(e)){const e="revocation"===t.statusPurpose?"revoked":"suspended";throw new td(id.checkRevokedStatus,`Certificate has been ${e}.`)}}}(this.documentToVerify.credentialStatus)}));const e=this.getRevocationListUrl();if(!e)return console.warn("No revocation list url was set on the issuer."),void await this.executeStep(id.checkRevokedStatus,(()=>!0));const t=await this.executeStep(null,(async()=>await zC.verifier.getRevokedAssertions(e,this.id)));await this.executeStep(id.checkRevokedStatus,(()=>function(e,t){if(!e||!t)return;Array.isArray(t)||(t=[t]),t=t.filter((e=>null!=e));const n=function(e=[],t=[]){return e.filter((e=>t.includes(e))).filter(((e,t,n)=>n.indexOf(e)===t))}(t,e.map((e=>e.id)));if(n.length>0){const t=e.findIndex((e=>e.id===n[0]));if(t>-1)throw new td(id.checkRevokedStatus,zC.certificates.generateRevocationReason(e[t].revocationReason))}}(t,this.id)))}async checkExpiresDate(){await this.executeStep(id.checkExpiresDate,(()=>function(e=null){if(!e)return;const t=GC(e);if((new Date).getTime()>=t)throw new td(id.checkExpiresDate,Wh("errors","ensureNotExpired"))}(this.expires)))}async controlVerificationMethod(){await this.executeStep(id.controlVerificationMethod,(()=>{!function(e,t=""){const n=function(e){return e.id}(e);if(n!==t.split("#")[0])throw new td(id.controlVerificationMethod,`${RR} - ${zC.i18n.getText("errors","controlVerificationMethod")}`)}(this.issuer.didDocument,KX(this.documentToVerify.proof))}))}findStepFromVerificationProcess(e,t){return zC.verifier.findVerificationSubstep(e,this.verificationSteps,t)}_failed(e){const{message:t}=e;return zX(`failure:${t}`),this._setFinalStep({status:HC.FAILURE,message:t})}_isFailing(){return this._stepsStatuses.some((e=>e.status===HC.FAILURE))}_succeed(){let e;return 1===this.proofVerifiers.length&&(this.proofVerifiers[0].type.includes("MerkleProof")?(e=zC.chains.isMockChain(this.proofVerifiers[0].getChain())?zC.i18n.getComposedText("success","mocknet"):zC.i18n.getComposedText("success","blockchain"),zX(e)):e={...zC.i18n.getComposedText("success","generic"),description:zC.i18n.getComposedText("success","generic").description.replace("${SIGNATURE_TYPE}",this.proofVerifiers[0].type)}),this.proofVerifiers.length>1&&(e=zC.i18n.getComposedText("success","multisign")),this._setFinalStep({status:HC.SUCCESS,message:e})}_setFinalStep({status:e,message:t}){return{code:rd.final,status:e,message:t}}_updateStatusCallback(e,t,n="",r=""){if(null!=e){const i=this.findStepFromVerificationProcess(e,n);if(void 0===i)return void console.warn("step with code",e,"was not found for suite",n,"ignoring but you should not.");const o={code:e,status:t,parentStep:i.parentStep,label:i.labelPending};r&&(o.errorMessage=r),this._stepCallback(o)}}}class YX{certificateImage;certificateJson;description;display;expires;explorerAPIs=[];id;isFormatValid;issuedOn;issuer;locale;metadataJson;name;options;recipientFullName;recordLink;revocationKey;sealImage;signature;signatureImage;signers=[];subtitle;hashlinkVerifier;verificationSteps;verifier;constructor(e,t={}){if(this._setOptions(t),"object"!=typeof e)try{e=JSON.parse(e)}catch(e){throw new Error(zC.i18n.getText("errors","certificateNotValid"))}this.certificateJson=cD(e),this.hashlinkVerifier=new Tl}async init(){await this.parseJson(this.certificateJson),this.verifier=new JX({certificateJson:this.certificateJson,expires:this.expires,id:this.id,issuer:this.issuer,hashlinkVerifier:this.hashlinkVerifier,revocationKey:this.revocationKey,explorerAPIs:cD(this.explorerAPIs)}),await this.verifier.init(),this.verificationSteps=this.verifier.getVerificationSteps()}async verify(e){const t=await this.verifier.verify(e);return this.setSigners(),t}async parseJson(e){const t=await async function(e){try{const t=YC(e["@context"]),n=await XC[t.versionNumber](e);return n.isFormatValid=!0,n}catch(e){return console.error(e),{isFormatValid:!1,error:e.message}}}(e);if(!t.isFormatValid)throw new Error(t.error);await this._setProperties(t)}setSigners(){this.signers=this.verifier.getSignersData()}_setOptions(e){this.options=Object.assign({},zh,e),this.locale=zC.i18n.ensureIsSupported("auto"===this.options.locale?zC.i18n.detectLocale():this.options.locale),this.explorerAPIs=this.options.explorerAPIs||[],e.didResolverUrl&&(zC.did.didResolver.url=e.didResolverUrl),Yh.locale=this.locale}async _setProperties({certificateImage:e,description:t,display:n,expires:r,id:i,isFormatValid:o,issuedOn:a,issuer:s,metadataJson:l,name:u,recipientFullName:A,recordLink:c,revocationKey:h,sealImage:d,signature:f,signatureImage:p,subtitle:g}){this.isFormatValid=o,this.certificateImage=e,this.description=t,this.expires=r,this.id=i,this.issuedOn=a,this.issuer=s,this.metadataJson=l,this.name=u,this.recipientFullName=A,this.recordLink=c,this.revocationKey=h,this.sealImage=d,this.signature=f,this.signatureImage=p,this.subtitle=g,this.display=await this.parseHashlinksInDisplay(n)}async parseHashlinksInDisplay(e){const t=cD(e);if(t)return"text/html"!==t.contentMediaType||(t.content=await async function(e,t){const n=[...e.matchAll(/hl:{1}[a-zA-Z0-9]+:{1}[a-zA-Z0-9]+/gm)].map((e=>e[0])).filter((e=>!!e));if(n.length){const r=await async function(e,t){return(await Promise.all(e.map((async e=>await t.decode(e))))).reduce((function(e,t){return e.push(t.meta.url[0]),e}),[])}(n,t);e=function(e,t,n){return t.forEach(((t,r)=>{e=e.replace(n[r],t)})),e}(e,r,n)}return e}(t.content,this.hashlinkVerifier)),t}}function XX(e){return/^(ftp|http|https):\/\/[^ "]+$/.test(e)}function WX(e){return/^(\.\/|\.\.\/|[A-Z]:\/\/|\/)[^ "]+$/.test(e)}function ZX(){return{certificateDefinition:null,errorMessage:"errors.invalidBlockcertsUrl"}}
|
|
710
|
+
*/!function(e,t){(function(){var n,r="Expected a function",i="__lodash_hash_undefined__",o="__lodash_placeholder__",a=32,s=128,l=1/0,u=9007199254740991,A=NaN,c=4294967295,h=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",a],["partialRight",64],["rearg",256]],d="[object Arguments]",f="[object Array]",p="[object Boolean]",g="[object Date]",y="[object Error]",m="[object Function]",v="[object GeneratorFunction]",w="[object Map]",I="[object Number]",b="[object Object]",B="[object Promise]",E="[object RegExp]",C="[object Set]",x="[object String]",S="[object Symbol]",Q="[object WeakMap]",k="[object ArrayBuffer]",_="[object DataView]",N="[object Float32Array]",D="[object Float64Array]",F="[object Int8Array]",U="[object Int16Array]",P="[object Int32Array]",T="[object Uint8Array]",L="[object Uint8ClampedArray]",M="[object Uint16Array]",R="[object Uint32Array]",O=/\b__p \+= '';/g,H=/\b(__p \+=) '' \+/g,K=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,q=RegExp(j.source),V=RegExp(G.source),z=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,Z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$=/[\\^$.*+?()[\]{}|]/g,ee=RegExp($.source),te=/^\s+/,ne=/\s/,re=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ie=/\{\n\/\* \[wrapped with (.+)\] \*/,oe=/,? & /,ae=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ae=/\w*$/,ce=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,fe=/^0o[0-7]+$/i,pe=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ye=/($^)/,me=/['\n\r\u2028\u2029\\]/g,ve="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",we="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",be="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\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",Be="["+be+"]",Ee="["+ve+"]",Ce="\\d+",xe="["+we+"]",Se="[^\\ud800-\\udfff"+be+Ce+"\\u2700-\\u27bf"+we+Ie+"]",Qe="\\ud83c[\\udffb-\\udfff]",ke="[^\\ud800-\\udfff]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",Ne="[\\ud800-\\udbff][\\udc00-\\udfff]",De="["+Ie+"]",Fe="(?:"+xe+"|"+Se+")",Ue="(?:"+De+"|"+Se+")",Pe="(?:['’](?:d|ll|m|re|s|t|ve))?",Te="(?:['’](?:D|LL|M|RE|S|T|VE))?",Le="(?:"+Ee+"|"+Qe+")?",Me="[\\ufe0e\\ufe0f]?",Re=Me+Le+"(?:\\u200d(?:"+[ke,_e,Ne].join("|")+")"+Me+Le+")*",Oe="(?:"+["[\\u2700-\\u27bf]",_e,Ne].join("|")+")"+Re,He="(?:"+[ke+Ee+"?",Ee,_e,Ne,"[\\ud800-\\udfff]"].join("|")+")",Ke=RegExp("['’]","g"),je=RegExp(Ee,"g"),Ge=RegExp(Qe+"(?="+Qe+")|"+He+Re,"g"),qe=RegExp([De+"?"+xe+"+"+Pe+"(?="+[Be,De,"$"].join("|")+")",Ue+"+"+Te+"(?="+[Be,De+Fe,"$"].join("|")+")",De+"?"+Fe+"+"+Pe,De+"+"+Te,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ce,Oe].join("|"),"g"),Ve=RegExp("[\\u200d\\ud800-\\udfff"+ve+"\\ufe0e\\ufe0f]"),ze=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Je=["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"],Ye=-1,Xe={};Xe[N]=Xe[D]=Xe[F]=Xe[U]=Xe[P]=Xe[T]=Xe[L]=Xe[M]=Xe[R]=!0,Xe[d]=Xe[f]=Xe[k]=Xe[p]=Xe[_]=Xe[g]=Xe[y]=Xe[m]=Xe[w]=Xe[I]=Xe[b]=Xe[E]=Xe[C]=Xe[x]=Xe[Q]=!1;var We={};We[d]=We[f]=We[k]=We[_]=We[p]=We[g]=We[N]=We[D]=We[F]=We[U]=We[P]=We[w]=We[I]=We[b]=We[E]=We[C]=We[x]=We[S]=We[T]=We[L]=We[M]=We[R]=!0,We[y]=We[m]=We[Q]=!1;var Ze={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$e=parseFloat,et=parseInt,tt="object"==typeof Ki&&Ki&&Ki.Object===Object&&Ki,nt="object"==typeof self&&self&&self.Object===Object&&self,rt=tt||nt||Function("return this")(),it=t&&!t.nodeType&&t,ot=it&&e&&!e.nodeType&&e,at=ot&&ot.exports===it,st=at&&tt.process,lt=function(){try{return ot&&ot.require&&ot.require("util").types||st&&st.binding&&st.binding("util")}catch(e){}}(),ut=lt&<.isArrayBuffer,At=lt&<.isDate,ct=lt&<.isMap,ht=lt&<.isRegExp,dt=lt&<.isSet,ft=lt&<.isTypedArray;function pt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function gt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(r,a,n(a),e)}return r}function yt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function mt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function vt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function wt(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function It(e,t){return!(null==e||!e.length)&&Nt(e,t,0)>-1}function bt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function Bt(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Et(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Ct(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function xt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function St(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Qt=Pt("length");function kt(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function _t(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function Nt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):_t(e,Ft,n)}function Dt(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function Ft(e){return e!=e}function Ut(e,t){var n=null==e?0:e.length;return n?Mt(e,t)/n:A}function Pt(e){return function(t){return null==t?n:t[e]}}function Tt(e){return function(t){return null==e?n:e[t]}}function Lt(e,t,n,r,i){return i(e,(function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)})),n}function Mt(e,t){for(var r,i=-1,o=e.length;++i<o;){var a=t(e[i]);a!==n&&(r=r===n?a:r+a)}return r}function Rt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Ot(e){return e?e.slice(0,rn(e)+1).replace(te,""):e}function Ht(e){return function(t){return e(t)}}function Kt(e,t){return Bt(t,(function(t){return e[t]}))}function jt(e,t){return e.has(t)}function Gt(e,t){for(var n=-1,r=e.length;++n<r&&Nt(t,e[n],0)>-1;);return n}function qt(e,t){for(var n=e.length;n--&&Nt(t,e[n],0)>-1;);return n}function Vt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var zt=Tt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Jt=Tt({"&":"&","<":"<",">":">",'"':""","'":"'"});function Yt(e){return"\\"+Ze[e]}function Xt(e){return Ve.test(e)}function Wt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Zt(e,t){return function(n){return e(t(n))}}function $t(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var s=e[n];s!==t&&s!==o||(e[n]=o,a[i++]=n)}return a}function en(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function tn(e){return Xt(e)?function(e){for(var t=Ge.lastIndex=0;Ge.test(e);)++t;return t}(e):Qt(e)}function nn(e){return Xt(e)?function(e){return e.match(Ge)||[]}(e):function(e){return e.split("")}(e)}function rn(e){for(var t=e.length;t--&&ne.test(e.charAt(t)););return t}var on=Tt({"&":"&","<":"<",">":">",""":'"',"'":"'"}),an=function e(t){var ne,ve=(t=null==t?rt:an.defaults(rt.Object(),t,an.pick(rt,Je))).Array,we=t.Date,Ie=t.Error,be=t.Function,Be=t.Math,Ee=t.Object,Ce=t.RegExp,xe=t.String,Se=t.TypeError,Qe=ve.prototype,ke=be.prototype,_e=Ee.prototype,Ne=t["__core-js_shared__"],De=ke.toString,Fe=_e.hasOwnProperty,Ue=0,Pe=(ne=/[^.]+$/.exec(Ne&&Ne.keys&&Ne.keys.IE_PROTO||""))?"Symbol(src)_1."+ne:"",Te=_e.toString,Le=De.call(Ee),Me=rt._,Re=Ce("^"+De.call(Fe).replace($,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Oe=at?t.Buffer:n,He=t.Symbol,Ge=t.Uint8Array,Ve=Oe?Oe.allocUnsafe:n,Ze=Zt(Ee.getPrototypeOf,Ee),tt=Ee.create,nt=_e.propertyIsEnumerable,it=Qe.splice,ot=He?He.isConcatSpreadable:n,st=He?He.iterator:n,lt=He?He.toStringTag:n,Qt=function(){try{var e=lo(Ee,"defineProperty");return e({},"",{}),e}catch(e){}}(),Tt=t.clearTimeout!==rt.clearTimeout&&t.clearTimeout,sn=we&&we.now!==rt.Date.now&&we.now,ln=t.setTimeout!==rt.setTimeout&&t.setTimeout,un=Be.ceil,An=Be.floor,cn=Ee.getOwnPropertySymbols,hn=Oe?Oe.isBuffer:n,dn=t.isFinite,fn=Qe.join,pn=Zt(Ee.keys,Ee),gn=Be.max,yn=Be.min,mn=we.now,vn=t.parseInt,wn=Be.random,In=Qe.reverse,bn=lo(t,"DataView"),Bn=lo(t,"Map"),En=lo(t,"Promise"),Cn=lo(t,"Set"),xn=lo(t,"WeakMap"),Sn=lo(Ee,"create"),Qn=xn&&new xn,kn={},_n=To(bn),Nn=To(Bn),Dn=To(En),Fn=To(Cn),Un=To(xn),Pn=He?He.prototype:n,Tn=Pn?Pn.valueOf:n,Ln=Pn?Pn.toString:n;function Mn(e){if($a(e)&&!Ka(e)&&!(e instanceof Kn)){if(e instanceof Hn)return e;if(Fe.call(e,"__wrapped__"))return Lo(e)}return new Hn(e)}var Rn=function(){function e(){}return function(t){if(!Za(t))return{};if(tt)return tt(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function On(){}function Hn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function Kn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=c,this.__views__=[]}function jn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Vn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new qn;++t<n;)this.add(e[t])}function zn(e){var t=this.__data__=new Gn(e);this.size=t.size}function Jn(e,t){var n=Ka(e),r=!n&&Ha(e),i=!n&&!r&&Va(e),o=!n&&!r&&!i&&ss(e),a=n||r||i||o,s=a?Rt(e.length,xe):[],l=s.length;for(var u in e)!t&&!Fe.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||go(u,l))||s.push(u);return s}function Yn(e){var t=e.length;return t?e[qr(0,t-1)]:n}function Xn(e,t){return Fo(xi(e),or(t,0,e.length))}function Wn(e){return Fo(xi(e))}function Zn(e,t,r){(r!==n&&!Ma(e[t],r)||r===n&&!(t in e))&&rr(e,t,r)}function $n(e,t,r){var i=e[t];Fe.call(e,t)&&Ma(i,r)&&(r!==n||t in e)||rr(e,t,r)}function er(e,t){for(var n=e.length;n--;)if(Ma(e[n][0],t))return n;return-1}function tr(e,t,n,r){return Ar(e,(function(e,i,o){t(r,e,n(e),o)})),r}function nr(e,t){return e&&Si(t,ks(t),e)}function rr(e,t,n){"__proto__"==t&&Qt?Qt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ir(e,t){for(var r=-1,i=t.length,o=ve(i),a=null==e;++r<i;)o[r]=a?n:Es(e,t[r]);return o}function or(e,t,r){return e==e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function ar(e,t,r,i,o,a){var s,l=1&t,u=2&t,A=4&t;if(r&&(s=o?r(e,i,o,a):r(e)),s!==n)return s;if(!Za(e))return e;var c=Ka(e);if(c){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Fe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return xi(e,s)}else{var h=co(e),f=h==m||h==v;if(Va(e))return wi(e,l);if(h==b||h==d||f&&!o){if(s=u||f?{}:fo(e),!l)return u?function(e,t){return Si(e,Ao(e),t)}(e,function(e,t){return e&&Si(t,_s(t),e)}(s,e)):function(e,t){return Si(e,uo(e),t)}(e,nr(s,e))}else{if(!We[h])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case k:return Ii(e);case p:case g:return new i(+e);case _:return function(e,t){var n=t?Ii(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case D:case F:case U:case P:case T:case L:case M:case R:return bi(e,n);case w:return new i;case I:case x:return new i(e);case E:return function(e){var t=new e.constructor(e.source,Ae.exec(e));return t.lastIndex=e.lastIndex,t}(e);case C:return new i;case S:return r=e,Tn?Ee(Tn.call(r)):{}}}(e,h,l)}}a||(a=new zn);var y=a.get(e);if(y)return y;a.set(e,s),is(e)?e.forEach((function(n){s.add(ar(n,t,r,n,e,a))})):es(e)&&e.forEach((function(n,i){s.set(i,ar(n,t,r,i,e,a))}));var B=c?n:(A?u?to:eo:u?_s:ks)(e);return yt(B||e,(function(n,i){B&&(n=e[i=n]),$n(s,i,ar(n,t,r,i,e,a))})),s}function sr(e,t,r){var i=r.length;if(null==e)return!i;for(e=Ee(e);i--;){var o=r[i],a=t[o],s=e[o];if(s===n&&!(o in e)||!a(s))return!1}return!0}function lr(e,t,i){if("function"!=typeof e)throw new Se(r);return ko((function(){e.apply(n,i)}),t)}function ur(e,t,n,r){var i=-1,o=It,a=!0,s=e.length,l=[],u=t.length;if(!s)return l;n&&(t=Bt(t,Ht(n))),r?(o=bt,a=!1):t.length>=200&&(o=jt,a=!1,t=new Vn(t));e:for(;++i<s;){var A=e[i],c=null==n?A:n(A);if(A=r||0!==A?A:0,a&&c==c){for(var h=u;h--;)if(t[h]===c)continue e;l.push(A)}else o(t,c,r)||l.push(A)}return l}Mn.templateSettings={escape:z,evaluate:J,interpolate:Y,variable:"",imports:{_:Mn}},Mn.prototype=On.prototype,Mn.prototype.constructor=Mn,Hn.prototype=Rn(On.prototype),Hn.prototype.constructor=Hn,Kn.prototype=Rn(On.prototype),Kn.prototype.constructor=Kn,jn.prototype.clear=function(){this.__data__=Sn?Sn(null):{},this.size=0},jn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},jn.prototype.get=function(e){var t=this.__data__;if(Sn){var r=t[e];return r===i?n:r}return Fe.call(t,e)?t[e]:n},jn.prototype.has=function(e){var t=this.__data__;return Sn?t[e]!==n:Fe.call(t,e)},jn.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Sn&&t===n?i:t,this},Gn.prototype.clear=function(){this.__data__=[],this.size=0},Gn.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():it.call(t,n,1),--this.size,0))},Gn.prototype.get=function(e){var t=this.__data__,r=er(t,e);return r<0?n:t[r][1]},Gn.prototype.has=function(e){return er(this.__data__,e)>-1},Gn.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new jn,map:new(Bn||Gn),string:new jn}},qn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},qn.prototype.get=function(e){return ao(this,e).get(e)},qn.prototype.has=function(e){return ao(this,e).has(e)},qn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Vn.prototype.add=Vn.prototype.push=function(e){return this.__data__.set(e,i),this},Vn.prototype.has=function(e){return this.__data__.has(e)},zn.prototype.clear=function(){this.__data__=new Gn,this.size=0},zn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},zn.prototype.get=function(e){return this.__data__.get(e)},zn.prototype.has=function(e){return this.__data__.has(e)},zn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Gn){var r=n.__data__;if(!Bn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(e,t),this.size=n.size,this};var Ar=_i(mr),cr=_i(vr,!0);function hr(e,t){var n=!0;return Ar(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function dr(e,t,r){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=t(a);if(null!=s&&(l===n?s==s&&!as(s):r(s,l)))var l=s,u=a}return u}function fr(e,t){var n=[];return Ar(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function pr(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=po),i||(i=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?pr(s,t-1,n,r,i):Et(i,s):r||(i[i.length]=s)}return i}var gr=Ni(),yr=Ni(!0);function mr(e,t){return e&&gr(e,t,ks)}function vr(e,t){return e&&yr(e,t,ks)}function wr(e,t){return wt(t,(function(t){return Ya(e[t])}))}function Ir(e,t){for(var r=0,i=(t=gi(t,e)).length;null!=e&&r<i;)e=e[Po(t[r++])];return r&&r==i?e:n}function br(e,t,n){var r=t(e);return Ka(e)?r:Et(r,n(e))}function Br(e){return null==e?e===n?"[object Undefined]":"[object Null]":lt&< in Ee(e)?function(e){var t=Fe.call(e,lt),r=e[lt];try{e[lt]=n;var i=!0}catch(e){}var o=Te.call(e);return i&&(t?e[lt]=r:delete e[lt]),o}(e):function(e){return Te.call(e)}(e)}function Er(e,t){return e>t}function Cr(e,t){return null!=e&&Fe.call(e,t)}function xr(e,t){return null!=e&&t in Ee(e)}function Sr(e,t,r){for(var i=r?bt:It,o=e[0].length,a=e.length,s=a,l=ve(a),u=1/0,A=[];s--;){var c=e[s];s&&t&&(c=Bt(c,Ht(t))),u=yn(c.length,u),l[s]=!r&&(t||o>=120&&c.length>=120)?new Vn(s&&c):n}c=e[0];var h=-1,d=l[0];e:for(;++h<o&&A.length<u;){var f=c[h],p=t?t(f):f;if(f=r||0!==f?f:0,!(d?jt(d,p):i(A,p,r))){for(s=a;--s;){var g=l[s];if(!(g?jt(g,p):i(e[s],p,r)))continue e}d&&d.push(p),A.push(f)}}return A}function Qr(e,t,r){var i=null==(e=Co(e,t=gi(t,e)))?e:e[Po(Jo(t))];return null==i?n:pt(i,e,r)}function kr(e){return $a(e)&&Br(e)==d}function _r(e,t,r,i,o){return e===t||(null==e||null==t||!$a(e)&&!$a(t)?e!=e&&t!=t:function(e,t,r,i,o,a){var s=Ka(e),l=Ka(t),u=s?f:co(e),A=l?f:co(t),c=(u=u==d?b:u)==b,h=(A=A==d?b:A)==b,m=u==A;if(m&&Va(e)){if(!Va(t))return!1;s=!0,c=!1}if(m&&!c)return a||(a=new zn),s||ss(e)?Zi(e,t,r,i,o,a):function(e,t,n,r,i,o,a){switch(n){case _:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case k:return!(e.byteLength!=t.byteLength||!o(new Ge(e),new Ge(t)));case p:case g:case I:return Ma(+e,+t);case y:return e.name==t.name&&e.message==t.message;case E:case x:return e==t+"";case w:var s=Wt;case C:var l=1&r;if(s||(s=en),e.size!=t.size&&!l)return!1;var u=a.get(e);if(u)return u==t;r|=2,a.set(e,t);var A=Zi(s(e),s(t),r,i,o,a);return a.delete(e),A;case S:if(Tn)return Tn.call(e)==Tn.call(t)}return!1}(e,t,u,r,i,o,a);if(!(1&r)){var v=c&&Fe.call(e,"__wrapped__"),B=h&&Fe.call(t,"__wrapped__");if(v||B){var Q=v?e.value():e,N=B?t.value():t;return a||(a=new zn),o(Q,N,r,i,a)}}return!!m&&(a||(a=new zn),function(e,t,r,i,o,a){var s=1&r,l=eo(e),u=l.length;if(u!=eo(t).length&&!s)return!1;for(var A=u;A--;){var c=l[A];if(!(s?c in t:Fe.call(t,c)))return!1}var h=a.get(e),d=a.get(t);if(h&&d)return h==t&&d==e;var f=!0;a.set(e,t),a.set(t,e);for(var p=s;++A<u;){var g=e[c=l[A]],y=t[c];if(i)var m=s?i(y,g,c,t,e,a):i(g,y,c,e,t,a);if(!(m===n?g===y||o(g,y,r,i,a):m)){f=!1;break}p||(p="constructor"==c)}if(f&&!p){var v=e.constructor,w=t.constructor;v==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof w&&w instanceof w||(f=!1)}return a.delete(e),a.delete(t),f}(e,t,r,i,o,a))}(e,t,r,i,_r,o))}function Nr(e,t,r,i){var o=r.length,a=o,s=!i;if(null==e)return!a;for(e=Ee(e);o--;){var l=r[o];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++o<a;){var u=(l=r[o])[0],A=e[u],c=l[1];if(s&&l[2]){if(A===n&&!(u in e))return!1}else{var h=new zn;if(i)var d=i(A,c,u,e,t,h);if(!(d===n?_r(c,A,3,i,h):d))return!1}}return!0}function Dr(e){return!(!Za(e)||(t=e,Pe&&Pe in t))&&(Ya(e)?Re:de).test(To(e));var t}function Fr(e){return"function"==typeof e?e:null==e?tl:"object"==typeof e?Ka(e)?Mr(e[0],e[1]):Lr(e):Al(e)}function Ur(e){if(!Io(e))return pn(e);var t=[];for(var n in Ee(e))Fe.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Pr(e,t){return e<t}function Tr(e,t){var n=-1,r=Ga(e)?ve(e.length):[];return Ar(e,(function(e,i,o){r[++n]=t(e,i,o)})),r}function Lr(e){var t=so(e);return 1==t.length&&t[0][2]?Bo(t[0][0],t[0][1]):function(n){return n===e||Nr(n,e,t)}}function Mr(e,t){return mo(e)&&bo(t)?Bo(Po(e),t):function(r){var i=Es(r,e);return i===n&&i===t?Cs(r,e):_r(t,i,3)}}function Rr(e,t,r,i,o){e!==t&&gr(t,(function(a,s){if(o||(o=new zn),Za(a))!function(e,t,r,i,o,a,s){var l=So(e,r),u=So(t,r),A=s.get(u);if(A)Zn(e,r,A);else{var c=a?a(l,u,r+"",e,t,s):n,h=c===n;if(h){var d=Ka(u),f=!d&&Va(u),p=!d&&!f&&ss(u);c=u,d||f||p?Ka(l)?c=l:qa(l)?c=xi(l):f?(h=!1,c=wi(u,!0)):p?(h=!1,c=bi(u,!0)):c=[]:ns(u)||Ha(u)?(c=l,Ha(l)?c=ps(l):Za(l)&&!Ya(l)||(c=fo(u))):h=!1}h&&(s.set(u,c),o(c,u,i,a,s),s.delete(u)),Zn(e,r,c)}}(e,t,s,r,Rr,i,o);else{var l=i?i(So(e,s),a,s+"",e,t,o):n;l===n&&(l=a),Zn(e,s,l)}}),_s)}function Or(e,t){var r=e.length;if(r)return go(t+=t<0?r:0,r)?e[t]:n}function Hr(e,t,n){t=t.length?Bt(t,(function(e){return Ka(e)?function(t){return Ir(t,1===e.length?e[0]:e)}:e})):[tl];var r=-1;t=Bt(t,Ht(oo()));var i=Tr(e,(function(e,n,i){var o=Bt(t,(function(t){return t(e)}));return{criteria:o,index:++r,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(i,(function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r<a;){var l=Bi(i[r],o[r]);if(l)return r>=s?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Kr(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=Ir(e,a);n(s,a)&&Xr(o,gi(a,e),s)}return o}function jr(e,t,n,r){var i=r?Dt:Nt,o=-1,a=t.length,s=e;for(e===t&&(t=xi(t)),n&&(s=Bt(e,Ht(n)));++o<a;)for(var l=0,u=t[o],A=n?n(u):u;(l=i(s,A,l,r))>-1;)s!==e&&it.call(s,l,1),it.call(e,l,1);return e}function Gr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;go(i)?it.call(e,i,1):li(e,i)}}return e}function qr(e,t){return e+An(wn()*(t-e+1))}function Vr(e,t){var n="";if(!e||t<1||t>u)return n;do{t%2&&(n+=e),(t=An(t/2))&&(e+=e)}while(t);return n}function zr(e,t){return _o(Eo(e,t,tl),e+"")}function Jr(e){return Yn(Ms(e))}function Yr(e,t){var n=Ms(e);return Fo(n,or(t,0,n.length))}function Xr(e,t,r,i){if(!Za(e))return e;for(var o=-1,a=(t=gi(t,e)).length,s=a-1,l=e;null!=l&&++o<a;){var u=Po(t[o]),A=r;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(o!=s){var c=l[u];(A=i?i(c,u,l):n)===n&&(A=Za(c)?c:go(t[o+1])?[]:{})}$n(l,u,A),l=l[u]}return e}var Wr=Qn?function(e,t){return Qn.set(e,t),e}:tl,Zr=Qt?function(e,t){return Qt(e,"toString",{configurable:!0,enumerable:!1,value:Zs(t),writable:!0})}:tl;function $r(e){return Fo(Ms(e))}function ei(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=ve(i);++r<i;)o[r]=e[r+t];return o}function ti(e,t){var n;return Ar(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function ni(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=e[o];null!==a&&!as(a)&&(n?a<=t:a<t)?r=o+1:i=o}return i}return ri(e,t,tl,n)}function ri(e,t,r,i){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=r(t))!=t,l=null===t,u=as(t),A=t===n;o<a;){var c=An((o+a)/2),h=r(e[c]),d=h!==n,f=null===h,p=h==h,g=as(h);if(s)var y=i||p;else y=A?p&&(i||d):l?p&&d&&(i||!f):u?p&&d&&!f&&(i||!g):!f&&!g&&(i?h<=t:h<t);y?o=c+1:a=c}return yn(a,4294967294)}function ii(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!Ma(s,l)){var l=s;o[i++]=0===a?0:a}}return o}function oi(e){return"number"==typeof e?e:as(e)?A:+e}function ai(e){if("string"==typeof e)return e;if(Ka(e))return Bt(e,ai)+"";if(as(e))return Ln?Ln.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function si(e,t,n){var r=-1,i=It,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=bt;else if(o>=200){var u=t?null:Vi(e);if(u)return en(u);a=!1,i=jt,l=new Vn}else l=t?[]:s;e:for(;++r<o;){var A=e[r],c=t?t(A):A;if(A=n||0!==A?A:0,a&&c==c){for(var h=l.length;h--;)if(l[h]===c)continue e;t&&l.push(c),s.push(A)}else i(l,c,n)||(l!==s&&l.push(c),s.push(A))}return s}function li(e,t){return null==(e=Co(e,t=gi(t,e)))||delete e[Po(Jo(t))]}function ui(e,t,n,r){return Xr(e,t,n(Ir(e,t)),r)}function Ai(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?ei(e,r?0:o,r?o+1:i):ei(e,r?o+1:0,r?i:o)}function ci(e,t){var n=e;return n instanceof Kn&&(n=n.value()),Ct(t,(function(e,t){return t.func.apply(t.thisArg,Et([e],t.args))}),n)}function hi(e,t,n){var r=e.length;if(r<2)return r?si(e[0]):[];for(var i=-1,o=ve(r);++i<r;)for(var a=e[i],s=-1;++s<r;)s!=i&&(o[i]=ur(o[i]||a,e[s],t,n));return si(pr(o,1),t,n)}function di(e,t,r){for(var i=-1,o=e.length,a=t.length,s={};++i<o;){var l=i<a?t[i]:n;r(s,e[i],l)}return s}function fi(e){return qa(e)?e:[]}function pi(e){return"function"==typeof e?e:tl}function gi(e,t){return Ka(e)?e:mo(e,t)?[e]:Uo(gs(e))}var yi=zr;function mi(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:ei(e,t,r)}var vi=Tt||function(e){return rt.clearTimeout(e)};function wi(e,t){if(t)return e.slice();var n=e.length,r=Ve?Ve(n):new e.constructor(n);return e.copy(r),r}function Ii(e){var t=new e.constructor(e.byteLength);return new Ge(t).set(new Ge(e)),t}function bi(e,t){var n=t?Ii(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Bi(e,t){if(e!==t){var r=e!==n,i=null===e,o=e==e,a=as(e),s=t!==n,l=null===t,u=t==t,A=as(t);if(!l&&!A&&!a&&e>t||a&&s&&u&&!l&&!A||i&&s&&u||!r&&u||!o)return 1;if(!i&&!a&&!A&&e<t||A&&r&&o&&!i&&!a||l&&r&&o||!s&&o||!u)return-1}return 0}function Ei(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,l=t.length,u=gn(o-a,0),A=ve(l+u),c=!r;++s<l;)A[s]=t[s];for(;++i<a;)(c||i<o)&&(A[n[i]]=e[i]);for(;u--;)A[s++]=e[i++];return A}function Ci(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,l=-1,u=t.length,A=gn(o-s,0),c=ve(A+u),h=!r;++i<A;)c[i]=e[i];for(var d=i;++l<u;)c[d+l]=t[l];for(;++a<s;)(h||i<o)&&(c[d+n[a]]=e[i++]);return c}function xi(e,t){var n=-1,r=e.length;for(t||(t=ve(r));++n<r;)t[n]=e[n];return t}function Si(e,t,r,i){var o=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var l=t[a],u=i?i(r[l],e[l],l,r,e):n;u===n&&(u=e[l]),o?rr(r,l,u):$n(r,l,u)}return r}function Qi(e,t){return function(n,r){var i=Ka(n)?gt:tr,o=t?t():{};return i(n,e,oo(r,2),o)}}function ki(e){return zr((function(t,r){var i=-1,o=r.length,a=o>1?r[o-1]:n,s=o>2?r[2]:n;for(a=e.length>3&&"function"==typeof a?(o--,a):n,s&&yo(r[0],r[1],s)&&(a=o<3?n:a,o=1),t=Ee(t);++i<o;){var l=r[i];l&&e(t,l,i,a)}return t}))}function _i(e,t){return function(n,r){if(null==n)return n;if(!Ga(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Ee(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Ni(e){return function(t,n,r){for(var i=-1,o=Ee(t),a=r(t),s=a.length;s--;){var l=a[e?s:++i];if(!1===n(o[l],l,o))break}return t}}function Di(e){return function(t){var r=Xt(t=gs(t))?nn(t):n,i=r?r[0]:t.charAt(0),o=r?mi(r,1).join(""):t.slice(1);return i[e]()+o}}function Fi(e){return function(t){return Ct(Ys(Hs(t).replace(Ke,"")),e,"")}}function Ui(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Rn(e.prototype),r=e.apply(n,t);return Za(r)?r:n}}function Pi(e){return function(t,r,i){var o=Ee(t);if(!Ga(t)){var a=oo(r,3);t=ks(t),r=function(e){return a(o[e],e,o)}}var s=e(t,r,i);return s>-1?o[a?t[s]:s]:n}}function Ti(e){return $i((function(t){var i=t.length,o=i,a=Hn.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Se(r);if(a&&!l&&"wrapper"==ro(s))var l=new Hn([],!0)}for(o=l?o:i;++o<i;){var u=ro(s=t[o]),A="wrapper"==u?no(s):n;l=A&&vo(A[0])&&424==A[1]&&!A[4].length&&1==A[9]?l[ro(A[0])].apply(l,A[3]):1==s.length&&vo(s)?l[u]():l.thru(s)}return function(){var e=arguments,n=e[0];if(l&&1==e.length&&Ka(n))return l.plant(n).value();for(var r=0,o=i?t[r].apply(this,e):n;++r<i;)o=t[r].call(this,o);return o}}))}function Li(e,t,r,i,o,a,l,u,A,c){var h=t&s,d=1&t,f=2&t,p=24&t,g=512&t,y=f?n:Ui(e);return function n(){for(var s=arguments.length,m=ve(s),v=s;v--;)m[v]=arguments[v];if(p)var w=io(n),I=Vt(m,w);if(i&&(m=Ei(m,i,o,p)),a&&(m=Ci(m,a,l,p)),s-=I,p&&s<c){var b=$t(m,w);return Gi(e,t,Li,n.placeholder,r,m,b,u,A,c-s)}var B=d?r:this,E=f?B[e]:e;return s=m.length,u?m=xo(m,u):g&&s>1&&m.reverse(),h&&A<s&&(m.length=A),this&&this!==rt&&this instanceof n&&(E=y||Ui(E)),E.apply(B,m)}}function Mi(e,t){return function(n,r){return function(e,t,n,r){return mr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function Ri(e,t){return function(r,i){var o;if(r===n&&i===n)return t;if(r!==n&&(o=r),i!==n){if(o===n)return i;"string"==typeof r||"string"==typeof i?(r=ai(r),i=ai(i)):(r=oi(r),i=oi(i)),o=e(r,i)}return o}}function Oi(e){return $i((function(t){return t=Bt(t,Ht(oo())),zr((function(n){var r=this;return e(t,(function(e){return pt(e,r,n)}))}))}))}function Hi(e,t){var r=(t=t===n?" ":ai(t)).length;if(r<2)return r?Vr(t,e):t;var i=Vr(t,un(e/tn(t)));return Xt(t)?mi(nn(i),0,e).join(""):i.slice(0,e)}function Ki(e){return function(t,r,i){return i&&"number"!=typeof i&&yo(t,r,i)&&(r=i=n),t=cs(t),r===n?(r=t,t=0):r=cs(r),function(e,t,n,r){for(var i=-1,o=gn(un((t-e)/(n||1)),0),a=ve(o);o--;)a[r?o:++i]=e,e+=n;return a}(t,r,i=i===n?t<r?1:-1:cs(i),e)}}function ji(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=fs(t),n=fs(n)),e(t,n)}}function Gi(e,t,r,i,o,s,l,u,A,c){var h=8&t;t|=h?a:64,4&(t&=~(h?64:a))||(t&=-4);var d=[e,t,o,h?s:n,h?l:n,h?n:s,h?n:l,u,A,c],f=r.apply(n,d);return vo(e)&&Qo(f,d),f.placeholder=i,No(f,e,t)}function qi(e){var t=Be[e];return function(e,n){if(e=fs(e),(n=null==n?0:yn(hs(n),292))&&dn(e)){var r=(gs(e)+"e").split("e");return+((r=(gs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Vi=Cn&&1/en(new Cn([,-0]))[1]==l?function(e){return new Cn(e)}:al;function zi(e){return function(t){var n=co(t);return n==w?Wt(t):n==C?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return Bt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Ji(e,t,i,l,u,A,c,h){var d=2&t;if(!d&&"function"!=typeof e)throw new Se(r);var f=l?l.length:0;if(f||(t&=-97,l=u=n),c=c===n?c:gn(hs(c),0),h=h===n?h:hs(h),f-=u?u.length:0,64&t){var p=l,g=u;l=u=n}var y=d?n:no(e),m=[e,t,i,l,u,p,g,A,c,h];if(y&&function(e,t){var n=e[1],r=t[1],i=n|r,a=i<131,l=r==s&&8==n||r==s&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!a&&!l)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var A=e[3];e[3]=A?Ei(A,u,t[4]):u,e[4]=A?$t(e[3],o):t[4]}(u=t[5])&&(A=e[5],e[5]=A?Ci(A,u,t[6]):u,e[6]=A?$t(e[5],o):t[6]),(u=t[7])&&(e[7]=u),r&s&&(e[8]=null==e[8]?t[8]:yn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(m,y),e=m[0],t=m[1],i=m[2],l=m[3],u=m[4],!(h=m[9]=m[9]===n?d?0:e.length:gn(m[9]-f,0))&&24&t&&(t&=-25),t&&1!=t)v=8==t||16==t?function(e,t,r){var i=Ui(e);return function o(){for(var a=arguments.length,s=ve(a),l=a,u=io(o);l--;)s[l]=arguments[l];var A=a<3&&s[0]!==u&&s[a-1]!==u?[]:$t(s,u);return(a-=A.length)<r?Gi(e,t,Li,o.placeholder,n,s,A,n,n,r-a):pt(this&&this!==rt&&this instanceof o?i:e,this,s)}}(e,t,h):t!=a&&33!=t||u.length?Li.apply(n,m):function(e,t,n,r){var i=1&t,o=Ui(e);return function t(){for(var a=-1,s=arguments.length,l=-1,u=r.length,A=ve(u+s),c=this&&this!==rt&&this instanceof t?o:e;++l<u;)A[l]=r[l];for(;s--;)A[l++]=arguments[++a];return pt(c,i?n:this,A)}}(e,t,i,l);else var v=function(e,t,n){var r=1&t,i=Ui(e);return function t(){return(this&&this!==rt&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,i);return No((y?Wr:Qo)(v,m),e,t)}function Yi(e,t,r,i){return e===n||Ma(e,_e[r])&&!Fe.call(i,r)?t:e}function Xi(e,t,r,i,o,a){return Za(e)&&Za(t)&&(a.set(t,e),Rr(e,t,n,Xi,a),a.delete(t)),e}function Wi(e){return ns(e)?n:e}function Zi(e,t,r,i,o,a){var s=1&r,l=e.length,u=t.length;if(l!=u&&!(s&&u>l))return!1;var A=a.get(e),c=a.get(t);if(A&&c)return A==t&&c==e;var h=-1,d=!0,f=2&r?new Vn:n;for(a.set(e,t),a.set(t,e);++h<l;){var p=e[h],g=t[h];if(i)var y=s?i(g,p,h,t,e,a):i(p,g,h,e,t,a);if(y!==n){if(y)continue;d=!1;break}if(f){if(!St(t,(function(e,t){if(!jt(f,t)&&(p===e||o(p,e,r,i,a)))return f.push(t)}))){d=!1;break}}else if(p!==g&&!o(p,g,r,i,a)){d=!1;break}}return a.delete(e),a.delete(t),d}function $i(e){return _o(Eo(e,n,jo),e+"")}function eo(e){return br(e,ks,uo)}function to(e){return br(e,_s,Ao)}var no=Qn?function(e){return Qn.get(e)}:al;function ro(e){for(var t=e.name+"",n=kn[t],r=Fe.call(kn,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function io(e){return(Fe.call(Mn,"placeholder")?Mn:e).placeholder}function oo(){var e=Mn.iteratee||nl;return e=e===nl?Fr:e,arguments.length?e(arguments[0],arguments[1]):e}function ao(e,t){var n=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function so(e){for(var t=ks(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,bo(i)]}return t}function lo(e,t){var r=function(e,t){return null==e?n:e[t]}(e,t);return Dr(r)?r:n}var uo=cn?function(e){return null==e?[]:(e=Ee(e),wt(cn(e),(function(t){return nt.call(e,t)})))}:dl,Ao=cn?function(e){for(var t=[];e;)Et(t,uo(e)),e=Ze(e);return t}:dl,co=Br;function ho(e,t,n){for(var r=-1,i=(t=gi(t,e)).length,o=!1;++r<i;){var a=Po(t[r]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Wa(i)&&go(a,i)&&(Ka(e)||Ha(e))}function fo(e){return"function"!=typeof e.constructor||Io(e)?{}:Rn(Ze(e))}function po(e){return Ka(e)||Ha(e)||!!(ot&&e&&e[ot])}function go(e,t){var n=typeof e;return!!(t=null==t?u:t)&&("number"==n||"symbol"!=n&&pe.test(e))&&e>-1&&e%1==0&&e<t}function yo(e,t,n){if(!Za(n))return!1;var r=typeof t;return!!("number"==r?Ga(n)&&go(t,n.length):"string"==r&&t in n)&&Ma(n[t],e)}function mo(e,t){if(Ka(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!as(e))||W.test(e)||!X.test(e)||null!=t&&e in Ee(t)}function vo(e){var t=ro(e),n=Mn[t];if("function"!=typeof n||!(t in Kn.prototype))return!1;if(e===n)return!0;var r=no(n);return!!r&&e===r[0]}(bn&&co(new bn(new ArrayBuffer(1)))!=_||Bn&&co(new Bn)!=w||En&&co(En.resolve())!=B||Cn&&co(new Cn)!=C||xn&&co(new xn)!=Q)&&(co=function(e){var t=Br(e),r=t==b?e.constructor:n,i=r?To(r):"";if(i)switch(i){case _n:return _;case Nn:return w;case Dn:return B;case Fn:return C;case Un:return Q}return t});var wo=Ne?Ya:fl;function Io(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||_e)}function bo(e){return e==e&&!Za(e)}function Bo(e,t){return function(r){return null!=r&&r[e]===t&&(t!==n||e in Ee(r))}}function Eo(e,t,r){return t=gn(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=gn(n.length-t,0),a=ve(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=ve(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),pt(e,this,s)}}function Co(e,t){return t.length<2?e:Ir(e,ei(t,0,-1))}function xo(e,t){for(var r=e.length,i=yn(t.length,r),o=xi(e);i--;){var a=t[i];e[i]=go(a,r)?o[a]:n}return e}function So(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Qo=Do(Wr),ko=ln||function(e,t){return rt.setTimeout(e,t)},_o=Do(Zr);function No(e,t,n){var r=t+"";return _o(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(re,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return yt(h,(function(n){var r="_."+n[0];t&n[1]&&!It(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ie);return t?t[1].split(oe):[]}(r),n)))}function Do(e){var t=0,r=0;return function(){var i=mn(),o=16-(i-r);if(r=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Fo(e,t){var r=-1,i=e.length,o=i-1;for(t=t===n?i:t;++r<t;){var a=qr(r,o),s=e[a];e[a]=e[r],e[r]=s}return e.length=t,e}var Uo=function(e){var t=Da((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Z,(function(e,n,r,i){t.push(r?i.replace(le,"$1"):n||e)})),t}),(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}();function Po(e){if("string"==typeof e||as(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function To(e){if(null!=e){try{return De.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Lo(e){if(e instanceof Kn)return e.clone();var t=new Hn(e.__wrapped__,e.__chain__);return t.__actions__=xi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Mo=zr((function(e,t){return qa(e)?ur(e,pr(t,1,qa,!0)):[]})),Ro=zr((function(e,t){var r=Jo(t);return qa(r)&&(r=n),qa(e)?ur(e,pr(t,1,qa,!0),oo(r,2)):[]})),Oo=zr((function(e,t){var r=Jo(t);return qa(r)&&(r=n),qa(e)?ur(e,pr(t,1,qa,!0),n,r):[]}));function Ho(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=gn(r+i,0)),_t(e,oo(t,3),i)}function Ko(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return r!==n&&(o=hs(r),o=r<0?gn(i+o,0):yn(o,i-1)),_t(e,oo(t,3),o,!0)}function jo(e){return null!=e&&e.length?pr(e,1):[]}function Go(e){return e&&e.length?e[0]:n}var qo=zr((function(e){var t=Bt(e,fi);return t.length&&t[0]===e[0]?Sr(t):[]})),Vo=zr((function(e){var t=Jo(e),r=Bt(e,fi);return t===Jo(r)?t=n:r.pop(),r.length&&r[0]===e[0]?Sr(r,oo(t,2)):[]})),zo=zr((function(e){var t=Jo(e),r=Bt(e,fi);return(t="function"==typeof t?t:n)&&r.pop(),r.length&&r[0]===e[0]?Sr(r,n,t):[]}));function Jo(e){var t=null==e?0:e.length;return t?e[t-1]:n}var Yo=zr(Xo);function Xo(e,t){return e&&e.length&&t&&t.length?jr(e,t):e}var Wo=$i((function(e,t){var n=null==e?0:e.length,r=ir(e,t);return Gr(e,Bt(t,(function(e){return go(e,n)?+e:e})).sort(Bi)),r}));function Zo(e){return null==e?e:In.call(e)}var $o=zr((function(e){return si(pr(e,1,qa,!0))})),ea=zr((function(e){var t=Jo(e);return qa(t)&&(t=n),si(pr(e,1,qa,!0),oo(t,2))})),ta=zr((function(e){var t=Jo(e);return t="function"==typeof t?t:n,si(pr(e,1,qa,!0),n,t)}));function na(e){if(!e||!e.length)return[];var t=0;return e=wt(e,(function(e){if(qa(e))return t=gn(e.length,t),!0})),Rt(t,(function(t){return Bt(e,Pt(t))}))}function ra(e,t){if(!e||!e.length)return[];var r=na(e);return null==t?r:Bt(r,(function(e){return pt(t,n,e)}))}var ia=zr((function(e,t){return qa(e)?ur(e,t):[]})),oa=zr((function(e){return hi(wt(e,qa))})),aa=zr((function(e){var t=Jo(e);return qa(t)&&(t=n),hi(wt(e,qa),oo(t,2))})),sa=zr((function(e){var t=Jo(e);return t="function"==typeof t?t:n,hi(wt(e,qa),n,t)})),la=zr(na),ua=zr((function(e){var t=e.length,r=t>1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,ra(e,r)}));function Aa(e){var t=Mn(e);return t.__chain__=!0,t}function ca(e,t){return t(e)}var ha=$i((function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Kn&&go(r)?((i=i.slice(r,+r+(t?1:0))).__actions__.push({func:ca,args:[o],thisArg:n}),new Hn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(n),e}))):this.thru(o)})),da=Qi((function(e,t,n){Fe.call(e,n)?++e[n]:rr(e,n,1)})),fa=Pi(Ho),pa=Pi(Ko);function ga(e,t){return(Ka(e)?yt:Ar)(e,oo(t,3))}function ya(e,t){return(Ka(e)?mt:cr)(e,oo(t,3))}var ma=Qi((function(e,t,n){Fe.call(e,n)?e[n].push(t):rr(e,n,[t])})),va=zr((function(e,t,n){var r=-1,i="function"==typeof t,o=Ga(e)?ve(e.length):[];return Ar(e,(function(e){o[++r]=i?pt(t,e,n):Qr(e,t,n)})),o})),wa=Qi((function(e,t,n){rr(e,n,t)}));function Ia(e,t){return(Ka(e)?Bt:Tr)(e,oo(t,3))}var ba=Qi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Ba=zr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Hr(e,pr(t,1),[])})),Ea=sn||function(){return rt.Date.now()};function Ca(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,Ji(e,s,n,n,n,n,t)}function xa(e,t){var i;if("function"!=typeof t)throw new Se(r);return e=hs(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=n),i}}var Sa=zr((function(e,t,n){var r=1;if(n.length){var i=$t(n,io(Sa));r|=a}return Ji(e,r,t,n,i)})),Qa=zr((function(e,t,n){var r=3;if(n.length){var i=$t(n,io(Qa));r|=a}return Ji(t,r,e,n,i)}));function ka(e,t,i){var o,a,s,l,u,A,c=0,h=!1,d=!1,f=!0;if("function"!=typeof e)throw new Se(r);function p(t){var r=o,i=a;return o=a=n,c=t,l=e.apply(i,r)}function g(e){return c=e,u=ko(m,t),h?p(e):l}function y(e){var r=e-A;return A===n||r>=t||r<0||d&&e-c>=s}function m(){var e=Ea();if(y(e))return v(e);u=ko(m,function(e){var n=t-(e-A);return d?yn(n,s-(e-c)):n}(e))}function v(e){return u=n,f&&o?p(e):(o=a=n,l)}function w(){var e=Ea(),r=y(e);if(o=arguments,a=this,A=e,r){if(u===n)return g(A);if(d)return vi(u),u=ko(m,t),p(A)}return u===n&&(u=ko(m,t)),l}return t=fs(t)||0,Za(i)&&(h=!!i.leading,s=(d="maxWait"in i)?gn(fs(i.maxWait)||0,t):s,f="trailing"in i?!!i.trailing:f),w.cancel=function(){u!==n&&vi(u),c=0,o=A=a=u=n},w.flush=function(){return u===n?l:v(Ea())},w}var _a=zr((function(e,t){return lr(e,1,t)})),Na=zr((function(e,t,n){return lr(e,fs(t)||0,n)}));function Da(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Se(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Da.Cache||qn),n}function Fa(e){if("function"!=typeof e)throw new Se(r);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Da.Cache=qn;var Ua=yi((function(e,t){var n=(t=1==t.length&&Ka(t[0])?Bt(t[0],Ht(oo())):Bt(pr(t,1),Ht(oo()))).length;return zr((function(r){for(var i=-1,o=yn(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return pt(e,this,r)}))})),Pa=zr((function(e,t){var r=$t(t,io(Pa));return Ji(e,a,n,t,r)})),Ta=zr((function(e,t){var r=$t(t,io(Ta));return Ji(e,64,n,t,r)})),La=$i((function(e,t){return Ji(e,256,n,n,n,t)}));function Ma(e,t){return e===t||e!=e&&t!=t}var Ra=ji(Er),Oa=ji((function(e,t){return e>=t})),Ha=kr(function(){return arguments}())?kr:function(e){return $a(e)&&Fe.call(e,"callee")&&!nt.call(e,"callee")},Ka=ve.isArray,ja=ut?Ht(ut):function(e){return $a(e)&&Br(e)==k};function Ga(e){return null!=e&&Wa(e.length)&&!Ya(e)}function qa(e){return $a(e)&&Ga(e)}var Va=hn||fl,za=At?Ht(At):function(e){return $a(e)&&Br(e)==g};function Ja(e){if(!$a(e))return!1;var t=Br(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ns(e)}function Ya(e){if(!Za(e))return!1;var t=Br(e);return t==m||t==v||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xa(e){return"number"==typeof e&&e==hs(e)}function Wa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function Za(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function $a(e){return null!=e&&"object"==typeof e}var es=ct?Ht(ct):function(e){return $a(e)&&co(e)==w};function ts(e){return"number"==typeof e||$a(e)&&Br(e)==I}function ns(e){if(!$a(e)||Br(e)!=b)return!1;var t=Ze(e);if(null===t)return!0;var n=Fe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&De.call(n)==Le}var rs=ht?Ht(ht):function(e){return $a(e)&&Br(e)==E},is=dt?Ht(dt):function(e){return $a(e)&&co(e)==C};function os(e){return"string"==typeof e||!Ka(e)&&$a(e)&&Br(e)==x}function as(e){return"symbol"==typeof e||$a(e)&&Br(e)==S}var ss=ft?Ht(ft):function(e){return $a(e)&&Wa(e.length)&&!!Xe[Br(e)]},ls=ji(Pr),us=ji((function(e,t){return e<=t}));function As(e){if(!e)return[];if(Ga(e))return os(e)?nn(e):xi(e);if(st&&e[st])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[st]());var t=co(e);return(t==w?Wt:t==C?en:Ms)(e)}function cs(e){return e?(e=fs(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hs(e){var t=cs(e),n=t%1;return t==t?n?t-n:t:0}function ds(e){return e?or(hs(e),0,c):0}function fs(e){if("number"==typeof e)return e;if(as(e))return A;if(Za(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Za(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ot(e);var n=he.test(e);return n||fe.test(e)?et(e.slice(2),n?2:8):ce.test(e)?A:+e}function ps(e){return Si(e,_s(e))}function gs(e){return null==e?"":ai(e)}var ys=ki((function(e,t){if(Io(t)||Ga(t))Si(t,ks(t),e);else for(var n in t)Fe.call(t,n)&&$n(e,n,t[n])})),ms=ki((function(e,t){Si(t,_s(t),e)})),vs=ki((function(e,t,n,r){Si(t,_s(t),e,r)})),ws=ki((function(e,t,n,r){Si(t,ks(t),e,r)})),Is=$i(ir),bs=zr((function(e,t){e=Ee(e);var r=-1,i=t.length,o=i>2?t[2]:n;for(o&&yo(t[0],t[1],o)&&(i=1);++r<i;)for(var a=t[r],s=_s(a),l=-1,u=s.length;++l<u;){var A=s[l],c=e[A];(c===n||Ma(c,_e[A])&&!Fe.call(e,A))&&(e[A]=a[A])}return e})),Bs=zr((function(e){return e.push(n,Xi),pt(Ds,n,e)}));function Es(e,t,r){var i=null==e?n:Ir(e,t);return i===n?r:i}function Cs(e,t){return null!=e&&ho(e,t,xr)}var xs=Mi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),e[t]=n}),Zs(tl)),Ss=Mi((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),Fe.call(e,t)?e[t].push(n):e[t]=[n]}),oo),Qs=zr(Qr);function ks(e){return Ga(e)?Jn(e):Ur(e)}function _s(e){return Ga(e)?Jn(e,!0):function(e){if(!Za(e))return function(e){var t=[];if(null!=e)for(var n in Ee(e))t.push(n);return t}(e);var t=Io(e),n=[];for(var r in e)("constructor"!=r||!t&&Fe.call(e,r))&&n.push(r);return n}(e)}var Ns=ki((function(e,t,n){Rr(e,t,n)})),Ds=ki((function(e,t,n,r){Rr(e,t,n,r)})),Fs=$i((function(e,t){var n={};if(null==e)return n;var r=!1;t=Bt(t,(function(t){return t=gi(t,e),r||(r=t.length>1),t})),Si(e,to(e),n),r&&(n=ar(n,7,Wi));for(var i=t.length;i--;)li(n,t[i]);return n})),Us=$i((function(e,t){return null==e?{}:function(e,t){return Kr(e,t,(function(t,n){return Cs(e,n)}))}(e,t)}));function Ps(e,t){if(null==e)return{};var n=Bt(to(e),(function(e){return[e]}));return t=oo(t),Kr(e,n,(function(e,n){return t(e,n[0])}))}var Ts=zi(ks),Ls=zi(_s);function Ms(e){return null==e?[]:Kt(e,ks(e))}var Rs=Fi((function(e,t,n){return t=t.toLowerCase(),e+(n?Os(t):t)}));function Os(e){return Js(gs(e).toLowerCase())}function Hs(e){return(e=gs(e))&&e.replace(ge,zt).replace(je,"")}var Ks=Fi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),js=Fi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Gs=Di("toLowerCase"),qs=Fi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Vs=Fi((function(e,t,n){return e+(n?" ":"")+Js(t)})),zs=Fi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Js=Di("toUpperCase");function Ys(e,t,r){return e=gs(e),(t=r?n:t)===n?function(e){return ze.test(e)}(e)?function(e){return e.match(qe)||[]}(e):function(e){return e.match(ae)||[]}(e):e.match(t)||[]}var Xs=zr((function(e,t){try{return pt(e,n,t)}catch(e){return Ja(e)?e:new Ie(e)}})),Ws=$i((function(e,t){return yt(t,(function(t){t=Po(t),rr(e,t,Sa(e[t],e))})),e}));function Zs(e){return function(){return e}}var $s=Ti(),el=Ti(!0);function tl(e){return e}function nl(e){return Fr("function"==typeof e?e:ar(e,1))}var rl=zr((function(e,t){return function(n){return Qr(n,e,t)}})),il=zr((function(e,t){return function(n){return Qr(e,n,t)}}));function ol(e,t,n){var r=ks(t),i=wr(t,r);null!=n||Za(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=wr(t,ks(t)));var o=!(Za(n)&&"chain"in n&&!n.chain),a=Ya(e);return yt(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=xi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Et([this.value()],arguments))})})),e}function al(){}var sl=Oi(Bt),ll=Oi(vt),ul=Oi(St);function Al(e){return mo(e)?Pt(Po(e)):function(e){return function(t){return Ir(t,e)}}(e)}var cl=Ki(),hl=Ki(!0);function dl(){return[]}function fl(){return!1}var pl,gl=Ri((function(e,t){return e+t}),0),yl=qi("ceil"),ml=Ri((function(e,t){return e/t}),1),vl=qi("floor"),wl=Ri((function(e,t){return e*t}),1),Il=qi("round"),bl=Ri((function(e,t){return e-t}),0);return Mn.after=function(e,t){if("function"!=typeof t)throw new Se(r);return e=hs(e),function(){if(--e<1)return t.apply(this,arguments)}},Mn.ary=Ca,Mn.assign=ys,Mn.assignIn=ms,Mn.assignInWith=vs,Mn.assignWith=ws,Mn.at=Is,Mn.before=xa,Mn.bind=Sa,Mn.bindAll=Ws,Mn.bindKey=Qa,Mn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ka(e)?e:[e]},Mn.chain=Aa,Mn.chunk=function(e,t,r){t=(r?yo(e,t,r):t===n)?1:gn(hs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=ve(un(i/t));o<i;)s[a++]=ei(e,o,o+=t);return s},Mn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i},Mn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=ve(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Et(Ka(n)?xi(n):[n],pr(t,1))},Mn.cond=function(e){var t=null==e?0:e.length,n=oo();return e=t?Bt(e,(function(e){if("function"!=typeof e[1])throw new Se(r);return[n(e[0]),e[1]]})):[],zr((function(n){for(var r=-1;++r<t;){var i=e[r];if(pt(i[0],this,n))return pt(i[1],this,n)}}))},Mn.conforms=function(e){return function(e){var t=ks(e);return function(n){return sr(n,e,t)}}(ar(e,1))},Mn.constant=Zs,Mn.countBy=da,Mn.create=function(e,t){var n=Rn(e);return null==t?n:nr(n,t)},Mn.curry=function e(t,r,i){var o=Ji(t,8,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},Mn.curryRight=function e(t,r,i){var o=Ji(t,16,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},Mn.debounce=ka,Mn.defaults=bs,Mn.defaultsDeep=Bs,Mn.defer=_a,Mn.delay=Na,Mn.difference=Mo,Mn.differenceBy=Ro,Mn.differenceWith=Oo,Mn.drop=function(e,t,r){var i=null==e?0:e.length;return i?ei(e,(t=r||t===n?1:hs(t))<0?0:t,i):[]},Mn.dropRight=function(e,t,r){var i=null==e?0:e.length;return i?ei(e,0,(t=i-(t=r||t===n?1:hs(t)))<0?0:t):[]},Mn.dropRightWhile=function(e,t){return e&&e.length?Ai(e,oo(t,3),!0,!0):[]},Mn.dropWhile=function(e,t){return e&&e.length?Ai(e,oo(t,3),!0):[]},Mn.fill=function(e,t,r,i){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&yo(e,t,r)&&(r=0,i=o),function(e,t,r,i){var o=e.length;for((r=hs(r))<0&&(r=-r>o?0:o+r),(i=i===n||i>o?o:hs(i))<0&&(i+=o),i=r>i?0:ds(i);r<i;)e[r++]=t;return e}(e,t,r,i)):[]},Mn.filter=function(e,t){return(Ka(e)?wt:fr)(e,oo(t,3))},Mn.flatMap=function(e,t){return pr(Ia(e,t),1)},Mn.flatMapDeep=function(e,t){return pr(Ia(e,t),l)},Mn.flatMapDepth=function(e,t,r){return r=r===n?1:hs(r),pr(Ia(e,t),r)},Mn.flatten=jo,Mn.flattenDeep=function(e){return null!=e&&e.length?pr(e,l):[]},Mn.flattenDepth=function(e,t){return null!=e&&e.length?pr(e,t=t===n?1:hs(t)):[]},Mn.flip=function(e){return Ji(e,512)},Mn.flow=$s,Mn.flowRight=el,Mn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Mn.functions=function(e){return null==e?[]:wr(e,ks(e))},Mn.functionsIn=function(e){return null==e?[]:wr(e,_s(e))},Mn.groupBy=ma,Mn.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Mn.intersection=qo,Mn.intersectionBy=Vo,Mn.intersectionWith=zo,Mn.invert=xs,Mn.invertBy=Ss,Mn.invokeMap=va,Mn.iteratee=nl,Mn.keyBy=wa,Mn.keys=ks,Mn.keysIn=_s,Mn.map=Ia,Mn.mapKeys=function(e,t){var n={};return t=oo(t,3),mr(e,(function(e,r,i){rr(n,t(e,r,i),e)})),n},Mn.mapValues=function(e,t){var n={};return t=oo(t,3),mr(e,(function(e,r,i){rr(n,r,t(e,r,i))})),n},Mn.matches=function(e){return Lr(ar(e,1))},Mn.matchesProperty=function(e,t){return Mr(e,ar(t,1))},Mn.memoize=Da,Mn.merge=Ns,Mn.mergeWith=Ds,Mn.method=rl,Mn.methodOf=il,Mn.mixin=ol,Mn.negate=Fa,Mn.nthArg=function(e){return e=hs(e),zr((function(t){return Or(t,e)}))},Mn.omit=Fs,Mn.omitBy=function(e,t){return Ps(e,Fa(oo(t)))},Mn.once=function(e){return xa(2,e)},Mn.orderBy=function(e,t,r,i){return null==e?[]:(Ka(t)||(t=null==t?[]:[t]),Ka(r=i?n:r)||(r=null==r?[]:[r]),Hr(e,t,r))},Mn.over=sl,Mn.overArgs=Ua,Mn.overEvery=ll,Mn.overSome=ul,Mn.partial=Pa,Mn.partialRight=Ta,Mn.partition=ba,Mn.pick=Us,Mn.pickBy=Ps,Mn.property=Al,Mn.propertyOf=function(e){return function(t){return null==e?n:Ir(e,t)}},Mn.pull=Yo,Mn.pullAll=Xo,Mn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?jr(e,t,oo(n,2)):e},Mn.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?jr(e,t,n,r):e},Mn.pullAt=Wo,Mn.range=cl,Mn.rangeRight=hl,Mn.rearg=La,Mn.reject=function(e,t){return(Ka(e)?wt:fr)(e,Fa(oo(t,3)))},Mn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=oo(t,3);++r<o;){var a=e[r];t(a,r,e)&&(n.push(a),i.push(r))}return Gr(e,i),n},Mn.rest=function(e,t){if("function"!=typeof e)throw new Se(r);return zr(e,t=t===n?t:hs(t))},Mn.reverse=Zo,Mn.sampleSize=function(e,t,r){return t=(r?yo(e,t,r):t===n)?1:hs(t),(Ka(e)?Xn:Yr)(e,t)},Mn.set=function(e,t,n){return null==e?e:Xr(e,t,n)},Mn.setWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Xr(e,t,r,i)},Mn.shuffle=function(e){return(Ka(e)?Wn:$r)(e)},Mn.slice=function(e,t,r){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&yo(e,t,r)?(t=0,r=i):(t=null==t?0:hs(t),r=r===n?i:hs(r)),ei(e,t,r)):[]},Mn.sortBy=Ba,Mn.sortedUniq=function(e){return e&&e.length?ii(e):[]},Mn.sortedUniqBy=function(e,t){return e&&e.length?ii(e,oo(t,2)):[]},Mn.split=function(e,t,r){return r&&"number"!=typeof r&&yo(e,t,r)&&(t=r=n),(r=r===n?c:r>>>0)?(e=gs(e))&&("string"==typeof t||null!=t&&!rs(t))&&!(t=ai(t))&&Xt(e)?mi(nn(e),0,r):e.split(t,r):[]},Mn.spread=function(e,t){if("function"!=typeof e)throw new Se(r);return t=null==t?0:gn(hs(t),0),zr((function(n){var r=n[t],i=mi(n,0,t);return r&&Et(i,r),pt(e,this,i)}))},Mn.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Mn.take=function(e,t,r){return e&&e.length?ei(e,0,(t=r||t===n?1:hs(t))<0?0:t):[]},Mn.takeRight=function(e,t,r){var i=null==e?0:e.length;return i?ei(e,(t=i-(t=r||t===n?1:hs(t)))<0?0:t,i):[]},Mn.takeRightWhile=function(e,t){return e&&e.length?Ai(e,oo(t,3),!1,!0):[]},Mn.takeWhile=function(e,t){return e&&e.length?Ai(e,oo(t,3)):[]},Mn.tap=function(e,t){return t(e),e},Mn.throttle=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new Se(r);return Za(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),ka(e,t,{leading:i,maxWait:t,trailing:o})},Mn.thru=ca,Mn.toArray=As,Mn.toPairs=Ts,Mn.toPairsIn=Ls,Mn.toPath=function(e){return Ka(e)?Bt(e,Po):as(e)?[e]:xi(Uo(gs(e)))},Mn.toPlainObject=ps,Mn.transform=function(e,t,n){var r=Ka(e),i=r||Va(e)||ss(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Za(e)&&Ya(o)?Rn(Ze(e)):{}}return(i?yt:mr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Mn.unary=function(e){return Ca(e,1)},Mn.union=$o,Mn.unionBy=ea,Mn.unionWith=ta,Mn.uniq=function(e){return e&&e.length?si(e):[]},Mn.uniqBy=function(e,t){return e&&e.length?si(e,oo(t,2)):[]},Mn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?si(e,n,t):[]},Mn.unset=function(e,t){return null==e||li(e,t)},Mn.unzip=na,Mn.unzipWith=ra,Mn.update=function(e,t,n){return null==e?e:ui(e,t,pi(n))},Mn.updateWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:ui(e,t,pi(r),i)},Mn.values=Ms,Mn.valuesIn=function(e){return null==e?[]:Kt(e,_s(e))},Mn.without=ia,Mn.words=Ys,Mn.wrap=function(e,t){return Pa(pi(t),e)},Mn.xor=oa,Mn.xorBy=aa,Mn.xorWith=sa,Mn.zip=la,Mn.zipObject=function(e,t){return di(e||[],t||[],$n)},Mn.zipObjectDeep=function(e,t){return di(e||[],t||[],Xr)},Mn.zipWith=ua,Mn.entries=Ts,Mn.entriesIn=Ls,Mn.extend=ms,Mn.extendWith=vs,ol(Mn,Mn),Mn.add=gl,Mn.attempt=Xs,Mn.camelCase=Rs,Mn.capitalize=Os,Mn.ceil=yl,Mn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=fs(r))==r?r:0),t!==n&&(t=(t=fs(t))==t?t:0),or(fs(e),t,r)},Mn.clone=function(e){return ar(e,4)},Mn.cloneDeep=function(e){return ar(e,5)},Mn.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:n)},Mn.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:n)},Mn.conformsTo=function(e,t){return null==t||sr(e,t,ks(t))},Mn.deburr=Hs,Mn.defaultTo=function(e,t){return null==e||e!=e?t:e},Mn.divide=ml,Mn.endsWith=function(e,t,r){e=gs(e),t=ai(t);var i=e.length,o=r=r===n?i:or(hs(r),0,i);return(r-=t.length)>=0&&e.slice(r,o)==t},Mn.eq=Ma,Mn.escape=function(e){return(e=gs(e))&&V.test(e)?e.replace(G,Jt):e},Mn.escapeRegExp=function(e){return(e=gs(e))&&ee.test(e)?e.replace($,"\\$&"):e},Mn.every=function(e,t,r){var i=Ka(e)?vt:hr;return r&&yo(e,t,r)&&(t=n),i(e,oo(t,3))},Mn.find=fa,Mn.findIndex=Ho,Mn.findKey=function(e,t){return kt(e,oo(t,3),mr)},Mn.findLast=pa,Mn.findLastIndex=Ko,Mn.findLastKey=function(e,t){return kt(e,oo(t,3),vr)},Mn.floor=vl,Mn.forEach=ga,Mn.forEachRight=ya,Mn.forIn=function(e,t){return null==e?e:gr(e,oo(t,3),_s)},Mn.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),_s)},Mn.forOwn=function(e,t){return e&&mr(e,oo(t,3))},Mn.forOwnRight=function(e,t){return e&&vr(e,oo(t,3))},Mn.get=Es,Mn.gt=Ra,Mn.gte=Oa,Mn.has=function(e,t){return null!=e&&ho(e,t,Cr)},Mn.hasIn=Cs,Mn.head=Go,Mn.identity=tl,Mn.includes=function(e,t,n,r){e=Ga(e)?e:Ms(e),n=n&&!r?hs(n):0;var i=e.length;return n<0&&(n=gn(i+n,0)),os(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Nt(e,t,n)>-1},Mn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=gn(r+i,0)),Nt(e,t,i)},Mn.inRange=function(e,t,r){return t=cs(t),r===n?(r=t,t=0):r=cs(r),function(e,t,n){return e>=yn(t,n)&&e<gn(t,n)}(e=fs(e),t,r)},Mn.invoke=Qs,Mn.isArguments=Ha,Mn.isArray=Ka,Mn.isArrayBuffer=ja,Mn.isArrayLike=Ga,Mn.isArrayLikeObject=qa,Mn.isBoolean=function(e){return!0===e||!1===e||$a(e)&&Br(e)==p},Mn.isBuffer=Va,Mn.isDate=za,Mn.isElement=function(e){return $a(e)&&1===e.nodeType&&!ns(e)},Mn.isEmpty=function(e){if(null==e)return!0;if(Ga(e)&&(Ka(e)||"string"==typeof e||"function"==typeof e.splice||Va(e)||ss(e)||Ha(e)))return!e.length;var t=co(e);if(t==w||t==C)return!e.size;if(Io(e))return!Ur(e).length;for(var n in e)if(Fe.call(e,n))return!1;return!0},Mn.isEqual=function(e,t){return _r(e,t)},Mn.isEqualWith=function(e,t,r){var i=(r="function"==typeof r?r:n)?r(e,t):n;return i===n?_r(e,t,n,r):!!i},Mn.isError=Ja,Mn.isFinite=function(e){return"number"==typeof e&&dn(e)},Mn.isFunction=Ya,Mn.isInteger=Xa,Mn.isLength=Wa,Mn.isMap=es,Mn.isMatch=function(e,t){return e===t||Nr(e,t,so(t))},Mn.isMatchWith=function(e,t,r){return r="function"==typeof r?r:n,Nr(e,t,so(t),r)},Mn.isNaN=function(e){return ts(e)&&e!=+e},Mn.isNative=function(e){if(wo(e))throw new Ie("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Dr(e)},Mn.isNil=function(e){return null==e},Mn.isNull=function(e){return null===e},Mn.isNumber=ts,Mn.isObject=Za,Mn.isObjectLike=$a,Mn.isPlainObject=ns,Mn.isRegExp=rs,Mn.isSafeInteger=function(e){return Xa(e)&&e>=-9007199254740991&&e<=u},Mn.isSet=is,Mn.isString=os,Mn.isSymbol=as,Mn.isTypedArray=ss,Mn.isUndefined=function(e){return e===n},Mn.isWeakMap=function(e){return $a(e)&&co(e)==Q},Mn.isWeakSet=function(e){return $a(e)&&"[object WeakSet]"==Br(e)},Mn.join=function(e,t){return null==e?"":fn.call(e,t)},Mn.kebabCase=Ks,Mn.last=Jo,Mn.lastIndexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i;return r!==n&&(o=(o=hs(r))<0?gn(i+o,0):yn(o,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):_t(e,Ft,o,!0)},Mn.lowerCase=js,Mn.lowerFirst=Gs,Mn.lt=ls,Mn.lte=us,Mn.max=function(e){return e&&e.length?dr(e,tl,Er):n},Mn.maxBy=function(e,t){return e&&e.length?dr(e,oo(t,2),Er):n},Mn.mean=function(e){return Ut(e,tl)},Mn.meanBy=function(e,t){return Ut(e,oo(t,2))},Mn.min=function(e){return e&&e.length?dr(e,tl,Pr):n},Mn.minBy=function(e,t){return e&&e.length?dr(e,oo(t,2),Pr):n},Mn.stubArray=dl,Mn.stubFalse=fl,Mn.stubObject=function(){return{}},Mn.stubString=function(){return""},Mn.stubTrue=function(){return!0},Mn.multiply=wl,Mn.nth=function(e,t){return e&&e.length?Or(e,hs(t)):n},Mn.noConflict=function(){return rt._===this&&(rt._=Me),this},Mn.noop=al,Mn.now=Ea,Mn.pad=function(e,t,n){e=gs(e);var r=(t=hs(t))?tn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Hi(An(i),n)+e+Hi(un(i),n)},Mn.padEnd=function(e,t,n){e=gs(e);var r=(t=hs(t))?tn(e):0;return t&&r<t?e+Hi(t-r,n):e},Mn.padStart=function(e,t,n){e=gs(e);var r=(t=hs(t))?tn(e):0;return t&&r<t?Hi(t-r,n)+e:e},Mn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),vn(gs(e).replace(te,""),t||0)},Mn.random=function(e,t,r){if(r&&"boolean"!=typeof r&&yo(e,t,r)&&(t=r=n),r===n&&("boolean"==typeof t?(r=t,t=n):"boolean"==typeof e&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=cs(e),t===n?(t=e,e=0):t=cs(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var o=wn();return yn(e+o*(t-e+$e("1e-"+((o+"").length-1))),t)}return qr(e,t)},Mn.reduce=function(e,t,n){var r=Ka(e)?Ct:Lt,i=arguments.length<3;return r(e,oo(t,4),n,i,Ar)},Mn.reduceRight=function(e,t,n){var r=Ka(e)?xt:Lt,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Mn.repeat=function(e,t,r){return t=(r?yo(e,t,r):t===n)?1:hs(t),Vr(gs(e),t)},Mn.replace=function(){var e=arguments,t=gs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Mn.result=function(e,t,r){var i=-1,o=(t=gi(t,e)).length;for(o||(o=1,e=n);++i<o;){var a=null==e?n:e[Po(t[i])];a===n&&(i=o,a=r),e=Ya(a)?a.call(e):a}return e},Mn.round=Il,Mn.runInContext=e,Mn.sample=function(e){return(Ka(e)?Yn:Jr)(e)},Mn.size=function(e){if(null==e)return 0;if(Ga(e))return os(e)?tn(e):e.length;var t=co(e);return t==w||t==C?e.size:Ur(e).length},Mn.snakeCase=qs,Mn.some=function(e,t,r){var i=Ka(e)?St:ti;return r&&yo(e,t,r)&&(t=n),i(e,oo(t,3))},Mn.sortedIndex=function(e,t){return ni(e,t)},Mn.sortedIndexBy=function(e,t,n){return ri(e,t,oo(n,2))},Mn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ni(e,t);if(r<n&&Ma(e[r],t))return r}return-1},Mn.sortedLastIndex=function(e,t){return ni(e,t,!0)},Mn.sortedLastIndexBy=function(e,t,n){return ri(e,t,oo(n,2),!0)},Mn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ni(e,t,!0)-1;if(Ma(e[n],t))return n}return-1},Mn.startCase=Vs,Mn.startsWith=function(e,t,n){return e=gs(e),n=null==n?0:or(hs(n),0,e.length),t=ai(t),e.slice(n,n+t.length)==t},Mn.subtract=bl,Mn.sum=function(e){return e&&e.length?Mt(e,tl):0},Mn.sumBy=function(e,t){return e&&e.length?Mt(e,oo(t,2)):0},Mn.template=function(e,t,r){var i=Mn.templateSettings;r&&yo(e,t,r)&&(t=n),e=gs(e),t=vs({},t,i,Yi);var o,a,s=vs({},t.imports,i.imports,Yi),l=ks(s),u=Kt(s,l),A=0,c=t.interpolate||ye,h="__p += '",d=Ce((t.escape||ye).source+"|"+c.source+"|"+(c===Y?ue:ye).source+"|"+(t.evaluate||ye).source+"|$","g"),f="//# sourceURL="+(Fe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ye+"]")+"\n";e.replace(d,(function(t,n,r,i,s,l){return r||(r=i),h+=e.slice(A,l).replace(me,Yt),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),A=l+t.length,t})),h+="';\n";var p=Fe.call(t,"variable")&&t.variable;if(p){if(se.test(p))throw new Ie("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(a?h.replace(O,""):h).replace(H,"$1").replace(K,"$1;"),h="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=Xs((function(){return be(l,f+"return "+h).apply(n,u)}));if(g.source=h,Ja(g))throw g;return g},Mn.times=function(e,t){if((e=hs(e))<1||e>u)return[];var n=c,r=yn(e,c);t=oo(t),e-=c;for(var i=Rt(r,t);++n<e;)t(n);return i},Mn.toFinite=cs,Mn.toInteger=hs,Mn.toLength=ds,Mn.toLower=function(e){return gs(e).toLowerCase()},Mn.toNumber=fs,Mn.toSafeInteger=function(e){return e?or(hs(e),-9007199254740991,u):0===e?e:0},Mn.toString=gs,Mn.toUpper=function(e){return gs(e).toUpperCase()},Mn.trim=function(e,t,r){if((e=gs(e))&&(r||t===n))return Ot(e);if(!e||!(t=ai(t)))return e;var i=nn(e),o=nn(t);return mi(i,Gt(i,o),qt(i,o)+1).join("")},Mn.trimEnd=function(e,t,r){if((e=gs(e))&&(r||t===n))return e.slice(0,rn(e)+1);if(!e||!(t=ai(t)))return e;var i=nn(e);return mi(i,0,qt(i,nn(t))+1).join("")},Mn.trimStart=function(e,t,r){if((e=gs(e))&&(r||t===n))return e.replace(te,"");if(!e||!(t=ai(t)))return e;var i=nn(e);return mi(i,Gt(i,nn(t))).join("")},Mn.truncate=function(e,t){var r=30,i="...";if(Za(t)){var o="separator"in t?t.separator:o;r="length"in t?hs(t.length):r,i="omission"in t?ai(t.omission):i}var a=(e=gs(e)).length;if(Xt(e)){var s=nn(e);a=s.length}if(r>=a)return e;var l=r-tn(i);if(l<1)return i;var u=s?mi(s,0,l).join(""):e.slice(0,l);if(o===n)return u+i;if(s&&(l+=u.length-l),rs(o)){if(e.slice(l).search(o)){var A,c=u;for(o.global||(o=Ce(o.source,gs(Ae.exec(o))+"g")),o.lastIndex=0;A=o.exec(c);)var h=A.index;u=u.slice(0,h===n?l:h)}}else if(e.indexOf(ai(o),l)!=l){var d=u.lastIndexOf(o);d>-1&&(u=u.slice(0,d))}return u+i},Mn.unescape=function(e){return(e=gs(e))&&q.test(e)?e.replace(j,on):e},Mn.uniqueId=function(e){var t=++Ue;return gs(e)+t},Mn.upperCase=zs,Mn.upperFirst=Js,Mn.each=ga,Mn.eachRight=ya,Mn.first=Go,ol(Mn,(pl={},mr(Mn,(function(e,t){Fe.call(Mn.prototype,t)||(pl[t]=e)})),pl),{chain:!1}),Mn.VERSION="4.17.21",yt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Mn[e].placeholder=Mn})),yt(["drop","take"],(function(e,t){Kn.prototype[e]=function(r){r=r===n?1:gn(hs(r),0);var i=this.__filtered__&&!t?new Kn(this):this.clone();return i.__filtered__?i.__takeCount__=yn(r,i.__takeCount__):i.__views__.push({size:yn(r,c),type:e+(i.__dir__<0?"Right":"")}),i},Kn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),yt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Kn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),yt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Kn.prototype[e]=function(){return this[n](1).value()[0]}})),yt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Kn.prototype[e]=function(){return this.__filtered__?new Kn(this):this[n](1)}})),Kn.prototype.compact=function(){return this.filter(tl)},Kn.prototype.find=function(e){return this.filter(e).head()},Kn.prototype.findLast=function(e){return this.reverse().find(e)},Kn.prototype.invokeMap=zr((function(e,t){return"function"==typeof e?new Kn(this):this.map((function(n){return Qr(n,e,t)}))})),Kn.prototype.reject=function(e){return this.filter(Fa(oo(e)))},Kn.prototype.slice=function(e,t){e=hs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Kn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=hs(t))<0?r.dropRight(-t):r.take(t-e)),r)},Kn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Kn.prototype.toArray=function(){return this.take(c)},mr(Kn.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Mn[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Mn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,l=t instanceof Kn,u=s[0],A=l||Ka(t),c=function(e){var t=o.apply(Mn,Et([e],s));return i&&h?t[0]:t};A&&r&&"function"==typeof u&&1!=u.length&&(l=A=!1);var h=this.__chain__,d=!!this.__actions__.length,f=a&&!h,p=l&&!d;if(!a&&A){t=p?t:new Kn(this);var g=e.apply(t,s);return g.__actions__.push({func:ca,args:[c],thisArg:n}),new Hn(g,h)}return f&&p?e.apply(this,s):(g=this.thru(c),f?i?g.value()[0]:g.value():g)})})),yt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Qe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Mn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ka(i)?i:[],e)}return this[n]((function(n){return t.apply(Ka(n)?n:[],e)}))}})),mr(Kn.prototype,(function(e,t){var n=Mn[t];if(n){var r=n.name+"";Fe.call(kn,r)||(kn[r]=[]),kn[r].push({name:t,func:n})}})),kn[Li(n,2).name]=[{name:"wrapper",func:n}],Kn.prototype.clone=function(){var e=new Kn(this.__wrapped__);return e.__actions__=xi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=xi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=xi(this.__views__),e},Kn.prototype.reverse=function(){if(this.__filtered__){var e=new Kn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Kn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ka(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=yn(t,e+a);break;case"takeRight":e=gn(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,l=s-a,u=r?s:a-1,A=this.__iteratees__,c=A.length,h=0,d=yn(l,this.__takeCount__);if(!n||!r&&i==l&&d==l)return ci(e,this.__actions__);var f=[];e:for(;l--&&h<d;){for(var p=-1,g=e[u+=t];++p<c;){var y=A[p],m=y.iteratee,v=y.type,w=m(g);if(2==v)g=w;else if(!w){if(1==v)continue e;break e}}f[h++]=g}return f},Mn.prototype.at=ha,Mn.prototype.chain=function(){return Aa(this)},Mn.prototype.commit=function(){return new Hn(this.value(),this.__chain__)},Mn.prototype.next=function(){this.__values__===n&&(this.__values__=As(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},Mn.prototype.plant=function(e){for(var t,r=this;r instanceof On;){var i=Lo(r);i.__index__=0,i.__values__=n,t?o.__wrapped__=i:t=i;var o=i;r=r.__wrapped__}return o.__wrapped__=e,t},Mn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Kn){var t=e;return this.__actions__.length&&(t=new Kn(this)),(t=t.reverse()).__actions__.push({func:ca,args:[Zo],thisArg:n}),new Hn(t,this.__chain__)}return this.thru(Zo)},Mn.prototype.toJSON=Mn.prototype.valueOf=Mn.prototype.value=function(){return ci(this.__wrapped__,this.__actions__)},Mn.prototype.first=Mn.prototype.head,st&&(Mn.prototype[st]=function(){return this}),Mn}();ot?((ot.exports=an)._=an,it._=an):rt._=an}).call(Ki)}(cG,cG.exports);const{validate:hG}=iK;const dG=oK,fG=aK,pG=tG.exports,gG=cG.exports;var yG=class{constructor(e){if(!pG.isEncoded(e))throw new Error("Base58 string is invalid. Cannot construct Decoder.");this.base58=e}constructRootJSON(e){const t=gG.invert(dG.root);return e.reduce(((e,n)=>{const r=t[n[0]];let i=n[1];return i instanceof Array&&("anchors"===r&&(i=this.constructAnchorsJSON(i)),"path"===r&&(i=this.constructPathJSON(i))),i instanceof ao&&(i=fG.decode(i).toString("hex")),e[r]=i,e}),{})}constructAnchorsJSON(e){const t=gG.invertBy(dG.chain,(e=>e.id));return e.map((e=>e.reduce(((e,n)=>{if(0===n[0])return`${e}:${t[n[1]]}`;if(1===n[0]){const t=e.split(":").pop();return`${e}:${gG.invert(dG.chain[t].networks)[n[1]]}`}return`${e}:${fG.decode(n[1]).toString("hex")}`}),"blink")))}constructPathJSON(e){const t=gG.invert(dG.path);return e.map((e=>({[t[e[0]]]:fG.decode(e[1]).toString("hex")})))}decode(){const e=pG.decode(this.base58),t=fG.decode(e);return this.constructRootJSON(t)}};function mG(e){const t=Object.keys(jl).map((e=>jl[e])).find((t=>t.signatureValue===e));return t}function vG(e,t){const n=e.findIndex((e=>e===t));n>-1&&e.splice(n,1)}var wG={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",creator:{"@id":"dc:creator","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"sec:expiration","@type":"xsd:dateTime"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:"bc:verification",publicKeys:"bc:publicKeys",ChainpointSHA256v2:"cp:ChainpointSHA256v2",BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/merkleProof2017Schema.json"}]},IG={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"bc:created","@type":"xsd:dateTime"},name:{"@id":"schema:name"}}},bG={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType","@type":"@id"},contentEncoding:{"@id":"bc:contentEncoding","@type":"@id"},content:{"@id":"bc:content","@type":"@id"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey","@type":"@id"},url:{"@id":"schema:url","@type":"@id"},image:{"@id":"schema:image","@type":"@id"}}};function BG(e){e=e.trim();const t=[];for(let n=0;n<e.length;n+=2)t.push(parseInt(e.substring(n,n+2),16));return t}jh["https://w3id.org/blockcerts/schema/2.0-alpha/context.json"]=wG,jh["https://www.blockcerts.org/schema/2.0-alpha/context.json"]=wG,jh["https://www.blockcerts.org/schema/3.0-alpha/context.json"]=IG,jh["https://w3id.org/blockcerts/schema/3.0-alpha/context.json"]=IG,jh["https://w3id.org/blockcerts/v3.0-alpha"]=IG,jh["https://www.blockcerts.org/schema/3.0-beta/context.json"]=bG,jh["https://w3id.org/blockcerts/schema/3.0-beta/context.json"]=bG,jh["https://w3id.org/blockcerts/v3.0-beta"]=bG,jh["https://w3id.org/security/suites/ed25519-2020/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},Ed25519VerificationKey2020:{"@id":"https://w3id.org/security#Ed25519VerificationKey2020","@context":{"@protected":!0,id:"@id",type:"@type",controller:{"@id":"https://w3id.org/security#controller","@type":"@id"},revoked:{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},Ed25519Signature2020:{"@id":"https://w3id.org/security#Ed25519Signature2020","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};class EG extends Error{constructor(e,t){super(t),this.stepCode=e}}var CG="en-US",xG={"en-US":{errors:{ensureHashesEqual:"Computed hash does not match remote hash",ensureMerkleRootEqual:"Merkle root does not match remote hash.",ensureValidReceipt:"The receipt is malformed. There was a problem navigating the merkle tree in the receipt.",failedJsonLdNormalization:"Failed JSON-LD normalization",foundUnmappedFields:"Found unmapped fields during JSON-LD normalization",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Cannot verify this certificate without a transaction ID to compare against.",invalidMerkleReceipt:"Invalid Merkle Receipt. Proof hash did not match Merkle root",isTransactionIdValid:"Cannot verify this certificate without a transaction ID to compare against.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},fr:{errors:{ensureHashesEqual:"Calcul du hash local différent du hash distant",ensureMerkleRootEqual:"Le Merkle root ne correspond pas au hash distant",ensureValidReceipt:"Erreur d'écriture du reçu. Un problème est survenu lors de la navigation de l'arbre Merkle du reçu.",failedJsonLdNormalization:"Erreur de normalisation JSON-LD",foundUnmappedFields:"Champs non liés découverts durant la normalisation JSON-LD",identityErrorBaseMessage:"Identité de l'émetteur invalide",deriveIssuingAddressFromPublicKey:"Cette blockchain n'est pas supportée pour la vérification de l'identité décentralisée.",compareIssuingAddress:"La méthode de vérification n'a pas permis d'établir l'identité de l'émetteur.",getTransactionId:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",invalidMerkleReceipt:"Reçu Merkle invalide. Hash de preuve différent du Merkle root",isTransactionIdValid:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",noProofSpecified:"La propriété 'proof' du document est un tableau mais aucune preuve n'a été passée pour savoir ce qu'il faut vérifier"}},es:{errors:{ensureHashesEqual:"La cadena binaria calculada no corresponde con la cadena binaria remota",ensureMerkleRootEqual:"La raíz Merkle no corresponde con la cadena binaria remota",ensureValidReceipt:"El recibo está malformado. Hubo un problema navegando el árbol Merkle en el recibo",failedJsonLdNormalization:"La normalización del JSON-LD ha fallado",foundUnmappedFields:"Se han encontrado campos no mapeados durante la normalización de JSON-LD",identityErrorBaseMessage:"Identitad del emisor inválida",deriveIssuingAddressFromPublicKey:"No se puede validar la identitad decentalisada con esta cadena binaria.",compareIssuingAddress:"El metodo de verificación no corresponde a la identitad del emisor.",getTransactionId:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",invalidMerkleReceipt:"Recibo Merkle inválido. La cadena binaria de prueba no corresponde con la raíz Merkle",isTransactionIdValid:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",noProofSpecified:"La propiedad 'proof' del documento es una lista, pero no prueba especifica ha sido declarada para conocer el punto de verificación"}},mt:{errors:{ensureHashesEqual:"Il-hash ikkalkulat ma jikkorrispondix mar-remote hash",ensureMerkleRootEqual:"Merkle root ma taqbilx mar-remote hash",ensureValidReceipt:"L-irċevuta hija malformata. Kien hemm problema fin-navigazzjoni tal-merkle tree fl-irċevuta",failedJsonLdNormalization:"In-normalizzazzjoni ta' JSON-LD ma rnexxietx",foundUnmappedFields:"Instabu unmapped fields matul in-normalizzazzjoni JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",invalidMerkleReceipt:"Irċevuta Merkle invalida. Il-proof hash ma kienx jaqbel mal-Merkle root",isTransactionIdValid:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},"it-IT":{errors:{ensureHashesEqual:"L'hash calcolato non corrisponde all'hash remoto",ensureMerkleRootEqual:"La radice di Merkle non corrisponde all'hash remoto.",ensureValidReceipt:"La ricevuta è malformata. C'è stato un problema nella navigazione dell'albero di Merkle nella ricevuta.",failedJsonLdNormalization:"Normalizzazione JSON-LD fallita",foundUnmappedFields:"Campi non mappati trovati durante la normalizzazione JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",invalidMerkleReceipt:"Ricevuta Merkle non valida. L'hash di prova non corrisponde alla radice di Merkle",isTransactionIdValid:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},ja:{errors:{ensureHashesEqual:"算出されたハッシュがリモートハッシュと一致しませんでした",ensureMerkleRootEqual:"Merkle rootがリモートハッシュと一致しませんでした",ensureValidReceipt:"レシートが異常です。レシート内のMerkle treeを辿る際に問題が発生しました。",failedJsonLdNormalization:"JSON-LDの正規化に失敗しました",foundUnmappedFields:"JSON-LDの正規化時にマップされていないフィールドを検出しました",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"照合のための取引IDがないため、この証明書を認証できません。",invalidMerkleReceipt:"Merkleレシートが無効です。証明ハッシュがMerkle rootと一致しませんでした。",isTransactionIdValid:"照合するための取引IDがないため、この証明書を認証できません。",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}}};function SG(e,t){return e&&t?xG[CG]?xG[CG][e]?xG[CG][e][t]?xG[CG][e][t]||"":"[missing locale item data]":"[missing locale group data]":"[missing locale data]":""}var QG=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const kG=ao;var _G={},NG={},DG={};Object.defineProperty(DG,"__esModule",{value:!0}),DG.testnet=DG.regtest=DG.bitcoin=void 0,DG.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},DG.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},DG.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var FG={},UG={},PG={},TG={};Object.defineProperty(TG,"__esModule",{value:!0}),TG.encode=TG.decode=TG.check=void 0,TG.check=function(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;const t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;const n=e[5+t];return!(0===n||6+t+n!==e.length||128&e[4]||t>1&&0===e[4]&&!(128&e[5])||128&e[t+6]||n>1&&0===e[t+6]&&!(128&e[t+7]))},TG.decode=function(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");const t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");const n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}},TG.encode=function(e,t){const n=e.length,r=t.length;if(0===n)throw new Error("R length is zero");if(0===r)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(r>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");const i=ao.allocUnsafe(6+n+r);return i[0]=48,i[1]=i.length-2,i[2]=2,i[3]=e.length,e.copy(i,4),i[4+n]=2,i[5+n]=t.length,t.copy(i,6+n),i};var LG={};Object.defineProperty(LG,"__esModule",{value:!0}),LG.REVERSE_OPS=LG.OPS=void 0;const MG={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};LG.OPS=MG;const RG={};LG.REVERSE_OPS=RG;for(const e of Object.keys(MG))RG[MG[e]]=e;var OG={};Object.defineProperty(OG,"__esModule",{value:!0}),OG.decode=OG.encode=OG.encodingLength=void 0;const HG=LG;function KG(e){return e<HG.OPS.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}OG.encodingLength=KG,OG.encode=function(e,t,n){const r=KG(t);return 1===r?e.writeUInt8(t,n):2===r?(e.writeUInt8(HG.OPS.OP_PUSHDATA1,n),e.writeUInt8(t,n+1)):3===r?(e.writeUInt8(HG.OPS.OP_PUSHDATA2,n),e.writeUInt16LE(t,n+1)):(e.writeUInt8(HG.OPS.OP_PUSHDATA4,n),e.writeUInt32LE(t,n+1)),r},OG.decode=function(e,t){const n=e.readUInt8(t);let r,i;if(n<HG.OPS.OP_PUSHDATA1)r=n,i=1;else if(n===HG.OPS.OP_PUSHDATA1){if(t+2>e.length)return null;r=e.readUInt8(t+1),i=2}else if(n===HG.OPS.OP_PUSHDATA2){if(t+3>e.length)return null;r=e.readUInt16LE(t+1),i=3}else{if(t+5>e.length)return null;if(n!==HG.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");r=e.readUInt32LE(t+1),i=5}return{opcode:n,number:r,size:i}};var jG={};Object.defineProperty(jG,"__esModule",{value:!0}),jG.encode=jG.decode=void 0,jG.decode=function(e,t,n){t=t||4,n=void 0===n||n;const r=e.length;if(0===r)return 0;if(r>t)throw new TypeError("Script number overflow");if(n&&0==(127&e[r-1])&&(r<=1||0==(128&e[r-2])))throw new Error("Non-minimally encoded script number");if(5===r){const t=e.readUInt32LE(0),n=e.readUInt8(4);return 128&n?-(4294967296*(-129&n)+t):4294967296*n+t}let i=0;for(let t=0;t<r;++t)i|=e[t]<<8*t;return 128&e[r-1]?-(i&~(128<<8*(r-1))):i},jG.encode=function(e){let t=Math.abs(e);const n=(r=t)>2147483647?5:r>8388607?4:r>32767?3:r>127?2:r>0?1:0;var r;const i=ao.allocUnsafe(n),o=e<0;for(let e=0;e<n;++e)i.writeUInt8(255&t,e),t>>=8;return 128&i[n-1]?i.writeUInt8(o?128:0,n-1):o&&(i[n-1]|=128),i};var GG={},qG={},VG={Array:function(e){return null!=e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return null==e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var zG in VG.Null=VG.Nil,VG)VG[zG].toJSON=function(e){return e}.bind(null,zG);var JG=VG,YG=JG;function XG(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function WG(e){return YG.Nil(e)?"":XG(e.constructor)}function ZG(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function $G(e){return YG.Function(e)?e.toJSON?e.toJSON():XG(e):YG.Array(e)?"Array":e&&YG.Object(e)?"Object":void 0!==e?e:""}function eq(e,t,n){var r=function(e){return YG.Function(e)?"":YG.String(e)?JSON.stringify(e):e&&YG.Object(e)?"":e}(t);return"Expected "+$G(e)+", got"+(""!==n?" "+n:"")+(""!==r?" "+r:"")}function tq(e,t,n){n=n||WG(t),this.message=eq(e,t,n),ZG(this,tq),this.__type=e,this.__value=t,this.__valueTypeName=n}function nq(e,t,n,r,i){e?(i=i||WG(r),this.message=function(e,t,n,r,i){var o='" of type ';return"key"===t&&(o='" with key type '),eq('property "'+$G(n)+o+$G(e),r,i)}(e,n,t,r,i)):this.message='Unexpected property "'+t+'"',ZG(this,tq),this.__label=n,this.__property=t,this.__type=e,this.__value=r,this.__valueTypeName=i}tq.prototype=Object.create(Error.prototype),tq.prototype.constructor=tq,nq.prototype=Object.create(Error.prototype),nq.prototype.constructor=tq;var rq={TfTypeError:tq,TfPropertyTypeError:nq,tfCustomError:function(e,t){return new tq(e,{},t)},tfSubError:function(e,t,n){return e instanceof nq?(t=t+"."+e.__property,e=new nq(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof tq&&(e=new nq(e.__type,t,n,e.__value,e.__valueTypeName)),ZG(e),e},tfJSON:$G,getValueTypeName:WG},iq=JG,oq=rq;function aq(e){return jo(e)}function sq(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function lq(e,t){var n=e.toJSON();function r(r){if(!e(r))return!1;if(r.length===t)return!0;throw oq.tfCustomError(n+"(Length: "+t+")",n+"(Length: "+r.length+")")}return r.toJSON=function(){return n},r}var uq=lq.bind(null,iq.Array),Aq=lq.bind(null,aq),cq=lq.bind(null,sq),hq=lq.bind(null,iq.String),dq=Math.pow(2,53)-1,fq={ArrayN:uq,Buffer:aq,BufferN:Aq,Finite:function(e){return"number"==typeof e&&isFinite(e)},Hex:sq,HexN:cq,Int8:function(e){return e<<24>>24===e},Int16:function(e){return e<<16>>16===e},Int32:function(e){return(0|e)===e},Int53:function(e){return"number"==typeof e&&e>=-dq&&e<=dq&&Math.floor(e)===e},Range:function(e,t,n){function r(r,i){return n(r,i)&&r>e&&r<t}return n=n||iq.Number,r.toJSON=function(){return`${n.toJSON()} between [${e}, ${t}]`},r},StringN:hq,UInt8:function(e){return(255&e)===e},UInt16:function(e){return(65535&e)===e},UInt32:function(e){return e>>>0===e},UInt53:function(e){return"number"==typeof e&&e>=0&&e<=dq&&Math.floor(e)===e}};for(var pq in fq)fq[pq].toJSON=function(e){return e}.bind(null,pq);var gq=fq,yq=JG,mq=rq.tfJSON,vq=rq.TfTypeError,wq=rq.TfPropertyTypeError,Iq=rq.tfSubError,bq=rq.getValueTypeName,Bq={arrayOf:function(e,t){function n(n,r){return!!yq.Array(n)&&!yq.Nil(n)&&!(void 0!==t.minLength&&n.length<t.minLength)&&!(void 0!==t.maxLength&&n.length>t.maxLength)&&(void 0===t.length||n.length===t.length)&&n.every((function(t,n){try{return Cq(e,t,r)}catch(e){throw Iq(e,n)}}))}return e=Eq(e),t=t||{},n.toJSON=function(){var n="["+mq(e)+"]";return void 0!==t.length?n+="{"+t.length+"}":void 0===t.minLength&&void 0===t.maxLength||(n+="{"+(void 0===t.minLength?0:t.minLength)+","+(void 0===t.maxLength?1/0:t.maxLength)+"}"),n},n},maybe:function e(t){function n(n,r){return yq.Nil(n)||t(n,r,e)}return t=Eq(t),n.toJSON=function(){return"?"+mq(t)},n},map:function(e,t){function n(n,r){if(!yq.Object(n))return!1;if(yq.Nil(n))return!1;for(var i in n){try{t&&Cq(t,i,r)}catch(e){throw Iq(e,i,"key")}try{var o=n[i];Cq(e,o,r)}catch(e){throw Iq(e,i)}}return!0}return e=Eq(e),t&&(t=Eq(t)),n.toJSON=t?function(){return"{"+mq(t)+": "+mq(e)+"}"}:function(){return"{"+mq(e)+"}"},n},object:function(e){var t={};for(var n in e)t[n]=Eq(e[n]);function r(e,n){if(!yq.Object(e))return!1;if(yq.Nil(e))return!1;var r;try{for(r in t)Cq(t[r],e[r],n)}catch(e){throw Iq(e,r)}if(n)for(r in e)if(!t[r])throw new wq(void 0,r);return!0}return r.toJSON=function(){return mq(t)},r},anyOf:function(){var e=[].slice.call(arguments).map(Eq);function t(t,n){return e.some((function(e){try{return Cq(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(mq).join("|")},t},allOf:function(){var e=[].slice.call(arguments).map(Eq);function t(t,n){return e.every((function(e){try{return Cq(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(mq).join(" & ")},t},quacksLike:function(e){function t(t){return e===bq(t)}return t.toJSON=function(){return e},t},tuple:function(){var e=[].slice.call(arguments).map(Eq);function t(t,n){return!yq.Nil(t)&&!yq.Nil(t.length)&&(!n||t.length===e.length)&&e.every((function(e,r){try{return Cq(e,t[r],n)}catch(e){throw Iq(e,r)}}))}return t.toJSON=function(){return"("+e.map(mq).join(", ")+")"},t},value:function(e){function t(t){return t===e}return t.toJSON=function(){return e},t}};function Eq(e){if(yq.String(e))return"?"===e[0]?Bq.maybe(e.slice(1)):yq[e]||Bq.quacksLike(e);if(e&&yq.Object(e)){if(yq.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return Bq.arrayOf(e[0])}return Bq.object(e)}return yq.Function(e)?e:Bq.value(e)}function Cq(e,t,n,r){if(yq.Function(e)){if(e(t,n))return!0;throw new vq(r||e,t)}return Cq(Eq(e),t,n)}for(var xq in Bq.oneOf=Bq.anyOf,yq)Cq[xq]=yq[xq];for(xq in Bq)Cq[xq]=Bq[xq];var Sq=gq;for(xq in Sq)Cq[xq]=Sq[xq];Cq.compile=Eq,Cq.TfTypeError=vq,Cq.TfPropertyTypeError=wq;var Qq=Cq;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.oneOf=e.Null=e.BufferN=e.Function=e.UInt32=e.UInt8=e.tuple=e.maybe=e.Hex=e.Buffer=e.String=e.Boolean=e.Array=e.Number=e.Hash256bit=e.Hash160bit=e.Buffer256bit=e.Network=e.ECPoint=e.Satoshi=e.Signer=e.BIP32Path=e.UInt31=e.isPoint=e.typeforce=void 0;const t=qo;e.typeforce=Qq;const n=t.Buffer.alloc(32,0),r=t.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");e.isPoint=function(e){if(!t.Buffer.isBuffer(e))return!1;if(e.length<33)return!1;const i=e[0],o=e.slice(1,33);if(0===o.compare(n))return!1;if(o.compare(r)>=0)return!1;if((2===i||3===i)&&33===e.length)return!0;const a=e.slice(33);return 0!==a.compare(n)&&!(a.compare(r)>=0)&&4===i&&65===e.length};const i=Math.pow(2,31)-1;function o(t){return e.typeforce.String(t)&&!!t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.UInt31=function(t){return e.typeforce.UInt32(t)&&t<=i},e.BIP32Path=o,o.toJSON=()=>"BIP32 derivation path",e.Signer=function(t){return(e.typeforce.Buffer(t.publicKey)||"function"==typeof t.getPublicKey)&&"function"==typeof t.sign},e.Satoshi=function(t){return e.typeforce.UInt53(t)&&t<=21e14},e.ECPoint=e.typeforce.quacksLike("Point"),e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.Buffer256bit=e.typeforce.BufferN(32),e.Hash160bit=e.typeforce.BufferN(20),e.Hash256bit=e.typeforce.BufferN(32),e.Number=e.typeforce.Number,e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.String=e.typeforce.String,e.Buffer=e.typeforce.Buffer,e.Hex=e.typeforce.Hex,e.maybe=e.typeforce.maybe,e.tuple=e.typeforce.tuple,e.UInt8=e.typeforce.UInt8,e.UInt32=e.typeforce.UInt32,e.Function=e.typeforce.Function,e.BufferN=e.typeforce.BufferN,e.Null=e.typeforce.Null,e.oneOf=e.typeforce.oneOf}(qG),Object.defineProperty(GG,"__esModule",{value:!0}),GG.encode=GG.decode=void 0;const kq=TG,_q=qG,{typeforce:Nq}=_q,Dq=ao.alloc(1,0);function Fq(e){let t=0;for(;0===e[t];)++t;return t===e.length?Dq:128&(e=e.slice(t))[0]?ao.concat([Dq,e],1+e.length):e}function Uq(e){0===e[0]&&(e=e.slice(1));const t=ao.alloc(32,0),n=Math.max(0,32-e.length);return e.copy(t,n),t}GG.decode=function(e){const t=e.readUInt8(e.length-1),n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);const r=kq.decode(e.slice(0,-1)),i=Uq(r.r),o=Uq(r.s);return{signature:ao.concat([i,o],64),hashType:t}},GG.encode=function(e,t){Nq({signature:_q.BufferN(64),hashType:_q.UInt8},{signature:e,hashType:t});const n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);const r=ao.allocUnsafe(1);r.writeUInt8(t,0);const i=Fq(e.slice(0,32)),o=Fq(e.slice(32,64));return ao.concat([kq.encode(i,o),r])},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.signature=e.number=e.isCanonicalScriptSignature=e.isDefinedHashType=e.isCanonicalPubKey=e.toStack=e.fromASM=e.toASM=e.decompile=e.compile=e.isPushOnly=e.OPS=void 0;const t=TG,n=LG;Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return n.OPS}});const r=OG,i=jG,o=GG,a=qG,{typeforce:s}=a,l=n.OPS.OP_RESERVED;function u(e){return a.Buffer(e)||function(e){return a.Number(e)&&(e===n.OPS.OP_0||e>=n.OPS.OP_1&&e<=n.OPS.OP_16||e===n.OPS.OP_1NEGATE)}(e)}function A(e){return a.Array(e)&&e.every(u)}function c(e){return 0===e.length?n.OPS.OP_0:1===e.length?e[0]>=1&&e[0]<=16?l+e[0]:129===e[0]?n.OPS.OP_1NEGATE:void 0:void 0}function h(e){return jo(e)}function d(e){return jo(e)}function f(e){if(h(e))return e;s(a.Array,e);const t=e.reduce(((e,t)=>d(t)?1===t.length&&void 0!==c(t)?e+1:e+r.encodingLength(t.length)+t.length:e+1),0),n=ao.allocUnsafe(t);let i=0;if(e.forEach((e=>{if(d(e)){const t=c(e);if(void 0!==t)return n.writeUInt8(t,i),void(i+=1);i+=r.encode(n,e.length,i),e.copy(n,i),i+=e.length}else n.writeUInt8(e,i),i+=1})),i!==n.length)throw new Error("Could not decode chunks");return n}function p(e){if(t=e,a.Array(t))return e;var t;s(a.Buffer,e);const i=[];let o=0;for(;o<e.length;){const t=e[o];if(t>n.OPS.OP_0&&t<=n.OPS.OP_PUSHDATA4){const t=r.decode(e,o);if(null===t)return null;if(o+=t.size,o+t.number>e.length)return null;const n=e.slice(o,o+t.number);o+=t.number;const a=c(n);void 0!==a?i.push(a):i.push(n)}else i.push(t),o+=1}return i}function g(e){const t=-129&e;return t>0&&t<4}e.isPushOnly=A,e.compile=f,e.decompile=p,e.toASM=function(e){return h(e)&&(e=p(e)),e.map((e=>{if(d(e)){const t=c(e);if(void 0===t)return e.toString("hex");e=t}return n.REVERSE_OPS[e]})).join(" ")},e.fromASM=function(e){return s(a.String,e),f(e.split(" ").map((e=>void 0!==n.OPS[e]?n.OPS[e]:(s(a.Hex,e),ao.from(e,"hex")))))},e.toStack=function(e){return e=p(e),s(A,e),e.map((e=>d(e)?e:e===n.OPS.OP_0?ao.allocUnsafe(0):i.encode(e-l)))},e.isCanonicalPubKey=function(e){return a.isPoint(e)},e.isDefinedHashType=g,e.isCanonicalScriptSignature=function(e){return!!jo(e)&&!!g(e[e.length-1])&&t.check(e.slice(0,-1))},e.number=i,e.signature=o}(PG);var Pq={};Object.defineProperty(Pq,"__esModule",{value:!0}),Pq.value=Pq.prop=void 0,Pq.prop=function(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=n.call(this);return this[t]=e,e},set(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})},Pq.value=function(e){let t;return()=>(void 0!==t||(t=e()),t)},Object.defineProperty(UG,"__esModule",{value:!0}),UG.p2data=void 0;const Tq=DG,Lq=PG,Mq=qG,Rq=Pq,Oq=Lq.OPS;UG.p2data=function(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,Mq.typeforce)({network:Mq.typeforce.maybe(Mq.typeforce.Object),output:Mq.typeforce.maybe(Mq.typeforce.Buffer),data:Mq.typeforce.maybe(Mq.typeforce.arrayOf(Mq.typeforce.Buffer))},e);const n={name:"embed",network:e.network||Tq.bitcoin};if(Rq.prop(n,"output",(()=>{if(e.data)return Lq.compile([Oq.OP_RETURN].concat(e.data))})),Rq.prop(n,"data",(()=>{if(e.output)return Lq.decompile(e.output).slice(1)})),t.validate&&e.output){const t=Lq.decompile(e.output);if(t[0]!==Oq.OP_RETURN)throw new TypeError("Output is invalid");if(!t.slice(1).every(Mq.typeforce.Buffer))throw new TypeError("Output is invalid");if(e.data&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.data,n.data))throw new TypeError("Data mismatch")}return Object.assign(n,e)};var Hq={};Object.defineProperty(Hq,"__esModule",{value:!0}),Hq.p2ms=void 0;const Kq=DG,jq=PG,Gq=qG,qq=Pq,Vq=jq.OPS,zq=Vq.OP_RESERVED;function Jq(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}Hq.p2ms=function(e,t){if(!(e.input||e.output||e.pubkeys&&void 0!==e.m||e.signatures))throw new TypeError("Not enough data");function n(e){return jq.isCanonicalScriptSignature(e)||void 0!==(t.allowIncomplete&&e===Vq.OP_0)}t=Object.assign({validate:!0},t||{}),(0,Gq.typeforce)({network:Gq.typeforce.maybe(Gq.typeforce.Object),m:Gq.typeforce.maybe(Gq.typeforce.Number),n:Gq.typeforce.maybe(Gq.typeforce.Number),output:Gq.typeforce.maybe(Gq.typeforce.Buffer),pubkeys:Gq.typeforce.maybe(Gq.typeforce.arrayOf(Gq.isPoint)),signatures:Gq.typeforce.maybe(Gq.typeforce.arrayOf(n)),input:Gq.typeforce.maybe(Gq.typeforce.Buffer)},e);const r={network:e.network||Kq.bitcoin};let i=[],o=!1;function a(e){o||(o=!0,i=jq.decompile(e),r.m=i[0]-zq,r.n=i[i.length-2]-zq,r.pubkeys=i.slice(1,-2))}if(qq.prop(r,"output",(()=>{if(e.m&&r.n&&e.pubkeys)return jq.compile([].concat(zq+e.m,e.pubkeys,zq+r.n,Vq.OP_CHECKMULTISIG))})),qq.prop(r,"m",(()=>{if(r.output)return a(r.output),r.m})),qq.prop(r,"n",(()=>{if(r.pubkeys)return r.pubkeys.length})),qq.prop(r,"pubkeys",(()=>{if(e.output)return a(e.output),r.pubkeys})),qq.prop(r,"signatures",(()=>{if(e.input)return jq.decompile(e.input).slice(1)})),qq.prop(r,"input",(()=>{if(e.signatures)return jq.compile([Vq.OP_0].concat(e.signatures))})),qq.prop(r,"witness",(()=>{if(r.input)return[]})),qq.prop(r,"name",(()=>{if(r.m&&r.n)return`p2ms(${r.m} of ${r.n})`})),t.validate){if(e.output){if(a(e.output),!Gq.typeforce.Number(i[0]))throw new TypeError("Output is invalid");if(!Gq.typeforce.Number(i[i.length-2]))throw new TypeError("Output is invalid");if(i[i.length-1]!==Vq.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(r.m<=0||r.n>16||r.m>r.n||r.n!==i.length-3)throw new TypeError("Output is invalid");if(!r.pubkeys.every((e=>(0,Gq.isPoint)(e))))throw new TypeError("Output is invalid");if(void 0!==e.m&&e.m!==r.m)throw new TypeError("m mismatch");if(void 0!==e.n&&e.n!==r.n)throw new TypeError("n mismatch");if(e.pubkeys&&!Jq(e.pubkeys,r.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(r.n=e.pubkeys.length,r.n<r.m)throw new TypeError("Pubkey count cannot be less than m")}if(e.signatures){if(e.signatures.length<r.m)throw new TypeError("Not enough signatures provided");if(e.signatures.length>r.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==Vq.OP_0)throw new TypeError("Input is invalid");if(0===r.signatures.length||!r.signatures.every(n))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!Jq(e.signatures,r.signatures))throw new TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(r,e)};var Yq={};Object.defineProperty(Yq,"__esModule",{value:!0}),Yq.p2pk=void 0;const Xq=DG,Wq=PG,Zq=qG,$q=Pq,eV=Wq.OPS;Yq.p2pk=function(e,t){if(!(e.input||e.output||e.pubkey||e.input||e.signature))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,Zq.typeforce)({network:Zq.typeforce.maybe(Zq.typeforce.Object),output:Zq.typeforce.maybe(Zq.typeforce.Buffer),pubkey:Zq.typeforce.maybe(Zq.isPoint),signature:Zq.typeforce.maybe(Wq.isCanonicalScriptSignature),input:Zq.typeforce.maybe(Zq.typeforce.Buffer)},e);const n=$q.value((()=>Wq.decompile(e.input))),r={name:"p2pk",network:e.network||Xq.bitcoin};if($q.prop(r,"output",(()=>{if(e.pubkey)return Wq.compile([e.pubkey,eV.OP_CHECKSIG])})),$q.prop(r,"pubkey",(()=>{if(e.output)return e.output.slice(1,-1)})),$q.prop(r,"signature",(()=>{if(e.input)return n()[0]})),$q.prop(r,"input",(()=>{if(e.signature)return Wq.compile([e.signature])})),$q.prop(r,"witness",(()=>{if(r.input)return[]})),t.validate){if(e.output){if(e.output[e.output.length-1]!==eV.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,Zq.isPoint)(r.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(r.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(r.input))throw new TypeError("Signature mismatch");if(e.input){if(1!==n().length)throw new TypeError("Input is invalid");if(!Wq.isCanonicalScriptSignature(r.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(r,e)};var tV={},nV={};Object.defineProperty(nV,"__esModule",{value:!0}),nV.taggedHash=nV.hash256=nV.hash160=nV.sha256=nV.sha1=nV.ripemd160=void 0;const rV=yL,iV=GP;function oV(e){try{return rV("rmd160").update(e).digest()}catch(t){try{return rV("ripemd160").update(e).digest()}catch(t){return(new iV).update(e).digest()}}}function aV(e){return rV("sha256").update(e).digest()}nV.ripemd160=oV,nV.sha1=function(e){return rV("sha1").update(e).digest()},nV.sha256=aV,nV.hash160=function(e){return oV(aV(e))},nV.hash256=function(e){return aV(aV(e))};const sV=Object.fromEntries(["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"].map((e=>{const t=aV(ao.from(e));return[e,ao.concat([t,t])]})));nV.taggedHash=function(e,t){return aV(ao.concat([sV[e],t]))};var lV=ER,uV=ED.exports.Buffer,AV=yL,cV=function(e){function t(t){var n=t.slice(0,-4),r=t.slice(-4),i=e(n);if(!(r[0]^i[0]|r[1]^i[1]|r[2]^i[2]|r[3]^i[3]))return n}return{encode:function(t){var n=e(t);return lV.encode(uV.concat([t,n],t.length+4))},decode:function(e){var n=t(lV.decode(e));if(!n)throw new Error("Invalid checksum");return n},decodeUnsafe:function(e){var n=lV.decodeUnsafe(e);if(n)return t(n)}}}((function(e){var t=AV("sha256").update(e).digest();return AV("sha256").update(t).digest()}));Object.defineProperty(tV,"__esModule",{value:!0}),tV.p2pkh=void 0;const hV=nV,dV=DG,fV=PG,pV=qG,gV=Pq,yV=cV,mV=fV.OPS;tV.p2pkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,pV.typeforce)({network:pV.typeforce.maybe(pV.typeforce.Object),address:pV.typeforce.maybe(pV.typeforce.String),hash:pV.typeforce.maybe(pV.typeforce.BufferN(20)),output:pV.typeforce.maybe(pV.typeforce.BufferN(25)),pubkey:pV.typeforce.maybe(pV.isPoint),signature:pV.typeforce.maybe(fV.isCanonicalScriptSignature),input:pV.typeforce.maybe(pV.typeforce.Buffer)},e);const n=gV.value((()=>{const t=yV.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),r=gV.value((()=>fV.decompile(e.input))),i=e.network||dV.bitcoin,o={name:"p2pkh",network:i};if(gV.prop(o,"address",(()=>{if(!o.hash)return;const e=ao.allocUnsafe(21);return e.writeUInt8(i.pubKeyHash,0),o.hash.copy(e,1),yV.encode(e)})),gV.prop(o,"hash",(()=>e.output?e.output.slice(3,23):e.address?n().hash:e.pubkey||o.pubkey?hV.hash160(e.pubkey||o.pubkey):void 0)),gV.prop(o,"output",(()=>{if(o.hash)return fV.compile([mV.OP_DUP,mV.OP_HASH160,o.hash,mV.OP_EQUALVERIFY,mV.OP_CHECKSIG])})),gV.prop(o,"pubkey",(()=>{if(e.input)return r()[1]})),gV.prop(o,"signature",(()=>{if(e.input)return r()[0]})),gV.prop(o,"input",(()=>{if(e.pubkey&&e.signature)return fV.compile([e.signature,e.pubkey])})),gV.prop(o,"witness",(()=>{if(o.input)return[]})),t.validate){let t=ao.from([]);if(e.address){if(n().version!==i.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==n().hash.length)throw new TypeError("Invalid address");t=n().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==mV.OP_DUP||e.output[1]!==mV.OP_HASH160||20!==e.output[2]||e.output[23]!==mV.OP_EQUALVERIFY||e.output[24]!==mV.OP_CHECKSIG)throw new TypeError("Output is invalid");const n=e.output.slice(3,23);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.pubkey){const n=hV.hash160(e.pubkey);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.input){const n=r();if(2!==n.length)throw new TypeError("Input is invalid");if(!fV.isCanonicalScriptSignature(n[0]))throw new TypeError("Input has invalid signature");if(!(0,pV.isPoint)(n[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(n[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(n[1]))throw new TypeError("Pubkey mismatch");const i=hV.hash160(n[1]);if(t.length>0&&!t.equals(i))throw new TypeError("Hash mismatch")}}return Object.assign(o,e)};var vV={};Object.defineProperty(vV,"__esModule",{value:!0}),vV.p2sh=void 0;const wV=nV,IV=DG,bV=PG,BV=qG,EV=Pq,CV=cV,xV=bV.OPS;vV.p2sh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,BV.typeforce)({network:BV.typeforce.maybe(BV.typeforce.Object),address:BV.typeforce.maybe(BV.typeforce.String),hash:BV.typeforce.maybe(BV.typeforce.BufferN(20)),output:BV.typeforce.maybe(BV.typeforce.BufferN(23)),redeem:BV.typeforce.maybe({network:BV.typeforce.maybe(BV.typeforce.Object),output:BV.typeforce.maybe(BV.typeforce.Buffer),input:BV.typeforce.maybe(BV.typeforce.Buffer),witness:BV.typeforce.maybe(BV.typeforce.arrayOf(BV.typeforce.Buffer))}),input:BV.typeforce.maybe(BV.typeforce.Buffer),witness:BV.typeforce.maybe(BV.typeforce.arrayOf(BV.typeforce.Buffer))},e);let n=e.network;n||(n=e.redeem&&e.redeem.network||IV.bitcoin);const r={network:n},i=EV.value((()=>{const t=CV.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),o=EV.value((()=>bV.decompile(e.input))),a=EV.value((()=>{const t=o(),r=t[t.length-1];return{network:n,output:r===xV.OP_FALSE?ao.from([]):r,input:bV.compile(t.slice(0,-1)),witness:e.witness||[]}}));if(EV.prop(r,"address",(()=>{if(!r.hash)return;const e=ao.allocUnsafe(21);return e.writeUInt8(r.network.scriptHash,0),r.hash.copy(e,1),CV.encode(e)})),EV.prop(r,"hash",(()=>e.output?e.output.slice(2,22):e.address?i().hash:r.redeem&&r.redeem.output?wV.hash160(r.redeem.output):void 0)),EV.prop(r,"output",(()=>{if(r.hash)return bV.compile([xV.OP_HASH160,r.hash,xV.OP_EQUAL])})),EV.prop(r,"redeem",(()=>{if(e.input)return a()})),EV.prop(r,"input",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.output)return bV.compile([].concat(bV.decompile(e.redeem.input),e.redeem.output))})),EV.prop(r,"witness",(()=>r.redeem&&r.redeem.witness?r.redeem.witness:r.input?[]:void 0)),EV.prop(r,"name",(()=>{const e=["p2sh"];return void 0!==r.redeem&&void 0!==r.redeem.name&&e.push(r.redeem.name),e.join("-")})),t.validate){let t=ao.from([]);if(e.address){if(i().version!==n.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==i().hash.length)throw new TypeError("Invalid address");t=i().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(23!==e.output.length||e.output[0]!==xV.OP_HASH160||20!==e.output[1]||e.output[22]!==xV.OP_EQUAL)throw new TypeError("Output is invalid");const n=e.output.slice(2,22);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}const r=e=>{if(e.output){const n=bV.decompile(e.output);if(!n||n.length<1)throw new TypeError("Redeem.output too short");const r=wV.hash160(e.output);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.input){const t=e.input.length>0,n=e.witness&&e.witness.length>0;if(!t&&!n)throw new TypeError("Empty input");if(t&&n)throw new TypeError("Input and witness provided");if(t){const t=bV.decompile(e.input);if(!bV.isPushOnly(t))throw new TypeError("Non push-only scriptSig")}}};if(e.input){const e=o();if(!e||e.length<1)throw new TypeError("Input too short");if(!jo(a().output))throw new TypeError("Input is invalid");r(a())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==n)throw new TypeError("Network mismatch");if(e.input){const t=a();if(e.redeem.output&&!e.redeem.output.equals(t.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(t.input))throw new TypeError("Redeem.input mismatch")}r(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(r,e)};var SV={},QV={};Object.defineProperty(QV,"__esModule",{value:!0}),QV.bech32m=QV.bech32=void 0;const kV="qpzry9x8gf2tvdw0s3jn54khce6mua7l",_V={};for(let e=0;e<kV.length;e++){const t=kV.charAt(e);_V[t]=e}function NV(e){const t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function DV(e){let t=1;for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=NV(t)^r>>5}t=NV(t);for(let n=0;n<e.length;++n){const r=e.charCodeAt(n);t=NV(t)^31&r}return t}function FV(e,t,n,r){let i=0,o=0;const a=(1<<n)-1,s=[];for(let r=0;r<e.length;++r)for(i=i<<t|e[r],o+=t;o>=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<<n-o&a);else{if(o>=t)return"Excess padding";if(i<<n-o&a)return"Non-zero padding"}return s}function UV(e){return FV(e,8,5,!0)}function PV(e){const t=FV(e,5,8,!1);if(Array.isArray(t))return t}function TV(e){const t=FV(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function LV(e){let t;function n(e,n){if(n=n||90,e.length<8)return e+" too short";if(e.length>n)return"Exceeds length limit";const r=e.toLowerCase(),i=e.toUpperCase();if(e!==r&&e!==i)return"Mixed-case string "+e;const o=(e=r).lastIndexOf("1");if(-1===o)return"No separator character for "+e;if(0===o)return"Missing prefix for "+e;const a=e.slice(0,o),s=e.slice(o+1);if(s.length<6)return"Data too short";let l=DV(a);if("string"==typeof l)return l;const u=[];for(let e=0;e<s.length;++e){const t=s.charAt(e),n=_V[t];if(void 0===n)return"Unknown character "+t;l=NV(l)^n,e+6>=s.length||u.push(n)}return l!==t?"Invalid checksum for "+e:{prefix:a,words:u}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const r=n(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=n(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(e,n,r){if(r=r||90,e.length+7+n.length>r)throw new TypeError("Exceeds length limit");let i=DV(e=e.toLowerCase());if("string"==typeof i)throw new Error(i);let o=e+"1";for(let e=0;e<n.length;++e){const t=n[e];if(t>>5!=0)throw new Error("Non 5-bit word");i=NV(i)^t,o+=kV.charAt(t)}for(let e=0;e<6;++e)i=NV(i);i^=t;for(let e=0;e<6;++e)o+=kV.charAt(i>>5*(5-e)&31);return o},toWords:UV,fromWordsUnsafe:PV,fromWords:TV}}QV.bech32=LV("bech32"),QV.bech32m=LV("bech32m"),Object.defineProperty(SV,"__esModule",{value:!0}),SV.p2wpkh=void 0;const MV=nV,RV=DG,OV=PG,HV=qG,KV=Pq,jV=QV,GV=OV.OPS,qV=ao.alloc(0);SV.p2wpkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,HV.typeforce)({address:HV.typeforce.maybe(HV.typeforce.String),hash:HV.typeforce.maybe(HV.typeforce.BufferN(20)),input:HV.typeforce.maybe(HV.typeforce.BufferN(0)),network:HV.typeforce.maybe(HV.typeforce.Object),output:HV.typeforce.maybe(HV.typeforce.BufferN(22)),pubkey:HV.typeforce.maybe(HV.isPoint),signature:HV.typeforce.maybe(OV.isCanonicalScriptSignature),witness:HV.typeforce.maybe(HV.typeforce.arrayOf(HV.typeforce.Buffer))},e);const n=KV.value((()=>{const t=jV.bech32.decode(e.address),n=t.words.shift(),r=jV.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:ao.from(r)}})),r=e.network||RV.bitcoin,i={name:"p2wpkh",network:r};if(KV.prop(i,"address",(()=>{if(!i.hash)return;const e=jV.bech32.toWords(i.hash);return e.unshift(0),jV.bech32.encode(r.bech32,e)})),KV.prop(i,"hash",(()=>e.output?e.output.slice(2,22):e.address?n().data:e.pubkey||i.pubkey?MV.hash160(e.pubkey||i.pubkey):void 0)),KV.prop(i,"output",(()=>{if(i.hash)return OV.compile([GV.OP_0,i.hash])})),KV.prop(i,"pubkey",(()=>e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0)),KV.prop(i,"signature",(()=>{if(e.witness)return e.witness[0]})),KV.prop(i,"input",(()=>{if(i.witness)return qV})),KV.prop(i,"witness",(()=>{if(e.pubkey&&e.signature)return[e.signature,e.pubkey]})),t.validate){let t=ao.from([]);if(e.address){if(r&&r.bech32!==n().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(20!==n().data.length)throw new TypeError("Invalid address data");t=n().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(22!==e.output.length||e.output[0]!==GV.OP_0||20!==e.output[1])throw new TypeError("Output is invalid");if(t.length>0&&!t.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");t=e.output.slice(2)}if(e.pubkey){const n=MV.hash160(e.pubkey);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");if(t=n,!(0,HV.isPoint)(e.pubkey)||33!==e.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(2!==e.witness.length)throw new TypeError("Witness is invalid");if(!OV.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,HV.isPoint)(e.witness[1])||33!==e.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");const n=MV.hash160(e.witness[1]);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(i,e)};var VV={};Object.defineProperty(VV,"__esModule",{value:!0}),VV.p2wsh=void 0;const zV=nV,JV=DG,YV=PG,XV=qG,WV=Pq,ZV=QV,$V=YV.OPS,ez=ao.alloc(0);function tz(e){return!(!jo(e)||65!==e.length||4!==e[0]||!(0,XV.isPoint)(e))}VV.p2wsh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,XV.typeforce)({network:XV.typeforce.maybe(XV.typeforce.Object),address:XV.typeforce.maybe(XV.typeforce.String),hash:XV.typeforce.maybe(XV.typeforce.BufferN(32)),output:XV.typeforce.maybe(XV.typeforce.BufferN(34)),redeem:XV.typeforce.maybe({input:XV.typeforce.maybe(XV.typeforce.Buffer),network:XV.typeforce.maybe(XV.typeforce.Object),output:XV.typeforce.maybe(XV.typeforce.Buffer),witness:XV.typeforce.maybe(XV.typeforce.arrayOf(XV.typeforce.Buffer))}),input:XV.typeforce.maybe(XV.typeforce.BufferN(0)),witness:XV.typeforce.maybe(XV.typeforce.arrayOf(XV.typeforce.Buffer))},e);const n=WV.value((()=>{const t=ZV.bech32.decode(e.address),n=t.words.shift(),r=ZV.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:ao.from(r)}})),r=WV.value((()=>YV.decompile(e.redeem.input)));let i=e.network;i||(i=e.redeem&&e.redeem.network||JV.bitcoin);const o={network:i};if(WV.prop(o,"address",(()=>{if(!o.hash)return;const e=ZV.bech32.toWords(o.hash);return e.unshift(0),ZV.bech32.encode(i.bech32,e)})),WV.prop(o,"hash",(()=>e.output?e.output.slice(2):e.address?n().data:o.redeem&&o.redeem.output?zV.sha256(o.redeem.output):void 0)),WV.prop(o,"output",(()=>{if(o.hash)return YV.compile([$V.OP_0,o.hash])})),WV.prop(o,"redeem",(()=>{if(e.witness)return{output:e.witness[e.witness.length-1],input:ez,witness:e.witness.slice(0,-1)}})),WV.prop(o,"input",(()=>{if(o.witness)return ez})),WV.prop(o,"witness",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){const t=YV.toStack(r());return o.redeem=Object.assign({witness:t},e.redeem),o.redeem.input=ez,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)})),WV.prop(o,"name",(()=>{const e=["p2wsh"];return void 0!==o.redeem&&void 0!==o.redeem.name&&e.push(o.redeem.name),e.join("-")})),t.validate){let t=ao.from([]);if(e.address){if(n().prefix!==i.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(32!==n().data.length)throw new TypeError("Invalid address data");t=n().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(34!==e.output.length||e.output[0]!==$V.OP_0||32!==e.output[1])throw new TypeError("Output is invalid");const n=e.output.slice(2);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.redeem){if(e.redeem.network&&e.redeem.network!==i)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){if(0===YV.decompile(e.redeem.output).length)throw new TypeError("Redeem.output is invalid");const n=zV.sha256(e.redeem.output);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.redeem.input&&!YV.isPushOnly(r()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every(((e,n)=>e.equals(t[n])))}(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&r().some(tz)||e.redeem.output&&(YV.decompile(e.redeem.output)||[]).some(tz))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){const t=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&!e.redeem.output.equals(t))throw new TypeError("Witness and redeem.output mismatch");if(e.witness.some(tz)||(YV.decompile(t)||[]).some(tz))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(o,e)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.p2wsh=e.p2wpkh=e.p2sh=e.p2pkh=e.p2pk=e.p2ms=e.embed=void 0;const t=UG;Object.defineProperty(e,"embed",{enumerable:!0,get:function(){return t.p2data}});const n=Hq;Object.defineProperty(e,"p2ms",{enumerable:!0,get:function(){return n.p2ms}});const r=Yq;Object.defineProperty(e,"p2pk",{enumerable:!0,get:function(){return r.p2pk}});const i=tV;Object.defineProperty(e,"p2pkh",{enumerable:!0,get:function(){return i.p2pkh}});const o=vV;Object.defineProperty(e,"p2sh",{enumerable:!0,get:function(){return o.p2sh}});const a=SV;Object.defineProperty(e,"p2wpkh",{enumerable:!0,get:function(){return a.p2wpkh}});const s=VV;Object.defineProperty(e,"p2wsh",{enumerable:!0,get:function(){return s.p2wsh}})}(FG),Object.defineProperty(NG,"__esModule",{value:!0}),NG.toOutputScript=NG.fromOutputScript=NG.toBech32=NG.toBase58Check=NG.fromBech32=NG.fromBase58Check=void 0;const nz=DG,rz=FG,iz=PG,oz=qG,az=QV,sz=cV,{typeforce:lz}=oz,uz="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";function Az(e){const t=sz.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");return{version:t.readUInt8(0),hash:t.slice(1)}}function cz(e){let t,n;try{t=az.bech32.decode(e)}catch(e){}if(t){if(n=t.words[0],0!==n)throw new TypeError(e+" uses wrong encoding")}else if(t=az.bech32m.decode(e),n=t.words[0],0===n)throw new TypeError(e+" uses wrong encoding");const r=az.bech32.fromWords(t.words.slice(1));return{version:n,prefix:t.prefix,data:ao.from(r)}}function hz(e,t,n){const r=az.bech32.toWords(e);return r.unshift(t),0===t?az.bech32.encode(n,r):az.bech32m.encode(n,r)}NG.fromBase58Check=Az,NG.fromBech32=cz,NG.toBase58Check=function(e,t){lz(oz.tuple(oz.Hash160bit,oz.UInt8),arguments);const n=ao.allocUnsafe(21);return n.writeUInt8(t,0),e.copy(n,1),sz.encode(n)},NG.toBech32=hz,NG.fromOutputScript=function(e,t){t=t||nz.bitcoin;try{return rz.p2pkh({output:e,network:t}).address}catch(e){}try{return rz.p2sh({output:e,network:t}).address}catch(e){}try{return rz.p2wpkh({output:e,network:t}).address}catch(e){}try{return rz.p2wsh({output:e,network:t}).address}catch(e){}try{return function(e,t){const n=e.slice(2);if(n.length<2||n.length>40)throw new TypeError("Invalid program length for segwit address");const r=e[0]-80;if(r<1||r>16)throw new TypeError("Invalid version for segwit address");if(e[1]!==n.length)throw new TypeError("Invalid script for segwit address");return console.warn(uz),hz(n,r,t.bech32)}(e,t)}catch(e){}throw new Error(iz.toASM(e)+" has no matching Address")},NG.toOutputScript=function(e,t){let n,r;t=t||nz.bitcoin;try{n=Az(e)}catch(e){}if(n){if(n.version===t.pubKeyHash)return rz.p2pkh({hash:n.hash}).output;if(n.version===t.scriptHash)return rz.p2sh({hash:n.hash}).output}else{try{r=cz(e)}catch(e){}if(r){if(r.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===r.version){if(20===r.data.length)return rz.p2wpkh({hash:r.data}).output;if(32===r.data.length)return rz.p2wsh({hash:r.data}).output}else if(r.version>=1&&r.version<=16&&r.data.length>=2&&r.data.length<=40)return console.warn(uz),iz.compile([r.version+80,r.data])}}throw new Error(e+" has no matching Script")};var dz={},fz={},pz=ED.exports.Buffer;function gz(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function yz(e){return gz(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var mz={encode:function e(t,n,r){if(gz(t),n||(n=pz.allocUnsafe(yz(t))),!pz.isBuffer(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),e.bytes=1):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),e.bytes=3):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),e.bytes=5):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),e.bytes=9),n},decode:function e(t,n){if(!pz.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);var r=t.readUInt8(n);if(r<253)return e.bytes=1,r;if(253===r)return e.bytes=3,t.readUInt16LE(n+1);if(254===r)return e.bytes=5,t.readUInt32LE(n+1);e.bytes=9;var i=t.readUInt32LE(n+1),o=4294967296*t.readUInt32LE(n+5)+i;return gz(o),o},encodingLength:yz};Object.defineProperty(fz,"__esModule",{value:!0}),fz.BufferReader=fz.BufferWriter=fz.cloneBuffer=fz.reverseBuffer=fz.writeUInt64LE=fz.readUInt64LE=fz.varuint=void 0;const vz=qG,{typeforce:wz}=vz,Iz=mz;function bz(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function Bz(e,t){const n=e.readUInt32LE(t);let r=e.readUInt32LE(t+4);return r*=4294967296,bz(r+n,9007199254740991),r+n}function Ez(e,t,n){return bz(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8}fz.varuint=Iz,fz.readUInt64LE=Bz,fz.writeUInt64LE=Ez,fz.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,n=0;for(let r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},fz.cloneBuffer=function(e){const t=ao.allocUnsafe(e.length);return e.copy(t),t};class Cz{constructor(e,t=0){this.buffer=e,this.offset=t,wz(vz.tuple(vz.Buffer,vz.UInt32),[e,t])}static withCapacity(e){return new Cz(ao.alloc(e))}writeUInt8(e){this.offset=this.buffer.writeUInt8(e,this.offset)}writeInt32(e){this.offset=this.buffer.writeInt32LE(e,this.offset)}writeUInt32(e){this.offset=this.buffer.writeUInt32LE(e,this.offset)}writeUInt64(e){this.offset=Ez(this.buffer,e,this.offset)}writeVarInt(e){Iz.encode(e,this.buffer,this.offset),this.offset+=Iz.encode.bytes}writeSlice(e){if(this.buffer.length<this.offset+e.length)throw new Error("Cannot write slice out of bounds");this.offset+=e.copy(this.buffer,this.offset)}writeVarSlice(e){this.writeVarInt(e.length),this.writeSlice(e)}writeVector(e){this.writeVarInt(e.length),e.forEach((e=>this.writeVarSlice(e)))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}fz.BufferWriter=Cz,fz.BufferReader=class{constructor(e,t=0){this.buffer=e,this.offset=t,wz(vz.tuple(vz.Buffer,vz.UInt32),[e,t])}readUInt8(){const e=this.buffer.readUInt8(this.offset);return this.offset++,e}readInt32(){const e=this.buffer.readInt32LE(this.offset);return this.offset+=4,e}readUInt32(){const e=this.buffer.readUInt32LE(this.offset);return this.offset+=4,e}readUInt64(){const e=Bz(this.buffer,this.offset);return this.offset+=8,e}readVarInt(){const e=Iz.decode(this.buffer,this.offset);return this.offset+=Iz.decode.bytes,e}readSlice(e){if(this.buffer.length<this.offset+e)throw new Error("Cannot read slice out of bounds");const t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const e=this.readVarInt(),t=[];for(let n=0;n<e;n++)t.push(this.readVarSlice());return t}};var xz={};Object.defineProperty(xz,"__esModule",{value:!0}),xz.fastMerkleRoot=void 0,xz.fastMerkleRoot=function(e,t){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof t)throw TypeError("Expected digest Function");let n=e.length;const r=e.concat();for(;n>1;){let e=0;for(let i=0;i<n;i+=2,++e){const o=r[i],a=i+1===n?o:r[i+1],s=ao.concat([o,a]);r[e]=t(s)}n=e}return r[0]};var Sz={};Object.defineProperty(Sz,"__esModule",{value:!0}),Sz.Transaction=void 0;const Qz=fz,kz=nV,_z=PG,Nz=PG,Dz=qG,{typeforce:Fz}=Dz;function Uz(e){const t=e.length;return Qz.varuint.encodingLength(t)+t}const Pz=ao.allocUnsafe(0),Tz=[],Lz=ao.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),Mz=ao.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),Rz=ao.from("ffffffffffffffff","hex"),Oz={script:Pz,valueBuffer:Rz};class Hz{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(e,t){const n=new Qz.BufferReader(e),r=new Hz;r.version=n.readInt32();const i=n.readUInt8(),o=n.readUInt8();let a=!1;i===Hz.ADVANCED_TRANSACTION_MARKER&&o===Hz.ADVANCED_TRANSACTION_FLAG?a=!0:n.offset-=2;const s=n.readVarInt();for(let e=0;e<s;++e)r.ins.push({hash:n.readSlice(32),index:n.readUInt32(),script:n.readVarSlice(),sequence:n.readUInt32(),witness:Tz});const l=n.readVarInt();for(let e=0;e<l;++e)r.outs.push({value:n.readUInt64(),script:n.readVarSlice()});if(a){for(let e=0;e<s;++e)r.ins[e].witness=n.readVector();if(!r.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(r.locktime=n.readUInt32(),t)return r;if(n.offset!==e.length)throw new Error("Transaction has unexpected data");return r}static fromHex(e){return Hz.fromBuffer(ao.from(e,"hex"),!1)}static isCoinbaseHash(e){Fz(Dz.Hash256bit,e);for(let t=0;t<32;++t)if(0!==e[t])return!1;return!0}isCoinbase(){return 1===this.ins.length&&Hz.isCoinbaseHash(this.ins[0].hash)}addInput(e,t,n,r){return Fz(Dz.tuple(Dz.Hash256bit,Dz.UInt32,Dz.maybe(Dz.UInt32),Dz.maybe(Dz.Buffer)),arguments),Dz.Null(n)&&(n=Hz.DEFAULT_SEQUENCE),this.ins.push({hash:e,index:t,script:r||Pz,sequence:n,witness:Tz})-1}addOutput(e,t){return Fz(Dz.tuple(Dz.Buffer,Dz.Satoshi),arguments),this.outs.push({script:e,value:t})-1}hasWitnesses(){return this.ins.some((e=>0!==e.witness.length))}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(e=!0){const t=e&&this.hasWitnesses();return(t?10:8)+Qz.varuint.encodingLength(this.ins.length)+Qz.varuint.encodingLength(this.outs.length)+this.ins.reduce(((e,t)=>e+40+Uz(t.script)),0)+this.outs.reduce(((e,t)=>e+8+Uz(t.script)),0)+(t?this.ins.reduce(((e,t)=>e+function(e){const t=e.length;return Qz.varuint.encodingLength(t)+e.reduce(((e,t)=>e+Uz(t)),0)}(t.witness)),0):0)}clone(){const e=new Hz;return e.version=this.version,e.locktime=this.locktime,e.ins=this.ins.map((e=>({hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness}))),e.outs=this.outs.map((e=>({script:e.script,value:e.value}))),e}hashForSignature(e,t,n){if(Fz(Dz.tuple(Dz.UInt32,Dz.Buffer,Dz.Number),arguments),e>=this.ins.length)return Mz;const r=_z.compile(_z.decompile(t).filter((e=>e!==Nz.OPS.OP_CODESEPARATOR))),i=this.clone();if((31&n)===Hz.SIGHASH_NONE)i.outs=[],i.ins.forEach(((t,n)=>{n!==e&&(t.sequence=0)}));else if((31&n)===Hz.SIGHASH_SINGLE){if(e>=this.outs.length)return Mz;i.outs.length=e+1;for(let t=0;t<e;t++)i.outs[t]=Oz;i.ins.forEach(((t,n)=>{n!==e&&(t.sequence=0)}))}n&Hz.SIGHASH_ANYONECANPAY?(i.ins=[i.ins[e]],i.ins[0].script=r):(i.ins.forEach((e=>{e.script=Pz})),i.ins[e].script=r);const o=ao.allocUnsafe(i.byteLength(!1)+4);return o.writeInt32LE(n,o.length-4),i.__toBuffer(o,0,!1),kz.hash256(o)}hashForWitnessV1(e,t,n,r,i,o){if(Fz(Dz.tuple(Dz.UInt32,Fz.arrayOf(Dz.Buffer),Fz.arrayOf(Dz.Satoshi),Dz.UInt32),arguments),n.length!==this.ins.length||t.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const a=r===Hz.SIGHASH_DEFAULT?Hz.SIGHASH_ALL:r&Hz.SIGHASH_OUTPUT_MASK,s=(r&Hz.SIGHASH_INPUT_MASK)===Hz.SIGHASH_ANYONECANPAY,l=a===Hz.SIGHASH_NONE,u=a===Hz.SIGHASH_SINGLE;let A=Pz,c=Pz,h=Pz,d=Pz,f=Pz;if(!s){let e=Qz.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach((t=>{e.writeSlice(t.hash),e.writeUInt32(t.index)})),A=kz.sha256(e.end()),e=Qz.BufferWriter.withCapacity(8*this.ins.length),n.forEach((t=>e.writeUInt64(t))),c=kz.sha256(e.end()),e=Qz.BufferWriter.withCapacity(t.map(Uz).reduce(((e,t)=>e+t))),t.forEach((t=>e.writeVarSlice(t))),h=kz.sha256(e.end()),e=Qz.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach((t=>e.writeUInt32(t.sequence))),d=kz.sha256(e.end())}if(l||u){if(u&&e<this.outs.length){const t=this.outs[e],n=Qz.BufferWriter.withCapacity(8+Uz(t.script));n.writeUInt64(t.value),n.writeVarSlice(t.script),f=kz.sha256(n.end())}}else{const e=this.outs.map((e=>8+Uz(e.script))).reduce(((e,t)=>e+t)),t=Qz.BufferWriter.withCapacity(e);this.outs.forEach((e=>{t.writeUInt64(e.value),t.writeVarSlice(e.script)})),f=kz.sha256(t.end())}const p=(i?2:0)+(o?1:0),g=174-(s?49:0)-(l?32:0)+(o?32:0)+(i?37:0),y=Qz.BufferWriter.withCapacity(g);if(y.writeUInt8(r),y.writeInt32(this.version),y.writeUInt32(this.locktime),y.writeSlice(A),y.writeSlice(c),y.writeSlice(h),y.writeSlice(d),l||u||y.writeSlice(f),y.writeUInt8(p),s){const r=this.ins[e];y.writeSlice(r.hash),y.writeUInt32(r.index),y.writeUInt64(n[e]),y.writeVarSlice(t[e]),y.writeUInt32(r.sequence)}else y.writeUInt32(e);if(o){const e=Qz.BufferWriter.withCapacity(Uz(o));e.writeVarSlice(o),y.writeSlice(kz.sha256(e.end()))}return u&&y.writeSlice(f),i&&(y.writeSlice(i),y.writeUInt8(0),y.writeUInt32(4294967295)),kz.taggedHash("TapSighash",ao.concat([ao.of(0),y.end()]))}hashForWitnessV0(e,t,n,r){Fz(Dz.tuple(Dz.UInt32,Dz.Buffer,Dz.Satoshi,Dz.UInt32),arguments);let i,o=ao.from([]),a=Lz,s=Lz,l=Lz;if(r&Hz.SIGHASH_ANYONECANPAY||(o=ao.allocUnsafe(36*this.ins.length),i=new Qz.BufferWriter(o,0),this.ins.forEach((e=>{i.writeSlice(e.hash),i.writeUInt32(e.index)})),s=kz.hash256(o)),r&Hz.SIGHASH_ANYONECANPAY||(31&r)===Hz.SIGHASH_SINGLE||(31&r)===Hz.SIGHASH_NONE||(o=ao.allocUnsafe(4*this.ins.length),i=new Qz.BufferWriter(o,0),this.ins.forEach((e=>{i.writeUInt32(e.sequence)})),l=kz.hash256(o)),(31&r)!==Hz.SIGHASH_SINGLE&&(31&r)!==Hz.SIGHASH_NONE){const e=this.outs.reduce(((e,t)=>e+8+Uz(t.script)),0);o=ao.allocUnsafe(e),i=new Qz.BufferWriter(o,0),this.outs.forEach((e=>{i.writeUInt64(e.value),i.writeVarSlice(e.script)})),a=kz.hash256(o)}else if((31&r)===Hz.SIGHASH_SINGLE&&e<this.outs.length){const t=this.outs[e];o=ao.allocUnsafe(8+Uz(t.script)),i=new Qz.BufferWriter(o,0),i.writeUInt64(t.value),i.writeVarSlice(t.script),a=kz.hash256(o)}o=ao.allocUnsafe(156+Uz(t)),i=new Qz.BufferWriter(o,0);const u=this.ins[e];return i.writeInt32(this.version),i.writeSlice(s),i.writeSlice(l),i.writeSlice(u.hash),i.writeUInt32(u.index),i.writeVarSlice(t),i.writeUInt64(n),i.writeUInt32(u.sequence),i.writeSlice(a),i.writeUInt32(this.locktime),i.writeUInt32(r),kz.hash256(o)}getHash(e){return e&&this.isCoinbase()?ao.alloc(32,0):kz.hash256(this.__toBuffer(void 0,void 0,e))}getId(){return(0,Qz.reverseBuffer)(this.getHash(!1)).toString("hex")}toBuffer(e,t){return this.__toBuffer(e,t,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(e,t){Fz(Dz.tuple(Dz.Number,Dz.Buffer),arguments),this.ins[e].script=t}setWitness(e,t){Fz(Dz.tuple(Dz.Number,[Dz.Buffer]),arguments),this.ins[e].witness=t}__toBuffer(e,t,n=!1){e||(e=ao.allocUnsafe(this.byteLength(n)));const r=new Qz.BufferWriter(e,t||0);r.writeInt32(this.version);const i=n&&this.hasWitnesses();return i&&(r.writeUInt8(Hz.ADVANCED_TRANSACTION_MARKER),r.writeUInt8(Hz.ADVANCED_TRANSACTION_FLAG)),r.writeVarInt(this.ins.length),this.ins.forEach((e=>{r.writeSlice(e.hash),r.writeUInt32(e.index),r.writeVarSlice(e.script),r.writeUInt32(e.sequence)})),r.writeVarInt(this.outs.length),this.outs.forEach((e=>{void 0!==e.value?r.writeUInt64(e.value):r.writeSlice(e.valueBuffer),r.writeVarSlice(e.script)})),i&&this.ins.forEach((e=>{r.writeVector(e.witness)})),r.writeUInt32(this.locktime),void 0!==t?e.slice(t,r.offset):e}}Sz.Transaction=Hz,Hz.DEFAULT_SEQUENCE=4294967295,Hz.SIGHASH_DEFAULT=0,Hz.SIGHASH_ALL=1,Hz.SIGHASH_NONE=2,Hz.SIGHASH_SINGLE=3,Hz.SIGHASH_ANYONECANPAY=128,Hz.SIGHASH_OUTPUT_MASK=3,Hz.SIGHASH_INPUT_MASK=128,Hz.ADVANCED_TRANSACTION_MARKER=0,Hz.ADVANCED_TRANSACTION_FLAG=1,Object.defineProperty(dz,"__esModule",{value:!0}),dz.Block=void 0;const Kz=fz,jz=nV,Gz=xz,qz=Sz,Vz=qG,{typeforce:zz}=Vz,Jz=new TypeError("Cannot compute merkle root for zero transactions"),Yz=new TypeError("Cannot compute witness commit for non-segwit block");class Xz{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(e){if(e.length<80)throw new Error("Buffer too small (< 80 bytes)");const t=new Kz.BufferReader(e),n=new Xz;if(n.version=t.readInt32(),n.prevHash=t.readSlice(32),n.merkleRoot=t.readSlice(32),n.timestamp=t.readUInt32(),n.bits=t.readUInt32(),n.nonce=t.readUInt32(),80===e.length)return n;const r=()=>{const e=qz.Transaction.fromBuffer(t.buffer.slice(t.offset),!0);return t.offset+=e.byteLength(),e},i=t.readVarInt();n.transactions=[];for(let e=0;e<i;++e){const e=r();n.transactions.push(e)}const o=n.getWitnessCommit();return o&&(n.witnessCommit=o),n}static fromHex(e){return Xz.fromBuffer(ao.from(e,"hex"))}static calculateTarget(e){const t=((4278190080&e)>>24)-3,n=8388607&e,r=ao.alloc(32,0);return r.writeUIntBE(n,29-t,3),r}static calculateMerkleRoot(e,t){if(zz([{getHash:Vz.Function}],e),0===e.length)throw Jz;if(t&&!Wz(e))throw Yz;const n=e.map((e=>e.getHash(t))),r=(0,Gz.fastMerkleRoot)(n,jz.hash256);return t?jz.hash256(ao.concat([r,e[0].ins[0].witness[0]])):r}getWitnessCommit(){if(!Wz(this.transactions))return null;const e=this.transactions[0].outs.filter((e=>e.script.slice(0,6).equals(ao.from("6a24aa21a9ed","hex")))).map((e=>e.script.slice(6,38)));if(0===e.length)return null;const t=e[e.length-1];return t instanceof ao&&32===t.length?t:null}hasWitnessCommit(){return this.witnessCommit instanceof ao&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(e=this.transactions)instanceof Array&&e.some((e=>"object"==typeof e&&e.ins instanceof Array&&e.ins.some((e=>"object"==typeof e&&e.witness instanceof Array&&e.witness.length>0))));var e}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(e,t=!0){return e||!this.transactions?80:80+Kz.varuint.encodingLength(this.transactions.length)+this.transactions.reduce(((e,n)=>e+n.byteLength(t)),0)}getHash(){return jz.hash256(this.toBuffer(!0))}getId(){return(0,Kz.reverseBuffer)(this.getHash()).toString("hex")}getUTCDate(){const e=new Date(0);return e.setUTCSeconds(this.timestamp),e}toBuffer(e){const t=ao.allocUnsafe(this.byteLength(e)),n=new Kz.BufferWriter(t);return n.writeInt32(this.version),n.writeSlice(this.prevHash),n.writeSlice(this.merkleRoot),n.writeUInt32(this.timestamp),n.writeUInt32(this.bits),n.writeUInt32(this.nonce),e||!this.transactions||(Kz.varuint.encode(this.transactions.length,t,n.offset),n.offset+=Kz.varuint.encode.bytes,this.transactions.forEach((e=>{const r=e.byteLength();e.toBuffer(t,n.offset),n.offset+=r}))),t}toHex(e){return this.toBuffer(e).toString("hex")}checkTxRoots(){const e=this.hasWitnessCommit();return!(!e&&this.hasWitness())&&this.__checkMerkleRoot()&&(!e||this.__checkWitnessCommit())}checkProofOfWork(){const e=(0,Kz.reverseBuffer)(this.getHash()),t=Xz.calculateTarget(this.bits);return e.compare(t)<=0}__checkMerkleRoot(){if(!this.transactions)throw Jz;const e=Xz.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(e)}__checkWitnessCommit(){if(!this.transactions)throw Jz;if(!this.hasWitnessCommit())throw Yz;const e=Xz.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(e)}}function Wz(e){return e instanceof Array&&e[0]&&e[0].ins&&e[0].ins instanceof Array&&e[0].ins[0]&&e[0].ins[0].witness&&e[0].ins[0].witness instanceof Array&&e[0].ins[0].witness.length>0}dz.Block=Xz;var Zz={},$z={},eJ={},tJ={},nJ={},rJ={},iJ={};!function(e){var t,n,r;Object.defineProperty(e,"__esModule",{value:!0}),(t=e.GlobalTypes||(e.GlobalTypes={}))[t.UNSIGNED_TX=0]="UNSIGNED_TX",t[t.GLOBAL_XPUB=1]="GLOBAL_XPUB",e.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],(n=e.InputTypes||(e.InputTypes={}))[n.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",n[n.WITNESS_UTXO=1]="WITNESS_UTXO",n[n.PARTIAL_SIG=2]="PARTIAL_SIG",n[n.SIGHASH_TYPE=3]="SIGHASH_TYPE",n[n.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",n[n.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",n[n.BIP32_DERIVATION=6]="BIP32_DERIVATION",n[n.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",n[n.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",n[n.POR_COMMITMENT=9]="POR_COMMITMENT",n[n.TAP_KEY_SIG=19]="TAP_KEY_SIG",n[n.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",n[n.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",n[n.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",n[n.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",n[n.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT",e.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],(r=e.OutputTypes||(e.OutputTypes={}))[r.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",r[r.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",r[r.BIP32_DERIVATION=2]="BIP32_DERIVATION",r[r.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",r[r.TAP_TREE=6]="TAP_TREE",r[r.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION",e.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]}(iJ);var oJ={};Object.defineProperty(oJ,"__esModule",{value:!0});const aJ=iJ;oJ.decode=function(e){if(e.key[0]!==aJ.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+e.key.toString("hex"));if(79!==e.key.length||![2,3].includes(e.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const t=e.key.slice(1),n={masterFingerprint:e.value.slice(0,4),extendedPubkey:t,path:"m"};for(const t of(r=e.value.length/4-1,[...Array(r).keys()])){const r=e.value.readUInt32LE(4*t+4),i=!!(2147483648&r),o=2147483647&r;n.path+="/"+o.toString(10)+(i?"'":"")}var r;return n},oJ.encode=function(e){const t=ao.from([aJ.GlobalTypes.GLOBAL_XPUB]),n=ao.concat([t,e.extendedPubkey]),r=e.path.split("/"),i=ao.allocUnsafe(4*r.length);e.masterFingerprint.copy(i,0);let o=4;return r.slice(1).forEach((e=>{const t="'"===e.slice(-1);let n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),i.writeUInt32LE(n,o),o+=4})),{key:n,value:i}},oJ.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",oJ.check=function(e){const t=e.extendedPubkey,n=e.masterFingerprint,r=e.path;return jo(t)&&78===t.length&&[2,3].indexOf(t[45])>-1&&jo(n)&&4===n.length&&"string"==typeof r&&!!r.match(/^m(\/\d+'?)*$/)},oJ.canAddToArray=function(e,t,n){const r=t.extendedPubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.extendedPubkey.equals(t.extendedPubkey))).length)};var sJ={};Object.defineProperty(sJ,"__esModule",{value:!0});const lJ=iJ;sJ.encode=function(e){return{key:ao.from([lJ.GlobalTypes.UNSIGNED_TX]),value:e.toBuffer()}};var uJ={};Object.defineProperty(uJ,"__esModule",{value:!0});const AJ=iJ;uJ.decode=function(e){if(e.key[0]!==AJ.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+e.key.toString("hex"));return e.value},uJ.encode=function(e){return{key:ao.from([AJ.InputTypes.FINAL_SCRIPTSIG]),value:e}},uJ.expected="Buffer",uJ.check=function(e){return jo(e)},uJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptSig};var cJ={};Object.defineProperty(cJ,"__esModule",{value:!0});const hJ=iJ;cJ.decode=function(e){if(e.key[0]!==hJ.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+e.key.toString("hex"));return e.value},cJ.encode=function(e){return{key:ao.from([hJ.InputTypes.FINAL_SCRIPTWITNESS]),value:e}},cJ.expected="Buffer",cJ.check=function(e){return jo(e)},cJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptWitness};var dJ={};Object.defineProperty(dJ,"__esModule",{value:!0});const fJ=iJ;dJ.decode=function(e){if(e.key[0]!==fJ.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+e.key.toString("hex"));return e.value},dJ.encode=function(e){return{key:ao.from([fJ.InputTypes.NON_WITNESS_UTXO]),value:e}},dJ.expected="Buffer",dJ.check=function(e){return jo(e)},dJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.nonWitnessUtxo};var pJ={};Object.defineProperty(pJ,"__esModule",{value:!0});const gJ=iJ;pJ.decode=function(e){if(e.key[0]!==gJ.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+e.key.toString("hex"));if(34!==e.key.length&&66!==e.key.length||![2,3,4].includes(e.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1),signature:e.value}},pJ.encode=function(e){const t=ao.from([gJ.InputTypes.PARTIAL_SIG]);return{key:ao.concat([t,e.pubkey]),value:e.signature}},pJ.expected="{ pubkey: Buffer; signature: Buffer; }",pJ.check=function(e){return jo(e.pubkey)&&jo(e.signature)&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&function(e){if(!jo(e)||e.length<9)return!1;if(48!==e[0])return!1;if(e.length!==e[1]+3)return!1;if(2!==e[2])return!1;const t=e[3];if(t>33||t<1)return!1;if(2!==e[3+t+1])return!1;const n=e[3+t+2];return!(n>33||n<1)&&e.length===3+t+2+n+2}(e.signature)},pJ.canAddToArray=function(e,t,n){const r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)};var yJ={};Object.defineProperty(yJ,"__esModule",{value:!0});const mJ=iJ;yJ.decode=function(e){if(e.key[0]!==mJ.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+e.key.toString("hex"));return e.value.toString("utf8")},yJ.encode=function(e){return{key:ao.from([mJ.InputTypes.POR_COMMITMENT]),value:ao.from(e,"utf8")}},yJ.expected="string",yJ.check=function(e){return"string"==typeof e},yJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.porCommitment};var vJ={};Object.defineProperty(vJ,"__esModule",{value:!0});const wJ=iJ;vJ.decode=function(e){if(e.key[0]!==wJ.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+e.key.toString("hex"));return e.value.readUInt32LE(0)},vJ.encode=function(e){const t=ao.from([wJ.InputTypes.SIGHASH_TYPE]),n=ao.allocUnsafe(4);return n.writeUInt32LE(e,0),{key:t,value:n}},vJ.expected="number",vJ.check=function(e){return"number"==typeof e},vJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.sighashType};var IJ={};Object.defineProperty(IJ,"__esModule",{value:!0});const bJ=iJ;function BJ(e){return jo(e)&&(64===e.length||65===e.length)}IJ.decode=function(e){if(e.key[0]!==bJ.InputTypes.TAP_KEY_SIG||1!==e.key.length)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+e.key.toString("hex"));if(!BJ(e.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return e.value},IJ.encode=function(e){return{key:ao.from([bJ.InputTypes.TAP_KEY_SIG]),value:e}},IJ.expected="Buffer",IJ.check=BJ,IJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapKeySig};var EJ={};Object.defineProperty(EJ,"__esModule",{value:!0});const CJ=iJ;EJ.decode=function(e){if(e.key[0]!==CJ.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+e.key.toString("hex"));if((e.key.length-2)%32!=0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+e.key.toString("hex"));const t=e.value[e.value.length-1];if((254&e.key[1])!==t)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+e.key.toString("hex"));const n=e.value.slice(0,-1);return{controlBlock:e.key.slice(1),script:n,leafVersion:t}},EJ.encode=function(e){const t=ao.from([CJ.InputTypes.TAP_LEAF_SCRIPT]),n=ao.from([e.leafVersion]);return{key:ao.concat([t,e.controlBlock]),value:ao.concat([e.script,n])}},EJ.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }",EJ.check=function(e){return jo(e.controlBlock)&&(e.controlBlock.length-1)%32==0&&(254&e.controlBlock[0])===e.leafVersion&&jo(e.script)},EJ.canAddToArray=function(e,t,n){const r=t.controlBlock.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.controlBlock.equals(t.controlBlock))).length)};var xJ={};Object.defineProperty(xJ,"__esModule",{value:!0});const SJ=iJ;function QJ(e){return jo(e)&&32===e.length}xJ.decode=function(e){if(e.key[0]!==SJ.InputTypes.TAP_MERKLE_ROOT||1!==e.key.length)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+e.key.toString("hex"));if(!QJ(e.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return e.value},xJ.encode=function(e){return{key:ao.from([SJ.InputTypes.TAP_MERKLE_ROOT]),value:e}},xJ.expected="Buffer",xJ.check=QJ,xJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapMerkleRoot};var kJ={};Object.defineProperty(kJ,"__esModule",{value:!0});const _J=iJ;kJ.decode=function(e){if(e.key[0]!==_J.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+e.key.toString("hex"));if(65!==e.key.length)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+e.key.toString("hex"));if(64!==e.value.length&&65!==e.value.length)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1,33),leafHash:e.key.slice(33),signature:e.value}},kJ.encode=function(e){const t=ao.from([_J.InputTypes.TAP_SCRIPT_SIG]);return{key:ao.concat([t,e.pubkey,e.leafHash]),value:e.signature}},kJ.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }",kJ.check=function(e){return jo(e.pubkey)&&jo(e.leafHash)&&jo(e.signature)&&32===e.pubkey.length&&32===e.leafHash.length&&(64===e.signature.length||65===e.signature.length)},kJ.canAddToArray=function(e,t,n){const r=t.pubkey.toString("hex")+t.leafHash.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey)&&e.leafHash.equals(t.leafHash))).length)};var NJ={},DJ={},FJ={};function UJ(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function PJ(e){return UJ(e),e<253?1:e<=65535?3:e<=4294967295?5:9}Object.defineProperty(FJ,"__esModule",{value:!0}),FJ.encode=function e(t,n,r){if(UJ(t),n||(n=ao.allocUnsafe(PJ(t))),!jo(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),Object.assign(e,{bytes:1})):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),Object.assign(e,{bytes:3})):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),Object.assign(e,{bytes:5})):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),Object.assign(e,{bytes:9})),n},FJ.decode=function e(t,n){if(!jo(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);const r=t.readUInt8(n);if(r<253)return Object.assign(e,{bytes:1}),r;if(253===r)return Object.assign(e,{bytes:3}),t.readUInt16LE(n+1);if(254===r)return Object.assign(e,{bytes:5}),t.readUInt32LE(n+1);{Object.assign(e,{bytes:9});const r=t.readUInt32LE(n+1),i=4294967296*t.readUInt32LE(n+5)+r;return UJ(i),i}},FJ.encodingLength=PJ,Object.defineProperty(DJ,"__esModule",{value:!0});const TJ=FJ;function LJ(e){const t=e.key.length,n=e.value.length,r=TJ.encodingLength(t),i=TJ.encodingLength(n),o=ao.allocUnsafe(r+t+i+n);return TJ.encode(t,o,0),e.key.copy(o,r),TJ.encode(n,o,r+t),e.value.copy(o,r+t+i),o}function MJ(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}DJ.range=e=>[...Array(e).keys()],DJ.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,n=0;for(let r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},DJ.keyValsToBuffer=function(e){const t=e.map(LJ);return t.push(ao.from([0])),ao.concat(t)},DJ.keyValToBuffer=LJ,DJ.readUInt64LE=function(e,t){const n=e.readUInt32LE(t);let r=e.readUInt32LE(t+4);return r*=4294967296,MJ(r+n,9007199254740991),r+n},DJ.writeUInt64LE=function(e,t,n){return MJ(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8},Object.defineProperty(NJ,"__esModule",{value:!0});const RJ=iJ,OJ=DJ,HJ=FJ;NJ.decode=function(e){if(e.key[0]!==RJ.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+e.key.toString("hex"));const t=OJ.readUInt64LE(e.value,0);let n=8;const r=HJ.decode(e.value,n);n+=HJ.encodingLength(r);const i=e.value.slice(n);if(i.length!==r)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:i,value:t}},NJ.encode=function(e){const{script:t,value:n}=e,r=HJ.encodingLength(t.length),i=ao.allocUnsafe(8+r+t.length);return OJ.writeUInt64LE(i,n,0),HJ.encode(t.length,i,8),t.copy(i,8+r),{key:ao.from([RJ.InputTypes.WITNESS_UTXO]),value:i}},NJ.expected="{ script: Buffer; value: number; }",NJ.check=function(e){return jo(e.script)&&"number"==typeof e.value},NJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.witnessUtxo};var KJ={};Object.defineProperty(KJ,"__esModule",{value:!0});const jJ=iJ,GJ=FJ;KJ.decode=function(e){if(e.key[0]!==jJ.OutputTypes.TAP_TREE||1!==e.key.length)throw new Error("Decode Error: could not decode tapTree with key 0x"+e.key.toString("hex"));let t=0;const n=[];for(;t<e.value.length;){const r=e.value[t++],i=e.value[t++],o=GJ.decode(e.value,t);t+=GJ.encodingLength(o),n.push({depth:r,leafVersion:i,script:e.value.slice(t,t+o)}),t+=o}return{leaves:n}},KJ.encode=function(e){const t=ao.from([jJ.OutputTypes.TAP_TREE]),n=[].concat(...e.leaves.map((e=>[ao.of(e.depth,e.leafVersion),GJ.encode(e.script.length),e.script])));return{key:t,value:ao.concat(n)}},KJ.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }",KJ.check=function(e){return Array.isArray(e.leaves)&&e.leaves.every((e=>e.depth>=0&&e.depth<=128&&(254&e.leafVersion)===e.leafVersion&&jo(e.script)))},KJ.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapTree};var qJ={};Object.defineProperty(qJ,"__esModule",{value:!0});const VJ=e=>33===e.length&&[2,3].includes(e[0])||65===e.length&&4===e[0];qJ.makeConverter=function(e,t=VJ){return{decode:function(n){if(n.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+n.key.toString("hex"));const r=n.key.slice(1);if(!t(r))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+n.key.toString("hex"));if(n.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const i={masterFingerprint:n.value.slice(0,4),pubkey:r,path:"m"};for(const e of(o=n.value.length/4-1,[...Array(o).keys()])){const t=n.value.readUInt32LE(4*e+4),r=!!(2147483648&t),o=2147483647&t;i.path+="/"+o.toString(10)+(r?"'":"")}var o;return i},encode:function(t){const n=ao.from([e]),r=ao.concat([n,t.pubkey]),i=t.path.split("/"),o=ao.allocUnsafe(4*i.length);t.masterFingerprint.copy(o,0);let a=4;return i.slice(1).forEach((e=>{const t="'"===e.slice(-1);let n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),o.writeUInt32LE(n,a),a+=4})),{key:r,value:o}},check:function(e){return jo(e.pubkey)&&jo(e.masterFingerprint)&&"string"==typeof e.path&&t(e.pubkey)&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(e,t,n){const r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)}}};var zJ={};Object.defineProperty(zJ,"__esModule",{value:!0}),zJ.makeChecker=function(e){return function(t){let n;if(e.includes(t.key[0])&&(n=t.key.slice(1),33!==n.length&&65!==n.length||![2,3,4].includes(n[0])))throw new Error("Format Error: invalid pubkey in key 0x"+t.key.toString("hex"));return n}};var JJ={};Object.defineProperty(JJ,"__esModule",{value:!0}),JJ.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.redeemScript}}};var YJ={};Object.defineProperty(YJ,"__esModule",{value:!0});const XJ=FJ,WJ=qJ,ZJ=e=>32===e.length;YJ.makeConverter=function(e){const t=WJ.makeConverter(e,ZJ);return{decode:function(e){const n=XJ.decode(e.value),r=XJ.encodingLength(n),i=t.decode({key:e.key,value:e.value.slice(r+32*n)}),o=new Array(n);for(let t=0,i=r;t<n;t++,i+=32)o[t]=e.value.slice(i,i+32);return Object.assign({},i,{leafHashes:o})},encode:function(e){const n=t.encode(e),r=XJ.encodingLength(e.leafHashes.length),i=ao.allocUnsafe(r);XJ.encode(e.leafHashes.length,i);const o=ao.concat([i,...e.leafHashes,n.value]);return Object.assign({},n,{value:o})},check:function(e){return Array.isArray(e.leafHashes)&&e.leafHashes.every((e=>jo(e)&&32===e.length))&&t.check(e)},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; leafHashes: Buffer[]; }",canAddToArray:t.canAddToArray}};var $J={};Object.defineProperty($J,"__esModule",{value:!0}),$J.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e||1!==t.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+t.key.toString("hex"));if(32!==t.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)&&32===e.length},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.tapInternalKey}}};var eY={};Object.defineProperty(eY,"__esModule",{value:!0}),eY.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:ao.from([e]),value:t}},check:function(e){return jo(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.witnessScript}}},Object.defineProperty(rJ,"__esModule",{value:!0});const tY=iJ,nY=uJ,rY=cJ,iY=dJ,oY=pJ,aY=yJ,sY=vJ,lY=IJ,uY=EJ,AY=xJ,cY=kJ,hY=NJ,dY=KJ,fY=qJ,pY=zJ,gY=JJ,yY=YJ,mY=$J,vY=eY,wY={unsignedTx:sJ,globalXpub:oJ,checkPubkey:pY.makeChecker([])};rJ.globals=wY;const IY={nonWitnessUtxo:iY,partialSig:oY,sighashType:sY,finalScriptSig:nY,finalScriptWitness:rY,porCommitment:aY,witnessUtxo:hY,bip32Derivation:fY.makeConverter(tY.InputTypes.BIP32_DERIVATION),redeemScript:gY.makeConverter(tY.InputTypes.REDEEM_SCRIPT),witnessScript:vY.makeConverter(tY.InputTypes.WITNESS_SCRIPT),checkPubkey:pY.makeChecker([tY.InputTypes.PARTIAL_SIG,tY.InputTypes.BIP32_DERIVATION]),tapKeySig:lY,tapScriptSig:cY,tapLeafScript:uY,tapBip32Derivation:yY.makeConverter(tY.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:mY.makeConverter(tY.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot:AY};rJ.inputs=IY;const bY={bip32Derivation:fY.makeConverter(tY.OutputTypes.BIP32_DERIVATION),redeemScript:gY.makeConverter(tY.OutputTypes.REDEEM_SCRIPT),witnessScript:vY.makeConverter(tY.OutputTypes.WITNESS_SCRIPT),checkPubkey:pY.makeChecker([tY.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:yY.makeConverter(tY.OutputTypes.TAP_BIP32_DERIVATION),tapTree:dY,tapInternalKey:mY.makeConverter(tY.OutputTypes.TAP_INTERNAL_KEY)};rJ.outputs=bY,Object.defineProperty(nJ,"__esModule",{value:!0});const BY=rJ,EY=DJ,CY=FJ,xY=iJ;function SY(e,t,n){if(!t.equals(ao.from([n])))throw new Error(`Format Error: Invalid ${e} key: ${t.toString("hex")}`)}function QY(e,{globalMapKeyVals:t,inputKeyVals:n,outputKeyVals:r}){const i={unsignedTx:e};let o=0;for(const e of t)switch(e.key[0]){case xY.GlobalTypes.UNSIGNED_TX:if(SY("global",e.key,xY.GlobalTypes.UNSIGNED_TX),o>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");o++;break;case xY.GlobalTypes.GLOBAL_XPUB:void 0===i.globalXpub&&(i.globalXpub=[]),i.globalXpub.push(BY.globals.globalXpub.decode(e));break;default:i.unknownKeyVals||(i.unknownKeyVals=[]),i.unknownKeyVals.push(e)}const a=n.length,s=r.length,l=[],u=[];for(const e of EY.range(a)){const t={};for(const r of n[e])switch(BY.inputs.checkPubkey(r),r.key[0]){case xY.InputTypes.NON_WITNESS_UTXO:if(SY("input",r.key,xY.InputTypes.NON_WITNESS_UTXO),void 0!==t.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");t.nonWitnessUtxo=BY.inputs.nonWitnessUtxo.decode(r);break;case xY.InputTypes.WITNESS_UTXO:if(SY("input",r.key,xY.InputTypes.WITNESS_UTXO),void 0!==t.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");t.witnessUtxo=BY.inputs.witnessUtxo.decode(r);break;case xY.InputTypes.PARTIAL_SIG:void 0===t.partialSig&&(t.partialSig=[]),t.partialSig.push(BY.inputs.partialSig.decode(r));break;case xY.InputTypes.SIGHASH_TYPE:if(SY("input",r.key,xY.InputTypes.SIGHASH_TYPE),void 0!==t.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");t.sighashType=BY.inputs.sighashType.decode(r);break;case xY.InputTypes.REDEEM_SCRIPT:if(SY("input",r.key,xY.InputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");t.redeemScript=BY.inputs.redeemScript.decode(r);break;case xY.InputTypes.WITNESS_SCRIPT:if(SY("input",r.key,xY.InputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");t.witnessScript=BY.inputs.witnessScript.decode(r);break;case xY.InputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(BY.inputs.bip32Derivation.decode(r));break;case xY.InputTypes.FINAL_SCRIPTSIG:SY("input",r.key,xY.InputTypes.FINAL_SCRIPTSIG),t.finalScriptSig=BY.inputs.finalScriptSig.decode(r);break;case xY.InputTypes.FINAL_SCRIPTWITNESS:SY("input",r.key,xY.InputTypes.FINAL_SCRIPTWITNESS),t.finalScriptWitness=BY.inputs.finalScriptWitness.decode(r);break;case xY.InputTypes.POR_COMMITMENT:SY("input",r.key,xY.InputTypes.POR_COMMITMENT),t.porCommitment=BY.inputs.porCommitment.decode(r);break;case xY.InputTypes.TAP_KEY_SIG:SY("input",r.key,xY.InputTypes.TAP_KEY_SIG),t.tapKeySig=BY.inputs.tapKeySig.decode(r);break;case xY.InputTypes.TAP_SCRIPT_SIG:void 0===t.tapScriptSig&&(t.tapScriptSig=[]),t.tapScriptSig.push(BY.inputs.tapScriptSig.decode(r));break;case xY.InputTypes.TAP_LEAF_SCRIPT:void 0===t.tapLeafScript&&(t.tapLeafScript=[]),t.tapLeafScript.push(BY.inputs.tapLeafScript.decode(r));break;case xY.InputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(BY.inputs.tapBip32Derivation.decode(r));break;case xY.InputTypes.TAP_INTERNAL_KEY:SY("input",r.key,xY.InputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=BY.inputs.tapInternalKey.decode(r);break;case xY.InputTypes.TAP_MERKLE_ROOT:SY("input",r.key,xY.InputTypes.TAP_MERKLE_ROOT),t.tapMerkleRoot=BY.inputs.tapMerkleRoot.decode(r);break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(r)}l.push(t)}for(const e of EY.range(s)){const t={};for(const n of r[e])switch(BY.outputs.checkPubkey(n),n.key[0]){case xY.OutputTypes.REDEEM_SCRIPT:if(SY("output",n.key,xY.OutputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");t.redeemScript=BY.outputs.redeemScript.decode(n);break;case xY.OutputTypes.WITNESS_SCRIPT:if(SY("output",n.key,xY.OutputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");t.witnessScript=BY.outputs.witnessScript.decode(n);break;case xY.OutputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(BY.outputs.bip32Derivation.decode(n));break;case xY.OutputTypes.TAP_INTERNAL_KEY:SY("output",n.key,xY.OutputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=BY.outputs.tapInternalKey.decode(n);break;case xY.OutputTypes.TAP_TREE:SY("output",n.key,xY.OutputTypes.TAP_TREE),t.tapTree=BY.outputs.tapTree.decode(n);break;case xY.OutputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(BY.outputs.tapBip32Derivation.decode(n));break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(n)}u.push(t)}return{globalMap:i,inputs:l,outputs:u}}nJ.psbtFromBuffer=function(e,t){let n=0;function r(){const t=CY.decode(e,n);n+=CY.encodingLength(t);const r=e.slice(n,n+t);return n+=t,r}function i(){return{key:r(),value:r()}}function o(){if(n>=e.length)throw new Error("Format Error: Unexpected End of PSBT");const t=0===e.readUInt8(n);return t&&n++,t}if(1886610036!==function(){const t=e.readUInt32BE(n);return n+=4,t}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const t=e.readUInt8(n);return n+=1,t}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const a=[],s={};for(;!o();){const e=i(),t=e.key.toString("hex");if(s[t])throw new Error("Format Error: Keys must be unique for global keymap: key "+t);s[t]=1,a.push(e)}const l=a.filter((e=>e.key[0]===xY.GlobalTypes.UNSIGNED_TX));if(1!==l.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const u=t(l[0].value),{inputCount:A,outputCount:c}=u.getInputOutputCounts(),h=[],d=[];for(const e of EY.range(A)){const t={},n=[];for(;!o();){const r=i(),o=r.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each input: input index "+e+" key "+o);t[o]=1,n.push(r)}h.push(n)}for(const e of EY.range(c)){const t={},n=[];for(;!o();){const r=i(),o=r.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each output: output index "+e+" key "+o);t[o]=1,n.push(r)}d.push(n)}return QY(u,{globalMapKeyVals:a,inputKeyVals:h,outputKeyVals:d})},nJ.checkKeyBuffer=SY,nJ.psbtFromKeyVals=QY;var kY={};Object.defineProperty(kY,"__esModule",{value:!0});const _Y=rJ,NY=DJ;kY.psbtToBuffer=function({globalMap:e,inputs:t,outputs:n}){const{globalKeyVals:r,inputKeyVals:i,outputKeyVals:o}=UY({globalMap:e,inputs:t,outputs:n}),a=NY.keyValsToBuffer(r),s=e=>0===e.length?[ao.from([0])]:e.map(NY.keyValsToBuffer),l=s(i),u=s(o),A=ao.allocUnsafe(5);return A.writeUIntBE(482972169471,0,5),ao.concat([A,a].concat(l,u))};const DY=(e,t)=>e.key.compare(t.key);function FY(e,t){const n=new Set,r=Object.entries(e).reduce(((e,[r,i])=>{if("unknownKeyVals"===r)return e;const o=t[r];if(void 0===o)return e;const a=(Array.isArray(i)?i:[i]).map(o.encode);return a.map((e=>e.key.toString("hex"))).forEach((e=>{if(n.has(e))throw new Error("Serialize Error: Duplicate key: "+e);n.add(e)})),e.concat(a)}),[]),i=e.unknownKeyVals?e.unknownKeyVals.filter((e=>!n.has(e.key.toString("hex")))):[];return r.concat(i).sort(DY)}function UY({globalMap:e,inputs:t,outputs:n}){return{globalKeyVals:FY(e,_Y.globals),inputKeyVals:t.map((e=>FY(e,_Y.inputs))),outputKeyVals:n.map((e=>FY(e,_Y.outputs)))}}kY.psbtToKeyVals=UY,function(e){function t(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),t(nJ),t(kY)}(tJ),Object.defineProperty(eJ,"__esModule",{value:!0});const PY=tJ;function TY(e,t,n){return r=>{if(e.has(r))return;const i=n.filter((e=>e.key.toString("hex")===r))[0];t.push(i),e.add(r)}}function LY(e){return e.globalMap.unsignedTx}function MY(e){const t=new Set;return e.forEach((e=>{const n=e.key.toString("hex");if(t.has(n))throw new Error("Combine: KeyValue Map keys should be unique");t.add(n)})),t}eJ.combine=function(e){const t=e[0],n=PY.psbtToKeyVals(t),r=e.slice(1);if(0===r.length)throw new Error("Combine: Nothing to combine");const i=LY(t);if(void 0===i)throw new Error("Combine: Self missing transaction");const o=MY(n.globalKeyVals),a=n.inputKeyVals.map(MY),s=n.outputKeyVals.map(MY);for(const e of r){const t=LY(e);if(void 0===t||!t.toBuffer().equals(i.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const r=PY.psbtToKeyVals(e);MY(r.globalKeyVals).forEach(TY(o,n.globalKeyVals,r.globalKeyVals)),r.inputKeyVals.map(MY).forEach(((e,t)=>e.forEach(TY(a[t],n.inputKeyVals[t],r.inputKeyVals[t])))),r.outputKeyVals.map(MY).forEach(((e,t)=>e.forEach(TY(s[t],n.outputKeyVals[t],r.outputKeyVals[t]))))}return PY.psbtFromKeyVals(i,{globalMapKeyVals:n.globalKeyVals,inputKeyVals:n.inputKeyVals,outputKeyVals:n.outputKeyVals})};var RY={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=rJ;function n(e,t){const n=e[t];if(void 0===n)throw new Error(`No input #${t}`);return n}function r(e,t){const n=e[t];if(void 0===n)throw new Error(`No output #${t}`);return n}function i(e,t,n,r){throw new Error(`Data for ${e} key ${t} is incorrect: Expected ${n} and got ${JSON.stringify(r)}`)}function o(e){return(n,r)=>{for(const o of Object.keys(n)){const a=n[o],{canAdd:s,canAddToArray:l,check:u,expected:A}=t[e+"s"][o]||{},c=!!l;if(u)if(c){if(!Array.isArray(a)||r[o]&&!Array.isArray(r[o]))throw new Error(`Key type ${o} must be an array`);a.every(u)||i(e,o,A,a);const t=r[o]||[],n=new Set;if(!a.every((e=>l(t,e,n))))throw new Error("Can not add duplicate data to array");r[o]=t.concat(a)}else{if(u(a)||i(e,o,A,a),!s(r,a))throw new Error(`Can not add duplicate data to ${e}`);r[o]=a}}}}e.checkForInput=n,e.checkForOutput=r,e.checkHasKey=function(e,t,n){if(e.key[0]<n)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(t&&0!==t.filter((t=>t.key.equals(e.key))).length)throw new Error(`Duplicate Key: ${e.key.toString("hex")}`)},e.getEnumLength=function(e){let t=0;return Object.keys(e).forEach((e=>{Number(isNaN(Number(e)))&&t++})),t},e.inputCheckUncleanFinalized=function(e,t){let n=!1;if(t.nonWitnessUtxo||t.witnessUtxo){const e=!!t.redeemScript,r=!!t.witnessScript,i=!e||!!t.finalScriptSig,o=!r||!!t.finalScriptWitness,a=!!t.finalScriptSig||!!t.finalScriptWitness;n=i&&o&&a}if(!1===n)throw new Error(`Input #${e} has too much or too little data to clean`)},e.updateGlobal=o("global"),e.updateInput=o("input"),e.updateOutput=o("output"),e.addInputAttributes=function(t,r){const i=n(t,t.length-1);e.updateInput(r,i)},e.addOutputAttributes=function(t,n){const i=r(t,t.length-1);e.updateOutput(n,i)},e.defaultVersionSetter=function(e,t){if(!jo(t)||t.length<4)throw new Error("Set Version: Invalid Transaction");return t.writeUInt32LE(e,0),t},e.defaultLocktimeSetter=function(e,t){if(!jo(t)||t.length<4)throw new Error("Set Locktime: Invalid Transaction");return t.writeUInt32LE(e,t.length-4),t}}(RY),Object.defineProperty($z,"__esModule",{value:!0});const OY=eJ,HY=tJ,KY=iJ,jY=RY;$z.Psbt=class{constructor(e){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:e}}static fromBase64(e,t){const n=ao.from(e,"base64");return this.fromBuffer(n,t)}static fromHex(e,t){const n=ao.from(e,"hex");return this.fromBuffer(n,t)}static fromBuffer(e,t){const n=HY.psbtFromBuffer(e,t),r=new this(n.globalMap.unsignedTx);return Object.assign(r,n),r}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return HY.psbtToBuffer(this)}updateGlobal(e){return jY.updateGlobal(e,this.globalMap),this}updateInput(e,t){const n=jY.checkForInput(this.inputs,e);return jY.updateInput(t,n),this}updateOutput(e,t){const n=jY.checkForOutput(this.outputs,e);return jY.updateOutput(t,n),this}addUnknownKeyValToGlobal(e){return jY.checkHasKey(e,this.globalMap.unknownKeyVals,jY.getEnumLength(KY.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(e),this}addUnknownKeyValToInput(e,t){const n=jY.checkForInput(this.inputs,e);return jY.checkHasKey(t,n.unknownKeyVals,jY.getEnumLength(KY.InputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}addUnknownKeyValToOutput(e,t){const n=jY.checkForOutput(this.outputs,e);return jY.checkHasKey(t,n.unknownKeyVals,jY.getEnumLength(KY.OutputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}addInput(e){this.globalMap.unsignedTx.addInput(e),this.inputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],n=this.inputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(n,e))),jY.addInputAttributes(this.inputs,e),this}addOutput(e){this.globalMap.unsignedTx.addOutput(e),this.outputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],n=this.outputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(n,e))),jY.addOutputAttributes(this.outputs,e),this}clearFinalizedInput(e){const t=jY.checkForInput(this.inputs,e);jY.inputCheckUncleanFinalized(e,t);for(const e of Object.keys(t))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(e)||delete t[e];return this}combine(...e){const t=OY.combine([this].concat(e));return Object.assign(this,t),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}},Object.defineProperty(Zz,"__esModule",{value:!0}),Zz.Psbt=void 0;const GY=$z,qY=FJ,VY=RY,zY=NG,JY=fz,YY=nV,XY=FG,WY=PG,ZY=Sz,$Y={network:DG.bitcoin,maximumFeeRate:5e3};class eX{constructor(e={},t=new GY.Psbt(new nX)){this.data=t,this.opts=Object.assign({},$Y,e),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const n=(e,t,n,r)=>Object.defineProperty(e,t,{enumerable:n,writable:r});n(this,"__CACHE",!1,!0),n(this,"opts",!1,!0)}static fromBase64(e,t={}){const n=ao.from(e,"base64");return this.fromBuffer(n,t)}static fromHex(e,t={}){const n=ao.from(e,"hex");return this.fromBuffer(n,t)}static fromBuffer(e,t={}){const n=GY.Psbt.fromBuffer(e,tX),r=new eX(t,n);return function(e,t){e.ins.forEach((e=>{gX(t,e)}))}(r.__CACHE.__TX,r.__CACHE),r}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(e){this.setVersion(e)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(e){this.setLocktime(e)}get txInputs(){return this.__CACHE.__TX.ins.map((e=>({hash:(0,JY.cloneBuffer)(e.hash),index:e.index,sequence:e.sequence})))}get txOutputs(){return this.__CACHE.__TX.outs.map((e=>{let t;try{t=(0,zY.fromOutputScript)(e.script,this.opts.network)}catch(e){}return{script:(0,JY.cloneBuffer)(e.script),value:e.value,address:t}}))}combine(...e){return this.data.combine(...e.map((e=>e.data))),this}clone(){const e=eX.fromBuffer(this.data.toBuffer());return e.opts=JSON.parse(JSON.stringify(this.opts)),e}setMaximumFeeRate(e){dX(e),this.opts.maximumFeeRate=e}setVersion(e){dX(e),fX(this.data.inputs,"setVersion");const t=this.__CACHE;return t.__TX.version=e,t.__EXTRACTED_TX=void 0,this}setLocktime(e){dX(e),fX(this.data.inputs,"setLocktime");const t=this.__CACHE;return t.__TX.locktime=e,t.__EXTRACTED_TX=void 0,this}setInputSequence(e,t){dX(t),fX(this.data.inputs,"setInputSequence");const n=this.__CACHE;if(n.__TX.ins.length<=e)throw new Error("Input index too high");return n.__TX.ins[e].sequence=t,n.__EXTRACTED_TX=void 0,this}addInputs(e){return e.forEach((e=>this.addInput(e))),this}addInput(e){if(arguments.length>1||!e||void 0===e.hash||void 0===e.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");fX(this.data.inputs,"addInput"),e.witnessScript&&DX(e.witnessScript);const t=this.__CACHE;this.data.addInput(e),gX(t,t.__TX.ins[t.__TX.ins.length-1]);const n=this.data.inputs.length-1,r=this.data.inputs[n];return r.nonWitnessUtxo&&xX(this.__CACHE,r,n),t.__FEE=void 0,t.__FEE_RATE=void 0,t.__EXTRACTED_TX=void 0,this}addOutputs(e){return e.forEach((e=>this.addOutput(e))),this}addOutput(e){if(arguments.length>1||!e||void 0===e.value||void 0===e.address&&void 0===e.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");fX(this.data.inputs,"addOutput");const{address:t}=e;if("string"==typeof t){const{network:n}=this.opts,r=(0,zY.toOutputScript)(t,n);e=Object.assign(e,{script:r})}const n=this.__CACHE;return this.data.addOutput(e),n.__FEE=void 0,n.__FEE_RATE=void 0,n.__EXTRACTED_TX=void 0,this}extractTransaction(e){if(!this.data.inputs.every(iX))throw new Error("Not finalized");const t=this.__CACHE;if(e||function(e,t,n){const r=t.__FEE_RATE||e.getFeeRate(),i=t.__EXTRACTED_TX.virtualSize(),o=r*i;if(r>=n.maximumFeeRate)throw new Error(`Warning: You are paying around ${(o/1e8).toFixed(8)} in fees, which is ${r} satoshi per byte for a transaction with a VSize of ${i} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}(this,t,this.opts),t.__EXTRACTED_TX)return t.__EXTRACTED_TX;const n=t.__TX.clone();return SX(this.data.inputs,n,t,!0),n}getFeeRate(){return wX("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return wX("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return(0,VY.checkForInput)(this.data.inputs,0),PX(this.data.inputs.length).forEach((e=>this.finalizeInput(e))),this}finalizeInput(e,t=IX){const n=(0,VY.checkForInput)(this.data.inputs,e),{script:r,isP2SH:i,isP2WSH:o,isSegwit:a}=function(e,t,n){const r=n.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!t.redeemScript,i.isP2WSH=!!t.witnessScript,t.witnessScript)i.script=t.witnessScript;else if(t.redeemScript)i.script=t.redeemScript;else if(t.nonWitnessUtxo){const o=QX(n,t,e),a=r.ins[e].index;i.script=o.outs[a].script}else t.witnessUtxo&&(i.script=t.witnessUtxo.script);return(t.witnessScript||uX(i.script))&&(i.isSegwit=!0),i}(e,n,this.__CACHE);if(!r)throw new Error(`No script found for input #${e}`);!function(e){if(!e.sighashType||!e.partialSig)return;const{partialSig:t,sighashType:n}=e;t.forEach((e=>{const{hashType:t}=WY.signature.decode(e.signature);if(n!==t)throw new Error("Signature sighash does not match input sighash type")}))}(n);const{finalScriptSig:s,finalScriptWitness:l}=t(e,n,r,a,i,o);if(s&&this.data.updateInput(e,{finalScriptSig:s}),l&&this.data.updateInput(e,{finalScriptWitness:l}),!s&&!l)throw new Error(`Unknown error finalizing input #${e}`);return this.data.clearFinalizedInput(e),this}getInputType(e){const t=(0,VY.checkForInput)(this.data.inputs,e),n=NX(kX(e,t,this.__CACHE),e,"input",t.redeemScript||function(e){if(!e)return;const t=WY.decompile(e);if(!t)return;const n=t[t.length-1];var r;if(jo(n)&&!_X(n)&&(r=n,!WY.isCanonicalScriptSignature(r))&&WY.decompile(n))return n}(t.finalScriptSig),t.witnessScript||function(e){if(!e)return;const t=CX(e),n=t[t.length-1];return!_X(n)&&WY.decompile(n)?n:void 0}(t.finalScriptWitness));return("raw"===n.type?"":n.type+"-")+UX(n.meaningfulScript)}inputHasPubkey(e,t){return function(e,t,n,r){const i=kX(n,t,r),{meaningfulScript:o}=NX(i,n,"input",t.redeemScript,t.witnessScript);return FX(e,o)}(t,(0,VY.checkForInput)(this.data.inputs,e),e,this.__CACHE)}inputHasHDKey(e,t){const n=(0,VY.checkForInput)(this.data.inputs,e),r=hX(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}outputHasPubkey(e,t){return function(e,t,n,r){const i=r.__TX.outs[n].script,{meaningfulScript:o}=NX(i,n,"output",t.redeemScript,t.witnessScript);return FX(e,o)}(t,(0,VY.checkForOutput)(this.data.outputs,e),e,this.__CACHE)}outputHasHDKey(e,t){const n=(0,VY.checkForOutput)(this.data.outputs,e),r=hX(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}validateSignaturesOfAllInputs(e){return(0,VY.checkForInput)(this.data.inputs,0),PX(this.data.inputs.length).map((t=>this.validateSignaturesOfInput(t,e))).reduce(((e,t)=>!0===t&&e),!0)}validateSignaturesOfInput(e,t,n){const r=this.data.inputs[e],i=(r||{}).partialSig;if(!r||!i||i.length<1)throw new Error("No signatures to validate");if("function"!=typeof t)throw new Error("Need validator function to validate signatures");const o=n?i.filter((e=>e.pubkey.equals(n))):i;if(o.length<1)throw new Error("No signatures for this pubkey");const a=[];let s,l,u;for(const n of o){const i=WY.signature.decode(n.signature),{hash:o,script:A}=u!==i.hashType?BX(e,Object.assign({},r,{sighashType:i.hashType}),this.__CACHE,!0):{hash:s,script:l};u=i.hashType,s=o,l=A,pX(n.pubkey,A,"verify"),a.push(t(n.pubkey,o,i.signature))}return a.every((e=>!0===e))}signAllInputsHD(e,t=[ZY.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");const n=[];for(const r of PX(this.data.inputs.length))try{this.signInputHD(r,e,t),n.push(!0)}catch(e){n.push(!1)}if(n.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(e,t=[ZY.Transaction.SIGHASH_ALL]){return new Promise(((n,r)=>{if(!e||!e.publicKey||!e.fingerprint)return r(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const n of PX(this.data.inputs.length))o.push(this.signInputHDAsync(n,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return r(new Error("No inputs were signed"));n()}))}))}signInputHD(e,t,n=[ZY.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");return EX(e,this.data.inputs,t).forEach((t=>this.signInput(e,t,n))),this}signInputHDAsync(e,t,n=[ZY.Transaction.SIGHASH_ALL]){return new Promise(((r,i)=>{if(!t||!t.publicKey||!t.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=EX(e,this.data.inputs,t).map((t=>this.signInputAsync(e,t,n)));return Promise.all(o).then((()=>{r()})).catch(i)}))}signAllInputs(e,t=[ZY.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const n=[];for(const r of PX(this.data.inputs.length))try{this.signInput(r,e,t),n.push(!0)}catch(e){n.push(!1)}if(n.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsAsync(e,t=[ZY.Transaction.SIGHASH_ALL]){return new Promise(((n,r)=>{if(!e||!e.publicKey)return r(new Error("Need Signer to sign input"));const i=[],o=[];for(const[n]of this.data.inputs.entries())o.push(this.signInputAsync(n,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return r(new Error("No inputs were signed"));n()}))}))}signInput(e,t,n=[ZY.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const{hash:r,sighashType:i}=bX(this.data.inputs,e,t.publicKey,this.__CACHE,n),o=[{pubkey:t.publicKey,signature:WY.signature.encode(t.sign(r),i)}];return this.data.updateInput(e,{partialSig:o}),this}signInputAsync(e,t,n=[ZY.Transaction.SIGHASH_ALL]){return Promise.resolve().then((()=>{if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const{hash:r,sighashType:i}=bX(this.data.inputs,e,t.publicKey,this.__CACHE,n);return Promise.resolve(t.sign(r)).then((n=>{const r=[{pubkey:t.publicKey,signature:WY.signature.encode(n,i)}];this.data.updateInput(e,{partialSig:r})}))}))}toBuffer(){return rX(this.__CACHE),this.data.toBuffer()}toHex(){return rX(this.__CACHE),this.data.toHex()}toBase64(){return rX(this.__CACHE),this.data.toBase64()}updateGlobal(e){return this.data.updateGlobal(e),this}updateInput(e,t){return t.witnessScript&&DX(t.witnessScript),this.data.updateInput(e,t),t.nonWitnessUtxo&&xX(this.__CACHE,this.data.inputs[e],e),this}updateOutput(e,t){return this.data.updateOutput(e,t),this}addUnknownKeyValToGlobal(e){return this.data.addUnknownKeyValToGlobal(e),this}addUnknownKeyValToInput(e,t){return this.data.addUnknownKeyValToInput(e,t),this}addUnknownKeyValToOutput(e,t){return this.data.addUnknownKeyValToOutput(e,t),this}clearFinalizedInput(e){return this.data.clearFinalizedInput(e),this}}Zz.Psbt=eX;const tX=e=>new nX(e);class nX{constructor(e=ao.from([2,0,0,0,0,0,0,0,0,0])){this.tx=ZY.Transaction.fromBuffer(e),function(e){if(!e.ins.every((e=>e.script&&0===e.script.length&&e.witness&&0===e.witness.length)))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(e){if(void 0===e.hash||void 0===e.index||!jo(e.hash)&&"string"!=typeof e.hash||"number"!=typeof e.index)throw new Error("Error adding input.");const t="string"==typeof e.hash?(0,JY.reverseBuffer)(ao.from(e.hash,"hex")):e.hash;this.tx.addInput(t,e.index,e.sequence)}addOutput(e){if(void 0===e.script||void 0===e.value||!jo(e.script)||"number"!=typeof e.value)throw new Error("Error adding output.");this.tx.addOutput(e.script,e.value)}toBuffer(){return this.tx.toBuffer()}}function rX(e){if(!1!==e.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function iX(e){return!!e.finalScriptSig||!!e.finalScriptWitness}function oX(e){return t=>{try{return e({output:t}),!0}catch(e){return!1}}}const aX=oX(XY.p2ms),sX=oX(XY.p2pk),lX=oX(XY.p2pkh),uX=oX(XY.p2wpkh),AX=oX(XY.p2wsh),cX=oX(XY.p2sh);function hX(e){return t=>!!t.masterFingerprint.equals(e.fingerprint)&&!!e.derivePath(t.path).publicKey.equals(t.pubkey)}function dX(e){if("number"!=typeof e||e!==Math.floor(e)||e>4294967295||e<0)throw new Error("Invalid 32 bit integer")}function fX(e,t){e.forEach((e=>{let n=!1,r=[];if(0===(e.partialSig||[]).length){if(!e.finalScriptSig&&!e.finalScriptWitness)return;r=function(e){const t=e.finalScriptSig&&WY.decompile(e.finalScriptSig)||[],n=e.finalScriptWitness&&WY.decompile(e.finalScriptWitness)||[];return t.concat(n).filter((e=>jo(e)&&WY.isCanonicalScriptSignature(e))).map((e=>({signature:e})))}(e)}else r=e.partialSig;if(r.forEach((e=>{const{hashType:r}=WY.signature.decode(e.signature),i=[];switch(r&ZY.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&r){case ZY.Transaction.SIGHASH_ALL:break;case ZY.Transaction.SIGHASH_SINGLE:case ZY.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}-1===i.indexOf(t)&&(n=!0)})),n)throw new Error("Can not modify transaction, signatures exist.")}))}function pX(e,t,n){if(!FX(e,t))throw new Error(`Can not ${n} for this input with the key ${e.toString("hex")}`)}function gX(e,t){const n=(0,JY.reverseBuffer)(ao.from(t.hash)).toString("hex")+":"+t.index;if(e.__TX_IN_CACHE[n])throw new Error("Duplicate input detected.");e.__TX_IN_CACHE[n]=1}function yX(e,t){return(n,r,i,o)=>{const a=e({redeem:{output:i}}).output;if(!r.equals(a))throw new Error(`${t} for ${o} #${n} doesn't match the scriptPubKey in the prevout`)}}const mX=yX(XY.p2sh,"Redeem script"),vX=yX(XY.p2wsh,"Witness script");function wX(e,t,n,r){if(!n.every(iX))throw new Error(`PSBT must be finalized to calculate ${t}`);if("__FEE_RATE"===e&&r.__FEE_RATE)return r.__FEE_RATE;if("__FEE"===e&&r.__FEE)return r.__FEE;let i,o=!0;return r.__EXTRACTED_TX?(i=r.__EXTRACTED_TX,o=!1):i=r.__TX.clone(),SX(n,i,r,o),"__FEE_RATE"===e?r.__FEE_RATE:"__FEE"===e?r.__FEE:void 0}function IX(e,t,n,r,i,o){UX(n);throw new Error(`Can not finalize input #${e}`)}function bX(e,t,n,r,i){const o=(0,VY.checkForInput)(e,t),{hash:a,sighashType:s,script:l}=BX(t,o,r,!1,i);return pX(n,l,"sign"),{hash:a,sighashType:s}}function BX(e,t,n,r,i){const o=n.__TX,a=t.sighashType||ZY.Transaction.SIGHASH_ALL;if(i&&i.indexOf(a)<0){const e=function(e){let t=e&ZY.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&e){case ZY.Transaction.SIGHASH_ALL:t+="SIGHASH_ALL";break;case ZY.Transaction.SIGHASH_SINGLE:t+="SIGHASH_SINGLE";break;case ZY.Transaction.SIGHASH_NONE:t+="SIGHASH_NONE"}return t}(a);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${e}`)}let s,l;if(t.nonWitnessUtxo){const r=QX(n,t,e),i=o.ins[e].hash,a=r.getHash();if(!i.equals(a))throw new Error(`Non-witness UTXO hash for input #${e} doesn't match the hash specified in the prevout`);const s=o.ins[e].index;l=r.outs[s]}else{if(!t.witnessUtxo)throw new Error("Need a Utxo input item for signing");l=t.witnessUtxo}const{meaningfulScript:u,type:A}=NX(l.script,e,"input",t.redeemScript,t.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(A)>=0)s=o.hashForWitnessV0(e,u,l.value,a);else if(uX(u)){const t=XY.p2pkh({hash:u.slice(2)}).output;s=o.hashForWitnessV0(e,t,l.value,a)}else{if(void 0===t.nonWitnessUtxo&&!1===n.__UNSAFE_SIGN_NONSEGWIT)throw new Error(`Input #${e} has witnessUtxo but non-segwit script: ${u.toString("hex")}`);r||!1===n.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as Psbt's predecesor (TransactionBuilder - now removed) when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),s=o.hashForSignature(e,u,a)}return{script:u,sighashType:a,hash:s}}function EX(e,t,n){const r=(0,VY.checkForInput)(t,e);if(!r.bip32Derivation||0===r.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=r.bip32Derivation.map((e=>e.masterFingerprint.equals(n.fingerprint)?e:void 0)).filter((e=>!!e));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");const o=i.map((e=>{const t=n.derivePath(e.path);if(!e.pubkey.equals(t.publicKey))throw new Error("pubkey did not match bip32Derivation");return t}));return o}function CX(e){let t=0;function n(){const n=qY.decode(e,t);return t+=qY.decode.bytes,n}function r(){return r=n(),t+=r,e.slice(t-r,t);var r}return function(){const e=n(),t=[];for(let n=0;n<e;n++)t.push(r());return t}()}function xX(e,t,n){e.__NON_WITNESS_UTXO_BUF_CACHE[n]=t.nonWitnessUtxo;const r=ZY.Transaction.fromBuffer(t.nonWitnessUtxo);e.__NON_WITNESS_UTXO_TX_CACHE[n]=r;const i=e,o=n;delete t.nonWitnessUtxo,Object.defineProperty(t,"nonWitnessUtxo",{enumerable:!0,get(){const e=i.__NON_WITNESS_UTXO_BUF_CACHE[o],t=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==e)return e;{const e=t.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e,e}},set(e){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e}})}function SX(e,t,n,r){let i=0;e.forEach(((e,o)=>{if(r&&e.finalScriptSig&&(t.ins[o].script=e.finalScriptSig),r&&e.finalScriptWitness&&(t.ins[o].witness=CX(e.finalScriptWitness)),e.witnessUtxo)i+=e.witnessUtxo.value;else if(e.nonWitnessUtxo){const r=QX(n,e,o),a=t.ins[o].index,s=r.outs[a];i+=s.value}}));const o=t.outs.reduce(((e,t)=>e+t.value),0),a=i-o;if(a<0)throw new Error("Outputs are spending more than Inputs");const s=t.virtualSize();n.__FEE=a,n.__EXTRACTED_TX=t,n.__FEE_RATE=Math.floor(a/s)}function QX(e,t,n){const r=e.__NON_WITNESS_UTXO_TX_CACHE;return r[n]||xX(e,t,n),r[n]}function kX(e,t,n){if(void 0!==t.witnessUtxo)return t.witnessUtxo.script;if(void 0!==t.nonWitnessUtxo)return QX(n,t,e).outs[n.__TX.ins[e].index].script;throw new Error("Can't find pubkey in input without Utxo data")}function _X(e){return 33===e.length&&WY.isCanonicalPubKey(e)}function NX(e,t,n,r,i){const o=cX(e),a=o&&r&&AX(r),s=AX(e);if(o&&void 0===r)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((s||a)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let l;return a?(l=i,mX(t,e,r,n),vX(t,r,i,n),DX(l)):s?(l=i,vX(t,e,i,n),DX(l)):o?(l=r,mX(t,e,r,n)):l=e,{meaningfulScript:l,type:a?"p2sh-p2wsh":o?"p2sh":s?"p2wsh":"raw"}}function DX(e){if(uX(e)||cX(e))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function FX(e,t){const n=(0,YY.hash160)(e),r=WY.decompile(t);if(null===r)throw new Error("Unknown script error");return r.some((t=>"number"!=typeof t&&(t.equals(e)||t.equals(n))))}function UX(e){return uX(e)?"witnesspubkeyhash":lX(e)?"pubkeyhash":aX(e)?"multisig":sX(e)?"pubkey":"nonstandard"}function PX(e){return[...Array(e).keys()]}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Transaction=e.opcodes=e.Psbt=e.Block=e.script=e.payments=e.networks=e.crypto=e.address=void 0;const t=NG;e.address=t;const n=nV;e.crypto=n;const r=DG;e.networks=r;const i=FG;e.payments=i;const o=PG;e.script=o;var a=dz;Object.defineProperty(e,"Block",{enumerable:!0,get:function(){return a.Block}});var s=Zz;Object.defineProperty(e,"Psbt",{enumerable:!0,get:function(){return s.Psbt}});var l=LG;Object.defineProperty(e,"opcodes",{enumerable:!0,get:function(){return l.OPS}});var u=Sz;Object.defineProperty(e,"Transaction",{enumerable:!0,get:function(){return u.Transaction}})}(_G);var TX={exports:{}};function LX(e,t){const n=(e=>{const t=(e=>{const t=fR.from(Object.assign(Object.assign({},e),{crv:"K-256"}),"jwk").toString("blk","public"),n=AC.publicKeyConvert(kG.from(t,"hex"),!0);return kG.from(n).toString("hex")})(e);let n=kG.from(t,"hex"),r=32-n.length;for(;r>0;)n=kG.concat([kG.from("00","hex"),n]),r--;return n})(e.publicKeyJwk),r=SG("errors","identityErrorBaseMessage");let i="";switch(t.code){case Ol.Bitcoin:case Ol.Mocknet:case Ol.Testnet:i=function(e,t){return _G.payments.p2pkh({pubkey:e,network:_G.networks[t.code]}).address}(n,t);break;case Ol.Ethmain:case Ol.Ethropst:case Ol.Ethrinkeby:case Ol.Ethgoerli:case Ol.Ethsepolia:i=function(e,t){const n=e.toString("hex"),r=new II.ec("secp256k1").keyFromPublic(n,"hex").getPublic().encode("hex").slice(2),i=ao;return`0x${TX.exports.keccak256(i.from(r,"hex")).slice(24).toString()}`}(n);break;default:throw new EG("deriveIssuingAddressFromPublicKey",`${r} - ${SG("errors","deriveIssuingAddressFromPublicKey")}`)}return i}function MX(e){if(e){const t="string"==typeof e?e:e.code;return!!Object.keys(jl).some((e=>e===t))&&!!jl[t].test}return!1}!function(e){!function(){var t="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof gu&&gu.versions&&gu.versions.node?r=Ki:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&e.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),l=[4,1024,262144,67108864],u=[0,8,16,24],A=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],c=[224,256,384,512],h=[128,256],d=["hex","buffer","arrayBuffer","array","digest"],f={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var p=function(e,t,n){return function(r){return new _(e,t,e).update(r)[n]()}},g=function(e,t,n){return function(r,i){return new _(e,t,i).update(r)[n]()}},y=function(e,t,n){return function(t,r,i,o){return b["cshake"+e].update(t,r,i,o)[n]()}},m=function(e,t,n){return function(t,r,i,o){return b["kmac"+e].update(t,r,i,o)[n]()}},v=function(e,t,n,r){for(var i=0;i<d.length;++i){var o=d[i];e[o]=t(n,r,o)}return e},w=function(e,t){var n=p(e,t,"hex");return n.create=function(){return new _(e,t,e)},n.update=function(e){return n.create().update(e)},v(n,p,e,t)},I=[{name:"keccak",padding:[1,256,65536,16777216],bits:c,createMethod:w},{name:"sha3",padding:[6,1536,393216,100663296],bits:c,createMethod:w},{name:"shake",padding:[31,7936,2031616,520093696],bits:h,createMethod:function(e,t){var n=g(e,t,"hex");return n.create=function(n){return new _(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},v(n,g,e,t)}},{name:"cshake",padding:l,bits:h,createMethod:function(e,t){var n=f[e],r=y(e,0,"hex");return r.create=function(r,i,o){return i||o?new _(e,t,r).bytepad([i,o],n):b["shake"+e].create(r)},r.update=function(e,t,n,i){return r.create(t,n,i).update(e)},v(r,y,e,t)}},{name:"kmac",padding:l,bits:h,createMethod:function(e,t){var n=f[e],r=m(e,0,"hex");return r.create=function(r,i,o){return new N(e,t,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(e,t,n,i){return r.create(e,n,i).update(t)},v(r,m,e,t)}}],b={},B=[],E=0;E<I.length;++E)for(var C=I[E],x=C.bits,S=0;S<x.length;++S){var Q=C.name+"_"+x[S];if(B.push(Q),b[Q]=C.createMethod(x[S],C.padding),"sha3"!==C.name){var k=C.name+x[S];B.push(k),b[k]=b[Q]}}function _(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function N(e,t,n){_.call(this,e,t,n)}_.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var i,o,s=this.blocks,l=this.byteCount,A=e.length,c=this.blockCount,h=0,d=this.s;h<A;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<c+1;++i)s[i]=0;if(n)for(i=this.start;h<A&&i<l;++h)s[i>>2]|=e[h]<<u[3&i++];else for(i=this.start;h<A&&i<l;++h)(o=e.charCodeAt(h))<128?s[i>>2]|=o<<u[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<u[3&i++],s[i>>2]|=(128|o>>6&63)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++h)),s[i>>2]|=(240|o>>18)<<u[3&i++],s[i>>2]|=(128|o>>12&63)<<u[3&i++],s[i>>2]|=(128|o>>6&63)<<u[3&i++],s[i>>2]|=(128|63&o)<<u[3&i++]);if(this.lastByteIndex=i,i>=l){for(this.start=i-l,this.block=s[c],i=0;i<c;++i)d[i]^=s[i];D(d),this.reset=!0}else this.start=i}return this},_.prototype.encode=function(e,t){var n=255&e,r=1,i=[n];for(n=255&(e>>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},_.prototype.encodeString=function(e){var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}var i=0,o=e.length;if(n)i=o;else for(var s=0;s<e.length;++s){var l=e.charCodeAt(s);l<128?i+=1:l<2048?i+=2:l<55296||l>=57344?i+=3:(l=65536+((1023&l)<<10|1023&e.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(e),i},_.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var i=t-n%t,o=[];return o.length=i,this.update(o),this},_.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];D(r)}},_.prototype.toString=_.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,l="";a<r;){for(o=0;o<t&&a<r;++o,++a)e=n[o],l+=s[e>>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t==0&&(D(n),o=0)}return i&&(e=n[o],l+=s[e>>4&15]+s[15&e],i>1&&(l+=s[e>>12&15]+s[e>>8&15]),i>2&&(l+=s[e>>20&15]+s[e>>16&15])),l},_.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var l=new Uint32Array(e);a<r;){for(o=0;o<t&&a<r;++o,++a)l[a]=n[o];a%t==0&&D(n)}return i&&(l[o]=n[o],e=e.slice(0,s)),e},_.prototype.buffer=_.prototype.arrayBuffer,_.prototype.digest=_.prototype.array=function(){this.finalize();for(var e,t,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,l=[];s<i;){for(a=0;a<n&&s<i;++a,++s)e=s<<2,t=r[a],l[e]=255&t,l[e+1]=t>>8&255,l[e+2]=t>>16&255,l[e+3]=t>>24&255;s%n==0&&D(r)}return o&&(e=s<<2,t=r[a],l[e]=255&t,o>1&&(l[e+1]=t>>8&255),o>2&&(l[e+2]=t>>16&255)),l},N.prototype=new _,N.prototype.finalize=function(){return this.encode(this.outputBits,!0),_.prototype.finalize.call(this)};var D=function(e){var t,n,r,i,o,a,s,l,u,c,h,d,f,p,g,y,m,v,w,I,b,B,E,C,x,S,Q,k,_,N,D,F,U,P,T,L,M,R,O,H,K,j,G,q,V,z,J,Y,X,W,Z,$,ee,te,ne,re,ie,oe,ae,se,le,ue,Ae;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],l=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(l<<1|u>>>31),n=o^(u<<1|l>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(c<<1|h>>>31),n=s^(h<<1|c>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=l^(d<<1|f>>>31),n=u^(f<<1|d>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=c^(i<<1|o>>>31),n=h^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,p=e[0],g=e[1],z=e[11]<<4|e[10]>>>28,J=e[10]<<4|e[11]>>>28,k=e[20]<<3|e[21]>>>29,_=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,le=e[30]<<9|e[31]>>>23,j=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,P=e[2]<<1|e[3]>>>31,T=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,m=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,D=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,Ae=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,M=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,W=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,F=e[45]<<29|e[44]>>>3,U=e[44]<<29|e[45]>>>3,C=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,R=e[26]<<25|e[27]>>>7,O=e[27]<<25|e[26]>>>7,I=e[36]<<21|e[37]>>>11,b=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,S=e[18]<<20|e[19]>>>12,Q=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,H=e[38]<<8|e[39]>>>24,K=e[39]<<8|e[38]>>>24,B=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=p^~y&v,e[1]=g^~m&w,e[10]=C^~S&k,e[11]=x^~Q&_,e[20]=P^~L&R,e[21]=T^~M&O,e[30]=q^~z&Y,e[31]=V^~J&X,e[40]=te^~re&oe,e[41]=ne^~ie&ae,e[2]=y^~v&I,e[3]=m^~w&b,e[12]=S^~k&N,e[13]=Q^~_&D,e[22]=L^~R&H,e[23]=M^~O&K,e[32]=z^~Y&W,e[33]=J^~X&Z,e[42]=re^~oe&se,e[43]=ie^~ae&le,e[4]=v^~I&B,e[5]=w^~b&E,e[14]=k^~N&F,e[15]=_^~D&U,e[24]=R^~H&j,e[25]=O^~K&G,e[34]=Y^~W&$,e[35]=X^~Z&ee,e[44]=oe^~se&ue,e[45]=ae^~le&Ae,e[6]=I^~B&p,e[7]=b^~E&g,e[16]=N^~F&C,e[17]=D^~U&x,e[26]=H^~j&P,e[27]=K^~G&T,e[36]=W^~$&q,e[37]=Z^~ee&V,e[46]=se^~ue&te,e[47]=le^~Ae&ne,e[8]=B^~p&y,e[9]=E^~g&m,e[18]=F^~C&S,e[19]=U^~x&Q,e[28]=j^~P&L,e[29]=G^~T&M,e[38]=$^~q&z,e[39]=ee^~V&J,e[48]=ue^~te&re,e[49]=Ae^~ne&ie,e[0]^=A[r],e[1]^=A[r+1]};if(o)e.exports=b;else for(E=0;E<B.length;++E)r[B[E]]=b[B[E]]}()}(TX);var RX=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const{LinkedDataProof:OX}=m_.suites;class HX extends OX{constructor({issuer:e=null,verificationMethod:t=null,document:n=null,proof:r=null,options:i={}}){if(super({type:"MerkleProof2019"}),this.type="MerkleProof2019",this.issuer=null,this.verificationMethod=null,this.proof=null,this.proofValue=null,this.document=null,this.explorerAPIs=[],this.documentLoader=null,this.proofVerificationProcess=["getTransactionId","computeLocalHash","fetchRemoteHash","compareHashes","checkMerkleRoot","checkReceipt"],this.identityVerificationProcess=["deriveIssuingAddressFromPublicKey","compareIssuingAddress"],this.transactionId="",!n)throw new Error("A document signed by MerkleProof2019 is required for the verification process.");this.issuer=e,this.verificationMethod=t,this.document=n,this.setProof(r),this.setOptions(i),this.getChain(),MX(this.chain)&&(this.adaptProofVerificationProcessToMocknet(),this.adaptIdentityVerificationProcessToMocknet())}static decodeMerkleProof2019(e){return new yG(e.proofValue).decode()}setProof(e=null){const t=null!=e?e:this.document.proof;if(!t)throw new Error("The passed document is not signed.");this.proof=t,this.proofValue=HX.decodeMerkleProof2019(this.proof)}verifyProof({documentLoader:e,verifyIdentity:t}={documentLoader:e=>{},verifyIdentity:!0}){return RX(this,void 0,void 0,(function*(){let n;this.documentLoader=e;let r="";try{yield this.verifyProcess(this.proofVerificationProcess),t&&(yield this.verifyIdentity()),n=!0}catch(e){console.error(e),n=!1,r=e.message}return{verificationMethod:this.verificationMethod,verified:n,error:r}}))}verifyIdentity(){return RX(this,void 0,void 0,(function*(){if(null!=this.verificationMethod)try{yield this.verifyProcess(this.identityVerificationProcess)}catch(e){throw new Error(e)}}))}getProofVerificationProcess(){return this.proofVerificationProcess}getIdentityVerificationProcess(){return this.identityVerificationProcess}getIssuerPublicKey(){var e,t;return MX(this.chain)?"This mock chain does not support issuing addresses":null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.issuingAddress)&&void 0!==t?t:""}getIssuanceTime(){var e,t;return null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.time)&&void 0!==t?t:""}getChain(){return this.chain||(this.chain=function(e=null){if(null==e?void 0:e.anchors){const{anchors:t}=e,n=t[0];if("string"==typeof n)return function(e){const t=e.split(":");let n;switch(t[1]){case jl.mocknet.blinkCode:return mG(jl.mocknet.signatureValue);case jl.bitcoin.blinkCode:n=jl.bitcoin.name;break;case jl.ethmain.blinkCode:n=jl.ethmain.name;break;default:throw new Error("Could not retrieve chain.")}const r=t[2],i=n.toLowerCase()+function(e){const t=e.substr(0,1),n=e.substr(1,e.length-1);return t.toUpperCase()+n.toLowerCase()}(r);return mG(i)}(n)}return null}(this.proofValue)),this.chain}getTxData(){return this.txData?this.txData:(console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?"),null)}adaptProofVerificationProcessToMocknet(){vG(this.proofVerificationProcess,"getTransactionId"),vG(this.proofVerificationProcess,"fetchRemoteHash"),vG(this.proofVerificationProcess,"checkMerkleRoot")}adaptIdentityVerificationProcessToMocknet(){this.identityVerificationProcess=[]}setOptions(e){var t;this.explorerAPIs=null!==(t=e.explorerAPIs)&&void 0!==t?t:[],e.executeStepMethod&&"function"==typeof e.executeStepMethod&&(this.executeStep=e.executeStepMethod)}executeStep(e,t,n=""){return RX(this,void 0,void 0,(function*(){return yield t()}))}verifyProcess(e){return RX(this,void 0,void 0,(function*(){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");yield this[t]()}}))}checkMerkleRoot(){return RX(this,void 0,void 0,(function*(){yield this.executeStep("checkMerkleRoot",(()=>function(e,t){if(e!==t)throw new EG("checkMerkleRoot",SG("errors","ensureMerkleRootEqual"));return!0}(this.proofValue.merkleRoot,this.txData.remoteHash)),this.type)}))}compareHashes(){return RX(this,void 0,void 0,(function*(){yield this.executeStep("compareHashes",(()=>function(e,t){if(e!==t)throw new EG("compareHashes",SG("errors","ensureHashesEqual"));return!0}(this.localDocumentHash,this.proofValue.targetHash)),this.type)}))}computeLocalHash(){return RX(this,void 0,void 0,(function*(){this.localDocumentHash=yield this.executeStep("computeLocalHash",(()=>RX(this,void 0,void 0,(function*(){return yield function(e,t=null,n=(e=>{})){return QG(this,void 0,void 0,(function*(){e["@context"].find((e=>{return(t=e)===Object(t)&&"@vocab"in e;var t}))||e["@context"].push({"@vocab":"http://fallback.org/"});const r=JSON.parse(JSON.stringify(e));if(Array.isArray(r.proof)){if(!t)throw new EG("computeLocalHash",SG("errors","noProofSpecified"));const e=r.proof.findIndex((e=>e.proofValue===t.proofValue));r.proof=r.proof.slice(0,e)}else delete r.proof;const i={algorithm:"URDNA2015",format:"application/nquads",documentLoader:function(e){return QG(this,void 0,void 0,(function*(){return null!=n&&(yield n(e)),e in jh?{contextUrl:null,document:jh[e],documentUrl:e}:ov.documentLoader(e)}))}};let o;try{o=yield ov.normalize(r,i)}catch(e){throw console.error(e),new EG("computeLocalHash",SG("errors","failedJsonLdNormalization"))}const a=function(e){const t=e.split("\n"),n=/<http:\/\/fallback\.org\/(.*)>/,r=t.map((e=>n.exec(e))).filter((e=>null!=e));if(r.length>0){const e=r.map((e=>e[1])).sort();return Array.from(new Set(e))}return null}(o);if(a)throw new EG("computeLocalHash",`${SG("errors","foundUnmappedFields")}: ${a.join(", ")}`);return PR(function(e){const t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}(o))}))}(this.document,this.proof,this.documentLoader)}))),this.type)}))}checkReceipt(){return RX(this,void 0,void 0,(function*(){yield this.executeStep("checkReceipt",(()=>function(e){let t=e.targetHash;const n=e.merkleRoot;try{const n=e.path;if(n&&t)for(const e in n){const r=n[e];let i;if(void 0!==r.left)i=BG(`${r.left}${t}`),t=PR(i);else{if(void 0===r.right)throw new EG("checkReceipt","Trigger catch error.");i=BG(`${t}${r.right}`),t=PR(i)}}}catch(e){throw new EG("checkReceipt",SG("errors","ensureValidReceipt"))}if(t!==n)throw new EG("checkReceipt",SG("errors","invalidMerkleReceipt"))}(this.proofValue)),this.type)}))}getTransactionId(){return RX(this,void 0,void 0,(function*(){return this.transactionId=function(e=null){if(!e)throw new Error("DecodedProof is not set");const{anchors:t}=e,n=t[0];if("string"==typeof n)return n.split(":").pop();throw new Error("Could not retrieve transaction id as was provided an unexpected format")}(this.proofValue),yield this.executeStep("getTransactionId",(()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new EG("getTransactionId",SG("errors","isTransactionIdValid"))}(this.transactionId)),this.type)}))}fetchRemoteHash(){return RX(this,void 0,void 0,(function*(){this.txData=yield this.executeStep("fetchRemoteHash",(()=>RX(this,void 0,void 0,(function*(){var e;return yield Lh({transactionId:this.transactionId,chain:null===(e=this.chain)||void 0===e?void 0:e.code,explorerAPIs:this.explorerAPIs})}))),this.type)}))}deriveIssuingAddressFromPublicKey(){return RX(this,void 0,void 0,(function*(){this.derivedIssuingAddress=yield this.executeStep("deriveIssuingAddressFromPublicKey",(()=>LX(this.verificationMethod,this.chain)),this.type)}))}compareIssuingAddress(){return RX(this,void 0,void 0,(function*(){yield this.executeStep("compareIssuingAddress",(()=>function(e,t){const n=SG("errors","identityErrorBaseMessage");if(e!==t)throw new EG("compareIssuingAddress",`${n} - ${SG("errors","compareIssuingAddress")}`)}(this.getIssuerPublicKey(),this.derivedIssuingAddress)),this.type)}))}}function KX(e){return Array.isArray(e)?e.find((e=>"ChainedProof2021"!==e.type)).verificationMethod:e.verificationMethod}var jX,GX;!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkImagesIntegrity="checkImagesIntegrity",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.deriveIssuingAddressFromPublicKey="deriveIssuingAddressFromPublicKey",e.compareIssuingAddress="compareIssuingAddress",e.checkAuthenticity="checkAuthenticity"}(jX||(jX={}));class qX extends lD{proofVerificationProcess=[jX.parseIssuerKeys,jX.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;verificationMethodPublicKey;derivedIssuingAddress;hasDid;proof;type="MerkleProof2019";suite;constructor(e){var t;super(e),this.executeStep=e.executeStep,this.documentToVerify=e.document,this.explorerAPIs=e.explorerAPIs,this.proof=e.proof,this.issuer=e.issuer,this.validateProofType(),this.receipt=(t=this.proof,HX.decodeMerkleProof2019(t)),this.transactionId=zC.certificates.getTransactionId(this.receipt),this.setHasDid()}async init(){await this.setVerificationSuite(),this.chain=this.suite.getChain(),this.adaptVerificationProcessToChain()}async verifyProof(){await this.suite.verifyProof({verifyIdentity:!1}),await this.verifyProcess(this.proofVerificationProcess)}async verifyIdentity(){await this.suite.verifyIdentity()}getProofVerificationSteps(e){return[...this.suite.getProofVerificationProcess(),...this.proofVerificationProcess].map((t=>zC.verifier.convertToVerificationSubsteps(e,t)))}getIdentityVerificationSteps(e){return this.hasDid?this.suite.getIdentityVerificationProcess().map((t=>zC.verifier.convertToVerificationSubsteps(e,t))):[]}getIssuerPublicKey(){return this.suite.getIssuerPublicKey()}getIssuanceTime(){return this.suite.getIssuanceTime()}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){return new URL(this.getIssuerProfileUrl())?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.proof.created}getChain(){return this.suite.getChain()}getReceipt(){return this.receipt}getTransactionIdString(){return zC.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}async executeStep(e,t,n){throw new Error("executeStep method needs to be overwritten by injecting from Verifier")}async setVerificationSuite(){await this.setIssuerFromProofVerificationMethod(),this.verificationMethodPublicKey=OR(this.getTargetVerificationMethodContainer(),KX(this.proof)),this.suite=new HX({document:this.documentToVerify,proof:this.proof,verificationMethod:this.verificationMethodPublicKey,options:{explorerAPIs:this.explorerAPIs,executeStepMethod:this.executeStep}})}adaptVerificationProcessToChain(){zC.chains.isMockChain(this.chain)&&(ad(this.proofVerificationProcess,jX.parseIssuerKeys),ad(this.proofVerificationProcess,jX.checkAuthenticity))}getTargetVerificationMethodContainer(){return this.issuer.didDocument??this.issuer}isProofChain(){return"ChainedProof2021"===this.proof.type}isMultipleProof(){return Array.isArray(this.documentToVerify.proof)}getProofIndex(){return this.isMultipleProof()?this.documentToVerify.proof.findIndex((e=>e.proofValue===this.proof.proofValue)):-1}async setIssuerFromProofVerificationMethod(){if(this.getProofIndex()>0){const e=this.proof.verificationMethod.split("#")[0];this.issuer=await zC.verifier.getIssuerProfile(e)}}setHasDid(){if(this.getProofIndex()>0){const e=this.proof.verificationMethod.split("#")[0];this.hasDid=dd(e)}else this.hasDid=!!this.issuer.didDocument}validateProofType(){const e=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}async verifyProcess(e){for(const t of e){if(!this[t])return void console.error("verification logic for",t,"not implemented");await this[t]()}}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(jX.parseIssuerKeys,(()=>zC.verifier.parseIssuerKeys(this.issuer)),this.type)}async checkAuthenticity(){await this.executeStep(jX.checkAuthenticity,(()=>MR(this.issuerPublicKeyList,this.getIssuerPublicKey(),this.getIssuanceTime())),this.type)}}!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.checkAuthenticity="checkAuthenticity"}(GX||(GX={}));class VX extends lD{verificationProcess=[GX.getTransactionId,GX.computeLocalHash,GX.fetchRemoteHash,GX.compareHashes,GX.checkMerkleRoot,GX.checkReceipt,GX.parseIssuerKeys,GX.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;proof;type="MerkleProof2017";constructor(e){super(e),e.executeStep&&(this.executeStep=e.executeStep),this.documentToVerify=e.document,this.explorerAPIs=e.explorerAPIs,this.issuer=e.issuer,this.proof=e.proof,this.validateProofType(),this.receipt=this.documentToVerify.signature,this.chain=zC.certificates.getChain("",this.receipt),this.transactionId=zC.certificates.getTransactionId(this.receipt),this.adaptVerificationProcessToChain()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(e){return this.verificationProcess.map((t=>zC.verifier.convertToVerificationSubsteps(e,t)))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return zC.chains.isMockChain(this.chain)?"This mock chain does not support issuing addresses":this.txData?this.txData.issuingAddress:void console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?")}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){return new URL(this.getIssuerProfileUrl())?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.documentToVerify.issuedOn}getChain(){return this.chain}getReceipt(){return this.receipt}getTransactionIdString(){return zC.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return zC.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}validateProofType(){if(this.proof.type[0]!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${this.proof.type[0]}`)}adaptVerificationProcessToChain(){zC.chains.isMockChain(this.chain)&&(ad(this.verificationProcess,GX.getTransactionId),ad(this.verificationProcess,GX.fetchRemoteHash),ad(this.verificationProcess,GX.parseIssuerKeys),ad(this.verificationProcess,GX.checkMerkleRoot),ad(this.verificationProcess,GX.checkAuthenticity))}async executeStep(e,t,n){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}async getTransactionId(){await this.executeStep(GX.getTransactionId,(()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new td("getTransactionId",Wh("errors","isTransactionIdValid"))}(this.transactionId)),this.type)}async computeLocalHash(){this.localHash=await this.executeStep(GX.computeLocalHash,(async()=>await LR(this.documentToVerify)),this.type)}async fetchRemoteHash(){this.txData=await this.executeStep(GX.fetchRemoteHash,(async()=>await zC.verifier.lookForTx({transactionId:this.transactionId,chain:this.chain.code,explorerAPIs:this.explorerAPIs})),this.type)}async compareHashes(){await this.executeStep(GX.compareHashes,(()=>function(e,t){if(e!==t)throw new td("compareHashes",Wh("errors","ensureHashesEqual"));return!0}(this.localHash,this.receipt.targetHash)),this.type)}async checkMerkleRoot(){await this.executeStep(GX.checkMerkleRoot,(()=>function(e,t){if(e!==t)throw new td("checkMerkleRoot",Wh("errors","ensureMerkleRootEqual"));return!0}(this.receipt.merkleRoot,this.txData.remoteHash)),this.type)}async checkReceipt(){await this.executeStep(GX.checkReceipt,(()=>function(e){let t=e.targetHash;const n=e.merkleRoot;try{const n=e.proof||e.path;if(n)for(const e in n){const r=n[e];let i;if(void 0!==r.left)i=TR(`${r.left}${t}`),t=PR(i);else{if(void 0===r.right)throw new td("checkReceipt","Trigger catch error.");i=TR(`${t}${r.right}`),t=PR(i)}}}catch(e){throw new td("checkReceipt",Wh("errors","ensureValidReceipt"))}if(t!==n)throw new td("checkReceipt",Wh("errors","invalidMerkleReceipt"))}(this.receipt)),this.type)}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(GX.parseIssuerKeys,(()=>zC.verifier.parseIssuerKeys(this.issuer)),this.type)}async checkAuthenticity(){await this.executeStep(GX.checkAuthenticity,(()=>MR(this.issuerPublicKeyList,this.txData.issuingAddress,this.txData.time)),this.type)}}const zX=ix("Verifier");class JX{expires;id;issuer;revocationKey;documentToVerify;explorerAPIs;txData;_stepsStatuses=[];hashlinkVerifier;verificationSteps;supportedVerificationSuites;proofVerifiers=[];verificationProcess;proofMap;constructor({certificateJson:e,expires:t,hashlinkVerifier:n,id:r,issuer:i,revocationKey:o,explorerAPIs:a}){this.expires=t,this.id=r,this.issuer=i,this.hashlinkVerifier=n,this.revocationKey=o,this.explorerAPIs=a,this.documentToVerify=Object.assign({},e)}getVerificationSteps(){return this.verificationSteps}getSignersData(){return this.proofVerifiers.map((e=>({signingDate:e.getSigningDate(),signatureSuiteType:e.type,issuerPublicKey:e.getIssuerPublicKey(),issuerName:e.getIssuerName(),issuerProfileDomain:e.getIssuerProfileDomain(),issuerProfileUrl:e.getIssuerProfileUrl(),chain:e.getChain?.(),transactionId:e.getTransactionIdString?.(),transactionLink:e.getTransactionLink?.(),rawTransactionLink:e.getRawTransactionLink?.()})))}async init(){this.instantiateProofVerifiers();for(const e of this.proofVerifiers)await e.init();this.prepareVerificationProcess()}async verify(e=(()=>{})){this._stepCallback=e,this._stepsStatuses=[];for(let e=0;e<this.proofVerifiers.length;e++)await this.proofVerifiers[e].verifyProof();for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}for(let e=0;e<this.proofVerifiers.length;e++)await this.proofVerifiers[e].verifyIdentity();const t=this._stepsStatuses.find((e=>e.status===HC.FAILURE));return t?this._failed(t):this._succeed()}getRevocationListUrl(){return this.issuer.revocationList}getProofTypes(){const e=[];return this.proofMap.forEach((t=>{let{type:n}=t;"ChainedProof2021"===n&&(n=t.chainedProofType),Array.isArray(n)&&(n=n[0]),e.push(n)})),e}getProofMap(e){const t=new Map;return"proof"in e?Array.isArray(e.proof)?e.proof.forEach(((e,n)=>t.set(n,e))):t.set(0,e.proof):"signature"in e&&t.set(0,e.signature),t}instantiateProofVerifiers(){this.supportedVerificationSuites={MerkleProof2017:VX,MerkleProof2019:qX,Ed25519Signature2020:fD,EcdsaSecp256k1Signature2019:QR},this.proofMap=this.getProofMap(this.documentToVerify);const e=this.getProofTypes(),t=function(e=[],t=[]){return t.filter((t=>!e.includes(t)))}(Object.keys(this.supportedVerificationSuites),e);if(t.length)throw new Error(`No support for proof verification of type: ${t.join(", ")}`);this.proofMap.forEach(((t,n)=>{const r={executeStep:this.executeStep.bind(this),document:this.documentToVerify,proof:t,explorerAPIs:this.explorerAPIs,issuer:this.issuer};this.proofVerifiers.push(new this.supportedVerificationSuites[e[n]](r))}))}prepareVerificationProcess(){const e=zC.certificates.getVerificationMap(!!this.issuer.didDocument,this.hashlinkVerifier.hasHashlinksToVerify());this.verificationSteps=e.verificationMap,this.verificationProcess=e.verificationProcess,this.registerSignatureVerificationSteps(),this.registerIdentityVerificationSteps(),this.verificationSteps=this.verificationSteps.filter((e=>e.subSteps?.length>0||e.suites?.some((e=>e.subSteps.length>0))))}registerSignatureVerificationSteps(){const e=rd.proofVerification;this.verificationSteps.find((t=>t.code===e)).suites=this.getSuiteSubsteps(e)}getSuiteSubsteps(e){const t={[rd.proofVerification]:"getProofVerificationSteps",[rd.identityVerification]:"getIdentityVerificationSteps"};return this.proofVerifiers.map((n=>({proofType:n.type,subSteps:n[t[e]](e)})))}registerIdentityVerificationSteps(){const e=rd.identityVerification;this.verificationSteps.find((t=>t.code===e)).suites=this.getSuiteSubsteps(e)}async executeStep(e,t,n){if(this._isFailing())return;let r;e&&(r=zC.i18n.getText("subSteps",`${e}LabelPending`),zX(r),this._updateStatusCallback(e,HC.STARTING,n));try{const r=await t();return e&&(this._updateStatusCallback(e,HC.SUCCESS,n),this._stepsStatuses.push({code:e,status:HC.SUCCESS})),r}catch(t){console.error(t),e&&(this._updateStatusCallback(e,HC.FAILURE,n,t.message),this._stepsStatuses.push({code:e,message:t.message,status:HC.FAILURE}))}}_stepCallback(e){}async checkImagesIntegrity(){await this.executeStep(id.checkImagesIntegrity,(async()=>{await this.hashlinkVerifier.verifyHashlinkTable().catch((e=>{throw console.error("hashlink verification error",e),new td(id.checkImagesIntegrity,Wh("errors","checkImagesIntegrity"))}))}))}async checkRevokedStatus(){if(this.documentToVerify.credentialStatus)return void await this.executeStep(id.checkRevokedStatus,(async()=>{await async function(e){Array.isArray(e)||(e=[e]);for(const t of e){const e=parseInt(t.statusListIndex,10),n=await kR(t.statusListCredential);if(!n)throw new td(id.checkRevokedStatus,`No status list could be found at the specified URL for 'statusListCredential': ${t.statusListCredential}.`);await NR(n);const{encodedList:r}=n.credentialSubject;if((await Ik({encodedList:r})).isRevoked(e)){const e="revocation"===t.statusPurpose?"revoked":"suspended";throw new td(id.checkRevokedStatus,`Certificate has been ${e}.`)}}}(this.documentToVerify.credentialStatus)}));const e=this.getRevocationListUrl();if(!e)return console.warn("No revocation list url was set on the issuer."),void await this.executeStep(id.checkRevokedStatus,(()=>!0));const t=await this.executeStep(null,(async()=>await zC.verifier.getRevokedAssertions(e,this.id)));await this.executeStep(id.checkRevokedStatus,(()=>function(e,t){if(!e||!t)return;Array.isArray(t)||(t=[t]),t=t.filter((e=>null!=e));const n=function(e=[],t=[]){return e.filter((e=>t.includes(e))).filter(((e,t,n)=>n.indexOf(e)===t))}(t,e.map((e=>e.id)));if(n.length>0){const t=e.findIndex((e=>e.id===n[0]));if(t>-1)throw new td(id.checkRevokedStatus,zC.certificates.generateRevocationReason(e[t].revocationReason))}}(t,this.id)))}async checkExpiresDate(){await this.executeStep(id.checkExpiresDate,(()=>function(e=null){if(!e)return;const t=GC(e);if((new Date).getTime()>=t)throw new td(id.checkExpiresDate,Wh("errors","ensureNotExpired"))}(this.expires)))}async controlVerificationMethod(){await this.executeStep(id.controlVerificationMethod,(()=>{!function(e,t=""){const n=function(e){return e.id}(e);if(n!==t.split("#")[0])throw new td(id.controlVerificationMethod,`${RR} - ${zC.i18n.getText("errors","controlVerificationMethod")}`)}(this.issuer.didDocument,KX(this.documentToVerify.proof))}))}findStepFromVerificationProcess(e,t){return zC.verifier.findVerificationSubstep(e,this.verificationSteps,t)}_failed(e){const{message:t}=e;return zX(`failure:${t}`),this._setFinalStep({status:HC.FAILURE,message:t})}_isFailing(){return this._stepsStatuses.some((e=>e.status===HC.FAILURE))}_succeed(){let e;return 1===this.proofVerifiers.length&&(this.proofVerifiers[0].type.includes("MerkleProof")?(e=zC.chains.isMockChain(this.proofVerifiers[0].getChain())?zC.i18n.getComposedText("success","mocknet"):zC.i18n.getComposedText("success","blockchain"),zX(e)):e={...zC.i18n.getComposedText("success","generic"),description:zC.i18n.getComposedText("success","generic").description.replace("${SIGNATURE_TYPE}",this.proofVerifiers[0].type)}),this.proofVerifiers.length>1&&(e=zC.i18n.getComposedText("success","multisign")),this._setFinalStep({status:HC.SUCCESS,message:e})}_setFinalStep({status:e,message:t}){return{code:rd.final,status:e,message:t}}_updateStatusCallback(e,t,n="",r=""){if(null!=e){const i=this.findStepFromVerificationProcess(e,n);if(void 0===i)return void console.warn("step with code",e,"was not found for suite",n,"ignoring but you should not.");const o={code:e,status:t,parentStep:i.parentStep,label:i.labelPending};r&&(o.errorMessage=r),this._stepCallback(o)}}}class YX{certificateImage;certificateJson;description;display;expires;explorerAPIs=[];id;isFormatValid;issuedOn;issuer;locale;metadataJson;name;options;recipientFullName;recordLink;revocationKey;sealImage;signature;signatureImage;signers=[];subtitle;hashlinkVerifier;verificationSteps;verifier;constructor(e,t={}){if(this._setOptions(t),"object"!=typeof e)try{e=JSON.parse(e)}catch(e){throw new Error(zC.i18n.getText("errors","certificateNotValid"))}this.certificateJson=cD(e),this.hashlinkVerifier=new Tl}async init(){await this.parseJson(this.certificateJson),this.verifier=new JX({certificateJson:this.certificateJson,expires:this.expires,id:this.id,issuer:this.issuer,hashlinkVerifier:this.hashlinkVerifier,revocationKey:this.revocationKey,explorerAPIs:cD(this.explorerAPIs)}),await this.verifier.init(),this.verificationSteps=this.verifier.getVerificationSteps()}async verify(e){const t=await this.verifier.verify(e);return this.setSigners(),t}async parseJson(e){const t=await async function(e){try{const t=YC(e["@context"]),n=await XC[t.versionNumber](e);return n.isFormatValid=!0,n}catch(e){return console.error(e),{isFormatValid:!1,error:e.message}}}(e);if(!t.isFormatValid)throw new Error(t.error);await this._setProperties(t)}setSigners(){this.signers=this.verifier.getSignersData()}_setOptions(e){this.options=Object.assign({},zh,e),this.locale=zC.i18n.ensureIsSupported("auto"===this.options.locale?zC.i18n.detectLocale():this.options.locale),this.explorerAPIs=this.options.explorerAPIs||[],e.didResolverUrl&&(zC.did.didResolver.url=e.didResolverUrl),Yh.locale=this.locale}async _setProperties({certificateImage:e,description:t,display:n,expires:r,id:i,isFormatValid:o,issuedOn:a,issuer:s,metadataJson:l,name:u,recipientFullName:A,recordLink:c,revocationKey:h,sealImage:d,signature:f,signatureImage:p,subtitle:g}){this.isFormatValid=o,this.certificateImage=e,this.description=t,this.expires=r,this.id=i,this.issuedOn=a,this.issuer=s,this.metadataJson=l,this.name=u,this.recipientFullName=A,this.recordLink=c,this.revocationKey=h,this.sealImage=d,this.signature=f,this.signatureImage=p,this.subtitle=g,this.display=await this.parseHashlinksInDisplay(n)}async parseHashlinksInDisplay(e){const t=cD(e);if(t)return"text/html"!==t.contentMediaType||(t.content=await async function(e,t){const n=[...e.matchAll(/hl:{1}[a-zA-Z0-9]+:{1}[a-zA-Z0-9]+/gm)].map((e=>e[0])).filter((e=>!!e));if(n.length){const r=await async function(e,t){return(await Promise.all(e.map((async e=>await t.decode(e))))).reduce((function(e,t){return e.push(t.meta.url[0]),e}),[])}(n,t);e=function(e,t,n){return t.forEach(((t,r)=>{e=e.replace(n[r],t)})),e}(e,r,n)}return e}(t.content,this.hashlinkVerifier)),t}}function XX(e){return/^(ftp|http|https):\/\/[^ "]+$/.test(e)}function WX(e){return/^(\.\/|\.\.\/|[A-Z]:\/\/|\/)[^ "]+$/.test(e)}function ZX(){return{certificateDefinition:null,errorMessage:"errors.invalidBlockcertsUrl"}}
|
|
711
711
|
/*! *****************************************************************************
|
|
712
712
|
Copyright (c) Microsoft Corporation.
|
|
713
713
|
|