rugproof-metamask-snap
Version:
RugProof MetaMask Snap for real-time crypto security analysis including honeypot detection, contract verification, and wallet scanning
1 lines • 62.9 kB
JavaScript
(()=>{var e={85:e=>{e.exports=function(e){return"function"==typeof e?e:Array.isArray(e)?t=>{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1}},334:(e,t)=>{"use strict";const n=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",r="["+n+"]["+(n+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*",i=new RegExp("^"+r+"$");t.isExist=function(e){return void 0!==e},t.isEmptyObject=function(e){return 0===Object.keys(e).length},t.merge=function(e,t,n){if(t){const r=Object.keys(t),i=r.length;for(let o=0;o<i;o++)e[r[o]]="strict"===n?[t[r[o]]]:t[r[o]]}},t.getValue=function(e){return t.isExist(e)?e:""},t.isName=function(e){const t=i.exec(e);return!(null==t)},t.getAllMatches=function(e,t){const n=[];let r=t.exec(e);for(;r;){const i=[];i.startIndex=t.lastIndex-r[0].length;const o=r.length;for(let e=0;e<o;e++)i.push(r[e]);n.push(i),r=t.exec(e)}return n},t.nameRegexp=r},400:(e,t,n)=>{const r=n(334);function i(e,t){let n="";for(;t<e.length&&"'"!==e[t]&&'"'!==e[t];t++)n+=e[t];if(n=n.trim(),-1!==n.indexOf(" "))throw new Error("External entites are not supported");const r=e[t++];let i="";for(;t<e.length&&e[t]!==r;t++)i+=e[t];return[n,i,t]}function o(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function s(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"N"===e[t+3]&&"T"===e[t+4]&&"I"===e[t+5]&&"T"===e[t+6]&&"Y"===e[t+7]}function a(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"L"===e[t+3]&&"E"===e[t+4]&&"M"===e[t+5]&&"E"===e[t+6]&&"N"===e[t+7]&&"T"===e[t+8]}function c(e,t){return"!"===e[t+1]&&"A"===e[t+2]&&"T"===e[t+3]&&"T"===e[t+4]&&"L"===e[t+5]&&"I"===e[t+6]&&"S"===e[t+7]&&"T"===e[t+8]}function u(e,t){return"!"===e[t+1]&&"N"===e[t+2]&&"O"===e[t+3]&&"T"===e[t+4]&&"A"===e[t+5]&&"T"===e[t+6]&&"I"===e[t+7]&&"O"===e[t+8]&&"N"===e[t+9]}function l(e){if(r.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}e.exports=function(e,t){const n={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let r=1,d=!1,f=!1,p="";for(;t<e.length;t++)if("<"!==e[t]||f)if(">"===e[t]){if(f?"-"===e[t-1]&&"-"===e[t-2]&&(f=!1,r--):r--,0===r)break}else"["===e[t]?d=!0:p+=e[t];else{if(d&&s(e,t)){let r,o;t+=7,[r,o,t]=i(e,t+1),-1===o.indexOf("&")&&(n[l(r)]={regx:RegExp(`&${r};`,"g"),val:o})}else if(d&&a(e,t))t+=8;else if(d&&c(e,t))t+=8;else if(d&&u(e,t))t+=9;else{if(!o)throw new Error("Invalid DOCTYPE");f=!0}r++,p=""}if(0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}}},454:(e,t,n)=>{"use strict";const r=n(918),i=n(923),o=n(904);e.exports={XMLParser:i,XMLValidator:r,XMLBuilder:o}},460:(e,t)=>{const n={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}};t.buildOptions=function(e){return Object.assign({},n,e)},t.defaultOptions=n},463:e=>{e.exports=s,s.default=s,s.stable=l,s.stableStringify=l;var t="[...]",n="[Circular]",r=[],i=[];function o(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function s(e,t,n,s){var a;void 0===s&&(s=o()),c(e,"",0,[],void 0,0,s);try{a=0===i.length?JSON.stringify(e,t,n):JSON.stringify(e,f(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return a}function a(e,t,n,o){var s=Object.getOwnPropertyDescriptor(o,n);void 0!==s.get?s.configurable?(Object.defineProperty(o,n,{value:e}),r.push([o,n,t,s])):i.push([t,n,e]):(o[n]=e,r.push([o,n,t]))}function c(e,r,i,o,s,u,l){var d;if(u+=1,"object"==typeof e&&null!==e){for(d=0;d<o.length;d++)if(o[d]===e)return void a(n,e,r,s);if(void 0!==l.depthLimit&&u>l.depthLimit)return void a(t,e,r,s);if(void 0!==l.edgesLimit&&i+1>l.edgesLimit)return void a(t,e,r,s);if(o.push(e),Array.isArray(e))for(d=0;d<e.length;d++)c(e[d],d,d,o,e,u,l);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var p=f[d];c(e[p],p,d,o,e,u,l)}}o.pop()}}function u(e,t){return e<t?-1:e>t?1:0}function l(e,t,n,s){void 0===s&&(s=o());var a,c=d(e,"",0,[],void 0,0,s)||e;try{a=0===i.length?JSON.stringify(c,t,n):JSON.stringify(c,f(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var u=r.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return a}function d(e,i,o,s,c,l,f){var p;if(l+=1,"object"==typeof e&&null!==e){for(p=0;p<s.length;p++)if(s[p]===e)return void a(n,e,i,c);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==f.depthLimit&&l>f.depthLimit)return void a(t,e,i,c);if(void 0!==f.edgesLimit&&o+1>f.edgesLimit)return void a(t,e,i,c);if(s.push(e),Array.isArray(e))for(p=0;p<e.length;p++)d(e[p],p,p,s,e,l,f);else{var h={},g=Object.keys(e).sort(u);for(p=0;p<g.length;p++){var m=g[p];d(e[m],m,p,s,e,l,f),h[m]=e[m]}if(void 0===c)return h;r.push([c,i,e]),c[i]=h}s.pop()}}function f(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(i.length>0)for(var r=0;r<i.length;r++){var o=i[r];if(o[1]===t&&o[0]===n){n=o[2],i.splice(r,1);break}}return e.call(this,t,n)}}},629:(e,t)=>{"use strict";function n(e,t,s){let a;const c={};for(let u=0;u<e.length;u++){const l=e[u],d=r(l);let f="";if(f=void 0===s?d:s+"."+d,d===t.textNodeName)void 0===a?a=l[d]:a+=""+l[d];else{if(void 0===d)continue;if(l[d]){let e=n(l[d],t,f);const r=o(e,t);l[":@"]?i(e,l[":@"],f,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==c[d]&&c.hasOwnProperty(d)?(Array.isArray(c[d])||(c[d]=[c[d]]),c[d].push(e)):t.isArray(d,f,r)?c[d]=[e]:c[d]=e}}}return"string"==typeof a?a.length>0&&(c[t.textNodeName]=a):void 0!==a&&(c[t.textNodeName]=a),c}function r(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const n=t[e];if(":@"!==n)return n}}function i(e,t,n,r){if(t){const i=Object.keys(t),o=i.length;for(let s=0;s<o;s++){const o=i[s];r.isArray(o,n+"."+o,!0,!0)?e[o]=[t[o]]:e[o]=t[o]}}}function o(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return 0===r||!(1!==r||!e[n]&&"boolean"!=typeof e[n]&&0!==e[n])}t.prettify=function(e,t){return n(e,t)}},680:(e,t,n)=>{"use strict";const r=n(334),i=n(832),o=n(400),s=n(983),a=n(85);function c(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function u(e,t,n,r,i,o,s){if(void 0!==e&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){s||(e=this.replaceEntitiesValue(e));const r=this.options.tagValueProcessor(t,e,n,i,o);if(null==r)return e;if(typeof r!=typeof e||r!==e)return r;if(this.options.trimValues)return N(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?N(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function l(e){if(this.options.removeNSPrefix){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}const d=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function f(e,t,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){const n=r.getAllMatches(e,d),i=n.length,o={};for(let e=0;e<i;e++){const r=this.resolveNameSpace(n[e][1]);if(this.ignoreAttributesFn(r,t))continue;let i=n[e][4],s=this.options.attributeNamePrefix+r;if(r.length)if(this.options.transformAttributeName&&(s=this.options.transformAttributeName(s)),"__proto__"===s&&(s="#__proto__"),void 0!==i){this.options.trimValues&&(i=i.trim()),i=this.replaceEntitiesValue(i);const e=this.options.attributeValueProcessor(r,i,t);o[s]=null==e?i:typeof e!=typeof i||e!==i?e:N(i,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[s]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=o,e}return o}}const p=function(e){e=e.replace(/\r\n?/g,"\n");const t=new i("!xml");let n=t,r="",s="";for(let a=0;a<e.length;a++){if("<"===e[a])if("/"===e[a+1]){const t=v(e,">",a,"Closing Tag is not closed.");let i=e.substring(a+2,t).trim();if(this.options.removeNSPrefix){const e=i.indexOf(":");-1!==e&&(i=i.substr(e+1))}this.options.transformTagName&&(i=this.options.transformTagName(i)),n&&(r=this.saveTextToParentTag(r,n,s));const o=s.substring(s.lastIndexOf(".")+1);if(i&&-1!==this.options.unpairedTags.indexOf(i))throw new Error(`Unpaired tag can not be used as closing tag: </${i}>`);let c=0;o&&-1!==this.options.unpairedTags.indexOf(o)?(c=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=s.lastIndexOf("."),s=s.substring(0,c),n=this.tagsNodeStack.pop(),r="",a=t}else if("?"===e[a+1]){let t=b(e,a,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new i(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,s,t.tagName)),this.addChild(n,e,s)}a=t.closeIndex+1}else if("!--"===e.substr(a+1,3)){const t=v(e,"--\x3e",a+4,"Comment is not closed.");if(this.options.commentPropName){const i=e.substring(a+4,t-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:i}])}a=t}else if("!D"===e.substr(a+1,2)){const t=o(e,a);this.docTypeEntities=t.entities,a=t.i}else if("!["===e.substr(a+1,2)){const t=v(e,"]]>",a,"CDATA is not closed.")-2,i=e.substring(a+9,t);r=this.saveTextToParentTag(r,n,s);let o=this.parseTextData(i,n.tagname,s,!0,!1,!0,!0);null==o&&(o=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:i}]):n.add(this.options.textNodeName,o),a=t+2}else{let o=b(e,a,this.options.removeNSPrefix),c=o.tagName;const u=o.rawTagName;let l=o.tagExp,d=o.attrExpPresent,f=o.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&r&&"!xml"!==n.tagname&&(r=this.saveTextToParentTag(r,n,s,!1));const p=n;if(p&&-1!==this.options.unpairedTags.indexOf(p.tagname)&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),c!==t.tagname&&(s+=s?"."+c:c),this.isItStopNode(this.options.stopNodes,s,c)){let t="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===c[c.length-1]?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),l=c):l=l.substr(0,l.length-1),a=o.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(c))a=o.closeIndex;else{const n=this.readStopNodeData(e,u,f+1);if(!n)throw new Error(`Unexpected end of ${u}`);a=n.i,t=n.tagContent}const r=new i(c);c!==l&&d&&(r[":@"]=this.buildAttributesMap(l,s,c)),t&&(t=this.parseTextData(t,c,s,!0,d,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),r.add(this.options.textNodeName,t),this.addChild(n,r,s)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===c[c.length-1]?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),l=c):l=l.substr(0,l.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const e=new i(c);c!==l&&d&&(e[":@"]=this.buildAttributesMap(l,s,c)),this.addChild(n,e,s),s=s.substr(0,s.lastIndexOf("."))}else{const e=new i(c);this.tagsNodeStack.push(n),c!==l&&d&&(e[":@"]=this.buildAttributesMap(l,s,c)),this.addChild(n,e,s),n=e}r="",a=f}}else r+=e[a]}return t.child};function h(e,t,n){const r=this.options.updateTag(t.tagname,n,t[":@"]);!1===r||("string"==typeof r?(t.tagname=r,e.addChild(t)):e.addChild(t))}const g=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function m(e,t,n,r){return e&&(void 0===r&&(r=0===t.child.length),void 0!==(e=this.parseTextData(e,t.tagname,n,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,r))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function y(e,t,n){const r="*."+n;for(const n in e){const i=e[n];if(r===i||t===i)return!0}return!1}function v(e,t,n,r){const i=e.indexOf(t,n);if(-1===i)throw new Error(r);return i+t.length-1}function b(e,t,n,r=">"){const i=function(e,t,n=">"){let r,i="";for(let o=t;o<e.length;o++){let t=e[o];if(r)t===r&&(r="");else if('"'===t||"'"===t)r=t;else if(t===n[0]){if(!n[1])return{data:i,index:o};if(e[o+1]===n[1])return{data:i,index:o}}else"\t"===t&&(t=" ");i+=t}}(e,t+1,r);if(!i)return;let o=i.data;const s=i.index,a=o.search(/\s/);let c=o,u=!0;-1!==a&&(c=o.substring(0,a),o=o.substring(a+1).trimStart());const l=c;if(n){const e=c.indexOf(":");-1!==e&&(c=c.substr(e+1),u=c!==i.data.substr(e+1))}return{tagName:c,tagExp:o,closeIndex:s,attrExpPresent:u,rawTagName:l}}function x(e,t,n){const r=n;let i=1;for(;n<e.length;n++)if("<"===e[n])if("/"===e[n+1]){const o=v(e,">",n,`${t} is not closed`);if(e.substring(n+2,o).trim()===t&&(i--,0===i))return{tagContent:e.substring(r,n),i:o};n=o}else if("?"===e[n+1]){n=v(e,"?>",n+1,"StopNode is not closed.")}else if("!--"===e.substr(n+1,3)){n=v(e,"--\x3e",n+3,"StopNode is not closed.")}else if("!["===e.substr(n+1,2)){n=v(e,"]]>",n,"StopNode is not closed.")-2}else{const r=b(e,n,">");if(r){(r&&r.tagName)===t&&"/"!==r.tagExp[r.tagExp.length-1]&&i++,n=r.closeIndex}}}function N(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&s(e,n)}return r.isExist(e)?e:""}e.exports=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=c,this.parseXml=p,this.parseTextData=u,this.resolveNameSpace=l,this.buildAttributesMap=f,this.isItStopNode=y,this.replaceEntitiesValue=g,this.readStopNodeData=x,this.saveTextToParentTag=m,this.addChild=h,this.ignoreAttributesFn=a(this.options.ignoreAttributes)}}},788:e=>{function t(e,s,a,c){let u="",l=!1;for(let d=0;d<e.length;d++){const f=e[d],p=n(f);if(void 0===p)continue;let h="";if(h=0===a.length?p:`${a}.${p}`,p===s.textNodeName){let e=f[p];i(h,s)||(e=s.tagValueProcessor(p,e),e=o(e,s)),l&&(u+=c),u+=e,l=!1;continue}if(p===s.cdataPropName){l&&(u+=c),u+=`<![CDATA[${f[p][0][s.textNodeName]}]]>`,l=!1;continue}if(p===s.commentPropName){u+=c+`\x3c!--${f[p][0][s.textNodeName]}--\x3e`,l=!0;continue}if("?"===p[0]){const e=r(f[":@"],s),t="?xml"===p?"":c;let n=f[p][0][s.textNodeName];n=0!==n.length?" "+n:"",u+=t+`<${p}${n}${e}?>`,l=!0;continue}let g=c;""!==g&&(g+=s.indentBy);const m=c+`<${p}${r(f[":@"],s)}`,y=t(f[p],s,h,g);-1!==s.unpairedTags.indexOf(p)?s.suppressUnpairedNode?u+=m+">":u+=m+"/>":y&&0!==y.length||!s.suppressEmptyNode?y&&y.endsWith(">")?u+=m+`>${y}${c}</${p}>`:(u+=m+">",y&&""!==c&&(y.includes("/>")||y.includes("</"))?u+=c+s.indentBy+y+c:u+=y,u+=`</${p}>`):u+=m+"/>",l=!0}return u}function n(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&":@"!==r)return r}}function r(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let i=t.attributeValueProcessor(r,e[r]);i=o(i,t),!0===i&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${i}"`}return n}function i(e,t){let n=(e=e.substr(0,e.length-t.textNodeName.length-1)).substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function o(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}e.exports=function(e,n){let r="";return n.format&&n.indentBy.length>0&&(r="\n"),t(e,n,"",r)}},832:e=>{"use strict";e.exports=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}},904:(e,t,n)=>{"use strict";const r=n(788),i=n(85),o={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function s(e){this.options=Object.assign({},o,e),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=i(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=u),this.processTextOrObjNode=a,this.options.format?(this.indentate=c,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function a(e,t,n,r){const i=this.j2x(e,n+1,r.concat(t));return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,i.attrStr,n):this.buildObjectNode(i.val,t,i.attrStr,n)}function c(e){return this.options.indentBy.repeat(e)}function u(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}s.prototype.build=function(e){return this.options.preserveOrder?r(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},s.prototype.j2x=function(e,t,n){let r="",i="";const o=n.join(".");for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(void 0===e[s])this.isAttribute(s)&&(i+="");else if(null===e[s])this.isAttribute(s)||s===this.options.cdataPropName?i+="":"?"===s[0]?i+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)i+=this.buildTextValNode(e[s],s,"",t);else if("object"!=typeof e[s]){const n=this.isAttribute(s);if(n&&!this.ignoreAttributesFn(n,o))r+=this.buildAttrPairStr(n,""+e[s]);else if(!n)if(s===this.options.textNodeName){let t=this.options.tagValueProcessor(s,""+e[s]);i+=this.replaceEntitiesValue(t)}else i+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){const r=e[s].length;let o="",a="";for(let c=0;c<r;c++){const r=e[s][c];if(void 0===r);else if(null===r)"?"===s[0]?i+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if("object"==typeof r)if(this.options.oneListGroup){const e=this.j2x(r,t+1,n.concat(s));o+=e.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(a+=e.attrStr)}else o+=this.processTextOrObjNode(r,s,t,n);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(s,r);e=this.replaceEntitiesValue(e),o+=e}else o+=this.buildTextValNode(r,s,"",t)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,a,t)),i+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const t=Object.keys(e[s]),n=t.length;for(let i=0;i<n;i++)r+=this.buildAttrPairStr(t[i],""+e[s][t[i]])}else i+=this.processTextOrObjNode(e[s],s,t,n);return{attrStr:r,val:i}},s.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},s.prototype.buildObjectNode=function(e,t,n,r){if(""===e)return"?"===t[0]?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let i="</"+t+this.tagEndChar,o="";return"?"===t[0]&&(o="?",i=""),!n&&""!==n||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===o.length?this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(r)+"<"+t+n+o+this.tagEndChar+e+this.indentate(r)+i:this.indentate(r)+"<"+t+n+o+">"+e+i}},s.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},s.prototype.buildTextValNode=function(e,t,n,r){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),""===i?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+i+"</"+t+this.tagEndChar}},s.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e},e.exports=s},918:(e,t,n)=>{"use strict";const r=n(334),i={allowBooleanAttributes:!1,unpairedTags:[]};function o(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function s(e,t){const n=t;for(;t<e.length;t++)if("?"==e[t]||" "==e[t]){const r=e.substr(n,t-n);if(t>5&&"xml"===r)return h("InvalidXml","XML declaration allowed only at the start of the document.",y(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}continue}return t}function a(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let n=1;for(t+=8;t<e.length;t++)if("<"===e[t])n++;else if(">"===e[t]&&(n--,0===n))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}t.validate=function(e,t){t=Object.assign({},i,t);const n=[];let r=!1,c=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let i=0;i<e.length;i++)if("<"===e[i]&&"?"===e[i+1]){if(i+=2,i=s(e,i),i.err)return i}else{if("<"!==e[i]){if(o(e[i]))continue;return h("InvalidChar","char '"+e[i]+"' is not expected.",y(e,i))}{let u=i;if(i++,"!"===e[i]){i=a(e,i);continue}{let d=!1;"/"===e[i]&&(d=!0,i++);let g="";for(;i<e.length&&">"!==e[i]&&" "!==e[i]&&"\t"!==e[i]&&"\n"!==e[i]&&"\r"!==e[i];i++)g+=e[i];if(g=g.trim(),"/"===g[g.length-1]&&(g=g.substring(0,g.length-1),i--),!m(g)){let t;return t=0===g.trim().length?"Invalid space after '<'.":"Tag '"+g+"' is an invalid name.",h("InvalidTag",t,y(e,i))}const v=l(e,i);if(!1===v)return h("InvalidAttr","Attributes for '"+g+"' have open quote.",y(e,i));let b=v.value;if(i=v.index,"/"===b[b.length-1]){const n=i-b.length;b=b.substring(0,b.length-1);const o=f(b,t);if(!0!==o)return h(o.err.code,o.err.msg,y(e,n+o.err.line));r=!0}else if(d){if(!v.tagClosed)return h("InvalidTag","Closing tag '"+g+"' doesn't have proper closing.",y(e,i));if(b.trim().length>0)return h("InvalidTag","Closing tag '"+g+"' can't have attributes or invalid starting.",y(e,u));if(0===n.length)return h("InvalidTag","Closing tag '"+g+"' has not been opened.",y(e,u));{const t=n.pop();if(g!==t.tagName){let n=y(e,t.tagStartPos);return h("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+g+"'.",y(e,u))}0==n.length&&(c=!0)}}else{const o=f(b,t);if(!0!==o)return h(o.err.code,o.err.msg,y(e,i-b.length+o.err.line));if(!0===c)return h("InvalidXml","Multiple possible root nodes found.",y(e,i));-1!==t.unpairedTags.indexOf(g)||n.push({tagName:g,tagStartPos:u}),r=!0}for(i++;i<e.length;i++)if("<"===e[i]){if("!"===e[i+1]){i++,i=a(e,i);continue}if("?"!==e[i+1])break;if(i=s(e,++i),i.err)return i}else if("&"===e[i]){const t=p(e,i);if(-1==t)return h("InvalidChar","char '&' is not expected.",y(e,i));i=t}else if(!0===c&&!o(e[i]))return h("InvalidXml","Extra text at the end",y(e,i));"<"===e[i]&&i--}}}return r?1==n.length?h("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",y(e,n[0].tagStartPos)):!(n.length>0)||h("InvalidXml","Invalid '"+JSON.stringify(n.map(e=>e.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):h("InvalidXml","Start tag expected.",1)};const c='"',u="'";function l(e,t){let n="",r="",i=!1;for(;t<e.length;t++){if(e[t]===c||e[t]===u)""===r?r=e[t]:r!==e[t]||(r="");else if(">"===e[t]&&""===r){i=!0;break}n+=e[t]}return""===r&&{value:n,index:t,tagClosed:i}}const d=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function f(e,t){const n=r.getAllMatches(e,d),i={};for(let e=0;e<n.length;e++){if(0===n[e][1].length)return h("InvalidAttr","Attribute '"+n[e][2]+"' has no space in starting.",v(n[e]));if(void 0!==n[e][3]&&void 0===n[e][4])return h("InvalidAttr","Attribute '"+n[e][2]+"' is without value.",v(n[e]));if(void 0===n[e][3]&&!t.allowBooleanAttributes)return h("InvalidAttr","boolean attribute '"+n[e][2]+"' is not allowed.",v(n[e]));const r=n[e][2];if(!g(r))return h("InvalidAttr","Attribute '"+r+"' is an invalid name.",v(n[e]));if(i.hasOwnProperty(r))return h("InvalidAttr","Attribute '"+r+"' is repeated.",v(n[e]));i[r]=1}return!0}function p(e,t){if(";"===e[++t])return-1;if("#"===e[t])return function(e,t){let n=/\d/;for("x"===e[t]&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(n))break}return-1}(e,++t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(";"===e[t])break;return-1}return t}function h(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function g(e){return r.isName(e)}function m(e){return r.isName(e)}function y(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function v(e){return e.startIndex+e[1].length}},923:(e,t,n)=>{const{buildOptions:r}=n(460),i=n(680),{prettify:o}=n(629),s=n(918);e.exports=class{constructor(e){this.externalEntities={},this.options=r(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const n=s.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new i(this.options);n.addExternalEntities(this.externalEntities);const r=n.parseXml(e);return this.options.preserveOrder||void 0===r?r:o(r,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}}},983:e=>{const t=/^[-+]?0x[a-fA-F0-9]+$/,n=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,r={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};e.exports=function(e,i={}){if(i=Object.assign({},r,i),!e||"string"!=typeof e)return e;let o=e.trim();if(void 0!==i.skipLike&&i.skipLike.test(o))return e;if("0"===e)return 0;if(i.hex&&t.test(o))return function(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(o,16);if(-1!==o.search(/[eE]/)){const t=o.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);if(t){if(i.leadingZeros)o=(t[1]||"")+t[3];else if("0"!==t[2]||"."!==t[3][0])return e;return i.eNotation?Number(o):e}return e}{const t=n.exec(o);if(t){const n=t[1],r=t[2];let s=function(e){if(e&&-1!==e.indexOf("."))return"."===(e=e.replace(/0+$/,""))?e="0":"."===e[0]?e="0"+e:"."===e[e.length-1]&&(e=e.substr(0,e.length-1)),e;return e}(t[3]);if(!i.leadingZeros&&r.length>0&&n&&"."!==o[2])return e;if(!i.leadingZeros&&r.length>0&&!n&&"."!==o[1])return e;if(i.leadingZeros&&r===e)return 0;{const t=Number(o),a=""+t;return-1!==a.search(/[eE]/)?i.eNotation?t:e:-1!==o.indexOf(".")?"0"===a&&""===s||a===s||n&&a==="-"+s?t:e:r?s===a||n+s===a?t:e:o===a||o===n+a?t:e}}return e}}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";function e(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}n.r(r),n.d(r,{onRpcRequest:()=>hr,onTransaction:()=>pr});const t=(e,t)=>Object.hasOwnProperty.call(e,t);var i;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(i=i||(i={}));class o extends TypeError{constructor(e,t){let n;const{message:r,explanation:i,...o}=e,{path:s}=e,a=0===s.length?r:`At path: ${s.join(".")} -- ${r}`;super(i??a),null!=i&&(this.cause=a),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function s(e){return"object"==typeof e&&null!==e}function a(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function c(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:s}=n,{refinement:c,message:u=`Expected a value of type \`${s}\`${c?` with refinement \`${c}\``:""}, but received: \`${a(r)}\``}=e;return{value:r,type:s,refinement:c,key:i[i.length-1],path:i,branch:o,...e,message:u}}function*u(e,t,n,r){(function(e){return s(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const i of e){const e=c(i,t,n,r);e&&(yield e)}}function*l(e,t,n={}){const{path:r=[],branch:i=[e],coerce:o=!1,mask:a=!1}=n,c={path:r,branch:i};if(o&&(e=t.coercer(e,c),a&&"type"!==t.type&&s(t.schema)&&s(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let u="valid";for(const r of t.validator(e,c))r.explanation=n.message,u="not_valid",yield[r,void 0];for(let[d,f,p]of t.entries(e,c)){const t=l(f,p,{path:void 0===d?r:[...r,d],branch:void 0===d?i:[...i,f],coerce:o,mask:a,message:n.message});for(const n of t)n[0]?(u=null===n[0].refinement||void 0===n[0].refinement?"not_valid":"not_refined",yield[n[0],void 0]):o&&(f=n[1],void 0===d?e=f:e instanceof Map?e.set(d,f):e instanceof Set?e.add(f):s(e)&&(void 0!==f||d in e)&&(e[d]=f))}if("not_valid"!==u)for(const r of t.refiner(e,c))r.explanation=n.message,u="not_refined",yield[r,void 0];"valid"===u&&(yield[void 0,e])}class d{constructor(e){const{type:t,schema:n,validator:r,refiner:i,coercer:o=e=>e,entries:s=function*(){}}=e;this.type=t,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(e,t)=>u(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>u(i(e,t),t,this,e):()=>[]}assert(e,t){return h(e,this,t)}create(e,t){return g(e,this,t)}is(e){return m(e,this)}mask(e,t){return function(e,t,n){const r=y(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return y(e,this,t)}}const f="EXACT_OPTIONAL";class p extends d{constructor(e){super({...e,type:`exact optional ${e.type}`}),this.brand=f}static isExactOptional(e){return s(e)&&"brand"in e&&e.brand===f}}function h(e,t,n){const r=y(e,t,{message:n});if(r[0])throw r[0]}function g(e,t,n){const r=y(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function m(e,t){return!y(e,t)[0]}function y(e,t,n={}){const r=l(e,t,n),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(i[0]){return[new o(i[0],function*(){for(const e of r)e[0]&&(yield e[0])}),void 0]}return[void 0,i[1]]}function v(e,t){return new d({type:e,schema:null,validator:t})}function b(e){let t;return new d({type:"lazy",schema:null,*entries(n,r){t??(t=e()),yield*t.entries(n,r)},validator:(n,r)=>(t??(t=e()),t.validator(n,r)),coercer:(n,r)=>(t??(t=e()),t.coercer(n,r)),refiner:(n,r)=>(t??(t=e()),t.refiner(n,r))})}function x(){return v("any",()=>!0)}function N(e){return new d({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${a(e)}`})}function w(){return v("boolean",e=>"boolean"==typeof e)}function E(){return v("integer",e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${a(e)}`)}function T(e){const t=a(e),n=typeof e;return new d({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${a(n)}`})}function O(){return v("never",()=>!1)}function A(e){return new d({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function P(){return v("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${a(e)}`)}function S(e){const t=e?Object.keys(e):[],n=O();return new d({type:"object",schema:e??null,*entries(r){if(e&&s(r)){const i=new Set(Object.keys(r));for(const n of t){i.delete(n);const t=e[n];p.isExactOptional(t)&&!Object.prototype.hasOwnProperty.call(r,n)||(yield[n,r[n],e[n]])}for(const e of i)yield[e,r[e],n]}},validator:e=>s(e)||`Expected an object, but received: ${a(e)}`,coercer:e=>s(e)?{...e}:e})}function k(e){return new d({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function j(e,t){return new d({type:"record",schema:null,*entries(n){if(s(n))for(const r in n){const i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>s(e)||`Expected an object, but received: ${a(e)}`})}function $(){return v("string",e=>"string"==typeof e||`Expected a string, but received: ${a(e)}`)}function I(e){const t=e.map(e=>e.type).join(" | ");return new d({type:"union",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const i=[];for(const t of e){const[...e]=l(n,t,r),[o]=e;if(!o?.[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${a(n)}`,...i]}})}function C(){return v("unknown",()=>!0)}function _(e,t,n){return new d({...e,coercer:(r,i)=>m(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)})}Error;function R(e){return function(e){return function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)&&"string"==typeof e.message?e.message:null==e?"":String(e)}(e).replace(/\.$/u,"")}function F(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}class L extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}function V(e,t="Assertion failed.",n=L){if(!e){if(t instanceof Error)throw t;throw F(n,t)}}function D(e,t,n="Assertion failed",r=L){try{h(e,t)}catch(e){throw F(r,`${n}: ${R(e)}.`)}}const M=e=>S(e);function B({path:e,branch:n}){const r=e[e.length-1];return t(n[n.length-2],r)}function J(e){return new d({...e,type:`optional ${e.type}`,validator:(t,n)=>!B(n)||e.validator(t,n),refiner:(t,n)=>!B(n)||e.refiner(t,n)})}const q=I([T(null),w(),v("finite number",e=>m(e,P())&&Number.isFinite(e)),$(),N(b(()=>q)),j($(),b(()=>q))]),z=_(q,x(),e=>(D(e,q),JSON.parse(JSON.stringify(e,(e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))));function U(e){try{return function(e){g(e,z)}(e),!0}catch{return!1}}const G=T("2.0"),X=A(I([P(),$()])),Y=M({code:E(),message:$(),data:J(z),stack:J($())}),W=I([j($(),z),N(z)]);M({id:X,jsonrpc:G,method:$(),params:J(W)}),M({jsonrpc:G,method:$(),params:J(W)});S({id:X,jsonrpc:G,result:k(C()),error:k(Y)});const H=M({id:X,jsonrpc:G,result:z}),Z=M({id:X,jsonrpc:G,error:Y});I([H,Z]);class Q extends TypeError{constructor(e,t){let n;const{message:r,explanation:i,...o}=e,{path:s}=e,a=0===s.length?r:`At path: ${s.join(".")} -- ${r}`;super(i??a),null!=i&&(this.cause=a),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function K(e){return"object"==typeof e&&null!=e}function ee(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function te(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:s}=n,{refinement:a,message:c=`Expected a value of type \`${s}\`${a?` with refinement \`${a}\``:""}, but received: \`${ee(r)}\``}=e;return{value:r,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*ne(e,t,n,r){var i;K(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const i of e){const e=te(i,t,n,r);e&&(yield e)}}function*re(e,t,n={}){const{path:r=[],branch:i=[e],coerce:o=!1,mask:s=!1}=n,a={path:r,branch:i};if(o&&(e=t.coercer(e,a),s&&"type"!==t.type&&K(t.schema)&&K(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let c="valid";for(const r of t.validator(e,a))r.explanation=n.message,c="not_valid",yield[r,void 0];for(let[u,l,d]of t.entries(e,a)){const t=re(l,d,{path:void 0===u?r:[...r,u],branch:void 0===u?i:[...i,l],coerce:o,mask:s,message:n.message});for(const n of t)n[0]?(c=null!=n[0].refinement?"not_refined":"not_valid",yield[n[0],void 0]):o&&(l=n[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):K(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const r of t.refiner(e,a))r.explanation=n.message,c="not_refined",yield[r,void 0];"valid"===c&&(yield[void 0,e])}class ie{constructor(e){const{type:t,schema:n,validator:r,refiner:i,coercer:o=e=>e,entries:s=function*(){}}=e;this.type=t,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(e,t)=>ne(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>ne(i(e,t),t,this,e):()=>[]}assert(e,t){return function(e,t,n){const r=se(e,t,{message:n});if(r[0])throw r[0]}(e,this,t)}create(e,t){return function(e,t,n){const r=se(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}is(e){return oe(e,this)}mask(e,t){return function(e,t,n){const r=se(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return se(e,this,t)}}function oe(e,t){return!se(e,t)[0]}function se(e,t,n={}){const r=re(e,t,n),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(i[0]){return[new Q(i[0],function*(){for(const e of r)e[0]&&(yield e[0])}),void 0]}return[void 0,i[1]]}function ae(...e){const t="type"===e[0].type,n=e.map(e=>e.schema),r=Object.assign({},...n);return t?be(r):ge(r)}function ce(e,t){return new ie({type:e,schema:null,validator:t})}function ue(e){let t;return new ie({type:"lazy",schema:null,*entries(n,r){t??(t=e()),yield*t.entries(n,r)},validator:(n,r)=>(t??(t=e()),t.validator(n,r)),coercer:(n,r)=>(t??(t=e()),t.coercer(n,r)),refiner:(n,r)=>(t??(t=e()),t.refiner(n,r))})}function le(e){return new ie({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${ee(e)}`})}function de(){return ce("boolean",e=>"boolean"==typeof e)}function fe(e){const t=ee(e),n=typeof e;return new ie({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${ee(n)}`})}function pe(){return ce("never",()=>!1)}function he(e){return new ie({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function ge(e){const t=e?Object.keys(e):[],n=pe();return new ie({type:"object",schema:e||null,*entries(r){if(e&&K(r)){const i=new Set(Object.keys(r));for(const n of t)i.delete(n),yield[n,r[n],e[n]];for(const e of i)yield[e,r[e],n]}},validator:e=>K(e)||`Expected an object, but received: ${ee(e)}`,coercer:e=>K(e)?{...e}:e})}function me(e){return new ie({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function ye(e,t){return new ie({type:"record",schema:null,*entries(n){if(K(n))for(const r in n){const i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>K(e)||`Expected an object, but received: ${ee(e)}`})}function ve(){return ce("string",e=>"string"==typeof e||`Expected a string, but received: ${ee(e)}`)}function be(e){const t=Object.keys(e);return new ie({type:"type",schema:e,*entries(n){if(K(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>K(e)||`Expected an object, but received: ${ee(e)}`,coercer:e=>K(e)?{...e}:e})}function xe(e){const t=e.map(e=>e.type).join(" | ");return new ie({type:"union",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const i=[];for(const t of e){const[...e]=re(n,t,r),[o]=e;if(!o[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ee(n)}`,...i]}})}function Ne(){return ce("unknown",()=>!0)}function we(e){return e instanceof Map||e instanceof Set?e.size:e.length}function Ee(e,t,n){return new ie({...e,*refiner(r,i){yield*e.refiner(r,i);const o=ne(n(r,i),i,e,r);for(const e of o)yield{...e,refinement:t}}})}var Te=n(454);function Oe(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}const Ae=(e,t)=>Object.hasOwnProperty.call(e,t);var Pe;!function(e){e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date"}(Pe=Pe||(Pe={}));var Se=n(463);function ke(e){return function(e){return function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)&&"string"==typeof e.message?e.message:null==e?"":String(e)}(e).replace(/\.$/u,"")}function je(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}class $e extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}const Ie=e=>S(e);function Ce({path:e,branch:t}){const n=e[e.length-1];return Ae(t[t.length-2],n)}function _e(e){return new d({...e,type:`optional ${e.type}`,validator:(t,n)=>!Ce(n)||e.validator(t,n),refiner:(t,n)=>!Ce(n)||e.refiner(t,n)})}const Re=I([T(null),w(),v("finite number",e=>m(e,P())&&Number.isFinite(e)),$(),N(b(()=>Re)),j($(),b(()=>Re))]),Fe=_(Re,x(),e=>(function(e,t,n="Assertion failed",r=$e){try{h(e,t)}catch(e){throw je(r,`${n}: ${ke(e)}.`)}}(e,Re),JSON.parse(JSON.stringify(e,(e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))));function Le(e){try{return function(e){g(e,Fe)}(e),!0}catch{return!1}}const Ve=T("2.0"),De=A(I([P(),$()])),Me=Ie({code:E(),message:$(),data:_e(Fe),stack:_e($())}),Be=I([j($(),Fe),N(Fe)]);Ie({id:De,jsonrpc:Ve,method:$(),params:_e(Be)}),Ie({jsonrpc:Ve,method:$(),params:_e(Be)});S({id:De,jsonrpc:Ve,result:k(C()),error:k(Me)});const Je=Ie({id:De,jsonrpc:Ve,result:Fe}),qe=Ie({id:De,jsonrpc:Ve,error:Me});I([Je,qe]);const ze={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},Ue={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901},Ge={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},Xe=ze.internal,Ye=(We(Xe),"Unspecified server error.");function We(e,t="Unspecified error message. This is a bug, please report it."){if(function(e){return Number.isInteger(e)}(e)){const t=e.toString();if(Ae(Ge,t))return Ge[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return Ye}return t}function He(e){return Array.isArray(e)?e.map(e=>Le(e)?e:Oe(e)?Ze(e):null):Oe(e)?Ze(e):Le(e)?e:null}function Ze(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{const r=e[n];return Le(r)&&(t[n]=r),t},{})}const Qe=function(e){return e?.__esModule?e.default:e}(Se);class Ke extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a non-empty string.');!function(e){return Oe(e)&&Ae(e,"cause")&&Oe(e.cause)}(n)?super(t):(super(t,{cause:n.cause}),Ae(this,"cause")||Object.assign(this,{cause:n.cause})),void 0!==n&&(this.data=n),this.code=e}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(this.data)&&(e.data.cause=He(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return Qe(this.serialize(),tt,2)}}class et extends Ke{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}function tt(e,t){if("[Circular]"!==t)return t}const nt=e=>vt(ze.parse,e),rt=e=>vt(ze.invalidRequest,e),it=e=>vt(ze.invalidParams,e),ot=e=>vt(ze.methodNotFound,e),st=e=>vt(ze.internal,e),at=e=>vt(ze.invalidInput,e),ct=e=>vt(ze.resourceNotFound,e),ut=e=>vt(ze.resourceUnavailable,e),lt=e=>vt(ze.transactionRejected,e),dt=e=>vt(ze.methodNotSupported,e),ft=e=>vt(ze.limitExceeded,e),pt=e=>bt(Ue.userRejectedRequest,e),ht=e=>bt(Ue.unauthorized,e),gt=e=>bt(Ue.unsupportedMethod,e),mt=e=>bt(Ue.disconnected,e),yt=e=>bt(Ue.chainDisconnected,e);function vt(e,t){const[n,r]=xt(t);return new Ke(e,n??We(e),r)}function bt(e,t){const[n,r]=xt(t);return new et(e,n??We(e),r)}function xt(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t??void 0,n]}}return[]}function Nt(e,t){return wt(e,"pattern",n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`)}function wt(e,t,n){return new d({...e,*refiner(r,i){yield*e.refiner(r,i);const o=u(n(r,i),i,e,r);for(const e of o)yield{...e,refinement:t}}})}Nt($(),/^(?:0x)?[0-9a-f]+$/iu),Nt($(),/^0x[0-9a-f]+$/iu),Nt($(),/^0x[0-9a-f]{40}$/u);const Et=Nt($(),/^0x[0-9a-fA-F]{40}$/u);var Tt,Ot,At,Pt,St=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},kt=(e,t,n)=>(St(e,t,"read from private field"),n?n.call(e):t.get(e)),jt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},$t=(e,t,n,r)=>(St(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),It=class extends Error{constructor(n,r={}){const i=function(n){if(e(n)&&t(n,"message")&&"string"==typeof n.message)return n.message;return String(n)}(n);super(i),jt(this,Tt,void 0),jt(this,Ot,void 0),jt(this,At,void 0),jt(this,Pt,void 0),$t(this,Ot,i),$t(this,Tt,function(n){if(e(n)&&t(n,"code")&&"number"==typeof n.code&&Number.isInteger(n.code))return n.code;return-32603}(n));const o={...Ft(n),...r};Object.keys(o).length>0&&$t(this,At,o),$t(this,Pt,super.stack)}get name(){return"SnapError"}get code(){return kt(this,Tt)}get message(){return kt(this,Ot)}get data(){return kt(this,At)}get stack(){return kt(this,Pt)}toJSON(){return{code:_t,message:Rt,data:{cause:{code:this.code,message:this.message,stack:this.stack,...this.data?{data:this.data}:{}}}}}serialize(){return this.toJSON()}};function C