@metamask/interactive-ui-example-snap 1.0.1 → 2.0.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/CHANGELOG.md CHANGED
@@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2.0.0]
10
+ ### Changed
11
+ - **BREAKING:** Revamp interactive UI example using JSX ([#2427](https://github.com/MetaMask/snaps/pull/2427))
12
+ - The `getState` RPC method was removed as part of this refactor.
13
+
14
+ ## [1.0.2]
15
+ ### Fixed
16
+ - Fix a crash when submitting an empty string ([#2333](https://github.com/MetaMask/snaps/pull/2333))
17
+
9
18
  ## [1.0.1]
10
19
  ### Changed
11
20
  - Use error wrappers ([#2178](https://github.com/MetaMask/snaps/pull/2178))
@@ -14,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
23
  ### Added
15
24
  - Add interactive UI example Snap ([#2171](https://github.com/MetaMask/snaps/pull/2171))
16
25
 
17
- [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/interactive-ui-example-snap@1.0.1...HEAD
26
+ [Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/interactive-ui-example-snap@2.0.0...HEAD
27
+ [2.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/interactive-ui-example-snap@1.0.2...@metamask/interactive-ui-example-snap@2.0.0
28
+ [1.0.2]: https://github.com/MetaMask/snaps/compare/@metamask/interactive-ui-example-snap@1.0.1...@metamask/interactive-ui-example-snap@1.0.2
18
29
  [1.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/interactive-ui-example-snap@1.0.0...@metamask/interactive-ui-example-snap@1.0.1
19
30
  [1.0.0]: https://github.com/MetaMask/snaps/releases/tag/@metamask/interactive-ui-example-snap@1.0.0
package/README.md CHANGED
@@ -11,8 +11,6 @@ JSON-RPC methods:
11
11
 
12
12
  - `dialog`: Create a `snap_dialog` with an interactive interface. This demonstrates that a snap can show an interactive `snap_dialog` that the user can interact with.
13
13
 
14
- - `getState`: Get the state of a given interface. This demonstrates that a snap can retrieve an interface state.
15
-
16
14
  ### onTransaction
17
15
 
18
16
  This snap exposes an `onTransaction` handler, which is called when a transaction
package/dist/bundle.js CHANGED
@@ -1 +1 @@
1
- (()=>{var t={12:t=>{t.exports=a,a.default=a,a.stable=l,a.stableStringify=l;var e="[...]",n="[Circular]",r=[],i=[];function s(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function a(t,e,n,a){var o;void 0===a&&(a=s()),u(t,"",0,[],void 0,0,a);try{o=0===i.length?JSON.stringify(t,e,n):JSON.stringify(t,p(e),n)}catch(t){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return o}function o(t,e,n,s){var a=Object.getOwnPropertyDescriptor(s,n);void 0!==a.get?a.configurable?(Object.defineProperty(s,n,{value:t}),r.push([s,n,e,a])):i.push([e,n,t]):(s[n]=t,r.push([s,n,e]))}function u(t,r,i,s,a,c,l){var d;if(c+=1,"object"==typeof t&&null!==t){for(d=0;d<s.length;d++)if(s[d]===t)return void o(n,t,r,a);if(void 0!==l.depthLimit&&c>l.depthLimit)return void o(e,t,r,a);if(void 0!==l.edgesLimit&&i+1>l.edgesLimit)return void o(e,t,r,a);if(s.push(t),Array.isArray(t))for(d=0;d<t.length;d++)u(t[d],d,d,s,t,c,l);else{var p=Object.keys(t);for(d=0;d<p.length;d++){var f=p[d];u(t[f],f,d,s,t,c,l)}}s.pop()}}function c(t,e){return t<e?-1:t>e?1:0}function l(t,e,n,a){void 0===a&&(a=s());var o,u=d(t,"",0,[],void 0,0,a)||t;try{o=0===i.length?JSON.stringify(u,e,n):JSON.stringify(u,p(e),n)}catch(t){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var c=r.pop();4===c.length?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return o}function d(t,i,s,a,u,l,p){var f;if(l+=1,"object"==typeof t&&null!==t){for(f=0;f<a.length;f++)if(a[f]===t)return void o(n,t,i,u);try{if("function"==typeof t.toJSON)return}catch(t){return}if(void 0!==p.depthLimit&&l>p.depthLimit)return void o(e,t,i,u);if(void 0!==p.edgesLimit&&s+1>p.edgesLimit)return void o(e,t,i,u);if(a.push(t),Array.isArray(t))for(f=0;f<t.length;f++)d(t[f],f,f,a,t,l,p);else{var h={},g=Object.keys(t).sort(c);for(f=0;f<g.length;f++){var m=g[f];d(t[m],m,f,a,t,l,p),h[m]=t[m]}if(void 0===u)return h;r.push([u,i,t]),u[i]=h}a.pop()}}function p(t){return t=void 0!==t?t:function(t,e){return e},function(e,n){if(i.length>0)for(var r=0;r<i.length;r++){var s=i[r];if(s[1]===e&&s[0]===n){n=s[2],i.splice(r,1);break}}return t.call(this,e,n)}}},525:(t,e,n)=>{"use strict";const r=n(730),i=n(702),s=n(653);t.exports={XMLParser:i,XMLValidator:r,XMLBuilder:s}},768:(t,e)=>{"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+"$");e.isExist=function(t){return void 0!==t},e.isEmptyObject=function(t){return 0===Object.keys(t).length},e.merge=function(t,e,n){if(e){const r=Object.keys(e),i=r.length;for(let s=0;s<i;s++)t[r[s]]="strict"===n?[e[r[s]]]:e[r[s]]}},e.getValue=function(t){return e.isExist(t)?t:""},e.isName=function(t){const e=i.exec(t);return!(null==e)},e.getAllMatches=function(t,e){const n=[];let r=e.exec(t);for(;r;){const i=[];i.startIndex=e.lastIndex-r[0].length;const s=r.length;for(let t=0;t<s;t++)i.push(r[t]);n.push(i),r=e.exec(t)}return n},e.nameRegexp=r},730:(t,e,n)=>{"use strict";const r=n(768),i={allowBooleanAttributes:!1,unpairedTags:[]};function s(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function a(t,e){const n=e;for(;e<t.length;e++)if("?"!=t[e]&&" "!=t[e]);else{const r=t.substr(n,e-n);if(e>5&&"xml"===r)return h("InvalidXml","XML declaration allowed only at the start of the document.",m(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function o(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let n=1;for(e+=8;e<t.length;e++)if("<"===t[e])n++;else if(">"===t[e]&&(n--,0===n))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}e.validate=function(t,e){e=Object.assign({},i,e);const n=[];let u=!1,c=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let i=0;i<t.length;i++)if("<"===t[i]&&"?"===t[i+1]){if(i+=2,i=a(t,i),i.err)return i}else{if("<"!==t[i]){if(s(t[i]))continue;return h("InvalidChar","char '"+t[i]+"' is not expected.",m(t,i))}{let g=i;if(i++,"!"===t[i]){i=o(t,i);continue}{let v=!1;"/"===t[i]&&(v=!0,i++);let b="";for(;i<t.length&&">"!==t[i]&&" "!==t[i]&&"\t"!==t[i]&&"\n"!==t[i]&&"\r"!==t[i];i++)b+=t[i];if(b=b.trim(),"/"===b[b.length-1]&&(b=b.substring(0,b.length-1),i--),d=b,!r.isName(d)){let e;return e=0===b.trim().length?"Invalid space after '<'.":"Tag '"+b+"' is an invalid name.",h("InvalidTag",e,m(t,i))}const y=l(t,i);if(!1===y)return h("InvalidAttr","Attributes for '"+b+"' have open quote.",m(t,i));let x=y.value;if(i=y.index,"/"===x[x.length-1]){const n=i-x.length;x=x.substring(0,x.length-1);const r=p(x,e);if(!0!==r)return h(r.err.code,r.err.msg,m(t,n+r.err.line));u=!0}else if(v){if(!y.tagClosed)return h("InvalidTag","Closing tag '"+b+"' doesn't have proper closing.",m(t,i));if(x.trim().length>0)return h("InvalidTag","Closing tag '"+b+"' can't have attributes or invalid starting.",m(t,g));{const e=n.pop();if(b!==e.tagName){let n=m(t,e.tagStartPos);return h("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+b+"'.",m(t,g))}0==n.length&&(c=!0)}}else{const r=p(x,e);if(!0!==r)return h(r.err.code,r.err.msg,m(t,i-x.length+r.err.line));if(!0===c)return h("InvalidXml","Multiple possible root nodes found.",m(t,i));-1!==e.unpairedTags.indexOf(b)||n.push({tagName:b,tagStartPos:g}),u=!0}for(i++;i<t.length;i++)if("<"===t[i]){if("!"===t[i+1]){i++,i=o(t,i);continue}if("?"!==t[i+1])break;if(i=a(t,++i),i.err)return i}else if("&"===t[i]){const e=f(t,i);if(-1==e)return h("InvalidChar","char '&' is not expected.",m(t,i));i=e}else if(!0===c&&!s(t[i]))return h("InvalidXml","Extra text at the end",m(t,i));"<"===t[i]&&i--}}}var d;return u?1==n.length?h("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",m(t,n[0].tagStartPos)):!(n.length>0)||h("InvalidXml","Invalid '"+JSON.stringify(n.map((t=>t.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):h("InvalidXml","Start tag expected.",1)};const u='"',c="'";function l(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===u||t[e]===c)""===r?r=t[e]:r!==t[e]||(r="");else if(">"===t[e]&&""===r){i=!0;break}n+=t[e]}return""===r&&{value:n,index:e,tagClosed:i}}const d=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function p(t,e){const n=r.getAllMatches(t,d),i={};for(let t=0;t<n.length;t++){if(0===n[t][1].length)return h("InvalidAttr","Attribute '"+n[t][2]+"' has no space in starting.",v(n[t]));if(void 0!==n[t][3]&&void 0===n[t][4])return h("InvalidAttr","Attribute '"+n[t][2]+"' is without value.",v(n[t]));if(void 0===n[t][3]&&!e.allowBooleanAttributes)return h("InvalidAttr","boolean attribute '"+n[t][2]+"' is not allowed.",v(n[t]));const r=n[t][2];if(!g(r))return h("InvalidAttr","Attribute '"+r+"' is an invalid name.",v(n[t]));if(i.hasOwnProperty(r))return h("InvalidAttr","Attribute '"+r+"' is repeated.",v(n[t]));i[r]=1}return!0}function f(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let n=/\d/;for("x"===t[e]&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(n))break}return-1}(t,++e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(";"===t[e])break;return-1}return e}function h(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function g(t){return r.isName(t)}function m(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function v(t){return t.startIndex+t[1].length}},653:(t,e,n)=>{"use strict";const r=n(292),i={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function s(t){this.options=Object.assign({},i,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=u),this.processTextOrObjNode=a,this.options.format?(this.indentate=o,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function a(t,e,n){const r=this.j2x(t,n+1);return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,r.attrStr,n):this.buildObjectNode(r.val,e,r.attrStr,n)}function o(t){return this.options.indentBy.repeat(t)}function u(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}s.prototype.build=function(t){return this.options.preserveOrder?r(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)},s.prototype.j2x=function(t,e){let n="",r="";for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i))if(void 0===t[i])this.isAttribute(i)&&(r+="");else if(null===t[i])this.isAttribute(i)?r+="":"?"===i[0]?r+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(t[i]instanceof Date)r+=this.buildTextValNode(t[i],i,"",e);else if("object"!=typeof t[i]){const s=this.isAttribute(i);if(s)n+=this.buildAttrPairStr(s,""+t[i]);else if(i===this.options.textNodeName){let e=this.options.tagValueProcessor(i,""+t[i]);r+=this.replaceEntitiesValue(e)}else r+=this.buildTextValNode(t[i],i,"",e)}else if(Array.isArray(t[i])){const n=t[i].length;let s="";for(let a=0;a<n;a++){const n=t[i][a];void 0===n||(null===n?"?"===i[0]?r+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+i+"/"+this.tagEndChar:"object"==typeof n?this.options.oneListGroup?s+=this.j2x(n,e+1).val:s+=this.processTextOrObjNode(n,i,e):s+=this.buildTextValNode(n,i,"",e))}this.options.oneListGroup&&(s=this.buildObjectNode(s,i,"",e)),r+=s}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const e=Object.keys(t[i]),r=e.length;for(let s=0;s<r;s++)n+=this.buildAttrPairStr(e[s],""+t[i][e[s]])}else r+=this.processTextOrObjNode(t[i],i,e);return{attrStr:n,val:r}},s.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},s.prototype.buildObjectNode=function(t,e,n,r){if(""===t)return"?"===e[0]?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;{let i="</"+e+this.tagEndChar,s="";return"?"===e[0]&&(s="?",i=""),!n&&""!==n||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===s.length?this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(r)+"<"+e+n+s+this.tagEndChar+t+this.indentate(r)+i:this.indentate(r)+"<"+e+n+s+">"+t+i}},s.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},s.prototype.buildTextValNode=function(t,e,n,r){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),""===i?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+i+"</"+e+this.tagEndChar}},s.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t},t.exports=s},292:t=>{function e(t,a,o,u){let c="",l=!1;for(let d=0;d<t.length;d++){const p=t[d],f=n(p);if(void 0===f)continue;let h="";if(h=0===o.length?f:`${o}.${f}`,f===a.textNodeName){let t=p[f];i(h,a)||(t=a.tagValueProcessor(f,t),t=s(t,a)),l&&(c+=u),c+=t,l=!1;continue}if(f===a.cdataPropName){l&&(c+=u),c+=`<![CDATA[${p[f][0][a.textNodeName]}]]>`,l=!1;continue}if(f===a.commentPropName){c+=u+`\x3c!--${p[f][0][a.textNodeName]}--\x3e`,l=!0;continue}if("?"===f[0]){const t=r(p[":@"],a),e="?xml"===f?"":u;let n=p[f][0][a.textNodeName];n=0!==n.length?" "+n:"",c+=e+`<${f}${n}${t}?>`,l=!0;continue}let g=u;""!==g&&(g+=a.indentBy);const m=u+`<${f}${r(p[":@"],a)}`,v=e(p[f],a,h,g);-1!==a.unpairedTags.indexOf(f)?a.suppressUnpairedNode?c+=m+">":c+=m+"/>":v&&0!==v.length||!a.suppressEmptyNode?v&&v.endsWith(">")?c+=m+`>${v}${u}</${f}>`:(c+=m+">",v&&""!==u&&(v.includes("/>")||v.includes("</"))?c+=u+a.indentBy+v+u:c+=v,c+=`</${f}>`):c+=m+"/>",l=!0}return c}function n(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(t.hasOwnProperty(r)&&":@"!==r)return r}}function r(t,e){let n="";if(t&&!e.ignoreAttributes)for(let r in t){if(!t.hasOwnProperty(r))continue;let i=e.attributeValueProcessor(r,t[r]);i=s(i,e),!0===i&&e.suppressBooleanAttributes?n+=` ${r.substr(e.attributeNamePrefix.length)}`:n+=` ${r.substr(e.attributeNamePrefix.length)}="${i}"`}return n}function i(t,e){let n=(t=t.substr(0,t.length-e.textNodeName.length-1)).substr(t.lastIndexOf(".")+1);for(let r in e.stopNodes)if(e.stopNodes[r]===t||e.stopNodes[r]==="*."+n)return!0;return!1}function s(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const r=e.entities[n];t=t.replace(r.regex,r.val)}return t}t.exports=function(t,n){let r="";return n.format&&n.indentBy.length>0&&(r="\n"),e(t,n,"",r)}},534:(t,e,n)=>{const r=n(768);function i(t,e){let n="";for(;e<t.length&&"'"!==t[e]&&'"'!==t[e];e++)n+=t[e];if(n=n.trim(),-1!==n.indexOf(" "))throw new Error("External entites are not supported");const r=t[e++];let i="";for(;e<t.length&&t[e]!==r;e++)i+=t[e];return[n,i,e]}function s(t,e){return"!"===t[e+1]&&"-"===t[e+2]&&"-"===t[e+3]}function a(t,e){return"!"===t[e+1]&&"E"===t[e+2]&&"N"===t[e+3]&&"T"===t[e+4]&&"I"===t[e+5]&&"T"===t[e+6]&&"Y"===t[e+7]}function o(t,e){return"!"===t[e+1]&&"E"===t[e+2]&&"L"===t[e+3]&&"E"===t[e+4]&&"M"===t[e+5]&&"E"===t[e+6]&&"N"===t[e+7]&&"T"===t[e+8]}function u(t,e){return"!"===t[e+1]&&"A"===t[e+2]&&"T"===t[e+3]&&"T"===t[e+4]&&"L"===t[e+5]&&"I"===t[e+6]&&"S"===t[e+7]&&"T"===t[e+8]}function c(t,e){return"!"===t[e+1]&&"N"===t[e+2]&&"O"===t[e+3]&&"T"===t[e+4]&&"A"===t[e+5]&&"T"===t[e+6]&&"I"===t[e+7]&&"O"===t[e+8]&&"N"===t[e+9]}function l(t){if(r.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}t.exports=function(t,e){const n={};if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let r=1,d=!1,p=!1,f="";for(;e<t.length;e++)if("<"!==t[e]||p)if(">"===t[e]){if(p?"-"===t[e-1]&&"-"===t[e-2]&&(p=!1,r--):r--,0===r)break}else"["===t[e]?d=!0:f+=t[e];else{if(d&&a(t,e))e+=7,[entityName,val,e]=i(t,e+1),-1===val.indexOf("&")&&(n[l(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(d&&o(t,e))e+=8;else if(d&&u(t,e))e+=8;else if(d&&c(t,e))e+=9;else{if(!s)throw new Error("Invalid DOCTYPE");p=!0}r++,f=""}if(0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:e}}},911:(t,e)=>{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(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t}};e.buildOptions=function(t){return Object.assign({},n,t)},e.defaultOptions=n},575:(t,e,n)=>{"use strict";const r=n(768),i=n(601),s=n(534),a=n(396);function o(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:t[r]}}}function u(t,e,n,r,i,s,a){if(void 0!==t&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));const r=this.options.tagValueProcessor(e,t,n,i,s);if(null==r)return t;if(typeof r!=typeof t||r!==t)return r;if(this.options.trimValues)return x(t,this.options.parseTagValue,this.options.numberParseOptions);return t.trim()===t?x(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function c(t){if(this.options.removeNSPrefix){const e=t.split(":"),n="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=n+e[1])}return t}const l=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function d(t,e,n){if(!this.options.ignoreAttributes&&"string"==typeof t){const n=r.getAllMatches(t,l),i=n.length,s={};for(let t=0;t<i;t++){const r=this.resolveNameSpace(n[t][1]);let i=n[t][4],a=this.options.attributeNamePrefix+r;if(r.length)if(this.options.transformAttributeName&&(a=this.options.transformAttributeName(a)),"__proto__"===a&&(a="#__proto__"),void 0!==i){this.options.trimValues&&(i=i.trim()),i=this.replaceEntitiesValue(i);const t=this.options.attributeValueProcessor(r,i,e);s[a]=null==t?i:typeof t!=typeof i||t!==i?t:x(i,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[a]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=s,t}return s}}const p=function(t){t=t.replace(/\r\n?/g,"\n");const e=new i("!xml");let n=e,r="",a="";for(let o=0;o<t.length;o++){if("<"===t[o])if("/"===t[o+1]){const e=v(t,">",o,"Closing Tag is not closed.");let i=t.substring(o+2,e).trim();if(this.options.removeNSPrefix){const t=i.indexOf(":");-1!==t&&(i=i.substr(t+1))}this.options.transformTagName&&(i=this.options.transformTagName(i)),n&&(r=this.saveTextToParentTag(r,n,a));const s=a.substring(a.lastIndexOf(".")+1);if(i&&-1!==this.options.unpairedTags.indexOf(i))throw new Error(`Unpaired tag can not be used as closing tag: </${i}>`);let u=0;s&&-1!==this.options.unpairedTags.indexOf(s)?(u=a.lastIndexOf(".",a.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=a.lastIndexOf("."),a=a.substring(0,u),n=this.tagsNodeStack.pop(),r="",o=e}else if("?"===t[o+1]){let e=b(t,o,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,a),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new i(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,a,e.tagName)),this.addChild(n,t,a)}o=e.closeIndex+1}else if("!--"===t.substr(o+1,3)){const e=v(t,"--\x3e",o+4,"Comment is not closed.");if(this.options.commentPropName){const i=t.substring(o+4,e-2);r=this.saveTextToParentTag(r,n,a),n.add(this.options.commentPropName,[{[this.options.textNodeName]:i}])}o=e}else if("!D"===t.substr(o+1,2)){const e=s(t,o);this.docTypeEntities=e.entities,o=e.i}else if("!["===t.substr(o+1,2)){const e=v(t,"]]>",o,"CDATA is not closed.")-2,i=t.substring(o+9,e);r=this.saveTextToParentTag(r,n,a);let s=this.parseTextData(i,n.tagname,a,!0,!1,!0,!0);null==s&&(s=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:i}]):n.add(this.options.textNodeName,s),o=e+2}else{let s=b(t,o,this.options.removeNSPrefix),u=s.tagName;const c=s.rawTagName;let l=s.tagExp,d=s.attrExpPresent,p=s.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&r&&"!xml"!==n.tagname&&(r=this.saveTextToParentTag(r,n,a,!1));const f=n;if(f&&-1!==this.options.unpairedTags.indexOf(f.tagname)&&(n=this.tagsNodeStack.pop(),a=a.substring(0,a.lastIndexOf("."))),u!==e.tagname&&(a+=a?"."+u:u),this.isItStopNode(this.options.stopNodes,a,u)){let e="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)o=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(u))o=s.closeIndex;else{const n=this.readStopNodeData(t,c,p+1);if(!n)throw new Error(`Unexpected end of ${c}`);o=n.i,e=n.tagContent}const r=new i(u);u!==l&&d&&(r[":@"]=this.buildAttributesMap(l,a,u)),e&&(e=this.parseTextData(e,u,a,!0,d,!0,!0)),a=a.substr(0,a.lastIndexOf(".")),r.add(this.options.textNodeName,e),this.addChild(n,r,a)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===u[u.length-1]?(u=u.substr(0,u.length-1),a=a.substr(0,a.length-1),l=u):l=l.substr(0,l.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const t=new i(u);u!==l&&d&&(t[":@"]=this.buildAttributesMap(l,a,u)),this.addChild(n,t,a),a=a.substr(0,a.lastIndexOf("."))}else{const t=new i(u);this.tagsNodeStack.push(n),u!==l&&d&&(t[":@"]=this.buildAttributesMap(l,a,u)),this.addChild(n,t,a),n=t}r="",o=p}}else r+=t[o]}return e.child};function f(t,e,n){const r=this.options.updateTag(e.tagname,n,e[":@"]);!1===r||("string"==typeof r?(e.tagname=r,t.addChild(e)):t.addChild(e))}const h=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const n=this.docTypeEntities[e];t=t.replace(n.regx,n.val)}for(let e in this.lastEntities){const n=this.lastEntities[e];t=t.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const n=this.htmlEntities[e];t=t.replace(n.regex,n.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function g(t,e,n,r){return t&&(void 0===r&&(r=0===Object.keys(e.child).length),void 0!==(t=this.parseTextData(t,e.tagname,n,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,r))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function m(t,e,n){const r="*."+n;for(const n in t){const i=t[n];if(r===i||e===i)return!0}return!1}function v(t,e,n,r){const i=t.indexOf(e,n);if(-1===i)throw new Error(r);return i+e.length-1}function b(t,e,n,r=">"){const i=function(t,e,n=">"){let r,i="";for(let s=e;s<t.length;s++){let e=t[s];if(r)e===r&&(r="");else if('"'===e||"'"===e)r=e;else if(e===n[0]){if(!n[1])return{data:i,index:s};if(t[s+1]===n[1])return{data:i,index:s}}else"\t"===e&&(e=" ");i+=e}}(t,e+1,r);if(!i)return;let s=i.data;const a=i.index,o=s.search(/\s/);let u=s,c=!0;-1!==o&&(u=s.substring(0,o),s=s.substring(o+1).trimStart());const l=u;if(n){const t=u.indexOf(":");-1!==t&&(u=u.substr(t+1),c=u!==i.data.substr(t+1))}return{tagName:u,tagExp:s,closeIndex:a,attrExpPresent:c,rawTagName:l}}function y(t,e,n){const r=n;let i=1;for(;n<t.length;n++)if("<"===t[n])if("/"===t[n+1]){const s=v(t,">",n,`${e} is not closed`);if(t.substring(n+2,s).trim()===e&&(i--,0===i))return{tagContent:t.substring(r,n),i:s};n=s}else if("?"===t[n+1]){n=v(t,"?>",n+1,"StopNode is not closed.")}else if("!--"===t.substr(n+1,3)){n=v(t,"--\x3e",n+3,"StopNode is not closed.")}else if("!["===t.substr(n+1,2)){n=v(t,"]]>",n,"StopNode is not closed.")-2}else{const r=b(t,n,">");if(r){(r&&r.tagName)===e&&"/"!==r.tagExp[r.tagExp.length-1]&&i++,n=r.closeIndex}}}function x(t,e,n){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&a(t,n)}return r.isExist(t)?t:""}t.exports=class{constructor(t){this.options=t,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:"₹"}},this.addExternalEntities=o,this.parseXml=p,this.parseTextData=u,this.resolveNameSpace=c,this.buildAttributesMap=d,this.isItStopNode=m,this.replaceEntitiesValue=h,this.readStopNodeData=y,this.saveTextToParentTag=g,this.addChild=f}}},702:(t,e,n)=>{const{buildOptions:r}=n(911),i=n(575),{prettify:s}=n(625),a=n(730);t.exports=class{constructor(t){this.externalEntities={},this.options=r(t)}parse(t,e){if("string"==typeof t);else{if(!t.toString)throw new Error("XML data is accepted in String or Bytes[] form.");t=t.toString()}if(e){!0===e&&(e={});const n=a.validate(t,e);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(t);return this.options.preserveOrder||void 0===r?r:s(r,this.options)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}}},625:(t,e)=>{"use strict";function n(t,e,a){let o;const u={};for(let c=0;c<t.length;c++){const l=t[c],d=r(l);let p="";if(p=void 0===a?d:a+"."+d,d===e.textNodeName)void 0===o?o=l[d]:o+=""+l[d];else{if(void 0===d)continue;if(l[d]){let t=n(l[d],e,p);const r=s(t,e);l[":@"]?i(t,l[":@"],p,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==u[d]&&u.hasOwnProperty(d)?(Array.isArray(u[d])||(u[d]=[u[d]]),u[d].push(t)):e.isArray(d,p,r)?u[d]=[t]:u[d]=t}}}return"string"==typeof o?o.length>0&&(u[e.textNodeName]=o):void 0!==o&&(u[e.textNodeName]=o),u}function r(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const n=e[t];if(":@"!==n)return n}}function i(t,e,n,r){if(e){const i=Object.keys(e),s=i.length;for(let a=0;a<s;a++){const s=i[a];r.isArray(s,n+"."+s,!0,!0)?t[s]=[e[s]]:t[s]=e[s]}}}function s(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return 0===r||!(1!==r||!t[n]&&"boolean"!=typeof t[n]&&0!==t[n])}e.prettify=function(t,e){return n(t,e)}},601:t=>{"use strict";t.exports=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}},396:t=>{const e=/^[-+]?0x[a-fA-F0-9]+$/,n=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const r={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};t.exports=function(t,i={}){if(i=Object.assign({},r,i),!t||"string"!=typeof t)return t;let s=t.trim();if(void 0!==i.skipLike&&i.skipLike.test(s))return t;if(i.hex&&e.test(s))return Number.parseInt(s,16);{const e=n.exec(s);if(e){const n=e[1],r=e[2];let a=function(t){if(t&&-1!==t.indexOf("."))return"."===(t=t.replace(/0+$/,""))?t="0":"."===t[0]?t="0"+t:"."===t[t.length-1]&&(t=t.substr(0,t.length-1)),t;return t}(e[3]);const o=e[4]||e[6];if(!i.leadingZeros&&r.length>0&&n&&"."!==s[2])return t;if(!i.leadingZeros&&r.length>0&&!n&&"."!==s[1])return t;{const e=Number(s),u=""+e;return-1!==u.search(/[eE]/)||o?i.eNotation?e:t:-1!==s.indexOf(".")?"0"===u&&""===a||u===a||n&&u==="-"+a?e:t:r?a===u||n+a===u?e:t:s===u||s===n+u?e:t}}return t}}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var s=e[r]={exports:{}};return t[r](s,s.exports,n),s.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";function t(t){return Boolean(t)&&"object"==typeof t&&!Array.isArray(t)}n.r(r),n.d(r,{onHomePage:()=>tn,onRpcRequest:()=>Ke,onTransaction:()=>en,onUserInput:()=>nn});var e=(t,e)=>Object.hasOwnProperty.call(t,e);var i,s=((i=s||{})[i.Null=4]="Null",i[i.Comma=1]="Comma",i[i.Wrapper=1]="Wrapper",i[i.True=4]="True",i[i.False=5]="False",i[i.Quote=1]="Quote",i[i.Colon=1]="Colon",i[i.Date=24]="Date",i);function a(t){if("object"!=typeof t||null===t)return!1;try{let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}catch(t){return!1}}class o extends TypeError{constructor(t,e){let n;const{message:r,explanation:i,...s}=t,{path:a}=t,o=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(i??o),null!=i&&(this.cause=o),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...e()])}}function u(t){return"object"==typeof t&&null!=t}function c(t){return"symbol"==typeof t?t.toString():"string"==typeof t?JSON.stringify(t):`${t}`}function l(t,e,n,r){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});const{path:i,branch:s}=e,{type:a}=n,{refinement:o,message:u=`Expected a value of type \`${a}\`${o?` with refinement \`${o}\``:""}, but received: \`${c(r)}\``}=t;return{value:r,type:a,refinement:o,key:i[i.length-1],path:i,branch:s,...t,message:u}}function*d(t,e,n,r){var i;u(i=t)&&"function"==typeof i[Symbol.iterator]||(t=[t]);for(const i of t){const t=l(i,e,n,r);t&&(yield t)}}function*p(t,e,n={}){const{path:r=[],branch:i=[t],coerce:s=!1,mask:a=!1}=n,o={path:r,branch:i};if(s&&(t=e.coercer(t,o),a&&"type"!==e.type&&u(e.schema)&&u(t)&&!Array.isArray(t)))for(const n in t)void 0===e.schema[n]&&delete t[n];let c="valid";for(const r of e.validator(t,o))r.explanation=n.message,c="not_valid",yield[r,void 0];for(let[l,d,f]of e.entries(t,o)){const e=p(d,f,{path:void 0===l?r:[...r,l],branch:void 0===l?i:[...i,d],coerce:s,mask:a,message:n.message});for(const n of e)n[0]?(c=null!=n[0].refinement?"not_refined":"not_valid",yield[n[0],void 0]):s&&(d=n[1],void 0===l?t=d:t instanceof Map?t.set(l,d):t instanceof Set?t.add(d):u(t)&&(void 0!==d||l in t)&&(t[l]=d))}if("not_valid"!==c)for(const r of e.refiner(t,o))r.explanation=n.message,c="not_refined",yield[r,void 0];"valid"===c&&(yield[void 0,t])}class f{constructor(t){const{type:e,schema:n,validator:r,refiner:i,coercer:s=(t=>t),entries:a=function*(){}}=t;this.type=e,this.schema=n,this.entries=a,this.coercer=s,this.validator=r?(t,e)=>d(r(t,e),e,this,t):()=>[],this.refiner=i?(t,e)=>d(i(t,e),e,this,t):()=>[]}assert(t,e){return h(t,this,e)}create(t,e){return g(t,this,e)}is(t){return m(t,this)}mask(t,e){return function(t,e,n){const r=v(t,e,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(t,this,e)}validate(t,e={}){return v(t,this,e)}}function h(t,e,n){const r=v(t,e,{message:n});if(r[0])throw r[0]}function g(t,e,n){const r=v(t,e,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function m(t,e){return!v(t,e)[0]}function v(t,e,n={}){const r=p(t,e,n),i=function(t){const{done:e,value:n}=t.next();return e?void 0:n}(r);if(i[0]){return[new o(i[0],(function*(){for(const t of r)t[0]&&(yield t[0])})),void 0]}return[void 0,i[1]]}function b(...t){const e="type"===t[0].type,n=t.map((t=>t.schema)),r=Object.assign({},...n);return e?C(r):P(r)}function y(t,e){return new f({type:t,schema:null,validator:e})}function x(t){let e;return new f({type:"lazy",schema:null,*entries(n,r){e??(e=t()),yield*e.entries(n,r)},validator:(n,r)=>(e??(e=t()),e.validator(n,r)),coercer:(n,r)=>(e??(e=t()),e.coercer(n,r)),refiner:(n,r)=>(e??(e=t()),e.refiner(n,r))})}function N(t){return new f({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||`Expected an array value, but received: ${c(t)}`})}function E(){return y("boolean",(t=>"boolean"==typeof t))}function w(t){const e=c(t),n=typeof t;return new f({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?t:null,validator:n=>n===t||`Expected the literal \`${e}\`, but received: ${c(n)}`})}function O(){return y("never",(()=>!1))}function T(t){return new f({...t,validator:(e,n)=>null===e||t.validator(e,n),refiner:(e,n)=>null===e||t.refiner(e,n)})}function S(){return y("number",(t=>"number"==typeof t&&!isNaN(t)||`Expected a number, but received: ${c(t)}`))}function P(t){const e=t?Object.keys(t):[],n=O();return new f({type:"object",schema:t||null,*entries(r){if(t&&u(r)){const i=new Set(Object.keys(r));for(const n of e)i.delete(n),yield[n,r[n],t[n]];for(const t of i)yield[t,r[t],n]}},validator:t=>u(t)||`Expected an object, but received: ${c(t)}`,coercer:t=>u(t)?{...t}:t})}function A(t){return new f({...t,validator:(e,n)=>void 0===e||t.validator(e,n),refiner:(e,n)=>void 0===e||t.refiner(e,n)})}function I(t,e){return new f({type:"record",schema:null,*entries(n){if(u(n))for(const r in n){const i=n[r];yield[r,r,t],yield[r,i,e]}},validator:t=>u(t)||`Expected an object, but received: ${c(t)}`})}function j(){return y("string",(t=>"string"==typeof t||`Expected a string, but received: ${c(t)}`))}function C(t){const e=Object.keys(t);return new f({type:"type",schema:t,*entries(n){if(u(n))for(const r of e)yield[r,n[r],t[r]]},validator:t=>u(t)||`Expected an object, but received: ${c(t)}`,coercer:t=>u(t)?{...t}:t})}function k(t){const e=t.map((t=>t.type)).join(" | ");return new f({type:"union",schema:null,coercer(e){for(const n of t){const[t,r]=n.validate(e,{coerce:!0});if(!t)return r}return e},validator(n,r){const i=[];for(const e of t){const[...t]=p(n,e,r),[s]=t;if(!s[0])return[];for(const[e]of t)e&&i.push(e)}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${c(n)}`,...i]}})}function $(){return y("unknown",(()=>!0))}function _(t,e,n){return new f({...t,coercer:(r,i)=>m(r,e)?t.coercer(n(r,i),i):t.coercer(r,i)})}function F(t,e){return R(t,"pattern",(n=>e.test(n)||`Expected a ${t.type} matching \`/${e.source}/\` but received "${n}"`))}function R(t,e,n){return new f({...t,*refiner(r,i){yield*t.refiner(r,i);const s=d(n(r,i),i,t,r);for(const t of s)yield{...t,refinement:e}}})}function V(t){return function(t){return function(t){return"object"==typeof t&&null!==t&&"message"in t}(t)&&"string"==typeof t.message?t.message:null==t?"":String(t)}(t).replace(/\.$/u,"")}function D(t,e){return n=t,Boolean("string"==typeof n?.prototype?.constructor?.name)?new t({message:e}):t({message:e});var n}var M=class extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}};function L(t,e="Assertion failed.",n=M){if(!t){if(e instanceof Error)throw e;throw D(n,e)}}function q(t,e,n="Assertion failed",r=M){try{h(t,e)}catch(t){throw D(r,`${n}: ${V(t)}.`)}}var B=t=>P(t);function U({path:t,branch:n}){const r=t[t.length-1];return e(n[n.length-2],r)}function J(t){return new f({...t,type:`optional ${t.type}`,validator:(e,n)=>!U(n)||t.validator(e,n),refiner:(e,n)=>!U(n)||t.refiner(e,n)})}var G=k([w(null),E(),y("finite number",(t=>m(t,S())&&Number.isFinite(t))),j(),N(x((()=>G))),I(j(),x((()=>G)))]),X=_(G,y("any",(()=>!0)),(t=>(q(t,G),JSON.parse(JSON.stringify(t,((t,e)=>{if("__proto__"!==t&&"constructor"!==t)return e}))))));function z(t){try{return function(t){g(t,X)}(t),!0}catch{return!1}}var W=w("2.0"),Y=T(k([S(),j()])),Z=B({code:y("integer",(t=>"number"==typeof t&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${c(t)}`)),message:j(),data:J(X),stack:J(j())}),H=k([I(j(),X),N(X)]);B({id:Y,jsonrpc:W,method:j(),params:J(H)}),B({jsonrpc:W,method:j(),params:J(H)});P({id:Y,jsonrpc:W,result:A($()),error:A(Z)});var Q=B({id:Y,jsonrpc:W,result:X}),K=B({id:Y,jsonrpc:W,error:Z});k([Q,K]);var tt=n(525),et={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},nt={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901},rt={"-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."}},it=et.internal,st="Unspecified error message. This is a bug, please report it.",at=(ot(it),"Unspecified server error.");function ot(t,n=st){if(function(t){return Number.isInteger(t)}(t)){const n=t.toString();if(e(rt,n))return rt[n].message;if(function(t){return t>=-32099&&t<=-32e3}(t))return at}return n}function ut(e){return Array.isArray(e)?e.map((e=>z(e)?e:t(e)?ct(e):null)):t(e)?ct(e):z(e)?e:null}function ct(t){return Object.getOwnPropertyNames(t).reduce(((e,n)=>{const r=t[n];return z(r)&&(e[n]=r),e}),{})}var lt=n(12),dt=class extends Error{constructor(t,e,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!e||"string"!=typeof e)throw new Error('"message" must be a non-empty string.');super(e),this.code=t,void 0!==n&&(this.data=n)}serialize(){const t={code:this.code,message:this.message};return void 0!==this.data&&(t.data=this.data,a(this.data)&&(t.data.cause=ut(this.data.cause))),this.stack&&(t.stack=this.stack),t}toString(){return lt(this.serialize(),ft,2)}},pt=class extends dt{constructor(t,e,n){if(!function(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,e,n)}};function ft(t,e){if("[Circular]"!==e)return e}var ht=t=>jt(et.parse,t),gt=t=>jt(et.invalidRequest,t),mt=t=>jt(et.invalidParams,t),vt=t=>jt(et.methodNotFound,t),bt=t=>jt(et.internal,t),yt=t=>jt(et.invalidInput,t),xt=t=>jt(et.resourceNotFound,t),Nt=t=>jt(et.resourceUnavailable,t),Et=t=>jt(et.transactionRejected,t),wt=t=>jt(et.methodNotSupported,t),Ot=t=>jt(et.limitExceeded,t),Tt=t=>Ct(nt.userRejectedRequest,t),St=t=>Ct(nt.unauthorized,t),Pt=t=>Ct(nt.unsupportedMethod,t),At=t=>Ct(nt.disconnected,t),It=t=>Ct(nt.chainDisconnected,t);function jt(t,e){const[n,r]=kt(e);return new dt(t,n??ot(t),r)}function Ct(t,e){const[n,r]=kt(e);return new pt(t,n??ot(t),r)}function kt(t){if(t){if("string"==typeof t)return[t];if("object"==typeof t&&!Array.isArray(t)){const{message:e,data:n}=t;if(e&&"string"!=typeof e)throw new Error("Must specify string message.");return[e??void 0,n]}}return[]}!function(){const t=[]}();F(j(),/^(?:0x)?[0-9a-f]+$/iu),F(j(),/^0x[0-9a-f]+$/iu),F(j(),/^0x[0-9a-f]{40}$/u);var $t=F(j(),/^0x[0-9a-fA-F]{40}$/u);function _t(t){return t.startsWith("0x")||t.startsWith("0X")?t.substring(2):t}var Ft,Rt,Vt,Dt,Mt=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Lt=(t,e,n)=>(Mt(t,e,"read from private field"),n?n.call(t):e.get(t)),qt=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Bt=(t,e,n,r)=>(Mt(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Ut=class extends Error{constructor(n,r={}){const i=function(n){if(t(n)&&e(n,"message")&&"string"==typeof n.message)return n.message;return String(n)}(n);super(i),qt(this,Ft,void 0),qt(this,Rt,void 0),qt(this,Vt,void 0),qt(this,Dt,void 0),Bt(this,Rt,i),Bt(this,Ft,function(n){if(t(n)&&e(n,"code")&&"number"==typeof n.code&&Number.isInteger(n.code))return n.code;return-32603}(n));const s={...zt(n),...r};Object.keys(s).length>0&&Bt(this,Vt,s),Bt(this,Dt,super.stack)}get name(){return"SnapError"}get code(){return Lt(this,Ft)}get message(){return Lt(this,Rt)}get data(){return Lt(this,Vt)}get stack(){return Lt(this,Dt)}toJSON(){return{code:Gt,message:Xt,data:{cause:{code:this.code,message:this.message,stack:this.stack,...this.data?{data:this.data}:{}}}}}serialize(){return this.toJSON()}};function Jt(t){return class extends Ut{constructor(e,n){if("object"==typeof e){const n=t();return void super({code:n.code,message:n.message,data:e})}const r=t(e);super({code:r.code,message:r.message,data:n})}}}Ft=new WeakMap,Rt=new WeakMap,Vt=new WeakMap,Dt=new WeakMap;var Gt=-31002,Xt="Snap Error";function zt(n){return t(n)&&e(n,"data")&&"object"==typeof n.data&&null!==n.data&&z(n.data)&&!Array.isArray(n.data)?n.data:{}}function Wt(t){return e=t,y(JSON.stringify(e),w(e).validator);var e}function Yt(n){try{return function(n){try{const r=n.trim();L(r.length>0);const i=new tt.XMLParser({ignoreAttributes:!1,parseAttributeValue:!0}).parse(r,!0);return L(e(i,"svg")),t(i.svg)?i.svg:{}}catch{throw new Error("Snap icon must be a valid SVG.")}}(n),!0}catch{return!1}}Jt(bt),Jt(yt),Jt(mt),Jt(gt),Jt(Ot);var Zt=Jt(vt);Jt(wt),Jt(ht),Jt(xt),Jt(Nt),Jt(Et),Jt(It),Jt(At),Jt(St),Jt(Pt),Jt(Tt);function Ht(t,e,n=[]){return(...r)=>{if(1===r.length&&a(r[0])){const n={...r[0],type:t};return q(n,e,`Invalid ${t} component`),n}const i=n.reduce(((t,e,n)=>void 0!==r[n]?{...t,[e]:r[n]}:t),{type:t});return q(i,e,`Invalid ${t} component`),i}}var Qt,Kt=((Qt=Kt||{}).Copyable="copyable",Qt.Divider="divider",Qt.Heading="heading",Qt.Panel="panel",Qt.Spinner="spinner",Qt.Text="text",Qt.Image="image",Qt.Row="row",Qt.Address="address",Qt.Button="button",Qt.Input="input",Qt.Form="form",Qt),te=P({type:j()}),ee=b(te,P({value:$()})),ne=b(ee,P({type:w("address"),value:$t})),re=Ht("address",ne,["value"]),ie=b(ee,P({type:w("copyable"),value:j(),sensitive:A(E())})),se=Ht("copyable",ie,["value","sensitive"]),ae=b(te,P({type:w("divider")})),oe=(Ht("divider",ae),b(ee,P({type:w("heading"),value:j()}))),ue=Ht("heading",oe,["value"]);var ce,le,de,pe,fe=b(te,P({type:w("image"),value:R(j(),"SVG",(t=>!!Yt(t)||"Value is not a valid SVG."))})),he=(Ht("image",fe,["value"]),(ce=he||{}).Primary="primary",ce.Secondary="secondary",ce),ge=((le=ge||{}).Button="button",le.Submit="submit",le),me=b(ee,P({type:w("button"),value:j(),variant:A(k([Wt("primary"),Wt("secondary")])),buttonType:A(k([Wt("button"),Wt("submit")])),name:A(j())})),ve=Ht("button",me,["value","buttonType","name","variant"]),be=((de=be||{}).Text="text",de.Number="number",de.Password="password",de),ye=b(ee,P({type:w("input"),value:A(j()),name:j(),inputType:A(k([Wt("text"),Wt("password"),Wt("number")])),placeholder:A(j()),label:A(j()),error:A(j())})),xe=Ht("input",ye,["name","inputType","placeholder","value","label"]),Ne=k([ye,me]),Ee=b(te,P({type:w("form"),children:N(Ne),name:j()})),we=Ht("form",Ee,["name","children"]),Oe=b(ee,P({type:w("text"),value:j(),markdown:A(E())})),Te=Ht("text",Oe,["value","markdown"]),Se=((pe=Se||{}).Default="default",pe.Critical="critical",pe.Warning="warning",pe),Pe=k([fe,Oe,ne]),Ae=b(ee,P({type:w("row"),variant:A(k([Wt("default"),Wt("critical"),Wt("warning")])),label:j(),value:Pe})),Ie=Ht("row",Ae,["label","value","variant"]),je=b(te,P({type:w("spinner")})),Ce=(Ht("spinner",je),b(te,P({children:N(x((()=>_e)))}))),ke=b(Ce,P({type:w("panel")})),$e=Ht("panel",ke,["children"]),_e=k([ie,ae,oe,fe,ke,je,Oe,Ae,ne,ye,Ee,me]);var Fe,Re,Ve,De,Me,Le,qe=((Fe=qe||{}).Critical="critical",Fe),Be=((Re=Be||{}).ButtonClickEvent="ButtonClickEvent",Re.FormSubmitEvent="FormSubmitEvent",Re.InputChangeEvent="InputChangeEvent",Re),Ue=P({type:j(),name:A(j())}),Je=(k([b(Ue,P({type:w("ButtonClickEvent"),name:A(j())})),b(Ue,P({type:w("FormSubmitEvent"),value:I(j(),j()),name:j()})),b(Ue,P({type:w("InputChangeEvent"),name:j(),value:j()}))]),(Ve=Je||{}).Alert="alert",Ve.Confirmation="confirmation",Ve.Prompt="prompt",Ve),Ge=((De=Ge||{}).Base64="base64",De.Hex="hex",De.Utf8="utf8",De),Xe=((Me=Xe||{}).ClearState="clear",Me.GetState="get",Me.UpdateState="update",Me),ze=((Le=ze||{}).InApp="inApp",Le.Native="native",Le),We=I(j(),T(j()));I(j(),k([We,T(j())]));const Ye=[{name:"ERC-20",signature:"a9059cbb"},{name:"ERC-721",signature:"23b872dd"},{name:"ERC-1155",signature:"f242432a"}];async function Ze(){return await snap.request({method:"snap_createInterface",params:{ui:$e([ue("Interactive UI Example Snap"),ve({value:"Update UI",name:"update"})])}})}async function He(){var t;const e=await snap.request({method:"snap_manageState",params:{operation:Xe.GetState}});L(null===(t=e)||void 0===t?void 0:t.transaction,"No transaction found in Snap state.");const{from:n,to:r}=e.transaction;return $e([Ie("From",re(n)),Ie("To",r?re(r):Te("None")),ve({value:"See transaction type",name:"transaction-type"})])}async function Qe(t){var e;const n=await snap.request({method:"snap_manageState",params:{operation:Xe.GetState}});L(null===(e=n)||void 0===e?void 0:e.transaction,"No transaction found in Snap state.");const r=function(t){if(t&&"string"==typeof t){var e;const n=_t(t).slice(0,8);return(null===(e=Ye.find((t=>t.signature===n)))||void 0===e?void 0:e.name)??"Unknown"}return"Unknown"}(n.transaction.data);await snap.request({method:"snap_updateInterface",params:{id:t,ui:$e([Ie("Transaction type",Te(r)),ve({value:"Go back",name:"go-back"})])}})}const Ke=async({request:t})=>{switch(t.method){case"dialog":try{const t=await Ze();return await snap.request({method:"snap_manageState",params:{operation:Xe.UpdateState,newState:{interfaceId:t},encrypted:!1}}),await snap.request({method:"snap_dialog",params:{type:"confirmation",id:t}})}finally{await snap.request({method:"snap_manageState",params:{operation:Xe.ClearState,encrypted:!1}})}case"getState":{var e;const t=await snap.request({method:"snap_manageState",params:{operation:Xe.GetState,encrypted:!1}});L(null===(e=t)||void 0===e?void 0:e.interfaceId,"No interface ID found in state.");return await snap.request({method:"snap_getInterfaceState",params:{id:t.interfaceId}})}default:throw new Zt({method:t.method})}},tn=async()=>({id:await Ze()}),en=async({transaction:t})=>{await snap.request({method:"snap_manageState",params:{operation:Xe.UpdateState,newState:{transaction:t}}});return{id:await snap.request({method:"snap_createInterface",params:{ui:await He()}})}},nn=async({id:t,event:e})=>{if(e.type===Be.ButtonClickEvent)switch(e.name){case"update":await async function(t){await snap.request({method:"snap_updateInterface",params:{id:t,ui:$e([ue("Interactive UI Example Snap"),we({name:"example-form",children:[xe({name:"example-input",placeholder:"Enter something..."}),ve("Submit",ge.Submit,"submit")]})])}})}(t);break;case"transaction-type":await Qe(t);break;case"go-back":await snap.request({method:"snap_updateInterface",params:{id:t,ui:await He()}})}if(e.type===Be.FormSubmitEvent&&"example-form"===e.name){const n=e.value["example-input"];await async function(t,e){await snap.request({method:"snap_updateInterface",params:{id:t,ui:$e([ue("Interactive UI Example Snap"),Te("The submitted value is:"),se(e)])}})}(t,n)}}})();var i=exports;for(var s in r)i[s]=r[s];r.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
1
+ (()=>{var e={12:e=>{e.exports=s,s.default=s,s.stable=c,s.stableStringify=c;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()),u(e,"",0,[],void 0,0,s);try{a=0===i.length?JSON.stringify(e,t,n):JSON.stringify(e,p(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var l=r.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[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 u(e,r,i,o,s,l,c){var d;if(l+=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!==c.depthLimit&&l>c.depthLimit)return void a(t,e,r,s);if(void 0!==c.edgesLimit&&i+1>c.edgesLimit)return void a(t,e,r,s);if(o.push(e),Array.isArray(e))for(d=0;d<e.length;d++)u(e[d],d,d,o,e,l,c);else{var p=Object.keys(e);for(d=0;d<p.length;d++){var f=p[d];u(e[f],f,d,o,e,l,c)}}o.pop()}}function l(e,t){return e<t?-1:e>t?1:0}function c(e,t,n,s){void 0===s&&(s=o());var a,u=d(e,"",0,[],void 0,0,s)||e;try{a=0===i.length?JSON.stringify(u,t,n):JSON.stringify(u,p(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==r.length;){var l=r.pop();4===l.length?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return a}function d(e,i,o,s,u,c,p){var f;if(c+=1,"object"==typeof e&&null!==e){for(f=0;f<s.length;f++)if(s[f]===e)return void a(n,e,i,u);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==p.depthLimit&&c>p.depthLimit)return void a(t,e,i,u);if(void 0!==p.edgesLimit&&o+1>p.edgesLimit)return void a(t,e,i,u);if(s.push(e),Array.isArray(e))for(f=0;f<e.length;f++)d(e[f],f,f,s,e,c,p);else{var h={},g=Object.keys(e).sort(l);for(f=0;f<g.length;f++){var m=g[f];d(e[m],m,f,s,e,c,p),h[m]=e[m]}if(void 0===u)return h;r.push([u,i,e]),u[i]=h}s.pop()}}function p(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)}}},525:(e,t,n)=>{"use strict";const r=n(730),i=n(702),o=n(653);e.exports={XMLParser:i,XMLValidator:r,XMLBuilder:o}},768:(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},730:(e,t,n)=>{"use strict";const r=n(768),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]);else{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.",m(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}}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 u=!1,l=!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.",m(e,i))}{let g=i;if(i++,"!"===e[i]){i=a(e,i);continue}{let v=!1;"/"===e[i]&&(v=!0,i++);let b="";for(;i<e.length&&">"!==e[i]&&" "!==e[i]&&"\t"!==e[i]&&"\n"!==e[i]&&"\r"!==e[i];i++)b+=e[i];if(b=b.trim(),"/"===b[b.length-1]&&(b=b.substring(0,b.length-1),i--),d=b,!r.isName(d)){let t;return t=0===b.trim().length?"Invalid space after '<'.":"Tag '"+b+"' is an invalid name.",h("InvalidTag",t,m(e,i))}const y=c(e,i);if(!1===y)return h("InvalidAttr","Attributes for '"+b+"' have open quote.",m(e,i));let x=y.value;if(i=y.index,"/"===x[x.length-1]){const n=i-x.length;x=x.substring(0,x.length-1);const r=p(x,t);if(!0!==r)return h(r.err.code,r.err.msg,m(e,n+r.err.line));u=!0}else if(v){if(!y.tagClosed)return h("InvalidTag","Closing tag '"+b+"' doesn't have proper closing.",m(e,i));if(x.trim().length>0)return h("InvalidTag","Closing tag '"+b+"' can't have attributes or invalid starting.",m(e,g));{const t=n.pop();if(b!==t.tagName){let n=m(e,t.tagStartPos);return h("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+b+"'.",m(e,g))}0==n.length&&(l=!0)}}else{const r=p(x,t);if(!0!==r)return h(r.err.code,r.err.msg,m(e,i-x.length+r.err.line));if(!0===l)return h("InvalidXml","Multiple possible root nodes found.",m(e,i));-1!==t.unpairedTags.indexOf(b)||n.push({tagName:b,tagStartPos:g}),u=!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=f(e,i);if(-1==t)return h("InvalidChar","char '&' is not expected.",m(e,i));i=t}else if(!0===l&&!o(e[i]))return h("InvalidXml","Extra text at the end",m(e,i));"<"===e[i]&&i--}}}var d;return u?1==n.length?h("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",m(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 u='"',l="'";function c(e,t){let n="",r="",i=!1;for(;t<e.length;t++){if(e[t]===u||e[t]===l)""===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 p(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 f(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,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}},653:(e,t,n)=>{"use strict";const r=n(292),i={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:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function o(e){this.options=Object.assign({},i,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=u),this.processTextOrObjNode=s,this.options.format?(this.indentate=a,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function s(e,t,n){const r=this.j2x(e,n+1);return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}function a(e){return this.options.indentBy.repeat(e)}function u(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}o.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)},o.prototype.j2x=function(e,t){let n="",r="";for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i))if(void 0===e[i])this.isAttribute(i)&&(r+="");else if(null===e[i])this.isAttribute(i)?r+="":"?"===i[0]?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(e[i]instanceof Date)r+=this.buildTextValNode(e[i],i,"",t);else if("object"!=typeof e[i]){const o=this.isAttribute(i);if(o)n+=this.buildAttrPairStr(o,""+e[i]);else if(i===this.options.textNodeName){let t=this.options.tagValueProcessor(i,""+e[i]);r+=this.replaceEntitiesValue(t)}else r+=this.buildTextValNode(e[i],i,"",t)}else if(Array.isArray(e[i])){const n=e[i].length;let o="";for(let s=0;s<n;s++){const n=e[i][s];void 0===n||(null===n?"?"===i[0]?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar:"object"==typeof n?this.options.oneListGroup?o+=this.j2x(n,t+1).val:o+=this.processTextOrObjNode(n,i,t):o+=this.buildTextValNode(n,i,"",t))}this.options.oneListGroup&&(o=this.buildObjectNode(o,i,"",t)),r+=o}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const t=Object.keys(e[i]),r=t.length;for(let o=0;o<r;o++)n+=this.buildAttrPairStr(t[o],""+e[i][t[o]])}else r+=this.processTextOrObjNode(e[i],i,t);return{attrStr:n,val:r}},o.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},o.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}},o.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},o.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}},o.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=o},292:e=>{function t(e,s,a,u){let l="",c=!1;for(let d=0;d<e.length;d++){const p=e[d],f=n(p);if(void 0===f)continue;let h="";if(h=0===a.length?f:`${a}.${f}`,f===s.textNodeName){let e=p[f];i(h,s)||(e=s.tagValueProcessor(f,e),e=o(e,s)),c&&(l+=u),l+=e,c=!1;continue}if(f===s.cdataPropName){c&&(l+=u),l+=`<![CDATA[${p[f][0][s.textNodeName]}]]>`,c=!1;continue}if(f===s.commentPropName){l+=u+`\x3c!--${p[f][0][s.textNodeName]}--\x3e`,c=!0;continue}if("?"===f[0]){const e=r(p[":@"],s),t="?xml"===f?"":u;let n=p[f][0][s.textNodeName];n=0!==n.length?" "+n:"",l+=t+`<${f}${n}${e}?>`,c=!0;continue}let g=u;""!==g&&(g+=s.indentBy);const m=u+`<${f}${r(p[":@"],s)}`,v=t(p[f],s,h,g);-1!==s.unpairedTags.indexOf(f)?s.suppressUnpairedNode?l+=m+">":l+=m+"/>":v&&0!==v.length||!s.suppressEmptyNode?v&&v.endsWith(">")?l+=m+`>${v}${u}</${f}>`:(l+=m+">",v&&""!==u&&(v.includes("/>")||v.includes("</"))?l+=u+s.indentBy+v+u:l+=v,l+=`</${f}>`):l+=m+"/>",c=!0}return l}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)}},534:(e,t,n)=>{const r=n(768);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 u(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 l(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 c(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,p=!1,f="";for(;t<e.length;t++)if("<"!==e[t]||p)if(">"===e[t]){if(p?"-"===e[t-1]&&"-"===e[t-2]&&(p=!1,r--):r--,0===r)break}else"["===e[t]?d=!0:f+=e[t];else{if(d&&s(e,t))t+=7,[entityName,val,t]=i(e,t+1),-1===val.indexOf("&")&&(n[c(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(d&&a(e,t))t+=8;else if(d&&u(e,t))t+=8;else if(d&&l(e,t))t+=9;else{if(!o)throw new Error("Invalid DOCTYPE");p=!0}r++,f=""}if(0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}}},911:(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},575:(e,t,n)=>{"use strict";const r=n(768),i=n(601),o=n(534),s=n(396);function a(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 x(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?x(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 c=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function d(e,t,n){if(!this.options.ignoreAttributes&&"string"==typeof e){const n=r.getAllMatches(e,c),i=n.length,o={};for(let e=0;e<i;e++){const r=this.resolveNameSpace(n[e][1]);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:x(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 u=0;o&&-1!==this.options.unpairedTags.indexOf(o)?(u=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=s.lastIndexOf("."),s=s.substring(0,u),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),u=o.tagName;const l=o.rawTagName;let c=o.tagExp,d=o.attrExpPresent,p=o.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&r&&"!xml"!==n.tagname&&(r=this.saveTextToParentTag(r,n,s,!1));const f=n;if(f&&-1!==this.options.unpairedTags.indexOf(f.tagname)&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),u!==t.tagname&&(s+=s?"."+u:u),this.isItStopNode(this.options.stopNodes,s,u)){let t="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)a=o.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(u))a=o.closeIndex;else{const n=this.readStopNodeData(e,l,p+1);if(!n)throw new Error(`Unexpected end of ${l}`);a=n.i,t=n.tagContent}const r=new i(u);u!==c&&d&&(r[":@"]=this.buildAttributesMap(c,s,u)),t&&(t=this.parseTextData(t,u,s,!0,d,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),r.add(this.options.textNodeName,t),this.addChild(n,r,s)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){"/"===u[u.length-1]?(u=u.substr(0,u.length-1),s=s.substr(0,s.length-1),c=u):c=c.substr(0,c.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const e=new i(u);u!==c&&d&&(e[":@"]=this.buildAttributesMap(c,s,u)),this.addChild(n,e,s),s=s.substr(0,s.lastIndexOf("."))}else{const e=new i(u);this.tagsNodeStack.push(n),u!==c&&d&&(e[":@"]=this.buildAttributesMap(c,s,u)),this.addChild(n,e,s),n=e}r="",a=p}}else r+=e[a]}return t.child};function f(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 h=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 g(e,t,n,r){return e&&(void 0===r&&(r=0===Object.keys(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 m(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 u=o,l=!0;-1!==a&&(u=o.substring(0,a),o=o.substring(a+1).trimStart());const c=u;if(n){const e=u.indexOf(":");-1!==e&&(u=u.substr(e+1),l=u!==i.data.substr(e+1))}return{tagName:u,tagExp:o,closeIndex:s,attrExpPresent:l,rawTagName:c}}function y(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 x(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:"₹"}},this.addExternalEntities=a,this.parseXml=p,this.parseTextData=u,this.resolveNameSpace=l,this.buildAttributesMap=d,this.isItStopNode=m,this.replaceEntitiesValue=h,this.readStopNodeData=y,this.saveTextToParentTag=g,this.addChild=f}}},702:(e,t,n)=>{const{buildOptions:r}=n(911),i=n(575),{prettify:o}=n(625),s=n(730);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 '&#xD;'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}}},625:(e,t)=>{"use strict";function n(e,t,s){let a;const u={};for(let l=0;l<e.length;l++){const c=e[l],d=r(c);let p="";if(p=void 0===s?d:s+"."+d,d===t.textNodeName)void 0===a?a=c[d]:a+=""+c[d];else{if(void 0===d)continue;if(c[d]){let e=n(c[d],t,p);const r=o(e,t);c[":@"]?i(e,c[":@"],p,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!==u[d]&&u.hasOwnProperty(d)?(Array.isArray(u[d])||(u[d]=[u[d]]),u[d].push(e)):t.isArray(d,p,r)?u[d]=[e]:u[d]=e}}}return"string"==typeof a?a.length>0&&(u[t.textNodeName]=a):void 0!==a&&(u[t.textNodeName]=a),u}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)}},601: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})}}},396:e=>{const t=/^[-+]?0x[a-fA-F0-9]+$/,n=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const 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(i.hex&&t.test(o))return Number.parseInt(o,16);{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]);const a=t[4]||t[6];if(!i.leadingZeros&&r.length>0&&n&&"."!==o[2])return e;if(!i.leadingZeros&&r.length>0&&!n&&"."!==o[1])return e;{const t=Number(o),u=""+t;return-1!==u.search(/[eE]/)||a?i.eNotation?t:e:-1!==o.indexOf(".")?"0"===u&&""===s||u===s||n&&u==="-"+s?t:e:r?s===u||n+s===u?t:e:o===u||o===n+u?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,t,n){if("string"==typeof e)throw new Error(`An HTML element ("${String(e)}") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`);if(!e)throw new Error("A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.");return e({...t,key:n})}function t(t,n,r){return e(t,n,r)}function i(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}n.r(r),n.d(r,{onHomePage:()=>pr,onRpcRequest:()=>dr,onTransaction:()=>fr,onUserInput:()=>hr});var o=(e,t)=>Object.hasOwnProperty.call(e,t);var s,a=((s=a||{})[s.Null=4]="Null",s[s.Comma=1]="Comma",s[s.Wrapper=1]="Wrapper",s[s.True=4]="True",s[s.False=5]="False",s[s.Quote=1]="Quote",s[s.Colon=1]="Colon",s[s.Date=24]="Date",s);function u(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}}class l 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 c(e){return"object"==typeof e&&null!=e}function d(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function p(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:u=`Expected a value of type \`${s}\`${a?` with refinement \`${a}\``:""}, but received: \`${d(r)}\``}=e;return{value:r,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...e,message:u}}function*f(e,t,n,r){var i;c(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const i of e){const e=p(i,t,n,r);e&&(yield e)}}function*h(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&&c(t.schema)&&c(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,a))r.explanation=n.message,u="not_valid",yield[r,void 0];for(let[l,d,p]of t.entries(e,a)){const t=h(d,p,{path:void 0===l?r:[...r,l],branch:void 0===l?i:[...i,d],coerce:o,mask:s,message:n.message});for(const n of t)n[0]?(u=null!=n[0].refinement?"not_refined":"not_valid",yield[n[0],void 0]):o&&(d=n[1],void 0===l?e=d:e instanceof Map?e.set(l,d):e instanceof Set?e.add(d):c(e)&&(void 0!==d||l in e)&&(e[l]=d))}if("not_valid"!==u)for(const r of t.refiner(e,a))r.explanation=n.message,u="not_refined",yield[r,void 0];"valid"===u&&(yield[void 0,e])}class g{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)=>f(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>f(i(e,t),t,this,e):()=>[]}assert(e,t){return m(e,this,t)}create(e,t){return v(e,this,t)}is(e){return b(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)}}function m(e,t,n){const r=y(e,t,{message:n});if(r[0])throw r[0]}function v(e,t,n){const r=y(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function b(e,t){return!y(e,t)[0]}function y(e,t,n={}){const r=h(e,t,n),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(i[0]){return[new l(i[0],(function*(){for(const e of r)e[0]&&(yield e[0])})),void 0]}return[void 0,i[1]]}function x(...e){const t="type"===e[0].type,n=e.map((e=>e.schema)),r=Object.assign({},...n);return t?_(r):I(r)}function N(e,t){return new g({type:e,schema:null,validator:t})}function E(e){let t;return new g({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 w(e){return new g({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: ${d(e)}`})}function O(){return N("boolean",(e=>"boolean"==typeof e))}function T(e){const t=d(e),n=typeof e;return new g({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${d(n)}`})}function P(){return N("never",(()=>!1))}function A(e){return new g({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}function S(){return N("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${d(e)}`))}function I(e){const t=e?Object.keys(e):[],n=P();return new g({type:"object",schema:e||null,*entries(r){if(e&&c(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=>c(e)||`Expected an object, but received: ${d(e)}`,coercer:e=>c(e)?{...e}:e})}function j(e){return new g({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function k(e,t){return new g({type:"record",schema:null,*entries(n){if(c(n))for(const r in n){const i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>c(e)||`Expected an object, but received: ${d(e)}`})}function C(){return N("string",(e=>"string"==typeof e||`Expected a string, but received: ${d(e)}`))}function $(e){const t=P();return new g({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let i=0;i<r;i++)yield[i,n[i],e[i]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${d(e)}`})}function _(e){const t=Object.keys(e);return new g({type:"type",schema:e,*entries(n){if(c(n))for(const r of t)yield[r,n[r],e[r]]},validator:e=>c(e)||`Expected an object, but received: ${d(e)}`,coercer:e=>c(e)?{...e}:e})}function F(e){const t=e.map((e=>e.type)).join(" | ");return new g({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]=h(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: ${d(n)}`,...i]}})}function R(){return N("unknown",(()=>!0))}function D(e,t,n){return new g({...e,coercer:(r,i)=>b(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)})}function V(e,t){return B(e,"pattern",(n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`))}function B(e,t,n){return new g({...e,*refiner(r,i){yield*e.refiner(r,i);const o=f(n(r,i),i,e,r);for(const e of o)yield{...e,refinement:t}}})}function L(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 M(e,t){return n=e,Boolean("string"==typeof n?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var n}var J=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function q(e,t="Assertion failed.",n=J){if(!e){if(t instanceof Error)throw t;throw M(n,t)}}function U(e,t,n="Assertion failed",r=J){try{m(e,t)}catch(e){throw M(r,`${n}: ${L(e)}.`)}}var X=e=>I(e);function G({path:e,branch:t}){const n=e[e.length-1];return o(t[t.length-2],n)}function z(e){return new g({...e,type:`optional ${e.type}`,validator:(t,n)=>!G(n)||e.validator(t,n),refiner:(t,n)=>!G(n)||e.refiner(t,n)})}var W=F([T(null),O(),N("finite number",(e=>b(e,S())&&Number.isFinite(e))),C(),w(E((()=>W))),k(C(),E((()=>W)))]),H=D(W,N("any",(()=>!0)),(e=>(U(e,W),JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))))));function Y(e){try{return function(e){v(e,H)}(e),!0}catch{return!1}}var Z=T("2.0"),Q=A(F([S(),C()])),K=X({code:N("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${d(e)}`)),message:C(),data:z(H),stack:z(C())}),ee=F([k(C(),H),w(H)]);X({id:Q,jsonrpc:Z,method:C(),params:z(ee)}),X({jsonrpc:Z,method:C(),params:z(ee)});I({id:Q,jsonrpc:Z,result:j(R()),error:j(K)});var te=X({id:Q,jsonrpc:Z,result:H}),ne=X({id:Q,jsonrpc:Z,error:K});F([te,ne]);var re=n(525),ie={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},oe={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901},se={"-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."}},ae=ie.internal,ue="Unspecified error message. This is a bug, please report it.",le=(ce(ae),"Unspecified server error.");function ce(e,t=ue){if(function(e){return Number.isInteger(e)}(e)){const t=e.toString();if(o(se,t))return se[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return le}return t}function de(e){return Array.isArray(e)?e.map((e=>Y(e)?e:i(e)?pe(e):null)):i(e)?pe(e):Y(e)?e:null}function pe(e){return Object.getOwnPropertyNames(e).reduce(((t,n)=>{const r=e[n];return Y(r)&&(t[n]=r),t}),{})}var fe=n(12),he=class 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.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,u(this.data)&&(e.data.cause=de(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return fe(this.serialize(),me,2)}},ge=class extends he{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 me(e,t){if("[Circular]"!==t)return t}var ve=e=>$e(ie.parse,e),be=e=>$e(ie.invalidRequest,e),ye=e=>$e(ie.invalidParams,e),xe=e=>$e(ie.methodNotFound,e),Ne=e=>$e(ie.internal,e),Ee=e=>$e(ie.invalidInput,e),we=e=>$e(ie.resourceNotFound,e),Oe=e=>$e(ie.resourceUnavailable,e),Te=e=>$e(ie.transactionRejected,e),Pe=e=>$e(ie.methodNotSupported,e),Ae=e=>$e(ie.limitExceeded,e),Se=e=>_e(oe.userRejectedRequest,e),Ie=e=>_e(oe.unauthorized,e),je=e=>_e(oe.unsupportedMethod,e),ke=e=>_e(oe.disconnected,e),Ce=e=>_e(oe.chainDisconnected,e);function $e(e,t){const[n,r]=Fe(t);return new he(e,n??ce(e),r)}function _e(e,t){const[n,r]=Fe(t);return new ge(e,n??ce(e),r)}function Fe(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(){const e=[]}();V(C(),/^(?:0x)?[0-9a-f]+$/iu),V(C(),/^0x[0-9a-f]+$/iu),V(C(),/^0x[0-9a-f]{40}$/u);var Re=V(C(),/^0x[0-9a-fA-F]{40}$/u);function De(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}var Ve,Be,Le,Me,Je=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},qe=(e,t,n)=>(Je(e,t,"read from private field"),n?n.call(e):t.get(e)),Ue=(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)},Xe=(e,t,n,r)=>(Je(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ge=class extends Error{constructor(e,t={}){const n=function(e){if(i(e)&&o(e,"message")&&"string"==typeof e.message)return e.message;return String(e)}(e);super(n),Ue(this,Ve,void 0),Ue(this,Be,void 0),Ue(this,Le,void 0),Ue(this,Me,void 0),Xe(this,Be,n),Xe(this,Ve,function(e){if(i(e)&&o(e,"code")&&"number"==typeof e.code&&Number.isInteger(e.code))return e.code;return-32603}(e));const r={...Ye(e),...t};Object.keys(r).length>0&&Xe(this,Le,r),Xe(this,Me,super.stack)}get name(){return"SnapError"}get code(){return qe(this,Ve)}get message(){return qe(this,Be)}get data(){return qe(this,Le)}get stack(){return qe(this,Me)}toJSON(){return{code:We,message:He,data:{cause:{code:this.code,message:this.message,stack:this.stack,...this.data?{data:this.data}:{}}}}}serialize(){return this.toJSON()}};function ze(e){return class extends Ge{constructor(t,n){if("object"==typeof t){const n=e();return void super({code:n.code,message:n.message,data:t})}const r=e(t);super({code:r.code,message:r.message,data:n})}}}Ve=new WeakMap,Be=new WeakMap,Le=new WeakMap,Me=new WeakMap;var We=-31002,He="Snap Error";function Ye(e){return i(e)&&o(e,"data")&&"object"==typeof e.data&&null!==e.data&&Y(e.data)&&!Array.isArray(e.data)?e.data:{}}function Ze(e){return N(JSON.stringify(e),T(e).validator)}function Qe(e){return Ze(e)}function Ke(e){return function([e,...t]){const n=F([e,...t]);return new g({...n,schema:[e,...t]})}(e)}function et(e){try{return function(e){try{const t=e.trim();q(t.length>0);const n=new re.XMLParser({ignoreAttributes:!1,parseAttributeValue:!0}).parse(t,!0);return q(o(n,"svg")),i(n.svg)?n.svg:{}}catch{throw new Error("Snap icon must be a valid SVG.")}}(e),!0}catch{return!1}}ze(Ne),ze(Ee),ze(ye),ze(be),ze(Ae);var tt=ze(xe);ze(Pe),ze(ve),ze(we),ze(Oe),ze(Te),ze(Ce),ze(ke),ze(Ie),ze(je),ze(Se);function nt(e,t,n=[]){return(...r)=>{if(1===r.length&&u(r[0])){const n={...r[0],type:e};return U(n,t,`Invalid ${e} component`),n}const i=n.reduce(((e,t,n)=>void 0!==r[n]?{...e,[t]:r[n]}:e),{type:e});return U(i,t,`Invalid ${e} component`),i}}var rt,it=((rt=it||{}).Copyable="copyable",rt.Divider="divider",rt.Heading="heading",rt.Panel="panel",rt.Spinner="spinner",rt.Text="text",rt.Image="image",rt.Row="row",rt.Address="address",rt.Button="button",rt.Input="input",rt.Form="form",rt),ot=I({type:C()}),st=x(ot,I({value:R()})),at=x(st,I({type:T("address"),value:Re})),ut=(nt("address",at,["value"]),x(st,I({type:T("copyable"),value:C(),sensitive:j(O())}))),lt=(nt("copyable",ut,["value","sensitive"]),x(ot,I({type:T("divider")}))),ct=(nt("divider",lt),x(st,I({type:T("heading"),value:C()})));nt("heading",ct,["value"]);var dt,pt,ft,ht,gt=x(ot,I({type:T("image"),value:B(C(),"SVG",(e=>!!et(e)||"Value is not a valid SVG."))})),mt=(nt("image",gt,["value"]),(dt=mt||{}).Primary="primary",dt.Secondary="secondary",dt),vt=((pt=vt||{}).Button="button",pt.Submit="submit",pt),bt=x(st,I({type:T("button"),value:C(),variant:j(F([Qe("primary"),Qe("secondary")])),buttonType:j(F([Qe("button"),Qe("submit")])),name:j(C())})),yt=(nt("button",bt,["value","buttonType","name","variant"]),(ft=yt||{}).Text="text",ft.Number="number",ft.Password="password",ft),xt=x(st,I({type:T("input"),value:j(C()),name:C(),inputType:j(F([Qe("text"),Qe("password"),Qe("number")])),placeholder:j(C()),label:j(C()),error:j(C())})),Nt=(nt("input",xt,["name","inputType","placeholder","value","label"]),F([xt,bt])),Et=x(ot,I({type:T("form"),children:w(Nt),name:C()})),wt=(nt("form",Et,["name","children"]),x(st,I({type:T("text"),value:C(),markdown:j(O())}))),Ot=(nt("text",wt,["value","markdown"]),(ht=Ot||{}).Default="default",ht.Critical="critical",ht.Warning="warning",ht),Tt=F([gt,wt,at]),Pt=x(st,I({type:T("row"),variant:j(F([Qe("default"),Qe("critical"),Qe("warning")])),label:C(),value:Tt})),At=(nt("row",Pt,["label","value","variant"]),x(ot,I({type:T("spinner")}))),St=(nt("spinner",At),x(ot,I({children:w(E((()=>jt)))}))),It=x(St,I({type:T("panel")})),jt=(nt("panel",It,["children"]),F([ut,lt,ct,gt,It,At,wt,Pt,at,xt,Et,bt]));var kt,Ct,$t,_t,Ft,Rt,Dt=((kt=Dt||{}).Critical="critical",kt),Vt=((Ct=Vt||{}).ButtonClickEvent="ButtonClickEvent",Ct.FormSubmitEvent="FormSubmitEvent",Ct.InputChangeEvent="InputChangeEvent",Ct),Bt=I({type:C(),name:j(C())}),Lt=(F([x(Bt,I({type:T("ButtonClickEvent"),name:j(C())})),x(Bt,I({type:T("FormSubmitEvent"),value:k(C(),A(C())),name:C()})),x(Bt,I({type:T("InputChangeEvent"),name:C(),value:C()}))]),($t=Lt||{}).Alert="alert",$t.Confirmation="confirmation",$t.Prompt="prompt",$t),Mt=((_t=Mt||{}).Base64="base64",_t.Hex="hex",_t.Utf8="utf8",_t),Jt=((Ft=Jt||{}).ClearState="clear",Ft.GetState="get",Ft.UpdateState="update",Ft),qt=((Rt=qt||{}).InApp="inApp",Rt.Native="native",Rt),Ut=Ke([C(),S()]),Xt=Gt(C());I({type:C(),props:k(C(),H),key:A(Ut)});function Gt(e){return Ke([e,w(e)])}function zt(e,t={}){return I({type:Ze(e),props:I(t),key:A(Ut)})}var Wt=zt("Button",{children:Xt,name:j(C()),type:j(Ke([Ze("button"),Ze("submit")])),variant:j(Ke([Ze("primary"),Ze("destructive")])),disabled:j(O())}),Ht=zt("Input",{name:C(),type:j(Ke([Ze("text"),Ze("password"),Ze("number")])),value:j(C()),placeholder:j(C())}),Yt=zt("Option",{value:C(),children:C()}),Zt=zt("Dropdown",{name:C(),value:j(C()),children:Gt(Yt)}),Qt=zt("Field",{label:j(C()),error:j(C()),children:Ke([$([Ht,Wt]),Ht,Zt])}),Kt=zt("Form",{children:Gt(Ke([Qt,Wt])),name:C()}),en=zt("Bold",{children:Gt(A(Ke([C(),E((()=>tn))])))}),tn=zt("Italic",{children:Gt(A(Ke([C(),E((()=>en))])))}),nn=Ke([en,tn]),rn=zt("Address",{address:Re}),on=zt("Box",{children:Gt(A(E((()=>gn)))),direction:j(Ke([Ze("horizontal"),Ze("vertical")])),alignment:j(Ke([Ze("start"),Ze("center"),Ze("end"),Ze("space-between"),Ze("space-around")]))}),sn=zt("Copyable",{value:C(),sensitive:j(O())}),an=zt("Divider"),un=zt("Value",{value:C(),extra:C()}),ln=zt("Heading",{children:Xt}),cn=zt("Image",{src:C(),alt:j(C())}),dn=zt("Link",{href:C(),children:Gt(A(Ke([nn,C()])))}),pn=zt("Text",{children:Gt(A(Ke([C(),en,tn,dn])))}),fn=zt("Row",{label:C(),children:Ke([rn,cn,pn,un]),variant:j(Ke([Ze("default"),Ze("warning"),Ze("error")]))}),hn=zt("Spinner"),gn=Ke([Wt,Ht,Kt,en,tn,rn,on,sn,an,ln,cn,dn,fn,hn,pn,Zt]),mn=gn,vn=(Ke([Wt,Ht,Qt,Kt,en,tn,rn,on,sn,an,ln,cn,dn,fn,hn,pn,Zt,Yt,un]),k(C(),A(C())));k(C(),F([vn,A(C())])),F([jt,mn]),k(C(),H);function bn(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e)))}function yn(e){return t=>{const{key:n=null,...r}=t;return{type:e,props:bn(r),key:n}}}var xn=yn("Button"),Nn=yn("Dropdown"),En=yn("Option"),wn=yn("Field"),On=yn("Form"),Tn=yn("Input"),Pn=yn("Bold"),An=(yn("Italic"),yn("Address")),Sn=yn("Box"),In=yn("Copyable"),jn=(yn("Divider"),yn("Value"),yn("Heading")),kn=(yn("Image"),yn("Link"),yn("Row")),Cn=(yn("Spinner"),yn("Text"));function $n(e){return N(JSON.stringify(e),T(e).validator)}function _n(e){return function([e,...t]){const n=F([e,...t]);return new g({...n,schema:[e,...t]})}(e)}var Fn=_n([C(),S()]),Rn=Dn(C());I({type:C(),props:k(C(),H),key:A(Fn)});function Dn(e){return _n([e,w(e)])}function Vn(e,t={}){return I({type:$n(e),props:I(t),key:A(Fn)})}var Bn=Vn("Button",{children:Rn,name:j(C()),type:j(_n([$n("button"),$n("submit")])),variant:j(_n([$n("primary"),$n("destructive")])),disabled:j(O())}),Ln=Vn("Input",{name:C(),type:j(_n([$n("text"),$n("password"),$n("number")])),value:j(C()),placeholder:j(C())}),Mn=Vn("Option",{value:C(),children:C()}),Jn=Vn("Dropdown",{name:C(),value:j(C()),children:Dn(Mn)}),qn=Vn("Field",{label:j(C()),error:j(C()),children:_n([$([Ln,Bn]),Ln,Jn])}),Un=Vn("Form",{children:Dn(_n([qn,Bn])),name:C()}),Xn=Vn("Bold",{children:Dn(A(_n([C(),E((()=>Gn))])))}),Gn=Vn("Italic",{children:Dn(A(_n([C(),E((()=>Xn))])))}),zn=_n([Xn,Gn]),Wn=Vn("Address",{address:Re}),Hn=Vn("Box",{children:Dn(A(E((()=>or)))),direction:j(_n([$n("horizontal"),$n("vertical")])),alignment:j(_n([$n("start"),$n("center"),$n("end"),$n("space-between"),$n("space-around")]))}),Yn=Vn("Copyable",{value:C(),sensitive:j(O())}),Zn=Vn("Divider"),Qn=Vn("Value",{value:C(),extra:C()}),Kn=Vn("Heading",{children:Rn}),er=Vn("Image",{src:C(),alt:j(C())}),tr=Vn("Link",{href:C(),children:Dn(A(_n([zn,C()])))}),nr=Vn("Text",{children:Dn(A(_n([C(),Xn,Gn,tr])))}),rr=Vn("Row",{label:C(),children:_n([Wn,er,nr,Qn]),variant:j(_n([$n("default"),$n("warning"),$n("error")]))}),ir=Vn("Spinner"),or=_n([Bn,Ln,Un,Xn,Gn,Wn,Hn,Yn,Zn,Kn,er,tr,rr,ir,nr,Jn]);_n([Bn,Ln,qn,Un,Xn,Gn,Wn,Hn,Yn,Zn,Kn,er,tr,rr,ir,nr,Jn,Mn,Qn]);const sr=()=>t(Sn,{children:[e(jn,{children:"Interactive UI Example Snap"}),t(On,{name:"example-form",children:[e(wn,{label:"Example Input",children:e(Tn,{name:"example-input",placeholder:"Enter something..."})}),e(wn,{label:"Example Dropdown",children:t(Nn,{name:"example-dropdown",children:[e(En,{value:"option1",children:"Option 1"}),e(En,{value:"option2",children:"Option 2"}),e(En,{value:"option3",children:"Option 3"})]})}),e(xn,{type:"submit",name:"submit",children:"Submit"})]})]}),ar=({from:n,to:r})=>t(Sn,{children:[e(kn,{label:"From",children:e(An,{address:n})}),e(kn,{label:"To",children:r?e(An,{address:n}):e(Cn,{children:"None"})}),e(xn,{name:"transaction-type",children:"See transaction type"})]}),ur=({type:n})=>t(Sn,{children:[e(kn,{label:"Transaction Type",children:e(Cn,{children:e(Pn,{children:n})})}),e(xn,{name:"go-back",children:"Back"})]}),lr=({values:n})=>t(Sn,{children:[e(jn,{children:"Interactive UI Example Snap"}),e(Cn,{children:"You submitted the following values:"}),e(Sn,{children:Object.values(n).map((t=>e(In,{value:t??""})))}),e(xn,{name:"back",children:"Back"})]}),cr=[{name:"ERC-20",signature:"a9059cbb"},{name:"ERC-721",signature:"23b872dd"},{name:"ERC-1155",signature:"f242432a"}];const dr=async({request:t})=>{if("dialog"===t.method)return await snap.request({method:"snap_dialog",params:{type:"confirmation",content:e(sr,{})}});throw new tt({method:t.method})},pr=async()=>({content:e(sr,{})}),fr=async({transaction:t})=>{const{from:n,to:r}=t;return{id:await snap.request({method:"snap_createInterface",params:{ui:e(ar,{from:n,to:r}),context:{transaction:t}}})}},hr=async({id:t,event:n,context:r})=>{if(n.type===Vt.ButtonClickEvent)switch(n.name){case"transaction-type":{var i;const n=function(e){if(e&&"string"==typeof e){var t;const n=De(e).slice(0,8);return(null===(t=cr.find((e=>e.signature===n)))||void 0===t?void 0:t.name)??"Unknown"}return"Unknown"}((null===(i=r)||void 0===i?void 0:i.transaction).data);await snap.request({method:"snap_updateInterface",params:{id:t,ui:e(ur,{type:n})}});break}case"go-back":{var o;const n=null===(o=r)||void 0===o?void 0:o.transaction;await snap.request({method:"snap_updateInterface",params:{id:t,ui:e(ar,{from:n.from,to:n.to})}});break}case"back":await snap.request({method:"snap_updateInterface",params:{id:t,ui:e(sr,{})}})}n.type===Vt.FormSubmitEvent&&"example-form"===n.name&&await snap.request({method:"snap_updateInterface",params:{id:t,ui:e(lr,{values:n.value})}})}})();var i=exports;for(var o in r)i[o]=r[o];r.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/interactive-ui-example-snap",
3
- "version": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "description": "MetaMask example snap demonstrating the use of interactive UI.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,19 +30,19 @@
30
30
  "lint:dependencies": "depcheck"
31
31
  },
32
32
  "dependencies": {
33
- "@metamask/snaps-sdk": "^3.2.0",
33
+ "@metamask/snaps-sdk": "^4.3.0",
34
34
  "@metamask/utils": "^8.3.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@jest/globals": "^29.5.0",
38
- "@lavamoat/allow-scripts": "^3.0.3",
38
+ "@lavamoat/allow-scripts": "^3.0.4",
39
39
  "@metamask/auto-changelog": "^3.4.4",
40
40
  "@metamask/eslint-config": "^12.1.0",
41
41
  "@metamask/eslint-config-jest": "^12.1.0",
42
42
  "@metamask/eslint-config-nodejs": "^12.1.0",
43
43
  "@metamask/eslint-config-typescript": "^12.1.0",
44
- "@metamask/snaps-cli": "^6.1.0",
45
- "@metamask/snaps-jest": "^6.0.2",
44
+ "@metamask/snaps-cli": "^6.2.0",
45
+ "@metamask/snaps-jest": "^8.1.0",
46
46
  "@swc/core": "1.3.78",
47
47
  "@swc/jest": "^0.2.26",
48
48
  "@typescript-eslint/eslint-plugin": "^5.42.1",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.1",
2
+ "version": "2.0.0",
3
3
  "description": "MetaMask example snap demonstrating the use of interactive UI",
4
4
  "proposedName": "Interactive UI Example Snap",
5
5
  "repository": {
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/MetaMask/snaps.git"
8
8
  },
9
9
  "source": {
10
- "shasum": "opdcmTNMX2T252PmyJIM5ctTJvFr2OzddoIHYXMBgew=",
10
+ "shasum": "Bzph8qHiipWZxvfPRRIF8uTNn/B6vsru5Y/iM4oncuo=",
11
11
  "location": {
12
12
  "npm": {
13
13
  "filePath": "dist/bundle.js",
@@ -23,8 +23,7 @@
23
23
  },
24
24
  "snap_dialog": {},
25
25
  "endowment:transaction-insight": {},
26
- "endowment:page-home": {},
27
- "snap_manageState": {}
26
+ "endowment:page-home": {}
28
27
  },
29
28
  "manifestVersion": "0.1"
30
29
  }